Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2388759pxu; Mon, 7 Dec 2020 05:29:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJw46ug8WKgJkt3Zcoq/9V0ReuUc0Ke/xHOGXi6RA+3iW4HTFHiV0WIddrqbvklbVgT3qbJe X-Received: by 2002:a17:906:3a4e:: with SMTP id a14mr19161250ejf.140.1607347752042; Mon, 07 Dec 2020 05:29:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607347752; cv=none; d=google.com; s=arc-20160816; b=MjSV0+d9hyViaQDQn+vQiAzc4XYJl3Rs2g7gJQ7i55BtMj7SjQX5xMjIB+nTmb8MWl dd5P3HrQ0P32gNCs6My1cl9vzdXzyY0DWb0V8R82pzmB1StJK240iV60vsJO0wBaTuwU NAWjPUWTaNOv+opkSQVola42KQAahgzIzl12o4F82d6/yJjCcHO8mK4QRuZnjR2CjVxD vx3Y6YrVa+wdvsqzvc4j11Qc1AYkOw7fT4iZDyyeR/4XQ1j2brZW1OkkEz2vmHMhTNDf 56w8jkKcznsGVeDpjLCiQU48u627doDqt7kSCfJjY7uYT9jF9aVclKS8AmAkzJkvMED0 MIHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GUF0obSd4VoBjnotD58UAfe+GcsZfRAHuRtUll6vREE=; b=wkzrrL34xrYbfTsd/ZZAJsFMsgB0WaY+/3voYSCyfFmH6LfNCGDa6sYvnqu+g+TmOL VyPamhVSHIFCbIiB8noxI/DAjThF4ttB4Xr6s3lpik6Jfbo7JZxlS9r4ZoWuBDl5eEnO /4J6PYQEaEWtJLBBMMLcRoJDV8CUKayb9giG/w36JKKYNZmD6SzxXbnFp2PcfsVcAWku t0j8wQJQENYrnabGKC0BQStlRo/rZkRgL16EatlHkxEE/4TLKD9BJFxkqPh4cQNcLFui ePvI5HJJdsoIBon9lxoPXU8GV71QM+qP5Yyq3bBpwJM5lEt/URdYym6SqYIRcw0jK2/D AXhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.co.jp header.s=amazon201209 header.b=e1jAaR+Z; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.jp Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si1923466ejr.672.2020.12.07.05.28.49; Mon, 07 Dec 2020 05:29:12 -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; dkim=pass header.i=@amazon.co.jp header.s=amazon201209 header.b=e1jAaR+Z; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.jp Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726611AbgLGN02 (ORCPT + 99 others); Mon, 7 Dec 2020 08:26:28 -0500 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:36461 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbgLGN02 (ORCPT ); Mon, 7 Dec 2020 08:26:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.co.jp; i=@amazon.co.jp; q=dns/txt; s=amazon201209; t=1607347586; x=1638883586; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=GUF0obSd4VoBjnotD58UAfe+GcsZfRAHuRtUll6vREE=; b=e1jAaR+Z4b4eRoATrelGpp+Q1AbpjCIMiSxp9SAbqxOZqBecH1wWZA2B rEaR4vKqJn1bN7g6290EtqwQMGlENYjgtfYPv303s1SaUPYryEb28RGgI 6ZSp3BA+HjFoHTTbn69tIKrN+vcNj4GIOs16zpv4saqYARb56EqLmVKlT s=; X-IronPort-AV: E=Sophos;i="5.78,399,1599523200"; d="scan'208";a="67699577" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 07 Dec 2020 13:25:59 +0000 Received: from EX13MTAUWB001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (Postfix) with ESMTPS id B8C93A2040; Mon, 7 Dec 2020 13:25:56 +0000 (UTC) Received: from EX13D04ANC001.ant.amazon.com (10.43.157.89) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 7 Dec 2020 13:25:55 +0000 Received: from 38f9d3582de7.ant.amazon.com (10.43.161.43) by EX13D04ANC001.ant.amazon.com (10.43.157.89) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 7 Dec 2020 13:25:45 +0000 From: Kuniyuki Iwashima To: "David S . Miller" , Jakub Kicinski , Eric Dumazet , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau CC: Benjamin Herrenschmidt , Kuniyuki Iwashima , Kuniyuki Iwashima , , , Subject: [PATCH v2 bpf-next 02/13] bpf: Define migration types for SO_REUSEPORT. Date: Mon, 7 Dec 2020 22:24:45 +0900 Message-ID: <20201207132456.65472-3-kuniyu@amazon.co.jp> X-Mailer: git-send-email 2.17.2 (Apple Git-113) In-Reply-To: <20201207132456.65472-1-kuniyu@amazon.co.jp> References: <20201207132456.65472-1-kuniyu@amazon.co.jp> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.43] X-ClientProxiedBy: EX13D37UWC002.ant.amazon.com (10.43.162.123) To EX13D04ANC001.ant.amazon.com (10.43.157.89) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As noted in the preceding commit, there are two migration types. In addition to that, the kernel will run the same eBPF program to select a listener for SYN packets. This patch defines three types to signal the kernel and the eBPF program if it is receiving a new request or migrating ESTABLISHED/SYN_RECV sockets in the accept queue or NEW_SYN_RECV socket during 3WHS. Signed-off-by: Kuniyuki Iwashima --- include/uapi/linux/bpf.h | 14 ++++++++++++++ tools/include/uapi/linux/bpf.h | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 1233f14f659f..7a48e0055500 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -4423,6 +4423,20 @@ struct sk_msg_md { __bpf_md_ptr(struct bpf_sock *, sk); /* current socket */ }; +/* Migration type for SO_REUSEPORT enabled TCP sockets. + * + * BPF_SK_REUSEPORT_MIGRATE_NO : Select a listener for SYN packets. + * BPF_SK_REUSEPORT_MIGRATE_QUEUE : Migrate ESTABLISHED and SYN_RECV sockets in + * the accept queue at close() or shutdown(). + * BPF_SK_REUSEPORT_MIGRATE_REQUEST : Migrate NEW_SYN_RECV socket at receiving the + * final ACK of 3WHS or retransmitting SYN+ACKs. + */ +enum { + BPF_SK_REUSEPORT_MIGRATE_NO, + BPF_SK_REUSEPORT_MIGRATE_QUEUE, + BPF_SK_REUSEPORT_MIGRATE_REQUEST, +}; + struct sk_reuseport_md { /* * Start of directly accessible data. It begins from diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 1233f14f659f..7a48e0055500 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -4423,6 +4423,20 @@ struct sk_msg_md { __bpf_md_ptr(struct bpf_sock *, sk); /* current socket */ }; +/* Migration type for SO_REUSEPORT enabled TCP sockets. + * + * BPF_SK_REUSEPORT_MIGRATE_NO : Select a listener for SYN packets. + * BPF_SK_REUSEPORT_MIGRATE_QUEUE : Migrate ESTABLISHED and SYN_RECV sockets in + * the accept queue at close() or shutdown(). + * BPF_SK_REUSEPORT_MIGRATE_REQUEST : Migrate NEW_SYN_RECV socket at receiving the + * final ACK of 3WHS or retransmitting SYN+ACKs. + */ +enum { + BPF_SK_REUSEPORT_MIGRATE_NO, + BPF_SK_REUSEPORT_MIGRATE_QUEUE, + BPF_SK_REUSEPORT_MIGRATE_REQUEST, +}; + struct sk_reuseport_md { /* * Start of directly accessible data. It begins from -- 2.17.2 (Apple Git-113)