bonding: push Netlink bits into separate file

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko
2013-10-18 17:43:33 +02:00
committed by David S. Miller
parent b1eda2ac3f
commit 0a2a78c4a9
4 changed files with 67 additions and 28 deletions

View File

@@ -3951,7 +3951,7 @@ static void bond_destructor(struct net_device *bond_dev)
free_netdev(bond_dev);
}
static void bond_setup(struct net_device *bond_dev)
void bond_setup(struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
@@ -4451,32 +4451,11 @@ static int bond_init(struct net_device *bond_dev)
return 0;
}
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;
}
static unsigned int bond_get_num_tx_queues(void)
unsigned int bond_get_num_tx_queues(void)
{
return tx_queues;
}
static struct rtnl_link_ops bond_link_ops __read_mostly = {
.kind = "bond",
.priv_size = sizeof(struct bonding),
.setup = bond_setup,
.validate = bond_validate,
.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 */
};
/* Create a new bond based on the specified name and bonding parameters.
* If name is NULL, obtain a suitable "bond%d" name for us.
* Caller must NOT hold rtnl_lock; we need to release it here before we
@@ -4563,7 +4542,7 @@ static int __init bonding_init(void)
if (res)
goto out;
res = rtnl_link_register(&bond_link_ops);
res = bond_netlink_init();
if (res)
goto err_link;
@@ -4579,7 +4558,7 @@ static int __init bonding_init(void)
out:
return res;
err:
rtnl_link_unregister(&bond_link_ops);
bond_netlink_fini();
err_link:
unregister_pernet_subsys(&bond_net_ops);
goto out;
@@ -4592,7 +4571,7 @@ static void __exit bonding_exit(void)
bond_destroy_debugfs();
rtnl_link_unregister(&bond_link_ops);
bond_netlink_fini();
unregister_pernet_subsys(&bond_net_ops);
#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -4609,4 +4588,3 @@ MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
MODULE_DESCRIPTION(DRV_DESCRIPTION ", v" DRV_VERSION);
MODULE_AUTHOR("Thomas Davis, tadavis@lbl.gov and many others");
MODULE_ALIAS_RTNL_LINK("bond");