diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2010-09-05 01:58:34 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-09-05 00:29:49 -0700 |
commit | 6a0e9fa88df9e3a517a2fd317706aefa10a43191 (patch) | |
tree | 2dcf657e159d168a65af81cb65d21108cae48ead /drivers/staging/batman-adv/main.c | |
parent | bf3264f6d1039e68ec9881447808327c0260ae61 (diff) | |
download | op-kernel-dev-6a0e9fa88df9e3a517a2fd317706aefa10a43191.zip op-kernel-dev-6a0e9fa88df9e3a517a2fd317706aefa10a43191.tar.gz |
Staging: batman-adv: attach each hard-interface to a soft-interface
This patch replaces the static bat0 interface with a dynamic/abstracted
approach. It is now possible to create multiple batX interfaces by
assigning hard interfaces to them. Each batX interface acts as an
independent mesh network. A soft interface is removed once no hard
interface references it any longer.
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
[sven.eckelmann@gmx.de: Rework on top of current version]
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv/main.c')
-rw-r--r-- | drivers/staging/batman-adv/main.c | 54 |
1 files changed, 2 insertions, 52 deletions
diff --git a/drivers/staging/batman-adv/main.c b/drivers/staging/batman-adv/main.c index eb0bfbe..52c019b 100644 --- a/drivers/staging/batman-adv/main.c +++ b/drivers/staging/batman-adv/main.c @@ -44,8 +44,6 @@ DEFINE_SPINLOCK(forw_bcast_list_lock); int16_t num_hna; -struct net_device *soft_device; - unsigned char broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; atomic_t module_state; @@ -53,8 +51,6 @@ struct workqueue_struct *bat_event_workqueue; static int __init batman_init(void) { - int retval; - INIT_LIST_HEAD(&if_list); INIT_HLIST_HEAD(&forw_bat_list); INIT_HLIST_HEAD(&forw_bcast_list); @@ -71,32 +67,6 @@ static int __init batman_init(void) bat_socket_init(); debugfs_init(); - /* initialize layer 2 interface */ - soft_device = alloc_netdev(sizeof(struct bat_priv) , "bat%d", - interface_setup); - - if (!soft_device) { - pr_err("Unable to allocate the batman interface\n"); - goto end; - } - - retval = register_netdev(soft_device); - - if (retval < 0) { - pr_err("Unable to register the batman interface: %i\n", retval); - goto free_soft_device; - } - - retval = sysfs_add_meshif(soft_device); - - if (retval < 0) - goto unreg_soft_device; - - retval = debugfs_add_meshif(soft_device); - - if (retval < 0) - goto unreg_sysfs; - register_netdevice_notifier(&hard_if_notifier); pr_info("B.A.T.M.A.N. advanced %s%s (compatibility version %i) " @@ -104,19 +74,6 @@ static int __init batman_init(void) COMPAT_VERSION); return 0; - -unreg_sysfs: - sysfs_del_meshif(soft_device); -unreg_soft_device: - unregister_netdev(soft_device); - soft_device = NULL; - return -ENOMEM; - -free_soft_device: - free_netdev(soft_device); - soft_device = NULL; -end: - return -ENOMEM; } static void __exit batman_exit(void) @@ -127,13 +84,6 @@ static void __exit batman_exit(void) unregister_netdevice_notifier(&hard_if_notifier); hardif_remove_interfaces(); - if (soft_device) { - debugfs_del_meshif(soft_device); - sysfs_del_meshif(soft_device); - unregister_netdev(soft_device); - soft_device = NULL; - } - destroy_workqueue(bat_event_workqueue); bat_event_workqueue = NULL; } @@ -150,12 +100,12 @@ void activate_module(void) if (hna_global_init() < 1) goto err; - hna_local_add(soft_device->dev_addr); + /*hna_local_add(soft_device->dev_addr);*/ if (vis_init() < 1) goto err; - update_min_mtu(); + /*update_min_mtu();*/ atomic_set(&module_state, MODULE_ACTIVE); goto end; |