net/ngbe: fix packet statistics
[dpdk.git] / drivers / net / bnxt / bnxt_rxr.c
index 157297b..b60c247 100644 (file)
@@ -824,6 +824,9 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
 {
        uint32_t cfa_code = 0;
 
+       if (unlikely(bp->mark_table == NULL))
+               return;
+
        cfa_code = rte_le_to_cpu_16(rxcmp1->cfa_code);
        if (!cfa_code)
                return;
@@ -986,6 +989,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 +1008,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:
@@ -1332,9 +1335,9 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
                if (unlikely(!rxr->rx_buf_ring[i])) {
                        if (bnxt_alloc_rx_data(rxq, rxr, raw_prod) != 0) {
                                PMD_DRV_LOG(WARNING,
-                                           "init'ed rx ring %d with %d/%d mbufs only\n",
+                                           "RxQ %d allocated %d of %d mbufs\n",
                                            rxq->queue_id, i, ring->ring_size);
-                               break;
+                               return -ENOMEM;
                        }
                }
                rxr->rx_raw_prod = raw_prod;
@@ -1362,9 +1365,9 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
                if (unlikely(!rxr->ag_buf_ring[i])) {
                        if (bnxt_alloc_ag_data(rxq, rxr, raw_prod) != 0) {
                                PMD_DRV_LOG(WARNING,
-                                           "init'ed AG ring %d with %d/%d mbufs only\n",
+                                           "RxQ %d allocated %d of %d mbufs\n",
                                            rxq->queue_id, i, ring->ring_size);
-                               break;
+                               return -ENOMEM;
                        }
                }
                rxr->ag_raw_prod = raw_prod;
@@ -1408,6 +1411,9 @@ int bnxt_flush_rx_cmp(struct bnxt_cp_ring_info *cpr)
                cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
                rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
 
+               if (!bnxt_cpr_cmp_valid(rxcmp, raw_cons, ring_mask + 1))
+                       break;
+
                if (CMP_TYPE(rxcmp) == CMPL_BASE_TYPE_HWRM_DONE)
                        return 1;