@@ -16,6 +16,7 @@
#include <linux/clocksource.h>
#include <linux/net_tstamp.h>
#include <linux/ptp_clock_kernel.h>
+#include <linux/netpoll.h>
#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
defined(CONFIG_M520x) || defined(CONFIG_M532x) || \
@@ -509,6 +510,7 @@ struct fec_enet_private {
int speed;
struct completion mdio_done;
int irq[FEC_IRQ_NUM];
+ struct netpoll_irq_lock netpoll_locks[FEC_IRQ_NUM];
bool bufdesc_ex;
int pause_flag;
u32 quirks;
@@ -1558,6 +1558,18 @@ fec_enet_interrupt(int irq, void *dev_id)
const unsigned napi_mask = FEC_ENET_RXF | FEC_ENET_TXF;
uint int_events;
irqreturn_t ret = IRQ_NONE;
+ int i;
+ struct netpoll_irq_lock *netpoll_lock = NULL;
+
+ for (i = 0; i < FEC_IRQ_NUM; i++) {
+ if (fep->irq[i] == irq) {
+ netpoll_lock = &fep->netpoll_locks[i];
+ netpoll_irq_lock(netpoll_lock);
+ break;
+ }
+ }
+ if (!netpoll_lock)
+ return ret;
int_events = readl(fep->hwp + FEC_IEVENT);
writel(int_events & ~napi_mask, fep->hwp + FEC_IEVENT);
@@ -1579,6 +1591,7 @@ fec_enet_interrupt(int irq, void *dev_id)
if (fep->ptp_clock)
fec_ptp_check_pps_event(fep);
+ netpoll_irq_unlock(netpoll_lock);
return ret;
}
@@ -3237,6 +3250,7 @@ fec_probe(struct platform_device *pdev)
for (i = 0; i < FEC_IRQ_NUM; i++) {
irq = platform_get_irq(pdev, i);
+ netpoll_irq_lock_init(&fep->netpoll_locks[i]);
if (irq < 0) {
if (i)
break;
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@queasysnail.net> --- drivers/net/ethernet/freescale/fec.h | 2 ++ drivers/net/ethernet/freescale/fec_main.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+)