Skip to content

Commit 51f9478

Browse files
gregkhmarckleinebudde
authored andcommitted
can: usb: f81604: handle bulk write errors properly
If a write urb fails then more needs to be done other than just logging the message, otherwise the transmission could be stalled. Properly increment the error counters and wake up the queues so that data will continue to flow. Cc: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw> Cc: Marc Kleine-Budde <mkl@pengutronix.de> Cc: Vincent Mailhol <mailhol@kernel.org> Cc: stable@kernel.org Assisted-by: gkh_clanker_2000 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/2026022334-slackness-dynamic-9195@gregkh Fixes: 88da174 ("can: usb: f81604: add Fintek F81604 support") Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 7299b1b commit 51f9478

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

drivers/net/can/usb/f81604.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,9 +880,27 @@ static void f81604_write_bulk_callback(struct urb *urb)
880880
if (!netif_device_present(netdev))
881881
return;
882882

883-
if (urb->status)
884-
netdev_info(netdev, "%s: Tx URB error: %pe\n", __func__,
885-
ERR_PTR(urb->status));
883+
if (!urb->status)
884+
return;
885+
886+
switch (urb->status) {
887+
case -ENOENT:
888+
case -ECONNRESET:
889+
case -ESHUTDOWN:
890+
return;
891+
default:
892+
break;
893+
}
894+
895+
if (net_ratelimit())
896+
netdev_err(netdev, "%s: Tx URB error: %pe\n", __func__,
897+
ERR_PTR(urb->status));
898+
899+
can_free_echo_skb(netdev, 0, NULL);
900+
netdev->stats.tx_dropped++;
901+
netdev->stats.tx_errors++;
902+
903+
netif_wake_queue(netdev);
886904
}
887905

888906
static void f81604_clear_reg_work(struct work_struct *work)

0 commit comments

Comments
 (0)