From: Greg Kroah-Hartman Date: Thu, 12 May 2022 14:01:28 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v4.9.314~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ccf461f7aeadc961b8e86a4de0c2ec1efa813e31;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: can-grcan-only-use-the-napi-poll-budget-for-rx.patch --- diff --git a/queue-4.19/can-grcan-only-use-the-napi-poll-budget-for-rx.patch b/queue-4.19/can-grcan-only-use-the-napi-poll-budget-for-rx.patch new file mode 100644 index 00000000000..9db0ac8bb71 --- /dev/null +++ b/queue-4.19/can-grcan-only-use-the-napi-poll-budget-for-rx.patch @@ -0,0 +1,87 @@ +From 2873d4d52f7c52d60b316ba6c47bd7122b5a9861 Mon Sep 17 00:00:00 2001 +From: Andreas Larsson +Date: Fri, 29 Apr 2022 10:46:56 +0200 +Subject: can: grcan: only use the NAPI poll budget for RX + +From: Andreas Larsson + +commit 2873d4d52f7c52d60b316ba6c47bd7122b5a9861 upstream. + +The previous split budget between TX and RX made it return not using +the entire budget but at the same time not having calling called +napi_complete. This sometimes led to the poll to not be called, and at +the same time having TX and RX interrupts disabled resulting in the +driver getting stuck. + +Fixes: 6cec9b07fe6a ("can: grcan: Add device driver for GRCAN and GRHCAN cores") +Link: https://lore.kernel.org/all/20220429084656.29788-4-andreas@gaisler.com +Cc: stable@vger.kernel.org +Signed-off-by: Andreas Larsson +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/can/grcan.c | 22 +++++++--------------- + 1 file changed, 7 insertions(+), 15 deletions(-) + +--- a/drivers/net/can/grcan.c ++++ b/drivers/net/can/grcan.c +@@ -1141,7 +1141,7 @@ static int grcan_close(struct net_device + return 0; + } + +-static int grcan_transmit_catch_up(struct net_device *dev, int budget) ++static void grcan_transmit_catch_up(struct net_device *dev) + { + struct grcan_priv *priv = netdev_priv(dev); + unsigned long flags; +@@ -1149,7 +1149,7 @@ static int grcan_transmit_catch_up(struc + + spin_lock_irqsave(&priv->lock, flags); + +- work_done = catch_up_echo_skb(dev, budget, true); ++ work_done = catch_up_echo_skb(dev, -1, true); + if (work_done) { + if (!priv->resetting && !priv->closing && + !(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) +@@ -1163,8 +1163,6 @@ static int grcan_transmit_catch_up(struc + } + + spin_unlock_irqrestore(&priv->lock, flags); +- +- return work_done; + } + + static int grcan_receive(struct net_device *dev, int budget) +@@ -1246,19 +1244,13 @@ static int grcan_poll(struct napi_struct + struct net_device *dev = priv->dev; + struct grcan_registers __iomem *regs = priv->regs; + unsigned long flags; +- int tx_work_done, rx_work_done; +- int rx_budget = budget / 2; +- int tx_budget = budget - rx_budget; ++ int work_done; + +- /* Half of the budget for receiveing messages */ +- rx_work_done = grcan_receive(dev, rx_budget); ++ work_done = grcan_receive(dev, budget); + +- /* Half of the budget for transmitting messages as that can trigger echo +- * frames being received +- */ +- tx_work_done = grcan_transmit_catch_up(dev, tx_budget); ++ grcan_transmit_catch_up(dev); + +- if (rx_work_done < rx_budget && tx_work_done < tx_budget) { ++ if (work_done < budget) { + napi_complete(napi); + + /* Guarantee no interference with a running reset that otherwise +@@ -1275,7 +1267,7 @@ static int grcan_poll(struct napi_struct + spin_unlock_irqrestore(&priv->lock, flags); + } + +- return rx_work_done + tx_work_done; ++ return work_done; + } + + /* Work tx bug by waiting while for the risky situation to clear. If that fails, diff --git a/queue-4.19/series b/queue-4.19/series index 8d2b03af7f7..cc120ae585c 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -3,3 +3,4 @@ block-drbd-drbd_nl-make-conversion-to-enum-drbd_ret_code-explicit.patch drm-amd-display-dc-gpio-gpio_service-pass-around-correct-dce_-version-environment-types.patch nfp-bpf-silence-bitwise-vs.-logical-or-warning.patch can-grcan-grcan_probe-fix-broken-system-id-check-for-errata-workaround-needs.patch +can-grcan-only-use-the-napi-poll-budget-for-rx.patch