From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28C4DA0A02 for ; Mon, 17 May 2021 18:17:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 231A64014E; Mon, 17 May 2021 18:17:02 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id 413A0410E2 for ; Mon, 17 May 2021 18:17:00 +0200 (CEST) Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=Keschdeichel.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lifvO-0008Qa-0F; Mon, 17 May 2021 16:16:58 +0000 From: Christian Ehrhardt To: Viacheslav Ovsiienko Cc: Ferruh Yigit , Xiaoyun Li , dpdk stable Date: Mon, 17 May 2021 18:09:52 +0200 Message-Id: <20210517161039.3132619-163-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> References: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'app/testpmd: fix segment number check' has been queued to stable release 19.11.9 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/19/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/6ed9bcc3d9275c26aa451e1c90510e6fdcdacab7 Thanks. Christian Ehrhardt --- >From 6ed9bcc3d9275c26aa451e1c90510e6fdcdacab7 Mon Sep 17 00:00:00 2001 From: Viacheslav Ovsiienko Date: Fri, 23 Apr 2021 17:09:52 +0100 Subject: [PATCH] app/testpmd: fix segment number check [ 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 " 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 Signed-off-by: Ferruh Yigit Acked-by: Xiaoyun Li --- 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 64224280b4..077d860401 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -2849,6 +2849,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 ce6fb44d5a..5f875a9cac 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2843,13 +2843,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; } @@ -2865,12 +2867,26 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) uint16_t tx_pkt_len; unsigned 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.31.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-17 17:40:35.788701891 +0200 +++ 0163-app-testpmd-fix-segment-number-check.patch 2021-05-17 17:40:29.475811870 +0200 @@ -1 +1 @@ -From 3f47c017eed414490b6428d58d47dfca2964209e Mon Sep 17 00:00:00 2001 +From 6ed9bcc3d9275c26aa451e1c90510e6fdcdacab7 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 3f47c017eed414490b6428d58d47dfca2964209e ] + @@ -29 +30,0 @@ -Cc: stable@dpdk.org @@ -40 +41 @@ -index 0ad27dff66..5fdcc1ca18 100644 +index 64224280b4..077d860401 100644 @@ -43 +44 @@ -@@ -2910,6 +2910,10 @@ cmd_setup_rxtx_queue_parsed( +@@ -2849,6 +2849,10 @@ cmd_setup_rxtx_queue_parsed( @@ -55 +56 @@ -index e189062efd..a4445a73bf 100644 +index ce6fb44d5a..5f875a9cac 100644 @@ -58 +59 @@ -@@ -3697,13 +3697,15 @@ nb_segs_is_invalid(unsigned int nb_segs) +@@ -2843,13 +2843,15 @@ nb_segs_is_invalid(unsigned int nb_segs) @@ -80 +81 @@ -@@ -3719,12 +3721,26 @@ set_tx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs) +@@ -2865,12 +2867,26 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) @@ -82 +83 @@ - unsigned int i; + unsigned i;