Lines Matching refs:slave_dev

74 	struct net_device *slave_dev;  in net_failover_close()  local
78 slave_dev = rtnl_dereference(nfo_info->primary_dev); in net_failover_close()
79 if (slave_dev) in net_failover_close()
80 dev_close(slave_dev); in net_failover_close()
82 slave_dev = rtnl_dereference(nfo_info->standby_dev); in net_failover_close()
83 if (slave_dev) in net_failover_close()
84 dev_close(slave_dev); in net_failover_close()
188 struct net_device *slave_dev; in net_failover_get_stats() local
195 slave_dev = rcu_dereference(nfo_info->primary_dev); in net_failover_get_stats()
196 if (slave_dev) { in net_failover_get_stats()
197 new = dev_get_stats(slave_dev, &temp); in net_failover_get_stats()
202 slave_dev = rcu_dereference(nfo_info->standby_dev); in net_failover_get_stats()
203 if (slave_dev) { in net_failover_get_stats()
204 new = dev_get_stats(slave_dev, &temp); in net_failover_get_stats()
246 struct net_device *slave_dev; in net_failover_set_rx_mode() local
250 slave_dev = rcu_dereference(nfo_info->primary_dev); in net_failover_set_rx_mode()
251 if (slave_dev) { in net_failover_set_rx_mode()
252 dev_uc_sync_multiple(slave_dev, dev); in net_failover_set_rx_mode()
253 dev_mc_sync_multiple(slave_dev, dev); in net_failover_set_rx_mode()
256 slave_dev = rcu_dereference(nfo_info->standby_dev); in net_failover_set_rx_mode()
257 if (slave_dev) { in net_failover_set_rx_mode()
258 dev_uc_sync_multiple(slave_dev, dev); in net_failover_set_rx_mode()
259 dev_mc_sync_multiple(slave_dev, dev); in net_failover_set_rx_mode()
294 struct net_device *slave_dev; in net_failover_vlan_rx_kill_vid() local
296 slave_dev = rcu_dereference(nfo_info->primary_dev); in net_failover_vlan_rx_kill_vid()
297 if (slave_dev) in net_failover_vlan_rx_kill_vid()
298 vlan_vid_del(slave_dev, proto, vid); in net_failover_vlan_rx_kill_vid()
300 slave_dev = rcu_dereference(nfo_info->standby_dev); in net_failover_vlan_rx_kill_vid()
301 if (slave_dev) in net_failover_vlan_rx_kill_vid()
302 vlan_vid_del(slave_dev, proto, vid); in net_failover_vlan_rx_kill_vid()
335 struct net_device *slave_dev; in nfo_ethtool_get_link_ksettings() local
337 slave_dev = rtnl_dereference(nfo_info->primary_dev); in nfo_ethtool_get_link_ksettings()
338 if (!slave_dev || !net_failover_xmit_ready(slave_dev)) { in nfo_ethtool_get_link_ksettings()
339 slave_dev = rtnl_dereference(nfo_info->standby_dev); in nfo_ethtool_get_link_ksettings()
340 if (!slave_dev || !net_failover_xmit_ready(slave_dev)) { in nfo_ethtool_get_link_ksettings()
349 return __ethtool_get_link_ksettings(slave_dev, cmd); in nfo_ethtool_get_link_ksettings()
435 static void net_failover_lower_state_changed(struct net_device *slave_dev, in net_failover_lower_state_changed() argument
441 if (netif_carrier_ok(slave_dev)) in net_failover_lower_state_changed()
446 if (slave_dev == primary_dev) { in net_failover_lower_state_changed()
459 netdev_lower_state_changed(slave_dev, &info); in net_failover_lower_state_changed()
462 static int net_failover_slave_pre_register(struct net_device *slave_dev, in net_failover_slave_pre_register() argument
472 slave_is_standby = slave_dev->dev.parent == failover_dev->dev.parent; in net_failover_slave_pre_register()
475 slave_dev->name, in net_failover_slave_pre_register()
484 if (!slave_is_standby && (!slave_dev->dev.parent || in net_failover_slave_pre_register()
485 !dev_is_pci(slave_dev->dev.parent))) in net_failover_slave_pre_register()
498 static int net_failover_slave_register(struct net_device *slave_dev, in net_failover_slave_register() argument
508 orig_mtu = slave_dev->mtu; in net_failover_slave_register()
509 err = dev_set_mtu(slave_dev, failover_dev->mtu); in net_failover_slave_register()
512 slave_dev->name, failover_dev->mtu); in net_failover_slave_register()
516 dev_hold(slave_dev); in net_failover_slave_register()
519 err = dev_open(slave_dev, NULL); in net_failover_slave_register()
522 slave_dev->name, err); in net_failover_slave_register()
528 dev_uc_sync_multiple(slave_dev, failover_dev); in net_failover_slave_register()
529 dev_mc_sync_multiple(slave_dev, failover_dev); in net_failover_slave_register()
532 err = vlan_vids_add_by_dev(slave_dev, failover_dev); in net_failover_slave_register()
535 slave_dev->name, err); in net_failover_slave_register()
542 slave_is_standby = slave_dev->dev.parent == failover_dev->dev.parent; in net_failover_slave_register()
545 rcu_assign_pointer(nfo_info->standby_dev, slave_dev); in net_failover_slave_register()
546 standby_dev = slave_dev; in net_failover_slave_register()
549 rcu_assign_pointer(nfo_info->primary_dev, slave_dev); in net_failover_slave_register()
550 primary_dev = slave_dev; in net_failover_slave_register()
552 failover_dev->min_mtu = slave_dev->min_mtu; in net_failover_slave_register()
553 failover_dev->max_mtu = slave_dev->max_mtu; in net_failover_slave_register()
556 net_failover_lower_state_changed(slave_dev, primary_dev, standby_dev); in net_failover_slave_register()
559 call_netdevice_notifiers(NETDEV_JOIN, slave_dev); in net_failover_slave_register()
562 slave_is_standby ? "standby" : "primary", slave_dev->name); in net_failover_slave_register()
567 dev_uc_unsync(slave_dev, failover_dev); in net_failover_slave_register()
568 dev_mc_unsync(slave_dev, failover_dev); in net_failover_slave_register()
569 dev_close(slave_dev); in net_failover_slave_register()
571 dev_put(slave_dev); in net_failover_slave_register()
572 dev_set_mtu(slave_dev, orig_mtu); in net_failover_slave_register()
577 static int net_failover_slave_pre_unregister(struct net_device *slave_dev, in net_failover_slave_pre_unregister() argument
587 if (slave_dev != primary_dev && slave_dev != standby_dev) in net_failover_slave_pre_unregister()
593 static int net_failover_slave_unregister(struct net_device *slave_dev, in net_failover_slave_unregister() argument
604 if (WARN_ON_ONCE(slave_dev != primary_dev && slave_dev != standby_dev)) in net_failover_slave_unregister()
607 vlan_vids_del_by_dev(slave_dev, failover_dev); in net_failover_slave_unregister()
608 dev_uc_unsync(slave_dev, failover_dev); in net_failover_slave_unregister()
609 dev_mc_unsync(slave_dev, failover_dev); in net_failover_slave_unregister()
610 dev_close(slave_dev); in net_failover_slave_unregister()
615 slave_is_standby = slave_dev->dev.parent == failover_dev->dev.parent; in net_failover_slave_unregister()
626 dev_put(slave_dev); in net_failover_slave_unregister()
631 slave_is_standby ? "standby" : "primary", slave_dev->name); in net_failover_slave_unregister()
636 static int net_failover_slave_link_change(struct net_device *slave_dev, in net_failover_slave_link_change() argument
647 if (slave_dev != primary_dev && slave_dev != standby_dev) in net_failover_slave_link_change()
660 net_failover_lower_state_changed(slave_dev, primary_dev, standby_dev); in net_failover_slave_link_change()
665 static int net_failover_slave_name_change(struct net_device *slave_dev, in net_failover_slave_name_change() argument
676 if (slave_dev != primary_dev && slave_dev != standby_dev) in net_failover_slave_name_change()
682 dev_open(slave_dev, NULL); in net_failover_slave_name_change()
797 struct net_device *slave_dev; in net_failover_destroy() local
809 slave_dev = rtnl_dereference(nfo_info->primary_dev); in net_failover_destroy()
810 if (slave_dev) in net_failover_destroy()
811 failover_slave_unregister(slave_dev); in net_failover_destroy()
813 slave_dev = rtnl_dereference(nfo_info->standby_dev); in net_failover_destroy()
814 if (slave_dev) in net_failover_destroy()
815 failover_slave_unregister(slave_dev); in net_failover_destroy()