net/bnxt: support Rx queue count
[dpdk.git] / drivers / net / bnxt / bnxt_rxr.c
index 28105b0..3216a6d 100644 (file)
@@ -219,6 +219,9 @@ static int bnxt_agg_bufs_valid(struct bnxt_cp_ring_info *cpr,
        raw_cp_cons = ADV_RAW_CMP(raw_cp_cons, agg_bufs);
        last_cp_cons = RING_CMP(cpr->cp_ring_struct, raw_cp_cons);
        agg_cmpl = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[last_cp_cons];
+       cpr->valid = FLIP_VALID(raw_cp_cons,
+                               cpr->cp_ring_struct->ring_mask,
+                               cpr->valid);
        return CMP_VALID(agg_cmpl, raw_cp_cons, cpr->cp_ring_struct);
 }
 
@@ -360,6 +363,10 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
        if (!CMP_VALID(rxcmp1, tmp_raw_cons, cpr->cp_ring_struct))
                return -EBUSY;
 
+       cpr->valid = FLIP_VALID(cp_cons,
+                               cpr->cp_ring_struct->ring_mask,
+                               cpr->valid);
+
        cmp_type = CMP_TYPE(rxcmp);
        if (cmp_type == RX_PKT_CMPL_TYPE_RX_L2_TPA_START) {
                bnxt_tpa_start(rxq, (struct rx_tpa_start_cmpl *)rxcmp,
@@ -492,14 +499,15 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
        /* Handle RX burst request */
        while (1) {
-               int rc;
-
                cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
                rte_prefetch0(&cpr->cp_desc_ring[cons]);
                rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
 
                if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
                        break;
+               cpr->valid = FLIP_VALID(cons,
+                                       cpr->cp_ring_struct->ring_mask,
+                                       cpr->valid);
 
                /* TODO: Avoid magic numbers... */
                if ((CMP_TYPE(rxcmp) & 0x30) == 0x10) {