net: dsa: slave: Handle switchdev host mdb add/del
authorAndrew Lunn <andrew@lunn.ch>
Thu, 9 Nov 2017 22:11:00 +0000 (23:11 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Nov 2017 04:41:40 +0000 (13:41 +0900)
Add code to handle switchdev host mdb add/del. Since DSA uses one of
the switch ports as a transport to the host, we just need to add an
MDB on this port.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/slave.c

index cc7fe47dd4bffcb37cc87312b94af2dff95ae0c9..35715fda84b2e95b4506af0200d8c95055d8377a 100644 (file)
@@ -304,6 +304,13 @@ static int dsa_slave_port_obj_add(struct net_device *dev,
        case SWITCHDEV_OBJ_ID_PORT_MDB:
                err = dsa_port_mdb_add(dp, SWITCHDEV_OBJ_PORT_MDB(obj), trans);
                break;
+       case SWITCHDEV_OBJ_ID_HOST_MDB:
+               /* DSA can directly translate this to a normal MDB add,
+                * but on the CPU port.
+                */
+               err = dsa_port_mdb_add(dp->cpu_dp, SWITCHDEV_OBJ_PORT_MDB(obj),
+                                      trans);
+               break;
        case SWITCHDEV_OBJ_ID_PORT_VLAN:
                err = dsa_port_vlan_add(dp, SWITCHDEV_OBJ_PORT_VLAN(obj),
                                        trans);
@@ -326,6 +333,12 @@ static int dsa_slave_port_obj_del(struct net_device *dev,
        case SWITCHDEV_OBJ_ID_PORT_MDB:
                err = dsa_port_mdb_del(dp, SWITCHDEV_OBJ_PORT_MDB(obj));
                break;
+       case SWITCHDEV_OBJ_ID_HOST_MDB:
+               /* DSA can directly translate this to a normal MDB add,
+                * but on the CPU port.
+                */
+               err = dsa_port_mdb_del(dp->cpu_dp, SWITCHDEV_OBJ_PORT_MDB(obj));
+               break;
        case SWITCHDEV_OBJ_ID_PORT_VLAN:
                err = dsa_port_vlan_del(dp, SWITCHDEV_OBJ_PORT_VLAN(obj));
                break;