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 CCBC1A0C41; Wed, 1 Dec 2021 12:49:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 57DE64067B; Wed, 1 Dec 2021 12:49:11 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2053.outbound.protection.outlook.com [40.107.94.53]) by mails.dpdk.org (Postfix) with ESMTP id 562CE40140 for ; Wed, 1 Dec 2021 12:49:10 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cGNy016B3L5w7EnxynjrcUXyXdKyxPgurUvnB6Q1pfQAmkzzbWUdG5nK4kf1rVxiVLmJYCwbCvg3QHK7ljCcmjLiBOv/vyc5mzjipkDeNnUfas9Ulq+66PLHj5kfN9eXU7Ddl7Q+m237zWGxaJ/7TgpyTX7POK93qxkW7ADdt8wwhHKBuz+7aW08M/FGUfY7EH7vb0dLOVv6ahPSojV9TBPri0IjEHF6VGorDSTJcn56bquBf+x+M5zQOPxNIepD5YZkE04YSeawHNV8iKoBzuKonHWi9Mb6vwlSfj4CYsL/T3nxQ1q5whqzPYGtz99iMustB61kDT597XJRFd5X3Q== 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=cM2H8C5YwRG+bkjmeMz0RNVdQ7/xipcD286C4T4P/04=; b=VsakEQCFpsN1Tibl3LruFv9EgbkmIw0mLvbkYBXFcNkqgau/6TO59JOGCYAaUjShmqmAwXs+eHY3k1n0iCce/Ns8PrpslDNSYtS4lflt4xSdxn52Dw/xdAlxo+OSOroh8+ZCjkEu2KWXsXOIn1tcasyp81RvvU4s5yXHZAQHefvWSL28+RHnK44Ij5BT5bpcTNARoFP1UQhvNFYoMBRRMsqaVk0/PajglIulrem0/DzZMUMrLYYBBL0pJL86KKo6Eq8potASV+sTl0AW1uNMo+5PEC2FczAp36IbaQG/2y+HBj87fy7WDTChw6UKtgHqpgFcNnrwa6238bXoC51x0Q== 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=cM2H8C5YwRG+bkjmeMz0RNVdQ7/xipcD286C4T4P/04=; b=uq01n5ADDLQqNrnMb29dZ6Se+VLiFclEKmWBmNRqTgVRmIwvKAHnxwoHTge7LIk8IgJlZYTXHqoyJNIb7LjCvXShgdQX1IKZg4bhtGAaPIa5HYSuhedslQz36YRnIKwHk9uRtDVpIH74ZD4yynmFUg+uUSS76XVeWQYnpfXxfWhWBz8lvCFmbQbe5rVMuyOYUZ400T/8UIkC8PUicnZxcFu4Zwmy35iQ8Q+/moUC1uPdMBJ5fViMV85TLHNOZiqSt/XZiq926f6TXtbcuOzfwM7Uwpj6zSlI0oIcDPgxv1/Vp6AJHItO9Rk+RslEO8MaUPlG50JFHVSSOUECoPktzw== Received: from BY5PR12MB4227.namprd12.prod.outlook.com (2603:10b6:a03:206::21) by BY5PR12MB3667.namprd12.prod.outlook.com (2603:10b6:a03:1a2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Wed, 1 Dec 2021 11:49:08 +0000 Received: from BY5PR12MB4227.namprd12.prod.outlook.com ([fe80::8492:99a3:f527:52a1]) by BY5PR12MB4227.namprd12.prod.outlook.com ([fe80::8492:99a3:f527:52a1%6]) with mapi id 15.20.4713.020; Wed, 1 Dec 2021 11:49:08 +0000 From: Dariusz Sosnowski To: Huichao Cai CC: "konstantin.ananyev@intel.com" , "dev@dpdk.org" Subject: Re: [PATCH] ip_frag: add IPv4 options fragment and unit test data Thread-Topic: [PATCH] ip_frag: add IPv4 options fragment and unit test data Thread-Index: AQHX4Q/tX/1d4vl1rEC9qYhMyKNYjKwdhflQ Date: Wed, 1 Dec 2021 11:49:08 +0000 Message-ID: References: <1637743626-70632-1-git-send-email-chcchc88@163.com> In-Reply-To: <1637743626-70632-1-git-send-email-chcchc88@163.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-office365-filtering-correlation-id: 2177a099-91ca-4ca8-cb6d-08d9b4c095a3 x-ms-traffictypediagnostic: BY5PR12MB3667: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:376; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GU9eF0p2VBGauvci384eby6CqLHVaGeNqFeRQibHRqW1xNKRfB9/3tUGQmW/Xn1+ZLIpNUUmKBI4RxjCTc7m154p2vXKq6PI7ZAy69VPk4fyh9gFSAblr7Dg3lyLno5mvHGbbnfq4/I89DaZ85D6PiDDn9AcXJRIaLlKnJT9aNPoj/6B9fOamUul7ddx/nJFl3qx3ceFzyiecARrvnXKMP1yp6GufRj8oJR2rlsFc9bJscOUofsAfEIdXdxIC7Oi287nsoXMHUKO3WLTcmY72han8vwhmdniRg8Mq9ITv9nRl8UPXrqHCHS1zSxgfCaxWcJcJ5Plou+sax5tulQZ0IWICGoSGgW0rgg/u3wp2K+BdSpQqwhfk8i5GyH7U6g3TjeNC5ynpaE0JwVpyiq0DtwkFjAens0mvykW8/NeZl7ihxp+/D5OKU8WoWlCdGfPko5ULkDyegK6NLqsaAY2yBZguqW20Q0XGHMPrT+wSFVrQ3ea6bSn4GDFJr04WD7O+XZU0GSst1Msjmk1foYCIpoOejiomE99hObfJgdcQ4O3ePzXh9FJsFIUtE10wSId130Fy0Qk9A013KnWqKWvumykPCYktOYiKCdkPSvJ3OdRjzNjrHqqwvHMJxIjwqVG/wySHdzpwoxaqRcyLxFTrdn5yk+uig4qC63wBBia5e/1jTnYJqUCMpsv/m99Ujpev475UcMkdY0R0RCbT/ccxg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4227.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(4326008)(33656002)(71200400001)(8676002)(9686003)(5660300002)(122000001)(186003)(86362001)(52536014)(6916009)(66556008)(2906002)(38070700005)(66476007)(76116006)(64756008)(66446008)(38100700002)(66946007)(508600001)(55016003)(8936002)(54906003)(55236004)(26005)(6506007)(7696005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?xHxXaPJh4P30HW+S2wUEhdMQSh4joprkItZw/4KNR5pO+2x9W1IwfhggiQB2?= =?us-ascii?Q?JxvjEu+qXKcjs5yY07SJB6XVJFNdzwKutVvZptyVfl6gDm9Cr+/ui/+8wRcC?= =?us-ascii?Q?6EF3cQA5HgT+yBaNANxsqT+53d5jHHlD5ZLKHA1ylELdlDeLYkzEK5GEPXQK?= =?us-ascii?Q?Y6Stq8E1n5JRLN3Tc9DzHiYjTkVB/jezvXn2uvgPeVnWQQSeQU2lPdFRpFtI?= =?us-ascii?Q?PQoU7FwkGDk1/LCPyyrPLfZBc7/diUi79XdxU+u6veXAjeMroep9dptPsYbX?= =?us-ascii?Q?Y3NEe3+qvFlgn0b6Ytw+0BJCJpuXYU7Ov9I2NrwmBEOIOtSnk/VWGVV/aM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lvaz1G8UoUYJXahAWLwslRe9J5RpN?= =?us-ascii?Q?BMDmFtHELi19sje/Jwg2F1ebQ+Fid4/l5vvlNeoZseTtlW6O2Uf6n6hD7BWz?= =?us-ascii?Q?h4338UcE1rJOCsiTjs3rOSU0ContH9Fd2I9yqPBeY8E7FSmHCued+JUjOb7B?= =?us-ascii?Q?O4CjQ3HjdDUTdO3//3WNjuxxtJM0udj7Vkwvu28VP39JmjeGlGkq0mMDXMe1?= =?us-ascii?Q?Eqanj5ZluuLe/SkQAfaUN6cwe87S966oCC5N6fTSpK/mztijGXqX2eZ87Tfj?= =?us-ascii?Q?7Zv3uFogN6wj4fVfLs5Yj4gxScHa58BUwuK9KwDZGmup+hsQ4xlvSO+p+v4n?= =?us-ascii?Q?lND563AxW2r8AweRlzHhpUla4/pgGsn4bUOLWJ2T8FaK2KT6pjI4RIMJ9liV?= =?us-ascii?Q?mgmSrD/yKUodHmHS8mvC/v0=3D?= 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: BY5PR12MB4227.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2177a099-91ca-4ca8-cb6d-08d9b4c095a3 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2021 11:49:08.5671 (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: r2vuvRuI/mpW3z/65Z4UfJaSfPQpRpsebtiUFDWdbPraU8Lui+dxXptdbW3Cq/R8RVxyYSmgsfoZu+aGaNLgcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3667 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 On Wed, 24 Nov 2021 16:47:06 +0800, Huichao Cai wrote: > +/* > + * Options "fragmenting", just fill options not > + * allowed in fragments with NOOPs. > + * Simple and stupid 8), but the most efficient way. > + */ > +static inline void ip_options_fragment(struct rte_ipv4_hdr *iph) > +{ > + unsigned char *optptr =3D (unsigned char *)iph + > + sizeof(struct rte_ipv4_hdr); > + int l =3D (iph->version_ihl & RTE_IPV4_HDR_IHL_MASK) * > + RTE_IPV4_IHL_MULTIPLIER - sizeof(struct rte_ipv4_hdr); > + int optlen; > + > + while (l > 0) { > + switch (*optptr) { > + case RTE_IPOPT_END: > + return; > + case RTE_IPOPT_NOOP: > + l--; > + optptr++; > + continue; > + } > + optlen =3D optptr[1]; > + if (optlen < 2 || optlen > l) > + return; > + if (!RTE_IPOPT_COPIED(*optptr)) > + memset(optptr, RTE_IPOPT_NOOP, optlen); > + l -=3D optlen; > + optptr +=3D optlen; > + } > +} > + I have a few concerns regarding this implementation: - Any IPv4 option longer than 2 bytes with copied flag unset, will not be s= ubstituted by NOOP option. In effect it will be copied to all fragments. - Substituting options with NOOP might cause rte_ipv4_fragment_packet to pr= oduce more fragments than necessary, since options with copied flag unset w= ill still occupy space in IPv4 header. It would require some benchmarking, but maybe a better solution would be to= prepare a separate IPv4 header for fragments without unnecessary options.= =20