From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f173.google.com (mail-wr0-f173.google.com [209.85.128.173]) by dpdk.org (Postfix) with ESMTP id 609F66CD4 for ; Mon, 6 Mar 2017 17:57:17 +0100 (CET) Received: by mail-wr0-f173.google.com with SMTP id u108so121066697wrb.3 for ; Mon, 06 Mar 2017 08:57:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=zob0Wy2bJLdxUJAv3iWlEmN9N17QoTFk34R5D0axPYg=; b=LN01hhFoVyIbTyYRKHBhGex0RmDcrI7adh0daD1sy2bWIT+FrEJR9hJbLL/e8bbAmy IOxo4zq8fIzbs1TzyoYXAm2DjSBmY33WjouHRotuCku+f8BYsnIs2yyjmSDIxxqmPLFX lH3UKZWy/4EpCFFTECQzbXUIXhdEdrxMv2HoYHgqkUV93/7lZd1KwFwPEbCEWp/G/3gQ mf2NQJpo05qYvawLF4nSWCJCw6YpKkgl/lZ2evE9lrhdXPiES92PYm9WKTHJH+/S3Qaj BLliGnk0WY0QgQ9NOmLtVVgaxzMtnNTNq01ObzhH9Aa73J3N1Go/ui4ia0Klhsj30aKN +DcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=zob0Wy2bJLdxUJAv3iWlEmN9N17QoTFk34R5D0axPYg=; b=qTmMpQByZtgBS0tpO1UDKH2W5j3asHtC8RlFud5NfbxrHt7IIn0jzcCe8dvFpcKZAW 1BO53JkevXg7M4ZjB+ZnVF74sV8tzrlKw2vdZQiC5mj/f6fOTzyU15CtjfU/yTVw0XUa /Yodxo02WMrkFkSf8dATNcpJnNm9QHm6CVuL2xrbbwisUMvls2uoErVuwRAGgDE8eEVp qPTFNnRHhmepXKUVuAuQimzRvSZxkcIaOuh8yEiOfPQ0B9B/Qpea/hyuhMoudSZr+EFx EaLg+d3T2AjMNoPUkBMzpgpRcuWO9AY6ly9WgcKgTNxyvyWFfRBYqHOY1/RIACEqGIuo dVdw== X-Gm-Message-State: AMke39mecNV4gn2mqx+mX8j6huFb/SEnvAWH9bW17RyKBLX2OJhu18iX3WUuVBeEDVzuDBcS X-Received: by 10.223.161.213 with SMTP id v21mr14335466wrv.144.1488819437152; Mon, 06 Mar 2017 08:57:17 -0800 (PST) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id o15sm15562608wmd.10.2017.03.06.08.57.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 08:57:16 -0800 (PST) From: Thomas Monjalon 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" Date: Mon, 06 Mar 2017 17:57:15 +0100 Message-ID: <12629083.yAQ7FffjSn@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D8912652759FC7@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> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 16:57:17 -0000 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 = 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* = 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 of the device rather than having each capability provide its own mechanism in 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 space and file (that's why I tend to call this a plugin-like mechanism), as opposed to the 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 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 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 = rte_eth_dev_capability_ops_get(port_id, RTE_ETH_CABABILITY_TM, &tm_ops); > B) status = rte_eth_dev_tm_ops_get(port_id, &tm_ops); I prefer B because instead of tm_ops, you can use some specific tm arguments, show their types and properly document each parameter.