NIC statistics are enhanced with rx/tx queue errors.

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

diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
index 735847ede7..88adec7253 100644
--- a/drivers/net/gve/gve_ethdev.c
+++ b/drivers/net/gve/gve_ethdev.c
@@ -417,6 +417,18 @@ gve_xstats_get(struct rte_eth_dev *dev, struct 
rte_eth_xstat *xstats, unsigned i
                        if (--requested == 0)
                                return n;
                        xstat++;
+
+                       xstat->id = indx++;
+                       xstat->value = rxq->errors;
+                       if (--requested == 0)
+                               return n;
+                       xstat++;
+
+                       xstat->id = indx++;
+                       xstat->value = rxq->no_mbufs;
+                       if (--requested == 0)
+                               return n;
+                       xstat++;
                }
 
                for (i = 0; i < dev->data->nb_tx_queues; i++) {
@@ -432,10 +444,16 @@ gve_xstats_get(struct rte_eth_dev *dev, struct 
rte_eth_xstat *xstats, unsigned i
                        if (--requested == 0)
                                return n;
                        xstat++;
+
+                       xstat->id = indx++;
+                       xstat->value = txq->errors;
+                       if (--requested == 0)
+                               return n;
+                       xstat++;
                }
        }
 
-       return (dev->data->nb_tx_queues + dev->data->nb_rx_queues) * 2;
+       return (dev->data->nb_rx_queues * 4) + (dev->data->nb_tx_queues * 3);
 }
 
 static int
@@ -454,29 +472,48 @@ gve_xstats_get_names(struct rte_eth_dev *dev, struct 
rte_eth_xstat_name *xstats_
                uint16_t i;
 
                for (i = 0; i < dev->data->nb_rx_queues; i++) {
-                       snprintf(xstats_name->name, sizeof(xstats_name->name), 
"rx_q%d_packets", i);
+                       snprintf(xstats_name->name, sizeof(xstats_name->name),
+                                       "rx_q%d_packets", i);
+                       if (--requested == 0)
+                               return n;
+                       xstats_name++;
+                       snprintf(xstats_name->name, sizeof(xstats_name->name),
+                                       "rx_q%d_bytes", i);
                        if (--requested == 0)
                                return n;
                        xstats_name++;
-                       snprintf(xstats_name->name, sizeof(xstats_name->name), 
"rx_q%d_bytes", i);
+                       snprintf(xstats_name->name, sizeof(xstats_name->name),
+                                       "rx_q%d_errors", i);
+                       if (--requested == 0)
+                               return n;
+                       xstats_name++;
+                       snprintf(xstats_name->name, sizeof(xstats_name->name),
+                                       "rx_q%d_no_mbufs", i);
                        if (--requested == 0)
                                return n;
                        xstats_name++;
                }
 
                for (i = 0; i < dev->data->nb_tx_queues; i++) {
-                       snprintf(xstats_name->name, sizeof(xstats_name->name), 
"tx_q%d_packets", i);
+                       snprintf(xstats_name->name, sizeof(xstats_name->name),
+                                       "tx_q%d_packets", i);
+                       if (--requested == 0)
+                               return n;
+                       xstats_name++;
+                       snprintf(xstats_name->name, sizeof(xstats_name->name),
+                                       "tx_q%d_bytes", i);
                        if (--requested == 0)
                                return n;
                        xstats_name++;
-                       snprintf(xstats_name->name, sizeof(xstats_name->name), 
"tx_q%d_bytes", i);
+                       snprintf(xstats_name->name, sizeof(xstats_name->name),
+                                       "tx_q%d_errors", i);
                        if (--requested == 0)
                                return n;
                        xstats_name++;
                }
        }
 
-       return (dev->data->nb_tx_queues + dev->data->nb_rx_queues) * 2;
+       return (dev->data->nb_rx_queues * 4) + (dev->data->nb_tx_queues * 3);
 }
 
 static const struct eth_dev_ops gve_eth_dev_ops = {
-- 
2.37.1 (Apple Git-137.1)

Reply via email to