patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, Rahul Gupta <rahul.gupta@broadcom.com>,
	stable@dpdk.org, Somnath Kotur <somnath.kotur@broadcom.com>
Subject: [dpdk-stable] [PATCH v3 13/16] net/bnxt: fix Rx queue count devop
Date: Wed,  2 Oct 2019 10:17:42 -0700	[thread overview]
Message-ID: <20191002171745.4504-14-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20191002171745.4504-1-ajit.khaparde@broadcom.com>

From: Rahul Gupta <rahul.gupta@broadcom.com>

Fix Computing of number of used descriptors in an Rx queue.

Fixes: 1b7ceba3e375 ("net/bnxt: support Rx queue count")
Cc: stable@dpdk.org
Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 74ded7717a..0159be3462 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2096,9 +2096,6 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	struct bnxt_cp_ring_info *cpr;
 	struct bnxt_rx_queue *rxq;
 	struct rx_pkt_cmpl *rxcmp;
-	uint16_t cmp_type;
-	uint8_t cmp = 1;
-	bool valid;
 	int rc;
 
 	rc = is_bnxt_in_error(bp);
@@ -2107,33 +2104,19 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 
 	rxq = dev->data->rx_queues[rx_queue_id];
 	cpr = rxq->cp_ring;
-	valid = cpr->valid;
+	raw_cons = cpr->cp_raw_cons;
 
-	while (raw_cons < rxq->nb_rx_desc) {
+	while (1) {
 		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 (!CMPL_VALID(rxcmp, valid))
-			goto nothing_to_do;
-		valid = FLIP_VALID(cons, cpr->cp_ring_struct->ring_mask, valid);
-		cmp_type = CMP_TYPE(rxcmp);
-		if (cmp_type == RX_TPA_END_CMPL_TYPE_RX_TPA_END) {
-			cmp = (rte_le_to_cpu_32(
-					((struct rx_tpa_end_cmpl *)
-					 (rxcmp))->agg_bufs_v1) &
-			       RX_TPA_END_CMPL_AGG_BUFS_MASK) >>
-				RX_TPA_END_CMPL_AGG_BUFS_SFT;
-			desc++;
-		} else if (cmp_type == 0x11) {
-			desc++;
-			cmp = (rxcmp->agg_bufs_v1 &
-				   RX_PKT_CMPL_AGG_BUFS_MASK) >>
-				RX_PKT_CMPL_AGG_BUFS_SFT;
+		if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct)) {
+			break;
 		} else {
-			cmp = 1;
+			raw_cons++;
+			desc++;
 		}
-nothing_to_do:
-		raw_cons += cmp ? cmp : 2;
 	}
 
 	return desc;
-- 
2.20.1 (Apple Git-117)


  parent reply	other threads:[~2019-10-02 17:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191002055423.99659-1-ajit.khaparde@broadcom.com>
2019-10-02  5:54 ` [dpdk-stable] [PATCH v2 02/17] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
2019-10-02  5:54 ` [dpdk-stable] [PATCH v2 03/17] net/bnxt: fix rxq stop/start handling Ajit Khaparde
2019-10-02  5:54 ` [dpdk-stable] [PATCH v2 05/17] net/bnxt: fix async link handling and update Ajit Khaparde
2019-10-02  5:54 ` [dpdk-stable] [PATCH v2 12/17] net/bnxt: fix accessing variable before null check Ajit Khaparde
2019-10-02  5:54 ` [dpdk-stable] [PATCH v2 13/17] net/bnxt: fix Rx queue count devop Ajit Khaparde
2019-10-02  5:54 ` [dpdk-stable] [PATCH v2 14/17] net/bnxt: fix mbuf flags for PTP packets in vector mode Rx Ajit Khaparde
2019-10-02  5:54 ` [dpdk-stable] [PATCH v2 15/17] net/bnxt: fix a segfault in secondary process Ajit Khaparde
     [not found] ` <20191002171745.4504-1-ajit.khaparde@broadcom.com>
2019-10-02 17:17   ` [dpdk-stable] [PATCH v3 02/16] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
2019-10-02 17:17   ` [dpdk-stable] [PATCH v3 03/16] net/bnxt: fix rxq stop/start handling Ajit Khaparde
2019-10-02 17:17   ` [dpdk-stable] [PATCH v3 05/16] net/bnxt: fix async link handling and update Ajit Khaparde
2019-10-02 17:17   ` [dpdk-stable] [PATCH v3 12/16] net/bnxt: fix accessing variable before null check Ajit Khaparde
2019-10-02 17:17   ` Ajit Khaparde [this message]
2019-10-02 17:17   ` [dpdk-stable] [PATCH v3 14/16] net/bnxt: fix a segfault in secondary process Ajit Khaparde

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=20191002171745.4504-14-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=rahul.gupta@broadcom.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=stable@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).