aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-02-25 17:04:15 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-25 17:04:15 -0500
commitbb66be1c549a0760500cfad404b3d79a136d0e44 (patch)
treed0a46201df407c4719abade5cd44bcb86041b195 /net/dsa/dsa.c
parent92bf200881d978bc3c6a290991ae1f9ddc7b5411 (diff)
parent12f460f23423e81d6dd3efeb78906ae634ad8fc9 (diff)
Merge branch 'sf2_hwbridge'
Florian Fainelli says: ==================== net: dsa: integration with SWITCHDEV for HW bridging This patch set provides the DSA and SWITCHDEV integration bits together and modifies the bcm_sf2 driver accordingly such that it works properly with HW bridging. Changes in v3: - add back the null pointer check in dsa_slave_br_port_mask from Guenter - slightly rework patch 1 commit message not to mention the function name we add in patch 2 Changes in v2: - avoid a race condition in how DSA network devices are created, patch from Guenter Roeck - provide a consistent and work STP state once a port leaves the bridge - retain a bridge device pointer to properly flag port/bridge membership - properly flush the ARL (Address Resolution Logic) in bcm_sf2.c - properly retain port membership when individually bringing devices up/down while they are members of a bridge We discussed on the mailing-list the possibility of standardizing a "fdb_flush" operation for DSA switch drivers, looking at the Marvell and Broadcom switches, I am not convinced this is practical or diserable as the terminologies vary here, but there is nothing preventing us from doing it later. Many thanks to Guenter and Andrew for both testing and providing feedback. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r--net/dsa/dsa.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 2173402d87e0..9c208f0dab08 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -314,19 +314,15 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
314 * Create network devices for physical switch ports. 314 * Create network devices for physical switch ports.
315 */ 315 */
316 for (i = 0; i < DSA_MAX_PORTS; i++) { 316 for (i = 0; i < DSA_MAX_PORTS; i++) {
317 struct net_device *slave_dev;
318
319 if (!(ds->phys_port_mask & (1 << i))) 317 if (!(ds->phys_port_mask & (1 << i)))
320 continue; 318 continue;
321 319
322 slave_dev = dsa_slave_create(ds, parent, i, pd->port_names[i]); 320 ret = dsa_slave_create(ds, parent, i, pd->port_names[i]);
323 if (slave_dev == NULL) { 321 if (ret < 0) {
324 netdev_err(dst->master_netdev, "[%d]: can't create dsa slave device for port %d(%s)\n", 322 netdev_err(dst->master_netdev, "[%d]: can't create dsa slave device for port %d(%s)\n",
325 index, i, pd->port_names[i]); 323 index, i, pd->port_names[i]);
326 continue; 324 ret = 0;
327 } 325 }
328
329 ds->ports[i] = slave_dev;
330 } 326 }
331 327
332#ifdef CONFIG_NET_DSA_HWMON 328#ifdef CONFIG_NET_DSA_HWMON
@@ -830,6 +826,10 @@ static struct packet_type dsa_pack_type __read_mostly = {
830 .func = dsa_switch_rcv, 826 .func = dsa_switch_rcv,
831}; 827};
832 828
829static struct notifier_block dsa_netdevice_nb __read_mostly = {
830 .notifier_call = dsa_slave_netdevice_event,
831};
832
833#ifdef CONFIG_PM_SLEEP 833#ifdef CONFIG_PM_SLEEP
834static int dsa_suspend(struct device *d) 834static int dsa_suspend(struct device *d)
835{ 835{
@@ -888,6 +888,8 @@ static int __init dsa_init_module(void)
888{ 888{
889 int rc; 889 int rc;
890 890
891 register_netdevice_notifier(&dsa_netdevice_nb);
892
891 rc = platform_driver_register(&dsa_driver); 893 rc = platform_driver_register(&dsa_driver);
892 if (rc) 894 if (rc)
893 return rc; 895 return rc;
@@ -900,6 +902,7 @@ module_init(dsa_init_module);
900 902
901static void __exit dsa_cleanup_module(void) 903static void __exit dsa_cleanup_module(void)
902{ 904{
905 unregister_netdevice_notifier(&dsa_netdevice_nb);
903 dev_remove_pack(&dsa_pack_type); 906 dev_remove_pack(&dsa_pack_type);
904 platform_driver_unregister(&dsa_driver); 907 platform_driver_unregister(&dsa_driver);
905} 908}