aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/dsa.h
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-10-16 11:12:18 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-18 12:24:33 +0100
commitf8b8b1cd5aadd221742b45eb0ee3c8a80abf036a (patch)
treead5b305182f3406c9de65031dce9577abd743da6 /include/net/dsa.h
parentnet: dsa: rename dsa_master_get_slave (diff)
downloadlinux-dev-f8b8b1cd5aadd221742b45eb0ee3c8a80abf036a.tar.xz
linux-dev-f8b8b1cd5aadd221742b45eb0ee3c8a80abf036a.zip
net: dsa: split dsa_port's netdev member
The dsa_port structure has a "netdev" member, which can be used for either the master device, or the slave device, depending on its type. It is true that today, CPU port are not exposed to userspace, thus the port's netdev member can be used to point to its master interface. But it is still slightly confusing, so split it into more explicit "master" and "slave" members inside an anonymous union. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dsa.h')
-rw-r--r--include/net/dsa.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 2746741f74cf..6ed1a17ed1bd 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -164,6 +164,14 @@ struct dsa_mall_tc_entry {
struct dsa_port {
+ /* A CPU port is physically connected to a master device.
+ * A user port exposed to userspace has a slave device.
+ */
+ union {
+ struct net_device *master;
+ struct net_device *slave;
+ };
+
/* CPU port tagging operations used by master or slave devices */
const struct dsa_device_ops *tag_ops;
@@ -176,7 +184,6 @@ struct dsa_port {
unsigned int index;
const char *name;
struct dsa_port *cpu_dp;
- struct net_device *netdev;
struct device_node *dn;
unsigned int ageing_time;
u8 stp_state;