| 2520 | } |
| 2521 | |
| 2522 | void |
| 2523 | iflib_stop(if_ctx_t ctx) |
| 2524 | { |
| 2525 | iflib_txq_t txq = ctx->ifc_txqs; |
| 2526 | iflib_rxq_t rxq = ctx->ifc_rxqs; |
| 2527 | if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; |
| 2528 | if_shared_ctx_t sctx = ctx->ifc_sctx; |
| 2529 | iflib_dma_info_t di; |
| 2530 | iflib_fl_t fl; |
| 2531 | int i, j; |
| 2532 | |
| 2533 | /* Tell the stack that the interface is no longer active */ |
| 2534 | if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); |
| 2535 | |
| 2536 | IFDI_INTR_DISABLE(ctx); |
| 2537 | DELAY(1000); |
| 2538 | IFDI_STOP(ctx); |
| 2539 | DELAY(1000); |
| 2540 | |
| 2541 | /* |
| 2542 | * Stop any pending txsync/rxsync and prevent new ones |
| 2543 | * form starting. Processes blocked in poll() will get |
| 2544 | * POLLERR. |
| 2545 | */ |
| 2546 | netmap_disable_all_rings(ctx->ifc_ifp); |
| 2547 | |
| 2548 | iflib_debug_reset(); |
| 2549 | /* Wait for current tx queue users to exit to disarm watchdog timer. */ |
| 2550 | for (i = 0; i < scctx->isc_ntxqsets; i++, txq++) { |
| 2551 | /* make sure all transmitters have completed before proceeding XXX */ |
| 2552 | |
| 2553 | CALLOUT_LOCK(txq); |
| 2554 | callout_stop(&txq->ift_timer); |
| 2555 | #ifdef DEV_NETMAP |
| 2556 | callout_stop(&txq->ift_netmap_timer); |
| 2557 | #endif /* DEV_NETMAP */ |
| 2558 | CALLOUT_UNLOCK(txq); |
| 2559 | |
| 2560 | /* clean any enqueued buffers */ |
| 2561 | iflib_ifmp_purge(txq); |
| 2562 | /* Free any existing tx buffers. */ |
| 2563 | for (j = 0; j < txq->ift_size; j++) { |
| 2564 | iflib_txsd_free(ctx, txq, j); |
| 2565 | } |
| 2566 | txq->ift_processed = txq->ift_cleaned = txq->ift_cidx_processed = 0; |
| 2567 | txq->ift_in_use = txq->ift_gen = txq->ift_cidx = txq->ift_pidx = txq->ift_no_desc_avail = 0; |
| 2568 | txq->ift_closed = txq->ift_mbuf_defrag = txq->ift_mbuf_defrag_failed = 0; |
| 2569 | txq->ift_no_tx_dma_setup = txq->ift_txd_encap_efbig = txq->ift_map_failed = 0; |
| 2570 | txq->ift_pullups = 0; |
| 2571 | ifmp_ring_reset_stats(txq->ift_br); |
| 2572 | for (j = 0, di = txq->ift_ifdi; j < sctx->isc_ntxqs; j++, di++) |
| 2573 | bzero((void *)di->idi_vaddr, di->idi_size); |
| 2574 | } |
| 2575 | for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { |
| 2576 | /* make sure all transmitters have completed before proceeding XXX */ |
| 2577 | |
| 2578 | rxq->ifr_cq_cidx = 0; |
| 2579 | for (j = 0, di = rxq->ifr_ifdi; j < sctx->isc_nrxqs; j++, di++) |
no test coverage detected