From patchwork Sat Nov 11 04:59:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 134110 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 56910432FA; Sat, 11 Nov 2023 05:59:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B0269402B1; Sat, 11 Nov 2023 05:59:36 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 4992F4027E for ; Sat, 11 Nov 2023 05:59:34 +0100 (CET) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SS3LT5S6szrTrn; Sat, 11 Nov 2023 12:56:17 +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; Sat, 11 Nov 2023 12:59:32 +0800 From: Huisong Li To: , , Aman Singh , Yuying Zhang , Shahaf Shuler , Wenzhuo Lu CC: , , Subject: [PATCH v2 3/3] app/testpmd: fix unnecessary change when set tunnel TSO Date: Sat, 11 Nov 2023 12:59:43 +0800 Message-ID: <20231111045944.46378-4-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231111045944.46378-1-lihuisong@huawei.com> References: <20231110081925.14142-1-lihuisong@huawei.com> <20231111045944.46378-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 | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 7a85cb0024..a37fbe07c2 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -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]);