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 E78E8A0A02; Thu, 14 Jan 2021 16:18:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D093714136F; Thu, 14 Jan 2021 16:18:47 +0100 (CET) Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by mails.dpdk.org (Postfix) with ESMTP id 5B5DE141360 for ; Thu, 14 Jan 2021 16:18:46 +0100 (CET) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 14 Jan 2021 07:18:45 -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; Thu, 14 Jan 2021 15:18:40 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.103) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 14 Jan 2021 15:18:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gs13m0ZfWc2EO8QizxjDp4oScTsFM6WT0iDLmRWN4lHV2+g0BcqwRBC3AhQiBKGbzh4R+KePKxlNnok5Tn7OLXr5AoXdF1AV4B/fqhIPdIyicFId5OMNPzr7qpqrdRJ+vpCjxA+W5ZglZkL3nA5Y3uGkEmP+AUuWrIOtT4hoUijwePkfjxBktf6FsE6Pe9NOxYkH6UneRzcUGZQgD4IivbikXkk17yejD/PkOaRt3Vqg/dZlQq7JiF2kIvFsC+ZNiPSGJofx7/kCXoe/NplAZn3bGg29S11l6fw1H31EuLO0DahDtV2M+J9xHMmM+rW/en8nN5UIAoPjXhcMfMY9yg== 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=eVOh7pBA5uKVNArBMMiqOimyVyL6hVdRnC6IlwAQh5M=; b=gwwG7K3IB75GgHlMkKaz1Brea8hb8ZJclDTIvF8v3KLs1q6Y929/DAy6n4nljd6TswJjNoSMszUnxsXISW9y59y8QRh1vdXgV19uZGxUx6LiemI7+7W6Xqxyg2xfUbR16WNJQ6niZNvW48vy45L/QP4jfLaF9oqY54zfpoipLKepq5zU/3kzd7wiJxsFf5L1T2uzvs8qWDUmAkVRycJJ3r1kJTpsKIdC8CTs6Ux3Z7NpvB3IAyQuqxdgNu3Gl0f4gFlJUInKUZv1aigAw/gdFHvE9rk1k50ngNDGytlrse20IwdSmI8+A4Zcm1VZPgd41ItXCxo0seFoWbbFnh4SOw== 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 DM6PR12MB2620.namprd12.prod.outlook.com (2603:10b6:5:42::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.11; Thu, 14 Jan 2021 15:18:39 +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.3763.010; Thu, 14 Jan 2021 15:18:39 +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 v4 2/2] app/testpmd: add support for generic copy rte flow action Thread-Index: AQHW6c6nm2W/4+Kh/kyQqFh3aXK23aonKhQw Date: Thu, 14 Jan 2021 15:18:39 +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: <20210113170751.13044-3-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: 0c1d7882-2115-4ac8-dcfc-08d8b89fabaa x-ms-traffictypediagnostic: DM6PR12MB2620: 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:5236; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DFmOkTrfaskx4hy38J9BvbvujQKXdBTQ9LN9vyGELFw9QoVDAG1chMEBm7Vhk1QZ9OgaVW5eJkYN5pHVLBUZTQ0ST9dKh6BnYO1PFZ9ePV4fwYtk7AlboaSdyj2MRMoCL/2pn6Gc2+gWipQy/Dj34rCWij+dVw9ngIN6zu8w2/ThzAMWoj6lW5e6oBjGoA/LWlOkFc3kud6S1JwDOv/PHCRoe07q/egwq1/Zd8VrPMw+0WP+uIv6hT7qPNZDdZjJrZSIyEDmC2GFbaR1FIP6mAdSc/NDpXx0c8oJDWaofOmUQ/MfZffQqLA+wwH+9KvT5SpivocEFvm6uH+9yQg5zXrhRnc0AggKvPHXE/vazs985FzfEj+Btyt6WgxbE7XH0U+UlRZDLbooHXfA0Pyn1PURU0NbJcYn9Y0fjXBggFKTSjgCOV1/eIkO2v7xOSOb 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)(376002)(366004)(346002)(396003)(39860400002)(136003)(2906002)(6506007)(53546011)(8936002)(54906003)(316002)(86362001)(8676002)(66946007)(110136005)(478600001)(9686003)(55016002)(4326008)(83380400001)(7696005)(5660300002)(76116006)(71200400001)(52536014)(66556008)(66446008)(33656002)(26005)(64756008)(66476007)(186003)(41533002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?nMRn8DFElbl/ywR+7KbTWjBaQ0mfG4xW3OCynTzBYPCH3j+RJXB1mZXVzUMy?= =?us-ascii?Q?GafsbdC6Rhcc4va03Qyahy1tDOsHkRgzbFGpdcZ8CZI4r4eIQJP/BMbU4LRJ?= =?us-ascii?Q?TotUCxzdZczAnNm6Sa1Kwb2J6xYz5hcR2amOn3Z3YMTMVhY7QDojrR+yNXn5?= =?us-ascii?Q?tG0jUzCX93YqBYsie2ua+urkXOrgwQj8/yoB/lEvmFtAhW9RqaFLevRgvo/l?= =?us-ascii?Q?lBEwF/lcETeIYi2iDzK3KFfJaqrWkkQ6csm53siUDtF++dUrqkUGVr3pFLYO?= =?us-ascii?Q?nV9huaXDBKj6iyQYsx8za89H5uLi8C74jES+dfzA+wVSZLbGvvGtRmRtkey3?= =?us-ascii?Q?WxKEvcaRKdA3PIS5QIkUGYmGzWULDbFZEpwf/M+QizfItU7GtWDPeqD2RSuC?= =?us-ascii?Q?fTigOuzH53tyrCO6oRzgIgrXK/0p88mPVyybu6N95yxotkwLvvZyDFF8SSM8?= =?us-ascii?Q?W8LvM28EDT/pkRZGZilSSIqQr9l39XdBueQHHiNkGTCmb0qQDyzZ9Fx0RqLf?= =?us-ascii?Q?a/f9isKndUINBN5bS2YHsz2Okeg5XBJ51R4dMbAHPXiEQuHA/mHM11BlP3d6?= =?us-ascii?Q?6j16JD8GV+mymHTgw+xegMtnXOtjRWMgMp3zxjey8Y+05KbBVqgKEAjDm5Qq?= =?us-ascii?Q?1pNBUSJQgtsZGsZ1K2tXuOUNXecncVuDcNqnuxbBA4yRwm9xAsX+uPUCtH9y?= =?us-ascii?Q?7YH4IvRXB/8h8TS0sH4Dket6RggPOb/oNczYOsy3DCIWTSW3IebGOS33HKpY?= =?us-ascii?Q?Bjy3bP2PYe5cjuRuM+O46e8i3NP58HhUZaXpI+SQAlOrVX90sirTs0uvMH+P?= =?us-ascii?Q?MppzxCa9oE90iJlS7fMURIiY4+IV7vZHIsYh+WWWl+8hmiSDTmMs8OP3zbgE?= =?us-ascii?Q?HcngHOfcPOKjzNRsYuhaJYfQii24Y6h0suCSH6VK8oka5cyQaUkslyN9zfOz?= =?us-ascii?Q?6Kwaxe2xS0iIrGIkT12PmCEAcB3/jbME7VLORurxeNU=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: 0c1d7882-2115-4ac8-dcfc-08d8b89fabaa X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2021 15:18:39.1388 (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: ODZTzCt9h4z9YAdDhr5JttnEwcF19WvTZMnZ+l2elI5fiN+Yn+CrwE9/Lwpk4QBFwKwOGqZuBeTxZfJYJe9oCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2620 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1610637525; bh=eVOh7pBA5uKVNArBMMiqOimyVyL6hVdRnC6IlwAQh5M=; 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=p2rtXv7W9cPj2AZbn+3KTfNia8KQDWJVfmHYCk/Rj0idLBx7gkt72ruWzG9vsXMOR 6StHZCxOGd+Bg7MY5oOynyHCBjcUFm1nqBC+pWVt3+tp7LZ/HVTG+A8+GNlmtYkexF iqHtx6vzVs6LU+JhAiZcih06FSts1F5y5HsGu0p5h5es2+Qpl8f1lbpJPi1ERCUgq9 0cLhR+3I3rSoLFmNrjn6jmVOPmsbz10Llc2J/smulNmNf3kf9Miwsb7B/vRbFVRaHa VuEvjIcdBK+x8kWWTAGIEUfD1kpDygJF2WMIu1d4k+706bHE9zOEZH6GiX6xUt5lki BU1WF2+pLzlAg== 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" Hi > -----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 flo= w > action >=20 > 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. >=20 > 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 >=20 > 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. >=20 > 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. >=20 > Signed-off-by: Alexander Kozyrev > --- > app/test-pmd/cmdline_flow.c | 166 > ++++++++++++++++++++++++++++++++++++ > 1 file changed, 166 insertions(+) >=20 > 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, > }; >=20 > /** 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]; >=20 > +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 >=20 > @@ -1306,6 +1328,7 @@ static const enum index next_action[] =3D { > ACTION_AGE, > ACTION_SAMPLE, > ACTION_SHARED, > + ACTION_COPY_FIELD, > ZERO, > }; >=20 > @@ -1556,6 +1579,20 @@ static const enum index next_action_sample[] =3D { > ZERO, > }; >=20 > +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 sa= me struct both for the src and the dst. What do you think? (see my comment below) > static int parse_set_raw_encap_decap(struct context *, const struct toke= n *, > const char *, unsigned int, > void *, unsigned int); > @@ -1638,6 +1675,10 @@ static int > parse_vc_action_sample_index(struct context *ctx, const struct token *to= ken, > 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); >=20 > /** 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, You are forcing that the first parameter will be the source, what do you th= ink about removing this limitation? > + }, > + [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; > } >=20 > +/** 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; > } >=20 > +/** 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; >=20 > -- > 2.24.1 Acked-by: Ori Kam Best, Ori