aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-07-13 21:30:19 -0400
committerDavid S. Miller <davem@davemloft.net>2018-07-13 21:30:19 -0400
commit6bed5e260709897cf918ca262b8e68a17227ec4b (patch)
treee2c8dcd7afb92e790d652b6d096cafe837946faa
parent5fc853cc01c68f84984ecc2d5fd777ecad78240f (diff)
parenta69258f7aa2623e0930212f09c586fd06674ad79 (diff)
Merge branch 'fix-DCTCP-delayed-ACK'
Yuchung Cheng says: ==================== fix DCTCP delayed ACK This patch series addresses the issue that sometimes DCTCP fail to acknowledge the latest sequence and result in sender timeout if inflight is small. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/tcp.h2
-rw-r--r--net/ipv4/tcp_dctcp.c31
-rw-r--r--net/ipv4/tcp_output.c4
3 files changed, 4 insertions, 33 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index af3ec72d5d41..3482d13d655b 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -912,8 +912,6 @@ enum tcp_ca_event {
912 CA_EVENT_LOSS, /* loss timeout */ 912 CA_EVENT_LOSS, /* loss timeout */
913 CA_EVENT_ECN_NO_CE, /* ECT set, but not CE marked */ 913 CA_EVENT_ECN_NO_CE, /* ECT set, but not CE marked */
914 CA_EVENT_ECN_IS_CE, /* received CE marked IP packet */ 914 CA_EVENT_ECN_IS_CE, /* received CE marked IP packet */
915 CA_EVENT_DELAYED_ACK, /* Delayed ack is sent */
916 CA_EVENT_NON_DELAYED_ACK,
917}; 915};
918 916
919/* Information about inbound ACK, passed to cong_ops->in_ack_event() */ 917/* Information about inbound ACK, passed to cong_ops->in_ack_event() */
diff --git a/net/ipv4/tcp_dctcp.c b/net/ipv4/tcp_dctcp.c
index 5f5e5936760e..5869f89ca656 100644
--- a/net/ipv4/tcp_dctcp.c
+++ b/net/ipv4/tcp_dctcp.c
@@ -55,7 +55,6 @@ struct dctcp {
55 u32 dctcp_alpha; 55 u32 dctcp_alpha;
56 u32 next_seq; 56 u32 next_seq;
57 u32 ce_state; 57 u32 ce_state;
58 u32 delayed_ack_reserved;
59 u32 loss_cwnd; 58 u32 loss_cwnd;
60}; 59};
61 60
@@ -96,7 +95,6 @@ static void dctcp_init(struct sock *sk)
96 95
97 ca->dctcp_alpha = min(dctcp_alpha_on_init, DCTCP_MAX_ALPHA); 96 ca->dctcp_alpha = min(dctcp_alpha_on_init, DCTCP_MAX_ALPHA);
98 97
99 ca->delayed_ack_reserved = 0;
100 ca->loss_cwnd = 0; 98 ca->loss_cwnd = 0;
101 ca->ce_state = 0; 99 ca->ce_state = 0;
102 100
@@ -134,7 +132,8 @@ static void dctcp_ce_state_0_to_1(struct sock *sk)
134 /* State has changed from CE=0 to CE=1 and delayed 132 /* State has changed from CE=0 to CE=1 and delayed
135 * ACK has not sent yet. 133 * ACK has not sent yet.
136 */ 134 */
137 if (!ca->ce_state && ca->delayed_ack_reserved) { 135 if (!ca->ce_state &&
136 inet_csk(sk)->icsk_ack.pending & ICSK_ACK_TIMER) {
138 u32 tmp_rcv_nxt; 137 u32 tmp_rcv_nxt;
139 138
140 /* Save current rcv_nxt. */ 139 /* Save current rcv_nxt. */
@@ -164,7 +163,8 @@ static void dctcp_ce_state_1_to_0(struct sock *sk)
164 /* State has changed from CE=1 to CE=0 and delayed 163 /* State has changed from CE=1 to CE=0 and delayed
165 * ACK has not sent yet. 164 * ACK has not sent yet.
166 */ 165 */
167 if (ca->ce_state && ca->delayed_ack_reserved) { 166 if (ca->ce_state &&
167 inet_csk(sk)->icsk_ack.pending & ICSK_ACK_TIMER) {
168 u32 tmp_rcv_nxt; 168 u32 tmp_rcv_nxt;
169 169
170 /* Save current rcv_nxt. */ 170 /* Save current rcv_nxt. */
@@ -248,25 +248,6 @@ static void dctcp_state(struct sock *sk, u8 new_state)
248 } 248 }
249} 249}
250 250
251static void dctcp_update_ack_reserved(struct sock *sk, enum tcp_ca_event ev)
252{
253 struct dctcp *ca = inet_csk_ca(sk);
254
255 switch (ev) {
256 case CA_EVENT_DELAYED_ACK:
257 if (!ca->delayed_ack_reserved)
258 ca->delayed_ack_reserved = 1;
259 break;
260 case CA_EVENT_NON_DELAYED_ACK:
261 if (ca->delayed_ack_reserved)
262 ca->delayed_ack_reserved = 0;
263 break;
264 default:
265 /* Don't care for the rest. */
266 break;
267 }
268}
269
270static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev) 251static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev)
271{ 252{
272 switch (ev) { 253 switch (ev) {
@@ -276,10 +257,6 @@ static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev)
276 case CA_EVENT_ECN_NO_CE: 257 case CA_EVENT_ECN_NO_CE:
277 dctcp_ce_state_1_to_0(sk); 258 dctcp_ce_state_1_to_0(sk);
278 break; 259 break;
279 case CA_EVENT_DELAYED_ACK:
280 case CA_EVENT_NON_DELAYED_ACK:
281 dctcp_update_ack_reserved(sk, ev);
282 break;
283 default: 260 default:
284 /* Don't care for the rest. */ 261 /* Don't care for the rest. */
285 break; 262 break;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 8e08b409c71e..00e5a300ddb9 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -3523,8 +3523,6 @@ void tcp_send_delayed_ack(struct sock *sk)
3523 int ato = icsk->icsk_ack.ato; 3523 int ato = icsk->icsk_ack.ato;
3524 unsigned long timeout; 3524 unsigned long timeout;
3525 3525
3526 tcp_ca_event(sk, CA_EVENT_DELAYED_ACK);
3527
3528 if (ato > TCP_DELACK_MIN) { 3526 if (ato > TCP_DELACK_MIN) {
3529 const struct tcp_sock *tp = tcp_sk(sk); 3527 const struct tcp_sock *tp = tcp_sk(sk);
3530 int max_ato = HZ / 2; 3528 int max_ato = HZ / 2;
@@ -3581,8 +3579,6 @@ void tcp_send_ack(struct sock *sk)
3581 if (sk->sk_state == TCP_CLOSE) 3579 if (sk->sk_state == TCP_CLOSE)
3582 return; 3580 return;
3583 3581
3584 tcp_ca_event(sk, CA_EVENT_NON_DELAYED_ACK);
3585
3586 /* We are not putting this on the write queue, so 3582 /* We are not putting this on the write queue, so
3587 * tcp_transmit_skb() will set the ownership to this 3583 * tcp_transmit_skb() will set the ownership to this
3588 * sock. 3584 * sock.