diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/inet_fragment.c | 16 | ||||
-rw-r--r-- | net/ipv4/inet_lro.c | 3 | ||||
-rw-r--r-- | net/ipv4/ip_fragment.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 9 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 6 |
5 files changed, 23 insertions, 13 deletions
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index 4ed429bd5951..0546a0bc97ea 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c | |||
@@ -192,14 +192,21 @@ EXPORT_SYMBOL(inet_frag_evictor); | |||
192 | 192 | ||
193 | static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf, | 193 | static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf, |
194 | struct inet_frag_queue *qp_in, struct inet_frags *f, | 194 | struct inet_frag_queue *qp_in, struct inet_frags *f, |
195 | unsigned int hash, void *arg) | 195 | void *arg) |
196 | { | 196 | { |
197 | struct inet_frag_queue *qp; | 197 | struct inet_frag_queue *qp; |
198 | #ifdef CONFIG_SMP | 198 | #ifdef CONFIG_SMP |
199 | struct hlist_node *n; | 199 | struct hlist_node *n; |
200 | #endif | 200 | #endif |
201 | unsigned int hash; | ||
201 | 202 | ||
202 | write_lock(&f->lock); | 203 | write_lock(&f->lock); |
204 | /* | ||
205 | * While we stayed w/o the lock other CPU could update | ||
206 | * the rnd seed, so we need to re-calculate the hash | ||
207 | * chain. Fortunatelly the qp_in can be used to get one. | ||
208 | */ | ||
209 | hash = f->hashfn(qp_in); | ||
203 | #ifdef CONFIG_SMP | 210 | #ifdef CONFIG_SMP |
204 | /* With SMP race we have to recheck hash table, because | 211 | /* With SMP race we have to recheck hash table, because |
205 | * such entry could be created on other cpu, while we | 212 | * such entry could be created on other cpu, while we |
@@ -247,7 +254,7 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf, | |||
247 | } | 254 | } |
248 | 255 | ||
249 | static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf, | 256 | static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf, |
250 | struct inet_frags *f, void *arg, unsigned int hash) | 257 | struct inet_frags *f, void *arg) |
251 | { | 258 | { |
252 | struct inet_frag_queue *q; | 259 | struct inet_frag_queue *q; |
253 | 260 | ||
@@ -255,7 +262,7 @@ static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf, | |||
255 | if (q == NULL) | 262 | if (q == NULL) |
256 | return NULL; | 263 | return NULL; |
257 | 264 | ||
258 | return inet_frag_intern(nf, q, f, hash, arg); | 265 | return inet_frag_intern(nf, q, f, arg); |
259 | } | 266 | } |
260 | 267 | ||
261 | struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, | 268 | struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
@@ -264,7 +271,6 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, | |||
264 | struct inet_frag_queue *q; | 271 | struct inet_frag_queue *q; |
265 | struct hlist_node *n; | 272 | struct hlist_node *n; |
266 | 273 | ||
267 | read_lock(&f->lock); | ||
268 | hlist_for_each_entry(q, n, &f->hash[hash], list) { | 274 | hlist_for_each_entry(q, n, &f->hash[hash], list) { |
269 | if (q->net == nf && f->match(q, key)) { | 275 | if (q->net == nf && f->match(q, key)) { |
270 | atomic_inc(&q->refcnt); | 276 | atomic_inc(&q->refcnt); |
@@ -274,6 +280,6 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, | |||
274 | } | 280 | } |
275 | read_unlock(&f->lock); | 281 | read_unlock(&f->lock); |
276 | 282 | ||
277 | return inet_frag_create(nf, f, key, hash); | 283 | return inet_frag_create(nf, f, key); |
278 | } | 284 | } |
279 | EXPORT_SYMBOL(inet_frag_find); | 285 | EXPORT_SYMBOL(inet_frag_find); |
diff --git a/net/ipv4/inet_lro.c b/net/ipv4/inet_lro.c index 4a4d49fca1f2..cfd034a2b96e 100644 --- a/net/ipv4/inet_lro.c +++ b/net/ipv4/inet_lro.c | |||
@@ -383,8 +383,7 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb, | |||
383 | out2: /* send aggregated SKBs to stack */ | 383 | out2: /* send aggregated SKBs to stack */ |
384 | lro_flush(lro_mgr, lro_desc); | 384 | lro_flush(lro_mgr, lro_desc); |
385 | 385 | ||
386 | out: /* Original SKB has to be posted to stack */ | 386 | out: |
387 | skb->ip_summed = lro_mgr->ip_summed; | ||
388 | return 1; | 387 | return 1; |
389 | } | 388 | } |
390 | 389 | ||
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index cd6ce6ac6358..37221f659159 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -229,6 +229,8 @@ static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user) | |||
229 | 229 | ||
230 | arg.iph = iph; | 230 | arg.iph = iph; |
231 | arg.user = user; | 231 | arg.user = user; |
232 | |||
233 | read_lock(&ip4_frags.lock); | ||
232 | hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); | 234 | hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); |
233 | 235 | ||
234 | q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); | 236 | q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index fc54a48fde1e..850825dc86e6 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -260,6 +260,8 @@ | |||
260 | #include <linux/socket.h> | 260 | #include <linux/socket.h> |
261 | #include <linux/random.h> | 261 | #include <linux/random.h> |
262 | #include <linux/bootmem.h> | 262 | #include <linux/bootmem.h> |
263 | #include <linux/highmem.h> | ||
264 | #include <linux/swap.h> | ||
263 | #include <linux/cache.h> | 265 | #include <linux/cache.h> |
264 | #include <linux/err.h> | 266 | #include <linux/err.h> |
265 | #include <linux/crypto.h> | 267 | #include <linux/crypto.h> |
@@ -2620,7 +2622,7 @@ __setup("thash_entries=", set_thash_entries); | |||
2620 | void __init tcp_init(void) | 2622 | void __init tcp_init(void) |
2621 | { | 2623 | { |
2622 | struct sk_buff *skb = NULL; | 2624 | struct sk_buff *skb = NULL; |
2623 | unsigned long limit; | 2625 | unsigned long nr_pages, limit; |
2624 | int order, i, max_share; | 2626 | int order, i, max_share; |
2625 | 2627 | ||
2626 | BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); | 2628 | BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); |
@@ -2689,8 +2691,9 @@ void __init tcp_init(void) | |||
2689 | * is up to 1/2 at 256 MB, decreasing toward zero with the amount of | 2691 | * is up to 1/2 at 256 MB, decreasing toward zero with the amount of |
2690 | * memory, with a floor of 128 pages. | 2692 | * memory, with a floor of 128 pages. |
2691 | */ | 2693 | */ |
2692 | limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); | 2694 | nr_pages = totalram_pages - totalhigh_pages; |
2693 | limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); | 2695 | limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); |
2696 | limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); | ||
2694 | limit = max(limit, 128UL); | 2697 | limit = max(limit, 128UL); |
2695 | sysctl_tcp_mem[0] = limit / 4 * 3; | 2698 | sysctl_tcp_mem[0] = limit / 4 * 3; |
2696 | sysctl_tcp_mem[1] = limit; | 2699 | sysctl_tcp_mem[1] = limit; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 12695be2c255..ffe869ac1bcf 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2291,7 +2291,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len) | |||
2291 | } | 2291 | } |
2292 | 2292 | ||
2293 | seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " | 2293 | seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " |
2294 | "%08X %5d %8d %lu %d %p %u %u %u %u %d%n", | 2294 | "%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n", |
2295 | i, src, srcp, dest, destp, sk->sk_state, | 2295 | i, src, srcp, dest, destp, sk->sk_state, |
2296 | tp->write_seq - tp->snd_una, | 2296 | tp->write_seq - tp->snd_una, |
2297 | sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog : | 2297 | sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog : |
@@ -2303,8 +2303,8 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len) | |||
2303 | icsk->icsk_probes_out, | 2303 | icsk->icsk_probes_out, |
2304 | sock_i_ino(sk), | 2304 | sock_i_ino(sk), |
2305 | atomic_read(&sk->sk_refcnt), sk, | 2305 | atomic_read(&sk->sk_refcnt), sk, |
2306 | icsk->icsk_rto, | 2306 | jiffies_to_clock_t(icsk->icsk_rto), |
2307 | icsk->icsk_ack.ato, | 2307 | jiffies_to_clock_t(icsk->icsk_ack.ato), |
2308 | (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong, | 2308 | (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong, |
2309 | tp->snd_cwnd, | 2309 | tp->snd_cwnd, |
2310 | tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh, | 2310 | tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh, |