2010-10-25 09:25:05

by Juuso Oikarinen

[permalink] [raw]
Subject: [PATCH] wl1271: Fix RX path stall

From: Juuso Oikarinen <[email protected]>

The wl1271_rx function loops through packets in an aggregated buffer. Each
packet in the buffer is handled by a call to wl1271_rx_handle_data, which will
fail if skb memory allocation fails or production mode is enabled. These
failures currently prevent the rx counters to be incremented, thus causing the
rx loop to run forever.

Fix this by ignoring error codes reported wl1271_rx_handle_data function.
This essentially means that frames will be dropped in production mode, which
is the intetion, and frames will be dropped if memory allocation fails, which
is a decent way to recover from that situation.

Signed-off-by: Juuso Oikarinen <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271_rx.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index 35448e7..cacfee5 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -184,10 +184,14 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status)
while (pkt_offset < buf_size) {
pkt_length = wl1271_rx_get_buf_size(status,
drv_rx_counter);
- if (wl1271_rx_handle_data(wl,
- wl->aggr_buf + pkt_offset,
- pkt_length) < 0)
- break;
+ /*
+ * the handle data call can only fail in memory-outage
+ * conditions, in that case the received frame will just
+ * be dropped.
+ */
+ wl1271_rx_handle_data(wl,
+ wl->aggr_buf + pkt_offset,
+ pkt_length);
wl->rx_counter++;
drv_rx_counter++;
drv_rx_counter &= NUM_RX_PKT_DESC_MOD_MASK;
--
1.7.0.4



2010-10-25 12:37:10

by Tuomas Katila

[permalink] [raw]
Subject: Re: [PATCH] wl1271: Fix RX path stall

On Mon, 2010-10-25 at 11:24 +0200, ext [email protected] wrote:
> From: Juuso Oikarinen <[email protected]>
>
> The wl1271_rx function loops through packets in an aggregated buffer. Each
> packet in the buffer is handled by a call to wl1271_rx_handle_data, which will
> fail if skb memory allocation fails or production mode is enabled. These
> failures currently prevent the rx counters to be incremented, thus causing the
> rx loop to run forever.
>
> Fix this by ignoring error codes reported wl1271_rx_handle_data function.
> This essentially means that frames will be dropped in production mode, which
> is the intetion, and frames will be dropped if memory allocation fails, which
> is a decent way to recover from that situation.
>
> Signed-off-by: Juuso Oikarinen <[email protected]>
> ---

Tested-by: Tuomas Katila <[email protected]>

I tested this with production mode in the scenario where it was
previously failing, and it is not getting stuck anymore.

-Tuomas



2010-10-26 10:18:25

by Luciano Coelho

[permalink] [raw]
Subject: Re: [PATCH] wl1271: Fix RX path stall

On Mon, 2010-10-25 at 11:24 +0200, [email protected] wrote:
> From: Juuso Oikarinen <[email protected]>
>
> The wl1271_rx function loops through packets in an aggregated buffer. Each
> packet in the buffer is handled by a call to wl1271_rx_handle_data, which will
> fail if skb memory allocation fails or production mode is enabled. These
> failures currently prevent the rx counters to be incremented, thus causing the
> rx loop to run forever.
>
> Fix this by ignoring error codes reported wl1271_rx_handle_data function.
> This essentially means that frames will be dropped in production mode, which
> is the intetion, and frames will be dropped if memory allocation fails, which
> is a decent way to recover from that situation.
>
> Signed-off-by: Juuso Oikarinen <[email protected]>
> ---

Reviewed-by: Luciano Coelho <[email protected]>

And applied to the wl12xx tree. Thank you!

--
Cheers,
Luca.