aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_plink.c
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2013-11-05 14:16:54 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-11-25 14:50:01 -0500
commit36c9bb29bfad5c43327aa7b8b912ff8dca68416c (patch)
tree3f9fca737a5cc1b9cecff35267af6daed29528ca /net/mac80211/mesh_plink.c
parent32cb05bfe81ed00676a21d914db5729abe3f326f (diff)
mac80211: mesh: rewrite rssi_threshold_check in C
Use C instead of cpp for type checking. Also swap the arguments into the usual sdata -> sta order. Signed-off-by: Bob Copeland <bob@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mesh_plink.c')
-rw-r--r--net/mac80211/mesh_plink.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 5048658709d0..36b6cfffa6fb 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -19,12 +19,6 @@
19#define mod_plink_timer(s, t) (mod_timer(&s->plink_timer, \ 19#define mod_plink_timer(s, t) (mod_timer(&s->plink_timer, \
20 jiffies + HZ * t / 1000)) 20 jiffies + HZ * t / 1000))
21 21
22/* We only need a valid sta if user configured a minimum rssi_threshold. */
23#define rssi_threshold_check(sta, sdata) \
24 (sdata->u.mesh.mshcfg.rssi_threshold == 0 ||\
25 (sta && (s8) -ewma_read(&sta->avg_signal) > \
26 sdata->u.mesh.mshcfg.rssi_threshold))
27
28enum plink_event { 22enum plink_event {
29 PLINK_UNDEFINED, 23 PLINK_UNDEFINED,
30 OPN_ACPT, 24 OPN_ACPT,
@@ -63,6 +57,16 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
63 enum ieee80211_self_protected_actioncode action, 57 enum ieee80211_self_protected_actioncode action,
64 u8 *da, __le16 llid, __le16 plid, __le16 reason); 58 u8 *da, __le16 llid, __le16 plid, __le16 reason);
65 59
60
61/* We only need a valid sta if user configured a minimum rssi_threshold. */
62static bool rssi_threshold_check(struct ieee80211_sub_if_data *sdata,
63 struct sta_info *sta)
64{
65 s32 rssi_threshold = sdata->u.mesh.mshcfg.rssi_threshold;
66 return rssi_threshold == 0 ||
67 (sta && (s8) -ewma_read(&sta->avg_signal) > rssi_threshold);
68}
69
66/** 70/**
67 * mesh_plink_fsm_restart - restart a mesh peer link finite state machine 71 * mesh_plink_fsm_restart - restart a mesh peer link finite state machine
68 * 72 *
@@ -518,7 +522,7 @@ void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata,
518 sta->plink_state == NL80211_PLINK_LISTEN && 522 sta->plink_state == NL80211_PLINK_LISTEN &&
519 sdata->u.mesh.accepting_plinks && 523 sdata->u.mesh.accepting_plinks &&
520 sdata->u.mesh.mshcfg.auto_open_plinks && 524 sdata->u.mesh.mshcfg.auto_open_plinks &&
521 rssi_threshold_check(sta, sdata)) 525 rssi_threshold_check(sdata, sta))
522 changed = mesh_plink_open(sta); 526 changed = mesh_plink_open(sta);
523 527
524 ieee80211_mps_frame_release(sta, elems); 528 ieee80211_mps_frame_release(sta, elems);
@@ -776,7 +780,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
776 mesh_matches_local(sdata, &elems); 780 mesh_matches_local(sdata, &elems);
777 781
778 if (ftype == WLAN_SP_MESH_PEERING_OPEN && 782 if (ftype == WLAN_SP_MESH_PEERING_OPEN &&
779 !rssi_threshold_check(sta, sdata)) { 783 !rssi_threshold_check(sdata, sta)) {
780 mpl_dbg(sdata, "Mesh plink: %pM does not meet rssi threshold\n", 784 mpl_dbg(sdata, "Mesh plink: %pM does not meet rssi threshold\n",
781 mgmt->sa); 785 mgmt->sa);
782 rcu_read_unlock(); 786 rcu_read_unlock();