diff options
author | Nikolay Aleksandrov <razor@blackwall.org> | 2015-06-14 09:36:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-15 19:40:24 -0400 |
commit | 46ea297ed67cdeeb0142244873458b911037d0ba (patch) | |
tree | d7af7c0118003b89814e0320fead24fab26a85e3 /drivers/net/bonding | |
parent | 254cb6dbfd8894743fbf814ec856ccd0874af691 (diff) |
bonding: export slave's partner_oper_port_state via sysfs and netlink
Export the partner_oper_port_state of each port via sysfs and netlink.
In 802.3ad mode it is valuable for the user to be able to check the
partner_oper state, it is already exported via bond's proc entry.
Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_netlink.c | 5 | ||||
-rw-r--r-- | drivers/net/bonding/bond_sysfs_slave.c | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c index a0e600db4236..5580fcde738f 100644 --- a/drivers/net/bonding/bond_netlink.c +++ b/drivers/net/bonding/bond_netlink.c | |||
@@ -29,6 +29,7 @@ static size_t bond_get_slave_size(const struct net_device *bond_dev, | |||
29 | nla_total_size(sizeof(u16)) + /* IFLA_BOND_SLAVE_QUEUE_ID */ | 29 | nla_total_size(sizeof(u16)) + /* IFLA_BOND_SLAVE_QUEUE_ID */ |
30 | nla_total_size(sizeof(u16)) + /* IFLA_BOND_SLAVE_AD_AGGREGATOR_ID */ | 30 | nla_total_size(sizeof(u16)) + /* IFLA_BOND_SLAVE_AD_AGGREGATOR_ID */ |
31 | nla_total_size(sizeof(u8)) + /* IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE */ | 31 | nla_total_size(sizeof(u8)) + /* IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE */ |
32 | nla_total_size(sizeof(u16)) + /* IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE */ | ||
32 | 0; | 33 | 0; |
33 | } | 34 | } |
34 | 35 | ||
@@ -69,6 +70,10 @@ static int bond_fill_slave_info(struct sk_buff *skb, | |||
69 | IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE, | 70 | IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE, |
70 | ad_port->actor_oper_port_state)) | 71 | ad_port->actor_oper_port_state)) |
71 | goto nla_put_failure; | 72 | goto nla_put_failure; |
73 | if (nla_put_u16(skb, | ||
74 | IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE, | ||
75 | ad_port->partner_oper.port_state)) | ||
76 | goto nla_put_failure; | ||
72 | } | 77 | } |
73 | } | 78 | } |
74 | 79 | ||
diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c index f6c197cee669..7d16c51e6913 100644 --- a/drivers/net/bonding/bond_sysfs_slave.c +++ b/drivers/net/bonding/bond_sysfs_slave.c | |||
@@ -95,6 +95,21 @@ static ssize_t ad_actor_oper_port_state_show(struct slave *slave, char *buf) | |||
95 | } | 95 | } |
96 | static SLAVE_ATTR_RO(ad_actor_oper_port_state); | 96 | static SLAVE_ATTR_RO(ad_actor_oper_port_state); |
97 | 97 | ||
98 | static ssize_t ad_partner_oper_port_state_show(struct slave *slave, char *buf) | ||
99 | { | ||
100 | const struct port *ad_port; | ||
101 | |||
102 | if (BOND_MODE(slave->bond) == BOND_MODE_8023AD) { | ||
103 | ad_port = &SLAVE_AD_INFO(slave)->port; | ||
104 | if (ad_port->aggregator) | ||
105 | return sprintf(buf, "%u\n", | ||
106 | ad_port->partner_oper.port_state); | ||
107 | } | ||
108 | |||
109 | return sprintf(buf, "N/A\n"); | ||
110 | } | ||
111 | static SLAVE_ATTR_RO(ad_partner_oper_port_state); | ||
112 | |||
98 | static const struct slave_attribute *slave_attrs[] = { | 113 | static const struct slave_attribute *slave_attrs[] = { |
99 | &slave_attr_state, | 114 | &slave_attr_state, |
100 | &slave_attr_mii_status, | 115 | &slave_attr_mii_status, |
@@ -103,6 +118,7 @@ static const struct slave_attribute *slave_attrs[] = { | |||
103 | &slave_attr_queue_id, | 118 | &slave_attr_queue_id, |
104 | &slave_attr_ad_aggregator_id, | 119 | &slave_attr_ad_aggregator_id, |
105 | &slave_attr_ad_actor_oper_port_state, | 120 | &slave_attr_ad_actor_oper_port_state, |
121 | &slave_attr_ad_partner_oper_port_state, | ||
106 | NULL | 122 | NULL |
107 | }; | 123 | }; |
108 | 124 | ||