diff mbox series

[mptcp-next,v15,04/19] mptcp: move snd_burst into mptcp_sched_ops

Message ID 14220e2e48a619afff73d8935901024fee37a710.1666349129.git.geliang.tang@suse.com (mailing list archive)
State Superseded, archived
Delegated to: Mat Martineau
Headers show
Series BPF redundant scheduler | expand

Checks

Context Check Description
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 53 lines checked
matttbe/build fail Build error with: -Werror
matttbe/KVM_Validation__normal warning Unstable: 3 failed test(s): packetdrill_add_addr selftest_mptcp_join selftest_simult_flows

Commit Message

Geliang Tang Oct. 21, 2022, 10:59 a.m. UTC
Move snd_burst from struct mptcp_sock into struct mptcp_sched_ops, use
msk->sched->snd_burst instead of msk->snd_burst.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 include/net/mptcp.h  | 2 ++
 net/mptcp/protocol.c | 7 +++----
 net/mptcp/protocol.h | 1 -
 net/mptcp/sched.c    | 1 +
 4 files changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index a45e00bf2f3e..a0c01bf153b2 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -110,6 +110,8 @@  struct mptcp_sched_ops {
 	int (*get_subflow)(const struct mptcp_sock *msk,
 			   struct mptcp_sched_data *data);
 
+	/* burst scheduler */
+	int		snd_burst;
 	/* round-robin scheduler */
 	struct sock	*last_snd;
 
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index a9d33dea2a8a..594206bfe9a5 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1476,7 +1476,7 @@  struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
 	subflow->avg_pacing_rate = div_u64((u64)subflow->avg_pacing_rate * wmem +
 					   READ_ONCE(ssk->sk_pacing_rate) * burst,
 					   burst + wmem);
-	msk->snd_burst = burst;
+	msk->sched->snd_burst = burst;
 	return ssk;
 }
 
@@ -1494,7 +1494,7 @@  static void mptcp_update_post_push(struct mptcp_sock *msk,
 
 	dfrag->already_sent += sent;
 
-	msk->snd_burst -= sent;
+	msk->sched->snd_burst -= sent;
 
 	snd_nxt_new += dfrag->already_sent;
 
@@ -1545,7 +1545,7 @@  static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
 		}
 		WRITE_ONCE(msk->first_pending, mptcp_send_next(sk));
 
-		if (msk->snd_burst <= 0 ||
+		if (msk->sched->snd_burst <= 0 ||
 		    !sk_stream_memory_free(ssk) ||
 		    !mptcp_subflow_active(mptcp_subflow_ctx(ssk))) {
 			err = copied ? : -EAGAIN;
@@ -2285,7 +2285,6 @@  bool __mptcp_retransmit_pending_data(struct sock *sk)
 	mptcp_data_unlock(sk);
 
 	msk->first_pending = rtx_head;
-	msk->snd_burst = 0;
 
 	/* be sure to clear the "sent status" on all re-injected fragments */
 	list_for_each_entry(cur, &msk->rtx_queue, list) {
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index a58fa261f487..9b4f4443fda3 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -257,7 +257,6 @@  struct mptcp_sock {
 	atomic64_t	rcv_wnd_sent;
 	u64		rcv_data_fin_seq;
 	int		rmem_fwd_alloc;
-	int		snd_burst;
 	int		old_wspace;
 	u64		recovery_snd_nxt;	/* in recovery mode accept up to this seq;
 						 * recovery related fields are under data_lock
diff --git a/net/mptcp/sched.c b/net/mptcp/sched.c
index f6c622e15584..0487206bb832 100644
--- a/net/mptcp/sched.c
+++ b/net/mptcp/sched.c
@@ -68,6 +68,7 @@  int mptcp_init_sched(struct mptcp_sock *msk,
 	if (msk->sched->init)
 		msk->sched->init(msk);
 
+	msk->sched->snd_burst = 0;
 	msk->sched->last_snd = NULL;
 
 	pr_debug("sched=%s", msk->sched->name);