lkml.org 
[lkml]   [2010]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] enhanced reimplemented of the kfifo API
    From
    Date
    Am Freitag, den 15.01.2010, 14:01 -0800 schrieb Ira W. Snyder:
    > On Fri, Jan 15, 2010 at 10:30:01PM +0100, Stefani Seibold wrote:
    > >
    > > > I'm glad to see this example, it really illustrates how to use the new
    > > > DMA functionality of the kfifo API.
    > > >
    > > > Is there any reason why a very large scatterlist could not be used? I
    > > > have a driver that uses a large scatterlist (~4000 entries, allocated as
    > > > a struct sg_table). I implemented my own copy_from_user() functionality
    > > > into this scatterlist, but I'd love to use the kfifo DMA API instead.
    > > > After filling the scatterlist, I use the usual DMA API's to transfer it
    > > > to my device.
    > > >
    > >
    > > No, but the API will only return max. two entries.
    > >
    >
    > Ah, I see. __kfifo_alloc() uses kmalloc() internally. The kfifo API will
    > not work for my purposes then, since I want to allocate a 16MB chunk of
    > memory, and I'm very uncomfortable doing that with kmalloc(). I'll stick
    > with my custom scatterlist code, which uses alloc_page() to fill in the
    > scatterlist with order-0 allocations.
    >

    I think you can use vmalloc() instead and assign this buffer with
    kfifo_init().

    > Another nitpick in the code: I've noticed that you use sgl++ in the
    > setup_sgl() function. That should become "sgl = sg_next(sgl);" so that
    > this code can work with an struct sg_table as well.

    No, its by definition an array. You cannot pass as struct sg_table to
    the kfifo_dma_* functions.

    Stefani




    \
     
     \ /
      Last update: 2010-01-15 23:07    [W:0.025 / U:0.952 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site