mwifiex: update correct dtim_period in dump_station()
authorAmitkumar Karwar <akarwar@marvell.com>
Fri, 3 Feb 2012 04:48:58 +0000 (20:48 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 6 Feb 2012 19:55:54 +0000 (14:55 -0500)
Earlier we were using dtim period extracted from scan response
buffer provided by FW in scan operation. But it is observed that
sometimes the buffer doesn't contain dtim period tlv, and wrong
value (0) was sent to user space.

After association FW will start listening to beacon frames of
connected AP and store dtim period. Therefore we can get it from
FW in dump_station() instead of using wrong value obtained in
scanning.

Redundant code after adapting new approach for dtim period is
also removed in this patch.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/scan.c
drivers/net/wireless/mwifiex/sta_cmdresp.c

index 54e45c829c5399eea18c60996c9e5dc2ac3f7992..478d2f12c0244863cde480678c50b198791f0912 100644 (file)
@@ -539,6 +539,11 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
                ret = -EFAULT;
        }
 
+       /* Get DTIM period information from firmware */
+       mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
+                             HostCmd_ACT_GEN_GET, DTIM_PERIOD_I,
+                             &priv->dtim_period);
+
        /*
         * Bit 0 in tx_htinfo indicates that current Tx rate is 11n rate. Valid
         * MCS index values for us are 0 to 7.
@@ -573,8 +578,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
                                                WLAN_CAPABILITY_SHORT_SLOT_TIME)
                        sinfo->bss_param.flags |=
                                        BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
-               sinfo->bss_param.dtim_period =
-                       priv->curr_bss_params.bss_descriptor.dtim_period;
+               sinfo->bss_param.dtim_period = priv->dtim_period;
                sinfo->bss_param.beacon_interval =
                        priv->curr_bss_params.bss_descriptor.beacon_period;
        }
index 3dc0f721c1db7590bffe85bdb837df32eabda834..52810b1497eadbf1718ebc2b24c466c5f8c841db 100644 (file)
@@ -249,7 +249,6 @@ struct mwifiex_bssdescriptor {
        u32 channel;
        u32 freq;
        u16 beacon_period;
-       u8 dtim_period;
        u8 erp_flags;
        u32 bss_mode;
        u8 supported_rates[MWIFIEX_SUPPORTED_RATES];
@@ -392,6 +391,7 @@ struct mwifiex_private {
        u8 prev_bssid[ETH_ALEN];
        struct mwifiex_current_bss_params curr_bss_params;
        u16 beacon_period;
+       u8 dtim_period;
        u16 listen_interval;
        u16 atim_window;
        u8 adhoc_channel;
index 135208596afff16cb272b7c9519ea7543c284747..98f1ca9cd6d862cb4169d465c8a20db7d4b202b6 100644 (file)
@@ -1086,7 +1086,6 @@ mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
        struct ieee_types_vendor_specific *vendor_ie;
        const u8 wpa_oui[4] = { 0x00, 0x50, 0xf2, 0x01 };
        const u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 };
-       struct ieee80211_tim_ie *tim_ie;
 
        found_data_rate_ie = false;
        rate_size = 0;
@@ -1259,11 +1258,6 @@ mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
                                        sizeof(struct ieee_types_header) -
                                        bss_entry->beacon_buf);
                        break;
-               case WLAN_EID_TIM:
-                       tim_ie = (void *) (current_ptr +
-                                        sizeof(struct ieee_types_header));
-                       bss_entry->dtim_period = tim_ie->dtim_period;
-                       break;
                default:
                        break;
                }
index e812db8b695cabdfa294c19d9ab08e92b4cb88b7..0d8618a8443fb8bf007b8db85be3367ffde57aa6 100644 (file)
@@ -210,6 +210,9 @@ static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv,
                        dev_dbg(priv->adapter->dev,
                                "info: SNMP_RESP: TxRetryCount=%u\n", ul_temp);
                        break;
+               case DTIM_PERIOD_I:
+                       dev_dbg(priv->adapter->dev,
+                               "info: SNMP_RESP: DTIM period=%u\n", ul_temp);
                default:
                        break;
                }