aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2013-10-18 11:43:33 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-19 18:58:45 -0400
commit0a2a78c4a95240e658272bd7cd7422a529e4eb4a (patch)
tree6b03014f30e7f45ffd222753eae1afce8a63b4aa /drivers/net/bonding/bond_main.c
parentb1eda2ac3fa6bf23b27c7c70eda6885124c79ed3 (diff)
bonding: push Netlink bits into separate file
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index dfb4f6dd5de0..a113e4212486 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3951,7 +3951,7 @@ static void bond_destructor(struct net_device *bond_dev)
3951 free_netdev(bond_dev); 3951 free_netdev(bond_dev);
3952} 3952}
3953 3953
3954static void bond_setup(struct net_device *bond_dev) 3954void bond_setup(struct net_device *bond_dev)
3955{ 3955{
3956 struct bonding *bond = netdev_priv(bond_dev); 3956 struct bonding *bond = netdev_priv(bond_dev);
3957 3957
@@ -4451,32 +4451,11 @@ static int bond_init(struct net_device *bond_dev)
4451 return 0; 4451 return 0;
4452} 4452}
4453 4453
4454static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) 4454unsigned int bond_get_num_tx_queues(void)
4455{
4456 if (tb[IFLA_ADDRESS]) {
4457 if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
4458 return -EINVAL;
4459 if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
4460 return -EADDRNOTAVAIL;
4461 }
4462 return 0;
4463}
4464
4465static unsigned int bond_get_num_tx_queues(void)
4466{ 4455{
4467 return tx_queues; 4456 return tx_queues;
4468} 4457}
4469 4458
4470static struct rtnl_link_ops bond_link_ops __read_mostly = {
4471 .kind = "bond",
4472 .priv_size = sizeof(struct bonding),
4473 .setup = bond_setup,
4474 .validate = bond_validate,
4475 .get_num_tx_queues = bond_get_num_tx_queues,
4476 .get_num_rx_queues = bond_get_num_tx_queues, /* Use the same number
4477 as for TX queues */
4478};
4479
4480/* Create a new bond based on the specified name and bonding parameters. 4459/* Create a new bond based on the specified name and bonding parameters.
4481 * If name is NULL, obtain a suitable "bond%d" name for us. 4460 * If name is NULL, obtain a suitable "bond%d" name for us.
4482 * Caller must NOT hold rtnl_lock; we need to release it here before we 4461 * Caller must NOT hold rtnl_lock; we need to release it here before we
@@ -4563,7 +4542,7 @@ static int __init bonding_init(void)
4563 if (res) 4542 if (res)
4564 goto out; 4543 goto out;
4565 4544
4566 res = rtnl_link_register(&bond_link_ops); 4545 res = bond_netlink_init();
4567 if (res) 4546 if (res)
4568 goto err_link; 4547 goto err_link;
4569 4548
@@ -4579,7 +4558,7 @@ static int __init bonding_init(void)
4579out: 4558out:
4580 return res; 4559 return res;
4581err: 4560err:
4582 rtnl_link_unregister(&bond_link_ops); 4561 bond_netlink_fini();
4583err_link: 4562err_link:
4584 unregister_pernet_subsys(&bond_net_ops); 4563 unregister_pernet_subsys(&bond_net_ops);
4585 goto out; 4564 goto out;
@@ -4592,7 +4571,7 @@ static void __exit bonding_exit(void)
4592 4571
4593 bond_destroy_debugfs(); 4572 bond_destroy_debugfs();
4594 4573
4595 rtnl_link_unregister(&bond_link_ops); 4574 bond_netlink_fini();
4596 unregister_pernet_subsys(&bond_net_ops); 4575 unregister_pernet_subsys(&bond_net_ops);
4597 4576
4598#ifdef CONFIG_NET_POLL_CONTROLLER 4577#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -4609,4 +4588,3 @@ MODULE_LICENSE("GPL");
4609MODULE_VERSION(DRV_VERSION); 4588MODULE_VERSION(DRV_VERSION);
4610MODULE_DESCRIPTION(DRV_DESCRIPTION ", v" DRV_VERSION); 4589MODULE_DESCRIPTION(DRV_DESCRIPTION ", v" DRV_VERSION);
4611MODULE_AUTHOR("Thomas Davis, tadavis@lbl.gov and many others"); 4590MODULE_AUTHOR("Thomas Davis, tadavis@lbl.gov and many others");
4612MODULE_ALIAS_RTNL_LINK("bond");