[PATCH mptcp-next v9 02/13] mptcp: make mptcp_subflow_set_scheduled inline

Geliang Tang posted 13 patches 1 month ago
[PATCH mptcp-next v9 02/13] mptcp: make mptcp_subflow_set_scheduled inline
Posted by Geliang Tang 1 month ago
From: Geliang Tang <tanggeliang@kylinos.cn>

Now mptcp_subflow_set_scheduled() is no longer used in BPF, but only in
kernel. A new mptcp_subflow_set_scheduled() helper will be implemented
in BPF specifically for use with BPF. To avoid compilation errors due
to duplicate names, this function is made inline in kernel and moved into
protocol.h.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/mptcp/protocol.h | 9 +++++++--
 net/mptcp/sched.c    | 6 ------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index b4c72a73594f..ab4e88b40efc 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -750,13 +750,18 @@ 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 6da60e35932f..73a24b9c96ff 100644
--- a/net/mptcp/sched.c
+++ b/net/mptcp/sched.c
@@ -135,12 +135,6 @@ 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);
-}
-
 static void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk,
 					  struct mptcp_sched_data *data)
 {
-- 
2.45.2