app/testpmd: fix the command to set tunnel TSO
cover app/testpmd: fix the command to set tunnel TSO
Please see each patch in the series for detail.
Huisong Li (3):
app/testpmd: fix random value to set tunnel TSO app/testpmd: add the explicit check for tunnel TSO offload app/testpmd: fix unnecessary change when set tunnel TSO
app/test-pmd/cmdline.c | 102 ++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 52 deletions(-)
Signature · 1 line
2.33.0
PATCH 1/3 app/testpmd: fix random value to set tunnel TSO
Currently, testpmd set tunnel TSO offload even if fail to get dev_info. In this case, the 'tx_offload_capa' in dev_info is a random value,
--- app/test-pmd/cmdline.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
app/test-pmd/cmdline.c +14 -15
@@ -5035,39 +5035,33 @@ struct cmd_tunnel_tso_set_result {portid_t port_id; }; -static struct rte_eth_dev_info -check_tunnel_tso_nic_support (portid_t port_id) +static void +check_tunnel_tso_nic_support (portid_t port_id,uint64_t tx_offload_capa) { -struct rte_eth_dev_info dev_info; - -if (eth_dev_info_get_print_err (port_id, &dev_info) !=0 ) -return dev_info; - -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO ))fprintf (stderr,"Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO ))fprintf (stderr,"Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO ))fprintf (stderr,"Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO ))fprintf (stderr,"Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO ))fprintf (stderr,"Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ))fprintf (stderr,"Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -return dev_info; } static void
@@ -5077,6 +5071,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, {struct cmd_tunnel_tso_set_result *res = parsed_result;struct rte_eth_dev_info dev_info; +int ret;if (port_id_is_invalid (res->port_id,ENABLED_WARN ))return ;
@@ -5088,7 +5083,11 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,if (!strcmp (res->mode,"set" )) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - dev_info =check_tunnel_tso_nic_support (res->port_id); + ret =eth_dev_info_get_print_err (res->port_id, &dev_info); +if (ret !=0 ) +return ; + +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa);if (ports[res->port_id].tunnel_tso_segsz ==0 ) { ports[res->port_id].dev_conf.txmode.offloads &= ~(RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
Signature · 1 line
2.33.0
Re: [PATCH v1 1/3] app/testpmd: fix random value to set tunnel TSO
Hi,
(minor question below)
Quoted 16 lines · Huisong Li
Currently, testpmd set tunnel TSO offload even if fail to get
dev_info. In this case, the 'tx_offload_capa' indev_infois a random value,Fixes 6f51deb903b2 ("app/testpmd: check status of getting ethdev info")Signed-off-by Huisong Li <[email protected]>---
app/test-pmd/cmdline.c| 29 ++++++++++++++---------------1 file changed, 14 insertions(+), 15 deletions(-)app/test-pmd/cmdline.c +0
-0
app/test-pmd/cmdline.c struct cmd_tunnel_tso_set_result { · line 5041
Quoted 9 lines
app/test-pmd/cmdline.c +2
-3@@ -5035,39 +5035,33 @@ struct cmd_tunnel_tso_set_result {portid_t port_id; }; -static struct rte_eth_dev_info -check_tunnel_tso_nic_support (portid_t port_id) +static void +check_tunnel_tso_nic_support (portid_t port_id,uint64_t tx_offload_capa) { -struct rte_eth_dev_info dev_info;
Why not just initialise this to zeros?
Quoted 63 lines
app/test-pmd/cmdline.c +6
-11- -if (eth_dev_info_get_print_err (port_id, &dev_info) !=0 ) -return dev_info; - -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO ))fprintf (stderr,"Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO ))fprintf (stderr,"Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO ))fprintf (stderr,"Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO ))fprintf (stderr,"Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO ))fprintf (stderr,"Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ))fprintf (stderr,"Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -return dev_info; }static void
app/test-pmd/cmdline.c +6
-1@@ -5077,6 +5071,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, {struct cmd_tunnel_tso_set_result *res = parsed_result;struct rte_eth_dev_info dev_info; +int ret;if (port_id_is_invalid (res->port_id,ENABLED_WARN ))return ;@@ -5088,7 +5083,11 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,if (!strcmp (res->mode,"set" )) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - dev_info =check_tunnel_tso_nic_support (res->port_id); + ret =eth_dev_info_get_print_err (res->port_id, &dev_info); +if (ret !=0 ) +return ; + +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa);if (ports[res->port_id].tunnel_tso_segsz ==0 ) { ports[res->port_id].dev_conf.txmode.offloads &= ~(RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |Signature · 1 line
2.33.0
Thank you.
Re: [PATCH v1 1/3] app/testpmd: fix random value to set tunnel TSO
Hi,
Thanks for your review.
Quoted 25 lines · Ivan Malov
Hi,
(minor question below)
Quoted 19 lines · Huisong Li
Currently, testpmd set tunnel TSO offload even if fail to get
dev_info. In this case, the 'tx_offload_capa' indev_infois a random value,Fixes 6f51deb903b2 ("app/testpmd: check status of getting ethdev info")Signed-off-by Huisong Li <[email protected]>---
app/test-pmd/cmdline.c| 29 ++++++++++++++---------------1 file changed, 14 insertions(+), 15 deletions(-)app/test-pmd/cmdline.c +0
-0@@ -5035,39 +5035,33 @@ struct cmd_tunnel_tso_set_result { portid_t port_id; };
Quoted 9 lines
app/test-pmd/cmdline.c struct cmd_tunnel_tso_set_result { · line 5041
Quoted 7 lines
app/test-pmd/cmdline.c +2
-3-static struct rte_eth_dev_info -check_tunnel_tso_nic_support (portid_t port_id) +static void +check_tunnel_tso_nic_support (portid_t port_id,uint64_t tx_offload_capa) { - struct rte_eth_dev_info dev_info;Why not just initialise this to zeros?
The main purpose of this function is to check which tunnel TSO offload port supports instead of getting dev_info, right?
Quoted 70 lines
Quoted 60 lines
app/test-pmd/cmdline.c +6
-11- - if (eth_dev_info_get_print_err(port_id, &dev_info) != 0) - return dev_info; - - if (!(dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO)) + if (!(tx_offload_capa & RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO)) fprintf(stderr, "Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n", port_id); - if (!(dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO)) + if (!(tx_offload_capa & RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO)) fprintf(stderr, "Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n", port_id); - if (!(dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO)) + if (!(tx_offload_capa & RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO)) fprintf(stderr, "Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n", port_id); - if (!(dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO)) + if (!(tx_offload_capa & RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO)) fprintf(stderr, "Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n", port_id); - if (!(dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_IP_TNL_TSO)) + if (!(tx_offload_capa & RTE_ETH_TX_OFFLOAD_IP_TNL_TSO)) fprintf(stderr, "Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n", port_id); - if (!(dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO)) + if (!(tx_offload_capa & RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO)) fprintf(stderr, "Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n", port_id); - return dev_info; }static void
app/test-pmd/cmdline.c +6
-1@@ -5077,6 +5071,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, { struct cmd_tunnel_tso_set_result *res = parsed_result; struct rte_eth_dev_info dev_info; + int ret; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return;@@ -5088,7 +5083,11 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - dev_info = check_tunnel_tso_nic_support(res->port_id); + ret = eth_dev_info_get_print_err(res->port_id, &dev_info); + if (ret != 0) + return; + + check_tunnel_tso_nic_support(res->port_id, dev_info.tx_offload_capa); if (ports[res->port_id].tunnel_tso_segsz == 0) {Quoted 6 lines
ports[res->port_id].dev_conf.txmode.offloads &= ~(RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
Signature · 1 line
2.33.0Thank you.
.
Re: [PATCH v1 1/3] app/testpmd: fix random value to set tunnel TSO
Quoted 40 lines · lihuisong (C)
Hi,
Thanks for your review.
Quoted 25 lines · Ivan Malov
Hi,
(minor question below)
Quoted 19 lines · Huisong Li
Currently, testpmd set tunnel TSO offload even if fail to get
dev_info. In this case, the 'tx_offload_capa' indev_infois a random value,Fixes 6f51deb903b2 ("app/testpmd: check status of getting ethdev info")Signed-off-by Huisong Li <[email protected]>---
app/test-pmd/cmdline.c| 29 ++++++++++++++---------------1 file changed, 14 insertions(+), 15 deletions(-)app/test-pmd/cmdline.c +0
-0@@ -5035,39 +5035,33 @@ struct cmd_tunnel_tso_set_result { portid_t port_id; };Quoted 9 lines
app/test-pmd/cmdline.c struct cmd_tunnel_tso_set_result { · line 5041
Quoted 7 lines
app/test-pmd/cmdline.c +2
-3-static struct rte_eth_dev_info -check_tunnel_tso_nic_support (portid_t port_id) +static void +check_tunnel_tso_nic_support (portid_t port_id,uint64_t tx_offload_capa) { - struct rte_eth_dev_info dev_info;Why not just initialise this to zeros?
Quoted 3 lines
The main purpose of this function is to check which tunnel TSO offload port supports instead of getting
dev_info, right?
Agree with Huisong, zeroing out the dev_info doesn't help much, this function still will fail to do its job, and caller function will still get wrong dev info.
Quoted 76 lines
Quoted 76 lines
Quoted 66 lines
app/test-pmd/cmdline.c +1
-5- - if (eth_dev_info_get_print_err(port_id, &dev_info) != 0) - return dev_info; - - if (!(dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO)) + if (!(tx_offload_capa & RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO)) fprintf(stderr,"Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
- if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO)) + if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO)) fprintf(stderr,
"Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
- if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO)) + if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO)) fprintf(stderr,
"Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
- if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO))
+ if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO)) fprintf(stderr,
"Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
- if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO)) + if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO)) fprintf(stderr,
"Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
- if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO)) + if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO)) fprintf(stderr,
"Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
- returndev_info;
}static void
app/test-pmd/cmdline.c +6
-1@@ -5077,6 +5071,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, { struct cmd_tunnel_tso_set_result *res = parsed_result; struct rte_eth_dev_info dev_info; + int ret; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return;@@ -5088,7 +5083,11 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - dev_info = check_tunnel_tso_nic_support(res->port_id); + ret = eth_dev_info_get_print_err(res->port_id, &dev_info); + if (ret != 0) + return; + + check_tunnel_tso_nic_support(res->port_id, dev_info.tx_offload_capa); if (ports[res->port_id].tunnel_tso_segsz == 0) {Quoted 6 lines
ports[res->port_id].dev_conf.txmode.offloads &= ~(RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | --
2.33.0Thank you.
.
PATCH 2/3 app/testpmd: add the explicit check for tunnel TSO offload
In reply to Huisong LiIf port don't support TSO of tunnel packets, tell user in advance and no need to change other configuration of this port in case of fault spread.
In addition, if some tunnel offloads don't support, which is not an error case, the log about this shouldn't be to stderr.
--- app/test-pmd/cmdline.c | 51 +++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 28 deletions(-)
app/test-pmd/cmdline.c +23 -28
@@ -5039,28 +5039,22 @@ static void check_tunnel_tso_nic_support(portid_t port_id, uint64_t tx_offload_capa) {if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO )) -fprintf (stderr, -"Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO )) -fprintf (stderr, -"Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO )) -fprintf (stderr, -"Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO )) -fprintf (stderr, -"Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO )) -fprintf (stderr, -"Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO )) -fprintf (stderr, -"Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); }
@@ -5071,6 +5065,12 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, {struct cmd_tunnel_tso_set_result *res = parsed_result;struct rte_eth_dev_info dev_info; +uint64_t all_tunnel_tso =RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | +RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | +RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | +RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | +RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | +RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ;int ret;if (port_id_is_invalid (res->port_id,ENABLED_WARN ))
@@ -5087,26 +5087,21 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,if (ret !=0 )return ; -check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); +if (ports[res->port_id].tunnel_tso_segsz !=0 ) { +if ((all_tunnel_tso & dev_info.tx_offload_capa) ==0 ) { +fprintf (stderr,"Error: port=%u don't support tunnel TSO offloads.\n" , + res->port_id); +return ; + } +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); + } +if (ports[res->port_id].tunnel_tso_segsz ==0 ) { - ports[res->port_id].dev_conf.txmode.offloads &= - ~(RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ); + ports[res->port_id].dev_conf.txmode.offloads &= ~all_tunnel_tso;printf ("TSO for tunneled packets is disabled\n" ); }else { -uint64_t tso_offloads = (RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ); - ports[res->port_id].dev_conf.txmode.offloads |= - (tso_offloads & dev_info.tx_offload_capa); + (all_tunnel_tso & dev_info.tx_offload_capa);printf ("TSO segment size for tunneled packets is %d\n" , ports[res->port_id].tunnel_tso_segsz);
Signature · 1 line
2.33.0
Re: [PATCH v1 2/3] app/testpmd: add the explicit check for tunnel TSO offload
Quoted 6 lines · Huisong Li
If port don't support TSO of tunnel packets, tell user in advance and no need to change other configuration of this port in case of fault spread.
In addition, if some tunnel offloads don't support, which is not an error case, the log about this shouldn't be to stderr.
Overall patch looks good to me, please check a minor comment below.
Quoted 64 lines
Fixes 3926dd2b6668 ("app/testpmd: enforce offload capabilities check")Signed-off-by Huisong Li <[email protected]>--- app/test-pmd/cmdline.c | 51 +++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 28 deletions(-)app/test-pmd/cmdline.c +12
-12@@ -5039,28 +5039,22 @@ static void check_tunnel_tso_nic_support(portid_t port_id, uint64_t tx_offload_capa) {if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO )) -fprintf (stderr, -"Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO )) -fprintf (stderr, -"Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO )) -fprintf (stderr, -"Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO )) -fprintf (stderr, -"Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO )) -fprintf (stderr, -"Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO )) -fprintf (stderr, -"Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); }@@ -5071,6 +5065,12 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, {struct cmd_tunnel_tso_set_result *res = parsed_result;struct rte_eth_dev_info dev_info; +uint64_t all_tunnel_tso =RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | +RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | +RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | +RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | +RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | +RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ;int ret;if (port_id_is_invalid (res->port_id,ENABLED_WARN ))@@ -5087,26 +5087,21 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,if (ret !=0 )return ;
app/test-pmd/cmdline.c cmd_tunnel_tso_set_parsed(void *parsed_result, · line 5098
Quoted 10 lines
app/test-pmd/cmdline.c +9
-1-check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); +if (ports[res->port_id].tunnel_tso_segsz !=0 ) { +if ((all_tunnel_tso & dev_info.tx_offload_capa) ==0 ) { +fprintf (stderr,"Error: port=%u don't support tunnel TSO offloads.\n" , + res->port_id); +return ; + } +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); + } +
Instead of having a separate if block, else leg of below if block does same check [1], what do you think to move above block to there?
Quoted 8 lines
app/test-pmd/cmdline.c +0
-7if (ports[res->port_id].tunnel_tso_segsz ==0 ) { - ports[res->port_id].dev_conf.txmode.offloads &= - ~(RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO );
app/test-pmd/cmdline.c cmd_tunnel_tso_set_parsed(void *parsed_result, · line 5107
Quoted 10 lines
app/test-pmd/cmdline.c +1
-7+ ports[res->port_id].dev_conf.txmode.offloads &= ~all_tunnel_tso;printf ("TSO for tunneled packets is disabled\n" ); }else { -uint64_t tso_offloads = (RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ); -
[1] ---> here has same logical condition
Quoted 6 lines
app/test-pmd/cmdline.c +1
-1ports[res->port_id].dev_conf.txmode.offloads |= - (tso_offloads & dev_info.tx_offload_capa); + (all_tunnel_tso & dev_info.tx_offload_capa);printf ("TSO segment size for tunneled packets is %d\n" , ports[res->port_id].tunnel_tso_segsz);
Re: [PATCH v1 2/3] app/testpmd: add the explicit check for tunnel TSO offload
Hi Ferruh,
Thanks for you review so fast.
Quoted 73 lines · Ferruh Yigit
Quoted 6 lines · Huisong Li
If port don't support TSO of tunnel packets, tell user in advance and no need to change other configuration of this port in case of fault spread.
In addition, if some tunnel offloads don't support, which is not an error case, the log about this shouldn't be to stderr.
Overall patch looks good to me, please check a minor comment below.
Quoted 64 lines
Fixes 3926dd2b6668 ("app/testpmd: enforce offload capabilities check")Signed-off-by Huisong Li <[email protected]>--- app/test-pmd/cmdline.c | 51 +++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 28 deletions(-)app/test-pmd/cmdline.c +12
-12@@ -5039,28 +5039,22 @@ static void check_tunnel_tso_nic_support(portid_t port_id, uint64_t tx_offload_capa) {if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO )) -fprintf (stderr, -"Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO )) -fprintf (stderr, -"Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO )) -fprintf (stderr, -"Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO )) -fprintf (stderr, -"Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO )) -fprintf (stderr, -"Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO )) -fprintf (stderr, -"Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); }@@ -5071,6 +5065,12 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, {struct cmd_tunnel_tso_set_result *res = parsed_result;struct rte_eth_dev_info dev_info; +uint64_t all_tunnel_tso =RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | +RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | +RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | +RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | +RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | +RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ;int ret;if (port_id_is_invalid (res->port_id,ENABLED_WARN ))@@ -5087,26 +5087,21 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,if (ret !=0 )return ;
Quoted 12 lines
app/test-pmd/cmdline.c cmd_tunnel_tso_set_parsed(void *parsed_result, · line 5098
Quoted 10 lines
app/test-pmd/cmdline.c +9
-1-check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); +if (ports[res->port_id].tunnel_tso_segsz !=0 ) { +if ((all_tunnel_tso & dev_info.tx_offload_capa) ==0 ) { +fprintf (stderr,"Error: port=%u don't support tunnel TSO offloads.\n" , + res->port_id); +return ; + } +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); + } +Instead of having a separate if block, else leg of below if block does same check [1], what do you think to move above block to there?
ok, will fixed in next version.
Quoted 28 lines
Quoted 9 lines
app/test-pmd/cmdline.c +0
-7if (ports[res->port_id].tunnel_tso_segsz ==0 ) { - ports[res->port_id].dev_conf.txmode.offloads &= - ~(RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO );app/test-pmd/cmdline.c cmd_tunnel_tso_set_parsed(void *parsed_result, · line 5107
Quoted 10 lines
app/test-pmd/cmdline.c +1
-7+ ports[res->port_id].dev_conf.txmode.offloads &= ~all_tunnel_tso;printf ("TSO for tunneled packets is disabled\n" ); }else { -uint64_t tso_offloads = (RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ); -[1] ---> here has same logical condition
app/test-pmd/cmdline.c cmd_tunnel_tso_set_parsed(void *parsed_result, · line 5107
Quoted 6 lines
app/test-pmd/cmdline.c +1
-1ports[res->port_id].dev_conf.txmode.offloads |= - (tso_offloads & dev_info.tx_offload_capa); + (all_tunnel_tso & dev_info.tx_offload_capa);printf ("TSO segment size for tunneled packets is %d\n" , ports[res->port_id].tunnel_tso_segsz);.
PATCH 3/3 app/testpmd: fix unnecessary change when set tunnel TSO
In reply to Huisong LiCurrently, there are two conditions to set tunnel TSO, like "parse tunnel" and "outer IP checksum". If these conditions are not satisfied, testpmd should not change their configuration, like tx_offloads on port and per queue, and no need to request "reconfig device".
--- app/test-pmd/cmdline.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)
app/test-pmd/cmdline.c +20 -16
@@ -5093,17 +5093,6 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, res->port_id);return ; } -check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); - } - -if (ports[res->port_id].tunnel_tso_segsz ==0 ) { - ports[res->port_id].dev_conf.txmode.offloads &= ~all_tunnel_tso; -printf ("TSO for tunneled packets is disabled\n" ); - }else { - ports[res->port_id].dev_conf.txmode.offloads |= - (all_tunnel_tso & dev_info.tx_offload_capa); -printf ("TSO segment size for tunneled packets is %d\n" , - ports[res->port_id].tunnel_tso_segsz);/* Below conditions are needed to make it work: * (1) tunnel TSO is supported by the NIC;
@@ -5116,14 +5105,29 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,* is not necessary for IPv6 tunneled pkts because there's no * checksum in IP header anymore. */ - -if (!ports[res->port_id].parse_tunnel) +if (!ports[res->port_id].parse_tunnel) {fprintf (stderr, -"Warning: csum parse_tunnel must be set so that tunneled packets are recognized\n" ); +"Error: csum parse_tunnel must be set so that tunneled packets are recognized\n" ); +return ; + }if (!(ports[res->port_id].dev_conf.txmode.offloads & -RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM )) +RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM )) {fprintf (stderr, -"Warning: csum set outer-ip must be set to hw if outer L3 is IPv4; not necessary for IPv6\n" ); +"Error: csum set outer-ip must be set to hw if outer L3 is IPv4; not necessary for IPv6\n" ); +return ; + } + +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); + } + +if (ports[res->port_id].tunnel_tso_segsz ==0 ) { + ports[res->port_id].dev_conf.txmode.offloads &= ~all_tunnel_tso; +printf ("TSO for tunneled packets is disabled\n" ); + }else { + ports[res->port_id].dev_conf.txmode.offloads |= + (all_tunnel_tso & dev_info.tx_offload_capa); +printf ("TSO segment size for tunneled packets is %d\n" , + ports[res->port_id].tunnel_tso_segsz); }cmd_config_queue_tx_offloads (&ports[res->port_id]);
Signature · 1 line
2.33.0
Re: [PATCH v1 3/3] app/testpmd: fix unnecessary change when set tunnel TSO
Quoted 58 lines · Huisong Li
Currently, there are two conditions to set tunnel TSO, like "parse tunnel" and "outer IP checksum". If these conditions are not satisfied, testpmd should not change their configuration, like
tx_offloadson port and per queue, and no need to request "reconfig device".Fixes 597f9fafe13b ("app/testpmd: convert to new Tx offloads API")Signed-off-by Huisong Li <[email protected]>--- app/test-pmd/cmdline.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)app/test-pmd/cmdline.c +11
-16@@ -5093,17 +5093,6 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, res->port_id);return ; } -check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); - } - -if (ports[res->port_id].tunnel_tso_segsz ==0 ) { - ports[res->port_id].dev_conf.txmode.offloads &= ~all_tunnel_tso; -printf ("TSO for tunneled packets is disabled\n" ); - }else { - ports[res->port_id].dev_conf.txmode.offloads |= - (all_tunnel_tso & dev_info.tx_offload_capa); -printf ("TSO segment size for tunneled packets is %d\n" , - ports[res->port_id].tunnel_tso_segsz);/* Below conditions are needed to make it work: * (1) tunnel TSO is supported by the NIC; @@ -5116,14 +5105,29 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,* is not necessary for IPv6 tunneled pkts because there's no * checksum in IP header anymore. */ - -if (!ports[res->port_id].parse_tunnel) +if (!ports[res->port_id].parse_tunnel) {fprintf (stderr, -"Warning: csum parse_tunnel must be set so that tunneled packets are recognized\n" ); +"Error: csum parse_tunnel must be set so that tunneled packets are recognized\n" ); +return ; + }if (!(ports[res->port_id].dev_conf.txmode.offloads & -RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM )) +RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM )) {fprintf (stderr, -"Warning: csum set outer-ip must be set to hw if outer L3 is IPv4; not necessary for IPv6\n" ); +"Error: csum set outer-ip must be set to hw if outer L3 is IPv4; not necessary for IPv6\n" ); +return ; + } + +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); + }
app/test-pmd/cmdline.c cmd_tunnel_tso_set_parsed(void *parsed_result, · line 5131
Quoted 10 lines
app/test-pmd/cmdline.c +9
-0+ +if (ports[res->port_id].tunnel_tso_segsz ==0 ) { + ports[res->port_id].dev_conf.txmode.offloads &= ~all_tunnel_tso; +printf ("TSO for tunneled packets is disabled\n" ); + }else { + ports[res->port_id].dev_conf.txmode.offloads |= + (all_tunnel_tso & dev_info.tx_offload_capa); +printf ("TSO segment size for tunneled packets is %d\n" , + ports[res->port_id].tunnel_tso_segsz);
Similar comment with previous patch, why having separate if block for same check, above block can be merged to it.
Re: [PATCH v1 3/3] app/testpmd: fix unnecessary change when set tunnel TSO
Quoted 63 lines · Ferruh Yigit
Quoted 62 lines · Huisong Li
Currently, there are two conditions to set tunnel TSO, like "parse tunnel" and "outer IP checksum". If these conditions are not satisfied, testpmd should not change their configuration, like
tx_offloadson port and per queue, and no need to request "reconfig device".Fixes 597f9fafe13b ("app/testpmd: convert to new Tx offloads API")Signed-off-by Huisong Li <[email protected]>--- app/test-pmd/cmdline.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)app/test-pmd/cmdline.c +15
-16@@ -5093,17 +5093,6 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, res->port_id);return ; } -check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); - } - -if (ports[res->port_id].tunnel_tso_segsz ==0 ) { - ports[res->port_id].dev_conf.txmode.offloads &= ~all_tunnel_tso; -printf ("TSO for tunneled packets is disabled\n" ); - }else { - ports[res->port_id].dev_conf.txmode.offloads |= - (all_tunnel_tso & dev_info.tx_offload_capa); -printf ("TSO segment size for tunneled packets is %d\n" , - ports[res->port_id].tunnel_tso_segsz);/* Below conditions are needed to make it work: * (1) tunnel TSO is supported by the NIC; @@ -5116,14 +5105,29 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,* is not necessary for IPv6 tunneled pkts because there's no * checksum in IP header anymore. */ - -if (!ports[res->port_id].parse_tunnel) +if (!ports[res->port_id].parse_tunnel) {fprintf (stderr, -"Warning: csum parse_tunnel must be set so that tunneled packets are recognized\n" ); +"Error: csum parse_tunnel must be set so that tunneled packets are recognized\n" ); +return ; + }if (!(ports[res->port_id].dev_conf.txmode.offloads & -RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM )) +RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM )) {fprintf (stderr, -"Warning: csum set outer-ip must be set to hw if outer L3 is IPv4; not necessary for IPv6\n" ); +"Error: csum set outer-ip must be set to hw if outer L3 is IPv4; not necessary for IPv6\n" ); +return ; + } + +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); + } + +if (ports[res->port_id].tunnel_tso_segsz ==0 ) { + ports[res->port_id].dev_conf.txmode.offloads &= ~all_tunnel_tso; +printf ("TSO for tunneled packets is disabled\n" );
Quoted 8 lines
app/test-pmd/cmdline.c cmd_tunnel_tso_set_parsed(void *parsed_result, · line 5132
Quoted 6 lines
app/test-pmd/cmdline.c +5
-0+ }else { + ports[res->port_id].dev_conf.txmode.offloads |= + (all_tunnel_tso & dev_info.tx_offload_capa); +printf ("TSO segment size for tunneled packets is %d\n" , + ports[res->port_id].tunnel_tso_segsz);Similar comment with previous patch, why having separate if block for same check, above block can be merged to it.
Ack
Quoted 2 lines
.
v2 cover app/testpmd: fix the command to set tunnel TSO
In reply to Huisong LiPlease see each patch in the series for detail.
---
-v2: fix the position of check code based on Ferruh's comments
Huisong Li (3):
app/testpmd: fix random value to set tunnel TSO app/testpmd: add the explicit check for tunnel TSO offload app/testpmd: fix unnecessary change when set tunnel TSO
app/test-pmd/cmdline.c | 93 ++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 49 deletions(-)
Signature · 1 line
2.33.0
PATCH v2 1/3 app/testpmd: fix random value to set tunnel TSO
Currently, testpmd set tunnel TSO offload even if fail to get dev_info. In this case, the 'tx_offload_capa' in dev_info is a random value,
--- app/test-pmd/cmdline.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
app/test-pmd/cmdline.c +14 -15
@@ -5035,39 +5035,33 @@ struct cmd_tunnel_tso_set_result {portid_t port_id; }; -static struct rte_eth_dev_info -check_tunnel_tso_nic_support (portid_t port_id) +static void +check_tunnel_tso_nic_support (portid_t port_id,uint64_t tx_offload_capa) { -struct rte_eth_dev_info dev_info; - -if (eth_dev_info_get_print_err (port_id, &dev_info) !=0 ) -return dev_info; - -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO ))fprintf (stderr,"Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO ))fprintf (stderr,"Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO ))fprintf (stderr,"Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO ))fprintf (stderr,"Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO ))fprintf (stderr,"Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -if (!(dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO )) +if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ))fprintf (stderr,"Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); -return dev_info; } static void
@@ -5077,6 +5071,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, {struct cmd_tunnel_tso_set_result *res = parsed_result;struct rte_eth_dev_info dev_info; +int ret;if (port_id_is_invalid (res->port_id,ENABLED_WARN ))return ;
@@ -5088,7 +5083,11 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,if (!strcmp (res->mode,"set" )) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - dev_info =check_tunnel_tso_nic_support (res->port_id); + ret =eth_dev_info_get_print_err (res->port_id, &dev_info); +if (ret !=0 ) +return ; + +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa);if (ports[res->port_id].tunnel_tso_segsz ==0 ) { ports[res->port_id].dev_conf.txmode.offloads &= ~(RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |
Signature · 1 line
2.33.0
PATCH v2 2/3 app/testpmd: add the explicit check for tunnel TSO offload
In reply to Huisong LiIf port don't support TSO of tunnel packets, tell user in advance and no need to change other configuration of this port in case of fault spread.
In addition, if some tunnel offloads don't support, which is not an error case, the log about this shouldn't be to stderr.
--- app/test-pmd/cmdline.c | 55 ++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 31 deletions(-)
app/test-pmd/cmdline.c +24 -31
@@ -5039,28 +5039,22 @@ static void check_tunnel_tso_nic_support(portid_t port_id, uint64_t tx_offload_capa) {if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO )) -fprintf (stderr, -"Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO )) -fprintf (stderr, -"Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO )) -fprintf (stderr, -"Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO )) -fprintf (stderr, -"Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_IP_TNL_TSO )) -fprintf (stderr, -"Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id);if (!(tx_offload_capa &RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO )) -fprintf (stderr, -"Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , +printf ("Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n" , port_id); }
@@ -5071,6 +5065,12 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, {struct cmd_tunnel_tso_set_result *res = parsed_result;struct rte_eth_dev_info dev_info; +uint64_t all_tunnel_tso =RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | +RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | +RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | +RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | +RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | +RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ;int ret;if (port_id_is_invalid (res->port_id,ENABLED_WARN ))
@@ -5083,30 +5083,23 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,if (!strcmp (res->mode,"set" )) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - ret =eth_dev_info_get_print_err (res->port_id, &dev_info); -if (ret !=0 ) -return ; - -check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa);if (ports[res->port_id].tunnel_tso_segsz ==0 ) { - ports[res->port_id].dev_conf.txmode.offloads &= - ~(RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ); + ports[res->port_id].dev_conf.txmode.offloads &= ~all_tunnel_tso;printf ("TSO for tunneled packets is disabled\n" ); }else { -uint64_t tso_offloads = (RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | -RTE_ETH_TX_OFFLOAD_IP_TNL_TSO | -RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO ); + ret =eth_dev_info_get_print_err (res->port_id, &dev_info); +if (ret !=0 ) +return ; + +if ((all_tunnel_tso & dev_info.tx_offload_capa) ==0 ) { +fprintf (stderr,"Error: port=%u don't support tunnel TSO offloads.\n" , + res->port_id); +return ; + } +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); ports[res->port_id].dev_conf.txmode.offloads |= - (tso_offloads & dev_info.tx_offload_capa); + (all_tunnel_tso & dev_info.tx_offload_capa);printf ("TSO segment size for tunneled packets is %d\n" , ports[res->port_id].tunnel_tso_segsz);
Signature · 1 line
2.33.0
PATCH v2 3/3 app/testpmd: fix unnecessary change when set tunnel TSO
In reply to Huisong LiCurrently, there are two conditions to set tunnel TSO, like "parse tunnel" and "outer IP checksum". If these conditions are not satisfied, testpmd should not change their configuration, like tx_offloads on port and per queue, and no need to request "reconfig device".
--- app/test-pmd/cmdline.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
app/test-pmd/cmdline.c +14 -11
@@ -5096,12 +5096,6 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, res->port_id);return ; } -check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); - - ports[res->port_id].dev_conf.txmode.offloads |= - (all_tunnel_tso & dev_info.tx_offload_capa); -printf ("TSO segment size for tunneled packets is %d\n" , - ports[res->port_id].tunnel_tso_segsz);/* Below conditions are needed to make it work: * (1) tunnel TSO is supported by the NIC;
@@ -5114,14 +5108,23 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,* is not necessary for IPv6 tunneled pkts because there's no * checksum in IP header anymore. */ - -if (!ports[res->port_id].parse_tunnel) +if (!ports[res->port_id].parse_tunnel) {fprintf (stderr, -"Warning: csum parse_tunnel must be set so that tunneled packets are recognized\n" ); +"Error: csum parse_tunnel must be set so that tunneled packets are recognized\n" ); +return ; + }if (!(ports[res->port_id].dev_conf.txmode.offloads & -RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM )) +RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM )) {fprintf (stderr, -"Warning: csum set outer-ip must be set to hw if outer L3 is IPv4; not necessary for IPv6\n" ); +"Error: csum set outer-ip must be set to hw if outer L3 is IPv4; not necessary for IPv6\n" ); +return ; + } + +check_tunnel_tso_nic_support (res->port_id, dev_info.tx_offload_capa); + ports[res->port_id].dev_conf.txmode.offloads |= + (all_tunnel_tso & dev_info.tx_offload_capa); +printf ("TSO segment size for tunneled packets is %d\n" , + ports[res->port_id].tunnel_tso_segsz); }cmd_config_queue_tx_offloads (&ports[res->port_id]);
Signature · 1 line
2.33.0
Quoted 10 lines · Huisong Li
Please see each patch in the series for detail.
---
-v2: fix the position of check code based on Ferruh's commentsHuisong Li (3):
app/testpmd: fix random value to set tunnel TSO app/testpmd: add the explicit check for tunnel TSO offload app/testpmd: fix unnecessary change when set tunnel TSO
For series,
Series applied to dpdk-next-net/main, thanks.