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 461E5A0A04; Fri, 15 Jan 2021 16:37:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F6CD14115F; Fri, 15 Jan 2021 16:37:23 +0100 (CET) Received: from nat-hk.nvidia.com (nat-hk.nvidia.com [203.18.50.4]) by mails.dpdk.org (Postfix) with ESMTP id B09DE14113F for ; Fri, 15 Jan 2021 16:37:21 +0100 (CET) Received: from HKMAIL103.nvidia.com (Not Verified[10.18.92.9]) by nat-hk.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Fri, 15 Jan 2021 23:37:20 +0800 Received: from HKMAIL101.nvidia.com (10.18.16.10) by HKMAIL103.nvidia.com (10.18.16.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 15 Jan 2021 15:37:15 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.172) by HKMAIL101.nvidia.com (10.18.16.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 15 Jan 2021 15:37:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S7HRth5DgTlEtKLMGhYKvGkHcK53bfX9TQcaC3hm9DdkU00wdWOrzNczr49u1yh8enwL6kGUjK7eeth0r4VFYp+Vx+O0XmiBKm9Mi/qfLurqgLwngsR//DO8XRAFeBMmzUKRmhaAxGJWA5XlycVipJnIz6ijZ11lYu4S49a0sufdA+hhMlgCQ1Vp7c+yM8Xn+Ju3LcKY1NUnLEiq9iy24yl3XZlEkwc1b2xwuoV07bA+c6F7uwjRnUYQyEklb6GMlG/cSMTL9eXTXVfr6Lu9irk2YWrCjkMNAoFwVPinHONgIgDexZcdJus09fzIwevP54oyxppOjhtCb7qXuztIzg== 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=Vt06XVpeihevhCBzOP3RPhHFNLQc0lc00X0QzdrY2FM=; b=dnHXPsFxvqL+bWm793DWaMt0K2kOHnH8LP5ahRDIVEefZQQzdmMT77+QJkk2dinitbf8QgcwC0rCXOwK3SifpXW53OOHAVXxJeRKczpu8gLYFxiVrFq9aR2SXVqBSO0U/JBbPqlYVnfG0gPZGNeTnQZ/mLE4juQCYnCyyCz+TkXEaA+WvQwCbE79UwPRicL8JR0Ao+aAE99h/GyjDeV9gJmL78ojGGaobYATBZuplKEHHthvug50238hkw0zY+4X/jGUAUdUZwbcrppMwtSqoMzLbj1GHo+fC7S6FCC9oYskgOoEwQTcGBcHJqAPGzWMpPR6tRyLbqc4ytbfcy33wA== 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 BN6PR1201MB2467.namprd12.prod.outlook.com (2603:10b6:404:a7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Fri, 15 Jan 2021 15:37:12 +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.012; Fri, 15 Jan 2021 15:37:12 +0000 From: Alexander Kozyrev To: Ori Kam , "dev@dpdk.org" CC: Slava Ovsiienko , NBU-Contact-Thomas Monjalon , "ferruh.yigit@intel.com" , "andrew.rybchenko@oktetlabs.ru" Thread-Topic: [PATCH v4 2/2] app/testpmd: add support for generic copy rte flow action Thread-Index: AQHW6oiJkGDN9oJt8ESuIMnww1favqoo0nGA Date: Fri, 15 Jan 2021 15:37:12 +0000 Message-ID: References: <20210113033854.11827-1-akozyrev@nvidia.com> <20210113170751.13044-1-akozyrev@nvidia.com> <20210113170751.13044-3-akozyrev@nvidia.com> In-Reply-To: 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:5e4:afb7:251b:4e84] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8f5b9767-7e47-4b70-fa82-08d8b96b6da9 x-ms-traffictypediagnostic: BN6PR1201MB2467: 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:5797; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WggTfsrgRtSPWRVL/R7fPVdjkIAXSJrib9JL92t620jxfM0Jgfy9tR3ChjwGa4+zzbBXnMSjrCNJb8FPyg6UbwE6h32WPZIGEawB3Ya95VKST7ohvg8QoElouFv2jJDIqfOca/Nxo+wCZ9DyHifcBJlrNhYdWZA2cHCO694YwlU8ToMnaNQ5h7zlJcF05eNDWxSEMFwCqzk8zAp+nE26021qS+6QsLGkBJ1GYJSMsDlAXQ1YBCp+iuRUbs3ETpOcnlLMeIrbU20En/t5TjOmHEi02rbYXDs3GSExay5sRgVBddVL2YHoSWJtAqApRaqpVe3uewS4/DeU9pXWpGfI3cH4ASXerxMHyU6cVr7s30WZagQnrVMwNQmspVVJNpEMddeqak9wr8QnEXWlNhl1k6nfJGOQ/cKpLZG2Rma3r5I0wbHNZhTXCRxV9241+thT 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)(136003)(376002)(346002)(39860400002)(366004)(396003)(5660300002)(54906003)(76116006)(33656002)(66446008)(66946007)(71200400001)(66556008)(110136005)(9686003)(6506007)(4326008)(316002)(8676002)(83380400001)(55016002)(64756008)(2906002)(478600001)(186003)(66476007)(7696005)(8936002)(53546011)(86362001)(30864003)(52536014)(41533002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?22uZtEJHUMl1LaR8FTyvx5rOwvyXalJdFeaWFq8mMHZsmi8HWhcjSzQyJhqK?= =?us-ascii?Q?gfUum94hB0xpqst7pBztBiQfraBOncyuAtQvzGkzikrOSs3H7VW4RWvpDqCt?= =?us-ascii?Q?85rhhcEIWBzEyxbrfnxpJXVwWkX4hyK5WTyMAZhes8IGSyvazQFcywVlQS3w?= =?us-ascii?Q?AI3XLUHXlww6tuFrOK5XjdP5zkDgfTVEWPYDI2ve2mOEcThC3qsnKs89qSsJ?= =?us-ascii?Q?qb3xzCo3XRT6ypxAiWNgMYtIZirUqEpQx71g6cxNYAjZAUQaiIyv+Lu2aWxV?= =?us-ascii?Q?vx/ONyAVYUINYtTI04xgKh+mPtx5LIZ6K+YOVspbcYPwTnUFae46gQp0FBma?= =?us-ascii?Q?ELl9dAfQtop99jgdCHir34nccDzAoA0wIAwOA5au7Gish2I70bSXsQXXYVQ1?= =?us-ascii?Q?mbyN26yZY4SbwfzNinWR9hPpYG+SjgiGx61pKHzBBSUtzQH7+x92V1FFVKVJ?= =?us-ascii?Q?FTVbTiBxxrJoYGC14Ibn/UpVF4cLZLvAodQHLn5D28lM1Rs3KhIy3O2InS1S?= =?us-ascii?Q?H3k2FZYGjwFXGZemwB/SO7CMHG00ZGeY6SqO5mVj2r9K7eQ76a0MfcquyxjM?= =?us-ascii?Q?mni/1k5eQ6wLd0sjRDEcahnCSPbhEtC3HOpg9f8XAj49PxRefDtXbgsdZDQX?= =?us-ascii?Q?XzMZuPgCodm8IEUNicGLIn8/jie5xxP/opbo0UMdarLGZsT5goTaJk5uOaEt?= =?us-ascii?Q?KhQ497fp4WBKq9qJhLoRjZZ/BllPX0ltHIh4oI+RXfZR9F4CKInKM4pBf5qd?= =?us-ascii?Q?Z0a4WTEE4dIcgDk0VKA4hnDAhv5U+Rt4XllaBMSVHOSPh4YgyBdgmX842pS/?= =?us-ascii?Q?j7s0CPImWimVa+K/Vu6ExeYvTdGbCwbYnbMUP01aR5o6wbRVyBk+eyFuBrck?= =?us-ascii?Q?UdlL0B5WfmTz+3D9zxPlbr0V6/y+rg2jdBwZh/0WFtCbT7hHIZWUmWdXz0e+?= =?us-ascii?Q?y865XHiL5rUlWsNCN0gFRCkrzGFV8leqemcwAKv6GvPfI8fUHLl5YzvcEbSO?= =?us-ascii?Q?k3BxB27DO1c5HkBt0xG4kMZfMdZ4jNmV07hjbw8Dk5Ng9Ng=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: 8f5b9767-7e47-4b70-fa82-08d8b96b6da9 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2021 15:37:12.4481 (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: 6mzNF9GC3i7IwJVZFnUDV8De3ff+j29Cy3D7b896IQT3Qudjw8j0n9sMlj6P3LXtbjBfiUeakiMtRar5CVYRKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB2467 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1610725040; bh=Vt06XVpeihevhCBzOP3RPhHFNLQc0lc00X0QzdrY2FM=; 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=Bg2vl4njkDnzVjXvJj/QXClCt4M8rHAWGRl/KSpBfTOtbrHY20yLZKUKUiskFXpkX AXzF7+Fs1EgLDrMAm+RaJRG3CJCY+WCog5gzruy6T82yatMqpjTxmh0qVaAkvkVqAB kvaItoIKEBHRzKb3BbZEDkRjbE4GfmL4MWEhByT2iqAfOiSYasy5pBnKUEwdDEjjnG UJ8R+dI8w80BQnuGMwhBvxOorFS0AC7yut28h4Pqq8IyiTnc6CEkvTmj5jm1u3y8/C KTm1jcqQ0oR3l4R3xIVOSmFfSoIKIQAXCJuoCVCoGng9JlbGxtRHmMtpN44wHiMNXQ utRAm9z4ELJ+Q== Subject: Re: [dpdk-dev] [PATCH v4 2/2] app/testpmd: add support for 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" > From: Ori Kam on Thursday, January 14, 2021 10:19 > Subject: RE: [PATCH v4 2/2] app/testpmd: add support for generic copy rte > flow action >=20 > Hi >=20 > > -----Original Message----- > > From: Alexander Kozyrev > > Sent: Wednesday, January 13, 2021 7:08 PM > > Subject: [PATCH v4 2/2] app/testpmd: add support for generic copy rte > flow > > action > > > > Add support for the RTE_FLOW_ACTION_COPY_FIELD to the testpmd. > > Implement CLI to create the copy_field action and supply all the > > needed parameters to copy an arbitrary packet field (as well as > > mark, tag or metadata) into another field. > > > > Example of the flow is the following: > > flow create 0 egress group 1 pattern eth / ipv4 / udp / end > > actions copy_field dst_type tag dst_level 0 dst_offset 8 > > src_type gtp_teid src_level 0 src_offset 0 width 32 / end > > > > This flow copies 32 bits from the first Tag in the Tags array > > into the outermost GTP TEID packet header field. 8 bits of the > > Tag are skipped as indicated by the dst_offset action parameter. > > > > dst_type and src_type are the only mandatory parameters to > > specify. Levels and offset are 0 by default if they are not > > overridden by a user. The width parameter gets the smallest width > > from the source and destination sizes if it is not specified. > > > > Signed-off-by: Alexander Kozyrev > > --- > > app/test-pmd/cmdline_flow.c | 166 > > ++++++++++++++++++++++++++++++++++++ > > 1 file changed, 166 insertions(+) > > > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > > index 585cab98b4..115d4772f9 100644 > > --- a/app/test-pmd/cmdline_flow.c > > +++ b/app/test-pmd/cmdline_flow.c > > @@ -408,6 +408,16 @@ enum index { > > ACTION_SAMPLE_INDEX_VALUE, > > ACTION_SHARED, > > SHARED_ACTION_ID2PTR, > > + ACTION_COPY_FIELD, > > + ACTION_COPY_FIELD_DST_TYPE, > > + ACTION_COPY_FIELD_DST_TYPE_VALUE, > > + ACTION_COPY_FIELD_DST_LEVEL, > > + ACTION_COPY_FIELD_DST_OFFSET, > > + ACTION_COPY_FIELD_SRC_TYPE, > > + ACTION_COPY_FIELD_SRC_TYPE_VALUE, > > + ACTION_COPY_FIELD_SRC_LEVEL, > > + ACTION_COPY_FIELD_SRC_OFFSET, > > + ACTION_COPY_FIELD_WIDTH, > > }; > > > > /** Maximum size for pattern in struct rte_flow_item_raw. */ > > @@ -561,6 +571,18 @@ struct rte_flow_action_count > > sample_count[RAW_SAMPLE_CONFS_MAX_NUM]; > > struct rte_flow_action_port_id > > sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM]; > > struct rte_flow_action_raw_encap > > sample_encap[RAW_SAMPLE_CONFS_MAX_NUM]; > > > > +static const char *const copy_field_table[] =3D { > > + "start", "mac_dst", "mac_src", > > + "vlan_type", "vlan_id", "mac_type", > > + "ipv4_dscp", "ipv4_ttl", "ipv4_src", "ipv4_dst", > > + "ipv6_hoplimit", "ipv6_src", "ipv6_dst", > > + "tcp_port_src", "tcp_port_dst", > > + "tcp_seq_num", "tcp_ack_num", "tcp_flags", > > + "udp_port_src", "udp_port_dst", > > + "vxlan_vni", "geneve_vni", "gtp_teid", > > + "tag", "mark", "meta", NULL > > +}; > > + > > /** Maximum number of subsequent tokens and arguments on the stack. > */ > > #define CTX_STACK_SIZE 16 > > > > @@ -1306,6 +1328,7 @@ static const enum index next_action[] =3D { > > ACTION_AGE, > > ACTION_SAMPLE, > > ACTION_SHARED, > > + ACTION_COPY_FIELD, > > ZERO, > > }; > > > > @@ -1556,6 +1579,20 @@ static const enum index next_action_sample[] =3D > { > > ZERO, > > }; > > > > +static const enum index action_copy_field_dst[] =3D { > > + ACTION_COPY_FIELD_DST_LEVEL, > > + ACTION_COPY_FIELD_DST_OFFSET, > > + ACTION_COPY_FIELD_SRC_TYPE, > > + ZERO, > > +}; > > + > > +static const enum index action_copy_field_src[] =3D { > > + ACTION_COPY_FIELD_SRC_LEVEL, > > + ACTION_COPY_FIELD_SRC_OFFSET, > > + ACTION_COPY_FIELD_WIDTH, > > + ZERO, > > +}; > > + > I think if we remove the order of actions then it is possible to use the = same > struct > both for the src and the dst. What do you think? (see my comment below) This is done intentionally so user can get away without specifying all the = mandatory parameters. That saves us a trouble to validate if they are present or not = later. > > static int parse_set_raw_encap_decap(struct context *, const struct to= ken > *, > > const char *, unsigned int, > > void *, unsigned int); > > @@ -1638,6 +1675,10 @@ static int > > parse_vc_action_sample_index(struct context *ctx, const struct token > *token, > > const char *str, unsigned int len, void *buf, > > unsigned int size); > > +static int > > +parse_vc_copy_field(struct context *ctx, const struct token *token, > > + const char *str, unsigned int len, void *buf, > > + unsigned int size); > > static int parse_destroy(struct context *, const struct token *, > > const char *, unsigned int, > > void *, unsigned int); > > @@ -1722,6 +1763,8 @@ static int comp_set_raw_index(struct context *, > > const struct token *, > > unsigned int, char *, unsigned int); > > static int comp_set_sample_index(struct context *, const struct token = *, > > unsigned int, char *, unsigned int); > > +static int comp_set_copy_field(struct context *, const struct token *, > > + unsigned int, char *, unsigned int); > > > > /** Token definitions. */ > > static const struct token token_list[] =3D { > > @@ -4037,6 +4080,81 @@ static const struct token token_list[] =3D { > > .call =3D parse_vc_action_raw_decap_index, > > .comp =3D comp_set_raw_index, > > }, > > + [ACTION_COPY_FIELD] =3D { > > + .name =3D "copy_field", > > + .help =3D "copy data from destination field to source field", > > + .priv =3D PRIV_ACTION(COPY_FIELD, > > + sizeof(struct rte_flow_action_copy_field)), > > + .next =3D > NEXT(NEXT_ENTRY(ACTION_COPY_FIELD_DST_TYPE)), > > + .call =3D parse_vc, >=20 > You are forcing that the first parameter will be the source, what do you = think > about > removing this limitation? I'm forcing the first parameter to be the destination, then the source, the= n the width. This way I can be sure that all of them are specified when the flow is crea= ted. >=20 > > + }, > > + [ACTION_COPY_FIELD_DST_TYPE] =3D { > > + .name =3D "dst_type", > > + .help =3D "destination field type", > > + .next =3D NEXT(action_copy_field_dst, > > + > > NEXT_ENTRY(ACTION_COPY_FIELD_DST_TYPE_VALUE)), > > + .call =3D parse_vc_conf, > > + }, > > + [ACTION_COPY_FIELD_DST_TYPE_VALUE] =3D { > > + .name =3D "{type}", > > + .help =3D "destination field type value", > > + .call =3D parse_vc_copy_field, > > + .comp =3D comp_set_copy_field, > > + }, > > + [ACTION_COPY_FIELD_DST_LEVEL] =3D { > > + .name =3D "dst_level", > > + .help =3D "destination field level", > > + .next =3D NEXT(action_copy_field_dst, > NEXT_ENTRY(UNSIGNED)), > > + .args =3D ARGS(ARGS_ENTRY(struct > rte_flow_action_copy_field, > > + dst.level)), > > + .call =3D parse_vc_conf, > > + }, > > + [ACTION_COPY_FIELD_DST_OFFSET] =3D { > > + .name =3D "dst_offset", > > + .help =3D "destination field bit offset", > > + .next =3D NEXT(action_copy_field_dst, > NEXT_ENTRY(UNSIGNED)), > > + .args =3D ARGS(ARGS_ENTRY(struct > rte_flow_action_copy_field, > > + dst.offset)), > > + .call =3D parse_vc_conf, > > + }, > > + [ACTION_COPY_FIELD_SRC_TYPE] =3D { > > + .name =3D "src_type", > > + .help =3D "source field type", > > + .next =3D NEXT(action_copy_field_src, > > + > > NEXT_ENTRY(ACTION_COPY_FIELD_SRC_TYPE_VALUE)), > > + .call =3D parse_vc_conf, > > + }, > > + [ACTION_COPY_FIELD_SRC_TYPE_VALUE] =3D { > > + .name =3D "{type}", > > + .help =3D "source field type value", > > + .call =3D parse_vc_copy_field, > > + .comp =3D comp_set_copy_field, > > + }, > > + [ACTION_COPY_FIELD_SRC_LEVEL] =3D { > > + .name =3D "src_level", > > + .help =3D "source field level", > > + .next =3D NEXT(action_copy_field_src, > NEXT_ENTRY(UNSIGNED)), > > + .args =3D ARGS(ARGS_ENTRY(struct > rte_flow_action_copy_field, > > + src.level)), > > + .call =3D parse_vc_conf, > > + }, > > + [ACTION_COPY_FIELD_SRC_OFFSET] =3D { > > + .name =3D "src_offset", > > + .help =3D "source field bit offset", > > + .next =3D NEXT(action_copy_field_src, > NEXT_ENTRY(UNSIGNED)), > > + .args =3D ARGS(ARGS_ENTRY(struct > rte_flow_action_copy_field, > > + src.offset)), > > + .call =3D parse_vc_conf, > > + }, > > + [ACTION_COPY_FIELD_WIDTH] =3D { > > + .name =3D "width", > > + .help =3D "number of bits to copy", > > + .next =3D NEXT(NEXT_ENTRY(ACTION_NEXT), > > + NEXT_ENTRY(UNSIGNED)), > > + .args =3D ARGS(ARGS_ENTRY(struct > rte_flow_action_copy_field, > > + width)), > > + .call =3D parse_vc_conf, > > + }, > > /* Top level command. */ > > [SET] =3D { > > .name =3D "set", > > @@ -5960,6 +6078,36 @@ parse_vc_action_sample_index(struct context > *ctx, > > const struct token *token, > > return len; > > } > > > > +/** Parse tokens for copy_field command. */ > > +static int > > +parse_vc_copy_field(struct context *ctx, const struct token *token, > > + const char *str, unsigned int len, void *buf, > > + unsigned int size) > > +{ > > + struct rte_flow_action_copy_field *action_copy_field; > > + unsigned int i; > > + > > + (void)token; > > + (void)buf; > > + (void)size; > > + if (ctx->curr !=3D ACTION_COPY_FIELD_DST_TYPE_VALUE && > > + ctx->curr !=3D ACTION_COPY_FIELD_SRC_TYPE_VALUE) > > + return -1; > > + for (i =3D 0; copy_field_table[i]; ++i) > > + if (!strcmp_partial(copy_field_table[i], str, len)) > > + break; > > + if (!copy_field_table[i]) > > + return -1; > > + if (!ctx->object) > > + return len; > > + action_copy_field =3D ctx->object; > > + if (ctx->curr =3D=3D ACTION_COPY_FIELD_DST_TYPE_VALUE) > > + action_copy_field->dst.field =3D (enum rte_flow_field_id)i; > > + else > > + action_copy_field->src.field =3D (enum rte_flow_field_id)i; > > + return len; > > +} > > + > > /** Parse tokens for destroy command. */ > > static int > > parse_destroy(struct context *ctx, const struct token *token, > > @@ -7029,6 +7177,24 @@ comp_set_sample_index(struct context *ctx, > const > > struct token *token, > > return nb; > > } > > > > +/** Complete field type for copy_field command. */ > > +static int > > +comp_set_copy_field(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; copy_field_table[idx]; ++idx) > > + ; > > + if (!buf) > > + return idx + 1; > > + if (ent < idx) > > + return strlcpy(buf, copy_field_table[ent], size); > > + return -1; > > +} > > + > > /** Internal context. */ > > static struct context cmd_flow_context; > > > > -- > > 2.24.1 >=20 >=20 > Acked-by: Ori Kam > Best, > Ori