Skip to contentSkip to conversation

net/sched: fix parsing of TCA_EXT_WARN_MSG for tc action

PATCH Applied Hangbin Liu 3 participants 9 messages Mar 16, 2023 – Mar 17, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover net/sched: fix parsing of TCA_EXT_WARN_MSG for tc action

In my previous commit 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message") I didn't notice the tc action use different enum with filter. So we can't use TCA_EXT_WARN_MSG directly for tc action.

Let's rever the previous fix 923b2e30dc9c ("net/sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy") and add a new TCA_ROOT_EXT_WARN_MSG for tc action specifically.

Here is the tdc test result:

1..1119
ok 1 d959 - Add cBPF action with valid bytecode ok 2 f84a - Add cBPF action with invalid bytecode ok 3 e939 - Add eBPF action with valid object-file ok 4 282d - Add eBPF action with invalid object-file ok 5 d819 - Replace cBPF bytecode and action control ok 6 6ae3 - Delete cBPF action
ok 7 3e0d - List cBPF actions
ok 8 55ce - Flush BPF actions
ok 9 ccc3 - Add cBPF action with duplicate index ok 10 89c7 - Add cBPF action with invalid index [...]
ok 1115 2348 - Show TBF class
ok 1116 84a0 - Create TEQL with default setting ok 1117 7734 - Create TEQL with multiple device ok 1118 34a9 - Delete TEQL with valid handle ok 1119 6289 - Show TEQL stats

Hangbin Liu (2):
Revert "net/sched: act_api: move TCA_EXT_WARN_MSG to the correct
hierarchy"
net/sched: act_api: add specific EXT_WARN_MSG for tc action

 include/uapi/linux/rtnetlink.h | 1 +
 net/sched/act_api.c            | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH v2 1/2 Revert "net/sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy"

This reverts commit 923b2e30dc9cd05931da0f64e2e23d040865c035.

This is not a correct fix as TCA_EXT_WARN_MSG is not a hierarchy to TCA_ACT_TAB. I didn't notice the TC actions use different enum when adding TCA_EXT_WARN_MSG. To fix the difference I will add a new WARN enum in TCA_ROOT_MAX as Jamal suggested.

---
 net/sched/act_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/sched/act_api.c +2 -2
index 34c508675041..fce522886099 100644
@@ -1596,12 +1596,12 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
 	if (tcf_action_dump(skb, actions, bind, ref, false) < 0)
 		goto out_nlmsg_trim;
 
+	nla_nest_end(skb, nest);
+
 	if (extack && extack->_msg &&
 	    nla_put_string(skb, TCA_EXT_WARN_MSG, extack->_msg))
 		goto out_nlmsg_trim;
 
-	nla_nest_end(skb, nest);
-
 	nlh->nlmsg_len = skb_tail_pointer(skb) - b;
 
 	return skb->len;
Signature · 1 line
2.38.1
maintainer Acked-by on v2 1/2
#2 lore raw

Re: [PATCHv2 net 1/2] Revert "net/sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy"

Quoted 22 lines · Hangbin Liu

This reverts commit 923b2e30dc9cd05931da0f64e2e23d040865c035.

This is not a correct fix as TCA_EXT_WARN_MSG is not a hierarchy to TCA_ACT_TAB. I didn't notice the TC actions use different enum when adding TCA_EXT_WARN_MSG. To fix the difference I will add a new WARN enum in TCA_ROOT_MAX as Jamal suggested.

---
 net/sched/act_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/sched/act_api.c +1 -0
index 34c508675041..fce522886099 100644
@@ -1596,12 +1596,12 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
        if (tcf_action_dump(skb, actions, bind, ref, false) < 0)
                goto out_nlmsg_trim;
 
+       nla_nest_end(skb, nest);

net/sched/act_api.c static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[], · line 1607

Quoted 10 lines
net/sched/act_api.c +1 -2
+
        if (extack && extack->_msg &&
            nla_put_string(skb, TCA_EXT_WARN_MSG, extack->_msg))
                goto out_nlmsg_trim;
 
-       nla_nest_end(skb, nest);
-
        nlh->nlmsg_len = skb_tail_pointer(skb) - b;
 
        return skb->len;

cheers,
jamal

Quoted 2 lines

2.38.1

#3 lore raw

PATCH v2 2/2 net/sched: act_api: add specific EXT_WARN_MSG for tc action

In reply to Hangbin Liu

In my previous commit 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message") I didn't notice the tc action use different enum with filter. So we can't use TCA_EXT_WARN_MSG directly for tc action. Let's add a TCA_ROOT_EXT_WARN_MSG for tc action specifically and put this param before going to the TCA_ACT_TAB nest.

Fixes 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message")

---
v2: rename TCA_ACT_EXT_WARN_MSG to TCA_ROOT_EXT_WARN_MSG

---
 include/uapi/linux/rtnetlink.h | 1 +
 net/sched/act_api.c            | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)
include/uapi/linux/rtnetlink.h +1 -0
index 25a0af57dd5e..51c13cf9c5ae 100644
@@ -789,6 +789,7 @@ enum {
 	TCA_ROOT_FLAGS,
 	TCA_ROOT_COUNT,
 	TCA_ROOT_TIME_DELTA, /* in msecs */
+	TCA_ROOT_EXT_WARN_MSG,
 	__TCA_ROOT_MAX,
 #define	TCA_ROOT_MAX (__TCA_ROOT_MAX - 1)
 };
net/sched/act_api.c +4 -4
index fce522886099..296fc1afedd8 100644
@@ -1589,6 +1589,10 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
 	t->tca__pad1 = 0;
 	t->tca__pad2 = 0;
 
+	if (extack && extack->_msg &&
+	    nla_put_string(skb, TCA_ROOT_EXT_WARN_MSG, extack->_msg))
+		goto out_nlmsg_trim;
+
 	nest = nla_nest_start_noflag(skb, TCA_ACT_TAB);
 	if (!nest)
 		goto out_nlmsg_trim;
@@ -1598,10 +1602,6 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
 
 	nla_nest_end(skb, nest);
 
-	if (extack && extack->_msg &&
-	    nla_put_string(skb, TCA_EXT_WARN_MSG, extack->_msg))
-		goto out_nlmsg_trim;
-
 	nlh->nlmsg_len = skb_tail_pointer(skb) - b;
 
 	return skb->len;
Signature · 1 line
2.38.1
maintainer Acked-by on v2 2/2
#4 lore raw

Re: [PATCHv2 net 2/2] net/sched: act_api: add specific EXT_WARN_MSG for tc action

Quoted 9 lines · Hangbin Liu

In my previous commit 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message") I didn't notice the tc action use different enum with filter. So we can't use TCA_EXT_WARN_MSG directly for tc action. Let's add a TCA_ROOT_EXT_WARN_MSG for tc action specifically and put this param before going to the TCA_ACT_TAB nest.

Fixes 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message")

cheers,
jamal

Quoted 48 lines

---
v2: rename TCA_ACT_EXT_WARN_MSG to TCA_ROOT_EXT_WARN_MSG

---
 include/uapi/linux/rtnetlink.h | 1 +
 net/sched/act_api.c            | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)
include/uapi/linux/rtnetlink.h +1 -0
index 25a0af57dd5e..51c13cf9c5ae 100644
@@ -789,6 +789,7 @@ enum {
        TCA_ROOT_FLAGS,
        TCA_ROOT_COUNT,
        TCA_ROOT_TIME_DELTA, /* in msecs */
+       TCA_ROOT_EXT_WARN_MSG,
        __TCA_ROOT_MAX,
 #define        TCA_ROOT_MAX (__TCA_ROOT_MAX - 1)
 };
net/sched/act_api.c +4 -5
index fce522886099..296fc1afedd8 100644
@@ -1589,6 +1589,10 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
        t->tca__pad1 = 0;
        t->tca__pad2 = 0;
 
+       if (extack && extack->_msg &&
+           nla_put_string(skb, TCA_ROOT_EXT_WARN_MSG, extack->_msg))
+               goto out_nlmsg_trim;
+
        nest = nla_nest_start_noflag(skb, TCA_ACT_TAB);
        if (!nest)
                goto out_nlmsg_trim;
@@ -1598,10 +1602,6 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
 
        nla_nest_end(skb, nest);
 
-       if (extack && extack->_msg &&
-           nla_put_string(skb, TCA_EXT_WARN_MSG, extack->_msg))
-               goto out_nlmsg_trim;
-
        nlh->nlmsg_len = skb_tail_pointer(skb) - b;
 
        return skb->len;
--

2.38.1

#5 lore raw
In reply to Hangbin Liu
Quoted 7 lines · Hangbin Liu

In my previous commit 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message") I didn't notice the tc action use different enum with filter. So we can't use TCA_EXT_WARN_MSG directly for tc action.

Let's rever the previous fix 923b2e30dc9c ("net/sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy") and add a new TCA_ROOT_EXT_WARN_MSG for tc action specifically.

Sigh. Sorry I sent the mail too quick and forgot to add

maintainer
#6 lore raw
Quoted 6 lines · Hangbin Liu
Quoted 4 lines · Hangbin Liu

In my previous commit 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message") I didn't notice the tc action use different enum with filter. So we can't use TCA_EXT_WARN_MSG directly for tc action.

Quoted 7 lines
Quoted 3 lines

Let's rever the previous fix 923b2e30dc9c ("net/sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy") and add a new TCA_ROOT_EXT_WARN_MSG for tc action specifically.

Sigh. Sorry I sent the mail too quick and forgot to add

For next time: instead of saying in the commit message "suggested by foo" specify it using "suggested-by: foo" semantics.

cheers,
jamal

#7 lore raw
Quoted 11 lines · Jamal Hadi Salim
Quoted 10 lines · Hangbin Liu
Quoted 7 lines · Hangbin Liu

In my previous commit 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message") I didn't notice the tc action use different enum with filter. So we can't use TCA_EXT_WARN_MSG directly for tc action.

Let's rever the previous fix 923b2e30dc9c ("net/sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy") and add a new TCA_ROOT_EXT_WARN_MSG for tc action specifically.

Quoted 6 lines
Quoted 3 lines

Sigh. Sorry I sent the mail too quick and forgot to add

For next time: instead of saying in the commit message "suggested by foo" specify it using "suggested-by: foo" semantics.

Sure, I will

Thanks
Hangbin

#8 lore raw
In reply to Hangbin Liu
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 16 Mar 2023 11:37:51 +0800 you wrote:

In my previous commit 0349b8779cc9 ("sched: add new attr TCA_EXT_WARN_MSG to report tc extact message") I didn't notice the tc action use different enum with filter. So we can't use TCA_EXT_WARN_MSG directly for tc action.

Let's rever the previous fix 923b2e30dc9c ("net/sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy") and add a new TCA_ROOT_EXT_WARN_MSG for tc action specifically.

[...]

Here is the summary with links:
- [PATCHv2,net,1/2] Revert "net/sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy"

    https://git.kernel.org/netdev/net/c/8de2bd02439e
  - [PATCHv2,net,2/2] net/sched: act_api: add specific EXT_WARN_MSG for tc action
    https://git.kernel.org/netdev/net/c/2f59823fe696

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html