aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/translation-table.c
diff options
context:
space:
mode:
authorLinus Lüssing <linus.luessing@web.de>2014-02-15 11:47:50 -0500
committerAntonio Quartulli <antonio@meshcoding.com>2014-03-22 04:18:56 -0400
commite17931d1a61d189845d3ca923c5baf99e729156a (patch)
tree9022f779a494dddd661e2bdd64cc4b4c4cd5e070 /net/batman-adv/translation-table.c
parentc5caf4ef34e2779c9a90bf4cbb57fbdf57dc8cbc (diff)
batman-adv: introduce capability initialization bitfield
The new bitfield allows us to keep track whether capability subsets of an originator have gone through their initialization phase yet. The translation table is the only user right now, but a new one will be added soon. Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r--net/batman-adv/translation-table.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 4082d05a93a9..f641dfe302a4 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1774,7 +1774,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
1774 } 1774 }
1775 spin_unlock_bh(list_lock); 1775 spin_unlock_bh(list_lock);
1776 } 1776 }
1777 orig_node->tt_initialised = false; 1777 orig_node->capa_initialized &= ~BATADV_ORIG_CAPA_HAS_TT;
1778} 1778}
1779 1779
1780static bool batadv_tt_global_to_purge(struct batadv_tt_global_entry *tt_global, 1780static bool batadv_tt_global_to_purge(struct batadv_tt_global_entry *tt_global,
@@ -2734,7 +2734,7 @@ static void _batadv_tt_update_changes(struct batadv_priv *bat_priv,
2734 return; 2734 return;
2735 } 2735 }
2736 } 2736 }
2737 orig_node->tt_initialised = true; 2737 orig_node->capa_initialized |= BATADV_ORIG_CAPA_HAS_TT;
2738} 2738}
2739 2739
2740static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv, 2740static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv,
@@ -3224,13 +3224,15 @@ static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
3224 uint8_t orig_ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn); 3224 uint8_t orig_ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn);
3225 struct batadv_tvlv_tt_vlan_data *tt_vlan; 3225 struct batadv_tvlv_tt_vlan_data *tt_vlan;
3226 bool full_table = true; 3226 bool full_table = true;
3227 bool has_tt_init;
3227 3228
3228 tt_vlan = (struct batadv_tvlv_tt_vlan_data *)tt_buff; 3229 tt_vlan = (struct batadv_tvlv_tt_vlan_data *)tt_buff;
3230 has_tt_init = orig_node->capa_initialized & BATADV_ORIG_CAPA_HAS_TT;
3231
3229 /* orig table not initialised AND first diff is in the OGM OR the ttvn 3232 /* orig table not initialised AND first diff is in the OGM OR the ttvn
3230 * increased by one -> we can apply the attached changes 3233 * increased by one -> we can apply the attached changes
3231 */ 3234 */
3232 if ((!orig_node->tt_initialised && ttvn == 1) || 3235 if ((!has_tt_init && ttvn == 1) || ttvn - orig_ttvn == 1) {
3233 ttvn - orig_ttvn == 1) {
3234 /* the OGM could not contain the changes due to their size or 3236 /* the OGM could not contain the changes due to their size or
3235 * because they have already been sent BATADV_TT_OGM_APPEND_MAX 3237 * because they have already been sent BATADV_TT_OGM_APPEND_MAX
3236 * times. 3238 * times.
@@ -3270,7 +3272,7 @@ static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
3270 /* if we missed more than one change or our tables are not 3272 /* if we missed more than one change or our tables are not
3271 * in sync anymore -> request fresh tt data 3273 * in sync anymore -> request fresh tt data
3272 */ 3274 */
3273 if (!orig_node->tt_initialised || ttvn != orig_ttvn || 3275 if (!has_tt_init || ttvn != orig_ttvn ||
3274 !batadv_tt_global_check_crc(orig_node, tt_vlan, 3276 !batadv_tt_global_check_crc(orig_node, tt_vlan,
3275 tt_num_vlan)) { 3277 tt_num_vlan)) {
3276request_table: 3278request_table: