From patchwork Thu Oct 17 10:55:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13839835 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 519E35478E for ; Thu, 17 Oct 2024 10:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729162554; cv=none; b=s7hoVuw1y3rJ2UQaEe2c583Cjr0LtcmYQS+lMETFPl6UwlMz5rjKc2WocwmLamvKIJw2S+fcMO8FhCoEjGhXJtSNA1FVH8vULhYDLr5DFjl4jymkH0oqIn2oxM2CA+eCuZTnXSsone9JnNP8EHTPh8FdeiyjCx5qqPX4/0wryKw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729162554; c=relaxed/simple; bh=PfB1yZw9mAsYcFrfCWKV3G1mUHHCMm+98nIELBImSJQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hLgLMgI9UywyqldLmkAb7rfLnRD3urIgxmurPZyuElu71lUkxwx1zvOcC4rov2dsqyeVanm2xQEHpcPsF6y+w5fpLZ3JpVOrcRUhpMJ/v7jL4xR7RR7Zz+fEWHJctbebrkH4rFZj/uv9UlJYaQ/GkdqdbQpQ2Vb+z1GwLxzGv/s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dI0Ydkc2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dI0Ydkc2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F43EC4CEC3; Thu, 17 Oct 2024 10:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729162554; bh=PfB1yZw9mAsYcFrfCWKV3G1mUHHCMm+98nIELBImSJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dI0Ydkc20HerOIqsURq4QkYYmij7h4xreZWKGr7TNMMtZCekUtXVffhPX+oEWqZmG 5CWkQYEtR5cx8BwxIFqS6vxwyKqn55vOuFMqdKzPqvhHZ0OGktaeSq2yMWXfrCx0Ow QjvY+34uPvK/R6TFCZHzuslnDjpn+uBOs8MFIh52fTl5n1sbADqwLpzUA/+wPNoTp9 AyrJbEtHt41XTk0orWUO3JTcQZnG/MhIT85H0U62gIKbYeOCc6f0ureVj1IANlZMXM vv6McwByR5Lv4dkFpnR0dIeCSmRD1d6jyoSqwkj6U647oMTwr9jmivdiNnsEff1atF wm/H9nomVNSBQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 1/3] Squash to "bpf: Register mptcp common kfunc set" Date: Thu, 17 Oct 2024 18:55:30 +0800 Message-ID: <41f7542b3fce0903d12f05dbdbd884b7bf0b9797.1729162349.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang bpf_mptcp_sk() definition is missing. It will be used in patch 4. Please update the commit log: ''' MPTCP helper mptcp_sk() is used to convert struct sock to mptcp_sock. Helpers mptcp_subflow_ctx() and mptcp_subflow_tcp_sock() are used to convert between struct mptcp_subflow_context and sock. They all will be used in MPTCP BPF programs too. This patch defines corresponding wrappers of them, and put the wrappers into mptcp common kfunc set and register the set with the flag BPF_PROG_TYPE_UNSPEC to let them accessible to all types of BPF programs. ''' Signed-off-by: Geliang Tang --- net/mptcp/bpf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index a2fd62c2777a..1ad7f703abb2 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -216,6 +216,11 @@ struct bpf_iter_mptcp_subflow_kern { __bpf_kfunc_start_defs(); +__bpf_kfunc static struct mptcp_sock *bpf_mptcp_sk(struct sock *sk) +{ + return mptcp_sk(sk); +} + __bpf_kfunc static struct mptcp_subflow_context * bpf_mptcp_subflow_ctx(const struct sock *sk) { @@ -291,6 +296,7 @@ __bpf_kfunc static bool bpf_mptcp_subflow_queues_empty(struct sock *sk) __bpf_kfunc_end_defs(); BTF_KFUNCS_START(bpf_mptcp_common_kfunc_ids) +BTF_ID_FLAGS(func, bpf_mptcp_sk) BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx) BTF_ID_FLAGS(func, bpf_mptcp_subflow_tcp_sock) BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new, KF_ITER_NEW | KF_TRUSTED_ARGS) From patchwork Thu Oct 17 10:55:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13839836 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 650EE1DAC9B for ; Thu, 17 Oct 2024 10:55:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729162557; cv=none; b=fydUotvwl70Sxm3SXESjNM2wusPeyutCi9djtV6raFuLVLNlbMDEkx6M+xeUbYceryHcZ4ZmC8iFZ4mrIfmJl1ss2kZ4BUD6rvYGZpS/QMoIi2IrlJl1QTCCyEm0ujCk9XoCrwgXrrwF8no2T3OFw8Dcb4vXaFLQINelxG6L3+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729162557; c=relaxed/simple; bh=SBYyz3UfP8B09or0JY+xbymOV/Qj9iiPUqV3IalP6FU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mOcmQ+M69oSug1ZSQNEYnkOaOGe3MP/S2m/qSO2vtNx4EWFSwOfoPjbTOk0HuXGOxCCLhv6crvc2XNz8nD/cX7vuZj9NGjcgQEH4BuE8SHZxUvxNYhxDiSQWeOio1CDVn4ZzxoSiydfGR3+bcdpS5URzFNeH5gkGO0MlUac6AoY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dVGew4Ze; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dVGew4Ze" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F9B2C4CEC3; Thu, 17 Oct 2024 10:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729162557; bh=SBYyz3UfP8B09or0JY+xbymOV/Qj9iiPUqV3IalP6FU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dVGew4ZetdcyjllArZvSBueWJnPbkjUfVA19kpglxiVXYRBRC3CNQBVRlhqxM8mFJ RPtSSc9ANeewd6x5YzXvrsGaJ4C3aHS0IjTyRRe8nhIP5nl2v1LFCwaMLrLr7ne39h 9lZx3auQ34/Z7EreWqtuHN5X5f94jlQBzvGMCDk16IBTpp9QwndxEqVW4UkkCTVZ1j ffJY700JdJOeOFWk0kSwfEv4uvOFKn7Xj7mGL6r0BdGhsMwRebFXSyguGeuTbFh7WD GrVTE8nhXS8Qm+KkmG30r/BcplcW80gxRQ4pgtDyF/MQKJq8vaUGTsCYhkQuecdt9H uG5zjLN5ckZ1g== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 2/3] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter test prog" Date: Thu, 17 Oct 2024 18:55:31 +0800 Message-ID: <01292808c07fdaa9925d3be09a4ed1d8b82887f4.1729162349.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang Export bpf_mptcp_sk(), it is used in this test program. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/progs/mptcp_bpf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf.h b/tools/testing/selftests/bpf/progs/mptcp_bpf.h index b1f6e1fb467e..3b20cfd44505 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf.h +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf.h @@ -46,6 +46,7 @@ mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow) extern struct mptcp_sock *bpf_mptcp_sock_acquire(struct mptcp_sock *msk) __ksym; extern void bpf_mptcp_sock_release(struct mptcp_sock *msk) __ksym; +extern struct mptcp_sock *bpf_mptcp_sk(struct sock *sk) __ksym; extern struct mptcp_subflow_context * bpf_mptcp_subflow_ctx(const struct sock *sk) __ksym; extern struct sock * From patchwork Thu Oct 17 10:55:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13839837 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B74B71DAC9F for ; Thu, 17 Oct 2024 10:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729162561; cv=none; b=Psl3wOzyVDJAGR2+3EZC/XZTJu48j9urLRcjEUeQ5+tqP9ivgCv882HWhkw6DkIIMKOi0lmC0Yd78j0A//J50xelBFcTKYHd5ksf26TP+mWRscTWVcCwVBSgxHtqOwO+VCwhnAfAhN8F9UhbbtBjHbsa8bpz2zb1YCLMPj6K7eI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729162561; c=relaxed/simple; bh=hKQHcwvQPd4LoZMLqmnoTXI6VkLicWJ3JecdnYNwr68=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GqWQb2DzJj0j1m2jcJUwty7Sz+m5kJfyaDEUgARJoQOt4fuaaYRWzP5roLHsihbcpRt4bjnUYu4eWy0w9lywZy2qPVXfRHnF9G6HwbPFm1wLrf/eFK+YB75Wd2OKpjJlgtnmcFAsE6Rd8S8ghrv54QqYFUwwlMCniSdGiUdpe/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dFLJ7YZ9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dFLJ7YZ9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A6D8C4CEC3; Thu, 17 Oct 2024 10:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729162561; bh=hKQHcwvQPd4LoZMLqmnoTXI6VkLicWJ3JecdnYNwr68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dFLJ7YZ96R76Fg/FZ+cW+ooYESvumjPrfywS4JTwft5nXDK6o1dxkDfDrQUHy3oju S7+58jPWZSpp3m7+ylY/EKed1RbYiRWJKJ/6ffMTiuS/y7a2MvrNlboYyelzdI5tnZ k9MymnGhrZb2iD0eIzd1DTb0DpIzzbw6vBZ1iG3YtuTkpfJNWOYb2jkwUkZ8RMztWV zdQnf36jy9zkxKIFCBeWbvMpVNgd4SS32jErSuOjUALOhzDwU7BTuKDRH7AyCQK8yV mDLdP7sULi9U2RV1NWHsIp77kjrpZoyPaX4Hl2++u+T+fxC+t86dEvTbcrwMUB367p +JOIv4GlmLTJg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 3/3] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest" Date: Thu, 17 Oct 2024 18:55:32 +0800 Message-ID: <5c6243ea7e2429c75ff2cba228416194601d7ae6.1729162349.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang /home/tgl/mptcp_net-next/tools/testing/selftests/bpf/prog_tests/mptcp.c: In function 'test_iters_subflow': /home/tgl/mptcp_net-next/tools/testing/selftests/bpf/prog_tests/mptcp.c:546:13: error: unused variable 'err' [-Werror=unused-variable] 546 | int err; | ^~~ TEST-OBJ [test_progs] pe_preserve_elems.test.o Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_tests/mptcp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c index 6644fdaa10a5..7282e98a8f51 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -543,7 +543,6 @@ static void test_iters_subflow(void) struct mptcp_bpf_iters *skel; struct nstoken *nstoken; int cgroup_fd; - int err; cgroup_fd = test__join_cgroup("/iters_subflow"); if (!ASSERT_OK_FD(cgroup_fd, "join_cgroup: iters_subflow"))