From: Eli Cohen <eli-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Or Gerlitz <or.gerlitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Roland Dreier <rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>,
RDMA list <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] mlx4: Limit num of fast reg WRs
Date: Tue, 12 Oct 2010 10:19:55 +0200 [thread overview]
Message-ID: <20101012081955.GB1617@mtldesk30> (raw)
In-Reply-To: <AANLkTinKiBHOT2sSA+_s5CGhqC8nEoDTp2_pGmo6MrQp-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Tue, Oct 12, 2010 at 12:13:26AM +0200, Or Gerlitz wrote:
> Guys, can you clarify if the hardware limitation is 511 entries or its
> (PAGE_SIZE / sizeof(pointer)) - 1 which is 4096 / 8 - 1 = 511 but can
> change if the page size gets bigger or smaller?
>
The limit is 511 entries.
After I posted this patch, I was told that there is yet another
constraint on the page list: The buffer containing the list must not
cross a page boundary. So I was thinking what is the best way to deal
with this. One way is to always allocate a whole page and map it using
dma_map_page(page, DMA_TO_DEVICE), something like this (not a complete
patch, just the idea).
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c
index 83e3cc7..e9b2c8a 100644
--- a/drivers/infiniband/hw/mlx4/mr.c
+++ b/drivers/infiniband/hw/mlx4/mr.c
@@ -237,18 +237,23 @@ struct ib_fast_reg_page_list *mlx4_ib_alloc_fast_reg_page_list(struct ib_device
if (!mfrpl->ibfrpl.page_list)
goto err_free;
- mfrpl->mapped_page_list = dma_alloc_coherent(&dev->dev->pdev->dev,
- size, &mfrpl->map,
- GFP_KERNEL);
+ mfrpl->mapped_page_list = (__be64 *)__get_free_page(GFP_KERNEL);
if (!mfrpl->mapped_page_list)
goto err_free;
- WARN_ON(mfrpl->map & 0x3f);
+ mfrpl->map = dma_map_single(ibdev->dma_device, mfrpl->mapped_page_list,
+ PAGE_SIZE, DMA_TO_DEVICE);
+ if (dma_mapping_error(ibdev->dma_device, mfrpl->map))
+ goto err_page;
+
+
return &mfrpl->ibfrpl;
+err_page:
+ free_page((unsigned long) mfrpl->mapped_page_list);
+
err_free:
- kfree(mfrpl->ibfrpl.page_list);
kfree(mfrpl);
return ERR_PTR(-ENOMEM);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-10-12 8:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 14:24 [PATCH] mlx4: Limit num of fast reg WRs Eli Cohen
2010-10-11 21:37 ` Roland Dreier
2010-10-11 22:13 ` Or Gerlitz
[not found] ` <AANLkTinKiBHOT2sSA+_s5CGhqC8nEoDTp2_pGmo6MrQp-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-12 8:19 ` Eli Cohen [this message]
2010-10-12 20:37 ` Roland Dreier
[not found] ` <adad3rf171q.fsf-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2010-10-12 20:44 ` Eli Cohen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101012081955.GB1617@mtldesk30 \
--to=eli-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=or.gerlitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox