mirror-linux/drivers/net/can/usb
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
..
etas_es58x can: etas_es58x: es58x_init_netdev(): free netdev when register_candev() 2022-11-24 16:10:04 +01:00
kvaser_usb can: kvaser_usb: hydra: help gcc-13 to figure out cmd_len 2023-02-25 11:25:40 +01:00
peak_usb can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
Kconfig
Makefile
ems_usb.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
esd_usb.c can: esd_usb: Make use of can_change_state() and relocate checking skb for NULL 2023-03-10 09:33:06 +01:00
gs_usb.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
mcba_usb.c can: mcba_usb: Fix termination command argument 2022-11-24 16:26:48 +01:00
ucan.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
usb_8dev.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00