diff options
Diffstat (limited to 'net/core/link_watch.c')
| -rw-r--r-- | net/core/link_watch.c | 43 | 
1 files changed, 25 insertions, 18 deletions
diff --git a/net/core/link_watch.c b/net/core/link_watch.c index 01a1101b593..bd0767e6b2b 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c @@ -76,10 +76,26 @@ static void rfc2863_policy(struct net_device *dev)  } +void linkwatch_init_dev(struct net_device *dev) +{ +	/* Handle pre-registration link state changes */ +	if (!netif_carrier_ok(dev) || netif_dormant(dev)) +		rfc2863_policy(dev); +} + +  static bool linkwatch_urgent_event(struct net_device *dev)  { -	return netif_running(dev) && netif_carrier_ok(dev) && -		qdisc_tx_changing(dev); +	if (!netif_running(dev)) +		return false; + +	if (dev->ifindex != dev->iflink) +		return true; + +	if (dev->priv_flags & IFF_TEAM_PORT) +		return true; + +	return netif_carrier_ok(dev) &&	qdisc_tx_changing(dev);  } @@ -115,22 +131,13 @@ static void linkwatch_schedule_work(int urgent)  		delay = 0;  	/* -	 * This is true if we've scheduled it immeditately or if we don't -	 * need an immediate execution and it's already pending. +	 * If urgent, schedule immediate execution; otherwise, don't +	 * override the existing timer.  	 */ -	if (schedule_delayed_work(&linkwatch_work, delay) == !delay) -		return; - -	/* Don't bother if there is nothing urgent. */ -	if (!test_bit(LW_URGENT, &linkwatch_flags)) -		return; - -	/* It's already running which is good enough. */ -	if (!cancel_delayed_work(&linkwatch_work)) -		return; - -	/* Otherwise we reschedule it again for immediate exection. */ -	schedule_delayed_work(&linkwatch_work, 0); +	if (test_bit(LW_URGENT, &linkwatch_flags)) +		mod_delayed_work(system_wq, &linkwatch_work, 0); +	else +		schedule_delayed_work(&linkwatch_work, delay);  } @@ -140,7 +147,7 @@ static void linkwatch_do_dev(struct net_device *dev)  	 * Make sure the above read is complete since it can be  	 * rewritten as soon as we clear the bit below.  	 */ -	smp_mb__before_clear_bit(); +	smp_mb__before_atomic();  	/* We are about to handle this device,  	 * so new events can be accepted  | 
