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 66DB1428F8 for ; Sun, 9 Apr 2023 17:27:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60E4441149; Sun, 9 Apr 2023 17:27:23 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2047.outbound.protection.outlook.com [40.107.220.47]) by mails.dpdk.org (Postfix) with ESMTP id 050F24067E for ; Sun, 9 Apr 2023 17:27:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IYHioNnRUyQ4kEIhdUwnV+HH/URyVNL5ABMbov2Eih7LCXDsaSfHltXuvbJAZv/NNlfYgC+qDAAnkGd1TPeciyflsuEezo4AjJ1M7yIX8ogY0SLbEp8/b5FOJRMyO9SnalA45u0exDS3R0DjI+sZVw0TIJGSNBPstREvx/0boaXt/pVoitXKQ9n/64uWnmhiDHYW6Pc4TwB92VgMFlKJDpK3Wgy4GjCkGBaww3sxdJi8TG2+U8nvpFXzTF1Uf6JvSw55f1pZd4FwNl0nHWYg4+JulqJ1MaxqTgE+kkxR5i+fQGjmM4cCWOh1fzESmaWNIXAiOA+GIyHGbn+Dst1x0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6MwGPxYDMpd4s+9Wz9wf9hdKJrzbJYoW1QaSRkH9/M4=; b=IT8DxmIaPZ4kEj4UGjTKU52k14eWX0EOtGfPCYY/HuR4y5cI89oYbD8Veen+8IETQ/1LW4sV/GI043nepwN5VVpeGSXdLCvgHTgowACoKxMzgha6NOEhbwrOXIEGTR33wGAR2VaHYoKiKXAIY2/QglpieyeznQD2WMPPIbVe1XoTR1EshLmRCf5Y53q3j7UKK0nw3ap/OrzhaIhGP/EO8Ura6Cd2vFbIOulSeIzTyJyouEgi0/aZOW3l0d55t1WnYQfEE39o4YbDz9s/9T6WygBS896y833tnfHYuV/2dAKUfyuvsoIPcLwC0lYaWacSI/f0D/V/MEo4w1ikmGG4Bg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oktetlabs.ru smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6MwGPxYDMpd4s+9Wz9wf9hdKJrzbJYoW1QaSRkH9/M4=; b=ZboR1AUaa1nT+rdTTZGc/EULevT1dbbo7yAr7ugxfFN4GfM9xUFC1IYcqw8szdigIJH7pXjJX0ZuyN30i9a7xemxgmf7jkCNdzZeKr97FtagGpHjGz73lC/TJV+HyWNB1/zA+m6xXZ83Wc+Jb6dP3w0IBAhJYlIfr8bhygDM9gPMfIRk9WVytwhkh2eBwwSgoGCn/wEcdcNa0OKCT/jXJE8E8UNCNLjkpmvSjs2Ar92PHWjXxgI49K1Y5+IBlGFVBftLPYZZUClwUAHMFop1nv31ThAP1wVJ4DZ4HPP2+zy4Gbq0f7oVKAUoOKqFljQx8YPg12ACAW8UJCM6n3NVzA== Received: from BN8PR07CA0025.namprd07.prod.outlook.com (2603:10b6:408:ac::38) by CH2PR12MB4969.namprd12.prod.outlook.com (2603:10b6:610:68::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.36; Sun, 9 Apr 2023 15:27:18 +0000 Received: from BN8NAM11FT100.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ac:cafe::59) by BN8PR07CA0025.outlook.office365.com (2603:10b6:408:ac::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38 via Frontend Transport; Sun, 9 Apr 2023 15:27:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT100.mail.protection.outlook.com (10.13.177.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.20 via Frontend Transport; Sun, 9 Apr 2023 15:27:16 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sun, 9 Apr 2023 08:27:07 -0700 Received: from nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sun, 9 Apr 2023 08:27:05 -0700 From: Xueming Li To: Boleslav Stankevich CC: Andrew Rybchenko , Maxime Coquelin , dpdk stable Subject: patch 'net/virtio: deduce IP length for TSO checksum' has been queued to stable release 22.11.2 Date: Sun, 9 Apr 2023 23:23:26 +0800 Message-ID: <20230409152529.5308-19-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230409152529.5308-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230409152529.5308-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT100:EE_|CH2PR12MB4969:EE_ X-MS-Office365-Filtering-Correlation-Id: e9aae559-c8d5-40c8-aec5-08db390ee6ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2l1rIygTUy4im8w7uBmcJOvrVEsGWz/RyVshuHpwWK72QXKRuFn4dg4jyYLX/ZhWv9X5JMrTkTnVmRm7/SVx0ofFUmTYQMmiuAiCqGk+kbsUBrhmZYN/7tKlcxhaVc9IoGDRqnJo2pU3QTf4W6QGWekpFx4PND3SRLn2P2hWrbvWedioLpKLms0wAABY5DQMdVLvCsF9JucTdlDjCtZmGOdl9enhCtQouAuWlVBfSuiTTLBpmFby2HnTDiAhRwFZ+wXZx5wG/O+Mq+5GZ2f11no+h35iwG/oSK1KjIEyK8AZ7o+0CvLdsiVqWDyujQYfMtKaBl/68ezO0rMQ668WZgAUl9uXsUmuLO8bGzwseGf6eO9fCxrU1eqQM7P+mk6DJiCe5/nBVQtzb8Wt/8CfrUP8I/CWCmgcn6qIDqGwc0Smc8JXivpSWpSOwUHyNUY0ECqnJqXw3He5u+zmS5OELOVzyAJyQRJf9l8lAOOq/HIAiVbQP5rduO9cxgPFpT64WgGFbjLKBnxzjvy8k9H9mYSlSVIVrezNiAbLJ3C7h7323U9LNQ9uZuzmef2dMWS+Es1FEROccYYEOoeGJHKFyMifDMz0bWRsC0bhtifhYIrjwXYjZhDqspyVa/1hDRXPATIOUngbfmL1YhMjUz19rJLlD2mPM5Lu6vlSiaZnC5XiAPZW85WOHriVUFsbjzDktkxc01t/No2jhL3RaRoT99KnwzhGoQibrcxzIpkRh8nTebUSpv9Mf5zJQi0ixFbuNdxFFT8bZj/f8O+kC6wKX7VAKrVymnsDxqJgRihwbKcXmmzUFzi69dOSA7HJKbJdISmDjzBsQP/2rHuIenZ47g== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(396003)(39860400002)(376002)(451199021)(40470700004)(36840700001)(46966006)(478600001)(7696005)(54906003)(316002)(53546011)(1076003)(26005)(16526019)(6286002)(186003)(6666004)(966005)(2906002)(4326008)(70586007)(70206006)(5660300002)(8676002)(6916009)(41300700001)(8936002)(82310400005)(7636003)(356005)(82740400003)(55016003)(86362001)(40480700001)(36756003)(40460700003)(66574015)(47076005)(83380400001)(2616005)(426003)(336012)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2023 15:27:16.5343 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9aae559-c8d5-40c8-aec5-08db390ee6ce X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT100.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4969 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/11/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/33f3ef50211ece8b98055cf1ac61a3bcd21a26a5 Thanks. Xueming Li --- >From 33f3ef50211ece8b98055cf1ac61a3bcd21a26a5 Mon Sep 17 00:00:00 2001 From: Boleslav Stankevich Date: Fri, 3 Mar 2023 14:19:29 +0300 Subject: [PATCH] net/virtio: deduce IP length for TSO checksum Cc: Xueming Li [ upstream commit d069c80a5d8c0a05033932421851cdb7159de0df ] The length of TSO payload could not fit into 16 bits provided by the IPv4 total length and IPv6 payload length fields. Thus, deduce it from the length of the packet. Fixes: 696573046e9e ("net/virtio: support TSO") Signed-off-by: Boleslav Stankevich Reviewed-by: Andrew Rybchenko Reviewed-by: Maxime Coquelin --- .mailmap | 1 + drivers/net/virtio/virtio_rxtx.c | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.mailmap b/.mailmap index 42a169ca18..8b0904d938 100644 --- a/.mailmap +++ b/.mailmap @@ -167,6 +167,7 @@ Bin Huang Bin Zheng Björn Töpel Bo Chen +Boleslav Stankevich Boon Ang Boris Pismenny Brandon Lo diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index d9d40832e0..c3e686cf0c 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -404,29 +404,36 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len + m->l4_len)) { struct rte_ipv4_hdr *iph; - struct rte_ipv6_hdr *ip6h; struct rte_tcp_hdr *th; - uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; + uint16_t prev_cksum, new_cksum; + uint32_t ip_paylen; uint32_t tmp; iph = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); th = RTE_PTR_ADD(iph, m->l3_len); + + /* + * Calculate IPv4 header checksum with current total length value + * (whatever it is) to have correct checksum after update on edits + * done by TSO. + */ if ((iph->version_ihl >> 4) == 4) { iph->hdr_checksum = 0; iph->hdr_checksum = rte_ipv4_cksum(iph); - ip_len = iph->total_length; - ip_paylen = rte_cpu_to_be_16(rte_be_to_cpu_16(ip_len) - - m->l3_len); - } else { - ip6h = (struct rte_ipv6_hdr *)iph; - ip_paylen = ip6h->payload_len; } + /* + * Do not use IPv4 total length and IPv6 payload length fields to get + * TSO payload length since it could not fit into 16 bits. + */ + ip_paylen = rte_cpu_to_be_32(rte_pktmbuf_pkt_len(m) - m->l2_len - + m->l3_len); + /* calculate the new phdr checksum not including ip_paylen */ prev_cksum = th->cksum; tmp = prev_cksum; - tmp += ip_paylen; + tmp += (ip_paylen & 0xffff) + (ip_paylen >> 16); tmp = (tmp & 0xffff) + (tmp >> 16); new_cksum = tmp; -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-04-09 21:45:39.295518200 +0800 +++ 0018-net-virtio-deduce-IP-length-for-TSO-checksum.patch 2023-04-09 21:45:38.599042200 +0800 @@ -1 +1 @@ -From d069c80a5d8c0a05033932421851cdb7159de0df Mon Sep 17 00:00:00 2001 +From 33f3ef50211ece8b98055cf1ac61a3bcd21a26a5 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit d069c80a5d8c0a05033932421851cdb7159de0df ] @@ -11 +13,0 @@ -Cc: stable@dpdk.org @@ -22 +24 @@ -index a9f4f28fba..8e7d78f37e 100644 +index 42a169ca18..8b0904d938 100644 @@ -34 +36 @@ -index 2d0afd3302..e48ff3cca7 100644 +index d9d40832e0..c3e686cf0c 100644