linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: joakim.misund@gmail.com
To: unlisted-recipients:; (no To-header on input)
Cc: joakim.misund@gmail.com, Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] tcp: Added check of destination specific CC before sending syn/ack
Date: Mon,  9 Jul 2018 13:25:53 +0200	[thread overview]
Message-ID: <20180709112554.32754-1-joakim.misund@gmail.com> (raw)

From: Joakim Misund <joakim.misund@gmail.com>

Issue:
Currently TCP stack does not check for a destination specific CC before responding to a syn with a syn/ack.
The system wide default CC is used. If the default CC does not need ECN, but the destination specific does,
the syn/ack will not carry ECT(0) which makes it eligible to drop instead of being marked at routers.
In an ECN-based network ECN marks are frequent (likely) and packet not carrying ECT(0) are likely to be dropped.
This leads to slow connection establishment, and in worst case the establishment can fail.

Signed-off-by: Joakim Misund <joakim.misund@gmail.com>
---
 include/net/tcp.h     | 1 +
 net/ipv4/tcp_input.c  | 2 ++
 net/ipv4/tcp_output.c | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index af3ec72d5d41..347c59ac0a72 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -545,6 +545,7 @@ void tcp_send_loss_probe(struct sock *sk);
 bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto);
 void tcp_skb_collapse_tstamp(struct sk_buff *skb,
 			     const struct sk_buff *next_skb);
+void tcp_ca_dst_init(struct sock *sk, const struct dst_entry *dst);
 
 /* tcp_input.c */
 void tcp_rearm_rto(struct sock *sk);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 8e5522c6833a..973e3b5b0516 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6401,6 +6401,8 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
 		isn = af_ops->init_seq(skb);
 	}
 
+	tcp_ca_dst_init(sk, dst);
+
 	tcp_ecn_create_request(req, skb, sk, dst);
 
 	if (want_cookie) {
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 8e08b409c71e..550597acd48c 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -3256,7 +3256,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
 }
 EXPORT_SYMBOL(tcp_make_synack);
 
-static void tcp_ca_dst_init(struct sock *sk, const struct dst_entry *dst)
+void tcp_ca_dst_init(struct sock *sk, const struct dst_entry *dst)
 {
 	struct inet_connection_sock *icsk = inet_csk(sk);
 	const struct tcp_congestion_ops *ca;
-- 
2.17.1


             reply	other threads:[~2018-07-09 11:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 11:25 joakim.misund [this message]
2018-07-09 11:54 ` [PATCH] tcp: Added check of destination specific CC before sending syn/ack Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180709112554.32754-1-joakim.misund@gmail.com \
    --to=joakim.misund@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).