From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
"Linus Lüssing" <linus.luessing@web.de>,
"Marek Lindner" <mareklindner@neomailbox.ch>,
"Antonio Quartulli" <antonio@meshcoding.com>
Subject: [PATCH 09/16] batman-adv: introduce capability initialization bitfield
Date: Sat, 22 Mar 2014 09:56:09 +0100 [thread overview]
Message-ID: <1395478576-10999-10-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1395478576-10999-1-git-send-email-antonio@meshcoding.com>
From: Linus Lüssing <linus.luessing@web.de>
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>
---
net/batman-adv/originator.c | 1 -
net/batman-adv/translation-table.c | 12 +++++++-----
net/batman-adv/types.h | 7 ++++---
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 9f2da37..24a9300 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,
/* extra reference for return */
atomic_set(&orig_node->refcount, 2);
- orig_node->tt_initialised = false;
orig_node->bat_priv = bat_priv;
ether_addr_copy(orig_node->orig, addr);
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 4082d05..f641dfe 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,
}
spin_unlock_bh(list_lock);
}
- orig_node->tt_initialised = false;
+ orig_node->capa_initialized &= ~BATADV_ORIG_CAPA_HAS_TT;
}
static 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,
return;
}
}
- orig_node->tt_initialised = true;
+ orig_node->capa_initialized |= BATADV_ORIG_CAPA_HAS_TT;
}
static 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,
uint8_t orig_ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn);
struct batadv_tvlv_tt_vlan_data *tt_vlan;
bool full_table = true;
+ bool has_tt_init;
tt_vlan = (struct batadv_tvlv_tt_vlan_data *)tt_buff;
+ has_tt_init = orig_node->capa_initialized & BATADV_ORIG_CAPA_HAS_TT;
+
/* orig table not initialised AND first diff is in the OGM OR the ttvn
* increased by one -> we can apply the attached changes
*/
- if ((!orig_node->tt_initialised && ttvn == 1) ||
- ttvn - orig_ttvn == 1) {
+ if ((!has_tt_init && ttvn == 1) || ttvn - orig_ttvn == 1) {
/* the OGM could not contain the changes due to their size or
* because they have already been sent BATADV_TT_OGM_APPEND_MAX
* times.
@@ -3270,7 +3272,7 @@ static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
/* if we missed more than one change or our tables are not
* in sync anymore -> request fresh tt data
*/
- if (!orig_node->tt_initialised || ttvn != orig_ttvn ||
+ if (!has_tt_init || ttvn != orig_ttvn ||
!batadv_tt_global_check_crc(orig_node, tt_vlan,
tt_num_vlan)) {
request_table:
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index d553264..b46117c 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -205,13 +205,12 @@ struct batadv_orig_bat_iv {
* @last_seen: time when last packet from this node was received
* @bcast_seqno_reset: time when the broadcast seqno window was reset
* @capabilities: announced capabilities of this originator
+ * @capa_initialized: bitfield to remember whether a capability was initialized
* @last_ttvn: last seen translation table version number
* @tt_buff: last tt changeset this node received from the orig node
* @tt_buff_len: length of the last tt changeset this node received from the
* orig node
* @tt_buff_lock: lock that protects tt_buff and tt_buff_len
- * @tt_initialised: bool keeping track of whether or not this node have received
- * any translation table information from the orig node yet
* @tt_lock: prevents from updating the table while reading it. Table update is
* made up by two operations (data structure update and metdata -CRC/TTVN-
* recalculation) and they have to be executed atomically in order to avoid
@@ -248,11 +247,11 @@ struct batadv_orig_node {
unsigned long last_seen;
unsigned long bcast_seqno_reset;
uint8_t capabilities;
+ uint8_t capa_initialized;
atomic_t last_ttvn;
unsigned char *tt_buff;
int16_t tt_buff_len;
spinlock_t tt_buff_lock; /* protects tt_buff & tt_buff_len */
- bool tt_initialised;
/* prevents from changing the table while reading it */
spinlock_t tt_lock;
DECLARE_BITMAP(bcast_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
@@ -282,10 +281,12 @@ struct batadv_orig_node {
* enum batadv_orig_capabilities - orig node capabilities
* @BATADV_ORIG_CAPA_HAS_DAT: orig node has distributed arp table enabled
* @BATADV_ORIG_CAPA_HAS_NC: orig node has network coding enabled
+ * @BATADV_ORIG_CAPA_HAS_TT: orig node has tt capability
*/
enum batadv_orig_capabilities {
BATADV_ORIG_CAPA_HAS_DAT = BIT(0),
BATADV_ORIG_CAPA_HAS_NC = BIT(1),
+ BATADV_ORIG_CAPA_HAS_TT = BIT(2),
};
/**
--
1.8.3.2
next prev parent reply other threads:[~2014-03-22 8:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-22 8:56 pull request: batman-adv 20140322 Antonio Quartulli
2014-03-22 8:56 ` [PATCH 01/16] batman-adv: fix coccinelle warnings Antonio Quartulli
2014-03-22 8:56 ` [PATCH 02/16] batman-adv: use vlan_/eth_hdr() instead of skb->data in interface_tx path Antonio Quartulli
2014-03-22 8:56 ` [PATCH 03/16] batman-adv: remove obsolete skb_reset_mac_header() in batadv_bla_tx() Antonio Quartulli
2014-03-22 8:56 ` [PATCH 04/16] batman-adv: prefer ether_addr_copy to memcpy Antonio Quartulli
2014-03-22 8:56 ` [PATCH 05/16] batman-adv: fix a few kerneldoc inconsistencies Antonio Quartulli
2014-03-22 8:56 ` [PATCH 06/16] batman-adv: call unregister_netdev() to have it handle the locking for us Antonio Quartulli
2014-03-22 8:56 ` [PATCH 07/16] batman-adv: add kerneldoc for dst_hint argument Antonio Quartulli
2014-03-22 8:56 ` [PATCH 08/16] batman-adv: Multicast Listener Announcements via Translation Table Antonio Quartulli
2014-03-22 8:56 ` Antonio Quartulli [this message]
2014-03-22 8:56 ` [PATCH 10/16] batman-adv: Announce new capability via multicast TVLV Antonio Quartulli
2014-03-22 8:56 ` [PATCH 11/16] batman-adv: Modified forwarding behaviour for multicast packets Antonio Quartulli
2014-03-22 8:56 ` [PATCH 12/16] batman-adv: Add IPv4 link-local/IPv6-ll-all-nodes multicast support Antonio Quartulli
2014-03-22 8:56 ` [PATCH 13/16] batman-adv: Send multicast packets to nodes with a WANT_ALL flag Antonio Quartulli
2014-03-22 8:56 ` [PATCH 14/16] batman-adv: improve the TT flags documentation Antonio Quartulli
2014-03-22 8:56 ` [PATCH 15/16] batman-adv: improve DAT documentation Antonio Quartulli
2014-03-22 8:56 ` [PATCH 16/16] batman-adv: Start new development cycle Antonio Quartulli
2014-03-22 19:00 ` pull request: batman-adv 20140322 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395478576-10999-10-git-send-email-antonio@meshcoding.com \
--to=antonio@meshcoding.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=linus.luessing@web.de \
--cc=mareklindner@neomailbox.ch \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).