* [MPTCP] [RFC v2 01/10] mptcp: token: remove token_init
@ 2019-08-29 9:06 Florian Westphal
0 siblings, 0 replies; only message in thread
From: Florian Westphal @ 2019-08-29 9:06 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 2316 bytes --]
Its not needed, just use the static initialisers.
Also add 'MPTCP' prefix for pr_* calls.
Signed-off-by: Florian Westphal <fw(a)strlen.de>
---
net/mptcp/protocol.c | 1 -
net/mptcp/protocol.h | 1 -
net/mptcp/token.c | 17 ++++++-----------
3 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index aaa71b161c1a..b408150e46b9 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1104,7 +1104,6 @@ void mptcp_proto_init(void)
mptcp_stream_ops.listen = mptcp_listen;
mptcp_stream_ops.shutdown = mptcp_shutdown;
- token_init();
subflow_init();
pm_init();
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 68877e952780..e97ac14115a2 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -225,7 +225,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);
diff --git a/net/mptcp/token.c b/net/mptcp/token.c
index 506665da8b2d..19b63bd34315 100644
--- a/net/mptcp/token.c
+++ b/net/mptcp/token.c
@@ -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);
-}
--
2.21.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-29 9:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-29 9:06 [MPTCP] [RFC v2 01/10] mptcp: token: remove token_init Florian Westphal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.