From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
kernel@pengutronix.de,
Maximilian Zimmermann <maxz@spacecubics.com>,
stable@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH net-next 12/12] can: xilinx_can: set CAN FD flags on received frames
Date: Wed, 18 Nov 2026 10:11:45 +0100 [thread overview]
Message-ID: <20261118092955.1283165-13-mkl@pengutronix.de> (raw)
In-Reply-To: <20261118092955.1283165-1-mkl@pengutronix.de>
From: Maximilian Zimmermann <maxz@spacecubics.com>
The Xilinx CAN FD controller reports the bit rate switch (BRS) and error
state indicator (ESI) in the receive buffer DLC register. The receive
path currently uses this register to determine frame format and payload
length, but does not set BRS and ESI in struct canfd_frame::flags.
This results in applications being unable to receive the BRS and ESI
flags, even when the controller correctly received them.
Add the ESI register mask and copy the controller flags to the
corresponding SocketCAN canfd_frame struct.
Fixes: c223da689324 ("can: xilinx_can: Add support for CANFD FD frames")
Cc: stable@vger.kernel.org
Signed-off-by: Maximilian Zimmermann <maxz@spacecubics.com>
Link: https://patch.msgid.link/20260921-fix-xilinx-canfd-flags-v1-1-a371c90b4e7c@spacecubics.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/xilinx_can.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 43d7f22820b8..52661e088205 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -157,6 +157,7 @@ enum xcan_reg {
#define XCAN_2_FSR_RI_MASK 0x0000003F /* RX Read Index */
#define XCAN_DLCR_EDL_MASK 0x08000000 /* EDL Mask in DLC */
#define XCAN_DLCR_BRS_MASK 0x04000000 /* BRS Mask in DLC */
+#define XCAN_DLCR_ESI_MASK 0x02000000 /* ESI Mask in DLC */
#define XCAN_ECC_CFG_REECRX_MASK BIT(2) /* Reset RX FIFO ECC error counters */
#define XCAN_ECC_CFG_REECTXOL_MASK BIT(1) /* Reset TXOL FIFO ECC error counters */
#define XCAN_ECC_CFG_REECTXTL_MASK BIT(0) /* Reset TXTL FIFO ECC error counters */
@@ -959,6 +960,11 @@ static int xcanfd_rx(struct net_device *ndev, int frame_base)
/* Check the frame received is FD or not*/
if (dlc & XCAN_DLCR_EDL_MASK) {
+ if (dlc & XCAN_DLCR_BRS_MASK)
+ cf->flags |= CANFD_BRS;
+ if (dlc & XCAN_DLCR_ESI_MASK)
+ cf->flags |= CANFD_ESI;
+
for (i = 0; i < cf->len; i += 4) {
dw_offset = XCANFD_FRAME_DW_OFFSET(frame_base) +
(dwindex * XCANFD_DW_BYTES);
--
2.53.0
prev parent reply other threads:[~2026-11-18 9:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 9:11 [PATCH net-next 0/12] pull-request: can-next 2026-11-18 Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 01/12] MAINTAINERS: add entry for PEAK-System CAN drivers Marc Kleine-Budde
2026-11-18 9:38 ` netdev-bot+sinfo
2026-11-18 9:45 ` Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 02/12] can: raw: remove redundant NULL check before netdev_hold() Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 03/12] can: dev: remove unused safe_candev_priv() Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 04/12] can: convert to DEFINE_SIMPLE_DEV_PM_OPS() Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 05/12] can: cc770: don't discard the IRQ lookup error in probe Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 06/12] can: sun4i_can: " Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 07/12] can: at91_can: " Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 08/12] can: janz-ican3: " Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 09/12] can: ifi_canfd: " Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 10/12] can: remove Softing CANcard driver Marc Kleine-Budde
2026-11-18 9:11 ` [PATCH net-next 11/12] can: ucan: fix repeated word 'is' in comment Marc Kleine-Budde
2026-11-18 9:11 ` Marc Kleine-Budde [this message]
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=20261118092955.1283165-13-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=davem@davemloft.net \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=maxz@spacecubics.com \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).