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 82123A0487 for ; Thu, 4 Jul 2019 13:56:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 387931BE1C; Thu, 4 Jul 2019 13:56:38 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20068.outbound.protection.outlook.com [40.107.2.68]) by dpdk.org (Postfix) with ESMTP id DE8171BE07 for ; Thu, 4 Jul 2019 13:56:36 +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=r763d4eXWhuuHDpYqbKUMwy/0NsxwV7s2NYtoaE/g7s=; b=rdgUn9DOAjTJxsEiKjFZ7J6nzhWqU9kYf4dHveVVo0R5OJZ/gcztb2Rewxqbobahp8xhQYG1LM5JVFTrkM9EwGCGXcrbCiFhBb6MIkLHZzXsY9wKhPOP8rWue6pYgTKj36CvbhFNSal46ST4+isNglykYfFrgrgjkl5otK+lAQo= Received: from AM6PR05MB6567.eurprd05.prod.outlook.com (20.179.6.215) by AM6PR05MB6232.eurprd05.prod.outlook.com (20.178.95.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.17; Thu, 4 Jul 2019 11:56:35 +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 11:56:35 +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+/81VXrsYI96a6fAuA//+8zwCAACLBgA== Date: Thu, 4 Jul 2019 11:56:35 +0000 Message-ID: <20190704115625.umjpfsztht3ypcnn@mellanox.com> References: <20190624154018.128379-1-jackmin@mellanox.com> <5d9e2fcd3a1bf439b0cff354ca5b5bf1f43e090d.1562058723.git.jackmin@mellanox.com> <20190703152516.GI4512@6wind.com> <20190704055231.bpwbvbd6g2zosbl6@mellanox.com> <20190704095202.GL4512@6wind.com> In-Reply-To: <20190704095202.GL4512@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK0PR01CA0007.apcprd01.prod.exchangelabs.com (2603:1096:203:92::19) 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: 1158bea5-7261-4834-0963-08d70076a9aa 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:AM6PR05MB6232; x-ms-traffictypediagnostic: AM6PR05MB6232: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 0088C92887 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(39860400002)(346002)(376002)(189003)(199004)(66476007)(14444005)(73956011)(68736007)(66446008)(66946007)(86362001)(64756008)(66556008)(6116002)(25786009)(14454004)(7736002)(6512007)(305945005)(1076003)(6246003)(256004)(71200400001)(71190400001)(66066001)(53936002)(6916009)(6486002)(486006)(76176011)(386003)(8936002)(186003)(36756003)(478600001)(6436002)(229853002)(26005)(99286004)(5660300002)(2906002)(446003)(476003)(2616005)(11346002)(52116002)(81156014)(8676002)(316002)(4326008)(3846002)(54906003)(6506007)(81166006)(102836004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB6232; 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: O2hIQfff+AZ3bdJepnAyjjQ3mMGmouw/2NwB6blyaxZmvOk6nQGyv57dXYI24pdRlq4+wcZOiAVOyPPV3ePsFNRZ+roC76vKJj37bGY2y+BoxNaUbbE9a58Uj8Rsr9qjvOHTOw6+/x6m2g19NJnC4fJw9RO4K/+KMlsriV8tp3zfNEqfb5ryiMLhyPwEzDIJxHLbyAO53Xzcper0yqcGhaWwSP9blA/AfbrYf8J76FwRjD2NJEA3Flhe7Mr/R970p1P99WJVqNip5ZFeAcetZoUyfIyyCkBz/8N3h/qr8+genUauor1tszuJ0DyYBF9Vc4iyvtK0kDx9Id5vYYQ07qbSRRVmzHOLGgjt0a41mdwWW2piqu0cG4K0h5D4XF3mINq6VfM8zFFhMTMkoO1DFLr/yj1mkFVF2VXzjrLy7/k= 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: 1158bea5-7261-4834-0963-08d70076a9aa X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jul 2019 11:56:35.2776 (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: AM6PR05MB6232 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 Thu, 19-07-04, 11:52, Adrien Mazarguil wrote: > On Thu, Jul 04, 2019 at 05:52:43AM +0000, Jack Min wrote: > > 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 ma= tches > > > gre_key already or is this a specific hardware limitation in your cas= e? > > >=20 > >=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. >=20 > OK, makes sense. >=20 > > > 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 explic= itly > >=20 > > Yes, I should document this. > > So it should be documented in __testpmd_funcs.rst__ ? >=20 > No it would be a change in the GRE_KEY item itself at the rte_flow API > level (rte_flow.h) & documentation (rte_flow.rst). The flow rules created= by > testpmd must be an exact translation of user input, as a debugging tool i= t > can't request something that wasn't explicitly written. >=20 will update rte_flow.h & rte_flow.rst > > > spec/mask K as "0" and still provides gre_key, the PMD can safely ign= ore the > > > gre_key item. > > >=20 > >=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. >=20 > Not good then. You should spit an error out if it's an impossible > combination. You can't match both K =3D=3D 0 *and* a GRE key, unless perh= aps if > key mask is also 0, e.g.: >=20 > gre crksv is 0x0000 crksv mask 0xb000 / > gre_key value spec 0x00000000 value mask 0x00000000 >=20 Never thought man will wirte thing like this, they don't wanna match gre_key why put the item there ? But, since you have raised this example, I'll update PMD part to handle thi= s. > This is merely an overly complex way for telling the PMD that one wants t= o > match packets without GRE keys that you could technically support. >=20 > > The reason is wanna keep code simple, needn't to get > > information from other item (gre) inside gre_key item, or vice verse. >=20 > PMDs typically maintain context as they process the pattern. The GRE patt= ern > item is guaranteed to come before GRE_KEY, so you already know at this po= int > whether users want to match K at all, and if so, what value they want it = to > have. >=20 Yes, PMD can know. Just need to add some code. > > 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? >=20 > Depends. They may want to match all GRE traffic with a key, doesn't matte= r > which, in order to process it through a different path. To do so they cou= ld > either: >=20 > 1. Use the GRE item only to match K bit =3D=3D 1. >=20 > 2. Use the GRE_KEY item to match a nonspecific key value (mask =3D=3D 0). >=20 > 3. Use a combination of both. >=20 > I think you can easily support all three of them with mlx5 if you support > partial masks on GRE keys (I haven't checked), even if you're unable to > specifically match the K bit itself. >=20 Already support this. > [...] > > > > @@ -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 > >=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. >=20 > OK no problem. Perhaps you could make this easier by allowing users to ma= tch > individual bits, let me explain: >=20 > The flow command in testpmd is a direct interface to manipulate rte_flow'= s > structures. The "crksv" field doesn't exist in rte_flow_item_gre, its nam= e > is "c_rsvd0_ver". Testpmd must use the same in its command and internal > code. >=20 > However since bit-masks are usually a pain to mentally work out, you can > provide extras for convenience. The "types" field of the RSS action > (ACTION_RSS_TYPES) is an extreme example of this approach. >=20 > So I suggest adding ITEM_GRE_C_RSVD0_VER taking a 16-bit value like CRKSV= , > and complete it with ITEM_GRE_C_BIT, ITEM_GRE_S_BIT and ITEM_GRE_K_BIT > addressing the individual bits you would like to expose for convenience. >=20 So something like: eth / ipv4 / gre c_rsvd0_ver c_bit is 0 s_bit is 0 k_bit is 1 / ... Is it right? > [...] > > > You should have named this field "value" then, i.e.: > > >=20 > > > - ``value {unsigned}``: key value. > > >=20 > >=20 > > OK, I'll update it. >=20 > Please remember to update it in rte_flow.h and documentation as well, > thanks. >=20 OK. > --=20 > Adrien Mazarguil > 6WIND