summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-06-04 21:16:57 +0200
committerDavid S. Miller <davem@davemloft.net>2016-06-04 14:29:53 -0700
commitc8b098086b4c744084350d2757a637ad756adf34 (patch)
tree0777d99335eff8adf732bd1cb574926b87f9d6c2 /include
parent149cafd790573294752787f5ce1dc0f99e4088d3 (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/net/dsa.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 17c3d37b6779..9aed8572037c 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -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)