From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BFFD0432E6; Fri, 10 Nov 2023 12:42:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4FF1140E5E; Fri, 10 Nov 2023 12:42:19 +0100 (CET) Received: from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80]) by mails.dpdk.org (Postfix) with ESMTP id 8F25C40291 for ; Fri, 10 Nov 2023 12:42:18 +0100 (CET) Received: from debian (unknown [78.109.65.227]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by agw.arknetworks.am (Postfix) with ESMTPSA id A418EE0582; Fri, 10 Nov 2023 15:42:17 +0400 (+04) DKIM-Filter: OpenDKIM Filter v2.11.0 agw.arknetworks.am A418EE0582 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arknetworks.am; s=default; t=1699616538; bh=gqrtbC64Gn0VuhfUS+At70YR9h7grDe1y0BUWjldXPE=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=hZVxq610rvF3XYquEw9y6reE4DKioY5SHxhfm20hSlJjUn7cbEBwlzqSkR/4b8cuJ 2Ai50YI5PJhud6qdBFQ/vaEE3C0bRLREL2zbaoshM0HV5niV9eC45/uLauJTKUCpi5 bMl53VaAOGPffmIeUuki4wm4s7fKFg9hotqkt6mAFR7fEy7m9/w/T0uRmuXQ20N0if 2mUqzcJKM+/GfeA/Q6eVIxxmbbcjmsELSXi0f6upG0TXEKAja0VAc+kK7pw/7tTnAJ RyoNqoVin+beiOmZ08KNjeEnuOdKtVxMPlP245ibOkZoR6h3T+HFo/KyYauBGIDSO/ 8NXzNRrlBlEoA== Date: Fri, 10 Nov 2023 15:42:07 +0400 (+04) From: Ivan Malov To: Huisong Li cc: dev@dpdk.org, ferruh.yigit@amd.com, Aman Singh , Yuying Zhang , Andrew Rybchenko , Bernard Iremonger , Ivan Ilchenko , liuyonglong@huawei.com Subject: Re: [PATCH v1 1/3] app/testpmd: fix random value to set tunnel TSO In-Reply-To: <20231110081925.14142-2-lihuisong@huawei.com> Message-ID: <7046579c-a129-69c2-f72b-94ab2fa5d5fd@arknetworks.am> References: <20231110081925.14142-1-lihuisong@huawei.com> <20231110081925.14142-2-lihuisong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi, (minor question below) On Fri, 10 Nov 2023, Huisong Li wrote: > 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: 6f51deb903b2 ("app/testpmd: check status of getting ethdev info") > Cc: stable@dpdk.org > > Signed-off-by: Huisong Li > --- > app/test-pmd/cmdline.c | 29 ++++++++++++++--------------- > 1 file changed, 14 insertions(+), 15 deletions(-) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index 05078f8377..25462bdbfc 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -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? > - > - 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 | > -- > 2.33.0 > > Thank you.