[dpdk-stable] patch 'net/ena: fix Tx SQ free space assessment' has been queued to stable release 20.11.1

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Feb 5 12:19:17 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/07/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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/bde94e82f559ad767ed000945ba1dc04779ce973

Thanks.

Luca Boccassi

---
>From bde94e82f559ad767ed000945ba1dc04779ce973 Mon Sep 17 00:00:00 2001
From: Igor Chauskin <igorch at amazon.com>
Date: Tue, 26 Jan 2021 19:32:25 +0100
Subject: [PATCH] net/ena: fix Tx SQ free space assessment

[ upstream commit 8a90f3d8d09b5fa2e7a6a7b83b8e4868acebbe01 ]

Before starting transmission of Tx burst, the driver checked the
available space in the sq and limited the number of packets for
transmission accordingly.
The calculation was incorrect for fragmented packets and potentially had
significantly limited the length of Tx bursts.

This patch removes the assessment and pushes packets to the sq as long
as the burst is not exhausted and space is available in the sq.

Correct evaluation of the required space isn't possible before the burst
because it depends on the number of segments of each packet.
This patch adds per-packet space evaluation for each packet before
attempting to process it. In case there is not enough queue space, the
burst will just stop without error.

Fixes: 2061fe41f212 ("net/ena: linearize Tx mbuf")

Signed-off-by: Igor Chauskin <igorch at amazon.com>
Reviewed-by: Michal Krawczyk <mk at semihalf.com>
---
 drivers/net/ena/ena_ethdev.c | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 9ee9de6eb9..4083568d5d 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -2359,8 +2359,8 @@ static void ena_update_hints(struct ena_adapter *adapter,
 	}
 }
 
-static int ena_check_and_linearize_mbuf(struct ena_ring *tx_ring,
-					struct rte_mbuf *mbuf)
+static int ena_check_space_and_linearize_mbuf(struct ena_ring *tx_ring,
+					      struct rte_mbuf *mbuf)
 {
 	struct ena_com_dev *ena_dev;
 	int num_segments, header_len, rc;
@@ -2370,13 +2370,21 @@ static int ena_check_and_linearize_mbuf(struct ena_ring *tx_ring,
 	header_len = mbuf->data_len;
 
 	if (likely(num_segments < tx_ring->sgl_size))
-		return 0;
+		goto checkspace;
 
 	if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV &&
 	    (num_segments == tx_ring->sgl_size) &&
 	    (header_len < tx_ring->tx_max_header_size))
-		return 0;
+		goto checkspace;
 
+	/* Checking for space for 2 additional metadata descriptors due to
+	 * possible header split and metadata descriptor. Linearization will
+	 * be needed so we reduce the segments number from num_segments to 1
+	 */
+	if (!ena_com_sq_have_enough_space(tx_ring->ena_com_io_sq, 3)) {
+		PMD_DRV_LOG(DEBUG, "Not enough space in the tx queue\n");
+		return ENA_COM_NO_MEM;
+	}
 	++tx_ring->tx_stats.linearize;
 	rc = rte_pktmbuf_linearize(mbuf);
 	if (unlikely(rc)) {
@@ -2386,7 +2394,19 @@ static int ena_check_and_linearize_mbuf(struct ena_ring *tx_ring,
 		return rc;
 	}
 
-	return rc;
+	return 0;
+
+checkspace:
+	/* Checking for space for 2 additional metadata descriptors due to
+	 * possible header split and metadata descriptor
+	 */
+	if (!ena_com_sq_have_enough_space(tx_ring->ena_com_io_sq,
+					  num_segments + 2)) {
+		PMD_DRV_LOG(DEBUG, "Not enough space in the tx queue\n");
+		return ENA_COM_NO_MEM;
+	}
+
+	return 0;
 }
 
 static void ena_tx_map_mbuf(struct ena_ring *tx_ring,
@@ -2473,7 +2493,7 @@ static int ena_xmit_mbuf(struct ena_ring *tx_ring, struct rte_mbuf *mbuf)
 	int nb_hw_desc;
 	int rc;
 
-	rc = ena_check_and_linearize_mbuf(tx_ring, mbuf);
+	rc = ena_check_space_and_linearize_mbuf(tx_ring, mbuf);
 	if (unlikely(rc))
 		return rc;
 
@@ -2580,9 +2600,6 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		return 0;
 	}
 
-	nb_pkts = RTE_MIN(ena_com_free_q_entries(tx_ring->ena_com_io_sq),
-		nb_pkts);
-
 	for (sent_idx = 0; sent_idx < nb_pkts; sent_idx++) {
 		if (ena_xmit_mbuf(tx_ring, tx_pkts[sent_idx]))
 			break;
-- 
2.29.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-02-05 11:18:41.141838816 +0000
+++ 0271-net-ena-fix-Tx-SQ-free-space-assessment.patch	2021-02-05 11:18:29.358701621 +0000
@@ -1 +1 @@
-From 8a90f3d8d09b5fa2e7a6a7b83b8e4868acebbe01 Mon Sep 17 00:00:00 2001
+From bde94e82f559ad767ed000945ba1dc04779ce973 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 8a90f3d8d09b5fa2e7a6a7b83b8e4868acebbe01 ]
+
@@ -22 +23,0 @@
-Cc: stable at dpdk.org
@@ -31 +32 @@
-index 1728ceb9a8..8a937d7f27 100644
+index 9ee9de6eb9..4083568d5d 100644


More information about the stable mailing list