net: ndo_bridge_setlink: Add extack
authorPetr Machata <petrm@mellanox.com>
Wed, 12 Dec 2018 17:02:48 +0000 (17:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Dec 2018 00:34:21 +0000 (16:34 -0800)
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 <petrm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/ice/ice_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
include/linux/netdevice.h
net/bridge/br_netlink.c
net/bridge/br_private.h
net/core/rtnetlink.c

index f4f29939ba72663711259030c755f557496a549f..8a2e9cdd38ee813d7bfafdbbf15696fa816e846a 100644 (file)
@@ -9618,7 +9618,7 @@ static int bnxt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 }
 
 static int bnxt_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
-                              u16 flags)
+                              u16 flags, struct netlink_ext_ack *extack)
 {
        struct bnxt *bp = netdev_priv(dev);
        struct nlattr *attr, *br_spec;
index 245abf0d19c0016df7f651844f1f02fffa343458..852f5bfe5f6df4be4606663650daf9fddad20043 100644 (file)
@@ -4955,7 +4955,7 @@ fw_exit:
 }
 
 static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
-                                u16 flags)
+                                u16 flags, struct netlink_ext_ack *extack)
 {
        struct be_adapter *adapter = netdev_priv(dev);
        struct nlattr *attr, *br_spec;
index 6d5b13f69deceb58084412f4dfd3f36e9976f8e1..fbb21ac06c9806dd41680fef976c1db0c741e069 100644 (file)
@@ -11685,6 +11685,7 @@ static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
  * @dev: the netdev being configured
  * @nlh: RTNL message
  * @flags: bridge flags
+ * @extack: netlink extended ack
  *
  * Inserts a new hardware bridge if not already created and
  * enables the bridging mode requested (VEB or VEPA). If the
@@ -11697,7 +11698,8 @@ static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
  **/
 static int i40e_ndo_bridge_setlink(struct net_device *dev,
                                   struct nlmsghdr *nlh,
-                                  u16 flags)
+                                  u16 flags,
+                                  struct netlink_ext_ack *extack)
 {
        struct i40e_netdev_priv *np = netdev_priv(dev);
        struct i40e_vsi *vsi = np->vsi;
index e45e57499d9193a027f0916391adf21a08453924..f9f0d470412bf1fd061bcf0a9b2b5f39f79bf018 100644 (file)
@@ -3624,6 +3624,7 @@ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode)
  * @dev: the netdev being configured
  * @nlh: RTNL message
  * @flags: bridge setlink flags
+ * @extack: netlink extended ack
  *
  * Sets the bridge mode (VEB/VEPA) of the switch to which the netdev (VSI) is
  * hooked up to. Iterates through the PF VSI list and sets the loopback mode (if
@@ -3632,7 +3633,7 @@ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode)
  */
 static int
 ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
-                  u16 __always_unused flags)
+                  u16 __always_unused flags, struct netlink_ext_ack *extack)
 {
        struct ice_netdev_priv *np = netdev_priv(dev);
        struct ice_pf *pf = np->vsi->back;
index 49a4ea38eb070a7352eea1756ea5c34ba77b04e1..f1e40734c975481dd07428a61b52d468ff0dd531 100644 (file)
@@ -9979,7 +9979,8 @@ static int ixgbe_configure_bridge_mode(struct ixgbe_adapter *adapter,
 }
 
 static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
-                                   struct nlmsghdr *nlh, u16 flags)
+                                   struct nlmsghdr *nlh, u16 flags,
+                                   struct netlink_ext_ack *extack)
 {
        struct ixgbe_adapter *adapter = netdev_priv(dev);
        struct nlattr *attr, *br_spec;
index fc6ba71513be35cdcbc2bf288b51cdf27a09297d..36ca5f50f8226f1469eed58e38e57681f8179b4a 100644 (file)
@@ -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,8 @@ struct net_device_ops {
 
        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,
index ff2c10d47529303cbc8ca5c3bbed3cb89771a5d8..f9be70b2609106793ef4bbf75f33ad67383bc4be 100644 (file)
@@ -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];
index 5719b4d3e4668a9cbe29eaee856de930e6795bca..090dfacdc4381102fb87eebf93e24b7a16ad46c9 100644 (file)
@@ -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);
index c9c0407a7ee0d0de62ea14c1a652d132c3556e4b..3b6e551f9e694b92153badca8e564f1bd1b7ea75 100644 (file)
@@ -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;