Skip to content

Commit

Permalink
app/testpmd: add explicit check for tunnel TSO
Browse files Browse the repository at this point in the history
[ upstream commit 33156a6bc61560e74a126ade38a7af9c1fa02671 ]

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.

Fixes: 3926dd2 ("app/testpmd: enforce offload capabilities check")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
  • Loading branch information
LiHuiSong1 authored and bluca committed Nov 15, 2023
1 parent a99c87f commit d6dd9c8
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions app/test-pmd/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -4942,23 +4942,23 @@ static void
check_tunnel_tso_nic_support(portid_t port_id, uint64_t tx_offload_capa)
{
if (!(tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO))
printf("Warning: VXLAN TUNNEL TSO not supported therefore "
"not enabled for port %d\n", port_id);
printf("Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
if (!(tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO))
printf("Warning: GRE TUNNEL TSO not supported therefore "
"not enabled for port %d\n", port_id);
printf("Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
if (!(tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO))
printf("Warning: IPIP TUNNEL TSO not supported therefore "
"not enabled for port %d\n", port_id);
printf("Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
if (!(tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO))
printf("Warning: GENEVE TUNNEL TSO not supported therefore "
"not enabled for port %d\n", port_id);
printf("Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
if (!(tx_offload_capa & DEV_TX_OFFLOAD_IP_TNL_TSO))
printf("Warning: IP TUNNEL TSO not supported therefore "
"not enabled for port %d\n", port_id);
printf("Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
if (!(tx_offload_capa & DEV_TX_OFFLOAD_UDP_TNL_TSO))
printf("Warning: UDP TUNNEL TSO not supported therefore "
"not enabled for port %d\n", port_id);
printf("Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n",
port_id);
}

static void
Expand All @@ -4968,6 +4968,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 = DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
DEV_TX_OFFLOAD_GRE_TNL_TSO |
DEV_TX_OFFLOAD_IPIP_TNL_TSO |
DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
DEV_TX_OFFLOAD_IP_TNL_TSO |
DEV_TX_OFFLOAD_UDP_TNL_TSO;
int ret;

if (port_id_is_invalid(res->port_id, ENABLED_WARN))
Expand All @@ -4980,30 +4986,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 &=
~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
DEV_TX_OFFLOAD_GRE_TNL_TSO |
DEV_TX_OFFLOAD_IPIP_TNL_TSO |
DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
DEV_TX_OFFLOAD_IP_TNL_TSO |
DEV_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 = (DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
DEV_TX_OFFLOAD_GRE_TNL_TSO |
DEV_TX_OFFLOAD_IPIP_TNL_TSO |
DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
DEV_TX_OFFLOAD_IP_TNL_TSO |
DEV_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);

Expand Down

0 comments on commit d6dd9c8

Please sign in to comment.