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 6CCCBB0AB for ; Wed, 11 Jun 2014 16:19:23 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 11 Jun 2014 07:14:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="353611175" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by FMSMGA003.fm.intel.com with ESMTP; 11 Jun 2014 07:15:41 -0700 Received: from irsmsx154.ger.corp.intel.com (163.33.192.96) by IRSMSX104.ger.corp.intel.com (163.33.3.159) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 11 Jun 2014 15:19:34 +0100 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.58]) by IRSMSX154.ger.corp.intel.com ([169.254.12.14]) with mapi id 14.03.0123.003; Wed, 11 Jun 2014 15:19:34 +0100 From: "De Lara Guarch, Pablo" To: David Marchand , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] ethdev: add RX errors counter for missed, badcrc and badlen packets Thread-Index: AQHPdeuzZBODdrOGKk2Wl6PqbGt7RZtsD/ng Date: Wed, 11 Jun 2014 14:19:34 +0000 Message-ID: References: <1400783309-14666-1-git-send-email-david.marchand@6wind.com> In-Reply-To: <1400783309-14666-1-git-send-email-david.marchand@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] ethdev: add RX errors counter for missed, badcrc and badlen packets 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: Wed, 11 Jun 2014 14:19:24 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Marchand > Sent: Thursday, May 22, 2014 7:28 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] ethdev: add RX errors counter for missed, > badcrc and badlen packets >=20 > From: Ivan Boule >=20 > Split input error stats to have a better understanding of why packets hav= e > been > dropped. > Keep ierrors field untouched for backward compatibility. >=20 > Signed-off-by: Ivan Boule > Signed-off-by: David Marchand > --- > app/test-pmd/config.c | 24 +++++++++++++++++------- > app/test-pmd/testpmd.c | 32 ++++++++++++++++++++---------= --- > examples/load_balancer/runtime.c | 2 +- > lib/librte_ether/rte_ethdev.h | 3 +++ > lib/librte_pmd_e1000/em_ethdev.c | 9 +++++++-- > lib/librte_pmd_e1000/igb_ethdev.c | 9 +++++++-- > lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 12 +++++++++--- > 7 files changed, 64 insertions(+), 27 deletions(-) >=20 > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 89aa8b2..d3934e5 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -126,19 +126,29 @@ nic_stats_display(portid_t port_id) > nic_stats_border, port_id, nic_stats_border); >=20 > if ((!port->rx_queue_stats_mapping_enabled) && (!port- > >tx_queue_stats_mapping_enabled)) { > - printf(" RX-packets: %-10"PRIu64" RX-errors: %- > 10"PRIu64"RX-bytes: " > - "%-"PRIu64"\n" > - " TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64"TX- > bytes: " > + printf(" RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" > RX-bytes: " > + "%-"PRIu64"\n", > + stats.ipackets, stats.imissed, stats.ibytes); > + printf(" RX-badcrc: %-10"PRIu64" RX-badlen: %-10"PRIu64" > RX-errors: " > + "%-"PRIu64"\n", > + stats.ibadcrc, stats.ibadlen, stats.ierrors); > + printf(" RX-nombuf: %-10"PRIu64"\n", > + stats.rx_nombuf); > + printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" > TX-bytes: " > "%-"PRIu64"\n", > - stats.ipackets, stats.ierrors, stats.ibytes, > stats.opackets, stats.oerrors, stats.obytes); > } > else { > printf(" RX-packets: %10"PRIu64" RX-errors: > %10"PRIu64 > - " RX-bytes: %10"PRIu64"\n" > - " TX-packets: %10"PRIu64" TX-errors: > %10"PRIu64 > + " RX-bytes: %10"PRIu64"\n", > + stats.ipackets, stats.ierrors, stats.ibytes); > + printf(" RX-badcrc: %10"PRIu64" RX-badlen: > %10"PRIu64 > + " RX-errors: %10"PRIu64"\n", > + stats.ibadcrc, stats.ibadlen, stats.ierrors); > + printf(" RX-nombuf: %10"PRIu64"\n", > + stats.rx_nombuf); > + printf(" TX-packets: %10"PRIu64" TX-errors: > %10"PRIu64 > " TX-bytes: %10"PRIu64"\n", > - stats.ipackets, stats.ierrors, stats.ibytes, > stats.opackets, stats.oerrors, stats.obytes); > } >=20 > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index bc38305..ac8c9f3 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -770,8 +770,8 @@ fwd_port_stats_display(portid_t port_id, struct > rte_eth_stats *stats) > if ((!port->rx_queue_stats_mapping_enabled) && (!port- > >tx_queue_stats_mapping_enabled)) { > printf(" RX-packets: %-14"PRIu64" RX-dropped: %- > 14"PRIu64"RX-total: " > "%-"PRIu64"\n", > - stats->ipackets, stats->ierrors, > - (uint64_t) (stats->ipackets + stats->ierrors)); > + stats->ipackets, stats->imissed, > + (uint64_t) (stats->ipackets + stats->imissed)); >=20 > if (cur_fwd_eng =3D=3D &csum_fwd_engine) > printf(" Bad-ipcsum: %-14"PRIu64" Bad-l4csum: %- > 14"PRIu64" \n", > @@ -782,15 +782,19 @@ fwd_port_stats_display(portid_t port_id, struct > rte_eth_stats *stats) > stats->opackets, port->tx_dropped, > (uint64_t) (stats->opackets + port->tx_dropped)); >=20 > - if (stats->rx_nombuf > 0) > - printf(" RX-nombufs: %-14"PRIu64"\n", stats- > >rx_nombuf); > + if (((stats->ierrors - stats->imissed) + stats->rx_nombuf) > 0) { > + printf(" RX-badcrc: %-14"PRIu64" RX-badlen: %- > 14"PRIu64"RX-errors: %-"PRIu64"\n", > + stats->ibadcrc, stats->ibadlen, stats->ierrors); > + printf(" RX-nombufs: %-14"PRIu64"\n", > + stats->rx_nombuf); > + } >=20 > } > else { > printf(" RX-packets: %14"PRIu64" RX- > dropped:%14"PRIu64" RX-total:" > "%14"PRIu64"\n", > - stats->ipackets, stats->ierrors, > - (uint64_t) (stats->ipackets + stats->ierrors)); > + stats->ipackets, stats->imissed, > + (uint64_t) (stats->ipackets + stats->imissed)); >=20 > if (cur_fwd_eng =3D=3D &csum_fwd_engine) > printf(" Bad-ipcsum:%14"PRIu64" Bad- > l4csum:%14"PRIu64"\n", > @@ -800,9 +804,13 @@ fwd_port_stats_display(portid_t port_id, struct > rte_eth_stats *stats) > "%14"PRIu64"\n", > stats->opackets, port->tx_dropped, > (uint64_t) (stats->opackets + port->tx_dropped)); > - > - if (stats->rx_nombuf > 0) > - printf(" RX-nombufs:%14"PRIu64"\n", stats- > >rx_nombuf); > + if (((stats->ierrors - stats->imissed) + stats->rx_nombuf) > 0) { > + printf(" RX-badcrc: %14"PRIu64" RX-badlen: > %14"PRIu64" RX-errors:" > + "%"PRIu64"\n", > + stats->ibadcrc, stats->ibadlen, stats->ierrors); > + printf(" RX-nombufs: %14"PRIu64"\n", > + stats->rx_nombuf); > + } > } >=20 > /* Display statistics of XON/XOFF pause frames, if any. */ > @@ -1164,8 +1172,8 @@ stop_packet_forwarding(void) > port->stats.ibytes =3D 0; > stats.obytes -=3D port->stats.obytes; > port->stats.obytes =3D 0; > - stats.ierrors -=3D port->stats.ierrors; > - port->stats.ierrors =3D 0; > + stats.imissed -=3D port->stats.imissed; > + port->stats.imissed =3D 0; > stats.oerrors -=3D port->stats.oerrors; > port->stats.oerrors =3D 0; > stats.rx_nombuf -=3D port->stats.rx_nombuf; > @@ -1177,7 +1185,7 @@ stop_packet_forwarding(void) >=20 > total_recv +=3D stats.ipackets; > total_xmit +=3D stats.opackets; > - total_rx_dropped +=3D stats.ierrors; > + total_rx_dropped +=3D stats.imissed; > total_tx_dropped +=3D port->tx_dropped; > total_rx_nombuf +=3D stats.rx_nombuf; >=20 > diff --git a/examples/load_balancer/runtime.c > b/examples/load_balancer/runtime.c > index e85abdb..6c63c26 100644 > --- a/examples/load_balancer/runtime.c > +++ b/examples/load_balancer/runtime.c > @@ -215,7 +215,7 @@ app_lcore_io_rx( > printf("I/O RX %u in (NIC port %u): NIC drop ratio =3D > %.2f avg burst size =3D %.2f\n", > lcore, > (unsigned) port, > - (double) stats.ierrors / (double) (stats.ierrors > + stats.ipackets), > + (double) stats.imissed / (double) > (stats.imissed + stats.ipackets), > ((double) lp->rx.nic_queues_count[i]) / > ((double) lp->rx.nic_queues_iters[i])); > lp->rx.nic_queues_iters[i] =3D 0; > lp->rx.nic_queues_count[i] =3D 0; > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.= h > index 4bf2383..d839b8c 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -186,6 +186,9 @@ struct rte_eth_stats { > uint64_t opackets; /**< Total number of successfully transmitted > packets.*/ > uint64_t ibytes; /**< Total number of successfully received bytes. > */ > uint64_t obytes; /**< Total number of successfully transmitted > bytes. */ > + uint64_t imissed; /**< Total of RX missed packets (e.g full FIFO). */ > + uint64_t ibadcrc; /**< Total of RX packets with CRC error. */ > + uint64_t ibadlen; /**< Total of RX packets with bad length. */ > uint64_t ierrors; /**< Total number of erroneous received packets. > */ > uint64_t oerrors; /**< Total number of failed transmitted packets. > */ > uint64_t imcasts; /**< Total number of multicast received packets. > */ > diff --git a/lib/librte_pmd_e1000/em_ethdev.c > b/lib/librte_pmd_e1000/em_ethdev.c > index 493806c..2f0e1a0 100644 > --- a/lib/librte_pmd_e1000/em_ethdev.c > +++ b/lib/librte_pmd_e1000/em_ethdev.c > @@ -793,8 +793,13 @@ eth_em_stats_get(struct rte_eth_dev *dev, struct > rte_eth_stats *rte_stats) > return; >=20 > /* Rx Errors */ > - rte_stats->ierrors =3D stats->rxerrc + stats->crcerrs + stats->algnerrc= + > - stats->ruc + stats->roc + stats->mpc + stats->cexterr; > + rte_stats->ibadcrc =3D stats->crcerrs; > + rte_stats->ibadlen =3D stats->rlec + stats->ruc + stats->roc; > + rte_stats->imissed =3D stats->mpc; > + rte_stats->ierrors =3D rte_stats->ibadcrc + > + rte_stats->ibadlen + > + rte_stats->imissed + > + stats->rxerrc + stats->algnerrc + stats->cexterr; >=20 > /* Tx Errors */ > rte_stats->oerrors =3D stats->ecol + stats->latecol; > diff --git a/lib/librte_pmd_e1000/igb_ethdev.c > b/lib/librte_pmd_e1000/igb_ethdev.c > index 5f93bcf..777413e 100644 > --- a/lib/librte_pmd_e1000/igb_ethdev.c > +++ b/lib/librte_pmd_e1000/igb_ethdev.c > @@ -1087,8 +1087,13 @@ eth_igb_stats_get(struct rte_eth_dev *dev, struct > rte_eth_stats *rte_stats) > return; >=20 > /* Rx Errors */ > - rte_stats->ierrors =3D stats->rxerrc + stats->crcerrs + stats->algnerrc= + > - stats->ruc + stats->roc + stats->mpc + stats->cexterr; > + rte_stats->ibadcrc =3D stats->crcerrs; > + rte_stats->ibadlen =3D stats->rlec + stats->ruc + stats->roc; > + rte_stats->imissed =3D stats->mpc; > + rte_stats->ierrors =3D rte_stats->ibadcrc + > + rte_stats->ibadlen + > + rte_stats->imissed + > + stats->rxerrc + stats->algnerrc + stats->cexterr; >=20 > /* Tx Errors */ > rte_stats->oerrors =3D stats->ecol + stats->latecol; > diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c > b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c > index 327da0b..d1718e1 100644 > --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c > +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c > @@ -1702,9 +1702,15 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, > struct rte_eth_stats *stats) > } >=20 > /* Rx Errors */ > - stats->ierrors =3D total_missed_rx + hw_stats->crcerrs + > - hw_stats->rlec; > - > + stats->ibadcrc =3D hw_stats->crcerrs; > + stats->ibadlen =3D hw_stats->rlec + hw_stats->ruc + hw_stats->roc; > + stats->imissed =3D total_missed_rx; > + stats->ierrors =3D stats->ibadcrc + > + stats->ibadlen + > + stats->imissed + > + hw_stats->illerrc + hw_stats->errbc; > + > + /* Tx Errors */ > stats->oerrors =3D 0; >=20 > /* XON/XOFF pause frames */ > -- > 1.7.10.4 In function fwd_port_stats_display(), for aligning purposes, the following = change should be made: if (((stats->ierrors - stats->imissed) + stats->rx_nombuf) > 0) { - printf(" RX-badcrc: %-14"PRIu64" RX-badlen: %-14"= PRIu64"RX-errors: %-"PRIu64"\n", + printf(" RX-badcrc: %-15"PRIu64" RX-badlen: %-15"P= RIu64"RX-errors: %-"PRIu64"\n", stats->ibadcrc, stats->ibadlen, stats->ierrors); So, Rx-badlen will be aligned to TX-dropped in the line above and RX-errors= will be aligned to TX-total. Thanks, Pablo=20