public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinay K Nallamothu <vinay-rc@naturesoft.net>
To: netdev@oss.sgi.com
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.6.0-test4][IPv6] ip6_flowlabel.c: timer cleanups
Date: 26 Aug 2003 19:54:41 +0530	[thread overview]
Message-ID: <1061907882.1108.28.camel@lima.royalchallenge.com> (raw)

Hi,

Compiles fine though untested. A similar patch should be applicable to
2.4 also.

net/ipv6/ip6_flowlabel.c:
This patch does the following modifications to timer management:
1. use static timer initializer
2. replace del_timer/add_timer with mod_timer

--- linux-2.6.0-test4/net/ipv6/ip6_flowlabel.c	2003-07-15 17:23:45.000000000 +0530
+++ linux-2.6.0-test4-nvk/net/ipv6/ip6_flowlabel.c	2003-08-26 19:49:34.000000000 +0530
@@ -49,7 +49,8 @@
 static atomic_t fl_size = ATOMIC_INIT(0);
 static struct ip6_flowlabel *fl_ht[FL_HASH_MASK+1];
 
-static struct timer_list ip6_fl_gc_timer;
+static void ip6_fl_gc(unsigned long dummy);
+static struct timer_list ip6_fl_gc_timer = TIMER_INITIALIZER(ip6_fl_gc, 0, 0);
 
 /* FL hash table lock: it protects only of GC */
 
@@ -104,10 +105,9 @@
 			fl->opt = NULL;
 			kfree(opt);
 		}
-		if (!del_timer(&ip6_fl_gc_timer) ||
-		    (long)(ip6_fl_gc_timer.expires - ttd) > 0)
-			ip6_fl_gc_timer.expires = ttd;
-		add_timer(&ip6_fl_gc_timer);
+		if (!timer_pending(&ip6_fl_gc_timer) ||
+		    time_after(ip6_fl_gc_timer.expires, ttd))
+			mod_timer(&ip6_fl_gc_timer, ttd);
 	}
 }
 
@@ -692,10 +692,6 @@
 {
 #ifdef CONFIG_PROC_FS
 	struct proc_dir_entry *p;
-#endif
-	init_timer(&ip6_fl_gc_timer);
-	ip6_fl_gc_timer.function = ip6_fl_gc;
-#ifdef CONFIG_PROC_FS
 	p = create_proc_entry("ip6_flowlabel", S_IRUGO, proc_net);
 	if (p)
 		p->proc_fops = &ip6fl_seq_fops;






             reply	other threads:[~2003-08-26 14:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-26 14:24 Vinay K Nallamothu [this message]
2003-08-28  6:25 ` [PATCH 2.6.0-test4][IPv6] ip6_flowlabel.c: timer cleanups David S. Miller

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=1061907882.1108.28.camel@lima.royalchallenge.com \
    --to=vinay-rc@naturesoft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    /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