net/bnxt: support Rx descriptor status
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Thu, 28 Sep 2017 21:43:36 +0000 (16:43 -0500)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 6 Oct 2017 00:49:49 +0000 (02:49 +0200)
Add support for rx_descriptor_status dev_op

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
doc/guides/nics/features/bnxt.ini
drivers/net/bnxt/bnxt_ethdev.c

index 119132e..22d05cc 100644 (file)
@@ -17,6 +17,7 @@ RSS reta update      = Y
 SR-IOV               = Y
 VLAN filter          = Y
 VLAN offload         = Y
+Rx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 FW version           = Y
index 5c68797..12888e6 100644 (file)
@@ -1572,6 +1572,44 @@ nothing_to_do:
        return desc;
 }
 
+static int
+bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset)
+{
+       struct bnxt_rx_queue *rxq = (struct bnxt_rx_queue *)rx_queue;
+       struct bnxt_rx_ring_info *rxr;
+       struct bnxt_cp_ring_info *cpr;
+       struct bnxt_sw_rx_bd *rx_buf;
+       struct rx_pkt_cmpl *rxcmp;
+       uint32_t cons, cp_cons;
+
+       if (!rxq)
+               return -EINVAL;
+
+       cpr = rxq->cp_ring;
+       rxr = rxq->rx_ring;
+
+       if (offset >= rxq->nb_rx_desc)
+               return -EINVAL;
+
+       cons = RING_CMP(cpr->cp_ring_struct, offset);
+       cp_cons = cpr->cp_raw_cons;
+       rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
+
+       if (cons > cp_cons) {
+               if (CMPL_VALID(rxcmp, cpr->valid))
+                       return RTE_ETH_RX_DESC_DONE;
+       } else {
+               if (CMPL_VALID(rxcmp, !cpr->valid))
+                       return RTE_ETH_RX_DESC_DONE;
+       }
+       rx_buf = &rxr->rx_buf_ring[cons];
+       if (rx_buf->mbuf == NULL)
+               return RTE_ETH_RX_DESC_UNAVAIL;
+
+
+       return RTE_ETH_RX_DESC_AVAIL;
+}
+
 /*
  * Initialization
  */
@@ -1622,6 +1660,7 @@ static const struct eth_dev_ops bnxt_dev_ops = {
        .xstats_get_by_id = bnxt_dev_xstats_get_by_id_op,
        .xstats_get_names_by_id = bnxt_dev_xstats_get_names_by_id_op,
        .rx_queue_count = bnxt_rx_queue_count_op,
+       .rx_descriptor_status = bnxt_rx_descriptor_status_op,
 };
 
 static bool bnxt_vf_pciid(uint16_t id)