diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2017-01-17 20:41:38 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-18 16:49:46 -0500 |
commit | b22de490869da354116ea4cbbaa09dcbc260b2b4 (patch) | |
tree | f524fe3351c33f6d18ab3c3f9c455f7e9ca8c199 /include/net/dsa.h | |
parent | e33c2ef106d17ad8cdb16a0be0ef0daebb2d2c16 (diff) | |
download | linux-stable-b22de490869da354116ea4cbbaa09dcbc260b2b4.tar.gz linux-stable-b22de490869da354116ea4cbbaa09dcbc260b2b4.tar.bz2 linux-stable-b22de490869da354116ea4cbbaa09dcbc260b2b4.zip |
net: dsa: store CPU switch structure in the tree
Store a dsa_switch pointer to the CPU switch in the tree instead of only
its index. This avoids the need to initialize it to -1.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dsa.h')
-rw-r--r-- | include/net/dsa.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h index b94d1f2ef912..c72ed7af2a2a 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -124,7 +124,7 @@ struct dsa_switch_tree { /* * The switch and port to which the CPU is attached. */ - s8 cpu_switch; + struct dsa_switch *cpu_switch; s8 cpu_port; /* @@ -204,7 +204,7 @@ struct dsa_switch { static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p) { - return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port); + return !!(ds == ds->dst->cpu_switch && p == ds->dst->cpu_port); } static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p) @@ -227,10 +227,10 @@ static inline u8 dsa_upstream_port(struct dsa_switch *ds) * Else return the (DSA) port number that connects to the * switch that is one hop closer to the cpu. */ - if (dst->cpu_switch == ds->index) + if (dst->cpu_switch == ds) return dst->cpu_port; else - return ds->rtable[dst->cpu_switch]; + return ds->rtable[dst->cpu_switch->index]; } struct switchdev_trans; |