aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-23 04:46:32 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-08-27 11:26:47 -0400
commit246ed355221076884d225f9d8a4c30a048be8162 (patch)
tree64bba3b115c6f0d7ba245c44b81c38e46adec6c8 /drivers/net/wireless/iwlwifi/iwl-4965.c
parent903786a5626e7214d97b232bece88ee75e37d021 (diff)
iwlwifi: initial contextification
In order to support multiple interfaces, we must move a lot of data into per-context structures so we can use the contexts the device offers. To start with, this makes a lot of code context-aware, more changes will move more things into the context structure. 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/wireless/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index f0a47f42d4b8..82f32305f50e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -347,7 +347,7 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv)
347 struct iwl_chain_noise_data *data = &(priv->chain_noise_data); 347 struct iwl_chain_noise_data *data = &(priv->chain_noise_data);
348 348
349 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && 349 if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
350 iwl_is_associated(priv)) { 350 iwl_is_any_associated(priv)) {
351 struct iwl_calib_diff_gain_cmd cmd; 351 struct iwl_calib_diff_gain_cmd cmd;
352 352
353 /* clear data for chain noise calibration algorithm */ 353 /* clear data for chain noise calibration algorithm */
@@ -1374,6 +1374,7 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)
1374 u8 band = 0; 1374 u8 band = 0;
1375 bool is_ht40 = false; 1375 bool is_ht40 = false;
1376 u8 ctrl_chan_high = 0; 1376 u8 ctrl_chan_high = 0;
1377 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1377 1378
1378 if (test_bit(STATUS_SCANNING, &priv->status)) { 1379 if (test_bit(STATUS_SCANNING, &priv->status)) {
1379 /* If this gets hit a lot, switch it to a BUG() and catch 1380 /* If this gets hit a lot, switch it to a BUG() and catch
@@ -1385,17 +1386,16 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)
1385 1386
1386 band = priv->band == IEEE80211_BAND_2GHZ; 1387 band = priv->band == IEEE80211_BAND_2GHZ;
1387 1388
1388 is_ht40 = is_ht40_channel(priv->active_rxon.flags); 1389 is_ht40 = is_ht40_channel(ctx->active.flags);
1389 1390
1390 if (is_ht40 && 1391 if (is_ht40 && (ctx->active.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
1391 (priv->active_rxon.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
1392 ctrl_chan_high = 1; 1392 ctrl_chan_high = 1;
1393 1393
1394 cmd.band = band; 1394 cmd.band = band;
1395 cmd.channel = priv->active_rxon.channel; 1395 cmd.channel = ctx->active.channel;
1396 1396
1397 ret = iwl4965_fill_txpower_tbl(priv, band, 1397 ret = iwl4965_fill_txpower_tbl(priv, band,
1398 le16_to_cpu(priv->active_rxon.channel), 1398 le16_to_cpu(ctx->active.channel),
1399 is_ht40, ctrl_chan_high, &cmd.tx_power); 1399 is_ht40, ctrl_chan_high, &cmd.tx_power);
1400 if (ret) 1400 if (ret)
1401 goto out; 1401 goto out;
@@ -1406,12 +1406,13 @@ out:
1406 return ret; 1406 return ret;
1407} 1407}
1408 1408
1409static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) 1409static int iwl4965_send_rxon_assoc(struct iwl_priv *priv,
1410 struct iwl_rxon_context *ctx)
1410{ 1411{
1411 int ret = 0; 1412 int ret = 0;
1412 struct iwl4965_rxon_assoc_cmd rxon_assoc; 1413 struct iwl4965_rxon_assoc_cmd rxon_assoc;
1413 const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; 1414 const struct iwl_rxon_cmd *rxon1 = &ctx->staging;
1414 const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; 1415 const struct iwl_rxon_cmd *rxon2 = &ctx->active;
1415 1416
1416 if ((rxon1->flags == rxon2->flags) && 1417 if ((rxon1->flags == rxon2->flags) &&
1417 (rxon1->filter_flags == rxon2->filter_flags) && 1418 (rxon1->filter_flags == rxon2->filter_flags) &&
@@ -1426,16 +1427,16 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv)
1426 return 0; 1427 return 0;
1427 } 1428 }
1428 1429
1429 rxon_assoc.flags = priv->staging_rxon.flags; 1430 rxon_assoc.flags = ctx->staging.flags;
1430 rxon_assoc.filter_flags = priv->staging_rxon.filter_flags; 1431 rxon_assoc.filter_flags = ctx->staging.filter_flags;
1431 rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates; 1432 rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates;
1432 rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; 1433 rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates;
1433 rxon_assoc.reserved = 0; 1434 rxon_assoc.reserved = 0;
1434 rxon_assoc.ofdm_ht_single_stream_basic_rates = 1435 rxon_assoc.ofdm_ht_single_stream_basic_rates =
1435 priv->staging_rxon.ofdm_ht_single_stream_basic_rates; 1436 ctx->staging.ofdm_ht_single_stream_basic_rates;
1436 rxon_assoc.ofdm_ht_dual_stream_basic_rates = 1437 rxon_assoc.ofdm_ht_dual_stream_basic_rates =
1437 priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; 1438 ctx->staging.ofdm_ht_dual_stream_basic_rates;
1438 rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; 1439 rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain;
1439 1440
1440 ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, 1441 ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC,
1441 sizeof(rxon_assoc), &rxon_assoc, NULL); 1442 sizeof(rxon_assoc), &rxon_assoc, NULL);
@@ -1448,6 +1449,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv)
1448static int iwl4965_hw_channel_switch(struct iwl_priv *priv, 1449static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
1449 struct ieee80211_channel_switch *ch_switch) 1450 struct ieee80211_channel_switch *ch_switch)
1450{ 1451{
1452 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1451 int rc; 1453 int rc;
1452 u8 band = 0; 1454 u8 band = 0;
1453 bool is_ht40 = false; 1455 bool is_ht40 = false;
@@ -1458,22 +1460,22 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
1458 u16 ch; 1460 u16 ch;
1459 u32 tsf_low; 1461 u32 tsf_low;
1460 u8 switch_count; 1462 u8 switch_count;
1461 u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval); 1463 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
1462 struct ieee80211_vif *vif = priv->vif; 1464 struct ieee80211_vif *vif = priv->vif;
1463 band = priv->band == IEEE80211_BAND_2GHZ; 1465 band = priv->band == IEEE80211_BAND_2GHZ;
1464 1466
1465 is_ht40 = is_ht40_channel(priv->staging_rxon.flags); 1467 is_ht40 = is_ht40_channel(ctx->staging.flags);
1466 1468
1467 if (is_ht40 && 1469 if (is_ht40 &&
1468 (priv->staging_rxon.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK)) 1470 (ctx->staging.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
1469 ctrl_chan_high = 1; 1471 ctrl_chan_high = 1;
1470 1472
1471 cmd.band = band; 1473 cmd.band = band;
1472 cmd.expect_beacon = 0; 1474 cmd.expect_beacon = 0;
1473 ch = ch_switch->channel->hw_value; 1475 ch = ch_switch->channel->hw_value;
1474 cmd.channel = cpu_to_le16(ch); 1476 cmd.channel = cpu_to_le16(ch);
1475 cmd.rxon_flags = priv->staging_rxon.flags; 1477 cmd.rxon_flags = ctx->staging.flags;
1476 cmd.rxon_filter_flags = priv->staging_rxon.filter_flags; 1478 cmd.rxon_filter_flags = ctx->staging.filter_flags;
1477 switch_count = ch_switch->count; 1479 switch_count = ch_switch->count;
1478 tsf_low = ch_switch->timestamp & 0x0ffffffff; 1480 tsf_low = ch_switch->timestamp & 0x0ffffffff;
1479 /* 1481 /*
@@ -1508,7 +1510,7 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
1508 cmd.expect_beacon = is_channel_radar(ch_info); 1510 cmd.expect_beacon = is_channel_radar(ch_info);
1509 else { 1511 else {
1510 IWL_ERR(priv, "invalid channel switch from %u to %u\n", 1512 IWL_ERR(priv, "invalid channel switch from %u to %u\n",
1511 priv->active_rxon.channel, ch); 1513 ctx->active.channel, ch);
1512 return -EFAULT; 1514 return -EFAULT;
1513 } 1515 }
1514 1516