diff options
author | Haggai Eran <haggaie@mellanox.com> | 2014-12-11 10:04:10 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-12-15 21:13:35 -0500 |
commit | 21af2c3ebfd551660ae0016ecc5bc9afcc24f116 (patch) | |
tree | 769ad4c07f00df2c4f55d0a330a2d38e001b762c | |
parent | 70e71ca0af244f48a5dcf56dc435243792e3a495 (diff) |
IB/mlx5: Remove per-MR pas and dma pointers
Since UMR code now uses its own context struct on the stack, the pas
and dma pointers for the UMR operation that remained in the mlx5_ib_mr
struct are not necessary. This patch removes them.
Fixes: a74d24168d2d ("IB/mlx5: Refactor UMR to have its own context struct")
Signed-off-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx5/mr.c | 21 |
2 files changed, 12 insertions, 11 deletions
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h index 386780f0d1e1..29da55222070 100644 --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h | |||
@@ -261,8 +261,6 @@ struct mlx5_ib_mr { | |||
261 | struct list_head list; | 261 | struct list_head list; |
262 | int order; | 262 | int order; |
263 | int umred; | 263 | int umred; |
264 | __be64 *pas; | ||
265 | dma_addr_t dma; | ||
266 | int npages; | 264 | int npages; |
267 | struct mlx5_ib_dev *dev; | 265 | struct mlx5_ib_dev *dev; |
268 | struct mlx5_create_mkey_mbox_out out; | 266 | struct mlx5_create_mkey_mbox_out out; |
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 5a80dd993761..2ab081cdbca0 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c | |||
@@ -743,6 +743,8 @@ static struct mlx5_ib_mr *reg_umr(struct ib_pd *pd, struct ib_umem *umem, | |||
743 | struct mlx5_ib_mr *mr; | 743 | struct mlx5_ib_mr *mr; |
744 | struct ib_sge sg; | 744 | struct ib_sge sg; |
745 | int size = sizeof(u64) * npages; | 745 | int size = sizeof(u64) * npages; |
746 | __be64 *mr_pas; | ||
747 | dma_addr_t dma; | ||
746 | int err = 0; | 748 | int err = 0; |
747 | int i; | 749 | int i; |
748 | 750 | ||
@@ -761,25 +763,26 @@ static struct mlx5_ib_mr *reg_umr(struct ib_pd *pd, struct ib_umem *umem, | |||
761 | if (!mr) | 763 | if (!mr) |
762 | return ERR_PTR(-EAGAIN); | 764 | return ERR_PTR(-EAGAIN); |
763 | 765 | ||
764 | mr->pas = kmalloc(size + MLX5_UMR_ALIGN - 1, GFP_KERNEL); | 766 | mr_pas = kmalloc(size + MLX5_UMR_ALIGN - 1, GFP_KERNEL); |
765 | if (!mr->pas) { | 767 | if (!mr_pas) { |
766 | err = -ENOMEM; | 768 | err = -ENOMEM; |
767 | goto free_mr; | 769 | goto free_mr; |
768 | } | 770 | } |
769 | 771 | ||
770 | mlx5_ib_populate_pas(dev, umem, page_shift, | 772 | mlx5_ib_populate_pas(dev, umem, page_shift, |
771 | mr_align(mr->pas, MLX5_UMR_ALIGN), 1); | 773 | mr_align(mr_pas, MLX5_UMR_ALIGN), 1); |
772 | 774 | ||
773 | mr->dma = dma_map_single(ddev, mr_align(mr->pas, MLX5_UMR_ALIGN), size, | 775 | dma = dma_map_single(ddev, mr_align(mr_pas, MLX5_UMR_ALIGN), size, |
774 | DMA_TO_DEVICE); | 776 | DMA_TO_DEVICE); |
775 | if (dma_mapping_error(ddev, mr->dma)) { | 777 | if (dma_mapping_error(ddev, dma)) { |
776 | err = -ENOMEM; | 778 | err = -ENOMEM; |
777 | goto free_pas; | 779 | goto free_pas; |
778 | } | 780 | } |
779 | 781 | ||
780 | memset(&wr, 0, sizeof(wr)); | 782 | memset(&wr, 0, sizeof(wr)); |
781 | wr.wr_id = (u64)(unsigned long)&umr_context; | 783 | wr.wr_id = (u64)(unsigned long)&umr_context; |
782 | prep_umr_reg_wqe(pd, &wr, &sg, mr->dma, npages, mr->mmr.key, page_shift, virt_addr, len, access_flags); | 784 | prep_umr_reg_wqe(pd, &wr, &sg, dma, npages, mr->mmr.key, page_shift, |
785 | virt_addr, len, access_flags); | ||
783 | 786 | ||
784 | mlx5_ib_init_umr_context(&umr_context); | 787 | mlx5_ib_init_umr_context(&umr_context); |
785 | down(&umrc->sem); | 788 | down(&umrc->sem); |
@@ -801,10 +804,10 @@ static struct mlx5_ib_mr *reg_umr(struct ib_pd *pd, struct ib_umem *umem, | |||
801 | 804 | ||
802 | unmap_dma: | 805 | unmap_dma: |
803 | up(&umrc->sem); | 806 | up(&umrc->sem); |
804 | dma_unmap_single(ddev, mr->dma, size, DMA_TO_DEVICE); | 807 | dma_unmap_single(ddev, dma, size, DMA_TO_DEVICE); |
805 | 808 | ||
806 | free_pas: | 809 | free_pas: |
807 | kfree(mr->pas); | 810 | kfree(mr_pas); |
808 | 811 | ||
809 | free_mr: | 812 | free_mr: |
810 | if (err) { | 813 | if (err) { |