From: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Brandon Maier <brandon.maier@rockwellcollins.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
Marc Kleine-Budde <mkl@pengutronix.de>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
"Ludovic Desroches" <ludovic.desroches@microchip.com>,
"open list:CAN NETWORK DRIVERS" <linux-can@vger.kernel.org>,
"open list:NETWORKING DRIVERS" <netdev@vger.kernel.org>,
"moderated list:ARM/Microchip (AT91) SoC support"
<linux-arm-kernel@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] can: at91_can: fix passive-state AERR flooding
Date: Thu, 7 Oct 2021 15:28:23 +0200 [thread overview]
Message-ID: <ac0aaa78-d258-fb22-300a-43851006b5c5@microchip.com> (raw)
In-Reply-To: <20211005183023.109328-1-brandon.maier@rockwellcollins.com>
On 05/10/2021 at 20:30, Brandon Maier wrote:
> When the at91_can is a single node on the bus and a user attempts to
> transmit, the can state machine will report ack errors and increment the
> transmit error count until it reaches the passive-state. Per the
> specification, it will then transmit with a passive error, but will stop
> incrementing the transmit error count. This results in the host machine
> being flooded with the AERR interrupt forever, or until another node
> rejoins the bus.
>
> To prevent the AERR flooding, disable the AERR interrupt when we are in
> passive mode.
>
> Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
Even if I'm not familiar with the matter, the explanation above makes sense:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Thanks Brandon, best regards,
Nicolas
> ---
> drivers/net/can/at91_can.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
> index b06af90a9964..2a8831127bd0 100644
> --- a/drivers/net/can/at91_can.c
> +++ b/drivers/net/can/at91_can.c
> @@ -804,8 +804,13 @@ static int at91_poll(struct napi_struct *napi, int quota)
> work_done += at91_poll_err(dev, quota - work_done, reg_sr);
>
> if (work_done < quota) {
> - /* enable IRQs for frame errors and all mailboxes >= rx_next */
> + /* enable IRQs for frame errors and all mailboxes >= rx_next,
> + * disable the ack error in passive mode to avoid flooding
> + * ourselves with interrupts
> + */
> u32 reg_ier = AT91_IRQ_ERR_FRAME;
> + if (priv->can.state == CAN_STATE_ERROR_PASSIVE)
> + reg_ier &= ~AT91_IRQ_AERR;
>
> reg_ier |= get_irq_mb_rx(priv) & ~AT91_MB_MASK(priv->rx_next);
>
> --
> 2.30.2
>
--
Nicolas Ferre
next prev parent reply other threads:[~2021-10-07 13:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 18:30 [PATCH] can: at91_can: fix passive-state AERR flooding Brandon Maier
2021-10-07 13:28 ` Nicolas Ferre [this message]
2021-10-17 12:46 ` 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=ac0aaa78-d258-fb22-300a-43851006b5c5@microchip.com \
--to=nicolas.ferre@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=brandon.maier@rockwellcollins.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=mkl@pengutronix.de \
--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