diff options
Diffstat (limited to 'net/core/link_watch.c')
-rw-r--r-- | net/core/link_watch.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/net/core/link_watch.c b/net/core/link_watch.c index c3519c6d1b16..8f82a5cc3851 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c | |||
@@ -76,6 +76,14 @@ static void rfc2863_policy(struct net_device *dev) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | void linkwatch_init_dev(struct net_device *dev) | ||
80 | { | ||
81 | /* Handle pre-registration link state changes */ | ||
82 | if (!netif_carrier_ok(dev) || netif_dormant(dev)) | ||
83 | rfc2863_policy(dev); | ||
84 | } | ||
85 | |||
86 | |||
79 | static bool linkwatch_urgent_event(struct net_device *dev) | 87 | static bool linkwatch_urgent_event(struct net_device *dev) |
80 | { | 88 | { |
81 | if (!netif_running(dev)) | 89 | if (!netif_running(dev)) |
@@ -120,22 +128,13 @@ static void linkwatch_schedule_work(int urgent) | |||
120 | delay = 0; | 128 | delay = 0; |
121 | 129 | ||
122 | /* | 130 | /* |
123 | * This is true if we've scheduled it immeditately or if we don't | 131 | * If urgent, schedule immediate execution; otherwise, don't |
124 | * need an immediate execution and it's already pending. | 132 | * override the existing timer. |
125 | */ | 133 | */ |
126 | if (schedule_delayed_work(&linkwatch_work, delay) == !delay) | 134 | if (test_bit(LW_URGENT, &linkwatch_flags)) |
127 | return; | 135 | mod_delayed_work(system_wq, &linkwatch_work, 0); |
128 | 136 | else | |
129 | /* Don't bother if there is nothing urgent. */ | 137 | schedule_delayed_work(&linkwatch_work, delay); |
130 | if (!test_bit(LW_URGENT, &linkwatch_flags)) | ||
131 | return; | ||
132 | |||
133 | /* It's already running which is good enough. */ | ||
134 | if (!__cancel_delayed_work(&linkwatch_work)) | ||
135 | return; | ||
136 | |||
137 | /* Otherwise we reschedule it again for immediate execution. */ | ||
138 | schedule_delayed_work(&linkwatch_work, 0); | ||
139 | } | 138 | } |
140 | 139 | ||
141 | 140 | ||