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 4480FA09FF; Tue, 5 Jan 2021 23:12:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E01AA16081E; Tue, 5 Jan 2021 23:12:56 +0100 (CET) Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by mails.dpdk.org (Postfix) with ESMTP id 6D231160819 for ; Tue, 5 Jan 2021 23:12:55 +0100 (CET) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Tue, 05 Jan 2021 14:12:54 -0800 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 5 Jan 2021 22:12:50 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.175) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 5 Jan 2021 22:12:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aMZCqGJ8l9SSZYaqHd3H6LUm1IhLsEO8fDcLWMQivBEAibaVG7tNDR40f8z8ZGL5hSOX2fLTIttRU/uEqmiq5qAPQY5vDhz/xGbOyTAm193CCkmjTbn8C3l99KH3rkZ3hOXcmmIimC8nQl1q85yWpuNIRhB4fo3bYqZZNWA+C9kyXDteJEvdMu3aHiAUn9iJnD/SwSuMgRVCNkdq5/9zahFTdS54NLJjJGFvfsnqPir9f6dDFPc+omZTWkJUhiLe248bgpV2HA/SGpj7WGJ4pfqS8QFS2OmcAqGBmNh0+RxPKovQXGpH6U7w+qGdEmNicU6gwJa6C9RUXg70BvSvVA== 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=nPhJaQ8oFKHdZOp3B5Bk1oByOvZjX0cxAdMm7j+zf38=; b=iIwbR0nr1mraZiba9vAyGASfoC1k3Fr4Wze18xc4wWZhSwgRTIsvvQNuAg6D7Lcm41Hp24oEOWY3+VNi/hCX5R9MdWMlb58+xZU3OmCAIAlPGPV/v8IkBwQorh6bdo6+W5xLq6874f5o0dFy2ud3DUzsPYrG0G40w/L1ez5Z9yH2rhGSxGl10Q+e1m34UPhp6oJ5B6gB5KZPpV8dFilKxYvjS6tAfxShjykUXAyXuV1x1z7dQ4vukkmRZ+ac3/JXkrjIOw2rdmt9QA+rhExre4oU+e8xmLDubQmPQubEf6rvY3Sp+mpKh5ku8lWXvVeWmmC4IJGqRbDmbQIv+f6RPQ== 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 BN8PR12MB3393.namprd12.prod.outlook.com (2603:10b6:408:46::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.21; Tue, 5 Jan 2021 22:12:49 +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.3721.024; Tue, 5 Jan 2021 22:12:48 +0000 From: Alexander Kozyrev To: Alexander Kozyrev , "dev@dpdk.org" CC: Slava Ovsiienko , Ori Kam , NBU-Contact-Thomas Monjalon , "ferruh.yigit@intel.com" , "andrew.rybchenko@oktetlabs.ru" Thread-Topic: [dpdk-dev] [RFC] ethdev: introduce copy_field rte flow action Thread-Index: AQHW1N2TdPEI29qYiUa+u6muk6TpcaoZtMoQ Date: Tue, 5 Jan 2021 22:12:48 +0000 Message-ID: References: <20201218013129.25186-1-akozyrev@nvidia.com> In-Reply-To: <20201218013129.25186-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: [2607:fea8:e380:d8e0:85ce:de31:c781:cad5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3084b8fe-3cdc-4464-53e4-08d8b1c7098a x-ms-traffictypediagnostic: BN8PR12MB3393: 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: lMteAErjFWmjZpkfLPeLzpl8axs6X+8z9nJAb1+SoanOSwMCSaGT33kWFm5QTHOwa1mUf/UvfVULNYAMk/XQ5Z+NbGEFflb6FoTmQ6tqFHEyUu10bqsDF0NJw49uNmsFXXxUN3f7TJTFwbSTXkGSZMpsSLm5ph6PhyGJ9eWhopICsdRwnswJdvu6rFez7CP8ThG2cAarh39vUlO11WWkQiPf+lbRaE8dgnfI9bbhIgYCr/XlWDSk7p/BOEK0peRJXydINw82Sodd227umOCJ+AQcfdByvQee3tIjMV8YllbLIsfBfOskKz20psISnL6ruzThvIKyZaQ1jotyY6dn1nqUfBYf5HGRVESThjY4mq/ML8t3eVBnYntVbkU1DQUsJW1wAL4Y72RWjHM7avCI7xwWJi0VvCcieIpx6vTIGpNjrytXMxwqSaargdphAncE 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)(346002)(396003)(366004)(136003)(376002)(39860400002)(86362001)(9686003)(55016002)(478600001)(66476007)(5660300002)(316002)(54906003)(66946007)(66556008)(8936002)(186003)(52536014)(4326008)(76116006)(66446008)(8676002)(2906002)(7696005)(33656002)(6506007)(110136005)(53546011)(83380400001)(71200400001)(64756008)(21314003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?9gA+M9O5/av4sHM+Vji8XBJzfDJUgZssR8j7i3ZKJO7hcTFkXKgmyGb55rXF?= =?us-ascii?Q?DtIJ7l3cHO5vuUtud3L9Xvpq58ac5K5LfOujELr06kUw1ifp1U5mTgFPdjk5?= =?us-ascii?Q?1HLrUoJkMurePJ+BF4hEYXNMONcutez2IZ5Qg0yDhS9V0Ja0zFqtkJmB645W?= =?us-ascii?Q?SHYqnU50sXDL9wfCenxySEkZ6EbMTmf9OyCw4r82tWH42PPho70qOgf8KaA3?= =?us-ascii?Q?wlaO/tYdz3ZfsNqMmNHAba9Vz8dXy3HVIIumog0v5s+8tSIhbYmBAfizx9GA?= =?us-ascii?Q?uB8EiC2f3bid4W/UK3GNn0JdN+S7KMQUhAZIRaaTefzsG8CcqBHvYcXkjOBg?= =?us-ascii?Q?TMBbHoowHYb7usUEoug76cXLYUkNmEnHAC0PvRZSyOvE16Z/selH/zfn+FPI?= =?us-ascii?Q?DMN4KoNdPQFdJ8tMxSalIABop/M3/6oIIe96N1Pevz+3iiU1GFyEOvwUt3Rd?= =?us-ascii?Q?IFJawdz6CH83TWKt5CTx+9q/LpIdZ6aOE1ElFxPBTgUWXJKJ5NTkV+EVVZg7?= =?us-ascii?Q?FlZs+nLqPwI3IsNsEyCg7tdHwQV9yWUXhBTwrdCUOhTH89qVgSJq21ISfoFi?= =?us-ascii?Q?3dSY+6dqD+aYKMpRT47yfRgDBYByC263p+XJMVuKo4p2D929qkygJuLdA+sH?= =?us-ascii?Q?D9Pi7FJAtcjHxDHVeReedbZB3t/5jUfBw1xtHhHm0E+QZRWQMDzLKd+lW1UY?= =?us-ascii?Q?G4QXs46dS1D9Hthu2pgGvcQeSVMzzKDqTO9msxqhfKNSEz7kUEq/KLXXEWXu?= =?us-ascii?Q?BVzK6bZiwGpUPHZVGjEycq2CkFzaHOhSlbeP4TqPkxXcO+DHXZqQP3YVtB6n?= =?us-ascii?Q?yaaZtRLf21Cbj+ktEuosEu/pzgz9EMkmIvBr6oLLyFsnM5La7exXlwdf/G7j?= =?us-ascii?Q?75n2AIt/1uRtx7v18TrOc49NrOWEpTzKy7VDHzg3dqHv1Q8qgx9arNdemB7Q?= =?us-ascii?Q?IKId0ZSiNP+k5KaZPIP0dxEO8DpjQaZONQ68TGhdG643/bYYqU8YpFr0NQgB?= =?us-ascii?Q?e8B6stSTKUvjKKsB0UlwJeeWgL33EF5aee00qulmB4jDQkA=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: 3084b8fe-3cdc-4464-53e4-08d8b1c7098a X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2021 22:12:48.7544 (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: EqJVlLKxISsdC+2qKNkN+mh/EcTeb4Jp9WdprhDXYqHRtea+M39OfOtlQKmOx3uLSlbrLtCIbTVfBruJNpCabA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3393 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1609884774; bh=nPhJaQ8oFKHdZOp3B5Bk1oByOvZjX0cxAdMm7j+zf38=; 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=AgXaB/nfLzia/wSGUznoSC3HCoTCHbG+6xqhvUubtrLYvY1rp+KeWZAJOAwSAbWVO WJq350aWZdndEta6yU5PEn469Kuo9Ux9rMlHlhH2d708rdMo2Q7mWR4rpdHDb0HnIX RnYT/zAgJIgwXdKhfx6mBm+moNZYtyA0b5GnYrix101fq0EetfI7gjEu2Hscl9xICU 2O+zqif/qArfU03DEoRCN4vldBa6ZuG8wISeC0Zyx6xnL/Z1Mn1i5lQm7pyfbvFLsv LOaaY8sfUc5hixJ6pmOHtZ6Fkkkic8dDzEWLaiTdvaYuncc472oJ9MfB1GdpB2ptfO 6Kpae/DhUOwRg== 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" Happy New Year Gentlemen, would you mind to share your thought on the propo= sed changes? I was thinking about renaming it to more general "copy item" to cover all p= acket fields, tags and metadata. Other than that it is ready for a formal patch integration in my opinion if= there are no objections. Please advise. Regards, Alex > -----Original Message----- > From: dev On Behalf Of Alexander Kozyrev > Sent: Thursday, December 17, 2020 20:31 > To: dev@dpdk.org > Cc: Slava Ovsiienko ; Ori Kam ; > NBU-Contact-Thomas Monjalon ; > ferruh.yigit@intel.com; andrew.rybchenko@oktetlabs.ru > Subject: [dpdk-dev] [RFC] ethdev: introduce copy_field rte flow action >=20 > RTE Flows API lacks the ability to save an arbitrary header field in > order to use it later for advanced packet manipulations. Examples > include the usage of VxLAN ID after the packet is decapsulated or > storing this ID inside the packet payload itself or swapping an > arbitrary inner and outer packet fields. >=20 > The idea is to allow a copy of a specified number of bits form any > packet header field into another header field: > RTE_FLOW_ACTION_TYPE_COPY_FIELD with the structure defined below. >=20 > struct rte_flow_action_copy_field { > struct rte_flow_action_copy_data dest; > struct rte_flow_action_copy_data src; > uint16_t width; > }; >=20 > Arbitrary header field (as well as mark, metadata or tag values) 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/metadata or > copy it into another header field directly. tag/mark/metadata can also > be used as a value to be stored in an arbitrary packet header field. >=20 > struct rte_flow_action_copy_data { > enum rte_flow_field_id field; > uint16_t index; > uint16_t offset; > }; >=20 > The rte_flow_field_id specifies the particular packet field (or > tag/mark/metadata) to be used as a copy source or destination. > 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. >=20 > It is proposed to implement the "set copy_field" command to store all > the required parameters and then to use this template by specifying the > index of the needed copy action. For example, to modify the GTP tunnel > ID after the packet is encapsulated following testpmd rules are used: >=20 > set copy_field width 32 src field tag index 1 offset 0 > dst field teid index 0 offset 0 > flow create 0 ingress pattern ... / end > raw_decap index 1 / raw_encap index 2 / > copy_field index 1 / end >=20 > A more generic mechanism to overwrite an arbitrary header field may be > introduced to the RTE flows implementation later: > RTE_FLOW_ACTION_TYPE_SET_FIELD with the structure defined below. >=20 > struct rte_flow_action_copy_field { > struct rte_flow_action_copy_data dest; > uint8_t *data; > uint16_t width; > }; >=20 > This way we can have the generic way to specify an immediate value and > use it as data for any packet header field instead of having separate > RTE Flow action for each of the packet fields. Deprecation notice may > be issued to RTE_FLOW_ACTION_TYPE_SET_XXX actions after the unified > method of setting a value to any packet field is implemented. >=20 > Signed-off-by: Alexander Kozyrev > --- > lib/librte_ethdev/rte_flow.c | 1 + > lib/librte_ethdev/rte_flow.h | 59 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 60 insertions(+) >=20 > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index a06f64c271..c3154a29e2 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_FIELD, sizeof(struct > rte_flow_action_copy_field)), > /** > * 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..8f1798487c 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_field. > + */ > + RTE_FLOW_ACTION_TYPE_COPY_FIELD, > }; >=20 > /** > @@ -2791,6 +2801,55 @@ struct rte_flow_action_set_dscp { > */ > struct rte_flow_shared_action; >=20 > +enum rte_flow_field_id { > + RTE_FLOW_FIELD_NONE =3D 0, > + RTE_FLOW_FIELD_MAC_DST, > + RTE_FLOW_FIELD_MAC_SRC, > + RTE_FLOW_FIELD_VLAN_TYPE, > + RTE_FLOW_FIELD_VLAN_ID, > + RTE_FLOW_FIELD_MAC_TYPE, > + RTE_FLOW_FIELD_IPV4_DSCP, > + RTE_FLOW_FIELD_IPV4_TTL, > + RTE_FLOW_FIELD_IPV4_SRC, > + RTE_FLOW_FIELD_IPV4_DST, > + RTE_FLOW_FIELD_IPV6_HOPLIMIT, > + RTE_FLOW_FIELD_IPV6_SRC, > + RTE_FLOW_FIELD_IPV6_DST, > + RTE_FLOW_FIELD_TCP_PORT_SRC, > + RTE_FLOW_FIELD_TCP_PORT_DST, > + RTE_FLOW_FIELD_TCP_SEQ_NUM, > + RTE_FLOW_FIELD_TCP_ACK_NUM, > + RTE_FLOW_FIELD_TCP_FLAGS, > + RTE_FLOW_FIELD_UDP_PORT_SRC, > + RTE_FLOW_FIELD_UDP_PORT_DST, > + RTE_FLOW_FIELD_VXLAN_VNI, > + RTE_FLOW_FIELD_GENEVE_VNI, > + RTE_FLOW_FIELD_GTP_TEID, > + RTE_FLOW_FIELD_TAG, > + RTE_FLOW_FIELD_MARK, > + RTE_FLOW_FIELD_META, > +}; > + > +struct rte_flow_action_copy_data { > + enum rte_flow_field_id field; > + uint16_t index; > + uint16_t offset; > +}; > + > +/** > + * RTE_FLOW_ACTION_TYPE_COPY_FIELD > + * > + * 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_field { > + struct rte_flow_action_copy_data dest; > + struct rte_flow_action_copy_data src; > + uint16_t width; > +}; > + > /* Mbuf dynamic field offset for metadata. */ > extern int32_t rte_flow_dynf_metadata_offs; >=20 > -- > 2.24.1