Skip to contentSkip to conversation

bugfix for testpmd

PATCH Applied Min Hu (Connor) 3 participants 7 messages Apr 22, 2021 – Apr 26, 2021

lore
Share & tools
lore
#0 lore raw

cover bugfix for testpmd

This patchset contains two bugfixes for testpmd.

Chengchang Tang (2):
app/testpmd: fix integer overflow during get DCB conf app/testpmd: fix max queue number when configure Tx offloads

 app/test-pmd/cmdline.c | 2 +-
 app/test-pmd/testpmd.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 app/testpmd: fix integer overflow during get DCB conf

From: Chengchang Tang <[email protected]>

In C, constant is treated as integer. Therefore, if nb_queque_pools is ETH_32_POOLS, the shift here may cause integer overflow.

Fixes 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic class")
---
 app/test-pmd/testpmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/testpmd.c +1 -1
index afa2a6b..6784160 100644
@@ -3640,7 +3640,7 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
 		for (i = 0; i < vmdq_rx_conf->nb_pool_maps; i++) {
 			vmdq_rx_conf->pool_map[i].vlan_id = vlan_tags[i];
 			vmdq_rx_conf->pool_map[i].pools =
-				1 << (i % vmdq_rx_conf->nb_queue_pools);
+				1ULL << (i % vmdq_rx_conf->nb_queue_pools);
 		}
 		for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
 			vmdq_rx_conf->dcb_tc[i] = i % num_tcs;
Signature · 1 line
2.7.4
#2 lore raw

Re: [dpdk-dev] [PATCH 1/2] app/testpmd: fix integer overflow during get DCB conf

Hi

Quoted 27 lines

-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Thursday, April 22, 2021 15:04
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH 1/2] app/testpmd: fix integer overflow during get DCB conf

From: Chengchang Tang <[email protected]>

In C, constant is treated as integer. Therefore, if nb_queque_pools is ETH_32_POOLS, the shift here may cause integer overflow.

Fixes 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic

class")
Cc: [email protected]

---
 app/test-pmd/testpmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

afa2a6b..6784160 100644

app/test-pmd/testpmd.c get_eth_dcb_conf(portid_t pid, struct rte_eth_conf · line 3644

Quoted 6 lines
app/test-pmd/testpmd.c +1 -1
@@ -3640,7 +3640,7 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf
 *eth_conf,
 		for (i = 0; i < vmdq_rx_conf->nb_pool_maps; i++) {
 			vmdq_rx_conf->pool_map[i].vlan_id = vlan_tags[i];
 			vmdq_rx_conf->pool_map[i].pools =
-				1 << (i % vmdq_rx_conf->nb_queue_pools);
+				1ULL << (i % vmdq_rx_conf->nb_queue_pools);

In get_eth_dcb_conf(),
vmdq_rx_conf->nb_queue_pools =

			(num_tcs ==  ETH_4_TCS ? ETH_32_POOLS : ETH_16_POOLS);

It will only be 16 or 32.
So I don't think this patch is necessary unless you're going to use the value ETH_64_POOLS.

Quoted 5 lines
app/test-pmd/testpmd.c +0 -0
 		}
 		for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {

vmdq_rx_conf->dcb_tc[i] = i % num_tcs;
--
2.7.4

#3 lore raw

Re: [dpdk-dev] [PATCH 1/2] app/testpmd: fix integer overflow during get DCB conf

Quoted 38 lines · Xiaoyun

Hi

Quoted 27 lines

-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Thursday, April 22, 2021 15:04
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH 1/2] app/testpmd: fix integer overflow during get DCB conf

From: Chengchang Tang <[email protected]>

In C, constant is treated as integer. Therefore, if nb_queque_pools is ETH_32_POOLS, the shift here may cause integer overflow.

Fixes 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic

class")
Cc: [email protected]

---
  app/test-pmd/testpmd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

afa2a6b..6784160 100644

app/test-pmd/testpmd.c get_eth_dcb_conf(portid_t pid, struct rte_eth_conf · line 3644

Quoted 6 lines
app/test-pmd/testpmd.c +1 -1
@@ -3640,7 +3640,7 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf
 *eth_conf,
  		for (i = 0; i < vmdq_rx_conf->nb_pool_maps; i++) {
  			vmdq_rx_conf->pool_map[i].vlan_id = vlan_tags[i];
  			vmdq_rx_conf->pool_map[i].pools =
-				1 << (i % vmdq_rx_conf->nb_queue_pools);
+				1ULL << (i % vmdq_rx_conf->nb_queue_pools);

In get_eth_dcb_conf(),
vmdq_rx_conf->nb_queue_pools =

Quoted 5 lines
			(num_tcs ==  ETH_4_TCS ? ETH_32_POOLS : ETH_16_POOLS);

It will only be 16 or 32.
So I don't think this patch is necessary unless you're going to use the value ETH_64_POOLS.

Agreed, this patch can be abandoned, thanks.

Quoted 8 lines
Quoted 5 lines
app/test-pmd/testpmd.c +0 -0
  		}
  		for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {

vmdq_rx_conf->dcb_tc[i] = i % num_tcs;
--
2.7.4

.

#4 lore raw

PATCH 2/2 app/testpmd: fix max queue number when configure Tx offloads

In reply to Min Hu (Connor)

From: Chengchang Tang <[email protected]>

When txq offload is configured, max rxq is used as the max queue. This patch fixes it.

Fixes 74453ac9ef67 ("app/testpmd: fix queue offload configuration")
---
 app/test-pmd/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/cmdline.c +1 -1
index f0fa6e8..1cb1027 100644
@@ -4666,7 +4666,7 @@ cmd_config_queue_tx_offloads(struct rte_port *port)
 	int k;
 
 	/* Apply queue tx offloads configuration */
-	for (k = 0; k < port->dev_info.max_rx_queues; k++)
+	for (k = 0; k < port->dev_info.max_tx_queues; k++)
 		port->tx_conf[k].offloads =
 			port->dev_conf.txmode.offloads;
 }
Signature · 1 line
2.7.4
Acked-by on v1 2/2
#5 lore raw

Re: [dpdk-dev] [PATCH 2/2] app/testpmd: fix max queue number when configure Tx offloads

Quoted 37 lines

-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Thursday, April 22, 2021 15:04
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH 2/2] app/testpmd: fix max queue number when configure Tx offloads

From: Chengchang Tang <[email protected]>

When txq offload is configured, max rxq is used as the max queue. This patch fixes it.

Fixes 74453ac9ef67 ("app/testpmd: fix queue offload configuration")
---
 app/test-pmd/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

f0fa6e8..1cb1027 100644

app/test-pmd/cmdline.c +1 -2
@@ -4666,7 +4666,7 @@ cmd_config_queue_tx_offloads(struct rte_port *port)
 	int k;
 
 	/* Apply queue tx offloads configuration */
-	for (k = 0; k < port->dev_info.max_rx_queues; k++)
+	for (k = 0; k < port->dev_info.max_tx_queues; k++)
 		port->tx_conf[k].offloads =
 			port->dev_conf.txmode.offloads;
 }
--
Quoted 1 line

2.7.4

Applied
#6 lore raw

Re: [dpdk-dev] [PATCH 2/2] app/testpmd: fix max queue number when configure Tx offloads

Quoted 30 lines · Xiaoyun
Quoted 30 lines

-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Thursday, April 22, 2021 15:04
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH 2/2] app/testpmd: fix max queue number when configure Tx offloads

From: Chengchang Tang <[email protected]>

When txq offload is configured, max rxq is used as the max queue. This patch fixes it.

Fixes 74453ac9ef67 ("app/testpmd: fix queue offload configuration")
---
 app/test-pmd/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

f0fa6e8..1cb1027 100644

app/test-pmd/cmdline.c +0 -0
@@ -4666,7 +4666,7 @@ cmd_config_queue_tx_offloads(struct rte_port *port)
 int k;
 
Quoted 11 lines
Quoted 8 lines
app/test-pmd/cmdline.c +1 -2
 /* Apply queue tx offloads configuration */
-for (k = 0; k < port->dev_info.max_rx_queues; k++)
+for (k = 0; k < port->dev_info.max_tx_queues; k++)
 port->tx_conf[k].offloads =
 port->dev_conf.txmode.offloads;
 }
--

2.7.4

Applied to dpdk-next-net/main, thanks.