diff options
author | Gregory Greenman <gregory.greenman@intel.com> | 2008-05-15 01:53:59 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-21 21:47:54 -0400 |
commit | c1adf9fb31e31ee753d613bd5bc6aef9b762b747 (patch) | |
tree | c4f91af5ec9b24bee0833cf88b6379b1cf8fb993 /drivers/net/wireless/iwlwifi/iwl4965-base.c | |
parent | 8567c63e3385688b95658fe31b3ac8f4436b1b0f (diff) |
iwlwifi: get_hw_cmd_size
This patch introduces a new handler get_hw_cmd_size in hcmd_utils,
which should adjust the size of the command sent to the microcode
according to the current nic.
It also changes the RXON flow to make usage of this new handler.
The patch also adds iwl_rxon_cmd structure which is supperset for
5000 HW and 4965.
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 6e70405d4416..45b6b5234eef 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -353,11 +353,14 @@ int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
353 | u32 *control_flags; | 353 | u32 *control_flags; |
354 | struct iwl_cmd *out_cmd; | 354 | struct iwl_cmd *out_cmd; |
355 | u32 idx; | 355 | u32 idx; |
356 | u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); | 356 | u16 fix_size; |
357 | dma_addr_t phys_addr; | 357 | dma_addr_t phys_addr; |
358 | int ret; | 358 | int ret; |
359 | unsigned long flags; | 359 | unsigned long flags; |
360 | 360 | ||
361 | cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len); | ||
362 | fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); | ||
363 | |||
361 | /* If any of the command structures end up being larger than | 364 | /* If any of the command structures end up being larger than |
362 | * the TFD_MAX_PAYLOAD_SIZE, and it sent as a 'small' command then | 365 | * the TFD_MAX_PAYLOAD_SIZE, and it sent as a 'small' command then |
363 | * we will need to increase the size of the TFD entries */ | 366 | * we will need to increase the size of the TFD entries */ |
@@ -422,7 +425,7 @@ int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
422 | 425 | ||
423 | static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) | 426 | static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) |
424 | { | 427 | { |
425 | struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; | 428 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; |
426 | 429 | ||
427 | if (hw_decrypt) | 430 | if (hw_decrypt) |
428 | rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; | 431 | rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; |
@@ -470,7 +473,7 @@ static int iwl4965_rxon_add_station(struct iwl_priv *priv, | |||
470 | * be #ifdef'd out once the driver is stable and folks aren't actively | 473 | * be #ifdef'd out once the driver is stable and folks aren't actively |
471 | * making changes | 474 | * making changes |
472 | */ | 475 | */ |
473 | static int iwl4965_check_rxon_cmd(struct iwl4965_rxon_cmd *rxon) | 476 | static int iwl4965_check_rxon_cmd(struct iwl_rxon_cmd *rxon) |
474 | { | 477 | { |
475 | int error = 0; | 478 | int error = 0; |
476 | int counter = 1; | 479 | int counter = 1; |
@@ -595,7 +598,7 @@ static int iwl4965_full_rxon_required(struct iwl_priv *priv) | |||
595 | static int iwl4965_commit_rxon(struct iwl_priv *priv) | 598 | static int iwl4965_commit_rxon(struct iwl_priv *priv) |
596 | { | 599 | { |
597 | /* cast away the const for active_rxon in this function */ | 600 | /* cast away the const for active_rxon in this function */ |
598 | struct iwl4965_rxon_cmd *active_rxon = (void *)&priv->active_rxon; | 601 | struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; |
599 | DECLARE_MAC_BUF(mac); | 602 | DECLARE_MAC_BUF(mac); |
600 | int rc = 0; | 603 | int rc = 0; |
601 | 604 | ||
@@ -640,7 +643,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
640 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 643 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
641 | 644 | ||
642 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, | 645 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, |
643 | sizeof(struct iwl4965_rxon_cmd), | 646 | sizeof(struct iwl_rxon_cmd), |
644 | &priv->active_rxon); | 647 | &priv->active_rxon); |
645 | 648 | ||
646 | /* If the mask clearing failed then we set | 649 | /* If the mask clearing failed then we set |
@@ -665,7 +668,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
665 | iwl4965_set_rxon_hwcrypto(priv, !priv->hw_params.sw_crypto); | 668 | iwl4965_set_rxon_hwcrypto(priv, !priv->hw_params.sw_crypto); |
666 | /* Apply the new configuration */ | 669 | /* Apply the new configuration */ |
667 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, | 670 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, |
668 | sizeof(struct iwl4965_rxon_cmd), &priv->staging_rxon); | 671 | sizeof(struct iwl_rxon_cmd), &priv->staging_rxon); |
669 | if (rc) { | 672 | if (rc) { |
670 | IWL_ERROR("Error setting new configuration (%d).\n", rc); | 673 | IWL_ERROR("Error setting new configuration (%d).\n", rc); |
671 | return rc; | 674 | return rc; |
@@ -2699,7 +2702,7 @@ static void iwl4965_rx_reply_error(struct iwl_priv *priv, | |||
2699 | static void iwl4965_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | 2702 | static void iwl4965_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) |
2700 | { | 2703 | { |
2701 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | 2704 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; |
2702 | struct iwl4965_rxon_cmd *rxon = (void *)&priv->active_rxon; | 2705 | struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon; |
2703 | struct iwl4965_csa_notification *csa = &(pkt->u.csa_notif); | 2706 | struct iwl4965_csa_notification *csa = &(pkt->u.csa_notif); |
2704 | IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", | 2707 | IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", |
2705 | le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); | 2708 | le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); |
@@ -3317,7 +3320,7 @@ static int iwl4965_tx_queue_update_write_ptr(struct iwl_priv *priv, | |||
3317 | #ifdef CONFIG_IWLWIFI_DEBUG | 3320 | #ifdef CONFIG_IWLWIFI_DEBUG |
3318 | static void iwl4965_print_rx_config_cmd(struct iwl_priv *priv) | 3321 | static void iwl4965_print_rx_config_cmd(struct iwl_priv *priv) |
3319 | { | 3322 | { |
3320 | struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; | 3323 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; |
3321 | DECLARE_MAC_BUF(mac); | 3324 | DECLARE_MAC_BUF(mac); |
3322 | 3325 | ||
3323 | IWL_DEBUG_RADIO("RX CONFIG:\n"); | 3326 | IWL_DEBUG_RADIO("RX CONFIG:\n"); |
@@ -4213,8 +4216,8 @@ static void iwl4965_alive_start(struct iwl_priv *priv) | |||
4213 | priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; | 4216 | priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; |
4214 | 4217 | ||
4215 | if (iwl_is_associated(priv)) { | 4218 | if (iwl_is_associated(priv)) { |
4216 | struct iwl4965_rxon_cmd *active_rxon = | 4219 | struct iwl_rxon_cmd *active_rxon = |
4217 | (struct iwl4965_rxon_cmd *)(&priv->active_rxon); | 4220 | (struct iwl_rxon_cmd *)&priv->active_rxon; |
4218 | 4221 | ||
4219 | memcpy(&priv->staging_rxon, &priv->active_rxon, | 4222 | memcpy(&priv->staging_rxon, &priv->active_rxon, |
4220 | sizeof(priv->staging_rxon)); | 4223 | sizeof(priv->staging_rxon)); |
@@ -5021,7 +5024,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw) | |||
5021 | /* we should be verifying the device is ready to be opened */ | 5024 | /* we should be verifying the device is ready to be opened */ |
5022 | mutex_lock(&priv->mutex); | 5025 | mutex_lock(&priv->mutex); |
5023 | 5026 | ||
5024 | memset(&priv->staging_rxon, 0, sizeof(struct iwl4965_rxon_cmd)); | 5027 | memset(&priv->staging_rxon, 0, sizeof(struct iwl_rxon_cmd)); |
5025 | /* fetch ucode file from disk, alloc and copy to bus-master buffers ... | 5028 | /* fetch ucode file from disk, alloc and copy to bus-master buffers ... |
5026 | * ucode filename and max sizes are card-specific. */ | 5029 | * ucode filename and max sizes are card-specific. */ |
5027 | 5030 | ||