Skip to content

Commit 08d05ce

Browse files
committed
Merge tag 'linux-can-fixes-for-6.12-20241104' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says: ==================== pull-request: can 2024-11-04 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. * tag 'linux-can-fixes-for-6.12-20241104' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can: can: mcp251xfd: mcp251xfd_get_tef_len(): fix length calculation can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes can: rockchip_canfd: Drop obsolete dependency on COMPILE_TEST can: rockchip_canfd: CAN_ROCKCHIP_CANFD should depend on ARCH_ROCKCHIP can: c_can: fix {rx,tx}_errors statistics can: m_can: m_can_close(): don't call free_irq() for IRQ-less devices can: {cc770,sja1000}_isa: allow building on x86_64 can: j1939: fix error in J1939 documentation. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 5ccdcdf + 3c1c185 commit 08d05ce

File tree

8 files changed

+25
-12
lines changed

8 files changed

+25
-12
lines changed

Documentation/networking/j1939.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ format, the Group Extension is set in the PS-field.
121121

122122
On the other hand, when using PDU1 format, the PS-field contains a so-called
123123
Destination Address, which is _not_ part of the PGN. When communicating a PGN
124-
from user space to kernel (or vice versa) and PDU2 format is used, the PS-field
124+
from user space to kernel (or vice versa) and PDU1 format is used, the PS-field
125125
of the PGN shall be set to zero. The Destination Address shall be set
126126
elsewhere.
127127

drivers/net/can/c_can/c_can_main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,6 @@ static int c_can_handle_bus_err(struct net_device *dev,
10111011

10121012
/* common for all type of bus errors */
10131013
priv->can.can_stats.bus_error++;
1014-
stats->rx_errors++;
10151014

10161015
/* propagate the error condition to the CAN stack */
10171016
skb = alloc_can_err_skb(dev, &cf);
@@ -1027,26 +1026,32 @@ static int c_can_handle_bus_err(struct net_device *dev,
10271026
case LEC_STUFF_ERROR:
10281027
netdev_dbg(dev, "stuff error\n");
10291028
cf->data[2] |= CAN_ERR_PROT_STUFF;
1029+
stats->rx_errors++;
10301030
break;
10311031
case LEC_FORM_ERROR:
10321032
netdev_dbg(dev, "form error\n");
10331033
cf->data[2] |= CAN_ERR_PROT_FORM;
1034+
stats->rx_errors++;
10341035
break;
10351036
case LEC_ACK_ERROR:
10361037
netdev_dbg(dev, "ack error\n");
10371038
cf->data[3] = CAN_ERR_PROT_LOC_ACK;
1039+
stats->tx_errors++;
10381040
break;
10391041
case LEC_BIT1_ERROR:
10401042
netdev_dbg(dev, "bit1 error\n");
10411043
cf->data[2] |= CAN_ERR_PROT_BIT1;
1044+
stats->tx_errors++;
10421045
break;
10431046
case LEC_BIT0_ERROR:
10441047
netdev_dbg(dev, "bit0 error\n");
10451048
cf->data[2] |= CAN_ERR_PROT_BIT0;
1049+
stats->tx_errors++;
10461050
break;
10471051
case LEC_CRC_ERROR:
10481052
netdev_dbg(dev, "CRC error\n");
10491053
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
1054+
stats->rx_errors++;
10501055
break;
10511056
default:
10521057
break;

drivers/net/can/cc770/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if CAN_CC770
77

88
config CAN_CC770_ISA
99
tristate "ISA Bus based legacy CC770 driver"
10-
depends on ISA
10+
depends on HAS_IOPORT
1111
help
1212
This driver adds legacy support for CC770 and AN82527 chips
1313
connected to the ISA bus using I/O port, memory mapped or

drivers/net/can/m_can/m_can.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,8 @@ static int m_can_close(struct net_device *dev)
17651765
netif_stop_queue(dev);
17661766

17671767
m_can_stop(dev);
1768-
free_irq(dev->irq, dev);
1768+
if (dev->irq)
1769+
free_irq(dev->irq, dev);
17691770

17701771
m_can_clean(dev);
17711772

drivers/net/can/rockchip/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
config CAN_ROCKCHIP_CANFD
44
tristate "Rockchip CAN-FD controller"
5-
depends on OF || COMPILE_TEST
5+
depends on OF
6+
depends on ARCH_ROCKCHIP || COMPILE_TEST
67
select CAN_RX_OFFLOAD
78
help
89
Say Y here if you want to use CAN-FD controller found on

drivers/net/can/sja1000/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ config CAN_PLX_PCI
8787

8888
config CAN_SJA1000_ISA
8989
tristate "ISA Bus based legacy SJA1000 driver"
90-
depends on ISA
90+
depends on HAS_IOPORT
9191
help
9292
This driver adds legacy support for SJA1000 chips connected to
9393
the ISA bus using I/O port, memory mapped or indirect access.

drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// mcp251xfd - Microchip MCP251xFD Family CAN controller driver
44
//
5-
// Copyright (c) 2019, 2020, 2021 Pengutronix,
5+
// Copyright (c) 2019, 2020, 2021, 2024 Pengutronix,
66
// Marc Kleine-Budde <[email protected]>
77
//
88
// Based on:
@@ -483,9 +483,11 @@ int mcp251xfd_ring_alloc(struct mcp251xfd_priv *priv)
483483
};
484484
const struct ethtool_coalesce ec = {
485485
.rx_coalesce_usecs_irq = priv->rx_coalesce_usecs_irq,
486-
.rx_max_coalesced_frames_irq = priv->rx_obj_num_coalesce_irq,
486+
.rx_max_coalesced_frames_irq = priv->rx_obj_num_coalesce_irq == 0 ?
487+
1 : priv->rx_obj_num_coalesce_irq,
487488
.tx_coalesce_usecs_irq = priv->tx_coalesce_usecs_irq,
488-
.tx_max_coalesced_frames_irq = priv->tx_obj_num_coalesce_irq,
489+
.tx_max_coalesced_frames_irq = priv->tx_obj_num_coalesce_irq == 0 ?
490+
1 : priv->tx_obj_num_coalesce_irq,
489491
};
490492
struct can_ram_layout layout;
491493

drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
#include "mcp251xfd.h"
1818

19-
static inline bool mcp251xfd_tx_fifo_sta_full(u32 fifo_sta)
19+
static inline bool mcp251xfd_tx_fifo_sta_empty(u32 fifo_sta)
2020
{
21-
return !(fifo_sta & MCP251XFD_REG_FIFOSTA_TFNRFNIF);
21+
return fifo_sta & MCP251XFD_REG_FIFOSTA_TFERFFIF;
2222
}
2323

2424
static inline int
@@ -122,7 +122,11 @@ mcp251xfd_get_tef_len(struct mcp251xfd_priv *priv, u8 *len_p)
122122
if (err)
123123
return err;
124124

125-
if (mcp251xfd_tx_fifo_sta_full(fifo_sta)) {
125+
/* If the chip says the TX-FIFO is empty, but there are no TX
126+
* buffers free in the ring, we assume all have been sent.
127+
*/
128+
if (mcp251xfd_tx_fifo_sta_empty(fifo_sta) &&
129+
mcp251xfd_get_tx_free(tx_ring) == 0) {
126130
*len_p = tx_ring->obj_num;
127131
return 0;
128132
}

0 commit comments

Comments
 (0)