From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 169E75599 for ; Mon, 6 Mar 2017 19:28:10 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2017 10:28:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,254,1484035200"; d="scan'208";a="831573390" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by FMSMGA003.fm.intel.com with ESMTP; 06 Mar 2017 10:28:08 -0800 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by IRSMSX101.ger.corp.intel.com (163.33.3.153) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 6 Mar 2017 18:28:07 +0000 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.173]) by irsmsx112.ger.corp.intel.com ([169.254.1.175]) with mapi id 14.03.0248.002; Mon, 6 Mar 2017 18:28:07 +0000 From: "Dumitrescu, Cristian" To: Thomas Monjalon CC: "dev@dpdk.org" , "jerin.jacob@caviumnetworks.com" , "balasubramanian.manoharan@cavium.com" , "hemant.agrawal@nxp.com" , "shreyansh.jain@nxp.com" , "Wiles, Keith" , "Richardson, Bruce" Thread-Topic: [PATCH v3 1/2] ethdev: add capability control API Thread-Index: AQHSlmT9/DkS4b/2AkeHpbDSe8ZJ3KGH+A7AgAAQkYCAABafoA== Date: Mon, 6 Mar 2017 18:28:06 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891265275B202@IRSMSX108.ger.corp.intel.com> References: <1488589820-206947-1-git-send-email-cristian.dumitrescu@intel.com> <2480022.hlQWxlV5d8@xps13> <3EB4FA525960D640B5BDFFD6A3D8912652759FC7@IRSMSX108.ger.corp.intel.com> <12629083.yAQ7FffjSn@xps13> In-Reply-To: <12629083.yAQ7FffjSn@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDRiZGNlNTctZjFjNC00ZTY5LWIxYzAtZDVkZWVkNTA1OTM2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjIuMTEuMCIsIlRydXN0ZWRMYWJlbEhhc2giOiJJVWNiaGtFT2xhbVNkeVRvTnRTamZDZVV6YVhBdGxkNU13cEVINXFWV1hBPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" 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 18:28:11 -0000 > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Monday, March 6, 2017 4:57 PM > To: Dumitrescu, Cristian > Cc: dev@dpdk.org; jerin.jacob@caviumnetworks.com; > balasubramanian.manoharan@cavium.com; hemant.agrawal@nxp.com; > shreyansh.jain@nxp.com; Wiles, Keith ; Richardson, > Bruce > Subject: Re: [PATCH v3 1/2] ethdev: add capability control API >=20 > 2017-03-06 16:35, Dumitrescu, Cristian: > > Hi Thomas, > > > > Thanks for reviewing this proposal. > > > > > > > > Signed-off-by: Cristian Dumitrescu > > > > Acked-by: Keith Wiles > > > > Acked-by: Jerin Jacob > > > > Acked-by: Hemant Agrawal > > > [...] > > > > +enum rte_eth_capability { > > > > + RTE_ETH_CAPABILITY_FLOW =3D 0, /**< Flow */ > > > > + RTE_ETH_CAPABILITY_TM, /**< Traffic Manager */ > > > > + RTE_ETH_CAPABILITY_MAX > > > > +}; > > > [...] > > > > /** > > > > + * Take capability operations on an Ethernet device. > > > > + * > > > > + * @param port_id > > > > + * The port identifier of the Ethernet device. > > > > + * @param cap > > > > + * The capability of the Ethernet device > > > > + * @param arg > > > > + * A pointer to arguments defined specifically for the operation= . > > > > + * @return > > > > + * - (0) if successful. > > > > + * - (-ENOTSUP) if hardware doesn't support. > > > > + * - (-ENODEV) if *port_id* invalid. > > > > + */ > > > > +int rte_eth_dev_capability_ops_get(uint8_t port_id, > > > > + enum rte_eth_capability cap, void *arg); > > > > > > 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. > > > > The advantage is providing a standard interface to query the capabiliti= es of > the device rather than having each capability provide its own mechanism i= n a > slightly different way. > > > > 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 spac= e > and file (that's why I tend to call this a plugin-like mechanism), as opp= osed to > the current monolithic approach for ethdev, where we have 100+ API > functions in a single name space and that are split into functional group= s just > by blank lines in the header file. It is simply the generalization of the > mechanism introduced by rte_flow in release 17.02 (so all the credit shou= ld > go to Adrien and not me). > > > > IMO, having a standard function as above it cleaner than having a separ= ate > and slightly different function per feature. People can quickly see the s= et 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. Note that rte_flow already returns the flow ops as a void * with no strong = argument type checking (approach A from above). Are you saying this is wron= g? rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_GENERIC, RTE_ETH_FILTER_GE= T, void *eth_flow_ops); Personally, I am in favour of allowing the standard interface at the expens= e of strong build-time type checking. Especially that this API function is = between ethdev and the drivers, as opposed to between app and ethdev.