]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
mac80211: Add DS Parameter Set into Probe Request on 2.4 GHz
authorJouni Malinen <j@w1.fi>
Sat, 28 Aug 2010 16:37:51 +0000 (19:37 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 24 Sep 2010 19:54:28 +0000 (15:54 -0400)
IEEE Std 802.11k-2008 added DS Parameter Set information element into
Probe Request frames as an optional information on 2.4 GHz band (and
mandatory, if radio measurements are enabled). This allows APs to
filter out Probe Request frames that may be received from neighboring
overlapping channels and by doing so, reduce the number of unnecessary
frames in the air. Make mac80211 add this IE into Probe Request frames
whenever the channel is known (i.e., whenever hwscan is not used).

Signed-off-by: Jouni Malinen <j@w1.fi>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/ieee80211_i.h
net/mac80211/scan.c
net/mac80211/util.c

index 3641563d90f8b5d77348176c5226243c02cd1f15..78a8d9208cecfd342277e90b92d3323f37d1f1ac 100644 (file)
@@ -1256,7 +1256,8 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
                         const u8 *key, u8 key_len, u8 key_idx);
 int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
                             const u8 *ie, size_t ie_len,
-                            enum ieee80211_band band, u32 rate_mask);
+                            enum ieee80211_band band, u32 rate_mask,
+                            u8 channel);
 void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
                              const u8 *ssid, size_t ssid_len,
                              const u8 *ie, size_t ie_len);
index 1623e9d2086e66ea5461ed36f60ed2a0b42f5adc..5171a95816312466afc085fe26ebcd871fa4c9ce 100644 (file)
@@ -242,7 +242,8 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local)
        local->hw_scan_req->n_channels = n_chans;
 
        ielen = ieee80211_build_preq_ies(local, (u8 *)local->hw_scan_req->ie,
-                                        req->ie, req->ie_len, band, (u32) -1);
+                                        req->ie, req->ie_len, band, (u32) -1,
+                                        0);
        local->hw_scan_req->ie_len = ielen;
 
        return true;
index bfd19d76667a575083171c9021a274637dba4f3f..aba025d748e92cd8bdfa7e4c7347a4ea7e8ea18e 100644 (file)
@@ -895,7 +895,8 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
 
 int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
                             const u8 *ie, size_t ie_len,
-                            enum ieee80211_band band, u32 rate_mask)
+                            enum ieee80211_band band, u32 rate_mask,
+                            u8 channel)
 {
        struct ieee80211_supported_band *sband;
        u8 *pos;
@@ -947,6 +948,12 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
                pos += ext_rates_len;
        }
 
+       if (channel && sband->band == IEEE80211_BAND_2GHZ) {
+               *pos++ = WLAN_EID_DS_PARAMS;
+               *pos++ = 1;
+               *pos++ = channel;
+       }
+
        /* insert custom IEs that go before HT */
        if (ie && ie_len) {
                static const u8 before_ht[] = {
@@ -1013,6 +1020,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
        struct ieee80211_mgmt *mgmt;
        size_t buf_len;
        u8 *buf;
+       u8 chan;
 
        /* FIXME: come up with a proper value */
        buf = kmalloc(200 + ie_len, GFP_KERNEL);
@@ -1022,10 +1030,14 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
                return;
        }
 
+       chan = ieee80211_frequency_to_channel(
+               local->hw.conf.channel->center_freq);
+
        buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len,
                                           local->hw.conf.channel->band,
                                           sdata->rc_rateidx_mask
-                                          [local->hw.conf.channel->band]);
+                                          [local->hw.conf.channel->band],
+                                          chan);
 
        skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
                                     ssid, ssid_len,