FAILED: patch "[PATCH] can: kvaser_usb_leaf: Fix TX queue out of sync after restart" failed to apply to 4.9-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Possible dependencies:
455561fb618f ("can: kvaser_usb_leaf: Fix TX queue out of sync after restart") 7259124eac7d ("can: kvaser_usb: Split driver into kvaser_usb_core.c and kvaser_usb_leaf.c") e0543f2479f8 ("can: kvaser_usb: Add SPDX GPL-2.0 license identifier") 2b049c150080 ("can: kvaser_usb: Fix typos")6ba0b9294bca ("can: kvaser_usb: Improve logging messages")7c4780146177 ("can: kvaser_usb: Refactor kvaser_usb_init_one()")99ce1bc17462 ("can: kvaser_usb: Refactor kvaser_usb_get_endpoints()") 0e30619fd6fa ("can: kvaser_usb: Add pointer to struct usb_interface into struct kvaser_usb") 75d2b4c3e399 ("can: kvaser_usb: Replace USB timeout constants with one define") f741f938556d ("can: kvaser_usb: Rename message/msg to command/cmd") 237572220121 ("can: kvaser_usb: Remove unused commands and defines") deaa1c984be7 ("can: kvaser_usb: Remove unnecessary return")ffbdd9172ee2 ("can: usb: Kconfig/Makefile: sort alphabetically")6ee00865ffe4 ("can: kvaser_usb: Increase correct stats counter in kvaser_usb_rx_can_msg()") 6aa8d5945502 ("can: kvaser_usb: cancel urb on -EPIPE and -EPROTO") 8bd13bd522ff ("can: kvaser_usb: ratelimit errors if incomplete messages are received") e84f44eb5523 ("can: kvaser_usb: Fix comparison bug in kvaser_usb_read_bulk_callback()") 435019b48033 ("can: kvaser_usb: free buf in error paths")e1d2d1329a57 ("can: kvaser_usb: Ignore CMD_FLUSH_QUEUE_REPLY messages") 8f65a923e6b6 ("can: kvaser_usb: Correct return value in printout")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 455561fb618fde40558776b5b8435f9420f335db Mon Sep 17 00:00:00 2001
From: Anssi Hannula <[email protected]>
Date: Mon, 10 Oct 2022 17:08:28 +0200
Subject: [PATCH] can: kvaser_usb_leaf: Fix TX queue out of sync after restart
The TX queue seems to be implicitly flushed by the hardware during bus-off or bus-off recovery, but the driver does not reset the TX bookkeeping.
Despite not resetting TX bookkeeping the driver still re-enables TX queue unconditionally, leading to "cannot find free context" / NETDEV_TX_BUSY errors if the TX queue was full at bus-off time.
Fix that by resetting TX bookkeeping on CAN restart.
Tested with 0bfd:0124 Kvaser Mini PCI Express 2xHS FW 4.18.778.
drivers/net/can/usb/kvaser_usb/kvaser_usb.h +2 -0
@@ -178,6 +178,8 @@ struct kvaser_usb_dev_cfg {extern const struct kvaser_usb_dev_ops kvaser_usb_hydra_dev_ops;extern const struct kvaser_usb_dev_ops kvaser_usb_leaf_dev_ops; +void kvaser_usb_unlink_tx_urbs (struct kvaser_usb_net_priv *priv); +int kvaser_usb_recv_cmd (const struct kvaser_usb *dev,void *cmd,int len,int *actual_len);
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +1 -1
@@ -477,7 +477,7 @@ static void kvaser_usb_reset_tx_urb_contexts(struct kvaser_usb_net_priv *priv)/* This method might sleep. Do not call it in the atomic context * of URB completions. */ -static void kvaser_usb_unlink_tx_urbs (struct kvaser_usb_net_priv *priv) +void kvaser_usb_unlink_tx_urbs (struct kvaser_usb_net_priv *priv) {usb_kill_anchored_urbs (&priv->tx_submitted);kvaser_usb_reset_tx_urb_contexts (priv);
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +2 -0
@@ -1426,6 +1426,8 @@ static int kvaser_usb_leaf_set_mode(struct net_device *netdev,switch (mode) {case CAN_MODE_START : +kvaser_usb_unlink_tx_urbs (priv); + err =kvaser_usb_leaf_simple_cmd_async (priv,CMD_START_CHIP );if (err)return err;