>From b2c2a9eeb22ab48d4d31b61d2b4980faafb46c83 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Fri, 6 Oct 2023 14:41:21 +0000 Subject: [PATCH net-next 2/2] net, tc: Add tc_set_drop_reason for reclassify limit Add an initial user for the newly added tc_set_drop_reason() helper to set the drop reason to SKB_DROP_REASON_TC_ERROR_MAX_LOOP when the maximum reclassification limit is hit. Signed-off-by: Daniel Borkmann Cc: Jamal Hadi Salim Cc: Victor Nogueira Cc: Jakub Kicinski --- include/net/dropreason-core.h | 3 +++ net/sched/cls_api.c | 1 + 2 files changed, 4 insertions(+) diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h index a587e83fc169..a8503a72fddf 100644 --- a/include/net/dropreason-core.h +++ b/include/net/dropreason-core.h @@ -80,6 +80,7 @@ FN(IPV6_NDISC_BAD_OPTIONS) \ FN(IPV6_NDISC_NS_OTHERHOST) \ FN(QUEUE_PURGE) \ + FN(TC_ERROR_MAX_LOOP) \ FNe(MAX) /** @@ -345,6 +346,8 @@ enum skb_drop_reason { SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST, /** @SKB_DROP_REASON_QUEUE_PURGE: bulk free. */ SKB_DROP_REASON_QUEUE_PURGE, + /** @SKB_DROP_REASON_TC_ERROR_MAX_LOOP: dropped due to hitting maximum reclassify limit. */ + SKB_DROP_REASON_TC_ERROR_MAX_LOOP, /** * @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which * shouldn't be used as a real 'reason' - only for tracing code gen diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index a193cc7b3241..ed740f070dc4 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1723,6 +1723,7 @@ static inline int __tcf_classify(struct sk_buff *skb, tp->chain->block->index, tp->prio & 0xffff, ntohs(tp->protocol)); + tc_set_drop_reason(res, SKB_DROP_REASON_TC_ERROR_MAX_LOOP); return TC_ACT_SHOT; } -- 2.34.1