net/bnxt: fix Rx next consumer index in mbuf alloc fail
authorSomnath Kotur <somnath.kotur@broadcom.com>
Wed, 17 Nov 2021 03:12:06 +0000 (08:42 +0530)
committerAjit Khaparde <ajit.khaparde@broadcom.com>
Wed, 17 Nov 2021 03:57:19 +0000 (04:57 +0100)
The driver internal variable to track the next consumer index on
the Rx ring was not being set if there was an mbuf allocation
failure. In that scenario, eventually it would fall out of sync
with the actual consumer index and raise a false alarm on Thor
needlessly causing a segmentation fault with testpmd

Fixes: 03c8f2fe111c ("net/bnxt: detect bad opaque in Rx completion")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
drivers/net/bnxt/bnxt_rxr.c

index 157297b..e2f09ad 100644 (file)
@@ -986,6 +986,7 @@ reuse_rx_mbuf:
                goto rx;
        }
        rxr->rx_raw_prod = raw_prod;
+rx:
        rxr->rx_next_cons = RING_IDX(rxr->rx_ring_struct, RING_NEXT(cons));
 
        if (BNXT_TRUFLOW_EN(bp) && (BNXT_VF_IS_TRUSTED(bp) || BNXT_PF(bp)) &&
@@ -1004,7 +1005,6 @@ reuse_rx_mbuf:
         * All MBUFs are allocated with the same size under DPDK,
         * no optimization for rx_copy_thresh
         */
-rx:
        *rx_pkt = mbuf;
 
 next_rx: