Lines Matching refs:mw
617 struct ntb_transport_mw *mw; in ntb_transport_setup_qp_mw() local
629 mw = &nt->mw_vec[mw_num]; in ntb_transport_setup_qp_mw()
631 if (!mw->virt_addr) in ntb_transport_setup_qp_mw()
639 rx_size = (unsigned int)mw->xlat_size / num_qps_mw; in ntb_transport_setup_qp_mw()
640 qp->rx_buff = mw->virt_addr + rx_size * (qp_num / mw_count); in ntb_transport_setup_qp_mw()
793 struct ntb_transport_mw *mw = &nt->mw_vec[num_mw]; in ntb_free_mw() local
796 if (!mw->virt_addr) in ntb_free_mw()
800 dma_free_coherent(&pdev->dev, mw->alloc_size, in ntb_free_mw()
801 mw->alloc_addr, mw->dma_addr); in ntb_free_mw()
802 mw->xlat_size = 0; in ntb_free_mw()
803 mw->buff_size = 0; in ntb_free_mw()
804 mw->alloc_size = 0; in ntb_free_mw()
805 mw->alloc_addr = NULL; in ntb_free_mw()
806 mw->virt_addr = NULL; in ntb_free_mw()
809 static int ntb_alloc_mw_buffer(struct ntb_transport_mw *mw, in ntb_alloc_mw_buffer() argument
816 alloc_addr = dma_alloc_coherent(dma_dev, mw->alloc_size, in ntb_alloc_mw_buffer()
820 mw->alloc_size); in ntb_alloc_mw_buffer()
832 if (mw->alloc_size > mw->buff_size) { in ntb_alloc_mw_buffer()
841 mw->alloc_addr = alloc_addr; in ntb_alloc_mw_buffer()
842 mw->virt_addr = virt_addr; in ntb_alloc_mw_buffer()
843 mw->dma_addr = dma_addr; in ntb_alloc_mw_buffer()
848 dma_free_coherent(dma_dev, mw->alloc_size, alloc_addr, dma_addr); in ntb_alloc_mw_buffer()
856 struct ntb_transport_mw *mw = &nt->mw_vec[num_mw]; in ntb_set_mw() local
875 if (mw->xlat_size == xlat_size) in ntb_set_mw()
878 if (mw->buff_size) in ntb_set_mw()
882 mw->xlat_size = xlat_size; in ntb_set_mw()
883 mw->buff_size = buff_size; in ntb_set_mw()
884 mw->alloc_size = buff_size; in ntb_set_mw()
886 rc = ntb_alloc_mw_buffer(mw, &pdev->dev, xlat_align); in ntb_set_mw()
888 mw->alloc_size *= 2; in ntb_set_mw()
889 rc = ntb_alloc_mw_buffer(mw, &pdev->dev, xlat_align); in ntb_set_mw()
893 mw->xlat_size = 0; in ntb_set_mw()
894 mw->buff_size = 0; in ntb_set_mw()
895 mw->alloc_size = 0; in ntb_set_mw()
901 rc = ntb_mw_set_trans(nt->ndev, PIDX, num_mw, mw->dma_addr, in ntb_set_mw()
902 mw->xlat_size); in ntb_set_mw()
1244 struct ntb_transport_mw *mw; in ntb_transport_probe() local
1310 mw = &nt->mw_vec[i]; in ntb_transport_probe()
1312 rc = ntb_peer_mw_get_addr(ndev, i, &mw->phys_addr, in ntb_transport_probe()
1313 &mw->phys_size); in ntb_transport_probe()
1317 mw->vbase = ioremap_wc(mw->phys_addr, mw->phys_size); in ntb_transport_probe()
1318 if (!mw->vbase) { in ntb_transport_probe()
1323 mw->buff_size = 0; in ntb_transport_probe()
1324 mw->xlat_size = 0; in ntb_transport_probe()
1325 mw->virt_addr = NULL; in ntb_transport_probe()
1326 mw->dma_addr = 0; in ntb_transport_probe()
1392 mw = &nt->mw_vec[i]; in ntb_transport_probe()
1393 iounmap(mw->vbase); in ntb_transport_probe()