Commit 0b0094e0 authored by Marek Lindner's avatar Marek Lindner Committed by Antonio Quartulli

batman-adv: replace HZ calculations with jiffies_to_msecs()

Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
Acked-by: default avatarSimon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
parent d7b2a97e
...@@ -83,8 +83,8 @@ int debug_log(struct bat_priv *bat_priv, const char *fmt, ...) ...@@ -83,8 +83,8 @@ int debug_log(struct bat_priv *bat_priv, const char *fmt, ...)
va_start(args, fmt); va_start(args, fmt);
vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args);
fdebug_log(bat_priv->debug_log, "[%10lu] %s", fdebug_log(bat_priv->debug_log, "[%10u] %s",
(jiffies / HZ), tmp_log_buf); jiffies_to_msecs(jiffies), tmp_log_buf);
va_end(args); va_end(args);
return 0; return 0;
......
...@@ -35,7 +35,8 @@ static void purge_orig(struct work_struct *work); ...@@ -35,7 +35,8 @@ static void purge_orig(struct work_struct *work);
static void start_purge_timer(struct bat_priv *bat_priv) static void start_purge_timer(struct bat_priv *bat_priv)
{ {
INIT_DELAYED_WORK(&bat_priv->orig_work, purge_orig); INIT_DELAYED_WORK(&bat_priv->orig_work, purge_orig);
queue_delayed_work(bat_event_workqueue, &bat_priv->orig_work, 1 * HZ); queue_delayed_work(bat_event_workqueue,
&bat_priv->orig_work, msecs_to_jiffies(1000));
} }
/* returns 1 if they are the same originator */ /* returns 1 if they are the same originator */
...@@ -274,6 +275,7 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv, ...@@ -274,6 +275,7 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
struct hlist_node *node, *node_tmp; struct hlist_node *node, *node_tmp;
struct neigh_node *neigh_node; struct neigh_node *neigh_node;
bool neigh_purged = false; bool neigh_purged = false;
unsigned long last_seen;
*best_neigh_node = NULL; *best_neigh_node = NULL;
...@@ -288,6 +290,8 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv, ...@@ -288,6 +290,8 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
(neigh_node->if_incoming->if_status == IF_NOT_IN_USE) || (neigh_node->if_incoming->if_status == IF_NOT_IN_USE) ||
(neigh_node->if_incoming->if_status == IF_TO_BE_REMOVED)) { (neigh_node->if_incoming->if_status == IF_TO_BE_REMOVED)) {
last_seen = neigh_node->last_seen;
if ((neigh_node->if_incoming->if_status == if ((neigh_node->if_incoming->if_status ==
IF_INACTIVE) || IF_INACTIVE) ||
(neigh_node->if_incoming->if_status == (neigh_node->if_incoming->if_status ==
...@@ -300,9 +304,9 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv, ...@@ -300,9 +304,9 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv,
neigh_node->if_incoming->net_dev->name); neigh_node->if_incoming->net_dev->name);
else else
bat_dbg(DBG_BATMAN, bat_priv, bat_dbg(DBG_BATMAN, bat_priv,
"neighbor timeout: originator %pM, neighbor: %pM, last_seen: %lu\n", "neighbor timeout: originator %pM, neighbor: %pM, last_seen: %u\n",
orig_node->orig, neigh_node->addr, orig_node->orig, neigh_node->addr,
(neigh_node->last_seen / HZ)); jiffies_to_msecs(last_seen));
neigh_purged = true; neigh_purged = true;
...@@ -327,8 +331,9 @@ static bool purge_orig_node(struct bat_priv *bat_priv, ...@@ -327,8 +331,9 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
if (has_timed_out(orig_node->last_seen, 2 * PURGE_TIMEOUT)) { if (has_timed_out(orig_node->last_seen, 2 * PURGE_TIMEOUT)) {
bat_dbg(DBG_BATMAN, bat_priv, bat_dbg(DBG_BATMAN, bat_priv,
"Originator timeout: originator %pM, last_seen %lu\n", "Originator timeout: originator %pM, last_seen %u\n",
orig_node->orig, (orig_node->last_seen / HZ)); orig_node->orig,
jiffies_to_msecs(orig_node->last_seen));
return true; return true;
} else { } else {
if (purge_orig_neighbors(bat_priv, orig_node, if (purge_orig_neighbors(bat_priv, orig_node,
......
...@@ -292,7 +292,7 @@ static void send_outstanding_bcast_packet(struct work_struct *work) ...@@ -292,7 +292,7 @@ static void send_outstanding_bcast_packet(struct work_struct *work)
/* if we still have some more bcasts to send */ /* if we still have some more bcasts to send */
if (forw_packet->num_packets < 3) { if (forw_packet->num_packets < 3) {
_add_bcast_packet_to_list(bat_priv, forw_packet, _add_bcast_packet_to_list(bat_priv, forw_packet,
((5 * HZ) / 1000)); msecs_to_jiffies(5));
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment