[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220215112812.2093852-19-imagedong@tencent.com>
Date: Tue, 15 Feb 2022 19:28:11 +0800
From: menglong8.dong@...il.com
To: dsahern@...nel.org, kuba@...nel.org
Cc: edumazet@...gle.com, davem@...emloft.net, rostedt@...dmis.org,
mingo@...hat.com, yoshfuji@...ux-ipv6.org, ast@...nel.org,
daniel@...earbox.net, hawk@...nel.org, john.fastabend@...il.com,
imagedong@...cent.com, talalahmad@...gle.com,
keescook@...omium.org, ilias.apalodimas@...aro.org, alobakin@...me,
memxor@...il.com, atenart@...nel.org, bigeasy@...utronix.de,
pabeni@...hat.com, linyunsheng@...wei.com, arnd@...db.de,
yajun.deng@...ux.dev, roopa@...dia.com, willemb@...gle.com,
vvs@...tuozzo.com, cong.wang@...edance.com,
luiz.von.dentz@...el.com, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, bpf@...r.kernel.org, flyingpeng@...cent.com
Subject: [PATCH net-next 18/19] net: dev: use kfree_skb_reason() for sch_handle_ingress()
From: Menglong Dong <imagedong@...cent.com>
Replace kfree_skb() used in sch_handle_ingress() with
kfree_skb_reason(). Following drop reasons are introduced:
SKB_DROP_REASON_QDISC_INGRESS
Signed-off-by: Menglong Dong <imagedong@...cent.com>
---
include/linux/skbuff.h | 4 ++++
include/trace/events/skb.h | 1 +
net/core/dev.c | 2 +-
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 79b24d5f491d..e36e27943104 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -411,6 +411,10 @@ enum skb_drop_reason {
* net.rst) or RPS flow limit
*/
SKB_DROP_REASON_XDP, /* dropped by XDP in input path */
+ SKB_DROP_REASON_QDISC_INGRESS, /* qdisc of type ingress check
+ * failed (maybe an eBPF program
+ * is tricking?)
+ */
SKB_DROP_REASON_MAX,
};
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 7bc46414a81b..96a550570dfe 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -47,6 +47,7 @@
EM(SKB_DROP_REASON_QDISC_DROP, QDISC_DROP) \
EM(SKB_DROP_REASON_CPU_BACKLOG, CPU_BACKLOG) \
EM(SKB_DROP_REASON_XDP, XDP) \
+ EM(SKB_DROP_REASON_QDISC_INGRESS, QDISC_INGRESS) \
EMe(SKB_DROP_REASON_MAX, MAX)
#undef EM
diff --git a/net/core/dev.c b/net/core/dev.c
index a2548b7f2708..c67e3491c004 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5006,7 +5006,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
break;
case TC_ACT_SHOT:
mini_qdisc_qstats_cpu_drop(miniq);
- kfree_skb(skb);
+ kfree_skb_reason(skb, SKB_DROP_REASON_QDISC_INGRESS);
return NULL;
case TC_ACT_STOLEN:
case TC_ACT_QUEUED:
--
2.34.1
Powered by blists - more mailing lists