netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull request: ipsec 2012-11-22
@ 2012-11-22  7:56 Steffen Klassert
  2012-11-22  7:56 ` [PATCH] xfrm: Fix the gc threshold value for ipv4 Steffen Klassert
  2012-11-22 20:25 ` pull request: ipsec 2012-11-22 David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Steffen Klassert @ 2012-11-22  7:56 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, netdev

This pull request is intended for 3.7 and contains a single patch to
fix the IPsec gc threshold value for ipv4.

Please pull or let me know if there are problems.

Thanks!

The following changes since commit a66fe1653f4e81c007a68ca975067432a42df05b:

  net: usb: cdc_eem: Fix rx skb allocation for 802.1Q VLANs (2012-11-07 21:12:26 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git master

for you to fetch changes up to 703fb94ec58e0e8769380c2877a8a34aeb5b6c97:

  xfrm: Fix the gc threshold value for ipv4 (2012-11-13 09:15:07 +0100)

----------------------------------------------------------------
Steffen Klassert (1):
      xfrm: Fix the gc threshold value for ipv4

 include/net/xfrm.h      |    2 +-
 net/ipv4/route.c        |    2 +-
 net/ipv4/xfrm4_policy.c |   13 +------------
 3 files changed, 3 insertions(+), 14 deletions(-)

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

* [PATCH] xfrm: Fix the gc threshold value for ipv4
  2012-11-22  7:56 pull request: ipsec 2012-11-22 Steffen Klassert
@ 2012-11-22  7:56 ` Steffen Klassert
  2012-11-22 20:25 ` pull request: ipsec 2012-11-22 David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Steffen Klassert @ 2012-11-22  7:56 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, netdev

The xfrm gc threshold value depends on ip_rt_max_size. This
value was set to INT_MAX with the routing cache removal patch,
so we start doing garbage collecting when we have INT_MAX/2
IPsec routes cached. Fix this by going back to the static
threshold of 1024 routes.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 include/net/xfrm.h      |    2 +-
 net/ipv4/route.c        |    2 +-
 net/ipv4/xfrm4_policy.c |   13 +------------
 3 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 6f0ba01..63445ed 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1351,7 +1351,7 @@ struct xfrm6_tunnel {
 };
 
 extern void xfrm_init(void);
-extern void xfrm4_init(int rt_hash_size);
+extern void xfrm4_init(void);
 extern int xfrm_state_init(struct net *net);
 extern void xfrm_state_fini(struct net *net);
 extern void xfrm4_state_init(void);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a8c6512..200d287 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2597,7 +2597,7 @@ int __init ip_rt_init(void)
 		pr_err("Unable to create route proc files\n");
 #ifdef CONFIG_XFRM
 	xfrm_init();
-	xfrm4_init(ip_rt_max_size);
+	xfrm4_init();
 #endif
 	rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL, NULL);
 
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 05c5ab8..3be0ac2 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -279,19 +279,8 @@ static void __exit xfrm4_policy_fini(void)
 	xfrm_policy_unregister_afinfo(&xfrm4_policy_afinfo);
 }
 
-void __init xfrm4_init(int rt_max_size)
+void __init xfrm4_init(void)
 {
-	/*
-	 * Select a default value for the gc_thresh based on the main route
-	 * table hash size.  It seems to me the worst case scenario is when
-	 * we have ipsec operating in transport mode, in which we create a
-	 * dst_entry per socket.  The xfrm gc algorithm starts trying to remove
-	 * entries at gc_thresh, and prevents new allocations as 2*gc_thresh
-	 * so lets set an initial xfrm gc_thresh value at the rt_max_size/2.
-	 * That will let us store an ipsec connection per route table entry,
-	 * and start cleaning when were 1/2 full
-	 */
-	xfrm4_dst_ops.gc_thresh = rt_max_size/2;
 	dst_entries_init(&xfrm4_dst_ops);
 
 	xfrm4_state_init();
-- 
1.7.9.5

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

* Re: pull request: ipsec 2012-11-22
  2012-11-22  7:56 pull request: ipsec 2012-11-22 Steffen Klassert
  2012-11-22  7:56 ` [PATCH] xfrm: Fix the gc threshold value for ipv4 Steffen Klassert
@ 2012-11-22 20:25 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-11-22 20:25 UTC (permalink / raw)
  To: steffen.klassert; +Cc: herbert, netdev

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Thu, 22 Nov 2012 08:56:36 +0100

> This pull request is intended for 3.7 and contains a single patch to
> fix the IPsec gc threshold value for ipv4.
> 
> Please pull or let me know if there are problems.

Pulled, thanks.

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

end of thread, other threads:[~2012-11-22 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-22  7:56 pull request: ipsec 2012-11-22 Steffen Klassert
2012-11-22  7:56 ` [PATCH] xfrm: Fix the gc threshold value for ipv4 Steffen Klassert
2012-11-22 20:25 ` pull request: ipsec 2012-11-22 David 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).