From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 0FC63B38D for ; Sun, 5 Jul 2015 12:02:42 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 05 Jul 2015 03:02:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,409,1432623600"; d="scan'208";a="740854847" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga001.fm.intel.com with ESMTP; 05 Jul 2015 03:02:41 -0700 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.200]) by IRSMSX101.ger.corp.intel.com ([169.254.1.201]) with mapi id 14.03.0224.002; Sun, 5 Jul 2015 11:02:40 +0100 From: "Tahhan, Maryam" To: "Tahhan, Maryam" , Olivier MATZ , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 2/7] ixgbe: add functions to get and reset xstats Thread-Index: AQHQsA/02/X1giN3pEarMnxmZb9IlJ3Js/kAgAAAzQCAAvTm0IAACN4A Date: Sun, 5 Jul 2015 10:02:40 +0000 Message-ID: <1A27633A6DA49C4A92FCD5D4312DBF536A45ADE9@IRSMSX109.ger.corp.intel.com> References: <1435323558-169985-1-git-send-email-maryam.tahhan@intel.com> <1435323558-169985-3-git-send-email-maryam.tahhan@intel.com> <55968B1C.6070405@6wind.com> <55968BC8.1060704@6wind.com> <1A27633A6DA49C4A92FCD5D4312DBF536A45ADD4@IRSMSX109.ger.corp.intel.com> In-Reply-To: <1A27633A6DA49C4A92FCD5D4312DBF536A45ADD4@IRSMSX109.ger.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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 2/7] ixgbe: add functions to get and reset xstats X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jul 2015 10:02:43 -0000 >=20 >=20 > > > > > > >> + > > >> + total_missed_rx =3D 0; > > >> + total_qbrc =3D 0; > > >> + total_qprc =3D 0; > > >> + total_qprdc =3D 0; > > >> + rxnfgpc =3D 0; > > >> + txdgpc =3D 0; > > >> + count =3D 0; > > >> + > > >> + ixgbe_read_stats_registers(hw, hw_stats, &total_missed_rx, > > &total_qbrc, > > >> + &total_qprc, > > &rxnfgpc, &txdgpc, &total_qprdc); > > >> + > > >> + if (!xstats) > > >> + return 0; > > > > > > this cannot happen except if n =3D=3D 0. > > > This condition is already tested above, and "count" should be returne= d. > > > > > >> + > > >> + /* Error stats */ > > >> + for (i =3D 0; i < RTE_NB_XSTATS; i++) { > > >> + snprintf(xstats[count].name, sizeof(xstats[count].name), > > >> + "%s", rte_ixgbe_stats_strings[i].name); > > >> + xstats[count++].value =3D *(uint64_t *)(((char *)hw_stats) + > > >> + > > rte_ixgbe_stats_strings[i].offset); > > >> + } > > >> + > > >> + return count; > > >> +} > > > > > > Shouldn't it be xstats[i] instead of xstats[count] ? > > > > > > Does it work when using "show port in test-pmd"? > > > > ok I missed the 'count =3D 0' above. > > So why using count instead of i ? > > > > Also, I think it would be clearer to use the constant IXGBE_NB_XSTATS > > instead of count at the beginning of the function. > > > > >=20 > Hi Olivier >=20 > Actually, count should not be 0, it should be n, which is the passed in i= ndex > from rte_eth_xstats_get()... >=20 > Because we fill out the generic stats first in rte_eth_xstats_get() then = we call > ixgbe_dev_xstats_get to fill out the rest. >=20 > I will fix this up Hi Olivier,=20 I confused this change with a subsequent patch in the patch set... so yes f= or this patch you are correct we can just use i... and leave count as 0.=20 in a subsequent patch I modify count to start at n, which is a passed in in= dex from in rte_eth_xstats_get()... so I will change count for i in the loop here.=20 > > > > > >> + > > >> +static void > > >> +ixgbe_dev_xstats_reset(struct rte_eth_dev *dev) { > > >> + struct ixgbe_hw_stats *stats =3D > > >> + IXGBE_DEV_PRIVATE_TO_STATS(dev->data- > > >dev_private); > > >> + > > >> + /* HW registers are cleared on read */ > > >> + ixgbe_dev_xstats_get(dev, NULL, RTE_NB_XSTATS); > > >> + > > >> + /* Reset software totals */ > > >> + memset(stats, 0, sizeof(*stats)); } > > >> + > > >> static void > > >> ixgbevf_dev_stats_get(struct rte_eth_dev *dev, struct > > >> rte_eth_stats > > >> *stats) { > > >>