aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-11-22 15:25:55 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-22 15:25:55 -0500
commit242a18d1374cebacd301f6b0ce1fd70d6c5afee6 (patch)
treeb5b6079bd153f3461c92895dd7a4435cf3a80bd5
parentf2fb4ab2a647d6576812cbb3ae1979538112f6c8 (diff)
parent0afe21fdf6cfe0fe8a184d82a399773cc331bf40 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next
Steffen Klassert says: ==================== This pull request is intended for net-next and contains the following changes: 1) Remove a redundant check when initializing the xfrm replay functions, from Ulrich Weber. 2) Use a faster per-cpu helper when allocating ipcomt transforms, from Shan Wei. 3) Use a static gc threshold value for ipv6, simmilar to what we do for ipv4 now. 4) Remove a commented out function call. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/xfrm6_policy.c17
-rw-r--r--net/xfrm/xfrm_ipcomp.c8
-rw-r--r--net/xfrm/xfrm_replay.c13
3 files changed, 10 insertions, 28 deletions
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index f3ed8ca59b9..c9844135c9c 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -327,21 +327,7 @@ static struct ctl_table_header *sysctl_hdr;
327int __init xfrm6_init(void) 327int __init xfrm6_init(void)
328{ 328{
329 int ret; 329 int ret;
330 unsigned int gc_thresh; 330
331
332 /*
333 * We need a good default value for the xfrm6 gc threshold.
334 * In ipv4 we set it to the route hash table size * 8, which
335 * is half the size of the maximaum route cache for ipv4. It
336 * would be good to do the same thing for v6, except the table is
337 * constructed differently here. Here each table for a net namespace
338 * can have FIB_TABLE_HASHSZ entries, so lets go with the same
339 * computation that we used for ipv4 here. Also, lets keep the initial
340 * gc_thresh to a minimum of 1024, since, the ipv6 route cache defaults
341 * to that as a minimum as well
342 */
343 gc_thresh = FIB6_TABLE_HASHSZ * 8;
344 xfrm6_dst_ops.gc_thresh = (gc_thresh < 1024) ? 1024 : gc_thresh;
345 dst_entries_init(&xfrm6_dst_ops); 331 dst_entries_init(&xfrm6_dst_ops);
346 332
347 ret = xfrm6_policy_init(); 333 ret = xfrm6_policy_init();
@@ -370,7 +356,6 @@ void xfrm6_fini(void)
370 if (sysctl_hdr) 356 if (sysctl_hdr)
371 unregister_net_sysctl_table(sysctl_hdr); 357 unregister_net_sysctl_table(sysctl_hdr);
372#endif 358#endif
373 //xfrm6_input_fini();
374 xfrm6_policy_fini(); 359 xfrm6_policy_fini();
375 xfrm6_state_fini(); 360 xfrm6_state_fini();
376 dst_entries_destroy(&xfrm6_dst_ops); 361 dst_entries_destroy(&xfrm6_dst_ops);
diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index e5246fbe36c..2906d520eea 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -276,18 +276,16 @@ static struct crypto_comp * __percpu *ipcomp_alloc_tfms(const char *alg_name)
276 struct crypto_comp * __percpu *tfms; 276 struct crypto_comp * __percpu *tfms;
277 int cpu; 277 int cpu;
278 278
279 /* This can be any valid CPU ID so we don't need locking. */
280 cpu = raw_smp_processor_id();
281 279
282 list_for_each_entry(pos, &ipcomp_tfms_list, list) { 280 list_for_each_entry(pos, &ipcomp_tfms_list, list) {
283 struct crypto_comp *tfm; 281 struct crypto_comp *tfm;
284 282
285 tfms = pos->tfms; 283 /* This can be any valid CPU ID so we don't need locking. */
286 tfm = *per_cpu_ptr(tfms, cpu); 284 tfm = __this_cpu_read(*pos->tfms);
287 285
288 if (!strcmp(crypto_comp_name(tfm), alg_name)) { 286 if (!strcmp(crypto_comp_name(tfm), alg_name)) {
289 pos->users++; 287 pos->users++;
290 return tfms; 288 return pos->tfms;
291 } 289 }
292 } 290 }
293 291
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
index 3efb07d3eb2..765f6fe951e 100644
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -521,13 +521,12 @@ int xfrm_init_replay(struct xfrm_state *x)
521 replay_esn->bmp_len * sizeof(__u32) * 8) 521 replay_esn->bmp_len * sizeof(__u32) * 8)
522 return -EINVAL; 522 return -EINVAL;
523 523
524 if ((x->props.flags & XFRM_STATE_ESN) && replay_esn->replay_window == 0) 524 if (x->props.flags & XFRM_STATE_ESN) {
525 return -EINVAL; 525 if (replay_esn->replay_window == 0)
526 526 return -EINVAL;
527 if ((x->props.flags & XFRM_STATE_ESN) && x->replay_esn) 527 x->repl = &xfrm_replay_esn;
528 x->repl = &xfrm_replay_esn; 528 } else
529 else 529 x->repl = &xfrm_replay_bmp;
530 x->repl = &xfrm_replay_bmp;
531 } else 530 } else
532 x->repl = &xfrm_replay_legacy; 531 x->repl = &xfrm_replay_legacy;
533 532