Squash to "implement mptcp read_sock" v8
Subsystems (3)
Geliang Tang
reviewerv3 cover Squash to "implement mptcp read_sock" v8
From: Geliang Tang <[email protected]>
v3:
- rename mptcp_recv_should_stop to tcp_recv_should_stop and use it for TCP too.
v2:
- use mptcp_recv_should_stop instead of
if (sk->sk_err ||
sk->sk_state == TCP_CLOSE ||
(sk->sk_shutdown & RCV_SHUTDOWN) ||
!timeo ||
signal_pending(current)) in mptcp_recvmsg.
- use mptcp_recv_should_stop instead of
if (sk->sk_err || sk->sk_state == TCP_CLOSE ||
(sk->sk_shutdown & RCV_SHUTDOWN) ||
signal_pending(current)) in mptcp_splice_read.
v1:
Drop "shutdown" parameter of mptcp_recv_should_stop.
Based-on: <[email protected]>
Geliang Tang (2):
Squash to "mptcp: add recv_should_stop helper"
Squash to "mptcp: implement .splice_read"
include/net/tcp.h | 23 ++++++++++++++ net/ipv4/tcp.c | 73 +++++++----------------------------------- net/mptcp/protocol.c | 75 ++++++++++++++++---------------------------- 3 files changed, 61 insertions(+), 110 deletions(-)
Signature · 1 line
2.48.1
Geliang Tang
reviewerPATCH v3 1/2 Squash to "mptcp: add recv_should_stop helper"
From: Geliang Tang <[email protected]>
tcp: add recv_should_stop helper
Drop "shutdown" parameter of mptcp_recv_should_stop.
Use mptcp_recv_should_stop for "if (copied)" case too. Rename this helper as tcp_recv_should_stop using for both TCP and MPTCP.
--- include/net/tcp.h | 23 ++++++++++++++ net/ipv4/tcp.c | 73 +++++++------------------------------------- net/mptcp/protocol.c | 54 +++++++++----------------------- 3 files changed, 49 insertions(+), 101 deletions(-)
include/net/tcp.h +23 -0
@@ -270,6 +270,29 @@ struct tcp_splice_state {int tcp_splice_data_recv (read_descriptor_t *rd_desc,struct sk_buff *skb,unsigned int offset,size_t len); +static inline int tcp_recv_should_stop (struct sock *sk,long timeo) +{ +if (sock_flag (sk,SOCK_DONE )) +return -ENETDOWN ; + +if (sk->sk_err) +return sock_error (sk); + +if (sk->sk_shutdown &RCV_SHUTDOWN ) +return -ESHUTDOWN ; + +if (sk->sk_state ==TCP_CLOSE ) +return -ENOTCONN ; + +if (!timeo) +return -EAGAIN ; + +if (signal_pending (current)) +return sock_intr_errno (timeo); + +return 0 ; +} +/* sysctl variables for tcp */ extern int sysctl_tcp_max_orphans;
net/ipv4/tcp.c +11 -62
103 lines not on this page · raw message
net/mptcp/protocol.c +15 -39
74 lines not on this page · raw message
Signature · 1 line
2.48.1
Geliang Tang
reviewerPATCH v3 2/2 Squash to "mptcp: implement .splice_read"
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Update the parameter of mptcp_recv_should_stop. Use mptcp_recv_should_stop at the end of the main loop too. Rename to tcp_recv_should_stop.
--- net/mptcp/protocol.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
net/mptcp/protocol.c +12 -9
@@ -4037,10 +4037,9 @@ static ssize_t mptcp_splice_read(struct socket *sock, loff_t *ppos, .flags = flags, };struct sock *sk = sock->sk; -int shutdown =-1 ;ssize_t spliced; +int ret, err;long timeo; -int ret;/* * We can't seek on a socket input
@@ -4063,11 +4062,17 @@ static ssize_t mptcp_splice_read(struct socket *sock, loff_t *ppos,break ;if (sock_flag (sk,SOCK_DONE ))break ; - ret =mptcp_recv_should_stop (sk, timeo, &shutdown); -if (ret <0 || shutdown ==1 ) + err =tcp_recv_should_stop (sk, timeo); +if (err <0 ) { +if (err == -ESHUTDOWN ) { +if (__mptcp_move_skbs (sk)) +continue ; +break ; + } +if (err != -ENETDOWN ) + ret = err;break ; -if (shutdown ==0 ) -continue ; + }/* if __mptcp_splice_read() got nothing while we have * an skb in receive queue, we do not want to loop. * This might happen with URG data.
@@ -4087,9 +4092,7 @@ static ssize_t mptcp_splice_read(struct socket *sock, loff_t *ppos,release_sock (sk);lock_sock (sk); -if (sk->sk_err || sk->sk_state ==TCP_CLOSE || - (sk->sk_shutdown &RCV_SHUTDOWN ) || -signal_pending (current)) +if (tcp_recv_should_stop (sk, timeo))break ; }
Signature · 1 line
2.48.1
Hi Geliang,
Thank you for your modifications, that's great!
But sadly, our CI spotted some issues with it when trying to build it.
You can find more details there:
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/16198880454
Status: failure
Initiator: Matthieu Baerts (NGI0)
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/8d1d0792ca2d
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=980943
Feel free to reply to this email if you cannot access logs, if you need some support to fix the error, if this doesn't seem to be caused by your modifications or if the error is a false positive one.
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Success! ✅
- KVM Validation: debug: 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/16198880391
Initiator: Matthieu Baerts (NGI0)
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/8d1d0792ca2d
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=980943
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-normalFor 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)