From nobody Sat Dec 21 13:44:53 2024 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 4E3AB80C13 for ; Tue, 24 Sep 2024 09:10:03 +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=1727169004; cv=none; b=qez13kd93XvNkzCu1ztsOYnRD8zBa41NCACgm2GcCLNmiXxHY7MFSnC3u+Runin8sD2hl1wI2FyjrRu+jf/XHc1TJHimLXbuyiohImuH0Ttv78/BDA5qg16mjuMAsRj5xDzVHuzn4N7pHxFqREcW/aLDskHXi/yHsEoRcqHRO+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727169004; c=relaxed/simple; bh=AgV7K5szJxnDHwt6AY+DRY0novdmT9FMnxZuD9bvMQU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gw3pAJpvupmLN1aNXCEdipHNEAnJ7q7Kd0CwQ/v1HRxmAp7FcjqfAg2jNFhfC+iJOAZtBsHSA53Y2D1t92SXMfCRXZ+xcjWgOpXlLWQYOECHIvRVCTA5bPl7NJfllEEddWGA7EmHffg/hRxJmXCjYXzitjs82HygxkTgfUf1GxU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u9F1qRls; 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="u9F1qRls" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E898C4CEC6; Tue, 24 Sep 2024 09:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727169003; bh=AgV7K5szJxnDHwt6AY+DRY0novdmT9FMnxZuD9bvMQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u9F1qRlslgchG1vWs9AFoRdC4EAfaAgH6QuX+sYXrZgT8HCHFI9uncHbHY4/x/8zs ypTNxxNPs42Zt/RjP4r/43m4Ayn8FGL2fkr8QznrPNaqB/lrEr0DMPE/P+MCNRpetH JPJ8bu6HNCvMcnLOnU7Pf43sI4FeAgiOJYjnF0o8ywVKt2Sn7vPFgJq8Ixle48QzJU ZCv7FxQlJbMBhq3RTLYj5cbUoxnM7nRBrvis4M/MKitnUE+fbCNirv7onprE39AFpN 4o4C0u2DWQuQsxeHOZYbYi5fsoENWzKM+FXv77FNxTRvLJc0WAYCxDwJAaDhCFGWuw TzOcchbBV90NQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 01/10] bpf: Register mptcp common kfunc set Date: Tue, 24 Sep 2024 17:09:45 +0800 Message-ID: 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang The mptcp kfuncs mptcp_subflow_active(), mptcp_subflow_set_scheduled() and mptcp_sk() are going to be used in BPF selftests, so put them into mptcp common kfunc set and register it with BPF_PROG_TYPE_UNSPEC. Signed-off-by: Geliang Tang --- net/mptcp/bpf.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index 6414824402e6..959d1d6af036 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -205,6 +205,11 @@ __diag_push(); __diag_ignore_all("-Wmissing-prototypes", "kfuncs which will be used in BPF programs"); =20 +__bpf_kfunc struct mptcp_sock *bpf_mptcp_sk(struct sock *sk) +{ + return mptcp_sk(sk); +} + __bpf_kfunc struct mptcp_subflow_context * bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned= int pos) { @@ -220,10 +225,19 @@ __bpf_kfunc bool bpf_mptcp_subflow_queues_empty(struc= t sock *sk) =20 __diag_pop(); =20 +BTF_KFUNCS_START(bpf_mptcp_common_kfunc_ids) +BTF_ID_FLAGS(func, mptcp_subflow_active) +BTF_ID_FLAGS(func, bpf_mptcp_sk) +BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids) + +static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set =3D { + .owner =3D THIS_MODULE, + .set =3D &bpf_mptcp_common_kfunc_ids, +}; + BTF_KFUNCS_START(bpf_mptcp_sched_kfunc_ids) BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled) BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx_by_pos) -BTF_ID_FLAGS(func, mptcp_subflow_active) BTF_ID_FLAGS(func, mptcp_set_timeout) BTF_ID_FLAGS(func, mptcp_wnd_end) BTF_ID_FLAGS(func, tcp_stream_memory_free) @@ -241,6 +255,8 @@ static int __init bpf_mptcp_kfunc_init(void) int ret; =20 ret =3D register_btf_fmodret_id_set(&bpf_mptcp_fmodret_set); + ret =3D ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_UNSPEC, + &bpf_mptcp_common_kfunc_set); ret =3D ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS, &bpf_mptcp_sched_kfunc_set); #ifdef CONFIG_BPF_JIT --=20 2.43.0 From nobody Sat Dec 21 13:44:53 2024 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 C4E0680C13 for ; Tue, 24 Sep 2024 09:10:05 +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=1727169005; cv=none; b=SMOtxPXKMrMGyCYcZ+35HaARqREGBa3DVM/GRcQ5ocS8hl1aEUaDMl2KRPYq5UqnVxinJwIfz518zJVRQCx3/q+ygie0+Gc6ZLU3KFTaM3r8lWCW3zTOO27ROE6p8A/KusZ37AgNL+AWF8fxIikYRxMSQP7htfpuzx6gnBO7Ib4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727169005; c=relaxed/simple; bh=Ih0h8HtYHUSPF1Gh6spc0a6lNKdgk7FaVAHKTnyPUjM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U0XFUHUDxRRvV697JP0dfPQYqlwkWJR+TWZqVC+kdP6ng6YM1UnCS34u7Rdx4pNexnuPHdOQvzx4xU46iBbi15wqqhd6fTWqpv6crGZ87TCzNQABMEMsEGqRKFTQ8Bvp3ooD5Rk7sGzSynMsocC4axkl+21I4EiaUCzqDD3+Oyo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BoqFNSph; 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="BoqFNSph" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 772F7C4CEC4; Tue, 24 Sep 2024 09:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727169005; bh=Ih0h8HtYHUSPF1Gh6spc0a6lNKdgk7FaVAHKTnyPUjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BoqFNSphsRF8/YBBvVp+0cimzYp1RFY872nSxgOtq5W0qvdKesFk3xdJYBvNY1Y66 Nbyi740Cj5Hkyy1MX2SVE75GvhRnqz5MKtiL3IWSxzacl19Q+LOsPkdbTy6pHTHMP8 XzVb3EciECWV1QvNRQpDqNIa9A+csjAfmpDmA73EPa3CkK5WZrYnYuhIVCKbythHQz 8l/+zVKCTA/mdZom5vm/5+rX+7Jbfz6vdyYiduNjHNC3YLKCDb6s8619IA/eX0lYXC buvpcaCEnA4x3nvNxVbQ77mHTlq1+ayfuBn0AMiXucbO692R38jMZlq8EyKtERZTLO zua4j2nWWlDpw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 02/10] bpf: Add mptcp_subflow bpf_iter Date: Tue, 24 Sep 2024 17:09:46 +0800 Message-ID: <9139af7024b3de3389bf8d2ec4d5da91309940b3.1727168628.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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang It's necessary to traverse all subflows on the conn_list of an MPTCP socket and then call kfunc to modify the fields of each subflow. In kernel space, mptcp_for_each_subflow() helper is used for this: mptcp_for_each_subflow(msk, subflow) kfunc(subflow); But in the MPTCP BPF program, this has not yet been implemented. As Martin suggested recently, this conn_list walking + modify-by-kfunc usage fits the bpf_iter use case. So this patch adds a new bpf_iter type named "mptcp_subflow" to do this and implements its helpers bpf_iter_mptcp_subflow_new()/_next()/ _destroy(). And register these bpf_iter mptcp_subflow into mptcp common kfunc set. Then bpf_for_each() for mptcp_subflow can be used in BPF program like this: bpf_for_each(mptcp_subflow, subflow, msk) kfunc(subflow); v2: remove msk->pm.lock in _new() and _destroy() (Martin) drop DEFINE_BPF_ITER_FUNC, change opaque[3] to opaque[2] (Andrii) v3: drop bpf_iter__mptcp_subflow v4: if msk is NULL, initialize kit->msk to NULL in _new() and check it in _next() (Andrii) v5: use list_is_last() instead of list_entry_is_head() add KF_ITER_NEW/NEXT/DESTROY flags add msk_owned_by_me in _new() v6: add KF_TRUSTED_ARGS flag (Andrii, Martin) "Suggested-by: Martin KaFai Lau " Signed-off-by: Geliang Tang --- net/mptcp/bpf.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index 959d1d6af036..3e13bf126e0e 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -201,15 +201,53 @@ static const struct btf_kfunc_id_set bpf_mptcp_fmodre= t_set =3D { .set =3D &bpf_mptcp_fmodret_ids, }; =20 -__diag_push(); -__diag_ignore_all("-Wmissing-prototypes", - "kfuncs which will be used in BPF programs"); +struct bpf_iter_mptcp_subflow { + __u64 __opaque[2]; +} __attribute__((aligned(8))); + +struct bpf_iter_mptcp_subflow_kern { + struct mptcp_sock *msk; + struct list_head *pos; +} __attribute__((aligned(8))); + +__bpf_kfunc_start_defs(); =20 __bpf_kfunc struct mptcp_sock *bpf_mptcp_sk(struct sock *sk) { return mptcp_sk(sk); } =20 +__bpf_kfunc int bpf_iter_mptcp_subflow_new(struct bpf_iter_mptcp_subflow *= it, + struct mptcp_sock *msk) +{ + struct bpf_iter_mptcp_subflow_kern *kit =3D (void *)it; + + kit->msk =3D msk; + if (!msk) + return -EINVAL; + + msk_owned_by_me(msk); + + kit->pos =3D &msk->conn_list; + return 0; +} + +__bpf_kfunc struct mptcp_subflow_context * +bpf_iter_mptcp_subflow_next(struct bpf_iter_mptcp_subflow *it) +{ + struct bpf_iter_mptcp_subflow_kern *kit =3D (void *)it; + + if (!kit->msk || list_is_last(kit->pos, &kit->msk->conn_list)) + return NULL; + + kit->pos =3D kit->pos->next; + return list_entry(kit->pos, struct mptcp_subflow_context, node); +} + +__bpf_kfunc void bpf_iter_mptcp_subflow_destroy(struct bpf_iter_mptcp_subf= low *it) +{ +} + __bpf_kfunc struct mptcp_subflow_context * bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned= int pos) { @@ -223,11 +261,14 @@ __bpf_kfunc bool bpf_mptcp_subflow_queues_empty(struc= t sock *sk) return tcp_rtx_queue_empty(sk); } =20 -__diag_pop(); +__bpf_kfunc_end_defs(); =20 BTF_KFUNCS_START(bpf_mptcp_common_kfunc_ids) BTF_ID_FLAGS(func, mptcp_subflow_active) BTF_ID_FLAGS(func, bpf_mptcp_sk) +BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new, KF_ITER_NEW | KF_TRUSTED_AR= GS) +BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_next, KF_ITER_NEXT | KF_RET_NULL) +BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_destroy, KF_ITER_DESTROY) BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids) =20 static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set =3D { --=20 2.43.0 From nobody Sat Dec 21 13:44:53 2024 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 A5D8380C13 for ; Tue, 24 Sep 2024 09:10:07 +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=1727169007; cv=none; b=uimNkS9ipqvzmI1UG/y1gBpWXABqrJGSBXIPK2cSUnnwgr7tCFO90OwRbZIgynEKn5Nrij0YIuplhlp239VMB57Wp7of8AfvEHiOyAIDlMyRxXsBY4fNTcqdEJRBeShTlSUs5wWc5DrTb/JZXNKPYb6CDgY7vXqQha3WaxJXFR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727169007; c=relaxed/simple; bh=P7kYYdBgJb4t2O0r2+V/Ny8iY05lxoL8YcLH9Qfcgo0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=peUF1vN/7LFlsYj4RpNF2vjo5n0bU/uNnTkQX1FMFl2mXRbYvC8C9Kq+bFPoy17EWm3vJ5YaTM2P4CpS53DflrlLCRT1cPFTIOnT0VB/+V97/wWFneJXd4tiKHrTNwRF7jB5pZtHwHnUL00K4n021KU7qjt6d80l+K+dOrUWNQw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mmysWi49; 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="mmysWi49" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51231C4CEC4; Tue, 24 Sep 2024 09:10:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727169007; bh=P7kYYdBgJb4t2O0r2+V/Ny8iY05lxoL8YcLH9Qfcgo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mmysWi49XGDVrR2W7bux7VhqcX0ja3um+Wpbab5mF3AygrzXZSyxDAmbuNmye4kI2 zOJPtMs5MiU9eYN5LinO85NZ7fnpSvgrMGPaH851HYFKJJloPsewEk0OaB7AC9Pmm+ sEkq1i1IKCWAoo306BNSxVMYnnlfxD1bSFOXjtHLb6q2SbGk6FALhewj51HorPzKYC bUtlIdBFUa3UdViou//cYK1rvC3l8Ar3vS2rEO8GkJdWEqt7xm0Zwoo5nntNFvXLJ3 icRAPS83ws6kqziYeggYFA38lUXZtu6Ozqs9iOeUhP4P2ocq0uU3unXRGo0lZQjzsQ oQnhDnEQPLYdg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 03/10] bpf: Add mptcp_sock acquire and release helpers Date: Tue, 24 Sep 2024 17:09:47 +0800 Message-ID: <5279f8e3ea5ebbb7ec672803713970223096269d.1727168628.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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch adds bpf_mptcp_sock_acquire() and bpf_mptcp_sock_release() helpers. A refcounted object is added in struct mptcp_sock, increase it in _acquire() and decrease it in _release(). Register them with KF_ACQUIRE flag and KF_RELEASE flag. Signed-off-by: Geliang Tang --- net/mptcp/bpf.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index 3e13bf126e0e..32894d2246b2 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -248,6 +248,22 @@ __bpf_kfunc void bpf_iter_mptcp_subflow_destroy(struct= bpf_iter_mptcp_subflow *i { } =20 +__bpf_kfunc struct mptcp_sock *bpf_mptcp_sock_acquire(struct mptcp_sock *m= sk) +{ + struct sock *sk =3D (struct sock *)msk; + + if (sk && refcount_inc_not_zero(&sk->sk_refcnt)) + return msk; + return NULL; +} + +__bpf_kfunc void bpf_mptcp_sock_release(struct mptcp_sock *msk) +{ + struct sock *sk =3D (struct sock *)msk; + + WARN_ON_ONCE(!sk || !refcount_dec_not_one(&sk->sk_refcnt)); +} + __bpf_kfunc struct mptcp_subflow_context * bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned= int pos) { @@ -269,6 +285,8 @@ BTF_ID_FLAGS(func, bpf_mptcp_sk) BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new, KF_ITER_NEW | KF_TRUSTED_AR= GS) BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_next, KF_ITER_NEXT | KF_RET_NULL) BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_destroy, KF_ITER_DESTROY) +BTF_ID_FLAGS(func, bpf_mptcp_sock_acquire, KF_ACQUIRE | KF_RET_NULL) +BTF_ID_FLAGS(func, bpf_mptcp_sock_release, KF_RELEASE) BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids) =20 static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set =3D { --=20 2.43.0 From nobody Sat Dec 21 13:44:53 2024 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 7E59B80C13 for ; Tue, 24 Sep 2024 09:10:09 +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=1727169009; cv=none; b=sJ7vxlJXgGx4JWpVzm/sJ8CbYsshSvc+HlAru6yQ+ejrSoxjzU3HZlR7b2urKhD45sbCyRh6d2Uv+62eZS46wvHOJj4v1BAh+Id26woJZlPSWpLRsehRaI44z9tpAaf6LtSAjqqNaHcBq0sb4Rtcm/IwYPxKsh3m5BaADZ89fHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727169009; c=relaxed/simple; bh=5fLCxGFpHjELiPu/sDDRqRb7EBs7tE1st2nT3+IP+T0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oLox18naOMHlBhvraDF9wj7obm3sx0t5R1H2qUq7LkW1bXJyJiodjtouubVQeUFYr5Mhz84C6Iaa5m6BZLDtZIR2EAItMpTFIs7TIj7RTQiw5dOthS31yCnJDZ9dtr+69jtvX/qfHfuMMWK1BBCpyjyXLFAzazvzWj4QnlAu8/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ni46VGq+; 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="ni46VGq+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A709C4CEC5; Tue, 24 Sep 2024 09:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727169009; bh=5fLCxGFpHjELiPu/sDDRqRb7EBs7tE1st2nT3+IP+T0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ni46VGq+8eGNGNU1ZZ3EJAw7erz7gI98Xg0PAGCmhZULGF8kQnZZSnNRSrnPD0gJw KBDU8EtaM6gNHSVKkwR1l0o4cRgwXH+8brKOVSdd04H5znx4VhP1YpJYd6D0rE5bGH 6HVFlfHXn/zkAc1PpkuN38UB/Dm25uJtUGZFQwrDmVqiLQUsEFNfh1S7Da4rXvoUeS bEq4TyZouOsJLmVnbVk2nK1bpuJ3ErIHZ+tUfMZI5gQ/GiNfQRqh3aBUv+/ZWqZb3H 9RYcSLnXPDPC9fds6taiIAO54XGJTgkQXwmy6llRc98cPRRm/2enAihbO+fKByEf5l kdrn8QRWYR59A== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 04/10] selftests/bpf: Add mptcp_subflow bpf_iter test prog Date: Tue, 24 Sep 2024 17:09:48 +0800 Message-ID: <6b52ba4a67304ccb3b36f9e098a8e26d9ffb58ff.1727168628.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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch adds a new mptcp bpf selftest program in "cgroup/getsockopt" for the newly added mptcp_subflow bpf_iter. Export bpf_mptcp_sk, bpf_iter_mptcp_subflow_new/_next/_destroy and bpf_mptcp_sock_acquire/_release into bpf_experimental.h, then use bpf_for_each(mptcp_subflow, subflow, msk) to walk the mptcp subflow list. Invoke kfuncs mptcp_subflow_active() and mptcp_subflow_set_scheduled() in bpf_for_each loop. Signed-off-by: Geliang Tang --- .../testing/selftests/bpf/bpf_experimental.h | 7 +++ tools/testing/selftests/bpf/progs/mptcp_bpf.h | 6 +++ .../selftests/bpf/progs/mptcp_bpf_iter.c | 46 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/mptcp_bpf_iter.c diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing= /selftests/bpf/bpf_experimental.h index 828556cdc2f0..97aad95c90c6 100644 --- a/tools/testing/selftests/bpf/bpf_experimental.h +++ b/tools/testing/selftests/bpf/bpf_experimental.h @@ -549,6 +549,13 @@ extern int bpf_iter_css_new(struct bpf_iter_css *it, extern struct cgroup_subsys_state *bpf_iter_css_next(struct bpf_iter_css *= it) __weak __ksym; extern void bpf_iter_css_destroy(struct bpf_iter_css *it) __weak __ksym; =20 +struct bpf_iter_mptcp_subflow; +extern int bpf_iter_mptcp_subflow_new(struct bpf_iter_mptcp_subflow *it, + struct mptcp_sock *msk) __weak __ksym; +extern struct mptcp_subflow_context * +bpf_iter_mptcp_subflow_next(struct bpf_iter_mptcp_subflow *it) __weak __ks= ym; +extern void bpf_iter_mptcp_subflow_destroy(struct bpf_iter_mptcp_subflow *= it) __weak __ksym; + extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags= ) __weak __ksym; extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ks= ym; extern int bpf_wq_set_callback_impl(struct bpf_wq *wq, diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf.h b/tools/testing/= selftests/bpf/progs/mptcp_bpf.h index c3800f986ae1..ab46b66422c4 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf.h +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf.h @@ -43,6 +43,12 @@ mptcp_subflow_tcp_sock(const struct mptcp_subflow_contex= t *subflow) } =20 /* ksym */ +extern bool mptcp_subflow_active(struct mptcp_subflow_context *subflow) __= ksym; +extern struct mptcp_sock *bpf_mptcp_sk(struct sock *sk) __ksym; + +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 void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subf= low, bool scheduled) __ksym; =20 diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_iter.c b/tools/tes= ting/selftests/bpf/progs/mptcp_bpf_iter.c new file mode 100644 index 000000000000..39240df5bc3c --- /dev/null +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_iter.c @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2024, Kylin Software */ + +/* vmlinux.h, bpf_helpers.h and other 'define' */ +#include "bpf_tracing_net.h" +#include "mptcp_bpf.h" + +char _license[] SEC("license") =3D "GPL"; +int subflows; +int pid; + +SEC("cgroup/getsockopt") +int mptcp_getsockopt(struct bpf_sockopt *ctx) +{ + struct mptcp_subflow_context *subflow; + struct bpf_sock *sk =3D ctx->sk; + struct mptcp_sock *msk; + + if (bpf_get_current_pid_tgid() >> 32 !=3D pid) + return 1; + + if (!sk || sk->protocol !=3D IPPROTO_MPTCP || + ctx->level !=3D SOL_TCP || ctx->optname !=3D TCP_CONGESTION) + return 1; + + msk =3D bpf_mptcp_sock_acquire(bpf_mptcp_sk((struct sock *)sk)); + if (!msk) + return 1; + + subflows =3D 0; + + bpf_for_each(mptcp_subflow, subflow, msk) { + if (subflow->token !=3D msk->token) { + ctx->retval =3D -1; + break; + } + + if (!mptcp_subflow_active(subflow)) + continue; + + subflows++; + } + bpf_mptcp_sock_release(msk); + + return 1; +} --=20 2.43.0 From nobody Sat Dec 21 13:44:53 2024 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 9B1F280C13 for ; Tue, 24 Sep 2024 09:10:11 +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=1727169011; cv=none; b=l1gC/raAlShJvyUy/lA4OlwK79pdTYmm9Bm2c7KfB3bw4AyWETTdS8oEQpaEBNpdyxHF2NzTAt2B482ynQW3UG/7rbR6gZov7Qsji3ehjTDyVEuHLfMxpLvZk60A09qS/zWcfcKTAISds5weS+0H4xUhASsZUyg+xYfvitsyL3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727169011; c=relaxed/simple; bh=PqhL1+HJ5QSdK+L/sMvyJR56R2rzBeswxSui00kjs7k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uVxhcx3OMw/Yrvr40/kLmvts0PCxjGKolxCys+oVDOD1wVyMmB+ES/Il6AfS/APjEAqYPYavPsGFbIvYrOu9CkNvsOFEYVW1yIv3T0qF7EZSHtfJOfc+hMFb6ql5AlycxsP/DDk5o3/X3HcOzn+LoDbOi5mU921u5tUK4pOAFuI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sEvBaC3O; 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="sEvBaC3O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 047FCC4CEC5; Tue, 24 Sep 2024 09:10:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727169011; bh=PqhL1+HJ5QSdK+L/sMvyJR56R2rzBeswxSui00kjs7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sEvBaC3ORMDOBdehw26yOY/qF2CtazLBgdYvi7GK2SwYEqMKNMRK/jw2pdrdbLc8s ZUSxgP0RZJ4wgM4t74oYBBjM7HYl60k8Htv4/l2gCWmvh6avN0uluzIbi6MleKIDEf weBe+uV1KQltMb0qG/QI6oVtXsraF2lfyaK8QawHORsW1tIGTPfM15SpXKXFWVIRUV q8AHaTFb0mM4OQz7gUNAZwgu25MQMpHRLs9OLwD59AhjUylPNG1b/+pJKfplrgAJkI 58ZHz1sQvB4esVbIME2muG/G4q7tLOTNBHSELzt6/O/4dfL04dRsYsPt2cHDSA/jCn YzGRL21yYT+VA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 05/10] selftests/bpf: More endpoints for endpoint_init Date: Tue, 24 Sep 2024 17:09:49 +0800 Message-ID: <59ad691caaab9468b15faa4300b05890fcddb792.1727168628.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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch adds two more test addresses ADDR_3 and ADDR_4, and adds a new helper address_init() to initialize all these addresses. Add a new parameter "endpoints" for endpoint_init() to control how many endpoints are used for the tests. This makes it more flexible. Update the parameters of endpoint_init() in test_subflow(). Signed-off-by: Geliang Tang --- .../testing/selftests/bpf/prog_tests/mptcp.c | 46 +++++++++++++++++-- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing= /selftests/bpf/prog_tests/mptcp.c index acd79be134cd..076903680e75 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -20,6 +20,8 @@ #define NS_TEST "mptcp_ns" #define ADDR_1 "10.0.1.1" #define ADDR_2 "10.0.1.2" +#define ADDR_3 "10.0.1.3" +#define ADDR_4 "10.0.1.4" #define PORT_1 10001 #define WITH_DATA true #define WITHOUT_DATA false @@ -351,22 +353,56 @@ static void test_mptcpify(void) close(cgroup_fd); } =20 -static int endpoint_init(char *flags) +static int address_init(void) { SYS(fail, "ip -net %s link add veth1 type veth peer name veth2", NS_TEST); SYS(fail, "ip -net %s addr add %s/24 dev veth1", NS_TEST, ADDR_1); SYS(fail, "ip -net %s link set dev veth1 up", NS_TEST); SYS(fail, "ip -net %s addr add %s/24 dev veth2", NS_TEST, ADDR_2); SYS(fail, "ip -net %s link set dev veth2 up", NS_TEST); - if (SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s", NS_TEST, ADDR_2, fl= ags)) { + + SYS(fail, "ip -net %s link add veth3 type veth peer name veth4", NS_TEST); + SYS(fail, "ip -net %s addr add %s/24 dev veth3", NS_TEST, ADDR_3); + SYS(fail, "ip -net %s link set dev veth3 up", NS_TEST); + SYS(fail, "ip -net %s addr add %s/24 dev veth4", NS_TEST, ADDR_4); + SYS(fail, "ip -net %s link set dev veth4 up", NS_TEST); + + return 0; +fail: + return -1; +} + +static int endpoint_add(char *addr, char *flags) +{ + return SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s", NS_TEST, addr, f= lags); +} + +static int endpoint_init(char *flags, u8 endpoints) +{ + int ret =3D -1; + + if (!endpoints || endpoints > 4) + goto fail; + + if (address_init()) + goto fail; + + if (SYS_NOFAIL("ip -net %s mptcp limits set add_addr_accepted 4 subflows = 4", + NS_TEST)) { printf("'ip mptcp' not supported, skip this test.\n"); test__skip(); goto fail; } =20 - return 0; + if (endpoints > 1) + ret =3D endpoint_add(ADDR_2, flags); + if (endpoints > 2) + ret =3D ret ?: endpoint_add(ADDR_3, flags); + if (endpoints > 3) + ret =3D ret ?: endpoint_add(ADDR_4, flags); + fail: - return -1; + return ret; } =20 static void wait_for_new_subflows(int fd) @@ -452,7 +488,7 @@ static void test_subflow(void) if (!ASSERT_OK_PTR(nstoken, "create_netns: mptcp_subflow")) goto skel_destroy; =20 - if (endpoint_init("subflow") < 0) + if (endpoint_init("subflow", 2) < 0) goto close_netns; =20 run_subflow(); --=20 2.43.0 From nobody Sat Dec 21 13:44:53 2024 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 00CF180C13 for ; Tue, 24 Sep 2024 09:10:12 +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=1727169013; cv=none; b=h0p2Jy7wC2ApKF7ceBNBa6BwAftbI1vcPnmkppM4lfIGu/xuhS5Tfs/34aB0u5IAjtnnDE4b5AdXBQl9TOf2qoRlXeEelD2RqCOGpT9rxH+pix58PqNZrf8ZoOmgy+o26J8x7e+YBXq1hi+3Y2+iAVGZ3snGWJzaq6TQPTWCjVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727169013; c=relaxed/simple; bh=B7s0zwGCgU+HdlcKYACzKEwnf2YnbwVokt52vAuWwXY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=patEYYZyCfqsbTYhs3z8dNjsOD9cR6XISXJFr3w6kn75nKgR4vSXMSd1iif9wEKflru+Uy5ZhFLkrlQK2CiPYGtQ1eB7d5iVS4WP/voDsYyvBlCtszw7FMai9Bgr8fTRdkWVicH3XMcxzLs7dyUYyuUPun73dqxPW/IwqW2Brjo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cMAnKrqS; 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="cMAnKrqS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FF43C4CEC6; Tue, 24 Sep 2024 09:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727169012; bh=B7s0zwGCgU+HdlcKYACzKEwnf2YnbwVokt52vAuWwXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cMAnKrqS++mQDitqnloL1CcTiLr8gxERPOZGKZV+rbEwr/kuW/dXBLc/Him3h/R/4 IQvyEzGVDsUR0jbBfEPTdOM7WkOGxs0wtSniJOW3X3PVjg/3maSObCUTPdTF6PXOsS g7DFEVHeiD1DpjpJhKj1znddrYOy3OA/WOH6lGSK5I2zomuKEeOxA+6ZSrVumZtWez V4jsiDzTEIHdXZA/p+Q9zGE5y7iWpDwLMBQs9IN56UAvNVwYEuw8kSvBwGAiFuwB/3 caAOLCfOFIv72mHlkXi5gHKs0Mn7KopYvXCOFPx6MgKTrfTNdGHLzsyGC2mjfg0rIO grvBVOKGejA2w== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 06/10] selftests/bpf: Add mptcp_subflow bpf_iter subtest Date: Tue, 24 Sep 2024 17:09:50 +0800 Message-ID: <1bb28d77c41cd9f6eb1c23e447d3537f2025c31d.1727168628.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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch adds a subtest named test_bpf_iter to load and verify the newly added mptcp_subflow type bpf_iter example in test_mptcp. Use the helper endpoint_init() to add 3 new subflow endpoints. getsockopt(TCP_CONGESTION) is invoked to trigger the "cgroup/getsockopt" program after wait_for_new_subflows(). Check if skel->bss->subflows equals 4 to verify whether the "cgroup/getsockopt" program loops fourth as expected. Signed-off-by: Geliang Tang --- .../testing/selftests/bpf/prog_tests/mptcp.c | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing= /selftests/bpf/prog_tests/mptcp.c index 076903680e75..29bd840422af 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -11,6 +11,7 @@ #include "mptcp_sock.skel.h" #include "mptcpify.skel.h" #include "mptcp_subflow.skel.h" +#include "mptcp_bpf_iter.skel.h" #include "mptcp_bpf_first.skel.h" #include "mptcp_bpf_bkup.skel.h" #include "mptcp_bpf_rr.skel.h" @@ -501,6 +502,77 @@ static void test_subflow(void) close(cgroup_fd); } =20 +static void run_bpf_iter(void) +{ + int server_fd, client_fd, err; + char new[TCP_CA_NAME_MAX]; + char cc[TCP_CA_NAME_MAX]; + socklen_t len; + + server_fd =3D start_mptcp_server(AF_INET, ADDR_1, PORT_1, 0); + if (!ASSERT_OK_FD(server_fd, "start_mptcp_server")) + return; + + client_fd =3D connect_to_fd(server_fd, 0); + if (!ASSERT_OK_FD(client_fd, "connect_to_fd")) + goto close_server; + + send_byte(client_fd); + wait_for_new_subflows(client_fd); + + len =3D sizeof(new); + err =3D getsockopt(client_fd, SOL_TCP, TCP_CONGESTION, new, &len); + if (ASSERT_OK(err, "getsockopt(client_fd, TCP_CONGESTION)")) { + get_msk_ca_name(cc); + ASSERT_STREQ(new, cc, "cc"); + } + + close(client_fd); +close_server: + close(server_fd); +} + +static void test_bpf_iter(void) +{ + struct mptcp_bpf_iter *skel; + struct nstoken *nstoken; + int subflows =3D 4; + int cgroup_fd; + + cgroup_fd =3D test__join_cgroup("/mptcp_iter"); + if (!ASSERT_OK_FD(cgroup_fd, "join_cgroup: mptcp_iter")) + return; + + skel =3D mptcp_bpf_iter__open_and_load(); + if (!ASSERT_OK_PTR(skel, "skel_open_load: mptcp_iter")) + goto close_cgroup; + + skel->bss->pid =3D getpid(); + + skel->links.mptcp_getsockopt =3D bpf_program__attach_cgroup(skel->progs.m= ptcp_getsockopt, + cgroup_fd); + if (!ASSERT_OK_PTR(skel->links.mptcp_getsockopt, "attach getsockopt")) + goto skel_destroy; + + nstoken =3D create_netns(); + if (!ASSERT_OK_PTR(nstoken, "create_netns: mptcp_iter")) + goto skel_destroy; + + if (endpoint_init("subflow", subflows) < 0) + goto close_netns; + + run_bpf_iter(); + + ASSERT_EQ(skel->bss->subflows, subflows, "subflows"); + +close_netns: + cleanup_netns(nstoken); +skel_destroy: + mptcp_bpf_iter__destroy(skel); +close_cgroup: + close(cgroup_fd); +} + static struct nstoken *sched_init(char *flags, char *sched) { struct nstoken *nstoken; @@ -682,6 +754,8 @@ void test_mptcp(void) test_mptcpify(); if (test__start_subtest("subflow")) test_subflow(); + if (test__start_subtest("bpf_iter")) + test_bpf_iter(); if (test__start_subtest("default")) test_default(); if (test__start_subtest("first")) --=20 2.43.0 From nobody Sat Dec 21 13:44:53 2024 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 CE5E280C13 for ; Tue, 24 Sep 2024 09:10:14 +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=1727169014; cv=none; b=VqtV3cFe9rcR3c6S+pcmmm976+W0pv8/meEmPuivBJJwojExhBBXsDO3OfNk6uI88R5HyM0rjasNapFBev1/6egyYKfR9w5jUOJHaKhT23Fp9WpgzrYt17xFwTwdTxyuaAB0RVEZTZMpqVDpBAkSx3WPhhQnHHIBcmeildzpccg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727169014; c=relaxed/simple; bh=Q7NoE/4dIPBTJOkheqdFKGv24hXt5LxGUUxgYfjgpYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k2rRrQKQ5ypRWiTi4swrTl2Q+XMXhXO3cfhbSKiu0hKhIc2pKtB8sMT5MZIcie3oOUO0SXQQt5QR5qlPkoW47cFMNyJcOSzV6MSd9mNote4kD8ksKVgwkYUUHOHIg12mMot/dg5/hGzwyE1gJTxtOhj9D0zK2XO3GBm+jaxZkHM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jt1UYHNy; 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="jt1UYHNy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A465C4CEC6; Tue, 24 Sep 2024 09:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727169014; bh=Q7NoE/4dIPBTJOkheqdFKGv24hXt5LxGUUxgYfjgpYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jt1UYHNyd6Vp9wAVdFzr/WCS3iup1mpmzJcOZPAXpvn2EM+Kwu8qSnx0MHcWCH1xd IiP9jAPxLMxvZotKebimRQqQdO5j61p6U/aCkc0Phj9V1tvJt10yPeC5805BJ7aI69 KCvCvmIjcxe15UIFVwiQOHmCFcccYzqQU6C/IKOc2fy+/o/A4aMgi5nLhiQbRoSmwi PZKcf/dgH+0VOJLjcR/8I0pxG2+4paBVei+YP4XTg7S/iDyf/qKCAYFW/A1oBC2PRR Dtr1BtkwiiJYZTTJtobp7yNOaereBbo1H+86/0/IacqPCjWwNNXiteSgXWd7uzVJO8 RPFwMfc+MOokA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 07/10] Squash to "selftests/bpf: Add bpf scheduler test" Date: Tue, 24 Sep 2024 17:09:51 +0800 Message-ID: <9113e9a5bf3280a18417e072d38aec9101defa4c.1727168628.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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Update endpoint_init() in sched_init(). Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_tests/mptcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing= /selftests/bpf/prog_tests/mptcp.c index 29bd840422af..0de5d9250ed5 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -581,7 +581,7 @@ static struct nstoken *sched_init(char *flags, char *sc= hed) if (!ASSERT_OK_PTR(nstoken, "create_netns")) return NULL; =20 - if (endpoint_init("subflow") < 0) + if (endpoint_init("subflow", 2) < 0) goto fail; =20 SYS(fail, "ip netns exec %s sysctl -qw net.mptcp.scheduler=3D%s", NS_TEST= , sched); --=20 2.43.0 From nobody Sat Dec 21 13:44:53 2024 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 1672480C13 for ; Tue, 24 Sep 2024 09:10:16 +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=1727169017; cv=none; b=X/pUYDd8+kVDsPSi+L++MoBVDTJWhcjzmv2G1g+JPdfSpY3Y4m9vpF84JCwH5pf8AAl32HW2WnYSsEI+y0YfPBcNpaHcNxb3Z4qEembsC+6lUXAXmL0a70LiLWLr08v9IhZ3VAlfrSsF5IoHPkQmDtKy0ol2T6YljxZCgvf0EuE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727169017; c=relaxed/simple; bh=f0hBMXuSXKp5L3lBtmLBbKDXwkkk785wylGa9yTx9aA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CTjLStO4FQ4sIT3ykpB/BjaQfY1VDcuyNsxk494Hxd0ez9/sqTQZCOC6KaAR4oQPNNNz9yB13qQ7CZPOllySjFVdBocdMkGt111rVvoVQ0BsXiwJTTlVSE8ot7hNCQjIPzS3XZpeX1+zGsNVn5jujQd1+rftT3WLVpbPK/xZTfg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l3m/PQDp; 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="l3m/PQDp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 538A8C4CEC4; Tue, 24 Sep 2024 09:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727169016; bh=f0hBMXuSXKp5L3lBtmLBbKDXwkkk785wylGa9yTx9aA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l3m/PQDp/Skp5Pj3JFoAIq94KGF5ogBd5pHq9IefjXoLWuv2Soqvh7z/BTidD5nrM 1RWGNyq2/OtLQfgqRdSN0H1nvfWSppIcgNmqzijs6seIHiPXaCUWKfWTpAoFGmwtK9 U/IifGDgpvfOzAyZsJEf1FPFMKoU0ngs44T63OsULtDgNGPKQlGPgkJabcmeeNKvX7 0jAT4ILxzrxLL0pfjkeW6lIqBzW3HtF5q5ke8nA1RDyhL4+pgUuGKibqTw79AH7tWV ObAm/IcJSMwG3gXrnSewSrgyh4Ko73DfX+stLuDvz23S+sisFTk8GWQreiI7wTdH3T 5ll3Rfd0TZAnQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 08/10] Squash to "mptcp: add sched_data helpers" Date: Tue, 24 Sep 2024 17:09:52 +0800 Message-ID: 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Use __bpf_kfunc_start_defs and __bpf_kfunc_end_defs. Drop bpf_mptcp_subflow_ctx_by_pos declaration. Signed-off-by: Geliang Tang --- net/mptcp/protocol.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index c3942416fa3a..d864c8ccf316 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -722,8 +722,6 @@ void mptcp_sock_graft(struct sock *sk, struct socket *p= arent); u64 mptcp_wnd_end(const struct mptcp_sock *msk); void mptcp_set_timeout(struct sock *sk); bool bpf_mptcp_subflow_queues_empty(struct sock *sk); -struct mptcp_subflow_context * -bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned= int pos); struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk); bool __mptcp_close(struct sock *sk, long timeout); void mptcp_cancel_work(struct sock *sk); --=20 2.43.0 From nobody Sat Dec 21 13:44:53 2024 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 81AB680C13 for ; Tue, 24 Sep 2024 09:10:18 +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=1727169018; cv=none; b=OYojwXRZ9m1tP2XpvGpCJTtjmnwkrU4CBiNOb/kh1OQ96v7e1sAlOUrCOyjdJCDeTZUULwE0dbU60anjQs/LcE/sBcYEq6Z1cywN5FsGZivBiS4bHdB0KUPebOwFsO57sHRXIXxv7hEN+iWUYcixG9IUR54WV29HmAiHo0ADAo8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727169018; c=relaxed/simple; bh=NMOtzIOCOETa0fpcP9kKo8rqzMY7RmWa6x2jUA8URDU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C8tFM3nZQyVJDxgUZB240SE2FwJV2gfnpcshz13gVm7zhwnkoBtS7wXUEirHDP0/xKivxkc4ulibFHcgkfEPovO6AtRzWlTyuMM6g8BoTq92QjysrRawIi1vV0Ir5Grq+fo8DaCvqPvI451xVXGHG4ejqw3f5JaLueJLy1S54e8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W829K0Lx; 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="W829K0Lx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CC91C4CEC6; Tue, 24 Sep 2024 09:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727169018; bh=NMOtzIOCOETa0fpcP9kKo8rqzMY7RmWa6x2jUA8URDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W829K0Lx+15VOBxIRg/0p5KHOrFmQ9DINx4m26QNrofjUKW4GqkhIDzqKXb3JI1S1 BPqT9YZGFf001sHXtpSaUpT03DkCBGE1YDDzJabCwyDwOAn6i1TaVjs1G9w0dJhJxh oh6MAW8OLXe3VS81fgpW597sK8Yl0IrG9GgXDVVdcK/me4Vvtx/YvbDhB0iSCwFwg+ nCuaRvGB/awSvV89Uj0fjuHbmvbuTO338k/hi304tnNPn+WVByEip0HmxeSoZ/KtNS MfsRW+agUupVZ+yWmrQWYZo3XhECW/obiHqEfHh8nQKDGA6OcWCj8tu28Q2Bb0TfyF 6hZQFT+cuJA0g== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 09/10] Squash to "bpf: Export more bpf_burst related functions" Date: Tue, 24 Sep 2024 17:09:53 +0800 Message-ID: <6caa3d6601ac95ef80b943016c783ffd56e3c2e9.1727168628.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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Drop bpf_mptcp_subflow_queues_empty declaration. Signed-off-by: Geliang Tang --- net/mptcp/protocol.h | 1 - 1 file changed, 1 deletion(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index d864c8ccf316..9df56c21756d 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -721,7 +721,6 @@ void mptcp_subflow_queue_clean(struct sock *sk, struct = sock *ssk); void mptcp_sock_graft(struct sock *sk, struct socket *parent); u64 mptcp_wnd_end(const struct mptcp_sock *msk); void mptcp_set_timeout(struct sock *sk); -bool bpf_mptcp_subflow_queues_empty(struct sock *sk); struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk); bool __mptcp_close(struct sock *sk, long timeout); void mptcp_cancel_work(struct sock *sk); --=20 2.43.0 From nobody Sat Dec 21 13:44:53 2024 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 5697880C13 for ; Tue, 24 Sep 2024 09:10:20 +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=1727169020; cv=none; b=dUCQb8aFPkHFv8uEBFO7W3eIIM/Lora0ncMxfSuk8VARqLK790G5HJsc7/P9cZOfTWlhjmaU4yTTUL9i96Qpx+qWp9Udh9Zy5cgLxOtP8nUKJ1OCLh8v6Z69sdTr+ESG4D2QO2sKa6Ag11OzKWGyJBZvo0jp2NbDyE5haGmIhnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727169020; c=relaxed/simple; bh=Zb+32JUdCvzFr6YS3HVWxtO3o2fz5/zgF4mbGXoaSRA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SH98GQN+BiUqmEFKkwsudk8uL+eGQz1XSHLDQeGanry7fmgsg0XIUfJqcI7CNtk7BtFDZ52Dh76o+BkfujinUfIDdkTbGfozrnXm9UG99swK7rFKLV/usIJXuOMb6KDlmwcoVRYXOiXMiNB0WrQywwx/kt/h/sq2SmigyFqKvlQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Oc9QR6tG; 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="Oc9QR6tG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 081E8C4CEC5; Tue, 24 Sep 2024 09:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727169020; bh=Zb+32JUdCvzFr6YS3HVWxtO3o2fz5/zgF4mbGXoaSRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oc9QR6tGwjl6JQpYTU/Idz9M8J8sQUBU7olcuEBSjHbdcvhowfAwjCxEe2hxQBV1Q YIgWXrnCcFLOtGYs5+PmY0O76ebkkTY42VbUTS+3RKRpcXI/4qrq3ihCInJxPJDJq9 jNZ+qSEbEJ2s6fDBshGtjDKhj84mxT8S6aKNNlTNm0DhLetcstqA2XezRzCSH6mMg7 sJFPdBq0J6U0bAfCXibtDZlCZkIAlbgFA/F14ZTT2d35IgKPKn92tMv9Tjb7uCuJU5 Pe84cuYCf5uZX2fGwhfCTsJ07euH8Oiz9FSUZO2Ptgi+wuW47XGIPRCnP1JObMOLIs 1Oo98+tMbyY+w== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v6 10/10] Squash to "selftests/bpf: Add bpf_burst scheduler & test" Date: Tue, 24 Sep 2024 17:09:54 +0800 Message-ID: <9fee9ecb81012a155bfb60d25437fe871876ce98.1727168628.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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Drop mptcp_subflow_active declaration. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c b/tools/te= sting/selftests/bpf/progs/mptcp_bpf_burst.c index eb21119aa8f7..dcab196867fe 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c @@ -16,7 +16,6 @@ struct bpf_subflow_send_info { __u64 linger_time; }; =20 -extern bool mptcp_subflow_active(struct mptcp_subflow_context *subflow) __= ksym; extern void mptcp_set_timeout(struct sock *sk) __ksym; extern __u64 mptcp_wnd_end(const struct mptcp_sock *msk) __ksym; extern bool tcp_stream_memory_free(const struct sock *sk, int wake) __ksym; --=20 2.43.0