[ofa-general] [PATCH RFC] RDMA: New Memory Extensions.
Ralph Campbell
ralph.campbell at qlogic.com
Thu May 15 12:37:25 PDT 2008
On Thu, 2008-05-15 at 14:05 -0500, Steve Wise wrote:
> >> We're not talking about allocating the pages themselves.
> >>
> >> Here's an example (ignoring errors):
> >>
> >> page_list = ib_alloc_fast_reg_page_list(device, 1);
> >>
> >> v = get_free_page(GFP_KERNEL);
> >>
> >> page_list->page_list[0] = ib_dma_map_single(device, v, PAGE_SIZE,
> >>
> >> DMA_TO_DEVICE|DMA_FROM_DEVICE);
> >>
> >> wr.opcode = IB_WR_FAST_REG_MR;
> >> wr.next = NULL;
> >> wr.send_flags = 0;
> >> wr.wr_id = 0xdeadbeef;
> >> wr.wr.fast_reg.mr = mr;
> >> wr.wr.fast_reg.page_list = page_list;
> >> wr.wr.fast_reg.page_size = PAGE_SIZE;
> >> wr.wr.fast_reg.page_list_len = 1;
> >> wr.wr.fast_reg.first_byte_offset = 0;
> >> wr.wr.fast_reg.iova_start = (u64)v;
> >> wr.wr.fast_reg.length = PAGE_SIZE;
> >> wr.wr.fast_reg.access_flags = IB_ACCESS_LOCAL_WRITE |
> >>
> >> IB_ACCESS_REMOTE_READ |
> >>
> >> IB_ACCESS_REMOTE_WRITE;
> >>
> >> ib_post_send(qp, &wr, &bad_wr);
> >>
> >
> > OK. Thanks for clarifying. This wasn't clear to me from the
> > original description but I understand now.
> >
>
> Perhaps ib_alloc_fast_reg_page_list() isn't clear. Maybe
> ib_alloc_fast_reg_page_list_mem() is better? That's getting too long
> for my taste, but if others thing it helps... I'll change it.
At a minimum, I would change the comments for the function
in ib_verbs.h:
+/**
+ * ib_alloc_fast_reg_page_list - Allocates a page list array
+ * @device - ib device pointer.
+ * @page_list_len - size of the page list array to be allocated.
+ *
+ * This allocates and returns a struct ib_fast_reg_page_list *
+ * and a page_list array that is at least page_list_len in size.
+ * The actual size is returned in max_page_list_len.
+ * The caller is responsible for initializing the contents of the
+ * page_list array before posting a send work request with the
+ * IB_WC_FAST_REG_MR opcode. The page_list array entries must be
+ * translated using one of the ib_dma_*() functions similar to the
+ * addresses passed to ib_map_phys_fmr(). Once the ib_post_send()
+ * is issued, the struct ib_fast_reg_page_list should not be modified
+ * by the caller until a completion notice is returned by the device.
+ */
More information about the general
mailing list