From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <maryam.tahhan@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id D24525921
 for <dev@dpdk.org>; Fri, 23 Oct 2015 16:35:31 +0200 (CEST)
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by fmsmga101.fm.intel.com with ESMTP; 23 Oct 2015 07:35:30 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.20,186,1444719600"; d="scan'208";a="833475958"
Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25])
 by orsmga002.jf.intel.com with ESMTP; 23 Oct 2015 07:35:30 -0700
Received: from irsmsx109.ger.corp.intel.com ([169.254.13.139]) by
 irsmsx110.ger.corp.intel.com ([169.254.15.151]) with mapi id 14.03.0248.002;
 Fri, 23 Oct 2015 15:35:28 +0100
From: "Tahhan, Maryam" <maryam.tahhan@intel.com>
To: "Van Haaren, Harry" <harry.van.haaren@intel.com>, "dev@dpdk.org"
 <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get()
 strings and	Q handling
Thread-Index: AQHRDOFLjkFiDz1vqU+TPHbnVtAUGJ55JUfQ
Date: Fri, 23 Oct 2015 14:35:28 +0000
Message-ID: <1A27633A6DA49C4A92FCD5D4312DBF536A5D93C0@IRSMSX109.ger.corp.intel.com>
References: <1443606022-13581-2-git-send-email-harry.van.haaren@intel.com>
 <1445528914-27636-1-git-send-email-harry.van.haaren@intel.com>
 <1445528914-27636-4-git-send-email-harry.van.haaren@intel.com>
In-Reply-To: <1445528914-27636-4-git-send-email-harry.van.haaren@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 03/11] ethdev: update xstats_get() strings
 and	Q handling
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 23 Oct 2015 14:35:32 -0000

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Harry van Haaren
> Sent: Thursday, October 22, 2015 4:48 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get() strings =
and
> Q handling
>=20
> Update the strings used for presenting stats to adhere to the scheme
> previously presented. Updated xstats_get() function to handle Q informati=
on
> only if xstats() is not implemented in the PMD, providing the PMD with th=
e
> needed flexibility to expose its extended Q stats.
>=20
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> ---
>  lib/librte_ether/rte_ethdev.c | 38 +++++++++++++++++++++++--------------=
-
>  1 file changed, 23 insertions(+), 15 deletions(-)
>=20
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.=
c
> index f593f6e..07f0c26 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -137,27 +137,30 @@ struct rte_eth_xstats_name_off {  };
>=20
>  static const struct rte_eth_xstats_name_off rte_stats_strings[] =3D {
> -	{"rx_packets", offsetof(struct rte_eth_stats, ipackets)},
> -	{"tx_packets", offsetof(struct rte_eth_stats, opackets)},
> -	{"rx_bytes", offsetof(struct rte_eth_stats, ibytes)},
> -	{"tx_bytes", offsetof(struct rte_eth_stats, obytes)},
> -	{"tx_errors", offsetof(struct rte_eth_stats, oerrors)},
> +	{"rx_good_packets", offsetof(struct rte_eth_stats, ipackets)},
> +	{"tx_good_packets", offsetof(struct rte_eth_stats, opackets)},
> +	{"rx_good_bytes", offsetof(struct rte_eth_stats, ibytes)},
> +	{"tx_good_bytes", offsetof(struct rte_eth_stats, obytes)},

Hi Harry
If there are any apps today scraping the existing stats this will cause an =
issue.
I think the "good" description breaks the meaning of the various stats defi=
ned in the header. For example rx_packets is Total number of successfully r=
eceived packets rather than the "good" packets.

BR
Maryam
>  	{"rx_errors", offsetof(struct rte_eth_stats, ierrors)},
> -	{"alloc_rx_buff_failed", offsetof(struct rte_eth_stats, rx_nombuf)},
> +	{"tx_errors", offsetof(struct rte_eth_stats, oerrors)},
> +	{"rx_mbuf_allocation_errors", offsetof(struct rte_eth_stats,
> +		rx_nombuf)},
>  };
> +
>  #define RTE_NB_STATS (sizeof(rte_stats_strings) / sizeof(rte_stats_strin=
gs[0]))
>=20
>  static const struct rte_eth_xstats_name_off rte_rxq_stats_strings[] =3D =
{
> -	{"rx_packets", offsetof(struct rte_eth_stats, q_ipackets)},
> -	{"rx_bytes", offsetof(struct rte_eth_stats, q_ibytes)},
> +	{"packets", offsetof(struct rte_eth_stats, q_ipackets)},
> +	{"bytes", offsetof(struct rte_eth_stats, q_ibytes)},
> +	{"errors", offsetof(struct rte_eth_stats, q_errors)},
>  };
> +
>  #define RTE_NB_RXQ_STATS (sizeof(rte_rxq_stats_strings) /	\
>  		sizeof(rte_rxq_stats_strings[0]))
>=20
>  static const struct rte_eth_xstats_name_off rte_txq_stats_strings[] =3D =
{
> -	{"tx_packets", offsetof(struct rte_eth_stats, q_opackets)},
> -	{"tx_bytes", offsetof(struct rte_eth_stats, q_obytes)},
> -	{"tx_errors", offsetof(struct rte_eth_stats, q_errors)},
> +	{"packets", offsetof(struct rte_eth_stats, q_opackets)},
> +	{"bytes", offsetof(struct rte_eth_stats, q_obytes)},
>  };
>  #define RTE_NB_TXQ_STATS (sizeof(rte_txq_stats_strings) /	\
>  		sizeof(rte_txq_stats_strings[0]))
> @@ -1666,8 +1669,6 @@ rte_eth_xstats_get(uint8_t port_id, struct
> rte_eth_xstats *xstats,
>=20
>  	/* Return generic statistics */
>  	count =3D RTE_NB_STATS;
> -	count +=3D dev->data->nb_rx_queues * RTE_NB_RXQ_STATS;
> -	count +=3D dev->data->nb_tx_queues * RTE_NB_TXQ_STATS;
>=20
>  	/* implemented by the driver */
>  	if (dev->dev_ops->xstats_get !=3D NULL) { @@ -1679,6 +1680,9 @@
> rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,
>=20
>  		if (xcount < 0)
>  			return xcount;
> +	} else {
> +		count +=3D dev->data->nb_rx_queues * RTE_NB_RXQ_STATS;
> +		count +=3D dev->data->nb_tx_queues * RTE_NB_TXQ_STATS;
>  	}
>=20
>  	if (n < count + xcount)
> @@ -1698,6 +1702,10 @@ rte_eth_xstats_get(uint8_t port_id, struct
> rte_eth_xstats *xstats,
>  		xstats[count++].value =3D val;
>  	}
>=20
> +	/* if xstats_get() is implemented by the PMD, the Q stats are done */
> +	if (dev->dev_ops->xstats_get !=3D NULL)
> +		return count + xcount;
> +
>  	/* per-rxq stats */
>  	for (q =3D 0; q < dev->data->nb_rx_queues; q++) {
>  		for (i =3D 0; i < RTE_NB_RXQ_STATS; i++) { @@ -1706,7 +1714,7
> @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,
>  					q * sizeof(uint64_t));
>  			val =3D *stats_ptr;
>  			snprintf(xstats[count].name,
> sizeof(xstats[count].name),
> -				"rx_queue_%u_%s", q,
> +				"rx_q%u_%s", q,
>  				rte_rxq_stats_strings[i].name);
>  			xstats[count++].value =3D val;
>  		}
> @@ -1720,7 +1728,7 @@ rte_eth_xstats_get(uint8_t port_id, struct
> rte_eth_xstats *xstats,
>  					q * sizeof(uint64_t));
>  			val =3D *stats_ptr;
>  			snprintf(xstats[count].name,
> sizeof(xstats[count].name),
> -				"tx_queue_%u_%s", q,
> +				"tx_q%u_%s", q,
>  				rte_txq_stats_strings[i].name);
>  			xstats[count++].value =3D val;
>  		}
> --
> 1.9.1