summaryrefslogtreecommitdiff
path: root/drivers/staging/batman-adv/routing.c
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2010-11-21 23:56:02 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2010-11-29 19:09:13 (GMT)
commitdfaf9dd3459cac02411cebf418e8469aa0d8ca5d (patch)
tree1c71c3ed4de7bb097b1f1be375eaf980dd5ee958 /drivers/staging/batman-adv/routing.c
parent7a18deb7b03e4112af5add8498889f9b2b36d59f (diff)
downloadlinux-fsl-qoriq-dfaf9dd3459cac02411cebf418e8469aa0d8ca5d.tar.xz
Staging: batman-adv: adding gateway functionality
Via the /sys filesystem you can change the gateway mode of a node using gw_mode. Adjustments to it can be done using gw_bandwidth for server mode and gw_sel_class for client mode. 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>
Diffstat (limited to 'drivers/staging/batman-adv/routing.c')
-rw-r--r--drivers/staging/batman-adv/routing.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c
index 1536963..9f31167 100644
--- a/drivers/staging/batman-adv/routing.c
+++ b/drivers/staging/batman-adv/routing.c
@@ -32,6 +32,8 @@
#include "ring_buffer.h"
#include "vis.h"
#include "aggregation.h"
+#include "gateway_common.h"
+#include "gateway_client.h"
#include "unicast.h"
void slide_own_bcast_window(struct batman_if *batman_if)
@@ -316,11 +318,23 @@ static void update_orig(struct bat_priv *bat_priv,
update_routes(bat_priv, orig_node, neigh_node,
hna_buff, tmp_hna_buff_len);
- return;
+ goto update_gw;
update_hna:
update_routes(bat_priv, orig_node, orig_node->router,
hna_buff, tmp_hna_buff_len);
+
+update_gw:
+ if (orig_node->gw_flags != batman_packet->gw_flags)
+ gw_node_update(bat_priv, orig_node, batman_packet->gw_flags);
+
+ orig_node->gw_flags = batman_packet->gw_flags;
+
+ /* restart gateway selection if fast or late switching was enabled */
+ if ((orig_node->gw_flags) &&
+ (atomic_read(&bat_priv->gw_mode) == GW_MODE_CLIENT) &&
+ (atomic_read(&bat_priv->gw_sel_class) > 2))
+ gw_check_election(bat_priv, orig_node);
}
/* checks whether the host restarted and is in the protection time.