From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dumitrescu, Cristian" Subject: Re: [PATCH v3 1/2] ethdev: add capability control API Date: Mon, 6 Mar 2017 16:35:26 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D8912652759FC7@IRSMSX108.ger.corp.intel.com> References: <1488589820-206947-1-git-send-email-cristian.dumitrescu@intel.com> <1488589820-206947-2-git-send-email-cristian.dumitrescu@intel.com> <2480022.hlQWxlV5d8@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "jerin.jacob@caviumnetworks.com" , "balasubramanian.manoharan@cavium.com" , "hemant.agrawal@nxp.com" , "shreyansh.jain@nxp.com" , "Wiles, Keith" , "Richardson, Bruce" To: Thomas Monjalon Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 23A2EFA86 for ; Mon, 6 Mar 2017 17:35:30 +0100 (CET) In-Reply-To: <2480022.hlQWxlV5d8@xps13> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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); >=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. The advantage is providing a standard interface to query the capabilities o= f 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 ethde= v features on the clean path to add new features in a modular way, extendin= g the ethdev functionality while doing so in a separate name space and file= (that's why I tend to call this a plugin-like mechanism), as opposed to th= e current monolithic approach for ethdev, where we have 100+ API functions = in a single name space and that are split into functional groups just by bl= ank lines in the header file. It is simply the generalization of the mechan= ism introduced by rte_flow in release 17.02 (so all the credit should go to= Adrien and not me). IMO, having a standard function as above it cleaner than having a separate = 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); Regards, Cristian