From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikolay Aleksandrov Subject: Re: [PATCH net-next 1/9] net: ndo_bridge_setlink: Add extack Date: Wed, 12 Dec 2018 14:26:48 +0200 Message-ID: <9121d1c9-122e-a45e-4c51-9df7e8e06f9c@cumulusnetworks.com> References: <2eefe68d8d5441b25eb9a75570c4725877e117b6.1544614445.git.petrm@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Jiri Pirko , Ido Schimmel , "davem@davemloft.net" , "ivecera@redhat.com" To: Petr Machata , "netdev@vger.kernel.org" Return-path: Received: from mail-wm1-f68.google.com ([209.85.128.68]:50644 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727155AbeLLM0w (ORCPT ); Wed, 12 Dec 2018 07:26:52 -0500 Received: by mail-wm1-f68.google.com with SMTP id n190so5597686wmd.0 for ; Wed, 12 Dec 2018 04:26:50 -0800 (PST) In-Reply-To: <2eefe68d8d5441b25eb9a75570c4725877e117b6.1544614445.git.petrm@mellanox.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 12/12/2018 13:52, Petr Machata wrote: > Drivers may not be able to implement a VLAN addition or reconfiguration. > In those cases it's desirable to explain to the user that it was > rejected (and why). > > To that end, add extack argument to ndo_bridge_setlink. Adapt all users > to that change. > > Following patches will use the new argument in the bridge driver. > > Signed-off-by: Petr Machata > Acked-by: Jiri Pirko > --- > drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- > drivers/net/ethernet/emulex/benet/be_main.c | 2 +- > drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +++- > drivers/net/ethernet/intel/ice/ice_main.c | 3 ++- > drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- > include/linux/netdevice.h | 6 ++++-- > net/bridge/br_netlink.c | 3 ++- > net/bridge/br_private.h | 3 ++- > net/core/rtnetlink.c | 6 ++++-- > 9 files changed, 21 insertions(+), 11 deletions(-) > [snip] > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h > index fc6ba71513be..d8046696d27b 100644 > --- a/include/linux/netdevice.h > +++ b/include/linux/netdevice.h > @@ -1165,7 +1165,7 @@ struct dev_ifalias { > * entries to skb and update idx with the number of entries. > * > * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh, > - * u16 flags) > + * u16 flags, struct netlink_ext_ack *extack) > * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, > * struct net_device *dev, u32 filter_mask, > * int nlflags) > @@ -1390,7 +1390,9 @@ struct net_device_ops { > > int (*ndo_bridge_setlink)(struct net_device *dev, > struct nlmsghdr *nlh, > - u16 flags); > + u16 flags, > + struct netlink_ext_ack * > + extack); IMO it's better to have struct netlink_ext_ack and extack on the same line even if it goes a little over 80 here, it is normal for netdevice ops and wouldn't be the first (check below or above). At first I thought the arg name is missing. :) > int (*ndo_bridge_getlink)(struct sk_buff *skb, > u32 pid, u32 seq, > struct net_device *dev, > diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c > index ff2c10d47529..f9be70b26091 100644 > --- a/net/bridge/br_netlink.c > +++ b/net/bridge/br_netlink.c > @@ -850,7 +850,8 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[]) > } > > /* Change state and parameters on port. */ > -int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags) > +int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags, > + struct netlink_ext_ack *extack) > { > struct net_bridge *br = (struct net_bridge *)netdev_priv(dev); > struct nlattr *tb[IFLA_BRPORT_MAX + 1]; > diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h > index 5719b4d3e466..090dfacdc438 100644 > --- a/net/bridge/br_private.h > +++ b/net/bridge/br_private.h > @@ -1138,7 +1138,8 @@ int br_netlink_init(void); > void br_netlink_fini(void); > void br_ifinfo_notify(int event, const struct net_bridge *br, > const struct net_bridge_port *port); > -int br_setlink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags); > +int br_setlink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags, > + struct netlink_ext_ack *extack); > int br_dellink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags); > int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev, > u32 filter_mask, int nlflags); > diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c > index c9c0407a7ee0..3b6e551f9e69 100644 > --- a/net/core/rtnetlink.c > +++ b/net/core/rtnetlink.c > @@ -4332,7 +4332,8 @@ static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, > goto out; > } > > - err = br_dev->netdev_ops->ndo_bridge_setlink(dev, nlh, flags); > + err = br_dev->netdev_ops->ndo_bridge_setlink(dev, nlh, flags, > + extack); > if (err) > goto out; > > @@ -4344,7 +4345,8 @@ static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, > err = -EOPNOTSUPP; > else > err = dev->netdev_ops->ndo_bridge_setlink(dev, nlh, > - flags); > + flags, > + extack); > if (!err) { > flags &= ~BRIDGE_FLAGS_SELF; > >