diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index e4686a8bb0b8f..cfeb8537f4238 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -737,6 +737,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 fe16140dfbf22..582ac60c4b190 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 d8ab234f4410e..98701d4164295 100644 --- a/net/mptcp/sched.c +++ b/net/mptcp/sched.c @@ -148,6 +148,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 1ce84873231dc..39edd3c319247 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 f0c9f59847361..9306dd27665c8 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c @@ -133,7 +133,7 @@ static int 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 7d4d29a50aa00..62dd152238472 100644 --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c @@ -58,7 +58,6 @@ int BPF_PROG(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);