mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
ntb: Fix calculation ntb_transport_tx_free_entry()
commit5a7693e6bb
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:e74bfeedad
("NTB: Add flow control to the ntb_netdev") Reviewed-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: renlonglong <ren.longlong@h3c.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Jon Mason <jdmason@kudzu.us> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
446cb3d0a0
commit
b913f4ffa2
1 changed files with 1 additions and 1 deletions
|
@ -2429,7 +2429,7 @@ unsigned int ntb_transport_tx_free_entry(struct ntb_transport_qp *qp)
|
|||
unsigned int head = qp->tx_index;
|
||||
unsigned int tail = qp->remote_rx_info->entry;
|
||||
|
||||
return tail > head ? tail - head : qp->tx_max_entry + tail - head;
|
||||
return tail >= head ? tail - head : qp->tx_max_entry + tail - head;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ntb_transport_tx_free_entry);
|
||||
|
||||
|
|
Loading…
Reference in a new issue