OSDN Git Service

can: esd_usb: Add support for CAN_CTRLMODE_BERR_REPORTING
authorFrank Jungclaus <frank.jungclaus@esd.eu>
Thu, 30 Mar 2023 18:44:46 +0000 (20:44 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 4 Apr 2023 14:48:45 +0000 (16:48 +0200)
commitc42fc36949234bc8f8b5afe734acf6b49377f37a
tree7a2d4d6766247c5b448415a43e9d20bd24ecb766
parent066b41a599d687fb0409bd0b0f3c41615f070d77
can: esd_usb: Add support for CAN_CTRLMODE_BERR_REPORTING

Announce that the driver supports CAN_CTRLMODE_BERR_REPORTING by means
of priv->can.ctrlmode_supported. Until now berr reporting always has
been active without taking care of the berr-reporting parameter given
to an "ip link set ..." command.

Additionally apply some changes to function esd_usb_rx_event():
- If berr reporting is off and it is also no state change, then
immediately return.
- Unconditionally (even in case of the above "immediate return") store
tx- and rx-error counters, so directly use priv->bec.txerr and
priv->bec.rxerr instead of intermediate variables.
- Not directly related, but to better point out the linkage between a
failed alloc_can_err_skb() and stats->rx_dropped++:
Move the increment of the rx_dropped statistic counter (back) to
directly behind the err_skb allocation.

Signed-off-by: Frank Jungclaus <frank.jungclaus@esd.eu>
Link: https://lore.kernel.org/all/20230330184446.2802135-1-frank.jungclaus@esd.eu
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/esd_usb.c