-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bonding: push Netlink bits into separate file
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Jiri Pirko
authored and
David S. Miller
committed
Oct 19, 2013
1 parent
b1eda2a
commit 0a2a78c
Showing
4 changed files
with
67 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* drivers/net/bond/bond_netlink.c - Netlink interface for bonding | ||
* Copyright (c) 2013 Jiri Pirko <jiri@resnulli.us> | ||
* | ||
* 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" | ||
|
||
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; | ||
} | ||
|
||
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 */ | ||
}; | ||
|
||
int __init bond_netlink_init(void) | ||
{ | ||
return rtnl_link_register(&bond_link_ops); | ||
} | ||
|
||
void __exit bond_netlink_fini(void) | ||
{ | ||
rtnl_link_unregister(&bond_link_ops); | ||
} | ||
|
||
MODULE_ALIAS_RTNL_LINK("bond"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters