From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00081.outbound.protection.outlook.com [40.107.0.81]) by dpdk.org (Postfix) with ESMTP id D4BDC3772 for ; Wed, 22 Aug 2018 09:59:24 +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=MbgaA+IJEByKFLtoXSKf+Wmoa1erHPjIdWAyyfzKtr0=; b=L9wv/bHTUeG8/HhuboBqROz43siG6w9Wq+u0VdMD69ESuy0VRbNNP0tgDyO6K1GFEceZlk6mzPO3GGxOjWXjqK1WvCh+35JyYlGyyONnGtkaXyUEUvKuhsjP5zh4Hbn72BfAkZKs4JEYDuqjgGFr2HD9+fUg6qPnLJT2GO1Hlxw= Received: from VI1PR05MB4224.eurprd05.prod.outlook.com (52.133.12.13) by VI1PR05MB1472.eurprd05.prod.outlook.com (10.164.85.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.21; Wed, 22 Aug 2018 07:59:23 +0000 Received: from VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::4934:cd8f:bfc8:d6a8]) by VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::4934:cd8f:bfc8:d6a8%4]) with mapi id 15.20.1059.023; Wed, 22 Aug 2018 07:59:23 +0000 From: Dekel Peled To: "Ananyev, Konstantin" , "dev@dpdk.org" , Adrien Mazarguil , "olivier.matz@6wind.com" CC: Ori Kam , Shahaf Shuler Thread-Topic: [RFC] ethdev: support metadata as flow rule criteria Thread-Index: AQHUMtnfoKZmLsKuaEqZDNcdM8RhdKS9UDhAgAzqGwCAAAPWQA== Date: Wed, 22 Aug 2018 07:59:23 +0000 Message-ID: References: <1534146418-1060-1-git-send-email-dekelp@mellanox.com> <2601191342CEEE43887BDE71AB977258E9FA2D49@IRSMSX102.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB977258E9FA2D49@IRSMSX102.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=dekelp@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR05MB1472; 6:FsR5bUor7MKyAiM6epI6GSm3uKy8MKg/9gf/PQdqKKogeLl5gAB9/yaWmS650WMuhpMkFgdwLXnMPlAT+cjnQghUbBg3IDIpUBO+cE3LN876b0nhiheWEgze0daiAxNLm9ZmhOJ8BlllenIsIgAAGXmsBR5aOUXrnTb1x3kVpPjgWnO+v/NV3eDCcp6+UJdWHqgDc3tRI0s9yuEdTQkRe+taQ6NV2CvpuU7mPlhXxlyaVqT4YCBFbmaL7Xz90ASN7UrFv/e268ZNaoX2o4AMEIgTsuslK8y6hYwwD/Lph6EF7unfcUnCswk2R3+t/vZB/NxsBVcrPvXJje7hTKjNyl2ZouDeQcKLEtuyEmhjRwAnnVh91lyhZF8R3jIivnkiXqLiQWrgO/DdDXOkI5InHSEX6DSpcwlyYBJxpn8tczAhIne4O0XHqNi5WL5yKeOWqLPXN3Bhy4skIASMClsGFA==; 5:S8UZwNGm+mWO08syIwbGZ96Bq25hqNagD7DaLh7+p6NLo6tdW3kXtZJPFrs64o+fUPR2qrmPGh+W+4fZqh7rf0tN0tPwYgxF0qxj46yHmtJipXLVuTKDYjWyyqXUnebOuKdB1yGl1+ZgwFrWZc/FM5FzUnYczQstvGk5DKu/kKQ=; 7:WhBB+s0NPpDiR7USMYkh2J81Rj4bxdKd9Iacqbeh2NcYMJU79J8g7qeR/pcAlW0HUncK01+BakYUgN5IJbMLRjJpDA6phnqWdwzg4N8a2vutqLw7U4Lyz+Xiwu0mDBcfpw1lqnQRdNdnvYIDmE40dqE1vcKaY6ffrNsq7iSnI84ioMPiv9YTu6wtdGOOx4iQiIxdsm76IvcaJZShRLc2CfEauJoKnS5NVTLFsqqwSfdJHzK72KaofN1ROJKsv0fr x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: fc2fb07a-fb30-46d7-3233-08d608052c8c 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:VI1PR05MB1472; x-ms-traffictypediagnostic: VI1PR05MB1472: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699)(17755550239193); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(823301075)(3231311)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016); SRVR:VI1PR05MB1472; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB1472; x-forefront-prvs: 0772E5DAD5 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(376002)(366004)(346002)(396003)(13464003)(199004)(189003)(74316002)(110136005)(102836004)(11346002)(5660300001)(33656002)(256004)(486006)(14454004)(476003)(76176011)(3846002)(107886003)(446003)(54906003)(316002)(66066001)(478600001)(99286004)(6116002)(186003)(4326008)(7696005)(2900100001)(105586002)(25786009)(6436002)(81166006)(7736002)(8676002)(106356001)(2906002)(53546011)(2501003)(68736007)(6246003)(81156014)(26005)(9686003)(8936002)(53936002)(6506007)(86362001)(5250100002)(55016002)(229853002)(97736004)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB1472; H:VI1PR05MB4224.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: BxZBT+b6cd5OeMengIqSiomVuqFCWSh8ny/PF/OqwrBSg8UxnUUTqOIXrpe3Go/5KLRoCY2wVYLb0vbR2JZF8UIO+1KwQDkqBOSas8Veen2tgWJYcF4im1MfgUPu6jdsji3o7Py4aDvdtV1GZs3I3oee7TjUpasIEfqHyM62qxaCkauWiJpagN7sCvY21XWXUwvo1FyPxHC8JVdN71ozdSS0QeVeRLHOFwMKQa9YtIpAwRUtrOGgxtiFNNkG+vd1V4kAUfwAVk1o3QsS84kuBWZLBtF9tfV4VeL8NsrV0CUFwDHbd4/VikMntDiG/9KbEojkFy2ZKAx+C1i8dbZKRt8DzNAIWLx3uQ3WmGtrlwY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc2fb07a-fb30-46d7-3233-08d608052c8c X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Aug 2018 07:59:23.3587 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB1472 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: Wed, 22 Aug 2018 07:59:25 -0000 Thanks, PSB. > -----Original Message----- > From: Ananyev, Konstantin [mailto:konstantin.ananyev@intel.com] > Sent: Tuesday, August 21, 2018 4:08 PM > To: Dekel Peled ; dev@dpdk.org; Adrien Mazarguil > ; olivier.matz@6wind.com > Cc: Ori Kam ; Shahaf Shuler > > Subject: RE: [RFC] ethdev: support metadata as flow rule criteria >=20 >=20 >=20 > > > > > -----Original Message----- > > > From: Dekel Peled [mailto:dekelp@mellanox.com] > > > Sent: Monday, August 13, 2018 10:47 AM > > > To: dev@dpdk.org > > > Cc: Ori Kam ; Shahaf Shuler > > > > > > Subject: [RFC] ethdev: support metadata as flow rule criteria > > > > > > 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 f= low > 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 metadat= a. > > > > > > 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 | > > > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D+ > > > + | ``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 =3D { > > > + .data =3D 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 UD= P > > > * 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; > > > + >=20 > Just one thought - with that change we'll have only 8 free bytes left ins= ide > rte_mbuf. > Wonder tan this metadata field be combined within tx_offload or probably > hash fields? > Konstantin The match on metadata feature is currently implemented for egress, but is p= lanned to be extended for ingress use in the future. Hence the need for dedicated field, detached from Tx specific or Rx specifi= c fields. Dekel >=20 >=20 > > > } __rte_cache_aligned; > > > > > > /** > > > -- > > > 1.8.3.1