Sven Eckelmann [Fri, 7 May 2010 19:47:29 +0000 (21:47 +0200)]
Staging: batman-adv: Fix whitespace problems criticized by checkpatch.pl
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>
Sven Eckelmann [Fri, 7 May 2010 19:47:27 +0000 (21:47 +0200)]
Staging: batman-adv: Update pointer to ethhdr after skb_copy
We must ensure that all pointer to a socket buffer are updated when we
copy a socket buffer and free our reference to the old one.
Another part of the kernel could also free its reference which maybe
removes the buffer completely. In that situation we would would feed
wrong information to the routing algorithm after the memory area is
written again by someone else.
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 packets
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: Reorganize sequence number handling
BATMAN and broadcast packets are tracked with a sequence number window of
currently 64 entries to measure and avoid duplicates. Packets which have a
sequence number smaller than the newest received packet minus 64 are not
within this sequence number window anymore and are called "old packets"
from now on.
When old packets are received, the routing code assumes that the host of the
originator has been restarted. This assumption however might be wrong as
packets can also be delayed by NIC drivers, e.g. because of long queues or
collision detection in dense WiFi? environments. This behaviour can be
reproduced by doing a broadcast ping flood in a dense node environment.
The effect is that the sequence number window is jumping forth and back,
accepting and forwarding any packet (because packets are assumed to be "new")
and causing loops.
To overcome this problem, the sequence number handling has been reorganized.
When an old packet is received, the window is reset back only once. Other old
packets are dropped for (currently) 30 seconds to "protect" the new sequence
number and avoid the hopping as described above.
The reorganization brings some code cleanups (at least i hope you feel the
same) and also fixes a bug in count_real_packets() which falsely updated
the last_real_seqno for slightly older packets within the seqno window
if they are no duplicates.
This second version of the patch also fixes a problem where for seq_diff==64
bit_shift() reads from outside of the seqno window, and removes the loop
for seq_diff == -64 which was present in the first patch.
The third iteration also adds a window for the next expected sequence numbers.
This minimizes sequence number flapping for packets with very big differences
(e.g. 3 packets with seqno 0, 25000 and 50000 might still cause problems
without this window).
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>
Sven Eckelmann [Fri, 7 May 2010 19:47:23 +0000 (21:47 +0200)]
Staging: batman-adv: fix whitespace style issues
This patch fixes unnecessary whitespaces before a quoted
newline that the remaining batman-adv files had.
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>
Marek Lindner [Fri, 7 May 2010 19:47:22 +0000 (21:47 +0200)]
Staging: batman-adv: move /proc interface handling to /sys
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).
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>
Marek Lindner [Fri, 7 May 2010 19:47:18 +0000 (21:47 +0200)]
Staging: batman-adv: convert multiple /proc files to use sysfs
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>
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>
Linus Lüssing [Fri, 7 May 2010 19:47:14 +0000 (21:47 +0200)]
Staging: batman-adv: Update README about vis raw output
We are now having a newer, more neutral vis output so that we won't have
to change the kernelmodule for adding support of new vis output formats.
This patch adds an explanation about this in the README file of
batman-adv and removes the description about the dot/json format (they
will be added to the README of batctl).
Signed-off-by: Linus Lüssing <linus.luessing@web.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>
So far, neighbour's secondary interface OGMs can involuntarily
piggyback on primary interface OGMs that arrived on the same secondary
interface before. Secondary interface OGMs should NEVER leave their
direct neighbour broadcast domain! This patch ensures that secondary
interface OGMs can only be aggregated to other secondary interface OGMs.
Signed-off-by: Linus Lüssing <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>
Marek Lindner [Fri, 7 May 2010 19:47:08 +0000 (21:47 +0200)]
Staging: batman-adv: fix aggregation timing bug
batman-adv aggregates routing packets to reduce the number of packets in
the air. Every outgoing packet is compared with other packets in the
buffer to determine whether it can be aggregated or not. Packets sent
at a lower interval can be held back longer to maximize the aggregation.
Due to insufficient checking batman-adv held back all packets for a
certain time depending on its own lowest interval rate which slowed
down all other nodes.
Reported-by: Linus Lüssing <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>
Sven Eckelmann [Fri, 7 May 2010 19:47:07 +0000 (21:47 +0200)]
Staging: batman-adv: Clone shared bat packets before modifying them
"tcpdump" and "batctl td" will receive packets with a wrong sequence
number on systems with a different endianess than network byte order.
This happens due to the reordering of bytes in the function which
handles aggregated bat packets. The function which receives the bat
packets must ensure that these buffers aren't shared with anything else
before that function tries to write into it. Otherwise it has to copy
the buffers so it is save again to change them.
Reported-by: Kevin Steen <batman@kevinsteen.net> 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>
Linus Lüssing [Fri, 7 May 2010 19:47:06 +0000 (21:47 +0200)]
Staging: batman-adv: only modify hna-table on active module
If we haven't set the module to MODULE_ACTIVE state before (in general,
no interface has yet been added to batman-adv) then the hna table is not
initialised yet. If the kernel changes the mac address of the bat0
interface at this moment then an hna_local_add() called by interface_set_mac_addr()
then resulted in a null pointer derefernce. With this patch we are now
explicitly checking before if the state is MODULE_ACTIVE right now so
that we can assume having an initialised hna table.
Signed-off-by: Linus Lüssing <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>
Randy Dunlap [Wed, 5 May 2010 22:45:22 +0000 (15:45 -0700)]
Staging: rar_register: depends on PCI
rar_register driver uses PCI interfaces and PCI devices, so it
should depend on PCI.
Also format the Kconfig help text as normally done.
drivers/staging/rar_register/rar_register.c:623: error: implicit declaration of function 'pci_dev_get'
drivers/staging/rar_register/rar_register.c:623: warning: assignment makes pointer from integer without a cast
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
It has sat in the staging directory since October of 2009, and no one
has stepped up to take it over, so odds are, no one cares about it
anymore. So, it is now deleted as scheduled, and documented in the TODO
file.
Cc: John W. Linville <linville@tuxdriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
It has sat in the staging directory since October of 2009, and no one
has stepped up to take it over, so odds are, no one cares about it
anymore. So, it is now deleted as scheduled, and documented in the TODO
file.
Cc: John W. Linville <linville@tuxdriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
It has sat in the staging directory since October of 2009, and no one
has stepped up to take it over, so odds are, no one cares about it
anymore. So, it is now deleted as scheduled, and documented in the TODO
file.
Cc: John W. Linville <linville@tuxdriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
It has sat in the staging directory since October of 2009, and no one
has stepped up to take it over, so odds are, no one cares about it
anymore. So, it is now deleted as scheduled, and documented in the TODO
file.
Cc: John W. Linville <linville@tuxdriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Bill Pemberton [Wed, 5 May 2010 19:27:49 +0000 (15:27 -0400)]
staging: hv: check return value of RingBufferInit()
RingBufferInit() would always return sucess and instead relied on an
ASSERT() to test for an error condition. Remove the ASSERT() and
return -EINVAL instead. The return value of RingBufferInit() was also
never checked, so check it.
Staging: comedi: cb_pcidas64: fix up build warnings
Now that the 8255.h file is being included properly, we were
using the incorrect function prototypes, which causes a build
warning now. This fixes it up and preserves the __iomem markings that
sparse wants to see.
Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Staging: comedi: 8255: fix up previous static markings.
Ian pointed out that exported symbols should not be marked as static :)
Fixed this up by properly including the 8255.h file, and fixing
the function prototypes there, as the CONFIG variables were not getting
set so users of the header file were seeing the incorrect function
prototypes.
Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>