net/bnxt: fix buffer allocation reattempt

In case of a buffer allocation failure, we reattempt buffer allocation
before the Rx handler exits. We were not attempting this when producer
index is greater than the number of buffers to allocate. Fixed it with
correct checks.

Fixes: d9dd0b29ed31 ("net/bnxt: fix Rx handling and buffer allocation logic")
Cc: stable@dpdk.org

Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
This commit is contained in:
Santoshkumar Karanappa Rastapur 2020-02-06 22:03:14 +05:30 committed by Ferruh Yigit
parent 623ac30bfa
commit 01829dea73

View File

@ -678,10 +678,11 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
/* Attempt to alloc Rx buf in case of a previous allocation failure. */
if (rc == -ENOMEM) {
int i;
int i = RING_NEXT(rxr->rx_ring_struct, prod);
int cnt = nb_rx_pkts;
for (i = prod; i <= nb_rx_pkts;
i = RING_NEXT(rxr->rx_ring_struct, i)) {
for (; cnt;
i = RING_NEXT(rxr->rx_ring_struct, i), cnt--) {
struct bnxt_sw_rx_bd *rx_buf = &rxr->rx_buf_ring[i];
/* Buffer already allocated for this index. */