Commit afa79d08 authored by Changbin Du's avatar Changbin Du Committed by Jakub Kicinski

net: in_irq() cleanup

Replace the obsolete and ambiguos macro in_irq() with new
macro in_hardirq().
Signed-off-by: default avatarChangbin Du <changbin.du@gmail.com>
Link: https://lore.kernel.org/r/20210813145749.86512-1-changbin.du@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 39a0876d
...@@ -3956,7 +3956,7 @@ void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason); ...@@ -3956,7 +3956,7 @@ void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason);
/* /*
* It is not allowed to call kfree_skb() or consume_skb() from hardware * It is not allowed to call kfree_skb() or consume_skb() from hardware
* interrupt context or with hardware interrupts being disabled. * interrupt context or with hardware interrupts being disabled.
* (in_irq() || irqs_disabled()) * (in_hardirq() || irqs_disabled())
* *
* We provide four helpers that can be used in following contexts : * We provide four helpers that can be used in following contexts :
* *
......
...@@ -416,7 +416,7 @@ static bool bpf_sk_storage_tracing_allowed(const struct bpf_prog *prog) ...@@ -416,7 +416,7 @@ static bool bpf_sk_storage_tracing_allowed(const struct bpf_prog *prog)
BPF_CALL_4(bpf_sk_storage_get_tracing, struct bpf_map *, map, struct sock *, sk, BPF_CALL_4(bpf_sk_storage_get_tracing, struct bpf_map *, map, struct sock *, sk,
void *, value, u64, flags) void *, value, u64, flags)
{ {
if (in_irq() || in_nmi()) if (in_hardirq() || in_nmi())
return (unsigned long)NULL; return (unsigned long)NULL;
return (unsigned long)____bpf_sk_storage_get(map, sk, value, flags); return (unsigned long)____bpf_sk_storage_get(map, sk, value, flags);
...@@ -425,7 +425,7 @@ BPF_CALL_4(bpf_sk_storage_get_tracing, struct bpf_map *, map, struct sock *, sk, ...@@ -425,7 +425,7 @@ BPF_CALL_4(bpf_sk_storage_get_tracing, struct bpf_map *, map, struct sock *, sk,
BPF_CALL_2(bpf_sk_storage_delete_tracing, struct bpf_map *, map, BPF_CALL_2(bpf_sk_storage_delete_tracing, struct bpf_map *, map,
struct sock *, sk) struct sock *, sk)
{ {
if (in_irq() || in_nmi()) if (in_hardirq() || in_nmi())
return -EPERM; return -EPERM;
return ____bpf_sk_storage_delete(map, sk); return ____bpf_sk_storage_delete(map, sk);
......
...@@ -3107,7 +3107,7 @@ EXPORT_SYMBOL(__dev_kfree_skb_irq); ...@@ -3107,7 +3107,7 @@ EXPORT_SYMBOL(__dev_kfree_skb_irq);
void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason) void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason)
{ {
if (in_irq() || irqs_disabled()) if (in_hardirq() || irqs_disabled())
__dev_kfree_skb_irq(skb, reason); __dev_kfree_skb_irq(skb, reason);
else else
dev_kfree_skb(skb); dev_kfree_skb(skb);
......
...@@ -156,7 +156,7 @@ void *__netdev_alloc_frag_align(unsigned int fragsz, unsigned int align_mask) ...@@ -156,7 +156,7 @@ void *__netdev_alloc_frag_align(unsigned int fragsz, unsigned int align_mask)
void *data; void *data;
fragsz = SKB_DATA_ALIGN(fragsz); fragsz = SKB_DATA_ALIGN(fragsz);
if (in_irq() || irqs_disabled()) { if (in_hardirq() || irqs_disabled()) {
nc = this_cpu_ptr(&netdev_alloc_cache); nc = this_cpu_ptr(&netdev_alloc_cache);
data = page_frag_alloc_align(nc, fragsz, GFP_ATOMIC, align_mask); data = page_frag_alloc_align(nc, fragsz, GFP_ATOMIC, align_mask);
} else { } else {
...@@ -502,7 +502,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len, ...@@ -502,7 +502,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len,
if (sk_memalloc_socks()) if (sk_memalloc_socks())
gfp_mask |= __GFP_MEMALLOC; gfp_mask |= __GFP_MEMALLOC;
if (in_irq() || irqs_disabled()) { if (in_hardirq() || irqs_disabled()) {
nc = this_cpu_ptr(&netdev_alloc_cache); nc = this_cpu_ptr(&netdev_alloc_cache);
data = page_frag_alloc(nc, len, gfp_mask); data = page_frag_alloc(nc, len, gfp_mask);
pfmemalloc = nc->pfmemalloc; pfmemalloc = nc->pfmemalloc;
...@@ -724,7 +724,7 @@ void skb_release_head_state(struct sk_buff *skb) ...@@ -724,7 +724,7 @@ void skb_release_head_state(struct sk_buff *skb)
{ {
skb_dst_drop(skb); skb_dst_drop(skb);
if (skb->destructor) { if (skb->destructor) {
WARN_ON(in_irq()); WARN_ON(in_hardirq());
skb->destructor(skb); skb->destructor(skb);
} }
#if IS_ENABLED(CONFIG_NF_CONNTRACK) #if IS_ENABLED(CONFIG_NF_CONNTRACK)
......
...@@ -140,7 +140,7 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb, ...@@ -140,7 +140,7 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb,
{ {
struct sock *sk = (struct sock *) context; struct sock *sk = (struct sock *) context;
BUG_ON(in_irq()); BUG_ON(in_hardirq());
pr_debug("sk=%p err=%d\n", sk, err); pr_debug("sk=%p err=%d\n", sk, err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment