All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
To: linux-can@vger.kernel.org
Cc: "Marc Kleine-Budde" <mkl@pengutronix.de>,
	"Frank Jungclaus" <frank.jungclaus@esd.eu>,
	"Stefan Mätje" <Stefan.Maetje@esd.eu>,
	"Vincent Mailhol" <mailhol.vincent@wanadoo.fr>
Subject: [PATCH v2 10/12] can: error: specify the values of data[5..7] of CAN error frames
Date: Tue, 19 Jul 2022 23:35:48 +0900	[thread overview]
Message-ID: <20220719143550.3681-11-mailhol.vincent@wanadoo.fr> (raw)
In-Reply-To: <20220719143550.3681-1-mailhol.vincent@wanadoo.fr>

Currently, data[5..7] of struct can_frame, when used as a CAN error
frame, are defined as being "controller specific". Device specific
behaviours are problematic because it prevents someone from writing
code which is portable between devices.

As a matter of fact, data[5] is never used, data[6] is always used to
report TX error counter and data[7] is always used to report RX error
counter. can-utils also relies on this.

This patch updates the comment in the uapi header to specify that
data[5] is reserved (and thus should not be used) and that data[6..7]
are used for error counters.

Fixes: 0d66548a10cb ("[CAN]: Add PF_CAN core module")
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 include/uapi/linux/can/error.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/can/error.h b/include/uapi/linux/can/error.h
index 34633283de64..a1000cb63063 100644
--- a/include/uapi/linux/can/error.h
+++ b/include/uapi/linux/can/error.h
@@ -120,6 +120,9 @@
 #define CAN_ERR_TRX_CANL_SHORT_TO_GND  0x70 /* 0111 0000 */
 #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */
 
-/* controller specific additional information / data[5..7] */
+/* data[5] is reserved (do not use) */
+
+/* TX error counter / data[6] */
+/* RX error counter / data[7] */
 
 #endif /* _UAPI_CAN_ERROR_H */
-- 
2.35.1


  parent reply	other threads:[~2022-07-19 14:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12 15:31 [PATCH v1 00/12] can: error: set of fixes and improvement on txerr and rxerr reporting Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 01/12] can: pch_can: do not report txerr and rxerr during bus-off Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 02/12] can: rcar_can: " Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 03/12] can: sja1000: " Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 04/12] can: slcan: " Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 05/12] can: hi311x: " Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 06/12] can: sun4i_can: " Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 07/12] can: kvaser_usb_hydra: " Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 08/12] can: kvaser_usb_leaf: " Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 09/12] can: usb_8dev: " Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 10/12] can: error: specify the values of data[5..7] of CAN error frames Vincent Mailhol
2022-07-19 10:44   ` Stefan Mätje
2022-07-19 14:14     ` Vincent MAILHOL
2022-07-12 15:31 ` [PATCH v1 11/12] can: add CAN_ERR_CNT flag to notify availability of error counter Vincent Mailhol
2022-07-12 15:31 ` [PATCH v1 12/12] can: error: add definitions for the different CAN error thresholds Vincent Mailhol
2022-07-19 14:35 ` [PATCH v2 00/12] can: error: set of fixes and improvement on txerr and rxerr reporting Vincent Mailhol
2022-07-19 14:35   ` [PATCH v2 01/12] can: pch_can: do not report txerr and rxerr during bus-off Vincent Mailhol
2022-07-19 14:35   ` [PATCH v2 02/12] can: rcar_can: " Vincent Mailhol
2022-07-19 14:35   ` [PATCH v2 03/12] can: sja1000: " Vincent Mailhol
2022-07-19 14:35   ` [PATCH v2 04/12] can: slcan: " Vincent Mailhol
2022-07-19 14:35   ` [PATCH v2 05/12] can: hi311x: " Vincent Mailhol
2022-07-19 14:35   ` [PATCH v2 06/12] can: sun4i_can: " Vincent Mailhol
2022-07-19 14:35   ` [PATCH v2 07/12] can: kvaser_usb_hydra: " Vincent Mailhol
2022-07-19 14:35   ` [PATCH v2 08/12] can: kvaser_usb_leaf: " Vincent Mailhol
2022-07-19 14:35   ` [PATCH v2 09/12] can: usb_8dev: " Vincent Mailhol
2022-07-19 14:35   ` Vincent Mailhol [this message]
2022-07-19 14:35   ` [PATCH v2 11/12] can: add CAN_ERR_CNT flag to notify availability of error counter Vincent Mailhol
2022-07-19 14:35   ` [PATCH v2 12/12] can: error: add definitions for the different CAN error thresholds Vincent Mailhol
2022-07-20  7:17   ` [PATCH v2 00/12] can: error: set of fixes and improvement on txerr and rxerr reporting Marc Kleine-Budde
2022-07-20  7:24     ` Vincent MAILHOL

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220719143550.3681-11-mailhol.vincent@wanadoo.fr \
    --to=mailhol.vincent@wanadoo.fr \
    --cc=Stefan.Maetje@esd.eu \
    --cc=frank.jungclaus@esd.eu \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.