Commit 7e726ed8 authored by Menglong Dong's avatar Menglong Dong Committed by David S. Miller

net: dev: use kfree_skb_reason() for do_xdp_generic()

Replace kfree_skb() used in do_xdp_generic() with kfree_skb_reason().
The drop reason SKB_DROP_REASON_XDP is introduced for this case.
Signed-off-by: default avatarMenglong Dong <imagedong@tencent.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 44f0bd40
...@@ -405,6 +405,7 @@ enum skb_drop_reason { ...@@ -405,6 +405,7 @@ enum skb_drop_reason {
* full (see netdev_max_backlog in * full (see netdev_max_backlog in
* net.rst) or RPS flow limit * net.rst) or RPS flow limit
*/ */
SKB_DROP_REASON_XDP, /* dropped by XDP in input path */
SKB_DROP_REASON_MAX, SKB_DROP_REASON_MAX,
}; };
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
EM(SKB_DROP_REASON_TC_EGRESS, TC_EGRESS) \ EM(SKB_DROP_REASON_TC_EGRESS, TC_EGRESS) \
EM(SKB_DROP_REASON_QDISC_DROP, QDISC_DROP) \ EM(SKB_DROP_REASON_QDISC_DROP, QDISC_DROP) \
EM(SKB_DROP_REASON_CPU_BACKLOG, CPU_BACKLOG) \ EM(SKB_DROP_REASON_CPU_BACKLOG, CPU_BACKLOG) \
EM(SKB_DROP_REASON_XDP, XDP) \
EMe(SKB_DROP_REASON_MAX, MAX) EMe(SKB_DROP_REASON_MAX, MAX)
#undef EM #undef EM
......
...@@ -4825,7 +4825,7 @@ int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff *skb) ...@@ -4825,7 +4825,7 @@ int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff *skb)
} }
return XDP_PASS; return XDP_PASS;
out_redir: out_redir:
kfree_skb(skb); kfree_skb_reason(skb, SKB_DROP_REASON_XDP);
return XDP_DROP; return XDP_DROP;
} }
EXPORT_SYMBOL_GPL(do_xdp_generic); EXPORT_SYMBOL_GPL(do_xdp_generic);
......
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