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 5267AA04B5; Sun, 10 Jan 2021 09:00:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9186140E33; Sun, 10 Jan 2021 09:00:43 +0100 (CET) Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by mails.dpdk.org (Postfix) with ESMTP id BBC1E140E2F for ; Sun, 10 Jan 2021 09:00:42 +0100 (CET) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Sun, 10 Jan 2021 00:00:41 -0800 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 10 Jan 2021 08:00:39 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Sun, 10 Jan 2021 08:00:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hH69Kt0mIFg95QD5J/ABR/Rll7Gk+CVtD/OslqLqzmpKRM7hT7NMN9k5Zv8fFCT2zLlNg2ZTp95qvExyk5LjIApZwiTCruZeJmZ/7KCCT1rDOgTvG9pEl/3yc8ZEPNUBorNJCvW8IK8CwRBdnli/STXDYLCpiwbvfK0YWCpGPAKZI8kDs1X1ACLwMWKnmonxuL3PJGzAvf6TofPpfeSOwJpER4LzFxhQMMkNjMKCwDBn7+Cjxy42Sg0Qf9U62wj3i7OvRR0FSd4VTZsvXrWSqpgFKDhguhXCABifKHsCSpXo99uQpvZ9ipL3w2EEP4opfMpMYGgUiVdJ8PKVendTsg== 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=aDNEi8if1eWP7cWcmeLsjLWNFxhmB9v9A9wbyAciWAo=; b=F0WKz8FuQjF9sPtC1UItqdomZMhaSJt5vsl4V5Acn0xH0TLpc3svzcTg2oTUci6uSZr1SDsEkU0emlprln80lGjGqKEdR0d0lXQ1lM7pwpv7lc1Lmzp4VMgz02IeXVcLh/M/r/SyDXmdVflQXfXi2dExmgYGB3N4AB0x2aS8cpOeYKmNsANq9OuCcSVwQZdtUjqAl9DCHvSl2T534hMv0gYwCVOHuwIRT2dv/f120p73KedzVqNDswCHRUWuve5R1Hv03uA5uwY4D86SKwjI+3SIU4qewBVPqWuWzYZVhW0qnME1tIBSszX9UCzbgaZ3G0TvV3LKW+pwo+L7WNllgg== 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 DM6PR12MB4987.namprd12.prod.outlook.com (2603:10b6:5:163::31) by DM6PR12MB3963.namprd12.prod.outlook.com (2603:10b6:5:1cd::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Sun, 10 Jan 2021 08:00:37 +0000 Received: from DM6PR12MB4987.namprd12.prod.outlook.com ([fe80::e1e4:bf73:a753:2665]) by DM6PR12MB4987.namprd12.prod.outlook.com ([fe80::e1e4:bf73:a753:2665%4]) with mapi id 15.20.3742.012; Sun, 10 Jan 2021 08:00:37 +0000 From: Ori Kam To: Alexander Kozyrev , "dev@dpdk.org" CC: Slava Ovsiienko , NBU-Contact-Thomas Monjalon , "ferruh.yigit@intel.com" , "andrew.rybchenko@oktetlabs.ru" Thread-Topic: [PATCH] ethdev: introduce generic copy rte flow action Thread-Index: AQHW5YgR+7Ov3GfAIkW0PNLie6o6Jqogen4Q Date: Sun, 10 Jan 2021 08:00:37 +0000 Message-ID: References: <20210108063234.7679-1-akozyrev@nvidia.com> In-Reply-To: <20210108063234.7679-1-akozyrev@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; 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: d78d4286-5bfe-4936-f537-08d8b53dd110 x-ms-traffictypediagnostic: DM6PR12MB3963: 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:1284; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JQsDsRMklEOexib8QbXNag7BhTZQe2NMK+OdwtPApg4pBcLqG5w3tOgVr6GU/HqmeDMQVhf7xG6T3C3cE2utKVFi1kssaHBDuN8sGjS4lV90XVoGkMfiUbL6auAGMsvZDCq+s0OpCHQidzXg2fQ4CAWy/QLofAHyvIf80rzfyLTmeGqN9O2jwEmNVE7PqcfKfNk40M20P7Q48D3TuQ+qUeGQjCEVO/6L/XjdzSpEhUiKibcwsi6SawhfX8BcdfR3o0fDQrtK+IGuKGhmqPL3vOBpNTGPcDwW3eWioGlAQhM7d3aL6rbpXLnkFv0PqU+ic8KVlm7wjQMrE0PI2QDOZ3TPiQ4JGIo57+rJ2NJWmNPvNO3NNMZNESinWnu2WSX5oo05oaSzjhnYdrWK+dsW1DZA/K8LxFjyDxn1z3nVAejZky2DoS5FKTYsB1qkqgHMyhi0gaWJ+a1FELRCC5U25Od87JYBMwQBJ5QZkVbml2A= 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)(136003)(346002)(396003)(39850400004)(376002)(366004)(2906002)(7696005)(71200400001)(53546011)(64756008)(33656002)(6506007)(478600001)(66476007)(55016002)(5660300002)(966005)(66556008)(9686003)(45080400002)(8676002)(86362001)(66446008)(66946007)(52536014)(76116006)(54906003)(110136005)(8936002)(26005)(4326008)(316002)(186003)(83380400001)(41533002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?057M3Hl80k8gom95sRQQWad6w1SO6uIELuCLPU3At5GEblbxezxnU3guhZuh?= =?us-ascii?Q?uhvjTEgZu+qrgAYvZ/r6KlKYrNssn8NUfbywURgq+ukFoqBK8v+MkhdvQtBv?= =?us-ascii?Q?XCA9HIeaoduGR5gkK8hbmA72bD0ybEYBG+pa0QN52zLuOVuGkY07JMfSMHUJ?= =?us-ascii?Q?Eeu8nYTCgz4GWZKpSs/2e6qO8Ue4HR4FB377jifrcWOwDUvvDUW+/cLgsNeh?= =?us-ascii?Q?C8mZhlOA1CnxVN7+RiCpKzdd46S6WFufWV77+5r1rPROYhoWpnwZhoIIP1ew?= =?us-ascii?Q?X9eE4wy+x1+jfJulwaPM3mGiMviueOa5YpJ7UwKpk/SRpM2a/2V3/26mWMm2?= =?us-ascii?Q?oWgocWlMs7cVlaV59KztX3FfaNy5xmL1VAg8QmiTLsgGTlMXMH+E5UsP4fgp?= =?us-ascii?Q?gmkwA0t4O7yExIVSiv/spWNfap2sbQCYS23/TxM8+kLOjwRVKJkJMtsIkhM4?= =?us-ascii?Q?+NMoI8rZDP2bVzG/UNsB04EUmnzuF+bkU2HhLywg+PyP+nKwUGtoHm2V+pTr?= =?us-ascii?Q?bjg2g0JyNOyLEuLtYPH8wHIEA/Yq+J342iuK2680WFY+m8bvx4lJIUeDJZW5?= =?us-ascii?Q?DbpxKbhpdNNebQhLdbmT8PPa3h9b8AP3anCw1KyP1BHVRfWYdbqCrA88A5gl?= =?us-ascii?Q?orBmVL+BdVaVqp9xr2XjXSgoe4bH2MweosHyA7J05repCTRoA3FfRleDKYUR?= =?us-ascii?Q?JaUj0EalHxJG+Ag7qr8UFYvuSEeU0WBhCefosDfbDswiS1trXUg9/ygJzHde?= =?us-ascii?Q?miM4b9FsCXYIDQrCiyyuAkjEchulP+z71z6fGIvb0iaZUieWZ+cA8LD1vQH9?= =?us-ascii?Q?Hmq/KAyck7y3n8F02n23Cjq8HbIbhq5mExqQr/LeLnAZdxj3BD1fiOaP3ZMe?= =?us-ascii?Q?qK/GMC1EpKu82f1xf/F6Vf6TmTnzHFWNU+8nLC6b4fqjlz3QjvnUgSu8WEyG?= =?us-ascii?Q?tmMU6iS/8GmPlbnsM+NxvqU0ASoYWSJEqrBNm5GsXxw=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: DM6PR12MB4987.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d78d4286-5bfe-4936-f537-08d8b53dd110 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2021 08:00:37.7387 (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: mc4XJxHxVQBBsFycBuEBeQAJM4xctuxpQCy68pesbc0MG75uRSFI4KOGqHqSMh1DOwfG9h1mhSs1i7eToQ8v1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3963 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1610265641; bh=aDNEi8if1eWP7cWcmeLsjLWNFxhmB9v9A9wbyAciWAo=; 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=f5mREF5AFiKFdKQ2qqboFjg4VFgur9Zl6+YZ+MhSVvS8D3UVHUDsJLAw/VP5++DFY ls6MAaZzdIEeHC4I2NYsqVk5dopVqLCEpGqUXOWJo31VoiJqxyjBzg+h3pfzhIkDpp /zE1ZKFBpnh9trdYNG3Nk0vqQ4UVxkWtJ1M5sW828cE/t8M9h+Oe7qNblyw6JGsmIn teqm38RFnFZVZA4caOOqPr651Obe3li85W4PFXZGUKoa4g5yyv5lsdIGR4O1vWj8sy 3r2CdVMqj4hCZb318kzavi2zmIGMKP4O11Ay84vgwIBVCI9gO4wm6e/jClMidRF2SQ SY+gklp8api0g== Subject: Re: [dpdk-dev] [PATCH] ethdev: introduce generic copy 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" Hi Alexander, I guess that the test-pmd part will be available later right? > -----Original Message----- > From: Alexander Kozyrev > Sent: Friday, January 8, 2021 8:33 AM > Subject: [PATCH] ethdev: introduce generic copy rte flow action >=20 > Implement a generic copy flow API to allow copying of an arbitrary > header field (as well as mark, metadata or tag) to another item. >=20 > This generic copy mechanism removes the necessity to implement a > separate RTE Flow action every time we need to modify a new packet > field in the future. A user-provided value can be used from a > specified tag/metadata or directly copied from other packet field. >=20 > The number of bits to copy as well as the offset to start from can > be specified to allow a partial copy or copy into an arbitrary > place in a packet for greater flexibility. >=20 Since the question why you are using enum and not just offset from=20 the start of the packet, was discussed and raised by number of people it wi= ll be best if it will appear in the commit log, at least the advantages to this implem= entation. > RFC: > https://nam11.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fpatche= s.d > pdk.org%2Fpatch%2F85384%2F&data=3D04%7C01%7Corika%40nvidia.com% > 7Cd04c2e49c3a840994da408d8b39f3304%7C43083d15727340c1b7db39efd9cc > c17a%7C0%7C0%7C637456843629116269%7CUnknown%7CTWFpbGZsb3d8eyJ > WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C > 1000&sdata=3D85096rASBtzbjU42pV6sPkl3nVt5HlR6%2BL9nxI3qgFA%3D&a > mp;reserved=3D0 >=20 > Signed-off-by: Alexander Kozyrev > --- > doc/guides/prog_guide/rte_flow.rst | 35 ++++++++++++++++++ > lib/librte_ethdev/rte_flow.c | 1 + > lib/librte_ethdev/rte_flow.h | 59 ++++++++++++++++++++++++++++++ > 3 files changed, 95 insertions(+) >=20 > diff --git a/doc/guides/prog_guide/rte_flow.rst > b/doc/guides/prog_guide/rte_flow.rst > index 86b3444803..b737ff9dad 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -2766,6 +2766,41 @@ The behaviour of the shared action defined by > ``action`` argument of type > | no properties | > +---------------+ >=20 > +Action: ``COPY_ITEM`` > +^^^^^^^^^^^^^^^^^^^^^ > + > +Copy ``width`` bits from ``src`` item to ``dst`` item. > + > +An arbitrary header field (as well as mark, metadata or tag values) > +can be used as both source and destination items as set by ``item``. > + For tag I think you should also use the index right? > +Inner packet header fields can be accessed using the ``index`` and > +it is possible to start the copy from the ``offset`` bits in an item. Please specify what means index 0 /1 ... 0 is outer most? Inner most? You can look at the RSS level for reference. I think it will be best to use the same values. What happens if we want to copy between different sizes? for example copy IPV6 src to number of tags? I assume we will be using offs= et and split the copy command to number of actions right? > + > +.. _table_rte_flow_action_copy_item: > + > +.. table:: COPY_ITEM > + > + +-----------------------------------------+ > + | Field | Value | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > + | ``dst`` | destination item | > + | ``src`` | source item | > + | ``width`` | number of bits to copy | > + +---------------+-------------------------+ > + > +.. _table_rte_flow_action_copy_data: > + > +.. table:: destination/source item definition > + > + +----------------------------------------------------------+ > + | Field | Value | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ > + | ``item`` | ID of a packet field/mark/metadata/tag | > + | ``index`` | index of outer/inner header or tag array | > + | ``offset`` | number of bits to skip during the copy | > + +---------------+------------------------------------------+ > + > Negative types > ~~~~~~~~~~~~~~ >=20 > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index a06f64c271..fdbabefc47 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -176,6 +176,7 @@ static const struct rte_flow_desc_data > rte_flow_desc_action[] =3D { > MK_FLOW_ACTION(SET_IPV6_DSCP, sizeof(struct > rte_flow_action_set_dscp)), > MK_FLOW_ACTION(AGE, sizeof(struct rte_flow_action_age)), > MK_FLOW_ACTION(SAMPLE, sizeof(struct rte_flow_action_sample)), > + MK_FLOW_ACTION(COPY_ITEM, sizeof(struct > rte_flow_action_copy_item)), > /** > * Shared action represented as handle of type > * (struct rte_flow_shared action *) stored in conf field (see > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > index 0977a78270..0540c861fb 100644 > --- a/lib/librte_ethdev/rte_flow.h > +++ b/lib/librte_ethdev/rte_flow.h > @@ -2198,6 +2198,16 @@ enum rte_flow_action_type { > * struct rte_flow_shared_action). > */ > RTE_FLOW_ACTION_TYPE_SHARED, > + > + /** > + * Copy a packet header field, tag, mark or metadata. > + * > + * Allow saving an arbitrary header field by copying its value > + * to a tag/mark/metadata or copy it into another header field. > + * > + * See struct rte_flow_action_copy_item. > + */ > + RTE_FLOW_ACTION_TYPE_COPY_ITEM, > }; >=20 > /** > @@ -2791,6 +2801,55 @@ struct rte_flow_action_set_dscp { > */ > struct rte_flow_shared_action; >=20 > +enum rte_flow_item_id { > + RTE_FLOW_ITEM_NONE =3D 0, > + RTE_FLOW_ITEM_MAC_DST, > + RTE_FLOW_ITEM_MAC_SRC, > + RTE_FLOW_ITEM_VLAN_TYPE, > + RTE_FLOW_ITEM_VLAN_ID, > + RTE_FLOW_ITEM_MAC_TYPE, > + RTE_FLOW_ITEM_IPV4_DSCP, > + RTE_FLOW_ITEM_IPV4_TTL, > + RTE_FLOW_ITEM_IPV4_SRC, > + RTE_FLOW_ITEM_IPV4_DST, > + RTE_FLOW_ITEM_IPV6_HOPLIMIT, > + RTE_FLOW_ITEM_IPV6_SRC, > + RTE_FLOW_ITEM_IPV6_DST, > + RTE_FLOW_ITEM_TCP_PORT_SRC, > + RTE_FLOW_ITEM_TCP_PORT_DST, > + RTE_FLOW_ITEM_TCP_SEQ_NUM, > + RTE_FLOW_ITEM_TCP_ACK_NUM, > + RTE_FLOW_ITEM_TCP_FLAGS, > + RTE_FLOW_ITEM_UDP_PORT_SRC, > + RTE_FLOW_ITEM_UDP_PORT_DST, > + RTE_FLOW_ITEM_VXLAN_VNI, > + RTE_FLOW_ITEM_GENEVE_VNI, > + RTE_FLOW_ITEM_GTP_TEID, > + RTE_FLOW_ITEM_TAG, > + RTE_FLOW_ITEM_MARK, > + RTE_FLOW_ITEM_META, > +}; I don't think this name is good since it not rte_flow_item this is just int= ernal enumeration for this action. > + > +struct rte_flow_action_copy_data { > + enum rte_flow_item_id item; > + uint32_t index; > + uint32_t offset; Why use 32 bits? Since this copy only one register with max len of 32 bit. The max offset can 31? Same for the index. > +}; > + > +/** > + * RTE_FLOW_ACTION_TYPE_COPY_ITEM > + * > + * Copies a specified number of bits from a source header field > + * to a destination header field. Tag, mark or metadata can also > + * be used as a source/destination to allow saving/overwriting > + * an arbituary header field with a user-specified value. > + */ > +struct rte_flow_action_copy_item { > + struct rte_flow_action_copy_data dst; > + struct rte_flow_action_copy_data src; > + uint32_t width; Why use 32 bit register? > +}; > + > /* Mbuf dynamic field offset for metadata. */ > extern int32_t rte_flow_dynf_metadata_offs; >=20 > -- > 2.24.1 Best, Ori