From patchwork Tue Jul 5 13:43:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1157 Return-Path: Received: from nm7.bullet.mail.ukl.yahoo.com (nm7.bullet.mail.ukl.yahoo.com [217.146.182.248]) by open-mesh.org (Postfix) with SMTP id 5319F1542E7 for ; Tue, 5 Jul 2011 15:44:20 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.184] by nm7.bullet.mail.ukl.yahoo.com with NNFMP; 05 Jul 2011 13:44:19 -0000 Received: from [77.238.184.68] by tm15.bullet.mail.ukl.yahoo.com with NNFMP; 05 Jul 2011 13:44:19 -0000 Received: from [127.0.0.1] by smtp137.mail.ukl.yahoo.com with NNFMP; 05 Jul 2011 13:44:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1309873459; bh=R/gvS4D87yoGa9B/Svrrjqdr/JoRkrzAS1j1Cna8OqE=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=AB/9qAmaEdbUsLaTHxCrVjicZNO+qtB9EK0ZgYIZCrboEhyJpW4KrMjizmcRfxY+LJLK1SM7FKBEJWZ3QK3aap0SKxctMlzHAQwDipKJOMfXojBQa0XbJ4IGobsewKOunMXpNxquc2KhfiX3kiqkK32z6QQ5N/gf0u1sLLAjPMU= X-Yahoo-Newman-Id: 465665.91015.bm@smtp137.mail.ukl.yahoo.com Received: from localhost (lindner_marek@90.35.97.9 with plain) by smtp137.mail.ukl.yahoo.com with SMTP; 05 Jul 2011 13:44:18 +0000 GMT X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- X-YMail-OSG: J7aW5.EVM1nDTkaGhml3J3YbEjIkk8LFUmbBb1QJQsiPhKz gIAkCUZojyBOGqK5K800XQoWT7m8YEprIWafUGaxTb_Ocqd7rqldyh2Kj7sP VZ.bm6iGBSnZFZXgMZp8YPt5toQRPw7IkwX.r68IiQBUaos.s0FVv5T6OEsA 9I3iClXSOQmy5jBdqvr0fYv37p45nk26RO4_5oGcPoE8nM.Gqjl_Ms5kzPfR cXMLllNEZIJdgH38KjV3iGR2vh553sGwcEhavrlXYPzXoEEPDFimlCly2NcQ tvNlbIRyxHNT1k2XygULnFCH3EXdIKVuS9BXJQKXZtBfpupZCiIP5WZwyZeq t X-Yahoo-Newman-Property: ymail-3 From: Marek Lindner To: davem@davemloft.net Date: Tue, 5 Jul 2011 15:43:57 +0200 Message-Id: <1309873440-11704-4-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.3 In-Reply-To: <1309873440-11704-1-git-send-email-lindner_marek@yahoo.de> References: <1309873440-11704-1-git-send-email-lindner_marek@yahoo.de> Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 3/6] batman-adv: pass a unique flag arg instead of a sequence of bool ones X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2011 13:44:20 -0000 From: Antonio Quartulli now tt_local_event() takes a flags argument instead of a sequence of boolean values which would grow up with the time. Signed-off-by: Antonio Quartulli Signed-off-by: Marek Lindner --- net/batman-adv/translation-table.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 4208dc7..06d361d 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -143,8 +143,8 @@ static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry) kfree_rcu(tt_global_entry, rcu); } -static void tt_local_event(struct bat_priv *bat_priv, uint8_t op, - const uint8_t *addr, bool roaming) +static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr, + uint8_t flags) { struct tt_change_node *tt_change_node; @@ -153,10 +153,7 @@ static void tt_local_event(struct bat_priv *bat_priv, uint8_t op, if (!tt_change_node) return; - tt_change_node->change.flags = op; - if (roaming) - tt_change_node->change.flags |= TT_CLIENT_ROAM; - + tt_change_node->change.flags = flags; memcpy(tt_change_node->change.addr, addr, ETH_ALEN); spin_lock_bh(&bat_priv->tt_changes_list_lock); @@ -203,8 +200,6 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) if (!tt_local_entry) goto out; - tt_local_event(bat_priv, NO_FLAGS, addr, false); - bat_dbg(DBG_TT, bat_priv, "Creating new local tt entry: %pM (ttvn: %d)\n", addr, (uint8_t)atomic_read(&bat_priv->ttvn)); @@ -218,6 +213,8 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) if (compare_eth(addr, soft_iface->dev_addr)) tt_local_entry->flags |= TT_CLIENT_NOPURGE; + tt_local_event(bat_priv, addr, tt_local_entry->flags); + hash_add(bat_priv->tt_local_hash, compare_ltt, choose_orig, tt_local_entry, &tt_local_entry->hash_entry); @@ -386,7 +383,9 @@ void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, if (!tt_local_entry) goto out; - tt_local_event(bat_priv, TT_CLIENT_DEL, tt_local_entry->addr, roaming); + tt_local_event(bat_priv, tt_local_entry->addr, + tt_local_entry->flags | TT_CLIENT_DEL | + (roaming ? TT_CLIENT_ROAM : NO_FLAGS)); tt_local_del(bat_priv, tt_local_entry, message); out: if (tt_local_entry) @@ -416,8 +415,8 @@ static void tt_local_purge(struct bat_priv *bat_priv) TT_LOCAL_TIMEOUT * 1000)) continue; - tt_local_event(bat_priv, TT_CLIENT_DEL, - tt_local_entry->addr, false); + tt_local_event(bat_priv, tt_local_entry->addr, + tt_local_entry->flags | TT_CLIENT_DEL); atomic_dec(&bat_priv->num_local_tt); bat_dbg(DBG_TT, bat_priv, "Deleting local " "tt entry (%pM): timed out\n",