linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] net: arcnet: Fix RESET sequence
@ 2020-12-22  9:03 Ahmed S. Darwish
  2020-12-22  9:03 ` [RFC PATCH 1/1] net: arcnet: Fix RESET flag handling Ahmed S. Darwish
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ahmed S. Darwish @ 2020-12-22  9:03 UTC (permalink / raw)
  To: Michael Grzeschik, David S. Miller, Jakub Kicinski, netdev
  Cc: LKML, Thomas Gleixner, Sebastian A. Siewior, Ahmed S. Darwish

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-18 17:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22  9:03 [RFC PATCH 0/1] net: arcnet: Fix RESET sequence Ahmed S. Darwish
2020-12-22  9:03 ` [RFC PATCH 1/1] net: arcnet: Fix RESET flag handling Ahmed S. Darwish
2021-01-11 10:09 ` [RFC PATCH 0/1] net: arcnet: Fix RESET sequence Sebastian A. Siewior
2021-01-11 13:54 ` Ahmed S. Darwish
2021-01-18 10:45   ` Ahmed S. Darwish
2021-01-18 17:31     ` Jakub Kicinski

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).