tcp: use dctcp if enabled on the route to the initiator
[platform/kernel/linux-rpi.git] / net / ipv4 / tcp_input.c
index dc08e23..a8f515b 100644 (file)
@@ -6003,14 +6003,17 @@ static void tcp_ecn_create_request(struct request_sock *req,
        const struct net *net = sock_net(listen_sk);
        bool th_ecn = th->ece && th->cwr;
        bool ect, ecn_ok;
+       u32 ecn_ok_dst;
 
        if (!th_ecn)
                return;
 
        ect = !INET_ECN_is_not_ect(TCP_SKB_CB(skb)->ip_dsfield);
-       ecn_ok = net->ipv4.sysctl_tcp_ecn || dst_feature(dst, RTAX_FEATURE_ECN);
+       ecn_ok_dst = dst_feature(dst, DST_FEATURE_ECN_MASK);
+       ecn_ok = net->ipv4.sysctl_tcp_ecn || ecn_ok_dst;
 
-       if ((!ect && ecn_ok) || tcp_ca_needs_ecn(listen_sk))
+       if ((!ect && ecn_ok) || tcp_ca_needs_ecn(listen_sk) ||
+           (ecn_ok_dst & DST_FEATURE_ECN_CA))
                inet_rsk(req)->ecn_ok = 1;
 }