sched: multicast sched extack messages
Subsystems (3)
PATCH v3 1/1 sched: multicast sched extack messages
In commit 81c7288b170a ("sched: cls: enable verbose logging") Marcelo made cls could log verbose info for offloading failures, which helps improving Open vSwitch debuggability when using flower offloading.
It would also be helpful if userspace monitor tools, like "tc monitor", could log this kind of message, as it doesn't require vswitchd log level adjusment. Let's add a new function to report the extack message so the monitor program could receive the failures. e.g.
# tc monitor
added chain dev enp3s0f1np1 parent ffff: chain 0
added filter dev enp3s0f1np1 ingress protocol all pref 49152 flower chain 0 handle 0x1
ct_state +trk+new
not_in_hw
action order 1: gact action drop
random type none pass val 0
index 1 ref 1 bind 1 Warning: mlx5_core: matching on ct_state +new isn't supported.
---
v3: also add this feature for qdisc, class, action, chain notify
v2: use NLMSG_ERROR instad of NLMSG_DONE to report the extack message
--- include/net/sch_generic.h | 2 ++ net/sched/act_api.c | 15 ++++++---- net/sched/cls_api.c | 61 ++++++++++++++++++++++++--------------- net/sched/sch_api.c | 56 +++++++++++++++++++++-------------- net/sched/sch_generic.c | 26 +++++++++++++++++ 5 files changed, 111 insertions(+), 49 deletions(-)
include/net/sch_generic.h +2 -0
@@ -1288,4 +1288,6 @@ void mq_change_real_num_tx(struct Qdisc *sch, unsigned int new_real_tx);int sch_frag_xmit_hook (struct sk_buff *skb,int (*xmit)(struct sk_buff *skb)); +int tc_set_nl_ext (struct sk_buff *skb,const struct nlmsghdr *n, +struct netlink_ext_ack *extack,u32 portid);#endif
net/sched/act_api.c +10 -5
@@ -1582,7 +1582,8 @@ int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *p,static int tca_get_fill (struct sk_buff *skb,struct tc_action *actions[],u32 portid,u32 seq,u16 flags,int event,int bind, -int ref) +int ref,const struct nlmsghdr *n, +struct netlink_ext_ack *extack) {struct tcamsg *t;struct nlmsghdr *nlh;
@@ -1607,6 +1608,10 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],nla_nest_end (skb, nest); nlh->nlmsg_len =skb_tail_pointer (skb) - b; + +if ((flags &NLM_F_ACK ) &&tc_set_nl_ext (skb, n, extack, portid)) + goto out_nlmsg_trim; +return skb->len; out_nlmsg_trim:
@@ -1625,7 +1630,7 @@ tcf_get_notify(struct net *net, u32 portid, struct nlmsghdr *n,if (!skb)return -ENOBUFS ;if (tca_get_fill (skb, actions, portid, n->nlmsg_seq,0 , event, -0 ,1 ) <=0 ) { +0 ,1 ,NULL ,NULL ) <=0 ) {NL_SET_ERR_MSG (extack,"Failed to fill netlink attributes while adding TC action" );kfree_skb (skb);return -EINVAL ;
@@ -1799,7 +1804,7 @@ tcf_reoffload_del_notify(struct net *net, struct tc_action *action)if (!skb)return -ENOBUFS ; -if (tca_get_fill (skb, actions,0 ,0 ,0 ,RTM_DELACTION ,0 ,1 ) <=0 ) { +if (tca_get_fill (skb, actions,0 ,0 ,0 ,RTM_DELACTION ,0 ,1 ,NULL ,NULL ) <=0 ) {kfree_skb (skb);return -EINVAL ; }
@@ -1886,7 +1891,7 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],return -ENOBUFS ;if (tca_get_fill (skb, actions, portid, n->nlmsg_seq,0 ,RTM_DELACTION , -0 ,2 ) <=0 ) { +0 ,2 , n, extack) <=0 ) {NL_SET_ERR_MSG (extack,"Failed to fill netlink TC action attributes" );kfree_skb (skb);return -EINVAL ;
@@ -1965,7 +1970,7 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],return -ENOBUFS ;if (tca_get_fill (skb, actions, portid, n->nlmsg_seq, n->nlmsg_flags, -RTM_NEWACTION ,0 ,0 ) <=0 ) { +RTM_NEWACTION ,0 ,0 , n, extack) <=0 ) {NL_SET_ERR_MSG (extack,"Failed to fill netlink attributes while adding TC action" );kfree_skb (skb);return -EINVAL ;
net/sched/cls_api.c +38 -23
207 lines not on this page · raw message
net/sched/sch_api.c +35 -21
186 lines not on this page · raw message
net/sched/sch_generic.c +26 -0
@@ -1594,3 +1594,29 @@ void mini_qdisc_pair_init(struct mini_Qdisc_pair *miniqp, struct Qdisc *qdisc, miniqp->p_miniq = p_miniq; }EXPORT_SYMBOL (mini_qdisc_pair_init); + +int tc_set_nl_ext (struct sk_buff *skb,const struct nlmsghdr *n, +struct netlink_ext_ack *extack,u32 portid) +{ +struct nlmsgerr *errmsg; +struct nlmsghdr *nlh; + +if (!n || !extack || !extack->_msg) +return 0 ; + + nlh =nlmsg_put (skb, portid, n->nlmsg_seq,NLMSG_ERROR ,sizeof (*errmsg), +NLM_F_ACK_TLVS |NLM_F_CAPPED ); +if (!nlh) +return -1 ; + + errmsg = (struct nlmsgerr *)nlmsg_data (nlh); + errmsg->error =0 ; + errmsg->msg = *n; + +if (nla_put_string (skb,NLMSGERR_ATTR_MSG , extack->_msg)) +return -1 ; + +nlmsg_end (skb, nlh); + +return 0 ; +}
Signature · 1 line
2.38.1
Quoted 8 lines · On Wed, 4 Jan 2023 17:16:08 +0800 Hangbin Liu wrote:
In commit
81c7288b170a("sched: cls: enable verbose logging") Marcelo made cls could log verbose info for offloading failures, which helps improving Open vSwitch debuggability when using flower offloading.It would also be helpful if userspace monitor tools, like "tc monitor", could log this kind of message, as it doesn't require vswitchd log level adjusment. Let's add a new function to report the extack message so the monitor program could receive the failures. e.g.
If you repost this ever again please make sure you include my tag:
I explained to you at least twice why this is a terrible idea, and gave you multiple alternatives.
Quoted 10 lines · Jakub Kicinski
Quoted 8 lines · On Wed, 4 Jan 2023 17:16:08 +0800 Hangbin Liu wrote:
In commit
81c7288b170a("sched: cls: enable verbose logging") Marcelo made cls could log verbose info for offloading failures, which helps improving Open vSwitch debuggability when using flower offloading.It would also be helpful if userspace monitor tools, like "tc monitor", could log this kind of message, as it doesn't require vswitchd log level adjusment. Let's add a new function to report the extack message so the monitor program could receive the failures. e.g.
Quoted 6 lines
If you repost this ever again please make sure you include my tag:
Nacked-by Jakub Kicinski <[email protected]>I explained to you at least twice why this is a terrible idea, and gave you multiple alternatives.
Hi Jakub,
I'm very sorry if this patch makes you feel disturbed. I switched the notification to NLMSG_ERROR instead of NLMSG_DONE as you pointed out. I also made the notification only in sched sub-system, not using netlink_ack() globally. Oh, and forgot to reply to you, I use portid and seq in the notification as all the tc notifies also use them.
In the last patch, I saw Jamal reply to you about the usability. So I thought you might reconsider this feature. Now I will stop posting this patch unless you agree to keep working on this.
Sorry again if I missed any other suggestions from you.
Best regards
Hangbin
Jamal Hadi Salim
maintainerOn Mon, Jan 9, 2023 at 10:56 AM Jamal Hadi Salim <[email protected]> wrote:
IMO the feature is useful. The idea of using a single tool to get the details improves the operational experience.
And in this case this is a valid event (someone tried to add an entry to hardware and s/ware and it worked for
one and not the other).
I think Jakub's objection is in the approach. Jakub, would using specific attributes restricted to
just QDISC/FILTER/ACTION work for you?
cheers,
jamal
On Thu, Jan 5, 2023 at 5:12 AM Hangbin Liu <[email protected]> wrote:
Quoted 10 lines · Jakub Kicinski
Quoted 8 lines · On Wed, 4 Jan 2023 17:16:08 +0800 Hangbin Liu wrote:
In commit
81c7288b170a("sched: cls: enable verbose logging") Marcelo made cls could log verbose info for offloading failures, which helps improving Open vSwitch debuggability when using flower offloading.It would also be helpful if userspace monitor tools, like "tc monitor", could log this kind of message, as it doesn't require vswitchd log level adjusment. Let's add a new function to report the extack message so the monitor program could receive the failures. e.g.
Quoted 6 lines
If you repost this ever again please make sure you include my tag:
Nacked-by Jakub Kicinski <[email protected]>I explained to you at least twice why this is a terrible idea, and gave you multiple alternatives.
Hi Jakub,
I'm very sorry if this patch makes you feel disturbed. I switched the notification
to NLMSG_ERROR instead of NLMSG_DONE as you pointed out. I also made the notification only in sched sub-system, not using netlink_ack() globally. Oh, and forgot to reply to you, I use portid and seq in the notification as all the tc notifies also use them.
In the last patch, I saw Jamal reply to you about the usability. So I thought you might reconsider this feature. Now I will stop posting this patch unless you agree to keep working on this.
Sorry again if I missed any other suggestions from you.
Best regards
Hangbin
Quoted 35 lines · Hangbin Liu
Quoted 10 lines · Jakub Kicinski
Quoted 8 lines · On Wed, 4 Jan 2023 17:16:08 +0800 Hangbin Liu wrote:
In commit
81c7288b170a("sched: cls: enable verbose logging") Marcelo made cls could log verbose info for offloading failures, which helps improving Open vSwitch debuggability when using flower offloading.It would also be helpful if userspace monitor tools, like "tc monitor", could log this kind of message, as it doesn't require vswitchd log level adjusment. Let's add a new function to report the extack message so the monitor program could receive the failures. e.g.
Quoted 6 lines
If you repost this ever again please make sure you include my tag:
Nacked-by Jakub Kicinski <[email protected]>I explained to you at least twice why this is a terrible idea, and gave you multiple alternatives.
Hi Jakub,
I'm very sorry if this patch makes you feel disturbed. I switched the notification to
NLMSG_ERRORinstead ofNLMSG_DONEas you pointed out. I also made the notification only in sched sub-system, not usingnetlink_ack()globally. Oh, and forgot to reply to you, I use portid and seq in the notification as all the tc notifies also use them.In the last patch, I saw Jamal reply to you about the usability. So I thought you might reconsider this feature. Now I will stop posting this patch unless you agree to keep working on this.
Sorry again if I missed any other suggestions from you.
Best regards
Hangbin
A message that is not in the archive (sent off-list or not yet received): CAM0EoMkw8GA=KA_FXV8v4a-RKYCibK64ngp9hRQeT1UzXY4LCg@mail.gmail.com
Jakub Kicinski
maintainerQuoted 6 lines · On Mon, 9 Jan 2023 10:56:00 -0500 Jamal Hadi Salim wrote:
IMO the feature is useful. The idea of using a single tool to get the details improves the operational experience.
And in this case this is a valid event (someone tried to add an entry to hardware and s/ware and it worked for
one and not the other).
I think Jakub's objection is in the approach.
Right.
Quoted 2 lines
Jakub, would using specific attributes restricted to just QDISC/FILTER/ACTION work for you?
Yes, specific attr to wrap the extack seems acceptable.
Quoted 8 lines · Jakub Kicinski
Quoted 6 lines · On Mon, 9 Jan 2023 10:56:00 -0500 Jamal Hadi Salim wrote:
IMO the feature is useful. The idea of using a single tool to get the details improves the operational experience.
And in this case this is a valid event (someone tried to add an entry to hardware and s/ware and it worked for
one and not the other).
I think Jakub's objection is in the approach.
Quoted 6 lines
Right.
Quoted 2 lines
Jakub, would using specific attributes restricted to just QDISC/FILTER/ACTION work for you?
Yes, specific attr to wrap the extack seems acceptable.
Looks we go back to the TCA_NTF_WARN_MSG approach[1], right?
[1] https://lore.kernel.org/all/Y3OJucOnuGrBvwYM@Laptop-X1/
Thanks
Hangbin
Jakub Kicinski
maintainerQuoted 8 lines · On Tue, 10 Jan 2023 18:17:33 +0800 Hangbin Liu wrote:
Quoted 4 lines
Quoted 2 lines
Jakub, would using specific attributes restricted to just QDISC/FILTER/ACTION work for you?
Yes, specific attr to wrap the extack seems acceptable.
Looks we go back to the
TCA_NTF_WARN_MSGapproach[1], right?
Yes :)