ath6kl: Export beacon interval and DTIM period through STA info
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 19 Sep 2011 16:15:07 +0000 (19:15 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 22 Sep 2011 07:08:00 +0000 (10:08 +0300)
Now that we allow the first Beacon frame after each connection to
be processed at the host, we can figure out the DTIM period and
expose it with Beacon interval through STA info BSS parameters
to user space.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/ath6kl/core.h
drivers/net/wireless/ath/ath6kl/wmi.c

index 0bdd837d6121b3b1b500c15fb440ac36c94bc95f..c3540bbfcac638386f6fbf1f41ed77870cdee613 100644 (file)
@@ -483,6 +483,13 @@ void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel,
        assoc_req_len -= assoc_req_ie_offset;
        assoc_resp_len -= assoc_resp_ie_offset;
 
+       /*
+        * Store Beacon interval here; DTIM period will be available only once
+        * a Beacon frame from the AP is seen.
+        */
+       ar->assoc_bss_beacon_int = beacon_intvl;
+       clear_bit(DTIM_PERIOD_AVAIL, &ar->flag);
+
        if (nw_type & ADHOC_NETWORK) {
                if (ar->wdev->iftype != NL80211_IFTYPE_ADHOC) {
                        ath6kl_dbg(ATH6KL_DBG_WLAN_CFG,
@@ -1366,6 +1373,15 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev,
 
        sinfo->filled |= STATION_INFO_TX_BITRATE;
 
+       if (test_bit(CONNECTED, &ar->flag) &&
+           test_bit(DTIM_PERIOD_AVAIL, &ar->flag) &&
+           ar->nw_type == INFRA_NETWORK) {
+               sinfo->filled |= STATION_INFO_BSS_PARAM;
+               sinfo->bss_param.flags = 0;
+               sinfo->bss_param.dtim_period = ar->assoc_bss_dtim_period;
+               sinfo->bss_param.beacon_interval = ar->assoc_bss_beacon_int;
+       }
+
        return 0;
 }
 
index c14bb75d3614fc44358f17ebba44012351901e1d..82be42f5edc856c2544bf940e169bbf2d9cf6a9f 100644 (file)
@@ -395,6 +395,7 @@ struct ath6kl_req_key {
 #define WLAN_ENABLED        12
 #define TESTMODE            13
 #define CLEAR_BSSFILTER_ON_BEACON 14
+#define DTIM_PERIOD_AVAIL    15
 
 struct ath6kl {
        struct device *dev;
@@ -511,6 +512,8 @@ struct ath6kl {
        u16 next_chan;
 
        bool p2p;
+       u16 assoc_bss_beacon_int;
+       u8 assoc_bss_dtim_period;
 
 #ifdef CONFIG_ATH6KL_DEBUG
        struct {
index f7dcb56ab3543086da4a5a51ae7d39430da943e1..b90d116c018ce1f554217fa698e2815f38c5fbf0 100644 (file)
@@ -930,6 +930,17 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len)
        if (len < 8 + 2 + 2)
                return -EINVAL;
 
+       if (bih->frame_type == BEACON_FTYPE && test_bit(CONNECTED, &ar->flag) &&
+           memcmp(bih->bssid, ar->bssid, ETH_ALEN) == 0) {
+               const u8 *tim;
+               tim = cfg80211_find_ie(WLAN_EID_TIM, buf + 8 + 2 + 2,
+                                      len - 8 - 2 - 2);
+               if (tim && tim[1] >= 2) {
+                       ar->assoc_bss_dtim_period = tim[3];
+                       set_bit(DTIM_PERIOD_AVAIL, &ar->flag);
+               }
+       }
+
        /*
         * In theory, use of cfg80211_inform_bss() would be more natural here
         * since we do not have the full frame. However, at least for now,