diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index 15459418a4b5..9274372aa8a5 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -745,6 +745,7 @@ BTF_ID_FLAGS(func, mptcp_subflow_shutdown, KF_SLEEPABLE) BTF_ID_FLAGS(func, mptcp_close_ssk, KF_SLEEPABLE) BTF_ID_FLAGS(func, BPF_MPTCP_INC_STATS) BTF_ID_FLAGS(func, mptcp_pm_nl_mp_prio_send_ack, KF_SLEEPABLE) +BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled) BTF_ID_FLAGS(func, mptcp_subflow_active) BTF_ID_FLAGS(func, mptcp_set_timeout) BTF_ID_FLAGS(func, mptcp_wnd_end) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index fe16140dfbf2..582ac60c4b19 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -758,18 +758,13 @@ void mptcp_sched_init(void); int mptcp_init_sched(struct mptcp_sock *msk, struct mptcp_sched_ops *sched); void mptcp_release_sched(struct mptcp_sock *msk); +void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, + bool scheduled); struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk); struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk); int mptcp_sched_get_send(struct mptcp_sock *msk); int mptcp_sched_get_retrans(struct mptcp_sock *msk); -static inline void -mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, - bool scheduled) -{ - WRITE_ONCE(subflow->scheduled, scheduled); -} - static inline u64 mptcp_data_avail(const struct mptcp_sock *msk) { return READ_ONCE(msk->bytes_received) - READ_ONCE(msk->bytes_consumed); diff --git a/net/mptcp/sched.c b/net/mptcp/sched.c index 91a17db4fde0..87aa291fed74 100644 --- a/net/mptcp/sched.c +++ b/net/mptcp/sched.c @@ -159,6 +159,12 @@ void mptcp_release_sched(struct mptcp_sock *msk) bpf_module_put(sched, sched->owner); } +void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, + bool scheduled) +{ + WRITE_ONCE(subflow->scheduled, scheduled); +} + int mptcp_sched_get_send(struct mptcp_sock *msk) { struct mptcp_subflow_context *subflow; diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf.h b/tools/testing/selftests/bpf/progs/mptcp_bpf.h index 1ce84873231d..39edd3c31924 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf.h +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf.h @@ -74,11 +74,14 @@ mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow) #define WRITE_ONCE(x, val) ((*(volatile typeof(x) *) &(x)) = (val)) static __always_inline void -mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, bool scheduled) +bpf_mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, bool scheduled) { WRITE_ONCE(subflow->scheduled, scheduled); } +extern void +mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, bool scheduled) __ksym; + /* 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; diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c index 6104606018dc..ef7855030ca1 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c @@ -134,7 +134,7 @@ int BPF_PROG(bpf_burst_get_send, struct mptcp_sock *msk) msk->snd_burst = burst; out: - mptcp_subflow_set_scheduled(subflow, true); + bpf_mptcp_subflow_set_scheduled(subflow, true); return 0; } diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c index fc216195549e..c3823ed20ac8 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c @@ -59,7 +59,6 @@ static int bpf_rr_get_subflow(struct mptcp_sock *msk) } out: - next = bpf_core_cast(next, struct mptcp_subflow_context); mptcp_subflow_set_scheduled(next, true); //bpf_printk("rr subflow=%u/%u", next->subflow_id, msk->pm.subflows + 1); ptr->last_snd = mptcp_subflow_tcp_sock(next);