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 0590C43319; Mon, 13 Nov 2023 09:01:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDE38402B2; Mon, 13 Nov 2023 09:01:20 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2060.outbound.protection.outlook.com [40.107.244.60]) by mails.dpdk.org (Postfix) with ESMTP id 05EEB40279; Mon, 13 Nov 2023 09:01:19 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kEG+TMnKpn5HZfa5H7JE0BNKZ5PL1DxChE5EwVbpZsA27CXxamt2sQwz3+wKB4POM4/TD70Xrl6eFR4Z0Vk6oDiZLtT8AUlfREari16gNv3wMrQHbk3LDY7Gc/+rJsLOWCHLjNyykog4KdZyqx9CyogjK17xN/YHltMkPKOofEW723suulsXG7A+Jbyvoy2rbVm2keBw6Kkt7q92RA4zBin4xljZKyCUl/ZBAYpgOVleckpJBqDzehayMhejXeYUOm54DzHXgi1EfamtDEjofXgQJ/iHW32uJob1ZFhmB55mnsw1uAYGO7UEdZVAuvD4nzSaGwtcTa6dXLScwZq2tw== 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=UWfUMT+7sj2hTdPJjiSxKpzS/hdEoUsgJC+Gv4RPLvo=; b=NEVhK+b/L9bfGkNnMYOvVh2+0yIpeYXuMvyua6WnYabKhuoR7/nprXanJwfGKEbXp5tRnr4qtA50AmAimjT8afWi6sqLit70e5IWrgb1B56+C8c+bdzEsD/KJzrtsr9e4r0WkH2nPdxZ3kFiWhVoyjx/LwtXMbTx7+s5HIv+iJZ8qRSqO1jPVH9bVX8of9jGKeOnNTUrqEuMkSKDqTM4CFuxBMU+8WjpNCDWIa8x+ly1Xh+JptZma5LWJzGoYO1ERSw0tlBwj3zqlQfXRB5mrYwZpoya2zOEhzMUMl/lSsLcU54Y3YX1eax4YwIQ4DGCOx/G/H272j4ppD5PF0ZWPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=UWfUMT+7sj2hTdPJjiSxKpzS/hdEoUsgJC+Gv4RPLvo=; b=uiU7dJOXlo7b9ktYPWP+U5j1M29bP4G7ha8zE8eHN/2ZW3wSWYZP0I+hcTRayHJ0BP+wdcew7cVn2kMNbRlEVnteDDk+vGwp+FSHibaPcM2WCtNyrE++Bu6PFRZ3TlQL6kdPwWIkzBRuXiFtZmj4sXrDAevr96CPqlJjWjeILszjjhCBfNxpe6rCHNZnG+swaWMXGWpViMqKupaCRM8KbX3oYjTqN59ZlchfmLMeRTsvGvavKtHxjmk+n2XUccPFRyAGzvVNPQ+LlPT8o7uYSc2yWgNINTiOw9ZOTbCmiOVx4fMvmuGySBn8zwOyp70pTwaOXae8hO2ymTSim0nbNA== Received: from CO6PR12MB5396.namprd12.prod.outlook.com (2603:10b6:303:139::8) by SJ2PR12MB7797.namprd12.prod.outlook.com (2603:10b6:a03:4c5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Mon, 13 Nov 2023 08:01:16 +0000 Received: from CO6PR12MB5396.namprd12.prod.outlook.com ([fe80::62e9:ab3c:240b:ea17]) by CO6PR12MB5396.namprd12.prod.outlook.com ([fe80::62e9:ab3c:240b:ea17%4]) with mapi id 15.20.6977.029; Mon, 13 Nov 2023 08:01:16 +0000 From: Suanming Mou To: Bing Zhao , Matan Azrad , Slava Ovsiienko , Raslan Darawsheh , Ori Kam CC: "dev@dpdk.org" , Eli Britstein , "stable@dpdk.org" Subject: RE: [PATCH] net/mlx5: zero encap UDP csum for IPv4 too Thread-Topic: [PATCH] net/mlx5: zero encap UDP csum for IPv4 too Thread-Index: AQHaFgM+opBoR2OIakuOalgIbVP0OLB34JLQ Date: Mon, 13 Nov 2023 08:01:16 +0000 Message-ID: References: <20231113072941.6914-1-bingz@nvidia.com> In-Reply-To: <20231113072941.6914-1-bingz@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO6PR12MB5396:EE_|SJ2PR12MB7797:EE_ x-ms-office365-filtering-correlation-id: 8365930c-8a83-4fe4-ffcc-08dbe41eb64a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Higj6CNnHYCim8QC6cDUFc4pVVB2tJqwi2HHC7JOCZfWVuWag8Htnhrjdt2OLNSamCmLChTEuiysrAsHLLtuFjWWgTo8RMwy8Lta3PyysEb2x1FnME9fO9Zb1f/+nsJx05988XznviT3ojNYVMi45D5k09nyWfinI1aUhwmGDJ5DY+I5ybSag09IO35D22LiMVVhzgghjs6OjNl8I+2KHUpU5/MidLgjMtU7436XPLSzaaCIg4ZgfHQIFWYr9NQQ7roPEgHPPkHhQ3UZrvZQHMo4GybZsuaeJYXkXMHhdjFEoTY78CSWgSmpIMYqE8HzZMgoK6GkrsrdVPecIg3PlpyU9Yv6AxtkP40yn9TjOxC92NQ2mYpLzmxviswXplOxH/Ja013SnjeiaMeM6rnxtNscbhqjikrFLrtUkqXxp11kaSW7DOXrLU3WyN+3/e5t/c3nC3FBm4KSg512alYss7H1iPaTSHGsrhG7YVadYgMcRXpRhWSsy4dUCpD4DlnIqy9V9N4J17jXIDBjU2v7Nq1kpIKT08eiz43NisdhvI0/jVNP6TNDp9auO6RCS6fivbrrxbDCKumrmq6SFOXleCMrf7/HaI9V9iNz70mRqedTOer/OBEn0MKmX8pDfWrQ x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR12MB5396.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(136003)(396003)(346002)(366004)(39860400002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(52536014)(122000001)(9686003)(41300700001)(26005)(6506007)(7696005)(8676002)(8936002)(2906002)(4326008)(83380400001)(76116006)(6636002)(71200400001)(66556008)(54906003)(110136005)(478600001)(64756008)(316002)(66476007)(66446008)(66946007)(38070700009)(38100700002)(5660300002)(33656002)(86362001)(53546011)(450100002)(55016003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?DL9qx/SIZG9DFVJeTbLVvsfg/lF2QRYBAg+/D2aQrUF1ifGmM1kMxlKbVVls?= =?us-ascii?Q?J5aRmp3nfbuaHpOS3/4SXfxGCvUqNoMFImgnVwxVLKsLO22PyZc3FpgYrIRy?= =?us-ascii?Q?3RQXQXdaHZS2WMhOIOl2KBvs7AvQkhyQ8KTRHtZmapgaSY/rV5XTgikobrrt?= =?us-ascii?Q?gzDYpUpD7T9GYqAFRLgo2APwJ6dOufJ2l8atLShxwm+xoCsgZY58srCVo6SB?= =?us-ascii?Q?6usgfvZ4RPO6rtWjA5QjWcj8CfNGQiJqML/alE9EMH3pNSnObt0v5OHf+iHT?= =?us-ascii?Q?YQsfRH4sPLuNHKPgEawoYgFS/1+BCQlOgrSj0PP+ryGL6k+OkS2NDtx6p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ooqlMPUDLCRv6NHKglBBHlzzF?= =?us-ascii?Q?vyQgJoy0QGVSn3kn5EarXImFiOTpCa1fS279dYSMT2Uws8wcyT/rl+HfTLxE?= =?us-ascii?Q?QCeYegZPlaEuAXgXRKM3bGJ5U2D/y3f4oS2s9rTo1joLbenYmArDb1qQTjoy?= =?us-ascii?Q?iBuod3ed+Nq/Gu/hPzlsR6ZflMiYfUtgIGFBpUIq+e+z9cHGt4NuypmW5h/S?= =?us-ascii?Q?k7SVhmqZh1wL04rq91doUR3aQcDFPOGy/ePBk4c4qBmH3q9RM0lca8TZNEw2?= =?us-ascii?Q?YNdh/c/+83hnQZ7dXqskzpneZTD0oPa89dmGEduAfwCQScypQntx9nBNc16Q?= =?us-ascii?Q?xDU65UxESc+8mYDTZxKWrh1JbLn4RPrZEXH4v039?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR12MB5396.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8365930c-8a83-4fe4-ffcc-08dbe41eb64a X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Nov 2023 08:01:16.1321 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 9Pm51IxKnE/BKgdjYBjl0A6brHJT5mcgBOsqBp/72p+UTcuPGF64t7zKis+6il3gGsASQxro2wr0/WHa/fDEtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7797 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, > -----Original Message----- > From: Bing Zhao > Sent: Monday, November 13, 2023 3:30 PM > To: Matan Azrad ; Slava Ovsiienko > ; Raslan Darawsheh ; Suanming > Mou ; Ori Kam > Cc: dev@dpdk.org; Eli Britstein ; stable@dpdk.org > Subject: [PATCH] net/mlx5: zero encap UDP csum for IPv4 too >=20 > From: Eli Britstein >=20 > A zero UDP csum indicates it should not be validated by the receiver. > The HW may not calculate UDP csum after encap. >=20 > The cited commit made sure the UDP csum is zero for UDP over IPv6, mistak= enly > not handling UDP over IPv4. Fix it. >=20 > Fixes: bf1d7d9a033a ("net/mlx5: zero out UDP checksum in encapsulation") > Cc: stable@dpdk.org >=20 > Signed-off-by: Eli Britstein Acked-by: Suanming Mou > --- > drivers/net/mlx5/mlx5_flow_dv.c | 26 +++++++++++++++----------- > 1 file changed, 15 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow= _dv.c > index 9753af2cb1..115d730317 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -4713,6 +4713,7 @@ flow_dv_zero_encap_udp_csum(void *data, struct > rte_flow_error *error) { > struct rte_ether_hdr *eth =3D NULL; > struct rte_vlan_hdr *vlan =3D NULL; > + struct rte_ipv4_hdr *ipv4 =3D NULL; > struct rte_ipv6_hdr *ipv6 =3D NULL; > struct rte_udp_hdr *udp =3D NULL; > char *next_hdr; > @@ -4729,24 +4730,27 @@ flow_dv_zero_encap_udp_csum(void *data, struct > rte_flow_error *error) > next_hdr +=3D sizeof(struct rte_vlan_hdr); > } >=20 > - /* HW calculates IPv4 csum. no need to proceed */ > - if (proto =3D=3D RTE_ETHER_TYPE_IPV4) > - return 0; > - > /* non IPv4/IPv6 header. not supported */ > - if (proto !=3D RTE_ETHER_TYPE_IPV6) { > + if (proto !=3D RTE_ETHER_TYPE_IPV4 && proto !=3D RTE_ETHER_TYPE_IPV6) > { > return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, "Cannot offload non > IPv4/IPv6"); > } >=20 > - ipv6 =3D (struct rte_ipv6_hdr *)next_hdr; > - > - /* ignore non UDP */ > - if (ipv6->proto !=3D IPPROTO_UDP) > - return 0; > + if (proto =3D=3D RTE_ETHER_TYPE_IPV4) { > + ipv4 =3D (struct rte_ipv4_hdr *)next_hdr; > + /* ignore non UDP */ > + if (ipv4->next_proto_id !=3D IPPROTO_UDP) > + return 0; > + udp =3D (struct rte_udp_hdr *)(ipv4 + 1); > + } else { > + ipv6 =3D (struct rte_ipv6_hdr *)next_hdr; > + /* ignore non UDP */ > + if (ipv6->proto !=3D IPPROTO_UDP) > + return 0; > + udp =3D (struct rte_udp_hdr *)(ipv6 + 1); > + } >=20 > - udp =3D (struct rte_udp_hdr *)(ipv6 + 1); > udp->dgram_cksum =3D 0; >=20 > return 0; > -- > 2.34.1