diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/af_inet.c | 46 | ||||
-rw-r--r-- | net/ipv4/proc.c | 28 | ||||
-rw-r--r-- | net/ipv4/route.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 21 |
4 files changed, 50 insertions, 47 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 7d12c6a9b19b..33b7dffa7732 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1385,7 +1385,7 @@ int inet_ctl_sock_create(struct sock **sk, unsigned short family, | |||
1385 | } | 1385 | } |
1386 | EXPORT_SYMBOL_GPL(inet_ctl_sock_create); | 1386 | EXPORT_SYMBOL_GPL(inet_ctl_sock_create); |
1387 | 1387 | ||
1388 | unsigned long snmp_fold_field(void *mib[], int offt) | 1388 | unsigned long snmp_fold_field(void __percpu *mib[], int offt) |
1389 | { | 1389 | { |
1390 | unsigned long res = 0; | 1390 | unsigned long res = 0; |
1391 | int i; | 1391 | int i; |
@@ -1398,7 +1398,7 @@ unsigned long snmp_fold_field(void *mib[], int offt) | |||
1398 | } | 1398 | } |
1399 | EXPORT_SYMBOL_GPL(snmp_fold_field); | 1399 | EXPORT_SYMBOL_GPL(snmp_fold_field); |
1400 | 1400 | ||
1401 | int snmp_mib_init(void *ptr[2], size_t mibsize) | 1401 | int snmp_mib_init(void __percpu *ptr[2], size_t mibsize) |
1402 | { | 1402 | { |
1403 | BUG_ON(ptr == NULL); | 1403 | BUG_ON(ptr == NULL); |
1404 | ptr[0] = __alloc_percpu(mibsize, __alignof__(unsigned long long)); | 1404 | ptr[0] = __alloc_percpu(mibsize, __alignof__(unsigned long long)); |
@@ -1416,7 +1416,7 @@ err0: | |||
1416 | } | 1416 | } |
1417 | EXPORT_SYMBOL_GPL(snmp_mib_init); | 1417 | EXPORT_SYMBOL_GPL(snmp_mib_init); |
1418 | 1418 | ||
1419 | void snmp_mib_free(void *ptr[2]) | 1419 | void snmp_mib_free(void __percpu *ptr[2]) |
1420 | { | 1420 | { |
1421 | BUG_ON(ptr == NULL); | 1421 | BUG_ON(ptr == NULL); |
1422 | free_percpu(ptr[0]); | 1422 | free_percpu(ptr[0]); |
@@ -1460,25 +1460,25 @@ static const struct net_protocol icmp_protocol = { | |||
1460 | 1460 | ||
1461 | static __net_init int ipv4_mib_init_net(struct net *net) | 1461 | static __net_init int ipv4_mib_init_net(struct net *net) |
1462 | { | 1462 | { |
1463 | if (snmp_mib_init((void **)net->mib.tcp_statistics, | 1463 | if (snmp_mib_init((void __percpu **)net->mib.tcp_statistics, |
1464 | sizeof(struct tcp_mib)) < 0) | 1464 | sizeof(struct tcp_mib)) < 0) |
1465 | goto err_tcp_mib; | 1465 | goto err_tcp_mib; |
1466 | if (snmp_mib_init((void **)net->mib.ip_statistics, | 1466 | if (snmp_mib_init((void __percpu **)net->mib.ip_statistics, |
1467 | sizeof(struct ipstats_mib)) < 0) | 1467 | sizeof(struct ipstats_mib)) < 0) |
1468 | goto err_ip_mib; | 1468 | goto err_ip_mib; |
1469 | if (snmp_mib_init((void **)net->mib.net_statistics, | 1469 | if (snmp_mib_init((void __percpu **)net->mib.net_statistics, |
1470 | sizeof(struct linux_mib)) < 0) | 1470 | sizeof(struct linux_mib)) < 0) |
1471 | goto err_net_mib; | 1471 | goto err_net_mib; |
1472 | if (snmp_mib_init((void **)net->mib.udp_statistics, | 1472 | if (snmp_mib_init((void __percpu **)net->mib.udp_statistics, |
1473 | sizeof(struct udp_mib)) < 0) | 1473 | sizeof(struct udp_mib)) < 0) |
1474 | goto err_udp_mib; | 1474 | goto err_udp_mib; |
1475 | if (snmp_mib_init((void **)net->mib.udplite_statistics, | 1475 | if (snmp_mib_init((void __percpu **)net->mib.udplite_statistics, |
1476 | sizeof(struct udp_mib)) < 0) | 1476 | sizeof(struct udp_mib)) < 0) |
1477 | goto err_udplite_mib; | 1477 | goto err_udplite_mib; |
1478 | if (snmp_mib_init((void **)net->mib.icmp_statistics, | 1478 | if (snmp_mib_init((void __percpu **)net->mib.icmp_statistics, |
1479 | sizeof(struct icmp_mib)) < 0) | 1479 | sizeof(struct icmp_mib)) < 0) |
1480 | goto err_icmp_mib; | 1480 | goto err_icmp_mib; |
1481 | if (snmp_mib_init((void **)net->mib.icmpmsg_statistics, | 1481 | if (snmp_mib_init((void __percpu **)net->mib.icmpmsg_statistics, |
1482 | sizeof(struct icmpmsg_mib)) < 0) | 1482 | sizeof(struct icmpmsg_mib)) < 0) |
1483 | goto err_icmpmsg_mib; | 1483 | goto err_icmpmsg_mib; |
1484 | 1484 | ||
@@ -1486,30 +1486,30 @@ static __net_init int ipv4_mib_init_net(struct net *net) | |||
1486 | return 0; | 1486 | return 0; |
1487 | 1487 | ||
1488 | err_icmpmsg_mib: | 1488 | err_icmpmsg_mib: |
1489 | snmp_mib_free((void **)net->mib.icmp_statistics); | 1489 | snmp_mib_free((void __percpu **)net->mib.icmp_statistics); |
1490 | err_icmp_mib: | 1490 | err_icmp_mib: |
1491 | snmp_mib_free((void **)net->mib.udplite_statistics); | 1491 | snmp_mib_free((void __percpu **)net->mib.udplite_statistics); |
1492 | err_udplite_mib: | 1492 | err_udplite_mib: |
1493 | snmp_mib_free((void **)net->mib.udp_statistics); | 1493 | snmp_mib_free((void __percpu **)net->mib.udp_statistics); |
1494 | err_udp_mib: | 1494 | err_udp_mib: |
1495 | snmp_mib_free((void **)net->mib.net_statistics); | 1495 | snmp_mib_free((void __percpu **)net->mib.net_statistics); |
1496 | err_net_mib: | 1496 | err_net_mib: |
1497 | snmp_mib_free((void **)net->mib.ip_statistics); | 1497 | snmp_mib_free((void __percpu **)net->mib.ip_statistics); |
1498 | err_ip_mib: | 1498 | err_ip_mib: |
1499 | snmp_mib_free((void **)net->mib.tcp_statistics); | 1499 | snmp_mib_free((void __percpu **)net->mib.tcp_statistics); |
1500 | err_tcp_mib: | 1500 | err_tcp_mib: |
1501 | return -ENOMEM; | 1501 | return -ENOMEM; |
1502 | } | 1502 | } |
1503 | 1503 | ||
1504 | static __net_exit void ipv4_mib_exit_net(struct net *net) | 1504 | static __net_exit void ipv4_mib_exit_net(struct net *net) |
1505 | { | 1505 | { |
1506 | snmp_mib_free((void **)net->mib.icmpmsg_statistics); | 1506 | snmp_mib_free((void __percpu **)net->mib.icmpmsg_statistics); |
1507 | snmp_mib_free((void **)net->mib.icmp_statistics); | 1507 | snmp_mib_free((void __percpu **)net->mib.icmp_statistics); |
1508 | snmp_mib_free((void **)net->mib.udplite_statistics); | 1508 | snmp_mib_free((void __percpu **)net->mib.udplite_statistics); |
1509 | snmp_mib_free((void **)net->mib.udp_statistics); | 1509 | snmp_mib_free((void __percpu **)net->mib.udp_statistics); |
1510 | snmp_mib_free((void **)net->mib.net_statistics); | 1510 | snmp_mib_free((void __percpu **)net->mib.net_statistics); |
1511 | snmp_mib_free((void **)net->mib.ip_statistics); | 1511 | snmp_mib_free((void __percpu **)net->mib.ip_statistics); |
1512 | snmp_mib_free((void **)net->mib.tcp_statistics); | 1512 | snmp_mib_free((void __percpu **)net->mib.tcp_statistics); |
1513 | } | 1513 | } |
1514 | 1514 | ||
1515 | static __net_initdata struct pernet_operations ipv4_mib_ops = { | 1515 | static __net_initdata struct pernet_operations ipv4_mib_ops = { |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 1b09a6dde7c0..242ed2307370 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -280,7 +280,7 @@ static void icmpmsg_put(struct seq_file *seq) | |||
280 | 280 | ||
281 | count = 0; | 281 | count = 0; |
282 | for (i = 0; i < ICMPMSG_MIB_MAX; i++) { | 282 | for (i = 0; i < ICMPMSG_MIB_MAX; i++) { |
283 | val = snmp_fold_field((void **) net->mib.icmpmsg_statistics, i); | 283 | val = snmp_fold_field((void __percpu **) net->mib.icmpmsg_statistics, i); |
284 | if (val) { | 284 | if (val) { |
285 | type[count] = i; | 285 | type[count] = i; |
286 | vals[count++] = val; | 286 | vals[count++] = val; |
@@ -307,18 +307,18 @@ static void icmp_put(struct seq_file *seq) | |||
307 | for (i=0; icmpmibmap[i].name != NULL; i++) | 307 | for (i=0; icmpmibmap[i].name != NULL; i++) |
308 | seq_printf(seq, " Out%s", icmpmibmap[i].name); | 308 | seq_printf(seq, " Out%s", icmpmibmap[i].name); |
309 | seq_printf(seq, "\nIcmp: %lu %lu", | 309 | seq_printf(seq, "\nIcmp: %lu %lu", |
310 | snmp_fold_field((void **) net->mib.icmp_statistics, ICMP_MIB_INMSGS), | 310 | snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_INMSGS), |
311 | snmp_fold_field((void **) net->mib.icmp_statistics, ICMP_MIB_INERRORS)); | 311 | snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_INERRORS)); |
312 | for (i=0; icmpmibmap[i].name != NULL; i++) | 312 | for (i=0; icmpmibmap[i].name != NULL; i++) |
313 | seq_printf(seq, " %lu", | 313 | seq_printf(seq, " %lu", |
314 | snmp_fold_field((void **) net->mib.icmpmsg_statistics, | 314 | snmp_fold_field((void __percpu **) net->mib.icmpmsg_statistics, |
315 | icmpmibmap[i].index)); | 315 | icmpmibmap[i].index)); |
316 | seq_printf(seq, " %lu %lu", | 316 | seq_printf(seq, " %lu %lu", |
317 | snmp_fold_field((void **) net->mib.icmp_statistics, ICMP_MIB_OUTMSGS), | 317 | snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_OUTMSGS), |
318 | snmp_fold_field((void **) net->mib.icmp_statistics, ICMP_MIB_OUTERRORS)); | 318 | snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_OUTERRORS)); |
319 | for (i=0; icmpmibmap[i].name != NULL; i++) | 319 | for (i=0; icmpmibmap[i].name != NULL; i++) |
320 | seq_printf(seq, " %lu", | 320 | seq_printf(seq, " %lu", |
321 | snmp_fold_field((void **) net->mib.icmpmsg_statistics, | 321 | snmp_fold_field((void __percpu **) net->mib.icmpmsg_statistics, |
322 | icmpmibmap[i].index | 0x100)); | 322 | icmpmibmap[i].index | 0x100)); |
323 | } | 323 | } |
324 | 324 | ||
@@ -341,7 +341,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) | |||
341 | 341 | ||
342 | for (i = 0; snmp4_ipstats_list[i].name != NULL; i++) | 342 | for (i = 0; snmp4_ipstats_list[i].name != NULL; i++) |
343 | seq_printf(seq, " %lu", | 343 | seq_printf(seq, " %lu", |
344 | snmp_fold_field((void **)net->mib.ip_statistics, | 344 | snmp_fold_field((void __percpu **)net->mib.ip_statistics, |
345 | snmp4_ipstats_list[i].entry)); | 345 | snmp4_ipstats_list[i].entry)); |
346 | 346 | ||
347 | icmp_put(seq); /* RFC 2011 compatibility */ | 347 | icmp_put(seq); /* RFC 2011 compatibility */ |
@@ -356,11 +356,11 @@ static int snmp_seq_show(struct seq_file *seq, void *v) | |||
356 | /* MaxConn field is signed, RFC 2012 */ | 356 | /* MaxConn field is signed, RFC 2012 */ |
357 | if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN) | 357 | if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN) |
358 | seq_printf(seq, " %ld", | 358 | seq_printf(seq, " %ld", |
359 | snmp_fold_field((void **)net->mib.tcp_statistics, | 359 | snmp_fold_field((void __percpu **)net->mib.tcp_statistics, |
360 | snmp4_tcp_list[i].entry)); | 360 | snmp4_tcp_list[i].entry)); |
361 | else | 361 | else |
362 | seq_printf(seq, " %lu", | 362 | seq_printf(seq, " %lu", |
363 | snmp_fold_field((void **)net->mib.tcp_statistics, | 363 | snmp_fold_field((void __percpu **)net->mib.tcp_statistics, |
364 | snmp4_tcp_list[i].entry)); | 364 | snmp4_tcp_list[i].entry)); |
365 | } | 365 | } |
366 | 366 | ||
@@ -371,7 +371,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) | |||
371 | seq_puts(seq, "\nUdp:"); | 371 | seq_puts(seq, "\nUdp:"); |
372 | for (i = 0; snmp4_udp_list[i].name != NULL; i++) | 372 | for (i = 0; snmp4_udp_list[i].name != NULL; i++) |
373 | seq_printf(seq, " %lu", | 373 | seq_printf(seq, " %lu", |
374 | snmp_fold_field((void **)net->mib.udp_statistics, | 374 | snmp_fold_field((void __percpu **)net->mib.udp_statistics, |
375 | snmp4_udp_list[i].entry)); | 375 | snmp4_udp_list[i].entry)); |
376 | 376 | ||
377 | /* the UDP and UDP-Lite MIBs are the same */ | 377 | /* the UDP and UDP-Lite MIBs are the same */ |
@@ -382,7 +382,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) | |||
382 | seq_puts(seq, "\nUdpLite:"); | 382 | seq_puts(seq, "\nUdpLite:"); |
383 | for (i = 0; snmp4_udp_list[i].name != NULL; i++) | 383 | for (i = 0; snmp4_udp_list[i].name != NULL; i++) |
384 | seq_printf(seq, " %lu", | 384 | seq_printf(seq, " %lu", |
385 | snmp_fold_field((void **)net->mib.udplite_statistics, | 385 | snmp_fold_field((void __percpu **)net->mib.udplite_statistics, |
386 | snmp4_udp_list[i].entry)); | 386 | snmp4_udp_list[i].entry)); |
387 | 387 | ||
388 | seq_putc(seq, '\n'); | 388 | seq_putc(seq, '\n'); |
@@ -419,7 +419,7 @@ static int netstat_seq_show(struct seq_file *seq, void *v) | |||
419 | seq_puts(seq, "\nTcpExt:"); | 419 | seq_puts(seq, "\nTcpExt:"); |
420 | for (i = 0; snmp4_net_list[i].name != NULL; i++) | 420 | for (i = 0; snmp4_net_list[i].name != NULL; i++) |
421 | seq_printf(seq, " %lu", | 421 | seq_printf(seq, " %lu", |
422 | snmp_fold_field((void **)net->mib.net_statistics, | 422 | snmp_fold_field((void __percpu **)net->mib.net_statistics, |
423 | snmp4_net_list[i].entry)); | 423 | snmp4_net_list[i].entry)); |
424 | 424 | ||
425 | seq_puts(seq, "\nIpExt:"); | 425 | seq_puts(seq, "\nIpExt:"); |
@@ -429,7 +429,7 @@ static int netstat_seq_show(struct seq_file *seq, void *v) | |||
429 | seq_puts(seq, "\nIpExt:"); | 429 | seq_puts(seq, "\nIpExt:"); |
430 | for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++) | 430 | for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++) |
431 | seq_printf(seq, " %lu", | 431 | seq_printf(seq, " %lu", |
432 | snmp_fold_field((void **)net->mib.ip_statistics, | 432 | snmp_fold_field((void __percpu **)net->mib.ip_statistics, |
433 | snmp4_ipextstats_list[i].entry)); | 433 | snmp4_ipextstats_list[i].entry)); |
434 | 434 | ||
435 | seq_putc(seq, '\n'); | 435 | seq_putc(seq, '\n'); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index b16dfadbe6d6..04762d3bef71 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -3334,7 +3334,7 @@ static __net_initdata struct pernet_operations rt_secret_timer_ops = { | |||
3334 | 3334 | ||
3335 | 3335 | ||
3336 | #ifdef CONFIG_NET_CLS_ROUTE | 3336 | #ifdef CONFIG_NET_CLS_ROUTE |
3337 | struct ip_rt_acct *ip_rt_acct __read_mostly; | 3337 | struct ip_rt_acct __percpu *ip_rt_acct __read_mostly; |
3338 | #endif /* CONFIG_NET_CLS_ROUTE */ | 3338 | #endif /* CONFIG_NET_CLS_ROUTE */ |
3339 | 3339 | ||
3340 | static __initdata unsigned long rhash_entries; | 3340 | static __initdata unsigned long rhash_entries; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index d5d69ea8f249..e471d037fcc9 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2788,10 +2788,10 @@ EXPORT_SYMBOL(tcp_gro_complete); | |||
2788 | 2788 | ||
2789 | #ifdef CONFIG_TCP_MD5SIG | 2789 | #ifdef CONFIG_TCP_MD5SIG |
2790 | static unsigned long tcp_md5sig_users; | 2790 | static unsigned long tcp_md5sig_users; |
2791 | static struct tcp_md5sig_pool **tcp_md5sig_pool; | 2791 | static struct tcp_md5sig_pool * __percpu *tcp_md5sig_pool; |
2792 | static DEFINE_SPINLOCK(tcp_md5sig_pool_lock); | 2792 | static DEFINE_SPINLOCK(tcp_md5sig_pool_lock); |
2793 | 2793 | ||
2794 | static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool **pool) | 2794 | static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool * __percpu *pool) |
2795 | { | 2795 | { |
2796 | int cpu; | 2796 | int cpu; |
2797 | for_each_possible_cpu(cpu) { | 2797 | for_each_possible_cpu(cpu) { |
@@ -2808,7 +2808,7 @@ static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool **pool) | |||
2808 | 2808 | ||
2809 | void tcp_free_md5sig_pool(void) | 2809 | void tcp_free_md5sig_pool(void) |
2810 | { | 2810 | { |
2811 | struct tcp_md5sig_pool **pool = NULL; | 2811 | struct tcp_md5sig_pool * __percpu *pool = NULL; |
2812 | 2812 | ||
2813 | spin_lock_bh(&tcp_md5sig_pool_lock); | 2813 | spin_lock_bh(&tcp_md5sig_pool_lock); |
2814 | if (--tcp_md5sig_users == 0) { | 2814 | if (--tcp_md5sig_users == 0) { |
@@ -2822,10 +2822,11 @@ void tcp_free_md5sig_pool(void) | |||
2822 | 2822 | ||
2823 | EXPORT_SYMBOL(tcp_free_md5sig_pool); | 2823 | EXPORT_SYMBOL(tcp_free_md5sig_pool); |
2824 | 2824 | ||
2825 | static struct tcp_md5sig_pool **__tcp_alloc_md5sig_pool(struct sock *sk) | 2825 | static struct tcp_md5sig_pool * __percpu * |
2826 | __tcp_alloc_md5sig_pool(struct sock *sk) | ||
2826 | { | 2827 | { |
2827 | int cpu; | 2828 | int cpu; |
2828 | struct tcp_md5sig_pool **pool; | 2829 | struct tcp_md5sig_pool * __percpu *pool; |
2829 | 2830 | ||
2830 | pool = alloc_percpu(struct tcp_md5sig_pool *); | 2831 | pool = alloc_percpu(struct tcp_md5sig_pool *); |
2831 | if (!pool) | 2832 | if (!pool) |
@@ -2852,9 +2853,9 @@ out_free: | |||
2852 | return NULL; | 2853 | return NULL; |
2853 | } | 2854 | } |
2854 | 2855 | ||
2855 | struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(struct sock *sk) | 2856 | struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *sk) |
2856 | { | 2857 | { |
2857 | struct tcp_md5sig_pool **pool; | 2858 | struct tcp_md5sig_pool * __percpu *pool; |
2858 | int alloc = 0; | 2859 | int alloc = 0; |
2859 | 2860 | ||
2860 | retry: | 2861 | retry: |
@@ -2873,7 +2874,9 @@ retry: | |||
2873 | 2874 | ||
2874 | if (alloc) { | 2875 | if (alloc) { |
2875 | /* we cannot hold spinlock here because this may sleep. */ | 2876 | /* we cannot hold spinlock here because this may sleep. */ |
2876 | struct tcp_md5sig_pool **p = __tcp_alloc_md5sig_pool(sk); | 2877 | struct tcp_md5sig_pool * __percpu *p; |
2878 | |||
2879 | p = __tcp_alloc_md5sig_pool(sk); | ||
2877 | spin_lock_bh(&tcp_md5sig_pool_lock); | 2880 | spin_lock_bh(&tcp_md5sig_pool_lock); |
2878 | if (!p) { | 2881 | if (!p) { |
2879 | tcp_md5sig_users--; | 2882 | tcp_md5sig_users--; |
@@ -2897,7 +2900,7 @@ EXPORT_SYMBOL(tcp_alloc_md5sig_pool); | |||
2897 | 2900 | ||
2898 | struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu) | 2901 | struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu) |
2899 | { | 2902 | { |
2900 | struct tcp_md5sig_pool **p; | 2903 | struct tcp_md5sig_pool * __percpu *p; |
2901 | spin_lock_bh(&tcp_md5sig_pool_lock); | 2904 | spin_lock_bh(&tcp_md5sig_pool_lock); |
2902 | p = tcp_md5sig_pool; | 2905 | p = tcp_md5sig_pool; |
2903 | if (p) | 2906 | if (p) |