switchdev: Add support for flood control
authorIdo Schimmel <idosch@mellanox.com>
Wed, 28 Oct 2015 09:16:54 +0000 (10:16 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 30 Oct 2015 03:26:38 +0000 (12:26 +0900)
Allow devices supporting this feature to control the flooding of unknown
unicast traffic, by making switchdev infrastructure propagate this setting
to the switch driver.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/switchdev.txt
net/switchdev/switchdev.c

index 0714fe5550165ddc658432f7afdc4ce8e087f6c7..ce510e1a3e87cdaf9ca7620885a37cebfc132aaf 100644 (file)
@@ -298,6 +298,9 @@ packets up to the bridge driver for flooding.  This is not ideal as the number
 of ports scale in the L2 domain as the device is much more efficient at
 flooding packets that software.
 
+If supported by the device, flood control can be offloaded to it, preventing
+certain netdevs from flooding unicast traffic for which there is no FDB entry.
+
 IGMP Snooping
 ^^^^^^^^^^^^^
 
index 1eb76956b4390fef09825f38bda1f1b29a1ab352..8950d39af34182a2fd433676c03a459dfc5cf3e4 100644 (file)
@@ -746,7 +746,7 @@ int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
                .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
        };
        u16 mode = BRIDGE_MODE_UNDEF;
-       u32 mask = BR_LEARNING | BR_LEARNING_SYNC;
+       u32 mask = BR_LEARNING | BR_LEARNING_SYNC | BR_FLOOD;
        int err;
 
        err = switchdev_port_attr_get(dev, &attr);
@@ -817,6 +817,9 @@ static int switchdev_port_br_setlink_protinfo(struct net_device *dev,
                        err = switchdev_port_br_setflag(dev, attr,
                                                        BR_LEARNING_SYNC);
                        break;
+               case IFLA_BRPORT_UNICAST_FLOOD:
+                       err = switchdev_port_br_setflag(dev, attr, BR_FLOOD);
+                       break;
                default:
                        err = -EOPNOTSUPP;
                        break;