-----Original Message-----
From: Lijun Ou <ouli...@huawei.com>
Sent: Friday, March 5, 2021 18:22
To: Yigit, Ferruh <ferruh.yi...@intel.com>
Cc: Li, Xiaoyun <xiaoyun...@intel.com>; dev@dpdk.org;
linux...@openeuler.org
Subject: [PATCH 1/3] app/testpmd: fix forwarding configuration when
DCB test
From: Huisong Li <lihuis...@huawei.com>
Currently, 'nb_fwd_lcores' value are both adjusted based on
'nb_fwd_streams' in
rss/simple/icmp_echo_fwd_config_setup. But the operation is lack for
dcb_fwd_config_setup, which may lead to a bad events where multiple
polling
threads operate on the same queue. As a result, various possible
exceptions will
occur. The procedure is as follows:
startup testpmd app as follows:
testpmd> port stop all
testpmd> set nbcore 8
testpmd> port config 0 dcb vt off 4 pfc on port config all rxq 16 port
testpmd> config all txq 16 port start all set fwd mac
Logical Core 1 (socket 0) forwards packets on 4 streams:
RX P=0/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0)
peer=02:00:00:00:00:00 RX
P=0/Q=1 (socket 0) -> TX P=0/Q=1 (socket 0) peer=02:00:00:00:00:00 RX
P=0/Q=2 (socket 0) -> TX P=0/Q=2 (socket 0) peer=02:00:00:00:00:00 RX
P=0/Q=3 (socket 0) -> TX P=0/Q=3 (socket 0) peer=02:00:00:00:00:00
Logical
Core 2 (socket 0) forwards packets on 4 streams:
RX P=0/Q=4 (socket 0) -> TX P=0/Q=4 (socket 0)
peer=02:00:00:00:00:00 RX
P=0/Q=5 (socket 0) -> TX P=0/Q=5 (socket 0) peer=02:00:00:00:00:00 RX
P=0/Q=6 (socket 0) -> TX P=0/Q=6 (socket 0) peer=02:00:00:00:00:00 RX
P=0/Q=7 (socket 0) -> TX P=0/Q=7 (socket 0) peer=02:00:00:00:00:00
Logical
Core 3 (socket 0) forwards packets on 4 streams:
RX P=0/Q=8 (socket 0) -> TX P=0/Q=8 (socket 0)
peer=02:00:00:00:00:00 RX
P=0/Q=9 (socket 0) -> TX P=0/Q=9 (socket 0) peer=02:00:00:00:00:00 RX
P=0/Q=10 (socket 0) -> TX P=0/Q=10 (socket 0) peer=02:00:00:00:00:00 RX
P=0/Q=11 (socket 0) -> TX P=0/Q=11 (socket 0) peer=02:00:00:00:00:00
Logical
Core 4 (socket 0) forwards packets on 4 streams:
RX P=0/Q=12 (socket 0) -> TX P=0/Q=12 (socket 0)
peer=02:00:00:00:00:00 RX
P=0/Q=13 (socket 0) -> TX P=0/Q=13 (socket 0) peer=02:00:00:00:00:00 RX
P=0/Q=14 (socket 0) -> TX P=0/Q=14 (socket 0) peer=02:00:00:00:00:00 RX
P=0/Q=15 (socket 0) -> TX P=0/Q=15 (socket 0) peer=02:00:00:00:00:00
Logical
Core 5 (socket 0) forwards packets on 1 streams:
RX P=0/Q=4 (socket 0) -> TX P=0/Q=4 (socket 0)
peer=02:00:00:00:00:00 Logical
Core 6 (socket 0) forwards packets on 1 streams:
RX P=0/Q=5 (socket 0) -> TX P=0/Q=5 (socket 0)
peer=02:00:00:00:00:00 Logical
Core 7 (socket 0) forwards packets on 1 streams:
RX P=0/Q=6 (socket 0) -> TX P=0/Q=6 (socket 0)
peer=02:00:00:00:00:00 Logical
Core 8 (socket 0) forwards packets on 1 streams:
RX P=0/Q=7 (socket 0) -> TX P=0/Q=7 (socket 0) peer=02:00:00:00:00:00
Notice: number of rxq and txq in running cmdline are greater than
used nb_tc.
For the DCB forwarding test, each core is assigned on each traffic
class and each
core is assigned a multi-stream. Therefore, 'nb_fwd_lcores'
value can be adjusted based on 'total_tc_num' in all forwarding ports.
In addition, after operation of port stop/port start, forwarding
configuration is
changed by rss_fwd_config_setup. In "start_port"
function, dcb_test is set to 1 based on dcb_config. So it also
should be cleared
when dcb_config is 0.
Fixes: 900550de04a7 ("app/testpmd: add dcb support")
Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
Cc: sta...@dpdk.org
Signed-off-by: Huisong Li <lihuis...@huawei.com>
Signed-off-by: Lijun Ou <ouli...@huawei.com>
---
app/test-pmd/config.c | 19 +++++++++++++++++++
app/test-pmd/testpmd.c |
12 +++++++-----
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index
576d5ac..c89f8cd 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2864,6 +2864,21 @@ rss_fwd_config_setup(void)
}
}
+static uint16_t
+get_fwd_port_total_tc_num(void)
+{
+ struct rte_eth_dcb_info dcb_info;
+ uint16_t total_tc_num = 0;
+ unsigned int i;
+
+ for (i = 0; i < nb_fwd_ports; i++) {
+ (void)rte_eth_dev_get_dcb_info(fwd_ports_ids[i], &dcb_info);
+ total_tc_num += dcb_info.nb_tcs;
+ }
+
+ return total_tc_num;
+}