public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven.eckelmann@openmesh.com>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sven Eckelmann <sven.eckelmann@openmesh.com>
Subject: [B.A.T.M.A.N.] [PATCH 2/5] alfred: Only query tq of remote master in slave mode
Date: Wed, 24 May 2017 12:32:08 +0200	[thread overview]
Message-ID: <20170524103211.810-2-sven.eckelmann@openmesh.com> (raw)
In-Reply-To: <4690435.IOLn72U8Ez@bentobox>

The querying of the originator mac address and tq values of the orignator
address takes significant amount of time. It is therefore better to avoid
the TQ retrieval code when possible.

The TQ will not be used in master mode and it can therefore be skipped
together with the code which tries to find the new best server.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
---
 recv.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/recv.c b/recv.c
index 3fd964d..8aa512d 100644
--- a/recv.c
+++ b/recv.c
@@ -304,6 +304,13 @@ process_alfred_announce_master(struct globals *globals,
 	}
 
 	clock_gettime(CLOCK_MONOTONIC, &server->last_seen);
+
+	/* TQ is not used for master sync mode */
+	if (globals->opmode == OPMODE_MASTER) {
+		server->tq = 0;
+		return 0;
+	}
+
 	if (strcmp(globals->mesh_iface, "none") != 0) {
 		macaddr = translate_mac(globals->mesh_iface,
 					(struct ether_addr *)&server->hwaddr);
@@ -315,8 +322,7 @@ process_alfred_announce_master(struct globals *globals,
 		server->tq = 255;
 	}
 
-	if (globals->opmode == OPMODE_SLAVE)
-		set_best_server(globals);
+	set_best_server(globals);
 
 	return 0;
 }
-- 
2.11.0


  parent reply	other threads:[~2017-05-24 10:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 10:31 [B.A.T.M.A.N.] [PATCH 0/5] alfred: TQ query optimizations Sven Eckelmann
2017-05-24 10:32 ` [B.A.T.M.A.N.] [PATCH 1/5] alfred: Move alfred specific netlink code in separate file Sven Eckelmann
2017-05-24 10:32 ` Sven Eckelmann [this message]
2017-05-24 10:32 ` [B.A.T.M.A.N.] [PATCH 3/5] alfred: Check the TQ of master servers before pushing data Sven Eckelmann
2017-05-24 10:32 ` [B.A.T.M.A.N.] [PATCH 4/5] alfred: Cache the TQ values for each originator Sven Eckelmann
2017-05-24 10:32 ` [B.A.T.M.A.N.] [PATCH 5/5] alfred: Cache the global translation table entries Sven Eckelmann
2017-05-31 15:24 ` [B.A.T.M.A.N.] [PATCH 0/5] alfred: TQ query optimizations Simon Wunderlich
2017-06-01  6:15   ` Sven Eckelmann

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=20170524103211.810-2-sven.eckelmann@openmesh.com \
    --to=sven.eckelmann@openmesh.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.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