aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r--net/dsa/dsa.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 0dc1589343c3..88e7c2f3fa0d 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -29,6 +29,7 @@ void register_switch_driver(struct dsa_switch_driver *drv)
29 list_add_tail(&drv->list, &dsa_switch_drivers); 29 list_add_tail(&drv->list, &dsa_switch_drivers);
30 mutex_unlock(&dsa_switch_drivers_mutex); 30 mutex_unlock(&dsa_switch_drivers_mutex);
31} 31}
32EXPORT_SYMBOL_GPL(register_switch_driver);
32 33
33void unregister_switch_driver(struct dsa_switch_driver *drv) 34void unregister_switch_driver(struct dsa_switch_driver *drv)
34{ 35{
@@ -36,6 +37,7 @@ void unregister_switch_driver(struct dsa_switch_driver *drv)
36 list_del_init(&drv->list); 37 list_del_init(&drv->list);
37 mutex_unlock(&dsa_switch_drivers_mutex); 38 mutex_unlock(&dsa_switch_drivers_mutex);
38} 39}
40EXPORT_SYMBOL_GPL(unregister_switch_driver);
39 41
40static struct dsa_switch_driver * 42static struct dsa_switch_driver *
41dsa_switch_probe(struct mii_bus *bus, int sw_addr, char **_name) 43dsa_switch_probe(struct mii_bus *bus, int sw_addr, char **_name)
@@ -199,29 +201,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
199} 201}
200 202
201 203
202/* hooks for ethertype-less tagging formats *********************************/
203/*
204 * The original DSA tag format and some other tag formats have no
205 * ethertype, which means that we need to add a little hack to the
206 * networking receive path to make sure that received frames get
207 * the right ->protocol assigned to them when one of those tag
208 * formats is in use.
209 */
210bool dsa_uses_dsa_tags(void *dsa_ptr)
211{
212 struct dsa_switch_tree *dst = dsa_ptr;
213
214 return !!(dst->tag_protocol == htons(ETH_P_DSA));
215}
216
217bool dsa_uses_trailer_tags(void *dsa_ptr)
218{
219 struct dsa_switch_tree *dst = dsa_ptr;
220
221 return !!(dst->tag_protocol == htons(ETH_P_TRAILER));
222}
223
224
225/* link polling *************************************************************/ 204/* link polling *************************************************************/
226static void dsa_link_poll_work(struct work_struct *ugly) 205static void dsa_link_poll_work(struct work_struct *ugly)
227{ 206{
@@ -419,12 +398,36 @@ static struct platform_driver dsa_driver = {
419 398
420static int __init dsa_init_module(void) 399static int __init dsa_init_module(void)
421{ 400{
422 return platform_driver_register(&dsa_driver); 401 int rc;
402
403 rc = platform_driver_register(&dsa_driver);
404 if (rc)
405 return rc;
406
407#ifdef CONFIG_NET_DSA_TAG_DSA
408 dev_add_pack(&dsa_packet_type);
409#endif
410#ifdef CONFIG_NET_DSA_TAG_EDSA
411 dev_add_pack(&edsa_packet_type);
412#endif
413#ifdef CONFIG_NET_DSA_TAG_TRAILER
414 dev_add_pack(&trailer_packet_type);
415#endif
416 return 0;
423} 417}
424module_init(dsa_init_module); 418module_init(dsa_init_module);
425 419
426static void __exit dsa_cleanup_module(void) 420static void __exit dsa_cleanup_module(void)
427{ 421{
422#ifdef CONFIG_NET_DSA_TAG_TRAILER
423 dev_remove_pack(&trailer_packet_type);
424#endif
425#ifdef CONFIG_NET_DSA_TAG_EDSA
426 dev_remove_pack(&edsa_packet_type);
427#endif
428#ifdef CONFIG_NET_DSA_TAG_DSA
429 dev_remove_pack(&dsa_packet_type);
430#endif
428 platform_driver_unregister(&dsa_driver); 431 platform_driver_unregister(&dsa_driver);
429} 432}
430module_exit(dsa_cleanup_module); 433module_exit(dsa_cleanup_module);