path: root/net/mac80211/mesh_hwmp.c
AgeCommit message (Collapse)AuthorLines
2016-04-06mac80211: fix "warning: ‘target_metric’ may be used uninitialized"Jeff Mahoney-1/+1
This fixes: net/mac80211/mesh_hwmp.c:603:26: warning: ‘target_metric’ may be used uninitialized in this function target_metric is only consumed when reply = true so no bug exists here, but not all versions of gcc realize it. Initialize to 0 to remove the warning. Signed-off-by: Jeff Mahoney <> Signed-off-by: Johannes Berg <>
2016-03-04mac80211: use reset to set header pointerZhang Shengju-3/+3
Since offset is zero, it's not necessary to use set function. Reset function is straightforward, and will remove the unnecessary add operation in set function. Signed-off-by: Zhang Shengju <> Signed-off-by: David S. Miller <>
2015-10-21mac80211: move station statistics into sub-structsJohannes Berg-1/+1
Group station statistics by where they're (mostly) updated (TX, RX and TX-status) and group them into sub-structs of the struct sta_info. Also rename the variables since the grouping now makes it obvious where they belong. This makes it easier to identify where the statistics are updated in the code, and thus easier to think about them. Signed-off-by: Johannes Berg <>
2015-07-17mac80211: mesh: move fail_avg into mesh structJohannes Berg-4/+5
This value is only used in mesh, so move it into the new mesh sub-struct of the station info. Signed-off-by: Johannes Berg <>
2015-07-17mac80211: mesh process the target only subfield for mesh hwmpChun-Yeow Yeoh-24/+8
This patch does the following: - Remove unnecessary flags field used by PERR element - Use the per target flags defined in <linux/ieee80211.h> - Process the target only subfield based on case E2 of IEEE802.11-2012 Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: Johannes Berg <>
2015-07-17mac80211: mac80211: Check SN for deactivated mpathsJesse Jones-0/+26
When processing a PREQ or PREP it's critical to use the incoming SN. If that is improperly done routing loops and other types of badness can happen. But the code was always processing path messages for deactivated paths. This path fixes that so that if we have a valid SN then we use it to verify that it is a message we can accept. For reference the relevant section of the standard is which doesn't address the deactivated path case at all. I also included a special case for when our peer reboots or restarts networking. This is an important case because without it there can be a very long delay before we accept path messages from that peer. It's also a simple case and intimately associated with processing messages for deactivated paths so I used one patch instead of two. Signed-off-by: Alexis Green <> Signed-off-by: Johannes Berg <>
2015-07-17mac80211: mesh: don't invalidate SN on discovery failureJesse Jones-1/+3
The 2012 spec mentions that path SNs can be invalid when created (see section table 13-9) but AFAICT never talks about invalidating SNs. Which makes sense: if we have figured out the path to a target at a certain SN then we want to remember that fact. Failing to do so can lead to routing loops because if we don't have a valid SN then we have no way of knowing whether an incoming path message leads to or away from the target. However currently when discovery fails we zero out mpath->flags which clears MESH_PATH_SN_VALID. This patch fixes that so that only the discovery relevant flags are cleared. Signed-off-by: Alexis Green <> Signed-off-by: Johannes Berg <>
2015-07-17mac80211: mesh: add missing case to PERR processingAlexis Green-2/+5
When the nexthop is unable to resolve its own nexthop it will send back a PERR with a zero target_sn. According to section step b in the 2012 standard that perr should be forwarded and the associated mpath->sn should be incremented. Neither one of those was happening which is rather bad because the originator was not told that packets are black holing. Signed-off-by: Alexis Green <> CC: Jesse Jones <> Signed-off-by: Johannes Berg <>
2015-07-17mac80211: move mesh related station fields to own structJohannes Berg-1/+1
There are now a fairly large number of mesh fields that really aren't needed in any other modes; move those into their own structure and allocate them separately. Signed-off-by: Johannes Berg <>
2015-06-10mac80211: Fix a case of incorrect metric used when forwarding a PREQAlexis Green-9/+8
This patch fixes a bug in hwmp_preq_frame_process where the wrong metric can be used when forwarding a PREQ. This happens because the code uses the same metric variable to record the value of the metric to the source of the PREQ and the value of the metric to the target of the PREQ. This comes into play when both reply and forward are set which happens when IEEE80211_PREQ_PROACTIVE_PREP_FLAG is set and when MP_F_DO | MP_F_RF is set. The original code had a special case to handle the first case but not the second. The patch uses distinct variables for the two metrics which makes the code flow much clearer and removes the need to restore the original value of metric when forwarding. Signed-off-by: Alexis Green <> CC: Jesse Jones <> Signed-off-by: Johannes Berg <>
2015-06-09mac80211: Fix incorrectly named last_hop_metric variable in ↵Alexis Green-9/+9
mesh_rx_path_sel_frame The last hop metric should refer to link cost (this is how hwmp_route_info_get uses it for example). But in mesh_rx_path_sel_frame we are not dealing with link cost but with the total cost to the origin of a PREQ or PREP. Signed-off-by: Alexis Green <> CC: Jesse Jones <> Signed-off-by: Johannes Berg <>
2014-07-15mac80211: remove unnecessary break after returnFabian Frederick-1/+0
Signed-off-by: Fabian Frederick <> Signed-off-by: David S. Miller <>
2014-04-22mac80211: mesh: always use the latest target_snBob Copeland-1/+2
When a path target responds to a path request, its response always contains the most up-to-date information; accordingly, it should use the latest target_sn, regardless of net_traversal_jiffies(). Otherwise, only the first path response is considered when constructing a path, as it will have the highest target_sn of all replies during that period. Signed-off-by: Bob Copeland <> Signed-off-by: Johannes Berg <>
2014-04-22mac80211: mesh: use u16 return type for u16 getterBob Copeland-1/+1
u16_field_get() is a simple wrapper around get_unaligned_le16(), and it is being assigned to a u16, so there's no need to promote to u32 in the middle. Signed-off-by: Bob Copeland <> Signed-off-by: Johannes Berg <>
2013-11-25mac80211: use put_unaligned_le in mesh when necessaryChun-Yeow Yeoh-50/+37
Use put_unaligned_le16 and put_unaligned_le32 for mesh_path_error_tx and mesh_path_sel_frame_tx. Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: Johannes Berg <>
2013-11-25mac80211: add generic cipher scheme supportMax Stepanov-2/+2
This adds generic cipher scheme support to mac80211, such schemes are fully under control by the driver. On hw registration drivers may specify additional HW ciphers with a scheme how these ciphers have to be handled by mac80211 TX/RR. A cipher scheme specifies a cipher suite value, a size of the security header to be added to or stripped from frames and how the PN is to be verified on RX. Signed-off-by: Max Stepanov <> Signed-off-by: Johannes Berg <>
2013-04-16mac80211: parse VHT channel switch IEsJohannes Berg-1/+1
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 <>
2013-04-08mac80211: return new mpath from mesh_path_add()Bob Copeland-13/+9
Most times that mesh_path_add() is called, it is followed by a lookup to get the just-added mpath. We can instead just return the new mpath in the case that we allocated one (or the existing one if already there), so do that. Also, reorder the code in mesh_path_add a bit so that we don't need to allocate in the pre-existing case. Signed-off-by: Bob Copeland <> Signed-off-by: Johannes Berg <>
2013-04-08mac80211: fix the PREP mesh hwmp debug messageChun-Yeow Yeoh-2/+2
The mesh hwmp debug message is a bit confusing. The "sending PREP to %p" should be the MAC address of mesh STA that has originated the PREQ message and the "received PREP from %pM" should be the MAC address of the mesh STA that has originated the PREP message. Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: Johannes Berg <>
2013-02-15mac80211: clean up mesh codeJohannes Berg-34/+34
There's various code with strange indentation, questionable loop and locking constructs, etc. The bigger change is moving the "sdata" argument to the first argument of all functions, like all other mac80211 functions that have one. Signed-off-by: Johannes Berg <>
2013-02-15mac80211: constify IE parsingJohannes Berg-19/+23
Make all the parsed IE pointers const, and propagate the change to all the users etc. Signed-off-by: Johannes Berg <>
2013-02-04mac80211: mesh power save basicsMarco Porsch-0/+7
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 <> Signed-off-by: Ivan Bezyazychnyy <> Signed-off-by: Mike Krinkin <> Signed-off-by: Max Filippov <> Signed-off-by: Johannes Berg <>
2013-01-28Merge branch 'master' of ↵John W. Linville-1/+4
git:// Conflicts: drivers/net/wireless/ath/ath9k/main.c drivers/net/wireless/iwlwifi/dvm/tx.c
2013-01-16mac80211: add encrypt headroom to PERR framesBob Copeland-1/+3
Mesh PERR action frames are robust and thus may be encrypted, so add proper head/tailroom to allow this. Fixes this warning when operating a Mesh STA on ath5k: WARNING: at net/mac80211/wpa.c:427 ccmp_encrypt_skb.isra.5+0x7b/0x1a0 [mac80211]() Call Trace: [<c011c5e7>] warn_slowpath_common+0x63/0x78 [<c011c60b>] warn_slowpath_null+0xf/0x13 [<e090621d>] ccmp_encrypt_skb.isra.5+0x7b/0x1a0 [mac80211] [<e090685c>] ieee80211_crypto_ccmp_encrypt+0x1f/0x37 [mac80211] [<e0917113>] invoke_tx_handlers+0xcad/0x10bd [mac80211] [<e0917665>] ieee80211_tx+0x87/0xb3 [mac80211] [<e0918932>] ieee80211_tx_pending+0xcc/0x170 [mac80211] [<c0121c43>] tasklet_action+0x3e/0x65 Signed-off-by: Bob Copeland <> Signed-off-by: Johannes Berg <>
2013-01-16mac80211: set NEED_TXPROCESSING for PERR framesBob Copeland-0/+1
A user reported warnings in ath5k due to transmitting frames with no rates set up. The frames were Mesh PERR frames, and some debugging showed an empty control block with just the vif pointer: > [ 562.522682] XXX txinfo: 00000000: 00 00 00 00 00 00 00 00 00 00 00 > 00 00 00 00 00 ................ > [ 562.522688] XXX txinfo: 00000010: 00 00 00 00 00 00 00 00 54 b8 f2 > db 00 00 00 00 ........T....... > [ 562.522693] XXX txinfo: 00000020: 00 00 00 00 00 00 00 00 00 00 00 > 00 00 00 00 00 ................ Set the IEEE80211_TX_INTFL_NEED_TXPROCESSING flag to ensure that rate control gets run before the frame is sent. Signed-off-by: Bob Copeland <> Signed-off-by: Johannes Berg <>
2013-01-04mac80211: fix mesh_hwmp kerneldocBob Copeland-1/+4
One of the function names was wrong and some parameters were missing. Signed-off-by: Bob Copeland <> Signed-off-by: Johannes Berg <>
2012-08-20mac80211: clean up mpath_move_to_queue()Thomas Pedersen-2/+0
Use skb_queue_walk_safe instead, and fix a few issues: - didn't free old skbs on moving - didn't react to failed skb alloc - needlessly held a local pointer to the destination frame queue - didn't check destination queue length before adding skb Signed-off-by: Thomas Pedersen <> Signed-off-by: Johannes Berg <>
2012-07-10net: Fix (nearly-)kernel-doc comments for various functionsBen Hutchings-2/+5
Fix incorrect start markers, wrapped summary lines, missing section breaks, incorrect separators, and some name mismatches. Signed-off-by: Ben Hutchings <> Signed-off-by: David S. Miller <>
2012-06-24mac80211: clean up debuggingJohannes Berg-23/+19
There are a few things that make the logging and debugging in mac80211 less useful than it should be right now: * a lot of messages should be pr_info, not pr_debug * wholesale use of pr_debug makes it require *both* Kconfig and dynamic configuration * there are still a lot of ifdefs * the style is very inconsistent, sometimes the sdata->name is printed in front Clean up everything, introducing new macros and separating out the station MLME debugging into a new Kconfig symbol. Signed-off-by: Johannes Berg <>
2012-06-18mac80211: fix and improve mesh RANN processingChun-Yeow Yeoh-18/+25
This patch fixes the problem of dropping RANN element if the TTL is 1. If the received RANN element TTL is 1 or greater than 1, the RANN is processed. However, forwarding of received RANN element with TTL 1 or less is prohibited according to the standard. This is previously reported by Monthadar Al Jaberi. Besides, this patch also avoid the processing of unicast PREQ generation if the RANN element does not meet the acceptance criteria mentioned in Sec. of IEEE Std. 802.11-2012. Reported-by: Monthadar Al Jaberi <> Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: Johannes Berg <>
2012-06-18{nl,cfg,mac}80211: implement dot11MeshHWMPconfirmationIntervalChun-Yeow Yeoh-1/+6
As defined in section Case D (802.11-2012), this control variable is used to limit the mesh STA to send only one PREQ to a root mesh STA within this interval of time (in TUs). The default value for this variable is set to 2000 TUs. However, for current implementation, the maximum configurable of dot11MeshHWMPconfirmationInterval is restricted by dot11MeshHWMPactivePathTimeout. Signed-off-by: Chun-Yeow Yeoh <> [line-break commit log] Signed-off-by: Johannes Berg <>
2012-06-18mac80211: implement the proactive PREP generationChun-Yeow Yeoh-5/+33
Generate the proactive PREP element in Proactive PREQ mode as defined in Sec. (Case D) of IEEE Std. 802.11-2012. Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: Johannes Berg <>
2012-06-14mac80211: implement the proactive PREQ generationChun-Yeow Yeoh-3/+24
Generate the proactive PREQ element as defined in Sec. (Case C) of IEEE Std. 802.11-2012 based on the selection of dot11MeshHWMPRootMode as follow: dot11MeshHWMPRootMode (2) is proactivePREQnoPREP dot11MeshHWMPRootMode (3) is proactivePREQwithPREP The proactive PREQ is generated based on the interval defined by dot11MeshHWMProotInterval. With this change, proactive RANN element is now generated if the dot11MeshHWMPRootMode is set to (4) instead of (1). Signed-off-by: Chun-Yeow Yeoh <> [line-break commit log] Signed-off-by: Johannes Berg <>
2012-06-09mac80211: Rename stainfo variable for the more common staJavier Cardona-4/+4
Signed-off-by: Javier Cardona <> Reviewed-by: Jason Abele <> Signed-off-by: Johannes Berg <>
2012-06-09mac80211: Remove unused variableJavier Cardona-3/+0
Signed-off-by: Javier Cardona <> Reviewed-by: Jason Abele <> Signed-off-by: Johannes Berg <>
2012-06-05net: mac80211: Convert printk(KERN_DEBUG to pr_debugJoe Perches-1/+1
Standardize the debugging to be able to use dynamic_debug. Coalesce formats, align arguments. Signed-off-by: Joe Perches <> Signed-off-by: John W. Linville <>
2012-05-22Merge git:// W. Linville-1/+4
2012-05-15mac80211: fix the increment of unicast/multicast counters for forwarded PREQChun-Yeow Yeoh-1/+4
Forwarded PREQ is either unicast or multicast. The appropriate counters should be incremented accordingly. Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: John W. Linville <>
2012-05-09mac80211: Convert compare_ether_addr to ether_addr_equalJoe Perches-7/+7
Use the new bool function ether_addr_equal to add some clarity and reduce the likelihood for misuse of compare_ether_addr for sorting. Done via cocci script: $ cat compare_ether_addr.cocci @@ expression a,b; @@ - !compare_ether_addr(a, b) + ether_addr_equal(a, b) @@ expression a,b; @@ - compare_ether_addr(a, b) + !ether_addr_equal(a, b) @@ expression a,b; @@ - !ether_addr_equal(a, b) == 0 + ether_addr_equal(a, b) @@ expression a,b; @@ - !ether_addr_equal(a, b) != 0 + !ether_addr_equal(a, b) @@ expression a,b; @@ - ether_addr_equal(a, b) == 0 + !ether_addr_equal(a, b) @@ expression a,b; @@ - ether_addr_equal(a, b) != 0 + ether_addr_equal(a, b) @@ expression a,b; @@ - !!ether_addr_equal(a, b) + ether_addr_equal(a, b) Signed-off-by: Joe Perches <> Signed-off-by: David S. Miller <>
2012-04-12mac80211: fix the assignment of PREQ's MAC address for Proactive RANNChun-Yeow Yeoh-2/+3
Record the RANN sender's address only for RANNs that meet the acceptance criteria (per sections Signed-off-by: Chun-Yeow Yeoh <> Reviewed-by: Javier Cardona <> Signed-off-by: John W. Linville <>
2012-04-09mac80211: fix the RANN propagation issuesChun-Yeow Yeoh-6/+18
This patch is intended to solve the follwing issues in RANN propagation: [1] The interval in propagated RANN should be based on the interval of received RANN. [2] The aggregated path metric for propagated RANN is as received plus own link metric towards the transmitting mesh STA (not root mesh STA). [3] The comparison of path metric for RANN with same sequence number should be done before deciding whether to propagate or not. Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: John W. Linville <>
2012-04-09mac80211: fix the sparse warnings on endian handling in RANN propagationChun-Yeow Yeoh-2/+2
The HWMP sequence number of received RANN element is compared to decide whether to be propagated. The sequence number is required to covert from 32bit little endian data into CPUs endianness for comparison. The same applies to the RANN metric. Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: Javier Cardona <> Signed-off-by: John W. Linville <>
2012-03-06mac80211: fix mesh airtime link metric estimatingThomas Pedersen-2/+4
Airtime link metric estimation was broken in HT mesh, use cfg80211_calculate_bitrate to get the right rate value. Also factor out tx rate copying from sta_set_sinfo(). Signed-off-by: Thomas Pedersen <> Reviewed-by: Johannes Berg <> Signed-off-by: John W. Linville <>
2012-03-05mac80211: fix the support of setting non-forwarding entity in MeshChun-Yeow Yeoh-1/+8
RANN, PREP and PERR propagation should happen only if the dot11MeshForwarding is true. Besides, data frame should not be forwarded if dot11MeshForwarding is false. This redundant checking is necessary to avoid the broadcasted ARP breaking the non-forwarding rule. Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: John W. Linville <>
2012-03-05mac80211: use compare_ether_addr on MAC addresses instead of memcmpFelix Fietkau-8/+11
Because of the constant size and guaranteed 16 bit alignment, the inline compare_ether_addr function is much cheaper than calling memcmp. Signed-off-by: Felix Fietkau <> Acked-by: Johannes Berg <> Signed-off-by: John W. Linville <>
2012-03-05mac80211: Fix the generation of PREQs in proactive RANN mechanism of HWMPChun-Yeow Yeoh-5/+15
According to Section Y.7.4 Actions on receipt of proactive RANN, an individually addressed PREQ should be generated towards the neighbor peer mesh STA indicated in the RANN Sender Address field in the forwarding information. Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: Javier Cardona <> Signed-off-by: Thomas Pedersen <> Signed-off-by: John W. Linville <>
2012-02-27mac80211: clean up asm/unaligned.h inclusionJohannes Berg-0/+1
Some files implicitly get this via mesh.h which itself doesn't need it, so move the inclusion into the right files. Some other files don't need it at all but include it, so remove it from there. Signed-off-by: Johannes Berg <> Signed-off-by: John W. Linville <>
2012-02-01Merge branch 'master' of ↵John W. Linville-4/+4
2012-01-27{nl,cfg,mac}80211: Add support of setting non-forwarding entity in MeshChun-Yeow Yeoh-1/+1
A mesh node that joins the mesh network is by default a forwarding entity. This patch allows the mesh node to set as non-forwarding entity. Whenever dot11MeshForwarding is set to 0, the mesh node can prevent itself from forwarding the traffic which is not destined to him. Signed-off-by: Chun-Yeow Yeoh <> Signed-off-by: John W. Linville <>
2012-01-18mac80211: Use the right headroom size for mesh mgmt framesJavier Cardona-4/+4
Use local->tx_headroom instad of local->hw.extra_tx_headroom. local->tx_headroom is the max of hw.extra_tx_headroom required by the driver and the headroom required by mac80211 for status reporting. On drivers where hw.extra_tx_headroom is smaller than what mac80211 requires (e.g. ath5k), we would not reserve sufficient buffer space to report tx status. Also, don't reserve local->tx_headroom + local->hw.extra_tx_headroom. Reported-by: Simon Morgenthaler <> Reported-by: Kai Scharwies <> Signed-off-by: Javier Cardona <> Signed-off-by: John W. Linville <>