Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wlcore: memset wl->rx_filter_enabled to zero after recovery

zero rx_filter_enabled array after recovery to avoid
cases were the driver will keep trying to clear a
filter which is not configured in FW.

Such case will cause consecutive recoveries due to
command execution failures.

While on it, convert rx_filter_enabled to bitmap,
to save some memory and make sparse happy (it
doesn't like sizeof(bool array)).

Signed-off-by: Nadim Zubidat <nadimz@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Nadim Zubidat and committed by
John W. Linville
02d0727c bb6bd25c

+8 -4
+1
drivers/net/wireless/ti/wlcore/main.c
··· 1914 1914 memset(wl->links_map, 0, sizeof(wl->links_map)); 1915 1915 memset(wl->roc_map, 0, sizeof(wl->roc_map)); 1916 1916 memset(wl->session_ids, 0, sizeof(wl->session_ids)); 1917 + memset(wl->rx_filter_enabled, 0, sizeof(wl->rx_filter_enabled)); 1917 1918 wl->active_sta_count = 0; 1918 1919 wl->active_link_count = 0; 1919 1920
+6 -3
drivers/net/wireless/ti/wlcore/rx.c
··· 302 302 { 303 303 int ret; 304 304 305 - if (wl->rx_filter_enabled[index] == enable) { 305 + if (!!test_bit(index, wl->rx_filter_enabled) == enable) { 306 306 wl1271_warning("Request to enable an already " 307 307 "enabled rx filter %d", index); 308 308 return 0; ··· 316 316 return ret; 317 317 } 318 318 319 - wl->rx_filter_enabled[index] = enable; 319 + if (enable) 320 + __set_bit(index, wl->rx_filter_enabled); 321 + else 322 + __clear_bit(index, wl->rx_filter_enabled); 320 323 321 324 return 0; 322 325 } ··· 329 326 int i, ret = 0; 330 327 331 328 for (i = 0; i < WL1271_MAX_RX_FILTERS; i++) { 332 - if (!wl->rx_filter_enabled[i]) 329 + if (!test_bit(i, wl->rx_filter_enabled)) 333 330 continue; 334 331 ret = wl1271_rx_filter_enable(wl, i, 0, NULL); 335 332 if (ret)
+1 -1
drivers/net/wireless/ti/wlcore/wlcore.h
··· 451 451 size_t fw_status_priv_len; 452 452 453 453 /* RX Data filter rule state - enabled/disabled */ 454 - bool rx_filter_enabled[WL1271_MAX_RX_FILTERS]; 454 + unsigned long rx_filter_enabled[BITS_TO_LONGS(WL1271_MAX_RX_FILTERS)]; 455 455 456 456 /* size of the private static data */ 457 457 size_t static_data_priv_len;