lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZE9ij6it2lvS0SFB@shredder>
Date:   Mon, 1 May 2023 09:56:15 +0300
From:   Ido Schimmel <idosch@...sch.org>
To:     Zahari Doychev <zahari.doychev@...ux.com>
Cc:     netdev@...r.kernel.org, jhs@...atatu.com, xiyou.wangcong@...il.com,
        jiri@...nulli.us, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, pabeni@...hat.com, hmehrtens@...linear.com,
        aleksander.lobakin@...el.com, simon.horman@...igine.com,
        Zahari Doychev <zdoychev@...linear.com>
Subject: Re: [PATCH net-next v4 2/3] net: flower: add support for matching
 cfm fields

On Sun, Apr 30, 2023 at 06:35:13PM +0200, Zahari Doychev wrote:
> On Sun, Apr 30, 2023 at 05:49:57PM +0300, Ido Schimmel wrote:
> > On Tue, Apr 25, 2023 at 11:16:29PM +0200, Zahari Doychev wrote:
> > > +static const struct nla_policy cfm_opt_policy[TCA_FLOWER_KEY_CFM_OPT_MAX] = {
> > > +	[TCA_FLOWER_KEY_CFM_MD_LEVEL]	= NLA_POLICY_MAX(NLA_U8, 7),
> > 
> > Instead of 7, can you use FIELD_MAX(FLOW_DIS_CFM_MDL_MASK) like you did
> > in the previous version?
> > 
> 
> It seems that the macro can be use only inside functions. I wanted to use it
> but I was getting the following error:
> 
> linux/include/linux/bitfield.h:86:9: error: braced-group within expression allowed only inside a function

I see. Another option that I personally find better than hard-coding 7
is the below:

diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index 479b66b11d2d..52f30906b210 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -317,6 +317,7 @@ struct flow_dissector_key_cfm {
 };
 
 #define FLOW_DIS_CFM_MDL_MASK GENMASK(7, 5)
+#define FLOW_DIS_CFM_MDL_MAX 7
 
 enum flow_dissector_key_id {
        FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 5d77da484a88..85fc77063866 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -772,7 +772,8 @@ mpls_stack_entry_policy[TCA_FLOWER_KEY_MPLS_OPT_LSE_MAX + 1] = {
 };
 
 static const struct nla_policy cfm_opt_policy[TCA_FLOWER_KEY_CFM_OPT_MAX] = {
-       [TCA_FLOWER_KEY_CFM_MD_LEVEL]   = NLA_POLICY_MAX(NLA_U8, 7),
+       [TCA_FLOWER_KEY_CFM_MD_LEVEL]   = NLA_POLICY_MAX(NLA_U8,
+                                                        FLOW_DIS_CFM_MDL_MAX),
        [TCA_FLOWER_KEY_CFM_OPCODE]     = { .type = NLA_U8 },
 };

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ