[dpdk-stable] patch 'net/bnxt: fix Tx descriptor status implementation' has been queued to stable release 19.11.10

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Tue Aug 10 17:39:29 CEST 2021


Hi,

FYI, your patch has been queued to stable release 19.11.10

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/12/21. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/cpaelzer/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/cca90b556a33225f9713e46ad1de83cd2f4e1512

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From cca90b556a33225f9713e46ad1de83cd2f4e1512 Mon Sep 17 00:00:00 2001
From: Lance Richardson <lance.richardson at broadcom.com>
Date: Wed, 16 Jun 2021 13:55:21 -0400
Subject: [PATCH] net/bnxt: fix Tx descriptor status implementation

[ upstream commit ce5c57ac01af038b930d5164df2cb16193e238ec ]

With Tx completion batching, a single transmit completion
can correspond to one or more transmit descriptors, adjust
implementation to account for this.

RTE_ETH_TX_DESC_DONE should be returned for descriptors that
are available for use instead of RTE_ETH_TX_DESC_UNAVAIL.

Fixes: 5735eb241947 ("net/bnxt: support Tx batching")
Fixes: 478ed3bb7b9d ("net/bnxt: support Tx descriptor status")

Signed-off-by: Lance Richardson <lance.richardson at broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 54 +++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3d07efd0f0..c3a8b68885 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2597,41 +2597,49 @@ static int
 bnxt_tx_descriptor_status_op(void *tx_queue, uint16_t offset)
 {
 	struct bnxt_tx_queue *txq = (struct bnxt_tx_queue *)tx_queue;
-	struct bnxt_tx_ring_info *txr;
-	struct bnxt_cp_ring_info *cpr;
-	struct bnxt_sw_tx_bd *tx_buf;
-	struct tx_pkt_cmpl *txcmp;
-	uint32_t cons, cp_cons;
+	struct bnxt_cp_ring_info *cpr = txq->cp_ring;
+	uint32_t ring_mask, raw_cons, nb_tx_pkts = 0;
+	struct bnxt_ring *cp_ring_struct;
+	struct cmpl_base *cp_desc_ring;
 	int rc;
 
-	if (!txq)
-		return -EINVAL;
-
 	rc = is_bnxt_in_error(txq->bp);
 	if (rc)
 		return rc;
 
-	cpr = txq->cp_ring;
-	txr = txq->tx_ring;
-
 	if (offset >= txq->nb_tx_desc)
 		return -EINVAL;
 
-	cons = RING_CMP(cpr->cp_ring_struct, offset);
-	txcmp = (struct tx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
-	cp_cons = cpr->cp_raw_cons;
+	/* Return "desc done" if descriptor is available for use. */
+	if (bnxt_tx_bds_in_hw(txq) <= offset)
+		return RTE_ETH_TX_DESC_DONE;
 
-	if (cons > cp_cons) {
-		if (CMPL_VALID(txcmp, cpr->valid))
-			return RTE_ETH_TX_DESC_UNAVAIL;
-	} else {
-		if (CMPL_VALID(txcmp, !cpr->valid))
-			return RTE_ETH_TX_DESC_UNAVAIL;
+	raw_cons = cpr->cp_raw_cons;
+	cp_desc_ring = cpr->cp_desc_ring;
+	cp_ring_struct = cpr->cp_ring_struct;
+	ring_mask = cpr->cp_ring_struct->ring_mask;
+
+	/* Check to see if hw has posted a completion for the descriptor. */
+	while (1) {
+		struct tx_cmpl *txcmp;
+		uint32_t cons;
+
+		cons = RING_CMPL(ring_mask, raw_cons);
+		txcmp = (struct tx_cmpl *)&cp_desc_ring[cons];
+
+		if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct))
+			break;
+
+		if (CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2)
+			nb_tx_pkts += rte_le_to_cpu_32(txcmp->opaque);
+
+		if (nb_tx_pkts > offset)
+			return RTE_ETH_TX_DESC_DONE;
+
+		raw_cons = NEXT_RAW_CMP(raw_cons);
 	}
-	tx_buf = &txr->tx_buf_ring[cons];
-	if (tx_buf->mbuf == NULL)
-		return RTE_ETH_TX_DESC_DONE;
 
+	/* Descriptor is pending transmit, not yet completed by hardware. */
 	return RTE_ETH_TX_DESC_FULL;
 }
 
-- 
2.32.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-08-10 15:11:14.924065675 +0200
+++ 0049-net-bnxt-fix-Tx-descriptor-status-implementation.patch	2021-08-10 15:11:13.026638158 +0200
@@ -1 +1 @@
-From ce5c57ac01af038b930d5164df2cb16193e238ec Mon Sep 17 00:00:00 2001
+From cca90b556a33225f9713e46ad1de83cd2f4e1512 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit ce5c57ac01af038b930d5164df2cb16193e238ec ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
-index 74ade93b71..4d51a209f9 100644
+index 3d07efd0f0..c3a8b68885 100644
@@ -27 +28 @@
-@@ -3296,41 +3296,49 @@ static int
+@@ -2597,41 +2597,49 @@ static int
@@ -33 +34 @@
--	struct rte_mbuf **tx_buf;
+-	struct bnxt_sw_tx_bd *tx_buf;
@@ -93 +94 @@
--	if (*tx_buf == NULL)
+-	if (tx_buf->mbuf == NULL)


More information about the stable mailing list