Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/ipv4: Update ip_tunnel_metadata_cnt static key to modern api

No changes in refcount semantics -- key init is false; replace

static_key_slow_inc|dec with static_branch_inc|dec
static_key_false with static_branch_unlikely

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Davidlohr Bueso and committed by
David S. Miller
5263a98f 5bafeb6e

+5 -5
+2 -2
include/net/ip_tunnels.h
··· 477 477 return (struct ip_tunnel_info *)lwtstate->data; 478 478 } 479 479 480 - extern struct static_key ip_tunnel_metadata_cnt; 480 + DECLARE_STATIC_KEY_FALSE(ip_tunnel_metadata_cnt); 481 481 482 482 /* Returns > 0 if metadata should be collected */ 483 483 static inline int ip_tunnel_collect_metadata(void) 484 484 { 485 - return static_key_false(&ip_tunnel_metadata_cnt); 485 + return static_branch_unlikely(&ip_tunnel_metadata_cnt); 486 486 } 487 487 488 488 void __init ip_tunnel_core_init(void);
+3 -3
net/ipv4/ip_tunnel_core.c
··· 423 423 lwtunnel_encap_add_ops(&ip6_tun_lwt_ops, LWTUNNEL_ENCAP_IP6); 424 424 } 425 425 426 - struct static_key ip_tunnel_metadata_cnt = STATIC_KEY_INIT_FALSE; 426 + DEFINE_STATIC_KEY_FALSE(ip_tunnel_metadata_cnt); 427 427 EXPORT_SYMBOL(ip_tunnel_metadata_cnt); 428 428 429 429 void ip_tunnel_need_metadata(void) 430 430 { 431 - static_key_slow_inc(&ip_tunnel_metadata_cnt); 431 + static_branch_inc(&ip_tunnel_metadata_cnt); 432 432 } 433 433 EXPORT_SYMBOL_GPL(ip_tunnel_need_metadata); 434 434 435 435 void ip_tunnel_unneed_metadata(void) 436 436 { 437 - static_key_slow_dec(&ip_tunnel_metadata_cnt); 437 + static_branch_dec(&ip_tunnel_metadata_cnt); 438 438 } 439 439 EXPORT_SYMBOL_GPL(ip_tunnel_unneed_metadata);