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

net: dsa: mv88e6xxx: add port private structure

Add a per-port mv88e6xxx_priv_port structure to store per-port related
data, instead of adding several arrays of DSA_MAX_PORTS elements in the
mv88e6xxx_priv_state structure.

It currently only contains the port STP state.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9b69d206
...@@ -1131,7 +1131,7 @@ int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state) ...@@ -1131,7 +1131,7 @@ int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state)
/* mv88e6xxx_port_stp_update may be called with softirqs disabled, /* mv88e6xxx_port_stp_update may be called with softirqs disabled,
* so we can not update the port state directly but need to schedule it. * so we can not update the port state directly but need to schedule it.
*/ */
ps->port_state[port] = stp_state; ps->ports[port].state = stp_state;
set_bit(port, &ps->port_state_update_mask); set_bit(port, &ps->port_state_update_mask);
schedule_work(&ps->bridge_work); schedule_work(&ps->bridge_work);
...@@ -1925,7 +1925,7 @@ static void mv88e6xxx_bridge_work(struct work_struct *work) ...@@ -1925,7 +1925,7 @@ static void mv88e6xxx_bridge_work(struct work_struct *work)
while (ps->port_state_update_mask) { while (ps->port_state_update_mask) {
port = __ffs(ps->port_state_update_mask); port = __ffs(ps->port_state_update_mask);
clear_bit(port, &ps->port_state_update_mask); clear_bit(port, &ps->port_state_update_mask);
mv88e6xxx_set_port_state(ds, port, ps->port_state[port]); mv88e6xxx_set_port_state(ds, port, ps->ports[port].state);
} }
} }
......
...@@ -379,6 +379,10 @@ struct mv88e6xxx_vtu_stu_entry { ...@@ -379,6 +379,10 @@ struct mv88e6xxx_vtu_stu_entry {
u8 data[DSA_MAX_PORTS]; u8 data[DSA_MAX_PORTS];
}; };
struct mv88e6xxx_priv_port {
u8 state;
};
struct mv88e6xxx_priv_state { struct mv88e6xxx_priv_state {
/* When using multi-chip addressing, this mutex protects /* When using multi-chip addressing, this mutex protects
* access to the indirect access registers. (In single-chip * access to the indirect access registers. (In single-chip
...@@ -415,8 +419,9 @@ struct mv88e6xxx_priv_state { ...@@ -415,8 +419,9 @@ struct mv88e6xxx_priv_state {
int id; /* switch product id */ int id; /* switch product id */
int num_ports; /* number of switch ports */ int num_ports; /* number of switch ports */
struct mv88e6xxx_priv_port ports[DSA_MAX_PORTS];
unsigned long port_state_update_mask; unsigned long port_state_update_mask;
u8 port_state[DSA_MAX_PORTS];
struct work_struct bridge_work; struct work_struct bridge_work;
}; };
......
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