aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ibss.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-23 10:10:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-06 15:14:33 -0400
commit57c4d7b4c4986037be51476b8e3025d5ba18d8b8 (patch)
treebcd24a127b4c79891f45799a20867f49c0f7f949 /net/mac80211/ibss.c
parentf3b85252f081581a8f257545ed748062dce7798b (diff)
mac80211: clean up beacon interval settings
We currently have two beacon interval configuration knobs: hw.conf.beacon_int and vif.bss_info.beacon_int. This is rather confusing, even though the former is used when we beacon ourselves and the latter when we are associated to an AP. This just deprecates the hw.conf.beacon_int setting in favour of always using vif.bss_info.beacon_int. Since it touches all the beaconing IBSS code anyway, we can also add support for the cfg80211 IBSS beacon interval configuration easily. NOTE: The hw.conf.beacon_int setting is retained for now due to drivers still using it -- I couldn't untangle all drivers, some are updated in this patch. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r--net/mac80211/ibss.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 25ff583612ef..f4879dad3cd7 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -73,6 +73,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
73 struct ieee80211_mgmt *mgmt; 73 struct ieee80211_mgmt *mgmt;
74 u8 *pos; 74 u8 *pos;
75 struct ieee80211_supported_band *sband; 75 struct ieee80211_supported_band *sband;
76 u32 bss_change;
76 77
77 if (local->ops->reset_tsf) { 78 if (local->ops->reset_tsf) {
78 /* Reset own TSF to allow time synchronization work. */ 79 /* Reset own TSF to allow time synchronization work. */
@@ -92,8 +93,6 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
92 93
93 memcpy(ifibss->bssid, bssid, ETH_ALEN); 94 memcpy(ifibss->bssid, bssid, ETH_ALEN);
94 95
95 local->hw.conf.beacon_int = beacon_int >= 10 ? beacon_int : 10;
96
97 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; 96 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
98 97
99 ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID); 98 ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID);
@@ -101,6 +100,12 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
101 local->oper_channel = chan; 100 local->oper_channel = chan;
102 local->oper_channel_type = NL80211_CHAN_NO_HT; 101 local->oper_channel_type = NL80211_CHAN_NO_HT;
103 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 102 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
103
104 sdata->vif.bss_conf.beacon_int = beacon_int;
105 bss_change = BSS_CHANGED_BEACON_INT;
106 bss_change |= ieee80211_reset_erp_info(sdata);
107 ieee80211_bss_info_change_notify(sdata, bss_change);
108
104 sband = local->hw.wiphy->bands[chan->band]; 109 sband = local->hw.wiphy->bands[chan->band];
105 110
106 /* Build IBSS probe response */ 111 /* Build IBSS probe response */
@@ -111,7 +116,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
111 memset(mgmt->da, 0xff, ETH_ALEN); 116 memset(mgmt->da, 0xff, ETH_ALEN);
112 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); 117 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
113 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); 118 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN);
114 mgmt->u.beacon.beacon_int = cpu_to_le16(local->hw.conf.beacon_int); 119 mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int);
115 mgmt->u.beacon.timestamp = cpu_to_le64(tsf); 120 mgmt->u.beacon.timestamp = cpu_to_le64(tsf);
116 mgmt->u.beacon.capab_info = cpu_to_le16(capability); 121 mgmt->u.beacon.capab_info = cpu_to_le16(capability);
117 122
@@ -181,8 +186,13 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
181static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, 186static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
182 struct ieee80211_bss *bss) 187 struct ieee80211_bss *bss)
183{ 188{
189 u16 beacon_int = bss->cbss.beacon_interval;
190
191 if (beacon_int < 10)
192 beacon_int = 10;
193
184 __ieee80211_sta_join_ibss(sdata, bss->cbss.bssid, 194 __ieee80211_sta_join_ibss(sdata, bss->cbss.bssid,
185 bss->cbss.beacon_interval, 195 beacon_int,
186 bss->cbss.channel, 196 bss->cbss.channel,
187 bss->supp_rates_len, bss->supp_rates, 197 bss->supp_rates_len, bss->supp_rates,
188 bss->cbss.capability, 198 bss->cbss.capability,
@@ -464,9 +474,6 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
464 474
465 sband = local->hw.wiphy->bands[ifibss->channel->band]; 475 sband = local->hw.wiphy->bands[ifibss->channel->band];
466 476
467 if (local->hw.conf.beacon_int == 0)
468 local->hw.conf.beacon_int = 100;
469
470 capability = WLAN_CAPABILITY_IBSS; 477 capability = WLAN_CAPABILITY_IBSS;
471 478
472 if (sdata->default_key) 479 if (sdata->default_key)
@@ -480,7 +487,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
480 *pos++ = (u8) (rate / 5); 487 *pos++ = (u8) (rate / 5);
481 } 488 }
482 489
483 __ieee80211_sta_join_ibss(sdata, bssid, local->hw.conf.beacon_int, 490 __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
484 ifibss->channel, sband->n_bitrates, 491 ifibss->channel, sband->n_bitrates,
485 supp_rates, capability, 0); 492 supp_rates, capability, 0);
486} 493}
@@ -823,6 +830,8 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
823 } else 830 } else
824 sdata->u.ibss.fixed_bssid = false; 831 sdata->u.ibss.fixed_bssid = false;
825 832
833 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
834
826 sdata->u.ibss.channel = params->channel; 835 sdata->u.ibss.channel = params->channel;
827 sdata->u.ibss.fixed_channel = params->channel_fixed; 836 sdata->u.ibss.fixed_channel = params->channel_fixed;
828 837