summaryrefslogtreecommitdiffstats
path: root/sys/net80211
Commit message (Collapse)AuthorAgeFilesLines
* MFC r283313:ae2015-05-312-7/+19
| | | | | | | | | | | | Properly update TX statistics for wlan(4). ieee80211_pwrsave() can fail due to queue overflow, check its return code and increment oerrors counter when it fails. Also handle more error cases and update oerrors counter when we don't send mbuf due to some errors. Return ENETDOWN when parent interface isn't ready. Update obytes and omcasts counters in corresponding places. PR: 184626 Differential Revision: https://reviews.freebsd.org/D2621
* MFC r281383:eadler2015-04-131-1/+1
| | | | | iwn, wlan: fix typos Fxi tow typos
* MFC r263710, r273377, r273378, r273423 and r273455:hselasky2014-10-274-5/+5
| | | | | | | - De-vnet hash sizes and hash masks. - Fix multiple issues related to arguments passed to SYSCTL macros. Sponsored by: Mellanox Technologies
* MFC r260444:kevlo2014-02-178-19/+19
| | | | | | | | | | | | | Rename definition of IEEE80211_FC1_WEP to IEEE80211_FC1_PROTECTED. The origin of WEP comes from IEEE Std 802.11-1997 where it defines whether the frame body of MAC frame has been encrypted using WEP algorithm or not. IEEE Std. 802.11-2007 changes WEP to Protected Frame, indicates whether the frame is protected by a cryptographic encapsulation algorithm. Reviewed by: adrian, rpaulo
* Merge r257065 (by adrian) from head:gavin2013-12-103-8/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a use-after-free node reference issue when waiting for a return from a management frame transmission. This bug is a bit loopy, so here goes. The underlying cause is pretty easy to understand - the node isn't referenced before passing into the callout, so if the node is deleted before the callout fires, it'll dereference free'd memory. The code path however is slightly more convoluted. The functions _say_ mgt_tx - ie management transmit - which is partially true. Yes, that callback is attached to the mbuf for some management frames. However, it's only for frames relating to scanning and authentication attempts. It helpfully drives the VAP state back to "SCAN" if the transmission fails _OR_ (as I subsequently found out!) if the transmission succeeds but the state machine doesn't make progress towards being authenticated and active. Now, the code itself isn't terribly clear about this. It _looks_ like it's just handling the transmit failure case. However, when you look at what goes on in the transmit success case, it's moving the VAP state back to SCAN if it hasn't changed state since the time the callback was scheduled. Ie, if it's in ASSOC or AUTH still, it'll go back to SCAN. But if it has transitioned to the RUN state, the comparison will fail and it'll not transition things back to the SCAN state. So, to fix this, I decided to leave everything the way it is and merely fix the locking and remove the node reference. The _better_ fix would be to turn this callout into a "assoc/auth request" timeout callback and make the callout locked, thus eliminating all races. However, until all the drivers have been fixed so that transmit completions occur outside of any locking that's going on, it's going to be impossible to do this without introducing LORs. So, I leave some of the evilness in there. Candidate for 10.0.
* Merge r256294 (by adrian) from head:gavin2013-12-101-2/+2
| | | | | | | | | | | | | | Fix the "am I a net80211 vap" check for bpf listeners. I changed it to use if_transmit a while ago but apparently with monitor mode the if_transmit method is overridden. This is (mostly) a workaround until a more permanent solution can be found. Candidate for 10.0. Submitted by: Patrick Kelsey <kelsey@ieee.org>
* Merge r258758 (by adrian) from head:gavin2013-12-101-0/+1
| | | | | | | | | | Make sure any waiters on the scan results get notified if the scan task decides to do nothing. If this isn't done, then a scan request whilst a scan occurs in an active channel set or a completed channel set will hang. Candidate for 10.0.
* Merge r257754 (by adrian) from head:gavin2013-12-101-4/+8
| | | | | | | | | Don't return ENOBUFS if the transmit path handles the frame but queues it (eg in power save.) 10.0 candidate. PR: kern/183727
* Create a new function to complete 802.11 mbuf transmission.adrian2013-08-272-0/+33
| | | | | | | | | | | | | | | | | The aim of this function is to eventually be the completion entry point for all 802.11 encapsulated mbufs. All the wifi drivers end up doing what is in this function so it's an easy win to turn it into a net80211 method and abstract out this code. Ideally the drivers will all eventually be modified to queue up completed mbufs and call this function with all the driver locks not held. This will allow for some much more interesting software queue handling in the future (like net80211 based A-MSDU, fast-frames, A-MPDU aggregation and retransmission.) Tested: * ath(4), iwn(4)
* Migrate the ff_encap1() routine out into the normal output code.adrian2013-08-263-39/+42
| | | | | This will eventually be used by the A-MSDU encapsulation code that I'm writing - the sub-frame encapsulation requirement is the same.
* Add in some backwards compatability hacks to make -HEAD net80211 compileadrian2013-08-223-0/+27
| | | | on -9.
* Reorder the mbuf defines to make more sense and group related flagsandre2013-08-191-8/+5
| | | | | | | | | | | | | | together. Add M_FLAG_PRINTF for use with printf(9) %b indentifier. Use the generic mbuf flags print names in the net80211 code and adjust the protocol specific bits for their new positions. Change SCTP M_PROTO mapping from 5 to 1 to fit within the 16bit field they use internally to store some additional information. Discussed with: trociny, glebius
* Migrate the net80211 protocol specific use of M_FRAG, M_FIRSTFRAG andandre2013-08-191-2/+5
| | | | | | | | M_LASTFRAG flags to protocol specific flags. Remove the now unused M_FRAG, M_FIRSTFRAG and M_LASTFRAG mbuf flags. Discussed with: trociny, glebius, adrian
* Add m_clrprotoflags() to clear protocol specific mbuf flags at up andandre2013-08-192-2/+4
| | | | | | | | downwards layer crossings. Consistently use it within IP, IPv6 and ethernet protocols. Discussed with: trociny, glebius
* Don't return ENOTSUPP here - the net80211 pluggable ioctl API will treatadrian2013-08-181-2/+2
| | | | | | this as the final item in the linker set and not try others. This stopped the fast frames IOCTLs from being called.
* Return the correct status if ieee80211_ff_check() consumes the mbuf.adrian2013-08-181-2/+1
| | | | I broke this when converting the net80211 TX path to use if_transmit.
* Replace the homegrown implementation of nitems() with calls to nitems()rpaulo2013-08-146-56/+37
| | | | | | | | | (param.h). Operating systems that don't have nitems() can easily define it on their own net80211 OS-specific header file. Discussed with: adrian
* Blank m_nextpkt before passing it up.adrian2013-08-121-0/+1
|
* When flushing packets from the powersave queue, make sure thatadrian2013-08-121-0/+1
| | | | | m_nextpkt is NULL before passing it up to the parent transmit method.
* Add in missing m_free()'s during error conditions.adrian2013-08-101-0/+6
|
* Convert net80211 over to using if_transmit for the dispatch from theadrian2013-08-0812-61/+54
| | | | | | | | | | | | | | | | | | | | | | | | upper layer(s). This eliminates the if_snd queue from net80211. Yay! This unfortunately has a few side effects: * It breaks ALTQ to net80211 for now - sorry everyone, but fixing parallelism and eliminating the if_snd queue is more important than supporting this broken traffic scheduling model. :-) * There's no VAP and IC flush methods just yet - I think I'll add some NULL methods for now just as placeholders. * It reduces throughput a little because now net80211 will drop packets rather than buffer them if the driver doesn't do its own buffering. This will be addressed in the future as I implement per-node software queues. Tested: * ath(4) and iwn(4) in STA operation
* Allow net80211 to compile on stable/9 and stable/8.adrian2013-08-074-0/+22
|
* Fix compilation when debugging is disabled.adrian2013-07-281-2/+1
|
* Commit the missing header change.adrian2013-07-281-0/+2
|
* Refactor the VAP transmit path code into a utility function that bothadrian2013-07-282-217/+155
| | | | | | | | | | the normal and the mesh transmit paths can use. The API is a bit horrible because it both consumes the mbuf and frees the node reference regardless of whether it succeeds or not. It's a hold-over from how the code behaves; it'd be nice to have it not free the node reference / mbuf if TX fails and let the caller decide what to do.
* Add ieee80211_add_{qos,wpa,rsn}() functions since they are needed by anrpaulo2013-07-253-40/+46
| | | | | | OpenBSD driver that is being ported to FreeBSD. Reviewed by: adrian
* Make kassert_printf use __printflike.alfred2013-07-071-1/+1
| | | | | | Fix associated errors/warnings while I'm here. Requested by: avg
* Add a missing unlock.adrian2013-07-051-0/+1
|
* Document the current 11n rate selection shortcoming in the AMRR code.adrian2013-07-051-0/+8
|
* Implement basic 802.11n awareness in the PHY and AMRR rate control code.adrian2013-07-043-30/+315
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add 802.11n 2ghz and 5ghz tables, including legacy rates and up to MCS23 rates (3x3.) * Populate the rate code -> rate index lookup table with MCS _and_ normal rates, but _not_ the basic rate flag. Since the basic rate flag is the same as the MCS flag, we can only use one. * Introduce some accessor inlines that do PLCP and rate table lookup/access and enforce that it doesn't set the basic rate bit. They're not designed for MCS rates, so it will panic. * Start converting drivers that use the rate table stuff to use the accessor inlines and strip the basic flag. * Teach AMRR about basic 11n - it's still as crap for MCS as it is being used by iwn, so it's not a step _backwardS_. * Convert iwn over to accept 11n MCS rates rather than 'translate' legacy to MCS rates. It doesn't use a lookup table any longer; instead it's a function which takes the current node (for HT parameters) and the rate code, and returns the hardware PLCP code to use. Tested: * ath - it's a no-op, and it works that way * iwn - both 11n and non-11n
* Don't panic the kernel if we run wpa_supplicant on a hostap VAP.rpaulo2013-06-291-1/+3
| | | | Reviewed by: adrian
* Fix typo (dbM -> dBm)eadler2013-06-141-1/+1
| | | | | Submitted by: Daan@vitsch.nl Reviewed by: adrian
* Don't hold the node lock over the iterator.adrian2013-06-071-4/+24
| | | | | | | | | | | | | | | | The "find node" function call will increase the node reference anyway; so there's no reason to hold the node table lock during the MLME change. The only reason I could think of is to stop overlapping mlme ioctls from causing issues, but this should be fixed a different way. This fixes a whole class of LORs that creep up when nodes are being timed out or removed by hostapd. Tested: * AR5416, hostap, with nodes coming and going. No LORs or stability issues were observed.
* Fix net80211 fragment creation.adrian2013-05-251-4/+15
| | | | | | | | | | | | | | | When creating fragment frames, the header length should honour the DATAPAD flag. This fixes the fragments that are queued to the ath(4) driver but it doesn't yet fix fragment transmission. That requires further changes to the ath(4) transmit path. Well, strictly speaking, it requires further changes to _all_ wifi driver transmit paths, but this is at least a start. Tested: * AR5416, STA mode, w/ fragthreshold set to 256.
* 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
* Add const qualifier to the dst parameter of the ifnet if_output method.glebius2013-04-264-4/+4
|
* Implement a utility function to return the current TX power cap foradrian2013-04-161-0/+22
| | | | | | | | | | | | the given node. This takes into account the per-node cap, the ic cap and the per-channel regulatory caps. This is designed to replace references to ni_txpower in various net80211 drivers - ni_txpower doesn't necessarily reflect the actual cap for the given node (eg if the node has the default value of 50dBm (100) and the administrator has manually configured a lower TX power.)
* Add VNET wrappers around the rest of the ieee80211 rtsock messages.adrian2013-03-201-0/+10
| | | | I triggered the cac/radar messages when doing testing in DFS channels.
* Kill this, it's not needed at this point and (hopefully) the parentadrian2013-03-101-2/+0
| | | | has correctly locked the ic/vap.
* Fix another compiler warning issue when invariants are disabled.adrian2013-03-091-2/+1
|
* Fix non-invariant compilation.adrian2013-03-091-6/+3
|
* Bring over my initial work from the net80211 TX locking branch.adrian2013-03-0813-250/+458
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Disable this variable; the code using it is also disabled.adrian2013-02-181-0/+2
|
* Disable this code and add a note as to why.adrian2013-02-181-0/+15
| | | | | It wasn't currently being called anyway - but being explicit about it can't hurt.
* Fix an incorrect sizeof()adrian2013-02-161-1/+1
| | | | | | Spotted by: clang Submitted by: dim
* Mesh: QoS Control field bit flags fix.monthadar2013-02-141-3/+3
| | | | | | | | | | * The following bit flags where incroccetly defined: o Mesh Control Present o Mesh Power Save Level o RSPI This is now corrected according to Table 8.4 as per IEEE 802.11 2012; Approved by: adrian (mentor)
* Substitute '#ifdef ALIGNED_POINTER' with '#ifndef __NO_STRICT_ALIGNMENT',glebius2013-02-123-4/+6
| | | | | | | | since the former is defined everywhere. This cuts off some code not necessary on non strict aligment arches. Reviewed by: adrian Sponsored by: Nginx, Inc.
* Fix ieee80211_mesh.c compilation.adrian2013-02-081-0/+4
| | | | | | * Add the superg.h header to allow ieee80211_check_ff() to work * Since the assert stuff creates assertions based on line numbers and there was a conflict, just nudge things down a bit.
* Mesh: recevied GANN frames where not parsed correctly.monthadar2013-02-071-26/+66
| | | | | | | * Added mesh_parse_meshgate_action that parse all values to host endian; * Add more detailed debug output; Approved by: adrian (mentor)
* Mesh HWMP forwarding information: updating FI for transmitter.monthadar2013-02-071-5/+44
| | | | | | | | | * Added hwmp_update_transmitter function that checks if the metric to the transmitter have improved. If old FI is invalid or metric is larger the FI to the transmitter is updated occurdingly. This is a recommendation from the 802.11 2012 standard, table 13-9; Approved by: adrian (mentor)
OpenPOWER on IntegriCloud