hn_vf_stats_get was ignoring the qstats parameter (__rte_unused),
calling rte_eth_stats_get which only collects aggregate stats. This
meant per-queue stats (rx_q0_good_packets, tx_q0_good_packets, etc.)
were always zero when VF datapath was active, even though the
underlying MANA driver populates them in its stats_get callback.

Call the VF device's stats_get op directly with the qstats pointer
so per-queue counters are forwarded through netvsc to the xstats
telemetry output.

Fixes: dc7680e8597c ("net/netvsc: support integrated VF")
Cc: [email protected]
Signed-off-by: Long Li <[email protected]>
---
 drivers/net/netvsc/hn_vf.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index 1fcc65a712..497f747aab 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -749,7 +749,7 @@ void hn_vf_rx_queue_release(struct hn_data *hv, uint16_t 
queue_id)
 
 int hn_vf_stats_get(struct rte_eth_dev *dev,
                    struct rte_eth_stats *stats,
-                   struct eth_queue_stats *qstats __rte_unused)
+                   struct eth_queue_stats *qstats)
 {
        struct hn_data *hv = dev->data->dev_private;
        struct rte_eth_dev *vf_dev;
@@ -757,8 +757,12 @@ int hn_vf_stats_get(struct rte_eth_dev *dev,
 
        rte_rwlock_read_lock(&hv->vf_lock);
        vf_dev = hn_get_vf_dev(hv);
-       if (vf_dev)
-               ret = rte_eth_stats_get(vf_dev->data->port_id, stats);
+       if (vf_dev) {
+               if (vf_dev->dev_ops->stats_get)
+                       ret = vf_dev->dev_ops->stats_get(vf_dev, stats, qstats);
+               else
+                       ret = rte_eth_stats_get(vf_dev->data->port_id, stats);
+       }
        rte_rwlock_read_unlock(&hv->vf_lock);
        return ret;
 }
-- 
2.43.0

Reply via email to