aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-27 12:44:50 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-08-27 12:47:46 -0400
commit52a02d1500e4cbb347006e407d1c0bd941eee7fc (patch)
tree23470c9edd120f05a0dd92a7a47fbd068c97c422 /drivers/net
parent08abc53cf4f7547ab3bc3957bc6e60c364a882c3 (diff)
iwlwifi: send PAN parameters
In order for the microcode to be able to handle multiple interfaces, we need to give it the PAN parameters that state how to allocate the time between the two interfaces. Do this, and update it wherever necessary. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c75
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c3
6 files changed, 96 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
index 2d4cdb027aa6..6fb52abafc8d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
@@ -270,12 +270,86 @@ static int iwlagn_calc_rssi(struct iwl_priv *priv,
270 return max_rssi - agc - IWLAGN_RSSI_OFFSET; 270 return max_rssi - agc - IWLAGN_RSSI_OFFSET;
271} 271}
272 272
273static int iwlagn_set_pan_params(struct iwl_priv *priv)
274{
275 struct iwl_wipan_params_cmd cmd;
276 struct iwl_rxon_context *ctx_bss, *ctx_pan;
277 int slot0 = 300, slot1 = 0;
278 int ret;
279
280 if (priv->valid_contexts == BIT(IWL_RXON_CTX_BSS))
281 return 0;
282
283 BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
284
285 lockdep_assert_held(&priv->mutex);
286
287 ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS];
288 ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN];
289
290 memset(&cmd, 0, sizeof(cmd));
291
292 /* only 2 slots are currently allowed */
293 cmd.num_slots = 2;
294
295 cmd.slots[0].type = 0; /* BSS */
296 cmd.slots[1].type = 1; /* PAN */
297
298 if (ctx_bss->vif && ctx_pan->vif) {
299 int bcnint = ctx_pan->vif->bss_conf.beacon_int;
300
301 /* should be set, but seems unused?? */
302 cmd.flags |= cpu_to_le16(IWL_WIPAN_PARAMS_FLG_SLOTTED_MODE);
303
304 if (ctx_pan->vif->type == NL80211_IFTYPE_AP &&
305 bcnint &&
306 bcnint != ctx_bss->vif->bss_conf.beacon_int) {
307 IWL_ERR(priv,
308 "beacon intervals don't match (%d, %d)\n",
309 ctx_bss->vif->bss_conf.beacon_int,
310 ctx_pan->vif->bss_conf.beacon_int);
311 } else
312 bcnint = max_t(int, bcnint,
313 ctx_bss->vif->bss_conf.beacon_int);
314 if (!bcnint)
315 bcnint = 100;
316 slot0 = bcnint / 2;
317 slot1 = bcnint - slot0;
318
319 if (test_bit(STATUS_SCAN_HW, &priv->status) ||
320 (!ctx_bss->vif->bss_conf.idle &&
321 !ctx_bss->vif->bss_conf.assoc)) {
322 slot0 = bcnint * 3 - 20;
323 slot1 = 20;
324 } else if (!ctx_pan->vif->bss_conf.idle &&
325 !ctx_pan->vif->bss_conf.assoc) {
326 slot1 = bcnint * 3 - 20;
327 slot0 = 20;
328 }
329 } else if (ctx_pan->vif) {
330 slot0 = 0;
331 slot1 = max_t(int, 1, ctx_pan->vif->bss_conf.dtim_period) *
332 ctx_pan->vif->bss_conf.beacon_int;
333 slot1 = max_t(int, 100, slot1);
334 }
335
336 cmd.slots[0].width = cpu_to_le16(slot0);
337 cmd.slots[1].width = cpu_to_le16(slot1);
338
339 ret = iwl_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, sizeof(cmd), &cmd);
340 if (ret)
341 IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret);
342
343 return ret;
344}
345
273struct iwl_hcmd_ops iwlagn_hcmd = { 346struct iwl_hcmd_ops iwlagn_hcmd = {
274 .rxon_assoc = iwlagn_send_rxon_assoc, 347 .rxon_assoc = iwlagn_send_rxon_assoc,
275 .commit_rxon = iwl_commit_rxon, 348 .commit_rxon = iwl_commit_rxon,
276 .set_rxon_chain = iwl_set_rxon_chain, 349 .set_rxon_chain = iwl_set_rxon_chain,
277 .set_tx_ant = iwlagn_send_tx_ant_config, 350 .set_tx_ant = iwlagn_send_tx_ant_config,
278 .send_bt_config = iwl_send_bt_config, 351 .send_bt_config = iwl_send_bt_config,
352 .set_pan_params = iwlagn_set_pan_params,
279}; 353};
280 354
281struct iwl_hcmd_ops iwlagn_bt_hcmd = { 355struct iwl_hcmd_ops iwlagn_bt_hcmd = {
@@ -284,6 +358,7 @@ struct iwl_hcmd_ops iwlagn_bt_hcmd = {
284 .set_rxon_chain = iwl_set_rxon_chain, 358 .set_rxon_chain = iwl_set_rxon_chain,
285 .set_tx_ant = iwlagn_send_tx_ant_config, 359 .set_tx_ant = iwlagn_send_tx_ant_config,
286 .send_bt_config = iwlagn_send_advance_bt_config, 360 .send_bt_config = iwlagn_send_advance_bt_config,
361 .set_pan_params = iwlagn_set_pan_params,
287}; 362};
288 363
289struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = { 364struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 7002d7d0fac4..a8f2adfd799e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1424,6 +1424,11 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
1424 scan->len = cpu_to_le16(cmd.len); 1424 scan->len = cpu_to_le16(cmd.len);
1425 1425
1426 set_bit(STATUS_SCAN_HW, &priv->status); 1426 set_bit(STATUS_SCAN_HW, &priv->status);
1427
1428 if (priv->cfg->ops->hcmd->set_pan_params &&
1429 priv->cfg->ops->hcmd->set_pan_params(priv))
1430 goto done;
1431
1427 if (iwl_send_cmd_sync(priv, &cmd)) 1432 if (iwl_send_cmd_sync(priv, &cmd))
1428 goto done; 1433 goto done;
1429 1434
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 8e0722830413..f2884b5ca5b4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -197,6 +197,12 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
197 } 197 }
198 } 198 }
199 199
200 if (priv->cfg->ops->hcmd->set_pan_params) {
201 ret = priv->cfg->ops->hcmd->set_pan_params(priv);
202 if (ret)
203 return ret;
204 }
205
200 /* Apply the new configuration 206 /* Apply the new configuration
201 * RXON unassoc clears the station table in uCode so restoration of 207 * RXON unassoc clears the station table in uCode so restoration of
202 * stations is needed after it (the RXON command) completes 208 * stations is needed after it (the RXON command) completes
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 04d7894e0004..b61b838a24b5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1931,6 +1931,12 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
1931 bss_conf->bssid); 1931 bss_conf->bssid);
1932 } 1932 }
1933 1933
1934 if (changes & BSS_CHANGED_IDLE &&
1935 priv->cfg->ops->hcmd->set_pan_params) {
1936 if (priv->cfg->ops->hcmd->set_pan_params(priv))
1937 IWL_ERR(priv, "failed to update PAN params\n");
1938 }
1939
1934 mutex_unlock(&priv->mutex); 1940 mutex_unlock(&priv->mutex);
1935 1941
1936 IWL_DEBUG_MAC80211(priv, "leave\n"); 1942 IWL_DEBUG_MAC80211(priv, "leave\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index d2ee55d6811d..ab465c5fd6f6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -94,6 +94,7 @@ struct iwl_hcmd_ops {
94 struct iwl_rxon_context *ctx); 94 struct iwl_rxon_context *ctx);
95 int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant); 95 int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant);
96 void (*send_bt_config)(struct iwl_priv *priv); 96 void (*send_bt_config)(struct iwl_priv *priv);
97 int (*set_pan_params)(struct iwl_priv *priv);
97}; 98};
98 99
99struct iwl_hcmd_utils_ops { 100struct iwl_hcmd_utils_ops {
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 556dcaaa0efe..7727f0966d31 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -572,6 +572,9 @@ static void iwl_bg_scan_completed(struct work_struct *work)
572 iwlcore_commit_rxon(priv, ctx); 572 iwlcore_commit_rxon(priv, ctx);
573 573
574 out: 574 out:
575 if (priv->cfg->ops->hcmd->set_pan_params)
576 priv->cfg->ops->hcmd->set_pan_params(priv);
577
575 mutex_unlock(&priv->mutex); 578 mutex_unlock(&priv->mutex);
576 579
577 /* 580 /*