From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Frank Jungclaus <Frank.Jungclaus@esd.eu>
Cc: "mailhol.vincent@wanadoo.fr" <mailhol.vincent@wanadoo.fr>,
"Stefan Mätje" <Stefan.Maetje@esd.eu>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"wg@grandegger.com" <wg@grandegger.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] can: esd_usb: Improved behavior on esd CAN_ERROR_EXT event (2)
Date: Thu, 2 Feb 2023 16:22:56 +0100 [thread overview]
Message-ID: <20230202152256.kc5xh4e4m6panumw@pengutronix.de> (raw)
In-Reply-To: <786db8fae65a2ed415b5dd0c3001b4dfc8c7112b.camel@esd.eu>
[-- Attachment #1: Type: text/plain, Size: 3329 bytes --]
On 23.01.2023 15:47:22, Frank Jungclaus wrote:
> On Thu, 2022-12-22 at 11:21 +0900, Vincent MAILHOL wrote:
> > On Thu. 22 Dec. 2022 at 03:42, Frank Jungclaus <Frank.Jungclaus@esd.eu> wrote:
> > > On Tue, 2022-12-20 at 14:49 +0900, Vincent MAILHOL wrote:
> > > > On Tue. 20 Dec. 2022 at 06:29, Frank Jungclaus <frank.jungclaus@esd.eu> wrote:
> > > > > Started a rework initiated by Vincents remarks "You should not report
> > > > > the greatest of txerr and rxerr but the one which actually increased."
> > > > > [1]
> > > >
> > > > I do not see this comment being addressed. You are still assigning the
> > > > flags depending on the highest value, not the one which actually
> > > > changed.
> > >
> > >
> > > Yes, I'm assigning depending on the highest value, but from my point of
> > > view doing so is analogue to what is done by can_change_state().
> >
> > On the surface, it may look similar. But if you look into details,
> > can_change_state() is only called when there is a change on enum
> > can_state. enum can_state is the global state and does not
> > differentiate the RX and TX.
> >
> > I will give an example. Imagine that:
> >
> > - txerr is 128 (ERROR_PASSIVE)
> > - rxerr is 95 (ERROR_ACTIVE)
> >
> > Imagine that rxerr then increases to 96. If you call
> > can_change_state() under this condition, the old state:
> > can_priv->state is still equal to the new one: max(tx_state, rx_state)
> > and you would get the oops message:
> >
> > https://elixir.bootlin.com/linux/latest/source/drivers/net/can/dev/dev.c#L100
> >
> > So can_change_state() is indeed correct because it excludes the case
> > when the smallest err counter changed.
> >
> > > And
> > > it should be fine, because e.g. my "case ESD_BUSSTATE_WARN:" is reached
> > > exactly once while the transition from ERROR_ACTIVE to
> > > ERROR_WARN. Than one of rec or tec is responsible for this
> > > transition.
> > > There is no second pass for "case ESD_BUSSTATE_WARN:"
> > > when e.g. rec is already on WARN (or above) and now tec also reaches
> > > WARN.
> > > Man, this is even difficult to explain in German language ;)
> >
> > OK. This is new information. I agree that it should work. But I am
> > still puzzled because the code doesn't make this limitation apparent.
> >
> > Also, as long as you have the rxerr and txerr value, you should still
> > be able to set the correct flag by comparing the err counters instead
> > of relying on your device events.
> >
>
> I agree, this would be an option. But I dislike the fact that then
> - beside the USB firmware - there is a second instance which decides on
> the bus state. I'll send a reworked patch which makes use of
^^^^^^^^^^^^^^^^^^^^^
> can_change_state(). Hopefully that will address your concerns ;)
> This also will fix the imperfection, that our current code e.g. does
> an error_warning++ when going back in direction of ERROR_ACTIVE ...
Not taking this series, waiting for the reworked version.
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-02-02 15:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-19 21:27 [PATCH 2/3] can: esd_usb: Improved behavior on esd CAN_ERROR_EXT event (2) Frank Jungclaus
2022-12-19 21:27 ` [PATCH 3/3] can: esd_usb: Improved decoding for ESD_EV_CAN_ERROR_EXT messages Frank Jungclaus
2022-12-20 5:27 ` Vincent MAILHOL
2022-12-20 8:53 ` Vincent MAILHOL
2022-12-20 9:05 ` Marc Kleine-Budde
2023-01-23 15:51 ` Frank Jungclaus
2022-12-21 18:01 ` Frank Jungclaus
2022-12-20 5:49 ` [PATCH 2/3] can: esd_usb: Improved behavior on esd CAN_ERROR_EXT event (2) Vincent MAILHOL
2022-12-21 18:29 ` Frank Jungclaus
2022-12-22 2:21 ` Vincent MAILHOL
2023-01-23 15:47 ` Frank Jungclaus
2023-02-02 15:22 ` Marc Kleine-Budde [this message]
2023-02-09 19:00 ` Frank Jungclaus
2023-02-09 19:30 ` Marc Kleine-Budde
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=20230202152256.kc5xh4e4m6panumw@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=Frank.Jungclaus@esd.eu \
--cc=Stefan.Maetje@esd.eu \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=netdev@vger.kernel.org \
--cc=wg@grandegger.com \
/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).