• Vignesh Raghavendra's avatar
    net: ti: am65-cpsw-nuss: fix RX IRQ state after .ndo_stop() · 47bfc4d1
    Vignesh Raghavendra authored
    On TI K3 am64x platform the issue with RX IRQ is observed - it's become
    disabled forever after .ndo_stop(). The K3 CPSW driver manipulates RX IRQ
    by using standard Linux enable_irq()/disable_irq_nosync() API as there is
    no IRQ enable/disable options in CPSW HW itself, as result during
    .ndo_stop() following sequence happens
    
      phy_stop()
      teardown TX/RX channels
      wait for TX tdown complete
      napi_disable(TX)
      clean up TX channels
    
      (a)
    
      napi_disable(RX)
    
    At point (a) it's not possible to predict if RX IRQ was triggered or not.
    if RX IRQ was triggered then it also not possible to definitely say if RX
    NAPI was run or only scheduled and immediately canceled by
    napi_disable(RX). Actually the last case causes RX IRQ to be permanently
    disabled.
    
    Another observed issue is that RX IRQ enable counter become unbalanced if
    (gro_flush_timeout =! 0) while (napi_defer_hard_irqs == 0):
    
    Unbalanced enable for IRQ 44
    WARNING: CPU: 0 PID: 10 at ../kernel/irq/manage.c:776 __enable_irq+0x38/0x80
    __enable_irq+0x38/0x80
    enable_irq+0x54/0xb0
    am65_cpsw_nuss_rx_poll+0x2f4/0x368
    __napi_poll+0x34/0x1b8
    net_rx_action+0xe4/0x220
    _stext+0x11c/0x284
    run_ksoftirqd+0x4c/0x60
    
    To avoid above issues introduce flag indicating if RX was actually disabled
    before enabling it in am65_cpsw_nuss_rx_poll() and restore RX IRQ state in
    .ndo_open()
    
    Fixes: 4f7cce27 ("net: ethernet: ti: am65-cpsw: add support for am64x cpsw3g")
    Signed-off-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
    Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    47bfc4d1
am65-cpsw-nuss.h 4.53 KB