From patchwork Tue Dec 7 20:19:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 655 Return-Path: Received: from fmmailgate01.web.de (fmmailgate01.web.de [217.72.192.221]) by open-mesh.org (Postfix) with ESMTP id 97C9C15462D for ; Tue, 7 Dec 2010 21:21:08 +0100 (CET) Received: from smtp03.web.de ( [172.20.0.65]) by fmmailgate01.web.de (Postfix) with ESMTP id 1CB75180E0435; Tue, 7 Dec 2010 21:19:33 +0100 (CET) Received: from [46.126.246.98] (helo=localhost) by smtp03.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.110 #4) id 1PQ40V-0007zH-00; Tue, 07 Dec 2010 21:19:27 +0100 From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 7 Dec 2010 21:19:33 +0100 Message-Id: <1291753173-29456-2-git-send-email-linus.luessing@ascom.ch> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1291732778-27441-11-git-send-email-linus.luessing@ascom.ch> References: <1291732778-27441-11-git-send-email-linus.luessing@ascom.ch> Sender: linus.luessing@web.de X-Sender: linus.luessing@web.de X-Provags-ID: V01U2FsdGVkX187nKf9cQ5MtZeGewZrP3MS2MgpI6v0HcL6iBe4 JACz+Vv8LyRgN/j680vdFD3XNpEPIwBrwz3sOVrc2sXCyJ1iZM y1/fPlAR5wQboy6aMILQ== Cc: =?UTF-8?q?Linus=20L=C3=BCssing?= Subject: [B.A.T.M.A.N.] [PATCHv2 10/10] batman-adv: Use local tq values determined by NDP on OGMs X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 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, 07 Dec 2010 20:21:08 -0000 With this commit not the local transmit quality values determined by the OGMs themselves are applied on received OGMs, but the local transmit quality detemined by NDP instead. Usually the link quality measurements of NDP are more up-to-date than the one of the OGMs, as NDP is using a more frequent interval because NDP's packets are not being flooded through the whole mesh. --- routing.c | 55 ++++++++++++++++++++++++------------------------------- 1 files changed, 24 insertions(+), 31 deletions(-) diff --git a/routing.c b/routing.c index 1972bb8..d33680d 100644 --- a/routing.c +++ b/routing.c @@ -136,7 +136,7 @@ static int is_bidirectional_neigh(struct orig_node *orig_node, { struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface); struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; - unsigned char total_count; + uint8_t local_tq = 0, local_rq = 0; if (orig_node == orig_neigh_node) { list_for_each_entry(tmp_neigh_node, @@ -180,25 +180,20 @@ static int is_bidirectional_neigh(struct orig_node *orig_node, return 0; } - orig_node->last_valid = jiffies; + spin_lock_bh(&if_incoming->neigh_list_lock); + list_for_each_entry(neigh_node, &if_incoming->neigh_list, list) { + if (!compare_orig(neigh_node->addr, orig_neigh_node->orig)) + continue; - /* pay attention to not get a value bigger than 100 % */ - total_count = (orig_neigh_node->bcast_own_sum[if_incoming->if_num] > - neigh_node->real_packet_count ? - neigh_node->real_packet_count : - orig_neigh_node->bcast_own_sum[if_incoming->if_num]); + orig_node->last_valid = jiffies; + local_tq = neigh_node->tq_avg; + local_rq = neigh_node->rq; + break; + } + spin_unlock_bh(&if_incoming->neigh_list_lock); - /* if we have too few packets (too less data) we set tq_own to zero */ - /* if we receive too few packets it is not considered bidirectional */ - if ((total_count < TQ_LOCAL_BIDRECT_SEND_MINIMUM) || - (neigh_node->real_packet_count < TQ_LOCAL_BIDRECT_RECV_MINIMUM)) - orig_neigh_node->tq_own = 0; - else - /* neigh_node->real_packet_count is never zero as we - * only purge old information when getting new - * information */ - orig_neigh_node->tq_own = (TQ_MAX_VALUE * total_count) / - neigh_node->real_packet_count; + if (local_tq == 0) + return 0; /* * 1 - ((1-x) ** 3), normalized to TQ_MAX_VALUE this does @@ -209,25 +204,23 @@ static int is_bidirectional_neigh(struct orig_node *orig_node, orig_neigh_node->tq_asym_penalty = TQ_MAX_VALUE - (TQ_MAX_VALUE * - (TQ_LOCAL_WINDOW_SIZE - neigh_node->real_packet_count) * - (TQ_LOCAL_WINDOW_SIZE - neigh_node->real_packet_count) * - (TQ_LOCAL_WINDOW_SIZE - neigh_node->real_packet_count)) / - (TQ_LOCAL_WINDOW_SIZE * - TQ_LOCAL_WINDOW_SIZE * - TQ_LOCAL_WINDOW_SIZE); + (TQ_MAX_VALUE - local_rq) * + (TQ_MAX_VALUE - local_rq) * + (TQ_MAX_VALUE - local_rq)) / + (TQ_MAX_VALUE * + TQ_MAX_VALUE * + TQ_MAX_VALUE); batman_packet_ogm->tq = ((batman_packet_ogm->tq * - orig_neigh_node->tq_own * + local_tq * orig_neigh_node->tq_asym_penalty) / - (TQ_MAX_VALUE * TQ_MAX_VALUE)); + (TQ_MAX_VALUE * TQ_MAX_VALUE)); bat_dbg(DBG_BATMAN, bat_priv, "bidirectional: " - "orig = %-15pM neigh = %-15pM => own_bcast = %2i, " - "real recv = %2i, local tq: %3i, asym_penalty: %3i, " - "total tq: %3i\n", - orig_node->orig, orig_neigh_node->orig, total_count, - neigh_node->real_packet_count, orig_neigh_node->tq_own, + "orig = %-15pM neigh = %-15pM => local tq = %3i, " + "local rq: %3i, asym_penalty: %3i, total tq: %3i\n", + orig_node->orig, orig_neigh_node->orig, local_tq, local_rq, orig_neigh_node->tq_asym_penalty, batman_packet_ogm->tq); /* if link has the minimum required transmission quality