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 | |
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')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 15 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-commands.h | 26 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 25 |
7 files changed, 65 insertions, 18 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 2bb0075a807f..83876a07fe2e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -1857,8 +1857,8 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) | |||
1857 | { | 1857 | { |
1858 | int ret = 0; | 1858 | int ret = 0; |
1859 | struct iwl4965_rxon_assoc_cmd rxon_assoc; | 1859 | struct iwl4965_rxon_assoc_cmd rxon_assoc; |
1860 | const struct iwl4965_rxon_cmd *rxon1 = &priv->staging_rxon; | 1860 | const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; |
1861 | const struct iwl4965_rxon_cmd *rxon2 = &priv->active_rxon; | 1861 | const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; |
1862 | 1862 | ||
1863 | if ((rxon1->flags == rxon2->flags) && | 1863 | if ((rxon1->flags == rxon2->flags) && |
1864 | (rxon1->filter_flags == rxon2->filter_flags) && | 1864 | (rxon1->filter_flags == rxon2->filter_flags) && |
@@ -3743,6 +3743,16 @@ int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | |||
3743 | #endif /* CONFIG_IWL4965_HT */ | 3743 | #endif /* CONFIG_IWL4965_HT */ |
3744 | 3744 | ||
3745 | 3745 | ||
3746 | static u16 iwl4965_get_hcmd_size(u8 cmd_id, u16 len) | ||
3747 | { | ||
3748 | switch (cmd_id) { | ||
3749 | case REPLY_RXON: | ||
3750 | return (u16) sizeof(struct iwl4965_rxon_cmd); | ||
3751 | default: | ||
3752 | return len; | ||
3753 | } | ||
3754 | } | ||
3755 | |||
3746 | static u16 iwl4965_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data) | 3756 | static u16 iwl4965_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data) |
3747 | { | 3757 | { |
3748 | struct iwl4965_addsta_cmd *addsta = (struct iwl4965_addsta_cmd *)data; | 3758 | struct iwl4965_addsta_cmd *addsta = (struct iwl4965_addsta_cmd *)data; |
@@ -3802,6 +3812,7 @@ static struct iwl_hcmd_ops iwl4965_hcmd = { | |||
3802 | }; | 3812 | }; |
3803 | 3813 | ||
3804 | static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { | 3814 | static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { |
3815 | .get_hcmd_size = iwl4965_get_hcmd_size, | ||
3805 | .enqueue_hcmd = iwl4965_enqueue_hcmd, | 3816 | .enqueue_hcmd = iwl4965_enqueue_hcmd, |
3806 | .build_addsta_hcmd = iwl4965_build_addsta_hcmd, | 3817 | .build_addsta_hcmd = iwl4965_build_addsta_hcmd, |
3807 | #ifdef CONFIG_IWL4965_RUN_TIME_CALIB | 3818 | #ifdef CONFIG_IWL4965_RUN_TIME_CALIB |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index b5e28b811796..72d655c59fba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -459,10 +459,17 @@ static int iwl5000_disable_tx_fifo(struct iwl_priv *priv) | |||
459 | return 0; | 459 | return 0; |
460 | } | 460 | } |
461 | 461 | ||
462 | /* Currently 5000 is the supperset of everything */ | ||
463 | static u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len) | ||
464 | { | ||
465 | return len; | ||
466 | } | ||
467 | |||
462 | static struct iwl_hcmd_ops iwl5000_hcmd = { | 468 | static struct iwl_hcmd_ops iwl5000_hcmd = { |
463 | }; | 469 | }; |
464 | 470 | ||
465 | static struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = { | 471 | static struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = { |
472 | .get_hcmd_size = iwl5000_get_hcmd_size, | ||
466 | .build_addsta_hcmd = iwl5000_build_addsta_hcmd, | 473 | .build_addsta_hcmd = iwl5000_build_addsta_hcmd, |
467 | #ifdef CONFIG_IWL5000_RUN_TIME_CALIB | 474 | #ifdef CONFIG_IWL5000_RUN_TIME_CALIB |
468 | .gain_computation = iwl5000_gain_computation, | 475 | .gain_computation = iwl5000_gain_computation, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index d16a853f376a..350af1be6e35 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -600,6 +600,32 @@ struct iwl4965_rxon_cmd { | |||
600 | u8 ofdm_ht_dual_stream_basic_rates; | 600 | u8 ofdm_ht_dual_stream_basic_rates; |
601 | } __attribute__ ((packed)); | 601 | } __attribute__ ((packed)); |
602 | 602 | ||
603 | /* 5000 HW just extend this cmmand */ | ||
604 | struct iwl_rxon_cmd { | ||
605 | u8 node_addr[6]; | ||
606 | __le16 reserved1; | ||
607 | u8 bssid_addr[6]; | ||
608 | __le16 reserved2; | ||
609 | u8 wlap_bssid_addr[6]; | ||
610 | __le16 reserved3; | ||
611 | u8 dev_type; | ||
612 | u8 air_propagation; | ||
613 | __le16 rx_chain; | ||
614 | u8 ofdm_basic_rates; | ||
615 | u8 cck_basic_rates; | ||
616 | __le16 assoc_id; | ||
617 | __le32 flags; | ||
618 | __le32 filter_flags; | ||
619 | __le16 channel; | ||
620 | u8 ofdm_ht_single_stream_basic_rates; | ||
621 | u8 ofdm_ht_dual_stream_basic_rates; | ||
622 | u8 ofdm_ht_triple_stream_basic_rates; | ||
623 | u8 reserved5; | ||
624 | __le16 acquisition_data; | ||
625 | __le16 reserved6; | ||
626 | } __attribute__ ((packed)); | ||
627 | |||
628 | |||
603 | /* | 629 | /* |
604 | * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) | 630 | * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) |
605 | */ | 631 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index a2f4f288375a..b800031ecca5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -588,7 +588,7 @@ EXPORT_SYMBOL(iwl_is_fat_tx_allowed); | |||
588 | 588 | ||
589 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info) | 589 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info) |
590 | { | 590 | { |
591 | struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; | 591 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; |
592 | u32 val; | 592 | u32 val; |
593 | 593 | ||
594 | if (!ht_info->is_ht) | 594 | if (!ht_info->is_ht) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index e139c8ffa9a2..dcf1e562af32 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -86,6 +86,7 @@ struct iwl_hcmd_ops { | |||
86 | int (*rxon_assoc)(struct iwl_priv *priv); | 86 | int (*rxon_assoc)(struct iwl_priv *priv); |
87 | }; | 87 | }; |
88 | struct iwl_hcmd_utils_ops { | 88 | struct iwl_hcmd_utils_ops { |
89 | u16 (*get_hcmd_size)(u8 cmd_id, u16 len); | ||
89 | int (*enqueue_hcmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd); | 90 | int (*enqueue_hcmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd); |
90 | u16 (*build_addsta_hcmd)(const struct iwl_addsta_cmd *cmd, u8 *data); | 91 | u16 (*build_addsta_hcmd)(const struct iwl_addsta_cmd *cmd, u8 *data); |
91 | #ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB | 92 | #ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB |
@@ -303,5 +304,4 @@ static inline int iwl_send_rxon_assoc(struct iwl_priv *priv) | |||
303 | return priv->cfg->ops->hcmd->rxon_assoc(priv); | 304 | return priv->cfg->ops->hcmd->rxon_assoc(priv); |
304 | } | 305 | } |
305 | 306 | ||
306 | |||
307 | #endif /* __iwl_core_h__ */ | 307 | #endif /* __iwl_core_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index ae18a803d034..9a842fd047d4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1009,11 +1009,11 @@ struct iwl_priv { | |||
1009 | * changed via explicit cast within the | 1009 | * changed via explicit cast within the |
1010 | * routines that actually update the physical | 1010 | * routines that actually update the physical |
1011 | * hardware */ | 1011 | * hardware */ |
1012 | const struct iwl4965_rxon_cmd active_rxon; | 1012 | const struct iwl_rxon_cmd active_rxon; |
1013 | struct iwl4965_rxon_cmd staging_rxon; | 1013 | struct iwl_rxon_cmd staging_rxon; |
1014 | 1014 | ||
1015 | int error_recovering; | 1015 | int error_recovering; |
1016 | struct iwl4965_rxon_cmd recovery_rxon; | 1016 | struct iwl_rxon_cmd recovery_rxon; |
1017 | 1017 | ||
1018 | /* 1st responses from initialize and runtime uCode images. | 1018 | /* 1st responses from initialize and runtime uCode images. |
1019 | * 4965's initialize alive response contains some calibration data. */ | 1019 | * 4965's initialize alive response contains some calibration data. */ |
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 | ||