lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221018043333.38858-1-vivek.2311@samsung.com>
Date:   Tue, 18 Oct 2022 10:03:33 +0530
From:   Vivek Yadav <vivek.2311@...sung.com>
To:     rcsekar@...sung.com, wg@...ndegger.com, mkl@...gutronix.de,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, pankaj.dubey@...sung.com, ravi.patel@...sung.com
Cc:     linux-can@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, Vivek Yadav <vivek.2311@...sung.com>
Subject: [PATCH v4] can: mcan: Add support for handling DLEC error on CAN FD

When a frame in CAN FD format has reached the data phase, the next
CAN event (error or valid frame) will be shown in DLEC.

Utilizes the dedicated flag (Data Phase Last Error Code: DLEC flag) to
determine the type of last error that occurred in the data phase
of a CAN FD frame and handle the bus errors.

Signed-off-by: Vivek Yadav <vivek.2311@...sung.com>
---
This patch is dependent on following patch from Marc:
[1]: https://lore.kernel.org/all/20221012074205.691384-1-mkl@pengutronix.de/

 drivers/net/can/m_can/m_can.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 18a138fdfa66..98cc98564ab4 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -156,6 +156,7 @@ enum m_can_reg {
 #define PSR_EW		BIT(6)
 #define PSR_EP		BIT(5)
 #define PSR_LEC_MASK	GENMASK(2, 0)
+#define PSR_DLEC_MASK   GENMASK(8, 10)
 
 /* Interrupt Register (IR) */
 #define IR_ALL_INT	0xffffffff
@@ -868,6 +869,7 @@ static int m_can_handle_bus_errors(struct net_device *dev, u32 irqstatus,
 {
 	struct m_can_classdev *cdev = netdev_priv(dev);
 	int work_done = 0;
+	u8 dlec = 0;
 
 	if (irqstatus & IR_RF0L)
 		work_done += m_can_handle_lost_msg(dev);
@@ -878,6 +880,13 @@ static int m_can_handle_bus_errors(struct net_device *dev, u32 irqstatus,
 
 		if (is_lec_err(lec))
 			work_done += m_can_handle_lec_err(dev, lec);
+
+		dlec = FIELD_GET(PSR_DLEC_MASK, psr);
+
+		if (is_lec_err(dlec)) {
+			netdev_dbg(dev, "Data phase error detected\n");
+			work_done += m_can_handle_lec_err(dev, dlec);
+		}
 	}
 
 	/* handle protocol errors in arbitration phase */
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ