aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_netlink.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>2019-01-23 19:14:50 +0200
committerDavid S. Miller <davem@davemloft.net>2019-01-24 22:18:48 -0800
commit949e7cea0cbccd7e2afc4b374e2be998b8fcef78 (patch)
treeddd52d1d246a442b18ff46d9099ec7b69cfb97c1 /drivers/net/bonding/bond_netlink.c
parentMerge branch 'net-phy-improve-starting-PHY' (diff)
downloadlinux-dev-949e7cea0cbccd7e2afc4b374e2be998b8fcef78.tar.xz
linux-dev-949e7cea0cbccd7e2afc4b374e2be998b8fcef78.zip
bonding: count master 3ad stats separately
I made a dumb mistake when I summed up the slave stats, obviously slaves can come and go which would make the master stats unreliable. Count and export the master stats separately. Fixes: a258aeacd7f0 ("bonding: add support for xstats and export 3ad stats") Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/net/bonding/bond_netlink.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index d1338fbe1830..b286f591242e 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -715,16 +715,12 @@ static int bond_fill_linkxstats(struct sk_buff *skb,
if (!nest)
return -EMSGSIZE;
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
- struct bond_3ad_stats stats;
- struct list_head *iter;
-
- memset(&stats, 0, sizeof(stats));
- if (slave) {
- bond_3ad_stats_add(slave, &stats);
- } else {
- bond_for_each_slave(bond, slave, iter)
- bond_3ad_stats_add(slave, &stats);
- }
+ struct bond_3ad_stats *stats;
+
+ if (slave)
+ stats = &SLAVE_AD_INFO(slave)->stats;
+ else
+ stats = &BOND_AD_INFO(bond).stats;
nest2 = nla_nest_start(skb, BOND_XSTATS_3AD);
if (!nest2) {
@@ -732,7 +728,7 @@ static int bond_fill_linkxstats(struct sk_buff *skb,
return -EMSGSIZE;
}
- if (bond_3ad_stats_fill(skb, &stats)) {
+ if (bond_3ad_stats_fill(skb, stats)) {
nla_nest_cancel(skb, nest2);
nla_nest_end(skb, nest);
return -EMSGSIZE;