summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-05-20 06:52:26 +0000
committerDavid S. Miller <davem@davemloft.net>2013-05-20 14:00:42 -0700
commit71cea17ed39fdf1c0634f530ddc6a2c2fc601c2b (patch)
treeec6ec3929a41948fb7fef76cceaebf2f1681f1d8 /include/net
parent168fc21a971e4bc821a7838ccc39b7bdaf316c11 (diff)
downloadblackbird-op-linux-71cea17ed39fdf1c0634f530ddc6a2c2fc601c2b.tar.gz
blackbird-op-linux-71cea17ed39fdf1c0634f530ddc6a2c2fc601c2b.zip
tcp: md5: remove spinlock usage in fast path
TCP md5 code uses per cpu variables but protects access to them with a shared spinlock, which is a contention point. [ tcp_md5sig_pool_lock is locked twice per incoming packet ] Makes things much simpler, by allocating crypto structures once, first time a socket needs md5 keys, and not deallocating them as they are really small. Next step would be to allow crypto allocations being done in a NUMA aware way. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/tcp.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e1c3723f161f..bf1cc3dced5e 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1283,11 +1283,13 @@ static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
#define tcp_twsk_md5_key(twsk) NULL
#endif
-extern struct tcp_md5sig_pool __percpu *tcp_alloc_md5sig_pool(struct sock *);
-extern void tcp_free_md5sig_pool(void);
+extern bool tcp_alloc_md5sig_pool(void);
extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
-extern void tcp_put_md5sig_pool(void);
+static inline void tcp_put_md5sig_pool(void)
+{
+ local_bh_enable();
+}
extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *);
extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *,
OpenPOWER on IntegriCloud