Commit 0b0e32b7 authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho

wl12xx: change bits in the link_map under spin lock

These bits are used in op_tx to determine if a packet should be dropped.
As such we should use the spin lock to sync the state.
Signed-off-by: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 5af70c86
...@@ -459,23 +459,32 @@ int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id) ...@@ -459,23 +459,32 @@ int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id)
int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid) int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
{ {
unsigned long flags;
u8 link = find_first_zero_bit(wl->links_map, WL12XX_MAX_LINKS); u8 link = find_first_zero_bit(wl->links_map, WL12XX_MAX_LINKS);
if (link >= WL12XX_MAX_LINKS) if (link >= WL12XX_MAX_LINKS)
return -EBUSY; return -EBUSY;
/* these bits are used by op_tx */
spin_lock_irqsave(&wl->wl_lock, flags);
__set_bit(link, wl->links_map); __set_bit(link, wl->links_map);
__set_bit(link, wlvif->links_map); __set_bit(link, wlvif->links_map);
spin_unlock_irqrestore(&wl->wl_lock, flags);
*hlid = link; *hlid = link;
return 0; return 0;
} }
void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid) void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
{ {
unsigned long flags;
if (*hlid == WL12XX_INVALID_LINK_ID) if (*hlid == WL12XX_INVALID_LINK_ID)
return; return;
/* these bits are used by op_tx */
spin_lock_irqsave(&wl->wl_lock, flags);
__clear_bit(*hlid, wl->links_map); __clear_bit(*hlid, wl->links_map);
__clear_bit(*hlid, wlvif->links_map); __clear_bit(*hlid, wlvif->links_map);
spin_unlock_irqrestore(&wl->wl_lock, flags);
*hlid = WL12XX_INVALID_LINK_ID; *hlid = WL12XX_INVALID_LINK_ID;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment