diff mbox series

[net-next] net: sched: alias action flags with TCA_ACT_ prefix

Message ID 20201121160902.808705-1-vlad@buslov.dev (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: sched: alias action flags with TCA_ACT_ prefix | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 6564 this patch: 6564
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 57 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 6985 this patch: 6985
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Vlad Buslov Nov. 21, 2020, 4:09 p.m. UTC
Currently both filter and action flags use same "TCA_" prefix which makes
them hard to distinguish to code and confusing for users. Create aliases
for existing action flags constants with "TCA_ACT_" prefix.

Signed-off-by: Vlad Buslov <vlad@buslov.dev>
---
 include/uapi/linux/rtnetlink.h | 11 +++++++----
 net/sched/act_api.c            | 10 +++++-----
 2 files changed, 12 insertions(+), 9 deletions(-)

Comments

Jamal Hadi Salim Nov. 23, 2020, 12:11 a.m. UTC | #1
On 2020-11-21 11:09 a.m., Vlad Buslov wrote:
> Currently both filter and action flags use same "TCA_" prefix which makes
> them hard to distinguish to code and confusing for users. Create aliases
> for existing action flags constants with "TCA_ACT_" prefix.
> 
> Signed-off-by: Vlad Buslov <vlad@buslov.dev>

LGTM, thanks for the effort
.
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal
Jakub Kicinski Nov. 23, 2020, 9:22 p.m. UTC | #2
On Sat, 21 Nov 2020 18:09:02 +0200 Vlad Buslov wrote:
> Currently both filter and action flags use same "TCA_" prefix which makes
> them hard to distinguish to code and confusing for users. Create aliases
> for existing action flags constants with "TCA_ACT_" prefix.
> 
> Signed-off-by: Vlad Buslov <vlad@buslov.dev>

Are we expecting to add both aliases for all new flags?

TCA_FLAG_TERSE_DUMP exists only in net-next, we could rename it, right?
Vlad Buslov Nov. 24, 2020, 9:28 a.m. UTC | #3
On Mon 23 Nov 2020 at 23:22, Jakub Kicinski <kuba@kernel.org> wrote:
> On Sat, 21 Nov 2020 18:09:02 +0200 Vlad Buslov wrote:
>> Currently both filter and action flags use same "TCA_" prefix which makes
>> them hard to distinguish to code and confusing for users. Create aliases
>> for existing action flags constants with "TCA_ACT_" prefix.
>> 
>> Signed-off-by: Vlad Buslov <vlad@buslov.dev>
>
> Are we expecting to add both aliases for all new flags?

I don't think it makes sense to have both aliases for any new flags.

>
> TCA_FLAG_TERSE_DUMP exists only in net-next, we could rename it, right?

You are right. I'll send a fix.
Jamal Hadi Salim Nov. 24, 2020, 1:39 p.m. UTC | #4
On 2020-11-24 4:28 a.m., Vlad Buslov wrote:
> On Mon 23 Nov 2020 at 23:22, Jakub Kicinski <kuba@kernel.org> wrote:
>> On Sat, 21 Nov 2020 18:09:02 +0200 Vlad Buslov wrote:
>>> Currently both filter and action flags use same "TCA_" prefix which makes
>>> them hard to distinguish to code and confusing for users. Create aliases
>>> for existing action flags constants with "TCA_ACT_" prefix.
>>>
>>> Signed-off-by: Vlad Buslov <vlad@buslov.dev>
>>
>> Are we expecting to add both aliases for all new flags?
> 
> I don't think it makes sense to have both aliases for any new flags.
> 

Agreed.

cheers,
jamal
Jakub Kicinski Nov. 24, 2020, 4:24 p.m. UTC | #5
On Tue, 24 Nov 2020 11:28:37 +0200 Vlad Buslov wrote:
> > TCA_FLAG_TERSE_DUMP exists only in net-next, we could rename it, right?  
> 
> You are right. I'll send a fix.

You mean v2, not a follow up, right? :)
Vlad Buslov Nov. 24, 2020, 4:39 p.m. UTC | #6
On Tue 24 Nov 2020 at 18:24, Jakub Kicinski <kuba@kernel.org> wrote:
> On Tue, 24 Nov 2020 11:28:37 +0200 Vlad Buslov wrote:
>> > TCA_FLAG_TERSE_DUMP exists only in net-next, we could rename it, right?  
>> 
>> You are right. I'll send a fix.
>
> You mean v2, not a follow up, right? :)

Yes. Sending the v2.
diff mbox series

Patch

diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 2ffbef5da6c1..91db081e5360 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -768,16 +768,19 @@  enum {
 #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg))
 /* tcamsg flags stored in attribute TCA_ROOT_FLAGS
  *
- * TCA_FLAG_LARGE_DUMP_ON user->kernel to request for larger than TCA_ACT_MAX_PRIO
- * actions in a dump. All dump responses will contain the number of actions
- * being dumped stored in for user app's consumption in TCA_ROOT_COUNT
+ * TCA_ACT_FLAG_LARGE_DUMP_ON user->kernel to request for larger than
+ * TCA_ACT_MAX_PRIO actions in a dump. All dump responses will contain the
+ * number of actions being dumped stored in for user app's consumption in
+ * TCA_ROOT_COUNT
  *
- * TCA_FLAG_TERSE_DUMP user->kernel to request terse (brief) dump that only
+ * TCA_ACT_FLAG_TERSE_DUMP user->kernel to request terse (brief) dump that only
  * includes essential action info (kind, index, etc.)
  *
  */
 #define TCA_FLAG_LARGE_DUMP_ON		(1 << 0)
+#define TCA_ACT_FLAG_LARGE_DUMP_ON	TCA_FLAG_LARGE_DUMP_ON
 #define TCA_FLAG_TERSE_DUMP		(1 << 1)
+#define TCA_ACT_FLAG_TERSE_DUMP		TCA_FLAG_TERSE_DUMP
 
 /* New extended info filters for IFLA_EXT_MASK */
 #define RTEXT_FILTER_VF		(1 << 0)
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index fc23f46a315c..99db1c77426b 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -278,7 +278,7 @@  static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
 			index--;
 			goto nla_put_failure;
 		}
-		err = (act_flags & TCA_FLAG_TERSE_DUMP) ?
+		err = (act_flags & TCA_ACT_FLAG_TERSE_DUMP) ?
 			tcf_action_dump_terse(skb, p, true) :
 			tcf_action_dump_1(skb, p, 0, 0);
 		if (err < 0) {
@@ -288,7 +288,7 @@  static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
 		}
 		nla_nest_end(skb, nest);
 		n_i++;
-		if (!(act_flags & TCA_FLAG_LARGE_DUMP_ON) &&
+		if (!(act_flags & TCA_ACT_FLAG_LARGE_DUMP_ON) &&
 		    n_i >= TCA_ACT_MAX_PRIO)
 			goto done;
 	}
@@ -298,7 +298,7 @@  static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
 
 	mutex_unlock(&idrinfo->lock);
 	if (n_i) {
-		if (act_flags & TCA_FLAG_LARGE_DUMP_ON)
+		if (act_flags & TCA_ACT_FLAG_LARGE_DUMP_ON)
 			cb->args[1] = n_i;
 	}
 	return n_i;
@@ -1473,8 +1473,8 @@  static int tcf_action_add(struct net *net, struct nlattr *nla,
 }
 
 static const struct nla_policy tcaa_policy[TCA_ROOT_MAX + 1] = {
-	[TCA_ROOT_FLAGS] = NLA_POLICY_BITFIELD32(TCA_FLAG_LARGE_DUMP_ON |
-						 TCA_FLAG_TERSE_DUMP),
+	[TCA_ROOT_FLAGS] = NLA_POLICY_BITFIELD32(TCA_ACT_FLAG_LARGE_DUMP_ON |
+						 TCA_ACT_FLAG_TERSE_DUMP),
 	[TCA_ROOT_TIME_DELTA]      = { .type = NLA_U32 },
 };