aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c9
-rw-r--r--net/batman-adv/main.h1
-rw-r--r--net/batman-adv/types.h1
3 files changed, 10 insertions, 1 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 8cd97d59ee61..bda8b1710806 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -378,6 +378,7 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig,
378 entry->crc = BATADV_BLA_CRC_INIT; 378 entry->crc = BATADV_BLA_CRC_INIT;
379 entry->bat_priv = bat_priv; 379 entry->bat_priv = bat_priv;
380 atomic_set(&entry->request_sent, 0); 380 atomic_set(&entry->request_sent, 0);
381 atomic_set(&entry->wait_periods, 0);
381 memcpy(entry->orig, orig, ETH_ALEN); 382 memcpy(entry->orig, orig, ETH_ALEN);
382 383
383 /* one for the hash, one for returning */ 384 /* one for the hash, one for returning */
@@ -407,6 +408,7 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig,
407 408
408 /* this will be decreased in the worker thread */ 409 /* this will be decreased in the worker thread */
409 atomic_inc(&entry->request_sent); 410 atomic_inc(&entry->request_sent);
411 atomic_set(&entry->wait_periods, BATADV_BLA_WAIT_PERIODS);
410 atomic_inc(&bat_priv->bla.num_requests); 412 atomic_inc(&bat_priv->bla.num_requests);
411 } 413 }
412 414
@@ -1148,12 +1150,17 @@ static void batadv_bla_periodic_work(struct work_struct *work)
1148 * problems when we are not yet known as backbone gw 1150 * problems when we are not yet known as backbone gw
1149 * in the backbone. 1151 * in the backbone.
1150 * 1152 *
1151 * We can reset this now and allow traffic again. 1153 * We can reset this now after we waited some periods
1154 * to give bridge forward delays and bla group forming
1155 * some grace time.
1152 */ 1156 */
1153 1157
1154 if (atomic_read(&backbone_gw->request_sent) == 0) 1158 if (atomic_read(&backbone_gw->request_sent) == 0)
1155 continue; 1159 continue;
1156 1160
1161 if (!atomic_dec_and_test(&backbone_gw->wait_periods))
1162 continue;
1163
1157 atomic_dec(&backbone_gw->bat_priv->bla.num_requests); 1164 atomic_dec(&backbone_gw->bat_priv->bla.num_requests);
1158 atomic_set(&backbone_gw->request_sent, 0); 1165 atomic_set(&backbone_gw->request_sent, 0);
1159 } 1166 }
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 240c74ffeb93..8f149bb66817 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -95,6 +95,7 @@
95#define BATADV_BLA_PERIOD_LENGTH 10000 /* 10 seconds */ 95#define BATADV_BLA_PERIOD_LENGTH 10000 /* 10 seconds */
96#define BATADV_BLA_BACKBONE_TIMEOUT (BATADV_BLA_PERIOD_LENGTH * 3) 96#define BATADV_BLA_BACKBONE_TIMEOUT (BATADV_BLA_PERIOD_LENGTH * 3)
97#define BATADV_BLA_CLAIM_TIMEOUT (BATADV_BLA_PERIOD_LENGTH * 10) 97#define BATADV_BLA_CLAIM_TIMEOUT (BATADV_BLA_PERIOD_LENGTH * 10)
98#define BATADV_BLA_WAIT_PERIODS 3
98 99
99#define BATADV_DUPLIST_SIZE 16 100#define BATADV_DUPLIST_SIZE 16
100#define BATADV_DUPLIST_TIMEOUT 500 /* 500 ms */ 101#define BATADV_DUPLIST_TIMEOUT 500 /* 500 ms */
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index e8a1b18ae546..fa09961652a1 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -369,6 +369,7 @@ struct batadv_backbone_gw {
369 struct hlist_node hash_entry; 369 struct hlist_node hash_entry;
370 struct batadv_priv *bat_priv; 370 struct batadv_priv *bat_priv;
371 unsigned long lasttime; /* last time we heard of this backbone gw */ 371 unsigned long lasttime; /* last time we heard of this backbone gw */
372 atomic_t wait_periods;
372 atomic_t request_sent; 373 atomic_t request_sent;
373 atomic_t refcount; 374 atomic_t refcount;
374 struct rcu_head rcu; 375 struct rcu_head rcu;