[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-can
Subject: [PATCH 2/4] socketcan: display CANFD_FDF and CANXL_XLF flag content
From: Oliver Hartkopp <socketcan () hartkopp ! net>
Date: 2024-03-18 10:46:41
Message-ID: 20240318104643.24098-3-socketcan () hartkopp ! net
[Download RAW message or body]
Display the officially defined bits for CAN XL and CAN FD.
While CANXL_XLF is a mandatory set bit value for CAN XL frames
the CANFD_FDF bit might be set based on the used Linux kernel
version. So both bits present valuable content for the user.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
epan/dissectors/packet-socketcan.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/epan/dissectors/packet-socketcan.c b/epan/dissectors/packet-socketcan.c
index e9fcdb2dd8..2e29484085 100644
--- a/epan/dissectors/packet-socketcan.c
+++ b/epan/dissectors/packet-socketcan.c
@@ -75,18 +75,20 @@ static int hf_can_err_trx_canl;
static int hf_can_err_ctrl_specific;
static int hf_canxl_priority;
static int hf_canxl_vcid;
static int hf_canxl_secflag;
+static int hf_canxl_xlflag;
static int hf_canxl_sdu_type;
static int hf_canxl_len;
static int hf_canxl_acceptance_field;
static expert_field ei_can_err_dlc_mismatch;
static int hf_canfd_brsflag;
static int hf_canfd_esiflag;
+static int hf_canfd_fdflag;
static gint ett_can;
static gint ett_can_fd;
static gint ett_can_xl;
@@ -107,13 +109,10 @@ static heur_dtbl_entry_t *heur_dtbl_entry;
#define CAN_LEN_OFFSET 4
#define CAN_DATA_OFFSET 8
#define CANFD_FLAG_OFFSET 5
-#define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */
-#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */
-
#define CANXL_FLAGS_OFFSET CAN_LEN_OFFSET
#define CANXL_LEN_OFFSET 6
#define CANXL_DATA_OFFSET 12
static dissector_table_t can_id_dissector_table = NULL;
@@ -564,10 +563,11 @@ dissect_socketcan_common(tvbuff_t *tvb, packet_info *pinfo, \
proto_tree *tree, gu NULL,
};
static int * const canfd_flag_fields[] = {
&hf_canfd_brsflag,
&hf_canfd_esiflag,
+ &hf_canfd_fdflag,
NULL,
};
static int * const can_err_flags[] = {
&hf_can_errflag,
&hf_can_err_tx_timeout,
@@ -587,10 +587,11 @@ dissect_socketcan_common(tvbuff_t *tvb, packet_info *pinfo, \
proto_tree *tree, gu &hf_canxl_vcid,
NULL,
};
static int * const canxl_flag_fields[] = {
&hf_canxl_secflag,
+ &hf_canxl_xlflag,
NULL,
};
/* determine CAN packet type */
if (can_packet_type == PACKET_TYPE_UNKNOWN) {
@@ -860,10 +861,12 @@ proto_register_socketcan(void) {
"Padding", "can.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } \
}, { &hf_canfd_brsflag, {
"Bit Rate Setting", "canfd.flags.brs", FT_BOOLEAN, 8, NULL, CANFD_BRS, \
NULL, HFILL } }, { &hf_canfd_esiflag, {
"Error State Indicator", "canfd.flags.esi", FT_BOOLEAN, 8, NULL, \
CANFD_ESI, NULL, HFILL } }, + { &hf_canfd_fdflag, {
+ "FD Frame", "canfd.flags.fdf", FT_BOOLEAN, 8, NULL, CANFD_FDF, NULL, \
HFILL } }, { &hf_can_err_tx_timeout, {
"Transmit timeout", "can.err.tx_timeout", FT_BOOLEAN, 32, NULL, \
CAN_ERR_TX_TIMEOUT, NULL, HFILL } }, { &hf_can_err_lostarb, {
"Lost arbitration", "can.err.lostarb", FT_BOOLEAN, 32, NULL, \
CAN_ERR_LOSTARB, NULL, HFILL } }, { &hf_can_err_ctrl, {
@@ -926,10 +929,12 @@ proto_register_socketcan(void) {
"Priority", "canxl.priority", FT_UINT32, BASE_DEC, NULL, 0x0000FFFF, \
NULL, HFILL } }, { &hf_canxl_vcid, {
"VCID", "canxl.vcid", FT_UINT32, BASE_DEC, NULL, 0x00FF0000, NULL, HFILL \
} }, { &hf_canxl_secflag, {
"Simple Extended Context", "canxl.flags.sec", FT_BOOLEAN, 8, NULL, \
CANXL_SEC, NULL, HFILL } }, + { &hf_canxl_xlflag, {
+ "XL Frame", "canxl.flags.xl", FT_BOOLEAN, 8, NULL, CANXL_XLF, NULL, \
HFILL } }, { &hf_canxl_sdu_type, {
"SDU type", "canxl.sdu_type", FT_UINT8, BASE_HEX, \
VALS(canxl_sdu_type_vals), 0, NULL, HFILL } }, { &hf_canxl_len, {
"Frame-Length", "canxl.len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL \
} }, { &hf_canxl_acceptance_field, {
--
2.43.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic