[dpdk-dev,4/8] net/bnxt: add support for rx_descriptor_done

Message ID 20170824162956.62761-6-ajit.khaparde@broadcom.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Ajit Khaparde Aug. 24, 2017, 4:29 p.m. UTC
  add support for rx_descriptor_done dev_op
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
  

Comments

Ferruh Yigit Aug. 29, 2017, 4:11 p.m. UTC | #1
On 8/24/2017 5:29 PM, Ajit Khaparde wrote:
> add support for rx_descriptor_done dev_op
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

<...>

> @@ -1615,6 +1637,7 @@ static const struct eth_dev_ops bnxt_dev_ops = {
>  	.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,
> +	.rx_descriptor_done   = bnxt_rx_descriptor_done_op,

"rx_descriptor_status" is updated version of the "rx_descriptor_done".
Because "rx_descriptor_status" already implemented, this is not required.

>  };
>  
>  static bool bnxt_vf_pciid(uint16_t id)
>
  

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1d2fd78..1b8e4a9 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1564,6 +1564,28 @@  bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset)
 	return RTE_ETH_RX_DESC_AVAIL;
 }
 
+static int
+bnxt_rx_descriptor_done_op(void *rx_queue, uint16_t offset)
+{
+	struct bnxt_rx_queue *rxq = (struct bnxt_rx_queue *)rx_queue;
+	struct bnxt_cp_ring_info *cpr;
+	struct rx_pkt_cmpl *rxcmp;
+	uint32_t cons;
+
+	if (!rxq)
+		return -EINVAL;
+
+	cpr = rxq->cp_ring;
+
+	if (offset >= rxq->nb_rx_desc)
+		return -EINVAL;
+
+	cons = RING_CMP(cpr->cp_ring_struct, offset);
+	rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
+
+	return !!(CMP_VALID(rxcmp, offset, cpr->cp_ring_struct));
+}
+
 /*
  * Initialization
  */
@@ -1615,6 +1637,7 @@  static const struct eth_dev_ops bnxt_dev_ops = {
 	.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,
+	.rx_descriptor_done   = bnxt_rx_descriptor_done_op,
 };
 
 static bool bnxt_vf_pciid(uint16_t id)