diff options
author | David S. Miller <davem@davemloft.net> | 2019-04-17 14:26:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-17 14:26:25 -0400 |
commit | 6b0a7f84ea1fe248df96ccc4dd86e817e32ef65b (patch) | |
tree | 0a7976054052e793da782c2b7ec34eccfbf66449 /net/ipv4 | |
parent | cea0aa9cbd5ad4efe267e9487ed5d48d16756253 (diff) | |
parent | fe5cdef29e41c8bda8cd1a11545e7c6bfe25570e (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflict resolution of af_smc.c from Stephen Rothwell.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/fou.c | 4 | ||||
-rw-r--r-- | net/ipv4/route.c | 16 | ||||
-rw-r--r-- | net/ipv4/tcp_dctcp.c | 45 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 10 |
4 files changed, 40 insertions, 35 deletions
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index b038f563baa4..1ca1586a7e46 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c | |||
@@ -121,6 +121,7 @@ static int gue_udp_recv(struct sock *sk, struct sk_buff *skb) | |||
121 | struct guehdr *guehdr; | 121 | struct guehdr *guehdr; |
122 | void *data; | 122 | void *data; |
123 | u16 doffset = 0; | 123 | u16 doffset = 0; |
124 | u8 proto_ctype; | ||
124 | 125 | ||
125 | if (!fou) | 126 | if (!fou) |
126 | return 1; | 127 | return 1; |
@@ -210,13 +211,14 @@ static int gue_udp_recv(struct sock *sk, struct sk_buff *skb) | |||
210 | if (unlikely(guehdr->control)) | 211 | if (unlikely(guehdr->control)) |
211 | return gue_control_message(skb, guehdr); | 212 | return gue_control_message(skb, guehdr); |
212 | 213 | ||
214 | proto_ctype = guehdr->proto_ctype; | ||
213 | __skb_pull(skb, sizeof(struct udphdr) + hdrlen); | 215 | __skb_pull(skb, sizeof(struct udphdr) + hdrlen); |
214 | skb_reset_transport_header(skb); | 216 | skb_reset_transport_header(skb); |
215 | 217 | ||
216 | if (iptunnel_pull_offloads(skb)) | 218 | if (iptunnel_pull_offloads(skb)) |
217 | goto drop; | 219 | goto drop; |
218 | 220 | ||
219 | return -guehdr->proto_ctype; | 221 | return -proto_ctype; |
220 | 222 | ||
221 | drop: | 223 | drop: |
222 | kfree_skb(skb); | 224 | kfree_skb(skb); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index efa6a36cbfff..d9b5aa2290d6 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1200,9 +1200,23 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | |||
1200 | 1200 | ||
1201 | static void ipv4_link_failure(struct sk_buff *skb) | 1201 | static void ipv4_link_failure(struct sk_buff *skb) |
1202 | { | 1202 | { |
1203 | struct ip_options opt; | ||
1203 | struct rtable *rt; | 1204 | struct rtable *rt; |
1205 | int res; | ||
1204 | 1206 | ||
1205 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); | 1207 | /* Recompile ip options since IPCB may not be valid anymore. |
1208 | */ | ||
1209 | memset(&opt, 0, sizeof(opt)); | ||
1210 | opt.optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr); | ||
1211 | |||
1212 | rcu_read_lock(); | ||
1213 | res = __ip_options_compile(dev_net(skb->dev), &opt, skb, NULL); | ||
1214 | rcu_read_unlock(); | ||
1215 | |||
1216 | if (res) | ||
1217 | return; | ||
1218 | |||
1219 | __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, &opt); | ||
1206 | 1220 | ||
1207 | rt = skb_rtable(skb); | 1221 | rt = skb_rtable(skb); |
1208 | if (rt) | 1222 | if (rt) |
diff --git a/net/ipv4/tcp_dctcp.c b/net/ipv4/tcp_dctcp.c index 359da68d7c06..477cb4aa456c 100644 --- a/net/ipv4/tcp_dctcp.c +++ b/net/ipv4/tcp_dctcp.c | |||
@@ -49,9 +49,8 @@ | |||
49 | #define DCTCP_MAX_ALPHA 1024U | 49 | #define DCTCP_MAX_ALPHA 1024U |
50 | 50 | ||
51 | struct dctcp { | 51 | struct dctcp { |
52 | u32 acked_bytes_ecn; | 52 | u32 old_delivered; |
53 | u32 acked_bytes_total; | 53 | u32 old_delivered_ce; |
54 | u32 prior_snd_una; | ||
55 | u32 prior_rcv_nxt; | 54 | u32 prior_rcv_nxt; |
56 | u32 dctcp_alpha; | 55 | u32 dctcp_alpha; |
57 | u32 next_seq; | 56 | u32 next_seq; |
@@ -73,8 +72,8 @@ static void dctcp_reset(const struct tcp_sock *tp, struct dctcp *ca) | |||
73 | { | 72 | { |
74 | ca->next_seq = tp->snd_nxt; | 73 | ca->next_seq = tp->snd_nxt; |
75 | 74 | ||
76 | ca->acked_bytes_ecn = 0; | 75 | ca->old_delivered = tp->delivered; |
77 | ca->acked_bytes_total = 0; | 76 | ca->old_delivered_ce = tp->delivered_ce; |
78 | } | 77 | } |
79 | 78 | ||
80 | static void dctcp_init(struct sock *sk) | 79 | static void dctcp_init(struct sock *sk) |
@@ -86,7 +85,6 @@ static void dctcp_init(struct sock *sk) | |||
86 | sk->sk_state == TCP_CLOSE)) { | 85 | sk->sk_state == TCP_CLOSE)) { |
87 | struct dctcp *ca = inet_csk_ca(sk); | 86 | struct dctcp *ca = inet_csk_ca(sk); |
88 | 87 | ||
89 | ca->prior_snd_una = tp->snd_una; | ||
90 | ca->prior_rcv_nxt = tp->rcv_nxt; | 88 | ca->prior_rcv_nxt = tp->rcv_nxt; |
91 | 89 | ||
92 | ca->dctcp_alpha = min(dctcp_alpha_on_init, DCTCP_MAX_ALPHA); | 90 | ca->dctcp_alpha = min(dctcp_alpha_on_init, DCTCP_MAX_ALPHA); |
@@ -118,37 +116,25 @@ static void dctcp_update_alpha(struct sock *sk, u32 flags) | |||
118 | { | 116 | { |
119 | const struct tcp_sock *tp = tcp_sk(sk); | 117 | const struct tcp_sock *tp = tcp_sk(sk); |
120 | struct dctcp *ca = inet_csk_ca(sk); | 118 | struct dctcp *ca = inet_csk_ca(sk); |
121 | u32 acked_bytes = tp->snd_una - ca->prior_snd_una; | ||
122 | |||
123 | /* If ack did not advance snd_una, count dupack as MSS size. | ||
124 | * If ack did update window, do not count it at all. | ||
125 | */ | ||
126 | if (acked_bytes == 0 && !(flags & CA_ACK_WIN_UPDATE)) | ||
127 | acked_bytes = inet_csk(sk)->icsk_ack.rcv_mss; | ||
128 | if (acked_bytes) { | ||
129 | ca->acked_bytes_total += acked_bytes; | ||
130 | ca->prior_snd_una = tp->snd_una; | ||
131 | |||
132 | if (flags & CA_ACK_ECE) | ||
133 | ca->acked_bytes_ecn += acked_bytes; | ||
134 | } | ||
135 | 119 | ||
136 | /* Expired RTT */ | 120 | /* Expired RTT */ |
137 | if (!before(tp->snd_una, ca->next_seq)) { | 121 | if (!before(tp->snd_una, ca->next_seq)) { |
138 | u64 bytes_ecn = ca->acked_bytes_ecn; | 122 | u32 delivered_ce = tp->delivered_ce - ca->old_delivered_ce; |
139 | u32 alpha = ca->dctcp_alpha; | 123 | u32 alpha = ca->dctcp_alpha; |
140 | 124 | ||
141 | /* alpha = (1 - g) * alpha + g * F */ | 125 | /* alpha = (1 - g) * alpha + g * F */ |
142 | 126 | ||
143 | alpha -= min_not_zero(alpha, alpha >> dctcp_shift_g); | 127 | alpha -= min_not_zero(alpha, alpha >> dctcp_shift_g); |
144 | if (bytes_ecn) { | 128 | if (delivered_ce) { |
129 | u32 delivered = tp->delivered - ca->old_delivered; | ||
130 | |||
145 | /* If dctcp_shift_g == 1, a 32bit value would overflow | 131 | /* If dctcp_shift_g == 1, a 32bit value would overflow |
146 | * after 8 Mbytes. | 132 | * after 8 M packets. |
147 | */ | 133 | */ |
148 | bytes_ecn <<= (10 - dctcp_shift_g); | 134 | delivered_ce <<= (10 - dctcp_shift_g); |
149 | do_div(bytes_ecn, max(1U, ca->acked_bytes_total)); | 135 | delivered_ce /= max(1U, delivered); |
150 | 136 | ||
151 | alpha = min(alpha + (u32)bytes_ecn, DCTCP_MAX_ALPHA); | 137 | alpha = min(alpha + delivered_ce, DCTCP_MAX_ALPHA); |
152 | } | 138 | } |
153 | /* dctcp_alpha can be read from dctcp_get_info() without | 139 | /* dctcp_alpha can be read from dctcp_get_info() without |
154 | * synchro, so we ask compiler to not use dctcp_alpha | 140 | * synchro, so we ask compiler to not use dctcp_alpha |
@@ -200,6 +186,7 @@ static size_t dctcp_get_info(struct sock *sk, u32 ext, int *attr, | |||
200 | union tcp_cc_info *info) | 186 | union tcp_cc_info *info) |
201 | { | 187 | { |
202 | const struct dctcp *ca = inet_csk_ca(sk); | 188 | const struct dctcp *ca = inet_csk_ca(sk); |
189 | const struct tcp_sock *tp = tcp_sk(sk); | ||
203 | 190 | ||
204 | /* Fill it also in case of VEGASINFO due to req struct limits. | 191 | /* Fill it also in case of VEGASINFO due to req struct limits. |
205 | * We can still correctly retrieve it later. | 192 | * We can still correctly retrieve it later. |
@@ -211,8 +198,10 @@ static size_t dctcp_get_info(struct sock *sk, u32 ext, int *attr, | |||
211 | info->dctcp.dctcp_enabled = 1; | 198 | info->dctcp.dctcp_enabled = 1; |
212 | info->dctcp.dctcp_ce_state = (u16) ca->ce_state; | 199 | info->dctcp.dctcp_ce_state = (u16) ca->ce_state; |
213 | info->dctcp.dctcp_alpha = ca->dctcp_alpha; | 200 | info->dctcp.dctcp_alpha = ca->dctcp_alpha; |
214 | info->dctcp.dctcp_ab_ecn = ca->acked_bytes_ecn; | 201 | info->dctcp.dctcp_ab_ecn = tp->mss_cache * |
215 | info->dctcp.dctcp_ab_tot = ca->acked_bytes_total; | 202 | (tp->delivered_ce - ca->old_delivered_ce); |
203 | info->dctcp.dctcp_ab_tot = tp->mss_cache * | ||
204 | (tp->delivered - ca->old_delivered); | ||
216 | } | 205 | } |
217 | 206 | ||
218 | *attr = INET_DIAG_DCTCPINFO; | 207 | *attr = INET_DIAG_DCTCPINFO; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 6660ce2a7333..97671bff597a 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -402,11 +402,12 @@ static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb) | |||
402 | static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) | 402 | static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) |
403 | { | 403 | { |
404 | struct tcp_sock *tp = tcp_sk(sk); | 404 | struct tcp_sock *tp = tcp_sk(sk); |
405 | int room; | ||
406 | |||
407 | room = min_t(int, tp->window_clamp, tcp_space(sk)) - tp->rcv_ssthresh; | ||
405 | 408 | ||
406 | /* Check #1 */ | 409 | /* Check #1 */ |
407 | if (tp->rcv_ssthresh < tp->window_clamp && | 410 | if (room > 0 && !tcp_under_memory_pressure(sk)) { |
408 | (int)tp->rcv_ssthresh < tcp_space(sk) && | ||
409 | !tcp_under_memory_pressure(sk)) { | ||
410 | int incr; | 411 | int incr; |
411 | 412 | ||
412 | /* Check #2. Increase window, if skb with such overhead | 413 | /* Check #2. Increase window, if skb with such overhead |
@@ -419,8 +420,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) | |||
419 | 420 | ||
420 | if (incr) { | 421 | if (incr) { |
421 | incr = max_t(int, incr, 2 * skb->len); | 422 | incr = max_t(int, incr, 2 * skb->len); |
422 | tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, | 423 | tp->rcv_ssthresh += min(room, incr); |
423 | tp->window_clamp); | ||
424 | inet_csk(sk)->icsk_ack.quick |= 1; | 424 | inet_csk(sk)->icsk_ack.quick |= 1; |
425 | } | 425 | } |
426 | } | 426 | } |