enic: use napi_schedule_irqoff()
Subsystems (3)
PATCH 1/2 enic: use napi_schedule_irqoff()
enic_isr_legacy(), enic_isr_msix() & enic_isr_msi() run from hard interrupt context.
They can use napi_schedule_irqoff() instead of napi_schedule()
Signed-off-by Govindarajulu Varadarajan <[email protected]>
--- drivers/net/ethernet/cisco/enic/enic_main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +5 -7
@@ -283,12 +283,10 @@ static irqreturn_t enic_isr_legacy(int irq, void *data)return IRQ_HANDLED ; } -if (ENIC_TEST_INTR (pba, io_intr)) { -if (napi_schedule_prep (&enic->napi[0 ])) -__napi_schedule (&enic->napi[0 ]); - }else { +if (ENIC_TEST_INTR (pba, io_intr)) +napi_schedule_irqoff (&enic->napi[0 ]); +else vnic_intr_unmask (&enic->intr[io_intr]); - }return IRQ_HANDLED ; }
@@ -313,7 +311,7 @@ static irqreturn_t enic_isr_msi(int irq, void *data)* writes). */ -napi_schedule (&enic->napi[0 ]); +napi_schedule_irqoff (&enic->napi[0 ]);return IRQ_HANDLED ; }
@@ -322,7 +320,7 @@ static irqreturn_t enic_isr_msix(int irq, void *data) {struct napi_struct *napi = data; -napi_schedule (napi); +napi_schedule_irqoff (napi);return IRQ_HANDLED ; }
Signature · 1 line
2.1.0
PATCH 2/2 enic: use spin_lock(wq_lock) instead of spin_lock_irqsave(wq_lock)
All the access to wq has been moved out of hardirq context. We no longer need to use spin_lock_irqsave.
Signed-off-by Govindarajulu Varadarajan <[email protected]>
--- drivers/net/ethernet/cisco/enic/enic_main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +3 -4
@@ -529,7 +529,6 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb, {struct enic *enic =netdev_priv (netdev);struct vnic_wq *wq; -unsigned long flags;unsigned int txq_map;struct netdev_queue *txq;
@@ -554,14 +553,14 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,return NETDEV_TX_OK ; } -spin_lock_irqsave (&enic->wq_lock[txq_map], flags); +spin_lock (&enic->wq_lock[txq_map]);if (vnic_wq_desc_avail (wq) <skb_shinfo (skb)->nr_frags +ENIC_DESC_MAX_SPLITS ) {netif_tx_stop_queue (txq);/* This is a hard error, log it */ netdev_err (netdev,"BUG! Tx ring full when queue awake!\n" ); -spin_unlock_irqrestore (&enic->wq_lock[txq_map], flags); +spin_unlock (&enic->wq_lock[txq_map]);return NETDEV_TX_BUSY ; }
@@ -572,7 +571,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,if (!skb->xmit_more ||netif_xmit_stopped (txq))vnic_wq_doorbell (wq); -spin_unlock_irqrestore (&enic->wq_lock[txq_map], flags); +spin_unlock (&enic->wq_lock[txq_map]);return NETDEV_TX_OK ; }
Signature · 1 line
2.1.0