wl12xx: fix session counter
authorArik Nemtsov <arik@wizery.com>
Sun, 14 Aug 2011 10:17:20 +0000 (13:17 +0300)
committerLuciano Coelho <coelho@ti.com>
Mon, 22 Aug 2011 09:35:27 +0000 (12:35 +0300)
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>
drivers/net/wireless/wl12xx/cmd.c
drivers/net/wireless/wl12xx/main.c

index c620a9d4939c80a21c605b67e3d057e618de120b..7c5d7384536114c7293c540b38ee75188abdb0b3 100644 (file)
@@ -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 "
index 1774a66723144edecb678c57de7465c65e3dc248..157c46237d9f9b894447e64b187039b91cef9ecd 100644 (file)
@@ -2187,11 +2187,6 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, bool idle)
                        goto out;
                set_bit(WL1271_FLAG_IDLE, &wl->flags);
        } else {
-               /* increment the session counter */
-               wl->session_counter++;
-               if (wl->session_counter >= SESSION_COUNTER_MAX)
-                       wl->session_counter = 0;
-
                /* The current firmware only supports sched_scan in idle */
                if (wl->sched_scanning) {
                        wl1271_scan_sched_scan_stop(wl);
@@ -4453,6 +4448,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
        wl->sta_hlid = WL12XX_INVALID_LINK_ID;
        wl->dev_role_id = WL12XX_INVALID_ROLE_ID;
        wl->dev_hlid = WL12XX_INVALID_LINK_ID;
+       wl->session_counter = 0;
        setup_timer(&wl->rx_streaming_timer, wl1271_rx_streaming_timer,
                    (unsigned long) wl);
        wl->fwlog_size = 0;