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 C6F4DA00C3; Tue, 1 Feb 2022 13:57:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6045140698; Tue, 1 Feb 2022 13:57:15 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2049.outbound.protection.outlook.com [40.107.96.49]) by mails.dpdk.org (Postfix) with ESMTP id 73B3240691 for ; Tue, 1 Feb 2022 13:57:13 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jz7qHdBLE1gvjZn88qixpQchngtHElU3azwzPW3Ba/TlGo4bon4+mF2euZOCD2dZqm7LFOtZV92jpYSMeX/JKo256rFoRdOagSMmSXsTwi0xR+A5K13ee2EHRxBdgNZc3p0DuJ8wW0mZaKiKatLAL1CmMK3bO5+dnQz7LZik+dFpp7EoU1PWq4+/O5UiIgQ0NglveFj/1xoxncOAfynULZSNwXD1W9MB1jFFGED/7FuSo2p8O8R/y9bT0HKiKwnIK8axmqSJ+U3H0TxSr68WyecDevhcKt4skAWk/EHPQjNEo7EQNYGuXzoF4l0bstn5REnsYKnw8PfHxpkfKrvNBA== 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=ki4/owW2lX7i7Ee5OaTPDCYEz4BNTt/JDYXdG0zznYE=; b=ktyttSAwoivQYPO4kPu+0qYTfxmD+wkueRjGqkXFT8wLkvl2SMKto4Xi3YFio42QNK/Ad1pyhiIqbE5I+Xy3G5Y1N1rlWp5sLB2Uc+mDWk1ySK26RinBK+F4gV8e5r8FpMzZahxcmqf/471wRNnwqUirOyahB7+VMUEMSzb50W1QbSjAcaGKeMrFq1RPUh+G3ESzPTdYUDwNdT8/B5n4esy8ss9ItPaZmVaqbhVw8R2dLO4/Z3gPSYUdbSPw6aSKL0UVMphYdUb7paLA3iQn1orG8xkj3IYMf9TWDliKS1nsdXm5g42UplFau0Fs9Cw/Bn3s6bWoi55bL9ESNnFsng== 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=ki4/owW2lX7i7Ee5OaTPDCYEz4BNTt/JDYXdG0zznYE=; b=bJ740Ay4pghb4QbLMalx62emzG7nIminjz62s1ZeMXPR2qE6QD/HNzyM/p84oHGzjPBsJGVALKh5NFsSLcCzqPWfnrtI3/iuCgG/5brnbi41QT4pUzKsdDeHQwMg2Fk7OxpIOU5eK4ykhoL/ek6Tst6v2dP4bkJS/49vIyNpUuVQ8d5lsYRy+VnCflSmNNO5vSXKMvEApi9m/I8KZ8X4xVw1C18jifGjD6TkBzfqJJJKCSeakrKCHUAAAJuZQx4beLgduFhiHLDT//7fHPfY+6U76wsK1ZzVk8aqbNfDs6kYtQTEF+FKLrsIxLy67bPkYrXg1zXIhFr1G1riIeRCTA== Received: from MW2PR12MB4666.namprd12.prod.outlook.com (2603:10b6:302:13::22) by CH0PR12MB5267.namprd12.prod.outlook.com (2603:10b6:610:d2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Tue, 1 Feb 2022 12:57:11 +0000 Received: from MW2PR12MB4666.namprd12.prod.outlook.com ([fe80::1869:1984:7899:8cbb]) by MW2PR12MB4666.namprd12.prod.outlook.com ([fe80::1869:1984:7899:8cbb%4]) with mapi id 15.20.4930.022; Tue, 1 Feb 2022 12:57:11 +0000 From: Ori Kam To: "Sean Zhang (Networking SW)" , "NBU-Contact-Thomas Monjalon (EXTERNAL)" , Xiaoyun Li , Aman Singh , Yuying Zhang CC: "dev@dpdk.org" Subject: RE: [v1 3/4] app/testpmd: add gre_option item command Thread-Topic: [v1 3/4] app/testpmd: add gre_option item command Thread-Index: AQHYEpDzAVklQ70m0U+Njtfi+47wj6x+sRtQ Date: Tue, 1 Feb 2022 12:57:11 +0000 Message-ID: References: <20211230030817.15264-2-xiazhang@nvidia.com> <20220126084404.40178-1-xiazhang@nvidia.com> <20220126084404.40178-4-xiazhang@nvidia.com> In-Reply-To: <20220126084404.40178-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: 5cbe9721-be3a-4699-fc25-08d9e5825cb9 x-ms-traffictypediagnostic: CH0PR12MB5267:EE_ x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: moqLOTkrLsZreePPEYI+y9i5DFfn/PKS54Jmgnfk+x1e9CVLqUl7WhnuVrzB0IWyQWerAabNOGFHYB27mrt0XdYfMqPrh2DdfClkNBWKXgdkke+ruIVhQ0qtaRlB99gNvmF0XE+82FGAIP7K2LkGXMLsjKyGPS+oCjV51dTcUE+XLjFoWnHRzEHtxmUCOZQ0Sqglmu2oYUl1w+lHz2wH+cG5EGoeo6vhmiZQKHUTCmGVJKG6z+OdAXFSA5DKlAeXbl1DoXJhvaFzPsugFHpf25Kl5diTwaIPNFsqtzOQxOS2dDEUq6v+rbIEkdd1WqTMF2T6gimdKhWzUl4d/hFtseBh7UMBQsYkvpYhWp3iHg8Va6MgfvZ8PiK5N7gNKEtYMJl7Zb7bqgftUS5xTNac8EVKbxQdRxjPFaB9NpHY5Q4pmL+/YgtxmHyX7qCHxnAP39rjX5BLP4fdzB0eBDF5HYyBW0I6ImqUiMiuVrEqOAi1eb2Hn3/Kdva4wa4XM3aN44r6O/50OnlKO+BYrJ3FVJqGzL21WYQynEMmoaENuiYGG46JUi1yNu15/pE169XSpZ9/DMZo0Mt62nCF6Bua22moBoQwvK4yLehERwky1Yn05PkQz0yNH2OoWXXDCTMqECxfCy2LwGQ1pzFYUJPv5AHKh5aFprom5o8i5/ceevV+H8cBQVizOoOthC6/xi+MgspPsYmh5iFzCbhMiwN2HQ== 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)(6506007)(7696005)(38100700002)(122000001)(55016003)(33656002)(83380400001)(2906002)(5660300002)(52536014)(66556008)(66946007)(76116006)(110136005)(4326008)(8676002)(8936002)(66476007)(186003)(26005)(71200400001)(38070700005)(9686003)(316002)(53546011)(86362001)(508600001)(64756008)(66446008)(20210929001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?UG9VZcjv1D2X3SvD0mluueTlXx7vP9r+4hfzEwfWDO7XphHi/C78nrOXJ0PQ?= =?us-ascii?Q?4pGJ7QWW9l+8vuDF+2d0n2tKneXEm8yKNJ0zUeog4Zz/rD0efmAu0FusbK/+?= =?us-ascii?Q?C4Ro8E52cKpKn0KxLCJPVPPwUudb2BS+iJZJP59LKcmyfavq13s49cGqqGrs?= =?us-ascii?Q?GvMsMqpn8oElCujKYnRpXCQQpdWHYele88KGkCCy7DRlEAIcSBvFrIuVkVTg?= =?us-ascii?Q?HA4gV/4J0NwSJy8Xv8L3oAL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Vd6ZqALTAhIzpIdDfSNX7H+lEWUwvmLN4SeD3llp9FeEiBMLkMSlghtcE9?= =?us-ascii?Q?UZk0hkjLAbJ3DPBHj35bvA+u89Bq7RPglgKOHo5jVnlEOnm/7xALRhr91Cik?= =?us-ascii?Q?Eo1HIbCmMFHrvch659EzYFSJQt0GCUc270S2odp6Cl0kvHDTQwLdL9de6jUI?= =?us-ascii?Q?zLTp5mTtNnmLzFGxBXPe1dFJf1syw66arsglIChu7r2Tr8QLe5ZeM3NTwOgw?= =?us-ascii?Q?/8miS2npZE/6XR4w1B2P8gxfuM9AbCocxuxfbo0SPTRRJvAN2yb9g5zsp0Ie?= =?us-ascii?Q?sGO3qyjohozCigR26qoUXggGSENCclHJp5xtKa0lFTmTK/uik5qhUGxsP3tH?= =?us-ascii?Q?2189wlNLDkLxMH5NpP2GpXWXnU46lNE3AwYQPi5hLsiK1f+ZqtT6p+1m/jDu?= =?us-ascii?Q?bGhEkkqXysZPKmCjtPJEFClzNfbpXETw/pT4L1966vwCeTpL6Ip3L2rM0Xrl?= =?us-ascii?Q?IbI0xDLi4EPnxoZBOnwQBog=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: 5cbe9721-be3a-4699-fc25-08d9e5825cb9 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Feb 2022 12:57:11.2900 (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: XbDR5tRNM0tSKr7azjPLSsGv9RqT9QtXQwnntZqr7biBmIv7XofDIF+9ym/TdShXDGx2vq4YkxDxRBO5ApOPow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5267 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) > Sent: Wednesday, January 26, 2022 10:44 AM > Subject: [v1 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 | 59 +++++++++++++++++++++++= ++++++ > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 +++ > 2 files changed, 65 insertions(+) >=20 > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 5c2bba4..b7aacac 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -271,6 +271,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, > @@ -1042,6 +1046,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, > @@ -1232,6 +1237,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, > @@ -3479,6 +3492,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)), > + }, > + [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)), > + }, > + [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)), > + }, > [ITEM_GTP_PSC] =3D { > .name =3D "gtp_psc", > .help =3D "match GTP extension header with type 0x85", > @@ -9235,6 +9280,20 @@ 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.checksum) > + size +=3D 4; > + if (opt->key.key) > + size +=3D 4; > + if (opt->sequence.sequence) > + size +=3D 4; > + } > + 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 94792d8..751503e 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -3714,6 +3714,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