net/gve: add Rx/Tx queue statistics

Message ID 20230219003111.85508-1-levendsayar@gmail.com (mailing list archive)
State Rejected, archived
Delegated to: Ferruh Yigit
Headers
Series net/gve: add Rx/Tx queue statistics |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-intel-Performance fail Performance Testing issues
ci/github-robot: build success github build: passed
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Levend Sayar Feb. 19, 2023, 12:31 a.m. UTC
  Google Virtual NIC PMD is enriched with rx/tx queue statistics info.

Signed-off-by: Levend Sayar <levendsayar@gmail.com>
---
 drivers/net/gve/gve_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Ferruh Yigit Feb. 19, 2023, 8:15 p.m. UTC | #1
On 2/19/2023 12:31 AM, Levend Sayar wrote:
> Google Virtual NIC PMD is enriched with rx/tx queue statistics info.
> 
> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
> ---
>  drivers/net/gve/gve_ethdev.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
> index fef2458a16..2a6cb11da3 100644
> --- a/drivers/net/gve/gve_ethdev.c
> +++ b/drivers/net/gve/gve_ethdev.c
> @@ -213,6 +213,7 @@ gve_dev_start(struct rte_eth_dev *dev)
>  		}
>  	}
>  
> +	dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
>  	dev->data->dev_started = 1;
>  	gve_link_update(dev, 0);
>  
> @@ -331,6 +332,9 @@ gve_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>  		stats->opackets += txq->packets;
>  		stats->obytes += txq->bytes;
>  		stats->oerrors += txq->errors;
> +
> +		stats->q_opackets[i] = txq->packets;
> +		stats->q_obytes[i] = txq->bytes;
>  	}
>  
>  	for (i = 0; i < dev->data->nb_rx_queues; i++) {
> @@ -342,6 +346,10 @@ gve_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>  		stats->ibytes += rxq->bytes;
>  		stats->ierrors += rxq->errors;
>  		stats->rx_nombuf += rxq->no_mbufs;
> +
> +		stats->q_ipackets[i] = rxq->packets;
> +		stats->q_ibytes[i] = rxq->bytes;
> +		stats->q_errors[i] = rxq->errors;
>  	}
>  
>  	return 0;

nack,

as explained in other thread [1], we need to implement xstats in driver
without relying on 'RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS' flag.

[1]
https://inbox.dpdk.org/dev/0123d577-39f5-7213-07b3-04ef3918edda@amd.com/T/#u
  

Patch

diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
index fef2458a16..2a6cb11da3 100644
--- a/drivers/net/gve/gve_ethdev.c
+++ b/drivers/net/gve/gve_ethdev.c
@@ -213,6 +213,7 @@  gve_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
+	dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 	dev->data->dev_started = 1;
 	gve_link_update(dev, 0);
 
@@ -331,6 +332,9 @@  gve_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 		stats->opackets += txq->packets;
 		stats->obytes += txq->bytes;
 		stats->oerrors += txq->errors;
+
+		stats->q_opackets[i] = txq->packets;
+		stats->q_obytes[i] = txq->bytes;
 	}
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -342,6 +346,10 @@  gve_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 		stats->ibytes += rxq->bytes;
 		stats->ierrors += rxq->errors;
 		stats->rx_nombuf += rxq->no_mbufs;
+
+		stats->q_ipackets[i] = rxq->packets;
+		stats->q_ibytes[i] = rxq->bytes;
+		stats->q_errors[i] = rxq->errors;
 	}
 
 	return 0;