From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com [209.85.128.172]) by dpdk.org (Postfix) with ESMTP id 3D666914 for ; Mon, 6 Mar 2017 21:21:35 +0100 (CET) Received: by mail-wr0-f172.google.com with SMTP id l37so125151344wrc.1 for ; Mon, 06 Mar 2017 12:21:35 -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=fDGNO5TGweCYsxs4TNKDAyKzp1H8T5xQK6/fHQBURXY=; b=XcbruaZuIdFRoJ1A/+R4bFR1c1Y5vPEY0YSZpYFHPBpt6CWDWTzwoEb+3qRXxI8IA8 jrOhdPoC8eoghatDuYphrVlWbut01ZKAi5fLROudB+lxqZSg7gCaQ6jXSKUAiW4Gbobk AZU0XGTnSsD45HdCIBI//SbgzH+xcEVS0hEgjzCdF3Ttt9kljmlzaOd4rFFYTr7f3Eof EVom2pxo3Uzg3XPLr80BSAb7oVeA4zks5/LDaizLZyFRxKP8g4u254sJv0+KERAkyD4J Ivyj4P9LbqBFz7SkxIIyt1OFbuN6abvbS4t48Ey/+/BAifwIGDiRuOjtuC6OLpEHtC5m N4hw== 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=fDGNO5TGweCYsxs4TNKDAyKzp1H8T5xQK6/fHQBURXY=; b=hl47lGeFUecNqsfUCuiEaTfbsGBeNzZjr2Hb6uAGQvWUtGNGYMHnQwU0HflFil/XIz zlSYV4EJWVOqTVgVGQOFKVJYf2FRScfJVyRbgtg3R57PDdmMbA3m+f4bw2UNtUcU3r1J DxvLJ2G6M0Xj29esUC9vdTMnZGL7EMxeLOFnv2UeMGKBXH3zFo3Pi805hUXTUaMEga/b XVeAyE5XYJNcwkKUPk2Ma82Vqc36CClw+68whGWRXtC/s7VzEGcNPAw5cBs1FXL7I2wt uVdqrJAgjwGCJchWn3+c4o0aPDQpdZ+HkMzD9ckAJAknMSM+X2+biy5RVgBn+yfZDgrZ E3DA== X-Gm-Message-State: AMke39miAAX7UXRMW+oebe1hQ8mYPvtk1oYzZzQzl29fvEagG86JW3HIuMcX2bxMgBxxMblL X-Received: by 10.223.170.73 with SMTP id q9mr15903301wrd.13.1488831694951; Mon, 06 Mar 2017 12:21:34 -0800 (PST) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id j80sm16152889wmd.14.2017.03.06.12.21.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 12:21:34 -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 21:21:33 +0100 Message-ID: <10140076.z0k8vql8dv@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D891265275B202@IRSMSX108.ger.corp.intel.com> References: <1488589820-206947-1-git-send-email-cristian.dumitrescu@intel.com> <12629083.yAQ7FffjSn@xps13> <3EB4FA525960D640B5BDFFD6A3D891265275B202@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 20:21:35 -0000 > 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); > > > > > > > > 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. > > 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 wrong? > > rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_GENERIC, RTE_ETH_FILTER_GET, void *eth_flow_ops); > > Personally, I am in favour of allowing the standard interface at the expense of strong build-time type checking. Especially that this API function is between ethdev and the drivers, as opposed to between app and ethdev. 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 be 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 = 0, /**< Flow */ RTE_ETH_CAPABILITY_TM, /**< Traffic Manager */ RTE_ETH_CAPABILITY_MAX } I won't debate more on this. We have to read opinions of other reviewers.