On Wed, 22 Nov 2006 11:45:52 +0100, Paolo Abeni <[EMAIL PROTECTED]> wrote:

BTW, I'm putting the cc: back. See, Marcel already replied. We ought
to keep people in the loop. Although generally others are interested
in patches only, it's good to have a record of the design process.

> One possible solution is to add another ioctl operation to remove a
> specified number of records (header+data) from the buffer. User use this
> ioctl after processing at least one urb.

Right, this is what I was going to do. It's part of what I call
"mfetch". The mfetch takes this struct:

struct mfetch_info {
        unsigned int *offvec;   /* Vector of events fetched */
        int nfetch;             /* Number of events to fetch (out: fetched) */
        int nflush;             /* Number of events to flush */
}

The ioctl works likes this:
 - Drop up to nflush events
 - Wait if !O_NONBLOCK and buffer is empty
 - Extract up to nfetch offsets, stores them in offvec, returns how
   many were fetched in nfetch.

The idea here is that polling without any syscalls is a no-goal,
considering systemic overhead elsewhere. By getting a bunch of
mmap offsets, applications use a "fraction of syscall per event"
model and do not need to think about wrapped buffers (they see
the filler packets, but it's a very small overhead).

I'm thinking if I should add a "force O_NONBLOCK" flag somehow,
in case someone wants to flush all events. If you find an application
which can make an intelligent use of it, please let me know.

I am going to write some test code and validate if this works.

>               /*
>                * remove args events or fillers from buffer. If args is 
> greater 
>                * than the number of events present in buffer, fail 
>                * with error and no modification is applied to the buffer; 
>                */
>                       if (rp->cnt == 0) {
>                               rp->b_cnt = cnt;
>                               rp->b_out = out;
>                               ret = -EINVAL;
>                               break;

Why is that? I thought that it may be useful to start with INT_MAX
events to flush.

> BTW I tried to implement the MON_IOCT_RING_SIZE ioctl operation:

Yeah, I'll take that too, modulo sizes always being unsigned here
unless they are ssize_t (we have one case).

-- Pete

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to