From patchwork Wed Jan 9 02:12:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuchung Cheng X-Patchwork-Id: 1022274 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="uQd/mT/G"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43ZCMN5BcSz9sMQ for ; Wed, 9 Jan 2019 13:12:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729148AbfAICMq (ORCPT ); Tue, 8 Jan 2019 21:12:46 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41369 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728389AbfAICMq (ORCPT ); Tue, 8 Jan 2019 21:12:46 -0500 Received: by mail-pf1-f195.google.com with SMTP id b7so2857277pfi.8 for ; Tue, 08 Jan 2019 18:12:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nqyjCoIf1/D0VRs6bcWBTszn+WYxD3AqM78vBObsXwk=; b=uQd/mT/GatW3BLjOgJsv8i3ljk+X5uHZd5f4GFBmRMsMml4yavztUbSFT0B16DRs1w iELrb7sW8imppHkzBpZXLSEB9kMJxBpwE8i4m0GNXJiFMgPYe5hnS3vvq1kAUAmGJ6pY 0+Tjk5b7I/ltytGQwL3wQHqj0l6YpvbqBwYo+HHgXvLyfG7lxyv23Bw28ezvDo1w2i3t PfUWWYTCydrHJbzj/7hpYMG/WIGMp1UyyBTsVdiKRPeNgM74mKqaU4027m+6JJEGzmVq Km/wEs7nfrJBcVdnje0a7n+afSXaEgnooiaw7RIxNMYP7uILo+ztyhohDvtrWKOlQXKH 9NVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nqyjCoIf1/D0VRs6bcWBTszn+WYxD3AqM78vBObsXwk=; b=i2slMoSKwZRDb1NTLf6V8z9VrQnaMkjnf+ZgEpl6ycppZa8tKzzgLzTKPWFfDxUZq0 YefMLsVMPmyKAXVG++P2bMTZ8fQBPWOOwcMt5guXn8vtcCWGyNwuztq9sbz6185Vj6mC W2uXYNTh1fhOSRlm2kJ8Q1I8EZ4r8uiMNrqdZvMKTeopXVz1d+Dj47FvCJlNdZuzcrad 4ygXO/lzGKs8fmMYsJxxvLpIGsg/rVfQv8jidjStITkLKf4+aAtWcKNAHq5yU+pitY9j f6uevwV7LfpXbh6BRSdoZWzp8HUz6kXlBW0t4iM5/DTyOMCaiUSzx6vSbLvj00NsIDvB bfTg== X-Gm-Message-State: AJcUukfrjRAWJcV8gBvTlucqynmf5yIcoFZgAqQ9z1nO80kR7yzn2yWE c5dy9ZoUALa7CFdnn+QUQm4swg== X-Google-Smtp-Source: ALg8bN4Bf0lJKjj8eZTC2rEWI1ssLkdwY+bMRAHGrWp/9lZ3SweRjJAaLqNdtWmzf4T6049Vs//3TQ== X-Received: by 2002:a62:140a:: with SMTP id 10mr4039725pfu.157.1546999964370; Tue, 08 Jan 2019 18:12:44 -0800 (PST) Received: from ycheng2.svl.corp.google.com ([2620:15c:2c4:201:d660:6c0b:8a4f:4c77]) by smtp.gmail.com with ESMTPSA id c67sm94514683pfg.170.2019.01.08.18.12.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jan 2019 18:12:43 -0800 (PST) From: Yuchung Cheng To: ast@kernel.org, daniel@iogearbox.net Cc: netdev@vger.kernel.org, brakmo@fb.com, ncardwell@google.com, edumazet@google.com, Yuchung Cheng Subject: [PATCH bpf] bpf: correctly set initial window on active Fast Open sender Date: Tue, 8 Jan 2019 18:12:24 -0800 Message-Id: <20190109021224.6244-1-ycheng@google.com> X-Mailer: git-send-email 2.20.1.97.g81188d93c3-goog MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The existing BPF TCP initial congestion window (TCP_BPF_IW) does not to work on (active) Fast Open sender. This is because it changes the (initial) window only if data_segs_out is zero -- but data_segs_out is also incremented on SYN-data. This patch fixes the issue by proerly accounting for SYN-data additionally. Fixes: fc7478103c84 ("bpf: Adds support for setting initial cwnd") Signed-off-by: Yuchung Cheng Reviewed-by: Neal Cardwell Acked-by: Lawrence Brakmo --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index 447dd1bad31f..2b3b436ef545 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4203,7 +4203,7 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, /* Only some options are supported */ switch (optname) { case TCP_BPF_IW: - if (val <= 0 || tp->data_segs_out > 0) + if (val <= 0 || tp->data_segs_out > tp->syn_data) ret = -EINVAL; else tp->snd_cwnd = val;