On Tue, Feb 26, 2019 at 5:51 AM Petr Machata <pe...@mellanox.com> wrote:
>
>
> Roopa Prabhu <ro...@cumulusnetworks.com> writes:
>
> > From: Roopa Prabhu <ro...@cumulusnetworks.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 <ro...@cumulusnetworks.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 <pe...@mellanox.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.

Reply via email to