From: Ido Schimmel <idosch@idosch.org>
To: Zahari Doychev <zahari.doychev@linux.com>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
hmehrtens@maxlinear.com, aleksander.lobakin@intel.com,
simon.horman@corigine.com,
Zahari Doychev <zdoychev@maxlinear.com>
Subject: Re: [PATCH net-next v4 2/3] net: flower: add support for matching cfm fields
Date: Mon, 1 May 2023 09:56:15 +0300 [thread overview]
Message-ID: <ZE9ij6it2lvS0SFB@shredder> (raw)
In-Reply-To: <yabevxsc5uqezsjwjalqbnliu2yspl3v2drspd5a6a76nxdjon@47q7jzo2r3bl>
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 },
};
next prev parent reply other threads:[~2023-05-01 6:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-25 21:16 [PATCH net-next v4 0/3] net: flower: add cfm support Zahari Doychev
2023-04-25 21:16 ` [PATCH net-next v4 1/3] net: flow_dissector: add support for cfm packets Zahari Doychev
2023-04-30 14:32 ` Ido Schimmel
2023-04-30 16:33 ` Zahari Doychev
2023-04-25 21:16 ` [PATCH net-next v4 2/3] net: flower: add support for matching cfm fields Zahari Doychev
2023-04-30 14:49 ` Ido Schimmel
2023-04-30 16:35 ` Zahari Doychev
2023-05-01 6:56 ` Ido Schimmel [this message]
2023-05-03 20:15 ` Zahari Doychev
2023-04-25 21:16 ` [PATCH net-next v4 3/3] selftests: net: add tc flower cfm test Zahari Doychev
2023-04-30 15:01 ` Ido Schimmel
2023-04-30 16:37 ` Zahari Doychev
2023-04-26 7:22 ` [PATCH net-next v4 0/3] net: flower: add cfm support Leon Romanovsky
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=ZE9ij6it2lvS0SFB@shredder \
--to=idosch@idosch.org \
--cc=aleksander.lobakin@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hmehrtens@maxlinear.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=simon.horman@corigine.com \
--cc=xiyou.wangcong@gmail.com \
--cc=zahari.doychev@linux.com \
--cc=zdoychev@maxlinear.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.