* netisr_poll is typically scheduled once per tick. */
| 431 | * netisr_poll is typically scheduled once per tick. |
| 432 | */ |
| 433 | void |
| 434 | netisr_poll(void) |
| 435 | { |
| 436 | int i, cycles; |
| 437 | enum poll_cmd arg = POLL_ONLY; |
| 438 | |
| 439 | NET_EPOCH_ASSERT(); |
| 440 | |
| 441 | if (poll_handlers == 0) |
| 442 | return; |
| 443 | |
| 444 | mtx_lock(&poll_mtx); |
| 445 | if (!netisr_poll_scheduled) { |
| 446 | mtx_unlock(&poll_mtx); |
| 447 | return; |
| 448 | } |
| 449 | netisr_poll_scheduled = 0; |
| 450 | phase = 3; |
| 451 | if (residual_burst == 0) { /* first call in this tick */ |
| 452 | microuptime(&poll_start_t); |
| 453 | if (++reg_frac_count == reg_frac) { |
| 454 | arg = POLL_AND_CHECK_STATUS; |
| 455 | reg_frac_count = 0; |
| 456 | } |
| 457 | |
| 458 | residual_burst = poll_burst; |
| 459 | } |
| 460 | cycles = (residual_burst < poll_each_burst) ? |
| 461 | residual_burst : poll_each_burst; |
| 462 | residual_burst -= cycles; |
| 463 | |
| 464 | for (i = 0 ; i < poll_handlers ; i++) |
| 465 | pr[i].handler(pr[i].ifp, arg, cycles); |
| 466 | |
| 467 | phase = 4; |
| 468 | mtx_unlock(&poll_mtx); |
| 469 | } |
| 470 | |
| 471 | /* |
| 472 | * Try to register routine for polling. Returns 0 if successful |
no test coverage detected