summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2019-04-28 13:37:12 -0400
committerDavid S. Miller <davem@davemloft.net>2019-04-28 19:41:01 -0400
commit0b42f03363706609d621c31324fae5c1250f579f (patch)
treeb4b66ab0f485b8d885446a55d450772eb22c7e08
parent875138f81d71af3cfa80df57e32fe9efbc4f95bc (diff)
dsa: Add MODULE_ALIAS to taggers in preparation to become modules
When the tag drivers become modules, we will need to dynamically load them based on what the switch drivers need. Add aliases to map between the TAG protocol and the driver. In order to do this, we need the tag protocol number as something which the C pre-processor can stringinfy. Only the compiler knows the value of an enum, CPP cannot use them. So add #defines. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/dsa.h43
-rw-r--r--net/dsa/tag_brcm.c4
-rw-r--r--net/dsa/tag_dsa.c2
-rw-r--r--net/dsa/tag_edsa.c2
-rw-r--r--net/dsa/tag_gswip.c2
-rw-r--r--net/dsa/tag_ksz.c4
-rw-r--r--net/dsa/tag_lan9303.c2
-rw-r--r--net/dsa/tag_mtk.c2
-rw-r--r--net/dsa/tag_qca.c2
-rw-r--r--net/dsa/tag_trailer.c2
10 files changed, 52 insertions, 13 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 801346e31e9b..8f3d5e0825a2 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -30,20 +30,33 @@ struct phy_device;
30struct fixed_phy_status; 30struct fixed_phy_status;
31struct phylink_link_state; 31struct phylink_link_state;
32 32
33#define DSA_TAG_PROTO_NONE_VALUE 0
34#define DSA_TAG_PROTO_BRCM_VALUE 1
35#define DSA_TAG_PROTO_BRCM_PREPEND_VALUE 2
36#define DSA_TAG_PROTO_DSA_VALUE 3
37#define DSA_TAG_PROTO_EDSA_VALUE 4
38#define DSA_TAG_PROTO_GSWIP_VALUE 5
39#define DSA_TAG_PROTO_KSZ9477_VALUE 6
40#define DSA_TAG_PROTO_KSZ9893_VALUE 7
41#define DSA_TAG_PROTO_LAN9303_VALUE 8
42#define DSA_TAG_PROTO_MTK_VALUE 9
43#define DSA_TAG_PROTO_QCA_VALUE 10
44#define DSA_TAG_PROTO_TRAILER_VALUE 11
45
33enum dsa_tag_protocol { 46enum dsa_tag_protocol {
34 DSA_TAG_PROTO_NONE = 0, 47 DSA_TAG_PROTO_NONE = DSA_TAG_PROTO_NONE_VALUE,
35 DSA_TAG_PROTO_BRCM, 48 DSA_TAG_PROTO_BRCM = DSA_TAG_PROTO_BRCM_VALUE,
36 DSA_TAG_PROTO_BRCM_PREPEND, 49 DSA_TAG_PROTO_BRCM_PREPEND = DSA_TAG_PROTO_BRCM_PREPEND_VALUE,
37 DSA_TAG_PROTO_DSA, 50 DSA_TAG_PROTO_DSA = DSA_TAG_PROTO_DSA_VALUE,
38 DSA_TAG_PROTO_EDSA, 51 DSA_TAG_PROTO_EDSA = DSA_TAG_PROTO_EDSA_VALUE,
39 DSA_TAG_PROTO_GSWIP, 52 DSA_TAG_PROTO_GSWIP = DSA_TAG_PROTO_GSWIP_VALUE,
40 DSA_TAG_PROTO_KSZ9477, 53 DSA_TAG_PROTO_KSZ9477 = DSA_TAG_PROTO_KSZ9477_VALUE,
41 DSA_TAG_PROTO_KSZ9893, 54 DSA_TAG_PROTO_KSZ9893 = DSA_TAG_PROTO_KSZ9893_VALUE,
42 DSA_TAG_PROTO_LAN9303, 55 DSA_TAG_PROTO_LAN9303 = DSA_TAG_PROTO_LAN9303_VALUE,
43 DSA_TAG_PROTO_MTK, 56 DSA_TAG_PROTO_MTK = DSA_TAG_PROTO_MTK_VALUE,
44 DSA_TAG_PROTO_QCA, 57 DSA_TAG_PROTO_QCA = DSA_TAG_PROTO_QCA_VALUE,
45 DSA_TAG_PROTO_TRAILER, 58 DSA_TAG_PROTO_TRAILER = DSA_TAG_PROTO_TRAILER_VALUE,
46 DSA_TAG_LAST, /* MUST BE LAST */ 59 DSA_TAG_LAST, /* MUST BE LAST */
47}; 60};
48 61
49struct packet_type; 62struct packet_type;
@@ -59,6 +72,10 @@ struct dsa_device_ops {
59 const char *name; 72 const char *name;
60}; 73};
61 74
75#define DSA_TAG_DRIVER_ALIAS "dsa_tag-"
76#define MODULE_ALIAS_DSA_TAG_DRIVER(__proto) \
77 MODULE_ALIAS(DSA_TAG_DRIVER_ALIAS __stringify(__proto##_VALUE))
78
62struct dsa_switch_tree { 79struct dsa_switch_tree {
63 struct list_head list; 80 struct list_head list;
64 81
diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index 1b7dfbe6b3ae..24d8f45a7e6f 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -173,6 +173,8 @@ const struct dsa_device_ops brcm_netdev_ops = {
173 .rcv = brcm_tag_rcv, 173 .rcv = brcm_tag_rcv,
174 .overhead = BRCM_TAG_LEN, 174 .overhead = BRCM_TAG_LEN,
175}; 175};
176
177MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM);
176#endif 178#endif
177 179
178#ifdef CONFIG_NET_DSA_TAG_BRCM_PREPEND 180#ifdef CONFIG_NET_DSA_TAG_BRCM_PREPEND
@@ -198,3 +200,5 @@ const struct dsa_device_ops brcm_prepend_netdev_ops = {
198 .overhead = BRCM_TAG_LEN, 200 .overhead = BRCM_TAG_LEN,
199}; 201};
200#endif 202#endif
203
204MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_PREPEND);
diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
index e1c90709de6c..8aefaf96c1ca 100644
--- a/net/dsa/tag_dsa.c
+++ b/net/dsa/tag_dsa.c
@@ -157,3 +157,5 @@ const struct dsa_device_ops dsa_netdev_ops = {
157 .flow_dissect = dsa_tag_flow_dissect, 157 .flow_dissect = dsa_tag_flow_dissect,
158 .overhead = DSA_HLEN, 158 .overhead = DSA_HLEN,
159}; 159};
160
161MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_DSA);
diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c
index b936b4660b71..bad12e760f3d 100644
--- a/net/dsa/tag_edsa.c
+++ b/net/dsa/tag_edsa.c
@@ -176,3 +176,5 @@ const struct dsa_device_ops edsa_netdev_ops = {
176 .flow_dissect = edsa_tag_flow_dissect, 176 .flow_dissect = edsa_tag_flow_dissect,
177 .overhead = EDSA_HLEN, 177 .overhead = EDSA_HLEN,
178}; 178};
179
180MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_EDSA);
diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c
index d1c1e7db87b6..30bf7036620f 100644
--- a/net/dsa/tag_gswip.c
+++ b/net/dsa/tag_gswip.c
@@ -109,3 +109,5 @@ const struct dsa_device_ops gswip_netdev_ops = {
109 .rcv = gswip_tag_rcv, 109 .rcv = gswip_tag_rcv,
110 .overhead = GSWIP_RX_HEADER_LEN, 110 .overhead = GSWIP_RX_HEADER_LEN,
111}; 111};
112
113MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_GSWIP);
diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
index 631094599514..9be0f5f12afb 100644
--- a/net/dsa/tag_ksz.c
+++ b/net/dsa/tag_ksz.c
@@ -140,6 +140,8 @@ const struct dsa_device_ops ksz9477_netdev_ops = {
140 .overhead = KSZ9477_INGRESS_TAG_LEN, 140 .overhead = KSZ9477_INGRESS_TAG_LEN,
141}; 141};
142 142
143MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9477);
144
143#define KSZ9893_TAIL_TAG_OVERRIDE BIT(5) 145#define KSZ9893_TAIL_TAG_OVERRIDE BIT(5)
144#define KSZ9893_TAIL_TAG_LOOKUP BIT(6) 146#define KSZ9893_TAIL_TAG_LOOKUP BIT(6)
145 147
@@ -173,3 +175,5 @@ const struct dsa_device_ops ksz9893_netdev_ops = {
173 .rcv = ksz9477_rcv, 175 .rcv = ksz9477_rcv,
174 .overhead = KSZ_INGRESS_TAG_LEN, 176 .overhead = KSZ_INGRESS_TAG_LEN,
175}; 177};
178
179MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9893);
diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c
index 67d70339536d..48bca20024d4 100644
--- a/net/dsa/tag_lan9303.c
+++ b/net/dsa/tag_lan9303.c
@@ -134,3 +134,5 @@ const struct dsa_device_ops lan9303_netdev_ops = {
134 .rcv = lan9303_rcv, 134 .rcv = lan9303_rcv,
135 .overhead = LAN9303_TAG_LEN, 135 .overhead = LAN9303_TAG_LEN,
136}; 136};
137
138MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_LAN9303);
diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c
index dc537d9a18c0..23210a65cbed 100644
--- a/net/dsa/tag_mtk.c
+++ b/net/dsa/tag_mtk.c
@@ -105,3 +105,5 @@ const struct dsa_device_ops mtk_netdev_ops = {
105 .flow_dissect = mtk_tag_flow_dissect, 105 .flow_dissect = mtk_tag_flow_dissect,
106 .overhead = MTK_HDR_LEN, 106 .overhead = MTK_HDR_LEN,
107}; 107};
108
109MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_MTK);
diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c
index f62296ffc5b7..7d9cb178da3d 100644
--- a/net/dsa/tag_qca.c
+++ b/net/dsa/tag_qca.c
@@ -106,3 +106,5 @@ const struct dsa_device_ops qca_netdev_ops = {
106 .flow_dissect = qca_tag_flow_dissect, 106 .flow_dissect = qca_tag_flow_dissect,
107 .overhead = QCA_HDR_LEN, 107 .overhead = QCA_HDR_LEN,
108}; 108};
109
110MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_QCA);
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c
index 20ee7f84fe4d..00d521cf9c48 100644
--- a/net/dsa/tag_trailer.c
+++ b/net/dsa/tag_trailer.c
@@ -83,3 +83,5 @@ const struct dsa_device_ops trailer_netdev_ops = {
83 .rcv = trailer_rcv, 83 .rcv = trailer_rcv,
84 .overhead = 4, 84 .overhead = 4,
85}; 85};
86
87MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_TRAILER);