All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
@ 2023-10-14 18:09 Victor Nogueira
  2023-10-14 19:00 ` Florian Westphal
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Victor Nogueira @ 2023-10-14 18:09 UTC (permalink / raw)
  To: jhs, daniel, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni,
	paulb
  Cc: bpf, mleitner, martin.lau, dcaratti, netdev, kernel

Currently there is no way to distinguish between an error and a
classification verdict. Which has caused us a lot of pain with buggy qdiscs
and syzkaller. This patch does 2 things - one is it disambiguates between
an error and policy decisions. The reasons are added under the auspices of
skb drop reason. We add the drop reason as a part of struct tcf_result.
That way, tcf_classify can set a proper drop reason when it fails,
and we keep the classification result as the tcf_classify's return value.

This patch also adds a variety of drop reasons which are more fine grained
on why a packet was dropped by the TC classification action subsystem.

Co-developed-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
---

v1 -> v2:
- Make tcf_classify set drop reason instead of verdict in struct
  tcf_result
- Make tcf_classify return verdict (as it was doing before)
- Only initialise struct tcf_result in tc_run
- Add new drop reasons specific to TC
- Merged v1 patch with Daniel's patch (https://lore.kernel.org/bpf/20231013141722.21165ef3@kernel.org/T/)
  for completeness

 include/net/dropreason-core.h | 26 ++++++++++++++++++++++++
 include/net/pkt_cls.h         |  6 ++++++
 include/net/sch_generic.h     |  3 +--
 net/core/dev.c                | 17 ++++++++++------
 net/sched/cls_api.c           | 37 +++++++++++++++++++++++++++++------
 net/sched/sch_ets.c           |  4 +---
 net/sched/sch_fq_codel.c      |  4 +---
 net/sched/sch_fq_pie.c        |  4 +---
 net/sched/sch_hfsc.c          |  4 +---
 net/sched/sch_htb.c           |  6 +-----
 net/sched/sch_multiq.c        |  6 +-----
 net/sched/sch_prio.c          |  6 +-----
 net/sched/sch_qfq.c           |  4 +---
 net/sched/sch_sfb.c           |  4 +---
 net/sched/sch_sfq.c           |  4 +---
 15 files changed, 85 insertions(+), 50 deletions(-)

diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h
index a587e83fc169..fe479f75aa1f 100644
--- a/include/net/dropreason-core.h
+++ b/include/net/dropreason-core.h
@@ -80,6 +80,12 @@
 	FN(IPV6_NDISC_BAD_OPTIONS)	\
 	FN(IPV6_NDISC_NS_OTHERHOST)	\
 	FN(QUEUE_PURGE)			\
+	FN(TC_EXT_COOKIE_NOTFOUND)	\
+	FN(TC_COOKIE_EXT_MISMATCH)	\
+	FN(TC_COOKIE_MISMATCH)		\
+	FN(TC_CHAIN_NOTFOUND)		\
+	FN(TC_ALLOC_SKB_EXT)		\
+	FN(TC_RECLASSIFY_LOOP)		\
 	FNe(MAX)
 
 /**
@@ -345,6 +351,26 @@ 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_EXT_COOKIE_NOTFOUND: tc cookie was lookuped using ext,
+	 * but was not found.
+	 */
+	SKB_DROP_REASON_TC_EXT_COOKIE_NOTFOUND,
+	/** @SKB_DROP_REASON_TC_COOKIE_EXT_MISMATCH: tc ext was lookup using cookie and
+	 * either was not found or different from expected.
+	 */
+	SKB_DROP_REASON_TC_COOKIE_EXT_MISMATCH,
+	/** @SKB_DROP_REASON_TC_COOKIE_MISMATCH: tc cookie available but was
+	 * unable to match to filter.
+	 */
+	SKB_DROP_REASON_TC_COOKIE_MISMATCH,
+	/** @SKB_DROP_REASON_TC_CHAIN_NOTFOUND: tc chain lookup failed. */
+	SKB_DROP_REASON_TC_CHAIN_NOTFOUND,
+	/** @SKB_DROP_REASON_TC_ALLOC_SKB_EXT: tc failed to allocate skb ext. */
+	SKB_DROP_REASON_TC_ALLOC_SKB_EXT,
+	/** @SKB_DROP_REASON_TC_RECLASSIFY_LOOP: tc exceeded max reclassify
+	 * loop iterations.
+	 */
+	SKB_DROP_REASON_TC_RECLASSIFY_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/include/net/pkt_cls.h b/include/net/pkt_cls.h
index f308e8268651..a76c9171db0e 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -154,6 +154,12 @@ __cls_set_class(unsigned long *clp, unsigned long cl)
 	return xchg(clp, cl);
 }
 
+static inline void tcf_set_drop_reason(struct tcf_result *res,
+				       enum skb_drop_reason reason)
+{
+	res->drop_reason = reason;
+}
+
 static inline void
 __tcf_bind_filter(struct Qdisc *q, struct tcf_result *r, unsigned long base)
 {
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index c7318c73cfd6..dcb9160e6467 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -324,7 +324,6 @@ struct Qdisc_ops {
 	struct module		*owner;
 };
 
-
 struct tcf_result {
 	union {
 		struct {
@@ -332,8 +331,8 @@ struct tcf_result {
 			u32		classid;
 		};
 		const struct tcf_proto *goto_tp;
-
 	};
+	enum skb_drop_reason		drop_reason;
 };
 
 struct tcf_chain;
diff --git a/net/core/dev.c b/net/core/dev.c
index 606a366cc209..8b899d0a79df 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3910,24 +3910,27 @@ EXPORT_SYMBOL_GPL(netdev_xmit_skip_txqueue);
 #endif /* CONFIG_NET_EGRESS */
 
 #ifdef CONFIG_NET_XGRESS
-static int tc_run(struct tcx_entry *entry, struct sk_buff *skb)
+static int tc_run(struct tcx_entry *entry, struct sk_buff *skb,
+		  enum skb_drop_reason *drop_reason)
 {
 	int ret = TC_ACT_UNSPEC;
 #ifdef CONFIG_NET_CLS_ACT
 	struct mini_Qdisc *miniq = rcu_dereference_bh(entry->miniq);
-	struct tcf_result res;
+	struct tcf_result res = {0};
 
 	if (!miniq)
 		return ret;
 
 	tc_skb_cb(skb)->mru = 0;
 	tc_skb_cb(skb)->post_ct = false;
+	res.drop_reason = *drop_reason;
 
 	mini_qdisc_bstats_cpu_update(miniq, skb);
 	ret = tcf_classify(skb, miniq->block, miniq->filter_list, &res, false);
 	/* Only tcf related quirks below. */
 	switch (ret) {
 	case TC_ACT_SHOT:
+		*drop_reason = res.drop_reason;
 		mini_qdisc_qstats_cpu_drop(miniq);
 		break;
 	case TC_ACT_OK:
@@ -3977,6 +3980,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
 		   struct net_device *orig_dev, bool *another)
 {
 	struct bpf_mprog_entry *entry = rcu_dereference_bh(skb->dev->tcx_ingress);
+	enum skb_drop_reason drop_reason = SKB_DROP_REASON_TC_INGRESS;
 	int sch_ret;
 
 	if (!entry)
@@ -3994,7 +3998,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
 		if (sch_ret != TC_ACT_UNSPEC)
 			goto ingress_verdict;
 	}
-	sch_ret = tc_run(tcx_entry(entry), skb);
+	sch_ret = tc_run(tcx_entry(entry), skb, &drop_reason);
 ingress_verdict:
 	switch (sch_ret) {
 	case TC_ACT_REDIRECT:
@@ -4011,7 +4015,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
 		*ret = NET_RX_SUCCESS;
 		return NULL;
 	case TC_ACT_SHOT:
-		kfree_skb_reason(skb, SKB_DROP_REASON_TC_INGRESS);
+		kfree_skb_reason(skb, drop_reason);
 		*ret = NET_RX_DROP;
 		return NULL;
 	/* used by tc_run */
@@ -4032,6 +4036,7 @@ static __always_inline struct sk_buff *
 sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
 {
 	struct bpf_mprog_entry *entry = rcu_dereference_bh(dev->tcx_egress);
+	enum skb_drop_reason drop_reason = SKB_DROP_REASON_TC_EGRESS;
 	int sch_ret;
 
 	if (!entry)
@@ -4045,7 +4050,7 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
 		if (sch_ret != TC_ACT_UNSPEC)
 			goto egress_verdict;
 	}
-	sch_ret = tc_run(tcx_entry(entry), skb);
+	sch_ret = tc_run(tcx_entry(entry), skb, &drop_reason);
 egress_verdict:
 	switch (sch_ret) {
 	case TC_ACT_REDIRECT:
@@ -4054,7 +4059,7 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
 		*ret = NET_XMIT_SUCCESS;
 		return NULL;
 	case TC_ACT_SHOT:
-		kfree_skb_reason(skb, SKB_DROP_REASON_TC_EGRESS);
+		kfree_skb_reason(skb, drop_reason);
 		*ret = NET_XMIT_DROP;
 		return NULL;
 	/* used by tc_run */
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index a193cc7b3241..f3b2b6d2d3ad 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1681,12 +1681,20 @@ static inline int __tcf_classify(struct sk_buff *skb,
 			 * time we got here with a cookie from hardware.
 			 */
 			if (unlikely(n->tp != tp || n->tp->chain != n->chain ||
-				     !tp->ops->get_exts))
+				     !tp->ops->get_exts)) {
+				u32 drop_reason = SKB_DROP_REASON_TC_COOKIE_MISMATCH;
+
+				tcf_set_drop_reason(res, drop_reason);
 				return TC_ACT_SHOT;
+			}
 
 			exts = tp->ops->get_exts(tp, n->handle);
-			if (unlikely(!exts || n->exts != exts))
+			if (unlikely(!exts || n->exts != exts)) {
+				u32 drop_reason = SKB_DROP_REASON_TC_COOKIE_EXT_MISMATCH;
+
+				tcf_set_drop_reason(res, drop_reason);
 				return TC_ACT_SHOT;
+			}
 
 			n = NULL;
 			err = tcf_exts_exec_ex(skb, exts, act_index, res);
@@ -1712,8 +1720,11 @@ static inline int __tcf_classify(struct sk_buff *skb,
 			return err;
 	}
 
-	if (unlikely(n))
+	if (unlikely(n)) {
+		tcf_set_drop_reason(res,
+				    SKB_DROP_REASON_TC_COOKIE_MISMATCH);
 		return TC_ACT_SHOT;
+	}
 
 	return TC_ACT_UNSPEC; /* signal: continue lookup */
 #ifdef CONFIG_NET_CLS_ACT
@@ -1723,6 +1734,8 @@ static inline int __tcf_classify(struct sk_buff *skb,
 				       tp->chain->block->index,
 				       tp->prio & 0xffff,
 				       ntohs(tp->protocol));
+		tcf_set_drop_reason(res,
+				    SKB_DROP_REASON_TC_RECLASSIFY_LOOP);
 		return TC_ACT_SHOT;
 	}
 
@@ -1759,7 +1772,10 @@ int tcf_classify(struct sk_buff *skb,
 			if (ext->act_miss) {
 				n = tcf_exts_miss_cookie_lookup(ext->act_miss_cookie,
 								&act_index);
-				if (!n)
+				if (!n) {
+					u32 drop_reason = SKB_TC_EXT_COOKIE_NOTFOUND;
+
+					tcf_set_drop_reason(res, drop_reason);
 					return TC_ACT_SHOT;
 
 				chain = n->chain_index;
@@ -1768,8 +1784,13 @@ int tcf_classify(struct sk_buff *skb,
 			}
 
 			fchain = tcf_chain_lookup_rcu(block, chain);
-			if (!fchain)
+			if (!fchain) {
+				u32 drop_reason = SKB_DROP_REASON_TC_CHAIN_NOTFOUND;
+
+				tcf_set_drop_reason(res, drop_reason);
+
 				return TC_ACT_SHOT;
+			}
 
 			/* Consume, so cloned/redirect skbs won't inherit ext */
 			skb_ext_del(skb, TC_SKB_EXT);
@@ -1788,8 +1809,12 @@ int tcf_classify(struct sk_buff *skb,
 			struct tc_skb_cb *cb = tc_skb_cb(skb);
 
 			ext = tc_skb_ext_alloc(skb);
-			if (WARN_ON_ONCE(!ext))
+			if (WARN_ON_ONCE(!ext)) {
+				u32 drop_reason = SKB_TC_ALLOC_SKB_EXT;
+
+				tcf_set_drop_reason(res, drop_reason);
 				return TC_ACT_SHOT;
+			}
 			ext->chain = last_executed_chain;
 			ext->mru = cb->mru;
 			ext->post_ct = cb->post_ct;
diff --git a/net/sched/sch_ets.c b/net/sched/sch_ets.c
index b10efeaf0629..e5e3e3834016 100644
--- a/net/sched/sch_ets.c
+++ b/net/sched/sch_ets.c
@@ -374,8 +374,8 @@ static struct ets_class *ets_classify(struct sk_buff *skb, struct Qdisc *sch,
 				      int *qerr)
 {
 	struct ets_sched *q = qdisc_priv(sch);
+	struct tcf_result res = {0};
 	u32 band = skb->priority;
-	struct tcf_result res;
 	struct tcf_proto *fl;
 	int err;
 
@@ -383,7 +383,6 @@ static struct ets_class *ets_classify(struct sk_buff *skb, struct Qdisc *sch,
 	if (TC_H_MAJ(skb->priority) != sch->handle) {
 		fl = rcu_dereference_bh(q->filter_list);
 		err = tcf_classify(skb, NULL, fl, &res, false);
-#ifdef CONFIG_NET_CLS_ACT
 		switch (err) {
 		case TC_ACT_STOLEN:
 		case TC_ACT_QUEUED:
@@ -393,7 +392,6 @@ static struct ets_class *ets_classify(struct sk_buff *skb, struct Qdisc *sch,
 		case TC_ACT_SHOT:
 			return NULL;
 		}
-#endif
 		if (!fl || err < 0) {
 			if (TC_H_MAJ(band))
 				band = 0;
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 8c4fee063436..b95fac441ed2 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -77,8 +77,8 @@ static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch,
 				      int *qerr)
 {
 	struct fq_codel_sched_data *q = qdisc_priv(sch);
+	struct tcf_result res = {0};
 	struct tcf_proto *filter;
-	struct tcf_result res;
 	int result;
 
 	if (TC_H_MAJ(skb->priority) == sch->handle &&
@@ -93,7 +93,6 @@ static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch,
 	*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
 	result = tcf_classify(skb, NULL, filter, &res, false);
 	if (result >= 0) {
-#ifdef CONFIG_NET_CLS_ACT
 		switch (result) {
 		case TC_ACT_STOLEN:
 		case TC_ACT_QUEUED:
@@ -103,7 +102,6 @@ static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch,
 		case TC_ACT_SHOT:
 			return 0;
 		}
-#endif
 		if (TC_H_MIN(res.classid) <= q->flows_cnt)
 			return TC_H_MIN(res.classid);
 	}
diff --git a/net/sched/sch_fq_pie.c b/net/sched/sch_fq_pie.c
index 68e6acd0f130..9967d31f2c4e 100644
--- a/net/sched/sch_fq_pie.c
+++ b/net/sched/sch_fq_pie.c
@@ -81,8 +81,8 @@ static unsigned int fq_pie_classify(struct sk_buff *skb, struct Qdisc *sch,
 				    int *qerr)
 {
 	struct fq_pie_sched_data *q = qdisc_priv(sch);
+	struct tcf_result res = {0};
 	struct tcf_proto *filter;
-	struct tcf_result res;
 	int result;
 
 	if (TC_H_MAJ(skb->priority) == sch->handle &&
@@ -97,7 +97,6 @@ static unsigned int fq_pie_classify(struct sk_buff *skb, struct Qdisc *sch,
 	*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
 	result = tcf_classify(skb, NULL, filter, &res, false);
 	if (result >= 0) {
-#ifdef CONFIG_NET_CLS_ACT
 		switch (result) {
 		case TC_ACT_STOLEN:
 		case TC_ACT_QUEUED:
@@ -107,7 +106,6 @@ static unsigned int fq_pie_classify(struct sk_buff *skb, struct Qdisc *sch,
 		case TC_ACT_SHOT:
 			return 0;
 		}
-#endif
 		if (TC_H_MIN(res.classid) <= q->flows_cnt)
 			return TC_H_MIN(res.classid);
 	}
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 3554085bc2be..d32e85b6b1f0 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1122,7 +1122,7 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 {
 	struct hfsc_sched *q = qdisc_priv(sch);
 	struct hfsc_class *head, *cl;
-	struct tcf_result res;
+	struct tcf_result res = {0};
 	struct tcf_proto *tcf;
 	int result;
 
@@ -1135,7 +1135,6 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 	head = &q->root;
 	tcf = rcu_dereference_bh(q->root.filter_list);
 	while (tcf && (result = tcf_classify(skb, NULL, tcf, &res, false)) >= 0) {
-#ifdef CONFIG_NET_CLS_ACT
 		switch (result) {
 		case TC_ACT_QUEUED:
 		case TC_ACT_STOLEN:
@@ -1145,7 +1144,6 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 		case TC_ACT_SHOT:
 			return NULL;
 		}
-#endif
 		cl = (struct hfsc_class *)res.class;
 		if (!cl) {
 			cl = hfsc_find_class(res.classid, sch);
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 0d947414e616..e762d53bb469 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -220,8 +220,8 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
 				      int *qerr)
 {
 	struct htb_sched *q = qdisc_priv(sch);
+	struct tcf_result res = {0};
 	struct htb_class *cl;
-	struct tcf_result res;
 	struct tcf_proto *tcf;
 	int result;
 
@@ -243,7 +243,6 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
 
 	*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
 	while (tcf && (result = tcf_classify(skb, NULL, tcf, &res, false)) >= 0) {
-#ifdef CONFIG_NET_CLS_ACT
 		switch (result) {
 		case TC_ACT_QUEUED:
 		case TC_ACT_STOLEN:
@@ -253,7 +252,6 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
 		case TC_ACT_SHOT:
 			return NULL;
 		}
-#endif
 		cl = (void *)res.class;
 		if (!cl) {
 			if (res.classid == sch->handle)
@@ -631,13 +629,11 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 		} else {
 			return qdisc_drop(skb, sch, to_free);
 		}
-#ifdef CONFIG_NET_CLS_ACT
 	} else if (!cl) {
 		if (ret & __NET_XMIT_BYPASS)
 			qdisc_qstats_drop(sch);
 		__qdisc_drop(skb, to_free);
 		return ret;
-#endif
 	} else if ((ret = qdisc_enqueue(skb, cl->leaf.q,
 					to_free)) != NET_XMIT_SUCCESS) {
 		if (net_xmit_drop_count(ret)) {
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c
index 75c9c860182b..e6c4e64f18b3 100644
--- a/net/sched/sch_multiq.c
+++ b/net/sched/sch_multiq.c
@@ -30,14 +30,13 @@ static struct Qdisc *
 multiq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 {
 	struct multiq_sched_data *q = qdisc_priv(sch);
+	struct tcf_result res = {0};
 	u32 band;
-	struct tcf_result res;
 	struct tcf_proto *fl = rcu_dereference_bh(q->filter_list);
 	int err;
 
 	*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
 	err = tcf_classify(skb, NULL, fl, &res, false);
-#ifdef CONFIG_NET_CLS_ACT
 	switch (err) {
 	case TC_ACT_STOLEN:
 	case TC_ACT_QUEUED:
@@ -47,7 +46,6 @@ multiq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 	case TC_ACT_SHOT:
 		return NULL;
 	}
-#endif
 	band = skb_get_queue_mapping(skb);
 
 	if (band >= q->bands)
@@ -64,7 +62,6 @@ multiq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 	int ret;
 
 	qdisc = multiq_classify(skb, sch, &ret);
-#ifdef CONFIG_NET_CLS_ACT
 	if (qdisc == NULL) {
 
 		if (ret & __NET_XMIT_BYPASS)
@@ -72,7 +69,6 @@ multiq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 		__qdisc_drop(skb, to_free);
 		return ret;
 	}
-#endif
 
 	ret = qdisc_enqueue(skb, qdisc, to_free);
 	if (ret == NET_XMIT_SUCCESS) {
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index fdc5ef52c3ee..3b0fa2fc6926 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -31,8 +31,8 @@ static struct Qdisc *
 prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 {
 	struct prio_sched_data *q = qdisc_priv(sch);
+	struct tcf_result res = {0};
 	u32 band = skb->priority;
-	struct tcf_result res;
 	struct tcf_proto *fl;
 	int err;
 
@@ -40,7 +40,6 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 	if (TC_H_MAJ(skb->priority) != sch->handle) {
 		fl = rcu_dereference_bh(q->filter_list);
 		err = tcf_classify(skb, NULL, fl, &res, false);
-#ifdef CONFIG_NET_CLS_ACT
 		switch (err) {
 		case TC_ACT_STOLEN:
 		case TC_ACT_QUEUED:
@@ -50,7 +49,6 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 		case TC_ACT_SHOT:
 			return NULL;
 		}
-#endif
 		if (!fl || err < 0) {
 			if (TC_H_MAJ(band))
 				band = 0;
@@ -73,7 +71,6 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
 	int ret;
 
 	qdisc = prio_classify(skb, sch, &ret);
-#ifdef CONFIG_NET_CLS_ACT
 	if (qdisc == NULL) {
 
 		if (ret & __NET_XMIT_BYPASS)
@@ -81,7 +78,6 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
 		__qdisc_drop(skb, to_free);
 		return ret;
 	}
-#endif
 
 	ret = qdisc_enqueue(skb, qdisc, to_free);
 	if (ret == NET_XMIT_SUCCESS) {
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index 546c10adcacd..9be6c34aff7e 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -680,8 +680,8 @@ static struct qfq_class *qfq_classify(struct sk_buff *skb, struct Qdisc *sch,
 				      int *qerr)
 {
 	struct qfq_sched *q = qdisc_priv(sch);
+	struct tcf_result res = {0};
 	struct qfq_class *cl;
-	struct tcf_result res;
 	struct tcf_proto *fl;
 	int result;
 
@@ -696,7 +696,6 @@ static struct qfq_class *qfq_classify(struct sk_buff *skb, struct Qdisc *sch,
 	fl = rcu_dereference_bh(q->filter_list);
 	result = tcf_classify(skb, NULL, fl, &res, false);
 	if (result >= 0) {
-#ifdef CONFIG_NET_CLS_ACT
 		switch (result) {
 		case TC_ACT_QUEUED:
 		case TC_ACT_STOLEN:
@@ -706,7 +705,6 @@ static struct qfq_class *qfq_classify(struct sk_buff *skb, struct Qdisc *sch,
 		case TC_ACT_SHOT:
 			return NULL;
 		}
-#endif
 		cl = (struct qfq_class *)res.class;
 		if (cl == NULL)
 			cl = qfq_find_class(sch, res.classid);
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
index 1871a1c0224d..10684fcb5418 100644
--- a/net/sched/sch_sfb.c
+++ b/net/sched/sch_sfb.c
@@ -254,12 +254,11 @@ static bool sfb_rate_limit(struct sk_buff *skb, struct sfb_sched_data *q)
 static bool sfb_classify(struct sk_buff *skb, struct tcf_proto *fl,
 			 int *qerr, u32 *salt)
 {
-	struct tcf_result res;
+	struct tcf_result res = {0};
 	int result;
 
 	result = tcf_classify(skb, NULL, fl, &res, false);
 	if (result >= 0) {
-#ifdef CONFIG_NET_CLS_ACT
 		switch (result) {
 		case TC_ACT_STOLEN:
 		case TC_ACT_QUEUED:
@@ -269,7 +268,6 @@ static bool sfb_classify(struct sk_buff *skb, struct tcf_proto *fl,
 		case TC_ACT_SHOT:
 			return false;
 		}
-#endif
 		*salt = TC_H_MIN(res.classid);
 		return true;
 	}
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 66dcb18638fe..3fba247201ef 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -164,7 +164,7 @@ static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
 				 int *qerr)
 {
 	struct sfq_sched_data *q = qdisc_priv(sch);
-	struct tcf_result res;
+	struct tcf_result res = {0};
 	struct tcf_proto *fl;
 	int result;
 
@@ -180,7 +180,6 @@ static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
 	*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
 	result = tcf_classify(skb, NULL, fl, &res, false);
 	if (result >= 0) {
-#ifdef CONFIG_NET_CLS_ACT
 		switch (result) {
 		case TC_ACT_STOLEN:
 		case TC_ACT_QUEUED:
@@ -190,7 +189,6 @@ static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
 		case TC_ACT_SHOT:
 			return 0;
 		}
-#endif
 		if (TC_H_MIN(res.classid) <= q->divisor)
 			return TC_H_MIN(res.classid);
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
  2023-10-14 18:09 [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code Victor Nogueira
@ 2023-10-14 19:00 ` Florian Westphal
  2023-10-16 14:01 ` Davide Caratti
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Florian Westphal @ 2023-10-14 19:00 UTC (permalink / raw)
  To: Victor Nogueira
  Cc: jhs, daniel, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni,
	paulb, bpf, mleitner, martin.lau, dcaratti, netdev, kernel

Victor Nogueira <victor@mojatatu.com> wrote:
> +	FN(TC_ALLOC_SKB_EXT)		\

I think that SKB_DROP_REASON_NOMEM is fine for this, adding
a new drop reason for every type of object alloction failure
doesn't help.

The other ones are things that do point at tc specific config problems
so no objections there.

>  			ext = tc_skb_ext_alloc(skb);
> -			if (WARN_ON_ONCE(!ext))
> +			if (WARN_ON_ONCE(!ext)) {
> +				u32 drop_reason = SKB_TC_ALLOC_SKB_EXT;
> +
> +				tcf_set_drop_reason(res, drop_reason);

Unrelated to your patch, but I think this WARN_ON makes no sense.

There is nothing the user or a developer could do about that GFP_ATOMIC failure.

Also I see this patch gets rid of some, but not all, CONFIG_NET_CLS_ACT ifdefs.
The changelog should mention why.

Otherwise this LGTM.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
  2023-10-14 18:09 [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code Victor Nogueira
  2023-10-14 19:00 ` Florian Westphal
@ 2023-10-16 14:01 ` Davide Caratti
  2023-10-16 14:11   ` Jamal Hadi Salim
  2023-10-16 16:04 ` Jakub Kicinski
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Davide Caratti @ 2023-10-16 14:01 UTC (permalink / raw)
  To: Victor Nogueira
  Cc: jhs, daniel, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni,
	paulb, bpf, mleitner, martin.lau, netdev, kernel

hello Victor, thanks for the patch!

On Sat, Oct 14, 2023 at 03:09:21PM -0300, Victor Nogueira wrote:
> Currently there is no way to distinguish between an error and a
> classification verdict. Which has caused us a lot of pain with buggy qdiscs
> and syzkaller. This patch does 2 things - one is it disambiguates between
> an error and policy decisions. The reasons are added under the auspices of
> skb drop reason. We add the drop reason as a part of struct tcf_result.
> That way, tcf_classify can set a proper drop reason when it fails,
> and we keep the classification result as the tcf_classify's return value.
> 
> This patch also adds a variety of drop reasons which are more fine grained
> on why a packet was dropped by the TC classification action subsystem.
> 
> Co-developed-by: Daniel Borkmann <daniel@iogearbox.net>
> Signed-off-by: Victor Nogueira <victor@mojatatu.com>
> ---
> 
> v1 -> v2:
> - Make tcf_classify set drop reason instead of verdict in struct
>   tcf_result
> - Make tcf_classify return verdict (as it was doing before)
> - Only initialise struct tcf_result in tc_run
> - Add new drop reasons specific to TC
> - Merged v1 patch with Daniel's patch (https://lore.kernel.org/bpf/20231013141722.21165ef3@kernel.org/T/)
>   for completeness

Acked-by: Davide Caratti <dcaratti@redhat.com>

By the way, this might be a chance to remove the "TC mirred to Houston"
printout and replace it with a proper drop reason (see [1]). WDYT?

thanks,
-- 
davide

[1] https://lore.kernel.org/netdev/Yt2CIl7iCoahCPoU@pop-os.localdomain/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
  2023-10-16 14:01 ` Davide Caratti
@ 2023-10-16 14:11   ` Jamal Hadi Salim
  0 siblings, 0 replies; 8+ messages in thread
From: Jamal Hadi Salim @ 2023-10-16 14:11 UTC (permalink / raw)
  To: Davide Caratti
  Cc: Victor Nogueira, daniel, xiyou.wangcong, jiri, davem, edumazet,
	kuba, pabeni, paulb, bpf, mleitner, martin.lau, netdev, kernel

On Mon, Oct 16, 2023 at 10:01 AM Davide Caratti <dcaratti@redhat.com> wrote:
>
> hello Victor, thanks for the patch!
>
> On Sat, Oct 14, 2023 at 03:09:21PM -0300, Victor Nogueira wrote:
> > Currently there is no way to distinguish between an error and a
> > classification verdict. Which has caused us a lot of pain with buggy qdiscs
> > and syzkaller. This patch does 2 things - one is it disambiguates between
> > an error and policy decisions. The reasons are added under the auspices of
> > skb drop reason. We add the drop reason as a part of struct tcf_result.
> > That way, tcf_classify can set a proper drop reason when it fails,
> > and we keep the classification result as the tcf_classify's return value.
> >
> > This patch also adds a variety of drop reasons which are more fine grained
> > on why a packet was dropped by the TC classification action subsystem.
> >
> > Co-developed-by: Daniel Borkmann <daniel@iogearbox.net>
> > Signed-off-by: Victor Nogueira <victor@mojatatu.com>
> > ---
> >
> > v1 -> v2:
> > - Make tcf_classify set drop reason instead of verdict in struct
> >   tcf_result
> > - Make tcf_classify return verdict (as it was doing before)
> > - Only initialise struct tcf_result in tc_run
> > - Add new drop reasons specific to TC
> > - Merged v1 patch with Daniel's patch (https://lore.kernel.org/bpf/20231013141722.21165ef3@kernel.org/T/)
> >   for completeness
>
> Acked-by: Davide Caratti <dcaratti@redhat.com>
>
> By the way, this might be a chance to remove the "TC mirred to Houston"
> printout and replace it with a proper drop reason (see [1]). WDYT?

sigh. So much history there. I recommend
SKB_DROP_REASON_TC_MIRRED_TO_HOUSTON
/me runs

cheers,
jamal
> thanks,
> --
> davide
>
> [1] https://lore.kernel.org/netdev/Yt2CIl7iCoahCPoU@pop-os.localdomain/
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
  2023-10-14 18:09 [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code Victor Nogueira
  2023-10-14 19:00 ` Florian Westphal
  2023-10-16 14:01 ` Davide Caratti
@ 2023-10-16 16:04 ` Jakub Kicinski
  2023-10-17 13:02 ` kernel test robot
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2023-10-16 16:04 UTC (permalink / raw)
  To: Victor Nogueira
  Cc: jhs, daniel, xiyou.wangcong, jiri, davem, edumazet, pabeni, paulb,
	bpf, mleitner, martin.lau, dcaratti, netdev, kernel

On Sat, 14 Oct 2023 15:09:21 -0300 Victor Nogueira wrote:
> Currently there is no way to distinguish between an error and a
> classification verdict. Which has caused us a lot of pain with buggy qdiscs
> and syzkaller. This patch does 2 things - one is it disambiguates between
> an error and policy decisions. The reasons are added under the auspices of
> skb drop reason. We add the drop reason as a part of struct tcf_result.
> That way, tcf_classify can set a proper drop reason when it fails,
> and we keep the classification result as the tcf_classify's return value.
> 
> This patch also adds a variety of drop reasons which are more fine grained
> on why a packet was dropped by the TC classification action subsystem.

Looks like this mostly builds on top of Daniel's patches with some
not-described additions like zeroing out res and cleaning up ifdefs.
Let me apply Daniel's patches and you can refine the return codes
on top.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
  2023-10-14 18:09 [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code Victor Nogueira
                   ` (2 preceding siblings ...)
  2023-10-16 16:04 ` Jakub Kicinski
@ 2023-10-17 13:02 ` kernel test robot
  2023-10-21 22:51 ` kernel test robot
  2023-10-23 14:16 ` kernel test robot
  5 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2023-10-17 13:02 UTC (permalink / raw)
  To: Victor Nogueira; +Cc: oe-kbuild-all

Hi Victor,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:

[auto build test WARNING on net/main]
[also build test WARNING on linus/master v6.6-rc6]
[cannot apply to net-next/main next-20231017]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Victor-Nogueira/net-sched-Disambiguate-verdict-from-return-code/20231017-134937
base:   net/main
patch link:    https://lore.kernel.org/r/20231014180921.833820-1-victor%40mojatatu.com
patch subject: [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231017/202310172017.0AiVu6E9-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231017/202310172017.0AiVu6E9-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310172017.0AiVu6E9-lkp@intel.com/

All warnings (new ones prefixed by >>):

   net/sched/cls_api.c: In function 'tcf_classify':
   net/sched/cls_api.c:1776:59: error: 'SKB_TC_EXT_COOKIE_NOTFOUND' undeclared (first use in this function); did you mean 'SKB_DROP_REASON_TC_EXT_COOKIE_NOTFOUND'?
    1776 |                                         u32 drop_reason = SKB_TC_EXT_COOKIE_NOTFOUND;
         |                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                           SKB_DROP_REASON_TC_EXT_COOKIE_NOTFOUND
   net/sched/cls_api.c:1776:59: note: each undeclared identifier is reported only once for each function it appears in
   net/sched/cls_api.c:1813:51: error: 'SKB_TC_ALLOC_SKB_EXT' undeclared (first use in this function)
    1813 |                                 u32 drop_reason = SKB_TC_ALLOC_SKB_EXT;
         |                                                   ^~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:1837:26: error: invalid storage class for function 'tcf_chain_tp_prev'
    1837 | static struct tcf_proto *tcf_chain_tp_prev(struct tcf_chain *chain,
         |                          ^~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:1843:12: error: invalid storage class for function 'tcf_chain_tp_insert'
    1843 | static int tcf_chain_tp_insert(struct tcf_chain *chain,
         |            ^~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:1859:13: error: invalid storage class for function 'tcf_chain_tp_remove'
    1859 | static void tcf_chain_tp_remove(struct tcf_chain *chain,
         |             ^~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:1871:26: error: invalid storage class for function 'tcf_chain_tp_find'
    1871 | static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
         |                          ^~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:1881:26: error: invalid storage class for function 'tcf_chain_tp_insert_unique'
    1881 | static struct tcf_proto *tcf_chain_tp_insert_unique(struct tcf_chain *chain,
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c: In function 'tcf_chain_tp_insert_unique':
   net/sched/cls_api.c:1898:14: error: implicit declaration of function 'tcf_chain_tp_find'; did you mean 'tcf_chain_tp_prev'? [-Werror=implicit-function-declaration]
    1898 |         tp = tcf_chain_tp_find(chain, &chain_info,
         |              ^~~~~~~~~~~~~~~~~
         |              tcf_chain_tp_prev
>> net/sched/cls_api.c:1898:12: warning: assignment to 'struct tcf_proto *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    1898 |         tp = tcf_chain_tp_find(chain, &chain_info,
         |            ^
   net/sched/cls_api.c: In function 'tcf_classify':
   net/sched/cls_api.c:1915:13: error: invalid storage class for function 'tcf_chain_tp_delete_empty'
    1915 | static void tcf_chain_tp_delete_empty(struct tcf_chain *chain,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:1956:26: error: invalid storage class for function 'tcf_chain_tp_find'
    1956 | static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
         |                          ^~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:1989:12: error: invalid storage class for function 'tcf_fill_node'
    1989 | static int tcf_fill_node(struct net *net, struct sk_buff *skb,
         |            ^~~~~~~~~~~~~
   net/sched/cls_api.c:2050:12: error: invalid storage class for function 'tfilter_notify'
    2050 | static int tfilter_notify(struct net *net, struct sk_buff *oskb,
         |            ^~~~~~~~~~~~~~
   net/sched/cls_api.c:2079:12: error: invalid storage class for function 'tfilter_del_notify'
    2079 | static int tfilter_del_notify(struct net *net, struct sk_buff *oskb,
         |            ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:2118:13: error: invalid storage class for function 'tfilter_notify_chain'
    2118 | static void tfilter_notify_chain(struct net *net, struct sk_buff *oskb,
         |             ^~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:2132:13: error: invalid storage class for function 'tfilter_put'
    2132 | static void tfilter_put(struct tcf_proto *tp, void *fh)
         |             ^~~~~~~~~~~
   net/sched/cls_api.c:2138:13: error: invalid storage class for function 'is_qdisc_ingress'
    2138 | static bool is_qdisc_ingress(__u32 classid)
         |             ^~~~~~~~~~~~~~~~
   net/sched/cls_api.c:2143:12: error: invalid storage class for function 'tc_new_tfilter'
    2143 | static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
         |            ^~~~~~~~~~~~~~
   net/sched/cls_api.c:2377:12: error: invalid storage class for function 'tc_del_tfilter'
    2377 | static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
         |            ^~~~~~~~~~~~~~
   net/sched/cls_api.c:2534:12: error: invalid storage class for function 'tc_get_tfilter'
    2534 | static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
         |            ^~~~~~~~~~~~~~
   net/sched/cls_api.c:2666:12: error: invalid storage class for function 'tcf_node_dump'
    2666 | static int tcf_node_dump(struct tcf_proto *tp, void *n, struct tcf_walker *arg)
         |            ^~~~~~~~~~~~~
   net/sched/cls_api.c:2677:13: error: invalid storage class for function 'tcf_chain_dump'
    2677 | static bool tcf_chain_dump(struct tcf_chain *chain, struct Qdisc *q, u32 parent,
         |             ^~~~~~~~~~~~~~
   net/sched/cls_api.c:2743:12: error: invalid storage class for function 'tc_dump_tfilter'
    2743 | static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
         |            ^~~~~~~~~~~~~~~
   net/sched/cls_api.c:2847:12: error: invalid storage class for function 'tc_chain_fill_node'
    2847 | static int tc_chain_fill_node(const struct tcf_proto_ops *tmplt_ops,
         |            ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:2903:12: error: invalid storage class for function 'tc_chain_notify'
    2903 | static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,
         |            ^~~~~~~~~~~~~~~
   net/sched/cls_api.c:2933:12: error: invalid storage class for function 'tc_chain_notify_delete'
    2933 | static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,
         |            ^~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:2958:12: error: invalid storage class for function 'tc_chain_tmplt_add'
    2958 | static int tc_chain_tmplt_add(struct tcf_chain *chain, struct net *net,
         |            ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:2994:13: error: invalid storage class for function 'tc_chain_tmplt_del'
    2994 | static void tc_chain_tmplt_del(const struct tcf_proto_ops *tmplt_ops,
         |             ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3007:12: error: invalid storage class for function 'tc_ctl_chain'
    3007 | static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n,
         |            ^~~~~~~~~~~~
   net/sched/cls_api.c:3139:12: error: invalid storage class for function 'tc_dump_chain'
    3139 | static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb)
         |            ^~~~~~~~~~~~~
   In file included from include/linux/linkage.h:7,
                    from include/linux/preempt.h:10,
                    from arch/m68k/include/asm/irqflags.h:6,
                    from include/linux/irqflags.h:17,
                    from arch/m68k/include/asm/atomic.h:6,
                    from include/linux/atomic.h:7,
                    from include/linux/mm_types_task.h:13,
                    from include/linux/mm_types.h:5,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from net/sched/cls_api.c:12:
   net/sched/cls_api.c:3271:15: error: non-static declaration of 'tcf_exts_init_ex' follows static declaration
    3271 | EXPORT_SYMBOL(tcf_exts_init_ex);
         |               ^~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3271:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3271 | EXPORT_SYMBOL(tcf_exts_init_ex);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3232:5: note: previous definition of 'tcf_exts_init_ex' with type 'int(struct tcf_exts *, struct net *, int,  int,  struct tcf_proto *, u32,  bool)' {aka 'int(struct tcf_exts *, struct net *, int,  int,  struct tcf_proto *, unsigned int,  _Bool)'}
    3232 | int tcf_exts_init_ex(struct tcf_exts *exts, struct net *net, int action,
         |     ^~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3285:15: error: non-static declaration of 'tcf_exts_destroy' follows static declaration
    3285 | EXPORT_SYMBOL(tcf_exts_destroy);
         |               ^~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
--
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3896:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3896 | EXPORT_SYMBOL(tcf_qevent_destroy);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3891:6: note: previous definition of 'tcf_qevent_destroy' with type 'void(struct tcf_qevent *, struct Qdisc *)'
    3891 | void tcf_qevent_destroy(struct tcf_qevent *qe, struct Qdisc *sch)
         |      ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3919:15: error: non-static declaration of 'tcf_qevent_validate_change' follows static declaration
    3919 | EXPORT_SYMBOL(tcf_qevent_validate_change);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3919:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3919 | EXPORT_SYMBOL(tcf_qevent_validate_change);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3898:5: note: previous definition of 'tcf_qevent_validate_change' with type 'int(struct tcf_qevent *, struct nlattr *, struct netlink_ext_ack *)'
    3898 | int tcf_qevent_validate_change(struct tcf_qevent *qe, struct nlattr *block_index_attr,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3952:15: error: non-static declaration of 'tcf_qevent_handle' follows static declaration
    3952 | EXPORT_SYMBOL(tcf_qevent_handle);
         |               ^~~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3952:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3952 | EXPORT_SYMBOL(tcf_qevent_handle);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3921:17: note: previous definition of 'tcf_qevent_handle' with type 'struct sk_buff *(struct tcf_qevent *, struct Qdisc *, struct sk_buff *, struct sk_buff **, int *)'
    3921 | struct sk_buff *tcf_qevent_handle(struct tcf_qevent *qe, struct Qdisc *sch, struct sk_buff *skb,
         |                 ^~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3960:15: error: non-static declaration of 'tcf_qevent_dump' follows static declaration
    3960 | EXPORT_SYMBOL(tcf_qevent_dump);
         |               ^~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3960:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3960 | EXPORT_SYMBOL(tcf_qevent_dump);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3954:5: note: previous definition of 'tcf_qevent_dump' with type 'int(struct sk_buff *, int,  struct tcf_qevent *)'
    3954 | int tcf_qevent_dump(struct sk_buff *skb, int attr_name, struct tcf_qevent *qe)
         |     ^~~~~~~~~~~~~~~
   net/sched/cls_api.c:3963:23: error: invalid storage class for function 'tcf_net_init'
    3963 | static __net_init int tcf_net_init(struct net *net)
         |                       ^~~~~~~~~~~~
   net/sched/cls_api.c:3972:24: error: invalid storage class for function 'tcf_net_exit'
    3972 | static void __net_exit tcf_net_exit(struct net *net)
         |                        ^~~~~~~~~~~~
   net/sched/cls_api.c:3980:17: error: initializer element is not constant
    3980 |         .init = tcf_net_init,
         |                 ^~~~~~~~~~~~
   net/sched/cls_api.c:3980:17: note: (near initialization for 'tcf_net_ops.init')
   net/sched/cls_api.c:3981:17: error: initializer element is not constant
    3981 |         .exit = tcf_net_exit,
         |                 ^~~~~~~~~~~~
   net/sched/cls_api.c:3981:17: note: (near initialization for 'tcf_net_ops.exit')
   net/sched/cls_api.c:3986:19: error: invalid storage class for function 'tc_filter_init'
    3986 | static int __init tc_filter_init(void)
         |                   ^~~~~~~~~~~~~~
   In file included from include/linux/printk.h:6,
                    from include/asm-generic/bug.h:22,
                    from arch/m68k/include/asm/bug.h:32,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:13,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/m68k/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:79:
   net/sched/cls_api.c:4018:17: error: initializer element is not constant
    4018 | subsys_initcall(tc_filter_init);
         |                 ^~~~~~~~~~~~~~
   include/linux/init.h:270:55: note: in definition of macro '____define_initcall'
     270 |                 __attribute__((__section__(__sec))) = fn;
         |                                                       ^~
   include/linux/init.h:280:9: note: in expansion of macro '__unique_initcall'
     280 |         __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |         ^~~~~~~~~~~~~~~~~
   include/linux/init.h:282:35: note: in expansion of macro '___define_initcall'
     282 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                   ^~~~~~~~~~~~~~~~~~
   include/linux/init.h:306:41: note: in expansion of macro '__define_initcall'
     306 | #define subsys_initcall(fn)             __define_initcall(fn, 4)
         |                                         ^~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:4018:1: note: in expansion of macro 'subsys_initcall'
    4018 | subsys_initcall(tc_filter_init);
         | ^~~~~~~~~~~~~~~
   net/sched/cls_api.c:4018:1: error: expected declaration or statement at end of input
   net/sched/cls_api.c: At top level:
>> net/sched/cls_api.c:592:12: warning: 'tc_chain_notify' used but never defined
     592 | static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,
         |            ^~~~~~~~~~~~~~~
>> net/sched/cls_api.c:648:13: warning: 'tc_chain_tmplt_del' used but never defined
     648 | static void tc_chain_tmplt_del(const struct tcf_proto_ops *tmplt_ops,
         |             ^~~~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:650:12: warning: 'tc_chain_notify_delete' used but never defined
     650 | static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,
         |            ^~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c: In function 'tcf_classify':
   net/sched/cls_api.c:4019: error: control reaches end of non-void function [-Werror=return-type]
   net/sched/cls_api.c: At top level:
>> net/sched/cls_api.c:2994:13: warning: 'tc_chain_tmplt_del' defined but not used [-Wunused-function]
    2994 | static void tc_chain_tmplt_del(const struct tcf_proto_ops *tmplt_ops,
         |             ^~~~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:2933:12: warning: 'tc_chain_notify_delete' defined but not used [-Wunused-function]
    2933 | static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,
         |            ^~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +1898 net/sched/cls_api.c

2190d1d0944f84 Jiri Pirko  2017-05-17  1870  
8b64678e0af8f4 Vlad Buslov 2019-02-11  1871  static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
8b64678e0af8f4 Vlad Buslov 2019-02-11  1872  					   struct tcf_chain_info *chain_info,
8b64678e0af8f4 Vlad Buslov 2019-02-11  1873  					   u32 protocol, u32 prio,
8b64678e0af8f4 Vlad Buslov 2019-02-11  1874  					   bool prio_allocate);
8b64678e0af8f4 Vlad Buslov 2019-02-11  1875  
8b64678e0af8f4 Vlad Buslov 2019-02-11  1876  /* Try to insert new proto.
8b64678e0af8f4 Vlad Buslov 2019-02-11  1877   * If proto with specified priority already exists, free new proto
8b64678e0af8f4 Vlad Buslov 2019-02-11  1878   * and return existing one.
8b64678e0af8f4 Vlad Buslov 2019-02-11  1879   */
8b64678e0af8f4 Vlad Buslov 2019-02-11  1880  
8b64678e0af8f4 Vlad Buslov 2019-02-11  1881  static struct tcf_proto *tcf_chain_tp_insert_unique(struct tcf_chain *chain,
8b64678e0af8f4 Vlad Buslov 2019-02-11  1882  						    struct tcf_proto *tp_new,
12db03b65c2b90 Vlad Buslov 2019-02-11  1883  						    u32 protocol, u32 prio,
12db03b65c2b90 Vlad Buslov 2019-02-11  1884  						    bool rtnl_held)
8b64678e0af8f4 Vlad Buslov 2019-02-11  1885  {
8b64678e0af8f4 Vlad Buslov 2019-02-11  1886  	struct tcf_chain_info chain_info;
8b64678e0af8f4 Vlad Buslov 2019-02-11  1887  	struct tcf_proto *tp;
726d061286ceee Vlad Buslov 2019-02-11  1888  	int err = 0;
8b64678e0af8f4 Vlad Buslov 2019-02-11  1889  
8b64678e0af8f4 Vlad Buslov 2019-02-11  1890  	mutex_lock(&chain->filter_chain_lock);
8b64678e0af8f4 Vlad Buslov 2019-02-11  1891  
59eb87cb52c9f7 John Hurley 2019-11-02  1892  	if (tcf_proto_exists_destroying(chain, tp_new)) {
59eb87cb52c9f7 John Hurley 2019-11-02  1893  		mutex_unlock(&chain->filter_chain_lock);
59eb87cb52c9f7 John Hurley 2019-11-02  1894  		tcf_proto_destroy(tp_new, rtnl_held, false, NULL);
59eb87cb52c9f7 John Hurley 2019-11-02  1895  		return ERR_PTR(-EAGAIN);
59eb87cb52c9f7 John Hurley 2019-11-02  1896  	}
59eb87cb52c9f7 John Hurley 2019-11-02  1897  
8b64678e0af8f4 Vlad Buslov 2019-02-11 @1898  	tp = tcf_chain_tp_find(chain, &chain_info,
8b64678e0af8f4 Vlad Buslov 2019-02-11  1899  			       protocol, prio, false);
8b64678e0af8f4 Vlad Buslov 2019-02-11  1900  	if (!tp)
726d061286ceee Vlad Buslov 2019-02-11  1901  		err = tcf_chain_tp_insert(chain, &chain_info, tp_new);
8b64678e0af8f4 Vlad Buslov 2019-02-11  1902  	mutex_unlock(&chain->filter_chain_lock);
8b64678e0af8f4 Vlad Buslov 2019-02-11  1903  
8b64678e0af8f4 Vlad Buslov 2019-02-11  1904  	if (tp) {
59eb87cb52c9f7 John Hurley 2019-11-02  1905  		tcf_proto_destroy(tp_new, rtnl_held, false, NULL);
8b64678e0af8f4 Vlad Buslov 2019-02-11  1906  		tp_new = tp;
726d061286ceee Vlad Buslov 2019-02-11  1907  	} else if (err) {
59eb87cb52c9f7 John Hurley 2019-11-02  1908  		tcf_proto_destroy(tp_new, rtnl_held, false, NULL);
726d061286ceee Vlad Buslov 2019-02-11  1909  		tp_new = ERR_PTR(err);
8b64678e0af8f4 Vlad Buslov 2019-02-11  1910  	}
8b64678e0af8f4 Vlad Buslov 2019-02-11  1911  
8b64678e0af8f4 Vlad Buslov 2019-02-11  1912  	return tp_new;
8b64678e0af8f4 Vlad Buslov 2019-02-11  1913  }
8b64678e0af8f4 Vlad Buslov 2019-02-11  1914  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
  2023-10-14 18:09 [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code Victor Nogueira
                   ` (3 preceding siblings ...)
  2023-10-17 13:02 ` kernel test robot
@ 2023-10-21 22:51 ` kernel test robot
  2023-10-23 14:16 ` kernel test robot
  5 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2023-10-21 22:51 UTC (permalink / raw)
  To: Victor Nogueira; +Cc: oe-kbuild-all

Hi Victor,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build errors:

[auto build test ERROR on net/main]
[also build test ERROR on linus/master v6.6-rc6]
[cannot apply to net-next/main next-20231020]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Victor-Nogueira/net-sched-Disambiguate-verdict-from-return-code/20231017-134937
base:   net/main
patch link:    https://lore.kernel.org/r/20231014180921.833820-1-victor%40mojatatu.com
patch subject: [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
config: s390-debug_defconfig (https://download.01.org/0day-ci/archive/20231022/202310220628.lUcXGGLq-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231022/202310220628.lUcXGGLq-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310220628.lUcXGGLq-lkp@intel.com/

All errors (new ones prefixed by >>):

   net/sched/cls_api.c: In function 'tcf_classify':
>> net/sched/cls_api.c:1776:59: error: 'SKB_TC_EXT_COOKIE_NOTFOUND' undeclared (first use in this function); did you mean 'SKB_DROP_REASON_TC_EXT_COOKIE_NOTFOUND'?
    1776 |                                         u32 drop_reason = SKB_TC_EXT_COOKIE_NOTFOUND;
         |                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                           SKB_DROP_REASON_TC_EXT_COOKIE_NOTFOUND
   net/sched/cls_api.c:1776:59: note: each undeclared identifier is reported only once for each function it appears in
>> net/sched/cls_api.c:1813:51: error: 'SKB_TC_ALLOC_SKB_EXT' undeclared (first use in this function)
    1813 |                                 u32 drop_reason = SKB_TC_ALLOC_SKB_EXT;
         |                                                   ^~~~~~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:1837:26: error: invalid storage class for function 'tcf_chain_tp_prev'
    1837 | static struct tcf_proto *tcf_chain_tp_prev(struct tcf_chain *chain,
         |                          ^~~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:1843:12: error: invalid storage class for function 'tcf_chain_tp_insert'
    1843 | static int tcf_chain_tp_insert(struct tcf_chain *chain,
         |            ^~~~~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:1859:13: error: invalid storage class for function 'tcf_chain_tp_remove'
    1859 | static void tcf_chain_tp_remove(struct tcf_chain *chain,
         |             ^~~~~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:1871:26: error: invalid storage class for function 'tcf_chain_tp_find'
    1871 | static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
         |                          ^~~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:1881:26: error: invalid storage class for function 'tcf_chain_tp_insert_unique'
    1881 | static struct tcf_proto *tcf_chain_tp_insert_unique(struct tcf_chain *chain,
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c: In function 'tcf_chain_tp_insert_unique':
>> net/sched/cls_api.c:1898:14: error: implicit declaration of function 'tcf_chain_tp_find'; did you mean 'tcf_chain_tp_prev'? [-Werror=implicit-function-declaration]
    1898 |         tp = tcf_chain_tp_find(chain, &chain_info,
         |              ^~~~~~~~~~~~~~~~~
         |              tcf_chain_tp_prev
   net/sched/cls_api.c:1898:12: warning: assignment to 'struct tcf_proto *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    1898 |         tp = tcf_chain_tp_find(chain, &chain_info,
         |            ^
   net/sched/cls_api.c: In function 'tcf_classify':
>> net/sched/cls_api.c:1915:13: error: invalid storage class for function 'tcf_chain_tp_delete_empty'
    1915 | static void tcf_chain_tp_delete_empty(struct tcf_chain *chain,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:1956:26: error: invalid storage class for function 'tcf_chain_tp_find'
    1956 | static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
         |                          ^~~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:1989:12: error: invalid storage class for function 'tcf_fill_node'
    1989 | static int tcf_fill_node(struct net *net, struct sk_buff *skb,
         |            ^~~~~~~~~~~~~
>> net/sched/cls_api.c:2050:12: error: invalid storage class for function 'tfilter_notify'
    2050 | static int tfilter_notify(struct net *net, struct sk_buff *oskb,
         |            ^~~~~~~~~~~~~~
>> net/sched/cls_api.c:2079:12: error: invalid storage class for function 'tfilter_del_notify'
    2079 | static int tfilter_del_notify(struct net *net, struct sk_buff *oskb,
         |            ^~~~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:2118:13: error: invalid storage class for function 'tfilter_notify_chain'
    2118 | static void tfilter_notify_chain(struct net *net, struct sk_buff *oskb,
         |             ^~~~~~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:2132:13: error: invalid storage class for function 'tfilter_put'
    2132 | static void tfilter_put(struct tcf_proto *tp, void *fh)
         |             ^~~~~~~~~~~
>> net/sched/cls_api.c:2138:13: error: invalid storage class for function 'is_qdisc_ingress'
    2138 | static bool is_qdisc_ingress(__u32 classid)
         |             ^~~~~~~~~~~~~~~~
>> net/sched/cls_api.c:2143:12: error: invalid storage class for function 'tc_new_tfilter'
    2143 | static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
         |            ^~~~~~~~~~~~~~
>> net/sched/cls_api.c:2377:12: error: invalid storage class for function 'tc_del_tfilter'
    2377 | static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
         |            ^~~~~~~~~~~~~~
>> net/sched/cls_api.c:2534:12: error: invalid storage class for function 'tc_get_tfilter'
    2534 | static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
         |            ^~~~~~~~~~~~~~
>> net/sched/cls_api.c:2666:12: error: invalid storage class for function 'tcf_node_dump'
    2666 | static int tcf_node_dump(struct tcf_proto *tp, void *n, struct tcf_walker *arg)
         |            ^~~~~~~~~~~~~
>> net/sched/cls_api.c:2677:13: error: invalid storage class for function 'tcf_chain_dump'
    2677 | static bool tcf_chain_dump(struct tcf_chain *chain, struct Qdisc *q, u32 parent,
         |             ^~~~~~~~~~~~~~
   net/sched/cls_api.c:2743:12: error: invalid storage class for function 'tc_dump_tfilter'
    2743 | static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
         |            ^~~~~~~~~~~~~~~
   net/sched/cls_api.c:2847:12: error: invalid storage class for function 'tc_chain_fill_node'
    2847 | static int tc_chain_fill_node(const struct tcf_proto_ops *tmplt_ops,
         |            ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:2903:12: error: invalid storage class for function 'tc_chain_notify'
    2903 | static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,
         |            ^~~~~~~~~~~~~~~
   net/sched/cls_api.c:2933:12: error: invalid storage class for function 'tc_chain_notify_delete'
    2933 | static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,
         |            ^~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:2958:12: error: invalid storage class for function 'tc_chain_tmplt_add'
    2958 | static int tc_chain_tmplt_add(struct tcf_chain *chain, struct net *net,
         |            ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:2994:13: error: invalid storage class for function 'tc_chain_tmplt_del'
    2994 | static void tc_chain_tmplt_del(const struct tcf_proto_ops *tmplt_ops,
         |             ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3007:12: error: invalid storage class for function 'tc_ctl_chain'
    3007 | static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n,
         |            ^~~~~~~~~~~~
   net/sched/cls_api.c:3139:12: error: invalid storage class for function 'tc_dump_chain'
    3139 | static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb)
         |            ^~~~~~~~~~~~~
   In file included from include/linux/linkage.h:7,
                    from include/linux/preempt.h:10,
                    from arch/s390/include/asm/timex.h:13,
                    from include/linux/timex.h:67,
                    from include/linux/time32.h:13,
                    from include/linux/time.h:60,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from net/sched/cls_api.c:12:
   net/sched/cls_api.c:3271:15: error: non-static declaration of 'tcf_exts_init_ex' follows static declaration
    3271 | EXPORT_SYMBOL(tcf_exts_init_ex);
         |               ^~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3271:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3271 | EXPORT_SYMBOL(tcf_exts_init_ex);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3232:5: note: previous definition of 'tcf_exts_init_ex' with type 'int(struct tcf_exts *, struct net *, int,  int,  struct tcf_proto *, u32,  bool)' {aka 'int(struct tcf_exts *, struct net *, int,  int,  struct tcf_proto *, unsigned int,  _Bool)'}
    3232 | int tcf_exts_init_ex(struct tcf_exts *exts, struct net *net, int action,
         |     ^~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3285:15: error: non-static declaration of 'tcf_exts_destroy' follows static declaration
    3285 | EXPORT_SYMBOL(tcf_exts_destroy);
         |               ^~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3285:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3285 | EXPORT_SYMBOL(tcf_exts_destroy);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3273:6: note: previous definition of 'tcf_exts_destroy' with type 'void(struct tcf_exts *)'
    3273 | void tcf_exts_destroy(struct tcf_exts *exts)
         |      ^~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3340:15: error: non-static declaration of 'tcf_exts_validate_ex' follows static declaration
    3340 | EXPORT_SYMBOL(tcf_exts_validate_ex);
         |               ^~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3340:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3340 | EXPORT_SYMBOL(tcf_exts_validate_ex);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3287:5: note: previous definition of 'tcf_exts_validate_ex' with type 'int(struct net *, struct tcf_proto *, struct nlattr **, struct nlattr *, struct tcf_exts *, u32,  u32,  struct netlink_ext_ack *)' {aka 'int(struct net *, struct tcf_proto *, struct nlattr **, struct nlattr *, struct tcf_exts *, unsigned int,  unsigned int,  struct netlink_ext_ack *)'}
    3287 | int tcf_exts_validate_ex(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
         |     ^~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3349:15: error: non-static declaration of 'tcf_exts_validate' follows static declaration
    3349 | EXPORT_SYMBOL(tcf_exts_validate);
         |               ^~~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3349:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3349 | EXPORT_SYMBOL(tcf_exts_validate);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3342:5: note: previous definition of 'tcf_exts_validate' with type 'int(struct net *, struct tcf_proto *, struct nlattr **, struct nlattr *, struct tcf_exts *, u32,  struct netlink_ext_ack *)' {aka 'int(struct net *, struct tcf_proto *, struct nlattr **, struct nlattr *, struct tcf_exts *, unsigned int,  struct netlink_ext_ack *)'}
    3342 | int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb,
         |     ^~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3360:15: error: non-static declaration of 'tcf_exts_change' follows static declaration
    3360 | EXPORT_SYMBOL(tcf_exts_change);
         |               ^~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \


vim +1776 net/sched/cls_api.c

  1746	
  1747	int tcf_classify(struct sk_buff *skb,
  1748			 const struct tcf_block *block,
  1749			 const struct tcf_proto *tp,
  1750			 struct tcf_result *res, bool compat_mode)
  1751	{
  1752	#if !IS_ENABLED(CONFIG_NET_TC_SKB_EXT)
  1753		u32 last_executed_chain = 0;
  1754	
  1755		return __tcf_classify(skb, tp, tp, res, compat_mode, NULL, 0,
  1756				      &last_executed_chain);
  1757	#else
  1758		u32 last_executed_chain = tp ? tp->chain->index : 0;
  1759		struct tcf_exts_miss_cookie_node *n = NULL;
  1760		const struct tcf_proto *orig_tp = tp;
  1761		struct tc_skb_ext *ext;
  1762		int act_index = 0;
  1763		int ret;
  1764	
  1765		if (block) {
  1766			ext = skb_ext_find(skb, TC_SKB_EXT);
  1767	
  1768			if (ext && (ext->chain || ext->act_miss)) {
  1769				struct tcf_chain *fchain;
  1770				u32 chain;
  1771	
  1772				if (ext->act_miss) {
  1773					n = tcf_exts_miss_cookie_lookup(ext->act_miss_cookie,
  1774									&act_index);
  1775					if (!n) {
> 1776						u32 drop_reason = SKB_TC_EXT_COOKIE_NOTFOUND;
  1777	
  1778						tcf_set_drop_reason(res, drop_reason);
  1779						return TC_ACT_SHOT;
  1780	
  1781					chain = n->chain_index;
  1782				} else {
  1783					chain = ext->chain;
  1784				}
  1785	
  1786				fchain = tcf_chain_lookup_rcu(block, chain);
  1787				if (!fchain) {
  1788					u32 drop_reason = SKB_DROP_REASON_TC_CHAIN_NOTFOUND;
  1789	
  1790					tcf_set_drop_reason(res, drop_reason);
  1791	
  1792					return TC_ACT_SHOT;
  1793				}
  1794	
  1795				/* Consume, so cloned/redirect skbs won't inherit ext */
  1796				skb_ext_del(skb, TC_SKB_EXT);
  1797	
  1798				tp = rcu_dereference_bh(fchain->filter_chain);
  1799				last_executed_chain = fchain->index;
  1800			}
  1801		}
  1802	
  1803		ret = __tcf_classify(skb, tp, orig_tp, res, compat_mode, n, act_index,
  1804				     &last_executed_chain);
  1805	
  1806		if (tc_skb_ext_tc_enabled()) {
  1807			/* If we missed on some chain */
  1808			if (ret == TC_ACT_UNSPEC && last_executed_chain) {
  1809				struct tc_skb_cb *cb = tc_skb_cb(skb);
  1810	
  1811				ext = tc_skb_ext_alloc(skb);
  1812				if (WARN_ON_ONCE(!ext)) {
> 1813					u32 drop_reason = SKB_TC_ALLOC_SKB_EXT;
  1814	
  1815					tcf_set_drop_reason(res, drop_reason);
  1816					return TC_ACT_SHOT;
  1817				}
  1818				ext->chain = last_executed_chain;
  1819				ext->mru = cb->mru;
  1820				ext->post_ct = cb->post_ct;
  1821				ext->post_ct_snat = cb->post_ct_snat;
  1822				ext->post_ct_dnat = cb->post_ct_dnat;
  1823				ext->zone = cb->zone;
  1824			}
  1825		}
  1826	
  1827		return ret;
  1828	#endif
  1829	}
  1830	EXPORT_SYMBOL(tcf_classify);
  1831	
  1832	struct tcf_chain_info {
  1833		struct tcf_proto __rcu **pprev;
  1834		struct tcf_proto __rcu *next;
  1835	};
  1836	
> 1837	static struct tcf_proto *tcf_chain_tp_prev(struct tcf_chain *chain,
  1838						   struct tcf_chain_info *chain_info)
  1839	{
  1840		return tcf_chain_dereference(*chain_info->pprev, chain);
  1841	}
  1842	
> 1843	static int tcf_chain_tp_insert(struct tcf_chain *chain,
  1844				       struct tcf_chain_info *chain_info,
  1845				       struct tcf_proto *tp)
  1846	{
  1847		if (chain->flushing)
  1848			return -EAGAIN;
  1849	
  1850		RCU_INIT_POINTER(tp->next, tcf_chain_tp_prev(chain, chain_info));
  1851		if (*chain_info->pprev == chain->filter_chain)
  1852			tcf_chain0_head_change(chain, tp);
  1853		tcf_proto_get(tp);
  1854		rcu_assign_pointer(*chain_info->pprev, tp);
  1855	
  1856		return 0;
  1857	}
  1858	
> 1859	static void tcf_chain_tp_remove(struct tcf_chain *chain,
  1860					struct tcf_chain_info *chain_info,
  1861					struct tcf_proto *tp)
  1862	{
  1863		struct tcf_proto *next = tcf_chain_dereference(chain_info->next, chain);
  1864	
  1865		tcf_proto_mark_delete(tp);
  1866		if (tp == chain->filter_chain)
  1867			tcf_chain0_head_change(chain, next);
  1868		RCU_INIT_POINTER(*chain_info->pprev, next);
  1869	}
  1870	
> 1871	static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
  1872						   struct tcf_chain_info *chain_info,
  1873						   u32 protocol, u32 prio,
  1874						   bool prio_allocate);
  1875	
  1876	/* Try to insert new proto.
  1877	 * If proto with specified priority already exists, free new proto
  1878	 * and return existing one.
  1879	 */
  1880	
> 1881	static struct tcf_proto *tcf_chain_tp_insert_unique(struct tcf_chain *chain,
  1882							    struct tcf_proto *tp_new,
  1883							    u32 protocol, u32 prio,
  1884							    bool rtnl_held)
  1885	{
  1886		struct tcf_chain_info chain_info;
  1887		struct tcf_proto *tp;
  1888		int err = 0;
  1889	
  1890		mutex_lock(&chain->filter_chain_lock);
  1891	
  1892		if (tcf_proto_exists_destroying(chain, tp_new)) {
  1893			mutex_unlock(&chain->filter_chain_lock);
  1894			tcf_proto_destroy(tp_new, rtnl_held, false, NULL);
  1895			return ERR_PTR(-EAGAIN);
  1896		}
  1897	
> 1898		tp = tcf_chain_tp_find(chain, &chain_info,
  1899				       protocol, prio, false);
  1900		if (!tp)
  1901			err = tcf_chain_tp_insert(chain, &chain_info, tp_new);
  1902		mutex_unlock(&chain->filter_chain_lock);
  1903	
  1904		if (tp) {
  1905			tcf_proto_destroy(tp_new, rtnl_held, false, NULL);
  1906			tp_new = tp;
  1907		} else if (err) {
  1908			tcf_proto_destroy(tp_new, rtnl_held, false, NULL);
  1909			tp_new = ERR_PTR(err);
  1910		}
  1911	
  1912		return tp_new;
  1913	}
  1914	
> 1915	static void tcf_chain_tp_delete_empty(struct tcf_chain *chain,
  1916					      struct tcf_proto *tp, bool rtnl_held,
  1917					      struct netlink_ext_ack *extack)
  1918	{
  1919		struct tcf_chain_info chain_info;
  1920		struct tcf_proto *tp_iter;
  1921		struct tcf_proto **pprev;
  1922		struct tcf_proto *next;
  1923	
  1924		mutex_lock(&chain->filter_chain_lock);
  1925	
  1926		/* Atomically find and remove tp from chain. */
  1927		for (pprev = &chain->filter_chain;
  1928		     (tp_iter = tcf_chain_dereference(*pprev, chain));
  1929		     pprev = &tp_iter->next) {
  1930			if (tp_iter == tp) {
  1931				chain_info.pprev = pprev;
  1932				chain_info.next = tp_iter->next;
  1933				WARN_ON(tp_iter->deleting);
  1934				break;
  1935			}
  1936		}
  1937		/* Verify that tp still exists and no new filters were inserted
  1938		 * concurrently.
  1939		 * Mark tp for deletion if it is empty.
  1940		 */
  1941		if (!tp_iter || !tcf_proto_check_delete(tp)) {
  1942			mutex_unlock(&chain->filter_chain_lock);
  1943			return;
  1944		}
  1945	
  1946		tcf_proto_signal_destroying(chain, tp);
  1947		next = tcf_chain_dereference(chain_info.next, chain);
  1948		if (tp == chain->filter_chain)
  1949			tcf_chain0_head_change(chain, next);
  1950		RCU_INIT_POINTER(*chain_info.pprev, next);
  1951		mutex_unlock(&chain->filter_chain_lock);
  1952	
  1953		tcf_proto_put(tp, rtnl_held, extack);
  1954	}
  1955	
> 1956	static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
  1957						   struct tcf_chain_info *chain_info,
  1958						   u32 protocol, u32 prio,
  1959						   bool prio_allocate)
  1960	{
  1961		struct tcf_proto **pprev;
  1962		struct tcf_proto *tp;
  1963	
  1964		/* Check the chain for existence of proto-tcf with this priority */
  1965		for (pprev = &chain->filter_chain;
  1966		     (tp = tcf_chain_dereference(*pprev, chain));
  1967		     pprev = &tp->next) {
  1968			if (tp->prio >= prio) {
  1969				if (tp->prio == prio) {
  1970					if (prio_allocate ||
  1971					    (tp->protocol != protocol && protocol))
  1972						return ERR_PTR(-EINVAL);
  1973				} else {
  1974					tp = NULL;
  1975				}
  1976				break;
  1977			}
  1978		}
  1979		chain_info->pprev = pprev;
  1980		if (tp) {
  1981			chain_info->next = tp->next;
  1982			tcf_proto_get(tp);
  1983		} else {
  1984			chain_info->next = NULL;
  1985		}
  1986		return tp;
  1987	}
  1988	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
  2023-10-14 18:09 [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code Victor Nogueira
                   ` (4 preceding siblings ...)
  2023-10-21 22:51 ` kernel test robot
@ 2023-10-23 14:16 ` kernel test robot
  5 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2023-10-23 14:16 UTC (permalink / raw)
  To: Victor Nogueira; +Cc: oe-kbuild-all

Hi Victor,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build errors:

[auto build test ERROR on net/main]
[also build test ERROR on linus/master v6.6-rc7]
[cannot apply to net-next/main next-20231023]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Victor-Nogueira/net-sched-Disambiguate-verdict-from-return-code/20231017-134937
base:   net/main
patch link:    https://lore.kernel.org/r/20231014180921.833820-1-victor%40mojatatu.com
patch subject: [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20231023/202310232151.gWaJgPWd-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231023/202310232151.gWaJgPWd-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310232151.gWaJgPWd-lkp@intel.com/

All errors (new ones prefixed by >>):

         |              ^~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3854:12: error: invalid storage class for function 'tcf_qevent_parse_block_index'
    3854 | static int tcf_qevent_parse_block_index(struct nlattr *block_index_attr,
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3889:15: error: non-static declaration of 'tcf_qevent_init' follows static declaration
    3889 | EXPORT_SYMBOL(tcf_qevent_init);
         |               ^~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3889:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3889 | EXPORT_SYMBOL(tcf_qevent_init);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3867:5: note: previous definition of 'tcf_qevent_init' with type 'int(struct tcf_qevent *, struct Qdisc *, enum flow_block_binder_type,  struct nlattr *, struct netlink_ext_ack *)'
    3867 | int tcf_qevent_init(struct tcf_qevent *qe, struct Qdisc *sch,
         |     ^~~~~~~~~~~~~~~
   net/sched/cls_api.c:3896:15: error: non-static declaration of 'tcf_qevent_destroy' follows static declaration
    3896 | EXPORT_SYMBOL(tcf_qevent_destroy);
         |               ^~~~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3896:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3896 | EXPORT_SYMBOL(tcf_qevent_destroy);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3891:6: note: previous definition of 'tcf_qevent_destroy' with type 'void(struct tcf_qevent *, struct Qdisc *)'
    3891 | void tcf_qevent_destroy(struct tcf_qevent *qe, struct Qdisc *sch)
         |      ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3919:15: error: non-static declaration of 'tcf_qevent_validate_change' follows static declaration
    3919 | EXPORT_SYMBOL(tcf_qevent_validate_change);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3919:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3919 | EXPORT_SYMBOL(tcf_qevent_validate_change);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3898:5: note: previous definition of 'tcf_qevent_validate_change' with type 'int(struct tcf_qevent *, struct nlattr *, struct netlink_ext_ack *)'
    3898 | int tcf_qevent_validate_change(struct tcf_qevent *qe, struct nlattr *block_index_attr,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3952:15: error: non-static declaration of 'tcf_qevent_handle' follows static declaration
    3952 | EXPORT_SYMBOL(tcf_qevent_handle);
         |               ^~~~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3952:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3952 | EXPORT_SYMBOL(tcf_qevent_handle);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3921:17: note: previous definition of 'tcf_qevent_handle' with type 'struct sk_buff *(struct tcf_qevent *, struct Qdisc *, struct sk_buff *, struct sk_buff **, int *)'
    3921 | struct sk_buff *tcf_qevent_handle(struct tcf_qevent *qe, struct Qdisc *sch, struct sk_buff *skb,
         |                 ^~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:3960:15: error: non-static declaration of 'tcf_qevent_dump' follows static declaration
    3960 | EXPORT_SYMBOL(tcf_qevent_dump);
         |               ^~~~~~~~~~~~~~~
   include/linux/export.h:74:28: note: in definition of macro '__EXPORT_SYMBOL'
      74 |         extern typeof(sym) sym;                                 \
         |                            ^~~
   include/linux/export.h:86:41: note: in expansion of macro '_EXPORT_SYMBOL'
      86 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   net/sched/cls_api.c:3960:1: note: in expansion of macro 'EXPORT_SYMBOL'
    3960 | EXPORT_SYMBOL(tcf_qevent_dump);
         | ^~~~~~~~~~~~~
   net/sched/cls_api.c:3954:5: note: previous definition of 'tcf_qevent_dump' with type 'int(struct sk_buff *, int,  struct tcf_qevent *)'
    3954 | int tcf_qevent_dump(struct sk_buff *skb, int attr_name, struct tcf_qevent *qe)
         |     ^~~~~~~~~~~~~~~
   net/sched/cls_api.c:3963:23: error: invalid storage class for function 'tcf_net_init'
    3963 | static __net_init int tcf_net_init(struct net *net)
         |                       ^~~~~~~~~~~~
   net/sched/cls_api.c:3972:24: error: invalid storage class for function 'tcf_net_exit'
    3972 | static void __net_exit tcf_net_exit(struct net *net)
         |                        ^~~~~~~~~~~~
   net/sched/cls_api.c:3980:17: error: initializer element is not constant
    3980 |         .init = tcf_net_init,
         |                 ^~~~~~~~~~~~
   net/sched/cls_api.c:3980:17: note: (near initialization for 'tcf_net_ops.init')
   net/sched/cls_api.c:3981:17: error: initializer element is not constant
    3981 |         .exit = tcf_net_exit,
         |                 ^~~~~~~~~~~~
   net/sched/cls_api.c:3981:17: note: (near initialization for 'tcf_net_ops.exit')
   net/sched/cls_api.c:3986:19: error: invalid storage class for function 'tc_filter_init'
    3986 | static int __init tc_filter_init(void)
         |                   ^~~~~~~~~~~~~~
   In file included from include/linux/build_bug.h:5,
                    from include/linux/container_of.h:5,
                    from include/linux/list.h:5,
                    from include/linux/module.h:12:
>> include/linux/compiler.h:215:60: error: initializer element is not constant
     215 |                 __UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)&sym;
         |                                                            ^
   include/linux/compiler.h:217:9: note: in expansion of macro '___ADDRESSABLE'
     217 |         ___ADDRESSABLE(sym, __section(".discard.addressable"))
         |         ^~~~~~~~~~~~~~
   include/linux/init.h:256:9: note: in expansion of macro '__ADDRESSABLE'
     256 |         __ADDRESSABLE(fn)
         |         ^~~~~~~~~~~~~
   include/linux/init.h:261:9: note: in expansion of macro '__define_initcall_stub'
     261 |         __define_initcall_stub(__stub, fn)                      \
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/init.h:274:9: note: in expansion of macro '____define_initcall'
     274 |         ____define_initcall(fn,                                 \
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/init.h:280:9: note: in expansion of macro '__unique_initcall'
     280 |         __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |         ^~~~~~~~~~~~~~~~~
   include/linux/init.h:282:35: note: in expansion of macro '___define_initcall'
     282 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                   ^~~~~~~~~~~~~~~~~~
   include/linux/init.h:306:41: note: in expansion of macro '__define_initcall'
     306 | #define subsys_initcall(fn)             __define_initcall(fn, 4)
         |                                         ^~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:4018:1: note: in expansion of macro 'subsys_initcall'
    4018 | subsys_initcall(tc_filter_init);
         | ^~~~~~~~~~~~~~~
   net/sched/cls_api.c:4018:1: error: expected declaration or statement at end of input
   net/sched/cls_api.c: At top level:
   net/sched/cls_api.c:592:12: warning: 'tc_chain_notify' used but never defined
     592 | static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,
         |            ^~~~~~~~~~~~~~~
   net/sched/cls_api.c:648:13: warning: 'tc_chain_tmplt_del' used but never defined
     648 | static void tc_chain_tmplt_del(const struct tcf_proto_ops *tmplt_ops,
         |             ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:650:12: warning: 'tc_chain_notify_delete' used but never defined
     650 | static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,
         |            ^~~~~~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c: In function 'tcf_classify':
   net/sched/cls_api.c:4019: error: control reaches end of non-void function [-Werror=return-type]
   net/sched/cls_api.c: At top level:
   net/sched/cls_api.c:2994:13: warning: 'tc_chain_tmplt_del' defined but not used [-Wunused-function]
    2994 | static void tc_chain_tmplt_del(const struct tcf_proto_ops *tmplt_ops,
         |             ^~~~~~~~~~~~~~~~~~
   net/sched/cls_api.c:2933:12: warning: 'tc_chain_notify_delete' defined but not used [-Wunused-function]
    2933 | static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,
         |            ^~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +215 include/linux/compiler.h

^1da177e4c3f41 Linus Torvalds 2005-04-16  206  
7290d58095712a Ard Biesheuvel 2018-08-21  207  /*
7290d58095712a Ard Biesheuvel 2018-08-21  208   * Force the compiler to emit 'sym' as a symbol, so that we can reference
7290d58095712a Ard Biesheuvel 2018-08-21  209   * it from inline assembler. Necessary in case 'sym' could be inlined
7290d58095712a Ard Biesheuvel 2018-08-21  210   * otherwise, or eliminated entirely due to lack of references that are
7290d58095712a Ard Biesheuvel 2018-08-21  211   * visible to the compiler.
7290d58095712a Ard Biesheuvel 2018-08-21  212   */
92efda8eb15295 Sami Tolvanen  2022-09-08  213  #define ___ADDRESSABLE(sym, __attrs) \
92efda8eb15295 Sami Tolvanen  2022-09-08  214  	static void * __used __attrs \
563a02b0c9704f Josh Poimboeuf 2020-08-18 @215  		__UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)&sym;
92efda8eb15295 Sami Tolvanen  2022-09-08  216  #define __ADDRESSABLE(sym) \
92efda8eb15295 Sami Tolvanen  2022-09-08  217  	___ADDRESSABLE(sym, __section(".discard.addressable"))
7290d58095712a Ard Biesheuvel 2018-08-21  218  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-10-23 14:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-14 18:09 [PATCH RFC net-next v2 1/1] net: sched: Disambiguate verdict from return code Victor Nogueira
2023-10-14 19:00 ` Florian Westphal
2023-10-16 14:01 ` Davide Caratti
2023-10-16 14:11   ` Jamal Hadi Salim
2023-10-16 16:04 ` Jakub Kicinski
2023-10-17 13:02 ` kernel test robot
2023-10-21 22:51 ` kernel test robot
2023-10-23 14:16 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.