From patchwork Fri Nov 10 08:19:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 134079 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A906B432F0; Fri, 10 Nov 2023 09:19:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73D4C402E7; Fri, 10 Nov 2023 09:19:15 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 446F44026D for ; Fri, 10 Nov 2023 09:19:13 +0100 (CET) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SRWqL6Y2yz1P7tC; Fri, 10 Nov 2023 16:15:58 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 16:19:11 +0800 From: Huisong Li To: , , Aman Singh , Yuying Zhang , Andrew Rybchenko , Bernard Iremonger , Ivan Ilchenko CC: , Subject: [PATCH v1 1/3] app/testpmd: fix random value to set tunnel TSO Date: Fri, 10 Nov 2023 16:19:23 +0800 Message-ID: <20231110081925.14142-2-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231110081925.14142-1-lihuisong@huawei.com> References: <20231110081925.14142-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected 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 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; - - 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 | From patchwork Fri Nov 10 08:19:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 134080 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D675A432F0; Fri, 10 Nov 2023 09:19:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A49D042D97; Fri, 10 Nov 2023 09:19:17 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id F2B76402EA for ; Fri, 10 Nov 2023 09:19:13 +0100 (CET) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRWtn15J1zWgn9; Fri, 10 Nov 2023 16:18:57 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 16:19:12 +0800 From: Huisong Li To: , , Aman Singh , Yuying Zhang , Wenzhuo Lu , Shahaf Shuler CC: , , Subject: [PATCH v1 2/3] app/testpmd: add the explicit check for tunnel TSO offload Date: Fri, 10 Nov 2023 16:19:24 +0800 Message-ID: <20231110081925.14142-3-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231110081925.14142-1-lihuisong@huawei.com> References: <20231110081925.14142-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected 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 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: 3926dd2b6668 ("app/testpmd: enforce offload capabilities check") Cc: stable@dpdk.org Signed-off-by: Huisong Li --- app/test-pmd/cmdline.c | 51 +++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 25462bdbfc..d3243d016b 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -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); From patchwork Fri Nov 10 08:19:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 134081 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E9832432F0; Fri, 10 Nov 2023 09:19:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1987642DD3; Fri, 10 Nov 2023 09:19:19 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 4D3564026D for ; Fri, 10 Nov 2023 09:19:14 +0100 (CET) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SRWtn5MzKzWh1L; Fri, 10 Nov 2023 16:18:57 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 10 Nov 2023 16:19:12 +0800 From: Huisong Li To: , , Aman Singh , Yuying Zhang , Shahaf Shuler , Wenzhuo Lu CC: , , Subject: [PATCH v1 3/3] app/testpmd: fix unnecessary change when set tunnel TSO Date: Fri, 10 Nov 2023 16:19:25 +0800 Message-ID: <20231110081925.14142-4-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231110081925.14142-1-lihuisong@huawei.com> References: <20231110081925.14142-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected 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 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_offloads on port and per queue, and no need to request "reconfig device". Fixes: 597f9fafe13b ("app/testpmd: convert to new Tx offloads API") Cc: stable@dpdk.org Signed-off-by: Huisong Li --- app/test-pmd/cmdline.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d3243d016b..33e66d1d93 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -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]);