Thread (26 messages) 26 messages, 5 authors, 2025-08-19

Re: [PATCH 4/6] can: esd_usb: Add watermark handling for TX jobs

From: Stefan Mätje <stefan.maetje@esd.eu>
Date: 2025-08-18 09:55:03
Also in: linux-can

Am Mittwoch, dem 13.08.2025 um 10:13 +0200 schrieb Marc Kleine-Budde:
On 11.08.2025 23:06:09, Stefan Mätje wrote:
quoted
The driver tried to keep as much CAN frames as possible submitted to the
USB device (ESD_USB_MAX_TX_URBS). This has led to occasional "No free
context" error messages in high load situations like with
"cangen -g 0 -p 10 canX".

This patch now calls netif_stop_queue() already if the number of active
jobs reaches ESD_USB_TX_URBS_HI_WM which is < ESD_USB_MAX_TX_URBS.
The netif_start_queue() is called in esd_usb_tx_done_msg() only if
the number of active jobs is <= ESD_USB_TX_URBS_LO_WM.

This change eliminates the occasional error messages and significantly
reduces the number of calls to netif_start_queue() and
netif_stop_queue().

The watermark limits have been chosen with the CAN-USB/Micro in mind to
not to compromise its TX throughput. This device is running on USB 1.1
only with its 1ms USB polling cycle where a ESD_USB_TX_URBS_LO_WM
value below 9 decreases the TX throughput.

Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
Please add a Fixes tag.
I did not add a fixes tag because I had the impression that the code was working
fine with older kernels and the occasional messages began showing up only with
newer kernels after ~ 6.11. So I was not able to pinpoint the error to the patch 
that exposed the problem. 

But I retested the stuff now with older kernels. Somewhere between 5.4 and the 5.15
the problem starts. But on older kernels it can only be exposed transmitting zero
byte frames with "cangen -I i -g 0 -p 10 -L 0 canX" and additionally load the system
with other heavy tasks.

The code was unchanged since the initial implementation. I will then add a fixes 
tag that denotes the initial implementation. That would be:

Fixes: 96d8e90382dc ("can: Add driver for esd CAN-USB/2 device")
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help