]> git.baikalelectronics.ru Git - kernel.git/commit
net: qed: fix left elements count calculation
authorAlexander Lobakin <alobakin@marvell.com>
Tue, 23 Jun 2020 13:51:29 +0000 (16:51 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Jun 2020 22:01:16 +0000 (15:01 -0700)
commit6117f46c93f6e593309fa2d77b295bf6e1a943cc
treeec3ae7b777523d72de6c13a556020ef7cd1da008
parent97733b9046e874882c3769b5a4f48da51bcb05df
net: qed: fix left elements count calculation

qed_chain_get_element_left{,_u32} returned 0 when the difference
between producer and consumer page count was equal to the total
page count.
Fix this by conditional expanding of producer value (vs
unconditional). This allowed to eliminate normalizaton against
total page count, which was the cause of this bug.

Misc: replace open-coded constants with common defines.

Fixes: 7d9bd3fa3169 ("qed: Revisit chain implementation")
Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/qed/qed_chain.h