From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D69603796 for ; Mon, 23 Mar 2015 17:45:52 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 23 Mar 2015 09:45:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,452,1422950400"; d="scan'208";a="684340605" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by fmsmga001.fm.intel.com with ESMTP; 23 Mar 2015 09:45:45 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.47]) by IRSMSX102.ger.corp.intel.com ([169.254.2.9]) with mapi id 14.03.0224.002; Mon, 23 Mar 2015 16:45:45 +0000 From: "Ananyev, Konstantin" To: "stephen@networkplumber.org" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] ixgbe: do not include CRC in Tx byte count Thread-Index: AQHQNtVBX9zWu1q5E0qP5YOdYGVuXp0qm0yQ Date: Mon, 23 Mar 2015 16:45:44 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772582140700B@irsmsx105.ger.corp.intel.com> References: <1421994224-2127-1-git-send-email-stephen@networkplumber.org> In-Reply-To: <1421994224-2127-1-git-send-email-stephen@networkplumber.org> 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 Cc: Stephen Hemminger Subject: Re: [dpdk-dev] [PATCH] ixgbe: do not include CRC in Tx byte count 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: Mon, 23 Mar 2015 16:45:53 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of stephen@networkplumb= er.org > Sent: Friday, January 23, 2015 6:24 AM > To: dev@dpdk.org > Cc: Stephen Hemminger > Subject: [dpdk-dev] [PATCH] ixgbe: do not include CRC in Tx byte count >=20 > From: Stephen Hemminger >=20 > The ixgbe driver was including CRC in the transmit packet byte > count, but not for packets received. > This was notice when forwarding and > the number of bytes received was greater than the number of bytes transmi= tted > for the same number of packets. Make the driver behave like other > virtual devices and not include CRC in byte count. Use the same queue > counters already computed and used for Rx. About RX side stats - as I remember it depends to what value hw_stip_crc is= set at configure(). If hw_stip_crc=3D=3D1, then, yes CRC bytes are not included into QBRC valu= e. I If hw_stip_crc=3D=3D0, then CRC bytes are included into QBRC.=20 I.E: ./dpdk.org/x86_64-native-linuxapp-gcc/app/testpmd -c ff -n 4 -w 86:00.1 -- = -i --tx-queue-stats-mapping=3D'(0,0,0)' --rx-queue-stats-mapping=3D'(0,0,0)= ' --crc-strip testpmd> start testpmd> show port stats all ######################## NIC statistics for port 0 #######################= # RX-packets: 1 RX-errors: 0 RX-bytes:= 60 // sum of QBRC[] RX-badcrc: 0 RX-badlen: 0 RX-errors: = 0 RX-nombuf: 0 TX-packets: 1 TX-errors: 0 TX-bytes:= 64 //GOTC Stats reg 0 RX-packets: 1 RX-errors: 0 RX-bytes:= 60 //QBRC[0] ... Stats reg 0 TX-packets: 1 TX-bytes:= 60 // QBTC[0] ########################################################################= #### ./dpdk.org/x86_64-native-linuxapp-gcc/app/testpmd -c ff -n 4 -w 86:00.1 -- = -i --tx-queue-stats-mapping=3D'(0,0,0)' --rx-queue-stats-mapping=3D'(0,0,0)= ' testpmd> start testpmd> show port stats all ######################## NIC statistics for port 0 #####################= ### RX-packets: 1 RX-errors: 0 RX-bytes:= 64 // sum of QBRC[] RX-badcrc: 0 RX-badlen: 0 RX-errors: = 0 RX-nombuf: 0 TX-packets: 1 TX-errors: 0 TX-bytes:= 64 //GOTC Stats reg 0 RX-packets: 1 RX-errors: 0 RX-bytes:= 64 //QBRC[0] .... Stats reg 0 TX-packets: 1 TX-bytes:= 60 // QBTC[0] #######################################################################= ##### So now, number of RX/TX stat bytes for simple forwarding are equal when hw_= stip_crc=3D=3D0 and differ when hw_stip_crc=3D=3D1, With your change, as I understand, it would be visa-versa. I don' t mind changing it yours way, but wonder why that is any better? Probably the proper patch, should also do something like that: stats->ibytes =3D total_qbrc - stats->ipackets * dev->data->dev_conf. hw_s= trip_crc * CRC_LEN; too?=20 About using sum of QBRC[] for stats.ibytes instead of GORC, I think the ini= tial reason was: http://www.intel.com/content/www/us/en/ethernet-controllers/82599-10-gbe-co= ntroller-spec-update.html: 7 GPRC and GORCL/H Also Count Missed Packets Problem: GPRC (Good Packets Received Count) and GORCL/H (Good Octets Received Count)= count missed packets and missed packets bytes; this is not consistent with previous prod= ucts. Implication: None. 331521-002 23 Errata-Intel(r) 82599 10 GbE Controller Workaround: Statistics are available indirectly for these registers. This workaround is= included in Intel drivers. * For GPRC - Subtract MPC (Missed Packet Count) from GPRC. Alternatively, u= se QPRC. * For GORCL/H - use QBRCL/H (Quad Bytes Received). Konstantin >=20 > Signed-off-by: Stephen Hemminger > --- > lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/i= xgbe_ethdev.c > index b58ec45..27355eb 100644 > --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c > +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c > @@ -1724,12 +1724,15 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, stru= ct rte_eth_stats *stats) > struct ixgbe_hw_stats *hw_stats =3D > IXGBE_DEV_PRIVATE_TO_STATS(dev->data->dev_private); > uint32_t bprc, lxon, lxoff, total; > - uint64_t total_missed_rx, total_qbrc, total_qprc; > + uint64_t total_missed_rx; > + uint64_t total_qbrc, total_qprc, total_qbtc, total_qptc; > unsigned i; >=20 > total_missed_rx =3D 0; > total_qbrc =3D 0; > total_qprc =3D 0; > + total_qbtc =3D 0; > + total_qptc =3D 0; >=20 > hw_stats->crcerrs +=3D IXGBE_READ_REG(hw, IXGBE_CRCERRS); > hw_stats->illerrc +=3D IXGBE_READ_REG(hw, IXGBE_ILLERRC); > @@ -1770,6 +1773,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct= rte_eth_stats *stats) >=20 > total_qprc +=3D hw_stats->qprc[i]; > total_qbrc +=3D hw_stats->qbrc[i]; > + total_qptc +=3D hw_stats->qptc[i]; > + total_qbtc +=3D hw_stats->qbtc[i]; > } > hw_stats->mlfc +=3D IXGBE_READ_REG(hw, IXGBE_MLFC); > hw_stats->mrfc +=3D IXGBE_READ_REG(hw, IXGBE_MRFC); > @@ -1860,8 +1865,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct= rte_eth_stats *stats) > /* Fill out the rte_eth_stats statistics structure */ > stats->ipackets =3D total_qprc; > stats->ibytes =3D total_qbrc; > - stats->opackets =3D hw_stats->gptc; > - stats->obytes =3D hw_stats->gotc; > + stats->opackets =3D total_qptc; > + stats->obytes =3D total_qbtc; > stats->imcasts =3D hw_stats->mprc; >=20 > for (i =3D 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) { > -- > 2.1.4