dba1f2e223718a3c151b7ca5633c6f5caaa6f935
[firefly-linux-kernel-4.4.55.git] / drivers / net / bonding / bond_netlink.c
1 /*
2  * drivers/net/bond/bond_netlink.c - Netlink interface for bonding
3  * Copyright (c) 2013 Jiri Pirko <jiri@resnulli.us>
4  * Copyright (c) 2013 Scott Feldman <sfeldma@cumulusnetworks.com>
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
24 int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb)
25 {
26         struct slave *slave = bond_slave_get_rtnl(slave_dev);
27         const struct aggregator *agg;
28
29         if (nla_put_u8(skb, IFLA_SLAVE_STATE, bond_slave_state(slave)))
30                 goto nla_put_failure;
31
32         if (nla_put_u8(skb, IFLA_SLAVE_MII_STATUS, slave->link))
33                 goto nla_put_failure;
34
35         if (nla_put_u32(skb, IFLA_SLAVE_LINK_FAILURE_COUNT,
36                         slave->link_failure_count))
37                 goto nla_put_failure;
38
39         if (nla_put(skb, IFLA_SLAVE_PERM_HWADDR,
40                     slave_dev->addr_len, slave->perm_hwaddr))
41                 goto nla_put_failure;
42
43         if (nla_put_u16(skb, IFLA_SLAVE_QUEUE_ID, slave->queue_id))
44                 goto nla_put_failure;
45
46         if (slave->bond->params.mode == BOND_MODE_8023AD) {
47                 agg = SLAVE_AD_INFO(slave).port.aggregator;
48                 if (agg)
49                         if (nla_put_u16(skb, IFLA_SLAVE_AD_AGGREGATOR_ID,
50                                         agg->aggregator_identifier))
51                                 goto nla_put_failure;
52         }
53
54         return 0;
55
56 nla_put_failure:
57         return -EMSGSIZE;
58 }
59
60 static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = {
61         [IFLA_BOND_MODE]                = { .type = NLA_U8 },
62         [IFLA_BOND_ACTIVE_SLAVE]        = { .type = NLA_U32 },
63         [IFLA_BOND_MIIMON]              = { .type = NLA_U32 },
64         [IFLA_BOND_UPDELAY]             = { .type = NLA_U32 },
65         [IFLA_BOND_DOWNDELAY]           = { .type = NLA_U32 },
66         [IFLA_BOND_USE_CARRIER]         = { .type = NLA_U8 },
67         [IFLA_BOND_ARP_INTERVAL]        = { .type = NLA_U32 },
68         [IFLA_BOND_ARP_IP_TARGET]       = { .type = NLA_NESTED },
69         [IFLA_BOND_ARP_VALIDATE]        = { .type = NLA_U32 },
70         [IFLA_BOND_ARP_ALL_TARGETS]     = { .type = NLA_U32 },
71         [IFLA_BOND_PRIMARY]             = { .type = NLA_U32 },
72         [IFLA_BOND_PRIMARY_RESELECT]    = { .type = NLA_U8 },
73         [IFLA_BOND_FAIL_OVER_MAC]       = { .type = NLA_U8 },
74         [IFLA_BOND_XMIT_HASH_POLICY]    = { .type = NLA_U8 },
75         [IFLA_BOND_RESEND_IGMP]         = { .type = NLA_U32 },
76         [IFLA_BOND_NUM_PEER_NOTIF]      = { .type = NLA_U8 },
77         [IFLA_BOND_ALL_SLAVES_ACTIVE]   = { .type = NLA_U8 },
78         [IFLA_BOND_MIN_LINKS]           = { .type = NLA_U32 },
79         [IFLA_BOND_LP_INTERVAL]         = { .type = NLA_U32 },
80         [IFLA_BOND_PACKETS_PER_SLAVE]   = { .type = NLA_U32 },
81         [IFLA_BOND_AD_LACP_RATE]        = { .type = NLA_U8 },
82         [IFLA_BOND_AD_SELECT]           = { .type = NLA_U8 },
83         [IFLA_BOND_AD_INFO]             = { .type = NLA_NESTED },
84 };
85
86 static int bond_validate(struct nlattr *tb[], struct nlattr *data[])
87 {
88         if (tb[IFLA_ADDRESS]) {
89                 if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
90                         return -EINVAL;
91                 if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
92                         return -EADDRNOTAVAIL;
93         }
94         return 0;
95 }
96
97 static int bond_changelink(struct net_device *bond_dev,
98                            struct nlattr *tb[], struct nlattr *data[])
99 {
100         struct bonding *bond = netdev_priv(bond_dev);
101         struct bond_opt_value newval;
102         int miimon = 0;
103         int err;
104
105         if (!data)
106                 return 0;
107
108         if (data[IFLA_BOND_MODE]) {
109                 int mode = nla_get_u8(data[IFLA_BOND_MODE]);
110
111                 bond_opt_initval(&newval, mode);
112                 err = __bond_opt_set(bond, BOND_OPT_MODE, &newval);
113                 if (err)
114                         return err;
115         }
116         if (data[IFLA_BOND_ACTIVE_SLAVE]) {
117                 int ifindex = nla_get_u32(data[IFLA_BOND_ACTIVE_SLAVE]);
118                 struct net_device *slave_dev;
119                 char *active_slave = "";
120
121                 if (ifindex != 0) {
122                         slave_dev = __dev_get_by_index(dev_net(bond_dev),
123                                                        ifindex);
124                         if (!slave_dev)
125                                 return -ENODEV;
126                         active_slave = slave_dev->name;
127                 }
128                 bond_opt_initstr(&newval, active_slave);
129                 err = __bond_opt_set(bond, BOND_OPT_ACTIVE_SLAVE, &newval);
130                 if (err)
131                         return err;
132         }
133         if (data[IFLA_BOND_MIIMON]) {
134                 miimon = nla_get_u32(data[IFLA_BOND_MIIMON]);
135
136                 bond_opt_initval(&newval, miimon);
137                 err = __bond_opt_set(bond, BOND_OPT_MIIMON, &newval);
138                 if (err)
139                         return err;
140         }
141         if (data[IFLA_BOND_UPDELAY]) {
142                 int updelay = nla_get_u32(data[IFLA_BOND_UPDELAY]);
143
144                 bond_opt_initval(&newval, updelay);
145                 err = __bond_opt_set(bond, BOND_OPT_UPDELAY, &newval);
146                 if (err)
147                         return err;
148         }
149         if (data[IFLA_BOND_DOWNDELAY]) {
150                 int downdelay = nla_get_u32(data[IFLA_BOND_DOWNDELAY]);
151
152                 bond_opt_initval(&newval, downdelay);
153                 err = __bond_opt_set(bond, BOND_OPT_DOWNDELAY, &newval);
154                 if (err)
155                         return err;
156         }
157         if (data[IFLA_BOND_USE_CARRIER]) {
158                 int use_carrier = nla_get_u8(data[IFLA_BOND_USE_CARRIER]);
159
160                 bond_opt_initval(&newval, use_carrier);
161                 err = __bond_opt_set(bond, BOND_OPT_USE_CARRIER, &newval);
162                 if (err)
163                         return err;
164         }
165         if (data[IFLA_BOND_ARP_INTERVAL]) {
166                 int arp_interval = nla_get_u32(data[IFLA_BOND_ARP_INTERVAL]);
167
168                 if (arp_interval && miimon) {
169                         pr_err("%s: ARP monitoring cannot be used with MII monitoring.\n",
170                                bond->dev->name);
171                         return -EINVAL;
172                 }
173
174                 bond_opt_initval(&newval, arp_interval);
175                 err = __bond_opt_set(bond, BOND_OPT_ARP_INTERVAL, &newval);
176                 if (err)
177                         return err;
178         }
179         if (data[IFLA_BOND_ARP_IP_TARGET]) {
180                 struct nlattr *attr;
181                 int i = 0, rem;
182
183                 bond_option_arp_ip_targets_clear(bond);
184                 nla_for_each_nested(attr, data[IFLA_BOND_ARP_IP_TARGET], rem) {
185                         __be32 target = nla_get_be32(attr);
186
187                         bond_opt_initval(&newval, target);
188                         err = __bond_opt_set(bond, BOND_OPT_ARP_TARGETS,
189                                              &newval);
190                         if (err)
191                                 break;
192                         i++;
193                 }
194                 if (i == 0 && bond->params.arp_interval)
195                         pr_warn("%s: removing last arp target with arp_interval on\n",
196                                 bond->dev->name);
197                 if (err)
198                         return err;
199         }
200         if (data[IFLA_BOND_ARP_VALIDATE]) {
201                 int arp_validate = nla_get_u32(data[IFLA_BOND_ARP_VALIDATE]);
202
203                 if (arp_validate && miimon) {
204                         pr_err("%s: ARP validating cannot be used with MII monitoring.\n",
205                                bond->dev->name);
206                         return -EINVAL;
207                 }
208
209                 bond_opt_initval(&newval, arp_validate);
210                 err = __bond_opt_set(bond, BOND_OPT_ARP_VALIDATE, &newval);
211                 if (err)
212                         return err;
213         }
214         if (data[IFLA_BOND_ARP_ALL_TARGETS]) {
215                 int arp_all_targets =
216                         nla_get_u32(data[IFLA_BOND_ARP_ALL_TARGETS]);
217
218                 bond_opt_initval(&newval, arp_all_targets);
219                 err = __bond_opt_set(bond, BOND_OPT_ARP_ALL_TARGETS, &newval);
220                 if (err)
221                         return err;
222         }
223         if (data[IFLA_BOND_PRIMARY]) {
224                 int ifindex = nla_get_u32(data[IFLA_BOND_PRIMARY]);
225                 struct net_device *dev;
226                 char *primary = "";
227
228                 dev = __dev_get_by_index(dev_net(bond_dev), ifindex);
229                 if (dev)
230                         primary = dev->name;
231
232                 bond_opt_initstr(&newval, primary);
233                 err = __bond_opt_set(bond, BOND_OPT_PRIMARY, &newval);
234                 if (err)
235                         return err;
236         }
237         if (data[IFLA_BOND_PRIMARY_RESELECT]) {
238                 int primary_reselect =
239                         nla_get_u8(data[IFLA_BOND_PRIMARY_RESELECT]);
240
241                 bond_opt_initval(&newval, primary_reselect);
242                 err = __bond_opt_set(bond, BOND_OPT_PRIMARY_RESELECT, &newval);
243                 if (err)
244                         return err;
245         }
246         if (data[IFLA_BOND_FAIL_OVER_MAC]) {
247                 int fail_over_mac =
248                         nla_get_u8(data[IFLA_BOND_FAIL_OVER_MAC]);
249
250                 bond_opt_initval(&newval, fail_over_mac);
251                 err = __bond_opt_set(bond, BOND_OPT_FAIL_OVER_MAC, &newval);
252                 if (err)
253                         return err;
254         }
255         if (data[IFLA_BOND_XMIT_HASH_POLICY]) {
256                 int xmit_hash_policy =
257                         nla_get_u8(data[IFLA_BOND_XMIT_HASH_POLICY]);
258
259                 bond_opt_initval(&newval, xmit_hash_policy);
260                 err = __bond_opt_set(bond, BOND_OPT_XMIT_HASH, &newval);
261                 if (err)
262                         return err;
263         }
264         if (data[IFLA_BOND_RESEND_IGMP]) {
265                 int resend_igmp =
266                         nla_get_u32(data[IFLA_BOND_RESEND_IGMP]);
267
268                 err = bond_option_resend_igmp_set(bond, resend_igmp);
269                 if (err)
270                         return err;
271         }
272         if (data[IFLA_BOND_NUM_PEER_NOTIF]) {
273                 int num_peer_notif =
274                         nla_get_u8(data[IFLA_BOND_NUM_PEER_NOTIF]);
275
276                 bond_opt_initval(&newval, num_peer_notif);
277                 err = __bond_opt_set(bond, BOND_OPT_NUM_PEER_NOTIF, &newval);
278                 if (err)
279                         return err;
280         }
281         if (data[IFLA_BOND_ALL_SLAVES_ACTIVE]) {
282                 int all_slaves_active =
283                         nla_get_u8(data[IFLA_BOND_ALL_SLAVES_ACTIVE]);
284
285                 err = bond_option_all_slaves_active_set(bond,
286                                                         all_slaves_active);
287                 if (err)
288                         return err;
289         }
290         if (data[IFLA_BOND_MIN_LINKS]) {
291                 int min_links =
292                         nla_get_u32(data[IFLA_BOND_MIN_LINKS]);
293
294                 bond_opt_initval(&newval, min_links);
295                 err = __bond_opt_set(bond, BOND_OPT_MINLINKS, &newval);
296                 if (err)
297                         return err;
298         }
299         if (data[IFLA_BOND_LP_INTERVAL]) {
300                 int lp_interval =
301                         nla_get_u32(data[IFLA_BOND_LP_INTERVAL]);
302
303                 err = bond_option_lp_interval_set(bond, lp_interval);
304                 if (err)
305                         return err;
306         }
307         if (data[IFLA_BOND_PACKETS_PER_SLAVE]) {
308                 int packets_per_slave =
309                         nla_get_u32(data[IFLA_BOND_PACKETS_PER_SLAVE]);
310
311                 bond_opt_initval(&newval, packets_per_slave);
312                 err = __bond_opt_set(bond, BOND_OPT_PACKETS_PER_SLAVE, &newval);
313                 if (err)
314                         return err;
315         }
316         if (data[IFLA_BOND_AD_LACP_RATE]) {
317                 int lacp_rate =
318                         nla_get_u8(data[IFLA_BOND_AD_LACP_RATE]);
319
320                 bond_opt_initval(&newval, lacp_rate);
321                 err = __bond_opt_set(bond, BOND_OPT_LACP_RATE, &newval);
322                 if (err)
323                         return err;
324         }
325         if (data[IFLA_BOND_AD_SELECT]) {
326                 int ad_select =
327                         nla_get_u8(data[IFLA_BOND_AD_SELECT]);
328
329                 bond_opt_initval(&newval, ad_select);
330                 err = __bond_opt_set(bond, BOND_OPT_AD_SELECT, &newval);
331                 if (err)
332                         return err;
333         }
334         return 0;
335 }
336
337 static int bond_newlink(struct net *src_net, struct net_device *bond_dev,
338                         struct nlattr *tb[], struct nlattr *data[])
339 {
340         int err;
341
342         err = bond_changelink(bond_dev, tb, data);
343         if (err < 0)
344                 return err;
345
346         return register_netdevice(bond_dev);
347 }
348
349 static size_t bond_get_size(const struct net_device *bond_dev)
350 {
351         return nla_total_size(sizeof(u8)) +     /* IFLA_BOND_MODE */
352                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_ACTIVE_SLAVE */
353                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_MIIMON */
354                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_UPDELAY */
355                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_DOWNDELAY */
356                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_USE_CARRIER */
357                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_ARP_INTERVAL */
358                                                 /* IFLA_BOND_ARP_IP_TARGET */
359                 nla_total_size(sizeof(struct nlattr)) +
360                 nla_total_size(sizeof(u32)) * BOND_MAX_ARP_TARGETS +
361                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_ARP_VALIDATE */
362                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_ARP_ALL_TARGETS */
363                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_PRIMARY */
364                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_PRIMARY_RESELECT */
365                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_FAIL_OVER_MAC */
366                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_XMIT_HASH_POLICY */
367                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_RESEND_IGMP */
368                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_NUM_PEER_NOTIF */
369                 nla_total_size(sizeof(u8)) +   /* IFLA_BOND_ALL_SLAVES_ACTIVE */
370                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_MIN_LINKS */
371                 nla_total_size(sizeof(u32)) +   /* IFLA_BOND_LP_INTERVAL */
372                 nla_total_size(sizeof(u32)) +  /* IFLA_BOND_PACKETS_PER_SLAVE */
373                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_AD_LACP_RATE */
374                 nla_total_size(sizeof(u8)) +    /* IFLA_BOND_AD_SELECT */
375                 nla_total_size(sizeof(struct nlattr)) + /* IFLA_BOND_AD_INFO */
376                 nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_AGGREGATOR */
377                 nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_NUM_PORTS */
378                 nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_ACTOR_KEY */
379                 nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_PARTNER_KEY*/
380                 nla_total_size(ETH_ALEN) +    /* IFLA_BOND_AD_INFO_PARTNER_MAC*/
381                 0;
382 }
383
384 static int bond_fill_info(struct sk_buff *skb,
385                           const struct net_device *bond_dev)
386 {
387         struct bonding *bond = netdev_priv(bond_dev);
388         struct net_device *slave_dev = bond_option_active_slave_get(bond);
389         struct nlattr *targets;
390         unsigned int packets_per_slave;
391         int i, targets_added;
392
393         if (nla_put_u8(skb, IFLA_BOND_MODE, bond->params.mode))
394                 goto nla_put_failure;
395
396         if (slave_dev &&
397             nla_put_u32(skb, IFLA_BOND_ACTIVE_SLAVE, slave_dev->ifindex))
398                 goto nla_put_failure;
399
400         if (nla_put_u32(skb, IFLA_BOND_MIIMON, bond->params.miimon))
401                 goto nla_put_failure;
402
403         if (nla_put_u32(skb, IFLA_BOND_UPDELAY,
404                         bond->params.updelay * bond->params.miimon))
405                 goto nla_put_failure;
406
407         if (nla_put_u32(skb, IFLA_BOND_DOWNDELAY,
408                         bond->params.downdelay * bond->params.miimon))
409                 goto nla_put_failure;
410
411         if (nla_put_u8(skb, IFLA_BOND_USE_CARRIER, bond->params.use_carrier))
412                 goto nla_put_failure;
413
414         if (nla_put_u32(skb, IFLA_BOND_ARP_INTERVAL, bond->params.arp_interval))
415                 goto nla_put_failure;
416
417         targets = nla_nest_start(skb, IFLA_BOND_ARP_IP_TARGET);
418         if (!targets)
419                 goto nla_put_failure;
420
421         targets_added = 0;
422         for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) {
423                 if (bond->params.arp_targets[i]) {
424                         nla_put_be32(skb, i, bond->params.arp_targets[i]);
425                         targets_added = 1;
426                 }
427         }
428
429         if (targets_added)
430                 nla_nest_end(skb, targets);
431         else
432                 nla_nest_cancel(skb, targets);
433
434         if (nla_put_u32(skb, IFLA_BOND_ARP_VALIDATE, bond->params.arp_validate))
435                 goto nla_put_failure;
436
437         if (nla_put_u32(skb, IFLA_BOND_ARP_ALL_TARGETS,
438                         bond->params.arp_all_targets))
439                 goto nla_put_failure;
440
441         if (bond->primary_slave &&
442             nla_put_u32(skb, IFLA_BOND_PRIMARY,
443                         bond->primary_slave->dev->ifindex))
444                 goto nla_put_failure;
445
446         if (nla_put_u8(skb, IFLA_BOND_PRIMARY_RESELECT,
447                        bond->params.primary_reselect))
448                 goto nla_put_failure;
449
450         if (nla_put_u8(skb, IFLA_BOND_FAIL_OVER_MAC,
451                        bond->params.fail_over_mac))
452                 goto nla_put_failure;
453
454         if (nla_put_u8(skb, IFLA_BOND_XMIT_HASH_POLICY,
455                        bond->params.xmit_policy))
456                 goto nla_put_failure;
457
458         if (nla_put_u32(skb, IFLA_BOND_RESEND_IGMP,
459                         bond->params.resend_igmp))
460                 goto nla_put_failure;
461
462         if (nla_put_u8(skb, IFLA_BOND_NUM_PEER_NOTIF,
463                        bond->params.num_peer_notif))
464                 goto nla_put_failure;
465
466         if (nla_put_u8(skb, IFLA_BOND_ALL_SLAVES_ACTIVE,
467                        bond->params.all_slaves_active))
468                 goto nla_put_failure;
469
470         if (nla_put_u32(skb, IFLA_BOND_MIN_LINKS,
471                         bond->params.min_links))
472                 goto nla_put_failure;
473
474         if (nla_put_u32(skb, IFLA_BOND_LP_INTERVAL,
475                         bond->params.lp_interval))
476                 goto nla_put_failure;
477
478         packets_per_slave = bond->params.packets_per_slave;
479         if (nla_put_u32(skb, IFLA_BOND_PACKETS_PER_SLAVE,
480                         packets_per_slave))
481                 goto nla_put_failure;
482
483         if (nla_put_u8(skb, IFLA_BOND_AD_LACP_RATE,
484                        bond->params.lacp_fast))
485                 goto nla_put_failure;
486
487         if (nla_put_u8(skb, IFLA_BOND_AD_SELECT,
488                        bond->params.ad_select))
489                 goto nla_put_failure;
490
491         if (bond->params.mode == BOND_MODE_8023AD) {
492                 struct ad_info info;
493
494                 if (!bond_3ad_get_active_agg_info(bond, &info)) {
495                         struct nlattr *nest;
496
497                         nest = nla_nest_start(skb, IFLA_BOND_AD_INFO);
498                         if (!nest)
499                                 goto nla_put_failure;
500
501                         if (nla_put_u16(skb, IFLA_BOND_AD_INFO_AGGREGATOR,
502                                         info.aggregator_id))
503                                 goto nla_put_failure;
504                         if (nla_put_u16(skb, IFLA_BOND_AD_INFO_NUM_PORTS,
505                                         info.ports))
506                                 goto nla_put_failure;
507                         if (nla_put_u16(skb, IFLA_BOND_AD_INFO_ACTOR_KEY,
508                                         info.actor_key))
509                                 goto nla_put_failure;
510                         if (nla_put_u16(skb, IFLA_BOND_AD_INFO_PARTNER_KEY,
511                                         info.partner_key))
512                                 goto nla_put_failure;
513                         if (nla_put(skb, IFLA_BOND_AD_INFO_PARTNER_MAC,
514                                     sizeof(info.partner_system),
515                                     &info.partner_system))
516                                 goto nla_put_failure;
517
518                         nla_nest_end(skb, nest);
519                 }
520         }
521
522         return 0;
523
524 nla_put_failure:
525         return -EMSGSIZE;
526 }
527
528 struct rtnl_link_ops bond_link_ops __read_mostly = {
529         .kind                   = "bond",
530         .priv_size              = sizeof(struct bonding),
531         .setup                  = bond_setup,
532         .maxtype                = IFLA_BOND_MAX,
533         .policy                 = bond_policy,
534         .validate               = bond_validate,
535         .newlink                = bond_newlink,
536         .changelink             = bond_changelink,
537         .get_size               = bond_get_size,
538         .fill_info              = bond_fill_info,
539         .get_num_tx_queues      = bond_get_num_tx_queues,
540         .get_num_rx_queues      = bond_get_num_tx_queues, /* Use the same number
541                                                              as for TX queues */
542 };
543
544 int __init bond_netlink_init(void)
545 {
546         return rtnl_link_register(&bond_link_ops);
547 }
548
549 void bond_netlink_fini(void)
550 {
551         rtnl_link_unregister(&bond_link_ops);
552 }
553
554 MODULE_ALIAS_RTNL_LINK("bond");