summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/cmd.c
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2011-08-14 13:17:20 +0300
committerLuciano Coelho <coelho@ti.com>2011-08-22 12:35:27 +0300
commit712e9bf750c5d0db63040c5695dacf38aed4f42c (patch)
tree78f168fabd8576675a31121b1911d4d9c526ad9e /drivers/net/wireless/wl12xx/cmd.c
parent3be4112cb2c53fcda85fb408aea9a6f94075683b (diff)
downloadlinux-712e9bf750c5d0db63040c5695dacf38aed4f42c.tar.gz
linux-712e9bf750c5d0db63040c5695dacf38aed4f42c.tar.bz2
linux-712e9bf750c5d0db63040c5695dacf38aed4f42c.zip
wl12xx: fix session counter
Increment the session counter on every wl12xx_cmd_role_start_sta() command. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/cmd.c')
-rw-r--r--drivers/net/wireless/wl12xx/cmd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
index c620a9d4939c..7c5d73845361 100644
--- a/drivers/net/wireless/wl12xx/cmd.c
+++ b/drivers/net/wireless/wl12xx/cmd.c
@@ -458,6 +458,16 @@ static void wl12xx_free_link(struct wl1271 *wl, u8 *hlid)
*hlid = WL12XX_INVALID_LINK_ID;
}
+static int wl12xx_get_new_session_id(struct wl1271 *wl)
+{
+ if (wl->session_counter >= SESSION_COUNTER_MAX)
+ wl->session_counter = 0;
+
+ wl->session_counter++;
+
+ return wl->session_counter;
+}
+
int wl12xx_cmd_role_start_dev(struct wl1271 *wl)
{
struct wl12xx_cmd_role_start *cmd;
@@ -580,7 +590,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl)
goto out_free;
}
cmd->sta.hlid = wl->sta_hlid;
- cmd->sta.session = wl->session_counter;
+ cmd->sta.session = wl12xx_get_new_session_id(wl);
cmd->sta.remote_rates = cpu_to_le32(wl->rate_set);
wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d "