Re: [PATCH v2] can: mcan: Add support for handling DLEC error on CAN FD

From: Marc Kleine-Budde
Date: Fri Oct 14 2022 - 07:36:32 EST


On 14.10.2022 16:53:19, Vivek Yadav wrote:
> >
> > if (is_lec_err(lec))
> > work_done += m_can_handle_lec_err(dev, lec);
> >
> > if (is_lec_err(dlec))
> > work_done += m_can_handle_lec_err(dev, dlec);
> >
> > > + u8 dlec = FIELD_GET(PSR_DLEC_MASK, psr);
> > > +
> > > + if (is_lec_err(dlec)) {
> > > + netdev_dbg(dev, "Data phase error
> > detected\n");
> >
> > If you add a debug, please add one for the Arbitration phase, too.
>
> I have added the debug print specially for dlec (data phase). So we
> can differentiate lec errors (for all type of frames except FD with
> BRS) and Data phase errors, as we are calling same handler function
> for both the errors.
>
> If I understood your comment correctly, you are asking something like below:
> /* handle protocol errors in arbitration phase */
> if ((cdev->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) &&
> - m_can_is_protocol_err(irqstatus))
> + m_can_is_protocol_err(irqstatus)) {
> + netdev_dbg(dev, "Arbitration phase error detected\n");
> work_done += m_can_handle_protocol_error(dev, irqstatus);
> + }
>
> If the above implementation is correct as per your review comment, I
> think we don't need the above changes because Debug print for
> arbitration failure are already there in "
> m_can_handle_protocol_error" function.

Ok

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature