aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/cns3xxx/files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-03-10 18:25:16 +0000
committerFelix Fietkau <nbd@openwrt.org>2013-03-10 18:25:16 +0000
commit5dab5bf10c848aa900b7651c0dac0c5886b41f76 (patch)
tree6908d911e675e9dd651f1bdb3b0cb02e15b8f420 /target/linux/cns3xxx/files
parent275672c3c968a451c4cf1199eec1245d26302da8 (diff)
downloadupstream-5dab5bf10c848aa900b7651c0dac0c5886b41f76.tar.gz
upstream-5dab5bf10c848aa900b7651c0dac0c5886b41f76.tar.bz2
upstream-5dab5bf10c848aa900b7651c0dac0c5886b41f76.zip
cns3xxx: fix an rx irq handling corner case
When an rx interrupt comes in, rx interrupts are disabled and NAPI polling is scheduled. During the NAPI poll, the driver first processes received frames in the ring, then fills the dma descriptor slots with new buffers and calls tx complete, before finally re-enabling rx interrupts and completing NAPI (if below the budget). If the hardware rx queue overflows before the napi complete is called, the hardware will not throw any further rx interrupts and rx processing stops completely. Fix this by keeping NAPI polling scheduled until it completes a poll without receiving any packets, and also handle NAPI completion before refilling rx or completing tx. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35942 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/cns3xxx/files')
-rw-r--r--target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
index 7ffff684de..7309d9ea77 100644
--- a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
+++ b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
@@ -706,15 +706,15 @@ static int eth_poll(struct napi_struct *napi, int budget)
}
}
- cns3xxx_alloc_rx_buf(sw, received);
-
- rx_ring->cur_index = i;
-
- if (received != budget) {
+ if (!received) {
napi_complete(napi);
enable_irq(IRQ_CNS3XXX_SW_R0RXC);
}
+ cns3xxx_alloc_rx_buf(sw, received);
+
+ rx_ring->cur_index = i;
+
wmb();
enable_rx_dma(sw);