DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lance Richardson <lance.richardson@broadcom.com>
To: dev@dpdk.org
Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com,
	Lance Richardson <lance.richardson@broadcom.com>
Subject: [dpdk-dev] [PATCH 7/7] net/bnxt: improve CPR handling in vector PMD
Date: Fri, 30 Aug 2019 16:52:01 -0400	[thread overview]
Message-ID: <20190830205201.26644-8-lance.richardson@broadcom.com> (raw)
In-Reply-To: <20190830205201.26644-1-lance.richardson@broadcom.com>

Reduce overhead of CPR descriptor validity checking in vector
receive and transmit functions.

Preserve raw cpr consumer index in vector transmit completion
function.

Remove an unneeded prefetch (per benchmarking) from vector
transmit completion function.

Fixes: bc4a000f2f53 ("net/bnxt: implement SSE vector mode")
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index 2e6e83c94..980fddb1f 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -245,10 +245,6 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
 			break;
 
-		cpr->valid = FLIP_VALID(cons,
-					cpr->cp_ring_struct->ring_mask,
-					cpr->valid);
-
 		if (likely(CMP_TYPE(rxcmp) == RX_PKT_CMPL_TYPE_RX_L2)) {
 			struct rx_pkt_cmpl_hi *rxcmp1;
 			uint32_t tmp_raw_cons;
@@ -272,10 +268,6 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			rte_prefetch0(mbuf);
 			rxr->rx_buf_ring[cons].mbuf = NULL;
 
-			cpr->valid = FLIP_VALID(cp_cons,
-						cpr->cp_ring_struct->ring_mask,
-						cpr->valid);
-
 			/* Set constant fields from mbuf initializer. */
 			_mm_store_si128((__m128i *)&mbuf->rearm_data,
 					mbuf_init);
@@ -318,22 +310,13 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	rxq->rxrearm_nb += nb_rx_pkts;
 	cpr->cp_raw_cons = raw_cons;
+	cpr->valid = !!(cpr->cp_raw_cons & cpr->cp_ring_struct->ring_size);
 	if (nb_rx_pkts || evt)
 		bnxt_db_cq(cpr);
 
 	return nb_rx_pkts;
 }
 
-static inline void bnxt_next_cmpl(struct bnxt_cp_ring_info *cpr, uint32_t *idx,
-				  bool *v, uint32_t inc)
-{
-	*idx += inc;
-	if (unlikely(*idx == cpr->cp_ring_struct->ring_size)) {
-		*v = !*v;
-		*idx = 0;
-	}
-}
-
 static void
 bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
 {
@@ -379,10 +362,8 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)
 		cons = RING_CMPL(ring_mask, raw_cons);
 		txcmp = (struct tx_cmpl *)&cp_desc_ring[cons];
 
-		if (!CMPL_VALID(txcmp, cpr->valid))
+		if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct))
 			break;
-		bnxt_next_cmpl(cpr, &cons, &cpr->valid, 1);
-		rte_prefetch0(&cp_desc_ring[cons]);
 
 		if (likely(CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2))
 			nb_tx_pkts += txcmp->opaque;
@@ -390,9 +371,10 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)
 			RTE_LOG_DP(ERR, PMD,
 				   "Unhandled CMP type %02x\n",
 				   CMP_TYPE(txcmp));
-		raw_cons = cons;
+		raw_cons = NEXT_RAW_CMP(raw_cons);
 	} while (nb_tx_pkts < ring_mask);
 
+	cpr->valid = !!(raw_cons & cp_ring_struct->ring_size);
 	if (nb_tx_pkts) {
 		bnxt_tx_cmp_vec(txq, nb_tx_pkts);
 		cpr->cp_raw_cons = raw_cons;
-- 
2.17.1


      parent reply	other threads:[~2019-08-30 20:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30 20:51 [dpdk-dev] [PATCH 0/7] bnxt patchset for thor and bnxt " Lance Richardson
2019-08-30 20:51 ` [dpdk-dev] [PATCH 1/7] net/bnxt: fix thor tqm entry allocation Lance Richardson
2019-08-30 20:51 ` [dpdk-dev] [PATCH 2/7] net/bnxt: fix ring alignment for thor-based adapters Lance Richardson
2019-08-30 20:51 ` [dpdk-dev] [PATCH 3/7] net/bnxt: use common receive/transmit NQ ring Lance Richardson
2019-08-30 20:51 ` [dpdk-dev] [PATCH 4/7] net/bnxt: use correct default Rx queue for thor Lance Richardson
2019-08-30 20:51 ` [dpdk-dev] [PATCH 5/7] net/bnxt: add support for LRO for thor adapters Lance Richardson
2019-08-30 20:52 ` [dpdk-dev] [PATCH 6/7] net/bnxt: fix scatter receive offload capability Lance Richardson
2019-08-30 20:52 ` Lance Richardson [this message]

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=20190830205201.26644-8-lance.richardson@broadcom.com \
    --to=lance.richardson@broadcom.com \
    --cc=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).