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 A98EDA0547; Fri, 28 May 2021 12:21:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 242CA40143; Fri, 28 May 2021 12:21:05 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 3F94840040 for ; Fri, 28 May 2021 12:21:02 +0200 (CEST) IronPort-SDR: tyUfcjqwTdT2he8cZf1io1JaXvsF4clsINGiTDnUA83sVeGye+SojpikM4s/IH57S4g7a03OeQ H9sGWxIlVqMg== X-IronPort-AV: E=McAfee;i="6200,9189,9997"; a="202968284" X-IronPort-AV: E=Sophos;i="5.83,229,1616482800"; d="scan'208";a="202968284" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2021 03:21:01 -0700 IronPort-SDR: xjKHIvZHynRYBlfxFLtimoWpekcay85J7e95XhImeF2wubAKRIbvJYUK74mmOi2fmLF7VUhXT4 F6BU0zqSL5ng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,229,1616482800"; d="scan'208";a="477878208" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by orsmga001.jf.intel.com with ESMTP; 28 May 2021 03:21:00 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 28 May 2021 03:21:00 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 28 May 2021 03:21:00 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Fri, 28 May 2021 03:21:00 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.176) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Fri, 28 May 2021 03:20:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lu8gE4HlSt4BqRF/B0fDIVcFUlb8FTKU5KN/E0qZZYXlK/gwTv/QZxrFHmwpYb8mhF5NDZYFUpVZcKC0ui8v5Fo+UfGtOIML0UduAKZD8lmjqCEVxuECogF3B0YgTJY3CfHG7zLzWEKQ0ToQgli9BRIKbVLp2nvpxGEiwjEk65MX9z83+oWczmMLLeMy2nfUHYKm8eATSLnRpM2qROS1WZv4VpakHrMDnMJGoiSM5zloKfcbhpp+1jO4GJl7lfDXeERreYjII+AJwuF+6V2aTnrZ4xLIOSC9jZxH7li6RTBhKwCkyw189RSH7ZvGVecD4rO3wjmVWIW1bUP/8pcspQ== 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-SenderADCheck; bh=/lEwkK24z+k0hmfrA+GCSAXeTtXsTsJrBuIMEh9qCF8=; b=b2ui8Yw2HJJDFXvPkA7JPdlUIndwiiBz+ON3WebTAfxUfD1GvjhJQAeJHzs7tWhyDaJqkVsLDXdMlcdrGrP+8ejUmfUlZofNjwuqgHc1xaZc0nGQgvRjN/X6rZuRQioGLtAREQHQodlwZkU9vft84buw/vxvjP5de3FvZhkAoi97v7DKe4s4KJe6p1VUtwSnRZ4M29GyOi1ASPiZjTyEYWUwrVovU7bmp7vi/ZjToy5I5adEMAdKGlUv8L8adLa5rYeOA/yt/IqDUt3Rs8H3Pbl2q06GBsJzXfySC0yg7RpFZlM9J2nZdsNMv0wuHOdkJ927hob3xwMKqx+ikSuhRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/lEwkK24z+k0hmfrA+GCSAXeTtXsTsJrBuIMEh9qCF8=; b=SyEt7SSZe5u9pGEkEmjr54uq7e3eZ+G1HvDOKSpc4BKi9yfotQ2ScN5cHZck+nvBEgZqr9RdgCgdnYfLX2U2dBVFBIw8p8Up2wLJnrUFr2ouyjATvOX1lSlTkKdwq/bupqKlJV5zR0q3dIBUP/+jKCVcEThtX3DSmDwWquFUWIU= Received: from BY5PR11MB4482.namprd11.prod.outlook.com (2603:10b6:a03:1ca::33) by BYAPR11MB2551.namprd11.prod.outlook.com (2603:10b6:a02:c5::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.24; Fri, 28 May 2021 10:20:58 +0000 Received: from BY5PR11MB4482.namprd11.prod.outlook.com ([fe80::a900:7531:4afa:6c5a]) by BY5PR11MB4482.namprd11.prod.outlook.com ([fe80::a900:7531:4afa:6c5a%5]) with mapi id 15.20.4173.021; Fri, 28 May 2021 10:20:58 +0000 From: "Ananyev, Konstantin" To: =?iso-8859-1?Q?Morten_Br=F8rup?= , "Gregory Etelson" , "dev@dpdk.org" CC: "matan@nvidia.com" , "orika@nvidia.com" , "rasland@nvidia.com" , "Iremonger, Bernard" , Olivier Matz Thread-Topic: [dpdk-dev] [PATCH] net: introduce IPv4 ihl and version fields Thread-Index: AQHXUw1e6pIatJvRL0OXGQrSmeIttar3e60AgAEsi7A= Date: Fri, 28 May 2021 10:20:58 +0000 Message-ID: References: <20210527152858.13312-1-getelson@nvidia.com> <98CBD80474FA8B44BF855DF32C47DC35C617E2@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35C617E2@smartserver.smartshare.dk> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: smartsharesystems.com; dkim=none (message not signed) header.d=none; smartsharesystems.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [109.255.184.192] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a61737c8-b916-4368-8f46-08d921c24908 x-ms-traffictypediagnostic: BYAPR11MB2551: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2512; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: jZOVilkW0cvpibCUgkrZcxGfcZk0c2R1VynUKLOX5JTQ5nIPrQ9Jth8jL4I8FaE4Ul8DTWlFalIVTUbIOCEVBBt7GX7d7aFe5fXkoj7oEEnvthcczNINHXO6bzZbIwa5zdpKr70sb/7EFi9AzFqGNSUXWofLHOpJ+1/wao9+xXe1uKa0jWhEpkygZxLbrUGBIrBjk6QBDKvD4ONmLAyJNhl5Yw1F68/ViklONUcNUmyoBHOBcqK763xYrRIQ+S1GgqRaTGHwkQWdIrSGfoSZkfNAz70OpsAyb/uL2ipl/0/uPSoztbY+kVaopOEy+WbVWtaZ7L1hIN4VjjOiNlZfmBTszbD3/Stp7DdmDI/SOAM7I0Op8Q3624Y/1lP0PbWE5AHSpSPsG/0t1T/oVPfZ8v6jnqxHxOPibR0cGs4kBl9b7vpCiI82EF+KnW2YyBFxfu5gOVkz2bQBOITZzBUq5Y901DYhdu9cidHGiz9RVlBzXboIhhnIDYVu8PiwjMaA5oU3zoonShb6CSN/I/G4q6hDOXPKTqSsj6oj7gW0cV7vrKemJH++yWj0i7SI6M66fs3heZwf8KMk6U9rZF3CoXL4sPRFYk3tAIxsJjWRsQ0= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR11MB4482.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(366004)(376002)(136003)(396003)(346002)(66574015)(316002)(5660300002)(83380400001)(478600001)(186003)(6506007)(8676002)(8936002)(66946007)(71200400001)(4326008)(66556008)(54906003)(66476007)(110136005)(66446008)(64756008)(55236004)(26005)(76116006)(2906002)(9686003)(38100700002)(122000001)(86362001)(33656002)(55016002)(7696005)(52536014); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?itIHLQEP+774S05Ic/s7o6yITqcIb3oAmwsDLZ4xNiXaUdhJvBoLh7sjkt?= =?iso-8859-1?Q?RQXte4HwEjivDjmXElQsbNJOtsYwDWxMkmkTHxWikKbehftxt+th/xivKI?= =?iso-8859-1?Q?7caZ6W0mpawEdiDLsnUKSuFyKFBmnTKhSChJGYBdOoCnm2Dcr5ObR3iaYZ?= =?iso-8859-1?Q?/+NlhnNuTTglxgEyB0ff34nZeXLqqJKJyfQw7B4P6tMwJZdm12L5RjIVLG?= =?iso-8859-1?Q?o2E1nzzNWcPsHSXOZNMnZXmfprRE0gnDPxyM8z9gnZjZfSEMv78Qk98ICo?= =?iso-8859-1?Q?S1U4iVJjmGQsvWG5k+FUuUF5VNhB0RIJo7Nzri6q+pMR8qOMZvTsVjg0YD?= =?iso-8859-1?Q?jirPuihOmHYaDBtE7I+QRqWBr77oHIUKK3a2R/MKb2fTjIwCdwRUbLm16v?= =?iso-8859-1?Q?Vcnb0FFA5hbxNY9wf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lKWBy3aDhfoh/B?= =?iso-8859-1?Q?7vnKC+fC6V8/0dDWvqwrCShzQzuPhTYA7gCgt328FuFPpgxjtxC5nNlHK1?= =?iso-8859-1?Q?olc35/t77E?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB4482.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a61737c8-b916-4368-8f46-08d921c24908 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 May 2021 10:20:58.1186 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: avbkcLVvwVkgucVvQhBtITsquuonv+Oxf3wjulGbVok/rYGE04KDP+HPHCV9JRL/FvoCREyKbbXwYLc6YHCedtKzQu2gpNOLfyiAaJ5P3L4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2551 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] net: introduce IPv4 ihl and version fields 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 Sender: "dev" =20 > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Gregory Etelson > > Sent: Thursday, 27 May 2021 17.29 > and version fields > > > > RTE IPv4 header definition combines the `version' and `ihl' fields > > into a single structure member. > > This patch introduces dedicated structure members for both `version' > > and `ihl' IPv4 fields. Separated header fields definitions allow to > > create simplified code to match on the IHL value in a flow rule. > > The original `version_ihl' structure member is kept for backward > > compatibility. > > > > Signed-off-by: Gregory Etelson > > --- > > app/test/test_flow_classify.c | 8 ++++---- > > lib/net/rte_ip.h | 16 +++++++++++++++- > > 2 files changed, 19 insertions(+), 5 deletions(-) > > > > diff --git a/app/test/test_flow_classify.c > > b/app/test/test_flow_classify.c > > index 951606f248..4f64be5357 100644 > > --- a/app/test/test_flow_classify.c > > +++ b/app/test/test_flow_classify.c > > @@ -95,7 +95,7 @@ static struct rte_acl_field_def > > ipv4_defs[NUM_FIELDS_IPV4] =3D { > > * dst mask 255.255.255.00 / udp src is 32 dst is 33 / end" > > */ > > static struct rte_flow_item_ipv4 ipv4_udp_spec_1 =3D { > > - { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, > > + { { .version_ihl =3D 0}, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, > > RTE_IPV4(2, 2, 2, 3), RTE_IPV4(2, 2, 2, 7)} > > }; > > static const struct rte_flow_item_ipv4 ipv4_mask_24 =3D { > > @@ -131,7 +131,7 @@ static struct rte_flow_item end_item =3D { > > RTE_FLOW_ITEM_TYPE_END, > > * dst mask 255.255.255.00 / tcp src is 16 dst is 17 / end" > > */ > > static struct rte_flow_item_ipv4 ipv4_tcp_spec_1 =3D { > > - { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, > > + { { .version_ihl =3D 0}, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, > > RTE_IPV4(1, 2, 3, 4), RTE_IPV4(5, 6, 7, 8)} > > }; > > > > @@ -150,8 +150,8 @@ static struct rte_flow_item tcp_item_1 =3D { > > RTE_FLOW_ITEM_TYPE_TCP, > > * dst mask 255.255.255.00 / sctp src is 16 dst is 17/ end" > > */ > > static struct rte_flow_item_ipv4 ipv4_sctp_spec_1 =3D { > > - { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, RTE_IPV4(11, 12, 13, 14), > > - RTE_IPV4(15, 16, 17, 18)} > > + { { .version_ihl =3D 0}, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, > > + RTE_IPV4(11, 12, 13, 14), RTE_IPV4(15, 16, 17, 18)} > > }; > > > > static struct rte_flow_item_sctp sctp_spec_1 =3D { > > diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h > > index 4b728969c1..684bb028b2 100644 > > --- a/lib/net/rte_ip.h > > +++ b/lib/net/rte_ip.h > > @@ -38,7 +38,21 @@ extern "C" { > > * IPv4 Header > > */ > > struct rte_ipv4_hdr { > > - uint8_t version_ihl; /**< version and header length */ > > + __extension__ > > + union { > > + uint8_t version_ihl; /**< version and header length */ > > + struct { > > +#if RTE_BYTE_ORDER =3D=3D RTE_LITTLE_ENDIAN > > + uint8_t ihl:4; > > + uint8_t version:4; > > +#elif RTE_BYTE_ORDER =3D=3D RTE_BIG_ENDIAN > > + uint8_t version:4; > > + uint8_t ihl:4; > > +#else > > +#error "setup endian definition" > > +#endif > > + }; > > + }; > > uint8_t type_of_service; /**< type of service */ > > rte_be16_t total_length; /**< length of packet */ > > rte_be16_t packet_id; /**< packet ID */ > > -- > > 2.31.1 > > >=20 > This does not break the ABI, but it could be discussed if it breaks the A= PI due to the required structure initialization changes shown in > test_flow_classify.c. Yep, I guess it might be classified as API change. Another thing that concerns me - it is not the only place in IPv4 header wh= en we unite multiple bit-fields into one field: type_of_service, fragment_offset. If we start splitting ipv4 fields into actual bitfields, I suppose we'll en= d-up splitting these ones too. But I am not sure it will pay off - as compiler not always generates optima= l code for reading/updating bitfields. Did you consider just adding extra macros to simplify access to these field= s (like RTE_IPV4_HDR_(GET_SET)_*), instead? =20 > I think this patch is an improvement, and that such structure modificatio= ns should be generally accepted, so: >=20 > Acked-by: Morten Br=F8rup