switchdev: add new switchdev_port_bridge_dellink
authorScott Feldman <sfeldma@gmail.com>
Sun, 10 May 2015 16:48:00 +0000 (09:48 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 May 2015 22:43:55 +0000 (18:43 -0400)
Same change as setlink.  Provide the wrapper op for SELF ndo_bridge_dellink
and call into the switchdev driver to delete afspec VLANs.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/switchdev.h
net/switchdev/switchdev.c

index ce5ceb2dc677addfae2617d93cfb76114897cb00..8ffadca9e760c187c8f4cd473c30cd9cb2b6b45e 100644 (file)
@@ -164,6 +164,12 @@ static inline int switchdev_port_obj_del(struct net_device *dev,
        return -EOPNOTSUPP;
 }
 
+static inline int switchdev_port_bridge_dellink(struct net_device *dev,
+                                           struct nlmsghdr *nlh, u16 flags)
+{
+       return -EOPNOTSUPP;
+}
+
 static inline int register_switchdev_notifier(struct notifier_block *nb)
 {
        return 0;
index dcdec9de91373b335e42bd2b2300614b31353588..8ce678e397b4d90e40464f989e2b3a8576b1c4a4 100644 (file)
@@ -512,27 +512,27 @@ int switchdev_port_bridge_setlink(struct net_device *dev,
 EXPORT_SYMBOL_GPL(switchdev_port_bridge_setlink);
 
 /**
- *     switchdev_port_bridge_dellink - Notify switch device port of bridge
- *     port attribute delete
+ *     switchdev_port_bridge_dellink - Set bridge port attributes
  *
  *     @dev: port device
- *     @nlh: netlink msg with bridge port attributes
- *     @flags: bridge setlink flags
+ *     @nlh: netlink header
+ *     @flags: netlink flags
  *
- *     Notify switch device port of bridge port attribute delete
+ *     Called for SELF on rtnl_bridge_dellink to set bridge port
+ *     attributes.
  */
 int switchdev_port_bridge_dellink(struct net_device *dev,
                                  struct nlmsghdr *nlh, u16 flags)
 {
-       const struct net_device_ops *ops = dev->netdev_ops;
-
-       if (!(dev->features & NETIF_F_HW_SWITCH_OFFLOAD))
-               return 0;
+       struct nlattr *afspec;
 
-       if (!ops->ndo_bridge_dellink)
-               return -EOPNOTSUPP;
+       afspec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg),
+                                IFLA_AF_SPEC);
+       if (afspec)
+               return switchdev_port_br_afspec(dev, afspec,
+                                               switchdev_port_obj_del);
 
-       return ops->ndo_bridge_dellink(dev, nlh, flags);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(switchdev_port_bridge_dellink);