diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-09-12 00:18:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-13 17:04:35 -0400 |
commit | ac7a04c33dd7f8e429df4b929ba3a3e8e729cc89 (patch) | |
tree | 5b1e76c258c08ef39fdcf5e469a05e0322ffb228 /include/net/dsa.h | |
parent | c55542983e572bcac813fd9a393e725e158074be (diff) |
net: dsa: change tag_protocol to an enum
Now that we introduced an additional multiplexing/demultiplexing layer
with commit 3e8a72d1dae37 ("net: dsa: reduce number of protocol hooks")
that lives within the DSA code, we no longer need to have a given switch
driver tag_protocol be an actual ethertype value, instead, we can
replace it with an enum: dsa_tag_protocol.
Do this replacement in the drivers, which allows us to get rid of the
cpu_to_be16()/htons() dance, and remove ETH_P_BRCMTAG since we do not
need it anymore.
Suggested-by: Alexander Duyck <alexander.duyck@gmail.com>
Signed-off-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 | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h index 97712927a9d2..8a8a5d976f97 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h | |||
@@ -19,10 +19,13 @@ | |||
19 | #include <linux/phy.h> | 19 | #include <linux/phy.h> |
20 | #include <linux/phy_fixed.h> | 20 | #include <linux/phy_fixed.h> |
21 | 21 | ||
22 | /* Not an official ethertype value, used only internally for DSA | 22 | enum dsa_tag_protocol { |
23 | * demultiplexing | 23 | DSA_TAG_PROTO_NONE = 0, |
24 | */ | 24 | DSA_TAG_PROTO_DSA, |
25 | #define ETH_P_BRCMTAG (ETH_P_XDSA + 1) | 25 | DSA_TAG_PROTO_TRAILER, |
26 | DSA_TAG_PROTO_EDSA, | ||
27 | DSA_TAG_PROTO_BRCM, | ||
28 | }; | ||
26 | 29 | ||
27 | #define DSA_MAX_SWITCHES 4 | 30 | #define DSA_MAX_SWITCHES 4 |
28 | #define DSA_MAX_PORTS 12 | 31 | #define DSA_MAX_PORTS 12 |
@@ -89,7 +92,7 @@ struct dsa_switch_tree { | |||
89 | */ | 92 | */ |
90 | struct net_device *master_netdev; | 93 | struct net_device *master_netdev; |
91 | const struct dsa_device_ops *ops; | 94 | const struct dsa_device_ops *ops; |
92 | __be16 tag_protocol; | 95 | enum dsa_tag_protocol tag_protocol; |
93 | 96 | ||
94 | /* | 97 | /* |
95 | * The switch and port to which the CPU is attached. | 98 | * The switch and port to which the CPU is attached. |
@@ -166,7 +169,7 @@ static inline u8 dsa_upstream_port(struct dsa_switch *ds) | |||
166 | struct dsa_switch_driver { | 169 | struct dsa_switch_driver { |
167 | struct list_head list; | 170 | struct list_head list; |
168 | 171 | ||
169 | __be16 tag_protocol; | 172 | enum dsa_tag_protocol tag_protocol; |
170 | int priv_size; | 173 | int priv_size; |
171 | 174 | ||
172 | /* | 175 | /* |
@@ -215,7 +218,7 @@ static inline void *ds_to_priv(struct dsa_switch *ds) | |||
215 | 218 | ||
216 | static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst) | 219 | static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst) |
217 | { | 220 | { |
218 | return dst->tag_protocol != 0; | 221 | return dst->tag_protocol != DSA_TAG_PROTO_NONE; |
219 | } | 222 | } |
220 | 223 | ||
221 | #endif | 224 | #endif |