Skip to content

Commit

Permalink
net: dsa: b53: use dsa_port's bridge pointer
Browse files Browse the repository at this point in the history
Now that DSA exposes the bridge device pointer to which a port belongs,
use it when programming the port based VLANs and thus remove the cache.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vivien Didelot authored and David S. Miller committed Jan 29, 2017
1 parent 922754a commit ddd3a0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
9 changes: 3 additions & 6 deletions drivers/net/dsa/b53/b53_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ int b53_fdb_dump(struct dsa_switch *ds, int port,
}
EXPORT_SYMBOL(b53_fdb_dump);

int b53_br_join(struct dsa_switch *ds, int port, struct net_device *bridge)
int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br)
{
struct b53_device *dev = ds->priv;
s8 cpu_port = ds->dst->cpu_port;
Expand All @@ -1326,11 +1326,10 @@ int b53_br_join(struct dsa_switch *ds, int port, struct net_device *bridge)
b53_write16(dev, B53_VLAN_PAGE, B53_JOIN_ALL_VLAN_EN, reg);
}

dev->ports[port].bridge_dev = bridge;
b53_read16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), &pvlan);

b53_for_each_port(dev, i) {
if (dev->ports[i].bridge_dev != bridge)
if (ds->ports[i].bridge_dev != br)
continue;

/* Add this local port to the remote port VLAN control
Expand All @@ -1357,7 +1356,6 @@ EXPORT_SYMBOL(b53_br_join);
void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br)
{
struct b53_device *dev = ds->priv;
struct net_device *bridge = dev->ports[port].bridge_dev;
struct b53_vlan *vl = &dev->vlans[0];
s8 cpu_port = ds->dst->cpu_port;
unsigned int i;
Expand All @@ -1367,7 +1365,7 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br)

b53_for_each_port(dev, i) {
/* Don't touch the remaining ports */
if (dev->ports[i].bridge_dev != bridge)
if (ds->ports[i].bridge_dev != br)
continue;

b53_read16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(i), &reg);
Expand All @@ -1382,7 +1380,6 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br)

b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), pvlan);
dev->ports[port].vlan_ctl_mask = pvlan;
dev->ports[port].bridge_dev = NULL;

if (is5325(dev) || is5365(dev))
pvid = 1;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/dsa/b53/b53_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ enum {

struct b53_port {
u16 vlan_ctl_mask;
struct net_device *bridge_dev;
};

struct b53_vlan {
Expand Down

0 comments on commit ddd3a0c

Please sign in to comment.