aboutsummaryrefslogtreecommitdiff
path: root/net/mac80211/util.c
AgeCommit message (Collapse)AuthorFilesLines
2013-11-05Merge branch 'for-john' of ↵John W. Linville1-3/+121
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next Conflicts: net/wireless/reg.c
2013-11-04Merge branch 'master' of ↵John W. Linville1-4/+5
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless Conflicts: drivers/net/wireless/iwlwifi/pcie/drv.c
2013-10-28{nl,cfg,mac}80211: enable the triggering of CSA frame in meshChun-Yeow Yeoh1-0/+87
Allow the triggering of CSA frame using mesh interface. The rules are more or less same with IBSS, such as not allowed to change between the band and channel width has to be same from the previous mode. Also, move the ieee80211_send_action_csa to a common space so that it can be re-used by mesh interface. Signed-off-by: Chun-Yeow Yeoh <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-10-28mac80211: process the CSA frame for mesh accordinglyChun-Yeow Yeoh1-0/+9
Process the CSA frame according to the procedures define in IEEE Std 802.11-2012 section 10.9.8.4.3 as follow: * The mesh channel switch parameters element (MCSP) must be availabe. * If the MCSP's TTL is 1, drop the frame but still process the CSA. * If the MCSP's precedence value is less than or equal to the current precedence value, drop the frame and do not process the CSA. * The CSA frame is forwarded after TTL is decremented by 1 and the initiator field is set to 0. Transmit restrict field and others are maintained as is. * No beacon or probe response frame are handled here. Also, introduce the debug message used for mesh CSA purpose. Signed-off-by: Chun-Yeow Yeoh <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-10-28mac80211: Remove check for offchannel state when waking netdev queuesSeth Forshee1-3/+0
6c17b77b67587b9f9e3070fb89fe98cef3187131 ensures that a device's mac80211 queues will remain stopped while offchannel. Since the vif can no longer be offchannel when the queues wake it's not necessary to check for this before waking its netdev queues. Signed-off-by: Seth Forshee <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-10-28mac80211: implement SMPS for APEmmanuel Grumbach1-0/+25
When the driver requests to move to STATIC or DYNAMIC SMPS, we send an action frame to each associated station and reconfigure the channel context / driver. Of course, non-MIMO stations are ignored. The beacon isn't updated. The association response will include the original capabilities. Stations that associate while in non-OFF SMPS mode will get an action frame right after association to inform them about our current state. Note that we wait until the end of the EAPOL. Sending an action frame before the EAPOL is finished can be an issue for a few clients. Clients aren't likely to send EAPOL frames in MIMO anyway. When the SMPS configuration gets more permissive (e.g. STATIC -> OFF), we don't wake up stations that are asleep We remember that they don't know about the change and send the action frame when they wake up. When the SMPS configuration gets more restrictive (e.g. OFF -> STATIC), we set the TIM bit for every sleeping STA. uAPSD stations might send MIMO until they poll the action frame, but this is for a short period of time. Signed-off-by: Emmanuel Grumbach <[email protected]> [fix vht streams loop, initialisation] Signed-off-by: Johannes Berg <[email protected]>
2013-10-14mac80211: fix crash if bitrate calculation goes wrongJohannes Berg1-0/+4
If a frame's timestamp is calculated, and the bitrate calculation goes wrong and returns zero, the system will attempt to divide by zero and crash. Catch this case and print the rate information that the driver reported when this happens. Cc: [email protected] Reported-by: Thomas Lindroth <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-10-01mac80211: improve default WMM parameter settingFred Zhou1-13/+14
Move the default setting for WMM parameters outside the for loop to avoid redundant assignment multiple times. Signed-off-by: Fred Zhou <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-10-01mac80211: use exact-size allocation for authentication frameFred Zhou1-2/+2
The authentication frame has a fixied size of 30 bytes (including header, algo num, trans seq num, and status) followed by a variable challenge text. Allocate using exact size, instead of over-allocation by sizeof(ieee80211_mgmt). Signed-off-by: Fred Zhou <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-09-26mac80211: fix the setting of extended supported rate IEChun-Yeow Yeoh1-4/+1
The patch "mac80211: select and adjust bitrates according to channel mode" causes regression and breaks the extended supported rate IE setting. Since "i" is starting with 8, so this is not necessary to introduce "skip" here. Signed-off-by: Chun-Yeow Yeoh <[email protected]> Signed-off-by: Colleen Twitty <[email protected]> Reviewed-by: Jason Abele <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-09-26mac80211: split off channel switch parsing functionSimon Wunderlich1-0/+60
The channel switch parsing function can be re-used for the IBSS code, put the common part into an extra function. Signed-off-by: Simon Wunderlich <[email protected]> Signed-off-by: Mathias Kretschmer <[email protected]> [also move/rename chandef_downgrade] Signed-off-by: Johannes Berg <[email protected]>
2013-09-26mac80211: add ieee80211_iterate_active_interfaces_rtnl()Johannes Berg1-37/+34
If it is needed to disconnect multiple virtual interfaces after (WoWLAN-) suspend, the most obvious approach would be to iterate all interfaces by calling ieee80211_iterate_active_interfaces() and then call ieee80211_resume_disconnect() for each one. This is what the iwlmvm driver does. Unfortunately, this causes a locking dependency from mac80211's iflist_mtx to the key_mtx. This is problematic as the former is intentionally never held while calling any driver operation to allow drivers to iterate with their own locks held. The key_mtx is held while installing a key into the driver though, so this new lock dependency means drivers implementing the logic above can no longer hold their own lock while iterating. To fix this, add a new ieee80211_iterate_active_interfaces_rtnl() function that iterates while the RTNL is already held. This is true during suspend/resume, so that then the locking dependency isn't introduced. While at it, also refactor the various interface iterators and keep only a single implementation called by the various cases. Signed-off-by: Johannes Berg <[email protected]>
2013-08-16mac80211: add APIs to allow keeping connections after WoWLANJohannes Berg1-1/+1
In order to be able to (securely) keep connections alive after the system was suspended for WoWLAN, we need some additional APIs. We already have API (ieee80211_gtk_rekey_notify) to tell wpa_supplicant about the new replay counter if GTK rekeying was done by the device while the host was asleep, but that's not sufficient. If GTK rekeying wasn't done, we need to tell the host about sequence counters for the GTK (and PTK regardless of rekeying) that was used while asleep, add ieee80211_set_key_rx_seq() for that. If GTK rekeying was done, then we need to be able to disable the old keys (with ieee80211_remove_key()) and allocate the new GTK key(s) in mac80211 (with ieee80211_gtk_rekey_add()). If protocol offload (e.g. ARP) is implemented, then also the TX sequence counter for the PTK must be updated, using the new ieee80211_set_key_tx_seq() function. Signed-off-by: Johannes Berg <[email protected]>
2013-07-16mac80211: fix regression when initializing ibss wmm paramsSimon Wunderlich1-26/+0
There appear to be two regressions in ibss.c when calling ieee80211_sta_def_wmm_params(): * the second argument should be a rate length, not a rate array. This was introduced by my commit "mac80211: select and adjust bitrates according to channel mode" * the third argument is not initialized (anymore), making further checks within this function useless. Since ieee80211_sta_def_wmm_params() is only used by ibss anyway, remove the function entirely and handle the operating mode decision immediately. Signed-off-by: Simon Wunderlich <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-07-16mac80211: select and adjust bitrates according to channel modeSimon Wunderlich1-30/+129
The various components accessing the bitrates table must use consider the used channel bandwidth to select only available rates or calculate the bitrate correctly. There are some rates in reduced bandwidth modes which can't be represented as multiples of 500kbps, like 2.25 MBit/s in 5 MHz mode. The standard suggests to round up to the next multiple of 500kbps, just do that in mac80211 as well. Signed-off-by: Simon Wunderlich <[email protected]> Signed-off-by: Mathias Kretschmer <[email protected]> [make rate unsigned in ieee80211_add_tx_radiotap_header(), squash fix] Signed-off-by: Johannes Berg <[email protected]>
2013-07-16mac80211: fix timing for 5 MHz and 10 MHz channelsSimon Wunderlich1-13/+26
according to IEEE 802.11-2012 section 18, various timings change when using 5 MHz and 10 MHz. Reflect this by using a "shift" when calculating durations. Signed-off-by: Simon Wunderlich <[email protected]> Signed-off-by: Mathias Kretschmer <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-06-18Merge branch 'master' of ↵John W. Linville1-2/+2
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
2013-06-12mac80211: work around broken APs not including HT infoJohannes Berg1-2/+2
There are some APs, notably 2G/3G/4G Wifi routers, specifically the "Onda PN51T", "Vodafone PocketWiFi 2", "ZTE MF60" and a similar T-Mobile branded device [1] that erroneously don't include all the needed information in (re)association response frames. Work around this by assuming the information is the same as it was in the beacon or probe response and using the data from there instead. This fixes https://bugzilla.kernel.org/show_bug.cgi?id=58881. [1] https://bbs.archlinux.org/viewtopic.php?pid=1277305 Note that this requires marking the first ieee802_11_parse_elems() argument const, otherwise we'd get a compiler warning. Cc: [email protected] Reported-and-tested-by: Michal Zajac <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-06-05mac80211: Use suitable semantics for beacon availability indicationAlexander Bondar1-2/+3
Currently beacon availability upon association is marked by have_beacon flag of assoc_data structure that becomes unavailable when association completes. However beacon availability indication is required also after association to inform a driver. Currently dtim_period parameter is used for this purpose. Move have_beacon flag to another structure, persistant throughout a interface's life cycle. Use suitable sematics for beacon availability indication. Signed-off-by: Alexander Bondar <[email protected]> [fix another instance of BSS_CHANGED_DTIM_PERIOD in docs] Signed-off-by: Johannes Berg <[email protected]>
2013-05-29mac80211: support active monitor interfacesFelix Fietkau1-0/+6
Support them only if the driver advertises support for them via IEEE80211_HW_SUPPORTS_ACTIVE_MONITOR. Unlike normal monitor interfaces, they are added to the driver, along with their MAC address. Signed-off-by: Felix Fietkau <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-05-25cfg80211/mac80211: use cfg80211 wdev mutex in mac80211Johannes Berg1-2/+2
Using separate locks in cfg80211 and mac80211 has always caused issues, for example having to unlock in places in mac80211 to call cfg80211, which even needed a framework to make cfg80211 calls after some functions returned etc. Additionally, I suspect some issues people have reported with the cfg80211 state getting confused could be due to such issues, when cfg80211 is asking mac80211 to change state but mac80211 is in the process of telling cfg80211 that the state changed (in another way.) Signed-off-by: Johannes Berg <[email protected]>
2013-05-25Merge remote-tracking branch 'mac80211/master' into mac80211-nextJohannes Berg1-0/+7
2013-05-24{cfg,mac}80211: move mandatory rates calculation to cfg80211Ashok Nagarajan1-26/+0
Move mandatory rates calculation to cfg80211, shared with non mac80211 drivers. Signed-off-by: Ashok Nagarajan <[email protected]> [extend documentation] Signed-off-by: Johannes Berg <[email protected]>
2013-05-16mac80211: fix IEEE80211_SDATA_DISCONNECT_RESUMEJohannes Berg1-0/+7
Since commit 12e7f517029dad819c45eca9ca01fdb9ba57616b, IEEE80211_SDATA_DISCONNECT_RESUME no longer worked as it would simply never be tested. Restore a bit of the code removed there and in 9b7d72c1041ec5b20b24af487a9 to make it work again. Signed-off-by: Johannes Berg <[email protected]>
2013-04-16mac80211: parse VHT channel switch IEsJohannes Berg1-1/+35
VHT introduces multiple IEs that need to be parsed for a wide bandwidth channel switch. Two are (currently) needed in mac80211: * wide bandwidth channel switch element * channel switch wrapper element The former is contained in the latter for beacons and probe responses, but not for the spectrum management action frames so the IE parser needs a new argument to differentiate them. Signed-off-by: Johannes Berg <[email protected]>
2013-04-16mac80211: support secondary channel offset in CSAJohannes Berg1-0/+8
Add support for the secondary channel offset IE in channel switch announcements. This is necessary for proper handling of CSA on HT access points. For this to work it is also necessary to convert everything here to use chandef structs instead of just channels. The driver updates aren't really correct though. In particular, the TI wl18xx driver update can't possibly be right since it just ignores the new channel width for lack of firmware API. Signed-off-by: Johannes Berg <[email protected]>
2013-04-16mac80211: support extended channel switchJohannes Berg1-0/+7
Support extended channel switch when the operating class is one of the global operating classes as defined in Annex E of 802.11-2012. If it isn't, disconnect from the AP instead. Signed-off-by: Johannes Berg <[email protected]>
2013-04-11mac80211: fix ieee80211_queue_stopped()Thomas Pedersen1-1/+2
Johannes Berg notes mac80211 drivers which use ieee80211_queue_stopped() really only want to know if they previously requested a queue stop. Signed-off-by: Thomas Pedersen <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-04-08mac80211: make ieee802_11_parse_elems an inlineJohannes Berg1-6/+0
This (slightly) reduces the code size. Signed-off-by: Johannes Berg <[email protected]>
2013-04-08mac80211: destroy virtual monitor interface across suspendJohannes Berg1-0/+5
It has to be removed from the driver, but completely destroying it helps handle unplug of a device during suspend since then the channel context handling etc. doesn't have to happen later when it's removed. Signed-off-by: Johannes Berg <[email protected]>
2013-04-08mac80211: parse Timeout Interval Element using a structJohannes Berg1-2/+4
Instead of open-coding the accesses and length check do the length check in the IE parser and assign a struct pointer for use in the remaining code. Signed-off-by: Johannes Berg <[email protected]>
2013-04-08mac80211: check ERP info IE length in parserJohannes Berg1-2/+4
It's always just one byte, so check for that and remove the length field from the parser struct. Signed-off-by: Johannes Berg <[email protected]>
2013-04-08mac80211: check DSSS params IE length in parserJohannes Berg1-2/+4
It's always just one byte, so check for that and remove the length field from the parser struct. Signed-off-by: Johannes Berg <[email protected]>
2013-04-08mac80211: remove unused IE pointers from parserJohannes Berg1-19/+0
There's no need to parse IEs that aren't used so just remove them. Signed-off-by: Johannes Berg <[email protected]>
2013-03-25mac80211: Use a cfg80211_chan_def in ieee80211_hw_conf_chanKarl Beldan1-2/+1
Drivers that don't use chanctxes cannot perform VHT association because they still use a "backward compatibility" pair of {ieee80211_channel, nl80211_channel_type} in ieee80211_conf and ieee80211_local. Signed-off-by: Karl Beldan <[email protected]> [fix kernel-doc] Signed-off-by: Johannes Berg <[email protected]>
2013-03-20mac80211: return the RSSI in dBmEmmanuel Grumbach1-1/+1
For the sake of speed of calculation and number accuracy, mac80211 tracks the RSSI in dBm * 16. But it forgot to divide back by 16 when the RSSI is asked by the driver. Signed-off-by: Emmanuel Grumbach <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-03-18mac80211: stop queues temporarily for flushingJohannes Berg1-7/+16
Sometimes queues are flushed in the middle of operation, which can lead to driver issues. Stop queues temporarily, while flushing, to avoid transmitting new packets while they are being flushed. Signed-off-by: Johannes Berg <[email protected]>
2013-03-18mac80211: pass queue bitmap to flush operationJohannes Berg1-0/+25
There are a number of situations in which mac80211 only really needs to flush queues for one virtual interface, and in fact during this frames might be transmitted on other virtual interfaces. Calculate and pass a queue bitmap to the driver so it knows which queues to flush. Signed-off-by: Johannes Berg <[email protected]>
2013-03-06mac80211: merge reconfig assign chanctx codeStanislaw Gruszka1-25/+22
Signed-off-by: Stanislaw Gruszka <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-03-06mac80211: cleanup generic suspend/resume proceduresStanislaw Gruszka1-26/+0
Since now we disconnect before suspend, various code which save connection state can now be removed from suspend and resume procedure. Cleanup on resume side is smaller as ieee80211_reconfig() is also used for H/W restart. Signed-off-by: Stanislaw Gruszka <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-02-15mac80211: constify IE parsingJohannes Berg1-2/+2
Make all the parsed IE pointers const, and propagate the change to all the users etc. Signed-off-by: Johannes Berg <[email protected]>
2013-02-15mac80211: handle operating mode notif in beacon/assoc responseJohannes Berg1-0/+6
In beacons and association response frames an AP may include an operating mode notification element to advertise changes in the number of spatial streams it can receive. Handle this using the existing function that handles the action frame, but only handle NSS changes, not bandwidth changes which aren't allowed here. Signed-off-by: Johannes Berg <[email protected]>
2013-02-15mac80211: don't pick up WPA vendor IEJohannes Berg1-5/+1
There's no use for it, WPA is entirely handled in wpa_supplicant in userspace, so don't pick the IE. Signed-off-by: Johannes Berg <[email protected]>
2013-02-15mac80211: add radar detection command/eventSimon Wunderlich1-0/+46
Add command to trigger radar detection in the driver/FW. Once radar detection is started it should continuously monitor for radars as long as the channel active. If radar is detected usermode notified with 'radar detected' event. Scanning and remain on channel functionality must be disabled while doing radar detection/scanning, and vice versa. Based on original patch by Victor Goldenshtein <[email protected]> Signed-off-by: Simon Wunderlich <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-02-04mac80211: mesh power save basicsMarco Porsch1-0/+4
Add routines to - maintain a PS mode for each peer and a non-peer PS mode - indicate own PS mode in transmitted frames - track neighbor STAs power modes - buffer frames when neighbors are in PS mode - add TIM and Awake Window IE to beacons - release frames in Mesh Peer Service Periods Add local_pm to sta_info to represent the link-specific power mode at this station towards the remote station. When a peer link is established, use the default power mode stored in mesh config. Update the PS status if the peering status of a neighbor changes. Maintain a mesh power mode for non-peer mesh STAs. Set the non-peer power mode to active mode during peering. Authenticated mesh peering is currently not working when either node is configured to be in power save mode. Indicate the current power mode in transmitted frames. Use QoS Nulls to indicate mesh power mode transitions. For performance reasons, calls to the function setting the frame flags are placed in HWMP routing routines, as there the STA pointer is already available. Add peer_pm to sta_info to represent the peer's link-specific power mode towards the local station. Add nonpeer_pm to represent the peer's power mode towards all non-peer stations. Track power modes based on received frames. Add the ps_data structure to ieee80211_if_mesh (for TIM map, PS neighbor counter and group-addressed frame buffer). Set WLAN_STA_PS flag for STA in PS mode to use the unicast frame buffering routines in the tx path. Update num_sta_ps to buffer and release group-addressed frames after DTIM beacons. Announce the awake window duration in beacons if in light or deep sleep mode towards any peer or non-peer. Create a TIM IE similarly to AP mode and add it to mesh beacons. Parse received Awake Window IEs and check TIM IEs for buffered frames. Release frames towards peers in mesh Peer Service Periods. Use the corresponding trigger frames and monitor the MPSP status. Append a QoS Null as trigger frame if neccessary to properly end the MPSP. Currently, in HT channels MPSPs behave imperfectly and show large delay spikes and frame losses. Signed-off-by: Marco Porsch <[email protected]> Signed-off-by: Ivan Bezyazychnyy <[email protected]> Signed-off-by: Mike Krinkin <[email protected]> Signed-off-by: Max Filippov <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-01-31mac80211: start auth/assoc timeout on frame statusJohannes Berg1-6/+6
When sending authentication/association frames they might take a bit of time to go out because we may have to synchronise with the AP, in particular in the case where it's really a P2P GO. In this case the 200ms fixed timeout could potentially be too short if the beacon interval is relatively large. For drivers that report TX status we can do better. Instead of starting the timeout directly, start it only when the frame status arrives. Since then the frame was out on the air, we can wait shorter (the typical response time is supposed to be 30ms, wait 100ms.) Also, if the frame failed to be transmitted try again right away instead of waiting. Signed-off-by: Johannes Berg <[email protected]>
2013-01-31mac80211: inform the driver about update of dtim_periodEmmanuel Grumbach1-0/+4
Currently, when the driver requires the DTIM period, mac80211 will wait to hear a beacon before association. This behavior is suboptimal since some drivers may be able to deal with knowing the DTIM period after the association, if they get it at all. To address this, notify the drivers with bss_info_changed with the new BSS_CHANGED_DTIM_PERIOD flag when the DTIM becomes known. This might be when changing to associated, or later when the entire association was done with only probe response information. Rename the hardware flag for the current behaviour to IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC to more accurately reflect its behaviour. IEEE80211_HW_NEED_DTIM_PERIOD is no longer accurate as all drivers get the DTIM period now, just not before association. Signed-off-by: Emmanuel Grumbach <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2013-01-16mac80211: call restart complete at wowlan resume timeJohannes Berg1-3/+4
When the driver's resume function can't completely restore the configuration in the device, it returns 1 from the callback which will be treated like a HW restart request, but done directly. In this case, also call the driver's restart_complete() function so it can finish the reconfiguration there. Signed-off-by: Johannes Berg <[email protected]>
2013-01-16mac80211: fix resume from WoWLANJohannes Berg1-2/+4
My commit 529ba6e9313dbe60dab7e72c6fdf647a012e9f5b ("mac80211: clean up association better in suspend") introduced a bug when resuming from WoWLAN when a device reset is desired. This case must not use the suspend_bss_conf as it hasn't been stored. Signed-off-by: Johannes Berg <[email protected]>
2013-01-03mac80211: split aggregation stop by reasonJohannes Berg1-1/+2
The initiator/tx doesn't really identify why an aggregation session is stopped, give a reason for stopping that more clearly identifies what's going on. This will help tell the driver clearly what is expected of it. Signed-off-by: Johannes Berg <[email protected]>