From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by dpdk.org (Postfix) with ESMTP id 50CD57286 for ; Thu, 15 Mar 2018 08:09:18 +0100 (CET) Received: by mail-lf0-f66.google.com with SMTP id x205-v6so8569215lfa.0 for ; Thu, 15 Mar 2018 00:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=jMyJp1yjMLhbdTHE8vlRf4y40A56P7x8ig5ZgFxrZ8k=; b=YsmVij/1rJsSgz033SQL7MND5ou+vKFZfvOz2jxgPl88dmKj13bEE2PTcSTWiGEW0b LoRFktdeshQ2b40UB07MyJE6x+tWLYeO7WkSIhrBDU/AiSLX1K0dStv06yctj9ImEo4c tKs88G0MO8gXtQ1Wyi+wcxwN4Pa71iGtJUeMO92lO5DO3VQWLKr/Nbsc0frYWqMVfZ5W TiafWW6JMk6jVFXWOM0WbaokDLqjqrvRp+mp5toU6pkJdZ+iqvpah9G6KPLb71aOeyt9 2qn5SkncgSPCWJR9mbXf/2Q0PIEtPagn7uad3KIIS1nxO7/QB+mRgyUGDYOVNwNMrL5e 3TDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=jMyJp1yjMLhbdTHE8vlRf4y40A56P7x8ig5ZgFxrZ8k=; b=R9oBOq707d1fFbp4b1FDlU0olBRrai/PL/w4uc92/l/d873mcGBQd88OtLKzdb9LsD 5HR3XBFgRTSS5ntrnSKZxWHp804neHTC6tbyqO/LIHq4ickO3F9as5d16I/unNVnJX5r SkcVqrNF+ilEo4mSC1mRfaoUUJ4peVfvPfaLFnNSzFMeVA61tXm9SAqsYuyFQVS6ky9b HECE9bvEZloUPH9yntlOqi5GR10/ysHPuB4y+YcvBPTxvGjsF+JAGAuYjWNYjlHDLLG9 AumC8RsH0lWffi8xZf83afHVj9r3x2WXXUmabe/CoPrsoMuvuEG2ZNTREEZFuFvC01MD YRog== X-Gm-Message-State: AElRT7Gcy+xaPZn1XOXC5w/7eoyAuKModIFa89yK3Ehfse5lEs1yJDjB XiEujY3Lrl8BJOhWbEaTVkN0dw== X-Google-Smtp-Source: AG47ELuUHjHYxH+LbxRpXK4LyfYQ4BuV+n7KjIUFIKnOsZFgylGzLo6k/qf8W+rSZ7qd4BWzaF40eg== X-Received: by 2002:a19:e418:: with SMTP id b24-v6mr5251403lfh.61.1521097756727; Thu, 15 Mar 2018 00:09:16 -0700 (PDT) Received: from localhost (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id v124-v6sm1007863lfa.67.2018.03.15.00.09.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 00:09:15 -0700 (PDT) Date: Thu, 15 Mar 2018 08:09:14 +0100 From: Tomasz Duszynski To: Ferruh Yigit Cc: Tomasz Duszynski , dev@dpdk.org, mw@semihalf.com, dima@marvell.com, nsamsono@marvell.com, jck@semihalf.com, jianbo.liu@arm.com Message-ID: <20180315070914.GA15180@sh> References: <1519222460-14605-1-git-send-email-tdu@semihalf.com> <1520844132-29969-1-git-send-email-tdu@semihalf.com> <1520844132-29969-7-git-send-email-tdu@semihalf.com> <8210985b-4898-88f1-2f90-0a69862078c1@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <8210985b-4898-88f1-2f90-0a69862078c1@intel.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2 6/8] net/mrvl: add extended statistics 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: Thu, 15 Mar 2018 07:09:18 -0000 On Wed, Mar 14, 2018 at 05:21:07PM +0000, Ferruh Yigit wrote: > On 3/12/2018 8:42 AM, Tomasz Duszynski wrote: > > Add extended statistics implementation. > > > > Signed-off-by: Natalie Samsonov > > Signed-off-by: Tomasz Duszynski > > <...> > > > @@ -1674,6 +1784,94 @@ mrvl_eth_filter_ctrl(struct rte_eth_dev *dev __r= te_unused, > > } > > } > > > > +/** > > + * DPDK callback to get xstats by id. > > + * > > + * @param dev > > + * Pointer to the device structure. > > + * @param ids > > + * Pointer to the ids table. > > + * @param values > > + * Pointer to the values table. > > + * @param n > > + * Values table size. > > + * @returns > > + * Number of read values, negative value otherwise. > > + */ > > +static int > > +mrvl_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, > > + uint64_t *values, unsigned int n) > > +{ > > + unsigned int i, num =3D RTE_DIM(mrvl_xstats_tbl); > > + uint64_t vals[n]; > > + int ret; > > + > > + if (!ids) { > > You will not get NULL ids, this case covered by ethdev layer, for both by= _id() > functions. > > > + struct rte_eth_xstat xstats[num]; > > + int j; > > + > > + ret =3D mrvl_xstats_get(dev, xstats, num); > > + for (j =3D 0; j < ret; i++) > > + values[j] =3D xstats[j].value; > > + > > + return ret; > > + } > > + > > + ret =3D mrvl_xstats_get_by_id(dev, NULL, vals, n); > > + if (ret < 0) > > + return ret; > > + > > + for (i =3D 0; i < n; i++) { > > + if (ids[i] >=3D num) { > > + RTE_LOG(ERR, PMD, "id value is not valid\n"); > > + return -1; > > + } > > + > > + values[i] =3D vals[ids[i]]; > > + } > > + > > + return n; > > +} > > + > > +/** > > + * DPDK callback to get xstats names by ids. > > + * > > + * @param dev > > + * Pointer to the device structure. > > + * @param xstats_names > > + * Pointer to table with xstats names. > > + * @param ids > > + * Pointer to table with ids. > > + * @param size > > + * Xstats names table size. > > + * @returns > > + * Number of names read, negative value otherwise. > > + */ > > +static int > > +mrvl_xstats_get_names_by_id(struct rte_eth_dev *dev, > > + struct rte_eth_xstat_name *xstats_names, > > + const uint64_t *ids, unsigned int size) > > +{ > > + unsigned int i, num =3D RTE_DIM(mrvl_xstats_tbl); > > + struct rte_eth_xstat_name names[num]; > > + > > + if (!ids) > > + return mrvl_xstats_get_names(dev, xstats_names, size); > > + > > + mrvl_xstats_get_names(dev, names, size); > > + for (i =3D 0; i < size; i++) { > > + if (ids[i] >=3D num) { > > + RTE_LOG(ERR, PMD, "id value is not valid"); > > + return -1; > > + } > > + > > + snprintf(xstats_names[i].name, RTE_ETH_XSTATS_NAME_SIZE, > > + "%s", names[ids[i]].name); > > + } > > + > > + return size; > > +} > > Specific to *_by_id() implementations, please check ethdev layer APIs for= these > devops, they already do same thing as you did here. > > These devops are to access specific ids efficiently with support of PMD, = if you > don't have a quick way to access to an extended stat by id, you may just = left > these unimplemented and abstraction layer will do the work for you, it is= up to you. Good point. Since *_by_id() are using xstats_get_names()/xstats_get() anyway they do not provide a real speedup. I'll drop that in v3. > > > Thanks, > ferruh -- - Tomasz Duszy=C5=84ski