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 E5952A054F; Wed, 17 Mar 2021 00:03:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8530940A4B; Wed, 17 Mar 2021 00:03:51 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2087.outbound.protection.outlook.com [40.107.223.87]) by mails.dpdk.org (Postfix) with ESMTP id 7071440040 for ; Wed, 17 Mar 2021 00:03:50 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PPX4FdU4pr1mzGzaXdFnweSum1E1Mpw+olqDOVdFxyM2hiPWz1pl6LlRF7d39Wtb4XLl9ihoCT7NfNDYnWBJY1U61Ll1RV20mhx3V9RFdxSRl+gj/VCjgo/b+q6q8qk/Djf9e34e1FjCQwYuXp4N7Rowmct097DmOA09mLWrUBGLMTWuRQGZn70CwuJd9aYOIQ4MSbMcegWbofdbL9ocjCEUmoZ/5FZgdjL8McMcu8ECGa4egIFXkCXIUktsBpqYzoYkjXG0aopGOSW4Vmiy4xlfDoyHKKXCU6UGO/4rOqSZkc58GiIDrnWlw5Emj8TbSMhyMiemd+Ij5jLn08D2xA== 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=l/8jGfXJapPGD8DgBAAlIrkC0EIcDCESHFxHn+ZiSg0=; b=H2Vpb/SA7c03tNezrWJ/gD+WHaF64qqyf8gYsIP1Br1youpatgqqsWb5H+u7lH8d8HOr1cA139FOLXmLHz6N5s6Fm/g63Ib/PFy537nV8koCzfG8ec7rsk8eF2xjIe8jbit2sGhQupREbJ9EjTHOWf4Pc/uGinDRYmrU5/LpWubx0BgtiEZ+cWRmbSu4oiPzrPGfvRroI2MWJakAXYliGE4MZf3B3V/mL1p3OogqyxqXllpMWk/nbGK2PWFS0xycWnkAiF1IaUy4AvTSUAjYvLjNtu0etQLy/+m5qSkA6vHSZbr1evo14emaiAp9Img8qdYzdKhKXRBBh9tOhZ/h2A== 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=l/8jGfXJapPGD8DgBAAlIrkC0EIcDCESHFxHn+ZiSg0=; b=N25qxbU6AkA4DTRknOyNFsKH/TFzN+3kFSip4S0Ggpqk1N2cdDM2LULmgJnRa8KnXu6SF8ccD4sghkYaLo218ZbwFJiEyAgskBSxmzY3FW1Vx8jTY8EBFjTGZ3HR/LhfwgV3PIJCKXsdGvn5/gsjLsKOJSF1NlhCr0/B08LKDcCocmXuh3RCjvH5fvrZYoMO+W7L0vAIbwi2AoPtu9g0Cb7A6utDhHf/HHDSWjyGD+I2LYpgQZvFDGmvxR/EN5S+1GbianCfkQmwxspmPmGJ5+tRh4EK8ncr/3CRqC/sg9SFxsKpR7FJHfy2NqtyPNHXzaWj3SyECv8at/UDd1T0rQ== Received: from DM6PR12MB4987.namprd12.prod.outlook.com (2603:10b6:5:163::31) by DM6PR12MB3962.namprd12.prod.outlook.com (2603:10b6:5:1ce::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31; Tue, 16 Mar 2021 23:03:48 +0000 Received: from DM6PR12MB4987.namprd12.prod.outlook.com ([fe80::f5ce:c5a8:6aec:e308]) by DM6PR12MB4987.namprd12.prod.outlook.com ([fe80::f5ce:c5a8:6aec:e308%7]) with mapi id 15.20.3933.032; Tue, 16 Mar 2021 23:03:48 +0000 From: Ori Kam To: Ivan Malov , "dev@dpdk.org" CC: Andrew Rybchenko , Andy Moreton , NBU-Contact-Thomas Monjalon , Ferruh Yigit Thread-Topic: [PATCH 01/10] ethdev: reuse header definition in flow pattern item ETH Thread-Index: AQHXFyKMRYYTOxOsDUCN5SqMnH1/XaqHQs7g Date: Tue, 16 Mar 2021 23:03:48 +0000 Message-ID: References: <20210312093143.28186-1-ivan.malov@oktetlabs.ru> In-Reply-To: <20210312093143.28186-1-ivan.malov@oktetlabs.ru> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: oktetlabs.ru; dkim=none (message not signed) header.d=none;oktetlabs.ru; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [147.236.145.126] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c3a0fa45-61a2-420a-b3a4-08d8e8cfc24d x-ms-traffictypediagnostic: DM6PR12MB3962: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-transport-forked: True x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: umP09A7lHKF6vNMJVzLrZRAsQHuqZf2Xq38zhn4Fb1YyxOcOLjPxdeZGGv9TynZn+uHp7cXNDKh+tWvo1DnizQKffd6/TblBXWuW769fall/lQ55N4ncMFWeMP20Z1tZPvwPu8qCHXRSH2kJuNrBhMRA95b3dJZ7b8S3HI+kXDPDFuP3I/04nfSMqSuPXz3+74c6Sn3Z5aDtK/zS9aL3g3GqW63oOupXKOt2kid3iRSjlsAxkw39SdmmybrW2FjxXlVlGv5Zios5YmcF7DitqVcbnTD9uomsL7bHXasYXGFwoGsHAzPdCe61BazrJJCo+br0xOPv44upVfmqvE77oueSKn0mlGYNTC3p3SVdISOLptv3DfILb2pXaw8V3aoI7Ig1DtEEla4ramrJ8cridg4UcBP5Y1FwJrC0op/hQoco1vxcFErD/PKMBshxz+2zZUWzkD6skFcReZl9PXN+lYYnLzyj2xpaDDH8GAplMMaA1+BRolK8ous8wT07cqOEx09uSrZk/y483gEelsFOXuiyE7OSayAp86ds9VmhgHVF4MnX2XLQwOuinP5LbO5Y x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB4987.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(376002)(39860400002)(366004)(396003)(76116006)(33656002)(8676002)(5660300002)(54906003)(110136005)(6506007)(9686003)(86362001)(66946007)(55016002)(66446008)(66476007)(64756008)(66556008)(7696005)(52536014)(71200400001)(8936002)(2906002)(4326008)(316002)(478600001)(26005)(186003)(83380400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?PhF5SRIkajNat7sWr/QEquEl3vX9n8UM5I67sbIVz4nRnCl2My2MoTaf+bTC?= =?us-ascii?Q?84df6GSZc8uMEnpVucGRpJRzoQej4ZfMdmOI/3oC6Ywj7KvNnVx3OS3zRJbF?= =?us-ascii?Q?YO5Vl5IWysuOpwu+LLuHZE9F8AKI8m5MrsqEkWKFq1BJA+hi+K8jLjlGhzo2?= =?us-ascii?Q?eccFJJ0RrQm1ACv1aW878E9UhdSdTBWdjY88S+K9HGP2fbyWORCuPTLb0R3P?= =?us-ascii?Q?2Xnc5oY0giVNH1nLdK9EIfsDC4F7b9jP3J47uNWRw4UWcsI6AQAzlhi/Lmai?= =?us-ascii?Q?blNB+N9p/88H/ekJkhWs3TLjdqwUB/gfvrFMeo16XA+HYE0w1krwT/TE5pBu?= =?us-ascii?Q?UxmLgXst1mFaC6g91rP9uPJLdF8ffWvoAKrO5euK/QUncwnsv4dUd3UWtl6F?= =?us-ascii?Q?v5M6cN9ofXhuqlzU8XCzPsqOAFiAqQhLIu0JGujLIBbauU9AS5+wZ3AER2i/?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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: DM6PR12MB4987.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3a0fa45-61a2-420a-b3a4-08d8e8cfc24d X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Mar 2021 23:03:48.8161 (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: As1mZwKFnooZmJvKk3UdTYUIkL5SH689WD422lw1+URlNNnYuMA7MBfYcn/fWxpoU9rLKbUzyzw6Ch6JTPxHHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3962 Subject: Re: [dpdk-dev] [PATCH 01/10] ethdev: reuse header definition in flow pattern item ETH 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" Hi Ivan, > -----Original Message----- > From: Ivan Malov > Sent: Friday, March 12, 2021 11:32 AM >=20 > One ought to reuse existing header structs in flow items. > This particular item contains non-header fields, so it's > important to keep the header fields in a separate struct. >=20 > Signed-off-by: Ivan Malov > Reviewed-by: Andrew Rybchenko > Reviewed-by: Andy Moreton > --- > lib/librte_ethdev/rte_flow.h | 44 ++++++++++++++++++++++-------------- > 1 file changed, 27 insertions(+), 17 deletions(-) >=20 > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > index 669e677e9..96fd93ee1 100644 > --- a/lib/librte_ethdev/rte_flow.h > +++ b/lib/librte_ethdev/rte_flow.h > @@ -728,22 +728,32 @@ static const struct rte_flow_item_raw > rte_flow_item_raw_mask =3D { > * > * Matches an Ethernet header. > * > - * The @p type field either stands for "EtherType" or "TPID" when follow= ed > - * by so-called layer 2.5 pattern items such as RTE_FLOW_ITEM_TYPE_VLAN. > In > - * the latter case, @p type refers to that of the outer header, with the > - * inner EtherType/TPID provided by the subsequent pattern item. This is= the > - * same order as on the wire. > - * If the @p type field contains a TPID value, then only tagged packets = with the > - * specified TPID will match the pattern. > - * The field @p has_vlan can be used to match any type of tagged packets= , > - * instead of using the @p type field. > - * If the @p type and @p has_vlan fields are not specified, then both ta= gged > - * and untagged packets will match the pattern. > + * Inside @p hdr field, the sub-field @p ether_type stands either for Et= herType > + * or TPID, depending on whether the item is followed by a VLAN item or = not. > If > + * two VLAN items follow, the sub-field refers to the outer one, which, = in turn, > + * contains the inner TPID in the similar header field. The innermost VL= AN > item > + * contains a layer-3 EtherType. All of that follows the order seen on t= he wire. > + * > + * If the field in question contains a TPID value, only tagged packets w= ith the > + * specified TPID will match the pattern. Alternatively, it's possible t= o match > + * any type of tagged packets by means of the field @p has_vlan rather t= han > use > + * the EtherType/TPID field. Also, it's possible to leave the two fields= unused. > + * If this is the case, both tagged and untagged packets will match the = pattern. > */ > +RTE_STD_C11 > struct rte_flow_item_eth { > - struct rte_ether_addr dst; /**< Destination MAC. */ > - struct rte_ether_addr src; /**< Source MAC. */ > - rte_be16_t type; /**< EtherType or TPID. */ > + union { > + struct { > + /* > + * These fields are retained for compatibility. > + * Please switch to the new header field below. > + */ > + struct rte_ether_addr dst; /**< Destination MAC. */ > + struct rte_ether_addr src; /**< Source MAC. */ > + rte_be16_t type; /**< EtherType or TPID. */ > + }; > + struct rte_ether_hdr hdr; > + }; > uint32_t has_vlan:1; /**< Packet header contains at least one VLAN. */ > uint32_t reserved:31; /**< Reserved, must be zero. */ > }; > @@ -751,9 +761,9 @@ struct rte_flow_item_eth { > /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */ > #ifndef __cplusplus > static const struct rte_flow_item_eth rte_flow_item_eth_mask =3D { > - .dst.addr_bytes =3D "\xff\xff\xff\xff\xff\xff", > - .src.addr_bytes =3D "\xff\xff\xff\xff\xff\xff", > - .type =3D RTE_BE16(0x0000), > + .hdr.d_addr.addr_bytes =3D "\xff\xff\xff\xff\xff\xff", > + .hdr.s_addr.addr_bytes =3D "\xff\xff\xff\xff\xff\xff", > + .hdr.ether_type =3D RTE_BE16(0x0000), > }; > #endif >=20 > -- > 2.20.1 Acked-by: Ori Kam Best, Ori