aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-24 20:31:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-24 20:31:47 -0400
commit0723090656a03940c5ea536342f109e34b8d1257 (patch)
treee44648aec5b63bbdd7ab71501b6207d6431dc709 /net/ipv4/tcp_output.c
parentf89ed2f880ccb117246ba095e12087d9c3df89c5 (diff)
parent03bc7cab7d7218088412a75e141696a89059ab00 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Handle stations tied to AP_VLANs properly during mac80211 hw reconfig. From Manikanta Pubbisetty. 2) Fix jump stack depth validation in nf_tables, from Taehee Yoo. 3) Fix quota handling in aRFS flow expiration of mlx5 driver, from Eran Ben Elisha. 4) Exit path handling fix in powerpc64 BPF JIT, from Daniel Borkmann. 5) Use ptr_ring_consume_bh() in page pool code, from Tariq Toukan. 6) Fix cached netdev name leak in nf_tables, from Florian Westphal. 7) Fix memory leaks on chain rename, also from Florian Westphal. 8) Several fixes to DCTCP congestion control ACK handling, from Yuchunk Cheng. 9) Missing rcu_read_unlock() in CAIF protocol code, from Yue Haibing. 10) Fix link local address handling with VRF, from David Ahern. 11) Don't clobber 'err' on a successful call to __skb_linearize() in skb_segment(). From Eric Dumazet. 12) Fix vxlan fdb notification races, from Roopa Prabhu. 13) Hash UDP fragments consistently, from Paolo Abeni. 14) If TCP receives lots of out of order tiny packets, we do really silly stuff. Make the out-of-order queue ending more robust to this kind of behavior, from Eric Dumazet. 15) Don't leak netlink dump state in nf_tables, from Florian Westphal. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (76 commits) net: axienet: Fix double deregister of mdio qmi_wwan: fix interface number for DW5821e production firmware ip: in cmsg IP(V6)_ORIGDSTADDR call pskb_may_pull bnx2x: Fix invalid memory access in rss hash config path. net/mlx4_core: Save the qpn from the input modifier in RST2INIT wrapper r8169: restore previous behavior to accept BIOS WoL settings cfg80211: never ignore user regulatory hint sock: fix sg page frag coalescing in sk_alloc_sg netfilter: nf_tables: move dumper state allocation into ->start tcp: add tcp_ooo_try_coalesce() helper tcp: call tcp_drop() from tcp_data_queue_ofo() tcp: detect malicious patterns in tcp_collapse_ofo_queue() tcp: avoid collapses in tcp_prune_queue() if possible tcp: free batches of packets in tcp_prune_ofo_queue() ip: hash fragments consistently ipv6: use fib6_info_hold_safe() when necessary can: xilinx_can: fix power management handling can: xilinx_can: fix incorrect clear of non-processed interrupts can: xilinx_can: fix RX overflow interrupt not being enabled can: xilinx_can: keep only 1-2 frames in TX FIFO to fix TX accounting ...
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 00e5a300ddb9..c4172c1fb198 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -160,7 +160,8 @@ static void tcp_event_data_sent(struct tcp_sock *tp,
160} 160}
161 161
162/* Account for an ACK we sent. */ 162/* Account for an ACK we sent. */
163static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts) 163static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts,
164 u32 rcv_nxt)
164{ 165{
165 struct tcp_sock *tp = tcp_sk(sk); 166 struct tcp_sock *tp = tcp_sk(sk);
166 167
@@ -171,6 +172,9 @@ static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts)
171 if (hrtimer_try_to_cancel(&tp->compressed_ack_timer) == 1) 172 if (hrtimer_try_to_cancel(&tp->compressed_ack_timer) == 1)
172 __sock_put(sk); 173 __sock_put(sk);
173 } 174 }
175
176 if (unlikely(rcv_nxt != tp->rcv_nxt))
177 return; /* Special ACK sent by DCTCP to reflect ECN */
174 tcp_dec_quickack_mode(sk, pkts); 178 tcp_dec_quickack_mode(sk, pkts);
175 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); 179 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
176} 180}
@@ -1023,8 +1027,8 @@ static void tcp_update_skb_after_send(struct tcp_sock *tp, struct sk_buff *skb)
1023 * We are working here with either a clone of the original 1027 * We are working here with either a clone of the original
1024 * SKB, or a fresh unique copy made by the retransmit engine. 1028 * SKB, or a fresh unique copy made by the retransmit engine.
1025 */ 1029 */
1026static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, 1030static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
1027 gfp_t gfp_mask) 1031 int clone_it, gfp_t gfp_mask, u32 rcv_nxt)
1028{ 1032{
1029 const struct inet_connection_sock *icsk = inet_csk(sk); 1033 const struct inet_connection_sock *icsk = inet_csk(sk);
1030 struct inet_sock *inet; 1034 struct inet_sock *inet;
@@ -1100,7 +1104,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
1100 th->source = inet->inet_sport; 1104 th->source = inet->inet_sport;
1101 th->dest = inet->inet_dport; 1105 th->dest = inet->inet_dport;
1102 th->seq = htonl(tcb->seq); 1106 th->seq = htonl(tcb->seq);
1103 th->ack_seq = htonl(tp->rcv_nxt); 1107 th->ack_seq = htonl(rcv_nxt);
1104 *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | 1108 *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) |
1105 tcb->tcp_flags); 1109 tcb->tcp_flags);
1106 1110
@@ -1141,7 +1145,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
1141 icsk->icsk_af_ops->send_check(sk, skb); 1145 icsk->icsk_af_ops->send_check(sk, skb);
1142 1146
1143 if (likely(tcb->tcp_flags & TCPHDR_ACK)) 1147 if (likely(tcb->tcp_flags & TCPHDR_ACK))
1144 tcp_event_ack_sent(sk, tcp_skb_pcount(skb)); 1148 tcp_event_ack_sent(sk, tcp_skb_pcount(skb), rcv_nxt);
1145 1149
1146 if (skb->len != tcp_header_size) { 1150 if (skb->len != tcp_header_size) {
1147 tcp_event_data_sent(tp, sk); 1151 tcp_event_data_sent(tp, sk);
@@ -1178,6 +1182,13 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
1178 return err; 1182 return err;
1179} 1183}
1180 1184
1185static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
1186 gfp_t gfp_mask)
1187{
1188 return __tcp_transmit_skb(sk, skb, clone_it, gfp_mask,
1189 tcp_sk(sk)->rcv_nxt);
1190}
1191
1181/* This routine just queues the buffer for sending. 1192/* This routine just queues the buffer for sending.
1182 * 1193 *
1183 * NOTE: probe0 timer is not checked, do not forget tcp_push_pending_frames, 1194 * NOTE: probe0 timer is not checked, do not forget tcp_push_pending_frames,
@@ -3571,7 +3582,7 @@ void tcp_send_delayed_ack(struct sock *sk)
3571} 3582}
3572 3583
3573/* This routine sends an ack and also updates the window. */ 3584/* This routine sends an ack and also updates the window. */
3574void tcp_send_ack(struct sock *sk) 3585void __tcp_send_ack(struct sock *sk, u32 rcv_nxt)
3575{ 3586{
3576 struct sk_buff *buff; 3587 struct sk_buff *buff;
3577 3588
@@ -3604,9 +3615,14 @@ void tcp_send_ack(struct sock *sk)
3604 skb_set_tcp_pure_ack(buff); 3615 skb_set_tcp_pure_ack(buff);
3605 3616
3606 /* Send it off, this clears delayed acks for us. */ 3617 /* Send it off, this clears delayed acks for us. */
3607 tcp_transmit_skb(sk, buff, 0, (__force gfp_t)0); 3618 __tcp_transmit_skb(sk, buff, 0, (__force gfp_t)0, rcv_nxt);
3619}
3620EXPORT_SYMBOL_GPL(__tcp_send_ack);
3621
3622void tcp_send_ack(struct sock *sk)
3623{
3624 __tcp_send_ack(sk, tcp_sk(sk)->rcv_nxt);
3608} 3625}
3609EXPORT_SYMBOL_GPL(tcp_send_ack);
3610 3626
3611/* This routine sends a packet with an out of date sequence 3627/* This routine sends a packet with an out of date sequence
3612 * number. It assumes the other end will try to ack it. 3628 * number. It assumes the other end will try to ack it.