DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/8] net/bnxt: add support for rx_queue_count
Date: Thu, 24 Aug 2017 11:29:50 -0500	[thread overview]
Message-ID: <20170824162956.62761-4-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20170824162956.62761-1-ajit.khaparde@broadcom.com>

add support for rx_queue_count dev_op
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1302710..316a167 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1517,6 +1517,28 @@ bnxt_dev_led_off_op(struct rte_eth_dev *dev)
 	return bnxt_hwrm_port_led_cfg(bp, false);
 }
 
+static uint32_t
+bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+{
+	uint32_t desc = 0, raw_cons = 0, cons;
+	struct bnxt_cp_ring_info *cpr;
+	struct bnxt_rx_queue *rxq;
+	struct rx_pkt_cmpl *rxcmp;
+
+	rxq = dev->data->rx_queues[rx_queue_id];
+	cpr = rxq->cp_ring;
+
+	while (raw_cons < rxq->nb_rx_desc) {
+		cons = RING_CMP(cpr->cp_ring_struct, raw_cons++);
+		rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
+
+		if (CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
+			desc++;
+	}
+
+	return desc;
+}
+
 /*
  * Initialization
  */
@@ -1566,6 +1588,7 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.dev_led_off = bnxt_dev_led_off_op,
 	.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,
 };
 
 static bool bnxt_vf_pciid(uint16_t id)
-- 
2.10.1 (Apple Git-78)

  parent reply	other threads:[~2017-08-24 16:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24 16:29 [dpdk-dev] [PATCH 0/8] bnxt patchset Ajit Khaparde
2017-08-24 16:29 ` [dpdk-dev] [PATCH 1/8] net/bnxt: add support for xstats get by id Ajit Khaparde
2017-08-29 16:10   ` Ferruh Yigit
2017-08-24 16:29 ` Ajit Khaparde [this message]
2017-08-29 16:10   ` [dpdk-dev] [PATCH 2/8] net/bnxt: add support for rx_queue_count Ferruh Yigit
2017-08-24 16:29 ` [dpdk-dev] [PATCH 3/8] net/bnxt: add support for rx_descriptor_status Ajit Khaparde
2017-08-29 16:11   ` Ferruh Yigit
2017-08-24 16:29 ` [dpdk-dev] [PATCH 4/8] net/bnxt: add support for rx_descriptor_done Ajit Khaparde
2017-08-29 16:11   ` Ferruh Yigit
2017-08-24 16:29 ` [dpdk-dev] [PATCH 5/8] net/bnxt: add support for tx_descriptor_status Ajit Khaparde
2017-08-29 16:12   ` Ferruh Yigit
2017-08-24 16:29 ` [dpdk-dev] [PATCH 6/8] net/bnxt: add new HWRM structures Ajit Khaparde
2017-08-24 16:29 ` [dpdk-dev] [PATCH 7/8] net/bnxt: fix HWRM_*() macros and locking Ajit Khaparde
2017-08-29 16:12   ` Ferruh Yigit
2017-08-24 16:29 ` [dpdk-dev] [PATCH 8/8] net/bnxt: add support for flow filter ops Ajit Khaparde
2017-08-29 16:16   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170824162956.62761-4-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).