aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_plink.c
diff options
context:
space:
mode:
authorMarco Porsch <marco.porsch@etit.tu-chemnitz.de>2012-11-21 21:40:32 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-26 05:36:42 -0500
commit453e66f247f4ecb98cfef653164d428d087187d8 (patch)
treedecbb1a289286991a7305aa838876e4e03ced976 /net/mac80211/mesh_plink.c
parent40aefedc8b494d6a7006ceb9d051fbc58268c86e (diff)
mac80211: remove mesh config macros from mesh_plink.c
Use shortcut pointer instead where it is appropriate. Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mesh_plink.c')
-rw-r--r--net/mac80211/mesh_plink.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 234fe755968b..7a47f4063d0a 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#define dot11MeshMaxRetries(s) (s->u.mesh.mshcfg.dot11MeshMaxRetries)
23#define dot11MeshRetryTimeout(s) (s->u.mesh.mshcfg.dot11MeshRetryTimeout)
24#define dot11MeshConfirmTimeout(s) (s->u.mesh.mshcfg.dot11MeshConfirmTimeout)
25#define dot11MeshHoldingTimeout(s) (s->u.mesh.mshcfg.dot11MeshHoldingTimeout)
26#define dot11MeshMaxPeerLinks(s) (s->u.mesh.mshcfg.dot11MeshMaxPeerLinks)
27
28/* We only need a valid sta if user configured a minimum rssi_threshold. */ 22/* We only need a valid sta if user configured a minimum rssi_threshold. */
29#define rssi_threshold_check(sta, sdata) \ 23#define rssi_threshold_check(sta, sdata) \
30 (sdata->u.mesh.mshcfg.rssi_threshold == 0 ||\ 24 (sdata->u.mesh.mshcfg.rssi_threshold == 0 ||\
@@ -430,6 +424,7 @@ static void mesh_plink_timer(unsigned long data)
430 struct sta_info *sta; 424 struct sta_info *sta;
431 __le16 llid, plid, reason; 425 __le16 llid, plid, reason;
432 struct ieee80211_sub_if_data *sdata; 426 struct ieee80211_sub_if_data *sdata;
427 struct mesh_config *mshcfg;
433 428
434 /* 429 /*
435 * This STA is valid because sta_info_destroy() will 430 * This STA is valid because sta_info_destroy() will
@@ -456,12 +451,13 @@ static void mesh_plink_timer(unsigned long data)
456 llid = sta->llid; 451 llid = sta->llid;
457 plid = sta->plid; 452 plid = sta->plid;
458 sdata = sta->sdata; 453 sdata = sta->sdata;
454 mshcfg = &sdata->u.mesh.mshcfg;
459 455
460 switch (sta->plink_state) { 456 switch (sta->plink_state) {
461 case NL80211_PLINK_OPN_RCVD: 457 case NL80211_PLINK_OPN_RCVD:
462 case NL80211_PLINK_OPN_SNT: 458 case NL80211_PLINK_OPN_SNT:
463 /* retry timer */ 459 /* retry timer */
464 if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { 460 if (sta->plink_retries < mshcfg->dot11MeshMaxRetries) {
465 u32 rand; 461 u32 rand;
466 mpl_dbg(sta->sdata, 462 mpl_dbg(sta->sdata,
467 "Mesh plink for %pM (retry, timeout): %d %d\n", 463 "Mesh plink for %pM (retry, timeout): %d %d\n",
@@ -484,7 +480,7 @@ static void mesh_plink_timer(unsigned long data)
484 if (!reason) 480 if (!reason)
485 reason = cpu_to_le16(WLAN_REASON_MESH_CONFIRM_TIMEOUT); 481 reason = cpu_to_le16(WLAN_REASON_MESH_CONFIRM_TIMEOUT);
486 sta->plink_state = NL80211_PLINK_HOLDING; 482 sta->plink_state = NL80211_PLINK_HOLDING;
487 mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); 483 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout);
488 spin_unlock_bh(&sta->lock); 484 spin_unlock_bh(&sta->lock);
489 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, 485 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,
490 sta->sta.addr, llid, plid, reason); 486 sta->sta.addr, llid, plid, reason);
@@ -543,7 +539,7 @@ int mesh_plink_open(struct sta_info *sta)
543 return -EBUSY; 539 return -EBUSY;
544 } 540 }
545 sta->plink_state = NL80211_PLINK_OPN_SNT; 541 sta->plink_state = NL80211_PLINK_OPN_SNT;
546 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); 542 mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout);
547 spin_unlock_bh(&sta->lock); 543 spin_unlock_bh(&sta->lock);
548 mpl_dbg(sdata, 544 mpl_dbg(sdata,
549 "Mesh plink: starting establishment with %pM\n", 545 "Mesh plink: starting establishment with %pM\n",
@@ -570,6 +566,7 @@ void mesh_plink_block(struct sta_info *sta)
570void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt, 566void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt,
571 size_t len, struct ieee80211_rx_status *rx_status) 567 size_t len, struct ieee80211_rx_status *rx_status)
572{ 568{
569 struct mesh_config *mshcfg = &sdata->u.mesh.mshcfg;
573 struct ieee802_11_elems elems; 570 struct ieee802_11_elems elems;
574 struct sta_info *sta; 571 struct sta_info *sta;
575 enum plink_event event; 572 enum plink_event event;
@@ -777,7 +774,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
777 sta->plid = plid; 774 sta->plid = plid;
778 get_random_bytes(&llid, 2); 775 get_random_bytes(&llid, 2);
779 sta->llid = llid; 776 sta->llid = llid;
780 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); 777 mesh_plink_timer_set(sta,
778 mshcfg->dot11MeshRetryTimeout);
781 spin_unlock_bh(&sta->lock); 779 spin_unlock_bh(&sta->lock);
782 mesh_plink_frame_tx(sdata, 780 mesh_plink_frame_tx(sdata,
783 WLAN_SP_MESH_PEERING_OPEN, 781 WLAN_SP_MESH_PEERING_OPEN,
@@ -803,7 +801,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
803 sta->reason = reason; 801 sta->reason = reason;
804 sta->plink_state = NL80211_PLINK_HOLDING; 802 sta->plink_state = NL80211_PLINK_HOLDING;
805 if (!mod_plink_timer(sta, 803 if (!mod_plink_timer(sta,
806 dot11MeshHoldingTimeout(sdata))) 804 mshcfg->dot11MeshHoldingTimeout))
807 sta->ignore_plink_timer = true; 805 sta->ignore_plink_timer = true;
808 806
809 llid = sta->llid; 807 llid = sta->llid;
@@ -825,7 +823,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
825 case CNF_ACPT: 823 case CNF_ACPT:
826 sta->plink_state = NL80211_PLINK_CNF_RCVD; 824 sta->plink_state = NL80211_PLINK_CNF_RCVD;
827 if (!mod_plink_timer(sta, 825 if (!mod_plink_timer(sta,
828 dot11MeshConfirmTimeout(sdata))) 826 mshcfg->dot11MeshConfirmTimeout))
829 sta->ignore_plink_timer = true; 827 sta->ignore_plink_timer = true;
830 828
831 spin_unlock_bh(&sta->lock); 829 spin_unlock_bh(&sta->lock);
@@ -847,7 +845,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
847 sta->reason = reason; 845 sta->reason = reason;
848 sta->plink_state = NL80211_PLINK_HOLDING; 846 sta->plink_state = NL80211_PLINK_HOLDING;
849 if (!mod_plink_timer(sta, 847 if (!mod_plink_timer(sta,
850 dot11MeshHoldingTimeout(sdata))) 848 mshcfg->dot11MeshHoldingTimeout))
851 sta->ignore_plink_timer = true; 849 sta->ignore_plink_timer = true;
852 850
853 llid = sta->llid; 851 llid = sta->llid;
@@ -888,7 +886,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
888 sta->reason = reason; 886 sta->reason = reason;
889 sta->plink_state = NL80211_PLINK_HOLDING; 887 sta->plink_state = NL80211_PLINK_HOLDING;
890 if (!mod_plink_timer(sta, 888 if (!mod_plink_timer(sta,
891 dot11MeshHoldingTimeout(sdata))) 889 mshcfg->dot11MeshHoldingTimeout))
892 sta->ignore_plink_timer = true; 890 sta->ignore_plink_timer = true;
893 891
894 llid = sta->llid; 892 llid = sta->llid;
@@ -923,7 +921,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
923 changed |= __mesh_plink_deactivate(sta); 921 changed |= __mesh_plink_deactivate(sta);
924 sta->plink_state = NL80211_PLINK_HOLDING; 922 sta->plink_state = NL80211_PLINK_HOLDING;
925 llid = sta->llid; 923 llid = sta->llid;
926 mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); 924 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout);
927 spin_unlock_bh(&sta->lock); 925 spin_unlock_bh(&sta->lock);
928 changed |= mesh_set_ht_prot_mode(sdata); 926 changed |= mesh_set_ht_prot_mode(sdata);
929 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, 927 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,