From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id A01A9952 for ; Mon, 6 Mar 2017 21:41:30 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP; 06 Mar 2017 12:41:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,255,1484035200"; d="scan'208";a="72892264" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga005.fm.intel.com with ESMTP; 06 Mar 2017 12:41:29 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 6 Mar 2017 12:41:28 -0800 Received: from fmsmsx113.amr.corp.intel.com ([169.254.13.172]) by FMSMSX114.amr.corp.intel.com ([10.18.116.8]) with mapi id 14.03.0248.002; Mon, 6 Mar 2017 12:41:28 -0800 From: "Wiles, Keith" To: Thomas Monjalon CC: "Dumitrescu, Cristian" , DPDK , "jerin.jacob@caviumnetworks.com" , "balasubramanian.manoharan@cavium.com" , "hemant.agrawal@nxp.com" , "shreyansh.jain@nxp.com" , "Richardson, Bruce" Thread-Topic: [PATCH v3 1/2] ethdev: add capability control API Thread-Index: AQHSlpeqbOHz0w9xmUeucMjNJegaXqGIjlaAgAAZYgCAAB+zgIAABY+A Date: Mon, 6 Mar 2017 20:41:27 +0000 Message-ID: <77383876-70CD-4F81-B179-B95ED52933D6@intel.com> References: <1488589820-206947-1-git-send-email-cristian.dumitrescu@intel.com> <12629083.yAQ7FffjSn@xps13> <3EB4FA525960D640B5BDFFD6A3D891265275B202@IRSMSX108.ger.corp.intel.com> <10140076.z0k8vql8dv@xps13> In-Reply-To: <10140076.z0k8vql8dv@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.255.71.106] Content-Type: text/plain; charset="us-ascii" Content-ID: <9EB0FE91D373DD41ABD7E7C150C476C5@intel.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 1/2] ethdev: add capability control API 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: Mon, 06 Mar 2017 20:41:31 -0000 > On Mar 6, 2017, at 2:21 PM, Thomas Monjalon w= rote: >=20 >> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] >>> 2017-03-06 16:35, Dumitrescu, Cristian: >>>>>> +int rte_eth_dev_capability_ops_get(uint8_t port_id, >>>>>> + enum rte_eth_capability cap, void *arg); >>>>>=20 >>>>> What is the benefit of getting different kind of capabilities with >>>>> the same function? >>>>> enum + void* =3D ioctl >>>>> A self-explanatory API should have a dedicated function for each kind >>>>> of features with different argument types. >>>>=20 >>>> The advantage is providing a standard interface to query the capabilit= ies of >>> the device rather than having each capability provide its own mechanism= in a >>> slightly different way. >>>>=20 >>>> IMO this mechanism is of great help to guide the developers of future >>> ethdev features on the clean path to add new features in a modular way, >>> extending the ethdev functionality while doing so in a separate name sp= ace >>> and file (that's why I tend to call this a plugin-like mechanism), as o= pposed to >>> the current monolithic approach for ethdev, where we have 100+ API >>> functions in a single name space and that are split into functional gro= ups just >>> by blank lines in the header file. It is simply the generalization of t= he >>> mechanism introduced by rte_flow in release 17.02 (so all the credit sh= ould >>> go to Adrien and not me). >>>>=20 >>>> IMO, having a standard function as above it cleaner than having a sepa= rate >>> and slightly different function per feature. People can quickly see the= set of >>> standard ethdev capabilities and which ones are supported by a specific >>> device. Between A) and B) below, I definitely prefer A): >>>> A) status =3D rte_eth_dev_capability_ops_get(port_id, >>> RTE_ETH_CABABILITY_TM, &tm_ops); >>>> B) status =3D rte_eth_dev_tm_ops_get(port_id, &tm_ops); >>>=20 >>> I prefer B because instead of tm_ops, you can use some specific tm >>> arguments, >>> show their types and properly document each parameter. >>=20 >> Note that rte_flow already returns the flow ops as a void * with no stro= ng argument type checking (approach A from above). Are you saying this is w= rong? >>=20 >> rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_GENERIC, RTE_ETH_FILTER= _GET, void *eth_flow_ops); >>=20 >> Personally, I am in favour of allowing the standard interface at the exp= ense of strong build-time type checking. Especially that this API function = is between ethdev and the drivers, as opposed to between app and ethdev. >=20 > rte_eth_dev_filter_ctrl is going to be specialized in rte_flow operations= . > I agree with you on having independent API blocks in ethdev like rte_flow= . > But this function rte_eth_dev_capability_ops_get that you propose would b= e > cross-blocks. I don't see the benefit. > I especially don't think there is a sense in the enum > enum rte_eth_capability { > RTE_ETH_CAPABILITY_FLOW =3D 0, /**< Flow */ > RTE_ETH_CAPABILITY_TM, /**< Traffic Manager */ > RTE_ETH_CAPABILITY_MAX > } >=20 > I won't debate more on this. We have to read opinions of other reviewers. The benefit is providing a generic API, which we do not need to alter in th= e future (causing ABI breakage). The PMD can add a capability to the list i= f not present already and then provide a API structure for the feature. Being able to add features without having to change DPDK maybe a strong fea= ture for companies that have special needs for its application. They just n= eed to add a rte_eth_capability enum in a range that they want to control (= which does not mean they need to change the above structure) and they can p= rovide private features to the application especially if they are very spec= ific features to some HW. I do not like private features, but I also do not= want to stick just any old API in DPDK for any given special feature. Today the structure is just APIs, but it could also provide some special or= specific information to the application in that structure or via an API ca= ll. Regards, Keith