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 2BC37A034F; Mon, 11 Oct 2021 11:13:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 14B9D410E5; Mon, 11 Oct 2021 11:13:28 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2076.outbound.protection.outlook.com [40.107.236.76]) by mails.dpdk.org (Postfix) with ESMTP id 49A4B40E0F for ; Mon, 11 Oct 2021 11:13:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EOIc2fvIujYw0Ns2aDodYhJPagAA5Mk1C+9kb/ek3zhnSTMDyeYkD8U4gKgJl8PW+Jn1fLa/LEX0FZ/LCJmS39C3NfTuxmeCXbpqTyZ+5asP/t9jooepD9/Podijdkmh6lBcO8tFBZA7PxV3wrsnAEsO3ddiFvd+zDE3oUuKs21qLTA9pDIqYlbqMgTmwIoN/sb+1TnwtJOn1h/6vGzM8v56f3U1d4AqOB16o5d9lN9ToOPpZhcgysbO1AJ9cUZYxK2Ang8Dr2S5ZUf7Nu9PZifz9+kuTlOgZ7a8Vb4P7+2R8RD505R2FAIJvzDJTaS3IAiw1IS6st11LgE56hOTtA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=S4yVj4MBMyEgAeeEFQKElZkACUQhCXCXZAje63GlSZw=; b=f02zd+8n6LMmNar/uTuZrMCtvtz3Un4SGQenooqm48jvjaDuT5mrR1Lm3PcGY6PnQBLMk2MjphvURFpW2hNXz7ERTwawgn4U9yLfZ//z9FP7fwBoFSEjeMQAcwKwxNU9yKaN6STYzsbcZPWtgCz5qqzW1Gihw/2CrzkCvbgyOTItgS6QKqgu+89W/v1KXIJV6OI0eaSyytCzsfV23fK67rz1RH05koiqlQk0bMBL85J8dpdS3q+Mo1kLR+r6JGIrUB0wXrffe94n8BBUSUh8b6H2nL45KZGGeiiddVG4XWYd3d/jbCoP6iLR3D7oll6rJGqW7gHodpYIgT/cFCpNGA== 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=S4yVj4MBMyEgAeeEFQKElZkACUQhCXCXZAje63GlSZw=; b=iMuFTZs/7FHg+cKM1Ej+VqQmxIZ2huzwhynlX/r4VzTBNO0LKRRJAsOQnXmkUxsXSga1DB1Xa9pxs/mOTvEXwqq19GrZofYHfvlMX3VU+apHwXwQMRfm3QWsIkR1EEVp6ptl4vdvzEwk1uq8+Ju2l202VMFOeN+d6i+zzqZY36muiTW48KcO15QYVQeBfCSjAlCPefaxCZLYmwfl1bQv+hV3iYEWA2lgP7gwd8ktvA4L0gmm67c9DGmy8YfWdJHHTrQKjU8/1hwv/XTcHpjSXgxx7c840CVVr1RSet8g1EBoMH4UlFrS5jMVGWpyelT2nZRA9QqS1n55JJ71ncmwzQ== Received: from DM8PR12MB5400.namprd12.prod.outlook.com (2603:10b6:8:3b::12) by DM4PR12MB5344.namprd12.prod.outlook.com (2603:10b6:5:39f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.22; Mon, 11 Oct 2021 09:13:26 +0000 Received: from DM8PR12MB5400.namprd12.prod.outlook.com ([fe80::d03d:1f75:ca20:6a32]) by DM8PR12MB5400.namprd12.prod.outlook.com ([fe80::d03d:1f75:ca20:6a32%6]) with mapi id 15.20.4587.026; Mon, 11 Oct 2021 09:13:26 +0000 From: Ori Kam To: Slava Ovsiienko , "dev@dpdk.org" CC: Raslan Darawsheh , Matan Azrad , Shahaf Shuler , Gregory Etelson , NBU-Contact-Thomas Monjalon Thread-Topic: [PATCH v2 2/5] app/testpmd: update modify field flow action support Thread-Index: AQHXvjEGkYupmG/oAEiqIy71xznPWKvNZY7g Date: Mon, 11 Oct 2021 09:13:26 +0000 Message-ID: References: <20210910141609.8410-1-viacheslavo@nvidia.com> <20211010234547.1495-1-viacheslavo@nvidia.com> <20211010234547.1495-3-viacheslavo@nvidia.com> In-Reply-To: <20211010234547.1495-3-viacheslavo@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-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 55308db7-c9cb-418b-456e-08d98c976211 x-ms-traffictypediagnostic: DM4PR12MB5344: 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:4714; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uX54xlVqqOwKYpqTvfWd5NkRfHNq4m39nNZZN7OzqFHszPexsQYn0bc+7pB/YF2qrRgRIbCDTD+i6V53LiCQV+9FCNC5uUPxqIN5EgsuIoLWk3TkcgpAueWbFZ+XCDmv7C2tN7vkgTrhk8GQcqDS4ZnsYRuyhMvShfJyXmX0qhkIAdiq9rZyH0owJPaktiB7CGM1j7gZKO4D9L8KI702EhgyGh6GarNEkNCH4ZPqyxHXY3KGWxveOA3HalQitkC7Ifc1ncPHXRNW9wTImot/ngElAN/Qm4sbqaXEqv2Kfb5nBUWe12y/rRRLpPmqx+qnQGE7U7TbT5E9ak8El1uyptfQiqEElZQc0o6edfZkHpiqwCm/BVVGw+QcPUKX9KKvxaV8t1kz4GszjIrLM6MZnunCgifEZfKUUS8UaZvq5uKS0xREltLE2otknrQn6+peSZWIfQhumhQHF1JE7hsv152uhrP60SZJOPNcAcmmPvBmUwiEbGqm9IsJvwWAQI3OFyf3NKrnHhF5zzTt7vufl/BA3XDDO0JidK+9g3fqFNuxtJ5ribYsNiLGxIU+sT/YfDrDvVHhPkwl44s2CvOsFfpc/nfQCdD26DnXoZ+9+2AmG1AnFQksPDNwgZHMS7dHuZG4zAHvJIYKwVontya8SvX7kJEF96Xp9jqdGv6vbxWW745/IqWPQyD0yqxjX6IHBtoDLPikt9WbqZqgCagdXw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR12MB5400.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(76116006)(64756008)(66446008)(316002)(4326008)(38100700002)(508600001)(66556008)(110136005)(66946007)(66476007)(15650500001)(122000001)(6506007)(7696005)(2906002)(53546011)(186003)(38070700005)(26005)(83380400001)(5660300002)(8936002)(71200400001)(86362001)(8676002)(9686003)(55016002)(54906003)(33656002)(52536014); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ADVJ8Qe3kXgGss1tZksufgMWwcYjOZt4ACNcNSaRBhTFot9ztDU52P+zDspJ?= =?us-ascii?Q?6lj/sSiRpsoMLzuGYMhDxtYXEi+rj05Jy6hVdxP1DsYk2yIsjFz/wUMY/fq2?= =?us-ascii?Q?sh5PbIwDpmUIiJioD6Q1S8TEgtQ+Ha/v3Wu+d4Y68H4X9EsBCrc9zE+CNdBs?= =?us-ascii?Q?dehDNAL00AfsN/u7zIn68PaDJjBXMusN/JBdEjLlJ77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/7q5VXkE8iLNw7nO4qxrhiIkLKVG4+G29p?= =?us-ascii?Q?ZJyEVkth16tuM2iN8198c7pFHx+Y2fKdLoWY1RsYDGcd0TyYy9RZIP2XANXP?= =?us-ascii?Q?mKm8+fPSarq1lxOISwhaCkVNDVodNr70MgKvAYCi55HB3FoDfti/Rff0MOTG?= =?us-ascii?Q?EAVV1A9Ymux7pJt9r0JnmDfXZCyjZYqc3vXtWpNX8pbl2cPUh165WMi7xp+2?= =?us-ascii?Q?kpzQRqidacmXDc3AuIuQBczk?= 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: DM8PR12MB5400.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55308db7-c9cb-418b-456e-08d98c976211 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2021 09:13:26.1934 (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: HMan06MfsXUmqa2NC9EDsejqNO2Zl9ZaoT2uXvV46wkxWWP493dplSJHuBPJc77lepU5gBhaQKkbD4+JiSRLBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5344 Subject: Re: [dpdk-dev] [PATCH v2 2/5] app/testpmd: update modify field flow action support 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 Slava, > -----Original Message----- > From: Slava Ovsiienko > Sent: Monday, October 11, 2021 2:46 AM > Subject: [PATCH v2 2/5] app/testpmd: update modify field flow action supp= ort >=20 > The testpmd flow create command updates provided: >=20 > - modify field action supports the updated actions > - pointer type added for action source field > - pointer and value source field takes hex string > instead of unsigned int in host endianness >=20 > There are some examples of flow with update modified field action: >=20 > 1. IPv6 destination address bytes 4-7 assignment: > 0000::1111 - > 0000:xxxx:4455:6677::1111 >=20 > flow create 0 egress group 1 > pattern eth / ipv6 dst is 0000::1111 / udp / end > actions modify_field op set > dst_type ipv6_dst > dst_offset 32 > src_type value > src_value 0011223344556677 > width 32 / end >=20 > 2. Copy second byte of IPv4 destination address to the > third byte of source address: > 10.0.118.4 -> 192.168.100.1 > 10.0.168.4 -> 192.168.100.1 >=20 > flow create 0 egress group 1 > pattern eth / ipv4 / udp / end > actions modify_field op set > dst_type ipv4_src > dst_offset 16 > src_type ipv4_dst > src_offset 8 > width 8 / end >=20 > 3. Assign METADATA value with 11223344 value from the > hex string in the linear buffer. Please note, the value > definition should follow host-endian, example is given > for x86 (little-endian): >=20 > flow create 0 egress group 1 > pattern eth / ipv4 / end > actions modify_field op set > dst_type meta > src_type pointer > src_ptr 44332211 > width 32 / end >=20 > 4. Assign destination MAC with EA:11:0B:AD:0B:ED value: >=20 > flow create 0 egress group 1 > pattern eth / end > actions modify_field op set > dst_type mac_dst > src_type value > src_value EA110BAD0BED > width 48 / end >=20 > Signed-off-by: Viacheslav Ovsiienko > --- > app/test-pmd/cmdline_flow.c | 55 +++++++++++++++++++++++++------------ > 1 file changed, 38 insertions(+), 17 deletions(-) >=20 > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c in= dex > bb22294dd3..736029c4fd 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -448,6 +448,7 @@ enum index { > ACTION_MODIFY_FIELD_SRC_LEVEL, > ACTION_MODIFY_FIELD_SRC_OFFSET, > ACTION_MODIFY_FIELD_SRC_VALUE, > + ACTION_MODIFY_FIELD_SRC_POINTER, > ACTION_MODIFY_FIELD_WIDTH, > ACTION_CONNTRACK, > ACTION_CONNTRACK_UPDATE, > @@ -468,6 +469,14 @@ enum index { > #define ITEM_RAW_SIZE \ > (sizeof(struct rte_flow_item_raw) + ITEM_RAW_PATTERN_SIZE) >=20 > +/** Maximum size for external pattern in struct > +rte_flow_action_modify_data. */ #define ACTION_MODIFY_PATTERN_SIZE 32 > + > +/** Storage size for struct rte_flow_action_modify_field including > +pattern. */ #define ACTION_MODIFY_SIZE \ > + (sizeof(struct rte_flow_action_modify_field) + \ > + ACTION_MODIFY_PATTERN_SIZE) > + > /** Maximum number of queue indices in struct rte_flow_action_rss. */ #= define > ACTION_RSS_QUEUE_NUM 128 >=20 > @@ -1704,6 +1713,7 @@ static const enum index action_modify_field_src[] = =3D { > ACTION_MODIFY_FIELD_SRC_LEVEL, > ACTION_MODIFY_FIELD_SRC_OFFSET, > ACTION_MODIFY_FIELD_SRC_VALUE, > + ACTION_MODIFY_FIELD_SRC_POINTER, > ACTION_MODIFY_FIELD_WIDTH, > ZERO, > }; > @@ -4455,8 +4465,7 @@ static const struct token token_list[] =3D { > [ACTION_MODIFY_FIELD] =3D { > .name =3D "modify_field", > .help =3D "modify destination field with data from source field", > - .priv =3D PRIV_ACTION(MODIFY_FIELD, > - sizeof(struct rte_flow_action_modify_field)), > + .priv =3D PRIV_ACTION(MODIFY_FIELD, ACTION_MODIFY_SIZE), > .next =3D NEXT(NEXT_ENTRY(ACTION_MODIFY_FIELD_OP)), > .call =3D parse_vc, > }, > @@ -4539,11 +4548,26 @@ static const struct token token_list[] =3D { > .name =3D "src_value", > .help =3D "source immediate value", > .next =3D NEXT(NEXT_ENTRY(ACTION_MODIFY_FIELD_WIDTH), > - NEXT_ENTRY(COMMON_UNSIGNED)), > - .args =3D ARGS(ARGS_ENTRY(struct rte_flow_action_modify_field, > + NEXT_ENTRY(COMMON_HEX)), > + .args =3D ARGS(ARGS_ENTRY_ARB(0, 0), > + ARGS_ENTRY_ARB(0, 0), > + ARGS_ENTRY(struct rte_flow_action_modify_field, > src.value)), > .call =3D parse_vc_conf, > }, > + [ACTION_MODIFY_FIELD_SRC_POINTER] =3D { > + .name =3D "src_ptr", > + .help =3D "pointer to source immediate value", > + .next =3D NEXT(NEXT_ENTRY(ACTION_MODIFY_FIELD_WIDTH), > + NEXT_ENTRY(COMMON_HEX)), > + .args =3D ARGS(ARGS_ENTRY(struct rte_flow_action_modify_field, > + src.pvalue), > + ARGS_ENTRY_ARB(0, 0), > + ARGS_ENTRY_ARB > + (sizeof(struct rte_flow_action_modify_field), > + ACTION_MODIFY_PATTERN_SIZE)), > + .call =3D parse_vc_conf, > + }, > [ACTION_MODIFY_FIELD_WIDTH] =3D { > .name =3D "width", > .help =3D "number of bits to copy", > @@ -7830,15 +7854,11 @@ static int > comp_set_modify_field_op(struct context *ctx, const struct token *token, > unsigned int ent, char *buf, unsigned int size) { > - uint16_t idx =3D 0; > - > RTE_SET_USED(ctx); > RTE_SET_USED(token); > - for (idx =3D 0; modify_field_ops[idx]; ++idx) > - ; > if (!buf) > - return idx + 1; > - if (ent < idx) > + return RTE_DIM(modify_field_ops); > + if (ent < RTE_DIM(modify_field_ops) - 1) > return strlcpy(buf, modify_field_ops[ent], size); > return -1; > } > @@ -7848,16 +7868,17 @@ static int > comp_set_modify_field_id(struct context *ctx, const struct token *token, > unsigned int ent, char *buf, unsigned int size) { > - uint16_t idx =3D 0; > + const char *name; >=20 > - RTE_SET_USED(ctx); > RTE_SET_USED(token); > - for (idx =3D 0; modify_field_ids[idx]; ++idx) > - ; > if (!buf) > - return idx + 1; > - if (ent < idx) > - return strlcpy(buf, modify_field_ids[ent], size); > + return RTE_DIM(modify_field_ids); > + if (ent >=3D RTE_DIM(modify_field_ids) - 1) > + return -1; > + name =3D modify_field_ids[ent]; > + if (ctx->curr =3D=3D ACTION_MODIFY_FIELD_SRC_TYPE || > + (strcmp(name, "pointer") && strcmp(name, "value"))) > + return strlcpy(buf, name, size); > return -1; > } >=20 > -- > 2.18.1 Acked-by: Ori Kam Thanks, Ori