From nobody Sun Dec 22 05:38:44 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 1340133FE for ; Mon, 9 Sep 2024 01:55:39 +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=1725846940; cv=none; b=JUghRAgKXkbrMiAA9KIK7jBlI2rrgXC6KQ5kSRSxCiO8wF7Aj9KSPQIIT08QwksYIPMV0OKRfimYhPLdgYRtdgNNDVIHzOga/Bkn2wUH+Z8i94zm6+mOnoPXgxLMXV1yxnRcPnKiB3EgTUQ0sDu66JZ7AMBIOBpWYCoydqciCzs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725846940; c=relaxed/simple; bh=oRPddNFGFo6Z+dCpJXlJ8VLO4VG3VnIN7OuGV5N+jBs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XEv2iy4AfHSH/jM6o1KvlOjxk8ERHetn1Gm4TD8qbilR1zexWByrFj/4v+fVwDXVpX5jT3CSxRn9Jq84s4uUrlF1PXPEqBVRSEokNj/JL+Wc0jsdHbg6f8ofhfTmJ54/2V5+SzEqrhmvg37HNppQHZ2wBeedQqBS5A6impHab0Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UdzaviYC; 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="UdzaviYC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BB3AC4CEC6; Mon, 9 Sep 2024 01:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725846939; bh=oRPddNFGFo6Z+dCpJXlJ8VLO4VG3VnIN7OuGV5N+jBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UdzaviYCy/UnsBM908vVsoXmPyz9XCcw5GYpLixSTLm/94UxmwV2YiOzGiBxfUJG4 wboTnbYOnWU9BXNtIM1crVGyYOzK+fPA3tXcbrHHce0EN/9UxIf+QzFOftZ2juCCID /zHX9SHKbQIjiEidXR26M3dmwzT8VmodNnc+X8uU1Pnlt0H6b0EsSVWERNt/Geowo+ nDF3MSNOf0Mmt8963N/5JXbVKLvJth7kcVAWr6AVouGPqvMkinek/ov/HJhcEjHn6i KRS6uxA+814hWRoNFrQVB3UQlYr6DTveH1SmEzSNKym6sIWlQ7dAWJNtRX0BRttd8W IagVbtk7Kc9kw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 1/4] Squash to "bpf: Add bpf_mptcp_sched_ops" Date: Mon, 9 Sep 2024 09:55:29 +0800 Message-ID: <5a985e7bb55e2d82e3205d22358fc6732c98ba64.1725846806.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 The helper mptcp_subflow_set_scheduled() is used to update the scheduled flags of a subflow. BPF schedulers are not allowed to directly modify this flags. So the write access permission for this flag shouldn't be allow. Signed-off-by: Geliang Tang --- net/mptcp/bpf.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index 9672a70c24b0..6414824402e6 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -60,9 +60,6 @@ static int bpf_mptcp_sched_btf_struct_access(struct bpf_v= erifier_log *log, } } else if (t =3D=3D mptcp_subflow_type) { switch (off) { - case offsetof(struct mptcp_subflow_context, scheduled): - end =3D offsetofend(struct mptcp_subflow_context, scheduled); - break; case offsetof(struct mptcp_subflow_context, avg_pacing_rate): end =3D offsetofend(struct mptcp_subflow_context, avg_pacing_rate); break; --=20 2.43.0 From nobody Sun Dec 22 05:38:44 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 E348511CA1 for ; Mon, 9 Sep 2024 01:55:41 +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=1725846942; cv=none; b=tFQr7rWbGEYwQhxmeU7W5OVMFZ5eSOlTV6enHC3LRmbJHYRuOYCXzIvUAPnYf6OJZq5EuTbaOr6wo18x5kR4iW5taWDUZPZ61tqASH/+/MiFLnwK/r2uTI5q9rntbJkmIda4E04e0ReGIVPO5p7T+0PjvaYp64Gxqo4wIRqfqhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725846942; c=relaxed/simple; bh=WKuNO3DJK8T2M0Ato5+aw4357ZWLYh9twwY0SMJGtqo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kz5mwx52cJLvUffmHfME4vs/mLUiXN+5a6Bmbb3IWfz2aNGdvOlBQ/TuHIqL4L8kT/P3WbLLv7a8cCtiwUtSh+me2hgUuEk1KOZOgYYJwhbkYDNdyiLI55KskiNgB6wXCmoR6xgkI/7CbPIqSxebS0fhBbwsslVkRe4DlKFZjwk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E78TrkHz; 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="E78TrkHz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 354CFC4CEC3; Mon, 9 Sep 2024 01:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725846941; bh=WKuNO3DJK8T2M0Ato5+aw4357ZWLYh9twwY0SMJGtqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E78TrkHzmspNFOH312eWCnPK0y8AiadKjYdQq/YF/NQ2GgftgpniGa7Mgj9/Ed8++ iXNL8xwQLQKvPSi5nQvnHRW4HSRg+CdjmcVKoXOpSuZblVQaiPULl7B8k4bfojqE9d vDZGFjsnhCK0uqOGT8qW5l2h6/hw9rTZsu9hz6TEmz81w7tH/N6tkgSXGs9HguyvfT AbAhKyJQD65a9EL7oFyuWtIRvjHbc6t0ifzwebVqf1hl+ePnQrEFsO67fCrzA/7Ho5 jv7izNjX9KlYTN9GqwxyPQbvS3DrN2LIyK6tlGM7Ah29L98wRSoW7DkQ8WUg2+rNMB KSW45AgfwXGow== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 2/4] Squash to "selftests/bpf: Add mptcp subflow subtest" Date: Mon, 9 Sep 2024 09:55:30 +0800 Message-ID: <9dcfd8c36c789c6207275701bb7c93b2d7d25c04.1725846806.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 Should use dedicated ASSERT_OK_FD() to check the fds. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_tests/mptcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing= /selftests/bpf/prog_tests/mptcp.c index 93869c873cad..987692863fde 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -394,11 +394,11 @@ static void run_subflow(void) socklen_t len; =20 server_fd =3D start_mptcp_server(AF_INET, ADDR_1, PORT_1, 0); - if (!ASSERT_GE(server_fd, 0, "start_mptcp_server")) + if (!ASSERT_OK_FD(server_fd, "start_mptcp_server")) return; =20 client_fd =3D connect_to_fd(server_fd, 0); - if (!ASSERT_GE(client_fd, 0, "connect to fd")) + if (!ASSERT_OK_FD(client_fd, "connect_to_fd")) goto close_server; =20 send_byte(client_fd); @@ -429,7 +429,7 @@ static void test_subflow(void) struct bpf_link *link; =20 cgroup_fd =3D test__join_cgroup("/mptcp_subflow"); - if (!ASSERT_GE(cgroup_fd, 0, "join_cgroup: mptcp_subflow")) + if (!ASSERT_OK_FD(cgroup_fd, "join_cgroup: mptcp_subflow")) return; =20 skel =3D mptcp_subflow__open_and_load(); --=20 2.43.0 From nobody Sun Dec 22 05:38:44 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 1CFD833FE for ; Mon, 9 Sep 2024 01:55:43 +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=1725846943; cv=none; b=f7JqmsWdJKJr+ejDLxSybyPTjtNrPfl78mtBlCQ7u0OxwXA4I5B+N92lKzn2v1fSAIeJGELV2C/Pp+W8eg9zzt/zjaR+CGEX8KtI/DdIerjEyF5PvgkMuRT0q9+go5+Ks2RbJFx8Clw6Cf29AkCbdnPFN7sfxa3lGZE9poCZxT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725846943; c=relaxed/simple; bh=KLDZKlNwfB/sc1wiXSYNVZ1g+AAXDi9otFT9GKttFAU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P3xN5uRF4K5z+CGbyWeBiGhoVtJ7Mkmci+7EAlgXMpU53nYi/ZMHzE4+cjO+x3s2sWwVU3/pzAXxqovd+/vRcW8fUJa8+bSWwCXssVWGx/WCG2jCwctl2j89ezg8dptBofMmQ9ziJEqse9PY0E/42jCdshxYirmCLrpLUcglOxY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PBDtcYKl; 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="PBDtcYKl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F879C4CEC3; Mon, 9 Sep 2024 01:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725846942; bh=KLDZKlNwfB/sc1wiXSYNVZ1g+AAXDi9otFT9GKttFAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PBDtcYKl6zAe72oXe6/PIpgWXW25fXMgH3KTVZeMekufCPgoPVZQiBRV7yALR9klG 6omZvdBClr0PldHxVSRZLIQc5PePBYhEyjkvm2Ociu61l3z4lIz/gkWz0OZdlOOvDj Eu34HmY2BTu1Y/z5MtvivalAdWbYWbRGMZBWL6TvrZLPZmCicpbvB4bhmkLAXqA11K BwBjJ8+DifO6nC3nHsEWKJEhsKRo1i5X7i11Cfcyr6P9SdkiNCJ645WBpQrF9YRimf q2HQe8pcR/NlbAmlgQUloRXQWzsoabTINdSnms1TYrwJV+nbQMs5ooLpwz6JJ6fk/Z RdhAtCnD336CA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 3/4] Squash to "selftests/bpf: Add bpf scheduler test" Date: Mon, 9 Sep 2024 09:55:31 +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 Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_tests/mptcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing= /selftests/bpf/prog_tests/mptcp.c index 987692863fde..2476f0a083bc 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -507,11 +507,11 @@ static void send_data_and_verify(char *sched, bool ad= dr1, bool addr2) unsigned int delta_ms; =20 server_fd =3D start_mptcp_server(AF_INET, ADDR_1, PORT_1, 0); - if (CHECK(server_fd < 0, sched, "start_mptcp_server: %d\n", errno)) + if (!ASSERT_OK_FD(server_fd, "start_mptcp_server")) return; =20 client_fd =3D connect_to_fd(server_fd, 0); - if (CHECK(client_fd < 0, sched, "connect_to_fd: %d\n", errno)) + if (!ASSERT_OK_FD(client_fd, "connect_to_fd")) goto fail; =20 if (clock_gettime(CLOCK_MONOTONIC, &start) < 0) --=20 2.43.0 From nobody Sun Dec 22 05:38:44 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 6EF2611CA1 for ; Mon, 9 Sep 2024 01:55:44 +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=1725846944; cv=none; b=hdc+nsemlk4YZ7PSgqwNmyT4PHIjt64u9d+pojwHjdcFlMinQCKF5iSBTtj7mQAkMUWbAElAAPPxuj9oQrhWqsfkhNq0GNEJIuaxmlkhBQtRSpxibgpB0csk0riQq+Bn7LRz190teaIL0ryVaD/EypOrg6aJoDqponGR8phB8+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725846944; c=relaxed/simple; bh=DdGEIIWht+8UQLVl/O99KOPa1fIqXXo4euO+8dSQqbM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SdwOVNB+xhXlVcDq4BgaDDioUVkA2qqVK0KF6FBK9N9HKHHTnUjlpCnLqYswKl54T6/RQfC1oam2wuPJOjIYYE+vnVfUC5VZbfvGhKErxjtoA8dU11mKa8S99k3ge67rkdwCLXmJnQLv8eHwOqiqXLmh4dft2DHA0GSStPGN/BA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eDY0xmNb; 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="eDY0xmNb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D4FDC4CEC3; Mon, 9 Sep 2024 01:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725846944; bh=DdGEIIWht+8UQLVl/O99KOPa1fIqXXo4euO+8dSQqbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eDY0xmNbyr9tdX6TShszLHAIA7ibnY/EgGIcDHkHfq5G4rXu+ibJh1hDB0413EWzi Q3L32Ei+rTI8k/BqDCOQwtBefnn8ERVP5HHQcRbVpiYdRgNMnWgeVgA5fPQUrQgNz6 lK6YoJSpmzXU/u7WfPlVKyZUz5awMvEvIT+EKm0ibJiRgCl6lU77xyr/3vjghf7YdG C6nsjVwWf972rlJkWrEnMJ81H7bbGY1FkD/c07w7SzVsM5Ze1WqegvXOkDEuuVFqek UN+PUv2XjsMQjY8jHnSuHUONPz0FmEWu33fKsVJh4qwncJ4rjjfa58TWxIBEBphyRD BOt6l4Xb8WNug== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 4/4] Squash to "selftests/bpf: Add bpf_burst scheduler & test" Date: Mon, 9 Sep 2024 09:55:32 +0800 Message-ID: <33f322e8fd3e1fe158557f70e82706ccca41fff2.1725846806.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 Use nr_active variable just like in mptcp_subflow_get_send(). Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c b/tools/te= sting/selftests/bpf/progs/mptcp_bpf_burst.c index 3a673291b4dd..eb21119aa8f7 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c @@ -74,9 +74,9 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow; struct sock *sk =3D (struct sock *)msk; __u32 pace, burst, wmem; + int i, nr_active =3D 0; __u64 linger_time; struct sock *ssk; - int i; =20 /* pick the subflow with the lower wmem/wspace ratio */ for (i =3D 0; i < SSK_MODE_MAX; ++i) { @@ -97,6 +97,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, if (!mptcp_subflow_active(subflow)) continue; =20 + nr_active +=3D !backup; pace =3D subflow->avg_pacing_rate; if (!pace) { /* init pacing rate from socket */ @@ -115,7 +116,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, mptcp_set_timeout(sk); =20 /* pick the best backup if no other subflow is active */ - if (send_info[SSK_MODE_ACTIVE].subflow_id =3D=3D MPTCP_SUBFLOWS_MAX) + if (!nr_active) send_info[SSK_MODE_ACTIVE].subflow_id =3D send_info[SSK_MODE_BACKUP].sub= flow_id; =20 subflow =3D bpf_mptcp_subflow_ctx_by_pos(data, send_info[SSK_MODE_ACTIVE]= .subflow_id); --=20 2.43.0