[dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get() strings and Q handling

2015-10-23 Thread Tahhan, Maryam
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Harry van Haaren
> Sent: Thursday, October 22, 2015 4:48 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get() strings and
> Q handling
> 
> Update the strings used for presenting stats to adhere to the scheme
> previously presented. Updated xstats_get() function to handle Q information
> only if xstats() is not implemented in the PMD, providing the PMD with the
> needed flexibility to expose its extended Q stats.
> 
> Signed-off-by: Harry van Haaren 

Acked-by: Maryam Tahhan 


[dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get() strings and Q handling

2015-10-23 Thread Tahhan, Maryam
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Tahhan, Maryam
> Sent: Friday, October 23, 2015 3:35 PM
> To: Van Haaren, Harry ; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get() strings
> and Q handling
> 
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Harry van Haaren
> > Sent: Thursday, October 22, 2015 4:48 PM
> > To: dev at dpdk.org
> > Subject: [dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get()
> > strings and Q handling
> >
> > Update the strings used for presenting stats to adhere to the scheme
> > previously presented. Updated xstats_get() function to handle Q
> > information only if xstats() is not implemented in the PMD, providing
> > the PMD with the needed flexibility to expose its extended Q stats.
> >
> > Signed-off-by: Harry van Haaren 
> > ---
> >  lib/librte_ether/rte_ethdev.c | 38
> > +++---
> >  1 file changed, 23 insertions(+), 15 deletions(-)
> >
> > 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 {  };
> >
> >  static const struct rte_eth_xstats_name_off rte_stats_strings[] = {
> > -   {"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 defined
> in the header. For example rx_packets is Total number of successfully
> received packets rather than the "good" packets.
> 
> BR
> Maryam
> > {"rx_errors", offsetof(struct rte_eth_stats, ierrors)},

My bad, was quoting the wrong stats register... I'm happy with this change




[dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get() strings and Q handling

2015-10-23 Thread Tahhan, Maryam
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Harry van Haaren
> Sent: Thursday, October 22, 2015 4:48 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get() strings and
> Q handling
> 
> Update the strings used for presenting stats to adhere to the scheme
> previously presented. Updated xstats_get() function to handle Q information
> only if xstats() is not implemented in the PMD, providing the PMD with the
> needed flexibility to expose its extended Q stats.
> 
> Signed-off-by: Harry van Haaren 
> ---
>  lib/librte_ether/rte_ethdev.c | 38 +++---
>  1 file changed, 23 insertions(+), 15 deletions(-)
> 
> 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 {  };
> 
>  static const struct rte_eth_xstats_name_off rte_stats_strings[] = {
> - {"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 defined 
in the header. For example rx_packets is Total number of successfully received 
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_strings[0]))
> 
>  static const struct rte_eth_xstats_name_off rte_rxq_stats_strings[] = {
> - {"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]))
> 
>  static const struct rte_eth_xstats_name_off rte_txq_stats_strings[] = {
> - {"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,
> 
>   /* Return generic statistics */
>   count = RTE_NB_STATS;
> - count += dev->data->nb_rx_queues * RTE_NB_RXQ_STATS;
> - count += dev->data->nb_tx_queues * RTE_NB_TXQ_STATS;
> 
>   /* implemented by the driver */
>   if (dev->dev_ops->xstats_get != NULL) { @@ -1679,6 +1680,9 @@
> rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,
> 
>   if (xcount < 0)
>   return xcount;
> + } else {
> + count += dev->data->nb_rx_queues * RTE_NB_RXQ_STATS;
> + count += dev->data->nb_tx_queues * RTE_NB_TXQ_STATS;
>   }
> 
>   if (n < count + xcount)
> @@ -1698,6 +1702,10 @@ rte_eth_xstats_get(uint8_t port_id, struct
> rte_eth_xstats *xstats,
>   xstats[count++].value = val;
>   }
> 
> + /* if xstats_get() is implemented by the PMD, the Q stats are done */
> + if (dev->dev_ops->xstats_get != NULL)
> + return count + xcount;
> +
>   

[dpdk-dev] [PATCH v3 03/11] ethdev: update xstats_get() strings and Q handling

2015-10-22 Thread Harry van Haaren
Update the strings used for presenting stats to adhere
to the scheme previously presented. Updated xstats_get()
function to handle Q information only if xstats() is not
implemented in the PMD, providing the PMD with the needed
flexibility to expose its extended Q stats.

Signed-off-by: Harry van Haaren 
---
 lib/librte_ether/rte_ethdev.c | 38 +++---
 1 file changed, 23 insertions(+), 15 deletions(-)

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 {
 };

 static const struct rte_eth_xstats_name_off rte_stats_strings[] = {
-   {"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)},
{"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_strings[0]))

 static const struct rte_eth_xstats_name_off rte_rxq_stats_strings[] = {
-   {"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]))

 static const struct rte_eth_xstats_name_off rte_txq_stats_strings[] = {
-   {"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,

/* Return generic statistics */
count = RTE_NB_STATS;
-   count += dev->data->nb_rx_queues * RTE_NB_RXQ_STATS;
-   count += dev->data->nb_tx_queues * RTE_NB_TXQ_STATS;

/* implemented by the driver */
if (dev->dev_ops->xstats_get != NULL) {
@@ -1679,6 +1680,9 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats 
*xstats,

if (xcount < 0)
return xcount;
+   } else {
+   count += dev->data->nb_rx_queues * RTE_NB_RXQ_STATS;
+   count += dev->data->nb_tx_queues * RTE_NB_TXQ_STATS;
}

if (n < count + xcount)
@@ -1698,6 +1702,10 @@ rte_eth_xstats_get(uint8_t port_id, struct 
rte_eth_xstats *xstats,
xstats[count++].value = val;
}

+   /* if xstats_get() is implemented by the PMD, the Q stats are done */
+   if (dev->dev_ops->xstats_get != NULL)
+   return count + xcount;
+
/* per-rxq stats */
for (q = 0; q < dev->data->nb_rx_queues; q++) {
for (i = 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 = *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 = val;
}
@@ -1720,7 +1728,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats 
*xstats,
q * sizeof(uint64_t));
val = *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 = val;
}
-- 
1.9.1