aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-06 00:41:53 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-06 00:41:53 -0400
commitf3032be921cd126615ce3bfd7084e3d319f3f892 (patch)
treec2ce874f2ab7f107dddf7b854772e0f3b64d35a1 /net
parent70c03b49b80ba3634958acc31853771019c0ebd3 (diff)
parent18d7260527ce7c0d0a177afdf92d8f868f50b067 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/Kconfig162
-rw-r--r--net/mac80211/Makefile18
-rw-r--r--net/mac80211/ieee80211_i.h6
-rw-r--r--net/mac80211/iface.c6
-rw-r--r--net/mac80211/main.c35
-rw-r--r--net/mac80211/mesh_pathtbl.c1
-rw-r--r--net/mac80211/mlme.c426
-rw-r--r--net/mac80211/rate.h4
-rw-r--r--net/mac80211/rc80211_pid_algo.c10
-rw-r--r--net/mac80211/rx.c203
-rw-r--r--net/mac80211/sta_info.c2
-rw-r--r--net/mac80211/tx.c77
-rw-r--r--net/mac80211/wep.c13
-rw-r--r--net/mac80211/wme.c1
-rw-r--r--net/mac80211/wpa.c28
15 files changed, 423 insertions, 569 deletions
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 0d3661d9b6a0..11a1e7fa195d 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -27,6 +27,14 @@ comment "QoS/HT support needs CONFIG_NETDEVICES_MULTIQUEUE"
27menu "Rate control algorithm selection" 27menu "Rate control algorithm selection"
28 depends on MAC80211 != n 28 depends on MAC80211 != n
29 29
30config MAC80211_RC_PID
31 bool "PID controller based rate control algorithm" if EMBEDDED
32 default y
33 ---help---
34 This option enables a TX rate control algorithm for
35 mac80211 that uses a PID controller to select the TX
36 rate.
37
30choice 38choice
31 prompt "Default rate control algorithm" 39 prompt "Default rate control algorithm"
32 default MAC80211_RC_DEFAULT_PID 40 default MAC80211_RC_DEFAULT_PID
@@ -38,40 +46,19 @@ choice
38 46
39config MAC80211_RC_DEFAULT_PID 47config MAC80211_RC_DEFAULT_PID
40 bool "PID controller based rate control algorithm" 48 bool "PID controller based rate control algorithm"
41 select MAC80211_RC_PID 49 depends on MAC80211_RC_PID
42 ---help--- 50 ---help---
43 Select the PID controller based rate control as the 51 Select the PID controller based rate control as the
44 default rate control algorithm. You should choose 52 default rate control algorithm. You should choose
45 this unless you know what you are doing. 53 this unless you know what you are doing.
46 54
47config MAC80211_RC_DEFAULT_NONE
48 bool "No default algorithm"
49 depends on EMBEDDED
50 help
51 Selecting this option will select no default algorithm
52 and allow you to not build any. Do not choose this
53 option unless you know your driver comes with another
54 suitable algorithm.
55endchoice 55endchoice
56 56
57comment "Selecting 'y' for an algorithm will"
58comment "build the algorithm into mac80211."
59
60config MAC80211_RC_DEFAULT 57config MAC80211_RC_DEFAULT
61 string 58 string
62 default "pid" if MAC80211_RC_DEFAULT_PID 59 default "pid" if MAC80211_RC_DEFAULT_PID
63 default "" 60 default ""
64 61
65config MAC80211_RC_PID
66 tristate "PID controller based rate control algorithm"
67 ---help---
68 This option enables a TX rate control algorithm for
69 mac80211 that uses a PID controller to select the TX
70 rate.
71
72 Say Y or M unless you're sure you want to use a
73 different rate control algorithm.
74
75endmenu 62endmenu
76 63
77config MAC80211_MESH 64config MAC80211_MESH
@@ -101,10 +88,16 @@ config MAC80211_DEBUGFS
101 88
102 Say N unless you know you need this. 89 Say N unless you know you need this.
103 90
91menuconfig MAC80211_DEBUG_MENU
92 bool "Select mac80211 debugging features"
93 depends on MAC80211
94 ---help---
95 This option collects various mac80211 debug settings.
96
104config MAC80211_DEBUG_PACKET_ALIGNMENT 97config MAC80211_DEBUG_PACKET_ALIGNMENT
105 bool "Enable packet alignment debugging" 98 bool "Enable packet alignment debugging"
106 depends on MAC80211 99 depends on MAC80211_DEBUG_MENU
107 help 100 ---help---
108 This option is recommended for driver authors and strongly 101 This option is recommended for driver authors and strongly
109 discouraged for everybody else, it will trigger a warning 102 discouraged for everybody else, it will trigger a warning
110 when a driver hands mac80211 a buffer that is aligned in 103 when a driver hands mac80211 a buffer that is aligned in
@@ -113,33 +106,95 @@ config MAC80211_DEBUG_PACKET_ALIGNMENT
113 106
114 Say N unless you're writing a mac80211 based driver. 107 Say N unless you're writing a mac80211 based driver.
115 108
116config MAC80211_DEBUG 109config MAC80211_NOINLINE
117 bool "Enable debugging output" 110 bool "Do not inline TX/RX handlers"
118 depends on MAC80211 111 depends on MAC80211_DEBUG_MENU
119 ---help--- 112 ---help---
120 This option will enable debug tracing output for the 113 This option affects code generation in mac80211, when
121 ieee80211 network stack. 114 selected some functions are marked "noinline" to allow
115 easier debugging of problems in the transmit and receive
116 paths.
122 117
123 If you are not trying to debug or develop the ieee80211 118 This option increases code size a bit and inserts a lot
124 subsystem, you most likely want to say N here. 119 of function calls in the code, but is otherwise safe to
120 enable.
121
122 If unsure, say N unless you expect to be finding problems
123 in mac80211.
124
125config MAC80211_VERBOSE_DEBUG
126 bool "Verbose debugging output"
127 depends on MAC80211_DEBUG_MENU
128 ---help---
129 Selecting this option causes mac80211 to print out
130 many debugging messages. It should not be selected
131 on production systems as some of the messages are
132 remotely triggerable.
133
134 Do not select this option.
125 135
126config MAC80211_HT_DEBUG 136config MAC80211_HT_DEBUG
127 bool "Enable HT debugging output" 137 bool "Verbose HT debugging"
128 depends on MAC80211_DEBUG 138 depends on MAC80211_DEBUG_MENU
129 ---help--- 139 ---help---
130 This option enables 802.11n High Throughput features 140 This option enables 802.11n High Throughput features
131 debug tracing output. 141 debug tracing output.
132 142
133 If you are not trying to debug of develop the ieee80211 143 It should not be selected on production systems as some
134 subsystem, you most likely want to say N here. 144 of the messages are remotely triggerable.
135 145
136config MAC80211_VERBOSE_DEBUG 146 Do not select this option.
137 bool "Verbose debugging output" 147
138 depends on MAC80211_DEBUG 148config MAC80211_TKIP_DEBUG
149 bool "Verbose TKIP debugging"
150 depends on MAC80211_DEBUG_MENU
151 ---help---
152 Selecting this option causes mac80211 to print out
153 very verbose TKIP debugging messages. It should not
154 be selected on production systems as those messages
155 are remotely triggerable.
156
157 Do not select this option.
158
159config MAC80211_IBSS_DEBUG
160 bool "Verbose IBSS debugging"
161 depends on MAC80211_DEBUG_MENU
162 ---help---
163 Selecting this option causes mac80211 to print out
164 very verbose IBSS debugging messages. It should not
165 be selected on production systems as those messages
166 are remotely triggerable.
167
168 Do not select this option.
169
170config MAC80211_VERBOSE_PS_DEBUG
171 bool "Verbose powersave mode debugging"
172 depends on MAC80211_DEBUG_MENU
173 ---help---
174 Selecting this option causes mac80211 to print out very
175 verbose power save mode debugging messages (when mac80211
176 is an AP and has power saving stations.)
177 It should not be selected on production systems as those
178 messages are remotely triggerable.
179
180 Do not select this option.
181
182config MAC80211_VERBOSE_MPL_DEBUG
183 bool "Verbose mesh peer link debugging"
184 depends on MAC80211_DEBUG_MENU
185 depends on MAC80211_MESH
186 ---help---
187 Selecting this option causes mac80211 to print out very
188 verbose mesh peer link debugging messages (when mac80211
189 is taking part in a mesh network).
190 It should not be selected on production systems as those
191 messages are remotely triggerable.
192
193 Do not select this option.
139 194
140config MAC80211_LOWTX_FRAME_DUMP 195config MAC80211_LOWTX_FRAME_DUMP
141 bool "Debug frame dumping" 196 bool "Debug frame dumping"
142 depends on MAC80211_DEBUG 197 depends on MAC80211_DEBUG_MENU
143 ---help--- 198 ---help---
144 Selecting this option will cause the stack to 199 Selecting this option will cause the stack to
145 print a message for each frame that is handed 200 print a message for each frame that is handed
@@ -150,30 +205,21 @@ config MAC80211_LOWTX_FRAME_DUMP
150 If unsure, say N and insert the debugging code 205 If unsure, say N and insert the debugging code
151 you require into the driver you are debugging. 206 you require into the driver you are debugging.
152 207
153config MAC80211_TKIP_DEBUG
154 bool "TKIP debugging"
155 depends on MAC80211_DEBUG
156
157config MAC80211_DEBUG_COUNTERS 208config MAC80211_DEBUG_COUNTERS
158 bool "Extra statistics for TX/RX debugging" 209 bool "Extra statistics for TX/RX debugging"
159 depends on MAC80211_DEBUG 210 depends on MAC80211_DEBUG
160 211 depends on MAC80211_DEBUG_MENU
161config MAC80211_IBSS_DEBUG 212 depends on MAC80211_DEBUGFS
162 bool "Support for IBSS testing"
163 depends on MAC80211_DEBUG
164 ---help--- 213 ---help---
165 Say Y here if you intend to debug the IBSS code. 214 Selecting this option causes mac80211 to keep additional
215 and very verbose statistics about TX and RX handler use
216 and show them in debugfs.
166 217
167config MAC80211_VERBOSE_PS_DEBUG 218 If unsure, say N.
168 bool "Verbose powersave mode debugging"
169 depends on MAC80211_DEBUG
170 ---help---
171 Say Y here to print out verbose powersave
172 mode debug messages.
173 219
174config MAC80211_VERBOSE_MPL_DEBUG 220config MAC80211_VERBOSE_SPECT_MGMT_DEBUG
175 bool "Verbose mesh peer link debugging" 221 bool "Verbose Spectrum Management (IEEE 802.11h)debugging"
176 depends on MAC80211_DEBUG && MAC80211_MESH 222 depends on MAC80211_DEBUG
177 ---help--- 223 ---help---
178 Say Y here to print out verbose mesh peer link 224 Say Y here to print out verbose Spectrum Management (IEEE 802.11h)
179 debug messages. 225 debug messages.
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 1d2a4e010e5c..fa47438e338f 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -1,13 +1,5 @@
1obj-$(CONFIG_MAC80211) += mac80211.o 1obj-$(CONFIG_MAC80211) += mac80211.o
2 2
3# objects for PID algorithm
4rc80211_pid-y := rc80211_pid_algo.o
5rc80211_pid-$(CONFIG_MAC80211_DEBUGFS) += rc80211_pid_debugfs.o
6
7# build helper for PID algorithm
8rc-pid-y := $(rc80211_pid-y)
9rc-pid-m := rc80211_pid.o
10
11# mac80211 objects 3# mac80211 objects
12mac80211-y := \ 4mac80211-y := \
13 main.o \ 5 main.o \
@@ -42,10 +34,8 @@ mac80211-$(CONFIG_MAC80211_MESH) += \
42 mesh_plink.o \ 34 mesh_plink.o \
43 mesh_hwmp.o 35 mesh_hwmp.o
44 36
37# objects for PID algorithm
38rc80211_pid-y := rc80211_pid_algo.o
39rc80211_pid-$(CONFIG_MAC80211_DEBUGFS) += rc80211_pid_debugfs.o
45 40
46# Build rate control algorithm(s) 41mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc80211_pid-y)
47CFLAGS_rc80211_pid_algo.o += -DRC80211_PID_COMPILE
48mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc-pid-$(CONFIG_MAC80211_RC_PID))
49
50# Modular rate algorithms are assigned to mac80211-m - make separate modules
51obj-m += $(mac80211-m)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index af352c05c983..f90da1bbec49 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -954,4 +954,10 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
954void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx, 954void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx,
955 struct ieee80211_hdr *hdr); 955 struct ieee80211_hdr *hdr);
956 956
957#ifdef CONFIG_MAC80211_NOINLINE
958#define debug_noinline noinline
959#else
960#define debug_noinline
961#endif
962
957#endif /* IEEE80211_I_H */ 963#endif /* IEEE80211_I_H */
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 984472702381..eeb16926aa7d 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -184,9 +184,9 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
184 sdata->u.mntr_flags = MONITOR_FLAG_CONTROL | 184 sdata->u.mntr_flags = MONITOR_FLAG_CONTROL |
185 MONITOR_FLAG_OTHER_BSS; 185 MONITOR_FLAG_OTHER_BSS;
186 break; 186 break;
187 default: 187 case IEEE80211_IF_TYPE_INVALID:
188 printk(KERN_WARNING "%s: %s: Unknown interface type 0x%x", 188 BUG();
189 dev->name, __func__, type); 189 break;
190 } 190 }
191 ieee80211_debugfs_change_if_type(sdata, oldtype); 191 ieee80211_debugfs_change_if_type(sdata, oldtype);
192} 192}
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index b661ee5bb824..f18cfd727872 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -151,9 +151,7 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
151 /* FIX: what would be proper limits for MTU? 151 /* FIX: what would be proper limits for MTU?
152 * This interface uses 802.3 frames. */ 152 * This interface uses 802.3 frames. */
153 if (new_mtu < 256 || 153 if (new_mtu < 256 ||
154 new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) { 154 new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) {
155 printk(KERN_WARNING "%s: invalid MTU %d\n",
156 dev->name, new_mtu);
157 return -EINVAL; 155 return -EINVAL;
158 } 156 }
159 157
@@ -589,7 +587,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
589 587
590 sta = sta_info_get(local, ra); 588 sta = sta_info_get(local, ra);
591 if (!sta) { 589 if (!sta) {
590#ifdef CONFIG_MAC80211_HT_DEBUG
592 printk(KERN_DEBUG "Could not find the station\n"); 591 printk(KERN_DEBUG "Could not find the station\n");
592#endif
593 ret = -ENOENT; 593 ret = -ENOENT;
594 goto exit; 594 goto exit;
595 } 595 }
@@ -617,9 +617,11 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
617 sta->ampdu_mlme.tid_tx[tid] = 617 sta->ampdu_mlme.tid_tx[tid] =
618 kmalloc(sizeof(struct tid_ampdu_tx), GFP_ATOMIC); 618 kmalloc(sizeof(struct tid_ampdu_tx), GFP_ATOMIC);
619 if (!sta->ampdu_mlme.tid_tx[tid]) { 619 if (!sta->ampdu_mlme.tid_tx[tid]) {
620#ifdef CONFIG_MAC80211_HT_DEBUG
620 if (net_ratelimit()) 621 if (net_ratelimit())
621 printk(KERN_ERR "allocate tx mlme to tid %d failed\n", 622 printk(KERN_ERR "allocate tx mlme to tid %d failed\n",
622 tid); 623 tid);
624#endif
623 ret = -ENOMEM; 625 ret = -ENOMEM;
624 goto err_unlock_sta; 626 goto err_unlock_sta;
625 } 627 }
@@ -689,7 +691,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
689 sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.expires = 691 sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.expires =
690 jiffies + ADDBA_RESP_INTERVAL; 692 jiffies + ADDBA_RESP_INTERVAL;
691 add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer); 693 add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
694#ifdef CONFIG_MAC80211_HT_DEBUG
692 printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid); 695 printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid);
696#endif
693 goto exit; 697 goto exit;
694 698
695err_unlock_queue: 699err_unlock_queue:
@@ -771,8 +775,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
771 DECLARE_MAC_BUF(mac); 775 DECLARE_MAC_BUF(mac);
772 776
773 if (tid >= STA_TID_NUM) { 777 if (tid >= STA_TID_NUM) {
778#ifdef CONFIG_MAC80211_HT_DEBUG
774 printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", 779 printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
775 tid, STA_TID_NUM); 780 tid, STA_TID_NUM);
781#endif
776 return; 782 return;
777 } 783 }
778 784
@@ -780,8 +786,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
780 sta = sta_info_get(local, ra); 786 sta = sta_info_get(local, ra);
781 if (!sta) { 787 if (!sta) {
782 rcu_read_unlock(); 788 rcu_read_unlock();
789#ifdef CONFIG_MAC80211_HT_DEBUG
783 printk(KERN_DEBUG "Could not find station: %s\n", 790 printk(KERN_DEBUG "Could not find station: %s\n",
784 print_mac(mac, ra)); 791 print_mac(mac, ra));
792#endif
785 return; 793 return;
786 } 794 }
787 795
@@ -789,8 +797,10 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
789 spin_lock_bh(&sta->lock); 797 spin_lock_bh(&sta->lock);
790 798
791 if (!(*state & HT_ADDBA_REQUESTED_MSK)) { 799 if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
800#ifdef CONFIG_MAC80211_HT_DEBUG
792 printk(KERN_DEBUG "addBA was not requested yet, state is %d\n", 801 printk(KERN_DEBUG "addBA was not requested yet, state is %d\n",
793 *state); 802 *state);
803#endif
794 spin_unlock_bh(&sta->lock); 804 spin_unlock_bh(&sta->lock);
795 rcu_read_unlock(); 805 rcu_read_unlock();
796 return; 806 return;
@@ -801,7 +811,9 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
801 *state |= HT_ADDBA_DRV_READY_MSK; 811 *state |= HT_ADDBA_DRV_READY_MSK;
802 812
803 if (*state == HT_AGG_STATE_OPERATIONAL) { 813 if (*state == HT_AGG_STATE_OPERATIONAL) {
814#ifdef CONFIG_MAC80211_HT_DEBUG
804 printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid); 815 printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid);
816#endif
805 ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); 817 ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
806 } 818 }
807 spin_unlock_bh(&sta->lock); 819 spin_unlock_bh(&sta->lock);
@@ -818,8 +830,10 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
818 DECLARE_MAC_BUF(mac); 830 DECLARE_MAC_BUF(mac);
819 831
820 if (tid >= STA_TID_NUM) { 832 if (tid >= STA_TID_NUM) {
833#ifdef CONFIG_MAC80211_HT_DEBUG
821 printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", 834 printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
822 tid, STA_TID_NUM); 835 tid, STA_TID_NUM);
836#endif
823 return; 837 return;
824 } 838 }
825 839
@@ -831,8 +845,10 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
831 rcu_read_lock(); 845 rcu_read_lock();
832 sta = sta_info_get(local, ra); 846 sta = sta_info_get(local, ra);
833 if (!sta) { 847 if (!sta) {
848#ifdef CONFIG_MAC80211_HT_DEBUG
834 printk(KERN_DEBUG "Could not find station: %s\n", 849 printk(KERN_DEBUG "Could not find station: %s\n",
835 print_mac(mac, ra)); 850 print_mac(mac, ra));
851#endif
836 rcu_read_unlock(); 852 rcu_read_unlock();
837 return; 853 return;
838 } 854 }
@@ -842,7 +858,9 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
842 * ieee80211_stop_tx_ba_session will let only 858 * ieee80211_stop_tx_ba_session will let only
843 * one stop call to pass through per sta/tid */ 859 * one stop call to pass through per sta/tid */
844 if ((*state & HT_AGG_STATE_REQ_STOP_BA_MSK) == 0) { 860 if ((*state & HT_AGG_STATE_REQ_STOP_BA_MSK) == 0) {
861#ifdef CONFIG_MAC80211_HT_DEBUG
845 printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n"); 862 printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n");
863#endif
846 rcu_read_unlock(); 864 rcu_read_unlock();
847 return; 865 return;
848 } 866 }
@@ -884,9 +902,11 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
884 struct sk_buff *skb = dev_alloc_skb(0); 902 struct sk_buff *skb = dev_alloc_skb(0);
885 903
886 if (unlikely(!skb)) { 904 if (unlikely(!skb)) {
905#ifdef CONFIG_MAC80211_HT_DEBUG
887 if (net_ratelimit()) 906 if (net_ratelimit())
888 printk(KERN_WARNING "%s: Not enough memory, " 907 printk(KERN_WARNING "%s: Not enough memory, "
889 "dropping start BA session", skb->dev->name); 908 "dropping start BA session", skb->dev->name);
909#endif
890 return; 910 return;
891 } 911 }
892 ra_tid = (struct ieee80211_ra_tid *) &skb->cb; 912 ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
@@ -907,9 +927,11 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
907 struct sk_buff *skb = dev_alloc_skb(0); 927 struct sk_buff *skb = dev_alloc_skb(0);
908 928
909 if (unlikely(!skb)) { 929 if (unlikely(!skb)) {
930#ifdef CONFIG_MAC80211_HT_DEBUG
910 if (net_ratelimit()) 931 if (net_ratelimit())
911 printk(KERN_WARNING "%s: Not enough memory, " 932 printk(KERN_WARNING "%s: Not enough memory, "
912 "dropping stop BA session", skb->dev->name); 933 "dropping stop BA session", skb->dev->name);
934#endif
913 return; 935 return;
914 } 936 }
915 ra_tid = (struct ieee80211_ra_tid *) &skb->cb; 937 ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
@@ -1236,9 +1258,8 @@ static void ieee80211_tasklet_handler(unsigned long data)
1236 ra_tid->ra, ra_tid->tid); 1258 ra_tid->ra, ra_tid->tid);
1237 dev_kfree_skb(skb); 1259 dev_kfree_skb(skb);
1238 break ; 1260 break ;
1239 default: /* should never get here! */ 1261 default:
1240 printk(KERN_ERR "%s: Unknown message type (%d)\n", 1262 WARN_ON(1);
1241 wiphy_name(local->hw.wiphy), skb->pkt_type);
1242 dev_kfree_skb(skb); 1263 dev_kfree_skb(skb);
1243 break; 1264 break;
1244 } 1265 }
@@ -1365,12 +1386,14 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
1365 return; 1386 return;
1366 } 1387 }
1367 1388
1389#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1368 if (net_ratelimit()) 1390 if (net_ratelimit())
1369 printk(KERN_DEBUG "%s: dropped TX filtered frame, " 1391 printk(KERN_DEBUG "%s: dropped TX filtered frame, "
1370 "queue_len=%d PS=%d @%lu\n", 1392 "queue_len=%d PS=%d @%lu\n",
1371 wiphy_name(local->hw.wiphy), 1393 wiphy_name(local->hw.wiphy),
1372 skb_queue_len(&sta->tx_filtered), 1394 skb_queue_len(&sta->tx_filtered),
1373 !!test_sta_flags(sta, WLAN_STA_PS), jiffies); 1395 !!test_sta_flags(sta, WLAN_STA_PS), jiffies);
1396#endif
1374 dev_kfree_skb(skb); 1397 dev_kfree_skb(skb);
1375} 1398}
1376 1399
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 947b13b40726..5f88a2e6ee50 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -262,7 +262,6 @@ void mesh_plink_broken(struct sta_info *sta)
262 } 262 }
263 rcu_read_unlock(); 263 rcu_read_unlock();
264} 264}
265EXPORT_SYMBOL(mesh_plink_broken);
266 265
267/** 266/**
268 * mesh_path_flush_by_nexthop - Deletes mesh paths if their next hop matches 267 * mesh_path_flush_by_nexthop - Deletes mesh paths if their next hop matches
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 7b4d4d46843b..4a3bddd206d8 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -346,7 +346,7 @@ static void ieee80211_sta_wmm_params(struct net_device *dev,
346 params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4); 346 params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4);
347 params.cw_min = ecw2cw(pos[1] & 0x0f); 347 params.cw_min = ecw2cw(pos[1] & 0x0f);
348 params.txop = pos[2] | (pos[3] << 8); 348 params.txop = pos[2] | (pos[3] << 8);
349#ifdef CONFIG_MAC80211_DEBUG 349#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
350 printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d " 350 printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d "
351 "cWmin=%d cWmax=%d txop=%d\n", 351 "cWmin=%d cWmax=%d txop=%d\n",
352 dev->name, queue, aci, acm, params.aifs, params.cw_min, 352 dev->name, queue, aci, acm, params.aifs, params.cw_min,
@@ -371,6 +371,7 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
371 u32 changed = 0; 371 u32 changed = 0;
372 372
373 if (use_protection != bss_conf->use_cts_prot) { 373 if (use_protection != bss_conf->use_cts_prot) {
374#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
374 if (net_ratelimit()) { 375 if (net_ratelimit()) {
375 printk(KERN_DEBUG "%s: CTS protection %s (BSSID=" 376 printk(KERN_DEBUG "%s: CTS protection %s (BSSID="
376 "%s)\n", 377 "%s)\n",
@@ -378,11 +379,13 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
378 use_protection ? "enabled" : "disabled", 379 use_protection ? "enabled" : "disabled",
379 print_mac(mac, ifsta->bssid)); 380 print_mac(mac, ifsta->bssid));
380 } 381 }
382#endif
381 bss_conf->use_cts_prot = use_protection; 383 bss_conf->use_cts_prot = use_protection;
382 changed |= BSS_CHANGED_ERP_CTS_PROT; 384 changed |= BSS_CHANGED_ERP_CTS_PROT;
383 } 385 }
384 386
385 if (use_short_preamble != bss_conf->use_short_preamble) { 387 if (use_short_preamble != bss_conf->use_short_preamble) {
388#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
386 if (net_ratelimit()) { 389 if (net_ratelimit()) {
387 printk(KERN_DEBUG "%s: switched to %s barker preamble" 390 printk(KERN_DEBUG "%s: switched to %s barker preamble"
388 " (BSSID=%s)\n", 391 " (BSSID=%s)\n",
@@ -390,6 +393,7 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
390 use_short_preamble ? "short" : "long", 393 use_short_preamble ? "short" : "long",
391 print_mac(mac, ifsta->bssid)); 394 print_mac(mac, ifsta->bssid));
392 } 395 }
396#endif
393 bss_conf->use_short_preamble = use_short_preamble; 397 bss_conf->use_short_preamble = use_short_preamble;
394 changed |= BSS_CHANGED_ERP_PREAMBLE; 398 changed |= BSS_CHANGED_ERP_PREAMBLE;
395 } 399 }
@@ -747,6 +751,10 @@ static void ieee80211_send_assoc(struct net_device *dev,
747 * b-only mode) */ 751 * b-only mode) */
748 rates_len = ieee80211_compatible_rates(bss, sband, &rates); 752 rates_len = ieee80211_compatible_rates(bss, sband, &rates);
749 753
754 if ((bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT) &&
755 (local->hw.flags & IEEE80211_HW_SPECTRUM_MGMT))
756 capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
757
750 ieee80211_rx_bss_put(dev, bss); 758 ieee80211_rx_bss_put(dev, bss);
751 } else { 759 } else {
752 rates = ~0; 760 rates = ~0;
@@ -814,6 +822,26 @@ static void ieee80211_send_assoc(struct net_device *dev,
814 } 822 }
815 } 823 }
816 824
825 if (capab & WLAN_CAPABILITY_SPECTRUM_MGMT) {
826 /* 1. power capabilities */
827 pos = skb_put(skb, 4);
828 *pos++ = WLAN_EID_PWR_CAPABILITY;
829 *pos++ = 2;
830 *pos++ = 0; /* min tx power */
831 *pos++ = local->hw.conf.channel->max_power; /* max tx power */
832
833 /* 2. supported channels */
834 /* TODO: get this in reg domain format */
835 pos = skb_put(skb, 2 * sband->n_channels + 2);
836 *pos++ = WLAN_EID_SUPPORTED_CHANNELS;
837 *pos++ = 2 * sband->n_channels;
838 for (i = 0; i < sband->n_channels; i++) {
839 *pos++ = ieee80211_frequency_to_channel(
840 sband->channels[i].center_freq);
841 *pos++ = 1; /* one channel in the subband*/
842 }
843 }
844
817 if (ifsta->extra_ie) { 845 if (ifsta->extra_ie) {
818 pos = skb_put(skb, ifsta->extra_ie_len); 846 pos = skb_put(skb, ifsta->extra_ie_len);
819 memcpy(pos, ifsta->extra_ie, ifsta->extra_ie_len); 847 memcpy(pos, ifsta->extra_ie, ifsta->extra_ie_len);
@@ -1151,14 +1179,10 @@ static void ieee80211_auth_challenge(struct net_device *dev,
1151 u8 *pos; 1179 u8 *pos;
1152 struct ieee802_11_elems elems; 1180 struct ieee802_11_elems elems;
1153 1181
1154 printk(KERN_DEBUG "%s: replying to auth challenge\n", dev->name);
1155 pos = mgmt->u.auth.variable; 1182 pos = mgmt->u.auth.variable;
1156 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); 1183 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
1157 if (!elems.challenge) { 1184 if (!elems.challenge)
1158 printk(KERN_DEBUG "%s: no challenge IE in shared key auth "
1159 "frame\n", dev->name);
1160 return; 1185 return;
1161 }
1162 ieee80211_send_auth(dev, ifsta, 3, elems.challenge - 2, 1186 ieee80211_send_auth(dev, ifsta, 3, elems.challenge - 2,
1163 elems.challenge_len + 2, 1); 1187 elems.challenge_len + 2, 1);
1164} 1188}
@@ -1340,9 +1364,11 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
1340 sta->ampdu_mlme.tid_rx[tid] = 1364 sta->ampdu_mlme.tid_rx[tid] =
1341 kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC); 1365 kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC);
1342 if (!sta->ampdu_mlme.tid_rx[tid]) { 1366 if (!sta->ampdu_mlme.tid_rx[tid]) {
1367#ifdef CONFIG_MAC80211_HT_DEBUG
1343 if (net_ratelimit()) 1368 if (net_ratelimit())
1344 printk(KERN_ERR "allocate rx mlme to tid %d failed\n", 1369 printk(KERN_ERR "allocate rx mlme to tid %d failed\n",
1345 tid); 1370 tid);
1371#endif
1346 goto end; 1372 goto end;
1347 } 1373 }
1348 /* rx timer */ 1374 /* rx timer */
@@ -1358,9 +1384,11 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
1358 tid_agg_rx->reorder_buf = 1384 tid_agg_rx->reorder_buf =
1359 kmalloc(buf_size * sizeof(struct sk_buff *), GFP_ATOMIC); 1385 kmalloc(buf_size * sizeof(struct sk_buff *), GFP_ATOMIC);
1360 if (!tid_agg_rx->reorder_buf) { 1386 if (!tid_agg_rx->reorder_buf) {
1387#ifdef CONFIG_MAC80211_HT_DEBUG
1361 if (net_ratelimit()) 1388 if (net_ratelimit())
1362 printk(KERN_ERR "can not allocate reordering buffer " 1389 printk(KERN_ERR "can not allocate reordering buffer "
1363 "to tid %d\n", tid); 1390 "to tid %d\n", tid);
1391#endif
1364 kfree(sta->ampdu_mlme.tid_rx[tid]); 1392 kfree(sta->ampdu_mlme.tid_rx[tid]);
1365 goto end; 1393 goto end;
1366 } 1394 }
@@ -1427,8 +1455,6 @@ static void ieee80211_sta_process_addba_resp(struct net_device *dev,
1427 1455
1428 if (!(*state & HT_ADDBA_REQUESTED_MSK)) { 1456 if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
1429 spin_unlock_bh(&sta->lock); 1457 spin_unlock_bh(&sta->lock);
1430 printk(KERN_DEBUG "state not HT_ADDBA_REQUESTED_MSK:"
1431 "%d\n", *state);
1432 goto addba_resp_exit; 1458 goto addba_resp_exit;
1433 } 1459 }
1434 1460
@@ -1447,22 +1473,14 @@ static void ieee80211_sta_process_addba_resp(struct net_device *dev,
1447#endif /* CONFIG_MAC80211_HT_DEBUG */ 1473#endif /* CONFIG_MAC80211_HT_DEBUG */
1448 if (le16_to_cpu(mgmt->u.action.u.addba_resp.status) 1474 if (le16_to_cpu(mgmt->u.action.u.addba_resp.status)
1449 == WLAN_STATUS_SUCCESS) { 1475 == WLAN_STATUS_SUCCESS) {
1450 if (*state & HT_ADDBA_RECEIVED_MSK)
1451 printk(KERN_DEBUG "double addBA response\n");
1452
1453 *state |= HT_ADDBA_RECEIVED_MSK; 1476 *state |= HT_ADDBA_RECEIVED_MSK;
1454 sta->ampdu_mlme.addba_req_num[tid] = 0; 1477 sta->ampdu_mlme.addba_req_num[tid] = 0;
1455 1478
1456 if (*state == HT_AGG_STATE_OPERATIONAL) { 1479 if (*state == HT_AGG_STATE_OPERATIONAL)
1457 printk(KERN_DEBUG "Aggregation on for tid %d \n", tid);
1458 ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); 1480 ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
1459 }
1460 1481
1461 spin_unlock_bh(&sta->lock); 1482 spin_unlock_bh(&sta->lock);
1462 printk(KERN_DEBUG "recipient accepted agg: tid %d \n", tid);
1463 } else { 1483 } else {
1464 printk(KERN_DEBUG "recipient rejected agg: tid %d \n", tid);
1465
1466 sta->ampdu_mlme.addba_req_num[tid]++; 1484 sta->ampdu_mlme.addba_req_num[tid]++;
1467 /* this will allow the state check in stop_BA_session */ 1485 /* this will allow the state check in stop_BA_session */
1468 *state = HT_AGG_STATE_OPERATIONAL; 1486 *state = HT_AGG_STATE_OPERATIONAL;
@@ -1561,7 +1579,7 @@ void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *ra, u16 tid,
1561 ra, tid, NULL); 1579 ra, tid, NULL);
1562 if (ret) 1580 if (ret)
1563 printk(KERN_DEBUG "HW problem - can not stop rx " 1581 printk(KERN_DEBUG "HW problem - can not stop rx "
1564 "aggergation for tid %d\n", tid); 1582 "aggregation for tid %d\n", tid);
1565 1583
1566 /* shutdown timer has not expired */ 1584 /* shutdown timer has not expired */
1567 if (initiator != WLAN_BACK_TIMER) 1585 if (initiator != WLAN_BACK_TIMER)
@@ -1667,12 +1685,16 @@ void sta_addba_resp_timer_expired(unsigned long data)
1667 if (!(*state & HT_ADDBA_REQUESTED_MSK)) { 1685 if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
1668 spin_unlock_bh(&sta->lock); 1686 spin_unlock_bh(&sta->lock);
1669 *state = HT_AGG_STATE_IDLE; 1687 *state = HT_AGG_STATE_IDLE;
1688#ifdef CONFIG_MAC80211_HT_DEBUG
1670 printk(KERN_DEBUG "timer expired on tid %d but we are not " 1689 printk(KERN_DEBUG "timer expired on tid %d but we are not "
1671 "expecting addBA response there", tid); 1690 "expecting addBA response there", tid);
1691#endif
1672 goto timer_expired_exit; 1692 goto timer_expired_exit;
1673 } 1693 }
1674 1694
1695#ifdef CONFIG_MAC80211_HT_DEBUG
1675 printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid); 1696 printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid);
1697#endif
1676 1698
1677 /* go through the state check in stop_BA_session */ 1699 /* go through the state check in stop_BA_session */
1678 *state = HT_AGG_STATE_OPERATIONAL; 1700 *state = HT_AGG_STATE_OPERATIONAL;
@@ -1700,7 +1722,9 @@ static void sta_rx_agg_session_timer_expired(unsigned long data)
1700 struct sta_info *sta = container_of(timer_to_id, struct sta_info, 1722 struct sta_info *sta = container_of(timer_to_id, struct sta_info,
1701 timer_to_tid[0]); 1723 timer_to_tid[0]);
1702 1724
1725#ifdef CONFIG_MAC80211_HT_DEBUG
1703 printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); 1726 printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid);
1727#endif
1704 ieee80211_sta_stop_rx_ba_session(sta->sdata->dev, sta->addr, 1728 ieee80211_sta_stop_rx_ba_session(sta->sdata->dev, sta->addr,
1705 (u16)*ptid, WLAN_BACK_TIMER, 1729 (u16)*ptid, WLAN_BACK_TIMER,
1706 WLAN_REASON_QSTA_TIMEOUT); 1730 WLAN_REASON_QSTA_TIMEOUT);
@@ -1795,47 +1819,24 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev,
1795 DECLARE_MAC_BUF(mac); 1819 DECLARE_MAC_BUF(mac);
1796 1820
1797 if (ifsta->state != IEEE80211_AUTHENTICATE && 1821 if (ifsta->state != IEEE80211_AUTHENTICATE &&
1798 sdata->vif.type != IEEE80211_IF_TYPE_IBSS) { 1822 sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
1799 printk(KERN_DEBUG "%s: authentication frame received from "
1800 "%s, but not in authenticate state - ignored\n",
1801 dev->name, print_mac(mac, mgmt->sa));
1802 return; 1823 return;
1803 }
1804 1824
1805 if (len < 24 + 6) { 1825 if (len < 24 + 6)
1806 printk(KERN_DEBUG "%s: too short (%zd) authentication frame "
1807 "received from %s - ignored\n",
1808 dev->name, len, print_mac(mac, mgmt->sa));
1809 return; 1826 return;
1810 }
1811 1827
1812 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 1828 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
1813 memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { 1829 memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0)
1814 printk(KERN_DEBUG "%s: authentication frame received from "
1815 "unknown AP (SA=%s BSSID=%s) - "
1816 "ignored\n", dev->name, print_mac(mac, mgmt->sa),
1817 print_mac(mac, mgmt->bssid));
1818 return; 1830 return;
1819 }
1820 1831
1821 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 1832 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
1822 memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) { 1833 memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)
1823 printk(KERN_DEBUG "%s: authentication frame received from "
1824 "unknown BSSID (SA=%s BSSID=%s) - "
1825 "ignored\n", dev->name, print_mac(mac, mgmt->sa),
1826 print_mac(mac, mgmt->bssid));
1827 return; 1834 return;
1828 }
1829 1835
1830 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); 1836 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
1831 auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); 1837 auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
1832 status_code = le16_to_cpu(mgmt->u.auth.status_code); 1838 status_code = le16_to_cpu(mgmt->u.auth.status_code);
1833 1839
1834 printk(KERN_DEBUG "%s: RX authentication from %s (alg=%d "
1835 "transaction=%d status=%d)\n",
1836 dev->name, print_mac(mac, mgmt->sa), auth_alg,
1837 auth_transaction, status_code);
1838
1839 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 1840 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
1840 /* 1841 /*
1841 * IEEE 802.11 standard does not require authentication in IBSS 1842 * IEEE 802.11 standard does not require authentication in IBSS
@@ -1843,26 +1844,16 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev,
1843 * However, try to reply to authentication attempts if someone 1844 * However, try to reply to authentication attempts if someone
1844 * has actually implemented this. 1845 * has actually implemented this.
1845 */ 1846 */
1846 if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) { 1847 if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
1847 printk(KERN_DEBUG "%s: unexpected IBSS authentication "
1848 "frame (alg=%d transaction=%d)\n",
1849 dev->name, auth_alg, auth_transaction);
1850 return; 1848 return;
1851 }
1852 ieee80211_send_auth(dev, ifsta, 2, NULL, 0, 0); 1849 ieee80211_send_auth(dev, ifsta, 2, NULL, 0, 0);
1853 } 1850 }
1854 1851
1855 if (auth_alg != ifsta->auth_alg || 1852 if (auth_alg != ifsta->auth_alg ||
1856 auth_transaction != ifsta->auth_transaction) { 1853 auth_transaction != ifsta->auth_transaction)
1857 printk(KERN_DEBUG "%s: unexpected authentication frame "
1858 "(alg=%d transaction=%d)\n",
1859 dev->name, auth_alg, auth_transaction);
1860 return; 1854 return;
1861 }
1862 1855
1863 if (status_code != WLAN_STATUS_SUCCESS) { 1856 if (status_code != WLAN_STATUS_SUCCESS) {
1864 printk(KERN_DEBUG "%s: AP denied authentication (auth_alg=%d "
1865 "code=%d)\n", dev->name, ifsta->auth_alg, status_code);
1866 if (status_code == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) { 1857 if (status_code == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) {
1867 u8 algs[3]; 1858 u8 algs[3];
1868 const int num_algs = ARRAY_SIZE(algs); 1859 const int num_algs = ARRAY_SIZE(algs);
@@ -1891,9 +1882,6 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev,
1891 !ieee80211_sta_wep_configured(dev)) 1882 !ieee80211_sta_wep_configured(dev))
1892 continue; 1883 continue;
1893 ifsta->auth_alg = algs[pos]; 1884 ifsta->auth_alg = algs[pos];
1894 printk(KERN_DEBUG "%s: set auth_alg=%d for "
1895 "next try\n",
1896 dev->name, ifsta->auth_alg);
1897 break; 1885 break;
1898 } 1886 }
1899 } 1887 }
@@ -1923,27 +1911,14 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev,
1923 u16 reason_code; 1911 u16 reason_code;
1924 DECLARE_MAC_BUF(mac); 1912 DECLARE_MAC_BUF(mac);
1925 1913
1926 if (len < 24 + 2) { 1914 if (len < 24 + 2)
1927 printk(KERN_DEBUG "%s: too short (%zd) deauthentication frame "
1928 "received from %s - ignored\n",
1929 dev->name, len, print_mac(mac, mgmt->sa));
1930 return; 1915 return;
1931 }
1932 1916
1933 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { 1917 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN))
1934 printk(KERN_DEBUG "%s: deauthentication frame received from "
1935 "unknown AP (SA=%s BSSID=%s) - "
1936 "ignored\n", dev->name, print_mac(mac, mgmt->sa),
1937 print_mac(mac, mgmt->bssid));
1938 return; 1918 return;
1939 }
1940 1919
1941 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); 1920 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
1942 1921
1943 printk(KERN_DEBUG "%s: RX deauthentication from %s"
1944 " (reason=%d)\n",
1945 dev->name, print_mac(mac, mgmt->sa), reason_code);
1946
1947 if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) 1922 if (ifsta->flags & IEEE80211_STA_AUTHENTICATED)
1948 printk(KERN_DEBUG "%s: deauthenticated\n", dev->name); 1923 printk(KERN_DEBUG "%s: deauthenticated\n", dev->name);
1949 1924
@@ -1968,27 +1943,14 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev,
1968 u16 reason_code; 1943 u16 reason_code;
1969 DECLARE_MAC_BUF(mac); 1944 DECLARE_MAC_BUF(mac);
1970 1945
1971 if (len < 24 + 2) { 1946 if (len < 24 + 2)
1972 printk(KERN_DEBUG "%s: too short (%zd) disassociation frame "
1973 "received from %s - ignored\n",
1974 dev->name, len, print_mac(mac, mgmt->sa));
1975 return; 1947 return;
1976 }
1977 1948
1978 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { 1949 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN))
1979 printk(KERN_DEBUG "%s: disassociation frame received from "
1980 "unknown AP (SA=%s BSSID=%s) - "
1981 "ignored\n", dev->name, print_mac(mac, mgmt->sa),
1982 print_mac(mac, mgmt->bssid));
1983 return; 1950 return;
1984 }
1985 1951
1986 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); 1952 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
1987 1953
1988 printk(KERN_DEBUG "%s: RX disassociation from %s"
1989 " (reason=%d)\n",
1990 dev->name, print_mac(mac, mgmt->sa), reason_code);
1991
1992 if (ifsta->flags & IEEE80211_STA_ASSOCIATED) 1954 if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
1993 printk(KERN_DEBUG "%s: disassociated\n", dev->name); 1955 printk(KERN_DEBUG "%s: disassociated\n", dev->name);
1994 1956
@@ -2024,27 +1986,14 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2024 /* AssocResp and ReassocResp have identical structure, so process both 1986 /* AssocResp and ReassocResp have identical structure, so process both
2025 * of them in this function. */ 1987 * of them in this function. */
2026 1988
2027 if (ifsta->state != IEEE80211_ASSOCIATE) { 1989 if (ifsta->state != IEEE80211_ASSOCIATE)
2028 printk(KERN_DEBUG "%s: association frame received from "
2029 "%s, but not in associate state - ignored\n",
2030 dev->name, print_mac(mac, mgmt->sa));
2031 return; 1990 return;
2032 }
2033 1991
2034 if (len < 24 + 6) { 1992 if (len < 24 + 6)
2035 printk(KERN_DEBUG "%s: too short (%zd) association frame "
2036 "received from %s - ignored\n",
2037 dev->name, len, print_mac(mac, mgmt->sa));
2038 return; 1993 return;
2039 }
2040 1994
2041 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { 1995 if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0)
2042 printk(KERN_DEBUG "%s: association frame received from "
2043 "unknown AP (SA=%s BSSID=%s) - "
2044 "ignored\n", dev->name, print_mac(mac, mgmt->sa),
2045 print_mac(mac, mgmt->bssid));
2046 return; 1996 return;
2047 }
2048 1997
2049 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); 1998 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info);
2050 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); 1999 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
@@ -2479,6 +2428,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2479 memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); 2428 memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
2480 mgmt->u.beacon.beacon_int = 2429 mgmt->u.beacon.beacon_int =
2481 cpu_to_le16(local->hw.conf.beacon_int); 2430 cpu_to_le16(local->hw.conf.beacon_int);
2431 mgmt->u.beacon.timestamp = cpu_to_le64(bss->timestamp);
2482 mgmt->u.beacon.capab_info = cpu_to_le16(bss->capability); 2432 mgmt->u.beacon.capab_info = cpu_to_le16(bss->capability);
2483 2433
2484 pos = skb_put(skb, 2 + ifsta->ssid_len); 2434 pos = skb_put(skb, 2 + ifsta->ssid_len);
@@ -2622,11 +2572,10 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2622 struct ieee80211_mgmt *mgmt, 2572 struct ieee80211_mgmt *mgmt,
2623 size_t len, 2573 size_t len,
2624 struct ieee80211_rx_status *rx_status, 2574 struct ieee80211_rx_status *rx_status,
2575 struct ieee802_11_elems *elems,
2625 int beacon) 2576 int beacon)
2626{ 2577{
2627 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 2578 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2628 struct ieee802_11_elems elems;
2629 size_t baselen;
2630 int freq, clen; 2579 int freq, clen;
2631 struct ieee80211_sta_bss *bss; 2580 struct ieee80211_sta_bss *bss;
2632 struct sta_info *sta; 2581 struct sta_info *sta;
@@ -2639,35 +2588,24 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2639 if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN)) 2588 if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN))
2640 return; /* ignore ProbeResp to foreign address */ 2589 return; /* ignore ProbeResp to foreign address */
2641 2590
2642#if 0
2643 printk(KERN_DEBUG "%s: RX %s from %s to %s\n",
2644 dev->name, beacon ? "Beacon" : "Probe Response",
2645 print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da));
2646#endif
2647
2648 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt;
2649 if (baselen > len)
2650 return;
2651
2652 beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp); 2591 beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp);
2653 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems);
2654 2592
2655 if (ieee80211_vif_is_mesh(&sdata->vif) && elems.mesh_id && 2593 if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id &&
2656 elems.mesh_config && mesh_matches_local(&elems, dev)) { 2594 elems->mesh_config && mesh_matches_local(elems, dev)) {
2657 u64 rates = ieee80211_sta_get_rates(local, &elems, 2595 u64 rates = ieee80211_sta_get_rates(local, elems,
2658 rx_status->band); 2596 rx_status->band);
2659 2597
2660 mesh_neighbour_update(mgmt->sa, rates, dev, 2598 mesh_neighbour_update(mgmt->sa, rates, dev,
2661 mesh_peer_accepts_plinks(&elems, dev)); 2599 mesh_peer_accepts_plinks(elems, dev));
2662 } 2600 }
2663 2601
2664 rcu_read_lock(); 2602 rcu_read_lock();
2665 2603
2666 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && elems.supp_rates && 2604 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && elems->supp_rates &&
2667 memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0 && 2605 memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0 &&
2668 (sta = sta_info_get(local, mgmt->sa))) { 2606 (sta = sta_info_get(local, mgmt->sa))) {
2669 u64 prev_rates; 2607 u64 prev_rates;
2670 u64 supp_rates = ieee80211_sta_get_rates(local, &elems, 2608 u64 supp_rates = ieee80211_sta_get_rates(local, elems,
2671 rx_status->band); 2609 rx_status->band);
2672 2610
2673 prev_rates = sta->supp_rates[rx_status->band]; 2611 prev_rates = sta->supp_rates[rx_status->band];
@@ -2679,21 +2617,12 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2679 sta->supp_rates[rx_status->band] = 2617 sta->supp_rates[rx_status->band] =
2680 sdata->u.sta.supp_rates_bits[rx_status->band]; 2618 sdata->u.sta.supp_rates_bits[rx_status->band];
2681 } 2619 }
2682 if (sta->supp_rates[rx_status->band] != prev_rates) {
2683 printk(KERN_DEBUG "%s: updated supp_rates set for "
2684 "%s based on beacon info (0x%llx & 0x%llx -> "
2685 "0x%llx)\n",
2686 dev->name, print_mac(mac, sta->addr),
2687 (unsigned long long) prev_rates,
2688 (unsigned long long) supp_rates,
2689 (unsigned long long) sta->supp_rates[rx_status->band]);
2690 }
2691 } 2620 }
2692 2621
2693 rcu_read_unlock(); 2622 rcu_read_unlock();
2694 2623
2695 if (elems.ds_params && elems.ds_params_len == 1) 2624 if (elems->ds_params && elems->ds_params_len == 1)
2696 freq = ieee80211_channel_to_frequency(elems.ds_params[0]); 2625 freq = ieee80211_channel_to_frequency(elems->ds_params[0]);
2697 else 2626 else
2698 freq = rx_status->freq; 2627 freq = rx_status->freq;
2699 2628
@@ -2703,23 +2632,23 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2703 return; 2632 return;
2704 2633
2705#ifdef CONFIG_MAC80211_MESH 2634#ifdef CONFIG_MAC80211_MESH
2706 if (elems.mesh_config) 2635 if (elems->mesh_config)
2707 bss = ieee80211_rx_mesh_bss_get(dev, elems.mesh_id, 2636 bss = ieee80211_rx_mesh_bss_get(dev, elems->mesh_id,
2708 elems.mesh_id_len, elems.mesh_config, freq); 2637 elems->mesh_id_len, elems->mesh_config, freq);
2709 else 2638 else
2710#endif 2639#endif
2711 bss = ieee80211_rx_bss_get(dev, mgmt->bssid, freq, 2640 bss = ieee80211_rx_bss_get(dev, mgmt->bssid, freq,
2712 elems.ssid, elems.ssid_len); 2641 elems->ssid, elems->ssid_len);
2713 if (!bss) { 2642 if (!bss) {
2714#ifdef CONFIG_MAC80211_MESH 2643#ifdef CONFIG_MAC80211_MESH
2715 if (elems.mesh_config) 2644 if (elems->mesh_config)
2716 bss = ieee80211_rx_mesh_bss_add(dev, elems.mesh_id, 2645 bss = ieee80211_rx_mesh_bss_add(dev, elems->mesh_id,
2717 elems.mesh_id_len, elems.mesh_config, 2646 elems->mesh_id_len, elems->mesh_config,
2718 elems.mesh_config_len, freq); 2647 elems->mesh_config_len, freq);
2719 else 2648 else
2720#endif 2649#endif
2721 bss = ieee80211_rx_bss_add(dev, mgmt->bssid, freq, 2650 bss = ieee80211_rx_bss_add(dev, mgmt->bssid, freq,
2722 elems.ssid, elems.ssid_len); 2651 elems->ssid, elems->ssid_len);
2723 if (!bss) 2652 if (!bss)
2724 return; 2653 return;
2725 } else { 2654 } else {
@@ -2732,43 +2661,43 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2732 } 2661 }
2733 2662
2734 /* save the ERP value so that it is available at association time */ 2663 /* save the ERP value so that it is available at association time */
2735 if (elems.erp_info && elems.erp_info_len >= 1) { 2664 if (elems->erp_info && elems->erp_info_len >= 1) {
2736 bss->erp_value = elems.erp_info[0]; 2665 bss->erp_value = elems->erp_info[0];
2737 bss->has_erp_value = 1; 2666 bss->has_erp_value = 1;
2738 } 2667 }
2739 2668
2740 if (elems.ht_cap_elem && 2669 if (elems->ht_cap_elem &&
2741 (!bss->ht_ie || bss->ht_ie_len != elems.ht_cap_elem_len || 2670 (!bss->ht_ie || bss->ht_ie_len != elems->ht_cap_elem_len ||
2742 memcmp(bss->ht_ie, elems.ht_cap_elem, elems.ht_cap_elem_len))) { 2671 memcmp(bss->ht_ie, elems->ht_cap_elem, elems->ht_cap_elem_len))) {
2743 kfree(bss->ht_ie); 2672 kfree(bss->ht_ie);
2744 bss->ht_ie = kmalloc(elems.ht_cap_elem_len + 2, GFP_ATOMIC); 2673 bss->ht_ie = kmalloc(elems->ht_cap_elem_len + 2, GFP_ATOMIC);
2745 if (bss->ht_ie) { 2674 if (bss->ht_ie) {
2746 memcpy(bss->ht_ie, elems.ht_cap_elem - 2, 2675 memcpy(bss->ht_ie, elems->ht_cap_elem - 2,
2747 elems.ht_cap_elem_len + 2); 2676 elems->ht_cap_elem_len + 2);
2748 bss->ht_ie_len = elems.ht_cap_elem_len + 2; 2677 bss->ht_ie_len = elems->ht_cap_elem_len + 2;
2749 } else 2678 } else
2750 bss->ht_ie_len = 0; 2679 bss->ht_ie_len = 0;
2751 } else if (!elems.ht_cap_elem && bss->ht_ie) { 2680 } else if (!elems->ht_cap_elem && bss->ht_ie) {
2752 kfree(bss->ht_ie); 2681 kfree(bss->ht_ie);
2753 bss->ht_ie = NULL; 2682 bss->ht_ie = NULL;
2754 bss->ht_ie_len = 0; 2683 bss->ht_ie_len = 0;
2755 } 2684 }
2756 2685
2757 if (elems.ht_info_elem && 2686 if (elems->ht_info_elem &&
2758 (!bss->ht_add_ie || 2687 (!bss->ht_add_ie ||
2759 bss->ht_add_ie_len != elems.ht_info_elem_len || 2688 bss->ht_add_ie_len != elems->ht_info_elem_len ||
2760 memcmp(bss->ht_add_ie, elems.ht_info_elem, 2689 memcmp(bss->ht_add_ie, elems->ht_info_elem,
2761 elems.ht_info_elem_len))) { 2690 elems->ht_info_elem_len))) {
2762 kfree(bss->ht_add_ie); 2691 kfree(bss->ht_add_ie);
2763 bss->ht_add_ie = 2692 bss->ht_add_ie =
2764 kmalloc(elems.ht_info_elem_len + 2, GFP_ATOMIC); 2693 kmalloc(elems->ht_info_elem_len + 2, GFP_ATOMIC);
2765 if (bss->ht_add_ie) { 2694 if (bss->ht_add_ie) {
2766 memcpy(bss->ht_add_ie, elems.ht_info_elem - 2, 2695 memcpy(bss->ht_add_ie, elems->ht_info_elem - 2,
2767 elems.ht_info_elem_len + 2); 2696 elems->ht_info_elem_len + 2);
2768 bss->ht_add_ie_len = elems.ht_info_elem_len + 2; 2697 bss->ht_add_ie_len = elems->ht_info_elem_len + 2;
2769 } else 2698 } else
2770 bss->ht_add_ie_len = 0; 2699 bss->ht_add_ie_len = 0;
2771 } else if (!elems.ht_info_elem && bss->ht_add_ie) { 2700 } else if (!elems->ht_info_elem && bss->ht_add_ie) {
2772 kfree(bss->ht_add_ie); 2701 kfree(bss->ht_add_ie);
2773 bss->ht_add_ie = NULL; 2702 bss->ht_add_ie = NULL;
2774 bss->ht_add_ie_len = 0; 2703 bss->ht_add_ie_len = 0;
@@ -2778,20 +2707,20 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2778 bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info); 2707 bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info);
2779 2708
2780 bss->supp_rates_len = 0; 2709 bss->supp_rates_len = 0;
2781 if (elems.supp_rates) { 2710 if (elems->supp_rates) {
2782 clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len; 2711 clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len;
2783 if (clen > elems.supp_rates_len) 2712 if (clen > elems->supp_rates_len)
2784 clen = elems.supp_rates_len; 2713 clen = elems->supp_rates_len;
2785 memcpy(&bss->supp_rates[bss->supp_rates_len], elems.supp_rates, 2714 memcpy(&bss->supp_rates[bss->supp_rates_len], elems->supp_rates,
2786 clen); 2715 clen);
2787 bss->supp_rates_len += clen; 2716 bss->supp_rates_len += clen;
2788 } 2717 }
2789 if (elems.ext_supp_rates) { 2718 if (elems->ext_supp_rates) {
2790 clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len; 2719 clen = IEEE80211_MAX_SUPP_RATES - bss->supp_rates_len;
2791 if (clen > elems.ext_supp_rates_len) 2720 if (clen > elems->ext_supp_rates_len)
2792 clen = elems.ext_supp_rates_len; 2721 clen = elems->ext_supp_rates_len;
2793 memcpy(&bss->supp_rates[bss->supp_rates_len], 2722 memcpy(&bss->supp_rates[bss->supp_rates_len],
2794 elems.ext_supp_rates, clen); 2723 elems->ext_supp_rates, clen);
2795 bss->supp_rates_len += clen; 2724 bss->supp_rates_len += clen;
2796 } 2725 }
2797 2726
@@ -2815,33 +2744,33 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2815 return; 2744 return;
2816 } 2745 }
2817 2746
2818 if (elems.wpa && 2747 if (elems->wpa &&
2819 (!bss->wpa_ie || bss->wpa_ie_len != elems.wpa_len || 2748 (!bss->wpa_ie || bss->wpa_ie_len != elems->wpa_len ||
2820 memcmp(bss->wpa_ie, elems.wpa, elems.wpa_len))) { 2749 memcmp(bss->wpa_ie, elems->wpa, elems->wpa_len))) {
2821 kfree(bss->wpa_ie); 2750 kfree(bss->wpa_ie);
2822 bss->wpa_ie = kmalloc(elems.wpa_len + 2, GFP_ATOMIC); 2751 bss->wpa_ie = kmalloc(elems->wpa_len + 2, GFP_ATOMIC);
2823 if (bss->wpa_ie) { 2752 if (bss->wpa_ie) {
2824 memcpy(bss->wpa_ie, elems.wpa - 2, elems.wpa_len + 2); 2753 memcpy(bss->wpa_ie, elems->wpa - 2, elems->wpa_len + 2);
2825 bss->wpa_ie_len = elems.wpa_len + 2; 2754 bss->wpa_ie_len = elems->wpa_len + 2;
2826 } else 2755 } else
2827 bss->wpa_ie_len = 0; 2756 bss->wpa_ie_len = 0;
2828 } else if (!elems.wpa && bss->wpa_ie) { 2757 } else if (!elems->wpa && bss->wpa_ie) {
2829 kfree(bss->wpa_ie); 2758 kfree(bss->wpa_ie);
2830 bss->wpa_ie = NULL; 2759 bss->wpa_ie = NULL;
2831 bss->wpa_ie_len = 0; 2760 bss->wpa_ie_len = 0;
2832 } 2761 }
2833 2762
2834 if (elems.rsn && 2763 if (elems->rsn &&
2835 (!bss->rsn_ie || bss->rsn_ie_len != elems.rsn_len || 2764 (!bss->rsn_ie || bss->rsn_ie_len != elems->rsn_len ||
2836 memcmp(bss->rsn_ie, elems.rsn, elems.rsn_len))) { 2765 memcmp(bss->rsn_ie, elems->rsn, elems->rsn_len))) {
2837 kfree(bss->rsn_ie); 2766 kfree(bss->rsn_ie);
2838 bss->rsn_ie = kmalloc(elems.rsn_len + 2, GFP_ATOMIC); 2767 bss->rsn_ie = kmalloc(elems->rsn_len + 2, GFP_ATOMIC);
2839 if (bss->rsn_ie) { 2768 if (bss->rsn_ie) {
2840 memcpy(bss->rsn_ie, elems.rsn - 2, elems.rsn_len + 2); 2769 memcpy(bss->rsn_ie, elems->rsn - 2, elems->rsn_len + 2);
2841 bss->rsn_ie_len = elems.rsn_len + 2; 2770 bss->rsn_ie_len = elems->rsn_len + 2;
2842 } else 2771 } else
2843 bss->rsn_ie_len = 0; 2772 bss->rsn_ie_len = 0;
2844 } else if (!elems.rsn && bss->rsn_ie) { 2773 } else if (!elems->rsn && bss->rsn_ie) {
2845 kfree(bss->rsn_ie); 2774 kfree(bss->rsn_ie);
2846 bss->rsn_ie = NULL; 2775 bss->rsn_ie = NULL;
2847 bss->rsn_ie_len = 0; 2776 bss->rsn_ie_len = 0;
@@ -2861,20 +2790,21 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2861 * inclusion of the WMM Parameters in beacons, however, is optional. 2790 * inclusion of the WMM Parameters in beacons, however, is optional.
2862 */ 2791 */
2863 2792
2864 if (elems.wmm_param && 2793 if (elems->wmm_param &&
2865 (!bss->wmm_ie || bss->wmm_ie_len != elems.wmm_param_len || 2794 (!bss->wmm_ie || bss->wmm_ie_len != elems->wmm_param_len ||
2866 memcmp(bss->wmm_ie, elems.wmm_param, elems.wmm_param_len))) { 2795 memcmp(bss->wmm_ie, elems->wmm_param, elems->wmm_param_len))) {
2867 kfree(bss->wmm_ie); 2796 kfree(bss->wmm_ie);
2868 bss->wmm_ie = kmalloc(elems.wmm_param_len + 2, GFP_ATOMIC); 2797 bss->wmm_ie = kmalloc(elems->wmm_param_len + 2, GFP_ATOMIC);
2869 if (bss->wmm_ie) { 2798 if (bss->wmm_ie) {
2870 memcpy(bss->wmm_ie, elems.wmm_param - 2, 2799 memcpy(bss->wmm_ie, elems->wmm_param - 2,
2871 elems.wmm_param_len + 2); 2800 elems->wmm_param_len + 2);
2872 bss->wmm_ie_len = elems.wmm_param_len + 2; 2801 bss->wmm_ie_len = elems->wmm_param_len + 2;
2873 } else 2802 } else
2874 bss->wmm_ie_len = 0; 2803 bss->wmm_ie_len = 0;
2875 } else if (elems.wmm_info && 2804 } else if (elems->wmm_info &&
2876 (!bss->wmm_ie || bss->wmm_ie_len != elems.wmm_info_len || 2805 (!bss->wmm_ie || bss->wmm_ie_len != elems->wmm_info_len ||
2877 memcmp(bss->wmm_ie, elems.wmm_info, elems.wmm_info_len))) { 2806 memcmp(bss->wmm_ie, elems->wmm_info,
2807 elems->wmm_info_len))) {
2878 /* As for certain AP's Fifth bit is not set in WMM IE in 2808 /* As for certain AP's Fifth bit is not set in WMM IE in
2879 * beacon frames.So while parsing the beacon frame the 2809 * beacon frames.So while parsing the beacon frame the
2880 * wmm_info structure is used instead of wmm_param. 2810 * wmm_info structure is used instead of wmm_param.
@@ -2884,14 +2814,14 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2884 * n-band association. 2814 * n-band association.
2885 */ 2815 */
2886 kfree(bss->wmm_ie); 2816 kfree(bss->wmm_ie);
2887 bss->wmm_ie = kmalloc(elems.wmm_info_len + 2, GFP_ATOMIC); 2817 bss->wmm_ie = kmalloc(elems->wmm_info_len + 2, GFP_ATOMIC);
2888 if (bss->wmm_ie) { 2818 if (bss->wmm_ie) {
2889 memcpy(bss->wmm_ie, elems.wmm_info - 2, 2819 memcpy(bss->wmm_ie, elems->wmm_info - 2,
2890 elems.wmm_info_len + 2); 2820 elems->wmm_info_len + 2);
2891 bss->wmm_ie_len = elems.wmm_info_len + 2; 2821 bss->wmm_ie_len = elems->wmm_info_len + 2;
2892 } else 2822 } else
2893 bss->wmm_ie_len = 0; 2823 bss->wmm_ie_len = 0;
2894 } else if (!elems.wmm_param && !elems.wmm_info && bss->wmm_ie) { 2824 } else if (!elems->wmm_param && !elems->wmm_info && bss->wmm_ie) {
2895 kfree(bss->wmm_ie); 2825 kfree(bss->wmm_ie);
2896 bss->wmm_ie = NULL; 2826 bss->wmm_ie = NULL;
2897 bss->wmm_ie_len = 0; 2827 bss->wmm_ie_len = 0;
@@ -2902,8 +2832,9 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2902 !local->sta_sw_scanning && !local->sta_hw_scanning && 2832 !local->sta_sw_scanning && !local->sta_hw_scanning &&
2903 bss->capability & WLAN_CAPABILITY_IBSS && 2833 bss->capability & WLAN_CAPABILITY_IBSS &&
2904 bss->freq == local->oper_channel->center_freq && 2834 bss->freq == local->oper_channel->center_freq &&
2905 elems.ssid_len == sdata->u.sta.ssid_len && 2835 elems->ssid_len == sdata->u.sta.ssid_len &&
2906 memcmp(elems.ssid, sdata->u.sta.ssid, sdata->u.sta.ssid_len) == 0) { 2836 memcmp(elems->ssid, sdata->u.sta.ssid,
2837 sdata->u.sta.ssid_len) == 0) {
2907 if (rx_status->flag & RX_FLAG_TSFT) { 2838 if (rx_status->flag & RX_FLAG_TSFT) {
2908 /* in order for correct IBSS merging we need mactime 2839 /* in order for correct IBSS merging we need mactime
2909 * 2840 *
@@ -2941,11 +2872,10 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
2941#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 2872#endif /* CONFIG_MAC80211_IBSS_DEBUG */
2942 if (beacon_timestamp > rx_timestamp) { 2873 if (beacon_timestamp > rx_timestamp) {
2943#ifndef CONFIG_MAC80211_IBSS_DEBUG 2874#ifndef CONFIG_MAC80211_IBSS_DEBUG
2944 if (net_ratelimit()) 2875 printk(KERN_DEBUG "%s: beacon TSF higher than "
2876 "local TSF - IBSS merge with BSSID %s\n",
2877 dev->name, print_mac(mac, mgmt->bssid));
2945#endif 2878#endif
2946 printk(KERN_DEBUG "%s: beacon TSF higher than "
2947 "local TSF - IBSS merge with BSSID %s\n",
2948 dev->name, print_mac(mac, mgmt->bssid));
2949 ieee80211_sta_join_ibss(dev, &sdata->u.sta, bss); 2879 ieee80211_sta_join_ibss(dev, &sdata->u.sta, bss);
2950 ieee80211_ibss_add_sta(dev, NULL, 2880 ieee80211_ibss_add_sta(dev, NULL,
2951 mgmt->bssid, mgmt->sa, 2881 mgmt->bssid, mgmt->sa,
@@ -2962,7 +2892,17 @@ static void ieee80211_rx_mgmt_probe_resp(struct net_device *dev,
2962 size_t len, 2892 size_t len,
2963 struct ieee80211_rx_status *rx_status) 2893 struct ieee80211_rx_status *rx_status)
2964{ 2894{
2965 ieee80211_rx_bss_info(dev, mgmt, len, rx_status, 0); 2895 size_t baselen;
2896 struct ieee802_11_elems elems;
2897
2898 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
2899 if (baselen > len)
2900 return;
2901
2902 ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
2903 &elems);
2904
2905 ieee80211_rx_bss_info(dev, mgmt, len, rx_status, &elems, 0);
2966} 2906}
2967 2907
2968 2908
@@ -2979,7 +2919,14 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
2979 struct ieee80211_conf *conf = &local->hw.conf; 2919 struct ieee80211_conf *conf = &local->hw.conf;
2980 u32 changed = 0; 2920 u32 changed = 0;
2981 2921
2982 ieee80211_rx_bss_info(dev, mgmt, len, rx_status, 1); 2922 /* Process beacon from the current BSS */
2923 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt;
2924 if (baselen > len)
2925 return;
2926
2927 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems);
2928
2929 ieee80211_rx_bss_info(dev, mgmt, len, rx_status, &elems, 1);
2983 2930
2984 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 2931 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2985 if (sdata->vif.type != IEEE80211_IF_TYPE_STA) 2932 if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
@@ -2990,13 +2937,6 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
2990 memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) 2937 memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)
2991 return; 2938 return;
2992 2939
2993 /* Process beacon from the current BSS */
2994 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt;
2995 if (baselen > len)
2996 return;
2997
2998 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems);
2999
3000 ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, 2940 ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param,
3001 elems.wmm_param_len); 2941 elems.wmm_param_len);
3002 2942
@@ -3075,11 +3015,11 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev,
3075 pos = mgmt->u.probe_req.variable; 3015 pos = mgmt->u.probe_req.variable;
3076 if (pos[0] != WLAN_EID_SSID || 3016 if (pos[0] != WLAN_EID_SSID ||
3077 pos + 2 + pos[1] > end) { 3017 pos + 2 + pos[1] > end) {
3078 if (net_ratelimit()) { 3018#ifdef CONFIG_MAC80211_IBSS_DEBUG
3079 printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " 3019 printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq "
3080 "from %s\n", 3020 "from %s\n",
3081 dev->name, print_mac(mac, mgmt->sa)); 3021 dev->name, print_mac(mac, mgmt->sa));
3082 } 3022#endif
3083 return; 3023 return;
3084 } 3024 }
3085 if (pos[1] != 0 && 3025 if (pos[1] != 0 &&
@@ -3148,11 +3088,6 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev,
3148 break; 3088 break;
3149 ieee80211_sta_process_delba(dev, mgmt, len); 3089 ieee80211_sta_process_delba(dev, mgmt, len);
3150 break; 3090 break;
3151 default:
3152 if (net_ratelimit())
3153 printk(KERN_DEBUG "%s: Rx unknown A-MPDU action\n",
3154 dev->name);
3155 break;
3156 } 3091 }
3157 break; 3092 break;
3158 case PLINK_CATEGORY: 3093 case PLINK_CATEGORY:
@@ -3163,11 +3098,6 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev,
3163 if (ieee80211_vif_is_mesh(&sdata->vif)) 3098 if (ieee80211_vif_is_mesh(&sdata->vif))
3164 mesh_rx_path_sel_frame(dev, mgmt, len); 3099 mesh_rx_path_sel_frame(dev, mgmt, len);
3165 break; 3100 break;
3166 default:
3167 if (net_ratelimit())
3168 printk(KERN_DEBUG "%s: Rx unknown action frame - "
3169 "category=%d\n", dev->name, mgmt->u.action.category);
3170 break;
3171 } 3101 }
3172} 3102}
3173 3103
@@ -3203,11 +3133,6 @@ void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
3203 skb_queue_tail(&ifsta->skb_queue, skb); 3133 skb_queue_tail(&ifsta->skb_queue, skb);
3204 queue_work(local->hw.workqueue, &ifsta->work); 3134 queue_work(local->hw.workqueue, &ifsta->work);
3205 return; 3135 return;
3206 default:
3207 printk(KERN_DEBUG "%s: received unknown management frame - "
3208 "stype=%d\n", dev->name,
3209 (fc & IEEE80211_FCTL_STYPE) >> 4);
3210 break;
3211 } 3136 }
3212 3137
3213 fail: 3138 fail:
@@ -3336,8 +3261,10 @@ static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time)
3336 spin_lock_irqsave(&local->sta_lock, flags); 3261 spin_lock_irqsave(&local->sta_lock, flags);
3337 list_for_each_entry_safe(sta, tmp, &local->sta_list, list) 3262 list_for_each_entry_safe(sta, tmp, &local->sta_list, list)
3338 if (time_after(jiffies, sta->last_rx + exp_time)) { 3263 if (time_after(jiffies, sta->last_rx + exp_time)) {
3264#ifdef CONFIG_MAC80211_IBSS_DEBUG
3339 printk(KERN_DEBUG "%s: expiring inactive STA %s\n", 3265 printk(KERN_DEBUG "%s: expiring inactive STA %s\n",
3340 dev->name, print_mac(mac, sta->addr)); 3266 dev->name, print_mac(mac, sta->addr));
3267#endif
3341 __sta_info_unlink(&sta); 3268 __sta_info_unlink(&sta);
3342 if (sta) 3269 if (sta)
3343 list_add(&sta->list, &tmp_list); 3270 list_add(&sta->list, &tmp_list);
@@ -3420,13 +3347,10 @@ void ieee80211_sta_work(struct work_struct *work)
3420 if (local->sta_sw_scanning || local->sta_hw_scanning) 3347 if (local->sta_sw_scanning || local->sta_hw_scanning)
3421 return; 3348 return;
3422 3349
3423 if (sdata->vif.type != IEEE80211_IF_TYPE_STA && 3350 if (WARN_ON(sdata->vif.type != IEEE80211_IF_TYPE_STA &&
3424 sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 3351 sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
3425 sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) { 3352 sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT))
3426 printk(KERN_DEBUG "%s: ieee80211_sta_work: non-STA interface "
3427 "(type=%d)\n", dev->name, sdata->vif.type);
3428 return; 3353 return;
3429 }
3430 ifsta = &sdata->u.sta; 3354 ifsta = &sdata->u.sta;
3431 3355
3432 while ((skb = skb_dequeue(&ifsta->skb_queue))) 3356 while ((skb = skb_dequeue(&ifsta->skb_queue)))
@@ -3480,8 +3404,7 @@ void ieee80211_sta_work(struct work_struct *work)
3480 break; 3404 break;
3481#endif 3405#endif
3482 default: 3406 default:
3483 printk(KERN_DEBUG "ieee80211_sta_work: Unknown state %d\n", 3407 WARN_ON(1);
3484 ifsta->state);
3485 break; 3408 break;
3486 } 3409 }
3487 3410
@@ -3516,8 +3439,6 @@ static void ieee80211_sta_reset_auth(struct net_device *dev,
3516 ifsta->auth_alg = WLAN_AUTH_LEAP; 3439 ifsta->auth_alg = WLAN_AUTH_LEAP;
3517 else 3440 else
3518 ifsta->auth_alg = WLAN_AUTH_OPEN; 3441 ifsta->auth_alg = WLAN_AUTH_OPEN;
3519 printk(KERN_DEBUG "%s: Initial auth_alg=%d\n", dev->name,
3520 ifsta->auth_alg);
3521 ifsta->auth_transaction = -1; 3442 ifsta->auth_transaction = -1;
3522 ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; 3443 ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
3523 ifsta->auth_tries = ifsta->assoc_tries = 0; 3444 ifsta->auth_tries = ifsta->assoc_tries = 0;
@@ -4316,6 +4237,13 @@ ieee80211_sta_scan_result(struct net_device *dev,
4316 current_ev = iwe_stream_add_point(info, current_ev, 4237 current_ev = iwe_stream_add_point(info, current_ev,
4317 end_buf, 4238 end_buf,
4318 &iwe, buf); 4239 &iwe, buf);
4240 memset(&iwe, 0, sizeof(iwe));
4241 iwe.cmd = IWEVCUSTOM;
4242 sprintf(buf, " Last beacon: %dms ago",
4243 jiffies_to_msecs(jiffies - bss->last_update));
4244 iwe.u.data.length = strlen(buf);
4245 current_ev = iwe_stream_add_point(info, current_ev,
4246 end_buf, &iwe, buf);
4319 kfree(buf); 4247 kfree(buf);
4320 } 4248 }
4321 } 4249 }
@@ -4436,8 +4364,10 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
4436 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) 4364 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid))
4437 return NULL; 4365 return NULL;
4438 4366
4367#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
4439 printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", 4368 printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n",
4440 wiphy_name(local->hw.wiphy), print_mac(mac, addr), dev->name); 4369 wiphy_name(local->hw.wiphy), print_mac(mac, addr), dev->name);
4370#endif
4441 4371
4442 sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); 4372 sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
4443 if (!sta) 4373 if (!sta)
@@ -4464,7 +4394,7 @@ int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason)
4464 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 4394 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
4465 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 4395 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
4466 4396
4467 printk(KERN_DEBUG "%s: deauthenticate(reason=%d)\n", 4397 printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n",
4468 dev->name, reason); 4398 dev->name, reason);
4469 4399
4470 if (sdata->vif.type != IEEE80211_IF_TYPE_STA && 4400 if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
@@ -4482,7 +4412,7 @@ int ieee80211_sta_disassociate(struct net_device *dev, u16 reason)
4482 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 4412 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
4483 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 4413 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
4484 4414
4485 printk(KERN_DEBUG "%s: disassociate(reason=%d)\n", 4415 printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n",
4486 dev->name, reason); 4416 dev->name, reason);
4487 4417
4488 if (sdata->vif.type != IEEE80211_IF_TYPE_STA) 4418 if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index 0ed9c8a2f56f..ede7ab56f65b 100644
--- a/net/mac80211/rate.h
+++ b/net/mac80211/rate.h
@@ -162,9 +162,7 @@ void rate_control_deinitialize(struct ieee80211_local *local);
162 162
163 163
164/* Rate control algorithms */ 164/* Rate control algorithms */
165#if defined(RC80211_PID_COMPILE) || \ 165#ifdef CONFIG_MAC80211_RC_PID
166 (defined(CONFIG_MAC80211_RC_PID) && \
167 !defined(CONFIG_MAC80211_RC_PID_MODULE))
168extern int rc80211_pid_init(void); 166extern int rc80211_pid_init(void);
169extern void rc80211_pid_exit(void); 167extern void rc80211_pid_exit(void);
170#else 168#else
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index e8945413e4a2..62388f8e9024 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -540,11 +540,6 @@ static struct rate_control_ops mac80211_rcpid = {
540#endif 540#endif
541}; 541};
542 542
543MODULE_DESCRIPTION("PID controller based rate control algorithm");
544MODULE_AUTHOR("Stefano Brivio");
545MODULE_AUTHOR("Mattias Nissler");
546MODULE_LICENSE("GPL");
547
548int __init rc80211_pid_init(void) 543int __init rc80211_pid_init(void)
549{ 544{
550 return ieee80211_rate_control_register(&mac80211_rcpid); 545 return ieee80211_rate_control_register(&mac80211_rcpid);
@@ -554,8 +549,3 @@ void rc80211_pid_exit(void)
554{ 549{
555 ieee80211_rate_control_unregister(&mac80211_rcpid); 550 ieee80211_rate_control_unregister(&mac80211_rcpid);
556} 551}
557
558#ifdef CONFIG_MAC80211_RC_PID_MODULE
559module_init(rc80211_pid_init);
560module_exit(rc80211_pid_exit);
561#endif
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 8962d1355f04..6a88e8f9bff0 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -386,7 +386,7 @@ static void ieee80211_verify_ip_alignment(struct ieee80211_rx_data *rx)
386 386
387/* rx handlers */ 387/* rx handlers */
388 388
389static ieee80211_rx_result 389static ieee80211_rx_result debug_noinline
390ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx) 390ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
391{ 391{
392 struct ieee80211_local *local = rx->local; 392 struct ieee80211_local *local = rx->local;
@@ -463,7 +463,7 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
463} 463}
464 464
465 465
466static ieee80211_rx_result 466static ieee80211_rx_result debug_noinline
467ieee80211_rx_h_check(struct ieee80211_rx_data *rx) 467ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
468{ 468{
469 struct ieee80211_hdr *hdr; 469 struct ieee80211_hdr *hdr;
@@ -522,7 +522,7 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
522} 522}
523 523
524 524
525static ieee80211_rx_result 525static ieee80211_rx_result debug_noinline
526ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) 526ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
527{ 527{
528 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; 528 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
@@ -613,11 +613,6 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
613 rx->key->tx_rx_count++; 613 rx->key->tx_rx_count++;
614 /* TODO: add threshold stuff again */ 614 /* TODO: add threshold stuff again */
615 } else { 615 } else {
616#ifdef CONFIG_MAC80211_DEBUG
617 if (net_ratelimit())
618 printk(KERN_DEBUG "%s: RX protected frame,"
619 " but have no key\n", rx->dev->name);
620#endif /* CONFIG_MAC80211_DEBUG */
621 return RX_DROP_MONITOR; 616 return RX_DROP_MONITOR;
622 } 617 }
623 618
@@ -710,7 +705,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
710 return sent; 705 return sent;
711} 706}
712 707
713static ieee80211_rx_result 708static ieee80211_rx_result debug_noinline
714ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) 709ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
715{ 710{
716 struct sta_info *sta = rx->sta; 711 struct sta_info *sta = rx->sta;
@@ -789,7 +784,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
789 sdata->fragment_next = 0; 784 sdata->fragment_next = 0;
790 785
791 if (!skb_queue_empty(&entry->skb_list)) { 786 if (!skb_queue_empty(&entry->skb_list)) {
792#ifdef CONFIG_MAC80211_DEBUG 787#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
793 struct ieee80211_hdr *hdr = 788 struct ieee80211_hdr *hdr =
794 (struct ieee80211_hdr *) entry->skb_list.next->data; 789 (struct ieee80211_hdr *) entry->skb_list.next->data;
795 DECLARE_MAC_BUF(mac); 790 DECLARE_MAC_BUF(mac);
@@ -801,7 +796,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
801 jiffies - entry->first_frag_time, entry->seq, 796 jiffies - entry->first_frag_time, entry->seq,
802 entry->last_frag, print_mac(mac, hdr->addr1), 797 entry->last_frag, print_mac(mac, hdr->addr1),
803 print_mac(mac2, hdr->addr2)); 798 print_mac(mac2, hdr->addr2));
804#endif /* CONFIG_MAC80211_DEBUG */ 799#endif
805 __skb_queue_purge(&entry->skb_list); 800 __skb_queue_purge(&entry->skb_list);
806 } 801 }
807 802
@@ -858,7 +853,7 @@ ieee80211_reassemble_find(struct ieee80211_sub_if_data *sdata,
858 return NULL; 853 return NULL;
859} 854}
860 855
861static ieee80211_rx_result 856static ieee80211_rx_result debug_noinline
862ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) 857ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
863{ 858{
864 struct ieee80211_hdr *hdr; 859 struct ieee80211_hdr *hdr;
@@ -922,18 +917,8 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
922 break; 917 break;
923 } 918 }
924 rpn = rx->key->u.ccmp.rx_pn[rx->queue]; 919 rpn = rx->key->u.ccmp.rx_pn[rx->queue];
925 if (memcmp(pn, rpn, CCMP_PN_LEN) != 0) { 920 if (memcmp(pn, rpn, CCMP_PN_LEN))
926 if (net_ratelimit())
927 printk(KERN_DEBUG "%s: defrag: CCMP PN not "
928 "sequential A2=%s"
929 " PN=%02x%02x%02x%02x%02x%02x "
930 "(expected %02x%02x%02x%02x%02x%02x)\n",
931 rx->dev->name, print_mac(mac, hdr->addr2),
932 rpn[0], rpn[1], rpn[2], rpn[3], rpn[4],
933 rpn[5], pn[0], pn[1], pn[2], pn[3],
934 pn[4], pn[5]);
935 return RX_DROP_UNUSABLE; 921 return RX_DROP_UNUSABLE;
936 }
937 memcpy(entry->last_pn, pn, CCMP_PN_LEN); 922 memcpy(entry->last_pn, pn, CCMP_PN_LEN);
938 } 923 }
939 924
@@ -974,7 +959,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
974 return RX_CONTINUE; 959 return RX_CONTINUE;
975} 960}
976 961
977static ieee80211_rx_result 962static ieee80211_rx_result debug_noinline
978ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) 963ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
979{ 964{
980 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); 965 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
@@ -1037,7 +1022,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
1037 * have nothing buffered for it? 1022 * have nothing buffered for it?
1038 */ 1023 */
1039 printk(KERN_DEBUG "%s: STA %s sent PS Poll even " 1024 printk(KERN_DEBUG "%s: STA %s sent PS Poll even "
1040 "though there is no buffered frames for it\n", 1025 "though there are no buffered frames for it\n",
1041 rx->dev->name, print_mac(mac, rx->sta->addr)); 1026 rx->dev->name, print_mac(mac, rx->sta->addr));
1042#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 1027#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
1043 } 1028 }
@@ -1049,7 +1034,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
1049 return RX_QUEUED; 1034 return RX_QUEUED;
1050} 1035}
1051 1036
1052static ieee80211_rx_result 1037static ieee80211_rx_result debug_noinline
1053ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx) 1038ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx)
1054{ 1039{
1055 u16 fc = rx->fc; 1040 u16 fc = rx->fc;
@@ -1073,14 +1058,8 @@ static int
1073ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) 1058ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx)
1074{ 1059{
1075 if (unlikely(!rx->sta || 1060 if (unlikely(!rx->sta ||
1076 !test_sta_flags(rx->sta, WLAN_STA_AUTHORIZED))) { 1061 !test_sta_flags(rx->sta, WLAN_STA_AUTHORIZED)))
1077#ifdef CONFIG_MAC80211_DEBUG
1078 if (net_ratelimit())
1079 printk(KERN_DEBUG "%s: dropped frame "
1080 "(unauthorized port)\n", rx->dev->name);
1081#endif /* CONFIG_MAC80211_DEBUG */
1082 return -EACCES; 1062 return -EACCES;
1083 }
1084 1063
1085 return 0; 1064 return 0;
1086} 1065}
@@ -1160,16 +1139,8 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1160 memcpy(src, hdr->addr2, ETH_ALEN); 1139 memcpy(src, hdr->addr2, ETH_ALEN);
1161 1140
1162 if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_AP && 1141 if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_AP &&
1163 sdata->vif.type != IEEE80211_IF_TYPE_VLAN)) { 1142 sdata->vif.type != IEEE80211_IF_TYPE_VLAN))
1164 if (net_ratelimit())
1165 printk(KERN_DEBUG "%s: dropped ToDS frame "
1166 "(BSSID=%s SA=%s DA=%s)\n",
1167 dev->name,
1168 print_mac(mac, hdr->addr1),
1169 print_mac(mac2, hdr->addr2),
1170 print_mac(mac3, hdr->addr3));
1171 return -1; 1143 return -1;
1172 }
1173 break; 1144 break;
1174 case (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): 1145 case (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
1175 /* RA TA DA SA */ 1146 /* RA TA DA SA */
@@ -1177,17 +1148,8 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1177 memcpy(src, hdr->addr4, ETH_ALEN); 1148 memcpy(src, hdr->addr4, ETH_ALEN);
1178 1149
1179 if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS && 1150 if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS &&
1180 sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)) { 1151 sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT))
1181 if (net_ratelimit())
1182 printk(KERN_DEBUG "%s: dropped FromDS&ToDS "
1183 "frame (RA=%s TA=%s DA=%s SA=%s)\n",
1184 rx->dev->name,
1185 print_mac(mac, hdr->addr1),
1186 print_mac(mac2, hdr->addr2),
1187 print_mac(mac3, hdr->addr3),
1188 print_mac(mac4, hdr->addr4));
1189 return -1; 1152 return -1;
1190 }
1191 break; 1153 break;
1192 case IEEE80211_FCTL_FROMDS: 1154 case IEEE80211_FCTL_FROMDS:
1193 /* DA BSSID SA */ 1155 /* DA BSSID SA */
@@ -1204,27 +1166,13 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1204 memcpy(dst, hdr->addr1, ETH_ALEN); 1166 memcpy(dst, hdr->addr1, ETH_ALEN);
1205 memcpy(src, hdr->addr2, ETH_ALEN); 1167 memcpy(src, hdr->addr2, ETH_ALEN);
1206 1168
1207 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS) { 1169 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
1208 if (net_ratelimit()) {
1209 printk(KERN_DEBUG "%s: dropped IBSS frame "
1210 "(DA=%s SA=%s BSSID=%s)\n",
1211 dev->name,
1212 print_mac(mac, hdr->addr1),
1213 print_mac(mac2, hdr->addr2),
1214 print_mac(mac3, hdr->addr3));
1215 }
1216 return -1; 1170 return -1;
1217 }
1218 break; 1171 break;
1219 } 1172 }
1220 1173
1221 if (unlikely(skb->len - hdrlen < 8)) { 1174 if (unlikely(skb->len - hdrlen < 8))
1222 if (net_ratelimit()) {
1223 printk(KERN_DEBUG "%s: RX too short data frame "
1224 "payload\n", dev->name);
1225 }
1226 return -1; 1175 return -1;
1227 }
1228 1176
1229 payload = skb->data + hdrlen; 1177 payload = skb->data + hdrlen;
1230 ethertype = (payload[6] << 8) | payload[7]; 1178 ethertype = (payload[6] << 8) | payload[7];
@@ -1367,7 +1315,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
1367 } 1315 }
1368} 1316}
1369 1317
1370static ieee80211_rx_result 1318static ieee80211_rx_result debug_noinline
1371ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) 1319ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1372{ 1320{
1373 struct net_device *dev = rx->dev; 1321 struct net_device *dev = rx->dev;
@@ -1416,10 +1364,8 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1416 1364
1417 padding = ((4 - subframe_len) & 0x3); 1365 padding = ((4 - subframe_len) & 0x3);
1418 /* the last MSDU has no padding */ 1366 /* the last MSDU has no padding */
1419 if (subframe_len > remaining) { 1367 if (subframe_len > remaining)
1420 printk(KERN_DEBUG "%s: wrong buffer size\n", dev->name);
1421 return RX_DROP_UNUSABLE; 1368 return RX_DROP_UNUSABLE;
1422 }
1423 1369
1424 skb_pull(skb, sizeof(struct ethhdr)); 1370 skb_pull(skb, sizeof(struct ethhdr));
1425 /* if last subframe reuse skb */ 1371 /* if last subframe reuse skb */
@@ -1440,8 +1386,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1440 eth = (struct ethhdr *) skb_pull(skb, ntohs(len) + 1386 eth = (struct ethhdr *) skb_pull(skb, ntohs(len) +
1441 padding); 1387 padding);
1442 if (!eth) { 1388 if (!eth) {
1443 printk(KERN_DEBUG "%s: wrong buffer size\n",
1444 dev->name);
1445 dev_kfree_skb(frame); 1389 dev_kfree_skb(frame);
1446 return RX_DROP_UNUSABLE; 1390 return RX_DROP_UNUSABLE;
1447 } 1391 }
@@ -1484,7 +1428,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1484 return RX_QUEUED; 1428 return RX_QUEUED;
1485} 1429}
1486 1430
1487static ieee80211_rx_result 1431static ieee80211_rx_result debug_noinline
1488ieee80211_rx_h_data(struct ieee80211_rx_data *rx) 1432ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
1489{ 1433{
1490 struct net_device *dev = rx->dev; 1434 struct net_device *dev = rx->dev;
@@ -1515,7 +1459,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
1515 return RX_QUEUED; 1459 return RX_QUEUED;
1516} 1460}
1517 1461
1518static ieee80211_rx_result 1462static ieee80211_rx_result debug_noinline
1519ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx) 1463ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx)
1520{ 1464{
1521 struct ieee80211_local *local = rx->local; 1465 struct ieee80211_local *local = rx->local;
@@ -1559,7 +1503,7 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx)
1559 return RX_CONTINUE; 1503 return RX_CONTINUE;
1560} 1504}
1561 1505
1562static ieee80211_rx_result 1506static ieee80211_rx_result debug_noinline
1563ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) 1507ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
1564{ 1508{
1565 struct ieee80211_sub_if_data *sdata; 1509 struct ieee80211_sub_if_data *sdata;
@@ -1593,31 +1537,16 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1593 else 1537 else
1594 keyidx = -1; 1538 keyidx = -1;
1595 1539
1596 if (net_ratelimit())
1597 printk(KERN_DEBUG "%s: TKIP hwaccel reported Michael MIC "
1598 "failure from %s to %s keyidx=%d\n",
1599 dev->name, print_mac(mac, hdr->addr2),
1600 print_mac(mac2, hdr->addr1), keyidx);
1601
1602 if (!rx->sta) { 1540 if (!rx->sta) {
1603 /* 1541 /*
1604 * Some hardware seem to generate incorrect Michael MIC 1542 * Some hardware seem to generate incorrect Michael MIC
1605 * reports; ignore them to avoid triggering countermeasures. 1543 * reports; ignore them to avoid triggering countermeasures.
1606 */ 1544 */
1607 if (net_ratelimit())
1608 printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
1609 "error for unknown address %s\n",
1610 dev->name, print_mac(mac, hdr->addr2));
1611 goto ignore; 1545 goto ignore;
1612 } 1546 }
1613 1547
1614 if (!(rx->fc & IEEE80211_FCTL_PROTECTED)) { 1548 if (!(rx->fc & IEEE80211_FCTL_PROTECTED))
1615 if (net_ratelimit())
1616 printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
1617 "error for a frame with no PROTECTED flag (src "
1618 "%s)\n", dev->name, print_mac(mac, hdr->addr2));
1619 goto ignore; 1549 goto ignore;
1620 }
1621 1550
1622 if (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP && keyidx) { 1551 if (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP && keyidx) {
1623 /* 1552 /*
@@ -1626,24 +1555,13 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1626 * group keys and only the AP is sending real multicast 1555 * group keys and only the AP is sending real multicast
1627 * frames in the BSS. 1556 * frames in the BSS.
1628 */ 1557 */
1629 if (net_ratelimit())
1630 printk(KERN_DEBUG "%s: ignored Michael MIC error for "
1631 "a frame with non-zero keyidx (%d)"
1632 " (src %s)\n", dev->name, keyidx,
1633 print_mac(mac, hdr->addr2));
1634 goto ignore; 1558 goto ignore;
1635 } 1559 }
1636 1560
1637 if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && 1561 if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA &&
1638 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || 1562 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT ||
1639 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH)) { 1563 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH))
1640 if (net_ratelimit())
1641 printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
1642 "error for a frame that cannot be encrypted "
1643 "(fc=0x%04x) (src %s)\n",
1644 dev->name, rx->fc, print_mac(mac, hdr->addr2));
1645 goto ignore; 1564 goto ignore;
1646 }
1647 1565
1648 mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr); 1566 mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr);
1649 ignore: 1567 ignore:
@@ -1732,66 +1650,57 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx)
1732 dev_kfree_skb(skb); 1650 dev_kfree_skb(skb);
1733} 1651}
1734 1652
1735typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_rx_data *);
1736static ieee80211_rx_handler ieee80211_rx_handlers[] =
1737{
1738 ieee80211_rx_h_passive_scan,
1739 ieee80211_rx_h_check,
1740 ieee80211_rx_h_decrypt,
1741 ieee80211_rx_h_sta_process,
1742 ieee80211_rx_h_defragment,
1743 ieee80211_rx_h_ps_poll,
1744 ieee80211_rx_h_michael_mic_verify,
1745 /* this must be after decryption - so header is counted in MPDU mic
1746 * must be before pae and data, so QOS_DATA format frames
1747 * are not passed to user space by these functions
1748 */
1749 ieee80211_rx_h_remove_qos_control,
1750 ieee80211_rx_h_amsdu,
1751 ieee80211_rx_h_data,
1752 ieee80211_rx_h_ctrl,
1753 ieee80211_rx_h_mgmt,
1754 NULL
1755};
1756 1653
1757static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata, 1654static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata,
1758 struct ieee80211_rx_data *rx, 1655 struct ieee80211_rx_data *rx,
1759 struct sk_buff *skb) 1656 struct sk_buff *skb)
1760{ 1657{
1761 ieee80211_rx_handler *handler;
1762 ieee80211_rx_result res = RX_DROP_MONITOR; 1658 ieee80211_rx_result res = RX_DROP_MONITOR;
1763 1659
1764 rx->skb = skb; 1660 rx->skb = skb;
1765 rx->sdata = sdata; 1661 rx->sdata = sdata;
1766 rx->dev = sdata->dev; 1662 rx->dev = sdata->dev;
1767 1663
1768 for (handler = ieee80211_rx_handlers; *handler != NULL; handler++) { 1664#define CALL_RXH(rxh) \
1769 res = (*handler)(rx); 1665 res = rxh(rx); \
1770 1666 if (res != RX_CONTINUE) \
1771 switch (res) { 1667 goto rxh_done;
1772 case RX_CONTINUE: 1668
1773 continue; 1669 CALL_RXH(ieee80211_rx_h_passive_scan)
1774 case RX_DROP_UNUSABLE: 1670 CALL_RXH(ieee80211_rx_h_check)
1775 case RX_DROP_MONITOR: 1671 CALL_RXH(ieee80211_rx_h_decrypt)
1776 I802_DEBUG_INC(sdata->local->rx_handlers_drop); 1672 CALL_RXH(ieee80211_rx_h_sta_process)
1777 if (rx->sta) 1673 CALL_RXH(ieee80211_rx_h_defragment)
1778 rx->sta->rx_dropped++; 1674 CALL_RXH(ieee80211_rx_h_ps_poll)
1779 break; 1675 CALL_RXH(ieee80211_rx_h_michael_mic_verify)
1780 case RX_QUEUED: 1676 /* must be after MMIC verify so header is counted in MPDU mic */
1781 I802_DEBUG_INC(sdata->local->rx_handlers_queued); 1677 CALL_RXH(ieee80211_rx_h_remove_qos_control)
1782 break; 1678 CALL_RXH(ieee80211_rx_h_amsdu)
1783 } 1679 CALL_RXH(ieee80211_rx_h_data)
1784 break; 1680 CALL_RXH(ieee80211_rx_h_ctrl)
1785 } 1681 CALL_RXH(ieee80211_rx_h_mgmt)
1786 1682
1683#undef CALL_RXH
1684
1685 rxh_done:
1787 switch (res) { 1686 switch (res) {
1788 case RX_CONTINUE:
1789 case RX_DROP_MONITOR: 1687 case RX_DROP_MONITOR:
1688 I802_DEBUG_INC(sdata->local->rx_handlers_drop);
1689 if (rx->sta)
1690 rx->sta->rx_dropped++;
1691 /* fall through */
1692 case RX_CONTINUE:
1790 ieee80211_rx_cooked_monitor(rx); 1693 ieee80211_rx_cooked_monitor(rx);
1791 break; 1694 break;
1792 case RX_DROP_UNUSABLE: 1695 case RX_DROP_UNUSABLE:
1696 I802_DEBUG_INC(sdata->local->rx_handlers_drop);
1697 if (rx->sta)
1698 rx->sta->rx_dropped++;
1793 dev_kfree_skb(rx->skb); 1699 dev_kfree_skb(rx->skb);
1794 break; 1700 break;
1701 case RX_QUEUED:
1702 I802_DEBUG_INC(sdata->local->rx_handlers_queued);
1703 break;
1795 } 1704 }
1796} 1705}
1797 1706
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index b3c733162fc1..d8a16b7f6a6b 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -554,8 +554,10 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
554 554
555 sdata = sta->sdata; 555 sdata = sta->sdata;
556 local->total_ps_buffered--; 556 local->total_ps_buffered--;
557#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
557 printk(KERN_DEBUG "Buffered frame expired (STA " 558 printk(KERN_DEBUG "Buffered frame expired (STA "
558 "%s)\n", print_mac(mac, sta->addr)); 559 "%s)\n", print_mac(mac, sta->addr));
560#endif
559 dev_kfree_skb(skb); 561 dev_kfree_skb(skb);
560 562
561 if (skb_queue_empty(&sta->ps_tx_buf)) 563 if (skb_queue_empty(&sta->ps_tx_buf))
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 52ab85c4341b..9bd9faac3c3c 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -220,7 +220,7 @@ static int inline is_ieee80211_device(struct net_device *dev,
220 220
221/* tx handlers */ 221/* tx handlers */
222 222
223static ieee80211_tx_result 223static ieee80211_tx_result debug_noinline
224ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) 224ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
225{ 225{
226#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 226#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
@@ -274,7 +274,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
274 return TX_CONTINUE; 274 return TX_CONTINUE;
275} 275}
276 276
277static ieee80211_tx_result 277static ieee80211_tx_result debug_noinline
278ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) 278ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
279{ 279{
280 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 280 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
@@ -327,8 +327,10 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
327 rcu_read_unlock(); 327 rcu_read_unlock();
328 328
329 local->total_ps_buffered = total; 329 local->total_ps_buffered = total;
330#ifdef MAC80211_VERBOSE_PS_DEBUG
330 printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n", 331 printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n",
331 wiphy_name(local->hw.wiphy), purged); 332 wiphy_name(local->hw.wiphy), purged);
333#endif
332} 334}
333 335
334static ieee80211_tx_result 336static ieee80211_tx_result
@@ -358,11 +360,13 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
358 purge_old_ps_buffers(tx->local); 360 purge_old_ps_buffers(tx->local);
359 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= 361 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >=
360 AP_MAX_BC_BUFFER) { 362 AP_MAX_BC_BUFFER) {
363#ifdef MAC80211_VERBOSE_PS_DEBUG
361 if (net_ratelimit()) { 364 if (net_ratelimit()) {
362 printk(KERN_DEBUG "%s: BC TX buffer full - " 365 printk(KERN_DEBUG "%s: BC TX buffer full - "
363 "dropping the oldest frame\n", 366 "dropping the oldest frame\n",
364 tx->dev->name); 367 tx->dev->name);
365 } 368 }
369#endif
366 dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); 370 dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf));
367 } else 371 } else
368 tx->local->total_ps_buffered++; 372 tx->local->total_ps_buffered++;
@@ -403,11 +407,13 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
403 purge_old_ps_buffers(tx->local); 407 purge_old_ps_buffers(tx->local);
404 if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) { 408 if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) {
405 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf); 409 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf);
410#ifdef MAC80211_VERBOSE_PS_DEBUG
406 if (net_ratelimit()) { 411 if (net_ratelimit()) {
407 printk(KERN_DEBUG "%s: STA %s TX " 412 printk(KERN_DEBUG "%s: STA %s TX "
408 "buffer full - dropping oldest frame\n", 413 "buffer full - dropping oldest frame\n",
409 tx->dev->name, print_mac(mac, sta->addr)); 414 tx->dev->name, print_mac(mac, sta->addr));
410 } 415 }
416#endif
411 dev_kfree_skb(old); 417 dev_kfree_skb(old);
412 } else 418 } else
413 tx->local->total_ps_buffered++; 419 tx->local->total_ps_buffered++;
@@ -432,7 +438,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
432 return TX_CONTINUE; 438 return TX_CONTINUE;
433} 439}
434 440
435static ieee80211_tx_result 441static ieee80211_tx_result debug_noinline
436ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx) 442ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx)
437{ 443{
438 if (unlikely(tx->flags & IEEE80211_TX_PS_BUFFERED)) 444 if (unlikely(tx->flags & IEEE80211_TX_PS_BUFFERED))
@@ -444,7 +450,7 @@ ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx)
444 return ieee80211_tx_h_multicast_ps_buf(tx); 450 return ieee80211_tx_h_multicast_ps_buf(tx);
445} 451}
446 452
447static ieee80211_tx_result 453static ieee80211_tx_result debug_noinline
448ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) 454ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
449{ 455{
450 struct ieee80211_key *key; 456 struct ieee80211_key *key;
@@ -493,7 +499,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
493 return TX_CONTINUE; 499 return TX_CONTINUE;
494} 500}
495 501
496static ieee80211_tx_result 502static ieee80211_tx_result debug_noinline
497ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) 503ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
498{ 504{
499 struct rate_selection rsel; 505 struct rate_selection rsel;
@@ -537,7 +543,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
537 return TX_CONTINUE; 543 return TX_CONTINUE;
538} 544}
539 545
540static ieee80211_tx_result 546static ieee80211_tx_result debug_noinline
541ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) 547ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
542{ 548{
543 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 549 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
@@ -632,7 +638,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
632 return TX_CONTINUE; 638 return TX_CONTINUE;
633} 639}
634 640
635static ieee80211_tx_result 641static ieee80211_tx_result debug_noinline
636ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) 642ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
637{ 643{
638 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 644 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
@@ -713,7 +719,6 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
713 return TX_CONTINUE; 719 return TX_CONTINUE;
714 720
715 fail: 721 fail:
716 printk(KERN_DEBUG "%s: failed to fragment frame\n", tx->dev->name);
717 if (frags) { 722 if (frags) {
718 for (i = 0; i < num_fragm - 1; i++) 723 for (i = 0; i < num_fragm - 1; i++)
719 if (frags[i]) 724 if (frags[i])
@@ -724,7 +729,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
724 return TX_DROP; 729 return TX_DROP;
725} 730}
726 731
727static ieee80211_tx_result 732static ieee80211_tx_result debug_noinline
728ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx) 733ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
729{ 734{
730 if (!tx->key) 735 if (!tx->key)
@@ -744,7 +749,7 @@ ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
744 return TX_DROP; 749 return TX_DROP;
745} 750}
746 751
747static ieee80211_tx_result 752static ieee80211_tx_result debug_noinline
748ieee80211_tx_h_calculate_duration(struct ieee80211_tx_data *tx) 753ieee80211_tx_h_calculate_duration(struct ieee80211_tx_data *tx)
749{ 754{
750 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 755 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
@@ -774,7 +779,7 @@ ieee80211_tx_h_calculate_duration(struct ieee80211_tx_data *tx)
774 return TX_CONTINUE; 779 return TX_CONTINUE;
775} 780}
776 781
777static ieee80211_tx_result 782static ieee80211_tx_result debug_noinline
778ieee80211_tx_h_stats(struct ieee80211_tx_data *tx) 783ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
779{ 784{
780 int i; 785 int i;
@@ -795,24 +800,6 @@ ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
795} 800}
796 801
797 802
798typedef ieee80211_tx_result (*ieee80211_tx_handler)(struct ieee80211_tx_data *);
799static ieee80211_tx_handler ieee80211_tx_handlers[] =
800{
801 ieee80211_tx_h_check_assoc,
802 ieee80211_tx_h_sequence,
803 ieee80211_tx_h_ps_buf,
804 ieee80211_tx_h_select_key,
805 ieee80211_tx_h_michael_mic_add,
806 ieee80211_tx_h_rate_ctrl,
807 ieee80211_tx_h_misc,
808 ieee80211_tx_h_fragment,
809 /* handlers after fragment must be aware of tx info fragmentation! */
810 ieee80211_tx_h_encrypt,
811 ieee80211_tx_h_calculate_duration,
812 ieee80211_tx_h_stats,
813 NULL
814};
815
816/* actual transmit path */ 803/* actual transmit path */
817 804
818/* 805/*
@@ -1110,20 +1097,32 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1110 */ 1097 */
1111static int invoke_tx_handlers(struct ieee80211_tx_data *tx) 1098static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
1112{ 1099{
1113 struct ieee80211_local *local = tx->local;
1114 struct sk_buff *skb = tx->skb; 1100 struct sk_buff *skb = tx->skb;
1115 ieee80211_tx_handler *handler;
1116 ieee80211_tx_result res = TX_DROP; 1101 ieee80211_tx_result res = TX_DROP;
1117 int i; 1102 int i;
1118 1103
1119 for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) { 1104#define CALL_TXH(txh) \
1120 res = (*handler)(tx); 1105 res = txh(tx); \
1121 if (res != TX_CONTINUE) 1106 if (res != TX_CONTINUE) \
1122 break; 1107 goto txh_done;
1123 } 1108
1109 CALL_TXH(ieee80211_tx_h_check_assoc)
1110 CALL_TXH(ieee80211_tx_h_sequence)
1111 CALL_TXH(ieee80211_tx_h_ps_buf)
1112 CALL_TXH(ieee80211_tx_h_select_key)
1113 CALL_TXH(ieee80211_tx_h_michael_mic_add)
1114 CALL_TXH(ieee80211_tx_h_rate_ctrl)
1115 CALL_TXH(ieee80211_tx_h_misc)
1116 CALL_TXH(ieee80211_tx_h_fragment)
1117 /* handlers after fragment must be aware of tx info fragmentation! */
1118 CALL_TXH(ieee80211_tx_h_encrypt)
1119 CALL_TXH(ieee80211_tx_h_calculate_duration)
1120 CALL_TXH(ieee80211_tx_h_stats)
1121#undef CALL_TXH
1124 1122
1123 txh_done:
1125 if (unlikely(res == TX_DROP)) { 1124 if (unlikely(res == TX_DROP)) {
1126 I802_DEBUG_INC(local->tx_handlers_drop); 1125 I802_DEBUG_INC(tx->local->tx_handlers_drop);
1127 dev_kfree_skb(skb); 1126 dev_kfree_skb(skb);
1128 for (i = 0; i < tx->num_extra_frag; i++) 1127 for (i = 0; i < tx->num_extra_frag; i++)
1129 if (tx->extra_frag[i]) 1128 if (tx->extra_frag[i])
@@ -1131,7 +1130,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
1131 kfree(tx->extra_frag); 1130 kfree(tx->extra_frag);
1132 return -1; 1131 return -1;
1133 } else if (unlikely(res == TX_QUEUED)) { 1132 } else if (unlikely(res == TX_QUEUED)) {
1134 I802_DEBUG_INC(local->tx_handlers_queued); 1133 I802_DEBUG_INC(tx->local->tx_handlers_queued);
1135 return -1; 1134 return -1;
1136 } 1135 }
1137 1136
@@ -1410,8 +1409,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1410 1409
1411 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1410 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1412 if (unlikely(skb->len < ETH_HLEN)) { 1411 if (unlikely(skb->len < ETH_HLEN)) {
1413 printk(KERN_DEBUG "%s: short skb (len=%d)\n",
1414 dev->name, skb->len);
1415 ret = 0; 1412 ret = 0;
1416 goto fail; 1413 goto fail;
1417 } 1414 }
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 35b664d00e23..872d2fcd1a5b 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -253,11 +253,8 @@ int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,
253 253
254 if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen, 254 if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen,
255 skb->data + hdrlen + WEP_IV_LEN, 255 skb->data + hdrlen + WEP_IV_LEN,
256 len)) { 256 len))
257 if (net_ratelimit())
258 printk(KERN_DEBUG "WEP decrypt failed (ICV)\n");
259 ret = -1; 257 ret = -1;
260 }
261 258
262 kfree(rc4key); 259 kfree(rc4key);
263 260
@@ -301,14 +298,8 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
301 return RX_CONTINUE; 298 return RX_CONTINUE;
302 299
303 if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { 300 if (!(rx->status->flag & RX_FLAG_DECRYPTED)) {
304 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { 301 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key))
305#ifdef CONFIG_MAC80211_DEBUG
306 if (net_ratelimit())
307 printk(KERN_DEBUG "%s: RX WEP frame, decrypt "
308 "failed\n", rx->dev->name);
309#endif /* CONFIG_MAC80211_DEBUG */
310 return RX_DROP_UNUSABLE; 302 return RX_DROP_UNUSABLE;
311 }
312 } else if (!(rx->status->flag & RX_FLAG_IV_STRIPPED)) { 303 } else if (!(rx->status->flag & RX_FLAG_IV_STRIPPED)) {
313 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); 304 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
314 /* remove ICV */ 305 /* remove ICV */
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index cfa8fbb0736a..f23b5a4d4ac9 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -680,7 +680,6 @@ void ieee80211_requeue(struct ieee80211_local *local, int queue)
680 if (!qdisc || !qdisc->dequeue) 680 if (!qdisc || !qdisc->dequeue)
681 return; 681 return;
682 682
683 printk(KERN_DEBUG "requeue: qlen = %d\n", qdisc->q.qlen);
684 for (len = qdisc->q.qlen; len > 0; len--) { 683 for (len = qdisc->q.qlen; len > 0; len--) {
685 skb = qdisc->dequeue(qdisc); 684 skb = qdisc->dequeue(qdisc);
686 root_qd->q.qlen--; 685 root_qd->q.qlen--;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index f809761fbfb5..b414d5d92f38 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -146,9 +146,6 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
146 if (!(rx->flags & IEEE80211_RX_RA_MATCH)) 146 if (!(rx->flags & IEEE80211_RX_RA_MATCH))
147 return RX_DROP_UNUSABLE; 147 return RX_DROP_UNUSABLE;
148 148
149 printk(KERN_DEBUG "%s: invalid Michael MIC in data frame from "
150 "%s\n", rx->dev->name, print_mac(mac, sa));
151
152 mac80211_ev_michael_mic_failure(rx->dev, rx->key->conf.keyidx, 149 mac80211_ev_michael_mic_failure(rx->dev, rx->key->conf.keyidx,
153 (void *) skb->data); 150 (void *) skb->data);
154 return RX_DROP_UNUSABLE; 151 return RX_DROP_UNUSABLE;
@@ -282,15 +279,8 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
282 hdr->addr1, hwaccel, rx->queue, 279 hdr->addr1, hwaccel, rx->queue,
283 &rx->tkip_iv32, 280 &rx->tkip_iv32,
284 &rx->tkip_iv16); 281 &rx->tkip_iv16);
285 if (res != TKIP_DECRYPT_OK || wpa_test) { 282 if (res != TKIP_DECRYPT_OK || wpa_test)
286#ifdef CONFIG_MAC80211_DEBUG
287 if (net_ratelimit())
288 printk(KERN_DEBUG "%s: TKIP decrypt failed for RX "
289 "frame from %s (res=%d)\n", rx->dev->name,
290 print_mac(mac, rx->sta->addr), res);
291#endif /* CONFIG_MAC80211_DEBUG */
292 return RX_DROP_UNUSABLE; 283 return RX_DROP_UNUSABLE;
293 }
294 284
295 /* Trim ICV */ 285 /* Trim ICV */
296 skb_trim(skb, skb->len - TKIP_ICV_LEN); 286 skb_trim(skb, skb->len - TKIP_ICV_LEN);
@@ -512,16 +502,6 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
512 (void) ccmp_hdr2pn(pn, skb->data + hdrlen); 502 (void) ccmp_hdr2pn(pn, skb->data + hdrlen);
513 503
514 if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) { 504 if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) {
515#ifdef CONFIG_MAC80211_DEBUG
516 u8 *ppn = key->u.ccmp.rx_pn[rx->queue];
517
518 printk(KERN_DEBUG "%s: CCMP replay detected for RX frame from "
519 "%s (RX PN %02x%02x%02x%02x%02x%02x <= prev. PN "
520 "%02x%02x%02x%02x%02x%02x)\n", rx->dev->name,
521 print_mac(mac, rx->sta->addr),
522 pn[0], pn[1], pn[2], pn[3], pn[4], pn[5],
523 ppn[0], ppn[1], ppn[2], ppn[3], ppn[4], ppn[5]);
524#endif /* CONFIG_MAC80211_DEBUG */
525 key->u.ccmp.replays++; 505 key->u.ccmp.replays++;
526 return RX_DROP_UNUSABLE; 506 return RX_DROP_UNUSABLE;
527 } 507 }
@@ -541,12 +521,6 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
541 skb->data + hdrlen + CCMP_HDR_LEN, data_len, 521 skb->data + hdrlen + CCMP_HDR_LEN, data_len,
542 skb->data + skb->len - CCMP_MIC_LEN, 522 skb->data + skb->len - CCMP_MIC_LEN,
543 skb->data + hdrlen + CCMP_HDR_LEN)) { 523 skb->data + hdrlen + CCMP_HDR_LEN)) {
544#ifdef CONFIG_MAC80211_DEBUG
545 if (net_ratelimit())
546 printk(KERN_DEBUG "%s: CCMP decrypt failed "
547 "for RX frame from %s\n", rx->dev->name,
548 print_mac(mac, rx->sta->addr));
549#endif /* CONFIG_MAC80211_DEBUG */
550 return RX_DROP_UNUSABLE; 524 return RX_DROP_UNUSABLE;
551 } 525 }
552 } 526 }