* Hook from hardclock. Tries to schedule a netisr, but keeps track * of lost ticks due to the previous handler taking too long. * Normally, this should not happen, because polling handler should * run for a short time. However, in some cases (e.g. when there are * changes in link status etc.) the drivers take a very long time * (even in the order of milliseconds) to reset and reconfigure the
| 291 | * meaning either stray interrupts or delayed events. |
| 292 | */ |
| 293 | void |
| 294 | hardclock_device_poll(void) |
| 295 | { |
| 296 | static struct timeval prev_t, t; |
| 297 | int delta; |
| 298 | |
| 299 | if (poll_handlers == 0 || poll_shutting_down) |
| 300 | return; |
| 301 | |
| 302 | microuptime(&t); |
| 303 | delta = (t.tv_usec - prev_t.tv_usec) + |
| 304 | (t.tv_sec - prev_t.tv_sec)*1000000; |
| 305 | if (delta * hz < 500000) |
| 306 | short_ticks++; |
| 307 | else |
| 308 | prev_t = t; |
| 309 | |
| 310 | if (pending_polls > 100) { |
| 311 | /* |
| 312 | * Too much, assume it has stalled (not always true |
| 313 | * see comment above). |
| 314 | */ |
| 315 | stalled++; |
| 316 | pending_polls = 0; |
| 317 | phase = 0; |
| 318 | } |
| 319 | |
| 320 | if (phase <= 2) { |
| 321 | if (phase != 0) |
| 322 | suspect++; |
| 323 | phase = 1; |
| 324 | netisr_poll_scheduled = 1; |
| 325 | netisr_pollmore_scheduled = 1; |
| 326 | netisr_sched_poll(); |
| 327 | phase = 2; |
| 328 | } |
| 329 | if (pending_polls++ > 0) |
| 330 | lost_polls++; |
| 331 | } |
| 332 | |
| 333 | /* |
| 334 | * ether_poll is called from the idle loop. |
no test coverage detected