aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c100
1 files changed, 59 insertions, 41 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 136c29067489..d3afddae8d9f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -1953,6 +1953,60 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
1953 return 0; 1953 return 0;
1954} 1954}
1955 1955
1956static u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr)
1957{
1958 int i;
1959 int start = 0;
1960 int ret = IWL_INVALID_STATION;
1961 unsigned long flags;
1962
1963 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) ||
1964 (priv->iw_mode == NL80211_IFTYPE_AP))
1965 start = IWL_STA_ID;
1966
1967 if (is_broadcast_ether_addr(addr))
1968 return priv->hw_params.bcast_sta_id;
1969
1970 spin_lock_irqsave(&priv->sta_lock, flags);
1971 for (i = start; i < priv->hw_params.max_stations; i++)
1972 if (priv->stations[i].used &&
1973 (!compare_ether_addr(priv->stations[i].sta.sta.addr,
1974 addr))) {
1975 ret = i;
1976 goto out;
1977 }
1978
1979 IWL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n",
1980 addr, priv->num_stations);
1981
1982 out:
1983 /*
1984 * It may be possible that more commands interacting with stations
1985 * arrive before we completed processing the adding of
1986 * station
1987 */
1988 if (ret != IWL_INVALID_STATION &&
1989 (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) ||
1990 ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) &&
1991 (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) {
1992 IWL_ERR(priv, "Requested station info for sta %d before ready.\n",
1993 ret);
1994 ret = IWL_INVALID_STATION;
1995 }
1996 spin_unlock_irqrestore(&priv->sta_lock, flags);
1997 return ret;
1998}
1999
2000static int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
2001{
2002 if (priv->iw_mode == NL80211_IFTYPE_STATION) {
2003 return IWL_AP_ID;
2004 } else {
2005 u8 *da = ieee80211_get_DA(hdr);
2006 return iwl_find_station(priv, da);
2007 }
2008}
2009
1956/** 2010/**
1957 * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response 2011 * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response
1958 */ 2012 */
@@ -2112,34 +2166,6 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv)
2112 cancel_work_sync(&priv->txpower_work); 2166 cancel_work_sync(&priv->txpower_work);
2113} 2167}
2114 2168
2115#define IWL4965_UCODE_GET(item) \
2116static u32 iwl4965_ucode_get_##item(const struct iwl_ucode_header *ucode,\
2117 u32 api_ver) \
2118{ \
2119 return le32_to_cpu(ucode->u.v1.item); \
2120}
2121
2122static u32 iwl4965_ucode_get_header_size(u32 api_ver)
2123{
2124 return UCODE_HEADER_SIZE(1);
2125}
2126static u32 iwl4965_ucode_get_build(const struct iwl_ucode_header *ucode,
2127 u32 api_ver)
2128{
2129 return 0;
2130}
2131static u8 *iwl4965_ucode_get_data(const struct iwl_ucode_header *ucode,
2132 u32 api_ver)
2133{
2134 return (u8 *) ucode->u.v1.data;
2135}
2136
2137IWL4965_UCODE_GET(inst_size);
2138IWL4965_UCODE_GET(data_size);
2139IWL4965_UCODE_GET(init_size);
2140IWL4965_UCODE_GET(init_data_size);
2141IWL4965_UCODE_GET(boot_size);
2142
2143static struct iwl_hcmd_ops iwl4965_hcmd = { 2169static struct iwl_hcmd_ops iwl4965_hcmd = {
2144 .rxon_assoc = iwl4965_send_rxon_assoc, 2170 .rxon_assoc = iwl4965_send_rxon_assoc,
2145 .commit_rxon = iwl_commit_rxon, 2171 .commit_rxon = iwl_commit_rxon,
@@ -2147,16 +2173,6 @@ static struct iwl_hcmd_ops iwl4965_hcmd = {
2147 .send_bt_config = iwl_send_bt_config, 2173 .send_bt_config = iwl_send_bt_config,
2148}; 2174};
2149 2175
2150static struct iwl_ucode_ops iwl4965_ucode = {
2151 .get_header_size = iwl4965_ucode_get_header_size,
2152 .get_build = iwl4965_ucode_get_build,
2153 .get_inst_size = iwl4965_ucode_get_inst_size,
2154 .get_data_size = iwl4965_ucode_get_data_size,
2155 .get_init_size = iwl4965_ucode_get_init_size,
2156 .get_init_data_size = iwl4965_ucode_get_init_data_size,
2157 .get_boot_size = iwl4965_ucode_get_boot_size,
2158 .get_data = iwl4965_ucode_get_data,
2159};
2160static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { 2176static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
2161 .get_hcmd_size = iwl4965_get_hcmd_size, 2177 .get_hcmd_size = iwl4965_get_hcmd_size,
2162 .build_addsta_hcmd = iwl4965_build_addsta_hcmd, 2178 .build_addsta_hcmd = iwl4965_build_addsta_hcmd,
@@ -2218,7 +2234,7 @@ static struct iwl_lib_ops iwl4965_lib = {
2218 .temperature = iwl4965_temperature_calib, 2234 .temperature = iwl4965_temperature_calib,
2219 .set_ct_kill = iwl4965_set_ct_threshold, 2235 .set_ct_kill = iwl4965_set_ct_threshold,
2220 }, 2236 },
2221 .add_bcast_station = iwl_add_bcast_station, 2237 .manage_ibss_station = iwlagn_manage_ibss_station,
2222 .debugfs_ops = { 2238 .debugfs_ops = {
2223 .rx_stats_read = iwl_ucode_rx_stats_read, 2239 .rx_stats_read = iwl_ucode_rx_stats_read,
2224 .tx_stats_read = iwl_ucode_tx_stats_read, 2240 .tx_stats_read = iwl_ucode_tx_stats_read,
@@ -2228,7 +2244,6 @@ static struct iwl_lib_ops iwl4965_lib = {
2228}; 2244};
2229 2245
2230static const struct iwl_ops iwl4965_ops = { 2246static const struct iwl_ops iwl4965_ops = {
2231 .ucode = &iwl4965_ucode,
2232 .lib = &iwl4965_lib, 2247 .lib = &iwl4965_lib,
2233 .hcmd = &iwl4965_hcmd, 2248 .hcmd = &iwl4965_hcmd,
2234 .utils = &iwl4965_hcmd_utils, 2249 .utils = &iwl4965_hcmd_utils,
@@ -2262,7 +2277,10 @@ struct iwl_cfg iwl4965_agn_cfg = {
2262 .monitor_recover_period = IWL_MONITORING_PERIOD, 2277 .monitor_recover_period = IWL_MONITORING_PERIOD,
2263 .temperature_kelvin = true, 2278 .temperature_kelvin = true,
2264 .max_event_log_size = 512, 2279 .max_event_log_size = 512,
2265 2280 .tx_power_by_driver = true,
2281 .ucode_tracing = true,
2282 .sensitivity_calib_by_driver = true,
2283 .chain_noise_calib_by_driver = true,
2266 /* 2284 /*
2267 * Force use of chains B and C for scan RX on 5 GHz band 2285 * Force use of chains B and C for scan RX on 5 GHz band
2268 * because the device has off-channel reception on chain A. 2286 * because the device has off-channel reception on chain A.