• Marek Vasut's avatar
    net: ks8851-ml: Fix IRQ handling and locking · 44343418
    Marek Vasut authored
    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: default avatarMarek 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: default avatarDavid S. Miller <davem@davemloft.net>
    44343418
ks8851_mll.c 32.9 KB