public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	netdev@vger.kernel.org, Jiri Pirko <jiri@resnulli.us>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, David Ahern <dsahern@kernel.org>
Subject: Re: [PATCH (repost) net-next] sched: add extack for tfilter_notify
Date: Tue, 15 Nov 2022 20:44:41 +0800	[thread overview]
Message-ID: <Y3OJucOnuGrBvwYM@Laptop-X1> (raw)
In-Reply-To: <20221114205143.717fd03f@kernel.org>

On Mon, Nov 14, 2022 at 08:51:43PM -0800, Jakub Kicinski wrote:
> > 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

  parent reply	other threads:[~2022-11-15 12:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29  3:35 [PATCH (repost) net-next] sched: add extack for tfilter_notify Hangbin Liu
2022-10-01  2:03 ` Jakub Kicinski
2022-10-01 18:39 ` Cong Wang
2022-10-01 20:39   ` Marcelo Ricardo Leitner
2022-10-02 15:27     ` Jamal Hadi Salim
2022-10-26  9:58       ` Hangbin Liu
2022-11-02  1:26         ` Hangbin Liu
2022-11-02 15:33         ` Jamal Hadi Salim
2022-11-02 23:36           ` Jakub Kicinski
2022-11-04  2:39             ` Hangbin Liu
2022-11-08  9:11             ` Hangbin Liu
2022-11-08 18:55               ` Jakub Kicinski
2022-11-09 11:53                 ` Hangbin Liu
2022-11-10  1:52                   ` Jamal Hadi Salim
2022-11-10  2:20                     ` Jakub Kicinski
2022-11-10  6:29                       ` Hangbin Liu
2022-11-10 17:12                         ` Jakub Kicinski
2022-11-10 14:27                       ` Jamal Hadi Salim
2022-11-10 17:27                         ` Jakub Kicinski
2022-11-15  3:07                           ` Hangbin Liu
2022-11-15  4:51                             ` Jakub Kicinski
2022-11-15 12:42                               ` Jamal Hadi Salim
2022-11-15 12:44                               ` Hangbin Liu [this message]
2022-11-15 13:13                                 ` Jamal Hadi Salim
2022-11-15 13:57                                   ` Hangbin Liu
2022-11-15 16:26                                     ` Jamal Hadi Salim
2022-11-17  8:42                                       ` Hangbin Liu
2022-11-29  8:07                                       ` Hangbin Liu
2022-11-29 15:43                                         ` Jakub Kicinski
2022-11-30  8:44                                           ` Hangbin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y3OJucOnuGrBvwYM@Laptop-X1 \
    --to=liuhangbin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox