squash and cleanup
Subsystems (2)
Paolo Abeni
cover squash and cleanup
This series contains a "squashable" version of:
subflow: place further subflows on new 'join_list'
and a bunch of minor cleanup (unneeded check after not so recent net-next changes)
Rebased tree available at:
https://github.com/pabeni/mptcp/tree/mptcp_net-next_part3_14
this supersede the squashed branch posted previously.
Self-tests loop running. Will update here with results.
options.c | 11 +++-------- protocol.c | 31 ++++++++++++++++++++++++++++++- protocol.h | 2 ++ subflow.c | 5 ++++- 4 files changed, 39 insertions(+), 10 deletions(-)
Paolo Abeni
PATCH 1/5 Squash-to: "mptcp: Add ADD_ADDR handling"
subflow->conn is always valid for is_mptcp socket, drop unneeded check
--- net/mptcp/options.c | 3 --- 1 file changed, 3 deletions(-)
net/mptcp/options.c +0 -3
@@ -486,9 +486,6 @@ static bool mptcp_established_options_addr(struct sock *sk,struct sockaddr_storage saddr;u8 id; -if (!msk) -return false; - id =0 ;memset (&saddr,0 ,sizeof (saddr));
Signature · 1 line
2.21.1
Paolo Abeni
PATCH 2/5 Squash-to: "mptcp: Add path manager interface"
In reply to Paolo AbeniSame as previous patch
--- net/mptcp/options.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/mptcp/options.c +1 -2
@@ -692,8 +692,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb, mpext->data_fin = mp_opt->data_fin; -if (msk) -mptcp_pm_fully_established (msk); +mptcp_pm_fully_established (msk); }void mptcp_write_options (__be32 *ptr,struct mptcp_out_options *opts)
Signature · 1 line
2.21.1
Paolo Abeni
PATCH 3/5 Squash-to: "mptcp: Add handling of incoming MP_JOIN requests"
In reply to Paolo AbeniDrop another unneeded check, and remote the paired, obsoleted comment.
--- net/mptcp/options.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/mptcp/options.c +1 -2
@@ -661,8 +661,7 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *sk, subflow->can_ack =1 ; fully_established: -/* msk can be null for MPC subflow on passive socket */ -if (subflow->pm_notified || !msk) +if (likely (subflow->pm_notified))return true; subflow->pm_notified =1 ;
Signature · 1 line
2.21.1
Paolo Abeni
PATCH 4/5 Squash-to: "mptcp: Add handling of outgoing MP_JOIN requests"
In reply to Paolo AbeniThis is just a rebase of existing later patch "subflow: place further subflows on new 'join_list'".
The original should be update accordingly changing:
"""
When a valid SYN-ACK is received the
new sock is added to the tail of the mptcp sock conn_list where it will not interfere with data flow on the original connection.
"""
With something alike:
"""
Passive sockets can't acquire the mptcp socket lock at subflow creation time, so an additional list protected by a new spinlock is used to track the MPJ subflows.
Such list is spliced into conn_list tail every time the msk socket lock is acquired, so that it will not interfere with data flow on the original connection.
"""
--- net/mptcp/protocol.c | 31 ++++++++++++++++++++++++++++++- net/mptcp/protocol.h | 2 ++ net/mptcp/subflow.c | 5 ++++- 3 files changed, 36 insertions(+), 2 deletions(-)
net/mptcp/protocol.c +30 -1
@@ -241,6 +241,16 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk) sk->sk_data_ready (sk); } +static void __mptcp_flush_join_list (struct mptcp_sock *msk) +{ +if (likely (list_empty (&msk->join_list))) +return ; + +spin_lock_bh (&msk->join_list_lock); +list_splice_tail_init (&msk->join_list, &msk->conn_list); +spin_unlock_bh (&msk->join_list_lock); +} +static bool mptcp_ext_cache_refill (struct mptcp_sock *msk) {if (!msk->cached_ext)
@@ -462,6 +472,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)return ret >=0 ? ret + copied : (copied ? copied : ret); } +__mptcp_flush_join_list (msk); ssk =mptcp_subflow_get_send (msk);while (!sk_stream_memory_free (sk) || !ssk) { ret =sk_stream_wait_memory (sk, &timeo);
@@ -603,6 +614,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, len =min_t (size_t, len,INT_MAX ); target =sock_rcvlowat (sk, flags &MSG_WAITALL , len); +__mptcp_flush_join_list (msk);while (len > (size_t )copied) {int bytes_read;
@@ -718,6 +730,7 @@ static void mptcp_worker(struct work_struct *work)struct sock *sk = &msk->sk.icsk_inet.sk;lock_sock (sk); +__mptcp_flush_join_list (msk);__mptcp_move_skbs (msk);release_sock (sk);sock_put (sk);
@@ -727,7 +740,10 @@ static int __mptcp_init_sock(struct sock *sk) {struct mptcp_sock *msk =mptcp_sk (sk); +spin_lock_init (&msk->join_list_lock); +INIT_LIST_HEAD (&msk->conn_list); +INIT_LIST_HEAD (&msk->join_list);__set_bit (MPTCP_SEND_SPACE , &msk->flags);INIT_WORK (&msk->work, mptcp_worker);
@@ -800,6 +816,8 @@ static void mptcp_close(struct sock *sk, long timeout)mptcp_token_destroy (msk->token);inet_sk_state_store (sk,TCP_CLOSE ); +__mptcp_flush_join_list (msk); +list_splice_init (&msk->conn_list, &conn_list); data_fin_tx_seq = msk->write_seq;
@@ -1111,6 +1129,7 @@ bool mptcp_finish_join(struct sock *sk)struct mptcp_sock *msk =mptcp_sk (subflow->conn);struct sock *parent = (void *)msk;struct socket *parent_sock; +bool ret;pr_debug ("msk=%p, subflow=%p" , msk, subflow);
@@ -1126,7 +1145,15 @@ bool mptcp_finish_join(struct sock *sk)if (parent_sock && !sk->sk_socket)mptcp_sock_graft (sk, parent_sock); -return mptcp_pm_allow_new_subflow (msk); + ret =mptcp_pm_allow_new_subflow (msk); +if (ret) { +/* active connections are already on conn_list */ +spin_lock_bh (&msk->join_list_lock); +if (!WARN_ON_ONCE (!list_empty (&subflow->node))) +list_add_tail (&subflow->node, &msk->join_list); +spin_unlock_bh (&msk->join_list_lock); + } +return ret; }bool mptcp_sk_is_subflow (const struct sock *sk)
@@ -1315,6 +1342,7 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,/* set ssk->sk_socket of accept()ed flows to mptcp socket. * This is needed so NOSPACE flag can be set from tcp stack. */ +__mptcp_flush_join_list (msk);list_for_each_entry (subflow, &msk->conn_list, node) {struct sock *ssk =mptcp_subflow_tcp_sock (subflow);
@@ -1396,6 +1424,7 @@ static int mptcp_shutdown(struct socket *sock, int how) sock->state =SS_CONNECTED ; } +__mptcp_flush_join_list (msk);mptcp_for_each_subflow (msk, subflow) {struct sock *tcp_sk =mptcp_subflow_tcp_sock (subflow);
net/mptcp/protocol.h +2 -0
@@ -150,8 +150,10 @@ struct mptcp_sock {u32 token;unsigned long flags;bool can_ack; +spinlock_t join_list_lock;struct work_struct work;struct list_head conn_list; +struct list_head join_list;struct skb_ext *cached_ext;/* for the next sendmsg */ struct socket *subflow;/* outgoing connect/listener/!mp_capable */ struct sock *first;
net/mptcp/subflow.c +4 -1
@@ -865,10 +865,13 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex,if (err && err != -EINPROGRESS ) goto failed; +spin_lock_bh (&msk->join_list_lock); +list_add_tail (&subflow->node, &msk->join_list); +spin_unlock_bh (&msk->join_list_lock); +return err; failed: -list_del_init (&subflow->node);sock_release (sf);return err; }
Signature · 1 line
2.21.1
Paolo Abeni
PATCH 5/5 Squash-to: "mptcp: update per unacked sequence on pkt reception"
In reply to Paolo AbeniDrop another unneeded check
--- net/mptcp/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/options.c +1 -1
@@ -839,7 +839,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,/* we can't wait for recvmsg() to update the ack_seq, otherwise * monodirectional flows will stuck */ -if (msk && mp_opt->use_ack) +if (mp_opt->use_ack)update_una (msk, mp_opt); mpext =skb_ext_add (skb,SKB_EXT_MPTCP );
Signature · 1 line
2.21.1
Mat Martineau
Quoted 13 lines · Paolo Abeni
This series contains a "squashable" version of:
subflow: place further subflows on new '
join_list'and a bunch of minor cleanup (unneeded check after not so recent net-next changes)
Rebased tree available at:
https://github.com/pabeni/mptcp/tree/mptcp_net-next_part3_14
this supersede the squashed branch posted previously.
Quoted 7 lines
Self-tests loop running. Will update here with results.
options.c | 11 +++-------- protocol.c | 31 ++++++++++++++++++++++++++++++- protocol.h | 2 ++ subflow.c | 5 ++++- 4 files changed, 39 insertions(+), 10 deletions(-)
Changes look good to me - thanks Paolo!
--
Mat Martineau
Intel
Paolo Abeni
Quoted 7 lines · Paolo Abeni
This series contains a "squashable" version of:
subflow: place further subflows on new '
join_list'and a bunch of minor cleanup (unneeded check after not so recent net-next changes)
Quoted 7 lines
Rebased tree available at:
https://github.com/pabeni/mptcp/tree/mptcp_net-next_part3_14
this supersede the squashed branch posted previously.
Self-tests loop running. Will update here with results.
Went throught ~700 self-tests loop iteration without issues.
/P
Matthieu Baerts
Hi Paolo, Mat
@Paolo: I have a comment for you below
Quoted 18 lines · Mat Martineau
Quoted 15 lines · Paolo Abeni
This series contains a "squashable" version of:
subflow: place further subflows on new '
join_list'and a bunch of minor cleanup (unneeded check after not so recent net-next changes)
Rebased tree available at:
https://github.com/pabeni/mptcp/tree/mptcp_net-next_part3_14
this supersede the squashed branch posted previously.
Self-tests loop running. Will update here with results.
Quoted 7 lines
Quoted 5 lines
options.c | 11 +++--------
protocol.c| 31 ++++++++++++++++++++++++++++++-protocol.h| 2 ++
subflow.c | 5 ++++-4 files changed, 39 insertions(+), 10 deletions(-)Changes look good to me - thanks Paolo!
Thank you for the patches, the tests and the reviews!
- d9c29116606a: "squashed" patch 1/5 in "mptcp: Add ADD_ADDR handling"
- 348e235ba3d5: conflict in t/mptcp-Add-path-manager-interface
- c011ac35dcba..dffdcd105251: result
- e7ac600fc440: "squashed" patch 2/5 in "mptcp: Add path manager interface"
- 7c7660a7e9d8: conflict in t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
- dffdcd105251..83e0a152c29b: result (empty, as expected)
- fe80488ecbae: "squashed" patch 3/5 in "mptcp: Add handling of incoming MP_JOIN requests"
- 83e0a152c29b..082785f12357: result
- 5079f6bd9a9b: "squashed" patch 4/5 in "mptcp: Add handling of outgoing MP_JOIN requests"
- 49a712650dca: tg: add a description from parent commit
- 6303bcfe7f27: conflict in t/mptcp-queue-data-for-mptcp-level-retransmission
- 9f05cafd0fc3: conflict in t/mptcp-introduce-MPTCP-retransmission-timer
- 66c69c29abdc: conflict in t/mptcp-implement-and-use-MPTCP-level-retransmission
- 082785f12357..9345f86134a1: result
*Paolo* : the result is not empty because the commit to squash was not empty. I guess in your previous message (squashing of "subflow: place further subflows on new 'join_list'") the diff was inverted, right?
Additional commit:
- 1c46c069c95d: mptcp:worker: flush the join list sooner
- c85ce15b5be0..2bfb96355343: result
- 7585b5b02c27: "squashed" patch 5/5 in "mptcp: update per unacked sequence on pkt reception"
- 9345f86134a1..c85ce15b5be0: result
- 4ae633d18908: tg: depend on t/sendmsg-truncate-source-buffer-if-mptcp-sndbuf-size-was-set-from-userspace
- 2bfb96355343..49bd5a76f678: result (empty as expected)
Tests + export are going to be launched soon.
Cheers
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium