From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C1EB2A0524;
	Thu,  7 Jan 2021 16:11:08 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 543CE140FB9;
	Thu,  7 Jan 2021 16:11:08 +0100 (CET)
Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com
 [216.228.121.64])
 by mails.dpdk.org (Postfix) with ESMTP id 13204140FB3
 for <dev@dpdk.org>; Thu,  7 Jan 2021 16:11:06 +0100 (CET)
Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by
 hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA)
 id <B5ff7248a0000>; Thu, 07 Jan 2021 07:11:06 -0800
Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL109.nvidia.com
 (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 7 Jan
 2021 15:10:54 +0000
Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.49) 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 15:10:54 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=L0ryPvhpI0UCkcnOuIGO8Vq5mWpgD6lh+UvtpNd4O/lTQRaPJlGQLXhNsUJDbvOjpR7z4FxVRiNjHtl76jTqiCym5gPFmPnRDi4fpoeNLK0udu3YAH9NWILInAo+H++vb6Q248G/RIBo0fPU22a1QycPwH7NGKeXa1XWsPNxg86TaRvOVnZyva15qi3slUO5Cr+mZnb5GnCTt0VpVuPExHwEuE60A4dKf7Z2UI9WBL3qJUJS1RBAExChVT1NpfRmi7NClUkjFWXxHWGuzWLk+NjUiSFvHXXP9IKed89osynd4ljhw2S6pmyVKjkx/tRX48I9M2zPbKbHDsA36vaGlQ==
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=lbk8OrfYO0SVy3etjMHJrGVkzYrfvk7a7RKsE5fo/q4=;
 b=SLPay3cj1ZlsxwrbFvQzu3cI2tK8upM/vOZbybIzRk73p3BoM9W6FxPuKnmhgVyWjQNXkmJOaq6htNVCb/vedqwP3Sc9y4nKagZhQ8+vqNisp1WtQm0B4ZMFhvfca7TQHyw4JUDesuVoybPtn2xFWUQSsYCmyIGenkXgD5WJDB/GMrYQEIruiMMJ1pCBTcRz/6RLRxyG4SnyWIndoQYczL8XdnL0VTPAONgNWMv7EcO6K6OdfgSfnTqdPH2MhIz32Aic5Uj0lKsm2aIlAY50fwCnElLAQlkCJwaAmfUKCSHBUBTmfNjJW7ZhyjjR3q6IE+3qZyYckGN7YEU33392pg==
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; Thu, 7 Jan
 2021 15:10:53 +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
 15:10:53 +0000
From: Alexander Kozyrev <akozyrev@nvidia.com>
To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>
CC: "dev@dpdk.org" <dev@dpdk.org>, Slava Ovsiienko <viacheslavo@nvidia.com>,
 Ori Kam <orika@nvidia.com>, "ferruh.yigit@intel.com"
 <ferruh.yigit@intel.com>, "andrew.rybchenko@oktetlabs.ru"
 <andrew.rybchenko@oktetlabs.ru>, "ajit.khaparde@broadcom.com"
 <ajit.khaparde@broadcom.com>, "jerinj@marvell.com" <jerinj@marvell.com>
Thread-Topic: [dpdk-dev] [RFC] ethdev: introduce copy_field rte flow action
Thread-Index: AQHW1N2TdPEI29qYiUa+u6muk6TpcaoZtyQAgAKb6PCAABCegIAAAFHg
Date: Thu, 7 Jan 2021 15:10:53 +0000
Message-ID: <BN7PR12MB27070C3068BAFBA3160C7490AFAF0@BN7PR12MB2707.namprd12.prod.outlook.com>
References: <20201218013129.25186-1-akozyrev@nvidia.com>
 <69996023.yYu3UIiVKq@thomas>
 <BN7PR12MB27076C97B778C654B53D8258AFAF0@BN7PR12MB2707.namprd12.prod.outlook.com>
 <6314874.LEoM74Pqvz@thomas>
In-Reply-To: <6314874.LEoM74Pqvz@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: e44e0345-9b40-43d9-f3c1-08d8b31e6d3a
x-ms-traffictypediagnostic: BN8PR12MB3393:
x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <BN8PR12MB33932EEB411DC016027541ABAFAF0@BN8PR12MB3393.namprd12.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: 5CwQ6gI3A7FlHpZNmtslWBaYzTDiwciqFAdETXhN6gRYSkl0ffEHWlgqk6IZPR69M/Lv4B19wbQUTYEa5qDYYsKg0yXBcP49fk+fLqJhGmzy8dxzehLPuPIhkXNrZ2HEPwc+q/VFmM5bdxv0G0lLCkkwPaasESkzJoHb0bv8VFMxyT2QQREK0o7MYDcjSAjFuxt0LmsvcJ+3w5GHSMCNIX91GdVs4Us9OFo/o2gHs3XzeXCcQGURIF+Efk3PicY40jLg7aJ4JOpDdBxNgAL0xE4K5FCYx5E8Znl8Gzs2sUPsMnaLHA4vNtkcp3i9hQB1vW82NZzH7fbWlJAn2wznv3t2foT5PVQp0dnh3Jm7aJ1EFuL5Fg/uPH020FDRK48HG4+4TtHylBxZfhCs4rpeag==
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)(136003)(376002)(346002)(396003)(366004)(6506007)(33656002)(6916009)(66446008)(2906002)(7696005)(71200400001)(83380400001)(478600001)(8676002)(64756008)(86362001)(9686003)(55016002)(66476007)(76116006)(4326008)(8936002)(186003)(5660300002)(52536014)(54906003)(66556008)(316002)(66946007);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata: =?us-ascii?Q?4ftVONBHpePNUtYULJqYDJZ/UsdtP8EL4rBtPWoWRvCqJVMaxWOMHMAvtGVF?=
 =?us-ascii?Q?8Nl52lGEyAn1u+uUQ4CY1X6v7LEt+53K9oUCAqUYBTj8r61VrXkaLVz4PUsC?=
 =?us-ascii?Q?WIkOIdeBsEpAIAVBscUvafwfoRZ/SdvnnDStT8CUEJdlX9v6GB3Ee489M5QB?=
 =?us-ascii?Q?4d9e+DgnAojNgOkzkUHz9dmY5tfzfp+49FI5pEYus/AmZX8Zke9HJik50L7d?=
 =?us-ascii?Q?QeiCKyUliIBNrJfNC5CqiQJl6PIE3nY4FazWOM97QsF5vBULlwDTwA9AmU/U?=
 =?us-ascii?Q?21/IM2OPcq8x85u7VRmhTS5lxSNS1fbmEW7VZi0PbdacNvDkp6DN45YN8T2f?=
 =?us-ascii?Q?7TDy2bs5UW83ksirZ1BpgNIW6PJ2E/50XulRh05GB23GnXwvjBLVj1CCiPzu?=
 =?us-ascii?Q?35XPHXZmFeT3FR0W6IZvu2Ijg0Y6pIRCLg1Yf/AdFP4fiQAtjbOmJBJB+UVS?=
 =?us-ascii?Q?ewy0oHTEg52Wh5HutW4gcGzJNi9UrGfThAELRsnIaFf5MXoXcB6Im3jLx4AN?=
 =?us-ascii?Q?dgJ6i+y6i/WJIwbyaFW+EX9orFpleTSNoRyJEhltTnzqf2Ce75Thm9ooFu/c?=
 =?us-ascii?Q?4T78YPjPKGDMweHj+DH8QRt3MbwogswDN6XDYZbaCLGgidQiKxuS0lQ7AaCT?=
 =?us-ascii?Q?j3lrKrHZd56ShwyJNMBt2m856MFEaMUwNhjWeMcG0Uh8S7keWvVgSQgyH/hd?=
 =?us-ascii?Q?yEukQJ8GK4xs7UbOiD532BAFB2fkCQFXQ9nVL5J6p+ovJnGY+33Vi0lMdUr/?=
 =?us-ascii?Q?5mDrv/gQ9bVcCqxqm06BAi0dPy2RLY9DeHaAfa3enC8wLszCfyU5ARjkzfow?=
 =?us-ascii?Q?x6eU3hUGmAFhXLgZxTBU7SLWoe7LcAPQ2PRjVDn/isSO24qexlmiaogpJZyb?=
 =?us-ascii?Q?EOz5bX9oVUvMDMq2+NbCZU4zTd+fOyw0GBQn7c8YVpObAXlqg7Yh4DBfAlbA?=
 =?us-ascii?Q?1fC+aA4yG+zcIzy/zV0vBaz1Tl8w0VbUQZzTPyRc3OuETdB0YXpT8KwVzOik?=
 =?us-ascii?Q?k163uV/9Twr3FWYDBbUcuhyBtCDn/4nj6cYgCeBSbK7c3cA=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: e44e0345-9b40-43d9-f3c1-08d8b31e6d3a
X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2021 15:10:53.4736 (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: pICf/jPfMltpEhsmGSPhSfKGvsdyHdWj0fwwUmhQvCwdFSINBmeNvDgiyaB5UMuiPWQNK58KxWRqIxGJKwZoJg==
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=1610032266; bh=lbk8OrfYO0SVy3etjMHJrGVkzYrfvk7a7RKsE5fo/q4=;
 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=FYtopqodPaYXxJ3z12QELgbjOUOD49cTblqYiptVjK4D+NpouMV1RAn6HKP7Rjlog
 S+yeYXIt07W1MonkVv0R0IAPRi2I51UrWz9VHcdOtNt1VzJ9KcqQXtJuCL9sohIr4m
 ce8UXn2jlngv7srx3v2E8KwSWAEYZrKfqTmA8XN+WcAU6ZtiYXPUkwVO6Bl7QxRMMH
 CrJSjsTxVEMMpIBTbq8Y+wHgoUiJDrFAZ7B1mtoMI9cP/ewcbuTZB+7h6u7ltixE2a
 L442CsvAoITsFSXYIBRwmxqn0sY8qgcB+wmD0hztTDUpwLwP8ZPnz/UZEZgcHUVuEb
 9+hIv/Wgl4sMQ==
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

> > > Thursday, January 7, 2021 10:07, Thomas Monjalon <thomas@monjalon.net=
>
> > > > RTE Flows API lacks the ability to save an arbitrary header field i=
n
> > > > 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.
> > > >
> > > > 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.
> > > >
> > > > 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 values) ca=
n 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 a=
lso
> > > > be used as a value to be stored in an arbitrary packet header 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 destination.
> > > > The index gives access to inner packet headers or elements in the t=
ags
> > > > array. The offset allows to copy a packet field value into the payl=
oad.
> > >
> > > So index is in reality the layer? How is it numbered exactly?
> >
> > It is a layer for packet fields, inner headers get higher number index.
> > But is it also an index in the TAG array, so the name comes from it.
>=20
> Sorry it is not obvious.
> Please describe the exact numbering in tunnel and VLAN cases.
>=20
> > > 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 completely diff=
erent
> area.
>=20
> 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 address f=
or example.
=20
> > > Can we say that a field id can always be replaced by an offset?
> >
> > Not really. You can use offset to jump around packet fields for sure, b=
ut it is
> going to be
> > hard and cumbersome to calculate all the offsets for that. Field ID is =
much
> more convenient.
>=20
> 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 offsets.
It is possible with this RFC, driver can choose what to use: id and/or offs=
et.