Lines Matching refs:mw
617 struct ntb_transport_mw *mw;
629 mw = &nt->mw_vec[mw_num];
631 if (!mw->virt_addr)
639 rx_size = (unsigned int)mw->xlat_size / num_qps_mw;
640 qp->rx_buff = mw->virt_addr + rx_size * (qp_num / mw_count);
793 struct ntb_transport_mw *mw = &nt->mw_vec[num_mw];
796 if (!mw->virt_addr)
800 dma_free_coherent(&pdev->dev, mw->alloc_size,
801 mw->alloc_addr, mw->dma_addr);
802 mw->xlat_size = 0;
803 mw->buff_size = 0;
804 mw->alloc_size = 0;
805 mw->alloc_addr = NULL;
806 mw->virt_addr = NULL;
809 static int ntb_alloc_mw_buffer(struct ntb_transport_mw *mw,
816 alloc_addr = dma_alloc_coherent(dma_dev, mw->alloc_size,
820 mw->alloc_size);
832 if (mw->alloc_size > mw->buff_size) {
841 mw->alloc_addr = alloc_addr;
842 mw->virt_addr = virt_addr;
843 mw->dma_addr = dma_addr;
848 dma_free_coherent(dma_dev, mw->alloc_size, alloc_addr, dma_addr);
856 struct ntb_transport_mw *mw = &nt->mw_vec[num_mw];
875 if (mw->xlat_size == xlat_size)
878 if (mw->buff_size)
882 mw->xlat_size = xlat_size;
883 mw->buff_size = buff_size;
884 mw->alloc_size = buff_size;
886 rc = ntb_alloc_mw_buffer(mw, &pdev->dev, xlat_align);
888 mw->alloc_size *= 2;
889 rc = ntb_alloc_mw_buffer(mw, &pdev->dev, xlat_align);
893 mw->xlat_size = 0;
894 mw->buff_size = 0;
895 mw->alloc_size = 0;
901 rc = ntb_mw_set_trans(nt->ndev, PIDX, num_mw, mw->dma_addr,
902 mw->xlat_size);
904 dev_err(&pdev->dev, "Unable to set mw%d translation", num_mw);
1251 struct ntb_transport_mw *mw;
1317 mw = &nt->mw_vec[i];
1319 rc = ntb_peer_mw_get_addr(ndev, i, &mw->phys_addr,
1320 &mw->phys_size);
1324 mw->vbase = ioremap_wc(mw->phys_addr, mw->phys_size);
1325 if (!mw->vbase) {
1330 mw->buff_size = 0;
1331 mw->xlat_size = 0;
1332 mw->virt_addr = NULL;
1333 mw->dma_addr = 0;
1399 mw = &nt->mw_vec[i];
1400 iounmap(mw->vbase);