2012-12-07 13:53:02

by Cedric VONCKEN

[permalink] [raw]
Subject: [RFC] ATH9K: infinite loop in Tasklet

??????????????? Dear mailling list,
???????????????
??????????????? I think there is a possible infinite loop in ATH9K tasklet, and this loop block the linux kernel.

In my test based on freescale MPC8315 cpu, the Wireless card is bridged to Ethernet driver (Gianfar). When I receive data from Wifi (iperf -c xx -b50M) to Ethernet, the Gianfar NAPI poll function is never called because the ath_rx_tasklet always loops.

??????????????? In the ath_rx_tasklet(...), the "while" loops until ath_get_next_rx_buf() or ath_edma_get_next_rx_buf returns a buffer.

??????????????? If these functions always ?return a buffer, this tasklet always runs. While this tasklet runs, all other tasklets are blocked.
To fix it I applied this patch:

--- recv.c???????????? 2012-12-07 14:30:26.000000000 +0100
+++ recv.c.new??????????????? 2012-12-07 14:30:05.364591961 +0100
@@ -1067,6 +1067,7 @@
?????????????? u64 tsf = 0;
?????????????? u32 tsf_lower = 0;
?????????????? unsigned long flags;
+???????????? int count = 150;

??????????????? if (edma)
????????????????????????????? dma_type = DMA_BIDIRECTIONAL;
@@ -1085,6 +1086,10 @@
????????????????????????????? if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags) && (flush == 0))
????????????????????????????????????????????? break;

+???????????????????????????? if(count <= 0)
+??????????????????????????????????????????? break;
+
+???????????????????????????? count --;
????????????????????????????? memset(&rs, 0, sizeof(rs));
????????????????????????????? if (edma)
????????????????????????????????????????????? bf = ath_edma_get_next_rx_buf(sc, &rs, qtype);

I think this solution is not correct, because the tasklet is not rescheduled and we always have data in Rx buffer.

??????????????? Have you any suggestion to fix this issue correctly?

??????????????? Thanks for your help.

??????????????? Best regards.