Skip to content

Commit

Permalink
app/testpmd: fix tunnel TSO capability check
Browse files Browse the repository at this point in the history
[ upstream commit 6d4def820aa7d118f1ebdebf7af8ba6299ac20ee ]

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,

Fixes: 6f51deb ("app/testpmd: check status of getting ethdev info")

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 b7c87c9 commit a99c87f
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions app/test-pmd/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -4938,33 +4938,27 @@ 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 & DEV_TX_OFFLOAD_VXLAN_TNL_TSO))
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);
if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO))
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);
if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO))
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);
if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO))
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);
if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IP_TNL_TSO))
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);
if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TNL_TSO))
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);
return dev_info;
}

static void
Expand All @@ -4974,6 +4968,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;
Expand All @@ -4985,7 +4980,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 &=
~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
Expand Down

0 comments on commit a99c87f

Please sign in to comment.