From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yang, Zhiyong" Subject: Re: [PATCH v2] net/vhost: add pmd xstats Date: Fri, 9 Sep 2016 08:54:50 +0000 Message-ID: References: <1471608966-39077-1-git-send-email-zhiyong.yang@intel.com> <1473408927-40364-1-git-send-email-zhiyong.yang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "yuanhan.liu@linux.intel.com" , "thomas.monjalon@6wind.com" To: "Van Haaren, Harry" , "dev@dpdk.org" Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 527685A72 for ; Fri, 9 Sep 2016 10:55:29 +0200 (CEST) In-Reply-To: Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, Harry: Your idea looks very good. Thanks --Zhiyong > -----Original Message----- > From: Van Haaren, Harry > Sent: Friday, September 9, 2016 4:41 PM > To: Yang, Zhiyong ; dev@dpdk.org > Cc: yuanhan.liu@linux.intel.com; thomas.monjalon@6wind.com; > "mailto:pmatilai"@redhat.com; Yang, Zhiyong > Subject: RE: [dpdk-dev] [PATCH v2] net/vhost: add pmd xstats >=20 > Hi Zhiyong, >=20 > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhiyong Yang > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v2] net/vhost: add pmd xstats > > > > +struct vhost_xstats { > > + uint64_t stat[16]; > > +}; >=20 > Perhaps we could create an enum to access the stat array? >=20 > enum VHOST_STAT { > ... > VHOST_STAT_64_PKT, > ... > }; >=20 > > + {"broadcast_packets", > > + offsetof(struct vhost_queue, xstats.stat[8])}, >=20 > I think the "magic number" 8 here could be from the enum, and would be > more clear which statistic is being accessed. >=20 > > + if (pkt_len =3D=3D 64) { > > + xstats_update->stat[1]++; >=20 > Similarly, incrementing the counters would be more representative if it > looked like >=20 > xstats_update->stat[VHOST_STAT_64_PKT]++; /* or similar */ >=20 > -Harry