From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 790F69655 for ; Sun, 5 Jul 2015 11:34:58 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 05 Jul 2015 02:34:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,409,1432623600"; d="scan'208";a="519079223" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by FMSMGA003.fm.intel.com with ESMTP; 05 Jul 2015 02:34:57 -0700 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.200]) by IRSMSX102.ger.corp.intel.com ([169.254.2.117]) with mapi id 14.03.0224.002; Sun, 5 Jul 2015 10:34:22 +0100 From: "Tahhan, Maryam" To: 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/kAgAAAzQCAAvTm0A== Date: Sun, 5 Jul 2015 09:34:22 +0000 Message-ID: <1A27633A6DA49C4A92FCD5D4312DBF536A45ADD4@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> In-Reply-To: <55968BC8.1060704@6wind.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 09:34:59 -0000 > > > >> + > >> + 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 returned. > > > >> + > >> + /* 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"? >=20 > ok I missed the 'count =3D 0' above. > So why using count instead of i ? >=20 > Also, I think it would be clearer to use the constant IXGBE_NB_XSTATS ins= tead > of count at the beginning of the function. >=20 >=20 Hi Olivier Actually, count should not be 0, it should be n, which is the passed in ind= ex from rte_eth_xstats_get()... 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. I will fix this up > > > >> + > >> +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) { > >>