net/gve: Enable stats reporting for GQ format
PATCH 1/1 net/gve: Enable stats reporting for GQ format
Read from shared region to retrieve imissed statistics for GQ. Tested using show port xstats <port-id> in interactive mode. This metric can be triggered by using queues > cores.
Signed-off-by Rushil Gupta <[email protected]>
Reviewed-by Joshua Washington <[email protected]>
--- drivers/net/gve/base/gve_adminq.h | 11 +++ drivers/net/gve/gve_ethdev.c | 142 ++++++++++++++++++++++++++++-- drivers/net/gve/gve_ethdev.h | 20 ++++- 3 files changed, 167 insertions(+), 6 deletions(-)
drivers/net/gve/base/gve_adminq.h +11 -0
@@ -314,6 +314,17 @@ struct gve_stats_report {GVE_CHECK_STRUCT_LEN (8 , gve_stats_report); +/* Numbers of gve tx/rx stats in stats report. */ +#define GVE_TX_STATS_REPORT_NUM 6 +#define GVE_RX_STATS_REPORT_NUM 2 + +/* Interval to schedule a stats report update, 20000ms. */ +#define GVE_STATS_REPORT_TIMER_PERIOD 20000 + +/* Numbers of NIC tx/rx stats in stats report. */ +#define NIC_TX_STATS_REPORT_NUM 0 +#define NIC_RX_STATS_REPORT_NUM 4 +enum gve_stat_names {/* stats from gve */ TX_WAKE_CNT =1 ,
drivers/net/gve/gve_ethdev.c +137 -5
196 lines not on this page · raw message
drivers/net/gve/gve_ethdev.h +19 -1
@@ -8,13 +8,25 @@#include <ethdev_driver.h> #include <ethdev_pci.h> #include <rte_ether.h> -#include <rte_pci.h> #include "base/gve.h" /* TODO: this is a workaround to ensure that Tx complq is enough */ #define DQO_TX_MULTIPLIER 4 +/* +* Following macros are derived from linux/pci_regs.h, however, +* we can't simply include that header here, as there is no such +* file for non-Linux platform. +*/ +#define PCI_CFG_SPACE_SIZE 256 +#define PCI_CAPABILITY_LIST 0x34/* Offset of first capability list entry */ +#define PCI_STD_HEADER_SIZEOF 64 +#define PCI_CAP_SIZEOF 4 +#define PCI_CAP_ID_MSIX 0x11/* MSI-X */ +#define PCI_MSIX_FLAGS 2/* Message Control */ +#define PCI_MSIX_FLAGS_QSIZE 0x07FF/* Table size */ +#define GVE_DEFAULT_RX_FREE_THRESH 64#define GVE_DEFAULT_TX_FREE_THRESH 32#define GVE_DEFAULT_TX_RS_THRESH 32
@@ -85,6 +97,7 @@ struct gve_rx_stats {uint64_t errors;uint64_t no_mbufs;uint64_t no_mbufs_bulk; +uint64_t imissed; };struct gve_xstats_name_offset {
@@ -272,6 +285,11 @@ struct gve_priv {struct gve_tx_queue **txqs;struct gve_rx_queue **rxqs; + +uint32_t stats_report_len; +const struct rte_memzone *stats_report_mem; +uint16_t stats_start_idx;/* start index of array of stats written by NIC */ +uint16_t stats_end_idx;/* end index of array of stats written by NIC */ }; static inline bool
Signature · 1 line
2.43.0.472.g3155946c3a-goog