Commit e5f98bc0 authored by Dave Jiang's avatar Dave Jiang Committed by sanglipeng
Browse files

ntb: Fix calculation ntb_transport_tx_free_entry()

stable inclusion
from stable-v5.10.195
commit 3d8d13a174ef46a1bd96870ca33e9bd238c21060
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I95JOC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3d8d13a174ef46a1bd96870ca33e9bd238c21060



--------------------------------

commit 5a7693e6 upstream.

ntb_transport_tx_free_entry() never returns 0 with the current
calculation. If head == tail, then it would return qp->tx_max_entry.
Change compare to tail >= head and when they are equal, a 0 would be
returned.

Fixes: e74bfeed ("NTB: Add flow control to the ntb_netdev")
Reviewed-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Signed-off-by: default avatarrenlonglong <ren.longlong@h3c.com>
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent dc4c5522
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment