MCPcopy Create free account
hub / github.com/F-Stack/f-stack / iflib_stop

Function iflib_stop

freebsd/net/iflib.c:2522–2585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2520}
2521
2522void
2523iflib_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++)

Callers 7

iflib_netmap_registerFunction · 0.85
iflib_if_init_lockedFunction · 0.85
iflib_if_ioctlFunction · 0.85
iflib_vlan_registerFunction · 0.85
iflib_vlan_unregisterFunction · 0.85
iflib_device_deregisterFunction · 0.85
iflib_clone_destroyFunction · 0.85

Calls 8

if_setdrvflagbitsFunction · 0.85
iflib_debug_resetFunction · 0.85
iflib_ifmp_purgeFunction · 0.85
iflib_txsd_freeFunction · 0.85
ifmp_ring_reset_statsFunction · 0.85
bzeroFunction · 0.85
iflib_fl_bufs_freeFunction · 0.85
DELAYFunction · 0.50

Tested by

no test coverage detected