[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <qgobhbt3abx5o5js6czejn2hiol7lfkyfyhptghexpkm2f2me7@xzzjtzpipy6p>
Date: Wed, 19 Apr 2023 18:39:47 +0200
From: Zahari Doychev <zahari.doychev@...ux.com>
To: Ido Schimmel <idosch@...sch.org>
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 v3 2/3] net: flower: add support for matching
cfm fields
On Wed, Apr 19, 2023 at 06:20:57PM +0300, Ido Schimmel wrote:
> On Mon, Apr 17, 2023 at 11:32:32PM +0200, Zahari Doychev wrote:
> > +static const struct nla_policy cfm_opt_policy[TCA_FLOWER_KEY_CFM_OPT_MAX] = {
> > + [TCA_FLOWER_KEY_CFM_MD_LEVEL] = { .type = NLA_U8 },
> > + [TCA_FLOWER_KEY_CFM_OPCODE] = { .type = NLA_U8 },
> > +};
>
> [...]
>
> > +static int fl_set_key_cfm_md_level(struct nlattr **tb,
> > + struct fl_flow_key *key,
> > + struct fl_flow_key *mask,
> > + struct netlink_ext_ack *extack)
> > +{
> > + u8 level;
> > +
> > + if (!tb[TCA_FLOWER_KEY_CFM_MD_LEVEL])
> > + return 0;
> > +
> > + level = nla_get_u8(tb[TCA_FLOWER_KEY_CFM_MD_LEVEL]);
> > + if (level & ~FIELD_MAX(FLOW_DIS_CFM_MDL_MASK)) {
> > + NL_SET_ERR_MSG_ATTR(extack, tb[TCA_FLOWER_KEY_CFM_MD_LEVEL],
> > + "cfm md level must be in [0, 7]");
> > + return -EINVAL;
> > + }
>
> You should be able to replace this with NLA_POLICY_MAX()
ok, I will change it in the next version.
thanks
Zahari
>
> > +
> > + key->cfm.mdl_ver = FIELD_PREP(FLOW_DIS_CFM_MDL_MASK, level);
> > + mask->cfm.mdl_ver = FLOW_DIS_CFM_MDL_MASK;
> > +
> > + return 0;
> > +}
Powered by blists - more mailing lists