[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160617095834.GA5408@leon.nu>
Date: Fri, 17 Jun 2016 12:58:34 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Lijun Ou <oulijun@...wei.com>
Cc: dledford@...hat.com, sean.hefty@...el.com,
hal.rosenstock@...il.com, davem@...emloft.net,
jeffrey.t.kirsher@...el.com, jiri@...lanox.com,
ogerlitz@...lanox.com, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
gongyangming@...wei.com, xiaokun@...wei.com,
tangchaofei@...wei.com, haifeng.wei@...wei.com,
yisen.zhuang@...wei.com, yankejian@...wei.com,
charles.chenxin@...wei.com, linuxarm@...wei.com
Subject: Re: [PATCH v10 08/22] IB/hns: Add icm support
On Thu, Jun 16, 2016 at 10:35:16PM +0800, Lijun Ou wrote:
> This patch mainly added icm support for RoCE. It initializes icm
> which managers the relative memory blocks for RoCE. The data
> structures of RoCE will be located in it. For example, CQ table,
> QP table and MTPT table so on.
>
> Signed-off-by: Wei Hu <xavier.huwei@...wei.com>
> Signed-off-by: Nenglong Zhao <zhaonenglong@...ilicon.com>
> Signed-off-by: Lijun Ou <oulijun@...wei.com>
> ---
<...>
> +
> +static int hns_roce_alloc_icm_pages(struct scatterlist *mem, int order,
> + gfp_t gfp_mask)
> +{
> + struct page *page;
> +
> + page = alloc_pages(gfp_mask, order);
> + if (!page)
> + return -ENOMEM;
> +
> + sg_set_page(mem, page, PAGE_SIZE << order, 0);
> +
> + return 0;
> +}
> +
> +static int hns_roce_alloc_icm_coherent(struct device *dev,
> + struct scatterlist *mem, int order,
> + gfp_t gfp_mask)
> +{
> + void *buf = dma_alloc_coherent(dev, PAGE_SIZE << order,
> + &sg_dma_address(mem), gfp_mask);
> + if (!buf)
> + return -ENOMEM;
> +
> + sg_set_buf(mem, buf, PAGE_SIZE << order);
> + WARN_ON(mem->offset);
> + sg_dma_len(mem) = PAGE_SIZE << order;
> + return 0;
> +}
> +
<...>
> +
> +static void hns_roce_free_icm_pages(struct hns_roce_dev *hr_dev,
> + struct hns_roce_icm_chunk *chunk)
> +{
> + int i;
> +
> + if (chunk->nsg > 0)
> + dma_unmap_sg(&hr_dev->pdev->dev, chunk->mem, chunk->npages,
> + DMA_BIDIRECTIONAL);
> +
> + for (i = 0; i < chunk->npages; ++i)
> + __free_pages(sg_page(&chunk->mem[i]),
> + get_order(chunk->mem[i].length));
You used alloc_pages for this allocation, so why are you using
__free_pages instead of free_pages?
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists