Netdev List
 help / color / mirror / Atom feed
* [PATCH][IPSEC]: Aggregate make_jiffies
@ 2006-08-16  1:58 jamal
  2006-08-16  2:33 ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: jamal @ 2006-08-16  1:58 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: netdev

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


make_jiffies definition is repeated in xfrm_state and xfrm_policy.
Aggregate in header instead. Against Dave's last perf improvement
patches.

signed-off-by: Jamal Hadi Salim<hadi@cyberus.ca>




[-- Attachment #2: ipsec-p111 --]
[-- Type: text/x-patch, Size: 1533 bytes --]

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 8123d49..05444dd 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -619,6 +619,14 @@ xfrm_state_addr_cmp(struct xfrm_tmpl *tm
 	return !0;
 }
 
+static inline unsigned long make_jiffies(long secs)
+{
+	if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ)
+		return MAX_SCHEDULE_TIMEOUT-1;
+	else
+		return secs*HZ;
+}
+
 #ifdef CONFIG_XFRM
 
 extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family);
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index a378812..cd785be 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -220,14 +220,6 @@ void xfrm_put_mode(struct xfrm_mode *mod
 	module_put(mode->owner);
 }
 
-static inline unsigned long make_jiffies(long secs)
-{
-	if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ)
-		return MAX_SCHEDULE_TIMEOUT-1;
-	else
-	        return secs*HZ;
-}
-
 static void xfrm_policy_timer(unsigned long data)
 {
 	struct xfrm_policy *xp = (struct xfrm_policy*)data;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index b1c0ae7..00ae0f8 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -264,14 +264,6 @@ static void xfrm_state_gc_task(void *dat
 	wake_up(&km_waitq);
 }
 
-static inline unsigned long make_jiffies(long secs)
-{
-	if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ)
-		return MAX_SCHEDULE_TIMEOUT-1;
-	else
-	        return secs*HZ;
-}
-
 static void xfrm_timer_handler(unsigned long data)
 {
 	struct xfrm_state *x = (struct xfrm_state*)data;

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

* Re: [PATCH][IPSEC]: Aggregate make_jiffies
  2006-08-16  1:58 [PATCH][IPSEC]: Aggregate make_jiffies jamal
@ 2006-08-16  2:33 ` Herbert Xu
  2006-08-16  2:59   ` jamal
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2006-08-16  2:33 UTC (permalink / raw)
  To: jamal; +Cc: David S. Miller, netdev

On Tue, Aug 15, 2006 at 09:58:19PM -0400, jamal wrote:
>
> diff --git a/include/net/xfrm.h b/include/net/xfrm.h
> index 8123d49..05444dd 100644
> --- a/include/net/xfrm.h
> +++ b/include/net/xfrm.h
> @@ -619,6 +619,14 @@ xfrm_state_addr_cmp(struct xfrm_tmpl *tm
>  	return !0;
>  }
>  
> +static inline unsigned long make_jiffies(long secs)
> +{
> +	if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ)
> +		return MAX_SCHEDULE_TIMEOUT-1;
> +	else
> +		return secs*HZ;
> +}

This name is probably too generic for net/xfrm.h.  How about moving
it to linux/jiffies.h and rewrite in the style of msec_to_jiffies?

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

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

* Re: [PATCH][IPSEC]: Aggregate make_jiffies
  2006-08-16  2:33 ` Herbert Xu
@ 2006-08-16  2:59   ` jamal
  2006-08-16 13:13     ` jamal
  0 siblings, 1 reply; 5+ messages in thread
From: jamal @ 2006-08-16  2:59 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, netdev

On Wed, 2006-16-08 at 12:33 +1000, Herbert Xu wrote:
> On Tue, Aug 15, 2006 at 09:58:19PM -0400, jamal wrote:

> > +static inline unsigned long make_jiffies(long secs)
> > +{
> > +	if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ)
> > +		return MAX_SCHEDULE_TIMEOUT-1;
> > +	else
> > +		return secs*HZ;
> > +}
> 
> This name is probably too generic for net/xfrm.h. 

agreed. 

>  How about moving
> it to linux/jiffies.h and rewrite in the style of msec_to_jiffies?
> 

Is there something other than the boundary check already done you
foresee being made? If yes, do you wanna take a crack at it?

cheers,
jamal


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

* Re: [PATCH][IPSEC]: Aggregate make_jiffies
  2006-08-16  2:59   ` jamal
@ 2006-08-16 13:13     ` jamal
  2006-08-16 13:24       ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: jamal @ 2006-08-16 13:13 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, netdev

On Tue, 2006-15-08 at 22:59 -0400, jamal wrote:

> >  How about moving
> > it to linux/jiffies.h and rewrite in the style of msec_to_jiffies?
> > 
> 
> Is there something other than the boundary check already done you
> foresee being made? If yes, do you wanna take a crack at it?

Herbert, I actually dont know the answer that is why i am punting it to
you;-> I would just move the whole thing to linux/jiffies.h as is but
you seem to suggest there may be other boundary checks. If yes, go at
it ;->

cheers,
jamal





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

* Re: [PATCH][IPSEC]: Aggregate make_jiffies
  2006-08-16 13:13     ` jamal
@ 2006-08-16 13:24       ` Herbert Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2006-08-16 13:24 UTC (permalink / raw)
  To: jamal; +Cc: David S. Miller, netdev

On Wed, Aug 16, 2006 at 09:13:14AM -0400, jamal wrote:
> 
> Herbert, I actually dont know the answer that is why i am punting it to
> you;-> I would just move the whole thing to linux/jiffies.h as is but
> you seem to suggest there may be other boundary checks. If yes, go at
> it ;->

I think it's just the boundary check.  If you rewrite the function in
the same fashion as msec_to_jiffies then it should be OK.

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

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

end of thread, other threads:[~2006-08-16 13:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-16  1:58 [PATCH][IPSEC]: Aggregate make_jiffies jamal
2006-08-16  2:33 ` Herbert Xu
2006-08-16  2:59   ` jamal
2006-08-16 13:13     ` jamal
2006-08-16 13:24       ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox