From patchwork Thu Dec 17 19:04:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 5218 Return-Path: Received: from fmmailgate01.web.de (fmmailgate01.web.de [217.72.192.221]) by open-mesh.net (Postfix) with ESMTP id 12D7115423E for ; Thu, 17 Dec 2009 19:50:28 +0000 (UTC) Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215]) by fmmailgate01.web.de (Postfix) with ESMTP id 10D7E14214C40 for ; Thu, 17 Dec 2009 20:04:35 +0100 (CET) Received: from [78.54.13.214] (helo=localhost) by smtp07.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.110 #314) id 1NLLeM-0003f4-00 for b.a.t.m.a.n@lists.open-mesh.net; Thu, 17 Dec 2009 20:04:34 +0100 Date: Thu, 17 Dec 2009 20:04:33 +0100 From: Linus =?utf-8?Q?L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.net Message-ID: <20091217190433.GA3960@Linus-Debian> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linus.luessing@web.de X-Sender: linus.luessing@web.de X-Provags-ID: V01U2FsdGVkX18eUtyQVTBPvZ6T/wSv4ksGq4lcO+4C0zqr9d+f SgR9PYeJIuk29tBJukLehr7C1x4Kawq+RBo3kFujtafkVEwLjZ n6H7nOOATp+mZJ4nLatw== Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: Fixes rounding issues in vis.c X-BeenThere: b.a.t.m.a.n@lists.open-mesh.net 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: Thu, 17 Dec 2009 19:50:28 -0000 This patches fixes two rounding issues in vis.c for sending and purging vis packets. Before, the timers and timeouts always got rounded down to seconds, though we want a precision in milliseconds. This also fixes a kernel panic that occures when lowering the timer for sending vis packets (vis_interval) to less than 1000ms in main.c manually. Signed-off-by: Linus Lüssing Index: vis.c =================================================================== --- vis.c (revision 1505) +++ vis.c (working copy) @@ -377,7 +377,7 @@ if (info == my_vis_info) /* never purge own data. */ continue; if (time_after(jiffies, - info->first_seen + (VIS_TIMEOUT/1000)*HZ)) { + info->first_seen + (VIS_TIMEOUT*HZ)/1000)) { hash_remove_bucket(vis_hash, &hashit); free_info(info); } @@ -556,5 +556,5 @@ static void start_vis_timer(void) { queue_delayed_work(bat_event_workqueue, &vis_timer_wq, - (atomic_read(&vis_interval)/1000) * HZ); + (atomic_read(&vis_interval) * HZ ) / 1000); }