diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2018-05-08 09:07:03 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-10 15:13:34 -0400 |
commit | 88ab31081b8c8d4d7698711b80fbfd3f52d27fd9 (patch) | |
tree | 79220b7c16db91c81ccc73f4971bde0ca8a462e1 /net/ipv4/udp.c | |
parent | 02786475c74c7d0721b0142fac74108112cb456c (diff) | |
download | linux-88ab31081b8c8d4d7698711b80fbfd3f52d27fd9.tar.gz linux-88ab31081b8c8d4d7698711b80fbfd3f52d27fd9.tar.bz2 linux-88ab31081b8c8d4d7698711b80fbfd3f52d27fd9.zip |
net/udp: Update udp_encap_needed static key to modern api
No changes in refcount semantics -- key init is false; replace
static_key_enable with static_branch_enable
static_key_slow_inc|dec with static_branch_inc|dec
static_key_false with static_branch_unlikely
Added a '_key' suffix to udp and udpv6 encap_needed, for better
self documentation.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index e07db83b311e..229e616fafc5 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1875,10 +1875,10 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) return 0; } -static struct static_key udp_encap_needed __read_mostly; +static DEFINE_STATIC_KEY_FALSE(udp_encap_needed_key); void udp_encap_enable(void) { - static_key_enable(&udp_encap_needed); + static_branch_enable(&udp_encap_needed_key); } EXPORT_SYMBOL(udp_encap_enable); @@ -1902,7 +1902,7 @@ static int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) goto drop; nf_reset(skb); - if (static_key_false(&udp_encap_needed) && up->encap_type) { + if (static_branch_unlikely(&udp_encap_needed_key) && up->encap_type) { int (*encap_rcv)(struct sock *sk, struct sk_buff *skb); /* @@ -2365,7 +2365,7 @@ void udp_destroy_sock(struct sock *sk) bool slow = lock_sock_fast(sk); udp_flush_pending_frames(sk); unlock_sock_fast(sk, slow); - if (static_key_false(&udp_encap_needed) && up->encap_type) { + if (static_branch_unlikely(&udp_encap_needed_key) && up->encap_type) { void (*encap_destroy)(struct sock *sk); encap_destroy = READ_ONCE(up->encap_destroy); if (encap_destroy) |