Skip to content

Commit 5f4dbc5

Browse files
lunndavem330
authored andcommitted
net: dsa: slave: Handle switchdev host mdb add/del
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 47d5b6d commit 5f4dbc5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

net/dsa/slave.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ static int dsa_slave_port_obj_add(struct net_device *dev,
304304
case SWITCHDEV_OBJ_ID_PORT_MDB:
305305
err = dsa_port_mdb_add(dp, SWITCHDEV_OBJ_PORT_MDB(obj), trans);
306306
break;
307+
case SWITCHDEV_OBJ_ID_HOST_MDB:
308+
/* DSA can directly translate this to a normal MDB add,
309+
* but on the CPU port.
310+
*/
311+
err = dsa_port_mdb_add(dp->cpu_dp, SWITCHDEV_OBJ_PORT_MDB(obj),
312+
trans);
313+
break;
307314
case SWITCHDEV_OBJ_ID_PORT_VLAN:
308315
err = dsa_port_vlan_add(dp, SWITCHDEV_OBJ_PORT_VLAN(obj),
309316
trans);
@@ -326,6 +333,12 @@ static int dsa_slave_port_obj_del(struct net_device *dev,
326333
case SWITCHDEV_OBJ_ID_PORT_MDB:
327334
err = dsa_port_mdb_del(dp, SWITCHDEV_OBJ_PORT_MDB(obj));
328335
break;
336+
case SWITCHDEV_OBJ_ID_HOST_MDB:
337+
/* DSA can directly translate this to a normal MDB add,
338+
* but on the CPU port.
339+
*/
340+
err = dsa_port_mdb_del(dp->cpu_dp, SWITCHDEV_OBJ_PORT_MDB(obj));
341+
break;
329342
case SWITCHDEV_OBJ_ID_PORT_VLAN:
330343
err = dsa_port_vlan_del(dp, SWITCHDEV_OBJ_PORT_VLAN(obj));
331344
break;

0 commit comments

Comments
 (0)