From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id A65C72BF7 for ; Thu, 23 Aug 2018 17:34:52 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2018 08:34:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,278,1531810800"; d="scan'208";a="84336273" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.56]) ([10.237.221.56]) by orsmga001.jf.intel.com with ESMTP; 23 Aug 2018 08:34:49 -0700 To: Dekel Peled , "dev@dpdk.org" , Adrien Mazarguil , "olivier.matz@6wind.com" Cc: Ori Kam , Shahaf Shuler References: <1534146418-1060-1-git-send-email-dekelp@mellanox.com> From: Ferruh Yigit Openpgp: preference=signencrypt Message-ID: <6ee5f829-79bc-43dc-a2b5-aeacbad4fd62@intel.com> Date: Thu, 23 Aug 2018 16:34:49 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 15:34:53 -0000 On 8/13/2018 9:03 AM, Dekel Peled wrote: > Adding relevant maintainers. > >> -----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 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 Why not use mbuf->udata64 but add a new field? In your sample, the information that "metadata" contains the VM id needs to be implemented into PMD so that it can program HW accordingly, this is not flexible. What if app needs to provide another custom id, how PMD can know if provided metadata is VM id or custom id? Won't be better to provide an id_type and id_value, PMD can be implemented to behave different for id_type and use the id_value in the context of that type?