bond_netlink.c 15.6 KB
Newer Older
1 2 3
/*
 * drivers/net/bond/bond_netlink.c - Netlink interface for bonding
 * Copyright (c) 2013 Jiri Pirko <jiri@resnulli.us>
4
 * Copyright (c) 2013 Scott Feldman <sfeldma@cumulusnetworks.com>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/errno.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_link.h>
#include <linux/if_ether.h>
#include <net/netlink.h>
#include <net/rtnetlink.h>
#include "bonding.h"

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
int bond_get_slave(struct net_device *slave_dev, struct sk_buff *skb)
{
	struct slave *slave = bond_slave_get_rtnl(slave_dev);
	const struct aggregator *agg;

	if (nla_put_u8(skb, IFLA_SLAVE_STATE, bond_slave_state(slave)))
		goto nla_put_failure;

	if (nla_put_u8(skb, IFLA_SLAVE_MII_STATUS, slave->link))
		goto nla_put_failure;

	if (nla_put_u32(skb, IFLA_SLAVE_LINK_FAILURE_COUNT,
			slave->link_failure_count))
		goto nla_put_failure;

	if (nla_put(skb, IFLA_SLAVE_PERM_HWADDR,
		    slave_dev->addr_len, slave->perm_hwaddr))
		goto nla_put_failure;

	if (nla_put_u16(skb, IFLA_SLAVE_QUEUE_ID, slave->queue_id))
		goto nla_put_failure;

	if (slave->bond->params.mode == BOND_MODE_8023AD) {
		agg = SLAVE_AD_INFO(slave).port.aggregator;
		if (agg)
			if (nla_put_u16(skb, IFLA_SLAVE_AD_AGGREGATOR_ID,
					agg->aggregator_identifier))
				goto nla_put_failure;
	}

	return 0;

nla_put_failure:
	return -EMSGSIZE;
}

60 61
static const struct nla_policy bond_policy[IFLA_BOND_MAX + 1] = {
	[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 87 88 89 90 91 92 93 94 95 96
static int bond_validate(struct nlattr *tb[], struct nlattr *data[])
{
	if (tb[IFLA_ADDRESS]) {
		if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
			return -EINVAL;
		if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
			return -EADDRNOTAVAIL;
	}
	return 0;
}

97 98 99 100
static int bond_changelink(struct net_device *bond_dev,
			   struct nlattr *tb[], struct nlattr *data[])
{
	struct bonding *bond = netdev_priv(bond_dev);
101
	struct bond_opt_value newval;
102
	int miimon = 0;
103 104
	int err;

105 106 107 108
	if (!data)
		return 0;

	if (data[IFLA_BOND_MODE]) {
109 110
		int mode = nla_get_u8(data[IFLA_BOND_MODE]);

111 112
		bond_opt_initval(&newval, mode);
		err = __bond_opt_set(bond, BOND_OPT_MODE, &newval);
113 114 115
		if (err)
			return err;
	}
116
	if (data[IFLA_BOND_ACTIVE_SLAVE]) {
117 118
		int ifindex = nla_get_u32(data[IFLA_BOND_ACTIVE_SLAVE]);
		struct net_device *slave_dev;
119
		char *active_slave = "";
120

121
		if (ifindex != 0) {
122 123 124 125
			slave_dev = __dev_get_by_index(dev_net(bond_dev),
						       ifindex);
			if (!slave_dev)
				return -ENODEV;
126
			active_slave = slave_dev->name;
127
		}
128 129
		bond_opt_initstr(&newval, active_slave);
		err = __bond_opt_set(bond, BOND_OPT_ACTIVE_SLAVE, &newval);
130 131 132
		if (err)
			return err;
	}
133
	if (data[IFLA_BOND_MIIMON]) {
134
		miimon = nla_get_u32(data[IFLA_BOND_MIIMON]);
135

136 137
		bond_opt_initval(&newval, miimon);
		err = __bond_opt_set(bond, BOND_OPT_MIIMON, &newval);
138 139 140
		if (err)
			return err;
	}
141 142 143
	if (data[IFLA_BOND_UPDELAY]) {
		int updelay = nla_get_u32(data[IFLA_BOND_UPDELAY]);

144 145
		bond_opt_initval(&newval, updelay);
		err = __bond_opt_set(bond, BOND_OPT_UPDELAY, &newval);
146 147 148
		if (err)
			return err;
	}
149 150 151
	if (data[IFLA_BOND_DOWNDELAY]) {
		int downdelay = nla_get_u32(data[IFLA_BOND_DOWNDELAY]);

152 153
		bond_opt_initval(&newval, downdelay);
		err = __bond_opt_set(bond, BOND_OPT_DOWNDELAY, &newval);
154 155 156
		if (err)
			return err;
	}
157 158 159
	if (data[IFLA_BOND_USE_CARRIER]) {
		int use_carrier = nla_get_u8(data[IFLA_BOND_USE_CARRIER]);

160 161
		bond_opt_initval(&newval, use_carrier);
		err = __bond_opt_set(bond, BOND_OPT_USE_CARRIER, &newval);
162 163 164
		if (err)
			return err;
	}
165 166 167 168 169 170 171 172 173
	if (data[IFLA_BOND_ARP_INTERVAL]) {
		int arp_interval = nla_get_u32(data[IFLA_BOND_ARP_INTERVAL]);

		if (arp_interval && miimon) {
			pr_err("%s: ARP monitoring cannot be used with MII monitoring.\n",
			       bond->dev->name);
			return -EINVAL;
		}

174 175
		bond_opt_initval(&newval, arp_interval);
		err = __bond_opt_set(bond, BOND_OPT_ARP_INTERVAL, &newval);
176 177 178
		if (err)
			return err;
	}
179 180 181 182
	if (data[IFLA_BOND_ARP_IP_TARGET]) {
		struct nlattr *attr;
		int i = 0, rem;

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 188 189 190 191 192 193 194 195 196
			bond_opt_initval(&newval, target);
			err = __bond_opt_set(bond, BOND_OPT_ARP_TARGETS,
					     &newval);
			if (err)
				break;
			i++;
		}
		if (i == 0 && bond->params.arp_interval)
			pr_warn("%s: removing last arp target with arp_interval on\n",
				bond->dev->name);
197 198 199
		if (err)
			return err;
	}
200 201 202 203 204 205 206 207 208
	if (data[IFLA_BOND_ARP_VALIDATE]) {
		int arp_validate = nla_get_u32(data[IFLA_BOND_ARP_VALIDATE]);

		if (arp_validate && miimon) {
			pr_err("%s: ARP validating cannot be used with MII monitoring.\n",
			       bond->dev->name);
			return -EINVAL;
		}

209 210
		bond_opt_initval(&newval, arp_validate);
		err = __bond_opt_set(bond, BOND_OPT_ARP_VALIDATE, &newval);
211 212 213
		if (err)
			return err;
	}
214 215 216 217
	if (data[IFLA_BOND_ARP_ALL_TARGETS]) {
		int arp_all_targets =
			nla_get_u32(data[IFLA_BOND_ARP_ALL_TARGETS]);

218 219
		bond_opt_initval(&newval, arp_all_targets);
		err = __bond_opt_set(bond, BOND_OPT_ARP_ALL_TARGETS, &newval);
220 221 222
		if (err)
			return err;
	}
223 224 225 226 227 228 229 230 231
	if (data[IFLA_BOND_PRIMARY]) {
		int ifindex = nla_get_u32(data[IFLA_BOND_PRIMARY]);
		struct net_device *dev;
		char *primary = "";

		dev = __dev_get_by_index(dev_net(bond_dev), ifindex);
		if (dev)
			primary = dev->name;

232 233
		bond_opt_initstr(&newval, primary);
		err = __bond_opt_set(bond, BOND_OPT_PRIMARY, &newval);
234 235 236
		if (err)
			return err;
	}
237 238 239 240
	if (data[IFLA_BOND_PRIMARY_RESELECT]) {
		int primary_reselect =
			nla_get_u8(data[IFLA_BOND_PRIMARY_RESELECT]);

241 242
		bond_opt_initval(&newval, primary_reselect);
		err = __bond_opt_set(bond, BOND_OPT_PRIMARY_RESELECT, &newval);
243 244 245
		if (err)
			return err;
	}
246 247 248 249
	if (data[IFLA_BOND_FAIL_OVER_MAC]) {
		int fail_over_mac =
			nla_get_u8(data[IFLA_BOND_FAIL_OVER_MAC]);

250 251
		bond_opt_initval(&newval, fail_over_mac);
		err = __bond_opt_set(bond, BOND_OPT_FAIL_OVER_MAC, &newval);
252 253 254
		if (err)
			return err;
	}
255 256 257 258
	if (data[IFLA_BOND_XMIT_HASH_POLICY]) {
		int xmit_hash_policy =
			nla_get_u8(data[IFLA_BOND_XMIT_HASH_POLICY]);

259 260
		bond_opt_initval(&newval, xmit_hash_policy);
		err = __bond_opt_set(bond, BOND_OPT_XMIT_HASH, &newval);
261 262 263
		if (err)
			return err;
	}
264 265 266 267 268 269 270 271
	if (data[IFLA_BOND_RESEND_IGMP]) {
		int resend_igmp =
			nla_get_u32(data[IFLA_BOND_RESEND_IGMP]);

		err = bond_option_resend_igmp_set(bond, resend_igmp);
		if (err)
			return err;
	}
272 273 274 275
	if (data[IFLA_BOND_NUM_PEER_NOTIF]) {
		int num_peer_notif =
			nla_get_u8(data[IFLA_BOND_NUM_PEER_NOTIF]);

276 277
		bond_opt_initval(&newval, num_peer_notif);
		err = __bond_opt_set(bond, BOND_OPT_NUM_PEER_NOTIF, &newval);
278 279 280
		if (err)
			return err;
	}
281 282 283 284
	if (data[IFLA_BOND_ALL_SLAVES_ACTIVE]) {
		int all_slaves_active =
			nla_get_u8(data[IFLA_BOND_ALL_SLAVES_ACTIVE]);

285 286
		bond_opt_initval(&newval, all_slaves_active);
		err = __bond_opt_set(bond, BOND_OPT_ALL_SLAVES_ACTIVE, &newval);
287 288 289
		if (err)
			return err;
	}
290 291 292 293
	if (data[IFLA_BOND_MIN_LINKS]) {
		int min_links =
			nla_get_u32(data[IFLA_BOND_MIN_LINKS]);

294 295
		bond_opt_initval(&newval, min_links);
		err = __bond_opt_set(bond, BOND_OPT_MINLINKS, &newval);
296 297 298
		if (err)
			return err;
	}
299 300 301 302 303 304 305 306
	if (data[IFLA_BOND_LP_INTERVAL]) {
		int lp_interval =
			nla_get_u32(data[IFLA_BOND_LP_INTERVAL]);

		err = bond_option_lp_interval_set(bond, lp_interval);
		if (err)
			return err;
	}
307 308 309 310
	if (data[IFLA_BOND_PACKETS_PER_SLAVE]) {
		int packets_per_slave =
			nla_get_u32(data[IFLA_BOND_PACKETS_PER_SLAVE]);

311 312
		bond_opt_initval(&newval, packets_per_slave);
		err = __bond_opt_set(bond, BOND_OPT_PACKETS_PER_SLAVE, &newval);
313 314 315
		if (err)
			return err;
	}
316 317 318 319
	if (data[IFLA_BOND_AD_LACP_RATE]) {
		int lacp_rate =
			nla_get_u8(data[IFLA_BOND_AD_LACP_RATE]);

320 321
		bond_opt_initval(&newval, lacp_rate);
		err = __bond_opt_set(bond, BOND_OPT_LACP_RATE, &newval);
322 323 324
		if (err)
			return err;
	}
325 326 327 328
	if (data[IFLA_BOND_AD_SELECT]) {
		int ad_select =
			nla_get_u8(data[IFLA_BOND_AD_SELECT]);

329 330
		bond_opt_initval(&newval, ad_select);
		err = __bond_opt_set(bond, BOND_OPT_AD_SELECT, &newval);
331 332 333
		if (err)
			return err;
	}
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
	return 0;
}

static int bond_newlink(struct net *src_net, struct net_device *bond_dev,
			struct nlattr *tb[], struct nlattr *data[])
{
	int err;

	err = bond_changelink(bond_dev, tb, data);
	if (err < 0)
		return err;

	return register_netdevice(bond_dev);
}

static size_t bond_get_size(const struct net_device *bond_dev)
{
351
	return nla_total_size(sizeof(u8)) +	/* IFLA_BOND_MODE */
352 353
		nla_total_size(sizeof(u32)) +	/* IFLA_BOND_ACTIVE_SLAVE */
		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 376 377 378 379 380
		nla_total_size(sizeof(struct nlattr)) + /* IFLA_BOND_AD_INFO */
		nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_AGGREGATOR */
		nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_NUM_PORTS */
		nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_ACTOR_KEY */
		nla_total_size(sizeof(u16)) + /* IFLA_BOND_AD_INFO_PARTNER_KEY*/
		nla_total_size(ETH_ALEN) +    /* IFLA_BOND_AD_INFO_PARTNER_MAC*/
381
		0;
382 383 384 385 386 387
}

static int bond_fill_info(struct sk_buff *skb,
			  const struct net_device *bond_dev)
{
	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 397 398 399 400 401 402

	if (slave_dev &&
	    nla_put_u32(skb, IFLA_BOND_ACTIVE_SLAVE, slave_dev->ifindex))
		goto nla_put_failure;

	if (nla_put_u32(skb, IFLA_BOND_MIIMON, bond->params.miimon))
		goto nla_put_failure;

403 404 405 406
	if (nla_put_u32(skb, IFLA_BOND_UPDELAY,
			bond->params.updelay * bond->params.miimon))
		goto nla_put_failure;

407 408 409 410
	if (nla_put_u32(skb, IFLA_BOND_DOWNDELAY,
			bond->params.downdelay * bond->params.miimon))
		goto nla_put_failure;

411 412 413
	if (nla_put_u8(skb, IFLA_BOND_USE_CARRIER, bond->params.use_carrier))
		goto nla_put_failure;

414 415 416
	if (nla_put_u32(skb, IFLA_BOND_ARP_INTERVAL, bond->params.arp_interval))
		goto nla_put_failure;

417 418 419 420 421 422 423
	targets = nla_nest_start(skb, IFLA_BOND_ARP_IP_TARGET);
	if (!targets)
		goto nla_put_failure;

	targets_added = 0;
	for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) {
		if (bond->params.arp_targets[i]) {
424
			nla_put_be32(skb, i, bond->params.arp_targets[i]);
425 426 427 428 429 430 431 432 433
			targets_added = 1;
		}
	}

	if (targets_added)
		nla_nest_end(skb, targets);
	else
		nla_nest_cancel(skb, targets);

434 435 436
	if (nla_put_u32(skb, IFLA_BOND_ARP_VALIDATE, bond->params.arp_validate))
		goto nla_put_failure;

437 438 439 440
	if (nla_put_u32(skb, IFLA_BOND_ARP_ALL_TARGETS,
			bond->params.arp_all_targets))
		goto nla_put_failure;

441 442 443 444 445
	if (bond->primary_slave &&
	    nla_put_u32(skb, IFLA_BOND_PRIMARY,
			bond->primary_slave->dev->ifindex))
		goto nla_put_failure;

446 447 448 449
	if (nla_put_u8(skb, IFLA_BOND_PRIMARY_RESELECT,
		       bond->params.primary_reselect))
		goto nla_put_failure;

450 451 452 453
	if (nla_put_u8(skb, IFLA_BOND_FAIL_OVER_MAC,
		       bond->params.fail_over_mac))
		goto nla_put_failure;

454 455 456 457
	if (nla_put_u8(skb, IFLA_BOND_XMIT_HASH_POLICY,
		       bond->params.xmit_policy))
		goto nla_put_failure;

458 459 460 461
	if (nla_put_u32(skb, IFLA_BOND_RESEND_IGMP,
		        bond->params.resend_igmp))
		goto nla_put_failure;

462 463 464 465
	if (nla_put_u8(skb, IFLA_BOND_NUM_PEER_NOTIF,
		       bond->params.num_peer_notif))
		goto nla_put_failure;

466 467 468 469
	if (nla_put_u8(skb, IFLA_BOND_ALL_SLAVES_ACTIVE,
		       bond->params.all_slaves_active))
		goto nla_put_failure;

470 471 472 473
	if (nla_put_u32(skb, IFLA_BOND_MIN_LINKS,
			bond->params.min_links))
		goto nla_put_failure;

474 475 476 477
	if (nla_put_u32(skb, IFLA_BOND_LP_INTERVAL,
			bond->params.lp_interval))
		goto nla_put_failure;

478 479 480 481 482
	packets_per_slave = bond->params.packets_per_slave;
	if (nla_put_u32(skb, IFLA_BOND_PACKETS_PER_SLAVE,
			packets_per_slave))
		goto nla_put_failure;

483 484 485 486
	if (nla_put_u8(skb, IFLA_BOND_AD_LACP_RATE,
		       bond->params.lacp_fast))
		goto nla_put_failure;

487 488 489 490
	if (nla_put_u8(skb, IFLA_BOND_AD_SELECT,
		       bond->params.ad_select))
		goto nla_put_failure;

491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521
	if (bond->params.mode == BOND_MODE_8023AD) {
		struct ad_info info;

		if (!bond_3ad_get_active_agg_info(bond, &info)) {
			struct nlattr *nest;

			nest = nla_nest_start(skb, IFLA_BOND_AD_INFO);
			if (!nest)
				goto nla_put_failure;

			if (nla_put_u16(skb, IFLA_BOND_AD_INFO_AGGREGATOR,
					info.aggregator_id))
				goto nla_put_failure;
			if (nla_put_u16(skb, IFLA_BOND_AD_INFO_NUM_PORTS,
					info.ports))
				goto nla_put_failure;
			if (nla_put_u16(skb, IFLA_BOND_AD_INFO_ACTOR_KEY,
					info.actor_key))
				goto nla_put_failure;
			if (nla_put_u16(skb, IFLA_BOND_AD_INFO_PARTNER_KEY,
					info.partner_key))
				goto nla_put_failure;
			if (nla_put(skb, IFLA_BOND_AD_INFO_PARTNER_MAC,
				    sizeof(info.partner_system),
				    &info.partner_system))
				goto nla_put_failure;

			nla_nest_end(skb, nest);
		}
	}

522 523 524 525 526 527
	return 0;

nla_put_failure:
	return -EMSGSIZE;
}

528 529 530 531
struct rtnl_link_ops bond_link_ops __read_mostly = {
	.kind			= "bond",
	.priv_size		= sizeof(struct bonding),
	.setup			= bond_setup,
532 533
	.maxtype		= IFLA_BOND_MAX,
	.policy			= bond_policy,
534
	.validate		= bond_validate,
535 536 537 538
	.newlink		= bond_newlink,
	.changelink		= bond_changelink,
	.get_size		= bond_get_size,
	.fill_info		= bond_fill_info,
539 540 541 542 543 544 545 546 547 548
	.get_num_tx_queues	= bond_get_num_tx_queues,
	.get_num_rx_queues	= bond_get_num_tx_queues, /* Use the same number
							     as for TX queues */
};

int __init bond_netlink_init(void)
{
	return rtnl_link_register(&bond_link_ops);
}

549
void bond_netlink_fini(void)
550 551 552 553 554
{
	rtnl_link_unregister(&bond_link_ops);
}

MODULE_ALIAS_RTNL_LINK("bond");
反馈
建议
客服 返回
顶部