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

Commit eda6d1d1 authored by Steve Wise's avatar Steve Wise Committed by Roland Dreier
Browse files

RDMA/cxgb4: Save the correct map length for fast_reg_page_lists



We cannot save the mapped length using the rdma max_page_list_len field
of the ib_fast_reg_page_list struct because the core code uses it.  This
results in an incorrect unmap of the page list in c4iw_free_fastreg_pbl().

I found this with dma mapping debugging enabled in the kernel.  The
fix is to save the length in the c4iw_fr_page_list struct.

Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent df2d5130
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -369,6 +369,7 @@ struct c4iw_fr_page_list {
	DEFINE_DMA_UNMAP_ADDR(mapping);
	dma_addr_t dma_addr;
	struct c4iw_dev *dev;
	int pll_len;
};

static inline struct c4iw_fr_page_list *to_c4iw_fr_page_list(
+10 −2
Original line number Diff line number Diff line
@@ -903,7 +903,11 @@ struct ib_fast_reg_page_list *c4iw_alloc_fastreg_pbl(struct ib_device *device,
	dma_unmap_addr_set(c4pl, mapping, dma_addr);
	c4pl->dma_addr = dma_addr;
	c4pl->dev = dev;
	c4pl->ibpl.max_page_list_len = pll_len;
	c4pl->pll_len = pll_len;

	PDBG("%s c4pl %p pll_len %u page_list %p dma_addr %pad\n",
	     __func__, c4pl, c4pl->pll_len, c4pl->ibpl.page_list,
	     &c4pl->dma_addr);

	return &c4pl->ibpl;
}
@@ -912,8 +916,12 @@ void c4iw_free_fastreg_pbl(struct ib_fast_reg_page_list *ibpl)
{
	struct c4iw_fr_page_list *c4pl = to_c4iw_fr_page_list(ibpl);

	PDBG("%s c4pl %p pll_len %u page_list %p dma_addr %pad\n",
	     __func__, c4pl, c4pl->pll_len, c4pl->ibpl.page_list,
	     &c4pl->dma_addr);

	dma_free_coherent(&c4pl->dev->rdev.lldi.pdev->dev,
			  c4pl->ibpl.max_page_list_len,
			  c4pl->pll_len,
			  c4pl->ibpl.page_list, dma_unmap_addr(c4pl, mapping));
	kfree(c4pl);
}