summaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r--net/dsa/dsa.c45
1 files changed, 2 insertions, 43 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 36de4f2a3366..92b3cd129eb7 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -35,6 +35,7 @@ static struct sk_buff *dsa_slave_notag_xmit(struct sk_buff *skb,
35} 35}
36 36
37static const struct dsa_device_ops none_ops = { 37static const struct dsa_device_ops none_ops = {
38 .name = "none",
38 .xmit = dsa_slave_notag_xmit, 39 .xmit = dsa_slave_notag_xmit,
39 .rcv = NULL, 40 .rcv = NULL,
40}; 41};
@@ -76,49 +77,7 @@ const struct dsa_device_ops *dsa_device_ops[DSA_TAG_LAST] = {
76 77
77const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops) 78const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops)
78{ 79{
79 const char *protocol_name[DSA_TAG_LAST] = { 80 return ops->name;
80#ifdef CONFIG_NET_DSA_TAG_BRCM
81 [DSA_TAG_PROTO_BRCM] = "brcm",
82#endif
83#ifdef CONFIG_NET_DSA_TAG_BRCM_PREPEND
84 [DSA_TAG_PROTO_BRCM_PREPEND] = "brcm-prepend",
85#endif
86#ifdef CONFIG_NET_DSA_TAG_DSA
87 [DSA_TAG_PROTO_DSA] = "dsa",
88#endif
89#ifdef CONFIG_NET_DSA_TAG_EDSA
90 [DSA_TAG_PROTO_EDSA] = "edsa",
91#endif
92#ifdef CONFIG_NET_DSA_TAG_GSWIP
93 [DSA_TAG_PROTO_GSWIP] = "gswip",
94#endif
95#ifdef CONFIG_NET_DSA_TAG_KSZ9477
96 [DSA_TAG_PROTO_KSZ9477] = "ksz9477",
97 [DSA_TAG_PROTO_KSZ9893] = "ksz9893",
98#endif
99#ifdef CONFIG_NET_DSA_TAG_LAN9303
100 [DSA_TAG_PROTO_LAN9303] = "lan9303",
101#endif
102#ifdef CONFIG_NET_DSA_TAG_MTK
103 [DSA_TAG_PROTO_MTK] = "mtk",
104#endif
105#ifdef CONFIG_NET_DSA_TAG_QCA
106 [DSA_TAG_PROTO_QCA] = "qca",
107#endif
108#ifdef CONFIG_NET_DSA_TAG_TRAILER
109 [DSA_TAG_PROTO_TRAILER] = "trailer",
110#endif
111 [DSA_TAG_PROTO_NONE] = "none",
112 };
113 unsigned int i;
114
115 BUILD_BUG_ON(ARRAY_SIZE(protocol_name) != DSA_TAG_LAST);
116
117 for (i = 0; i < ARRAY_SIZE(dsa_device_ops); i++)
118 if (ops == dsa_device_ops[i])
119 return protocol_name[i];
120
121 return protocol_name[DSA_TAG_PROTO_NONE];
122}; 81};
123 82
124const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol) 83const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol)