Skip to contentSkip to conversation

mptcp: autotune related improvement

PATCH Superseded Paolo Abeni 3 participants 7 messages Oct 31, 2025 – Nov 1, 2025

Subsystems (2)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Paolo Abeni

author maintainer
#0 lore raw

cover mptcp: autotune related improvement

This series collects a few follow-up for the backlog refactor, with some of them posing as fixes just to confuse the enemy (or feel the season mood)

Targeting net-next as the issues addressed are very old, the change is quite invasive and, as mentioned, based on the BL refactor.

Only patch 1/4 could be considered for net, but still included because somewhat related to the others and to keep my life easy.

Paolo Abeni (4):
mptcp: avoid unneeded subflow-level drops.
mptcp: fix receive space time initialization.
mptcp: better mptcp-level rtt estimator
mptcp: add receive queue awareness in tcp_rcv_space_adjust()

 net/mptcp/options.c  |  31 ++++++++
 net/mptcp/protocol.c | 177 ++++++++++++++++++++++++++-----------------
 net/mptcp/protocol.h |  15 +++-
 net/mptcp/subflow.c  |   2 -
 4 files changed, 150 insertions(+), 75 deletions(-)
Signature · 1 line
2.51.0
author maintainer
#1 lore raw

PATCH 1/4 mptcp: avoid unneeded subflow-level drops.

The rcv window is shared among all the subflows. Currently, MPTCP sync the TCP-level rcv window with the MPTCP one at tcp_transmit_skb() time.

The above means that incoming data may sporadically observe outdated TCP-level rcv window and being wrongly dropped by TCP.

Address the issue checking for the edge condition before queuing the data at TCP level, and eventually syncing the rcv window as needed.

Note that the issue is actually present from the very first MPTCP implementation, but backports older than the blamed commit below will range from impossible to useless.

Before:
nstat >/dev/null ;sleep 1; nstat -z TcpExtBeyondWindow
TcpExtBeyondWindow 14 0.0

After:
nstat >/dev/null ;sleep 1; nstat -z TcpExtBeyondWindow
TcpExtBeyondWindow 0 0.0

Fixes fa3fe2b15031 ("mptcp: track window announced to peer")
---
 net/mptcp/options.c  | 31 +++++++++++++++++++++++++++++++
 net/mptcp/protocol.h |  1 +
 2 files changed, 32 insertions(+)
net/mptcp/options.c +31 -0
index cf531f2d815c..9e2516193e21 100644
@@ -1042,6 +1042,31 @@ static void __mptcp_snd_una_update(struct mptcp_sock *msk, u64 new_snd_una)
 	WRITE_ONCE(msk->snd_una, new_snd_una);
 }
 
+static void rwin_update(struct mptcp_sock *msk, struct sock *ssk,
+			struct sk_buff *skb)
+{
+	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
+	struct tcp_sock *tp = tcp_sk(ssk);
+	u64 mptcp_rcv_wnd;
+
+	/* Avoid touching extra cachelines if TCP is going to accept this
+	 * skb without filling the TCP-level window even with a possibly
+	 * outdated mptcp-level rwin.
+	 */
+	if (!skb->len || skb->len < tcp_receive_window(tp))
+		return;
+
+	mptcp_rcv_wnd = atomic64_read(&msk->rcv_wnd_sent);
+	if (!after64(mptcp_rcv_wnd, subflow->rcv_wnd_sent))
+		return;
+
+	/* Some other subflow grew the mptcp-level rwin since rcv_wup,
+	 * resync.
+	 */
+	tp->rcv_wnd += mptcp_rcv_wnd - subflow->rcv_wnd_sent;
+	subflow->rcv_wnd_sent = mptcp_rcv_wnd;
+}
+
 static void ack_update_msk(struct mptcp_sock *msk,
 			   struct sock *ssk,
 			   struct mptcp_options_received *mp_opt)
@@ -1209,6 +1234,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
 	 */
 	if (mp_opt.use_ack)
 		ack_update_msk(msk, sk, &mp_opt);
+	rwin_update(msk, sk, skb);
 
 	/* Zero-data-length packets are dropped by the caller and not
 	 * propagated to the MPTCP layer, so the skb extension does not
@@ -1295,6 +1321,10 @@ static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th)
 
 	if (rcv_wnd_new != rcv_wnd_old) {
 raise_win:
+		/* the msk-level rcv wnd is after the tcp level one,
+		 * sync the latter
+		 */
+		rcv_wnd_new = rcv_wnd_old;
 		win = rcv_wnd_old - ack_seq;
 		tp->rcv_wnd = min_t(u64, win, U32_MAX);
 		new_win = tp->rcv_wnd;
@@ -1318,6 +1348,7 @@ static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th)
 
 update_wspace:
 	WRITE_ONCE(msk->old_wspace, tp->rcv_wnd);
+	subflow->rcv_wnd_sent = rcv_wnd_new;
 }
 
 __sum16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum)
net/mptcp/protocol.h +1 -0
index 8e0f780e9210..84f2c51d776c 100644
@@ -513,6 +513,7 @@ struct mptcp_subflow_context {
 	u64	remote_key;
 	u64	idsn;
 	u64	map_seq;
+	u64	rcv_wnd_sent;
 	u32	snd_isn;
 	u32	token;
 	u32	rel_write_seq;
Signature · 1 line
2.51.0
author maintainer
#2 lore raw

PATCH 2/4 mptcp: fix receive space time initialization.

In reply to Paolo Abeni

MPTCP initialize the receive buffer stamp in mptcp_rcv_space_init(), using the provided subflow stamp. Such helper is invoked in several places, with a catch-up call in mptcp_rcv_space_adjust().

For passive sockets, MPTCP ends-up accesses the subflow stamp before its initialization, leading to quite randomic timing for the first receive buffer auto-tune event.

Fix the issue using a fresh stamp.

Drop the all the mptcp_rcv_space_init() invocations except the catch-up
one: they add unneeded complexity for no good reason.

As a side effect, this avoid using a zero value for imsk->rcvq_space.time, that made the first receive buffer auto-tune even quite randomic.

This will also make the next patch cleaner.

Fixes 013e3179dbd2 ("mptcp: fix rcv space initialization")
---
 net/mptcp/protocol.c | 40 ++++++++++++++++++++--------------------
 net/mptcp/protocol.h |  6 +++++-
 net/mptcp/subflow.c  |  2 --
 3 files changed, 25 insertions(+), 23 deletions(-)
net/mptcp/protocol.c +20 -20
index d16ad1a85411..e17abab7bab6 100644
@@ -2047,6 +2047,21 @@ static int __mptcp_recvmsg_mskq(struct sock *sk, struct msghdr *msg,
 	return copied;
 }
 
+static void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk)
+{
+	const struct tcp_sock *tp = tcp_sk(ssk);
+
+	msk->rcvspace_init = 1;
+	msk->rcvq_space.copied = 0;
+	msk->rcvq_space.rtt_us = 0;
+
+	/* initial rcv_space offering made to peer */
+	msk->rcvq_space.space = min_t(u32, tp->rcv_wnd,
+				      TCP_INIT_CWND * tp->advmss);
+	if (msk->rcvq_space.space == 0)
+		msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT;
+}
+
 /* receive buffer autotuning.  See tcp_rcv_space_adjust for more information.
  *
  * Only difference: Use highest rtt estimate of the subflows in use.
@@ -2069,8 +2084,8 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 
 	msk->rcvq_space.copied += copied;
 
-	mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC);
-	time = tcp_stamp_us_delta(mstamp, msk->rcvq_space.time);
+	mstamp = mptcp_stamp();
+	time = tcp_stamp_us_delta(mstamp, READ_ONCE(msk->rcvq_space.time));
 
 	rtt_us = msk->rcvq_space.rtt_us;
 	if (rtt_us && time < (rtt_us >> 3))
@@ -3487,7 +3502,7 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
 	mptcp_copy_inaddrs(nsk, ssk);
 	__mptcp_propagate_sndbuf(nsk, ssk);
 
-	mptcp_rcv_space_init(msk, ssk);
+	msk->rcvq_space.time = mptcp_stamp();
 
 	if (mp_opt->suboptions & OPTION_MPTCP_MPC_ACK)
 		__mptcp_subflow_fully_established(msk, subflow, mp_opt);
@@ -3497,23 +3512,6 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
 	return nsk;
 }
 
-void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk)
-{
-	const struct tcp_sock *tp = tcp_sk(ssk);
-
-	msk->rcvspace_init = 1;
-	msk->rcvq_space.copied = 0;
-	msk->rcvq_space.rtt_us = 0;
-
-	msk->rcvq_space.time = tp->tcp_mstamp;
-
-	/* initial rcv_space offering made to peer */
-	msk->rcvq_space.space = min_t(u32, tp->rcv_wnd,
-				      TCP_INIT_CWND * tp->advmss);
-	if (msk->rcvq_space.space == 0)
-		msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT;
-}
-
 static void mptcp_destroy(struct sock *sk)
 {
 	struct mptcp_sock *msk = mptcp_sk(sk);
@@ -3703,6 +3701,8 @@ void mptcp_finish_connect(struct sock *ssk)
 	 */
 	WRITE_ONCE(msk->local_key, subflow->local_key);
 
+	WRITE_ONCE(msk->rcvq_space.time, mptcp_stamp());
+
 	mptcp_pm_new_connection(msk, ssk, 0);
 }
 
net/mptcp/protocol.h +5 -1
index 84f2c51d776c..1f67d8468dfb 100644
@@ -908,7 +908,11 @@ static inline bool mptcp_is_fully_established(struct sock *sk)
 	       READ_ONCE(mptcp_sk(sk)->fully_established);
 }
 
-void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk);
+static inline u64 mptcp_stamp(void)
+{
+	return div_u64(tcp_clock_ns(), NSEC_PER_USEC);
+}
+
 void mptcp_data_ready(struct sock *sk, struct sock *ssk);
 bool mptcp_finish_join(struct sock *sk);
 bool mptcp_schedule_work(struct sock *sk);
net/mptcp/subflow.c +0 -2
index ac8616e7521e..b64ab7649908 100644
@@ -462,8 +462,6 @@ void __mptcp_sync_state(struct sock *sk, int state)
 
 	subflow = mptcp_subflow_ctx(ssk);
 	__mptcp_propagate_sndbuf(sk, ssk);
-	if (!msk->rcvspace_init)
-		mptcp_rcv_space_init(msk, ssk);
 
 	if (sk->sk_state == TCP_SYN_SENT) {
 		/* subflow->idsn is always available is TCP_SYN_SENT state,
Signature · 1 line
2.51.0
author maintainer
#3 lore raw

PATCH 3/4 mptcp: better mptcp-level rtt estimator

In reply to Paolo Abeni

On high speed links, the MPTCP-level receive buffer auto-tuning happens with a frequency well above the TCP-level's one. That in turn can cause excessive/unneeded receive buffer increase.

On such links, the initial rtt_us value is considerably higher than the actual delay, but the current mptcp_rcv_space_adjust() logic prevents msk->rcvq_space.rtt_us from decreasing.

Address the issue with a more accurate RTT estimation strategy: the MPTCP-level RTT is set to the minimum of all the subflow feeding data into the MPTCP-receive buffer.

Some complexity is due to try to avoid frequent updates of MPTCP-level fields and to allow subflow feeding data via the backlog to still perform the update under the msk socket lock.

Fixes a6b118febbab ("mptcp: add receive buffer auto-tuning")
---
 net/mptcp/protocol.c | 89 ++++++++++++++++++++++++++++++--------------
 net/mptcp/protocol.h |  8 +++-
 2 files changed, 68 insertions(+), 29 deletions(-)
net/mptcp/protocol.c +61 -28
index e17abab7bab6..4fc1519baab6 100644
@@ -865,10 +865,52 @@ static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk)
 	return moved;
 }
 
+static void mptcp_rcv_rtt_update(struct mptcp_sock *msk, u32 rtt_us, u8 sr)
+{
+	/* Similar to plain TCP, only consider samples with empty RX queue */
+	if (mptcp_data_avail(msk))
+		return;
+
+	if (msk->rcv_rtt_est.reset) {
+		msk->rcv_rtt_est.rtt_us = rtt_us;
+		msk->rcv_rtt_est.reset = false;
+		msk->scaling_ratio = sr;
+		return;
+	}
+
+	if (rtt_us < msk->rcv_rtt_est.rtt_us)
+		msk->rcv_rtt_est.rtt_us = rtt_us;
+	if (sr < msk->scaling_ratio)
+		msk->scaling_ratio = sr;
+}
+
+static void mptcp_rcv_rtt_update_from_backlog(struct mptcp_sock *msk)
+{
+	mptcp_rcv_rtt_update(msk, msk->rcv_rtt_est.bl_rtt_us,
+			     msk->rcv_rtt_est.bl_scaling_ratio);
+
+	if (READ_ONCE(msk->rcv_rtt_est.reset_bl)) {
+		msk->rcv_rtt_est.bl_rtt_us = U32_MAX;
+		msk->rcv_rtt_est.bl_scaling_ratio = U8_MAX;
+		msk->rcv_rtt_est.reset_bl = false;
+	}
+}
+
+static void mptcp_backlog_rcv_rtt_update(struct mptcp_sock *msk, u32 rtt_us,
+					 u8 sr)
+{
+	if (rtt_us < msk->rcv_rtt_est.bl_rtt_us)
+		msk->rcv_rtt_est.bl_rtt_us = rtt_us;
+	if (sr < msk->rcv_rtt_est.bl_scaling_ratio)
+		msk->rcv_rtt_est.bl_scaling_ratio = sr;
+}
+
 void mptcp_data_ready(struct sock *sk, struct sock *ssk)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
+	u32 rtt_us = tcp_sk(ssk)->rcv_rtt_est.rtt_us;
 	struct mptcp_sock *msk = mptcp_sk(sk);
+	u8 sr = tcp_sk(ssk)->scaling_ratio;
 
 	/* The peer can send data while we are shutting down this
 	 * subflow at subflow destruction time, but we must avoid enqueuing
@@ -879,10 +921,12 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk)
 
 	mptcp_data_lock(sk);
 	if (!sock_owned_by_user(sk)) {
+		mptcp_rcv_rtt_update(msk, rtt_us, sr);
 		/* Wake-up the reader only for in-sequence data */
 		if (move_skbs_to_msk(msk, ssk) && mptcp_epollin_ready(sk))
 			sk->sk_data_ready(sk);
 	} else {
+		mptcp_backlog_rcv_rtt_update(msk, rtt_us, sr);
 		__mptcp_move_skbs_from_subflow(msk, ssk, false);
 	}
 	mptcp_data_unlock(sk);
@@ -2053,7 +2097,6 @@ static void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk)
 
 	msk->rcvspace_init = 1;
 	msk->rcvq_space.copied = 0;
-	msk->rcvq_space.rtt_us = 0;
 
 	/* initial rcv_space offering made to peer */
 	msk->rcvq_space.space = min_t(u32, tp->rcv_wnd,
@@ -2070,16 +2113,15 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 {
 	struct mptcp_subflow_context *subflow;
 	struct sock *sk = (struct sock *)msk;
-	u8 scaling_ratio = U8_MAX;
-	u32 time, advmss = 1;
-	u64 rtt_us, mstamp;
+	u32 rtt_us, time;
+	u64 mstamp;
 
 	msk_owned_by_me(msk);
 
 	if (copied <= 0)
 		return;
 
-	if (!msk->rcvspace_init)
+	if (unlikely(!msk->rcvspace_init))
 		mptcp_rcv_space_init(msk, msk->first);
 
 	msk->rcvq_space.copied += copied;
@@ -2087,29 +2129,8 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 	mstamp = mptcp_stamp();
 	time = tcp_stamp_us_delta(mstamp, READ_ONCE(msk->rcvq_space.time));
 
-	rtt_us = msk->rcvq_space.rtt_us;
-	if (rtt_us && time < (rtt_us >> 3))
-		return;
-
-	rtt_us = 0;
-	mptcp_for_each_subflow(msk, subflow) {
-		const struct tcp_sock *tp;
-		u64 sf_rtt_us;
-		u32 sf_advmss;
-
-		tp = tcp_sk(mptcp_subflow_tcp_sock(subflow));
-
-		sf_rtt_us = READ_ONCE(tp->rcv_rtt_est.rtt_us);
-		sf_advmss = READ_ONCE(tp->advmss);
-
-		rtt_us = max(sf_rtt_us, rtt_us);
-		advmss = max(sf_advmss, advmss);
-		scaling_ratio = min(tp->scaling_ratio, scaling_ratio);
-	}
-
-	msk->rcvq_space.rtt_us = rtt_us;
-	msk->scaling_ratio = scaling_ratio;
-	if (time < (rtt_us >> 3) || rtt_us == 0)
+	rtt_us = msk->rcv_rtt_est.rtt_us;
+	if (rtt_us == U32_MAX || time < (rtt_us >> 3))
 		return;
 
 	if (msk->rcvq_space.copied <= msk->rcvq_space.space)
@@ -2137,6 +2158,8 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 new_measure:
 	msk->rcvq_space.copied = 0;
 	msk->rcvq_space.time = mstamp;
+	msk->rcv_rtt_est.reset = true;
+	WRITE_ONCE(msk->rcv_rtt_est.reset_bl, true);
 }
 
 static bool __mptcp_move_skbs(struct sock *sk, struct list_head *skbs, u32 *delta)
@@ -2198,6 +2221,7 @@ static bool mptcp_move_skbs(struct sock *sk)
 	u32 moved;
 
 	mptcp_data_lock(sk);
+	mptcp_rcv_rtt_update_from_backlog(mptcp_sk(sk));
 	while (mptcp_can_spool_backlog(sk, &skbs)) {
 		mptcp_data_unlock(sk);
 		enqueued |= __mptcp_move_skbs(sk, &skbs, &moved);
@@ -2933,6 +2957,10 @@ static void __mptcp_init_sock(struct sock *sk)
 	msk->timer_ival = TCP_RTO_MIN;
 	msk->scaling_ratio = TCP_DEFAULT_SCALING_RATIO;
 	msk->backlog_len = 0;
+	msk->rcv_rtt_est.bl_rtt_us = U32_MAX;
+	msk->rcv_rtt_est.rtt_us = U32_MAX;
+	msk->rcv_rtt_est.bl_scaling_ratio = U8_MAX;
+	msk->scaling_ratio = U8_MAX;
 
 	WRITE_ONCE(msk->first, NULL);
 	inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss;
@@ -3375,6 +3403,10 @@ static int mptcp_disconnect(struct sock *sk, int flags)
 	msk->bytes_sent = 0;
 	msk->bytes_retrans = 0;
 	msk->rcvspace_init = 0;
+	msk->scaling_ratio = U8_MAX;
+	msk->rcv_rtt_est.rtt_us = U32_MAX;
+	msk->rcv_rtt_est.bl_rtt_us = U32_MAX;
+	msk->rcv_rtt_est.bl_scaling_ratio = U8_MAX;
 
 	/* for fallback's sake */
 	WRITE_ONCE(msk->ack_seq, 0);
@@ -3560,6 +3592,7 @@ static void mptcp_release_cb(struct sock *sk)
 
 		INIT_LIST_HEAD(&join_list);
 		list_splice_init(&msk->join_list, &join_list);
+		mptcp_rcv_rtt_update_from_backlog(msk);
 
 		/* the following actions acquire the subflow socket lock
 		 *
net/mptcp/protocol.h +7 -1
index 1f67d8468dfb..d38a455f8f5b 100644
@@ -340,11 +340,17 @@ struct mptcp_sock {
 				 */
 	struct mptcp_pm_data	pm;
 	struct mptcp_sched_ops	*sched;
+	struct {
+		u32	rtt_us;		/* Minimum rtt of subflows */
+		u32	bl_rtt_us;	/* Min rtt if subflows using the bl */
+		u8	bl_scaling_ratio;
+		bool	reset;
+		bool	reset_bl;	/* Protected by data lock */
+	} rcv_rtt_est;
 	struct {
 		int	space;	/* bytes copied in last measurement window */
 		int	copied; /* bytes copied in this measurement window */
 		u64	time;	/* start time of measurement window */
-		u64	rtt_us; /* last maximum rtt of subflows */
 	} rcvq_space;
 	u8		scaling_ratio;
 	bool		allow_subflows;
Signature · 1 line
2.51.0
author maintainer
#4 lore raw

PATCH 4/4 mptcp: add receive queue awareness in tcp_rcv_space_adjust()

In reply to Paolo Abeni

This is the mptcp counter-part of commit ea33537d8292 ("tcp: add receive queue awareness in tcp_rcv_space_adjust()").

Prior to this commit:

ESTAB 33165568 0      192.168.255.2:5201 192.168.255.1:53380 \
	skmem:(r33076416,rb33554432,t0,tb91136,f448,w0,o0,bl0,d0)

After:

ESTAB 3279168 0      192.168.255.2:5201 192.168.255.1]:53042 \
	skmem:(r3190912,rb3719956,t0,tb91136,f1536,w0,o0,bl0,d0)

(same tput)

---
 net/mptcp/protocol.c | 50 +++++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 24 deletions(-)
net/mptcp/protocol.c +26 -24
index 4fc1519baab6..37a90d644e7b 100644
@@ -2105,6 +2105,27 @@ static void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk)
 		msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT;
 }
 
+static unsigned int mptcp_inq_hint(const struct sock *sk)
+{
+	const struct mptcp_sock *msk = mptcp_sk(sk);
+	const struct sk_buff *skb;
+
+	skb = skb_peek(&sk->sk_receive_queue);
+	if (skb) {
+		u64 hint_val = READ_ONCE(msk->ack_seq) - MPTCP_SKB_CB(skb)->map_seq;
+
+		if (hint_val >= INT_MAX)
+			return INT_MAX;
+
+		return (unsigned int)hint_val;
+	}
+
+	if (sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN))
+		return 1;
+
+	return 0;
+}
+
 /* receive buffer autotuning.  See tcp_rcv_space_adjust for more information.
  *
  * Only difference: Use highest rtt estimate of the subflows in use.
@@ -2133,10 +2154,12 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 	if (rtt_us == U32_MAX || time < (rtt_us >> 3))
 		return;
 
-	if (msk->rcvq_space.copied <= msk->rcvq_space.space)
+	copied = msk->rcvq_space.copied;
+	copied -= mptcp_inq_hint(sk);
+	if (copied <= msk->rcvq_space.space)
 		goto new_measure;
 
-	if (mptcp_rcvbuf_grow(sk, msk->rcvq_space.copied)) {
+	if (mptcp_rcvbuf_grow(sk, copied)) {
 
 		/* Make subflows follow along.  If we do not do this, we
 		 * get drops at subflow level if skbs can't be moved to
@@ -2150,7 +2173,7 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 			ssk = mptcp_subflow_tcp_sock(subflow);
 			slow = lock_sock_fast(ssk);
 			if (tcp_sk(ssk)->rcvq_space.space)
-				tcp_rcvbuf_grow(ssk, msk->rcvq_space.copied);
+				tcp_rcvbuf_grow(ssk, copied);
 			unlock_sock_fast(ssk, slow);
 		}
 	}
@@ -2233,27 +2256,6 @@ static bool mptcp_move_skbs(struct sock *sk)
 	return enqueued;
 }
 
-static unsigned int mptcp_inq_hint(const struct sock *sk)
-{
-	const struct mptcp_sock *msk = mptcp_sk(sk);
-	const struct sk_buff *skb;
-
-	skb = skb_peek(&sk->sk_receive_queue);
-	if (skb) {
-		u64 hint_val = READ_ONCE(msk->ack_seq) - MPTCP_SKB_CB(skb)->map_seq;
-
-		if (hint_val >= INT_MAX)
-			return INT_MAX;
-
-		return (unsigned int)hint_val;
-	}
-
-	if (sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN))
-		return 1;
-
-	return 0;
-}
-
 static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
 			 int flags, int *addr_len)
 {
Signature · 1 line
2.51.0
maintainer
#5 lore raw
In reply to Paolo Abeni

Hi Paolo,

Quoted 3 lines · Paolo Abeni

This series collects a few follow-up for the backlog refactor, with some of them posing as fixes just to confuse the enemy (or feel the season mood)

:)

Quoted 5 lines

Targeting net-next as the issues addressed are very old, the change is quite invasive and, as mentioned, based on the BL refactor.

Only patch 1/4 could be considered for net, but still included because somewhat related to the others and to keep my life easy.

It makes sense!

Thank you for the fixes and improvements!

Note: this is not a review. Just to let you know I manually applied this series on top of the "mptcp: introduce backlog processing" series to avoid conflicts. I guess that was the intension. If you want this to be automated to get results quicker, you can add a line like this one in the cover-letter:

Based-on: <[email protected]>

While at it, I also rebased the above series on top of the export branch, and I had a small conflict with Eric's latest series: "tcp: fix receive autotune again". That's because I removed an extra line in the v3 that got applied.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
#6 lore raw
In reply to Paolo Abeni

Hi Paolo,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join): Unstable: 1 failed test(s): selftest_mptcp_connect_sendfile - Critical: 1 Call Trace(s) - Critical: Global Timeout ❌
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Critical: 1 Call Trace(s) - Critical: Global Timeout ❌
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/18994741164

Initiator: Matthieu Baerts (NGI0)
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/7e6786f6a20f
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1018332

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)