]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
bonding: handle NETIF_F_HW_SWITCH_OFFLOAD flag and add ndo_bridge_setlink/dellink...
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Fri, 30 Jan 2015 06:40:16 +0000 (22:40 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Feb 2015 07:16:34 +0000 (23:16 -0800)
We want bond to pick up the offload flag if any of its slaves have it.

NETIF_F_HW_SWITCH_OFFLOAD flag is added to the mask, so that
netdev_increment_features does not ignore it.

This also adds ndo_bridge_setlink and ndo_bridge_dellink handlers.
These currently point to the default handlers provided by the
switchdev api.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c

index e229a8657de829a423d3ed4b696346def8ded2d0..c9e519cb921412ac1e73d67a3a95be96c5c1c2ec 100644 (file)
@@ -77,6 +77,7 @@
 #include <net/pkt_sched.h>
 #include <linux/rculist.h>
 #include <net/flow_keys.h>
+#include <net/switchdev.h>
 #include <net/bonding.h>
 #include <net/bond_3ad.h>
 #include <net/bond_alb.h>
@@ -979,7 +980,11 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
        netdev_features_t mask;
        struct slave *slave;
 
-       mask = features;
+       /* If any slave has the offload feature flag set,
+        * set the offload flag on the bond.
+        */
+       mask = features | NETIF_F_HW_SWITCH_OFFLOAD;
+
        features &= ~NETIF_F_ONE_FOR_ALL;
        features |= NETIF_F_ALL_FOR_ALL;
 
@@ -3952,6 +3957,8 @@ static const struct net_device_ops bond_netdev_ops = {
        .ndo_add_slave          = bond_enslave,
        .ndo_del_slave          = bond_release,
        .ndo_fix_features       = bond_fix_features,
+       .ndo_bridge_setlink     = ndo_dflt_netdev_switch_port_bridge_setlink,
+       .ndo_bridge_dellink     = ndo_dflt_netdev_switch_port_bridge_dellink,
 };
 
 static const struct device_type bond_type = {