[dpdk-stable] patch 'app/testpmd: fix segment number check' has been queued to stable release 20.11.2

Xueming Li xuemingl at nvidia.com
Sat Jun 12 01:01:59 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.11.2

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

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/9886a1aed2ba8f55f678504ad21bc110d33373de

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 9886a1aed2ba8f55f678504ad21bc110d33373de Mon Sep 17 00:00:00 2001
From: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
Date: Fri, 23 Apr 2021 17:09:52 +0100
Subject: [PATCH] app/testpmd: fix segment number check
Cc: Luca Boccassi <bluca at debian.org>

[ upstream commit 3f47c017eed414490b6428d58d47dfca2964209e ]

The --txpkts command line parameter was silently ignored due to
application was unable to check the Tx queue ring sizes for non
configured ports.

The "set txpkts <len0[,len1]*>" was also rejected if there
was some stopped or /unconfigured port.

This provides the following:

  - If fails to get ring size from the port, this can be because port is
    not initialized yet, ignore the check and just be sure segment size
    won't cause an out of bound access. The port descriptor check will
    be done during Tx setup.

  - The capability to send single packet is supposed to be very basic
    and always supported, the setting segment number to 1 is always
    allowed, no check performed

  - At the moment of Tx queue setup the descriptor number is checked
    against configured segment number

Bugzilla ID: 584
Fixes: 8dae835d88b7 ("app/testpmd: remove restriction on Tx segments set")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
Acked-by: Xiaoyun Li <xiaoyun.li at intel.com>
---
 app/test-pmd/cmdline.c |  4 ++++
 app/test-pmd/config.c  | 32 ++++++++++++++++++++++++--------
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ab9a603dc2..294031542a 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -2808,6 +2808,10 @@ cmd_setup_rxtx_queue_parsed(
 		if (!numa_support || socket_id == NUMA_NO_CONFIG)
 			socket_id = port->socket_id;
 
+		if (port->nb_tx_desc[res->qid] < tx_pkt_nb_segs) {
+			printf("Failed to setup TX queue: not enough descriptors\n");
+			return;
+		}
 		ret = rte_eth_tx_queue_setup(res->portid,
 					     res->qid,
 					     port->nb_tx_desc[res->qid],
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 5f147ec711..cb97963157 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3842,13 +3842,15 @@ nb_segs_is_invalid(unsigned int nb_segs)
 	RTE_ETH_FOREACH_DEV(port_id) {
 		for (queue_id = 0; queue_id < nb_txq; queue_id++) {
 			ret = get_tx_ring_size(port_id, queue_id, &ring_size);
-
-			if (ret)
-				return true;
-
+			if (ret) {
+				/* Port may not be initialized yet, can't say
+				 * the port is invalid in this stage.
+				 */
+				continue;
+			}
 			if (ring_size < nb_segs) {
-				printf("nb segments per TX packets=%u >= "
-				       "TX queue(%u) ring_size=%u - ignored\n",
+				printf("nb segments per TX packets=%u >= TX "
+				       "queue(%u) ring_size=%u - txpkts ignored\n",
 				       nb_segs, queue_id, ring_size);
 				return true;
 			}
@@ -3864,12 +3866,26 @@ set_tx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs)
 	uint16_t tx_pkt_len;
 	unsigned int i;
 
-	if (nb_segs_is_invalid(nb_segs))
+	/*
+	 * For single segment settings failed check is ignored.
+	 * It is a very basic capability to send the single segment
+	 * packets, suppose it is always supported.
+	 */
+	if (nb_segs > 1 && nb_segs_is_invalid(nb_segs)) {
+		printf("Tx segment size(%u) is not supported - txpkts ignored\n",
+			nb_segs);
 		return;
+	}
+
+	if (nb_segs > RTE_MAX_SEGS_PER_PKT) {
+		printf("Tx segment size(%u) is bigger than max number of segment(%u)\n",
+			nb_segs, RTE_MAX_SEGS_PER_PKT);
+		return;
+	}
 
 	/*
 	 * Check that each segment length is greater or equal than
-	 * the mbuf data sise.
+	 * the mbuf data size.
 	 * Check also that the total packet length is greater or equal than the
 	 * size of an empty UDP/IP packet (sizeof(struct rte_ether_hdr) +
 	 * 20 + 8).
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-06-12 06:53:57.341865600 +0800
+++ 0025-app-testpmd-fix-segment-number-check.patch	2021-06-12 06:53:56.140000000 +0800
@@ -1 +1 @@
-From 3f47c017eed414490b6428d58d47dfca2964209e Mon Sep 17 00:00:00 2001
+From 9886a1aed2ba8f55f678504ad21bc110d33373de Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Luca Boccassi <bluca at debian.org>
+
+[ upstream commit 3f47c017eed414490b6428d58d47dfca2964209e ]
@@ -29 +31,0 @@
-Cc: stable at dpdk.org
@@ -40 +42 @@
-index 0ad27dff66..5fdcc1ca18 100644
+index ab9a603dc2..294031542a 100644
@@ -43 +45 @@
-@@ -2910,6 +2910,10 @@ cmd_setup_rxtx_queue_parsed(
+@@ -2808,6 +2808,10 @@ cmd_setup_rxtx_queue_parsed(
@@ -55 +57 @@
-index e189062efd..a4445a73bf 100644
+index 5f147ec711..cb97963157 100644
@@ -58 +60 @@
-@@ -3697,13 +3697,15 @@ nb_segs_is_invalid(unsigned int nb_segs)
+@@ -3842,13 +3842,15 @@ nb_segs_is_invalid(unsigned int nb_segs)
@@ -80 +82 @@
-@@ -3719,12 +3721,26 @@ set_tx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs)
+@@ -3864,12 +3866,26 @@ set_tx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs)


More information about the stable mailing list