From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6616CA0524; Thu, 7 Jan 2021 17:58:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D4750140FEB; Thu, 7 Jan 2021 17:57:54 +0100 (CET) Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by mails.dpdk.org (Postfix) with ESMTP id 18693140FEB for ; Thu, 7 Jan 2021 17:57:52 +0100 (CET) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 07 Jan 2021 08:57:52 -0800 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 7 Jan 2021 16:57:40 +0000 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.50) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 7 Jan 2021 16:57:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KpmwtgKHvC726/ZCASic+yyKtZyvnrH/upKT0hNKvaNHLuQBx5dRj9gSNDcSGPXMZzQdfgX6KTBxfRrXGEC6bP5lspWdwybV3o85GQegU4yd4ligeHwYFnnSM62BsYcSbwRlXxVcG5cdBkNmeIoIj1rUyY4sbs6+TZMcHS3ko4WuKQUUklOWQbZFKzVn7lbi7ZgVUlvtV7HcV5YYUgOTRflTZZafr/YSPViYqc61Z2Z+0pQfVgydE8FMcoA5v74bRI3XnJMG1a4qWL7yYV8l62rRjLHCAqpec8bZVjmeMVwGSu5P6D0kn8+o15IG8YwIzdws0GtjTK7huwn4Tl2Vvw== 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=HACPoTXmygXBIhnmgJlqBrCrxjfMgKeLxC7OBfYYzEY=; b=iEWQGkrQcR3IcaNgQvCvBRzMspP5/hEQG6KUq4Vn6d+94zJbc76LLGxx0ubhM+WIMxV1hbj7zju1g7wNZ4xx2dvj9RB7zkUk/+5MBvmvtM8FCo4tJggiuWQ92RL+OpvfU3ZDbVB+6NXylFQkKI9LBCRimzzDoSRnbApZTOHvsQ2JQlJHAAzr0kw3iBO7ogVyNt4g7YYHuS1koFxjvq5wnxD0nYAJpJJkkiaIWaiHgyWUWrIVvHfBw+GJM76L3ljZ5tPECT3SjlZQavJ/0x6odHae779eAU4s5XkAdICRmBisM3zoC8OCfnkCUTblP1eBexpi5GISqkns4U8q6vAjTQ== 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 Received: from BN7PR12MB2707.namprd12.prod.outlook.com (2603:10b6:408:2f::29) by BN6PR1201MB0114.namprd12.prod.outlook.com (2603:10b6:405:4d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Thu, 7 Jan 2021 16:57:39 +0000 Received: from BN7PR12MB2707.namprd12.prod.outlook.com ([fe80::c44c:1e37:b3f4:e968]) by BN7PR12MB2707.namprd12.prod.outlook.com ([fe80::c44c:1e37:b3f4:e968%6]) with mapi id 15.20.3742.006; Thu, 7 Jan 2021 16:57:38 +0000 From: Alexander Kozyrev To: NBU-Contact-Thomas Monjalon CC: "dev@dpdk.org" , Slava Ovsiienko , Ori Kam , "ferruh.yigit@intel.com" , "andrew.rybchenko@oktetlabs.ru" , "ajit.khaparde@broadcom.com" , "jerinj@marvell.com" Thread-Topic: [dpdk-dev] [RFC] ethdev: introduce copy_field rte flow action Thread-Index: AQHW1N2TdPEI29qYiUa+u6muk6TpcaoZtyQAgAKb6PCAABCegIAAAFHggAAC0gCAAABOMIAAGpGAgAAATqA= Date: Thu, 7 Jan 2021 16:57:38 +0000 Message-ID: References: <20201218013129.25186-1-akozyrev@nvidia.com> <4077045.mHWWFMTU2l@thomas> <2354870.U5oG32Jqq5@thomas> In-Reply-To: <2354870.U5oG32Jqq5@thomas> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [2607:fea8:e380:d8e0:f5a5:eebe:38ad:c361] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8fffe909-408d-4aee-154c-08d8b32d5722 x-ms-traffictypediagnostic: BN6PR1201MB0114: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Zq5t5hiA/9Suz5PhfasiaIY6YdElr0OQ8THQ6Bb4XfXy502PGEySetZzXFQLRTJ6KrKIXMJ+TWR6NLJJ0TlX02EYC07ZqMMoR/tG1YZrB90mM/nqHh02IRHGM6Ed8AsOX2J8cy+YitUJIWRo/jABkyIKkd6L8SPOPT4JxrkwtwA8CXDwD7siSC3FWfw7GHKOF6K333b5lpxmHN5/JKlJI+TlS3Dp6VHMkIqJzIbq9egu8HsNd/4tuDjAqcZi0FxYDAO0lZSisMb8r2gpi4fnlC8t3X3AT0vuaE1cdJKme64I63Wn/m5Sv5O+DuMipxhvOzrF8dStcWOAutaR5mFDQ2GhH1lHdBQsNkWIeUIcxT75gekGaz5G+asmoaQsbg/NmdLp5x/h6HYUJ94ooNqaGg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN7PR12MB2707.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(136003)(366004)(396003)(346002)(76116006)(66446008)(66946007)(54906003)(66556008)(64756008)(66476007)(83380400001)(478600001)(71200400001)(316002)(186003)(86362001)(33656002)(2906002)(6506007)(8936002)(6916009)(55016002)(7696005)(5660300002)(4326008)(52536014)(9686003)(8676002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?QEzzkgKE/4WxvqX1QOVEztTGveEOUGYX3PZGvWY4NjFrkqNlEAy6Ma/WLQ3/?= =?us-ascii?Q?VIvrZREBIpYws0+d6mXNgusbnnAu+6o+1z/Qk65MW5fY6vya/fyfdbu/MCDR?= =?us-ascii?Q?oTbqbhKdk5jF+J5cJsKdxVpOSMwCp2lCs98YrV8uWsagQX4J9oK+/cfh4lPz?= =?us-ascii?Q?zklNf59A63Z+5Kq4Ji+8mTx/kyQGQEjkXaP00H4giQxIUGIACACS+84NlWex?= =?us-ascii?Q?TH7uuiyWHMBeevfrN22taA//wFOH4lL8pptT7buJUDjgeVkIW3HMy6HahyW4?= =?us-ascii?Q?+eBEazwq3KPCmyyrbI23fPWYTZVX9fFN7+BHApUKqjs+U6skx3LlfEXsnpi8?= =?us-ascii?Q?hpY1ksxj08NN8+xMCO7pYONxQeZtURlYuv8mnuWcl2nf5BzU0nOBk4OnnCKz?= =?us-ascii?Q?qfPsgc1A6xGYLxiilbqoCyeUlDzy6Mwx746rQQDFN1YY2JTYOZEKGhQYwS5e?= =?us-ascii?Q?hJ4E3leT9pvbpi/kUzvZS5NWlW8gfskdTuKO/i60/niVUjbgbNUwauYxJD3v?= =?us-ascii?Q?qOpj3AEWR9CqEVIlpq1hNGybTeLqq/nUtfdJIix9Xoun489FKD/q5bGFzOcC?= =?us-ascii?Q?sdwvQjqjGIiKpwfHoNZQjdJ16Zw+adRugeibhvPRwvNZlNcsQOL4k9ALISx0?= =?us-ascii?Q?KHiATiNy6M5qxpoDBMrrW/xB69aF99dmNJuZsug0d2ECWnZuh3XNNZmumBpI?= =?us-ascii?Q?saQgMX7raYQAnSjisBe/+wKnK4c5JV8yUSaLScYlry1MFt3mZiVb45H1Zk0c?= =?us-ascii?Q?cBtygdylUXo5qJFLjAOP9bKklKDw/gxNra6hSQxzbUss2F5HYhA7z5chQUTB?= =?us-ascii?Q?pjhq6t2Q5/4kSb08UWYXcoNqM0ly4VQXwI+QiczQMnX0KseOzM5DpweWjCDu?= =?us-ascii?Q?H0YEIfamLOaU5VvzFhkElM16Zubw7H9qScxx1J1xiXav/VJJpC67dhfngJ0s?= =?us-ascii?Q?XOfDYhBJ5HjRM+OOi37DIdId22WxYx2bGVN0HApiL2MQ17cIapktfQcrfKDx?= =?us-ascii?Q?9vvtZWTpX+Q/zW3VSlOQwkgOklQZe8tLNgazId0Qy1CX8tA=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN7PR12MB2707.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8fffe909-408d-4aee-154c-08d8b32d5722 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2021 16:57:38.8807 (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: vRLJe2n4qADSFcjqXqjVhRwCsJ++QiTHAOoj4bLUF5MOS9n7XdEXWOT9zuvIxGG7M71SJdX7KVa1N4QfPdV2Ag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0114 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1610038672; bh=HACPoTXmygXBIhnmgJlqBrCrxjfMgKeLxC7OBfYYzEY=; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To: CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References: In-Reply-To:Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:authentication-results:x-originating-ip: x-ms-publictraffictype:x-ms-office365-filtering-correlation-id: x-ms-traffictypediagnostic:x-ld-processed: x-ms-exchange-transport-forked:x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers:x-ms-exchange-senderadcheck: x-microsoft-antispam:x-microsoft-antispam-message-info: x-forefront-antispam-report:x-ms-exchange-antispam-messagedata: Content-Type:Content-Transfer-Encoding:MIME-Version: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; b=lSOT145WDVp3tDfruZ/jD+aH5+B8bW+uivZdSxMKQgwvAuG7wiWStNJsOa0dmQnAi loL6RrtGSnTDOcb3uGUi49gYAGmPaJDkKSuwK6bfe/SmHDczJRg5LnwBISZxlrIz8u PQOv5t2Lj+lOFaBNtp6NcyUAlXtmtQma3JWQh5bpMh0NesMhsigxd8bGldZ7yWuuEX rcXq73Odx5jJSuHKc77C4U/M1Gv9mywnZb5LrHVFdIg8V/QR7uEXalOMuBSwrCzE4w JbphNpsL3vYYhRbfRu6NKzLNVatVm6RKorh88SZt0PQlUSw6bkq1IkV2wZ9KO/aVaf oHTH/vgSZKELg== Subject: Re: [dpdk-dev] [RFC] ethdev: introduce copy_field rte flow action 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" > 07/01/2021 16:22, Alexander Kozyrev: > > > 07/01/2021 16:10, Alexander Kozyrev: > > > > > > > Thursday, January 7, 2021 10:18, Thomas Monjalon > > > > > > > > > > > RTE Flows API lacks the ability to save an arbitrary header= field in > > > > > > > > order to use it later for advanced packet manipulations. Ex= amples > > > > > > > > include the usage of VxLAN ID after the packet is decapsula= ted or > > > > > > > > storing this ID inside the packet payload itself or swappin= g an > > > > > > > > arbitrary inner and outer packet fields. > > > > > > > > > > > > > > > > The idea is to allow a copy of a specified number of bits f= orm any > > > > > > > > packet header field into another header field: > > > > > > > > RTE_FLOW_ACTION_TYPE_COPY_FIELD with the structure defined > > > below. > > > > > > > > > > > > > > > > struct rte_flow_action_copy_field { > > > > > > > > struct rte_flow_action_copy_data dest; > > > > > > > > struct rte_flow_action_copy_data src; > > > > > > > > uint16_t width; > > > > > > > > }; > > > > > > > > > > > > > > > > Arbitrary header field (as well as mark, metadata or tag va= lues) can > be > > > > > > > > used as both source and destination fields. This way we can= save an > > > > > > > > arbitrary header field by copying its value to a tag/mark/m= etadata > or > > > > > > > > copy it into another header field directly. tag/mark/metada= ta can > also > > > > > > > > be used as a value to be stored in an arbitrary packet head= er field. > > > > > > > > > > > > > > > > struct rte_flow_action_copy_data { > > > > > > > > enum rte_flow_field_id field; > > > > > > > > uint16_t index; > > > > > > > > uint16_t offset; > > > > > > > > }; > > > > > > > > > > > > > > > > The rte_flow_field_id specifies the particular packet field= (or > > > > > > > > tag/mark/metadata) to be used as a copy source or destinati= on. > > > > > > > > The index gives access to inner packet headers or elements = in the > tags > > > > > > > > array. The offset allows to copy a packet field value into = the > payload. > > > > > > > > > > > > > > So index is in reality the layer? How is it numbered exactly? > > > > > > > > > > > > It is a layer for packet fields, inner headers get higher numbe= r index. > > > > > > But is it also an index in the TAG array, so the name comes fro= m it. > > > > > > > > > > Sorry it is not obvious. > > > > > Please describe the exact numbering in tunnel and VLAN cases. > > > > > > > > > > > > What is the field id if an offset is given? > > > > > > > > > > > > Field ID stays the same, you can specify a small offset to copy= just a > few > > > bits > > > > > > from the entire packet field or a big offset to move to complet= ely > different > > > > > area. > > > > > > > > > > I don't understand what is an offset then. > > > > > Isn't it the byte or bit where the copy start? > > > > > Do you handle sizes smaller than a byte? > > > > > > > > It is the bit offset, you can copy 20 bits out of 32 bits of IPv4 a= ddress for > > > example. > > > > > > Now I'm confused. > > > You mean rte_flow_action_copy_data.offset is a bit offset? > > > > rte_flow_action_copy_data.offset and rte_flow_action_copy_field.width > > are measured in bits, right. >=20 > So the offset is limited to 16 bits? > How can it be useful? Is it an offset starting from the specified field? Why 16? It can be up to 2^16=3D65536 bits. Do you think that is not enough? And it starts from the specific packet field pointed by the Field ID, corre= ct. >=20 > > > > > > > Can we say that a field id can always be replaced by an offse= t? > > > > > > > > > > > > Not really. You can use offset to jump around packet fields for= sure, but > it > > > is > > > > > going to be > > > > > > hard and cumbersome to calculate all the offsets for that. Fiel= d ID is > much > > > > > more convenient. > > > > > > > > > > I think it depends for who. > > > > > For some use cases, it may be easier to pass an offset. > > > > > For some drivers, it may be more efficient to directly manage off= sets. > > > > > > > > It is possible with this RFC, driver can choose what to use: id and= /or offset. > > > > > > > > We can set field and index to 0, and use only offset? > > Yes, I'm not inending to put any restrictions against that. > > > Then it is a byte offset from the beginning mbuf.data? > > Yes, but it is still bit offset, not byte offset.