diff options
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index d5ffb573ca4d..355d3dffd021 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -254,8 +254,10 @@ static void tcp_ecn_withdraw_cwr(struct tcp_sock *tp) | |||
254 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; | 254 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; |
255 | } | 255 | } |
256 | 256 | ||
257 | static void __tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb) | 257 | static void __tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb) |
258 | { | 258 | { |
259 | struct tcp_sock *tp = tcp_sk(sk); | ||
260 | |||
259 | switch (TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK) { | 261 | switch (TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK) { |
260 | case INET_ECN_NOT_ECT: | 262 | case INET_ECN_NOT_ECT: |
261 | /* Funny extension: if ECT is not set on a segment, | 263 | /* Funny extension: if ECT is not set on a segment, |
@@ -263,31 +265,31 @@ static void __tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb) | |||
263 | * it is probably a retransmit. | 265 | * it is probably a retransmit. |
264 | */ | 266 | */ |
265 | if (tp->ecn_flags & TCP_ECN_SEEN) | 267 | if (tp->ecn_flags & TCP_ECN_SEEN) |
266 | tcp_enter_quickack_mode((struct sock *)tp, 1); | 268 | tcp_enter_quickack_mode(sk, 1); |
267 | break; | 269 | break; |
268 | case INET_ECN_CE: | 270 | case INET_ECN_CE: |
269 | if (tcp_ca_needs_ecn((struct sock *)tp)) | 271 | if (tcp_ca_needs_ecn(sk)) |
270 | tcp_ca_event((struct sock *)tp, CA_EVENT_ECN_IS_CE); | 272 | tcp_ca_event(sk, CA_EVENT_ECN_IS_CE); |
271 | 273 | ||
272 | if (!(tp->ecn_flags & TCP_ECN_DEMAND_CWR)) { | 274 | if (!(tp->ecn_flags & TCP_ECN_DEMAND_CWR)) { |
273 | /* Better not delay acks, sender can have a very low cwnd */ | 275 | /* Better not delay acks, sender can have a very low cwnd */ |
274 | tcp_enter_quickack_mode((struct sock *)tp, 1); | 276 | tcp_enter_quickack_mode(sk, 1); |
275 | tp->ecn_flags |= TCP_ECN_DEMAND_CWR; | 277 | tp->ecn_flags |= TCP_ECN_DEMAND_CWR; |
276 | } | 278 | } |
277 | tp->ecn_flags |= TCP_ECN_SEEN; | 279 | tp->ecn_flags |= TCP_ECN_SEEN; |
278 | break; | 280 | break; |
279 | default: | 281 | default: |
280 | if (tcp_ca_needs_ecn((struct sock *)tp)) | 282 | if (tcp_ca_needs_ecn(sk)) |
281 | tcp_ca_event((struct sock *)tp, CA_EVENT_ECN_NO_CE); | 283 | tcp_ca_event(sk, CA_EVENT_ECN_NO_CE); |
282 | tp->ecn_flags |= TCP_ECN_SEEN; | 284 | tp->ecn_flags |= TCP_ECN_SEEN; |
283 | break; | 285 | break; |
284 | } | 286 | } |
285 | } | 287 | } |
286 | 288 | ||
287 | static void tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb) | 289 | static void tcp_ecn_check_ce(struct sock *sk, const struct sk_buff *skb) |
288 | { | 290 | { |
289 | if (tp->ecn_flags & TCP_ECN_OK) | 291 | if (tcp_sk(sk)->ecn_flags & TCP_ECN_OK) |
290 | __tcp_ecn_check_ce(tp, skb); | 292 | __tcp_ecn_check_ce(sk, skb); |
291 | } | 293 | } |
292 | 294 | ||
293 | static void tcp_ecn_rcv_synack(struct tcp_sock *tp, const struct tcphdr *th) | 295 | static void tcp_ecn_rcv_synack(struct tcp_sock *tp, const struct tcphdr *th) |
@@ -710,7 +712,7 @@ static void tcp_event_data_recv(struct sock *sk, struct sk_buff *skb) | |||
710 | } | 712 | } |
711 | icsk->icsk_ack.lrcvtime = now; | 713 | icsk->icsk_ack.lrcvtime = now; |
712 | 714 | ||
713 | tcp_ecn_check_ce(tp, skb); | 715 | tcp_ecn_check_ce(sk, skb); |
714 | 716 | ||
715 | if (skb->len >= 128) | 717 | if (skb->len >= 128) |
716 | tcp_grow_window(sk, skb); | 718 | tcp_grow_window(sk, skb); |
@@ -4434,7 +4436,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb) | |||
4434 | u32 seq, end_seq; | 4436 | u32 seq, end_seq; |
4435 | bool fragstolen; | 4437 | bool fragstolen; |
4436 | 4438 | ||
4437 | tcp_ecn_check_ce(tp, skb); | 4439 | tcp_ecn_check_ce(sk, skb); |
4438 | 4440 | ||
4439 | if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) { | 4441 | if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) { |
4440 | NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP); | 4442 | NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP); |