aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_hwmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/mesh_hwmp.c')
-rw-r--r--net/mac80211/mesh_hwmp.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index aed1821bd6f1..fb7b6a11d0ba 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -13,13 +13,6 @@
13#include "wme.h" 13#include "wme.h"
14#include "mesh.h" 14#include "mesh.h"
15 15
16#ifdef CONFIG_MAC80211_VERBOSE_MHWMP_DEBUG
17#define mhwmp_dbg(fmt, args...) \
18 pr_debug("Mesh HWMP (%s): " fmt "\n", sdata->name, ##args)
19#else
20#define mhwmp_dbg(fmt, args...) do { (void)(0); } while (0)
21#endif
22
23#define TEST_FRAME_LEN 8192 16#define TEST_FRAME_LEN 8192
24#define MAX_METRIC 0xffffffff 17#define MAX_METRIC 0xffffffff
25#define ARITH_SHIFT 8 18#define ARITH_SHIFT 8
@@ -144,19 +137,19 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
144 137
145 switch (action) { 138 switch (action) {
146 case MPATH_PREQ: 139 case MPATH_PREQ:
147 mhwmp_dbg("sending PREQ to %pM", target); 140 mhwmp_dbg(sdata, "sending PREQ to %pM\n", target);
148 ie_len = 37; 141 ie_len = 37;
149 pos = skb_put(skb, 2 + ie_len); 142 pos = skb_put(skb, 2 + ie_len);
150 *pos++ = WLAN_EID_PREQ; 143 *pos++ = WLAN_EID_PREQ;
151 break; 144 break;
152 case MPATH_PREP: 145 case MPATH_PREP:
153 mhwmp_dbg("sending PREP to %pM", target); 146 mhwmp_dbg(sdata, "sending PREP to %pM\n", target);
154 ie_len = 31; 147 ie_len = 31;
155 pos = skb_put(skb, 2 + ie_len); 148 pos = skb_put(skb, 2 + ie_len);
156 *pos++ = WLAN_EID_PREP; 149 *pos++ = WLAN_EID_PREP;
157 break; 150 break;
158 case MPATH_RANN: 151 case MPATH_RANN:
159 mhwmp_dbg("sending RANN from %pM", orig_addr); 152 mhwmp_dbg(sdata, "sending RANN from %pM\n", orig_addr);
160 ie_len = sizeof(struct ieee80211_rann_ie); 153 ie_len = sizeof(struct ieee80211_rann_ie);
161 pos = skb_put(skb, 2 + ie_len); 154 pos = skb_put(skb, 2 + ie_len);
162 *pos++ = WLAN_EID_RANN; 155 *pos++ = WLAN_EID_RANN;
@@ -535,10 +528,10 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
535 flags = PREQ_IE_FLAGS(preq_elem); 528 flags = PREQ_IE_FLAGS(preq_elem);
536 root_is_gate = !!(flags & RANN_FLAG_IS_GATE); 529 root_is_gate = !!(flags & RANN_FLAG_IS_GATE);
537 530
538 mhwmp_dbg("received PREQ from %pM", orig_addr); 531 mhwmp_dbg(sdata, "received PREQ from %pM\n", orig_addr);
539 532
540 if (ether_addr_equal(target_addr, sdata->vif.addr)) { 533 if (ether_addr_equal(target_addr, sdata->vif.addr)) {
541 mhwmp_dbg("PREQ is for us"); 534 mhwmp_dbg(sdata, "PREQ is for us\n");
542 forward = false; 535 forward = false;
543 reply = true; 536 reply = true;
544 metric = 0; 537 metric = 0;
@@ -590,7 +583,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
590 lifetime = PREQ_IE_LIFETIME(preq_elem); 583 lifetime = PREQ_IE_LIFETIME(preq_elem);
591 ttl = ifmsh->mshcfg.element_ttl; 584 ttl = ifmsh->mshcfg.element_ttl;
592 if (ttl != 0) { 585 if (ttl != 0) {
593 mhwmp_dbg("replying to the PREQ"); 586 mhwmp_dbg(sdata, "replying to the PREQ\n");
594 mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr, 587 mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr,
595 cpu_to_le32(orig_sn), 0, target_addr, 588 cpu_to_le32(orig_sn), 0, target_addr,
596 cpu_to_le32(target_sn), mgmt->sa, 0, ttl, 589 cpu_to_le32(target_sn), mgmt->sa, 0, ttl,
@@ -611,7 +604,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
611 ifmsh->mshstats.dropped_frames_ttl++; 604 ifmsh->mshstats.dropped_frames_ttl++;
612 return; 605 return;
613 } 606 }
614 mhwmp_dbg("forwarding the PREQ from %pM", orig_addr); 607 mhwmp_dbg(sdata, "forwarding the PREQ from %pM\n", orig_addr);
615 --ttl; 608 --ttl;
616 preq_id = PREQ_IE_PREQ_ID(preq_elem); 609 preq_id = PREQ_IE_PREQ_ID(preq_elem);
617 hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1; 610 hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1;
@@ -658,7 +651,8 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
658 u8 next_hop[ETH_ALEN]; 651 u8 next_hop[ETH_ALEN];
659 u32 target_sn, orig_sn, lifetime; 652 u32 target_sn, orig_sn, lifetime;
660 653
661 mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem)); 654 mhwmp_dbg(sdata, "received PREP from %pM\n",
655 PREP_IE_ORIG_ADDR(prep_elem));
662 656
663 orig_addr = PREP_IE_ORIG_ADDR(prep_elem); 657 orig_addr = PREP_IE_ORIG_ADDR(prep_elem);
664 if (ether_addr_equal(orig_addr, sdata->vif.addr)) 658 if (ether_addr_equal(orig_addr, sdata->vif.addr))
@@ -784,8 +778,9 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
784 if (ether_addr_equal(orig_addr, sdata->vif.addr)) 778 if (ether_addr_equal(orig_addr, sdata->vif.addr))
785 return; 779 return;
786 780
787 mhwmp_dbg("received RANN from %pM via neighbour %pM (is_gate=%d)", 781 mhwmp_dbg(sdata,
788 orig_addr, mgmt->sa, root_is_gate); 782 "received RANN from %pM via neighbour %pM (is_gate=%d)\n",
783 orig_addr, mgmt->sa, root_is_gate);
789 784
790 rcu_read_lock(); 785 rcu_read_lock();
791 sta = sta_info_get(sdata, mgmt->sa); 786 sta = sta_info_get(sdata, mgmt->sa);
@@ -818,8 +813,9 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
818 root_path_confirmation_jiffies(sdata)) || 813 root_path_confirmation_jiffies(sdata)) ||
819 time_before(jiffies, mpath->last_preq_to_root))) && 814 time_before(jiffies, mpath->last_preq_to_root))) &&
820 !(mpath->flags & MESH_PATH_FIXED) && (ttl != 0)) { 815 !(mpath->flags & MESH_PATH_FIXED) && (ttl != 0)) {
821 mhwmp_dbg("%s time to refresh root mpath %pM", sdata->name, 816 mhwmp_dbg(sdata,
822 orig_addr); 817 "time to refresh root mpath %pM\n",
818 orig_addr);
823 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); 819 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
824 mpath->last_preq_to_root = jiffies; 820 mpath->last_preq_to_root = jiffies;
825 } 821 }
@@ -926,7 +922,7 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags)
926 922
927 preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_ATOMIC); 923 preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_ATOMIC);
928 if (!preq_node) { 924 if (!preq_node) {
929 mhwmp_dbg("could not allocate PREQ node"); 925 mhwmp_dbg(sdata, "could not allocate PREQ node\n");
930 return; 926 return;
931 } 927 }
932 928
@@ -935,7 +931,7 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags)
935 spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); 931 spin_unlock_bh(&ifmsh->mesh_preq_queue_lock);
936 kfree(preq_node); 932 kfree(preq_node);
937 if (printk_ratelimit()) 933 if (printk_ratelimit())
938 mhwmp_dbg("PREQ node queue full"); 934 mhwmp_dbg(sdata, "PREQ node queue full\n");
939 return; 935 return;
940 } 936 }
941 937
@@ -1183,7 +1179,7 @@ void mesh_path_timer(unsigned long data)
1183 if (!mpath->is_gate && mesh_gate_num(sdata) > 0) { 1179 if (!mpath->is_gate && mesh_gate_num(sdata) > 0) {
1184 ret = mesh_path_send_to_gates(mpath); 1180 ret = mesh_path_send_to_gates(mpath);
1185 if (ret) 1181 if (ret)
1186 mhwmp_dbg("no gate was reachable"); 1182 mhwmp_dbg(sdata, "no gate was reachable\n");
1187 } else 1183 } else
1188 mesh_path_flush_pending(mpath); 1184 mesh_path_flush_pending(mpath);
1189 } 1185 }
@@ -1221,7 +1217,7 @@ mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata)
1221 0, cpu_to_le32(ifmsh->preq_id++), sdata); 1217 0, cpu_to_le32(ifmsh->preq_id++), sdata);
1222 break; 1218 break;
1223 default: 1219 default:
1224 mhwmp_dbg("Proactive mechanism not supported"); 1220 mhwmp_dbg(sdata, "Proactive mechanism not supported\n");
1225 return; 1221 return;
1226 } 1222 }
1227} 1223}