[PATCH mptcp-next] Squash to "selftests/bpf: Add bpf_stale scheduler, v3"

Geliang Tang posted 1 patch 11 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
tools/testing/selftests/bpf/progs/mptcp_bpf_stale.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
[PATCH mptcp-next] Squash to "selftests/bpf: Add bpf_stale scheduler, v3"
Posted by Geliang Tang 11 months ago
Move set_stale from get_subflow() to init().

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/bpf/progs/mptcp_bpf_stale.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_stale.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_stale.c
index 08c857f79221..b5ca9e273409 100644
--- a/tools/testing/selftests/bpf/progs/mptcp_bpf_stale.c
+++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_stale.c
@@ -90,7 +90,11 @@ void BPF_PROG(mptcp_sched_stale_init, struct mptcp_sock *msk)
 	if (!storage)
 		return;
 
+	for (int i = 0; i < MPTCP_SUBFLOWS_MAX; i++)
+		storage->ids[i] = 0;
 	storage->nr = 0;
+
+	mptcp_subflow_set_stale(storage, 2);
 }
 
 SEC("struct_ops/mptcp_sched_stale_release")
@@ -102,7 +106,6 @@ void BPF_PROG(mptcp_sched_stale_release, struct mptcp_sock *msk)
 int BPF_STRUCT_OPS(bpf_stale_get_subflow, struct mptcp_sock *msk,
 		   struct mptcp_sched_data *data)
 {
-	struct mptcp_subflow_context *subflow;
 	struct mptcp_stale_storage *storage;
 	int nr = -1;
 
@@ -115,14 +118,11 @@ int BPF_STRUCT_OPS(bpf_stale_get_subflow, struct mptcp_sock *msk,
 
 	/* Handle invalid subflow ids for subflows that have been closed */
 	for (int i = 0; i < storage->nr && i < MPTCP_SUBFLOWS_MAX; i++) {
-		if (!mptcp_subflow_is_active(data, storage->ids[i]))
+		if (!mptcp_subflow_is_active(data, storage->ids[i]) &&
+		    data->subflows > 1)
 			mptcp_subflow_clear_stale(storage, storage->ids[i]);
 	}
 
-	subflow = mptcp_subflow_ctx_by_pos(data, 1);
-	if (subflow)
-		mptcp_subflow_set_stale(storage, subflow->subflow_id);
-
 	for (int i = 0; i < data->subflows && i < MPTCP_SUBFLOWS_MAX; i++) {
 		struct mptcp_subflow_context *subflow;
 
-- 
2.35.3