* [PATCH net 0/8] pull-request: can 2024-11-04
@ 2024-11-04 19:53 Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 1/8] can: j1939: fix error in J1939 documentation Marc Kleine-Budde
` (7 more replies)
0 siblings, 8 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2024-11-04 19:53 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, linux-can, kernel
Hello netdev-team,
this is a pull request of 8 patches for net/master.
Alexander Hölzl contributes a patch to fix an error in the CAN j1939
documentation.
Thomas Mühlbacher's patch allows building of the {cc770,sja1000}_isa
drivers on x86_64 again.
A patch by me targets the m_can driver and limits the call to
free_irq() to devices with IRQs.
Dario Binacchi's patch fixes the RX and TX error counters in the c_can
driver.
The next 2 patches target the rockchip_canfd driver. Geert
Uytterhoeven's patch lets the driver depend on ARCH_ROCKCHIP. Jean
Delvare's patch drops the obsolete dependency on COMPILE_TEST.
The last 2 patches are by me and fix 2 regressions in the mcp251xfd
driver: fix broken coalescing configuration when switching CAN modes
and fix the length calculation of the Transmit Event FIFO (TEF) on
full TEF.
regards,
Marc
---
The following changes since commit 5ccdcdf186aec6b9111845fd37e1757e9b413e2f:
net: xilinx: axienet: Enqueue Tx packets in dql before dmaengine starts (2024-11-03 14:35:11 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-6.12-20241104
for you to fetch changes up to 3c1c18551e6ac1b988d0a05c5650e3f6c95a1b8a:
can: mcp251xfd: mcp251xfd_get_tef_len(): fix length calculation (2024-11-04 18:01:07 +0100)
----------------------------------------------------------------
linux-can-fixes-for-6.12-20241104
----------------------------------------------------------------
Alexander Hölzl (1):
can: j1939: fix error in J1939 documentation.
Dario Binacchi (1):
can: c_can: fix {rx,tx}_errors statistics
Geert Uytterhoeven (1):
can: rockchip_canfd: CAN_ROCKCHIP_CANFD should depend on ARCH_ROCKCHIP
Jean Delvare (1):
can: rockchip_canfd: Drop obsolete dependency on COMPILE_TEST
Marc Kleine-Budde (3):
can: m_can: m_can_close(): don't call free_irq() for IRQ-less devices
can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes
can: mcp251xfd: mcp251xfd_get_tef_len(): fix length calculation
Thomas Mühlbacher (1):
can: {cc770,sja1000}_isa: allow building on x86_64
Documentation/networking/j1939.rst | 2 +-
drivers/net/can/c_can/c_can_main.c | 7 ++++++-
drivers/net/can/cc770/Kconfig | 2 +-
drivers/net/can/m_can/m_can.c | 3 ++-
drivers/net/can/rockchip/Kconfig | 3 ++-
drivers/net/can/sja1000/Kconfig | 2 +-
drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c | 8 +++++---
drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c | 10 +++++++---
8 files changed, 25 insertions(+), 12 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net 1/8] can: j1939: fix error in J1939 documentation.
2024-11-04 19:53 [PATCH net 0/8] pull-request: can 2024-11-04 Marc Kleine-Budde
@ 2024-11-04 19:53 ` Marc Kleine-Budde
2024-11-05 2:10 ` patchwork-bot+netdevbpf
2024-11-04 19:53 ` [PATCH net 2/8] can: {cc770,sja1000}_isa: allow building on x86_64 Marc Kleine-Budde
` (6 subsequent siblings)
7 siblings, 1 reply; 12+ messages in thread
From: Marc Kleine-Budde @ 2024-11-04 19:53 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, linux-can, kernel, Alexander Hölzl,
Oleksij Rempel, Vincent Mailhol, Marc Kleine-Budde
From: Alexander Hölzl <alexander.hoelzl@gmx.net>
The description of PDU1 format usage mistakenly referred to PDU2 format.
Signed-off-by: Alexander Hölzl <alexander.hoelzl@gmx.net>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://patch.msgid.link/20241023145257.82709-1-alexander.hoelzl@gmx.net
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Documentation/networking/j1939.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst
index e4bd7aa1f5aa..544bad175aae 100644
--- a/Documentation/networking/j1939.rst
+++ b/Documentation/networking/j1939.rst
@@ -121,7 +121,7 @@ format, the Group Extension is set in the PS-field.
On the other hand, when using PDU1 format, the PS-field contains a so-called
Destination Address, which is _not_ part of the PGN. When communicating a PGN
-from user space to kernel (or vice versa) and PDU2 format is used, the PS-field
+from user space to kernel (or vice versa) and PDU1 format is used, the PS-field
of the PGN shall be set to zero. The Destination Address shall be set
elsewhere.
base-commit: 5ccdcdf186aec6b9111845fd37e1757e9b413e2f
--
2.45.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 2/8] can: {cc770,sja1000}_isa: allow building on x86_64
2024-11-04 19:53 [PATCH net 0/8] pull-request: can 2024-11-04 Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 1/8] can: j1939: fix error in J1939 documentation Marc Kleine-Budde
@ 2024-11-04 19:53 ` Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 3/8] can: m_can: m_can_close(): don't call free_irq() for IRQ-less devices Marc Kleine-Budde
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2024-11-04 19:53 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, linux-can, kernel, Thomas Mühlbacher, stable,
Marc Kleine-Budde
From: Thomas Mühlbacher <tmuehlbacher@posteo.net>
The ISA variable is only defined if X86_32 is also defined. However,
these drivers are still useful and in use on at least some modern 64-bit
x86 industrial systems as well. With the correct module parameters, they
work as long as IO port communication is possible, despite their name
having ISA in them.
Fixes: a29689e60ed3 ("net: handle HAS_IOPORT dependencies")
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
Link: https://patch.msgid.link/20240919174151.15473-2-tmuehlbacher@posteo.net
Cc: stable@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/cc770/Kconfig | 2 +-
drivers/net/can/sja1000/Kconfig | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/cc770/Kconfig b/drivers/net/can/cc770/Kconfig
index 467ef19de1c1..aae25c2f849e 100644
--- a/drivers/net/can/cc770/Kconfig
+++ b/drivers/net/can/cc770/Kconfig
@@ -7,7 +7,7 @@ if CAN_CC770
config CAN_CC770_ISA
tristate "ISA Bus based legacy CC770 driver"
- depends on ISA
+ depends on HAS_IOPORT
help
This driver adds legacy support for CC770 and AN82527 chips
connected to the ISA bus using I/O port, memory mapped or
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig
index 01168db4c106..2f516cc6d22c 100644
--- a/drivers/net/can/sja1000/Kconfig
+++ b/drivers/net/can/sja1000/Kconfig
@@ -87,7 +87,7 @@ config CAN_PLX_PCI
config CAN_SJA1000_ISA
tristate "ISA Bus based legacy SJA1000 driver"
- depends on ISA
+ depends on HAS_IOPORT
help
This driver adds legacy support for SJA1000 chips connected to
the ISA bus using I/O port, memory mapped or indirect access.
--
2.45.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 3/8] can: m_can: m_can_close(): don't call free_irq() for IRQ-less devices
2024-11-04 19:53 [PATCH net 0/8] pull-request: can 2024-11-04 Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 1/8] can: j1939: fix error in J1939 documentation Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 2/8] can: {cc770,sja1000}_isa: allow building on x86_64 Marc Kleine-Budde
@ 2024-11-04 19:53 ` Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 4/8] can: c_can: fix {rx,tx}_errors statistics Marc Kleine-Budde
` (4 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2024-11-04 19:53 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde, Simon Horman,
Markus Schneider-Pargmann, stable
In commit b382380c0d2d ("can: m_can: Add hrtimer to generate software
interrupt") support for IRQ-less devices was added. Instead of an
interrupt, the interrupt routine is called by a hrtimer-based polling
loop.
That patch forgot to change free_irq() to be only called for devices
with IRQs. Fix this, by calling free_irq() conditionally only if an
IRQ is available for the device (and thus has been requested
previously).
Fixes: b382380c0d2d ("can: m_can: Add hrtimer to generate software interrupt")
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
Link: https://patch.msgid.link/20240930-m_can-cleanups-v1-1-001c579cdee4@pengutronix.de
Cc: <stable@vger.kernel.org> # v6.6+
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/m_can/m_can.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index a978b960f1f1..16e9e7d7527d 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1765,7 +1765,8 @@ static int m_can_close(struct net_device *dev)
netif_stop_queue(dev);
m_can_stop(dev);
- free_irq(dev->irq, dev);
+ if (dev->irq)
+ free_irq(dev->irq, dev);
m_can_clean(dev);
--
2.45.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 4/8] can: c_can: fix {rx,tx}_errors statistics
2024-11-04 19:53 [PATCH net 0/8] pull-request: can 2024-11-04 Marc Kleine-Budde
` (2 preceding siblings ...)
2024-11-04 19:53 ` [PATCH net 3/8] can: m_can: m_can_close(): don't call free_irq() for IRQ-less devices Marc Kleine-Budde
@ 2024-11-04 19:53 ` Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 5/8] can: rockchip_canfd: CAN_ROCKCHIP_CANFD should depend on ARCH_ROCKCHIP Marc Kleine-Budde
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2024-11-04 19:53 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, linux-can, kernel, Dario Binacchi, Marc Kleine-Budde
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
The c_can_handle_bus_err() function was incorrectly incrementing only the
receive error counter, even in cases of bit or acknowledgment errors that
occur during transmission. The patch fixes the issue by incrementing the
appropriate counter based on the type of error.
Fixes: 881ff67ad450 ("can: c_can: Added support for Bosch C_CAN controller")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://patch.msgid.link/20241014135319.2009782-1-dario.binacchi@amarulasolutions.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/c_can/c_can_main.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/c_can/c_can_main.c b/drivers/net/can/c_can/c_can_main.c
index c63f7fc1e691..511615dc3341 100644
--- a/drivers/net/can/c_can/c_can_main.c
+++ b/drivers/net/can/c_can/c_can_main.c
@@ -1011,7 +1011,6 @@ static int c_can_handle_bus_err(struct net_device *dev,
/* common for all type of bus errors */
priv->can.can_stats.bus_error++;
- stats->rx_errors++;
/* propagate the error condition to the CAN stack */
skb = alloc_can_err_skb(dev, &cf);
@@ -1027,26 +1026,32 @@ static int c_can_handle_bus_err(struct net_device *dev,
case LEC_STUFF_ERROR:
netdev_dbg(dev, "stuff error\n");
cf->data[2] |= CAN_ERR_PROT_STUFF;
+ stats->rx_errors++;
break;
case LEC_FORM_ERROR:
netdev_dbg(dev, "form error\n");
cf->data[2] |= CAN_ERR_PROT_FORM;
+ stats->rx_errors++;
break;
case LEC_ACK_ERROR:
netdev_dbg(dev, "ack error\n");
cf->data[3] = CAN_ERR_PROT_LOC_ACK;
+ stats->tx_errors++;
break;
case LEC_BIT1_ERROR:
netdev_dbg(dev, "bit1 error\n");
cf->data[2] |= CAN_ERR_PROT_BIT1;
+ stats->tx_errors++;
break;
case LEC_BIT0_ERROR:
netdev_dbg(dev, "bit0 error\n");
cf->data[2] |= CAN_ERR_PROT_BIT0;
+ stats->tx_errors++;
break;
case LEC_CRC_ERROR:
netdev_dbg(dev, "CRC error\n");
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
+ stats->rx_errors++;
break;
default:
break;
--
2.45.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 5/8] can: rockchip_canfd: CAN_ROCKCHIP_CANFD should depend on ARCH_ROCKCHIP
2024-11-04 19:53 [PATCH net 0/8] pull-request: can 2024-11-04 Marc Kleine-Budde
` (3 preceding siblings ...)
2024-11-04 19:53 ` [PATCH net 4/8] can: c_can: fix {rx,tx}_errors statistics Marc Kleine-Budde
@ 2024-11-04 19:53 ` Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 6/8] can: rockchip_canfd: Drop obsolete dependency on COMPILE_TEST Marc Kleine-Budde
` (2 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2024-11-04 19:53 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, linux-can, kernel, Geert Uytterhoeven,
Heiko Stuebner, Marc Kleine-Budde
From: Geert Uytterhoeven <geert+renesas@glider.be>
The Rockchip CAN-FD controller is only present on Rockchip SoCs. Hence
add a dependency on ARCH_ROCKCHIP, to prevent asking the user about
this driver when configuring a kernel without Rockchip platform
support.
Fixes: ff60bfbaf67f219c ("can: rockchip_canfd: add driver for Rockchip CAN-FD controller")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/a4b3c8c1cca9515e67adac83af5ba1b1fab2fcbc.1727169288.git.geert+renesas@glider.be
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/rockchip/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/can/rockchip/Kconfig b/drivers/net/can/rockchip/Kconfig
index e029e2a3ca4b..fd8d9f5eeaa4 100644
--- a/drivers/net/can/rockchip/Kconfig
+++ b/drivers/net/can/rockchip/Kconfig
@@ -3,6 +3,7 @@
config CAN_ROCKCHIP_CANFD
tristate "Rockchip CAN-FD controller"
depends on OF || COMPILE_TEST
+ depends on ARCH_ROCKCHIP || COMPILE_TEST
select CAN_RX_OFFLOAD
help
Say Y here if you want to use CAN-FD controller found on
--
2.45.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 6/8] can: rockchip_canfd: Drop obsolete dependency on COMPILE_TEST
2024-11-04 19:53 [PATCH net 0/8] pull-request: can 2024-11-04 Marc Kleine-Budde
` (4 preceding siblings ...)
2024-11-04 19:53 ` [PATCH net 5/8] can: rockchip_canfd: CAN_ROCKCHIP_CANFD should depend on ARCH_ROCKCHIP Marc Kleine-Budde
@ 2024-11-04 19:53 ` Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 7/8] can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 8/8] can: mcp251xfd: mcp251xfd_get_tef_len(): fix length calculation Marc Kleine-Budde
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2024-11-04 19:53 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, linux-can, kernel, Jean Delvare, Vincent Mailhol,
Marc Kleine-Budde
From: Jean Delvare <jdelvare@suse.de>
Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), OF
can be enabled on all architectures. Therefore depending on
COMPILE_TEST as an alternative is no longer needed.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://patch.msgid.link/20241022130439.70d016e9@endymion.delvare
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/rockchip/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/rockchip/Kconfig b/drivers/net/can/rockchip/Kconfig
index fd8d9f5eeaa4..d203c530551f 100644
--- a/drivers/net/can/rockchip/Kconfig
+++ b/drivers/net/can/rockchip/Kconfig
@@ -2,7 +2,7 @@
config CAN_ROCKCHIP_CANFD
tristate "Rockchip CAN-FD controller"
- depends on OF || COMPILE_TEST
+ depends on OF
depends on ARCH_ROCKCHIP || COMPILE_TEST
select CAN_RX_OFFLOAD
help
--
2.45.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 7/8] can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes
2024-11-04 19:53 [PATCH net 0/8] pull-request: can 2024-11-04 Marc Kleine-Budde
` (5 preceding siblings ...)
2024-11-04 19:53 ` [PATCH net 6/8] can: rockchip_canfd: Drop obsolete dependency on COMPILE_TEST Marc Kleine-Budde
@ 2024-11-04 19:53 ` Marc Kleine-Budde
2024-11-05 1:44 ` Jakub Kicinski
2024-11-04 19:53 ` [PATCH net 8/8] can: mcp251xfd: mcp251xfd_get_tef_len(): fix length calculation Marc Kleine-Budde
7 siblings, 1 reply; 12+ messages in thread
From: Marc Kleine-Budde @ 2024-11-04 19:53 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde, stable,
Simon Horman
Since commit 50ea5449c563 ("can: mcp251xfd: fix ring configuration
when switching from CAN-CC to CAN-FD mode"), the current ring and
coalescing configuration is passed to can_ram_get_layout(). That fixed
the issue when switching between CAN-CC and CAN-FD mode with
configured ring (rx, tx) and/or coalescing parameters (rx-frames-irq,
tx-frames-irq).
However 50ea5449c563 ("can: mcp251xfd: fix ring configuration when
switching from CAN-CC to CAN-FD mode"), introduced a regression when
switching CAN modes with disabled coalescing configuration: Even if
the previous CAN mode has no coalescing configured, the new mode is
configured with active coalescing. This leads to delayed receiving of
CAN-FD frames.
This comes from the fact, that ethtool uses usecs = 0 and max_frames =
1 to disable coalescing, however the driver uses internally
priv->{rx,tx}_obj_num_coalesce_irq = 0 to indicate disabled
coalescing.
Fix the regression by assigning struct ethtool_coalesce
ec->{rx,tx}_max_coalesced_frames_irq = 1 if coalescing is disabled in
the driver as can_ram_get_layout() expects this.
Reported-by: https://github.com/vdh-robothania
Closes: https://github.com/raspberrypi/linux/issues/6407
Fixes: 50ea5449c563 ("can: mcp251xfd: fix ring configuration when switching from CAN-CC to CAN-FD mode")
Cc: stable@vger.kernel.org
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241025-mcp251xfd-fix-coalesing-v1-1-9d11416de1df@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c
index e684991fa391..7209a831f0f2 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c
@@ -2,7 +2,7 @@
//
// mcp251xfd - Microchip MCP251xFD Family CAN controller driver
//
-// Copyright (c) 2019, 2020, 2021 Pengutronix,
+// Copyright (c) 2019, 2020, 2021, 2024 Pengutronix,
// Marc Kleine-Budde <kernel@pengutronix.de>
//
// Based on:
@@ -483,9 +483,11 @@ int mcp251xfd_ring_alloc(struct mcp251xfd_priv *priv)
};
const struct ethtool_coalesce ec = {
.rx_coalesce_usecs_irq = priv->rx_coalesce_usecs_irq,
- .rx_max_coalesced_frames_irq = priv->rx_obj_num_coalesce_irq,
+ .rx_max_coalesced_frames_irq = priv->rx_obj_num_coalesce_irq == 0 ?
+ 1 : priv->rx_obj_num_coalesce_irq,
.tx_coalesce_usecs_irq = priv->tx_coalesce_usecs_irq,
- .tx_max_coalesced_frames_irq = priv->tx_obj_num_coalesce_irq,
+ .tx_max_coalesced_frames_irq = priv->tx_obj_num_coalesce_irq == 0 ?
+ 1 : priv->tx_obj_num_coalesce_irq,
};
struct can_ram_layout layout;
--
2.45.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH net 8/8] can: mcp251xfd: mcp251xfd_get_tef_len(): fix length calculation
2024-11-04 19:53 [PATCH net 0/8] pull-request: can 2024-11-04 Marc Kleine-Budde
` (6 preceding siblings ...)
2024-11-04 19:53 ` [PATCH net 7/8] can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes Marc Kleine-Budde
@ 2024-11-04 19:53 ` Marc Kleine-Budde
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2024-11-04 19:53 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde,
Sven Schuchmann, stable
Commit b8e0ddd36ce9 ("can: mcp251xfd: tef: prepare to workaround
broken TEF FIFO tail index erratum") introduced
mcp251xfd_get_tef_len() to get the number of unhandled transmit events
from the Transmit Event FIFO (TEF).
As the TEF has no head pointer, the driver uses the TX FIFO's tail
pointer instead, assuming that send frames are completed. However the
check for the TEF being full was not correct. This leads to the driver
stop working if the TEF is full.
Fix the TEF full check by assuming that if, from the driver's point of
view, there are no free TX buffers in the chip and the TX FIFO is
empty, all messages must have been sent and the TEF must therefore be
full.
Reported-by: Sven Schuchmann <schuchmann@schleissheimer.de>
Closes: https://patch.msgid.link/FR3P281MB155216711EFF900AD9791B7ED9692@FR3P281MB1552.DEUP281.PROD.OUTLOOK.COM
Fixes: b8e0ddd36ce9 ("can: mcp251xfd: tef: prepare to workaround broken TEF FIFO tail index erratum")
Tested-by: Sven Schuchmann <schuchmann@schleissheimer.de>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20241104-mcp251xfd-fix-length-calculation-v3-1-608b6e7e2197@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c
index f732556d233a..d3ac865933fd 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c
@@ -16,9 +16,9 @@
#include "mcp251xfd.h"
-static inline bool mcp251xfd_tx_fifo_sta_full(u32 fifo_sta)
+static inline bool mcp251xfd_tx_fifo_sta_empty(u32 fifo_sta)
{
- return !(fifo_sta & MCP251XFD_REG_FIFOSTA_TFNRFNIF);
+ return fifo_sta & MCP251XFD_REG_FIFOSTA_TFERFFIF;
}
static inline int
@@ -122,7 +122,11 @@ mcp251xfd_get_tef_len(struct mcp251xfd_priv *priv, u8 *len_p)
if (err)
return err;
- if (mcp251xfd_tx_fifo_sta_full(fifo_sta)) {
+ /* If the chip says the TX-FIFO is empty, but there are no TX
+ * buffers free in the ring, we assume all have been sent.
+ */
+ if (mcp251xfd_tx_fifo_sta_empty(fifo_sta) &&
+ mcp251xfd_get_tx_free(tx_ring) == 0) {
*len_p = tx_ring->obj_num;
return 0;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net 7/8] can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes
2024-11-04 19:53 ` [PATCH net 7/8] can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes Marc Kleine-Budde
@ 2024-11-05 1:44 ` Jakub Kicinski
2024-11-05 5:29 ` Marc Kleine-Budde
0 siblings, 1 reply; 12+ messages in thread
From: Jakub Kicinski @ 2024-11-05 1:44 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: netdev, davem, linux-can, kernel, stable, Simon Horman
On Mon, 4 Nov 2024 20:53:30 +0100 Marc Kleine-Budde wrote:
> Reported-by: https://github.com/vdh-robothania
Did you do this because of a checkpatch warning or to give the person
credit? If the former ignore the warning, if the latter I think it's
better to mention their user name in the commit message and that's it.
IMO Reported-by should be a machine readable email address, in case we
need to CC the person and ask for testing.
That's just my $.02 for future cases.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net 1/8] can: j1939: fix error in J1939 documentation.
2024-11-04 19:53 ` [PATCH net 1/8] can: j1939: fix error in J1939 documentation Marc Kleine-Budde
@ 2024-11-05 2:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 12+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-05 2:10 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: netdev, davem, kuba, linux-can, kernel, alexander.hoelzl,
o.rempel, mailhol.vincent
Hello:
This series was applied to netdev/net.git (main)
by Marc Kleine-Budde <mkl@pengutronix.de>:
On Mon, 4 Nov 2024 20:53:24 +0100 you wrote:
> From: Alexander Hölzl <alexander.hoelzl@gmx.net>
>
> The description of PDU1 format usage mistakenly referred to PDU2 format.
>
> Signed-off-by: Alexander Hölzl <alexander.hoelzl@gmx.net>
> Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
> Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> Link: https://patch.msgid.link/20241023145257.82709-1-alexander.hoelzl@gmx.net
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
>
> [...]
Here is the summary with links:
- [net,1/8] can: j1939: fix error in J1939 documentation.
https://git.kernel.org/netdev/net/c/b6ec62e01aa4
- [net,2/8] can: {cc770,sja1000}_isa: allow building on x86_64
https://git.kernel.org/netdev/net/c/7b22846f8af5
- [net,3/8] can: m_can: m_can_close(): don't call free_irq() for IRQ-less devices
https://git.kernel.org/netdev/net/c/e4de81f9e134
- [net,4/8] can: c_can: fix {rx,tx}_errors statistics
https://git.kernel.org/netdev/net/c/4d6d26537940
- [net,5/8] can: rockchip_canfd: CAN_ROCKCHIP_CANFD should depend on ARCH_ROCKCHIP
https://git.kernel.org/netdev/net/c/4384b8b6ec46
- [net,6/8] can: rockchip_canfd: Drop obsolete dependency on COMPILE_TEST
https://git.kernel.org/netdev/net/c/51e102ec23b2
- [net,7/8] can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes
https://git.kernel.org/netdev/net/c/eb9a839b3d8a
- [net,8/8] can: mcp251xfd: mcp251xfd_get_tef_len(): fix length calculation
https://git.kernel.org/netdev/net/c/3c1c18551e6a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net 7/8] can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes
2024-11-05 1:44 ` Jakub Kicinski
@ 2024-11-05 5:29 ` Marc Kleine-Budde
0 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2024-11-05 5:29 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, davem, linux-can, kernel, stable, Simon Horman
[-- Attachment #1: Type: text/plain, Size: 984 bytes --]
On 04.11.2024 17:44:46, Jakub Kicinski wrote:
> On Mon, 4 Nov 2024 20:53:30 +0100 Marc Kleine-Budde wrote:
> > Reported-by: https://github.com/vdh-robothania
>
> Did you do this because of a checkpatch warning or to give the person
> credit? If the former ignore the warning, if the latter I think it's
> better to mention their user name in the commit message and that's it.
I added the link to their gh to credit them. Will @-mention github users
without public email addresses in future commits.
> IMO Reported-by should be a machine readable email address, in case we
> need to CC the person and ask for testing.
That makes sense.
> That's just my $.02 for future cases.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-11-05 7:29 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 19:53 [PATCH net 0/8] pull-request: can 2024-11-04 Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 1/8] can: j1939: fix error in J1939 documentation Marc Kleine-Budde
2024-11-05 2:10 ` patchwork-bot+netdevbpf
2024-11-04 19:53 ` [PATCH net 2/8] can: {cc770,sja1000}_isa: allow building on x86_64 Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 3/8] can: m_can: m_can_close(): don't call free_irq() for IRQ-less devices Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 4/8] can: c_can: fix {rx,tx}_errors statistics Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 5/8] can: rockchip_canfd: CAN_ROCKCHIP_CANFD should depend on ARCH_ROCKCHIP Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 6/8] can: rockchip_canfd: Drop obsolete dependency on COMPILE_TEST Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 7/8] can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes Marc Kleine-Budde
2024-11-05 1:44 ` Jakub Kicinski
2024-11-05 5:29 ` Marc Kleine-Budde
2024-11-04 19:53 ` [PATCH net 8/8] can: mcp251xfd: mcp251xfd_get_tef_len(): fix length calculation Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).