summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_ht.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Importing pfSense patches net80211HEAD.tgz and conf.file.ieee80211.diff"Renato Botelho2016-02-221-27/+2
| | | | This reverts commit 6ee75bdd7bf7c20359dd6e38c243586cb062edea.
* Importing pfSense patches net80211HEAD.tgz and conf.file.ieee80211.diffRenato Botelho2015-08-171-2/+27
|
* MFC r263710, r273377, r273378, r273423 and r273455:hselasky2014-10-271-1/+1
| | | | | | | - De-vnet hash sizes and hash masks. - Fix multiple issues related to arguments passed to SYSCTL macros. Sponsored by: Mellanox Technologies
* Fix a VAP BSS node reference in the HT code to actually take a referenceadrian2013-05-101-1/+7
| | | | | | | | | | | | | | before using said node. The "blessed" way here is to take a node reference before referencing anything inside the node, otherwise the node can be freed between the time the pointer is copied/dereferenced and the time the node contents are used. This mirrors fixes that I've done elsewhere in the net80211/driver stack. PR: kern/178470
* Bring over my initial work from the net80211 TX locking branch.adrian2013-03-081-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patchset implements a new TX lock, covering both the per-VAP (and thus per-node) TX locking and the serialisation through to the underlying physical device. This implements the hard requirement that frames to the underlying physical device are scheduled to the underlying device in the same order that they are processed at the VAP layer. This includes adding extra encapsulation state (such as sequence numbers and CCMP IV numbers.) Any order mismatch here will result in dropped packets at the receiver. There are multiple transmit contexts from the upper protocol layers as well as the "raw" interface via the management and BPF transmit paths. All of these need to be correctly serialised or bad behaviour will result under load. The specifics: * add a new TX IC lock - it will eventually just be used for serialisation to the underlying physical device but for now it's used for both the VAP encapsulation/serialisation and the physical device dispatch. This lock is specifically non-recursive. * Methodize the parent transmit, vap transmit and ic_raw_xmit function pointers; use lock assertions in the parent/vap transmit routines. * Add a lock assertion in ieee80211_encap() - the TX lock must be held here to guarantee sensible behaviour. * Refactor out the packet sending code from ieee80211_start() - now ieee80211_start() is just a loop over the ifnet queue and it dispatches each VAP packet send through ieee80211_start_pkt(). Yes, I will likely rename ieee80211_start_pkt() to something that better reflects its status as a VAP packet transmit path. More on that later. * Add locking around the management and BAR TX sending - to ensure that encapsulation and TX are done hand-in-hand. * Add locking in the mesh code - again, to ensure that encapsulation and mesh transmit are done hand-in-hand. * Add locking around the power save queue and ageq handling, when dispatching to the parent interface. * Add locking around the WDS handoff. * Add a note in the mesh dispatch code that the TX path needs to be re-thought-out - right now it's doing a direct parent device transmit rather than going via the vap layer. It may "work", but it's likely incorrect (as it bypasses any possible per-node power save and aggregation handling.) Why not a per-VAP or per-node lock? Because in order to ensure per-VAP ordering, we'd have to hold the VAP lock across parent->if_transmit(). There are a few problems with this: * There's some state being setup during each driver transmit - specifically, the encryption encap / CCMP IV setup. That should eventually be dragged back into the encapsulation phase but for now it lives in the driver TX path. This should be locked. * Two drivers (ath, iwn) re-use the node->ni_txseqs array in order to allocate sequence numbers when doing transmit aggregation. This should also be locked. * Drivers may have multiple frames queued already - so when one calls if_transmit(), it may end up dispatching multiple frames for different VAPs/nodes, each needing a different lock when handling that particular end destination. So to be "correct" locking-wise, we'd end up needing to grab a VAP or node lock inside the driver TX path when setting up crypto / AMPDU sequence numbers, and we may already _have_ a TX lock held - mostly for the same destination vap/node, but sometimes it'll be for others. That could lead to LORs and thus deadlocks. So for now, I'm sticking with an IC TX lock. It has the advantage of papering over the above and it also has the added advantage that I can assert that it's being held when doing a parent device transmit. I'll look at splitting the locks out a bit more later on. General outstanding net80211 TX path issues / TODO: * Look into separating out the VAP serialisation and the IC handoff. It's going to be tricky as parent->if_transmit() doesn't give me the opportunity to split queuing from driver dispatch. See above. * Work with monthadar to fix up the mesh transmit path so it doesn't go via the parent interface when retransmitting frames. * Push the encryption handling back into the driver, if it's at all architectually sane to do so. I know it's possible - it's what mac80211 in Linux does. * Make ieee80211_raw_xmit() queue a frame into VAP or parent queue rather than doing a short-cut direct into the driver. There are QoS issues here - you do want your management frames to be encapsulated and pushed onto the stack sooner than the (large, bursty) amount of data frames that are queued. But there has to be a saner way to do this. * Fragments are still broken - drivers need to be upgraded to an if_transmit() implementation and then fragmentation handling needs to be properly fixed. Tested: * STA - AR5416, AR9280, Intel 5300 abgn wifi * Hostap - AR5416, AR9160, AR9280 * Mesh - some testing by monthadar@, more to come.
* Add some further BAR TX debugging; it was useful when figuring outadrian2012-10-281-0/+47
| | | | when BAR TX was actually failing.
* Fix some corner cases in the ieee80211_send_bar() handling.adrian2012-05-221-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * If the first call succeeded but failed to transmit, a timer would reschedule it via bar_timeout(). Unfortunately bar_timeout() didn't check the return value from the ieee80211_send_bar() reattempt and if that failed (eg the driver ic_raw_xmit() failed), it would never re-arm the timer. * If BARPEND is cleared (which ieee80211_send_bar() will do if it can't TX), then re-arming the timer isn't enough - once bar_timeout() occurs, it'll see BARPEND is 0 and not run through the rest of the routine. So when rearming the timer, also set that flag. * If the TX wasn't occuring, bar_tx_complete() wouldn't be called and the driver callback wouldn't be called either. So the driver had no idea that the BAR TX attempt had failed. In the ath(4) case, TX would stay paused. (There's no callback to indicate that BAR TX had failed or not; only a "BAR TX was attempted". That's a separate, later problem.) So call the driver callback (ic_bar_response()) before the ADDBA session is torn down, so it has a chance of being notified that things didn't quite go to plan. I've verified that yes, this does suspend traffic for ath(4), retry BAR TX even if the driver is failing ic_raw_xmit(), and then eventually giving up and sending a DELBA. I'll address the "out of ath_buf" issue in ath(4) in a subsequent commit - this commit just fixes the edge case where any driver is (way) out of internal buffers/descriptors and fails frame TX. PR: kern/168170 Reviewed by: bschmidt MFC after: 1 month
* Migrate the net80211 TX aggregation state to be from per-AC to per-TID.adrian2012-04-151-31/+32
| | | | | | | | TODO: * Test mwl(4) more thoroughly! Reviewed by: bschmidt (for iwn)
* Add some statistics to track BAR TX.adrian2012-04-081-2/+8
|
* Create a new task to handle 802.11n channel width changes.adrian2012-03-251-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, a channel width change updates the 802.11n HT info data in net80211 but it doesn't trigger any device changes. So the device driver may decide that HT40 frames can be transmitted but the last device channel set only had HT20 set. Now, a task is scheduled so a hardware reset or change isn't done during any active ongoing RX. It also means that it's serialised with the other task operations (eg channel change.) This isn't the final incantation of this work, see below. For now, any unmodified drivers will simply receive a channel change log entry. A subsequent patch to ath(4) will introduce some basic channel change handling (by resetting the NIC.) Other NICs may need to update their rate control information. TODO: * There's still a small window at the present moment where the channel width has been updated but the task hasn't been fired. The final version of this should likely pass in a channel width field to the driver and let the driver atomically do whatever it needs to before changing the channel. PR: kern/166286
* MCS32 equals 32, not 8*ic_txstream.bschmidt2012-01-021-1/+1
|
* Fix some net80211 enum nits:bschmidt2011-12-171-3/+4
| | | | | | | | | | - ic_vap_create() uses an ieee80211_opmode argument - ieee80211_rate2media() takes an ieee80211_phymode argument - ieee80211_plcp2rate() takes an ieee80211_phytype argument - cast to enum ieee80211_protmode and ieee80211_roamingmode to silence compiler warnings Submitted by: arundel@
* Correctly handle BAR TX failures.adrian2011-08-191-1/+5
| | | | | | | | On a TX failure, ic_raw_xmit will still call ieee80211_node_free(). There's no need to call it here. Submitted by: moonlightakkiy@yahoo.ca Approved by: re (kib)
* Fix BAR frame TX completion - successful transmission is indicatedadrian2011-08-161-2/+2
| | | | | | by a status of 0. Approved by: re (kib)
* Add a callback for ADDBA response timeouts.adrian2011-06-201-0/+19
| | | | | | | | | | | | TX for the given TID needs to be paused during ADDBA requests (and unpaused once the session is established.) Since net80211 currently doesn't implement software aggregation, if this pause/unpause is done in the driver (as it is in my development branch) then it will need to be unpaused both on ADDBA response and on ADDBA timeout. This callback allows the driver to unpause TX for the relevant TID. Reviewed by: bschmidt
* Certain adapters have HT40 support on some but not all channels. Thebschmidt2011-06-041-0/+12
| | | | | | | | | | Intel 4965 devices for example have HT40 on 2GHz completely disabled but it is still supported for 5GHz. To handle that in sta mode we need to check if we can "upgrade" to a HT40 channel after the association, if that is not possible but we are still announcing support to the remote side we are left with a very flabby connection. Reviewed by: adrian
* Constantly use MHz instead of Mhz.bschmidt2011-03-131-5/+5
| | | | Pointed out by: N.J. Mann <njm at njm.me.uk>
* Honor device capabilities while initializing ni_htrates.bschmidt2011-03-131-9/+51
| | | | | | Instead of hardcoding MCS0-15 generate the table dynamically, also restrict the MCS rates to our own capabilities while parsing a htcap element.
* Fill hc_mcsset completely.bschmidt2011-03-131-14/+42
| | | | | | | | Contrary to the rateset information in legacy frames the MCS Set field also contains TX capability information in cases where the number of available TX and RX spartial streams differ. Because a rateset doesn't contain that information we have to pull the those directly from the hardware capabilities.
* Change the way HT capatibilities are announced.bschmidt2011-03-131-43/+88
| | | | | | | | | | | | | | | | Get rid of the assumption that every device is capable of 40MHz, SGI and 2 spartial streams. Instead of printing, in the worst case, 8 times 76 MCS rates, print logically connect ranges and the support RX/TX streams. A device without 40MHz and SGI support looks like: ath0: 2T2R ath0: 11na MCS 20Mhz ath0: MCS 0-7: 6.5Mbps - 65Mbps ath0: MCS 8-15: 13Mbps - 130Mbps ath0: 11ng MCS 20Mhz ath0: MCS 0-7: 6.5Mbps - 65Mbps ath0: MCS 8-15: 13Mbps - 130Mbps
* Complete the MCS rate table based on the final 802.11n std. While herebschmidt2011-03-101-18/+78
| | | | | | adjust the IEEE80211_HTRATE_MAXSIZE constant, only MCS0 - 76 are valid the other bits in the mcsset IE (77 - 127) are either reserved or used for TX parameters.
* Add a new field for extended HT capabilities.rpaulo2010-03-231-2/+11
| | | | | | Submitted by: Alexander Egorenkov <egorenar at gmail.com> MFC after: 2 weeks Sponsored by: iXsystems, inc.
* Unbreak build by removing a code bit that is only related to other coderpaulo2010-03-181-1/+1
| | | | in my branch.
* Fix a couple of bugs with 802.11n:rpaulo2010-03-181-23/+64
| | | | | | | | | | | o Process the BAR frame on the adhoc, mesh and sta modes o Fix the format of the ADDBA reply frame o Fix references to the spec section numbers Also, print the all the MCS rates in bootverbose. Sponsored by: iXsystems, Inc. Obtained from: //depot/user/rpaulo/80211n/...
* Revamp 802.11 action frame handling:sam2009-07-051-343/+365
| | | | | | | | | | | | | | o add a new facility for components to register send+recv handlers o ieee80211_send_action and ieee80211_recv_action now use the registered handlers to dispatch operations o rev ieee80211_send_action api to enable passing arbitrary data o rev ieee80211_recv_action api to pass the 802.11 frame header as it may be difficult to locate o update existing IEEE80211_ACTION_CAT_BA and IEEE80211_ACTION_CAT_HT handling o update mwl for api rev Reviewed by: rpaulo Approved by: re (kensmith)
* Correct ieee80211_gettid:sam2009-06-091-1/+1
| | | | | | | | | | o don't increment extracted tid, this was a vestige of IEEE80211_NONQOS_TID being defined as 0 (w/ real tid's +1) o handle 4-address frames (add IEEE80211_IS_DSTODS to check if an 802.11 header is DSTODS) Submitted by: cbzimmer Reviewed by: avatar
* iv_flags_ext is full, make room by moving HT-related flags to a newsam2009-06-071-37/+37
| | | | iv_flags_ht word
* distribute sysctl decls so global variables can be made staticsam2009-05-301-8/+23
|
* Overhaul monitor mode handling:sam2009-05-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | o replace DLT_IEEE802_11 support in net80211 with DLT_IEEE802_11_RADIO and remove explicit bpf support from wireless drivers; drivers now use ieee80211_radiotap_attach to setup shared data structures that hold the radiotap header for each packet tx/rx o remove rx timestamp from the rx path; it was used only by the tdma support for debugging and was mostly useless due to it being 32-bits and mostly unavailable o track DLT_IEEE80211_RADIO bpf attachments and maintain per-vap and per-com state when there are active taps o track the number of monitor mode vaps o use bpf tap and monitor mode vap state to decide when to collect radiotap state and dispatch frames; drivers no longer explicitly directly check bpf state or use bpf calls to tap frames o handle radiotap state updates on channel change in net80211; drivers should not do this (unless they bypass net80211 which is almost always a mistake) o update various drivers to be more consistent/correct in handling radiotap o update ral to include TSF in radiotap'd frames o add promisc mode callback to wi Reviewed by: cbzimmer, rpaulo, thompsa
* allow drivers to hook ampdu rx start/stopsam2009-04-261-10/+23
|
* o change ieee80211_mgmt_output to take a raw xmit parameters block sosam2008-10-261-1/+9
| | | | | | | | | the net80211 layer has complete control over the handling of mgt frames (in particular, the ac, tx rate, and retry count); this also allows us to purge the M_LINK0 flag that was attached to mbufs to mark them as needing encryption for shared key auth o change ieee80211_send_setup to take a tid parameter so it can be used to setup QoS frames
* Sync BAR frame handling with out of tree work:sam2008-10-251-52/+181
| | | | | | | | | | | | | o correct BAR frame construction for AMPDU o retransmit BAR frames until ACK'd or timeout (use tunables to control behaviour, default is very aggressive) o defer seq# update until BAR frame is ACK'd o add BAR response handling callback for driver to interpose and push new state to device or push pending aggregates While here also: o add backpointer to node in the per-tid tx aggregation data structure o move ampdu tx state setup/teardown work to separate functions
* cleanup after mergesam2008-09-221-1/+0
|
* Fix handling of shortgi: use the local configuration (and implicitlysam2008-09-221-0/+20
| | | | | device capabilities) to decide whether to use short gi. Drivers inspect ni_flags to decide whether to send a frame w/ short sgi.
* RIFS support; needs driver callback for dynamic state changesam2008-09-221-2/+22
|
* MIMO power save support; still needs callbacks for notifying driverssam2008-09-211-2/+50
| | | | of dynamic state change in station mode.
* Revamp ht ie handling:sam2008-09-211-42/+98
| | | | | | | | | | | | | | | o change ieee80211_parse_htcap and ieee80211_parse_htinfo to save only internal state obtained from the ie's; no dynamic state such as ni_chw is altered o add ieee80211_ht_updateparams to parse ht cap+info ie's and update dynamic node state o change ieee80211_ht_node_init to not take an htcap ie that is parsed; instead have the caller make a separate call as one caller wants to parse the ie while another wants to parse both cap+info ie's and update state so can better do this with ieee80211_ht_updateparams These changes fix sta mode state handling where the node's channel width was shifted to ht20/ht40 prematurely.
* don't propagate ht bss occupancy changes to legacy vaps;sam2008-09-211-0/+3
| | | | they won't have an htinfo ie to update
* change ieee80211_ampdu_stop to take an explicit reason codesam2008-09-211-5/+7
|
* simplify debug msgsam2008-09-211-3/+2
|
* Cleanup AMPDU handling:sam2008-09-211-4/+12
| | | | | | | | | | | | | | | | | | | | | | For receive: o explicitly tag rx frames w/ M_AMPDU instead of passing frames through the reorder processing according to the node having HT and the frame being QoS data o relax ieee80211_ampdu_reorder asserts to allow any frame to be passed in, unsuitable frames are returned to the caller for normal processing; this permits drivers that cannot inspect the PLCP to mark all data frames as potential ampdu candidates with only a small penalty o add M_AMPDU_MPDU to identify frames resubmitted from the reorder q For transmit: o tag aggregation candidates with M_AMPDU_MPDU o fix the QoS ack policy set in ampdu subframes; we only support immediate BA streams which should be marked for "normal ack" to get implicit block ack behaviour; interestingly certain vendor parts BA'd frames with the 11e BA ack policy set o do not assign a sequence # to aggregation candidates; this must be done when frames are submitted for transmit (NB: this can/will be handled better when aggregation is pulled up to net80211)
* Always update ic_lastnonht so we track overlapping legacy bsssam2008-09-211-10/+9
| | | | | | | properly; was doing this only on a change in the protection mode so the advertised protection mode in the beacon would oscillate. Submitted by: Chris Zimmermann
* Cleanup starting seq# for tx ampdu:sam2008-09-211-3/+5
| | | | | | o use txa_start to form the addba request and purge txa_seqstart o fill txa_start before calling ic_addba_request to permit drivers to override when they handle seq# generation (e.g. mwl)
* o kill IEEE80211_NODE_PSUPDATE; it was never usedsam2008-09-061-7/+5
| | | | | o kill IEEE80211_NODE_CHWUPDATE; it's use was pointless and it was defined wrong (overlap w/ existing flags)
* put back placeholder commentsam2008-09-061-0/+1
|
* o validate the ba policy in addba responsesam2008-09-061-1/+27
| | | | | o leave a check for the max ba window disabled; we accept out of range values and just truncate them but may want to act differently in the future
* add IEEE80211_NODE_HT_ALL to collect up all the HT-related node flagssam2008-09-061-2/+1
|
* don't do ampdu reordering of fragments; they should never happensam2008-09-061-1/+15
|
* moreve the aggregation q; it's not being used andsam2008-09-061-4/+0
| | | | there's a better way to do this
* add missing lock for htinfo updatesam2008-08-021-0/+2
| | | | Submitted by: Chris Zimmermann
OpenPOWER on IntegriCloud