[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201222090338.186503-1-a.darwish@linutronix.de>
Date: Tue, 22 Dec 2020 10:03:37 +0100
From: "Ahmed S. Darwish" <a.darwish@...utronix.de>
To: Michael Grzeschik <m.grzeschik@...gutronix.de>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org
Cc: LKML <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Sebastian A. Siewior" <bigeasy@...utronix.de>,
"Ahmed S. Darwish" <a.darwish@...utronix.de>
Subject: [RFC PATCH 0/1] net: arcnet: Fix RESET sequence
Folks,
At drivers/net/arcnet/arcnet.c, there is:
irqreturn_t arcnet_interrupt(int irq, void *dev_id)
{
...
if (status & RESETflag) {
arcnet_close(dev);
arcnet_open(dev);
}
...
}
struct net_device_ops arcnet_netdev_ops = {
.ndo_open = arcnet_open,
.ndo_stop = arcnet_close,
...
};
which is wrong, in many ways:
1) In general, interrupt handlers should never call ->ndo_stop() and
->ndo_open() functions. They are usually full of blocking calls and
other methods that are expected to be called only from drivers
init/exit code paths.
2) arcnet_close() contains a del_timer_sync(). If the irq handler
interrupts the to-be-deleted timer then call del_timer_sync(), it
will just loop forever.
3) arcnet_close() also calls tasklet_kill(), which has a warning if
called from irq context.
4) For device reset, the sequence "arcnet_close(); arcnet_open();" is
not complete. Some children arcnet drivers have special init/exit
code sequences, which then embed a call to arcnet_open() and
arcnet_close() accordingly. Check drivers/net/arcnet/com20020.c.
Included is an RFC patch to fix the points above: if the RESET flag is
encountered, a workqueue is scheduled to run the generic reset sequence.
Note: Only compile-tested, as I do not have the hardware in question.
Thanks,
8<--------------
Ahmed S. Darwish (1):
net: arcnet: Fix RESET flag handling
drivers/net/arcnet/arc-rimi.c | 4 +-
drivers/net/arcnet/arcdevice.h | 6 +++
drivers/net/arcnet/arcnet.c | 69 +++++++++++++++++++++++++++++--
drivers/net/arcnet/com20020-isa.c | 4 +-
drivers/net/arcnet/com20020-pci.c | 2 +-
drivers/net/arcnet/com20020_cs.c | 2 +-
drivers/net/arcnet/com90io.c | 4 +-
drivers/net/arcnet/com90xx.c | 4 +-
8 files changed, 81 insertions(+), 14 deletions(-)
base-commit: 2c85ebc57b3e1817b6ce1a6b703928e113a90442
--
2.29.2
Powered by blists - more mailing lists