Commit fae8a25e authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: mv88e6xxx: use dsa_port's bridge pointer

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: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f123f2fb
...@@ -1247,8 +1247,8 @@ static int _mv88e6xxx_atu_remove(struct mv88e6xxx_chip *chip, u16 fid, ...@@ -1247,8 +1247,8 @@ static int _mv88e6xxx_atu_remove(struct mv88e6xxx_chip *chip, u16 fid,
static int _mv88e6xxx_port_based_vlan_map(struct mv88e6xxx_chip *chip, int port) static int _mv88e6xxx_port_based_vlan_map(struct mv88e6xxx_chip *chip, int port)
{ {
struct net_device *bridge = chip->ports[port].bridge_dev;
struct dsa_switch *ds = chip->ds; struct dsa_switch *ds = chip->ds;
struct net_device *bridge = ds->ports[port].bridge_dev;
u16 output_ports = 0; u16 output_ports = 0;
int i; int i;
...@@ -1258,7 +1258,7 @@ static int _mv88e6xxx_port_based_vlan_map(struct mv88e6xxx_chip *chip, int port) ...@@ -1258,7 +1258,7 @@ static int _mv88e6xxx_port_based_vlan_map(struct mv88e6xxx_chip *chip, int port)
} else { } else {
for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) {
/* allow sending frames to every group member */ /* allow sending frames to every group member */
if (bridge && chip->ports[i].bridge_dev == bridge) if (bridge && ds->ports[i].bridge_dev == bridge)
output_ports |= BIT(i); output_ports |= BIT(i);
/* allow sending frames to CPU port and DSA link(s) */ /* allow sending frames to CPU port and DSA link(s) */
...@@ -1820,17 +1820,17 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port, ...@@ -1820,17 +1820,17 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER) GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER)
continue; continue;
if (chip->ports[i].bridge_dev == if (ds->ports[i].bridge_dev ==
chip->ports[port].bridge_dev) ds->ports[port].bridge_dev)
break; /* same bridge, check next VLAN */ break; /* same bridge, check next VLAN */
if (!chip->ports[i].bridge_dev) if (!ds->ports[i].bridge_dev)
continue; continue;
netdev_warn(ds->ports[port].netdev, netdev_warn(ds->ports[port].netdev,
"hardware VLAN %d already used by %s\n", "hardware VLAN %d already used by %s\n",
vlan.vid, vlan.vid,
netdev_name(chip->ports[i].bridge_dev)); netdev_name(ds->ports[i].bridge_dev));
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto unlock; goto unlock;
} }
...@@ -2320,18 +2320,16 @@ static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port, ...@@ -2320,18 +2320,16 @@ static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port,
} }
static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
struct net_device *bridge) struct net_device *br)
{ {
struct mv88e6xxx_chip *chip = ds->priv; struct mv88e6xxx_chip *chip = ds->priv;
int i, err = 0; int i, err = 0;
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
/* Assign the bridge and remap each port's VLANTable */ /* Remap each port's VLANTable */
chip->ports[port].bridge_dev = bridge;
for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) {
if (chip->ports[i].bridge_dev == bridge) { if (ds->ports[i].bridge_dev == br) {
err = _mv88e6xxx_port_based_vlan_map(chip, i); err = _mv88e6xxx_port_based_vlan_map(chip, i);
if (err) if (err)
break; break;
...@@ -2347,16 +2345,13 @@ static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port, ...@@ -2347,16 +2345,13 @@ static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port,
struct net_device *br) struct net_device *br)
{ {
struct mv88e6xxx_chip *chip = ds->priv; struct mv88e6xxx_chip *chip = ds->priv;
struct net_device *bridge = chip->ports[port].bridge_dev;
int i; int i;
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
/* Unassign the bridge and remap each port's VLANTable */ /* Remap each port's VLANTable */
chip->ports[port].bridge_dev = NULL;
for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) for (i = 0; i < mv88e6xxx_num_ports(chip); ++i)
if (i == port || chip->ports[i].bridge_dev == bridge) if (i == port || ds->ports[i].bridge_dev == br)
if (_mv88e6xxx_port_based_vlan_map(chip, i)) if (_mv88e6xxx_port_based_vlan_map(chip, i))
netdev_warn(ds->ports[i].netdev, netdev_warn(ds->ports[i].netdev,
"failed to remap\n"); "failed to remap\n");
......
...@@ -676,10 +676,6 @@ struct mv88e6xxx_vtu_entry { ...@@ -676,10 +676,6 @@ struct mv88e6xxx_vtu_entry {
struct mv88e6xxx_bus_ops; struct mv88e6xxx_bus_ops;
struct mv88e6xxx_priv_port {
struct net_device *bridge_dev;
};
struct mv88e6xxx_irq { struct mv88e6xxx_irq {
u16 masked; u16 masked;
struct irq_chip chip; struct irq_chip chip;
...@@ -720,8 +716,6 @@ struct mv88e6xxx_chip { ...@@ -720,8 +716,6 @@ struct mv88e6xxx_chip {
*/ */
struct mutex stats_mutex; struct mutex stats_mutex;
struct mv88e6xxx_priv_port ports[DSA_MAX_PORTS];
/* A switch may have a GPIO line tied to its reset pin. Parse /* A switch may have a GPIO line tied to its reset pin. Parse
* this from the device tree, and use it before performing * this from the device tree, and use it before performing
* switch soft reset. * switch soft reset.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment