net: dsa: Add a ports structure and use it in the switch structure
There are going to be more per-port members added to the switch structure. So add a port structure and move the netdev into it. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
149cafd790
commit
c8b098086b
@@ -119,6 +119,10 @@ struct dsa_switch_tree {
|
||||
struct dsa_switch *ds[DSA_MAX_SWITCHES];
|
||||
};
|
||||
|
||||
struct dsa_port {
|
||||
struct net_device *netdev;
|
||||
};
|
||||
|
||||
struct dsa_switch {
|
||||
struct device *dev;
|
||||
|
||||
@@ -158,8 +162,8 @@ struct dsa_switch {
|
||||
u32 dsa_port_mask;
|
||||
u32 enabled_port_mask;
|
||||
u32 phys_mii_mask;
|
||||
struct dsa_port ports[DSA_MAX_PORTS];
|
||||
struct mii_bus *slave_mii_bus;
|
||||
struct net_device *ports[DSA_MAX_PORTS];
|
||||
};
|
||||
|
||||
static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
|
||||
@@ -174,7 +178,7 @@ static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)
|
||||
|
||||
static inline bool dsa_is_port_initialized(struct dsa_switch *ds, int p)
|
||||
{
|
||||
return ds->enabled_port_mask & (1 << p) && ds->ports[p];
|
||||
return ds->enabled_port_mask & (1 << p) && ds->ports[p].netdev;
|
||||
}
|
||||
|
||||
static inline u8 dsa_upstream_port(struct dsa_switch *ds)
|
||||
|
Reference in New Issue
Block a user