DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <stephen@networkplumber.org>
Cc: <dev@dpdk.org>, <aman.deep.singh@intel.com>,
	<liuyonglong@huawei.com>, <yangxingui@huawei.com>,
	<lihuisong@huawei.com>
Subject: [PATCH v2 1/3] app/testpmd: fix invalid txp when setup DCB forward
Date: Wed, 5 Nov 2025 17:47:46 +0800	[thread overview]
Message-ID: <20251105094748.3269-2-fengchengwen@huawei.com> (raw)
In-Reply-To: <20251105094748.3269-1-fengchengwen@huawei.com>

The txp maybe invalid (e.g. start with only one port but set with 1),
this commit fix it by get txp from fwd_topology_tx_port_get() function.

An added benefit is that the DCB test also supports '--port-topology'
parameter.

Fixes: 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic class")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 app/test-pmd/config.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3ce2a14a1b..0f687018c7 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -5187,7 +5187,7 @@ dcb_fwd_config_setup(void)
 	/* reinitialize forwarding streams */
 	init_fwd_streams();
 	sm_id = 0;
-	txp = 1;
+	txp = fwd_topology_tx_port_get(rxp);
 	/* get the dcb info on the first RX and TX ports */
 	(void)rte_eth_dev_get_dcb_info(fwd_ports_ids[rxp], &rxp_dcb_info);
 	(void)rte_eth_dev_get_dcb_info(fwd_ports_ids[txp], &txp_dcb_info);
@@ -5235,11 +5235,8 @@ dcb_fwd_config_setup(void)
 			rxp++;
 		if (rxp >= nb_fwd_ports)
 			return;
+		txp = fwd_topology_tx_port_get(rxp);
 		/* get the dcb information on next RX and TX ports */
-		if ((rxp & 0x1) == 0)
-			txp = (portid_t) (rxp + 1);
-		else
-			txp = (portid_t) (rxp - 1);
 		rte_eth_dev_get_dcb_info(fwd_ports_ids[rxp], &rxp_dcb_info);
 		rte_eth_dev_get_dcb_info(fwd_ports_ids[txp], &txp_dcb_info);
 	}
-- 
2.17.1


  reply	other threads:[~2025-11-05  9:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04  4:09 [PATCH 0/3] testpmd support stop specify lcore Chengwen Feng
2025-11-04  4:09 ` [PATCH 1/3] app/testpmd: fix invalid txp when setup DCB forward Chengwen Feng
2025-11-04  4:09 ` [PATCH 2/3] app/testpmd: fix wrong Rx queues " Chengwen Feng
2025-11-04  4:09 ` [PATCH 3/3] app/testpmd: support stop specify lcore Chengwen Feng
2025-11-05  0:21 ` [PATCH 0/3] testpmd " Stephen Hemminger
2025-11-05  0:43   ` fengchengwen
2025-11-05  9:47 ` [PATCH v2 0/3] testpmd support pause/resume specify lcore's fwd Chengwen Feng
2025-11-05  9:47   ` Chengwen Feng [this message]
2025-11-05  9:47   ` [PATCH v2 2/3] app/testpmd: fix wrong Rx queues when setup DCB forward Chengwen Feng
2025-11-05  9:47   ` [PATCH v2 3/3] app/testpmd: support pause/resume specify lcore Chengwen Feng
2025-11-05 18:59   ` [PATCH v2 0/3] testpmd support pause/resume specify lcore's fwd Stephen Hemminger

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=20251105094748.3269-2-fengchengwen@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=lihuisong@huawei.com \
    --cc=liuyonglong@huawei.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    --cc=yangxingui@huawei.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).