Debashis Dutt wrote:
> Hi,
>
> I am writing a 10G Link Layer driver for a network adapter capable of
> receiving
> Jumbo frames. Unfortunately this device has a limitation that there is
> a 1 to 1 mapping
> of the received packets to the host Rx buffers, so that only a single
> buffer can be
> used for 1 packet and multiple packets cannot fit into a single buffer.
>
> So I need to be able to allocate physically contiguous buffers of 9K
> or more on x86
> platforms.
>
> My question is :
>
> 1) Does allocb() guarantee a physically contiguous data block of the
> size that I
> request ? My understanding is, currently it does not.
Your understanding is *correct*.
> When the memory returned by allocb() is DMA mapped using
> ddi_dma_addr_bind_handle()
> this returns the number of cookies to indicate the number of
> actual physical chunks
> that the memory is broken up into.
Correct.
>
> 2) Other alternative is to use ddi_dma_mem_alloc() and link it to the
> message block by
> using esballoc() / desballoc(). Even with that, is it guaranteed
> that the number
> of dma_cookies is always 1 ?
If your DMA attributes do not allow for multiple cookies/windows, then
yes, it will be contiguous.
> However I do not want to go this route because in that case I need
> to provide a free
> function to free up the buffers when the upper layers are done.
>
> Can anybody suggest a better way of doing this ?
Not really. esballoc/desballoc is what you have to do here, if you want
contiguous memory.
You could copy through to a scratch buffer, but that would incur
substantial cost.
-- Garrett
>
> Thanks
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> networking-discuss mailing list
> [email protected]
_______________________________________________
networking-discuss mailing list
[email protected]