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()
184 struct net_device *slave_dev; in net_failover_get_stats() local
191 slave_dev = rcu_dereference(nfo_info->primary_dev); in net_failover_get_stats()
192 if (slave_dev) { in net_failover_get_stats()
193 new = dev_get_stats(slave_dev, &temp); in net_failover_get_stats()
198 slave_dev = rcu_dereference(nfo_info->standby_dev); in net_failover_get_stats()
199 if (slave_dev) { in net_failover_get_stats()
200 new = dev_get_stats(slave_dev, &temp); in net_failover_get_stats()
242 struct net_device *slave_dev; in net_failover_set_rx_mode() local
246 slave_dev = rcu_dereference(nfo_info->primary_dev); in net_failover_set_rx_mode()
247 if (slave_dev) { in net_failover_set_rx_mode()
248 dev_uc_sync_multiple(slave_dev, dev); in net_failover_set_rx_mode()
249 dev_mc_sync_multiple(slave_dev, dev); in net_failover_set_rx_mode()
252 slave_dev = rcu_dereference(nfo_info->standby_dev); in net_failover_set_rx_mode()
253 if (slave_dev) { in net_failover_set_rx_mode()
254 dev_uc_sync_multiple(slave_dev, dev); in net_failover_set_rx_mode()
255 dev_mc_sync_multiple(slave_dev, dev); in net_failover_set_rx_mode()
290 struct net_device *slave_dev; in net_failover_vlan_rx_kill_vid() local
292 slave_dev = rcu_dereference(nfo_info->primary_dev); in net_failover_vlan_rx_kill_vid()
293 if (slave_dev) in net_failover_vlan_rx_kill_vid()
294 vlan_vid_del(slave_dev, proto, vid); in net_failover_vlan_rx_kill_vid()
296 slave_dev = rcu_dereference(nfo_info->standby_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()
331 struct net_device *slave_dev; in nfo_ethtool_get_link_ksettings() local
333 slave_dev = rtnl_dereference(nfo_info->primary_dev); in nfo_ethtool_get_link_ksettings()
334 if (!slave_dev || !net_failover_xmit_ready(slave_dev)) { in nfo_ethtool_get_link_ksettings()
335 slave_dev = rtnl_dereference(nfo_info->standby_dev); in nfo_ethtool_get_link_ksettings()
336 if (!slave_dev || !net_failover_xmit_ready(slave_dev)) { in nfo_ethtool_get_link_ksettings()
345 return __ethtool_get_link_ksettings(slave_dev, cmd); in nfo_ethtool_get_link_ksettings()
431 static void net_failover_lower_state_changed(struct net_device *slave_dev, in net_failover_lower_state_changed() argument
437 if (netif_carrier_ok(slave_dev)) in net_failover_lower_state_changed()
442 if (slave_dev == primary_dev) { in net_failover_lower_state_changed()
455 netdev_lower_state_changed(slave_dev, &info); in net_failover_lower_state_changed()
458 static int net_failover_slave_pre_register(struct net_device *slave_dev, in net_failover_slave_pre_register() argument
468 slave_is_standby = slave_dev->dev.parent == failover_dev->dev.parent; in net_failover_slave_pre_register()
471 slave_dev->name, in net_failover_slave_pre_register()
480 if (!slave_is_standby && (!slave_dev->dev.parent || in net_failover_slave_pre_register()
481 !dev_is_pci(slave_dev->dev.parent))) in net_failover_slave_pre_register()
494 static int net_failover_slave_register(struct net_device *slave_dev, in net_failover_slave_register() argument
504 orig_mtu = slave_dev->mtu; in net_failover_slave_register()
505 err = dev_set_mtu(slave_dev, failover_dev->mtu); in net_failover_slave_register()
508 slave_dev->name, failover_dev->mtu); in net_failover_slave_register()
512 dev_hold(slave_dev); in net_failover_slave_register()
515 err = dev_open(slave_dev, NULL); in net_failover_slave_register()
518 slave_dev->name, err); in net_failover_slave_register()
524 dev_uc_sync_multiple(slave_dev, failover_dev); in net_failover_slave_register()
525 dev_mc_sync_multiple(slave_dev, failover_dev); in net_failover_slave_register()
528 err = vlan_vids_add_by_dev(slave_dev, failover_dev); in net_failover_slave_register()
531 slave_dev->name, err); in net_failover_slave_register()
538 slave_is_standby = slave_dev->dev.parent == failover_dev->dev.parent; in net_failover_slave_register()
541 rcu_assign_pointer(nfo_info->standby_dev, slave_dev); in net_failover_slave_register()
542 standby_dev = slave_dev; in net_failover_slave_register()
545 rcu_assign_pointer(nfo_info->primary_dev, slave_dev); in net_failover_slave_register()
546 primary_dev = slave_dev; in net_failover_slave_register()
548 failover_dev->min_mtu = slave_dev->min_mtu; in net_failover_slave_register()
549 failover_dev->max_mtu = slave_dev->max_mtu; in net_failover_slave_register()
552 net_failover_lower_state_changed(slave_dev, primary_dev, standby_dev); in net_failover_slave_register()
555 call_netdevice_notifiers(NETDEV_JOIN, slave_dev); in net_failover_slave_register()
558 slave_is_standby ? "standby" : "primary", slave_dev->name); in net_failover_slave_register()
563 dev_uc_unsync(slave_dev, failover_dev); in net_failover_slave_register()
564 dev_mc_unsync(slave_dev, failover_dev); in net_failover_slave_register()
565 dev_close(slave_dev); in net_failover_slave_register()
567 dev_put(slave_dev); in net_failover_slave_register()
568 dev_set_mtu(slave_dev, orig_mtu); in net_failover_slave_register()
573 static int net_failover_slave_pre_unregister(struct net_device *slave_dev, in net_failover_slave_pre_unregister() argument
583 if (slave_dev != primary_dev && slave_dev != standby_dev) in net_failover_slave_pre_unregister()
589 static int net_failover_slave_unregister(struct net_device *slave_dev, in net_failover_slave_unregister() argument
600 if (WARN_ON_ONCE(slave_dev != primary_dev && slave_dev != standby_dev)) in net_failover_slave_unregister()
603 vlan_vids_del_by_dev(slave_dev, failover_dev); in net_failover_slave_unregister()
604 dev_uc_unsync(slave_dev, failover_dev); in net_failover_slave_unregister()
605 dev_mc_unsync(slave_dev, failover_dev); in net_failover_slave_unregister()
606 dev_close(slave_dev); in net_failover_slave_unregister()
611 slave_is_standby = slave_dev->dev.parent == failover_dev->dev.parent; in net_failover_slave_unregister()
622 dev_put(slave_dev); in net_failover_slave_unregister()
627 slave_is_standby ? "standby" : "primary", slave_dev->name); in net_failover_slave_unregister()
632 static int net_failover_slave_link_change(struct net_device *slave_dev, in net_failover_slave_link_change() argument
643 if (slave_dev != primary_dev && slave_dev != standby_dev) in net_failover_slave_link_change()
656 net_failover_lower_state_changed(slave_dev, primary_dev, standby_dev); in net_failover_slave_link_change()
661 static int net_failover_slave_name_change(struct net_device *slave_dev, in net_failover_slave_name_change() argument
672 if (slave_dev != primary_dev && slave_dev != standby_dev) in net_failover_slave_name_change()
678 dev_open(slave_dev, NULL); in net_failover_slave_name_change()
792 struct net_device *slave_dev; in net_failover_destroy() local
804 slave_dev = rtnl_dereference(nfo_info->primary_dev); in net_failover_destroy()
805 if (slave_dev) in net_failover_destroy()
806 failover_slave_unregister(slave_dev); in net_failover_destroy()
808 slave_dev = rtnl_dereference(nfo_info->standby_dev); in net_failover_destroy()
809 if (slave_dev) in net_failover_destroy()
810 failover_slave_unregister(slave_dev); in net_failover_destroy()