[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1418135842-21389-9-git-send-email-sd@queasysnail.net>
Date: Tue, 9 Dec 2014 15:37:19 +0100
From: Sabrina Dubroca <sd@...asysnail.net>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org, Sabrina Dubroca <sd@...asysnail.net>,
Michal Simek <michal.simek@...inx.com>,
Sören Brinkmann <soren.brinkmann@...inx.com>
Subject: [RFC PATCH net-next 08/11] ll_temac: remove disable_irq from netpoll controller, use netpoll_irq_lock
disable_irq() may sleep, replace it with a spin_lock in the interrupt
handler and netpoll controller.
No actual testing done, only compiled.
Signed-off-by: Sabrina Dubroca <sd@...asysnail.net>
Cc: Michal Simek <michal.simek@...inx.com>
Cc: "Sören Brinkmann" <soren.brinkmann@...inx.com>
---
drivers/net/ethernet/xilinx/ll_temac.h | 3 +++
drivers/net/ethernet/xilinx/ll_temac_main.c | 13 +++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/ll_temac.h b/drivers/net/ethernet/xilinx/ll_temac.h
index 522abe2ff25a..09906958a689 100644
--- a/drivers/net/ethernet/xilinx/ll_temac.h
+++ b/drivers/net/ethernet/xilinx/ll_temac.h
@@ -3,6 +3,7 @@
#define XILINX_LL_TEMAC_H
#include <linux/netdevice.h>
+#include <linux/netpoll.h>
#include <linux/of.h>
#include <linux/spinlock.h>
@@ -368,6 +369,8 @@ struct temac_local {
int tx_bd_next;
int tx_bd_tail;
int rx_bd_ci;
+
+ struct netpoll_irq_lock netpoll_lock;
};
/* xilinx_temac.c */
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 9c2d91ea0af4..37c3f9588208 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -815,6 +815,7 @@ static irqreturn_t ll_temac_tx_irq(int irq, void *_ndev)
struct temac_local *lp = netdev_priv(ndev);
unsigned int status;
+ netpoll_irq_lock(&lp->netpoll_lock);
status = lp->dma_in(lp, TX_IRQ_REG);
lp->dma_out(lp, TX_IRQ_REG, status);
@@ -823,6 +824,8 @@ static irqreturn_t ll_temac_tx_irq(int irq, void *_ndev)
if (status & 0x080)
dev_err(&ndev->dev, "DMA error 0x%x\n", status);
+ netpoll_irq_unlock(&lp->netpoll_lock);
+
return IRQ_HANDLED;
}
@@ -832,6 +835,7 @@ static irqreturn_t ll_temac_rx_irq(int irq, void *_ndev)
struct temac_local *lp = netdev_priv(ndev);
unsigned int status;
+ netpoll_irq_lock(&lp->netpoll_lock);
/* Read and clear the status registers */
status = lp->dma_in(lp, RX_IRQ_REG);
lp->dma_out(lp, RX_IRQ_REG, status);
@@ -839,6 +843,8 @@ static irqreturn_t ll_temac_rx_irq(int irq, void *_ndev)
if (status & (IRQ_COAL | IRQ_DLY))
ll_temac_recv(lp->ndev);
+ netpoll_irq_unlock(&lp->netpoll_lock);
+
return IRQ_HANDLED;
}
@@ -905,14 +911,8 @@ temac_poll_controller(struct net_device *ndev)
{
struct temac_local *lp = netdev_priv(ndev);
- disable_irq(lp->tx_irq);
- disable_irq(lp->rx_irq);
-
ll_temac_rx_irq(lp->tx_irq, ndev);
ll_temac_tx_irq(lp->rx_irq, ndev);
-
- enable_irq(lp->tx_irq);
- enable_irq(lp->rx_irq);
}
#endif
@@ -1037,6 +1037,7 @@ static int temac_of_probe(struct platform_device *op)
lp->dev = &op->dev;
lp->options = XTE_OPTION_DEFAULTS;
spin_lock_init(&lp->rx_lock);
+ netpoll_irq_lock_init(&lp->netpoll_lock);
mutex_init(&lp->indirect_mutex);
/* map device registers */
--
2.1.3
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists