Re: future developments of usbnet

2 messages, 2 authors, 2011-05-14 · open the first message on its own page

Re: future developments of usbnet

From: Alan Stern <hidden>
Date: 2011-05-12 14:37:28

On Thu, 12 May 2011, Oliver Neukum wrote:
Am Mittwoch, 11. Mai 2011, 19:47:27 schrieb David Miller:
quoted
Basically once you take you interrupt, and disable device interrupts,
the generic net device layer calls your ->poll() routing with a "weight"
You should not process more RX packets than this value.

If you have less than "weight" work to do, you should do a napi_complete(),
which takes you out of the polling group, and re-enable device interrupts.

So the idea is that you keep getting ->poll()'d until there is no more
RX work to do.

The "weight" argument implements fairness amongst competing, actively
polling, devices on the same CPU.
Thank you, this is very informative. Our problem here is that USB doesn't work
sanely without interrupts. We can stop IO regarding rx, but we cannot stop
interrupts if we want to do rx.
The idea behind NAPI can be adapted to the usbnet context.  The basic
idea is that the driver is allowed to accept only a limited number of 
packets, driven by polling from the NAPI core.

Therefore usbnet's poll routine should take the "weight" argument as an
indication of how many outstanding rx URBs are allowed.  Each time the
poll routine is called, it should check to see if any rx URBs have
completed since the previous poll.  If not then there is no network
traffic, so usbnet can take itself out of the poll loop.  Otherwise,
the number of outstanding URBs should be adjusted (by unlinking some or
submitting more -- subject to some fixed maximum limit) to match the
new "weight".

Does that make sense?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: future developments of usbnet

From: Oliver Neukum <oliver@neukum.org>
Date: 2011-05-14 09:59:51

Am Donnerstag, 12. Mai 2011, 16:37:28 schrieb Alan Stern:
Therefore usbnet's poll routine should take the "weight" argument as an
indication of how many outstanding rx URBs are allowed.  Each time the
poll routine is called, it should check to see if any rx URBs have
completed since the previous poll.  If not then there is no network
traffic, so usbnet can take itself out of the poll loop.  Otherwise,
the number of outstanding URBs should be adjusted (by unlinking some or
submitting more -- subject to some fixed maximum limit) to match the
new "weight".

Does that make sense?
What does happen if we reach the weight 0 ?

	Regards
		Oliver
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help