This patch adds the redundant subflows support, sending all packets
redundantly on all available subflows.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/protocol.c | 40 ++++++++++++++++++++++++++++------------
1 file changed, 28 insertions(+), 12 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 74dc832a9d9d..1105c8ad670f 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1559,6 +1559,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
struct mptcp_data_frag *dfrag;
int len, copied = 0;
bool call_again;
+ int max = 0;
while ((dfrag = mptcp_send_head(sk))) {
info.sent = dfrag->already_sent;
@@ -1586,18 +1587,25 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
lock_sock(ssk);
ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info);
- if (ret <= 0) {
+ if (ret <= 0 && !call_again) {
mptcp_push_release(ssk, &info);
goto out;
}
- info.sent += ret;
- copied += ret;
- len -= ret;
+ if (ret > max)
+ max = ret;
- mptcp_update_post_push(msk, dfrag, ret);
+ if (!call_again) {
+ info.sent += max;
+ copied += max;
+ len -= max;
+
+ mptcp_update_post_push(msk, dfrag, max);
+ max = 0;
+ }
}
- WRITE_ONCE(msk->first_pending, mptcp_send_next(sk));
+ if (!call_again)
+ WRITE_ONCE(msk->first_pending, mptcp_send_next(sk));
}
/* at this point we held the socket lock for the last subflow we used */
@@ -1623,6 +1631,7 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk)
struct sock *xmit_ssk;
int len, copied = 0;
bool first = true;
+ int max = 0;
info.flags = 0;
while ((dfrag = mptcp_send_head(sk))) {
@@ -1646,17 +1655,24 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk)
}
ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info);
- if (ret <= 0)
+ if (ret <= 0 && !call_again)
goto out;
- info.sent += ret;
- copied += ret;
- len -= ret;
+ if (ret > max)
+ max = ret;
+
first = false;
+ if (!call_again) {
+ info.sent += max;
+ copied += max;
+ len -= max;
- mptcp_update_post_push(msk, dfrag, ret);
+ mptcp_update_post_push(msk, dfrag, max);
+ max = 0;
+ }
}
- WRITE_ONCE(msk->first_pending, mptcp_send_next(sk));
+ if (!call_again)
+ WRITE_ONCE(msk->first_pending, mptcp_send_next(sk));
}
out:
--
2.34.1