static void ntb_transport_free(void *transport) { struct ntb_netdev *nt = transport; struct ntb_softc *ntb = nt->ntb; int i; nt->transport_link = NTB_LINK_DOWN; callout_drain(&nt->link_work); /* verify that all the qps are freed */ for (i = 0; i < nt->max_qps; i++) if (!test_bit(i, &nt->qp_bitmap)) ntb_transport_free_queue(&nt->qps[i]); ntb_unregister_event_callback(ntb); for (i = 0; i < NTB_NUM_MW; i++) if (nt->mw[i].virt_addr != NULL) contigfree(nt->mw[i].virt_addr, nt->mw[i].size, M_NTB_IF); free(nt->qps, M_NTB_IF); ntb_unregister_transport(ntb); }
/** * ntb_unregister_transport() - Unregister the transport with the NTB HW driver * @ndev - ntb_device of the transport to be freed * * This function unregisters the transport from the HW driver and performs any * necessary cleanups. */ void ntb_unregister_transport(struct ntb_device *ndev) { int i; if (!ndev->ntb_transport) return; for (i = 0; i < ndev->max_cbs; i++) ntb_unregister_db_callback(ndev, i); ntb_unregister_event_callback(ndev); ndev->ntb_transport = NULL; }