summaryrefslogtreecommitdiffstats
path: root/drivers/staging/batman-adv
Commit message (Collapse)AuthorAgeFilesLines
* Staging: make drivers use spin_lock_init()Sven-Thorsten Dietrich2010-03-031-1/+1
| | | | | | | | | | This fixes some RT-triggered compile errors and typos. Signed-off-by: Sven-Thorsten Dietrich <sdietrich@novell.com> Acked-by: Marek Lindner <lindner_marek@yahoo.de> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: fix module initializationMarek Lindner2010-03-032-11/+13
| | | | | | | | | | | | Make sure that batman-adv does not process packets before its initialization is complete. Some sanity checks added to the receiver function. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> 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: avoid crash on memory allocation errorMarek Lindner2010-03-031-7/+9
| | | | | | | | | | skb_share_check() returns NULL if it can't allocate more memory but it still frees the skbuff. 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 skbuff leak in VIS code.Andrew Lunn2010-03-031-5/+4
| | | | | | | | | | The vis code takes a copy of the data inside the skbuf if it is interesting for us, so we always need to release the skbuf. Reported-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: atomic variable for vis-srv activationLinus Luessing2010-03-036-51/+18
| | | | | | | | | | | | | 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 obsolete variablesMarek Lindner2010-03-032-3/+0
| | | | | | | | | | This patch removes a variable that became obsolete since the skb handling replaced the packet handling thread. 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: avoid having the same error message more than onceMarek Lindner2010-03-031-6/+8
| | | | | | | | | | | | | The routing code has 2 sections which warn about ttl exceeded. The corresponding warnings were identical which makes it hard to debug. In addition, batman-adv does not need to warn about ttl exceeded in case we encountered an echo request as this is commonly used to generate traceroute graphs. 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: don't lock while sending packetsSimon Wunderlich2010-03-031-3/+10
| | | | | | | | | | | | | As in other parts of batman-adv, we should not lock while sending a packet but keep the lock held for as short as possible. Additionally, we should check whether the interface is active, otherwise batman_if->net_dev might not be available ... Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Acked-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: depend on NET instead of PACKET in KconfigSven Eckelmann2010-03-031-1/+1
| | | | | | | | | | | The code which uses the raw packet sockets was removed. The only related dependencies are the skb and netdev handling code. This is provided by NET in Kconfig. Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Update the README for mainline usage.Andrew Lunn2010-03-031-37/+13
| | | | | | | | | | | The module now only compiles inside mainline, so remove the comments about different versions of the kernel it can be used with. Also update comments about building with debug enabled and how to use the VIS data now that it no longer natively outputs dot or JSON. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Dont deactivate aggregation on wrong inputLinus Lüssing2010-03-031-12/+12
| | | | | | | | | | | A non-integer changes the aggregation mode. Therefore this patch changes the behaviour to explicitly check strict_strtoul()'s return code. Signed-off-by: Linus Lüssing <linus.luessing@web.de> Acked-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: Remove compat.hSimon Wunderlich2010-03-0312-151/+6
| | | | | | | | | 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-039-121/+111
| | | | | | | | | | | | | | | 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: Allow the MAC address to be setAndrew Lunn2010-03-033-2/+27
| | | | | | | | | | | | | | Some embedded devices have very limited sources of entropy for the random number generator. It has been observed that the random MAC address on the interface bat0 is not always random. When testing with a collection of identical hardware, sometimes the bat0 device the same MAC address on multiple devices, causing mayhem. This patch allows the MAC address to be set by the user. 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-0315-509/+548
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: check all kmalloc()sSimon Wunderlich2010-03-033-14/+53
| | | | | | | | | | | there are some kmallocs left which are not checked whether they succeeds or not, which might lead to corrupted data structures if the system memory is full. This patch should clean up the remaining unchecked kmalloc()s. 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: splitting /proc vis file into vis_server and vis_dataMarek Lindner2010-03-035-103/+151
| | | | | | | | | | | | | | The /proc vis file was used to enable/disable the vis server and to output the vis data at the same time. This behaviour was confusing and lacked a proper method to display the current vis server status. This patch seperates the 2 functionalities: * use vis_server to enable/disable the vis server and to retrieve its status * use vis_data to retrieve the vis raw data (if the server is enabled) 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: remove obsoleted vis_format /proc fileLinus Luessing2010-03-032-83/+1
| | | | | | | | | | | | batman-adv used to export the vis data using different formats that were switchable via /proc/net/batman-adv/vis_format. The various formats moved to user space and rendered this configuration switch useless. Signed-off-by: Linus Luessing <linus.luessing@web.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: moving vis output formats out of the kernelAndrew Lunn2010-03-033-129/+60
| | | | | | | | | | | | The batman-adv kernel module is able to output visualization data using the dot draw or JSON format. This patch transforms the output into a generic format (called vis raw). User space tool may convert the raw data to support a variety of formats without the need of modifying the kernel module. 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: fix minor orig table layout bugMarek Lindner2010-03-031-1/+1
| | | | | | | | | | The originator table contained a TAB instead of a space which broke the layout as well as the batctl parser. 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: Fixes rounding issues in vis.cLinus Lüssing2010-03-031-2/+2
| | | | | | | | | | | | | | | | | This patches fixes two rounding issues in vis.c for sending and purging vis packets. Before, the timers and timeouts always got rounded down to seconds, though we want a precision in milliseconds. This also fixes a kernel panic that occures when lowering the timer for sending vis packets (vis_interval) to less than 1000ms in main.c manually. Signed-off-by: Linus Lüssing <linus.luessing@web.de> Acked-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: Use forw_bcast_list_lock always with disabled interruptsSven Eckelmann2010-03-031-8/+11
| | | | | | | | | | | | | | | | | | | | | | | forw_bcast_list_lock is spin_locked in both process and softirq context. SoftIRQ calls the spinlock with disabled IRQ and normal process context with enabled IRQs. When process context is inside an spin_locked area protected by forw_bcast_list_lock and gets interrupted by an IRQ, it could happen that something tries to lock forw_bcast_list_lock again in SoftIRQ context. It cannot proceed further since the lock is already taken somewhere else, but no reschedule will happen inside the SoftIRQ context. This leads to an complete kernel hang without any chance of resurrection. All functions called in process context must disable IRQs when they try to get get that lock to to prevent any reschedule due to IRQs. Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Acked-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: consistent spelling of "neighbors"Simon Wunderlich2010-03-035-14/+14
| | | | | | | | | | we have written "neighbors", "neighbours" and bad spelled versions of this word, this patch should make it consistent. 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: initialize static hash iteratorsSimon Wunderlich2010-03-038-60/+57
| | | | | | | | | | | | | | | instead of dynamically registering hash iterators, calling functions are changed to register the iterator objects statically. The two advantages are: * no memory leaks when aborting from hash_iterate() * no calls to kmalloc/kfree, therefore a little faster/safer Tested with 9 QEMU instances, no obvious regression found. 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: Replace KERN_DEBUG with bat_dbgAndrew Lunn2010-03-032-9/+3
| | | | | | | | | | Ameya Palande requested we replace printk(KERN_DEBUG "") by pr_debug() I decided it was better to use our debug macro. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: update README for latest kernelSimon Wunderlich2010-03-031-2/+2
| | | | | | | | | state in the README that we also (compile) support 2.6.32 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: Remove NULL pointer checkSven Eckelmann2010-03-031-2/+1
| | | | | | | | | | | It is safe to call kfree(NULL) which makes this extra check unneeded. It was found using checkpatch.pl from linux-2.6 Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Acked-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: Fix the naming of the debug option.Andrew Lunn2010-03-034-6/+6
| | | | | | | | | | 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-036-221/+289
| | | | | | | | | | 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: Always receive when discarding.Andrew Lunn2010-03-031-2/+1
| | | | | | | | | | It does not matter if the interface is to be activated or not, we must read the packet in order that it be discarded. 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: stop persistent warnings if a device is deactivated.Andrew Lunn2010-03-031-6/+2
| | | | | | | | | | | Without this change we spam the kernel log on every packet received on any other interface when an interface has been added, but is not yet active, ie UP. 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: Refactor routing.cAndrew Lunn2010-03-031-439/+709
| | | | | | | | | | | | Break up a lot of the big functions up into many smaller ones. This helps with readability and there is now a lot less code squashed against the right hand margin. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Marek Lindner <lindner_marek@yahoo.de> Acked-by: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: replace internal logging mechanism.Andrew Lunn2010-03-0315-520/+242
| | | | | | | | | | 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: introduce missing kfreeJulia Lawall2009-12-231-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error handling code following a kzalloc should free the allocated data. Similarly for usb-alloc urb. The semantic match that finds the first problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...); ... if (x == NULL) S <... when != x when != if (...) { <+...x...+> } ( x->f1 = E | (x->f1 == NULL || ...) | f(...,x->f1,...) ) ...> ( return \(0\|<+...x...+>\|ptr\); | return@p2 ...; ) @script:python@ p1 << r.p1; p2 << r.p2; @@ print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Add Kconfig dependancies on PROC_FS and PACKET.Andrew Lunn2009-12-231-0/+1
| | | | | | Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman: fix debug Kconfig optionGreg Kroah-Hartman2009-12-111-1/+1
| | | | | | | The debug batman option needs to depend on the correct config option. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* staging: batman-adv meshing protocolAndrew Lunn2009-12-1136-0/+7098
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