Commit Graph

174 Commits (6e8af08dfa40b747002207d3ce8e8b43a050d99f)

Author SHA1 Message Date
Marek Lindner b6faaae1a1 Staging: batman-adv: ensure that eth_type_trans gets linear memory
eth_type_trans tries to pull data with the length of the ethernet header
from the skb. We only ensured that enough data for the first ethernet
header and the batman header is available in non-paged memory of the skb
and not for the ethernet after the batman header.

eth_type_trans would fail sometimes with drivers which don't ensure that
all there data is perfectly linearised.

The failure was noticed through a kernel bug Oops generated by the
skb_pull inside eth_type_trans.

Reported-by: Rafal Lesniak <lesniak@eresi-project.org>
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>
2010-11-29 10:53:14 -08:00
Sven Eckelmann 9ee898739b Staging: batman-adv: Don't remove interface with spinlock held
We call a lot of the netdevice code when holding if_list_lock which will
spin the whole time. This is not necessary because we only want to
protect the access to the list to be serialized. An extra queue can be
used which hold all interfaces which should be removed and then use that
queue without any locks for netdevice cleanup.

We create a "scheduling while atomic" Oops when calling different
netdevice related functions inside a spinlock protected area on a
preemtible kernel.

Reported-by: Rafal Lesniak <lesniak@eresi-project.org>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-29 10:53:14 -08:00
Marek Lindner 4d774a7fed Staging: batman-adv: suppress false warning when changing the mac address
Whenever the mac address of an batman interface is changed
check_known_mac_addr() is called to print a warning if the newly added
mac address exists an another batman interface. While looping through
the batman interface list check_known_mac_addr() only compares mac
addresses and does not make sure they belong to different interfaces,
thus always printing a warning.

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>
2010-11-09 16:21:27 -08:00
Chris Lang f581cf21b4 Staging: batman-adv: fix interface alternating and bonding reggression
55d1666b521cbed95924c8d4775fe272c103f08c incidentally disabled bonding
of packets first entering the mesh along with also disabling interface
alternating regardless of where the packet came from. This re-enables
these options.

Signed-off-by: Chris Lang <clang@gateworks.com>
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>
2010-11-09 16:21:27 -08:00
Andy Shevchenko 77099f0afe staging: batman-adv: remove useless addr_to_string()
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>
2010-10-20 15:48:40 -07:00
Marek Lindner 1bc80e9527 Staging: batman-adv: process OGMs bigger than MAX_AGGREGATION_BYTES
Reported-by: Sam Yeung <sam.cwyeung@gmail.com>
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>
2010-10-19 10:04:16 -07:00
Marek Lindner 15f00687e3 Staging: batman-adv: fix crash when new OGM is generated
If aggregation is not enabled the local translation table can grow
much bigger and expects to fill a full ethernet packet.

Reported-by: Sam Yeung <sam.cwyeung@gmail.com>
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>
2010-10-19 10:04:16 -07:00
Marek Lindner 24fb009bae Staging: batman-adv: protect against ogm packet overflow by checking table length
Reported-by: Sam Yeung <sam.cwyeung@gmail.com>
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>
2010-10-19 10:04:16 -07:00
Marek Lindner 3c45603024 Staging: batman-adv: document fragmentation sysfs API
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>
2010-10-19 10:04:16 -07:00
Linus Lüssing 5dfa2ba9e6 Staging: batman-adv: Fix resizing of broadcast seqno buffers on if deletion
Not only the entries of the deleted interface got erased, but also all
ones with a lower if_num. This commit fixes this issue by setting the
destination appropriately.

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>
2010-10-19 10:04:16 -07:00
Sven Eckelmann 9b37bc2c71 Staging: batman-adv: Don't dereference unchecked incoming soft_iface
send_packet derefenced forw_packet->if_incoming and checked if
forw_packet->if_incoming is NULL.

This cannot happen, but still makes irritates when reading through the
functions.

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-19 10:04:16 -07:00
Sven Eckelmann 1ee600ced3 Staging: batman-adv: Add hash recommendations to TODO
David Miller <davem@davemloft.net> recommended in
20100924.134334.28812338.davem@davemloft.net that we must make the hash
abstraction helper more efficient and may remove it completely.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-19 10:04:15 -07:00
Tracey Dent 8996ba139e Staging: batman-adv: Makefile: replace the use of <module>-objs with <module>-y
Changed <module>-objs to <module>-y n Makefile.

Signed-off-by: Tracey Dent <tdent48227@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-08 07:23:53 -07:00
Marek Lindner 037dafa867 Staging: batman-adv: Introduce update_primary_addr to update mac address
set_primary_if is currently misused to update the mac address in vis
packets. This unneeded and introduces overhead due to other operations
which must be done when updating the primary interface.

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>
2010-09-20 16:29:51 -07:00
Sven Eckelmann 7e8158b341 Staging: batman-adv: Track references of batman_if in set_primary_if
set_primary_if exchanges the current primary interfaces with a new one.
This is a new reference and thus we have to count it and decrease the
count of the old primary interface.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-20 16:29:50 -07:00
Sven Eckelmann 399fb5b445 Staging: batman-adv: count batman_if list queries as reference
The return of get_batman_if_by_netdev and get_active_batman_if leaks a
pointer from the rcu protected list of interfaces. We must protect it to
prevent a too early release of the memory. Those functions must increase
the reference counter before rcu_read_unlock or it may be to late to
prevent a free.

hardif_add_interface must also increase the reference count for the
returned batman_if to make the behaviour consistent.

Reported-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-20 16:29:50 -07:00
Sven Eckelmann 47f621dddc Staging: batman-adv: Use refcnt to track usage count of batman_if
get_batman_if_by_netdev and get_active_batman_if may leak data from the
rcu protected list of interfaces. The rcu protected list of all gateway
nodes leaks the actual data outside the read-side critical area. This is
not valid as we may free the data using a call_rcu created callback
after we unlock using rcu_read_unlock. A workaround is to provide a
reference count to be sure that the memory isn't freed to early.

It is currently only to implement the already existing functionality and
doesn't provide the full tracking of all usage cases.

Additionally, we must hardif_hold inside the
rcu_read_lock()..rcu_read_unlock() before we attach to the structure
which "leaks" it. When another function now removed it from its usage
context (primary_if, usage on stack, ...) then we must hardif_put it. If
it is decremented to zero then we can issue the call_rcu to the freeing
function. So "put" is not allowed inside an rcu_read_lock.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-20 16:29:50 -07:00
Sven Eckelmann 16f9530e99 Staging: batman-adv: Use synchronize_rcu instead of call_rcu
It is recommended [1] to use synchronize_rcu to simplify the code -
especially when otherwise extra locking is needed to protect other code
from picking stale elements. It also protects us for emitting to many
callbacks which may results in OOM conditions.

The only reason not to use it, would be in performance critical sections
or when we are not allowed to block.

[1] Documentation/RCU/checklist.txt

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-20 16:29:49 -07:00
Sven Eckelmann 952c699c06 Staging: batman-adv: Remove unneeded rcu_read_lock
Regions which do not use rcu functions don't need to protected by
rcu_read_lock. If we want to protect data from being freed than it must
be covered by the same read-side critical section or otherwise the grace
period may already ended and freed the memory before we called
rcu_read_lock again.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-20 16:29:49 -07:00
Sven Eckelmann 2250840111 Staging: batman-adv: Always protect list_for_each_entry_rcu with RCU
receive_bat_packet is not called with rcu_read_lock so we must ensure by
ourself that we protect list_for_each_entry_rcu using the correct RCU
locks.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-20 16:29:49 -07:00
Sven Eckelmann af2ac7bfec Staging: batman-adv: Introduce if_list_lock to protect if_list
The update critical sections of if_list must be protected by a locking
primitive other than RCU. The iterator must also be protected by the
chosen locking mechanism.

The rtnl_lock in hardif_remove_interfaces must also be moved outside the
iterator primitive to ensure that we don't deadlock the kernel due to
differently nested locks in hardif_remove_interfaces and hard_if_event.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-20 16:29:49 -07:00
Sven Eckelmann 67c3b70593 Staging: batman-adv: wait for call_rcu before unloading module
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>
2010-09-20 16:29:48 -07:00
Sven Eckelmann 2d77bb592f Staging: batman-adv: Mark debugfs files as nonseekable
We don't allow to seek in the debugfs socket and log files. Thus we
should mark the file descriptor as nonseekable.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-20 16:29:48 -07:00
Sven Eckelmann 93b3d9d578 Staging: batman-adv: Move mailing list address to .org
The official mailing list is run on lists.open-mesh.org and it should be
avoided to sent them to lists.open-mesh.net to reduce the number of
receipents and double posts.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-20 16:29:48 -07:00
Sven Eckelmann 1612ae996e Staging: batman-adv: checkpatch cleanup of comments
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>
2010-09-20 16:29:47 -07:00
Vasiliy Kulikov ff75f96bb0 Staging: batman-adv: check kmalloc() return value
kmalloc() may fail, if so drop current packet.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
[sven.eckelmann@gmx.de: Removed new introduced deadlock]
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-14 16:38:34 -07:00
Marek Lindner b001f71ed1 Staging: batman-adv: removing redundant assignment of skb->dev
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>
2010-09-14 16:38:33 -07:00
Sven Eckelmann 368b4f06c8 Staging: batman-adv: Add rcu TODO
Paul E. McKenney informed us that rcu is misused by leaking pointers to
rcu related elements outside read-side protected critical sections.

He also recommended that it should be checked against the rcu checklist.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-14 16:38:32 -07:00
Sven Eckelmann f73d8b4321 Staging: batman-adv: Remove currently unused gw_* datastructures
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>
2010-09-14 16:38:32 -07:00
Linus Lüssing 09686b560f Staging: batman-adv: Always synchronize rcu's on module shutdown
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>
2010-09-14 16:38:32 -07:00
Sven Eckelmann 07fd7364b3 Staging: batman-adv: Update mtu of bat device by changing mtu of slave device
We must reduce our own mtu when we reduce the mtu of any device we use
to transfer our packets. Otherwise we may accept to large packets which
gets dropped by the actual device.

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>
2010-09-05 00:29:50 -07:00
Sven Eckelmann 81abee4f18 Staging: batman-adv: Don't inform about dropped packets in nodebug
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>
2010-09-05 00:29:50 -07:00
Sven Eckelmann 57b7117af8 Staging: batman-adv: Remove duplicate of attached device name
batman_if has the name of the net_dev as extra string in its own
structure, but also holds a reference to the actual net_device structure
which always has the current name of the device. This makes it
unneccessary and also more complex because we must update the name in
situations when we receive a NETDEV_CHANGENAME event.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-05 00:29:50 -07:00
Marek Lindner 8c70f13832 Staging: batman-adv: multiple mesh clouds
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>
2010-09-05 00:29:49 -07:00
Marek Lindner 6a0e9fa88d 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>
2010-09-05 00:29:49 -07:00
Sven Eckelmann bf3264f6d1 Staging: batman-adv: Provide full headers and packets as linear skb
We must ensure that all interesting data is linear and not paged out to
access all information in a header or a full batman-adv related packet.
Otherwise we may drop packets which have non-linear headers but which
hold valid data.

This doesn't affect non-linear skbs which have all headers in a linear
head unless we must process the whole packet like in ogms or vis
packets.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-05 00:29:48 -07:00
Sven Eckelmann aedbffc777 Staging: batman-adv: Create copy of skb with pre-allocated headroom
We can use skb_cow instead of a handwritten function to test and create
a writable skb buffer. This also allows us to pre-allocate headroom to
be able to send the data without re-allocating the buffer again to add
the ethernet header.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-05 00:29:48 -07:00
Sven Eckelmann b411d498ee Staging: batman-adv: Prepare vis packets directly inside a skb
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>
2010-09-05 00:29:47 -07:00
Sven Eckelmann b706007b89 Staging: batman-adv: Aggregate batman packets directly in skb
All originator messages are send through aggregation buffers. Those
buffers can directly be allocated as skb to reduce the cost of
allocation an extra buffer and copying them to a new allocated skb
directly before it gets send.

Now only the skb must be cloned in case of send_packet_to_if as it gets
called by send_packet for each interface. Non-primary ogms must not
cloned at all because they will only send once and the forward_packet
structure is freed by send_outstanding_bat_packet afterwards.

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>
2010-09-05 00:29:47 -07:00
Sven Eckelmann 43bfee7693 Staging: batman-adv: Only clone skb data for multiple broadcasts
batman-adv tries to resend broadcasts on all interfaces up to three
times. For each round and each interface it must provide a skb which
gets consumed by the sending function.

It is unnecessary to copy the data of each broadcast because the actual
data is either not shared or already copied by add_bcast_packet_to_list.
So it is enough to just copy the skb control data

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>
2010-09-05 00:29:46 -07:00
Sven Eckelmann 99eed2842c Staging: batman-adv: Keep header writable and unshared
my_skb_push provided an easy way to allocate enough headroom in
situation were we don't have enough space left and move the data pointer
to the new position, but we didn't checked wether we are allowed to
write to the new pushed header. This is for example a problem when the
skb was cloned and thus doesn't have a private data part.

my_skb_head_push now replaces my_skb_push by using skb_cow_head to
provide only a large enough, writable header without testing for the
rest of the (maybe shared) data. It will also move the data pointer
using skb_push when skb_cow_head doesn't fail.

This should give us enough flexibility in situation were skbs will be
queued by underlying layers and still doesn't unnecessarily copy the
data in situations when the skb was consumed right away during
dev_queue_xmit.

Reported-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>
2010-09-05 00:29:46 -07:00
Marek Lindner 15cf5523d2 Staging: batman-adv: register the batman-adv packet type per interface
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>
2010-09-05 00:29:45 -07:00
Sven Eckelmann d52e90aeaf Staging: batman-adv: Directly prepare icmp packets in socket buffer
It is unnecessary to generate an icmp packet in an extra memory region
and than copying it to a new allocated skb.

This also resolved the problem that we do inform the user that we
couldn't send the packet because we couldn't allocate the socket buffer.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-05 00:29:45 -07:00
Andreas Langer e63760e595 Staging: batman-adv: layer2 unicast packet fragmentation
This patch implements a simple layer2 fragmentation to allow traffic
exchange over network interfaces with a MTU smaller than 1500 bytes. The
fragmentation splits the big packets into two parts and marks the frames
accordingly. The receiving end buffers the packets to reassemble the
orignal packet before passing it to the higher layers. This feature
makes it necessary to modify the batman-adv encapsulation for unicast
packets by adding a sequence number, flags and the originator address.
This modifcation is part of a seperate packet type for fragemented
packets to keep the original overhead as low as possible. This patch
enables the feature by default to ensure the data traffic can travel
through the network. But it also prints a warning to notify the user
about the performance implications.

Note: Fragmentation should be avoided at all costs since it has a
dramatic impact on the performance, especially when it comes wifi
networks. Instead of a single packet, 2 packets have to be sent! Not
only valuable airtime is wasted but also packetloss decreases the
throughput. A link with 50% packetloss and fragmentation enabled is
pretty much unusable.

Signed-off-by: Andreas Langer <an.langer@gmx.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>
2010-09-05 00:29:45 -07:00
Marek Lindner 24c76fc07b Staging: batman-adv: refactoring unicast payload code
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>
2010-09-05 00:29:44 -07:00
Simon Wunderlich 7d02674f71 Staging: batman-adv: move queue counters into bat_priv
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>
2010-09-05 00:29:44 -07:00
Sven Eckelmann 8bb22a38d6 Staging: batman-adv: Calculate hamming weight using optimized kernel functions
The Kernighan algorithm is not able to calculate the number of set bits
in parallel and the compiler cannot replace it with optimized
instructions.

The kernel provides specialised functions for each cpu which can either
use a software implementation or hardware instruction depending on the
target cpu.

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>
2010-09-05 00:29:43 -07:00
Simon Wunderlich 556c83ece8 Staging: batman-adv: Count Ethernet header for incoming packets
The Ethernet header is counted when transmitting a packet, so it should also
be counted when receiving a packet. With this patch, the rx_bytes and tx_bytes
statistics behave like an ordinary Ethernet interface.

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>
2010-09-05 00:29:43 -07:00
Sven Eckelmann b19ad29f55 Staging: batman-adv: Start new development cycle
Version 2010.1.0 of the extra kernel module was released and thus the
documentation should be updated and everything prepared for the the
upcoming patchset.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-05 00:29:42 -07:00
Sven Eckelmann cbbdd77152 Staging: batman-adv: Remove CHANGELOG
The changelog is only generated on standalone releases. Thus it has no
real value for the in-kernel version of batman-adv.

Reported-by: Abraham Arce <abraham.arce.moreno@gmail.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-05 00:29:42 -07:00