Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0b6b8c9 authored by Arkadi Sharshevsky's avatar Arkadi Sharshevsky Committed by David S. Miller
Browse files

net: dsa: Remove support for vlan dump from DSA's drivers



This is done as a preparation before removing support for vlan dump from
DSA core. The vlans are synced with the bridge and thus there is no
need for special dump operation support.

Signed-off-by: default avatarArkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c9e2105e
Loading
Loading
Loading
Loading
+0 −44
Original line number Diff line number Diff line
@@ -1053,49 +1053,6 @@ int b53_vlan_del(struct dsa_switch *ds, int port,
}
EXPORT_SYMBOL(b53_vlan_del);

int b53_vlan_dump(struct dsa_switch *ds, int port,
		  struct switchdev_obj_port_vlan *vlan,
		  switchdev_obj_dump_cb_t *cb)
{
	struct b53_device *dev = ds->priv;
	u16 vid, vid_start = 0, pvid;
	struct b53_vlan *vl;
	int err = 0;

	if (is5325(dev) || is5365(dev))
		vid_start = 1;

	b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &pvid);

	/* Use our software cache for dumps, since we do not have any HW
	 * operation returning only the used/valid VLANs
	 */
	for (vid = vid_start; vid < dev->num_vlans; vid++) {
		vl = &dev->vlans[vid];

		if (!vl->valid)
			continue;

		if (!(vl->members & BIT(port)))
			continue;

		vlan->vid_begin = vlan->vid_end = vid;
		vlan->flags = 0;

		if (vl->untag & BIT(port))
			vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED;
		if (pvid == vid)
			vlan->flags |= BRIDGE_VLAN_INFO_PVID;

		err = cb(&vlan->obj);
		if (err)
			break;
	}

	return err;
}
EXPORT_SYMBOL(b53_vlan_dump);

/* Address Resolution Logic routines */
static int b53_arl_op_wait(struct b53_device *dev)
{
@@ -1552,7 +1509,6 @@ static const struct dsa_switch_ops b53_switch_ops = {
	.port_vlan_prepare	= b53_vlan_prepare,
	.port_vlan_add		= b53_vlan_add,
	.port_vlan_del		= b53_vlan_del,
	.port_vlan_dump		= b53_vlan_dump,
	.port_fdb_dump		= b53_fdb_dump,
	.port_fdb_add		= b53_fdb_add,
	.port_fdb_del		= b53_fdb_del,
+0 −3
Original line number Diff line number Diff line
@@ -393,9 +393,6 @@ void b53_vlan_add(struct dsa_switch *ds, int port,
		  struct switchdev_trans *trans);
int b53_vlan_del(struct dsa_switch *ds, int port,
		 const struct switchdev_obj_port_vlan *vlan);
int b53_vlan_dump(struct dsa_switch *ds, int port,
		  struct switchdev_obj_port_vlan *vlan,
		  switchdev_obj_dump_cb_t *cb);
int b53_fdb_add(struct dsa_switch *ds, int port,
		const unsigned char *addr, u16 vid);
int b53_fdb_del(struct dsa_switch *ds, int port,
+0 −1
Original line number Diff line number Diff line
@@ -1021,7 +1021,6 @@ static const struct dsa_switch_ops bcm_sf2_ops = {
	.port_vlan_prepare	= b53_vlan_prepare,
	.port_vlan_add		= b53_vlan_add,
	.port_vlan_del		= b53_vlan_del,
	.port_vlan_dump		= b53_vlan_dump,
	.port_fdb_dump		= b53_fdb_dump,
	.port_fdb_add		= b53_fdb_add,
	.port_fdb_del		= b53_fdb_del,
+0 −38
Original line number Diff line number Diff line
@@ -257,43 +257,6 @@ static int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port,
	return 0;
}

static int dsa_loop_port_vlan_dump(struct dsa_switch *ds, int port,
				   struct switchdev_obj_port_vlan *vlan,
				   switchdev_obj_dump_cb_t *cb)
{
	struct dsa_loop_priv *ps = ds->priv;
	struct mii_bus *bus = ps->bus;
	struct dsa_loop_vlan *vl;
	u16 vid, vid_start = 0;
	int err = 0;

	dev_dbg(ds->dev, "%s\n", __func__);

	/* Just do a sleeping operation to make lockdep checks effective */
	mdiobus_read(bus, ps->port_base + port, MII_BMSR);

	for (vid = vid_start; vid < DSA_LOOP_VLANS; vid++) {
		vl = &ps->vlans[vid];

		if (!(vl->members & BIT(port)))
			continue;

		vlan->vid_begin = vlan->vid_end = vid;
		vlan->flags = 0;

		if (vl->untagged & BIT(port))
			vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED;
		if (ps->pvid == vid)
			vlan->flags |= BRIDGE_VLAN_INFO_PVID;

		err = cb(&vlan->obj);
		if (err)
			break;
	}

	return err;
}

static struct dsa_switch_ops dsa_loop_driver = {
	.get_tag_protocol	= dsa_loop_get_protocol,
	.setup			= dsa_loop_setup,
@@ -310,7 +273,6 @@ static struct dsa_switch_ops dsa_loop_driver = {
	.port_vlan_prepare	= dsa_loop_port_vlan_prepare,
	.port_vlan_add		= dsa_loop_port_vlan_add,
	.port_vlan_del		= dsa_loop_port_vlan_del,
	.port_vlan_dump		= dsa_loop_port_vlan_dump,
};

static int dsa_loop_drv_probe(struct mdio_device *mdiodev)
+0 −41
Original line number Diff line number Diff line
@@ -638,46 +638,6 @@ static int ksz_port_vlan_del(struct dsa_switch *ds, int port,
	return 0;
}

static int ksz_port_vlan_dump(struct dsa_switch *ds, int port,
			      struct switchdev_obj_port_vlan *vlan,
			      switchdev_obj_dump_cb_t *cb)
{
	struct ksz_device *dev = ds->priv;
	u16 vid;
	u16 data;
	struct vlan_table *vlan_cache;
	int err = 0;

	mutex_lock(&dev->vlan_mutex);

	/* use dev->vlan_cache due to lack of searching valid vlan entry */
	for (vid = vlan->vid_begin; vid < dev->num_vlans; vid++) {
		vlan_cache = &dev->vlan_cache[vid];

		if (!(vlan_cache->table[0] & VLAN_VALID))
			continue;

		vlan->vid_begin = vid;
		vlan->vid_end = vid;
		vlan->flags = 0;
		if (vlan_cache->table[2] & BIT(port)) {
			if (vlan_cache->table[1] & BIT(port))
				vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED;
			ksz_pread16(dev, port, REG_PORT_DEFAULT_VID, &data);
			if (vid == (data & 0xFFFFF))
				vlan->flags |= BRIDGE_VLAN_INFO_PVID;

			err = cb(&vlan->obj);
			if (err)
				break;
		}
	}

	mutex_unlock(&dev->vlan_mutex);

	return err;
}

struct alu_struct {
	/* entry 1 */
	u8	is_static:1;
@@ -1124,7 +1084,6 @@ static const struct dsa_switch_ops ksz_switch_ops = {
	.port_vlan_prepare	= ksz_port_vlan_prepare,
	.port_vlan_add		= ksz_port_vlan_add,
	.port_vlan_del		= ksz_port_vlan_del,
	.port_vlan_dump		= ksz_port_vlan_dump,
	.port_fdb_dump		= ksz_port_fdb_dump,
	.port_fdb_add		= ksz_port_fdb_add,
	.port_fdb_del		= ksz_port_fdb_del,
Loading