diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 73 |
1 files changed, 22 insertions, 51 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index fd65e1c3e055..46288e724889 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -769,35 +769,6 @@ void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) | |||
769 | return ; | 769 | return ; |
770 | } | 770 | } |
771 | 771 | ||
772 | u8 iwl3945_hw_find_station(struct iwl_priv *priv, const u8 *addr) | ||
773 | { | ||
774 | int i, start = IWL_AP_ID; | ||
775 | int ret = IWL_INVALID_STATION; | ||
776 | unsigned long flags; | ||
777 | |||
778 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) || | ||
779 | (priv->iw_mode == NL80211_IFTYPE_AP)) | ||
780 | start = IWL_STA_ID; | ||
781 | |||
782 | if (is_broadcast_ether_addr(addr)) | ||
783 | return priv->hw_params.bcast_sta_id; | ||
784 | |||
785 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
786 | for (i = start; i < priv->hw_params.max_stations; i++) | ||
787 | if ((priv->stations_39[i].used) && | ||
788 | (!compare_ether_addr | ||
789 | (priv->stations_39[i].sta.sta.addr, addr))) { | ||
790 | ret = i; | ||
791 | goto out; | ||
792 | } | ||
793 | |||
794 | IWL_DEBUG_INFO(priv, "can not find STA %pM (total %d)\n", | ||
795 | addr, priv->num_stations); | ||
796 | out: | ||
797 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
798 | return ret; | ||
799 | } | ||
800 | |||
801 | /** | 772 | /** |
802 | * iwl3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: | 773 | * iwl3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: |
803 | * | 774 | * |
@@ -875,13 +846,13 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, struct iwl_cmd *cmd, | |||
875 | u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) | 846 | u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) |
876 | { | 847 | { |
877 | unsigned long flags_spin; | 848 | unsigned long flags_spin; |
878 | struct iwl3945_station_entry *station; | 849 | struct iwl_station_entry *station; |
879 | 850 | ||
880 | if (sta_id == IWL_INVALID_STATION) | 851 | if (sta_id == IWL_INVALID_STATION) |
881 | return IWL_INVALID_STATION; | 852 | return IWL_INVALID_STATION; |
882 | 853 | ||
883 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 854 | spin_lock_irqsave(&priv->sta_lock, flags_spin); |
884 | station = &priv->stations_39[sta_id]; | 855 | station = &priv->stations[sta_id]; |
885 | 856 | ||
886 | station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK; | 857 | station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK; |
887 | station->sta.rate_n_flags = cpu_to_le16(tx_rate); | 858 | station->sta.rate_n_flags = cpu_to_le16(tx_rate); |
@@ -889,8 +860,7 @@ u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) | |||
889 | 860 | ||
890 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 861 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); |
891 | 862 | ||
892 | iwl_send_add_sta(priv, | 863 | iwl_send_add_sta(priv, &station->sta, flags); |
893 | (struct iwl_addsta_cmd *)&station->sta, flags); | ||
894 | IWL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n", | 864 | IWL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n", |
895 | sta_id, tx_rate); | 865 | sta_id, tx_rate); |
896 | return sta_id; | 866 | return sta_id; |
@@ -2029,7 +1999,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
2029 | 1999 | ||
2030 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); | 2000 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); |
2031 | 2001 | ||
2032 | priv->cfg->ops->smgmt->clear_station_table(priv); | 2002 | iwl_clear_stations_table(priv); |
2033 | 2003 | ||
2034 | /* If we issue a new RXON command which required a tune then we must | 2004 | /* If we issue a new RXON command which required a tune then we must |
2035 | * send a new TXPOWER command or we won't be able to Tx any frames */ | 2005 | * send a new TXPOWER command or we won't be able to Tx any frames */ |
@@ -2040,7 +2010,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
2040 | } | 2010 | } |
2041 | 2011 | ||
2042 | /* Add the broadcast address so we can send broadcast frames */ | 2012 | /* Add the broadcast address so we can send broadcast frames */ |
2043 | if (priv->cfg->ops->smgmt->add_station(priv, iwl_bcast_addr, 0, 0, NULL) == | 2013 | if (iwl_add_station(priv, iwl_bcast_addr, false, CMD_SYNC, NULL) == |
2044 | IWL_INVALID_STATION) { | 2014 | IWL_INVALID_STATION) { |
2045 | IWL_ERR(priv, "Error adding BROADCAST address for transmit.\n"); | 2015 | IWL_ERR(priv, "Error adding BROADCAST address for transmit.\n"); |
2046 | return -EIO; | 2016 | return -EIO; |
@@ -2050,9 +2020,8 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
2050 | * add the IWL_AP_ID to the station rate table */ | 2020 | * add the IWL_AP_ID to the station rate table */ |
2051 | if (iwl_is_associated(priv) && | 2021 | if (iwl_is_associated(priv) && |
2052 | (priv->iw_mode == NL80211_IFTYPE_STATION)) | 2022 | (priv->iw_mode == NL80211_IFTYPE_STATION)) |
2053 | if (priv->cfg->ops->smgmt->add_station(priv, | 2023 | if (iwl_add_station(priv, priv->active_rxon.bssid_addr, |
2054 | priv->active_rxon.bssid_addr, 1, 0, NULL) | 2024 | true, CMD_SYNC, NULL) == IWL_INVALID_STATION) { |
2055 | == IWL_INVALID_STATION) { | ||
2056 | IWL_ERR(priv, "Error adding AP address for transmit\n"); | 2025 | IWL_ERR(priv, "Error adding AP address for transmit\n"); |
2057 | return -EIO; | 2026 | return -EIO; |
2058 | } | 2027 | } |
@@ -2466,13 +2435,25 @@ static u16 iwl3945_get_hcmd_size(u8 cmd_id, u16 len) | |||
2466 | } | 2435 | } |
2467 | } | 2436 | } |
2468 | 2437 | ||
2438 | |||
2469 | static u16 iwl3945_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data) | 2439 | static u16 iwl3945_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data) |
2470 | { | 2440 | { |
2471 | u16 size = (u16)sizeof(struct iwl3945_addsta_cmd); | 2441 | struct iwl3945_addsta_cmd *addsta = (struct iwl3945_addsta_cmd *)data; |
2472 | memcpy(data, cmd, size); | 2442 | addsta->mode = cmd->mode; |
2473 | return size; | 2443 | memcpy(&addsta->sta, &cmd->sta, sizeof(struct sta_id_modify)); |
2444 | memcpy(&addsta->key, &cmd->key, sizeof(struct iwl4965_keyinfo)); | ||
2445 | addsta->station_flags = cmd->station_flags; | ||
2446 | addsta->station_flags_msk = cmd->station_flags_msk; | ||
2447 | addsta->tid_disable_tx = cpu_to_le16(0); | ||
2448 | addsta->rate_n_flags = cmd->rate_n_flags; | ||
2449 | addsta->add_immediate_ba_tid = cmd->add_immediate_ba_tid; | ||
2450 | addsta->remove_immediate_ba_tid = cmd->remove_immediate_ba_tid; | ||
2451 | addsta->add_immediate_ba_ssn = cmd->add_immediate_ba_ssn; | ||
2452 | |||
2453 | return (u16)sizeof(struct iwl3945_addsta_cmd); | ||
2474 | } | 2454 | } |
2475 | 2455 | ||
2456 | |||
2476 | /** | 2457 | /** |
2477 | * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table | 2458 | * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table |
2478 | */ | 2459 | */ |
@@ -2842,15 +2823,6 @@ static struct iwl_lib_ops iwl3945_lib = { | |||
2842 | .config_ap = iwl3945_config_ap, | 2823 | .config_ap = iwl3945_config_ap, |
2843 | }; | 2824 | }; |
2844 | 2825 | ||
2845 | static struct iwl_station_mgmt_ops iwl3945_station_mgmt = { | ||
2846 | .add_station = iwl3945_add_station, | ||
2847 | #if 0 | ||
2848 | .remove_station = iwl3945_remove_station, | ||
2849 | #endif | ||
2850 | .find_station = iwl3945_hw_find_station, | ||
2851 | .clear_station_table = iwl3945_clear_stations_table, | ||
2852 | }; | ||
2853 | |||
2854 | static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { | 2826 | static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { |
2855 | .get_hcmd_size = iwl3945_get_hcmd_size, | 2827 | .get_hcmd_size = iwl3945_get_hcmd_size, |
2856 | .build_addsta_hcmd = iwl3945_build_addsta_hcmd, | 2828 | .build_addsta_hcmd = iwl3945_build_addsta_hcmd, |
@@ -2860,7 +2832,6 @@ static struct iwl_ops iwl3945_ops = { | |||
2860 | .lib = &iwl3945_lib, | 2832 | .lib = &iwl3945_lib, |
2861 | .hcmd = &iwl3945_hcmd, | 2833 | .hcmd = &iwl3945_hcmd, |
2862 | .utils = &iwl3945_hcmd_utils, | 2834 | .utils = &iwl3945_hcmd_utils, |
2863 | .smgmt = &iwl3945_station_mgmt, | ||
2864 | }; | 2835 | }; |
2865 | 2836 | ||
2866 | static struct iwl_cfg iwl3945_bg_cfg = { | 2837 | static struct iwl_cfg iwl3945_bg_cfg = { |