From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00074.outbound.protection.outlook.com [40.107.0.74]) by dpdk.org (Postfix) with ESMTP id 52A6A2C38 for ; Thu, 23 Aug 2018 23:31:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TbIvQnTbfH8PqM4/uESnpKTa11BV731LvJ1B6VYPSyY=; b=M5uGMdxu3eWaGn/vc2UWVkj/697AEhTjXBJHE94kIY4xgqsLepWoWU0W4JSt6vJpifu4M6DTOQtjaenFpuzhkPTSu6i/sDikNHjzX7h6hFCtfI8XdfevHETOVNECXD8PrMwwgMH6iCB60eWVvafmUgripccRgeBdhKs3+lQ2axs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from yongseok-MBP.local (209.116.155.178) by DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.20; Thu, 23 Aug 2018 21:31:53 +0000 Date: Thu, 23 Aug 2018 14:31:39 -0700 From: Yongseok Koh To: Andrew Rybchenko Cc: Dekel Peled , dev@dpdk.org, orika@mellanox.com, shahafs@mellanox.com, Thomas Monjalon , Konstantin Ananyev , Ferruh Yigit , Adrien Mazarguil , Olivier Matz Message-ID: <20180823213138.GB31847@yongseok-MBP.local> References: <1534146418-1060-1-git-send-email-dekelp@mellanox.com> <4da29594-c4c5-9006-2ecb-4f4094db42a5@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4da29594-c4c5-9006-2ecb-4f4094db42a5@solarflare.com> User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: DM5PR06CA0061.namprd06.prod.outlook.com (2603:10b6:3:37::23) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69a3ddc8-ba3b-49b2-ceaa-08d6093fd91a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3980; X-Microsoft-Exchange-Diagnostics: 1; DB3PR0502MB3980; 3:w4LegglDPBFU3uMFMgQlOmG09NAU5chLBC86OTEgXQ+R91gAka3dkYZmi+lnc+tXYCiGD4Lm45ikga/xBc3r+Bv0Gxf2jf9ORDXCtKHELaIzGDkGp3N4h7LLLFtO0TheTdGHhb02/D1Eg4TWaxyicgaM/LhInpMkyMg2moaA1iFXzRfedGkLHlSzyONggRO9WeYyB7A1Tc9pyk1XMysPQH5pIh4+5BA/fruV9WaNZ8vUxO7CHStaFQcORVejbZOD; 25:cVV3tX4bamR5ZTQlvUbveieCaDWs5WLXnT0EFridH0jnSc1+5ZDO6Rhnkcw2NJ2zDYPNmwGBRgtblaRkSAMmt4VW8PimY/26hqrn5N2SselFA4pSsG43P9v0w+YcBUeS0a19gUJC7+kTN8mHlVibU/j4L+PKXBjG+7QeSJUvhOBYbKrcB2aRM3HFuHIOUV9FWhxLyOU5DOzBQIjsHbFfI3fh+w0226m7Yj7foyJZ3s4CAgQIFlcu8vqwE2XoHyG4Tha23Tz60nXA8jLkllcpua5FtNQfAu1px2lpLfhlubdM59BudQfDqc0nEW3gYnjbEJgYTrsexzJ2ie6J4AdjXA==; 31:EZlbKidqPG6+c8yDi6yOa8R4a2eHOPfF9VZfYxQ5UzMXtsurnS4wXZxk3Xe1zVol+nDD+XzYwlLTZ12zgc2xszDk+gXC5pzgcRf4eMVLp/Mw6NCgqsa3BjG7y/XiJETnenaPb3LE+fFRzfe814/Jh7oWTlOTSEc+UzJhxRSOMyFZRe+ksDBNCzOIMLozhMl0ig1BqOn+8kVF1Ca6sCmHX3zTgXgTaE6VBJYiHzymhI0= X-MS-TrafficTypeDiagnostic: DB3PR0502MB3980: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB3PR0502MB3980; 20:Po+kAidVllC/xsph1O35xo00Ew62X3HZd1G1v+pwbCrmflqnaG6pfSoxxY+48W538X7HxcnmMAZdHrCvBT1tgVHak7X9AELr0aivbV0JVtNDwD+MoN82z3R2zPXxk/bGlxpIm0nY1HnXxgHui0zlC8P53yCgwk2ydwH3q68TQdk/Q3UIFeD1kmFDFFBSaNzmhYwV3Wx+IR+GVY/4bU1I5zjLk99UGnLFOftPRnjsfZKcOTwnbokIfCfTYtEFCHGJ1b+40Sn5QpqZpZqd2a+I5jcgvoqyWEW+dtwbnTSax+xjki+1ejO256ufvL9OFdELBfZ+5+s6e8MoyLTJGAEkqP6YFjdxkgpY6Jj5syKcHNdYQlpxEcM/c7OU1386dMV/So/mh5hNOcqAknkRATD3rZq0QVBo+ReH+0VFBOdekAicqe0zvQjAGy9bl5Mv3WAJdi9BCkQyq1iVIw5+S6BoRmytwsJZ8C5xyqlmQP6GGO5Av7KFv75MiASxaJXejZXr; 4:J8d/tN+XRslAF2zp1P8KkIDXfTd9GsK/ZI0b4xlHncZXGGIVdc+A2mp9qhA1umEQiPux324tyZRDQy/s9s/rzJ1eCLxZMvUpu8k+5PWClEMcfTYRiKYWOCO3BV9lQvgwAdGwvIdWvGTgPuwiPiSeDGDeAyYR3IzuXSVNg0F4rzCWiDTyCn2OSk3JQGnpR8FPoTxqEAtxT2Ogy/4/zdwDEMGO6malslmstqsCisJvgrx/Nlluyhf9VKOROkJCLC1pk0SKnUtfMEyU4mi9cCGbbg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699016); SRVR:DB3PR0502MB3980; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3980; X-Forefront-PRVS: 0773BB46AC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(136003)(396003)(346002)(376002)(39860400002)(189003)(199004)(25786009)(53936002)(97736004)(478600001)(6246003)(81166006)(11346002)(81156014)(52116002)(76176011)(8676002)(33896004)(446003)(53546011)(26005)(50466002)(476003)(956004)(4326008)(54906003)(7696005)(58126008)(186003)(6116002)(16526019)(1076002)(3846002)(23726003)(106356001)(9686003)(16586007)(86362001)(8936002)(105586002)(229853002)(316002)(6916009)(5660300001)(6666003)(486006)(55016002)(66066001)(6506007)(386003)(305945005)(7736002)(47776003)(98436002)(33656002)(2906002)(68736007)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3980; H:yongseok-MBP.local; 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-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB3PR0502MB3980; 23:mal4Al3BcrEaS7EMTUeNOgxKHm1t3J6vUYfIDF9?= =?us-ascii?Q?2phFy+VELEFl4V0k5MIarhgX6StFOvnRTMQ6hyVKaZ0MSWUaGLN8l0yYwOTG?= =?us-ascii?Q?ejMN8MRIGhTaQqAZKIvx3ZHUT5iuIwUAoWnAdh3kqbYpm8F0yyggihtkQO25?= =?us-ascii?Q?k9nbgvVPi1V/ajcs9B2U+yM/ZFX3typ/Rp3R32mK2f4emO/Dlxflf5ViULzp?= =?us-ascii?Q?F6SGGtSuMffhUGZ7oGO0RZzAFrL7weYaQS+tSU3Ycofq+PGyZLq+1pPTzoOy?= =?us-ascii?Q?h//pPDYlzfVGFvLGCu+UwjuTSRKxKZKqUevbk6/59LTMPfLMJoSPsI0Boems?= =?us-ascii?Q?IkUFUMb8Hy0DLJQMzwC/c9N0+PxouGhfcmSIdOpGvXNvhScFLSzNCq+J5aXH?= =?us-ascii?Q?lInrizNb9SaBbn0MintxPerzU8SilAK+VybPwXXUyN74wI7nokpW1Pqgtndd?= =?us-ascii?Q?QnyCLkk+xm7L9o4oHzHbTqDahha6/qWkw330SHjllt83eq5+wV4osFBwyfw/?= =?us-ascii?Q?MNwZtSd0revf8cMqyvoGtoO5kQBmHW6Mm13NTD13cs1d8HF7VEsiOXea3yM+?= =?us-ascii?Q?PSNNP3ubzD01b9u4I5UuvzQGNlUfCgS1yV2WHAOnVSqpzjcJCYpywrr+oZeS?= =?us-ascii?Q?AtlrAwrK2wi65P0c2kA64i4w69nIcfouorg8tSg6FrKroxuuGLnKG4dSAN+v?= =?us-ascii?Q?XXbahUcn2aN3FLtv8av0n+GV4B7vipIPTj/7vOtbio6AHUitjtLR/8mYXx/y?= =?us-ascii?Q?zz6X1G/zqkVXuYClQjzShA95VKjorGJSUlD5YUvXmwuwvPPovRp9rJWJqCZs?= =?us-ascii?Q?+3OgjGOhpf9oP12i5JNKjzUSxK48C8dkkwD0fH6mQusqu0bZiqrKVy5N9qOu?= =?us-ascii?Q?3xOkRIhe0BQ/f+t8m4tTNyvFx4i2hcHdYtDLeQlIqXq2DUBgDS13FzU06fm7?= =?us-ascii?Q?bEdCsiG7M9hoapjT75Txv+TaAW4REW1pGt76/fOQfkqmuAWGsDjYypAMn1o0?= =?us-ascii?Q?/kZ5baT79CkkguWmo3c1ZFf3HeLFHptnPwTXm3iUviynvPvCYWBpPlUZHwlf?= =?us-ascii?Q?2GtgWUE6Rxqr2tt0t4AXe/zOWN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dMPKf2Pj7IRrCgigXEtys+9rRReU9es6TChwk0dDQqzW82f/EV77Z3kI5zcQdKtDgwXZvTLrou7/NgGHybLxEYPsROjOOi4nWmS7xnuxFnduFaoACcA9ihSgA==; 5:vCCx0IS635cYcdMsGxVOiQgpCxkq+n2QkER1cA3a1ATUl7YrWEURBlnqhDxbY5OENMdzatzAemw6K4UzdYDmTxAD7DLhO5P04bM7D1HgNrAwN73GWSoq54W540wEJovmaeN+aCj+Qrdvf//svI6bguEfrNOED+A/UZoWaDsLIPg=; 7:fXrKdtoXaUznlY9Oe2tH8b6lcZLxl4S94Y4polk4fls56C0x5O9jdsJbOVZqDkzesA1mNLMQYlTnmcK6q9laad4NR8zNv010KJ23PATPBJz3yB+SZY2jVoxar9O1Vp0dp88F/iErzHyjCIMwK/wMohf/JRofCxUFTcppaZTyzctHNXMI59kxCVvSW0KMN/5lLsuggjEXNSnlOFoy9iv/dgrfXDIMgs0hCwUt5KYUvZ8LoQrLCUNTCVREDNzGp+PG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2018 21:31:53.0443 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69a3ddc8-ba3b-49b2-ceaa-08d6093fd91a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3980 Subject: Re: [dpdk-dev] [RFC] ethdev: support metadata as flow rule criteria 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: , X-List-Received-Date: Thu, 23 Aug 2018 21:31:57 -0000 On Wed, Aug 22, 2018 at 04:31:14PM +0300, Andrew Rybchenko wrote: > On 13.08.2018 10:46, Dekel Peled wrote: > > Current implementation of rte_flow allows match pattern of flow rule, > > based on packet data or header fields. > > This limits the application use of match patterns. > > > > For example, consider a vswitch application which controls a set of VMs, > > connected with virtio, in a fabric with overlay of VXLAN. > > Several VMs can have the same inner tuple, while the outer tuple is > > different and controlled by the vswitch (encap action). > > For the vswtich to be able to offload the rule to the NIC, it must use a > > unique match criteria, independent from the inner tuple, to perform the > > encap action. > > > > This RFC adds support for additional metadata to use as match pattern. > > The metadata is an opaque item, fully controlled by the application. > > > > The use of metadata is relevant for egress rules only. > > It can be set in the flow rule using the RTE_FLOW_ITEM_META. > > > > Application should set the packet metdata in the mbuf->metadata field, > > and set the PKT_TX_METADATA flag in the mbuf->ol_flags. > > The NIC will use the packet metadata as match criteria for relevant flow > > rules. > > > > For example, to do an encap action depending on the VM id, the > > application needs to configure 'match on metadata' rte_flow rule with > > VM id as metadata, along with desired encap action. > > When preparing an egress data packet, application will set VM id data in > > mbuf metadata field and set PKT_TX_METADATA flag. > > > > PMD will send data packets to NIC, with VM id as metadata. > > Egress flow on NIC will match metadata as done with other criteria. > > Upon match on metadata (VM id) the appropriate encap action will be > > performed. > > > > This RFC introduces metadata item type for rte_flow RTE_FLOW_ITEM_META, > > along with corresponding struct rte_flow_item_meta and ol_flag > > PKT_TX_METADATA. > > It also enhances struct rte_mbuf with new data item, uint64_t metadata. > > > > Comments are welcome. > > > > Signed-off-by: Dekel Peled > > --- > > doc/guides/prog_guide/rte_flow.rst | 21 +++++++++++++++++++++ > > lib/librte_ethdev/rte_flow.c | 1 + > > lib/librte_ethdev/rte_flow.h | 25 +++++++++++++++++++++++++ > > lib/librte_mbuf/rte_mbuf.h | 11 +++++++++++ > > 4 files changed, 58 insertions(+) > > > > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst > > index b305a72..b6e35f1 100644 > > --- a/doc/guides/prog_guide/rte_flow.rst > > +++ b/doc/guides/prog_guide/rte_flow.rst > > @@ -1191,6 +1191,27 @@ Normally preceded by any of: > > - `Item: ICMP6_ND_NS`_ > > - `Item: ICMP6_ND_OPT`_ > > +Item: ``META`` > > +^^^^^^^^^^^^^^ > > + > > +Matches an application specific 64 bit metadata item. > > + > > +- Default ``mask`` matches any 64 bit value. > > + > > +.. _table_rte_flow_item_meta: > > + > > +.. table:: META > > + > > + +----------+----------+---------------------------+ > > + | Field | Subfield | Value | > > + +==========+==========+===========================+ > > + | ``spec`` | ``data`` | 64 bit metadata value | > > + +----------+--------------------------------------+ > > + | ``last`` | ``data`` | upper range value | > > + +----------+----------+---------------------------+ > > + | ``mask`` | ``data`` | zeroed to match any value | > > + +----------+----------+---------------------------+ > > + > > Actions > > ~~~~~~~ > > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > > index cff4b52..54e5ef8 100644 > > --- a/lib/librte_ethdev/rte_flow.c > > +++ b/lib/librte_ethdev/rte_flow.c > > @@ -66,6 +66,7 @@ struct rte_flow_desc_data { > > sizeof(struct rte_flow_item_icmp6_nd_opt_sla_eth)), > > MK_FLOW_ITEM(ICMP6_ND_OPT_TLA_ETH, > > sizeof(struct rte_flow_item_icmp6_nd_opt_tla_eth)), > > + MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)), > > }; > > /** Generate flow_action[] entry. */ > > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > > index f8ba71c..b81c816 100644 > > --- a/lib/librte_ethdev/rte_flow.h > > +++ b/lib/librte_ethdev/rte_flow.h > > @@ -413,6 +413,15 @@ enum rte_flow_item_type { > > * See struct rte_flow_item_mark. > > */ > > RTE_FLOW_ITEM_TYPE_MARK, > > + > > + /** > > + * [META] > > + * > > + * Matches a metadata value specified in mbuf metadata field. > > + * > > + * See struct rte_flow_item_meta. > > + */ > > + RTE_FLOW_ITEM_TYPE_META, > > }; > > /** > > @@ -849,6 +858,22 @@ struct rte_flow_item_gre { > > #endif > > /** > > + * RTE_FLOW_ITEM_TYPE_META. > > + * > > + * Matches a specified metadata value. > > + */ > > +struct rte_flow_item_meta { > > + uint64_t data; > > +}; > > + > > +/** Default mask for RTE_FLOW_ITEM_TYPE_META. */ > > +#ifndef __cplusplus > > +static const struct rte_flow_item_meta rte_flow_item_meta_mask = { > > + .data = RTE_BE64(UINT64_MAX), > > +}; > > +#endif > > + > > +/** > > * RTE_FLOW_ITEM_TYPE_FUZZY > > * > > * Fuzzy pattern match, expect faster than default. > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > > index 9ce5d76..8f06a78 100644 > > --- a/lib/librte_mbuf/rte_mbuf.h > > +++ b/lib/librte_mbuf/rte_mbuf.h > > @@ -182,6 +182,11 @@ > > /* add new TX flags here */ > > /** > > + * This flag indicates that the metadata field in the mbuf is in use. > > + */ > > +#define PKT_TX_METADATA (1ULL << 41) > > + > > +/** > > * UDP Fragmentation Offload flag. This flag is used for enabling UDP > > * fragmentation in SW or in HW. When use UFO, mbuf->tso_segsz is used > > * to store the MSS of UDP fragments. > > @@ -593,6 +598,12 @@ struct rte_mbuf { > > */ > > struct rte_mbuf_ext_shared_info *shinfo; > > + /** > > + * Application specific metadata value for flow rule match. > > + * Valid if PKT_TX_METADATA is set. > > + */ > > + uint64_t metadata; > > + > > I don't see the difference from hash union which is 64-bit wide as well. > hash.fdir.hi is used by flow mark action and mark match item (but just > 32-bit). Rx metadata would be different from flow mark ID. Mark ID is set when the flow is created (it is a kind of marking classification result) but metadata could be sent by other entity, e.g. VM-to-VM traffic or VM-to-HV traffic. Thanks, Yongseok > > > } __rte_cache_aligned; > > /** >