[PATCH v4 25/27] net/hinic3: add SP230 VF software statistics
Jiacheng Ye
yejiacheng4 at h-partners.com
Fri Oct 23 17:58:06 CEST 2026
The SP230 VF does not expose rx/tx counters through the vport statistics
path, so aggregate the software queue counters instead to return meaningful
ipackets/ibytes/opackets/obytes for VF ports.
Signed-off-by: Jiacheng Ye <yejiacheng4 at h-partners.com>
---
drivers/net/hinic3/hinic3_ethdev.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/drivers/net/hinic3/hinic3_ethdev.c b/drivers/net/hinic3/hinic3_ethdev.c
index d83b11bc37..c09dad9efa 100644
--- a/drivers/net/hinic3/hinic3_ethdev.c
+++ b/drivers/net/hinic3/hinic3_ethdev.c
@@ -2948,13 +2948,16 @@ hinic3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
struct hinic3_nic_dev *nic_dev = HINIC3_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
struct hinic3_vport_stats vport_stats;
uint64_t rx_discards_pmd = 0;
+ bool sw_stats = HINIC3_IS_VF(nic_dev->hwdev) && HINIC3_IS_SP230_NIC(nic_dev);
int err;
- err = hinic3_get_vport_stats(nic_dev->hwdev, &vport_stats);
- if (err) {
- PMD_DRV_LOG(ERR, "Get vport stats from fw failed, nic_dev: %s",
- nic_dev->dev_name);
- return err;
+ if (!sw_stats) {
+ err = hinic3_get_vport_stats(nic_dev->hwdev, &vport_stats);
+ if (err) {
+ PMD_DRV_LOG(ERR, "Get vport stats from fw failed, nic_dev: %s",
+ nic_dev->dev_name);
+ return err;
+ }
}
/* Rx queue stats. */
@@ -2975,6 +2978,12 @@ hinic3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
stats->ierrors += rxq->rxq_stats.errors;
rx_discards_pmd += rxq->rxq_stats.dropped;
dev->data->rx_mbuf_alloc_failed += rxq->rxq_stats.rx_nombuf;
+
+ if (sw_stats) {
+ stats->ipackets += rxq->rxq_stats.packets;
+ stats->ibytes += rxq->rxq_stats.bytes;
+ stats->imissed += rxq->rxq_stats.dropped;
+ }
}
/* Tx queue stats. */
@@ -2985,8 +2994,16 @@ hinic3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
qstats[i].q_opackets = txq->txq_stats.packets;
qstats[i].q_obytes = txq->txq_stats.bytes;
}
+
+ if (sw_stats) {
+ stats->opackets += txq->txq_stats.packets;
+ stats->obytes += txq->txq_stats.bytes;
+ }
}
+ if (sw_stats)
+ return 0;
+
/* Vport stats. */
stats->oerrors += vport_stats.tx_discard_vport;
--
2.33.0
More information about the dev
mailing list