Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7960d6b9 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Roland Dreier
Browse files

RDMA/cxgb3: Use the dma state API instead of pci equivalents



The DMA API is preferred; no functional change.

Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 0eddb519
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -174,7 +174,7 @@ int cxio_create_cq(struct cxio_rdev *rdev_p, struct t3_cq *cq, int kernel)
		kfree(cq->sw_queue);
		kfree(cq->sw_queue);
		return -ENOMEM;
		return -ENOMEM;
	}
	}
	pci_unmap_addr_set(cq, mapping, cq->dma_addr);
	dma_unmap_addr_set(cq, mapping, cq->dma_addr);
	memset(cq->queue, 0, size);
	memset(cq->queue, 0, size);
	setup.id = cq->cqid;
	setup.id = cq->cqid;
	setup.base_addr = (u64) (cq->dma_addr);
	setup.base_addr = (u64) (cq->dma_addr);
@@ -297,7 +297,7 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain,
		goto err4;
		goto err4;


	memset(wq->queue, 0, depth * sizeof(union t3_wr));
	memset(wq->queue, 0, depth * sizeof(union t3_wr));
	pci_unmap_addr_set(wq, mapping, wq->dma_addr);
	dma_unmap_addr_set(wq, mapping, wq->dma_addr);
	wq->doorbell = (void __iomem *)rdev_p->rnic_info.kdb_addr;
	wq->doorbell = (void __iomem *)rdev_p->rnic_info.kdb_addr;
	if (!kernel_domain)
	if (!kernel_domain)
		wq->udb = (u64)rdev_p->rnic_info.udbell_physbase +
		wq->udb = (u64)rdev_p->rnic_info.udbell_physbase +
@@ -325,7 +325,7 @@ int cxio_destroy_cq(struct cxio_rdev *rdev_p, struct t3_cq *cq)
	dma_free_coherent(&(rdev_p->rnic_info.pdev->dev),
	dma_free_coherent(&(rdev_p->rnic_info.pdev->dev),
			  (1UL << (cq->size_log2))
			  (1UL << (cq->size_log2))
			  * sizeof(struct t3_cqe), cq->queue,
			  * sizeof(struct t3_cqe), cq->queue,
			  pci_unmap_addr(cq, mapping));
			  dma_unmap_addr(cq, mapping));
	cxio_hal_put_cqid(rdev_p->rscp, cq->cqid);
	cxio_hal_put_cqid(rdev_p->rscp, cq->cqid);
	return err;
	return err;
}
}
@@ -336,7 +336,7 @@ int cxio_destroy_qp(struct cxio_rdev *rdev_p, struct t3_wq *wq,
	dma_free_coherent(&(rdev_p->rnic_info.pdev->dev),
	dma_free_coherent(&(rdev_p->rnic_info.pdev->dev),
			  (1UL << (wq->size_log2))
			  (1UL << (wq->size_log2))
			  * sizeof(union t3_wr), wq->queue,
			  * sizeof(union t3_wr), wq->queue,
			  pci_unmap_addr(wq, mapping));
			  dma_unmap_addr(wq, mapping));
	kfree(wq->sq);
	kfree(wq->sq);
	cxio_hal_rqtpool_free(rdev_p, wq->rq_addr, (1UL << wq->rq_size_log2));
	cxio_hal_rqtpool_free(rdev_p, wq->rq_addr, (1UL << wq->rq_size_log2));
	kfree(wq->rq);
	kfree(wq->rq);
@@ -537,7 +537,7 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
		err = -ENOMEM;
		err = -ENOMEM;
		goto err;
		goto err;
	}
	}
	pci_unmap_addr_set(&rdev_p->ctrl_qp, mapping,
	dma_unmap_addr_set(&rdev_p->ctrl_qp, mapping,
			   rdev_p->ctrl_qp.dma_addr);
			   rdev_p->ctrl_qp.dma_addr);
	rdev_p->ctrl_qp.doorbell = (void __iomem *)rdev_p->rnic_info.kdb_addr;
	rdev_p->ctrl_qp.doorbell = (void __iomem *)rdev_p->rnic_info.kdb_addr;
	memset(rdev_p->ctrl_qp.workq, 0,
	memset(rdev_p->ctrl_qp.workq, 0,
@@ -583,7 +583,7 @@ static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p)
	dma_free_coherent(&(rdev_p->rnic_info.pdev->dev),
	dma_free_coherent(&(rdev_p->rnic_info.pdev->dev),
			  (1UL << T3_CTRL_QP_SIZE_LOG2)
			  (1UL << T3_CTRL_QP_SIZE_LOG2)
			  * sizeof(union t3_wr), rdev_p->ctrl_qp.workq,
			  * sizeof(union t3_wr), rdev_p->ctrl_qp.workq,
			  pci_unmap_addr(&rdev_p->ctrl_qp, mapping));
			  dma_unmap_addr(&rdev_p->ctrl_qp, mapping));
	return cxio_hal_clear_qp_ctx(rdev_p, T3_CTRL_QP_ID);
	return cxio_hal_clear_qp_ctx(rdev_p, T3_CTRL_QP_ID);
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -71,7 +71,7 @@ struct cxio_hal_ctrl_qp {
	wait_queue_head_t waitq;/* wait for RspQ/CQE msg */
	wait_queue_head_t waitq;/* wait for RspQ/CQE msg */
	union t3_wr *workq;	/* the work request queue */
	union t3_wr *workq;	/* the work request queue */
	dma_addr_t dma_addr;	/* pci bus address of the workq */
	dma_addr_t dma_addr;	/* pci bus address of the workq */
	DECLARE_PCI_UNMAP_ADDR(mapping)
	DEFINE_DMA_UNMAP_ADDR(mapping);
	void __iomem *doorbell;
	void __iomem *doorbell;
};
};


+2 −2
Original line number Original line Diff line number Diff line
@@ -691,7 +691,7 @@ struct t3_swrq {
struct t3_wq {
struct t3_wq {
	union t3_wr *queue;		/* DMA accessable memory */
	union t3_wr *queue;		/* DMA accessable memory */
	dma_addr_t dma_addr;		/* DMA address for HW */
	dma_addr_t dma_addr;		/* DMA address for HW */
	DECLARE_PCI_UNMAP_ADDR(mapping)	/* unmap kruft */
	DEFINE_DMA_UNMAP_ADDR(mapping); /* unmap kruft */
	u32 error;			/* 1 once we go to ERROR */
	u32 error;			/* 1 once we go to ERROR */
	u32 qpid;
	u32 qpid;
	u32 wptr;			/* idx to next available WR slot */
	u32 wptr;			/* idx to next available WR slot */
@@ -718,7 +718,7 @@ struct t3_cq {
	u32 wptr;
	u32 wptr;
	u32 size_log2;
	u32 size_log2;
	dma_addr_t dma_addr;
	dma_addr_t dma_addr;
	DECLARE_PCI_UNMAP_ADDR(mapping)
	DEFINE_DMA_UNMAP_ADDR(mapping);
	struct t3_cqe *queue;
	struct t3_cqe *queue;
	struct t3_cqe *sw_queue;
	struct t3_cqe *sw_queue;
	u32 sw_rptr;
	u32 sw_rptr;