mptcp: token api refactoring/cleanup
Subsystems (2)
Florian Westphal
cover mptcp: token api refactoring/cleanup
I tried to fold the earlier 'RFC v2' in a way so that it allows easy squashing.
Patch #1 is the only one where this is painless.
For all others, things are not easy because conflicts exist all over the place.
So I see two ways forward:
1. I rebase this myself and offer a pull request for the resulting series
2. Only squash the first patch and keep the rest as extra patch.
I suggest we go with #2. The export tree already has a few patches that need to be squashed anyway before sending a formal series.
Also, the export branch is currently not bisectable, I get build errors mid-series.
I don't think this is a problem for now, I think it makes sense to not squash the larger patches for the time being.
Once another patch series is to be submitted to netdev, the export branch can be renamed/archived and a reorganisation can be done at that point (and the result diff'd versus the old export branch to make sure there is no difference in resulting code).
Florian Westphal
PATCH 1/2 mptcp: token: remove token_init
Its not needed, just use the static initialisers.
Also add 'MPTCP' prefix for pr_* calls.
squashto: mptcp: Add key generation and token tree
--- net/mptcp/protocol.c | 1 - net/mptcp/protocol.h | 1 - net/mptcp/token.c | 17 ++++++----------- 3 files changed, 6 insertions(+), 13 deletions(-)
net/mptcp/protocol.c +0 -1
@@ -1133,7 +1133,6 @@ void mptcp_proto_init(void) mptcp_stream_ops.listen = mptcp_listen; mptcp_stream_ops.shutdown = mptcp_shutdown; -token_init ();subflow_init ();pm_init ();
net/mptcp/protocol.h +0 -1
@@ -229,7 +229,6 @@ void mptcp_get_options(const struct sk_buff *skb,void mptcp_finish_connect (struct sock *sk,int mp_capable);void mptcp_finish_join (struct sock *sk); -void token_init (void );void token_new_request (struct request_sock *req,const struct sk_buff *skb);int token_join_request (struct request_sock *req,const struct sk_buff *skb);int token_join_response (struct sock *sk);
net/mptcp/token.c +6 -11
@@ -20,6 +20,8 @@* Brandon Heller <brandonh(a)stanford.edu> */ +#define pr_fmt (fmt) "MPTCP: " fmt +#include <linux/kernel.h> #include <linux/module.h> #include <linux/radix-tree.h>
@@ -31,10 +33,10 @@#include <net/mptcp.h> #include "protocol.h" -static struct radix_tree_root token_tree; -static struct radix_tree_root token_req_tree; -static spinlock_t token_tree_lock; -static int token_used; +static RADIX_TREE(token_tree, GFP_ATOMIC); +static RADIX_TREE(token_req_tree, GFP_ATOMIC); +static DEFINE_SPINLOCK (token_tree_lock); +static int token_used__read_mostly ;static bool find_req_token (u32 token) {
@@ -392,10 +394,3 @@ void token_destroy(u32 token)sock_put (conn);spin_unlock_bh (&token_tree_lock); } - -void token_init (void ) -{ -INIT_RADIX_TREE (&token_tree,GFP_ATOMIC ); -INIT_RADIX_TREE (&token_req_tree,GFP_ATOMIC ); -spin_lock_init (&token_tree_lock); -}
Signature · 1 line
2.21.0
Florian Westphal
PATCH 2/2 mptcp: token: add mptcp prefixes to functions
In reply to Florian Westphalsome functions are removed as they only have one caller. Functions that did not need to access the token tree are placed in the compilation unit where they are needed.
Also adds error handling -- adding an object to the radix tree might require dynamic memory allocation, so insertions can fail.
---
This is a squash of patches 2-9 of the earlier 'RFC v2' series.
I've omitted the last patch of that series:
[RFC v2 10/10] mptcp: token: rename token_release
Because I think we can remove that function by making the ULP context use ctx->conn directly -- I'm currently working on that.
I would not squash this patch for the time being.
net/mptcp/pm.c | 6 +- net/mptcp/protocol.c | 4 +- net/mptcp/protocol.h | 20 +-- net/mptcp/subflow.c | 133 +++++++++++++-- net/mptcp/token.c | 399 ++++++++++++++----------------------------- 5 files changed, 254 insertions(+), 308 deletions(-)
net/mptcp/pm.c +3 -3
@@ -13,7 +13,7 @@int pm_announce_addr (u32 token,sa_family_t family,u8 local_id,struct in_addr *addr) { -struct mptcp_sock *msk =mptcp_sk (token_lookup_get (token)); +struct mptcp_sock *msk =mptcp_token_get_sock (token);int err =0 ;if (!msk)
@@ -38,7 +38,7 @@ int pm_announce_addr(u32 token, sa_family_t family, u8 local_id,int pm_remove_addr (u32 token,u8 local_id) { -struct mptcp_sock *msk =mptcp_sk (token_lookup_get (token)); +struct mptcp_sock *msk =mptcp_token_get_sock (token);if (!msk)return -EINVAL ;
@@ -52,7 +52,7 @@ int pm_remove_addr(u32 token, u8 local_id)int pm_create_subflow (u32 token,u8 remote_id) { -struct mptcp_sock *msk =mptcp_sk (token_lookup_get (token)); +struct mptcp_sock *msk =mptcp_token_get_sock (token);struct sockaddr_in remote;struct sockaddr_in local;int err;
net/mptcp/protocol.c +2 -2
@@ -697,7 +697,7 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, msk->remote_key = subflow->remote_key; msk->local_key = subflow->local_key; msk->token = subflow->token; -token_update_accept (new_sock->sk, new_mptcp_sock); +mptcp_token_update_accept (new_sock->sk, new_mptcp_sock); msk->subflow =NULL ;pm_new_connection (msk,1 );
@@ -733,7 +733,7 @@ static void mptcp_destroy(struct sock *sk)pr_debug ("msk=%p" , sk); -token_destroy (msk->token); +mptcp_token_destroy (msk->token); } static int mptcp_setsockopt(struct sock *sk, int level, int optname,
net/mptcp/protocol.h +7 -13
@@ -229,20 +229,14 @@ void mptcp_get_options(const struct sk_buff *skb,void mptcp_finish_connect (struct sock *sk,int mp_capable);void mptcp_finish_join (struct sock *sk); -void token_new_request (struct request_sock *req,const struct sk_buff *skb); -int token_join_request (struct request_sock *req,const struct sk_buff *skb); -int token_join_response (struct sock *sk); -int token_join_valid (struct request_sock *req, -struct tcp_options_received *rx_opt); -void token_destroy_request (u32 token); -void token_new_connect (struct sock *sk); -void token_new_subflow (struct sock *sk); -void token_new_accept (struct sock *sk); -int token_new_join (struct sock *sk); -void token_update_accept (struct sock *sk,struct sock *conn); -struct sock *token_lookup_get (u32 token); +int mptcp_token_new_request (struct request_sock *req); +void mptcp_token_destroy_request (u32 token); +int mptcp_token_new_connect (struct sock *sk); +int mptcp_token_new_accept (u32 token); +void mptcp_token_update_accept (struct sock *sk,struct sock *conn); +struct mptcp_sock *mptcp_token_get_sock (u32 token);void token_release (u32 token); -void token_destroy (u32 token); +void mptcp_token_destroy (u32 token);void crypto_key_sha1 (u64 key,u32 *token,u64 *idsn);static inline void crypto_key_gen_sha1 (u64 *key,u32 *token,u64 *idsn)
net/mptcp/subflow.c +117 -16
217 lines not on this page · raw message
net/mptcp/token.c +125 -274
472 lines not on this page · raw message
Signature · 1 line
2.21.0
Matthieu Baerts
Hi Florian,
Quoted 7 lines · Florian Westphal
I tried to fold the earlier 'RFC v2' in a way so that it allows easy squashing.
Patch #1 is the only one where this is painless.
For all others, things are not easy because conflicts exist all over the place.
Quoted 5 lines
So I see two ways forward:
1. I rebase this myself and offer a pull request for the resulting series
2. Only squash the first patch and keep the rest as extra patch.I suggest we go with #2.
Sounds good to me. Is it OK for others if we do that?
I only propose to squash commits to ease the work for later and still have a patch-set that can be easy to read, not ending with a lot of "to squash" patches. But here I understand that there are conflicts everywhere.
Another possibility is to do the "rebase" directly in the TopGit tree if you prefer. I have no issue to give you the "push" permissions and you have experience with TopGit. But I can also understand that you prefer to postpone the rebase for later (or you don't like TopGit :) )
Quoted 2 lines
The export tree already has a few patches
that need to be squashed anyway before sending a formal series.
That's true. If we want to change that before, simply tell me which patches have to be squashed and I can already do the work :)
Quoted 2 lines
Also, the export branch is currently not bisectable, I get build errors mid-series.
That has to happen :/
Is it something very important if we send the whole patch-set upstream? I guess it is better to have "consistent" patches and we will certainly fix that but the goal is to merge the whole series.
Quoted 2 lines
I don't think this is a problem for now, I think it makes sense to not squash the larger patches for the time being.
I am fine with that.
Quoted 4 lines
Once another patch series is to be submitted to netdev, the export branch can be renamed/archived and a reorganisation can be done at that point (and the result diff'd versus the old export branch to make sure there is no difference in resulting code).
Sounds good to me!
We can even re-create another TopGit tree in parallel after the rebase if we think that it will take some times before being accepted upstream.
Another question linked to that: do you think it could be possible and a good idea to push our code upstream ASAP with known limitations and continue our work directly in a dedicated repo from git.kernel.org with "regular" merge request for net-next?
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
Florian Westphal
Quoted 3 lines · Matthieu Baerts
I only propose to squash commits to ease the work for later and still have a patch-set that can be easy to read, not ending with a lot of "to squash" patches. But here I understand that there are conflicts everywhere.
I have no problem with squashing the 'obvious' patches.
Quoted 4 lines
Another possibility is to do the "rebase" directly in the TopGit tree if you prefer. I have no issue to give you the "push" permissions and you have experience with TopGit. But I can also understand that you prefer to postpone the rebase for later (or you don't like TopGit :) )
I would have to take a look at topgit again. I used it for a short period but that was more than 6 years ago.
Quoted 10 lines
Quoted 2 lines
The export tree already has a few patches
that need to be squashed anyway before sending a formal series.That's true. If we want to change that before, simply tell me which patches have to be squashed and I can already do the work :)
Quoted 2 lines
Also, the export branch is currently not bisectable, I get build errors mid-series.
That has to happen :/
Why?
Quoted 1 line
Is it something very important if we send the whole patch-set upstream?
Yes, each step on the way needs to result in a compileable tree. Otherwise, other developers doing 'git bisect' on the kernel later will may hit this.
Quoted 2 lines
I guess it is better to have "consistent" patches and we will certainly fix that but the goal is to merge the whole series.
Of course. Note that its not a problem to add a function in patch n and then only add a user in patch n+1 later in the series.
Quoted 8 lines
Quoted 4 lines
Once another patch series is to be submitted to netdev, the export branch can be renamed/archived and a reorganisation can be done at that point (and the result diff'd versus the old export branch to make sure there is no difference in resulting code).
Sounds good to me!
We can even re-create another TopGit tree in parallel after the rebase if we think that it will take some times before being accepted upstream.
Thats good to know.
Quoted 4 lines
Another question linked to that: do you think it could be possible and a good idea to push our code upstream ASAP with known limitations and continue our work directly in a dedicated repo from git.kernel.org with "regular" merge request for net-next?
I think its good to merge early, but it needs to be well understood/described where the limits are.
At the moment I don't think we're there yet.
Once mptcp_poll is a bit saner (I added a note to the pad and will be working on this), we've sorted out token refcounting (also working on this), Paolos retrans patches are in *and* we can deal with data arriving on multiple subflows I think we'd be good for a non-rfc patchset.
IPv6 would be nice but I don't think its a deal-breaker if we'd place it on the immediate post-merge todo list.
Matthieu Baerts
Hi Florian,
Thank you for your quick answer!
Quoted 7 lines · Florian Westphal
Quoted 3 lines · Matthieu Baerts
I only propose to squash commits to ease the work for later and still have a patch-set that can be easy to read, not ending with a lot of "to squash" patches. But here I understand that there are conflicts everywhere.
I have no problem with squashing the 'obvious' patches.
Quoted 7 lines
Quoted 4 lines
Another possibility is to do the "rebase" directly in the TopGit tree if you prefer. I have no issue to give you the "push" permissions and you have experience with TopGit. But I can also understand that you prefer to postpone the rebase for later (or you don't like TopGit :) )
I would have to take a look at topgit again. I used it for a short period but that was more than 6 years ago.
I guess the logic is still the same but they improved the workflow, more tools and better speed: https://github.com/mackyle/topgit
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
The export tree already has a few patches
that need to be squashed anyway before sending a formal series.That's true. If we want to change that before, simply tell me which patches have to be squashed and I can already do the work :)
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Also, the export branch is currently not bisectable, I get build errors mid-series.
That has to happen :/
Why?
I was suspecting that with the all the squashes and rebase we did and continue to do. If we do not monitor this, we will have more issues :) On my side, I don't compile each commit we export.
Quoted 5 lines
Quoted 1 line
Is it something very important if we send the whole patch-set upstream?
Yes, each step on the way needs to result in a compileable tree. Otherwise, other developers doing 'git bisect' on the kernel later will may hit this.
It makes sense, thank you!
Quoted 5 lines
Quoted 2 lines
I guess it is better to have "consistent" patches and we will certainly fix that but the goal is to merge the whole series.
Of course. Note that its not a problem to add a function in patch n and then only add a user in patch n+1 later in the series.
Thank you for your answer!
Quoted 21 lines
Quoted 8 lines
Quoted 4 lines
Once another patch series is to be submitted to netdev, the export branch can be renamed/archived and a reorganisation can be done at that point (and the result diff'd versus the old export branch to make sure there is no difference in resulting code).
Sounds good to me!
We can even re-create another TopGit tree in parallel after the rebase if we think that it will take some times before being accepted upstream.Thats good to know.
Quoted 4 lines
Another question linked to that: do you think it could be possible and a good idea to push our code upstream ASAP with known limitations and continue our work directly in a dedicated repo from git.kernel.org with "regular" merge request for net-next?
I think its good to merge early, but it needs to be well understood/described where the limits are.
At the moment I don't think we're there yet.
Quoted 8 lines
Once
mptcp_pollis a bit saner (I added a note to the pad and will be working on this), we've sorted out token refcounting (also working on this), Paolos retrans patches are in *and* we can deal with data arriving on multiple subflows I think we'd be good for a non-rfc patchset.IPv6 would be nice but I don't think its a deal-breaker if we'd place it on the immediate post-merge todo list.
Excellent, thank you for sharing this with us! I also added this to the pad!
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
Florian Westphal
Quoted 7 lines · Matthieu Baerts
Quoted 3 lines
Quoted 1 line
That has to happen :/
Why?
I was suspecting that with the all the squashes and rebase we did and continue to do. If we do not monitor this, we will have more issues :) On my side, I don't compile each commit we export.
Argh, ok, sorry -- I misunderstood what you said :-) Until we go upstream with this the intermediate breakage is fine of course, no need to do anything right now.
Thanks for the pad update!
Peter Krystad
Quoted 7 lines · Florian Westphal
I tried to fold the earlier 'RFC v2' in a way so that it allows easy squashing.
Patch #1 is the only one where this is painless.
For all others, things are not easy because conflicts exist all over the place.
Quoted 7 lines
So I see two ways forward:
1. I rebase this myself and offer a pull request for the resulting series
2. Only squash the first patch and keep the rest as extra patch.I suggest we go with #2. The export tree already has a few patches that need to be squashed anyway before sending a formal series.
This looks good and I'm fine with the extra patch for now, would just be too hard to split this up and squash to all kinds of different places.
Peter.
Quoted 16 lines
Also, the export branch is currently not bisectable, I get build errors mid-series.
I don't think this is a problem for now, I think it makes sense to not squash the larger patches for the time being.
Once another patch series is to be submitted to netdev, the export branch can be renamed/archived and a reorganisation can be done at that point (and the result diff'd versus the old export branch to make sure there is no difference in resulting code).
_______________________________________________
mptcp mailing list
mptcp(a)lists.01.org
https://lists.01.org/mailman/listinfo/mptcp
Matthieu Baerts
Hi Florian, Peter,
Quoted 13 lines · Peter Krystad
Quoted 11 lines · Florian Westphal
I tried to fold the earlier 'RFC v2' in a way so that it allows easy squashing.
Patch #1 is the only one where this is painless.
For all others, things are not easy because conflicts exist all over the place.So I see two ways forward:
1. I rebase this myself and offer a pull request for the resulting series
2. Only squash the first patch and keep the rest as extra patch.
Quoted 5 lines
Quoted 3 lines
I suggest we go with #2. The export tree already has a few patches that need to be squashed anyway before sending a formal series.
This looks good and I'm fine with the extra patch for now, would just be too hard to split this up and squash to all kinds of different places.
Again, thank you for the patches and reviews!
- d02941b33b1a: first patch "squashed" into "mptcp: Add key generation and token tree"
- 4b56d876cb96: signed-off
- f491c702f9c3..02bf3cf7f6d2: result of the first patch
The second patch has been added at the end.
Tests are still OK!
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