Ethernet over USB – implementing “Leaky bucket” algorithm.
I am currently involved in developing a product which use a USB communication device as its WAN port.
The product is a CPE, intended to forward TCP/UDP traffic from the USB port towards Ethernet port which is the LAN side.
For stability reasons we want to be able to control the rate of incoming packets from USB side, regardless of size, merely PPS criteria. The easiest way to do so is using a “leaky bucket” budget based algorithm.
Naturally we want to drop a packet as soon as possible, which means in the USB hierarchy, as close as possible to HW.
The problem is that I can’t drop an URB without causing an error which shuts the qh.
Is there a place I can remove incoming data if token budget is zero?
A few details:
1. We are using ARM 11.
2. Kernel 2.6.39. (part of the Openwrt backfire we use)
3. USB 2.0 high speed.
Thanks a lot