small mac80211 updates
Johannes Berg
maintainercover small mac80211 updates
Hi,
This contains just patches I've previously sent, but possibly slightly modified (I've forgotten). Can you please ignore all patches I sent on the weekend and apply these instead? I have already rebased my other patches to apply after the ones from Tomas that do the disassociation fixes.
I'm resending these mostly to make it easier for you to drop the ones I don't want applied right now.
johannes
Johannes Berg
maintainerPATCH 1/3 mac80211: move some RCU locking into an if branch
The if itself doesn't need to be protected, so move in the RCU locking to avoid doing anything at all when the condition isn't true.
--- net/mac80211/mlme.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
net/mac80211/mlme.c +4 -5
@@ -2613,13 +2613,12 @@ static void ieee80211_rx_bss_info(struct mesh_peer_accepts_plinks(elems)); } -rcu_read_lock (); -if (sdata->vif.type ==IEEE80211_IF_TYPE_IBSS && elems->supp_rates &&memcmp (mgmt->bssid, sdata->u.sta.bssid,ETH_ALEN ) ==0 ) { - supp_rates =ieee80211_sta_get_rates (local, elems, band); +rcu_read_lock (); + sta =sta_info_get (local, mgmt->sa);if (sta) {u64 prev_rates;
@@ -2643,9 +2642,9 @@ static void ieee80211_rx_bss_info(structieee80211_ibss_add_sta (sdata,NULL , mgmt->bssid, mgmt->sa, supp_rates); } - } -rcu_read_unlock (); +rcu_read_unlock (); + }if (elems->ds_params && elems->ds_params_len ==1 ) freq =ieee80211_channel_to_frequency (elems->ds_params[0 ]);
Johannes Berg
maintainerPATCH 2/3 mac80211: make conf_tx non-atomic
In reply to Johannes BergThe conf_tx callback currently needs to be atomic, this requirement is just because it can be called from scanning. This rearranges it slightly to only update while not scanning (which is fine, we'll be getting beacons when associated) and thus removes the atomic requirement.
--- include/net/mac80211.h | 2 +- net/mac80211/mlme.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-)
include/net/mac80211.h +1 -1
@@ -1142,7 +1142,7 @@ enum ieee80211_ampdu_mlme_action {* of assocaited station or AP. * * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), -* bursting) for a hardware TX queue. Must be atomic. +* bursting) for a hardware TX queue. * * @get_tx_stats: Get statistics of the current TX queue status. This is used * to get number of currently queued packets (queue length), maximum queue
net/mac80211/mlme.c +8 -5
@@ -2873,15 +2873,18 @@ static void ieee80211_rx_mgmt_beacon(str memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)return ; -ieee80211_sta_wmm_params (local, ifsta, elems.wmm_param, - elems.wmm_param_len); -/* Do not send changes to driver if we are scanning. This removes -* requirement that driver's bss_info_changed function needs to be -* atomic. */ +* requirement that a driver's bss_info_changed/conf_tx functions +* need to be atomic. +* This is really ugly code, we should rewrite scanning and make +* all this more understandable for humans. +*/ if (local->sta_sw_scanning || local->sta_hw_scanning)return ; +ieee80211_sta_wmm_params (local, ifsta, elems.wmm_param, + elems.wmm_param_len); +if (elems.erp_info && elems.erp_info_len >=1 ) changed |=ieee80211_handle_erp_ie (sdata, elems.erp_info[0 ]);else {
Johannes Berg
maintainerPATCH 3/3 mac80211: BSS info: check channel first
In reply to Johannes BergWhen we receive information about a BSS we check at some point whether or not we think we're allowed to use the channel it is on, but we do that fairly late. I don't think we should do it that late, so do it earlier to avoid doing IBSS/mesh stuff on that channel and then getting confused because it's disabled.
--- net/mac80211/mlme.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
net/mac80211/mlme.c +11 -11
@@ -2603,7 +2603,15 @@ static void ieee80211_rx_bss_info(structDECLARE_MAC_BUF (mac);DECLARE_MAC_BUF (mac2); - beacon_timestamp =le64_to_cpu (mgmt->u.beacon.timestamp); +if (elems->ds_params && elems->ds_params_len ==1 ) + freq =ieee80211_channel_to_frequency (elems->ds_params[0 ]); +else + freq = rx_status->freq; + + channel =ieee80211_get_channel (local->hw.wiphy, freq); + +if (!channel || channel->flags &IEEE80211_CHAN_DISABLED ) +return ;if (ieee80211_vif_is_mesh (&sdata->vif) && elems->mesh_id && elems->mesh_config &&mesh_matches_local (elems, sdata)) {
@@ -2646,16 +2654,6 @@ static void ieee80211_rx_bss_info(structrcu_read_unlock (); } -if (elems->ds_params && elems->ds_params_len ==1 ) - freq =ieee80211_channel_to_frequency (elems->ds_params[0 ]); -else - freq = rx_status->freq; - - channel =ieee80211_get_channel (local->hw.wiphy, freq); - -if (!channel || channel->flags &IEEE80211_CHAN_DISABLED ) -return ; -#ifdef CONFIG_MAC80211_MESH if (elems->mesh_config) bss = ieee80211_rx_mesh_bss_get(local, elems->mesh_id,
@@ -2724,6 +2722,8 @@ static void ieee80211_rx_bss_info(struct bss->band = band; + beacon_timestamp =le64_to_cpu (mgmt->u.beacon.timestamp); + bss->timestamp = beacon_timestamp; bss->last_update = jiffies; bss->signal = rx_status->signal;
Johannes Berg
maintainer[PATCH 4/3] mac80211: fix action frame length checks
In reply to Johannes BergThe action frame length checks are one too small, there's not just an action code as the comment makes you believe, there's a category code too, and the category code is required in each action frame (hence part of IEEE80211_MIN_ACTION_SIZE).
--- net/mac80211/mesh_hwmp.c | 4 ++++ net/mac80211/mesh_plink.c | 4 ++++ net/mac80211/mlme.c | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-)
net/mac80211/mesh_hwmp.c +4 -0
@@ -581,6 +581,10 @@ void mesh_rx_path_sel_frame(struct ieee8size_t baselen;u32 last_hop_metric; +/* need action_code */ +if (len <IEEE80211_MIN_ACTION_SIZE +1 ) +return ; + baselen = (u8 *) mgmt->u.action.u.mesh_action.variable - (u8 *) mgmt;ieee802_11_parse_elems (mgmt->u.action.u.mesh_action.variable, len - baselen, &elems);
net/mac80211/mesh_plink.c +4 -0
@@ -421,6 +421,10 @@ void mesh_rx_plink_frame(struct ieee8021DECLARE_MAC_BUF (mac);#endif +/* need action_code, aux */ +if (len <IEEE80211_MIN_ACTION_SIZE +3 ) +return ; +if (is_multicast_ether_addr (mgmt->da)) {mpl_dbg ("Mesh plink: ignore frame from multicast address" );return ;
net/mac80211/mlme.c +3 -2
@@ -60,7 +60,7 @@#define ERP_INFO_USE_PROTECTION BIT(1) -/* mgmt header + 1 byte action code */ +/* mgmt header + 1 byte category code */ #define IEEE80211_MIN_ACTION_SIZE (24 + 1)#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
@@ -2989,7 +2989,8 @@ static void ieee80211_rx_mgmt_action(str {struct ieee80211_local *local = sdata->local; -if (len <IEEE80211_MIN_ACTION_SIZE ) +/* all categories we currently handle have action_code */ +if (len <IEEE80211_MIN_ACTION_SIZE +1 )return ;switch (mgmt->u.action.category) {
Johannes Berg
maintainer[PATCH 5/3] mac80211: fix typo in action frame handling
In reply to Johannes BergThis says chan_switch.action_code but really means measurement.action_code, of course the actual offset in the frame is the same, it's just harder to understand this way.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -2997,7 +2997,7 @@ static void ieee80211_rx_mgmt_action(strcase WLAN_CATEGORY_SPECTRUM_MGMT :if (local->hw.conf.channel->band !=IEEE80211_BAND_5GHZ )break ; -switch (mgmt->u.action.u.chan_switch.action_code) { +switch (mgmt->u.action.u.measurement.action_code) {case WLAN_ACTION_SPCT_MSR_REQ :if (len < (IEEE80211_MIN_ACTION_SIZE +sizeof (mgmt->u.action.u.measurement)))
Re: [PATCH 5/3] mac80211: fix typo in action frame handling
Quoted 17 lines · Johannes Berg
This says chan_switch.action_code but really means measurement.action_code, of course the actual offset in the frame is the same, it's just harder to understand this way.
Signed-off-by Johannes Berg <[email protected]>net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c 2008-09-08 16:29:56.000000000 +0200 static void ieee80211_rx_mgmt_action(str · line 3003
Quoted 8 lines
net/mac80211/mlme.c 2008-09-08 16:29:56.000000000 +0200 renamed from net/mac80211/mlme.c 2008-09-08 16:29:54.000000000 +0200 +1
-1@@ -2997,7 +2997,7 @@ static void ieee80211_rx_mgmt_action(str case WLAN_CATEGORY_SPECTRUM_MGMT: if (local->hw.conf.channel->band != IEEE80211_BAND_5GHZ) break; - switch (mgmt->u.action.u.chan_switch.action_code) { + switch (mgmt->u.action.u.measurement.action_code) { case WLAN_ACTION_SPCT_MSR_REQ: if (len < (IEEE80211_MIN_ACTION_SIZE + sizeof(mgmt->u.action.u.measurement)))
It doesn't really matter on which action code you doing the switch. The full code looks like that
switch (mgmt->u.action.u.chan_switch.action_code) {
case WLAN_ACTION_SPCT_MSR_REQ:
if (len < (IEEE80211_MIN_ACTION_SIZE +
sizeof(mgmt->u.action.u.msrment_req)))
break;
ieee80211_sta_process_measurement_req(dev, mgmt);
break;
case WLAN_ACTION_SPCT_CHL_SWITCH:
if (len < (IEEE80211_MIN_ACTION_SIZE +
sizeof(mgmt->u.action.u.chan_switch)))
break;
ieee80211_sta_process_channel_switch(dev, ifsta,
&mgmt->u.action.u.chan_switch.sw_elem);
break;
case WLAN_ACTION_SPCT_TPC_REQ:
ieee80211_sta_process_tpc_req(dev, mgmt, rx_status);
break;
default:
break;Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Johannes Berg
maintainerRe: [PATCH 5/3] mac80211: fix typo in action frame handling
Quoted 1 line · Tomas Winkler
It doesn't really matter on which action code you doing the switch.
Oh, I know, but I think it's confusing.
Quoted 13 lines
The full code looks like that
switch (mgmt->u.action.u.chan_switch.action_code) { case WLAN_ACTION_SPCT_MSR_REQ: if (len < (IEEE80211_MIN_ACTION_SIZE + sizeof(mgmt->u.action.u.msrment_req))) break; ieee80211_sta_process_measurement_req(dev, mgmt); break; case WLAN_ACTION_SPCT_CHL_SWITCH: if (len < (IEEE80211_MIN_ACTION_SIZE + sizeof(mgmt->u.action.u.chan_switch))) break;
Quoted 8 lines
ieee80211_sta_process_channel_switch(dev, ifsta, &mgmt->u.action.u.chan_switch.sw_elem); break; case WLAN_ACTION_SPCT_TPC_REQ: ieee80211_sta_process_tpc_req(dev, mgmt, rx_status); break; default: break;
Does channel switch and measurement have the same category? Can't we better reflect that in the structure? I thought the union in the struct had one sub-structure per category.
johannes
Johannes Berg
maintainer[PATCH 6/3] mac80211: move IE parsing to util file
In reply to Johannes BergSince IE parsing is required for the mlme and mesh code, it's not a static function anyway, and it's much better to have it in util rather than the overly large mlme.c
--- net/mac80211/mlme.c | 145 ---------------------------------------------------- net/mac80211/util.c | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 145 deletions(-)
net/mac80211/mlme.c +0 -145
@@ -91,151 +91,6 @@ static int ieee80211_sta_config_auth(strstatic void sta_rx_agg_session_timer_expired (unsigned long data); -void ieee802_11_parse_elems (u8 *start,size_t len, -struct ieee802_11_elems *elems) -{ -size_t left = len; -u8 *pos = start; - -memset (elems,0 ,sizeof (*elems)); - elems->ie_start = start; - elems->total_len = len; - -while (left >=2 ) { -u8 id, elen; - - id = *pos++; - elen = *pos++; - left -=2 ; - -if (elen > left) -return ; - -switch (id) { -case WLAN_EID_SSID : - elems->ssid = pos; - elems->ssid_len = elen; -break ; -case WLAN_EID_SUPP_RATES : - elems->supp_rates = pos; - elems->supp_rates_len = elen; -break ; -case WLAN_EID_FH_PARAMS : - elems->fh_params = pos; - elems->fh_params_len = elen; -break ; -case WLAN_EID_DS_PARAMS : - elems->ds_params = pos; - elems->ds_params_len = elen; -break ; -case WLAN_EID_CF_PARAMS : - elems->cf_params = pos; - elems->cf_params_len = elen; -break ; -case WLAN_EID_TIM : - elems->tim = pos; - elems->tim_len = elen; -break ; -case WLAN_EID_IBSS_PARAMS : - elems->ibss_params = pos; - elems->ibss_params_len = elen; -break ; -case WLAN_EID_CHALLENGE : - elems->challenge = pos; - elems->challenge_len = elen; -break ; -case WLAN_EID_WPA : -if (elen >=4 && pos[0 ] ==0x00 && pos[1 ] ==0x50 && - pos[2 ] ==0xf2 ) { -/* Microsoft OUI (00:50:F2) */ -if (pos[3 ] ==1 ) { -/* OUI Type 1 - WPA IE */ - elems->wpa = pos; - elems->wpa_len = elen; - }else if (elen >=5 && pos[3 ] ==2 ) { -if (pos[4 ] ==0 ) { - elems->wmm_info = pos; - elems->wmm_info_len = elen; - }else if (pos[4 ] ==1 ) { - elems->wmm_param = pos; - elems->wmm_param_len = elen; - } - } - } -break ; -case WLAN_EID_RSN : - elems->rsn = pos; - elems->rsn_len = elen; -break ; -case WLAN_EID_ERP_INFO : - elems->erp_info = pos; - elems->erp_info_len = elen; -break ; -case WLAN_EID_EXT_SUPP_RATES : - elems->ext_supp_rates = pos; - elems->ext_supp_rates_len = elen; -break ; -case WLAN_EID_HT_CAPABILITY : - elems->ht_cap_elem = pos; - elems->ht_cap_elem_len = elen; -break ; -case WLAN_EID_HT_EXTRA_INFO : - elems->ht_info_elem = pos; - elems->ht_info_elem_len = elen; -break ; -case WLAN_EID_MESH_ID : - elems->mesh_id = pos; - elems->mesh_id_len = elen; -break ; -case WLAN_EID_MESH_CONFIG : - elems->mesh_config = pos; - elems->mesh_config_len = elen; -break ; -case WLAN_EID_PEER_LINK : - elems->peer_link = pos; - elems->peer_link_len = elen; -break ; -case WLAN_EID_PREQ : - elems->preq = pos; - elems->preq_len = elen; -break ; -case WLAN_EID_PREP : - elems->prep = pos; - elems->prep_len = elen; -break ; -case WLAN_EID_PERR : - elems->perr = pos; - elems->perr_len = elen; -break ; -case WLAN_EID_CHANNEL_SWITCH : - elems->ch_switch_elem = pos; - elems->ch_switch_elem_len = elen; -break ; -case WLAN_EID_QUIET : -if (!elems->quiet_elem) { - elems->quiet_elem = pos; - elems->quiet_elem_len = elen; - } - elems->num_of_quiet_elem++; -break ; -case WLAN_EID_COUNTRY : - elems->country_elem = pos; - elems->country_elem_len = elen; -break ; -case WLAN_EID_PWR_CONSTRAINT : - elems->pwr_constr_elem = pos; - elems->pwr_constr_elem_len = elen; -break ; -default : -break ; - } - - left -= elen; - pos += elen; - } -} - -static u8 *ieee80211_bss_get_ie (struct ieee80211_sta_bss *bss,u8 ie) {u8 *end, *pos;
net/mac80211/util.c +144 -0
147 lines not on this page · raw message