aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/dvm
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2013-08-02 15:37:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-08-02 15:37:34 -0400
commit204162296edf0d0ac3e4dfd5bd0cac4af731b583 (patch)
treefdf941fd23fae6097500db4998d4ca96467fc352 /drivers/net/wireless/iwlwifi/dvm
parente3d5291436ff9efeeb968459724af5332305dded (diff)
parent147fc9be81d10e6e863323c0b54e140b42fd1ed6 (diff)
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next
Diffstat (limited to 'drivers/net/wireless/iwlwifi/dvm')
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/agn.h6
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/debugfs.c15
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/dev.h7
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/mac80211.c172
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/main.c62
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rs.c3
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rxon.c6
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/scan.c105
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/tx.c19
9 files changed, 3 insertions, 392 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/agn.h b/drivers/net/wireless/iwlwifi/dvm/agn.h
index 18355110deff..f2a86ffc3b4c 100644
--- a/drivers/net/wireless/iwlwifi/dvm/agn.h
+++ b/drivers/net/wireless/iwlwifi/dvm/agn.h
@@ -106,7 +106,6 @@ extern const struct iwl_dvm_cfg iwl_dvm_6030_cfg;
106#define STATUS_CHANNEL_SWITCH_PENDING 11 106#define STATUS_CHANNEL_SWITCH_PENDING 11
107#define STATUS_SCAN_COMPLETE 12 107#define STATUS_SCAN_COMPLETE 12
108#define STATUS_POWER_PMI 13 108#define STATUS_POWER_PMI 13
109#define STATUS_SCAN_ROC_EXPIRED 14
110 109
111struct iwl_ucode_capabilities; 110struct iwl_ucode_capabilities;
112 111
@@ -250,7 +249,6 @@ u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx, u8 valid);
250 249
251/* scan */ 250/* scan */
252void iwlagn_post_scan(struct iwl_priv *priv); 251void iwlagn_post_scan(struct iwl_priv *priv);
253void iwlagn_disable_roc(struct iwl_priv *priv);
254int iwl_force_rf_reset(struct iwl_priv *priv, bool external); 252int iwl_force_rf_reset(struct iwl_priv *priv, bool external);
255void iwl_init_scan_params(struct iwl_priv *priv); 253void iwl_init_scan_params(struct iwl_priv *priv);
256int iwl_scan_cancel(struct iwl_priv *priv); 254int iwl_scan_cancel(struct iwl_priv *priv);
@@ -265,10 +263,6 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
265 enum iwl_scan_type scan_type, 263 enum iwl_scan_type scan_type,
266 enum ieee80211_band band); 264 enum ieee80211_band band);
267 265
268void iwl_scan_roc_expired(struct iwl_priv *priv);
269void iwl_scan_offchannel_skb(struct iwl_priv *priv);
270void iwl_scan_offchannel_skb_status(struct iwl_priv *priv);
271
272/* For faster active scanning, scan will move to the next channel if fewer than 266/* For faster active scanning, scan will move to the next channel if fewer than
273 * PLCP_QUIET_THRESH packets are heard on this channel within 267 * PLCP_QUIET_THRESH packets are heard on this channel within
274 * ACTIVE_QUIET_TIME after sending probe request. This shortens the dwell 268 * ACTIVE_QUIET_TIME after sending probe request. This shortens the dwell
diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
index d5329489245a..d94f8ab15004 100644
--- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
@@ -69,19 +69,7 @@
69} while (0) 69} while (0)
70 70
71/* file operation */ 71/* file operation */
72#define DEBUGFS_READ_FUNC(name) \
73static ssize_t iwl_dbgfs_##name##_read(struct file *file, \
74 char __user *user_buf, \
75 size_t count, loff_t *ppos);
76
77#define DEBUGFS_WRITE_FUNC(name) \
78static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
79 const char __user *user_buf, \
80 size_t count, loff_t *ppos);
81
82
83#define DEBUGFS_READ_FILE_OPS(name) \ 72#define DEBUGFS_READ_FILE_OPS(name) \
84 DEBUGFS_READ_FUNC(name); \
85static const struct file_operations iwl_dbgfs_##name##_ops = { \ 73static const struct file_operations iwl_dbgfs_##name##_ops = { \
86 .read = iwl_dbgfs_##name##_read, \ 74 .read = iwl_dbgfs_##name##_read, \
87 .open = simple_open, \ 75 .open = simple_open, \
@@ -89,7 +77,6 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
89}; 77};
90 78
91#define DEBUGFS_WRITE_FILE_OPS(name) \ 79#define DEBUGFS_WRITE_FILE_OPS(name) \
92 DEBUGFS_WRITE_FUNC(name); \
93static const struct file_operations iwl_dbgfs_##name##_ops = { \ 80static const struct file_operations iwl_dbgfs_##name##_ops = { \
94 .write = iwl_dbgfs_##name##_write, \ 81 .write = iwl_dbgfs_##name##_write, \
95 .open = simple_open, \ 82 .open = simple_open, \
@@ -98,8 +85,6 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
98 85
99 86
100#define DEBUGFS_READ_WRITE_FILE_OPS(name) \ 87#define DEBUGFS_READ_WRITE_FILE_OPS(name) \
101 DEBUGFS_READ_FUNC(name); \
102 DEBUGFS_WRITE_FUNC(name); \
103static const struct file_operations iwl_dbgfs_##name##_ops = { \ 88static const struct file_operations iwl_dbgfs_##name##_ops = { \
104 .write = iwl_dbgfs_##name##_write, \ 89 .write = iwl_dbgfs_##name##_write, \
105 .read = iwl_dbgfs_##name##_read, \ 90 .read = iwl_dbgfs_##name##_read, \
diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h
index 60a4e0d15715..a79fdd137f95 100644
--- a/drivers/net/wireless/iwlwifi/dvm/dev.h
+++ b/drivers/net/wireless/iwlwifi/dvm/dev.h
@@ -540,7 +540,6 @@ struct iwl_rxon_context {
540enum iwl_scan_type { 540enum iwl_scan_type {
541 IWL_SCAN_NORMAL, 541 IWL_SCAN_NORMAL,
542 IWL_SCAN_RADIO_RESET, 542 IWL_SCAN_RADIO_RESET,
543 IWL_SCAN_ROC,
544}; 543};
545 544
546/** 545/**
@@ -825,12 +824,6 @@ struct iwl_priv {
825 struct reply_tx_error_statistics reply_tx_stats; 824 struct reply_tx_error_statistics reply_tx_stats;
826 struct reply_agg_tx_error_statistics reply_agg_tx_stats; 825 struct reply_agg_tx_error_statistics reply_agg_tx_stats;
827 826
828 /* remain-on-channel offload support */
829 struct ieee80211_channel *hw_roc_channel;
830 struct delayed_work hw_roc_disable_work;
831 int hw_roc_duration;
832 bool hw_roc_setup, hw_roc_start_notified;
833
834 /* bt coex */ 827 /* bt coex */
835 u8 bt_enable_flag; 828 u8 bt_enable_flag;
836 u8 bt_status; 829 u8 bt_status;
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index 822f1a00efbb..f0a2c957d503 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -76,29 +76,6 @@ static const struct ieee80211_iface_limit iwlagn_2sta_limits[] = {
76 }, 76 },
77}; 77};
78 78
79static const struct ieee80211_iface_limit iwlagn_p2p_sta_go_limits[] = {
80 {
81 .max = 1,
82 .types = BIT(NL80211_IFTYPE_STATION),
83 },
84 {
85 .max = 1,
86 .types = BIT(NL80211_IFTYPE_P2P_GO) |
87 BIT(NL80211_IFTYPE_AP),
88 },
89};
90
91static const struct ieee80211_iface_limit iwlagn_p2p_2sta_limits[] = {
92 {
93 .max = 2,
94 .types = BIT(NL80211_IFTYPE_STATION),
95 },
96 {
97 .max = 1,
98 .types = BIT(NL80211_IFTYPE_P2P_CLIENT),
99 },
100};
101
102static const struct ieee80211_iface_combination 79static const struct ieee80211_iface_combination
103iwlagn_iface_combinations_dualmode[] = { 80iwlagn_iface_combinations_dualmode[] = {
104 { .num_different_channels = 1, 81 { .num_different_channels = 1,
@@ -114,21 +91,6 @@ iwlagn_iface_combinations_dualmode[] = {
114 }, 91 },
115}; 92};
116 93
117static const struct ieee80211_iface_combination
118iwlagn_iface_combinations_p2p[] = {
119 { .num_different_channels = 1,
120 .max_interfaces = 2,
121 .beacon_int_infra_match = true,
122 .limits = iwlagn_p2p_sta_go_limits,
123 .n_limits = ARRAY_SIZE(iwlagn_p2p_sta_go_limits),
124 },
125 { .num_different_channels = 1,
126 .max_interfaces = 2,
127 .limits = iwlagn_p2p_2sta_limits,
128 .n_limits = ARRAY_SIZE(iwlagn_p2p_2sta_limits),
129 },
130};
131
132/* 94/*
133 * Not a mac80211 entry point function, but it fits in with all the 95 * Not a mac80211 entry point function, but it fits in with all the
134 * other mac80211 functions grouped here. 96 * other mac80211 functions grouped here.
@@ -186,19 +148,13 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
186 148
187 BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); 149 BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
188 150
189 if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) { 151 if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) {
190 hw->wiphy->iface_combinations = iwlagn_iface_combinations_p2p;
191 hw->wiphy->n_iface_combinations =
192 ARRAY_SIZE(iwlagn_iface_combinations_p2p);
193 } else if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) {
194 hw->wiphy->iface_combinations = 152 hw->wiphy->iface_combinations =
195 iwlagn_iface_combinations_dualmode; 153 iwlagn_iface_combinations_dualmode;
196 hw->wiphy->n_iface_combinations = 154 hw->wiphy->n_iface_combinations =
197 ARRAY_SIZE(iwlagn_iface_combinations_dualmode); 155 ARRAY_SIZE(iwlagn_iface_combinations_dualmode);
198 } 156 }
199 157
200 hw->wiphy->max_remain_on_channel_duration = 500;
201
202 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | 158 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
203 WIPHY_FLAG_DISABLE_BEACON_HINTS | 159 WIPHY_FLAG_DISABLE_BEACON_HINTS |
204 WIPHY_FLAG_IBSS_RSN; 160 WIPHY_FLAG_IBSS_RSN;
@@ -1156,126 +1112,6 @@ done:
1156 IWL_DEBUG_MAC80211(priv, "leave\n"); 1112 IWL_DEBUG_MAC80211(priv, "leave\n");
1157} 1113}
1158 1114
1159static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw,
1160 struct ieee80211_vif *vif,
1161 struct ieee80211_channel *channel,
1162 int duration,
1163 enum ieee80211_roc_type type)
1164{
1165 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1166 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_PAN];
1167 int err = 0;
1168
1169 if (!(priv->valid_contexts & BIT(IWL_RXON_CTX_PAN)))
1170 return -EOPNOTSUPP;
1171
1172 if (!(ctx->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)))
1173 return -EOPNOTSUPP;
1174
1175 IWL_DEBUG_MAC80211(priv, "enter\n");
1176 mutex_lock(&priv->mutex);
1177
1178 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
1179 /* mac80211 should not scan while ROC or ROC while scanning */
1180 if (WARN_ON_ONCE(priv->scan_type != IWL_SCAN_RADIO_RESET)) {
1181 err = -EBUSY;
1182 goto out;
1183 }
1184
1185 iwl_scan_cancel_timeout(priv, 100);
1186
1187 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
1188 err = -EBUSY;
1189 goto out;
1190 }
1191 }
1192
1193 priv->hw_roc_channel = channel;
1194 /* convert from ms to TU */
1195 priv->hw_roc_duration = DIV_ROUND_UP(1000 * duration, 1024);
1196 priv->hw_roc_start_notified = false;
1197 cancel_delayed_work(&priv->hw_roc_disable_work);
1198
1199 if (!ctx->is_active) {
1200 static const struct iwl_qos_info default_qos_data = {
1201 .def_qos_parm = {
1202 .ac[0] = {
1203 .cw_min = cpu_to_le16(3),
1204 .cw_max = cpu_to_le16(7),
1205 .aifsn = 2,
1206 .edca_txop = cpu_to_le16(1504),
1207 },
1208 .ac[1] = {
1209 .cw_min = cpu_to_le16(7),
1210 .cw_max = cpu_to_le16(15),
1211 .aifsn = 2,
1212 .edca_txop = cpu_to_le16(3008),
1213 },
1214 .ac[2] = {
1215 .cw_min = cpu_to_le16(15),
1216 .cw_max = cpu_to_le16(1023),
1217 .aifsn = 3,
1218 },
1219 .ac[3] = {
1220 .cw_min = cpu_to_le16(15),
1221 .cw_max = cpu_to_le16(1023),
1222 .aifsn = 7,
1223 },
1224 },
1225 };
1226
1227 ctx->is_active = true;
1228 ctx->qos_data = default_qos_data;
1229 ctx->staging.dev_type = RXON_DEV_TYPE_P2P;
1230 memcpy(ctx->staging.node_addr,
1231 priv->contexts[IWL_RXON_CTX_BSS].staging.node_addr,
1232 ETH_ALEN);
1233 memcpy(ctx->staging.bssid_addr,
1234 priv->contexts[IWL_RXON_CTX_BSS].staging.node_addr,
1235 ETH_ALEN);
1236 err = iwlagn_commit_rxon(priv, ctx);
1237 if (err)
1238 goto out;
1239 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK |
1240 RXON_FILTER_PROMISC_MSK |
1241 RXON_FILTER_CTL2HOST_MSK;
1242
1243 err = iwlagn_commit_rxon(priv, ctx);
1244 if (err) {
1245 iwlagn_disable_roc(priv);
1246 goto out;
1247 }
1248 priv->hw_roc_setup = true;
1249 }
1250
1251 err = iwl_scan_initiate(priv, ctx->vif, IWL_SCAN_ROC, channel->band);
1252 if (err)
1253 iwlagn_disable_roc(priv);
1254
1255 out:
1256 mutex_unlock(&priv->mutex);
1257 IWL_DEBUG_MAC80211(priv, "leave\n");
1258
1259 return err;
1260}
1261
1262static int iwlagn_mac_cancel_remain_on_channel(struct ieee80211_hw *hw)
1263{
1264 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1265
1266 if (!(priv->valid_contexts & BIT(IWL_RXON_CTX_PAN)))
1267 return -EOPNOTSUPP;
1268
1269 IWL_DEBUG_MAC80211(priv, "enter\n");
1270 mutex_lock(&priv->mutex);
1271 iwl_scan_cancel_timeout(priv, priv->hw_roc_duration);
1272 iwlagn_disable_roc(priv);
1273 mutex_unlock(&priv->mutex);
1274 IWL_DEBUG_MAC80211(priv, "leave\n");
1275
1276 return 0;
1277}
1278
1279static void iwlagn_mac_rssi_callback(struct ieee80211_hw *hw, 1115static void iwlagn_mac_rssi_callback(struct ieee80211_hw *hw,
1280 struct ieee80211_vif *vif, 1116 struct ieee80211_vif *vif,
1281 enum ieee80211_rssi_event rssi_event) 1117 enum ieee80211_rssi_event rssi_event)
@@ -1431,12 +1267,8 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
1431 IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", 1267 IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n",
1432 viftype, vif->addr); 1268 viftype, vif->addr);
1433 1269
1434 cancel_delayed_work_sync(&priv->hw_roc_disable_work);
1435
1436 mutex_lock(&priv->mutex); 1270 mutex_lock(&priv->mutex);
1437 1271
1438 iwlagn_disable_roc(priv);
1439
1440 if (!iwl_is_ready_rf(priv)) { 1272 if (!iwl_is_ready_rf(priv)) {
1441 IWL_WARN(priv, "Try to add interface when device not ready\n"); 1273 IWL_WARN(priv, "Try to add interface when device not ready\n");
1442 err = -EINVAL; 1274 err = -EINVAL;
@@ -1763,8 +1595,6 @@ struct ieee80211_ops iwlagn_hw_ops = {
1763 .channel_switch = iwlagn_mac_channel_switch, 1595 .channel_switch = iwlagn_mac_channel_switch,
1764 .flush = iwlagn_mac_flush, 1596 .flush = iwlagn_mac_flush,
1765 .tx_last_beacon = iwlagn_mac_tx_last_beacon, 1597 .tx_last_beacon = iwlagn_mac_tx_last_beacon,
1766 .remain_on_channel = iwlagn_mac_remain_on_channel,
1767 .cancel_remain_on_channel = iwlagn_mac_cancel_remain_on_channel,
1768 .rssi_callback = iwlagn_mac_rssi_callback, 1598 .rssi_callback = iwlagn_mac_rssi_callback,
1769 .set_tim = iwlagn_mac_set_tim, 1599 .set_tim = iwlagn_mac_set_tim,
1770}; 1600};
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c
index 1531a4fc0960..7aad766865cf 100644
--- a/drivers/net/wireless/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/iwlwifi/dvm/main.c
@@ -587,11 +587,6 @@ static void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags)
587 priv->contexts[IWL_RXON_CTX_PAN].interface_modes = 587 priv->contexts[IWL_RXON_CTX_PAN].interface_modes =
588 BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP); 588 BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP);
589 589
590 if (ucode_flags & IWL_UCODE_TLV_FLAGS_P2P)
591 priv->contexts[IWL_RXON_CTX_PAN].interface_modes |=
592 BIT(NL80211_IFTYPE_P2P_CLIENT) |
593 BIT(NL80211_IFTYPE_P2P_GO);
594
595 priv->contexts[IWL_RXON_CTX_PAN].ap_devtype = RXON_DEV_TYPE_CP; 590 priv->contexts[IWL_RXON_CTX_PAN].ap_devtype = RXON_DEV_TYPE_CP;
596 priv->contexts[IWL_RXON_CTX_PAN].station_devtype = RXON_DEV_TYPE_2STA; 591 priv->contexts[IWL_RXON_CTX_PAN].station_devtype = RXON_DEV_TYPE_2STA;
597 priv->contexts[IWL_RXON_CTX_PAN].unused_devtype = RXON_DEV_TYPE_P2P; 592 priv->contexts[IWL_RXON_CTX_PAN].unused_devtype = RXON_DEV_TYPE_P2P;
@@ -854,14 +849,6 @@ void iwl_down(struct iwl_priv *priv)
854 849
855 iwl_scan_cancel_timeout(priv, 200); 850 iwl_scan_cancel_timeout(priv, 200);
856 851
857 /*
858 * If active, scanning won't cancel it, so say it expired.
859 * No race since we hold the mutex here and a new one
860 * can't come in at this time.
861 */
862 if (priv->ucode_loaded && priv->cur_ucode != IWL_UCODE_INIT)
863 ieee80211_remain_on_channel_expired(priv->hw);
864
865 exit_pending = 852 exit_pending =
866 test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); 853 test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
867 854
@@ -1002,41 +989,6 @@ static void iwl_bg_restart(struct work_struct *data)
1002 } 989 }
1003} 990}
1004 991
1005
1006
1007
1008void iwlagn_disable_roc(struct iwl_priv *priv)
1009{
1010 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_PAN];
1011
1012 lockdep_assert_held(&priv->mutex);
1013
1014 if (!priv->hw_roc_setup)
1015 return;
1016
1017 ctx->staging.dev_type = RXON_DEV_TYPE_P2P;
1018 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1019
1020 priv->hw_roc_channel = NULL;
1021
1022 memset(ctx->staging.node_addr, 0, ETH_ALEN);
1023
1024 iwlagn_commit_rxon(priv, ctx);
1025
1026 ctx->is_active = false;
1027 priv->hw_roc_setup = false;
1028}
1029
1030static void iwlagn_disable_roc_work(struct work_struct *work)
1031{
1032 struct iwl_priv *priv = container_of(work, struct iwl_priv,
1033 hw_roc_disable_work.work);
1034
1035 mutex_lock(&priv->mutex);
1036 iwlagn_disable_roc(priv);
1037 mutex_unlock(&priv->mutex);
1038}
1039
1040/***************************************************************************** 992/*****************************************************************************
1041 * 993 *
1042 * driver setup and teardown 994 * driver setup and teardown
@@ -1053,8 +1005,6 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)
1053 INIT_WORK(&priv->tx_flush, iwl_bg_tx_flush); 1005 INIT_WORK(&priv->tx_flush, iwl_bg_tx_flush);
1054 INIT_WORK(&priv->bt_full_concurrency, iwl_bg_bt_full_concurrency); 1006 INIT_WORK(&priv->bt_full_concurrency, iwl_bg_bt_full_concurrency);
1055 INIT_WORK(&priv->bt_runtime_config, iwl_bg_bt_runtime_config); 1007 INIT_WORK(&priv->bt_runtime_config, iwl_bg_bt_runtime_config);
1056 INIT_DELAYED_WORK(&priv->hw_roc_disable_work,
1057 iwlagn_disable_roc_work);
1058 1008
1059 iwl_setup_scan_deferred_work(priv); 1009 iwl_setup_scan_deferred_work(priv);
1060 1010
@@ -1082,7 +1032,6 @@ void iwl_cancel_deferred_work(struct iwl_priv *priv)
1082 1032
1083 cancel_work_sync(&priv->bt_full_concurrency); 1033 cancel_work_sync(&priv->bt_full_concurrency);
1084 cancel_work_sync(&priv->bt_runtime_config); 1034 cancel_work_sync(&priv->bt_runtime_config);
1085 cancel_delayed_work_sync(&priv->hw_roc_disable_work);
1086 1035
1087 del_timer_sync(&priv->statistics_periodic); 1036 del_timer_sync(&priv->statistics_periodic);
1088 del_timer_sync(&priv->ucode_trace); 1037 del_timer_sync(&priv->ucode_trace);
@@ -1169,12 +1118,6 @@ static void iwl_option_config(struct iwl_priv *priv)
1169#else 1118#else
1170 IWL_INFO(priv, "CONFIG_IWLWIFI_DEVICE_TRACING disabled\n"); 1119 IWL_INFO(priv, "CONFIG_IWLWIFI_DEVICE_TRACING disabled\n");
1171#endif 1120#endif
1172
1173#ifdef CONFIG_IWLWIFI_P2P
1174 IWL_INFO(priv, "CONFIG_IWLWIFI_P2P enabled\n");
1175#else
1176 IWL_INFO(priv, "CONFIG_IWLWIFI_P2P disabled\n");
1177#endif
1178} 1121}
1179 1122
1180static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) 1123static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
@@ -1315,10 +1258,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1315 1258
1316 ucode_flags = fw->ucode_capa.flags; 1259 ucode_flags = fw->ucode_capa.flags;
1317 1260
1318#ifndef CONFIG_IWLWIFI_P2P
1319 ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
1320#endif
1321
1322 if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) { 1261 if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) {
1323 priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN; 1262 priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
1324 trans_cfg.cmd_queue = IWL_IPAN_CMD_QUEUE_NUM; 1263 trans_cfg.cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
@@ -1413,7 +1352,6 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1413 * if not PAN, then don't support P2P -- might be a uCode 1352 * if not PAN, then don't support P2P -- might be a uCode
1414 * packaging bug or due to the eeprom check above 1353 * packaging bug or due to the eeprom check above
1415 */ 1354 */
1416 ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P;
1417 priv->sta_key_max_num = STA_KEY_MAX_NUM; 1355 priv->sta_key_max_num = STA_KEY_MAX_NUM;
1418 trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; 1356 trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
1419 1357
diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.c b/drivers/net/wireless/iwlwifi/dvm/rs.c
index 91eb09b9b56f..b647e506564c 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rs.c
@@ -2826,9 +2826,6 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
2826 2826
2827 lq_sta->flush_timer = 0; 2827 lq_sta->flush_timer = 0;
2828 lq_sta->supp_rates = sta->supp_rates[sband->band]; 2828 lq_sta->supp_rates = sta->supp_rates[sband->band];
2829 for (j = 0; j < LQ_SIZE; j++)
2830 for (i = 0; i < IWL_RATE_COUNT; i++)
2831 rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
2832 2829
2833 IWL_DEBUG_RATE(priv, "LQ: *** rate scale station global init for station %d ***\n", 2830 IWL_DEBUG_RATE(priv, "LQ: *** rate scale station global init for station %d ***\n",
2834 sta_id); 2831 sta_id);
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
index cd1ad0019185..d7ce2f12a907 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
@@ -564,11 +564,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
564 cmd.slots[0].type = 0; /* BSS */ 564 cmd.slots[0].type = 0; /* BSS */
565 cmd.slots[1].type = 1; /* PAN */ 565 cmd.slots[1].type = 1; /* PAN */
566 566
567 if (priv->hw_roc_setup) { 567 if (ctx_bss->vif && ctx_pan->vif) {
568 /* both contexts must be used for this to happen */
569 slot1 = IWL_MIN_SLOT_TIME;
570 slot0 = 3000;
571 } else if (ctx_bss->vif && ctx_pan->vif) {
572 int bcnint = ctx_pan->beacon_int; 568 int bcnint = ctx_pan->beacon_int;
573 int dtim = ctx_pan->vif->bss_conf.dtim_period ?: 1; 569 int dtim = ctx_pan->vif->bss_conf.dtim_period ?: 1;
574 570
diff --git a/drivers/net/wireless/iwlwifi/dvm/scan.c b/drivers/net/wireless/iwlwifi/dvm/scan.c
index 8c686a5b90ac..35e0ee8b4e5b 100644
--- a/drivers/net/wireless/iwlwifi/dvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/dvm/scan.c
@@ -100,9 +100,6 @@ static void iwl_complete_scan(struct iwl_priv *priv, bool aborted)
100 ieee80211_scan_completed(priv->hw, aborted); 100 ieee80211_scan_completed(priv->hw, aborted);
101 } 101 }
102 102
103 if (priv->scan_type == IWL_SCAN_ROC)
104 iwl_scan_roc_expired(priv);
105
106 priv->scan_type = IWL_SCAN_NORMAL; 103 priv->scan_type = IWL_SCAN_NORMAL;
107 priv->scan_vif = NULL; 104 priv->scan_vif = NULL;
108 priv->scan_request = NULL; 105 priv->scan_request = NULL;
@@ -130,9 +127,6 @@ static void iwl_process_scan_complete(struct iwl_priv *priv)
130 goto out_settings; 127 goto out_settings;
131 } 128 }
132 129
133 if (priv->scan_type == IWL_SCAN_ROC)
134 iwl_scan_roc_expired(priv);
135
136 if (priv->scan_type != IWL_SCAN_NORMAL && !aborted) { 130 if (priv->scan_type != IWL_SCAN_NORMAL && !aborted) {
137 int err; 131 int err;
138 132
@@ -284,12 +278,6 @@ static int iwl_rx_scan_start_notif(struct iwl_priv *priv,
284 le32_to_cpu(notif->tsf_low), 278 le32_to_cpu(notif->tsf_low),
285 notif->status, notif->beacon_timer); 279 notif->status, notif->beacon_timer);
286 280
287 if (priv->scan_type == IWL_SCAN_ROC &&
288 !priv->hw_roc_start_notified) {
289 ieee80211_ready_on_channel(priv->hw);
290 priv->hw_roc_start_notified = true;
291 }
292
293 return 0; 281 return 0;
294} 282}
295 283
@@ -697,8 +685,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
697 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 685 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
698 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; 686 scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
699 687
700 if (priv->scan_type != IWL_SCAN_ROC && 688 if (iwl_is_any_associated(priv)) {
701 iwl_is_any_associated(priv)) {
702 u16 interval = 0; 689 u16 interval = 0;
703 u32 extra; 690 u32 extra;
704 u32 suspend_time = 100; 691 u32 suspend_time = 100;
@@ -706,9 +693,6 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
706 693
707 IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); 694 IWL_DEBUG_INFO(priv, "Scanning while associated...\n");
708 switch (priv->scan_type) { 695 switch (priv->scan_type) {
709 case IWL_SCAN_ROC:
710 WARN_ON(1);
711 break;
712 case IWL_SCAN_RADIO_RESET: 696 case IWL_SCAN_RADIO_RESET:
713 interval = 0; 697 interval = 0;
714 break; 698 break;
@@ -728,11 +712,6 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
728 scan->suspend_time = cpu_to_le32(scan_suspend_time); 712 scan->suspend_time = cpu_to_le32(scan_suspend_time);
729 IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", 713 IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n",
730 scan_suspend_time, interval); 714 scan_suspend_time, interval);
731 } else if (priv->scan_type == IWL_SCAN_ROC) {
732 scan->suspend_time = 0;
733 scan->max_out_time = 0;
734 scan->quiet_time = 0;
735 scan->quiet_plcp_th = 0;
736 } 715 }
737 716
738 switch (priv->scan_type) { 717 switch (priv->scan_type) {
@@ -774,9 +753,6 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
774 } else 753 } else
775 IWL_DEBUG_SCAN(priv, "Start passive scan.\n"); 754 IWL_DEBUG_SCAN(priv, "Start passive scan.\n");
776 break; 755 break;
777 case IWL_SCAN_ROC:
778 IWL_DEBUG_SCAN(priv, "Start ROC scan.\n");
779 break;
780 } 756 }
781 757
782 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 758 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
@@ -898,7 +874,6 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
898 scan_cmd_size - sizeof(*scan)); 874 scan_cmd_size - sizeof(*scan));
899 break; 875 break;
900 case IWL_SCAN_RADIO_RESET: 876 case IWL_SCAN_RADIO_RESET:
901 case IWL_SCAN_ROC:
902 /* use bcast addr, will not be transmitted but must be valid */ 877 /* use bcast addr, will not be transmitted but must be valid */
903 cmd_len = iwl_fill_probe_req( 878 cmd_len = iwl_fill_probe_req(
904 (struct ieee80211_mgmt *)scan->data, 879 (struct ieee80211_mgmt *)scan->data,
@@ -926,46 +901,6 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
926 is_active, n_probes, 901 is_active, n_probes,
927 (void *)&scan->data[cmd_len]); 902 (void *)&scan->data[cmd_len]);
928 break; 903 break;
929 case IWL_SCAN_ROC: {
930 struct iwl_scan_channel *scan_ch;
931 int n_chan, i;
932 u16 dwell;
933
934 dwell = iwl_limit_dwell(priv, priv->hw_roc_duration);
935 n_chan = DIV_ROUND_UP(priv->hw_roc_duration, dwell);
936
937 scan->channel_count = n_chan;
938
939 scan_ch = (void *)&scan->data[cmd_len];
940
941 for (i = 0; i < n_chan; i++) {
942 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
943 scan_ch->channel =
944 cpu_to_le16(priv->hw_roc_channel->hw_value);
945
946 if (i == n_chan - 1)
947 dwell = priv->hw_roc_duration - i * dwell;
948
949 scan_ch->active_dwell =
950 scan_ch->passive_dwell = cpu_to_le16(dwell);
951
952 /* Set txpower levels to defaults */
953 scan_ch->dsp_atten = 110;
954
955 /* NOTE: if we were doing 6Mb OFDM for scans we'd use
956 * power level:
957 * scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3;
958 */
959 if (priv->hw_roc_channel->band == IEEE80211_BAND_5GHZ)
960 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
961 else
962 scan_ch->tx_gain = ((1 << 5) | (5 << 3));
963
964 scan_ch++;
965 }
966 }
967
968 break;
969 } 904 }
970 905
971 if (scan->channel_count == 0) { 906 if (scan->channel_count == 0) {
@@ -1035,7 +970,6 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
1035 970
1036 IWL_DEBUG_SCAN(priv, "Starting %sscan...\n", 971 IWL_DEBUG_SCAN(priv, "Starting %sscan...\n",
1037 scan_type == IWL_SCAN_NORMAL ? "" : 972 scan_type == IWL_SCAN_NORMAL ? "" :
1038 scan_type == IWL_SCAN_ROC ? "remain-on-channel " :
1039 "internal short "); 973 "internal short ");
1040 974
1041 set_bit(STATUS_SCANNING, &priv->status); 975 set_bit(STATUS_SCANNING, &priv->status);
@@ -1149,40 +1083,3 @@ void iwl_cancel_scan_deferred_work(struct iwl_priv *priv)
1149 mutex_unlock(&priv->mutex); 1083 mutex_unlock(&priv->mutex);
1150 } 1084 }
1151} 1085}
1152
1153void iwl_scan_roc_expired(struct iwl_priv *priv)
1154{
1155 /*
1156 * The status bit should be set here, to prevent a race
1157 * where the atomic_read returns 1, but before the execution continues
1158 * iwl_scan_offchannel_skb_status() checks if the status bit is set
1159 */
1160 set_bit(STATUS_SCAN_ROC_EXPIRED, &priv->status);
1161
1162 if (atomic_read(&priv->num_aux_in_flight) == 0) {
1163 ieee80211_remain_on_channel_expired(priv->hw);
1164 priv->hw_roc_channel = NULL;
1165 schedule_delayed_work(&priv->hw_roc_disable_work,
1166 10 * HZ);
1167
1168 clear_bit(STATUS_SCAN_ROC_EXPIRED, &priv->status);
1169 } else {
1170 IWL_DEBUG_SCAN(priv, "ROC done with %d frames in aux\n",
1171 atomic_read(&priv->num_aux_in_flight));
1172 }
1173}
1174
1175void iwl_scan_offchannel_skb(struct iwl_priv *priv)
1176{
1177 WARN_ON(!priv->hw_roc_start_notified);
1178 atomic_inc(&priv->num_aux_in_flight);
1179}
1180
1181void iwl_scan_offchannel_skb_status(struct iwl_priv *priv)
1182{
1183 if (atomic_dec_return(&priv->num_aux_in_flight) == 0 &&
1184 test_bit(STATUS_SCAN_ROC_EXPIRED, &priv->status)) {
1185 IWL_DEBUG_SCAN(priv, "0 aux frames. Calling ROC expired\n");
1186 iwl_scan_roc_expired(priv);
1187 }
1188}
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c
index 5ee983faa679..3db0bbb1d123 100644
--- a/drivers/net/wireless/iwlwifi/dvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/dvm/tx.c
@@ -478,9 +478,6 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
478 if (sta_priv && sta_priv->client && !is_agg) 478 if (sta_priv && sta_priv->client && !is_agg)
479 atomic_inc(&sta_priv->pending_frames); 479 atomic_inc(&sta_priv->pending_frames);
480 480
481 if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN)
482 iwl_scan_offchannel_skb(priv);
483
484 return 0; 481 return 0;
485 482
486drop_unlock_sta: 483drop_unlock_sta:
@@ -1158,7 +1155,6 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1158 struct sk_buff *skb; 1155 struct sk_buff *skb;
1159 struct iwl_rxon_context *ctx; 1156 struct iwl_rxon_context *ctx;
1160 bool is_agg = (txq_id >= IWLAGN_FIRST_AMPDU_QUEUE); 1157 bool is_agg = (txq_id >= IWLAGN_FIRST_AMPDU_QUEUE);
1161 bool is_offchannel_skb;
1162 1158
1163 tid = (tx_resp->ra_tid & IWLAGN_TX_RES_TID_MSK) >> 1159 tid = (tx_resp->ra_tid & IWLAGN_TX_RES_TID_MSK) >>
1164 IWLAGN_TX_RES_TID_POS; 1160 IWLAGN_TX_RES_TID_POS;
@@ -1178,8 +1174,6 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1178 1174
1179 __skb_queue_head_init(&skbs); 1175 __skb_queue_head_init(&skbs);
1180 1176
1181 is_offchannel_skb = false;
1182
1183 if (tx_resp->frame_count == 1) { 1177 if (tx_resp->frame_count == 1) {
1184 u16 next_reclaimed = le16_to_cpu(tx_resp->seq_ctl); 1178 u16 next_reclaimed = le16_to_cpu(tx_resp->seq_ctl);
1185 next_reclaimed = IEEE80211_SEQ_TO_SN(next_reclaimed + 0x10); 1179 next_reclaimed = IEEE80211_SEQ_TO_SN(next_reclaimed + 0x10);
@@ -1256,8 +1250,6 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1256 if (!is_agg) 1250 if (!is_agg)
1257 iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1); 1251 iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1);
1258 1252
1259 is_offchannel_skb =
1260 (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN);
1261 freed++; 1253 freed++;
1262 } 1254 }
1263 1255
@@ -1271,14 +1263,6 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1271 if (!is_agg && freed != 1) 1263 if (!is_agg && freed != 1)
1272 IWL_ERR(priv, "Q: %d, freed %d\n", txq_id, freed); 1264 IWL_ERR(priv, "Q: %d, freed %d\n", txq_id, freed);
1273 1265
1274 /*
1275 * An offchannel frame can be send only on the AUX queue, where
1276 * there is no aggregation (and reordering) so it only is single
1277 * skb is expected to be processed.
1278 */
1279 if (is_offchannel_skb && freed != 1)
1280 IWL_ERR(priv, "OFFCHANNEL SKB freed %d\n", freed);
1281
1282 IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x)\n", txq_id, 1266 IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x)\n", txq_id,
1283 iwl_get_tx_fail_reason(status), status); 1267 iwl_get_tx_fail_reason(status), status);
1284 1268
@@ -1298,9 +1282,6 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1298 ieee80211_tx_status_ni(priv->hw, skb); 1282 ieee80211_tx_status_ni(priv->hw, skb);
1299 } 1283 }
1300 1284
1301 if (is_offchannel_skb)
1302 iwl_scan_offchannel_skb_status(priv);
1303
1304 return 0; 1285 return 0;
1305} 1286}
1306 1287