[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJieiUhKFrhoMcy-Bz1JmWEQ=8OooeZpb_sbD6zcKwotfJooBQ@mail.gmail.com>
Date: Tue, 26 Feb 2019 06:06:20 -0800
From: Roopa Prabhu <roopa@...ulusnetworks.com>
To: Petr Machata <petrm@...lanox.com>
Cc: "davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"dsa@...ulusnetworks.com" <dsa@...ulusnetworks.com>,
"sd@...asysnail.net" <sd@...asysnail.net>,
"johannes@...solutions.net" <johannes@...solutions.net>
Subject: Re: [PATCH net-next 1/2] vxlan: add extack support for create and changelink
On Tue, Feb 26, 2019 at 5:51 AM Petr Machata <petrm@...lanox.com> wrote:
>
>
> Roopa Prabhu <roopa@...ulusnetworks.com> writes:
>
> > From: Roopa Prabhu <roopa@...ulusnetworks.com>
> >
> > This patch adds extack coverage in vxlan link
> > create and changelink paths. Introduces a new helper
> > vxlan_nl2flags to consolidate flag attribute validation.
> >
> > thanks to Johannes Berg for some tips to construct the
> > generic vxlan flag extack strings.
> >
> > Signed-off-by: Roopa Prabhu <roopa@...ulusnetworks.com>
> > ---
> > drivers/net/vxlan.c | 208 +++++++++++++++++++++++++++++++++++-----------------
> > include/net/vxlan.h | 31 ++++++++
> > 2 files changed, 172 insertions(+), 67 deletions(-)
> >
> > diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> > index 577201c..a3c46d7 100644
> > --- a/drivers/net/vxlan.c
> > +++ b/drivers/net/vxlan.c
> > @@ -3583,11 +3583,40 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
> > return err;
> > }
> >
> > +/* Set/clear flags based on attribute */
> > +static int vxlan_nl2flag(struct vxlan_config *conf, struct nlattr *tb[],
> > + int attrtype, unsigned long mask, bool changelink,
> > + bool changelink_supported,
> > + struct netlink_ext_ack *extack)
> > +{
> > + unsigned long flags;
> > +
> > + if (!tb[attrtype])
> > + return 0;
> > +
> > + if (changelink && !changelink_supported) {
> > + vxlan_flag_attr_error(attrtype, extack);
> > + return -EOPNOTSUPP;
> > + }
> > +
> > + if (vxlan_policy[attrtype].type == NLA_FLAG)
> > + flags = conf->flags | mask;
> > + else if (nla_get_u8(tb[attrtype]))
> > + flags = conf->flags | mask;
> > + else
> > + flags = conf->flags & ~mask;
>
> Many of the flags for which you call this don't actually have the else
> branch. However I suspect there are no good reasons not to allow
> resetting a flag.
>
> Reviewed-by: Petr Machata <petrm@...lanox.com>
yes, correct, that was intentional.
also, I am not sure what is the best way to support reseting of a NLA_FLAG.
Absence of the flag attribute in the request cannot be the reason for
resetting or clearing the flag.
None of the NLA_FLAG attributes support changing the flag today. This
patch does not change that.
Powered by blists - more mailing lists