Skip to content

Commit 65aebfc

Browse files
viviendavem330
authored andcommitted
net: dsa: add port_vlan_dump routine
Similar to port_fdb_dump, add a port_vlan_dump function to DSA drivers which gets passed the switchdev VLAN object and callback. This function, if implemented, takes precedence over the soon legacy vlan_getnext/port_pvid_get approach. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2a04c7b commit 65aebfc

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Documentation/networking/dsa/dsa.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,10 @@ Bridge VLAN filtering
554554
- port_vlan_del: bridge layer function invoked when a VLAN is removed from the
555555
given switch port
556556

557+
- port_vlan_dump: bridge layer function invoked with a switchdev callback
558+
function that the driver has to call for each VLAN the given port is a member
559+
of. A switchdev object is used to carry the VID and bridge flags.
560+
557561
- vlan_getnext: bridge layer function invoked to query the next configured VLAN
558562
in the switch, i.e. returns the bitmaps of members and untagged ports
559563

include/net/dsa.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ struct dsa_switch_driver {
313313
struct switchdev_trans *trans);
314314
int (*port_vlan_del)(struct dsa_switch *ds, int port,
315315
const struct switchdev_obj_port_vlan *vlan);
316+
int (*port_vlan_dump)(struct dsa_switch *ds, int port,
317+
struct switchdev_obj_port_vlan *vlan,
318+
int (*cb)(struct switchdev_obj *obj));
316319
int (*port_pvid_get)(struct dsa_switch *ds, int port, u16 *pvid);
317320
int (*vlan_getnext)(struct dsa_switch *ds, u16 *vid,
318321
unsigned long *ports, unsigned long *untagged);

net/dsa/slave.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ static int dsa_slave_port_vlan_dump(struct net_device *dev,
248248
u16 pvid, vid = 0;
249249
int err;
250250

251+
if (ds->drv->port_vlan_dump)
252+
return ds->drv->port_vlan_dump(ds, p->port, vlan, cb);
253+
251254
if (!ds->drv->vlan_getnext || !ds->drv->port_pvid_get)
252255
return -EOPNOTSUPP;
253256

0 commit comments

Comments
 (0)