From: Mariusz Madej <Mariusz.Madej@xtrack.com>
To: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Cc: "dmurphy@ti.com" <dmurphy@ti.com>
Subject: m_can: a lot of 'Rx FIFO 0 Message Lost' in dmesg
Date: Wed, 24 Feb 2021 14:27:28 +0000 [thread overview]
Message-ID: <PR3PR05MB7212376CDA795770B7E625E6809F9@PR3PR05MB7212.eurprd05.prod.outlook.com> (raw)
Hi,
I have a problem with m_can controller in my sama5d2 processor.
Under heavy can traffic it happens that my device starts to report (dmesg):
[ 77.610000] m_can_platform f8054000.can can0: Rx FIFO 0 Message Lost
[ 77.620000] m_can_platform f8054000.can can0: Rx FIFO 0 Message Lost
[ 77.630000] m_can_platform f8054000.can can0: Rx FIFO 0 Message Lost
[ 77.630000] m_can_platform f8054000.can can0: Rx FIFO 0 Message Lost
[ 77.640000] m_can_platform f8054000.can can0: Rx FIFO 0 Message Lost
[ 77.640000] m_can_platform f8054000.can can0: Rx FIFO 0 Message Lost
[ 77.650000] m_can_platform f8054000.can can0: Rx FIFO 0 Message Lost
[ 77.660000] m_can_platform f8054000.can can0: Rx FIFO 0 Message Lost
[ 77.660000] m_can_platform f8054000.can can0: Rx FIFO 0 Message Lost
what causes large load problem in my system.
I think I have a clue what is going on but my kernel knowledge is low so i want
You to tell me if I am right or not. So:
The only place in m_can.c file, where interrupt register is cleared is function
called when interrupt arrives
static irqreturn_t m_can_isr(int irq, void *dev_id)
{
.
.
/* ACK all irqs */
if (ir & IR_ALL_INT)
m_can_write(cdev, M_CAN_IR, ir);
.
.
}
But when we enter 'NAPI mode' in heavy load we are never get to this function
until load gets lower and interrupts are enabled again. In this situation,
this code:
static int m_can_do_rx_poll(struct net_device *dev, int quota)
{
struct m_can_classdev *cdev = netdev_priv(dev);
u32 pkts = 0;
u32 rxfs;
rxfs = m_can_read(cdev, M_CAN_RXF0S);
if (!(rxfs & RXFS_FFL_MASK)) {
netdev_dbg(dev, "no messages in fifo0\n");
return 0;
}
while ((rxfs & RXFS_FFL_MASK) && (quota > 0)) {
if (rxfs & RXFS_RFL)
netdev_warn(dev, "Rx FIFO 0 Message Lost\n");
m_can_read_fifo(dev, rxfs);
quota--;
pkts++;
rxfs = m_can_read(cdev, M_CAN_RXF0S);
}
if (pkts)
can_led_event(dev, CAN_LED_EVENT_RX);
return pkts;
}
will always have (rxfs & RXFS_RFL) == true until interrupt are enabled again.
That is why we got so many messages in a row for so long time. So clearing
RXFS_RFL bit after warning is issued could be a solution.
Can You tell me if I am right?
Regards
Mariusz
next reply other threads:[~2021-02-24 15:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-24 14:27 Mariusz Madej [this message]
2021-02-26 13:37 ` m_can: a lot of 'Rx FIFO 0 Message Lost' in dmesg Torin Cooper-Bennun
2021-02-27 4:03 ` Mariusz Madej
2021-03-01 14:14 ` Torin Cooper-Bennun
2021-03-01 21:31 ` Mariusz Madej
-- strict thread matches above, loose matches on Subject: below --
2021-02-24 11:24 Mariusz Madej
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=PR3PR05MB7212376CDA795770B7E625E6809F9@PR3PR05MB7212.eurprd05.prod.outlook.com \
--to=mariusz.madej@xtrack.com \
--cc=dmurphy@ti.com \
--cc=linux-can@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).