Skip to contentSkip to conversation

app/testpmd: fix offloads overwrite by default configuration

PATCH Applied Wei Zhao 3 participants 17 messages May 9, 2019 – Jun 17, 2019

lore
Share & tools
lore

Wei Zhao

author
#0 lore raw

PATCH 1/1 app/testpmd: fix offloads overwrite by default configuration

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should do "or" for port offloads.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c +5 -0
index 6fbfd29..f0061d9 100644
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)
 {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;
 
 		/* Check if any Rx parameters have been passed */
 		if (rx_pthresh != RTE_PMD_PARAM_UNSET)
@@ -2833,7 +2836,9 @@ rxtx_port_config(struct rte_port *port)
 	}
 
 	for (qid = 0; qid < nb_txq; qid++) {
+		offloads = port->tx_conf[qid].offloads;
 		port->tx_conf[qid] = port->dev_info.default_txconf;
+		port->tx_conf[qid].offloads |= offloads;
 
 		/* Check if any Tx parameters have been passed */
 		if (tx_pthresh != RTE_PMD_PARAM_UNSET)
Signature · 1 line
2.7.5
author Tested-by Peng Yuan on v1 1/1
#1 lore raw
Quoted 49 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Thursday, May 9, 2019 3:21 PM
To: [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Yigit, Ferruh <[email protected]>; Lu, Wenzhuo <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH] app/testpmd: fix offloads overwrite by default configuration

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should do "or" for port offloads.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c +6 -1
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;
 
 		/* Check if any Rx parameters have been passed */
 		if (rx_pthresh != RTE_PMD_PARAM_UNSET) @@ -2833,7
+2836,9 @@ rxtx_port_config(struct rte_port *port)
 	}
 
 	for (qid = 0; qid < nb_txq; qid++) {
+		offloads = port->tx_conf[qid].offloads;
 		port->tx_conf[qid] = port->dev_info.default_txconf;
+		port->tx_conf[qid].offloads |= offloads;
 
 		/* Check if any Tx parameters have been passed */
 		if (tx_pthresh != RTE_PMD_PARAM_UNSET)
--

2.7.5

#2 lore raw

13/05/2019 05:30, Zhao1, Wei:

Quoted 10 lines

From: Zhao1, Wei

Quoted 8 lines

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should do "or" for port offloads.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")

Applied, thanks

#3 lore raw
In reply to Wei Zhao
Quoted 17 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should do "or" for port offloads.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c +0 -0
index 6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2817

Quoted 9 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)
 {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

OK to this changes as a fix for this release.

But I think intention is, if no offload information is provided by user to use use the driver provided defaults, if user explicitly provided some values to use them, instead of OR these two.

With this approach it is not possible to disable a driver default value, so it becomes mandatory offload instead of default offload values.

Wei, what do you think, does it make sense?

Quoted 14 lines
app/test-pmd/testpmd.c +2 -0
 		/* Check if any Rx parameters have been passed */
 		if (rx_pthresh != RTE_PMD_PARAM_UNSET)
@@ -2833,7 +2836,9 @@ rxtx_port_config(struct rte_port *port)
 	}
 
 	for (qid = 0; qid < nb_txq; qid++) {
+		offloads = port->tx_conf[qid].offloads;
 		port->tx_conf[qid] = port->dev_info.default_txconf;
+		port->tx_conf[qid].offloads |= offloads;
 
 		/* Check if any Tx parameters have been passed */
 		if (tx_pthresh != RTE_PMD_PARAM_UNSET)
author
#4 lore raw

Hi, Ferruh

Quoted 38 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 14, 2019 12:36 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 17 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should do "or" for port offloads.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

OK to this changes as a fix for this release.

Quoted 8 lines

But I think intention is, if no offload information is provided by user to use use the driver provided defaults, if user explicitly provided some values to use them, instead of OR these two.

With this approach it is not possible to disable a driver default value, so it becomes mandatory offload instead of default offload values.

Wei, what do you think, does it make sense?

I agree with you, but it is sure that the original code has offloads overwrite issue. What is your suggestion for code implement?
I find that Thomas has apply it, if you has other idea, maybe you has to commit patch base to this patch.

Quoted 16 lines

app/test-pmd/testpmd.c static void · line 2818

Quoted 4 lines
app/test-pmd/testpmd.c +0 -0
 		/* Check if any Rx parameters have been passed */
 		if (rx_pthresh != RTE_PMD_PARAM_UNSET) @@ -2833,7

+2836,9 @@

Quoted 11 lines
app/test-pmd/testpmd.c +0 -0
 rxtx_port_config(struct rte_port *port)
 	}
app/test-pmd/testpmd.c +2 -0
 	for (qid = 0; qid < nb_txq; qid++) {
+		offloads = port->tx_conf[qid].offloads;
 		port->tx_conf[qid] = port->dev_info.default_txconf;
+		port->tx_conf[qid].offloads |= offloads;
 
 		/* Check if any Tx parameters have been passed */
 		if (tx_pthresh != RTE_PMD_PARAM_UNSET)
#5 lore raw
Quoted 47 lines · Wei

Hi, Ferruh

Quoted 45 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 14, 2019 12:36 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 17 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should do "or" for port offloads.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

OK to this changes as a fix for this release.

But I think intention is, if no offload information is provided by user to use use the driver provided defaults, if user explicitly provided some values to use them, instead of OR these two.

With this approach it is not possible to disable a driver default value, so it becomes mandatory offload instead of default offload values.

Quoted 6 lines
Quoted 1 line

Wei, what do you think, does it make sense?

I agree with you, but it is sure that the original code has offloads overwrite issue. What is your suggestion for code implement?
I find that Thomas has apply it, if you has other idea, maybe you has to commit patch base to this patch.

Hi Wei,

Yes this needs to be incremental fix to existing code.

Queue specific offload can be altered either by providing Rx/Tx offload as command line argument [1] (port configs set to each queues) or via testpmd commands [2].
Does it make sense to set a global flag when one of above occurs and use default config only if it is not set?

[1]
Tx
tx-offloads
Rx
disable-crc-strip
enable-lro
enable-scatter
enable-rx-cksum
enable-rx-timestamp
enable-hw-vlan
enable-hw-vlan-filter
enable-hw-vlan-strip
enable-hw-vlan-extend

[2]
"port config <port_id> rx_offload ..."
"port <port_id> rxq <queue_id> rx_offload ..."
"port config <port_id> tx_offload ..."
"port <port_id> txq <queue_id> tx_offload ..."

author
#6 lore raw

Hi, Ferruh

Quoted 69 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, May 20, 2019 11:23 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 15 lines · Wei

Hi, Ferruh

Quoted 13 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 14, 2019 12:36 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 3 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should

do "or" for port offloads.

Quoted 29 lines
Quoted 29 lines
Quoted 14 lines
Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

OK to this changes as a fix for this release.

But I think intention is, if no offload information is provided by user to use use the driver provided defaults, if user explicitly provided some values to use them, instead of OR these two.

Quoted 7 lines
Quoted 4 lines

With this approach it is not possible to disable a driver default value, so it becomes mandatory offload instead of default offload values.

Wei, what do you think, does it make sense?

I agree with you, but it is sure that the original code has offloads overwrite

issue.

Quoted 2 lines

What is your suggestion for code implement?
I find that Thomas has apply it, if you has other idea, maybe you has to

commit patch base to this patch.

Hi Wei,

Quoted 7 lines

Yes this needs to be incremental fix to existing code.

Queue specific offload can be altered either by providing Rx/Tx offload as command line argument [1] (port configs set to each queues) or via testpmd commands [2].
Does it make sense to set a global flag when one of above occurs and use default config only if it is not set?

I AGREE with you to submit an incremental fix, and it make sense to set a global flag when one of above occurs and use
default config only if it is not set when implement code, but I do not have time to prepare such a patch by now, so maybe later or some else.

Quoted 21 lines

[1]
Tx
tx-offloads
Rx
disable-crc-strip
enable-lro
enable-scatter
enable-rx-cksum
enable-rx-timestamp
enable-hw-vlan
enable-hw-vlan-filter
enable-hw-vlan-strip
enable-hw-vlan-extend

[2]
"port config <port_id> rx_offload ..."
"port <port_id> rxq <queue_id> rx_offload ..."
"port config <port_id> tx_offload ..."
"port <port_id> txq <queue_id> tx_offload ..."

#7 lore raw
Quoted 73 lines · Wei

Hi, Ferruh

Quoted 71 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, May 20, 2019 11:23 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 15 lines · Wei

Hi, Ferruh

Quoted 13 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 14, 2019 12:36 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 3 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should

do "or" for port offloads.

Quoted 29 lines
Quoted 29 lines
Quoted 14 lines
Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

OK to this changes as a fix for this release.

But I think intention is, if no offload information is provided by user to use use the driver provided defaults, if user explicitly provided some values to use them, instead of OR these two.

Quoted 7 lines
Quoted 4 lines

With this approach it is not possible to disable a driver default value, so it becomes mandatory offload instead of default offload values.

Wei, what do you think, does it make sense?

I agree with you, but it is sure that the original code has offloads overwrite

issue.

Quoted 2 lines

What is your suggestion for code implement?
I find that Thomas has apply it, if you has other idea, maybe you has to

commit patch base to this patch.

Hi Wei,

Yes this needs to be incremental fix to existing code.

Quoted 8 lines
Quoted 5 lines

Queue specific offload can be altered either by providing Rx/Tx offload as command line argument [1] (port configs set to each queues) or via testpmd commands [2].
Does it make sense to set a global flag when one of above occurs and use default config only if it is not set?

I AGREE with you to submit an incremental fix, and it make sense to set a global flag when one of above occurs and use
default config only if it is not set when implement code, but I do not have time to prepare such a patch by now, so maybe later or some else.

I see, can you submit a public defect to record the issue, so it can be addressed later without forgotten?

Quoted 23 lines
Quoted 22 lines

[1]
Tx
tx-offloads
Rx
disable-crc-strip
enable-lro
enable-scatter
enable-rx-cksum
enable-rx-timestamp
enable-hw-vlan
enable-hw-vlan-filter
enable-hw-vlan-strip
enable-hw-vlan-extend

[2]
"port config <port_id> rx_offload ..."
"port <port_id> rxq <queue_id> rx_offload ..."
"port config <port_id> tx_offload ..."
"port <port_id> txq <queue_id> tx_offload ..."

author
#8 lore raw

Hi, Ferruh

Quoted 92 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 21, 2019 11:43 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 82 lines · Wei

Hi, Ferruh

Quoted 79 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, May 20, 2019 11:23 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 16 lines · Wei

Hi, Ferruh

Quoted 14 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 14, 2019 12:36 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 4 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should

do "or" for port offloads.

Quoted 29 lines
Quoted 29 lines
Quoted 14 lines
Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void rxtx_port_config(struct · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void  rxtx_port_config(struct
 rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

OK to this changes as a fix for this release.

But I think intention is, if no offload information is provided by user to use use the driver provided defaults, if user explicitly provided some values to use them, instead of OR these two.

Quoted 8 lines
Quoted 4 lines

With this approach it is not possible to disable a driver default value, so it becomes mandatory offload instead of default offload values.

Wei, what do you think, does it make sense?

I agree with you, but it is sure that the original code has offloads overwrite

issue.

Quoted 3 lines

What is your suggestion for code implement?
I find that Thomas has apply it, if you has other idea, maybe you has to

commit patch base to this patch.

Hi Wei,

Yes this needs to be incremental fix to existing code.

Queue specific offload can be altered either by providing Rx/Tx offload as command line argument [1] (port configs set to each queues) or via testpmd commands [2].
Does it make sense to set a global flag when one of above occurs and use default config only if it is not set?

Quoted 7 lines
Quoted 2 lines

I AGREE with you to submit an incremental fix, and it make sense to set a global flag when one of above occurs and use default config only if it is

not set when implement code, but I do not have time to prepare such a patch by now, so maybe later or some else.

I see, can you submit a public defect to record the issue, so it can be addressed later without forgotten?

Sure, but what is a public defect patch? Do you mean I need to update some doc? Can you give me a link as an example ?

Quoted 24 lines
Quoted 24 lines
Quoted 23 lines

[1]
Tx
tx-offloads
Rx
disable-crc-strip
enable-lro
enable-scatter
enable-rx-cksum
enable-rx-timestamp
enable-hw-vlan
enable-hw-vlan-filter
enable-hw-vlan-strip
enable-hw-vlan-extend

[2]
"port config <port_id> rx_offload ..."
"port <port_id> rxq <queue_id> rx_offload ..."
"port config <port_id> tx_offload ..."
"port <port_id> txq <queue_id> tx_offload ..."

#9 lore raw
Quoted 97 lines · Wei

Hi, Ferruh

Quoted 94 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 21, 2019 11:43 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 84 lines · Wei

Hi, Ferruh

Quoted 72 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, May 20, 2019 11:23 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 16 lines · Wei

Hi, Ferruh

Quoted 14 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 14, 2019 12:36 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 4 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should

do "or" for port offloads.

Quoted 29 lines
Quoted 29 lines
Quoted 14 lines
Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void rxtx_port_config(struct · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void  rxtx_port_config(struct
 rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

OK to this changes as a fix for this release.

But I think intention is, if no offload information is provided by user to use use the driver provided defaults, if user explicitly provided some values to use them, instead of OR these two.

Quoted 8 lines
Quoted 4 lines

With this approach it is not possible to disable a driver default value, so it becomes mandatory offload instead of default offload values.

Wei, what do you think, does it make sense?

I agree with you, but it is sure that the original code has offloads overwrite

issue.

Quoted 3 lines

What is your suggestion for code implement?
I find that Thomas has apply it, if you has other idea, maybe you has to

commit patch base to this patch.

Hi Wei,

Quoted 7 lines

Yes this needs to be incremental fix to existing code.

Queue specific offload can be altered either by providing Rx/Tx offload as command line argument [1] (port configs set to each queues) or via testpmd commands [2].
Does it make sense to set a global flag when one of above occurs and use default config only if it is not set?

I AGREE with you to submit an incremental fix, and it make sense to set a global flag when one of above occurs and use default config only if it is

Quoted 7 lines
Quoted 5 lines

not set when implement code, but I do not have time to prepare such a patch by now, so maybe later or some else.

I see, can you submit a public defect to record the issue, so it can be addressed later without forgotten?

Sure, but what is a public defect patch? Do you mean I need to update some doc? Can you give me a link as an example

No documentation, please create an issue in public DPDK bug tracker:
https://bugs.dpdk.org/

Quoted 27 lines
Quoted 26 lines
Quoted 26 lines
Quoted 25 lines

[1]
Tx
tx-offloads
Rx
disable-crc-strip
enable-lro
enable-scatter
enable-rx-cksum
enable-rx-timestamp
enable-hw-vlan
enable-hw-vlan-filter
enable-hw-vlan-strip
enable-hw-vlan-extend

[2]
"port config <port_id> rx_offload ..."
"port <port_id> rxq <queue_id> rx_offload ..."
"port config <port_id> tx_offload ..."
"port <port_id> txq <queue_id> tx_offload ..."

author
#10 lore raw

Hi, Ferruh

A patch has been commit for this issue by me, so no need for bug tracker
https://patches.dpdk.org/patch/54584/

Quoted 150 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, May 24, 2019 9:04 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 74 lines · Wei

Hi, Ferruh

Quoted 71 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 21, 2019 11:43 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 61 lines · Wei

Hi, Ferruh

Quoted 59 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, May 20, 2019 11:23 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 16 lines · Wei

Hi, Ferruh

Quoted 14 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, May 14, 2019 12:36 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 4 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should

do "or" for port offloads.

Quoted 32 lines
Quoted 32 lines
Quoted 15 lines
Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c +0 -0

index
6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void rxtx_port_config(struct · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void  rxtx_port_config(struct
 rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

OK to this changes as a fix for this release.

But I think intention is, if no offload information is provided by user to use use the driver provided defaults, if user explicitly provided some values to use them, instead of OR these two.

With this approach it is not possible to disable a driver default value, so it becomes mandatory offload instead of default offload

values.

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 14 lines
Quoted 6 lines
Quoted 2 lines

Wei, what do you think, does it make sense?

I agree with you, but it is sure that the original code has offloads overwrite

issue.

Quoted 3 lines

What is your suggestion for code implement?
I find that Thomas has apply it, if you has other idea, maybe you has to

commit patch base to this patch.

Hi Wei,

Quoted 7 lines

Yes this needs to be incremental fix to existing code.

Queue specific offload can be altered either by providing Rx/Tx offload as command line argument [1] (port configs set to each queues) or via testpmd commands [2].
Does it make sense to set a global flag when one of above occurs and use default config only if it is not set?

I AGREE with you to submit an incremental fix, and it make sense to set a global flag when one of above occurs and use default config only if it is

Quoted 8 lines
Quoted 5 lines

not set when implement code, but I do not have time to prepare such a patch by now, so maybe later or some else.

I see, can you submit a public defect to record the issue, so it can be addressed later without forgotten?

Sure, but what is a public defect patch? Do you mean I need to update some doc? Can you give me a link as an example

No documentation, please create an issue in public DPDK bug tracker:
https://bugs.dpdk.org/

Quoted 27 lines
Quoted 26 lines
Quoted 26 lines
Quoted 25 lines

[1]
Tx
tx-offloads
Rx
disable-crc-strip
enable-lro
enable-scatter
enable-rx-cksum
enable-rx-timestamp
enable-hw-vlan
enable-hw-vlan-filter
enable-hw-vlan-strip
enable-hw-vlan-extend

[2]
"port config <port_id> rx_offload ..."
"port <port_id> rxq <queue_id> rx_offload ..."
"port config <port_id> tx_offload ..."
"port <port_id> txq <queue_id> tx_offload ..."

#11 lore raw
In reply to Wei Zhao
Quoted 17 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should do "or" for port offloads.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c +0 -0
index 6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2817

Quoted 9 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)
 {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

While talking with Kevin, he pointed out the error in this code.

We are updating queue level offloads, with whatever in the 'offloads' and it can be non-queue level offloads in it, next time ethdev API called these values are caught by the API checks and causing an error.

It looks like port level offload flags needs to be masted out before writing to queue level 'offloads' variable.

Quoted 14 lines
app/test-pmd/testpmd.c +2 -0
 		/* Check if any Rx parameters have been passed */
 		if (rx_pthresh != RTE_PMD_PARAM_UNSET)
@@ -2833,7 +2836,9 @@ rxtx_port_config(struct rte_port *port)
 	}
 
 	for (qid = 0; qid < nb_txq; qid++) {
+		offloads = port->tx_conf[qid].offloads;
 		port->tx_conf[qid] = port->dev_info.default_txconf;
+		port->tx_conf[qid].offloads |= offloads;
 
 		/* Check if any Tx parameters have been passed */
 		if (tx_pthresh != RTE_PMD_PARAM_UNSET)
author
#12 lore raw

Hi, Ferruh

Quoted 38 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, June 11, 2019 10:37 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Kevin Traynor <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 17 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should do "or" for port offloads.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

While talking with Kevin, he pointed out the error in this code.

Quoted 6 lines

We are updating queue level offloads, with whatever in the 'offloads' and it can be non-queue level offloads in it, next time ethdev API called these values are caught by the API checks and causing an error.

It looks like port level offload flags needs to be masted out before writing to queue level 'offloads' variable.

By now, the default offloads value of i40e and ixgbe is 0, so it do not cause error when set port offloads to queue. But if it is not 0, maybe that will happen as you said.

Quoted 16 lines

app/test-pmd/testpmd.c static void · line 2818

Quoted 4 lines
app/test-pmd/testpmd.c +0 -0
 		/* Check if any Rx parameters have been passed */
 		if (rx_pthresh != RTE_PMD_PARAM_UNSET) @@ -2833,7

+2836,9 @@

Quoted 11 lines
app/test-pmd/testpmd.c +0 -0
 rxtx_port_config(struct rte_port *port)
 	}
app/test-pmd/testpmd.c +2 -0
 	for (qid = 0; qid < nb_txq; qid++) {
+		offloads = port->tx_conf[qid].offloads;
 		port->tx_conf[qid] = port->dev_info.default_txconf;
+		port->tx_conf[qid].offloads |= offloads;
 
 		/* Check if any Tx parameters have been passed */
 		if (tx_pthresh != RTE_PMD_PARAM_UNSET)
author
#13 lore raw
In reply to Ferruh Yigit
Quoted 40 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, June 11, 2019 10:37 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Kevin Traynor <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 17 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should do "or" for port offloads.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

While talking with Kevin, he pointed out the error in this code.

Quoted 6 lines

We are updating queue level offloads, with whatever in the 'offloads' and it can be non-queue level offloads in it, next time ethdev API called these values are caught by the API checks and causing an error.

It looks like port level offload flags needs to be masted out before writing to queue level 'offloads' variable.

By the way, this error in not introduced in this patch, it seems has exist long before this patch. This patch is just fix for overwrite problem.

Quoted 16 lines

app/test-pmd/testpmd.c static void · line 2818

Quoted 4 lines
app/test-pmd/testpmd.c +0 -0
 		/* Check if any Rx parameters have been passed */
 		if (rx_pthresh != RTE_PMD_PARAM_UNSET) @@ -2833,7

+2836,9 @@

Quoted 11 lines
app/test-pmd/testpmd.c +0 -0
 rxtx_port_config(struct rte_port *port)
 	}
app/test-pmd/testpmd.c +2 -0
 	for (qid = 0; qid < nb_txq; qid++) {
+		offloads = port->tx_conf[qid].offloads;
 		port->tx_conf[qid] = port->dev_info.default_txconf;
+		port->tx_conf[qid].offloads |= offloads;
 
 		/* Check if any Tx parameters have been passed */
 		if (tx_pthresh != RTE_PMD_PARAM_UNSET)
#14 lore raw
Quoted 44 lines · Wei
Quoted 44 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, June 11, 2019 10:37 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Kevin Traynor <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 17 lines · Wei Zhao

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should do "or" for port offloads.

Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

While talking with Kevin, he pointed out the error in this code.

We are updating queue level offloads, with whatever in the 'offloads' and it can be non-queue level offloads in it, next time ethdev API called these values are caught by the API checks and causing an error.

Quoted 6 lines
Quoted 2 lines

It looks like port level offload flags needs to be masted out before writing to queue level 'offloads' variable.

By the way, this error in not introduced in this patch, it seems has exist long before this patch. This patch is just fix for overwrite problem.

I disagree, writing 'offloads' to "rx_conf[].offloads" without checking if they queue offloads or not causing this problem. And that write introduced in this patch.

Quoted 20 lines
Quoted 19 lines

app/test-pmd/testpmd.c static void · line 2818

Quoted 7 lines
app/test-pmd/testpmd.c +0 -0
 		/* Check if any Rx parameters have been passed */
 		if (rx_pthresh != RTE_PMD_PARAM_UNSET) @@ -2833,7

+2836,9 @@

Quoted 11 lines
app/test-pmd/testpmd.c +0 -0
 rxtx_port_config(struct rte_port *port)
 	}
app/test-pmd/testpmd.c +2 -0
 	for (qid = 0; qid < nb_txq; qid++) {
+		offloads = port->tx_conf[qid].offloads;
 		port->tx_conf[qid] = port->dev_info.default_txconf;
+		port->tx_conf[qid].offloads |= offloads;
 
 		/* Check if any Tx parameters have been passed */
 		if (tx_pthresh != RTE_PMD_PARAM_UNSET)
author
#15 lore raw
Quoted 61 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, June 14, 2019 11:42 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Kevin Traynor <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 11 lines · Wei
Quoted 11 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, June 11, 2019 10:37 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Kevin Traynor <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 4 lines
Quoted 4 lines · Wei Zhao
Quoted 3 lines

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should

do "or" for port offloads.

Quoted 33 lines
Quoted 31 lines
Quoted 14 lines
Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

While talking with Kevin, he pointed out the error in this code.

We are updating queue level offloads, with whatever in the 'offloads' and it can be non-queue level offloads in it, next time ethdev API called these values are caught by the API checks and causing an error.

It looks like port level offload flags needs to be masted out before writing to queue level 'offloads' variable.

Quoted 8 lines
Quoted 1 line

By the way, this error in not introduced in this patch, it seems has exist long

before this patch.

Quoted 1 line

This patch is just fix for overwrite problem.

I disagree, writing 'offloads' to "rx_conf[].offloads" without checking if they queue offloads or not causing this problem. And that write introduced in this patch.

But if delete the patch I submitted, this bug still exists there.

Quoted 21 lines
Quoted 21 lines
Quoted 20 lines

app/test-pmd/testpmd.c static void · line 2818

Quoted 8 lines
app/test-pmd/testpmd.c +0 -0
 		/* Check if any Rx parameters have been passed */
 		if (rx_pthresh != RTE_PMD_PARAM_UNSET) @@ -2833,7

+2836,9 @@

Quoted 11 lines
app/test-pmd/testpmd.c +0 -0
 rxtx_port_config(struct rte_port *port)
 	}
app/test-pmd/testpmd.c +2 -0
 	for (qid = 0; qid < nb_txq; qid++) {
+		offloads = port->tx_conf[qid].offloads;
 		port->tx_conf[qid] = port->dev_info.default_txconf;
+		port->tx_conf[qid].offloads |= offloads;
 
 		/* Check if any Tx parameters have been passed */
 		if (tx_pthresh != RTE_PMD_PARAM_UNSET)
#16 lore raw
Quoted 63 lines · Wei
Quoted 63 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, June 14, 2019 11:42 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Kevin Traynor <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 11 lines · Wei
Quoted 11 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, June 11, 2019 10:37 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]; Peng, Yuan <[email protected]>; Lu, Wenzhuo <[email protected]>; Kevin Traynor <[email protected]>
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix offloads overwrite by default configuration

Quoted 4 lines
Quoted 4 lines · Wei Zhao
Quoted 3 lines

There is an error in function rxtx_port_config(), which may overwrite offloads configuration get from function launch_args_parse() when run testpmd app. So rxtx_port_config() should

do "or" for port offloads.

Quoted 29 lines
Quoted 29 lines
Quoted 14 lines
Fixes d44f8a485f5d ("app/testpmd: enable per queue configure")
---
 app/test-pmd/testpmd.c | 5 +++++
 1 file changed, 5 insertions(+)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

6fbfd29..f0061d9 100644

app/test-pmd/testpmd.c static void · line 2816

Quoted 8 lines
app/test-pmd/testpmd.c +3 -0
@@ -2809,9 +2809,12 @@ static void
 rxtx_port_config(struct rte_port *port)  {
 	uint16_t qid;
+	uint64_t offloads;
 
 	for (qid = 0; qid < nb_rxq; qid++) {
+		offloads = port->rx_conf[qid].offloads;
 		port->rx_conf[qid] = port->dev_info.default_rxconf;
+		port->rx_conf[qid].offloads |= offloads;

While talking with Kevin, he pointed out the error in this code.

We are updating queue level offloads, with whatever in the 'offloads' and it can be non-queue level offloads in it, next time ethdev API called these values are caught by the API checks and causing an error.

Quoted 5 lines
Quoted 2 lines

It looks like port level offload flags needs to be masted out before writing to queue level 'offloads' variable.

By the way, this error in not introduced in this patch, it seems has exist long

before this patch.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

This patch is just fix for overwrite problem.

I disagree, writing 'offloads' to "rx_conf[].offloads" without checking if they queue offloads or not causing this problem. And that write introduced in this patch.

But if delete the patch I submitted, this bug still exists there.

OK, after checking again, the defect was there as you said, but your patch makes it visible.

How to reproduce the problem:

testpmd> port stop all
testpmd> port config all crc-strip on
testpmd> port start all
Ethdev port_id=0 rx_queue_id=0, new added offloads 0x10000 must be within per-queue offload capabilities 0x0 in rte_eth_rx_queue_setup()

The failure is coming from 'rte_eth_rx_queue_setup()' and a valid error, a "port level offload" can't be set to individual queues without setting in port level, that is what happening here.
"port config all crc-strip on" removes the 'keep_crc' offload from port but not from queues, so when 'rte_eth_rx_queue_setup()' called it complains about it.

Before your patch "queue offloads" were overwritten and this error was not observed.

The solution can be updating "port config all xxxx on|off" command to updates queue offload values too, but even better we can remove it completely:

There are already different testpmd commands for same thing:
"port config <port_id> rx_offload <offload>"
"port config <port_id> tx_offload <offload>"
"port <port_id> txq <queue_id> rx_offload <offload>" "port <port_id> txq <queue_id> tx_offload <offload>"

For example using "port config 0 rx_offload crc-strip on" will work without error since it sets the port and queue offload properly.

Only missing thing in above commands are "all" parameter. I suggest removing "port config all <offload> on|off" and adding "all" support to above commands.

Quoted 23 lines
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines

app/test-pmd/testpmd.c static void · line 2818

Quoted 9 lines
app/test-pmd/testpmd.c +0 -0
 		/* Check if any Rx parameters have been passed */
 		if (rx_pthresh != RTE_PMD_PARAM_UNSET) @@ -2833,7

+2836,9 @@

Quoted 11 lines
app/test-pmd/testpmd.c +0 -0
 rxtx_port_config(struct rte_port *port)
 	}
app/test-pmd/testpmd.c +2 -0
 	for (qid = 0; qid < nb_txq; qid++) {
+		offloads = port->tx_conf[qid].offloads;
 		port->tx_conf[qid] = port->dev_info.default_txconf;
+		port->tx_conf[qid].offloads |= offloads;
 
 		/* Check if any Tx parameters have been passed */
 		if (tx_pthresh != RTE_PMD_PARAM_UNSET)