aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2015-02-24 16:15:33 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-25 17:03:38 -0500
commitb73adef67765b72f2a0d01ef15aff9d784dc85da (patch)
tree829c9c90cffe94d00a1a7ee568c9464fdcf0efae /net/dsa/dsa.c
parentd87d6f44d7c1254fd9560a5191659cb00882db56 (diff)
net: dsa: integrate with SWITCHDEV for HW bridging
In order to support bridging offloads in DSA switch drivers, select NET_SWITCHDEV to get access to the port_stp_update and parent_get_id NDOs that we are required to implement. To facilitate the integratation at the DSA driver level, we implement 3 types of operations: - port_join_bridge - port_leave_bridge - port_stp_update DSA will resolve which switch ports that are currently bridge port members as some Switch hardware/drivers need to know about that to limit the register programming to just the relevant registers (especially for slow MDIO buses). We also take care of setting the correct STP state when slave network devices are brought up/down while being bridge members. Finally, when a port is leaving the bridge, we make sure we set in BR_STATE_FORWARDING state, otherwise the bridge layer would leave it disabled as a result of having left the bridge. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r--net/dsa/dsa.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index fc1813140be6..9c208f0dab08 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -826,6 +826,10 @@ static struct packet_type dsa_pack_type __read_mostly = {
826 .func = dsa_switch_rcv, 826 .func = dsa_switch_rcv,
827}; 827};
828 828
829static struct notifier_block dsa_netdevice_nb __read_mostly = {
830 .notifier_call = dsa_slave_netdevice_event,
831};
832
829#ifdef CONFIG_PM_SLEEP 833#ifdef CONFIG_PM_SLEEP
830static int dsa_suspend(struct device *d) 834static int dsa_suspend(struct device *d)
831{ 835{
@@ -884,6 +888,8 @@ static int __init dsa_init_module(void)
884{ 888{
885 int rc; 889 int rc;
886 890
891 register_netdevice_notifier(&dsa_netdevice_nb);
892
887 rc = platform_driver_register(&dsa_driver); 893 rc = platform_driver_register(&dsa_driver);
888 if (rc) 894 if (rc)
889 return rc; 895 return rc;
@@ -896,6 +902,7 @@ module_init(dsa_init_module);
896 902
897static void __exit dsa_cleanup_module(void) 903static void __exit dsa_cleanup_module(void)
898{ 904{
905 unregister_netdevice_notifier(&dsa_netdevice_nb);
899 dev_remove_pack(&dsa_pack_type); 906 dev_remove_pack(&dsa_pack_type);
900 platform_driver_unregister(&dsa_driver); 907 platform_driver_unregister(&dsa_driver);
901} 908}