summaryrefslogtreecommitdiffstats
path: root/drivers/staging/batman-adv/main.c
Commit message (Collapse)AuthorAgeFilesLines
* staging: batman-adv: remove useless addr_to_string()Andy Shevchenko2010-10-201-5/+0
| | | | | | | | | | | | | Since all *printf() methods in the kernel understand '%pM' modifier the conversion to the string is useless beforehand. Additionally this patch decreases batman_if structure by 20 bytes. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Marek Lindner <lindner_marek@yahoo.de> Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Cc: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: wait for call_rcu before unloading moduleSven Eckelmann2010-09-201-1/+1
| | | | | | | | | | | | | | | synchronize_rcu respective synchronize_net only waits for the rcu grace period to elapse and we may fail to finish the calls which were made to call_rcu in that time. In result the module could be unloaded during the execution of the RCU callbacks. rcu_barrier[1] will now wait for all outstanding RCU callbacks to finish before continuing. [1] Documentation/RCU/rcubarrier.txt Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Remove currently unused gw_* datastructuresSven Eckelmann2010-09-141-2/+0
| | | | | | | | | gw_list_lock, gw_list and curr_gw are currently unused members of struct bat_priv. They will be readded when gateway support is really implemented. Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Always synchronize rcu's on module shutdownLinus Lüssing2010-09-141-3/+2
| | | | | | | | | | | | | | | | | | | | | During the module shutdown procedure in batman_exit(), a rcu callback is being scheduled (batman_exit -> hardif_remove_interfaces -> hardif_remove_interfae -> call_rcu). However, when the kernel unloads the module, the rcu callback might not have been executed yet, resulting in a "unable to handle kernel paging request" in __rcu_process_callback afterwards, causing the kernel to freeze. The synchronize_net and synchronize_rcu in mesh_free are currently called before the call_rcu in hardif_remove_interface and have no real effect on it. Therefore, we should always flush all rcu callback functions scheduled during the shutdown procedure using synchronize_net. The call to synchronize_rcu can be omitted because synchronize_net already calls it. Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: multiple mesh cloudsMarek Lindner2010-09-051-37/+37
| | | | | | | | | | | | | | This patch removes all remaining global variables and includes the necessary bits into the bat_priv structure. It is the last remaining piece to allow multiple concurrent mesh clouds on the same device. A few global variables have been rendered obsolete during the process and have been removed entirely. 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>
* Staging: batman-adv: attach each hard-interface to a soft-interfaceMarek Lindner2010-09-051-52/+2
| | | | | | | | | | | | | 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>
* Staging: batman-adv: register the batman-adv packet type per interfaceMarek Lindner2010-09-051-10/+0
| | | | | | | | | | | | | | | | | | | Batman-adv globally registered the batman-adv packet type and installed a hook to batman_skb_recv(). Each interface receiving a packet with that type would end up in this function which then had to loop through all batman-adv internal interface structures to find the its meta data. The more interfaces a system had the longer the loops might take. Each and every packet goes through this function making it a performance critical loop. This patch installs the hook for each activated interface. The called batman_skb_recv() can distinguish these calls, therefore avoiding the loop through the interface structures. 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>
* Staging: batman-adv: move queue counters into bat_privSimon Wunderlich2010-09-051-6/+0
| | | | | | | | | | | | | | | to support multiple mesh devices later, we need to move global variables like the queues into corresponding private structs bat_priv of the soft devices. Note that this patch still has a lot of FIXMEs and depends on the global soft_device variable. This should be resolved later, e.g. by referencing the parent soft device in batman_if. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.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>
* Staging: batman-adv: fix own mac address detectionMarek Lindner2010-08-231-2/+5
| | | | | | | | | | | | Earlier batman-adv versions would only create a batman_if struct after a corresponding interface had been activated by a user. Now each existing system interface has a batman_if struct and has to be checked by verifying the IF_ACTIVE flag. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: don't use default init_module/cleanup_module function namesRandy Dunlap2010-07-221-2/+5
| | | | | | | | | | | | | | | | | | Fix two staging drivers to use module_init()/module_exit() instead of default init_module() and cleanup_module() function names so that there are no name conflicts when both are built-in. drivers/staging/dt3155/built-in.o: In function `cleanup_module': (.text+0xc0): multiple definition of `cleanup_module' drivers/staging/batman-adv/built-in.o:(.text+0x330): first defined here drivers/staging/dt3155/built-in.o: In function `init_module': (.text+0xe60): multiple definition of `init_module' drivers/staging/batman-adv/built-in.o:(.text+0x400): first defined here Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> [sven.eckelmann@gmx.de: Mark module init and exit functions as static] Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Move printk to simplified macrosSven Eckelmann2010-07-081-9/+6
| | | | | | | | | | | | | | | Each general printk which is not informative by itself for a specific batX device were moved to pr_(info|warning|err) as it provides an easy interface which for example resolves the problem to add the prefix "batman-adv: " before each line. All information which is specific to a batX device will be printed using a bat_(info|err|warning) macro to prefix it also with "batman-adv: batX:" in each line. Reported-by: Joe Perches <joe@perches.com> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: add routing debug log accessible via debugfsMarek Lindner2010-07-081-11/+0
| | | | | | | | | | | All routing debug messages are saved in a ring buffer that can be read via the debugfs file "log". Note that CONFIG_BATMAN_ADV_DEBUG must be activated to have the debug logs compiled in. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: fix early debugfs deinitializationMarek Lindner2010-07-081-1/+1
| | | | | | | | | | | The debugfs files are initialized at load time only but would get deinitialized when the module changed in it deactivate (sleeping) state. As a consequence the debugfs files are not accessible anymore. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Convert names from Java to C styleAntonio Quartulli2010-07-081-1/+1
| | | | | | | | Useless but meaningfull patch that converts JavaStyle names into c_style Signed-off-by: Antonio Quartulli <ordex@ritirata.org> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Convert MAC_FMT to %pMJoe Perches2010-06-221-2/+1
| | | | | | | | | Remove the last uses of MAC_FMT Signed-off-by: Joe Perches <joe@perches.com> [sven.eckelmann@gmx.de: Adapted for current batman-adv version] Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Move device for icmp injection to debugfsSven Eckelmann2010-06-221-7/+14
| | | | | | | | | | | | | | batctl uses /dev/batman-adv to send special batman-adv icmp packets to other nodes in the mesh. To get it working with multiple batX devices we must ensure that every mesh device can have their own socket which is used to inject those packets in exactly one mesh. The current implementation still doesn't allow to use complete separated meshes as we rely on structures which are not part of the private data of a batman device. Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: convert vis_interval into defineSimon Wunderlich2010-06-181-3/+0
| | | | | | | | | | | | | vis_interval does not neccesarily needs to be a variable, as there is no way to change it anyway (and probably no need to). We can therefore remove yet another global variable. Thanks Marek for pointing this out. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.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>
* Staging: batman-adv: Don't call free_netdev twiceSven Eckelmann2010-06-041-0/+3
| | | | | | | | | | | Free_netdev is registered as destructor in interface_setup for every soft_device. This destructor is automatically called from unregister_netdev and we must not call it again for the freed net_device. Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Call unregister_netdev on failures to get rtnl lockSven Eckelmann2010-06-041-1/+1
| | | | | | | | | | | | | | | We must call unregister_netdev when we couldn't initialise the batman-adv module and the soft_device was registered. There are two version of the function which we can use: * unregister_netdevice - removes device * unregister_netdev - takes rtnl semaphore and remove device We don't hold the semaphore in an error situation. So we must use unregister_netdev. Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Reduce max characters on a line to 80Sven Eckelmann2010-05-111-6/+11
| | | | | | | | | | | | | | | Documentation/CodingStyle sets a strongly prefered limit of 80 characters per line in "Chapter 2: Breaking long lines and strings". Strings must be broken into smaller parts and long statements must be rewritten. Reported-by: Mikal Sande <mikal.sande@gmail.com> Reported-by: Mark Rankilor <reodge@gmail.com> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Limit queue lengths for batman and broadcast packetsSimon Wunderlich2010-05-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | This patch limits the queue lengths of batman and broadcast packets. BATMAN packets are held back for aggregation and jittered to avoid interferences. Broadcast packets are stored to be sent out multiple times to increase the probability to be received by other nodes in lossy environments. Especially in extreme cases like broadcast storms, the queues have been seen to run full, eating up all the memory and triggering the infamous OOM killer. With the queue length limits introduced in this patch, this problem is avoided. Each queue is limited to 256 entries for now, resulting in 1 MB of maximum space available in total for typical setups (assuming one packet including overhead does not require more than 2000 byte). This should also be reasonable for smaller routers, otherwise the defines can be tweaked later. This third version of the patch does not increase the local broadcast sequence number when the queue is already full. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: move /proc interface handling to /sysMarek Lindner2010-05-111-14/+7
| | | | | | | | | | | | | | | | | | | | | | | Instead of having a single /proc file "interfaces" in which you have to echo the wanted interface batman-adv will create a subfolder in each suitable /sys/class/net folder. This subfolder contains files for the interface specific settings. For example, mesh_iface to add/remove an interface from a virtual mesh network (at the moment only bat0 is supported). Example: echo bat0 > /sys/class/net/eth0/batman-adv/mesh_iface to deactivate: echo none > /sys/class/net/eth0/batman-adv/mesh_iface Interfaces which are not compatible with batman-adv won't contain the batman-adv folder, therefore can't be activated. Not supported are: loopback, non-ethernet, non-ARP and virtual mesh network interfaces Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: move originator interval setting from /proc to /sysMarek Lindner2010-05-111-2/+0
| | | | | | Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: convert more files from /proc to /sysMarek Lindner2010-05-111-2/+0
| | | | | | | | | converted files: vis_mode, vis_data Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: convert multiple /proc files to use sysfsMarek Lindner2010-05-111-2/+9
| | | | | | | | | | | | | | This is the first patch in a series of patches which aim to convert all batman-adv /proc files to sysfs. To keep the changes in a digestable size it has been split up into smaller chunks. During the transition period batman-adv will use /proc as well as sysfs. As a first step the following files have been converted: aggregate_ogm, originators, transtable_global, transtable_local Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: fix whitespace style issuesLuis de Bethencourt2010-05-111-1/+1
| | | | | | | | | | | | This patch fixes the 31 unnecessary whitespaces before a quoted newline that the batman-adv files had. Signed-off-by: Luis de Bethencourt <luisbg@ubuntu.com> [sven.eckelmann@gmx.de: Redone to apply against current version] Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Update copyright yearsSimon Wunderlich2010-05-111-1/+1
| | | | | | Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: atomic variable for vis-srv activationLinus Luessing2010-03-031-0/+2
| | | | | | | | | | | | | This fixes the bug discovered by Marek Lindner which did not allow turning on the vis-server before an interface has been added. With this patch we are using a global atomic variable for activating and deactiating the vis-server-mode, which can be used before inserting an interface. Signed-off-by: Linus Luessing <linus.luessing@web.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Remove compat.hSimon Wunderlich2010-03-031-1/+0
| | | | | | | | | Since we are now part of mainline, we don't need compat.h to allow building of the module with old versions of the kernel. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Use printk(%pM) for MAC addressesAndrew Lunn2010-03-031-1/+1
| | | | | | | | | | | | | | | printk() since kernel version 2.6.29 has supported printing MAC addresses directly, as an extension to the %p processing. This patch makes use of this for printk() and bat_dbg(). This will remove the overhead of using addr_to_string() which is normally never actually output. Fixed a typo found by Gus Wirth. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: receive packets directly using skbsSimon Wunderlich2010-03-031-20/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the (ugly and racy) packet receiving thread and the kernel socket usage. Instead, packets are received directly by registering the ethernet type and handling skbs instead of self-allocated buffers. Some consequences and comments: * we don't copy the payload data when forwarding/sending/receiving data anymore. This should boost performance. * packets from/to different interfaces can be (theoretically) processed simultaneously. Only the big originator hash lock might be in the way. * no more polling or sleeping/wakeup/scheduling issues when receiving packets * this might introduce new race conditions. * aggregation and vis code still use packet buffers and are not (yet) converted. * all spinlocks were converted to irqsave/restore versions to solve some lifelock issues when preempted. This might be overkill, some of these locks might be reverted later. * skb copies are only done if neccesary to avoid overhead performance differences: * we made some "benchmarks" with intel laptops. * bandwidth on Gigabit Ethernet increased from ~500 MBit/s to ~920 MBit/s * ping latency decresed from ~2ms to ~0.2 ms I did some tests on my 9 node qemu environment and could confirm that usual sending/receiving, forwarding, vis, batctl ping etc works. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Acked-by: Sven Eckelmann <sven.eckelmann@gmx.de> Acked-by: Marek Lindner <lindner_marek@yahoo.de> Acked-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Fix the naming of the debug option.Andrew Lunn2010-03-031-1/+1
| | | | | | | | | | So that the configuration hierarchy is correct, set the debug option to have the same base as the main BATMAN option. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Split originator handling parts out of routing.cAndrew Lunn2010-03-031-0/+1
| | | | | | | | | | Bug found and fixed in origional version by Linus Luessing. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Linus Luessing <linus.luessing@web.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: replace internal logging mechanism.Andrew Lunn2010-03-031-7/+17
| | | | | | | | | | batman-adv used its own logging infrastructure. Replace this with standard kernel logging, printk(), with compile time and runtime options to enable/disable different debug levels. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging: batman-adv meshing protocolAndrew Lunn2009-12-111-0/+286
B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is a routing protocol for multi-hop ad-hoc mesh networks. The networks may be wired or wireless. See http://www.open-mesh.org/ for more information and user space tools. This is the first submission for inclusion in staging. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
OpenPOWER on IntegriCloud