Jiri Pirko | 0a2a78c | 2013-10-18 17:43:33 +0200 | [diff] [blame] | 1 | /* |
| 2 | * drivers/net/bond/bond_netlink.c - Netlink interface for bonding |
| 3 | * Copyright (c) 2013 Jiri Pirko <jiri@resnulli.us> |
sfeldma@cumulusnetworks.com | eecdaa6 | 2013-12-12 14:09:55 -0800 | [diff] [blame] | 4 | * Copyright (c) 2013 Scott Feldman <sfeldma@cumulusnetworks.com> |
Jiri Pirko | 0a2a78c | 2013-10-18 17:43:33 +0200 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 13 | |
| 14 | #include <linux/module.h> |
| 15 | #include <linux/errno.h> |
| 16 | #include <linux/netdevice.h> |
| 17 | #include <linux/etherdevice.h> |
| 18 | #include <linux/if_link.h> |
| 19 | #include <linux/if_ether.h> |
| 20 | #include <net/netlink.h> |
| 21 | #include <net/rtnetlink.h> |
| 22 | #include "bonding.h" |
| 23 | |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 24 | static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = { |
| 25 | [IFLA_BOND_MODE] = { .type = NLA_U8 }, |
Jiri Pirko | ec76aa4 | 2013-10-18 17:43:39 +0200 | [diff] [blame] | 26 | [IFLA_BOND_ACTIVE_SLAVE] = { .type = NLA_U32 }, |
sfeldma@cumulusnetworks.com | eecdaa6 | 2013-12-12 14:09:55 -0800 | [diff] [blame] | 27 | [IFLA_BOND_MIIMON] = { .type = NLA_U32 }, |
sfeldma@cumulusnetworks.com | 25852e2 | 2013-12-12 14:10:02 -0800 | [diff] [blame] | 28 | [IFLA_BOND_UPDELAY] = { .type = NLA_U32 }, |
sfeldma@cumulusnetworks.com | c7461f9 | 2013-12-12 14:10:09 -0800 | [diff] [blame] | 29 | [IFLA_BOND_DOWNDELAY] = { .type = NLA_U32 }, |
sfeldma@cumulusnetworks.com | 9f53e14 | 2013-12-12 14:10:16 -0800 | [diff] [blame] | 30 | [IFLA_BOND_USE_CARRIER] = { .type = NLA_U8 }, |
sfeldma@cumulusnetworks.com | 06151db | 2013-12-12 14:10:24 -0800 | [diff] [blame] | 31 | [IFLA_BOND_ARP_INTERVAL] = { .type = NLA_U32 }, |
sfeldma@cumulusnetworks.com | 7f28fa1 | 2013-12-12 14:10:31 -0800 | [diff] [blame] | 32 | [IFLA_BOND_ARP_IP_TARGET] = { .type = NLA_NESTED }, |
sfeldma@cumulusnetworks.com | 29c4948 | 2013-12-12 14:10:38 -0800 | [diff] [blame] | 33 | [IFLA_BOND_ARP_VALIDATE] = { .type = NLA_U32 }, |
sfeldma@cumulusnetworks.com | d5c8425 | 2013-12-12 14:10:45 -0800 | [diff] [blame] | 34 | [IFLA_BOND_ARP_ALL_TARGETS] = { .type = NLA_U32 }, |
sfeldma@cumulusnetworks.com | 0a98a0d | 2013-12-15 16:41:51 -0800 | [diff] [blame] | 35 | [IFLA_BOND_PRIMARY] = { .type = NLA_U32 }, |
sfeldma@cumulusnetworks.com | 8a41ae4 | 2013-12-15 16:41:58 -0800 | [diff] [blame] | 36 | [IFLA_BOND_PRIMARY_RESELECT] = { .type = NLA_U8 }, |
sfeldma@cumulusnetworks.com | 8990197 | 2013-12-15 16:42:05 -0800 | [diff] [blame^] | 37 | [IFLA_BOND_FAIL_OVER_MAC] = { .type = NLA_U8 }, |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 38 | }; |
| 39 | |
Jiri Pirko | 0a2a78c | 2013-10-18 17:43:33 +0200 | [diff] [blame] | 40 | static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) |
| 41 | { |
| 42 | if (tb[IFLA_ADDRESS]) { |
| 43 | if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) |
| 44 | return -EINVAL; |
| 45 | if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS]))) |
| 46 | return -EADDRNOTAVAIL; |
| 47 | } |
| 48 | return 0; |
| 49 | } |
| 50 | |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 51 | static int bond_changelink(struct net_device *bond_dev, |
| 52 | struct nlattr *tb[], struct nlattr *data[]) |
| 53 | { |
| 54 | struct bonding *bond = netdev_priv(bond_dev); |
sfeldma@cumulusnetworks.com | 06151db | 2013-12-12 14:10:24 -0800 | [diff] [blame] | 55 | int miimon = 0; |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 56 | int err; |
| 57 | |
sfeldma@cumulusnetworks.com | eecdaa6 | 2013-12-12 14:09:55 -0800 | [diff] [blame] | 58 | if (!data) |
| 59 | return 0; |
| 60 | |
| 61 | if (data[IFLA_BOND_MODE]) { |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 62 | int mode = nla_get_u8(data[IFLA_BOND_MODE]); |
| 63 | |
| 64 | err = bond_option_mode_set(bond, mode); |
| 65 | if (err) |
| 66 | return err; |
| 67 | } |
sfeldma@cumulusnetworks.com | eecdaa6 | 2013-12-12 14:09:55 -0800 | [diff] [blame] | 68 | if (data[IFLA_BOND_ACTIVE_SLAVE]) { |
Jiri Pirko | ec76aa4 | 2013-10-18 17:43:39 +0200 | [diff] [blame] | 69 | int ifindex = nla_get_u32(data[IFLA_BOND_ACTIVE_SLAVE]); |
| 70 | struct net_device *slave_dev; |
| 71 | |
| 72 | if (ifindex == 0) { |
| 73 | slave_dev = NULL; |
| 74 | } else { |
| 75 | slave_dev = __dev_get_by_index(dev_net(bond_dev), |
| 76 | ifindex); |
| 77 | if (!slave_dev) |
| 78 | return -ENODEV; |
| 79 | } |
| 80 | err = bond_option_active_slave_set(bond, slave_dev); |
| 81 | if (err) |
| 82 | return err; |
| 83 | } |
sfeldma@cumulusnetworks.com | eecdaa6 | 2013-12-12 14:09:55 -0800 | [diff] [blame] | 84 | if (data[IFLA_BOND_MIIMON]) { |
sfeldma@cumulusnetworks.com | 06151db | 2013-12-12 14:10:24 -0800 | [diff] [blame] | 85 | miimon = nla_get_u32(data[IFLA_BOND_MIIMON]); |
sfeldma@cumulusnetworks.com | eecdaa6 | 2013-12-12 14:09:55 -0800 | [diff] [blame] | 86 | |
| 87 | err = bond_option_miimon_set(bond, miimon); |
| 88 | if (err) |
| 89 | return err; |
| 90 | } |
sfeldma@cumulusnetworks.com | 25852e2 | 2013-12-12 14:10:02 -0800 | [diff] [blame] | 91 | if (data[IFLA_BOND_UPDELAY]) { |
| 92 | int updelay = nla_get_u32(data[IFLA_BOND_UPDELAY]); |
| 93 | |
| 94 | err = bond_option_updelay_set(bond, updelay); |
| 95 | if (err) |
| 96 | return err; |
| 97 | } |
sfeldma@cumulusnetworks.com | c7461f9 | 2013-12-12 14:10:09 -0800 | [diff] [blame] | 98 | if (data[IFLA_BOND_DOWNDELAY]) { |
| 99 | int downdelay = nla_get_u32(data[IFLA_BOND_DOWNDELAY]); |
| 100 | |
| 101 | err = bond_option_downdelay_set(bond, downdelay); |
| 102 | if (err) |
| 103 | return err; |
| 104 | } |
sfeldma@cumulusnetworks.com | 9f53e14 | 2013-12-12 14:10:16 -0800 | [diff] [blame] | 105 | if (data[IFLA_BOND_USE_CARRIER]) { |
| 106 | int use_carrier = nla_get_u8(data[IFLA_BOND_USE_CARRIER]); |
| 107 | |
| 108 | err = bond_option_use_carrier_set(bond, use_carrier); |
| 109 | if (err) |
| 110 | return err; |
| 111 | } |
sfeldma@cumulusnetworks.com | 06151db | 2013-12-12 14:10:24 -0800 | [diff] [blame] | 112 | if (data[IFLA_BOND_ARP_INTERVAL]) { |
| 113 | int arp_interval = nla_get_u32(data[IFLA_BOND_ARP_INTERVAL]); |
| 114 | |
| 115 | if (arp_interval && miimon) { |
| 116 | pr_err("%s: ARP monitoring cannot be used with MII monitoring.\n", |
| 117 | bond->dev->name); |
| 118 | return -EINVAL; |
| 119 | } |
| 120 | |
| 121 | err = bond_option_arp_interval_set(bond, arp_interval); |
| 122 | if (err) |
| 123 | return err; |
| 124 | } |
sfeldma@cumulusnetworks.com | 7f28fa1 | 2013-12-12 14:10:31 -0800 | [diff] [blame] | 125 | if (data[IFLA_BOND_ARP_IP_TARGET]) { |
| 126 | __be32 targets[BOND_MAX_ARP_TARGETS] = { 0, }; |
| 127 | struct nlattr *attr; |
| 128 | int i = 0, rem; |
| 129 | |
| 130 | nla_for_each_nested(attr, data[IFLA_BOND_ARP_IP_TARGET], rem) { |
Jiri Pirko | e7ef941 | 2013-12-14 12:32:10 +0100 | [diff] [blame] | 131 | __be32 target = nla_get_be32(attr); |
sfeldma@cumulusnetworks.com | 7f28fa1 | 2013-12-12 14:10:31 -0800 | [diff] [blame] | 132 | targets[i++] = target; |
| 133 | } |
| 134 | |
| 135 | err = bond_option_arp_ip_targets_set(bond, targets, i); |
| 136 | if (err) |
| 137 | return err; |
| 138 | } |
sfeldma@cumulusnetworks.com | 29c4948 | 2013-12-12 14:10:38 -0800 | [diff] [blame] | 139 | if (data[IFLA_BOND_ARP_VALIDATE]) { |
| 140 | int arp_validate = nla_get_u32(data[IFLA_BOND_ARP_VALIDATE]); |
| 141 | |
| 142 | if (arp_validate && miimon) { |
| 143 | pr_err("%s: ARP validating cannot be used with MII monitoring.\n", |
| 144 | bond->dev->name); |
| 145 | return -EINVAL; |
| 146 | } |
| 147 | |
| 148 | err = bond_option_arp_validate_set(bond, arp_validate); |
| 149 | if (err) |
| 150 | return err; |
| 151 | } |
sfeldma@cumulusnetworks.com | d5c8425 | 2013-12-12 14:10:45 -0800 | [diff] [blame] | 152 | if (data[IFLA_BOND_ARP_ALL_TARGETS]) { |
| 153 | int arp_all_targets = |
| 154 | nla_get_u32(data[IFLA_BOND_ARP_ALL_TARGETS]); |
| 155 | |
| 156 | err = bond_option_arp_all_targets_set(bond, arp_all_targets); |
| 157 | if (err) |
| 158 | return err; |
| 159 | } |
sfeldma@cumulusnetworks.com | 0a98a0d | 2013-12-15 16:41:51 -0800 | [diff] [blame] | 160 | if (data[IFLA_BOND_PRIMARY]) { |
| 161 | int ifindex = nla_get_u32(data[IFLA_BOND_PRIMARY]); |
| 162 | struct net_device *dev; |
| 163 | char *primary = ""; |
| 164 | |
| 165 | dev = __dev_get_by_index(dev_net(bond_dev), ifindex); |
| 166 | if (dev) |
| 167 | primary = dev->name; |
| 168 | |
| 169 | err = bond_option_primary_set(bond, primary); |
| 170 | if (err) |
| 171 | return err; |
| 172 | } |
sfeldma@cumulusnetworks.com | 8a41ae4 | 2013-12-15 16:41:58 -0800 | [diff] [blame] | 173 | if (data[IFLA_BOND_PRIMARY_RESELECT]) { |
| 174 | int primary_reselect = |
| 175 | nla_get_u8(data[IFLA_BOND_PRIMARY_RESELECT]); |
| 176 | |
| 177 | err = bond_option_primary_reselect_set(bond, primary_reselect); |
| 178 | if (err) |
| 179 | return err; |
| 180 | } |
sfeldma@cumulusnetworks.com | 8990197 | 2013-12-15 16:42:05 -0800 | [diff] [blame^] | 181 | if (data[IFLA_BOND_FAIL_OVER_MAC]) { |
| 182 | int fail_over_mac = |
| 183 | nla_get_u8(data[IFLA_BOND_FAIL_OVER_MAC]); |
| 184 | |
| 185 | err = bond_option_fail_over_mac_set(bond, fail_over_mac); |
| 186 | if (err) |
| 187 | return err; |
| 188 | } |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 189 | return 0; |
| 190 | } |
| 191 | |
| 192 | static int bond_newlink(struct net *src_net, struct net_device *bond_dev, |
| 193 | struct nlattr *tb[], struct nlattr *data[]) |
| 194 | { |
| 195 | int err; |
| 196 | |
| 197 | err = bond_changelink(bond_dev, tb, data); |
| 198 | if (err < 0) |
| 199 | return err; |
| 200 | |
| 201 | return register_netdevice(bond_dev); |
| 202 | } |
| 203 | |
| 204 | static size_t bond_get_size(const struct net_device *bond_dev) |
| 205 | { |
Dan Carpenter | e139862 | 2013-11-01 13:18:44 +0300 | [diff] [blame] | 206 | return nla_total_size(sizeof(u8)) + /* IFLA_BOND_MODE */ |
sfeldma@cumulusnetworks.com | eecdaa6 | 2013-12-12 14:09:55 -0800 | [diff] [blame] | 207 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_ACTIVE_SLAVE */ |
| 208 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_MIIMON */ |
sfeldma@cumulusnetworks.com | 25852e2 | 2013-12-12 14:10:02 -0800 | [diff] [blame] | 209 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_UPDELAY */ |
sfeldma@cumulusnetworks.com | c7461f9 | 2013-12-12 14:10:09 -0800 | [diff] [blame] | 210 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_DOWNDELAY */ |
sfeldma@cumulusnetworks.com | 9f53e14 | 2013-12-12 14:10:16 -0800 | [diff] [blame] | 211 | nla_total_size(sizeof(u8)) + /* IFLA_BOND_USE_CARRIER */ |
sfeldma@cumulusnetworks.com | 06151db | 2013-12-12 14:10:24 -0800 | [diff] [blame] | 212 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_ARP_INTERVAL */ |
sfeldma@cumulusnetworks.com | 7f28fa1 | 2013-12-12 14:10:31 -0800 | [diff] [blame] | 213 | /* IFLA_BOND_ARP_IP_TARGET */ |
| 214 | nla_total_size(sizeof(u32)) * BOND_MAX_ARP_TARGETS + |
sfeldma@cumulusnetworks.com | 29c4948 | 2013-12-12 14:10:38 -0800 | [diff] [blame] | 215 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_ARP_VALIDATE */ |
sfeldma@cumulusnetworks.com | d5c8425 | 2013-12-12 14:10:45 -0800 | [diff] [blame] | 216 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_ARP_ALL_TARGETS */ |
sfeldma@cumulusnetworks.com | 0a98a0d | 2013-12-15 16:41:51 -0800 | [diff] [blame] | 217 | nla_total_size(sizeof(u32)) + /* IFLA_BOND_PRIMARY */ |
sfeldma@cumulusnetworks.com | 8a41ae4 | 2013-12-15 16:41:58 -0800 | [diff] [blame] | 218 | nla_total_size(sizeof(u8)) + /* IFLA_BOND_PRIMARY_RESELECT */ |
sfeldma@cumulusnetworks.com | 8990197 | 2013-12-15 16:42:05 -0800 | [diff] [blame^] | 219 | nla_total_size(sizeof(u8)) + /* IFLA_BOND_FAIL_OVER_MAC */ |
sfeldma@cumulusnetworks.com | eecdaa6 | 2013-12-12 14:09:55 -0800 | [diff] [blame] | 220 | 0; |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | static int bond_fill_info(struct sk_buff *skb, |
| 224 | const struct net_device *bond_dev) |
| 225 | { |
| 226 | struct bonding *bond = netdev_priv(bond_dev); |
Jiri Pirko | ec76aa4 | 2013-10-18 17:43:39 +0200 | [diff] [blame] | 227 | struct net_device *slave_dev = bond_option_active_slave_get(bond); |
sfeldma@cumulusnetworks.com | 7f28fa1 | 2013-12-12 14:10:31 -0800 | [diff] [blame] | 228 | struct nlattr *targets; |
| 229 | int i, targets_added; |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 230 | |
sfeldma@cumulusnetworks.com | eecdaa6 | 2013-12-12 14:09:55 -0800 | [diff] [blame] | 231 | if (nla_put_u8(skb, IFLA_BOND_MODE, bond->params.mode)) |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 232 | goto nla_put_failure; |
sfeldma@cumulusnetworks.com | eecdaa6 | 2013-12-12 14:09:55 -0800 | [diff] [blame] | 233 | |
| 234 | if (slave_dev && |
| 235 | nla_put_u32(skb, IFLA_BOND_ACTIVE_SLAVE, slave_dev->ifindex)) |
| 236 | goto nla_put_failure; |
| 237 | |
| 238 | if (nla_put_u32(skb, IFLA_BOND_MIIMON, bond->params.miimon)) |
| 239 | goto nla_put_failure; |
| 240 | |
sfeldma@cumulusnetworks.com | 25852e2 | 2013-12-12 14:10:02 -0800 | [diff] [blame] | 241 | if (nla_put_u32(skb, IFLA_BOND_UPDELAY, |
| 242 | bond->params.updelay * bond->params.miimon)) |
| 243 | goto nla_put_failure; |
| 244 | |
sfeldma@cumulusnetworks.com | c7461f9 | 2013-12-12 14:10:09 -0800 | [diff] [blame] | 245 | if (nla_put_u32(skb, IFLA_BOND_DOWNDELAY, |
| 246 | bond->params.downdelay * bond->params.miimon)) |
| 247 | goto nla_put_failure; |
| 248 | |
sfeldma@cumulusnetworks.com | 9f53e14 | 2013-12-12 14:10:16 -0800 | [diff] [blame] | 249 | if (nla_put_u8(skb, IFLA_BOND_USE_CARRIER, bond->params.use_carrier)) |
| 250 | goto nla_put_failure; |
| 251 | |
sfeldma@cumulusnetworks.com | 06151db | 2013-12-12 14:10:24 -0800 | [diff] [blame] | 252 | if (nla_put_u32(skb, IFLA_BOND_ARP_INTERVAL, bond->params.arp_interval)) |
| 253 | goto nla_put_failure; |
| 254 | |
sfeldma@cumulusnetworks.com | 7f28fa1 | 2013-12-12 14:10:31 -0800 | [diff] [blame] | 255 | targets = nla_nest_start(skb, IFLA_BOND_ARP_IP_TARGET); |
| 256 | if (!targets) |
| 257 | goto nla_put_failure; |
| 258 | |
| 259 | targets_added = 0; |
| 260 | for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) { |
| 261 | if (bond->params.arp_targets[i]) { |
Jiri Pirko | e7ef941 | 2013-12-14 12:32:10 +0100 | [diff] [blame] | 262 | nla_put_be32(skb, i, bond->params.arp_targets[i]); |
sfeldma@cumulusnetworks.com | 7f28fa1 | 2013-12-12 14:10:31 -0800 | [diff] [blame] | 263 | targets_added = 1; |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | if (targets_added) |
| 268 | nla_nest_end(skb, targets); |
| 269 | else |
| 270 | nla_nest_cancel(skb, targets); |
| 271 | |
sfeldma@cumulusnetworks.com | 29c4948 | 2013-12-12 14:10:38 -0800 | [diff] [blame] | 272 | if (nla_put_u32(skb, IFLA_BOND_ARP_VALIDATE, bond->params.arp_validate)) |
| 273 | goto nla_put_failure; |
| 274 | |
sfeldma@cumulusnetworks.com | d5c8425 | 2013-12-12 14:10:45 -0800 | [diff] [blame] | 275 | if (nla_put_u32(skb, IFLA_BOND_ARP_ALL_TARGETS, |
| 276 | bond->params.arp_all_targets)) |
| 277 | goto nla_put_failure; |
| 278 | |
sfeldma@cumulusnetworks.com | 0a98a0d | 2013-12-15 16:41:51 -0800 | [diff] [blame] | 279 | if (bond->primary_slave && |
| 280 | nla_put_u32(skb, IFLA_BOND_PRIMARY, |
| 281 | bond->primary_slave->dev->ifindex)) |
| 282 | goto nla_put_failure; |
| 283 | |
sfeldma@cumulusnetworks.com | 8a41ae4 | 2013-12-15 16:41:58 -0800 | [diff] [blame] | 284 | if (nla_put_u8(skb, IFLA_BOND_PRIMARY_RESELECT, |
| 285 | bond->params.primary_reselect)) |
| 286 | goto nla_put_failure; |
| 287 | |
sfeldma@cumulusnetworks.com | 8990197 | 2013-12-15 16:42:05 -0800 | [diff] [blame^] | 288 | if (nla_put_u8(skb, IFLA_BOND_FAIL_OVER_MAC, |
| 289 | bond->params.fail_over_mac)) |
| 290 | goto nla_put_failure; |
| 291 | |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 292 | return 0; |
| 293 | |
| 294 | nla_put_failure: |
| 295 | return -EMSGSIZE; |
| 296 | } |
| 297 | |
Jiri Pirko | 0a2a78c | 2013-10-18 17:43:33 +0200 | [diff] [blame] | 298 | struct rtnl_link_ops bond_link_ops __read_mostly = { |
| 299 | .kind = "bond", |
| 300 | .priv_size = sizeof(struct bonding), |
| 301 | .setup = bond_setup, |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 302 | .maxtype = IFLA_BOND_MAX, |
| 303 | .policy = bond_policy, |
Jiri Pirko | 0a2a78c | 2013-10-18 17:43:33 +0200 | [diff] [blame] | 304 | .validate = bond_validate, |
Jiri Pirko | 90af231 | 2013-10-18 17:43:38 +0200 | [diff] [blame] | 305 | .newlink = bond_newlink, |
| 306 | .changelink = bond_changelink, |
| 307 | .get_size = bond_get_size, |
| 308 | .fill_info = bond_fill_info, |
Jiri Pirko | 0a2a78c | 2013-10-18 17:43:33 +0200 | [diff] [blame] | 309 | .get_num_tx_queues = bond_get_num_tx_queues, |
| 310 | .get_num_rx_queues = bond_get_num_tx_queues, /* Use the same number |
| 311 | as for TX queues */ |
| 312 | }; |
| 313 | |
| 314 | int __init bond_netlink_init(void) |
| 315 | { |
| 316 | return rtnl_link_register(&bond_link_ops); |
| 317 | } |
| 318 | |
David S. Miller | a729e83 | 2013-10-19 19:09:18 -0400 | [diff] [blame] | 319 | void bond_netlink_fini(void) |
Jiri Pirko | 0a2a78c | 2013-10-18 17:43:33 +0200 | [diff] [blame] | 320 | { |
| 321 | rtnl_link_unregister(&bond_link_ops); |
| 322 | } |
| 323 | |
| 324 | MODULE_ALIAS_RTNL_LINK("bond"); |