From patchwork Tue Sep 24 09:28:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13810582 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 098C8156C69 for ; Tue, 24 Sep 2024 09:28: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=1727170124; cv=none; b=ERcSNDwcftxk332XH+pVtpJo3MVGnFW+IGk+KiyVce4YRN4byYIz/Cteygp/cGzp4i70IheZWMAhAnO3ZqCF4RMSNGxAOtDk6j+nN9NXvHgmxboOhDEDDT9rcxZkSiJq1CwavyhwRY16Fzo6uxaCVWsXaD+k3UF4YLUg3Q8GVl8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727170124; c=relaxed/simple; bh=zBo5KdCfWf6qZj3DuxGNSoCLUBHp/tIGLuImTf1AUnU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KbnfU6uPvaQyqvaoWe1M+9au6jYupWoM0aKNh30LKDzmMWkHS/ZnqJRaALMVLEEBe8VZN2xnh6KiulqLQEnd0qfZWq1HMg+rvgc+iHdBTAWN4BWy19uMJGgwfHj0RPI59xQgXtPMJH9PseqWan+T5Mu+cuAJIFYnfAj21hFzR1w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QdksYLA/; 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="QdksYLA/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63ED0C4CEC4; Tue, 24 Sep 2024 09:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727170123; bh=zBo5KdCfWf6qZj3DuxGNSoCLUBHp/tIGLuImTf1AUnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QdksYLA/loBGIOjZ9LWFykuc1I+TfBf1+Uo69M2IDsUvxiw9ZREzwgXlTxPN/kRP7 v6Uz2OVlrsvmqe+A+udmV6XO1owE2mjk9e71PcIR0Pw2zyzOobWuScpo86HOgpgiQA +F/P4skvzLibU8F6dE7TOhWOAUfuAbHxx+0FJ/gXo2XoWt8b7XwUY5V+DMHTPpiao5 4/UXiyyqFtbmrmLWxVKuWhzL4f3wRu/pBY0V3BlvDL/6bhYYO4z5uaFy+01ZNjwvsH g21prz78vxIGOjydwnCg78KR6mG/Q/j0C2qhQc8alXl15hpNtfOrf9GPGIR++wVj5M ncxRAkJ9yrYyA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 1/8] Squash to "mptcp: add sched_data helpers" Date: Tue, 24 Sep 2024 17:28:29 +0800 Message-ID: <541e59823f87bf1c4c8d28310dc1e7931c06e4e8.1727169534.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 Drop bpf_mptcp_subflow_ctx_by_pos declaration, since "-Wmissing-declarations" is ignored in __bpf_kfunc_start_defs. Rename bpf_mptcp_subflow_ctx_by_pos to bpf_mptcp_lookup_subflow_by_id and drop mptcp_sched_data_set_contexts. Signed-off-by: Geliang Tang --- net/mptcp/bpf.c | 13 +++++++++---- net/mptcp/sched.c | 22 ---------------------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index 32894d2246b2..ff2589b5edbb 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -265,11 +265,16 @@ __bpf_kfunc void bpf_mptcp_sock_release(struct mptcp_sock *msk) } __bpf_kfunc struct mptcp_subflow_context * -bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos) +bpf_mptcp_lookup_subflow_by_id(struct mptcp_sock *msk, unsigned int id) { - if (pos >= MPTCP_SUBFLOWS_MAX) - return NULL; - return data->contexts[pos]; + struct mptcp_subflow_context *subflow; + + mptcp_for_each_subflow(msk, subflow) { + if (subflow->subflow_id == id) + return subflow; + } + + return NULL; } __bpf_kfunc bool bpf_mptcp_subflow_queues_empty(struct sock *sk) diff --git a/net/mptcp/sched.c b/net/mptcp/sched.c index 5257bc6c8cd6..78ed508ebc1b 100644 --- a/net/mptcp/sched.c +++ b/net/mptcp/sched.c @@ -143,26 +143,6 @@ void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, WRITE_ONCE(subflow->scheduled, scheduled); } -static void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk, - struct mptcp_sched_data *data) -{ - struct mptcp_subflow_context *subflow; - int i = 0; - - mptcp_for_each_subflow(msk, subflow) { - if (i == MPTCP_SUBFLOWS_MAX) { - pr_warn_once("too many subflows"); - break; - } - mptcp_subflow_set_scheduled(subflow, false); - data->contexts[i++] = subflow; - } - data->subflows = i; - - for (; i < MPTCP_SUBFLOWS_MAX; i++) - data->contexts[i] = NULL; -} - int mptcp_sched_get_send(struct mptcp_sock *msk) { struct mptcp_subflow_context *subflow; @@ -189,7 +169,6 @@ int mptcp_sched_get_send(struct mptcp_sock *msk) data.reinject = false; if (msk->sched == &mptcp_sched_default || !msk->sched) return mptcp_sched_default_get_subflow(msk, &data); - mptcp_sched_data_set_contexts(msk, &data); return msk->sched->get_subflow(msk, &data); } @@ -212,6 +191,5 @@ int mptcp_sched_get_retrans(struct mptcp_sock *msk) data.reinject = true; if (msk->sched == &mptcp_sched_default || !msk->sched) return mptcp_sched_default_get_subflow(msk, &data); - mptcp_sched_data_set_contexts(msk, &data); return msk->sched->get_subflow(msk, &data); } From patchwork Tue Sep 24 09:28: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: 13810583 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 BF4D8146D59 for ; Tue, 24 Sep 2024 09:28:45 +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=1727170125; cv=none; b=MEKxQ9JUykBHBg/CyKB8EncSBWLyXflW2Z2VQZTJo6p4T+H1fWPagZzbWnR31NUVIeiDoDIIyGZqMVXSVjKiQ4+sK/TKsrcjhoAM0WYVQeO1ASpB9UOIYiZW64ZnnHqMJrUPFzmQvKuBggJMPVU35bT85+Ejn/rcgj8CzIUwVWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727170125; c=relaxed/simple; bh=VZrjVpvjHQqoJi15H9JsGJT+wrzfq547tdmgftY2cJs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=APCA5YDEvyFXClI7Iatyj9fkp/IlguX78zwwQPXkRFYIWFjdssJYM1ULcCN70Tqoeezu2152sbC8Bd8wfL6koqHufHpninemoXdHYCcs30swhbzKE/7L4cwZ0VQHoQaDBQ0+bCK3OvQN1WuWCF7JgQlE9ljLf8Y8bXQzPUIjbFU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZHTly4fA; 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="ZHTly4fA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C0ACC4CEC4; Tue, 24 Sep 2024 09:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727170125; bh=VZrjVpvjHQqoJi15H9JsGJT+wrzfq547tdmgftY2cJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHTly4fA71ftUANZpoK8vBt5dLdKZZEzpr9/zXhaSsnJ0uPSHgC4IH25ot1wgIGaw c5oIYniQRZ28+jswklYg5dJIKxX2jGO7B8UyvBlwsTrDkjQCThg11GROZ8gogn3r5U u3fYP42qp09nPesgUlRw6f/iSxc1wAWkkAAnDBctx0zxNmRBMhBzupUPR5EhquYam0 UIEMrde4+yuLUP0P4liHQ8T3EcuQj48ojt9IHlAXj2C2tzBddgvLS8j9HnIXm/Ho3d NzIENwyy0SFd1RDXxwVen1Z8EGz7g4aBGC4RlYtXu1visJ/v+BX8Oct0waBkNrvcpa hhIGNPIXJ1YIw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 2/8] Squash to "bpf: Add bpf_mptcp_sched_kfunc_set" Date: Tue, 24 Sep 2024 17:28:30 +0800 Message-ID: <5b4cd68a6c2761c437cdb6d9e5c7b6a0fd4b9c28.1727169534.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 Please update the subject to "bpf: Register mptcp struct_ops kfunc set" Rename bpf_mptcp_sched_kfunc_set to bpf_mptcp_struct_ops_kfunc_set, since this kfunc set will not only use in bpf packet schedulers, but also in other struct_ops like bpf path managers. Rename bpf_mptcp_subflow_ctx_by_pos to bpf_mptcp_lookup_subflow_by_id. Signed-off-by: Geliang Tang --- net/mptcp/bpf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index ff2589b5edbb..a133bf50330d 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -299,19 +299,19 @@ static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set = { .set = &bpf_mptcp_common_kfunc_ids, }; -BTF_KFUNCS_START(bpf_mptcp_sched_kfunc_ids) +BTF_KFUNCS_START(bpf_mptcp_struct_ops_kfunc_ids) BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled) -BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx_by_pos) +BTF_ID_FLAGS(func, bpf_mptcp_lookup_subflow_by_id) BTF_ID_FLAGS(func, mptcp_set_timeout) BTF_ID_FLAGS(func, mptcp_wnd_end) BTF_ID_FLAGS(func, tcp_stream_memory_free) BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty) BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale) -BTF_KFUNCS_END(bpf_mptcp_sched_kfunc_ids) +BTF_KFUNCS_END(bpf_mptcp_struct_ops_kfunc_ids) -static const struct btf_kfunc_id_set bpf_mptcp_sched_kfunc_set = { +static const struct btf_kfunc_id_set bpf_mptcp_struct_ops_kfunc_set = { .owner = THIS_MODULE, - .set = &bpf_mptcp_sched_kfunc_ids, + .set = &bpf_mptcp_struct_ops_kfunc_ids, }; static int __init bpf_mptcp_kfunc_init(void) @@ -322,7 +322,7 @@ static int __init bpf_mptcp_kfunc_init(void) ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_UNSPEC, &bpf_mptcp_common_kfunc_set); ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS, - &bpf_mptcp_sched_kfunc_set); + &bpf_mptcp_struct_ops_kfunc_set); #ifdef CONFIG_BPF_JIT ret = ret ?: register_bpf_struct_ops(&bpf_mptcp_sched_ops, mptcp_sched_ops); #endif From patchwork Tue Sep 24 09:28: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: 13810584 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 8446815534D for ; Tue, 24 Sep 2024 09:28:47 +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=1727170127; cv=none; b=poGoUzRR67mDgolyJNQvWeAw7QQyg8XKSaDoD/NpAnm+buSRg2QRhL1YnUDPGjYziL0BENlCtRcjeQjRy0f0XWL8osG4tXD8nUtF0d7zSsExQmWgly5yg+N8VjwYNwk8kWIeF4BiZus531IJMYLaYDoYvp+Qe0zKZXKZwJZHids= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727170127; c=relaxed/simple; bh=1v+87NR0V3OhPTa2SkWcT/M8UKDCxC31vaswOmge5yQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TdIgwp8nrVIDa31OLkaZmqg94thvf7Mw5znHoKzvpruDb7o0mfyd/DuEIslO6P26GVFe1Evz8Zj0MUbG3IEu3T7fP3aYkfYQKE0s0PX9SsBhCKyIjOkQVrzJZu8SUC40DjADhE7i01b4ENSD90+UlCodUBZoHFY9lo1uVw9SiKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hUyc6V9z; 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="hUyc6V9z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF6FEC4CEC5; Tue, 24 Sep 2024 09:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727170127; bh=1v+87NR0V3OhPTa2SkWcT/M8UKDCxC31vaswOmge5yQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hUyc6V9zNi39d1JAdKC1eAQg1frXXrYOTncGPyqbCdwt0eHbmN6ELp6fP9LNGgWor Nnx+HKBhW+lLKjkmGs/kGzcw2n0bzLF4wFKtHegscjWb6eXN3CDGvMnmp6cqdThDJ6 TuMH/tZ7Ujz8mb3TjRZ2SwPm/A6yoC9oR4rHsTpS0hxys8FoKLs/3rakQnSzKZx5FY ADJWbLRJIakMhQ8ArnBomRy6C2Zv/Anu4HrZrGzoiAlmcVUiCjBlPWKHafBJ/NKO6E rOsFaAPrf2+R1xj7iuRn+NYGDYho0lUZCQOSo9uOwhmT13LlWxEGEpbRFlhdpSD57M n6ksEw0RerZLw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 3/8] Squash to "selftests/bpf: Add bpf_first scheduler & test" Date: Tue, 24 Sep 2024 17:28:31 +0800 Message-ID: <81baea3a0aa8a949b8f1465cecf0a4c1ea45cc12.1727169534.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 Use the newly added bpf_for_each() helper to walk the conn_list. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/progs/mptcp_bpf.h | 2 +- tools/testing/selftests/bpf/progs/mptcp_bpf_first.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf.h b/tools/testing/selftests/bpf/progs/mptcp_bpf.h index ab46b66422c4..43262a4e85c2 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf.h +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf.h @@ -53,6 +53,6 @@ extern void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, bool scheduled) __ksym; extern struct mptcp_subflow_context * -bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos) __ksym; +bpf_mptcp_lookup_subflow_by_id(struct mptcp_sock *msk, unsigned int id) __ksym; #endif diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c index d57399b407a7..807685b3ab97 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c @@ -20,7 +20,13 @@ SEC("struct_ops") int BPF_PROG(bpf_first_get_subflow, struct mptcp_sock *msk, struct mptcp_sched_data *data) { - mptcp_subflow_set_scheduled(bpf_mptcp_subflow_ctx_by_pos(data, 0), true); + struct mptcp_subflow_context *subflow; + + bpf_for_each(mptcp_subflow, subflow, msk) { + mptcp_subflow_set_scheduled(subflow, true); + break; + } + return 0; } From patchwork Tue Sep 24 09:28: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: 13810585 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 CDEA215534D for ; Tue, 24 Sep 2024 09:28:48 +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=1727170128; cv=none; b=jEkBHD2e0/pqWd+V4x/jsZKVHOFQwOwfESIO4gkfVfkw3idbfH1rtzxKOvPXraqiZbGHn4Fq8ULJM6mlcVdcCXUfNgoqj/LYogl+VKh6gFU5wZiXTAr8VHXU5Ad9HS1qKIycBTxvd/h+3MRxw3khFl5nhqsTDROWtkmi7X+i6k8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727170128; c=relaxed/simple; bh=+Ns9vcAYflyNwdX3DkGpNegQAHdxvHGggo6htLg093M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GDk84vUC4AapLmHqRuG33n8BhWYUIteA4yLhP20ihA7J3j+jVBI82eB8AK4SEM33h4j1dR3ip9rnMjxTl3yuDNenlckloG8MqarfVa9MbKm4O8XZeI0o+B0l9zatIpg1v+va399EiHQgXoGO9DESorvUHwCx9J8+MEwBPikctSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Xnim8PpY; 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="Xnim8PpY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B25F8C4CEC4; Tue, 24 Sep 2024 09:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727170128; bh=+Ns9vcAYflyNwdX3DkGpNegQAHdxvHGggo6htLg093M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xnim8PpYhh6QcSTDMTH0wav9usIKCjKj/QIcgoa9PhuzR/zrPA8BNbXuMX0ZSJBG3 FQFDodWR21yU+MpfpUZ3hReOijSuR+lg+GFJvwrATGAxurJFj846JSeWngQdqnBTLp Go0AONkZcsJEcepJ9WR3C6GNh5KNIj6nALv9kt2vSr8UKC3uewl71NVCqGnMCy2RVM uIn0hweNVufz/iDMs8KC+XLzQT0AEZ9emB642lbdAcS8pVaJ6BUwcQ8NUZTqDGvFeM ajfGHTAwMuZ3toZwqqowle7jMGEJnDEjA8ssEW1N47MEggYEVZ0Dt2CjwZRBntsFPk jxq92qMJrm2/A== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 4/8] Squash to "selftests/bpf: Add bpf_bkup scheduler & test" Date: Tue, 24 Sep 2024 17:28:32 +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 From: Geliang Tang Use the newly added bpf_for_each() helper to walk the conn_list. Signed-off-by: Geliang Tang --- .../testing/selftests/bpf/progs/mptcp_bpf_bkup.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c index 296f0318d843..70c3a69d4a47 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_bkup.c @@ -20,26 +20,16 @@ SEC("struct_ops") int BPF_PROG(bpf_bkup_get_subflow, struct mptcp_sock *msk, struct mptcp_sched_data *data) { - int nr = -1; - - for (int i = 0; i < data->subflows && i < MPTCP_SUBFLOWS_MAX; i++) { - struct mptcp_subflow_context *subflow; - - subflow = bpf_mptcp_subflow_ctx_by_pos(data, i); - if (!subflow) - break; + struct mptcp_subflow_context *subflow; + bpf_for_each(mptcp_subflow, subflow, msk) { if (!BPF_CORE_READ_BITFIELD_PROBED(subflow, backup) || !BPF_CORE_READ_BITFIELD_PROBED(subflow, request_bkup)) { - nr = i; + mptcp_subflow_set_scheduled(subflow, true); break; } } - if (nr != -1) { - mptcp_subflow_set_scheduled(bpf_mptcp_subflow_ctx_by_pos(data, nr), true); - return -1; - } return 0; } From patchwork Tue Sep 24 09:28:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13810586 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 C5B34155C94 for ; Tue, 24 Sep 2024 09:28:50 +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=1727170130; cv=none; b=c6iVjYSxkb9oelgXC1J3qFiduAs2jgCU75rA/RhfscmcP9jyGMAULoGEnYeDVJEXD3gf+55E7MkFoBqqFsCS3NEO1Xevw9nTuRI1RxclAO0AMAUoc1fu+u26Uckf/Fq3YT6S9R3I3H1ZMGjn92YhG9dgdPaOXFXralg3sWac8Hk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727170130; c=relaxed/simple; bh=Ai/q76HOqa2HACWLQwQsXfDegewKiziuCZeR/XPXRpc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DnRaw40j0wGL0RsSjZJdAijasW5HNwuoEchNAHeSKHrLoIokEm89B2tYyXWfPbIrETujFJVUNAGCIbNRMOyfBaFa1rT/aS49+aEdgiUSLdSDGa1fwwzNSP0gOymcnmfzXyXozrhU1jYlSEaUICR50zWBncdSmEy2NsK51Uk+ZvU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZLxUaUxz; 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="ZLxUaUxz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58E01C4CEC4; Tue, 24 Sep 2024 09:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727170130; bh=Ai/q76HOqa2HACWLQwQsXfDegewKiziuCZeR/XPXRpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZLxUaUxzAJq+v+lp4Keg2+UV8dlPMOF5UTn66ZIQ6RNOb9AUS6OFhnihL0l3Qr47i KhYki4BbhqANwMDs9lqhtx2d5F3fCfL0EzmwIWG1y273zZtINbCRRswPyTSEigeYcT avjd1OVHKbv/oxmOiouBsXV06Ut0+YEQFNWORnckk9OtGuzRXPagsUmxDfrO3WMo6h APj/GFRE6eMf9+NSpGZrp0AUMznsm0kIn0xa8tb5yiDV0X7XC9wAYZifSnwwr0I2TI 5wP0zJiYrzBRrCti5KmHBv+V4r2jVDjFsW7PS9CM/qY/4qbKIQKr+Ght/UU0a17p3B gma7vtXWpqXoQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 5/8] Squash to "selftests/bpf: Add bpf_rr scheduler & test" Date: Tue, 24 Sep 2024 17:28:33 +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 From: Geliang Tang Use the newly added bpf_for_each() helper to walk the conn_list. Signed-off-by: Geliang Tang --- .../testing/selftests/bpf/progs/mptcp_bpf_rr.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c index 638ea6aa63b7..c0b30733d987 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c @@ -37,7 +37,7 @@ int BPF_PROG(bpf_rr_get_subflow, struct mptcp_sock *msk, struct mptcp_subflow_context *subflow; struct mptcp_rr_storage *ptr; struct sock *last_snd = NULL; - int nr = 0; + int id = 1; ptr = bpf_sk_storage_get(&mptcp_rr_map, msk, 0, BPF_LOCAL_STORAGE_GET_F_CREATE); @@ -46,22 +46,24 @@ int BPF_PROG(bpf_rr_get_subflow, struct mptcp_sock *msk, last_snd = ptr->last_snd; - for (int i = 0; i < data->subflows && i < MPTCP_SUBFLOWS_MAX; i++) { - subflow = bpf_mptcp_subflow_ctx_by_pos(data, i); - if (!last_snd || !subflow) + bpf_for_each(mptcp_subflow, subflow, msk) { + if (!last_snd) break; if (mptcp_subflow_tcp_sock(subflow) == last_snd) { - if (i + 1 == MPTCP_SUBFLOWS_MAX || - !bpf_mptcp_subflow_ctx_by_pos(data, i + 1)) + struct mptcp_subflow_context *next; + + next = bpf_core_cast(list_next_entry(subflow, node), + struct mptcp_subflow_context); + if (list_entry_is_head(next, &msk->conn_list, node)) break; - nr = i + 1; + id = next->subflow_id; break; } } - subflow = bpf_mptcp_subflow_ctx_by_pos(data, nr); + subflow = bpf_mptcp_lookup_subflow_by_id(msk, id); if (!subflow) return -1; mptcp_subflow_set_scheduled(subflow, true); From patchwork Tue Sep 24 09:28:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13810587 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 26CD715534D for ; Tue, 24 Sep 2024 09:28:52 +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=1727170132; cv=none; b=f716M+H+rPBi0Z3L26RSKOK3kfhUcHzWyBsb1kAzRxDnCiUD06RJDGBjRZYzDtA0kM06WXyUQE12OMDTNC2q4s1neSZomSEgAU1w0FZXhF78Dng1uFIdXZHBf23eF7zMEQ8zR7VUPlZc+njxRHC/L8Ru8jWDkCgRHg8c/Uw46AM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727170132; c=relaxed/simple; bh=vAGk2SNZxJ2K0XaAAadSTnWA8wtWMYR0tx03ZiqDhLQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PUNQQttku0vNEyP32LR013Cg+ivDQDa+43GWT71miqg+ybzYxRiwFdzbqPkchJZwW6jCsNuJoOqckUtpIo3zIt2jHr7RpgNtUZx/iKY9LqKvn8zfqonfDUGC5CFNtIpJknSE1DxanoQRtGQ7ggNmoDaVtbVu6LNqq9fif5tL04U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hXIq6PWn; 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="hXIq6PWn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00FE9C4CEC4; Tue, 24 Sep 2024 09:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727170132; bh=vAGk2SNZxJ2K0XaAAadSTnWA8wtWMYR0tx03ZiqDhLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hXIq6PWnJKtteiciPw63oEtJtgaeTGoPr5UPLZz7SphAA+5lUwcxd6PzfmmG8avX+ RQIy4LPGsGnQg71LH1X+N+9ArrMlgzKa1hLRmMLK0Pz9tlLq5HRWk+x15KRAL+WyhP Ou1SX0i1HHpNIOvR68IjoPkFtpW2PX2ziQgDciZ0RBYak0YSuZp80gNVakP8yn4T4G FpDwh/F7nVGSgfzQP1B+sfIAT7r+9k39lMjCc/azNLDVMMJryvOzKZPHMnDJ6uMrHn 1FQWaliv69qLZH7fRJcHGggKCdca1/kAY2gUzO6M1nTQd6fg2TGh5D1AUfzX1cxzzV xkGUJDFseJzRQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 6/8] Squash to "selftests/bpf: Add bpf_red scheduler & test" Date: Tue, 24 Sep 2024 17:28:34 +0800 Message-ID: <1c0df7423e49d0d636db82591910dd1e04bc8a9a.1727169534.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 Use the newly added bpf_for_each() helper to walk the conn_list. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/progs/mptcp_bpf_red.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c index cc0aab732fc4..ce19d604b898 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_red.c @@ -20,12 +20,10 @@ SEC("struct_ops") int BPF_PROG(bpf_red_get_subflow, struct mptcp_sock *msk, struct mptcp_sched_data *data) { - for (int i = 0; i < data->subflows && i < MPTCP_SUBFLOWS_MAX; i++) { - if (!bpf_mptcp_subflow_ctx_by_pos(data, i)) - break; + struct mptcp_subflow_context *subflow; - mptcp_subflow_set_scheduled(bpf_mptcp_subflow_ctx_by_pos(data, i), true); - } + bpf_for_each(mptcp_subflow, subflow, msk) + mptcp_subflow_set_scheduled(subflow, true); return 0; } From patchwork Tue Sep 24 09:28:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13810588 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 D75C215539D for ; Tue, 24 Sep 2024 09:28:53 +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=1727170133; cv=none; b=UH1Vwa7UeEM67Z4+6RSUNUGbvj6Mq0D+1kg/DS9T9cLn8tR7xSzxJncKBY6y+O+kAGT36jZbT34TqXuNfF1g1/HyWH3cZBtLSnmV9zbcxkwg81Z7ry+GeU/HgpLw5u0DqHC3/oELSl/UBw3fFShzOr/ysp7IHicojdpd/Jac7c8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727170133; c=relaxed/simple; bh=e47A1kNeBCP3iDZJFlUGIUyLRRz+/61jcgjFmdiXCmQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q3X+nYAZfAPsQxGa1CsLbzoz+RWNFI0gvp9EYNE5nYURmDjFv+QAyb+1l0U7x3a0v159HsFpFXDYbFV5Jen+Q1rE2syREt43KUpIv3YPUTjj2zfuYPgp5lWzSGjYHVhX/iAhtc3Tcq5Xaf+Q1Z57n6n/x7c/5zTmOE84boOpAb0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XkP0bTGY; 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="XkP0bTGY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7A6FC4CEC4; Tue, 24 Sep 2024 09:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727170133; bh=e47A1kNeBCP3iDZJFlUGIUyLRRz+/61jcgjFmdiXCmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XkP0bTGYaNeUbrDKGUDe96K8AdA9XEb+3MHLDP+Qn3lAVs15z6F6bcoutuMFK/8uL XbD92niUHqBxiJUHqn689wcKYcJlSbbVwf+J+MTMpquH+UDREgHOdWUVO8nNx8RO33 NSNthDQuy70JgiL7Jjhb2ML6GEsvep/jBVCTIDVhMThFU37j8LXJUs05vYUB1+L46u RLJM1KYaB8YlDs15FvhZWNxgD8p5XS/Ohwv0ig+6CHfhMfli2KgrNI+Hui7zCeHRY5 mJaDUgqmeAd8kNZ5KUNysYzsR+pCKpNRDZ4xBUC7A7XZ7VB9ZlB5dSRX/WuBrSM8fO UMXaHByRn7QLw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 7/8] Squash to "selftests/bpf: Add bpf_burst scheduler & test" Date: Tue, 24 Sep 2024 17:28:35 +0800 Message-ID: <1cfa154b788d27b18285a23e7cdd40d199802623.1727169534.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 Use the newly added bpf_for_each() helper to walk the conn_list. Signed-off-by: Geliang Tang --- .../selftests/bpf/progs/mptcp_bpf_burst.c | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c index dcab196867fe..3bf0213d01b3 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c @@ -66,8 +66,7 @@ void BPF_PROG(mptcp_sched_burst_release, struct mptcp_sock *msk) { } -static int bpf_burst_get_send(struct mptcp_sock *msk, - struct mptcp_sched_data *data) +static int bpf_burst_get_send(struct mptcp_sock *msk) { struct bpf_subflow_send_info send_info[SSK_MODE_MAX]; struct mptcp_subflow_context *subflow; @@ -83,14 +82,8 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, send_info[i].linger_time = -1; } - for (i = 0; i < data->subflows && i < MPTCP_SUBFLOWS_MAX; i++) { - bool backup; - - subflow = bpf_mptcp_subflow_ctx_by_pos(data, i); - if (!subflow) - break; - - backup = subflow->backup || subflow->request_bkup; + bpf_for_each(mptcp_subflow, subflow, msk) { + bool backup = subflow->backup || subflow->request_bkup; ssk = mptcp_subflow_tcp_sock(subflow); if (!mptcp_subflow_active(subflow)) @@ -108,7 +101,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, linger_time = div_u64((__u64)ssk->sk_wmem_queued << 32, pace); if (linger_time < send_info[backup].linger_time) { - send_info[backup].subflow_id = i; + send_info[backup].subflow_id = subflow->subflow_id; send_info[backup].linger_time = linger_time; } } @@ -118,7 +111,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, if (!nr_active) send_info[SSK_MODE_ACTIVE].subflow_id = send_info[SSK_MODE_BACKUP].subflow_id; - subflow = bpf_mptcp_subflow_ctx_by_pos(data, send_info[SSK_MODE_ACTIVE].subflow_id); + subflow = bpf_mptcp_lookup_subflow_by_id(msk, send_info[SSK_MODE_ACTIVE].subflow_id); if (!subflow) return -1; ssk = mptcp_subflow_tcp_sock(subflow); @@ -140,19 +133,15 @@ static int bpf_burst_get_send(struct mptcp_sock *msk, return 0; } -static int bpf_burst_get_retrans(struct mptcp_sock *msk, - struct mptcp_sched_data *data) +static int bpf_burst_get_retrans(struct mptcp_sock *msk) { - int backup = MPTCP_SUBFLOWS_MAX, pick = MPTCP_SUBFLOWS_MAX, subflow_id; + int backup = MPTCP_SUBFLOWS_MAX, pick = MPTCP_SUBFLOWS_MAX; struct mptcp_subflow_context *subflow; int min_stale_count = INT_MAX; struct sock *ssk; + int subflow_id; - for (int i = 0; i < data->subflows && i < MPTCP_SUBFLOWS_MAX; i++) { - subflow = bpf_mptcp_subflow_ctx_by_pos(data, i); - if (!subflow) - break; - + bpf_for_each(mptcp_subflow, subflow, msk) { if (!mptcp_subflow_active(subflow)) continue; @@ -166,12 +155,12 @@ static int bpf_burst_get_retrans(struct mptcp_sock *msk, if (subflow->backup || subflow->request_bkup) { if (backup == MPTCP_SUBFLOWS_MAX) - backup = i; + backup = subflow->subflow_id; continue; } if (pick == MPTCP_SUBFLOWS_MAX) - pick = i; + pick = subflow->subflow_id; } if (pick < MPTCP_SUBFLOWS_MAX) { @@ -181,7 +170,7 @@ static int bpf_burst_get_retrans(struct mptcp_sock *msk, subflow_id = min_stale_count > 1 ? backup : MPTCP_SUBFLOWS_MAX; out: - subflow = bpf_mptcp_subflow_ctx_by_pos(data, subflow_id); + subflow = bpf_mptcp_lookup_subflow_by_id(msk, subflow_id); if (!subflow) return -1; mptcp_subflow_set_scheduled(subflow, true); @@ -193,8 +182,8 @@ int BPF_PROG(bpf_burst_get_subflow, struct mptcp_sock *msk, struct mptcp_sched_data *data) { if (data->reinject) - return bpf_burst_get_retrans(msk, data); - return bpf_burst_get_send(msk, data); + return bpf_burst_get_retrans(msk); + return bpf_burst_get_send(msk); } SEC(".struct_ops") From patchwork Tue Sep 24 09:28:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13810589 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 5F591155C94 for ; Tue, 24 Sep 2024 09:28:55 +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=1727170135; cv=none; b=fIQOVQ2jM98PMoq0qtoF9G9+ziycbkEglZx7BEP+HmVuxtVcKaH7GdIog45I5O5yolwZGFVlA9FYi99P2q94nwwFWPFYMgsbtMjlkDcb3mFkwwiE53tAwtvJbVdj13gt9QutslhheOtIbNFMhy9xCiR5MkAZILivXxg10EutI30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727170135; c=relaxed/simple; bh=hN3agyD3X5i/gzavJ94nZKXl6iKgXdKHAjxn48A3d+A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NhWU2BXN9OpGX9gAUTNxN2TS9VqnlgrIyVKtIXCjZfs4cYOaQDuqvayuSSykXmOTcigB+QFDt5eUeltFhvZMDMNpfCuUwTmCQdkabMjiJqrG8IwjULqJ7T/a3bdpfrJw7yy5H/UxDHbvEtDph6SVNGL7SIHICODcdHoUH8zDKPs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DnvqH1MX; 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="DnvqH1MX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46297C4CEC5; Tue, 24 Sep 2024 09:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727170135; bh=hN3agyD3X5i/gzavJ94nZKXl6iKgXdKHAjxn48A3d+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DnvqH1MX54fJebrkyIwl1WbSLxEErZ1WFTHxcOryw269p/rn4WjIOGZm5IHR7ZSE1 zSfIKfAQ/tzGhB+tougHpWbDRyVskJBzESoGj8D1YCY4peUtEsC69CqmPW9+VZ2sxt DI67OqSi72VJJmnBmaH6CuY7SbQ/jlfsOMD0YQSm2Ei9Z26AkgN4hWsznyD1v7HygK mVFGcAAEf0YUxEXIhPsNNw9ne75ySkItWJtzqB3mIqtdEJZnmdzQ6+wQoWTsHtTp1W X6nhApZLueJl8LCrTlvB/X4wMr5TGqQpS1e6ad4XtOHlkg3RxdkhRKLKQIdC1rb5rM cvxi/hF8d8XIg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 8/8] mptcp: drop subflow contexts in mptcp_sched_data Date: Tue, 24 Sep 2024 17:28:36 +0800 Message-ID: <7de75b35ee8e2159cce7a3259a047eea21f398b2.1727169534.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 The mptcp_subflow bpf_iter is added now, it's better to use the helper bpf_for_each(mptcp_subflow) to traverse all subflows on the conn_list of an MPTCP socket and then call kfunc to modify the fields of each subflow in the WIP MPTCP BPF packet scheduler examples, instead of converting them to a fixed array. With this helper, we can get rid of this subflow array "contexts" and the size of it "subflows" in struct mptcp_sched_data. Signed-off-by: Geliang Tang --- include/net/mptcp.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index 814b5f2e3ed5..84d67947a517 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -104,8 +104,6 @@ struct mptcp_out_options { struct mptcp_sched_data { bool reinject; - u8 subflows; - struct mptcp_subflow_context *contexts[MPTCP_SUBFLOWS_MAX]; }; struct mptcp_sched_ops {