netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [IPSEC] Use add_timer instead of mod_timer in find_acq
@ 2004-05-24 11:53 Herbert Xu
  2004-05-24 17:15 ` David S. Miller
  2004-05-25 12:10 ` Herbert Xu
  0 siblings, 2 replies; 4+ messages in thread
From: Herbert Xu @ 2004-05-24 11:53 UTC (permalink / raw)
  To: David S. Miller, netdev

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

Hi Dave:

Here is a tiny optimisation to use add_timer instead of mod_timer
on the create path in find_acq.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 1053 bytes --]

===== xfrm4_state.c 1.7 vs edited =====
--- 1.7/net/ipv4/xfrm4_state.c	2004-05-24 21:49:33 +10:00
+++ edited/xfrm4_state.c	2004-05-24 21:41:13 +10:00
@@ -98,7 +98,8 @@
 		x0->props.family = AF_INET;
 		x0->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES;
 		xfrm_state_hold(x0);
-		mod_timer(&x0->timer, jiffies + XFRM_ACQ_EXPIRES*HZ);
+		x0->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ;
+		add_timer(&x0->timer);
 		xfrm_state_hold(x0);
 		list_add_tail(&x0->bydst, xfrm4_state_afinfo.state_bydst+h);
 		wake_up(&km_waitq);
===== xfrm6_state.c 1.9 vs edited =====
--- 1.9/net/ipv6/xfrm6_state.c	2004-05-24 21:49:33 +10:00
+++ edited/xfrm6_state.c	2004-05-24 21:51:19 +10:00
@@ -108,7 +108,8 @@
 		x0->props.reqid = reqid;
 		x0->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES;
 		xfrm_state_hold(x0);
-		mod_timer(&x0->timer, jiffies + XFRM_ACQ_EXPIRES*HZ);
+		x0->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ;
+		add_timer(&x0->timer);
 		xfrm_state_hold(x0);
 		list_add_tail(&x0->bydst, xfrm6_state_afinfo.state_bydst+h);
 		wake_up(&km_waitq);

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

* Re: [IPSEC] Use add_timer instead of mod_timer in find_acq
  2004-05-24 11:53 [IPSEC] Use add_timer instead of mod_timer in find_acq Herbert Xu
@ 2004-05-24 17:15 ` David S. Miller
  2004-05-25 12:10 ` Herbert Xu
  1 sibling, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-05-24 17:15 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev

On Mon, 24 May 2004 21:53:57 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> Here is a tiny optimisation to use add_timer instead of mod_timer
> on the create path in find_acq.

Applied, thanks.

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

* Re: [IPSEC] Use add_timer instead of mod_timer in find_acq
  2004-05-24 11:53 [IPSEC] Use add_timer instead of mod_timer in find_acq Herbert Xu
  2004-05-24 17:15 ` David S. Miller
@ 2004-05-25 12:10 ` Herbert Xu
  2004-05-25 18:02   ` David S. Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2004-05-25 12:10 UTC (permalink / raw)
  To: David S. Miller, netdev

[-- Attachment #1: Type: text/plain, Size: 510 bytes --]

On Mon, May 24, 2004 at 09:53:57PM +1000, herbert wrote:
> 
> Here is a tiny optimisation to use add_timer instead of mod_timer
> on the create path in find_acq.

Here is the same optimisation for the creation path in xfrm_state_find.
It also fixes the timer so that it actually expires :)

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 470 bytes --]

===== net/xfrm/xfrm_state.c 1.41 vs edited =====
--- 1.41/net/xfrm/xfrm_state.c	2004-05-25 22:01:18 +10:00
+++ edited/net/xfrm/xfrm_state.c	2004-05-25 22:09:10 +10:00
@@ -345,7 +345,8 @@
 			}
 			x->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES;
 			xfrm_state_hold(x);
-			mod_timer(&x->timer, XFRM_ACQ_EXPIRES*HZ);
+			x->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ;
+			add_timer(&x->timer);
 		} else {
 			x->km.state = XFRM_STATE_DEAD;
 			xfrm_state_put(x);

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

* Re: [IPSEC] Use add_timer instead of mod_timer in find_acq
  2004-05-25 12:10 ` Herbert Xu
@ 2004-05-25 18:02   ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-05-25 18:02 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev

On Tue, 25 May 2004 22:10:55 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> On Mon, May 24, 2004 at 09:53:57PM +1000, herbert wrote:
> > 
> > Here is a tiny optimisation to use add_timer instead of mod_timer
> > on the create path in find_acq.
> 
> Here is the same optimisation for the creation path in xfrm_state_find.
> It also fixes the timer so that it actually expires :)

Also applied, thanks.

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

end of thread, other threads:[~2004-05-25 18:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-24 11:53 [IPSEC] Use add_timer instead of mod_timer in find_acq Herbert Xu
2004-05-24 17:15 ` David S. Miller
2004-05-25 12:10 ` Herbert Xu
2004-05-25 18:02   ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).