aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-09-21 15:49:14 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-09-21 15:49:14 -0400
commitb618f6f885579a6237e5bf4582fa6167972ddef4 (patch)
treeb11508178570b98ce9cb2d76ecebd046a6f0e77c /net/mac80211
parent462fb2af9788a82a534f8184abfde31574e1cfa0 (diff)
parent6e5c2b4e8addfaab8ef54dedaf7b607e1585c35b (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts: arch/arm/mach-omap2/board-omap3pandora.c drivers/net/wireless/ath/ath5k/base.c
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c30
-rw-r--r--net/mac80211/chan.c2
-rw-r--r--net/mac80211/driver-ops.h6
-rw-r--r--net/mac80211/driver-trace.h21
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/iface.c34
-rw-r--r--net/mac80211/key.c2
-rw-r--r--net/mac80211/main.c18
-rw-r--r--net/mac80211/mlme.c42
-rw-r--r--net/mac80211/offchannel.c7
-rw-r--r--net/mac80211/rx.c4
-rw-r--r--net/mac80211/sta_info.c4
-rw-r--r--net/mac80211/tx.c1
-rw-r--r--net/mac80211/util.c22
14 files changed, 135 insertions, 60 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 5de1ca3f17b9..c981604b71e6 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -577,6 +577,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
577 struct sta_info *sta, 577 struct sta_info *sta,
578 struct station_parameters *params) 578 struct station_parameters *params)
579{ 579{
580 unsigned long flags;
580 u32 rates; 581 u32 rates;
581 int i, j; 582 int i, j;
582 struct ieee80211_supported_band *sband; 583 struct ieee80211_supported_band *sband;
@@ -585,7 +586,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
585 586
586 sband = local->hw.wiphy->bands[local->oper_channel->band]; 587 sband = local->hw.wiphy->bands[local->oper_channel->band];
587 588
588 spin_lock_bh(&sta->lock); 589 spin_lock_irqsave(&sta->flaglock, flags);
589 mask = params->sta_flags_mask; 590 mask = params->sta_flags_mask;
590 set = params->sta_flags_set; 591 set = params->sta_flags_set;
591 592
@@ -612,7 +613,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
612 if (set & BIT(NL80211_STA_FLAG_MFP)) 613 if (set & BIT(NL80211_STA_FLAG_MFP))
613 sta->flags |= WLAN_STA_MFP; 614 sta->flags |= WLAN_STA_MFP;
614 } 615 }
615 spin_unlock_bh(&sta->lock); 616 spin_unlock_irqrestore(&sta->flaglock, flags);
616 617
617 /* 618 /*
618 * cfg80211 validates this (1-2007) and allows setting the AID 619 * cfg80211 validates this (1-2007) and allows setting the AID
@@ -1150,15 +1151,26 @@ static int ieee80211_scan(struct wiphy *wiphy,
1150 struct net_device *dev, 1151 struct net_device *dev,
1151 struct cfg80211_scan_request *req) 1152 struct cfg80211_scan_request *req)
1152{ 1153{
1153 struct ieee80211_sub_if_data *sdata; 1154 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1154
1155 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1156 1155
1157 if (sdata->vif.type != NL80211_IFTYPE_STATION && 1156 switch (ieee80211_vif_type_p2p(&sdata->vif)) {
1158 sdata->vif.type != NL80211_IFTYPE_ADHOC && 1157 case NL80211_IFTYPE_STATION:
1159 sdata->vif.type != NL80211_IFTYPE_MESH_POINT && 1158 case NL80211_IFTYPE_ADHOC:
1160 (sdata->vif.type != NL80211_IFTYPE_AP || sdata->u.ap.beacon)) 1159 case NL80211_IFTYPE_MESH_POINT:
1160 case NL80211_IFTYPE_P2P_CLIENT:
1161 break;
1162 case NL80211_IFTYPE_P2P_GO:
1163 if (sdata->local->ops->hw_scan)
1164 break;
1165 /* FIXME: implement NoA while scanning in software */
1166 return -EOPNOTSUPP;
1167 case NL80211_IFTYPE_AP:
1168 if (sdata->u.ap.beacon)
1169 return -EOPNOTSUPP;
1170 break;
1171 default:
1161 return -EOPNOTSUPP; 1172 return -EOPNOTSUPP;
1173 }
1162 1174
1163 return ieee80211_request_scan(sdata, req); 1175 return ieee80211_request_scan(sdata, req);
1164} 1176}
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 32be11e4c4d9..5b24740fc0b0 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -11,7 +11,7 @@ __ieee80211_get_channel_mode(struct ieee80211_local *local,
11{ 11{
12 struct ieee80211_sub_if_data *sdata; 12 struct ieee80211_sub_if_data *sdata;
13 13
14 WARN_ON(!mutex_is_locked(&local->iflist_mtx)); 14 lockdep_assert_held(&local->iflist_mtx);
15 15
16 list_for_each_entry(sdata, &local->interfaces, list) { 16 list_for_each_entry(sdata, &local->interfaces, list) {
17 if (sdata == ignore) 17 if (sdata == ignore)
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 6064b7b09e01..16983825f8e8 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -56,14 +56,14 @@ static inline int drv_add_interface(struct ieee80211_local *local,
56 56
57static inline int drv_change_interface(struct ieee80211_local *local, 57static inline int drv_change_interface(struct ieee80211_local *local,
58 struct ieee80211_sub_if_data *sdata, 58 struct ieee80211_sub_if_data *sdata,
59 enum nl80211_iftype type) 59 enum nl80211_iftype type, bool p2p)
60{ 60{
61 int ret; 61 int ret;
62 62
63 might_sleep(); 63 might_sleep();
64 64
65 trace_drv_change_interface(local, sdata, type); 65 trace_drv_change_interface(local, sdata, type, p2p);
66 ret = local->ops->change_interface(&local->hw, &sdata->vif, type); 66 ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
67 trace_drv_return_int(local, ret); 67 trace_drv_return_int(local, ret);
68 return ret; 68 return ret;
69} 69}
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index f6f3d89e43fa..6831fb1641c8 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -25,12 +25,14 @@ static inline void trace_ ## name(proto) {}
25#define STA_PR_FMT " sta:%pM" 25#define STA_PR_FMT " sta:%pM"
26#define STA_PR_ARG __entry->sta_addr 26#define STA_PR_ARG __entry->sta_addr
27 27
28#define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \ 28#define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \
29 __field(bool, p2p) \
29 __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") 30 __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>")
30#define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ 31#define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \
32 __entry->p2p = sdata->vif.p2p; \
31 __assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") 33 __assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>")
32#define VIF_PR_FMT " vif:%s(%d)" 34#define VIF_PR_FMT " vif:%s(%d%s)"
33#define VIF_PR_ARG __get_str(vif_name), __entry->vif_type 35#define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : ""
34 36
35/* 37/*
36 * Tracing for driver callbacks. 38 * Tracing for driver callbacks.
@@ -139,25 +141,28 @@ TRACE_EVENT(drv_add_interface,
139TRACE_EVENT(drv_change_interface, 141TRACE_EVENT(drv_change_interface,
140 TP_PROTO(struct ieee80211_local *local, 142 TP_PROTO(struct ieee80211_local *local,
141 struct ieee80211_sub_if_data *sdata, 143 struct ieee80211_sub_if_data *sdata,
142 enum nl80211_iftype type), 144 enum nl80211_iftype type, bool p2p),
143 145
144 TP_ARGS(local, sdata, type), 146 TP_ARGS(local, sdata, type, p2p),
145 147
146 TP_STRUCT__entry( 148 TP_STRUCT__entry(
147 LOCAL_ENTRY 149 LOCAL_ENTRY
148 VIF_ENTRY 150 VIF_ENTRY
149 __field(u32, new_type) 151 __field(u32, new_type)
152 __field(bool, new_p2p)
150 ), 153 ),
151 154
152 TP_fast_assign( 155 TP_fast_assign(
153 LOCAL_ASSIGN; 156 LOCAL_ASSIGN;
154 VIF_ASSIGN; 157 VIF_ASSIGN;
155 __entry->new_type = type; 158 __entry->new_type = type;
159 __entry->new_p2p = p2p;
156 ), 160 ),
157 161
158 TP_printk( 162 TP_printk(
159 LOCAL_PR_FMT VIF_PR_FMT " new type:%d", 163 LOCAL_PR_FMT VIF_PR_FMT " new type:%d%s",
160 LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type 164 LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type,
165 __entry->new_p2p ? "/p2p" : ""
161 ) 166 )
162); 167);
163 168
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 4e635e2fabdb..9346a6b0f400 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1041,6 +1041,8 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
1041void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); 1041void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
1042void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 1042void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1043 struct sk_buff *skb); 1043 struct sk_buff *skb);
1044void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
1045void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
1044 1046
1045/* IBSS code */ 1047/* IBSS code */
1046void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); 1048void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index c1cc200ac81f..66785739dad3 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -188,6 +188,8 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
188 break; 188 break;
189 case NL80211_IFTYPE_UNSPECIFIED: 189 case NL80211_IFTYPE_UNSPECIFIED:
190 case NUM_NL80211_IFTYPES: 190 case NUM_NL80211_IFTYPES:
191 case NL80211_IFTYPE_P2P_CLIENT:
192 case NL80211_IFTYPE_P2P_GO:
191 /* cannot happen */ 193 /* cannot happen */
192 WARN_ON(1); 194 WARN_ON(1);
193 break; 195 break;
@@ -280,6 +282,8 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
280 netif_carrier_on(dev); 282 netif_carrier_on(dev);
281 } 283 }
282 284
285 set_bit(SDATA_STATE_RUNNING, &sdata->state);
286
283 if (sdata->vif.type == NL80211_IFTYPE_WDS) { 287 if (sdata->vif.type == NL80211_IFTYPE_WDS) {
284 /* Create STA entry for the WDS peer */ 288 /* Create STA entry for the WDS peer */
285 sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, 289 sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
@@ -331,8 +335,6 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
331 335
332 netif_tx_start_all_queues(dev); 336 netif_tx_start_all_queues(dev);
333 337
334 set_bit(SDATA_STATE_RUNNING, &sdata->state);
335
336 return 0; 338 return 0;
337 err_del_interface: 339 err_del_interface:
338 drv_remove_interface(local, &sdata->vif); 340 drv_remove_interface(local, &sdata->vif);
@@ -343,6 +345,7 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
343 sdata->bss = NULL; 345 sdata->bss = NULL;
344 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 346 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
345 list_del(&sdata->u.vlan.list); 347 list_del(&sdata->u.vlan.list);
348 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
346 return res; 349 return res;
347} 350}
348 351
@@ -843,6 +846,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
843 846
844 /* and set some type-dependent values */ 847 /* and set some type-dependent values */
845 sdata->vif.type = type; 848 sdata->vif.type = type;
849 sdata->vif.p2p = false;
846 sdata->dev->netdev_ops = &ieee80211_dataif_ops; 850 sdata->dev->netdev_ops = &ieee80211_dataif_ops;
847 sdata->wdev.iftype = type; 851 sdata->wdev.iftype = type;
848 852
@@ -856,10 +860,20 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
856 INIT_WORK(&sdata->work, ieee80211_iface_work); 860 INIT_WORK(&sdata->work, ieee80211_iface_work);
857 861
858 switch (type) { 862 switch (type) {
863 case NL80211_IFTYPE_P2P_GO:
864 type = NL80211_IFTYPE_AP;
865 sdata->vif.type = type;
866 sdata->vif.p2p = true;
867 /* fall through */
859 case NL80211_IFTYPE_AP: 868 case NL80211_IFTYPE_AP:
860 skb_queue_head_init(&sdata->u.ap.ps_bc_buf); 869 skb_queue_head_init(&sdata->u.ap.ps_bc_buf);
861 INIT_LIST_HEAD(&sdata->u.ap.vlans); 870 INIT_LIST_HEAD(&sdata->u.ap.vlans);
862 break; 871 break;
872 case NL80211_IFTYPE_P2P_CLIENT:
873 type = NL80211_IFTYPE_STATION;
874 sdata->vif.type = type;
875 sdata->vif.p2p = true;
876 /* fall through */
863 case NL80211_IFTYPE_STATION: 877 case NL80211_IFTYPE_STATION:
864 ieee80211_sta_setup_sdata(sdata); 878 ieee80211_sta_setup_sdata(sdata);
865 break; 879 break;
@@ -893,6 +907,8 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
893{ 907{
894 struct ieee80211_local *local = sdata->local; 908 struct ieee80211_local *local = sdata->local;
895 int ret, err; 909 int ret, err;
910 enum nl80211_iftype internal_type = type;
911 bool p2p = false;
896 912
897 ASSERT_RTNL(); 913 ASSERT_RTNL();
898 914
@@ -925,11 +941,19 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
925 * code isn't prepared to handle). 941 * code isn't prepared to handle).
926 */ 942 */
927 break; 943 break;
944 case NL80211_IFTYPE_P2P_CLIENT:
945 p2p = true;
946 internal_type = NL80211_IFTYPE_STATION;
947 break;
948 case NL80211_IFTYPE_P2P_GO:
949 p2p = true;
950 internal_type = NL80211_IFTYPE_AP;
951 break;
928 default: 952 default:
929 return -EBUSY; 953 return -EBUSY;
930 } 954 }
931 955
932 ret = ieee80211_check_concurrent_iface(sdata, type); 956 ret = ieee80211_check_concurrent_iface(sdata, internal_type);
933 if (ret) 957 if (ret)
934 return ret; 958 return ret;
935 959
@@ -937,7 +961,7 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
937 961
938 ieee80211_teardown_sdata(sdata->dev); 962 ieee80211_teardown_sdata(sdata->dev);
939 963
940 ret = drv_change_interface(local, sdata, type); 964 ret = drv_change_interface(local, sdata, internal_type, p2p);
941 if (ret) 965 if (ret)
942 type = sdata->vif.type; 966 type = sdata->vif.type;
943 967
@@ -956,7 +980,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
956 980
957 ASSERT_RTNL(); 981 ASSERT_RTNL();
958 982
959 if (type == sdata->vif.type) 983 if (type == ieee80211_vif_type_p2p(&sdata->vif))
960 return 0; 984 return 0;
961 985
962 /* Setting ad-hoc mode on non-IBSS channel is not supported. */ 986 /* Setting ad-hoc mode on non-IBSS channel is not supported. */
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 3570f8c2bb40..6a63d1abd14d 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -49,7 +49,7 @@ static const u8 bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
49 49
50static void assert_key_lock(struct ieee80211_local *local) 50static void assert_key_lock(struct ieee80211_local *local)
51{ 51{
52 WARN_ON(!mutex_is_locked(&local->key_mtx)); 52 lockdep_assert_held(&local->key_mtx);
53} 53}
54 54
55static struct ieee80211_sta *get_sta_for_key(struct ieee80211_key *key) 55static struct ieee80211_sta *get_sta_for_key(struct ieee80211_key *key)
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index b8cf2821f00d..fda97bb0018b 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -305,6 +305,9 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw)
305 305
306 trace_api_restart_hw(local); 306 trace_api_restart_hw(local);
307 307
308 /* wait for scan work complete */
309 flush_workqueue(local->workqueue);
310
308 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), 311 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
309 "%s called with hardware scan in progress\n", __func__); 312 "%s called with hardware scan in progress\n", __func__);
310 313
@@ -456,6 +459,21 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
456 BIT(IEEE80211_STYPE_DEAUTH >> 4) | 459 BIT(IEEE80211_STYPE_DEAUTH >> 4) |
457 BIT(IEEE80211_STYPE_ACTION >> 4), 460 BIT(IEEE80211_STYPE_ACTION >> 4),
458 }, 461 },
462 [NL80211_IFTYPE_P2P_CLIENT] = {
463 .tx = 0xffff,
464 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
465 BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
466 },
467 [NL80211_IFTYPE_P2P_GO] = {
468 .tx = 0xffff,
469 .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
470 BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
471 BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
472 BIT(IEEE80211_STYPE_DISASSOC >> 4) |
473 BIT(IEEE80211_STYPE_AUTH >> 4) |
474 BIT(IEEE80211_STYPE_DEAUTH >> 4) |
475 BIT(IEEE80211_STYPE_ACTION >> 4),
476 },
459}; 477};
460 478
461struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, 479struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 0cb822cc12e9..8b733cf6f3ea 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -92,7 +92,7 @@ enum rx_mgmt_action {
92/* utils */ 92/* utils */
93static inline void ASSERT_MGD_MTX(struct ieee80211_if_managed *ifmgd) 93static inline void ASSERT_MGD_MTX(struct ieee80211_if_managed *ifmgd)
94{ 94{
95 WARN_ON(!mutex_is_locked(&ifmgd->mtx)); 95 lockdep_assert_held(&ifmgd->mtx);
96} 96}
97 97
98/* 98/*
@@ -115,7 +115,7 @@ static void run_again(struct ieee80211_if_managed *ifmgd,
115 mod_timer(&ifmgd->timer, timeout); 115 mod_timer(&ifmgd->timer, timeout);
116} 116}
117 117
118static void mod_beacon_timer(struct ieee80211_sub_if_data *sdata) 118void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata)
119{ 119{
120 if (sdata->local->hw.flags & IEEE80211_HW_BEACON_FILTER) 120 if (sdata->local->hw.flags & IEEE80211_HW_BEACON_FILTER)
121 return; 121 return;
@@ -124,6 +124,19 @@ static void mod_beacon_timer(struct ieee80211_sub_if_data *sdata)
124 round_jiffies_up(jiffies + IEEE80211_BEACON_LOSS_TIME)); 124 round_jiffies_up(jiffies + IEEE80211_BEACON_LOSS_TIME));
125} 125}
126 126
127void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata)
128{
129 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
130
131 if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR)
132 return;
133
134 mod_timer(&sdata->u.mgd.conn_mon_timer,
135 round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME));
136
137 ifmgd->probe_send_count = 0;
138}
139
127static int ecw2cw(int ecw) 140static int ecw2cw(int ecw)
128{ 141{
129 return (1 << ecw) - 1; 142 return (1 << ecw) - 1;
@@ -1018,21 +1031,26 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
1018 if (is_multicast_ether_addr(hdr->addr1)) 1031 if (is_multicast_ether_addr(hdr->addr1))
1019 return; 1032 return;
1020 1033
1021 if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) 1034 ieee80211_sta_reset_conn_monitor(sdata);
1022 return;
1023
1024 mod_timer(&sdata->u.mgd.conn_mon_timer,
1025 round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME));
1026} 1035}
1027 1036
1028static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) 1037static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
1029{ 1038{
1030 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 1039 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
1031 const u8 *ssid; 1040 const u8 *ssid;
1041 u8 *dst = ifmgd->associated->bssid;
1042 u8 unicast_limit = max(1, IEEE80211_MAX_PROBE_TRIES - 3);
1043
1044 /*
1045 * Try sending broadcast probe requests for the last three
1046 * probe requests after the first ones failed since some
1047 * buggy APs only support broadcast probe requests.
1048 */
1049 if (ifmgd->probe_send_count >= unicast_limit)
1050 dst = NULL;
1032 1051
1033 ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); 1052 ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID);
1034 ieee80211_send_probe_req(sdata, ifmgd->associated->bssid, 1053 ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid[1], NULL, 0);
1035 ssid + 2, ssid[1], NULL, 0);
1036 1054
1037 ifmgd->probe_send_count++; 1055 ifmgd->probe_send_count++;
1038 ifmgd->probe_timeout = jiffies + IEEE80211_PROBE_WAIT; 1056 ifmgd->probe_timeout = jiffies + IEEE80211_PROBE_WAIT;
@@ -1381,7 +1399,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
1381 * Also start the timer that will detect beacon loss. 1399 * Also start the timer that will detect beacon loss.
1382 */ 1400 */
1383 ieee80211_sta_rx_notify(sdata, (struct ieee80211_hdr *)mgmt); 1401 ieee80211_sta_rx_notify(sdata, (struct ieee80211_hdr *)mgmt);
1384 mod_beacon_timer(sdata); 1402 ieee80211_sta_reset_beacon_monitor(sdata);
1385 1403
1386 return true; 1404 return true;
1387} 1405}
@@ -1484,7 +1502,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
1484 * we have or will be receiving any beacons or data, so let's 1502 * we have or will be receiving any beacons or data, so let's
1485 * schedule the timers again, just in case. 1503 * schedule the timers again, just in case.
1486 */ 1504 */
1487 mod_beacon_timer(sdata); 1505 ieee80211_sta_reset_beacon_monitor(sdata);
1488 1506
1489 mod_timer(&ifmgd->conn_mon_timer, 1507 mod_timer(&ifmgd->conn_mon_timer,
1490 round_jiffies_up(jiffies + 1508 round_jiffies_up(jiffies +
@@ -1610,7 +1628,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
1610 * Push the beacon loss detection into the future since 1628 * Push the beacon loss detection into the future since
1611 * we are processing a beacon from the AP just now. 1629 * we are processing a beacon from the AP just now.
1612 */ 1630 */
1613 mod_beacon_timer(sdata); 1631 ieee80211_sta_reset_beacon_monitor(sdata);
1614 1632
1615 ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); 1633 ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4);
1616 ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable, 1634 ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable,
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index eeacaa59380a..4b564091e51d 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -22,12 +22,16 @@
22static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata) 22static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata)
23{ 23{
24 struct ieee80211_local *local = sdata->local; 24 struct ieee80211_local *local = sdata->local;
25 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
25 26
26 local->offchannel_ps_enabled = false; 27 local->offchannel_ps_enabled = false;
27 28
28 /* FIXME: what to do when local->pspolling is true? */ 29 /* FIXME: what to do when local->pspolling is true? */
29 30
30 del_timer_sync(&local->dynamic_ps_timer); 31 del_timer_sync(&local->dynamic_ps_timer);
32 del_timer_sync(&ifmgd->bcn_mon_timer);
33 del_timer_sync(&ifmgd->conn_mon_timer);
34
31 cancel_work_sync(&local->dynamic_ps_enable_work); 35 cancel_work_sync(&local->dynamic_ps_enable_work);
32 36
33 if (local->hw.conf.flags & IEEE80211_CONF_PS) { 37 if (local->hw.conf.flags & IEEE80211_CONF_PS) {
@@ -85,6 +89,9 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata)
85 mod_timer(&local->dynamic_ps_timer, jiffies + 89 mod_timer(&local->dynamic_ps_timer, jiffies +
86 msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); 90 msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout));
87 } 91 }
92
93 ieee80211_sta_reset_beacon_monitor(sdata);
94 ieee80211_sta_reset_conn_monitor(sdata);
88} 95}
89 96
90void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local) 97void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index ac205a33690f..c0368152b721 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2588,9 +2588,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
2588 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) 2588 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
2589 return 0; 2589 return 0;
2590 break; 2590 break;
2591 case NL80211_IFTYPE_MONITOR: 2591 default:
2592 case NL80211_IFTYPE_UNSPECIFIED:
2593 case NUM_NL80211_IFTYPES:
2594 /* should never get here */ 2592 /* should never get here */
2595 WARN_ON(1); 2593 WARN_ON(1);
2596 break; 2594 break;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 687077e49dc6..44e10a9de0a7 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -125,7 +125,7 @@ struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
125 lockdep_is_held(&local->sta_mtx)); 125 lockdep_is_held(&local->sta_mtx));
126 while (sta) { 126 while (sta) {
127 if ((sta->sdata == sdata || 127 if ((sta->sdata == sdata ||
128 sta->sdata->bss == sdata->bss) && 128 (sta->sdata->bss && sta->sdata->bss == sdata->bss)) &&
129 memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) 129 memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
130 break; 130 break;
131 sta = rcu_dereference_check(sta->hnext, 131 sta = rcu_dereference_check(sta->hnext,
@@ -280,7 +280,7 @@ static int sta_info_finish_insert(struct sta_info *sta, bool async)
280 unsigned long flags; 280 unsigned long flags;
281 int err = 0; 281 int err = 0;
282 282
283 WARN_ON(!mutex_is_locked(&local->sta_mtx)); 283 lockdep_assert_held(&local->sta_mtx);
284 284
285 /* notify driver */ 285 /* notify driver */
286 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 286 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index ccf373788ce9..e1733dcb58a7 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1609,6 +1609,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1609 return; 1609 return;
1610 } 1610 }
1611 1611
1612 hdr = (struct ieee80211_hdr *) skb->data;
1612 info->control.vif = &sdata->vif; 1613 info->control.vif = &sdata->vif;
1613 1614
1614 if (ieee80211_vif_is_mesh(&sdata->vif) && 1615 if (ieee80211_vif_is_mesh(&sdata->vif) &&
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index bd40b11d5ab9..737f4267c335 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -474,16 +474,10 @@ void ieee80211_iterate_active_interfaces(
474 474
475 list_for_each_entry(sdata, &local->interfaces, list) { 475 list_for_each_entry(sdata, &local->interfaces, list) {
476 switch (sdata->vif.type) { 476 switch (sdata->vif.type) {
477 case NUM_NL80211_IFTYPES:
478 case NL80211_IFTYPE_UNSPECIFIED:
479 case NL80211_IFTYPE_MONITOR: 477 case NL80211_IFTYPE_MONITOR:
480 case NL80211_IFTYPE_AP_VLAN: 478 case NL80211_IFTYPE_AP_VLAN:
481 continue; 479 continue;
482 case NL80211_IFTYPE_AP: 480 default:
483 case NL80211_IFTYPE_STATION:
484 case NL80211_IFTYPE_ADHOC:
485 case NL80211_IFTYPE_WDS:
486 case NL80211_IFTYPE_MESH_POINT:
487 break; 481 break;
488 } 482 }
489 if (ieee80211_sdata_running(sdata)) 483 if (ieee80211_sdata_running(sdata))
@@ -508,16 +502,10 @@ void ieee80211_iterate_active_interfaces_atomic(
508 502
509 list_for_each_entry_rcu(sdata, &local->interfaces, list) { 503 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
510 switch (sdata->vif.type) { 504 switch (sdata->vif.type) {
511 case NUM_NL80211_IFTYPES:
512 case NL80211_IFTYPE_UNSPECIFIED:
513 case NL80211_IFTYPE_MONITOR: 505 case NL80211_IFTYPE_MONITOR:
514 case NL80211_IFTYPE_AP_VLAN: 506 case NL80211_IFTYPE_AP_VLAN:
515 continue; 507 continue;
516 case NL80211_IFTYPE_AP: 508 default:
517 case NL80211_IFTYPE_STATION:
518 case NL80211_IFTYPE_ADHOC:
519 case NL80211_IFTYPE_WDS:
520 case NL80211_IFTYPE_MESH_POINT:
521 break; 509 break;
522 } 510 }
523 if (ieee80211_sdata_running(sdata)) 511 if (ieee80211_sdata_running(sdata))
@@ -1193,6 +1181,8 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1193 break; 1181 break;
1194 case NL80211_IFTYPE_UNSPECIFIED: 1182 case NL80211_IFTYPE_UNSPECIFIED:
1195 case NUM_NL80211_IFTYPES: 1183 case NUM_NL80211_IFTYPES:
1184 case NL80211_IFTYPE_P2P_CLIENT:
1185 case NL80211_IFTYPE_P2P_GO:
1196 WARN_ON(1); 1186 WARN_ON(1);
1197 break; 1187 break;
1198 } 1188 }
@@ -1296,9 +1286,9 @@ void ieee80211_recalc_smps(struct ieee80211_local *local,
1296 int count = 0; 1286 int count = 0;
1297 1287
1298 if (forsdata) 1288 if (forsdata)
1299 WARN_ON(!mutex_is_locked(&forsdata->u.mgd.mtx)); 1289 lockdep_assert_held(&forsdata->u.mgd.mtx);
1300 1290
1301 WARN_ON(!mutex_is_locked(&local->iflist_mtx)); 1291 lockdep_assert_held(&local->iflist_mtx);
1302 1292
1303 /* 1293 /*
1304 * This function could be improved to handle multiple 1294 * This function could be improved to handle multiple