Thread (30 messages) 30 messages, 5 authors, 2022-11-30

Re: [PATCH (repost) net-next] sched: add extack for tfilter_notify

From: Hangbin Liu <hidden>
Date: 2022-11-15 12:44:52
Subsystem: networking [general], tc subsystem, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jamal Hadi Salim, Jiri Pirko, Linus Torvalds

On Mon, Nov 14, 2022 at 08:51:43PM -0800, Jakub Kicinski wrote:
quoted
So maybe I should stop on here?
It's a bit of a catch 22 - I don't mind the TCA_NTF_WARN_MSG itself 
but I would prefer for the extack via notification to spread to other
notifications.
Not sure if we could find a way to pass the GROUP ID to netlink_ack(),
and use nlmsg_notify() instead of nlmsg_unicast() in it. Then the tc monitor
could handle the NLMSG_ERROR directly.
If you have the code ready - post it, let's see how folks feel after
sleeping on it.
I just add a new TCA_NTF_WARN_MSG enum and put the extack message here.
Is this what you want?
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index eb2747d58a81..6952573e7054 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -635,6 +635,7 @@ enum {
 	TCA_INGRESS_BLOCK,
 	TCA_EGRESS_BLOCK,
 	TCA_DUMP_FLAGS,
+	TCA_NTF_WARN_MSG,
 	__TCA_MAX
 };
 
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 23d1cfa4f58c..204181cec215 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1816,7 +1816,8 @@ static int tcf_fill_node(struct net *net, struct sk_buff *skb,
 			 struct tcf_proto *tp, struct tcf_block *block,
 			 struct Qdisc *q, u32 parent, void *fh,
 			 u32 portid, u32 seq, u16 flags, int event,
-			 bool terse_dump, bool rtnl_held)
+			 bool terse_dump, bool rtnl_held,
+			 struct netlink_ext_ack *extack)
 {
 	struct tcmsg *tcm;
 	struct nlmsghdr  *nlh;
@@ -1856,6 +1857,11 @@ static int tcf_fill_node(struct net *net, struct sk_buff *skb,
 		    tp->ops->dump(net, tp, fh, skb, tcm, rtnl_held) < 0)
 			goto nla_put_failure;
 	}
+
+	if (extack && extack->_msg &&
+	    nla_put_string(skb, TCA_NTF_WARN_MSG, extack->_msg))
+			goto nla_put_failure;
+
 	nlh->nlmsg_len = skb_tail_pointer(skb) - b;
 	return skb->len;
Thanks
Hangbin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help