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

Re: [PATCH 3/6] can: esd_usb: Fix handling of TX context objects

From: Stefan Mätje <stefan.maetje@esd.eu>
Date: 2025-08-15 15:29:26
Also in: linux-can

Am Mittwoch, dem 13.08.2025 um 10:14 +0200 schrieb Marc Kleine-Budde:
On 11.08.2025 23:06:08, Stefan Mätje wrote:
quoted
For each TX CAN frame submitted to the USB device the driver saves the
echo skb index in struct esd_tx_urb_context context objects. If the
driver runs out of free context objects CAN transmission stops.

This patch fixes some spots where such context objects are not freed
correctly.

In esd_usb_tx_done_msg() the check for netif_device_present() is moved
after the identification and release of TX context and the release of
the echo skb. This is allowed even if netif_device_present() would
return false because the mentioned operations don't touch the device
itself but only free local acquired resources. This keeps the context
handling with the acknowledged TX jobs in sync.

In esd_usb_start_xmit() a check is performed to see whether a context
object could be allocated. Added a netif_stop_queue() there before the
function is aborted. This makes sure the network queue is stopped and
avoids getting tons of log messages in a situation without free TX
objects. The adjacent log message now also prints the active jobs
counter making a cross check between active jobs and "no free context"
condition possible.

In esd_usb_start_xmit() the error handling of usb_submit_urb() missed to
free the context object together with the echo skb and decreasing the
job count.

Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
Please add a Fixes tag.

Marc
I've looked it up. This code was already this way in the initial release.
I'll add then:

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