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 388FBA00BE; Fri, 11 Feb 2022 11:10:10 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 280914272F; Fri, 11 Feb 2022 11:10:10 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2057.outbound.protection.outlook.com [40.107.237.57]) by mails.dpdk.org (Postfix) with ESMTP id 8B5EB4272A for ; Fri, 11 Feb 2022 11:10:09 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E6f0j9VFtNudWRvbPHaLQybY2R+FfmiSvN42oD6V5Yr69OFgiQUHoh6ClI//hMQPn0vlvgwXCuJXHHjyIMhJxtYkqr9EKR02pwtmzAoMoWlhCokTAGrYirwelpjwHuYofNFfHLZSFyMMBCQeVbgppaHU7Nb9/l9mKR3Fn3Ee0tsKaefYbpdZjPfjIIgudWjHtyz7clY7QYO0mfSAOlN4n9C9xzPkk2XuN2IoQp54hUmLx0CBnxdndhXtHon0ZondWivzncc14D/x4ApaPrpOc6IXaTvcjSnVNGJEnSHFvmqjpoWNGlhSqT4JWWfVuDhxZKdKx6NOAFDOJOLBgbwgUg== 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=vo4S0sxqN90X+9HF9ZiLtgxtDY4wHZIT8K+XMh+QUWU=; b=CFy4QU8UgcHa740eJmMzqlmeAsrXk7WRMLQ9th9CUVEpyUZnCJjgnLFJGDnEFuIf5Cll3lxXBglkWUfcxvhrMavHs/XiDXTRJglMBFihSupj4jsPD/QkRNnTZDMc6QrV8ILgGVo2AU3yKlGSu1vDpoCS71AnH1YC+7V8XIS2L4XWXcxGQBmcidG+AwIB0NcTDmNb3cq6760ys2zHPtEV5J3X4JwoH0fOCFInryz76CsyffU4EH1ClR/AI5Np6bjHGzpG5ov0gcZlyLNSmRcQfEdHRBvFVzsidvMFauM4I+NcROc4D3Z6bISzx6qlKXDlvEkKnhmytcDmje4TYflvtw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=vo4S0sxqN90X+9HF9ZiLtgxtDY4wHZIT8K+XMh+QUWU=; b=Lpjlwyg6YwXKrZvQLsPQHNR8+g9kFcIRJSAGWL8MgJJtnEtw1l1HJSD/hXOU8LKqcD430POraJs5UOXM+7UoKBcCUewR+Ui0Kx5O7nO1CwKoTfaF8Ia5dXbdoLPtIt57gKvJn5/wtxjXg0jQq/w1tnZ4pxmGnzEyoNDvpEiddTw8VsMT7+wKxoI6xgeyzqeYaxjAHWkyt/vVZkwJPLAG0eXLP11GHV48yN2i8k+inrL6VyAKnhnglBhVmxCZpaVM7ptBKxifIZvdLDb19TsYm7EozWIdEr/zpVbOGu4zR5PRK6vd+3fp1bB2TtNI2z9nzd+mY3Men/gbg8P0CokLug== Received: from MW2PR12MB4666.namprd12.prod.outlook.com (2603:10b6:302:13::22) by MN2PR12MB3024.namprd12.prod.outlook.com (2603:10b6:208:cb::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Fri, 11 Feb 2022 10:10:03 +0000 Received: from MW2PR12MB4666.namprd12.prod.outlook.com ([fe80::9d4e:649c:c6b8:b353]) by MW2PR12MB4666.namprd12.prod.outlook.com ([fe80::9d4e:649c:c6b8:b353%4]) with mapi id 15.20.4951.019; Fri, 11 Feb 2022 10:10:03 +0000 From: Ori Kam To: "Sean Zhang (Networking SW)" , "NBU-Contact-Thomas Monjalon (EXTERNAL)" , "ferruh.yigit@intel.com" , Xiaoyun Li , Aman Singh , Yuying Zhang CC: "dev@dpdk.org" Subject: RE: [v2 3/4] app/testpmd: add gre_option item command Thread-Topic: [v2 3/4] app/testpmd: add gre_option item command Thread-Index: AQHYHukeQaRfbycX0EKz37xo8VL2fayOIPIw Date: Fri, 11 Feb 2022 10:10:03 +0000 Message-ID: References: <20220126084404.40178-1-xiazhang@nvidia.com> <20220211014530.77711-1-xiazhang@nvidia.com> <20220211014530.77711-4-xiazhang@nvidia.com> In-Reply-To: <20220211014530.77711-4-xiazhang@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a69a7b28-429f-4d62-b24a-08d9ed46abd2 x-ms-traffictypediagnostic: MN2PR12MB3024:EE_ x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uc9it6wGEWWi8xyjJzUwhXfHYgNriYrOZ2iBanRlgiMlEr2Gmy/8X/bIAXem9MdKwVlcYTz07hsarYhpINfIP+wUNYTQUWOUJp0+a3zNKhfpFUAcM9IW65braBUQuVelZZUaIhTXvWOdmjIt8REF76DOxlQVo24tJqNzzcsld2Of+VjzL+Yl3WrsMpUvgHlajTyG8RxpTY83d5/F2G8r7NdqRm9lQeQKO5oAhb0EF/LTeTU1a2jKLyQuMVbN8A2syKLNVpOnHlhJGk/uoyQuJth/yT7GP6mvVHlT5Un3roJuyFOoTbQdpoIbtaJemmH42w8xoXwoINZVNKnfLvJcqKm0luYkOXSTIyeDdq7nnIxPtgc2iCa2t3dnyLBXdySazJwTMDPZW+hkly/MENy67xzEHOj38LBm4UOdHry6vOGbgfkr6RU9d95rcQVbR7Yl3gG/7c5Jx75hoWG7Z7ECuFZLcPK59SfRwxfGJNXVLZ9I1j6XJLXTeiRZUy6vi8T2UJec68MnOhXd4KYHmxufAIXLu8KHukj+EPmfFzBMrJ5kvfCelLZEcKh65x9NYvL7tAxdThNx2CPfDIVec3NPwTN85UU4JGFh+RypmsROXezPoP1IrtX1JCKoQSk4V7AfrBCF97EdlaU0Io5eIyYbX+DqHNOI366qJnz/6b89VeyNNWp7BunYuELlkhwDWmwn++TL+Gx5lkZ+M2S+PXqFnA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR12MB4666.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(5660300002)(38070700005)(508600001)(9686003)(52536014)(8936002)(71200400001)(83380400001)(33656002)(186003)(26005)(7696005)(6506007)(2906002)(86362001)(38100700002)(110136005)(316002)(55016003)(66556008)(122000001)(4326008)(76116006)(66946007)(8676002)(66476007)(66446008)(64756008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?GvehZ7GQfNDklTt12y8grK+dJNXaebzErKZCaN5pUHkG1CUJlauUdBzSG292?= =?us-ascii?Q?bWKeImhc0ujCWD1cgNTcGdfAHM8/csFL9HjYbopKNHsiQt7RQ7QWvPml2fM/?= =?us-ascii?Q?6Ex+OmW0/acEG9ahWVk94CU/i+GYwvyc3BPRisH2dusELhDAWlKSeFAcj7pZ?= =?us-ascii?Q?7bwo9L+Z4YP3cR4N2djRmXiiMBp9t59DWBUSrfkDNV8ZmUTC/tpdtQ4ulgX7?= =?us-ascii?Q?GItkRHtMTHReye0R0unZczUOUZAQ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KkFicC/?= =?us-ascii?Q?WUU68aI1dmOSbw7Ie02g+v1GQCggtxhkgAt16OtX3nyAL6TeJuur8zffIWjm?= =?us-ascii?Q?3tbpbwyTC12rP+/7AuUDz6kIQYiUL6dcVCx7mX4xxbVZe+DhiNNMByI9z9+m?= =?us-ascii?Q?kztt1hOh9mRb7QtFf714ljzTuTmL8Lan0qzm/WMi0Pl5G8HqRL6AjQw5eFsF?= =?us-ascii?Q?3H3WdkK5dTNGVQBmsUhKWGJsiOOCZKkrpRTgW84St3Y85a0uMmgOB2kklBtK?= =?us-ascii?Q?Xn5tTiFeBKQ2N9AGtM2hRYmzPO1A9sdrAFfRIpbYFYYwOWHGTfouToIIjavT?= =?us-ascii?Q?7W58cc79OHhvN8Krm+WQf9j3rbtBtm+xWlpzIUJcE15BR8tyKUDNPqQ1eU2O?= =?us-ascii?Q?XM8ES8gdu7JaKBpwN95uzY/yvTi57jUl//QCxl9Sdc357W42O+jkq0xQVlf7?= =?us-ascii?Q?fRaObja4GabwhUc0Q8/CAng286wjs+OoVESyi16rRx+CQT6bgYkRTQt0h/CD?= =?us-ascii?Q?vA=3D=3D?= 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: MW2PR12MB4666.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a69a7b28-429f-4d62-b24a-08d9ed46abd2 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2022 10:10:03.4591 (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: enBlouolx3/IezT3zdSlcRHnsrmGKF64VNzWP7T0Z0kxyhm2GOgNXyhsm13qUN3jmgU37T9ob761UTBT1ENkJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3024 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 Hi Sean, > -----Original Message----- > From: Sean Zhang (Networking SW) > Subject: [v2 3/4] app/testpmd: add gre_option item command >=20 > Add gre_option command for matching optional fields(checksum/key/sequence= ) > in GRE header. The item must follow gre item, and the item does not > change the flags in gre item, the application should set the flags in > gre item correspondingly. > Application can still use gre_key item 'gre_key value is xx' for key > matching, the effect is the same with using 'gre_option key is xx'. >=20 > The examples for gre_option are as follows: >=20 > To match on checksum field with value 0x11: > testpmd> ... pattern / eth / gre c_bit is 1 / gre_option checksum is > 0x11 / end .. >=20 > To match on checksum field with value 0x11 and any value of key: > testpmd> ... pattern / eth / gre c_bit is 1 k_bit is 1 / gre_option > checksum is 0x11 / end .. >=20 > To match on checksum field with value 0x11 and no key field in packet: > testpmd> ... pattern / eth / gre c_bit is 1 k_bit is 0 / gre_option > checksum is 0x11 / end .. >=20 > The invalid patterns for gre_option are as follows: >=20 > testpmd> ... pattern / eth / gre / gre_option checksum is 0x11 / end .. > (c_bit in gre item not present) > testpmd> ... pattern / eth / gre c_bit is 0 / gre_option checksum is 0x11= / > end .. (c_bit is unset for gre item, but checksum is > specified by gre_option item) >=20 > Signed-off-by: Sean Zhang > --- > app/test-pmd/cmdline_flow.c | 72 +++++++++++++++++++++++= ++++++ > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 +++ > 2 files changed, 78 insertions(+) >=20 > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 7b56b1b..b977480 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -272,6 +272,10 @@ enum index { > ITEM_META_DATA, > ITEM_GRE_KEY, > ITEM_GRE_KEY_VALUE, > + ITEM_GRE_OPTION, > + ITEM_GRE_OPTION_CHECKSUM, > + ITEM_GRE_OPTION_KEY, > + ITEM_GRE_OPTION_SEQUENCE, > ITEM_GTP_PSC, > ITEM_GTP_PSC_QFI, > ITEM_GTP_PSC_PDU_T, > @@ -1043,6 +1047,7 @@ struct parse_action_priv { > ITEM_ICMP6_ND_OPT_TLA_ETH, > ITEM_META, > ITEM_GRE_KEY, > + ITEM_GRE_OPTION, > ITEM_GTP_PSC, > ITEM_PPPOES, > ITEM_PPPOED, > @@ -1234,6 +1239,14 @@ struct parse_action_priv { > ZERO, > }; >=20 > +static const enum index item_gre_option[] =3D { > + ITEM_GRE_OPTION_CHECKSUM, > + ITEM_GRE_OPTION_KEY, > + ITEM_GRE_OPTION_SEQUENCE, > + ITEM_NEXT, > + ZERO, > +}; > + > static const enum index item_gtp[] =3D { > ITEM_GTP_FLAGS, > ITEM_GTP_MSG_TYPE, > @@ -3494,6 +3507,38 @@ static int comp_set_modify_field_id(struct context= *, const struct token *, > item_param), > .args =3D ARGS(ARG_ENTRY_HTON(rte_be32_t)), > }, > + [ITEM_GRE_OPTION] =3D { > + .name =3D "gre_option", > + .help =3D "match GRE optional fields", > + .priv =3D PRIV_ITEM(GRE_OPTION, > + sizeof(struct rte_flow_item_gre_opt)), > + .next =3D NEXT(item_gre_option), > + .call =3D parse_vc, > + }, > + [ITEM_GRE_OPTION_CHECKSUM] =3D { > + .name =3D "checksum", > + .help =3D "match GRE checksum", > + .next =3D NEXT(item_gre_option, NEXT_ENTRY(COMMON_UNSIGNED), > + item_param), > + .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre_opt, > + checksum_rsvd.checksum)), > + }, > + [ITEM_GRE_OPTION_KEY] =3D { > + .name =3D "key", > + .help =3D "match GRE key", > + .next =3D NEXT(item_gre_option, NEXT_ENTRY(COMMON_UNSIGNED), > + item_param), > + .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre_opt, > + key.key)), > + }, > + [ITEM_GRE_OPTION_SEQUENCE] =3D { > + .name =3D "sequence", > + .help =3D "match GRE sequence", > + .next =3D NEXT(item_gre_option, NEXT_ENTRY(COMMON_UNSIGNED), > + item_param), > + .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre_opt, > + sequence.sequence)), > + }, > [ITEM_GTP_PSC] =3D { > .name =3D "gtp_psc", > .help =3D "match GTP extension header with type 0x85", > @@ -9252,6 +9297,33 @@ static int comp_set_modify_field_id(struct context= *, const struct token *, > ((const struct rte_flow_item_flex *) > item->spec)->length : 0; > break; > + case RTE_FLOW_ITEM_TYPE_GRE_OPTION: > + size =3D 0; > + if (item->spec) { > + const struct rte_flow_item_gre_opt > + *opt =3D item->spec; > + if (opt->checksum_rsvd.checksum) { > + *total_size +=3D > + sizeof(opt->checksum_rsvd); > + rte_memcpy(data_tail - (*total_size), > + &opt->checksum_rsvd, > + sizeof(opt->checksum_rsvd)); > + } > + if (opt->key.key) { > + *total_size +=3D sizeof(opt->key.key); > + rte_memcpy(data_tail - (*total_size), > + &opt->key.key, > + sizeof(opt->key.key)); > + } > + if (opt->sequence.sequence) { > + *total_size +=3D sizeof(opt->sequence.sequence); > + rte_memcpy(data_tail - (*total_size), > + &opt->sequence.sequence, > + sizeof(opt->sequence.sequence)); > + } > + } > + proto =3D 0x2F; > + break; > default: > fprintf(stderr, "Error - Not supported item\n"); > goto error; > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index 0551121..09cd1f4 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -3715,6 +3715,12 @@ This section lists supported pattern items and the= ir attributes, if any. >=20 > - ``value {unsigned}``: key value. >=20 > +- ``gre_option``: match GRE optional fields(checksum/key/sequence). > + > + - ``checksum {unsigned}``: checksum value. > + - ``key {unsigned}``: key value. > + - ``sequence {unsigned}``: sequence number value. > + > - ``fuzzy``: fuzzy pattern match, expect faster than default. >=20 > - ``thresh {unsigned}``: accuracy threshold. > -- > 1.8.3.1 Acked-by: Ori Kam Best, Ori