summaryrefslogtreecommitdiffstats
path: root/drivers/staging/batman-adv/soft-interface.c
diff options
context:
space:
mode:
authorSimon Wunderlich <siwu@hrz.tu-chemnitz.de>2010-06-22 01:25:52 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-06-22 14:05:06 -0700
commite35fd5ecde2ef0b247a607bc82c4b8f1de06d53b (patch)
tree8d0aeffb5593c92e4039717c9deeeb9590712773 /drivers/staging/batman-adv/soft-interface.c
parentcf2d72ec5c66ac3ebe9d28c3d88314a958cc180e (diff)
downloadop-kernel-dev-e35fd5ecde2ef0b247a607bc82c4b8f1de06d53b.zip
op-kernel-dev-e35fd5ecde2ef0b247a607bc82c4b8f1de06d53b.tar.gz
Staging: batman-adv: Add bonding functionality
This patch introduces bonding functionality to batman-advanced, targeted for the 0.3 release. As we are able to route the payload traffic as we want, we may use multiple interfaces on multihomed hosts to transfer data to achieve higher bandwidth. This can be considered as "light Multi Path Routing" for single hop connections. To detect which interfaces of a peer node belong to the same host, a new flag PRIMARIES_FIRST_HOP is introduced. This flag is set on the first hop of OGMs of the primary (first) interface, which is broadcasted on all interfaces. When receiving such an OGM, we can learn which interfaces belong to the same host (by assigning them to the primary originator). Bonding works by sending packets in a round-robin fashion to the available interfaces of a neighbor host, if multiple interfaces are available. The neighbor interfaces should be almost equally good to reach. To avoid interferences (i.e. sending on the same channel), only neighbor interfaces with different mac addresses and different outgoing interfaces are considered as candidates. Bonding is deactivated by default, and can be activated by echo 1 > /sys/class/net/bat0/mesh/bonding for each individual node. 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>
Diffstat (limited to 'drivers/staging/batman-adv/soft-interface.c')
-rw-r--r--drivers/staging/batman-adv/soft-interface.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c
index ce789a7..37fd565 100644
--- a/drivers/staging/batman-adv/soft-interface.c
+++ b/drivers/staging/batman-adv/soft-interface.c
@@ -22,6 +22,7 @@
#include "main.h"
#include "soft-interface.h"
#include "hard-interface.h"
+#include "routing.h"
#include "send.h"
#include "translation-table.h"
#include "types.h"
@@ -129,6 +130,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev)
struct unicast_packet *unicast_packet;
struct bcast_packet *bcast_packet;
struct orig_node *orig_node;
+ struct neigh_node *router;
struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
struct bat_priv *priv = netdev_priv(dev);
struct batman_if *batman_if;
@@ -186,38 +188,36 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev)
if (!orig_node)
orig_node = transtable_search(ethhdr->h_dest);
- if ((orig_node) &&
- (orig_node->router)) {
- struct neigh_node *router = orig_node->router;
+ router = find_router(orig_node);
- if (my_skb_push(skb, sizeof(struct unicast_packet)) < 0)
- goto unlock;
+ if (!router)
+ goto unlock;
+
+ /* don't lock while sending the packets ... we therefore
+ * copy the required data before sending */
+
+ batman_if = router->if_incoming;
+ memcpy(dstaddr, router->addr, ETH_ALEN);
- unicast_packet = (struct unicast_packet *)skb->data;
+ spin_unlock_irqrestore(&orig_hash_lock, flags);
- unicast_packet->version = COMPAT_VERSION;
- /* batman packet type: unicast */
- unicast_packet->packet_type = BAT_UNICAST;
- /* set unicast ttl */
- unicast_packet->ttl = TTL;
- /* copy the destination for faster routing */
- memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN);
+ if (batman_if->if_status != IF_ACTIVE)
+ goto dropped;
- /* net_dev won't be available when not active */
- if (router->if_incoming->if_status != IF_ACTIVE)
- goto unlock;
+ if (my_skb_push(skb, sizeof(struct unicast_packet)) < 0)
+ goto dropped;
- /* don't lock while sending the packets ... we therefore
- * copy the required data before sending */
+ unicast_packet = (struct unicast_packet *)skb->data;
- batman_if = router->if_incoming;
- memcpy(dstaddr, router->addr, ETH_ALEN);
- spin_unlock_irqrestore(&orig_hash_lock, flags);
+ unicast_packet->version = COMPAT_VERSION;
+ /* batman packet type: unicast */
+ unicast_packet->packet_type = BAT_UNICAST;
+ /* set unicast ttl */
+ unicast_packet->ttl = TTL;
+ /* copy the destination for faster routing */
+ memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN);
- send_skb_packet(skb, batman_if, dstaddr);
- } else {
- goto unlock;
- }
+ send_skb_packet(skb, batman_if, dstaddr);
}
priv->stats.tx_packets++;
OpenPOWER on IntegriCloud