All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next v3 0/2] BPF redundant scheduler, part 3
@ 2022-12-07 11:04 Geliang Tang
  2022-12-07 11:04 ` [PATCH mptcp-next v3 1/2] mptcp: update mptcp_push_release Geliang Tang
  2022-12-07 11:04 ` [PATCH mptcp-next v3 2/2] mptcp: retrans for redundant sends Geliang Tang
  0 siblings, 2 replies; 3+ messages in thread
From: Geliang Tang @ 2022-12-07 11:04 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

v3:
- invoking __mptcp_retrans in __mptcp_subflow_push_pending fails
  with a soft lockup error, so use MPTCP_WORK_RTX instead.
- invoke __mptcp_retrans in __mptcp_push_pending iteratively for each
  dfrag.
- depends on "BPF redundant scheduler, part 2" v23.

v2:
- drop retrans_redundant flag.
- call __mptcp_retrans() directly.
- depends on "BPF redundant scheduler, part 2" v23.

v1:
- The DSS issue has been fixed in this version, and all tests
(mptcp_connect.sh, mptcp_join.sh, simult_flows.sh and BPF test_progs)
passed.
- No need to set already_sent to 0, drop this.
- Add retrans_redundant flag.
- depends on "BPF redundant scheduler, part 2" v22.

Geliang Tang (2):
  mptcp: update mptcp_push_release
  mptcp: retrans for redundant sends

 net/mptcp/protocol.c | 63 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 53 insertions(+), 10 deletions(-)

-- 
2.35.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH mptcp-next v3 1/2] mptcp: update mptcp_push_release
  2022-12-07 11:04 [PATCH mptcp-next v3 0/2] BPF redundant scheduler, part 3 Geliang Tang
@ 2022-12-07 11:04 ` Geliang Tang
  2022-12-07 11:04 ` [PATCH mptcp-next v3 2/2] mptcp: retrans for redundant sends Geliang Tang
  1 sibling, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2022-12-07 11:04 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

This patch moves the NULL pointer check into mptcp_push_release(). Also
add a new parameter 'push' for it to set whether to invoke tcp_push in
it.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 net/mptcp/protocol.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 5505c1439b3e..0c4403c2aace 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1471,9 +1471,17 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
 	return ssk;
 }
 
-static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info *info)
+static void mptcp_push_release(struct sock *ssk,
+			       struct mptcp_sendmsg_info *info,
+			       bool push)
 {
-	tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal);
+	if (!ssk)
+		return;
+
+	if (push) {
+		tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle,
+			 info->size_goal);
+	}
 	release_sock(ssk);
 }
 
@@ -1579,8 +1587,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 					/* First check. If the ssk has changed since
 					 * the last round, release prev_ssk
 					 */
-					if (prev_ssk)
-						mptcp_push_release(prev_ssk, &info);
+					mptcp_push_release(prev_ssk, &info, do_check_data_fin);
 
 					/* Need to lock the new subflow only if different
 					 * from the previous one, otherwise we are still
@@ -1606,8 +1613,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 	}
 
 	/* at this point we held the socket lock for the last subflow we used */
-	if (ssk)
-		mptcp_push_release(ssk, &info);
+	mptcp_push_release(ssk, &info, do_check_data_fin);
 
 	/* ensure the rtx timer is running */
 	if (!mptcp_timer_pending(sk))
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH mptcp-next v3 2/2] mptcp: retrans for redundant sends
  2022-12-07 11:04 [PATCH mptcp-next v3 0/2] BPF redundant scheduler, part 3 Geliang Tang
  2022-12-07 11:04 ` [PATCH mptcp-next v3 1/2] mptcp: update mptcp_push_release Geliang Tang
@ 2022-12-07 11:04 ` Geliang Tang
  1 sibling, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2022-12-07 11:04 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Redundant sends need to work more like the MPTCP retransmit code path.
When the scheduler selects multiple subflows, the first subflow to send
is a "normal" transmit, and any other subflows would act like a retransmit
when accessing the dfrags.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 net/mptcp/protocol.c | 45 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 41 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 0c4403c2aace..8c2480b4baec 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -45,6 +45,7 @@ static struct percpu_counter mptcp_sockets_allocated ____cacheline_aligned_in_sm
 
 static void __mptcp_destroy_sock(struct sock *sk);
 static void __mptcp_check_send_data_fin(struct sock *sk);
+static void __mptcp_retrans(struct sock *sk);
 
 DEFINE_PER_CPU(struct mptcp_delegated_action, mptcp_delegated_actions);
 static struct net_device mptcp_napi_dev;
@@ -998,7 +999,7 @@ static void __mptcp_clean_una(struct sock *sk)
 
 		if (unlikely(dfrag == msk->first_pending)) {
 			/* in recovery mode can see ack after the current snd head */
-			if (WARN_ON_ONCE(!msk->recovery))
+			if (!msk->recovery)
 				break;
 
 			WRITE_ONCE(msk->first_pending, mptcp_send_next(sk));
@@ -1013,7 +1014,7 @@ static void __mptcp_clean_una(struct sock *sk)
 
 		/* prevent wrap around in recovery mode */
 		if (unlikely(delta > dfrag->already_sent)) {
-			if (WARN_ON_ONCE(!msk->recovery))
+			if (!msk->recovery)
 				goto out;
 			if (WARN_ON_ONCE(delta > dfrag->data_len))
 				goto out;
@@ -1112,6 +1113,7 @@ struct mptcp_sendmsg_info {
 	u16 sent;
 	unsigned int flags;
 	bool data_lock_held;
+	struct mptcp_data_frag *last;
 };
 
 static int mptcp_check_allowed_size(const struct mptcp_sock *msk, struct sock *ssk,
@@ -1527,6 +1529,7 @@ static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
 		info->sent = dfrag->already_sent;
 		info->limit = dfrag->data_len;
 		len = dfrag->data_len - dfrag->already_sent;
+		info->last = dfrag;
 		while (len > 0) {
 			int ret = 0;
 
@@ -1563,14 +1566,19 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 	struct sock *prev_ssk = NULL, *ssk = NULL;
 	struct mptcp_sock *msk = mptcp_sk(sk);
 	struct mptcp_subflow_context *subflow;
+	struct mptcp_data_frag *head, *dfrag;
 	struct mptcp_sendmsg_info info = {
 				.flags = flags,
 	};
 	bool do_check_data_fin = false;
 	int push_count = 1;
 
+	head = mptcp_send_head(sk);
+	if (!head)
+		goto out;
+
 	while (mptcp_send_head(sk) && (push_count > 0)) {
-		int ret = 0;
+		int ret = 0, i = 0;
 
 		if (mptcp_sched_get_send(msk))
 			break;
@@ -1579,6 +1587,19 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 
 		mptcp_for_each_subflow(msk, subflow) {
 			if (READ_ONCE(subflow->scheduled)) {
+				if (i > 0) {
+					WRITE_ONCE(msk->first_pending, head);
+					mptcp_push_release(ssk, &info, do_check_data_fin);
+
+					while ((dfrag = mptcp_send_head(sk))) {
+						__mptcp_retrans(sk);
+						if (dfrag == info.last)
+							break;
+						WRITE_ONCE(msk->first_pending, mptcp_send_next(sk));
+					}
+					goto out;
+				}
+
 				mptcp_subflow_set_scheduled(subflow, false);
 
 				prev_ssk = ssk;
@@ -1606,6 +1627,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 						push_count--;
 					continue;
 				}
+				i++;
 				do_check_data_fin = true;
 				msk->last_snd = ssk;
 			}
@@ -1615,6 +1637,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 	/* at this point we held the socket lock for the last subflow we used */
 	mptcp_push_release(ssk, &info, do_check_data_fin);
 
+out:
 	/* ensure the rtx timer is running */
 	if (!mptcp_timer_pending(sk))
 		mptcp_reset_timer(sk);
@@ -1629,14 +1652,19 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool
 	struct mptcp_sendmsg_info info = {
 		.data_lock_held = true,
 	};
+	struct mptcp_data_frag *head;
 	struct sock *xmit_ssk;
 	bool push = true;
 	int copied = 0;
 
+	head = mptcp_send_head(sk);
+	if (!head)
+		goto out;
+
 	info.flags = 0;
 	while (mptcp_send_head(sk) && push) {
 		bool delegate = false;
-		int ret = 0;
+		int ret = 0, i = 0;
 
 		/* check for a different subflow usage only after
 		 * spooling the first chunk of data
@@ -1656,6 +1684,13 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool
 
 		mptcp_for_each_subflow(msk, subflow) {
 			if (READ_ONCE(subflow->scheduled)) {
+				if (i > 0) {
+					WRITE_ONCE(msk->first_pending, head);
+					if (!test_and_set_bit(MPTCP_WORK_RTX, &msk->flags))
+						mptcp_schedule_work(sk);
+					goto out;
+				}
+
 				mptcp_subflow_set_scheduled(subflow, false);
 
 				xmit_ssk = mptcp_subflow_tcp_sock(subflow);
@@ -1666,6 +1701,7 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool
 						goto out;
 					mptcp_subflow_delegate(subflow,
 							       MPTCP_DELEGATE_SEND);
+					i++;
 					msk->last_snd = ssk;
 					delegate = true;
 					push = false;
@@ -1677,6 +1713,7 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool
 					push = false;
 					continue;
 				}
+				i++;
 				copied += ret;
 				msk->last_snd = ssk;
 			}
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-07 11:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-07 11:04 [PATCH mptcp-next v3 0/2] BPF redundant scheduler, part 3 Geliang Tang
2022-12-07 11:04 ` [PATCH mptcp-next v3 1/2] mptcp: update mptcp_push_release Geliang Tang
2022-12-07 11:04 ` [PATCH mptcp-next v3 2/2] mptcp: retrans for redundant sends Geliang Tang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.