aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2014-01-22 03:05:56 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-23 00:57:17 -0500
commit3bad540ed8285fb53f6365420bba0320d8cd2066 (patch)
tree89801857c75c7cf93d18294096452bd8aebbe957 /drivers/net
parentba7d49b1f0f8e5f24294a880ed576964059af5ef (diff)
bonding: convert netlink to use slave data info api
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c1
-rw-r--r--drivers/net/bonding/bond_netlink.c21
-rw-r--r--drivers/net/bonding/bonding.h1
3 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2ca949f6e995..4a8ccce3315a 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3824,7 +3824,6 @@ static const struct net_device_ops bond_netdev_ops = {
3824#endif 3824#endif
3825 .ndo_add_slave = bond_enslave, 3825 .ndo_add_slave = bond_enslave,
3826 .ndo_del_slave = bond_release, 3826 .ndo_del_slave = bond_release,
3827 .ndo_get_slave = bond_get_slave,
3828 .ndo_fix_features = bond_fix_features, 3827 .ndo_fix_features = bond_fix_features,
3829}; 3828};
3830 3829
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index 549eb8702ebb..70651f8e8e3b 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -21,10 +21,23 @@
21#include <net/rtnetlink.h> 21#include <net/rtnetlink.h>
22#include "bonding.h" 22#include "bonding.h"
23 23
24int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb) 24static size_t bond_get_slave_size(const struct net_device *bond_dev,
25 const struct net_device *slave_dev)
26{
27 return nla_total_size(sizeof(u8)) + /* IFLA_BOND_SLAVE_STATE */
28 nla_total_size(sizeof(u8)) + /* IFLA_BOND_SLAVE_MII_STATUS */
29 nla_total_size(sizeof(u32)) + /* IFLA_BOND_SLAVE_LINK_FAILURE_COUNT */
30 nla_total_size(MAX_ADDR_LEN) + /* IFLA_BOND_SLAVE_PERM_HWADDR */
31 nla_total_size(sizeof(u16)) + /* IFLA_BOND_SLAVE_QUEUE_ID */
32 nla_total_size(sizeof(u16)) + /* IFLA_BOND_SLAVE_AD_AGGREGATOR_ID */
33 0;
34}
35
36static int bond_fill_slave_info(struct sk_buff *skb,
37 const struct net_device *bond_dev,
38 const struct net_device *slave_dev)
25{ 39{
26 struct slave *slave = bond_slave_get_rtnl(slave_dev); 40 struct slave *slave = bond_slave_get_rtnl(slave_dev);
27 const struct aggregator *agg;
28 41
29 if (nla_put_u8(skb, IFLA_BOND_SLAVE_STATE, bond_slave_state(slave))) 42 if (nla_put_u8(skb, IFLA_BOND_SLAVE_STATE, bond_slave_state(slave)))
30 goto nla_put_failure; 43 goto nla_put_failure;
@@ -44,6 +57,8 @@ int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb)
44 goto nla_put_failure; 57 goto nla_put_failure;
45 58
46 if (slave->bond->params.mode == BOND_MODE_8023AD) { 59 if (slave->bond->params.mode == BOND_MODE_8023AD) {
60 const struct aggregator *agg;
61
47 agg = SLAVE_AD_INFO(slave).port.aggregator; 62 agg = SLAVE_AD_INFO(slave).port.aggregator;
48 if (agg) 63 if (agg)
49 if (nla_put_u16(skb, IFLA_BOND_SLAVE_AD_AGGREGATOR_ID, 64 if (nla_put_u16(skb, IFLA_BOND_SLAVE_AD_AGGREGATOR_ID,
@@ -541,6 +556,8 @@ struct rtnl_link_ops bond_link_ops __read_mostly = {
541 .get_num_tx_queues = bond_get_num_tx_queues, 556 .get_num_tx_queues = bond_get_num_tx_queues,
542 .get_num_rx_queues = bond_get_num_tx_queues, /* Use the same number 557 .get_num_rx_queues = bond_get_num_tx_queues, /* Use the same number
543 as for TX queues */ 558 as for TX queues */
559 .get_slave_size = bond_get_slave_size,
560 .fill_slave_info = bond_fill_slave_info,
544}; 561};
545 562
546int __init bond_netlink_init(void) 563int __init bond_netlink_init(void)
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 8032e07fec0e..1a9062f4e0d6 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -436,7 +436,6 @@ int bond_sysfs_slave_add(struct slave *slave);
436void bond_sysfs_slave_del(struct slave *slave); 436void bond_sysfs_slave_del(struct slave *slave);
437int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); 437int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
438int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); 438int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
439int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb);
440int bond_xmit_hash(struct bonding *bond, struct sk_buff *skb, int count); 439int bond_xmit_hash(struct bonding *bond, struct sk_buff *skb, int count);
441int bond_parse_parm(const char *mode_arg, const struct bond_parm_tbl *tbl); 440int bond_parse_parm(const char *mode_arg, const struct bond_parm_tbl *tbl);
442int bond_parm_tbl_lookup(int mode, const struct bond_parm_tbl *tbl); 441int bond_parm_tbl_lookup(int mode, const struct bond_parm_tbl *tbl);