mirror-linux/drivers/net/can
Frank Jungclaus ccf81ec1f1 can: esd_usb: Make use of can_change_state() and relocate checking skb for NULL
[ Upstream commit 9684b000a8 ]

Start a rework initiated by Vincents remarks "You should not report
the greatest of txerr and rxerr but the one which actually increased."
[1] and "As far as I understand, those flags should be set only when
the threshold is reached" [2] .

Therefore make use of can_change_state() to (among others) set the
flags CAN_ERR_CRTL_[RT]X_WARNING and CAN_ERR_CRTL_[RT]X_PASSIVE,
maintain CAN statistic counters for error_warning, error_passive and
bus_off.

Relocate testing alloc_can_err_skb() for NULL to the end of
esd_usb_rx_event(), to have things like can_bus_off(),
can_change_state() working even in out of memory conditions.

Fixes: 96d8e90382 ("can: Add driver for esd CAN-USB/2 device")
Signed-off-by: Frank Jungclaus <frank.jungclaus@esd.eu>
Link: [1] https://lore.kernel.org/all/CAMZ6RqKGBWe15aMkf8-QLf-cOQg99GQBebSm+1wEzTqHgvmNuw@mail.gmail.com/
Link: [2] https://lore.kernel.org/all/CAMZ6Rq+QBO1yTX_o6GV0yhdBj-RzZSRGWDZBS0fs7zbSTy4hmA@mail.gmail.com/
Link: https://lore.kernel.org/all/20230216190450.3901254-3-frank.jungclaus@esd.eu
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-10 09:33:06 +01:00
..
c_can
cc770
ctucanfd
dev
flexcan
ifi_canfd
m_can can: tcan4x5x: Fix use of register error status mask 2022-12-31 13:32:27 +01:00
mscan
peak_canfd
rcar can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses 2023-03-10 09:32:58 +01:00
sja1000
slcan
softing
spi can: mcp251xfd: mcp251xfd_ring_set_ringparam(): assign missing tx_obj_num_coalesce_irq 2023-02-09 11:28:10 +01:00
usb can: esd_usb: Make use of can_change_state() and relocate checking skb for NULL 2023-03-10 09:33:06 +01:00
Kconfig
Makefile
at91_can.c
can327.c
grcan.c
janz-ican3.c
kvaser_pciefd.c
pch_can.c
sun4i_can.c
ti_hecc.c
vcan.c
vxcan.c
xilinx_can.c