netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Florian Westphal <fw@strlen.de>,
	netdev@vger.kernel.org, Daniel Borkmann <dborkman@redhat.com>,
	Glenn Judd <glenn.judd@morganstanley.com>
Subject: Re: [PATCH 2/5] net: tcp: add flag for ca to indicate that ECN is required
Date: Tue, 13 May 2014 11:18:42 +0200	[thread overview]
Message-ID: <20140513091842.GB13945@breakpoint.cc> (raw)
In-Reply-To: <1399938695.7973.37.camel@edumazet-glaptop2.roam.corp.google.com>

Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > +static inline bool tcp_ca_needs_ecn(const struct sock *sk)
> > +{
> > +	const struct inet_connection_sock *icsk = inet_csk(sk);
> > +
> > +	return icsk->icsk_ca_ops->flags & TCP_CONG_NEEDS_ECN;
> > +}
> > +
> >  static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
> >  {
> >  	const struct inet_connection_sock *icsk = inet_csk(sk);
> > @@ -856,6 +847,26 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
> >  		icsk->icsk_ca_ops->cwnd_event(sk, event);
> >  }
> >  
> > +/* RFC3168 : 6.1.1 SYN packets must not have ECT/ECN bits set
> > + *
> > + * If we receive a SYN packet with these bits set, it means a network is
> > + * playing bad games with TOS bits. In order to avoid possible false congestion
> > + * notifications, we disable TCP ECN negociation.
> > + */
> 
> looks like comment needs a change.

Right, thanks for catching this.

> > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> > index 694711a..1f983dd 100644
> > --- a/net/ipv4/tcp_output.c
> > +++ b/net/ipv4/tcp_output.c
> > @@ -331,7 +331,8 @@ static inline void TCP_ECN_send_syn(struct sock *sk, struct sk_buff *skb)
> >  	struct tcp_sock *tp = tcp_sk(sk);
> >  
> >  	tp->ecn_flags = 0;
> > -	if (sock_net(sk)->ipv4.sysctl_tcp_ecn == 1) {
> > +	if (sock_net(sk)->ipv4.sysctl_tcp_ecn == 1 ||
> > +	    tcp_ca_needs_ecn(sk)) {
> >  		TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_ECE | TCPHDR_CWR;
> >  		tp->ecn_flags = TCP_ECN_OK;
> >  	}
> > @@ -953,6 +954,9 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
> >  	if (likely((tcb->tcp_flags & TCPHDR_SYN) == 0))
> >  		TCP_ECN_send(sk, skb, tcp_header_size);
> >  
> > +	if (tcp_ca_needs_ecn(sk))
> > +		INET_ECN_xmit(sk);
> 
> Why do we need this every time we send a packet ?

Indeed...  I'll change it.

> Its normally done in TCP_ECN_send(), where it probably makes sense to
> change the logic and add a comment why DCTCP sets ECT even for rtx
> packets ?

Sounds like an excellent suggestion, thanks Eric.

  reply	other threads:[~2014-05-13  9:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 20:59 [next PATCH 0/5] net: tcp: DCTCP congestion control algorithm Florian Westphal
2014-05-12 20:59 ` [PATCH 1/5] net: tcp: assign tcp cong_ops when tcp sk is created Florian Westphal
2014-05-12 20:59 ` [PATCH 2/5] net: tcp: add flag for ca to indicate that ECN is required Florian Westphal
2014-05-12 23:51   ` Eric Dumazet
2014-05-13  9:18     ` Florian Westphal [this message]
2014-05-12 20:59 ` [PATCH 3/5] net: tcp: split ack slow/fast events from cwnd_event Florian Westphal
2014-05-12 20:59 ` [PATCH 4/5] net: tcp: more detailed ACK events, and events for CE marked packets Florian Westphal
2014-05-13  4:41   ` Yuchung Cheng
2014-05-13 10:26     ` Florian Westphal
2014-05-12 20:59 ` [PATCH 5/5] net: tcp: add DCTCP congestion control algorithm Florian Westphal
2014-05-12 22:01 ` [next PATCH 0/5] net: tcp: " Cong Wang
2014-05-13  4:45   ` Stephen Hemminger
2014-05-13  9:34     ` Hagen Paul Pfeifer
2014-05-13  9:40       ` Eggert, Lars
2014-05-13 15:18       ` Stephen Hemminger

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=20140513091842.GB13945@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=dborkman@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=glenn.judd@morganstanley.com \
    --cc=netdev@vger.kernel.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).