net: dsa: add port_vlan_dump routine
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Tue, 23 Feb 2016 17:13:54 +0000 (12:13 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Feb 2016 20:20:20 +0000 (15:20 -0500)
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 <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/dsa/dsa.txt
include/net/dsa.h
net/dsa/slave.c

index ebf21530471f5b3e10ad33487b664f79bc53eb1a..350a502e031f0fed31b7ae6286aa619ea383e8b3 100644 (file)
@@ -554,6 +554,10 @@ Bridge VLAN filtering
 - port_vlan_del: bridge layer function invoked when a VLAN is removed from the
   given switch port
 
+- port_vlan_dump: bridge layer function invoked with a switchdev callback
+  function that the driver has to call for each VLAN the given port is a member
+  of. A switchdev object is used to carry the VID and bridge flags.
+
 - vlan_getnext: bridge layer function invoked to query the next configured VLAN
   in the switch, i.e. returns the bitmaps of members and untagged ports
 
index 1c845d7bf0b2d5979a34aa74e71ea30dd6513a17..ebc0d9ea96a1a1f217333721deede7f78dd27f76 100644 (file)
@@ -313,6 +313,9 @@ struct dsa_switch_driver {
                                 struct switchdev_trans *trans);
        int     (*port_vlan_del)(struct dsa_switch *ds, int port,
                                 const struct switchdev_obj_port_vlan *vlan);
+       int     (*port_vlan_dump)(struct dsa_switch *ds, int port,
+                                 struct switchdev_obj_port_vlan *vlan,
+                                 int (*cb)(struct switchdev_obj *obj));
        int     (*port_pvid_get)(struct dsa_switch *ds, int port, u16 *pvid);
        int     (*vlan_getnext)(struct dsa_switch *ds, u16 *vid,
                                unsigned long *ports, unsigned long *untagged);
index 14ca9784ec0c9bdc5c2322266eda0abd3bc5e3c1..a9cbb72fb155a827079fddeeb2fd2e4e649c9dbd 100644 (file)
@@ -248,6 +248,9 @@ static int dsa_slave_port_vlan_dump(struct net_device *dev,
        u16 pvid, vid = 0;
        int err;
 
+       if (ds->drv->port_vlan_dump)
+               return ds->drv->port_vlan_dump(ds, p->port, vlan, cb);
+
        if (!ds->drv->vlan_getnext || !ds->drv->port_pvid_get)
                return -EOPNOTSUPP;
 
This page took 0.049652 seconds and 5 git commands to generate.