Message ID | 20250121221519.392014-3-kuba@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | eth: fix calling napi_enable() in atomic context | expand |
On Tue, Jan 21, 2025 at 11:15 PM Jakub Kicinski <kuba@kernel.org> wrote: > > The local helpers for calling napi_enable() and napi_disable() > don't serve much purpose and they will complicate the fix in > the subsequent patch. Remove them, call the core functions > directly. > > Signed-off-by: Jakub Kicinski <kuba@kernel.org> I am fine with this. Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com> Zhu Yanjun > --- > CC: rain.1986.08.12@gmail.com > CC: zyjzyj2000@gmail.com > --- > drivers/net/ethernet/nvidia/forcedeth.c | 30 +++++++------------------ > 1 file changed, 8 insertions(+), 22 deletions(-) > > diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c > index 720f577929db..b00df57f2ca3 100644 > --- a/drivers/net/ethernet/nvidia/forcedeth.c > +++ b/drivers/net/ethernet/nvidia/forcedeth.c > @@ -1120,20 +1120,6 @@ static void nv_disable_hw_interrupts(struct net_device *dev, u32 mask) > } > } > > -static void nv_napi_enable(struct net_device *dev) > -{ > - struct fe_priv *np = get_nvpriv(dev); > - > - napi_enable(&np->napi); > -} > - > -static void nv_napi_disable(struct net_device *dev) > -{ > - struct fe_priv *np = get_nvpriv(dev); > - > - napi_disable(&np->napi); > -} > - > #define MII_READ (-1) > /* mii_rw: read/write a register on the PHY. > * > @@ -3114,7 +3100,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu) > * Changing the MTU is a rare event, it shouldn't matter. > */ > nv_disable_irq(dev); > - nv_napi_disable(dev); > + napi_disable(&np->napi); > netif_tx_lock_bh(dev); > netif_addr_lock(dev); > spin_lock(&np->lock); > @@ -3143,7 +3129,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu) > spin_unlock(&np->lock); > netif_addr_unlock(dev); > netif_tx_unlock_bh(dev); > - nv_napi_enable(dev); > + napi_enable(&np->napi); > nv_enable_irq(dev); > } > return 0; > @@ -4731,7 +4717,7 @@ static int nv_set_ringparam(struct net_device *dev, > > if (netif_running(dev)) { > nv_disable_irq(dev); > - nv_napi_disable(dev); > + napi_disable(&np->napi); > netif_tx_lock_bh(dev); > netif_addr_lock(dev); > spin_lock(&np->lock); > @@ -4784,7 +4770,7 @@ static int nv_set_ringparam(struct net_device *dev, > spin_unlock(&np->lock); > netif_addr_unlock(dev); > netif_tx_unlock_bh(dev); > - nv_napi_enable(dev); > + napi_enable(&np->napi); > nv_enable_irq(dev); > } > return 0; > @@ -5277,7 +5263,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64 > if (test->flags & ETH_TEST_FL_OFFLINE) { > if (netif_running(dev)) { > netif_stop_queue(dev); > - nv_napi_disable(dev); > + napi_disable(&np->napi); > netif_tx_lock_bh(dev); > netif_addr_lock(dev); > spin_lock_irq(&np->lock); > @@ -5334,7 +5320,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64 > /* restart rx engine */ > nv_start_rxtx(dev); > netif_start_queue(dev); > - nv_napi_enable(dev); > + napi_enable(&np->napi); > nv_enable_hw_interrupts(dev, np->irqmask); > } > } > @@ -5594,7 +5580,7 @@ static int nv_open(struct net_device *dev) > ret = nv_update_linkspeed(dev); > nv_start_rxtx(dev); > netif_start_queue(dev); > - nv_napi_enable(dev); > + napi_enable(&np->napi); > > if (ret) { > netif_carrier_on(dev); > @@ -5632,7 +5618,7 @@ static int nv_close(struct net_device *dev) > spin_lock_irq(&np->lock); > np->in_shutdown = 1; > spin_unlock_irq(&np->lock); > - nv_napi_disable(dev); > + napi_disable(&np->napi); > synchronize_irq(np->pci_dev->irq); > > del_timer_sync(&np->oom_kick); > -- > 2.48.1 >
On Tue, Jan 21, 2025 at 11:15 PM Jakub Kicinski <kuba@kernel.org> wrote: > > The local helpers for calling napi_enable() and napi_disable() > don't serve much purpose and they will complicate the fix in > the subsequent patch. Remove them, call the core functions > directly. > > Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com>
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 720f577929db..b00df57f2ca3 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c @@ -1120,20 +1120,6 @@ static void nv_disable_hw_interrupts(struct net_device *dev, u32 mask) } } -static void nv_napi_enable(struct net_device *dev) -{ - struct fe_priv *np = get_nvpriv(dev); - - napi_enable(&np->napi); -} - -static void nv_napi_disable(struct net_device *dev) -{ - struct fe_priv *np = get_nvpriv(dev); - - napi_disable(&np->napi); -} - #define MII_READ (-1) /* mii_rw: read/write a register on the PHY. * @@ -3114,7 +3100,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu) * Changing the MTU is a rare event, it shouldn't matter. */ nv_disable_irq(dev); - nv_napi_disable(dev); + napi_disable(&np->napi); netif_tx_lock_bh(dev); netif_addr_lock(dev); spin_lock(&np->lock); @@ -3143,7 +3129,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu) spin_unlock(&np->lock); netif_addr_unlock(dev); netif_tx_unlock_bh(dev); - nv_napi_enable(dev); + napi_enable(&np->napi); nv_enable_irq(dev); } return 0; @@ -4731,7 +4717,7 @@ static int nv_set_ringparam(struct net_device *dev, if (netif_running(dev)) { nv_disable_irq(dev); - nv_napi_disable(dev); + napi_disable(&np->napi); netif_tx_lock_bh(dev); netif_addr_lock(dev); spin_lock(&np->lock); @@ -4784,7 +4770,7 @@ static int nv_set_ringparam(struct net_device *dev, spin_unlock(&np->lock); netif_addr_unlock(dev); netif_tx_unlock_bh(dev); - nv_napi_enable(dev); + napi_enable(&np->napi); nv_enable_irq(dev); } return 0; @@ -5277,7 +5263,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64 if (test->flags & ETH_TEST_FL_OFFLINE) { if (netif_running(dev)) { netif_stop_queue(dev); - nv_napi_disable(dev); + napi_disable(&np->napi); netif_tx_lock_bh(dev); netif_addr_lock(dev); spin_lock_irq(&np->lock); @@ -5334,7 +5320,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64 /* restart rx engine */ nv_start_rxtx(dev); netif_start_queue(dev); - nv_napi_enable(dev); + napi_enable(&np->napi); nv_enable_hw_interrupts(dev, np->irqmask); } } @@ -5594,7 +5580,7 @@ static int nv_open(struct net_device *dev) ret = nv_update_linkspeed(dev); nv_start_rxtx(dev); netif_start_queue(dev); - nv_napi_enable(dev); + napi_enable(&np->napi); if (ret) { netif_carrier_on(dev); @@ -5632,7 +5618,7 @@ static int nv_close(struct net_device *dev) spin_lock_irq(&np->lock); np->in_shutdown = 1; spin_unlock_irq(&np->lock); - nv_napi_disable(dev); + napi_disable(&np->napi); synchronize_irq(np->pci_dev->irq); del_timer_sync(&np->oom_kick);
The local helpers for calling napi_enable() and napi_disable() don't serve much purpose and they will complicate the fix in the subsequent patch. Remove them, call the core functions directly. Signed-off-by: Jakub Kicinski <kuba@kernel.org> --- CC: rain.1986.08.12@gmail.com CC: zyjzyj2000@gmail.com --- drivers/net/ethernet/nvidia/forcedeth.c | 30 +++++++------------------ 1 file changed, 8 insertions(+), 22 deletions(-)