aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/inet_fragment.c16
-rw-r--r--net/ipv4/inet_lro.c3
-rw-r--r--net/ipv4/ip_fragment.c2
-rw-r--r--net/ipv4/tcp.c9
-rw-r--r--net/ipv4/tcp_ipv4.c6
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
193static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf, 193static 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
249static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf, 256static 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
261struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, 268struct 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}
279EXPORT_SYMBOL(inet_frag_find); 285EXPORT_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,
383out2: /* send aggregated SKBs to stack */ 383out2: /* send aggregated SKBs to stack */
384 lro_flush(lro_mgr, lro_desc); 384 lro_flush(lro_mgr, lro_desc);
385 385
386out: /* Original SKB has to be posted to stack */ 386out:
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 91e321407313..fbd5804b5d83 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -227,6 +227,8 @@ static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user)
227 227
228 arg.iph = iph; 228 arg.iph = iph;
229 arg.user = user; 229 arg.user = user;
230
231 read_lock(&ip4_frags.lock);
230 hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); 232 hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol);
231 233
232 q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); 234 q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash);
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index cf0850c068f5..c66ac83316e8 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -258,6 +258,8 @@
258#include <linux/socket.h> 258#include <linux/socket.h>
259#include <linux/random.h> 259#include <linux/random.h>
260#include <linux/bootmem.h> 260#include <linux/bootmem.h>
261#include <linux/highmem.h>
262#include <linux/swap.h>
261#include <linux/cache.h> 263#include <linux/cache.h>
262#include <linux/err.h> 264#include <linux/err.h>
263#include <linux/crypto.h> 265#include <linux/crypto.h>
@@ -2688,7 +2690,7 @@ __setup("thash_entries=", set_thash_entries);
2688void __init tcp_init(void) 2690void __init tcp_init(void)
2689{ 2691{
2690 struct sk_buff *skb = NULL; 2692 struct sk_buff *skb = NULL;
2691 unsigned long limit; 2693 unsigned long nr_pages, limit;
2692 int order, i, max_share; 2694 int order, i, max_share;
2693 2695
2694 BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)); 2696 BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb));
@@ -2757,8 +2759,9 @@ void __init tcp_init(void)
2757 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of 2759 * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
2758 * memory, with a floor of 128 pages. 2760 * memory, with a floor of 128 pages.
2759 */ 2761 */
2760 limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); 2762 nr_pages = totalram_pages - totalhigh_pages;
2761 limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); 2763 limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
2764 limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
2762 limit = max(limit, 128UL); 2765 limit = max(limit, 128UL);
2763 sysctl_tcp_mem[0] = limit / 4 * 3; 2766 sysctl_tcp_mem[0] = limit / 4 * 3;
2764 sysctl_tcp_mem[1] = limit; 2767 sysctl_tcp_mem[1] = limit;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 0db9b75c1fa2..4300bcf2ceaf 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2189,7 +2189,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
2189 } 2189 }
2190 2190
2191 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " 2191 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
2192 "%08X %5d %8d %lu %d %p %u %u %u %u %d%n", 2192 "%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n",
2193 i, src, srcp, dest, destp, sk->sk_state, 2193 i, src, srcp, dest, destp, sk->sk_state,
2194 tp->write_seq - tp->snd_una, 2194 tp->write_seq - tp->snd_una,
2195 sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog : 2195 sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog :
@@ -2201,8 +2201,8 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
2201 icsk->icsk_probes_out, 2201 icsk->icsk_probes_out,
2202 sock_i_ino(sk), 2202 sock_i_ino(sk),
2203 atomic_read(&sk->sk_refcnt), sk, 2203 atomic_read(&sk->sk_refcnt), sk,
2204 icsk->icsk_rto, 2204 jiffies_to_clock_t(icsk->icsk_rto),
2205 icsk->icsk_ack.ato, 2205 jiffies_to_clock_t(icsk->icsk_ack.ato),
2206 (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong, 2206 (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong,
2207 tp->snd_cwnd, 2207 tp->snd_cwnd,
2208 tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh, 2208 tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh,