summaryrefslogtreecommitdiffstats
path: root/drivers/staging/batman-adv/vis.c
Commit message (Collapse)AuthorAgeFilesLines
* staging: batman-adv: remove useless addr_to_string()Andy Shevchenko2010-10-201-12/+6
| | | | | | | | | | | | | 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: checkpatch cleanup of commentsSven Eckelmann2010-09-201-8/+8
| | | | | | | | | | | | | checkpatch now detects the start of a comment and warns about usage of multiple spaces at the beginning of a line. We have to replace the ' ' in multiple lines comments by ' * ' to fix it. Checkpatch also wants a comment after a definition of a spinlock_t which describes what it protects. It is currently not possible to add it before the actual struct which includes the spinlock. Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Don't inform about dropped packets in nodebugSven Eckelmann2010-09-051-1/+1
| | | | | | | | | | | | Information about dropped packets are usually only interesting for debugging purposes and otherwise open the possibility to flood the logs of the target machine with useless information. pr_debug will not output those information on a nodebug kernel. Reported-by: Vasiliy Kulikov <segooon@gmail.com> 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-154/+181
| | | | | | | | | | | | | | 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-7/+6
| | | | | | | | | | | | | 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: Prepare vis packets directly inside a skbSven Eckelmann2010-09-051-74/+132
| | | | | | | | | | | | | | The vis information structure is used in a way that it can be transfered directly as packet. It still had to be copied into a skb because of an extra buffer used for the actual preparation of the data. This is unnecessary and can be replaced by a simple clone instead of an full copy before each send. This makes also the send_raw_packet function obsolete. Reported-by: David S. Miller <davem@davemloft.net> 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-5/+4
| | | | | | | | | | | | | | | 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: Lower resolution for timeoutsSimon Wunderlich2010-07-081-1/+1
| | | | | | | | | | It is enough for our timeouts to keep them in seconds instead of miliseconds. With a too high resolution, we might even risk an integer overflow, so this patch should make things more safe. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.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-6/+6
| | | | | | | | 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: 32bit sequence number and TTL for broadcastsSimon Wunderlich2010-06-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | This patch changes the sequence number range from 8 or 16 bit to 32 bit. This should avoid problems with the sequence number sliding window algorithm which we had seen in the past for broadcast floods or malicious packet injections. We can not assure 100% security with this patch, but it is quite an improvement over the old 16 bit sequence numbers: * expected window size can be increased (4096 -> 65536) * 64k packets in the right order would now be needed to cause a loop, which seems practically impossible. Furthermore, a TTL field has been added to the broadcast packet type, just to make sure. These changes required to increase the compatibility level once again. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> [sven.eckelmann@gmx.de: Change atomic64_* back to atomic_*, 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: Mark locally used symbols as staticSven Eckelmann2010-06-221-2/+2
| | | | | | | | | | | | | | | | | Functions and variables which are used only inside one object file can be declared as static. This helped to find unused functions/variables * mainIfAddr_default * main_if_was_up and functions with declarations but missing definitions * hash_debug * orig_find * send_own_packet_work Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Move tables from sysfs to debugfsSven Eckelmann2010-06-221-31/+80
| | | | | | | | | | Files which represent more than a single attribute aren't allowed in sysfs. As we have some files which aren't essential and are lists or tables aggregated from data from different places inside batman-adv, we must place them in a filesystem without such a restriction. 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-2/+2
| | | | | | | | | | | | | 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: Fix whitespace problems criticized by checkpatch.plSven Eckelmann2010-05-111-1/+1
| | | | | | | | | | | | | | Trailing spaces at the end of a line or before a tab are against Documentation/CodingStyle "3.1: Spaces" and should be avoided. It is also common style to add a single space after commas unless it is followed either by a newline or a tab. Reported-by: Mikal Sande <mikal.sande@gmail.com> Reported-by: Luis de Bethencourt <luisbg@ubuntu.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: move /proc interface handling to /sysMarek Lindner2010-05-111-6/+3
| | | | | | | | | | | | | | | | | | | | | | | 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: remove redundant pointer to originator interfaceMarek Lindner2010-05-111-8/+7
| | | | | | 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-18/+106
| | | | | | | | | 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: 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: Fixing wrap-around bug in visLinus Lüssing2010-05-111-1/+17
| | | | | | | | | | | | | | | When the seqno for a vis packet had a wrap around from i.e. 255 to 0, add_packet() would falsely claim the older packet with the seqno 255 as newer as the one with the seqno of 0 and would therefore ignore the new packet. This happens with all following vis packets until the old vis packet expires after 180 seconds timeout. This patch fixes this issue and gets rid of these highly undesired 3min. breaks for the vis-server. Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: Fix VIS output bug for secondary interfacesLinus Lüssing2010-05-111-16/+9
| | | | | | | | | | | | TQ and HNA records for originators on secondary interfaces were wrongly being included on the primary interface. Ensure we output a line for each source interface on every node, so we correctly separate primary and secondary interface records. Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: don't have interrupts disabled while sending.Andrew Lunn2010-05-111-58/+136
| | | | | | | | | | | | | | | | | | send_vis_packets() would disable interrupts before calling dev_queue_xmit() which resulting in a backtrace in local_bh_enable(). Fix this by using kref on the vis_info object so that we can call send_vis_packets() without holding vis_hash_lock. vis_hash_lock also used to protect recv_list, so we now need a new lock to protect that instead of vis_hash_lock. Also a few checkpatch cleanups. Reported-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: batman-adv: atomic variable for vis-srv activationLinus Luessing2010-03-031-40/+6
| | | | | | | | | | | | | 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: receive packets directly using skbsSimon Wunderlich2010-03-031-23/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: splitting /proc vis file into vis_server and vis_dataMarek Lindner2010-03-031-0/+62
| | | | | | | | | | | | | | 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: 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: initialize static hash iteratorsSimon Wunderlich2010-03-031-17/+16
| | | | | | | | | | | | | | | 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 internal logging mechanism.Andrew Lunn2010-03-031-7/+5
| | | | | | | | | | 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/+564
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