Skip to content

Commit 5a7693e

Browse files
davejiangjonmason
authored andcommitted
ntb: Fix calculation ntb_transport_tx_free_entry()
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: e74bfee ("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>
1 parent f195a1a commit 5a7693e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/ntb/ntb_transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2429,7 +2429,7 @@ unsigned int ntb_transport_tx_free_entry(struct ntb_transport_qp *qp)
24292429
unsigned int head = qp->tx_index;
24302430
unsigned int tail = qp->remote_rx_info->entry;
24312431

2432-
return tail > head ? tail - head : qp->tx_max_entry + tail - head;
2432+
return tail >= head ? tail - head : qp->tx_max_entry + tail - head;
24332433
}
24342434
EXPORT_SYMBOL_GPL(ntb_transport_tx_free_entry);
24352435

0 commit comments

Comments
 (0)