public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: reduce local TT entry timeout to 10 minutes
@ 2012-11-08 21:16 Antonio Quartulli
  2012-11-08 21:16 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: improve local translation table output Antonio Quartulli
  2012-11-13 10:33 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: reduce local TT entry timeout to 10 minutes Marek Lindner
  0 siblings, 2 replies; 4+ messages in thread
From: Antonio Quartulli @ 2012-11-08 21:16 UTC (permalink / raw)
  To: b.a.t.m.a.n

The current timeout is set to one hour. However a client connected to the mesh
network will always generate traffic. In the worst case it will send ARP
requests every 4 or 5 minutes. On the other hand having a long timeout means
storing dead entries for one hour leads to very big trans-tables containing
useless clients.

This patch reduces the timeout to 10 minutes

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main.h b/main.h
index ec9c5ad..a8138be 100644
--- a/main.h
+++ b/main.h
@@ -41,7 +41,7 @@
  * -> TODO: check influence on BATADV_TQ_LOCAL_WINDOW_SIZE
  */
 #define BATADV_PURGE_TIMEOUT 200000 /* 200 seconds */
-#define BATADV_TT_LOCAL_TIMEOUT 3600000 /* in milliseconds */
+#define BATADV_TT_LOCAL_TIMEOUT 600000 /* in milliseconds */
 #define BATADV_TT_CLIENT_ROAM_TIMEOUT 600000 /* in milliseconds */
 #define BATADV_TT_CLIENT_TEMP_TIMEOUT 600000 /* in milliseconds */
 #define BATADV_DAT_ENTRY_TIMEOUT (5*60000) /* 5 mins in milliseconds */
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: improve local translation table output
  2012-11-08 21:16 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: reduce local TT entry timeout to 10 minutes Antonio Quartulli
@ 2012-11-08 21:16 ` Antonio Quartulli
  2012-11-13 10:42   ` Marek Lindner
  2012-11-13 10:33 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: reduce local TT entry timeout to 10 minutes Marek Lindner
  1 sibling, 1 reply; 4+ messages in thread
From: Antonio Quartulli @ 2012-11-08 21:16 UTC (permalink / raw)
  To: b.a.t.m.a.n

This patch adds a nice header to the local translation table and
the last_seen time for each local entry

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 translation-table.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/translation-table.c b/translation-table.c
index cb0281a..4657d9e 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -472,10 +472,14 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
 	struct batadv_priv *bat_priv = netdev_priv(net_dev);
 	struct batadv_hashtable *hash = bat_priv->tt.local_hash;
 	struct batadv_tt_common_entry *tt_common_entry;
+	struct batadv_tt_local_entry *tt_local;
 	struct batadv_hard_iface *primary_if;
 	struct hlist_node *node;
 	struct hlist_head *head;
 	uint32_t i;
+	int last_seen_secs;
+	int last_seen_msecs;
+	unsigned long last_seen_jiffies;
 
 	primary_if = batadv_seq_print_text_primary_if_get(seq);
 	if (!primary_if)
@@ -484,6 +488,8 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
 	seq_printf(seq,
 		   "Locally retrieved addresses (from %s) announced via TT (TTVN: %u):\n",
 		   net_dev->name, (uint8_t)atomic_read(&bat_priv->tt.vn));
+	seq_printf(seq, "       %-13s %-7s %-10s\n", "Client", "Flags",
+		   "Last seen");
 
 	for (i = 0; i < hash->size; i++) {
 		head = &hash->table[i];
@@ -491,7 +497,15 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
 		rcu_read_lock();
 		hlist_for_each_entry_rcu(tt_common_entry, node,
 					 head, hash_entry) {
-			seq_printf(seq, " * %pM [%c%c%c%c%c]\n",
+			tt_local = container_of(tt_common_entry,
+						struct batadv_tt_local_entry,
+						common);
+			last_seen_jiffies = jiffies - tt_local->last_seen;
+			last_seen_msecs = jiffies_to_msecs(last_seen_jiffies);
+			last_seen_secs = last_seen_msecs / 1000;
+			last_seen_msecs = last_seen_msecs % 1000;
+
+			seq_printf(seq, " * %pM [%c%c%c%c%c] %3u.%03u\n",
 				   tt_common_entry->addr,
 				   (tt_common_entry->flags &
 				    BATADV_TT_CLIENT_ROAM ? 'R' : '.'),
@@ -502,7 +516,8 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
 				   (tt_common_entry->flags &
 				    BATADV_TT_CLIENT_PENDING ? 'X' : '.'),
 				   (tt_common_entry->flags &
-				    BATADV_TT_CLIENT_WIFI ? 'W' : '.'));
+				    BATADV_TT_CLIENT_WIFI ? 'W' : '.'),
+				   last_seen_secs, last_seen_msecs);
 		}
 		rcu_read_unlock();
 	}
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: reduce local TT entry timeout to 10 minutes
  2012-11-08 21:16 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: reduce local TT entry timeout to 10 minutes Antonio Quartulli
  2012-11-08 21:16 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: improve local translation table output Antonio Quartulli
@ 2012-11-13 10:33 ` Marek Lindner
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2012-11-13 10:33 UTC (permalink / raw)
  To: b.a.t.m.a.n

On Friday, November 09, 2012 05:16:15 Antonio Quartulli wrote:
> The current timeout is set to one hour. However a client connected to the
> mesh network will always generate traffic. In the worst case it will send
> ARP requests every 4 or 5 minutes. On the other hand having a long timeout
> means storing dead entries for one hour leads to very big trans-tables
> containing useless clients.
> 
> This patch reduces the timeout to 10 minutes
> 
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
>  main.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied in revision 736dcf6.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: improve local translation table output
  2012-11-08 21:16 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: improve local translation table output Antonio Quartulli
@ 2012-11-13 10:42   ` Marek Lindner
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2012-11-13 10:42 UTC (permalink / raw)
  To: b.a.t.m.a.n

On Friday, November 09, 2012 05:16:16 Antonio Quartulli wrote:
> This patch adds a nice header to the local translation table and
> the last_seen time for each local entry
> 
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
>  translation-table.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)

Applied in revision 59cb086.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-13 10:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-08 21:16 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: reduce local TT entry timeout to 10 minutes Antonio Quartulli
2012-11-08 21:16 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: improve local translation table output Antonio Quartulli
2012-11-13 10:42   ` Marek Lindner
2012-11-13 10:33 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: reduce local TT entry timeout to 10 minutes Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox