From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 516B6A0487 for ; Thu, 4 Jul 2019 07:52:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 50C373195; Thu, 4 Jul 2019 07:52:47 +0200 (CEST) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30066.outbound.protection.outlook.com [40.107.3.66]) by dpdk.org (Postfix) with ESMTP id C20BB1F28 for ; Thu, 4 Jul 2019 07:52:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xZSWgy3JMXCgm1/Oa8muqozdmNJ0gvam7KSOwfbSnFA=; b=HHy1Bexe632bnWElxPygNMXoko5GAgsuDInOi8WhogeRIv8JBrdESQ/37zVqZSjz8n1Thw0n584/4LcmCb8iZ3zLt+79AG5bjOWytzDMuyDQIn0s5LdjHrA0Ds85daI9EScMV7bi9hLSEOf3L6uLzC+GYUmtO9yiCy0uXi/Vuck= Received: from AM6PR05MB6567.eurprd05.prod.outlook.com (20.179.6.215) by AM6PR05MB4293.eurprd05.prod.outlook.com (52.135.161.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.16; Thu, 4 Jul 2019 05:52:44 +0000 Received: from AM6PR05MB6567.eurprd05.prod.outlook.com ([fe80::496b:bd1c:863a:ed47]) by AM6PR05MB6567.eurprd05.prod.outlook.com ([fe80::496b:bd1c:863a:ed47%3]) with mapi id 15.20.2052.010; Thu, 4 Jul 2019 05:52:44 +0000 From: Jack Min To: Adrien Mazarguil CC: Ori Kam , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic , "dev@dpdk.org" Thread-Topic: [PATCH v4 4/4] app/testpmd: match GRE's key and present bits Thread-Index: AQHVMbOGAwBXQhdzs0+/81VXrsYI96a59e+A Date: Thu, 4 Jul 2019 05:52:43 +0000 Message-ID: <20190704055231.bpwbvbd6g2zosbl6@mellanox.com> References: <20190624154018.128379-1-jackmin@mellanox.com> <5d9e2fcd3a1bf439b0cff354ca5b5bf1f43e090d.1562058723.git.jackmin@mellanox.com> <20190703152516.GI4512@6wind.com> In-Reply-To: <20190703152516.GI4512@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK2PR04CA0047.apcprd04.prod.outlook.com (2603:1096:202:14::15) To AM6PR05MB6567.eurprd05.prod.outlook.com (2603:10a6:20b:bc::23) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jackmin@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [139.226.40.4] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7883dd5a-cbbe-4a9f-115d-08d70043d50e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:AM6PR05MB4293; x-ms-traffictypediagnostic: AM6PR05MB4293: x-ms-exchange-purlcount: 1 x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0088C92887 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(39860400002)(346002)(136003)(366004)(396003)(189003)(199004)(73956011)(305945005)(66946007)(1076003)(66556008)(64756008)(66446008)(66476007)(386003)(7736002)(6436002)(45080400002)(6246003)(6506007)(66066001)(76176011)(14454004)(2906002)(8676002)(52116002)(478600001)(256004)(14444005)(25786009)(86362001)(4326008)(99286004)(5660300002)(8936002)(229853002)(6116002)(6916009)(53936002)(6486002)(446003)(36756003)(26005)(6306002)(81166006)(6512007)(102836004)(81156014)(71190400001)(476003)(2616005)(3846002)(68736007)(486006)(71200400001)(11346002)(316002)(186003)(966005)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4293; H:AM6PR05MB6567.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: gdAT58SeyGK+Hf8yKKsETBoMHhuzDh39+AGnJanN2g0O3FzmPz2ni8Murq0hEHot9207yu+nbxjUnDnbJF9nQ0jZiwUHlxsYv3TJxnyGoy4JwamPlpWSVSc7S3lTyg33+vw3tkzwLrUDQoh4qaY7hsOcYHup6q8sPlHsIck100M+GTOqqu4N3W4RfBGVSwmAa/fTrzJdkEEbWjqdgSvpHzRml/reEEeNZKZob307PV4K2HvyjL8gXCOAO1IR6VypSB6gbPeV63c3bFe63SPh7q380YLCDK+yflcd1Ih9eIIAAxrP3KQzQ0veUBJux6cWWYhKzCYfcd6zQZ2xxYiud1pNMmgFtygQxC+UrzAfeD4dprC/QfVgBhfH82I1jcJpzkUiOjoJQf1nzF5eEQbmLfcoSLRy0OXMAcwjRLV2CP4= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7883dd5a-cbbe-4a9f-115d-08d70043d50e X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jul 2019 05:52:43.9708 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jackmin@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4293 Subject: Re: [dpdk-dev] [PATCH v4 4/4] app/testpmd: match GRE's key and present bits X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" On Wed, 19-07-03, 17:25, Adrien Mazarguil wrote: > On Tue, Jul 02, 2019 at 05:45:55PM +0800, Xiaoyu Min wrote: > > support matching on GRE key and present bits (C,K,S) > >=20 > > example testpmd command could be: > > testpmd>flow create 0 ingress group 1 pattern eth / ipv4 / > > gre crksv is 0x2000 crksv mask 0xb000 / > > gre_key key is 0x12345678 / end > > actions rss queues 1 0 end / mark id 196 / end > >=20 > > Which will match GRE packet with k present bit set and key value is > > 0x12345678. > >=20 > > Signed-off-by: Xiaoyu Min >=20 > I'm wondering... Is matching the K bit mandatory if one explicitly matche= s > gre_key already or is this a specific hardware limitation in your case? >=20 If there is gre_key item MLX5 PMD will force set HW matching on K bit, >From HW perspective it is mandatory. But, from testpmd (user) perspective, I agree with you, user needn't set matching on K bit if they already explicitly set gre_key item. > Perhaps we could document that the K bit is implicitly matched as "1" in = the > default mask when a gre_key pattern item is present. If a user explicitly Yes, I should document this. So it should be documented in __testpmd_funcs.rst__ ? > spec/mask K as "0" and still provides gre_key, the PMD can safely ignore = the > gre_key item. >=20 Well, actullay, when a user explicitly set spec/mask K as "0" and still provide gre_key item, MLX5 PMD will implicitly set match on K bit as "1", just ingore the K bit set by user. The reason is wanna keep code simple, needn't to get information from other item (gre) inside gre_key item, or vice verse. And, I think, when a user provides a gre_key item, most probably, they do really wanna match on gre_key. What do you think? > I'm asking because I think most users won't bother with the K bit when > attempting to match some key and their rules may not behave as expected a= s a > result. >=20 I see. > More below. >=20 > > --- > > ** This patch is based on patch [1] > >=20 > > [1] https://eur03.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2= Fpatches.dpdk.org%2Fpatch%2F55773%2F&data=3D02%7C01%7Cjackmin%40mellano= x.com%7C590e61b809bb42869cf508d6ffcaa82c%7Ca652971c7d2e4d9ba6a4d149256f461b= %7C0%7C0%7C636977643198683579&sdata=3DLhTsrHRfX3LHhiHRBtz4WKUUklWupJueS= BgWmiHPECM%3D&reserved=3D0 > > --- > > app/test-pmd/cmdline_flow.c | 32 +++++++++++++++++++++ > > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 +++ > > 2 files changed, 36 insertions(+) > >=20 > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > > index 201bd9de56..8504cc8bc1 100644 > > --- a/app/test-pmd/cmdline_flow.c > > +++ b/app/test-pmd/cmdline_flow.c > > @@ -148,6 +148,9 @@ enum index { > > ITEM_MPLS_LABEL, > > ITEM_GRE, > > ITEM_GRE_PROTO, > > + ITEM_GRE_CRKSV, > > + ITEM_GRE_KEY, > > + ITEM_GRE_KEY_KEY, >=20 > Assuming you move the GRE_KEY definition in rte_flow.h, please keep its > location synchronized in this list as well. >=20 I'll do this. > > ITEM_FUZZY, > > ITEM_FUZZY_THRESH, > > ITEM_GTP, > > @@ -595,6 +598,7 @@ static const enum index next_item[] =3D { > > ITEM_NVGRE, > > ITEM_MPLS, > > ITEM_GRE, > > + ITEM_GRE_KEY, > > ITEM_FUZZY, > > ITEM_GTP, > > ITEM_GTPC, > > @@ -755,6 +759,13 @@ static const enum index item_mpls[] =3D { > > =20 > > static const enum index item_gre[] =3D { > > ITEM_GRE_PROTO, > > + ITEM_GRE_CRKSV, >=20 > CRKSV may be unnecessary in this patch if the K bit is documented and > implemented as described in my previous comment. >=20 Well, actully, we also wanna testpmd can match on C,S bits with K bit together so we can test on gre packet with key only or csum + key, or csum + key + sequence. > > + ITEM_NEXT, > > + ZERO, > > +}; > > + > > +static const enum index item_gre_key[] =3D { > > + ITEM_GRE_KEY_KEY, > > ITEM_NEXT, > > ZERO, > > }; > > @@ -1898,6 +1909,27 @@ static const struct token token_list[] =3D { > > .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre, > > protocol)), > > }, > > + [ITEM_GRE_CRKSV] =3D { > > + .name =3D "crksv", > > + .help =3D "GRE's first word (bit0 - bit15)", > > + .next =3D NEXT(item_gre, NEXT_ENTRY(UNSIGNED), item_param), > > + .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre, > > + c_rsvd0_ver)), > > + }, > > + [ITEM_GRE_KEY] =3D { > > + .name =3D "gre_key", > > + .help =3D "match GRE Key", > > + .priv =3D PRIV_ITEM(GRE_KEY, > > + sizeof(rte_be32_t)), >=20 > Could be a single line. >=20 Yes, I'll update it. > > + .next =3D NEXT(item_gre_key), > > + .call =3D parse_vc, > > + }, > > + [ITEM_GRE_KEY_KEY] =3D { > > + .name =3D "key", > > + .help =3D "GRE key", > > + .next =3D NEXT(item_gre_key, NEXT_ENTRY(UNSIGNED), item_param), > > + .args =3D ARGS(ARG_ENTRY_HTON(rte_be32_t)), > > + }, > > [ITEM_FUZZY] =3D { > > .name =3D "fuzzy", > > .help =3D "fuzzy pattern match, expect faster than default", > > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/t= estpmd_app_ug/testpmd_funcs.rst > > index cb83a3ce8a..fc3ba8a009 100644 > > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > @@ -3804,6 +3804,10 @@ This section lists supported pattern items and t= heir attributes, if any. > > =20 > > - ``protocol {unsigned}``: protocol type. > > =20 > > +- ``gre_key``: match GRE optional key field. > > + > > + - ``key {unsigned}``: key value. > > + >=20 > You should have named this field "value" then, i.e.: >=20 > - ``value {unsigned}``: key value. >=20 OK, I'll update it. > > - ``fuzzy``: fuzzy pattern match, expect faster than default. > > =20 > > - ``thresh {unsigned}``: accuracy threshold. > > --=20 > > 2.21.0 > >=20 >=20 > --=20 > Adrien Mazarguil > 6WIND