DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH v2 15/19] net/bnxt: add support for rx_descriptor_status
Date: Mon, 18 Sep 2017 10:17:51 -0500	[thread overview]
Message-ID: <20170918151755.86605-16-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20170918151755.86605-1-ajit.khaparde@broadcom.com>

add support for rx_descriptor_status dev_op
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
--
v1->v2: incorporate review comments.
---
 doc/guides/nics/features/bnxt.ini |  1 +
 drivers/net/bnxt/bnxt_ethdev.c    | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/doc/guides/nics/features/bnxt.ini b/doc/guides/nics/features/bnxt.ini
index 119132e..e0af1df 100644
--- a/doc/guides/nics/features/bnxt.ini
+++ b/doc/guides/nics/features/bnxt.ini
@@ -21,6 +21,7 @@ Basic stats          = Y
 Extended stats       = Y
 FW version           = Y
 LED                  = Y
+Rx descriptor status = Y
 Linux UIO            = Y
 Linux VFIO           = Y
 x86-64               = Y
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b2272c2..140db0e 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1567,6 +1567,44 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	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
  */
@@ -1617,6 +1655,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)
-- 
2.10.1 (Apple Git-78)

  parent reply	other threads:[~2017-09-18 15:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 15:17 [dpdk-dev] [PATCH v2 00/19] bnxt patch set Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 01/19] net/bnxt: fix HWRM_*() macros and locking Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 02/19] net/bnxt: use 64-bits of address for vlan_table Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 03/19] net/bnxt: fix an issue with group id calculation Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 04/19] net/bnxt: fix calculation of number of pools Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 05/19] net/bnxt: handle multi queue mode properly Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 06/19] net/bnxt: fix rx handling and buffer allocation logic Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 07/19] net/bnxt: fix an issue with broadcast traffic Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 08/19] net/bnxt: fix usage of ETH_VMDQ_* flags Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 09/19] net/bnxt: set checksum offload flags correctly Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 10/19] net/bnxt: update status of Rx IP/L4 CKSUM Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 11/19] net/bnxt: add support for xstats get by id Ajit Khaparde
2017-09-19 12:39   ` Ferruh Yigit
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 12/19] net/bnxt: fix config rss update Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 13/19] net/bnxt: set the hash_key_size Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 14/19] net/bnxt: add support for rx_queue_count Ajit Khaparde
2017-09-18 15:17 ` Ajit Khaparde [this message]
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 16/19] net/bnxt: add support for tx_descriptor_status Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 17/19] net/bnxt: add new HWRM structs to support flow filtering Ajit Khaparde
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 18/19] net/bnxt: add support for flow filter ops Ajit Khaparde
2017-09-19 12:38   ` Ferruh Yigit
2017-09-18 15:17 ` [dpdk-dev] [PATCH v2 19/19] doc: update release notes Ajit Khaparde
2017-09-18 18:46   ` Mcnamara, John
2017-09-19 12:39   ` 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=20170918151755.86605-16-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /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).