RE: [PATCH net] r8152: avoid the driver drops a lot of packets

From: Hayes Wang
Date: Tue Sep 05 2023 - 12:52:10 EST


Paolo Abeni <pabeni@xxxxxxxxxx>
> Sent: Tuesday, September 5, 2023 7:21 PM
[...]
> I'm sorry, I have a very superficial knowledge of the USB layer, but it
> looks like that when such condition is reached, in the worst condition
> there could be up to urbs in flight. AFAICS each of them carries a 16K
> buffer, can be up to 10 standard-mtu packets - or much more small ones.
>
> Setting an upper limits to the rx_queue still looks like a reasonable
> safeguard.

I think it is very hard to queue more than 1000 packets. The NAPI continues
consuming the queued packets. And, the hardware wouldn't complete all
urbs at one time. However, I would add WARN_ON_ONCE() to observe if
any exception would occur.

> > Besides, if the flow control is disabled, the packets may be dropped by
> > the hardware when the FIFO of the device is full, after the driver stops
> > submitting rx.
>
> If the incoming rate exceeds the H/W processing capacity, packets are
> dropped: that is expected and unavoidable.
>
> Possibly exposing the root cause for such drops to user space via
> appropriate stats would be useful.

The number of packet which the device drops could be got through
ethtool.

Best Regards,
Hayes