OSDN Git Service

net: ks8851-ml: Fix IRQ handling and locking
authorMarek Vasut <marex@denx.de>
Sun, 23 Feb 2020 13:38:40 +0000 (14:38 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Feb 2020 04:53:42 +0000 (20:53 -0800)
commit44343418d0f2f623cb9da6f5000df793131cbe3b
tree0f3f2402d2dbc7b5b7e7e9e8223ba6fd40d6bbce
parent52df1e564eb0470b2ecd1481e457932f09f49f5d
net: ks8851-ml: Fix IRQ handling and locking

The KS8851 requires that packet RX and TX are mutually exclusive.
Currently, the driver hopes to achieve this by disabling interrupt
from the card by writing the card registers and by disabling the
interrupt on the interrupt controller. This however is racy on SMP.

Replace this approach by expanding the spinlock used around the
ks_start_xmit() TX path to ks_irq() RX path to assure true mutual
exclusion and remove the interrupt enabling/disabling, which is
now not needed anymore. Furthermore, disable interrupts also in
ks_net_stop(), which was missing before.

Note that a massive improvement here would be to re-use the KS8851
driver approach, which is to move the TX path into a worker thread,
interrupt handling to threaded interrupt, and synchronize everything
with mutexes, but that would be a much bigger rework, for a separate
patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/micrel/ks8851_mll.c