diff options
author | Tejun Heo <tj@kernel.org> | 2010-02-02 00:38:15 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-02-02 00:38:15 -0500 |
commit | ab386128f20c44c458a90039ab1bdc265ac474c9 (patch) | |
tree | 2ad188744922b1bb951fd10ff50dc04c83acce22 /net/ipv4 | |
parent | dbfc196a3cc1a2514ad0737a82f764de23bd65e6 (diff) | |
parent | ab658321f32770b903a4426e2a6fae0392757755 (diff) |
Merge branch 'master' into percpu
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/inet_diag.c | 2 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 2 | ||||
-rw-r--r-- | net/ipv4/route.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_probe.c | 19 | ||||
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 14 |
5 files changed, 22 insertions, 17 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index bdb78dd180ce..1aaa8110d84b 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -368,7 +368,7 @@ static int inet_diag_bc_run(const void *bc, int len, | |||
368 | yes = entry->sport >= op[1].no; | 368 | yes = entry->sport >= op[1].no; |
369 | break; | 369 | break; |
370 | case INET_DIAG_BC_S_LE: | 370 | case INET_DIAG_BC_S_LE: |
371 | yes = entry->dport <= op[1].no; | 371 | yes = entry->sport <= op[1].no; |
372 | break; | 372 | break; |
373 | case INET_DIAG_BC_D_GE: | 373 | case INET_DIAG_BC_D_GE: |
374 | yes = entry->dport >= op[1].no; | 374 | yes = entry->dport >= op[1].no; |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index e34013a78ef4..3451799e3dbf 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -254,7 +254,7 @@ int ip_mc_output(struct sk_buff *skb) | |||
254 | */ | 254 | */ |
255 | 255 | ||
256 | if (rt->rt_flags&RTCF_MULTICAST) { | 256 | if (rt->rt_flags&RTCF_MULTICAST) { |
257 | if ((!sk || inet_sk(sk)->mc_loop) | 257 | if (sk_mc_loop(sk) |
258 | #ifdef CONFIG_IP_MROUTE | 258 | #ifdef CONFIG_IP_MROUTE |
259 | /* Small optimization: do not loopback not local frames, | 259 | /* Small optimization: do not loopback not local frames, |
260 | which returned after forwarding; they will be dropped | 260 | which returned after forwarding; they will be dropped |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index e446496f564f..d62b05d33384 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -586,7 +586,9 @@ static void __net_exit ip_rt_do_proc_exit(struct net *net) | |||
586 | { | 586 | { |
587 | remove_proc_entry("rt_cache", net->proc_net_stat); | 587 | remove_proc_entry("rt_cache", net->proc_net_stat); |
588 | remove_proc_entry("rt_cache", net->proc_net); | 588 | remove_proc_entry("rt_cache", net->proc_net); |
589 | #ifdef CONFIG_NET_CLS_ROUTE | ||
589 | remove_proc_entry("rt_acct", net->proc_net); | 590 | remove_proc_entry("rt_acct", net->proc_net); |
591 | #endif | ||
590 | } | 592 | } |
591 | 593 | ||
592 | static struct pernet_operations ip_rt_proc_ops __net_initdata = { | 594 | static struct pernet_operations ip_rt_proc_ops __net_initdata = { |
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index bb110c5ce1d2..9bc805df95d2 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c | |||
@@ -39,9 +39,9 @@ static int port __read_mostly = 0; | |||
39 | MODULE_PARM_DESC(port, "Port to match (0=all)"); | 39 | MODULE_PARM_DESC(port, "Port to match (0=all)"); |
40 | module_param(port, int, 0); | 40 | module_param(port, int, 0); |
41 | 41 | ||
42 | static int bufsize __read_mostly = 4096; | 42 | static unsigned int bufsize __read_mostly = 4096; |
43 | MODULE_PARM_DESC(bufsize, "Log buffer size in packets (4096)"); | 43 | MODULE_PARM_DESC(bufsize, "Log buffer size in packets (4096)"); |
44 | module_param(bufsize, int, 0); | 44 | module_param(bufsize, uint, 0); |
45 | 45 | ||
46 | static int full __read_mostly; | 46 | static int full __read_mostly; |
47 | MODULE_PARM_DESC(full, "Full log (1=every ack packet received, 0=only cwnd changes)"); | 47 | MODULE_PARM_DESC(full, "Full log (1=every ack packet received, 0=only cwnd changes)"); |
@@ -75,12 +75,12 @@ static struct { | |||
75 | 75 | ||
76 | static inline int tcp_probe_used(void) | 76 | static inline int tcp_probe_used(void) |
77 | { | 77 | { |
78 | return (tcp_probe.head - tcp_probe.tail) % bufsize; | 78 | return (tcp_probe.head - tcp_probe.tail) & (bufsize - 1); |
79 | } | 79 | } |
80 | 80 | ||
81 | static inline int tcp_probe_avail(void) | 81 | static inline int tcp_probe_avail(void) |
82 | { | 82 | { |
83 | return bufsize - tcp_probe_used(); | 83 | return bufsize - tcp_probe_used() - 1; |
84 | } | 84 | } |
85 | 85 | ||
86 | /* | 86 | /* |
@@ -116,7 +116,7 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
116 | p->ssthresh = tcp_current_ssthresh(sk); | 116 | p->ssthresh = tcp_current_ssthresh(sk); |
117 | p->srtt = tp->srtt >> 3; | 117 | p->srtt = tp->srtt >> 3; |
118 | 118 | ||
119 | tcp_probe.head = (tcp_probe.head + 1) % bufsize; | 119 | tcp_probe.head = (tcp_probe.head + 1) & (bufsize - 1); |
120 | } | 120 | } |
121 | tcp_probe.lastcwnd = tp->snd_cwnd; | 121 | tcp_probe.lastcwnd = tp->snd_cwnd; |
122 | spin_unlock(&tcp_probe.lock); | 122 | spin_unlock(&tcp_probe.lock); |
@@ -149,7 +149,7 @@ static int tcpprobe_open(struct inode * inode, struct file * file) | |||
149 | static int tcpprobe_sprint(char *tbuf, int n) | 149 | static int tcpprobe_sprint(char *tbuf, int n) |
150 | { | 150 | { |
151 | const struct tcp_log *p | 151 | const struct tcp_log *p |
152 | = tcp_probe.log + tcp_probe.tail % bufsize; | 152 | = tcp_probe.log + tcp_probe.tail; |
153 | struct timespec tv | 153 | struct timespec tv |
154 | = ktime_to_timespec(ktime_sub(p->tstamp, tcp_probe.start)); | 154 | = ktime_to_timespec(ktime_sub(p->tstamp, tcp_probe.start)); |
155 | 155 | ||
@@ -192,7 +192,7 @@ static ssize_t tcpprobe_read(struct file *file, char __user *buf, | |||
192 | width = tcpprobe_sprint(tbuf, sizeof(tbuf)); | 192 | width = tcpprobe_sprint(tbuf, sizeof(tbuf)); |
193 | 193 | ||
194 | if (cnt + width < len) | 194 | if (cnt + width < len) |
195 | tcp_probe.tail = (tcp_probe.tail + 1) % bufsize; | 195 | tcp_probe.tail = (tcp_probe.tail + 1) & (bufsize - 1); |
196 | 196 | ||
197 | spin_unlock_bh(&tcp_probe.lock); | 197 | spin_unlock_bh(&tcp_probe.lock); |
198 | 198 | ||
@@ -222,9 +222,10 @@ static __init int tcpprobe_init(void) | |||
222 | init_waitqueue_head(&tcp_probe.wait); | 222 | init_waitqueue_head(&tcp_probe.wait); |
223 | spin_lock_init(&tcp_probe.lock); | 223 | spin_lock_init(&tcp_probe.lock); |
224 | 224 | ||
225 | if (bufsize < 0) | 225 | if (bufsize == 0) |
226 | return -EINVAL; | 226 | return -EINVAL; |
227 | 227 | ||
228 | bufsize = roundup_pow_of_two(bufsize); | ||
228 | tcp_probe.log = kcalloc(bufsize, sizeof(struct tcp_log), GFP_KERNEL); | 229 | tcp_probe.log = kcalloc(bufsize, sizeof(struct tcp_log), GFP_KERNEL); |
229 | if (!tcp_probe.log) | 230 | if (!tcp_probe.log) |
230 | goto err0; | 231 | goto err0; |
@@ -236,7 +237,7 @@ static __init int tcpprobe_init(void) | |||
236 | if (ret) | 237 | if (ret) |
237 | goto err1; | 238 | goto err1; |
238 | 239 | ||
239 | pr_info("TCP probe registered (port=%d)\n", port); | 240 | pr_info("TCP probe registered (port=%d) bufsize=%u\n", port, bufsize); |
240 | return 0; | 241 | return 0; |
241 | err1: | 242 | err1: |
242 | proc_net_remove(&init_net, procname); | 243 | proc_net_remove(&init_net, procname); |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 8c08a28d8f83..67107d63c1cd 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <net/xfrm.h> | 15 | #include <net/xfrm.h> |
16 | #include <net/ip.h> | 16 | #include <net/ip.h> |
17 | 17 | ||
18 | static struct dst_ops xfrm4_dst_ops; | ||
19 | static struct xfrm_policy_afinfo xfrm4_policy_afinfo; | 18 | static struct xfrm_policy_afinfo xfrm4_policy_afinfo; |
20 | 19 | ||
21 | static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos, | 20 | static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos, |
@@ -190,8 +189,10 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
190 | 189 | ||
191 | static inline int xfrm4_garbage_collect(struct dst_ops *ops) | 190 | static inline int xfrm4_garbage_collect(struct dst_ops *ops) |
192 | { | 191 | { |
193 | xfrm4_policy_afinfo.garbage_collect(&init_net); | 192 | struct net *net = container_of(ops, struct net, xfrm.xfrm4_dst_ops); |
194 | return (atomic_read(&xfrm4_dst_ops.entries) > xfrm4_dst_ops.gc_thresh*2); | 193 | |
194 | xfrm4_policy_afinfo.garbage_collect(net); | ||
195 | return (atomic_read(&ops->entries) > ops->gc_thresh * 2); | ||
195 | } | 196 | } |
196 | 197 | ||
197 | static void xfrm4_update_pmtu(struct dst_entry *dst, u32 mtu) | 198 | static void xfrm4_update_pmtu(struct dst_entry *dst, u32 mtu) |
@@ -268,7 +269,7 @@ static struct xfrm_policy_afinfo xfrm4_policy_afinfo = { | |||
268 | static struct ctl_table xfrm4_policy_table[] = { | 269 | static struct ctl_table xfrm4_policy_table[] = { |
269 | { | 270 | { |
270 | .procname = "xfrm4_gc_thresh", | 271 | .procname = "xfrm4_gc_thresh", |
271 | .data = &xfrm4_dst_ops.gc_thresh, | 272 | .data = &init_net.xfrm.xfrm4_dst_ops.gc_thresh, |
272 | .maxlen = sizeof(int), | 273 | .maxlen = sizeof(int), |
273 | .mode = 0644, | 274 | .mode = 0644, |
274 | .proc_handler = proc_dointvec, | 275 | .proc_handler = proc_dointvec, |
@@ -295,8 +296,6 @@ static void __exit xfrm4_policy_fini(void) | |||
295 | 296 | ||
296 | void __init xfrm4_init(int rt_max_size) | 297 | void __init xfrm4_init(int rt_max_size) |
297 | { | 298 | { |
298 | xfrm4_state_init(); | ||
299 | xfrm4_policy_init(); | ||
300 | /* | 299 | /* |
301 | * Select a default value for the gc_thresh based on the main route | 300 | * Select a default value for the gc_thresh based on the main route |
302 | * table hash size. It seems to me the worst case scenario is when | 301 | * table hash size. It seems to me the worst case scenario is when |
@@ -308,6 +307,9 @@ void __init xfrm4_init(int rt_max_size) | |||
308 | * and start cleaning when were 1/2 full | 307 | * and start cleaning when were 1/2 full |
309 | */ | 308 | */ |
310 | xfrm4_dst_ops.gc_thresh = rt_max_size/2; | 309 | xfrm4_dst_ops.gc_thresh = rt_max_size/2; |
310 | |||
311 | xfrm4_state_init(); | ||
312 | xfrm4_policy_init(); | ||
311 | #ifdef CONFIG_SYSCTL | 313 | #ifdef CONFIG_SYSCTL |
312 | sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv4_ctl_path, | 314 | sysctl_hdr = register_net_sysctl_table(&init_net, net_ipv4_ctl_path, |
313 | xfrm4_policy_table); | 315 | xfrm4_policy_table); |