aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2011-12-06 10:47:12 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-12-06 10:47:12 -0500
commitd39aeaf260e7d1ec6a677beed230a0406d0069a6 (patch)
tree1f5881fc037eaf55e83d56b09cfb194274419ce4 /net
parent40e4783ee62ac656a9a0fa3b512b6aee4f07d2d1 (diff)
parentd7a4858c0fde8383f7aa494eda0fba6bef3f2fec (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/Kconfig12
-rw-r--r--net/mac80211/Makefile4
-rw-r--r--net/mac80211/agg-rx.c11
-rw-r--r--net/mac80211/agg-tx.c39
-rw-r--r--net/mac80211/cfg.c22
-rw-r--r--net/mac80211/debugfs.c35
-rw-r--r--net/mac80211/debugfs_netdev.c3
-rw-r--r--net/mac80211/driver-ops.h14
-rw-r--r--net/mac80211/driver-trace.h11
-rw-r--r--net/mac80211/ht.c6
-rw-r--r--net/mac80211/ieee80211_i.h10
-rw-r--r--net/mac80211/iface.c17
-rw-r--r--net/mac80211/main.c47
-rw-r--r--net/mac80211/mesh.c1
-rw-r--r--net/mac80211/mesh.h2
-rw-r--r--net/mac80211/mesh_hwmp.c146
-rw-r--r--net/mac80211/mesh_pathtbl.c29
-rw-r--r--net/mac80211/offchannel.c9
-rw-r--r--net/mac80211/rx.c105
-rw-r--r--net/mac80211/scan.c4
-rw-r--r--net/mac80211/sta_info.c4
-rw-r--r--net/mac80211/sta_info.h3
-rw-r--r--net/mac80211/tx.c44
-rw-r--r--net/mac80211/util.c8
-rw-r--r--net/mac80211/wme.c32
-rw-r--r--net/mac80211/wme.h3
-rw-r--r--net/mac80211/work.c99
-rw-r--r--net/nfc/core.c60
-rw-r--r--net/nfc/nci/core.c84
-rw-r--r--net/nfc/nci/data.c30
-rw-r--r--net/nfc/nci/ntf.c83
-rw-r--r--net/nfc/nci/rsp.c84
-rw-r--r--net/nfc/netlink.c32
-rw-r--r--net/nfc/nfc.h7
-rw-r--r--net/nfc/rawsock.c28
-rw-r--r--net/rfkill/rfkill-gpio.c13
-rw-r--r--net/rfkill/rfkill-regulator.c12
-rw-r--r--net/wireless/mesh.c2
-rw-r--r--net/wireless/nl80211.c39
-rw-r--r--net/wireless/reg.c49
40 files changed, 565 insertions, 678 deletions
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 7d3b438755f0..96ddb72760b9 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -247,15 +247,3 @@ config MAC80211_DEBUG_COUNTERS
247 and show them in debugfs. 247 and show them in debugfs.
248 248
249 If unsure, say N. 249 If unsure, say N.
250
251config MAC80211_DRIVER_API_TRACER
252 bool "Driver API tracer"
253 depends on MAC80211_DEBUG_MENU
254 depends on EVENT_TRACING
255 help
256 Say Y here to make mac80211 register with the ftrace
257 framework for the driver API -- you can then see which
258 driver methods it is calling and which API functions
259 drivers are calling by looking at the trace.
260
261 If unsure, say Y.
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index fdb54e61d637..d540c3b160f3 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -24,7 +24,8 @@ mac80211-y := \
24 util.o \ 24 util.o \
25 wme.o \ 25 wme.o \
26 event.o \ 26 event.o \
27 chan.o 27 chan.o \
28 driver-trace.o
28 29
29mac80211-$(CONFIG_MAC80211_LEDS) += led.o 30mac80211-$(CONFIG_MAC80211_LEDS) += led.o
30mac80211-$(CONFIG_MAC80211_DEBUGFS) += \ 31mac80211-$(CONFIG_MAC80211_DEBUGFS) += \
@@ -41,7 +42,6 @@ mac80211-$(CONFIG_MAC80211_MESH) += \
41 42
42mac80211-$(CONFIG_PM) += pm.o 43mac80211-$(CONFIG_PM) += pm.o
43 44
44mac80211-$(CONFIG_MAC80211_DRIVER_API_TRACER) += driver-trace.o
45CFLAGS_driver-trace.o := -I$(src) 45CFLAGS_driver-trace.o := -I$(src)
46 46
47# objects for PID algorithm 47# objects for PID algorithm
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 476b106c0b1c..e844e5a38408 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -73,8 +73,11 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
73 RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL); 73 RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL);
74 74
75#ifdef CONFIG_MAC80211_HT_DEBUG 75#ifdef CONFIG_MAC80211_HT_DEBUG
76 printk(KERN_DEBUG "Rx BA session stop requested for %pM tid %u\n", 76 printk(KERN_DEBUG
77 sta->sta.addr, tid); 77 "Rx BA session stop requested for %pM tid %u %s reason: %d\n",
78 sta->sta.addr, tid,
79 initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator",
80 (int)reason);
78#endif /* CONFIG_MAC80211_HT_DEBUG */ 81#endif /* CONFIG_MAC80211_HT_DEBUG */
79 82
80 if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP, 83 if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP,
@@ -85,7 +88,7 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
85 /* check if this is a self generated aggregation halt */ 88 /* check if this is a self generated aggregation halt */
86 if (initiator == WLAN_BACK_RECIPIENT && tx) 89 if (initiator == WLAN_BACK_RECIPIENT && tx)
87 ieee80211_send_delba(sta->sdata, sta->sta.addr, 90 ieee80211_send_delba(sta->sdata, sta->sta.addr,
88 tid, 0, reason); 91 tid, WLAN_BACK_RECIPIENT, reason);
89 92
90 del_timer_sync(&tid_rx->session_timer); 93 del_timer_sync(&tid_rx->session_timer);
91 del_timer_sync(&tid_rx->reorder_timer); 94 del_timer_sync(&tid_rx->reorder_timer);
@@ -109,7 +112,7 @@ void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
109 int i; 112 int i;
110 113
111 rcu_read_lock(); 114 rcu_read_lock();
112 sta = sta_info_get(sdata, addr); 115 sta = sta_info_get_bss(sdata, addr);
113 if (!sta) { 116 if (!sta) {
114 rcu_read_unlock(); 117 rcu_read_unlock();
115 return; 118 return;
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index 556765749b9c..2c2e9519a2e7 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -186,6 +186,7 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
186#endif /* CONFIG_MAC80211_HT_DEBUG */ 186#endif /* CONFIG_MAC80211_HT_DEBUG */
187 187
188 del_timer_sync(&tid_tx->addba_resp_timer); 188 del_timer_sync(&tid_tx->addba_resp_timer);
189 del_timer_sync(&tid_tx->session_timer);
189 190
190 /* 191 /*
191 * After this packets are no longer handed right through 192 * After this packets are no longer handed right through
@@ -369,6 +370,28 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
369 tid_tx->timeout); 370 tid_tx->timeout);
370} 371}
371 372
373/*
374 * After accepting the AddBA Response we activated a timer,
375 * resetting it after each frame that we send.
376 */
377static void sta_tx_agg_session_timer_expired(unsigned long data)
378{
379 /* not an elegant detour, but there is no choice as the timer passes
380 * only one argument, and various sta_info are needed here, so init
381 * flow in sta_info_create gives the TID as data, while the timer_to_id
382 * array gives the sta through container_of */
383 u8 *ptid = (u8 *)data;
384 u8 *timer_to_id = ptid - *ptid;
385 struct sta_info *sta = container_of(timer_to_id, struct sta_info,
386 timer_to_tid[0]);
387
388#ifdef CONFIG_MAC80211_HT_DEBUG
389 printk(KERN_DEBUG "tx session timer expired on tid %d\n", (u16)*ptid);
390#endif
391
392 ieee80211_stop_tx_ba_session(&sta->sta, *ptid);
393}
394
372int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, 395int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
373 u16 timeout) 396 u16 timeout)
374{ 397{
@@ -438,11 +461,16 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
438 461
439 tid_tx->timeout = timeout; 462 tid_tx->timeout = timeout;
440 463
441 /* Tx timer */ 464 /* response timer */
442 tid_tx->addba_resp_timer.function = sta_addba_resp_timer_expired; 465 tid_tx->addba_resp_timer.function = sta_addba_resp_timer_expired;
443 tid_tx->addba_resp_timer.data = (unsigned long)&sta->timer_to_tid[tid]; 466 tid_tx->addba_resp_timer.data = (unsigned long)&sta->timer_to_tid[tid];
444 init_timer(&tid_tx->addba_resp_timer); 467 init_timer(&tid_tx->addba_resp_timer);
445 468
469 /* tx timer */
470 tid_tx->session_timer.function = sta_tx_agg_session_timer_expired;
471 tid_tx->session_timer.data = (unsigned long)&sta->timer_to_tid[tid];
472 init_timer(&tid_tx->session_timer);
473
446 /* assign a dialog token */ 474 /* assign a dialog token */
447 sta->ampdu_mlme.dialog_token_allocator++; 475 sta->ampdu_mlme.dialog_token_allocator++;
448 tid_tx->dialog_token = sta->ampdu_mlme.dialog_token_allocator; 476 tid_tx->dialog_token = sta->ampdu_mlme.dialog_token_allocator;
@@ -547,7 +575,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
547 } 575 }
548 576
549 mutex_lock(&local->sta_mtx); 577 mutex_lock(&local->sta_mtx);
550 sta = sta_info_get(sdata, ra); 578 sta = sta_info_get_bss(sdata, ra);
551 if (!sta) { 579 if (!sta) {
552 mutex_unlock(&local->sta_mtx); 580 mutex_unlock(&local->sta_mtx);
553#ifdef CONFIG_MAC80211_HT_DEBUG 581#ifdef CONFIG_MAC80211_HT_DEBUG
@@ -676,7 +704,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
676 704
677 mutex_lock(&local->sta_mtx); 705 mutex_lock(&local->sta_mtx);
678 706
679 sta = sta_info_get(sdata, ra); 707 sta = sta_info_get_bss(sdata, ra);
680 if (!sta) { 708 if (!sta) {
681#ifdef CONFIG_MAC80211_HT_DEBUG 709#ifdef CONFIG_MAC80211_HT_DEBUG
682 printk(KERN_DEBUG "Could not find station: %pM\n", ra); 710 printk(KERN_DEBUG "Could not find station: %pM\n", ra);
@@ -814,6 +842,11 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
814 ieee80211_agg_tx_operational(local, sta, tid); 842 ieee80211_agg_tx_operational(local, sta, tid);
815 843
816 sta->ampdu_mlme.addba_req_num[tid] = 0; 844 sta->ampdu_mlme.addba_req_num[tid] = 0;
845
846 if (tid_tx->timeout)
847 mod_timer(&tid_tx->session_timer,
848 TU_TO_EXP_TIME(tid_tx->timeout));
849
817 } else { 850 } else {
818 ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR, 851 ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR,
819 true); 852 true);
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 2577c45069e5..393b2a4445b8 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -102,6 +102,16 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
102 return 0; 102 return 0;
103} 103}
104 104
105static int ieee80211_set_noack_map(struct wiphy *wiphy,
106 struct net_device *dev,
107 u16 noack_map)
108{
109 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
110
111 sdata->noack_map = noack_map;
112 return 0;
113}
114
105static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, 115static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
106 u8 key_idx, bool pairwise, const u8 *mac_addr, 116 u8 key_idx, bool pairwise, const u8 *mac_addr,
107 struct key_params *params) 117 struct key_params *params)
@@ -499,7 +509,7 @@ static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
499 if (!resp || !resp_len) 509 if (!resp || !resp_len)
500 return -EINVAL; 510 return -EINVAL;
501 511
502 old = sdata->u.ap.probe_resp; 512 old = rtnl_dereference(sdata->u.ap.probe_resp);
503 513
504 new = dev_alloc_skb(resp_len); 514 new = dev_alloc_skb(resp_len);
505 if (!new) 515 if (!new)
@@ -1185,6 +1195,8 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
1185{ 1195{
1186 u8 *new_ie; 1196 u8 *new_ie;
1187 const u8 *old_ie; 1197 const u8 *old_ie;
1198 struct ieee80211_sub_if_data *sdata = container_of(ifmsh,
1199 struct ieee80211_sub_if_data, u.mesh);
1188 1200
1189 /* allocate information elements */ 1201 /* allocate information elements */
1190 new_ie = NULL; 1202 new_ie = NULL;
@@ -1211,6 +1223,10 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
1211 if (setup->is_secure) 1223 if (setup->is_secure)
1212 ifmsh->security |= IEEE80211_MESH_SEC_SECURED; 1224 ifmsh->security |= IEEE80211_MESH_SEC_SECURED;
1213 1225
1226 /* mcast rate setting in Mesh Node */
1227 memcpy(sdata->vif.bss_conf.mcast_rate, setup->mcast_rate,
1228 sizeof(setup->mcast_rate));
1229
1214 return 0; 1230 return 0;
1215} 1231}
1216 1232
@@ -1256,6 +1272,9 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy,
1256 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, mask)) 1272 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, mask))
1257 conf->dot11MeshHWMPpreqMinInterval = 1273 conf->dot11MeshHWMPpreqMinInterval =
1258 nconf->dot11MeshHWMPpreqMinInterval; 1274 nconf->dot11MeshHWMPpreqMinInterval;
1275 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, mask))
1276 conf->dot11MeshHWMPperrMinInterval =
1277 nconf->dot11MeshHWMPperrMinInterval;
1259 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, 1278 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
1260 mask)) 1279 mask))
1261 conf->dot11MeshHWMPnetDiameterTraversalTime = 1280 conf->dot11MeshHWMPnetDiameterTraversalTime =
@@ -2698,4 +2717,5 @@ struct cfg80211_ops mac80211_config_ops = {
2698 .tdls_mgmt = ieee80211_tdls_mgmt, 2717 .tdls_mgmt = ieee80211_tdls_mgmt,
2699 .probe_client = ieee80211_probe_client, 2718 .probe_client = ieee80211_probe_client,
2700 .get_channel = ieee80211_wiphy_get_channel, 2719 .get_channel = ieee80211_wiphy_get_channel,
2720 .set_noack_map = ieee80211_set_noack_map,
2701}; 2721};
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 00cefcb493eb..90baea53e7c5 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -97,40 +97,6 @@ static const struct file_operations reset_ops = {
97 .llseek = noop_llseek, 97 .llseek = noop_llseek,
98}; 98};
99 99
100static ssize_t noack_read(struct file *file, char __user *user_buf,
101 size_t count, loff_t *ppos)
102{
103 struct ieee80211_local *local = file->private_data;
104
105 return mac80211_format_buffer(user_buf, count, ppos, "%d\n",
106 local->wifi_wme_noack_test);
107}
108
109static ssize_t noack_write(struct file *file,
110 const char __user *user_buf,
111 size_t count, loff_t *ppos)
112{
113 struct ieee80211_local *local = file->private_data;
114 char buf[10];
115 size_t len;
116
117 len = min(count, sizeof(buf) - 1);
118 if (copy_from_user(buf, user_buf, len))
119 return -EFAULT;
120 buf[len] = '\0';
121
122 local->wifi_wme_noack_test = !!simple_strtoul(buf, NULL, 0);
123
124 return count;
125}
126
127static const struct file_operations noack_ops = {
128 .read = noack_read,
129 .write = noack_write,
130 .open = mac80211_open_file_generic,
131 .llseek = default_llseek,
132};
133
134static ssize_t uapsd_queues_read(struct file *file, char __user *user_buf, 100static ssize_t uapsd_queues_read(struct file *file, char __user *user_buf,
135 size_t count, loff_t *ppos) 101 size_t count, loff_t *ppos)
136{ 102{
@@ -398,7 +364,6 @@ void debugfs_hw_add(struct ieee80211_local *local)
398 DEBUGFS_ADD(wep_iv); 364 DEBUGFS_ADD(wep_iv);
399 DEBUGFS_ADD(queues); 365 DEBUGFS_ADD(queues);
400 DEBUGFS_ADD_MODE(reset, 0200); 366 DEBUGFS_ADD_MODE(reset, 0200);
401 DEBUGFS_ADD(noack);
402 DEBUGFS_ADD(uapsd_queues); 367 DEBUGFS_ADD(uapsd_queues);
403 DEBUGFS_ADD(uapsd_max_sp_len); 368 DEBUGFS_ADD(uapsd_max_sp_len);
404 DEBUGFS_ADD(channel_type); 369 DEBUGFS_ADD(channel_type);
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 9352819a986b..8df28910b8ee 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -405,6 +405,8 @@ IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout,
405 u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC); 405 u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC);
406IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval, 406IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval,
407 u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC); 407 u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC);
408IEEE80211_IF_FILE(dot11MeshHWMPperrMinInterval,
409 u.mesh.mshcfg.dot11MeshHWMPperrMinInterval, DEC);
408IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime, 410IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime,
409 u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC); 411 u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC);
410IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries, 412IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries,
@@ -534,6 +536,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
534 MESHPARAMS_ADD(dot11MeshMaxPeerLinks); 536 MESHPARAMS_ADD(dot11MeshMaxPeerLinks);
535 MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout); 537 MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout);
536 MESHPARAMS_ADD(dot11MeshHWMPpreqMinInterval); 538 MESHPARAMS_ADD(dot11MeshHWMPpreqMinInterval);
539 MESHPARAMS_ADD(dot11MeshHWMPperrMinInterval);
537 MESHPARAMS_ADD(dot11MeshHWMPnetDiameterTraversalTime); 540 MESHPARAMS_ADD(dot11MeshHWMPnetDiameterTraversalTime);
538 MESHPARAMS_ADD(dot11MeshHWMPmaxPREQretries); 541 MESHPARAMS_ADD(dot11MeshHWMPmaxPREQretries);
539 MESHPARAMS_ADD(path_refresh_time); 542 MESHPARAMS_ADD(path_refresh_time);
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 49cc5e0e8a6a..e8960ae39861 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -10,6 +10,16 @@ static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
10 WARN_ON(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER)); 10 WARN_ON(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER));
11} 11}
12 12
13static inline struct ieee80211_sub_if_data *
14get_bss_sdata(struct ieee80211_sub_if_data *sdata)
15{
16 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
17 sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
18 u.ap);
19
20 return sdata;
21}
22
13static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb) 23static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb)
14{ 24{
15 local->ops->tx(&local->hw, skb); 25 local->ops->tx(&local->hw, skb);
@@ -421,6 +431,7 @@ static inline void drv_sta_notify(struct ieee80211_local *local,
421 enum sta_notify_cmd cmd, 431 enum sta_notify_cmd cmd,
422 struct ieee80211_sta *sta) 432 struct ieee80211_sta *sta)
423{ 433{
434 sdata = get_bss_sdata(sdata);
424 check_sdata_in_driver(sdata); 435 check_sdata_in_driver(sdata);
425 436
426 trace_drv_sta_notify(local, sdata, cmd, sta); 437 trace_drv_sta_notify(local, sdata, cmd, sta);
@@ -437,6 +448,7 @@ static inline int drv_sta_add(struct ieee80211_local *local,
437 448
438 might_sleep(); 449 might_sleep();
439 450
451 sdata = get_bss_sdata(sdata);
440 check_sdata_in_driver(sdata); 452 check_sdata_in_driver(sdata);
441 453
442 trace_drv_sta_add(local, sdata, sta); 454 trace_drv_sta_add(local, sdata, sta);
@@ -454,6 +466,7 @@ static inline void drv_sta_remove(struct ieee80211_local *local,
454{ 466{
455 might_sleep(); 467 might_sleep();
456 468
469 sdata = get_bss_sdata(sdata);
457 check_sdata_in_driver(sdata); 470 check_sdata_in_driver(sdata);
458 471
459 trace_drv_sta_remove(local, sdata, sta); 472 trace_drv_sta_remove(local, sdata, sta);
@@ -547,6 +560,7 @@ static inline int drv_ampdu_action(struct ieee80211_local *local,
547 560
548 might_sleep(); 561 might_sleep();
549 562
563 sdata = get_bss_sdata(sdata);
550 check_sdata_in_driver(sdata); 564 check_sdata_in_driver(sdata);
551 565
552 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size); 566 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 2af4fca55337..6e9df8fd8fb8 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -5,17 +5,6 @@
5#include <net/mac80211.h> 5#include <net/mac80211.h>
6#include "ieee80211_i.h" 6#include "ieee80211_i.h"
7 7
8#if !defined(CONFIG_MAC80211_DRIVER_API_TRACER) || defined(__CHECKER__)
9#undef TRACE_EVENT
10#define TRACE_EVENT(name, proto, ...) \
11static inline void trace_ ## name(proto) {}
12#undef DECLARE_EVENT_CLASS
13#define DECLARE_EVENT_CLASS(...)
14#undef DEFINE_EVENT
15#define DEFINE_EVENT(evt_class, name, proto, ...) \
16static inline void trace_ ## name(proto) {}
17#endif
18
19#undef TRACE_SYSTEM 8#undef TRACE_SYSTEM
20#define TRACE_SYSTEM mac80211 9#define TRACE_SYSTEM mac80211
21 10
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index 810cfbea6ad1..d3eafaefb16b 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -28,9 +28,9 @@ bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata)
28 return false; 28 return false;
29} 29}
30 30
31void __check_htcap_disable(struct ieee80211_sub_if_data *sdata, 31static void __check_htcap_disable(struct ieee80211_sub_if_data *sdata,
32 struct ieee80211_sta_ht_cap *ht_cap, 32 struct ieee80211_sta_ht_cap *ht_cap,
33 u16 flag) 33 u16 flag)
34{ 34{
35 __le16 le_flag = cpu_to_le16(flag); 35 __le16 le_flag = cpu_to_le16(flag);
36 if (sdata->u.mgd.ht_capa_mask.cap_info & le_flag) { 36 if (sdata->u.mgd.ht_capa_mask.cap_info & le_flag) {
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 762243e469df..bdefa6ba3f4c 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -514,7 +514,9 @@ struct ieee80211_if_mesh {
514 atomic_t mpaths; 514 atomic_t mpaths;
515 /* Timestamp of last SN update */ 515 /* Timestamp of last SN update */
516 unsigned long last_sn_update; 516 unsigned long last_sn_update;
517 /* Timestamp of last SN sent */ 517 /* Time when it's ok to send next PERR */
518 unsigned long next_perr;
519 /* Timestamp of last PREQ sent */
518 unsigned long last_preq; 520 unsigned long last_preq;
519 struct mesh_rmc *rmc; 521 struct mesh_rmc *rmc;
520 spinlock_t mesh_preq_queue_lock; 522 spinlock_t mesh_preq_queue_lock;
@@ -611,6 +613,9 @@ struct ieee80211_sub_if_data {
611 struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; 613 struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
612 unsigned int fragment_next; 614 unsigned int fragment_next;
613 615
616 /* TID bitmap for NoAck policy */
617 u16 noack_map;
618
614 struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS]; 619 struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
615 struct ieee80211_key __rcu *default_unicast_key; 620 struct ieee80211_key __rcu *default_unicast_key;
616 struct ieee80211_key __rcu *default_multicast_key; 621 struct ieee80211_key __rcu *default_multicast_key;
@@ -961,7 +966,6 @@ struct ieee80211_local {
961 int total_ps_buffered; /* total number of all buffered unicast and 966 int total_ps_buffered; /* total number of all buffered unicast and
962 * multicast packets for power saving stations 967 * multicast packets for power saving stations
963 */ 968 */
964 int wifi_wme_noack_test;
965 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ 969 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
966 970
967 /* 971 /*
@@ -1216,13 +1220,11 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
1216void ieee80211_sched_scan_stopped_work(struct work_struct *work); 1220void ieee80211_sched_scan_stopped_work(struct work_struct *work);
1217 1221
1218/* off-channel helpers */ 1222/* off-channel helpers */
1219bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local);
1220void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local, 1223void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
1221 bool tell_ap); 1224 bool tell_ap);
1222void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, 1225void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
1223 bool offchannel_ps_enable); 1226 bool offchannel_ps_enable);
1224void ieee80211_offchannel_return(struct ieee80211_local *local, 1227void ieee80211_offchannel_return(struct ieee80211_local *local,
1225 bool enable_beaconing,
1226 bool offchannel_ps_disable); 1228 bool offchannel_ps_disable);
1227void ieee80211_hw_roc_setup(struct ieee80211_local *local); 1229void ieee80211_hw_roc_setup(struct ieee80211_local *local);
1228 1230
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index b34ca0cbdf6c..3d3bb5e9d8fa 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -672,7 +672,6 @@ static u16 ieee80211_monitor_select_queue(struct net_device *dev,
672 struct ieee80211_local *local = sdata->local; 672 struct ieee80211_local *local = sdata->local;
673 struct ieee80211_hdr *hdr; 673 struct ieee80211_hdr *hdr;
674 struct ieee80211_radiotap_header *rtap = (void *)skb->data; 674 struct ieee80211_radiotap_header *rtap = (void *)skb->data;
675 u8 *p;
676 675
677 if (local->hw.queues < 4) 676 if (local->hw.queues < 4)
678 return 0; 677 return 0;
@@ -683,19 +682,7 @@ static u16 ieee80211_monitor_select_queue(struct net_device *dev,
683 682
684 hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len)); 683 hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len));
685 684
686 if (!ieee80211_is_data(hdr->frame_control)) { 685 return ieee80211_select_queue_80211(local, skb, hdr);
687 skb->priority = 7;
688 return ieee802_1d_to_ac[skb->priority];
689 }
690 if (!ieee80211_is_data_qos(hdr->frame_control)) {
691 skb->priority = 0;
692 return ieee802_1d_to_ac[skb->priority];
693 }
694
695 p = ieee80211_get_qos_ctl(hdr);
696 skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK;
697
698 return ieee80211_downgrade_queue(local, skb);
699} 686}
700 687
701static const struct net_device_ops ieee80211_monitorif_ops = { 688static const struct net_device_ops ieee80211_monitorif_ops = {
@@ -866,6 +853,8 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
866 sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE); 853 sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE);
867 sdata->control_port_no_encrypt = false; 854 sdata->control_port_no_encrypt = false;
868 855
856 sdata->noack_map = 0;
857
869 /* only monitor differs */ 858 /* only monitor differs */
870 sdata->dev->type = ARPHRD_ETHER; 859 sdata->dev->type = ARPHRD_ETHER;
871 860
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index dddedfad5404..24cc50b963a9 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -92,47 +92,6 @@ static void ieee80211_reconfig_filter(struct work_struct *work)
92 ieee80211_configure_filter(local); 92 ieee80211_configure_filter(local);
93} 93}
94 94
95/*
96 * Returns true if we are logically configured to be on
97 * the operating channel AND the hardware-conf is currently
98 * configured on the operating channel. Compares channel-type
99 * as well.
100 */
101bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local)
102{
103 struct ieee80211_channel *chan;
104 enum nl80211_channel_type channel_type;
105
106 /* This logic needs to match logic in ieee80211_hw_config */
107 if (local->scan_channel) {
108 chan = local->scan_channel;
109 /* If scanning on oper channel, use whatever channel-type
110 * is currently in use.
111 */
112 if (chan == local->oper_channel)
113 channel_type = local->_oper_channel_type;
114 else
115 channel_type = NL80211_CHAN_NO_HT;
116 } else if (local->tmp_channel) {
117 chan = local->tmp_channel;
118 channel_type = local->tmp_channel_type;
119 } else {
120 chan = local->oper_channel;
121 channel_type = local->_oper_channel_type;
122 }
123
124 if (chan != local->oper_channel ||
125 channel_type != local->_oper_channel_type)
126 return false;
127
128 /* Check current hardware-config against oper_channel. */
129 if (local->oper_channel != local->hw.conf.channel ||
130 local->_oper_channel_type != local->hw.conf.channel_type)
131 return false;
132
133 return true;
134}
135
136int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) 95int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
137{ 96{
138 struct ieee80211_channel *chan; 97 struct ieee80211_channel *chan;
@@ -779,6 +738,12 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
779 if (!local->int_scan_req) 738 if (!local->int_scan_req)
780 return -ENOMEM; 739 return -ENOMEM;
781 740
741 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
742 if (!local->hw.wiphy->bands[band])
743 continue;
744 local->int_scan_req->rates[band] = (u32) -1;
745 }
746
782 /* if low-level driver supports AP, we also support VLAN */ 747 /* if low-level driver supports AP, we also support VLAN */
783 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { 748 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) {
784 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); 749 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index ee82d2f7f114..c707c8bf6d2c 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -749,6 +749,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
749 atomic_set(&ifmsh->mpaths, 0); 749 atomic_set(&ifmsh->mpaths, 0);
750 mesh_rmc_init(sdata); 750 mesh_rmc_init(sdata);
751 ifmsh->last_preq = jiffies; 751 ifmsh->last_preq = jiffies;
752 ifmsh->next_perr = jiffies;
752 /* Allocate all mesh structures when creating the first mesh interface. */ 753 /* Allocate all mesh structures when creating the first mesh interface. */
753 if (!mesh_allocated) 754 if (!mesh_allocated)
754 ieee80211s_init(); 755 ieee80211s_init();
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 622cc96eb4de..bd14bd26a2b6 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -233,6 +233,8 @@ void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh);
233/* Mesh paths */ 233/* Mesh paths */
234int mesh_nexthop_lookup(struct sk_buff *skb, 234int mesh_nexthop_lookup(struct sk_buff *skb,
235 struct ieee80211_sub_if_data *sdata); 235 struct ieee80211_sub_if_data *sdata);
236int mesh_nexthop_resolve(struct sk_buff *skb,
237 struct ieee80211_sub_if_data *sdata);
236void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata); 238void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata);
237struct mesh_path *mesh_path_lookup(u8 *dst, 239struct mesh_path *mesh_path_lookup(u8 *dst,
238 struct ieee80211_sub_if_data *sdata); 240 struct ieee80211_sub_if_data *sdata);
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index ce3db2735d7c..73abb7524b2c 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -241,11 +241,15 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn,
241{ 241{
242 struct ieee80211_local *local = sdata->local; 242 struct ieee80211_local *local = sdata->local;
243 struct sk_buff *skb; 243 struct sk_buff *skb;
244 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
244 struct ieee80211_mgmt *mgmt; 245 struct ieee80211_mgmt *mgmt;
245 u8 *pos, ie_len; 246 u8 *pos, ie_len;
246 int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.mesh_action) + 247 int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.mesh_action) +
247 sizeof(mgmt->u.action.u.mesh_action); 248 sizeof(mgmt->u.action.u.mesh_action);
248 249
250 if (time_before(jiffies, ifmsh->next_perr))
251 return -EAGAIN;
252
249 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 253 skb = dev_alloc_skb(local->hw.extra_tx_headroom +
250 hdr_len + 254 hdr_len +
251 2 + 15 /* PERR IE */); 255 2 + 15 /* PERR IE */);
@@ -290,6 +294,8 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn,
290 294
291 /* see note in function header */ 295 /* see note in function header */
292 prepare_frame_for_deferred_tx(sdata, skb); 296 prepare_frame_for_deferred_tx(sdata, skb);
297 ifmsh->next_perr = TU_TO_EXP_TIME(
298 ifmsh->mshcfg.dot11MeshHWMPperrMinInterval);
293 ieee80211_add_pending_skb(local, skb); 299 ieee80211_add_pending_skb(local, skb);
294 return 0; 300 return 0;
295} 301}
@@ -393,15 +399,13 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
393 orig_metric = PREQ_IE_METRIC(hwmp_ie); 399 orig_metric = PREQ_IE_METRIC(hwmp_ie);
394 break; 400 break;
395 case MPATH_PREP: 401 case MPATH_PREP:
396 /* Originator here refers to the MP that was the destination in 402 /* Originator here refers to the MP that was the target in the
397 * the Path Request. The draft refers to that MP as the 403 * Path Request. We divert from the nomenclature in the draft
398 * destination address, even though usually it is the origin of
399 * the PREP frame. We divert from the nomenclature in the draft
400 * so that we can easily use a single function to gather path 404 * so that we can easily use a single function to gather path
401 * information from both PREQ and PREP frames. 405 * information from both PREQ and PREP frames.
402 */ 406 */
403 orig_addr = PREP_IE_ORIG_ADDR(hwmp_ie); 407 orig_addr = PREP_IE_TARGET_ADDR(hwmp_ie);
404 orig_sn = PREP_IE_ORIG_SN(hwmp_ie); 408 orig_sn = PREP_IE_TARGET_SN(hwmp_ie);
405 orig_lifetime = PREP_IE_LIFETIME(hwmp_ie); 409 orig_lifetime = PREP_IE_LIFETIME(hwmp_ie);
406 orig_metric = PREP_IE_METRIC(hwmp_ie); 410 orig_metric = PREP_IE_METRIC(hwmp_ie);
407 break; 411 break;
@@ -562,9 +566,9 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
562 ttl = ifmsh->mshcfg.element_ttl; 566 ttl = ifmsh->mshcfg.element_ttl;
563 if (ttl != 0) { 567 if (ttl != 0) {
564 mhwmp_dbg("replying to the PREQ"); 568 mhwmp_dbg("replying to the PREQ");
565 mesh_path_sel_frame_tx(MPATH_PREP, 0, target_addr, 569 mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr,
566 cpu_to_le32(target_sn), 0, orig_addr, 570 cpu_to_le32(orig_sn), 0, target_addr,
567 cpu_to_le32(orig_sn), mgmt->sa, 0, ttl, 571 cpu_to_le32(target_sn), mgmt->sa, 0, ttl,
568 cpu_to_le32(lifetime), cpu_to_le32(metric), 572 cpu_to_le32(lifetime), cpu_to_le32(metric),
569 0, sdata); 573 0, sdata);
570 } else 574 } else
@@ -618,14 +622,8 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
618 622
619 mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem)); 623 mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem));
620 624
621 /* Note that we divert from the draft nomenclature and denominate 625 orig_addr = PREP_IE_ORIG_ADDR(prep_elem);
622 * destination to what the draft refers to as origininator. So in this 626 if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0)
623 * function destnation refers to the final destination of the PREP,
624 * which corresponds with the originator of the PREQ which this PREP
625 * replies
626 */
627 target_addr = PREP_IE_TARGET_ADDR(prep_elem);
628 if (memcmp(target_addr, sdata->vif.addr, ETH_ALEN) == 0)
629 /* destination, no forwarding required */ 627 /* destination, no forwarding required */
630 return; 628 return;
631 629
@@ -636,7 +634,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
636 } 634 }
637 635
638 rcu_read_lock(); 636 rcu_read_lock();
639 mpath = mesh_path_lookup(target_addr, sdata); 637 mpath = mesh_path_lookup(orig_addr, sdata);
640 if (mpath) 638 if (mpath)
641 spin_lock_bh(&mpath->state_lock); 639 spin_lock_bh(&mpath->state_lock);
642 else 640 else
@@ -651,7 +649,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
651 flags = PREP_IE_FLAGS(prep_elem); 649 flags = PREP_IE_FLAGS(prep_elem);
652 lifetime = PREP_IE_LIFETIME(prep_elem); 650 lifetime = PREP_IE_LIFETIME(prep_elem);
653 hopcount = PREP_IE_HOPCOUNT(prep_elem) + 1; 651 hopcount = PREP_IE_HOPCOUNT(prep_elem) + 1;
654 orig_addr = PREP_IE_ORIG_ADDR(prep_elem); 652 target_addr = PREP_IE_TARGET_ADDR(prep_elem);
655 target_sn = PREP_IE_TARGET_SN(prep_elem); 653 target_sn = PREP_IE_TARGET_SN(prep_elem);
656 orig_sn = PREP_IE_ORIG_SN(prep_elem); 654 orig_sn = PREP_IE_ORIG_SN(prep_elem);
657 655
@@ -984,71 +982,97 @@ enddiscovery:
984 kfree(preq_node); 982 kfree(preq_node);
985} 983}
986 984
987/** 985/* mesh_nexthop_resolve - lookup next hop for given skb and start path
988 * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame 986 * discovery if no forwarding information is found.
989 * 987 *
990 * @skb: 802.11 frame to be sent 988 * @skb: 802.11 frame to be sent
991 * @sdata: network subif the frame will be sent through 989 * @sdata: network subif the frame will be sent through
992 * 990 *
993 * Returns: 0 if the next hop was found. Nonzero otherwise. If no next hop is 991 * Returns: 0 if the next hop was found and -ENOENT if the frame was queued.
994 * found, the function will start a path discovery and queue the frame so it is 992 * skb is freeed here if no mpath could be allocated.
995 * sent when the path is resolved. This means the caller must not free the skb
996 * in this case.
997 */ 993 */
998int mesh_nexthop_lookup(struct sk_buff *skb, 994int mesh_nexthop_resolve(struct sk_buff *skb,
999 struct ieee80211_sub_if_data *sdata) 995 struct ieee80211_sub_if_data *sdata)
1000{ 996{
1001 struct sk_buff *skb_to_free = NULL;
1002 struct mesh_path *mpath;
1003 struct sta_info *next_hop;
1004 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 997 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
998 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
999 struct mesh_path *mpath;
1000 struct sk_buff *skb_to_free = NULL;
1005 u8 *target_addr = hdr->addr3; 1001 u8 *target_addr = hdr->addr3;
1006 int err = 0; 1002 int err = 0;
1007 1003
1008 rcu_read_lock(); 1004 rcu_read_lock();
1009 mpath = mesh_path_lookup(target_addr, sdata); 1005 err = mesh_nexthop_lookup(skb, sdata);
1006 if (!err)
1007 goto endlookup;
1010 1008
1009 /* no nexthop found, start resolving */
1010 mpath = mesh_path_lookup(target_addr, sdata);
1011 if (!mpath) { 1011 if (!mpath) {
1012 mesh_path_add(target_addr, sdata); 1012 mesh_path_add(target_addr, sdata);
1013 mpath = mesh_path_lookup(target_addr, sdata); 1013 mpath = mesh_path_lookup(target_addr, sdata);
1014 if (!mpath) { 1014 if (!mpath) {
1015 sdata->u.mesh.mshstats.dropped_frames_no_route++; 1015 mesh_path_discard_frame(skb, sdata);
1016 err = -ENOSPC; 1016 err = -ENOSPC;
1017 goto endlookup; 1017 goto endlookup;
1018 } 1018 }
1019 } 1019 }
1020 1020
1021 if (mpath->flags & MESH_PATH_ACTIVE) { 1021 if (!(mpath->flags & MESH_PATH_RESOLVING))
1022 if (time_after(jiffies, 1022 mesh_queue_preq(mpath, PREQ_Q_F_START);
1023 mpath->exp_time - 1023
1024 msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && 1024 if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN)
1025 !memcmp(sdata->vif.addr, hdr->addr4, ETH_ALEN) && 1025 skb_to_free = skb_dequeue(&mpath->frame_queue);
1026 !(mpath->flags & MESH_PATH_RESOLVING) &&
1027 !(mpath->flags & MESH_PATH_FIXED)) {
1028 mesh_queue_preq(mpath,
1029 PREQ_Q_F_START | PREQ_Q_F_REFRESH);
1030 }
1031 next_hop = rcu_dereference(mpath->next_hop);
1032 if (next_hop)
1033 memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN);
1034 else
1035 err = -ENOENT;
1036 } else {
1037 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1038 if (!(mpath->flags & MESH_PATH_RESOLVING)) {
1039 /* Start discovery only if it is not running yet */
1040 mesh_queue_preq(mpath, PREQ_Q_F_START);
1041 }
1042 1026
1043 if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN) 1027 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
1044 skb_to_free = skb_dequeue(&mpath->frame_queue); 1028 ieee80211_set_qos_hdr(sdata, skb);
1029 skb_queue_tail(&mpath->frame_queue, skb);
1030 err = -ENOENT;
1031 if (skb_to_free)
1032 mesh_path_discard_frame(skb_to_free, sdata);
1033
1034endlookup:
1035 rcu_read_unlock();
1036 return err;
1037}
1038/**
1039 * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame. Calling
1040 * this function is considered "using" the associated mpath, so preempt a path
1041 * refresh if this mpath expires soon.
1042 *
1043 * @skb: 802.11 frame to be sent
1044 * @sdata: network subif the frame will be sent through
1045 *
1046 * Returns: 0 if the next hop was found. Nonzero otherwise.
1047 */
1048int mesh_nexthop_lookup(struct sk_buff *skb,
1049 struct ieee80211_sub_if_data *sdata)
1050{
1051 struct mesh_path *mpath;
1052 struct sta_info *next_hop;
1053 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1054 u8 *target_addr = hdr->addr3;
1055 int err = -ENOENT;
1056
1057 rcu_read_lock();
1058 mpath = mesh_path_lookup(target_addr, sdata);
1059
1060 if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE))
1061 goto endlookup;
1062
1063 if (time_after(jiffies,
1064 mpath->exp_time -
1065 msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) &&
1066 !memcmp(sdata->vif.addr, hdr->addr4, ETH_ALEN) &&
1067 !(mpath->flags & MESH_PATH_RESOLVING) &&
1068 !(mpath->flags & MESH_PATH_FIXED))
1069 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
1045 1070
1046 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; 1071 next_hop = rcu_dereference(mpath->next_hop);
1047 ieee80211_set_qos_hdr(sdata, skb); 1072 if (next_hop) {
1048 skb_queue_tail(&mpath->frame_queue, skb); 1073 memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN);
1049 if (skb_to_free) 1074 memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
1050 mesh_path_discard_frame(skb_to_free, sdata); 1075 err = 0;
1051 err = -ENOENT;
1052 } 1076 }
1053 1077
1054endlookup: 1078endlookup:
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 7bd2a76aef0e..edf167e3b8f3 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -221,6 +221,7 @@ void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta)
221 while ((skb = __skb_dequeue(&mpath->frame_queue)) != NULL) { 221 while ((skb = __skb_dequeue(&mpath->frame_queue)) != NULL) {
222 hdr = (struct ieee80211_hdr *) skb->data; 222 hdr = (struct ieee80211_hdr *) skb->data;
223 memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN); 223 memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN);
224 memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN);
224 __skb_queue_tail(&tmpq, skb); 225 __skb_queue_tail(&tmpq, skb);
225 } 226 }
226 227
@@ -264,6 +265,7 @@ static void prepare_for_gate(struct sk_buff *skb, char *dst_addr,
264 next_hop = rcu_dereference(gate_mpath->next_hop)->sta.addr; 265 next_hop = rcu_dereference(gate_mpath->next_hop)->sta.addr;
265 memcpy(hdr->addr1, next_hop, ETH_ALEN); 266 memcpy(hdr->addr1, next_hop, ETH_ALEN);
266 rcu_read_unlock(); 267 rcu_read_unlock();
268 memcpy(hdr->addr2, gate_mpath->sdata->vif.addr, ETH_ALEN);
267 memcpy(hdr->addr3, dst_addr, ETH_ALEN); 269 memcpy(hdr->addr3, dst_addr, ETH_ALEN);
268} 270}
269 271
@@ -971,38 +973,11 @@ int mesh_path_send_to_gates(struct mesh_path *mpath)
971 * @skb: frame to discard 973 * @skb: frame to discard
972 * @sdata: network subif the frame was to be sent through 974 * @sdata: network subif the frame was to be sent through
973 * 975 *
974 * If the frame was being forwarded from another MP, a PERR frame will be sent
975 * to the precursor. The precursor's address (i.e. the previous hop) was saved
976 * in addr1 of the frame-to-be-forwarded, and would only be overwritten once
977 * the destination is successfully resolved.
978 *
979 * Locking: the function must me called within a rcu_read_lock region 976 * Locking: the function must me called within a rcu_read_lock region
980 */ 977 */
981void mesh_path_discard_frame(struct sk_buff *skb, 978void mesh_path_discard_frame(struct sk_buff *skb,
982 struct ieee80211_sub_if_data *sdata) 979 struct ieee80211_sub_if_data *sdata)
983{ 980{
984 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
985 struct mesh_path *mpath;
986 u32 sn = 0;
987 __le16 reason = cpu_to_le16(WLAN_REASON_MESH_PATH_NOFORWARD);
988
989 if (memcmp(hdr->addr4, sdata->vif.addr, ETH_ALEN) != 0) {
990 u8 *ra, *da;
991
992 da = hdr->addr3;
993 ra = hdr->addr1;
994 rcu_read_lock();
995 mpath = mesh_path_lookup(da, sdata);
996 if (mpath) {
997 spin_lock_bh(&mpath->state_lock);
998 sn = ++mpath->sn;
999 spin_unlock_bh(&mpath->state_lock);
1000 }
1001 rcu_read_unlock();
1002 mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl, skb->data,
1003 cpu_to_le32(sn), reason, ra, sdata);
1004 }
1005
1006 kfree_skb(skb); 981 kfree_skb(skb);
1007 sdata->u.mesh.mshstats.dropped_frames_no_route++; 982 sdata->u.mesh.mshstats.dropped_frames_no_route++;
1008} 983}
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index ebd8cccac8f2..e4330d843575 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -156,7 +156,6 @@ void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
156} 156}
157 157
158void ieee80211_offchannel_return(struct ieee80211_local *local, 158void ieee80211_offchannel_return(struct ieee80211_local *local,
159 bool enable_beaconing,
160 bool offchannel_ps_disable) 159 bool offchannel_ps_disable)
161{ 160{
162 struct ieee80211_sub_if_data *sdata; 161 struct ieee80211_sub_if_data *sdata;
@@ -188,11 +187,9 @@ void ieee80211_offchannel_return(struct ieee80211_local *local,
188 netif_tx_wake_all_queues(sdata->dev); 187 netif_tx_wake_all_queues(sdata->dev);
189 } 188 }
190 189
191 /* Check to see if we should re-enable beaconing */ 190 if (sdata->vif.type == NL80211_IFTYPE_AP ||
192 if (enable_beaconing && 191 sdata->vif.type == NL80211_IFTYPE_ADHOC ||
193 (sdata->vif.type == NL80211_IFTYPE_AP || 192 sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
194 sdata->vif.type == NL80211_IFTYPE_ADHOC ||
195 sdata->vif.type == NL80211_IFTYPE_MESH_POINT))
196 ieee80211_bss_info_change_notify( 193 ieee80211_bss_info_change_notify(
197 sdata, BSS_CHANGED_BEACON_ENABLED); 194 sdata, BSS_CHANGED_BEACON_ENABLED);
198 } 195 }
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index d1a8869fe05d..daf5cde65b30 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1895,13 +1895,16 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1895static ieee80211_rx_result 1895static ieee80211_rx_result
1896ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) 1896ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1897{ 1897{
1898 struct ieee80211_hdr *hdr; 1898 struct ieee80211_hdr *fwd_hdr, *hdr;
1899 struct ieee80211_tx_info *info;
1899 struct ieee80211s_hdr *mesh_hdr; 1900 struct ieee80211s_hdr *mesh_hdr;
1900 unsigned int hdrlen;
1901 struct sk_buff *skb = rx->skb, *fwd_skb; 1901 struct sk_buff *skb = rx->skb, *fwd_skb;
1902 struct ieee80211_local *local = rx->local; 1902 struct ieee80211_local *local = rx->local;
1903 struct ieee80211_sub_if_data *sdata = rx->sdata; 1903 struct ieee80211_sub_if_data *sdata = rx->sdata;
1904 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 1904 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
1905 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1906 __le16 reason = cpu_to_le16(WLAN_REASON_MESH_PATH_NOFORWARD);
1907 u16 q, hdrlen;
1905 1908
1906 hdr = (struct ieee80211_hdr *) skb->data; 1909 hdr = (struct ieee80211_hdr *) skb->data;
1907 hdrlen = ieee80211_hdrlen(hdr->frame_control); 1910 hdrlen = ieee80211_hdrlen(hdr->frame_control);
@@ -1917,14 +1920,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1917 return RX_CONTINUE; 1920 return RX_CONTINUE;
1918 1921
1919 if (!mesh_hdr->ttl) 1922 if (!mesh_hdr->ttl)
1920 /* illegal frame */
1921 return RX_DROP_MONITOR;
1922
1923 if (ieee80211_queue_stopped(&local->hw, skb_get_queue_mapping(skb))) {
1924 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh,
1925 dropped_frames_congestion);
1926 return RX_DROP_MONITOR; 1923 return RX_DROP_MONITOR;
1927 }
1928 1924
1929 if (mesh_hdr->flags & MESH_FLAGS_AE) { 1925 if (mesh_hdr->flags & MESH_FLAGS_AE) {
1930 struct mesh_path *mppath; 1926 struct mesh_path *mppath;
@@ -1957,59 +1953,50 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1957 compare_ether_addr(sdata->vif.addr, hdr->addr3) == 0) 1953 compare_ether_addr(sdata->vif.addr, hdr->addr3) == 0)
1958 return RX_CONTINUE; 1954 return RX_CONTINUE;
1959 1955
1960 skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb)); 1956 q = ieee80211_select_queue_80211(local, skb, hdr);
1961 mesh_hdr->ttl--; 1957 if (ieee80211_queue_stopped(&local->hw, q)) {
1958 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
1959 return RX_DROP_MONITOR;
1960 }
1961 skb_set_queue_mapping(skb, q);
1962 1962
1963 if (status->rx_flags & IEEE80211_RX_RA_MATCH) { 1963 if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
1964 if (!mesh_hdr->ttl) 1964 goto out;
1965 IEEE80211_IFSTA_MESH_CTR_INC(&rx->sdata->u.mesh, 1965
1966 dropped_frames_ttl); 1966 if (!--mesh_hdr->ttl) {
1967 else { 1967 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
1968 struct ieee80211_hdr *fwd_hdr; 1968 return RX_DROP_MONITOR;
1969 struct ieee80211_tx_info *info; 1969 }
1970 1970
1971 fwd_skb = skb_copy(skb, GFP_ATOMIC); 1971 fwd_skb = skb_copy(skb, GFP_ATOMIC);
1972 1972 if (!fwd_skb) {
1973 if (!fwd_skb && net_ratelimit()) 1973 if (net_ratelimit())
1974 printk(KERN_DEBUG "%s: failed to clone mesh frame\n", 1974 printk(KERN_DEBUG "%s: failed to clone mesh frame\n",
1975 sdata->name); 1975 sdata->name);
1976 if (!fwd_skb) 1976 goto out;
1977 goto out; 1977 }
1978 1978
1979 fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; 1979 fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data;
1980 memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); 1980 info = IEEE80211_SKB_CB(fwd_skb);
1981 info = IEEE80211_SKB_CB(fwd_skb); 1981 memset(info, 0, sizeof(*info));
1982 memset(info, 0, sizeof(*info)); 1982 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
1983 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; 1983 info->control.vif = &rx->sdata->vif;
1984 info->control.vif = &rx->sdata->vif; 1984 info->control.jiffies = jiffies;
1985 info->control.jiffies = jiffies; 1985 if (is_multicast_ether_addr(fwd_hdr->addr1)) {
1986 if (is_multicast_ether_addr(fwd_hdr->addr1)) { 1986 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast);
1987 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh, 1987 memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);
1988 fwded_mcast); 1988 } else if (!mesh_nexthop_lookup(fwd_skb, sdata)) {
1989 } else { 1989 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast);
1990 int err; 1990 } else {
1991 /* 1991 /* unable to resolve next hop */
1992 * Save TA to addr1 to send TA a path error if a 1992 mesh_path_error_tx(ifmsh->mshcfg.element_ttl, fwd_hdr->addr3,
1993 * suitable next hop is not found 1993 0, reason, fwd_hdr->addr2, sdata);
1994 */ 1994 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_no_route);
1995 memcpy(fwd_hdr->addr1, fwd_hdr->addr2, 1995 return RX_DROP_MONITOR;
1996 ETH_ALEN);
1997 err = mesh_nexthop_lookup(fwd_skb, sdata);
1998 /* Failed to immediately resolve next hop:
1999 * fwded frame was dropped or will be added
2000 * later to the pending skb queue. */
2001 if (err)
2002 return RX_DROP_MONITOR;
2003
2004 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh,
2005 fwded_unicast);
2006 }
2007 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh,
2008 fwded_frames);
2009 ieee80211_add_pending_skb(local, fwd_skb);
2010 }
2011 } 1996 }
2012 1997
1998 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames);
1999 ieee80211_add_pending_skb(local, fwd_skb);
2013 out: 2000 out:
2014 if (is_multicast_ether_addr(hdr->addr1) || 2001 if (is_multicast_ether_addr(hdr->addr1) ||
2015 sdata->dev->flags & IFF_PROMISC) 2002 sdata->dev->flags & IFF_PROMISC)
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 81863031e0a3..2c5041cc71f8 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -297,7 +297,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted,
297 if (!was_hw_scan) { 297 if (!was_hw_scan) {
298 ieee80211_configure_filter(local); 298 ieee80211_configure_filter(local);
299 drv_sw_scan_complete(local); 299 drv_sw_scan_complete(local);
300 ieee80211_offchannel_return(local, true, true); 300 ieee80211_offchannel_return(local, true);
301 } 301 }
302 302
303 ieee80211_recalc_idle(local); 303 ieee80211_recalc_idle(local);
@@ -602,7 +602,7 @@ static void ieee80211_scan_state_suspend(struct ieee80211_local *local,
602 * in off-channel state..will put that back 602 * in off-channel state..will put that back
603 * on-channel at the end of scanning. 603 * on-channel at the end of scanning.
604 */ 604 */
605 ieee80211_offchannel_return(local, true, false); 605 ieee80211_offchannel_return(local, false);
606 606
607 *next_delay = HZ / 5; 607 *next_delay = HZ / 5;
608 /* afterwards, resume scan & go to next channel */ 608 /* afterwards, resume scan & go to next channel */
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 8eaa746ec7a2..f98235262006 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -351,10 +351,6 @@ static int sta_info_finish_insert(struct sta_info *sta,
351 351
352 if (!sta->dummy || dummy_reinsert) { 352 if (!sta->dummy || dummy_reinsert) {
353 /* notify driver */ 353 /* notify driver */
354 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
355 sdata = container_of(sdata->bss,
356 struct ieee80211_sub_if_data,
357 u.ap);
358 err = drv_sta_add(local, sdata, &sta->sta); 354 err = drv_sta_add(local, sdata, &sta->sta);
359 if (err) { 355 if (err) {
360 if (!async) 356 if (!async)
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 6280e8bca49d..1a14fab4bc9a 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -88,6 +88,7 @@ enum ieee80211_sta_info_flags {
88 * struct tid_ampdu_tx - TID aggregation information (Tx). 88 * struct tid_ampdu_tx - TID aggregation information (Tx).
89 * 89 *
90 * @rcu_head: rcu head for freeing structure 90 * @rcu_head: rcu head for freeing structure
91 * @session_timer: check if we keep Tx-ing on the TID (by timeout value)
91 * @addba_resp_timer: timer for peer's response to addba request 92 * @addba_resp_timer: timer for peer's response to addba request
92 * @pending: pending frames queue -- use sta's spinlock to protect 93 * @pending: pending frames queue -- use sta's spinlock to protect
93 * @dialog_token: dialog token for aggregation session 94 * @dialog_token: dialog token for aggregation session
@@ -110,6 +111,7 @@ enum ieee80211_sta_info_flags {
110 */ 111 */
111struct tid_ampdu_tx { 112struct tid_ampdu_tx {
112 struct rcu_head rcu_head; 113 struct rcu_head rcu_head;
114 struct timer_list session_timer;
113 struct timer_list addba_resp_timer; 115 struct timer_list addba_resp_timer;
114 struct sk_buff_head pending; 116 struct sk_buff_head pending;
115 unsigned long state; 117 unsigned long state;
@@ -497,7 +499,6 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
497 */ 499 */
498int sta_info_insert(struct sta_info *sta); 500int sta_info_insert(struct sta_info *sta);
499int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU); 501int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU);
500int sta_info_insert_atomic(struct sta_info *sta);
501int sta_info_reinsert(struct sta_info *sta); 502int sta_info_reinsert(struct sta_info *sta);
502 503
503int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, 504int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 8d31933abe6a..c4cb4a536e27 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -151,11 +151,15 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
151 rate = mrate; 151 rate = mrate;
152 } 152 }
153 153
154 /* Time needed to transmit ACK 154 /* Don't calculate ACKs for QoS Frames with NoAck Policy set */
155 * (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up 155 if (ieee80211_is_data_qos(hdr->frame_control) &&
156 * to closest integer */ 156 *(ieee80211_get_qos_ctl(hdr)) | IEEE80211_QOS_CTL_ACK_POLICY_NOACK)
157 157 dur = 0;
158 dur = ieee80211_frame_duration(local, 10, rate, erp, 158 else
159 /* Time needed to transmit ACK
160 * (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up
161 * to closest integer */
162 dur = ieee80211_frame_duration(local, 10, rate, erp,
159 tx->sdata->vif.bss_conf.use_short_preamble); 163 tx->sdata->vif.bss_conf.use_short_preamble);
160 164
161 if (next_frag_len) { 165 if (next_frag_len) {
@@ -636,6 +640,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
636 else 640 else
637 txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; 641 txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1;
638 txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP || 642 txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP ||
643 tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
639 tx->sdata->vif.type == NL80211_IFTYPE_ADHOC); 644 tx->sdata->vif.type == NL80211_IFTYPE_ADHOC);
640 645
641 /* set up RTS protection if desired */ 646 /* set up RTS protection if desired */
@@ -1063,9 +1068,11 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
1063 int tid) 1068 int tid)
1064{ 1069{
1065 bool queued = false; 1070 bool queued = false;
1071 bool reset_agg_timer = false;
1066 1072
1067 if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) { 1073 if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
1068 info->flags |= IEEE80211_TX_CTL_AMPDU; 1074 info->flags |= IEEE80211_TX_CTL_AMPDU;
1075 reset_agg_timer = true;
1069 } else if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { 1076 } else if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) {
1070 /* 1077 /*
1071 * nothing -- this aggregation session is being started 1078 * nothing -- this aggregation session is being started
@@ -1097,6 +1104,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
1097 /* do nothing, let packet pass through */ 1104 /* do nothing, let packet pass through */
1098 } else if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) { 1105 } else if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
1099 info->flags |= IEEE80211_TX_CTL_AMPDU; 1106 info->flags |= IEEE80211_TX_CTL_AMPDU;
1107 reset_agg_timer = true;
1100 } else { 1108 } else {
1101 queued = true; 1109 queued = true;
1102 info->control.vif = &tx->sdata->vif; 1110 info->control.vif = &tx->sdata->vif;
@@ -1106,6 +1114,11 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
1106 spin_unlock(&tx->sta->lock); 1114 spin_unlock(&tx->sta->lock);
1107 } 1115 }
1108 1116
1117 /* reset session timer */
1118 if (reset_agg_timer && tid_tx->timeout)
1119 mod_timer(&tid_tx->session_timer,
1120 TU_TO_EXP_TIME(tid_tx->timeout));
1121
1109 return queued; 1122 return queued;
1110} 1123}
1111 1124
@@ -1173,16 +1186,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
1173 if (is_multicast_ether_addr(hdr->addr1)) { 1186 if (is_multicast_ether_addr(hdr->addr1)) {
1174 tx->flags &= ~IEEE80211_TX_UNICAST; 1187 tx->flags &= ~IEEE80211_TX_UNICAST;
1175 info->flags |= IEEE80211_TX_CTL_NO_ACK; 1188 info->flags |= IEEE80211_TX_CTL_NO_ACK;
1176 } else { 1189 } else
1177 tx->flags |= IEEE80211_TX_UNICAST; 1190 tx->flags |= IEEE80211_TX_UNICAST;
1178 if (unlikely(local->wifi_wme_noack_test))
1179 info->flags |= IEEE80211_TX_CTL_NO_ACK;
1180 /*
1181 * Flags are initialized to 0. Hence, no need to
1182 * explicitly unset IEEE80211_TX_CTL_NO_ACK since
1183 * it might already be set for injected frames.
1184 */
1185 }
1186 1191
1187 if (!(info->flags & IEEE80211_TX_CTL_DONTFRAG)) { 1192 if (!(info->flags & IEEE80211_TX_CTL_DONTFRAG)) {
1188 if (!(tx->flags & IEEE80211_TX_UNICAST) || 1193 if (!(tx->flags & IEEE80211_TX_UNICAST) ||
@@ -1223,9 +1228,10 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local,
1223 * queue is woken again. 1228 * queue is woken again.
1224 */ 1229 */
1225 if (txpending) 1230 if (txpending)
1226 skb_queue_splice(skbs, &local->pending[q]); 1231 skb_queue_splice_init(skbs, &local->pending[q]);
1227 else 1232 else
1228 skb_queue_splice_tail(skbs, &local->pending[q]); 1233 skb_queue_splice_tail_init(skbs,
1234 &local->pending[q]);
1229 1235
1230 spin_unlock_irqrestore(&local->queue_stop_reason_lock, 1236 spin_unlock_irqrestore(&local->queue_stop_reason_lock,
1231 flags); 1237 flags);
@@ -1297,7 +1303,7 @@ static bool __ieee80211_tx(struct ieee80211_local *local,
1297 ieee80211_tpt_led_trig_tx(local, fc, led_len); 1303 ieee80211_tpt_led_trig_tx(local, fc, led_len);
1298 ieee80211_led_tx(local, 1); 1304 ieee80211_led_tx(local, 1);
1299 1305
1300 WARN_ON(!skb_queue_empty(skbs)); 1306 WARN_ON_ONCE(!skb_queue_empty(skbs));
1301 1307
1302 return result; 1308 return result;
1303} 1309}
@@ -1458,7 +1464,7 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
1458 if (ieee80211_vif_is_mesh(&sdata->vif) && 1464 if (ieee80211_vif_is_mesh(&sdata->vif) &&
1459 ieee80211_is_data(hdr->frame_control) && 1465 ieee80211_is_data(hdr->frame_control) &&
1460 !is_multicast_ether_addr(hdr->addr1)) 1466 !is_multicast_ether_addr(hdr->addr1))
1461 if (mesh_nexthop_lookup(skb, sdata)) { 1467 if (mesh_nexthop_resolve(skb, sdata)) {
1462 /* skb queued: don't free */ 1468 /* skb queued: don't free */
1463 rcu_read_unlock(); 1469 rcu_read_unlock();
1464 return; 1470 return;
@@ -2260,10 +2266,10 @@ static void ieee80211_beacon_add_tim(struct ieee80211_if_ap *bss,
2260 /* Bitmap control */ 2266 /* Bitmap control */
2261 *pos++ = n1 | aid0; 2267 *pos++ = n1 | aid0;
2262 /* Part Virt Bitmap */ 2268 /* Part Virt Bitmap */
2269 skb_put(skb, n2 - n1);
2263 memcpy(pos, bss->tim + n1, n2 - n1 + 1); 2270 memcpy(pos, bss->tim + n1, n2 - n1 + 1);
2264 2271
2265 tim[1] = n2 - n1 + 4; 2272 tim[1] = n2 - n1 + 4;
2266 skb_put(skb, n2 - n1);
2267 } else { 2273 } else {
2268 *pos++ = aid0; /* Bitmap control */ 2274 *pos++ = aid0; /* Bitmap control */
2269 *pos++ = 0; /* Part Virt Bitmap */ 2275 *pos++ = 0; /* Part Virt Bitmap */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 3b9b492e9403..5243c2cadeef 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1192,7 +1192,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1192 struct ieee80211_sub_if_data, 1192 struct ieee80211_sub_if_data,
1193 u.ap); 1193 u.ap);
1194 1194
1195 memset(&sta->sta.drv_priv, 0, hw->sta_data_size);
1196 WARN_ON(drv_sta_add(local, sdata, &sta->sta)); 1195 WARN_ON(drv_sta_add(local, sdata, &sta->sta));
1197 } 1196 }
1198 } 1197 }
@@ -1244,8 +1243,11 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1244 changed |= BSS_CHANGED_IBSS; 1243 changed |= BSS_CHANGED_IBSS;
1245 /* fall through */ 1244 /* fall through */
1246 case NL80211_IFTYPE_AP: 1245 case NL80211_IFTYPE_AP:
1247 changed |= BSS_CHANGED_SSID | 1246 changed |= BSS_CHANGED_SSID;
1248 BSS_CHANGED_AP_PROBE_RESP; 1247
1248 if (sdata->vif.type == NL80211_IFTYPE_AP)
1249 changed |= BSS_CHANGED_AP_PROBE_RESP;
1250
1249 /* fall through */ 1251 /* fall through */
1250 case NL80211_IFTYPE_MESH_POINT: 1252 case NL80211_IFTYPE_MESH_POINT:
1251 changed |= BSS_CHANGED_BEACON | 1253 changed |= BSS_CHANGED_BEACON |
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 43327115b490..89511be3111e 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -52,6 +52,30 @@ static int wme_downgrade_ac(struct sk_buff *skb)
52 } 52 }
53} 53}
54 54
55/* Indicate which queue to use for this fully formed 802.11 frame */
56u16 ieee80211_select_queue_80211(struct ieee80211_local *local,
57 struct sk_buff *skb,
58 struct ieee80211_hdr *hdr)
59{
60 u8 *p;
61
62 if (local->hw.queues < 4)
63 return 0;
64
65 if (!ieee80211_is_data(hdr->frame_control)) {
66 skb->priority = 7;
67 return ieee802_1d_to_ac[skb->priority];
68 }
69 if (!ieee80211_is_data_qos(hdr->frame_control)) {
70 skb->priority = 0;
71 return ieee802_1d_to_ac[skb->priority];
72 }
73
74 p = ieee80211_get_qos_ctl(hdr);
75 skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK;
76
77 return ieee80211_downgrade_queue(local, skb);
78}
55 79
56/* Indicate which queue to use. */ 80/* Indicate which queue to use. */
57u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, 81u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
@@ -139,6 +163,7 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
139 struct sk_buff *skb) 163 struct sk_buff *skb)
140{ 164{
141 struct ieee80211_hdr *hdr = (void *)skb->data; 165 struct ieee80211_hdr *hdr = (void *)skb->data;
166 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
142 167
143 /* Fill in the QoS header if there is one. */ 168 /* Fill in the QoS header if there is one. */
144 if (ieee80211_is_data_qos(hdr->frame_control)) { 169 if (ieee80211_is_data_qos(hdr->frame_control)) {
@@ -150,9 +175,12 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
150 /* preserve EOSP bit */ 175 /* preserve EOSP bit */
151 ack_policy = *p & IEEE80211_QOS_CTL_EOSP; 176 ack_policy = *p & IEEE80211_QOS_CTL_EOSP;
152 177
153 if (unlikely(sdata->local->wifi_wme_noack_test) || 178 if (is_multicast_ether_addr(hdr->addr1) ||
154 is_multicast_ether_addr(hdr->addr1)) 179 sdata->noack_map & BIT(tid)) {
155 ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK; 180 ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;
181 info->flags |= IEEE80211_TX_CTL_NO_ACK;
182 }
183
156 /* qos header is 2 bytes */ 184 /* qos header is 2 bytes */
157 *p++ = ack_policy | tid; 185 *p++ = ack_policy | tid;
158 *p = ieee80211_vif_is_mesh(&sdata->vif) ? 186 *p = ieee80211_vif_is_mesh(&sdata->vif) ?
diff --git a/net/mac80211/wme.h b/net/mac80211/wme.h
index 34e166fbf4d4..94edceb617ff 100644
--- a/net/mac80211/wme.h
+++ b/net/mac80211/wme.h
@@ -15,6 +15,9 @@
15 15
16extern const int ieee802_1d_to_ac[8]; 16extern const int ieee802_1d_to_ac[8];
17 17
18u16 ieee80211_select_queue_80211(struct ieee80211_local *local,
19 struct sk_buff *skb,
20 struct ieee80211_hdr *hdr);
18u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, 21u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
19 struct sk_buff *skb); 22 struct sk_buff *skb);
20void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, 23void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/work.c b/net/mac80211/work.c
index 6884a2d986dc..c6dd01a05291 100644
--- a/net/mac80211/work.c
+++ b/net/mac80211/work.c
@@ -862,44 +862,6 @@ static void ieee80211_work_rx_queued_mgmt(struct ieee80211_local *local,
862 kfree_skb(skb); 862 kfree_skb(skb);
863} 863}
864 864
865static bool ieee80211_work_ct_coexists(enum nl80211_channel_type wk_ct,
866 enum nl80211_channel_type oper_ct)
867{
868 switch (wk_ct) {
869 case NL80211_CHAN_NO_HT:
870 return true;
871 case NL80211_CHAN_HT20:
872 if (oper_ct != NL80211_CHAN_NO_HT)
873 return true;
874 return false;
875 case NL80211_CHAN_HT40MINUS:
876 case NL80211_CHAN_HT40PLUS:
877 return (wk_ct == oper_ct);
878 }
879 WARN_ON(1); /* shouldn't get here */
880 return false;
881}
882
883static enum nl80211_channel_type
884ieee80211_calc_ct(enum nl80211_channel_type wk_ct,
885 enum nl80211_channel_type oper_ct)
886{
887 switch (wk_ct) {
888 case NL80211_CHAN_NO_HT:
889 return oper_ct;
890 case NL80211_CHAN_HT20:
891 if (oper_ct != NL80211_CHAN_NO_HT)
892 return oper_ct;
893 return wk_ct;
894 case NL80211_CHAN_HT40MINUS:
895 case NL80211_CHAN_HT40PLUS:
896 return wk_ct;
897 }
898 WARN_ON(1); /* shouldn't get here */
899 return wk_ct;
900}
901
902
903static void ieee80211_work_timer(unsigned long data) 865static void ieee80211_work_timer(unsigned long data)
904{ 866{
905 struct ieee80211_local *local = (void *) data; 867 struct ieee80211_local *local = (void *) data;
@@ -950,40 +912,12 @@ static void ieee80211_work_work(struct work_struct *work)
950 } 912 }
951 913
952 if (!started && !local->tmp_channel) { 914 if (!started && !local->tmp_channel) {
953 bool on_oper_chan, on_oper_chan2; 915 ieee80211_offchannel_stop_vifs(local, true);
954 enum nl80211_channel_type wk_ct;
955
956 on_oper_chan = ieee80211_cfg_on_oper_channel(local);
957
958 /* Work with existing channel type if possible. */
959 wk_ct = wk->chan_type;
960 if (wk->chan == local->hw.conf.channel)
961 wk_ct = ieee80211_calc_ct(wk->chan_type,
962 local->hw.conf.channel_type);
963 916
964 local->tmp_channel = wk->chan; 917 local->tmp_channel = wk->chan;
965 local->tmp_channel_type = wk_ct; 918 local->tmp_channel_type = wk->chan_type;
966 /* 919
967 * Leave the station vifs in awake mode if they 920 ieee80211_hw_config(local, 0);
968 * happen to be on the same channel as
969 * the requested channel.
970 */
971 on_oper_chan2 = ieee80211_cfg_on_oper_channel(local);
972 if (on_oper_chan != on_oper_chan2) {
973 if (on_oper_chan2) {
974 /* going off oper channel, PS too */
975 ieee80211_offchannel_stop_vifs(local,
976 true);
977 ieee80211_hw_config(local, 0);
978 } else {
979 /* going on channel, but leave PS
980 * off-channel. */
981 ieee80211_hw_config(local, 0);
982 ieee80211_offchannel_return(local,
983 true,
984 false);
985 }
986 }
987 921
988 started = true; 922 started = true;
989 wk->timeout = jiffies; 923 wk->timeout = jiffies;
@@ -1052,34 +986,17 @@ static void ieee80211_work_work(struct work_struct *work)
1052 list_for_each_entry(wk, &local->work_list, list) { 986 list_for_each_entry(wk, &local->work_list, list) {
1053 if (!wk->started) 987 if (!wk->started)
1054 continue; 988 continue;
1055 if (wk->chan != local->tmp_channel) 989 if (wk->chan != local->tmp_channel ||
1056 continue; 990 wk->chan_type != local->tmp_channel_type)
1057 if (!ieee80211_work_ct_coexists(wk->chan_type,
1058 local->tmp_channel_type))
1059 continue; 991 continue;
1060 remain_off_channel = true; 992 remain_off_channel = true;
1061 } 993 }
1062 994
1063 if (!remain_off_channel && local->tmp_channel) { 995 if (!remain_off_channel && local->tmp_channel) {
1064 local->tmp_channel = NULL; 996 local->tmp_channel = NULL;
1065 /* If tmp_channel wasn't operating channel, then 997 ieee80211_hw_config(local, 0);
1066 * we need to go back on-channel.
1067 * NOTE: If we can ever be here while scannning,
1068 * or if the hw_config() channel config logic changes,
1069 * then we may need to do a more thorough check to see if
1070 * we still need to do a hardware config. Currently,
1071 * we cannot be here while scanning, however.
1072 */
1073 if (!ieee80211_cfg_on_oper_channel(local))
1074 ieee80211_hw_config(local, 0);
1075 998
1076 /* At the least, we need to disable offchannel_ps, 999 ieee80211_offchannel_return(local, true);
1077 * so just go ahead and run the entire offchannel
1078 * return logic here. We *could* skip enabling
1079 * beaconing if we were already on-oper-channel
1080 * as a future optimization.
1081 */
1082 ieee80211_offchannel_return(local, true, true);
1083 1000
1084 /* give connection some time to breathe */ 1001 /* give connection some time to breathe */
1085 run_again(local, jiffies + HZ/2); 1002 run_again(local, jiffies + HZ/2);
diff --git a/net/nfc/core.c b/net/nfc/core.c
index 47e02c1b8c02..3ebc6b3aabac 100644
--- a/net/nfc/core.c
+++ b/net/nfc/core.c
@@ -21,6 +21,8 @@
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 22 */
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <linux/init.h> 26#include <linux/init.h>
25#include <linux/kernel.h> 27#include <linux/kernel.h>
26#include <linux/module.h> 28#include <linux/module.h>
@@ -33,25 +35,6 @@
33int nfc_devlist_generation; 35int nfc_devlist_generation;
34DEFINE_MUTEX(nfc_devlist_mutex); 36DEFINE_MUTEX(nfc_devlist_mutex);
35 37
36int nfc_printk(const char *level, const char *format, ...)
37{
38 struct va_format vaf;
39 va_list args;
40 int r;
41
42 va_start(args, format);
43
44 vaf.fmt = format;
45 vaf.va = &args;
46
47 r = printk("%sNFC: %pV\n", level, &vaf);
48
49 va_end(args);
50
51 return r;
52}
53EXPORT_SYMBOL(nfc_printk);
54
55/** 38/**
56 * nfc_dev_up - turn on the NFC device 39 * nfc_dev_up - turn on the NFC device
57 * 40 *
@@ -63,7 +46,7 @@ int nfc_dev_up(struct nfc_dev *dev)
63{ 46{
64 int rc = 0; 47 int rc = 0;
65 48
66 nfc_dbg("dev_name=%s", dev_name(&dev->dev)); 49 pr_debug("dev_name=%s\n", dev_name(&dev->dev));
67 50
68 device_lock(&dev->dev); 51 device_lock(&dev->dev);
69 52
@@ -97,7 +80,7 @@ int nfc_dev_down(struct nfc_dev *dev)
97{ 80{
98 int rc = 0; 81 int rc = 0;
99 82
100 nfc_dbg("dev_name=%s", dev_name(&dev->dev)); 83 pr_debug("dev_name=%s\n", dev_name(&dev->dev));
101 84
102 device_lock(&dev->dev); 85 device_lock(&dev->dev);
103 86
@@ -139,7 +122,8 @@ int nfc_start_poll(struct nfc_dev *dev, u32 protocols)
139{ 122{
140 int rc; 123 int rc;
141 124
142 nfc_dbg("dev_name=%s protocols=0x%x", dev_name(&dev->dev), protocols); 125 pr_debug("dev_name=%s protocols=0x%x\n",
126 dev_name(&dev->dev), protocols);
143 127
144 if (!protocols) 128 if (!protocols)
145 return -EINVAL; 129 return -EINVAL;
@@ -174,7 +158,7 @@ int nfc_stop_poll(struct nfc_dev *dev)
174{ 158{
175 int rc = 0; 159 int rc = 0;
176 160
177 nfc_dbg("dev_name=%s", dev_name(&dev->dev)); 161 pr_debug("dev_name=%s\n", dev_name(&dev->dev));
178 162
179 device_lock(&dev->dev); 163 device_lock(&dev->dev);
180 164
@@ -207,8 +191,8 @@ int nfc_activate_target(struct nfc_dev *dev, u32 target_idx, u32 protocol)
207{ 191{
208 int rc; 192 int rc;
209 193
210 nfc_dbg("dev_name=%s target_idx=%u protocol=%u", dev_name(&dev->dev), 194 pr_debug("dev_name=%s target_idx=%u protocol=%u\n",
211 target_idx, protocol); 195 dev_name(&dev->dev), target_idx, protocol);
212 196
213 device_lock(&dev->dev); 197 device_lock(&dev->dev);
214 198
@@ -236,7 +220,8 @@ int nfc_deactivate_target(struct nfc_dev *dev, u32 target_idx)
236{ 220{
237 int rc = 0; 221 int rc = 0;
238 222
239 nfc_dbg("dev_name=%s target_idx=%u", dev_name(&dev->dev), target_idx); 223 pr_debug("dev_name=%s target_idx=%u\n",
224 dev_name(&dev->dev), target_idx);
240 225
241 device_lock(&dev->dev); 226 device_lock(&dev->dev);
242 227
@@ -271,8 +256,8 @@ int nfc_data_exchange(struct nfc_dev *dev, u32 target_idx,
271{ 256{
272 int rc; 257 int rc;
273 258
274 nfc_dbg("dev_name=%s target_idx=%u skb->len=%u", dev_name(&dev->dev), 259 pr_debug("dev_name=%s target_idx=%u skb->len=%u\n",
275 target_idx, skb->len); 260 dev_name(&dev->dev), target_idx, skb->len);
276 261
277 device_lock(&dev->dev); 262 device_lock(&dev->dev);
278 263
@@ -326,7 +311,7 @@ int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets,
326{ 311{
327 int i; 312 int i;
328 313
329 nfc_dbg("dev_name=%s n_targets=%d", dev_name(&dev->dev), n_targets); 314 pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets);
330 315
331 dev->polling = false; 316 dev->polling = false;
332 317
@@ -360,7 +345,7 @@ static void nfc_release(struct device *d)
360{ 345{
361 struct nfc_dev *dev = to_nfc_dev(d); 346 struct nfc_dev *dev = to_nfc_dev(d);
362 347
363 nfc_dbg("dev_name=%s", dev_name(&dev->dev)); 348 pr_debug("dev_name=%s\n", dev_name(&dev->dev));
364 349
365 nfc_genl_data_exit(&dev->genl_data); 350 nfc_genl_data_exit(&dev->genl_data);
366 kfree(dev->targets); 351 kfree(dev->targets);
@@ -446,7 +431,7 @@ int nfc_register_device(struct nfc_dev *dev)
446{ 431{
447 int rc; 432 int rc;
448 433
449 nfc_dbg("dev_name=%s", dev_name(&dev->dev)); 434 pr_debug("dev_name=%s\n", dev_name(&dev->dev));
450 435
451 mutex_lock(&nfc_devlist_mutex); 436 mutex_lock(&nfc_devlist_mutex);
452 nfc_devlist_generation++; 437 nfc_devlist_generation++;
@@ -458,9 +443,8 @@ int nfc_register_device(struct nfc_dev *dev)
458 443
459 rc = nfc_genl_device_added(dev); 444 rc = nfc_genl_device_added(dev);
460 if (rc) 445 if (rc)
461 nfc_dbg("The userspace won't be notified that the device %s was" 446 pr_debug("The userspace won't be notified that the device %s was added\n",
462 " added", dev_name(&dev->dev)); 447 dev_name(&dev->dev));
463
464 448
465 return 0; 449 return 0;
466} 450}
@@ -475,7 +459,7 @@ void nfc_unregister_device(struct nfc_dev *dev)
475{ 459{
476 int rc; 460 int rc;
477 461
478 nfc_dbg("dev_name=%s", dev_name(&dev->dev)); 462 pr_debug("dev_name=%s\n", dev_name(&dev->dev));
479 463
480 mutex_lock(&nfc_devlist_mutex); 464 mutex_lock(&nfc_devlist_mutex);
481 nfc_devlist_generation++; 465 nfc_devlist_generation++;
@@ -490,8 +474,8 @@ void nfc_unregister_device(struct nfc_dev *dev)
490 474
491 rc = nfc_genl_device_removed(dev); 475 rc = nfc_genl_device_removed(dev);
492 if (rc) 476 if (rc)
493 nfc_dbg("The userspace won't be notified that the device %s" 477 pr_debug("The userspace won't be notified that the device %s was removed\n",
494 " was removed", dev_name(&dev->dev)); 478 dev_name(&dev->dev));
495 479
496} 480}
497EXPORT_SYMBOL(nfc_unregister_device); 481EXPORT_SYMBOL(nfc_unregister_device);
@@ -500,7 +484,7 @@ static int __init nfc_init(void)
500{ 484{
501 int rc; 485 int rc;
502 486
503 nfc_info("NFC Core ver %s", VERSION); 487 pr_info("NFC Core ver %s\n", VERSION);
504 488
505 rc = class_register(&nfc_class); 489 rc = class_register(&nfc_class);
506 if (rc) 490 if (rc)
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index fe5ca89abfce..37de28e97330 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -25,6 +25,8 @@
25 * 25 *
26 */ 26 */
27 27
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
28#include <linux/types.h> 30#include <linux/types.h>
29#include <linux/workqueue.h> 31#include <linux/workqueue.h>
30#include <linux/completion.h> 32#include <linux/completion.h>
@@ -79,7 +81,7 @@ static int __nci_request(struct nci_dev *ndev,
79 &ndev->req_completion, 81 &ndev->req_completion,
80 timeout); 82 timeout);
81 83
82 nfc_dbg("wait_for_completion return %ld", completion_rc); 84 pr_debug("wait_for_completion return %ld\n", completion_rc);
83 85
84 if (completion_rc > 0) { 86 if (completion_rc > 0) {
85 switch (ndev->req_status) { 87 switch (ndev->req_status) {
@@ -96,8 +98,8 @@ static int __nci_request(struct nci_dev *ndev,
96 break; 98 break;
97 } 99 }
98 } else { 100 } else {
99 nfc_err("wait_for_completion_interruptible_timeout failed %ld", 101 pr_err("wait_for_completion_interruptible_timeout failed %ld\n",
100 completion_rc); 102 completion_rc);
101 103
102 rc = ((completion_rc == 0) ? (-ETIMEDOUT) : (completion_rc)); 104 rc = ((completion_rc == 0) ? (-ETIMEDOUT) : (completion_rc));
103 } 105 }
@@ -323,8 +325,6 @@ static void nci_cmd_timer(unsigned long arg)
323{ 325{
324 struct nci_dev *ndev = (void *) arg; 326 struct nci_dev *ndev = (void *) arg;
325 327
326 nfc_dbg("entry");
327
328 atomic_set(&ndev->cmd_cnt, 1); 328 atomic_set(&ndev->cmd_cnt, 1);
329 queue_work(ndev->cmd_wq, &ndev->cmd_work); 329 queue_work(ndev->cmd_wq, &ndev->cmd_work);
330} 330}
@@ -333,8 +333,6 @@ static int nci_dev_up(struct nfc_dev *nfc_dev)
333{ 333{
334 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); 334 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
335 335
336 nfc_dbg("entry");
337
338 return nci_open_device(ndev); 336 return nci_open_device(ndev);
339} 337}
340 338
@@ -342,8 +340,6 @@ static int nci_dev_down(struct nfc_dev *nfc_dev)
342{ 340{
343 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); 341 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
344 342
345 nfc_dbg("entry");
346
347 return nci_close_device(ndev); 343 return nci_close_device(ndev);
348} 344}
349 345
@@ -352,20 +348,18 @@ static int nci_start_poll(struct nfc_dev *nfc_dev, __u32 protocols)
352 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); 348 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
353 int rc; 349 int rc;
354 350
355 nfc_dbg("entry");
356
357 if (test_bit(NCI_DISCOVERY, &ndev->flags)) { 351 if (test_bit(NCI_DISCOVERY, &ndev->flags)) {
358 nfc_err("unable to start poll, since poll is already active"); 352 pr_err("unable to start poll, since poll is already active\n");
359 return -EBUSY; 353 return -EBUSY;
360 } 354 }
361 355
362 if (ndev->target_active_prot) { 356 if (ndev->target_active_prot) {
363 nfc_err("there is an active target"); 357 pr_err("there is an active target\n");
364 return -EBUSY; 358 return -EBUSY;
365 } 359 }
366 360
367 if (test_bit(NCI_POLL_ACTIVE, &ndev->flags)) { 361 if (test_bit(NCI_POLL_ACTIVE, &ndev->flags)) {
368 nfc_dbg("target is active, implicitly deactivate..."); 362 pr_debug("target is active, implicitly deactivate...\n");
369 363
370 rc = nci_request(ndev, nci_rf_deactivate_req, 0, 364 rc = nci_request(ndev, nci_rf_deactivate_req, 0,
371 msecs_to_jiffies(NCI_RF_DEACTIVATE_TIMEOUT)); 365 msecs_to_jiffies(NCI_RF_DEACTIVATE_TIMEOUT));
@@ -386,10 +380,8 @@ static void nci_stop_poll(struct nfc_dev *nfc_dev)
386{ 380{
387 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); 381 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
388 382
389 nfc_dbg("entry");
390
391 if (!test_bit(NCI_DISCOVERY, &ndev->flags)) { 383 if (!test_bit(NCI_DISCOVERY, &ndev->flags)) {
392 nfc_err("unable to stop poll, since poll is not active"); 384 pr_err("unable to stop poll, since poll is not active\n");
393 return; 385 return;
394 } 386 }
395 387
@@ -402,21 +394,21 @@ static int nci_activate_target(struct nfc_dev *nfc_dev, __u32 target_idx,
402{ 394{
403 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); 395 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
404 396
405 nfc_dbg("entry, target_idx %d, protocol 0x%x", target_idx, protocol); 397 pr_debug("target_idx %d, protocol 0x%x\n", target_idx, protocol);
406 398
407 if (!test_bit(NCI_POLL_ACTIVE, &ndev->flags)) { 399 if (!test_bit(NCI_POLL_ACTIVE, &ndev->flags)) {
408 nfc_err("there is no available target to activate"); 400 pr_err("there is no available target to activate\n");
409 return -EINVAL; 401 return -EINVAL;
410 } 402 }
411 403
412 if (ndev->target_active_prot) { 404 if (ndev->target_active_prot) {
413 nfc_err("there is already an active target"); 405 pr_err("there is already an active target\n");
414 return -EBUSY; 406 return -EBUSY;
415 } 407 }
416 408
417 if (!(ndev->target_available_prots & (1 << protocol))) { 409 if (!(ndev->target_available_prots & (1 << protocol))) {
418 nfc_err("target does not support the requested protocol 0x%x", 410 pr_err("target does not support the requested protocol 0x%x\n",
419 protocol); 411 protocol);
420 return -EINVAL; 412 return -EINVAL;
421 } 413 }
422 414
@@ -430,10 +422,10 @@ static void nci_deactivate_target(struct nfc_dev *nfc_dev, __u32 target_idx)
430{ 422{
431 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); 423 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
432 424
433 nfc_dbg("entry, target_idx %d", target_idx); 425 pr_debug("target_idx %d\n", target_idx);
434 426
435 if (!ndev->target_active_prot) { 427 if (!ndev->target_active_prot) {
436 nfc_err("unable to deactivate target, no active target"); 428 pr_err("unable to deactivate target, no active target\n");
437 return; 429 return;
438 } 430 }
439 431
@@ -453,10 +445,10 @@ static int nci_data_exchange(struct nfc_dev *nfc_dev, __u32 target_idx,
453 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); 445 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
454 int rc; 446 int rc;
455 447
456 nfc_dbg("entry, target_idx %d, len %d", target_idx, skb->len); 448 pr_debug("target_idx %d, len %d\n", target_idx, skb->len);
457 449
458 if (!ndev->target_active_prot) { 450 if (!ndev->target_active_prot) {
459 nfc_err("unable to exchange data, no active target"); 451 pr_err("unable to exchange data, no active target\n");
460 return -EINVAL; 452 return -EINVAL;
461 } 453 }
462 454
@@ -499,7 +491,7 @@ struct nci_dev *nci_allocate_device(struct nci_ops *ops,
499{ 491{
500 struct nci_dev *ndev; 492 struct nci_dev *ndev;
501 493
502 nfc_dbg("entry, supported_protocols 0x%x", supported_protocols); 494 pr_debug("supported_protocols 0x%x\n", supported_protocols);
503 495
504 if (!ops->open || !ops->close || !ops->send) 496 if (!ops->open || !ops->close || !ops->send)
505 return NULL; 497 return NULL;
@@ -539,8 +531,6 @@ EXPORT_SYMBOL(nci_allocate_device);
539 */ 531 */
540void nci_free_device(struct nci_dev *ndev) 532void nci_free_device(struct nci_dev *ndev)
541{ 533{
542 nfc_dbg("entry");
543
544 nfc_free_device(ndev->nfc_dev); 534 nfc_free_device(ndev->nfc_dev);
545 kfree(ndev); 535 kfree(ndev);
546} 536}
@@ -557,8 +547,6 @@ int nci_register_device(struct nci_dev *ndev)
557 struct device *dev = &ndev->nfc_dev->dev; 547 struct device *dev = &ndev->nfc_dev->dev;
558 char name[32]; 548 char name[32];
559 549
560 nfc_dbg("entry");
561
562 rc = nfc_register_device(ndev->nfc_dev); 550 rc = nfc_register_device(ndev->nfc_dev);
563 if (rc) 551 if (rc)
564 goto exit; 552 goto exit;
@@ -621,8 +609,6 @@ EXPORT_SYMBOL(nci_register_device);
621 */ 609 */
622void nci_unregister_device(struct nci_dev *ndev) 610void nci_unregister_device(struct nci_dev *ndev)
623{ 611{
624 nfc_dbg("entry");
625
626 nci_close_device(ndev); 612 nci_close_device(ndev);
627 613
628 destroy_workqueue(ndev->cmd_wq); 614 destroy_workqueue(ndev->cmd_wq);
@@ -642,7 +628,7 @@ int nci_recv_frame(struct sk_buff *skb)
642{ 628{
643 struct nci_dev *ndev = (struct nci_dev *) skb->dev; 629 struct nci_dev *ndev = (struct nci_dev *) skb->dev;
644 630
645 nfc_dbg("entry, len %d", skb->len); 631 pr_debug("len %d\n", skb->len);
646 632
647 if (!ndev || (!test_bit(NCI_UP, &ndev->flags) 633 if (!ndev || (!test_bit(NCI_UP, &ndev->flags)
648 && !test_bit(NCI_INIT, &ndev->flags))) { 634 && !test_bit(NCI_INIT, &ndev->flags))) {
@@ -662,7 +648,7 @@ static int nci_send_frame(struct sk_buff *skb)
662{ 648{
663 struct nci_dev *ndev = (struct nci_dev *) skb->dev; 649 struct nci_dev *ndev = (struct nci_dev *) skb->dev;
664 650
665 nfc_dbg("entry, len %d", skb->len); 651 pr_debug("len %d\n", skb->len);
666 652
667 if (!ndev) { 653 if (!ndev) {
668 kfree_skb(skb); 654 kfree_skb(skb);
@@ -681,11 +667,11 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload)
681 struct nci_ctrl_hdr *hdr; 667 struct nci_ctrl_hdr *hdr;
682 struct sk_buff *skb; 668 struct sk_buff *skb;
683 669
684 nfc_dbg("entry, opcode 0x%x, plen %d", opcode, plen); 670 pr_debug("opcode 0x%x, plen %d\n", opcode, plen);
685 671
686 skb = nci_skb_alloc(ndev, (NCI_CTRL_HDR_SIZE + plen), GFP_KERNEL); 672 skb = nci_skb_alloc(ndev, (NCI_CTRL_HDR_SIZE + plen), GFP_KERNEL);
687 if (!skb) { 673 if (!skb) {
688 nfc_err("no memory for command"); 674 pr_err("no memory for command\n");
689 return -ENOMEM; 675 return -ENOMEM;
690 } 676 }
691 677
@@ -715,7 +701,7 @@ static void nci_tx_work(struct work_struct *work)
715 struct nci_dev *ndev = container_of(work, struct nci_dev, tx_work); 701 struct nci_dev *ndev = container_of(work, struct nci_dev, tx_work);
716 struct sk_buff *skb; 702 struct sk_buff *skb;
717 703
718 nfc_dbg("entry, credits_cnt %d", atomic_read(&ndev->credits_cnt)); 704 pr_debug("credits_cnt %d\n", atomic_read(&ndev->credits_cnt));
719 705
720 /* Send queued tx data */ 706 /* Send queued tx data */
721 while (atomic_read(&ndev->credits_cnt)) { 707 while (atomic_read(&ndev->credits_cnt)) {
@@ -728,10 +714,10 @@ static void nci_tx_work(struct work_struct *work)
728 NCI_DATA_FLOW_CONTROL_NOT_USED) 714 NCI_DATA_FLOW_CONTROL_NOT_USED)
729 atomic_dec(&ndev->credits_cnt); 715 atomic_dec(&ndev->credits_cnt);
730 716
731 nfc_dbg("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d", 717 pr_debug("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d\n",
732 nci_pbf(skb->data), 718 nci_pbf(skb->data),
733 nci_conn_id(skb->data), 719 nci_conn_id(skb->data),
734 nci_plen(skb->data)); 720 nci_plen(skb->data));
735 721
736 nci_send_frame(skb); 722 nci_send_frame(skb);
737 } 723 }
@@ -760,7 +746,7 @@ static void nci_rx_work(struct work_struct *work)
760 break; 746 break;
761 747
762 default: 748 default:
763 nfc_err("unknown MT 0x%x", nci_mt(skb->data)); 749 pr_err("unknown MT 0x%x\n", nci_mt(skb->data));
764 kfree_skb(skb); 750 kfree_skb(skb);
765 break; 751 break;
766 } 752 }
@@ -774,7 +760,7 @@ static void nci_cmd_work(struct work_struct *work)
774 struct nci_dev *ndev = container_of(work, struct nci_dev, cmd_work); 760 struct nci_dev *ndev = container_of(work, struct nci_dev, cmd_work);
775 struct sk_buff *skb; 761 struct sk_buff *skb;
776 762
777 nfc_dbg("entry, cmd_cnt %d", atomic_read(&ndev->cmd_cnt)); 763 pr_debug("cmd_cnt %d\n", atomic_read(&ndev->cmd_cnt));
778 764
779 /* Send queued command */ 765 /* Send queued command */
780 if (atomic_read(&ndev->cmd_cnt)) { 766 if (atomic_read(&ndev->cmd_cnt)) {
@@ -784,11 +770,11 @@ static void nci_cmd_work(struct work_struct *work)
784 770
785 atomic_dec(&ndev->cmd_cnt); 771 atomic_dec(&ndev->cmd_cnt);
786 772
787 nfc_dbg("NCI TX: MT=cmd, PBF=%d, GID=0x%x, OID=0x%x, plen=%d", 773 pr_debug("NCI TX: MT=cmd, PBF=%d, GID=0x%x, OID=0x%x, plen=%d\n",
788 nci_pbf(skb->data), 774 nci_pbf(skb->data),
789 nci_opcode_gid(nci_opcode(skb->data)), 775 nci_opcode_gid(nci_opcode(skb->data)),
790 nci_opcode_oid(nci_opcode(skb->data)), 776 nci_opcode_oid(nci_opcode(skb->data)),
791 nci_plen(skb->data)); 777 nci_plen(skb->data));
792 778
793 nci_send_frame(skb); 779 nci_send_frame(skb);
794 780
diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c
index 511fb96e21bc..1e040feb2f84 100644
--- a/net/nfc/nci/data.c
+++ b/net/nfc/nci/data.c
@@ -21,6 +21,8 @@
21 * 21 *
22 */ 22 */
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <linux/types.h> 26#include <linux/types.h>
25#include <linux/interrupt.h> 27#include <linux/interrupt.h>
26#include <linux/wait.h> 28#include <linux/wait.h>
@@ -40,7 +42,7 @@ void nci_data_exchange_complete(struct nci_dev *ndev,
40 data_exchange_cb_t cb = ndev->data_exchange_cb; 42 data_exchange_cb_t cb = ndev->data_exchange_cb;
41 void *cb_context = ndev->data_exchange_cb_context; 43 void *cb_context = ndev->data_exchange_cb_context;
42 44
43 nfc_dbg("entry, len %d, err %d", ((skb) ? (skb->len) : (0)), err); 45 pr_debug("len %d, err %d\n", skb ? skb->len : 0, err);
44 46
45 if (cb) { 47 if (cb) {
46 ndev->data_exchange_cb = NULL; 48 ndev->data_exchange_cb = NULL;
@@ -49,7 +51,7 @@ void nci_data_exchange_complete(struct nci_dev *ndev,
49 /* forward skb to nfc core */ 51 /* forward skb to nfc core */
50 cb(cb_context, skb, err); 52 cb(cb_context, skb, err);
51 } else if (skb) { 53 } else if (skb) {
52 nfc_err("no rx callback, dropping rx data..."); 54 pr_err("no rx callback, dropping rx data...\n");
53 55
54 /* no waiting callback, free skb */ 56 /* no waiting callback, free skb */
55 kfree_skb(skb); 57 kfree_skb(skb);
@@ -90,7 +92,7 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
90 int frag_len; 92 int frag_len;
91 int rc = 0; 93 int rc = 0;
92 94
93 nfc_dbg("entry, conn_id 0x%x, total_len %d", conn_id, total_len); 95 pr_debug("conn_id 0x%x, total_len %d\n", conn_id, total_len);
94 96
95 __skb_queue_head_init(&frags_q); 97 __skb_queue_head_init(&frags_q);
96 98
@@ -119,8 +121,8 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
119 data += frag_len; 121 data += frag_len;
120 total_len -= frag_len; 122 total_len -= frag_len;
121 123
122 nfc_dbg("frag_len %d, remaining total_len %d", 124 pr_debug("frag_len %d, remaining total_len %d\n",
123 frag_len, total_len); 125 frag_len, total_len);
124 } 126 }
125 127
126 /* queue all fragments atomically */ 128 /* queue all fragments atomically */
@@ -149,7 +151,7 @@ int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb)
149{ 151{
150 int rc = 0; 152 int rc = 0;
151 153
152 nfc_dbg("entry, conn_id 0x%x, plen %d", conn_id, skb->len); 154 pr_debug("conn_id 0x%x, plen %d\n", conn_id, skb->len);
153 155
154 /* check if the packet need to be fragmented */ 156 /* check if the packet need to be fragmented */
155 if (skb->len <= ndev->max_data_pkt_payload_size) { 157 if (skb->len <= ndev->max_data_pkt_payload_size) {
@@ -161,7 +163,7 @@ int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb)
161 /* fragment packet and queue the fragments */ 163 /* fragment packet and queue the fragments */
162 rc = nci_queue_tx_data_frags(ndev, conn_id, skb); 164 rc = nci_queue_tx_data_frags(ndev, conn_id, skb);
163 if (rc) { 165 if (rc) {
164 nfc_err("failed to fragment tx data packet"); 166 pr_err("failed to fragment tx data packet\n");
165 goto free_exit; 167 goto free_exit;
166 } 168 }
167 } 169 }
@@ -191,7 +193,7 @@ static void nci_add_rx_data_frag(struct nci_dev *ndev,
191 193
192 /* first, make enough room for the already accumulated data */ 194 /* first, make enough room for the already accumulated data */
193 if (skb_cow_head(skb, reassembly_len)) { 195 if (skb_cow_head(skb, reassembly_len)) {
194 nfc_err("error adding room for accumulated rx data"); 196 pr_err("error adding room for accumulated rx data\n");
195 197
196 kfree_skb(skb); 198 kfree_skb(skb);
197 skb = 0; 199 skb = 0;
@@ -228,19 +230,19 @@ void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb)
228{ 230{
229 __u8 pbf = nci_pbf(skb->data); 231 __u8 pbf = nci_pbf(skb->data);
230 232
231 nfc_dbg("entry, len %d", skb->len); 233 pr_debug("len %d\n", skb->len);
232 234
233 nfc_dbg("NCI RX: MT=data, PBF=%d, conn_id=%d, plen=%d", 235 pr_debug("NCI RX: MT=data, PBF=%d, conn_id=%d, plen=%d\n",
234 nci_pbf(skb->data), 236 nci_pbf(skb->data),
235 nci_conn_id(skb->data), 237 nci_conn_id(skb->data),
236 nci_plen(skb->data)); 238 nci_plen(skb->data));
237 239
238 /* strip the nci data header */ 240 /* strip the nci data header */
239 skb_pull(skb, NCI_DATA_HDR_SIZE); 241 skb_pull(skb, NCI_DATA_HDR_SIZE);
240 242
241 if (ndev->target_active_prot == NFC_PROTO_MIFARE) { 243 if (ndev->target_active_prot == NFC_PROTO_MIFARE) {
242 /* frame I/F => remove the status byte */ 244 /* frame I/F => remove the status byte */
243 nfc_dbg("NFC_PROTO_MIFARE => remove the status byte"); 245 pr_debug("NFC_PROTO_MIFARE => remove the status byte\n");
244 skb_trim(skb, (skb->len - 1)); 246 skb_trim(skb, (skb->len - 1));
245 } 247 }
246 248
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index c1bf54172c25..c36bd4a09abb 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -25,6 +25,8 @@
25 * 25 *
26 */ 26 */
27 27
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
28#include <linux/types.h> 30#include <linux/types.h>
29#include <linux/interrupt.h> 31#include <linux/interrupt.h>
30#include <linux/bitops.h> 32#include <linux/bitops.h>
@@ -43,16 +45,16 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,
43 struct nci_core_conn_credit_ntf *ntf = (void *) skb->data; 45 struct nci_core_conn_credit_ntf *ntf = (void *) skb->data;
44 int i; 46 int i;
45 47
46 nfc_dbg("entry, num_entries %d", ntf->num_entries); 48 pr_debug("num_entries %d\n", ntf->num_entries);
47 49
48 if (ntf->num_entries > NCI_MAX_NUM_CONN) 50 if (ntf->num_entries > NCI_MAX_NUM_CONN)
49 ntf->num_entries = NCI_MAX_NUM_CONN; 51 ntf->num_entries = NCI_MAX_NUM_CONN;
50 52
51 /* update the credits */ 53 /* update the credits */
52 for (i = 0; i < ntf->num_entries; i++) { 54 for (i = 0; i < ntf->num_entries; i++) {
53 nfc_dbg("entry[%d]: conn_id %d, credits %d", i, 55 pr_debug("entry[%d]: conn_id %d, credits %d\n",
54 ntf->conn_entries[i].conn_id, 56 i, ntf->conn_entries[i].conn_id,
55 ntf->conn_entries[i].credits); 57 ntf->conn_entries[i].credits);
56 58
57 if (ntf->conn_entries[i].conn_id == NCI_STATIC_RF_CONN_ID) { 59 if (ntf->conn_entries[i].conn_id == NCI_STATIC_RF_CONN_ID) {
58 /* found static rf connection */ 60 /* found static rf connection */
@@ -78,9 +80,8 @@ static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
78 80
79 nfca_poll->nfcid1_len = *data++; 81 nfca_poll->nfcid1_len = *data++;
80 82
81 nfc_dbg("sens_res 0x%x, nfcid1_len %d", 83 pr_debug("sens_res 0x%x, nfcid1_len %d\n",
82 nfca_poll->sens_res, 84 nfca_poll->sens_res, nfca_poll->nfcid1_len);
83 nfca_poll->nfcid1_len);
84 85
85 memcpy(nfca_poll->nfcid1, data, nfca_poll->nfcid1_len); 86 memcpy(nfca_poll->nfcid1, data, nfca_poll->nfcid1_len);
86 data += nfca_poll->nfcid1_len; 87 data += nfca_poll->nfcid1_len;
@@ -90,9 +91,9 @@ static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
90 if (nfca_poll->sel_res_len != 0) 91 if (nfca_poll->sel_res_len != 0)
91 nfca_poll->sel_res = *data++; 92 nfca_poll->sel_res = *data++;
92 93
93 nfc_dbg("sel_res_len %d, sel_res 0x%x", 94 pr_debug("sel_res_len %d, sel_res 0x%x\n",
94 nfca_poll->sel_res_len, 95 nfca_poll->sel_res_len,
95 nfca_poll->sel_res); 96 nfca_poll->sel_res);
96 97
97 return data; 98 return data;
98} 99}
@@ -114,8 +115,8 @@ static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
114 break; 115 break;
115 116
116 default: 117 default:
117 nfc_err("unsupported activation_rf_tech_and_mode 0x%x", 118 pr_err("unsupported activation_rf_tech_and_mode 0x%x\n",
118 ntf->activation_rf_tech_and_mode); 119 ntf->activation_rf_tech_and_mode);
119 return -EPROTO; 120 return -EPROTO;
120 } 121 }
121 122
@@ -138,12 +139,12 @@ static void nci_target_found(struct nci_dev *ndev,
138 nfc_tgt.sel_res = ntf->rf_tech_specific_params.nfca_poll.sel_res; 139 nfc_tgt.sel_res = ntf->rf_tech_specific_params.nfca_poll.sel_res;
139 140
140 if (!(nfc_tgt.supported_protocols & ndev->poll_prots)) { 141 if (!(nfc_tgt.supported_protocols & ndev->poll_prots)) {
141 nfc_dbg("the target found does not have the desired protocol"); 142 pr_debug("the target found does not have the desired protocol\n");
142 return; 143 return;
143 } 144 }
144 145
145 nfc_dbg("new target found, supported_protocols 0x%x", 146 pr_debug("new target found, supported_protocols 0x%x\n",
146 nfc_tgt.supported_protocols); 147 nfc_tgt.supported_protocols);
147 148
148 ndev->target_available_prots = nfc_tgt.supported_protocols; 149 ndev->target_available_prots = nfc_tgt.supported_protocols;
149 150
@@ -166,13 +167,13 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
166 ntf.activation_rf_tech_and_mode = *data++; 167 ntf.activation_rf_tech_and_mode = *data++;
167 ntf.rf_tech_specific_params_len = *data++; 168 ntf.rf_tech_specific_params_len = *data++;
168 169
169 nfc_dbg("rf_discovery_id %d", ntf.rf_discovery_id); 170 pr_debug("rf_discovery_id %d\n", ntf.rf_discovery_id);
170 nfc_dbg("rf_interface_type 0x%x", ntf.rf_interface_type); 171 pr_debug("rf_interface_type 0x%x\n", ntf.rf_interface_type);
171 nfc_dbg("rf_protocol 0x%x", ntf.rf_protocol); 172 pr_debug("rf_protocol 0x%x\n", ntf.rf_protocol);
172 nfc_dbg("activation_rf_tech_and_mode 0x%x", 173 pr_debug("activation_rf_tech_and_mode 0x%x\n",
173 ntf.activation_rf_tech_and_mode); 174 ntf.activation_rf_tech_and_mode);
174 nfc_dbg("rf_tech_specific_params_len %d", 175 pr_debug("rf_tech_specific_params_len %d\n",
175 ntf.rf_tech_specific_params_len); 176 ntf.rf_tech_specific_params_len);
176 177
177 if (ntf.rf_tech_specific_params_len > 0) { 178 if (ntf.rf_tech_specific_params_len > 0) {
178 switch (ntf.activation_rf_tech_and_mode) { 179 switch (ntf.activation_rf_tech_and_mode) {
@@ -182,8 +183,8 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
182 break; 183 break;
183 184
184 default: 185 default:
185 nfc_err("unsupported activation_rf_tech_and_mode 0x%x", 186 pr_err("unsupported activation_rf_tech_and_mode 0x%x\n",
186 ntf.activation_rf_tech_and_mode); 187 ntf.activation_rf_tech_and_mode);
187 return; 188 return;
188 } 189 }
189 } 190 }
@@ -193,14 +194,14 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
193 ntf.data_exch_rx_bit_rate = *data++; 194 ntf.data_exch_rx_bit_rate = *data++;
194 ntf.activation_params_len = *data++; 195 ntf.activation_params_len = *data++;
195 196
196 nfc_dbg("data_exch_rf_tech_and_mode 0x%x", 197 pr_debug("data_exch_rf_tech_and_mode 0x%x\n",
197 ntf.data_exch_rf_tech_and_mode); 198 ntf.data_exch_rf_tech_and_mode);
198 nfc_dbg("data_exch_tx_bit_rate 0x%x", 199 pr_debug("data_exch_tx_bit_rate 0x%x\n",
199 ntf.data_exch_tx_bit_rate); 200 ntf.data_exch_tx_bit_rate);
200 nfc_dbg("data_exch_rx_bit_rate 0x%x", 201 pr_debug("data_exch_rx_bit_rate 0x%x\n",
201 ntf.data_exch_rx_bit_rate); 202 ntf.data_exch_rx_bit_rate);
202 nfc_dbg("activation_params_len %d", 203 pr_debug("activation_params_len %d\n",
203 ntf.activation_params_len); 204 ntf.activation_params_len);
204 205
205 if (ntf.activation_params_len > 0) { 206 if (ntf.activation_params_len > 0) {
206 switch (ntf.rf_interface_type) { 207 switch (ntf.rf_interface_type) {
@@ -214,8 +215,8 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
214 break; 215 break;
215 216
216 default: 217 default:
217 nfc_err("unsupported rf_interface_type 0x%x", 218 pr_err("unsupported rf_interface_type 0x%x\n",
218 ntf.rf_interface_type); 219 ntf.rf_interface_type);
219 return; 220 return;
220 } 221 }
221 } 222 }
@@ -229,7 +230,7 @@ static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
229{ 230{
230 struct nci_rf_deactivate_ntf *ntf = (void *) skb->data; 231 struct nci_rf_deactivate_ntf *ntf = (void *) skb->data;
231 232
232 nfc_dbg("entry, type 0x%x, reason 0x%x", ntf->type, ntf->reason); 233 pr_debug("entry, type 0x%x, reason 0x%x\n", ntf->type, ntf->reason);
233 234
234 clear_bit(NCI_POLL_ACTIVE, &ndev->flags); 235 clear_bit(NCI_POLL_ACTIVE, &ndev->flags);
235 ndev->target_active_prot = 0; 236 ndev->target_active_prot = 0;
@@ -255,11 +256,11 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
255{ 256{
256 __u16 ntf_opcode = nci_opcode(skb->data); 257 __u16 ntf_opcode = nci_opcode(skb->data);
257 258
258 nfc_dbg("NCI RX: MT=ntf, PBF=%d, GID=0x%x, OID=0x%x, plen=%d", 259 pr_debug("NCI RX: MT=ntf, PBF=%d, GID=0x%x, OID=0x%x, plen=%d\n",
259 nci_pbf(skb->data), 260 nci_pbf(skb->data),
260 nci_opcode_gid(ntf_opcode), 261 nci_opcode_gid(ntf_opcode),
261 nci_opcode_oid(ntf_opcode), 262 nci_opcode_oid(ntf_opcode),
262 nci_plen(skb->data)); 263 nci_plen(skb->data));
263 264
264 /* strip the nci control header */ 265 /* strip the nci control header */
265 skb_pull(skb, NCI_CTRL_HDR_SIZE); 266 skb_pull(skb, NCI_CTRL_HDR_SIZE);
@@ -278,7 +279,7 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
278 break; 279 break;
279 280
280 default: 281 default:
281 nfc_err("unknown ntf opcode 0x%x", ntf_opcode); 282 pr_err("unknown ntf opcode 0x%x\n", ntf_opcode);
282 break; 283 break;
283 } 284 }
284 285
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index 0591f5aff89f..ca611c52aaaa 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -25,6 +25,8 @@
25 * 25 *
26 */ 26 */
27 27
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
28#include <linux/types.h> 30#include <linux/types.h>
29#include <linux/interrupt.h> 31#include <linux/interrupt.h>
30#include <linux/bitops.h> 32#include <linux/bitops.h>
@@ -40,12 +42,12 @@ static void nci_core_reset_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
40{ 42{
41 struct nci_core_reset_rsp *rsp = (void *) skb->data; 43 struct nci_core_reset_rsp *rsp = (void *) skb->data;
42 44
43 nfc_dbg("entry, status 0x%x", rsp->status); 45 pr_debug("status 0x%x\n", rsp->status);
44 46
45 if (rsp->status == NCI_STATUS_OK) { 47 if (rsp->status == NCI_STATUS_OK) {
46 ndev->nci_ver = rsp->nci_ver; 48 ndev->nci_ver = rsp->nci_ver;
47 nfc_dbg("nci_ver 0x%x, config_status 0x%x", 49 pr_debug("nci_ver 0x%x, config_status 0x%x\n",
48 rsp->nci_ver, rsp->config_status); 50 rsp->nci_ver, rsp->config_status);
49 } 51 }
50 52
51 nci_req_complete(ndev, rsp->status); 53 nci_req_complete(ndev, rsp->status);
@@ -56,7 +58,7 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
56 struct nci_core_init_rsp_1 *rsp_1 = (void *) skb->data; 58 struct nci_core_init_rsp_1 *rsp_1 = (void *) skb->data;
57 struct nci_core_init_rsp_2 *rsp_2; 59 struct nci_core_init_rsp_2 *rsp_2;
58 60
59 nfc_dbg("entry, status 0x%x", rsp_1->status); 61 pr_debug("status 0x%x\n", rsp_1->status);
60 62
61 if (rsp_1->status != NCI_STATUS_OK) 63 if (rsp_1->status != NCI_STATUS_OK)
62 goto exit; 64 goto exit;
@@ -95,34 +97,34 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
95 97
96 atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); 98 atomic_set(&ndev->credits_cnt, ndev->initial_num_credits);
97 99
98 nfc_dbg("nfcc_features 0x%x", 100 pr_debug("nfcc_features 0x%x\n",
99 ndev->nfcc_features); 101 ndev->nfcc_features);
100 nfc_dbg("num_supported_rf_interfaces %d", 102 pr_debug("num_supported_rf_interfaces %d\n",
101 ndev->num_supported_rf_interfaces); 103 ndev->num_supported_rf_interfaces);
102 nfc_dbg("supported_rf_interfaces[0] 0x%x", 104 pr_debug("supported_rf_interfaces[0] 0x%x\n",
103 ndev->supported_rf_interfaces[0]); 105 ndev->supported_rf_interfaces[0]);
104 nfc_dbg("supported_rf_interfaces[1] 0x%x", 106 pr_debug("supported_rf_interfaces[1] 0x%x\n",
105 ndev->supported_rf_interfaces[1]); 107 ndev->supported_rf_interfaces[1]);
106 nfc_dbg("supported_rf_interfaces[2] 0x%x", 108 pr_debug("supported_rf_interfaces[2] 0x%x\n",
107 ndev->supported_rf_interfaces[2]); 109 ndev->supported_rf_interfaces[2]);
108 nfc_dbg("supported_rf_interfaces[3] 0x%x", 110 pr_debug("supported_rf_interfaces[3] 0x%x\n",
109 ndev->supported_rf_interfaces[3]); 111 ndev->supported_rf_interfaces[3]);
110 nfc_dbg("max_logical_connections %d", 112 pr_debug("max_logical_connections %d\n",
111 ndev->max_logical_connections); 113 ndev->max_logical_connections);
112 nfc_dbg("max_routing_table_size %d", 114 pr_debug("max_routing_table_size %d\n",
113 ndev->max_routing_table_size); 115 ndev->max_routing_table_size);
114 nfc_dbg("max_ctrl_pkt_payload_len %d", 116 pr_debug("max_ctrl_pkt_payload_len %d\n",
115 ndev->max_ctrl_pkt_payload_len); 117 ndev->max_ctrl_pkt_payload_len);
116 nfc_dbg("max_size_for_large_params %d", 118 pr_debug("max_size_for_large_params %d\n",
117 ndev->max_size_for_large_params); 119 ndev->max_size_for_large_params);
118 nfc_dbg("max_data_pkt_payload_size %d", 120 pr_debug("max_data_pkt_payload_size %d\n",
119 ndev->max_data_pkt_payload_size); 121 ndev->max_data_pkt_payload_size);
120 nfc_dbg("initial_num_credits %d", 122 pr_debug("initial_num_credits %d\n",
121 ndev->initial_num_credits); 123 ndev->initial_num_credits);
122 nfc_dbg("manufact_id 0x%x", 124 pr_debug("manufact_id 0x%x\n",
123 ndev->manufact_id); 125 ndev->manufact_id);
124 nfc_dbg("manufact_specific_info 0x%x", 126 pr_debug("manufact_specific_info 0x%x\n",
125 ndev->manufact_specific_info); 127 ndev->manufact_specific_info);
126 128
127exit: 129exit:
128 nci_req_complete(ndev, rsp_1->status); 130 nci_req_complete(ndev, rsp_1->status);
@@ -133,7 +135,7 @@ static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev,
133{ 135{
134 __u8 status = skb->data[0]; 136 __u8 status = skb->data[0];
135 137
136 nfc_dbg("entry, status 0x%x", status); 138 pr_debug("status 0x%x\n", status);
137 139
138 nci_req_complete(ndev, status); 140 nci_req_complete(ndev, status);
139} 141}
@@ -142,7 +144,7 @@ static void nci_rf_disc_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
142{ 144{
143 __u8 status = skb->data[0]; 145 __u8 status = skb->data[0];
144 146
145 nfc_dbg("entry, status 0x%x", status); 147 pr_debug("status 0x%x\n", status);
146 148
147 if (status == NCI_STATUS_OK) 149 if (status == NCI_STATUS_OK)
148 set_bit(NCI_DISCOVERY, &ndev->flags); 150 set_bit(NCI_DISCOVERY, &ndev->flags);
@@ -155,7 +157,7 @@ static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev,
155{ 157{
156 __u8 status = skb->data[0]; 158 __u8 status = skb->data[0];
157 159
158 nfc_dbg("entry, status 0x%x", status); 160 pr_debug("status 0x%x\n", status);
159 161
160 clear_bit(NCI_DISCOVERY, &ndev->flags); 162 clear_bit(NCI_DISCOVERY, &ndev->flags);
161 163
@@ -169,11 +171,11 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
169 /* we got a rsp, stop the cmd timer */ 171 /* we got a rsp, stop the cmd timer */
170 del_timer(&ndev->cmd_timer); 172 del_timer(&ndev->cmd_timer);
171 173
172 nfc_dbg("NCI RX: MT=rsp, PBF=%d, GID=0x%x, OID=0x%x, plen=%d", 174 pr_debug("NCI RX: MT=rsp, PBF=%d, GID=0x%x, OID=0x%x, plen=%d\n",
173 nci_pbf(skb->data), 175 nci_pbf(skb->data),
174 nci_opcode_gid(rsp_opcode), 176 nci_opcode_gid(rsp_opcode),
175 nci_opcode_oid(rsp_opcode), 177 nci_opcode_oid(rsp_opcode),
176 nci_plen(skb->data)); 178 nci_plen(skb->data));
177 179
178 /* strip the nci control header */ 180 /* strip the nci control header */
179 skb_pull(skb, NCI_CTRL_HDR_SIZE); 181 skb_pull(skb, NCI_CTRL_HDR_SIZE);
@@ -200,7 +202,7 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
200 break; 202 break;
201 203
202 default: 204 default:
203 nfc_err("unknown rsp opcode 0x%x", rsp_opcode); 205 pr_err("unknown rsp opcode 0x%x\n", rsp_opcode);
204 break; 206 break;
205 } 207 }
206 208
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 03f8818e1f16..c10e9b8c5ad9 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -21,6 +21,8 @@
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 22 */
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <net/genetlink.h> 26#include <net/genetlink.h>
25#include <linux/nfc.h> 27#include <linux/nfc.h>
26#include <linux/slab.h> 28#include <linux/slab.h>
@@ -51,8 +53,6 @@ static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target,
51{ 53{
52 void *hdr; 54 void *hdr;
53 55
54 nfc_dbg("entry");
55
56 hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, 56 hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
57 &nfc_genl_family, flags, NFC_CMD_GET_TARGET); 57 &nfc_genl_family, flags, NFC_CMD_GET_TARGET);
58 if (!hdr) 58 if (!hdr)
@@ -105,8 +105,6 @@ static int nfc_genl_dump_targets(struct sk_buff *skb,
105 struct nfc_dev *dev = (struct nfc_dev *) cb->args[1]; 105 struct nfc_dev *dev = (struct nfc_dev *) cb->args[1];
106 int rc; 106 int rc;
107 107
108 nfc_dbg("entry");
109
110 if (!dev) { 108 if (!dev) {
111 dev = __get_device_from_cb(cb); 109 dev = __get_device_from_cb(cb);
112 if (IS_ERR(dev)) 110 if (IS_ERR(dev))
@@ -139,8 +137,6 @@ static int nfc_genl_dump_targets_done(struct netlink_callback *cb)
139{ 137{
140 struct nfc_dev *dev = (struct nfc_dev *) cb->args[1]; 138 struct nfc_dev *dev = (struct nfc_dev *) cb->args[1];
141 139
142 nfc_dbg("entry");
143
144 if (dev) 140 if (dev)
145 nfc_put_device(dev); 141 nfc_put_device(dev);
146 142
@@ -152,8 +148,6 @@ int nfc_genl_targets_found(struct nfc_dev *dev)
152 struct sk_buff *msg; 148 struct sk_buff *msg;
153 void *hdr; 149 void *hdr;
154 150
155 nfc_dbg("entry");
156
157 dev->genl_data.poll_req_pid = 0; 151 dev->genl_data.poll_req_pid = 0;
158 152
159 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); 153 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
@@ -183,8 +177,6 @@ int nfc_genl_device_added(struct nfc_dev *dev)
183 struct sk_buff *msg; 177 struct sk_buff *msg;
184 void *hdr; 178 void *hdr;
185 179
186 nfc_dbg("entry");
187
188 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); 180 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
189 if (!msg) 181 if (!msg)
190 return -ENOMEM; 182 return -ENOMEM;
@@ -216,8 +208,6 @@ int nfc_genl_device_removed(struct nfc_dev *dev)
216 struct sk_buff *msg; 208 struct sk_buff *msg;
217 void *hdr; 209 void *hdr;
218 210
219 nfc_dbg("entry");
220
221 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); 211 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
222 if (!msg) 212 if (!msg)
223 return -ENOMEM; 213 return -ENOMEM;
@@ -249,8 +239,6 @@ static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev,
249{ 239{
250 void *hdr; 240 void *hdr;
251 241
252 nfc_dbg("entry");
253
254 hdr = genlmsg_put(msg, pid, seq, &nfc_genl_family, flags, 242 hdr = genlmsg_put(msg, pid, seq, &nfc_genl_family, flags,
255 NFC_CMD_GET_DEVICE); 243 NFC_CMD_GET_DEVICE);
256 if (!hdr) 244 if (!hdr)
@@ -277,8 +265,6 @@ static int nfc_genl_dump_devices(struct sk_buff *skb,
277 struct nfc_dev *dev = (struct nfc_dev *) cb->args[1]; 265 struct nfc_dev *dev = (struct nfc_dev *) cb->args[1];
278 bool first_call = false; 266 bool first_call = false;
279 267
280 nfc_dbg("entry");
281
282 if (!iter) { 268 if (!iter) {
283 first_call = true; 269 first_call = true;
284 iter = kmalloc(sizeof(struct class_dev_iter), GFP_KERNEL); 270 iter = kmalloc(sizeof(struct class_dev_iter), GFP_KERNEL);
@@ -319,8 +305,6 @@ static int nfc_genl_dump_devices_done(struct netlink_callback *cb)
319{ 305{
320 struct class_dev_iter *iter = (struct class_dev_iter *) cb->args[0]; 306 struct class_dev_iter *iter = (struct class_dev_iter *) cb->args[0];
321 307
322 nfc_dbg("entry");
323
324 nfc_device_iter_exit(iter); 308 nfc_device_iter_exit(iter);
325 kfree(iter); 309 kfree(iter);
326 310
@@ -334,8 +318,6 @@ static int nfc_genl_get_device(struct sk_buff *skb, struct genl_info *info)
334 u32 idx; 318 u32 idx;
335 int rc = -ENOBUFS; 319 int rc = -ENOBUFS;
336 320
337 nfc_dbg("entry");
338
339 if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) 321 if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
340 return -EINVAL; 322 return -EINVAL;
341 323
@@ -373,8 +355,6 @@ static int nfc_genl_dev_up(struct sk_buff *skb, struct genl_info *info)
373 int rc; 355 int rc;
374 u32 idx; 356 u32 idx;
375 357
376 nfc_dbg("entry");
377
378 if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) 358 if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
379 return -EINVAL; 359 return -EINVAL;
380 360
@@ -396,8 +376,6 @@ static int nfc_genl_dev_down(struct sk_buff *skb, struct genl_info *info)
396 int rc; 376 int rc;
397 u32 idx; 377 u32 idx;
398 378
399 nfc_dbg("entry");
400
401 if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) 379 if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
402 return -EINVAL; 380 return -EINVAL;
403 381
@@ -420,8 +398,6 @@ static int nfc_genl_start_poll(struct sk_buff *skb, struct genl_info *info)
420 u32 idx; 398 u32 idx;
421 u32 protocols; 399 u32 protocols;
422 400
423 nfc_dbg("entry");
424
425 if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || 401 if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
426 !info->attrs[NFC_ATTR_PROTOCOLS]) 402 !info->attrs[NFC_ATTR_PROTOCOLS])
427 return -EINVAL; 403 return -EINVAL;
@@ -451,8 +427,6 @@ static int nfc_genl_stop_poll(struct sk_buff *skb, struct genl_info *info)
451 int rc; 427 int rc;
452 u32 idx; 428 u32 idx;
453 429
454 nfc_dbg("entry");
455
456 if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) 430 if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
457 return -EINVAL; 431 return -EINVAL;
458 432
@@ -524,7 +498,7 @@ static int nfc_genl_rcv_nl_event(struct notifier_block *this,
524 if (event != NETLINK_URELEASE || n->protocol != NETLINK_GENERIC) 498 if (event != NETLINK_URELEASE || n->protocol != NETLINK_GENERIC)
525 goto out; 499 goto out;
526 500
527 nfc_dbg("NETLINK_URELEASE event from id %d", n->pid); 501 pr_debug("NETLINK_URELEASE event from id %d\n", n->pid);
528 502
529 nfc_device_iter_init(&iter); 503 nfc_device_iter_init(&iter);
530 dev = nfc_device_iter_next(&iter); 504 dev = nfc_device_iter_next(&iter);
diff --git a/net/nfc/nfc.h b/net/nfc/nfc.h
index d86583f4831d..67d605015304 100644
--- a/net/nfc/nfc.h
+++ b/net/nfc/nfc.h
@@ -27,13 +27,6 @@
27#include <net/nfc/nfc.h> 27#include <net/nfc/nfc.h>
28#include <net/sock.h> 28#include <net/sock.h>
29 29
30__printf(2, 3)
31int nfc_printk(const char *level, const char *fmt, ...);
32
33#define nfc_info(fmt, arg...) nfc_printk(KERN_INFO, fmt, ##arg)
34#define nfc_err(fmt, arg...) nfc_printk(KERN_ERR, fmt, ##arg)
35#define nfc_dbg(fmt, arg...) pr_debug(fmt "\n", ##arg)
36
37struct nfc_protocol { 30struct nfc_protocol {
38 int id; 31 int id;
39 struct proto *proto; 32 struct proto *proto;
diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c
index ee7b2b365ef2..68ecf3fa94e0 100644
--- a/net/nfc/rawsock.c
+++ b/net/nfc/rawsock.c
@@ -21,6 +21,8 @@
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 22 */
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <net/tcp_states.h> 26#include <net/tcp_states.h>
25#include <linux/nfc.h> 27#include <linux/nfc.h>
26#include <linux/export.h> 28#include <linux/export.h>
@@ -29,7 +31,7 @@
29 31
30static void rawsock_write_queue_purge(struct sock *sk) 32static void rawsock_write_queue_purge(struct sock *sk)
31{ 33{
32 nfc_dbg("sk=%p", sk); 34 pr_debug("sk=%p\n", sk);
33 35
34 spin_lock_bh(&sk->sk_write_queue.lock); 36 spin_lock_bh(&sk->sk_write_queue.lock);
35 __skb_queue_purge(&sk->sk_write_queue); 37 __skb_queue_purge(&sk->sk_write_queue);
@@ -39,7 +41,7 @@ static void rawsock_write_queue_purge(struct sock *sk)
39 41
40static void rawsock_report_error(struct sock *sk, int err) 42static void rawsock_report_error(struct sock *sk, int err)
41{ 43{
42 nfc_dbg("sk=%p err=%d", sk, err); 44 pr_debug("sk=%p err=%d\n", sk, err);
43 45
44 sk->sk_shutdown = SHUTDOWN_MASK; 46 sk->sk_shutdown = SHUTDOWN_MASK;
45 sk->sk_err = -err; 47 sk->sk_err = -err;
@@ -52,7 +54,7 @@ static int rawsock_release(struct socket *sock)
52{ 54{
53 struct sock *sk = sock->sk; 55 struct sock *sk = sock->sk;
54 56
55 nfc_dbg("sock=%p", sock); 57 pr_debug("sock=%p\n", sock);
56 58
57 sock_orphan(sk); 59 sock_orphan(sk);
58 sock_put(sk); 60 sock_put(sk);
@@ -68,14 +70,14 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr,
68 struct nfc_dev *dev; 70 struct nfc_dev *dev;
69 int rc = 0; 71 int rc = 0;
70 72
71 nfc_dbg("sock=%p sk=%p flags=%d", sock, sk, flags); 73 pr_debug("sock=%p sk=%p flags=%d\n", sock, sk, flags);
72 74
73 if (!addr || len < sizeof(struct sockaddr_nfc) || 75 if (!addr || len < sizeof(struct sockaddr_nfc) ||
74 addr->sa_family != AF_NFC) 76 addr->sa_family != AF_NFC)
75 return -EINVAL; 77 return -EINVAL;
76 78
77 nfc_dbg("addr dev_idx=%u target_idx=%u protocol=%u", addr->dev_idx, 79 pr_debug("addr dev_idx=%u target_idx=%u protocol=%u\n",
78 addr->target_idx, addr->nfc_protocol); 80 addr->dev_idx, addr->target_idx, addr->nfc_protocol);
79 81
80 lock_sock(sk); 82 lock_sock(sk);
81 83
@@ -136,7 +138,7 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb,
136 138
137 BUG_ON(in_irq()); 139 BUG_ON(in_irq());
138 140
139 nfc_dbg("sk=%p err=%d", sk, err); 141 pr_debug("sk=%p err=%d\n", sk, err);
140 142
141 if (err) 143 if (err)
142 goto error; 144 goto error;
@@ -172,7 +174,7 @@ static void rawsock_tx_work(struct work_struct *work)
172 struct sk_buff *skb; 174 struct sk_buff *skb;
173 int rc; 175 int rc;
174 176
175 nfc_dbg("sk=%p target_idx=%u", sk, target_idx); 177 pr_debug("sk=%p target_idx=%u\n", sk, target_idx);
176 178
177 if (sk->sk_shutdown & SEND_SHUTDOWN) { 179 if (sk->sk_shutdown & SEND_SHUTDOWN) {
178 rawsock_write_queue_purge(sk); 180 rawsock_write_queue_purge(sk);
@@ -198,7 +200,7 @@ static int rawsock_sendmsg(struct kiocb *iocb, struct socket *sock,
198 struct sk_buff *skb; 200 struct sk_buff *skb;
199 int rc; 201 int rc;
200 202
201 nfc_dbg("sock=%p sk=%p len=%zu", sock, sk, len); 203 pr_debug("sock=%p sk=%p len=%zu\n", sock, sk, len);
202 204
203 if (msg->msg_namelen) 205 if (msg->msg_namelen)
204 return -EOPNOTSUPP; 206 return -EOPNOTSUPP;
@@ -239,7 +241,7 @@ static int rawsock_recvmsg(struct kiocb *iocb, struct socket *sock,
239 int copied; 241 int copied;
240 int rc; 242 int rc;
241 243
242 nfc_dbg("sock=%p sk=%p len=%zu flags=%d", sock, sk, len, flags); 244 pr_debug("sock=%p sk=%p len=%zu flags=%d\n", sock, sk, len, flags);
243 245
244 skb = skb_recv_datagram(sk, flags, noblock, &rc); 246 skb = skb_recv_datagram(sk, flags, noblock, &rc);
245 if (!skb) 247 if (!skb)
@@ -283,7 +285,7 @@ static const struct proto_ops rawsock_ops = {
283 285
284static void rawsock_destruct(struct sock *sk) 286static void rawsock_destruct(struct sock *sk)
285{ 287{
286 nfc_dbg("sk=%p", sk); 288 pr_debug("sk=%p\n", sk);
287 289
288 if (sk->sk_state == TCP_ESTABLISHED) { 290 if (sk->sk_state == TCP_ESTABLISHED) {
289 nfc_deactivate_target(nfc_rawsock(sk)->dev, 291 nfc_deactivate_target(nfc_rawsock(sk)->dev,
@@ -294,7 +296,7 @@ static void rawsock_destruct(struct sock *sk)
294 skb_queue_purge(&sk->sk_receive_queue); 296 skb_queue_purge(&sk->sk_receive_queue);
295 297
296 if (!sock_flag(sk, SOCK_DEAD)) { 298 if (!sock_flag(sk, SOCK_DEAD)) {
297 nfc_err("Freeing alive NFC raw socket %p", sk); 299 pr_err("Freeing alive NFC raw socket %p\n", sk);
298 return; 300 return;
299 } 301 }
300} 302}
@@ -304,7 +306,7 @@ static int rawsock_create(struct net *net, struct socket *sock,
304{ 306{
305 struct sock *sk; 307 struct sock *sk;
306 308
307 nfc_dbg("sock=%p", sock); 309 pr_debug("sock=%p\n", sock);
308 310
309 if (sock->type != SOCK_SEQPACKET) 311 if (sock->type != SOCK_SEQPACKET)
310 return -ESOCKTNOSUPPORT; 312 return -ESOCKTNOSUPPORT;
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 128677d69056..ca355e7e58b4 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -220,18 +220,7 @@ static struct platform_driver rfkill_gpio_driver = {
220 }, 220 },
221}; 221};
222 222
223static int __init rfkill_gpio_init(void) 223module_platform_driver(rfkill_gpio_driver);
224{
225 return platform_driver_register(&rfkill_gpio_driver);
226}
227
228static void __exit rfkill_gpio_exit(void)
229{
230 platform_driver_unregister(&rfkill_gpio_driver);
231}
232
233module_init(rfkill_gpio_init);
234module_exit(rfkill_gpio_exit);
235 224
236MODULE_DESCRIPTION("gpio rfkill"); 225MODULE_DESCRIPTION("gpio rfkill");
237MODULE_AUTHOR("NVIDIA"); 226MODULE_AUTHOR("NVIDIA");
diff --git a/net/rfkill/rfkill-regulator.c b/net/rfkill/rfkill-regulator.c
index 3ca7277a3c36..2ebfe8d0e873 100644
--- a/net/rfkill/rfkill-regulator.c
+++ b/net/rfkill/rfkill-regulator.c
@@ -144,17 +144,7 @@ static struct platform_driver rfkill_regulator_driver = {
144 }, 144 },
145}; 145};
146 146
147static int __init rfkill_regulator_init(void) 147module_platform_driver(rfkill_regulator_driver);
148{
149 return platform_driver_register(&rfkill_regulator_driver);
150}
151module_init(rfkill_regulator_init);
152
153static void __exit rfkill_regulator_exit(void)
154{
155 platform_driver_unregister(&rfkill_regulator_driver);
156}
157module_exit(rfkill_regulator_exit);
158 148
159MODULE_AUTHOR("Guiming Zhuo <gmzhuo@gmail.com>"); 149MODULE_AUTHOR("Guiming Zhuo <gmzhuo@gmail.com>");
160MODULE_AUTHOR("Antonio Ospite <ospite@studenti.unina.it>"); 150MODULE_AUTHOR("Antonio Ospite <ospite@studenti.unina.it>");
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index b7b7868f4128..8c550df13037 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -20,6 +20,7 @@
20 * interface 20 * interface
21 */ 21 */
22#define MESH_PREQ_MIN_INT 10 22#define MESH_PREQ_MIN_INT 10
23#define MESH_PERR_MIN_INT 100
23#define MESH_DIAM_TRAVERSAL_TIME 50 24#define MESH_DIAM_TRAVERSAL_TIME 50
24 25
25/* 26/*
@@ -47,6 +48,7 @@ const struct mesh_config default_mesh_config = {
47 .dot11MeshMaxPeerLinks = MESH_MAX_ESTAB_PLINKS, 48 .dot11MeshMaxPeerLinks = MESH_MAX_ESTAB_PLINKS,
48 .dot11MeshHWMPactivePathTimeout = MESH_PATH_TIMEOUT, 49 .dot11MeshHWMPactivePathTimeout = MESH_PATH_TIMEOUT,
49 .dot11MeshHWMPpreqMinInterval = MESH_PREQ_MIN_INT, 50 .dot11MeshHWMPpreqMinInterval = MESH_PREQ_MIN_INT,
51 .dot11MeshHWMPperrMinInterval = MESH_PERR_MIN_INT,
50 .dot11MeshHWMPnetDiameterTraversalTime = MESH_DIAM_TRAVERSAL_TIME, 52 .dot11MeshHWMPnetDiameterTraversalTime = MESH_DIAM_TRAVERSAL_TIME,
51 .dot11MeshHWMPmaxPREQretries = MESH_MAX_PREQ_RETRIES, 53 .dot11MeshHWMPmaxPREQretries = MESH_MAX_PREQ_RETRIES,
52 .path_refresh_time = MESH_PATH_REFRESH_TIME, 54 .path_refresh_time = MESH_PATH_REFRESH_TIME,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index eee9ccc7adaf..8a9b4d817ae6 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -204,6 +204,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
204 [NL80211_ATTR_HT_CAPABILITY_MASK] = { 204 [NL80211_ATTR_HT_CAPABILITY_MASK] = {
205 .len = NL80211_HT_CAPABILITY_LEN 205 .len = NL80211_HT_CAPABILITY_LEN
206 }, 206 },
207 [NL80211_ATTR_NOACK_MAP] = { .type = NLA_U16 },
207}; 208};
208 209
209/* policy for the key attributes */ 210/* policy for the key attributes */
@@ -904,6 +905,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
904 if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) 905 if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN)
905 CMD(sched_scan_start, START_SCHED_SCAN); 906 CMD(sched_scan_start, START_SCHED_SCAN);
906 CMD(probe_client, PROBE_CLIENT); 907 CMD(probe_client, PROBE_CLIENT);
908 CMD(set_noack_map, SET_NOACK_MAP);
907 if (dev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) { 909 if (dev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) {
908 i++; 910 i++;
909 NLA_PUT_U32(msg, i, NL80211_CMD_REGISTER_BEACONS); 911 NLA_PUT_U32(msg, i, NL80211_CMD_REGISTER_BEACONS);
@@ -1759,6 +1761,23 @@ static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info)
1759 return rdev->ops->del_virtual_intf(&rdev->wiphy, dev); 1761 return rdev->ops->del_virtual_intf(&rdev->wiphy, dev);
1760} 1762}
1761 1763
1764static int nl80211_set_noack_map(struct sk_buff *skb, struct genl_info *info)
1765{
1766 struct cfg80211_registered_device *rdev = info->user_ptr[0];
1767 struct net_device *dev = info->user_ptr[1];
1768 u16 noack_map;
1769
1770 if (!info->attrs[NL80211_ATTR_NOACK_MAP])
1771 return -EINVAL;
1772
1773 if (!rdev->ops->set_noack_map)
1774 return -EOPNOTSUPP;
1775
1776 noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]);
1777
1778 return rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
1779}
1780
1762struct get_key_cookie { 1781struct get_key_cookie {
1763 struct sk_buff *msg; 1782 struct sk_buff *msg;
1764 int error; 1783 int error;
@@ -3176,6 +3195,8 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,
3176 cur_params.dot11MeshHWMPactivePathTimeout); 3195 cur_params.dot11MeshHWMPactivePathTimeout);
3177 NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, 3196 NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
3178 cur_params.dot11MeshHWMPpreqMinInterval); 3197 cur_params.dot11MeshHWMPpreqMinInterval);
3198 NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
3199 cur_params.dot11MeshHWMPperrMinInterval);
3179 NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, 3200 NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
3180 cur_params.dot11MeshHWMPnetDiameterTraversalTime); 3201 cur_params.dot11MeshHWMPnetDiameterTraversalTime);
3181 NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_ROOTMODE, 3202 NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_ROOTMODE,
@@ -3210,6 +3231,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A
3210 [NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT] = { .type = NLA_U16 }, 3231 [NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT] = { .type = NLA_U16 },
3211 [NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT] = { .type = NLA_U32 }, 3232 [NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT] = { .type = NLA_U32 },
3212 [NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL] = { .type = NLA_U16 }, 3233 [NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL] = { .type = NLA_U16 },
3234 [NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL] = { .type = NLA_U16 },
3213 [NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME] = { .type = NLA_U16 }, 3235 [NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME] = { .type = NLA_U16 },
3214 [NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 }, 3236 [NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 },
3215 [NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 }, 3237 [NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 },
@@ -3284,6 +3306,9 @@ do {\
3284 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPpreqMinInterval, 3306 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPpreqMinInterval,
3285 mask, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, 3307 mask, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
3286 nla_get_u16); 3308 nla_get_u16);
3309 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPperrMinInterval,
3310 mask, NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
3311 nla_get_u16);
3287 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, 3312 FILL_IN_MESH_PARAM_IF_SET(tb, cfg,
3288 dot11MeshHWMPnetDiameterTraversalTime, 3313 dot11MeshHWMPnetDiameterTraversalTime,
3289 mask, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, 3314 mask, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
@@ -5648,6 +5673,11 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
5648 setup.mesh_id = nla_data(info->attrs[NL80211_ATTR_MESH_ID]); 5673 setup.mesh_id = nla_data(info->attrs[NL80211_ATTR_MESH_ID]);
5649 setup.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]); 5674 setup.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]);
5650 5675
5676 if (info->attrs[NL80211_ATTR_MCAST_RATE] &&
5677 !nl80211_parse_mcast_rate(rdev, setup.mcast_rate,
5678 nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE])))
5679 return -EINVAL;
5680
5651 if (info->attrs[NL80211_ATTR_MESH_SETUP]) { 5681 if (info->attrs[NL80211_ATTR_MESH_SETUP]) {
5652 /* parse additional setup parameters if given */ 5682 /* parse additional setup parameters if given */
5653 err = nl80211_parse_mesh_setup(info, &setup); 5683 err = nl80211_parse_mesh_setup(info, &setup);
@@ -6604,6 +6634,15 @@ static struct genl_ops nl80211_ops[] = {
6604 .internal_flags = NL80211_FLAG_NEED_WIPHY | 6634 .internal_flags = NL80211_FLAG_NEED_WIPHY |
6605 NL80211_FLAG_NEED_RTNL, 6635 NL80211_FLAG_NEED_RTNL,
6606 }, 6636 },
6637 {
6638 .cmd = NL80211_CMD_SET_NOACK_MAP,
6639 .doit = nl80211_set_noack_map,
6640 .policy = nl80211_policy,
6641 .flags = GENL_ADMIN_PERM,
6642 .internal_flags = NL80211_FLAG_NEED_NETDEV |
6643 NL80211_FLAG_NEED_RTNL,
6644 },
6645
6607}; 6646};
6608 6647
6609static struct genl_multicast_group nl80211_mlme_mcgrp = { 6648static struct genl_multicast_group nl80211_mlme_mcgrp = {
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 76b35df39623..70b171a52aea 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -57,8 +57,17 @@
57#define REG_DBG_PRINT(args...) 57#define REG_DBG_PRINT(args...)
58#endif 58#endif
59 59
60static struct regulatory_request core_request_world = {
61 .initiator = NL80211_REGDOM_SET_BY_CORE,
62 .alpha2[0] = '0',
63 .alpha2[1] = '0',
64 .intersect = false,
65 .processed = true,
66 .country_ie_env = ENVIRON_ANY,
67};
68
60/* Receipt of information from last regulatory request */ 69/* Receipt of information from last regulatory request */
61static struct regulatory_request *last_request; 70static struct regulatory_request *last_request = &core_request_world;
62 71
63/* To trigger userspace events */ 72/* To trigger userspace events */
64static struct platform_device *reg_pdev; 73static struct platform_device *reg_pdev;
@@ -150,7 +159,7 @@ static char user_alpha2[2];
150module_param(ieee80211_regdom, charp, 0444); 159module_param(ieee80211_regdom, charp, 0444);
151MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); 160MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code");
152 161
153static void reset_regdomains(void) 162static void reset_regdomains(bool full_reset)
154{ 163{
155 /* avoid freeing static information or freeing something twice */ 164 /* avoid freeing static information or freeing something twice */
156 if (cfg80211_regdomain == cfg80211_world_regdom) 165 if (cfg80211_regdomain == cfg80211_world_regdom)
@@ -165,6 +174,13 @@ static void reset_regdomains(void)
165 174
166 cfg80211_world_regdom = &world_regdom; 175 cfg80211_world_regdom = &world_regdom;
167 cfg80211_regdomain = NULL; 176 cfg80211_regdomain = NULL;
177
178 if (!full_reset)
179 return;
180
181 if (last_request != &core_request_world)
182 kfree(last_request);
183 last_request = &core_request_world;
168} 184}
169 185
170/* 186/*
@@ -175,7 +191,7 @@ static void update_world_regdomain(const struct ieee80211_regdomain *rd)
175{ 191{
176 BUG_ON(!last_request); 192 BUG_ON(!last_request);
177 193
178 reset_regdomains(); 194 reset_regdomains(false);
179 195
180 cfg80211_world_regdom = rd; 196 cfg80211_world_regdom = rd;
181 cfg80211_regdomain = rd; 197 cfg80211_regdomain = rd;
@@ -1409,7 +1425,8 @@ static int __regulatory_hint(struct wiphy *wiphy,
1409 } 1425 }
1410 1426
1411new_request: 1427new_request:
1412 kfree(last_request); 1428 if (last_request != &core_request_world)
1429 kfree(last_request);
1413 1430
1414 last_request = pending_request; 1431 last_request = pending_request;
1415 last_request->intersect = intersect; 1432 last_request->intersect = intersect;
@@ -1579,9 +1596,6 @@ static int regulatory_hint_core(const char *alpha2)
1579{ 1596{
1580 struct regulatory_request *request; 1597 struct regulatory_request *request;
1581 1598
1582 kfree(last_request);
1583 last_request = NULL;
1584
1585 request = kzalloc(sizeof(struct regulatory_request), 1599 request = kzalloc(sizeof(struct regulatory_request),
1586 GFP_KERNEL); 1600 GFP_KERNEL);
1587 if (!request) 1601 if (!request)
@@ -1779,7 +1793,7 @@ static void restore_regulatory_settings(bool reset_user)
1779 mutex_lock(&cfg80211_mutex); 1793 mutex_lock(&cfg80211_mutex);
1780 mutex_lock(&reg_mutex); 1794 mutex_lock(&reg_mutex);
1781 1795
1782 reset_regdomains(); 1796 reset_regdomains(true);
1783 restore_alpha2(alpha2, reset_user); 1797 restore_alpha2(alpha2, reset_user);
1784 1798
1785 /* 1799 /*
@@ -2076,8 +2090,10 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2076 } 2090 }
2077 2091
2078 request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); 2092 request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
2079 if (!request_wiphy) { 2093 if (!request_wiphy &&
2080 reg_set_request_processed(); 2094 (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER ||
2095 last_request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE)) {
2096 schedule_delayed_work(&reg_timeout, 0);
2081 return -ENODEV; 2097 return -ENODEV;
2082 } 2098 }
2083 2099
@@ -2085,7 +2101,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2085 int r; 2101 int r;
2086 2102
2087 if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) { 2103 if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) {
2088 reset_regdomains(); 2104 reset_regdomains(false);
2089 cfg80211_regdomain = rd; 2105 cfg80211_regdomain = rd;
2090 return 0; 2106 return 0;
2091 } 2107 }
@@ -2106,7 +2122,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2106 if (r) 2122 if (r)
2107 return r; 2123 return r;
2108 2124
2109 reset_regdomains(); 2125 reset_regdomains(false);
2110 cfg80211_regdomain = rd; 2126 cfg80211_regdomain = rd;
2111 return 0; 2127 return 0;
2112 } 2128 }
@@ -2131,7 +2147,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2131 2147
2132 rd = NULL; 2148 rd = NULL;
2133 2149
2134 reset_regdomains(); 2150 reset_regdomains(false);
2135 cfg80211_regdomain = intersected_rd; 2151 cfg80211_regdomain = intersected_rd;
2136 2152
2137 return 0; 2153 return 0;
@@ -2151,7 +2167,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2151 kfree(rd); 2167 kfree(rd);
2152 rd = NULL; 2168 rd = NULL;
2153 2169
2154 reset_regdomains(); 2170 reset_regdomains(false);
2155 cfg80211_regdomain = intersected_rd; 2171 cfg80211_regdomain = intersected_rd;
2156 2172
2157 return 0; 2173 return 0;
@@ -2304,11 +2320,8 @@ void /* __init_or_exit */ regulatory_exit(void)
2304 mutex_lock(&cfg80211_mutex); 2320 mutex_lock(&cfg80211_mutex);
2305 mutex_lock(&reg_mutex); 2321 mutex_lock(&reg_mutex);
2306 2322
2307 reset_regdomains(); 2323 reset_regdomains(true);
2308
2309 kfree(last_request);
2310 2324
2311 last_request = NULL;
2312 dev_set_uevent_suppress(&reg_pdev->dev, true); 2325 dev_set_uevent_suppress(&reg_pdev->dev, true);
2313 2326
2314 platform_device_unregister(reg_pdev); 2327 platform_device_unregister(reg_pdev);