Skip to contentSkip to conversation

Squash to "mptcp: simplify push_pending" v5

PATCH In review Geliang Tang 2 participants 3 messages Oct 9, 2022 – Oct 11, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Squash to "mptcp: simplify push_pending" v5

Update return values of __subflow_push_pending.

---
 net/mptcp/protocol.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
net/mptcp/protocol.c +4 -3
index f08c0eb0be11..ff2c1bbf4484 100644
@@ -1527,7 +1527,7 @@ static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
 
 			ret = mptcp_sendmsg_frag(sk, ssk, dfrag, info);
 			if (ret <= 0) {
-				err = ret;
+				err = copied ? : ret;
 				goto out;
 			}
 
@@ -1542,17 +1542,18 @@ static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
 		if (msk->snd_burst <= 0 ||
 		    !sk_stream_memory_free(ssk) ||
 		    !mptcp_subflow_active(mptcp_subflow_ctx(ssk))) {
-			err = -EAGAIN;
+			err = copied ? : -EAGAIN;
 			goto out;
 		}
+
 		mptcp_set_timeout(sk);
 	}
+	err = copied;
 
 out:
 	if (copied) {
 		tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle,
 			 info->size_goal);
-		err = copied;
 	}
 
 	return err;
Signature · 1 line
2.35.3
#1 lore raw

PATCH 2/2 Squash to "mptcp: multi subflows subflow_push_pending" v5

Update the first chunk of data pushing.

---
 net/mptcp/protocol.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
net/mptcp/protocol.c +7 -11
index ff2c1bbf4484..acc220bfb34e 100644
@@ -1614,17 +1614,8 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk,
 		/* check for a different subflow usage only after
 		 * spooling the first chunk of data
 		 */
-		if (first) {
-			ret = __subflow_push_pending(sk, ssk, &info);
-			if (ret <= 0) {
-				if (ret == -EAGAIN)
-					goto again;
-				break;
-			}
-			first = false;
-			msk->last_snd = ssk;
-			continue;
-		}
+		if (first)
+			goto push;
 
 		if (mptcp_sched_get_send(msk))
 			goto out;
@@ -1643,6 +1634,7 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk,
 					continue;
 				}
 
+push:
 				ret = __subflow_push_pending(sk, ssk, &info);
 				if (ret <= 0) {
 					if (ret == -EAGAIN)
@@ -1650,6 +1642,10 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk,
 					goto out;
 				}
 				msk->last_snd = ssk;
+				if (first) {
+					first = false;
+					goto again;
+				}
 				mptcp_subflow_set_scheduled(subflow, false);
 			}
 		}
Signature · 1 line
2.35.3
#2 lore raw

Re: [PATCH mptcp-next 2/2] Squash to "mptcp: multi subflows subflow_push_pending" v5

Quoted 18 lines · Geliang Tang

Update the first chunk of data pushing.

---
net/mptcp/protocol.c | 18 +++++++-----------

1 file changed, 7 insertions(+), 11 deletions(-)
net/mptcp/protocol.c +0 -3
index ff2c1bbf4484..acc220bfb34e 100644
@@ -1614,17 +1614,8 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk,
 		/* check for a different subflow usage only after
 		 * spooling the first chunk of data
 		 */
-		if (first) {
-			ret = __subflow_push_pending(sk, ssk, &info);
-			if (ret <= 0) {

net/mptcp/protocol.c static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, · line 1618

Quoted 10 lines
net/mptcp/protocol.c +2 -8
-				if (ret == -EAGAIN)
-					goto again;
-				break;
-			}
-			first = false;
-			msk->last_snd = ssk;
-			continue;
-		}
+		if (first)
+			goto push;

Is the only goal here to reduce duplicate code? It looks like the functionality is equivalent, but I'd rather not use 'goto' to jump into the middle of a loop.

The 'Squash to "mptcp: simplify push_pending"' looks fine to include in v6.

- Mat

Quoted 27 lines
net/mptcp/protocol.c +5 -0
 		if (mptcp_sched_get_send(msk))
 			goto out;
@@ -1643,6 +1634,7 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk,
 					continue;
 				}
 
+push:
 				ret = __subflow_push_pending(sk, ssk, &info);
 				if (ret <= 0) {
 					if (ret == -EAGAIN)
@@ -1650,6 +1642,10 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk,
 					goto out;
 				}
 				msk->last_snd = ssk;
+				if (first) {
+					first = false;
+					goto again;
+				}
 				mptcp_subflow_set_scheduled(subflow, false);
 			}
 		}
Signature · 1 line
2.35.3

--
Mat Martineau
Intel