aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/originator.c1
-rw-r--r--net/batman-adv/translation-table.c12
-rw-r--r--net/batman-adv/types.h7
3 files changed, 11 insertions, 9 deletions
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 9f2da37d0210..24a9300b08e0 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -664,7 +664,6 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
664 /* extra reference for return */ 664 /* extra reference for return */
665 atomic_set(&orig_node->refcount, 2); 665 atomic_set(&orig_node->refcount, 2);
666 666
667 orig_node->tt_initialised = false;
668 orig_node->bat_priv = bat_priv; 667 orig_node->bat_priv = bat_priv;
669 ether_addr_copy(orig_node->orig, addr); 668 ether_addr_copy(orig_node->orig, addr);
670 batadv_dat_init_orig_node_addr(orig_node); 669 batadv_dat_init_orig_node_addr(orig_node);
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:
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index d553264135d3..b46117ca5989 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -205,13 +205,12 @@ struct batadv_orig_bat_iv {
205 * @last_seen: time when last packet from this node was received 205 * @last_seen: time when last packet from this node was received
206 * @bcast_seqno_reset: time when the broadcast seqno window was reset 206 * @bcast_seqno_reset: time when the broadcast seqno window was reset
207 * @capabilities: announced capabilities of this originator 207 * @capabilities: announced capabilities of this originator
208 * @capa_initialized: bitfield to remember whether a capability was initialized
208 * @last_ttvn: last seen translation table version number 209 * @last_ttvn: last seen translation table version number
209 * @tt_buff: last tt changeset this node received from the orig node 210 * @tt_buff: last tt changeset this node received from the orig node
210 * @tt_buff_len: length of the last tt changeset this node received from the 211 * @tt_buff_len: length of the last tt changeset this node received from the
211 * orig node 212 * orig node
212 * @tt_buff_lock: lock that protects tt_buff and tt_buff_len 213 * @tt_buff_lock: lock that protects tt_buff and tt_buff_len
213 * @tt_initialised: bool keeping track of whether or not this node have received
214 * any translation table information from the orig node yet
215 * @tt_lock: prevents from updating the table while reading it. Table update is 214 * @tt_lock: prevents from updating the table while reading it. Table update is
216 * made up by two operations (data structure update and metdata -CRC/TTVN- 215 * made up by two operations (data structure update and metdata -CRC/TTVN-
217 * recalculation) and they have to be executed atomically in order to avoid 216 * recalculation) and they have to be executed atomically in order to avoid
@@ -248,11 +247,11 @@ struct batadv_orig_node {
248 unsigned long last_seen; 247 unsigned long last_seen;
249 unsigned long bcast_seqno_reset; 248 unsigned long bcast_seqno_reset;
250 uint8_t capabilities; 249 uint8_t capabilities;
250 uint8_t capa_initialized;
251 atomic_t last_ttvn; 251 atomic_t last_ttvn;
252 unsigned char *tt_buff; 252 unsigned char *tt_buff;
253 int16_t tt_buff_len; 253 int16_t tt_buff_len;
254 spinlock_t tt_buff_lock; /* protects tt_buff & tt_buff_len */ 254 spinlock_t tt_buff_lock; /* protects tt_buff & tt_buff_len */
255 bool tt_initialised;
256 /* prevents from changing the table while reading it */ 255 /* prevents from changing the table while reading it */
257 spinlock_t tt_lock; 256 spinlock_t tt_lock;
258 DECLARE_BITMAP(bcast_bits, BATADV_TQ_LOCAL_WINDOW_SIZE); 257 DECLARE_BITMAP(bcast_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
@@ -282,10 +281,12 @@ struct batadv_orig_node {
282 * enum batadv_orig_capabilities - orig node capabilities 281 * enum batadv_orig_capabilities - orig node capabilities
283 * @BATADV_ORIG_CAPA_HAS_DAT: orig node has distributed arp table enabled 282 * @BATADV_ORIG_CAPA_HAS_DAT: orig node has distributed arp table enabled
284 * @BATADV_ORIG_CAPA_HAS_NC: orig node has network coding enabled 283 * @BATADV_ORIG_CAPA_HAS_NC: orig node has network coding enabled
284 * @BATADV_ORIG_CAPA_HAS_TT: orig node has tt capability
285 */ 285 */
286enum batadv_orig_capabilities { 286enum batadv_orig_capabilities {
287 BATADV_ORIG_CAPA_HAS_DAT = BIT(0), 287 BATADV_ORIG_CAPA_HAS_DAT = BIT(0),
288 BATADV_ORIG_CAPA_HAS_NC = BIT(1), 288 BATADV_ORIG_CAPA_HAS_NC = BIT(1),
289 BATADV_ORIG_CAPA_HAS_TT = BIT(2),
289}; 290};
290 291
291/** 292/**