summaryrefslogtreecommitdiff
path: root/ip/iplink_bond.c
diff options
context:
space:
mode:
Diffstat (limited to 'ip/iplink_bond.c')
-rw-r--r--ip/iplink_bond.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/ip/iplink_bond.c b/ip/iplink_bond.c
index 650411fc..15db19a3 100644
--- a/ip/iplink_bond.c
+++ b/ip/iplink_bond.c
@@ -15,6 +15,7 @@
#include <string.h>
#include <linux/if_bonding.h>
+#include "list.h"
#include "rt_names.h"
#include "utils.h"
#include "ip_common.h"
@@ -761,7 +762,7 @@ static void bond_print_xstats_help(struct link_util *lu, FILE *f)
fprintf(f, "Usage: ... %s [ 802.3ad ] [ dev DEVICE ]\n", lu->id);
}
-static void bond_print_3ad_stats(struct rtattr *lacpattr)
+static void bond_print_3ad_stats(const struct rtattr *lacpattr)
{
struct rtattr *lacptb[BOND_3AD_STAT_MAX+1];
__u64 val;
@@ -912,7 +913,6 @@ int bond_parse_xstats(struct link_util *lu, int argc, char **argv)
return 0;
}
-
struct link_util bond_link_util = {
.id = "bond",
.maxattr = IFLA_BOND_MAX,
@@ -922,3 +922,54 @@ struct link_util bond_link_util = {
.parse_ifla_xstats = bond_parse_xstats,
.print_ifla_xstats = bond_print_xstats,
};
+
+static const struct ipstats_stat_desc ipstats_stat_desc_bond_tmpl_lacp = {
+ .name = "802.3ad",
+ .kind = IPSTATS_STAT_DESC_KIND_LEAF,
+ .show = &ipstats_stat_desc_show_xstats,
+ .pack = &ipstats_stat_desc_pack_xstats,
+};
+
+static const struct ipstats_stat_desc_xstats
+ipstats_stat_desc_xstats_bond_lacp = {
+ .desc = ipstats_stat_desc_bond_tmpl_lacp,
+ .xstats_at = IFLA_STATS_LINK_XSTATS,
+ .link_type_at = LINK_XSTATS_TYPE_BOND,
+ .inner_max = BOND_XSTATS_MAX,
+ .inner_at = BOND_XSTATS_3AD,
+ .show_cb = &bond_print_3ad_stats,
+};
+
+static const struct ipstats_stat_desc *
+ipstats_stat_desc_xstats_bond_subs[] = {
+ &ipstats_stat_desc_xstats_bond_lacp.desc,
+};
+
+const struct ipstats_stat_desc ipstats_stat_desc_xstats_bond_group = {
+ .name = "bond",
+ .kind = IPSTATS_STAT_DESC_KIND_GROUP,
+ .subs = ipstats_stat_desc_xstats_bond_subs,
+ .nsubs = ARRAY_SIZE(ipstats_stat_desc_xstats_bond_subs),
+};
+
+static const struct ipstats_stat_desc_xstats
+ipstats_stat_desc_xstats_slave_bond_lacp = {
+ .desc = ipstats_stat_desc_bond_tmpl_lacp,
+ .xstats_at = IFLA_STATS_LINK_XSTATS_SLAVE,
+ .link_type_at = LINK_XSTATS_TYPE_BOND,
+ .inner_max = BOND_XSTATS_MAX,
+ .inner_at = BOND_XSTATS_3AD,
+ .show_cb = &bond_print_3ad_stats,
+};
+
+static const struct ipstats_stat_desc *
+ipstats_stat_desc_xstats_slave_bond_subs[] = {
+ &ipstats_stat_desc_xstats_slave_bond_lacp.desc,
+};
+
+const struct ipstats_stat_desc ipstats_stat_desc_xstats_slave_bond_group = {
+ .name = "bond",
+ .kind = IPSTATS_STAT_DESC_KIND_GROUP,
+ .subs = ipstats_stat_desc_xstats_slave_bond_subs,
+ .nsubs = ARRAY_SIZE(ipstats_stat_desc_xstats_slave_bond_subs),
+};