Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1677011pxu; Sun, 6 Dec 2020 03:43:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHtsjgWU0YosyozqvlZTjjNgGaOgnBeaVPu0l9wSvvpQZC2Ijo4w4xi7Xvtsx1xTXx37mc X-Received: by 2002:a50:bf4a:: with SMTP id g10mr14947267edk.288.1607255036422; Sun, 06 Dec 2020 03:43:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607255036; cv=none; d=google.com; s=arc-20160816; b=kJpISAHfmirFvNvkW5I46CsUTgdpK4ckQEZ4V8kIHGFv3jRFtuPfsOGkBpxFEm8GQY oC7Odx2+AjcxW4GPH3s+/qkHSS2bfqJfzP1O8kTDwF3trcQ0UsD3XdB5ygmRzNd9oTX4 giBVP68Ft01s2mrLVWibYTRYbIQy7awNMH5ACZ1Q0KGiH8b0yiaAJe1IUOq3FMQNthIW c4C8wSWl62QAKm71Xfdk2Rshc5Cj0uiktyMJM74UAxZS0wiuwkImCpP3mEF/ELofpRex JRfAFtvMSEXolVt1iyZZ3dpBW/8mQ3reEHhsvnh7EV3RbCWA8ZdEWARYqu5jXwwVXqu8 8H5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=eZKOFeyq60OHNP3E4L9s5A5QB4w61WROe1l3Aaa81vI=; b=VTh5Xwb2iYmjAA6mkxKHdRu6YkzIAfHEWeyZYbWZGiMI4sLDZmqALunnTVjs5DVGMh i/iPCMAEcNJGo28dnFLRJ8W3ZIBmE1SmrmwQRxP47070yyGLEnUXpNYbQ0uOVCBtPkux lKaD2ktwCkZap147+7AvvptkXqDyBdmjMKhQNNrsIDG7PhFUfRnVn1b3fPUGCznxomXs G7pSBRobbalAmqeV+ZCO4CYGO9UyY4MFnNuyHoe+kfpwfxE2l7CPt4RroBy2allNB2Dg V7DEieQxKT0foKYvuKEOnufEc94c/prznW6XSKmeJ3n1yq6kQNZgWuzd/shfDxZSdRZJ xzXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si4566789ejx.708.2020.12.06.03.43.33; Sun, 06 Dec 2020 03:43:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728495AbgLFLkM (ORCPT + 99 others); Sun, 6 Dec 2020 06:40:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:37302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728472AbgLFLkK (ORCPT ); Sun, 6 Dec 2020 06:40:10 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Duyck , Jakub Kicinski Subject: [PATCH 4.19 06/32] tcp: Set INET_ECN_xmit configuration in tcp_reinit_congestion_control Date: Sun, 6 Dec 2020 12:17:06 +0100 Message-Id: <20201206111556.085997068@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206111555.787862631@linuxfoundation.org> References: <20201206111555.787862631@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Duyck [ Upstream commit 55472017a4219ca965a957584affdb17549ae4a4 ] When setting congestion control via a BPF program it is seen that the SYN/ACK for packets within a given flow will not include the ECT0 flag. A bit of simple printk debugging shows that when this is configured without BPF we will see the value INET_ECN_xmit value initialized in tcp_assign_congestion_control however when we configure this via BPF the socket is in the closed state and as such it isn't configured, and I do not see it being initialized when we transition the socket into the listen state. The result of this is that the ECT0 bit is configured based on whatever the default state is for the socket. Any easy way to reproduce this is to monitor the following with tcpdump: tools/testing/selftests/bpf/test_progs -t bpf_tcp_ca Without this patch the SYN/ACK will follow whatever the default is. If dctcp all SYN/ACK packets will have the ECT0 bit set, and if it is not then ECT0 will be cleared on all SYN/ACK packets. With this patch applied the SYN/ACK bit matches the value seen on the other packets in the given stream. Fixes: 91b5b21c7c16 ("bpf: Add support for changing congestion control") Signed-off-by: Alexander Duyck Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_cong.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c @@ -196,6 +196,11 @@ static void tcp_reinit_congestion_contro icsk->icsk_ca_setsockopt = 1; memset(icsk->icsk_ca_priv, 0, sizeof(icsk->icsk_ca_priv)); + if (ca->flags & TCP_CONG_NEEDS_ECN) + INET_ECN_xmit(sk); + else + INET_ECN_dontxmit(sk); + if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) tcp_init_congestion_control(sk); }