Lines Matching full:mw

619 	struct ntb_transport_mw *mw;  in ntb_transport_setup_qp_mw()  local
631 mw = &nt->mw_vec[mw_num]; in ntb_transport_setup_qp_mw()
633 if (!mw->virt_addr) in ntb_transport_setup_qp_mw()
641 rx_size = (unsigned int)mw->xlat_size / num_qps_mw; in ntb_transport_setup_qp_mw()
642 qp->rx_buff = mw->virt_addr + rx_size * (qp_num / mw_count); in ntb_transport_setup_qp_mw()
795 struct ntb_transport_mw *mw = &nt->mw_vec[num_mw]; in ntb_free_mw() local
798 if (!mw->virt_addr) in ntb_free_mw()
802 dma_free_coherent(&pdev->dev, mw->alloc_size, in ntb_free_mw()
803 mw->alloc_addr, mw->dma_addr); in ntb_free_mw()
804 mw->xlat_size = 0; in ntb_free_mw()
805 mw->buff_size = 0; in ntb_free_mw()
806 mw->alloc_size = 0; in ntb_free_mw()
807 mw->alloc_addr = NULL; in ntb_free_mw()
808 mw->virt_addr = NULL; in ntb_free_mw()
811 static int ntb_alloc_mw_buffer(struct ntb_transport_mw *mw, in ntb_alloc_mw_buffer() argument
830 alloc_addr = dma_alloc_attrs(ntb_dev, mw->alloc_size, in ntb_alloc_mw_buffer()
834 dev_err(ntb_dev, "Unable to alloc MW buff of size %zu\n", in ntb_alloc_mw_buffer()
835 mw->alloc_size); in ntb_alloc_mw_buffer()
847 if (mw->alloc_size > mw->buff_size) { in ntb_alloc_mw_buffer()
856 mw->alloc_addr = alloc_addr; in ntb_alloc_mw_buffer()
857 mw->virt_addr = virt_addr; in ntb_alloc_mw_buffer()
858 mw->dma_addr = dma_addr; in ntb_alloc_mw_buffer()
863 dma_free_coherent(ntb_dev, mw->alloc_size, alloc_addr, dma_addr); in ntb_alloc_mw_buffer()
871 struct ntb_transport_mw *mw = &nt->mw_vec[num_mw]; in ntb_set_mw() local
890 if (mw->xlat_size == xlat_size) in ntb_set_mw()
893 if (mw->buff_size) in ntb_set_mw()
897 mw->xlat_size = xlat_size; in ntb_set_mw()
898 mw->buff_size = buff_size; in ntb_set_mw()
899 mw->alloc_size = buff_size; in ntb_set_mw()
901 rc = ntb_alloc_mw_buffer(mw, &pdev->dev, xlat_align); in ntb_set_mw()
903 mw->alloc_size *= 2; in ntb_set_mw()
904 rc = ntb_alloc_mw_buffer(mw, &pdev->dev, xlat_align); in ntb_set_mw()
907 "Unable to alloc aligned MW buff\n"); in ntb_set_mw()
908 mw->xlat_size = 0; in ntb_set_mw()
909 mw->buff_size = 0; in ntb_set_mw()
910 mw->alloc_size = 0; in ntb_set_mw()
916 rc = ntb_mw_set_trans(nt->ndev, PIDX, num_mw, mw->dma_addr, in ntb_set_mw()
917 mw->xlat_size); in ntb_set_mw()
919 dev_err(&pdev->dev, "Unable to set mw%d translation", num_mw); in ntb_set_mw()
1109 dev_dbg(&pdev->dev, "Remote MW%d size = %#llx\n", i, val64); in ntb_transport_link_work()
1266 struct ntb_transport_mw *mw; in ntb_transport_probe() local
1275 dev_err(&ndev->dev, "Inbound MW based NTB API is required\n"); in ntb_transport_probe()
1299 * we will reserve the last MW for the MSI window. in ntb_transport_probe()
1311 /* Limit the MW's based on the availability of scratchpads */ in ntb_transport_probe()
1332 mw = &nt->mw_vec[i]; in ntb_transport_probe()
1334 rc = ntb_peer_mw_get_addr(ndev, i, &mw->phys_addr, in ntb_transport_probe()
1335 &mw->phys_size); in ntb_transport_probe()
1339 mw->vbase = ioremap_wc(mw->phys_addr, mw->phys_size); in ntb_transport_probe()
1340 if (!mw->vbase) { in ntb_transport_probe()
1345 mw->buff_size = 0; in ntb_transport_probe()
1346 mw->xlat_size = 0; in ntb_transport_probe()
1347 mw->virt_addr = NULL; in ntb_transport_probe()
1348 mw->dma_addr = 0; in ntb_transport_probe()
1414 mw = &nt->mw_vec[i]; in ntb_transport_probe()
1415 iounmap(mw->vbase); in ntb_transport_probe()