aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@stgolabs.net>2018-05-08 12:07:02 -0400
committerDavid S. Miller <davem@davemloft.net>2018-05-10 15:13:34 -0400
commit02786475c74c7d0721b0142fac74108112cb456c (patch)
treeb113ce12cd5e7cd33574ef2844fdeb9ff2668d5b /net/core/dev.c
parent39e8392201dcd02b7d70f2149e678035b20cc26a (diff)
net: Update generic_xdp_needed 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 Added a '_key' suffix to generic_xdp_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/core/dev.c')
-rw-r--r--net/core/dev.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index d6fd1578f770..9f4390182384 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4154,7 +4154,7 @@ void generic_xdp_tx(struct sk_buff *skb, struct bpf_prog *xdp_prog)
4154} 4154}
4155EXPORT_SYMBOL_GPL(generic_xdp_tx); 4155EXPORT_SYMBOL_GPL(generic_xdp_tx);
4156 4156
4157static struct static_key generic_xdp_needed __read_mostly; 4157static DEFINE_STATIC_KEY_FALSE(generic_xdp_needed_key);
4158 4158
4159int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff *skb) 4159int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff *skb)
4160{ 4160{
@@ -4194,7 +4194,7 @@ static int netif_rx_internal(struct sk_buff *skb)
4194 4194
4195 trace_netif_rx(skb); 4195 trace_netif_rx(skb);
4196 4196
4197 if (static_key_false(&generic_xdp_needed)) { 4197 if (static_branch_unlikely(&generic_xdp_needed_key)) {
4198 int ret; 4198 int ret;
4199 4199
4200 preempt_disable(); 4200 preempt_disable();
@@ -4726,9 +4726,9 @@ static int generic_xdp_install(struct net_device *dev, struct netdev_bpf *xdp)
4726 bpf_prog_put(old); 4726 bpf_prog_put(old);
4727 4727
4728 if (old && !new) { 4728 if (old && !new) {
4729 static_key_slow_dec(&generic_xdp_needed); 4729 static_branch_dec(&generic_xdp_needed_key);
4730 } else if (new && !old) { 4730 } else if (new && !old) {
4731 static_key_slow_inc(&generic_xdp_needed); 4731 static_branch_inc(&generic_xdp_needed_key);
4732 dev_disable_lro(dev); 4732 dev_disable_lro(dev);
4733 dev_disable_gro_hw(dev); 4733 dev_disable_gro_hw(dev);
4734 } 4734 }
@@ -4756,7 +4756,7 @@ static int netif_receive_skb_internal(struct sk_buff *skb)
4756 if (skb_defer_rx_timestamp(skb)) 4756 if (skb_defer_rx_timestamp(skb))
4757 return NET_RX_SUCCESS; 4757 return NET_RX_SUCCESS;
4758 4758
4759 if (static_key_false(&generic_xdp_needed)) { 4759 if (static_branch_unlikely(&generic_xdp_needed_key)) {
4760 int ret; 4760 int ret;
4761 4761
4762 preempt_disable(); 4762 preempt_disable();