From patchwork Thu Mar 1 07:35:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1577 Return-Path: Received: from nm1-vm0.bullet.mail.ukl.yahoo.com (nm1-vm0.bullet.mail.ukl.yahoo.com [217.146.183.224]) by open-mesh.org (Postfix) with SMTP id 2A80E6008DD for ; Thu, 1 Mar 2012 08:36:36 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.210] by nm1.bullet.mail.ukl.yahoo.com with NNFMP; 01 Mar 2012 07:36:36 -0000 Received: from [217.146.183.25] by tm3.bullet.mail.ukl.yahoo.com with NNFMP; 01 Mar 2012 07:36:36 -0000 Received: from [127.0.0.1] by smtp156.mail.ukl.yahoo.com with NNFMP; 01 Mar 2012 07:36:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1330587396; bh=e70gJrgHCE1h6GHFKBpaYojYXerpcB1UFnF/cv9BKOU=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=kwjgnl0pgjNsohR4cC2miYhjler6dhQBOW0pAsxx6r1FHhZ4s19IasZ/yBEntm3ccno0kT4ju13gSPaNgqJMMm3sKOyN5QlR6dE4lQVT0r16MlW/hF4e01EWWBXGCM1gVA8qxIEPE3r56kGzqAsFRy0FRBshCBG3+WOx6QGgT7k= X-Yahoo-Newman-Id: 19312.9581.bm@smtp156.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: kkFcPoMVM1lGcdwV8p.CD4WXWhZA6CehSHvneJV60JmoYWo ANKjXTbvy0gEN8_2ENvN8ohJugBDnWWF4SwModR2ZR6Hgk9XOOL7UqGwctPf _YDP79CZzTNYVo3Hs9UCFEkUB1rneemPnGL0NYuZq8chPTklOJHYY5y8LNh3 Kpg1FYF.H5OMbP05MDfYzLfWfEsR86oBtJhJMtOyunl27Tb9foymgYZztI_5 uo00k2B10.22S9Ph8LrtWS6iWaJnueW5hYtACHRF1kd0gxjFnMeto8nE5jrg zP3YbGCsZxZ2EUgAQpmOTMM7yD1pvMYtIinnECP2PxtYIU03_qE5FfJxf0gY Zyj63FaL.M.qpCcX1Qr.xUHQ23AtdLYrcKKWb1lTuTfE35xJDIxVFEasX.Av R397k X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@119.236.110.45 with plain) by smtp156.mail.ukl.yahoo.com with SMTP; 29 Feb 2012 23:36:34 -0800 PST From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 1 Mar 2012 15:35:20 +0800 Message-Id: <1330587321-12177-5-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1330587321-12177-1-git-send-email-lindner_marek@yahoo.de> References: <1330587321-12177-1-git-send-email-lindner_marek@yahoo.de> Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 5/6] batman-adv: replace HZ calculations with jiffies_to_msecs() 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: Thu, 01 Mar 2012 07:36:36 -0000 Signed-off-by: Marek Lindner --- bat_debugfs.c | 4 ++-- originator.c | 15 ++++++++++----- send.c | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/bat_debugfs.c b/bat_debugfs.c index 916380c..3b588f8 100644 --- a/bat_debugfs.c +++ b/bat_debugfs.c @@ -83,8 +83,8 @@ int debug_log(struct bat_priv *bat_priv, const char *fmt, ...) va_start(args, fmt); vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); - fdebug_log(bat_priv->debug_log, "[%10lu] %s", - (jiffies / HZ), tmp_log_buf); + fdebug_log(bat_priv->debug_log, "[%10u] %s", + jiffies_to_msecs(jiffies), tmp_log_buf); va_end(args); return 0; diff --git a/originator.c b/originator.c index aa33337..183a1fe 100644 --- a/originator.c +++ b/originator.c @@ -36,7 +36,8 @@ static void purge_orig(struct work_struct *work); static void start_purge_timer(struct bat_priv *bat_priv) { 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 */ @@ -276,6 +277,7 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv, struct hlist_node *node, *node_tmp; struct neigh_node *neigh_node; bool neigh_purged = false; + unsigned long last_seen; *best_neigh_node = NULL; @@ -290,6 +292,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_TO_BE_REMOVED)) { + last_seen = neigh_node->last_seen; + if ((neigh_node->if_incoming->if_status == IF_INACTIVE) || (neigh_node->if_incoming->if_status == @@ -304,9 +308,9 @@ static bool purge_orig_neighbors(struct bat_priv *bat_priv, else bat_dbg(DBG_BATMAN, bat_priv, "neighbor timeout: originator %pM, " - "neighbor: %pM, last_seen: %lu\n", + "neighbor: %pM, last_seen: %u\n", orig_node->orig, neigh_node->addr, - (neigh_node->last_seen / HZ)); + jiffies_to_msecs(last_seen)); neigh_purged = true; @@ -331,8 +335,9 @@ static bool purge_orig_node(struct bat_priv *bat_priv, if (has_timed_out(orig_node->last_seen, 2 * PURGE_TIMEOUT)) { bat_dbg(DBG_BATMAN, bat_priv, - "Originator timeout: originator %pM, last_seen %lu\n", - orig_node->orig, (orig_node->last_seen / HZ)); + "Originator timeout: originator %pM, last_seen %u\n", + orig_node->orig, + jiffies_to_msecs(orig_node->last_seen)); return true; } else { if (purge_orig_neighbors(bat_priv, orig_node, diff --git a/send.c b/send.c index f7f5e3a..0d01e2b 100644 --- a/send.c +++ b/send.c @@ -296,7 +296,7 @@ static void send_outstanding_bcast_packet(struct work_struct *work) /* if we still have some more bcasts to send */ if (forw_packet->num_packets < 3) { _add_bcast_packet_to_list(bat_priv, forw_packet, - ((5 * HZ) / 1000)); + msecs_to_jiffies(5)); return; }