[PATCH 2/8] net/bonding: skip unavailable member stats

Stephen Hemminger stephen at networkplumber.org
Sun Aug 30 22:23:44 CEST 2026


From: Weijun Pan <wpan3636 at gmail.com>

bond_ethdev_stats_get() accumulates statistics from each bonding
member. If rte_eth_stats_get() fails for a member, the local
member_stats structure may be left unchanged.

Skip members whose statistics cannot be read, instead of accumulating
stale or uninitialized counters.

Fixes: 2efb58cbab6e ("bond: new link bonding library")
Cc: stable at dpdk.org

Signed-off-by: Weijun Pan <wpan3636 at gmail.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 5b4b3d6ac2..6235c07679 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2704,7 +2704,9 @@ bond_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
 	int i;
 
 	for (i = 0; i < internals->member_count; i++) {
-		rte_eth_stats_get(internals->members[i].port_id, &member_stats);
+		if (rte_eth_stats_get(internals->members[i].port_id,
+				&member_stats) != 0)
+			continue;
 
 		stats->ipackets += member_stats.ipackets;
 		stats->opackets += member_stats.opackets;
-- 
2.53.0



More information about the dev mailing list