diff mbox

[net-next,3/3] net: dsa: drop vlan_getnext

Message ID 1456247636-4706-4-git-send-email-vivien.didelot@savoirfairelinux.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Vivien Didelot Feb. 23, 2016, 5:13 p.m. UTC
The VLAN GetNext operation is specific to some switches, and thus can be
complicated to implement for some drivers.

Remove the support for the vlan_getnext/port_pvid_get approach in favor
of the generic and simpler port_vlan_dump function.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 Documentation/networking/dsa/dsa.txt |  9 ---------
 include/net/dsa.h                    |  3 ---
 net/dsa/slave.c                      | 35 +----------------------------------
 3 files changed, 1 insertion(+), 46 deletions(-)

Comments

kernel test robot Feb. 23, 2016, 5:29 p.m. UTC | #1
Hi Vivien,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Vivien-Didelot/net-dsa-add-port_vlan_dump-routine/20160224-011644
config: i386-randconfig-x008-201608 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   net/dsa/slave.c: In function 'dsa_bridge_check_vlan_range':
>> net/dsa/slave.c:215:14: error: 'struct dsa_switch_driver' has no member named 'vlan_getnext'
     if (!ds->drv->vlan_getnext || !vid_begin)
                 ^
   net/dsa/slave.c:221:16: error: 'struct dsa_switch_driver' has no member named 'vlan_getnext'
      err = ds->drv->vlan_getnext(ds, &vid, members, untagged);
                   ^

vim +215 net/dsa/slave.c

11149536 Vivien Didelot 2015-08-13  209  	struct net_device *dev, *vlan_br;
11149536 Vivien Didelot 2015-08-13  210  	DECLARE_BITMAP(members, DSA_MAX_PORTS);
11149536 Vivien Didelot 2015-08-13  211  	DECLARE_BITMAP(untagged, DSA_MAX_PORTS);
11149536 Vivien Didelot 2015-08-13  212  	u16 vid;
11149536 Vivien Didelot 2015-08-13  213  	int member, err;
11149536 Vivien Didelot 2015-08-13  214  
11149536 Vivien Didelot 2015-08-13 @215  	if (!ds->drv->vlan_getnext || !vid_begin)
11149536 Vivien Didelot 2015-08-13  216  		return -EOPNOTSUPP;
11149536 Vivien Didelot 2015-08-13  217  
11149536 Vivien Didelot 2015-08-13  218  	vid = vid_begin - 1;

:::::: The code at line 215 was first introduced by commit
:::::: 111495361598205967f1be4e07d4726b0f762d60 net: dsa: add support for switchdev VLAN objects

:::::: TO: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Vivien Didelot Feb. 23, 2016, 5:55 p.m. UTC | #2
kbuild test robot <lkp@intel.com> writes:

> All errors (new ones prefixed by >>):
>
>    net/dsa/slave.c: In function 'dsa_bridge_check_vlan_range':
>>> net/dsa/slave.c:215:14: error: 'struct dsa_switch_driver' has no member named 'vlan_getnext'

Indeed this applies on an under-review patchset mentioned in the cover
letter, which removes the dsa_bridge_check_vlan_range function above:

https://patchwork.ozlabs.org/patch/582234/

Even though the 2 patchsets cover different semantics, I can resend them
in a single one if necessary.

Thanks,
-v
diff mbox

Patch

diff --git a/Documentation/networking/dsa/dsa.txt b/Documentation/networking/dsa/dsa.txt
index 350a502..974e9c3 100644
--- a/Documentation/networking/dsa/dsa.txt
+++ b/Documentation/networking/dsa/dsa.txt
@@ -542,12 +542,6 @@  Bridge layer
 Bridge VLAN filtering
 ---------------------
 
-- port_pvid_get: bridge layer function invoked when a Port-based VLAN ID is
-  queried for the given switch port
-
-- port_pvid_set: bridge layer function invoked when a Port-based VLAN ID needs
-  to be configured on the given switch port
-
 - port_vlan_add: bridge layer function invoked when a VLAN is configured
   (tagged or untagged) for the given switch port
 
@@ -558,9 +552,6 @@  Bridge VLAN filtering
   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
-
 - port_fdb_add: bridge layer function invoked when the bridge wants to install a
   Forwarding Database entry, the switch hardware should be programmed with the
   specified address in the specified VLAN Id in the forwarding database
diff --git a/include/net/dsa.h b/include/net/dsa.h
index ebc0d9e..3dd5486 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -316,9 +316,6 @@  struct dsa_switch_driver {
 	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);
 
 	/*
 	 * Forwarding database
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index a9cbb72..cde2923 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -243,44 +243,11 @@  static int dsa_slave_port_vlan_dump(struct net_device *dev,
 {
 	struct dsa_slave_priv *p = netdev_priv(dev);
 	struct dsa_switch *ds = p->parent;
-	DECLARE_BITMAP(members, DSA_MAX_PORTS);
-	DECLARE_BITMAP(untagged, DSA_MAX_PORTS);
-	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;
-
-	err = ds->drv->port_pvid_get(ds, p->port, &pvid);
-	if (err)
-		return err;
-
-	for (;;) {
-		err = ds->drv->vlan_getnext(ds, &vid, members, untagged);
-		if (err)
-			break;
-
-		if (!test_bit(p->port, members))
-			continue;
-
-		memset(vlan, 0, sizeof(*vlan));
-		vlan->vid_begin = vlan->vid_end = vid;
-
-		if (vid == pvid)
-			vlan->flags |= BRIDGE_VLAN_INFO_PVID;
-
-		if (test_bit(p->port, untagged))
-			vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED;
-
-		err = cb(&vlan->obj);
-		if (err)
-			break;
-	}
-
-	return err == -ENOENT ? 0 : err;
+	return -EOPNOTSUPP;
 }
 
 static int dsa_slave_port_fdb_add(struct net_device *dev,