[PATCH v2 00/12] can: error: set of fixes and improvement on txerr and rxerr reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This series is a collection of patches targeting the CAN error
counter. The series is split in three blocks (with small relation to
each other).

Several drivers uses the data[6] and data[7] fields (both of type u8)
of the CAN error frame to report those values. However, the maximum
size an u8 can hold is 255 and the error counter can exceed this value
if bus-off status occurs. As such, the first nine patches of this
series make sure that no drivers try to report txerr or rxerr through
the CAN error frame when bus-off status is reached.

can_frame::data[5..7] are defined as being "controller
specific". Controller specific behaviors are not something desirable
(portability issue...) The tenth patch of this series specifies how
can_frame::data[5..7] should be use and remove any "controller
specific" freedom. The eleventh patch adds a flag to notify though
can_frame::can_id that data[6..7] were populated (in order to be
consistent with other fields).

Finally, the twelfth and last patch add three macro values to specify
the different error counter threshold with so far was hard-coded as
magic numbers in the drivers.

N.B.:
  * patches 1 to 10 are for net (stable).
  * patches 11 and 12 are for net-next (but depends on patches 1 to 10).


** Changelog **

v1 -> v2:
  * Fix typo in patch #10: data[7] of CAN error frames is for the RX
    error counter, not the TX one (this is litteraly a one byte
    change).

Vincent Mailhol (12):
  can: pch_can: do not report txerr and rxerr during bus-off
  can: rcar_can: do not report txerr and rxerr during bus-off
  can: sja1000: do not report txerr and rxerr during bus-off
  can: slcan: do not report txerr and rxerr during bus-off
  can: hi311x: do not report txerr and rxerr during bus-off
  can: sun4i_can: do not report txerr and rxerr during bus-off
  can: kvaser_usb_hydra: do not report txerr and rxerr during bus-off
  can: kvaser_usb_leaf: do not report txerr and rxerr during bus-off
  can: usb_8dev: do not report txerr and rxerr during bus-off
  can: error: specify the values of data[5..7] of CAN error frames
  can: add CAN_ERR_CNT flag to notify availability of error counter
  can: error: add definitions for the different CAN error thresholds

 drivers/net/can/c_can/c_can_main.c            |  6 +++---
 drivers/net/can/cc770/cc770.c                 |  1 +
 drivers/net/can/ctucanfd/ctucanfd_base.c      |  5 +++--
 drivers/net/can/grcan.c                       |  1 +
 drivers/net/can/ifi_canfd/ifi_canfd.c         |  4 ++--
 drivers/net/can/janz-ican3.c                  |  4 ++--
 drivers/net/can/kvaser_pciefd.c               |  2 +-
 drivers/net/can/m_can/m_can.c                 |  4 ++--
 drivers/net/can/pch_can.c                     |  7 ++++---
 drivers/net/can/peak_canfd/peak_canfd.c       |  6 +++---
 drivers/net/can/rcar/rcar_can.c               |  9 +++++----
 drivers/net/can/rcar/rcar_canfd.c             |  4 ++--
 drivers/net/can/sja1000/sja1000.c             |  8 +++++---
 drivers/net/can/slcan/slcan-core.c            | 13 ++++++------
 drivers/net/can/spi/hi311x.c                  |  6 ++++--
 .../net/can/spi/mcp251xfd/mcp251xfd-core.c    |  1 +
 drivers/net/can/sun4i_can.c                   | 10 +++++-----
 drivers/net/can/ti_hecc.c                     |  1 +
 drivers/net/can/usb/esd_usb.c                 |  3 ++-
 .../net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 14 +++++++++----
 .../net/can/usb/kvaser_usb/kvaser_usb_leaf.c  |  7 +++++--
 drivers/net/can/usb/peak_usb/pcan_usb.c       |  1 +
 drivers/net/can/usb/usb_8dev.c                |  8 +++++---
 drivers/net/can/xilinx_can.c                  |  1 +
 include/uapi/linux/can/error.h                | 20 ++++++++++++++++++-
 25 files changed, 94 insertions(+), 52 deletions(-)

-- 
2.35.1




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux