df2a6e9448c5521c59556e1e48c5c4f1946bb62a
[openwrt/staging/adrian.git] /
1 zero rx_filter_enabled array after recovery to avoid
2 cases were the driver will keep trying to clear a
3 filter which is not configured in FW.
4
5 Such case will cause consecutive recoveries due to
6 command execution failures.
7
8 While on it, convert rx_filter_enabled to bitmap,
9 to save some memory and make sparse happy (it
10 doesn't like sizeof(bool array)).
11
12 Signed-off-by: Nadim Zubidat <nadimz@ti.com>
13 Signed-off-by: Eliad Peller <eliad@wizery.com>
14
15 ---
16 drivers/net/wireless/ti/wlcore/main.c | 1 +
17 drivers/net/wireless/ti/wlcore/rx.c | 9 ++++++---
18 drivers/net/wireless/ti/wlcore/wlcore.h | 2 +-
19 3 files changed, 8 insertions(+), 4 deletions(-)
20
21 --- a/drivers/net/wireless/ti/wlcore/main.c
22 +++ b/drivers/net/wireless/ti/wlcore/main.c
23 @@ -1914,6 +1914,7 @@ static void wlcore_op_stop_locked(struct
24 memset(wl->links_map, 0, sizeof(wl->links_map));
25 memset(wl->roc_map, 0, sizeof(wl->roc_map));
26 memset(wl->session_ids, 0, sizeof(wl->session_ids));
27 + memset(wl->rx_filter_enabled, 0, sizeof(wl->rx_filter_enabled));
28 wl->active_sta_count = 0;
29 wl->active_link_count = 0;
30
31 --- a/drivers/net/wireless/ti/wlcore/rx.c
32 +++ b/drivers/net/wireless/ti/wlcore/rx.c
33 @@ -302,7 +302,7 @@ int wl1271_rx_filter_enable(struct wl127
34 {
35 int ret;
36
37 - if (wl->rx_filter_enabled[index] == enable) {
38 + if (!!test_bit(index, wl->rx_filter_enabled) == enable) {
39 wl1271_warning("Request to enable an already "
40 "enabled rx filter %d", index);
41 return 0;
42 @@ -316,7 +316,10 @@ int wl1271_rx_filter_enable(struct wl127
43 return ret;
44 }
45
46 - wl->rx_filter_enabled[index] = enable;
47 + if (enable)
48 + __set_bit(index, wl->rx_filter_enabled);
49 + else
50 + __clear_bit(index, wl->rx_filter_enabled);
51
52 return 0;
53 }
54 @@ -326,7 +329,7 @@ int wl1271_rx_filter_clear_all(struct wl
55 int i, ret = 0;
56
57 for (i = 0; i < WL1271_MAX_RX_FILTERS; i++) {
58 - if (!wl->rx_filter_enabled[i])
59 + if (!test_bit(i, wl->rx_filter_enabled))
60 continue;
61 ret = wl1271_rx_filter_enable(wl, i, 0, NULL);
62 if (ret)
63 --- a/drivers/net/wireless/ti/wlcore/wlcore.h
64 +++ b/drivers/net/wireless/ti/wlcore/wlcore.h
65 @@ -453,7 +453,7 @@ struct wl1271 {
66 size_t fw_status_priv_len;
67
68 /* RX Data filter rule state - enabled/disabled */
69 - bool rx_filter_enabled[WL1271_MAX_RX_FILTERS];
70 + unsigned long rx_filter_enabled[BITS_TO_LONGS(WL1271_MAX_RX_FILTERS)];
71
72 /* size of the private static data */
73 size_t static_data_priv_len;