netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: netdev@vger.kernel.org
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	David Ahern <dsahern@kernel.org>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Davide Caratti <dcaratti@redhat.com>,
	Pedro Tammela <pctammela@mojatatu.com>,
	Marcelo Leitner <mleitner@redhat.com>,
	Phil Sutter <psutter@redhat.com>,
	Hangbin Liu <liuhangbin@gmail.com>
Subject: [PATCH net 2/2] net/sched: act_api: add specific EXT_WARN_MSG for tc action
Date: Tue, 14 Mar 2023 14:58:02 +0800	[thread overview]
Message-ID: <20230314065802.1532741-3-liuhangbin@gmail.com> (raw)
In-Reply-To: <20230314065802.1532741-1-liuhangbin@gmail.com>

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_ACT_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")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 include/uapi/linux/rtnetlink.h | 1 +
 net/sched/act_api.c            | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 25a0af57dd5e..5ad3448a1fa7 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -789,6 +789,7 @@ enum {
 	TCA_ROOT_FLAGS,
 	TCA_ROOT_COUNT,
 	TCA_ROOT_TIME_DELTA, /* in msecs */
+	TCA_ACT_EXT_WARN_MSG,
 	__TCA_ROOT_MAX,
 #define	TCA_ROOT_MAX (__TCA_ROOT_MAX - 1)
 };
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index fce522886099..f960cb534ca0 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -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_ACT_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


  parent reply	other threads:[~2023-03-14  6:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14  6:58 [PATCH net 0/2] net/sched: fix parsing of TCA_EXT_WARN_MSG for tc action Hangbin Liu
2023-03-14  6:58 ` [PATCH net 1/2] Revert "net/sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy" Hangbin Liu
2023-03-14 22:32   ` Jamal Hadi Salim
2023-03-14  6:58 ` Hangbin Liu [this message]
2023-03-14 22:35   ` [PATCH net 2/2] net/sched: act_api: add specific EXT_WARN_MSG for tc action Jamal Hadi Salim
2023-03-15  9:47     ` Hangbin Liu
2023-03-15 18:49       ` Jamal Hadi Salim
2023-03-16  3:33         ` Hangbin Liu
2023-03-16  9:39           ` Jamal Hadi Salim
2023-03-15  7:45   ` Jakub Kicinski
2023-03-15  9:39     ` Hangbin Liu
2023-03-15 18:47       ` Jamal Hadi Salim
2023-03-14  7:04 ` [PATCH iproute2 1/2] Revert "tc: m_action: fix parsing of TCA_EXT_WARN_MSG" Hangbin Liu
2023-03-14 12:10   ` Andrea Claudi
2023-03-15  7:46   ` Jakub Kicinski
2023-03-15  9:31     ` Hangbin Liu
2023-03-14  7:08 ` [PATCH iproute2 2/2] tc: m_action: fix parsing of TCA_EXT_WARN_MSG by using different enum Hangbin Liu
2023-03-14  9:22   ` Davide Caratti
2023-03-14  9:20 ` [PATCH net 0/2] net/sched: fix parsing of TCA_EXT_WARN_MSG for tc action Davide Caratti
2023-03-14 10:15   ` 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=20230314065802.1532741-3-liuhangbin@gmail.com \
    --to=liuhangbin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=mleitner@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pctammela@mojatatu.com \
    --cc=psutter@redhat.com \
    --cc=stephen@networkplumber.org \
    --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;
as well as URLs for NNTP newsgroup(s).