summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_hwmp.c
Commit message (Collapse)AuthorAgeFilesLines
* Convert net80211 over to using if_transmit for the dispatch from theadrian2013-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Bring over my initial work from the net80211 TX locking branch.adrian2013-03-081-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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)
* Mesh HWMP PERR bug fixes.monthadar2013-02-071-1/+1
| | | | | | | | | * When calling ieee80211_mesh_rt_flush_peer, the rt->rt_dest argument should not be passed because it can get freed before invalidating the other routes that depends on it to compare with next_hop. Use PERR_DADDR(i) instead; Approved by: adrian (mentor)
* Mesh HWMP PREQ: fixed conditions for discarding elements.monthadar2013-02-071-4/+4
| | | | Approved by: adrian (mentor)
* Mesh HWMP: don't send an intermediate PREP for proxy entries.monthadar2013-02-071-1/+3
| | | | | | | | | * The standard is unclear about what should happen in case a mesh STA (not marked as a mesh gate) recevies a PREQ for a destination that is marked as proxy. Solution for now is not to do intermediate reply at all, and let the PREQ reach the mesh gate; Approved by: adrian (mentor)
* Mesh HWMP PREQ update: proxy reply only if mesh STA is a meshgate.monthadar2013-02-071-3/+6
| | | | | | | | | * Original PREP frame is transmitted only by the target mesh STA or the mesh STA that is the proxy target; * Fixed so that metric value is not over written incorrectly in hwmp_recv_preq for when replying back with a PREP; Approved by: adrian (mentor)
* HWMP: ic->raw_xmit didn't always point to correct ni.monthadar2013-02-071-68/+51
| | | | | | | | | | | | | | | | | | | This is a code re-write. ic->raw_xmit need a pointer to ieee80211_node for the destination node (da). I have reorganized the code so that a pointer to the da node is searched for in the end & in one place. * Make mesh_find_txnode public to be used by HWMP, renamed to ieee80211_mesh_finx_txnode; * changed the argument from ieee80211_node to ieee80211vap for all hwmp_send_* functions; * removed the 'sa' argument from hwmp_send_* functions as all HWMP frames have the source address equal to vap->iv_myaddr; * Modified hwmp_send_action so that if da is MULTCAST ni=vap->iv_bss otherwise we called ieee80211_mesh_find_txnode. Also no need to hold a reference in this functions if da is not MULTICAST as by finding the node it became referenced in ieee80211_find_txnode; Approved by: adrian (mentor)
* Send frames to mesh gate if 11s discovery fails.monthadar2013-02-071-6/+11
| | | | | | | | | | | | * Send frames that have no path to a known valid Mesh Gate; * Added the function ieee80211_mesh_forward_to_gates that sends the frame to the first found Mesh Gate in the forwarding information; * If we try to discover again while we are discovering queue frame, the discovery callout will send the frames either to mesh gates or discards them silently; * Queue frame also if we try to discover to frequently; Approved by: adrian (mentor)
* Mark root mesh as gate when mesh gate flag set.monthadar2013-02-071-0/+19
| | | | | | | | * Add function ieee80211_mesh_mark_gate in ieee80211_mesh.h; * When received a proactive PREQ or RANN with corresponding mesh gate flag set, create a new entry in the known mesh gate list; Approved by: adrian (mentor)
* Mesh update: add base Mesh Gate functionality.monthadar2013-02-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | A Mesh Gate should transmit a Mesh Action frame containing ieee80211_meshgann_ie as its only information element periodically every ieee80211_mesh_gateint ms. Unless the mesh gate is also configure as a ROOT, then these frames should not be send. This is according to 802.11 2012 standard; * Introduce new SYSCTL net.wlan.mesh.gateint, with 10s default; * Add two new functions mesh_gatemode_setup and mesh_gatemode_cb. This is similar to how HWMP setups up a callout; * Add two new action handlers mesh_recv_action_meshgate and mesh_send_action_meshgate; * Added ieee80211_add_meshgate to ieee80211_mesh.h; * Modified mesh_send_action to look similar to hwmp_send_action. This is because we need to send out broadcast management frames. * Introduced a new flag for mesh state IEEE80211_MESHFLAGS_ROOT. This flag is now set by HWMP code when a mesh STA is configured as a ROOT. This is then checked by mesh_gatemode_cb before scheduling a new callout; * Added to new field to ieee80211_mesh_state: + struct callout ms_gatetimer + ieee80211_mesh_seq ms_gateseq; Approved by: adrian (mentor)
* Mesh: management mesh action frames are to be discardedmonthadar2013-02-071-14/+1
| | | | | | | | | | | | when not peered. * Modified ieee80211_recv_action to check if neighbour is peered for IEEE80211_ACTION_CAT_MESH frames, if not frame is discarded. This is according to IEEE802.11 2012 standard; * Removed duplicate checks in each hwmp_recv_* handlers because HWMP is a subtype of mesh action; Approved by: adrian (mentor)
* HWMP: Accept a PERR even if path is valid.monthadar2013-02-071-1/+1
| | | | | | | * An HWMP PERR should be accepted even if path is valid. Because we check if we recevied it from a neighbour that we use as a next hop; Approved by: adrian (mentor)
* Fix mesh path flag.monthadar2013-02-071-2/+5
| | | | | | | | | * A bug occurs while in discovery mode which leaves a path marked with both Discover and Valid flag. This happens when receiving/sending PREQ and PREP in a particular order. Solution is to assign the Valid bit instead of oring it; Approved by: adrian (mentor)
* Handle HWMP if_transmit() failure gracefully.adrian2013-01-061-1/+13
| | | | | | | | | If if_transmit() fails, the node ref may need freeing. This is based on the same logic used by the ageq, which the mesh code (re) uses for frames which need to be staged before transmitting. It also does the same thing - if M_ENCAP is set on the mbuf, it treats the recvif pointer as a node reference and derefs it.
* Mechanically substitute flags from historic mbuf allocator withglebius2012-12-051-1/+1
| | | | | | | | | malloc(9) flags within sys. Exceptions: - sys/contrib not touched - sys/mbuf.h edited manually
* Fixed some debug output in hwmp_recv_prep.monthadar2012-07-311-3/+3
|
* Fix a PREQ comparison error in 11s HWMP.monthadar2012-07-311-3/+4
| | | | | | | | * Earlier we compared two not equal metrics, one was what we recevied in the 'new PREQ' while the other was what we already have saved which was 'old PREQ' + link metric for the last hop; * Fixed by adding 'new PREQ' + link metric for the last hop in a temporary variable;
* Fix bugs in net80211s found with wtap simulator.monthadar2012-07-311-4/+6
| | | | | | | For description of the test scripts refer to projects/net80211_testsuite/wtap. * Test 007 showed a bug in intermediate PREP for a proxy entry. Resolved; * Test 002 showed a bug in the Addressing Mode flag for a PREQ. Resolved;
* Update HWMP Proactive code and mesh route flags.monthadar2012-05-011-20/+10
| | | | | | | | | | | | | * Modified hwmp_recv_preq: o cleaned up code, removed rootmac variable because preq->origaddr is the root when we recevie a Proactive PREQ; o Modified so that a PREP in response of a Proactive PREQ is unicast, a PREP is ALWAYS unicast; * Modified hwmp_recv_prep: o Before we mark a route to be valid we should remove the discovery flag and then mark it valid in such a way we wont lose the isgate flag; Approved by: adrian
* PREQ discovery update.monthadar2012-05-011-4/+63
| | | | | | | | | | | | | | * Added a new discovery flag IEEE80211_MESHRT_FLAGS_DISCOVER; * Modified ieee80211_ioctl.h to include IEEE80211_MESHRT_FLAGS_DISCOVER; * Added hwmp_rediscover_cb, which will be called by a timeout to do rediscovery if we have not reach max number of preq discovery; * Modified hwmp_discover to setup a callout for path rediscovery; * Added to ieee80211req_mesh_route to have a back pointer to ieee80211vap for the discovery callout context; * Modified mesh_rt_add_locked arguemnt from ieee80211_mesh_state to ieee80211vap, this because we have to initialize the above back pointer; Approved by: adrian
* Net80211s update: Mesh Gate Announcement and removal of Portal Announcement.monthadar2012-05-011-5/+5
| | | | | | | | | | | | | | | * Renamed IEEE80211_ELEMID_MESHPANN to IEEE80211_ELEMID_MESHGANN according to amendment; * Added IEEE80211_IOC_MESH_GATE that controls whether Mesh Gate Announcement is activated or not; * Renamed all flags from Portal to Gate in HWMP frames; * Removed IEEE80211_ACTION_MESHPANN enum cause its part of the Mesh Action category now as per amendment; * Renamed IEEE80211_MESHFLAGS_PORTAL to IEEE80211_MESHFLAGS_GATE in ieee80211_mesh_state flags; * Modified ieee80211_hwmp.c/ieee80211_mesh.c to use new GATE flags; Approved by: adrian
* RANN updatemonthadar2012-05-011-17/+82
| | | | | | | | | * Introduced a new HWMP sysctl, Root Confirmation Interval; * Added hr_lastrootconf to hwmp_route, is for ratecheck for a specific ROOT; * We missed reading RANN.interval subfield from a RANN frame before; * Updated hwmp_recv_rann according to amendment, see comments; Approved by: adrian
* PERR update to be called from mesh code.monthadar2012-05-011-1/+63
| | | | | | | | | | | | * Added mpp_senderror for Mesh Path Selection protocol; * Added hwmp_senderror that will send an HWMP PERR according to the supplied reason code; * Call mpp_senderror when deleting a route with correct reason code for whether the route is marked proxy or not; * Call mpp_senderror when trying to forward an individually addressed frame and there is no forwarding information; Approved by: adrian
* * Modified PERR acceptance criteria according to amendment;monthadar2012-05-011-25/+82
| | | | | | * Modified how PERR is handled and propagated according to amendment; Approved by: adrian
* Updated PREQ propagation code;monthadar2012-05-011-74/+65
| | | | | | | | | * When receiving a Proactive PREQ dont return after processing it but propagate; * When we propagate we should not enforce ratechecking; * Added checking for multiple pred ID detection; * Storing proxy orig address when PREQ is not for us; Approved by: adrian
* * PREQ acceptance criteria updated to check for proxy condition as in amendment;monthadar2012-05-011-6/+9
| | | | Approved by: adrian
* * Proactive PREQ (original transmission) must also setmonthadar2012-05-011-1/+2
| | | | | | IEEE80211_MESHPREQ_TFLAGS_USN flag in target_flag field; Approved by: adrian
* * Fixed hwmp_discover code to populate a PREQ packet correctly;monthadar2012-05-011-11/+3
| | | | | | | * Removed IEEE80211_MESHPREQ_TFLAGS_RF which is no longer part of the amendment spec; Approved by: adrian
* * Fixed PREQ flag field Adressing mode subfiled according to amendment specs;monthadar2012-05-011-4/+4
| | | | Approved by: adria
* * Added a mesh max PREQ retires sysctl that governous how many timesmonthadar2012-05-011-2/+38
| | | | | | | | we try to discover an address; * Added a mesh net travelse time across an MBSS, which is used to enforce discovery rate check; Approved by: adrian
* Change how we enforce PREQ minimum interval.monthadar2012-05-011-24/+33
| | | | | | | | | | | * Moved hs_lastpreq to be hr_lastpreq cause this rate check should be per target mesh STA according to amendment (NB: not applicable for PERR); * Modified hwmp_send_preq to use two extra arguments for last sent PREQ and minimum PREQ interval; * hwmp_send_preq is called with last two arguments equal to NULL when sending Proactive PREQs cause the call back task enforces the rate check; Approved by: adrian
* PREP updatemonthadar2012-05-011-65/+60
| | | | | | | | | | | | | | | | | | | | * Added assertion in mesh_rt_update; * Fixed some prep propagation that where multicast, ALL PREPS ARE UNICAST; * Fixed PREP acceptance criteria; * Fixed some PREP debug messages; * HWMP intermediate reply (PREP) should only be sent if we have newer forwarding infomration (FI) about target; * Fixed PREP propagation condition and PREP w/ AE handling; * Ignore PREPs that have unknown originator. * Removed old code inside PREP that was for proactive path building to root mesh; Other errors include: * use seq number of target and not orig mesh STA; * Metric is what we have stored in our FI; * Error in amendment, Hop count is not 0 but equals FI hopcount for target; Approved by: adrian
* Mesh forwarding with proxy support.monthadar2012-05-011-63/+121
| | | | | | | | | | | | | | | | | | | | | | * Modified HWMP PREP/PREQ to contain a proxy entry and also changed PREP frame processing according to amendment as following: o Fixed PREP to always update/create if acceptance criteria is meet; o PREQ processing to reply if request is for a proxy entry that is proxied by us; o Removed hwmp_discover call from PREQ, because sending a PREP will build the forward path, and by receving and accepting a PREQ we have already built the reverse path (non-proactive code); * Disabled code for pro-active in PREP for now (will make a separate patch for pro-active HWMP routing later) * Added proxy information for a Mesh route, mesh gate to use and proxy seqno; * Modified ieee80211_encap according to amendment; * Introduced Mesh control address extension enum and removed unused struct, also rename some structure element names. * Modified mesh_input and added mesh_recv_* that should verify and process mesh data frames according to 9.32 Mesh forwarding framework in amendment; * Modified mesh_decap accordingly to changes done in mesh control AE struct; Approved by: adrian
* Implemented so that Mesh forwarding information lifetime is dynamic.monthadar2012-05-011-12/+10
| | | | | | | | | | | | | | | * Introduced ieee80211_mesh_rt_update that updates a route with the maximum(lifetime left, new lifetime); * Modified ieee80211_mesh_route struct by adding a lock that will be used by both ieee80211_mesh_rt_update and precursor code (added in future commit); * Modified in ieee80211_hwmp.c HWMP code to use new ieee80211_mesh_rt_update; * Modified mesh_rt_flush_invalid to use new ieee80211_mesh_rt_update; * mesh_rt_flush also checks that lifetime == 0, this gives route discovery a change to complete; * Modified mesh_recv_mgmt case IEEE80211_FC0_SUBTYPE_BEACON: when ever we received a beacon from a neighbor we update route lifetime; Approved by: adrian
* Modify HWMP to be able to allocate memory for PREQ/PREP/PERR for all scenarios.adrian2012-03-061-65/+273
| | | | | | | | | | | | | | | * Added verify_mesh_*_len functions that verify the length according to the amendment spec and return number of destination addresses for allocation of appropriate struct size in memory; * Modified hwmp_recv_action_meshpath to allocate HWMP ie instead of storing them on the stack and store all available field according the flags; * Modify hwmp_add_mesh* to work with all cases of HWMP according to amendment. * Modify hwmp_send_* to calculate correct len of bytes for the HWMP ie. * Added new M_80211_MESH_* malloc defines. * Added macros with magic numbers for HWMP ie sizes according to amendment. * Added the external address to all HWMP ie structs. Submitted by: monthadar@gmail.com
* * Added IEEE80211_ACTION_CAT_MESH in ieee80211.h as specified amendment spec;adrian2012-03-041-4/+4
| | | | | | | | | | | | | | | | | * Moved old categories as specified by D4.0 to be action fields of MESH category as specified in amendment spec; * Modified functions to use MESH category and its action fields: + ieee80211_send_action_register + ieee80211_send_action + ieee80211_recv_action_register +ieee80211_recv_action; * Modified ieee80211_hwmp_init and hwmp_send_action so they uses correct action fields as specified in amendment spec; * Modified ieee80211_parse_action so that it verifies MESH frames. * Change Mesh Link Metric to use one information element as amendment spec. Draft 4.0 defined two different information elements for request and response. Submitted by: monthadar@gmail.com
* Missing code for receiving MESH PREP that should be part of r230409.adrian2012-01-291-6/+15
| | | | Submitted by: <monthadar@gmail.com>
* Fix the hwmp code to handle nodes in a "line" topology.adrian2012-01-211-39/+99
| | | | | | | | | | For example, this particular topology didn't work correctly from all nodes: [A] - [B] - [C] - [D] Submitted by: Monthadar Al Jaberi <monthadar@gmail.com> Reviewed by: bschmidt, adrian
* Change the hwmp debugging to use %6D rather than ether_sprintf().adrian2012-01-211-35/+36
| | | | | | | | This allows for multiple MAC addresses to be printed on the same debugging line. ether_sprintf() uses a static char buffer and thus isn't very useful here. Submitted by: Monthadar Al Jaberi <monthadar@gmail.com>
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-071-1/+1
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Add missing braces.rpaulo2010-06-101-1/+2
| | | | | Submitted by: sam MFC after: 3 days
* Don't reference null pointer in hwmp_recv_preq().rpaulo2010-06-011-0/+3
| | | | | | Found with: Coverity Prevent(tm) CID: 3912 MFC after: 3 days
* Update the route's sequence number upon receiving a RANN.rpaulo2009-10-291-9/+12
| | | | MFC after: 3 days
* Initialize rann_flags properly.rpaulo2009-10-221-0/+1
| | | | MFC after: 2 days
* Fix a bug in composing PERR frames introduced by latest draft update.rpaulo2009-10-191-1/+2
| | | | MFC after: 3 days
* HWMP fixes, namely:rpaulo2009-10-191-31/+32
| | | | | | | | * fix the processing of RANN frames * the originator and target addresses were swapped and while it worked fine, it was not spec compliant. MFC after: 3 days
* Another 3.03 draft bit that I missed in the previous 802.11s stackrpaulo2009-10-121-1/+1
| | | | | | | update. The Mesh Configuration IE has changed quite a bit. Refactor the code to handle this change. MFC after: 3 days
* Update 802.11s mesh support to draft 3.03. This includes a revised framerpaulo2009-09-221-94/+61
| | | | | | | | format for peering and changes to the PERR frames. Note that this is incompatible with the previous code. Reviewed by: sam MFC after: 1 week
* Mesh fixes, namely:rpaulo2009-07-271-72/+106
| | | | | | | | | | | | * don't clobber proxy entries * HWMP seq number processing, including discard of old frames * flush routing table entries based on nexthop * print route flags in ifconfig * more debugging messages and comments Proxy changes submitted by sam. Approved by: re (kib)
OpenPOWER on IntegriCloud