linux/drivers/net/can/usb
Frank Jungclaus 6d3c6d2304 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>
History 2023-03-10 09:28:23 +01:00
..
etas_es58x can: etas_es58x: remove es58x_get_product_info() 2022-12-12 11:39:13 +01:00
kvaser_usb can: kvaser_usb: hydra: help gcc-13 to figure out cmd_len 2022-12-19 16:08:27 +01:00
peak_usb can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
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:28:23 +01:00
gs_usb.c can: gs_usb: remove gs_can::iface 2022-12-12 11:41:25 +01:00
Kconfig can: etas_es58x: add devlink support 2022-12-12 11:39:12 +01:00
Makefile can/esd_usb2: Rename esd_usb2.c to esd_usb.c 2022-06-25 13:05:26 +02:00
mcba_usb.c can: mcba_usb: Fix termination command argument 2022-11-24 16:26:48 +01:00
ucan.c can: ucan: remove unused ucan_priv::intf 2022-12-12 11:41:25 +01:00
usb_8dev.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00