diff options
author | sfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com> | 2013-12-12 17:10:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-14 01:07:32 -0500 |
commit | 06151dbcf3f76edbe900138cde9e862f429918c9 (patch) | |
tree | 84622a95346240f5ca72ca1451c3fb8d815725c8 /drivers/net/bonding/bond_netlink.c | |
parent | 9f53e14e86c46a2300f17309f6308ad0dfbb53ff (diff) |
bonding: add arp_interval netlink support
Add IFLA_BOND_ARP_INTERVAL to allow get/set of bonding parameter
arp_interval via netlink.
Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_netlink.c')
-rw-r--r-- | drivers/net/bonding/bond_netlink.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c index 7edf6399cea2..58e71235b75f 100644 --- a/drivers/net/bonding/bond_netlink.c +++ b/drivers/net/bonding/bond_netlink.c | |||
@@ -28,6 +28,7 @@ static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = { | |||
28 | [IFLA_BOND_UPDELAY] = { .type = NLA_U32 }, | 28 | [IFLA_BOND_UPDELAY] = { .type = NLA_U32 }, |
29 | [IFLA_BOND_DOWNDELAY] = { .type = NLA_U32 }, | 29 | [IFLA_BOND_DOWNDELAY] = { .type = NLA_U32 }, |
30 | [IFLA_BOND_USE_CARRIER] = { .type = NLA_U8 }, | 30 | [IFLA_BOND_USE_CARRIER] = { .type = NLA_U8 }, |
31 | [IFLA_BOND_ARP_INTERVAL] = { .type = NLA_U32 }, | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) | 34 | static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) |
@@ -45,6 +46,7 @@ static int bond_changelink(struct net_device *bond_dev, | |||
45 | struct nlattr *tb[], struct nlattr *data[]) | 46 | struct nlattr *tb[], struct nlattr *data[]) |
46 | { | 47 | { |
47 | struct bonding *bond = netdev_priv(bond_dev); | 48 | struct bonding *bond = netdev_priv(bond_dev); |
49 | int miimon = 0; | ||
48 | int err; | 50 | int err; |
49 | 51 | ||
50 | if (!data) | 52 | if (!data) |
@@ -74,7 +76,7 @@ static int bond_changelink(struct net_device *bond_dev, | |||
74 | return err; | 76 | return err; |
75 | } | 77 | } |
76 | if (data[IFLA_BOND_MIIMON]) { | 78 | if (data[IFLA_BOND_MIIMON]) { |
77 | int miimon = nla_get_u32(data[IFLA_BOND_MIIMON]); | 79 | miimon = nla_get_u32(data[IFLA_BOND_MIIMON]); |
78 | 80 | ||
79 | err = bond_option_miimon_set(bond, miimon); | 81 | err = bond_option_miimon_set(bond, miimon); |
80 | if (err) | 82 | if (err) |
@@ -101,6 +103,19 @@ static int bond_changelink(struct net_device *bond_dev, | |||
101 | if (err) | 103 | if (err) |
102 | return err; | 104 | return err; |
103 | } | 105 | } |
106 | if (data[IFLA_BOND_ARP_INTERVAL]) { | ||
107 | int arp_interval = nla_get_u32(data[IFLA_BOND_ARP_INTERVAL]); | ||
108 | |||
109 | if (arp_interval && miimon) { | ||
110 | pr_err("%s: ARP monitoring cannot be used with MII monitoring.\n", | ||
111 | bond->dev->name); | ||
112 | return -EINVAL; | ||
113 | } | ||
114 | |||
115 | err = bond_option_arp_interval_set(bond, arp_interval); | ||
116 | if (err) | ||
117 | return err; | ||
118 | } | ||
104 | return 0; | 119 | return 0; |
105 | } | 120 | } |
106 | 121 | ||
@@ -124,6 +139,7 @@ static size_t bond_get_size(const struct net_device *bond_dev) | |||
124 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_UPDELAY */ | 139 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_UPDELAY */ |
125 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_DOWNDELAY */ | 140 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_DOWNDELAY */ |
126 | nla_total_size(sizeof(u8)) + /* IFLA_BOND_USE_CARRIER */ | 141 | nla_total_size(sizeof(u8)) + /* IFLA_BOND_USE_CARRIER */ |
142 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_ARP_INTERVAL */ | ||
127 | 0; | 143 | 0; |
128 | } | 144 | } |
129 | 145 | ||
@@ -154,6 +170,9 @@ static int bond_fill_info(struct sk_buff *skb, | |||
154 | if (nla_put_u8(skb, IFLA_BOND_USE_CARRIER, bond->params.use_carrier)) | 170 | if (nla_put_u8(skb, IFLA_BOND_USE_CARRIER, bond->params.use_carrier)) |
155 | goto nla_put_failure; | 171 | goto nla_put_failure; |
156 | 172 | ||
173 | if (nla_put_u32(skb, IFLA_BOND_ARP_INTERVAL, bond->params.arp_interval)) | ||
174 | goto nla_put_failure; | ||
175 | |||
157 | return 0; | 176 | return 0; |
158 | 177 | ||
159 | nla_put_failure: | 178 | nla_put_failure: |