[PATCH net-next v9 5/9] net: bond - make bond_create take name_assign_type

From: Tom Gundersen
Date: Thu Jul 17 2014 - 04:10:32 EST


Signed-off-by: Tom Gundersen <teg@xxxxxxx>
Cc: Jay Vosburgh <j.vosburgh@xxxxxxxxx>
Cc: Veaceslav Falico <vfalico@xxxxxxxxx>
Cc: Andy Gospodarek <andy@xxxxxxxxxxxxx>
---
drivers/net/bonding/bond_main.c | 7 ++++---
drivers/net/bonding/bond_sysfs.c | 2 +-
drivers/net/bonding/bonding.h | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d643807..1769745 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4421,7 +4421,7 @@ unsigned int bond_get_num_tx_queues(void)
* Caller must NOT hold rtnl_lock; we need to release it here before we
* set up our sysfs entries.
*/
-int bond_create(struct net *net, const char *name)
+int bond_create(struct net *net, const char *name, unsigned char name_assign_type)
{
struct net_device *bond_dev;
int res;
@@ -4429,7 +4429,8 @@ int bond_create(struct net *net, const char *name)
rtnl_lock();

bond_dev = alloc_netdev_mq(sizeof(struct bonding),
- name ? name : "bond%d", NET_NAME_UNKNOWN,
+ name ? name : "bond%d",
+ name ? name_assign_type : NET_NAME_ENUM,
bond_setup, tx_queues);
if (!bond_dev) {
pr_err("%s: eek! can't alloc netdev!\n", name);
@@ -4509,7 +4510,7 @@ static int __init bonding_init(void)
bond_create_debugfs();

for (i = 0; i < max_bonds; i++) {
- res = bond_create(&init_net, NULL);
+ res = bond_create(&init_net, NULL, NET_NAME_UNKNOWN);
if (res)
goto err;
}
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 98db8ed..7ac498c 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -111,7 +111,7 @@ static ssize_t bonding_store_bonds(struct class *cls,

if (command[0] == '+') {
pr_info("%s is being created...\n", ifname);
- rv = bond_create(bn->net, ifname);
+ rv = bond_create(bn->net, ifname, NET_NAME_USER);
if (rv) {
if (rv == -EEXIST)
pr_info("%s already exists\n", ifname);
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index b2e548e..95b5e70 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -496,7 +496,7 @@ struct bond_net {

int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave);
void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
-int bond_create(struct net *net, const char *name);
+int bond_create(struct net *net, const char *name, unsigned char name_assign_type);
int bond_create_sysfs(struct bond_net *net);
void bond_destroy_sysfs(struct bond_net *net);
void bond_prepare_sysfs_group(struct bonding *bond);
--
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/