Skip to content

RFC Add helpers for stats and error frames

Dario Binacchi linux-can lkml netdev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 RFC Latest6 patches 1 replyIn review
  2. v2 RFC6 patches 2 repliesSuperseded
  3. v1 RFC6 patches 2 repliesSuperseded

Changes in v3 from the cover letter

- Drop double assignement of "priv" variable.
- Check "dev" parameter is not NULL.
- Drop the check of "cf" parameter not NULL

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6can: dev: add generic function can_update_bus_error_stats()drivers/net/can/dev/dev.c include/linux/can/dev.h+31 -00 replies
2/6can: flexcan: use can_update_bus_error_stats()drivers/net/can/flexcan/flexcan-core.c+1 -120 replies
3/6can: dev: add helpers to setup an error frameinclude/linux/can/dev.h+37 -00 replies
4/6can: flexcan: use helpers to setup the error framedrivers/net/can/flexcan/flexcan-core.c+7 -90 replies
5/6can: netlink: extend stats to the error types (ack, CRC, form, ...)include/uapi/linux/can/netlink.h+6 -00 replies
6/6can: dev: update the error types stats (ack, CRC, form, ...)drivers/net/can/dev/dev.c+20 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [RFC PATCH v3 0/6] Add helpers for stats and error frames

This series originates from some tests I ran on a CAN communication for one of my clients that reports sporadic errors. After enabling BERR reporting, I was surprised that the command:

ip -details -statistics link show can0

did not display the occurrence of different types of errors, but only the generic ones for reception and transmission. In trying to export this information, I felt that the code related to managing statistics and handling CAN errors (CRC, STUF, BIT, ACK, and FORM) was quite duplicated in the implementation of various drivers, and there wasn't a generic function like in the case of state changes (i. e. can_change_state). This led to the idea of adding can_update_bus_error_stats() and the helpers for setting up the CAN error frame.

Regarding patch 5/6 ("can: netlink: extend stats to the error types (ack, CRC, form, ..."), I ran

./scripts/check-uapi.sh

which found

"error - 1/934 UAPI headers compatible with x86 appear _not_ to be backwards compatible."

I included it in the series because I am currently interested in understanding whether the idea behind each of the submitted patches makes sense, and I can adjust them later if the response is positive, following your suggestions.

Changes in v3:
- Drop double assignement of "priv" variable.
- Check "dev" parameter is not NULL.
- Drop the check of "cf" parameter not NULL

Changes in v2:
- Replace macros with static inline functions
- Update the commit message
- Replace the macros with static inline funcions calls.
- Update the commit message

Dario Binacchi (6):
can: dev: add generic function can_update_bus_error_stats()
can: flexcan: use can_update_bus_error_stats()
can: dev: add helpers to setup an error frame
can: flexcan: use helpers to setup the error frame
can: netlink: extend stats to the error types (ack, CRC, form, ...)
can: dev: update the error types stats (ack, CRC, form, ...)

 drivers/net/can/dev/dev.c              | 45 ++++++++++++++++++++++++++
 drivers/net/can/flexcan/flexcan-core.c | 29 +++++------------
 include/linux/can/dev.h                | 38 ++++++++++++++++++++++
 include/uapi/linux/can/netlink.h       |  6 ++++
 4 files changed, 97 insertions(+), 21 deletions(-)
Signature · 1 line
2.43.0