From 220173b01266d866009ca075757effad39648529 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Tue, 16 Oct 2007 00:50:25 +0200 Subject: iwlwifi: Add erp_ie_changed hanlder This patch adds erp_ie_changed handler to iwl4956 Signed-off-by: Tomas Winkler Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl4965-base.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 15a45f47171..35ebe2b8976 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -7670,6 +7670,29 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw, IWL_DEBUG_MAC80211("leave\n"); } +static void iwl_mac_erp_ie_changed(struct ieee80211_hw *hw, + u8 changes, int cts_protection, int preamble) +{ + + struct iwl_priv *priv = hw->priv; + + if (changes & IEEE80211_ERP_CHANGE_PREAMBLE) { + if (preamble == WLAN_ERP_PREAMBLE_SHORT) + priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; + else + priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; + } + + if (changes & IEEE80211_ERP_CHANGE_PROTECTION) { + if (cts_protection) + priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; + else + priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; + } + + if (iwl_is_associated(priv)) + iwl_send_rxon_assoc(priv); +} #define IWL_DELAY_NEXT_SCAN (HZ*2) static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) @@ -8929,6 +8952,7 @@ static struct ieee80211_ops iwl_hw_ops = { .get_tsf = iwl_mac_get_tsf, .reset_tsf = iwl_mac_reset_tsf, .beacon_update = iwl_mac_beacon_update, + .erp_ie_changed = iwl_mac_erp_ie_changed, #ifdef CONFIG_IWLWIFI_HT .conf_ht = iwl_mac_conf_ht, .get_ht_capab = iwl_mac_get_ht_capab, -- cgit v1.2.3-70-g09d2 From 01ebd063e11bdcf1ddc605d968ea89aef48e34e0 Mon Sep 17 00:00:00 2001 From: Ian Schram Date: Thu, 25 Oct 2007 17:15:22 +0800 Subject: iwlwifi: fix various spelling and typos Fixing various spelling errors and typos. Mostly in comments. In total 27 words were corrected, some of which occurred more than ones. Signed-Of-By: Ian Schram Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 2 +- drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl-3945-rs.h | 4 ++-- drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 2 +- drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 6 +++--- drivers/net/wireless/iwlwifi/iwl-4965-rs.h | 4 ++-- drivers/net/wireless/iwlwifi/iwl-4965.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl-commands.h | 2 +- drivers/net/wireless/iwlwifi/iwl-eeprom.h | 2 +- drivers/net/wireless/iwlwifi/iwl-hw.h | 2 +- drivers/net/wireless/iwlwifi/iwl-prph.h | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 32 ++++++++++++++--------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 32 ++++++++++++++--------------- drivers/net/wireless/iwlwifi/iwlwifi.h | 6 +++--- 14 files changed, 52 insertions(+), 52 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h index fb5f0649f4f..90d4249fa7f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h @@ -8,7 +8,7 @@ * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU Geeral Public License as + * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index ea7f459e961..a6cb97ac43e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c @@ -362,7 +362,7 @@ static void *rs_alloc(struct ieee80211_local *local) return local->hw.priv; } -/* rate scale requires free function to be implmented */ +/* rate scale requires free function to be implemented */ static void rs_free(void *priv) { return; @@ -568,7 +568,7 @@ static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv, u8 high = IWL_RATE_INVALID; u8 low = IWL_RATE_INVALID; - /* 802.11A walks to the next literal adjascent rate in + /* 802.11A walks to the next literal adjacent rate in * the rate table */ if (unlikely(phymode == MODE_IEEE80211A)) { int i; diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h index bec4d3ffca1..4f21bc73fc3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h @@ -174,7 +174,7 @@ static inline u8 iwl_get_prev_ieee_rate(u8 rate_index) * iwl_fill_rs_info - Fill an output text buffer with the rate representation * * NOTE: This is provided as a quick mechanism for a user to visualize - * the performance of the rate control alogirthm and is not meant to be + * the performance of the rate control algorithm and is not meant to be * parsed software. */ extern int iwl_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); @@ -182,7 +182,7 @@ extern int iwl_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); /** * iwl_rate_scale_init - Initialize the rate scale table based on assoc info * - * The specific througput table used is based on the type of network + * The specific throughput table used is based on the type of network * the associated with, including A, B, G, and G w/ TGG protection */ extern void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index 99a19ef4c74..6a2df9d0958 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h @@ -8,7 +8,7 @@ * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU Geeral Public License as + * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 62a3b52b327..2227ee4ad1a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c @@ -498,7 +498,7 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type) u8 high = IWL_RATE_INVALID; u8 low = IWL_RATE_INVALID; - /* 802.11A or ht walks to the next literal adjascent rate in + /* 802.11A or ht walks to the next literal adjacent rate in * the rate table */ if (is_a_band(rate_type) || !is_legacy(rate_type)) { int i; @@ -1413,7 +1413,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, index = IWL_INVALID_VALUE; update_lq = 1; - /* get the lowest availabe rate */ + /* get the lowest available rate */ for (i = 0; i <= IWL_RATE_COUNT; i++) { if ((1 << i) & rate_scale_index_msk) index = i; @@ -2245,7 +2245,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) max_time, good * 100 / samples, good, samples); else count += sprintf(&buf[count], "\nAverage rate: 0Mbs\n"); - count += sprintf(&buf[count], "\nrate scale type %d anntena %d " + count += sprintf(&buf[count], "\nrate scale type %d antenna %d " "active_search %d rate index %d\n", lq_type, antenna, rs_priv->search_better_tbl, sta->last_txrate); diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h index c6325f72df6..f735752abf3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h @@ -230,7 +230,7 @@ extern int iwl_rate_index_from_plcp(int plcp); * iwl_fill_rs_info - Fill an output text buffer with the rate representation * * NOTE: This is provided as a quick mechanism for a user to visualize - * the performance of the rate control alogirthm and is not meant to be + * the performance of the rate control algorithm and is not meant to be * parsed software. */ extern int iwl_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); @@ -238,7 +238,7 @@ extern int iwl_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); /** * iwl_rate_scale_init - Initialize the rate scale table based on assoc info * - * The specific througput table used is based on the type of network + * The specific throughput table used is based on the type of network * the associated with, including A, B, G, and G w/ TGG protection */ extern void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 891f90d2f01..02708c7ee51 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -4051,7 +4051,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv, agg->wait_for_ba = 0; IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->ba_seq_ctl); sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl>>4); - if (sh < 0) /* tbw something is wrong with indeces */ + if (sh < 0) /* tbw something is wrong with indices */ sh += 0x100; /* don't use 64 bits for now */ @@ -4109,7 +4109,7 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, agg = &priv->stations[ba_resp->sta_id].tid[ba_resp->tid].agg; index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); - /* TODO: Need to get this copy more sefely - now good for debug */ + /* TODO: Need to get this copy more safely - now good for debug */ /* { DECLARE_MAC_BUF(mac); diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 9de8d7f6efa..d852a77d112 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h @@ -8,7 +8,7 @@ * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU Geeral Public License as + * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index e473c97e3f4..22cbe278add 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h @@ -8,7 +8,7 @@ * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU Geeral Public License as + * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but diff --git a/drivers/net/wireless/iwlwifi/iwl-hw.h b/drivers/net/wireless/iwlwifi/iwl-hw.h index 1aa6fcd39a5..8968a95352d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-hw.h @@ -8,7 +8,7 @@ * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU Geeral Public License as + * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index 0df41148ead..b1b5233bafc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h @@ -8,7 +8,7 @@ * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU Geeral Public License as + * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 0b3ec7e4d93..60e25464cee 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -287,7 +287,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, txq->txb = kmalloc(sizeof(txq->txb[0]) * TFD_QUEUE_SIZE_MAX, GFP_KERNEL); if (!txq->txb) { - IWL_ERROR("kmalloc for auxilary BD " + IWL_ERROR("kmalloc for auxiliary BD " "structures failed\n"); goto error; } @@ -323,7 +323,7 @@ int iwl_tx_queue_init(struct iwl_priv *priv, int len; int rc = 0; - /* alocate command space + one big command for scan since scan + /* allocate command space + one big command for scan since scan * command is very huge the system will not have two scan at the * same time */ len = sizeof(struct iwl_cmd) * slots_num; @@ -405,7 +405,7 @@ const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; */ /**************************************************************/ -#if 0 /* temparary disable till we add real remove station */ +#if 0 /* temporary disable till we add real remove station */ static u8 iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) { int index = IWL_INVALID_STATION; @@ -482,7 +482,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) index = i; } - /* These twh conditions has the same outcome but keep them separate + /* These two conditions has the same outcome but keep them separate since they have different meaning */ if (unlikely(index == IWL_INVALID_STATION)) { spin_unlock_irqrestore(&priv->sta_lock, flags_spin); @@ -959,7 +959,7 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) /** * iwl_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit - * @priv: staging_rxon is comapred to active_rxon + * @priv: staging_rxon is compared to active_rxon * * If the RXON structure is changing sufficient to require a new * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1 @@ -1047,7 +1047,7 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv) /** * iwl_commit_rxon - commit staging_rxon to hardware * - * The RXON command in staging_rxon is commited to the hardware and + * The RXON command in staging_rxon is committed to the hardware and * the active_rxon structure is updated with the new data. This * function correctly transitions out of the RXON_ASSOC_MSK state if * a HW tune is required based on the RXON structure changes. @@ -2150,7 +2150,7 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) struct iwl_powertable_cmd cmd; /* If on battery, set to 3, - * if plugged into AC power, set to CAM ("continuosly aware mode"), + * if plugged into AC power, set to CAM ("continuously aware mode"), * else user level */ switch (mode) { case IWL_POWER_BATTERY: @@ -2440,7 +2440,7 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) } /* - * initilize rxon structure with default values fromm eeprom + * initialize rxon structure with default values from eeprom */ static void iwl_connection_init_rx_config(struct iwl_priv *priv) { @@ -2704,7 +2704,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) return priv->hw_setting.bcast_sta_id; } default: - IWL_WARNING("Unkown mode of operation: %d", priv->iw_mode); + IWL_WARNING("Unknown mode of operation: %d", priv->iw_mode); return priv->hw_setting.bcast_sta_id; } } @@ -3890,7 +3890,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv, * The management in the driver is as follows: * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled - * to replensish the iwl->rxq->rx_free. + * to replenish the iwl->rxq->rx_free. * + In iwl_rx_replenish (scheduled) if 'processed' != 'read' then the * iwl->rxq is replenished and the READ INDEX is updated (updating the * 'processed' and 'read' driver indexes as well) @@ -4047,12 +4047,12 @@ int iwl_rx_queue_restock(struct iwl_priv *priv) } /** - * iwl_rx_replensih - Move all used packet from rx_used to rx_free + * iwl_rx_replenish - Move all used packet from rx_used to rx_free * * When moving to rx_free an SKB is allocated for the slot. * * Also restock the Rx queue via iwl_rx_queue_restock. - * This is called as a scheduled work item (except for during intialization) + * This is called as a scheduled work item (except for during initialization) */ void iwl_rx_replenish(void *data) { @@ -6042,7 +6042,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) } /** - * iwl_init_alive_start - Called after REPLY_ALIVE notification receieved + * iwl_init_alive_start - Called after REPLY_ALIVE notification received * * Called after REPLY_ALIVE notification received from "initialize" uCode. * @@ -6693,7 +6693,7 @@ static void iwl_bg_request_scan(struct work_struct *data) return; done: - /* inform mac80211 sacn aborted */ + /* inform mac80211 scan aborted */ queue_work(priv->workqueue, &priv->scan_completed); mutex_unlock(&priv->mutex); } @@ -6997,7 +6997,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) } /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only - * what is exposed through include/ declrations */ + * what is exposed through include/ declarations */ if (unlikely(!iwl_param_disable_hw_scan && test_bit(STATUS_SCANNING, &priv->status))) { IWL_DEBUG_MAC80211("leave - scanning\n"); @@ -8541,7 +8541,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mutex_unlock(&priv->mutex); - IWL_DEBUG_INFO("Queing UP work.\n"); + IWL_DEBUG_INFO("Queueing UP work.\n"); queue_work(priv->workqueue, &priv->up); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 35ebe2b8976..1fe05402080 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -286,7 +286,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, txq->txb = kmalloc(sizeof(txq->txb[0]) * TFD_QUEUE_SIZE_MAX, GFP_KERNEL); if (!txq->txb) { - IWL_ERROR("kmalloc for auxilary BD " + IWL_ERROR("kmalloc for auxiliary BD " "structures failed\n"); goto error; } @@ -322,7 +322,7 @@ int iwl_tx_queue_init(struct iwl_priv *priv, int len; int rc = 0; - /* alocate command space + one big command for scan since scan + /* allocate command space + one big command for scan since scan * command is very huge the system will not have two scan at the * same time */ len = sizeof(struct iwl_cmd) * slots_num; @@ -405,7 +405,7 @@ const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /**************************************************************/ -#if 0 /* temparary disable till we add real remove station */ +#if 0 /* temporary disable till we add real remove station */ static u8 iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) { int index = IWL_INVALID_STATION; @@ -482,7 +482,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) } - /* These twh conditions has the same outcome but keep them separate + /* These two conditions has the same outcome but keep them separate since they have different meaning */ if (unlikely(index == IWL_INVALID_STATION)) { spin_unlock_irqrestore(&priv->sta_lock, flags_spin); @@ -970,7 +970,7 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) /** * iwl_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit - * @priv: staging_rxon is comapred to active_rxon + * @priv: staging_rxon is compared to active_rxon * * If the RXON structure is changing sufficient to require a new * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1 @@ -1073,7 +1073,7 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv) /** * iwl_commit_rxon - commit staging_rxon to hardware * - * The RXON command in staging_rxon is commited to the hardware and + * The RXON command in staging_rxon is committed to the hardware and * the active_rxon structure is updated with the new data. This * function correctly transitions out of the RXON_ASSOC_MSK state if * a HW tune is required based on the RXON structure changes. @@ -2224,7 +2224,7 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) struct iwl_powertable_cmd cmd; /* If on battery, set to 3, - * if plugged into AC power, set to CAM ("continuosly aware mode"), + * if plugged into AC power, set to CAM ("continuously aware mode"), * else user level */ switch (mode) { case IWL_POWER_BATTERY: @@ -2516,7 +2516,7 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) } /* - * initilize rxon structure with default values fromm eeprom + * initialize rxon structure with default values from eeprom */ static void iwl_connection_init_rx_config(struct iwl_priv *priv) { @@ -2787,7 +2787,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) return priv->hw_setting.bcast_sta_id; default: - IWL_WARNING("Unkown mode of operation: %d", priv->iw_mode); + IWL_WARNING("Unknown mode of operation: %d", priv->iw_mode); return priv->hw_setting.bcast_sta_id; } } @@ -4210,7 +4210,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv, * The management in the driver is as follows: * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled - * to replensish the iwl->rxq->rx_free. + * to replenish the iwl->rxq->rx_free. * + In iwl_rx_replenish (scheduled) if 'processed' != 'read' then the * iwl->rxq is replenished and the READ INDEX is updated (updating the * 'processed' and 'read' driver indexes as well) @@ -4368,12 +4368,12 @@ int iwl_rx_queue_restock(struct iwl_priv *priv) } /** - * iwl_rx_replensih - Move all used packet from rx_used to rx_free + * iwl_rx_replenish - Move all used packet from rx_used to rx_free * * When moving to rx_free an SKB is allocated for the slot. * * Also restock the Rx queue via iwl_rx_queue_restock. - * This is called as a scheduled work item (except for during intialization) + * This is called as a scheduled work item (except for during initialization) */ void iwl_rx_replenish(void *data) { @@ -6415,7 +6415,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) } /** - * iwl_init_alive_start - Called after REPLY_ALIVE notification receieved + * iwl_init_alive_start - Called after REPLY_ALIVE notification received * * Called after REPLY_ALIVE notification received from "initialize" uCode. * @@ -7068,7 +7068,7 @@ static void iwl_bg_request_scan(struct work_struct *data) return; done: - /* inform mac80211 sacn aborted */ + /* inform mac80211 scan aborted */ queue_work(priv->workqueue, &priv->scan_completed); mutex_unlock(&priv->mutex); } @@ -7386,7 +7386,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) } /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only - * what is exposed through include/ declrations */ + * what is exposed through include/ declarations */ if (unlikely(!iwl_param_disable_hw_scan && test_bit(STATUS_SCANNING, &priv->status))) { IWL_DEBUG_MAC80211("leave - scanning\n"); @@ -9159,7 +9159,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mutex_unlock(&priv->mutex); - IWL_DEBUG_INFO("Queing UP work.\n"); + IWL_DEBUG_INFO("Queueing UP work.\n"); queue_work(priv->workqueue, &priv->up); diff --git a/drivers/net/wireless/iwlwifi/iwlwifi.h b/drivers/net/wireless/iwlwifi/iwlwifi.h index 432ce887807..8e52fef9491 100644 --- a/drivers/net/wireless/iwlwifi/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi/iwlwifi.h @@ -54,9 +54,9 @@ extern struct pci_device_id iwl_hw_card_ids[]; * Driver implementation data structures, constants, inline * functions * - * NOTE: DO NOT PUT HARDWARE/UCODE SPECIFIC DECLRATIONS HERE + * NOTE: DO NOT PUT HARDWARE/UCODE SPECIFIC DECLARATIONS HERE * - * Hardware specific declrations go into iwl-*hw.h + * Hardware specific declarations go into iwl-*hw.h * */ @@ -467,7 +467,7 @@ union iwl_qos_capabity { u8 val; }; -/* QoS sturctures */ +/* QoS structures */ struct iwl_qos_info { int qos_enable; int qos_active; -- cgit v1.2.3-70-g09d2 From 91e1747384b80813c2a6c7a9d2dd99722d5b9e1e Mon Sep 17 00:00:00 2001 From: Ian Schram Date: Thu, 25 Oct 2007 17:15:23 +0800 Subject: iwlwifi: rename iwl_eeprom_aqcuire_semaphore to _acquire_ Correct the spelling of aqcuire. Signed-off-by: Ian Schram Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 2 +- drivers/net/wireless/iwlwifi/iwl-3945.h | 2 +- drivers/net/wireless/iwlwifi/iwl-4965.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl-4965.h | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl4965-base.c | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 3a45fe99a83..d6112816bad 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -2302,7 +2302,7 @@ struct pci_device_id iwl_hw_card_ids[] = { {0} }; -inline int iwl_eeprom_aqcuire_semaphore(struct iwl_priv *priv) +inline int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv) { _iwl_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); return 0; diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 813902e9f8c..2bc5e9a79be 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -30,7 +30,7 @@ /* * Forward declare iwl-3945.c functions for iwl-base.c */ -extern int iwl_eeprom_aqcuire_semaphore(struct iwl_priv *priv); +extern int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv); extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv); extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv); extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 02708c7ee51..7ff8f72d482 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -4700,7 +4700,7 @@ struct pci_device_id iwl_hw_card_ids[] = { {0} }; -int iwl_eeprom_aqcuire_semaphore(struct iwl_priv *priv) +int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv) { u16 count; int rc; @@ -4713,7 +4713,7 @@ int iwl_eeprom_aqcuire_semaphore(struct iwl_priv *priv) CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, EEPROM_SEM_TIMEOUT); if (rc >= 0) { - IWL_DEBUG_IO("Aqcuired semaphore after %d tries.\n", + IWL_DEBUG_IO("Acquired semaphore after %d tries.\n", count+1); return rc; } diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 4c700812b45..b31a7e4b7d7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -32,7 +32,7 @@ struct sta_ht_info; /* * Forward declare iwl-4965.c functions for iwl-base.c */ -extern int iwl_eeprom_aqcuire_semaphore(struct iwl_priv *priv); +extern int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv); extern void iwl_eeprom_release_semaphore(struct iwl_priv *priv); extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv, diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 60e25464cee..4fd9eac6516 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -1553,9 +1553,9 @@ int iwl_eeprom_init(struct iwl_priv *priv) return -ENOENT; } - rc = iwl_eeprom_aqcuire_semaphore(priv); + rc = iwl_eeprom_acquire_semaphore(priv); if (rc < 0) { - IWL_ERROR("Failed to aqcuire EEPROM semaphore.\n"); + IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); return -ENOENT; } diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 1fe05402080..eb2d7a555bb 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -1602,9 +1602,9 @@ int iwl_eeprom_init(struct iwl_priv *priv) return -ENOENT; } - rc = iwl_eeprom_aqcuire_semaphore(priv); + rc = iwl_eeprom_acquire_semaphore(priv); if (rc < 0) { - IWL_ERROR("Failed to aqcuire EEPROM semaphore.\n"); + IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); return -ENOENT; } -- cgit v1.2.3-70-g09d2 From fc4b6853fb5e729616159d4f17785f089227a8e8 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 25 Oct 2007 17:15:24 +0800 Subject: iwlwifi: renaming last_used and first_empty This patch renames queue pointers to write_ptr and read_ptr instead of first_empty and last_used. This is closer to technical terminology we everyday use Signed-off-by: Tomas Winkler Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 12 +++--- drivers/net/wireless/iwlwifi/iwl-4965.c | 26 ++++++------ drivers/net/wireless/iwlwifi/iwl3945-base.c | 60 +++++++++++++-------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 64 ++++++++++++++--------------- drivers/net/wireless/iwlwifi/iwlwifi.h | 4 +- 5 files changed, 83 insertions(+), 83 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index d6112816bad..b8d43436d35 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -526,14 +526,14 @@ int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, } /** - * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.last_used] + * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] * * Does NOT advance any indexes */ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) { struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; - struct iwl_tfd_frame *bd = &bd_tmp[txq->q.last_used]; + struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; struct pci_dev *dev = priv->pci_dev; int i; int counter; @@ -556,12 +556,12 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) for (i = 1; i < counter; i++) { pci_unmap_single(dev, le32_to_cpu(bd->pa[i].addr), le32_to_cpu(bd->pa[i].len), PCI_DMA_TODEVICE); - if (txq->txb[txq->q.last_used].skb[0]) { - struct sk_buff *skb = txq->txb[txq->q.last_used].skb[0]; - if (txq->txb[txq->q.last_used].skb[0]) { + if (txq->txb[txq->q.read_ptr].skb[0]) { + struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[0]; + if (txq->txb[txq->q.read_ptr].skb[0]) { /* Can be called from interrupt context */ dev_kfree_skb_any(skb); - txq->txb[txq->q.last_used].skb[0] = NULL; + txq->txb[txq->q.read_ptr].skb[0] = NULL; } } } diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 7ff8f72d482..d7e181f9ce8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -1749,14 +1749,14 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) } /** - * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.last_used] + * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] * * Does NOT advance any indexes */ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) { struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; - struct iwl_tfd_frame *bd = &bd_tmp[txq->q.last_used]; + struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; struct pci_dev *dev = priv->pci_dev; int i; int counter = 0; @@ -1796,11 +1796,11 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) IWL_GET_BITS(bd->pa[index], tb1_len), PCI_DMA_TODEVICE); - if (txq->txb[txq->q.last_used].skb[i]) { - struct sk_buff *skb = txq->txb[txq->q.last_used].skb[i]; + if (txq->txb[txq->q.read_ptr].skb[i]) { + struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[i]; dev_kfree_skb(skb); - txq->txb[txq->q.last_used].skb[i] = NULL; + txq->txb[txq->q.read_ptr].skb[i] = NULL; } } return 0; @@ -2776,11 +2776,11 @@ int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv, len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. - tfd_offset[txq->q.first_empty], byte_cnt, len); + tfd_offset[txq->q.write_ptr], byte_cnt, len); - if (txq->q.first_empty < IWL4965_MAX_WIN_SIZE) + if (txq->q.write_ptr < IWL4965_MAX_WIN_SIZE) IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. - tfd_offset[IWL4965_QUEUE_SIZE + txq->q.first_empty], + tfd_offset[IWL4965_QUEUE_SIZE + txq->q.write_ptr], byte_cnt, len); return 0; @@ -4134,7 +4134,7 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, */ iwl4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); /* releases all the TFDs until the SSN */ - if (txq->q.last_used != (ba_resp_scd_ssn & 0xff)) + if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) iwl_tx_queue_reclaim(priv, ba_resp_scd_flow, index); } @@ -4205,8 +4205,8 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, iwl_set_bits_restricted_reg(priv, SCD_QUEUECHAIN_SEL, (1<txq[txq_id].q.last_used = (ssn_idx & 0xff); - priv->txq[txq_id].q.first_empty = (ssn_idx & 0xff); + priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); + priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); /* supposes that ssn_idx is valid (!= 0xFFF) */ iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); @@ -4257,8 +4257,8 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, iwl_clear_bits_restricted_reg(priv, SCD_QUEUECHAIN_SEL, (1 << txq_id)); - priv->txq[txq_id].q.last_used = (ssn_idx & 0xff); - priv->txq[txq_id].q.first_empty = (ssn_idx & 0xff); + priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); + priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); /* supposes that ssn_idx is valid (!= 0xFFF) */ iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 4fd9eac6516..f6022649a6b 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -209,9 +209,9 @@ static void iwl_print_hex_dump(int level, void *p, u32 len) static int iwl_queue_space(const struct iwl_queue *q) { - int s = q->last_used - q->first_empty; + int s = q->read_ptr - q->write_ptr; - if (q->last_used > q->first_empty) + if (q->read_ptr > q->write_ptr) s -= q->n_bd; if (s <= 0) @@ -237,9 +237,9 @@ static inline int iwl_queue_dec_wrap(int index, int n_bd) static inline int x2_queue_used(const struct iwl_queue *q, int i) { - return q->first_empty > q->last_used ? - (i >= q->last_used && i < q->first_empty) : - !(i < q->last_used && i >= q->first_empty); + return q->write_ptr > q->read_ptr ? + (i >= q->read_ptr && i < q->write_ptr) : + !(i < q->read_ptr && i >= q->write_ptr); } static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) @@ -273,7 +273,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, if (q->high_mark < 2) q->high_mark = 2; - q->first_empty = q->last_used = 0; + q->write_ptr = q->read_ptr = 0; return 0; } @@ -369,8 +369,8 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) return; /* first, empty all BD's */ - for (; q->first_empty != q->last_used; - q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd)) + for (; q->write_ptr != q->read_ptr; + q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) iwl_hw_txq_free_tfd(priv, txq); len = sizeof(struct iwl_cmd) * q->n_window; @@ -649,12 +649,12 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) spin_lock_irqsave(&priv->hcmd_lock, flags); - tfd = &txq->bd[q->first_empty]; + tfd = &txq->bd[q->write_ptr]; memset(tfd, 0, sizeof(*tfd)); control_flags = (u32 *) tfd; - idx = get_cmd_index(q, q->first_empty, cmd->meta.flags & CMD_SIZE_HUGE); + idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE); out_cmd = &txq->cmd[idx]; out_cmd->hdr.cmd = cmd->id; @@ -666,7 +666,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) out_cmd->hdr.flags = 0; out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | - INDEX_TO_SEQ(q->first_empty)); + INDEX_TO_SEQ(q->write_ptr)); if (out_cmd->meta.flags & CMD_SIZE_HUGE) out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); @@ -682,10 +682,10 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) "%d bytes at %d[%d]:%d\n", get_cmd_string(out_cmd->hdr.cmd), out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), - fix_size, q->first_empty, idx, IWL_CMD_QUEUE_NUM); + fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM); txq->need_update = 1; - q->first_empty = iwl_queue_inc_wrap(q->first_empty, q->n_bd); + q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); ret = iwl_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->hcmd_lock, flags); @@ -2799,21 +2799,21 @@ static int iwl_tx_skb(struct iwl_priv *priv, spin_lock_irqsave(&priv->lock, flags); - tfd = &txq->bd[q->first_empty]; + tfd = &txq->bd[q->write_ptr]; memset(tfd, 0, sizeof(*tfd)); control_flags = (u32 *) tfd; - idx = get_cmd_index(q, q->first_empty, 0); + idx = get_cmd_index(q, q->write_ptr, 0); - memset(&(txq->txb[q->first_empty]), 0, sizeof(struct iwl_tx_info)); - txq->txb[q->first_empty].skb[0] = skb; - memcpy(&(txq->txb[q->first_empty].status.control), + memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); + txq->txb[q->write_ptr].skb[0] = skb; + memcpy(&(txq->txb[q->write_ptr].status.control), ctl, sizeof(struct ieee80211_tx_control)); out_cmd = &txq->cmd[idx]; memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx)); out_cmd->hdr.cmd = REPLY_TX; out_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | - INDEX_TO_SEQ(q->first_empty))); + INDEX_TO_SEQ(q->write_ptr))); /* copy frags header */ memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len); @@ -2881,7 +2881,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, iwl_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, ieee80211_get_hdrlen(fc)); - q->first_empty = iwl_queue_inc_wrap(q->first_empty, q->n_bd); + q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); rc = iwl_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); @@ -3375,20 +3375,20 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) { IWL_ERROR("Read index for DMA queue txq id (%d), index %d, " "is out of range [0-%d] %d %d.\n", txq_id, - index, q->n_bd, q->first_empty, q->last_used); + index, q->n_bd, q->write_ptr, q->read_ptr); return 0; } for (index = iwl_queue_inc_wrap(index, q->n_bd); - q->last_used != index; - q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd)) { + q->read_ptr != index; + q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { if (txq_id != IWL_CMD_QUEUE_NUM) { iwl_txstatus_to_ieee(priv, - &(txq->txb[txq->q.last_used])); + &(txq->txb[txq->q.read_ptr])); iwl_hw_txq_free_tfd(priv, txq); } else if (nfreed > 1) { IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, - q->first_empty, q->last_used); + q->write_ptr, q->read_ptr); queue_work(priv->workqueue, &priv->restart); } nfreed++; @@ -3428,12 +3428,12 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) { IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " "is out of range [0-%d] %d %d\n", txq_id, - index, txq->q.n_bd, txq->q.first_empty, - txq->q.last_used); + index, txq->q.n_bd, txq->q.write_ptr, + txq->q.read_ptr); return; } - tx_status = &(txq->txb[txq->q.last_used].status); + tx_status = &(txq->txb[txq->q.read_ptr].status); tx_status->retry_count = tx_resp->failure_frame; tx_status->queue_number = status; @@ -4368,14 +4368,14 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, if (rc) return rc; iwl_write_restricted(priv, HBUS_TARG_WRPTR, - txq->q.first_empty | (txq_id << 8)); + txq->q.write_ptr | (txq_id << 8)); iwl_release_restricted_access(priv); /* else not in power-save mode, uCode will never sleep when we're * trying to tx (during RFKILL, we're not trying to tx). */ } else iwl_write32(priv, HBUS_TARG_WRPTR, - txq->q.first_empty | (txq_id << 8)); + txq->q.write_ptr | (txq_id << 8)); txq->need_update = 0; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index eb2d7a555bb..e0feca8acdd 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -208,9 +208,9 @@ static void iwl_print_hex_dump(int level, void *p, u32 len) static int iwl_queue_space(const struct iwl_queue *q) { - int s = q->last_used - q->first_empty; + int s = q->read_ptr - q->write_ptr; - if (q->last_used > q->first_empty) + if (q->read_ptr > q->write_ptr) s -= q->n_bd; if (s <= 0) @@ -236,9 +236,9 @@ static inline int iwl_queue_dec_wrap(int index, int n_bd) static inline int x2_queue_used(const struct iwl_queue *q, int i) { - return q->first_empty > q->last_used ? - (i >= q->last_used && i < q->first_empty) : - !(i < q->last_used && i >= q->first_empty); + return q->write_ptr > q->read_ptr ? + (i >= q->read_ptr && i < q->write_ptr) : + !(i < q->read_ptr && i >= q->write_ptr); } static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) @@ -272,7 +272,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, if (q->high_mark < 2) q->high_mark = 2; - q->first_empty = q->last_used = 0; + q->write_ptr = q->read_ptr = 0; return 0; } @@ -368,8 +368,8 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) return; /* first, empty all BD's */ - for (; q->first_empty != q->last_used; - q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd)) + for (; q->write_ptr != q->read_ptr; + q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) iwl_hw_txq_free_tfd(priv, txq); len = sizeof(struct iwl_cmd) * q->n_window; @@ -652,12 +652,12 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) spin_lock_irqsave(&priv->hcmd_lock, flags); - tfd = &txq->bd[q->first_empty]; + tfd = &txq->bd[q->write_ptr]; memset(tfd, 0, sizeof(*tfd)); control_flags = (u32 *) tfd; - idx = get_cmd_index(q, q->first_empty, cmd->meta.flags & CMD_SIZE_HUGE); + idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE); out_cmd = &txq->cmd[idx]; out_cmd->hdr.cmd = cmd->id; @@ -669,7 +669,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) out_cmd->hdr.flags = 0; out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | - INDEX_TO_SEQ(q->first_empty)); + INDEX_TO_SEQ(q->write_ptr)); if (out_cmd->meta.flags & CMD_SIZE_HUGE) out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); @@ -681,11 +681,11 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) "%d bytes at %d[%d]:%d\n", get_cmd_string(out_cmd->hdr.cmd), out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), - fix_size, q->first_empty, idx, IWL_CMD_QUEUE_NUM); + fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM); txq->need_update = 1; ret = iwl4965_tx_queue_update_wr_ptr(priv, txq, 0); - q->first_empty = iwl_queue_inc_wrap(q->first_empty, q->n_bd); + q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); iwl_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->hcmd_lock, flags); @@ -2889,21 +2889,21 @@ static int iwl_tx_skb(struct iwl_priv *priv, spin_lock_irqsave(&priv->lock, flags); - tfd = &txq->bd[q->first_empty]; + tfd = &txq->bd[q->write_ptr]; memset(tfd, 0, sizeof(*tfd)); control_flags = (u32 *) tfd; - idx = get_cmd_index(q, q->first_empty, 0); + idx = get_cmd_index(q, q->write_ptr, 0); - memset(&(txq->txb[q->first_empty]), 0, sizeof(struct iwl_tx_info)); - txq->txb[q->first_empty].skb[0] = skb; - memcpy(&(txq->txb[q->first_empty].status.control), + memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); + txq->txb[q->write_ptr].skb[0] = skb; + memcpy(&(txq->txb[q->write_ptr].status.control), ctl, sizeof(struct ieee80211_tx_control)); out_cmd = &txq->cmd[idx]; memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx)); out_cmd->hdr.cmd = REPLY_TX; out_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | - INDEX_TO_SEQ(q->first_empty))); + INDEX_TO_SEQ(q->write_ptr))); /* copy frags header */ memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len); @@ -2969,7 +2969,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, iwl4965_tx_queue_update_wr_ptr(priv, txq, len); - q->first_empty = iwl_queue_inc_wrap(q->first_empty, q->n_bd); + q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); rc = iwl_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); @@ -3463,20 +3463,20 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) { IWL_ERROR("Read index for DMA queue txq id (%d), index %d, " "is out of range [0-%d] %d %d.\n", txq_id, - index, q->n_bd, q->first_empty, q->last_used); + index, q->n_bd, q->write_ptr, q->read_ptr); return 0; } for (index = iwl_queue_inc_wrap(index, q->n_bd); - q->last_used != index; - q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd)) { + q->read_ptr != index; + q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { if (txq_id != IWL_CMD_QUEUE_NUM) { iwl_txstatus_to_ieee(priv, - &(txq->txb[txq->q.last_used])); + &(txq->txb[txq->q.read_ptr])); iwl_hw_txq_free_tfd(priv, txq); } else if (nfreed > 1) { IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, - q->first_empty, q->last_used); + q->write_ptr, q->read_ptr); queue_work(priv->workqueue, &priv->restart); } nfreed++; @@ -3564,7 +3564,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, IWL_DEBUG_TX_REPLY("FrameCnt = %d, StartIdx=%d \n", agg->frame_count, agg->start_idx); - tx_status = &(priv->txq[txq_id].txb[txq->q.last_used].status); + tx_status = &(priv->txq[txq_id].txb[txq->q.read_ptr].status); tx_status->retry_count = tx_resp->failure_frame; tx_status->queue_number = status & 0xff; tx_status->queue_length = tx_resp->bt_kill_count; @@ -3669,8 +3669,8 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) { IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " "is out of range [0-%d] %d %d\n", txq_id, - index, txq->q.n_bd, txq->q.first_empty, - txq->q.last_used); + index, txq->q.n_bd, txq->q.write_ptr, + txq->q.read_ptr); return; } @@ -3705,7 +3705,7 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, /* TODO: send BAR */ } - if ((txq->q.last_used != (scd_ssn & 0xff))) { + if ((txq->q.read_ptr != (scd_ssn & 0xff))) { index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn " "%d index %d\n", scd_ssn , index); @@ -3714,7 +3714,7 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, } else { #endif /* CONFIG_IWLWIFI_HT_AGG */ #endif /* CONFIG_IWLWIFI_HT */ - tx_status = &(txq->txb[txq->q.last_used].status); + tx_status = &(txq->txb[txq->q.read_ptr].status); tx_status->retry_count = tx_resp->failure_frame; tx_status->queue_number = status; @@ -4692,14 +4692,14 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, if (rc) return rc; iwl_write_restricted(priv, HBUS_TARG_WRPTR, - txq->q.first_empty | (txq_id << 8)); + txq->q.write_ptr | (txq_id << 8)); iwl_release_restricted_access(priv); /* else not in power-save mode, uCode will never sleep when we're * trying to tx (during RFKILL, we're not trying to tx). */ } else iwl_write32(priv, HBUS_TARG_WRPTR, - txq->q.first_empty | (txq_id << 8)); + txq->q.write_ptr | (txq_id << 8)); txq->need_update = 0; diff --git a/drivers/net/wireless/iwlwifi/iwlwifi.h b/drivers/net/wireless/iwlwifi/iwlwifi.h index 8e52fef9491..bcff696937f 100644 --- a/drivers/net/wireless/iwlwifi/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi/iwlwifi.h @@ -144,8 +144,8 @@ struct iwl_rt_tx_hdr { */ struct iwl_queue { int n_bd; /* number of BDs in this queue */ - int first_empty; /* 1-st empty entry (index) host_w*/ - int last_used; /* last used entry (index) host_r*/ + int write_ptr; /* 1-st empty entry (index) host_w*/ + int read_ptr; /* last used entry (index) host_r*/ dma_addr_t dma_addr; /* physical addr for BD's */ int n_window; /* safe queue window */ u32 id; -- cgit v1.2.3-70-g09d2 From f1f1f5c730a3598b36989c63d387d9cab63161c7 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 25 Oct 2007 17:15:26 +0800 Subject: iwlwifi: add TGN flag to qos parameters This patch adds TGN flag to QoS parameters. This flag governs enablement of NAV shortening with CF-End and filters in 4 or 8K RX AMSDU packets Signed-off-by: Tomas Winkler Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl4965-base.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index e0feca8acdd..0a878cf49e0 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -2057,16 +2057,21 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) !priv->qos_data.qos_cap.q_AP.txop_request) priv->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TXOP_TYPE_MSK; - if (priv->qos_data.qos_active) priv->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_UPDATE_EDCA_MSK; +#ifdef CONFIG_IWLWIFI_HT + if (priv->is_ht_enabled && priv->current_assoc_ht.is_ht) + priv->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; +#endif /* CONFIG_IWLWIFI_HT */ + spin_unlock_irqrestore(&priv->lock, flags); if (force || iwl_is_associated(priv)) { - IWL_DEBUG_QOS("send QoS cmd with Qos active %d \n", - priv->qos_data.qos_active); + IWL_DEBUG_QOS("send QoS cmd with Qos active=%d FLAGS=0x%X\n", + priv->qos_data.qos_active, + priv->qos_data.def_qos_parm.qos_flags); iwl_send_qos_params_command(priv, &(priv->qos_data.def_qos_parm)); -- cgit v1.2.3-70-g09d2 From bc434dd2961763d33836f6e2e119e1d4a6325e4d Mon Sep 17 00:00:00 2001 From: Ian Schram Date: Thu, 25 Oct 2007 17:15:29 +0800 Subject: iwlwifi: Beautify by removing superfluous newlines and code Moving code around, lindent, and whatnot created several places where there appeared to be an 75 column "rule" instead of 80. This patch removes those that I can spot, hopefully increasing readability. Signed-off-by: Ian Schram Signed-off-by: Tomas Winkler Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 44 ++++++++++------------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 19 ++++--------- 2 files changed, 21 insertions(+), 42 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 125d99e9476..5041368a9a2 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -1352,7 +1352,6 @@ static int iwl_update_sta_key_info(struct iwl_priv *priv, break; case ALG_TKIP: case ALG_WEP: - return -EINVAL; default: return -EINVAL; } @@ -2647,11 +2646,9 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) { if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ || (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_REASSOC_REQ) - cmd->cmd.tx.timeout.pm_frame_timeout = - cpu_to_le16(3); + cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(3); else - cmd->cmd.tx.timeout.pm_frame_timeout = - cpu_to_le16(2); + cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(2); } else cmd->cmd.tx.timeout.pm_frame_timeout = 0; @@ -3158,24 +3155,21 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1); __list_for_each(p, &priv->ibss_mac_hash[index]) { - entry = - list_entry(p, struct iwl_ibss_seq, list); + entry = list_entry(p, struct iwl_ibss_seq, list); if (!compare_ether_addr(entry->mac, mac)) break; } if (p == &priv->ibss_mac_hash[index]) { entry = kzalloc(sizeof(*entry), GFP_ATOMIC); if (!entry) { - IWL_ERROR - ("Cannot malloc new mac entry\n"); + IWL_ERROR("Cannot malloc new mac entry\n"); return 0; } memcpy(entry->mac, mac, ETH_ALEN); entry->seq_num = seq; entry->frag_num = frag; entry->packet_time = jiffies; - list_add(&entry->list, - &priv->ibss_mac_hash[index]); + list_add(&entry->list, &priv->ibss_mac_hash[index]); return 0; } last_seq = &entry->seq_num; @@ -3322,9 +3316,8 @@ static int iwl_get_measurement(struct iwl_priv *priv, switch (spectrum_resp_status) { case 0: /* Command will be handled */ if (res->u.spectrum.id != 0xff) { - IWL_DEBUG_INFO - ("Replaced existing measurement: %d\n", - res->u.spectrum.id); + IWL_DEBUG_INFO("Replaced existing measurement: %d\n", + res->u.spectrum.id); priv->measurement_status &= ~MEASUREMENT_READY; } priv->measurement_status |= MEASUREMENT_ACTIVE; @@ -5527,8 +5520,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) iwl_release_restricted_access(priv); if (!errcnt) - IWL_DEBUG_INFO - ("ucode image in INSTRUCTION memory is good\n"); + IWL_DEBUG_INFO("ucode image in INSTRUCTION memory is good\n"); return rc; } @@ -5827,16 +5819,11 @@ static int iwl_read_ucode(struct iwl_priv *priv) boot_size = le32_to_cpu(ucode->boot_size); IWL_DEBUG_INFO("f/w package hdr ucode version = 0x%x\n", ver); - IWL_DEBUG_INFO("f/w package hdr runtime inst size = %u\n", - inst_size); - IWL_DEBUG_INFO("f/w package hdr runtime data size = %u\n", - data_size); - IWL_DEBUG_INFO("f/w package hdr init inst size = %u\n", - init_size); - IWL_DEBUG_INFO("f/w package hdr init data size = %u\n", - init_data_size); - IWL_DEBUG_INFO("f/w package hdr boot inst size = %u\n", - boot_size); + IWL_DEBUG_INFO("f/w package hdr runtime inst size = %u\n", inst_size); + IWL_DEBUG_INFO("f/w package hdr runtime data size = %u\n", data_size); + IWL_DEBUG_INFO("f/w package hdr init inst size = %u\n", init_size); + IWL_DEBUG_INFO("f/w package hdr init data size = %u\n", init_data_size); + IWL_DEBUG_INFO("f/w package hdr boot inst size = %u\n", boot_size); /* Verify size of file vs. image size info in file's header */ if (ucode_raw->size < sizeof(*ucode) + @@ -6827,7 +6814,7 @@ static void iwl_bg_post_associate(struct work_struct *data) default: IWL_ERROR("%s Should not be called in %d mode\n", - __FUNCTION__, priv->iw_mode); + __FUNCTION__, priv->iw_mode); break; } @@ -6841,8 +6828,7 @@ static void iwl_bg_post_associate(struct work_struct *data) static void iwl_bg_abort_scan(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, - abort_scan); + struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); if (!iwl_is_ready(priv)) return; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 0a878cf49e0..076c5518211 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -1384,7 +1384,6 @@ static int iwl_update_sta_key_info(struct iwl_priv *priv, break; case ALG_TKIP: case ALG_WEP: - return -EINVAL; default: return -EINVAL; } @@ -2734,11 +2733,9 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) { if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ || (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_REASSOC_REQ) - cmd->cmd.tx.timeout.pm_frame_timeout = - cpu_to_le16(3); + cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(3); else - cmd->cmd.tx.timeout.pm_frame_timeout = - cpu_to_le16(2); + cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(2); } else cmd->cmd.tx.timeout.pm_frame_timeout = 0; @@ -3249,24 +3246,21 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1); __list_for_each(p, &priv->ibss_mac_hash[index]) { - entry = - list_entry(p, struct iwl_ibss_seq, list); + entry = list_entry(p, struct iwl_ibss_seq, list); if (!compare_ether_addr(entry->mac, mac)) break; } if (p == &priv->ibss_mac_hash[index]) { entry = kzalloc(sizeof(*entry), GFP_ATOMIC); if (!entry) { - IWL_ERROR - ("Cannot malloc new mac entry\n"); + IWL_ERROR("Cannot malloc new mac entry\n"); return 0; } memcpy(entry->mac, mac, ETH_ALEN); entry->seq_num = seq; entry->frag_num = frag; entry->packet_time = jiffies; - list_add(&entry->list, - &priv->ibss_mac_hash[index]); + list_add(&entry->list, &priv->ibss_mac_hash[index]); return 0; } last_seq = &entry->seq_num; @@ -7234,8 +7228,7 @@ static void iwl_bg_post_associate(struct work_struct *data) static void iwl_bg_abort_scan(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, - abort_scan); + struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); if (!iwl_is_ready(priv)) return; -- cgit v1.2.3-70-g09d2 From 3edb059a40469fd058806c47f9f122dfee38b36c Mon Sep 17 00:00:00 2001 From: Ian Schram Date: Thu, 25 Oct 2007 17:15:30 +0800 Subject: iwlwifi: remove late null-check and duplicate bug_on These pieces of code appear to be useless. The BUG_ON is also performed in iwl_send_cmd_async. Serious karma would be needed to enter iwl_ativate_qos with a null priv. I had a deja vu when patching this, but for the life of me I couldn't track down a similar patch. Signed-off-by: Ian Schram Signed-off-by: Tomas Winkler Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 7 ------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 7 ------- 2 files changed, 14 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 5041368a9a2..c6606e1af51 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -808,10 +808,6 @@ out: int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) { - /* A command can not be asynchronous AND expect an SKB to be set. */ - BUG_ON((cmd->meta.flags & CMD_ASYNC) && - (cmd->meta.flags & CMD_WANT_SKB)); - if (cmd->meta.flags & CMD_ASYNC) return iwl_send_cmd_async(priv, cmd); @@ -1968,9 +1964,6 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) { unsigned long flags; - if (priv == NULL) - return; - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 076c5518211..fa11eb95699 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -806,10 +806,6 @@ out: int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) { - /* A command can not be asynchronous AND expect an SKB to be set. */ - BUG_ON((cmd->meta.flags & CMD_ASYNC) && - (cmd->meta.flags & CMD_WANT_SKB)); - if (cmd->meta.flags & CMD_ASYNC) return iwl_send_cmd_async(priv, cmd); @@ -2040,9 +2036,6 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) { unsigned long flags; - if (priv == NULL) - return; - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; -- cgit v1.2.3-70-g09d2 From 12a70fbe57b714a235e68c261267406d6b614574 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 25 Oct 2007 17:15:31 +0800 Subject: iwlwifi: remove cck_power_index_compensation cck_power_index_compensation variable was never used Signed-off-by: Tomas Winkler Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-priv.h | 1 - drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 -- 2 files changed, 3 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-priv.h b/drivers/net/wireless/iwlwifi/iwl-priv.h index 6b490d08fea..f43679a42ae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-priv.h +++ b/drivers/net/wireless/iwlwifi/iwl-priv.h @@ -278,7 +278,6 @@ struct iwl_priv { #define IWL_DEFAULT_TX_POWER 0x0F s8 user_txpower_limit; s8 max_channel_txpower_limit; - u32 cck_power_index_compensation; #ifdef CONFIG_PM u32 pm_state[16]; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index fa11eb95699..60174202ca1 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -9088,8 +9088,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->channel_width = IWL_CHANNEL_WIDTH_40MHZ; priv->valid_antenna = 0x7; /* assume all 3 connected */ priv->ps_mode = IWL_MIMO_PS_NONE; - priv->cck_power_index_compensation = iwl_read32( - priv, CSR_HW_REV_WA_REG); iwl4965_set_rxon_chain(priv); -- cgit v1.2.3-70-g09d2 From d860965200c867e7e3e81ede8572cffff8c7eb24 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 25 Oct 2007 17:15:35 +0800 Subject: iwlwifi: replace restricted_reg with prph This patch renames restricted_reg suffix with more proper name prhp for function accessing registers on the periphery bus. Signed-off-by: Tomas Winkler Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 36 +++++------ drivers/net/wireless/iwlwifi/iwl-4965.c | 64 +++++++++---------- drivers/net/wireless/iwlwifi/iwl-io.h | 98 +++++++++-------------------- drivers/net/wireless/iwlwifi/iwl3945-base.c | 40 ++++++------ drivers/net/wireless/iwlwifi/iwl4965-base.c | 38 +++++------ 5 files changed, 119 insertions(+), 157 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 1fda41107df..59e2fa27092 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -733,7 +733,7 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) rc = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, &val); if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) { - iwl_set_bits_mask_restricted_reg(priv, APMG_PS_CTRL_REG, + iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VAUX, ~APMG_PS_CTRL_MSK_PWR_SRC); iwl_release_restricted_access(priv); @@ -744,7 +744,7 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) } else iwl_release_restricted_access(priv); } else { - iwl_set_bits_mask_restricted_reg(priv, APMG_PS_CTRL_REG, + iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, ~APMG_PS_CTRL_MSK_PWR_SRC); @@ -806,18 +806,18 @@ static int iwl3945_tx_reset(struct iwl_priv *priv) } /* bypass mode */ - iwl_write_restricted_reg(priv, SCD_MODE_REG, 0x2); + iwl_write_prph(priv, SCD_MODE_REG, 0x2); /* RA 0 is active */ - iwl_write_restricted_reg(priv, SCD_ARASTAT_REG, 0x01); + iwl_write_prph(priv, SCD_ARASTAT_REG, 0x01); /* all 6 fifo are active */ - iwl_write_restricted_reg(priv, SCD_TXFACT_REG, 0x3f); + iwl_write_prph(priv, SCD_TXFACT_REG, 0x3f); - iwl_write_restricted_reg(priv, SCD_SBYP_MODE_1_REG, 0x010000); - iwl_write_restricted_reg(priv, SCD_SBYP_MODE_2_REG, 0x030002); - iwl_write_restricted_reg(priv, SCD_TXF4MF_REG, 0x000004); - iwl_write_restricted_reg(priv, SCD_TXF5MF_REG, 0x000005); + iwl_write_prph(priv, SCD_SBYP_MODE_1_REG, 0x010000); + iwl_write_prph(priv, SCD_SBYP_MODE_2_REG, 0x030002); + iwl_write_prph(priv, SCD_TXF4MF_REG, 0x000004); + iwl_write_prph(priv, SCD_TXF5MF_REG, 0x000005); iwl_write_restricted(priv, FH_TSSR_CBB_BASE, priv->hw_setting.shared_phys); @@ -902,11 +902,11 @@ int iwl_hw_nic_init(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_restricted_reg(priv, APMG_CLK_EN_REG, + iwl_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); udelay(20); - iwl_set_bits_restricted_reg(priv, APMG_PCIDEV_STT_REG, + iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); iwl_release_restricted_access(priv); spin_unlock_irqrestore(&priv->lock, flags); @@ -1045,7 +1045,7 @@ void iwl_hw_txq_ctx_stop(struct iwl_priv *priv) } /* stop SCD */ - iwl_write_restricted_reg(priv, SCD_MODE_REG, 0); + iwl_write_prph(priv, SCD_MODE_REG, 0); /* reset TFD queues */ for (queue = TFD_QUEUE_MIN; queue < TFD_QUEUE_MAX; queue++) { @@ -1111,7 +1111,7 @@ int iwl_hw_nic_reset(struct iwl_priv *priv) rc = iwl_grab_restricted_access(priv); if (!rc) { - iwl_write_restricted_reg(priv, APMG_CLK_CTRL_REG, + iwl_write_prph(priv, APMG_CLK_CTRL_REG, APMG_CLK_VAL_BSM_CLK_RQT); udelay(10); @@ -1119,20 +1119,20 @@ int iwl_hw_nic_reset(struct iwl_priv *priv) iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); - iwl_write_restricted_reg(priv, APMG_RTC_INT_MSK_REG, 0x0); - iwl_write_restricted_reg(priv, APMG_RTC_INT_STT_REG, + iwl_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0); + iwl_write_prph(priv, APMG_RTC_INT_STT_REG, 0xFFFFFFFF); /* enable DMA */ - iwl_write_restricted_reg(priv, APMG_CLK_EN_REG, + iwl_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); udelay(10); - iwl_set_bits_restricted_reg(priv, APMG_PS_CTRL_REG, + iwl_set_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); udelay(5); - iwl_clear_bits_restricted_reg(priv, APMG_PS_CTRL_REG, + iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); iwl_release_restricted_access(priv); } diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index a728c45b0d3..1e56dfa0cfb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -192,37 +192,35 @@ u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr) static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) { - int rc = 0; + int ret; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); - if (rc) { + ret = iwl_grab_restricted_access(priv); + if (ret) { spin_unlock_irqrestore(&priv->lock, flags); - return rc; + return ret; } if (!pwr_max) { u32 val; - rc = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, + ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, &val); if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) - iwl_set_bits_mask_restricted_reg( - priv, APMG_PS_CTRL_REG, + iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VAUX, ~APMG_PS_CTRL_MSK_PWR_SRC); } else - iwl_set_bits_mask_restricted_reg( - priv, APMG_PS_CTRL_REG, + iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, ~APMG_PS_CTRL_MSK_PWR_SRC); iwl_release_restricted_access(priv); spin_unlock_irqrestore(&priv->lock, flags); - return rc; + return ret; } static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) @@ -384,7 +382,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv) goto error_reset; } - iwl_write_restricted_reg(priv, SCD_TXFACT, 0); + iwl_write_prph(priv, SCD_TXFACT, 0); iwl_release_restricted_access(priv); spin_unlock_irqrestore(&priv->lock, flags); @@ -449,16 +447,16 @@ int iwl_hw_nic_init(struct iwl_priv *priv) return rc; } - iwl_read_restricted_reg(priv, APMG_CLK_CTRL_REG); + iwl_read_prph(priv, APMG_CLK_CTRL_REG); - iwl_write_restricted_reg(priv, APMG_CLK_CTRL_REG, + iwl_write_prph(priv, APMG_CLK_CTRL_REG, APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); - iwl_read_restricted_reg(priv, APMG_CLK_CTRL_REG); + iwl_read_prph(priv, APMG_CLK_CTRL_REG); udelay(20); - iwl_set_bits_restricted_reg(priv, APMG_PCIDEV_STT_REG, + iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); iwl_release_restricted_access(priv); @@ -514,11 +512,11 @@ int iwl_hw_nic_init(struct iwl_priv *priv) return rc; } - iwl_read_restricted_reg(priv, APMG_PS_CTRL_REG); - iwl_set_bits_restricted_reg(priv, APMG_PS_CTRL_REG, + iwl_read_prph(priv, APMG_PS_CTRL_REG); + iwl_set_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); udelay(5); - iwl_clear_bits_restricted_reg(priv, APMG_PS_CTRL_REG, + iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); iwl_release_restricted_access(priv); @@ -645,13 +643,13 @@ int iwl_hw_nic_reset(struct iwl_priv *priv) rc = iwl_grab_restricted_access(priv); if (!rc) { - iwl_write_restricted_reg(priv, APMG_CLK_EN_REG, + iwl_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); udelay(10); - iwl_set_bits_restricted_reg(priv, APMG_PCIDEV_STT_REG, + iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); iwl_release_restricted_access(priv); @@ -1585,7 +1583,7 @@ static void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index) { iwl_write_restricted(priv, HBUS_TARG_WRPTR, (index & 0xff) | (txq_id << 8)); - iwl_write_restricted_reg(priv, SCD_QUEUE_RDPTR(txq_id), index); + iwl_write_prph(priv, SCD_QUEUE_RDPTR(txq_id), index); } /* @@ -1598,7 +1596,7 @@ static void iwl4965_tx_queue_set_status(struct iwl_priv *priv, int txq_id = txq->q.id; int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0; - iwl_write_restricted_reg(priv, SCD_QUEUE_STATUS_BITS(txq_id), + iwl_write_prph(priv, SCD_QUEUE_STATUS_BITS(txq_id), (active << SCD_QUEUE_STTS_REG_POS_ACTIVE) | (tx_fifo_id << SCD_QUEUE_STTS_REG_POS_TXF) | (scd_retry << SCD_QUEUE_STTS_REG_POS_WSL) | @@ -1656,7 +1654,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv) return rc; } - priv->scd_base_addr = iwl_read_restricted_reg(priv, SCD_SRAM_BASE_ADDR); + priv->scd_base_addr = iwl_read_prph(priv, SCD_SRAM_BASE_ADDR); a = priv->scd_base_addr + SCD_CONTEXT_DATA_OFFSET; for (; a < priv->scd_base_addr + SCD_TX_STTS_BITMAP_OFFSET; a += 4) iwl_write_restricted_mem(priv, a, 0); @@ -1665,14 +1663,14 @@ int iwl4965_alive_notify(struct iwl_priv *priv) for (; a < sizeof(u16) * priv->hw_setting.max_txq_num; a += 4) iwl_write_restricted_mem(priv, a, 0); - iwl_write_restricted_reg(priv, SCD_DRAM_BASE_ADDR, + iwl_write_prph(priv, SCD_DRAM_BASE_ADDR, (priv->hw_setting.shared_phys + offsetof(struct iwl_shared, queues_byte_cnt_tbls)) >> 10); - iwl_write_restricted_reg(priv, SCD_QUEUECHAIN_SEL, 0); + iwl_write_prph(priv, SCD_QUEUECHAIN_SEL, 0); /* initiate the queues */ for (i = 0; i < priv->hw_setting.max_txq_num; i++) { - iwl_write_restricted_reg(priv, SCD_QUEUE_RDPTR(i), 0); + iwl_write_prph(priv, SCD_QUEUE_RDPTR(i), 0); iwl_write_restricted(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); iwl_write_restricted_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(i), @@ -1687,10 +1685,10 @@ int iwl4965_alive_notify(struct iwl_priv *priv) SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); } - iwl_write_restricted_reg(priv, SCD_INTERRUPT_MASK, + iwl_write_prph(priv, SCD_INTERRUPT_MASK, (1 << priv->hw_setting.max_txq_num) - 1); - iwl_write_restricted_reg(priv, SCD_TXFACT, + iwl_write_prph(priv, SCD_TXFACT, SCD_TXFACT_REG_TXFIFO_MASK(0, 7)); iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); @@ -4140,7 +4138,7 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, static void iwl4965_tx_queue_stop_scheduler(struct iwl_priv *priv, u16 txq_id) { - iwl_write_restricted_reg(priv, + iwl_write_prph(priv, SCD_QUEUE_STATUS_BITS(txq_id), (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)| (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); @@ -4201,7 +4199,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); - iwl_set_bits_restricted_reg(priv, SCD_QUEUECHAIN_SEL, (1<txq[txq_id].q.read_ptr = (ssn_idx & 0xff); priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); @@ -4219,7 +4217,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, (SCD_FRAME_LIMIT << SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); - iwl_set_bits_restricted_reg(priv, SCD_INTERRUPT_MASK, (1 << txq_id)); + iwl_set_bits_prph(priv, SCD_INTERRUPT_MASK, (1 << txq_id)); iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); @@ -4253,14 +4251,14 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, iwl4965_tx_queue_stop_scheduler(priv, txq_id); - iwl_clear_bits_restricted_reg(priv, SCD_QUEUECHAIN_SEL, (1 << txq_id)); + iwl_clear_bits_prph(priv, SCD_QUEUECHAIN_SEL, (1 << txq_id)); priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); /* supposes that ssn_idx is valid (!= 0xFFF) */ iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); - iwl_clear_bits_restricted_reg(priv, SCD_INTERRUPT_MASK, (1 << txq_id)); + iwl_clear_bits_prph(priv, SCD_INTERRUPT_MASK, (1 << txq_id)); iwl4965_txq_ctx_deactivate(priv, txq_id); iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index 8a8b96fcf48..b78afed9c79 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h @@ -330,27 +330,26 @@ static inline int __iwl_poll_restricted_bit(const char *f, u32 l, #define iwl_poll_restricted_bit _iwl_poll_restricted_bit #endif -static inline u32 _iwl_read_restricted_reg(struct iwl_priv *priv, u32 reg) +static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) { _iwl_write_restricted(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); return _iwl_read_restricted(priv, HBUS_TARG_PRPH_RDAT); } #ifdef CONFIG_IWLWIFI_DEBUG -static inline u32 __iwl_read_restricted_reg(u32 line, - struct iwl_priv *priv, u32 reg) +static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Unrestricted access from line %d\n", line); - return _iwl_read_restricted_reg(priv, reg); + return _iwl_read_prph(priv, reg); } -#define iwl_read_restricted_reg(priv, reg) \ - __iwl_read_restricted_reg(__LINE__, priv, reg) +#define iwl_read_prph(priv, reg) \ + __iwl_read_prph(__LINE__, priv, reg) #else -#define iwl_read_restricted_reg _iwl_read_restricted_reg +#define iwl_read_prph _iwl_read_prph #endif -static inline void _iwl_write_restricted_reg(struct iwl_priv *priv, +static inline void _iwl_write_prph(struct iwl_priv *priv, u32 addr, u32 val) { _iwl_write_restricted(priv, HBUS_TARG_PRPH_WADDR, @@ -358,61 +357,58 @@ static inline void _iwl_write_restricted_reg(struct iwl_priv *priv, _iwl_write_restricted(priv, HBUS_TARG_PRPH_WDAT, val); } #ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_write_restricted_reg(u32 line, - struct iwl_priv *priv, +static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, u32 addr, u32 val) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Unrestricted access from line %d\n", line); - _iwl_write_restricted_reg(priv, addr, val); + _iwl_write_prph(priv, addr, val); } -#define iwl_write_restricted_reg(priv, addr, val) \ - __iwl_write_restricted_reg(__LINE__, priv, addr, val); +#define iwl_write_prph(priv, addr, val) \ + __iwl_write_prph(__LINE__, priv, addr, val); #else -#define iwl_write_restricted_reg _iwl_write_restricted_reg +#define iwl_write_prph _iwl_write_prph #endif -#define _iwl_set_bits_restricted_reg(priv, reg, mask) \ - _iwl_write_restricted_reg(priv, reg, \ - (_iwl_read_restricted_reg(priv, reg) | mask)) +#define _iwl_set_bits_prph(priv, reg, mask) \ + _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) #ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_set_bits_restricted_reg(u32 line, struct iwl_priv - *priv, u32 reg, u32 mask) +static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, + u32 reg, u32 mask) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Unrestricted access from line %d\n", line); - _iwl_set_bits_restricted_reg(priv, reg, mask); + _iwl_set_bits_prph(priv, reg, mask); } -#define iwl_set_bits_restricted_reg(priv, reg, mask) \ - __iwl_set_bits_restricted_reg(__LINE__, priv, reg, mask) +#define iwl_set_bits_prph(priv, reg, mask) \ + __iwl_set_bits_prph(__LINE__, priv, reg, mask) #else -#define iwl_set_bits_restricted_reg _iwl_set_bits_restricted_reg +#define iwl_set_bits_prph _iwl_set_bits_prph #endif -#define _iwl_set_bits_mask_restricted_reg(priv, reg, bits, mask) \ - _iwl_write_restricted_reg( \ - priv, reg, ((_iwl_read_restricted_reg(priv, reg) & mask) | bits)) +#define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ + _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) + #ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_set_bits_mask_restricted_reg(u32 line, +static inline void __iwl_set_bits_mask_prph(u32 line, struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Unrestricted access from line %d\n", line); - _iwl_set_bits_mask_restricted_reg(priv, reg, bits, mask); + _iwl_set_bits_mask_prph(priv, reg, bits, mask); } - -#define iwl_set_bits_mask_restricted_reg(priv, reg, bits, mask) \ - __iwl_set_bits_mask_restricted_reg(__LINE__, priv, reg, bits, mask) +#define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ + __iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) #else -#define iwl_set_bits_mask_restricted_reg _iwl_set_bits_mask_restricted_reg +#define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph #endif -static inline void iwl_clear_bits_restricted_reg(struct iwl_priv +static inline void iwl_clear_bits_prph(struct iwl_priv *priv, u32 reg, u32 mask) { - u32 val = _iwl_read_restricted_reg(priv, reg); - _iwl_write_restricted_reg(priv, reg, (val & ~mask)); + u32 val = _iwl_read_prph(priv, reg); + _iwl_write_prph(priv, reg, (val & ~mask)); } static inline u32 iwl_read_restricted_mem(struct iwl_priv *priv, u32 addr) @@ -435,36 +431,4 @@ static inline void iwl_write_restricted_mems(struct iwl_priv *priv, u32 addr, for (; 0 < len; len -= sizeof(u32), values++) iwl_write_restricted(priv, HBUS_TARG_MEM_WDAT, *values); } - -static inline void iwl_write_restricted_regs(struct iwl_priv *priv, u32 reg, - u32 len, u8 *values) -{ - u32 reg_offset = reg; - u32 aligment = reg & 0x3; - - /* write any non-dword-aligned stuff at the beginning */ - if (len < sizeof(u32)) { - if ((aligment + len) <= sizeof(u32)) { - u8 size; - u32 value = 0; - size = len - 1; - memcpy(&value, values, len); - reg_offset = (reg_offset & 0x0000FFFF); - - _iwl_write_restricted(priv, - HBUS_TARG_PRPH_WADDR, - (reg_offset | (size << 24))); - _iwl_write_restricted(priv, HBUS_TARG_PRPH_WDAT, - value); - } - - return; - } - - /* now write all the dword-aligned stuff */ - for (; reg_offset < (reg + len); - reg_offset += sizeof(u32), values += sizeof(u32)) - _iwl_write_restricted_reg(priv, reg_offset, *((u32 *) values)); -} - #endif diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index c6606e1af51..676023a0a76 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -5623,11 +5623,11 @@ static int iwl_verify_bsm(struct iwl_priv *priv) IWL_DEBUG_INFO("Begin verify bsm\n"); /* verify BSM SRAM contents */ - val = iwl_read_restricted_reg(priv, BSM_WR_DWCOUNT_REG); + val = iwl_read_prph(priv, BSM_WR_DWCOUNT_REG); for (reg = BSM_SRAM_LOWER_BOUND; reg < BSM_SRAM_LOWER_BOUND + len; reg += sizeof(u32), image ++) { - val = iwl_read_restricted_reg(priv, reg); + val = iwl_read_prph(priv, reg); if (val != le32_to_cpu(*image)) { IWL_ERROR("BSM uCode verification failed at " "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", @@ -5708,16 +5708,16 @@ static int iwl_load_bsm(struct iwl_priv *priv) if (rc) return rc; - iwl_write_restricted_reg(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_write_restricted_reg(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_write_restricted_reg(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); - iwl_write_restricted_reg(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); + iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); + iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); /* Fill BSM memory with bootstrap instructions */ for (reg_offset = BSM_SRAM_LOWER_BOUND; reg_offset < BSM_SRAM_LOWER_BOUND + len; reg_offset += sizeof(u32), image++) - _iwl_write_restricted_reg(priv, reg_offset, + _iwl_write_prph(priv, reg_offset, le32_to_cpu(*image)); rc = iwl_verify_bsm(priv); @@ -5727,19 +5727,19 @@ static int iwl_load_bsm(struct iwl_priv *priv) } /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ - iwl_write_restricted_reg(priv, BSM_WR_MEM_SRC_REG, 0x0); - iwl_write_restricted_reg(priv, BSM_WR_MEM_DST_REG, + iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); + iwl_write_prph(priv, BSM_WR_MEM_DST_REG, RTC_INST_LOWER_BOUND); - iwl_write_restricted_reg(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); + iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); /* Load bootstrap code into instruction SRAM now, * to prepare to load "initialize" uCode */ - iwl_write_restricted_reg(priv, BSM_WR_CTRL_REG, + iwl_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); /* Wait for load of bootstrap uCode to finish */ for (i = 0; i < 100; i++) { - done = iwl_read_restricted_reg(priv, BSM_WR_CTRL_REG); + done = iwl_read_prph(priv, BSM_WR_CTRL_REG); if (!(done & BSM_WR_CTRL_REG_BIT_START)) break; udelay(10); @@ -5753,7 +5753,7 @@ static int iwl_load_bsm(struct iwl_priv *priv) /* Enable future boot loads whenever power management unit triggers it * (e.g. when powering back up after power-save shutdown) */ - iwl_write_restricted_reg(priv, BSM_WR_CTRL_REG, + iwl_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); iwl_release_restricted_access(priv); @@ -6004,14 +6004,14 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) } /* Tell bootstrap uCode where to find image to load */ - iwl_write_restricted_reg(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_write_restricted_reg(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_write_restricted_reg(priv, BSM_DRAM_DATA_BYTECOUNT_REG, + iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, priv->ucode_data.len); /* Inst bytecount must be last to set up, bit 31 signals uCode * that all new ptr/size info is in place */ - iwl_write_restricted_reg(priv, BSM_DRAM_INST_BYTECOUNT_REG, + iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, priv->ucode_code.len | BSM_DRAM_INST_LOAD); iwl_release_restricted_access(priv); @@ -6109,7 +6109,7 @@ static void iwl_alive_start(struct iwl_priv *priv) return; } - rfkill = iwl_read_restricted_reg(priv, APMG_RFKILL_REG); + rfkill = iwl_read_prph(priv, APMG_RFKILL_REG); IWL_DEBUG_INFO("RFKILL status: 0x%x\n", rfkill); iwl_release_restricted_access(priv); @@ -6274,7 +6274,7 @@ static void __iwl_down(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); if (!iwl_grab_restricted_access(priv)) { - iwl_write_restricted_reg(priv, APMG_CLK_DIS_REG, + iwl_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); iwl_release_restricted_access(priv); } @@ -8674,7 +8674,7 @@ static void iwl_resume(struct iwl_priv *priv) iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); if (!iwl_grab_restricted_access(priv)) { - iwl_write_restricted_reg(priv, APMG_CLK_DIS_REG, + iwl_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); iwl_release_restricted_access(priv); } diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 60174202ca1..e74f71fdaf9 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -6002,11 +6002,11 @@ static int iwl_verify_bsm(struct iwl_priv *priv) IWL_DEBUG_INFO("Begin verify bsm\n"); /* verify BSM SRAM contents */ - val = iwl_read_restricted_reg(priv, BSM_WR_DWCOUNT_REG); + val = iwl_read_prph(priv, BSM_WR_DWCOUNT_REG); for (reg = BSM_SRAM_LOWER_BOUND; reg < BSM_SRAM_LOWER_BOUND + len; reg += sizeof(u32), image ++) { - val = iwl_read_restricted_reg(priv, reg); + val = iwl_read_prph(priv, reg); if (val != le32_to_cpu(*image)) { IWL_ERROR("BSM uCode verification failed at " "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", @@ -6087,16 +6087,16 @@ static int iwl_load_bsm(struct iwl_priv *priv) if (rc) return rc; - iwl_write_restricted_reg(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_write_restricted_reg(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_write_restricted_reg(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); - iwl_write_restricted_reg(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); + iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); + iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); /* Fill BSM memory with bootstrap instructions */ for (reg_offset = BSM_SRAM_LOWER_BOUND; reg_offset < BSM_SRAM_LOWER_BOUND + len; reg_offset += sizeof(u32), image++) - _iwl_write_restricted_reg(priv, reg_offset, + _iwl_write_prph(priv, reg_offset, le32_to_cpu(*image)); rc = iwl_verify_bsm(priv); @@ -6106,19 +6106,19 @@ static int iwl_load_bsm(struct iwl_priv *priv) } /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ - iwl_write_restricted_reg(priv, BSM_WR_MEM_SRC_REG, 0x0); - iwl_write_restricted_reg(priv, BSM_WR_MEM_DST_REG, + iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); + iwl_write_prph(priv, BSM_WR_MEM_DST_REG, RTC_INST_LOWER_BOUND); - iwl_write_restricted_reg(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); + iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); /* Load bootstrap code into instruction SRAM now, * to prepare to load "initialize" uCode */ - iwl_write_restricted_reg(priv, BSM_WR_CTRL_REG, + iwl_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); /* Wait for load of bootstrap uCode to finish */ for (i = 0; i < 100; i++) { - done = iwl_read_restricted_reg(priv, BSM_WR_CTRL_REG); + done = iwl_read_prph(priv, BSM_WR_CTRL_REG); if (!(done & BSM_WR_CTRL_REG_BIT_START)) break; udelay(10); @@ -6132,7 +6132,7 @@ static int iwl_load_bsm(struct iwl_priv *priv) /* Enable future boot loads whenever power management unit triggers it * (e.g. when powering back up after power-save shutdown) */ - iwl_write_restricted_reg(priv, BSM_WR_CTRL_REG, + iwl_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); iwl_release_restricted_access(priv); @@ -6387,14 +6387,14 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) } /* Tell bootstrap uCode where to find image to load */ - iwl_write_restricted_reg(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_write_restricted_reg(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_write_restricted_reg(priv, BSM_DRAM_DATA_BYTECOUNT_REG, + iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, priv->ucode_data.len); /* Inst bytecount must be last to set up, bit 31 signals uCode * that all new ptr/size info is in place */ - iwl_write_restricted_reg(priv, BSM_DRAM_INST_BYTECOUNT_REG, + iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, priv->ucode_code.len | BSM_DRAM_INST_LOAD); iwl_release_restricted_access(priv); @@ -6639,7 +6639,7 @@ static void __iwl_down(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); if (!iwl_grab_restricted_access(priv)) { - iwl_write_restricted_reg(priv, APMG_CLK_DIS_REG, + iwl_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); iwl_release_restricted_access(priv); } @@ -9300,7 +9300,7 @@ static void iwl_resume(struct iwl_priv *priv) iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); if (!iwl_grab_restricted_access(priv)) { - iwl_write_restricted_reg(priv, APMG_CLK_DIS_REG, + iwl_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); iwl_release_restricted_access(priv); } -- cgit v1.2.3-70-g09d2 From af7cca2a441f6e2ebeb2a920ef5af1bec8df96e8 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 25 Oct 2007 17:15:36 +0800 Subject: iwlwifi: rename restricted_mem to targ_mem This patch renames restricted_mem suffix with more proper name targ_mem for function accessing memory on the nic in target mode Signed-off-by: Tomas Winkler Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 19 ++++++++-------- drivers/net/wireless/iwlwifi/iwl-4965.c | 18 +++++++-------- drivers/net/wireless/iwlwifi/iwl-io.h | 9 ++++---- drivers/net/wireless/iwlwifi/iwl3945-base.c | 30 ++++++++++++------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 34 ++++++++++++++--------------- 5 files changed, 54 insertions(+), 56 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 59e2fa27092..077fa1023fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -96,7 +96,7 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { * ... and set IWL_EVT_DISABLE to 1. */ void iwl_disable_events(struct iwl_priv *priv) { - int rc; + int ret; int i; u32 base; /* SRAM address of event log header */ u32 disable_ptr; /* SRAM address of event-disable bitmap array */ @@ -157,25 +157,24 @@ void iwl_disable_events(struct iwl_priv *priv) return; } - rc = iwl_grab_restricted_access(priv); - if (rc) { + ret = iwl_grab_restricted_access(priv); + if (ret) { IWL_WARNING("Can not read from adapter at this time.\n"); return; } - disable_ptr = iwl_read_restricted_mem(priv, base + (4 * sizeof(u32))); - array_size = iwl_read_restricted_mem(priv, base + (5 * sizeof(u32))); + disable_ptr = iwl_read_targ_mem(priv, base + (4 * sizeof(u32))); + array_size = iwl_read_targ_mem(priv, base + (5 * sizeof(u32))); iwl_release_restricted_access(priv); if (IWL_EVT_DISABLE && (array_size == IWL_EVT_DISABLE_SIZE)) { IWL_DEBUG_INFO("Disabling selected uCode log events at 0x%x\n", disable_ptr); - rc = iwl_grab_restricted_access(priv); + ret = iwl_grab_restricted_access(priv); for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++) - iwl_write_restricted_mem(priv, - disable_ptr + - (i * sizeof(u32)), - evt_disable[i]); + iwl_write_targ_mem(priv, + disable_ptr + (i * sizeof(u32)), + evt_disable[i]); iwl_release_restricted_access(priv); } else { diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 1e56dfa0cfb..5914657f1ca 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -1657,11 +1657,11 @@ int iwl4965_alive_notify(struct iwl_priv *priv) priv->scd_base_addr = iwl_read_prph(priv, SCD_SRAM_BASE_ADDR); a = priv->scd_base_addr + SCD_CONTEXT_DATA_OFFSET; for (; a < priv->scd_base_addr + SCD_TX_STTS_BITMAP_OFFSET; a += 4) - iwl_write_restricted_mem(priv, a, 0); + iwl_write_targ_mem(priv, a, 0); for (; a < priv->scd_base_addr + SCD_TRANSLATE_TBL_OFFSET; a += 4) - iwl_write_restricted_mem(priv, a, 0); + iwl_write_targ_mem(priv, a, 0); for (; a < sizeof(u16) * priv->hw_setting.max_txq_num; a += 4) - iwl_write_restricted_mem(priv, a, 0); + iwl_write_targ_mem(priv, a, 0); iwl_write_prph(priv, SCD_DRAM_BASE_ADDR, (priv->hw_setting.shared_phys + @@ -1672,12 +1672,12 @@ int iwl4965_alive_notify(struct iwl_priv *priv) for (i = 0; i < priv->hw_setting.max_txq_num; i++) { iwl_write_prph(priv, SCD_QUEUE_RDPTR(i), 0); iwl_write_restricted(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); - iwl_write_restricted_mem(priv, priv->scd_base_addr + + iwl_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(i), (SCD_WIN_SIZE << SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); - iwl_write_restricted_mem(priv, priv->scd_base_addr + + iwl_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(i) + sizeof(u32), (SCD_FRAME_LIMIT << @@ -4156,14 +4156,14 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, tbl_dw_addr = priv->scd_base_addr + SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); - tbl_dw = iwl_read_restricted_mem(priv, tbl_dw_addr); + tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr); if (txq_id & 0x1) tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); else tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); - iwl_write_restricted_mem(priv, tbl_dw_addr, tbl_dw); + iwl_write_targ_mem(priv, tbl_dw_addr, tbl_dw); return 0; } @@ -4207,12 +4207,12 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, /* supposes that ssn_idx is valid (!= 0xFFF) */ iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); - iwl_write_restricted_mem(priv, + iwl_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(txq_id), (SCD_WIN_SIZE << SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); - iwl_write_restricted_mem(priv, priv->scd_base_addr + + iwl_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), (SCD_FRAME_LIMIT << SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index b78afed9c79..5cdcfc43fa1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h @@ -411,21 +411,20 @@ static inline void iwl_clear_bits_prph(struct iwl_priv _iwl_write_prph(priv, reg, (val & ~mask)); } -static inline u32 iwl_read_restricted_mem(struct iwl_priv *priv, u32 addr) +static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) { iwl_write_restricted(priv, HBUS_TARG_MEM_RADDR, addr); return iwl_read_restricted(priv, HBUS_TARG_MEM_RDAT); } -static inline void iwl_write_restricted_mem(struct iwl_priv *priv, u32 addr, - u32 val) +static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) { iwl_write_restricted(priv, HBUS_TARG_MEM_WADDR, addr); iwl_write_restricted(priv, HBUS_TARG_MEM_WDAT, val); } -static inline void iwl_write_restricted_mems(struct iwl_priv *priv, u32 addr, - u32 len, u32 *values) +static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, + u32 len, u32 *values) { iwl_write_restricted(priv, HBUS_TARG_MEM_WADDR, addr); for (; 0 < len; len -= sizeof(u32), values++) diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 676023a0a76..96cb68ebc61 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -4457,7 +4457,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) return; } - count = iwl_read_restricted_mem(priv, base); + count = iwl_read_targ_mem(priv, base); if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { IWL_ERROR("Start IWL Error Log Dump:\n"); @@ -4470,19 +4470,19 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) for (i = ERROR_START_OFFSET; i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; i += ERROR_ELEM_SIZE) { - desc = iwl_read_restricted_mem(priv, base + i); + desc = iwl_read_targ_mem(priv, base + i); time = - iwl_read_restricted_mem(priv, base + i + 1 * sizeof(u32)); + iwl_read_targ_mem(priv, base + i + 1 * sizeof(u32)); blink1 = - iwl_read_restricted_mem(priv, base + i + 2 * sizeof(u32)); + iwl_read_targ_mem(priv, base + i + 2 * sizeof(u32)); blink2 = - iwl_read_restricted_mem(priv, base + i + 3 * sizeof(u32)); + iwl_read_targ_mem(priv, base + i + 3 * sizeof(u32)); ilink1 = - iwl_read_restricted_mem(priv, base + i + 4 * sizeof(u32)); + iwl_read_targ_mem(priv, base + i + 4 * sizeof(u32)); ilink2 = - iwl_read_restricted_mem(priv, base + i + 5 * sizeof(u32)); + iwl_read_targ_mem(priv, base + i + 5 * sizeof(u32)); data1 = - iwl_read_restricted_mem(priv, base + i + 6 * sizeof(u32)); + iwl_read_targ_mem(priv, base + i + 6 * sizeof(u32)); IWL_ERROR ("%-13s (#%d) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", @@ -4525,14 +4525,14 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, /* "time" is actually "data" for mode 0 (no timestamp). * place event id # at far right for easier visual parsing. */ for (i = 0; i < num_events; i++) { - ev = iwl_read_restricted_mem(priv, ptr); + ev = iwl_read_targ_mem(priv, ptr); ptr += sizeof(u32); - time = iwl_read_restricted_mem(priv, ptr); + time = iwl_read_targ_mem(priv, ptr); ptr += sizeof(u32); if (mode == 0) IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */ else { - data = iwl_read_restricted_mem(priv, ptr); + data = iwl_read_targ_mem(priv, ptr); ptr += sizeof(u32); IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev); } @@ -4562,10 +4562,10 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) } /* event log header */ - capacity = iwl_read_restricted_mem(priv, base); - mode = iwl_read_restricted_mem(priv, base + (1 * sizeof(u32))); - num_wraps = iwl_read_restricted_mem(priv, base + (2 * sizeof(u32))); - next_entry = iwl_read_restricted_mem(priv, base + (3 * sizeof(u32))); + capacity = iwl_read_targ_mem(priv, base); + mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32))); + num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32))); + next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32))); size = num_wraps ? capacity : next_entry; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index e74f71fdaf9..5d19ce9bb1a 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -4785,7 +4785,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) return; } - count = iwl_read_restricted_mem(priv, base); + count = iwl_read_targ_mem(priv, base); if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { IWL_ERROR("Start IWL Error Log Dump:\n"); @@ -4793,15 +4793,15 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) priv->status, priv->config, count); } - desc = iwl_read_restricted_mem(priv, base + 1 * sizeof(u32)); - blink1 = iwl_read_restricted_mem(priv, base + 3 * sizeof(u32)); - blink2 = iwl_read_restricted_mem(priv, base + 4 * sizeof(u32)); - ilink1 = iwl_read_restricted_mem(priv, base + 5 * sizeof(u32)); - ilink2 = iwl_read_restricted_mem(priv, base + 6 * sizeof(u32)); - data1 = iwl_read_restricted_mem(priv, base + 7 * sizeof(u32)); - data2 = iwl_read_restricted_mem(priv, base + 8 * sizeof(u32)); - line = iwl_read_restricted_mem(priv, base + 9 * sizeof(u32)); - time = iwl_read_restricted_mem(priv, base + 11 * sizeof(u32)); + desc = iwl_read_targ_mem(priv, base + 1 * sizeof(u32)); + blink1 = iwl_read_targ_mem(priv, base + 3 * sizeof(u32)); + blink2 = iwl_read_targ_mem(priv, base + 4 * sizeof(u32)); + ilink1 = iwl_read_targ_mem(priv, base + 5 * sizeof(u32)); + ilink2 = iwl_read_targ_mem(priv, base + 6 * sizeof(u32)); + data1 = iwl_read_targ_mem(priv, base + 7 * sizeof(u32)); + data2 = iwl_read_targ_mem(priv, base + 8 * sizeof(u32)); + line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32)); + time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32)); IWL_ERROR("Desc Time " "data1 data2 line\n"); @@ -4845,14 +4845,14 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, /* "time" is actually "data" for mode 0 (no timestamp). * place event id # at far right for easier visual parsing. */ for (i = 0; i < num_events; i++) { - ev = iwl_read_restricted_mem(priv, ptr); + ev = iwl_read_targ_mem(priv, ptr); ptr += sizeof(u32); - time = iwl_read_restricted_mem(priv, ptr); + time = iwl_read_targ_mem(priv, ptr); ptr += sizeof(u32); if (mode == 0) IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */ else { - data = iwl_read_restricted_mem(priv, ptr); + data = iwl_read_targ_mem(priv, ptr); ptr += sizeof(u32); IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev); } @@ -4882,10 +4882,10 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) } /* event log header */ - capacity = iwl_read_restricted_mem(priv, base); - mode = iwl_read_restricted_mem(priv, base + (1 * sizeof(u32))); - num_wraps = iwl_read_restricted_mem(priv, base + (2 * sizeof(u32))); - next_entry = iwl_read_restricted_mem(priv, base + (3 * sizeof(u32))); + capacity = iwl_read_targ_mem(priv, base); + mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32))); + num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32))); + next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32))); size = num_wraps ? capacity : next_entry; -- cgit v1.2.3-70-g09d2 From ac17a947a4f47b642097d6814d6dcc60c297eb17 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 25 Oct 2007 17:15:37 +0800 Subject: iwlwifi: replacing wording restricted to nic access in iwl-io This patch replaces wording 'restricted' with more appropriate 'nic access' NIC access is grabbed to prevent NIC entering power save mode General cleanup of iwl-io.h Signed-off-by: Tomas Winkler Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 78 +++++++-------- drivers/net/wireless/iwlwifi/iwl-4965.c | 80 +++++++-------- drivers/net/wireless/iwlwifi/iwl-io.h | 146 ++++++++++++++-------------- drivers/net/wireless/iwlwifi/iwl3945-base.c | 74 +++++++------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 82 ++++++++-------- 5 files changed, 229 insertions(+), 231 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 077fa1023fe..154f2a258db 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -157,7 +157,7 @@ void iwl_disable_events(struct iwl_priv *priv) return; } - ret = iwl_grab_restricted_access(priv); + ret = iwl_grab_nic_access(priv); if (ret) { IWL_WARNING("Can not read from adapter at this time.\n"); return; @@ -165,18 +165,18 @@ void iwl_disable_events(struct iwl_priv *priv) disable_ptr = iwl_read_targ_mem(priv, base + (4 * sizeof(u32))); array_size = iwl_read_targ_mem(priv, base + (5 * sizeof(u32))); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); if (IWL_EVT_DISABLE && (array_size == IWL_EVT_DISABLE_SIZE)) { IWL_DEBUG_INFO("Disabling selected uCode log events at 0x%x\n", disable_ptr); - ret = iwl_grab_restricted_access(priv); + ret = iwl_grab_nic_access(priv); for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++) iwl_write_targ_mem(priv, disable_ptr + (i * sizeof(u32)), evt_disable[i]); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } else { IWL_DEBUG_INFO("Selected uCode log events may be disabled\n"); IWL_DEBUG_INFO(" by writing \"1\"s into disable bitmap\n"); @@ -720,7 +720,7 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -735,19 +735,19 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VAUX, ~APMG_PS_CTRL_MSK_PWR_SRC); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); iwl_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VAUX_PWR_SRC, CSR_GPIO_IN_BIT_AUX_POWER, 5000); } else - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } else { iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, ~APMG_PS_CTRL_MSK_PWR_SRC); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); iwl_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */ } @@ -762,18 +762,18 @@ static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_restricted(priv, FH_RCSR_RBD_BASE(0), rxq->dma_addr); - iwl_write_restricted(priv, FH_RCSR_RPTR_ADDR(0), + iwl_write_direct32(priv, FH_RCSR_RBD_BASE(0), rxq->dma_addr); + iwl_write_direct32(priv, FH_RCSR_RPTR_ADDR(0), priv->hw_setting.shared_phys + offsetof(struct iwl_shared, rx_read_ptr[0])); - iwl_write_restricted(priv, FH_RCSR_WPTR(0), 0); - iwl_write_restricted(priv, FH_RCSR_CONFIG(0), + iwl_write_direct32(priv, FH_RCSR_WPTR(0), 0); + iwl_write_direct32(priv, FH_RCSR_CONFIG(0), ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE | ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE | ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN | @@ -784,9 +784,9 @@ static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH); /* fake read to flush all prev I/O */ - iwl_read_restricted(priv, FH_RSSR_CTRL); + iwl_read_direct32(priv, FH_RSSR_CTRL); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -798,7 +798,7 @@ static int iwl3945_tx_reset(struct iwl_priv *priv) unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -818,10 +818,10 @@ static int iwl3945_tx_reset(struct iwl_priv *priv) iwl_write_prph(priv, SCD_TXF4MF_REG, 0x000004); iwl_write_prph(priv, SCD_TXF5MF_REG, 0x000005); - iwl_write_restricted(priv, FH_TSSR_CBB_BASE, + iwl_write_direct32(priv, FH_TSSR_CBB_BASE, priv->hw_setting.shared_phys); - iwl_write_restricted(priv, FH_TSSR_MSG_CONFIG, + iwl_write_direct32(priv, FH_TSSR_MSG_CONFIG, ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON | ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B | @@ -830,7 +830,7 @@ static int iwl3945_tx_reset(struct iwl_priv *priv) ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH | ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -896,7 +896,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv) return rc; } - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -907,7 +907,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv) udelay(20); iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); /* Determine HW type */ @@ -998,13 +998,13 @@ int iwl_hw_nic_init(struct iwl_priv *priv) iwl_rx_queue_update_write_ptr(priv, rxq); */ - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_restricted(priv, FH_RCSR_WPTR(0), rxq->write & ~7); - iwl_release_restricted_access(priv); + iwl_write_direct32(priv, FH_RCSR_WPTR(0), rxq->write & ~7); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); @@ -1037,7 +1037,7 @@ void iwl_hw_txq_ctx_stop(struct iwl_priv *priv) unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - if (iwl_grab_restricted_access(priv)) { + if (iwl_grab_nic_access(priv)) { spin_unlock_irqrestore(&priv->lock, flags); iwl_hw_txq_ctx_free(priv); return; @@ -1048,13 +1048,13 @@ void iwl_hw_txq_ctx_stop(struct iwl_priv *priv) /* reset TFD queues */ for (queue = TFD_QUEUE_MIN; queue < TFD_QUEUE_MAX; queue++) { - iwl_write_restricted(priv, FH_TCSR_CONFIG(queue), 0x0); - iwl_poll_restricted_bit(priv, FH_TSSR_TX_STATUS, + iwl_write_direct32(priv, FH_TCSR_CONFIG(queue), 0x0); + iwl_poll_direct_bit(priv, FH_TSSR_TX_STATUS, ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(queue), 1000); } - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); iwl_hw_txq_ctx_free(priv); @@ -1108,7 +1108,7 @@ int iwl_hw_nic_reset(struct iwl_priv *priv) CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (!rc) { iwl_write_prph(priv, APMG_CLK_CTRL_REG, APMG_CLK_VAL_BSM_CLK_RQT); @@ -1133,7 +1133,7 @@ int iwl_hw_nic_reset(struct iwl_priv *priv) udelay(5); iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } /* Clear the 'host command active' bit... */ @@ -2096,18 +2096,18 @@ int iwl_hw_rxq_stop(struct iwl_priv *priv) unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_restricted(priv, FH_RCSR_CONFIG(0), 0); - rc = iwl_poll_restricted_bit(priv, FH_RSSR_STATUS, (1 << 24), 1000); + iwl_write_direct32(priv, FH_RCSR_CONFIG(0), 0); + rc = iwl_poll_direct_bit(priv, FH_RSSR_STATUS, (1 << 24), 1000); if (rc < 0) IWL_ERROR("Can't stop Rx DMA.\n"); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -2124,21 +2124,21 @@ int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_restricted(priv, FH_CBCC_CTRL(txq_id), 0); - iwl_write_restricted(priv, FH_CBCC_BASE(txq_id), 0); + iwl_write_direct32(priv, FH_CBCC_CTRL(txq_id), 0); + iwl_write_direct32(priv, FH_CBCC_BASE(txq_id), 0); - iwl_write_restricted(priv, FH_TCSR_CONFIG(txq_id), + iwl_write_direct32(priv, FH_TCSR_CONFIG(txq_id), ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT | ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF | ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD | ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL | ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); /* fake read to flush all prev. writes */ iwl_read32(priv, FH_TSSR_CBB_BASE); diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 5914657f1ca..8e9810b72ac 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -139,20 +139,20 @@ int iwl_hw_rxq_stop(struct iwl_priv *priv) unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } /* stop HW */ - iwl_write_restricted(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); - rc = iwl_poll_restricted_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, + iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); + rc = iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, (1 << 24), 1000); if (rc < 0) IWL_ERROR("Can't stop Rx DMA.\n"); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -196,7 +196,7 @@ static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - ret = iwl_grab_restricted_access(priv); + ret = iwl_grab_nic_access(priv); if (ret) { spin_unlock_irqrestore(&priv->lock, flags); return ret; @@ -217,7 +217,7 @@ static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, ~APMG_PS_CTRL_MSK_PWR_SRC); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return ret; @@ -229,24 +229,24 @@ static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } /* stop HW */ - iwl_write_restricted(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); + iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); - iwl_write_restricted(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); - iwl_write_restricted(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, + iwl_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); + iwl_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, rxq->dma_addr >> 8); - iwl_write_restricted(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, + iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, (priv->hw_setting.shared_phys + offsetof(struct iwl_shared, val0)) >> 4); - iwl_write_restricted(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, + iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | IWL_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K | @@ -258,7 +258,7 @@ static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) * iwl_write32(priv,CSR_INT_COAL_REG,0); */ - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -270,13 +270,13 @@ static int iwl4965_kw_init(struct iwl_priv *priv) int rc; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) goto out; - iwl_write_restricted(priv, IWL_FH_KW_MEM_ADDR_REG, + iwl_write_direct32(priv, IWL_FH_KW_MEM_ADDR_REG, priv->kw.dma_addr >> 4); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); out: spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -375,7 +375,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (unlikely(rc)) { IWL_ERROR("TX reset failed"); spin_unlock_irqrestore(&priv->lock, flags); @@ -383,7 +383,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv) } iwl_write_prph(priv, SCD_TXFACT, 0); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); rc = iwl4965_kw_init(priv); @@ -441,7 +441,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv) return rc; } - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -459,7 +459,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv) iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); iwl_write32(priv, CSR_INT_COALESCING, 512 / 32); spin_unlock_irqrestore(&priv->lock, flags); @@ -505,7 +505,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv) CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc < 0) { spin_unlock_irqrestore(&priv->lock, flags); IWL_DEBUG_INFO("Failed to init the card\n"); @@ -519,7 +519,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv) iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); iwl_hw_card_show_info(priv); @@ -603,18 +603,18 @@ void iwl_hw_txq_ctx_stop(struct iwl_priv *priv) /* reset TFD queues */ for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) { spin_lock_irqsave(&priv->lock, flags); - if (iwl_grab_restricted_access(priv)) { + if (iwl_grab_nic_access(priv)) { spin_unlock_irqrestore(&priv->lock, flags); continue; } - iwl_write_restricted(priv, + iwl_write_direct32(priv, IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id), 0x0); - iwl_poll_restricted_bit(priv, IWL_FH_TSSR_TX_STATUS_REG, + iwl_poll_direct_bit(priv, IWL_FH_TSSR_TX_STATUS_REG, IWL_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE (txq_id), 200); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); } @@ -641,7 +641,7 @@ int iwl_hw_nic_reset(struct iwl_priv *priv) udelay(10); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (!rc) { iwl_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT | @@ -652,7 +652,7 @@ int iwl_hw_nic_reset(struct iwl_priv *priv) iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } clear_bit(STATUS_HCMD_ACTIVE, &priv->status); @@ -1581,7 +1581,7 @@ static void iwl4965_bg_txpower_work(struct work_struct *work) */ static void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index) { - iwl_write_restricted(priv, HBUS_TARG_WRPTR, + iwl_write_direct32(priv, HBUS_TARG_WRPTR, (index & 0xff) | (txq_id << 8)); iwl_write_prph(priv, SCD_QUEUE_RDPTR(txq_id), index); } @@ -1648,7 +1648,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv) priv->chain_noise_data.delta_gain_code[i] = CHAIN_NOISE_DELTA_GAIN_INIT_VAL; #endif /* CONFIG_IWLWIFI_SENSITIVITY*/ - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -1671,7 +1671,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv) /* initiate the queues */ for (i = 0; i < priv->hw_setting.max_txq_num; i++) { iwl_write_prph(priv, SCD_QUEUE_RDPTR(i), 0); - iwl_write_restricted(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); + iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); iwl_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(i), (SCD_WIN_SIZE << @@ -1699,7 +1699,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv) iwl4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0); } - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -2688,19 +2688,19 @@ int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) int txq_id = txq->q.id; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_restricted(priv, FH_MEM_CBBC_QUEUE(txq_id), + iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), txq->q.dma_addr >> 8); - iwl_write_restricted( + iwl_write_direct32( priv, IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id), IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -4188,7 +4188,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, iwl_sta_modify_enable_tid_tx(priv, sta_id, tid); spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -4221,7 +4221,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -4243,7 +4243,7 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, } spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -4262,7 +4262,7 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, iwl4965_txq_ctx_deactivate(priv, txq_id); iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index 5cdcfc43fa1..43afcda6f73 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h @@ -42,15 +42,14 @@ * check or debug information is printed when that function is called. * * A double __ prefix before an access function means that state is checked - * (in the case of *restricted calls) and the current line number is printed - * in addition to any other debug output. + * and the current line number is printed in addition to any other debug output. * * The non-prefixed name is the #define that maps the caller into a * #define that provides the caller's __LINE__ to the double prefix version. * * If you wish to call the function without any debug or state checking, * you should use the single _ prefix version (as is used by dependent IO - * routines, for example _iwl_read_restricted calls the non-check version of + * routines, for example _iwl_read_direct32 calls the non-check version of * _iwl_read32.) * * These declarations are *extremely* useful in quickly isolating code deltas @@ -65,8 +64,7 @@ static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, u32 ofs, u32 val) { - IWL_DEBUG_IO("write_direct32(0x%08X, 0x%08X) - %s %d\n", - (u32) (ofs), (u32) (val), f, l); + IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); _iwl_write32(iwl, ofs, val); } #define iwl_write32(iwl, ofs, val) \ @@ -106,16 +104,16 @@ static inline int __iwl_poll_bit(const char *f, u32 l, struct iwl_priv *priv, u32 addr, u32 bits, u32 mask, int timeout) { - int rc = _iwl_poll_bit(priv, addr, bits, mask, timeout); - if (unlikely(rc == -ETIMEDOUT)) + int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); + if (unlikely(ret == -ETIMEDOUT)) IWL_DEBUG_IO ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n", addr, bits, mask, f, l); else IWL_DEBUG_IO ("poll_bit(0x%08X, 0x%08X, 0x%08X) = 0x%08X - %s %d\n", - addr, bits, mask, rc, f, l); - return rc; + addr, bits, mask, ret, f, l); + return ret; } #define iwl_poll_bit(iwl, addr, bits, mask, timeout) \ __iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) @@ -157,9 +155,9 @@ static inline void __iwl_clear_bit(const char *f, u32 l, #define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m) #endif -static inline int _iwl_grab_restricted_access(struct iwl_priv *priv) +static inline int _iwl_grab_nic_access(struct iwl_priv *priv) { - int rc; + int ret; u32 gp_ctl; #ifdef CONFIG_IWLWIFI_DEBUG @@ -184,11 +182,11 @@ static inline int _iwl_grab_restricted_access(struct iwl_priv *priv) /* this bit wakes up the NIC */ _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - rc = _iwl_poll_bit(priv, CSR_GP_CNTRL, + ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50); - if (rc < 0) { + if (ret < 0) { IWL_ERROR("MAC is in deep sleep!\n"); return -EIO; } @@ -200,25 +198,24 @@ static inline int _iwl_grab_restricted_access(struct iwl_priv *priv) } #ifdef CONFIG_IWLWIFI_DEBUG -static inline int __iwl_grab_restricted_access(const char *f, u32 l, +static inline int __iwl_grab_nic_access(const char *f, u32 l, struct iwl_priv *priv) { if (atomic_read(&priv->restrict_refcnt)) IWL_DEBUG_INFO("Grabbing access while already held at " "line %d.\n", l); - IWL_DEBUG_IO("grabbing restricted access - %s %d\n", f, l); - - return _iwl_grab_restricted_access(priv); + IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l); + return _iwl_grab_nic_access(priv); } -#define iwl_grab_restricted_access(priv) \ - __iwl_grab_restricted_access(__FILE__, __LINE__, priv) +#define iwl_grab_nic_access(priv) \ + __iwl_grab_nic_access(__FILE__, __LINE__, priv) #else -#define iwl_grab_restricted_access(priv) \ - _iwl_grab_restricted_access(priv) +#define iwl_grab_nic_access(priv) \ + _iwl_grab_nic_access(priv) #endif -static inline void _iwl_release_restricted_access(struct iwl_priv *priv) +static inline void _iwl_release_nic_access(struct iwl_priv *priv) { #ifdef CONFIG_IWLWIFI_DEBUG if (atomic_dec_and_test(&priv->restrict_refcnt)) @@ -227,80 +224,80 @@ static inline void _iwl_release_restricted_access(struct iwl_priv *priv) CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); } #ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_release_restricted_access(const char *f, u32 l, - struct iwl_priv *priv) +static inline void __iwl_release_nic_access(const char *f, u32 l, + struct iwl_priv *priv) { if (atomic_read(&priv->restrict_refcnt) <= 0) - IWL_ERROR("Release unheld restricted access at line %d.\n", l); + IWL_ERROR("Release unheld nic access at line %d.\n", l); - IWL_DEBUG_IO("releasing restricted access - %s %d\n", f, l); - _iwl_release_restricted_access(priv); + IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l); + _iwl_release_nic_access(priv); } -#define iwl_release_restricted_access(priv) \ - __iwl_release_restricted_access(__FILE__, __LINE__, priv) +#define iwl_release_nic_access(priv) \ + __iwl_release_nic_access(__FILE__, __LINE__, priv) #else -#define iwl_release_restricted_access(priv) \ - _iwl_release_restricted_access(priv) +#define iwl_release_nic_access(priv) \ + _iwl_release_nic_access(priv) #endif -static inline u32 _iwl_read_restricted(struct iwl_priv *priv, u32 reg) +static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) { return _iwl_read32(priv, reg); } #ifdef CONFIG_IWLWIFI_DEBUG -static inline u32 __iwl_read_restricted(const char *f, u32 l, +static inline u32 __iwl_read_direct32(const char *f, u32 l, struct iwl_priv *priv, u32 reg) { - u32 value = _iwl_read_restricted(priv, reg); + u32 value = _iwl_read_direct32(priv, reg); if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Unrestricted access from %s %d\n", f, l); - IWL_DEBUG_IO("read_restricted(0x%4X) = 0x%08x - %s %d \n", reg, value, + IWL_ERROR("Nic access not held from %s %d\n", f, l); + IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value, f, l); return value; } -#define iwl_read_restricted(priv, reg) \ - __iwl_read_restricted(__FILE__, __LINE__, priv, reg) +#define iwl_read_direct32(priv, reg) \ + __iwl_read_direct32(__FILE__, __LINE__, priv, reg) #else -#define iwl_read_restricted _iwl_read_restricted +#define iwl_read_direct32 _iwl_read_direct32 #endif -static inline void _iwl_write_restricted(struct iwl_priv *priv, +static inline void _iwl_write_direct32(struct iwl_priv *priv, u32 reg, u32 value) { _iwl_write32(priv, reg, value); } #ifdef CONFIG_IWLWIFI_DEBUG -static void __iwl_write_restricted(u32 line, +static void __iwl_write_direct32(u32 line, struct iwl_priv *priv, u32 reg, u32 value) { if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Unrestricted access from line %d\n", line); - _iwl_write_restricted(priv, reg, value); + IWL_ERROR("Nic access not held from line %d\n", line); + _iwl_write_direct32(priv, reg, value); } -#define iwl_write_restricted(priv, reg, value) \ - __iwl_write_restricted(__LINE__, priv, reg, value) +#define iwl_write_direct32(priv, reg, value) \ + __iwl_write_direct32(__LINE__, priv, reg, value) #else -#define iwl_write_restricted _iwl_write_restricted +#define iwl_write_direct32 _iwl_write_direct32 #endif -static inline void iwl_write_buffer_restricted(struct iwl_priv *priv, +static inline void iwl_write_reg_buf(struct iwl_priv *priv, u32 reg, u32 len, u32 *values) { u32 count = sizeof(u32); if ((priv != NULL) && (values != NULL)) { for (; 0 < len; len -= count, reg += count, values++) - _iwl_write_restricted(priv, reg, *values); + _iwl_write_direct32(priv, reg, *values); } } -static inline int _iwl_poll_restricted_bit(struct iwl_priv *priv, +static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, u32 addr, u32 mask, int timeout) { int i = 0; do { - if ((_iwl_read_restricted(priv, addr) & mask) == mask) + if ((_iwl_read_direct32(priv, addr) & mask) == mask) return i; mdelay(10); i += 10; @@ -310,36 +307,36 @@ static inline int _iwl_poll_restricted_bit(struct iwl_priv *priv, } #ifdef CONFIG_IWLWIFI_DEBUG -static inline int __iwl_poll_restricted_bit(const char *f, u32 l, +static inline int __iwl_poll_direct_bit(const char *f, u32 l, struct iwl_priv *priv, u32 addr, u32 mask, int timeout) { - int rc = _iwl_poll_restricted_bit(priv, addr, mask, timeout); + int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout); - if (unlikely(rc == -ETIMEDOUT)) - IWL_DEBUG_IO("poll_restricted_bit(0x%08X, 0x%08X) - " + if (unlikely(ret == -ETIMEDOUT)) + IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - " "timedout - %s %d\n", addr, mask, f, l); else - IWL_DEBUG_IO("poll_restricted_bit(0x%08X, 0x%08X) = 0x%08X " - "- %s %d\n", addr, mask, rc, f, l); - return rc; + IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) = 0x%08X " + "- %s %d\n", addr, mask, ret, f, l); + return ret; } -#define iwl_poll_restricted_bit(iwl, addr, mask, timeout) \ - __iwl_poll_restricted_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) +#define iwl_poll_direct_bit(iwl, addr, mask, timeout) \ + __iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) #else -#define iwl_poll_restricted_bit _iwl_poll_restricted_bit +#define iwl_poll_direct_bit _iwl_poll_direct_bit #endif static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) { - _iwl_write_restricted(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); - return _iwl_read_restricted(priv, HBUS_TARG_PRPH_RDAT); + _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); + return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); } #ifdef CONFIG_IWLWIFI_DEBUG static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) { if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Unrestricted access from line %d\n", line); + IWL_ERROR("Nic access not held from line %d\n", line); return _iwl_read_prph(priv, reg); } @@ -352,16 +349,16 @@ static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) static inline void _iwl_write_prph(struct iwl_priv *priv, u32 addr, u32 val) { - _iwl_write_restricted(priv, HBUS_TARG_PRPH_WADDR, + _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, ((addr & 0x0000FFFF) | (3 << 24))); - _iwl_write_restricted(priv, HBUS_TARG_PRPH_WDAT, val); + _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); } #ifdef CONFIG_IWLWIFI_DEBUG static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, u32 addr, u32 val) { if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Unrestricted access from line %d\n", line); + IWL_ERROR("Nic access from line %d\n", line); _iwl_write_prph(priv, addr, val); } @@ -378,7 +375,8 @@ static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, u32 reg, u32 mask) { if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Unrestricted access from line %d\n", line); + IWL_ERROR("Nic access not held from line %d\n", line); + _iwl_set_bits_prph(priv, reg, mask); } #define iwl_set_bits_prph(priv, reg, mask) \ @@ -395,7 +393,7 @@ static inline void __iwl_set_bits_mask_prph(u32 line, struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) { if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Unrestricted access from line %d\n", line); + IWL_ERROR("Nic access not held from line %d\n", line); _iwl_set_bits_mask_prph(priv, reg, bits, mask); } #define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ @@ -413,21 +411,21 @@ static inline void iwl_clear_bits_prph(struct iwl_priv static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) { - iwl_write_restricted(priv, HBUS_TARG_MEM_RADDR, addr); - return iwl_read_restricted(priv, HBUS_TARG_MEM_RDAT); + iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); + return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); } static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) { - iwl_write_restricted(priv, HBUS_TARG_MEM_WADDR, addr); - iwl_write_restricted(priv, HBUS_TARG_MEM_WDAT, val); + iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); } static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, u32 len, u32 *values) { - iwl_write_restricted(priv, HBUS_TARG_MEM_WADDR, addr); + iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); for (; 0 < len; len -= sizeof(u32), values++) - iwl_write_restricted(priv, HBUS_TARG_MEM_WDAT, *values); + iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); } #endif diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 96cb68ebc61..8b570e0237c 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -1563,7 +1563,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT; i += IWL_EEPROM_ACCESS_DELAY) { - r = _iwl_read_restricted(priv, CSR_EEPROM_REG); + r = _iwl_read_direct32(priv, CSR_EEPROM_REG); if (r & CSR_EEPROM_REG_READ_VALID_MSK) break; udelay(IWL_EEPROM_ACCESS_DELAY); @@ -2996,8 +2996,8 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) spin_lock_irqsave(&priv->lock, flags); iwl_read32(priv, CSR_UCODE_DRV_GP1); - if (!iwl_grab_restricted_access(priv)) - iwl_release_restricted_access(priv); + if (!iwl_grab_nic_access(priv)) + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { @@ -3954,13 +3954,13 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) goto exit_unlock; } - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) goto exit_unlock; - iwl_write_restricted(priv, FH_RSCSR_CHNL0_WPTR, + iwl_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } else iwl_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); @@ -4352,12 +4352,12 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, } /* restore this queue's parameters in nic hardware. */ - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) return rc; - iwl_write_restricted(priv, HBUS_TARG_WRPTR, + iwl_write_direct32(priv, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); /* else not in power-save mode, uCode will never sleep when we're * trying to tx (during RFKILL, we're not trying to tx). */ @@ -4451,7 +4451,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) return; } - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { IWL_WARNING("Can not read from adapter at this time.\n"); return; @@ -4490,7 +4490,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) ilink1, ilink2, data1); } - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } @@ -4499,7 +4499,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) /** * iwl_print_event_log - Dump error event log to syslog * - * NOTE: Must be called with iwl_grab_restricted_access() already obtained! + * NOTE: Must be called with iwl_grab_nic_access() already obtained! */ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, u32 num_events, u32 mode) @@ -4555,7 +4555,7 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) return; } - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { IWL_WARNING("Can not read from adapter at this time.\n"); return; @@ -4572,7 +4572,7 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) /* bail out if nothing in log */ if (size == 0) { IWL_ERROR("Start IWL Event Log Dump: nothing in log\n"); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); return; } @@ -4588,7 +4588,7 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) /* (then/else) start at top of log */ iwl_print_event_log(priv, 0, next_entry, mode); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } /** @@ -4779,11 +4779,11 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) IWL_DEBUG_ISR("Tx interrupt\n"); iwl_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); - if (!iwl_grab_restricted_access(priv)) { - iwl_write_restricted(priv, + if (!iwl_grab_nic_access(priv)) { + iwl_write_direct32(priv, FH_TCSR_CREDIT (ALM_FH_SRVC_CHNL), 0x0); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } handled |= CSR_INT_BIT_FH_TX; } @@ -5487,18 +5487,18 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) IWL_DEBUG_INFO("ucode inst image size is %u\n", len); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) return rc; - iwl_write_restricted(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); + iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); errcnt = 0; for (; len > 0; len -= sizeof(u32), image++) { /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log * if IWL_DL_IO is set */ - val = _iwl_read_restricted(priv, HBUS_TARG_MEM_RDAT); + val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { IWL_ERROR("uCode INST section is invalid at " "offset 0x%x, is 0x%x, s/b 0x%x\n", @@ -5510,7 +5510,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) } } - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); if (!errcnt) IWL_DEBUG_INFO("ucode image in INSTRUCTION memory is good\n"); @@ -5533,7 +5533,7 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) IWL_DEBUG_INFO("ucode inst image size is %u\n", len); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) return rc; @@ -5541,9 +5541,9 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log * if IWL_DL_IO is set */ - iwl_write_restricted(priv, HBUS_TARG_MEM_RADDR, + iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, i + RTC_INST_LOWER_BOUND); - val = _iwl_read_restricted(priv, HBUS_TARG_MEM_RDAT); + val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { #if 0 /* Enable this if you want to see details */ IWL_ERROR("uCode INST section is invalid at " @@ -5557,7 +5557,7 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) } } - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); return rc; } @@ -5704,7 +5704,7 @@ static int iwl_load_bsm(struct iwl_priv *priv) inst_len = priv->ucode_init.len; data_len = priv->ucode_init_data.len; - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) return rc; @@ -5722,7 +5722,7 @@ static int iwl_load_bsm(struct iwl_priv *priv) rc = iwl_verify_bsm(priv); if (rc) { - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); return rc; } @@ -5756,7 +5756,7 @@ static int iwl_load_bsm(struct iwl_priv *priv) iwl_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); return 0; } @@ -5997,7 +5997,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) pdata = priv->ucode_data_backup.p_addr; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -6014,7 +6014,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, priv->ucode_code.len | BSM_DRAM_INST_LOAD); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); @@ -6103,7 +6103,7 @@ static void iwl_alive_start(struct iwl_priv *priv) iwl_clear_stations_table(priv); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { IWL_WARNING("Can not read rfkill status from adapter\n"); return; @@ -6111,7 +6111,7 @@ static void iwl_alive_start(struct iwl_priv *priv) rfkill = iwl_read_prph(priv, APMG_RFKILL_REG); IWL_DEBUG_INFO("RFKILL status: 0x%x\n", rfkill); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); if (rfkill & 0x1) { clear_bit(STATUS_RF_KILL_HW, &priv->status); @@ -6273,10 +6273,10 @@ static void __iwl_down(struct iwl_priv *priv) iwl_hw_rxq_stop(priv); spin_lock_irqsave(&priv->lock, flags); - if (!iwl_grab_restricted_access(priv)) { + if (!iwl_grab_nic_access(priv)) { iwl_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } spin_unlock_irqrestore(&priv->lock, flags); @@ -8673,10 +8673,10 @@ static void iwl_resume(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - if (!iwl_grab_restricted_access(priv)) { + if (!iwl_grab_nic_access(priv)) { iwl_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } spin_unlock_irqrestore(&priv->lock, flags); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 5d19ce9bb1a..5408b5379a4 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -1610,7 +1610,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT; i += IWL_EEPROM_ACCESS_DELAY) { - r = _iwl_read_restricted(priv, CSR_EEPROM_REG); + r = _iwl_read_direct32(priv, CSR_EEPROM_REG); if (r & CSR_EEPROM_REG_READ_VALID_MSK) break; udelay(IWL_EEPROM_ACCESS_DELAY); @@ -3087,8 +3087,8 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) spin_lock_irqsave(&priv->lock, flags); iwl_read32(priv, CSR_UCODE_DRV_GP1); - if (!iwl_grab_restricted_access(priv)) - iwl_release_restricted_access(priv); + if (!iwl_grab_nic_access(priv)) + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { @@ -4025,23 +4025,23 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - if (!iwl_grab_restricted_access(priv)) { - iwl_write_restricted( + if (!iwl_grab_nic_access(priv)) { + iwl_write_direct32( priv, HBUS_TARG_MBX_C, HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } if (!(flags & RXON_CARD_DISABLED)) { iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - if (!iwl_grab_restricted_access(priv)) { - iwl_write_restricted( + if (!iwl_grab_nic_access(priv)) { + iwl_write_direct32( priv, HBUS_TARG_MBX_C, HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } } @@ -4049,8 +4049,8 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); iwl_read32(priv, CSR_UCODE_DRV_GP1); - if (!iwl_grab_restricted_access(priv)) - iwl_release_restricted_access(priv); + if (!iwl_grab_nic_access(priv)) + iwl_release_nic_access(priv); } } @@ -4278,13 +4278,13 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) goto exit_unlock; } - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) goto exit_unlock; - iwl_write_restricted(priv, FH_RSCSR_CHNL0_WPTR, + iwl_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } else iwl_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); @@ -4680,12 +4680,12 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, } /* restore this queue's parameters in nic hardware. */ - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) return rc; - iwl_write_restricted(priv, HBUS_TARG_WRPTR, + iwl_write_direct32(priv, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); /* else not in power-save mode, uCode will never sleep when we're * trying to tx (during RFKILL, we're not trying to tx). */ @@ -4779,7 +4779,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) return; } - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { IWL_WARNING("Can not read from adapter at this time.\n"); return; @@ -4811,7 +4811,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2, ilink1, ilink2); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } #define EVENT_START_OFFSET (4 * sizeof(u32)) @@ -4819,7 +4819,7 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) /** * iwl_print_event_log - Dump error event log to syslog * - * NOTE: Must be called with iwl_grab_restricted_access() already obtained! + * NOTE: Must be called with iwl_grab_nic_access() already obtained! */ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, u32 num_events, u32 mode) @@ -4875,7 +4875,7 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) return; } - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { IWL_WARNING("Can not read from adapter at this time.\n"); return; @@ -4892,7 +4892,7 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) /* bail out if nothing in log */ if (size == 0) { IWL_ERROR("Start IWL Event Log Dump: nothing in log\n"); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); return; } @@ -4908,7 +4908,7 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) /* (then/else) start at top of log */ iwl_print_event_log(priv, 0, next_entry, mode); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } /** @@ -5865,18 +5865,18 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) IWL_DEBUG_INFO("ucode inst image size is %u\n", len); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) return rc; - iwl_write_restricted(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); + iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); errcnt = 0; for (; len > 0; len -= sizeof(u32), image++) { /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log * if IWL_DL_IO is set */ - val = _iwl_read_restricted(priv, HBUS_TARG_MEM_RDAT); + val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { IWL_ERROR("uCode INST section is invalid at " "offset 0x%x, is 0x%x, s/b 0x%x\n", @@ -5888,7 +5888,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) } } - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); if (!errcnt) IWL_DEBUG_INFO @@ -5912,7 +5912,7 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) IWL_DEBUG_INFO("ucode inst image size is %u\n", len); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) return rc; @@ -5920,9 +5920,9 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log * if IWL_DL_IO is set */ - iwl_write_restricted(priv, HBUS_TARG_MEM_RADDR, + iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, i + RTC_INST_LOWER_BOUND); - val = _iwl_read_restricted(priv, HBUS_TARG_MEM_RDAT); + val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { #if 0 /* Enable this if you want to see details */ IWL_ERROR("uCode INST section is invalid at " @@ -5936,7 +5936,7 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) } } - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); return rc; } @@ -6083,7 +6083,7 @@ static int iwl_load_bsm(struct iwl_priv *priv) inst_len = priv->ucode_init.len; data_len = priv->ucode_init_data.len; - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) return rc; @@ -6101,7 +6101,7 @@ static int iwl_load_bsm(struct iwl_priv *priv) rc = iwl_verify_bsm(priv); if (rc) { - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); return rc; } @@ -6135,7 +6135,7 @@ static int iwl_load_bsm(struct iwl_priv *priv) iwl_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); return 0; } @@ -6380,7 +6380,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) pdata = priv->ucode_data_backup.p_addr >> 4; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_restricted_access(priv); + rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -6397,7 +6397,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, priv->ucode_code.len | BSM_DRAM_INST_LOAD); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); @@ -6638,10 +6638,10 @@ static void __iwl_down(struct iwl_priv *priv) iwl_hw_rxq_stop(priv); spin_lock_irqsave(&priv->lock, flags); - if (!iwl_grab_restricted_access(priv)) { + if (!iwl_grab_nic_access(priv)) { iwl_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); - iwl_release_restricted_access(priv); + iwl_release_nic_access(priv); } spin_unlock_irqrestore(&priv->lock, flags); @@ -9299,10 +9299,10 @@ static void iwl_resume(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - if (!iwl_grab_restricted_access(priv)) { + if (!iwl_grab_nic_access(priv)) { iwl_write_prph(priv, APMG_CLK_DIS_REG, - APMG_CLK_VAL_DMA_CLK_RQT); - iwl_release_restricted_access(priv); + APMG_CLK_VAL_DMA_CLK_RQT); + iwl_release_nic_access(priv); } spin_unlock_irqrestore(&priv->lock, flags); -- cgit v1.2.3-70-g09d2 From bee488dbd7effea4c4a483b0a336df331066bb3c Mon Sep 17 00:00:00 2001 From: mabbas Date: Thu, 25 Oct 2007 17:15:42 +0800 Subject: iwl4965: exclude 60M rate from probe request This patch do the following 2 things: 1. Make sure we don't add rate 60M part of supported rate in proble request, some AP does not like that. 2. It is wrong to set priv->active_rate in this function, this will set it to all avialable rates which might overwrite the mode supported rate. priv->active_rate should be set by only from iwl_set_rate. Signed-off-by: Mohamed Abbas Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl4965-base.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 5408b5379a4..a9415ca784a 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -1833,7 +1833,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, { int len = 0; u8 *pos = NULL; - u16 active_rates, ret_rates, cck_rates; + u16 active_rates, ret_rates, cck_rates, active_rate_basic; /* Make sure there is enough space for the probe request, * two mandatory IEs and the data */ @@ -1883,17 +1883,19 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, *pos++ = WLAN_EID_SUPP_RATES; *pos = 0; - priv->active_rate = priv->rates_mask; - active_rates = priv->active_rate; - priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; + /* exclude 60M rate */ + active_rates = priv->rates_mask; + active_rates &= ~IWL_RATE_60M_MASK; + + active_rate_basic = active_rates & IWL_BASIC_RATES_MASK; cck_rates = IWL_CCK_RATES_MASK & active_rates; ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, - priv->active_rate_basic, &left); + active_rate_basic, &left); active_rates &= ~ret_rates; ret_rates = iwl_supported_rate_to_ie(pos, active_rates, - priv->active_rate_basic, &left); + active_rate_basic, &left); active_rates &= ~ret_rates; len += 2 + *pos; @@ -1910,7 +1912,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, *pos++ = WLAN_EID_EXT_SUPP_RATES; *pos = 0; iwl_supported_rate_to_ie(pos, active_rates, - priv->active_rate_basic, &left); + active_rate_basic, &left); if (*pos > 0) len += 2 + *pos; -- cgit v1.2.3-70-g09d2 From 6ff752093302cedac1124b219729c16f48862c30 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 25 Oct 2007 17:15:44 +0800 Subject: iwlwifi: Update iwlwifi version stamp to 1.1.18 Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 8b570e0237c..d92d03f11a5 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -101,7 +101,7 @@ int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; #define VS #endif -#define IWLWIFI_VERSION "1.1.17k" VD VS +#define IWLWIFI_VERSION "1.1.18k" VD VS #define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation" #define DRV_VERSION IWLWIFI_VERSION diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index a9415ca784a..efd6d803e99 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -100,7 +100,7 @@ int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; #define VS #endif -#define IWLWIFI_VERSION "1.1.17k" VD VS +#define IWLWIFI_VERSION "1.1.18k" VD VS #define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation" #define DRV_VERSION IWLWIFI_VERSION -- cgit v1.2.3-70-g09d2 From 80f3e024dcc14f30bff58179ad610f941642901b Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 25 Oct 2007 17:15:48 +0800 Subject: iwlwifi: Update iwlwifi version stamp to 1.1.19 Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index d92d03f11a5..68f6b8bc4dd 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -101,7 +101,7 @@ int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; #define VS #endif -#define IWLWIFI_VERSION "1.1.18k" VD VS +#define IWLWIFI_VERSION "1.1.19k" VD VS #define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation" #define DRV_VERSION IWLWIFI_VERSION diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index efd6d803e99..aa45ebabe84 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -100,7 +100,7 @@ int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; #define VS #endif -#define IWLWIFI_VERSION "1.1.18k" VD VS +#define IWLWIFI_VERSION "1.1.19k" VD VS #define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation" #define DRV_VERSION IWLWIFI_VERSION -- cgit v1.2.3-70-g09d2 From 416e1438d5a921046fda6fc5673d5f2c69841c06 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 25 Oct 2007 17:15:49 +0800 Subject: iwlwifi: mark more functions/variables static mark more functions/variables static Signed-off-by: Christoph Hellwig Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 17 +---------------- drivers/net/wireless/iwlwifi/iwl-3945.h | 1 - drivers/net/wireless/iwlwifi/iwl-4965.c | 4 +++- drivers/net/wireless/iwlwifi/iwl3945-base.c | 29 ++++++++++++++++------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 25 ++++++++++++++----------- drivers/net/wireless/iwlwifi/iwlwifi.h | 20 ++++---------------- 6 files changed, 38 insertions(+), 58 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index aec564d976a..faaba292717 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -699,21 +699,6 @@ u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) return sta_id; } -void iwl_hw_card_show_info(struct iwl_priv *priv) -{ - IWL_DEBUG_INFO("3945ABG HW Version %u.%u.%u\n", - ((priv->eeprom.board_revision >> 8) & 0x0F), - ((priv->eeprom.board_revision >> 8) >> 4), - (priv->eeprom.board_revision & 0x00FF)); - - IWL_DEBUG_INFO("3945ABG PBA Number %.*s\n", - (int)sizeof(priv->eeprom.board_pba_number), - priv->eeprom.board_pba_number); - - IWL_DEBUG_INFO("EEPROM_ANTENNA_SWITCH_TYPE is 0x%02X\n", - priv->eeprom.antenna_switch_type); -} - static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) { int rc; @@ -1780,7 +1765,7 @@ void iwl3945_reg_txpower_periodic(struct iwl_priv *priv) &priv->thermal_periodic, REG_RECALIB_PERIOD * HZ); } -void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) +static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) { struct iwl_priv *priv = container_of(work, struct iwl_priv, thermal_periodic.work); diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 2bc5e9a79be..adb5d672e71 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -34,7 +34,6 @@ extern int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv); extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv); extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv); extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); -extern void iwl3945_bg_reg_txpower_periodic(struct work_struct *work); extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv); extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags); diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index f4113058188..28f7aa802fd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -43,6 +43,8 @@ #include "iwl-4965.h" #include "iwl-helpers.h" +static void iwl_hw_card_show_info(struct iwl_priv *priv); + #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ IWL_RATE_SISO_##s##M_PLCP, \ @@ -2744,7 +2746,7 @@ int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, return 0; } -void iwl_hw_card_show_info(struct iwl_priv *priv) +static void iwl_hw_card_show_info(struct iwl_priv *priv) { u16 hw_version = priv->eeprom.board_revision_4965; diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 68f6b8bc4dd..3cccb3db6ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -66,6 +66,9 @@ u32 iwl_debug_level; #endif +static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, + struct iwl_tx_queue *txq); + /****************************************************************************** * * module boiler plate @@ -73,12 +76,12 @@ u32 iwl_debug_level; ******************************************************************************/ /* module parameters */ -int iwl_param_disable_hw_scan; -int iwl_param_debug; -int iwl_param_disable; /* def: enable radio */ -int iwl_param_antenna; /* def: 0 = both antennas (use diversity) */ +static int iwl_param_disable_hw_scan; +static int iwl_param_debug; +static int iwl_param_disable; /* def: enable radio */ +static int iwl_param_antenna; /* def: 0 = both antennas (use diversity) */ int iwl_param_hwcrypto; /* def: using software encryption */ -int iwl_param_qos_enable = 1; +static int iwl_param_qos_enable = 1; int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; /* @@ -116,7 +119,7 @@ MODULE_VERSION(DRV_VERSION); MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_LICENSE("GPL"); -__le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr) +static __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr) { u16 fc = le16_to_cpu(hdr->frame_control); int hdr_len = ieee80211_get_hdrlen(fc); @@ -694,7 +697,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) return ret ? ret : idx; } -int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) { int ret; @@ -718,7 +721,7 @@ int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) return 0; } -int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) { int cmd_idx; int ret; @@ -2200,7 +2203,7 @@ int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x -const char *iwl_get_tx_fail_reason(u32 status) +static const char *iwl_get_tx_fail_reason(u32 status) { switch (status & TX_STATUS_MSK) { case TX_STATUS_SUCCESS: @@ -3354,7 +3357,7 @@ static void iwl_txstatus_to_ieee(struct iwl_priv *priv, * new 'R' index need to be reclaimed. As result, some free space * forms. If there is enough free space (> low mark), wake Tx queue. */ -int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) +static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) { struct iwl_tx_queue *txq = &priv->txq[txq_id]; struct iwl_queue *q = &txq->q; @@ -3994,7 +3997,7 @@ static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv, * also updates the memory address in the firmware to reference the new * target buffer. */ -int iwl_rx_queue_restock(struct iwl_priv *priv) +static int iwl_rx_queue_restock(struct iwl_priv *priv) { struct iwl_rx_queue *rxq = &priv->rxq; struct list_head *element; @@ -4084,7 +4087,7 @@ void iwl_rx_replenish(void *data) * This free routine walks the list of POOL entries and if SKB is set to * non NULL it is unmapped and freed */ -void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) { int i; for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { @@ -4327,7 +4330,7 @@ static void iwl_rx_handle(struct iwl_priv *priv) iwl_rx_queue_restock(priv); } -int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, +static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq) { u32 reg = 0; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index aa45ebabe84..0e46ffde22a 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -66,6 +66,9 @@ u32 iwl_debug_level; #endif +static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, + struct iwl_tx_queue *txq); + /****************************************************************************** * * module boiler plate @@ -73,12 +76,12 @@ u32 iwl_debug_level; ******************************************************************************/ /* module parameters */ -int iwl_param_disable_hw_scan; -int iwl_param_debug; -int iwl_param_disable; /* def: enable radio */ -int iwl_param_antenna; /* def: 0 = both antennas (use diversity) */ +static int iwl_param_disable_hw_scan; +static int iwl_param_debug; +static int iwl_param_disable; /* def: enable radio */ +static int iwl_param_antenna; /* def: 0 = both antennas (use diversity) */ int iwl_param_hwcrypto; /* def: using software encryption */ -int iwl_param_qos_enable = 1; +static int iwl_param_qos_enable = 1; int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; /* @@ -692,7 +695,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) return ret ? ret : idx; } -int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) { int ret; @@ -716,7 +719,7 @@ int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) return 0; } -int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) { int cmd_idx; int ret; @@ -2281,7 +2284,7 @@ int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x -const char *iwl_get_tx_fail_reason(u32 status) +static const char *iwl_get_tx_fail_reason(u32 status) { switch (status & TX_STATUS_MSK) { case TX_STATUS_SUCCESS: @@ -4321,7 +4324,7 @@ static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv, * also updates the memory address in the firmware to reference the new * target buffer. */ -int iwl_rx_queue_restock(struct iwl_priv *priv) +static int iwl_rx_queue_restock(struct iwl_priv *priv) { struct iwl_rx_queue *rxq = &priv->rxq; struct list_head *element; @@ -4411,7 +4414,7 @@ void iwl_rx_replenish(void *data) * This free routine walks the list of POOL entries and if SKB is set to * non NULL it is unmapped and freed */ -void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) { int i; for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { @@ -4657,7 +4660,7 @@ static void iwl_rx_handle(struct iwl_priv *priv) iwl_rx_queue_restock(priv); } -int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, +static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq) { u32 reg = 0; diff --git a/drivers/net/wireless/iwlwifi/iwlwifi.h b/drivers/net/wireless/iwlwifi/iwlwifi.h index 90716006bea..96558cc60ae 100644 --- a/drivers/net/wireless/iwlwifi/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi/iwlwifi.h @@ -76,13 +76,7 @@ extern struct pci_device_id iwl_hw_card_ids[]; #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) /* Module parameters accessible from iwl-*.c */ -extern int iwl_param_disable_hw_scan; -extern int iwl_param_debug; -extern int iwl_param_mode; -extern int iwl_param_disable; -extern int iwl_param_antenna; extern int iwl_param_hwcrypto; -extern int iwl_param_qos_enable; extern int iwl_param_queues_num; enum iwl_antenna { @@ -574,7 +568,6 @@ struct iwl_driver_hw_info { struct iwl_addsta_cmd; extern int iwl_send_add_station(struct iwl_priv *priv, struct iwl_addsta_cmd *sta, u8 flags); -extern const char *iwl_get_tx_fail_reason(u32 status); extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid, int is_ap, u8 flags); extern int iwl_is_network_packet(struct iwl_priv *priv, @@ -591,8 +584,6 @@ static inline void iwl_report_frame(struct iwl_priv *priv, struct ieee80211_hdr *header, int group100) {} #endif -extern int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_tx_queue *txq); extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb, void *data, short len, @@ -600,7 +591,6 @@ extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv, u16 phy_flags); extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header); -extern void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq); extern int iwl_rx_queue_alloc(struct iwl_priv *priv); extern void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); @@ -608,15 +598,10 @@ extern int iwl_calc_db_from_ratio(int sig_ratio); extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm); extern int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, int count, u32 id); -extern int iwl_rx_queue_restock(struct iwl_priv *priv); extern void iwl_rx_replenish(void *data); extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data); -extern int __must_check iwl_send_cmd_async(struct iwl_priv *priv, - struct iwl_host_cmd *cmd); -extern int __must_check iwl_send_cmd_sync(struct iwl_priv *priv, - struct iwl_host_cmd *cmd); extern int __must_check iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, @@ -628,7 +613,9 @@ extern int iwl_send_statistics_request(struct iwl_priv *priv); extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, u32 decrypt_res, struct ieee80211_rx_status *stats); +#if IWL == 4965 extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr); +#endif extern const u8 BROADCAST_ADDR[ETH_ALEN]; @@ -666,7 +653,6 @@ extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv); extern int iwl_hw_rxq_stop(struct iwl_priv *priv); extern int iwl_hw_set_hw_setting(struct iwl_priv *priv); extern int iwl_hw_nic_init(struct iwl_priv *priv); -extern void iwl_hw_card_show_info(struct iwl_priv *priv); extern int iwl_hw_nic_stop_master(struct iwl_priv *priv); extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv); extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv); @@ -703,5 +689,7 @@ extern int iwl4965_get_temperature(const struct iwl_priv *priv); extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid); extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel); +#if IWL == 4965 extern int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index); #endif +#endif -- cgit v1.2.3-70-g09d2 From 5d08cd1dfdc57dc834c47eb9f023fcf861f3d6bf Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 25 Oct 2007 17:15:50 +0800 Subject: iwlwifi: keep 3945 and 4965 headers separate The iwl3945 and iwl4965 devices share some common structure, but with a lot of difference split all over. Currently the two drivers share a lot of headers and use ugly preprocessor magic to manage the difference. This patch keeps two entirely separate copies of the headers to get rid of these hacks an ease future development. Signed-off-by: Christoph Hellwig Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945-commands.h | 1467 ++++++++++++++++++ drivers/net/wireless/iwlwifi/iwl-3945-debug.h | 152 ++ drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 627 ++++++++ drivers/net/wireless/iwlwifi/iwl-3945-io.h | 431 ++++++ drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 4 +- drivers/net/wireless/iwlwifi/iwl-3945.c | 5 +- drivers/net/wireless/iwlwifi/iwl-3945.h | 960 ++++++++++++ drivers/net/wireless/iwlwifi/iwl-4965-commands.h | 1582 ++++++++++++++++++++ drivers/net/wireless/iwlwifi/iwl-4965-debug.h | 152 ++ drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 677 +++++++++ drivers/net/wireless/iwlwifi/iwl-4965-io.h | 431 ++++++ drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 4 +- drivers/net/wireless/iwlwifi/iwl-4965.c | 3 - drivers/net/wireless/iwlwifi/iwl-4965.h | 1019 +++++++++++++ drivers/net/wireless/iwlwifi/iwl-channel.h | 161 -- drivers/net/wireless/iwlwifi/iwl-commands.h | 1734 ---------------------- drivers/net/wireless/iwlwifi/iwl-debug.h | 152 -- drivers/net/wireless/iwlwifi/iwl-eeprom.h | 336 ----- drivers/net/wireless/iwlwifi/iwl-hw.h | 537 ------- drivers/net/wireless/iwlwifi/iwl-io.h | 431 ------ drivers/net/wireless/iwlwifi/iwl-priv.h | 307 ---- drivers/net/wireless/iwlwifi/iwl3945-base.c | 3 - drivers/net/wireless/iwlwifi/iwl4965-base.c | 3 - drivers/net/wireless/iwlwifi/iwlwifi.h | 695 --------- 24 files changed, 7501 insertions(+), 4372 deletions(-) create mode 100644 drivers/net/wireless/iwlwifi/iwl-3945-commands.h create mode 100644 drivers/net/wireless/iwlwifi/iwl-3945-debug.h create mode 100644 drivers/net/wireless/iwlwifi/iwl-3945-io.h create mode 100644 drivers/net/wireless/iwlwifi/iwl-4965-commands.h create mode 100644 drivers/net/wireless/iwlwifi/iwl-4965-debug.h create mode 100644 drivers/net/wireless/iwlwifi/iwl-4965-io.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-channel.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-commands.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-debug.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-eeprom.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-hw.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-io.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-priv.h delete mode 100644 drivers/net/wireless/iwlwifi/iwlwifi.h (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h new file mode 100644 index 00000000000..2c71195a08e --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h @@ -0,0 +1,1467 @@ +/****************************************************************************** + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, + * USA + * + * The full GNU General Public License is included in this distribution + * in the file called LICENSE.GPL. + * + * Contact Information: + * James P. Ketrenos + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * BSD LICENSE + * + * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef __iwl_3945_commands_h__ +#define __iwl_3945_commands_h__ + +enum { + REPLY_ALIVE = 0x1, + REPLY_ERROR = 0x2, + + /* RXON and QOS commands */ + REPLY_RXON = 0x10, + REPLY_RXON_ASSOC = 0x11, + REPLY_QOS_PARAM = 0x13, + REPLY_RXON_TIMING = 0x14, + + /* Multi-Station support */ + REPLY_ADD_STA = 0x18, + REPLY_REMOVE_STA = 0x19, /* not used */ + REPLY_REMOVE_ALL_STA = 0x1a, /* not used */ + + /* RX, TX, LEDs */ + REPLY_3945_RX = 0x1b, /* 3945 only */ + REPLY_TX = 0x1c, + REPLY_RATE_SCALE = 0x47, /* 3945 only */ + REPLY_LEDS_CMD = 0x48, + REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */ + + /* 802.11h related */ + RADAR_NOTIFICATION = 0x70, /* not used */ + REPLY_QUIET_CMD = 0x71, /* not used */ + REPLY_CHANNEL_SWITCH = 0x72, + CHANNEL_SWITCH_NOTIFICATION = 0x73, + REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, + SPECTRUM_MEASURE_NOTIFICATION = 0x75, + + /* Power Management */ + POWER_TABLE_CMD = 0x77, + PM_SLEEP_NOTIFICATION = 0x7A, + PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, + + /* Scan commands and notifications */ + REPLY_SCAN_CMD = 0x80, + REPLY_SCAN_ABORT_CMD = 0x81, + SCAN_START_NOTIFICATION = 0x82, + SCAN_RESULTS_NOTIFICATION = 0x83, + SCAN_COMPLETE_NOTIFICATION = 0x84, + + /* IBSS/AP commands */ + BEACON_NOTIFICATION = 0x90, + REPLY_TX_BEACON = 0x91, + WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */ + + /* Miscellaneous commands */ + QUIET_NOTIFICATION = 0x96, /* not used */ + REPLY_TX_PWR_TABLE_CMD = 0x97, + MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ + + /* BT config command */ + REPLY_BT_CONFIG = 0x9b, + + /* 4965 Statistics */ + REPLY_STATISTICS_CMD = 0x9c, + STATISTICS_NOTIFICATION = 0x9d, + + /* RF-KILL commands and notifications */ + REPLY_CARD_STATE_CMD = 0xa0, + CARD_STATE_NOTIFICATION = 0xa1, + + /* Missed beacons notification */ + MISSED_BEACONS_NOTIFICATION = 0xa2, + + REPLY_MAX = 0xff +}; + +/****************************************************************************** + * (0) + * Header + * + *****************************************************************************/ + +#define IWL_CMD_FAILED_MSK 0x40 + +struct iwl_cmd_header { + u8 cmd; + u8 flags; + /* We have 15 LSB to use as we please (MSB indicates + * a frame Rx'd from the HW). We encode the following + * information into the sequence field: + * + * 0:7 index in fifo + * 8:13 fifo selection + * 14:14 bit indicating if this packet references the 'extra' + * storage at the end of the memory queue + * 15:15 (Rx indication) + * + */ + __le16 sequence; + + /* command data follows immediately */ + u8 data[0]; +} __attribute__ ((packed)); + +/****************************************************************************** + * (0a) + * Alive and Error Commands & Responses: + * + *****************************************************************************/ + +#define UCODE_VALID_OK __constant_cpu_to_le32(0x1) +#define INITIALIZE_SUBTYPE (9) + +/* + * REPLY_ALIVE = 0x1 (response only, not a command) + */ +struct iwl_alive_resp { + u8 ucode_minor; + u8 ucode_major; + __le16 reserved1; + u8 sw_rev[8]; + u8 ver_type; + u8 ver_subtype; + __le16 reserved2; + __le32 log_event_table_ptr; + __le32 error_event_table_ptr; + __le32 timestamp; + __le32 is_valid; +} __attribute__ ((packed)); + +struct iwl_init_alive_resp { + u8 ucode_minor; + u8 ucode_major; + __le16 reserved1; + u8 sw_rev[8]; + u8 ver_type; + u8 ver_subtype; + __le16 reserved2; + __le32 log_event_table_ptr; + __le32 error_event_table_ptr; + __le32 timestamp; + __le32 is_valid; +} __attribute__ ((packed)); + +union tsf { + u8 byte[8]; + __le16 word[4]; + __le32 dw[2]; +}; + +/* + * REPLY_ERROR = 0x2 (response only, not a command) + */ +struct iwl_error_resp { + __le32 error_type; + u8 cmd_id; + u8 reserved1; + __le16 bad_cmd_seq_num; + __le16 reserved2; + __le32 error_info; + union tsf timestamp; +} __attribute__ ((packed)); + +/****************************************************************************** + * (1) + * RXON Commands & Responses: + * + *****************************************************************************/ + +/* + * Rx config defines & structure + */ +/* rx_config device types */ +enum { + RXON_DEV_TYPE_AP = 1, + RXON_DEV_TYPE_ESS = 3, + RXON_DEV_TYPE_IBSS = 4, + RXON_DEV_TYPE_SNIFFER = 6, +}; + +/* rx_config flags */ +/* band & modulation selection */ +#define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0) +#define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1) +/* auto detection enable */ +#define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2) +/* TGg protection when tx */ +#define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3) +/* cck short slot & preamble */ +#define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4) +#define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5) +/* antenna selection */ +#define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7) +#define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00) +#define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) +#define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) +/* radar detection enable */ +#define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12) +#define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13) +/* rx response to host with 8-byte TSF +* (according to ON_AIR deassertion) */ +#define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15) + +/* rx_config filter flags */ +/* accept all data frames */ +#define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0) +/* pass control & management to host */ +#define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1) +/* accept multi-cast */ +#define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2) +/* don't decrypt uni-cast frames */ +#define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3) +/* don't decrypt multi-cast frames */ +#define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4) +/* STA is associated */ +#define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5) +/* transfer to host non bssid beacons in associated state */ +#define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6) + +/* + * REPLY_RXON = 0x10 (command, has simple generic response) + */ +struct iwl_rxon_cmd { + u8 node_addr[6]; + __le16 reserved1; + u8 bssid_addr[6]; + __le16 reserved2; + u8 wlap_bssid_addr[6]; + __le16 reserved3; + u8 dev_type; + u8 air_propagation; + __le16 reserved4; + u8 ofdm_basic_rates; + u8 cck_basic_rates; + __le16 assoc_id; + __le32 flags; + __le32 filter_flags; + __le16 channel; + __le16 reserved5; +} __attribute__ ((packed)); + +/* + * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) + */ +struct iwl_rxon_assoc_cmd { + __le32 flags; + __le32 filter_flags; + u8 ofdm_basic_rates; + u8 cck_basic_rates; + __le16 reserved; +} __attribute__ ((packed)); + +/* + * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) + */ +struct iwl_rxon_time_cmd { + union tsf timestamp; + __le16 beacon_interval; + __le16 atim_window; + __le32 beacon_init_val; + __le16 listen_interval; + __le16 reserved; +} __attribute__ ((packed)); + +struct iwl_tx_power { + u8 tx_gain; /* gain for analog radio */ + u8 dsp_atten; /* gain for DSP */ +} __attribute__ ((packed)); + +struct iwl_power_per_rate { + u8 rate; /* plcp */ + struct iwl_tx_power tpc; + u8 reserved; +} __attribute__ ((packed)); + +/* + * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) + */ +struct iwl_channel_switch_cmd { + u8 band; + u8 expect_beacon; + __le16 channel; + __le32 rxon_flags; + __le32 rxon_filter_flags; + __le32 switch_time; + struct iwl_power_per_rate power[IWL_MAX_RATES]; +} __attribute__ ((packed)); + +/* + * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) + */ +struct iwl_csa_notification { + __le16 band; + __le16 channel; + __le32 status; /* 0 - OK, 1 - fail */ +} __attribute__ ((packed)); + +/****************************************************************************** + * (2) + * Quality-of-Service (QOS) Commands & Responses: + * + *****************************************************************************/ +struct iwl_ac_qos { + __le16 cw_min; + __le16 cw_max; + u8 aifsn; + u8 reserved1; + __le16 edca_txop; +} __attribute__ ((packed)); + +/* QoS flags defines */ +#define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01) +#define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02) +#define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10) + +/* + * TXFIFO Queue number defines + */ +/* number of Access categories (AC) (EDCA), queues 0..3 */ +#define AC_NUM 4 + +/* + * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) + */ +struct iwl_qosparam_cmd { + __le32 qos_flags; + struct iwl_ac_qos ac[AC_NUM]; +} __attribute__ ((packed)); + +/****************************************************************************** + * (3) + * Add/Modify Stations Commands & Responses: + * + *****************************************************************************/ +/* + * Multi station support + */ +#define IWL_AP_ID 0 +#define IWL_MULTICAST_ID 1 +#define IWL_STA_ID 2 + +#define IWL3945_BROADCAST_ID 24 +#define IWL3945_STATION_COUNT 25 + +#define IWL4965_BROADCAST_ID 31 +#define IWL4965_STATION_COUNT 32 + +#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ +#define IWL_INVALID_STATION 255 + +#define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2); +#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8); + +#define STA_CONTROL_MODIFY_MSK 0x01 + +/* key flags __le16*/ +#define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7) +#define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0) +#define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1) +#define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2) +#define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3) + +#define STA_KEY_FLG_KEYID_POS 8 +#define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800) + +/* modify flags */ +#define STA_MODIFY_KEY_MASK 0x01 +#define STA_MODIFY_TID_DISABLE_TX 0x02 +#define STA_MODIFY_TX_RATE_MSK 0x04 +#define STA_MODIFY_ADDBA_TID_MSK 0x08 +#define STA_MODIFY_DELBA_TID_MSK 0x10 +#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) + +/* + * Antenna masks: + * bit14:15 01 B inactive, A active + * 10 B active, A inactive + * 11 Both active + */ +#define RATE_MCS_ANT_A_POS 14 +#define RATE_MCS_ANT_B_POS 15 +#define RATE_MCS_ANT_A_MSK 0x4000 +#define RATE_MCS_ANT_B_MSK 0x8000 +#define RATE_MCS_ANT_AB_MSK 0xc000 + +struct iwl_keyinfo { + __le16 key_flags; + u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ + u8 reserved1; + __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ + __le16 reserved2; + u8 key[16]; /* 16-byte unicast decryption key */ +} __attribute__ ((packed)); + +struct sta_id_modify { + u8 addr[ETH_ALEN]; + __le16 reserved1; + u8 sta_id; + u8 modify_mask; + __le16 reserved2; +} __attribute__ ((packed)); + +/* + * REPLY_ADD_STA = 0x18 (command) + */ +struct iwl_addsta_cmd { + u8 mode; + u8 reserved[3]; + struct sta_id_modify sta; + struct iwl_keyinfo key; + __le32 station_flags; + __le32 station_flags_msk; + __le16 tid_disable_tx; + __le16 rate_n_flags; + u8 add_immediate_ba_tid; + u8 remove_immediate_ba_tid; + __le16 add_immediate_ba_ssn; +} __attribute__ ((packed)); + +/* + * REPLY_ADD_STA = 0x18 (response) + */ +struct iwl_add_sta_resp { + u8 status; +} __attribute__ ((packed)); + +#define ADD_STA_SUCCESS_MSK 0x1 + +/****************************************************************************** + * (4) + * Rx Responses: + * + *****************************************************************************/ + +struct iwl_rx_frame_stats { + u8 phy_count; + u8 id; + u8 rssi; + u8 agc; + __le16 sig_avg; + __le16 noise_diff; + u8 payload[0]; +} __attribute__ ((packed)); + +struct iwl_rx_frame_hdr { + __le16 channel; + __le16 phy_flags; + u8 reserved1; + u8 rate; + __le16 len; + u8 payload[0]; +} __attribute__ ((packed)); + +#define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) +#define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) + +#define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) +#define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) +#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) +#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) +#define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) + +#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) +#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) +#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) +#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) +#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) + +#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) +#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) +#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) +#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) +#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) + +struct iwl_rx_frame_end { + __le32 status; + __le64 timestamp; + __le32 beacon_timestamp; +} __attribute__ ((packed)); + +/* + * REPLY_3945_RX = 0x1b (response only, not a command) + * + * NOTE: DO NOT dereference from casts to this structure + * It is provided only for calculating minimum data set size. + * The actual offsets of the hdr and end are dynamic based on + * stats.phy_count + */ +struct iwl_rx_frame { + struct iwl_rx_frame_stats stats; + struct iwl_rx_frame_hdr hdr; + struct iwl_rx_frame_end end; +} __attribute__ ((packed)); + +/* Fixed (non-configurable) rx data from phy */ +#define RX_PHY_FLAGS_ANTENNAE_OFFSET (4) +#define RX_PHY_FLAGS_ANTENNAE_MASK (0x70) +#define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ +#define IWL_AGC_DB_POS (7) +struct iwl4965_rx_non_cfg_phy { + __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ + __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ + u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ + u8 pad[0]; +} __attribute__ ((packed)); + +/* + * REPLY_4965_RX = 0xc3 (response only, not a command) + * Used only for legacy (non 11n) frames. + */ +#define RX_RES_PHY_CNT 14 +struct iwl4965_rx_phy_res { + u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ + u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ + u8 stat_id; /* configurable DSP phy data set ID */ + u8 reserved1; + __le64 timestamp; /* TSF at on air rise */ + __le32 beacon_time_stamp; /* beacon at on-air rise */ + __le16 phy_flags; /* general phy flags: band, modulation, ... */ + __le16 channel; /* channel number */ + __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ + __le32 reserved2; + __le32 rate_n_flags; + __le16 byte_count; /* frame's byte-count */ + __le16 reserved3; +} __attribute__ ((packed)); + +struct iwl4965_rx_mpdu_res_start { + __le16 byte_count; + __le16 reserved; +} __attribute__ ((packed)); + + +/****************************************************************************** + * (5) + * Tx Commands & Responses: + * + *****************************************************************************/ + +/* Tx flags */ +#define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1) +#define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2) +#define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3) +#define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4) +#define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6) +#define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7) +#define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00) +#define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) +#define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) + +/* ucode ignores BT priority for this frame */ +#define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12) + +/* ucode overrides sequence control */ +#define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13) + +/* signal that this frame is non-last MPDU */ +#define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14) + +/* calculate TSF in outgoing frame */ +#define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16) + +/* activate TX calibration. */ +#define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17) + +/* signals that 2 bytes pad was inserted + after the MAC header */ +#define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20) + +/* HCCA-AP - disable duration overwriting. */ +#define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25) + +/* + * TX command security control + */ +#define TX_CMD_SEC_WEP 0x01 +#define TX_CMD_SEC_CCM 0x02 +#define TX_CMD_SEC_TKIP 0x03 +#define TX_CMD_SEC_MSK 0x03 +#define TX_CMD_SEC_SHIFT 6 +#define TX_CMD_SEC_KEY128 0x08 + +/* + * TX command Frame life time + */ + +struct iwl_dram_scratch { + u8 try_cnt; + u8 bt_kill_cnt; + __le16 reserved; +} __attribute__ ((packed)); + +/* + * REPLY_TX = 0x1c (command) + */ +struct iwl_tx_cmd { + __le16 len; + __le16 next_frame_len; + __le32 tx_flags; + u8 rate; + u8 sta_id; + u8 tid_tspec; + u8 sec_ctl; + u8 key[16]; + union { + u8 byte[8]; + __le16 word[4]; + __le32 dw[2]; + } tkip_mic; + __le32 next_frame_info; + union { + __le32 life_time; + __le32 attempt; + } stop_time; + u8 supp_rates[2]; + u8 rts_retry_limit; /*byte 50 */ + u8 data_retry_limit; /*byte 51 */ + union { + __le16 pm_frame_timeout; + __le16 attempt_duration; + } timeout; + __le16 driver_txop; + u8 payload[0]; + struct ieee80211_hdr hdr[0]; +} __attribute__ ((packed)); + +/* TX command response is sent after *all* transmission attempts. + * + * NOTES: + * + * TX_STATUS_FAIL_NEXT_FRAG + * + * If the fragment flag in the MAC header for the frame being transmitted + * is set and there is insufficient time to transmit the next frame, the + * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. + * + * TX_STATUS_FIFO_UNDERRUN + * + * Indicates the host did not provide bytes to the FIFO fast enough while + * a TX was in progress. + * + * TX_STATUS_FAIL_MGMNT_ABORT + * + * This status is only possible if the ABORT ON MGMT RX parameter was + * set to true with the TX command. + * + * If the MSB of the status parameter is set then an abort sequence is + * required. This sequence consists of the host activating the TX Abort + * control line, and then waiting for the TX Abort command response. This + * indicates that a the device is no longer in a transmit state, and that the + * command FIFO has been cleared. The host must then deactivate the TX Abort + * control line. Receiving is still allowed in this case. + */ +enum { + TX_STATUS_SUCCESS = 0x01, + TX_STATUS_DIRECT_DONE = 0x02, + TX_STATUS_FAIL_SHORT_LIMIT = 0x82, + TX_STATUS_FAIL_LONG_LIMIT = 0x83, + TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, + TX_STATUS_FAIL_MGMNT_ABORT = 0x85, + TX_STATUS_FAIL_NEXT_FRAG = 0x86, + TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, + TX_STATUS_FAIL_DEST_PS = 0x88, + TX_STATUS_FAIL_ABORTED = 0x89, + TX_STATUS_FAIL_BT_RETRY = 0x8a, + TX_STATUS_FAIL_STA_INVALID = 0x8b, + TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, + TX_STATUS_FAIL_TID_DISABLE = 0x8d, + TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e, + TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, + TX_STATUS_FAIL_TX_LOCKED = 0x90, + TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, +}; + +#define TX_PACKET_MODE_REGULAR 0x0000 +#define TX_PACKET_MODE_BURST_SEQ 0x0100 +#define TX_PACKET_MODE_BURST_FIRST 0x0200 + +enum { + TX_POWER_PA_NOT_ACTIVE = 0x0, +}; + +enum { + TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ + TX_STATUS_DELAY_MSK = 0x00000040, + TX_STATUS_ABORT_MSK = 0x00000080, + TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ + TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ + TX_RESERVED = 0x00780000, /* bits 19:22 */ + TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ + TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ +}; + +/* ******************************* + * TX aggregation state + ******************************* */ + +enum { + AGG_TX_STATE_TRANSMITTED = 0x00, + AGG_TX_STATE_UNDERRUN_MSK = 0x01, + AGG_TX_STATE_BT_PRIO_MSK = 0x02, + AGG_TX_STATE_FEW_BYTES_MSK = 0x04, + AGG_TX_STATE_ABORT_MSK = 0x08, + AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, + AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, + AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, + AGG_TX_STATE_SCD_QUERY_MSK = 0x80, + AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, + AGG_TX_STATE_RESPONSE_MSK = 0x1ff, + AGG_TX_STATE_DUMP_TX_MSK = 0x200, + AGG_TX_STATE_DELAY_TX_MSK = 0x400 +}; + +#define AGG_TX_STATE_LAST_SENT_MSK \ +(AGG_TX_STATE_LAST_SENT_TTL_MSK | \ + AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ + AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) + +#define AGG_TX_STATE_TRY_CNT_POS 12 +#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 + +#define AGG_TX_STATE_SEQ_NUM_POS 16 +#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 + +/* + * REPLY_TX = 0x1c (response) + */ +struct iwl_tx_resp { + u8 failure_rts; + u8 failure_frame; + u8 bt_kill_count; + u8 rate; + __le32 wireless_media_time; + __le32 status; /* TX status (for aggregation status of 1st frame) */ +} __attribute__ ((packed)); + +/* + * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) + */ +struct iwl_compressed_ba_resp { + __le32 sta_addr_lo32; + __le16 sta_addr_hi16; + __le16 reserved; + u8 sta_id; + u8 tid; + __le16 ba_seq_ctl; + __le32 ba_bitmap0; + __le32 ba_bitmap1; + __le16 scd_flow; + __le16 scd_ssn; +} __attribute__ ((packed)); + +/* + * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) + */ +struct iwl_txpowertable_cmd { + u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ + u8 reserved; + __le16 channel; + struct iwl_power_per_rate power[IWL_MAX_RATES]; +} __attribute__ ((packed)); + +struct iwl_rate_scaling_info { + __le16 rate_n_flags; + u8 try_cnt; + u8 next_rate_index; +} __attribute__ ((packed)); + +/** + * struct iwl_rate_scaling_cmd - Rate Scaling Command & Response + * + * REPLY_RATE_SCALE = 0x47 (command, has simple generic response) + * + * NOTE: The table of rates passed to the uCode via the + * RATE_SCALE command sets up the corresponding order of + * rates used for all related commands, including rate + * masks, etc. + * + * For example, if you set 9MB (PLCP 0x0f) as the first + * rate in the rate table, the bit mask for that rate + * when passed through ofdm_basic_rates on the REPLY_RXON + * command would be bit 0 (1<<0) + */ +struct iwl_rate_scaling_cmd { + u8 table_id; + u8 reserved[3]; + struct iwl_rate_scaling_info table[IWL_MAX_RATES]; +} __attribute__ ((packed)); + +/* + * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) + */ +struct iwl_bt_cmd { + u8 flags; + u8 lead_time; + u8 max_kill; + u8 reserved; + __le32 kill_ack_mask; + __le32 kill_cts_mask; +} __attribute__ ((packed)); + +/****************************************************************************** + * (6) + * Spectrum Management (802.11h) Commands, Responses, Notifications: + * + *****************************************************************************/ + +/* + * Spectrum Management + */ +#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ + RXON_FILTER_CTL2HOST_MSK | \ + RXON_FILTER_ACCEPT_GRP_MSK | \ + RXON_FILTER_DIS_DECRYPT_MSK | \ + RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ + RXON_FILTER_ASSOC_MSK | \ + RXON_FILTER_BCON_AWARE_MSK) + +struct iwl_measure_channel { + __le32 duration; /* measurement duration in extended beacon + * format */ + u8 channel; /* channel to measure */ + u8 type; /* see enum iwl_measure_type */ + __le16 reserved; +} __attribute__ ((packed)); + +/* + * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) + */ +struct iwl_spectrum_cmd { + __le16 len; /* number of bytes starting from token */ + u8 token; /* token id */ + u8 id; /* measurement id -- 0 or 1 */ + u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ + u8 periodic; /* 1 = periodic */ + __le16 path_loss_timeout; + __le32 start_time; /* start time in extended beacon format */ + __le32 reserved2; + __le32 flags; /* rxon flags */ + __le32 filter_flags; /* rxon filter flags */ + __le16 channel_count; /* minimum 1, maximum 10 */ + __le16 reserved3; + struct iwl_measure_channel channels[10]; +} __attribute__ ((packed)); + +/* + * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) + */ +struct iwl_spectrum_resp { + u8 token; + u8 id; /* id of the prior command replaced, or 0xff */ + __le16 status; /* 0 - command will be handled + * 1 - cannot handle (conflicts with another + * measurement) */ +} __attribute__ ((packed)); + +enum iwl_measurement_state { + IWL_MEASUREMENT_START = 0, + IWL_MEASUREMENT_STOP = 1, +}; + +enum iwl_measurement_status { + IWL_MEASUREMENT_OK = 0, + IWL_MEASUREMENT_CONCURRENT = 1, + IWL_MEASUREMENT_CSA_CONFLICT = 2, + IWL_MEASUREMENT_TGH_CONFLICT = 3, + /* 4-5 reserved */ + IWL_MEASUREMENT_STOPPED = 6, + IWL_MEASUREMENT_TIMEOUT = 7, + IWL_MEASUREMENT_PERIODIC_FAILED = 8, +}; + +#define NUM_ELEMENTS_IN_HISTOGRAM 8 + +struct iwl_measurement_histogram { + __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ + __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ +} __attribute__ ((packed)); + +/* clear channel availability counters */ +struct iwl_measurement_cca_counters { + __le32 ofdm; + __le32 cck; +} __attribute__ ((packed)); + +enum iwl_measure_type { + IWL_MEASURE_BASIC = (1 << 0), + IWL_MEASURE_CHANNEL_LOAD = (1 << 1), + IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), + IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), + IWL_MEASURE_FRAME = (1 << 4), + /* bits 5:6 are reserved */ + IWL_MEASURE_IDLE = (1 << 7), +}; + +/* + * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) + */ +struct iwl_spectrum_notification { + u8 id; /* measurement id -- 0 or 1 */ + u8 token; + u8 channel_index; /* index in measurement channel list */ + u8 state; /* 0 - start, 1 - stop */ + __le32 start_time; /* lower 32-bits of TSF */ + u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ + u8 channel; + u8 type; /* see enum iwl_measurement_type */ + u8 reserved1; + /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only + * valid if applicable for measurement type requested. */ + __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ + __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ + __le32 cca_time; /* channel load time in usecs */ + u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - + * unidentified */ + u8 reserved2[3]; + struct iwl_measurement_histogram histogram; + __le32 stop_time; /* lower 32-bits of TSF */ + __le32 status; /* see iwl_measurement_status */ +} __attribute__ ((packed)); + +/****************************************************************************** + * (7) + * Power Management Commands, Responses, Notifications: + * + *****************************************************************************/ + +/** + * struct iwl_powertable_cmd - Power Table Command + * @flags: See below: + * + * POWER_TABLE_CMD = 0x77 (command, has simple generic response) + * + * PM allow: + * bit 0 - '0' Driver not allow power management + * '1' Driver allow PM (use rest of parameters) + * uCode send sleep notifications: + * bit 1 - '0' Don't send sleep notification + * '1' send sleep notification (SEND_PM_NOTIFICATION) + * Sleep over DTIM + * bit 2 - '0' PM have to walk up every DTIM + * '1' PM could sleep over DTIM till listen Interval. + * PCI power managed + * bit 3 - '0' (PCI_LINK_CTRL & 0x1) + * '1' !(PCI_LINK_CTRL & 0x1) + * Force sleep Modes + * bit 31/30- '00' use both mac/xtal sleeps + * '01' force Mac sleep + * '10' force xtal sleep + * '11' Illegal set + * + * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then + * ucode assume sleep over DTIM is allowed and we don't need to wakeup + * for every DTIM. + */ +#define IWL_POWER_VEC_SIZE 5 + +#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0) +#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2) +#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3) +struct iwl_powertable_cmd { + __le32 flags; + __le32 rx_data_timeout; + __le32 tx_data_timeout; + __le32 sleep_interval[IWL_POWER_VEC_SIZE]; +} __attribute__((packed)); + +/* + * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) + * 3945 and 4965 identical. + */ +struct iwl_sleep_notification { + u8 pm_sleep_mode; + u8 pm_wakeup_src; + __le16 reserved; + __le32 sleep_time; + __le32 tsf_low; + __le32 bcon_timer; +} __attribute__ ((packed)); + +/* Sleep states. 3945 and 4965 identical. */ +enum { + IWL_PM_NO_SLEEP = 0, + IWL_PM_SLP_MAC = 1, + IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, + IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, + IWL_PM_SLP_PHY = 4, + IWL_PM_SLP_REPENT = 5, + IWL_PM_WAKEUP_BY_TIMER = 6, + IWL_PM_WAKEUP_BY_DRIVER = 7, + IWL_PM_WAKEUP_BY_RFKILL = 8, + /* 3 reserved */ + IWL_PM_NUM_OF_MODES = 12, +}; + +/* + * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) + */ +#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ +#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ +#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ +struct iwl_card_state_cmd { + __le32 status; /* CARD_STATE_CMD_* request new power state */ +} __attribute__ ((packed)); + +/* + * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) + */ +struct iwl_card_state_notif { + __le32 flags; +} __attribute__ ((packed)); + +#define HW_CARD_DISABLED 0x01 +#define SW_CARD_DISABLED 0x02 +#define RF_CARD_DISABLED 0x04 +#define RXON_CARD_DISABLED 0x10 + +struct iwl_ct_kill_config { + __le32 reserved; + __le32 critical_temperature_M; + __le32 critical_temperature_R; +} __attribute__ ((packed)); + +/****************************************************************************** + * (8) + * Scan Commands, Responses, Notifications: + * + *****************************************************************************/ + +struct iwl_scan_channel { + /* type is defined as: + * 0:0 active (0 - passive) + * 1:4 SSID direct + * If 1 is set then corresponding SSID IE is transmitted in probe + * 5:7 reserved + */ + u8 type; + u8 channel; + struct iwl_tx_power tpc; + __le16 active_dwell; + __le16 passive_dwell; +} __attribute__ ((packed)); + +struct iwl_ssid_ie { + u8 id; + u8 len; + u8 ssid[32]; +} __attribute__ ((packed)); + +#define PROBE_OPTION_MAX 0x4 +#define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF) +#define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1) +#define IWL_MAX_SCAN_SIZE 1024 + +/* + * REPLY_SCAN_CMD = 0x80 (command) + */ +struct iwl_scan_cmd { + __le16 len; + u8 reserved0; + u8 channel_count; + __le16 quiet_time; /* dwell only this long on quiet chnl + * (active scan) */ + __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ + __le16 good_CRC_th; /* passive -> active promotion threshold */ + __le16 reserved1; + __le32 max_out_time; /* max usec to be out of associated (service) + * chnl */ + __le32 suspend_time; /* pause scan this long when returning to svc + * chnl. + * 3945 -- 31:24 # beacons, 19:0 additional usec, + * 4965 -- 31:22 # beacons, 21:0 additional usec. + */ + __le32 flags; + __le32 filter_flags; + + struct iwl_tx_cmd tx_cmd; + struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; + + u8 data[0]; + /* + * The channels start after the probe request payload and are of type: + * + * struct iwl_scan_channel channels[0]; + * + * NOTE: Only one band of channels can be scanned per pass. You + * can not mix 2.4GHz channels and 5.2GHz channels and must + * request a scan multiple times (not concurrently) + * + */ +} __attribute__ ((packed)); + +/* Can abort will notify by complete notification with abort status. */ +#define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1) +/* complete notification statuses */ +#define ABORT_STATUS 0x2 + +/* + * REPLY_SCAN_CMD = 0x80 (response) + */ +struct iwl_scanreq_notification { + __le32 status; /* 1: okay, 2: cannot fulfill request */ +} __attribute__ ((packed)); + +/* + * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) + */ +struct iwl_scanstart_notification { + __le32 tsf_low; + __le32 tsf_high; + __le32 beacon_timer; + u8 channel; + u8 band; + u8 reserved[2]; + __le32 status; +} __attribute__ ((packed)); + +#define SCAN_OWNER_STATUS 0x1; +#define MEASURE_OWNER_STATUS 0x2; + +#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ +/* + * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) + */ +struct iwl_scanresults_notification { + u8 channel; + u8 band; + u8 reserved[2]; + __le32 tsf_low; + __le32 tsf_high; + __le32 statistics[NUMBER_OF_STATISTICS]; +} __attribute__ ((packed)); + +/* + * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) + */ +struct iwl_scancomplete_notification { + u8 scanned_channels; + u8 status; + u8 reserved; + u8 last_channel; + __le32 tsf_low; + __le32 tsf_high; +} __attribute__ ((packed)); + + +/****************************************************************************** + * (9) + * IBSS/AP Commands and Notifications: + * + *****************************************************************************/ + +/* + * BEACON_NOTIFICATION = 0x90 (notification only, not a command) + */ +struct iwl_beacon_notif { + struct iwl_tx_resp beacon_notify_hdr; + __le32 low_tsf; + __le32 high_tsf; + __le32 ibss_mgr_status; +} __attribute__ ((packed)); + +/* + * REPLY_TX_BEACON = 0x91 (command, has simple generic response) + */ +struct iwl_tx_beacon_cmd { + struct iwl_tx_cmd tx; + __le16 tim_idx; + u8 tim_size; + u8 reserved1; + struct ieee80211_hdr frame[0]; /* beacon frame */ +} __attribute__ ((packed)); + +/****************************************************************************** + * (10) + * Statistics Commands and Notifications: + * + *****************************************************************************/ + +#define IWL_TEMP_CONVERT 260 + +#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 +#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 +#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 + +/* Used for passing to driver number of successes and failures per rate */ +struct rate_histogram { + union { + __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; + __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; + __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; + } success; + union { + __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; + __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; + __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; + } failed; +} __attribute__ ((packed)); + +/* statistics command response */ + +struct statistics_rx_phy { + __le32 ina_cnt; + __le32 fina_cnt; + __le32 plcp_err; + __le32 crc32_err; + __le32 overrun_err; + __le32 early_overrun_err; + __le32 crc32_good; + __le32 false_alarm_cnt; + __le32 fina_sync_err_cnt; + __le32 sfd_timeout; + __le32 fina_timeout; + __le32 unresponded_rts; + __le32 rxe_frame_limit_overrun; + __le32 sent_ack_cnt; + __le32 sent_cts_cnt; +} __attribute__ ((packed)); + +struct statistics_rx_non_phy { + __le32 bogus_cts; /* CTS received when not expecting CTS */ + __le32 bogus_ack; /* ACK received when not expecting ACK */ + __le32 non_bssid_frames; /* number of frames with BSSID that + * doesn't belong to the STA BSSID */ + __le32 filtered_frames; /* count frames that were dumped in the + * filtering process */ + __le32 non_channel_beacons; /* beacons with our bss id but not on + * our serving channel */ +} __attribute__ ((packed)); + +struct statistics_rx { + struct statistics_rx_phy ofdm; + struct statistics_rx_phy cck; + struct statistics_rx_non_phy general; +} __attribute__ ((packed)); + +struct statistics_tx { + __le32 preamble_cnt; + __le32 rx_detected_cnt; + __le32 bt_prio_defer_cnt; + __le32 bt_prio_kill_cnt; + __le32 few_bytes_cnt; + __le32 cts_timeout; + __le32 ack_timeout; + __le32 expected_ack_cnt; + __le32 actual_ack_cnt; +} __attribute__ ((packed)); + +struct statistics_dbg { + __le32 burst_check; + __le32 burst_count; + __le32 reserved[4]; +} __attribute__ ((packed)); + +struct statistics_div { + __le32 tx_on_a; + __le32 tx_on_b; + __le32 exec_time; + __le32 probe_time; +} __attribute__ ((packed)); + +struct statistics_general { + __le32 temperature; + struct statistics_dbg dbg; + __le32 sleep_time; + __le32 slots_out; + __le32 slots_idle; + __le32 ttl_timestamp; + struct statistics_div div; +} __attribute__ ((packed)); + +/* + * REPLY_STATISTICS_CMD = 0x9c, + * 3945 and 4965 identical. + * + * This command triggers an immediate response containing uCode statistics. + * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. + * + * If the CLEAR_STATS configuration flag is set, uCode will clear its + * internal copy of the statistics (counters) after issuing the response. + * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). + * + * If the DISABLE_NOTIF configuration flag is set, uCode will not issue + * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag + * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. + */ +#define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ +#define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ +struct iwl_statistics_cmd { + __le32 configuration_flags; /* IWL_STATS_CONF_* */ +} __attribute__ ((packed)); + +/* + * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) + * + * By default, uCode issues this notification after receiving a beacon + * while associated. To disable this behavior, set DISABLE_NOTIF flag in the + * REPLY_STATISTICS_CMD 0x9c, above. + * + * Statistics counters continue to increment beacon after beacon, but are + * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD + * 0x9c with CLEAR_STATS bit set (see above). + * + * uCode also issues this notification during scans. uCode clears statistics + * appropriately so that each notification contains statistics for only the + * one channel that has just been scanned. + */ +#define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) +#define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) +struct iwl_notif_statistics { + __le32 flag; + struct statistics_rx rx; + struct statistics_tx tx; + struct statistics_general general; +} __attribute__ ((packed)); + + +/* + * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) + */ +/* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row, + * then this notification will be sent. */ +#define CONSECUTIVE_MISSED_BCONS_TH 20 + +struct iwl_missed_beacon_notif { + __le32 consequtive_missed_beacons; + __le32 total_missed_becons; + __le32 num_expected_beacons; + __le32 num_recvd_beacons; +} __attribute__ ((packed)); + +/****************************************************************************** + * (11) + * Rx Calibration Commands: + * + *****************************************************************************/ + +#define PHY_CALIBRATE_DIFF_GAIN_CMD (7) +#define HD_TABLE_SIZE (11) + +struct iwl_sensitivity_cmd { + __le16 control; + __le16 table[HD_TABLE_SIZE]; +} __attribute__ ((packed)); + +struct iwl_calibration_cmd { + u8 opCode; + u8 flags; + __le16 reserved; + s8 diff_gain_a; + s8 diff_gain_b; + s8 diff_gain_c; + u8 reserved1; +} __attribute__ ((packed)); + +/****************************************************************************** + * (12) + * Miscellaneous Commands: + * + *****************************************************************************/ + +/* + * LEDs Command & Response + * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) + * + * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), + * this command turns it on or off, or sets up a periodic blinking cycle. + */ +struct iwl_led_cmd { + __le32 interval; /* "interval" in uSec */ + u8 id; /* 1: Activity, 2: Link, 3: Tech */ + u8 off; /* # intervals off while blinking; + * "0", with >0 "on" value, turns LED on */ + u8 on; /* # intervals on while blinking; + * "0", regardless of "off", turns LED off */ + u8 reserved; +} __attribute__ ((packed)); + +/****************************************************************************** + * (13) + * Union of all expected notifications/responses: + * + *****************************************************************************/ + +struct iwl_rx_packet { + __le32 len; + struct iwl_cmd_header hdr; + union { + struct iwl_alive_resp alive_frame; + struct iwl_rx_frame rx_frame; + struct iwl_tx_resp tx_resp; + struct iwl_spectrum_notification spectrum_notif; + struct iwl_csa_notification csa_notif; + struct iwl_error_resp err_resp; + struct iwl_card_state_notif card_state_notif; + struct iwl_beacon_notif beacon_status; + struct iwl_add_sta_resp add_sta; + struct iwl_sleep_notification sleep_notif; + struct iwl_spectrum_resp spectrum; + struct iwl_notif_statistics stats; + __le32 status; + u8 raw[0]; + } u; +} __attribute__ ((packed)); + +#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame)) + +#endif /* __iwl_3945_commands_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h new file mode 100644 index 00000000000..72318d78957 --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h @@ -0,0 +1,152 @@ +/****************************************************************************** + * + * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved. + * + * Portions of this file are derived from the ipw3945 project. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * The full GNU General Public License is included in this distribution in the + * file called LICENSE. + * + * Contact Information: + * James P. Ketrenos + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + *****************************************************************************/ + +#ifndef __iwl_debug_h__ +#define __iwl_debug_h__ + +#ifdef CONFIG_IWLWIFI_DEBUG +extern u32 iwl_debug_level; +#define IWL_DEBUG(level, fmt, args...) \ +do { if (iwl_debug_level & (level)) \ + printk(KERN_ERR DRV_NAME": %c %s " fmt, \ + in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) + +#define IWL_DEBUG_LIMIT(level, fmt, args...) \ +do { if ((iwl_debug_level & (level)) && net_ratelimit()) \ + printk(KERN_ERR DRV_NAME": %c %s " fmt, \ + in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) +#else +static inline void IWL_DEBUG(int level, const char *fmt, ...) +{ +} +static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) +{ +} +#endif /* CONFIG_IWLWIFI_DEBUG */ + +/* + * To use the debug system; + * + * If you are defining a new debug classification, simply add it to the #define + * list here in the form of: + * + * #define IWL_DL_xxxx VALUE + * + * shifting value to the left one bit from the previous entry. xxxx should be + * the name of the classification (for example, WEP) + * + * You then need to either add a IWL_xxxx_DEBUG() macro definition for your + * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want + * to send output to that classification. + * + * To add your debug level to the list of levels seen when you perform + * + * % cat /proc/net/iwl/debug_level + * + * you simply need to add your entry to the iwl_debug_levels array. + * + * If you do not see debug_level in /proc/net/iwl then you do not have + * CONFIG_IWLWIFI_DEBUG defined in your kernel configuration + * + */ + +#define IWL_DL_INFO (1<<0) +#define IWL_DL_MAC80211 (1<<1) +#define IWL_DL_HOST_COMMAND (1<<2) +#define IWL_DL_STATE (1<<3) + +#define IWL_DL_RADIO (1<<7) +#define IWL_DL_POWER (1<<8) +#define IWL_DL_TEMP (1<<9) + +#define IWL_DL_NOTIF (1<<10) +#define IWL_DL_SCAN (1<<11) +#define IWL_DL_ASSOC (1<<12) +#define IWL_DL_DROP (1<<13) + +#define IWL_DL_TXPOWER (1<<14) + +#define IWL_DL_AP (1<<15) + +#define IWL_DL_FW (1<<16) +#define IWL_DL_RF_KILL (1<<17) +#define IWL_DL_FW_ERRORS (1<<18) + +#define IWL_DL_LED (1<<19) + +#define IWL_DL_RATE (1<<20) + +#define IWL_DL_CALIB (1<<21) +#define IWL_DL_WEP (1<<22) +#define IWL_DL_TX (1<<23) +#define IWL_DL_RX (1<<24) +#define IWL_DL_ISR (1<<25) +#define IWL_DL_HT (1<<26) +#define IWL_DL_IO (1<<27) +#define IWL_DL_11H (1<<28) + +#define IWL_DL_STATS (1<<29) +#define IWL_DL_TX_REPLY (1<<30) +#define IWL_DL_QOS (1<<31) + +#define IWL_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) +#define IWL_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) +#define IWL_DEBUG_INFO(f, a...) IWL_DEBUG(IWL_DL_INFO, f, ## a) + +#define IWL_DEBUG_MAC80211(f, a...) IWL_DEBUG(IWL_DL_MAC80211, f, ## a) +#define IWL_DEBUG_TEMP(f, a...) IWL_DEBUG(IWL_DL_TEMP, f, ## a) +#define IWL_DEBUG_SCAN(f, a...) IWL_DEBUG(IWL_DL_SCAN, f, ## a) +#define IWL_DEBUG_RX(f, a...) IWL_DEBUG(IWL_DL_RX, f, ## a) +#define IWL_DEBUG_TX(f, a...) IWL_DEBUG(IWL_DL_TX, f, ## a) +#define IWL_DEBUG_ISR(f, a...) IWL_DEBUG(IWL_DL_ISR, f, ## a) +#define IWL_DEBUG_LED(f, a...) IWL_DEBUG(IWL_DL_LED, f, ## a) +#define IWL_DEBUG_WEP(f, a...) IWL_DEBUG(IWL_DL_WEP, f, ## a) +#define IWL_DEBUG_HC(f, a...) IWL_DEBUG(IWL_DL_HOST_COMMAND, f, ## a) +#define IWL_DEBUG_CALIB(f, a...) IWL_DEBUG(IWL_DL_CALIB, f, ## a) +#define IWL_DEBUG_FW(f, a...) IWL_DEBUG(IWL_DL_FW, f, ## a) +#define IWL_DEBUG_RF_KILL(f, a...) IWL_DEBUG(IWL_DL_RF_KILL, f, ## a) +#define IWL_DEBUG_DROP(f, a...) IWL_DEBUG(IWL_DL_DROP, f, ## a) +#define IWL_DEBUG_DROP_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_DROP, f, ## a) +#define IWL_DEBUG_AP(f, a...) IWL_DEBUG(IWL_DL_AP, f, ## a) +#define IWL_DEBUG_TXPOWER(f, a...) IWL_DEBUG(IWL_DL_TXPOWER, f, ## a) +#define IWL_DEBUG_IO(f, a...) IWL_DEBUG(IWL_DL_IO, f, ## a) +#define IWL_DEBUG_RATE(f, a...) IWL_DEBUG(IWL_DL_RATE, f, ## a) +#define IWL_DEBUG_RATE_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_RATE, f, ## a) +#define IWL_DEBUG_NOTIF(f, a...) IWL_DEBUG(IWL_DL_NOTIF, f, ## a) +#define IWL_DEBUG_ASSOC(f, a...) IWL_DEBUG(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) +#define IWL_DEBUG_ASSOC_LIMIT(f, a...) \ + IWL_DEBUG_LIMIT(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) +#define IWL_DEBUG_HT(f, a...) IWL_DEBUG(IWL_DL_HT, f, ## a) +#define IWL_DEBUG_STATS(f, a...) IWL_DEBUG(IWL_DL_STATS, f, ## a) +#define IWL_DEBUG_TX_REPLY(f, a...) IWL_DEBUG(IWL_DL_TX_REPLY, f, ## a) +#define IWL_DEBUG_QOS(f, a...) IWL_DEBUG(IWL_DL_QOS, f, ## a) +#define IWL_DEBUG_RADIO(f, a...) IWL_DEBUG(IWL_DL_RADIO, f, ## a) +#define IWL_DEBUG_POWER(f, a...) IWL_DEBUG(IWL_DL_POWER, f, ## a) +#define IWL_DEBUG_11H(f, a...) IWL_DEBUG(IWL_DL_11H, f, ## a) + +#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h index 90d4249fa7f..0a5a08d19f5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h @@ -64,6 +64,633 @@ #ifndef __iwl_3945_hw__ #define __iwl_3945_hw__ +/* uCode queue management definitions */ +#define IWL_CMD_QUEUE_NUM 4 +#define IWL_CMD_FIFO_NUM 4 +#define IWL_BACK_QUEUE_FIRST_ID 7 + +/* Tx rates */ +#define IWL_CCK_RATES 4 +#define IWL_OFDM_RATES 8 + +#define IWL_HT_RATES 0 + +#define IWL_MAX_RATES (IWL_CCK_RATES+IWL_OFDM_RATES+IWL_HT_RATES) + +/* Time constants */ +#define SHORT_SLOT_TIME 9 +#define LONG_SLOT_TIME 20 + +/* RSSI to dBm */ +#define IWL_RSSI_OFFSET 95 + +/* + * This file defines EEPROM related constants, enums, and inline functions. + * + */ + +#define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ +#define IWL_EEPROM_ACCESS_DELAY 10 /* uSec */ +/* EEPROM field values */ +#define ANTENNA_SWITCH_NORMAL 0 +#define ANTENNA_SWITCH_INVERSE 1 + +enum { + EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */ + EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */ + /* Bit 2 Reserved */ + EEPROM_CHANNEL_ACTIVE = (1 << 3), /* active scanning allowed */ + EEPROM_CHANNEL_RADAR = (1 << 4), /* radar detection required */ + EEPROM_CHANNEL_WIDE = (1 << 5), + EEPROM_CHANNEL_NARROW = (1 << 6), + EEPROM_CHANNEL_DFS = (1 << 7), /* dynamic freq selection candidate */ +}; + +/* EEPROM field lengths */ +#define EEPROM_BOARD_PBA_NUMBER_LENGTH 11 + +/* EEPROM field lengths */ +#define EEPROM_BOARD_PBA_NUMBER_LENGTH 11 +#define EEPROM_REGULATORY_SKU_ID_LENGTH 4 +#define EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH 14 +#define EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH 13 +#define EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH 12 +#define EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH 11 +#define EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH 6 + +#define EEPROM_REGULATORY_CHANNELS_LENGTH ( \ + EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH + \ + EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH + \ + EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH + \ + EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH + \ + EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH) + +#define EEPROM_REGULATORY_NUMBER_OF_BANDS 5 + +/* SKU Capabilities */ +#define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE (1 << 0) +#define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE (1 << 1) +#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7) + +/* *regulatory* channel data from eeprom, one for each channel */ +struct iwl_eeprom_channel { + u8 flags; /* flags copied from EEPROM */ + s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ +} __attribute__ ((packed)); + +/* + * Mapping of a Tx power level, at factory calibration temperature, + * to a radio/DSP gain table index. + * One for each of 5 "sample" power levels in each band. + * v_det is measured at the factory, using the 3945's built-in power amplifier + * (PA) output voltage detector. This same detector is used during Tx of + * long packets in normal operation to provide feedback as to proper output + * level. + * Data copied from EEPROM. + */ +struct iwl_eeprom_txpower_sample { + u8 gain_index; /* index into power (gain) setup table ... */ + s8 power; /* ... for this pwr level for this chnl group */ + u16 v_det; /* PA output voltage */ +} __attribute__ ((packed)); + +/* + * Mappings of Tx power levels -> nominal radio/DSP gain table indexes. + * One for each channel group (a.k.a. "band") (1 for BG, 4 for A). + * Tx power setup code interpolates between the 5 "sample" power levels + * to determine the nominal setup for a requested power level. + * Data copied from EEPROM. + * DO NOT ALTER THIS STRUCTURE!!! + */ +struct iwl_eeprom_txpower_group { + struct iwl_eeprom_txpower_sample samples[5]; /* 5 power levels */ + s32 a, b, c, d, e; /* coefficients for voltage->power + * formula (signed) */ + s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on + * frequency (signed) */ + s8 saturation_power; /* highest power possible by h/w in this + * band */ + u8 group_channel; /* "representative" channel # in this band */ + s16 temperature; /* h/w temperature at factory calib this band + * (signed) */ +} __attribute__ ((packed)); + +/* + * Temperature-based Tx-power compensation data, not band-specific. + * These coefficients are use to modify a/b/c/d/e coeffs based on + * difference between current temperature and factory calib temperature. + * Data copied from EEPROM. + */ +struct iwl_eeprom_temperature_corr { + u32 Ta; + u32 Tb; + u32 Tc; + u32 Td; + u32 Te; +} __attribute__ ((packed)); + +struct iwl_eeprom { + u8 reserved0[16]; +#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ + u16 device_id; /* abs.ofs: 16 */ + u8 reserved1[2]; +#define EEPROM_PMC (2*0x0A) /* 2 bytes */ + u16 pmc; /* abs.ofs: 20 */ + u8 reserved2[20]; +#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */ + u8 mac_address[6]; /* abs.ofs: 42 */ + u8 reserved3[58]; +#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */ + u16 board_revision; /* abs.ofs: 106 */ + u8 reserved4[11]; +#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */ + u8 board_pba_number[9]; /* abs.ofs: 119 */ + u8 reserved5[8]; +#define EEPROM_VERSION (2*0x44) /* 2 bytes */ + u16 version; /* abs.ofs: 136 */ +#define EEPROM_SKU_CAP (2*0x45) /* 1 bytes */ + u8 sku_cap; /* abs.ofs: 138 */ +#define EEPROM_LEDS_MODE (2*0x45+1) /* 1 bytes */ + u8 leds_mode; /* abs.ofs: 139 */ +#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ + u16 oem_mode; +#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */ + u16 wowlan_mode; /* abs.ofs: 142 */ +#define EEPROM_LEDS_TIME_INTERVAL (2*0x48) /* 2 bytes */ + u16 leds_time_interval; /* abs.ofs: 144 */ +#define EEPROM_LEDS_OFF_TIME (2*0x49) /* 1 bytes */ + u8 leds_off_time; /* abs.ofs: 146 */ +#define EEPROM_LEDS_ON_TIME (2*0x49+1) /* 1 bytes */ + u8 leds_on_time; /* abs.ofs: 147 */ +#define EEPROM_ALMGOR_M_VERSION (2*0x4A) /* 1 bytes */ + u8 almgor_m_version; /* abs.ofs: 148 */ +#define EEPROM_ANTENNA_SWITCH_TYPE (2*0x4A+1) /* 1 bytes */ + u8 antenna_switch_type; /* abs.ofs: 149 */ + u8 reserved6[42]; +#define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */ + u8 sku_id[4]; /* abs.ofs: 192 */ +#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */ + u16 band_1_count; /* abs.ofs: 196 */ +#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */ + struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */ +#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */ + u16 band_2_count; /* abs.ofs: 226 */ +#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */ + struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ +#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */ + u16 band_3_count; /* abs.ofs: 254 */ +#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */ + struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ +#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */ + u16 band_4_count; /* abs.ofs: 280 */ +#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */ + struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ +#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */ + u16 band_5_count; /* abs.ofs: 304 */ +#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */ + struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ + + u8 reserved9[194]; + +#define EEPROM_TXPOWER_CALIB_GROUP0 0x200 +#define EEPROM_TXPOWER_CALIB_GROUP1 0x240 +#define EEPROM_TXPOWER_CALIB_GROUP2 0x280 +#define EEPROM_TXPOWER_CALIB_GROUP3 0x2c0 +#define EEPROM_TXPOWER_CALIB_GROUP4 0x300 +#define IWL_NUM_TX_CALIB_GROUPS 5 + struct iwl_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS]; +/* abs.ofs: 512 */ +#define EEPROM_CALIB_TEMPERATURE_CORRECT 0x340 + struct iwl_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ + u8 reserved16[172]; /* fill out to full 1024 byte block */ +} __attribute__ ((packed)); + +#define IWL_EEPROM_IMAGE_SIZE 1024 + + +#include "iwl-3945-commands.h" + +#define PCI_LINK_CTRL 0x0F0 +#define PCI_POWER_SOURCE 0x0C8 +#define PCI_REG_WUM8 0x0E8 +#define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) + +/*=== CSR (control and status registers) ===*/ +#define CSR_BASE (0x000) + +#define CSR_SW_VER (CSR_BASE+0x000) +#define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */ +#define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */ +#define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */ +#define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */ +#define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/ +#define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */ +#define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/ +#define CSR_GP_CNTRL (CSR_BASE+0x024) +#define CSR_HW_REV (CSR_BASE+0x028) +#define CSR_EEPROM_REG (CSR_BASE+0x02c) +#define CSR_EEPROM_GP (CSR_BASE+0x030) +#define CSR_GP_UCODE (CSR_BASE+0x044) +#define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054) +#define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058) +#define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c) +#define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060) +#define CSR_LED_REG (CSR_BASE+0x094) +#define CSR_DRAM_INT_TBL_CTL (CSR_BASE+0x0A0) +#define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) +#define CSR_ANA_PLL_CFG (CSR_BASE+0x20c) +#define CSR_HW_REV_WA_REG (CSR_BASE+0x22C) + +/* HW I/F configuration */ +#define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB (0x00000100) +#define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM (0x00000200) +#define CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC (0x00000400) +#define CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE (0x00000800) +#define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000) +#define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000) +#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) + +/* interrupt flags in INTA, set by uCode or hardware (e.g. dma), + * acknowledged (reset) by host writing "1" to flagged bits. */ +#define CSR_INT_BIT_FH_RX (1<<31) /* Rx DMA, cmd responses, FH_INT[17:16] */ +#define CSR_INT_BIT_HW_ERR (1<<29) /* DMA hardware error FH_INT[31] */ +#define CSR_INT_BIT_DNLD (1<<28) /* uCode Download */ +#define CSR_INT_BIT_FH_TX (1<<27) /* Tx DMA FH_INT[1:0] */ +#define CSR_INT_BIT_MAC_CLK_ACTV (1<<26) /* NIC controller's clock toggled on/off */ +#define CSR_INT_BIT_SW_ERR (1<<25) /* uCode error */ +#define CSR_INT_BIT_RF_KILL (1<<7) /* HW RFKILL switch GP_CNTRL[27] toggled */ +#define CSR_INT_BIT_CT_KILL (1<<6) /* Critical temp (chip too hot) rfkill */ +#define CSR_INT_BIT_SW_RX (1<<3) /* Rx, command responses, 3945 */ +#define CSR_INT_BIT_WAKEUP (1<<1) /* NIC controller waking up (pwr mgmt) */ +#define CSR_INT_BIT_ALIVE (1<<0) /* uCode interrupts once it initializes */ + +#define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \ + CSR_INT_BIT_HW_ERR | \ + CSR_INT_BIT_FH_TX | \ + CSR_INT_BIT_SW_ERR | \ + CSR_INT_BIT_RF_KILL | \ + CSR_INT_BIT_SW_RX | \ + CSR_INT_BIT_WAKEUP | \ + CSR_INT_BIT_ALIVE) + +/* interrupt flags in FH (flow handler) (PCI busmaster DMA) */ +#define CSR_FH_INT_BIT_ERR (1<<31) /* Error */ +#define CSR_FH_INT_BIT_HI_PRIOR (1<<30) /* High priority Rx, bypass coalescing */ +#define CSR_FH_INT_BIT_RX_CHNL2 (1<<18) /* Rx channel 2 (3945 only) */ +#define CSR_FH_INT_BIT_RX_CHNL1 (1<<17) /* Rx channel 1 */ +#define CSR_FH_INT_BIT_RX_CHNL0 (1<<16) /* Rx channel 0 */ +#define CSR_FH_INT_BIT_TX_CHNL6 (1<<6) /* Tx channel 6 (3945 only) */ +#define CSR_FH_INT_BIT_TX_CHNL1 (1<<1) /* Tx channel 1 */ +#define CSR_FH_INT_BIT_TX_CHNL0 (1<<0) /* Tx channel 0 */ + +#define CSR_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \ + CSR_FH_INT_BIT_RX_CHNL2 | \ + CSR_FH_INT_BIT_RX_CHNL1 | \ + CSR_FH_INT_BIT_RX_CHNL0) + +#define CSR_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL6 | \ + CSR_FH_INT_BIT_TX_CHNL1 | \ + CSR_FH_INT_BIT_TX_CHNL0 ) + + +/* RESET */ +#define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001) +#define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002) +#define CSR_RESET_REG_FLAG_SW_RESET (0x00000080) +#define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100) +#define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200) + +/* GP (general purpose) CONTROL */ +#define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001) +#define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004) +#define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008) +#define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010) + +#define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001) + +#define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000) +#define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000) +#define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) + + +/* EEPROM REG */ +#define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001) +#define CSR_EEPROM_REG_BIT_CMD (0x00000002) + +/* EEPROM GP */ +#define CSR_EEPROM_GP_VALID_MSK (0x00000006) +#define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000) +#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180) + +/* UCODE DRV GP */ +#define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001) +#define CSR_UCODE_SW_BIT_RFKILL (0x00000002) +#define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004) +#define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008) + +/* GPIO */ +#define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200) +#define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000) +#define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC CSR_GPIO_IN_BIT_AUX_POWER + +/* GI Chicken Bits */ +#define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000) +#define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000) + +/* CSR_ANA_PLL_CFG */ +#define CSR_ANA_PLL_CFG_SH (0x00880300) + +#define CSR_LED_REG_TRUN_ON (0x00000078) +#define CSR_LED_REG_TRUN_OFF (0x00000038) +#define CSR_LED_BSM_CTRL_MSK (0xFFFFFFDF) + +/* DRAM_INT_TBL_CTRL */ +#define CSR_DRAM_INT_TBL_CTRL_EN (1<<31) +#define CSR_DRAM_INT_TBL_CTRL_WRAP_CHK (1<<27) + +/*=== HBUS (Host-side Bus) ===*/ +#define HBUS_BASE (0x400) + +#define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c) +#define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010) +#define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018) +#define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c) +#define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044) +#define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048) +#define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c) +#define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050) +#define HBUS_TARG_WRPTR (HBUS_BASE+0x060) + +#define HBUS_TARG_MBX_C (HBUS_BASE+0x030) + + +/* SCD (Scheduler) */ +#define SCD_BASE (CSR_BASE + 0x2E00) + +#define SCD_MODE_REG (SCD_BASE + 0x000) +#define SCD_ARASTAT_REG (SCD_BASE + 0x004) +#define SCD_TXFACT_REG (SCD_BASE + 0x010) +#define SCD_TXF4MF_REG (SCD_BASE + 0x014) +#define SCD_TXF5MF_REG (SCD_BASE + 0x020) +#define SCD_SBYP_MODE_1_REG (SCD_BASE + 0x02C) +#define SCD_SBYP_MODE_2_REG (SCD_BASE + 0x030) + +/*=== FH (data Flow Handler) ===*/ +#define FH_BASE (0x800) + +#define FH_CBCC_TABLE (FH_BASE+0x140) +#define FH_TFDB_TABLE (FH_BASE+0x180) +#define FH_RCSR_TABLE (FH_BASE+0x400) +#define FH_RSSR_TABLE (FH_BASE+0x4c0) +#define FH_TCSR_TABLE (FH_BASE+0x500) +#define FH_TSSR_TABLE (FH_BASE+0x680) + +/* TFDB (Transmit Frame Buffer Descriptor) */ +#define FH_TFDB(_channel, buf) \ + (FH_TFDB_TABLE+((_channel)*2+(buf))*0x28) +#define ALM_FH_TFDB_CHNL_BUF_CTRL_REG(_channel) \ + (FH_TFDB_TABLE + 0x50 * _channel) +/* CBCC _channel is [0,2] */ +#define FH_CBCC(_channel) (FH_CBCC_TABLE+(_channel)*0x8) +#define FH_CBCC_CTRL(_channel) (FH_CBCC(_channel)+0x00) +#define FH_CBCC_BASE(_channel) (FH_CBCC(_channel)+0x04) + +/* RCSR _channel is [0,2] */ +#define FH_RCSR(_channel) (FH_RCSR_TABLE+(_channel)*0x40) +#define FH_RCSR_CONFIG(_channel) (FH_RCSR(_channel)+0x00) +#define FH_RCSR_RBD_BASE(_channel) (FH_RCSR(_channel)+0x04) +#define FH_RCSR_WPTR(_channel) (FH_RCSR(_channel)+0x20) +#define FH_RCSR_RPTR_ADDR(_channel) (FH_RCSR(_channel)+0x24) + +#define FH_RSCSR_CHNL0_WPTR (FH_RCSR_WPTR(0)) + +/* RSSR */ +#define FH_RSSR_CTRL (FH_RSSR_TABLE+0x000) +#define FH_RSSR_STATUS (FH_RSSR_TABLE+0x004) +/* TCSR */ +#define FH_TCSR(_channel) (FH_TCSR_TABLE+(_channel)*0x20) +#define FH_TCSR_CONFIG(_channel) (FH_TCSR(_channel)+0x00) +#define FH_TCSR_CREDIT(_channel) (FH_TCSR(_channel)+0x04) +#define FH_TCSR_BUFF_STTS(_channel) (FH_TCSR(_channel)+0x08) +/* TSSR */ +#define FH_TSSR_CBB_BASE (FH_TSSR_TABLE+0x000) +#define FH_TSSR_MSG_CONFIG (FH_TSSR_TABLE+0x008) +#define FH_TSSR_TX_STATUS (FH_TSSR_TABLE+0x010) +/* 18 - reserved */ + +/* card static random access memory (SRAM) for processor data and instructs */ +#define RTC_INST_LOWER_BOUND (0x000000) +#define RTC_DATA_LOWER_BOUND (0x800000) + + +/* DBM */ + +#define ALM_FH_SRVC_CHNL (6) + +#define ALM_FH_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20) +#define ALM_FH_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4) + +#define ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000) + +#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000) + +#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000) + +#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000) + +#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000) + +#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000) + +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001) + +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) + +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) + +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) + +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) + +#define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000) + +#define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001) + +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000) +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000) + +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400) + +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100) +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080) + +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020) +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005) + +#define ALM_TB_MAX_BYTES_COUNT (0xFFF0) + +#define ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) \ + ((1LU << _channel) << 24) +#define ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel) \ + ((1LU << _channel) << 16) + +#define ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_channel) \ + (ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) | \ + ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel)) +#define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */ +#define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */ + +#define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004) + +#define TFD_QUEUE_MIN 0 +#define TFD_QUEUE_MAX 6 +#define TFD_QUEUE_SIZE_MAX (256) + +/* spectrum and channel data structures */ +#define IWL_NUM_SCAN_RATES (2) + +#define IWL_SCAN_FLAG_24GHZ (1<<0) +#define IWL_SCAN_FLAG_52GHZ (1<<1) +#define IWL_SCAN_FLAG_ACTIVE (1<<2) +#define IWL_SCAN_FLAG_DIRECT (1<<3) + +#define IWL_MAX_CMD_SIZE 1024 + +#define IWL_DEFAULT_TX_RETRY 15 +#define IWL_MAX_TX_RETRY 16 + +/*********************************************/ + +#define RFD_SIZE 4 +#define NUM_TFD_CHUNKS 4 + +#define RX_QUEUE_SIZE 256 +#define RX_QUEUE_MASK 255 +#define RX_QUEUE_SIZE_LOG 8 + +/* QoS definitions */ + +#define CW_MIN_OFDM 15 +#define CW_MAX_OFDM 1023 +#define CW_MIN_CCK 31 +#define CW_MAX_CCK 1023 + +#define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM +#define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM +#define QOS_TX2_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 2 - 1) +#define QOS_TX3_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 4 - 1) + +#define QOS_TX0_CW_MIN_CCK CW_MIN_CCK +#define QOS_TX1_CW_MIN_CCK CW_MIN_CCK +#define QOS_TX2_CW_MIN_CCK ((CW_MIN_CCK + 1) / 2 - 1) +#define QOS_TX3_CW_MIN_CCK ((CW_MIN_CCK + 1) / 4 - 1) + +#define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM +#define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM +#define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM +#define QOS_TX3_CW_MAX_OFDM ((CW_MIN_OFDM + 1) / 2 - 1) + +#define QOS_TX0_CW_MAX_CCK CW_MAX_CCK +#define QOS_TX1_CW_MAX_CCK CW_MAX_CCK +#define QOS_TX2_CW_MAX_CCK CW_MIN_CCK +#define QOS_TX3_CW_MAX_CCK ((CW_MIN_CCK + 1) / 2 - 1) + +#define QOS_TX0_AIFS 3 +#define QOS_TX1_AIFS 7 +#define QOS_TX2_AIFS 2 +#define QOS_TX3_AIFS 2 + +#define QOS_TX0_ACM 0 +#define QOS_TX1_ACM 0 +#define QOS_TX2_ACM 0 +#define QOS_TX3_ACM 0 + +#define QOS_TX0_TXOP_LIMIT_CCK 0 +#define QOS_TX1_TXOP_LIMIT_CCK 0 +#define QOS_TX2_TXOP_LIMIT_CCK 6016 +#define QOS_TX3_TXOP_LIMIT_CCK 3264 + +#define QOS_TX0_TXOP_LIMIT_OFDM 0 +#define QOS_TX1_TXOP_LIMIT_OFDM 0 +#define QOS_TX2_TXOP_LIMIT_OFDM 3008 +#define QOS_TX3_TXOP_LIMIT_OFDM 1504 + +#define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM +#define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM +#define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM +#define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM + +#define DEF_TX0_CW_MIN_CCK CW_MIN_CCK +#define DEF_TX1_CW_MIN_CCK CW_MIN_CCK +#define DEF_TX2_CW_MIN_CCK CW_MIN_CCK +#define DEF_TX3_CW_MIN_CCK CW_MIN_CCK + +#define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM +#define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM +#define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM +#define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM + +#define DEF_TX0_CW_MAX_CCK CW_MAX_CCK +#define DEF_TX1_CW_MAX_CCK CW_MAX_CCK +#define DEF_TX2_CW_MAX_CCK CW_MAX_CCK +#define DEF_TX3_CW_MAX_CCK CW_MAX_CCK + +#define DEF_TX0_AIFS (2) +#define DEF_TX1_AIFS (2) +#define DEF_TX2_AIFS (2) +#define DEF_TX3_AIFS (2) + +#define DEF_TX0_ACM 0 +#define DEF_TX1_ACM 0 +#define DEF_TX2_ACM 0 +#define DEF_TX3_ACM 0 + +#define DEF_TX0_TXOP_LIMIT_CCK 0 +#define DEF_TX1_TXOP_LIMIT_CCK 0 +#define DEF_TX2_TXOP_LIMIT_CCK 0 +#define DEF_TX3_TXOP_LIMIT_CCK 0 + +#define DEF_TX0_TXOP_LIMIT_OFDM 0 +#define DEF_TX1_TXOP_LIMIT_OFDM 0 +#define DEF_TX2_TXOP_LIMIT_OFDM 0 +#define DEF_TX3_TXOP_LIMIT_OFDM 0 + +#define QOS_QOS_SETS 3 +#define QOS_PARAM_SET_ACTIVE 0 +#define QOS_PARAM_SET_DEF_CCK 1 +#define QOS_PARAM_SET_DEF_OFDM 2 + +#define CTRL_QOS_NO_ACK (0x0020) +#define DCT_FLAG_EXT_QOS_ENABLED (0x10) + +#define U32_PAD(n) ((4-(n))&0x3) + +/* + * Generic queue structure + * + * Contains common data for Rx and Tx queues + */ +#define TFD_CTL_COUNT_SET(n) (n<<24) +#define TFD_CTL_COUNT_GET(ctl) ((ctl>>24) & 7) +#define TFD_CTL_PAD_SET(n) (n<<28) +#define TFD_CTL_PAD_GET(ctl) (ctl>>28) + +#define TFD_TX_CMD_SLOTS 256 +#define TFD_CMD_SLOTS 32 + +#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ + sizeof(struct iwl_cmd_meta)) + +/* + * RX related structures and functions + */ +#define RX_FREE_BUFFERS 64 +#define RX_LOW_WATERMARK 8 + + #define IWL_RX_BUF_SIZE 3000 /* card static random access memory (SRAM) for processor data and instructs */ #define ALM_RTC_INST_UPPER_BOUND (0x014000) diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-io.h b/drivers/net/wireless/iwlwifi/iwl-3945-io.h new file mode 100644 index 00000000000..89253e13353 --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-3945-io.h @@ -0,0 +1,431 @@ +/****************************************************************************** + * + * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved. + * + * Portions of this file are derived from the ipw3945 project. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * The full GNU General Public License is included in this distribution in the + * file called LICENSE. + * + * Contact Information: + * James P. Ketrenos + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + *****************************************************************************/ + +#ifndef __iwl_io_h__ +#define __iwl_io_h__ + +#include + +#include "iwl-3945-debug.h" + +/* + * IO, register, and NIC memory access functions + * + * NOTE on naming convention and macro usage for these + * + * A single _ prefix before a an access function means that no state + * check or debug information is printed when that function is called. + * + * A double __ prefix before an access function means that state is checked + * and the current line number is printed in addition to any other debug output. + * + * The non-prefixed name is the #define that maps the caller into a + * #define that provides the caller's __LINE__ to the double prefix version. + * + * If you wish to call the function without any debug or state checking, + * you should use the single _ prefix version (as is used by dependent IO + * routines, for example _iwl_read_direct32 calls the non-check version of + * _iwl_read32.) + * + * These declarations are *extremely* useful in quickly isolating code deltas + * which result in misconfiguring of the hardware I/O. In combination with + * git-bisect and the IO debug level you can quickly determine the specific + * commit which breaks the IO sequence to the hardware. + * + */ + +#define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, + u32 ofs, u32 val) +{ + IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); + _iwl_write32(iwl, ofs, val); +} +#define iwl_write32(iwl, ofs, val) \ + __iwl_write32(__FILE__, __LINE__, iwl, ofs, val) +#else +#define iwl_write32(iwl, ofs, val) _iwl_write32(iwl, ofs, val) +#endif + +#define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) +#ifdef CONFIG_IWLWIFI_DEBUG +static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs) +{ + IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); + return _iwl_read32(iwl, ofs); +} +#define iwl_read32(iwl, ofs) __iwl_read32(__FILE__, __LINE__, iwl, ofs) +#else +#define iwl_read32(p, o) _iwl_read32(p, o) +#endif + +static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, + u32 bits, u32 mask, int timeout) +{ + int i = 0; + + do { + if ((_iwl_read32(priv, addr) & mask) == (bits & mask)) + return i; + mdelay(10); + i += 10; + } while (i < timeout); + + return -ETIMEDOUT; +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline int __iwl_poll_bit(const char *f, u32 l, + struct iwl_priv *priv, u32 addr, + u32 bits, u32 mask, int timeout) +{ + int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); + if (unlikely(ret == -ETIMEDOUT)) + IWL_DEBUG_IO + ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n", + addr, bits, mask, f, l); + else + IWL_DEBUG_IO + ("poll_bit(0x%08X, 0x%08X, 0x%08X) = 0x%08X - %s %d\n", + addr, bits, mask, ret, f, l); + return ret; +} +#define iwl_poll_bit(iwl, addr, bits, mask, timeout) \ + __iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) +#else +#define iwl_poll_bit(p, a, b, m, t) _iwl_poll_bit(p, a, b, m, t) +#endif + +static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) +{ + _iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_set_bit(const char *f, u32 l, + struct iwl_priv *priv, u32 reg, u32 mask) +{ + u32 val = _iwl_read32(priv, reg) | mask; + IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); + _iwl_write32(priv, reg, val); +} +#define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m) +#else +#define iwl_set_bit(p, r, m) _iwl_set_bit(p, r, m) +#endif + +static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) +{ + _iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_clear_bit(const char *f, u32 l, + struct iwl_priv *priv, u32 reg, u32 mask) +{ + u32 val = _iwl_read32(priv, reg) & ~mask; + IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); + _iwl_write32(priv, reg, val); +} +#define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m) +#else +#define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m) +#endif + +static inline int _iwl_grab_nic_access(struct iwl_priv *priv) +{ + int ret; + u32 gp_ctl; + +#ifdef CONFIG_IWLWIFI_DEBUG + if (atomic_read(&priv->restrict_refcnt)) + return 0; +#endif + if (test_bit(STATUS_RF_KILL_HW, &priv->status) || + test_bit(STATUS_RF_KILL_SW, &priv->status)) { + IWL_WARNING("WARNING: Requesting MAC access during RFKILL " + "wakes up NIC\n"); + + /* 10 msec allows time for NIC to complete its data save */ + gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL); + if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { + IWL_DEBUG_RF_KILL("Wait for complete power-down, " + "gpctl = 0x%08x\n", gp_ctl); + mdelay(10); + } else + IWL_DEBUG_RF_KILL("power-down complete, " + "gpctl = 0x%08x\n", gp_ctl); + } + + /* this bit wakes up the NIC */ + _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); + ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, + CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, + (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | + CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50); + if (ret < 0) { + IWL_ERROR("MAC is in deep sleep!\n"); + return -EIO; + } + +#ifdef CONFIG_IWLWIFI_DEBUG + atomic_inc(&priv->restrict_refcnt); +#endif + return 0; +} + +#ifdef CONFIG_IWLWIFI_DEBUG +static inline int __iwl_grab_nic_access(const char *f, u32 l, + struct iwl_priv *priv) +{ + if (atomic_read(&priv->restrict_refcnt)) + IWL_DEBUG_INFO("Grabbing access while already held at " + "line %d.\n", l); + + IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l); + return _iwl_grab_nic_access(priv); +} +#define iwl_grab_nic_access(priv) \ + __iwl_grab_nic_access(__FILE__, __LINE__, priv) +#else +#define iwl_grab_nic_access(priv) \ + _iwl_grab_nic_access(priv) +#endif + +static inline void _iwl_release_nic_access(struct iwl_priv *priv) +{ +#ifdef CONFIG_IWLWIFI_DEBUG + if (atomic_dec_and_test(&priv->restrict_refcnt)) +#endif + _iwl_clear_bit(priv, CSR_GP_CNTRL, + CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_release_nic_access(const char *f, u32 l, + struct iwl_priv *priv) +{ + if (atomic_read(&priv->restrict_refcnt) <= 0) + IWL_ERROR("Release unheld nic access at line %d.\n", l); + + IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l); + _iwl_release_nic_access(priv); +} +#define iwl_release_nic_access(priv) \ + __iwl_release_nic_access(__FILE__, __LINE__, priv) +#else +#define iwl_release_nic_access(priv) \ + _iwl_release_nic_access(priv) +#endif + +static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) +{ + return _iwl_read32(priv, reg); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline u32 __iwl_read_direct32(const char *f, u32 l, + struct iwl_priv *priv, u32 reg) +{ + u32 value = _iwl_read_direct32(priv, reg); + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access not held from %s %d\n", f, l); + IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value, + f, l); + return value; +} +#define iwl_read_direct32(priv, reg) \ + __iwl_read_direct32(__FILE__, __LINE__, priv, reg) +#else +#define iwl_read_direct32 _iwl_read_direct32 +#endif + +static inline void _iwl_write_direct32(struct iwl_priv *priv, + u32 reg, u32 value) +{ + _iwl_write32(priv, reg, value); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static void __iwl_write_direct32(u32 line, + struct iwl_priv *priv, u32 reg, u32 value) +{ + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access not held from line %d\n", line); + _iwl_write_direct32(priv, reg, value); +} +#define iwl_write_direct32(priv, reg, value) \ + __iwl_write_direct32(__LINE__, priv, reg, value) +#else +#define iwl_write_direct32 _iwl_write_direct32 +#endif + +static inline void iwl_write_reg_buf(struct iwl_priv *priv, + u32 reg, u32 len, u32 *values) +{ + u32 count = sizeof(u32); + + if ((priv != NULL) && (values != NULL)) { + for (; 0 < len; len -= count, reg += count, values++) + _iwl_write_direct32(priv, reg, *values); + } +} + +static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, + u32 addr, u32 mask, int timeout) +{ + int i = 0; + + do { + if ((_iwl_read_direct32(priv, addr) & mask) == mask) + return i; + mdelay(10); + i += 10; + } while (i < timeout); + + return -ETIMEDOUT; +} + +#ifdef CONFIG_IWLWIFI_DEBUG +static inline int __iwl_poll_direct_bit(const char *f, u32 l, + struct iwl_priv *priv, + u32 addr, u32 mask, int timeout) +{ + int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout); + + if (unlikely(ret == -ETIMEDOUT)) + IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - " + "timedout - %s %d\n", addr, mask, f, l); + else + IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) = 0x%08X " + "- %s %d\n", addr, mask, ret, f, l); + return ret; +} +#define iwl_poll_direct_bit(iwl, addr, mask, timeout) \ + __iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) +#else +#define iwl_poll_direct_bit _iwl_poll_direct_bit +#endif + +static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) +{ + _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); + return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) +{ + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access not held from line %d\n", line); + return _iwl_read_prph(priv, reg); +} + +#define iwl_read_prph(priv, reg) \ + __iwl_read_prph(__LINE__, priv, reg) +#else +#define iwl_read_prph _iwl_read_prph +#endif + +static inline void _iwl_write_prph(struct iwl_priv *priv, + u32 addr, u32 val) +{ + _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, + ((addr & 0x0000FFFF) | (3 << 24))); + _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, + u32 addr, u32 val) +{ + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access from line %d\n", line); + _iwl_write_prph(priv, addr, val); +} + +#define iwl_write_prph(priv, addr, val) \ + __iwl_write_prph(__LINE__, priv, addr, val); +#else +#define iwl_write_prph _iwl_write_prph +#endif + +#define _iwl_set_bits_prph(priv, reg, mask) \ + _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, + u32 reg, u32 mask) +{ + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access not held from line %d\n", line); + + _iwl_set_bits_prph(priv, reg, mask); +} +#define iwl_set_bits_prph(priv, reg, mask) \ + __iwl_set_bits_prph(__LINE__, priv, reg, mask) +#else +#define iwl_set_bits_prph _iwl_set_bits_prph +#endif + +#define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ + _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) + +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_set_bits_mask_prph(u32 line, + struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) +{ + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access not held from line %d\n", line); + _iwl_set_bits_mask_prph(priv, reg, bits, mask); +} +#define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ + __iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) +#else +#define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph +#endif + +static inline void iwl_clear_bits_prph(struct iwl_priv + *priv, u32 reg, u32 mask) +{ + u32 val = _iwl_read_prph(priv, reg); + _iwl_write_prph(priv, reg, (val & ~mask)); +} + +static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) +{ + iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); + return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); +} + +static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) +{ + iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); +} + +static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, + u32 len, u32 *values) +{ + iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + for (; 0 < len; len -= sizeof(u32), values++) + iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); +} +#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index a6cb97ac43e..e3a507513e8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c @@ -37,11 +37,9 @@ #include -#define IWL 3945 - #include "../net/mac80211/ieee80211_rate.h" -#include "iwlwifi.h" +#include "iwl-3945.h" #define RS_NAME "iwl-3945-rs" diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index faaba292717..53fe9c1c174 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -39,11 +39,8 @@ #include -#define IWL 3945 - -#include "iwlwifi.h" -#include "iwl-helpers.h" #include "iwl-3945.h" +#include "iwl-helpers.h" #include "iwl-3945-rs.h" #define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index adb5d672e71..ab8412270f6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -27,6 +27,684 @@ #ifndef __iwl_3945_h__ #define __iwl_3945_h__ +#include /* for struct pci_device_id */ +#include +#include + +struct iwl_priv; + +/* Hardware specific file defines the PCI IDs table for that hardware module */ +extern struct pci_device_id iwl_hw_card_ids[]; + +#define DRV_NAME "iwl3945" +#include "iwl-3945-hw.h" +#include "iwl-prph.h" +#include "iwl-3945-debug.h" + +/* Default noise level to report when noise measurement is not available. + * This may be because we're: + * 1) Not associated (4965, no beacon statistics being sent to driver) + * 2) Scanning (noise measurement does not apply to associated channel) + * 3) Receiving CCK (3945 delivers noise info only for OFDM frames) + * Use default noise value of -127 ... this is below the range of measurable + * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user. + * Also, -127 works better than 0 when averaging frames with/without + * noise info (e.g. averaging might be done in app); measured dBm values are + * always negative ... using a negative value as the default keeps all + * averages within an s8's (used in some apps) range of negative values. */ +#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) + +/* Module parameters accessible from iwl-*.c */ +extern int iwl_param_hwcrypto; +extern int iwl_param_queues_num; + +enum iwl_antenna { + IWL_ANTENNA_DIVERSITY, + IWL_ANTENNA_MAIN, + IWL_ANTENNA_AUX +}; + +/* + * RTS threshold here is total size [2347] minus 4 FCS bytes + * Per spec: + * a value of 0 means RTS on all data/management packets + * a value > max MSDU size means no RTS + * else RTS for data/management frames where MPDU is larger + * than RTS value. + */ +#define DEFAULT_RTS_THRESHOLD 2347U +#define MIN_RTS_THRESHOLD 0U +#define MAX_RTS_THRESHOLD 2347U +#define MAX_MSDU_SIZE 2304U +#define MAX_MPDU_SIZE 2346U +#define DEFAULT_BEACON_INTERVAL 100U +#define DEFAULT_SHORT_RETRY_LIMIT 7U +#define DEFAULT_LONG_RETRY_LIMIT 4U + +struct iwl_rx_mem_buffer { + dma_addr_t dma_addr; + struct sk_buff *skb; + struct list_head list; +}; + +struct iwl_rt_rx_hdr { + struct ieee80211_radiotap_header rt_hdr; + __le64 rt_tsf; /* TSF */ + u8 rt_flags; /* radiotap packet flags */ + u8 rt_rate; /* rate in 500kb/s */ + __le16 rt_channelMHz; /* channel in MHz */ + __le16 rt_chbitmask; /* channel bitfield */ + s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ + s8 rt_dbmnoise; + u8 rt_antenna; /* antenna number */ + u8 payload[0]; /* payload... */ +} __attribute__ ((packed)); + +struct iwl_rt_tx_hdr { + struct ieee80211_radiotap_header rt_hdr; + u8 rt_rate; /* rate in 500kb/s */ + __le16 rt_channel; /* channel in mHz */ + __le16 rt_chbitmask; /* channel bitfield */ + s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ + u8 rt_antenna; /* antenna number */ + u8 payload[0]; /* payload... */ +} __attribute__ ((packed)); + +/* + * Generic queue structure + * + * Contains common data for Rx and Tx queues + */ +struct iwl_queue { + int n_bd; /* number of BDs in this queue */ + int write_ptr; /* 1-st empty entry (index) host_w*/ + int read_ptr; /* last used entry (index) host_r*/ + dma_addr_t dma_addr; /* physical addr for BD's */ + int n_window; /* safe queue window */ + u32 id; + int low_mark; /* low watermark, resume queue if free + * space more than this */ + int high_mark; /* high watermark, stop queue if free + * space less than this */ +} __attribute__ ((packed)); + +#define MAX_NUM_OF_TBS (20) + +struct iwl_tx_info { + struct ieee80211_tx_status status; + struct sk_buff *skb[MAX_NUM_OF_TBS]; +}; + +/** + * struct iwl_tx_queue - Tx Queue for DMA + * @need_update: need to update read/write index + * @shed_retry: queue is HT AGG enabled + * + * Queue consists of circular buffer of BD's and required locking structures. + */ +struct iwl_tx_queue { + struct iwl_queue q; + struct iwl_tfd_frame *bd; + struct iwl_cmd *cmd; + dma_addr_t dma_addr_cmd; + struct iwl_tx_info *txb; + int need_update; + int sched_retry; + int active; +}; + +#define IWL_NUM_SCAN_RATES (2) + +struct iwl_channel_tgd_info { + u8 type; + s8 max_power; +}; + +struct iwl_channel_tgh_info { + s64 last_radar_time; +}; + +/* current Tx power values to use, one for each rate for each channel. + * requested power is limited by: + * -- regulatory EEPROM limits for this channel + * -- hardware capabilities (clip-powers) + * -- spectrum management + * -- user preference (e.g. iwconfig) + * when requested power is set, base power index must also be set. */ +struct iwl_channel_power_info { + struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ + s8 power_table_index; /* actual (compenst'd) index into gain table */ + s8 base_power_index; /* gain index for power at factory temp. */ + s8 requested_power; /* power (dBm) requested for this chnl/rate */ +}; + +/* current scan Tx power values to use, one for each scan rate for each + * channel. */ +struct iwl_scan_power_info { + struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ + s8 power_table_index; /* actual (compenst'd) index into gain table */ + s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ +}; + +/* Channel unlock period is 15 seconds. If no beacon or probe response + * has been received within 15 seconds on a locked channel then the channel + * remains locked. */ +#define TX_UNLOCK_PERIOD 15 + +/* CSA lock period is 15 seconds. If a CSA has been received on a channel in + * the last 15 seconds, the channel is locked */ +#define CSA_LOCK_PERIOD 15 +/* + * One for each channel, holds all channel setup data + * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant + * with one another! + */ +#define IWL4965_MAX_RATE (33) + +struct iwl_channel_info { + struct iwl_channel_tgd_info tgd; + struct iwl_channel_tgh_info tgh; + struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ + struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for + * FAT channel */ + + u8 channel; /* channel number */ + u8 flags; /* flags copied from EEPROM */ + s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ + s8 curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) */ + s8 min_power; /* always 0 */ + s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */ + + u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */ + u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */ + u8 phymode; /* MODE_IEEE80211{A,B,G} */ + + /* Radio/DSP gain settings for each "normal" data Tx rate. + * These include, in addition to RF and DSP gain, a few fields for + * remembering/modifying gain settings (indexes). */ + struct iwl_channel_power_info power_info[IWL4965_MAX_RATE]; + + /* Radio/DSP gain settings for each scan rate, for directed scans. */ + struct iwl_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; +}; + +struct iwl_clip_group { + /* maximum power level to prevent clipping for each rate, derived by + * us from this band's saturation power in EEPROM */ + const s8 clip_powers[IWL_MAX_RATES]; +}; + +#include "iwl-3945-rs.h" + +#define IWL_TX_FIFO_AC0 0 +#define IWL_TX_FIFO_AC1 1 +#define IWL_TX_FIFO_AC2 2 +#define IWL_TX_FIFO_AC3 3 +#define IWL_TX_FIFO_HCCA_1 5 +#define IWL_TX_FIFO_HCCA_2 6 +#define IWL_TX_FIFO_NONE 7 + +/* Minimum number of queues. MAX_NUM is defined in hw specific files */ +#define IWL_MIN_NUM_QUEUES 4 + +/* Power management (not Tx power) structures */ + +struct iwl_power_vec_entry { + struct iwl_powertable_cmd cmd; + u8 no_dtim; +}; +#define IWL_POWER_RANGE_0 (0) +#define IWL_POWER_RANGE_1 (1) + +#define IWL_POWER_MODE_CAM 0x00 /* Continuously Aware Mode, always on */ +#define IWL_POWER_INDEX_3 0x03 +#define IWL_POWER_INDEX_5 0x05 +#define IWL_POWER_AC 0x06 +#define IWL_POWER_BATTERY 0x07 +#define IWL_POWER_LIMIT 0x07 +#define IWL_POWER_MASK 0x0F +#define IWL_POWER_ENABLED 0x10 +#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK) + +struct iwl_power_mgr { + spinlock_t lock; + struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC]; + struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC]; + u8 active_index; + u32 dtim_val; +}; + +#define IEEE80211_DATA_LEN 2304 +#define IEEE80211_4ADDR_LEN 30 +#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) +#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) + +struct iwl_frame { + union { + struct ieee80211_hdr frame; + struct iwl_tx_beacon_cmd beacon; + u8 raw[IEEE80211_FRAME_LEN]; + u8 cmd[360]; + } u; + struct list_head list; +}; + +#define SEQ_TO_QUEUE(x) ((x >> 8) & 0xbf) +#define QUEUE_TO_SEQ(x) ((x & 0xbf) << 8) +#define SEQ_TO_INDEX(x) (x & 0xff) +#define INDEX_TO_SEQ(x) (x & 0xff) +#define SEQ_HUGE_FRAME (0x4000) +#define SEQ_RX_FRAME __constant_cpu_to_le16(0x8000) +#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) +#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) +#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) + +enum { + /* CMD_SIZE_NORMAL = 0, */ + CMD_SIZE_HUGE = (1 << 0), + /* CMD_SYNC = 0, */ + CMD_ASYNC = (1 << 1), + /* CMD_NO_SKB = 0, */ + CMD_WANT_SKB = (1 << 2), +}; + +struct iwl_cmd; +struct iwl_priv; + +struct iwl_cmd_meta { + struct iwl_cmd_meta *source; + union { + struct sk_buff *skb; + int (*callback)(struct iwl_priv *priv, + struct iwl_cmd *cmd, struct sk_buff *skb); + } __attribute__ ((packed)) u; + + /* The CMD_SIZE_HUGE flag bit indicates that the command + * structure is stored at the end of the shared queue memory. */ + u32 flags; + +} __attribute__ ((packed)); + +struct iwl_cmd { + struct iwl_cmd_meta meta; + struct iwl_cmd_header hdr; + union { + struct iwl_addsta_cmd addsta; + struct iwl_led_cmd led; + u32 flags; + u8 val8; + u16 val16; + u32 val32; + struct iwl_bt_cmd bt; + struct iwl_rxon_time_cmd rxon_time; + struct iwl_powertable_cmd powertable; + struct iwl_qosparam_cmd qosparam; + struct iwl_tx_cmd tx; + struct iwl_tx_beacon_cmd tx_beacon; + struct iwl_rxon_assoc_cmd rxon_assoc; + u8 *indirect; + u8 payload[360]; + } __attribute__ ((packed)) cmd; +} __attribute__ ((packed)); + +struct iwl_host_cmd { + u8 id; + u16 len; + struct iwl_cmd_meta meta; + const void *data; +}; + +#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ + sizeof(struct iwl_cmd_meta)) + +/* + * RX related structures and functions + */ +#define RX_FREE_BUFFERS 64 +#define RX_LOW_WATERMARK 8 + +#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 +#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 +#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 + +/** + * struct iwl_rx_queue - Rx queue + * @processed: Internal index to last handled Rx packet + * @read: Shared index to newest available Rx buffer + * @write: Shared index to oldest written Rx packet + * @free_count: Number of pre-allocated buffers in rx_free + * @rx_free: list of free SKBs for use + * @rx_used: List of Rx buffers with no SKB + * @need_update: flag to indicate we need to update read/write index + * + * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers + */ +struct iwl_rx_queue { + __le32 *bd; + dma_addr_t dma_addr; + struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; + struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; + u32 processed; + u32 read; + u32 write; + u32 free_count; + struct list_head rx_free; + struct list_head rx_used; + int need_update; + spinlock_t lock; +}; + +#define IWL_SUPPORTED_RATES_IE_LEN 8 + +#define SCAN_INTERVAL 100 + +#define MAX_A_CHANNELS 252 +#define MIN_A_CHANNELS 7 + +#define MAX_B_CHANNELS 14 +#define MIN_B_CHANNELS 1 + +#define STATUS_HCMD_ACTIVE 0 /* host command in progress */ +#define STATUS_INT_ENABLED 1 +#define STATUS_RF_KILL_HW 2 +#define STATUS_RF_KILL_SW 3 +#define STATUS_INIT 4 +#define STATUS_ALIVE 5 +#define STATUS_READY 6 +#define STATUS_TEMPERATURE 7 +#define STATUS_GEO_CONFIGURED 8 +#define STATUS_EXIT_PENDING 9 +#define STATUS_IN_SUSPEND 10 +#define STATUS_STATISTICS 11 +#define STATUS_SCANNING 12 +#define STATUS_SCAN_ABORTING 13 +#define STATUS_SCAN_HW 14 +#define STATUS_POWER_PMI 15 +#define STATUS_FW_ERROR 16 + +#define MAX_TID_COUNT 9 + +#define IWL_INVALID_RATE 0xFF +#define IWL_INVALID_VALUE -1 + +struct iwl_tid_data { + u16 seq_number; +}; + +struct iwl_hw_key { + enum ieee80211_key_alg alg; + int keylen; + u8 key[32]; +}; + +union iwl_ht_rate_supp { + u16 rates; + struct { + u8 siso_rate; + u8 mimo_rate; + }; +}; + +#ifdef CONFIG_IWLWIFI_HT +#define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) +#define HT_IE_MAX_AMSDU_SIZE_4K (0) +#define CFG_HT_MPDU_DENSITY_2USEC (0x5) +#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC + +struct sta_ht_info { + u8 is_ht; + u16 rx_mimo_ps_mode; + u16 tx_mimo_ps_mode; + u16 control_channel; + u8 max_amsdu_size; + u8 ampdu_factor; + u8 mpdu_density; + u8 operating_mode; + u8 supported_chan_width; + u8 extension_chan_offset; + u8 is_green_field; + u8 sgf; + u8 supp_rates[16]; + u8 tx_chan_width; + u8 chan_width_cap; +}; +#endif /*CONFIG_IWLWIFI_HT */ + +#ifdef CONFIG_IWLWIFI_QOS + +union iwl_qos_capabity { + struct { + u8 edca_count:4; /* bit 0-3 */ + u8 q_ack:1; /* bit 4 */ + u8 queue_request:1; /* bit 5 */ + u8 txop_request:1; /* bit 6 */ + u8 reserved:1; /* bit 7 */ + } q_AP; + struct { + u8 acvo_APSD:1; /* bit 0 */ + u8 acvi_APSD:1; /* bit 1 */ + u8 ac_bk_APSD:1; /* bit 2 */ + u8 ac_be_APSD:1; /* bit 3 */ + u8 q_ack:1; /* bit 4 */ + u8 max_len:2; /* bit 5-6 */ + u8 more_data_ack:1; /* bit 7 */ + } q_STA; + u8 val; +}; + +/* QoS structures */ +struct iwl_qos_info { + int qos_enable; + int qos_active; + union iwl_qos_capabity qos_cap; + struct iwl_qosparam_cmd def_qos_parm; +}; +#endif /*CONFIG_IWLWIFI_QOS */ + +#define STA_PS_STATUS_WAKE 0 +#define STA_PS_STATUS_SLEEP 1 + +struct iwl_station_entry { + struct iwl_addsta_cmd sta; + struct iwl_tid_data tid[MAX_TID_COUNT]; + union { + struct { + u8 rate; + u8 flags; + } s; + u16 rate_n_flags; + } current_rate; + u8 used; + u8 ps_status; + struct iwl_hw_key keyinfo; +}; + +/* one for each uCode image (inst/data, boot/init/runtime) */ +struct fw_desc { + void *v_addr; /* access by driver */ + dma_addr_t p_addr; /* access by card's busmaster DMA */ + u32 len; /* bytes */ +}; + +/* uCode file layout */ +struct iwl_ucode { + __le32 ver; /* major/minor/subminor */ + __le32 inst_size; /* bytes of runtime instructions */ + __le32 data_size; /* bytes of runtime data */ + __le32 init_size; /* bytes of initialization instructions */ + __le32 init_data_size; /* bytes of initialization data */ + __le32 boot_size; /* bytes of bootstrap instructions */ + u8 data[0]; /* data in same order as "size" elements */ +}; + +#define IWL_IBSS_MAC_HASH_SIZE 32 + +struct iwl_ibss_seq { + u8 mac[ETH_ALEN]; + u16 seq_num; + u16 frag_num; + unsigned long packet_time; + struct list_head list; +}; + +struct iwl_driver_hw_info { + u16 max_txq_num; + u16 ac_queue_count; + u16 tx_cmd_len; + u16 max_rxq_size; + u32 rx_buffer_size; + u16 max_rxq_log; + u8 max_stations; + u8 bcast_sta_id; + void *shared_virt; + dma_addr_t shared_phys; +}; + + +#define STA_FLG_RTS_MIMO_PROT_MSK __constant_cpu_to_le32(1 << 17) +#define STA_FLG_AGG_MPDU_8US_MSK __constant_cpu_to_le32(1 << 18) +#define STA_FLG_MAX_AGG_SIZE_POS (19) +#define STA_FLG_MAX_AGG_SIZE_MSK __constant_cpu_to_le32(3 << 19) +#define STA_FLG_FAT_EN_MSK __constant_cpu_to_le32(1 << 21) +#define STA_FLG_MIMO_DIS_MSK __constant_cpu_to_le32(1 << 22) +#define STA_FLG_AGG_MPDU_DENSITY_POS (23) +#define STA_FLG_AGG_MPDU_DENSITY_MSK __constant_cpu_to_le32(7 << 23) +#define HT_SHORT_GI_20MHZ_ONLY (1 << 0) +#define HT_SHORT_GI_40MHZ_ONLY (1 << 1) + + +#define IWL_RX_HDR(x) ((struct iwl_rx_frame_hdr *)(\ + x->u.rx_frame.stats.payload + \ + x->u.rx_frame.stats.phy_count)) +#define IWL_RX_END(x) ((struct iwl_rx_frame_end *)(\ + IWL_RX_HDR(x)->payload + \ + le16_to_cpu(IWL_RX_HDR(x)->len))) +#define IWL_RX_STATS(x) (&x->u.rx_frame.stats) +#define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload) + + +/****************************************************************************** + * + * Functions implemented in iwl-base.c which are forward declared here + * for use by iwl-*.c + * + *****************************************************************************/ +struct iwl_addsta_cmd; +extern int iwl_send_add_station(struct iwl_priv *priv, + struct iwl_addsta_cmd *sta, u8 flags); +extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid, + int is_ap, u8 flags); +extern int iwl_is_network_packet(struct iwl_priv *priv, + struct ieee80211_hdr *header); +extern int iwl_power_init_handle(struct iwl_priv *priv); +extern int iwl_eeprom_init(struct iwl_priv *priv); +#ifdef CONFIG_IWLWIFI_DEBUG +extern void iwl_report_frame(struct iwl_priv *priv, + struct iwl_rx_packet *pkt, + struct ieee80211_hdr *header, int group100); +#else +static inline void iwl_report_frame(struct iwl_priv *priv, + struct iwl_rx_packet *pkt, + struct ieee80211_hdr *header, + int group100) {} +#endif +extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv, + struct iwl_rx_mem_buffer *rxb, + void *data, short len, + struct ieee80211_rx_status *stats, + u16 phy_flags); +extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr + *header); +extern int iwl_rx_queue_alloc(struct iwl_priv *priv); +extern void iwl_rx_queue_reset(struct iwl_priv *priv, + struct iwl_rx_queue *rxq); +extern int iwl_calc_db_from_ratio(int sig_ratio); +extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm); +extern int iwl_tx_queue_init(struct iwl_priv *priv, + struct iwl_tx_queue *txq, int count, u32 id); +extern void iwl_rx_replenish(void *data); +extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); +extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, + const void *data); +extern int __must_check iwl_send_cmd(struct iwl_priv *priv, + struct iwl_host_cmd *cmd); +extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, + struct ieee80211_hdr *hdr, + const u8 *dest, int left); +extern int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, + struct iwl_rx_queue *q); +extern int iwl_send_statistics_request(struct iwl_priv *priv); +extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, + u32 decrypt_res, + struct ieee80211_rx_status *stats); +extern const u8 BROADCAST_ADDR[ETH_ALEN]; + +/* + * Currently used by iwl-3945-rs... look at restructuring so that it doesn't + * call this... todo... fix that. +*/ +extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id, + u16 tx_rate, u8 flags); + +/****************************************************************************** + * + * Functions implemented in iwl-[34]*.c which are forward declared here + * for use by iwl-base.c + * + * NOTE: The implementation of these functions are hardware specific + * which is why they are in the hardware specific files (vs. iwl-base.c) + * + * Naming convention -- + * iwl_ <-- Its part of iwlwifi (should be changed to iwl_) + * iwl_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) + * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) + * iwl_bg_ <-- Called from work queue context + * iwl_mac_ <-- mac80211 callback + * + ****************************************************************************/ +extern void iwl_hw_rx_handler_setup(struct iwl_priv *priv); +extern void iwl_hw_setup_deferred_work(struct iwl_priv *priv); +extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv); +extern int iwl_hw_rxq_stop(struct iwl_priv *priv); +extern int iwl_hw_set_hw_setting(struct iwl_priv *priv); +extern int iwl_hw_nic_init(struct iwl_priv *priv); +extern int iwl_hw_nic_stop_master(struct iwl_priv *priv); +extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv); +extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv); +extern int iwl_hw_nic_reset(struct iwl_priv *priv); +extern int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd, + dma_addr_t addr, u16 len); +extern int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); +extern int iwl_hw_get_temperature(struct iwl_priv *priv); +extern int iwl_hw_tx_queue_init(struct iwl_priv *priv, + struct iwl_tx_queue *txq); +extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, + struct iwl_frame *frame, u8 rate); +extern int iwl_hw_get_rx_read(struct iwl_priv *priv); +extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, + struct iwl_cmd *cmd, + struct ieee80211_tx_control *ctrl, + struct ieee80211_hdr *hdr, + int sta_id, int tx_id); +extern int iwl_hw_reg_send_txpower(struct iwl_priv *priv); +extern int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); +extern void iwl_hw_rx_statistics(struct iwl_priv *priv, + struct iwl_rx_mem_buffer *rxb); +extern void iwl_disable_events(struct iwl_priv *priv); +extern int iwl4965_get_temperature(const struct iwl_priv *priv); + +/** + * iwl_hw_find_station - Find station id for a given BSSID + * @bssid: MAC address of station ID to find + * + * NOTE: This should not be hardware specific but the code has + * not yet been merged into a single common layer for managing the + * station tables. + */ +extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid); + +extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel); + /* * Forward declare iwl-3945.c functions for iwl-base.c */ @@ -37,4 +715,286 @@ extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv); extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags); + + +#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT + +enum { + MEASUREMENT_READY = (1 << 0), + MEASUREMENT_ACTIVE = (1 << 1), +}; + +#endif + +struct iwl_priv { + + /* ieee device used by generic ieee processing code */ + struct ieee80211_hw *hw; + struct ieee80211_channel *ieee_channels; + struct ieee80211_rate *ieee_rates; + + /* temporary frame storage list */ + struct list_head free_frames; + int frames_count; + + u8 phymode; + int alloc_rxb_skb; + + void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, + struct iwl_rx_mem_buffer *rxb); + + const struct ieee80211_hw_mode *modes; + +#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT + /* spectrum measurement report caching */ + struct iwl_spectrum_notification measure_report; + u8 measurement_status; +#endif + /* ucode beacon time */ + u32 ucode_beacon_time; + + /* we allocate array of iwl_channel_info for NIC's valid channels. + * Access via channel # using indirect index array */ + struct iwl_channel_info *channel_info; /* channel info array */ + u8 channel_count; /* # of channels */ + + /* each calibration channel group in the EEPROM has a derived + * clip setting for each rate. */ + const struct iwl_clip_group clip_groups[5]; + + /* thermal calibration */ + s32 temperature; /* degrees Kelvin */ + s32 last_temperature; + + /* Scan related variables */ + unsigned long last_scan_jiffies; + unsigned long scan_start; + unsigned long scan_pass_start; + unsigned long scan_start_tsf; + int scan_bands; + int one_direct_scan; + u8 direct_ssid_len; + u8 direct_ssid[IW_ESSID_MAX_SIZE]; + struct iwl_scan_cmd *scan; + u8 only_active_channel; + + /* spinlock */ + spinlock_t lock; /* protect general shared data */ + spinlock_t hcmd_lock; /* protect hcmd */ + struct mutex mutex; + + /* basic pci-network driver stuff */ + struct pci_dev *pci_dev; + + /* pci hardware address support */ + void __iomem *hw_base; + + /* uCode images, save to reload in case of failure */ + struct fw_desc ucode_code; /* runtime inst */ + struct fw_desc ucode_data; /* runtime data original */ + struct fw_desc ucode_data_backup; /* runtime data save/restore */ + struct fw_desc ucode_init; /* initialization inst */ + struct fw_desc ucode_init_data; /* initialization data */ + struct fw_desc ucode_boot; /* bootstrap inst */ + + + struct iwl_rxon_time_cmd rxon_timing; + + /* We declare this const so it can only be + * changed via explicit cast within the + * routines that actually update the physical + * hardware */ + const struct iwl_rxon_cmd active_rxon; + struct iwl_rxon_cmd staging_rxon; + + int error_recovering; + struct iwl_rxon_cmd recovery_rxon; + + /* 1st responses from initialize and runtime uCode images. + * 4965's initialize alive response contains some calibration data. */ + struct iwl_init_alive_resp card_alive_init; + struct iwl_alive_resp card_alive; + +#ifdef LED + /* LED related variables */ + struct iwl_activity_blink activity; + unsigned long led_packets; + int led_state; +#endif + + u16 active_rate; + u16 active_rate_basic; + + u8 call_post_assoc_from_beacon; + u8 assoc_station_added; + /* Rate scaling data */ + s8 data_retry_limit; + u8 retry_rate; + + wait_queue_head_t wait_command_queue; + + int activity_timer_active; + + /* Rx and Tx DMA processing queues */ + struct iwl_rx_queue rxq; + struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; + + unsigned long status; + u32 config; + + int last_rx_rssi; /* From Rx packet statisitics */ + int last_rx_noise; /* From beacon statistics */ + + struct iwl_power_mgr power_data; + + struct iwl_notif_statistics statistics; + unsigned long last_statistics_time; + + /* context information */ + u8 essid[IW_ESSID_MAX_SIZE]; + u8 essid_len; + u16 rates_mask; + + u32 power_mode; + u32 antenna; + u8 bssid[ETH_ALEN]; + u16 rts_threshold; + u8 mac_addr[ETH_ALEN]; + + /*station table variables */ + spinlock_t sta_lock; + int num_stations; + struct iwl_station_entry stations[IWL_STATION_COUNT]; + + /* Indication if ieee80211_ops->open has been called */ + int is_open; + + u8 mac80211_registered; + int is_abg; + + u32 notif_missed_beacons; + + /* Rx'd packet timing information */ + u32 last_beacon_time; + u64 last_tsf; + + /* Duplicate packet detection */ + u16 last_seq_num; + u16 last_frag_num; + unsigned long last_packet_time; + struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE]; + + /* eeprom */ + struct iwl_eeprom eeprom; + + int iw_mode; + + struct sk_buff *ibss_beacon; + + /* Last Rx'd beacon timestamp */ + u32 timestamp0; + u32 timestamp1; + u16 beacon_int; + struct iwl_driver_hw_info hw_setting; + int interface_id; + + /* Current association information needed to configure the + * hardware */ + u16 assoc_id; + u16 assoc_capability; + u8 ps_mode; + +#ifdef CONFIG_IWLWIFI_QOS + struct iwl_qos_info qos_data; +#endif /*CONFIG_IWLWIFI_QOS */ + + struct workqueue_struct *workqueue; + + struct work_struct up; + struct work_struct restart; + struct work_struct calibrated_work; + struct work_struct scan_completed; + struct work_struct rx_replenish; + struct work_struct rf_kill; + struct work_struct abort_scan; + struct work_struct update_link_led; + struct work_struct auth_work; + struct work_struct report_work; + struct work_struct request_scan; + struct work_struct beacon_update; + + struct tasklet_struct irq_tasklet; + + struct delayed_work init_alive_start; + struct delayed_work alive_start; + struct delayed_work activity_timer; + struct delayed_work thermal_periodic; + struct delayed_work gather_stats; + struct delayed_work scan_check; + struct delayed_work post_associate; + +#define IWL_DEFAULT_TX_POWER 0x0F + s8 user_txpower_limit; + s8 max_channel_txpower_limit; + +#ifdef CONFIG_PM + u32 pm_state[16]; +#endif + +#ifdef CONFIG_IWLWIFI_DEBUG + /* debugging info */ + u32 framecnt_to_us; + atomic_t restrict_refcnt; +#endif +}; /*iwl_priv */ + +static inline int iwl_is_associated(struct iwl_priv *priv) +{ + return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; +} + +static inline int is_channel_valid(const struct iwl_channel_info *ch_info) +{ + if (ch_info == NULL) + return 0; + return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; +} + +static inline int is_channel_narrow(const struct iwl_channel_info *ch_info) +{ + return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0; +} + +static inline int is_channel_radar(const struct iwl_channel_info *ch_info) +{ + return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; +} + +static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info) +{ + return ch_info->phymode == MODE_IEEE80211A; +} + +static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info) +{ + return ((ch_info->phymode == MODE_IEEE80211B) || + (ch_info->phymode == MODE_IEEE80211G)); +} + +static inline int is_channel_passive(const struct iwl_channel_info *ch) +{ + return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; +} + +static inline int is_channel_ibss(const struct iwl_channel_info *ch) +{ + return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; +} + +extern const struct iwl_channel_info *iwl_get_channel_info( + const struct iwl_priv *priv, int phymode, u16 channel); + +/* Requires full declaration of iwl_priv before including */ +#include "iwl-3945-io.h" + #endif diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h new file mode 100644 index 00000000000..5524bf77e88 --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h @@ -0,0 +1,1582 @@ +/****************************************************************************** + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, + * USA + * + * The full GNU General Public License is included in this distribution + * in the file called LICENSE.GPL. + * + * Contact Information: + * James P. Ketrenos + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * BSD LICENSE + * + * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#ifndef __iwl_commands_h__ +#define __iwl_commands_h__ + +enum { + REPLY_ALIVE = 0x1, + REPLY_ERROR = 0x2, + + /* RXON and QOS commands */ + REPLY_RXON = 0x10, + REPLY_RXON_ASSOC = 0x11, + REPLY_QOS_PARAM = 0x13, + REPLY_RXON_TIMING = 0x14, + + /* Multi-Station support */ + REPLY_ADD_STA = 0x18, + REPLY_REMOVE_STA = 0x19, /* not used */ + REPLY_REMOVE_ALL_STA = 0x1a, /* not used */ + + /* RX, TX, LEDs */ + REPLY_TX = 0x1c, + REPLY_RATE_SCALE = 0x47, /* 3945 only */ + REPLY_LEDS_CMD = 0x48, + REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */ + + /* 802.11h related */ + RADAR_NOTIFICATION = 0x70, /* not used */ + REPLY_QUIET_CMD = 0x71, /* not used */ + REPLY_CHANNEL_SWITCH = 0x72, + CHANNEL_SWITCH_NOTIFICATION = 0x73, + REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, + SPECTRUM_MEASURE_NOTIFICATION = 0x75, + + /* Power Management */ + POWER_TABLE_CMD = 0x77, + PM_SLEEP_NOTIFICATION = 0x7A, + PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, + + /* Scan commands and notifications */ + REPLY_SCAN_CMD = 0x80, + REPLY_SCAN_ABORT_CMD = 0x81, + SCAN_START_NOTIFICATION = 0x82, + SCAN_RESULTS_NOTIFICATION = 0x83, + SCAN_COMPLETE_NOTIFICATION = 0x84, + + /* IBSS/AP commands */ + BEACON_NOTIFICATION = 0x90, + REPLY_TX_BEACON = 0x91, + WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */ + + /* Miscellaneous commands */ + QUIET_NOTIFICATION = 0x96, /* not used */ + REPLY_TX_PWR_TABLE_CMD = 0x97, + MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ + + /* BT config command */ + REPLY_BT_CONFIG = 0x9b, + + /* 4965 Statistics */ + REPLY_STATISTICS_CMD = 0x9c, + STATISTICS_NOTIFICATION = 0x9d, + + /* RF-KILL commands and notifications */ + REPLY_CARD_STATE_CMD = 0xa0, + CARD_STATE_NOTIFICATION = 0xa1, + + /* Missed beacons notification */ + MISSED_BEACONS_NOTIFICATION = 0xa2, + + REPLY_CT_KILL_CONFIG_CMD = 0xa4, + SENSITIVITY_CMD = 0xa8, + REPLY_PHY_CALIBRATION_CMD = 0xb0, + REPLY_RX_PHY_CMD = 0xc0, + REPLY_RX_MPDU_CMD = 0xc1, + REPLY_4965_RX = 0xc3, + REPLY_COMPRESSED_BA = 0xc5, + REPLY_MAX = 0xff +}; + +/****************************************************************************** + * (0) + * Header + * + *****************************************************************************/ + +#define IWL_CMD_FAILED_MSK 0x40 + +struct iwl_cmd_header { + u8 cmd; + u8 flags; + /* We have 15 LSB to use as we please (MSB indicates + * a frame Rx'd from the HW). We encode the following + * information into the sequence field: + * + * 0:7 index in fifo + * 8:13 fifo selection + * 14:14 bit indicating if this packet references the 'extra' + * storage at the end of the memory queue + * 15:15 (Rx indication) + * + */ + __le16 sequence; + + /* command data follows immediately */ + u8 data[0]; +} __attribute__ ((packed)); + +/****************************************************************************** + * (0a) + * Alive and Error Commands & Responses: + * + *****************************************************************************/ + +#define UCODE_VALID_OK __constant_cpu_to_le32(0x1) +#define INITIALIZE_SUBTYPE (9) + +/* + * REPLY_ALIVE = 0x1 (response only, not a command) + */ +struct iwl_alive_resp { + u8 ucode_minor; + u8 ucode_major; + __le16 reserved1; + u8 sw_rev[8]; + u8 ver_type; + u8 ver_subtype; + __le16 reserved2; + __le32 log_event_table_ptr; + __le32 error_event_table_ptr; + __le32 timestamp; + __le32 is_valid; +} __attribute__ ((packed)); + +struct iwl_init_alive_resp { + u8 ucode_minor; + u8 ucode_major; + __le16 reserved1; + u8 sw_rev[8]; + u8 ver_type; + u8 ver_subtype; + __le16 reserved2; + __le32 log_event_table_ptr; + __le32 error_event_table_ptr; + __le32 timestamp; + __le32 is_valid; + + /* calibration values from "initialize" uCode */ + __le32 voltage; /* signed */ + __le32 therm_r1[2]; /* signed 1st for normal, 2nd for FAT channel */ + __le32 therm_r2[2]; /* signed */ + __le32 therm_r3[2]; /* signed */ + __le32 therm_r4[2]; /* signed */ + __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups, + * 2 Tx chains */ +} __attribute__ ((packed)); + +union tsf { + u8 byte[8]; + __le16 word[4]; + __le32 dw[2]; +}; + +/* + * REPLY_ERROR = 0x2 (response only, not a command) + */ +struct iwl_error_resp { + __le32 error_type; + u8 cmd_id; + u8 reserved1; + __le16 bad_cmd_seq_num; + __le32 error_info; + union tsf timestamp; +} __attribute__ ((packed)); + +/****************************************************************************** + * (1) + * RXON Commands & Responses: + * + *****************************************************************************/ + +/* + * Rx config defines & structure + */ +/* rx_config device types */ +enum { + RXON_DEV_TYPE_AP = 1, + RXON_DEV_TYPE_ESS = 3, + RXON_DEV_TYPE_IBSS = 4, + RXON_DEV_TYPE_SNIFFER = 6, +}; + +/* rx_config flags */ +/* band & modulation selection */ +#define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0) +#define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1) +/* auto detection enable */ +#define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2) +/* TGg protection when tx */ +#define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3) +/* cck short slot & preamble */ +#define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4) +#define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5) +/* antenna selection */ +#define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7) +#define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00) +#define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) +#define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) +/* radar detection enable */ +#define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12) +#define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13) +/* rx response to host with 8-byte TSF +* (according to ON_AIR deassertion) */ +#define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15) + +/* rx_config filter flags */ +/* accept all data frames */ +#define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0) +/* pass control & management to host */ +#define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1) +/* accept multi-cast */ +#define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2) +/* don't decrypt uni-cast frames */ +#define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3) +/* don't decrypt multi-cast frames */ +#define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4) +/* STA is associated */ +#define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5) +/* transfer to host non bssid beacons in associated state */ +#define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6) + +/* + * REPLY_RXON = 0x10 (command, has simple generic response) + */ +struct iwl_rxon_cmd { + u8 node_addr[6]; + __le16 reserved1; + u8 bssid_addr[6]; + __le16 reserved2; + u8 wlap_bssid_addr[6]; + __le16 reserved3; + u8 dev_type; + u8 air_propagation; + __le16 rx_chain; + u8 ofdm_basic_rates; + u8 cck_basic_rates; + __le16 assoc_id; + __le32 flags; + __le32 filter_flags; + __le16 channel; + u8 ofdm_ht_single_stream_basic_rates; + u8 ofdm_ht_dual_stream_basic_rates; +} __attribute__ ((packed)); + +/* + * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) + */ +struct iwl_rxon_assoc_cmd { + __le32 flags; + __le32 filter_flags; + u8 ofdm_basic_rates; + u8 cck_basic_rates; + u8 ofdm_ht_single_stream_basic_rates; + u8 ofdm_ht_dual_stream_basic_rates; + __le16 rx_chain_select_flags; + __le16 reserved; +} __attribute__ ((packed)); + +/* + * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) + */ +struct iwl_rxon_time_cmd { + union tsf timestamp; + __le16 beacon_interval; + __le16 atim_window; + __le32 beacon_init_val; + __le16 listen_interval; + __le16 reserved; +} __attribute__ ((packed)); + +struct iwl_tx_power { + u8 tx_gain; /* gain for analog radio */ + u8 dsp_atten; /* gain for DSP */ +} __attribute__ ((packed)); + +#define POWER_TABLE_NUM_ENTRIES 33 +#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 +#define POWER_TABLE_CCK_ENTRY 32 +struct tx_power_dual_stream { + __le32 dw; +} __attribute__ ((packed)); + +struct iwl_tx_power_db { + struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; +} __attribute__ ((packed)); + +/* + * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) + */ +struct iwl_channel_switch_cmd { + u8 band; + u8 expect_beacon; + __le16 channel; + __le32 rxon_flags; + __le32 rxon_filter_flags; + __le32 switch_time; + struct iwl_tx_power_db tx_power; +} __attribute__ ((packed)); + +/* + * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) + */ +struct iwl_csa_notification { + __le16 band; + __le16 channel; + __le32 status; /* 0 - OK, 1 - fail */ +} __attribute__ ((packed)); + +/****************************************************************************** + * (2) + * Quality-of-Service (QOS) Commands & Responses: + * + *****************************************************************************/ +struct iwl_ac_qos { + __le16 cw_min; + __le16 cw_max; + u8 aifsn; + u8 reserved1; + __le16 edca_txop; +} __attribute__ ((packed)); + +/* QoS flags defines */ +#define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01) +#define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02) +#define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10) + +/* + * TXFIFO Queue number defines + */ +/* number of Access categories (AC) (EDCA), queues 0..3 */ +#define AC_NUM 4 + +/* + * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) + */ +struct iwl_qosparam_cmd { + __le32 qos_flags; + struct iwl_ac_qos ac[AC_NUM]; +} __attribute__ ((packed)); + +/****************************************************************************** + * (3) + * Add/Modify Stations Commands & Responses: + * + *****************************************************************************/ +/* + * Multi station support + */ +#define IWL_AP_ID 0 +#define IWL_MULTICAST_ID 1 +#define IWL_STA_ID 2 + +#define IWL3945_BROADCAST_ID 24 +#define IWL3945_STATION_COUNT 25 + +#define IWL4965_BROADCAST_ID 31 +#define IWL4965_STATION_COUNT 32 + +#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ +#define IWL_INVALID_STATION 255 + +#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8); + +#define STA_CONTROL_MODIFY_MSK 0x01 + +/* key flags __le16*/ +#define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7) +#define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0) +#define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1) +#define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2) +#define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3) + +#define STA_KEY_FLG_KEYID_POS 8 +#define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800) + +/* modify flags */ +#define STA_MODIFY_KEY_MASK 0x01 +#define STA_MODIFY_TID_DISABLE_TX 0x02 +#define STA_MODIFY_TX_RATE_MSK 0x04 +#define STA_MODIFY_ADDBA_TID_MSK 0x08 +#define STA_MODIFY_DELBA_TID_MSK 0x10 +#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) + +/* + * Antenna masks: + * bit14:15 01 B inactive, A active + * 10 B active, A inactive + * 11 Both active + */ +#define RATE_MCS_ANT_A_POS 14 +#define RATE_MCS_ANT_B_POS 15 +#define RATE_MCS_ANT_A_MSK 0x4000 +#define RATE_MCS_ANT_B_MSK 0x8000 +#define RATE_MCS_ANT_AB_MSK 0xc000 + +struct iwl_keyinfo { + __le16 key_flags; + u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ + u8 reserved1; + __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ + __le16 reserved2; + u8 key[16]; /* 16-byte unicast decryption key */ +} __attribute__ ((packed)); + +struct sta_id_modify { + u8 addr[ETH_ALEN]; + __le16 reserved1; + u8 sta_id; + u8 modify_mask; + __le16 reserved2; +} __attribute__ ((packed)); + +/* + * REPLY_ADD_STA = 0x18 (command) + */ +struct iwl_addsta_cmd { + u8 mode; + u8 reserved[3]; + struct sta_id_modify sta; + struct iwl_keyinfo key; + __le32 station_flags; + __le32 station_flags_msk; + __le16 tid_disable_tx; + __le16 reserved1; + u8 add_immediate_ba_tid; + u8 remove_immediate_ba_tid; + __le16 add_immediate_ba_ssn; + __le32 reserved2; +} __attribute__ ((packed)); + +/* + * REPLY_ADD_STA = 0x18 (response) + */ +struct iwl_add_sta_resp { + u8 status; +} __attribute__ ((packed)); + +#define ADD_STA_SUCCESS_MSK 0x1 + +/****************************************************************************** + * (4) + * Rx Responses: + * + *****************************************************************************/ + +struct iwl_rx_frame_stats { + u8 phy_count; + u8 id; + u8 rssi; + u8 agc; + __le16 sig_avg; + __le16 noise_diff; + u8 payload[0]; +} __attribute__ ((packed)); + +struct iwl_rx_frame_hdr { + __le16 channel; + __le16 phy_flags; + u8 reserved1; + u8 rate; + __le16 len; + u8 payload[0]; +} __attribute__ ((packed)); + +#define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) +#define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) + +#define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) +#define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) +#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) +#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) +#define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) + +#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) +#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) +#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) +#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) +#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) + +#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) +#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) +#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) +#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) +#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) + +struct iwl_rx_frame_end { + __le32 status; + __le64 timestamp; + __le32 beacon_timestamp; +} __attribute__ ((packed)); + +/* + * REPLY_3945_RX = 0x1b (response only, not a command) + * + * NOTE: DO NOT dereference from casts to this structure + * It is provided only for calculating minimum data set size. + * The actual offsets of the hdr and end are dynamic based on + * stats.phy_count + */ +struct iwl_rx_frame { + struct iwl_rx_frame_stats stats; + struct iwl_rx_frame_hdr hdr; + struct iwl_rx_frame_end end; +} __attribute__ ((packed)); + +/* Fixed (non-configurable) rx data from phy */ +#define RX_PHY_FLAGS_ANTENNAE_OFFSET (4) +#define RX_PHY_FLAGS_ANTENNAE_MASK (0x70) +#define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ +#define IWL_AGC_DB_POS (7) +struct iwl4965_rx_non_cfg_phy { + __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ + __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ + u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ + u8 pad[0]; +} __attribute__ ((packed)); + +/* + * REPLY_4965_RX = 0xc3 (response only, not a command) + * Used only for legacy (non 11n) frames. + */ +#define RX_RES_PHY_CNT 14 +struct iwl4965_rx_phy_res { + u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ + u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ + u8 stat_id; /* configurable DSP phy data set ID */ + u8 reserved1; + __le64 timestamp; /* TSF at on air rise */ + __le32 beacon_time_stamp; /* beacon at on-air rise */ + __le16 phy_flags; /* general phy flags: band, modulation, ... */ + __le16 channel; /* channel number */ + __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ + __le32 reserved2; + __le32 rate_n_flags; + __le16 byte_count; /* frame's byte-count */ + __le16 reserved3; +} __attribute__ ((packed)); + +struct iwl4965_rx_mpdu_res_start { + __le16 byte_count; + __le16 reserved; +} __attribute__ ((packed)); + + +/****************************************************************************** + * (5) + * Tx Commands & Responses: + * + *****************************************************************************/ + +/* Tx flags */ +#define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1) +#define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2) +#define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3) +#define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4) +#define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6) +#define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7) +#define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00) +#define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) +#define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) + +/* ucode ignores BT priority for this frame */ +#define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12) + +/* ucode overrides sequence control */ +#define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13) + +/* signal that this frame is non-last MPDU */ +#define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14) + +/* calculate TSF in outgoing frame */ +#define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16) + +/* activate TX calibration. */ +#define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17) + +/* signals that 2 bytes pad was inserted + after the MAC header */ +#define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20) + +/* HCCA-AP - disable duration overwriting. */ +#define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25) + +/* + * TX command security control + */ +#define TX_CMD_SEC_WEP 0x01 +#define TX_CMD_SEC_CCM 0x02 +#define TX_CMD_SEC_TKIP 0x03 +#define TX_CMD_SEC_MSK 0x03 +#define TX_CMD_SEC_SHIFT 6 +#define TX_CMD_SEC_KEY128 0x08 + +/* + * TX command Frame life time + */ + +struct iwl_dram_scratch { + u8 try_cnt; + u8 bt_kill_cnt; + __le16 reserved; +} __attribute__ ((packed)); + +/* + * REPLY_TX = 0x1c (command) + */ +struct iwl_tx_cmd { + __le16 len; + __le16 next_frame_len; + __le32 tx_flags; + struct iwl_dram_scratch scratch; + __le32 rate_n_flags; + u8 sta_id; + u8 sec_ctl; + u8 initial_rate_index; + u8 reserved; + u8 key[16]; + __le16 next_frame_flags; + __le16 reserved2; + union { + __le32 life_time; + __le32 attempt; + } stop_time; + __le32 dram_lsb_ptr; + u8 dram_msb_ptr; + u8 rts_retry_limit; /*byte 50 */ + u8 data_retry_limit; /*byte 51 */ + u8 tid_tspec; + union { + __le16 pm_frame_timeout; + __le16 attempt_duration; + } timeout; + __le16 driver_txop; + u8 payload[0]; + struct ieee80211_hdr hdr[0]; +} __attribute__ ((packed)); + +/* TX command response is sent after *all* transmission attempts. + * + * NOTES: + * + * TX_STATUS_FAIL_NEXT_FRAG + * + * If the fragment flag in the MAC header for the frame being transmitted + * is set and there is insufficient time to transmit the next frame, the + * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. + * + * TX_STATUS_FIFO_UNDERRUN + * + * Indicates the host did not provide bytes to the FIFO fast enough while + * a TX was in progress. + * + * TX_STATUS_FAIL_MGMNT_ABORT + * + * This status is only possible if the ABORT ON MGMT RX parameter was + * set to true with the TX command. + * + * If the MSB of the status parameter is set then an abort sequence is + * required. This sequence consists of the host activating the TX Abort + * control line, and then waiting for the TX Abort command response. This + * indicates that a the device is no longer in a transmit state, and that the + * command FIFO has been cleared. The host must then deactivate the TX Abort + * control line. Receiving is still allowed in this case. + */ +enum { + TX_STATUS_SUCCESS = 0x01, + TX_STATUS_DIRECT_DONE = 0x02, + TX_STATUS_FAIL_SHORT_LIMIT = 0x82, + TX_STATUS_FAIL_LONG_LIMIT = 0x83, + TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, + TX_STATUS_FAIL_MGMNT_ABORT = 0x85, + TX_STATUS_FAIL_NEXT_FRAG = 0x86, + TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, + TX_STATUS_FAIL_DEST_PS = 0x88, + TX_STATUS_FAIL_ABORTED = 0x89, + TX_STATUS_FAIL_BT_RETRY = 0x8a, + TX_STATUS_FAIL_STA_INVALID = 0x8b, + TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, + TX_STATUS_FAIL_TID_DISABLE = 0x8d, + TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e, + TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, + TX_STATUS_FAIL_TX_LOCKED = 0x90, + TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, +}; + +#define TX_PACKET_MODE_REGULAR 0x0000 +#define TX_PACKET_MODE_BURST_SEQ 0x0100 +#define TX_PACKET_MODE_BURST_FIRST 0x0200 + +enum { + TX_POWER_PA_NOT_ACTIVE = 0x0, +}; + +enum { + TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ + TX_STATUS_DELAY_MSK = 0x00000040, + TX_STATUS_ABORT_MSK = 0x00000080, + TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ + TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ + TX_RESERVED = 0x00780000, /* bits 19:22 */ + TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ + TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ +}; + +/* ******************************* + * TX aggregation state + ******************************* */ + +enum { + AGG_TX_STATE_TRANSMITTED = 0x00, + AGG_TX_STATE_UNDERRUN_MSK = 0x01, + AGG_TX_STATE_BT_PRIO_MSK = 0x02, + AGG_TX_STATE_FEW_BYTES_MSK = 0x04, + AGG_TX_STATE_ABORT_MSK = 0x08, + AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, + AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, + AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, + AGG_TX_STATE_SCD_QUERY_MSK = 0x80, + AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, + AGG_TX_STATE_RESPONSE_MSK = 0x1ff, + AGG_TX_STATE_DUMP_TX_MSK = 0x200, + AGG_TX_STATE_DELAY_TX_MSK = 0x400 +}; + +#define AGG_TX_STATE_LAST_SENT_MSK \ +(AGG_TX_STATE_LAST_SENT_TTL_MSK | \ + AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ + AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) + +#define AGG_TX_STATE_TRY_CNT_POS 12 +#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 + +#define AGG_TX_STATE_SEQ_NUM_POS 16 +#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 + +/* + * REPLY_TX = 0x1c (response) + */ +struct iwl_tx_resp { + u8 frame_count; /* 1 no aggregation, >1 aggregation */ + u8 bt_kill_count; + u8 failure_rts; + u8 failure_frame; + __le32 rate_n_flags; + __le16 wireless_media_time; + __le16 reserved; + __le32 pa_power1; + __le32 pa_power2; + __le32 status; /* TX status (for aggregation status of 1st frame) */ +} __attribute__ ((packed)); + +/* + * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) + */ +struct iwl_compressed_ba_resp { + __le32 sta_addr_lo32; + __le16 sta_addr_hi16; + __le16 reserved; + u8 sta_id; + u8 tid; + __le16 ba_seq_ctl; + __le32 ba_bitmap0; + __le32 ba_bitmap1; + __le16 scd_flow; + __le16 scd_ssn; +} __attribute__ ((packed)); + +/* + * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) + */ +struct iwl_txpowertable_cmd { + u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ + u8 reserved; + __le16 channel; + struct iwl_tx_power_db tx_power; +} __attribute__ ((packed)); + +/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ +#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0) + +#define LINK_QUAL_AC_NUM AC_NUM +#define LINK_QUAL_MAX_RETRY_NUM 16 + +#define LINK_QUAL_ANT_A_MSK (1<<0) +#define LINK_QUAL_ANT_B_MSK (1<<1) +#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) + +struct iwl_link_qual_general_params { + u8 flags; + u8 mimo_delimiter; + u8 single_stream_ant_msk; + u8 dual_stream_ant_msk; + u8 start_rate_index[LINK_QUAL_AC_NUM]; +} __attribute__ ((packed)); + +struct iwl_link_qual_agg_params { + __le16 agg_time_limit; + u8 agg_dis_start_th; + u8 agg_frame_cnt_limit; + __le32 reserved; +} __attribute__ ((packed)); + +/* + * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) + */ +struct iwl_link_quality_cmd { + u8 sta_id; + u8 reserved1; + __le16 control; + struct iwl_link_qual_general_params general_params; + struct iwl_link_qual_agg_params agg_params; + struct { + __le32 rate_n_flags; + } rs_table[LINK_QUAL_MAX_RETRY_NUM]; + __le32 reserved2; +} __attribute__ ((packed)); + +/* + * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) + */ +struct iwl_bt_cmd { + u8 flags; + u8 lead_time; + u8 max_kill; + u8 reserved; + __le32 kill_ack_mask; + __le32 kill_cts_mask; +} __attribute__ ((packed)); + +/****************************************************************************** + * (6) + * Spectrum Management (802.11h) Commands, Responses, Notifications: + * + *****************************************************************************/ + +/* + * Spectrum Management + */ +#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ + RXON_FILTER_CTL2HOST_MSK | \ + RXON_FILTER_ACCEPT_GRP_MSK | \ + RXON_FILTER_DIS_DECRYPT_MSK | \ + RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ + RXON_FILTER_ASSOC_MSK | \ + RXON_FILTER_BCON_AWARE_MSK) + +struct iwl_measure_channel { + __le32 duration; /* measurement duration in extended beacon + * format */ + u8 channel; /* channel to measure */ + u8 type; /* see enum iwl_measure_type */ + __le16 reserved; +} __attribute__ ((packed)); + +/* + * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) + */ +struct iwl_spectrum_cmd { + __le16 len; /* number of bytes starting from token */ + u8 token; /* token id */ + u8 id; /* measurement id -- 0 or 1 */ + u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ + u8 periodic; /* 1 = periodic */ + __le16 path_loss_timeout; + __le32 start_time; /* start time in extended beacon format */ + __le32 reserved2; + __le32 flags; /* rxon flags */ + __le32 filter_flags; /* rxon filter flags */ + __le16 channel_count; /* minimum 1, maximum 10 */ + __le16 reserved3; + struct iwl_measure_channel channels[10]; +} __attribute__ ((packed)); + +/* + * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) + */ +struct iwl_spectrum_resp { + u8 token; + u8 id; /* id of the prior command replaced, or 0xff */ + __le16 status; /* 0 - command will be handled + * 1 - cannot handle (conflicts with another + * measurement) */ +} __attribute__ ((packed)); + +enum iwl_measurement_state { + IWL_MEASUREMENT_START = 0, + IWL_MEASUREMENT_STOP = 1, +}; + +enum iwl_measurement_status { + IWL_MEASUREMENT_OK = 0, + IWL_MEASUREMENT_CONCURRENT = 1, + IWL_MEASUREMENT_CSA_CONFLICT = 2, + IWL_MEASUREMENT_TGH_CONFLICT = 3, + /* 4-5 reserved */ + IWL_MEASUREMENT_STOPPED = 6, + IWL_MEASUREMENT_TIMEOUT = 7, + IWL_MEASUREMENT_PERIODIC_FAILED = 8, +}; + +#define NUM_ELEMENTS_IN_HISTOGRAM 8 + +struct iwl_measurement_histogram { + __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ + __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ +} __attribute__ ((packed)); + +/* clear channel availability counters */ +struct iwl_measurement_cca_counters { + __le32 ofdm; + __le32 cck; +} __attribute__ ((packed)); + +enum iwl_measure_type { + IWL_MEASURE_BASIC = (1 << 0), + IWL_MEASURE_CHANNEL_LOAD = (1 << 1), + IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), + IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), + IWL_MEASURE_FRAME = (1 << 4), + /* bits 5:6 are reserved */ + IWL_MEASURE_IDLE = (1 << 7), +}; + +/* + * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) + */ +struct iwl_spectrum_notification { + u8 id; /* measurement id -- 0 or 1 */ + u8 token; + u8 channel_index; /* index in measurement channel list */ + u8 state; /* 0 - start, 1 - stop */ + __le32 start_time; /* lower 32-bits of TSF */ + u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ + u8 channel; + u8 type; /* see enum iwl_measurement_type */ + u8 reserved1; + /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only + * valid if applicable for measurement type requested. */ + __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ + __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ + __le32 cca_time; /* channel load time in usecs */ + u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - + * unidentified */ + u8 reserved2[3]; + struct iwl_measurement_histogram histogram; + __le32 stop_time; /* lower 32-bits of TSF */ + __le32 status; /* see iwl_measurement_status */ +} __attribute__ ((packed)); + +/****************************************************************************** + * (7) + * Power Management Commands, Responses, Notifications: + * + *****************************************************************************/ + +/** + * struct iwl_powertable_cmd - Power Table Command + * @flags: See below: + * + * POWER_TABLE_CMD = 0x77 (command, has simple generic response) + * + * PM allow: + * bit 0 - '0' Driver not allow power management + * '1' Driver allow PM (use rest of parameters) + * uCode send sleep notifications: + * bit 1 - '0' Don't send sleep notification + * '1' send sleep notification (SEND_PM_NOTIFICATION) + * Sleep over DTIM + * bit 2 - '0' PM have to walk up every DTIM + * '1' PM could sleep over DTIM till listen Interval. + * PCI power managed + * bit 3 - '0' (PCI_LINK_CTRL & 0x1) + * '1' !(PCI_LINK_CTRL & 0x1) + * Force sleep Modes + * bit 31/30- '00' use both mac/xtal sleeps + * '01' force Mac sleep + * '10' force xtal sleep + * '11' Illegal set + * + * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then + * ucode assume sleep over DTIM is allowed and we don't need to wakeup + * for every DTIM. + */ +#define IWL_POWER_VEC_SIZE 5 + +#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1<<0) +#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2) +#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3) + +struct iwl_powertable_cmd { + __le16 flags; + u8 keep_alive_seconds; + u8 debug_flags; + __le32 rx_data_timeout; + __le32 tx_data_timeout; + __le32 sleep_interval[IWL_POWER_VEC_SIZE]; + __le32 keep_alive_beacons; +} __attribute__ ((packed)); + +/* + * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) + * 3945 and 4965 identical. + */ +struct iwl_sleep_notification { + u8 pm_sleep_mode; + u8 pm_wakeup_src; + __le16 reserved; + __le32 sleep_time; + __le32 tsf_low; + __le32 bcon_timer; +} __attribute__ ((packed)); + +/* Sleep states. 3945 and 4965 identical. */ +enum { + IWL_PM_NO_SLEEP = 0, + IWL_PM_SLP_MAC = 1, + IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, + IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, + IWL_PM_SLP_PHY = 4, + IWL_PM_SLP_REPENT = 5, + IWL_PM_WAKEUP_BY_TIMER = 6, + IWL_PM_WAKEUP_BY_DRIVER = 7, + IWL_PM_WAKEUP_BY_RFKILL = 8, + /* 3 reserved */ + IWL_PM_NUM_OF_MODES = 12, +}; + +/* + * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) + */ +#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ +#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ +#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ +struct iwl_card_state_cmd { + __le32 status; /* CARD_STATE_CMD_* request new power state */ +} __attribute__ ((packed)); + +/* + * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) + */ +struct iwl_card_state_notif { + __le32 flags; +} __attribute__ ((packed)); + +#define HW_CARD_DISABLED 0x01 +#define SW_CARD_DISABLED 0x02 +#define RF_CARD_DISABLED 0x04 +#define RXON_CARD_DISABLED 0x10 + +struct iwl_ct_kill_config { + __le32 reserved; + __le32 critical_temperature_M; + __le32 critical_temperature_R; +} __attribute__ ((packed)); + +/****************************************************************************** + * (8) + * Scan Commands, Responses, Notifications: + * + *****************************************************************************/ + +struct iwl_scan_channel { + /* type is defined as: + * 0:0 active (0 - passive) + * 1:4 SSID direct + * If 1 is set then corresponding SSID IE is transmitted in probe + * 5:7 reserved + */ + u8 type; + u8 channel; + struct iwl_tx_power tpc; + __le16 active_dwell; + __le16 passive_dwell; +} __attribute__ ((packed)); + +struct iwl_ssid_ie { + u8 id; + u8 len; + u8 ssid[32]; +} __attribute__ ((packed)); + +#define PROBE_OPTION_MAX 0x4 +#define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF) +#define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1) +#define IWL_MAX_SCAN_SIZE 1024 + +/* + * REPLY_SCAN_CMD = 0x80 (command) + */ +struct iwl_scan_cmd { + __le16 len; + u8 reserved0; + u8 channel_count; + __le16 quiet_time; /* dwell only this long on quiet chnl + * (active scan) */ + __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ + __le16 good_CRC_th; /* passive -> active promotion threshold */ + __le16 rx_chain; + __le32 max_out_time; /* max usec to be out of associated (service) + * chnl */ + __le32 suspend_time; /* pause scan this long when returning to svc + * chnl. + * 3945 -- 31:24 # beacons, 19:0 additional usec, + * 4965 -- 31:22 # beacons, 21:0 additional usec. + */ + __le32 flags; + __le32 filter_flags; + + struct iwl_tx_cmd tx_cmd; + struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; + + u8 data[0]; + /* + * The channels start after the probe request payload and are of type: + * + * struct iwl_scan_channel channels[0]; + * + * NOTE: Only one band of channels can be scanned per pass. You + * can not mix 2.4GHz channels and 5.2GHz channels and must + * request a scan multiple times (not concurrently) + * + */ +} __attribute__ ((packed)); + +/* Can abort will notify by complete notification with abort status. */ +#define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1) +/* complete notification statuses */ +#define ABORT_STATUS 0x2 + +/* + * REPLY_SCAN_CMD = 0x80 (response) + */ +struct iwl_scanreq_notification { + __le32 status; /* 1: okay, 2: cannot fulfill request */ +} __attribute__ ((packed)); + +/* + * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) + */ +struct iwl_scanstart_notification { + __le32 tsf_low; + __le32 tsf_high; + __le32 beacon_timer; + u8 channel; + u8 band; + u8 reserved[2]; + __le32 status; +} __attribute__ ((packed)); + +#define SCAN_OWNER_STATUS 0x1; +#define MEASURE_OWNER_STATUS 0x2; + +#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ +/* + * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) + */ +struct iwl_scanresults_notification { + u8 channel; + u8 band; + u8 reserved[2]; + __le32 tsf_low; + __le32 tsf_high; + __le32 statistics[NUMBER_OF_STATISTICS]; +} __attribute__ ((packed)); + +/* + * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) + */ +struct iwl_scancomplete_notification { + u8 scanned_channels; + u8 status; + u8 reserved; + u8 last_channel; + __le32 tsf_low; + __le32 tsf_high; +} __attribute__ ((packed)); + + +/****************************************************************************** + * (9) + * IBSS/AP Commands and Notifications: + * + *****************************************************************************/ + +/* + * BEACON_NOTIFICATION = 0x90 (notification only, not a command) + */ +struct iwl_beacon_notif { + struct iwl_tx_resp beacon_notify_hdr; + __le32 low_tsf; + __le32 high_tsf; + __le32 ibss_mgr_status; +} __attribute__ ((packed)); + +/* + * REPLY_TX_BEACON = 0x91 (command, has simple generic response) + */ +struct iwl_tx_beacon_cmd { + struct iwl_tx_cmd tx; + __le16 tim_idx; + u8 tim_size; + u8 reserved1; + struct ieee80211_hdr frame[0]; /* beacon frame */ +} __attribute__ ((packed)); + +/****************************************************************************** + * (10) + * Statistics Commands and Notifications: + * + *****************************************************************************/ + +#define IWL_TEMP_CONVERT 260 + +#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 +#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 +#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 + +/* Used for passing to driver number of successes and failures per rate */ +struct rate_histogram { + union { + __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; + __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; + __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; + } success; + union { + __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; + __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; + __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; + } failed; +} __attribute__ ((packed)); + +/* statistics command response */ + +struct statistics_rx_phy { + __le32 ina_cnt; + __le32 fina_cnt; + __le32 plcp_err; + __le32 crc32_err; + __le32 overrun_err; + __le32 early_overrun_err; + __le32 crc32_good; + __le32 false_alarm_cnt; + __le32 fina_sync_err_cnt; + __le32 sfd_timeout; + __le32 fina_timeout; + __le32 unresponded_rts; + __le32 rxe_frame_limit_overrun; + __le32 sent_ack_cnt; + __le32 sent_cts_cnt; + __le32 sent_ba_rsp_cnt; + __le32 dsp_self_kill; + __le32 mh_format_err; + __le32 re_acq_main_rssi_sum; + __le32 reserved3; +} __attribute__ ((packed)); + +struct statistics_rx_ht_phy { + __le32 plcp_err; + __le32 overrun_err; + __le32 early_overrun_err; + __le32 crc32_good; + __le32 crc32_err; + __le32 mh_format_err; + __le32 agg_crc32_good; + __le32 agg_mpdu_cnt; + __le32 agg_cnt; + __le32 reserved2; +} __attribute__ ((packed)); + +struct statistics_rx_non_phy { + __le32 bogus_cts; /* CTS received when not expecting CTS */ + __le32 bogus_ack; /* ACK received when not expecting ACK */ + __le32 non_bssid_frames; /* number of frames with BSSID that + * doesn't belong to the STA BSSID */ + __le32 filtered_frames; /* count frames that were dumped in the + * filtering process */ + __le32 non_channel_beacons; /* beacons with our bss id but not on + * our serving channel */ + __le32 channel_beacons; /* beacons with our bss id and in our + * serving channel */ + __le32 num_missed_bcon; /* number of missed beacons */ + __le32 adc_rx_saturation_time; /* count in 0.8us units the time the + * ADC was in saturation */ + __le32 ina_detection_search_time;/* total time (in 0.8us) searched + * for INA */ + __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */ + __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */ + __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */ + __le32 interference_data_flag; /* flag for interference data + * availability. 1 when data is + * available. */ + __le32 channel_load; /* counts RX Enable time */ + __le32 dsp_false_alarms; /* DSP false alarm (both OFDM + * and CCK) counter */ + __le32 beacon_rssi_a; + __le32 beacon_rssi_b; + __le32 beacon_rssi_c; + __le32 beacon_energy_a; + __le32 beacon_energy_b; + __le32 beacon_energy_c; +} __attribute__ ((packed)); + +struct statistics_rx { + struct statistics_rx_phy ofdm; + struct statistics_rx_phy cck; + struct statistics_rx_non_phy general; + struct statistics_rx_ht_phy ofdm_ht; +} __attribute__ ((packed)); + +struct statistics_tx_non_phy_agg { + __le32 ba_timeout; + __le32 ba_reschedule_frames; + __le32 scd_query_agg_frame_cnt; + __le32 scd_query_no_agg; + __le32 scd_query_agg; + __le32 scd_query_mismatch; + __le32 frame_not_ready; + __le32 underrun; + __le32 bt_prio_kill; + __le32 rx_ba_rsp_cnt; + __le32 reserved2; + __le32 reserved3; +} __attribute__ ((packed)); + +struct statistics_tx { + __le32 preamble_cnt; + __le32 rx_detected_cnt; + __le32 bt_prio_defer_cnt; + __le32 bt_prio_kill_cnt; + __le32 few_bytes_cnt; + __le32 cts_timeout; + __le32 ack_timeout; + __le32 expected_ack_cnt; + __le32 actual_ack_cnt; + __le32 dump_msdu_cnt; + __le32 burst_abort_next_frame_mismatch_cnt; + __le32 burst_abort_missing_next_frame_cnt; + __le32 cts_timeout_collision; + __le32 ack_or_ba_timeout_collision; + struct statistics_tx_non_phy_agg agg; +} __attribute__ ((packed)); + +struct statistics_dbg { + __le32 burst_check; + __le32 burst_count; + __le32 reserved[4]; +} __attribute__ ((packed)); + +struct statistics_div { + __le32 tx_on_a; + __le32 tx_on_b; + __le32 exec_time; + __le32 probe_time; + __le32 reserved1; + __le32 reserved2; +} __attribute__ ((packed)); + +struct statistics_general { + __le32 temperature; + __le32 temperature_m; + struct statistics_dbg dbg; + __le32 sleep_time; + __le32 slots_out; + __le32 slots_idle; + __le32 ttl_timestamp; + struct statistics_div div; + __le32 rx_enable_counter; + __le32 reserved1; + __le32 reserved2; + __le32 reserved3; +} __attribute__ ((packed)); + +/* + * REPLY_STATISTICS_CMD = 0x9c, + * 3945 and 4965 identical. + * + * This command triggers an immediate response containing uCode statistics. + * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. + * + * If the CLEAR_STATS configuration flag is set, uCode will clear its + * internal copy of the statistics (counters) after issuing the response. + * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). + * + * If the DISABLE_NOTIF configuration flag is set, uCode will not issue + * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag + * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. + */ +#define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ +#define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ +struct iwl_statistics_cmd { + __le32 configuration_flags; /* IWL_STATS_CONF_* */ +} __attribute__ ((packed)); + +/* + * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) + * + * By default, uCode issues this notification after receiving a beacon + * while associated. To disable this behavior, set DISABLE_NOTIF flag in the + * REPLY_STATISTICS_CMD 0x9c, above. + * + * Statistics counters continue to increment beacon after beacon, but are + * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD + * 0x9c with CLEAR_STATS bit set (see above). + * + * uCode also issues this notification during scans. uCode clears statistics + * appropriately so that each notification contains statistics for only the + * one channel that has just been scanned. + */ +#define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) +#define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) +struct iwl_notif_statistics { + __le32 flag; + struct statistics_rx rx; + struct statistics_tx tx; + struct statistics_general general; +} __attribute__ ((packed)); + + +/* + * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) + */ +/* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row, + * then this notification will be sent. */ +#define CONSECUTIVE_MISSED_BCONS_TH 20 + +struct iwl_missed_beacon_notif { + __le32 consequtive_missed_beacons; + __le32 total_missed_becons; + __le32 num_expected_beacons; + __le32 num_recvd_beacons; +} __attribute__ ((packed)); + +/****************************************************************************** + * (11) + * Rx Calibration Commands: + * + *****************************************************************************/ + +#define PHY_CALIBRATE_DIFF_GAIN_CMD (7) +#define HD_TABLE_SIZE (11) + +struct iwl_sensitivity_cmd { + __le16 control; + __le16 table[HD_TABLE_SIZE]; +} __attribute__ ((packed)); + +struct iwl_calibration_cmd { + u8 opCode; + u8 flags; + __le16 reserved; + s8 diff_gain_a; + s8 diff_gain_b; + s8 diff_gain_c; + u8 reserved1; +} __attribute__ ((packed)); + +/****************************************************************************** + * (12) + * Miscellaneous Commands: + * + *****************************************************************************/ + +/* + * LEDs Command & Response + * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) + * + * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), + * this command turns it on or off, or sets up a periodic blinking cycle. + */ +struct iwl_led_cmd { + __le32 interval; /* "interval" in uSec */ + u8 id; /* 1: Activity, 2: Link, 3: Tech */ + u8 off; /* # intervals off while blinking; + * "0", with >0 "on" value, turns LED on */ + u8 on; /* # intervals on while blinking; + * "0", regardless of "off", turns LED off */ + u8 reserved; +} __attribute__ ((packed)); + +/****************************************************************************** + * (13) + * Union of all expected notifications/responses: + * + *****************************************************************************/ + +struct iwl_rx_packet { + __le32 len; + struct iwl_cmd_header hdr; + union { + struct iwl_alive_resp alive_frame; + struct iwl_rx_frame rx_frame; + struct iwl_tx_resp tx_resp; + struct iwl_spectrum_notification spectrum_notif; + struct iwl_csa_notification csa_notif; + struct iwl_error_resp err_resp; + struct iwl_card_state_notif card_state_notif; + struct iwl_beacon_notif beacon_status; + struct iwl_add_sta_resp add_sta; + struct iwl_sleep_notification sleep_notif; + struct iwl_spectrum_resp spectrum; + struct iwl_notif_statistics stats; + struct iwl_compressed_ba_resp compressed_ba; + struct iwl_missed_beacon_notif missed_beacon; + __le32 status; + u8 raw[0]; + } u; +} __attribute__ ((packed)); + +#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame)) + +#endif /* __iwl_commands_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-debug.h b/drivers/net/wireless/iwlwifi/iwl-4965-debug.h new file mode 100644 index 00000000000..72318d78957 --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-4965-debug.h @@ -0,0 +1,152 @@ +/****************************************************************************** + * + * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved. + * + * Portions of this file are derived from the ipw3945 project. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * The full GNU General Public License is included in this distribution in the + * file called LICENSE. + * + * Contact Information: + * James P. Ketrenos + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + *****************************************************************************/ + +#ifndef __iwl_debug_h__ +#define __iwl_debug_h__ + +#ifdef CONFIG_IWLWIFI_DEBUG +extern u32 iwl_debug_level; +#define IWL_DEBUG(level, fmt, args...) \ +do { if (iwl_debug_level & (level)) \ + printk(KERN_ERR DRV_NAME": %c %s " fmt, \ + in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) + +#define IWL_DEBUG_LIMIT(level, fmt, args...) \ +do { if ((iwl_debug_level & (level)) && net_ratelimit()) \ + printk(KERN_ERR DRV_NAME": %c %s " fmt, \ + in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) +#else +static inline void IWL_DEBUG(int level, const char *fmt, ...) +{ +} +static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) +{ +} +#endif /* CONFIG_IWLWIFI_DEBUG */ + +/* + * To use the debug system; + * + * If you are defining a new debug classification, simply add it to the #define + * list here in the form of: + * + * #define IWL_DL_xxxx VALUE + * + * shifting value to the left one bit from the previous entry. xxxx should be + * the name of the classification (for example, WEP) + * + * You then need to either add a IWL_xxxx_DEBUG() macro definition for your + * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want + * to send output to that classification. + * + * To add your debug level to the list of levels seen when you perform + * + * % cat /proc/net/iwl/debug_level + * + * you simply need to add your entry to the iwl_debug_levels array. + * + * If you do not see debug_level in /proc/net/iwl then you do not have + * CONFIG_IWLWIFI_DEBUG defined in your kernel configuration + * + */ + +#define IWL_DL_INFO (1<<0) +#define IWL_DL_MAC80211 (1<<1) +#define IWL_DL_HOST_COMMAND (1<<2) +#define IWL_DL_STATE (1<<3) + +#define IWL_DL_RADIO (1<<7) +#define IWL_DL_POWER (1<<8) +#define IWL_DL_TEMP (1<<9) + +#define IWL_DL_NOTIF (1<<10) +#define IWL_DL_SCAN (1<<11) +#define IWL_DL_ASSOC (1<<12) +#define IWL_DL_DROP (1<<13) + +#define IWL_DL_TXPOWER (1<<14) + +#define IWL_DL_AP (1<<15) + +#define IWL_DL_FW (1<<16) +#define IWL_DL_RF_KILL (1<<17) +#define IWL_DL_FW_ERRORS (1<<18) + +#define IWL_DL_LED (1<<19) + +#define IWL_DL_RATE (1<<20) + +#define IWL_DL_CALIB (1<<21) +#define IWL_DL_WEP (1<<22) +#define IWL_DL_TX (1<<23) +#define IWL_DL_RX (1<<24) +#define IWL_DL_ISR (1<<25) +#define IWL_DL_HT (1<<26) +#define IWL_DL_IO (1<<27) +#define IWL_DL_11H (1<<28) + +#define IWL_DL_STATS (1<<29) +#define IWL_DL_TX_REPLY (1<<30) +#define IWL_DL_QOS (1<<31) + +#define IWL_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) +#define IWL_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) +#define IWL_DEBUG_INFO(f, a...) IWL_DEBUG(IWL_DL_INFO, f, ## a) + +#define IWL_DEBUG_MAC80211(f, a...) IWL_DEBUG(IWL_DL_MAC80211, f, ## a) +#define IWL_DEBUG_TEMP(f, a...) IWL_DEBUG(IWL_DL_TEMP, f, ## a) +#define IWL_DEBUG_SCAN(f, a...) IWL_DEBUG(IWL_DL_SCAN, f, ## a) +#define IWL_DEBUG_RX(f, a...) IWL_DEBUG(IWL_DL_RX, f, ## a) +#define IWL_DEBUG_TX(f, a...) IWL_DEBUG(IWL_DL_TX, f, ## a) +#define IWL_DEBUG_ISR(f, a...) IWL_DEBUG(IWL_DL_ISR, f, ## a) +#define IWL_DEBUG_LED(f, a...) IWL_DEBUG(IWL_DL_LED, f, ## a) +#define IWL_DEBUG_WEP(f, a...) IWL_DEBUG(IWL_DL_WEP, f, ## a) +#define IWL_DEBUG_HC(f, a...) IWL_DEBUG(IWL_DL_HOST_COMMAND, f, ## a) +#define IWL_DEBUG_CALIB(f, a...) IWL_DEBUG(IWL_DL_CALIB, f, ## a) +#define IWL_DEBUG_FW(f, a...) IWL_DEBUG(IWL_DL_FW, f, ## a) +#define IWL_DEBUG_RF_KILL(f, a...) IWL_DEBUG(IWL_DL_RF_KILL, f, ## a) +#define IWL_DEBUG_DROP(f, a...) IWL_DEBUG(IWL_DL_DROP, f, ## a) +#define IWL_DEBUG_DROP_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_DROP, f, ## a) +#define IWL_DEBUG_AP(f, a...) IWL_DEBUG(IWL_DL_AP, f, ## a) +#define IWL_DEBUG_TXPOWER(f, a...) IWL_DEBUG(IWL_DL_TXPOWER, f, ## a) +#define IWL_DEBUG_IO(f, a...) IWL_DEBUG(IWL_DL_IO, f, ## a) +#define IWL_DEBUG_RATE(f, a...) IWL_DEBUG(IWL_DL_RATE, f, ## a) +#define IWL_DEBUG_RATE_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_RATE, f, ## a) +#define IWL_DEBUG_NOTIF(f, a...) IWL_DEBUG(IWL_DL_NOTIF, f, ## a) +#define IWL_DEBUG_ASSOC(f, a...) IWL_DEBUG(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) +#define IWL_DEBUG_ASSOC_LIMIT(f, a...) \ + IWL_DEBUG_LIMIT(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) +#define IWL_DEBUG_HT(f, a...) IWL_DEBUG(IWL_DL_HT, f, ## a) +#define IWL_DEBUG_STATS(f, a...) IWL_DEBUG(IWL_DL_STATS, f, ## a) +#define IWL_DEBUG_TX_REPLY(f, a...) IWL_DEBUG(IWL_DL_TX_REPLY, f, ## a) +#define IWL_DEBUG_QOS(f, a...) IWL_DEBUG(IWL_DL_QOS, f, ## a) +#define IWL_DEBUG_RADIO(f, a...) IWL_DEBUG(IWL_DL_RADIO, f, ## a) +#define IWL_DEBUG_POWER(f, a...) IWL_DEBUG(IWL_DL_POWER, f, ## a) +#define IWL_DEBUG_11H(f, a...) IWL_DEBUG(IWL_DL_11H, f, ## a) + +#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index 5fc707b1ea7..21c75774cf4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h @@ -64,6 +64,683 @@ #ifndef __iwl_4965_hw_h__ #define __iwl_4965_hw_h__ +/* uCode queue management definitions */ +#define IWL_CMD_QUEUE_NUM 4 +#define IWL_CMD_FIFO_NUM 4 +#define IWL_BACK_QUEUE_FIRST_ID 7 + +/* Tx rates */ +#define IWL_CCK_RATES 4 +#define IWL_OFDM_RATES 8 + +#define IWL_HT_RATES 16 + +#define IWL_MAX_RATES (IWL_CCK_RATES+IWL_OFDM_RATES+IWL_HT_RATES) + +/* Time constants */ +#define SHORT_SLOT_TIME 9 +#define LONG_SLOT_TIME 20 + +/* RSSI to dBm */ +#define IWL_RSSI_OFFSET 44 + +/* + * This file defines EEPROM related constants, enums, and inline functions. + * + */ + +#define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ +#define IWL_EEPROM_ACCESS_DELAY 10 /* uSec */ +/* EEPROM field values */ +#define ANTENNA_SWITCH_NORMAL 0 +#define ANTENNA_SWITCH_INVERSE 1 + +enum { + EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */ + EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */ + /* Bit 2 Reserved */ + EEPROM_CHANNEL_ACTIVE = (1 << 3), /* active scanning allowed */ + EEPROM_CHANNEL_RADAR = (1 << 4), /* radar detection required */ + EEPROM_CHANNEL_WIDE = (1 << 5), + EEPROM_CHANNEL_NARROW = (1 << 6), + EEPROM_CHANNEL_DFS = (1 << 7), /* dynamic freq selection candidate */ +}; + +/* EEPROM field lengths */ +#define EEPROM_BOARD_PBA_NUMBER_LENGTH 11 + +/* EEPROM field lengths */ +#define EEPROM_BOARD_PBA_NUMBER_LENGTH 11 +#define EEPROM_REGULATORY_SKU_ID_LENGTH 4 +#define EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH 14 +#define EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH 13 +#define EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH 12 +#define EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH 11 +#define EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH 6 + +#define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS_LENGTH 7 +#define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS_LENGTH 11 +#define EEPROM_REGULATORY_CHANNELS_LENGTH ( \ + EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH + \ + EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH + \ + EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH + \ + EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH + \ + EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH + \ + EEPROM_REGULATORY_BAND_24_FAT_CHANNELS_LENGTH + \ + EEPROM_REGULATORY_BAND_52_FAT_CHANNELS_LENGTH) + +#define EEPROM_REGULATORY_NUMBER_OF_BANDS 5 + +/* SKU Capabilities */ +#define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE (1 << 0) +#define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE (1 << 1) +#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7) + +/* *regulatory* channel data from eeprom, one for each channel */ +struct iwl_eeprom_channel { + u8 flags; /* flags copied from EEPROM */ + s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ +} __attribute__ ((packed)); + +/* + * Mapping of a Tx power level, at factory calibration temperature, + * to a radio/DSP gain table index. + * One for each of 5 "sample" power levels in each band. + * v_det is measured at the factory, using the 3945's built-in power amplifier + * (PA) output voltage detector. This same detector is used during Tx of + * long packets in normal operation to provide feedback as to proper output + * level. + * Data copied from EEPROM. + */ +struct iwl_eeprom_txpower_sample { + u8 gain_index; /* index into power (gain) setup table ... */ + s8 power; /* ... for this pwr level for this chnl group */ + u16 v_det; /* PA output voltage */ +} __attribute__ ((packed)); + +/* + * Mappings of Tx power levels -> nominal radio/DSP gain table indexes. + * One for each channel group (a.k.a. "band") (1 for BG, 4 for A). + * Tx power setup code interpolates between the 5 "sample" power levels + * to determine the nominal setup for a requested power level. + * Data copied from EEPROM. + * DO NOT ALTER THIS STRUCTURE!!! + */ +struct iwl_eeprom_txpower_group { + struct iwl_eeprom_txpower_sample samples[5]; /* 5 power levels */ + s32 a, b, c, d, e; /* coefficients for voltage->power + * formula (signed) */ + s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on + * frequency (signed) */ + s8 saturation_power; /* highest power possible by h/w in this + * band */ + u8 group_channel; /* "representative" channel # in this band */ + s16 temperature; /* h/w temperature at factory calib this band + * (signed) */ +} __attribute__ ((packed)); + +/* + * Temperature-based Tx-power compensation data, not band-specific. + * These coefficients are use to modify a/b/c/d/e coeffs based on + * difference between current temperature and factory calib temperature. + * Data copied from EEPROM. + */ +struct iwl_eeprom_temperature_corr { + u32 Ta; + u32 Tb; + u32 Tc; + u32 Td; + u32 Te; +} __attribute__ ((packed)); + +#define EEPROM_TX_POWER_TX_CHAINS (2) +#define EEPROM_TX_POWER_BANDS (8) +#define EEPROM_TX_POWER_MEASUREMENTS (3) +#define EEPROM_TX_POWER_VERSION (2) +#define EEPROM_TX_POWER_VERSION_NEW (5) + +struct iwl_eeprom_calib_measure { + u8 temperature; + u8 gain_idx; + u8 actual_pow; + s8 pa_det; +} __attribute__ ((packed)); + +struct iwl_eeprom_calib_ch_info { + u8 ch_num; + struct iwl_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS] + [EEPROM_TX_POWER_MEASUREMENTS]; +} __attribute__ ((packed)); + +struct iwl_eeprom_calib_subband_info { + u8 ch_from; + u8 ch_to; + struct iwl_eeprom_calib_ch_info ch1; + struct iwl_eeprom_calib_ch_info ch2; +} __attribute__ ((packed)); + +struct iwl_eeprom_calib_info { + u8 saturation_power24; + u8 saturation_power52; + s16 voltage; /* signed */ + struct iwl_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS]; +} __attribute__ ((packed)); + + +struct iwl_eeprom { + u8 reserved0[16]; +#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ + u16 device_id; /* abs.ofs: 16 */ + u8 reserved1[2]; +#define EEPROM_PMC (2*0x0A) /* 2 bytes */ + u16 pmc; /* abs.ofs: 20 */ + u8 reserved2[20]; +#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */ + u8 mac_address[6]; /* abs.ofs: 42 */ + u8 reserved3[58]; +#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */ + u16 board_revision; /* abs.ofs: 106 */ + u8 reserved4[11]; +#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */ + u8 board_pba_number[9]; /* abs.ofs: 119 */ + u8 reserved5[8]; +#define EEPROM_VERSION (2*0x44) /* 2 bytes */ + u16 version; /* abs.ofs: 136 */ +#define EEPROM_SKU_CAP (2*0x45) /* 1 bytes */ + u8 sku_cap; /* abs.ofs: 138 */ +#define EEPROM_LEDS_MODE (2*0x45+1) /* 1 bytes */ + u8 leds_mode; /* abs.ofs: 139 */ +#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ + u16 oem_mode; +#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */ + u16 wowlan_mode; /* abs.ofs: 142 */ +#define EEPROM_LEDS_TIME_INTERVAL (2*0x48) /* 2 bytes */ + u16 leds_time_interval; /* abs.ofs: 144 */ +#define EEPROM_LEDS_OFF_TIME (2*0x49) /* 1 bytes */ + u8 leds_off_time; /* abs.ofs: 146 */ +#define EEPROM_LEDS_ON_TIME (2*0x49+1) /* 1 bytes */ + u8 leds_on_time; /* abs.ofs: 147 */ +#define EEPROM_ALMGOR_M_VERSION (2*0x4A) /* 1 bytes */ + u8 almgor_m_version; /* abs.ofs: 148 */ +#define EEPROM_ANTENNA_SWITCH_TYPE (2*0x4A+1) /* 1 bytes */ + u8 antenna_switch_type; /* abs.ofs: 149 */ + u8 reserved6[8]; +#define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */ + u16 board_revision_4965; /* abs.ofs: 158 */ + u8 reserved7[13]; +#define EEPROM_4965_BOARD_PBA (2*0x56+1) /* 9 bytes */ + u8 board_pba_number_4965[9]; /* abs.ofs: 173 */ + u8 reserved8[10]; +#define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */ + u8 sku_id[4]; /* abs.ofs: 192 */ +#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */ + u16 band_1_count; /* abs.ofs: 196 */ +#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */ + struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */ +#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */ + u16 band_2_count; /* abs.ofs: 226 */ +#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */ + struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ +#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */ + u16 band_3_count; /* abs.ofs: 254 */ +#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */ + struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ +#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */ + u16 band_4_count; /* abs.ofs: 280 */ +#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */ + struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ +#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */ + u16 band_5_count; /* abs.ofs: 304 */ +#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */ + struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ + + u8 reserved10[2]; +#define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS (2*0xA0) /* 14 bytes */ + struct iwl_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */ + u8 reserved11[2]; +#define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8) /* 22 bytes */ + struct iwl_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */ + u8 reserved12[6]; +#define EEPROM_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */ + u16 calib_version; /* abs.ofs: 364 */ + u8 reserved13[2]; +#define EEPROM_SATURATION_POWER_OFFSET (2*0xB8) /* 2 bytes */ + u16 satruation_power; /* abs.ofs: 368 */ + u8 reserved14[94]; +#define EEPROM_IWL_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */ + struct iwl_eeprom_calib_info calib_info; /* abs.ofs: 464 */ + + u8 reserved16[140]; /* fill out to full 1024 byte block */ + + +} __attribute__ ((packed)); + +#define IWL_EEPROM_IMAGE_SIZE 1024 + + +#include "iwl-4965-commands.h" + +#define PCI_LINK_CTRL 0x0F0 +#define PCI_POWER_SOURCE 0x0C8 +#define PCI_REG_WUM8 0x0E8 +#define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) + +/*=== CSR (control and status registers) ===*/ +#define CSR_BASE (0x000) + +#define CSR_SW_VER (CSR_BASE+0x000) +#define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */ +#define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */ +#define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */ +#define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */ +#define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/ +#define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */ +#define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/ +#define CSR_GP_CNTRL (CSR_BASE+0x024) +#define CSR_HW_REV (CSR_BASE+0x028) +#define CSR_EEPROM_REG (CSR_BASE+0x02c) +#define CSR_EEPROM_GP (CSR_BASE+0x030) +#define CSR_GP_UCODE (CSR_BASE+0x044) +#define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054) +#define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058) +#define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c) +#define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060) +#define CSR_LED_REG (CSR_BASE+0x094) +#define CSR_DRAM_INT_TBL_CTL (CSR_BASE+0x0A0) +#define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) +#define CSR_ANA_PLL_CFG (CSR_BASE+0x20c) +#define CSR_HW_REV_WA_REG (CSR_BASE+0x22C) + +/* HW I/F configuration */ +#define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB (0x00000100) +#define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM (0x00000200) +#define CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC (0x00000400) +#define CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE (0x00000800) +#define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000) +#define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000) +#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) + +/* interrupt flags in INTA, set by uCode or hardware (e.g. dma), + * acknowledged (reset) by host writing "1" to flagged bits. */ +#define CSR_INT_BIT_FH_RX (1<<31) /* Rx DMA, cmd responses, FH_INT[17:16] */ +#define CSR_INT_BIT_HW_ERR (1<<29) /* DMA hardware error FH_INT[31] */ +#define CSR_INT_BIT_DNLD (1<<28) /* uCode Download */ +#define CSR_INT_BIT_FH_TX (1<<27) /* Tx DMA FH_INT[1:0] */ +#define CSR_INT_BIT_MAC_CLK_ACTV (1<<26) /* NIC controller's clock toggled on/off */ +#define CSR_INT_BIT_SW_ERR (1<<25) /* uCode error */ +#define CSR_INT_BIT_RF_KILL (1<<7) /* HW RFKILL switch GP_CNTRL[27] toggled */ +#define CSR_INT_BIT_CT_KILL (1<<6) /* Critical temp (chip too hot) rfkill */ +#define CSR_INT_BIT_SW_RX (1<<3) /* Rx, command responses, 3945 */ +#define CSR_INT_BIT_WAKEUP (1<<1) /* NIC controller waking up (pwr mgmt) */ +#define CSR_INT_BIT_ALIVE (1<<0) /* uCode interrupts once it initializes */ + +#define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \ + CSR_INT_BIT_HW_ERR | \ + CSR_INT_BIT_FH_TX | \ + CSR_INT_BIT_SW_ERR | \ + CSR_INT_BIT_RF_KILL | \ + CSR_INT_BIT_SW_RX | \ + CSR_INT_BIT_WAKEUP | \ + CSR_INT_BIT_ALIVE) + +/* interrupt flags in FH (flow handler) (PCI busmaster DMA) */ +#define CSR_FH_INT_BIT_ERR (1<<31) /* Error */ +#define CSR_FH_INT_BIT_HI_PRIOR (1<<30) /* High priority Rx, bypass coalescing */ +#define CSR_FH_INT_BIT_RX_CHNL2 (1<<18) /* Rx channel 2 (3945 only) */ +#define CSR_FH_INT_BIT_RX_CHNL1 (1<<17) /* Rx channel 1 */ +#define CSR_FH_INT_BIT_RX_CHNL0 (1<<16) /* Rx channel 0 */ +#define CSR_FH_INT_BIT_TX_CHNL6 (1<<6) /* Tx channel 6 (3945 only) */ +#define CSR_FH_INT_BIT_TX_CHNL1 (1<<1) /* Tx channel 1 */ +#define CSR_FH_INT_BIT_TX_CHNL0 (1<<0) /* Tx channel 0 */ + +#define CSR_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \ + CSR_FH_INT_BIT_RX_CHNL2 | \ + CSR_FH_INT_BIT_RX_CHNL1 | \ + CSR_FH_INT_BIT_RX_CHNL0) + +#define CSR_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL6 | \ + CSR_FH_INT_BIT_TX_CHNL1 | \ + CSR_FH_INT_BIT_TX_CHNL0 ) + + +/* RESET */ +#define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001) +#define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002) +#define CSR_RESET_REG_FLAG_SW_RESET (0x00000080) +#define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100) +#define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200) + +/* GP (general purpose) CONTROL */ +#define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001) +#define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004) +#define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008) +#define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010) + +#define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001) + +#define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000) +#define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000) +#define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) + + +/* EEPROM REG */ +#define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001) +#define CSR_EEPROM_REG_BIT_CMD (0x00000002) + +/* EEPROM GP */ +#define CSR_EEPROM_GP_VALID_MSK (0x00000006) +#define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000) +#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180) + +/* UCODE DRV GP */ +#define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001) +#define CSR_UCODE_SW_BIT_RFKILL (0x00000002) +#define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004) +#define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008) + +/* GPIO */ +#define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200) +#define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000) +#define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC CSR_GPIO_IN_BIT_AUX_POWER + +/* GI Chicken Bits */ +#define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000) +#define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000) + +/* CSR_ANA_PLL_CFG */ +#define CSR_ANA_PLL_CFG_SH (0x00880300) + +#define CSR_LED_REG_TRUN_ON (0x00000078) +#define CSR_LED_REG_TRUN_OFF (0x00000038) +#define CSR_LED_BSM_CTRL_MSK (0xFFFFFFDF) + +/* DRAM_INT_TBL_CTRL */ +#define CSR_DRAM_INT_TBL_CTRL_EN (1<<31) +#define CSR_DRAM_INT_TBL_CTRL_WRAP_CHK (1<<27) + +/*=== HBUS (Host-side Bus) ===*/ +#define HBUS_BASE (0x400) + +#define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c) +#define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010) +#define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018) +#define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c) +#define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044) +#define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048) +#define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c) +#define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050) +#define HBUS_TARG_WRPTR (HBUS_BASE+0x060) + +#define HBUS_TARG_MBX_C (HBUS_BASE+0x030) + + +/* SCD (Scheduler) */ +#define SCD_BASE (CSR_BASE + 0x2E00) + +#define SCD_MODE_REG (SCD_BASE + 0x000) +#define SCD_ARASTAT_REG (SCD_BASE + 0x004) +#define SCD_TXFACT_REG (SCD_BASE + 0x010) +#define SCD_TXF4MF_REG (SCD_BASE + 0x014) +#define SCD_TXF5MF_REG (SCD_BASE + 0x020) +#define SCD_SBYP_MODE_1_REG (SCD_BASE + 0x02C) +#define SCD_SBYP_MODE_2_REG (SCD_BASE + 0x030) + +/*=== FH (data Flow Handler) ===*/ +#define FH_BASE (0x800) + +#define FH_CBCC_TABLE (FH_BASE+0x140) +#define FH_TFDB_TABLE (FH_BASE+0x180) +#define FH_RCSR_TABLE (FH_BASE+0x400) +#define FH_RSSR_TABLE (FH_BASE+0x4c0) +#define FH_TCSR_TABLE (FH_BASE+0x500) +#define FH_TSSR_TABLE (FH_BASE+0x680) + +/* TFDB (Transmit Frame Buffer Descriptor) */ +#define FH_TFDB(_channel, buf) \ + (FH_TFDB_TABLE+((_channel)*2+(buf))*0x28) +#define ALM_FH_TFDB_CHNL_BUF_CTRL_REG(_channel) \ + (FH_TFDB_TABLE + 0x50 * _channel) +/* CBCC _channel is [0,2] */ +#define FH_CBCC(_channel) (FH_CBCC_TABLE+(_channel)*0x8) +#define FH_CBCC_CTRL(_channel) (FH_CBCC(_channel)+0x00) +#define FH_CBCC_BASE(_channel) (FH_CBCC(_channel)+0x04) + +/* RCSR _channel is [0,2] */ +#define FH_RCSR(_channel) (FH_RCSR_TABLE+(_channel)*0x40) +#define FH_RCSR_CONFIG(_channel) (FH_RCSR(_channel)+0x00) +#define FH_RCSR_RBD_BASE(_channel) (FH_RCSR(_channel)+0x04) +#define FH_RCSR_WPTR(_channel) (FH_RCSR(_channel)+0x20) +#define FH_RCSR_RPTR_ADDR(_channel) (FH_RCSR(_channel)+0x24) + +#define FH_RSCSR_CHNL0_WPTR (FH_RSCSR_CHNL0_RBDCB_WPTR_REG) + +/* RSSR */ +#define FH_RSSR_CTRL (FH_RSSR_TABLE+0x000) +#define FH_RSSR_STATUS (FH_RSSR_TABLE+0x004) +/* TCSR */ +#define FH_TCSR(_channel) (FH_TCSR_TABLE+(_channel)*0x20) +#define FH_TCSR_CONFIG(_channel) (FH_TCSR(_channel)+0x00) +#define FH_TCSR_CREDIT(_channel) (FH_TCSR(_channel)+0x04) +#define FH_TCSR_BUFF_STTS(_channel) (FH_TCSR(_channel)+0x08) +/* TSSR */ +#define FH_TSSR_CBB_BASE (FH_TSSR_TABLE+0x000) +#define FH_TSSR_MSG_CONFIG (FH_TSSR_TABLE+0x008) +#define FH_TSSR_TX_STATUS (FH_TSSR_TABLE+0x010) +/* 18 - reserved */ + +/* card static random access memory (SRAM) for processor data and instructs */ +#define RTC_INST_LOWER_BOUND (0x000000) +#define RTC_DATA_LOWER_BOUND (0x800000) + + +/* DBM */ + +#define ALM_FH_SRVC_CHNL (6) + +#define ALM_FH_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20) +#define ALM_FH_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4) + +#define ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000) + +#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000) + +#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000) + +#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000) + +#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000) + +#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000) + +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001) + +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) + +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) + +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) + +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) +#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) + +#define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000) + +#define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001) + +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000) +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000) + +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400) + +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100) +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080) + +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020) +#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005) + +#define ALM_TB_MAX_BYTES_COUNT (0xFFF0) + +#define ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) \ + ((1LU << _channel) << 24) +#define ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel) \ + ((1LU << _channel) << 16) + +#define ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_channel) \ + (ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) | \ + ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel)) +#define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */ +#define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */ + +#define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004) + +#define TFD_QUEUE_MIN 0 +#define TFD_QUEUE_MAX 6 +#define TFD_QUEUE_SIZE_MAX (256) + +/* spectrum and channel data structures */ +#define IWL_NUM_SCAN_RATES (2) + +#define IWL_SCAN_FLAG_24GHZ (1<<0) +#define IWL_SCAN_FLAG_52GHZ (1<<1) +#define IWL_SCAN_FLAG_ACTIVE (1<<2) +#define IWL_SCAN_FLAG_DIRECT (1<<3) + +#define IWL_MAX_CMD_SIZE 1024 + +#define IWL_DEFAULT_TX_RETRY 15 +#define IWL_MAX_TX_RETRY 16 + +/*********************************************/ + +#define RFD_SIZE 4 +#define NUM_TFD_CHUNKS 4 + +#define RX_QUEUE_SIZE 256 +#define RX_QUEUE_MASK 255 +#define RX_QUEUE_SIZE_LOG 8 + +/* QoS definitions */ + +#define CW_MIN_OFDM 15 +#define CW_MAX_OFDM 1023 +#define CW_MIN_CCK 31 +#define CW_MAX_CCK 1023 + +#define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM +#define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM +#define QOS_TX2_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 2 - 1) +#define QOS_TX3_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 4 - 1) + +#define QOS_TX0_CW_MIN_CCK CW_MIN_CCK +#define QOS_TX1_CW_MIN_CCK CW_MIN_CCK +#define QOS_TX2_CW_MIN_CCK ((CW_MIN_CCK + 1) / 2 - 1) +#define QOS_TX3_CW_MIN_CCK ((CW_MIN_CCK + 1) / 4 - 1) + +#define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM +#define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM +#define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM +#define QOS_TX3_CW_MAX_OFDM ((CW_MIN_OFDM + 1) / 2 - 1) + +#define QOS_TX0_CW_MAX_CCK CW_MAX_CCK +#define QOS_TX1_CW_MAX_CCK CW_MAX_CCK +#define QOS_TX2_CW_MAX_CCK CW_MIN_CCK +#define QOS_TX3_CW_MAX_CCK ((CW_MIN_CCK + 1) / 2 - 1) + +#define QOS_TX0_AIFS 3 +#define QOS_TX1_AIFS 7 +#define QOS_TX2_AIFS 2 +#define QOS_TX3_AIFS 2 + +#define QOS_TX0_ACM 0 +#define QOS_TX1_ACM 0 +#define QOS_TX2_ACM 0 +#define QOS_TX3_ACM 0 + +#define QOS_TX0_TXOP_LIMIT_CCK 0 +#define QOS_TX1_TXOP_LIMIT_CCK 0 +#define QOS_TX2_TXOP_LIMIT_CCK 6016 +#define QOS_TX3_TXOP_LIMIT_CCK 3264 + +#define QOS_TX0_TXOP_LIMIT_OFDM 0 +#define QOS_TX1_TXOP_LIMIT_OFDM 0 +#define QOS_TX2_TXOP_LIMIT_OFDM 3008 +#define QOS_TX3_TXOP_LIMIT_OFDM 1504 + +#define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM +#define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM +#define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM +#define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM + +#define DEF_TX0_CW_MIN_CCK CW_MIN_CCK +#define DEF_TX1_CW_MIN_CCK CW_MIN_CCK +#define DEF_TX2_CW_MIN_CCK CW_MIN_CCK +#define DEF_TX3_CW_MIN_CCK CW_MIN_CCK + +#define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM +#define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM +#define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM +#define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM + +#define DEF_TX0_CW_MAX_CCK CW_MAX_CCK +#define DEF_TX1_CW_MAX_CCK CW_MAX_CCK +#define DEF_TX2_CW_MAX_CCK CW_MAX_CCK +#define DEF_TX3_CW_MAX_CCK CW_MAX_CCK + +#define DEF_TX0_AIFS (2) +#define DEF_TX1_AIFS (2) +#define DEF_TX2_AIFS (2) +#define DEF_TX3_AIFS (2) + +#define DEF_TX0_ACM 0 +#define DEF_TX1_ACM 0 +#define DEF_TX2_ACM 0 +#define DEF_TX3_ACM 0 + +#define DEF_TX0_TXOP_LIMIT_CCK 0 +#define DEF_TX1_TXOP_LIMIT_CCK 0 +#define DEF_TX2_TXOP_LIMIT_CCK 0 +#define DEF_TX3_TXOP_LIMIT_CCK 0 + +#define DEF_TX0_TXOP_LIMIT_OFDM 0 +#define DEF_TX1_TXOP_LIMIT_OFDM 0 +#define DEF_TX2_TXOP_LIMIT_OFDM 0 +#define DEF_TX3_TXOP_LIMIT_OFDM 0 + +#define QOS_QOS_SETS 3 +#define QOS_PARAM_SET_ACTIVE 0 +#define QOS_PARAM_SET_DEF_CCK 1 +#define QOS_PARAM_SET_DEF_OFDM 2 + +#define CTRL_QOS_NO_ACK (0x0020) +#define DCT_FLAG_EXT_QOS_ENABLED (0x10) + +#define U32_PAD(n) ((4-(n))&0x3) + +/* + * Generic queue structure + * + * Contains common data for Rx and Tx queues + */ +#define TFD_CTL_COUNT_SET(n) (n<<24) +#define TFD_CTL_COUNT_GET(ctl) ((ctl>>24) & 7) +#define TFD_CTL_PAD_SET(n) (n<<28) +#define TFD_CTL_PAD_GET(ctl) (ctl>>28) + +#define TFD_TX_CMD_SLOTS 256 +#define TFD_CMD_SLOTS 32 + +#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ + sizeof(struct iwl_cmd_meta)) + +/* + * RX related structures and functions + */ +#define RX_FREE_BUFFERS 64 +#define RX_LOW_WATERMARK 8 + + #define IWL_RX_BUF_SIZE (4 * 1024) #define IWL_MAX_BSM_SIZE BSM_SRAM_SIZE #define KDR_RTC_INST_UPPER_BOUND (0x018000) diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-io.h b/drivers/net/wireless/iwlwifi/iwl-4965-io.h new file mode 100644 index 00000000000..1ffa8f1e17c --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-4965-io.h @@ -0,0 +1,431 @@ +/****************************************************************************** + * + * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved. + * + * Portions of this file are derived from the ipw3945 project. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * The full GNU General Public License is included in this distribution in the + * file called LICENSE. + * + * Contact Information: + * James P. Ketrenos + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + *****************************************************************************/ + +#ifndef __iwl_io_h__ +#define __iwl_io_h__ + +#include + +#include "iwl-4965-debug.h" + +/* + * IO, register, and NIC memory access functions + * + * NOTE on naming convention and macro usage for these + * + * A single _ prefix before a an access function means that no state + * check or debug information is printed when that function is called. + * + * A double __ prefix before an access function means that state is checked + * and the current line number is printed in addition to any other debug output. + * + * The non-prefixed name is the #define that maps the caller into a + * #define that provides the caller's __LINE__ to the double prefix version. + * + * If you wish to call the function without any debug or state checking, + * you should use the single _ prefix version (as is used by dependent IO + * routines, for example _iwl_read_direct32 calls the non-check version of + * _iwl_read32.) + * + * These declarations are *extremely* useful in quickly isolating code deltas + * which result in misconfiguring of the hardware I/O. In combination with + * git-bisect and the IO debug level you can quickly determine the specific + * commit which breaks the IO sequence to the hardware. + * + */ + +#define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, + u32 ofs, u32 val) +{ + IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); + _iwl_write32(iwl, ofs, val); +} +#define iwl_write32(iwl, ofs, val) \ + __iwl_write32(__FILE__, __LINE__, iwl, ofs, val) +#else +#define iwl_write32(iwl, ofs, val) _iwl_write32(iwl, ofs, val) +#endif + +#define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) +#ifdef CONFIG_IWLWIFI_DEBUG +static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs) +{ + IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); + return _iwl_read32(iwl, ofs); +} +#define iwl_read32(iwl, ofs) __iwl_read32(__FILE__, __LINE__, iwl, ofs) +#else +#define iwl_read32(p, o) _iwl_read32(p, o) +#endif + +static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, + u32 bits, u32 mask, int timeout) +{ + int i = 0; + + do { + if ((_iwl_read32(priv, addr) & mask) == (bits & mask)) + return i; + mdelay(10); + i += 10; + } while (i < timeout); + + return -ETIMEDOUT; +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline int __iwl_poll_bit(const char *f, u32 l, + struct iwl_priv *priv, u32 addr, + u32 bits, u32 mask, int timeout) +{ + int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); + if (unlikely(ret == -ETIMEDOUT)) + IWL_DEBUG_IO + ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n", + addr, bits, mask, f, l); + else + IWL_DEBUG_IO + ("poll_bit(0x%08X, 0x%08X, 0x%08X) = 0x%08X - %s %d\n", + addr, bits, mask, ret, f, l); + return ret; +} +#define iwl_poll_bit(iwl, addr, bits, mask, timeout) \ + __iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) +#else +#define iwl_poll_bit(p, a, b, m, t) _iwl_poll_bit(p, a, b, m, t) +#endif + +static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) +{ + _iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_set_bit(const char *f, u32 l, + struct iwl_priv *priv, u32 reg, u32 mask) +{ + u32 val = _iwl_read32(priv, reg) | mask; + IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); + _iwl_write32(priv, reg, val); +} +#define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m) +#else +#define iwl_set_bit(p, r, m) _iwl_set_bit(p, r, m) +#endif + +static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) +{ + _iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_clear_bit(const char *f, u32 l, + struct iwl_priv *priv, u32 reg, u32 mask) +{ + u32 val = _iwl_read32(priv, reg) & ~mask; + IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); + _iwl_write32(priv, reg, val); +} +#define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m) +#else +#define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m) +#endif + +static inline int _iwl_grab_nic_access(struct iwl_priv *priv) +{ + int ret; + u32 gp_ctl; + +#ifdef CONFIG_IWLWIFI_DEBUG + if (atomic_read(&priv->restrict_refcnt)) + return 0; +#endif + if (test_bit(STATUS_RF_KILL_HW, &priv->status) || + test_bit(STATUS_RF_KILL_SW, &priv->status)) { + IWL_WARNING("WARNING: Requesting MAC access during RFKILL " + "wakes up NIC\n"); + + /* 10 msec allows time for NIC to complete its data save */ + gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL); + if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { + IWL_DEBUG_RF_KILL("Wait for complete power-down, " + "gpctl = 0x%08x\n", gp_ctl); + mdelay(10); + } else + IWL_DEBUG_RF_KILL("power-down complete, " + "gpctl = 0x%08x\n", gp_ctl); + } + + /* this bit wakes up the NIC */ + _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); + ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, + CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, + (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | + CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50); + if (ret < 0) { + IWL_ERROR("MAC is in deep sleep!\n"); + return -EIO; + } + +#ifdef CONFIG_IWLWIFI_DEBUG + atomic_inc(&priv->restrict_refcnt); +#endif + return 0; +} + +#ifdef CONFIG_IWLWIFI_DEBUG +static inline int __iwl_grab_nic_access(const char *f, u32 l, + struct iwl_priv *priv) +{ + if (atomic_read(&priv->restrict_refcnt)) + IWL_DEBUG_INFO("Grabbing access while already held at " + "line %d.\n", l); + + IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l); + return _iwl_grab_nic_access(priv); +} +#define iwl_grab_nic_access(priv) \ + __iwl_grab_nic_access(__FILE__, __LINE__, priv) +#else +#define iwl_grab_nic_access(priv) \ + _iwl_grab_nic_access(priv) +#endif + +static inline void _iwl_release_nic_access(struct iwl_priv *priv) +{ +#ifdef CONFIG_IWLWIFI_DEBUG + if (atomic_dec_and_test(&priv->restrict_refcnt)) +#endif + _iwl_clear_bit(priv, CSR_GP_CNTRL, + CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_release_nic_access(const char *f, u32 l, + struct iwl_priv *priv) +{ + if (atomic_read(&priv->restrict_refcnt) <= 0) + IWL_ERROR("Release unheld nic access at line %d.\n", l); + + IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l); + _iwl_release_nic_access(priv); +} +#define iwl_release_nic_access(priv) \ + __iwl_release_nic_access(__FILE__, __LINE__, priv) +#else +#define iwl_release_nic_access(priv) \ + _iwl_release_nic_access(priv) +#endif + +static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) +{ + return _iwl_read32(priv, reg); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline u32 __iwl_read_direct32(const char *f, u32 l, + struct iwl_priv *priv, u32 reg) +{ + u32 value = _iwl_read_direct32(priv, reg); + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access not held from %s %d\n", f, l); + IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value, + f, l); + return value; +} +#define iwl_read_direct32(priv, reg) \ + __iwl_read_direct32(__FILE__, __LINE__, priv, reg) +#else +#define iwl_read_direct32 _iwl_read_direct32 +#endif + +static inline void _iwl_write_direct32(struct iwl_priv *priv, + u32 reg, u32 value) +{ + _iwl_write32(priv, reg, value); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static void __iwl_write_direct32(u32 line, + struct iwl_priv *priv, u32 reg, u32 value) +{ + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access not held from line %d\n", line); + _iwl_write_direct32(priv, reg, value); +} +#define iwl_write_direct32(priv, reg, value) \ + __iwl_write_direct32(__LINE__, priv, reg, value) +#else +#define iwl_write_direct32 _iwl_write_direct32 +#endif + +static inline void iwl_write_reg_buf(struct iwl_priv *priv, + u32 reg, u32 len, u32 *values) +{ + u32 count = sizeof(u32); + + if ((priv != NULL) && (values != NULL)) { + for (; 0 < len; len -= count, reg += count, values++) + _iwl_write_direct32(priv, reg, *values); + } +} + +static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, + u32 addr, u32 mask, int timeout) +{ + int i = 0; + + do { + if ((_iwl_read_direct32(priv, addr) & mask) == mask) + return i; + mdelay(10); + i += 10; + } while (i < timeout); + + return -ETIMEDOUT; +} + +#ifdef CONFIG_IWLWIFI_DEBUG +static inline int __iwl_poll_direct_bit(const char *f, u32 l, + struct iwl_priv *priv, + u32 addr, u32 mask, int timeout) +{ + int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout); + + if (unlikely(ret == -ETIMEDOUT)) + IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - " + "timedout - %s %d\n", addr, mask, f, l); + else + IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) = 0x%08X " + "- %s %d\n", addr, mask, ret, f, l); + return ret; +} +#define iwl_poll_direct_bit(iwl, addr, mask, timeout) \ + __iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) +#else +#define iwl_poll_direct_bit _iwl_poll_direct_bit +#endif + +static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) +{ + _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); + return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) +{ + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access not held from line %d\n", line); + return _iwl_read_prph(priv, reg); +} + +#define iwl_read_prph(priv, reg) \ + __iwl_read_prph(__LINE__, priv, reg) +#else +#define iwl_read_prph _iwl_read_prph +#endif + +static inline void _iwl_write_prph(struct iwl_priv *priv, + u32 addr, u32 val) +{ + _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, + ((addr & 0x0000FFFF) | (3 << 24))); + _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); +} +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, + u32 addr, u32 val) +{ + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access from line %d\n", line); + _iwl_write_prph(priv, addr, val); +} + +#define iwl_write_prph(priv, addr, val) \ + __iwl_write_prph(__LINE__, priv, addr, val); +#else +#define iwl_write_prph _iwl_write_prph +#endif + +#define _iwl_set_bits_prph(priv, reg, mask) \ + _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, + u32 reg, u32 mask) +{ + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access not held from line %d\n", line); + + _iwl_set_bits_prph(priv, reg, mask); +} +#define iwl_set_bits_prph(priv, reg, mask) \ + __iwl_set_bits_prph(__LINE__, priv, reg, mask) +#else +#define iwl_set_bits_prph _iwl_set_bits_prph +#endif + +#define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ + _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) + +#ifdef CONFIG_IWLWIFI_DEBUG +static inline void __iwl_set_bits_mask_prph(u32 line, + struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) +{ + if (!atomic_read(&priv->restrict_refcnt)) + IWL_ERROR("Nic access not held from line %d\n", line); + _iwl_set_bits_mask_prph(priv, reg, bits, mask); +} +#define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ + __iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) +#else +#define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph +#endif + +static inline void iwl_clear_bits_prph(struct iwl_priv + *priv, u32 reg, u32 mask) +{ + u32 val = _iwl_read_prph(priv, reg); + _iwl_write_prph(priv, reg, (val & ~mask)); +} + +static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) +{ + iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); + return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); +} + +static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) +{ + iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); +} + +static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, + u32 len, u32 *values) +{ + iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + for (; 0 < len; len -= sizeof(u32), values++) + iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); +} +#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index b557faa6ff0..0e384e60648 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c @@ -36,11 +36,9 @@ #include -#define IWL 4965 - #include "../net/mac80211/ieee80211_rate.h" -#include "iwlwifi.h" +#include "iwl-4965.h" #include "iwl-helpers.h" #define RS_NAME "iwl-4965-rs" diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 28f7aa802fd..f8f77fe4128 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -37,9 +37,6 @@ #include #include -#define IWL 4965 - -#include "iwlwifi.h" #include "iwl-4965.h" #include "iwl-helpers.h" diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index b31a7e4b7d7..bf174d3b8fb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -26,6 +26,707 @@ #ifndef __iwl_4965_h__ #define __iwl_4965_h__ +#include /* for struct pci_device_id */ +#include +#include + +struct iwl_priv; + +/* Hardware specific file defines the PCI IDs table for that hardware module */ +extern struct pci_device_id iwl_hw_card_ids[]; + +#define DRV_NAME "iwl4965" +#include "iwl-4965-hw.h" +#include "iwl-prph.h" +#include "iwl-4965-debug.h" + +/* Default noise level to report when noise measurement is not available. + * This may be because we're: + * 1) Not associated (4965, no beacon statistics being sent to driver) + * 2) Scanning (noise measurement does not apply to associated channel) + * 3) Receiving CCK (3945 delivers noise info only for OFDM frames) + * Use default noise value of -127 ... this is below the range of measurable + * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user. + * Also, -127 works better than 0 when averaging frames with/without + * noise info (e.g. averaging might be done in app); measured dBm values are + * always negative ... using a negative value as the default keeps all + * averages within an s8's (used in some apps) range of negative values. */ +#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) + +/* Module parameters accessible from iwl-*.c */ +extern int iwl_param_hwcrypto; +extern int iwl_param_queues_num; + +enum iwl_antenna { + IWL_ANTENNA_DIVERSITY, + IWL_ANTENNA_MAIN, + IWL_ANTENNA_AUX +}; + +/* + * RTS threshold here is total size [2347] minus 4 FCS bytes + * Per spec: + * a value of 0 means RTS on all data/management packets + * a value > max MSDU size means no RTS + * else RTS for data/management frames where MPDU is larger + * than RTS value. + */ +#define DEFAULT_RTS_THRESHOLD 2347U +#define MIN_RTS_THRESHOLD 0U +#define MAX_RTS_THRESHOLD 2347U +#define MAX_MSDU_SIZE 2304U +#define MAX_MPDU_SIZE 2346U +#define DEFAULT_BEACON_INTERVAL 100U +#define DEFAULT_SHORT_RETRY_LIMIT 7U +#define DEFAULT_LONG_RETRY_LIMIT 4U + +struct iwl_rx_mem_buffer { + dma_addr_t dma_addr; + struct sk_buff *skb; + struct list_head list; +}; + +struct iwl_rt_rx_hdr { + struct ieee80211_radiotap_header rt_hdr; + __le64 rt_tsf; /* TSF */ + u8 rt_flags; /* radiotap packet flags */ + u8 rt_rate; /* rate in 500kb/s */ + __le16 rt_channelMHz; /* channel in MHz */ + __le16 rt_chbitmask; /* channel bitfield */ + s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ + s8 rt_dbmnoise; + u8 rt_antenna; /* antenna number */ + u8 payload[0]; /* payload... */ +} __attribute__ ((packed)); + +struct iwl_rt_tx_hdr { + struct ieee80211_radiotap_header rt_hdr; + u8 rt_rate; /* rate in 500kb/s */ + __le16 rt_channel; /* channel in mHz */ + __le16 rt_chbitmask; /* channel bitfield */ + s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ + u8 rt_antenna; /* antenna number */ + u8 payload[0]; /* payload... */ +} __attribute__ ((packed)); + +/* + * Generic queue structure + * + * Contains common data for Rx and Tx queues + */ +struct iwl_queue { + int n_bd; /* number of BDs in this queue */ + int write_ptr; /* 1-st empty entry (index) host_w*/ + int read_ptr; /* last used entry (index) host_r*/ + dma_addr_t dma_addr; /* physical addr for BD's */ + int n_window; /* safe queue window */ + u32 id; + int low_mark; /* low watermark, resume queue if free + * space more than this */ + int high_mark; /* high watermark, stop queue if free + * space less than this */ +} __attribute__ ((packed)); + +#define MAX_NUM_OF_TBS (20) + +struct iwl_tx_info { + struct ieee80211_tx_status status; + struct sk_buff *skb[MAX_NUM_OF_TBS]; +}; + +/** + * struct iwl_tx_queue - Tx Queue for DMA + * @need_update: need to update read/write index + * @shed_retry: queue is HT AGG enabled + * + * Queue consists of circular buffer of BD's and required locking structures. + */ +struct iwl_tx_queue { + struct iwl_queue q; + struct iwl_tfd_frame *bd; + struct iwl_cmd *cmd; + dma_addr_t dma_addr_cmd; + struct iwl_tx_info *txb; + int need_update; + int sched_retry; + int active; +}; + +#define IWL_NUM_SCAN_RATES (2) + +struct iwl_channel_tgd_info { + u8 type; + s8 max_power; +}; + +struct iwl_channel_tgh_info { + s64 last_radar_time; +}; + +/* current Tx power values to use, one for each rate for each channel. + * requested power is limited by: + * -- regulatory EEPROM limits for this channel + * -- hardware capabilities (clip-powers) + * -- spectrum management + * -- user preference (e.g. iwconfig) + * when requested power is set, base power index must also be set. */ +struct iwl_channel_power_info { + struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ + s8 power_table_index; /* actual (compenst'd) index into gain table */ + s8 base_power_index; /* gain index for power at factory temp. */ + s8 requested_power; /* power (dBm) requested for this chnl/rate */ +}; + +/* current scan Tx power values to use, one for each scan rate for each + * channel. */ +struct iwl_scan_power_info { + struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ + s8 power_table_index; /* actual (compenst'd) index into gain table */ + s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ +}; + +/* Channel unlock period is 15 seconds. If no beacon or probe response + * has been received within 15 seconds on a locked channel then the channel + * remains locked. */ +#define TX_UNLOCK_PERIOD 15 + +/* CSA lock period is 15 seconds. If a CSA has been received on a channel in + * the last 15 seconds, the channel is locked */ +#define CSA_LOCK_PERIOD 15 +/* + * One for each channel, holds all channel setup data + * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant + * with one another! + */ +#define IWL4965_MAX_RATE (33) + +struct iwl_channel_info { + struct iwl_channel_tgd_info tgd; + struct iwl_channel_tgh_info tgh; + struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ + struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for + * FAT channel */ + + u8 channel; /* channel number */ + u8 flags; /* flags copied from EEPROM */ + s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ + s8 curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) */ + s8 min_power; /* always 0 */ + s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */ + + u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */ + u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */ + u8 phymode; /* MODE_IEEE80211{A,B,G} */ + + /* Radio/DSP gain settings for each "normal" data Tx rate. + * These include, in addition to RF and DSP gain, a few fields for + * remembering/modifying gain settings (indexes). */ + struct iwl_channel_power_info power_info[IWL4965_MAX_RATE]; + + /* FAT channel info */ + s8 fat_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ + s8 fat_curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) */ + s8 fat_min_power; /* always 0 */ + s8 fat_scan_power; /* (dBm) eeprom, direct scans, any rate */ + u8 fat_flags; /* flags copied from EEPROM */ + u8 fat_extension_channel; + + /* Radio/DSP gain settings for each scan rate, for directed scans. */ + struct iwl_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; +}; + +struct iwl_clip_group { + /* maximum power level to prevent clipping for each rate, derived by + * us from this band's saturation power in EEPROM */ + const s8 clip_powers[IWL_MAX_RATES]; +}; + +#include "iwl-4965-rs.h" + +#define IWL_TX_FIFO_AC0 0 +#define IWL_TX_FIFO_AC1 1 +#define IWL_TX_FIFO_AC2 2 +#define IWL_TX_FIFO_AC3 3 +#define IWL_TX_FIFO_HCCA_1 5 +#define IWL_TX_FIFO_HCCA_2 6 +#define IWL_TX_FIFO_NONE 7 + +/* Minimum number of queues. MAX_NUM is defined in hw specific files */ +#define IWL_MIN_NUM_QUEUES 4 + +/* Power management (not Tx power) structures */ + +struct iwl_power_vec_entry { + struct iwl_powertable_cmd cmd; + u8 no_dtim; +}; +#define IWL_POWER_RANGE_0 (0) +#define IWL_POWER_RANGE_1 (1) + +#define IWL_POWER_MODE_CAM 0x00 /* Continuously Aware Mode, always on */ +#define IWL_POWER_INDEX_3 0x03 +#define IWL_POWER_INDEX_5 0x05 +#define IWL_POWER_AC 0x06 +#define IWL_POWER_BATTERY 0x07 +#define IWL_POWER_LIMIT 0x07 +#define IWL_POWER_MASK 0x0F +#define IWL_POWER_ENABLED 0x10 +#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK) + +struct iwl_power_mgr { + spinlock_t lock; + struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC]; + struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC]; + u8 active_index; + u32 dtim_val; +}; + +#define IEEE80211_DATA_LEN 2304 +#define IEEE80211_4ADDR_LEN 30 +#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) +#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) + +struct iwl_frame { + union { + struct ieee80211_hdr frame; + struct iwl_tx_beacon_cmd beacon; + u8 raw[IEEE80211_FRAME_LEN]; + u8 cmd[360]; + } u; + struct list_head list; +}; + +#define SEQ_TO_QUEUE(x) ((x >> 8) & 0xbf) +#define QUEUE_TO_SEQ(x) ((x & 0xbf) << 8) +#define SEQ_TO_INDEX(x) (x & 0xff) +#define INDEX_TO_SEQ(x) (x & 0xff) +#define SEQ_HUGE_FRAME (0x4000) +#define SEQ_RX_FRAME __constant_cpu_to_le16(0x8000) +#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) +#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) +#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) + +enum { + /* CMD_SIZE_NORMAL = 0, */ + CMD_SIZE_HUGE = (1 << 0), + /* CMD_SYNC = 0, */ + CMD_ASYNC = (1 << 1), + /* CMD_NO_SKB = 0, */ + CMD_WANT_SKB = (1 << 2), +}; + +struct iwl_cmd; +struct iwl_priv; + +struct iwl_cmd_meta { + struct iwl_cmd_meta *source; + union { + struct sk_buff *skb; + int (*callback)(struct iwl_priv *priv, + struct iwl_cmd *cmd, struct sk_buff *skb); + } __attribute__ ((packed)) u; + + /* The CMD_SIZE_HUGE flag bit indicates that the command + * structure is stored at the end of the shared queue memory. */ + u32 flags; + +} __attribute__ ((packed)); + +struct iwl_cmd { + struct iwl_cmd_meta meta; + struct iwl_cmd_header hdr; + union { + struct iwl_addsta_cmd addsta; + struct iwl_led_cmd led; + u32 flags; + u8 val8; + u16 val16; + u32 val32; + struct iwl_bt_cmd bt; + struct iwl_rxon_time_cmd rxon_time; + struct iwl_powertable_cmd powertable; + struct iwl_qosparam_cmd qosparam; + struct iwl_tx_cmd tx; + struct iwl_tx_beacon_cmd tx_beacon; + struct iwl_rxon_assoc_cmd rxon_assoc; + u8 *indirect; + u8 payload[360]; + } __attribute__ ((packed)) cmd; +} __attribute__ ((packed)); + +struct iwl_host_cmd { + u8 id; + u16 len; + struct iwl_cmd_meta meta; + const void *data; +}; + +#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ + sizeof(struct iwl_cmd_meta)) + +/* + * RX related structures and functions + */ +#define RX_FREE_BUFFERS 64 +#define RX_LOW_WATERMARK 8 + +#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 +#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 +#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 + +/** + * struct iwl_rx_queue - Rx queue + * @processed: Internal index to last handled Rx packet + * @read: Shared index to newest available Rx buffer + * @write: Shared index to oldest written Rx packet + * @free_count: Number of pre-allocated buffers in rx_free + * @rx_free: list of free SKBs for use + * @rx_used: List of Rx buffers with no SKB + * @need_update: flag to indicate we need to update read/write index + * + * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers + */ +struct iwl_rx_queue { + __le32 *bd; + dma_addr_t dma_addr; + struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; + struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; + u32 processed; + u32 read; + u32 write; + u32 free_count; + struct list_head rx_free; + struct list_head rx_used; + int need_update; + spinlock_t lock; +}; + +#define IWL_SUPPORTED_RATES_IE_LEN 8 + +#define SCAN_INTERVAL 100 + +#define MAX_A_CHANNELS 252 +#define MIN_A_CHANNELS 7 + +#define MAX_B_CHANNELS 14 +#define MIN_B_CHANNELS 1 + +#define STATUS_HCMD_ACTIVE 0 /* host command in progress */ +#define STATUS_INT_ENABLED 1 +#define STATUS_RF_KILL_HW 2 +#define STATUS_RF_KILL_SW 3 +#define STATUS_INIT 4 +#define STATUS_ALIVE 5 +#define STATUS_READY 6 +#define STATUS_TEMPERATURE 7 +#define STATUS_GEO_CONFIGURED 8 +#define STATUS_EXIT_PENDING 9 +#define STATUS_IN_SUSPEND 10 +#define STATUS_STATISTICS 11 +#define STATUS_SCANNING 12 +#define STATUS_SCAN_ABORTING 13 +#define STATUS_SCAN_HW 14 +#define STATUS_POWER_PMI 15 +#define STATUS_FW_ERROR 16 + +#define MAX_TID_COUNT 9 + +#define IWL_INVALID_RATE 0xFF +#define IWL_INVALID_VALUE -1 + +#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWLWIFI_HT_AGG +struct iwl_ht_agg { + u16 txq_id; + u16 frame_count; + u16 wait_for_ba; + u16 start_idx; + u32 bitmap0; + u32 bitmap1; + u32 rate_n_flags; +}; +#endif /* CONFIG_IWLWIFI_HT_AGG */ +#endif /* CONFIG_IWLWIFI_HT */ + +struct iwl_tid_data { + u16 seq_number; +#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWLWIFI_HT_AGG + struct iwl_ht_agg agg; +#endif /* CONFIG_IWLWIFI_HT_AGG */ +#endif /* CONFIG_IWLWIFI_HT */ +}; + +struct iwl_hw_key { + enum ieee80211_key_alg alg; + int keylen; + u8 key[32]; +}; + +union iwl_ht_rate_supp { + u16 rates; + struct { + u8 siso_rate; + u8 mimo_rate; + }; +}; + +#ifdef CONFIG_IWLWIFI_HT +#define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) +#define HT_IE_MAX_AMSDU_SIZE_4K (0) +#define CFG_HT_MPDU_DENSITY_2USEC (0x5) +#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC + +struct sta_ht_info { + u8 is_ht; + u16 rx_mimo_ps_mode; + u16 tx_mimo_ps_mode; + u16 control_channel; + u8 max_amsdu_size; + u8 ampdu_factor; + u8 mpdu_density; + u8 operating_mode; + u8 supported_chan_width; + u8 extension_chan_offset; + u8 is_green_field; + u8 sgf; + u8 supp_rates[16]; + u8 tx_chan_width; + u8 chan_width_cap; +}; +#endif /*CONFIG_IWLWIFI_HT */ + +#ifdef CONFIG_IWLWIFI_QOS + +union iwl_qos_capabity { + struct { + u8 edca_count:4; /* bit 0-3 */ + u8 q_ack:1; /* bit 4 */ + u8 queue_request:1; /* bit 5 */ + u8 txop_request:1; /* bit 6 */ + u8 reserved:1; /* bit 7 */ + } q_AP; + struct { + u8 acvo_APSD:1; /* bit 0 */ + u8 acvi_APSD:1; /* bit 1 */ + u8 ac_bk_APSD:1; /* bit 2 */ + u8 ac_be_APSD:1; /* bit 3 */ + u8 q_ack:1; /* bit 4 */ + u8 max_len:2; /* bit 5-6 */ + u8 more_data_ack:1; /* bit 7 */ + } q_STA; + u8 val; +}; + +/* QoS structures */ +struct iwl_qos_info { + int qos_enable; + int qos_active; + union iwl_qos_capabity qos_cap; + struct iwl_qosparam_cmd def_qos_parm; +}; +#endif /*CONFIG_IWLWIFI_QOS */ + +#define STA_PS_STATUS_WAKE 0 +#define STA_PS_STATUS_SLEEP 1 + +struct iwl_station_entry { + struct iwl_addsta_cmd sta; + struct iwl_tid_data tid[MAX_TID_COUNT]; + u8 used; + u8 ps_status; + struct iwl_hw_key keyinfo; +}; + +/* one for each uCode image (inst/data, boot/init/runtime) */ +struct fw_desc { + void *v_addr; /* access by driver */ + dma_addr_t p_addr; /* access by card's busmaster DMA */ + u32 len; /* bytes */ +}; + +/* uCode file layout */ +struct iwl_ucode { + __le32 ver; /* major/minor/subminor */ + __le32 inst_size; /* bytes of runtime instructions */ + __le32 data_size; /* bytes of runtime data */ + __le32 init_size; /* bytes of initialization instructions */ + __le32 init_data_size; /* bytes of initialization data */ + __le32 boot_size; /* bytes of bootstrap instructions */ + u8 data[0]; /* data in same order as "size" elements */ +}; + +#define IWL_IBSS_MAC_HASH_SIZE 32 + +struct iwl_ibss_seq { + u8 mac[ETH_ALEN]; + u16 seq_num; + u16 frag_num; + unsigned long packet_time; + struct list_head list; +}; + +struct iwl_driver_hw_info { + u16 max_txq_num; + u16 ac_queue_count; + u16 tx_cmd_len; + u16 max_rxq_size; + u32 rx_buffer_size; + u16 max_rxq_log; + u8 max_stations; + u8 bcast_sta_id; + void *shared_virt; + dma_addr_t shared_phys; +}; + + +#define STA_FLG_RTS_MIMO_PROT_MSK __constant_cpu_to_le32(1 << 17) +#define STA_FLG_AGG_MPDU_8US_MSK __constant_cpu_to_le32(1 << 18) +#define STA_FLG_MAX_AGG_SIZE_POS (19) +#define STA_FLG_MAX_AGG_SIZE_MSK __constant_cpu_to_le32(3 << 19) +#define STA_FLG_FAT_EN_MSK __constant_cpu_to_le32(1 << 21) +#define STA_FLG_MIMO_DIS_MSK __constant_cpu_to_le32(1 << 22) +#define STA_FLG_AGG_MPDU_DENSITY_POS (23) +#define STA_FLG_AGG_MPDU_DENSITY_MSK __constant_cpu_to_le32(7 << 23) +#define HT_SHORT_GI_20MHZ_ONLY (1 << 0) +#define HT_SHORT_GI_40MHZ_ONLY (1 << 1) + + +#define IWL_RX_HDR(x) ((struct iwl_rx_frame_hdr *)(\ + x->u.rx_frame.stats.payload + \ + x->u.rx_frame.stats.phy_count)) +#define IWL_RX_END(x) ((struct iwl_rx_frame_end *)(\ + IWL_RX_HDR(x)->payload + \ + le16_to_cpu(IWL_RX_HDR(x)->len))) +#define IWL_RX_STATS(x) (&x->u.rx_frame.stats) +#define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload) + + +/****************************************************************************** + * + * Functions implemented in iwl-base.c which are forward declared here + * for use by iwl-*.c + * + *****************************************************************************/ +struct iwl_addsta_cmd; +extern int iwl_send_add_station(struct iwl_priv *priv, + struct iwl_addsta_cmd *sta, u8 flags); +extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid, + int is_ap, u8 flags); +extern int iwl_is_network_packet(struct iwl_priv *priv, + struct ieee80211_hdr *header); +extern int iwl_power_init_handle(struct iwl_priv *priv); +extern int iwl_eeprom_init(struct iwl_priv *priv); +#ifdef CONFIG_IWLWIFI_DEBUG +extern void iwl_report_frame(struct iwl_priv *priv, + struct iwl_rx_packet *pkt, + struct ieee80211_hdr *header, int group100); +#else +static inline void iwl_report_frame(struct iwl_priv *priv, + struct iwl_rx_packet *pkt, + struct ieee80211_hdr *header, + int group100) {} +#endif +extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv, + struct iwl_rx_mem_buffer *rxb, + void *data, short len, + struct ieee80211_rx_status *stats, + u16 phy_flags); +extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr + *header); +extern int iwl_rx_queue_alloc(struct iwl_priv *priv); +extern void iwl_rx_queue_reset(struct iwl_priv *priv, + struct iwl_rx_queue *rxq); +extern int iwl_calc_db_from_ratio(int sig_ratio); +extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm); +extern int iwl_tx_queue_init(struct iwl_priv *priv, + struct iwl_tx_queue *txq, int count, u32 id); +extern void iwl_rx_replenish(void *data); +extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); +extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, + const void *data); +extern int __must_check iwl_send_cmd(struct iwl_priv *priv, + struct iwl_host_cmd *cmd); +extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, + struct ieee80211_hdr *hdr, + const u8 *dest, int left); +extern int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, + struct iwl_rx_queue *q); +extern int iwl_send_statistics_request(struct iwl_priv *priv); +extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, + u32 decrypt_res, + struct ieee80211_rx_status *stats); +extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr); + +extern const u8 BROADCAST_ADDR[ETH_ALEN]; + +/* + * Currently used by iwl-3945-rs... look at restructuring so that it doesn't + * call this... todo... fix that. +*/ +extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id, + u16 tx_rate, u8 flags); + +/****************************************************************************** + * + * Functions implemented in iwl-[34]*.c which are forward declared here + * for use by iwl-base.c + * + * NOTE: The implementation of these functions are hardware specific + * which is why they are in the hardware specific files (vs. iwl-base.c) + * + * Naming convention -- + * iwl_ <-- Its part of iwlwifi (should be changed to iwl_) + * iwl_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) + * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) + * iwl_bg_ <-- Called from work queue context + * iwl_mac_ <-- mac80211 callback + * + ****************************************************************************/ +extern void iwl_hw_rx_handler_setup(struct iwl_priv *priv); +extern void iwl_hw_setup_deferred_work(struct iwl_priv *priv); +extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv); +extern int iwl_hw_rxq_stop(struct iwl_priv *priv); +extern int iwl_hw_set_hw_setting(struct iwl_priv *priv); +extern int iwl_hw_nic_init(struct iwl_priv *priv); +extern int iwl_hw_nic_stop_master(struct iwl_priv *priv); +extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv); +extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv); +extern int iwl_hw_nic_reset(struct iwl_priv *priv); +extern int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd, + dma_addr_t addr, u16 len); +extern int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); +extern int iwl_hw_get_temperature(struct iwl_priv *priv); +extern int iwl_hw_tx_queue_init(struct iwl_priv *priv, + struct iwl_tx_queue *txq); +extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, + struct iwl_frame *frame, u8 rate); +extern int iwl_hw_get_rx_read(struct iwl_priv *priv); +extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, + struct iwl_cmd *cmd, + struct ieee80211_tx_control *ctrl, + struct ieee80211_hdr *hdr, + int sta_id, int tx_id); +extern int iwl_hw_reg_send_txpower(struct iwl_priv *priv); +extern int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); +extern void iwl_hw_rx_statistics(struct iwl_priv *priv, + struct iwl_rx_mem_buffer *rxb); +extern void iwl_disable_events(struct iwl_priv *priv); +extern int iwl4965_get_temperature(const struct iwl_priv *priv); + +/** + * iwl_hw_find_station - Find station id for a given BSSID + * @bssid: MAC address of station ID to find + * + * NOTE: This should not be hardware specific but the code has + * not yet been merged into a single common layer for managing the + * station tables. + */ +extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid); + +extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel); +extern int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index); + struct iwl_priv; struct sta_ht_info; @@ -338,4 +1039,322 @@ struct iwl_chain_noise_data { #define EEPROM_SEM_TIMEOUT 10 #define EEPROM_SEM_RETRY_LIMIT 1000 + +#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT + +enum { + MEASUREMENT_READY = (1 << 0), + MEASUREMENT_ACTIVE = (1 << 1), +}; + +#endif + +struct iwl_priv { + + /* ieee device used by generic ieee processing code */ + struct ieee80211_hw *hw; + struct ieee80211_channel *ieee_channels; + struct ieee80211_rate *ieee_rates; + + /* temporary frame storage list */ + struct list_head free_frames; + int frames_count; + + u8 phymode; + int alloc_rxb_skb; + + void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, + struct iwl_rx_mem_buffer *rxb); + + const struct ieee80211_hw_mode *modes; + +#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT + /* spectrum measurement report caching */ + struct iwl_spectrum_notification measure_report; + u8 measurement_status; +#endif + /* ucode beacon time */ + u32 ucode_beacon_time; + + /* we allocate array of iwl_channel_info for NIC's valid channels. + * Access via channel # using indirect index array */ + struct iwl_channel_info *channel_info; /* channel info array */ + u8 channel_count; /* # of channels */ + + /* each calibration channel group in the EEPROM has a derived + * clip setting for each rate. */ + const struct iwl_clip_group clip_groups[5]; + + /* thermal calibration */ + s32 temperature; /* degrees Kelvin */ + s32 last_temperature; + + /* Scan related variables */ + unsigned long last_scan_jiffies; + unsigned long scan_start; + unsigned long scan_pass_start; + unsigned long scan_start_tsf; + int scan_bands; + int one_direct_scan; + u8 direct_ssid_len; + u8 direct_ssid[IW_ESSID_MAX_SIZE]; + struct iwl_scan_cmd *scan; + u8 only_active_channel; + + /* spinlock */ + spinlock_t lock; /* protect general shared data */ + spinlock_t hcmd_lock; /* protect hcmd */ + struct mutex mutex; + + /* basic pci-network driver stuff */ + struct pci_dev *pci_dev; + + /* pci hardware address support */ + void __iomem *hw_base; + + /* uCode images, save to reload in case of failure */ + struct fw_desc ucode_code; /* runtime inst */ + struct fw_desc ucode_data; /* runtime data original */ + struct fw_desc ucode_data_backup; /* runtime data save/restore */ + struct fw_desc ucode_init; /* initialization inst */ + struct fw_desc ucode_init_data; /* initialization data */ + struct fw_desc ucode_boot; /* bootstrap inst */ + + + struct iwl_rxon_time_cmd rxon_timing; + + /* We declare this const so it can only be + * changed via explicit cast within the + * routines that actually update the physical + * hardware */ + const struct iwl_rxon_cmd active_rxon; + struct iwl_rxon_cmd staging_rxon; + + int error_recovering; + struct iwl_rxon_cmd recovery_rxon; + + /* 1st responses from initialize and runtime uCode images. + * 4965's initialize alive response contains some calibration data. */ + struct iwl_init_alive_resp card_alive_init; + struct iwl_alive_resp card_alive; + +#ifdef LED + /* LED related variables */ + struct iwl_activity_blink activity; + unsigned long led_packets; + int led_state; +#endif + + u16 active_rate; + u16 active_rate_basic; + + u8 call_post_assoc_from_beacon; + u8 assoc_station_added; + u8 use_ant_b_for_management_frame; /* Tx antenna selection */ + /* HT variables */ + u8 is_dup; + u8 is_ht_enabled; + u8 channel_width; /* 0=20MHZ, 1=40MHZ */ + u8 current_channel_width; + u8 valid_antenna; /* Bit mask of antennas actually connected */ +#ifdef CONFIG_IWLWIFI_SENSITIVITY + struct iwl_sensitivity_data sensitivity_data; + struct iwl_chain_noise_data chain_noise_data; + u8 start_calib; + __le16 sensitivity_tbl[HD_TABLE_SIZE]; +#endif /*CONFIG_IWLWIFI_SENSITIVITY*/ + +#ifdef CONFIG_IWLWIFI_HT + struct sta_ht_info current_assoc_ht; +#endif + u8 active_rate_ht[2]; + u8 last_phy_res[100]; + + /* Rate scaling data */ + struct iwl_lq_mngr lq_mngr; + + /* Rate scaling data */ + s8 data_retry_limit; + u8 retry_rate; + + wait_queue_head_t wait_command_queue; + + int activity_timer_active; + + /* Rx and Tx DMA processing queues */ + struct iwl_rx_queue rxq; + struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; + unsigned long txq_ctx_active_msk; + struct iwl_kw kw; /* keep warm address */ + u32 scd_base_addr; /* scheduler sram base address */ + + unsigned long status; + u32 config; + + int last_rx_rssi; /* From Rx packet statisitics */ + int last_rx_noise; /* From beacon statistics */ + + struct iwl_power_mgr power_data; + + struct iwl_notif_statistics statistics; + unsigned long last_statistics_time; + + /* context information */ + u8 essid[IW_ESSID_MAX_SIZE]; + u8 essid_len; + u16 rates_mask; + + u32 power_mode; + u32 antenna; + u8 bssid[ETH_ALEN]; + u16 rts_threshold; + u8 mac_addr[ETH_ALEN]; + + /*station table variables */ + spinlock_t sta_lock; + int num_stations; + struct iwl_station_entry stations[IWL_STATION_COUNT]; + + /* Indication if ieee80211_ops->open has been called */ + int is_open; + + u8 mac80211_registered; + int is_abg; + + u32 notif_missed_beacons; + + /* Rx'd packet timing information */ + u32 last_beacon_time; + u64 last_tsf; + + /* Duplicate packet detection */ + u16 last_seq_num; + u16 last_frag_num; + unsigned long last_packet_time; + struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE]; + + /* eeprom */ + struct iwl_eeprom eeprom; + + int iw_mode; + + struct sk_buff *ibss_beacon; + + /* Last Rx'd beacon timestamp */ + u32 timestamp0; + u32 timestamp1; + u16 beacon_int; + struct iwl_driver_hw_info hw_setting; + int interface_id; + + /* Current association information needed to configure the + * hardware */ + u16 assoc_id; + u16 assoc_capability; + u8 ps_mode; + +#ifdef CONFIG_IWLWIFI_QOS + struct iwl_qos_info qos_data; +#endif /*CONFIG_IWLWIFI_QOS */ + + struct workqueue_struct *workqueue; + + struct work_struct up; + struct work_struct restart; + struct work_struct calibrated_work; + struct work_struct scan_completed; + struct work_struct rx_replenish; + struct work_struct rf_kill; + struct work_struct abort_scan; + struct work_struct update_link_led; + struct work_struct auth_work; + struct work_struct report_work; + struct work_struct request_scan; + struct work_struct beacon_update; + + struct tasklet_struct irq_tasklet; + + struct delayed_work init_alive_start; + struct delayed_work alive_start; + struct delayed_work activity_timer; + struct delayed_work thermal_periodic; + struct delayed_work gather_stats; + struct delayed_work scan_check; + struct delayed_work post_associate; + +#define IWL_DEFAULT_TX_POWER 0x0F + s8 user_txpower_limit; + s8 max_channel_txpower_limit; + +#ifdef CONFIG_PM + u32 pm_state[16]; +#endif + +#ifdef CONFIG_IWLWIFI_DEBUG + /* debugging info */ + u32 framecnt_to_us; + atomic_t restrict_refcnt; +#endif + + struct work_struct txpower_work; +#ifdef CONFIG_IWLWIFI_SENSITIVITY + struct work_struct sensitivity_work; +#endif + struct work_struct statistics_work; + struct timer_list statistics_periodic; + +#ifdef CONFIG_IWLWIFI_HT_AGG + struct work_struct agg_work; +#endif +}; /*iwl_priv */ + +static inline int iwl_is_associated(struct iwl_priv *priv) +{ + return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; +} + +static inline int is_channel_valid(const struct iwl_channel_info *ch_info) +{ + if (ch_info == NULL) + return 0; + return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; +} + +static inline int is_channel_narrow(const struct iwl_channel_info *ch_info) +{ + return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0; +} + +static inline int is_channel_radar(const struct iwl_channel_info *ch_info) +{ + return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; +} + +static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info) +{ + return ch_info->phymode == MODE_IEEE80211A; +} + +static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info) +{ + return ((ch_info->phymode == MODE_IEEE80211B) || + (ch_info->phymode == MODE_IEEE80211G)); +} + +static inline int is_channel_passive(const struct iwl_channel_info *ch) +{ + return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; +} + +static inline int is_channel_ibss(const struct iwl_channel_info *ch) +{ + return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; +} + +extern const struct iwl_channel_info *iwl_get_channel_info( + const struct iwl_priv *priv, int phymode, u16 channel); + +/* Requires full declaration of iwl_priv before including */ +#include "iwl-4965-io.h" + #endif /* __iwl_4965_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-channel.h b/drivers/net/wireless/iwlwifi/iwl-channel.h deleted file mode 100644 index 023c3f240ce..00000000000 --- a/drivers/net/wireless/iwlwifi/iwl-channel.h +++ /dev/null @@ -1,161 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * James P. Ketrenos - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#ifndef __iwl_channel_h__ -#define __iwl_channel_h__ - -#define IWL_NUM_SCAN_RATES (2) - -struct iwl_channel_tgd_info { - u8 type; - s8 max_power; -}; - -struct iwl_channel_tgh_info { - s64 last_radar_time; -}; - -/* current Tx power values to use, one for each rate for each channel. - * requested power is limited by: - * -- regulatory EEPROM limits for this channel - * -- hardware capabilities (clip-powers) - * -- spectrum management - * -- user preference (e.g. iwconfig) - * when requested power is set, base power index must also be set. */ -struct iwl_channel_power_info { - struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ - s8 power_table_index; /* actual (compenst'd) index into gain table */ - s8 base_power_index; /* gain index for power at factory temp. */ - s8 requested_power; /* power (dBm) requested for this chnl/rate */ -}; - -/* current scan Tx power values to use, one for each scan rate for each - * channel. */ -struct iwl_scan_power_info { - struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ - s8 power_table_index; /* actual (compenst'd) index into gain table */ - s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ -}; - -/* Channel unlock period is 15 seconds. If no beacon or probe response - * has been received within 15 seconds on a locked channel then the channel - * remains locked. */ -#define TX_UNLOCK_PERIOD 15 - -/* CSA lock period is 15 seconds. If a CSA has been received on a channel in - * the last 15 seconds, the channel is locked */ -#define CSA_LOCK_PERIOD 15 -/* - * One for each channel, holds all channel setup data - * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant - * with one another! - */ -#define IWL4965_MAX_RATE (33) - -struct iwl_channel_info { - struct iwl_channel_tgd_info tgd; - struct iwl_channel_tgh_info tgh; - struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ - struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for - * FAT channel */ - - u8 channel; /* channel number */ - u8 flags; /* flags copied from EEPROM */ - s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ - s8 curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) */ - s8 min_power; /* always 0 */ - s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */ - - u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */ - u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */ - u8 phymode; /* MODE_IEEE80211{A,B,G} */ - - /* Radio/DSP gain settings for each "normal" data Tx rate. - * These include, in addition to RF and DSP gain, a few fields for - * remembering/modifying gain settings (indexes). */ - struct iwl_channel_power_info power_info[IWL4965_MAX_RATE]; - -#if IWL == 4965 - /* FAT channel info */ - s8 fat_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ - s8 fat_curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) */ - s8 fat_min_power; /* always 0 */ - s8 fat_scan_power; /* (dBm) eeprom, direct scans, any rate */ - u8 fat_flags; /* flags copied from EEPROM */ - u8 fat_extension_channel; -#endif - - /* Radio/DSP gain settings for each scan rate, for directed scans. */ - struct iwl_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; -}; - -struct iwl_clip_group { - /* maximum power level to prevent clipping for each rate, derived by - * us from this band's saturation power in EEPROM */ - const s8 clip_powers[IWL_MAX_RATES]; -}; - -static inline int is_channel_valid(const struct iwl_channel_info *ch_info) -{ - if (ch_info == NULL) - return 0; - return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; -} - -static inline int is_channel_narrow(const struct iwl_channel_info *ch_info) -{ - return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0; -} - -static inline int is_channel_radar(const struct iwl_channel_info *ch_info) -{ - return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; -} - -static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info) -{ - return ch_info->phymode == MODE_IEEE80211A; -} - -static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info) -{ - return ((ch_info->phymode == MODE_IEEE80211B) || - (ch_info->phymode == MODE_IEEE80211G)); -} - -static inline int is_channel_passive(const struct iwl_channel_info *ch) -{ - return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; -} - -static inline int is_channel_ibss(const struct iwl_channel_info *ch) -{ - return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; -} - -extern const struct iwl_channel_info *iwl_get_channel_info( - const struct iwl_priv *priv, int phymode, u16 channel); - -#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h deleted file mode 100644 index d852a77d112..00000000000 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ /dev/null @@ -1,1734 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, - * USA - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * James P. Ketrenos - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __iwl_commands_h__ -#define __iwl_commands_h__ - -enum { - REPLY_ALIVE = 0x1, - REPLY_ERROR = 0x2, - - /* RXON and QOS commands */ - REPLY_RXON = 0x10, - REPLY_RXON_ASSOC = 0x11, - REPLY_QOS_PARAM = 0x13, - REPLY_RXON_TIMING = 0x14, - - /* Multi-Station support */ - REPLY_ADD_STA = 0x18, - REPLY_REMOVE_STA = 0x19, /* not used */ - REPLY_REMOVE_ALL_STA = 0x1a, /* not used */ - - /* RX, TX, LEDs */ -#if IWL == 3945 - REPLY_3945_RX = 0x1b, /* 3945 only */ -#endif - REPLY_TX = 0x1c, - REPLY_RATE_SCALE = 0x47, /* 3945 only */ - REPLY_LEDS_CMD = 0x48, - REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */ - - /* 802.11h related */ - RADAR_NOTIFICATION = 0x70, /* not used */ - REPLY_QUIET_CMD = 0x71, /* not used */ - REPLY_CHANNEL_SWITCH = 0x72, - CHANNEL_SWITCH_NOTIFICATION = 0x73, - REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, - SPECTRUM_MEASURE_NOTIFICATION = 0x75, - - /* Power Management */ - POWER_TABLE_CMD = 0x77, - PM_SLEEP_NOTIFICATION = 0x7A, - PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, - - /* Scan commands and notifications */ - REPLY_SCAN_CMD = 0x80, - REPLY_SCAN_ABORT_CMD = 0x81, - SCAN_START_NOTIFICATION = 0x82, - SCAN_RESULTS_NOTIFICATION = 0x83, - SCAN_COMPLETE_NOTIFICATION = 0x84, - - /* IBSS/AP commands */ - BEACON_NOTIFICATION = 0x90, - REPLY_TX_BEACON = 0x91, - WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */ - - /* Miscellaneous commands */ - QUIET_NOTIFICATION = 0x96, /* not used */ - REPLY_TX_PWR_TABLE_CMD = 0x97, - MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ - - /* BT config command */ - REPLY_BT_CONFIG = 0x9b, - - /* 4965 Statistics */ - REPLY_STATISTICS_CMD = 0x9c, - STATISTICS_NOTIFICATION = 0x9d, - - /* RF-KILL commands and notifications */ - REPLY_CARD_STATE_CMD = 0xa0, - CARD_STATE_NOTIFICATION = 0xa1, - - /* Missed beacons notification */ - MISSED_BEACONS_NOTIFICATION = 0xa2, - -#if IWL == 4965 - REPLY_CT_KILL_CONFIG_CMD = 0xa4, - SENSITIVITY_CMD = 0xa8, - REPLY_PHY_CALIBRATION_CMD = 0xb0, - REPLY_RX_PHY_CMD = 0xc0, - REPLY_RX_MPDU_CMD = 0xc1, - REPLY_4965_RX = 0xc3, - REPLY_COMPRESSED_BA = 0xc5, -#endif - REPLY_MAX = 0xff -}; - -/****************************************************************************** - * (0) - * Header - * - *****************************************************************************/ - -#define IWL_CMD_FAILED_MSK 0x40 - -struct iwl_cmd_header { - u8 cmd; - u8 flags; - /* We have 15 LSB to use as we please (MSB indicates - * a frame Rx'd from the HW). We encode the following - * information into the sequence field: - * - * 0:7 index in fifo - * 8:13 fifo selection - * 14:14 bit indicating if this packet references the 'extra' - * storage at the end of the memory queue - * 15:15 (Rx indication) - * - */ - __le16 sequence; - - /* command data follows immediately */ - u8 data[0]; -} __attribute__ ((packed)); - -/****************************************************************************** - * (0a) - * Alive and Error Commands & Responses: - * - *****************************************************************************/ - -#define UCODE_VALID_OK __constant_cpu_to_le32(0x1) -#define INITIALIZE_SUBTYPE (9) - -/* - * REPLY_ALIVE = 0x1 (response only, not a command) - */ -struct iwl_alive_resp { - u8 ucode_minor; - u8 ucode_major; - __le16 reserved1; - u8 sw_rev[8]; - u8 ver_type; - u8 ver_subtype; - __le16 reserved2; - __le32 log_event_table_ptr; - __le32 error_event_table_ptr; - __le32 timestamp; - __le32 is_valid; -} __attribute__ ((packed)); - -struct iwl_init_alive_resp { - u8 ucode_minor; - u8 ucode_major; - __le16 reserved1; - u8 sw_rev[8]; - u8 ver_type; - u8 ver_subtype; - __le16 reserved2; - __le32 log_event_table_ptr; - __le32 error_event_table_ptr; - __le32 timestamp; - __le32 is_valid; - -#if IWL == 4965 - /* calibration values from "initialize" uCode */ - __le32 voltage; /* signed */ - __le32 therm_r1[2]; /* signed 1st for normal, 2nd for FAT channel */ - __le32 therm_r2[2]; /* signed */ - __le32 therm_r3[2]; /* signed */ - __le32 therm_r4[2]; /* signed */ - __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups, - * 2 Tx chains */ -#endif -} __attribute__ ((packed)); - -union tsf { - u8 byte[8]; - __le16 word[4]; - __le32 dw[2]; -}; - -/* - * REPLY_ERROR = 0x2 (response only, not a command) - */ -struct iwl_error_resp { - __le32 error_type; - u8 cmd_id; - u8 reserved1; - __le16 bad_cmd_seq_num; -#if IWL == 3945 - __le16 reserved2; -#endif - __le32 error_info; - union tsf timestamp; -} __attribute__ ((packed)); - -/****************************************************************************** - * (1) - * RXON Commands & Responses: - * - *****************************************************************************/ - -/* - * Rx config defines & structure - */ -/* rx_config device types */ -enum { - RXON_DEV_TYPE_AP = 1, - RXON_DEV_TYPE_ESS = 3, - RXON_DEV_TYPE_IBSS = 4, - RXON_DEV_TYPE_SNIFFER = 6, -}; - -/* rx_config flags */ -/* band & modulation selection */ -#define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0) -#define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1) -/* auto detection enable */ -#define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2) -/* TGg protection when tx */ -#define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3) -/* cck short slot & preamble */ -#define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4) -#define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5) -/* antenna selection */ -#define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7) -#define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00) -#define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) -#define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) -/* radar detection enable */ -#define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12) -#define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13) -/* rx response to host with 8-byte TSF -* (according to ON_AIR deassertion) */ -#define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15) - -/* rx_config filter flags */ -/* accept all data frames */ -#define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0) -/* pass control & management to host */ -#define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1) -/* accept multi-cast */ -#define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2) -/* don't decrypt uni-cast frames */ -#define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3) -/* don't decrypt multi-cast frames */ -#define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4) -/* STA is associated */ -#define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5) -/* transfer to host non bssid beacons in associated state */ -#define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6) - -/* - * REPLY_RXON = 0x10 (command, has simple generic response) - */ -struct iwl_rxon_cmd { - u8 node_addr[6]; - __le16 reserved1; - u8 bssid_addr[6]; - __le16 reserved2; - u8 wlap_bssid_addr[6]; - __le16 reserved3; - u8 dev_type; - u8 air_propagation; -#if IWL == 3945 - __le16 reserved4; -#elif IWL == 4965 - __le16 rx_chain; -#endif - u8 ofdm_basic_rates; - u8 cck_basic_rates; - __le16 assoc_id; - __le32 flags; - __le32 filter_flags; - __le16 channel; -#if IWL == 3945 - __le16 reserved5; -#elif IWL == 4965 - u8 ofdm_ht_single_stream_basic_rates; - u8 ofdm_ht_dual_stream_basic_rates; -#endif -} __attribute__ ((packed)); - -/* - * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) - */ -struct iwl_rxon_assoc_cmd { - __le32 flags; - __le32 filter_flags; - u8 ofdm_basic_rates; - u8 cck_basic_rates; -#if IWL == 4965 - u8 ofdm_ht_single_stream_basic_rates; - u8 ofdm_ht_dual_stream_basic_rates; - __le16 rx_chain_select_flags; -#endif - __le16 reserved; -} __attribute__ ((packed)); - -/* - * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) - */ -struct iwl_rxon_time_cmd { - union tsf timestamp; - __le16 beacon_interval; - __le16 atim_window; - __le32 beacon_init_val; - __le16 listen_interval; - __le16 reserved; -} __attribute__ ((packed)); - -struct iwl_tx_power { - u8 tx_gain; /* gain for analog radio */ - u8 dsp_atten; /* gain for DSP */ -} __attribute__ ((packed)); - -#if IWL == 3945 -struct iwl_power_per_rate { - u8 rate; /* plcp */ - struct iwl_tx_power tpc; - u8 reserved; -} __attribute__ ((packed)); - -#elif IWL == 4965 -#define POWER_TABLE_NUM_ENTRIES 33 -#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 -#define POWER_TABLE_CCK_ENTRY 32 -struct tx_power_dual_stream { - __le32 dw; -} __attribute__ ((packed)); - -struct iwl_tx_power_db { - struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; -} __attribute__ ((packed)); -#endif - -/* - * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) - */ -struct iwl_channel_switch_cmd { - u8 band; - u8 expect_beacon; - __le16 channel; - __le32 rxon_flags; - __le32 rxon_filter_flags; - __le32 switch_time; -#if IWL == 3945 - struct iwl_power_per_rate power[IWL_MAX_RATES]; -#elif IWL == 4965 - struct iwl_tx_power_db tx_power; -#endif -} __attribute__ ((packed)); - -/* - * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) - */ -struct iwl_csa_notification { - __le16 band; - __le16 channel; - __le32 status; /* 0 - OK, 1 - fail */ -} __attribute__ ((packed)); - -/****************************************************************************** - * (2) - * Quality-of-Service (QOS) Commands & Responses: - * - *****************************************************************************/ -struct iwl_ac_qos { - __le16 cw_min; - __le16 cw_max; - u8 aifsn; - u8 reserved1; - __le16 edca_txop; -} __attribute__ ((packed)); - -/* QoS flags defines */ -#define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01) -#define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02) -#define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10) - -/* - * TXFIFO Queue number defines - */ -/* number of Access categories (AC) (EDCA), queues 0..3 */ -#define AC_NUM 4 - -/* - * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) - */ -struct iwl_qosparam_cmd { - __le32 qos_flags; - struct iwl_ac_qos ac[AC_NUM]; -} __attribute__ ((packed)); - -/****************************************************************************** - * (3) - * Add/Modify Stations Commands & Responses: - * - *****************************************************************************/ -/* - * Multi station support - */ -#define IWL_AP_ID 0 -#define IWL_MULTICAST_ID 1 -#define IWL_STA_ID 2 - -#define IWL3945_BROADCAST_ID 24 -#define IWL3945_STATION_COUNT 25 - -#define IWL4965_BROADCAST_ID 31 -#define IWL4965_STATION_COUNT 32 - -#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ -#define IWL_INVALID_STATION 255 - -#if IWL == 3945 -#define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2); -#endif -#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8); - -#define STA_CONTROL_MODIFY_MSK 0x01 - -/* key flags __le16*/ -#define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7) -#define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0) -#define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1) -#define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2) -#define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3) - -#define STA_KEY_FLG_KEYID_POS 8 -#define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800) - -/* modify flags */ -#define STA_MODIFY_KEY_MASK 0x01 -#define STA_MODIFY_TID_DISABLE_TX 0x02 -#define STA_MODIFY_TX_RATE_MSK 0x04 -#define STA_MODIFY_ADDBA_TID_MSK 0x08 -#define STA_MODIFY_DELBA_TID_MSK 0x10 -#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) - -/* - * Antenna masks: - * bit14:15 01 B inactive, A active - * 10 B active, A inactive - * 11 Both active - */ -#define RATE_MCS_ANT_A_POS 14 -#define RATE_MCS_ANT_B_POS 15 -#define RATE_MCS_ANT_A_MSK 0x4000 -#define RATE_MCS_ANT_B_MSK 0x8000 -#define RATE_MCS_ANT_AB_MSK 0xc000 - -struct iwl_keyinfo { - __le16 key_flags; - u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ - u8 reserved1; - __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ - __le16 reserved2; - u8 key[16]; /* 16-byte unicast decryption key */ -} __attribute__ ((packed)); - -struct sta_id_modify { - u8 addr[ETH_ALEN]; - __le16 reserved1; - u8 sta_id; - u8 modify_mask; - __le16 reserved2; -} __attribute__ ((packed)); - -/* - * REPLY_ADD_STA = 0x18 (command) - */ -struct iwl_addsta_cmd { - u8 mode; - u8 reserved[3]; - struct sta_id_modify sta; - struct iwl_keyinfo key; - __le32 station_flags; - __le32 station_flags_msk; - __le16 tid_disable_tx; -#if IWL == 3945 - __le16 rate_n_flags; -#else - __le16 reserved1; -#endif - u8 add_immediate_ba_tid; - u8 remove_immediate_ba_tid; - __le16 add_immediate_ba_ssn; -#if IWL == 4965 - __le32 reserved2; -#endif -} __attribute__ ((packed)); - -/* - * REPLY_ADD_STA = 0x18 (response) - */ -struct iwl_add_sta_resp { - u8 status; -} __attribute__ ((packed)); - -#define ADD_STA_SUCCESS_MSK 0x1 - -/****************************************************************************** - * (4) - * Rx Responses: - * - *****************************************************************************/ - -struct iwl_rx_frame_stats { - u8 phy_count; - u8 id; - u8 rssi; - u8 agc; - __le16 sig_avg; - __le16 noise_diff; - u8 payload[0]; -} __attribute__ ((packed)); - -struct iwl_rx_frame_hdr { - __le16 channel; - __le16 phy_flags; - u8 reserved1; - u8 rate; - __le16 len; - u8 payload[0]; -} __attribute__ ((packed)); - -#define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) -#define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) - -#define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) -#define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) -#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) -#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) -#define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) - -#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) -#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) -#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) -#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) -#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) - -#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) -#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) -#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) -#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) -#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) - -struct iwl_rx_frame_end { - __le32 status; - __le64 timestamp; - __le32 beacon_timestamp; -} __attribute__ ((packed)); - -/* - * REPLY_3945_RX = 0x1b (response only, not a command) - * - * NOTE: DO NOT dereference from casts to this structure - * It is provided only for calculating minimum data set size. - * The actual offsets of the hdr and end are dynamic based on - * stats.phy_count - */ -struct iwl_rx_frame { - struct iwl_rx_frame_stats stats; - struct iwl_rx_frame_hdr hdr; - struct iwl_rx_frame_end end; -} __attribute__ ((packed)); - -/* Fixed (non-configurable) rx data from phy */ -#define RX_PHY_FLAGS_ANTENNAE_OFFSET (4) -#define RX_PHY_FLAGS_ANTENNAE_MASK (0x70) -#define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ -#define IWL_AGC_DB_POS (7) -struct iwl4965_rx_non_cfg_phy { - __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ - __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ - u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ - u8 pad[0]; -} __attribute__ ((packed)); - -/* - * REPLY_4965_RX = 0xc3 (response only, not a command) - * Used only for legacy (non 11n) frames. - */ -#define RX_RES_PHY_CNT 14 -struct iwl4965_rx_phy_res { - u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ - u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ - u8 stat_id; /* configurable DSP phy data set ID */ - u8 reserved1; - __le64 timestamp; /* TSF at on air rise */ - __le32 beacon_time_stamp; /* beacon at on-air rise */ - __le16 phy_flags; /* general phy flags: band, modulation, ... */ - __le16 channel; /* channel number */ - __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ - __le32 reserved2; - __le32 rate_n_flags; - __le16 byte_count; /* frame's byte-count */ - __le16 reserved3; -} __attribute__ ((packed)); - -struct iwl4965_rx_mpdu_res_start { - __le16 byte_count; - __le16 reserved; -} __attribute__ ((packed)); - - -/****************************************************************************** - * (5) - * Tx Commands & Responses: - * - *****************************************************************************/ - -/* Tx flags */ -#define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1) -#define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2) -#define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3) -#define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4) -#define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6) -#define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7) -#define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00) -#define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) -#define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) - -/* ucode ignores BT priority for this frame */ -#define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12) - -/* ucode overrides sequence control */ -#define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13) - -/* signal that this frame is non-last MPDU */ -#define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14) - -/* calculate TSF in outgoing frame */ -#define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16) - -/* activate TX calibration. */ -#define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17) - -/* signals that 2 bytes pad was inserted - after the MAC header */ -#define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20) - -/* HCCA-AP - disable duration overwriting. */ -#define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25) - -/* - * TX command security control - */ -#define TX_CMD_SEC_WEP 0x01 -#define TX_CMD_SEC_CCM 0x02 -#define TX_CMD_SEC_TKIP 0x03 -#define TX_CMD_SEC_MSK 0x03 -#define TX_CMD_SEC_SHIFT 6 -#define TX_CMD_SEC_KEY128 0x08 - -/* - * TX command Frame life time - */ - -struct iwl_dram_scratch { - u8 try_cnt; - u8 bt_kill_cnt; - __le16 reserved; -} __attribute__ ((packed)); - -/* - * REPLY_TX = 0x1c (command) - */ -struct iwl_tx_cmd { - __le16 len; - __le16 next_frame_len; - __le32 tx_flags; -#if IWL == 3945 - u8 rate; - u8 sta_id; - u8 tid_tspec; -#elif IWL == 4965 - struct iwl_dram_scratch scratch; - __le32 rate_n_flags; - u8 sta_id; -#endif - u8 sec_ctl; -#if IWL == 4965 - u8 initial_rate_index; - u8 reserved; -#endif - u8 key[16]; -#if IWL == 3945 - union { - u8 byte[8]; - __le16 word[4]; - __le32 dw[2]; - } tkip_mic; - __le32 next_frame_info; -#elif IWL == 4965 - __le16 next_frame_flags; - __le16 reserved2; -#endif - union { - __le32 life_time; - __le32 attempt; - } stop_time; -#if IWL == 3945 - u8 supp_rates[2]; -#elif IWL == 4965 - __le32 dram_lsb_ptr; - u8 dram_msb_ptr; -#endif - u8 rts_retry_limit; /*byte 50 */ - u8 data_retry_limit; /*byte 51 */ -#if IWL == 4965 - u8 tid_tspec; -#endif - union { - __le16 pm_frame_timeout; - __le16 attempt_duration; - } timeout; - __le16 driver_txop; - u8 payload[0]; - struct ieee80211_hdr hdr[0]; -} __attribute__ ((packed)); - -/* TX command response is sent after *all* transmission attempts. - * - * NOTES: - * - * TX_STATUS_FAIL_NEXT_FRAG - * - * If the fragment flag in the MAC header for the frame being transmitted - * is set and there is insufficient time to transmit the next frame, the - * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. - * - * TX_STATUS_FIFO_UNDERRUN - * - * Indicates the host did not provide bytes to the FIFO fast enough while - * a TX was in progress. - * - * TX_STATUS_FAIL_MGMNT_ABORT - * - * This status is only possible if the ABORT ON MGMT RX parameter was - * set to true with the TX command. - * - * If the MSB of the status parameter is set then an abort sequence is - * required. This sequence consists of the host activating the TX Abort - * control line, and then waiting for the TX Abort command response. This - * indicates that a the device is no longer in a transmit state, and that the - * command FIFO has been cleared. The host must then deactivate the TX Abort - * control line. Receiving is still allowed in this case. - */ -enum { - TX_STATUS_SUCCESS = 0x01, - TX_STATUS_DIRECT_DONE = 0x02, - TX_STATUS_FAIL_SHORT_LIMIT = 0x82, - TX_STATUS_FAIL_LONG_LIMIT = 0x83, - TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, - TX_STATUS_FAIL_MGMNT_ABORT = 0x85, - TX_STATUS_FAIL_NEXT_FRAG = 0x86, - TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, - TX_STATUS_FAIL_DEST_PS = 0x88, - TX_STATUS_FAIL_ABORTED = 0x89, - TX_STATUS_FAIL_BT_RETRY = 0x8a, - TX_STATUS_FAIL_STA_INVALID = 0x8b, - TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, - TX_STATUS_FAIL_TID_DISABLE = 0x8d, - TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e, - TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, - TX_STATUS_FAIL_TX_LOCKED = 0x90, - TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, -}; - -#define TX_PACKET_MODE_REGULAR 0x0000 -#define TX_PACKET_MODE_BURST_SEQ 0x0100 -#define TX_PACKET_MODE_BURST_FIRST 0x0200 - -enum { - TX_POWER_PA_NOT_ACTIVE = 0x0, -}; - -enum { - TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ - TX_STATUS_DELAY_MSK = 0x00000040, - TX_STATUS_ABORT_MSK = 0x00000080, - TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ - TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ - TX_RESERVED = 0x00780000, /* bits 19:22 */ - TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ - TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ -}; - -/* ******************************* - * TX aggregation state - ******************************* */ - -enum { - AGG_TX_STATE_TRANSMITTED = 0x00, - AGG_TX_STATE_UNDERRUN_MSK = 0x01, - AGG_TX_STATE_BT_PRIO_MSK = 0x02, - AGG_TX_STATE_FEW_BYTES_MSK = 0x04, - AGG_TX_STATE_ABORT_MSK = 0x08, - AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, - AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, - AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, - AGG_TX_STATE_SCD_QUERY_MSK = 0x80, - AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, - AGG_TX_STATE_RESPONSE_MSK = 0x1ff, - AGG_TX_STATE_DUMP_TX_MSK = 0x200, - AGG_TX_STATE_DELAY_TX_MSK = 0x400 -}; - -#define AGG_TX_STATE_LAST_SENT_MSK \ -(AGG_TX_STATE_LAST_SENT_TTL_MSK | \ - AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ - AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) - -#define AGG_TX_STATE_TRY_CNT_POS 12 -#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 - -#define AGG_TX_STATE_SEQ_NUM_POS 16 -#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 - -/* - * REPLY_TX = 0x1c (response) - */ -#if IWL == 4965 -struct iwl_tx_resp { - u8 frame_count; /* 1 no aggregation, >1 aggregation */ - u8 bt_kill_count; - u8 failure_rts; - u8 failure_frame; - __le32 rate_n_flags; - __le16 wireless_media_time; - __le16 reserved; - __le32 pa_power1; - __le32 pa_power2; - __le32 status; /* TX status (for aggregation status of 1st frame) */ -} __attribute__ ((packed)); - -#elif IWL == 3945 -struct iwl_tx_resp { - u8 failure_rts; - u8 failure_frame; - u8 bt_kill_count; - u8 rate; - __le32 wireless_media_time; - __le32 status; /* TX status (for aggregation status of 1st frame) */ -} __attribute__ ((packed)); -#endif - -/* - * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) - */ -struct iwl_compressed_ba_resp { - __le32 sta_addr_lo32; - __le16 sta_addr_hi16; - __le16 reserved; - u8 sta_id; - u8 tid; - __le16 ba_seq_ctl; - __le32 ba_bitmap0; - __le32 ba_bitmap1; - __le16 scd_flow; - __le16 scd_ssn; -} __attribute__ ((packed)); - -/* - * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) - */ -struct iwl_txpowertable_cmd { - u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ - u8 reserved; - __le16 channel; -#if IWL == 3945 - struct iwl_power_per_rate power[IWL_MAX_RATES]; -#elif IWL == 4965 - struct iwl_tx_power_db tx_power; -#endif -} __attribute__ ((packed)); - -#if IWL == 3945 -struct iwl_rate_scaling_info { - __le16 rate_n_flags; - u8 try_cnt; - u8 next_rate_index; -} __attribute__ ((packed)); - -/** - * struct iwl_rate_scaling_cmd - Rate Scaling Command & Response - * - * REPLY_RATE_SCALE = 0x47 (command, has simple generic response) - * - * NOTE: The table of rates passed to the uCode via the - * RATE_SCALE command sets up the corresponding order of - * rates used for all related commands, including rate - * masks, etc. - * - * For example, if you set 9MB (PLCP 0x0f) as the first - * rate in the rate table, the bit mask for that rate - * when passed through ofdm_basic_rates on the REPLY_RXON - * command would be bit 0 (1<<0) - */ -struct iwl_rate_scaling_cmd { - u8 table_id; - u8 reserved[3]; - struct iwl_rate_scaling_info table[IWL_MAX_RATES]; -} __attribute__ ((packed)); - -#elif IWL == 4965 - -/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ -#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0) - -#define LINK_QUAL_AC_NUM AC_NUM -#define LINK_QUAL_MAX_RETRY_NUM 16 - -#define LINK_QUAL_ANT_A_MSK (1<<0) -#define LINK_QUAL_ANT_B_MSK (1<<1) -#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) - -struct iwl_link_qual_general_params { - u8 flags; - u8 mimo_delimiter; - u8 single_stream_ant_msk; - u8 dual_stream_ant_msk; - u8 start_rate_index[LINK_QUAL_AC_NUM]; -} __attribute__ ((packed)); - -struct iwl_link_qual_agg_params { - __le16 agg_time_limit; - u8 agg_dis_start_th; - u8 agg_frame_cnt_limit; - __le32 reserved; -} __attribute__ ((packed)); - -/* - * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) - */ -struct iwl_link_quality_cmd { - u8 sta_id; - u8 reserved1; - __le16 control; - struct iwl_link_qual_general_params general_params; - struct iwl_link_qual_agg_params agg_params; - struct { - __le32 rate_n_flags; - } rs_table[LINK_QUAL_MAX_RETRY_NUM]; - __le32 reserved2; -} __attribute__ ((packed)); -#endif - -/* - * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) - */ -struct iwl_bt_cmd { - u8 flags; - u8 lead_time; - u8 max_kill; - u8 reserved; - __le32 kill_ack_mask; - __le32 kill_cts_mask; -} __attribute__ ((packed)); - -/****************************************************************************** - * (6) - * Spectrum Management (802.11h) Commands, Responses, Notifications: - * - *****************************************************************************/ - -/* - * Spectrum Management - */ -#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ - RXON_FILTER_CTL2HOST_MSK | \ - RXON_FILTER_ACCEPT_GRP_MSK | \ - RXON_FILTER_DIS_DECRYPT_MSK | \ - RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ - RXON_FILTER_ASSOC_MSK | \ - RXON_FILTER_BCON_AWARE_MSK) - -struct iwl_measure_channel { - __le32 duration; /* measurement duration in extended beacon - * format */ - u8 channel; /* channel to measure */ - u8 type; /* see enum iwl_measure_type */ - __le16 reserved; -} __attribute__ ((packed)); - -/* - * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) - */ -struct iwl_spectrum_cmd { - __le16 len; /* number of bytes starting from token */ - u8 token; /* token id */ - u8 id; /* measurement id -- 0 or 1 */ - u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ - u8 periodic; /* 1 = periodic */ - __le16 path_loss_timeout; - __le32 start_time; /* start time in extended beacon format */ - __le32 reserved2; - __le32 flags; /* rxon flags */ - __le32 filter_flags; /* rxon filter flags */ - __le16 channel_count; /* minimum 1, maximum 10 */ - __le16 reserved3; - struct iwl_measure_channel channels[10]; -} __attribute__ ((packed)); - -/* - * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) - */ -struct iwl_spectrum_resp { - u8 token; - u8 id; /* id of the prior command replaced, or 0xff */ - __le16 status; /* 0 - command will be handled - * 1 - cannot handle (conflicts with another - * measurement) */ -} __attribute__ ((packed)); - -enum iwl_measurement_state { - IWL_MEASUREMENT_START = 0, - IWL_MEASUREMENT_STOP = 1, -}; - -enum iwl_measurement_status { - IWL_MEASUREMENT_OK = 0, - IWL_MEASUREMENT_CONCURRENT = 1, - IWL_MEASUREMENT_CSA_CONFLICT = 2, - IWL_MEASUREMENT_TGH_CONFLICT = 3, - /* 4-5 reserved */ - IWL_MEASUREMENT_STOPPED = 6, - IWL_MEASUREMENT_TIMEOUT = 7, - IWL_MEASUREMENT_PERIODIC_FAILED = 8, -}; - -#define NUM_ELEMENTS_IN_HISTOGRAM 8 - -struct iwl_measurement_histogram { - __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ - __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ -} __attribute__ ((packed)); - -/* clear channel availability counters */ -struct iwl_measurement_cca_counters { - __le32 ofdm; - __le32 cck; -} __attribute__ ((packed)); - -enum iwl_measure_type { - IWL_MEASURE_BASIC = (1 << 0), - IWL_MEASURE_CHANNEL_LOAD = (1 << 1), - IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), - IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), - IWL_MEASURE_FRAME = (1 << 4), - /* bits 5:6 are reserved */ - IWL_MEASURE_IDLE = (1 << 7), -}; - -/* - * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) - */ -struct iwl_spectrum_notification { - u8 id; /* measurement id -- 0 or 1 */ - u8 token; - u8 channel_index; /* index in measurement channel list */ - u8 state; /* 0 - start, 1 - stop */ - __le32 start_time; /* lower 32-bits of TSF */ - u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ - u8 channel; - u8 type; /* see enum iwl_measurement_type */ - u8 reserved1; - /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only - * valid if applicable for measurement type requested. */ - __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ - __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ - __le32 cca_time; /* channel load time in usecs */ - u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - - * unidentified */ - u8 reserved2[3]; - struct iwl_measurement_histogram histogram; - __le32 stop_time; /* lower 32-bits of TSF */ - __le32 status; /* see iwl_measurement_status */ -} __attribute__ ((packed)); - -/****************************************************************************** - * (7) - * Power Management Commands, Responses, Notifications: - * - *****************************************************************************/ - -/** - * struct iwl_powertable_cmd - Power Table Command - * @flags: See below: - * - * POWER_TABLE_CMD = 0x77 (command, has simple generic response) - * - * PM allow: - * bit 0 - '0' Driver not allow power management - * '1' Driver allow PM (use rest of parameters) - * uCode send sleep notifications: - * bit 1 - '0' Don't send sleep notification - * '1' send sleep notification (SEND_PM_NOTIFICATION) - * Sleep over DTIM - * bit 2 - '0' PM have to walk up every DTIM - * '1' PM could sleep over DTIM till listen Interval. - * PCI power managed - * bit 3 - '0' (PCI_LINK_CTRL & 0x1) - * '1' !(PCI_LINK_CTRL & 0x1) - * Force sleep Modes - * bit 31/30- '00' use both mac/xtal sleeps - * '01' force Mac sleep - * '10' force xtal sleep - * '11' Illegal set - * - * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then - * ucode assume sleep over DTIM is allowed and we don't need to wakeup - * for every DTIM. - */ -#define IWL_POWER_VEC_SIZE 5 - - -#if IWL == 3945 - -#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0) -#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2) -#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3) -struct iwl_powertable_cmd { - __le32 flags; - __le32 rx_data_timeout; - __le32 tx_data_timeout; - __le32 sleep_interval[IWL_POWER_VEC_SIZE]; -} __attribute__((packed)); - -#elif IWL == 4965 - -#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1<<0) -#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2) -#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3) - -struct iwl_powertable_cmd { - __le16 flags; - u8 keep_alive_seconds; - u8 debug_flags; - __le32 rx_data_timeout; - __le32 tx_data_timeout; - __le32 sleep_interval[IWL_POWER_VEC_SIZE]; - __le32 keep_alive_beacons; -} __attribute__ ((packed)); -#endif - -/* - * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) - * 3945 and 4965 identical. - */ -struct iwl_sleep_notification { - u8 pm_sleep_mode; - u8 pm_wakeup_src; - __le16 reserved; - __le32 sleep_time; - __le32 tsf_low; - __le32 bcon_timer; -} __attribute__ ((packed)); - -/* Sleep states. 3945 and 4965 identical. */ -enum { - IWL_PM_NO_SLEEP = 0, - IWL_PM_SLP_MAC = 1, - IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, - IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, - IWL_PM_SLP_PHY = 4, - IWL_PM_SLP_REPENT = 5, - IWL_PM_WAKEUP_BY_TIMER = 6, - IWL_PM_WAKEUP_BY_DRIVER = 7, - IWL_PM_WAKEUP_BY_RFKILL = 8, - /* 3 reserved */ - IWL_PM_NUM_OF_MODES = 12, -}; - -/* - * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) - */ -#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ -#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ -#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ -struct iwl_card_state_cmd { - __le32 status; /* CARD_STATE_CMD_* request new power state */ -} __attribute__ ((packed)); - -/* - * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) - */ -struct iwl_card_state_notif { - __le32 flags; -} __attribute__ ((packed)); - -#define HW_CARD_DISABLED 0x01 -#define SW_CARD_DISABLED 0x02 -#define RF_CARD_DISABLED 0x04 -#define RXON_CARD_DISABLED 0x10 - -struct iwl_ct_kill_config { - __le32 reserved; - __le32 critical_temperature_M; - __le32 critical_temperature_R; -} __attribute__ ((packed)); - -/****************************************************************************** - * (8) - * Scan Commands, Responses, Notifications: - * - *****************************************************************************/ - -struct iwl_scan_channel { - /* type is defined as: - * 0:0 active (0 - passive) - * 1:4 SSID direct - * If 1 is set then corresponding SSID IE is transmitted in probe - * 5:7 reserved - */ - u8 type; - u8 channel; - struct iwl_tx_power tpc; - __le16 active_dwell; - __le16 passive_dwell; -} __attribute__ ((packed)); - -struct iwl_ssid_ie { - u8 id; - u8 len; - u8 ssid[32]; -} __attribute__ ((packed)); - -#define PROBE_OPTION_MAX 0x4 -#define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF) -#define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1) -#define IWL_MAX_SCAN_SIZE 1024 - -/* - * REPLY_SCAN_CMD = 0x80 (command) - */ -struct iwl_scan_cmd { - __le16 len; - u8 reserved0; - u8 channel_count; - __le16 quiet_time; /* dwell only this long on quiet chnl - * (active scan) */ - __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ - __le16 good_CRC_th; /* passive -> active promotion threshold */ -#if IWL == 3945 - __le16 reserved1; -#elif IWL == 4965 - __le16 rx_chain; -#endif - __le32 max_out_time; /* max usec to be out of associated (service) - * chnl */ - __le32 suspend_time; /* pause scan this long when returning to svc - * chnl. - * 3945 -- 31:24 # beacons, 19:0 additional usec, - * 4965 -- 31:22 # beacons, 21:0 additional usec. - */ - __le32 flags; - __le32 filter_flags; - - struct iwl_tx_cmd tx_cmd; - struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; - - u8 data[0]; - /* - * The channels start after the probe request payload and are of type: - * - * struct iwl_scan_channel channels[0]; - * - * NOTE: Only one band of channels can be scanned per pass. You - * can not mix 2.4GHz channels and 5.2GHz channels and must - * request a scan multiple times (not concurrently) - * - */ -} __attribute__ ((packed)); - -/* Can abort will notify by complete notification with abort status. */ -#define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1) -/* complete notification statuses */ -#define ABORT_STATUS 0x2 - -/* - * REPLY_SCAN_CMD = 0x80 (response) - */ -struct iwl_scanreq_notification { - __le32 status; /* 1: okay, 2: cannot fulfill request */ -} __attribute__ ((packed)); - -/* - * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) - */ -struct iwl_scanstart_notification { - __le32 tsf_low; - __le32 tsf_high; - __le32 beacon_timer; - u8 channel; - u8 band; - u8 reserved[2]; - __le32 status; -} __attribute__ ((packed)); - -#define SCAN_OWNER_STATUS 0x1; -#define MEASURE_OWNER_STATUS 0x2; - -#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ -/* - * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) - */ -struct iwl_scanresults_notification { - u8 channel; - u8 band; - u8 reserved[2]; - __le32 tsf_low; - __le32 tsf_high; - __le32 statistics[NUMBER_OF_STATISTICS]; -} __attribute__ ((packed)); - -/* - * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) - */ -struct iwl_scancomplete_notification { - u8 scanned_channels; - u8 status; - u8 reserved; - u8 last_channel; - __le32 tsf_low; - __le32 tsf_high; -} __attribute__ ((packed)); - - -/****************************************************************************** - * (9) - * IBSS/AP Commands and Notifications: - * - *****************************************************************************/ - -/* - * BEACON_NOTIFICATION = 0x90 (notification only, not a command) - */ -struct iwl_beacon_notif { - struct iwl_tx_resp beacon_notify_hdr; - __le32 low_tsf; - __le32 high_tsf; - __le32 ibss_mgr_status; -} __attribute__ ((packed)); - -/* - * REPLY_TX_BEACON = 0x91 (command, has simple generic response) - */ -struct iwl_tx_beacon_cmd { - struct iwl_tx_cmd tx; - __le16 tim_idx; - u8 tim_size; - u8 reserved1; - struct ieee80211_hdr frame[0]; /* beacon frame */ -} __attribute__ ((packed)); - -/****************************************************************************** - * (10) - * Statistics Commands and Notifications: - * - *****************************************************************************/ - -#define IWL_TEMP_CONVERT 260 - -#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 -#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 -#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 - -/* Used for passing to driver number of successes and failures per rate */ -struct rate_histogram { - union { - __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; - __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; - __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; - } success; - union { - __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; - __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; - __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; - } failed; -} __attribute__ ((packed)); - -/* statistics command response */ - -struct statistics_rx_phy { - __le32 ina_cnt; - __le32 fina_cnt; - __le32 plcp_err; - __le32 crc32_err; - __le32 overrun_err; - __le32 early_overrun_err; - __le32 crc32_good; - __le32 false_alarm_cnt; - __le32 fina_sync_err_cnt; - __le32 sfd_timeout; - __le32 fina_timeout; - __le32 unresponded_rts; - __le32 rxe_frame_limit_overrun; - __le32 sent_ack_cnt; - __le32 sent_cts_cnt; -#if IWL == 4965 - __le32 sent_ba_rsp_cnt; - __le32 dsp_self_kill; - __le32 mh_format_err; - __le32 re_acq_main_rssi_sum; - __le32 reserved3; -#endif -} __attribute__ ((packed)); - -#if IWL == 4965 -struct statistics_rx_ht_phy { - __le32 plcp_err; - __le32 overrun_err; - __le32 early_overrun_err; - __le32 crc32_good; - __le32 crc32_err; - __le32 mh_format_err; - __le32 agg_crc32_good; - __le32 agg_mpdu_cnt; - __le32 agg_cnt; - __le32 reserved2; -} __attribute__ ((packed)); -#endif - -struct statistics_rx_non_phy { - __le32 bogus_cts; /* CTS received when not expecting CTS */ - __le32 bogus_ack; /* ACK received when not expecting ACK */ - __le32 non_bssid_frames; /* number of frames with BSSID that - * doesn't belong to the STA BSSID */ - __le32 filtered_frames; /* count frames that were dumped in the - * filtering process */ - __le32 non_channel_beacons; /* beacons with our bss id but not on - * our serving channel */ -#if IWL == 4965 - __le32 channel_beacons; /* beacons with our bss id and in our - * serving channel */ - __le32 num_missed_bcon; /* number of missed beacons */ - __le32 adc_rx_saturation_time; /* count in 0.8us units the time the - * ADC was in saturation */ - __le32 ina_detection_search_time;/* total time (in 0.8us) searched - * for INA */ - __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */ - __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */ - __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */ - __le32 interference_data_flag; /* flag for interference data - * availability. 1 when data is - * available. */ - __le32 channel_load; /* counts RX Enable time */ - __le32 dsp_false_alarms; /* DSP false alarm (both OFDM - * and CCK) counter */ - __le32 beacon_rssi_a; - __le32 beacon_rssi_b; - __le32 beacon_rssi_c; - __le32 beacon_energy_a; - __le32 beacon_energy_b; - __le32 beacon_energy_c; -#endif -} __attribute__ ((packed)); - -struct statistics_rx { - struct statistics_rx_phy ofdm; - struct statistics_rx_phy cck; - struct statistics_rx_non_phy general; -#if IWL == 4965 - struct statistics_rx_ht_phy ofdm_ht; -#endif -} __attribute__ ((packed)); - -#if IWL == 4965 -struct statistics_tx_non_phy_agg { - __le32 ba_timeout; - __le32 ba_reschedule_frames; - __le32 scd_query_agg_frame_cnt; - __le32 scd_query_no_agg; - __le32 scd_query_agg; - __le32 scd_query_mismatch; - __le32 frame_not_ready; - __le32 underrun; - __le32 bt_prio_kill; - __le32 rx_ba_rsp_cnt; - __le32 reserved2; - __le32 reserved3; -} __attribute__ ((packed)); -#endif - -struct statistics_tx { - __le32 preamble_cnt; - __le32 rx_detected_cnt; - __le32 bt_prio_defer_cnt; - __le32 bt_prio_kill_cnt; - __le32 few_bytes_cnt; - __le32 cts_timeout; - __le32 ack_timeout; - __le32 expected_ack_cnt; - __le32 actual_ack_cnt; -#if IWL == 4965 - __le32 dump_msdu_cnt; - __le32 burst_abort_next_frame_mismatch_cnt; - __le32 burst_abort_missing_next_frame_cnt; - __le32 cts_timeout_collision; - __le32 ack_or_ba_timeout_collision; - struct statistics_tx_non_phy_agg agg; -#endif -} __attribute__ ((packed)); - -struct statistics_dbg { - __le32 burst_check; - __le32 burst_count; - __le32 reserved[4]; -} __attribute__ ((packed)); - -struct statistics_div { - __le32 tx_on_a; - __le32 tx_on_b; - __le32 exec_time; - __le32 probe_time; -#if IWL == 4965 - __le32 reserved1; - __le32 reserved2; -#endif -} __attribute__ ((packed)); - -struct statistics_general { - __le32 temperature; -#if IWL == 4965 - __le32 temperature_m; -#endif - struct statistics_dbg dbg; - __le32 sleep_time; - __le32 slots_out; - __le32 slots_idle; - __le32 ttl_timestamp; - struct statistics_div div; -#if IWL == 4965 - __le32 rx_enable_counter; - __le32 reserved1; - __le32 reserved2; - __le32 reserved3; -#endif -} __attribute__ ((packed)); - -/* - * REPLY_STATISTICS_CMD = 0x9c, - * 3945 and 4965 identical. - * - * This command triggers an immediate response containing uCode statistics. - * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. - * - * If the CLEAR_STATS configuration flag is set, uCode will clear its - * internal copy of the statistics (counters) after issuing the response. - * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). - * - * If the DISABLE_NOTIF configuration flag is set, uCode will not issue - * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag - * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. - */ -#define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ -#define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ -struct iwl_statistics_cmd { - __le32 configuration_flags; /* IWL_STATS_CONF_* */ -} __attribute__ ((packed)); - -/* - * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) - * - * By default, uCode issues this notification after receiving a beacon - * while associated. To disable this behavior, set DISABLE_NOTIF flag in the - * REPLY_STATISTICS_CMD 0x9c, above. - * - * Statistics counters continue to increment beacon after beacon, but are - * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD - * 0x9c with CLEAR_STATS bit set (see above). - * - * uCode also issues this notification during scans. uCode clears statistics - * appropriately so that each notification contains statistics for only the - * one channel that has just been scanned. - */ -#define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) -#define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) -struct iwl_notif_statistics { - __le32 flag; - struct statistics_rx rx; - struct statistics_tx tx; - struct statistics_general general; -} __attribute__ ((packed)); - - -/* - * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) - */ -/* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row, - * then this notification will be sent. */ -#define CONSECUTIVE_MISSED_BCONS_TH 20 - -struct iwl_missed_beacon_notif { - __le32 consequtive_missed_beacons; - __le32 total_missed_becons; - __le32 num_expected_beacons; - __le32 num_recvd_beacons; -} __attribute__ ((packed)); - -/****************************************************************************** - * (11) - * Rx Calibration Commands: - * - *****************************************************************************/ - -#define PHY_CALIBRATE_DIFF_GAIN_CMD (7) -#define HD_TABLE_SIZE (11) - -struct iwl_sensitivity_cmd { - __le16 control; - __le16 table[HD_TABLE_SIZE]; -} __attribute__ ((packed)); - -struct iwl_calibration_cmd { - u8 opCode; - u8 flags; - __le16 reserved; - s8 diff_gain_a; - s8 diff_gain_b; - s8 diff_gain_c; - u8 reserved1; -} __attribute__ ((packed)); - -/****************************************************************************** - * (12) - * Miscellaneous Commands: - * - *****************************************************************************/ - -/* - * LEDs Command & Response - * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) - * - * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), - * this command turns it on or off, or sets up a periodic blinking cycle. - */ -struct iwl_led_cmd { - __le32 interval; /* "interval" in uSec */ - u8 id; /* 1: Activity, 2: Link, 3: Tech */ - u8 off; /* # intervals off while blinking; - * "0", with >0 "on" value, turns LED on */ - u8 on; /* # intervals on while blinking; - * "0", regardless of "off", turns LED off */ - u8 reserved; -} __attribute__ ((packed)); - -/****************************************************************************** - * (13) - * Union of all expected notifications/responses: - * - *****************************************************************************/ - -struct iwl_rx_packet { - __le32 len; - struct iwl_cmd_header hdr; - union { - struct iwl_alive_resp alive_frame; - struct iwl_rx_frame rx_frame; - struct iwl_tx_resp tx_resp; - struct iwl_spectrum_notification spectrum_notif; - struct iwl_csa_notification csa_notif; - struct iwl_error_resp err_resp; - struct iwl_card_state_notif card_state_notif; - struct iwl_beacon_notif beacon_status; - struct iwl_add_sta_resp add_sta; - struct iwl_sleep_notification sleep_notif; - struct iwl_spectrum_resp spectrum; - struct iwl_notif_statistics stats; -#if IWL == 4965 - struct iwl_compressed_ba_resp compressed_ba; - struct iwl_missed_beacon_notif missed_beacon; -#endif - __le32 status; - u8 raw[0]; - } u; -} __attribute__ ((packed)); - -#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame)) - -#endif /* __iwl_commands_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h deleted file mode 100644 index 72318d78957..00000000000 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ /dev/null @@ -1,152 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * James P. Ketrenos - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __iwl_debug_h__ -#define __iwl_debug_h__ - -#ifdef CONFIG_IWLWIFI_DEBUG -extern u32 iwl_debug_level; -#define IWL_DEBUG(level, fmt, args...) \ -do { if (iwl_debug_level & (level)) \ - printk(KERN_ERR DRV_NAME": %c %s " fmt, \ - in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) - -#define IWL_DEBUG_LIMIT(level, fmt, args...) \ -do { if ((iwl_debug_level & (level)) && net_ratelimit()) \ - printk(KERN_ERR DRV_NAME": %c %s " fmt, \ - in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) -#else -static inline void IWL_DEBUG(int level, const char *fmt, ...) -{ -} -static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) -{ -} -#endif /* CONFIG_IWLWIFI_DEBUG */ - -/* - * To use the debug system; - * - * If you are defining a new debug classification, simply add it to the #define - * list here in the form of: - * - * #define IWL_DL_xxxx VALUE - * - * shifting value to the left one bit from the previous entry. xxxx should be - * the name of the classification (for example, WEP) - * - * You then need to either add a IWL_xxxx_DEBUG() macro definition for your - * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want - * to send output to that classification. - * - * To add your debug level to the list of levels seen when you perform - * - * % cat /proc/net/iwl/debug_level - * - * you simply need to add your entry to the iwl_debug_levels array. - * - * If you do not see debug_level in /proc/net/iwl then you do not have - * CONFIG_IWLWIFI_DEBUG defined in your kernel configuration - * - */ - -#define IWL_DL_INFO (1<<0) -#define IWL_DL_MAC80211 (1<<1) -#define IWL_DL_HOST_COMMAND (1<<2) -#define IWL_DL_STATE (1<<3) - -#define IWL_DL_RADIO (1<<7) -#define IWL_DL_POWER (1<<8) -#define IWL_DL_TEMP (1<<9) - -#define IWL_DL_NOTIF (1<<10) -#define IWL_DL_SCAN (1<<11) -#define IWL_DL_ASSOC (1<<12) -#define IWL_DL_DROP (1<<13) - -#define IWL_DL_TXPOWER (1<<14) - -#define IWL_DL_AP (1<<15) - -#define IWL_DL_FW (1<<16) -#define IWL_DL_RF_KILL (1<<17) -#define IWL_DL_FW_ERRORS (1<<18) - -#define IWL_DL_LED (1<<19) - -#define IWL_DL_RATE (1<<20) - -#define IWL_DL_CALIB (1<<21) -#define IWL_DL_WEP (1<<22) -#define IWL_DL_TX (1<<23) -#define IWL_DL_RX (1<<24) -#define IWL_DL_ISR (1<<25) -#define IWL_DL_HT (1<<26) -#define IWL_DL_IO (1<<27) -#define IWL_DL_11H (1<<28) - -#define IWL_DL_STATS (1<<29) -#define IWL_DL_TX_REPLY (1<<30) -#define IWL_DL_QOS (1<<31) - -#define IWL_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) -#define IWL_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) -#define IWL_DEBUG_INFO(f, a...) IWL_DEBUG(IWL_DL_INFO, f, ## a) - -#define IWL_DEBUG_MAC80211(f, a...) IWL_DEBUG(IWL_DL_MAC80211, f, ## a) -#define IWL_DEBUG_TEMP(f, a...) IWL_DEBUG(IWL_DL_TEMP, f, ## a) -#define IWL_DEBUG_SCAN(f, a...) IWL_DEBUG(IWL_DL_SCAN, f, ## a) -#define IWL_DEBUG_RX(f, a...) IWL_DEBUG(IWL_DL_RX, f, ## a) -#define IWL_DEBUG_TX(f, a...) IWL_DEBUG(IWL_DL_TX, f, ## a) -#define IWL_DEBUG_ISR(f, a...) IWL_DEBUG(IWL_DL_ISR, f, ## a) -#define IWL_DEBUG_LED(f, a...) IWL_DEBUG(IWL_DL_LED, f, ## a) -#define IWL_DEBUG_WEP(f, a...) IWL_DEBUG(IWL_DL_WEP, f, ## a) -#define IWL_DEBUG_HC(f, a...) IWL_DEBUG(IWL_DL_HOST_COMMAND, f, ## a) -#define IWL_DEBUG_CALIB(f, a...) IWL_DEBUG(IWL_DL_CALIB, f, ## a) -#define IWL_DEBUG_FW(f, a...) IWL_DEBUG(IWL_DL_FW, f, ## a) -#define IWL_DEBUG_RF_KILL(f, a...) IWL_DEBUG(IWL_DL_RF_KILL, f, ## a) -#define IWL_DEBUG_DROP(f, a...) IWL_DEBUG(IWL_DL_DROP, f, ## a) -#define IWL_DEBUG_DROP_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_DROP, f, ## a) -#define IWL_DEBUG_AP(f, a...) IWL_DEBUG(IWL_DL_AP, f, ## a) -#define IWL_DEBUG_TXPOWER(f, a...) IWL_DEBUG(IWL_DL_TXPOWER, f, ## a) -#define IWL_DEBUG_IO(f, a...) IWL_DEBUG(IWL_DL_IO, f, ## a) -#define IWL_DEBUG_RATE(f, a...) IWL_DEBUG(IWL_DL_RATE, f, ## a) -#define IWL_DEBUG_RATE_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_RATE, f, ## a) -#define IWL_DEBUG_NOTIF(f, a...) IWL_DEBUG(IWL_DL_NOTIF, f, ## a) -#define IWL_DEBUG_ASSOC(f, a...) IWL_DEBUG(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) -#define IWL_DEBUG_ASSOC_LIMIT(f, a...) \ - IWL_DEBUG_LIMIT(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) -#define IWL_DEBUG_HT(f, a...) IWL_DEBUG(IWL_DL_HT, f, ## a) -#define IWL_DEBUG_STATS(f, a...) IWL_DEBUG(IWL_DL_STATS, f, ## a) -#define IWL_DEBUG_TX_REPLY(f, a...) IWL_DEBUG(IWL_DL_TX_REPLY, f, ## a) -#define IWL_DEBUG_QOS(f, a...) IWL_DEBUG(IWL_DL_QOS, f, ## a) -#define IWL_DEBUG_RADIO(f, a...) IWL_DEBUG(IWL_DL_RADIO, f, ## a) -#define IWL_DEBUG_POWER(f, a...) IWL_DEBUG(IWL_DL_POWER, f, ## a) -#define IWL_DEBUG_11H(f, a...) IWL_DEBUG(IWL_DL_11H, f, ## a) - -#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h deleted file mode 100644 index 22cbe278add..00000000000 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ /dev/null @@ -1,336 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, - * USA - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * James P. Ketrenos - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __iwl_eeprom_h__ -#define __iwl_eeprom_h__ - -/* - * This file defines EEPROM related constants, enums, and inline functions. - * - */ - -#define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ -#define IWL_EEPROM_ACCESS_DELAY 10 /* uSec */ -/* EEPROM field values */ -#define ANTENNA_SWITCH_NORMAL 0 -#define ANTENNA_SWITCH_INVERSE 1 - -enum { - EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */ - EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */ - /* Bit 2 Reserved */ - EEPROM_CHANNEL_ACTIVE = (1 << 3), /* active scanning allowed */ - EEPROM_CHANNEL_RADAR = (1 << 4), /* radar detection required */ - EEPROM_CHANNEL_WIDE = (1 << 5), - EEPROM_CHANNEL_NARROW = (1 << 6), - EEPROM_CHANNEL_DFS = (1 << 7), /* dynamic freq selection candidate */ -}; - -/* EEPROM field lengths */ -#define EEPROM_BOARD_PBA_NUMBER_LENGTH 11 - -/* EEPROM field lengths */ -#define EEPROM_BOARD_PBA_NUMBER_LENGTH 11 -#define EEPROM_REGULATORY_SKU_ID_LENGTH 4 -#define EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH 14 -#define EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH 13 -#define EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH 12 -#define EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH 11 -#define EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH 6 - -#if IWL == 3945 -#define EEPROM_REGULATORY_CHANNELS_LENGTH ( \ - EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH + \ - EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH + \ - EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH + \ - EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH + \ - EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH) -#elif IWL == 4965 -#define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS_LENGTH 7 -#define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS_LENGTH 11 -#define EEPROM_REGULATORY_CHANNELS_LENGTH ( \ - EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH + \ - EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH + \ - EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH + \ - EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH + \ - EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH + \ - EEPROM_REGULATORY_BAND_24_FAT_CHANNELS_LENGTH + \ - EEPROM_REGULATORY_BAND_52_FAT_CHANNELS_LENGTH) -#endif - -#define EEPROM_REGULATORY_NUMBER_OF_BANDS 5 - -/* SKU Capabilities */ -#define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE (1 << 0) -#define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE (1 << 1) -#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7) - -/* *regulatory* channel data from eeprom, one for each channel */ -struct iwl_eeprom_channel { - u8 flags; /* flags copied from EEPROM */ - s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ -} __attribute__ ((packed)); - -/* - * Mapping of a Tx power level, at factory calibration temperature, - * to a radio/DSP gain table index. - * One for each of 5 "sample" power levels in each band. - * v_det is measured at the factory, using the 3945's built-in power amplifier - * (PA) output voltage detector. This same detector is used during Tx of - * long packets in normal operation to provide feedback as to proper output - * level. - * Data copied from EEPROM. - */ -struct iwl_eeprom_txpower_sample { - u8 gain_index; /* index into power (gain) setup table ... */ - s8 power; /* ... for this pwr level for this chnl group */ - u16 v_det; /* PA output voltage */ -} __attribute__ ((packed)); - -/* - * Mappings of Tx power levels -> nominal radio/DSP gain table indexes. - * One for each channel group (a.k.a. "band") (1 for BG, 4 for A). - * Tx power setup code interpolates between the 5 "sample" power levels - * to determine the nominal setup for a requested power level. - * Data copied from EEPROM. - * DO NOT ALTER THIS STRUCTURE!!! - */ -struct iwl_eeprom_txpower_group { - struct iwl_eeprom_txpower_sample samples[5]; /* 5 power levels */ - s32 a, b, c, d, e; /* coefficients for voltage->power - * formula (signed) */ - s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on - * frequency (signed) */ - s8 saturation_power; /* highest power possible by h/w in this - * band */ - u8 group_channel; /* "representative" channel # in this band */ - s16 temperature; /* h/w temperature at factory calib this band - * (signed) */ -} __attribute__ ((packed)); - -/* - * Temperature-based Tx-power compensation data, not band-specific. - * These coefficients are use to modify a/b/c/d/e coeffs based on - * difference between current temperature and factory calib temperature. - * Data copied from EEPROM. - */ -struct iwl_eeprom_temperature_corr { - u32 Ta; - u32 Tb; - u32 Tc; - u32 Td; - u32 Te; -} __attribute__ ((packed)); - -#if IWL == 4965 -#define EEPROM_TX_POWER_TX_CHAINS (2) -#define EEPROM_TX_POWER_BANDS (8) -#define EEPROM_TX_POWER_MEASUREMENTS (3) -#define EEPROM_TX_POWER_VERSION (2) -#define EEPROM_TX_POWER_VERSION_NEW (5) - -struct iwl_eeprom_calib_measure { - u8 temperature; - u8 gain_idx; - u8 actual_pow; - s8 pa_det; -} __attribute__ ((packed)); - -struct iwl_eeprom_calib_ch_info { - u8 ch_num; - struct iwl_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS] - [EEPROM_TX_POWER_MEASUREMENTS]; -} __attribute__ ((packed)); - -struct iwl_eeprom_calib_subband_info { - u8 ch_from; - u8 ch_to; - struct iwl_eeprom_calib_ch_info ch1; - struct iwl_eeprom_calib_ch_info ch2; -} __attribute__ ((packed)); - -struct iwl_eeprom_calib_info { - u8 saturation_power24; - u8 saturation_power52; - s16 voltage; /* signed */ - struct iwl_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS]; -} __attribute__ ((packed)); - -#endif - -struct iwl_eeprom { - u8 reserved0[16]; -#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ - u16 device_id; /* abs.ofs: 16 */ - u8 reserved1[2]; -#define EEPROM_PMC (2*0x0A) /* 2 bytes */ - u16 pmc; /* abs.ofs: 20 */ - u8 reserved2[20]; -#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */ - u8 mac_address[6]; /* abs.ofs: 42 */ - u8 reserved3[58]; -#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */ - u16 board_revision; /* abs.ofs: 106 */ - u8 reserved4[11]; -#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */ - u8 board_pba_number[9]; /* abs.ofs: 119 */ - u8 reserved5[8]; -#define EEPROM_VERSION (2*0x44) /* 2 bytes */ - u16 version; /* abs.ofs: 136 */ -#define EEPROM_SKU_CAP (2*0x45) /* 1 bytes */ - u8 sku_cap; /* abs.ofs: 138 */ -#define EEPROM_LEDS_MODE (2*0x45+1) /* 1 bytes */ - u8 leds_mode; /* abs.ofs: 139 */ -#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ - u16 oem_mode; -#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */ - u16 wowlan_mode; /* abs.ofs: 142 */ -#define EEPROM_LEDS_TIME_INTERVAL (2*0x48) /* 2 bytes */ - u16 leds_time_interval; /* abs.ofs: 144 */ -#define EEPROM_LEDS_OFF_TIME (2*0x49) /* 1 bytes */ - u8 leds_off_time; /* abs.ofs: 146 */ -#define EEPROM_LEDS_ON_TIME (2*0x49+1) /* 1 bytes */ - u8 leds_on_time; /* abs.ofs: 147 */ -#define EEPROM_ALMGOR_M_VERSION (2*0x4A) /* 1 bytes */ - u8 almgor_m_version; /* abs.ofs: 148 */ -#define EEPROM_ANTENNA_SWITCH_TYPE (2*0x4A+1) /* 1 bytes */ - u8 antenna_switch_type; /* abs.ofs: 149 */ -#if IWL == 3945 - u8 reserved6[42]; -#else - u8 reserved6[8]; -#define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */ - u16 board_revision_4965; /* abs.ofs: 158 */ - u8 reserved7[13]; -#define EEPROM_4965_BOARD_PBA (2*0x56+1) /* 9 bytes */ - u8 board_pba_number_4965[9]; /* abs.ofs: 173 */ - u8 reserved8[10]; -#endif -#define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */ - u8 sku_id[4]; /* abs.ofs: 192 */ -#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */ - u16 band_1_count; /* abs.ofs: 196 */ -#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */ - struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */ -#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */ - u16 band_2_count; /* abs.ofs: 226 */ -#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */ - struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ -#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */ - u16 band_3_count; /* abs.ofs: 254 */ -#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */ - struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ -#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */ - u16 band_4_count; /* abs.ofs: 280 */ -#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */ - struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ -#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */ - u16 band_5_count; /* abs.ofs: 304 */ -#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */ - struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ - -/* From here on out the EEPROM diverges between the 4965 and the 3945 */ -#if IWL == 3945 - - u8 reserved9[194]; - -#define EEPROM_TXPOWER_CALIB_GROUP0 0x200 -#define EEPROM_TXPOWER_CALIB_GROUP1 0x240 -#define EEPROM_TXPOWER_CALIB_GROUP2 0x280 -#define EEPROM_TXPOWER_CALIB_GROUP3 0x2c0 -#define EEPROM_TXPOWER_CALIB_GROUP4 0x300 -#define IWL_NUM_TX_CALIB_GROUPS 5 - struct iwl_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS]; -/* abs.ofs: 512 */ -#define EEPROM_CALIB_TEMPERATURE_CORRECT 0x340 - struct iwl_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ - u8 reserved16[172]; /* fill out to full 1024 byte block */ - -/* 4965AGN adds fat channel support */ -#elif IWL == 4965 - - u8 reserved10[2]; -#define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS (2*0xA0) /* 14 bytes */ - struct iwl_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */ - u8 reserved11[2]; -#define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8) /* 22 bytes */ - struct iwl_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */ - u8 reserved12[6]; -#define EEPROM_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */ - u16 calib_version; /* abs.ofs: 364 */ - u8 reserved13[2]; -#define EEPROM_SATURATION_POWER_OFFSET (2*0xB8) /* 2 bytes */ - u16 satruation_power; /* abs.ofs: 368 */ - u8 reserved14[94]; -#define EEPROM_IWL_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */ - struct iwl_eeprom_calib_info calib_info; /* abs.ofs: 464 */ - - u8 reserved16[140]; /* fill out to full 1024 byte block */ - -#endif - -} __attribute__ ((packed)); - -#define IWL_EEPROM_IMAGE_SIZE 1024 - -#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-hw.h b/drivers/net/wireless/iwlwifi/iwl-hw.h deleted file mode 100644 index 8968a95352d..00000000000 --- a/drivers/net/wireless/iwlwifi/iwl-hw.h +++ /dev/null @@ -1,537 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, - * USA - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * James P. Ketrenos - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __iwlwifi_hw_h__ -#define __iwlwifi_hw_h__ - -/* - * This file defines hardware constants common to 3945 and 4965. - * - * Device-specific constants are defined in iwl-3945-hw.h and iwl-4965-hw.h, - * although this file contains a few definitions for which the .c - * implementation is the same for 3945 and 4965, except for the value of - * a constant. - * - * uCode API constants are defined in iwl-commands.h. - * - * NOTE: DO NOT PUT OS IMPLEMENTATION-SPECIFIC DECLARATIONS HERE - * - * The iwl-*hw.h (and files they include) files should remain OS/driver - * implementation independent, declaring only the hardware interface. - */ - -/* uCode queue management definitions */ -#define IWL_CMD_QUEUE_NUM 4 -#define IWL_CMD_FIFO_NUM 4 -#define IWL_BACK_QUEUE_FIRST_ID 7 - -/* Tx rates */ -#define IWL_CCK_RATES 4 -#define IWL_OFDM_RATES 8 - -#if IWL == 3945 -#define IWL_HT_RATES 0 -#elif IWL == 4965 -#define IWL_HT_RATES 16 -#endif - -#define IWL_MAX_RATES (IWL_CCK_RATES+IWL_OFDM_RATES+IWL_HT_RATES) - -/* Time constants */ -#define SHORT_SLOT_TIME 9 -#define LONG_SLOT_TIME 20 - -/* RSSI to dBm */ -#if IWL == 3945 -#define IWL_RSSI_OFFSET 95 -#elif IWL == 4965 -#define IWL_RSSI_OFFSET 44 -#endif - -#include "iwl-eeprom.h" -#include "iwl-commands.h" - -#define PCI_LINK_CTRL 0x0F0 -#define PCI_POWER_SOURCE 0x0C8 -#define PCI_REG_WUM8 0x0E8 -#define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) - -/*=== CSR (control and status registers) ===*/ -#define CSR_BASE (0x000) - -#define CSR_SW_VER (CSR_BASE+0x000) -#define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */ -#define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */ -#define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */ -#define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */ -#define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/ -#define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */ -#define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/ -#define CSR_GP_CNTRL (CSR_BASE+0x024) -#define CSR_HW_REV (CSR_BASE+0x028) -#define CSR_EEPROM_REG (CSR_BASE+0x02c) -#define CSR_EEPROM_GP (CSR_BASE+0x030) -#define CSR_GP_UCODE (CSR_BASE+0x044) -#define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054) -#define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058) -#define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c) -#define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060) -#define CSR_LED_REG (CSR_BASE+0x094) -#define CSR_DRAM_INT_TBL_CTL (CSR_BASE+0x0A0) -#define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) -#define CSR_ANA_PLL_CFG (CSR_BASE+0x20c) -#define CSR_HW_REV_WA_REG (CSR_BASE+0x22C) - -/* HW I/F configuration */ -#define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB (0x00000100) -#define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM (0x00000200) -#define CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC (0x00000400) -#define CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE (0x00000800) -#define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000) -#define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000) -#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) - -/* interrupt flags in INTA, set by uCode or hardware (e.g. dma), - * acknowledged (reset) by host writing "1" to flagged bits. */ -#define CSR_INT_BIT_FH_RX (1<<31) /* Rx DMA, cmd responses, FH_INT[17:16] */ -#define CSR_INT_BIT_HW_ERR (1<<29) /* DMA hardware error FH_INT[31] */ -#define CSR_INT_BIT_DNLD (1<<28) /* uCode Download */ -#define CSR_INT_BIT_FH_TX (1<<27) /* Tx DMA FH_INT[1:0] */ -#define CSR_INT_BIT_MAC_CLK_ACTV (1<<26) /* NIC controller's clock toggled on/off */ -#define CSR_INT_BIT_SW_ERR (1<<25) /* uCode error */ -#define CSR_INT_BIT_RF_KILL (1<<7) /* HW RFKILL switch GP_CNTRL[27] toggled */ -#define CSR_INT_BIT_CT_KILL (1<<6) /* Critical temp (chip too hot) rfkill */ -#define CSR_INT_BIT_SW_RX (1<<3) /* Rx, command responses, 3945 */ -#define CSR_INT_BIT_WAKEUP (1<<1) /* NIC controller waking up (pwr mgmt) */ -#define CSR_INT_BIT_ALIVE (1<<0) /* uCode interrupts once it initializes */ - -#define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \ - CSR_INT_BIT_HW_ERR | \ - CSR_INT_BIT_FH_TX | \ - CSR_INT_BIT_SW_ERR | \ - CSR_INT_BIT_RF_KILL | \ - CSR_INT_BIT_SW_RX | \ - CSR_INT_BIT_WAKEUP | \ - CSR_INT_BIT_ALIVE) - -/* interrupt flags in FH (flow handler) (PCI busmaster DMA) */ -#define CSR_FH_INT_BIT_ERR (1<<31) /* Error */ -#define CSR_FH_INT_BIT_HI_PRIOR (1<<30) /* High priority Rx, bypass coalescing */ -#define CSR_FH_INT_BIT_RX_CHNL2 (1<<18) /* Rx channel 2 (3945 only) */ -#define CSR_FH_INT_BIT_RX_CHNL1 (1<<17) /* Rx channel 1 */ -#define CSR_FH_INT_BIT_RX_CHNL0 (1<<16) /* Rx channel 0 */ -#define CSR_FH_INT_BIT_TX_CHNL6 (1<<6) /* Tx channel 6 (3945 only) */ -#define CSR_FH_INT_BIT_TX_CHNL1 (1<<1) /* Tx channel 1 */ -#define CSR_FH_INT_BIT_TX_CHNL0 (1<<0) /* Tx channel 0 */ - -#define CSR_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \ - CSR_FH_INT_BIT_RX_CHNL2 | \ - CSR_FH_INT_BIT_RX_CHNL1 | \ - CSR_FH_INT_BIT_RX_CHNL0) - -#define CSR_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL6 | \ - CSR_FH_INT_BIT_TX_CHNL1 | \ - CSR_FH_INT_BIT_TX_CHNL0 ) - - -/* RESET */ -#define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001) -#define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002) -#define CSR_RESET_REG_FLAG_SW_RESET (0x00000080) -#define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100) -#define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200) - -/* GP (general purpose) CONTROL */ -#define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001) -#define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004) -#define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008) -#define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010) - -#define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001) - -#define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000) -#define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000) -#define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) - - -/* EEPROM REG */ -#define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001) -#define CSR_EEPROM_REG_BIT_CMD (0x00000002) - -/* EEPROM GP */ -#define CSR_EEPROM_GP_VALID_MSK (0x00000006) -#define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000) -#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180) - -/* UCODE DRV GP */ -#define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001) -#define CSR_UCODE_SW_BIT_RFKILL (0x00000002) -#define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004) -#define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008) - -/* GPIO */ -#define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200) -#define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000) -#define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC CSR_GPIO_IN_BIT_AUX_POWER - -/* GI Chicken Bits */ -#define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000) -#define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000) - -/* CSR_ANA_PLL_CFG */ -#define CSR_ANA_PLL_CFG_SH (0x00880300) - -#define CSR_LED_REG_TRUN_ON (0x00000078) -#define CSR_LED_REG_TRUN_OFF (0x00000038) -#define CSR_LED_BSM_CTRL_MSK (0xFFFFFFDF) - -/* DRAM_INT_TBL_CTRL */ -#define CSR_DRAM_INT_TBL_CTRL_EN (1<<31) -#define CSR_DRAM_INT_TBL_CTRL_WRAP_CHK (1<<27) - -/*=== HBUS (Host-side Bus) ===*/ -#define HBUS_BASE (0x400) - -#define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c) -#define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010) -#define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018) -#define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c) -#define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044) -#define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048) -#define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c) -#define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050) -#define HBUS_TARG_WRPTR (HBUS_BASE+0x060) - -#define HBUS_TARG_MBX_C (HBUS_BASE+0x030) - - -/* SCD (Scheduler) */ -#define SCD_BASE (CSR_BASE + 0x2E00) - -#define SCD_MODE_REG (SCD_BASE + 0x000) -#define SCD_ARASTAT_REG (SCD_BASE + 0x004) -#define SCD_TXFACT_REG (SCD_BASE + 0x010) -#define SCD_TXF4MF_REG (SCD_BASE + 0x014) -#define SCD_TXF5MF_REG (SCD_BASE + 0x020) -#define SCD_SBYP_MODE_1_REG (SCD_BASE + 0x02C) -#define SCD_SBYP_MODE_2_REG (SCD_BASE + 0x030) - -/*=== FH (data Flow Handler) ===*/ -#define FH_BASE (0x800) - -#define FH_CBCC_TABLE (FH_BASE+0x140) -#define FH_TFDB_TABLE (FH_BASE+0x180) -#define FH_RCSR_TABLE (FH_BASE+0x400) -#define FH_RSSR_TABLE (FH_BASE+0x4c0) -#define FH_TCSR_TABLE (FH_BASE+0x500) -#define FH_TSSR_TABLE (FH_BASE+0x680) - -/* TFDB (Transmit Frame Buffer Descriptor) */ -#define FH_TFDB(_channel, buf) \ - (FH_TFDB_TABLE+((_channel)*2+(buf))*0x28) -#define ALM_FH_TFDB_CHNL_BUF_CTRL_REG(_channel) \ - (FH_TFDB_TABLE + 0x50 * _channel) -/* CBCC _channel is [0,2] */ -#define FH_CBCC(_channel) (FH_CBCC_TABLE+(_channel)*0x8) -#define FH_CBCC_CTRL(_channel) (FH_CBCC(_channel)+0x00) -#define FH_CBCC_BASE(_channel) (FH_CBCC(_channel)+0x04) - -/* RCSR _channel is [0,2] */ -#define FH_RCSR(_channel) (FH_RCSR_TABLE+(_channel)*0x40) -#define FH_RCSR_CONFIG(_channel) (FH_RCSR(_channel)+0x00) -#define FH_RCSR_RBD_BASE(_channel) (FH_RCSR(_channel)+0x04) -#define FH_RCSR_WPTR(_channel) (FH_RCSR(_channel)+0x20) -#define FH_RCSR_RPTR_ADDR(_channel) (FH_RCSR(_channel)+0x24) - -#if IWL == 3945 -#define FH_RSCSR_CHNL0_WPTR (FH_RCSR_WPTR(0)) -#elif IWL == 4965 -#define FH_RSCSR_CHNL0_WPTR (FH_RSCSR_CHNL0_RBDCB_WPTR_REG) -#endif - -/* RSSR */ -#define FH_RSSR_CTRL (FH_RSSR_TABLE+0x000) -#define FH_RSSR_STATUS (FH_RSSR_TABLE+0x004) -/* TCSR */ -#define FH_TCSR(_channel) (FH_TCSR_TABLE+(_channel)*0x20) -#define FH_TCSR_CONFIG(_channel) (FH_TCSR(_channel)+0x00) -#define FH_TCSR_CREDIT(_channel) (FH_TCSR(_channel)+0x04) -#define FH_TCSR_BUFF_STTS(_channel) (FH_TCSR(_channel)+0x08) -/* TSSR */ -#define FH_TSSR_CBB_BASE (FH_TSSR_TABLE+0x000) -#define FH_TSSR_MSG_CONFIG (FH_TSSR_TABLE+0x008) -#define FH_TSSR_TX_STATUS (FH_TSSR_TABLE+0x010) -/* 18 - reserved */ - -/* card static random access memory (SRAM) for processor data and instructs */ -#define RTC_INST_LOWER_BOUND (0x000000) -#define RTC_DATA_LOWER_BOUND (0x800000) - - -/* DBM */ - -#define ALM_FH_SRVC_CHNL (6) - -#define ALM_FH_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20) -#define ALM_FH_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4) - -#define ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000) - -#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000) - -#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000) - -#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000) - -#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000) - -#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000) - -#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) -#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001) - -#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) -#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) - -#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) - -#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) - -#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) -#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) - -#define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000) - -#define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001) - -#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000) -#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000) - -#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400) - -#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100) -#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080) - -#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020) -#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005) - -#define ALM_TB_MAX_BYTES_COUNT (0xFFF0) - -#define ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) \ - ((1LU << _channel) << 24) -#define ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel) \ - ((1LU << _channel) << 16) - -#define ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_channel) \ - (ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) | \ - ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel)) -#define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */ -#define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */ - -#define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004) - -#define TFD_QUEUE_MIN 0 -#define TFD_QUEUE_MAX 6 -#define TFD_QUEUE_SIZE_MAX (256) - -/* spectrum and channel data structures */ -#define IWL_NUM_SCAN_RATES (2) - -#define IWL_SCAN_FLAG_24GHZ (1<<0) -#define IWL_SCAN_FLAG_52GHZ (1<<1) -#define IWL_SCAN_FLAG_ACTIVE (1<<2) -#define IWL_SCAN_FLAG_DIRECT (1<<3) - -#define IWL_MAX_CMD_SIZE 1024 - -#define IWL_DEFAULT_TX_RETRY 15 -#define IWL_MAX_TX_RETRY 16 - -/*********************************************/ - -#define RFD_SIZE 4 -#define NUM_TFD_CHUNKS 4 - -#define RX_QUEUE_SIZE 256 -#define RX_QUEUE_MASK 255 -#define RX_QUEUE_SIZE_LOG 8 - -/* QoS definitions */ - -#define CW_MIN_OFDM 15 -#define CW_MAX_OFDM 1023 -#define CW_MIN_CCK 31 -#define CW_MAX_CCK 1023 - -#define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM -#define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM -#define QOS_TX2_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 2 - 1) -#define QOS_TX3_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 4 - 1) - -#define QOS_TX0_CW_MIN_CCK CW_MIN_CCK -#define QOS_TX1_CW_MIN_CCK CW_MIN_CCK -#define QOS_TX2_CW_MIN_CCK ((CW_MIN_CCK + 1) / 2 - 1) -#define QOS_TX3_CW_MIN_CCK ((CW_MIN_CCK + 1) / 4 - 1) - -#define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM -#define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM -#define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM -#define QOS_TX3_CW_MAX_OFDM ((CW_MIN_OFDM + 1) / 2 - 1) - -#define QOS_TX0_CW_MAX_CCK CW_MAX_CCK -#define QOS_TX1_CW_MAX_CCK CW_MAX_CCK -#define QOS_TX2_CW_MAX_CCK CW_MIN_CCK -#define QOS_TX3_CW_MAX_CCK ((CW_MIN_CCK + 1) / 2 - 1) - -#define QOS_TX0_AIFS 3 -#define QOS_TX1_AIFS 7 -#define QOS_TX2_AIFS 2 -#define QOS_TX3_AIFS 2 - -#define QOS_TX0_ACM 0 -#define QOS_TX1_ACM 0 -#define QOS_TX2_ACM 0 -#define QOS_TX3_ACM 0 - -#define QOS_TX0_TXOP_LIMIT_CCK 0 -#define QOS_TX1_TXOP_LIMIT_CCK 0 -#define QOS_TX2_TXOP_LIMIT_CCK 6016 -#define QOS_TX3_TXOP_LIMIT_CCK 3264 - -#define QOS_TX0_TXOP_LIMIT_OFDM 0 -#define QOS_TX1_TXOP_LIMIT_OFDM 0 -#define QOS_TX2_TXOP_LIMIT_OFDM 3008 -#define QOS_TX3_TXOP_LIMIT_OFDM 1504 - -#define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM -#define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM -#define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM -#define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM - -#define DEF_TX0_CW_MIN_CCK CW_MIN_CCK -#define DEF_TX1_CW_MIN_CCK CW_MIN_CCK -#define DEF_TX2_CW_MIN_CCK CW_MIN_CCK -#define DEF_TX3_CW_MIN_CCK CW_MIN_CCK - -#define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM -#define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM -#define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM -#define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM - -#define DEF_TX0_CW_MAX_CCK CW_MAX_CCK -#define DEF_TX1_CW_MAX_CCK CW_MAX_CCK -#define DEF_TX2_CW_MAX_CCK CW_MAX_CCK -#define DEF_TX3_CW_MAX_CCK CW_MAX_CCK - -#define DEF_TX0_AIFS (2) -#define DEF_TX1_AIFS (2) -#define DEF_TX2_AIFS (2) -#define DEF_TX3_AIFS (2) - -#define DEF_TX0_ACM 0 -#define DEF_TX1_ACM 0 -#define DEF_TX2_ACM 0 -#define DEF_TX3_ACM 0 - -#define DEF_TX0_TXOP_LIMIT_CCK 0 -#define DEF_TX1_TXOP_LIMIT_CCK 0 -#define DEF_TX2_TXOP_LIMIT_CCK 0 -#define DEF_TX3_TXOP_LIMIT_CCK 0 - -#define DEF_TX0_TXOP_LIMIT_OFDM 0 -#define DEF_TX1_TXOP_LIMIT_OFDM 0 -#define DEF_TX2_TXOP_LIMIT_OFDM 0 -#define DEF_TX3_TXOP_LIMIT_OFDM 0 - -#define QOS_QOS_SETS 3 -#define QOS_PARAM_SET_ACTIVE 0 -#define QOS_PARAM_SET_DEF_CCK 1 -#define QOS_PARAM_SET_DEF_OFDM 2 - -#define CTRL_QOS_NO_ACK (0x0020) -#define DCT_FLAG_EXT_QOS_ENABLED (0x10) - -#define U32_PAD(n) ((4-(n))&0x3) - -/* - * Generic queue structure - * - * Contains common data for Rx and Tx queues - */ -#define TFD_CTL_COUNT_SET(n) (n<<24) -#define TFD_CTL_COUNT_GET(ctl) ((ctl>>24) & 7) -#define TFD_CTL_PAD_SET(n) (n<<28) -#define TFD_CTL_PAD_GET(ctl) (ctl>>28) - -#define TFD_TX_CMD_SLOTS 256 -#define TFD_CMD_SLOTS 32 - -#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ - sizeof(struct iwl_cmd_meta)) - -/* - * RX related structures and functions - */ -#define RX_FREE_BUFFERS 64 -#define RX_LOW_WATERMARK 8 - -#endif /* __iwlwifi_hw_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h deleted file mode 100644 index 43afcda6f73..00000000000 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ /dev/null @@ -1,431 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * James P. Ketrenos - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __iwl_io_h__ -#define __iwl_io_h__ - -#include - -#include "iwl-debug.h" - -/* - * IO, register, and NIC memory access functions - * - * NOTE on naming convention and macro usage for these - * - * A single _ prefix before a an access function means that no state - * check or debug information is printed when that function is called. - * - * A double __ prefix before an access function means that state is checked - * and the current line number is printed in addition to any other debug output. - * - * The non-prefixed name is the #define that maps the caller into a - * #define that provides the caller's __LINE__ to the double prefix version. - * - * If you wish to call the function without any debug or state checking, - * you should use the single _ prefix version (as is used by dependent IO - * routines, for example _iwl_read_direct32 calls the non-check version of - * _iwl_read32.) - * - * These declarations are *extremely* useful in quickly isolating code deltas - * which result in misconfiguring of the hardware I/O. In combination with - * git-bisect and the IO debug level you can quickly determine the specific - * commit which breaks the IO sequence to the hardware. - * - */ - -#define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) -#ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, - u32 ofs, u32 val) -{ - IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); - _iwl_write32(iwl, ofs, val); -} -#define iwl_write32(iwl, ofs, val) \ - __iwl_write32(__FILE__, __LINE__, iwl, ofs, val) -#else -#define iwl_write32(iwl, ofs, val) _iwl_write32(iwl, ofs, val) -#endif - -#define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) -#ifdef CONFIG_IWLWIFI_DEBUG -static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs) -{ - IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); - return _iwl_read32(iwl, ofs); -} -#define iwl_read32(iwl, ofs) __iwl_read32(__FILE__, __LINE__, iwl, ofs) -#else -#define iwl_read32(p, o) _iwl_read32(p, o) -#endif - -static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, - u32 bits, u32 mask, int timeout) -{ - int i = 0; - - do { - if ((_iwl_read32(priv, addr) & mask) == (bits & mask)) - return i; - mdelay(10); - i += 10; - } while (i < timeout); - - return -ETIMEDOUT; -} -#ifdef CONFIG_IWLWIFI_DEBUG -static inline int __iwl_poll_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 addr, - u32 bits, u32 mask, int timeout) -{ - int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); - if (unlikely(ret == -ETIMEDOUT)) - IWL_DEBUG_IO - ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n", - addr, bits, mask, f, l); - else - IWL_DEBUG_IO - ("poll_bit(0x%08X, 0x%08X, 0x%08X) = 0x%08X - %s %d\n", - addr, bits, mask, ret, f, l); - return ret; -} -#define iwl_poll_bit(iwl, addr, bits, mask, timeout) \ - __iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) -#else -#define iwl_poll_bit(p, a, b, m, t) _iwl_poll_bit(p, a, b, m, t) -#endif - -static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) -{ - _iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask); -} -#ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_set_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 reg, u32 mask) -{ - u32 val = _iwl_read32(priv, reg) | mask; - IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); - _iwl_write32(priv, reg, val); -} -#define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m) -#else -#define iwl_set_bit(p, r, m) _iwl_set_bit(p, r, m) -#endif - -static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) -{ - _iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask); -} -#ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_clear_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 reg, u32 mask) -{ - u32 val = _iwl_read32(priv, reg) & ~mask; - IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); - _iwl_write32(priv, reg, val); -} -#define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m) -#else -#define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m) -#endif - -static inline int _iwl_grab_nic_access(struct iwl_priv *priv) -{ - int ret; - u32 gp_ctl; - -#ifdef CONFIG_IWLWIFI_DEBUG - if (atomic_read(&priv->restrict_refcnt)) - return 0; -#endif - if (test_bit(STATUS_RF_KILL_HW, &priv->status) || - test_bit(STATUS_RF_KILL_SW, &priv->status)) { - IWL_WARNING("WARNING: Requesting MAC access during RFKILL " - "wakes up NIC\n"); - - /* 10 msec allows time for NIC to complete its data save */ - gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL); - if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { - IWL_DEBUG_RF_KILL("Wait for complete power-down, " - "gpctl = 0x%08x\n", gp_ctl); - mdelay(10); - } else - IWL_DEBUG_RF_KILL("power-down complete, " - "gpctl = 0x%08x\n", gp_ctl); - } - - /* this bit wakes up the NIC */ - _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, - (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | - CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50); - if (ret < 0) { - IWL_ERROR("MAC is in deep sleep!\n"); - return -EIO; - } - -#ifdef CONFIG_IWLWIFI_DEBUG - atomic_inc(&priv->restrict_refcnt); -#endif - return 0; -} - -#ifdef CONFIG_IWLWIFI_DEBUG -static inline int __iwl_grab_nic_access(const char *f, u32 l, - struct iwl_priv *priv) -{ - if (atomic_read(&priv->restrict_refcnt)) - IWL_DEBUG_INFO("Grabbing access while already held at " - "line %d.\n", l); - - IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l); - return _iwl_grab_nic_access(priv); -} -#define iwl_grab_nic_access(priv) \ - __iwl_grab_nic_access(__FILE__, __LINE__, priv) -#else -#define iwl_grab_nic_access(priv) \ - _iwl_grab_nic_access(priv) -#endif - -static inline void _iwl_release_nic_access(struct iwl_priv *priv) -{ -#ifdef CONFIG_IWLWIFI_DEBUG - if (atomic_dec_and_test(&priv->restrict_refcnt)) -#endif - _iwl_clear_bit(priv, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); -} -#ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_release_nic_access(const char *f, u32 l, - struct iwl_priv *priv) -{ - if (atomic_read(&priv->restrict_refcnt) <= 0) - IWL_ERROR("Release unheld nic access at line %d.\n", l); - - IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l); - _iwl_release_nic_access(priv); -} -#define iwl_release_nic_access(priv) \ - __iwl_release_nic_access(__FILE__, __LINE__, priv) -#else -#define iwl_release_nic_access(priv) \ - _iwl_release_nic_access(priv) -#endif - -static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) -{ - return _iwl_read32(priv, reg); -} -#ifdef CONFIG_IWLWIFI_DEBUG -static inline u32 __iwl_read_direct32(const char *f, u32 l, - struct iwl_priv *priv, u32 reg) -{ - u32 value = _iwl_read_direct32(priv, reg); - if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Nic access not held from %s %d\n", f, l); - IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value, - f, l); - return value; -} -#define iwl_read_direct32(priv, reg) \ - __iwl_read_direct32(__FILE__, __LINE__, priv, reg) -#else -#define iwl_read_direct32 _iwl_read_direct32 -#endif - -static inline void _iwl_write_direct32(struct iwl_priv *priv, - u32 reg, u32 value) -{ - _iwl_write32(priv, reg, value); -} -#ifdef CONFIG_IWLWIFI_DEBUG -static void __iwl_write_direct32(u32 line, - struct iwl_priv *priv, u32 reg, u32 value) -{ - if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Nic access not held from line %d\n", line); - _iwl_write_direct32(priv, reg, value); -} -#define iwl_write_direct32(priv, reg, value) \ - __iwl_write_direct32(__LINE__, priv, reg, value) -#else -#define iwl_write_direct32 _iwl_write_direct32 -#endif - -static inline void iwl_write_reg_buf(struct iwl_priv *priv, - u32 reg, u32 len, u32 *values) -{ - u32 count = sizeof(u32); - - if ((priv != NULL) && (values != NULL)) { - for (; 0 < len; len -= count, reg += count, values++) - _iwl_write_direct32(priv, reg, *values); - } -} - -static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, - u32 addr, u32 mask, int timeout) -{ - int i = 0; - - do { - if ((_iwl_read_direct32(priv, addr) & mask) == mask) - return i; - mdelay(10); - i += 10; - } while (i < timeout); - - return -ETIMEDOUT; -} - -#ifdef CONFIG_IWLWIFI_DEBUG -static inline int __iwl_poll_direct_bit(const char *f, u32 l, - struct iwl_priv *priv, - u32 addr, u32 mask, int timeout) -{ - int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout); - - if (unlikely(ret == -ETIMEDOUT)) - IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - " - "timedout - %s %d\n", addr, mask, f, l); - else - IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) = 0x%08X " - "- %s %d\n", addr, mask, ret, f, l); - return ret; -} -#define iwl_poll_direct_bit(iwl, addr, mask, timeout) \ - __iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) -#else -#define iwl_poll_direct_bit _iwl_poll_direct_bit -#endif - -static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) -{ - _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); - return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); -} -#ifdef CONFIG_IWLWIFI_DEBUG -static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) -{ - if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Nic access not held from line %d\n", line); - return _iwl_read_prph(priv, reg); -} - -#define iwl_read_prph(priv, reg) \ - __iwl_read_prph(__LINE__, priv, reg) -#else -#define iwl_read_prph _iwl_read_prph -#endif - -static inline void _iwl_write_prph(struct iwl_priv *priv, - u32 addr, u32 val) -{ - _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, - ((addr & 0x0000FFFF) | (3 << 24))); - _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); -} -#ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, - u32 addr, u32 val) -{ - if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Nic access from line %d\n", line); - _iwl_write_prph(priv, addr, val); -} - -#define iwl_write_prph(priv, addr, val) \ - __iwl_write_prph(__LINE__, priv, addr, val); -#else -#define iwl_write_prph _iwl_write_prph -#endif - -#define _iwl_set_bits_prph(priv, reg, mask) \ - _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) -#ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, - u32 reg, u32 mask) -{ - if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Nic access not held from line %d\n", line); - - _iwl_set_bits_prph(priv, reg, mask); -} -#define iwl_set_bits_prph(priv, reg, mask) \ - __iwl_set_bits_prph(__LINE__, priv, reg, mask) -#else -#define iwl_set_bits_prph _iwl_set_bits_prph -#endif - -#define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ - _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) - -#ifdef CONFIG_IWLWIFI_DEBUG -static inline void __iwl_set_bits_mask_prph(u32 line, - struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) -{ - if (!atomic_read(&priv->restrict_refcnt)) - IWL_ERROR("Nic access not held from line %d\n", line); - _iwl_set_bits_mask_prph(priv, reg, bits, mask); -} -#define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ - __iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) -#else -#define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph -#endif - -static inline void iwl_clear_bits_prph(struct iwl_priv - *priv, u32 reg, u32 mask) -{ - u32 val = _iwl_read_prph(priv, reg); - _iwl_write_prph(priv, reg, (val & ~mask)); -} - -static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) -{ - iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); - return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); -} - -static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) -{ - iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); - iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); -} - -static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, - u32 len, u32 *values) -{ - iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); - for (; 0 < len; len -= sizeof(u32), values++) - iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); -} -#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-priv.h b/drivers/net/wireless/iwlwifi/iwl-priv.h deleted file mode 100644 index c25f2ffccff..00000000000 --- a/drivers/net/wireless/iwlwifi/iwl-priv.h +++ /dev/null @@ -1,307 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * James P. Ketrenos - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __iwl_priv_h__ -#define __iwl_priv_h__ - -#include - -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT - -enum { - MEASUREMENT_READY = (1 << 0), - MEASUREMENT_ACTIVE = (1 << 1), -}; - -#endif - -struct iwl_priv { - - /* ieee device used by generic ieee processing code */ - struct ieee80211_hw *hw; - struct ieee80211_channel *ieee_channels; - struct ieee80211_rate *ieee_rates; - - /* temporary frame storage list */ - struct list_head free_frames; - int frames_count; - - u8 phymode; - int alloc_rxb_skb; - - void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); - - const struct ieee80211_hw_mode *modes; - -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT - /* spectrum measurement report caching */ - struct iwl_spectrum_notification measure_report; - u8 measurement_status; -#endif - /* ucode beacon time */ - u32 ucode_beacon_time; - - /* we allocate array of iwl_channel_info for NIC's valid channels. - * Access via channel # using indirect index array */ - struct iwl_channel_info *channel_info; /* channel info array */ - u8 channel_count; /* # of channels */ - - /* each calibration channel group in the EEPROM has a derived - * clip setting for each rate. */ - const struct iwl_clip_group clip_groups[5]; - - /* thermal calibration */ - s32 temperature; /* degrees Kelvin */ - s32 last_temperature; - - /* Scan related variables */ - unsigned long last_scan_jiffies; - unsigned long scan_start; - unsigned long scan_pass_start; - unsigned long scan_start_tsf; - int scan_bands; - int one_direct_scan; - u8 direct_ssid_len; - u8 direct_ssid[IW_ESSID_MAX_SIZE]; - struct iwl_scan_cmd *scan; - u8 only_active_channel; - - /* spinlock */ - spinlock_t lock; /* protect general shared data */ - spinlock_t hcmd_lock; /* protect hcmd */ - struct mutex mutex; - - /* basic pci-network driver stuff */ - struct pci_dev *pci_dev; - - /* pci hardware address support */ - void __iomem *hw_base; - - /* uCode images, save to reload in case of failure */ - struct fw_desc ucode_code; /* runtime inst */ - struct fw_desc ucode_data; /* runtime data original */ - struct fw_desc ucode_data_backup; /* runtime data save/restore */ - struct fw_desc ucode_init; /* initialization inst */ - struct fw_desc ucode_init_data; /* initialization data */ - struct fw_desc ucode_boot; /* bootstrap inst */ - - - struct iwl_rxon_time_cmd rxon_timing; - - /* We declare this const so it can only be - * changed via explicit cast within the - * routines that actually update the physical - * hardware */ - const struct iwl_rxon_cmd active_rxon; - struct iwl_rxon_cmd staging_rxon; - - int error_recovering; - struct iwl_rxon_cmd recovery_rxon; - - /* 1st responses from initialize and runtime uCode images. - * 4965's initialize alive response contains some calibration data. */ - struct iwl_init_alive_resp card_alive_init; - struct iwl_alive_resp card_alive; - -#ifdef LED - /* LED related variables */ - struct iwl_activity_blink activity; - unsigned long led_packets; - int led_state; -#endif - - u16 active_rate; - u16 active_rate_basic; - - u8 call_post_assoc_from_beacon; - u8 assoc_station_added; -#if IWL == 4965 - u8 use_ant_b_for_management_frame; /* Tx antenna selection */ - /* HT variables */ - u8 is_dup; - u8 is_ht_enabled; - u8 channel_width; /* 0=20MHZ, 1=40MHZ */ - u8 current_channel_width; - u8 valid_antenna; /* Bit mask of antennas actually connected */ -#ifdef CONFIG_IWLWIFI_SENSITIVITY - struct iwl_sensitivity_data sensitivity_data; - struct iwl_chain_noise_data chain_noise_data; - u8 start_calib; - __le16 sensitivity_tbl[HD_TABLE_SIZE]; -#endif /*CONFIG_IWLWIFI_SENSITIVITY*/ - -#ifdef CONFIG_IWLWIFI_HT - struct sta_ht_info current_assoc_ht; -#endif - u8 active_rate_ht[2]; - u8 last_phy_res[100]; - - /* Rate scaling data */ - struct iwl_lq_mngr lq_mngr; -#endif - - /* Rate scaling data */ - s8 data_retry_limit; - u8 retry_rate; - - wait_queue_head_t wait_command_queue; - - int activity_timer_active; - - /* Rx and Tx DMA processing queues */ - struct iwl_rx_queue rxq; - struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; -#if IWL == 4965 - unsigned long txq_ctx_active_msk; - struct iwl_kw kw; /* keep warm address */ - u32 scd_base_addr; /* scheduler sram base address */ -#endif - - unsigned long status; - u32 config; - - int last_rx_rssi; /* From Rx packet statisitics */ - int last_rx_noise; /* From beacon statistics */ - - struct iwl_power_mgr power_data; - - struct iwl_notif_statistics statistics; - unsigned long last_statistics_time; - - /* context information */ - u8 essid[IW_ESSID_MAX_SIZE]; - u8 essid_len; - u16 rates_mask; - - u32 power_mode; - u32 antenna; - u8 bssid[ETH_ALEN]; - u16 rts_threshold; - u8 mac_addr[ETH_ALEN]; - - /*station table variables */ - spinlock_t sta_lock; - int num_stations; - struct iwl_station_entry stations[IWL_STATION_COUNT]; - - /* Indication if ieee80211_ops->open has been called */ - int is_open; - - u8 mac80211_registered; - int is_abg; - - u32 notif_missed_beacons; - - /* Rx'd packet timing information */ - u32 last_beacon_time; - u64 last_tsf; - - /* Duplicate packet detection */ - u16 last_seq_num; - u16 last_frag_num; - unsigned long last_packet_time; - struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE]; - - /* eeprom */ - struct iwl_eeprom eeprom; - - int iw_mode; - - struct sk_buff *ibss_beacon; - - /* Last Rx'd beacon timestamp */ - u32 timestamp0; - u32 timestamp1; - u16 beacon_int; - struct iwl_driver_hw_info hw_setting; - int interface_id; - - /* Current association information needed to configure the - * hardware */ - u16 assoc_id; - u16 assoc_capability; - u8 ps_mode; - -#ifdef CONFIG_IWLWIFI_QOS - struct iwl_qos_info qos_data; -#endif /*CONFIG_IWLWIFI_QOS */ - - struct workqueue_struct *workqueue; - - struct work_struct up; - struct work_struct restart; - struct work_struct calibrated_work; - struct work_struct scan_completed; - struct work_struct rx_replenish; - struct work_struct rf_kill; - struct work_struct abort_scan; - struct work_struct update_link_led; - struct work_struct auth_work; - struct work_struct report_work; - struct work_struct request_scan; - struct work_struct beacon_update; - - struct tasklet_struct irq_tasklet; - - struct delayed_work init_alive_start; - struct delayed_work alive_start; - struct delayed_work activity_timer; - struct delayed_work thermal_periodic; - struct delayed_work gather_stats; - struct delayed_work scan_check; - struct delayed_work post_associate; - -#define IWL_DEFAULT_TX_POWER 0x0F - s8 user_txpower_limit; - s8 max_channel_txpower_limit; - -#ifdef CONFIG_PM - u32 pm_state[16]; -#endif - -#ifdef CONFIG_IWLWIFI_DEBUG - /* debugging info */ - u32 framecnt_to_us; - atomic_t restrict_refcnt; -#endif - -#if IWL == 4965 - struct work_struct txpower_work; -#ifdef CONFIG_IWLWIFI_SENSITIVITY - struct work_struct sensitivity_work; -#endif - struct work_struct statistics_work; - struct timer_list statistics_periodic; - -#ifdef CONFIG_IWLWIFI_HT_AGG - struct work_struct agg_work; -#endif - -#endif /* 4965 */ -}; /*iwl_priv */ - -#endif /* __iwl_priv_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 3cccb3db6ff..b9b67e617ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -56,9 +56,6 @@ #include -#define IWL 3945 - -#include "iwlwifi.h" #include "iwl-3945.h" #include "iwl-helpers.h" diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 0e46ffde22a..1e7b589ac86 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -56,9 +56,6 @@ #include -#define IWL 4965 - -#include "iwlwifi.h" #include "iwl-4965.h" #include "iwl-helpers.h" diff --git a/drivers/net/wireless/iwlwifi/iwlwifi.h b/drivers/net/wireless/iwlwifi/iwlwifi.h deleted file mode 100644 index 96558cc60ae..00000000000 --- a/drivers/net/wireless/iwlwifi/iwlwifi.h +++ /dev/null @@ -1,695 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * James P. Ketrenos - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __iwlwifi_h__ -#define __iwlwifi_h__ - -#include /* for struct pci_device_id */ -#include -#include - -struct iwl_priv; - -/* Hardware specific file defines the PCI IDs table for that hardware module */ -extern struct pci_device_id iwl_hw_card_ids[]; - -#include "iwl-hw.h" -#if IWL == 3945 -#define DRV_NAME "iwl3945" -#include "iwl-3945-hw.h" -#elif IWL == 4965 -#define DRV_NAME "iwl4965" -#include "iwl-4965-hw.h" -#endif - -#include "iwl-prph.h" - -/* - * Driver implementation data structures, constants, inline - * functions - * - * NOTE: DO NOT PUT HARDWARE/UCODE SPECIFIC DECLARATIONS HERE - * - * Hardware specific declarations go into iwl-*hw.h - * - */ - -#include "iwl-debug.h" - -/* Default noise level to report when noise measurement is not available. - * This may be because we're: - * 1) Not associated (4965, no beacon statistics being sent to driver) - * 2) Scanning (noise measurement does not apply to associated channel) - * 3) Receiving CCK (3945 delivers noise info only for OFDM frames) - * Use default noise value of -127 ... this is below the range of measurable - * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user. - * Also, -127 works better than 0 when averaging frames with/without - * noise info (e.g. averaging might be done in app); measured dBm values are - * always negative ... using a negative value as the default keeps all - * averages within an s8's (used in some apps) range of negative values. */ -#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) - -/* Module parameters accessible from iwl-*.c */ -extern int iwl_param_hwcrypto; -extern int iwl_param_queues_num; - -enum iwl_antenna { - IWL_ANTENNA_DIVERSITY, - IWL_ANTENNA_MAIN, - IWL_ANTENNA_AUX -}; - -/* - * RTS threshold here is total size [2347] minus 4 FCS bytes - * Per spec: - * a value of 0 means RTS on all data/management packets - * a value > max MSDU size means no RTS - * else RTS for data/management frames where MPDU is larger - * than RTS value. - */ -#define DEFAULT_RTS_THRESHOLD 2347U -#define MIN_RTS_THRESHOLD 0U -#define MAX_RTS_THRESHOLD 2347U -#define MAX_MSDU_SIZE 2304U -#define MAX_MPDU_SIZE 2346U -#define DEFAULT_BEACON_INTERVAL 100U -#define DEFAULT_SHORT_RETRY_LIMIT 7U -#define DEFAULT_LONG_RETRY_LIMIT 4U - -struct iwl_rx_mem_buffer { - dma_addr_t dma_addr; - struct sk_buff *skb; - struct list_head list; -}; - -struct iwl_rt_rx_hdr { - struct ieee80211_radiotap_header rt_hdr; - __le64 rt_tsf; /* TSF */ - u8 rt_flags; /* radiotap packet flags */ - u8 rt_rate; /* rate in 500kb/s */ - __le16 rt_channelMHz; /* channel in MHz */ - __le16 rt_chbitmask; /* channel bitfield */ - s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ - s8 rt_dbmnoise; - u8 rt_antenna; /* antenna number */ - u8 payload[0]; /* payload... */ -} __attribute__ ((packed)); - -struct iwl_rt_tx_hdr { - struct ieee80211_radiotap_header rt_hdr; - u8 rt_rate; /* rate in 500kb/s */ - __le16 rt_channel; /* channel in mHz */ - __le16 rt_chbitmask; /* channel bitfield */ - s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ - u8 rt_antenna; /* antenna number */ - u8 payload[0]; /* payload... */ -} __attribute__ ((packed)); - -/* - * Generic queue structure - * - * Contains common data for Rx and Tx queues - */ -struct iwl_queue { - int n_bd; /* number of BDs in this queue */ - int write_ptr; /* 1-st empty entry (index) host_w*/ - int read_ptr; /* last used entry (index) host_r*/ - dma_addr_t dma_addr; /* physical addr for BD's */ - int n_window; /* safe queue window */ - u32 id; - int low_mark; /* low watermark, resume queue if free - * space more than this */ - int high_mark; /* high watermark, stop queue if free - * space less than this */ -} __attribute__ ((packed)); - -#define MAX_NUM_OF_TBS (20) - -struct iwl_tx_info { - struct ieee80211_tx_status status; - struct sk_buff *skb[MAX_NUM_OF_TBS]; -}; - -/** - * struct iwl_tx_queue - Tx Queue for DMA - * @need_update: need to update read/write index - * @shed_retry: queue is HT AGG enabled - * - * Queue consists of circular buffer of BD's and required locking structures. - */ -struct iwl_tx_queue { - struct iwl_queue q; - struct iwl_tfd_frame *bd; - struct iwl_cmd *cmd; - dma_addr_t dma_addr_cmd; - struct iwl_tx_info *txb; - int need_update; - int sched_retry; - int active; -}; - -#include "iwl-channel.h" - -#if IWL == 3945 -#include "iwl-3945-rs.h" -#else -#include "iwl-4965-rs.h" -#endif - -#define IWL_TX_FIFO_AC0 0 -#define IWL_TX_FIFO_AC1 1 -#define IWL_TX_FIFO_AC2 2 -#define IWL_TX_FIFO_AC3 3 -#define IWL_TX_FIFO_HCCA_1 5 -#define IWL_TX_FIFO_HCCA_2 6 -#define IWL_TX_FIFO_NONE 7 - -/* Minimum number of queues. MAX_NUM is defined in hw specific files */ -#define IWL_MIN_NUM_QUEUES 4 - -/* Power management (not Tx power) structures */ - -struct iwl_power_vec_entry { - struct iwl_powertable_cmd cmd; - u8 no_dtim; -}; -#define IWL_POWER_RANGE_0 (0) -#define IWL_POWER_RANGE_1 (1) - -#define IWL_POWER_MODE_CAM 0x00 /* Continuously Aware Mode, always on */ -#define IWL_POWER_INDEX_3 0x03 -#define IWL_POWER_INDEX_5 0x05 -#define IWL_POWER_AC 0x06 -#define IWL_POWER_BATTERY 0x07 -#define IWL_POWER_LIMIT 0x07 -#define IWL_POWER_MASK 0x0F -#define IWL_POWER_ENABLED 0x10 -#define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK) - -struct iwl_power_mgr { - spinlock_t lock; - struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC]; - struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC]; - u8 active_index; - u32 dtim_val; -}; - -#define IEEE80211_DATA_LEN 2304 -#define IEEE80211_4ADDR_LEN 30 -#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) -#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) - -struct iwl_frame { - union { - struct ieee80211_hdr frame; - struct iwl_tx_beacon_cmd beacon; - u8 raw[IEEE80211_FRAME_LEN]; - u8 cmd[360]; - } u; - struct list_head list; -}; - -#define SEQ_TO_QUEUE(x) ((x >> 8) & 0xbf) -#define QUEUE_TO_SEQ(x) ((x & 0xbf) << 8) -#define SEQ_TO_INDEX(x) (x & 0xff) -#define INDEX_TO_SEQ(x) (x & 0xff) -#define SEQ_HUGE_FRAME (0x4000) -#define SEQ_RX_FRAME __constant_cpu_to_le16(0x8000) -#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) -#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) -#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) - -enum { - /* CMD_SIZE_NORMAL = 0, */ - CMD_SIZE_HUGE = (1 << 0), - /* CMD_SYNC = 0, */ - CMD_ASYNC = (1 << 1), - /* CMD_NO_SKB = 0, */ - CMD_WANT_SKB = (1 << 2), -}; - -struct iwl_cmd; -struct iwl_priv; - -struct iwl_cmd_meta { - struct iwl_cmd_meta *source; - union { - struct sk_buff *skb; - int (*callback)(struct iwl_priv *priv, - struct iwl_cmd *cmd, struct sk_buff *skb); - } __attribute__ ((packed)) u; - - /* The CMD_SIZE_HUGE flag bit indicates that the command - * structure is stored at the end of the shared queue memory. */ - u32 flags; - -} __attribute__ ((packed)); - -struct iwl_cmd { - struct iwl_cmd_meta meta; - struct iwl_cmd_header hdr; - union { - struct iwl_addsta_cmd addsta; - struct iwl_led_cmd led; - u32 flags; - u8 val8; - u16 val16; - u32 val32; - struct iwl_bt_cmd bt; - struct iwl_rxon_time_cmd rxon_time; - struct iwl_powertable_cmd powertable; - struct iwl_qosparam_cmd qosparam; - struct iwl_tx_cmd tx; - struct iwl_tx_beacon_cmd tx_beacon; - struct iwl_rxon_assoc_cmd rxon_assoc; - u8 *indirect; - u8 payload[360]; - } __attribute__ ((packed)) cmd; -} __attribute__ ((packed)); - -struct iwl_host_cmd { - u8 id; - u16 len; - struct iwl_cmd_meta meta; - const void *data; -}; - -#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ - sizeof(struct iwl_cmd_meta)) - -/* - * RX related structures and functions - */ -#define RX_FREE_BUFFERS 64 -#define RX_LOW_WATERMARK 8 - -#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 -#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 -#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 - -/** - * struct iwl_rx_queue - Rx queue - * @processed: Internal index to last handled Rx packet - * @read: Shared index to newest available Rx buffer - * @write: Shared index to oldest written Rx packet - * @free_count: Number of pre-allocated buffers in rx_free - * @rx_free: list of free SKBs for use - * @rx_used: List of Rx buffers with no SKB - * @need_update: flag to indicate we need to update read/write index - * - * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers - */ -struct iwl_rx_queue { - __le32 *bd; - dma_addr_t dma_addr; - struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; - struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; - u32 processed; - u32 read; - u32 write; - u32 free_count; - struct list_head rx_free; - struct list_head rx_used; - int need_update; - spinlock_t lock; -}; - -#define IWL_SUPPORTED_RATES_IE_LEN 8 - -#define SCAN_INTERVAL 100 - -#define MAX_A_CHANNELS 252 -#define MIN_A_CHANNELS 7 - -#define MAX_B_CHANNELS 14 -#define MIN_B_CHANNELS 1 - -#define STATUS_HCMD_ACTIVE 0 /* host command in progress */ -#define STATUS_INT_ENABLED 1 -#define STATUS_RF_KILL_HW 2 -#define STATUS_RF_KILL_SW 3 -#define STATUS_INIT 4 -#define STATUS_ALIVE 5 -#define STATUS_READY 6 -#define STATUS_TEMPERATURE 7 -#define STATUS_GEO_CONFIGURED 8 -#define STATUS_EXIT_PENDING 9 -#define STATUS_IN_SUSPEND 10 -#define STATUS_STATISTICS 11 -#define STATUS_SCANNING 12 -#define STATUS_SCAN_ABORTING 13 -#define STATUS_SCAN_HW 14 -#define STATUS_POWER_PMI 15 -#define STATUS_FW_ERROR 16 - -#define MAX_TID_COUNT 9 - -#define IWL_INVALID_RATE 0xFF -#define IWL_INVALID_VALUE -1 - -#if IWL == 4965 -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG -struct iwl_ht_agg { - u16 txq_id; - u16 frame_count; - u16 wait_for_ba; - u16 start_idx; - u32 bitmap0; - u32 bitmap1; - u32 rate_n_flags; -}; -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ -#endif - -struct iwl_tid_data { - u16 seq_number; -#if IWL == 4965 -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG - struct iwl_ht_agg agg; -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ -#endif -}; - -struct iwl_hw_key { - enum ieee80211_key_alg alg; - int keylen; - u8 key[32]; -}; - -union iwl_ht_rate_supp { - u16 rates; - struct { - u8 siso_rate; - u8 mimo_rate; - }; -}; - -#ifdef CONFIG_IWLWIFI_HT -#define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) -#define HT_IE_MAX_AMSDU_SIZE_4K (0) -#define CFG_HT_MPDU_DENSITY_2USEC (0x5) -#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC - -struct sta_ht_info { - u8 is_ht; - u16 rx_mimo_ps_mode; - u16 tx_mimo_ps_mode; - u16 control_channel; - u8 max_amsdu_size; - u8 ampdu_factor; - u8 mpdu_density; - u8 operating_mode; - u8 supported_chan_width; - u8 extension_chan_offset; - u8 is_green_field; - u8 sgf; - u8 supp_rates[16]; - u8 tx_chan_width; - u8 chan_width_cap; -}; -#endif /*CONFIG_IWLWIFI_HT */ - -#ifdef CONFIG_IWLWIFI_QOS - -union iwl_qos_capabity { - struct { - u8 edca_count:4; /* bit 0-3 */ - u8 q_ack:1; /* bit 4 */ - u8 queue_request:1; /* bit 5 */ - u8 txop_request:1; /* bit 6 */ - u8 reserved:1; /* bit 7 */ - } q_AP; - struct { - u8 acvo_APSD:1; /* bit 0 */ - u8 acvi_APSD:1; /* bit 1 */ - u8 ac_bk_APSD:1; /* bit 2 */ - u8 ac_be_APSD:1; /* bit 3 */ - u8 q_ack:1; /* bit 4 */ - u8 max_len:2; /* bit 5-6 */ - u8 more_data_ack:1; /* bit 7 */ - } q_STA; - u8 val; -}; - -/* QoS structures */ -struct iwl_qos_info { - int qos_enable; - int qos_active; - union iwl_qos_capabity qos_cap; - struct iwl_qosparam_cmd def_qos_parm; -}; -#endif /*CONFIG_IWLWIFI_QOS */ - -#define STA_PS_STATUS_WAKE 0 -#define STA_PS_STATUS_SLEEP 1 - -struct iwl_station_entry { - struct iwl_addsta_cmd sta; - struct iwl_tid_data tid[MAX_TID_COUNT]; -#if IWL == 3945 - union { - struct { - u8 rate; - u8 flags; - } s; - u16 rate_n_flags; - } current_rate; -#endif - u8 used; - u8 ps_status; - struct iwl_hw_key keyinfo; -}; - -/* one for each uCode image (inst/data, boot/init/runtime) */ -struct fw_desc { - void *v_addr; /* access by driver */ - dma_addr_t p_addr; /* access by card's busmaster DMA */ - u32 len; /* bytes */ -}; - -/* uCode file layout */ -struct iwl_ucode { - __le32 ver; /* major/minor/subminor */ - __le32 inst_size; /* bytes of runtime instructions */ - __le32 data_size; /* bytes of runtime data */ - __le32 init_size; /* bytes of initialization instructions */ - __le32 init_data_size; /* bytes of initialization data */ - __le32 boot_size; /* bytes of bootstrap instructions */ - u8 data[0]; /* data in same order as "size" elements */ -}; - -#define IWL_IBSS_MAC_HASH_SIZE 32 - -struct iwl_ibss_seq { - u8 mac[ETH_ALEN]; - u16 seq_num; - u16 frag_num; - unsigned long packet_time; - struct list_head list; -}; - -struct iwl_driver_hw_info { - u16 max_txq_num; - u16 ac_queue_count; - u16 tx_cmd_len; - u16 max_rxq_size; - u32 rx_buffer_size; - u16 max_rxq_log; - u8 max_stations; - u8 bcast_sta_id; - void *shared_virt; - dma_addr_t shared_phys; -}; - - -#define STA_FLG_RTS_MIMO_PROT_MSK __constant_cpu_to_le32(1 << 17) -#define STA_FLG_AGG_MPDU_8US_MSK __constant_cpu_to_le32(1 << 18) -#define STA_FLG_MAX_AGG_SIZE_POS (19) -#define STA_FLG_MAX_AGG_SIZE_MSK __constant_cpu_to_le32(3 << 19) -#define STA_FLG_FAT_EN_MSK __constant_cpu_to_le32(1 << 21) -#define STA_FLG_MIMO_DIS_MSK __constant_cpu_to_le32(1 << 22) -#define STA_FLG_AGG_MPDU_DENSITY_POS (23) -#define STA_FLG_AGG_MPDU_DENSITY_MSK __constant_cpu_to_le32(7 << 23) -#define HT_SHORT_GI_20MHZ_ONLY (1 << 0) -#define HT_SHORT_GI_40MHZ_ONLY (1 << 1) - - -#include "iwl-priv.h" - -/* Requires full declaration of iwl_priv before including */ -#include "iwl-io.h" - -#define IWL_RX_HDR(x) ((struct iwl_rx_frame_hdr *)(\ - x->u.rx_frame.stats.payload + \ - x->u.rx_frame.stats.phy_count)) -#define IWL_RX_END(x) ((struct iwl_rx_frame_end *)(\ - IWL_RX_HDR(x)->payload + \ - le16_to_cpu(IWL_RX_HDR(x)->len))) -#define IWL_RX_STATS(x) (&x->u.rx_frame.stats) -#define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload) - - -/****************************************************************************** - * - * Functions implemented in iwl-base.c which are forward declared here - * for use by iwl-*.c - * - *****************************************************************************/ -struct iwl_addsta_cmd; -extern int iwl_send_add_station(struct iwl_priv *priv, - struct iwl_addsta_cmd *sta, u8 flags); -extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid, - int is_ap, u8 flags); -extern int iwl_is_network_packet(struct iwl_priv *priv, - struct ieee80211_hdr *header); -extern int iwl_power_init_handle(struct iwl_priv *priv); -extern int iwl_eeprom_init(struct iwl_priv *priv); -#ifdef CONFIG_IWLWIFI_DEBUG -extern void iwl_report_frame(struct iwl_priv *priv, - struct iwl_rx_packet *pkt, - struct ieee80211_hdr *header, int group100); -#else -static inline void iwl_report_frame(struct iwl_priv *priv, - struct iwl_rx_packet *pkt, - struct ieee80211_hdr *header, - int group100) {} -#endif -extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb, - void *data, short len, - struct ieee80211_rx_status *stats, - u16 phy_flags); -extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr - *header); -extern int iwl_rx_queue_alloc(struct iwl_priv *priv); -extern void iwl_rx_queue_reset(struct iwl_priv *priv, - struct iwl_rx_queue *rxq); -extern int iwl_calc_db_from_ratio(int sig_ratio); -extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm); -extern int iwl_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq, int count, u32 id); -extern void iwl_rx_replenish(void *data); -extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); -extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, - const void *data); -extern int __must_check iwl_send_cmd(struct iwl_priv *priv, - struct iwl_host_cmd *cmd); -extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, - struct ieee80211_hdr *hdr, - const u8 *dest, int left); -extern int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_rx_queue *q); -extern int iwl_send_statistics_request(struct iwl_priv *priv); -extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, - u32 decrypt_res, - struct ieee80211_rx_status *stats); -#if IWL == 4965 -extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr); -#endif - -extern const u8 BROADCAST_ADDR[ETH_ALEN]; - -/* - * Currently used by iwl-3945-rs... look at restructuring so that it doesn't - * call this... todo... fix that. -*/ -extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id, - u16 tx_rate, u8 flags); - -static inline int iwl_is_associated(struct iwl_priv *priv) -{ - return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; -} - -/****************************************************************************** - * - * Functions implemented in iwl-[34]*.c which are forward declared here - * for use by iwl-base.c - * - * NOTE: The implementation of these functions are hardware specific - * which is why they are in the hardware specific files (vs. iwl-base.c) - * - * Naming convention -- - * iwl_ <-- Its part of iwlwifi (should be changed to iwl_) - * iwl_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) - * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) - * iwl_bg_ <-- Called from work queue context - * iwl_mac_ <-- mac80211 callback - * - ****************************************************************************/ -extern void iwl_hw_rx_handler_setup(struct iwl_priv *priv); -extern void iwl_hw_setup_deferred_work(struct iwl_priv *priv); -extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv); -extern int iwl_hw_rxq_stop(struct iwl_priv *priv); -extern int iwl_hw_set_hw_setting(struct iwl_priv *priv); -extern int iwl_hw_nic_init(struct iwl_priv *priv); -extern int iwl_hw_nic_stop_master(struct iwl_priv *priv); -extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv); -extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv); -extern int iwl_hw_nic_reset(struct iwl_priv *priv); -extern int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd, - dma_addr_t addr, u16 len); -extern int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); -extern int iwl_hw_get_temperature(struct iwl_priv *priv); -extern int iwl_hw_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq); -extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, - struct iwl_frame *frame, u8 rate); -extern int iwl_hw_get_rx_read(struct iwl_priv *priv); -extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, - struct iwl_cmd *cmd, - struct ieee80211_tx_control *ctrl, - struct ieee80211_hdr *hdr, - int sta_id, int tx_id); -extern int iwl_hw_reg_send_txpower(struct iwl_priv *priv); -extern int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); -extern void iwl_hw_rx_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -extern void iwl_disable_events(struct iwl_priv *priv); -extern int iwl4965_get_temperature(const struct iwl_priv *priv); - -/** - * iwl_hw_find_station - Find station id for a given BSSID - * @bssid: MAC address of station ID to find - * - * NOTE: This should not be hardware specific but the code has - * not yet been merged into a single common layer for managing the - * station tables. - */ -extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid); - -extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel); -#if IWL == 4965 -extern int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index); -#endif -#endif -- cgit v1.2.3-70-g09d2 From c8b0e6e19c0bcd30689cb6c6f64eb140f5d61894 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 25 Oct 2007 17:15:51 +0800 Subject: iwlwifi: cleanup Kconfig and ifdefs to split 3945 and 4965 Currently the iwl3945 & iwl4965 drivers share some common Kconfig symbols. This split it up into options for the individual drivers and gets rid of all the CONFIG_IWLWIFI cruft. Signed-off-by: Christoph Hellwig Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/Makefile | 3 +- drivers/net/wireless/iwlwifi/Kconfig | 169 +++++++++++++++----------- drivers/net/wireless/iwlwifi/iwl-3945-debug.h | 6 +- drivers/net/wireless/iwlwifi/iwl-3945-io.h | 34 +++--- drivers/net/wireless/iwlwifi/iwl-3945.c | 2 +- drivers/net/wireless/iwlwifi/iwl-3945.h | 20 +-- drivers/net/wireless/iwlwifi/iwl-4965-debug.h | 6 +- drivers/net/wireless/iwlwifi/iwl-4965-io.h | 34 +++--- drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 38 +++--- drivers/net/wireless/iwlwifi/iwl-4965.c | 92 +++++++------- drivers/net/wireless/iwlwifi/iwl-4965.h | 60 ++++----- drivers/net/wireless/iwlwifi/iwl3945-base.c | 72 +++++------ drivers/net/wireless/iwlwifi/iwl4965-base.c | 168 ++++++++++++------------- 13 files changed, 368 insertions(+), 336 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile index 6f32b53ee12..d48f7d19745 100644 --- a/drivers/net/wireless/Makefile +++ b/drivers/net/wireless/Makefile @@ -52,7 +52,8 @@ obj-$(CONFIG_RTL8187) += rtl8187.o obj-$(CONFIG_ADM8211) += adm8211.o -obj-$(CONFIG_IWLWIFI) += iwlwifi/ +obj-$(CONFIG_IWL3945) += iwlwifi/ +obj-$(CONFIG_IWL4965) += iwlwifi/ obj-$(CONFIG_RT2X00) += rt2x00/ obj-$(CONFIG_P54_COMMON) += p54common.o diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index 8d52a26c248..74243fe9dca 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig @@ -1,107 +1,95 @@ -config IWLWIFI - bool "Intel Wireless WiFi Link Drivers" - depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL +config IWL4965 + tristate "Intel Wireless WiFi 4965AGN" + depends on m && PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL select FW_LOADER - default n - ---help--- - Select to enable drivers based on the iwlwifi project. This - project provides a common foundation for Intel's wireless - drivers designed to use the mac80211 subsystem. - - See for - information on the capabilities currently enabled in this - driver and for tips for debugging issues and problems. - -config IWLWIFI_DEBUG - bool "Enable full debugging output in iwlwifi drivers" - depends on IWLWIFI - default y + default m ---help--- - This option will enable debug tracing output for the iwlwifi - drivers. + Select to build the driver supporting the: - This will result in the kernel module being ~100k larger. You can - control which debug output is sent to the kernel log by setting the - value in + Intel Wireless WiFi Link 4965AGN - /sys/bus/pci/drivers/${DRIVER}/debug_level + This driver uses the kernel's mac80211 subsystem. - This entry will only exist if this option is enabled. + See for + information on the capabilities currently enabled in this + driver and for tips for debugging any issues or problems. - To set a value, simply echo an 8-byte hex value to the same file: + In order to use this driver, you will need a microcode (uCode) + image for it. You can obtain the microcode from: - % echo 0x43fff > /sys/bus/pci/drivers/${DRIVER}/debug_level + . - You can find the list of debug mask values in: - drivers/net/wireless/mac80211/iwlwifi/iwl-debug.h + See the above referenced README.iwlwifi for information on where + to install the microcode images. - If this is your first time using this driver, you should say Y here - as the debug information can assist others in helping you resolve - any problems you may encounter. + If you want to compile the driver as a module ( = code which can be + inserted in and remvoed from the running kernel whenever you want), + say M here and read . The + module will be called iwl4965.ko. -config IWLWIFI_SENSITIVITY - bool "Enable Sensitivity Calibration in iwlwifi drivers" - depends on IWLWIFI +config IWL4965_QOS + bool "Enable Wireless QoS in iwl4965 driver" + depends on IWL4965 default y ---help--- - This option will enable sensitivity calibration for the iwlwifi - drivers. + This option will enable wireless quality of service (QoS) for the + iw4965 driver. -config IWLWIFI_SPECTRUM_MEASUREMENT - bool "Enable Spectrum Measurement in iwlwifi drivers" - depends on IWLWIFI +config IWL4965_SPECTRUM_MEASUREMENT + bool "Enable Spectrum Measurement in iw4965 driver" + depends on IWL4965 default y ---help--- - This option will enable spectrum measurement for the iwlwifi drivers. + This option will enable spectrum measurement for the iwl4965 driver. -config IWLWIFI_QOS - bool "Enable Wireless QoS in iwlwifi drivers" - depends on IWLWIFI +config IWL4965_SENSITIVITY + bool "Enable Sensitivity Calibration in iwl4965 driver" + depends on IWL4965 default y ---help--- - This option will enable wireless quality of service (QoS) for the - iwlwifi drivers. + This option will enable sensitivity calibration for the iwl4965 + driver. -config IWLWIFI_HT - bool "Enable 802.11n HT features in iwlwifi drivers" +config IWL4965_HT + bool "Enable 802.11n HT features in iwl4965 driver" depends on EXPERIMENTAL - depends on IWLWIFI && MAC80211_HT + depends on IWL4965 && MAC80211_HT default n ---help--- This option enables IEEE 802.11n High Throughput features - for the iwlwifi drivers. + for the iwl4965 driver. -config IWL4965 - tristate "Intel Wireless WiFi 4965AGN" - depends on m && IWLWIFI && EXPERIMENTAL - default m +config IWL4965_DEBUG + bool "Enable full debugging output in iwl4965 driver" + depends on IWL4965 + default y ---help--- - Select to build the driver supporting the: + This option will enable debug tracing output for the iwl4965 + driver. - Intel Wireless WiFi Link 4965AGN + This will result in the kernel module being ~100k larger. You can + control which debug output is sent to the kernel log by setting the + value in - This driver uses the kernel's mac80211 subsystem. + /sys/bus/pci/drivers/${DRIVER}/debug_level - See for - information on the capabilities currently enabled in this - driver and for tips for debugging any issues or problems. + This entry will only exist if this option is enabled. - In order to use this driver, you will need a microcode (uCode) - image for it. You can obtain the microcode from: + To set a value, simply echo an 8-byte hex value to the same file: - . + % echo 0x43fff > /sys/bus/pci/drivers/${DRIVER}/debug_level - See the above referenced README.iwlwifi for information on where - to install the microcode images. + You can find the list of debug mask values in: + drivers/net/wireless/iwlwifi/iwl-4965-debug.h - If you want to compile the driver as a module ( = code which can be - inserted in and remvoed from the running kernel whenever you want), - say M here and read . The - module will be called iwl4965.ko. + If this is your first time using this driver, you should say Y here + as the debug information can assist others in helping you resolve + any problems you may encounter. config IWL3945 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" - depends on m && IWLWIFI && EXPERIMENTAL + depends on m && PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL + select FW_LOADER default m ---help--- Select to build the driver supporting the: @@ -126,3 +114,46 @@ config IWL3945 inserted in and remvoed from the running kernel whenever you want), say M here and read . The module will be called iwl3945.ko. + +config IWL3945_QOS + bool "Enable Wireless QoS in iwl3945 driver" + depends on IWL3945 + default y + ---help--- + This option will enable wireless quality of service (QoS) for the + iwl3945 driver. + +config IWL3945_SPECTRUM_MEASUREMENT + bool "Enable Spectrum Measurement in iwl3945 drivers" + depends on IWL3945 + default y + ---help--- + This option will enable spectrum measurement for the iwl3945 driver. + +config IWL3945_DEBUG + bool "Enable full debugging output in iwl3945 driver" + depends on IWL3945 + default y + ---help--- + This option will enable debug tracing output for the iwl3945 + driver. + + This will result in the kernel module being ~100k larger. You can + control which debug output is sent to the kernel log by setting the + value in + + /sys/bus/pci/drivers/${DRIVER}/debug_level + + This entry will only exist if this option is enabled. + + To set a value, simply echo an 8-byte hex value to the same file: + + % echo 0x43fff > /sys/bus/pci/drivers/${DRIVER}/debug_level + + You can find the list of debug mask values in: + drivers/net/wireless/iwlwifi/iwl-3945-debug.h + + If this is your first time using this driver, you should say Y here + as the debug information can assist others in helping you resolve + any problems you may encounter. + diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h index 72318d78957..d0ea83404e0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h @@ -29,7 +29,7 @@ #ifndef __iwl_debug_h__ #define __iwl_debug_h__ -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG extern u32 iwl_debug_level; #define IWL_DEBUG(level, fmt, args...) \ do { if (iwl_debug_level & (level)) \ @@ -47,7 +47,7 @@ static inline void IWL_DEBUG(int level, const char *fmt, ...) static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) { } -#endif /* CONFIG_IWLWIFI_DEBUG */ +#endif /* CONFIG_IWL3945_DEBUG */ /* * To use the debug system; @@ -71,7 +71,7 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) * you simply need to add your entry to the iwl_debug_levels array. * * If you do not see debug_level in /proc/net/iwl then you do not have - * CONFIG_IWLWIFI_DEBUG defined in your kernel configuration + * CONFIG_IWL3945_DEBUG defined in your kernel configuration * */ diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-io.h b/drivers/net/wireless/iwlwifi/iwl-3945-io.h index 89253e13353..74a51798c23 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-io.h @@ -60,7 +60,7 @@ */ #define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, u32 ofs, u32 val) { @@ -74,7 +74,7 @@ static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, #endif #define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs) { IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); @@ -99,7 +99,7 @@ static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, return -ETIMEDOUT; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline int __iwl_poll_bit(const char *f, u32 l, struct iwl_priv *priv, u32 addr, u32 bits, u32 mask, int timeout) @@ -125,7 +125,7 @@ static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) { _iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline void __iwl_set_bit(const char *f, u32 l, struct iwl_priv *priv, u32 reg, u32 mask) { @@ -142,7 +142,7 @@ static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) { _iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline void __iwl_clear_bit(const char *f, u32 l, struct iwl_priv *priv, u32 reg, u32 mask) { @@ -160,7 +160,7 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) int ret; u32 gp_ctl; -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG if (atomic_read(&priv->restrict_refcnt)) return 0; #endif @@ -191,13 +191,13 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) return -EIO; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG atomic_inc(&priv->restrict_refcnt); #endif return 0; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline int __iwl_grab_nic_access(const char *f, u32 l, struct iwl_priv *priv) { @@ -217,13 +217,13 @@ static inline int __iwl_grab_nic_access(const char *f, u32 l, static inline void _iwl_release_nic_access(struct iwl_priv *priv) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG if (atomic_dec_and_test(&priv->restrict_refcnt)) #endif _iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline void __iwl_release_nic_access(const char *f, u32 l, struct iwl_priv *priv) { @@ -244,7 +244,7 @@ static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) { return _iwl_read32(priv, reg); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline u32 __iwl_read_direct32(const char *f, u32 l, struct iwl_priv *priv, u32 reg) { @@ -266,7 +266,7 @@ static inline void _iwl_write_direct32(struct iwl_priv *priv, { _iwl_write32(priv, reg, value); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static void __iwl_write_direct32(u32 line, struct iwl_priv *priv, u32 reg, u32 value) { @@ -306,7 +306,7 @@ static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, return -ETIMEDOUT; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline int __iwl_poll_direct_bit(const char *f, u32 l, struct iwl_priv *priv, u32 addr, u32 mask, int timeout) @@ -332,7 +332,7 @@ static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) { if (!atomic_read(&priv->restrict_refcnt)) @@ -353,7 +353,7 @@ static inline void _iwl_write_prph(struct iwl_priv *priv, ((addr & 0x0000FFFF) | (3 << 24))); _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, u32 addr, u32 val) { @@ -370,7 +370,7 @@ static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, #define _iwl_set_bits_prph(priv, reg, mask) \ _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, u32 reg, u32 mask) { @@ -388,7 +388,7 @@ static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, #define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static inline void __iwl_set_bits_mask_prph(u32 line, struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) { diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 53fe9c1c174..39e7b07248c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -371,7 +371,7 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, network_packet = iwl_is_network_packet(priv, header); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG if (iwl_debug_level & IWL_DL_STATS && net_ratelimit()) IWL_DEBUG_STATS ("[%c] %d RSSI: %d Signal: %u, Noise: %u, Rate: %u\n", diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index ab8412270f6..d1616bf9bc8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -445,7 +445,7 @@ union iwl_ht_rate_supp { }; }; -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL3945_HT #define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) #define HT_IE_MAX_AMSDU_SIZE_4K (0) #define CFG_HT_MPDU_DENSITY_2USEC (0x5) @@ -468,9 +468,9 @@ struct sta_ht_info { u8 tx_chan_width; u8 chan_width_cap; }; -#endif /*CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL3945_HT */ -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL3945_QOS union iwl_qos_capabity { struct { @@ -499,7 +499,7 @@ struct iwl_qos_info { union iwl_qos_capabity qos_cap; struct iwl_qosparam_cmd def_qos_parm; }; -#endif /*CONFIG_IWLWIFI_QOS */ +#endif /*CONFIG_IWL3945_QOS */ #define STA_PS_STATUS_WAKE 0 #define STA_PS_STATUS_SLEEP 1 @@ -598,7 +598,7 @@ extern int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header); extern int iwl_power_init_handle(struct iwl_priv *priv); extern int iwl_eeprom_init(struct iwl_priv *priv); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG extern void iwl_report_frame(struct iwl_priv *priv, struct iwl_rx_packet *pkt, struct ieee80211_hdr *header, int group100); @@ -717,7 +717,7 @@ extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags); -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT enum { MEASUREMENT_READY = (1 << 0), @@ -745,7 +745,7 @@ struct iwl_priv { const struct ieee80211_hw_mode *modes; -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT /* spectrum measurement report caching */ struct iwl_spectrum_notification measure_report; u8 measurement_status; @@ -904,9 +904,9 @@ struct iwl_priv { u16 assoc_capability; u8 ps_mode; -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL3945_QOS struct iwl_qos_info qos_data; -#endif /*CONFIG_IWLWIFI_QOS */ +#endif /*CONFIG_IWL3945_QOS */ struct workqueue_struct *workqueue; @@ -941,7 +941,7 @@ struct iwl_priv { u32 pm_state[16]; #endif -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG /* debugging info */ u32 framecnt_to_us; atomic_t restrict_refcnt; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-debug.h b/drivers/net/wireless/iwlwifi/iwl-4965-debug.h index 72318d78957..0c74883d2f8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-debug.h @@ -29,7 +29,7 @@ #ifndef __iwl_debug_h__ #define __iwl_debug_h__ -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG extern u32 iwl_debug_level; #define IWL_DEBUG(level, fmt, args...) \ do { if (iwl_debug_level & (level)) \ @@ -47,7 +47,7 @@ static inline void IWL_DEBUG(int level, const char *fmt, ...) static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) { } -#endif /* CONFIG_IWLWIFI_DEBUG */ +#endif /* CONFIG_IWL4965_DEBUG */ /* * To use the debug system; @@ -71,7 +71,7 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) * you simply need to add your entry to the iwl_debug_levels array. * * If you do not see debug_level in /proc/net/iwl then you do not have - * CONFIG_IWLWIFI_DEBUG defined in your kernel configuration + * CONFIG_IWL4965_DEBUG defined in your kernel configuration * */ diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-io.h b/drivers/net/wireless/iwlwifi/iwl-4965-io.h index 1ffa8f1e17c..5c497e4beea 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-io.h @@ -60,7 +60,7 @@ */ #define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, u32 ofs, u32 val) { @@ -74,7 +74,7 @@ static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, #endif #define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs) { IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); @@ -99,7 +99,7 @@ static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, return -ETIMEDOUT; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline int __iwl_poll_bit(const char *f, u32 l, struct iwl_priv *priv, u32 addr, u32 bits, u32 mask, int timeout) @@ -125,7 +125,7 @@ static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) { _iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline void __iwl_set_bit(const char *f, u32 l, struct iwl_priv *priv, u32 reg, u32 mask) { @@ -142,7 +142,7 @@ static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) { _iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline void __iwl_clear_bit(const char *f, u32 l, struct iwl_priv *priv, u32 reg, u32 mask) { @@ -160,7 +160,7 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) int ret; u32 gp_ctl; -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG if (atomic_read(&priv->restrict_refcnt)) return 0; #endif @@ -191,13 +191,13 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) return -EIO; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG atomic_inc(&priv->restrict_refcnt); #endif return 0; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline int __iwl_grab_nic_access(const char *f, u32 l, struct iwl_priv *priv) { @@ -217,13 +217,13 @@ static inline int __iwl_grab_nic_access(const char *f, u32 l, static inline void _iwl_release_nic_access(struct iwl_priv *priv) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG if (atomic_dec_and_test(&priv->restrict_refcnt)) #endif _iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline void __iwl_release_nic_access(const char *f, u32 l, struct iwl_priv *priv) { @@ -244,7 +244,7 @@ static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) { return _iwl_read32(priv, reg); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline u32 __iwl_read_direct32(const char *f, u32 l, struct iwl_priv *priv, u32 reg) { @@ -266,7 +266,7 @@ static inline void _iwl_write_direct32(struct iwl_priv *priv, { _iwl_write32(priv, reg, value); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static void __iwl_write_direct32(u32 line, struct iwl_priv *priv, u32 reg, u32 value) { @@ -306,7 +306,7 @@ static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, return -ETIMEDOUT; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline int __iwl_poll_direct_bit(const char *f, u32 l, struct iwl_priv *priv, u32 addr, u32 mask, int timeout) @@ -332,7 +332,7 @@ static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) { if (!atomic_read(&priv->restrict_refcnt)) @@ -353,7 +353,7 @@ static inline void _iwl_write_prph(struct iwl_priv *priv, ((addr & 0x0000FFFF) | (3 << 24))); _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, u32 addr, u32 val) { @@ -370,7 +370,7 @@ static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, #define _iwl_set_bits_prph(priv, reg, mask) \ _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, u32 reg, u32 mask) { @@ -388,7 +388,7 @@ static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, #define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static inline void __iwl_set_bits_mask_prph(u32 line, struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) { diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 0e384e60648..8f6e9f8395c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c @@ -197,7 +197,7 @@ static inline u8 iwl_rate_get_rate(u32 rate_n_flags) static int rs_send_lq_cmd(struct iwl_priv *priv, struct iwl_link_quality_cmd *lq, u8 flags) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG int i; #endif struct iwl_host_cmd cmd = { @@ -218,7 +218,7 @@ static int rs_send_lq_cmd(struct iwl_priv *priv, IWL_DEBUG_RATE("lq dta 0x%X 0x%X\n", lq->general_params.single_stream_ant_msk, lq->general_params.dual_stream_ant_msk); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) IWL_DEBUG_RATE("lq index %d 0x%X\n", i, lq->rs_table[i].rate_n_flags); @@ -442,13 +442,13 @@ static inline void rs_toggle_antenna(struct iwl_rate *new_rate, static inline u8 rs_use_green(struct iwl_priv *priv) { -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht) return 0; return ((priv->current_assoc_ht.is_green_field) && !(priv->current_assoc_ht.operating_mode & 0x4)); -#endif /*CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT */ return 0; } @@ -826,7 +826,7 @@ static void rs_get_expected_tpt_table(struct iwl_rate_scale_priv *lq_data, tbl->expected_tpt = expected_tpt_G; } -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT static s32 rs_get_best_rate(struct iwl_priv *priv, struct iwl_rate_scale_priv *lq_data, struct iwl_scale_tbl_info *tbl, @@ -879,7 +879,7 @@ static s32 rs_get_best_rate(struct iwl_priv *priv, return new_rate; } -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT */ static inline u8 rs_is_both_ant_supp(u8 valid_antenna) { @@ -890,7 +890,7 @@ static int rs_switch_to_mimo(struct iwl_priv *priv, struct iwl_rate_scale_priv *lq_data, struct iwl_scale_tbl_info *tbl, int index) { -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT u16 rate_mask; s32 rate; s8 is_green = lq_data->is_green; @@ -938,7 +938,7 @@ static int rs_switch_to_mimo(struct iwl_priv *priv, IWL_DEBUG_HT("LQ: Switch to new mcs %X index is green %X\n", tbl->current_rate.rate_n_flags, is_green); -#endif /*CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT */ return 0; } @@ -946,7 +946,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv, struct iwl_rate_scale_priv *lq_data, struct iwl_scale_tbl_info *tbl, int index) { -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT u16 rate_mask; u8 is_green = lq_data->is_green; s32 rate; @@ -992,7 +992,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv, IWL_DEBUG_HT("LQ: Switch to new mcs %X index is green %X\n", tbl->current_rate.rate_n_flags, is_green); -#endif /*CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT */ return 0; } @@ -1568,7 +1568,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, tbl1 = &(lq_data->lq_info[lq_data->active_tbl]); if (is_legacy(tbl1->lq_type) && -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT !priv->current_assoc_ht.is_ht && #endif (lq_data->action_counter >= 1)) { @@ -1579,14 +1579,14 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, if (lq_data->enable_counter && (lq_data->action_counter >= IWL_ACTION_LIMIT)) { -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT_AGG if ((lq_data->last_tpt > TID_AGG_TPT_THREHOLD) && (priv->lq_mngr.agg_ctrl.auto_agg)) { priv->lq_mngr.agg_ctrl.tid_retry = TID_ALL_SPECIFIED; schedule_work(&priv->agg_work); } -#endif /*CONFIG_IWLWIFI_HT_AGG */ +#endif /*CONFIG_IWL4965_HT_AGG */ lq_data->action_counter = 0; rs_set_stay_in_table(0, lq_data); } @@ -1806,7 +1806,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, crl->active_rate &= ~(0x1000); crl->active_rate_basic = priv->active_rate_basic; crl->phymode = priv->phymode; -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT crl->active_siso_rate = (priv->current_assoc_ht.supp_rates[0] << 1); crl->active_siso_rate |= (priv->current_assoc_ht.supp_rates[0] & 0x1); crl->active_siso_rate &= ~((u16)0x2); @@ -1818,7 +1818,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, crl->active_mimo_rate = crl->active_mimo_rate << IWL_FIRST_OFDM_RATE; IWL_DEBUG_HT("MIMO RATE 0x%X SISO MASK 0x%X\n", crl->active_siso_rate, crl->active_mimo_rate); -#endif /*CONFIG_IWLWIFI_HT*/ +#endif /*CONFIG_IWL4965_HT*/ #ifdef CONFIG_MAC80211_DEBUGFS crl->drv = priv; #endif @@ -1937,12 +1937,12 @@ static void rs_clear(void *priv_rate) IWL_DEBUG_RATE("enter\n"); priv->lq_mngr.lq_ready = 0; -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG if (priv->lq_mngr.agg_ctrl.granted_ba) iwl4965_turn_off_agg(priv, TID_ALL_SPECIFIED); -#endif /*CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ IWL_DEBUG_RATE("leave\n"); } diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index f8f77fe4128..fed2357b7ef 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -86,14 +86,14 @@ static int is_fat_channel(__le32 rxon_flags) static u8 is_single_stream(struct iwl_priv *priv) { -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht || (priv->active_rate_ht[1] == 0) || (priv->ps_mode == IWL_MIMO_PS_STATIC)) return 1; #else return 1; -#endif /*CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT */ return 0; } @@ -743,7 +743,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) IWL_DEBUG_INFO("REPLY_CT_KILL_CONFIG_CMD succeeded\n"); } -#ifdef CONFIG_IWLWIFI_SENSITIVITY +#ifdef CONFIG_IWL4965_SENSITIVITY /* "false alarms" are signals that our DSP tries to lock onto, * but then determines that they are either noise, or transmissions @@ -1546,7 +1546,7 @@ static void iwl4965_bg_sensitivity_work(struct work_struct *work) mutex_unlock(&priv->mutex); return; } -#endif /*CONFIG_IWLWIFI_SENSITIVITY*/ +#endif /*CONFIG_IWL4965_SENSITIVITY*/ static void iwl4965_bg_txpower_work(struct work_struct *work) { @@ -1638,7 +1638,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); -#ifdef CONFIG_IWLWIFI_SENSITIVITY +#ifdef CONFIG_IWL4965_SENSITIVITY memset(&(priv->sensitivity_data), 0, sizeof(struct iwl_sensitivity_data)); memset(&(priv->chain_noise_data), 0, @@ -1646,7 +1646,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv) for (i = 0; i < NUM_RX_CHAINS; i++) priv->chain_noise_data.delta_gain_code[i] = CHAIN_NOISE_DELTA_GAIN_INIT_VAL; -#endif /* CONFIG_IWLWIFI_SENSITIVITY*/ +#endif /* CONFIG_IWL4965_SENSITIVITY*/ rc = iwl_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); @@ -2814,8 +2814,8 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv) IWL_DEBUG_ASSOC("rx chain %X\n", priv->staging_rxon.rx_chain); } -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG /* get the traffic load value for tid */ @@ -3149,8 +3149,8 @@ static void iwl4965_bg_agg_work(struct work_struct *work) spin_unlock_irqrestore(&priv->lq_mngr.lock, flags); return; } -#endif /*CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, u8 sta_id, dma_addr_t txcmd_phys, @@ -3165,11 +3165,11 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, u16 fc; u16 rate_flags; int rate_index = min(ctrl->tx_rate & 0xffff, IWL_RATE_COUNT - 1); -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG __le16 *qc; -#endif /*CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ unicast = !is_multicast_ether_addr(hdr->addr1); @@ -3230,8 +3230,8 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, if (ieee80211_is_back_request(fc)) tx->tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK; -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG qc = ieee80211_get_qos_ctrl(hdr); if (qc && (priv->iw_mode != IEEE80211_IF_TYPE_IBSS)) { @@ -3443,7 +3443,7 @@ void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { iwl4965_rx_calc_noise(priv); -#ifdef CONFIG_IWLWIFI_SENSITIVITY +#ifdef CONFIG_IWL4965_SENSITIVITY queue_work(priv->workqueue, &priv->sensitivity_work); #endif } @@ -3596,7 +3596,7 @@ static int iwl4965_calc_rssi(struct iwl4965_rx_phy_res *rx_resp) return (max_rssi - agc - IWL_RSSI_OFFSET); } -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT /* Parsed Information Elements */ struct ieee802_11_elems { @@ -3668,7 +3668,7 @@ static int parse_elems(u8 *start, size_t len, struct ieee802_11_elems *elems) return 0; } -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT */ static void iwl4965_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) { @@ -3728,9 +3728,9 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, .antenna = 0, .rate = iwl_hw_get_rate(rx_start->rate_n_flags), .flag = 0, -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT_AGG .ordered = 0 -#endif /* CONFIG_IWLWIFI_HT_AGG */ +#endif /* CONFIG_IWL4965_HT_AGG */ }; u8 network_packet; @@ -3802,7 +3802,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, if (!iwl_is_associated(priv)) priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG /* TODO: Parts of iwl_report_frame are broken for 4965 */ if (iwl_debug_level & (IWL_DL_RX)) /* Set "1" to report good data frames in groups of 100 */ @@ -3866,10 +3866,10 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, case IEEE80211_STYPE_ASSOC_RESP: case IEEE80211_STYPE_REASSOC_RESP: if (network_packet) { -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT u8 *pos = NULL; struct ieee802_11_elems elems; -#endif /*CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT */ struct ieee80211_mgmt *mgnt = (struct ieee80211_mgmt *)header; @@ -3878,7 +3878,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, priv->assoc_capability = le16_to_cpu( mgnt->u.assoc_resp.capab_info); -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT pos = mgnt->u.assoc_resp.variable; if (!parse_elems(pos, len - (pos - (u8 *) mgnt), @@ -3887,7 +3887,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, elems.ht_cap_param) break; } -#endif /*CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT */ /* assoc_id is 0 no association */ if (!priv->assoc_id) break; @@ -3919,7 +3919,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, break; case IEEE80211_FTYPE_CTL: -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT_AGG switch (fc & IEEE80211_FCTL_STYPE) { case IEEE80211_STYPE_BACK_REQ: IWL_DEBUG_HT("IEEE80211_STYPE_BACK_REQ arrived\n"); @@ -3979,7 +3979,7 @@ static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { -#ifdef CONFIG_IWLWIFI_SENSITIVITY +#ifdef CONFIG_IWL4965_SENSITIVITY struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_missed_beacon_notif *missed_beacon; @@ -3994,11 +3994,11 @@ static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, if (unlikely(!test_bit(STATUS_SCANNING, &priv->status))) queue_work(priv->workqueue, &priv->sensitivity_work); } -#endif /*CONFIG_IWLWIFI_SENSITIVITY*/ +#endif /*CONFIG_IWL4965_SENSITIVITY*/ } -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG static void iwl4965_set_tx_status(struct iwl_priv *priv, int txq_id, int idx, u32 status, u32 retry_count, u32 rate) @@ -4267,8 +4267,8 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, return 0; } -#endif/* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif/* CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ /* * RATE SCALE CODE */ @@ -4331,7 +4331,7 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) &link_cmd); } -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT static u8 iwl_is_channel_extension(struct iwl_priv *priv, int phymode, u16 channel, u8 extension_chan_offset) @@ -4468,7 +4468,7 @@ void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index) return; } -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT_AGG static void iwl4965_sta_modify_add_ba_tid(struct iwl_priv *priv, int sta_id, int tid, u16 ssn) @@ -4642,8 +4642,8 @@ int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, return 0; } -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ /* Set up 4965-specific Rx frame reply handlers */ void iwl_hw_rx_handler_setup(struct iwl_priv *priv) @@ -4658,25 +4658,25 @@ void iwl_hw_rx_handler_setup(struct iwl_priv *priv) priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] = iwl4965_rx_missed_beacon_notif; -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG priv->rx_handlers[REPLY_COMPRESSED_BA] = iwl4965_rx_reply_compressed_ba; -#endif /* CONFIG_IWLWIFI_AGG */ -#endif /* CONFIG_IWLWIFI */ +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ } void iwl_hw_setup_deferred_work(struct iwl_priv *priv) { INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work); INIT_WORK(&priv->statistics_work, iwl4965_bg_statistics_work); -#ifdef CONFIG_IWLWIFI_SENSITIVITY +#ifdef CONFIG_IWL4965_SENSITIVITY INIT_WORK(&priv->sensitivity_work, iwl4965_bg_sensitivity_work); #endif -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG INIT_WORK(&priv->agg_work, iwl4965_bg_agg_work); -#endif /* CONFIG_IWLWIFI_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_AGG */ +#endif /* CONFIG_IWL4965_HT */ init_timer(&priv->statistics_periodic); priv->statistics_periodic.data = (unsigned long)priv; priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index bf174d3b8fb..d61cf0e26e8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -434,8 +434,8 @@ struct iwl_rx_queue { #define IWL_INVALID_RATE 0xFF #define IWL_INVALID_VALUE -1 -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG struct iwl_ht_agg { u16 txq_id; u16 frame_count; @@ -445,16 +445,16 @@ struct iwl_ht_agg { u32 bitmap1; u32 rate_n_flags; }; -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ struct iwl_tid_data { u16 seq_number; -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG struct iwl_ht_agg agg; -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ }; struct iwl_hw_key { @@ -471,7 +471,7 @@ union iwl_ht_rate_supp { }; }; -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT #define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) #define HT_IE_MAX_AMSDU_SIZE_4K (0) #define CFG_HT_MPDU_DENSITY_2USEC (0x5) @@ -494,9 +494,9 @@ struct sta_ht_info { u8 tx_chan_width; u8 chan_width_cap; }; -#endif /*CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT */ -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL4965_QOS union iwl_qos_capabity { struct { @@ -525,7 +525,7 @@ struct iwl_qos_info { union iwl_qos_capabity qos_cap; struct iwl_qosparam_cmd def_qos_parm; }; -#endif /*CONFIG_IWLWIFI_QOS */ +#endif /*CONFIG_IWL4965_QOS */ #define STA_PS_STATUS_WAKE 0 #define STA_PS_STATUS_SLEEP 1 @@ -617,7 +617,7 @@ extern int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header); extern int iwl_power_init_handle(struct iwl_priv *priv); extern int iwl_eeprom_init(struct iwl_priv *priv); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG extern void iwl_report_frame(struct iwl_priv *priv, struct iwl_rx_packet *pkt, struct ieee80211_hdr *header, int group100); @@ -764,8 +764,8 @@ extern int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u8 fat_extension_channel); extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv); -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG extern int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, u16 *start_seq_num); extern int iwl_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da, @@ -775,8 +775,8 @@ extern int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, extern int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, int generator); extern void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid); -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /*CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /*CONFIG_IWL4965_HT */ /* Structures, enum, and defines specific to the 4965 */ #define IWL4965_KW_SIZE 0x1000 /*4k */ @@ -843,7 +843,7 @@ struct iwl_traffic_load { u32 total; }; -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT_AGG struct iwl_agg_control { unsigned long next_retry; u32 wait_for_agg_status; @@ -855,10 +855,10 @@ struct iwl_agg_control { u32 ba_timeout; struct iwl_traffic_load traffic_load[TID_MAX_LOAD_COUNT]; }; -#endif /*CONFIG_IWLWIFI_HT_AGG */ +#endif /*CONFIG_IWL4965_HT_AGG */ struct iwl_lq_mngr { -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT_AGG struct iwl_agg_control agg_ctrl; #endif spinlock_t lock; @@ -1040,7 +1040,7 @@ struct iwl_chain_noise_data { #define EEPROM_SEM_RETRY_LIMIT 1000 -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT enum { MEASUREMENT_READY = (1 << 0), @@ -1068,7 +1068,7 @@ struct iwl_priv { const struct ieee80211_hw_mode *modes; -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT /* spectrum measurement report caching */ struct iwl_spectrum_notification measure_report; u8 measurement_status; @@ -1157,14 +1157,14 @@ struct iwl_priv { u8 channel_width; /* 0=20MHZ, 1=40MHZ */ u8 current_channel_width; u8 valid_antenna; /* Bit mask of antennas actually connected */ -#ifdef CONFIG_IWLWIFI_SENSITIVITY +#ifdef CONFIG_IWL4965_SENSITIVITY struct iwl_sensitivity_data sensitivity_data; struct iwl_chain_noise_data chain_noise_data; u8 start_calib; __le16 sensitivity_tbl[HD_TABLE_SIZE]; -#endif /*CONFIG_IWLWIFI_SENSITIVITY*/ +#endif /*CONFIG_IWL4965_SENSITIVITY*/ -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT struct sta_ht_info current_assoc_ht; #endif u8 active_rate_ht[2]; @@ -1253,9 +1253,9 @@ struct iwl_priv { u16 assoc_capability; u8 ps_mode; -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL4965_QOS struct iwl_qos_info qos_data; -#endif /*CONFIG_IWLWIFI_QOS */ +#endif /*CONFIG_IWL4965_QOS */ struct workqueue_struct *workqueue; @@ -1290,20 +1290,20 @@ struct iwl_priv { u32 pm_state[16]; #endif -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG /* debugging info */ u32 framecnt_to_us; atomic_t restrict_refcnt; #endif struct work_struct txpower_work; -#ifdef CONFIG_IWLWIFI_SENSITIVITY +#ifdef CONFIG_IWL4965_SENSITIVITY struct work_struct sensitivity_work; #endif struct work_struct statistics_work; struct timer_list statistics_periodic; -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT_AGG struct work_struct agg_work; #endif }; /*iwl_priv */ diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index b9b67e617ff..691d64e0393 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -59,7 +59,7 @@ #include "iwl-3945.h" #include "iwl-helpers.h" -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG u32 iwl_debug_level; #endif @@ -89,13 +89,13 @@ int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; #define DRV_DESCRIPTION \ "Intel(R) PRO/Wireless 3945ABG/BG Network Connection driver for Linux" -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG #define VD "d" #else #define VD #endif -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT #define VS "s" #else #define VS @@ -180,7 +180,7 @@ static const char *iwl_escape_essid(const char *essid, u8 essid_len) static void iwl_print_hex_dump(int level, void *p, u32 len) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG if (!(iwl_debug_level & level)) return; @@ -1584,7 +1584,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) * Misc. internal state and helper functions * ******************************************************************************/ -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG /** * iwl_report_frame - dump frame to syslog during debug sessions @@ -1864,7 +1864,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, /* * QoS support */ -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL3945_QOS static int iwl_send_qos_params_command(struct iwl_priv *priv, struct iwl_qosparam_cmd *qos) { @@ -1993,7 +1993,7 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) } } -#endif /* CONFIG_IWLWIFI_QOS */ +#endif /* CONFIG_IWL3945_QOS */ /* * Power management (not Tx power!) functions */ @@ -2747,7 +2747,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, fc = le16_to_cpu(hdr->frame_control); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG if (ieee80211_is_auth(fc)) IWL_DEBUG_TX("Sending AUTH frame\n"); else if (ieee80211_is_assoc_request(fc)) @@ -3196,7 +3196,7 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) return 1; } -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT #include "iwl-spectrum.h" @@ -3522,7 +3522,7 @@ static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); @@ -3540,7 +3540,7 @@ static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); IWL_DEBUG_RX("sleep mode: %d, src: %d\n", @@ -3586,7 +3586,7 @@ static void iwl_bg_beacon_update(struct work_struct *work) static void iwl_rx_beacon_notif(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_beacon_notif *beacon = &(pkt->u.beacon_status); u8 rate = beacon->beacon_notify_hdr.rate; @@ -3609,7 +3609,7 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv, static void iwl_rx_reply_scan(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_scanreq_notification *notif = (struct iwl_scanreq_notification *)pkt->u.raw; @@ -4370,7 +4370,7 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, return rc; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) { DECLARE_MAC_BUF(mac); @@ -4602,7 +4602,7 @@ static void iwl_irq_handle_error(struct iwl_priv *priv) /* Cancel currently queued command. */ clear_bit(STATUS_HCMD_ACTIVE, &priv->status); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG if (iwl_debug_level & IWL_DL_FW_ERRORS) { iwl_dump_nic_error_log(priv); iwl_dump_nic_event_log(priv); @@ -4651,7 +4651,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) u32 inta, handled = 0; u32 inta_fh; unsigned long flags; -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG u32 inta_mask; #endif @@ -4669,7 +4669,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG if (iwl_debug_level & IWL_DL_ISR) { inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", @@ -4702,7 +4702,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) return; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG if (iwl_debug_level & (IWL_DL_ISR)) { /* NIC fires this, but we don't use it, redundant with WAKEUP */ if (inta & CSR_INT_BIT_MAC_CLK_ACTV) @@ -4800,7 +4800,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) /* Re-enable all interrupts */ iwl_enable_interrupts(priv); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG if (iwl_debug_level & (IWL_DL_ISR)) { inta = iwl_read32(priv, CSR_INT); inta_mask = iwl_read32(priv, CSR_INT_MASK); @@ -6813,9 +6813,9 @@ static void iwl_bg_post_associate(struct work_struct *data) iwl_sequence_reset(priv); -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL3945_QOS iwl_activate_qos(priv, 0); -#endif /* CONFIG_IWLWIFI_QOS */ +#endif /* CONFIG_IWL3945_QOS */ mutex_unlock(&priv->mutex); } @@ -7367,7 +7367,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params) { struct iwl_priv *priv = hw->priv; -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL3945_QOS unsigned long flags; int q; #endif /* CONFIG_IWL_QOS */ @@ -7384,7 +7384,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, return 0; } -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL3945_QOS if (!priv->qos_data.qos_enable) { priv->qos_data.qos_active = 0; IWL_DEBUG_MAC80211("leave - qos not enabled\n"); @@ -7413,7 +7413,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, mutex_unlock(&priv->mutex); -#endif /*CONFIG_IWLWIFI_QOS */ +#endif /*CONFIG_IWL3945_QOS */ IWL_DEBUG_MAC80211("leave\n"); return 0; @@ -7479,7 +7479,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) mutex_lock(&priv->mutex); IWL_DEBUG_MAC80211("enter\n"); -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL3945_QOS iwl_reset_qos(priv); #endif cancel_delayed_work(&priv->post_associate); @@ -7569,7 +7569,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, IWL_DEBUG_MAC80211("leave\n"); spin_unlock_irqrestore(&priv->lock, flags); -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL3945_QOS iwl_reset_qos(priv); #endif @@ -7586,7 +7586,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, * *****************************************************************************/ -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG /* * The following adds a new attribute to the sysfs representation @@ -7619,7 +7619,7 @@ static ssize_t store_debug_level(struct device_driver *d, static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, store_debug_level); -#endif /* CONFIG_IWLWIFI_DEBUG */ +#endif /* CONFIG_IWL3945_DEBUG */ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, char *buf) @@ -7831,7 +7831,7 @@ static ssize_t store_tune(struct device *d, static DEVICE_ATTR(tune, S_IWUSR | S_IRUGO, show_tune, store_tune); -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT static ssize_t show_measurement(struct device *d, struct device_attribute *attr, char *buf) @@ -7902,7 +7902,7 @@ static ssize_t store_measurement(struct device *d, static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR, show_measurement, store_measurement); -#endif /* CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT */ +#endif /* CONFIG_IWL3945_SPECTRUM_MEASUREMENT */ static ssize_t show_rate(struct device *d, struct device_attribute *attr, char *buf) @@ -8280,7 +8280,7 @@ static struct attribute *iwl_sysfs_entries[] = { &dev_attr_dump_events.attr, &dev_attr_flags.attr, &dev_attr_filter_flags.attr, -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT &dev_attr_measurement.attr, #endif &dev_attr_power_level.attr, @@ -8360,7 +8360,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->pci_dev = pdev; priv->antenna = (enum iwl_antenna)iwl_param_antenna; -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG iwl_debug_level = iwl_param_debug; atomic_set(&priv->restrict_refcnt, 0); #endif @@ -8475,7 +8475,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_iounmap; } -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL3945_QOS if (iwl_param_qos_enable) priv->qos_data.qos_enable = 1; @@ -8483,7 +8483,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->qos_data.qos_active = 0; priv->qos_data.qos_cap.val = 0; -#endif /* CONFIG_IWLWIFI_QOS */ +#endif /* CONFIG_IWL3945_QOS */ iwl_set_rxon_channel(priv, MODE_IEEE80211G, 6); iwl_setup_deferred_work(priv); @@ -8743,7 +8743,7 @@ static int __init iwl_init(void) IWL_ERROR("Unable to initialize PCI module\n"); return ret; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG ret = driver_create_file(&iwl_driver.driver, &driver_attr_debug_level); if (ret) { IWL_ERROR("Unable to create driver sysfs file\n"); @@ -8757,7 +8757,7 @@ static int __init iwl_init(void) static void __exit iwl_exit(void) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL3945_DEBUG driver_remove_file(&iwl_driver.driver, &driver_attr_debug_level); #endif pci_unregister_driver(&iwl_driver); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 1e7b589ac86..6fb49b0738a 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -59,7 +59,7 @@ #include "iwl-4965.h" #include "iwl-helpers.h" -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG u32 iwl_debug_level; #endif @@ -88,13 +88,13 @@ int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; #define DRV_DESCRIPTION "Intel(R) Wireless WiFi Link 4965AGN driver for Linux" -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG #define VD "d" #else #define VD #endif -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT #define VS "s" #else #define VS @@ -179,7 +179,7 @@ static const char *iwl_escape_essid(const char *essid, u8 essid_len) static void iwl_print_hex_dump(int level, void *p, u32 len) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG if (!(iwl_debug_level & level)) return; @@ -507,12 +507,12 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) station->sta.sta.sta_id = index; station->sta.station_flags = 0; -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT /* BCAST station and IBSS stations do not work in HT mode */ if (index != priv->hw_setting.bcast_sta_id && priv->iw_mode != IEEE80211_IF_TYPE_IBSS) iwl4965_set_ht_add_station(priv, index); -#endif /*CONFIG_IWLWIFI_HT*/ +#endif /*CONFIG_IWL4965_HT*/ spin_unlock_irqrestore(&priv->sta_lock, flags_spin); iwl_send_add_station(priv, &station->sta, flags); @@ -1112,13 +1112,13 @@ static int iwl_commit_rxon(struct iwl_priv *priv) /* station table will be cleared */ priv->assoc_station_added = 0; -#ifdef CONFIG_IWLWIFI_SENSITIVITY +#ifdef CONFIG_IWL4965_SENSITIVITY priv->sensitivity_data.state = IWL_SENS_CALIB_NEED_REINIT; if (!priv->error_recovering) priv->start_calib = 0; iwl4965_init_sensitivity(priv, CMD_ASYNC, 1); -#endif /* CONFIG_IWLWIFI_SENSITIVITY */ +#endif /* CONFIG_IWL4965_SENSITIVITY */ /* If we are currently associated and the new config requires * an RXON_ASSOC and the new config wants the associated mask enabled, @@ -1162,13 +1162,13 @@ static int iwl_commit_rxon(struct iwl_priv *priv) iwl_clear_stations_table(priv); -#ifdef CONFIG_IWLWIFI_SENSITIVITY +#ifdef CONFIG_IWL4965_SENSITIVITY if (!priv->error_recovering) priv->start_calib = 0; priv->sensitivity_data.state = IWL_SENS_CALIB_NEED_REINIT; iwl4965_init_sensitivity(priv, CMD_ASYNC, 1); -#endif /* CONFIG_IWLWIFI_SENSITIVITY */ +#endif /* CONFIG_IWL4965_SENSITIVITY */ memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); @@ -1635,7 +1635,7 @@ done: * Misc. internal state and helper functions * ******************************************************************************/ -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG /** * iwl_report_frame - dump frame to syslog during debug sessions @@ -1818,7 +1818,7 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, return ret_rates; } -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT void static iwl_set_ht_capab(struct ieee80211_hw *hw, struct ieee80211_ht_capability *ht_cap, u8 use_wide_chan); @@ -1916,7 +1916,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, if (*pos > 0) len += 2 + *pos; -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT if (is_direct && priv->is_ht_enabled) { u8 use_wide_chan = 1; @@ -1929,7 +1929,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, use_wide_chan); len += 2 + sizeof(struct ieee80211_ht_capability); } -#endif /*CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT */ fill_end: return (u16)len; @@ -1938,7 +1938,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, /* * QoS support */ -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL4965_QOS static int iwl_send_qos_params_command(struct iwl_priv *priv, struct iwl_qosparam_cmd *qos) { @@ -2055,10 +2055,10 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) priv->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_UPDATE_EDCA_MSK; -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT if (priv->is_ht_enabled && priv->current_assoc_ht.is_ht) priv->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT */ spin_unlock_irqrestore(&priv->lock, flags); @@ -2072,7 +2072,7 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) } } -#endif /* CONFIG_IWLWIFI_QOS */ +#endif /* CONFIG_IWL4965_QOS */ /* * Power management (not Tx power!) functions */ @@ -2835,7 +2835,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, fc = le16_to_cpu(hdr->frame_control); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG if (ieee80211_is_auth(fc)) IWL_DEBUG_TX("Sending AUTH frame\n"); else if (ieee80211_is_assoc_request(fc)) @@ -2873,13 +2873,13 @@ static int iwl_tx_skb(struct iwl_priv *priv, (hdr->seq_ctrl & __constant_cpu_to_le16(IEEE80211_SCTL_FRAG)); seq_number += 0x10; -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG /* aggregation is on for this */ if (ctl->flags & IEEE80211_TXCTL_HT_MPDU_AGG) txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ } txq = &priv->txq[txq_id]; q = &txq->q; @@ -3289,7 +3289,7 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) return 1; } -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT #include "iwl-spectrum.h" @@ -3497,8 +3497,8 @@ static int iwl_is_tx_success(u32 status) * Generic RX handler implementations * ******************************************************************************/ -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG static inline int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) @@ -3654,8 +3654,8 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, struct ieee80211_tx_status *tx_status; struct iwl_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; u32 status = le32_to_cpu(tx_resp->status); -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG int tid, sta_id; #endif #endif @@ -3668,8 +3668,8 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, return; } -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG if (txq->sched_retry) { const u32 scd_ssn = iwl_get_scd_ssn(tx_resp); struct ieee80211_hdr *hdr = @@ -3706,8 +3706,8 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, iwl_tx_queue_reclaim(priv, txq_id, index); } } else { -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ tx_status = &(txq->txb[txq->q.read_ptr].status); tx_status->retry_count = tx_resp->failure_frame; @@ -3729,11 +3729,11 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); if (index != -1) iwl_tx_queue_reclaim(priv, txq_id, index); -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG } -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); @@ -3815,7 +3815,7 @@ static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); @@ -3833,7 +3833,7 @@ static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); IWL_DEBUG_RX("sleep mode: %d, src: %d\n", @@ -3879,7 +3879,7 @@ static void iwl_bg_beacon_update(struct work_struct *work) static void iwl_rx_beacon_notif(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_beacon_notif *beacon = &(pkt->u.beacon_status); u8 rate = iwl_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); @@ -3902,7 +3902,7 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv, static void iwl_rx_reply_scan(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_scanreq_notification *notif = (struct iwl_scanreq_notification *)pkt->u.raw; @@ -4700,7 +4700,7 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, return rc; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) { DECLARE_MAC_BUF(mac); @@ -4924,7 +4924,7 @@ static void iwl_irq_handle_error(struct iwl_priv *priv) /* Cancel currently queued command. */ clear_bit(STATUS_HCMD_ACTIVE, &priv->status); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG if (iwl_debug_level & IWL_DL_FW_ERRORS) { iwl_dump_nic_error_log(priv); iwl_dump_nic_event_log(priv); @@ -4973,7 +4973,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) u32 inta, handled = 0; u32 inta_fh; unsigned long flags; -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG u32 inta_mask; #endif @@ -4991,7 +4991,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG if (iwl_debug_level & IWL_DL_ISR) { inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", @@ -5024,7 +5024,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) return; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG if (iwl_debug_level & (IWL_DL_ISR)) { /* NIC fires this, but we don't use it, redundant with WAKEUP */ if (inta & CSR_INT_BIT_MAC_CLK_ACTV) @@ -5114,7 +5114,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) /* Re-enable all interrupts */ iwl_enable_interrupts(priv); -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG if (iwl_debug_level & (IWL_DL_ISR)) { inta = iwl_read32(priv, CSR_INT); inta_mask = iwl_read32(priv, CSR_INT_MASK); @@ -7148,7 +7148,7 @@ static void iwl_bg_post_associate(struct work_struct *data) priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT if (priv->is_ht_enabled && priv->current_assoc_ht.is_ht) iwl4965_set_rxon_ht(priv, &priv->current_assoc_ht); else { @@ -7156,7 +7156,7 @@ static void iwl_bg_post_associate(struct work_struct *data) priv->active_rate_ht[1] = 0; priv->current_channel_width = IWL_CHANNEL_WIDTH_20MHZ; } -#endif /* CONFIG_IWLWIFI_HT*/ +#endif /* CONFIG_IWL4965_HT*/ iwl4965_set_rxon_chain(priv); priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); @@ -7206,18 +7206,18 @@ static void iwl_bg_post_associate(struct work_struct *data) iwl_sequence_reset(priv); -#ifdef CONFIG_IWLWIFI_SENSITIVITY +#ifdef CONFIG_IWL4965_SENSITIVITY /* Enable Rx differential gain and sensitivity calibrations */ iwl4965_chain_noise_reset(priv); priv->start_calib = 1; -#endif /* CONFIG_IWLWIFI_SENSITIVITY */ +#endif /* CONFIG_IWL4965_SENSITIVITY */ if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) priv->assoc_station_added = 1; -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL4965_QOS iwl_activate_qos(priv, 0); -#endif /* CONFIG_IWLWIFI_QOS */ +#endif /* CONFIG_IWL4965_QOS */ mutex_unlock(&priv->mutex); } @@ -7399,7 +7399,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) return -EINVAL; } -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT /* if we are switching fron ht to 2.4 clear flags * from any ht related info since 2.4 does not * support ht */ @@ -7409,7 +7409,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) #endif ) priv->staging_rxon.flags = 0; -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT */ iwl_set_rxon_channel(priv, conf->phymode, conf->channel); @@ -7509,7 +7509,7 @@ static void iwl_config_ap(struct iwl_priv *priv) /* restore RXON assoc */ priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; iwl_commit_rxon(priv); -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL4965_QOS iwl_activate_qos(priv, 1); #endif iwl_rxon_add_station(priv, BROADCAST_ADDR, 0); @@ -7805,7 +7805,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params) { struct iwl_priv *priv = hw->priv; -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL4965_QOS unsigned long flags; int q; #endif /* CONFIG_IWL_QOS */ @@ -7822,7 +7822,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, return 0; } -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL4965_QOS if (!priv->qos_data.qos_enable) { priv->qos_data.qos_active = 0; IWL_DEBUG_MAC80211("leave - qos not enabled\n"); @@ -7851,7 +7851,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, mutex_unlock(&priv->mutex); -#endif /*CONFIG_IWLWIFI_QOS */ +#endif /*CONFIG_IWL4965_QOS */ IWL_DEBUG_MAC80211("leave\n"); return 0; @@ -7918,11 +7918,11 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) IWL_DEBUG_MAC80211("enter\n"); priv->lq_mngr.lq_ready = 0; -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT spin_lock_irqsave(&priv->lock, flags); memset(&priv->current_assoc_ht, 0, sizeof(struct sta_ht_info)); spin_unlock_irqrestore(&priv->lock, flags); -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT_AGG /* if (priv->lq_mngr.agg_ctrl.granted_ba) iwl4965_turn_off_agg(priv, TID_ALL_SPECIFIED);*/ @@ -7933,10 +7933,10 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) if (priv->lq_mngr.agg_ctrl.auto_agg) priv->lq_mngr.agg_ctrl.requested_ba = TID_ALL_ENABLED; -#endif /*CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /*CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL4965_QOS iwl_reset_qos(priv); #endif @@ -8028,7 +8028,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, IWL_DEBUG_MAC80211("leave\n"); spin_unlock_irqrestore(&priv->lock, flags); -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL4965_QOS iwl_reset_qos(priv); #endif @@ -8039,7 +8039,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, return 0; } -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT union ht_cap_info { struct { u16 advanced_coding_cap :1; @@ -8231,7 +8231,7 @@ static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw, iwl_set_ht_capab(hw, ht_cap, use_wide_channel); IWL_DEBUG_MAC80211("leave: \n"); } -#endif /*CONFIG_IWLWIFI_HT*/ +#endif /*CONFIG_IWL4965_HT*/ /***************************************************************************** * @@ -8239,7 +8239,7 @@ static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw, * *****************************************************************************/ -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG /* * The following adds a new attribute to the sysfs representation @@ -8272,7 +8272,7 @@ static ssize_t store_debug_level(struct device_driver *d, static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, store_debug_level); -#endif /* CONFIG_IWLWIFI_DEBUG */ +#endif /* CONFIG_IWL4965_DEBUG */ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, char *buf) @@ -8484,7 +8484,7 @@ static ssize_t store_tune(struct device *d, static DEVICE_ATTR(tune, S_IWUSR | S_IRUGO, show_tune, store_tune); -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT static ssize_t show_measurement(struct device *d, struct device_attribute *attr, char *buf) @@ -8555,7 +8555,7 @@ static ssize_t store_measurement(struct device *d, static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR, show_measurement, store_measurement); -#endif /* CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT */ +#endif /* CONFIG_IWL4965_SPECTRUM_MEASUREMENT */ static ssize_t store_retry_rate(struct device *d, struct device_attribute *attr, @@ -8908,7 +8908,7 @@ static struct attribute *iwl_sysfs_entries[] = { &dev_attr_dump_events.attr, &dev_attr_flags.attr, &dev_attr_filter_flags.attr, -#ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT +#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT &dev_attr_measurement.attr, #endif &dev_attr_power_level.attr, @@ -8946,16 +8946,16 @@ static struct ieee80211_ops iwl_hw_ops = { .reset_tsf = iwl_mac_reset_tsf, .beacon_update = iwl_mac_beacon_update, .erp_ie_changed = iwl_mac_erp_ie_changed, -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWL4965_HT .conf_ht = iwl_mac_conf_ht, .get_ht_capab = iwl_mac_get_ht_capab, -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT_AGG .ht_tx_agg_start = iwl_mac_ht_tx_agg_start, .ht_tx_agg_stop = iwl_mac_ht_tx_agg_stop, .ht_rx_agg_start = iwl_mac_ht_rx_agg_start, .ht_rx_agg_stop = iwl_mac_ht_rx_agg_stop, -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ .hw_scan = iwl_mac_hw_scan }; @@ -8997,7 +8997,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->pci_dev = pdev; priv->antenna = (enum iwl_antenna)iwl_param_antenna; -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG iwl_debug_level = iwl_param_debug; atomic_set(&priv->restrict_refcnt, 0); #endif @@ -9018,11 +9018,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE; hw->queues = 4; -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWL4965_HT +#ifdef CONFIG_IWL4965_HT_AGG hw->queues = 16; -#endif /* CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ spin_lock_init(&priv->lock); spin_lock_init(&priv->power_data.lock); @@ -9103,7 +9103,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_iounmap; } -#ifdef CONFIG_IWLWIFI_QOS +#ifdef CONFIG_IWL4965_QOS if (iwl_param_qos_enable) priv->qos_data.qos_enable = 1; @@ -9111,7 +9111,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->qos_data.qos_active = 0; priv->qos_data.qos_cap.val = 0; -#endif /* CONFIG_IWLWIFI_QOS */ +#endif /* CONFIG_IWL4965_QOS */ iwl_set_rxon_channel(priv, MODE_IEEE80211G, 6); iwl_setup_deferred_work(priv); @@ -9371,7 +9371,7 @@ static int __init iwl_init(void) IWL_ERROR("Unable to initialize PCI module\n"); return ret; } -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG ret = driver_create_file(&iwl_driver.driver, &driver_attr_debug_level); if (ret) { IWL_ERROR("Unable to create driver sysfs file\n"); @@ -9385,7 +9385,7 @@ static int __init iwl_init(void) static void __exit iwl_exit(void) { -#ifdef CONFIG_IWLWIFI_DEBUG +#ifdef CONFIG_IWL4965_DEBUG driver_remove_file(&iwl_driver.driver, &driver_attr_debug_level); #endif pci_unregister_driver(&iwl_driver); -- cgit v1.2.3-70-g09d2 From 49df2b33478fd67e642d05786d06de322504842c Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 26 Oct 2007 16:10:39 +0200 Subject: iwlwifi: disable interrupts before calling request_irq Disable interrupts in the iwl4965 before calling request_irq() for the case that the previous OS or the BIOS left a pending interrupt in the chip. This behavior has been observed on some laptops such as T61 Thinkpads and Toshiba Portege R500 Signed-off-by: Jes Sorensen Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 ++ drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 691d64e0393..e0f6f03a920 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -8494,6 +8494,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->power_mode = IWL_POWER_AC; priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; + iwl_disable_interrupts(priv); + pci_enable_msi(pdev); err = request_irq(pdev->irq, iwl_isr, IRQF_SHARED, DRV_NAME, priv); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 6fb49b0738a..07df6c1c102 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -9122,6 +9122,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->power_mode = IWL_POWER_AC; priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; + iwl_disable_interrupts(priv); + pci_enable_msi(pdev); err = request_irq(pdev->irq, iwl_isr, IRQF_SHARED, DRV_NAME, priv); -- cgit v1.2.3-70-g09d2 From bb8c093bdea62f2ae371b98ebff81b0407852faf Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 27 Jan 2008 16:41:47 -0800 Subject: iwlwifi: cleanup namespace Prefix all symbols with iwl3945_ or iwl4965_ and thus allow building the driver into the kernel. Also remove all the useless default statements in Kconfig while we're at it. Signed-off-by: Christoph Hellwig Signed-off-by: Zhu Yi Signed-off-by: Reinette Chatre Signed-off-by: John W. Linville Signed-off-by: David S. Miller --- drivers/net/wireless/iwlwifi/Kconfig | 14 +- drivers/net/wireless/iwlwifi/iwl-3945-commands.h | 190 +- drivers/net/wireless/iwlwifi/iwl-3945-debug.h | 12 +- drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 50 +- drivers/net/wireless/iwlwifi/iwl-3945-io.h | 256 +-- drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 144 +- drivers/net/wireless/iwlwifi/iwl-3945-rs.h | 26 +- drivers/net/wireless/iwlwifi/iwl-3945.c | 528 ++--- drivers/net/wireless/iwlwifi/iwl-3945.h | 376 ++-- drivers/net/wireless/iwlwifi/iwl-4965-commands.h | 200 +- drivers/net/wireless/iwlwifi/iwl-4965-debug.h | 12 +- drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 72 +- drivers/net/wireless/iwlwifi/iwl-4965-io.h | 256 +-- drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 300 +-- drivers/net/wireless/iwlwifi/iwl-4965-rs.h | 32 +- drivers/net/wireless/iwlwifi/iwl-4965.c | 752 +++---- drivers/net/wireless/iwlwifi/iwl-4965.h | 452 +++-- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2206 ++++++++++---------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2321 +++++++++++----------- 19 files changed, 4093 insertions(+), 4106 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index 74243fe9dca..abd0ce0954d 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig @@ -1,8 +1,7 @@ config IWL4965 tristate "Intel Wireless WiFi 4965AGN" - depends on m && PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL + depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL select FW_LOADER - default m ---help--- Select to build the driver supporting the: @@ -30,7 +29,6 @@ config IWL4965 config IWL4965_QOS bool "Enable Wireless QoS in iwl4965 driver" depends on IWL4965 - default y ---help--- This option will enable wireless quality of service (QoS) for the iw4965 driver. @@ -38,14 +36,12 @@ config IWL4965_QOS config IWL4965_SPECTRUM_MEASUREMENT bool "Enable Spectrum Measurement in iw4965 driver" depends on IWL4965 - default y ---help--- This option will enable spectrum measurement for the iwl4965 driver. config IWL4965_SENSITIVITY bool "Enable Sensitivity Calibration in iwl4965 driver" depends on IWL4965 - default y ---help--- This option will enable sensitivity calibration for the iwl4965 driver. @@ -54,7 +50,6 @@ config IWL4965_HT bool "Enable 802.11n HT features in iwl4965 driver" depends on EXPERIMENTAL depends on IWL4965 && MAC80211_HT - default n ---help--- This option enables IEEE 802.11n High Throughput features for the iwl4965 driver. @@ -62,7 +57,6 @@ config IWL4965_HT config IWL4965_DEBUG bool "Enable full debugging output in iwl4965 driver" depends on IWL4965 - default y ---help--- This option will enable debug tracing output for the iwl4965 driver. @@ -88,9 +82,8 @@ config IWL4965_DEBUG config IWL3945 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" - depends on m && PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL + depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL select FW_LOADER - default m ---help--- Select to build the driver supporting the: @@ -118,7 +111,6 @@ config IWL3945 config IWL3945_QOS bool "Enable Wireless QoS in iwl3945 driver" depends on IWL3945 - default y ---help--- This option will enable wireless quality of service (QoS) for the iwl3945 driver. @@ -126,14 +118,12 @@ config IWL3945_QOS config IWL3945_SPECTRUM_MEASUREMENT bool "Enable Spectrum Measurement in iwl3945 drivers" depends on IWL3945 - default y ---help--- This option will enable spectrum measurement for the iwl3945 driver. config IWL3945_DEBUG bool "Enable full debugging output in iwl3945 driver" depends on IWL3945 - default y ---help--- This option will enable debug tracing output for the iwl3945 driver. diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h index 2c71195a08e..dc7498d5621 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h @@ -141,7 +141,7 @@ enum { #define IWL_CMD_FAILED_MSK 0x40 -struct iwl_cmd_header { +struct iwl3945_cmd_header { u8 cmd; u8 flags; /* We have 15 LSB to use as we please (MSB indicates @@ -173,7 +173,7 @@ struct iwl_cmd_header { /* * REPLY_ALIVE = 0x1 (response only, not a command) */ -struct iwl_alive_resp { +struct iwl3945_alive_resp { u8 ucode_minor; u8 ucode_major; __le16 reserved1; @@ -187,7 +187,7 @@ struct iwl_alive_resp { __le32 is_valid; } __attribute__ ((packed)); -struct iwl_init_alive_resp { +struct iwl3945_init_alive_resp { u8 ucode_minor; u8 ucode_major; __le16 reserved1; @@ -210,7 +210,7 @@ union tsf { /* * REPLY_ERROR = 0x2 (response only, not a command) */ -struct iwl_error_resp { +struct iwl3945_error_resp { __le32 error_type; u8 cmd_id; u8 reserved1; @@ -279,7 +279,7 @@ enum { /* * REPLY_RXON = 0x10 (command, has simple generic response) */ -struct iwl_rxon_cmd { +struct iwl3945_rxon_cmd { u8 node_addr[6]; __le16 reserved1; u8 bssid_addr[6]; @@ -301,7 +301,7 @@ struct iwl_rxon_cmd { /* * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) */ -struct iwl_rxon_assoc_cmd { +struct iwl3945_rxon_assoc_cmd { __le32 flags; __le32 filter_flags; u8 ofdm_basic_rates; @@ -312,7 +312,7 @@ struct iwl_rxon_assoc_cmd { /* * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) */ -struct iwl_rxon_time_cmd { +struct iwl3945_rxon_time_cmd { union tsf timestamp; __le16 beacon_interval; __le16 atim_window; @@ -321,34 +321,34 @@ struct iwl_rxon_time_cmd { __le16 reserved; } __attribute__ ((packed)); -struct iwl_tx_power { +struct iwl3945_tx_power { u8 tx_gain; /* gain for analog radio */ u8 dsp_atten; /* gain for DSP */ } __attribute__ ((packed)); -struct iwl_power_per_rate { +struct iwl3945_power_per_rate { u8 rate; /* plcp */ - struct iwl_tx_power tpc; + struct iwl3945_tx_power tpc; u8 reserved; } __attribute__ ((packed)); /* * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) */ -struct iwl_channel_switch_cmd { +struct iwl3945_channel_switch_cmd { u8 band; u8 expect_beacon; __le16 channel; __le32 rxon_flags; __le32 rxon_filter_flags; __le32 switch_time; - struct iwl_power_per_rate power[IWL_MAX_RATES]; + struct iwl3945_power_per_rate power[IWL_MAX_RATES]; } __attribute__ ((packed)); /* * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) */ -struct iwl_csa_notification { +struct iwl3945_csa_notification { __le16 band; __le16 channel; __le32 status; /* 0 - OK, 1 - fail */ @@ -359,7 +359,7 @@ struct iwl_csa_notification { * Quality-of-Service (QOS) Commands & Responses: * *****************************************************************************/ -struct iwl_ac_qos { +struct iwl3945_ac_qos { __le16 cw_min; __le16 cw_max; u8 aifsn; @@ -381,9 +381,9 @@ struct iwl_ac_qos { /* * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) */ -struct iwl_qosparam_cmd { +struct iwl3945_qosparam_cmd { __le32 qos_flags; - struct iwl_ac_qos ac[AC_NUM]; + struct iwl3945_ac_qos ac[AC_NUM]; } __attribute__ ((packed)); /****************************************************************************** @@ -442,7 +442,7 @@ struct iwl_qosparam_cmd { #define RATE_MCS_ANT_B_MSK 0x8000 #define RATE_MCS_ANT_AB_MSK 0xc000 -struct iwl_keyinfo { +struct iwl3945_keyinfo { __le16 key_flags; u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ u8 reserved1; @@ -462,11 +462,11 @@ struct sta_id_modify { /* * REPLY_ADD_STA = 0x18 (command) */ -struct iwl_addsta_cmd { +struct iwl3945_addsta_cmd { u8 mode; u8 reserved[3]; struct sta_id_modify sta; - struct iwl_keyinfo key; + struct iwl3945_keyinfo key; __le32 station_flags; __le32 station_flags_msk; __le16 tid_disable_tx; @@ -479,7 +479,7 @@ struct iwl_addsta_cmd { /* * REPLY_ADD_STA = 0x18 (response) */ -struct iwl_add_sta_resp { +struct iwl3945_add_sta_resp { u8 status; } __attribute__ ((packed)); @@ -491,7 +491,7 @@ struct iwl_add_sta_resp { * *****************************************************************************/ -struct iwl_rx_frame_stats { +struct iwl3945_rx_frame_stats { u8 phy_count; u8 id; u8 rssi; @@ -501,7 +501,7 @@ struct iwl_rx_frame_stats { u8 payload[0]; } __attribute__ ((packed)); -struct iwl_rx_frame_hdr { +struct iwl3945_rx_frame_hdr { __le16 channel; __le16 phy_flags; u8 reserved1; @@ -531,7 +531,7 @@ struct iwl_rx_frame_hdr { #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) -struct iwl_rx_frame_end { +struct iwl3945_rx_frame_end { __le32 status; __le64 timestamp; __le32 beacon_timestamp; @@ -545,10 +545,10 @@ struct iwl_rx_frame_end { * The actual offsets of the hdr and end are dynamic based on * stats.phy_count */ -struct iwl_rx_frame { - struct iwl_rx_frame_stats stats; - struct iwl_rx_frame_hdr hdr; - struct iwl_rx_frame_end end; +struct iwl3945_rx_frame { + struct iwl3945_rx_frame_stats stats; + struct iwl3945_rx_frame_hdr hdr; + struct iwl3945_rx_frame_end end; } __attribute__ ((packed)); /* Fixed (non-configurable) rx data from phy */ @@ -643,7 +643,7 @@ struct iwl4965_rx_mpdu_res_start { * TX command Frame life time */ -struct iwl_dram_scratch { +struct iwl3945_dram_scratch { u8 try_cnt; u8 bt_kill_cnt; __le16 reserved; @@ -652,7 +652,7 @@ struct iwl_dram_scratch { /* * REPLY_TX = 0x1c (command) */ -struct iwl_tx_cmd { +struct iwl3945_tx_cmd { __le16 len; __le16 next_frame_len; __le32 tx_flags; @@ -784,7 +784,7 @@ enum { /* * REPLY_TX = 0x1c (response) */ -struct iwl_tx_resp { +struct iwl3945_tx_resp { u8 failure_rts; u8 failure_frame; u8 bt_kill_count; @@ -796,7 +796,7 @@ struct iwl_tx_resp { /* * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) */ -struct iwl_compressed_ba_resp { +struct iwl3945_compressed_ba_resp { __le32 sta_addr_lo32; __le16 sta_addr_hi16; __le16 reserved; @@ -812,21 +812,21 @@ struct iwl_compressed_ba_resp { /* * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) */ -struct iwl_txpowertable_cmd { +struct iwl3945_txpowertable_cmd { u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ u8 reserved; __le16 channel; - struct iwl_power_per_rate power[IWL_MAX_RATES]; + struct iwl3945_power_per_rate power[IWL_MAX_RATES]; } __attribute__ ((packed)); -struct iwl_rate_scaling_info { +struct iwl3945_rate_scaling_info { __le16 rate_n_flags; u8 try_cnt; u8 next_rate_index; } __attribute__ ((packed)); /** - * struct iwl_rate_scaling_cmd - Rate Scaling Command & Response + * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response * * REPLY_RATE_SCALE = 0x47 (command, has simple generic response) * @@ -840,16 +840,16 @@ struct iwl_rate_scaling_info { * when passed through ofdm_basic_rates on the REPLY_RXON * command would be bit 0 (1<<0) */ -struct iwl_rate_scaling_cmd { +struct iwl3945_rate_scaling_cmd { u8 table_id; u8 reserved[3]; - struct iwl_rate_scaling_info table[IWL_MAX_RATES]; + struct iwl3945_rate_scaling_info table[IWL_MAX_RATES]; } __attribute__ ((packed)); /* * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) */ -struct iwl_bt_cmd { +struct iwl3945_bt_cmd { u8 flags; u8 lead_time; u8 max_kill; @@ -875,18 +875,18 @@ struct iwl_bt_cmd { RXON_FILTER_ASSOC_MSK | \ RXON_FILTER_BCON_AWARE_MSK) -struct iwl_measure_channel { +struct iwl3945_measure_channel { __le32 duration; /* measurement duration in extended beacon * format */ u8 channel; /* channel to measure */ - u8 type; /* see enum iwl_measure_type */ + u8 type; /* see enum iwl3945_measure_type */ __le16 reserved; } __attribute__ ((packed)); /* * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) */ -struct iwl_spectrum_cmd { +struct iwl3945_spectrum_cmd { __le16 len; /* number of bytes starting from token */ u8 token; /* token id */ u8 id; /* measurement id -- 0 or 1 */ @@ -899,13 +899,13 @@ struct iwl_spectrum_cmd { __le32 filter_flags; /* rxon filter flags */ __le16 channel_count; /* minimum 1, maximum 10 */ __le16 reserved3; - struct iwl_measure_channel channels[10]; + struct iwl3945_measure_channel channels[10]; } __attribute__ ((packed)); /* * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) */ -struct iwl_spectrum_resp { +struct iwl3945_spectrum_resp { u8 token; u8 id; /* id of the prior command replaced, or 0xff */ __le16 status; /* 0 - command will be handled @@ -913,12 +913,12 @@ struct iwl_spectrum_resp { * measurement) */ } __attribute__ ((packed)); -enum iwl_measurement_state { +enum iwl3945_measurement_state { IWL_MEASUREMENT_START = 0, IWL_MEASUREMENT_STOP = 1, }; -enum iwl_measurement_status { +enum iwl3945_measurement_status { IWL_MEASUREMENT_OK = 0, IWL_MEASUREMENT_CONCURRENT = 1, IWL_MEASUREMENT_CSA_CONFLICT = 2, @@ -931,18 +931,18 @@ enum iwl_measurement_status { #define NUM_ELEMENTS_IN_HISTOGRAM 8 -struct iwl_measurement_histogram { +struct iwl3945_measurement_histogram { __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ } __attribute__ ((packed)); /* clear channel availability counters */ -struct iwl_measurement_cca_counters { +struct iwl3945_measurement_cca_counters { __le32 ofdm; __le32 cck; } __attribute__ ((packed)); -enum iwl_measure_type { +enum iwl3945_measure_type { IWL_MEASURE_BASIC = (1 << 0), IWL_MEASURE_CHANNEL_LOAD = (1 << 1), IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), @@ -955,7 +955,7 @@ enum iwl_measure_type { /* * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) */ -struct iwl_spectrum_notification { +struct iwl3945_spectrum_notification { u8 id; /* measurement id -- 0 or 1 */ u8 token; u8 channel_index; /* index in measurement channel list */ @@ -963,7 +963,7 @@ struct iwl_spectrum_notification { __le32 start_time; /* lower 32-bits of TSF */ u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ u8 channel; - u8 type; /* see enum iwl_measurement_type */ + u8 type; /* see enum iwl3945_measurement_type */ u8 reserved1; /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only * valid if applicable for measurement type requested. */ @@ -973,9 +973,9 @@ struct iwl_spectrum_notification { u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - * unidentified */ u8 reserved2[3]; - struct iwl_measurement_histogram histogram; + struct iwl3945_measurement_histogram histogram; __le32 stop_time; /* lower 32-bits of TSF */ - __le32 status; /* see iwl_measurement_status */ + __le32 status; /* see iwl3945_measurement_status */ } __attribute__ ((packed)); /****************************************************************************** @@ -985,7 +985,7 @@ struct iwl_spectrum_notification { *****************************************************************************/ /** - * struct iwl_powertable_cmd - Power Table Command + * struct iwl3945_powertable_cmd - Power Table Command * @flags: See below: * * POWER_TABLE_CMD = 0x77 (command, has simple generic response) @@ -1017,7 +1017,7 @@ struct iwl_spectrum_notification { #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0) #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2) #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3) -struct iwl_powertable_cmd { +struct iwl3945_powertable_cmd { __le32 flags; __le32 rx_data_timeout; __le32 tx_data_timeout; @@ -1028,7 +1028,7 @@ struct iwl_powertable_cmd { * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) * 3945 and 4965 identical. */ -struct iwl_sleep_notification { +struct iwl3945_sleep_notification { u8 pm_sleep_mode; u8 pm_wakeup_src; __le16 reserved; @@ -1058,14 +1058,14 @@ enum { #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ -struct iwl_card_state_cmd { +struct iwl3945_card_state_cmd { __le32 status; /* CARD_STATE_CMD_* request new power state */ } __attribute__ ((packed)); /* * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) */ -struct iwl_card_state_notif { +struct iwl3945_card_state_notif { __le32 flags; } __attribute__ ((packed)); @@ -1074,7 +1074,7 @@ struct iwl_card_state_notif { #define RF_CARD_DISABLED 0x04 #define RXON_CARD_DISABLED 0x10 -struct iwl_ct_kill_config { +struct iwl3945_ct_kill_config { __le32 reserved; __le32 critical_temperature_M; __le32 critical_temperature_R; @@ -1086,7 +1086,7 @@ struct iwl_ct_kill_config { * *****************************************************************************/ -struct iwl_scan_channel { +struct iwl3945_scan_channel { /* type is defined as: * 0:0 active (0 - passive) * 1:4 SSID direct @@ -1095,12 +1095,12 @@ struct iwl_scan_channel { */ u8 type; u8 channel; - struct iwl_tx_power tpc; + struct iwl3945_tx_power tpc; __le16 active_dwell; __le16 passive_dwell; } __attribute__ ((packed)); -struct iwl_ssid_ie { +struct iwl3945_ssid_ie { u8 id; u8 len; u8 ssid[32]; @@ -1114,7 +1114,7 @@ struct iwl_ssid_ie { /* * REPLY_SCAN_CMD = 0x80 (command) */ -struct iwl_scan_cmd { +struct iwl3945_scan_cmd { __le16 len; u8 reserved0; u8 channel_count; @@ -1133,14 +1133,14 @@ struct iwl_scan_cmd { __le32 flags; __le32 filter_flags; - struct iwl_tx_cmd tx_cmd; - struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; + struct iwl3945_tx_cmd tx_cmd; + struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX]; u8 data[0]; /* * The channels start after the probe request payload and are of type: * - * struct iwl_scan_channel channels[0]; + * struct iwl3945_scan_channel channels[0]; * * NOTE: Only one band of channels can be scanned per pass. You * can not mix 2.4GHz channels and 5.2GHz channels and must @@ -1157,14 +1157,14 @@ struct iwl_scan_cmd { /* * REPLY_SCAN_CMD = 0x80 (response) */ -struct iwl_scanreq_notification { +struct iwl3945_scanreq_notification { __le32 status; /* 1: okay, 2: cannot fulfill request */ } __attribute__ ((packed)); /* * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) */ -struct iwl_scanstart_notification { +struct iwl3945_scanstart_notification { __le32 tsf_low; __le32 tsf_high; __le32 beacon_timer; @@ -1181,7 +1181,7 @@ struct iwl_scanstart_notification { /* * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) */ -struct iwl_scanresults_notification { +struct iwl3945_scanresults_notification { u8 channel; u8 band; u8 reserved[2]; @@ -1193,7 +1193,7 @@ struct iwl_scanresults_notification { /* * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) */ -struct iwl_scancomplete_notification { +struct iwl3945_scancomplete_notification { u8 scanned_channels; u8 status; u8 reserved; @@ -1212,8 +1212,8 @@ struct iwl_scancomplete_notification { /* * BEACON_NOTIFICATION = 0x90 (notification only, not a command) */ -struct iwl_beacon_notif { - struct iwl_tx_resp beacon_notify_hdr; +struct iwl3945_beacon_notif { + struct iwl3945_tx_resp beacon_notify_hdr; __le32 low_tsf; __le32 high_tsf; __le32 ibss_mgr_status; @@ -1222,8 +1222,8 @@ struct iwl_beacon_notif { /* * REPLY_TX_BEACON = 0x91 (command, has simple generic response) */ -struct iwl_tx_beacon_cmd { - struct iwl_tx_cmd tx; +struct iwl3945_tx_beacon_cmd { + struct iwl3945_tx_cmd tx; __le16 tim_idx; u8 tim_size; u8 reserved1; @@ -1345,7 +1345,7 @@ struct statistics_general { */ #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ -struct iwl_statistics_cmd { +struct iwl3945_statistics_cmd { __le32 configuration_flags; /* IWL_STATS_CONF_* */ } __attribute__ ((packed)); @@ -1366,7 +1366,7 @@ struct iwl_statistics_cmd { */ #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) -struct iwl_notif_statistics { +struct iwl3945_notif_statistics { __le32 flag; struct statistics_rx rx; struct statistics_tx tx; @@ -1381,7 +1381,7 @@ struct iwl_notif_statistics { * then this notification will be sent. */ #define CONSECUTIVE_MISSED_BCONS_TH 20 -struct iwl_missed_beacon_notif { +struct iwl3945_missed_beacon_notif { __le32 consequtive_missed_beacons; __le32 total_missed_becons; __le32 num_expected_beacons; @@ -1397,12 +1397,12 @@ struct iwl_missed_beacon_notif { #define PHY_CALIBRATE_DIFF_GAIN_CMD (7) #define HD_TABLE_SIZE (11) -struct iwl_sensitivity_cmd { +struct iwl3945_sensitivity_cmd { __le16 control; __le16 table[HD_TABLE_SIZE]; } __attribute__ ((packed)); -struct iwl_calibration_cmd { +struct iwl3945_calibration_cmd { u8 opCode; u8 flags; __le16 reserved; @@ -1425,7 +1425,7 @@ struct iwl_calibration_cmd { * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), * this command turns it on or off, or sets up a periodic blinking cycle. */ -struct iwl_led_cmd { +struct iwl3945_led_cmd { __le32 interval; /* "interval" in uSec */ u8 id; /* 1: Activity, 2: Link, 3: Tech */ u8 off; /* # intervals off while blinking; @@ -1441,27 +1441,27 @@ struct iwl_led_cmd { * *****************************************************************************/ -struct iwl_rx_packet { +struct iwl3945_rx_packet { __le32 len; - struct iwl_cmd_header hdr; + struct iwl3945_cmd_header hdr; union { - struct iwl_alive_resp alive_frame; - struct iwl_rx_frame rx_frame; - struct iwl_tx_resp tx_resp; - struct iwl_spectrum_notification spectrum_notif; - struct iwl_csa_notification csa_notif; - struct iwl_error_resp err_resp; - struct iwl_card_state_notif card_state_notif; - struct iwl_beacon_notif beacon_status; - struct iwl_add_sta_resp add_sta; - struct iwl_sleep_notification sleep_notif; - struct iwl_spectrum_resp spectrum; - struct iwl_notif_statistics stats; + struct iwl3945_alive_resp alive_frame; + struct iwl3945_rx_frame rx_frame; + struct iwl3945_tx_resp tx_resp; + struct iwl3945_spectrum_notification spectrum_notif; + struct iwl3945_csa_notification csa_notif; + struct iwl3945_error_resp err_resp; + struct iwl3945_card_state_notif card_state_notif; + struct iwl3945_beacon_notif beacon_status; + struct iwl3945_add_sta_resp add_sta; + struct iwl3945_sleep_notification sleep_notif; + struct iwl3945_spectrum_resp spectrum; + struct iwl3945_notif_statistics stats; __le32 status; u8 raw[0]; } u; } __attribute__ ((packed)); -#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame)) +#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame)) -#endif /* __iwl_3945_commands_h__ */ +#endif /* __iwl3945_3945_commands_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h index d0ea83404e0..ebf016877fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h @@ -26,18 +26,18 @@ * *****************************************************************************/ -#ifndef __iwl_debug_h__ -#define __iwl_debug_h__ +#ifndef __iwl3945_debug_h__ +#define __iwl3945_debug_h__ #ifdef CONFIG_IWL3945_DEBUG -extern u32 iwl_debug_level; +extern u32 iwl3945_debug_level; #define IWL_DEBUG(level, fmt, args...) \ -do { if (iwl_debug_level & (level)) \ +do { if (iwl3945_debug_level & (level)) \ printk(KERN_ERR DRV_NAME": %c %s " fmt, \ in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) #define IWL_DEBUG_LIMIT(level, fmt, args...) \ -do { if ((iwl_debug_level & (level)) && net_ratelimit()) \ +do { if ((iwl3945_debug_level & (level)) && net_ratelimit()) \ printk(KERN_ERR DRV_NAME": %c %s " fmt, \ in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) #else @@ -68,7 +68,7 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) * * % cat /proc/net/iwl/debug_level * - * you simply need to add your entry to the iwl_debug_levels array. + * you simply need to add your entry to the iwl3945_debug_levels array. * * If you do not see debug_level in /proc/net/iwl then you do not have * CONFIG_IWL3945_DEBUG defined in your kernel configuration diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h index 71c9a7e32d1..8bbaa16442a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h @@ -133,7 +133,7 @@ enum { #define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7) /* *regulatory* channel data from eeprom, one for each channel */ -struct iwl_eeprom_channel { +struct iwl3945_eeprom_channel { u8 flags; /* flags copied from EEPROM */ s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ } __attribute__ ((packed)); @@ -148,7 +148,7 @@ struct iwl_eeprom_channel { * level. * Data copied from EEPROM. */ -struct iwl_eeprom_txpower_sample { +struct iwl3945_eeprom_txpower_sample { u8 gain_index; /* index into power (gain) setup table ... */ s8 power; /* ... for this pwr level for this chnl group */ u16 v_det; /* PA output voltage */ @@ -162,8 +162,8 @@ struct iwl_eeprom_txpower_sample { * Data copied from EEPROM. * DO NOT ALTER THIS STRUCTURE!!! */ -struct iwl_eeprom_txpower_group { - struct iwl_eeprom_txpower_sample samples[5]; /* 5 power levels */ +struct iwl3945_eeprom_txpower_group { + struct iwl3945_eeprom_txpower_sample samples[5]; /* 5 power levels */ s32 a, b, c, d, e; /* coefficients for voltage->power * formula (signed) */ s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on @@ -181,7 +181,7 @@ struct iwl_eeprom_txpower_group { * difference between current temperature and factory calib temperature. * Data copied from EEPROM. */ -struct iwl_eeprom_temperature_corr { +struct iwl3945_eeprom_temperature_corr { u32 Ta; u32 Tb; u32 Tc; @@ -189,7 +189,7 @@ struct iwl_eeprom_temperature_corr { u32 Te; } __attribute__ ((packed)); -struct iwl_eeprom { +struct iwl3945_eeprom { u8 reserved0[16]; #define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ u16 device_id; /* abs.ofs: 16 */ @@ -232,23 +232,23 @@ struct iwl_eeprom { #define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */ u16 band_1_count; /* abs.ofs: 196 */ #define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */ - struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */ + struct iwl3945_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */ #define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */ u16 band_2_count; /* abs.ofs: 226 */ #define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */ - struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ + struct iwl3945_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ #define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */ u16 band_3_count; /* abs.ofs: 254 */ #define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */ - struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ + struct iwl3945_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ #define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */ u16 band_4_count; /* abs.ofs: 280 */ #define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */ - struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ + struct iwl3945_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ #define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */ u16 band_5_count; /* abs.ofs: 304 */ #define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */ - struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ + struct iwl3945_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ u8 reserved9[194]; @@ -258,10 +258,10 @@ struct iwl_eeprom { #define EEPROM_TXPOWER_CALIB_GROUP3 0x2c0 #define EEPROM_TXPOWER_CALIB_GROUP4 0x300 #define IWL_NUM_TX_CALIB_GROUPS 5 - struct iwl_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS]; + struct iwl3945_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS]; /* abs.ofs: 512 */ #define EEPROM_CALIB_TEMPERATURE_CORRECT 0x340 - struct iwl_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ + struct iwl3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ u8 reserved16[172]; /* fill out to full 1024 byte block */ } __attribute__ ((packed)); @@ -681,8 +681,8 @@ struct iwl_eeprom { #define TFD_TX_CMD_SLOTS 256 #define TFD_CMD_SLOTS 32 -#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ - sizeof(struct iwl_cmd_meta)) +#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \ + sizeof(struct iwl3945_cmd_meta)) /* * RX related structures and functions @@ -704,41 +704,41 @@ struct iwl_eeprom { #define IWL_MAX_DATA_SIZE ALM_RTC_DATA_SIZE #define IWL_MAX_NUM_QUEUES 8 -static inline int iwl_hw_valid_rtc_data_addr(u32 addr) +static inline int iwl3945_hw_valid_rtc_data_addr(u32 addr) { return (addr >= RTC_DATA_LOWER_BOUND) && (addr < ALM_RTC_DATA_UPPER_BOUND); } -/* Base physical address of iwl_shared is provided to FH_TSSR_CBB_BASE - * and &iwl_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */ -struct iwl_shared { +/* Base physical address of iwl3945_shared is provided to FH_TSSR_CBB_BASE + * and &iwl3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */ +struct iwl3945_shared { __le32 tx_base_ptr[8]; __le32 rx_read_ptr[3]; } __attribute__ ((packed)); -struct iwl_tfd_frame_data { +struct iwl3945_tfd_frame_data { __le32 addr; __le32 len; } __attribute__ ((packed)); -struct iwl_tfd_frame { +struct iwl3945_tfd_frame { __le32 control_flags; - struct iwl_tfd_frame_data pa[4]; + struct iwl3945_tfd_frame_data pa[4]; u8 reserved[28]; } __attribute__ ((packed)); -static inline u8 iwl_hw_get_rate(__le16 rate_n_flags) +static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags) { return le16_to_cpu(rate_n_flags) & 0xFF; } -static inline u16 iwl_hw_get_rate_n_flags(__le16 rate_n_flags) +static inline u16 iwl3945_hw_get_rate_n_flags(__le16 rate_n_flags) { return le16_to_cpu(rate_n_flags); } -static inline __le16 iwl_hw_set_rate_n_flags(u8 rate, u16 flags) +static inline __le16 iwl3945_hw_set_rate_n_flags(u8 rate, u16 flags) { return cpu_to_le16((u16)rate|flags); } diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-io.h b/drivers/net/wireless/iwlwifi/iwl-3945-io.h index 74a51798c23..75e20d0a20d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-io.h @@ -26,8 +26,8 @@ * *****************************************************************************/ -#ifndef __iwl_io_h__ -#define __iwl_io_h__ +#ifndef __iwl3945_io_h__ +#define __iwl3945_io_h__ #include @@ -49,8 +49,8 @@ * * If you wish to call the function without any debug or state checking, * you should use the single _ prefix version (as is used by dependent IO - * routines, for example _iwl_read_direct32 calls the non-check version of - * _iwl_read32.) + * routines, for example _iwl3945_read_direct32 calls the non-check version of + * _iwl3945_read32.) * * These declarations are *extremely* useful in quickly isolating code deltas * which result in misconfiguring of the hardware I/O. In combination with @@ -59,39 +59,39 @@ * */ -#define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) +#define _iwl3945_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) #ifdef CONFIG_IWL3945_DEBUG -static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, +static inline void __iwl3945_write32(const char *f, u32 l, struct iwl3945_priv *iwl, u32 ofs, u32 val) { IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); - _iwl_write32(iwl, ofs, val); + _iwl3945_write32(iwl, ofs, val); } -#define iwl_write32(iwl, ofs, val) \ - __iwl_write32(__FILE__, __LINE__, iwl, ofs, val) +#define iwl3945_write32(iwl, ofs, val) \ + __iwl3945_write32(__FILE__, __LINE__, iwl, ofs, val) #else -#define iwl_write32(iwl, ofs, val) _iwl_write32(iwl, ofs, val) +#define iwl3945_write32(iwl, ofs, val) _iwl3945_write32(iwl, ofs, val) #endif -#define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) +#define _iwl3945_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) #ifdef CONFIG_IWL3945_DEBUG -static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs) +static inline u32 __iwl3945_read32(char *f, u32 l, struct iwl3945_priv *iwl, u32 ofs) { IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); - return _iwl_read32(iwl, ofs); + return _iwl3945_read32(iwl, ofs); } -#define iwl_read32(iwl, ofs) __iwl_read32(__FILE__, __LINE__, iwl, ofs) +#define iwl3945_read32(iwl, ofs) __iwl3945_read32(__FILE__, __LINE__, iwl, ofs) #else -#define iwl_read32(p, o) _iwl_read32(p, o) +#define iwl3945_read32(p, o) _iwl3945_read32(p, o) #endif -static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, +static inline int _iwl3945_poll_bit(struct iwl3945_priv *priv, u32 addr, u32 bits, u32 mask, int timeout) { int i = 0; do { - if ((_iwl_read32(priv, addr) & mask) == (bits & mask)) + if ((_iwl3945_read32(priv, addr) & mask) == (bits & mask)) return i; mdelay(10); i += 10; @@ -100,11 +100,11 @@ static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, return -ETIMEDOUT; } #ifdef CONFIG_IWL3945_DEBUG -static inline int __iwl_poll_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 addr, +static inline int __iwl3945_poll_bit(const char *f, u32 l, + struct iwl3945_priv *priv, u32 addr, u32 bits, u32 mask, int timeout) { - int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); + int ret = _iwl3945_poll_bit(priv, addr, bits, mask, timeout); if (unlikely(ret == -ETIMEDOUT)) IWL_DEBUG_IO ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n", @@ -115,47 +115,47 @@ static inline int __iwl_poll_bit(const char *f, u32 l, addr, bits, mask, ret, f, l); return ret; } -#define iwl_poll_bit(iwl, addr, bits, mask, timeout) \ - __iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) +#define iwl3945_poll_bit(iwl, addr, bits, mask, timeout) \ + __iwl3945_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) #else -#define iwl_poll_bit(p, a, b, m, t) _iwl_poll_bit(p, a, b, m, t) +#define iwl3945_poll_bit(p, a, b, m, t) _iwl3945_poll_bit(p, a, b, m, t) #endif -static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) +static inline void _iwl3945_set_bit(struct iwl3945_priv *priv, u32 reg, u32 mask) { - _iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask); + _iwl3945_write32(priv, reg, _iwl3945_read32(priv, reg) | mask); } #ifdef CONFIG_IWL3945_DEBUG -static inline void __iwl_set_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 reg, u32 mask) +static inline void __iwl3945_set_bit(const char *f, u32 l, + struct iwl3945_priv *priv, u32 reg, u32 mask) { - u32 val = _iwl_read32(priv, reg) | mask; + u32 val = _iwl3945_read32(priv, reg) | mask; IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); - _iwl_write32(priv, reg, val); + _iwl3945_write32(priv, reg, val); } -#define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m) +#define iwl3945_set_bit(p, r, m) __iwl3945_set_bit(__FILE__, __LINE__, p, r, m) #else -#define iwl_set_bit(p, r, m) _iwl_set_bit(p, r, m) +#define iwl3945_set_bit(p, r, m) _iwl3945_set_bit(p, r, m) #endif -static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) +static inline void _iwl3945_clear_bit(struct iwl3945_priv *priv, u32 reg, u32 mask) { - _iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask); + _iwl3945_write32(priv, reg, _iwl3945_read32(priv, reg) & ~mask); } #ifdef CONFIG_IWL3945_DEBUG -static inline void __iwl_clear_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 reg, u32 mask) +static inline void __iwl3945_clear_bit(const char *f, u32 l, + struct iwl3945_priv *priv, u32 reg, u32 mask) { - u32 val = _iwl_read32(priv, reg) & ~mask; + u32 val = _iwl3945_read32(priv, reg) & ~mask; IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); - _iwl_write32(priv, reg, val); + _iwl3945_write32(priv, reg, val); } -#define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m) +#define iwl3945_clear_bit(p, r, m) __iwl3945_clear_bit(__FILE__, __LINE__, p, r, m) #else -#define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m) +#define iwl3945_clear_bit(p, r, m) _iwl3945_clear_bit(p, r, m) #endif -static inline int _iwl_grab_nic_access(struct iwl_priv *priv) +static inline int _iwl3945_grab_nic_access(struct iwl3945_priv *priv) { int ret; u32 gp_ctl; @@ -170,7 +170,7 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) "wakes up NIC\n"); /* 10 msec allows time for NIC to complete its data save */ - gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL); + gp_ctl = _iwl3945_read32(priv, CSR_GP_CNTRL); if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { IWL_DEBUG_RF_KILL("Wait for complete power-down, " "gpctl = 0x%08x\n", gp_ctl); @@ -181,8 +181,8 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) } /* this bit wakes up the NIC */ - _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, + _iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); + ret = _iwl3945_poll_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50); @@ -198,106 +198,106 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) } #ifdef CONFIG_IWL3945_DEBUG -static inline int __iwl_grab_nic_access(const char *f, u32 l, - struct iwl_priv *priv) +static inline int __iwl3945_grab_nic_access(const char *f, u32 l, + struct iwl3945_priv *priv) { if (atomic_read(&priv->restrict_refcnt)) IWL_DEBUG_INFO("Grabbing access while already held at " "line %d.\n", l); IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l); - return _iwl_grab_nic_access(priv); + return _iwl3945_grab_nic_access(priv); } -#define iwl_grab_nic_access(priv) \ - __iwl_grab_nic_access(__FILE__, __LINE__, priv) +#define iwl3945_grab_nic_access(priv) \ + __iwl3945_grab_nic_access(__FILE__, __LINE__, priv) #else -#define iwl_grab_nic_access(priv) \ - _iwl_grab_nic_access(priv) +#define iwl3945_grab_nic_access(priv) \ + _iwl3945_grab_nic_access(priv) #endif -static inline void _iwl_release_nic_access(struct iwl_priv *priv) +static inline void _iwl3945_release_nic_access(struct iwl3945_priv *priv) { #ifdef CONFIG_IWL3945_DEBUG if (atomic_dec_and_test(&priv->restrict_refcnt)) #endif - _iwl_clear_bit(priv, CSR_GP_CNTRL, + _iwl3945_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); } #ifdef CONFIG_IWL3945_DEBUG -static inline void __iwl_release_nic_access(const char *f, u32 l, - struct iwl_priv *priv) +static inline void __iwl3945_release_nic_access(const char *f, u32 l, + struct iwl3945_priv *priv) { if (atomic_read(&priv->restrict_refcnt) <= 0) IWL_ERROR("Release unheld nic access at line %d.\n", l); IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l); - _iwl_release_nic_access(priv); + _iwl3945_release_nic_access(priv); } -#define iwl_release_nic_access(priv) \ - __iwl_release_nic_access(__FILE__, __LINE__, priv) +#define iwl3945_release_nic_access(priv) \ + __iwl3945_release_nic_access(__FILE__, __LINE__, priv) #else -#define iwl_release_nic_access(priv) \ - _iwl_release_nic_access(priv) +#define iwl3945_release_nic_access(priv) \ + _iwl3945_release_nic_access(priv) #endif -static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) +static inline u32 _iwl3945_read_direct32(struct iwl3945_priv *priv, u32 reg) { - return _iwl_read32(priv, reg); + return _iwl3945_read32(priv, reg); } #ifdef CONFIG_IWL3945_DEBUG -static inline u32 __iwl_read_direct32(const char *f, u32 l, - struct iwl_priv *priv, u32 reg) +static inline u32 __iwl3945_read_direct32(const char *f, u32 l, + struct iwl3945_priv *priv, u32 reg) { - u32 value = _iwl_read_direct32(priv, reg); + u32 value = _iwl3945_read_direct32(priv, reg); if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access not held from %s %d\n", f, l); IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value, f, l); return value; } -#define iwl_read_direct32(priv, reg) \ - __iwl_read_direct32(__FILE__, __LINE__, priv, reg) +#define iwl3945_read_direct32(priv, reg) \ + __iwl3945_read_direct32(__FILE__, __LINE__, priv, reg) #else -#define iwl_read_direct32 _iwl_read_direct32 +#define iwl3945_read_direct32 _iwl3945_read_direct32 #endif -static inline void _iwl_write_direct32(struct iwl_priv *priv, +static inline void _iwl3945_write_direct32(struct iwl3945_priv *priv, u32 reg, u32 value) { - _iwl_write32(priv, reg, value); + _iwl3945_write32(priv, reg, value); } #ifdef CONFIG_IWL3945_DEBUG -static void __iwl_write_direct32(u32 line, - struct iwl_priv *priv, u32 reg, u32 value) +static void __iwl3945_write_direct32(u32 line, + struct iwl3945_priv *priv, u32 reg, u32 value) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access not held from line %d\n", line); - _iwl_write_direct32(priv, reg, value); + _iwl3945_write_direct32(priv, reg, value); } -#define iwl_write_direct32(priv, reg, value) \ - __iwl_write_direct32(__LINE__, priv, reg, value) +#define iwl3945_write_direct32(priv, reg, value) \ + __iwl3945_write_direct32(__LINE__, priv, reg, value) #else -#define iwl_write_direct32 _iwl_write_direct32 +#define iwl3945_write_direct32 _iwl3945_write_direct32 #endif -static inline void iwl_write_reg_buf(struct iwl_priv *priv, +static inline void iwl3945_write_reg_buf(struct iwl3945_priv *priv, u32 reg, u32 len, u32 *values) { u32 count = sizeof(u32); if ((priv != NULL) && (values != NULL)) { for (; 0 < len; len -= count, reg += count, values++) - _iwl_write_direct32(priv, reg, *values); + _iwl3945_write_direct32(priv, reg, *values); } } -static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, +static inline int _iwl3945_poll_direct_bit(struct iwl3945_priv *priv, u32 addr, u32 mask, int timeout) { int i = 0; do { - if ((_iwl_read_direct32(priv, addr) & mask) == mask) + if ((_iwl3945_read_direct32(priv, addr) & mask) == mask) return i; mdelay(10); i += 10; @@ -307,11 +307,11 @@ static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, } #ifdef CONFIG_IWL3945_DEBUG -static inline int __iwl_poll_direct_bit(const char *f, u32 l, - struct iwl_priv *priv, +static inline int __iwl3945_poll_direct_bit(const char *f, u32 l, + struct iwl3945_priv *priv, u32 addr, u32 mask, int timeout) { - int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout); + int ret = _iwl3945_poll_direct_bit(priv, addr, mask, timeout); if (unlikely(ret == -ETIMEDOUT)) IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - " @@ -321,111 +321,111 @@ static inline int __iwl_poll_direct_bit(const char *f, u32 l, "- %s %d\n", addr, mask, ret, f, l); return ret; } -#define iwl_poll_direct_bit(iwl, addr, mask, timeout) \ - __iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) +#define iwl3945_poll_direct_bit(iwl, addr, mask, timeout) \ + __iwl3945_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) #else -#define iwl_poll_direct_bit _iwl_poll_direct_bit +#define iwl3945_poll_direct_bit _iwl3945_poll_direct_bit #endif -static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) +static inline u32 _iwl3945_read_prph(struct iwl3945_priv *priv, u32 reg) { - _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); - return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); + _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); + return _iwl3945_read_direct32(priv, HBUS_TARG_PRPH_RDAT); } #ifdef CONFIG_IWL3945_DEBUG -static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) +static inline u32 __iwl3945_read_prph(u32 line, struct iwl3945_priv *priv, u32 reg) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access not held from line %d\n", line); - return _iwl_read_prph(priv, reg); + return _iwl3945_read_prph(priv, reg); } -#define iwl_read_prph(priv, reg) \ - __iwl_read_prph(__LINE__, priv, reg) +#define iwl3945_read_prph(priv, reg) \ + __iwl3945_read_prph(__LINE__, priv, reg) #else -#define iwl_read_prph _iwl_read_prph +#define iwl3945_read_prph _iwl3945_read_prph #endif -static inline void _iwl_write_prph(struct iwl_priv *priv, +static inline void _iwl3945_write_prph(struct iwl3945_priv *priv, u32 addr, u32 val) { - _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, + _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WADDR, ((addr & 0x0000FFFF) | (3 << 24))); - _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); + _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); } #ifdef CONFIG_IWL3945_DEBUG -static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, +static inline void __iwl3945_write_prph(u32 line, struct iwl3945_priv *priv, u32 addr, u32 val) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access from line %d\n", line); - _iwl_write_prph(priv, addr, val); + _iwl3945_write_prph(priv, addr, val); } -#define iwl_write_prph(priv, addr, val) \ - __iwl_write_prph(__LINE__, priv, addr, val); +#define iwl3945_write_prph(priv, addr, val) \ + __iwl3945_write_prph(__LINE__, priv, addr, val); #else -#define iwl_write_prph _iwl_write_prph +#define iwl3945_write_prph _iwl3945_write_prph #endif -#define _iwl_set_bits_prph(priv, reg, mask) \ - _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) +#define _iwl3945_set_bits_prph(priv, reg, mask) \ + _iwl3945_write_prph(priv, reg, (_iwl3945_read_prph(priv, reg) | mask)) #ifdef CONFIG_IWL3945_DEBUG -static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, +static inline void __iwl3945_set_bits_prph(u32 line, struct iwl3945_priv *priv, u32 reg, u32 mask) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access not held from line %d\n", line); - _iwl_set_bits_prph(priv, reg, mask); + _iwl3945_set_bits_prph(priv, reg, mask); } -#define iwl_set_bits_prph(priv, reg, mask) \ - __iwl_set_bits_prph(__LINE__, priv, reg, mask) +#define iwl3945_set_bits_prph(priv, reg, mask) \ + __iwl3945_set_bits_prph(__LINE__, priv, reg, mask) #else -#define iwl_set_bits_prph _iwl_set_bits_prph +#define iwl3945_set_bits_prph _iwl3945_set_bits_prph #endif -#define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ - _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) +#define _iwl3945_set_bits_mask_prph(priv, reg, bits, mask) \ + _iwl3945_write_prph(priv, reg, ((_iwl3945_read_prph(priv, reg) & mask) | bits)) #ifdef CONFIG_IWL3945_DEBUG -static inline void __iwl_set_bits_mask_prph(u32 line, - struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) +static inline void __iwl3945_set_bits_mask_prph(u32 line, + struct iwl3945_priv *priv, u32 reg, u32 bits, u32 mask) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access not held from line %d\n", line); - _iwl_set_bits_mask_prph(priv, reg, bits, mask); + _iwl3945_set_bits_mask_prph(priv, reg, bits, mask); } -#define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ - __iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) +#define iwl3945_set_bits_mask_prph(priv, reg, bits, mask) \ + __iwl3945_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) #else -#define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph +#define iwl3945_set_bits_mask_prph _iwl3945_set_bits_mask_prph #endif -static inline void iwl_clear_bits_prph(struct iwl_priv +static inline void iwl3945_clear_bits_prph(struct iwl3945_priv *priv, u32 reg, u32 mask) { - u32 val = _iwl_read_prph(priv, reg); - _iwl_write_prph(priv, reg, (val & ~mask)); + u32 val = _iwl3945_read_prph(priv, reg); + _iwl3945_write_prph(priv, reg, (val & ~mask)); } -static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) +static inline u32 iwl3945_read_targ_mem(struct iwl3945_priv *priv, u32 addr) { - iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); - return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); + iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); + return iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT); } -static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) +static inline void iwl3945_write_targ_mem(struct iwl3945_priv *priv, u32 addr, u32 val) { - iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); - iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); + iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); } -static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, +static inline void iwl3945_write_targ_mem_buf(struct iwl3945_priv *priv, u32 addr, u32 len, u32 *values) { - iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); for (; 0 < len; len -= sizeof(u32), values++) - iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); + iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); } #endif diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index e3a507513e8..3e812743f6a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c @@ -43,7 +43,7 @@ #define RS_NAME "iwl-3945-rs" -struct iwl_rate_scale_data { +struct iwl3945_rate_scale_data { u64 data; s32 success_counter; s32 success_ratio; @@ -52,7 +52,7 @@ struct iwl_rate_scale_data { unsigned long stamp; }; -struct iwl_rate_scale_priv { +struct iwl3945_rate_scale_priv { spinlock_t lock; s32 *expected_tpt; unsigned long last_partial_flush; @@ -65,31 +65,31 @@ struct iwl_rate_scale_priv { u8 start_rate; u8 ibss_sta_added; struct timer_list rate_scale_flush; - struct iwl_rate_scale_data win[IWL_RATE_COUNT]; + struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; }; -static s32 iwl_expected_tpt_g[IWL_RATE_COUNT] = { +static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = { 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 }; -static s32 iwl_expected_tpt_g_prot[IWL_RATE_COUNT] = { +static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT] = { 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 }; -static s32 iwl_expected_tpt_a[IWL_RATE_COUNT] = { +static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT] = { 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 }; -static s32 iwl_expected_tpt_b[IWL_RATE_COUNT] = { +static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT] = { 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 }; -struct iwl_tpt_entry { +struct iwl3945_tpt_entry { s8 min_rssi; u8 index; }; -static struct iwl_tpt_entry iwl_tpt_table_a[] = { +static struct iwl3945_tpt_entry iwl3945_tpt_table_a[] = { {-60, IWL_RATE_54M_INDEX}, {-64, IWL_RATE_48M_INDEX}, {-72, IWL_RATE_36M_INDEX}, @@ -100,7 +100,7 @@ static struct iwl_tpt_entry iwl_tpt_table_a[] = { {-89, IWL_RATE_6M_INDEX} }; -static struct iwl_tpt_entry iwl_tpt_table_b[] = { +static struct iwl3945_tpt_entry iwl3945_tpt_table_b[] = { {-86, IWL_RATE_11M_INDEX}, {-88, IWL_RATE_5M_INDEX}, {-90, IWL_RATE_2M_INDEX}, @@ -108,7 +108,7 @@ static struct iwl_tpt_entry iwl_tpt_table_b[] = { }; -static struct iwl_tpt_entry iwl_tpt_table_g[] = { +static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = { {-60, IWL_RATE_54M_INDEX}, {-64, IWL_RATE_48M_INDEX}, {-68, IWL_RATE_36M_INDEX}, @@ -129,30 +129,30 @@ static struct iwl_tpt_entry iwl_tpt_table_g[] = { #define IWL_RATE_MIN_SUCCESS_TH 8 #define IWL_RATE_DECREASE_TH 1920 -static u8 iwl_get_rate_index_by_rssi(s32 rssi, u8 mode) +static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, u8 mode) { u32 index = 0; u32 table_size = 0; - struct iwl_tpt_entry *tpt_table = NULL; + struct iwl3945_tpt_entry *tpt_table = NULL; if ((rssi < IWL_MIN_RSSI_VAL) || (rssi > IWL_MAX_RSSI_VAL)) rssi = IWL_MIN_RSSI_VAL; switch (mode) { case MODE_IEEE80211G: - tpt_table = iwl_tpt_table_g; - table_size = ARRAY_SIZE(iwl_tpt_table_g); + tpt_table = iwl3945_tpt_table_g; + table_size = ARRAY_SIZE(iwl3945_tpt_table_g); break; case MODE_IEEE80211A: - tpt_table = iwl_tpt_table_a; - table_size = ARRAY_SIZE(iwl_tpt_table_a); + tpt_table = iwl3945_tpt_table_a; + table_size = ARRAY_SIZE(iwl3945_tpt_table_a); break; default: case MODE_IEEE80211B: - tpt_table = iwl_tpt_table_b; - table_size = ARRAY_SIZE(iwl_tpt_table_b); + tpt_table = iwl3945_tpt_table_b; + table_size = ARRAY_SIZE(iwl3945_tpt_table_b); break; } @@ -164,7 +164,7 @@ static u8 iwl_get_rate_index_by_rssi(s32 rssi, u8 mode) return tpt_table[index].index; } -static void iwl_clear_window(struct iwl_rate_scale_data *window) +static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window) { window->data = 0; window->success_counter = 0; @@ -175,13 +175,13 @@ static void iwl_clear_window(struct iwl_rate_scale_data *window) } /** - * iwl_rate_scale_flush_windows - flush out the rate scale windows + * iwl3945_rate_scale_flush_windows - flush out the rate scale windows * * Returns the number of windows that have gathered data but were * not flushed. If there were any that were not flushed, then * reschedule the rate flushing routine. */ -static int iwl_rate_scale_flush_windows(struct iwl_rate_scale_priv *rs_priv) +static int iwl3945_rate_scale_flush_windows(struct iwl3945_rate_scale_priv *rs_priv) { int unflushed = 0; int i; @@ -202,7 +202,7 @@ static int iwl_rate_scale_flush_windows(struct iwl_rate_scale_priv *rs_priv) IWL_DEBUG_RATE("flushing %d samples of rate " "index %d\n", rs_priv->win[i].counter, i); - iwl_clear_window(&rs_priv->win[i]); + iwl3945_clear_window(&rs_priv->win[i]); } else unflushed++; spin_unlock_irqrestore(&rs_priv->lock, flags); @@ -214,16 +214,16 @@ static int iwl_rate_scale_flush_windows(struct iwl_rate_scale_priv *rs_priv) #define IWL_RATE_FLUSH_MAX 5000 /* msec */ #define IWL_RATE_FLUSH_MIN 50 /* msec */ -static void iwl_bg_rate_scale_flush(unsigned long data) +static void iwl3945_bg_rate_scale_flush(unsigned long data) { - struct iwl_rate_scale_priv *rs_priv = (void *)data; + struct iwl3945_rate_scale_priv *rs_priv = (void *)data; int unflushed = 0; unsigned long flags; u32 packet_count, duration, pps; IWL_DEBUG_RATE("enter\n"); - unflushed = iwl_rate_scale_flush_windows(rs_priv); + unflushed = iwl3945_rate_scale_flush_windows(rs_priv); spin_lock_irqsave(&rs_priv->lock, flags); @@ -277,14 +277,14 @@ static void iwl_bg_rate_scale_flush(unsigned long data) } /** - * iwl_collect_tx_data - Update the success/failure sliding window + * iwl3945_collect_tx_data - Update the success/failure sliding window * * We keep a sliding window of the last 64 packets transmitted * at this rate. window->data contains the bitmask of successful * packets. */ -static void iwl_collect_tx_data(struct iwl_rate_scale_priv *rs_priv, - struct iwl_rate_scale_data *window, +static void iwl3945_collect_tx_data(struct iwl3945_rate_scale_priv *rs_priv, + struct iwl3945_rate_scale_data *window, int success, int retries) { unsigned long flags; @@ -373,12 +373,12 @@ static void rs_clear(void *priv) static void *rs_alloc_sta(void *priv, gfp_t gfp) { - struct iwl_rate_scale_priv *rs_priv; + struct iwl3945_rate_scale_priv *rs_priv; int i; IWL_DEBUG_RATE("enter\n"); - rs_priv = kzalloc(sizeof(struct iwl_rate_scale_priv), gfp); + rs_priv = kzalloc(sizeof(struct iwl3945_rate_scale_priv), gfp); if (!rs_priv) { IWL_DEBUG_RATE("leave: ENOMEM\n"); return NULL; @@ -389,7 +389,7 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp) rs_priv->start_rate = IWL_RATE_INVALID; /* default to just 802.11b */ - rs_priv->expected_tpt = iwl_expected_tpt_b; + rs_priv->expected_tpt = iwl3945_expected_tpt_b; rs_priv->last_partial_flush = jiffies; rs_priv->last_flush = jiffies; @@ -399,10 +399,10 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp) init_timer(&rs_priv->rate_scale_flush); rs_priv->rate_scale_flush.data = (unsigned long)rs_priv; - rs_priv->rate_scale_flush.function = &iwl_bg_rate_scale_flush; + rs_priv->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush; for (i = 0; i < IWL_RATE_COUNT; i++) - iwl_clear_window(&rs_priv->win[i]); + iwl3945_clear_window(&rs_priv->win[i]); IWL_DEBUG_RATE("leave\n"); @@ -411,7 +411,7 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp) static void rs_free_sta(void *priv, void *priv_sta) { - struct iwl_rate_scale_priv *rs_priv = priv_sta; + struct iwl3945_rate_scale_priv *rs_priv = priv_sta; IWL_DEBUG_RATE("enter\n"); del_timer_sync(&rs_priv->rate_scale_flush); @@ -425,9 +425,9 @@ static void rs_free_sta(void *priv, void *priv_sta) * for A and B mode we need to overright prev * value */ -static int rs_adjust_next_rate(struct iwl_priv *priv, int rate) +static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate) { - int next_rate = iwl_get_prev_ieee_rate(rate); + int next_rate = iwl3945_get_prev_ieee_rate(rate); switch (priv->phymode) { case MODE_IEEE80211A: @@ -449,7 +449,7 @@ static int rs_adjust_next_rate(struct iwl_priv *priv, int rate) /** * rs_tx_status - Update rate control values based on Tx results * - * NOTE: Uses iwl_priv->retry_rate for the # of retries attempted by + * NOTE: Uses iwl3945_priv->retry_rate for the # of retries attempted by * the hardware for each rate. */ static void rs_tx_status(void *priv_rate, @@ -462,9 +462,9 @@ static void rs_tx_status(void *priv_rate, unsigned long flags; struct sta_info *sta; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct iwl_priv *priv = (struct iwl_priv *)priv_rate; + struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); - struct iwl_rate_scale_priv *rs_priv; + struct iwl3945_rate_scale_priv *rs_priv; IWL_DEBUG_RATE("enter\n"); @@ -514,7 +514,7 @@ static void rs_tx_status(void *priv_rate, /* Update this rate accounting for as many retries * as was used for it (per current_count) */ - iwl_collect_tx_data(rs_priv, + iwl3945_collect_tx_data(rs_priv, &rs_priv->win[scale_rate_index], 0, current_count); IWL_DEBUG_RATE("Update rate %d for %d retries.\n", @@ -533,7 +533,7 @@ static void rs_tx_status(void *priv_rate, last_index, (tx_resp->flags & IEEE80211_TX_STATUS_ACK) ? "success" : "failure"); - iwl_collect_tx_data(rs_priv, + iwl3945_collect_tx_data(rs_priv, &rs_priv->win[last_index], tx_resp->flags & IEEE80211_TX_STATUS_ACK, 1); @@ -560,8 +560,8 @@ static void rs_tx_status(void *priv_rate, return; } -static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv, - u8 index, u16 rate_mask, int phymode) +static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv, + u8 index, u16 rate_mask, int phymode) { u8 high = IWL_RATE_INVALID; u8 low = IWL_RATE_INVALID; @@ -596,9 +596,9 @@ static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv, low = index; while (low != IWL_RATE_INVALID) { if (rs_priv->tgg) - low = iwl_rates[low].prev_rs_tgg; + low = iwl3945_rates[low].prev_rs_tgg; else - low = iwl_rates[low].prev_rs; + low = iwl3945_rates[low].prev_rs; if (low == IWL_RATE_INVALID) break; if (rate_mask & (1 << low)) @@ -609,9 +609,9 @@ static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv, high = index; while (high != IWL_RATE_INVALID) { if (rs_priv->tgg) - high = iwl_rates[high].next_rs_tgg; + high = iwl3945_rates[high].next_rs_tgg; else - high = iwl_rates[high].next_rs; + high = iwl3945_rates[high].next_rs; if (high == IWL_RATE_INVALID) break; if (rate_mask & (1 << high)) @@ -646,8 +646,8 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, u8 high = IWL_RATE_INVALID; u16 high_low; int index; - struct iwl_rate_scale_priv *rs_priv; - struct iwl_rate_scale_data *window = NULL; + struct iwl3945_rate_scale_priv *rs_priv; + struct iwl3945_rate_scale_data *window = NULL; int current_tpt = IWL_INVALID_VALUE; int low_tpt = IWL_INVALID_VALUE; int high_tpt = IWL_INVALID_VALUE; @@ -658,7 +658,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct sta_info *sta; u16 rate_mask; - struct iwl_priv *priv = (struct iwl_priv *)priv_rate; + struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; DECLARE_MAC_BUF(mac); IWL_DEBUG_RATE("enter\n"); @@ -682,12 +682,12 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && !rs_priv->ibss_sta_added) { - u8 sta_id = iwl_hw_find_station(priv, hdr->addr1); + u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); if (sta_id == IWL_INVALID_STATION) { IWL_DEBUG_RATE("LQ: ADD station %s\n", print_mac(mac, hdr->addr1)); - sta_id = iwl_add_station(priv, + sta_id = iwl3945_add_station(priv, hdr->addr1, 0, CMD_ASYNC); } if (sta_id != IWL_INVALID_STATION) @@ -725,7 +725,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, rs_priv->expected_tpt[index] + 64) / 128); current_tpt = window->average_tpt; - high_low = iwl_get_adjacent_rate(rs_priv, index, rate_mask, + high_low = iwl3945_get_adjacent_rate(rs_priv, index, rate_mask, local->hw.conf.phymode); low = high_low & 0xff; high = (high_low >> 8) & 0xff; @@ -830,11 +830,11 @@ static struct rate_control_ops rs_ops = { .free_sta = rs_free_sta, }; -int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) +int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) { struct ieee80211_local *local = hw_to_local(hw); - struct iwl_priv *priv = hw->priv; - struct iwl_rate_scale_priv *rs_priv; + struct iwl3945_priv *priv = hw->priv; + struct iwl3945_rate_scale_priv *rs_priv; struct sta_info *sta; unsigned long flags; int count = 0, i; @@ -860,7 +860,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) int j; count += - sprintf(&buf[count], " %2dMbs: ", iwl_rates[i].ieee / 2); + sprintf(&buf[count], " %2dMbs: ", iwl3945_rates[i].ieee / 2); mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) @@ -869,7 +869,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) samples += rs_priv->win[i].counter; good += rs_priv->win[i].success_counter; - success += rs_priv->win[i].success_counter * iwl_rates[i].ieee; + success += rs_priv->win[i].success_counter * iwl3945_rates[i].ieee; if (rs_priv->win[i].stamp) { int delta = @@ -882,7 +882,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) } else buf[count++] = '\n'; - j = iwl_get_prev_ieee_rate(i); + j = iwl3945_get_prev_ieee_rate(i); if (j == i) break; i = j; @@ -893,7 +893,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) /* Display the average rate of all samples taken. * * NOTE: We multiple # of samples by 2 since the IEEE measurement - * added from iwl_rates is actually 2X the rate */ + * added from iwl3945_rates is actually 2X the rate */ if (samples) count += sprintf( &buf[count], @@ -907,13 +907,13 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) return count; } -void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) +void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; s32 rssi = 0; unsigned long flags; struct ieee80211_local *local = hw_to_local(hw); - struct iwl_rate_scale_priv *rs_priv; + struct iwl3945_rate_scale_priv *rs_priv; struct sta_info *sta; IWL_DEBUG_RATE("enter\n"); @@ -942,19 +942,19 @@ void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) case MODE_IEEE80211G: if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { rs_priv->tgg = 1; - rs_priv->expected_tpt = iwl_expected_tpt_g_prot; + rs_priv->expected_tpt = iwl3945_expected_tpt_g_prot; } else - rs_priv->expected_tpt = iwl_expected_tpt_g; + rs_priv->expected_tpt = iwl3945_expected_tpt_g; break; case MODE_IEEE80211A: - rs_priv->expected_tpt = iwl_expected_tpt_a; + rs_priv->expected_tpt = iwl3945_expected_tpt_a; break; default: IWL_WARNING("Invalid phymode. Defaulting to 802.11b\n"); case MODE_IEEE80211B: - rs_priv->expected_tpt = iwl_expected_tpt_b; + rs_priv->expected_tpt = iwl3945_expected_tpt_b; break; } @@ -967,19 +967,19 @@ void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi); - rs_priv->start_rate = iwl_get_rate_index_by_rssi(rssi, priv->phymode); + rs_priv->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->phymode); IWL_DEBUG_RATE("leave: rssi %d assign rate index: " "%d (plcp 0x%x)\n", rssi, rs_priv->start_rate, - iwl_rates[rs_priv->start_rate].plcp); + iwl3945_rates[rs_priv->start_rate].plcp); } -void iwl_rate_control_register(struct ieee80211_hw *hw) +void iwl3945_rate_control_register(struct ieee80211_hw *hw) { ieee80211_rate_control_register(&rs_ops); } -void iwl_rate_control_unregister(struct ieee80211_hw *hw) +void iwl3945_rate_control_unregister(struct ieee80211_hw *hw) { ieee80211_rate_control_unregister(&rs_ops); } diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h index 4f21bc73fc3..075f7de0976 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h @@ -27,7 +27,7 @@ #ifndef __iwl_3945_rs_h__ #define __iwl_3945_rs_h__ -struct iwl_rate_info { +struct iwl3945_rate_info { u8 plcp; u8 ieee; u8 prev_ieee; /* previous rate in IEEE speeds */ @@ -159,11 +159,11 @@ enum { #define IWL_MIN_RSSI_VAL -100 #define IWL_MAX_RSSI_VAL 0 -extern const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT]; +extern const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT]; -static inline u8 iwl_get_prev_ieee_rate(u8 rate_index) +static inline u8 iwl3945_get_prev_ieee_rate(u8 rate_index) { - u8 rate = iwl_rates[rate_index].prev_ieee; + u8 rate = iwl3945_rates[rate_index].prev_ieee; if (rate == IWL_RATE_INVALID) rate = rate_index; @@ -171,40 +171,40 @@ static inline u8 iwl_get_prev_ieee_rate(u8 rate_index) } /** - * iwl_fill_rs_info - Fill an output text buffer with the rate representation + * iwl3945_fill_rs_info - Fill an output text buffer with the rate representation * * NOTE: This is provided as a quick mechanism for a user to visualize * the performance of the rate control algorithm and is not meant to be * parsed software. */ -extern int iwl_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); +extern int iwl3945_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); /** - * iwl_rate_scale_init - Initialize the rate scale table based on assoc info + * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info * * The specific throughput table used is based on the type of network * the associated with, including A, B, G, and G w/ TGG protection */ -extern void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); +extern void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); /** - * iwl_rate_control_register - Register the rate control algorithm callbacks + * iwl3945_rate_control_register - Register the rate control algorithm callbacks * * Since the rate control algorithm is hardware specific, there is no need * or reason to place it as a stand alone module. The driver can call - * iwl_rate_control_register in order to register the rate control callbacks + * iwl3945_rate_control_register in order to register the rate control callbacks * with the mac80211 subsystem. This should be performed prior to calling * ieee80211_register_hw * */ -extern void iwl_rate_control_register(struct ieee80211_hw *hw); +extern void iwl3945_rate_control_register(struct ieee80211_hw *hw); /** - * iwl_rate_control_unregister - Unregister the rate control callbacks + * iwl3945_rate_control_unregister - Unregister the rate control callbacks * * This should be called after calling ieee80211_unregister_hw, but before * the driver is unloaded. */ -extern void iwl_rate_control_unregister(struct ieee80211_hw *hw); +extern void iwl3945_rate_control_unregister(struct ieee80211_hw *hw); #endif diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 36867a18d5b..953a9bec063 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -63,7 +63,7 @@ * maps to IWL_RATE_INVALID * */ -const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { +const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT] = { IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ @@ -78,12 +78,12 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */ }; -/* 1 = enable the iwl_disable_events() function */ +/* 1 = enable the iwl3945_disable_events() function */ #define IWL_EVT_DISABLE (0) #define IWL_EVT_DISABLE_SIZE (1532/32) /** - * iwl_disable_events - Disable selected events in uCode event log + * iwl3945_disable_events - Disable selected events in uCode event log * * Disable an event by writing "1"s into "disable" * bitmap in SRAM. Bit position corresponds to Event # (id/type). @@ -91,7 +91,7 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { * Use for only special debugging. This function is just a placeholder as-is, * you'll need to provide the special bits! ... * ... and set IWL_EVT_DISABLE to 1. */ -void iwl_disable_events(struct iwl_priv *priv) +void iwl3945_disable_events(struct iwl3945_priv *priv) { int ret; int i; @@ -149,31 +149,31 @@ void iwl_disable_events(struct iwl_priv *priv) }; base = le32_to_cpu(priv->card_alive.log_event_table_ptr); - if (!iwl_hw_valid_rtc_data_addr(base)) { + if (!iwl3945_hw_valid_rtc_data_addr(base)) { IWL_ERROR("Invalid event log pointer 0x%08X\n", base); return; } - ret = iwl_grab_nic_access(priv); + ret = iwl3945_grab_nic_access(priv); if (ret) { IWL_WARNING("Can not read from adapter at this time.\n"); return; } - disable_ptr = iwl_read_targ_mem(priv, base + (4 * sizeof(u32))); - array_size = iwl_read_targ_mem(priv, base + (5 * sizeof(u32))); - iwl_release_nic_access(priv); + disable_ptr = iwl3945_read_targ_mem(priv, base + (4 * sizeof(u32))); + array_size = iwl3945_read_targ_mem(priv, base + (5 * sizeof(u32))); + iwl3945_release_nic_access(priv); if (IWL_EVT_DISABLE && (array_size == IWL_EVT_DISABLE_SIZE)) { IWL_DEBUG_INFO("Disabling selected uCode log events at 0x%x\n", disable_ptr); - ret = iwl_grab_nic_access(priv); + ret = iwl3945_grab_nic_access(priv); for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++) - iwl_write_targ_mem(priv, + iwl3945_write_targ_mem(priv, disable_ptr + (i * sizeof(u32)), evt_disable[i]); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); } else { IWL_DEBUG_INFO("Selected uCode log events may be disabled\n"); IWL_DEBUG_INFO(" by writing \"1\"s into disable bitmap\n"); @@ -194,7 +194,7 @@ void iwl_disable_events(struct iwl_priv *priv) * IWL_ANTENNA_MAIN - Force MAIN antenna * IWL_ANTENNA_AUX - Force AUX antenna */ -__le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv) +__le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv) { switch (priv->antenna) { case IWL_ANTENNA_DIVERSITY: @@ -226,11 +226,11 @@ __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv) * *****************************************************************************/ -void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) +void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; IWL_DEBUG_RX("Statistics notification received (%d vs %d).\n", - (int)sizeof(struct iwl_notif_statistics), + (int)sizeof(struct iwl3945_notif_statistics), le32_to_cpu(pkt->len)); memcpy(&priv->statistics, pkt->u.raw, sizeof(priv->statistics)); @@ -238,15 +238,15 @@ void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) priv->last_statistics_time = jiffies; } -static void iwl3945_handle_data_packet(struct iwl_priv *priv, int is_data, - struct iwl_rx_mem_buffer *rxb, +static void iwl3945_handle_data_packet(struct iwl3945_priv *priv, int is_data, + struct iwl3945_rx_mem_buffer *rxb, struct ieee80211_rx_status *stats, u16 phy_flags) { struct ieee80211_hdr *hdr; - struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; - struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); - struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt); + struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data; + struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); + struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); short len = le16_to_cpu(rx_hdr->len); /* We received data from the HW, so stop the watchdog */ @@ -262,11 +262,11 @@ static void iwl3945_handle_data_packet(struct iwl_priv *priv, int is_data, return; } if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { - if (iwl_param_hwcrypto) - iwl_set_decrypted_flag(priv, rxb->skb, + if (iwl3945_param_hwcrypto) + iwl3945_set_decrypted_flag(priv, rxb->skb, le32_to_cpu(rx_end->status), stats); - iwl_handle_data_packet_monitor(priv, rxb, IWL_RX_DATA(pkt), + iwl3945_handle_data_packet_monitor(priv, rxb, IWL_RX_DATA(pkt), len, stats, phy_flags); return; } @@ -277,21 +277,21 @@ static void iwl3945_handle_data_packet(struct iwl_priv *priv, int is_data, hdr = (void *)rxb->skb->data; - if (iwl_param_hwcrypto) - iwl_set_decrypted_flag(priv, rxb->skb, + if (iwl3945_param_hwcrypto) + iwl3945_set_decrypted_flag(priv, rxb->skb, le32_to_cpu(rx_end->status), stats); ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); rxb->skb = NULL; } -static void iwl3945_rx_reply_rx(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); - struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); - struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt); + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); + struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); + struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); struct ieee80211_hdr *header; u16 phy_flags = le16_to_cpu(rx_hdr->phy_flags); u16 rx_stats_sig_avg = le16_to_cpu(rx_stats->sig_avg); @@ -347,14 +347,14 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, * Calculate stats.signal (quality indicator in %) based on SNR. */ if (rx_stats_noise_diff) { snr = rx_stats_sig_avg / rx_stats_noise_diff; - stats.noise = stats.ssi - iwl_calc_db_from_ratio(snr); - stats.signal = iwl_calc_sig_qual(stats.ssi, stats.noise); + stats.noise = stats.ssi - iwl3945_calc_db_from_ratio(snr); + stats.signal = iwl3945_calc_sig_qual(stats.ssi, stats.noise); /* If noise info not available, calculate signal quality indicator (%) * using just the dBm signal level. */ } else { stats.noise = priv->last_rx_noise; - stats.signal = iwl_calc_sig_qual(stats.ssi, 0); + stats.signal = iwl3945_calc_sig_qual(stats.ssi, 0); } @@ -364,24 +364,24 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, stats.freq = ieee80211chan2mhz(stats.channel); - /* can be covered by iwl_report_frame() in most cases */ + /* can be covered by iwl3945_report_frame() in most cases */ /* IWL_DEBUG_RX("RX status: 0x%08X\n", rx_end->status); */ header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); - network_packet = iwl_is_network_packet(priv, header); + network_packet = iwl3945_is_network_packet(priv, header); #ifdef CONFIG_IWL3945_DEBUG - if (iwl_debug_level & IWL_DL_STATS && net_ratelimit()) + if (iwl3945_debug_level & IWL_DL_STATS && net_ratelimit()) IWL_DEBUG_STATS ("[%c] %d RSSI: %d Signal: %u, Noise: %u, Rate: %u\n", network_packet ? '*' : ' ', stats.channel, stats.ssi, stats.ssi, stats.ssi, stats.rate); - if (iwl_debug_level & (IWL_DL_RX)) + if (iwl3945_debug_level & (IWL_DL_RX)) /* Set "1" to report good data frames in groups of 100 */ - iwl_report_frame(priv, pkt, header, 1); + iwl3945_report_frame(priv, pkt, header, 1); #endif if (network_packet) { @@ -481,7 +481,7 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, DECLARE_MAC_BUF(mac2); DECLARE_MAC_BUF(mac3); - if (unlikely(is_duplicate_packet(priv, header))) + if (unlikely(iwl3945_is_duplicate_packet(priv, header))) IWL_DEBUG_DROP("Dropping (dup): %s, %s, %s\n", print_mac(mac1, header->addr1), print_mac(mac2, header->addr2), @@ -494,12 +494,12 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, } } -int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, +int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *ptr, dma_addr_t addr, u16 len) { int count; u32 pad; - struct iwl_tfd_frame *tfd = (struct iwl_tfd_frame *)ptr; + struct iwl3945_tfd_frame *tfd = (struct iwl3945_tfd_frame *)ptr; count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); pad = TFD_CTL_PAD_GET(le32_to_cpu(tfd->control_flags)); @@ -522,14 +522,14 @@ int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, } /** - * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] + * iwl3945_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] * * Does NOT advance any indexes */ -int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) +int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq) { - struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; - struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; + struct iwl3945_tfd_frame *bd_tmp = (struct iwl3945_tfd_frame *)&txq->bd[0]; + struct iwl3945_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; struct pci_dev *dev = priv->pci_dev; int i; int counter; @@ -564,7 +564,7 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) return 0; } -u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr) +u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr) { int i; int ret = IWL_INVALID_STATION; @@ -588,11 +588,11 @@ u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr) } /** - * iwl_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: + * iwl3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: * */ -void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, - struct iwl_cmd *cmd, +void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, + struct iwl3945_cmd *cmd, struct ieee80211_tx_control *ctrl, struct ieee80211_hdr *hdr, int sta_id, int tx_id) { @@ -605,7 +605,7 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, __le32 tx_flags; u16 fc = le16_to_cpu(hdr->frame_control); - rate = iwl_rates[rate_index].plcp; + rate = iwl3945_rates[rate_index].plcp; tx_flags = cmd->cmd.tx.tx_flags; /* We need to figure out how to get the sta->supp_rates while @@ -672,10 +672,10 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, cmd->cmd.tx.supp_rates[1], cmd->cmd.tx.supp_rates[0]); } -u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) +u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id, u16 tx_rate, u8 flags) { unsigned long flags_spin; - struct iwl_station_entry *station; + struct iwl3945_station_entry *station; if (sta_id == IWL_INVALID_STATION) return IWL_INVALID_STATION; @@ -690,19 +690,19 @@ u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) spin_unlock_irqrestore(&priv->sta_lock, flags_spin); - iwl_send_add_station(priv, &station->sta, flags); + iwl3945_send_add_station(priv, &station->sta, flags); IWL_DEBUG_RATE("SCALE sync station %d to rate %d\n", sta_id, tx_rate); return sta_id; } -static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) +static int iwl3945_nic_set_pwr_src(struct iwl3945_priv *priv, int pwr_max) { int rc; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -714,23 +714,23 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) rc = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, &val); if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) { - iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, + iwl3945_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VAUX, ~APMG_PS_CTRL_MSK_PWR_SRC); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); - iwl_poll_bit(priv, CSR_GPIO_IN, + iwl3945_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VAUX_PWR_SRC, CSR_GPIO_IN_BIT_AUX_POWER, 5000); } else - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); } else { - iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, + iwl3945_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, ~APMG_PS_CTRL_MSK_PWR_SRC); - iwl_release_nic_access(priv); - iwl_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, + iwl3945_release_nic_access(priv); + iwl3945_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */ } spin_unlock_irqrestore(&priv->lock, flags); @@ -738,24 +738,24 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) return rc; } -static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +static int iwl3945_rx_init(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq) { int rc; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_direct32(priv, FH_RCSR_RBD_BASE(0), rxq->dma_addr); - iwl_write_direct32(priv, FH_RCSR_RPTR_ADDR(0), + iwl3945_write_direct32(priv, FH_RCSR_RBD_BASE(0), rxq->dma_addr); + iwl3945_write_direct32(priv, FH_RCSR_RPTR_ADDR(0), priv->hw_setting.shared_phys + - offsetof(struct iwl_shared, rx_read_ptr[0])); - iwl_write_direct32(priv, FH_RCSR_WPTR(0), 0); - iwl_write_direct32(priv, FH_RCSR_CONFIG(0), + offsetof(struct iwl3945_shared, rx_read_ptr[0])); + iwl3945_write_direct32(priv, FH_RCSR_WPTR(0), 0); + iwl3945_write_direct32(priv, FH_RCSR_CONFIG(0), ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE | ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE | ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN | @@ -766,44 +766,44 @@ static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH); /* fake read to flush all prev I/O */ - iwl_read_direct32(priv, FH_RSSR_CTRL); + iwl3945_read_direct32(priv, FH_RSSR_CTRL); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; } -static int iwl3945_tx_reset(struct iwl_priv *priv) +static int iwl3945_tx_reset(struct iwl3945_priv *priv) { int rc; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } /* bypass mode */ - iwl_write_prph(priv, ALM_SCD_MODE_REG, 0x2); + iwl3945_write_prph(priv, ALM_SCD_MODE_REG, 0x2); /* RA 0 is active */ - iwl_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01); + iwl3945_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01); /* all 6 fifo are active */ - iwl_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f); + iwl3945_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f); - iwl_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000); - iwl_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002); - iwl_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004); - iwl_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); + iwl3945_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000); + iwl3945_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002); + iwl3945_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004); + iwl3945_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); - iwl_write_direct32(priv, FH_TSSR_CBB_BASE, + iwl3945_write_direct32(priv, FH_TSSR_CBB_BASE, priv->hw_setting.shared_phys); - iwl_write_direct32(priv, FH_TSSR_MSG_CONFIG, + iwl3945_write_direct32(priv, FH_TSSR_MSG_CONFIG, ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON | ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B | @@ -812,7 +812,7 @@ static int iwl3945_tx_reset(struct iwl_priv *priv) ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH | ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -823,12 +823,12 @@ static int iwl3945_tx_reset(struct iwl_priv *priv) * * Destroys all DMA structures and initialize them again */ -static int iwl3945_txq_ctx_reset(struct iwl_priv *priv) +static int iwl3945_txq_ctx_reset(struct iwl3945_priv *priv) { int rc; int txq_id, slots_num; - iwl_hw_txq_ctx_free(priv); + iwl3945_hw_txq_ctx_free(priv); /* Tx CMD queue */ rc = iwl3945_tx_reset(priv); @@ -839,7 +839,7 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv) for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) { slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; - rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num, + rc = iwl3945_tx_queue_init(priv, &priv->txq[txq_id], slots_num, txq_id); if (rc) { IWL_ERROR("Tx %d queue init failed\n", txq_id); @@ -850,26 +850,26 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv) return rc; error: - iwl_hw_txq_ctx_free(priv); + iwl3945_hw_txq_ctx_free(priv); return rc; } -int iwl_hw_nic_init(struct iwl_priv *priv) +int iwl3945_hw_nic_init(struct iwl3945_priv *priv) { u8 rev_id; int rc; unsigned long flags; - struct iwl_rx_queue *rxq = &priv->rxq; + struct iwl3945_rx_queue *rxq = &priv->rxq; - iwl_power_init_handle(priv); + iwl3945_power_init_handle(priv); spin_lock_irqsave(&priv->lock, flags); - iwl_set_bit(priv, CSR_ANA_PLL_CFG, (1 << 24)); - iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS, + iwl3945_set_bit(priv, CSR_ANA_PLL_CFG, (1 << 24)); + iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS, CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); - iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); - rc = iwl_poll_bit(priv, CSR_GP_CNTRL, + iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); + rc = iwl3945_poll_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); if (rc < 0) { @@ -878,18 +878,18 @@ int iwl_hw_nic_init(struct iwl_priv *priv) return rc; } - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_prph(priv, APMG_CLK_EN_REG, + iwl3945_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); udelay(20); - iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, + iwl3945_set_bits_prph(priv, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); /* Determine HW type */ @@ -905,25 +905,25 @@ int iwl_hw_nic_init(struct iwl_priv *priv) IWL_DEBUG_INFO("RTP type \n"); else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) { IWL_DEBUG_INFO("ALM-MB type\n"); - iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, + iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB); } else { IWL_DEBUG_INFO("ALM-MM type\n"); - iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, + iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM); } spin_unlock_irqrestore(&priv->lock, flags); /* Initialize the EEPROM */ - rc = iwl_eeprom_init(priv); + rc = iwl3945_eeprom_init(priv); if (rc) return rc; spin_lock_irqsave(&priv->lock, flags); if (EEPROM_SKU_CAP_OP_MODE_MRC == priv->eeprom.sku_cap) { IWL_DEBUG_INFO("SKU OP mode is mrc\n"); - iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, + iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC); } else IWL_DEBUG_INFO("SKU OP mode is basic\n"); @@ -931,24 +931,24 @@ int iwl_hw_nic_init(struct iwl_priv *priv) if ((priv->eeprom.board_revision & 0xF0) == 0xD0) { IWL_DEBUG_INFO("3945ABG revision is 0x%X\n", priv->eeprom.board_revision); - iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, + iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); } else { IWL_DEBUG_INFO("3945ABG revision is 0x%X\n", priv->eeprom.board_revision); - iwl_clear_bit(priv, CSR_HW_IF_CONFIG_REG, + iwl3945_clear_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); } if (priv->eeprom.almgor_m_version <= 1) { - iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, + iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A); IWL_DEBUG_INFO("Card M type A version is 0x%X\n", priv->eeprom.almgor_m_version); } else { IWL_DEBUG_INFO("Card M type B version is 0x%X\n", priv->eeprom.almgor_m_version); - iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, + iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B); } spin_unlock_irqrestore(&priv->lock, flags); @@ -961,15 +961,15 @@ int iwl_hw_nic_init(struct iwl_priv *priv) /* Allocate the RX queue, or reset if it is already allocated */ if (!rxq->bd) { - rc = iwl_rx_queue_alloc(priv); + rc = iwl3945_rx_queue_alloc(priv); if (rc) { IWL_ERROR("Unable to initialize Rx queue\n"); return -ENOMEM; } } else - iwl_rx_queue_reset(priv, rxq); + iwl3945_rx_queue_reset(priv, rxq); - iwl_rx_replenish(priv); + iwl3945_rx_replenish(priv); iwl3945_rx_init(priv, rxq); @@ -977,16 +977,16 @@ int iwl_hw_nic_init(struct iwl_priv *priv) /* Look at using this instead: rxq->need_update = 1; - iwl_rx_queue_update_write_ptr(priv, rxq); + iwl3945_rx_queue_update_write_ptr(priv, rxq); */ - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_direct32(priv, FH_RCSR_WPTR(0), rxq->write & ~7); - iwl_release_nic_access(priv); + iwl3945_write_direct32(priv, FH_RCSR_WPTR(0), rxq->write & ~7); + iwl3945_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); @@ -1000,49 +1000,49 @@ int iwl_hw_nic_init(struct iwl_priv *priv) } /** - * iwl_hw_txq_ctx_free - Free TXQ Context + * iwl3945_hw_txq_ctx_free - Free TXQ Context * * Destroy all TX DMA queues and structures */ -void iwl_hw_txq_ctx_free(struct iwl_priv *priv) +void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv) { int txq_id; /* Tx queues */ for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) - iwl_tx_queue_free(priv, &priv->txq[txq_id]); + iwl3945_tx_queue_free(priv, &priv->txq[txq_id]); } -void iwl_hw_txq_ctx_stop(struct iwl_priv *priv) +void iwl3945_hw_txq_ctx_stop(struct iwl3945_priv *priv) { int queue; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - if (iwl_grab_nic_access(priv)) { + if (iwl3945_grab_nic_access(priv)) { spin_unlock_irqrestore(&priv->lock, flags); - iwl_hw_txq_ctx_free(priv); + iwl3945_hw_txq_ctx_free(priv); return; } /* stop SCD */ - iwl_write_prph(priv, ALM_SCD_MODE_REG, 0); + iwl3945_write_prph(priv, ALM_SCD_MODE_REG, 0); /* reset TFD queues */ for (queue = TFD_QUEUE_MIN; queue < TFD_QUEUE_MAX; queue++) { - iwl_write_direct32(priv, FH_TCSR_CONFIG(queue), 0x0); - iwl_poll_direct_bit(priv, FH_TSSR_TX_STATUS, + iwl3945_write_direct32(priv, FH_TCSR_CONFIG(queue), 0x0); + iwl3945_poll_direct_bit(priv, FH_TSSR_TX_STATUS, ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(queue), 1000); } - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); - iwl_hw_txq_ctx_free(priv); + iwl3945_hw_txq_ctx_free(priv); } -int iwl_hw_nic_stop_master(struct iwl_priv *priv) +int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv) { int rc = 0; u32 reg_val; @@ -1051,16 +1051,16 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); /* set stop master bit */ - iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); + iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); - reg_val = iwl_read32(priv, CSR_GP_CNTRL); + reg_val = iwl3945_read32(priv, CSR_GP_CNTRL); if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE == (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE)) IWL_DEBUG_INFO("Card in power save, master is already " "stopped\n"); else { - rc = iwl_poll_bit(priv, CSR_RESET, + rc = iwl3945_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); if (rc < 0) { @@ -1075,47 +1075,47 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv) return rc; } -int iwl_hw_nic_reset(struct iwl_priv *priv) +int iwl3945_hw_nic_reset(struct iwl3945_priv *priv) { int rc; unsigned long flags; - iwl_hw_nic_stop_master(priv); + iwl3945_hw_nic_stop_master(priv); spin_lock_irqsave(&priv->lock, flags); - iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); + iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); - rc = iwl_poll_bit(priv, CSR_GP_CNTRL, + rc = iwl3945_poll_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (!rc) { - iwl_write_prph(priv, APMG_CLK_CTRL_REG, + iwl3945_write_prph(priv, APMG_CLK_CTRL_REG, APMG_CLK_VAL_BSM_CLK_RQT); udelay(10); - iwl_set_bit(priv, CSR_GP_CNTRL, + iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); - iwl_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0); - iwl_write_prph(priv, APMG_RTC_INT_STT_REG, + iwl3945_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0); + iwl3945_write_prph(priv, APMG_RTC_INT_STT_REG, 0xFFFFFFFF); /* enable DMA */ - iwl_write_prph(priv, APMG_CLK_EN_REG, + iwl3945_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); udelay(10); - iwl_set_bits_prph(priv, APMG_PS_CTRL_REG, + iwl3945_set_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); udelay(5); - iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG, + iwl3945_clear_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); } /* Clear the 'host command active' bit... */ @@ -1128,43 +1128,43 @@ int iwl_hw_nic_reset(struct iwl_priv *priv) } /** - * iwl_hw_reg_adjust_power_by_temp + * iwl3945_hw_reg_adjust_power_by_temp * return index delta into power gain settings table */ -static int iwl_hw_reg_adjust_power_by_temp(int new_reading, int old_reading) +static int iwl3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading) { return (new_reading - old_reading) * (-11) / 100; } /** - * iwl_hw_reg_temp_out_of_range - Keep temperature in sane range + * iwl3945_hw_reg_temp_out_of_range - Keep temperature in sane range */ -static inline int iwl_hw_reg_temp_out_of_range(int temperature) +static inline int iwl3945_hw_reg_temp_out_of_range(int temperature) { return (((temperature < -260) || (temperature > 25)) ? 1 : 0); } -int iwl_hw_get_temperature(struct iwl_priv *priv) +int iwl3945_hw_get_temperature(struct iwl3945_priv *priv) { - return iwl_read32(priv, CSR_UCODE_DRV_GP2); + return iwl3945_read32(priv, CSR_UCODE_DRV_GP2); } /** - * iwl_hw_reg_txpower_get_temperature + * iwl3945_hw_reg_txpower_get_temperature * get the current temperature by reading from NIC */ -static int iwl_hw_reg_txpower_get_temperature(struct iwl_priv *priv) +static int iwl3945_hw_reg_txpower_get_temperature(struct iwl3945_priv *priv) { int temperature; - temperature = iwl_hw_get_temperature(priv); + temperature = iwl3945_hw_get_temperature(priv); /* driver's okay range is -260 to +25. * human readable okay range is 0 to +285 */ IWL_DEBUG_INFO("Temperature: %d\n", temperature + IWL_TEMP_CONVERT); /* handle insane temp reading */ - if (iwl_hw_reg_temp_out_of_range(temperature)) { + if (iwl3945_hw_reg_temp_out_of_range(temperature)) { IWL_ERROR("Error bad temperature value %d\n", temperature); /* if really really hot(?), @@ -1189,11 +1189,11 @@ static int iwl_hw_reg_txpower_get_temperature(struct iwl_priv *priv) * records new temperature in tx_mgr->temperature. * replaces tx_mgr->last_temperature *only* if calib needed * (assumes caller will actually do the calibration!). */ -static int is_temp_calib_needed(struct iwl_priv *priv) +static int is_temp_calib_needed(struct iwl3945_priv *priv) { int temp_diff; - priv->temperature = iwl_hw_reg_txpower_get_temperature(priv); + priv->temperature = iwl3945_hw_reg_txpower_get_temperature(priv); temp_diff = priv->temperature - priv->last_temperature; /* get absolute value */ @@ -1225,7 +1225,7 @@ static int is_temp_calib_needed(struct iwl_priv *priv) /* radio and DSP power table, each step is 1/2 dB. * 1st number is for RF analog gain, 2nd number is for DSP pre-DAC gain. */ -static struct iwl_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = { +static struct iwl3945_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = { { {251, 127}, /* 2.4 GHz, highest power */ {251, 127}, @@ -1386,7 +1386,7 @@ static struct iwl_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = { {3, 120} } /* 5.x GHz, lowest power */ }; -static inline u8 iwl_hw_reg_fix_power_index(int index) +static inline u8 iwl3945_hw_reg_fix_power_index(int index) { if (index < 0) return 0; @@ -1399,17 +1399,17 @@ static inline u8 iwl_hw_reg_fix_power_index(int index) #define REG_RECALIB_PERIOD (60) /** - * iwl_hw_reg_set_scan_power - Set Tx power for scan probe requests + * iwl3945_hw_reg_set_scan_power - Set Tx power for scan probe requests * * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK) * or 6 Mbit (OFDM) rates. */ -static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, +static void iwl3945_hw_reg_set_scan_power(struct iwl3945_priv *priv, u32 scan_tbl_index, s32 rate_index, const s8 *clip_pwrs, - struct iwl_channel_info *ch_info, + struct iwl3945_channel_info *ch_info, int band_index) { - struct iwl_scan_power_info *scan_power_info; + struct iwl3945_scan_power_info *scan_power_info; s8 power; u8 power_index; @@ -1445,7 +1445,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, * of the table. */ /* don't exceed table bounds for "real" setting */ - power_index = iwl_hw_reg_fix_power_index(power_index); + power_index = iwl3945_hw_reg_fix_power_index(power_index); scan_power_info->power_table_index = power_index; scan_power_info->tpc.tx_gain = @@ -1455,21 +1455,21 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, } /** - * iwl_hw_reg_send_txpower - fill in Tx Power command with gain settings + * iwl3945_hw_reg_send_txpower - fill in Tx Power command with gain settings * * Configures power settings for all rates for the current channel, * using values from channel info struct, and send to NIC */ -int iwl_hw_reg_send_txpower(struct iwl_priv *priv) +int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv) { int rate_idx, i; - const struct iwl_channel_info *ch_info = NULL; - struct iwl_txpowertable_cmd txpower = { + const struct iwl3945_channel_info *ch_info = NULL; + struct iwl3945_txpowertable_cmd txpower = { .channel = priv->active_rxon.channel, }; txpower.band = (priv->phymode == MODE_IEEE80211A) ? 0 : 1; - ch_info = iwl_get_channel_info(priv, + ch_info = iwl3945_get_channel_info(priv, priv->phymode, le16_to_cpu(priv->active_rxon.channel)); if (!ch_info) { @@ -1491,7 +1491,7 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) rate_idx <= IWL_LAST_OFDM_RATE; rate_idx++, i++) { txpower.power[i].tpc = ch_info->power_info[i].tpc; - txpower.power[i].rate = iwl_rates[rate_idx].plcp; + txpower.power[i].rate = iwl3945_rates[rate_idx].plcp; IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", le16_to_cpu(txpower.channel), @@ -1504,7 +1504,7 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) for (rate_idx = IWL_FIRST_CCK_RATE; rate_idx <= IWL_LAST_CCK_RATE; rate_idx++, i++) { txpower.power[i].tpc = ch_info->power_info[i].tpc; - txpower.power[i].rate = iwl_rates[rate_idx].plcp; + txpower.power[i].rate = iwl3945_rates[rate_idx].plcp; IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", le16_to_cpu(txpower.channel), @@ -1514,13 +1514,13 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) txpower.power[i].rate); } - return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, - sizeof(struct iwl_txpowertable_cmd), &txpower); + return iwl3945_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, + sizeof(struct iwl3945_txpowertable_cmd), &txpower); } /** - * iwl_hw_reg_set_new_power - Configures power tables at new levels + * iwl3945_hw_reg_set_new_power - Configures power tables at new levels * @ch_info: Channel to update. Uses power_info.requested_power. * * Replace requested_power and base_power_index ch_info fields for @@ -1535,10 +1535,10 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) * properly fill out the scan powers, and actual h/w gain settings, * and send changes to NIC */ -static int iwl_hw_reg_set_new_power(struct iwl_priv *priv, - struct iwl_channel_info *ch_info) +static int iwl3945_hw_reg_set_new_power(struct iwl3945_priv *priv, + struct iwl3945_channel_info *ch_info) { - struct iwl_channel_power_info *power_info; + struct iwl3945_channel_power_info *power_info; int power_changed = 0; int i; const s8 *clip_pwrs; @@ -1578,7 +1578,7 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv, ch_info->power_info[IWL_RATE_12M_INDEX_TABLE]. requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF; - /* do all CCK rates' iwl_channel_power_info structures */ + /* do all CCK rates' iwl3945_channel_power_info structures */ for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) { power_info->requested_power = power; power_info->base_power_index = @@ -1592,13 +1592,13 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv, } /** - * iwl_hw_reg_get_ch_txpower_limit - returns new power limit for channel + * iwl3945_hw_reg_get_ch_txpower_limit - returns new power limit for channel * * NOTE: Returned power limit may be less (but not more) than requested, * based strictly on regulatory (eeprom and spectrum mgt) limitations * (no consideration for h/w clipping limitations). */ -static int iwl_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info) +static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl3945_channel_info *ch_info) { s8 max_power; @@ -1617,7 +1617,7 @@ static int iwl_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info) } /** - * iwl_hw_reg_comp_txpower_temp - Compensate for temperature + * iwl3945_hw_reg_comp_txpower_temp - Compensate for temperature * * Compensate txpower settings of *all* channels for temperature. * This only accounts for the difference between current temperature @@ -1626,9 +1626,9 @@ static int iwl_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info) * * If RxOn is "associated", this sends the new Txpower to NIC! */ -static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv) +static int iwl3945_hw_reg_comp_txpower_temp(struct iwl3945_priv *priv) { - struct iwl_channel_info *ch_info = NULL; + struct iwl3945_channel_info *ch_info = NULL; int delta_index; const s8 *clip_pwrs; /* array of h/w max power levels for each rate */ u8 a_band; @@ -1649,7 +1649,7 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv) /* get power index adjustment based on curr and factory * temps */ - delta_index = iwl_hw_reg_adjust_power_by_temp(temperature, + delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature, ref_temp); /* set tx power value for all rates, OFDM and CCK */ @@ -1662,7 +1662,7 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv) power_idx += delta_index; /* stay within table range */ - power_idx = iwl_hw_reg_fix_power_index(power_idx); + power_idx = iwl3945_hw_reg_fix_power_index(power_idx); ch_info->power_info[rate_index]. power_table_index = (u8) power_idx; ch_info->power_info[rate_index].tpc = @@ -1677,19 +1677,19 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv) scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { s32 actual_index = (scan_tbl_index == 0) ? IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE; - iwl_hw_reg_set_scan_power(priv, scan_tbl_index, + iwl3945_hw_reg_set_scan_power(priv, scan_tbl_index, actual_index, clip_pwrs, ch_info, a_band); } } /* send Txpower command for current channel to ucode */ - return iwl_hw_reg_send_txpower(priv); + return iwl3945_hw_reg_send_txpower(priv); } -int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) +int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power) { - struct iwl_channel_info *ch_info; + struct iwl3945_channel_info *ch_info; s8 max_power; u8 a_band; u8 i; @@ -1711,26 +1711,26 @@ int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) /* find minimum power of all user and regulatory constraints * (does not consider h/w clipping limitations) */ - max_power = iwl_hw_reg_get_ch_txpower_limit(ch_info); + max_power = iwl3945_hw_reg_get_ch_txpower_limit(ch_info); max_power = min(power, max_power); if (max_power != ch_info->curr_txpow) { ch_info->curr_txpow = max_power; /* this considers the h/w clipping limitations */ - iwl_hw_reg_set_new_power(priv, ch_info); + iwl3945_hw_reg_set_new_power(priv, ch_info); } } /* update txpower settings for all channels, * send to NIC if associated. */ is_temp_calib_needed(priv); - iwl_hw_reg_comp_txpower_temp(priv); + iwl3945_hw_reg_comp_txpower_temp(priv); return 0; } /* will add 3945 channel switch cmd handling later */ -int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel) +int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel) { return 0; } @@ -1745,17 +1745,17 @@ int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel) * -- send new set of gain settings to NIC * NOTE: This should continue working, even when we're not associated, * so we can keep our internal table of scan powers current. */ -void iwl3945_reg_txpower_periodic(struct iwl_priv *priv) +void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv) { /* This will kick in the "brute force" - * iwl_hw_reg_comp_txpower_temp() below */ + * iwl3945_hw_reg_comp_txpower_temp() below */ if (!is_temp_calib_needed(priv)) goto reschedule; /* Set up a new set of temp-adjusted TxPowers, send to NIC. * This is based *only* on current temperature, * ignoring any previous power measurements */ - iwl_hw_reg_comp_txpower_temp(priv); + iwl3945_hw_reg_comp_txpower_temp(priv); reschedule: queue_delayed_work(priv->workqueue, @@ -1764,7 +1764,7 @@ void iwl3945_reg_txpower_periodic(struct iwl_priv *priv) static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, + struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv, thermal_periodic.work); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) @@ -1776,7 +1776,7 @@ static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) } /** - * iwl_hw_reg_get_ch_grp_index - find the channel-group index (0-4) + * iwl3945_hw_reg_get_ch_grp_index - find the channel-group index (0-4) * for the channel. * * This function is used when initializing channel-info structs. @@ -1786,10 +1786,10 @@ static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) * on A-band, EEPROM's "group frequency" entries represent the top * channel in each group 1-4. Group 5 All B/G channels are in group 0. */ -static u16 iwl_hw_reg_get_ch_grp_index(struct iwl_priv *priv, - const struct iwl_channel_info *ch_info) +static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl3945_priv *priv, + const struct iwl3945_channel_info *ch_info) { - struct iwl_eeprom_txpower_group *ch_grp = &priv->eeprom.groups[0]; + struct iwl3945_eeprom_txpower_group *ch_grp = &priv->eeprom.groups[0]; u8 group; u16 group_index = 0; /* based on factory calib frequencies */ u8 grp_channel; @@ -1815,20 +1815,20 @@ static u16 iwl_hw_reg_get_ch_grp_index(struct iwl_priv *priv, } /** - * iwl_hw_reg_get_matched_power_index - Interpolate to get nominal index + * iwl3945_hw_reg_get_matched_power_index - Interpolate to get nominal index * * Interpolate to get nominal (i.e. at factory calibration temperature) index * into radio/DSP gain settings table for requested power. */ -static int iwl_hw_reg_get_matched_power_index(struct iwl_priv *priv, +static int iwl3945_hw_reg_get_matched_power_index(struct iwl3945_priv *priv, s8 requested_power, s32 setting_index, s32 *new_index) { - const struct iwl_eeprom_txpower_group *chnl_grp = NULL; + const struct iwl3945_eeprom_txpower_group *chnl_grp = NULL; s32 index0, index1; s32 power = 2 * requested_power; s32 i; - const struct iwl_eeprom_txpower_sample *samples; + const struct iwl3945_eeprom_txpower_sample *samples; s32 gains0, gains1; s32 res; s32 denominator; @@ -1868,11 +1868,11 @@ static int iwl_hw_reg_get_matched_power_index(struct iwl_priv *priv, return 0; } -static void iwl_hw_reg_init_channel_groups(struct iwl_priv *priv) +static void iwl3945_hw_reg_init_channel_groups(struct iwl3945_priv *priv) { u32 i; s32 rate_index; - const struct iwl_eeprom_txpower_group *group; + const struct iwl3945_eeprom_txpower_group *group; IWL_DEBUG_POWER("Initializing factory calib info from EEPROM\n"); @@ -1948,10 +1948,10 @@ static void iwl_hw_reg_init_channel_groups(struct iwl_priv *priv) * * This does *not* write values to NIC, just sets up our internal table. */ -int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) +int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv) { - struct iwl_channel_info *ch_info = NULL; - struct iwl_channel_power_info *pwr_info; + struct iwl3945_channel_info *ch_info = NULL; + struct iwl3945_channel_power_info *pwr_info; int delta_index; u8 rate_index; u8 scan_tbl_index; @@ -1964,10 +1964,10 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) /* save temperature reference, * so we can determine next time to calibrate */ - temperature = iwl_hw_reg_txpower_get_temperature(priv); + temperature = iwl3945_hw_reg_txpower_get_temperature(priv); priv->last_temperature = temperature; - iwl_hw_reg_init_channel_groups(priv); + iwl3945_hw_reg_init_channel_groups(priv); /* initialize Tx power info for each and every channel, 2.4 and 5.x */ for (i = 0, ch_info = priv->channel_info; i < priv->channel_count; @@ -1978,14 +1978,14 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) /* find this channel's channel group (*not* "band") index */ ch_info->group_index = - iwl_hw_reg_get_ch_grp_index(priv, ch_info); + iwl3945_hw_reg_get_ch_grp_index(priv, ch_info); /* Get this chnlgrp's rate->max/clip-powers table */ clip_pwrs = priv->clip_groups[ch_info->group_index].clip_powers; /* calculate power index *adjustment* value according to * diff between current temperature and factory temperature */ - delta_index = iwl_hw_reg_adjust_power_by_temp(temperature, + delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature, priv->eeprom.groups[ch_info->group_index]. temperature); @@ -2008,7 +2008,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) /* get base (i.e. at factory-measured temperature) * power table index for this rate's power */ - rc = iwl_hw_reg_get_matched_power_index(priv, pwr, + rc = iwl3945_hw_reg_get_matched_power_index(priv, pwr, ch_info->group_index, &power_idx); if (rc) { @@ -2021,9 +2021,9 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) power_idx += delta_index; /* stay within range of gain table */ - power_idx = iwl_hw_reg_fix_power_index(power_idx); + power_idx = iwl3945_hw_reg_fix_power_index(power_idx); - /* fill 1 OFDM rate's iwl_channel_power_info struct */ + /* fill 1 OFDM rate's iwl3945_channel_power_info struct */ pwr_info->requested_power = pwr; pwr_info->power_table_index = (u8) power_idx; pwr_info->tpc.tx_gain = @@ -2042,11 +2042,11 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) IWL_CCK_FROM_OFDM_INDEX_DIFF; /* stay within table range */ - pwr_index = iwl_hw_reg_fix_power_index(pwr_index); + pwr_index = iwl3945_hw_reg_fix_power_index(pwr_index); gain = power_gain_table[a_band][pwr_index].tx_gain; dsp_atten = power_gain_table[a_band][pwr_index].dsp_atten; - /* fill each CCK rate's iwl_channel_power_info structure + /* fill each CCK rate's iwl3945_channel_power_info structure * NOTE: All CCK-rate Txpwrs are the same for a given chnl! * NOTE: CCK rates start at end of OFDM rates! */ for (rate_index = 0; @@ -2064,7 +2064,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { s32 actual_index = (scan_tbl_index == 0) ? IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE; - iwl_hw_reg_set_scan_power(priv, scan_tbl_index, + iwl3945_hw_reg_set_scan_power(priv, scan_tbl_index, actual_index, clip_pwrs, ch_info, a_band); } } @@ -2072,66 +2072,66 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) return 0; } -int iwl_hw_rxq_stop(struct iwl_priv *priv) +int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv) { int rc; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_direct32(priv, FH_RCSR_CONFIG(0), 0); - rc = iwl_poll_direct_bit(priv, FH_RSSR_STATUS, (1 << 24), 1000); + iwl3945_write_direct32(priv, FH_RCSR_CONFIG(0), 0); + rc = iwl3945_poll_direct_bit(priv, FH_RSSR_STATUS, (1 << 24), 1000); if (rc < 0) IWL_ERROR("Can't stop Rx DMA.\n"); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; } -int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) +int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq) { int rc; unsigned long flags; int txq_id = txq->q.id; - struct iwl_shared *shared_data = priv->hw_setting.shared_virt; + struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt; shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_direct32(priv, FH_CBCC_CTRL(txq_id), 0); - iwl_write_direct32(priv, FH_CBCC_BASE(txq_id), 0); + iwl3945_write_direct32(priv, FH_CBCC_CTRL(txq_id), 0); + iwl3945_write_direct32(priv, FH_CBCC_BASE(txq_id), 0); - iwl_write_direct32(priv, FH_TCSR_CONFIG(txq_id), + iwl3945_write_direct32(priv, FH_TCSR_CONFIG(txq_id), ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT | ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF | ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD | ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL | ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); /* fake read to flush all prev. writes */ - iwl_read32(priv, FH_TSSR_CBB_BASE); + iwl3945_read32(priv, FH_TSSR_CBB_BASE); spin_unlock_irqrestore(&priv->lock, flags); return 0; } -int iwl_hw_get_rx_read(struct iwl_priv *priv) +int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv) { - struct iwl_shared *shared_data = priv->hw_setting.shared_virt; + struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt; return le32_to_cpu(shared_data->rx_read_ptr[0]); } @@ -2139,22 +2139,22 @@ int iwl_hw_get_rx_read(struct iwl_priv *priv) /** * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table */ -int iwl3945_init_hw_rate_table(struct iwl_priv *priv) +int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv) { int rc, i, index, prev_index; - struct iwl_rate_scaling_cmd rate_cmd = { + struct iwl3945_rate_scaling_cmd rate_cmd = { .reserved = {0, 0, 0}, }; - struct iwl_rate_scaling_info *table = rate_cmd.table; + struct iwl3945_rate_scaling_info *table = rate_cmd.table; - for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) { - index = iwl_rates[i].table_rs_index; + for (i = 0; i < ARRAY_SIZE(iwl3945_rates); i++) { + index = iwl3945_rates[i].table_rs_index; table[index].rate_n_flags = - iwl_hw_set_rate_n_flags(iwl_rates[i].plcp, 0); + iwl3945_hw_set_rate_n_flags(iwl3945_rates[i].plcp, 0); table[index].try_cnt = priv->retry_rate; - prev_index = iwl_get_prev_ieee_rate(i); - table[index].next_rate_index = iwl_rates[prev_index].table_rs_index; + prev_index = iwl3945_get_prev_ieee_rate(i); + table[index].next_rate_index = iwl3945_rates[prev_index].table_rs_index; } switch (priv->phymode) { @@ -2163,14 +2163,14 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv) /* If one of the following CCK rates is used, * have it fall back to the 6M OFDM rate */ for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) - table[i].next_rate_index = iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index; + table[i].next_rate_index = iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index; /* Don't fall back to CCK rates */ table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = IWL_RATE_9M_INDEX_TABLE; /* Don't drop out of OFDM rates */ table[IWL_RATE_6M_INDEX_TABLE].next_rate_index = - iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index; + iwl3945_rates[IWL_FIRST_OFDM_RATE].table_rs_index; break; case MODE_IEEE80211B: @@ -2178,7 +2178,7 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv) /* If an OFDM rate is used, have it fall back to the * 1M CCK rates */ for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; i++) - table[i].next_rate_index = iwl_rates[IWL_FIRST_CCK_RATE].table_rs_index; + table[i].next_rate_index = iwl3945_rates[IWL_FIRST_CCK_RATE].table_rs_index; /* CCK shouldn't fall back to OFDM... */ table[IWL_RATE_11M_INDEX_TABLE].next_rate_index = IWL_RATE_5M_INDEX_TABLE; @@ -2191,25 +2191,25 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv) /* Update the rate scaling for control frame Tx */ rate_cmd.table_id = 0; - rc = iwl_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), + rc = iwl3945_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), &rate_cmd); if (rc) return rc; /* Update the rate scaling for data frame Tx */ rate_cmd.table_id = 1; - return iwl_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), + return iwl3945_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), &rate_cmd); } -int iwl_hw_set_hw_setting(struct iwl_priv *priv) +int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv) { memset((void *)&priv->hw_setting, 0, - sizeof(struct iwl_driver_hw_info)); + sizeof(struct iwl3945_driver_hw_info)); priv->hw_setting.shared_virt = pci_alloc_consistent(priv->pci_dev, - sizeof(struct iwl_shared), + sizeof(struct iwl3945_shared), &priv->hw_setting.shared_phys); if (!priv->hw_setting.shared_virt) { @@ -2220,7 +2220,7 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv) priv->hw_setting.ac_queue_count = AC_NUM; priv->hw_setting.rx_buffer_size = IWL_RX_BUF_SIZE; - priv->hw_setting.tx_cmd_len = sizeof(struct iwl_tx_cmd); + priv->hw_setting.tx_cmd_len = sizeof(struct iwl3945_tx_cmd); priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE; priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG; priv->hw_setting.max_stations = IWL3945_STATION_COUNT; @@ -2228,21 +2228,21 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv) return 0; } -unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, - struct iwl_frame *frame, u8 rate) +unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv, + struct iwl3945_frame *frame, u8 rate) { - struct iwl_tx_beacon_cmd *tx_beacon_cmd; + struct iwl3945_tx_beacon_cmd *tx_beacon_cmd; unsigned int frame_size; - tx_beacon_cmd = (struct iwl_tx_beacon_cmd *)&frame->u; + tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u; memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); tx_beacon_cmd->tx.sta_id = IWL3945_BROADCAST_ID; tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - frame_size = iwl_fill_beacon_frame(priv, + frame_size = iwl3945_fill_beacon_frame(priv, tx_beacon_cmd->frame, - BROADCAST_ADDR, + iwl3945_broadcast_addr, sizeof(frame->u) - sizeof(*tx_beacon_cmd)); BUG_ON(frame_size > MAX_MPDU_SIZE); @@ -2259,35 +2259,35 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, tx_beacon_cmd->tx.supp_rates[1] = (IWL_CCK_BASIC_RATES_MASK & 0xF); - return (sizeof(struct iwl_tx_beacon_cmd) + frame_size); + return (sizeof(struct iwl3945_tx_beacon_cmd) + frame_size); } -void iwl_hw_rx_handler_setup(struct iwl_priv *priv) +void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv) { priv->rx_handlers[REPLY_3945_RX] = iwl3945_rx_reply_rx; } -void iwl_hw_setup_deferred_work(struct iwl_priv *priv) +void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv) { INIT_DELAYED_WORK(&priv->thermal_periodic, iwl3945_bg_reg_txpower_periodic); } -void iwl_hw_cancel_deferred_work(struct iwl_priv *priv) +void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv) { cancel_delayed_work(&priv->thermal_periodic); } -struct pci_device_id iwl_hw_card_ids[] = { +struct pci_device_id iwl3945_hw_card_ids[] = { {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4222)}, {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4227)}, {0} }; -inline int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv) +inline int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv) { - _iwl_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); + _iwl3945_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); return 0; } -MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); +MODULE_DEVICE_TABLE(pci, iwl3945_hw_card_ids); diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index d1616bf9bc8..e5b345de3c6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -31,10 +31,10 @@ #include #include -struct iwl_priv; +struct iwl3945_priv; /* Hardware specific file defines the PCI IDs table for that hardware module */ -extern struct pci_device_id iwl_hw_card_ids[]; +extern struct pci_device_id iwl3945_hw_card_ids[]; #define DRV_NAME "iwl3945" #include "iwl-3945-hw.h" @@ -55,10 +55,10 @@ extern struct pci_device_id iwl_hw_card_ids[]; #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) /* Module parameters accessible from iwl-*.c */ -extern int iwl_param_hwcrypto; -extern int iwl_param_queues_num; +extern int iwl3945_param_hwcrypto; +extern int iwl3945_param_queues_num; -enum iwl_antenna { +enum iwl3945_antenna { IWL_ANTENNA_DIVERSITY, IWL_ANTENNA_MAIN, IWL_ANTENNA_AUX @@ -81,13 +81,13 @@ enum iwl_antenna { #define DEFAULT_SHORT_RETRY_LIMIT 7U #define DEFAULT_LONG_RETRY_LIMIT 4U -struct iwl_rx_mem_buffer { +struct iwl3945_rx_mem_buffer { dma_addr_t dma_addr; struct sk_buff *skb; struct list_head list; }; -struct iwl_rt_rx_hdr { +struct iwl3945_rt_rx_hdr { struct ieee80211_radiotap_header rt_hdr; __le64 rt_tsf; /* TSF */ u8 rt_flags; /* radiotap packet flags */ @@ -100,7 +100,7 @@ struct iwl_rt_rx_hdr { u8 payload[0]; /* payload... */ } __attribute__ ((packed)); -struct iwl_rt_tx_hdr { +struct iwl3945_rt_tx_hdr { struct ieee80211_radiotap_header rt_hdr; u8 rt_rate; /* rate in 500kb/s */ __le16 rt_channel; /* channel in mHz */ @@ -115,7 +115,7 @@ struct iwl_rt_tx_hdr { * * Contains common data for Rx and Tx queues */ -struct iwl_queue { +struct iwl3945_queue { int n_bd; /* number of BDs in this queue */ int write_ptr; /* 1-st empty entry (index) host_w*/ int read_ptr; /* last used entry (index) host_r*/ @@ -130,24 +130,24 @@ struct iwl_queue { #define MAX_NUM_OF_TBS (20) -struct iwl_tx_info { +struct iwl3945_tx_info { struct ieee80211_tx_status status; struct sk_buff *skb[MAX_NUM_OF_TBS]; }; /** - * struct iwl_tx_queue - Tx Queue for DMA + * struct iwl3945_tx_queue - Tx Queue for DMA * @need_update: need to update read/write index * @shed_retry: queue is HT AGG enabled * * Queue consists of circular buffer of BD's and required locking structures. */ -struct iwl_tx_queue { - struct iwl_queue q; - struct iwl_tfd_frame *bd; - struct iwl_cmd *cmd; +struct iwl3945_tx_queue { + struct iwl3945_queue q; + struct iwl3945_tfd_frame *bd; + struct iwl3945_cmd *cmd; dma_addr_t dma_addr_cmd; - struct iwl_tx_info *txb; + struct iwl3945_tx_info *txb; int need_update; int sched_retry; int active; @@ -155,12 +155,12 @@ struct iwl_tx_queue { #define IWL_NUM_SCAN_RATES (2) -struct iwl_channel_tgd_info { +struct iwl3945_channel_tgd_info { u8 type; s8 max_power; }; -struct iwl_channel_tgh_info { +struct iwl3945_channel_tgh_info { s64 last_radar_time; }; @@ -171,8 +171,8 @@ struct iwl_channel_tgh_info { * -- spectrum management * -- user preference (e.g. iwconfig) * when requested power is set, base power index must also be set. */ -struct iwl_channel_power_info { - struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ +struct iwl3945_channel_power_info { + struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */ s8 power_table_index; /* actual (compenst'd) index into gain table */ s8 base_power_index; /* gain index for power at factory temp. */ s8 requested_power; /* power (dBm) requested for this chnl/rate */ @@ -180,8 +180,8 @@ struct iwl_channel_power_info { /* current scan Tx power values to use, one for each scan rate for each * channel. */ -struct iwl_scan_power_info { - struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ +struct iwl3945_scan_power_info { + struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */ s8 power_table_index; /* actual (compenst'd) index into gain table */ s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ }; @@ -201,11 +201,11 @@ struct iwl_scan_power_info { */ #define IWL4965_MAX_RATE (33) -struct iwl_channel_info { - struct iwl_channel_tgd_info tgd; - struct iwl_channel_tgh_info tgh; - struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ - struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for +struct iwl3945_channel_info { + struct iwl3945_channel_tgd_info tgd; + struct iwl3945_channel_tgh_info tgh; + struct iwl3945_eeprom_channel eeprom; /* EEPROM regulatory limit */ + struct iwl3945_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for * FAT channel */ u8 channel; /* channel number */ @@ -222,13 +222,13 @@ struct iwl_channel_info { /* Radio/DSP gain settings for each "normal" data Tx rate. * These include, in addition to RF and DSP gain, a few fields for * remembering/modifying gain settings (indexes). */ - struct iwl_channel_power_info power_info[IWL4965_MAX_RATE]; + struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE]; /* Radio/DSP gain settings for each scan rate, for directed scans. */ - struct iwl_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; + struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; }; -struct iwl_clip_group { +struct iwl3945_clip_group { /* maximum power level to prevent clipping for each rate, derived by * us from this band's saturation power in EEPROM */ const s8 clip_powers[IWL_MAX_RATES]; @@ -249,8 +249,8 @@ struct iwl_clip_group { /* Power management (not Tx power) structures */ -struct iwl_power_vec_entry { - struct iwl_powertable_cmd cmd; +struct iwl3945_power_vec_entry { + struct iwl3945_powertable_cmd cmd; u8 no_dtim; }; #define IWL_POWER_RANGE_0 (0) @@ -266,10 +266,10 @@ struct iwl_power_vec_entry { #define IWL_POWER_ENABLED 0x10 #define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK) -struct iwl_power_mgr { +struct iwl3945_power_mgr { spinlock_t lock; - struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC]; - struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC]; + struct iwl3945_power_vec_entry pwr_range_0[IWL_POWER_AC]; + struct iwl3945_power_vec_entry pwr_range_1[IWL_POWER_AC]; u8 active_index; u32 dtim_val; }; @@ -279,10 +279,10 @@ struct iwl_power_mgr { #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) -struct iwl_frame { +struct iwl3945_frame { union { struct ieee80211_hdr frame; - struct iwl_tx_beacon_cmd beacon; + struct iwl3945_tx_beacon_cmd beacon; u8 raw[IEEE80211_FRAME_LEN]; u8 cmd[360]; } u; @@ -308,15 +308,15 @@ enum { CMD_WANT_SKB = (1 << 2), }; -struct iwl_cmd; -struct iwl_priv; +struct iwl3945_cmd; +struct iwl3945_priv; -struct iwl_cmd_meta { - struct iwl_cmd_meta *source; +struct iwl3945_cmd_meta { + struct iwl3945_cmd_meta *source; union { struct sk_buff *skb; - int (*callback)(struct iwl_priv *priv, - struct iwl_cmd *cmd, struct sk_buff *skb); + int (*callback)(struct iwl3945_priv *priv, + struct iwl3945_cmd *cmd, struct sk_buff *skb); } __attribute__ ((packed)) u; /* The CMD_SIZE_HUGE flag bit indicates that the command @@ -325,37 +325,37 @@ struct iwl_cmd_meta { } __attribute__ ((packed)); -struct iwl_cmd { - struct iwl_cmd_meta meta; - struct iwl_cmd_header hdr; +struct iwl3945_cmd { + struct iwl3945_cmd_meta meta; + struct iwl3945_cmd_header hdr; union { - struct iwl_addsta_cmd addsta; - struct iwl_led_cmd led; + struct iwl3945_addsta_cmd addsta; + struct iwl3945_led_cmd led; u32 flags; u8 val8; u16 val16; u32 val32; - struct iwl_bt_cmd bt; - struct iwl_rxon_time_cmd rxon_time; - struct iwl_powertable_cmd powertable; - struct iwl_qosparam_cmd qosparam; - struct iwl_tx_cmd tx; - struct iwl_tx_beacon_cmd tx_beacon; - struct iwl_rxon_assoc_cmd rxon_assoc; + struct iwl3945_bt_cmd bt; + struct iwl3945_rxon_time_cmd rxon_time; + struct iwl3945_powertable_cmd powertable; + struct iwl3945_qosparam_cmd qosparam; + struct iwl3945_tx_cmd tx; + struct iwl3945_tx_beacon_cmd tx_beacon; + struct iwl3945_rxon_assoc_cmd rxon_assoc; u8 *indirect; u8 payload[360]; } __attribute__ ((packed)) cmd; } __attribute__ ((packed)); -struct iwl_host_cmd { +struct iwl3945_host_cmd { u8 id; u16 len; - struct iwl_cmd_meta meta; + struct iwl3945_cmd_meta meta; const void *data; }; -#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ - sizeof(struct iwl_cmd_meta)) +#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \ + sizeof(struct iwl3945_cmd_meta)) /* * RX related structures and functions @@ -368,7 +368,7 @@ struct iwl_host_cmd { #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 /** - * struct iwl_rx_queue - Rx queue + * struct iwl3945_rx_queue - Rx queue * @processed: Internal index to last handled Rx packet * @read: Shared index to newest available Rx buffer * @write: Shared index to oldest written Rx packet @@ -377,13 +377,13 @@ struct iwl_host_cmd { * @rx_used: List of Rx buffers with no SKB * @need_update: flag to indicate we need to update read/write index * - * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers + * NOTE: rx_free and rx_used are used as a FIFO for iwl3945_rx_mem_buffers */ -struct iwl_rx_queue { +struct iwl3945_rx_queue { __le32 *bd; dma_addr_t dma_addr; - struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; - struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; + struct iwl3945_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; + struct iwl3945_rx_mem_buffer *queue[RX_QUEUE_SIZE]; u32 processed; u32 read; u32 write; @@ -427,17 +427,17 @@ struct iwl_rx_queue { #define IWL_INVALID_RATE 0xFF #define IWL_INVALID_VALUE -1 -struct iwl_tid_data { +struct iwl3945_tid_data { u16 seq_number; }; -struct iwl_hw_key { +struct iwl3945_hw_key { enum ieee80211_key_alg alg; int keylen; u8 key[32]; }; -union iwl_ht_rate_supp { +union iwl3945_ht_rate_supp { u16 rates; struct { u8 siso_rate; @@ -472,7 +472,7 @@ struct sta_ht_info { #ifdef CONFIG_IWL3945_QOS -union iwl_qos_capabity { +union iwl3945_qos_capabity { struct { u8 edca_count:4; /* bit 0-3 */ u8 q_ack:1; /* bit 4 */ @@ -493,20 +493,20 @@ union iwl_qos_capabity { }; /* QoS structures */ -struct iwl_qos_info { +struct iwl3945_qos_info { int qos_enable; int qos_active; - union iwl_qos_capabity qos_cap; - struct iwl_qosparam_cmd def_qos_parm; + union iwl3945_qos_capabity qos_cap; + struct iwl3945_qosparam_cmd def_qos_parm; }; #endif /*CONFIG_IWL3945_QOS */ #define STA_PS_STATUS_WAKE 0 #define STA_PS_STATUS_SLEEP 1 -struct iwl_station_entry { - struct iwl_addsta_cmd sta; - struct iwl_tid_data tid[MAX_TID_COUNT]; +struct iwl3945_station_entry { + struct iwl3945_addsta_cmd sta; + struct iwl3945_tid_data tid[MAX_TID_COUNT]; union { struct { u8 rate; @@ -516,7 +516,7 @@ struct iwl_station_entry { } current_rate; u8 used; u8 ps_status; - struct iwl_hw_key keyinfo; + struct iwl3945_hw_key keyinfo; }; /* one for each uCode image (inst/data, boot/init/runtime) */ @@ -527,7 +527,7 @@ struct fw_desc { }; /* uCode file layout */ -struct iwl_ucode { +struct iwl3945_ucode { __le32 ver; /* major/minor/subminor */ __le32 inst_size; /* bytes of runtime instructions */ __le32 data_size; /* bytes of runtime data */ @@ -539,7 +539,7 @@ struct iwl_ucode { #define IWL_IBSS_MAC_HASH_SIZE 32 -struct iwl_ibss_seq { +struct iwl3945_ibss_seq { u8 mac[ETH_ALEN]; u16 seq_num; u16 frag_num; @@ -547,7 +547,7 @@ struct iwl_ibss_seq { struct list_head list; }; -struct iwl_driver_hw_info { +struct iwl3945_driver_hw_info { u16 max_txq_num; u16 ac_queue_count; u16 tx_cmd_len; @@ -573,10 +573,10 @@ struct iwl_driver_hw_info { #define HT_SHORT_GI_40MHZ_ONLY (1 << 1) -#define IWL_RX_HDR(x) ((struct iwl_rx_frame_hdr *)(\ +#define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\ x->u.rx_frame.stats.payload + \ x->u.rx_frame.stats.phy_count)) -#define IWL_RX_END(x) ((struct iwl_rx_frame_end *)(\ +#define IWL_RX_END(x) ((struct iwl3945_rx_frame_end *)(\ IWL_RX_HDR(x)->payload + \ le16_to_cpu(IWL_RX_HDR(x)->len))) #define IWL_RX_STATS(x) (&x->u.rx_frame.stats) @@ -589,61 +589,61 @@ struct iwl_driver_hw_info { * for use by iwl-*.c * *****************************************************************************/ -struct iwl_addsta_cmd; -extern int iwl_send_add_station(struct iwl_priv *priv, - struct iwl_addsta_cmd *sta, u8 flags); -extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid, +struct iwl3945_addsta_cmd; +extern int iwl3945_send_add_station(struct iwl3945_priv *priv, + struct iwl3945_addsta_cmd *sta, u8 flags); +extern u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *bssid, int is_ap, u8 flags); -extern int iwl_is_network_packet(struct iwl_priv *priv, +extern int iwl3945_is_network_packet(struct iwl3945_priv *priv, struct ieee80211_hdr *header); -extern int iwl_power_init_handle(struct iwl_priv *priv); -extern int iwl_eeprom_init(struct iwl_priv *priv); +extern int iwl3945_power_init_handle(struct iwl3945_priv *priv); +extern int iwl3945_eeprom_init(struct iwl3945_priv *priv); #ifdef CONFIG_IWL3945_DEBUG -extern void iwl_report_frame(struct iwl_priv *priv, - struct iwl_rx_packet *pkt, +extern void iwl3945_report_frame(struct iwl3945_priv *priv, + struct iwl3945_rx_packet *pkt, struct ieee80211_hdr *header, int group100); #else -static inline void iwl_report_frame(struct iwl_priv *priv, - struct iwl_rx_packet *pkt, +static inline void iwl3945_report_frame(struct iwl3945_priv *priv, + struct iwl3945_rx_packet *pkt, struct ieee80211_hdr *header, int group100) {} #endif -extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb, +extern void iwl3945_handle_data_packet_monitor(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb, void *data, short len, struct ieee80211_rx_status *stats, u16 phy_flags); -extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr - *header); -extern int iwl_rx_queue_alloc(struct iwl_priv *priv); -extern void iwl_rx_queue_reset(struct iwl_priv *priv, - struct iwl_rx_queue *rxq); -extern int iwl_calc_db_from_ratio(int sig_ratio); -extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm); -extern int iwl_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq, int count, u32 id); -extern void iwl_rx_replenish(void *data); -extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); -extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, +extern int iwl3945_is_duplicate_packet(struct iwl3945_priv *priv, + struct ieee80211_hdr *header); +extern int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv); +extern void iwl3945_rx_queue_reset(struct iwl3945_priv *priv, + struct iwl3945_rx_queue *rxq); +extern int iwl3945_calc_db_from_ratio(int sig_ratio); +extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm); +extern int iwl3945_tx_queue_init(struct iwl3945_priv *priv, + struct iwl3945_tx_queue *txq, int count, u32 id); +extern void iwl3945_rx_replenish(void *data); +extern void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq); +extern int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len, const void *data); -extern int __must_check iwl_send_cmd(struct iwl_priv *priv, - struct iwl_host_cmd *cmd); -extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, +extern int __must_check iwl3945_send_cmd(struct iwl3945_priv *priv, + struct iwl3945_host_cmd *cmd); +extern unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, struct ieee80211_hdr *hdr, const u8 *dest, int left); -extern int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_rx_queue *q); -extern int iwl_send_statistics_request(struct iwl_priv *priv); -extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, +extern int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, + struct iwl3945_rx_queue *q); +extern int iwl3945_send_statistics_request(struct iwl3945_priv *priv); +extern void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb, u32 decrypt_res, struct ieee80211_rx_status *stats); -extern const u8 BROADCAST_ADDR[ETH_ALEN]; +extern const u8 iwl3945_broadcast_addr[ETH_ALEN]; /* * Currently used by iwl-3945-rs... look at restructuring so that it doesn't * call this... todo... fix that. */ -extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id, +extern u8 iwl3945_sync_station(struct iwl3945_priv *priv, int sta_id, u16 tx_rate, u8 flags); /****************************************************************************** @@ -655,65 +655,65 @@ extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id, * which is why they are in the hardware specific files (vs. iwl-base.c) * * Naming convention -- - * iwl_ <-- Its part of iwlwifi (should be changed to iwl_) - * iwl_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) + * iwl3945_ <-- Its part of iwlwifi (should be changed to iwl3945_) + * iwl3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) - * iwl_bg_ <-- Called from work queue context - * iwl_mac_ <-- mac80211 callback + * iwl3945_bg_ <-- Called from work queue context + * iwl3945_mac_ <-- mac80211 callback * ****************************************************************************/ -extern void iwl_hw_rx_handler_setup(struct iwl_priv *priv); -extern void iwl_hw_setup_deferred_work(struct iwl_priv *priv); -extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv); -extern int iwl_hw_rxq_stop(struct iwl_priv *priv); -extern int iwl_hw_set_hw_setting(struct iwl_priv *priv); -extern int iwl_hw_nic_init(struct iwl_priv *priv); -extern int iwl_hw_nic_stop_master(struct iwl_priv *priv); -extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv); -extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv); -extern int iwl_hw_nic_reset(struct iwl_priv *priv); -extern int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd, +extern void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv); +extern void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv); +extern void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv); +extern int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv); +extern int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv); +extern int iwl3945_hw_nic_init(struct iwl3945_priv *priv); +extern int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv); +extern void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv); +extern void iwl3945_hw_txq_ctx_stop(struct iwl3945_priv *priv); +extern int iwl3945_hw_nic_reset(struct iwl3945_priv *priv); +extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *tfd, dma_addr_t addr, u16 len); -extern int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); -extern int iwl_hw_get_temperature(struct iwl_priv *priv); -extern int iwl_hw_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq); -extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, - struct iwl_frame *frame, u8 rate); -extern int iwl_hw_get_rx_read(struct iwl_priv *priv); -extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, - struct iwl_cmd *cmd, +extern int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq); +extern int iwl3945_hw_get_temperature(struct iwl3945_priv *priv); +extern int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, + struct iwl3945_tx_queue *txq); +extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv, + struct iwl3945_frame *frame, u8 rate); +extern int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv); +extern void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, + struct iwl3945_cmd *cmd, struct ieee80211_tx_control *ctrl, struct ieee80211_hdr *hdr, int sta_id, int tx_id); -extern int iwl_hw_reg_send_txpower(struct iwl_priv *priv); -extern int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); -extern void iwl_hw_rx_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -extern void iwl_disable_events(struct iwl_priv *priv); -extern int iwl4965_get_temperature(const struct iwl_priv *priv); +extern int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv); +extern int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power); +extern void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb); +extern void iwl3945_disable_events(struct iwl3945_priv *priv); +extern int iwl4965_get_temperature(const struct iwl3945_priv *priv); /** - * iwl_hw_find_station - Find station id for a given BSSID + * iwl3945_hw_find_station - Find station id for a given BSSID * @bssid: MAC address of station ID to find * * NOTE: This should not be hardware specific but the code has * not yet been merged into a single common layer for managing the * station tables. */ -extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid); +extern u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *bssid); -extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel); +extern int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel); /* * Forward declare iwl-3945.c functions for iwl-base.c */ -extern int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv); -extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv); -extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv); -extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv); -extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv); -extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, +extern int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv); +extern __le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv); +extern int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv); +extern void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv); +extern int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv); +extern u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id, u16 tx_rate, u8 flags); @@ -726,7 +726,7 @@ enum { #endif -struct iwl_priv { +struct iwl3945_priv { /* ieee device used by generic ieee processing code */ struct ieee80211_hw *hw; @@ -740,27 +740,27 @@ struct iwl_priv { u8 phymode; int alloc_rxb_skb; - void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); + void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb); const struct ieee80211_hw_mode *modes; #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT /* spectrum measurement report caching */ - struct iwl_spectrum_notification measure_report; + struct iwl3945_spectrum_notification measure_report; u8 measurement_status; #endif /* ucode beacon time */ u32 ucode_beacon_time; - /* we allocate array of iwl_channel_info for NIC's valid channels. + /* we allocate array of iwl3945_channel_info for NIC's valid channels. * Access via channel # using indirect index array */ - struct iwl_channel_info *channel_info; /* channel info array */ + struct iwl3945_channel_info *channel_info; /* channel info array */ u8 channel_count; /* # of channels */ /* each calibration channel group in the EEPROM has a derived * clip setting for each rate. */ - const struct iwl_clip_group clip_groups[5]; + const struct iwl3945_clip_group clip_groups[5]; /* thermal calibration */ s32 temperature; /* degrees Kelvin */ @@ -775,7 +775,7 @@ struct iwl_priv { int one_direct_scan; u8 direct_ssid_len; u8 direct_ssid[IW_ESSID_MAX_SIZE]; - struct iwl_scan_cmd *scan; + struct iwl3945_scan_cmd *scan; u8 only_active_channel; /* spinlock */ @@ -798,26 +798,26 @@ struct iwl_priv { struct fw_desc ucode_boot; /* bootstrap inst */ - struct iwl_rxon_time_cmd rxon_timing; + struct iwl3945_rxon_time_cmd rxon_timing; /* We declare this const so it can only be * changed via explicit cast within the * routines that actually update the physical * hardware */ - const struct iwl_rxon_cmd active_rxon; - struct iwl_rxon_cmd staging_rxon; + const struct iwl3945_rxon_cmd active_rxon; + struct iwl3945_rxon_cmd staging_rxon; int error_recovering; - struct iwl_rxon_cmd recovery_rxon; + struct iwl3945_rxon_cmd recovery_rxon; /* 1st responses from initialize and runtime uCode images. * 4965's initialize alive response contains some calibration data. */ - struct iwl_init_alive_resp card_alive_init; - struct iwl_alive_resp card_alive; + struct iwl3945_init_alive_resp card_alive_init; + struct iwl3945_alive_resp card_alive; #ifdef LED /* LED related variables */ - struct iwl_activity_blink activity; + struct iwl3945_activity_blink activity; unsigned long led_packets; int led_state; #endif @@ -836,8 +836,8 @@ struct iwl_priv { int activity_timer_active; /* Rx and Tx DMA processing queues */ - struct iwl_rx_queue rxq; - struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; + struct iwl3945_rx_queue rxq; + struct iwl3945_tx_queue txq[IWL_MAX_NUM_QUEUES]; unsigned long status; u32 config; @@ -845,9 +845,9 @@ struct iwl_priv { int last_rx_rssi; /* From Rx packet statisitics */ int last_rx_noise; /* From beacon statistics */ - struct iwl_power_mgr power_data; + struct iwl3945_power_mgr power_data; - struct iwl_notif_statistics statistics; + struct iwl3945_notif_statistics statistics; unsigned long last_statistics_time; /* context information */ @@ -864,7 +864,7 @@ struct iwl_priv { /*station table variables */ spinlock_t sta_lock; int num_stations; - struct iwl_station_entry stations[IWL_STATION_COUNT]; + struct iwl3945_station_entry stations[IWL_STATION_COUNT]; /* Indication if ieee80211_ops->open has been called */ int is_open; @@ -885,7 +885,7 @@ struct iwl_priv { struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE]; /* eeprom */ - struct iwl_eeprom eeprom; + struct iwl3945_eeprom eeprom; int iw_mode; @@ -895,7 +895,7 @@ struct iwl_priv { u32 timestamp0; u32 timestamp1; u16 beacon_int; - struct iwl_driver_hw_info hw_setting; + struct iwl3945_driver_hw_info hw_setting; int interface_id; /* Current association information needed to configure the @@ -905,7 +905,7 @@ struct iwl_priv { u8 ps_mode; #ifdef CONFIG_IWL3945_QOS - struct iwl_qos_info qos_data; + struct iwl3945_qos_info qos_data; #endif /*CONFIG_IWL3945_QOS */ struct workqueue_struct *workqueue; @@ -946,55 +946,55 @@ struct iwl_priv { u32 framecnt_to_us; atomic_t restrict_refcnt; #endif -}; /*iwl_priv */ +}; /*iwl3945_priv */ -static inline int iwl_is_associated(struct iwl_priv *priv) +static inline int iwl3945_is_associated(struct iwl3945_priv *priv) { return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; } -static inline int is_channel_valid(const struct iwl_channel_info *ch_info) +static inline int is_channel_valid(const struct iwl3945_channel_info *ch_info) { if (ch_info == NULL) return 0; return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; } -static inline int is_channel_narrow(const struct iwl_channel_info *ch_info) +static inline int is_channel_narrow(const struct iwl3945_channel_info *ch_info) { return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0; } -static inline int is_channel_radar(const struct iwl_channel_info *ch_info) +static inline int is_channel_radar(const struct iwl3945_channel_info *ch_info) { return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; } -static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info) +static inline u8 is_channel_a_band(const struct iwl3945_channel_info *ch_info) { return ch_info->phymode == MODE_IEEE80211A; } -static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info) +static inline u8 is_channel_bg_band(const struct iwl3945_channel_info *ch_info) { return ((ch_info->phymode == MODE_IEEE80211B) || (ch_info->phymode == MODE_IEEE80211G)); } -static inline int is_channel_passive(const struct iwl_channel_info *ch) +static inline int is_channel_passive(const struct iwl3945_channel_info *ch) { return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; } -static inline int is_channel_ibss(const struct iwl_channel_info *ch) +static inline int is_channel_ibss(const struct iwl3945_channel_info *ch) { return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; } -extern const struct iwl_channel_info *iwl_get_channel_info( - const struct iwl_priv *priv, int phymode, u16 channel); +extern const struct iwl3945_channel_info *iwl3945_get_channel_info( + const struct iwl3945_priv *priv, int phymode, u16 channel); -/* Requires full declaration of iwl_priv before including */ +/* Requires full declaration of iwl3945_priv before including */ #include "iwl-3945-io.h" #endif diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h index 5524bf77e88..2703c52750b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h @@ -61,8 +61,8 @@ * *****************************************************************************/ -#ifndef __iwl_commands_h__ -#define __iwl_commands_h__ +#ifndef __iwl4965_commands_h__ +#define __iwl4965_commands_h__ enum { REPLY_ALIVE = 0x1, @@ -147,7 +147,7 @@ enum { #define IWL_CMD_FAILED_MSK 0x40 -struct iwl_cmd_header { +struct iwl4965_cmd_header { u8 cmd; u8 flags; /* We have 15 LSB to use as we please (MSB indicates @@ -179,7 +179,7 @@ struct iwl_cmd_header { /* * REPLY_ALIVE = 0x1 (response only, not a command) */ -struct iwl_alive_resp { +struct iwl4965_alive_resp { u8 ucode_minor; u8 ucode_major; __le16 reserved1; @@ -193,7 +193,7 @@ struct iwl_alive_resp { __le32 is_valid; } __attribute__ ((packed)); -struct iwl_init_alive_resp { +struct iwl4965_init_alive_resp { u8 ucode_minor; u8 ucode_major; __le16 reserved1; @@ -225,7 +225,7 @@ union tsf { /* * REPLY_ERROR = 0x2 (response only, not a command) */ -struct iwl_error_resp { +struct iwl4965_error_resp { __le32 error_type; u8 cmd_id; u8 reserved1; @@ -293,7 +293,7 @@ enum { /* * REPLY_RXON = 0x10 (command, has simple generic response) */ -struct iwl_rxon_cmd { +struct iwl4965_rxon_cmd { u8 node_addr[6]; __le16 reserved1; u8 bssid_addr[6]; @@ -316,7 +316,7 @@ struct iwl_rxon_cmd { /* * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) */ -struct iwl_rxon_assoc_cmd { +struct iwl4965_rxon_assoc_cmd { __le32 flags; __le32 filter_flags; u8 ofdm_basic_rates; @@ -330,7 +330,7 @@ struct iwl_rxon_assoc_cmd { /* * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) */ -struct iwl_rxon_time_cmd { +struct iwl4965_rxon_time_cmd { union tsf timestamp; __le16 beacon_interval; __le16 atim_window; @@ -339,7 +339,7 @@ struct iwl_rxon_time_cmd { __le16 reserved; } __attribute__ ((packed)); -struct iwl_tx_power { +struct iwl4965_tx_power { u8 tx_gain; /* gain for analog radio */ u8 dsp_atten; /* gain for DSP */ } __attribute__ ((packed)); @@ -351,27 +351,27 @@ struct tx_power_dual_stream { __le32 dw; } __attribute__ ((packed)); -struct iwl_tx_power_db { +struct iwl4965_tx_power_db { struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; } __attribute__ ((packed)); /* * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) */ -struct iwl_channel_switch_cmd { +struct iwl4965_channel_switch_cmd { u8 band; u8 expect_beacon; __le16 channel; __le32 rxon_flags; __le32 rxon_filter_flags; __le32 switch_time; - struct iwl_tx_power_db tx_power; + struct iwl4965_tx_power_db tx_power; } __attribute__ ((packed)); /* * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) */ -struct iwl_csa_notification { +struct iwl4965_csa_notification { __le16 band; __le16 channel; __le32 status; /* 0 - OK, 1 - fail */ @@ -382,7 +382,7 @@ struct iwl_csa_notification { * Quality-of-Service (QOS) Commands & Responses: * *****************************************************************************/ -struct iwl_ac_qos { +struct iwl4965_ac_qos { __le16 cw_min; __le16 cw_max; u8 aifsn; @@ -404,9 +404,9 @@ struct iwl_ac_qos { /* * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) */ -struct iwl_qosparam_cmd { +struct iwl4965_qosparam_cmd { __le32 qos_flags; - struct iwl_ac_qos ac[AC_NUM]; + struct iwl4965_ac_qos ac[AC_NUM]; } __attribute__ ((packed)); /****************************************************************************** @@ -464,7 +464,7 @@ struct iwl_qosparam_cmd { #define RATE_MCS_ANT_B_MSK 0x8000 #define RATE_MCS_ANT_AB_MSK 0xc000 -struct iwl_keyinfo { +struct iwl4965_keyinfo { __le16 key_flags; u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ u8 reserved1; @@ -484,11 +484,11 @@ struct sta_id_modify { /* * REPLY_ADD_STA = 0x18 (command) */ -struct iwl_addsta_cmd { +struct iwl4965_addsta_cmd { u8 mode; u8 reserved[3]; struct sta_id_modify sta; - struct iwl_keyinfo key; + struct iwl4965_keyinfo key; __le32 station_flags; __le32 station_flags_msk; __le16 tid_disable_tx; @@ -502,7 +502,7 @@ struct iwl_addsta_cmd { /* * REPLY_ADD_STA = 0x18 (response) */ -struct iwl_add_sta_resp { +struct iwl4965_add_sta_resp { u8 status; } __attribute__ ((packed)); @@ -514,7 +514,7 @@ struct iwl_add_sta_resp { * *****************************************************************************/ -struct iwl_rx_frame_stats { +struct iwl4965_rx_frame_stats { u8 phy_count; u8 id; u8 rssi; @@ -524,7 +524,7 @@ struct iwl_rx_frame_stats { u8 payload[0]; } __attribute__ ((packed)); -struct iwl_rx_frame_hdr { +struct iwl4965_rx_frame_hdr { __le16 channel; __le16 phy_flags; u8 reserved1; @@ -554,7 +554,7 @@ struct iwl_rx_frame_hdr { #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) -struct iwl_rx_frame_end { +struct iwl4965_rx_frame_end { __le32 status; __le64 timestamp; __le32 beacon_timestamp; @@ -568,10 +568,10 @@ struct iwl_rx_frame_end { * The actual offsets of the hdr and end are dynamic based on * stats.phy_count */ -struct iwl_rx_frame { - struct iwl_rx_frame_stats stats; - struct iwl_rx_frame_hdr hdr; - struct iwl_rx_frame_end end; +struct iwl4965_rx_frame { + struct iwl4965_rx_frame_stats stats; + struct iwl4965_rx_frame_hdr hdr; + struct iwl4965_rx_frame_end end; } __attribute__ ((packed)); /* Fixed (non-configurable) rx data from phy */ @@ -666,7 +666,7 @@ struct iwl4965_rx_mpdu_res_start { * TX command Frame life time */ -struct iwl_dram_scratch { +struct iwl4965_dram_scratch { u8 try_cnt; u8 bt_kill_cnt; __le16 reserved; @@ -675,11 +675,11 @@ struct iwl_dram_scratch { /* * REPLY_TX = 0x1c (command) */ -struct iwl_tx_cmd { +struct iwl4965_tx_cmd { __le16 len; __le16 next_frame_len; __le32 tx_flags; - struct iwl_dram_scratch scratch; + struct iwl4965_dram_scratch scratch; __le32 rate_n_flags; u8 sta_id; u8 sec_ctl; @@ -807,7 +807,7 @@ enum { /* * REPLY_TX = 0x1c (response) */ -struct iwl_tx_resp { +struct iwl4965_tx_resp { u8 frame_count; /* 1 no aggregation, >1 aggregation */ u8 bt_kill_count; u8 failure_rts; @@ -823,7 +823,7 @@ struct iwl_tx_resp { /* * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) */ -struct iwl_compressed_ba_resp { +struct iwl4965_compressed_ba_resp { __le32 sta_addr_lo32; __le16 sta_addr_hi16; __le16 reserved; @@ -839,11 +839,11 @@ struct iwl_compressed_ba_resp { /* * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) */ -struct iwl_txpowertable_cmd { +struct iwl4965_txpowertable_cmd { u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ u8 reserved; __le16 channel; - struct iwl_tx_power_db tx_power; + struct iwl4965_tx_power_db tx_power; } __attribute__ ((packed)); /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ @@ -856,7 +856,7 @@ struct iwl_txpowertable_cmd { #define LINK_QUAL_ANT_B_MSK (1<<1) #define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) -struct iwl_link_qual_general_params { +struct iwl4965_link_qual_general_params { u8 flags; u8 mimo_delimiter; u8 single_stream_ant_msk; @@ -864,7 +864,7 @@ struct iwl_link_qual_general_params { u8 start_rate_index[LINK_QUAL_AC_NUM]; } __attribute__ ((packed)); -struct iwl_link_qual_agg_params { +struct iwl4965_link_qual_agg_params { __le16 agg_time_limit; u8 agg_dis_start_th; u8 agg_frame_cnt_limit; @@ -874,12 +874,12 @@ struct iwl_link_qual_agg_params { /* * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) */ -struct iwl_link_quality_cmd { +struct iwl4965_link_quality_cmd { u8 sta_id; u8 reserved1; __le16 control; - struct iwl_link_qual_general_params general_params; - struct iwl_link_qual_agg_params agg_params; + struct iwl4965_link_qual_general_params general_params; + struct iwl4965_link_qual_agg_params agg_params; struct { __le32 rate_n_flags; } rs_table[LINK_QUAL_MAX_RETRY_NUM]; @@ -889,7 +889,7 @@ struct iwl_link_quality_cmd { /* * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) */ -struct iwl_bt_cmd { +struct iwl4965_bt_cmd { u8 flags; u8 lead_time; u8 max_kill; @@ -915,18 +915,18 @@ struct iwl_bt_cmd { RXON_FILTER_ASSOC_MSK | \ RXON_FILTER_BCON_AWARE_MSK) -struct iwl_measure_channel { +struct iwl4965_measure_channel { __le32 duration; /* measurement duration in extended beacon * format */ u8 channel; /* channel to measure */ - u8 type; /* see enum iwl_measure_type */ + u8 type; /* see enum iwl4965_measure_type */ __le16 reserved; } __attribute__ ((packed)); /* * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) */ -struct iwl_spectrum_cmd { +struct iwl4965_spectrum_cmd { __le16 len; /* number of bytes starting from token */ u8 token; /* token id */ u8 id; /* measurement id -- 0 or 1 */ @@ -939,13 +939,13 @@ struct iwl_spectrum_cmd { __le32 filter_flags; /* rxon filter flags */ __le16 channel_count; /* minimum 1, maximum 10 */ __le16 reserved3; - struct iwl_measure_channel channels[10]; + struct iwl4965_measure_channel channels[10]; } __attribute__ ((packed)); /* * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) */ -struct iwl_spectrum_resp { +struct iwl4965_spectrum_resp { u8 token; u8 id; /* id of the prior command replaced, or 0xff */ __le16 status; /* 0 - command will be handled @@ -953,12 +953,12 @@ struct iwl_spectrum_resp { * measurement) */ } __attribute__ ((packed)); -enum iwl_measurement_state { +enum iwl4965_measurement_state { IWL_MEASUREMENT_START = 0, IWL_MEASUREMENT_STOP = 1, }; -enum iwl_measurement_status { +enum iwl4965_measurement_status { IWL_MEASUREMENT_OK = 0, IWL_MEASUREMENT_CONCURRENT = 1, IWL_MEASUREMENT_CSA_CONFLICT = 2, @@ -971,18 +971,18 @@ enum iwl_measurement_status { #define NUM_ELEMENTS_IN_HISTOGRAM 8 -struct iwl_measurement_histogram { +struct iwl4965_measurement_histogram { __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ } __attribute__ ((packed)); /* clear channel availability counters */ -struct iwl_measurement_cca_counters { +struct iwl4965_measurement_cca_counters { __le32 ofdm; __le32 cck; } __attribute__ ((packed)); -enum iwl_measure_type { +enum iwl4965_measure_type { IWL_MEASURE_BASIC = (1 << 0), IWL_MEASURE_CHANNEL_LOAD = (1 << 1), IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), @@ -995,7 +995,7 @@ enum iwl_measure_type { /* * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) */ -struct iwl_spectrum_notification { +struct iwl4965_spectrum_notification { u8 id; /* measurement id -- 0 or 1 */ u8 token; u8 channel_index; /* index in measurement channel list */ @@ -1003,7 +1003,7 @@ struct iwl_spectrum_notification { __le32 start_time; /* lower 32-bits of TSF */ u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ u8 channel; - u8 type; /* see enum iwl_measurement_type */ + u8 type; /* see enum iwl4965_measurement_type */ u8 reserved1; /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only * valid if applicable for measurement type requested. */ @@ -1013,9 +1013,9 @@ struct iwl_spectrum_notification { u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - * unidentified */ u8 reserved2[3]; - struct iwl_measurement_histogram histogram; + struct iwl4965_measurement_histogram histogram; __le32 stop_time; /* lower 32-bits of TSF */ - __le32 status; /* see iwl_measurement_status */ + __le32 status; /* see iwl4965_measurement_status */ } __attribute__ ((packed)); /****************************************************************************** @@ -1025,7 +1025,7 @@ struct iwl_spectrum_notification { *****************************************************************************/ /** - * struct iwl_powertable_cmd - Power Table Command + * struct iwl4965_powertable_cmd - Power Table Command * @flags: See below: * * POWER_TABLE_CMD = 0x77 (command, has simple generic response) @@ -1058,7 +1058,7 @@ struct iwl_spectrum_notification { #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2) #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3) -struct iwl_powertable_cmd { +struct iwl4965_powertable_cmd { __le16 flags; u8 keep_alive_seconds; u8 debug_flags; @@ -1072,7 +1072,7 @@ struct iwl_powertable_cmd { * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) * 3945 and 4965 identical. */ -struct iwl_sleep_notification { +struct iwl4965_sleep_notification { u8 pm_sleep_mode; u8 pm_wakeup_src; __le16 reserved; @@ -1102,14 +1102,14 @@ enum { #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ -struct iwl_card_state_cmd { +struct iwl4965_card_state_cmd { __le32 status; /* CARD_STATE_CMD_* request new power state */ } __attribute__ ((packed)); /* * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) */ -struct iwl_card_state_notif { +struct iwl4965_card_state_notif { __le32 flags; } __attribute__ ((packed)); @@ -1118,7 +1118,7 @@ struct iwl_card_state_notif { #define RF_CARD_DISABLED 0x04 #define RXON_CARD_DISABLED 0x10 -struct iwl_ct_kill_config { +struct iwl4965_ct_kill_config { __le32 reserved; __le32 critical_temperature_M; __le32 critical_temperature_R; @@ -1130,7 +1130,7 @@ struct iwl_ct_kill_config { * *****************************************************************************/ -struct iwl_scan_channel { +struct iwl4965_scan_channel { /* type is defined as: * 0:0 active (0 - passive) * 1:4 SSID direct @@ -1139,12 +1139,12 @@ struct iwl_scan_channel { */ u8 type; u8 channel; - struct iwl_tx_power tpc; + struct iwl4965_tx_power tpc; __le16 active_dwell; __le16 passive_dwell; } __attribute__ ((packed)); -struct iwl_ssid_ie { +struct iwl4965_ssid_ie { u8 id; u8 len; u8 ssid[32]; @@ -1158,7 +1158,7 @@ struct iwl_ssid_ie { /* * REPLY_SCAN_CMD = 0x80 (command) */ -struct iwl_scan_cmd { +struct iwl4965_scan_cmd { __le16 len; u8 reserved0; u8 channel_count; @@ -1177,14 +1177,14 @@ struct iwl_scan_cmd { __le32 flags; __le32 filter_flags; - struct iwl_tx_cmd tx_cmd; - struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; + struct iwl4965_tx_cmd tx_cmd; + struct iwl4965_ssid_ie direct_scan[PROBE_OPTION_MAX]; u8 data[0]; /* * The channels start after the probe request payload and are of type: * - * struct iwl_scan_channel channels[0]; + * struct iwl4965_scan_channel channels[0]; * * NOTE: Only one band of channels can be scanned per pass. You * can not mix 2.4GHz channels and 5.2GHz channels and must @@ -1201,14 +1201,14 @@ struct iwl_scan_cmd { /* * REPLY_SCAN_CMD = 0x80 (response) */ -struct iwl_scanreq_notification { +struct iwl4965_scanreq_notification { __le32 status; /* 1: okay, 2: cannot fulfill request */ } __attribute__ ((packed)); /* * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) */ -struct iwl_scanstart_notification { +struct iwl4965_scanstart_notification { __le32 tsf_low; __le32 tsf_high; __le32 beacon_timer; @@ -1225,7 +1225,7 @@ struct iwl_scanstart_notification { /* * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) */ -struct iwl_scanresults_notification { +struct iwl4965_scanresults_notification { u8 channel; u8 band; u8 reserved[2]; @@ -1237,7 +1237,7 @@ struct iwl_scanresults_notification { /* * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) */ -struct iwl_scancomplete_notification { +struct iwl4965_scancomplete_notification { u8 scanned_channels; u8 status; u8 reserved; @@ -1256,8 +1256,8 @@ struct iwl_scancomplete_notification { /* * BEACON_NOTIFICATION = 0x90 (notification only, not a command) */ -struct iwl_beacon_notif { - struct iwl_tx_resp beacon_notify_hdr; +struct iwl4965_beacon_notif { + struct iwl4965_tx_resp beacon_notify_hdr; __le32 low_tsf; __le32 high_tsf; __le32 ibss_mgr_status; @@ -1266,8 +1266,8 @@ struct iwl_beacon_notif { /* * REPLY_TX_BEACON = 0x91 (command, has simple generic response) */ -struct iwl_tx_beacon_cmd { - struct iwl_tx_cmd tx; +struct iwl4965_tx_beacon_cmd { + struct iwl4965_tx_cmd tx; __le16 tim_idx; u8 tim_size; u8 reserved1; @@ -1458,7 +1458,7 @@ struct statistics_general { */ #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ -struct iwl_statistics_cmd { +struct iwl4965_statistics_cmd { __le32 configuration_flags; /* IWL_STATS_CONF_* */ } __attribute__ ((packed)); @@ -1479,7 +1479,7 @@ struct iwl_statistics_cmd { */ #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) -struct iwl_notif_statistics { +struct iwl4965_notif_statistics { __le32 flag; struct statistics_rx rx; struct statistics_tx tx; @@ -1494,7 +1494,7 @@ struct iwl_notif_statistics { * then this notification will be sent. */ #define CONSECUTIVE_MISSED_BCONS_TH 20 -struct iwl_missed_beacon_notif { +struct iwl4965_missed_beacon_notif { __le32 consequtive_missed_beacons; __le32 total_missed_becons; __le32 num_expected_beacons; @@ -1510,12 +1510,12 @@ struct iwl_missed_beacon_notif { #define PHY_CALIBRATE_DIFF_GAIN_CMD (7) #define HD_TABLE_SIZE (11) -struct iwl_sensitivity_cmd { +struct iwl4965_sensitivity_cmd { __le16 control; __le16 table[HD_TABLE_SIZE]; } __attribute__ ((packed)); -struct iwl_calibration_cmd { +struct iwl4965_calibration_cmd { u8 opCode; u8 flags; __le16 reserved; @@ -1538,7 +1538,7 @@ struct iwl_calibration_cmd { * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), * this command turns it on or off, or sets up a periodic blinking cycle. */ -struct iwl_led_cmd { +struct iwl4965_led_cmd { __le32 interval; /* "interval" in uSec */ u8 id; /* 1: Activity, 2: Link, 3: Tech */ u8 off; /* # intervals off while blinking; @@ -1554,29 +1554,29 @@ struct iwl_led_cmd { * *****************************************************************************/ -struct iwl_rx_packet { +struct iwl4965_rx_packet { __le32 len; - struct iwl_cmd_header hdr; + struct iwl4965_cmd_header hdr; union { - struct iwl_alive_resp alive_frame; - struct iwl_rx_frame rx_frame; - struct iwl_tx_resp tx_resp; - struct iwl_spectrum_notification spectrum_notif; - struct iwl_csa_notification csa_notif; - struct iwl_error_resp err_resp; - struct iwl_card_state_notif card_state_notif; - struct iwl_beacon_notif beacon_status; - struct iwl_add_sta_resp add_sta; - struct iwl_sleep_notification sleep_notif; - struct iwl_spectrum_resp spectrum; - struct iwl_notif_statistics stats; - struct iwl_compressed_ba_resp compressed_ba; - struct iwl_missed_beacon_notif missed_beacon; + struct iwl4965_alive_resp alive_frame; + struct iwl4965_rx_frame rx_frame; + struct iwl4965_tx_resp tx_resp; + struct iwl4965_spectrum_notification spectrum_notif; + struct iwl4965_csa_notification csa_notif; + struct iwl4965_error_resp err_resp; + struct iwl4965_card_state_notif card_state_notif; + struct iwl4965_beacon_notif beacon_status; + struct iwl4965_add_sta_resp add_sta; + struct iwl4965_sleep_notification sleep_notif; + struct iwl4965_spectrum_resp spectrum; + struct iwl4965_notif_statistics stats; + struct iwl4965_compressed_ba_resp compressed_ba; + struct iwl4965_missed_beacon_notif missed_beacon; __le32 status; u8 raw[0]; } u; } __attribute__ ((packed)); -#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl_rx_frame)) +#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl4965_rx_frame)) -#endif /* __iwl_commands_h__ */ +#endif /* __iwl4965_commands_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-debug.h b/drivers/net/wireless/iwlwifi/iwl-4965-debug.h index 0c74883d2f8..00bc1faece9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-debug.h @@ -26,18 +26,18 @@ * *****************************************************************************/ -#ifndef __iwl_debug_h__ -#define __iwl_debug_h__ +#ifndef __iwl4965_debug_h__ +#define __iwl4965_debug_h__ #ifdef CONFIG_IWL4965_DEBUG -extern u32 iwl_debug_level; +extern u32 iwl4965_debug_level; #define IWL_DEBUG(level, fmt, args...) \ -do { if (iwl_debug_level & (level)) \ +do { if (iwl4965_debug_level & (level)) \ printk(KERN_ERR DRV_NAME": %c %s " fmt, \ in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) #define IWL_DEBUG_LIMIT(level, fmt, args...) \ -do { if ((iwl_debug_level & (level)) && net_ratelimit()) \ +do { if ((iwl4965_debug_level & (level)) && net_ratelimit()) \ printk(KERN_ERR DRV_NAME": %c %s " fmt, \ in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) #else @@ -68,7 +68,7 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) * * % cat /proc/net/iwl/debug_level * - * you simply need to add your entry to the iwl_debug_levels array. + * you simply need to add your entry to the iwl4965_debug_levels array. * * If you do not see debug_level in /proc/net/iwl then you do not have * CONFIG_IWL4965_DEBUG defined in your kernel configuration diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index 4afd69da375..dfaa6077946 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h @@ -137,7 +137,7 @@ enum { #define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7) /* *regulatory* channel data from eeprom, one for each channel */ -struct iwl_eeprom_channel { +struct iwl4965_eeprom_channel { u8 flags; /* flags copied from EEPROM */ s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ } __attribute__ ((packed)); @@ -152,7 +152,7 @@ struct iwl_eeprom_channel { * level. * Data copied from EEPROM. */ -struct iwl_eeprom_txpower_sample { +struct iwl4965_eeprom_txpower_sample { u8 gain_index; /* index into power (gain) setup table ... */ s8 power; /* ... for this pwr level for this chnl group */ u16 v_det; /* PA output voltage */ @@ -166,8 +166,8 @@ struct iwl_eeprom_txpower_sample { * Data copied from EEPROM. * DO NOT ALTER THIS STRUCTURE!!! */ -struct iwl_eeprom_txpower_group { - struct iwl_eeprom_txpower_sample samples[5]; /* 5 power levels */ +struct iwl4965_eeprom_txpower_group { + struct iwl4965_eeprom_txpower_sample samples[5]; /* 5 power levels */ s32 a, b, c, d, e; /* coefficients for voltage->power * formula (signed) */ s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on @@ -185,7 +185,7 @@ struct iwl_eeprom_txpower_group { * difference between current temperature and factory calib temperature. * Data copied from EEPROM. */ -struct iwl_eeprom_temperature_corr { +struct iwl4965_eeprom_temperature_corr { u32 Ta; u32 Tb; u32 Tc; @@ -199,35 +199,35 @@ struct iwl_eeprom_temperature_corr { #define EEPROM_TX_POWER_VERSION (2) #define EEPROM_TX_POWER_VERSION_NEW (5) -struct iwl_eeprom_calib_measure { +struct iwl4965_eeprom_calib_measure { u8 temperature; u8 gain_idx; u8 actual_pow; s8 pa_det; } __attribute__ ((packed)); -struct iwl_eeprom_calib_ch_info { +struct iwl4965_eeprom_calib_ch_info { u8 ch_num; - struct iwl_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS] + struct iwl4965_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS] [EEPROM_TX_POWER_MEASUREMENTS]; } __attribute__ ((packed)); -struct iwl_eeprom_calib_subband_info { +struct iwl4965_eeprom_calib_subband_info { u8 ch_from; u8 ch_to; - struct iwl_eeprom_calib_ch_info ch1; - struct iwl_eeprom_calib_ch_info ch2; + struct iwl4965_eeprom_calib_ch_info ch1; + struct iwl4965_eeprom_calib_ch_info ch2; } __attribute__ ((packed)); -struct iwl_eeprom_calib_info { +struct iwl4965_eeprom_calib_info { u8 saturation_power24; u8 saturation_power52; s16 voltage; /* signed */ - struct iwl_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS]; + struct iwl4965_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS]; } __attribute__ ((packed)); -struct iwl_eeprom { +struct iwl4965_eeprom { u8 reserved0[16]; #define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ u16 device_id; /* abs.ofs: 16 */ @@ -276,30 +276,30 @@ struct iwl_eeprom { #define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */ u16 band_1_count; /* abs.ofs: 196 */ #define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */ - struct iwl_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */ + struct iwl4965_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */ #define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */ u16 band_2_count; /* abs.ofs: 226 */ #define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */ - struct iwl_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ + struct iwl4965_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ #define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */ u16 band_3_count; /* abs.ofs: 254 */ #define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */ - struct iwl_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ + struct iwl4965_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ #define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */ u16 band_4_count; /* abs.ofs: 280 */ #define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */ - struct iwl_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ + struct iwl4965_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ #define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */ u16 band_5_count; /* abs.ofs: 304 */ #define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */ - struct iwl_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ + struct iwl4965_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ u8 reserved10[2]; #define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS (2*0xA0) /* 14 bytes */ - struct iwl_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */ + struct iwl4965_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */ u8 reserved11[2]; #define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8) /* 22 bytes */ - struct iwl_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */ + struct iwl4965_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */ u8 reserved12[6]; #define EEPROM_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */ u16 calib_version; /* abs.ofs: 364 */ @@ -308,7 +308,7 @@ struct iwl_eeprom { u16 satruation_power; /* abs.ofs: 368 */ u8 reserved14[94]; #define EEPROM_IWL_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */ - struct iwl_eeprom_calib_info calib_info; /* abs.ofs: 464 */ + struct iwl4965_eeprom_calib_info calib_info; /* abs.ofs: 464 */ u8 reserved16[140]; /* fill out to full 1024 byte block */ @@ -731,8 +731,8 @@ struct iwl_eeprom { #define TFD_TX_CMD_SLOTS 256 #define TFD_CMD_SLOTS 32 -#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ - sizeof(struct iwl_cmd_meta)) +#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \ + sizeof(struct iwl4965_cmd_meta)) /* * RX related structures and functions @@ -751,7 +751,7 @@ struct iwl_eeprom { #define IWL_MAX_INST_SIZE KDR_RTC_INST_SIZE #define IWL_MAX_DATA_SIZE KDR_RTC_DATA_SIZE -static inline int iwl_hw_valid_rtc_data_addr(u32 addr) +static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr) { return (addr >= RTC_DATA_LOWER_BOUND) && (addr < KDR_RTC_DATA_UPPER_BOUND); @@ -873,7 +873,7 @@ enum { #define CALIB_IWL_TX_ATTEN_GR5_LCH 20 -union iwl_tx_power_dual_stream { +union iwl4965_tx_power_dual_stream { struct { u8 radio_tx_gain[2]; u8 dsp_predis_atten[2]; @@ -1115,20 +1115,20 @@ union iwl_tx_power_dual_stream { #define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100) #define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200) -static inline u8 iwl_hw_get_rate(__le32 rate_n_flags) +static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags) { return le32_to_cpu(rate_n_flags) & 0xFF; } -static inline u16 iwl_hw_get_rate_n_flags(__le32 rate_n_flags) +static inline u16 iwl4965_hw_get_rate_n_flags(__le32 rate_n_flags) { return le32_to_cpu(rate_n_flags) & 0xFFFF; } -static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u16 flags) +static inline __le32 iwl4965_hw_set_rate_n_flags(u8 rate, u16 flags) { return cpu_to_le32(flags|(u16)rate); } -struct iwl_tfd_frame_data { +struct iwl4965_tfd_frame_data { __le32 tb1_addr; __le32 val1; @@ -1156,7 +1156,7 @@ struct iwl_tfd_frame_data { #define IWL_tb2_len_SYM val2 } __attribute__ ((packed)); -struct iwl_tfd_frame { +struct iwl4965_tfd_frame { __le32 val0; /* __le32 rsvd1:24; */ /* __le32 num_tbs:5; */ @@ -1165,7 +1165,7 @@ struct iwl_tfd_frame { #define IWL_num_tbs_SYM val0 /* __le32 rsvd2:1; */ /* __le32 padding:2; */ - struct iwl_tfd_frame_data pa[10]; + struct iwl4965_tfd_frame_data pa[10]; __le32 reserved; } __attribute__ ((packed)); @@ -1191,9 +1191,9 @@ struct iwl4965_sched_queue_byte_cnt_tbl { sizeof(__le16)]; } __attribute__ ((packed)); -/* Base physical address of iwl_shared is provided to KDR_SCD_DRAM_BASE_ADDR - * and &iwl_shared.val0 is provided to FH_RSCSR_CHNL0_STTS_WPTR_REG */ -struct iwl_shared { +/* Base physical address of iwl4965_shared is provided to KDR_SCD_DRAM_BASE_ADDR + * and &iwl4965_shared.val0 is provided to FH_RSCSR_CHNL0_STTS_WPTR_REG */ +struct iwl4965_shared { struct iwl4965_sched_queue_byte_cnt_tbl queues_byte_cnt_tbls[IWL_MAX_NUM_QUEUES]; __le32 val0; @@ -1225,4 +1225,4 @@ struct iwl_shared { __le32 padding2; } __attribute__ ((packed)); -#endif /* __iwl_4965_hw_h__ */ +#endif /* __iwl4965_4965_hw_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-io.h b/drivers/net/wireless/iwlwifi/iwl-4965-io.h index 5c497e4beea..34a0b57eea0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-io.h @@ -26,8 +26,8 @@ * *****************************************************************************/ -#ifndef __iwl_io_h__ -#define __iwl_io_h__ +#ifndef __iwl4965_io_h__ +#define __iwl4965_io_h__ #include @@ -49,8 +49,8 @@ * * If you wish to call the function without any debug or state checking, * you should use the single _ prefix version (as is used by dependent IO - * routines, for example _iwl_read_direct32 calls the non-check version of - * _iwl_read32.) + * routines, for example _iwl4965_read_direct32 calls the non-check version of + * _iwl4965_read32.) * * These declarations are *extremely* useful in quickly isolating code deltas * which result in misconfiguring of the hardware I/O. In combination with @@ -59,39 +59,39 @@ * */ -#define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) +#define _iwl4965_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) #ifdef CONFIG_IWL4965_DEBUG -static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, +static inline void __iwl4965_write32(const char *f, u32 l, struct iwl4965_priv *iwl, u32 ofs, u32 val) { IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); - _iwl_write32(iwl, ofs, val); + _iwl4965_write32(iwl, ofs, val); } -#define iwl_write32(iwl, ofs, val) \ - __iwl_write32(__FILE__, __LINE__, iwl, ofs, val) +#define iwl4965_write32(iwl, ofs, val) \ + __iwl4965_write32(__FILE__, __LINE__, iwl, ofs, val) #else -#define iwl_write32(iwl, ofs, val) _iwl_write32(iwl, ofs, val) +#define iwl4965_write32(iwl, ofs, val) _iwl4965_write32(iwl, ofs, val) #endif -#define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) +#define _iwl4965_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) #ifdef CONFIG_IWL4965_DEBUG -static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs) +static inline u32 __iwl4965_read32(char *f, u32 l, struct iwl4965_priv *iwl, u32 ofs) { IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); - return _iwl_read32(iwl, ofs); + return _iwl4965_read32(iwl, ofs); } -#define iwl_read32(iwl, ofs) __iwl_read32(__FILE__, __LINE__, iwl, ofs) +#define iwl4965_read32(iwl, ofs) __iwl4965_read32(__FILE__, __LINE__, iwl, ofs) #else -#define iwl_read32(p, o) _iwl_read32(p, o) +#define iwl4965_read32(p, o) _iwl4965_read32(p, o) #endif -static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, +static inline int _iwl4965_poll_bit(struct iwl4965_priv *priv, u32 addr, u32 bits, u32 mask, int timeout) { int i = 0; do { - if ((_iwl_read32(priv, addr) & mask) == (bits & mask)) + if ((_iwl4965_read32(priv, addr) & mask) == (bits & mask)) return i; mdelay(10); i += 10; @@ -100,11 +100,11 @@ static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, return -ETIMEDOUT; } #ifdef CONFIG_IWL4965_DEBUG -static inline int __iwl_poll_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 addr, +static inline int __iwl4965_poll_bit(const char *f, u32 l, + struct iwl4965_priv *priv, u32 addr, u32 bits, u32 mask, int timeout) { - int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); + int ret = _iwl4965_poll_bit(priv, addr, bits, mask, timeout); if (unlikely(ret == -ETIMEDOUT)) IWL_DEBUG_IO ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n", @@ -115,47 +115,47 @@ static inline int __iwl_poll_bit(const char *f, u32 l, addr, bits, mask, ret, f, l); return ret; } -#define iwl_poll_bit(iwl, addr, bits, mask, timeout) \ - __iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) +#define iwl4965_poll_bit(iwl, addr, bits, mask, timeout) \ + __iwl4965_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) #else -#define iwl_poll_bit(p, a, b, m, t) _iwl_poll_bit(p, a, b, m, t) +#define iwl4965_poll_bit(p, a, b, m, t) _iwl4965_poll_bit(p, a, b, m, t) #endif -static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) +static inline void _iwl4965_set_bit(struct iwl4965_priv *priv, u32 reg, u32 mask) { - _iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask); + _iwl4965_write32(priv, reg, _iwl4965_read32(priv, reg) | mask); } #ifdef CONFIG_IWL4965_DEBUG -static inline void __iwl_set_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 reg, u32 mask) +static inline void __iwl4965_set_bit(const char *f, u32 l, + struct iwl4965_priv *priv, u32 reg, u32 mask) { - u32 val = _iwl_read32(priv, reg) | mask; + u32 val = _iwl4965_read32(priv, reg) | mask; IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); - _iwl_write32(priv, reg, val); + _iwl4965_write32(priv, reg, val); } -#define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m) +#define iwl4965_set_bit(p, r, m) __iwl4965_set_bit(__FILE__, __LINE__, p, r, m) #else -#define iwl_set_bit(p, r, m) _iwl_set_bit(p, r, m) +#define iwl4965_set_bit(p, r, m) _iwl4965_set_bit(p, r, m) #endif -static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) +static inline void _iwl4965_clear_bit(struct iwl4965_priv *priv, u32 reg, u32 mask) { - _iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask); + _iwl4965_write32(priv, reg, _iwl4965_read32(priv, reg) & ~mask); } #ifdef CONFIG_IWL4965_DEBUG -static inline void __iwl_clear_bit(const char *f, u32 l, - struct iwl_priv *priv, u32 reg, u32 mask) +static inline void __iwl4965_clear_bit(const char *f, u32 l, + struct iwl4965_priv *priv, u32 reg, u32 mask) { - u32 val = _iwl_read32(priv, reg) & ~mask; + u32 val = _iwl4965_read32(priv, reg) & ~mask; IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); - _iwl_write32(priv, reg, val); + _iwl4965_write32(priv, reg, val); } -#define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m) +#define iwl4965_clear_bit(p, r, m) __iwl4965_clear_bit(__FILE__, __LINE__, p, r, m) #else -#define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m) +#define iwl4965_clear_bit(p, r, m) _iwl4965_clear_bit(p, r, m) #endif -static inline int _iwl_grab_nic_access(struct iwl_priv *priv) +static inline int _iwl4965_grab_nic_access(struct iwl4965_priv *priv) { int ret; u32 gp_ctl; @@ -170,7 +170,7 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) "wakes up NIC\n"); /* 10 msec allows time for NIC to complete its data save */ - gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL); + gp_ctl = _iwl4965_read32(priv, CSR_GP_CNTRL); if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { IWL_DEBUG_RF_KILL("Wait for complete power-down, " "gpctl = 0x%08x\n", gp_ctl); @@ -181,8 +181,8 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) } /* this bit wakes up the NIC */ - _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, + _iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); + ret = _iwl4965_poll_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50); @@ -198,106 +198,106 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) } #ifdef CONFIG_IWL4965_DEBUG -static inline int __iwl_grab_nic_access(const char *f, u32 l, - struct iwl_priv *priv) +static inline int __iwl4965_grab_nic_access(const char *f, u32 l, + struct iwl4965_priv *priv) { if (atomic_read(&priv->restrict_refcnt)) IWL_DEBUG_INFO("Grabbing access while already held at " "line %d.\n", l); IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l); - return _iwl_grab_nic_access(priv); + return _iwl4965_grab_nic_access(priv); } -#define iwl_grab_nic_access(priv) \ - __iwl_grab_nic_access(__FILE__, __LINE__, priv) +#define iwl4965_grab_nic_access(priv) \ + __iwl4965_grab_nic_access(__FILE__, __LINE__, priv) #else -#define iwl_grab_nic_access(priv) \ - _iwl_grab_nic_access(priv) +#define iwl4965_grab_nic_access(priv) \ + _iwl4965_grab_nic_access(priv) #endif -static inline void _iwl_release_nic_access(struct iwl_priv *priv) +static inline void _iwl4965_release_nic_access(struct iwl4965_priv *priv) { #ifdef CONFIG_IWL4965_DEBUG if (atomic_dec_and_test(&priv->restrict_refcnt)) #endif - _iwl_clear_bit(priv, CSR_GP_CNTRL, + _iwl4965_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); } #ifdef CONFIG_IWL4965_DEBUG -static inline void __iwl_release_nic_access(const char *f, u32 l, - struct iwl_priv *priv) +static inline void __iwl4965_release_nic_access(const char *f, u32 l, + struct iwl4965_priv *priv) { if (atomic_read(&priv->restrict_refcnt) <= 0) IWL_ERROR("Release unheld nic access at line %d.\n", l); IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l); - _iwl_release_nic_access(priv); + _iwl4965_release_nic_access(priv); } -#define iwl_release_nic_access(priv) \ - __iwl_release_nic_access(__FILE__, __LINE__, priv) +#define iwl4965_release_nic_access(priv) \ + __iwl4965_release_nic_access(__FILE__, __LINE__, priv) #else -#define iwl_release_nic_access(priv) \ - _iwl_release_nic_access(priv) +#define iwl4965_release_nic_access(priv) \ + _iwl4965_release_nic_access(priv) #endif -static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) +static inline u32 _iwl4965_read_direct32(struct iwl4965_priv *priv, u32 reg) { - return _iwl_read32(priv, reg); + return _iwl4965_read32(priv, reg); } #ifdef CONFIG_IWL4965_DEBUG -static inline u32 __iwl_read_direct32(const char *f, u32 l, - struct iwl_priv *priv, u32 reg) +static inline u32 __iwl4965_read_direct32(const char *f, u32 l, + struct iwl4965_priv *priv, u32 reg) { - u32 value = _iwl_read_direct32(priv, reg); + u32 value = _iwl4965_read_direct32(priv, reg); if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access not held from %s %d\n", f, l); IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value, f, l); return value; } -#define iwl_read_direct32(priv, reg) \ - __iwl_read_direct32(__FILE__, __LINE__, priv, reg) +#define iwl4965_read_direct32(priv, reg) \ + __iwl4965_read_direct32(__FILE__, __LINE__, priv, reg) #else -#define iwl_read_direct32 _iwl_read_direct32 +#define iwl4965_read_direct32 _iwl4965_read_direct32 #endif -static inline void _iwl_write_direct32(struct iwl_priv *priv, +static inline void _iwl4965_write_direct32(struct iwl4965_priv *priv, u32 reg, u32 value) { - _iwl_write32(priv, reg, value); + _iwl4965_write32(priv, reg, value); } #ifdef CONFIG_IWL4965_DEBUG -static void __iwl_write_direct32(u32 line, - struct iwl_priv *priv, u32 reg, u32 value) +static void __iwl4965_write_direct32(u32 line, + struct iwl4965_priv *priv, u32 reg, u32 value) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access not held from line %d\n", line); - _iwl_write_direct32(priv, reg, value); + _iwl4965_write_direct32(priv, reg, value); } -#define iwl_write_direct32(priv, reg, value) \ - __iwl_write_direct32(__LINE__, priv, reg, value) +#define iwl4965_write_direct32(priv, reg, value) \ + __iwl4965_write_direct32(__LINE__, priv, reg, value) #else -#define iwl_write_direct32 _iwl_write_direct32 +#define iwl4965_write_direct32 _iwl4965_write_direct32 #endif -static inline void iwl_write_reg_buf(struct iwl_priv *priv, +static inline void iwl4965_write_reg_buf(struct iwl4965_priv *priv, u32 reg, u32 len, u32 *values) { u32 count = sizeof(u32); if ((priv != NULL) && (values != NULL)) { for (; 0 < len; len -= count, reg += count, values++) - _iwl_write_direct32(priv, reg, *values); + _iwl4965_write_direct32(priv, reg, *values); } } -static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, +static inline int _iwl4965_poll_direct_bit(struct iwl4965_priv *priv, u32 addr, u32 mask, int timeout) { int i = 0; do { - if ((_iwl_read_direct32(priv, addr) & mask) == mask) + if ((_iwl4965_read_direct32(priv, addr) & mask) == mask) return i; mdelay(10); i += 10; @@ -307,11 +307,11 @@ static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, } #ifdef CONFIG_IWL4965_DEBUG -static inline int __iwl_poll_direct_bit(const char *f, u32 l, - struct iwl_priv *priv, +static inline int __iwl4965_poll_direct_bit(const char *f, u32 l, + struct iwl4965_priv *priv, u32 addr, u32 mask, int timeout) { - int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout); + int ret = _iwl4965_poll_direct_bit(priv, addr, mask, timeout); if (unlikely(ret == -ETIMEDOUT)) IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - " @@ -321,111 +321,111 @@ static inline int __iwl_poll_direct_bit(const char *f, u32 l, "- %s %d\n", addr, mask, ret, f, l); return ret; } -#define iwl_poll_direct_bit(iwl, addr, mask, timeout) \ - __iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) +#define iwl4965_poll_direct_bit(iwl, addr, mask, timeout) \ + __iwl4965_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) #else -#define iwl_poll_direct_bit _iwl_poll_direct_bit +#define iwl4965_poll_direct_bit _iwl4965_poll_direct_bit #endif -static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) +static inline u32 _iwl4965_read_prph(struct iwl4965_priv *priv, u32 reg) { - _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); - return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); + _iwl4965_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); + return _iwl4965_read_direct32(priv, HBUS_TARG_PRPH_RDAT); } #ifdef CONFIG_IWL4965_DEBUG -static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) +static inline u32 __iwl4965_read_prph(u32 line, struct iwl4965_priv *priv, u32 reg) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access not held from line %d\n", line); - return _iwl_read_prph(priv, reg); + return _iwl4965_read_prph(priv, reg); } -#define iwl_read_prph(priv, reg) \ - __iwl_read_prph(__LINE__, priv, reg) +#define iwl4965_read_prph(priv, reg) \ + __iwl4965_read_prph(__LINE__, priv, reg) #else -#define iwl_read_prph _iwl_read_prph +#define iwl4965_read_prph _iwl4965_read_prph #endif -static inline void _iwl_write_prph(struct iwl_priv *priv, +static inline void _iwl4965_write_prph(struct iwl4965_priv *priv, u32 addr, u32 val) { - _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, + _iwl4965_write_direct32(priv, HBUS_TARG_PRPH_WADDR, ((addr & 0x0000FFFF) | (3 << 24))); - _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); + _iwl4965_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); } #ifdef CONFIG_IWL4965_DEBUG -static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, +static inline void __iwl4965_write_prph(u32 line, struct iwl4965_priv *priv, u32 addr, u32 val) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access from line %d\n", line); - _iwl_write_prph(priv, addr, val); + _iwl4965_write_prph(priv, addr, val); } -#define iwl_write_prph(priv, addr, val) \ - __iwl_write_prph(__LINE__, priv, addr, val); +#define iwl4965_write_prph(priv, addr, val) \ + __iwl4965_write_prph(__LINE__, priv, addr, val); #else -#define iwl_write_prph _iwl_write_prph +#define iwl4965_write_prph _iwl4965_write_prph #endif -#define _iwl_set_bits_prph(priv, reg, mask) \ - _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) +#define _iwl4965_set_bits_prph(priv, reg, mask) \ + _iwl4965_write_prph(priv, reg, (_iwl4965_read_prph(priv, reg) | mask)) #ifdef CONFIG_IWL4965_DEBUG -static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, +static inline void __iwl4965_set_bits_prph(u32 line, struct iwl4965_priv *priv, u32 reg, u32 mask) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access not held from line %d\n", line); - _iwl_set_bits_prph(priv, reg, mask); + _iwl4965_set_bits_prph(priv, reg, mask); } -#define iwl_set_bits_prph(priv, reg, mask) \ - __iwl_set_bits_prph(__LINE__, priv, reg, mask) +#define iwl4965_set_bits_prph(priv, reg, mask) \ + __iwl4965_set_bits_prph(__LINE__, priv, reg, mask) #else -#define iwl_set_bits_prph _iwl_set_bits_prph +#define iwl4965_set_bits_prph _iwl4965_set_bits_prph #endif -#define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ - _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) +#define _iwl4965_set_bits_mask_prph(priv, reg, bits, mask) \ + _iwl4965_write_prph(priv, reg, ((_iwl4965_read_prph(priv, reg) & mask) | bits)) #ifdef CONFIG_IWL4965_DEBUG -static inline void __iwl_set_bits_mask_prph(u32 line, - struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) +static inline void __iwl4965_set_bits_mask_prph(u32 line, + struct iwl4965_priv *priv, u32 reg, u32 bits, u32 mask) { if (!atomic_read(&priv->restrict_refcnt)) IWL_ERROR("Nic access not held from line %d\n", line); - _iwl_set_bits_mask_prph(priv, reg, bits, mask); + _iwl4965_set_bits_mask_prph(priv, reg, bits, mask); } -#define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ - __iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) +#define iwl4965_set_bits_mask_prph(priv, reg, bits, mask) \ + __iwl4965_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) #else -#define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph +#define iwl4965_set_bits_mask_prph _iwl4965_set_bits_mask_prph #endif -static inline void iwl_clear_bits_prph(struct iwl_priv +static inline void iwl4965_clear_bits_prph(struct iwl4965_priv *priv, u32 reg, u32 mask) { - u32 val = _iwl_read_prph(priv, reg); - _iwl_write_prph(priv, reg, (val & ~mask)); + u32 val = _iwl4965_read_prph(priv, reg); + _iwl4965_write_prph(priv, reg, (val & ~mask)); } -static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) +static inline u32 iwl4965_read_targ_mem(struct iwl4965_priv *priv, u32 addr) { - iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); - return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); + iwl4965_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); + return iwl4965_read_direct32(priv, HBUS_TARG_MEM_RDAT); } -static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) +static inline void iwl4965_write_targ_mem(struct iwl4965_priv *priv, u32 addr, u32 val) { - iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); - iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); + iwl4965_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + iwl4965_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); } -static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, +static inline void iwl4965_write_targ_mem_buf(struct iwl4965_priv *priv, u32 addr, u32 len, u32 *values) { - iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); + iwl4965_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); for (; 0 < len; len -= sizeof(u32), values++) - iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); + iwl4965_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); } #endif diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 2163805158b..8d3d9f72a8c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c @@ -65,11 +65,11 @@ static u8 rs_ht_to_legacy[] = { IWL_RATE_48M_INDEX, IWL_RATE_54M_INDEX }; -struct iwl_rate { +struct iwl4965_rate { u32 rate_n_flags; } __attribute__ ((packed)); -struct iwl_rate_scale_data { +struct iwl4965_rate_scale_data { u64 data; s32 success_counter; s32 success_ratio; @@ -78,19 +78,19 @@ struct iwl_rate_scale_data { unsigned long stamp; }; -struct iwl_scale_tbl_info { - enum iwl_table_type lq_type; - enum iwl_antenna_type antenna_type; +struct iwl4965_scale_tbl_info { + enum iwl4965_table_type lq_type; + enum iwl4965_antenna_type antenna_type; u8 is_SGI; u8 is_fat; u8 is_dup; u8 action; s32 *expected_tpt; - struct iwl_rate current_rate; - struct iwl_rate_scale_data win[IWL_RATE_COUNT]; + struct iwl4965_rate current_rate; + struct iwl4965_rate_scale_data win[IWL_RATE_COUNT]; }; -struct iwl_rate_scale_priv { +struct iwl4965_rate_scale_priv { u8 active_tbl; u8 enable_counter; u8 stay_in_tbl; @@ -115,31 +115,31 @@ struct iwl_rate_scale_priv { u16 active_siso_rate; u16 active_mimo_rate; u16 active_rate_basic; - struct iwl_link_quality_cmd lq; - struct iwl_scale_tbl_info lq_info[LQ_SIZE]; + struct iwl4965_link_quality_cmd lq; + struct iwl4965_scale_tbl_info lq_info[LQ_SIZE]; #ifdef CONFIG_MAC80211_DEBUGFS struct dentry *rs_sta_dbgfs_scale_table_file; struct dentry *rs_sta_dbgfs_stats_table_file; - struct iwl_rate dbg_fixed; - struct iwl_priv *drv; + struct iwl4965_rate dbg_fixed; + struct iwl4965_priv *drv; #endif }; -static void rs_rate_scale_perform(struct iwl_priv *priv, +static void rs_rate_scale_perform(struct iwl4965_priv *priv, struct net_device *dev, struct ieee80211_hdr *hdr, struct sta_info *sta); -static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, - struct iwl_rate *tx_mcs, - struct iwl_link_quality_cmd *tbl); +static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, + struct iwl4965_rate *tx_mcs, + struct iwl4965_link_quality_cmd *tbl); #ifdef CONFIG_MAC80211_DEBUGFS -static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, - struct iwl_rate *mcs, int index); +static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv, + struct iwl4965_rate *mcs, int index); #else -static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, - struct iwl_rate *mcs, int index) +static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv, + struct iwl4965_rate *mcs, int index) {} #endif static s32 expected_tpt_A[IWL_RATE_COUNT] = { @@ -182,27 +182,27 @@ static s32 expected_tpt_mimo40MHzSGI[IWL_RATE_COUNT] = { 0, 0, 0, 0, 131, 131, 191, 222, 242, 270, 284, 289, 293 }; -static int iwl_lq_sync_callback(struct iwl_priv *priv, - struct iwl_cmd *cmd, struct sk_buff *skb) +static int iwl4965_lq_sync_callback(struct iwl4965_priv *priv, + struct iwl4965_cmd *cmd, struct sk_buff *skb) { /*We didn't cache the SKB; let the caller free it */ return 1; } -static inline u8 iwl_rate_get_rate(u32 rate_n_flags) +static inline u8 iwl4965_rate_get_rate(u32 rate_n_flags) { return (u8)(rate_n_flags & 0xFF); } -static int rs_send_lq_cmd(struct iwl_priv *priv, - struct iwl_link_quality_cmd *lq, u8 flags) +static int rs_send_lq_cmd(struct iwl4965_priv *priv, + struct iwl4965_link_quality_cmd *lq, u8 flags) { #ifdef CONFIG_IWL4965_DEBUG int i; #endif - struct iwl_host_cmd cmd = { + struct iwl4965_host_cmd cmd = { .id = REPLY_TX_LINK_QUALITY_CMD, - .len = sizeof(struct iwl_link_quality_cmd), + .len = sizeof(struct iwl4965_link_quality_cmd), .meta.flags = flags, .data = lq, }; @@ -225,16 +225,16 @@ static int rs_send_lq_cmd(struct iwl_priv *priv, #endif if (flags & CMD_ASYNC) - cmd.meta.u.callback = iwl_lq_sync_callback; + cmd.meta.u.callback = iwl4965_lq_sync_callback; - if (iwl_is_associated(priv) && priv->assoc_station_added && + if (iwl4965_is_associated(priv) && priv->assoc_station_added && priv->lq_mngr.lq_ready) - return iwl_send_cmd(priv, &cmd); + return iwl4965_send_cmd(priv, &cmd); return 0; } -static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) +static void rs_rate_scale_clear_window(struct iwl4965_rate_scale_data *window) { window->data = 0; window->success_counter = 0; @@ -244,10 +244,10 @@ static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) window->stamp = 0; } -static int rs_collect_tx_data(struct iwl_rate_scale_data *windows, +static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows, int scale_index, s32 tpt, u32 status) { - struct iwl_rate_scale_data *window = NULL; + struct iwl4965_rate_scale_data *window = NULL; u64 mask; u8 win_size = IWL_RATE_MAX_WINDOW; s32 fail_count; @@ -295,24 +295,24 @@ static int rs_collect_tx_data(struct iwl_rate_scale_data *windows, return 0; } -static void rs_mcs_from_tbl(struct iwl_rate *mcs_rate, - struct iwl_scale_tbl_info *tbl, +static void rs_mcs_from_tbl(struct iwl4965_rate *mcs_rate, + struct iwl4965_scale_tbl_info *tbl, int index, u8 use_green) { if (is_legacy(tbl->lq_type)) { - mcs_rate->rate_n_flags = iwl_rates[index].plcp; + mcs_rate->rate_n_flags = iwl4965_rates[index].plcp; if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE) mcs_rate->rate_n_flags |= RATE_MCS_CCK_MSK; } else if (is_siso(tbl->lq_type)) { if (index > IWL_LAST_OFDM_RATE) index = IWL_LAST_OFDM_RATE; - mcs_rate->rate_n_flags = iwl_rates[index].plcp_siso | + mcs_rate->rate_n_flags = iwl4965_rates[index].plcp_siso | RATE_MCS_HT_MSK; } else { if (index > IWL_LAST_OFDM_RATE) index = IWL_LAST_OFDM_RATE; - mcs_rate->rate_n_flags = iwl_rates[index].plcp_mimo | + mcs_rate->rate_n_flags = iwl4965_rates[index].plcp_mimo | RATE_MCS_HT_MSK; } @@ -349,14 +349,14 @@ static void rs_mcs_from_tbl(struct iwl_rate *mcs_rate, } } -static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate, - int phymode, struct iwl_scale_tbl_info *tbl, +static int rs_get_tbl_info_from_mcs(const struct iwl4965_rate *mcs_rate, + int phymode, struct iwl4965_scale_tbl_info *tbl, int *rate_idx) { int index; u32 ant_msk; - index = iwl_rate_index_from_plcp(mcs_rate->rate_n_flags); + index = iwl4965_rate_index_from_plcp(mcs_rate->rate_n_flags); if (index == IWL_RATE_INVALID) { *rate_idx = -1; @@ -386,7 +386,7 @@ static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate, } *rate_idx = index; - } else if (iwl_rate_get_rate(mcs_rate->rate_n_flags) + } else if (iwl4965_rate_get_rate(mcs_rate->rate_n_flags) <= IWL_RATE_SISO_60M_PLCP) { tbl->lq_type = LQ_SISO; @@ -426,8 +426,8 @@ static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate, return 0; } -static inline void rs_toggle_antenna(struct iwl_rate *new_rate, - struct iwl_scale_tbl_info *tbl) +static inline void rs_toggle_antenna(struct iwl4965_rate *new_rate, + struct iwl4965_scale_tbl_info *tbl) { if (tbl->antenna_type == ANT_AUX) { tbl->antenna_type = ANT_MAIN; @@ -440,7 +440,7 @@ static inline void rs_toggle_antenna(struct iwl_rate *new_rate, } } -static inline u8 rs_use_green(struct iwl_priv *priv) +static inline u8 rs_use_green(struct iwl4965_priv *priv) { #ifdef CONFIG_IWL4965_HT if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht) @@ -459,9 +459,9 @@ static inline u8 rs_use_green(struct iwl_priv *priv) * basic available rates. * */ -static void rs_get_supported_rates(struct iwl_rate_scale_priv *lq_data, +static void rs_get_supported_rates(struct iwl4965_rate_scale_priv *lq_data, struct ieee80211_hdr *hdr, - enum iwl_table_type rate_type, + enum iwl4965_table_type rate_type, u16 *data_rate) { if (is_legacy(rate_type)) @@ -512,7 +512,7 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type) low = index; while (low != IWL_RATE_INVALID) { - low = iwl_rates[low].prev_rs; + low = iwl4965_rates[low].prev_rs; if (low == IWL_RATE_INVALID) break; if (rate_mask & (1 << low)) @@ -522,7 +522,7 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type) high = index; while (high != IWL_RATE_INVALID) { - high = iwl_rates[high].next_rs; + high = iwl4965_rates[high].next_rs; if (high == IWL_RATE_INVALID) break; if (rate_mask & (1 << high)) @@ -533,9 +533,9 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type) return (high << 8) | low; } -static void rs_get_lower_rate(struct iwl_rate_scale_priv *lq_data, - struct iwl_scale_tbl_info *tbl, u8 scale_index, - u8 ht_possible, struct iwl_rate *mcs_rate) +static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data, + struct iwl4965_scale_tbl_info *tbl, u8 scale_index, + u8 ht_possible, struct iwl4965_rate *mcs_rate) { s32 low; u16 rate_mask; @@ -596,17 +596,17 @@ static void rs_tx_status(void *priv_rate, int status; u8 retries; int rs_index, index = 0; - struct iwl_rate_scale_priv *lq; - struct iwl_link_quality_cmd *table; + struct iwl4965_rate_scale_priv *lq; + struct iwl4965_link_quality_cmd *table; struct sta_info *sta; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct iwl_priv *priv = (struct iwl_priv *)priv_rate; + struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate; struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); - struct iwl_rate_scale_data *window = NULL; - struct iwl_rate_scale_data *search_win = NULL; - struct iwl_rate tx_mcs; - struct iwl_scale_tbl_info tbl_type; - struct iwl_scale_tbl_info *curr_tbl, *search_tbl; + struct iwl4965_rate_scale_data *window = NULL; + struct iwl4965_rate_scale_data *search_win = NULL; + struct iwl4965_rate tx_mcs; + struct iwl4965_scale_tbl_info tbl_type; + struct iwl4965_scale_tbl_info *curr_tbl, *search_tbl; u8 active_index = 0; u16 fc = le16_to_cpu(hdr->frame_control); s32 tpt = 0; @@ -630,7 +630,7 @@ static void rs_tx_status(void *priv_rate, return; } - lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; + lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv; if (!priv->lq_mngr.lq_ready) return; @@ -648,9 +648,9 @@ static void rs_tx_status(void *priv_rate, lq->antenna = lq->valid_antenna; curr_tbl = &(lq->lq_info[active_index]); search_tbl = &(lq->lq_info[(1 - active_index)]); - window = (struct iwl_rate_scale_data *) + window = (struct iwl4965_rate_scale_data *) &(curr_tbl->win[0]); - search_win = (struct iwl_rate_scale_data *) + search_win = (struct iwl4965_rate_scale_data *) &(search_tbl->win[0]); tx_mcs.rate_n_flags = tx_resp->control.tx_rate; @@ -751,7 +751,7 @@ static void rs_tx_status(void *priv_rate, } static u8 rs_is_ant_connected(u8 valid_antenna, - enum iwl_antenna_type antenna_type) + enum iwl4965_antenna_type antenna_type) { if (antenna_type == ANT_AUX) return ((valid_antenna & 0x2) ? 1:0); @@ -764,7 +764,7 @@ static u8 rs_is_ant_connected(u8 valid_antenna, } static u8 rs_is_other_ant_connected(u8 valid_antenna, - enum iwl_antenna_type antenna_type) + enum iwl4965_antenna_type antenna_type) { if (antenna_type == ANT_AUX) return rs_is_ant_connected(valid_antenna, ANT_MAIN); @@ -775,7 +775,7 @@ static u8 rs_is_other_ant_connected(u8 valid_antenna, } static void rs_set_stay_in_table(u8 is_legacy, - struct iwl_rate_scale_priv *lq_data) + struct iwl4965_rate_scale_priv *lq_data) { IWL_DEBUG_HT("we are staying in the same table\n"); lq_data->stay_in_tbl = 1; @@ -793,8 +793,8 @@ static void rs_set_stay_in_table(u8 is_legacy, lq_data->total_success = 0; } -static void rs_get_expected_tpt_table(struct iwl_rate_scale_priv *lq_data, - struct iwl_scale_tbl_info *tbl) +static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data, + struct iwl4965_scale_tbl_info *tbl) { if (is_legacy(tbl->lq_type)) { if (!is_a_band(tbl->lq_type)) @@ -827,12 +827,12 @@ static void rs_get_expected_tpt_table(struct iwl_rate_scale_priv *lq_data, } #ifdef CONFIG_IWL4965_HT -static s32 rs_get_best_rate(struct iwl_priv *priv, - struct iwl_rate_scale_priv *lq_data, - struct iwl_scale_tbl_info *tbl, +static s32 rs_get_best_rate(struct iwl4965_priv *priv, + struct iwl4965_rate_scale_priv *lq_data, + struct iwl4965_scale_tbl_info *tbl, u16 rate_mask, s8 index, s8 rate) { - struct iwl_scale_tbl_info *active_tbl = + struct iwl4965_scale_tbl_info *active_tbl = &(lq_data->lq_info[lq_data->active_tbl]); s32 new_rate, high, low, start_hi; s32 active_sr = active_tbl->win[index].success_ratio; @@ -886,9 +886,9 @@ static inline u8 rs_is_both_ant_supp(u8 valid_antenna) return (rs_is_ant_connected(valid_antenna, ANT_BOTH)); } -static int rs_switch_to_mimo(struct iwl_priv *priv, - struct iwl_rate_scale_priv *lq_data, - struct iwl_scale_tbl_info *tbl, int index) +static int rs_switch_to_mimo(struct iwl4965_priv *priv, + struct iwl4965_rate_scale_priv *lq_data, + struct iwl4965_scale_tbl_info *tbl, int index) { #ifdef CONFIG_IWL4965_HT u16 rate_mask; @@ -943,9 +943,9 @@ static int rs_switch_to_mimo(struct iwl_priv *priv, #endif /*CONFIG_IWL4965_HT */ } -static int rs_switch_to_siso(struct iwl_priv *priv, - struct iwl_rate_scale_priv *lq_data, - struct iwl_scale_tbl_info *tbl, int index) +static int rs_switch_to_siso(struct iwl4965_priv *priv, + struct iwl4965_rate_scale_priv *lq_data, + struct iwl4965_scale_tbl_info *tbl, int index) { #ifdef CONFIG_IWL4965_HT u16 rate_mask; @@ -999,18 +999,18 @@ static int rs_switch_to_siso(struct iwl_priv *priv, #endif /*CONFIG_IWL4965_HT */ } -static int rs_move_legacy_other(struct iwl_priv *priv, - struct iwl_rate_scale_priv *lq_data, +static int rs_move_legacy_other(struct iwl4965_priv *priv, + struct iwl4965_rate_scale_priv *lq_data, int index) { int ret = 0; - struct iwl_scale_tbl_info *tbl = + struct iwl4965_scale_tbl_info *tbl = &(lq_data->lq_info[lq_data->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = + struct iwl4965_scale_tbl_info *search_tbl = &(lq_data->lq_info[(1 - lq_data->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); + struct iwl4965_rate_scale_data *window = &(tbl->win[index]); + u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - + (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); u8 start_action = tbl->action; for (; ;) { @@ -1083,19 +1083,19 @@ static int rs_move_legacy_other(struct iwl_priv *priv, } -static int rs_move_siso_to_other(struct iwl_priv *priv, - struct iwl_rate_scale_priv *lq_data, +static int rs_move_siso_to_other(struct iwl4965_priv *priv, + struct iwl4965_rate_scale_priv *lq_data, int index) { int ret; u8 is_green = lq_data->is_green; - struct iwl_scale_tbl_info *tbl = + struct iwl4965_scale_tbl_info *tbl = &(lq_data->lq_info[lq_data->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = + struct iwl4965_scale_tbl_info *search_tbl = &(lq_data->lq_info[(1 - lq_data->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); + struct iwl4965_rate_scale_data *window = &(tbl->win[index]); + u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - + (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); u8 start_action = tbl->action; for (;;) { @@ -1173,18 +1173,18 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, return 0; } -static int rs_move_mimo_to_other(struct iwl_priv *priv, - struct iwl_rate_scale_priv *lq_data, +static int rs_move_mimo_to_other(struct iwl4965_priv *priv, + struct iwl4965_rate_scale_priv *lq_data, int index) { int ret; s8 is_green = lq_data->is_green; - struct iwl_scale_tbl_info *tbl = + struct iwl4965_scale_tbl_info *tbl = &(lq_data->lq_info[lq_data->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = + struct iwl4965_scale_tbl_info *search_tbl = &(lq_data->lq_info[(1 - lq_data->active_tbl)]); - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); + u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - + (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); u8 start_action = tbl->action; for (;;) { @@ -1253,9 +1253,9 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv, } -static void rs_stay_in_table(struct iwl_rate_scale_priv *lq_data) +static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data) { - struct iwl_scale_tbl_info *tbl; + struct iwl4965_scale_tbl_info *tbl; int i; int active_tbl; int flush_interval_passed = 0; @@ -1305,7 +1305,7 @@ static void rs_stay_in_table(struct iwl_rate_scale_priv *lq_data) } } -static void rs_rate_scale_perform(struct iwl_priv *priv, +static void rs_rate_scale_perform(struct iwl4965_priv *priv, struct net_device *dev, struct ieee80211_hdr *hdr, struct sta_info *sta) @@ -1314,7 +1314,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, int high = IWL_RATE_INVALID; int index; int i; - struct iwl_rate_scale_data *window = NULL; + struct iwl4965_rate_scale_data *window = NULL; int current_tpt = IWL_INVALID_VALUE; int low_tpt = IWL_INVALID_VALUE; int high_tpt = IWL_INVALID_VALUE; @@ -1322,10 +1322,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, s8 scale_action = 0; u16 fc, rate_mask; u8 update_lq = 0; - struct iwl_rate_scale_priv *lq_data; - struct iwl_scale_tbl_info *tbl, *tbl1; + struct iwl4965_rate_scale_priv *lq_data; + struct iwl4965_scale_tbl_info *tbl, *tbl1; u16 rate_scale_index_msk = 0; - struct iwl_rate mcs_rate; + struct iwl4965_rate mcs_rate; u8 is_green = 0; u8 active_tbl = 0; u8 done_search = 0; @@ -1348,7 +1348,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, IWL_DEBUG_RATE("still rate scaling not ready\n"); return; } - lq_data = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; + lq_data = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv; if (!lq_data->search_better_tbl) active_tbl = lq_data->active_tbl; @@ -1445,7 +1445,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, active_tbl = lq_data->active_tbl; tbl = &(lq_data->lq_info[active_tbl]); - index = iwl_rate_index_from_plcp( + index = iwl4965_rate_index_from_plcp( tbl->current_rate.rate_n_flags); update_lq = 1; @@ -1559,7 +1559,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, for (i = 0; i < IWL_RATE_COUNT; i++) rs_rate_scale_clear_window(&(tbl->win[i])); - index = iwl_rate_index_from_plcp( + index = iwl4965_rate_index_from_plcp( tbl->current_rate.rate_n_flags); IWL_DEBUG_HT("Switch current mcs: %X index: %d\n", @@ -1615,21 +1615,21 @@ out: } -static void rs_initialize_lq(struct iwl_priv *priv, +static void rs_initialize_lq(struct iwl4965_priv *priv, struct sta_info *sta) { int i; - struct iwl_rate_scale_priv *lq; - struct iwl_scale_tbl_info *tbl; + struct iwl4965_rate_scale_priv *lq; + struct iwl4965_scale_tbl_info *tbl; u8 active_tbl = 0; int rate_idx; u8 use_green = rs_use_green(priv); - struct iwl_rate mcs_rate; + struct iwl4965_rate mcs_rate; if (!sta || !sta->rate_ctrl_priv) goto out; - lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; + lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv; i = sta->last_txrate; if ((lq->lq.sta_id == 0xff) && @@ -1646,7 +1646,7 @@ static void rs_initialize_lq(struct iwl_priv *priv, if ((i < 0) || (i >= IWL_RATE_COUNT)) i = 0; - mcs_rate.rate_n_flags = iwl_rates[i].plcp ; + mcs_rate.rate_n_flags = iwl4965_rates[i].plcp ; mcs_rate.rate_n_flags |= RATE_MCS_ANT_B_MSK; mcs_rate.rate_n_flags &= ~RATE_MCS_ANT_A_MSK; @@ -1676,8 +1676,8 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct sta_info *sta; - struct iwl_priv *priv = (struct iwl_priv *)priv_rate; - struct iwl_rate_scale_priv *lq; + struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate; + struct iwl4965_rate_scale_priv *lq; IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); @@ -1690,17 +1690,17 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, return; } - lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; + lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv; i = sta->last_txrate; if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && !lq->ibss_sta_added) { - u8 sta_id = iwl_hw_find_station(priv, hdr->addr1); + u8 sta_id = iwl4965_hw_find_station(priv, hdr->addr1); DECLARE_MAC_BUF(mac); if (sta_id == IWL_INVALID_STATION) { IWL_DEBUG_RATE("LQ: ADD station %s\n", print_mac(mac, hdr->addr1)); - sta_id = iwl_add_station(priv, + sta_id = iwl4965_add_station_flags(priv, hdr->addr1, 0, CMD_ASYNC); } if ((sta_id != IWL_INVALID_STATION)) { @@ -1725,12 +1725,12 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, static void *rs_alloc_sta(void *priv, gfp_t gfp) { - struct iwl_rate_scale_priv *crl; + struct iwl4965_rate_scale_priv *crl; int i, j; IWL_DEBUG_RATE("create station rate scale window\n"); - crl = kzalloc(sizeof(struct iwl_rate_scale_priv), gfp); + crl = kzalloc(sizeof(struct iwl4965_rate_scale_priv), gfp); if (crl == NULL) return NULL; @@ -1750,8 +1750,8 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, { int i, j; struct ieee80211_hw_mode *mode = local->oper_hw_mode; - struct iwl_priv *priv = (struct iwl_priv *)priv_rate; - struct iwl_rate_scale_priv *crl = priv_sta; + struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate; + struct iwl4965_rate_scale_priv *crl = priv_sta; crl->flush_timer = 0; crl->supp_rates = sta->supp_rates; @@ -1768,7 +1768,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, crl->ibss_sta_added = 0; if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { - u8 sta_id = iwl_hw_find_station(priv, sta->addr); + u8 sta_id = iwl4965_hw_find_station(priv, sta->addr); DECLARE_MAC_BUF(mac); /* for IBSS the call are from tasklet */ @@ -1778,7 +1778,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, if (sta_id == IWL_INVALID_STATION) { IWL_DEBUG_RATE("LQ: ADD station %s\n", print_mac(mac, sta->addr)); - sta_id = iwl_add_station(priv, + sta_id = iwl4965_add_station_flags(priv, sta->addr, 0, CMD_ASYNC); } if ((sta_id != IWL_INVALID_STATION)) { @@ -1832,17 +1832,17 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, rs_initialize_lq(priv, sta); } -static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, - struct iwl_rate *tx_mcs, - struct iwl_link_quality_cmd *lq_cmd) +static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, + struct iwl4965_rate *tx_mcs, + struct iwl4965_link_quality_cmd *lq_cmd) { int index = 0; int rate_idx; int repeat_rate = 0; u8 ant_toggle_count = 0; u8 use_ht_possible = 1; - struct iwl_rate new_rate; - struct iwl_scale_tbl_info tbl_type = { 0 }; + struct iwl4965_rate new_rate; + struct iwl4965_scale_tbl_info tbl_type = { 0 }; rs_dbgfs_set_mcs(lq_data, tx_mcs, index); @@ -1935,7 +1935,7 @@ static void rs_free(void *priv_rate) static void rs_clear(void *priv_rate) { - struct iwl_priv *priv = (struct iwl_priv *) priv_rate; + struct iwl4965_priv *priv = (struct iwl4965_priv *) priv_rate; IWL_DEBUG_RATE("enter\n"); @@ -1952,7 +1952,7 @@ static void rs_clear(void *priv_rate) static void rs_free_sta(void *priv, void *priv_sta) { - struct iwl_rate_scale_priv *rs_priv = priv_sta; + struct iwl4965_rate_scale_priv *rs_priv = priv_sta; IWL_DEBUG_RATE("enter\n"); kfree(rs_priv); @@ -1966,8 +1966,8 @@ static int open_file_generic(struct inode *inode, struct file *file) file->private_data = inode->i_private; return 0; } -static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, - struct iwl_rate *mcs, int index) +static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv, + struct iwl4965_rate *mcs, int index) { u32 base_rate; @@ -1991,7 +1991,7 @@ static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - struct iwl_rate_scale_priv *rs_priv = file->private_data; + struct iwl4965_rate_scale_priv *rs_priv = file->private_data; char buf[64]; int buf_size; u32 parsed_rate; @@ -2028,7 +2028,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, int desc = 0; int i = 0; - struct iwl_rate_scale_priv *rs_priv = file->private_data; + struct iwl4965_rate_scale_priv *rs_priv = file->private_data; desc += sprintf(buff+desc, "sta_id %d\n", rs_priv->lq.sta_id); desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", @@ -2076,7 +2076,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, int desc = 0; int i, j; - struct iwl_rate_scale_priv *rs_priv = file->private_data; + struct iwl4965_rate_scale_priv *rs_priv = file->private_data; for (i = 0; i < LQ_SIZE; i++) { desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n" "rate=0x%X\n", @@ -2105,7 +2105,7 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = { static void rs_add_debugfs(void *priv, void *priv_sta, struct dentry *dir) { - struct iwl_rate_scale_priv *rs_priv = priv_sta; + struct iwl4965_rate_scale_priv *rs_priv = priv_sta; rs_priv->rs_sta_dbgfs_scale_table_file = debugfs_create_file("rate_scale_table", 0600, dir, rs_priv, &rs_sta_dbgfs_scale_table_ops); @@ -2116,7 +2116,7 @@ static void rs_add_debugfs(void *priv, void *priv_sta, static void rs_remove_debugfs(void *priv, void *priv_sta) { - struct iwl_rate_scale_priv *rs_priv = priv_sta; + struct iwl4965_rate_scale_priv *rs_priv = priv_sta; debugfs_remove(rs_priv->rs_sta_dbgfs_scale_table_file); debugfs_remove(rs_priv->rs_sta_dbgfs_stats_table_file); } @@ -2139,11 +2139,11 @@ static struct rate_control_ops rs_ops = { #endif }; -int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) +int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) { struct ieee80211_local *local = hw_to_local(hw); - struct iwl_priv *priv = hw->priv; - struct iwl_rate_scale_priv *rs_priv; + struct iwl4965_priv *priv = hw->priv; + struct iwl4965_rate_scale_priv *rs_priv; struct sta_info *sta; int count = 0, i; u32 samples = 0, success = 0, good = 0; @@ -2176,7 +2176,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) int active = rs_priv->active_tbl; count += - sprintf(&buf[count], " %2dMbs: ", iwl_rates[i].ieee / 2); + sprintf(&buf[count], " %2dMbs: ", iwl4965_rates[i].ieee / 2); mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) @@ -2187,7 +2187,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) samples += rs_priv->lq_info[active].win[i].counter; good += rs_priv->lq_info[active].win[i].success_counter; success += rs_priv->lq_info[active].win[i].success_counter * - iwl_rates[i].ieee; + iwl4965_rates[i].ieee; if (rs_priv->lq_info[active].win[i].stamp) { int delta = @@ -2201,7 +2201,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) } else buf[count++] = '\n'; - j = iwl_get_prev_ieee_rate(i); + j = iwl4965_get_prev_ieee_rate(i); if (j == i) break; i = j; @@ -2210,7 +2210,7 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) /* Display the average rate of all samples taken. * * NOTE: We multiple # of samples by 2 since the IEEE measurement - * added from iwl_rates is actually 2X the rate */ + * added from iwl4965_rates is actually 2X the rate */ if (samples) count += sprintf(&buf[count], "\nAverage rate is %3d.%02dMbs over last %4dms\n" @@ -2227,19 +2227,19 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) return count; } -void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) +void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; priv->lq_mngr.lq_ready = 1; } -void iwl_rate_control_register(struct ieee80211_hw *hw) +void iwl4965_rate_control_register(struct ieee80211_hw *hw) { ieee80211_rate_control_register(&rs_ops); } -void iwl_rate_control_unregister(struct ieee80211_hw *hw) +void iwl4965_rate_control_unregister(struct ieee80211_hw *hw) { ieee80211_rate_control_unregister(&rs_ops); } diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h index f735752abf3..4259099eae7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h @@ -29,7 +29,7 @@ #include "iwl-4965.h" -struct iwl_rate_info { +struct iwl4965_rate_info { u8 plcp; u8 plcp_siso; u8 plcp_mimo; @@ -197,9 +197,9 @@ enum { #define LQ_SIZE 2 -extern const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT]; +extern const struct iwl4965_rate_info iwl4965_rates[IWL_RATE_COUNT]; -enum iwl_table_type { +enum iwl4965_table_type { LQ_NONE, LQ_G, LQ_A, @@ -208,59 +208,59 @@ enum iwl_table_type { LQ_MAX, }; -enum iwl_antenna_type { +enum iwl4965_antenna_type { ANT_NONE, ANT_MAIN, ANT_AUX, ANT_BOTH, }; -static inline u8 iwl_get_prev_ieee_rate(u8 rate_index) +static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index) { - u8 rate = iwl_rates[rate_index].prev_ieee; + u8 rate = iwl4965_rates[rate_index].prev_ieee; if (rate == IWL_RATE_INVALID) rate = rate_index; return rate; } -extern int iwl_rate_index_from_plcp(int plcp); +extern int iwl4965_rate_index_from_plcp(int plcp); /** - * iwl_fill_rs_info - Fill an output text buffer with the rate representation + * iwl4965_fill_rs_info - Fill an output text buffer with the rate representation * * NOTE: This is provided as a quick mechanism for a user to visualize * the performance of the rate control algorithm and is not meant to be * parsed software. */ -extern int iwl_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); +extern int iwl4965_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id); /** - * iwl_rate_scale_init - Initialize the rate scale table based on assoc info + * iwl4965_rate_scale_init - Initialize the rate scale table based on assoc info * * The specific throughput table used is based on the type of network * the associated with, including A, B, G, and G w/ TGG protection */ -extern void iwl_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); +extern void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); /** - * iwl_rate_control_register - Register the rate control algorithm callbacks + * iwl4965_rate_control_register - Register the rate control algorithm callbacks * * Since the rate control algorithm is hardware specific, there is no need * or reason to place it as a stand alone module. The driver can call - * iwl_rate_control_register in order to register the rate control callbacks + * iwl4965_rate_control_register in order to register the rate control callbacks * with the mac80211 subsystem. This should be performed prior to calling * ieee80211_register_hw * */ -extern void iwl_rate_control_register(struct ieee80211_hw *hw); +extern void iwl4965_rate_control_register(struct ieee80211_hw *hw); /** - * iwl_rate_control_unregister - Unregister the rate control callbacks + * iwl4965_rate_control_unregister - Unregister the rate control callbacks * * This should be called after calling ieee80211_unregister_hw, but before * the driver is unloaded. */ -extern void iwl_rate_control_unregister(struct ieee80211_hw *hw); +extern void iwl4965_rate_control_unregister(struct ieee80211_hw *hw); #endif diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 620f125ae30..f7c5ac3072c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -40,7 +40,7 @@ #include "iwl-4965.h" #include "iwl-helpers.h" -static void iwl_hw_card_show_info(struct iwl_priv *priv); +static void iwl4965_hw_card_show_info(struct iwl4965_priv *priv); #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ @@ -62,7 +62,7 @@ static void iwl_hw_card_show_info(struct iwl_priv *priv); * maps to IWL_RATE_INVALID * */ -const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { +const struct iwl4965_rate_info iwl4965_rates[IWL_RATE_COUNT] = { IWL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */ IWL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */ IWL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */ @@ -84,7 +84,7 @@ static int is_fat_channel(__le32 rxon_flags) (rxon_flags & RXON_FLG_CHANNEL_MODE_MIXED_MSK); } -static u8 is_single_stream(struct iwl_priv *priv) +static u8 is_single_stream(struct iwl4965_priv *priv) { #ifdef CONFIG_IWL4965_HT if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht || @@ -103,7 +103,7 @@ static u8 is_single_stream(struct iwl_priv *priv) * MIMO (dual stream) requires at least 2, but works better with 3. * This does not determine *which* chains to use, just how many. */ -static int iwl4965_get_rx_chain_counter(struct iwl_priv *priv, +static int iwl4965_get_rx_chain_counter(struct iwl4965_priv *priv, u8 *idle_state, u8 *rx_state) { u8 is_single = is_single_stream(priv); @@ -132,32 +132,32 @@ static int iwl4965_get_rx_chain_counter(struct iwl_priv *priv, return 0; } -int iwl_hw_rxq_stop(struct iwl_priv *priv) +int iwl4965_hw_rxq_stop(struct iwl4965_priv *priv) { int rc; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } /* stop HW */ - iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); - rc = iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, + iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); + rc = iwl4965_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, (1 << 24), 1000); if (rc < 0) IWL_ERROR("Can't stop Rx DMA.\n"); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; } -u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr) +u8 iwl4965_hw_find_station(struct iwl4965_priv *priv, const u8 *addr) { int i; int start = 0; @@ -189,13 +189,13 @@ u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr) return ret; } -static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) +static int iwl4965_nic_set_pwr_src(struct iwl4965_priv *priv, int pwr_max) { int ret; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - ret = iwl_grab_nic_access(priv); + ret = iwl4965_grab_nic_access(priv); if (ret) { spin_unlock_irqrestore(&priv->lock, flags); return ret; @@ -208,44 +208,44 @@ static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) &val); if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) - iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, + iwl4965_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VAUX, ~APMG_PS_CTRL_MSK_PWR_SRC); } else - iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, + iwl4965_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, ~APMG_PS_CTRL_MSK_PWR_SRC); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return ret; } -static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +static int iwl4965_rx_init(struct iwl4965_priv *priv, struct iwl4965_rx_queue *rxq) { int rc; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } /* stop HW */ - iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); + iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); - iwl_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); - iwl_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, + iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); + iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, rxq->dma_addr >> 8); - iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, + iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, (priv->hw_setting.shared_phys + - offsetof(struct iwl_shared, val0)) >> 4); + offsetof(struct iwl4965_shared, val0)) >> 4); - iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, + iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | IWL_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K | @@ -254,37 +254,37 @@ static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT)); /* - * iwl_write32(priv,CSR_INT_COAL_REG,0); + * iwl4965_write32(priv,CSR_INT_COAL_REG,0); */ - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; } -static int iwl4965_kw_init(struct iwl_priv *priv) +static int iwl4965_kw_init(struct iwl4965_priv *priv) { unsigned long flags; int rc; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) goto out; - iwl_write_direct32(priv, IWL_FH_KW_MEM_ADDR_REG, + iwl4965_write_direct32(priv, IWL_FH_KW_MEM_ADDR_REG, priv->kw.dma_addr >> 4); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); out: spin_unlock_irqrestore(&priv->lock, flags); return rc; } -static int iwl4965_kw_alloc(struct iwl_priv *priv) +static int iwl4965_kw_alloc(struct iwl4965_priv *priv) { struct pci_dev *dev = priv->pci_dev; - struct iwl_kw *kw = &priv->kw; + struct iwl4965_kw *kw = &priv->kw; kw->size = IWL4965_KW_SIZE; /* TBW need set somewhere else */ kw->v_addr = pci_alloc_consistent(dev, kw->size, &kw->dma_addr); @@ -297,14 +297,14 @@ static int iwl4965_kw_alloc(struct iwl_priv *priv) #define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ ? # x " " : "") -int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel, - const struct iwl_eeprom_channel *eeprom_ch, +int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode, u16 channel, + const struct iwl4965_eeprom_channel *eeprom_ch, u8 fat_extension_channel) { - struct iwl_channel_info *ch_info; + struct iwl4965_channel_info *ch_info; - ch_info = (struct iwl_channel_info *) - iwl_get_channel_info(priv, phymode, channel); + ch_info = (struct iwl4965_channel_info *) + iwl4965_get_channel_info(priv, phymode, channel); if (!is_channel_valid(ch_info)) return -1; @@ -337,10 +337,10 @@ int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel, return 0; } -static void iwl4965_kw_free(struct iwl_priv *priv) +static void iwl4965_kw_free(struct iwl4965_priv *priv) { struct pci_dev *dev = priv->pci_dev; - struct iwl_kw *kw = &priv->kw; + struct iwl4965_kw *kw = &priv->kw; if (kw->v_addr) { pci_free_consistent(dev, kw->size, kw->v_addr, kw->dma_addr); @@ -355,7 +355,7 @@ static void iwl4965_kw_free(struct iwl_priv *priv) * @param priv * @return error code */ -static int iwl4965_txq_ctx_reset(struct iwl_priv *priv) +static int iwl4965_txq_ctx_reset(struct iwl4965_priv *priv) { int rc = 0; int txq_id, slots_num; @@ -363,7 +363,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv) iwl4965_kw_free(priv); - iwl_hw_txq_ctx_free(priv); + iwl4965_hw_txq_ctx_free(priv); /* Tx CMD queue */ rc = iwl4965_kw_alloc(priv); @@ -374,15 +374,15 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (unlikely(rc)) { IWL_ERROR("TX reset failed"); spin_unlock_irqrestore(&priv->lock, flags); goto error_reset; } - iwl_write_prph(priv, KDR_SCD_TXFACT, 0); - iwl_release_nic_access(priv); + iwl4965_write_prph(priv, KDR_SCD_TXFACT, 0); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); rc = iwl4965_kw_init(priv); @@ -395,7 +395,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv) for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) { slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; - rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num, + rc = iwl4965_tx_queue_init(priv, &priv->txq[txq_id], slots_num, txq_id); if (rc) { IWL_ERROR("Tx %d queue init failed\n", txq_id); @@ -406,32 +406,32 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv) return rc; error: - iwl_hw_txq_ctx_free(priv); + iwl4965_hw_txq_ctx_free(priv); error_reset: iwl4965_kw_free(priv); error_kw: return rc; } -int iwl_hw_nic_init(struct iwl_priv *priv) +int iwl4965_hw_nic_init(struct iwl4965_priv *priv) { int rc; unsigned long flags; - struct iwl_rx_queue *rxq = &priv->rxq; + struct iwl4965_rx_queue *rxq = &priv->rxq; u8 rev_id; u32 val; u8 val_link; - iwl_power_init_handle(priv); + iwl4965_power_init_handle(priv); /* nic_init */ spin_lock_irqsave(&priv->lock, flags); - iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS, + iwl4965_set_bit(priv, CSR_GIO_CHICKEN_BITS, CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); - iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); - rc = iwl_poll_bit(priv, CSR_GP_CNTRL, + iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); + rc = iwl4965_poll_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); if (rc < 0) { @@ -440,26 +440,26 @@ int iwl_hw_nic_init(struct iwl_priv *priv) return rc; } - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_read_prph(priv, APMG_CLK_CTRL_REG); + iwl4965_read_prph(priv, APMG_CLK_CTRL_REG); - iwl_write_prph(priv, APMG_CLK_CTRL_REG, + iwl4965_write_prph(priv, APMG_CLK_CTRL_REG, APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); - iwl_read_prph(priv, APMG_CLK_CTRL_REG); + iwl4965_read_prph(priv, APMG_CLK_CTRL_REG); udelay(20); - iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, + iwl4965_set_bits_prph(priv, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); - iwl_release_nic_access(priv); - iwl_write32(priv, CSR_INT_COALESCING, 512 / 32); + iwl4965_release_nic_access(priv); + iwl4965_write32(priv, CSR_INT_COALESCING, 512 / 32); spin_unlock_irqrestore(&priv->lock, flags); /* Determine HW type */ @@ -482,7 +482,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); /* Read the EEPROM */ - rc = iwl_eeprom_init(priv); + rc = iwl4965_eeprom_init(priv); if (rc) return rc; @@ -500,49 +500,49 @@ int iwl_hw_nic_init(struct iwl_priv *priv) /* set CSR_HW_CONFIG_REG for uCode use */ - iwl_set_bit(priv, CSR_SW_VER, CSR_HW_IF_CONFIG_REG_BIT_KEDRON_R | + iwl4965_set_bit(priv, CSR_SW_VER, CSR_HW_IF_CONFIG_REG_BIT_KEDRON_R | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc < 0) { spin_unlock_irqrestore(&priv->lock, flags); IWL_DEBUG_INFO("Failed to init the card\n"); return rc; } - iwl_read_prph(priv, APMG_PS_CTRL_REG); - iwl_set_bits_prph(priv, APMG_PS_CTRL_REG, + iwl4965_read_prph(priv, APMG_PS_CTRL_REG); + iwl4965_set_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); udelay(5); - iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG, + iwl4965_clear_bits_prph(priv, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); - iwl_hw_card_show_info(priv); + iwl4965_hw_card_show_info(priv); /* end nic_init */ /* Allocate the RX queue, or reset if it is already allocated */ if (!rxq->bd) { - rc = iwl_rx_queue_alloc(priv); + rc = iwl4965_rx_queue_alloc(priv); if (rc) { IWL_ERROR("Unable to initialize Rx queue\n"); return -ENOMEM; } } else - iwl_rx_queue_reset(priv, rxq); + iwl4965_rx_queue_reset(priv, rxq); - iwl_rx_replenish(priv); + iwl4965_rx_replenish(priv); iwl4965_rx_init(priv, rxq); spin_lock_irqsave(&priv->lock, flags); rxq->need_update = 1; - iwl_rx_queue_update_write_ptr(priv, rxq); + iwl4965_rx_queue_update_write_ptr(priv, rxq); spin_unlock_irqrestore(&priv->lock, flags); rc = iwl4965_txq_ctx_reset(priv); @@ -560,7 +560,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv) return 0; } -int iwl_hw_nic_stop_master(struct iwl_priv *priv) +int iwl4965_hw_nic_stop_master(struct iwl4965_priv *priv) { int rc = 0; u32 reg_val; @@ -569,16 +569,16 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); /* set stop master bit */ - iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); + iwl4965_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); - reg_val = iwl_read32(priv, CSR_GP_CNTRL); + reg_val = iwl4965_read32(priv, CSR_GP_CNTRL); if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE == (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE)) IWL_DEBUG_INFO("Card in power save, master is already " "stopped\n"); else { - rc = iwl_poll_bit(priv, CSR_RESET, + rc = iwl4965_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); if (rc < 0) { @@ -593,7 +593,7 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv) return rc; } -void iwl_hw_txq_ctx_stop(struct iwl_priv *priv) +void iwl4965_hw_txq_ctx_stop(struct iwl4965_priv *priv) { int txq_id; @@ -602,56 +602,56 @@ void iwl_hw_txq_ctx_stop(struct iwl_priv *priv) /* reset TFD queues */ for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) { spin_lock_irqsave(&priv->lock, flags); - if (iwl_grab_nic_access(priv)) { + if (iwl4965_grab_nic_access(priv)) { spin_unlock_irqrestore(&priv->lock, flags); continue; } - iwl_write_direct32(priv, + iwl4965_write_direct32(priv, IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id), 0x0); - iwl_poll_direct_bit(priv, IWL_FH_TSSR_TX_STATUS_REG, + iwl4965_poll_direct_bit(priv, IWL_FH_TSSR_TX_STATUS_REG, IWL_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE (txq_id), 200); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); } - iwl_hw_txq_ctx_free(priv); + iwl4965_hw_txq_ctx_free(priv); } -int iwl_hw_nic_reset(struct iwl_priv *priv) +int iwl4965_hw_nic_reset(struct iwl4965_priv *priv) { int rc = 0; unsigned long flags; - iwl_hw_nic_stop_master(priv); + iwl4965_hw_nic_stop_master(priv); spin_lock_irqsave(&priv->lock, flags); - iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); + iwl4965_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); udelay(10); - iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); - rc = iwl_poll_bit(priv, CSR_RESET, + iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); + rc = iwl4965_poll_bit(priv, CSR_RESET, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25); udelay(10); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (!rc) { - iwl_write_prph(priv, APMG_CLK_EN_REG, + iwl4965_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); udelay(10); - iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG, + iwl4965_set_bits_prph(priv, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); } clear_bit(STATUS_HCMD_ACTIVE, &priv->status); @@ -681,7 +681,7 @@ int iwl_hw_nic_reset(struct iwl_priv *priv) */ static void iwl4965_bg_statistics_periodic(unsigned long data) { - struct iwl_priv *priv = (struct iwl_priv *)data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)data; queue_work(priv->workqueue, &priv->statistics_work); } @@ -689,27 +689,27 @@ static void iwl4965_bg_statistics_periodic(unsigned long data) /** * iwl4965_bg_statistics_work - Send the statistics request to the hardware. * - * This is queued by iwl_bg_statistics_periodic. + * This is queued by iwl4965_bg_statistics_periodic. */ static void iwl4965_bg_statistics_work(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, + struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv, statistics_work); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - iwl_send_statistics_request(priv); + iwl4965_send_statistics_request(priv); mutex_unlock(&priv->mutex); } #define CT_LIMIT_CONST 259 #define TM_CT_KILL_THRESHOLD 110 -void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) +void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv) { - struct iwl_ct_kill_config cmd; + struct iwl4965_ct_kill_config cmd; u32 R1, R2, R3; u32 temp_th; u32 crit_temperature; @@ -717,7 +717,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) int rc = 0; spin_lock_irqsave(&priv->lock, flags); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); spin_unlock_irqrestore(&priv->lock, flags); @@ -735,7 +735,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) crit_temperature = ((temp_th * (R3-R1))/CT_LIMIT_CONST) + R2; cmd.critical_temperature_R = cpu_to_le32(crit_temperature); - rc = iwl_send_cmd_pdu(priv, + rc = iwl4965_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD, sizeof(cmd), &cmd); if (rc) IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n"); @@ -753,7 +753,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) * enough to receive all of our own network traffic, but not so * high that our DSP gets too busy trying to lock onto non-network * activity/noise. */ -static int iwl4965_sens_energy_cck(struct iwl_priv *priv, +static int iwl4965_sens_energy_cck(struct iwl4965_priv *priv, u32 norm_fa, u32 rx_enable_time, struct statistics_general_data *rx_info) @@ -779,7 +779,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, u32 false_alarms = norm_fa * 200 * 1024; u32 max_false_alarms = MAX_FA_CCK * rx_enable_time; u32 min_false_alarms = MIN_FA_CCK * rx_enable_time; - struct iwl_sensitivity_data *data = NULL; + struct iwl4965_sensitivity_data *data = NULL; data = &(priv->sensitivity_data); @@ -944,7 +944,7 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, } -static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, +static int iwl4965_sens_auto_corr_ofdm(struct iwl4965_priv *priv, u32 norm_fa, u32 rx_enable_time) { @@ -952,7 +952,7 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, u32 false_alarms = norm_fa * 200 * 1024; u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time; u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time; - struct iwl_sensitivity_data *data = NULL; + struct iwl4965_sensitivity_data *data = NULL; data = &(priv->sensitivity_data); @@ -1009,22 +1009,22 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, return 0; } -static int iwl_sensitivity_callback(struct iwl_priv *priv, - struct iwl_cmd *cmd, struct sk_buff *skb) +static int iwl4965_sensitivity_callback(struct iwl4965_priv *priv, + struct iwl4965_cmd *cmd, struct sk_buff *skb) { /* We didn't cache the SKB; let the caller free it */ return 1; } /* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ -static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags) +static int iwl4965_sensitivity_write(struct iwl4965_priv *priv, u8 flags) { int rc = 0; - struct iwl_sensitivity_cmd cmd ; - struct iwl_sensitivity_data *data = NULL; - struct iwl_host_cmd cmd_out = { + struct iwl4965_sensitivity_cmd cmd ; + struct iwl4965_sensitivity_data *data = NULL; + struct iwl4965_host_cmd cmd_out = { .id = SENSITIVITY_CMD, - .len = sizeof(struct iwl_sensitivity_cmd), + .len = sizeof(struct iwl4965_sensitivity_cmd), .meta.flags = flags, .data = &cmd, }; @@ -1071,7 +1071,7 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags) cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE; if (flags & CMD_ASYNC) - cmd_out.meta.u.callback = iwl_sensitivity_callback; + cmd_out.meta.u.callback = iwl4965_sensitivity_callback; /* Don't send command to uCode if nothing has changed */ if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]), @@ -1084,7 +1084,7 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags) memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), sizeof(u16)*HD_TABLE_SIZE); - rc = iwl_send_cmd(priv, &cmd_out); + rc = iwl4965_send_cmd(priv, &cmd_out); if (!rc) { IWL_DEBUG_CALIB("SENSITIVITY_CMD succeeded\n"); return rc; @@ -1093,11 +1093,11 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags) return 0; } -void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force) +void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags, u8 force) { int rc = 0; int i; - struct iwl_sensitivity_data *data = NULL; + struct iwl4965_sensitivity_data *data = NULL; IWL_DEBUG_CALIB("Start iwl4965_init_sensitivity\n"); @@ -1107,7 +1107,7 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force) /* Clear driver's sensitivity algo data */ data = &(priv->sensitivity_data); - memset(data, 0, sizeof(struct iwl_sensitivity_data)); + memset(data, 0, sizeof(struct iwl4965_sensitivity_data)); data->num_in_cck_no_fa = 0; data->nrg_curr_state = IWL_FA_TOO_MANY; @@ -1151,21 +1151,21 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force) /* Reset differential Rx gains in NIC to prepare for chain noise calibration. * Called after every association, but this runs only once! * ... once chain noise is calibrated the first time, it's good forever. */ -void iwl4965_chain_noise_reset(struct iwl_priv *priv) +void iwl4965_chain_noise_reset(struct iwl4965_priv *priv) { - struct iwl_chain_noise_data *data = NULL; + struct iwl4965_chain_noise_data *data = NULL; int rc = 0; data = &(priv->chain_noise_data); - if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { - struct iwl_calibration_cmd cmd; + if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl4965_is_associated(priv)) { + struct iwl4965_calibration_cmd cmd; memset(&cmd, 0, sizeof(cmd)); cmd.opCode = PHY_CALIBRATE_DIFF_GAIN_CMD; cmd.diff_gain_a = 0; cmd.diff_gain_b = 0; cmd.diff_gain_c = 0; - rc = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, + rc = iwl4965_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, sizeof(cmd), &cmd); msleep(4); data->state = IWL_CHAIN_NOISE_ACCUMULATE; @@ -1180,10 +1180,10 @@ void iwl4965_chain_noise_reset(struct iwl_priv *priv) * 1) Which antennas are connected. * 2) Differential rx gain settings to balance the 3 receivers. */ -static void iwl4965_noise_calibration(struct iwl_priv *priv, - struct iwl_notif_statistics *stat_resp) +static void iwl4965_noise_calibration(struct iwl4965_priv *priv, + struct iwl4965_notif_statistics *stat_resp) { - struct iwl_chain_noise_data *data = NULL; + struct iwl4965_chain_noise_data *data = NULL; int rc = 0; u32 chain_noise_a; @@ -1382,7 +1382,7 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv, /* Differential gain gets sent to uCode only once */ if (!data->radio_write) { - struct iwl_calibration_cmd cmd; + struct iwl4965_calibration_cmd cmd; data->radio_write = 1; memset(&cmd, 0, sizeof(cmd)); @@ -1390,7 +1390,7 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv, cmd.diff_gain_a = data->delta_gain_code[0]; cmd.diff_gain_b = data->delta_gain_code[1]; cmd.diff_gain_c = data->delta_gain_code[2]; - rc = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, + rc = iwl4965_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, sizeof(cmd), &cmd); if (rc) IWL_DEBUG_CALIB("fail sending cmd " @@ -1413,8 +1413,8 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv, return; } -static void iwl4965_sensitivity_calibration(struct iwl_priv *priv, - struct iwl_notif_statistics *resp) +static void iwl4965_sensitivity_calibration(struct iwl4965_priv *priv, + struct iwl4965_notif_statistics *resp) { int rc = 0; u32 rx_enable_time; @@ -1424,7 +1424,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv, u32 bad_plcp_ofdm; u32 norm_fa_ofdm; u32 norm_fa_cck; - struct iwl_sensitivity_data *data = NULL; + struct iwl4965_sensitivity_data *data = NULL; struct statistics_rx_non_phy *rx_info = &(resp->rx.general); struct statistics_rx *statistics = &(resp->rx); unsigned long flags; @@ -1432,7 +1432,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv, data = &(priv->sensitivity_data); - if (!iwl_is_associated(priv)) { + if (!iwl4965_is_associated(priv)) { IWL_DEBUG_CALIB("<< - not associated\n"); return; } @@ -1520,7 +1520,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv, static void iwl4965_bg_sensitivity_work(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, + struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv, sensitivity_work); mutex_lock(&priv->mutex); @@ -1550,7 +1550,7 @@ static void iwl4965_bg_sensitivity_work(struct work_struct *work) static void iwl4965_bg_txpower_work(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, + struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv, txpower_work); /* If a scan happened to start before we got here @@ -1566,7 +1566,7 @@ static void iwl4965_bg_txpower_work(struct work_struct *work) /* Regardless of if we are assocaited, we must reconfigure the * TX power since frames can be sent on non-radar channels while * not associated */ - iwl_hw_reg_send_txpower(priv); + iwl4965_hw_reg_send_txpower(priv); /* Update last_temperature to keep is_calib_needed from running * when it isn't needed... */ @@ -1578,24 +1578,24 @@ static void iwl4965_bg_txpower_work(struct work_struct *work) /* * Acquire priv->lock before calling this function ! */ -static void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index) +static void iwl4965_set_wr_ptrs(struct iwl4965_priv *priv, int txq_id, u32 index) { - iwl_write_direct32(priv, HBUS_TARG_WRPTR, + iwl4965_write_direct32(priv, HBUS_TARG_WRPTR, (index & 0xff) | (txq_id << 8)); - iwl_write_prph(priv, KDR_SCD_QUEUE_RDPTR(txq_id), index); + iwl4965_write_prph(priv, KDR_SCD_QUEUE_RDPTR(txq_id), index); } /* * Acquire priv->lock before calling this function ! */ -static void iwl4965_tx_queue_set_status(struct iwl_priv *priv, - struct iwl_tx_queue *txq, +static void iwl4965_tx_queue_set_status(struct iwl4965_priv *priv, + struct iwl4965_tx_queue *txq, int tx_fifo_id, int scd_retry) { int txq_id = txq->q.id; int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0; - iwl_write_prph(priv, KDR_SCD_QUEUE_STATUS_BITS(txq_id), + iwl4965_write_prph(priv, KDR_SCD_QUEUE_STATUS_BITS(txq_id), (active << SCD_QUEUE_STTS_REG_POS_ACTIVE) | (tx_fifo_id << SCD_QUEUE_STTS_REG_POS_TXF) | (scd_retry << SCD_QUEUE_STTS_REG_POS_WSL) | @@ -1619,17 +1619,17 @@ static const u16 default_queue_to_tx_fifo[] = { IWL_TX_FIFO_HCCA_2 }; -static inline void iwl4965_txq_ctx_activate(struct iwl_priv *priv, int txq_id) +static inline void iwl4965_txq_ctx_activate(struct iwl4965_priv *priv, int txq_id) { set_bit(txq_id, &priv->txq_ctx_active_msk); } -static inline void iwl4965_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id) +static inline void iwl4965_txq_ctx_deactivate(struct iwl4965_priv *priv, int txq_id) { clear_bit(txq_id, &priv->txq_ctx_active_msk); } -int iwl4965_alive_notify(struct iwl_priv *priv) +int iwl4965_alive_notify(struct iwl4965_priv *priv) { u32 a; int i = 0; @@ -1640,43 +1640,43 @@ int iwl4965_alive_notify(struct iwl_priv *priv) #ifdef CONFIG_IWL4965_SENSITIVITY memset(&(priv->sensitivity_data), 0, - sizeof(struct iwl_sensitivity_data)); + sizeof(struct iwl4965_sensitivity_data)); memset(&(priv->chain_noise_data), 0, - sizeof(struct iwl_chain_noise_data)); + sizeof(struct iwl4965_chain_noise_data)); for (i = 0; i < NUM_RX_CHAINS; i++) priv->chain_noise_data.delta_gain_code[i] = CHAIN_NOISE_DELTA_GAIN_INIT_VAL; #endif /* CONFIG_IWL4965_SENSITIVITY*/ - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - priv->scd_base_addr = iwl_read_prph(priv, KDR_SCD_SRAM_BASE_ADDR); + priv->scd_base_addr = iwl4965_read_prph(priv, KDR_SCD_SRAM_BASE_ADDR); a = priv->scd_base_addr + SCD_CONTEXT_DATA_OFFSET; for (; a < priv->scd_base_addr + SCD_TX_STTS_BITMAP_OFFSET; a += 4) - iwl_write_targ_mem(priv, a, 0); + iwl4965_write_targ_mem(priv, a, 0); for (; a < priv->scd_base_addr + SCD_TRANSLATE_TBL_OFFSET; a += 4) - iwl_write_targ_mem(priv, a, 0); + iwl4965_write_targ_mem(priv, a, 0); for (; a < sizeof(u16) * priv->hw_setting.max_txq_num; a += 4) - iwl_write_targ_mem(priv, a, 0); + iwl4965_write_targ_mem(priv, a, 0); - iwl_write_prph(priv, KDR_SCD_DRAM_BASE_ADDR, + iwl4965_write_prph(priv, KDR_SCD_DRAM_BASE_ADDR, (priv->hw_setting.shared_phys + - offsetof(struct iwl_shared, queues_byte_cnt_tbls)) >> 10); - iwl_write_prph(priv, KDR_SCD_QUEUECHAIN_SEL, 0); + offsetof(struct iwl4965_shared, queues_byte_cnt_tbls)) >> 10); + iwl4965_write_prph(priv, KDR_SCD_QUEUECHAIN_SEL, 0); /* initiate the queues */ for (i = 0; i < priv->hw_setting.max_txq_num; i++) { - iwl_write_prph(priv, KDR_SCD_QUEUE_RDPTR(i), 0); - iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); - iwl_write_targ_mem(priv, priv->scd_base_addr + + iwl4965_write_prph(priv, KDR_SCD_QUEUE_RDPTR(i), 0); + iwl4965_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); + iwl4965_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(i), (SCD_WIN_SIZE << SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); - iwl_write_targ_mem(priv, priv->scd_base_addr + + iwl4965_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(i) + sizeof(u32), (SCD_FRAME_LIMIT << @@ -1684,10 +1684,10 @@ int iwl4965_alive_notify(struct iwl_priv *priv) SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); } - iwl_write_prph(priv, KDR_SCD_INTERRUPT_MASK, + iwl4965_write_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << priv->hw_setting.max_txq_num) - 1); - iwl_write_prph(priv, KDR_SCD_TXFACT, + iwl4965_write_prph(priv, KDR_SCD_TXFACT, SCD_TXFACT_REG_TXFIFO_MASK(0, 7)); iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); @@ -1698,27 +1698,27 @@ int iwl4965_alive_notify(struct iwl_priv *priv) iwl4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0); } - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; } -int iwl_hw_set_hw_setting(struct iwl_priv *priv) +int iwl4965_hw_set_hw_setting(struct iwl4965_priv *priv) { priv->hw_setting.shared_virt = pci_alloc_consistent(priv->pci_dev, - sizeof(struct iwl_shared), + sizeof(struct iwl4965_shared), &priv->hw_setting.shared_phys); if (!priv->hw_setting.shared_virt) return -1; - memset(priv->hw_setting.shared_virt, 0, sizeof(struct iwl_shared)); + memset(priv->hw_setting.shared_virt, 0, sizeof(struct iwl4965_shared)); - priv->hw_setting.max_txq_num = iwl_param_queues_num; + priv->hw_setting.max_txq_num = iwl4965_param_queues_num; priv->hw_setting.ac_queue_count = AC_NUM; - priv->hw_setting.tx_cmd_len = sizeof(struct iwl_tx_cmd); + priv->hw_setting.tx_cmd_len = sizeof(struct iwl4965_tx_cmd); priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE; priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG; @@ -1728,30 +1728,30 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv) } /** - * iwl_hw_txq_ctx_free - Free TXQ Context + * iwl4965_hw_txq_ctx_free - Free TXQ Context * * Destroy all TX DMA queues and structures */ -void iwl_hw_txq_ctx_free(struct iwl_priv *priv) +void iwl4965_hw_txq_ctx_free(struct iwl4965_priv *priv) { int txq_id; /* Tx queues */ for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) - iwl_tx_queue_free(priv, &priv->txq[txq_id]); + iwl4965_tx_queue_free(priv, &priv->txq[txq_id]); iwl4965_kw_free(priv); } /** - * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] + * iwl4965_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] * * Does NOT advance any indexes */ -int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) +int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq) { - struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; - struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; + struct iwl4965_tfd_frame *bd_tmp = (struct iwl4965_tfd_frame *)&txq->bd[0]; + struct iwl4965_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; struct pci_dev *dev = priv->pci_dev; int i; int counter = 0; @@ -1801,9 +1801,9 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) return 0; } -int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) +int iwl4965_hw_reg_set_txpower(struct iwl4965_priv *priv, s8 power) { - IWL_ERROR("TODO: Implement iwl_hw_reg_set_txpower!\n"); + IWL_ERROR("TODO: Implement iwl4965_hw_reg_set_txpower!\n"); return -EINVAL; } @@ -1845,12 +1845,12 @@ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage, return comp; } -static const struct iwl_channel_info * -iwl4965_get_channel_txpower_info(struct iwl_priv *priv, u8 phymode, u16 channel) +static const struct iwl4965_channel_info * +iwl4965_get_channel_txpower_info(struct iwl4965_priv *priv, u8 phymode, u16 channel) { - const struct iwl_channel_info *ch_info; + const struct iwl4965_channel_info *ch_info; - ch_info = iwl_get_channel_info(priv, phymode, channel); + ch_info = iwl4965_get_channel_info(priv, phymode, channel); if (!is_channel_valid(ch_info)) return NULL; @@ -1884,7 +1884,7 @@ static s32 iwl4965_get_tx_atten_grp(u16 channel) return -1; } -static u32 iwl4965_get_sub_band(const struct iwl_priv *priv, u32 channel) +static u32 iwl4965_get_sub_band(const struct iwl4965_priv *priv, u32 channel) { s32 b = -1; @@ -1912,15 +1912,15 @@ static s32 iwl4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2) } } -static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel, - struct iwl_eeprom_calib_ch_info *chan_info) +static int iwl4965_interpolate_chan(struct iwl4965_priv *priv, u32 channel, + struct iwl4965_eeprom_calib_ch_info *chan_info) { s32 s = -1; u32 c; u32 m; - const struct iwl_eeprom_calib_measure *m1; - const struct iwl_eeprom_calib_measure *m2; - struct iwl_eeprom_calib_measure *omeas; + const struct iwl4965_eeprom_calib_measure *m1; + const struct iwl4965_eeprom_calib_measure *m2; + struct iwl4965_eeprom_calib_measure *omeas; u32 ch_i1; u32 ch_i2; @@ -1995,7 +1995,7 @@ static s32 back_off_table[] = { /* Thermal compensation values for txpower for various frequency ranges ... * ratios from 3:1 to 4.5:1 of degrees (Celsius) per half-dB gain adjust */ -static struct iwl_txpower_comp_entry { +static struct iwl4965_txpower_comp_entry { s32 degrees_per_05db_a; s32 degrees_per_05db_a_denom; } tx_power_cmp_tble[CALIB_CH_GROUP_MAX] = { @@ -2245,9 +2245,9 @@ static const struct gain_entry gain_table[2][108] = { } }; -static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, +static int iwl4965_fill_txpower_tbl(struct iwl4965_priv *priv, u8 band, u16 channel, u8 is_fat, u8 ctrl_chan_high, - struct iwl_tx_power_db *tx_power_tbl) + struct iwl4965_tx_power_db *tx_power_tbl) { u8 saturation_power; s32 target_power; @@ -2259,9 +2259,9 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, s32 txatten_grp = CALIB_CH_GROUP_MAX; int i; int c; - const struct iwl_channel_info *ch_info = NULL; - struct iwl_eeprom_calib_ch_info ch_eeprom_info; - const struct iwl_eeprom_calib_measure *measurement; + const struct iwl4965_channel_info *ch_info = NULL; + struct iwl4965_eeprom_calib_ch_info ch_eeprom_info; + const struct iwl4965_eeprom_calib_measure *measurement; s16 voltage; s32 init_voltage; s32 voltage_compensation; @@ -2400,7 +2400,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, /* for each of 33 bit-rates (including 1 for CCK) */ for (i = 0; i < POWER_TABLE_NUM_ENTRIES; i++) { u8 is_mimo_rate; - union iwl_tx_power_dual_stream tx_power; + union iwl4965_tx_power_dual_stream tx_power; /* for mimo, reduce each chain's txpower by half * (3dB, 6 steps), so total output power is regulatory @@ -2497,14 +2497,14 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, } /** - * iwl_hw_reg_send_txpower - Configure the TXPOWER level user limit + * iwl4965_hw_reg_send_txpower - Configure the TXPOWER level user limit * * Uses the active RXON for channel, band, and characteristics (fat, high) * The power limit is taken from priv->user_txpower_limit. */ -int iwl_hw_reg_send_txpower(struct iwl_priv *priv) +int iwl4965_hw_reg_send_txpower(struct iwl4965_priv *priv) { - struct iwl_txpowertable_cmd cmd = { 0 }; + struct iwl4965_txpowertable_cmd cmd = { 0 }; int rc = 0; u8 band = 0; u8 is_fat = 0; @@ -2536,23 +2536,23 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) if (rc) return rc; - rc = iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); + rc = iwl4965_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); return rc; } -int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel) +int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel) { int rc; u8 band = 0; u8 is_fat = 0; u8 ctrl_chan_high = 0; - struct iwl_channel_switch_cmd cmd = { 0 }; - const struct iwl_channel_info *ch_info; + struct iwl4965_channel_switch_cmd cmd = { 0 }; + const struct iwl4965_channel_info *ch_info; band = ((priv->phymode == MODE_IEEE80211B) || (priv->phymode == MODE_IEEE80211G)); - ch_info = iwl_get_channel_info(priv, priv->phymode, channel); + ch_info = iwl4965_get_channel_info(priv, priv->phymode, channel); is_fat = is_fat_channel(priv->staging_rxon.flags); @@ -2578,15 +2578,15 @@ int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel) return rc; } - rc = iwl_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); + rc = iwl4965_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); return rc; } #define RTS_HCCA_RETRY_LIMIT 3 #define RTS_DFAULT_RETRY_LIMIT 60 -void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, - struct iwl_cmd *cmd, +void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv, + struct iwl4965_cmd *cmd, struct ieee80211_tx_control *ctrl, struct ieee80211_hdr *hdr, int sta_id, int is_hcca) @@ -2599,7 +2599,7 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, tx_flags = cmd->cmd.tx.tx_flags; - rate = iwl_rates[ctrl->tx_rate].plcp; + rate = iwl4965_rates[ctrl->tx_rate].plcp; rts_retry_limit = (is_hcca) ? RTS_HCCA_RETRY_LIMIT : RTS_DFAULT_RETRY_LIMIT; @@ -2632,26 +2632,26 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, cmd->cmd.tx.rts_retry_limit = rts_retry_limit; cmd->cmd.tx.data_retry_limit = data_retry_limit; - cmd->cmd.tx.rate_n_flags = iwl_hw_set_rate_n_flags(rate, 0); + cmd->cmd.tx.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate, 0); cmd->cmd.tx.tx_flags = tx_flags; } -int iwl_hw_get_rx_read(struct iwl_priv *priv) +int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv) { - struct iwl_shared *shared_data = priv->hw_setting.shared_virt; + struct iwl4965_shared *shared_data = priv->hw_setting.shared_virt; return IWL_GET_BITS(*shared_data, rb_closed_stts_rb_num); } -int iwl_hw_get_temperature(struct iwl_priv *priv) +int iwl4965_hw_get_temperature(struct iwl4965_priv *priv) { return priv->temperature; } -unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, - struct iwl_frame *frame, u8 rate) +unsigned int iwl4965_hw_get_beacon_cmd(struct iwl4965_priv *priv, + struct iwl4965_frame *frame, u8 rate) { - struct iwl_tx_beacon_cmd *tx_beacon_cmd; + struct iwl4965_tx_beacon_cmd *tx_beacon_cmd; unsigned int frame_size; tx_beacon_cmd = &frame->u.beacon; @@ -2660,9 +2660,9 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, tx_beacon_cmd->tx.sta_id = IWL4965_BROADCAST_ID; tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - frame_size = iwl_fill_beacon_frame(priv, + frame_size = iwl4965_fill_beacon_frame(priv, tx_beacon_cmd->frame, - BROADCAST_ADDR, + iwl4965_broadcast_addr, sizeof(frame->u) - sizeof(*tx_beacon_cmd)); BUG_ON(frame_size > MAX_MPDU_SIZE); @@ -2670,36 +2670,36 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP)) tx_beacon_cmd->tx.rate_n_flags = - iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK); + iwl4965_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK); else tx_beacon_cmd->tx.rate_n_flags = - iwl_hw_set_rate_n_flags(rate, 0); + iwl4965_hw_set_rate_n_flags(rate, 0); tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK); return (sizeof(*tx_beacon_cmd) + frame_size); } -int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) +int iwl4965_hw_tx_queue_init(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq) { int rc; unsigned long flags; int txq_id = txq->q.id; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } - iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), + iwl4965_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), txq->q.dma_addr >> 8); - iwl_write_direct32( + iwl4965_write_direct32( priv, IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id), IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -2710,11 +2710,11 @@ static inline u8 iwl4965_get_dma_hi_address(dma_addr_t addr) return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0; } -int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, +int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl4965_priv *priv, void *ptr, dma_addr_t addr, u16 len) { int index, is_odd; - struct iwl_tfd_frame *tfd = ptr; + struct iwl4965_tfd_frame *tfd = ptr; u32 num_tbs = IWL_GET_BITS(*tfd, num_tbs); if ((num_tbs >= MAX_NUM_OF_TBS) || (num_tbs < 0)) { @@ -2743,7 +2743,7 @@ int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, return 0; } -static void iwl_hw_card_show_info(struct iwl_priv *priv) +static void iwl4965_hw_card_show_info(struct iwl4965_priv *priv) { u16 hw_version = priv->eeprom.board_revision_4965; @@ -2758,12 +2758,12 @@ static void iwl_hw_card_show_info(struct iwl_priv *priv) #define IWL_TX_CRC_SIZE 4 #define IWL_TX_DELIMITER_SIZE 4 -int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv, - struct iwl_tx_queue *txq, u16 byte_cnt) +int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv, + struct iwl4965_tx_queue *txq, u16 byte_cnt) { int len; int txq_id = txq->q.id; - struct iwl_shared *shared_data = priv->hw_setting.shared_virt; + struct iwl4965_shared *shared_data = priv->hw_setting.shared_virt; if (txq->need_update == 0) return 0; @@ -2783,7 +2783,7 @@ int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv, /* Set up Rx receiver/antenna/chain usage in "staging" RXON image. * This should not be used for scan command ... it puts data in wrong place. */ -void iwl4965_set_rxon_chain(struct iwl_priv *priv) +void iwl4965_set_rxon_chain(struct iwl4965_priv *priv) { u8 is_single = is_single_stream(priv); u8 idle_state, rx_state; @@ -2819,14 +2819,14 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv) /* get the traffic load value for tid */ -static u32 iwl4965_tl_get_load(struct iwl_priv *priv, u8 tid) +static u32 iwl4965_tl_get_load(struct iwl4965_priv *priv, u8 tid) { u32 load = 0; u32 current_time = jiffies_to_msecs(jiffies); u32 time_diff; s32 index; unsigned long flags; - struct iwl_traffic_load *tid_ptr = NULL; + struct iwl4965_traffic_load *tid_ptr = NULL; if (tid >= TID_MAX_LOAD_COUNT) return 0; @@ -2867,13 +2867,13 @@ static u32 iwl4965_tl_get_load(struct iwl_priv *priv, u8 tid) increment traffic load value for tid and also remove any old values if passed the certian time period */ -static void iwl4965_tl_add_packet(struct iwl_priv *priv, u8 tid) +static void iwl4965_tl_add_packet(struct iwl4965_priv *priv, u8 tid) { u32 current_time = jiffies_to_msecs(jiffies); u32 time_diff; s32 index; unsigned long flags; - struct iwl_traffic_load *tid_ptr = NULL; + struct iwl4965_traffic_load *tid_ptr = NULL; if (tid >= TID_MAX_LOAD_COUNT) return; @@ -2930,14 +2930,14 @@ enum HT_STATUS { BA_STATUS_ACTIVE, }; -static u8 iwl4964_tl_ba_avail(struct iwl_priv *priv) +static u8 iwl4964_tl_ba_avail(struct iwl4965_priv *priv) { int i; - struct iwl_lq_mngr *lq; + struct iwl4965_lq_mngr *lq; u8 count = 0; u16 msk; - lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); + lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr); for (i = 0; i < TID_MAX_LOAD_COUNT ; i++) { msk = 1 << i; if ((lq->agg_ctrl.granted_ba & msk) || @@ -2951,10 +2951,10 @@ static u8 iwl4964_tl_ba_avail(struct iwl_priv *priv) return 0; } -static void iwl4965_ba_status(struct iwl_priv *priv, +static void iwl4965_ba_status(struct iwl4965_priv *priv, u8 tid, enum HT_STATUS status); -static int iwl4965_perform_addba(struct iwl_priv *priv, u8 tid, u32 length, +static int iwl4965_perform_addba(struct iwl4965_priv *priv, u8 tid, u32 length, u32 ba_timeout) { int rc; @@ -2966,7 +2966,7 @@ static int iwl4965_perform_addba(struct iwl_priv *priv, u8 tid, u32 length, return rc; } -static int iwl4965_perform_delba(struct iwl_priv *priv, u8 tid) +static int iwl4965_perform_delba(struct iwl4965_priv *priv, u8 tid) { int rc; @@ -2977,8 +2977,8 @@ static int iwl4965_perform_delba(struct iwl_priv *priv, u8 tid) return rc; } -static void iwl4965_turn_on_agg_for_tid(struct iwl_priv *priv, - struct iwl_lq_mngr *lq, +static void iwl4965_turn_on_agg_for_tid(struct iwl4965_priv *priv, + struct iwl4965_lq_mngr *lq, u8 auto_agg, u8 tid) { u32 tid_msk = (1 << tid); @@ -3025,12 +3025,12 @@ static void iwl4965_turn_on_agg_for_tid(struct iwl_priv *priv, spin_unlock_irqrestore(&priv->lq_mngr.lock, flags); } -static void iwl4965_turn_on_agg(struct iwl_priv *priv, u8 tid) +static void iwl4965_turn_on_agg(struct iwl4965_priv *priv, u8 tid) { - struct iwl_lq_mngr *lq; + struct iwl4965_lq_mngr *lq; unsigned long flags; - lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); + lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr); if ((tid < TID_MAX_LOAD_COUNT)) iwl4965_turn_on_agg_for_tid(priv, lq, lq->agg_ctrl.auto_agg, @@ -3050,13 +3050,13 @@ static void iwl4965_turn_on_agg(struct iwl_priv *priv, u8 tid) } -void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid) +void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid) { u32 tid_msk; - struct iwl_lq_mngr *lq; + struct iwl4965_lq_mngr *lq; unsigned long flags; - lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); + lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr); if ((tid < TID_MAX_LOAD_COUNT)) { tid_msk = 1 << tid; @@ -3079,14 +3079,14 @@ void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid) } } -static void iwl4965_ba_status(struct iwl_priv *priv, +static void iwl4965_ba_status(struct iwl4965_priv *priv, u8 tid, enum HT_STATUS status) { - struct iwl_lq_mngr *lq; + struct iwl4965_lq_mngr *lq; u32 tid_msk = (1 << tid); unsigned long flags; - lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); + lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr); if ((tid >= TID_MAX_LOAD_COUNT)) goto out; @@ -3119,14 +3119,14 @@ static void iwl4965_ba_status(struct iwl_priv *priv, static void iwl4965_bg_agg_work(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, + struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv, agg_work); u32 tid; u32 retry_tid; u32 tid_msk; unsigned long flags; - struct iwl_lq_mngr *lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); + struct iwl4965_lq_mngr *lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr); spin_lock_irqsave(&priv->lq_mngr.lock, flags); retry_tid = lq->agg_ctrl.tid_retry; @@ -3152,13 +3152,13 @@ static void iwl4965_bg_agg_work(struct work_struct *work) #endif /*CONFIG_IWL4965_HT_AGG */ #endif /* CONFIG_IWL4965_HT */ -int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, +int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd, u8 sta_id, dma_addr_t txcmd_phys, struct ieee80211_hdr *hdr, u8 hdr_len, struct ieee80211_tx_control *ctrl, void *sta_in) { - struct iwl_tx_cmd cmd; - struct iwl_tx_cmd *tx = (struct iwl_tx_cmd *)&out_cmd->cmd.payload[0]; + struct iwl4965_tx_cmd cmd; + struct iwl4965_tx_cmd *tx = (struct iwl4965_tx_cmd *)&out_cmd->cmd.payload[0]; dma_addr_t scratch_phys; u8 unicast = 0; u8 is_data = 1; @@ -3177,8 +3177,8 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) is_data = 0; - memcpy(&cmd, &(out_cmd->cmd.tx), sizeof(struct iwl_tx_cmd)); - memset(tx, 0, sizeof(struct iwl_tx_cmd)); + memcpy(&cmd, &(out_cmd->cmd.tx), sizeof(struct iwl4965_tx_cmd)); + memset(tx, 0, sizeof(struct iwl4965_tx_cmd)); memcpy(tx->hdr, hdr, hdr_len); tx->len = cmd.len; @@ -3197,8 +3197,8 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, tx->rts_retry_limit = cmd.rts_retry_limit; tx->data_retry_limit = cmd.data_retry_limit; - scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + - offsetof(struct iwl_tx_cmd, scratch); + scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) + + offsetof(struct iwl4965_tx_cmd, scratch); tx->dram_lsb_ptr = cpu_to_le32(scratch_phys); tx->dram_msb_ptr = iwl4965_get_dma_hi_address(scratch_phys); @@ -3224,7 +3224,7 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, tx->tx_flags |= TX_CMD_FLG_STA_RATE_MSK; } - tx->rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[rate_index].plcp, + tx->rate_n_flags = iwl4965_hw_set_rate_n_flags(iwl4965_rates[rate_index].plcp, rate_flags); if (ieee80211_is_back_request(fc)) @@ -3277,7 +3277,7 @@ static s32 sign_extend(u32 oper, int index) * * A return of <0 indicates bogus data in the statistics */ -int iwl4965_get_temperature(const struct iwl_priv *priv) +int iwl4965_get_temperature(const struct iwl4965_priv *priv) { s32 temperature; s32 vt; @@ -3344,7 +3344,7 @@ int iwl4965_get_temperature(const struct iwl_priv *priv) * Assumes caller will replace priv->last_temperature once calibration * executed. */ -static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv) +static int iwl4965_is_temp_calib_needed(struct iwl4965_priv *priv) { int temp_diff; @@ -3377,7 +3377,7 @@ static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv) /* Calculate noise level, based on measurements during network silence just * before arriving beacon. This measurement can be done only if we know * exactly when to expect beacons, therefore only when we're associated. */ -static void iwl4965_rx_calc_noise(struct iwl_priv *priv) +static void iwl4965_rx_calc_noise(struct iwl4965_priv *priv) { struct statistics_rx_non_phy *rx_info = &(priv->statistics.rx.general); @@ -3414,9 +3414,9 @@ static void iwl4965_rx_calc_noise(struct iwl_priv *priv) priv->last_rx_noise); } -void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) +void iwl4965_hw_rx_statistics(struct iwl4965_priv *priv, struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; int change; s32 temp; @@ -3478,12 +3478,12 @@ void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) queue_work(priv->workqueue, &priv->txpower_work); } -static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data, +static void iwl4965_handle_data_packet(struct iwl4965_priv *priv, int is_data, int include_phy, - struct iwl_rx_mem_buffer *rxb, + struct iwl4965_rx_mem_buffer *rxb, struct ieee80211_rx_status *stats) { - struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; + struct iwl4965_rx_packet *pkt = (struct iwl4965_rx_packet *)rxb->skb->data; struct iwl4965_rx_phy_res *rx_start = (include_phy) ? (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : NULL; struct ieee80211_hdr *hdr; @@ -3540,25 +3540,25 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data, } if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { - if (iwl_param_hwcrypto) - iwl_set_decrypted_flag(priv, rxb->skb, + if (iwl4965_param_hwcrypto) + iwl4965_set_decrypted_flag(priv, rxb->skb, ampdu_status, stats); - iwl_handle_data_packet_monitor(priv, rxb, hdr, len, stats, 0); + iwl4965_handle_data_packet_monitor(priv, rxb, hdr, len, stats, 0); return; } stats->flag = 0; hdr = (struct ieee80211_hdr *)rxb->skb->data; - if (iwl_param_hwcrypto) - iwl_set_decrypted_flag(priv, rxb->skb, ampdu_status, stats); + if (iwl4965_param_hwcrypto) + iwl4965_set_decrypted_flag(priv, rxb->skb, ampdu_status, stats); ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); priv->alloc_rxb_skb--; rxb->skb = NULL; #ifdef LED priv->led_packets += len; - iwl_setup_activity_timer(priv); + iwl4965_setup_activity_timer(priv); #endif } @@ -3670,7 +3670,7 @@ static int parse_elems(u8 *start, size_t len, struct ieee802_11_elems *elems) } #endif /* CONFIG_IWL4965_HT */ -static void iwl4965_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) +static void iwl4965_sta_modify_ps_wake(struct iwl4965_priv *priv, int sta_id) { unsigned long flags; @@ -3681,13 +3681,13 @@ static void iwl4965_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; spin_unlock_irqrestore(&priv->sta_lock, flags); - iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); + iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); } -static void iwl4965_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) +static void iwl4965_update_ps_mode(struct iwl4965_priv *priv, u16 ps_bit, u8 *addr) { /* FIXME: need locking over ps_status ??? */ - u8 sta_id = iwl_hw_find_station(priv, addr); + u8 sta_id = iwl4965_hw_find_station(priv, addr); if (sta_id != IWL_INVALID_STATION) { u8 sta_awake = priv->stations[sta_id]. @@ -3704,10 +3704,10 @@ static void iwl4965_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) /* Called for REPLY_4965_RX (legacy ABG frames), or * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ -static void iwl4965_rx_reply_rx(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; /* Use phy data (Rx signal strength, etc.) contained within * this rx packet for legacy frames, * or phy data cached from REPLY_RX_PHY_CMD for HT frames. */ @@ -3726,7 +3726,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, (rx_start->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? MODE_IEEE80211G : MODE_IEEE80211A, .antenna = 0, - .rate = iwl_hw_get_rate(rx_start->rate_n_flags), + .rate = iwl4965_hw_get_rate(rx_start->rate_n_flags), .flag = 0, #ifdef CONFIG_IWL4965_HT_AGG .ordered = 0 @@ -3789,32 +3789,32 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, * which are gathered only when associated, and indicate noise * only for the associated network channel ... * Ignore these noise values while scanning (other channels) */ - if (iwl_is_associated(priv) && + if (iwl4965_is_associated(priv) && !test_bit(STATUS_SCANNING, &priv->status)) { stats.noise = priv->last_rx_noise; - stats.signal = iwl_calc_sig_qual(stats.ssi, stats.noise); + stats.signal = iwl4965_calc_sig_qual(stats.ssi, stats.noise); } else { stats.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; - stats.signal = iwl_calc_sig_qual(stats.ssi, 0); + stats.signal = iwl4965_calc_sig_qual(stats.ssi, 0); } /* Reset beacon noise level if not associated. */ - if (!iwl_is_associated(priv)) + if (!iwl4965_is_associated(priv)) priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; #ifdef CONFIG_IWL4965_DEBUG - /* TODO: Parts of iwl_report_frame are broken for 4965 */ - if (iwl_debug_level & (IWL_DL_RX)) + /* TODO: Parts of iwl4965_report_frame are broken for 4965 */ + if (iwl4965_debug_level & (IWL_DL_RX)) /* Set "1" to report good data frames in groups of 100 */ - iwl_report_frame(priv, pkt, header, 1); + iwl4965_report_frame(priv, pkt, header, 1); - if (iwl_debug_level & (IWL_DL_RX | IWL_DL_STATS)) + if (iwl4965_debug_level & (IWL_DL_RX | IWL_DL_STATS)) IWL_DEBUG_RX("Rssi %d, noise %d, qual %d, TSF %lu\n", stats.ssi, stats.noise, stats.signal, (long unsigned int)le64_to_cpu(rx_start->timestamp)); #endif - network_packet = iwl_is_network_packet(priv, header); + network_packet = iwl4965_is_network_packet(priv, header); if (network_packet) { priv->last_rx_rssi = stats.ssi; priv->last_beacon_time = priv->ucode_beacon_time; @@ -3902,7 +3902,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, case IEEE80211_STYPE_PROBE_REQ: if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && - !iwl_is_associated(priv)) { + !iwl4965_is_associated(priv)) { DECLARE_MAC_BUF(mac1); DECLARE_MAC_BUF(mac2); DECLARE_MAC_BUF(mac3); @@ -3948,7 +3948,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, print_mac(mac1, header->addr1), print_mac(mac2, header->addr2), print_mac(mac3, header->addr3)); - else if (unlikely(is_duplicate_packet(priv, header))) + else if (unlikely(iwl4965_is_duplicate_packet(priv, header))) IWL_DEBUG_DROP("Dropping (dup): %s, %s, %s\n", print_mac(mac1, header->addr1), print_mac(mac2, header->addr2), @@ -3966,22 +3966,22 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, /* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD). * This will be used later in iwl4965_rx_reply_rx() for REPLY_RX_MPDU_CMD. */ -static void iwl4965_rx_reply_rx_phy(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_reply_rx_phy(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; priv->last_phy_res[0] = 1; memcpy(&priv->last_phy_res[1], &(pkt->u.raw[0]), sizeof(struct iwl4965_rx_phy_res)); } -static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_missed_beacon_notif(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { #ifdef CONFIG_IWL4965_SENSITIVITY - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_missed_beacon_notif *missed_beacon; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_missed_beacon_notif *missed_beacon; missed_beacon = &pkt->u.missed_beacon; if (le32_to_cpu(missed_beacon->consequtive_missed_beacons) > 5) { @@ -4000,7 +4000,7 @@ static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG -static void iwl4965_set_tx_status(struct iwl_priv *priv, int txq_id, int idx, +static void iwl4965_set_tx_status(struct iwl4965_priv *priv, int txq_id, int idx, u32 status, u32 retry_count, u32 rate) { struct ieee80211_tx_status *tx_status = @@ -4012,7 +4012,7 @@ static void iwl4965_set_tx_status(struct iwl_priv *priv, int txq_id, int idx, } -static void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, +static void iwl4965_sta_modify_enable_tid_tx(struct iwl4965_priv *priv, int sta_id, int tid) { unsigned long flags; @@ -4023,13 +4023,13 @@ static void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; spin_unlock_irqrestore(&priv->sta_lock, flags); - iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); + iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); } -static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv, - struct iwl_ht_agg *agg, - struct iwl_compressed_ba_resp* +static int iwl4965_tx_status_reply_compressed_ba(struct iwl4965_priv *priv, + struct iwl4965_ht_agg *agg, + struct iwl4965_compressed_ba_resp* ba_resp) { @@ -4079,19 +4079,19 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv, return 0; } -static inline int iwl_queue_dec_wrap(int index, int n_bd) +static inline int iwl4965_queue_dec_wrap(int index, int n_bd) { return (index == 0) ? n_bd - 1 : index - 1; } -static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_reply_compressed_ba(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba; int index; - struct iwl_tx_queue *txq = NULL; - struct iwl_ht_agg *agg; + struct iwl4965_tx_queue *txq = NULL; + struct iwl4965_ht_agg *agg; u16 ba_resp_scd_flow = le16_to_cpu(ba_resp->scd_flow); u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); @@ -4102,7 +4102,7 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, txq = &priv->txq[ba_resp_scd_flow]; agg = &priv->stations[ba_resp->sta_id].tid[ba_resp->tid].agg; - index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); + index = iwl4965_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); /* TODO: Need to get this copy more safely - now good for debug */ /* @@ -4130,20 +4130,20 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, iwl4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); /* releases all the TFDs until the SSN */ if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) - iwl_tx_queue_reclaim(priv, ba_resp_scd_flow, index); + iwl4965_tx_queue_reclaim(priv, ba_resp_scd_flow, index); } -static void iwl4965_tx_queue_stop_scheduler(struct iwl_priv *priv, u16 txq_id) +static void iwl4965_tx_queue_stop_scheduler(struct iwl4965_priv *priv, u16 txq_id) { - iwl_write_prph(priv, + iwl4965_write_prph(priv, KDR_SCD_QUEUE_STATUS_BITS(txq_id), (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)| (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); } -static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, +static int iwl4965_tx_queue_set_q2ratid(struct iwl4965_priv *priv, u16 ra_tid, u16 txq_id) { u32 tbl_dw_addr; @@ -4155,14 +4155,14 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, tbl_dw_addr = priv->scd_base_addr + SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); - tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr); + tbl_dw = iwl4965_read_targ_mem(priv, tbl_dw_addr); if (txq_id & 0x1) tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); else tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); - iwl_write_targ_mem(priv, tbl_dw_addr, tbl_dw); + iwl4965_write_targ_mem(priv, tbl_dw_addr, tbl_dw); return 0; } @@ -4170,7 +4170,7 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, /** * txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID */ -static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, +static int iwl4965_tx_queue_agg_enable(struct iwl4965_priv *priv, int txq_id, int tx_fifo, int sta_id, int tid, u16 ssn_idx) { @@ -4184,10 +4184,10 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, ra_tid = BUILD_RAxTID(sta_id, tid); - iwl_sta_modify_enable_tid_tx(priv, sta_id, tid); + iwl4965_sta_modify_enable_tid_tx(priv, sta_id, tid); spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -4198,7 +4198,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); - iwl_set_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1<txq[txq_id].q.read_ptr = (ssn_idx & 0xff); priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); @@ -4206,21 +4206,21 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, /* supposes that ssn_idx is valid (!= 0xFFF) */ iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); - iwl_write_targ_mem(priv, + iwl4965_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(txq_id), (SCD_WIN_SIZE << SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); - iwl_write_targ_mem(priv, priv->scd_base_addr + + iwl4965_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), (SCD_FRAME_LIMIT << SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); - iwl_set_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id)); + iwl4965_set_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id)); iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -4229,7 +4229,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, /** * txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID */ -static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, +static int iwl4965_tx_queue_agg_disable(struct iwl4965_priv *priv, u16 txq_id, u16 ssn_idx, u8 tx_fifo) { unsigned long flags; @@ -4242,7 +4242,7 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, } spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; @@ -4250,18 +4250,18 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, iwl4965_tx_queue_stop_scheduler(priv, txq_id); - iwl_clear_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1 << txq_id)); + iwl4965_clear_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1 << txq_id)); priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); /* supposes that ssn_idx is valid (!= 0xFFF) */ iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); - iwl_clear_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id)); + iwl4965_clear_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id)); iwl4965_txq_ctx_deactivate(priv, txq_id); iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -4272,7 +4272,7 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, /* * RATE SCALE CODE */ -int iwl4965_init_hw_rates(struct iwl_priv *priv, struct ieee80211_rate *rates) +int iwl4965_init_hw_rates(struct iwl4965_priv *priv, struct ieee80211_rate *rates) { return 0; } @@ -4290,10 +4290,10 @@ int iwl4965_init_hw_rates(struct iwl_priv *priv, struct ieee80211_rate *rates) * rc80211_simple which is what this driver is currently using. * */ -void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) +void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) { int i, r; - struct iwl_link_quality_cmd link_cmd = { + struct iwl4965_link_quality_cmd link_cmd = { .reserved1 = 0, }; u16 rate_flags; @@ -4315,8 +4315,8 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) rate_flags |= RATE_MCS_ANT_B_MSK; rate_flags &= ~RATE_MCS_ANT_A_MSK; link_cmd.rs_table[i].rate_n_flags = - iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); - r = iwl_get_prev_ieee_rate(r); + iwl4965_hw_set_rate_n_flags(iwl4965_rates[r].plcp, rate_flags); + r = iwl4965_get_prev_ieee_rate(r); } link_cmd.general_params.single_stream_ant_msk = 2; @@ -4327,18 +4327,18 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) /* Update the rate scaling for control frame Tx to AP */ link_cmd.sta_id = is_ap ? IWL_AP_ID : IWL4965_BROADCAST_ID; - iwl_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, sizeof(link_cmd), + iwl4965_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, sizeof(link_cmd), &link_cmd); } #ifdef CONFIG_IWL4965_HT -static u8 iwl_is_channel_extension(struct iwl_priv *priv, int phymode, +static u8 iwl4965_is_channel_extension(struct iwl4965_priv *priv, int phymode, u16 channel, u8 extension_chan_offset) { - const struct iwl_channel_info *ch_info; + const struct iwl4965_channel_info *ch_info; - ch_info = iwl_get_channel_info(priv, phymode, channel); + ch_info = iwl4965_get_channel_info(priv, phymode, channel); if (!is_channel_valid(ch_info)) return 0; @@ -4352,7 +4352,7 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv, int phymode, return 0; } -static u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, +static u8 iwl4965_is_fat_tx_allowed(struct iwl4965_priv *priv, const struct sta_ht_info *ht_info) { @@ -4368,20 +4368,20 @@ static u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, /* no fat tx allowed on 2.4GHZ */ if (priv->phymode != MODE_IEEE80211A) return 0; - return (iwl_is_channel_extension(priv, priv->phymode, + return (iwl4965_is_channel_extension(priv, priv->phymode, ht_info->control_channel, ht_info->extension_chan_offset)); } -void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct sta_ht_info *ht_info) +void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct sta_ht_info *ht_info) { - struct iwl_rxon_cmd *rxon = &priv->staging_rxon; + struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; u32 val; if (!ht_info->is_ht) return; - if (iwl_is_fat_tx_allowed(priv, ht_info)) + if (iwl4965_is_fat_tx_allowed(priv, ht_info)) rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED_MSK; else rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK | @@ -4430,7 +4430,7 @@ void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct sta_ht_info *ht_info) return; } -void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index) +void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index) { __le32 sta_flags; struct sta_ht_info *ht_info = &priv->current_assoc_ht; @@ -4456,7 +4456,7 @@ void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index) ht_info->tx_chan_width = IWL_CHANNEL_WIDTH_20MHZ; ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_20MHZ; - if (iwl_is_fat_tx_allowed(priv, ht_info)) { + if (iwl4965_is_fat_tx_allowed(priv, ht_info)) { sta_flags |= STA_FLG_FAT_EN_MSK; ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_40MHZ; if (ht_info->supported_chan_width == IWL_CHANNEL_WIDTH_40MHZ) @@ -4470,7 +4470,7 @@ void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index) #ifdef CONFIG_IWL4965_HT_AGG -static void iwl4965_sta_modify_add_ba_tid(struct iwl_priv *priv, +static void iwl4965_sta_modify_add_ba_tid(struct iwl4965_priv *priv, int sta_id, int tid, u16 ssn) { unsigned long flags; @@ -4483,10 +4483,10 @@ static void iwl4965_sta_modify_add_ba_tid(struct iwl_priv *priv, priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; spin_unlock_irqrestore(&priv->sta_lock, flags); - iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); + iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); } -static void iwl4965_sta_modify_del_ba_tid(struct iwl_priv *priv, +static void iwl4965_sta_modify_del_ba_tid(struct iwl4965_priv *priv, int sta_id, int tid) { unsigned long flags; @@ -4498,7 +4498,7 @@ static void iwl4965_sta_modify_del_ba_tid(struct iwl_priv *priv, priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; spin_unlock_irqrestore(&priv->sta_lock, flags); - iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); + iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); } static const u16 default_tid_to_tx_fifo[] = { @@ -4521,7 +4521,7 @@ static const u16 default_tid_to_tx_fifo[] = { IWL_TX_FIFO_AC3 }; -static int iwl_txq_ctx_activate_free(struct iwl_priv *priv) +static int iwl4965_txq_ctx_activate_free(struct iwl4965_priv *priv) { int txq_id; @@ -4531,17 +4531,17 @@ static int iwl_txq_ctx_activate_free(struct iwl_priv *priv) return -1; } -int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, +int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, u16 *start_seq_num) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; int sta_id; int tx_fifo; int txq_id; int ssn = -1; unsigned long flags; - struct iwl_tid_data *tid_data; + struct iwl4965_tid_data *tid_data; DECLARE_MAC_BUF(mac); if (likely(tid < ARRAY_SIZE(default_tid_to_tx_fifo))) @@ -4549,14 +4549,14 @@ int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, else return -EINVAL; - IWL_WARNING("iwl-AGG iwl_mac_ht_tx_agg_start on da=%s" + IWL_WARNING("iwl-AGG iwl4965_mac_ht_tx_agg_start on da=%s" " tid=%d\n", print_mac(mac, da), tid); - sta_id = iwl_hw_find_station(priv, da); + sta_id = iwl4965_hw_find_station(priv, da); if (sta_id == IWL_INVALID_STATION) return -ENXIO; - txq_id = iwl_txq_ctx_activate_free(priv); + txq_id = iwl4965_txq_ctx_activate_free(priv); if (txq_id == -1) return -ENXIO; @@ -4573,13 +4573,13 @@ int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, } -int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, +int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, int generator) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; int tx_fifo_id, txq_id, sta_id, ssn = -1; - struct iwl_tid_data *tid_data; + struct iwl4965_tid_data *tid_data; int rc; DECLARE_MAC_BUF(mac); @@ -4593,7 +4593,7 @@ int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, else return -EINVAL; - sta_id = iwl_hw_find_station(priv, da); + sta_id = iwl4965_hw_find_station(priv, da); if (sta_id == IWL_INVALID_STATION) return -ENXIO; @@ -4608,36 +4608,36 @@ int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, return rc; iwl4965_ba_status(priv, tid, BA_STATUS_INITIATOR_DELBA); - IWL_DEBUG_INFO("iwl_mac_ht_tx_agg_stop on da=%s tid=%d\n", + IWL_DEBUG_INFO("iwl4965_mac_ht_tx_agg_stop on da=%s tid=%d\n", print_mac(mac, da), tid); return 0; } -int iwl_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da, +int iwl4965_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, u16 start_seq_num) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; int sta_id; DECLARE_MAC_BUF(mac); - IWL_WARNING("iwl-AGG iwl_mac_ht_rx_agg_start on da=%s" + IWL_WARNING("iwl-AGG iwl4965_mac_ht_rx_agg_start on da=%s" " tid=%d\n", print_mac(mac, da), tid); - sta_id = iwl_hw_find_station(priv, da); + sta_id = iwl4965_hw_find_station(priv, da); iwl4965_sta_modify_add_ba_tid(priv, sta_id, tid, start_seq_num); return 0; } -int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, +int iwl4965_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, int generator) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; int sta_id; DECLARE_MAC_BUF(mac); - IWL_WARNING("iwl-AGG iwl_mac_ht_rx_agg_stop on da=%s tid=%d\n", + IWL_WARNING("iwl-AGG iwl4965_mac_ht_rx_agg_stop on da=%s tid=%d\n", print_mac(mac, da), tid); - sta_id = iwl_hw_find_station(priv, da); + sta_id = iwl4965_hw_find_station(priv, da); iwl4965_sta_modify_del_ba_tid(priv, sta_id, tid); return 0; } @@ -4646,7 +4646,7 @@ int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, #endif /* CONFIG_IWL4965_HT */ /* Set up 4965-specific Rx frame reply handlers */ -void iwl_hw_rx_handler_setup(struct iwl_priv *priv) +void iwl4965_hw_rx_handler_setup(struct iwl4965_priv *priv) { /* Legacy Rx frames */ priv->rx_handlers[REPLY_4965_RX] = iwl4965_rx_reply_rx; @@ -4665,7 +4665,7 @@ void iwl_hw_rx_handler_setup(struct iwl_priv *priv) #endif /* CONFIG_IWL4965_HT */ } -void iwl_hw_setup_deferred_work(struct iwl_priv *priv) +void iwl4965_hw_setup_deferred_work(struct iwl4965_priv *priv) { INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work); INIT_WORK(&priv->statistics_work, iwl4965_bg_statistics_work); @@ -4682,28 +4682,28 @@ void iwl_hw_setup_deferred_work(struct iwl_priv *priv) priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; } -void iwl_hw_cancel_deferred_work(struct iwl_priv *priv) +void iwl4965_hw_cancel_deferred_work(struct iwl4965_priv *priv) { del_timer_sync(&priv->statistics_periodic); cancel_delayed_work(&priv->init_alive_start); } -struct pci_device_id iwl_hw_card_ids[] = { +struct pci_device_id iwl4965_hw_card_ids[] = { {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4229)}, {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4230)}, {0} }; -int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv) +int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv) { u16 count; int rc; for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) { - iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, + iwl4965_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); - rc = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG, + rc = iwl4965_poll_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, EEPROM_SEM_TIMEOUT); @@ -4717,11 +4717,11 @@ int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv) return rc; } -inline void iwl_eeprom_release_semaphore(struct iwl_priv *priv) +inline void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv) { - iwl_clear_bit(priv, CSR_HW_IF_CONFIG_REG, + iwl4965_clear_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); } -MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); +MODULE_DEVICE_TABLE(pci, iwl4965_hw_card_ids); diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index d61cf0e26e8..5944b4b9828 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -30,10 +30,10 @@ #include #include -struct iwl_priv; +struct iwl4965_priv; /* Hardware specific file defines the PCI IDs table for that hardware module */ -extern struct pci_device_id iwl_hw_card_ids[]; +extern struct pci_device_id iwl4965_hw_card_ids[]; #define DRV_NAME "iwl4965" #include "iwl-4965-hw.h" @@ -54,10 +54,10 @@ extern struct pci_device_id iwl_hw_card_ids[]; #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) /* Module parameters accessible from iwl-*.c */ -extern int iwl_param_hwcrypto; -extern int iwl_param_queues_num; +extern int iwl4965_param_hwcrypto; +extern int iwl4965_param_queues_num; -enum iwl_antenna { +enum iwl4965_antenna { IWL_ANTENNA_DIVERSITY, IWL_ANTENNA_MAIN, IWL_ANTENNA_AUX @@ -80,13 +80,13 @@ enum iwl_antenna { #define DEFAULT_SHORT_RETRY_LIMIT 7U #define DEFAULT_LONG_RETRY_LIMIT 4U -struct iwl_rx_mem_buffer { +struct iwl4965_rx_mem_buffer { dma_addr_t dma_addr; struct sk_buff *skb; struct list_head list; }; -struct iwl_rt_rx_hdr { +struct iwl4965_rt_rx_hdr { struct ieee80211_radiotap_header rt_hdr; __le64 rt_tsf; /* TSF */ u8 rt_flags; /* radiotap packet flags */ @@ -99,7 +99,7 @@ struct iwl_rt_rx_hdr { u8 payload[0]; /* payload... */ } __attribute__ ((packed)); -struct iwl_rt_tx_hdr { +struct iwl4965_rt_tx_hdr { struct ieee80211_radiotap_header rt_hdr; u8 rt_rate; /* rate in 500kb/s */ __le16 rt_channel; /* channel in mHz */ @@ -114,7 +114,7 @@ struct iwl_rt_tx_hdr { * * Contains common data for Rx and Tx queues */ -struct iwl_queue { +struct iwl4965_queue { int n_bd; /* number of BDs in this queue */ int write_ptr; /* 1-st empty entry (index) host_w*/ int read_ptr; /* last used entry (index) host_r*/ @@ -129,24 +129,24 @@ struct iwl_queue { #define MAX_NUM_OF_TBS (20) -struct iwl_tx_info { +struct iwl4965_tx_info { struct ieee80211_tx_status status; struct sk_buff *skb[MAX_NUM_OF_TBS]; }; /** - * struct iwl_tx_queue - Tx Queue for DMA + * struct iwl4965_tx_queue - Tx Queue for DMA * @need_update: need to update read/write index * @shed_retry: queue is HT AGG enabled * * Queue consists of circular buffer of BD's and required locking structures. */ -struct iwl_tx_queue { - struct iwl_queue q; - struct iwl_tfd_frame *bd; - struct iwl_cmd *cmd; +struct iwl4965_tx_queue { + struct iwl4965_queue q; + struct iwl4965_tfd_frame *bd; + struct iwl4965_cmd *cmd; dma_addr_t dma_addr_cmd; - struct iwl_tx_info *txb; + struct iwl4965_tx_info *txb; int need_update; int sched_retry; int active; @@ -154,12 +154,12 @@ struct iwl_tx_queue { #define IWL_NUM_SCAN_RATES (2) -struct iwl_channel_tgd_info { +struct iwl4965_channel_tgd_info { u8 type; s8 max_power; }; -struct iwl_channel_tgh_info { +struct iwl4965_channel_tgh_info { s64 last_radar_time; }; @@ -170,8 +170,8 @@ struct iwl_channel_tgh_info { * -- spectrum management * -- user preference (e.g. iwconfig) * when requested power is set, base power index must also be set. */ -struct iwl_channel_power_info { - struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ +struct iwl4965_channel_power_info { + struct iwl4965_tx_power tpc; /* actual radio and DSP gain settings */ s8 power_table_index; /* actual (compenst'd) index into gain table */ s8 base_power_index; /* gain index for power at factory temp. */ s8 requested_power; /* power (dBm) requested for this chnl/rate */ @@ -179,8 +179,8 @@ struct iwl_channel_power_info { /* current scan Tx power values to use, one for each scan rate for each * channel. */ -struct iwl_scan_power_info { - struct iwl_tx_power tpc; /* actual radio and DSP gain settings */ +struct iwl4965_scan_power_info { + struct iwl4965_tx_power tpc; /* actual radio and DSP gain settings */ s8 power_table_index; /* actual (compenst'd) index into gain table */ s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ }; @@ -200,11 +200,11 @@ struct iwl_scan_power_info { */ #define IWL4965_MAX_RATE (33) -struct iwl_channel_info { - struct iwl_channel_tgd_info tgd; - struct iwl_channel_tgh_info tgh; - struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ - struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for +struct iwl4965_channel_info { + struct iwl4965_channel_tgd_info tgd; + struct iwl4965_channel_tgh_info tgh; + struct iwl4965_eeprom_channel eeprom; /* EEPROM regulatory limit */ + struct iwl4965_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for * FAT channel */ u8 channel; /* channel number */ @@ -221,7 +221,7 @@ struct iwl_channel_info { /* Radio/DSP gain settings for each "normal" data Tx rate. * These include, in addition to RF and DSP gain, a few fields for * remembering/modifying gain settings (indexes). */ - struct iwl_channel_power_info power_info[IWL4965_MAX_RATE]; + struct iwl4965_channel_power_info power_info[IWL4965_MAX_RATE]; /* FAT channel info */ s8 fat_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ @@ -232,10 +232,10 @@ struct iwl_channel_info { u8 fat_extension_channel; /* Radio/DSP gain settings for each scan rate, for directed scans. */ - struct iwl_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; + struct iwl4965_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; }; -struct iwl_clip_group { +struct iwl4965_clip_group { /* maximum power level to prevent clipping for each rate, derived by * us from this band's saturation power in EEPROM */ const s8 clip_powers[IWL_MAX_RATES]; @@ -256,8 +256,8 @@ struct iwl_clip_group { /* Power management (not Tx power) structures */ -struct iwl_power_vec_entry { - struct iwl_powertable_cmd cmd; +struct iwl4965_power_vec_entry { + struct iwl4965_powertable_cmd cmd; u8 no_dtim; }; #define IWL_POWER_RANGE_0 (0) @@ -273,10 +273,10 @@ struct iwl_power_vec_entry { #define IWL_POWER_ENABLED 0x10 #define IWL_POWER_LEVEL(x) ((x) & IWL_POWER_MASK) -struct iwl_power_mgr { +struct iwl4965_power_mgr { spinlock_t lock; - struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC]; - struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC]; + struct iwl4965_power_vec_entry pwr_range_0[IWL_POWER_AC]; + struct iwl4965_power_vec_entry pwr_range_1[IWL_POWER_AC]; u8 active_index; u32 dtim_val; }; @@ -286,10 +286,10 @@ struct iwl_power_mgr { #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) -struct iwl_frame { +struct iwl4965_frame { union { struct ieee80211_hdr frame; - struct iwl_tx_beacon_cmd beacon; + struct iwl4965_tx_beacon_cmd beacon; u8 raw[IEEE80211_FRAME_LEN]; u8 cmd[360]; } u; @@ -315,15 +315,15 @@ enum { CMD_WANT_SKB = (1 << 2), }; -struct iwl_cmd; -struct iwl_priv; +struct iwl4965_cmd; +struct iwl4965_priv; -struct iwl_cmd_meta { - struct iwl_cmd_meta *source; +struct iwl4965_cmd_meta { + struct iwl4965_cmd_meta *source; union { struct sk_buff *skb; - int (*callback)(struct iwl_priv *priv, - struct iwl_cmd *cmd, struct sk_buff *skb); + int (*callback)(struct iwl4965_priv *priv, + struct iwl4965_cmd *cmd, struct sk_buff *skb); } __attribute__ ((packed)) u; /* The CMD_SIZE_HUGE flag bit indicates that the command @@ -332,37 +332,37 @@ struct iwl_cmd_meta { } __attribute__ ((packed)); -struct iwl_cmd { - struct iwl_cmd_meta meta; - struct iwl_cmd_header hdr; +struct iwl4965_cmd { + struct iwl4965_cmd_meta meta; + struct iwl4965_cmd_header hdr; union { - struct iwl_addsta_cmd addsta; - struct iwl_led_cmd led; + struct iwl4965_addsta_cmd addsta; + struct iwl4965_led_cmd led; u32 flags; u8 val8; u16 val16; u32 val32; - struct iwl_bt_cmd bt; - struct iwl_rxon_time_cmd rxon_time; - struct iwl_powertable_cmd powertable; - struct iwl_qosparam_cmd qosparam; - struct iwl_tx_cmd tx; - struct iwl_tx_beacon_cmd tx_beacon; - struct iwl_rxon_assoc_cmd rxon_assoc; + struct iwl4965_bt_cmd bt; + struct iwl4965_rxon_time_cmd rxon_time; + struct iwl4965_powertable_cmd powertable; + struct iwl4965_qosparam_cmd qosparam; + struct iwl4965_tx_cmd tx; + struct iwl4965_tx_beacon_cmd tx_beacon; + struct iwl4965_rxon_assoc_cmd rxon_assoc; u8 *indirect; u8 payload[360]; } __attribute__ ((packed)) cmd; } __attribute__ ((packed)); -struct iwl_host_cmd { +struct iwl4965_host_cmd { u8 id; u16 len; - struct iwl_cmd_meta meta; + struct iwl4965_cmd_meta meta; const void *data; }; -#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ - sizeof(struct iwl_cmd_meta)) +#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \ + sizeof(struct iwl4965_cmd_meta)) /* * RX related structures and functions @@ -375,7 +375,7 @@ struct iwl_host_cmd { #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 /** - * struct iwl_rx_queue - Rx queue + * struct iwl4965_rx_queue - Rx queue * @processed: Internal index to last handled Rx packet * @read: Shared index to newest available Rx buffer * @write: Shared index to oldest written Rx packet @@ -384,13 +384,13 @@ struct iwl_host_cmd { * @rx_used: List of Rx buffers with no SKB * @need_update: flag to indicate we need to update read/write index * - * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers + * NOTE: rx_free and rx_used are used as a FIFO for iwl4965_rx_mem_buffers */ -struct iwl_rx_queue { +struct iwl4965_rx_queue { __le32 *bd; dma_addr_t dma_addr; - struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; - struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; + struct iwl4965_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; + struct iwl4965_rx_mem_buffer *queue[RX_QUEUE_SIZE]; u32 processed; u32 read; u32 write; @@ -436,7 +436,7 @@ struct iwl_rx_queue { #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG -struct iwl_ht_agg { +struct iwl4965_ht_agg { u16 txq_id; u16 frame_count; u16 wait_for_ba; @@ -448,22 +448,22 @@ struct iwl_ht_agg { #endif /* CONFIG_IWL4965_HT_AGG */ #endif /* CONFIG_IWL4965_HT */ -struct iwl_tid_data { +struct iwl4965_tid_data { u16 seq_number; #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG - struct iwl_ht_agg agg; + struct iwl4965_ht_agg agg; #endif /* CONFIG_IWL4965_HT_AGG */ #endif /* CONFIG_IWL4965_HT */ }; -struct iwl_hw_key { +struct iwl4965_hw_key { enum ieee80211_key_alg alg; int keylen; u8 key[32]; }; -union iwl_ht_rate_supp { +union iwl4965_ht_rate_supp { u16 rates; struct { u8 siso_rate; @@ -498,7 +498,7 @@ struct sta_ht_info { #ifdef CONFIG_IWL4965_QOS -union iwl_qos_capabity { +union iwl4965_qos_capabity { struct { u8 edca_count:4; /* bit 0-3 */ u8 q_ack:1; /* bit 4 */ @@ -519,23 +519,23 @@ union iwl_qos_capabity { }; /* QoS structures */ -struct iwl_qos_info { +struct iwl4965_qos_info { int qos_enable; int qos_active; - union iwl_qos_capabity qos_cap; - struct iwl_qosparam_cmd def_qos_parm; + union iwl4965_qos_capabity qos_cap; + struct iwl4965_qosparam_cmd def_qos_parm; }; #endif /*CONFIG_IWL4965_QOS */ #define STA_PS_STATUS_WAKE 0 #define STA_PS_STATUS_SLEEP 1 -struct iwl_station_entry { - struct iwl_addsta_cmd sta; - struct iwl_tid_data tid[MAX_TID_COUNT]; +struct iwl4965_station_entry { + struct iwl4965_addsta_cmd sta; + struct iwl4965_tid_data tid[MAX_TID_COUNT]; u8 used; u8 ps_status; - struct iwl_hw_key keyinfo; + struct iwl4965_hw_key keyinfo; }; /* one for each uCode image (inst/data, boot/init/runtime) */ @@ -546,7 +546,7 @@ struct fw_desc { }; /* uCode file layout */ -struct iwl_ucode { +struct iwl4965_ucode { __le32 ver; /* major/minor/subminor */ __le32 inst_size; /* bytes of runtime instructions */ __le32 data_size; /* bytes of runtime data */ @@ -558,7 +558,7 @@ struct iwl_ucode { #define IWL_IBSS_MAC_HASH_SIZE 32 -struct iwl_ibss_seq { +struct iwl4965_ibss_seq { u8 mac[ETH_ALEN]; u16 seq_num; u16 frag_num; @@ -566,7 +566,7 @@ struct iwl_ibss_seq { struct list_head list; }; -struct iwl_driver_hw_info { +struct iwl4965_driver_hw_info { u16 max_txq_num; u16 ac_queue_count; u16 tx_cmd_len; @@ -592,10 +592,10 @@ struct iwl_driver_hw_info { #define HT_SHORT_GI_40MHZ_ONLY (1 << 1) -#define IWL_RX_HDR(x) ((struct iwl_rx_frame_hdr *)(\ +#define IWL_RX_HDR(x) ((struct iwl4965_rx_frame_hdr *)(\ x->u.rx_frame.stats.payload + \ x->u.rx_frame.stats.phy_count)) -#define IWL_RX_END(x) ((struct iwl_rx_frame_end *)(\ +#define IWL_RX_END(x) ((struct iwl4965_rx_frame_end *)(\ IWL_RX_HDR(x)->payload + \ le16_to_cpu(IWL_RX_HDR(x)->len))) #define IWL_RX_STATS(x) (&x->u.rx_frame.stats) @@ -608,63 +608,63 @@ struct iwl_driver_hw_info { * for use by iwl-*.c * *****************************************************************************/ -struct iwl_addsta_cmd; -extern int iwl_send_add_station(struct iwl_priv *priv, - struct iwl_addsta_cmd *sta, u8 flags); -extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid, +struct iwl4965_addsta_cmd; +extern int iwl4965_send_add_station(struct iwl4965_priv *priv, + struct iwl4965_addsta_cmd *sta, u8 flags); +extern u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *bssid, int is_ap, u8 flags); -extern int iwl_is_network_packet(struct iwl_priv *priv, +extern int iwl4965_is_network_packet(struct iwl4965_priv *priv, struct ieee80211_hdr *header); -extern int iwl_power_init_handle(struct iwl_priv *priv); -extern int iwl_eeprom_init(struct iwl_priv *priv); +extern int iwl4965_power_init_handle(struct iwl4965_priv *priv); +extern int iwl4965_eeprom_init(struct iwl4965_priv *priv); #ifdef CONFIG_IWL4965_DEBUG -extern void iwl_report_frame(struct iwl_priv *priv, - struct iwl_rx_packet *pkt, +extern void iwl4965_report_frame(struct iwl4965_priv *priv, + struct iwl4965_rx_packet *pkt, struct ieee80211_hdr *header, int group100); #else -static inline void iwl_report_frame(struct iwl_priv *priv, - struct iwl_rx_packet *pkt, +static inline void iwl4965_report_frame(struct iwl4965_priv *priv, + struct iwl4965_rx_packet *pkt, struct ieee80211_hdr *header, int group100) {} #endif -extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb, +extern void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb, void *data, short len, struct ieee80211_rx_status *stats, u16 phy_flags); -extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr - *header); -extern int iwl_rx_queue_alloc(struct iwl_priv *priv); -extern void iwl_rx_queue_reset(struct iwl_priv *priv, - struct iwl_rx_queue *rxq); -extern int iwl_calc_db_from_ratio(int sig_ratio); -extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm); -extern int iwl_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq, int count, u32 id); -extern void iwl_rx_replenish(void *data); -extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); -extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, +extern int iwl4965_is_duplicate_packet(struct iwl4965_priv *priv, + struct ieee80211_hdr *header); +extern int iwl4965_rx_queue_alloc(struct iwl4965_priv *priv); +extern void iwl4965_rx_queue_reset(struct iwl4965_priv *priv, + struct iwl4965_rx_queue *rxq); +extern int iwl4965_calc_db_from_ratio(int sig_ratio); +extern int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm); +extern int iwl4965_tx_queue_init(struct iwl4965_priv *priv, + struct iwl4965_tx_queue *txq, int count, u32 id); +extern void iwl4965_rx_replenish(void *data); +extern void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq); +extern int iwl4965_send_cmd_pdu(struct iwl4965_priv *priv, u8 id, u16 len, const void *data); -extern int __must_check iwl_send_cmd(struct iwl_priv *priv, - struct iwl_host_cmd *cmd); -extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, +extern int __must_check iwl4965_send_cmd(struct iwl4965_priv *priv, + struct iwl4965_host_cmd *cmd); +extern unsigned int iwl4965_fill_beacon_frame(struct iwl4965_priv *priv, struct ieee80211_hdr *hdr, const u8 *dest, int left); -extern int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_rx_queue *q); -extern int iwl_send_statistics_request(struct iwl_priv *priv); -extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, +extern int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, + struct iwl4965_rx_queue *q); +extern int iwl4965_send_statistics_request(struct iwl4965_priv *priv); +extern void iwl4965_set_decrypted_flag(struct iwl4965_priv *priv, struct sk_buff *skb, u32 decrypt_res, struct ieee80211_rx_status *stats); extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr); -extern const u8 BROADCAST_ADDR[ETH_ALEN]; +extern const u8 iwl4965_broadcast_addr[ETH_ALEN]; /* * Currently used by iwl-3945-rs... look at restructuring so that it doesn't * call this... todo... fix that. */ -extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id, +extern u8 iwl4965_sync_station(struct iwl4965_priv *priv, int sta_id, u16 tx_rate, u8 flags); /****************************************************************************** @@ -676,112 +676,110 @@ extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id, * which is why they are in the hardware specific files (vs. iwl-base.c) * * Naming convention -- - * iwl_ <-- Its part of iwlwifi (should be changed to iwl_) - * iwl_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) + * iwl4965_ <-- Its part of iwlwifi (should be changed to iwl4965_) + * iwl4965_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) - * iwl_bg_ <-- Called from work queue context - * iwl_mac_ <-- mac80211 callback + * iwl4965_bg_ <-- Called from work queue context + * iwl4965_mac_ <-- mac80211 callback * ****************************************************************************/ -extern void iwl_hw_rx_handler_setup(struct iwl_priv *priv); -extern void iwl_hw_setup_deferred_work(struct iwl_priv *priv); -extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv); -extern int iwl_hw_rxq_stop(struct iwl_priv *priv); -extern int iwl_hw_set_hw_setting(struct iwl_priv *priv); -extern int iwl_hw_nic_init(struct iwl_priv *priv); -extern int iwl_hw_nic_stop_master(struct iwl_priv *priv); -extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv); -extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv); -extern int iwl_hw_nic_reset(struct iwl_priv *priv); -extern int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd, +extern void iwl4965_hw_rx_handler_setup(struct iwl4965_priv *priv); +extern void iwl4965_hw_setup_deferred_work(struct iwl4965_priv *priv); +extern void iwl4965_hw_cancel_deferred_work(struct iwl4965_priv *priv); +extern int iwl4965_hw_rxq_stop(struct iwl4965_priv *priv); +extern int iwl4965_hw_set_hw_setting(struct iwl4965_priv *priv); +extern int iwl4965_hw_nic_init(struct iwl4965_priv *priv); +extern int iwl4965_hw_nic_stop_master(struct iwl4965_priv *priv); +extern void iwl4965_hw_txq_ctx_free(struct iwl4965_priv *priv); +extern void iwl4965_hw_txq_ctx_stop(struct iwl4965_priv *priv); +extern int iwl4965_hw_nic_reset(struct iwl4965_priv *priv); +extern int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl4965_priv *priv, void *tfd, dma_addr_t addr, u16 len); -extern int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); -extern int iwl_hw_get_temperature(struct iwl_priv *priv); -extern int iwl_hw_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq); -extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, - struct iwl_frame *frame, u8 rate); -extern int iwl_hw_get_rx_read(struct iwl_priv *priv); -extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, - struct iwl_cmd *cmd, +extern int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq); +extern int iwl4965_hw_get_temperature(struct iwl4965_priv *priv); +extern int iwl4965_hw_tx_queue_init(struct iwl4965_priv *priv, + struct iwl4965_tx_queue *txq); +extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl4965_priv *priv, + struct iwl4965_frame *frame, u8 rate); +extern int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv); +extern void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv, + struct iwl4965_cmd *cmd, struct ieee80211_tx_control *ctrl, struct ieee80211_hdr *hdr, int sta_id, int tx_id); -extern int iwl_hw_reg_send_txpower(struct iwl_priv *priv); -extern int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); -extern void iwl_hw_rx_statistics(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); -extern void iwl_disable_events(struct iwl_priv *priv); -extern int iwl4965_get_temperature(const struct iwl_priv *priv); +extern int iwl4965_hw_reg_send_txpower(struct iwl4965_priv *priv); +extern int iwl4965_hw_reg_set_txpower(struct iwl4965_priv *priv, s8 power); +extern void iwl4965_hw_rx_statistics(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb); +extern void iwl4965_disable_events(struct iwl4965_priv *priv); +extern int iwl4965_get_temperature(const struct iwl4965_priv *priv); /** - * iwl_hw_find_station - Find station id for a given BSSID + * iwl4965_hw_find_station - Find station id for a given BSSID * @bssid: MAC address of station ID to find * * NOTE: This should not be hardware specific but the code has * not yet been merged into a single common layer for managing the * station tables. */ -extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid); +extern u8 iwl4965_hw_find_station(struct iwl4965_priv *priv, const u8 *bssid); -extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel); -extern int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index); +extern int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel); +extern int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index); -struct iwl_priv; +struct iwl4965_priv; struct sta_ht_info; /* * Forward declare iwl-4965.c functions for iwl-base.c */ -extern int iwl_eeprom_acquire_semaphore(struct iwl_priv *priv); -extern void iwl_eeprom_release_semaphore(struct iwl_priv *priv); +extern int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv); +extern void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv); -extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv, - struct iwl_tx_queue *txq, +extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv, + struct iwl4965_tx_queue *txq, u16 byte_cnt); -extern void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, +extern void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap); -extern void iwl4965_set_rxon_ht(struct iwl_priv *priv, +extern void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct sta_ht_info *ht_info); -extern void iwl4965_set_rxon_chain(struct iwl_priv *priv); -extern int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, +extern void iwl4965_set_rxon_chain(struct iwl4965_priv *priv); +extern int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd, u8 sta_id, dma_addr_t txcmd_phys, struct ieee80211_hdr *hdr, u8 hdr_len, struct ieee80211_tx_control *ctrl, void *sta_in); -extern int iwl4965_init_hw_rates(struct iwl_priv *priv, - struct ieee80211_rate *rates); -extern int iwl4965_alive_notify(struct iwl_priv *priv); -extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode); -extern void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index); - -extern void iwl4965_chain_noise_reset(struct iwl_priv *priv); -extern void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, +extern int iwl4965_alive_notify(struct iwl4965_priv *priv); +extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode); +extern void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index); + +extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv); +extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags, u8 force); -extern int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, +extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode, u16 channel, - const struct iwl_eeprom_channel *eeprom_ch, + const struct iwl4965_eeprom_channel *eeprom_ch, u8 fat_extension_channel); -extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv); +extern void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv); #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG -extern int iwl_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, +extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, u16 *start_seq_num); -extern int iwl_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da, +extern int iwl4965_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, u16 start_seq_num); -extern int iwl_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, +extern int iwl4965_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, int generator); -extern int iwl_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, +extern int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, int generator); -extern void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid); +extern void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid); #endif /* CONFIG_IWL4965_HT_AGG */ #endif /*CONFIG_IWL4965_HT */ /* Structures, enum, and defines specific to the 4965 */ #define IWL4965_KW_SIZE 0x1000 /*4k */ -struct iwl_kw { +struct iwl4965_kw { dma_addr_t dma_addr; void *v_addr; size_t size; @@ -835,7 +833,7 @@ struct iwl_kw { #define IWL_TX_POWER_CCK_COMPENSATION_B_STEP (9) #define IWL_TX_POWER_CCK_COMPENSATION_C_STEP (5) -struct iwl_traffic_load { +struct iwl4965_traffic_load { unsigned long time_stamp; u32 packet_count[TID_QUEUE_MAX_SIZE]; u8 queue_count; @@ -844,7 +842,7 @@ struct iwl_traffic_load { }; #ifdef CONFIG_IWL4965_HT_AGG -struct iwl_agg_control { +struct iwl4965_agg_control { unsigned long next_retry; u32 wait_for_agg_status; u32 tid_retry; @@ -853,13 +851,13 @@ struct iwl_agg_control { u8 auto_agg; u32 tid_traffic_load_threshold; u32 ba_timeout; - struct iwl_traffic_load traffic_load[TID_MAX_LOAD_COUNT]; + struct iwl4965_traffic_load traffic_load[TID_MAX_LOAD_COUNT]; }; #endif /*CONFIG_IWL4965_HT_AGG */ -struct iwl_lq_mngr { +struct iwl4965_lq_mngr { #ifdef CONFIG_IWL4965_HT_AGG - struct iwl_agg_control agg_ctrl; + struct iwl4965_agg_control agg_ctrl; #endif spinlock_t lock; s32 max_window_size; @@ -940,24 +938,24 @@ struct iwl_lq_mngr { #define IN_BAND_FILTER 0xFF #define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF -enum iwl_false_alarm_state { +enum iwl4965_false_alarm_state { IWL_FA_TOO_MANY = 0, IWL_FA_TOO_FEW = 1, IWL_FA_GOOD_RANGE = 2, }; -enum iwl_chain_noise_state { +enum iwl4965_chain_noise_state { IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ IWL_CHAIN_NOISE_ACCUMULATE = 1, IWL_CHAIN_NOISE_CALIBRATED = 2, }; -enum iwl_sensitivity_state { +enum iwl4965_sensitivity_state { IWL_SENS_CALIB_ALLOWED = 0, IWL_SENS_CALIB_NEED_REINIT = 1, }; -enum iwl_calib_enabled_state { +enum iwl4965_calib_enabled_state { IWL_CALIB_DISABLED = 0, /* must be 0 */ IWL_CALIB_ENABLED = 1, }; @@ -972,7 +970,7 @@ struct statistics_general_data { }; /* Sensitivity calib data */ -struct iwl_sensitivity_data { +struct iwl4965_sensitivity_data { u32 auto_corr_ofdm; u32 auto_corr_ofdm_mrc; u32 auto_corr_ofdm_x1; @@ -1001,7 +999,7 @@ struct iwl_sensitivity_data { }; /* Chain noise (differential Rx gain) calib data */ -struct iwl_chain_noise_data { +struct iwl4965_chain_noise_data { u8 state; u16 beacon_count; u32 chain_noise_a; @@ -1049,7 +1047,7 @@ enum { #endif -struct iwl_priv { +struct iwl4965_priv { /* ieee device used by generic ieee processing code */ struct ieee80211_hw *hw; @@ -1063,27 +1061,27 @@ struct iwl_priv { u8 phymode; int alloc_rxb_skb; - void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb); + void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb); const struct ieee80211_hw_mode *modes; #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT /* spectrum measurement report caching */ - struct iwl_spectrum_notification measure_report; + struct iwl4965_spectrum_notification measure_report; u8 measurement_status; #endif /* ucode beacon time */ u32 ucode_beacon_time; - /* we allocate array of iwl_channel_info for NIC's valid channels. + /* we allocate array of iwl4965_channel_info for NIC's valid channels. * Access via channel # using indirect index array */ - struct iwl_channel_info *channel_info; /* channel info array */ + struct iwl4965_channel_info *channel_info; /* channel info array */ u8 channel_count; /* # of channels */ /* each calibration channel group in the EEPROM has a derived * clip setting for each rate. */ - const struct iwl_clip_group clip_groups[5]; + const struct iwl4965_clip_group clip_groups[5]; /* thermal calibration */ s32 temperature; /* degrees Kelvin */ @@ -1098,7 +1096,7 @@ struct iwl_priv { int one_direct_scan; u8 direct_ssid_len; u8 direct_ssid[IW_ESSID_MAX_SIZE]; - struct iwl_scan_cmd *scan; + struct iwl4965_scan_cmd *scan; u8 only_active_channel; /* spinlock */ @@ -1121,26 +1119,26 @@ struct iwl_priv { struct fw_desc ucode_boot; /* bootstrap inst */ - struct iwl_rxon_time_cmd rxon_timing; + struct iwl4965_rxon_time_cmd rxon_timing; /* We declare this const so it can only be * changed via explicit cast within the * routines that actually update the physical * hardware */ - const struct iwl_rxon_cmd active_rxon; - struct iwl_rxon_cmd staging_rxon; + const struct iwl4965_rxon_cmd active_rxon; + struct iwl4965_rxon_cmd staging_rxon; int error_recovering; - struct iwl_rxon_cmd recovery_rxon; + struct iwl4965_rxon_cmd recovery_rxon; /* 1st responses from initialize and runtime uCode images. * 4965's initialize alive response contains some calibration data. */ - struct iwl_init_alive_resp card_alive_init; - struct iwl_alive_resp card_alive; + struct iwl4965_init_alive_resp card_alive_init; + struct iwl4965_alive_resp card_alive; #ifdef LED /* LED related variables */ - struct iwl_activity_blink activity; + struct iwl4965_activity_blink activity; unsigned long led_packets; int led_state; #endif @@ -1158,8 +1156,8 @@ struct iwl_priv { u8 current_channel_width; u8 valid_antenna; /* Bit mask of antennas actually connected */ #ifdef CONFIG_IWL4965_SENSITIVITY - struct iwl_sensitivity_data sensitivity_data; - struct iwl_chain_noise_data chain_noise_data; + struct iwl4965_sensitivity_data sensitivity_data; + struct iwl4965_chain_noise_data chain_noise_data; u8 start_calib; __le16 sensitivity_tbl[HD_TABLE_SIZE]; #endif /*CONFIG_IWL4965_SENSITIVITY*/ @@ -1171,7 +1169,7 @@ struct iwl_priv { u8 last_phy_res[100]; /* Rate scaling data */ - struct iwl_lq_mngr lq_mngr; + struct iwl4965_lq_mngr lq_mngr; /* Rate scaling data */ s8 data_retry_limit; @@ -1182,10 +1180,10 @@ struct iwl_priv { int activity_timer_active; /* Rx and Tx DMA processing queues */ - struct iwl_rx_queue rxq; - struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; + struct iwl4965_rx_queue rxq; + struct iwl4965_tx_queue txq[IWL_MAX_NUM_QUEUES]; unsigned long txq_ctx_active_msk; - struct iwl_kw kw; /* keep warm address */ + struct iwl4965_kw kw; /* keep warm address */ u32 scd_base_addr; /* scheduler sram base address */ unsigned long status; @@ -1194,9 +1192,9 @@ struct iwl_priv { int last_rx_rssi; /* From Rx packet statisitics */ int last_rx_noise; /* From beacon statistics */ - struct iwl_power_mgr power_data; + struct iwl4965_power_mgr power_data; - struct iwl_notif_statistics statistics; + struct iwl4965_notif_statistics statistics; unsigned long last_statistics_time; /* context information */ @@ -1213,7 +1211,7 @@ struct iwl_priv { /*station table variables */ spinlock_t sta_lock; int num_stations; - struct iwl_station_entry stations[IWL_STATION_COUNT]; + struct iwl4965_station_entry stations[IWL_STATION_COUNT]; /* Indication if ieee80211_ops->open has been called */ int is_open; @@ -1234,7 +1232,7 @@ struct iwl_priv { struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE]; /* eeprom */ - struct iwl_eeprom eeprom; + struct iwl4965_eeprom eeprom; int iw_mode; @@ -1244,7 +1242,7 @@ struct iwl_priv { u32 timestamp0; u32 timestamp1; u16 beacon_int; - struct iwl_driver_hw_info hw_setting; + struct iwl4965_driver_hw_info hw_setting; int interface_id; /* Current association information needed to configure the @@ -1254,7 +1252,7 @@ struct iwl_priv { u8 ps_mode; #ifdef CONFIG_IWL4965_QOS - struct iwl_qos_info qos_data; + struct iwl4965_qos_info qos_data; #endif /*CONFIG_IWL4965_QOS */ struct workqueue_struct *workqueue; @@ -1306,55 +1304,55 @@ struct iwl_priv { #ifdef CONFIG_IWL4965_HT_AGG struct work_struct agg_work; #endif -}; /*iwl_priv */ +}; /*iwl4965_priv */ -static inline int iwl_is_associated(struct iwl_priv *priv) +static inline int iwl4965_is_associated(struct iwl4965_priv *priv) { return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; } -static inline int is_channel_valid(const struct iwl_channel_info *ch_info) +static inline int is_channel_valid(const struct iwl4965_channel_info *ch_info) { if (ch_info == NULL) return 0; return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; } -static inline int is_channel_narrow(const struct iwl_channel_info *ch_info) +static inline int is_channel_narrow(const struct iwl4965_channel_info *ch_info) { return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0; } -static inline int is_channel_radar(const struct iwl_channel_info *ch_info) +static inline int is_channel_radar(const struct iwl4965_channel_info *ch_info) { return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; } -static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info) +static inline u8 is_channel_a_band(const struct iwl4965_channel_info *ch_info) { return ch_info->phymode == MODE_IEEE80211A; } -static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info) +static inline u8 is_channel_bg_band(const struct iwl4965_channel_info *ch_info) { return ((ch_info->phymode == MODE_IEEE80211B) || (ch_info->phymode == MODE_IEEE80211G)); } -static inline int is_channel_passive(const struct iwl_channel_info *ch) +static inline int is_channel_passive(const struct iwl4965_channel_info *ch) { return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; } -static inline int is_channel_ibss(const struct iwl_channel_info *ch) +static inline int is_channel_ibss(const struct iwl4965_channel_info *ch) { return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; } -extern const struct iwl_channel_info *iwl_get_channel_info( - const struct iwl_priv *priv, int phymode, u16 channel); +extern const struct iwl4965_channel_info *iwl4965_get_channel_info( + const struct iwl4965_priv *priv, int phymode, u16 channel); -/* Requires full declaration of iwl_priv before including */ +/* Requires full declaration of iwl4965_priv before including */ #include "iwl-4965-io.h" -#endif /* __iwl_4965_h__ */ +#endif /* __iwl4965_4965_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index e0f6f03a920..e14e1333535 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -60,11 +60,11 @@ #include "iwl-helpers.h" #ifdef CONFIG_IWL3945_DEBUG -u32 iwl_debug_level; +u32 iwl3945_debug_level; #endif -static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_tx_queue *txq); +static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, + struct iwl3945_tx_queue *txq); /****************************************************************************** * @@ -73,13 +73,13 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, ******************************************************************************/ /* module parameters */ -static int iwl_param_disable_hw_scan; -static int iwl_param_debug; -static int iwl_param_disable; /* def: enable radio */ -static int iwl_param_antenna; /* def: 0 = both antennas (use diversity) */ -int iwl_param_hwcrypto; /* def: using software encryption */ -static int iwl_param_qos_enable = 1; -int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; +static int iwl3945_param_disable_hw_scan; +static int iwl3945_param_debug; +static int iwl3945_param_disable; /* def: enable radio */ +static int iwl3945_param_antenna; /* def: 0 = both antennas (use diversity) */ +int iwl3945_param_hwcrypto; /* def: using software encryption */ +static int iwl3945_param_qos_enable = 1; +int iwl3945_param_queues_num = IWL_MAX_NUM_QUEUES; /* * module name, copyright, version, etc. @@ -126,8 +126,8 @@ static __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr) return NULL; } -static const struct ieee80211_hw_mode *iwl_get_hw_mode( - struct iwl_priv *priv, int mode) +static const struct ieee80211_hw_mode *iwl3945_get_hw_mode( + struct iwl3945_priv *priv, int mode) { int i; @@ -138,7 +138,7 @@ static const struct ieee80211_hw_mode *iwl_get_hw_mode( return NULL; } -static int iwl_is_empty_essid(const char *essid, int essid_len) +static int iwl3945_is_empty_essid(const char *essid, int essid_len) { /* Single white space is for Linksys APs */ if (essid_len == 1 && essid[0] == ' ') @@ -154,13 +154,13 @@ static int iwl_is_empty_essid(const char *essid, int essid_len) return 1; } -static const char *iwl_escape_essid(const char *essid, u8 essid_len) +static const char *iwl3945_escape_essid(const char *essid, u8 essid_len) { static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; const char *s = essid; char *d = escaped; - if (iwl_is_empty_essid(essid, essid_len)) { + if (iwl3945_is_empty_essid(essid, essid_len)) { memcpy(escaped, "", sizeof("")); return escaped; } @@ -178,10 +178,10 @@ static const char *iwl_escape_essid(const char *essid, u8 essid_len) return escaped; } -static void iwl_print_hex_dump(int level, void *p, u32 len) +static void iwl3945_print_hex_dump(int level, void *p, u32 len) { #ifdef CONFIG_IWL3945_DEBUG - if (!(iwl_debug_level & level)) + if (!(iwl3945_debug_level & level)) return; print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1, @@ -207,7 +207,7 @@ static void iwl_print_hex_dump(int level, void *p, u32 len) * and four transmit queues for data. ***************************************************/ -static int iwl_queue_space(const struct iwl_queue *q) +static int iwl3945_queue_space(const struct iwl3945_queue *q) { int s = q->read_ptr - q->write_ptr; @@ -224,25 +224,25 @@ static int iwl_queue_space(const struct iwl_queue *q) } /* XXX: n_bd must be power-of-two size */ -static inline int iwl_queue_inc_wrap(int index, int n_bd) +static inline int iwl3945_queue_inc_wrap(int index, int n_bd) { return ++index & (n_bd - 1); } /* XXX: n_bd must be power-of-two size */ -static inline int iwl_queue_dec_wrap(int index, int n_bd) +static inline int iwl3945_queue_dec_wrap(int index, int n_bd) { return --index & (n_bd - 1); } -static inline int x2_queue_used(const struct iwl_queue *q, int i) +static inline int x2_queue_used(const struct iwl3945_queue *q, int i) { return q->write_ptr > q->read_ptr ? (i >= q->read_ptr && i < q->write_ptr) : !(i < q->read_ptr && i >= q->write_ptr); } -static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) +static inline u8 get_cmd_index(struct iwl3945_queue *q, u32 index, int is_huge) { if (is_huge) return q->n_window; @@ -250,15 +250,15 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) return index & (q->n_window - 1); } -static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, +static int iwl3945_queue_init(struct iwl3945_priv *priv, struct iwl3945_queue *q, int count, int slots_num, u32 id) { q->n_bd = count; q->n_window = slots_num; q->id = id; - /* count must be power-of-two size, otherwise iwl_queue_inc_wrap - * and iwl_queue_dec_wrap are broken. */ + /* count must be power-of-two size, otherwise iwl3945_queue_inc_wrap + * and iwl3945_queue_dec_wrap are broken. */ BUG_ON(!is_power_of_2(count)); /* slots_num must be power-of-two size, otherwise @@ -278,8 +278,8 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, return 0; } -static int iwl_tx_queue_alloc(struct iwl_priv *priv, - struct iwl_tx_queue *txq, u32 id) +static int iwl3945_tx_queue_alloc(struct iwl3945_priv *priv, + struct iwl3945_tx_queue *txq, u32 id) { struct pci_dev *dev = priv->pci_dev; @@ -316,8 +316,8 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, return -ENOMEM; } -int iwl_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq, int slots_num, u32 txq_id) +int iwl3945_tx_queue_init(struct iwl3945_priv *priv, + struct iwl3945_tx_queue *txq, int slots_num, u32 txq_id) { struct pci_dev *dev = priv->pci_dev; int len; @@ -326,14 +326,14 @@ int iwl_tx_queue_init(struct iwl_priv *priv, /* allocate command space + one big command for scan since scan * command is very huge the system will not have two scan at the * same time */ - len = sizeof(struct iwl_cmd) * slots_num; + len = sizeof(struct iwl3945_cmd) * slots_num; if (txq_id == IWL_CMD_QUEUE_NUM) len += IWL_MAX_SCAN_SIZE; txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); if (!txq->cmd) return -ENOMEM; - rc = iwl_tx_queue_alloc(priv, txq, txq_id); + rc = iwl3945_tx_queue_alloc(priv, txq, txq_id); if (rc) { pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); @@ -342,26 +342,26 @@ int iwl_tx_queue_init(struct iwl_priv *priv, txq->need_update = 0; /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise - * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ + * iwl3945_queue_inc_wrap and iwl3945_queue_dec_wrap are broken. */ BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); - iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); + iwl3945_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); - iwl_hw_tx_queue_init(priv, txq); + iwl3945_hw_tx_queue_init(priv, txq); return 0; } /** - * iwl_tx_queue_free - Deallocate DMA queue. + * iwl3945_tx_queue_free - Deallocate DMA queue. * @txq: Transmit queue to deallocate. * * Empty queue by removing and destroying all BD's. * Free all buffers. txq itself is not freed. * */ -void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) +void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq) { - struct iwl_queue *q = &txq->q; + struct iwl3945_queue *q = &txq->q; struct pci_dev *dev = priv->pci_dev; int len; @@ -370,10 +370,10 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) /* first, empty all BD's */ for (; q->write_ptr != q->read_ptr; - q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) - iwl_hw_txq_free_tfd(priv, txq); + q->read_ptr = iwl3945_queue_inc_wrap(q->read_ptr, q->n_bd)) + iwl3945_hw_txq_free_tfd(priv, txq); - len = sizeof(struct iwl_cmd) * q->n_window; + len = sizeof(struct iwl3945_cmd) * q->n_window; if (q->id == IWL_CMD_QUEUE_NUM) len += IWL_MAX_SCAN_SIZE; @@ -381,7 +381,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) /* free buffers belonging to queue itself */ if (txq->q.n_bd) - pci_free_consistent(dev, sizeof(struct iwl_tfd_frame) * + pci_free_consistent(dev, sizeof(struct iwl3945_tfd_frame) * txq->q.n_bd, txq->bd, txq->q.dma_addr); if (txq->txb) { @@ -393,12 +393,12 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) memset(txq, 0, sizeof(*txq)); } -const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; +const u8 iwl3945_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /*************** STATION TABLE MANAGEMENT **** * * NOTE: This needs to be overhauled to better synchronize between - * how the iwl-4965.c is using iwl_hw_find_station vs. iwl-3945.c + * how the iwl-4965.c is using iwl3945_hw_find_station vs. iwl-3945.c * * mac80211 should also be examined to determine if sta_info is duplicating * the functionality provided here @@ -406,7 +406,7 @@ const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /**************************************************************/ #if 0 /* temporary disable till we add real remove station */ -static u8 iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) +static u8 iwl3945_remove_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap) { int index = IWL_INVALID_STATION; int i; @@ -442,7 +442,7 @@ out: return 0; } #endif -static void iwl_clear_stations_table(struct iwl_priv *priv) +static void iwl3945_clear_stations_table(struct iwl3945_priv *priv) { unsigned long flags; @@ -455,11 +455,11 @@ static void iwl_clear_stations_table(struct iwl_priv *priv) } -u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) +u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 flags) { int i; int index = IWL_INVALID_STATION; - struct iwl_station_entry *station; + struct iwl3945_station_entry *station; unsigned long flags_spin; DECLARE_MAC_BUF(mac); u8 rate; @@ -500,7 +500,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) station->used = 1; priv->num_stations++; - memset(&station->sta, 0, sizeof(struct iwl_addsta_cmd)); + memset(&station->sta, 0, sizeof(struct iwl3945_addsta_cmd)); memcpy(station->sta.sta.addr, addr, ETH_ALEN); station->sta.mode = 0; station->sta.sta.sta_id = index; @@ -513,19 +513,19 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) /* Turn on both antennas for the station... */ station->sta.rate_n_flags = - iwl_hw_set_rate_n_flags(rate, RATE_MCS_ANT_AB_MSK); + iwl3945_hw_set_rate_n_flags(rate, RATE_MCS_ANT_AB_MSK); station->current_rate.rate_n_flags = le16_to_cpu(station->sta.rate_n_flags); spin_unlock_irqrestore(&priv->sta_lock, flags_spin); - iwl_send_add_station(priv, &station->sta, flags); + iwl3945_send_add_station(priv, &station->sta, flags); return index; } /*************** DRIVER STATUS FUNCTIONS *****/ -static inline int iwl_is_ready(struct iwl_priv *priv) +static inline int iwl3945_is_ready(struct iwl3945_priv *priv) { /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are * set but EXIT_PENDING is not */ @@ -534,29 +534,29 @@ static inline int iwl_is_ready(struct iwl_priv *priv) !test_bit(STATUS_EXIT_PENDING, &priv->status); } -static inline int iwl_is_alive(struct iwl_priv *priv) +static inline int iwl3945_is_alive(struct iwl3945_priv *priv) { return test_bit(STATUS_ALIVE, &priv->status); } -static inline int iwl_is_init(struct iwl_priv *priv) +static inline int iwl3945_is_init(struct iwl3945_priv *priv) { return test_bit(STATUS_INIT, &priv->status); } -static inline int iwl_is_rfkill(struct iwl_priv *priv) +static inline int iwl3945_is_rfkill(struct iwl3945_priv *priv) { return test_bit(STATUS_RF_KILL_HW, &priv->status) || test_bit(STATUS_RF_KILL_SW, &priv->status); } -static inline int iwl_is_ready_rf(struct iwl_priv *priv) +static inline int iwl3945_is_ready_rf(struct iwl3945_priv *priv) { - if (iwl_is_rfkill(priv)) + if (iwl3945_is_rfkill(priv)) return 0; - return iwl_is_ready(priv); + return iwl3945_is_ready(priv); } /*************** HOST COMMAND QUEUE FUNCTIONS *****/ @@ -615,7 +615,7 @@ static const char *get_cmd_string(u8 cmd) #define HOST_COMPLETE_TIMEOUT (HZ / 2) /** - * iwl_enqueue_hcmd - enqueue a uCode command + * iwl3945_enqueue_hcmd - enqueue a uCode command * @priv: device private data point * @cmd: a point to the ucode command structure * @@ -623,13 +623,13 @@ static const char *get_cmd_string(u8 cmd) * failed. On success, it turns the index (> 0) of command in the * command queue. */ -static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd) { - struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; - struct iwl_queue *q = &txq->q; - struct iwl_tfd_frame *tfd; + struct iwl3945_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; + struct iwl3945_queue *q = &txq->q; + struct iwl3945_tfd_frame *tfd; u32 *control_flags; - struct iwl_cmd *out_cmd; + struct iwl3945_cmd *out_cmd; u32 idx; u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); dma_addr_t phys_addr; @@ -644,7 +644,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && !(cmd->meta.flags & CMD_SIZE_HUGE)); - if (iwl_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { + if (iwl3945_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { IWL_ERROR("No space for Tx\n"); return -ENOSPC; } @@ -673,8 +673,8 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + - offsetof(struct iwl_cmd, hdr); - iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); + offsetof(struct iwl3945_cmd, hdr); + iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); pad = U32_PAD(cmd->len); count = TFD_CTL_COUNT_GET(*control_flags); @@ -687,14 +687,14 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM); txq->need_update = 1; - q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); - ret = iwl_tx_queue_update_write_ptr(priv, txq); + q->write_ptr = iwl3945_queue_inc_wrap(q->write_ptr, q->n_bd); + ret = iwl3945_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->hcmd_lock, flags); return ret ? ret : idx; } -static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +static int iwl3945_send_cmd_async(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd) { int ret; @@ -709,16 +709,16 @@ static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return -EBUSY; - ret = iwl_enqueue_hcmd(priv, cmd); + ret = iwl3945_enqueue_hcmd(priv, cmd); if (ret < 0) { - IWL_ERROR("Error sending %s: iwl_enqueue_hcmd failed: %d\n", + IWL_ERROR("Error sending %s: iwl3945_enqueue_hcmd failed: %d\n", get_cmd_string(cmd->id), ret); return ret; } return 0; } -static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +static int iwl3945_send_cmd_sync(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd) { int cmd_idx; int ret; @@ -740,10 +740,10 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) if (cmd->meta.flags & CMD_WANT_SKB) cmd->meta.source = &cmd->meta; - cmd_idx = iwl_enqueue_hcmd(priv, cmd); + cmd_idx = iwl3945_enqueue_hcmd(priv, cmd); if (cmd_idx < 0) { ret = cmd_idx; - IWL_ERROR("Error sending %s: iwl_enqueue_hcmd failed: %d\n", + IWL_ERROR("Error sending %s: iwl3945_enqueue_hcmd failed: %d\n", get_cmd_string(cmd->id), ret); goto out; } @@ -787,7 +787,7 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) cancel: if (cmd->meta.flags & CMD_WANT_SKB) { - struct iwl_cmd *qcmd; + struct iwl3945_cmd *qcmd; /* Cancel the CMD_WANT_SKB flag for the cmd in the * TX cmd queue. Otherwise in case the cmd comes @@ -806,43 +806,43 @@ out: return ret; } -int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +int iwl3945_send_cmd(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd) { if (cmd->meta.flags & CMD_ASYNC) - return iwl_send_cmd_async(priv, cmd); + return iwl3945_send_cmd_async(priv, cmd); - return iwl_send_cmd_sync(priv, cmd); + return iwl3945_send_cmd_sync(priv, cmd); } -int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data) +int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len, const void *data) { - struct iwl_host_cmd cmd = { + struct iwl3945_host_cmd cmd = { .id = id, .len = len, .data = data, }; - return iwl_send_cmd_sync(priv, &cmd); + return iwl3945_send_cmd_sync(priv, &cmd); } -static int __must_check iwl_send_cmd_u32(struct iwl_priv *priv, u8 id, u32 val) +static int __must_check iwl3945_send_cmd_u32(struct iwl3945_priv *priv, u8 id, u32 val) { - struct iwl_host_cmd cmd = { + struct iwl3945_host_cmd cmd = { .id = id, .len = sizeof(val), .data = &val, }; - return iwl_send_cmd_sync(priv, &cmd); + return iwl3945_send_cmd_sync(priv, &cmd); } -int iwl_send_statistics_request(struct iwl_priv *priv) +int iwl3945_send_statistics_request(struct iwl3945_priv *priv) { - return iwl_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0); + return iwl3945_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0); } /** - * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON + * iwl3945_set_rxon_channel - Set the phymode and channel values in staging RXON * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz * @channel: Any channel valid for the requested phymode @@ -851,9 +851,9 @@ int iwl_send_statistics_request(struct iwl_priv *priv) * NOTE: Does not commit to the hardware; it sets appropriate bit fields * in the staging RXON flag structure based on the phymode */ -static int iwl_set_rxon_channel(struct iwl_priv *priv, u8 phymode, u16 channel) +static int iwl3945_set_rxon_channel(struct iwl3945_priv *priv, u8 phymode, u16 channel) { - if (!iwl_get_channel_info(priv, phymode, channel)) { + if (!iwl3945_get_channel_info(priv, phymode, channel)) { IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", channel, phymode); return -EINVAL; @@ -877,13 +877,13 @@ static int iwl_set_rxon_channel(struct iwl_priv *priv, u8 phymode, u16 channel) } /** - * iwl_check_rxon_cmd - validate RXON structure is valid + * iwl3945_check_rxon_cmd - validate RXON structure is valid * * NOTE: This is really only useful during development and can eventually * be #ifdef'd out once the driver is stable and folks aren't actively * making changes */ -static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) +static int iwl3945_check_rxon_cmd(struct iwl3945_rxon_cmd *rxon) { int error = 0; int counter = 1; @@ -949,21 +949,21 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) le16_to_cpu(rxon->channel)); if (error) { - IWL_ERROR("Not a valid iwl_rxon_assoc_cmd field values\n"); + IWL_ERROR("Not a valid iwl3945_rxon_assoc_cmd field values\n"); return -1; } return 0; } /** - * iwl_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit + * iwl3945_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit * @priv: staging_rxon is compared to active_rxon * * If the RXON structure is changing sufficient to require a new * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1 * to indicate a new tune is required. */ -static int iwl_full_rxon_required(struct iwl_priv *priv) +static int iwl3945_full_rxon_required(struct iwl3945_priv *priv) { /* These items are only settable from the full RXON command */ @@ -998,19 +998,19 @@ static int iwl_full_rxon_required(struct iwl_priv *priv) return 0; } -static int iwl_send_rxon_assoc(struct iwl_priv *priv) +static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv) { int rc = 0; - struct iwl_rx_packet *res = NULL; - struct iwl_rxon_assoc_cmd rxon_assoc; - struct iwl_host_cmd cmd = { + struct iwl3945_rx_packet *res = NULL; + struct iwl3945_rxon_assoc_cmd rxon_assoc; + struct iwl3945_host_cmd cmd = { .id = REPLY_RXON_ASSOC, .len = sizeof(rxon_assoc), .meta.flags = CMD_WANT_SKB, .data = &rxon_assoc, }; - const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; - const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; + const struct iwl3945_rxon_cmd *rxon1 = &priv->staging_rxon; + const struct iwl3945_rxon_cmd *rxon2 = &priv->active_rxon; if ((rxon1->flags == rxon2->flags) && (rxon1->filter_flags == rxon2->filter_flags) && @@ -1026,11 +1026,11 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv) rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; rxon_assoc.reserved = 0; - rc = iwl_send_cmd_sync(priv, &cmd); + rc = iwl3945_send_cmd_sync(priv, &cmd); if (rc) return rc; - res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; + res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data; if (res->hdr.flags & IWL_CMD_FAILED_MSK) { IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n"); rc = -EIO; @@ -1043,21 +1043,21 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv) } /** - * iwl_commit_rxon - commit staging_rxon to hardware + * iwl3945_commit_rxon - commit staging_rxon to hardware * * The RXON command in staging_rxon is committed to the hardware and * the active_rxon structure is updated with the new data. This * function correctly transitions out of the RXON_ASSOC_MSK state if * a HW tune is required based on the RXON structure changes. */ -static int iwl_commit_rxon(struct iwl_priv *priv) +static int iwl3945_commit_rxon(struct iwl3945_priv *priv) { /* cast away the const for active_rxon in this function */ - struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; + struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon; int rc = 0; DECLARE_MAC_BUF(mac); - if (!iwl_is_alive(priv)) + if (!iwl3945_is_alive(priv)) return -1; /* always get timestamp with Rx frame */ @@ -1068,17 +1068,17 @@ static int iwl_commit_rxon(struct iwl_priv *priv) ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); priv->staging_rxon.flags |= iwl3945_get_antenna_flags(priv); - rc = iwl_check_rxon_cmd(&priv->staging_rxon); + rc = iwl3945_check_rxon_cmd(&priv->staging_rxon); if (rc) { IWL_ERROR("Invalid RXON configuration. Not committing.\n"); return -EINVAL; } /* If we don't need to send a full RXON, we can use - * iwl_rxon_assoc_cmd which is used to reconfigure filter + * iwl3945_rxon_assoc_cmd which is used to reconfigure filter * and other flags for the current radio configuration. */ - if (!iwl_full_rxon_required(priv)) { - rc = iwl_send_rxon_assoc(priv); + if (!iwl3945_full_rxon_required(priv)) { + rc = iwl3945_send_rxon_assoc(priv); if (rc) { IWL_ERROR("Error setting RXON_ASSOC " "configuration (%d).\n", rc); @@ -1094,13 +1094,13 @@ static int iwl_commit_rxon(struct iwl_priv *priv) * an RXON_ASSOC and the new config wants the associated mask enabled, * we must clear the associated from the active configuration * before we apply the new config */ - if (iwl_is_associated(priv) && + if (iwl3945_is_associated(priv) && (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) { IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - rc = iwl_send_cmd_pdu(priv, REPLY_RXON, - sizeof(struct iwl_rxon_cmd), + rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON, + sizeof(struct iwl3945_rxon_cmd), &priv->active_rxon); /* If the mask clearing failed then we set @@ -1123,8 +1123,8 @@ static int iwl_commit_rxon(struct iwl_priv *priv) print_mac(mac, priv->staging_rxon.bssid_addr)); /* Apply the new configuration */ - rc = iwl_send_cmd_pdu(priv, REPLY_RXON, - sizeof(struct iwl_rxon_cmd), &priv->staging_rxon); + rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON, + sizeof(struct iwl3945_rxon_cmd), &priv->staging_rxon); if (rc) { IWL_ERROR("Error setting new configuration (%d).\n", rc); return rc; @@ -1132,18 +1132,18 @@ static int iwl_commit_rxon(struct iwl_priv *priv) memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); - iwl_clear_stations_table(priv); + iwl3945_clear_stations_table(priv); /* If we issue a new RXON command which required a tune then we must * send a new TXPOWER command or we won't be able to Tx any frames */ - rc = iwl_hw_reg_send_txpower(priv); + rc = iwl3945_hw_reg_send_txpower(priv); if (rc) { IWL_ERROR("Error setting Tx power (%d).\n", rc); return rc; } /* Add the broadcast address so we can send broadcast frames */ - if (iwl_add_station(priv, BROADCAST_ADDR, 0, 0) == + if (iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0) == IWL_INVALID_STATION) { IWL_ERROR("Error adding BROADCAST address for transmit.\n"); return -EIO; @@ -1151,9 +1151,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv) /* If we have set the ASSOC_MSK and we are in BSS mode then * add the IWL_AP_ID to the station rate table */ - if (iwl_is_associated(priv) && + if (iwl3945_is_associated(priv) && (priv->iw_mode == IEEE80211_IF_TYPE_STA)) - if (iwl_add_station(priv, priv->active_rxon.bssid_addr, 1, 0) + if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr, 1, 0) == IWL_INVALID_STATION) { IWL_ERROR("Error adding AP address for transmit.\n"); return -EIO; @@ -1170,9 +1170,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv) return 0; } -static int iwl_send_bt_config(struct iwl_priv *priv) +static int iwl3945_send_bt_config(struct iwl3945_priv *priv) { - struct iwl_bt_cmd bt_cmd = { + struct iwl3945_bt_cmd bt_cmd = { .flags = 3, .lead_time = 0xAA, .max_kill = 1, @@ -1180,15 +1180,15 @@ static int iwl_send_bt_config(struct iwl_priv *priv) .kill_cts_mask = 0, }; - return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, - sizeof(struct iwl_bt_cmd), &bt_cmd); + return iwl3945_send_cmd_pdu(priv, REPLY_BT_CONFIG, + sizeof(struct iwl3945_bt_cmd), &bt_cmd); } -static int iwl_send_scan_abort(struct iwl_priv *priv) +static int iwl3945_send_scan_abort(struct iwl3945_priv *priv) { int rc = 0; - struct iwl_rx_packet *res; - struct iwl_host_cmd cmd = { + struct iwl3945_rx_packet *res; + struct iwl3945_host_cmd cmd = { .id = REPLY_SCAN_ABORT_CMD, .meta.flags = CMD_WANT_SKB, }; @@ -1201,13 +1201,13 @@ static int iwl_send_scan_abort(struct iwl_priv *priv) return 0; } - rc = iwl_send_cmd_sync(priv, &cmd); + rc = iwl3945_send_cmd_sync(priv, &cmd); if (rc) { clear_bit(STATUS_SCAN_ABORTING, &priv->status); return rc; } - res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; + res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data; if (res->u.status != CAN_ABORT_STATUS) { /* The scan abort will return 1 for success or * 2 for "failure". A failure condition can be @@ -1225,8 +1225,8 @@ static int iwl_send_scan_abort(struct iwl_priv *priv) return rc; } -static int iwl_card_state_sync_callback(struct iwl_priv *priv, - struct iwl_cmd *cmd, +static int iwl3945_card_state_sync_callback(struct iwl3945_priv *priv, + struct iwl3945_cmd *cmd, struct sk_buff *skb) { return 1; @@ -1242,9 +1242,9 @@ static int iwl_card_state_sync_callback(struct iwl_priv *priv, * When in the 'halt' state, the card is shut down and must be fully * restarted to come back on. */ -static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) +static int iwl3945_send_card_state(struct iwl3945_priv *priv, u32 flags, u8 meta_flag) { - struct iwl_host_cmd cmd = { + struct iwl3945_host_cmd cmd = { .id = REPLY_CARD_STATE_CMD, .len = sizeof(u32), .data = &flags, @@ -1252,22 +1252,22 @@ static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) }; if (meta_flag & CMD_ASYNC) - cmd.meta.u.callback = iwl_card_state_sync_callback; + cmd.meta.u.callback = iwl3945_card_state_sync_callback; - return iwl_send_cmd(priv, &cmd); + return iwl3945_send_cmd(priv, &cmd); } -static int iwl_add_sta_sync_callback(struct iwl_priv *priv, - struct iwl_cmd *cmd, struct sk_buff *skb) +static int iwl3945_add_sta_sync_callback(struct iwl3945_priv *priv, + struct iwl3945_cmd *cmd, struct sk_buff *skb) { - struct iwl_rx_packet *res = NULL; + struct iwl3945_rx_packet *res = NULL; if (!skb) { IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n"); return 1; } - res = (struct iwl_rx_packet *)skb->data; + res = (struct iwl3945_rx_packet *)skb->data; if (res->hdr.flags & IWL_CMD_FAILED_MSK) { IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", res->hdr.flags); @@ -1285,29 +1285,29 @@ static int iwl_add_sta_sync_callback(struct iwl_priv *priv, return 1; } -int iwl_send_add_station(struct iwl_priv *priv, - struct iwl_addsta_cmd *sta, u8 flags) +int iwl3945_send_add_station(struct iwl3945_priv *priv, + struct iwl3945_addsta_cmd *sta, u8 flags) { - struct iwl_rx_packet *res = NULL; + struct iwl3945_rx_packet *res = NULL; int rc = 0; - struct iwl_host_cmd cmd = { + struct iwl3945_host_cmd cmd = { .id = REPLY_ADD_STA, - .len = sizeof(struct iwl_addsta_cmd), + .len = sizeof(struct iwl3945_addsta_cmd), .meta.flags = flags, .data = sta, }; if (flags & CMD_ASYNC) - cmd.meta.u.callback = iwl_add_sta_sync_callback; + cmd.meta.u.callback = iwl3945_add_sta_sync_callback; else cmd.meta.flags |= CMD_WANT_SKB; - rc = iwl_send_cmd(priv, &cmd); + rc = iwl3945_send_cmd(priv, &cmd); if (rc || (flags & CMD_ASYNC)) return rc; - res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; + res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data; if (res->hdr.flags & IWL_CMD_FAILED_MSK) { IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", res->hdr.flags); @@ -1332,7 +1332,7 @@ int iwl_send_add_station(struct iwl_priv *priv, return rc; } -static int iwl_update_sta_key_info(struct iwl_priv *priv, +static int iwl3945_update_sta_key_info(struct iwl3945_priv *priv, struct ieee80211_key_conf *keyconf, u8 sta_id) { @@ -1366,28 +1366,28 @@ static int iwl_update_sta_key_info(struct iwl_priv *priv, spin_unlock_irqrestore(&priv->sta_lock, flags); IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n"); - iwl_send_add_station(priv, &priv->stations[sta_id].sta, 0); + iwl3945_send_add_station(priv, &priv->stations[sta_id].sta, 0); return 0; } -static int iwl_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) +static int iwl3945_clear_sta_key_info(struct iwl3945_priv *priv, u8 sta_id) { unsigned long flags; spin_lock_irqsave(&priv->sta_lock, flags); - memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); - memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl_keyinfo)); + memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl3945_hw_key)); + memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl3945_keyinfo)); priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; spin_unlock_irqrestore(&priv->sta_lock, flags); IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n"); - iwl_send_add_station(priv, &priv->stations[sta_id].sta, 0); + iwl3945_send_add_station(priv, &priv->stations[sta_id].sta, 0); return 0; } -static void iwl_clear_free_frames(struct iwl_priv *priv) +static void iwl3945_clear_free_frames(struct iwl3945_priv *priv) { struct list_head *element; @@ -1397,7 +1397,7 @@ static void iwl_clear_free_frames(struct iwl_priv *priv) while (!list_empty(&priv->free_frames)) { element = priv->free_frames.next; list_del(element); - kfree(list_entry(element, struct iwl_frame, list)); + kfree(list_entry(element, struct iwl3945_frame, list)); priv->frames_count--; } @@ -1408,9 +1408,9 @@ static void iwl_clear_free_frames(struct iwl_priv *priv) } } -static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv) +static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl3945_priv *priv) { - struct iwl_frame *frame; + struct iwl3945_frame *frame; struct list_head *element; if (list_empty(&priv->free_frames)) { frame = kzalloc(sizeof(*frame), GFP_KERNEL); @@ -1425,21 +1425,21 @@ static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv) element = priv->free_frames.next; list_del(element); - return list_entry(element, struct iwl_frame, list); + return list_entry(element, struct iwl3945_frame, list); } -static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) +static void iwl3945_free_frame(struct iwl3945_priv *priv, struct iwl3945_frame *frame) { memset(frame, 0, sizeof(*frame)); list_add(&frame->list, &priv->free_frames); } -unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, +unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, struct ieee80211_hdr *hdr, const u8 *dest, int left) { - if (!iwl_is_associated(priv) || !priv->ibss_beacon || + if (!iwl3945_is_associated(priv) || !priv->ibss_beacon || ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && (priv->iw_mode != IEEE80211_IF_TYPE_AP))) return 0; @@ -1452,37 +1452,37 @@ unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, return priv->ibss_beacon->len; } -static int iwl_rate_index_from_plcp(int plcp) +static int iwl3945_rate_index_from_plcp(int plcp) { int i = 0; for (i = 0; i < IWL_RATE_COUNT; i++) - if (iwl_rates[i].plcp == plcp) + if (iwl3945_rates[i].plcp == plcp) return i; return -1; } -static u8 iwl_rate_get_lowest_plcp(int rate_mask) +static u8 iwl3945_rate_get_lowest_plcp(int rate_mask) { u8 i; for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID; - i = iwl_rates[i].next_ieee) { + i = iwl3945_rates[i].next_ieee) { if (rate_mask & (1 << i)) - return iwl_rates[i].plcp; + return iwl3945_rates[i].plcp; } return IWL_RATE_INVALID; } -static int iwl_send_beacon_cmd(struct iwl_priv *priv) +static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv) { - struct iwl_frame *frame; + struct iwl3945_frame *frame; unsigned int frame_size; int rc; u8 rate; - frame = iwl_get_free_frame(priv); + frame = iwl3945_get_free_frame(priv); if (!frame) { IWL_ERROR("Could not obtain free frame buffer for beacon " @@ -1491,22 +1491,22 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv) } if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) { - rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & + rate = iwl3945_rate_get_lowest_plcp(priv->active_rate_basic & 0xFF0); if (rate == IWL_INVALID_RATE) rate = IWL_RATE_6M_PLCP; } else { - rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & 0xF); + rate = iwl3945_rate_get_lowest_plcp(priv->active_rate_basic & 0xF); if (rate == IWL_INVALID_RATE) rate = IWL_RATE_1M_PLCP; } - frame_size = iwl_hw_get_beacon_cmd(priv, frame, rate); + frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); - rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, + rc = iwl3945_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, &frame->u.cmd[0]); - iwl_free_frame(priv, frame); + iwl3945_free_frame(priv, frame); return rc; } @@ -1517,22 +1517,22 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv) * ******************************************************************************/ -static void get_eeprom_mac(struct iwl_priv *priv, u8 *mac) +static void get_eeprom_mac(struct iwl3945_priv *priv, u8 *mac) { memcpy(mac, priv->eeprom.mac_address, 6); } /** - * iwl_eeprom_init - read EEPROM contents + * iwl3945_eeprom_init - read EEPROM contents * * Load the EEPROM from adapter into priv->eeprom * * NOTE: This routine uses the non-debug IO access functions. */ -int iwl_eeprom_init(struct iwl_priv *priv) +int iwl3945_eeprom_init(struct iwl3945_priv *priv) { u16 *e = (u16 *)&priv->eeprom; - u32 gp = iwl_read32(priv, CSR_EEPROM_GP); + u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP); u32 r; int sz = sizeof(priv->eeprom); int rc; @@ -1550,7 +1550,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) return -ENOENT; } - rc = iwl_eeprom_acquire_semaphore(priv); + rc = iwl3945_eeprom_acquire_semaphore(priv); if (rc < 0) { IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); return -ENOENT; @@ -1558,12 +1558,12 @@ int iwl_eeprom_init(struct iwl_priv *priv) /* eeprom is an array of 16bit values */ for (addr = 0; addr < sz; addr += sizeof(u16)) { - _iwl_write32(priv, CSR_EEPROM_REG, addr << 1); - _iwl_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); + _iwl3945_write32(priv, CSR_EEPROM_REG, addr << 1); + _iwl3945_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT; i += IWL_EEPROM_ACCESS_DELAY) { - r = _iwl_read_direct32(priv, CSR_EEPROM_REG); + r = _iwl3945_read_direct32(priv, CSR_EEPROM_REG); if (r & CSR_EEPROM_REG_READ_VALID_MSK) break; udelay(IWL_EEPROM_ACCESS_DELAY); @@ -1587,19 +1587,19 @@ int iwl_eeprom_init(struct iwl_priv *priv) #ifdef CONFIG_IWL3945_DEBUG /** - * iwl_report_frame - dump frame to syslog during debug sessions + * iwl3945_report_frame - dump frame to syslog during debug sessions * * hack this function to show different aspects of received frames, * including selective frame dumps. * group100 parameter selects whether to show 1 out of 100 good frames. * * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type - * info output is okay, but some of this stuff (e.g. iwl_rx_frame_stats) + * info output is okay, but some of this stuff (e.g. iwl3945_rx_frame_stats) * is 3945-specific and gives bad output for 4965. Need to split the * functionality, keep common stuff here. */ -void iwl_report_frame(struct iwl_priv *priv, - struct iwl_rx_packet *pkt, +void iwl3945_report_frame(struct iwl3945_priv *priv, + struct iwl3945_rx_packet *pkt, struct ieee80211_hdr *header, int group100) { u32 to_us; @@ -1621,9 +1621,9 @@ void iwl_report_frame(struct iwl_priv *priv, u8 agc; u16 sig_avg; u16 noise_diff; - struct iwl_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); - struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); - struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt); + struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); + struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); + struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); u8 *data = IWL_RX_DATA(pkt); /* MAC header */ @@ -1699,11 +1699,11 @@ void iwl_report_frame(struct iwl_priv *priv, else title = "Frame"; - rate = iwl_rate_index_from_plcp(rate_sym); + rate = iwl3945_rate_index_from_plcp(rate_sym); if (rate == -1) rate = 0; else - rate = iwl_rates[rate].ieee / 2; + rate = iwl3945_rates[rate].ieee / 2; /* print frame summary. * MAC addresses show just the last byte (for brevity), @@ -1725,25 +1725,25 @@ void iwl_report_frame(struct iwl_priv *priv, } } if (print_dump) - iwl_print_hex_dump(IWL_DL_RX, data, length); + iwl3945_print_hex_dump(IWL_DL_RX, data, length); } #endif -static void iwl_unset_hw_setting(struct iwl_priv *priv) +static void iwl3945_unset_hw_setting(struct iwl3945_priv *priv) { if (priv->hw_setting.shared_virt) pci_free_consistent(priv->pci_dev, - sizeof(struct iwl_shared), + sizeof(struct iwl3945_shared), priv->hw_setting.shared_virt, priv->hw_setting.shared_phys); } /** - * iwl_supported_rate_to_ie - fill in the supported rate in IE field + * iwl3945_supported_rate_to_ie - fill in the supported rate in IE field * * return : set the bit for each supported rate insert in ie */ -static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, +static u16 iwl3945_supported_rate_to_ie(u8 *ie, u16 supported_rate, u16 basic_rate, int *left) { u16 ret_rates = 0, bit; @@ -1754,7 +1754,7 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { if (bit & supported_rate) { ret_rates |= bit; - rates[*cnt] = iwl_rates[i].ieee | + rates[*cnt] = iwl3945_rates[i].ieee | ((bit & basic_rate) ? 0x80 : 0x00); (*cnt)++; (*left)--; @@ -1768,9 +1768,9 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, } /** - * iwl_fill_probe_req - fill in all required fields and IE for probe request + * iwl3945_fill_probe_req - fill in all required fields and IE for probe request */ -static u16 iwl_fill_probe_req(struct iwl_priv *priv, +static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv, struct ieee80211_mgmt *frame, int left, int is_direct) { @@ -1786,9 +1786,9 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, len += 24; frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); - memcpy(frame->da, BROADCAST_ADDR, ETH_ALEN); + memcpy(frame->da, iwl3945_broadcast_addr, ETH_ALEN); memcpy(frame->sa, priv->mac_addr, ETH_ALEN); - memcpy(frame->bssid, BROADCAST_ADDR, ETH_ALEN); + memcpy(frame->bssid, iwl3945_broadcast_addr, ETH_ALEN); frame->seq_ctrl = 0; /* fill in our indirect SSID IE */ @@ -1831,11 +1831,11 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; cck_rates = IWL_CCK_RATES_MASK & active_rates; - ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, + ret_rates = iwl3945_supported_rate_to_ie(pos, cck_rates, priv->active_rate_basic, &left); active_rates &= ~ret_rates; - ret_rates = iwl_supported_rate_to_ie(pos, active_rates, + ret_rates = iwl3945_supported_rate_to_ie(pos, active_rates, priv->active_rate_basic, &left); active_rates &= ~ret_rates; @@ -1852,7 +1852,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, /* ... fill it in... */ *pos++ = WLAN_EID_EXT_SUPP_RATES; *pos = 0; - iwl_supported_rate_to_ie(pos, active_rates, + iwl3945_supported_rate_to_ie(pos, active_rates, priv->active_rate_basic, &left); if (*pos > 0) len += 2 + *pos; @@ -1865,15 +1865,15 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, * QoS support */ #ifdef CONFIG_IWL3945_QOS -static int iwl_send_qos_params_command(struct iwl_priv *priv, - struct iwl_qosparam_cmd *qos) +static int iwl3945_send_qos_params_command(struct iwl3945_priv *priv, + struct iwl3945_qosparam_cmd *qos) { - return iwl_send_cmd_pdu(priv, REPLY_QOS_PARAM, - sizeof(struct iwl_qosparam_cmd), qos); + return iwl3945_send_cmd_pdu(priv, REPLY_QOS_PARAM, + sizeof(struct iwl3945_qosparam_cmd), qos); } -static void iwl_reset_qos(struct iwl_priv *priv) +static void iwl3945_reset_qos(struct iwl3945_priv *priv) { u16 cw_min = 15; u16 cw_max = 1023; @@ -1960,7 +1960,7 @@ static void iwl_reset_qos(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } -static void iwl_activate_qos(struct iwl_priv *priv, u8 force) +static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force) { unsigned long flags; @@ -1984,11 +1984,11 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) spin_unlock_irqrestore(&priv->lock, flags); - if (force || iwl_is_associated(priv)) { + if (force || iwl3945_is_associated(priv)) { IWL_DEBUG_QOS("send QoS cmd with Qos active %d \n", priv->qos_data.qos_active); - iwl_send_qos_params_command(priv, + iwl3945_send_qos_params_command(priv, &(priv->qos_data.def_qos_parm)); } } @@ -2011,7 +2011,7 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) /* default power management (not Tx power) table values */ /* for tim 0-10 */ -static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { +static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = { {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0}, @@ -2021,7 +2021,7 @@ static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { }; /* for tim > 10 */ -static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { +static struct iwl3945_power_vec_entry range_1[IWL_POWER_AC] = { {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, @@ -2034,11 +2034,11 @@ static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} }; -int iwl_power_init_handle(struct iwl_priv *priv) +int iwl3945_power_init_handle(struct iwl3945_priv *priv) { int rc = 0, i; - struct iwl_power_mgr *pow_data; - int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_AC; + struct iwl3945_power_mgr *pow_data; + int size = sizeof(struct iwl3945_power_vec_entry) * IWL_POWER_AC; u16 pci_pm; IWL_DEBUG_POWER("Initialize power \n"); @@ -2057,7 +2057,7 @@ int iwl_power_init_handle(struct iwl_priv *priv) if (rc != 0) return 0; else { - struct iwl_powertable_cmd *cmd; + struct iwl3945_powertable_cmd *cmd; IWL_DEBUG_POWER("adjust power command flags\n"); @@ -2073,15 +2073,15 @@ int iwl_power_init_handle(struct iwl_priv *priv) return rc; } -static int iwl_update_power_cmd(struct iwl_priv *priv, - struct iwl_powertable_cmd *cmd, u32 mode) +static int iwl3945_update_power_cmd(struct iwl3945_priv *priv, + struct iwl3945_powertable_cmd *cmd, u32 mode) { int rc = 0, i; u8 skip; u32 max_sleep = 0; - struct iwl_power_vec_entry *range; + struct iwl3945_power_vec_entry *range; u8 period = 0; - struct iwl_power_mgr *pow_data; + struct iwl3945_power_mgr *pow_data; if (mode > IWL_POWER_INDEX_5) { IWL_DEBUG_POWER("Error invalid power mode \n"); @@ -2094,7 +2094,7 @@ static int iwl_update_power_cmd(struct iwl_priv *priv, else range = &pow_data->pwr_range_1[1]; - memcpy(cmd, &range[mode].cmd, sizeof(struct iwl_powertable_cmd)); + memcpy(cmd, &range[mode].cmd, sizeof(struct iwl3945_powertable_cmd)); #ifdef IWL_MAC80211_DISABLE if (priv->assoc_network != NULL) { @@ -2137,11 +2137,11 @@ static int iwl_update_power_cmd(struct iwl_priv *priv, return rc; } -static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) +static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode) { u32 final_mode = mode; int rc; - struct iwl_powertable_cmd cmd; + struct iwl3945_powertable_cmd cmd; /* If on battery, set to 3, * if plugged into AC power, set to CAM ("continuously aware mode"), @@ -2158,9 +2158,9 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) break; } - iwl_update_power_cmd(priv, &cmd, final_mode); + iwl3945_update_power_cmd(priv, &cmd, final_mode); - rc = iwl_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); + rc = iwl3945_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); if (final_mode == IWL_POWER_MODE_CAM) clear_bit(STATUS_POWER_PMI, &priv->status); @@ -2170,7 +2170,7 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) return rc; } -int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) +int iwl3945_is_network_packet(struct iwl3945_priv *priv, struct ieee80211_hdr *header) { /* Filter incoming packets to determine if they are targeted toward * this network, discarding packets coming from ourselves */ @@ -2200,7 +2200,7 @@ int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x -static const char *iwl_get_tx_fail_reason(u32 status) +static const char *iwl3945_get_tx_fail_reason(u32 status) { switch (status & TX_STATUS_MSK) { case TX_STATUS_SUCCESS: @@ -2227,11 +2227,11 @@ static const char *iwl_get_tx_fail_reason(u32 status) } /** - * iwl_scan_cancel - Cancel any currently executing HW scan + * iwl3945_scan_cancel - Cancel any currently executing HW scan * * NOTE: priv->mutex is not required before calling this function */ -static int iwl_scan_cancel(struct iwl_priv *priv) +static int iwl3945_scan_cancel(struct iwl3945_priv *priv) { if (!test_bit(STATUS_SCAN_HW, &priv->status)) { clear_bit(STATUS_SCANNING, &priv->status); @@ -2254,17 +2254,17 @@ static int iwl_scan_cancel(struct iwl_priv *priv) } /** - * iwl_scan_cancel_timeout - Cancel any currently executing HW scan + * iwl3945_scan_cancel_timeout - Cancel any currently executing HW scan * @ms: amount of time to wait (in milliseconds) for scan to abort * * NOTE: priv->mutex must be held before calling this function */ -static int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) +static int iwl3945_scan_cancel_timeout(struct iwl3945_priv *priv, unsigned long ms) { unsigned long now = jiffies; int ret; - ret = iwl_scan_cancel(priv); + ret = iwl3945_scan_cancel(priv); if (ret && ms) { mutex_unlock(&priv->mutex); while (!time_after(jiffies, now + msecs_to_jiffies(ms)) && @@ -2278,7 +2278,7 @@ static int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) return ret; } -static void iwl_sequence_reset(struct iwl_priv *priv) +static void iwl3945_sequence_reset(struct iwl3945_priv *priv) { /* Reset ieee stats */ @@ -2289,13 +2289,13 @@ static void iwl_sequence_reset(struct iwl_priv *priv) priv->last_frag_num = -1; priv->last_packet_time = 0; - iwl_scan_cancel(priv); + iwl3945_scan_cancel(priv); } #define MAX_UCODE_BEACON_INTERVAL 1024 #define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA) -static __le16 iwl_adjust_beacon_interval(u16 beacon_val) +static __le16 iwl3945_adjust_beacon_interval(u16 beacon_val) { u16 new_val = 0; u16 beacon_factor = 0; @@ -2308,7 +2308,7 @@ static __le16 iwl_adjust_beacon_interval(u16 beacon_val) return cpu_to_le16(new_val); } -static void iwl_setup_rxon_timing(struct iwl_priv *priv) +static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv) { u64 interval_tm_unit; u64 tsf, result; @@ -2338,14 +2338,14 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv) priv->rxon_timing.beacon_interval = cpu_to_le16(beacon_int); priv->rxon_timing.beacon_interval = - iwl_adjust_beacon_interval( + iwl3945_adjust_beacon_interval( le16_to_cpu(priv->rxon_timing.beacon_interval)); } priv->rxon_timing.atim_window = 0; } else { priv->rxon_timing.beacon_interval = - iwl_adjust_beacon_interval(conf->beacon_int); + iwl3945_adjust_beacon_interval(conf->beacon_int); /* TODO: we need to get atim_window from upper stack * for now we set to 0 */ priv->rxon_timing.atim_window = 0; @@ -2364,14 +2364,14 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv) le16_to_cpu(priv->rxon_timing.atim_window)); } -static int iwl_scan_initiate(struct iwl_priv *priv) +static int iwl3945_scan_initiate(struct iwl3945_priv *priv) { if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { IWL_ERROR("APs don't scan.\n"); return 0; } - if (!iwl_is_ready_rf(priv)) { + if (!iwl3945_is_ready_rf(priv)) { IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); return -EIO; } @@ -2398,9 +2398,9 @@ static int iwl_scan_initiate(struct iwl_priv *priv) return 0; } -static int iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) +static int iwl3945_set_rxon_hwcrypto(struct iwl3945_priv *priv, int hw_decrypt) { - struct iwl_rxon_cmd *rxon = &priv->staging_rxon; + struct iwl3945_rxon_cmd *rxon = &priv->staging_rxon; if (hw_decrypt) rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; @@ -2410,7 +2410,7 @@ static int iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) return 0; } -static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) +static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, u8 phymode) { if (phymode == MODE_IEEE80211A) { priv->staging_rxon.flags &= @@ -2418,7 +2418,7 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) | RXON_FLG_CCK_MSK); priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; } else { - /* Copied from iwl_bg_post_associate() */ + /* Copied from iwl3945_bg_post_associate() */ if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; else @@ -2436,9 +2436,9 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) /* * initialize rxon structure with default values from eeprom */ -static void iwl_connection_init_rx_config(struct iwl_priv *priv) +static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) { - const struct iwl_channel_info *ch_info; + const struct iwl3945_channel_info *ch_info; memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); @@ -2475,7 +2475,7 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv) priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; #endif - ch_info = iwl_get_channel_info(priv, priv->phymode, + ch_info = iwl3945_get_channel_info(priv, priv->phymode, le16_to_cpu(priv->staging_rxon.channel)); if (!ch_info) @@ -2495,7 +2495,7 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv) else priv->phymode = MODE_IEEE80211G; - iwl_set_flags_for_phymode(priv, priv->phymode); + iwl3945_set_flags_for_phymode(priv, priv->phymode); priv->staging_rxon.ofdm_basic_rates = (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; @@ -2503,15 +2503,15 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv) (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; } -static int iwl_set_mode(struct iwl_priv *priv, int mode) +static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) { - if (!iwl_is_ready_rf(priv)) + if (!iwl3945_is_ready_rf(priv)) return -EAGAIN; if (mode == IEEE80211_IF_TYPE_IBSS) { - const struct iwl_channel_info *ch_info; + const struct iwl3945_channel_info *ch_info; - ch_info = iwl_get_channel_info(priv, + ch_info = iwl3945_get_channel_info(priv, priv->phymode, le16_to_cpu(priv->staging_rxon.channel)); @@ -2523,7 +2523,7 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode) } cancel_delayed_work(&priv->scan_check); - if (iwl_scan_cancel_timeout(priv, 100)) { + if (iwl3945_scan_cancel_timeout(priv, 100)) { IWL_WARNING("Aborted scan still in progress after 100ms\n"); IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); return -EAGAIN; @@ -2531,23 +2531,23 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode) priv->iw_mode = mode; - iwl_connection_init_rx_config(priv); + iwl3945_connection_init_rx_config(priv); memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); - iwl_clear_stations_table(priv); + iwl3945_clear_stations_table(priv); - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); return 0; } -static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv, +static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv, struct ieee80211_tx_control *ctl, - struct iwl_cmd *cmd, + struct iwl3945_cmd *cmd, struct sk_buff *skb_frag, int last_frag) { - struct iwl_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo; + struct iwl3945_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo; switch (keyinfo->alg) { case ALG_CCMP: @@ -2590,8 +2590,8 @@ static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv, /* * handle build REPLY_TX command notification. */ -static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, - struct iwl_cmd *cmd, +static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv, + struct iwl3945_cmd *cmd, struct ieee80211_tx_control *ctrl, struct ieee80211_hdr *hdr, int is_unicast, u8 std_id) @@ -2650,7 +2650,7 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, cmd->cmd.tx.next_frame_len = 0; } -static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) +static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *hdr) { int sta_id; u16 fc = le16_to_cpu(hdr->frame_control); @@ -2670,7 +2670,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) /* If we are an AP, then find the station, or use BCAST */ case IEEE80211_IF_TYPE_AP: - sta_id = iwl_hw_find_station(priv, hdr->addr1); + sta_id = iwl3945_hw_find_station(priv, hdr->addr1); if (sta_id != IWL_INVALID_STATION) return sta_id; return priv->hw_setting.bcast_sta_id; @@ -2680,11 +2680,11 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) case IEEE80211_IF_TYPE_IBSS: { DECLARE_MAC_BUF(mac); - sta_id = iwl_hw_find_station(priv, hdr->addr1); + sta_id = iwl3945_hw_find_station(priv, hdr->addr1); if (sta_id != IWL_INVALID_STATION) return sta_id; - sta_id = iwl_add_station(priv, hdr->addr1, 0, CMD_ASYNC); + sta_id = iwl3945_add_station(priv, hdr->addr1, 0, CMD_ASYNC); if (sta_id != IWL_INVALID_STATION) return sta_id; @@ -2692,7 +2692,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) IWL_DEBUG_DROP("Station %s not in station map. " "Defaulting to broadcast...\n", print_mac(mac, hdr->addr1)); - iwl_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); + iwl3945_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); return priv->hw_setting.bcast_sta_id; } default: @@ -2704,18 +2704,18 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) /* * start REPLY_TX command process */ -static int iwl_tx_skb(struct iwl_priv *priv, +static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb, struct ieee80211_tx_control *ctl) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct iwl_tfd_frame *tfd; + struct iwl3945_tfd_frame *tfd; u32 *control_flags; int txq_id = ctl->queue; - struct iwl_tx_queue *txq = NULL; - struct iwl_queue *q = NULL; + struct iwl3945_tx_queue *txq = NULL; + struct iwl3945_queue *q = NULL; dma_addr_t phys_addr; dma_addr_t txcmd_phys; - struct iwl_cmd *out_cmd = NULL; + struct iwl3945_cmd *out_cmd = NULL; u16 len, idx, len_org; u8 id, hdr_len, unicast; u8 sta_id; @@ -2727,7 +2727,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, int rc; spin_lock_irqsave(&priv->lock, flags); - if (iwl_is_rfkill(priv)) { + if (iwl3945_is_rfkill(priv)) { IWL_DEBUG_DROP("Dropping - RF KILL\n"); goto drop_unlock; } @@ -2756,16 +2756,16 @@ static int iwl_tx_skb(struct iwl_priv *priv, IWL_DEBUG_TX("Sending REASSOC frame\n"); #endif - if (!iwl_is_associated(priv) && + if (!iwl3945_is_associated(priv) && ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { - IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n"); + IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); goto drop_unlock; } spin_unlock_irqrestore(&priv->lock, flags); hdr_len = ieee80211_get_hdrlen(fc); - sta_id = iwl_get_sta_id(priv, hdr); + sta_id = iwl3945_get_sta_id(priv, hdr); if (sta_id == IWL_INVALID_STATION) { DECLARE_MAC_BUF(mac); @@ -2796,7 +2796,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, control_flags = (u32 *) tfd; idx = get_cmd_index(q, q->write_ptr, 0); - memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); + memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info)); txq->txb[q->write_ptr].skb[0] = skb; memcpy(&(txq->txb[q->write_ptr].status.control), ctl, sizeof(struct ieee80211_tx_control)); @@ -2811,7 +2811,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, /* hdr = (struct ieee80211_hdr *)out_cmd->cmd.tx.hdr; */ len = priv->hw_setting.tx_cmd_len + - sizeof(struct iwl_cmd_header) + hdr_len; + sizeof(struct iwl3945_cmd_header) + hdr_len; len_org = len; len = (len + 3) & ~3; @@ -2821,20 +2821,20 @@ static int iwl_tx_skb(struct iwl_priv *priv, else len_org = 0; - txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx + - offsetof(struct iwl_cmd, hdr); + txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl3945_cmd) * idx + + offsetof(struct iwl3945_cmd, hdr); - iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); + iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) - iwl_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); + iwl3945_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); /* 802.11 null functions have no payload... */ len = skb->len - hdr_len; if (len) { phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, len, PCI_DMA_TODEVICE); - iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len); + iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len); } /* If there is no payload, then only one TFD is used */ @@ -2848,10 +2848,10 @@ static int iwl_tx_skb(struct iwl_priv *priv, out_cmd->cmd.tx.len = cpu_to_le16(len); /* TODO need this for burst mode later on */ - iwl_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id); + iwl3945_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id); /* set is_hcca to 0; it probably will never be implemented */ - iwl_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); + iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; @@ -2867,25 +2867,25 @@ static int iwl_tx_skb(struct iwl_priv *priv, txq->need_update = 0; } - iwl_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, + iwl3945_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, sizeof(out_cmd->cmd.tx)); - iwl_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, + iwl3945_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, ieee80211_get_hdrlen(fc)); - q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); - rc = iwl_tx_queue_update_write_ptr(priv, txq); + q->write_ptr = iwl3945_queue_inc_wrap(q->write_ptr, q->n_bd); + rc = iwl3945_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); if (rc) return rc; - if ((iwl_queue_space(q) < q->high_mark) + if ((iwl3945_queue_space(q) < q->high_mark) && priv->mac80211_registered) { if (wait_write_ptr) { spin_lock_irqsave(&priv->lock, flags); txq->need_update = 1; - iwl_tx_queue_update_write_ptr(priv, txq); + iwl3945_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); } @@ -2900,13 +2900,13 @@ drop: return -1; } -static void iwl_set_rate(struct iwl_priv *priv) +static void iwl3945_set_rate(struct iwl3945_priv *priv) { const struct ieee80211_hw_mode *hw = NULL; struct ieee80211_rate *rate; int i; - hw = iwl_get_hw_mode(priv, priv->phymode); + hw = iwl3945_get_hw_mode(priv, priv->phymode); if (!hw) { IWL_ERROR("Failed to set rate: unable to get hw mode\n"); return; @@ -2924,7 +2924,7 @@ static void iwl_set_rate(struct iwl_priv *priv) if ((rate->val < IWL_RATE_COUNT) && (rate->flags & IEEE80211_RATE_SUPPORTED)) { IWL_DEBUG_RATE("Adding rate index %d (plcp %d)%s\n", - rate->val, iwl_rates[rate->val].plcp, + rate->val, iwl3945_rates[rate->val].plcp, (rate->flags & IEEE80211_RATE_BASIC) ? "*" : ""); priv->active_rate |= (1 << rate->val); @@ -2932,7 +2932,7 @@ static void iwl_set_rate(struct iwl_priv *priv) priv->active_rate_basic |= (1 << rate->val); } else IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n", - rate->val, iwl_rates[rate->val].plcp); + rate->val, iwl3945_rates[rate->val].plcp); } IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n", @@ -2961,7 +2961,7 @@ static void iwl_set_rate(struct iwl_priv *priv) (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; } -static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) +static void iwl3945_radio_kill_sw(struct iwl3945_priv *priv, int disable_radio) { unsigned long flags; @@ -2972,21 +2972,21 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) disable_radio ? "OFF" : "ON"); if (disable_radio) { - iwl_scan_cancel(priv); + iwl3945_scan_cancel(priv); /* FIXME: This is a workaround for AP */ if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { spin_lock_irqsave(&priv->lock, flags); - iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_SW_BIT_RFKILL); spin_unlock_irqrestore(&priv->lock, flags); - iwl_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0); + iwl3945_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0); set_bit(STATUS_RF_KILL_SW, &priv->status); } return; } spin_lock_irqsave(&priv->lock, flags); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); clear_bit(STATUS_RF_KILL_SW, &priv->status); spin_unlock_irqrestore(&priv->lock, flags); @@ -2995,9 +2995,9 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) msleep(10); spin_lock_irqsave(&priv->lock, flags); - iwl_read32(priv, CSR_UCODE_DRV_GP1); - if (!iwl_grab_nic_access(priv)) - iwl_release_nic_access(priv); + iwl3945_read32(priv, CSR_UCODE_DRV_GP1); + if (!iwl3945_grab_nic_access(priv)) + iwl3945_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { @@ -3010,7 +3010,7 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) return; } -void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, +void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb, u32 decrypt_res, struct ieee80211_rx_status *stats) { u16 fc = @@ -3042,13 +3042,13 @@ void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, } } -void iwl_handle_data_packet_monitor(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb, +void iwl3945_handle_data_packet_monitor(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb, void *data, short len, struct ieee80211_rx_status *stats, u16 phy_flags) { - struct iwl_rt_rx_hdr *iwl_rt; + struct iwl3945_rt_rx_hdr *iwl3945_rt; /* First cache any information we need before we overwrite * the information provided in the skb from the hardware */ @@ -3059,26 +3059,26 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv, __le16 phy_flags_hw = cpu_to_le16(phy_flags); /* We received data from the HW, so stop the watchdog */ - if (len > IWL_RX_BUF_SIZE - sizeof(*iwl_rt)) { + if (len > IWL_RX_BUF_SIZE - sizeof(*iwl3945_rt)) { IWL_DEBUG_DROP("Dropping too large packet in monitor\n"); return; } /* copy the frame data to write after where the radiotap header goes */ - iwl_rt = (void *)rxb->skb->data; - memmove(iwl_rt->payload, data, len); + iwl3945_rt = (void *)rxb->skb->data; + memmove(iwl3945_rt->payload, data, len); - iwl_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; - iwl_rt->rt_hdr.it_pad = 0; /* always good to zero */ + iwl3945_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; + iwl3945_rt->rt_hdr.it_pad = 0; /* always good to zero */ /* total header + data */ - iwl_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl_rt)); + iwl3945_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl3945_rt)); /* Set the size of the skb to the size of the frame */ - skb_put(rxb->skb, sizeof(*iwl_rt) + len); + skb_put(rxb->skb, sizeof(*iwl3945_rt) + len); /* Big bitfield of all the fields we provide in radiotap */ - iwl_rt->rt_hdr.it_present = + iwl3945_rt->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | (1 << IEEE80211_RADIOTAP_FLAGS) | (1 << IEEE80211_RADIOTAP_RATE) | @@ -3088,39 +3088,39 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv, (1 << IEEE80211_RADIOTAP_ANTENNA)); /* Zero the flags, we'll add to them as we go */ - iwl_rt->rt_flags = 0; + iwl3945_rt->rt_flags = 0; - iwl_rt->rt_tsf = cpu_to_le64(tsf); + iwl3945_rt->rt_tsf = cpu_to_le64(tsf); /* Convert to dBm */ - iwl_rt->rt_dbmsignal = signal; - iwl_rt->rt_dbmnoise = noise; + iwl3945_rt->rt_dbmsignal = signal; + iwl3945_rt->rt_dbmnoise = noise; /* Convert the channel frequency and set the flags */ - iwl_rt->rt_channelMHz = cpu_to_le16(stats->freq); + iwl3945_rt->rt_channelMHz = cpu_to_le16(stats->freq); if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) - iwl_rt->rt_chbitmask = + iwl3945_rt->rt_chbitmask = cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) - iwl_rt->rt_chbitmask = + iwl3945_rt->rt_chbitmask = cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); else /* 802.11g */ - iwl_rt->rt_chbitmask = + iwl3945_rt->rt_chbitmask = cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ)); - rate = iwl_rate_index_from_plcp(rate); + rate = iwl3945_rate_index_from_plcp(rate); if (rate == -1) - iwl_rt->rt_rate = 0; + iwl3945_rt->rt_rate = 0; else - iwl_rt->rt_rate = iwl_rates[rate].ieee; + iwl3945_rt->rt_rate = iwl3945_rates[rate].ieee; /* antenna number */ - iwl_rt->rt_antenna = + iwl3945_rt->rt_antenna = le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; /* set the preamble flag if we have it */ if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) - iwl_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + iwl3945_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; IWL_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); @@ -3132,7 +3132,7 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv, #define IWL_PACKET_RETRY_TIME HZ -int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) +int iwl3945_is_duplicate_packet(struct iwl3945_priv *priv, struct ieee80211_hdr *header) { u16 sc = le16_to_cpu(header->seq_ctrl); u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4; @@ -3143,12 +3143,12 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) switch (priv->iw_mode) { case IEEE80211_IF_TYPE_IBSS:{ struct list_head *p; - struct iwl_ibss_seq *entry = NULL; + struct iwl3945_ibss_seq *entry = NULL; u8 *mac = header->addr2; int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1); __list_for_each(p, &priv->ibss_mac_hash[index]) { - entry = list_entry(p, struct iwl_ibss_seq, list); + entry = list_entry(p, struct iwl3945_ibss_seq, list); if (!compare_ether_addr(entry->mac, mac)) break; } @@ -3211,7 +3211,7 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) * the lower 3 bytes is the time in usec within one beacon interval */ -static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval) +static u32 iwl3945_usecs_to_beacons(u32 usec, u32 beacon_interval) { u32 quot; u32 rem; @@ -3230,7 +3230,7 @@ static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval) * the same as HW timer counter counting down */ -static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) +static __le32 iwl3945_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) { u32 base_low = base & BEACON_TIME_MASK_LOW; u32 addon_low = addon & BEACON_TIME_MASK_LOW; @@ -3249,13 +3249,13 @@ static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) return cpu_to_le32(res); } -static int iwl_get_measurement(struct iwl_priv *priv, +static int iwl3945_get_measurement(struct iwl3945_priv *priv, struct ieee80211_measurement_params *params, u8 type) { - struct iwl_spectrum_cmd spectrum; - struct iwl_rx_packet *res; - struct iwl_host_cmd cmd = { + struct iwl3945_spectrum_cmd spectrum; + struct iwl3945_rx_packet *res; + struct iwl3945_host_cmd cmd = { .id = REPLY_SPECTRUM_MEASUREMENT_CMD, .data = (void *)&spectrum, .meta.flags = CMD_WANT_SKB, @@ -3265,9 +3265,9 @@ static int iwl_get_measurement(struct iwl_priv *priv, int spectrum_resp_status; int duration = le16_to_cpu(params->duration); - if (iwl_is_associated(priv)) + if (iwl3945_is_associated(priv)) add_time = - iwl_usecs_to_beacons( + iwl3945_usecs_to_beacons( le64_to_cpu(params->start_time) - priv->last_tsf, le16_to_cpu(priv->rxon_timing.beacon_interval)); @@ -3280,9 +3280,9 @@ static int iwl_get_measurement(struct iwl_priv *priv, cmd.len = sizeof(spectrum); spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); - if (iwl_is_associated(priv)) + if (iwl3945_is_associated(priv)) spectrum.start_time = - iwl_add_beacon_time(priv->last_beacon_time, + iwl3945_add_beacon_time(priv->last_beacon_time, add_time, le16_to_cpu(priv->rxon_timing.beacon_interval)); else @@ -3295,11 +3295,11 @@ static int iwl_get_measurement(struct iwl_priv *priv, spectrum.flags |= RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; - rc = iwl_send_cmd_sync(priv, &cmd); + rc = iwl3945_send_cmd_sync(priv, &cmd); if (rc) return rc; - res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; + res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data; if (res->hdr.flags & IWL_CMD_FAILED_MSK) { IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n"); rc = -EIO; @@ -3328,8 +3328,8 @@ static int iwl_get_measurement(struct iwl_priv *priv, } #endif -static void iwl_txstatus_to_ieee(struct iwl_priv *priv, - struct iwl_tx_info *tx_sta) +static void iwl3945_txstatus_to_ieee(struct iwl3945_priv *priv, + struct iwl3945_tx_info *tx_sta) { tx_sta->status.ack_signal = 0; @@ -3348,16 +3348,16 @@ static void iwl_txstatus_to_ieee(struct iwl_priv *priv, } /** - * iwl_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC. + * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC. * * When FW advances 'R' index, all entries between old and * new 'R' index need to be reclaimed. As result, some free space * forms. If there is enough free space (> low mark), wake Tx queue. */ -static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) +static int iwl3945_tx_queue_reclaim(struct iwl3945_priv *priv, int txq_id, int index) { - struct iwl_tx_queue *txq = &priv->txq[txq_id]; - struct iwl_queue *q = &txq->q; + struct iwl3945_tx_queue *txq = &priv->txq[txq_id]; + struct iwl3945_queue *q = &txq->q; int nfreed = 0; if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) { @@ -3367,13 +3367,13 @@ static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) return 0; } - for (index = iwl_queue_inc_wrap(index, q->n_bd); + for (index = iwl3945_queue_inc_wrap(index, q->n_bd); q->read_ptr != index; - q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { + q->read_ptr = iwl3945_queue_inc_wrap(q->read_ptr, q->n_bd)) { if (txq_id != IWL_CMD_QUEUE_NUM) { - iwl_txstatus_to_ieee(priv, + iwl3945_txstatus_to_ieee(priv, &(txq->txb[txq->q.read_ptr])); - iwl_hw_txq_free_tfd(priv, txq); + iwl3945_hw_txq_free_tfd(priv, txq); } else if (nfreed > 1) { IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, q->write_ptr, q->read_ptr); @@ -3382,7 +3382,7 @@ static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) nfreed++; } - if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) && + if (iwl3945_queue_space(q) > q->low_mark && (txq_id >= 0) && (txq_id != IWL_CMD_QUEUE_NUM) && priv->mac80211_registered) ieee80211_wake_queue(priv->hw, txq_id); @@ -3391,7 +3391,7 @@ static int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) return nfreed; } -static int iwl_is_tx_success(u32 status) +static int iwl3945_is_tx_success(u32 status) { return (status & 0xFF) == 0x1; } @@ -3401,16 +3401,16 @@ static int iwl_is_tx_success(u32 status) * Generic RX handler implementations * ******************************************************************************/ -static void iwl_rx_reply_tx(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; u16 sequence = le16_to_cpu(pkt->hdr.sequence); int txq_id = SEQ_TO_QUEUE(sequence); int index = SEQ_TO_INDEX(sequence); - struct iwl_tx_queue *txq = &priv->txq[txq_id]; + struct iwl3945_tx_queue *txq = &priv->txq[txq_id]; struct ieee80211_tx_status *tx_status; - struct iwl_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; + struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; u32 status = le32_to_cpu(tx_resp->status); if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) { @@ -3429,28 +3429,28 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, tx_status->queue_length |= tx_resp->failure_rts; tx_status->flags = - iwl_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; + iwl3945_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; - tx_status->control.tx_rate = iwl_rate_index_from_plcp(tx_resp->rate); + tx_status->control.tx_rate = iwl3945_rate_index_from_plcp(tx_resp->rate); IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", - txq_id, iwl_get_tx_fail_reason(status), status, + txq_id, iwl3945_get_tx_fail_reason(status), status, tx_resp->rate, tx_resp->failure_frame); IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); if (index != -1) - iwl_tx_queue_reclaim(priv, txq_id, index); + iwl3945_tx_queue_reclaim(priv, txq_id, index); if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); } -static void iwl_rx_reply_alive(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_alive_resp *palive; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_alive_resp *palive; struct delayed_work *pwork; palive = &pkt->u.alive_frame; @@ -3464,14 +3464,14 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv, IWL_DEBUG_INFO("Initialization Alive received.\n"); memcpy(&priv->card_alive_init, &pkt->u.alive_frame, - sizeof(struct iwl_init_alive_resp)); + sizeof(struct iwl3945_init_alive_resp)); pwork = &priv->init_alive_start; } else { IWL_DEBUG_INFO("Runtime Alive received.\n"); memcpy(&priv->card_alive, &pkt->u.alive_frame, - sizeof(struct iwl_alive_resp)); + sizeof(struct iwl3945_alive_resp)); pwork = &priv->alive_start; - iwl_disable_events(priv); + iwl3945_disable_events(priv); } /* We delay the ALIVE response by 5ms to @@ -3483,19 +3483,19 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv, IWL_WARNING("uCode did not respond OK.\n"); } -static void iwl_rx_reply_add_sta(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_reply_add_sta(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); return; } -static void iwl_rx_reply_error(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_reply_error(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) " "seq 0x%04X ser 0x%08X\n", @@ -3508,23 +3508,23 @@ static void iwl_rx_reply_error(struct iwl_priv *priv, #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x -static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_csa(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon; - struct iwl_csa_notification *csa = &(pkt->u.csa_notif); + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_rxon_cmd *rxon = (void *)&priv->active_rxon; + struct iwl3945_csa_notification *csa = &(pkt->u.csa_notif); IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); rxon->channel = csa->channel; priv->staging_rxon.channel = csa->channel; } -static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_spectrum_measure_notif(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_spectrum_notification *report = &(pkt->u.spectrum_notif); if (!report->state) { IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO, @@ -3537,31 +3537,31 @@ static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, #endif } -static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { #ifdef CONFIG_IWL3945_DEBUG - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_sleep_notification *sleep = &(pkt->u.sleep_notif); IWL_DEBUG_RX("sleep mode: %d, src: %d\n", sleep->pm_sleep_mode, sleep->pm_wakeup_src); #endif } -static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_pm_debug_statistics_notif(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " "notification for %s:\n", le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); - iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); + iwl3945_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); } -static void iwl_bg_beacon_update(struct work_struct *work) +static void iwl3945_bg_beacon_update(struct work_struct *work) { - struct iwl_priv *priv = - container_of(work, struct iwl_priv, beacon_update); + struct iwl3945_priv *priv = + container_of(work, struct iwl3945_priv, beacon_update); struct sk_buff *beacon; /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ @@ -3580,15 +3580,15 @@ static void iwl_bg_beacon_update(struct work_struct *work) priv->ibss_beacon = beacon; mutex_unlock(&priv->mutex); - iwl_send_beacon_cmd(priv); + iwl3945_send_beacon_cmd(priv); } -static void iwl_rx_beacon_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_beacon_notif(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { #ifdef CONFIG_IWL3945_DEBUG - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_beacon_notif *beacon = &(pkt->u.beacon_status); + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status); u8 rate = beacon->beacon_notify_hdr.rate; IWL_DEBUG_RX("beacon status %x retries %d iss %d " @@ -3606,25 +3606,25 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv, } /* Service response to REPLY_SCAN_CMD (0x80) */ -static void iwl_rx_reply_scan(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_reply_scan(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { #ifdef CONFIG_IWL3945_DEBUG - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_scanreq_notification *notif = - (struct iwl_scanreq_notification *)pkt->u.raw; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_scanreq_notification *notif = + (struct iwl3945_scanreq_notification *)pkt->u.raw; IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status); #endif } /* Service SCAN_START_NOTIFICATION (0x82) */ -static void iwl_rx_scan_start_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_scan_start_notif(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_scanstart_notification *notif = - (struct iwl_scanstart_notification *)pkt->u.raw; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_scanstart_notification *notif = + (struct iwl3945_scanstart_notification *)pkt->u.raw; priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); IWL_DEBUG_SCAN("Scan start: " "%d [802.11%s] " @@ -3636,12 +3636,12 @@ static void iwl_rx_scan_start_notif(struct iwl_priv *priv, } /* Service SCAN_RESULTS_NOTIFICATION (0x83) */ -static void iwl_rx_scan_results_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_scanresults_notification *notif = - (struct iwl_scanresults_notification *)pkt->u.raw; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_scanresults_notification *notif = + (struct iwl3945_scanresults_notification *)pkt->u.raw; IWL_DEBUG_SCAN("Scan ch.res: " "%d [802.11%s] " @@ -3660,11 +3660,11 @@ static void iwl_rx_scan_results_notif(struct iwl_priv *priv, } /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ -static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_scancomplete_notification *scan_notif = (void *)pkt->u.raw; IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", scan_notif->scanned_channels, @@ -3717,10 +3717,10 @@ reschedule: /* Handle notification from uCode that card's power state is changing * due to software, hardware, or critical temperature RFKILL */ -static void iwl_rx_card_state_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_rx_card_state_notif(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); unsigned long status = priv->status; @@ -3728,7 +3728,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, (flags & HW_CARD_DISABLED) ? "Kill" : "On", (flags & SW_CARD_DISABLED) ? "Kill" : "On"); - iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); if (flags & HW_CARD_DISABLED) @@ -3742,7 +3742,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, else clear_bit(STATUS_RF_KILL_SW, &priv->status); - iwl_scan_cancel(priv); + iwl3945_scan_cancel(priv); if ((test_bit(STATUS_RF_KILL_HW, &status) != test_bit(STATUS_RF_KILL_HW, &priv->status)) || @@ -3754,7 +3754,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, } /** - * iwl_setup_rx_handlers - Initialize Rx handler callbacks + * iwl3945_setup_rx_handlers - Initialize Rx handler callbacks * * Setup the RX handlers for each of the reply types sent from the uCode * to the host. @@ -3762,20 +3762,20 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, * This function chains into the hardware specific files for them to setup * any hardware specific handlers as well. */ -static void iwl_setup_rx_handlers(struct iwl_priv *priv) +static void iwl3945_setup_rx_handlers(struct iwl3945_priv *priv) { - priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive; - priv->rx_handlers[REPLY_ADD_STA] = iwl_rx_reply_add_sta; - priv->rx_handlers[REPLY_ERROR] = iwl_rx_reply_error; - priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa; + priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive; + priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta; + priv->rx_handlers[REPLY_ERROR] = iwl3945_rx_reply_error; + priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl3945_rx_csa; priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = - iwl_rx_spectrum_measure_notif; - priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_rx_pm_sleep_notif; + iwl3945_rx_spectrum_measure_notif; + priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl3945_rx_pm_sleep_notif; priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = - iwl_rx_pm_debug_statistics_notif; - priv->rx_handlers[BEACON_NOTIFICATION] = iwl_rx_beacon_notif; + iwl3945_rx_pm_debug_statistics_notif; + priv->rx_handlers[BEACON_NOTIFICATION] = iwl3945_rx_beacon_notif; - /* NOTE: iwl_rx_statistics is different based on whether + /* NOTE: iwl3945_rx_statistics is different based on whether * the build is for the 3945 or the 4965. See the * corresponding implementation in iwl-XXXX.c * @@ -3783,40 +3783,40 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv) * discrete statistics request from the host as well as * for the periodic statistics notification from the uCode */ - priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl_hw_rx_statistics; - priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl_hw_rx_statistics; + priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl3945_hw_rx_statistics; + priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl3945_hw_rx_statistics; - priv->rx_handlers[REPLY_SCAN_CMD] = iwl_rx_reply_scan; - priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl_rx_scan_start_notif; + priv->rx_handlers[REPLY_SCAN_CMD] = iwl3945_rx_reply_scan; + priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl3945_rx_scan_start_notif; priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = - iwl_rx_scan_results_notif; + iwl3945_rx_scan_results_notif; priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = - iwl_rx_scan_complete_notif; - priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl_rx_card_state_notif; - priv->rx_handlers[REPLY_TX] = iwl_rx_reply_tx; + iwl3945_rx_scan_complete_notif; + priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl3945_rx_card_state_notif; + priv->rx_handlers[REPLY_TX] = iwl3945_rx_reply_tx; /* Setup hardware specific Rx handlers */ - iwl_hw_rx_handler_setup(priv); + iwl3945_hw_rx_handler_setup(priv); } /** - * iwl_tx_cmd_complete - Pull unused buffers off the queue and reclaim them + * iwl3945_tx_cmd_complete - Pull unused buffers off the queue and reclaim them * @rxb: Rx buffer to reclaim * * If an Rx buffer has an async callback associated with it the callback * will be executed. The attached skb (if present) will only be freed * if the callback returns 1 */ -static void iwl_tx_cmd_complete(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv, + struct iwl3945_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; + struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data; u16 sequence = le16_to_cpu(pkt->hdr.sequence); int txq_id = SEQ_TO_QUEUE(sequence); int index = SEQ_TO_INDEX(sequence); int huge = sequence & SEQ_HUGE_FRAME; int cmd_index; - struct iwl_cmd *cmd; + struct iwl3945_cmd *cmd; /* If a Tx command is being handled and it isn't in the actual * command queue then there a command routing bug has been introduced @@ -3837,7 +3837,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv, !cmd->meta.u.callback(priv, cmd, rxb->skb)) rxb->skb = NULL; - iwl_tx_queue_reclaim(priv, txq_id, index); + iwl3945_tx_queue_reclaim(priv, txq_id, index); if (!(cmd->meta.flags & CMD_ASYNC)) { clear_bit(STATUS_HCMD_ACTIVE, &priv->status); @@ -3879,7 +3879,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv, * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled * to replenish the iwl->rxq->rx_free. - * + In iwl_rx_replenish (scheduled) if 'processed' != 'read' then the + * + In iwl3945_rx_replenish (scheduled) if 'processed' != 'read' then the * iwl->rxq is replenished and the READ INDEX is updated (updating the * 'processed' and 'read' driver indexes as well) * + A received packet is processed and handed to the kernel network stack, @@ -3892,28 +3892,28 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv, * * Driver sequence: * - * iwl_rx_queue_alloc() Allocates rx_free - * iwl_rx_replenish() Replenishes rx_free list from rx_used, and calls - * iwl_rx_queue_restock - * iwl_rx_queue_restock() Moves available buffers from rx_free into Rx + * iwl3945_rx_queue_alloc() Allocates rx_free + * iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls + * iwl3945_rx_queue_restock + * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx * queue, updates firmware pointers, and updates * the WRITE index. If insufficient rx_free buffers - * are available, schedules iwl_rx_replenish + * are available, schedules iwl3945_rx_replenish * * -- enable interrupts -- - * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the + * ISR - iwl3945_rx() Detach iwl3945_rx_mem_buffers from pool up to the * READ INDEX, detaching the SKB from the pool. * Moves the packet buffer from queue to rx_used. - * Calls iwl_rx_queue_restock to refill any empty + * Calls iwl3945_rx_queue_restock to refill any empty * slots. * ... * */ /** - * iwl_rx_queue_space - Return number of free slots available in queue. + * iwl3945_rx_queue_space - Return number of free slots available in queue. */ -static int iwl_rx_queue_space(const struct iwl_rx_queue *q) +static int iwl3945_rx_queue_space(const struct iwl3945_rx_queue *q) { int s = q->read - q->write; if (s <= 0) @@ -3926,7 +3926,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q) } /** - * iwl_rx_queue_update_write_ptr - Update the write pointer for the RX queue + * iwl3945_rx_queue_update_write_ptr - Update the write pointer for the RX queue * * NOTE: This function has 3945 and 4965 specific code sections * but is declared in base due to the majority of the @@ -3934,7 +3934,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q) * different) * */ -int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) +int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, struct iwl3945_rx_queue *q) { u32 reg = 0; int rc = 0; @@ -3946,23 +3946,23 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) goto exit_unlock; if (test_bit(STATUS_POWER_PMI, &priv->status)) { - reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); + reg = iwl3945_read32(priv, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - iwl_set_bit(priv, CSR_GP_CNTRL, + iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); goto exit_unlock; } - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) goto exit_unlock; - iwl_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, + iwl3945_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); } else - iwl_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); + iwl3945_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); q->need_update = 0; @@ -3973,18 +3973,18 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) } /** - * iwl_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer. + * iwl3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer. * * NOTE: This function has 3945 and 4965 specific code paths in it. */ -static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv, +static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl3945_priv *priv, dma_addr_t dma_addr) { return cpu_to_le32((u32)dma_addr); } /** - * iwl_rx_queue_restock - refill RX queue from pre-allocated pool + * iwl3945_rx_queue_restock - refill RX queue from pre-allocated pool * * If there are slots in the RX queue that need to be restocked, * and we have free pre-allocated buffers, fill the ranks as much @@ -3994,21 +3994,21 @@ static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv, * also updates the memory address in the firmware to reference the new * target buffer. */ -static int iwl_rx_queue_restock(struct iwl_priv *priv) +static int iwl3945_rx_queue_restock(struct iwl3945_priv *priv) { - struct iwl_rx_queue *rxq = &priv->rxq; + struct iwl3945_rx_queue *rxq = &priv->rxq; struct list_head *element; - struct iwl_rx_mem_buffer *rxb; + struct iwl3945_rx_mem_buffer *rxb; unsigned long flags; int write, rc; spin_lock_irqsave(&rxq->lock, flags); write = rxq->write & ~0x7; - while ((iwl_rx_queue_space(rxq) > 0) && (rxq->free_count)) { + while ((iwl3945_rx_queue_space(rxq) > 0) && (rxq->free_count)) { element = rxq->rx_free.next; - rxb = list_entry(element, struct iwl_rx_mem_buffer, list); + rxb = list_entry(element, struct iwl3945_rx_mem_buffer, list); list_del(element); - rxq->bd[rxq->write] = iwl_dma_addr2rbd_ptr(priv, rxb->dma_addr); + rxq->bd[rxq->write] = iwl3945_dma_addr2rbd_ptr(priv, rxb->dma_addr); rxq->queue[rxq->write] = rxb; rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; rxq->free_count--; @@ -4026,7 +4026,7 @@ static int iwl_rx_queue_restock(struct iwl_priv *priv) spin_lock_irqsave(&rxq->lock, flags); rxq->need_update = 1; spin_unlock_irqrestore(&rxq->lock, flags); - rc = iwl_rx_queue_update_write_ptr(priv, rxq); + rc = iwl3945_rx_queue_update_write_ptr(priv, rxq); if (rc) return rc; } @@ -4035,24 +4035,24 @@ static int iwl_rx_queue_restock(struct iwl_priv *priv) } /** - * iwl_rx_replenish - Move all used packet from rx_used to rx_free + * iwl3945_rx_replenish - Move all used packet from rx_used to rx_free * * When moving to rx_free an SKB is allocated for the slot. * - * Also restock the Rx queue via iwl_rx_queue_restock. + * Also restock the Rx queue via iwl3945_rx_queue_restock. * This is called as a scheduled work item (except for during initialization) */ -void iwl_rx_replenish(void *data) +void iwl3945_rx_replenish(void *data) { - struct iwl_priv *priv = data; - struct iwl_rx_queue *rxq = &priv->rxq; + struct iwl3945_priv *priv = data; + struct iwl3945_rx_queue *rxq = &priv->rxq; struct list_head *element; - struct iwl_rx_mem_buffer *rxb; + struct iwl3945_rx_mem_buffer *rxb; unsigned long flags; spin_lock_irqsave(&rxq->lock, flags); while (!list_empty(&rxq->rx_used)) { element = rxq->rx_used.next; - rxb = list_entry(element, struct iwl_rx_mem_buffer, list); + rxb = list_entry(element, struct iwl3945_rx_mem_buffer, list); rxb->skb = alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC); if (!rxb->skb) { @@ -4075,7 +4075,7 @@ void iwl_rx_replenish(void *data) spin_unlock_irqrestore(&rxq->lock, flags); spin_lock_irqsave(&priv->lock, flags); - iwl_rx_queue_restock(priv); + iwl3945_rx_queue_restock(priv); spin_unlock_irqrestore(&priv->lock, flags); } @@ -4084,7 +4084,7 @@ void iwl_rx_replenish(void *data) * This free routine walks the list of POOL entries and if SKB is set to * non NULL it is unmapped and freed */ -static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +static void iwl3945_rx_queue_free(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq) { int i; for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { @@ -4101,9 +4101,9 @@ static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) rxq->bd = NULL; } -int iwl_rx_queue_alloc(struct iwl_priv *priv) +int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv) { - struct iwl_rx_queue *rxq = &priv->rxq; + struct iwl3945_rx_queue *rxq = &priv->rxq; struct pci_dev *dev = priv->pci_dev; int i; @@ -4124,7 +4124,7 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv) return 0; } -void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +void iwl3945_rx_queue_reset(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq) { unsigned long flags; int i; @@ -4171,7 +4171,7 @@ static u8 ratio2dB[100] = { /* Calculates a relative dB value from a ratio of linear * (i.e. not dB) signal levels. * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ -int iwl_calc_db_from_ratio(int sig_ratio) +int iwl3945_calc_db_from_ratio(int sig_ratio) { /* Anything above 1000:1 just report as 60 dB */ if (sig_ratio > 1000) @@ -4197,7 +4197,7 @@ int iwl_calc_db_from_ratio(int sig_ratio) /* Calculate an indication of rx signal quality (a percentage, not dBm!). * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info * about formulas used below. */ -int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) +int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm) { int sig_qual; int degradation = PERFECT_RSSI - rssi_dbm; @@ -4232,22 +4232,22 @@ int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) } /** - * iwl_rx_handle - Main entry function for receiving responses from the uCode + * iwl3945_rx_handle - Main entry function for receiving responses from the uCode * * Uses the priv->rx_handlers callback function array to invoke * the appropriate handlers, including command responses, * frame-received notifications, and other notifications. */ -static void iwl_rx_handle(struct iwl_priv *priv) +static void iwl3945_rx_handle(struct iwl3945_priv *priv) { - struct iwl_rx_mem_buffer *rxb; - struct iwl_rx_packet *pkt; - struct iwl_rx_queue *rxq = &priv->rxq; + struct iwl3945_rx_mem_buffer *rxb; + struct iwl3945_rx_packet *pkt; + struct iwl3945_rx_queue *rxq = &priv->rxq; u32 r, i; int reclaim; unsigned long flags; - r = iwl_hw_get_rx_read(priv); + r = iwl3945_hw_get_rx_read(priv); i = rxq->read; /* Rx interrupt, but nothing sent from uCode */ @@ -4267,7 +4267,7 @@ static void iwl_rx_handle(struct iwl_priv *priv) pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); - pkt = (struct iwl_rx_packet *)rxb->skb->data; + pkt = (struct iwl3945_rx_packet *)rxb->skb->data; /* Reclaim a command buffer only if this packet is a response * to a (driver-originated) command. @@ -4281,7 +4281,7 @@ static void iwl_rx_handle(struct iwl_priv *priv) /* Based on type of command response or notification, * handle those that need handling via function in - * rx_handlers table. See iwl_setup_rx_handlers() */ + * rx_handlers table. See iwl3945_setup_rx_handlers() */ if (priv->rx_handlers[pkt->hdr.cmd]) { IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR, "r = %d, i = %d, %s, 0x%02x\n", r, i, @@ -4297,10 +4297,10 @@ static void iwl_rx_handle(struct iwl_priv *priv) if (reclaim) { /* Invoke any callbacks, transfer the skb to caller, - * and fire off the (possibly) blocking iwl_send_cmd() + * and fire off the (possibly) blocking iwl3945_send_cmd() * as we reclaim the driver command queue */ if (rxb && rxb->skb) - iwl_tx_cmd_complete(priv, rxb); + iwl3945_tx_cmd_complete(priv, rxb); else IWL_WARNING("Claim null rxb?\n"); } @@ -4324,11 +4324,11 @@ static void iwl_rx_handle(struct iwl_priv *priv) /* Backtrack one entry */ priv->rxq.read = i; - iwl_rx_queue_restock(priv); + iwl3945_rx_queue_restock(priv); } -static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_tx_queue *txq) +static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, + struct iwl3945_tx_queue *txq) { u32 reg = 0; int rc = 0; @@ -4342,27 +4342,27 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, /* wake up nic if it's powered down ... * uCode will wake up, and interrupt us again, so next * time we'll skip this part. */ - reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); + reg = iwl3945_read32(priv, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { IWL_DEBUG_INFO("Requesting wakeup, GP1 = 0x%x\n", reg); - iwl_set_bit(priv, CSR_GP_CNTRL, + iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); return rc; } /* restore this queue's parameters in nic hardware. */ - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) return rc; - iwl_write_direct32(priv, HBUS_TARG_WRPTR, + iwl3945_write_direct32(priv, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); /* else not in power-save mode, uCode will never sleep when we're * trying to tx (during RFKILL, we're not trying to tx). */ } else - iwl_write32(priv, HBUS_TARG_WRPTR, + iwl3945_write32(priv, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); txq->need_update = 0; @@ -4371,12 +4371,12 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, } #ifdef CONFIG_IWL3945_DEBUG -static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) +static void iwl3945_print_rx_config_cmd(struct iwl3945_rxon_cmd *rxon) { DECLARE_MAC_BUF(mac); IWL_DEBUG_RADIO("RX CONFIG:\n"); - iwl_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); + iwl3945_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", @@ -4393,24 +4393,24 @@ static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) } #endif -static void iwl_enable_interrupts(struct iwl_priv *priv) +static void iwl3945_enable_interrupts(struct iwl3945_priv *priv) { IWL_DEBUG_ISR("Enabling interrupts\n"); set_bit(STATUS_INT_ENABLED, &priv->status); - iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); + iwl3945_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); } -static inline void iwl_disable_interrupts(struct iwl_priv *priv) +static inline void iwl3945_disable_interrupts(struct iwl3945_priv *priv) { clear_bit(STATUS_INT_ENABLED, &priv->status); /* disable interrupts from uCode/NIC to host */ - iwl_write32(priv, CSR_INT_MASK, 0x00000000); + iwl3945_write32(priv, CSR_INT_MASK, 0x00000000); /* acknowledge/clear/reset any interrupts still pending * from uCode or flow handler (Rx/Tx DMA) */ - iwl_write32(priv, CSR_INT, 0xffffffff); - iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); + iwl3945_write32(priv, CSR_INT, 0xffffffff); + iwl3945_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); IWL_DEBUG_ISR("Disabled interrupts\n"); } @@ -4437,7 +4437,7 @@ static const char *desc_lookup(int i) #define ERROR_START_OFFSET (1 * sizeof(u32)) #define ERROR_ELEM_SIZE (7 * sizeof(u32)) -static void iwl_dump_nic_error_log(struct iwl_priv *priv) +static void iwl3945_dump_nic_error_log(struct iwl3945_priv *priv) { u32 i; u32 desc, time, count, base, data1; @@ -4446,18 +4446,18 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) base = le32_to_cpu(priv->card_alive.error_event_table_ptr); - if (!iwl_hw_valid_rtc_data_addr(base)) { + if (!iwl3945_hw_valid_rtc_data_addr(base)) { IWL_ERROR("Not valid error log pointer 0x%08X\n", base); return; } - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { IWL_WARNING("Can not read from adapter at this time.\n"); return; } - count = iwl_read_targ_mem(priv, base); + count = iwl3945_read_targ_mem(priv, base); if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { IWL_ERROR("Start IWL Error Log Dump:\n"); @@ -4470,19 +4470,19 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) for (i = ERROR_START_OFFSET; i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; i += ERROR_ELEM_SIZE) { - desc = iwl_read_targ_mem(priv, base + i); + desc = iwl3945_read_targ_mem(priv, base + i); time = - iwl_read_targ_mem(priv, base + i + 1 * sizeof(u32)); + iwl3945_read_targ_mem(priv, base + i + 1 * sizeof(u32)); blink1 = - iwl_read_targ_mem(priv, base + i + 2 * sizeof(u32)); + iwl3945_read_targ_mem(priv, base + i + 2 * sizeof(u32)); blink2 = - iwl_read_targ_mem(priv, base + i + 3 * sizeof(u32)); + iwl3945_read_targ_mem(priv, base + i + 3 * sizeof(u32)); ilink1 = - iwl_read_targ_mem(priv, base + i + 4 * sizeof(u32)); + iwl3945_read_targ_mem(priv, base + i + 4 * sizeof(u32)); ilink2 = - iwl_read_targ_mem(priv, base + i + 5 * sizeof(u32)); + iwl3945_read_targ_mem(priv, base + i + 5 * sizeof(u32)); data1 = - iwl_read_targ_mem(priv, base + i + 6 * sizeof(u32)); + iwl3945_read_targ_mem(priv, base + i + 6 * sizeof(u32)); IWL_ERROR ("%-13s (#%d) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", @@ -4490,18 +4490,18 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) ilink1, ilink2, data1); } - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); } #define EVENT_START_OFFSET (4 * sizeof(u32)) /** - * iwl_print_event_log - Dump error event log to syslog + * iwl3945_print_event_log - Dump error event log to syslog * - * NOTE: Must be called with iwl_grab_nic_access() already obtained! + * NOTE: Must be called with iwl3945_grab_nic_access() already obtained! */ -static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, +static void iwl3945_print_event_log(struct iwl3945_priv *priv, u32 start_idx, u32 num_events, u32 mode) { u32 i; @@ -4525,21 +4525,21 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, /* "time" is actually "data" for mode 0 (no timestamp). * place event id # at far right for easier visual parsing. */ for (i = 0; i < num_events; i++) { - ev = iwl_read_targ_mem(priv, ptr); + ev = iwl3945_read_targ_mem(priv, ptr); ptr += sizeof(u32); - time = iwl_read_targ_mem(priv, ptr); + time = iwl3945_read_targ_mem(priv, ptr); ptr += sizeof(u32); if (mode == 0) IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */ else { - data = iwl_read_targ_mem(priv, ptr); + data = iwl3945_read_targ_mem(priv, ptr); ptr += sizeof(u32); IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev); } } } -static void iwl_dump_nic_event_log(struct iwl_priv *priv) +static void iwl3945_dump_nic_event_log(struct iwl3945_priv *priv) { int rc; u32 base; /* SRAM byte address of event log header */ @@ -4550,29 +4550,29 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) u32 size; /* # entries that we'll print */ base = le32_to_cpu(priv->card_alive.log_event_table_ptr); - if (!iwl_hw_valid_rtc_data_addr(base)) { + if (!iwl3945_hw_valid_rtc_data_addr(base)) { IWL_ERROR("Invalid event log pointer 0x%08X\n", base); return; } - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { IWL_WARNING("Can not read from adapter at this time.\n"); return; } /* event log header */ - capacity = iwl_read_targ_mem(priv, base); - mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32))); - num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32))); - next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32))); + capacity = iwl3945_read_targ_mem(priv, base); + mode = iwl3945_read_targ_mem(priv, base + (1 * sizeof(u32))); + num_wraps = iwl3945_read_targ_mem(priv, base + (2 * sizeof(u32))); + next_entry = iwl3945_read_targ_mem(priv, base + (3 * sizeof(u32))); size = num_wraps ? capacity : next_entry; /* bail out if nothing in log */ if (size == 0) { IWL_ERROR("Start IWL Event Log Dump: nothing in log\n"); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); return; } @@ -4582,31 +4582,31 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) /* if uCode has wrapped back to top of log, start at the oldest entry, * i.e the next one that uCode would fill. */ if (num_wraps) - iwl_print_event_log(priv, next_entry, + iwl3945_print_event_log(priv, next_entry, capacity - next_entry, mode); /* (then/else) start at top of log */ - iwl_print_event_log(priv, 0, next_entry, mode); + iwl3945_print_event_log(priv, 0, next_entry, mode); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); } /** - * iwl_irq_handle_error - called for HW or SW error interrupt from card + * iwl3945_irq_handle_error - called for HW or SW error interrupt from card */ -static void iwl_irq_handle_error(struct iwl_priv *priv) +static void iwl3945_irq_handle_error(struct iwl3945_priv *priv) { - /* Set the FW error flag -- cleared on iwl_down */ + /* Set the FW error flag -- cleared on iwl3945_down */ set_bit(STATUS_FW_ERROR, &priv->status); /* Cancel currently queued command. */ clear_bit(STATUS_HCMD_ACTIVE, &priv->status); #ifdef CONFIG_IWL3945_DEBUG - if (iwl_debug_level & IWL_DL_FW_ERRORS) { - iwl_dump_nic_error_log(priv); - iwl_dump_nic_event_log(priv); - iwl_print_rx_config_cmd(&priv->staging_rxon); + if (iwl3945_debug_level & IWL_DL_FW_ERRORS) { + iwl3945_dump_nic_error_log(priv); + iwl3945_dump_nic_event_log(priv); + iwl3945_print_rx_config_cmd(&priv->staging_rxon); } #endif @@ -4620,7 +4620,7 @@ static void iwl_irq_handle_error(struct iwl_priv *priv) IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS, "Restarting adapter due to uCode error.\n"); - if (iwl_is_associated(priv)) { + if (iwl3945_is_associated(priv)) { memcpy(&priv->recovery_rxon, &priv->active_rxon, sizeof(priv->recovery_rxon)); priv->error_recovering = 1; @@ -4629,16 +4629,16 @@ static void iwl_irq_handle_error(struct iwl_priv *priv) } } -static void iwl_error_recovery(struct iwl_priv *priv) +static void iwl3945_error_recovery(struct iwl3945_priv *priv) { unsigned long flags; memcpy(&priv->staging_rxon, &priv->recovery_rxon, sizeof(priv->staging_rxon)); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); - iwl_add_station(priv, priv->bssid, 1, 0); + iwl3945_add_station(priv, priv->bssid, 1, 0); spin_lock_irqsave(&priv->lock, flags); priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id); @@ -4646,7 +4646,7 @@ static void iwl_error_recovery(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } -static void iwl_irq_tasklet(struct iwl_priv *priv) +static void iwl3945_irq_tasklet(struct iwl3945_priv *priv) { u32 inta, handled = 0; u32 inta_fh; @@ -4660,18 +4660,18 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) /* Ack/clear/reset pending uCode interrupts. * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, * and will clear only when CSR_FH_INT_STATUS gets cleared. */ - inta = iwl_read32(priv, CSR_INT); - iwl_write32(priv, CSR_INT, inta); + inta = iwl3945_read32(priv, CSR_INT); + iwl3945_write32(priv, CSR_INT, inta); /* Ack/clear/reset pending flow-handler (DMA) interrupts. * Any new interrupts that happen after this, either while we're * in this tasklet, or later, will show up in next ISR/tasklet. */ - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); - iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); + inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS); + iwl3945_write32(priv, CSR_FH_INT_STATUS, inta_fh); #ifdef CONFIG_IWL3945_DEBUG - if (iwl_debug_level & IWL_DL_ISR) { - inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ + if (iwl3945_debug_level & IWL_DL_ISR) { + inta_mask = iwl3945_read32(priv, CSR_INT_MASK); /* just for debug */ IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); } @@ -4691,9 +4691,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) IWL_ERROR("Microcode HW error detected. Restarting.\n"); /* Tell the device to stop sending interrupts */ - iwl_disable_interrupts(priv); + iwl3945_disable_interrupts(priv); - iwl_irq_handle_error(priv); + iwl3945_irq_handle_error(priv); handled |= CSR_INT_BIT_HW_ERR; @@ -4703,7 +4703,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) } #ifdef CONFIG_IWL3945_DEBUG - if (iwl_debug_level & (IWL_DL_ISR)) { + if (iwl3945_debug_level & (IWL_DL_ISR)) { /* NIC fires this, but we don't use it, redundant with WAKEUP */ if (inta & CSR_INT_BIT_MAC_CLK_ACTV) IWL_DEBUG_ISR("Microcode started or stopped.\n"); @@ -4719,7 +4719,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) /* HW RF KILL switch toggled (4965 only) */ if (inta & CSR_INT_BIT_RF_KILL) { int hw_rf_kill = 0; - if (!(iwl_read32(priv, CSR_GP_CNTRL) & + if (!(iwl3945_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) hw_rf_kill = 1; @@ -4749,20 +4749,20 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) if (inta & CSR_INT_BIT_SW_ERR) { IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", inta); - iwl_irq_handle_error(priv); + iwl3945_irq_handle_error(priv); handled |= CSR_INT_BIT_SW_ERR; } /* uCode wakes up after power-down sleep */ if (inta & CSR_INT_BIT_WAKEUP) { IWL_DEBUG_ISR("Wakeup interrupt\n"); - iwl_rx_queue_update_write_ptr(priv, &priv->rxq); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[0]); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[1]); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[2]); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[3]); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[4]); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[5]); + iwl3945_rx_queue_update_write_ptr(priv, &priv->rxq); + iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[0]); + iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[1]); + iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[2]); + iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[3]); + iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[4]); + iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[5]); handled |= CSR_INT_BIT_WAKEUP; } @@ -4771,19 +4771,19 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) * Rx "responses" (frame-received notification), and other * notifications from uCode come through here*/ if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { - iwl_rx_handle(priv); + iwl3945_rx_handle(priv); handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); } if (inta & CSR_INT_BIT_FH_TX) { IWL_DEBUG_ISR("Tx interrupt\n"); - iwl_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); - if (!iwl_grab_nic_access(priv)) { - iwl_write_direct32(priv, + iwl3945_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); + if (!iwl3945_grab_nic_access(priv)) { + iwl3945_write_direct32(priv, FH_TCSR_CREDIT (ALM_FH_SRVC_CHNL), 0x0); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); } handled |= CSR_INT_BIT_FH_TX; } @@ -4798,13 +4798,13 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) } /* Re-enable all interrupts */ - iwl_enable_interrupts(priv); + iwl3945_enable_interrupts(priv); #ifdef CONFIG_IWL3945_DEBUG - if (iwl_debug_level & (IWL_DL_ISR)) { - inta = iwl_read32(priv, CSR_INT); - inta_mask = iwl_read32(priv, CSR_INT_MASK); - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); + if (iwl3945_debug_level & (IWL_DL_ISR)) { + inta = iwl3945_read32(priv, CSR_INT); + inta_mask = iwl3945_read32(priv, CSR_INT_MASK); + inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS); IWL_DEBUG_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); } @@ -4812,9 +4812,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } -static irqreturn_t iwl_isr(int irq, void *data) +static irqreturn_t iwl3945_isr(int irq, void *data) { - struct iwl_priv *priv = data; + struct iwl3945_priv *priv = data; u32 inta, inta_mask; u32 inta_fh; if (!priv) @@ -4826,12 +4826,12 @@ static irqreturn_t iwl_isr(int irq, void *data) * back-to-back ISRs and sporadic interrupts from our NIC. * If we have something to service, the tasklet will re-enable ints. * If we *don't* have something, we'll re-enable before leaving here. */ - inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ - iwl_write32(priv, CSR_INT_MASK, 0x00000000); + inta_mask = iwl3945_read32(priv, CSR_INT_MASK); /* just for debug */ + iwl3945_write32(priv, CSR_INT_MASK, 0x00000000); /* Discover which interrupts are active/pending */ - inta = iwl_read32(priv, CSR_INT); - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); + inta = iwl3945_read32(priv, CSR_INT); + inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS); /* Ignore interrupt if there's nothing in NIC to service. * This may be due to IRQ shared with another device, @@ -4850,7 +4850,7 @@ static irqreturn_t iwl_isr(int irq, void *data) IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); - /* iwl_irq_tasklet() will service interrupts and re-enable them */ + /* iwl3945_irq_tasklet() will service interrupts and re-enable them */ tasklet_schedule(&priv->irq_tasklet); unplugged: spin_unlock(&priv->lock); @@ -4859,18 +4859,18 @@ unplugged: none: /* re-enable interrupts here since we don't have anything to service. */ - iwl_enable_interrupts(priv); + iwl3945_enable_interrupts(priv); spin_unlock(&priv->lock); return IRQ_NONE; } /************************** EEPROM BANDS **************************** * - * The iwl_eeprom_band definitions below provide the mapping from the + * The iwl3945_eeprom_band definitions below provide the mapping from the * EEPROM contents to the specific channel number supported for each * band. * - * For example, iwl_priv->eeprom.band_3_channels[4] from the band_3 + * For example, iwl3945_priv->eeprom.band_3_channels[4] from the band_3 * definition below maps to physical channel 42 in the 5.2GHz spectrum. * The specific geography and calibration information for that channel * is contained in the eeprom map itself. @@ -4896,58 +4896,58 @@ unplugged: *********************************************************************/ /* 2.4 GHz */ -static const u8 iwl_eeprom_band_1[14] = { +static const u8 iwl3945_eeprom_band_1[14] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; /* 5.2 GHz bands */ -static const u8 iwl_eeprom_band_2[] = { +static const u8 iwl3945_eeprom_band_2[] = { 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 }; -static const u8 iwl_eeprom_band_3[] = { /* 5205-5320MHz */ +static const u8 iwl3945_eeprom_band_3[] = { /* 5205-5320MHz */ 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 }; -static const u8 iwl_eeprom_band_4[] = { /* 5500-5700MHz */ +static const u8 iwl3945_eeprom_band_4[] = { /* 5500-5700MHz */ 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 }; -static const u8 iwl_eeprom_band_5[] = { /* 5725-5825MHz */ +static const u8 iwl3945_eeprom_band_5[] = { /* 5725-5825MHz */ 145, 149, 153, 157, 161, 165 }; -static void iwl_init_band_reference(const struct iwl_priv *priv, int band, +static void iwl3945_init_band_reference(const struct iwl3945_priv *priv, int band, int *eeprom_ch_count, - const struct iwl_eeprom_channel + const struct iwl3945_eeprom_channel **eeprom_ch_info, const u8 **eeprom_ch_index) { switch (band) { case 1: /* 2.4GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1); + *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_1); *eeprom_ch_info = priv->eeprom.band_1_channels; - *eeprom_ch_index = iwl_eeprom_band_1; + *eeprom_ch_index = iwl3945_eeprom_band_1; break; case 2: /* 5.2GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2); + *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_2); *eeprom_ch_info = priv->eeprom.band_2_channels; - *eeprom_ch_index = iwl_eeprom_band_2; + *eeprom_ch_index = iwl3945_eeprom_band_2; break; case 3: /* 5.2GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3); + *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_3); *eeprom_ch_info = priv->eeprom.band_3_channels; - *eeprom_ch_index = iwl_eeprom_band_3; + *eeprom_ch_index = iwl3945_eeprom_band_3; break; case 4: /* 5.2GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4); + *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_4); *eeprom_ch_info = priv->eeprom.band_4_channels; - *eeprom_ch_index = iwl_eeprom_band_4; + *eeprom_ch_index = iwl3945_eeprom_band_4; break; case 5: /* 5.2GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5); + *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_5); *eeprom_ch_info = priv->eeprom.band_5_channels; - *eeprom_ch_index = iwl_eeprom_band_5; + *eeprom_ch_index = iwl3945_eeprom_band_5; break; default: BUG(); @@ -4955,7 +4955,7 @@ static void iwl_init_band_reference(const struct iwl_priv *priv, int band, } } -const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv, +const struct iwl3945_channel_info *iwl3945_get_channel_info(const struct iwl3945_priv *priv, int phymode, u16 channel) { int i; @@ -4982,13 +4982,13 @@ const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv, #define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ ? # x " " : "") -static int iwl_init_channel_map(struct iwl_priv *priv) +static int iwl3945_init_channel_map(struct iwl3945_priv *priv) { int eeprom_ch_count = 0; const u8 *eeprom_ch_index = NULL; - const struct iwl_eeprom_channel *eeprom_ch_info = NULL; + const struct iwl3945_eeprom_channel *eeprom_ch_info = NULL; int band, ch; - struct iwl_channel_info *ch_info; + struct iwl3945_channel_info *ch_info; if (priv->channel_count) { IWL_DEBUG_INFO("Channel map already initialized.\n"); @@ -5004,15 +5004,15 @@ static int iwl_init_channel_map(struct iwl_priv *priv) IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n"); priv->channel_count = - ARRAY_SIZE(iwl_eeprom_band_1) + - ARRAY_SIZE(iwl_eeprom_band_2) + - ARRAY_SIZE(iwl_eeprom_band_3) + - ARRAY_SIZE(iwl_eeprom_band_4) + - ARRAY_SIZE(iwl_eeprom_band_5); + ARRAY_SIZE(iwl3945_eeprom_band_1) + + ARRAY_SIZE(iwl3945_eeprom_band_2) + + ARRAY_SIZE(iwl3945_eeprom_band_3) + + ARRAY_SIZE(iwl3945_eeprom_band_4) + + ARRAY_SIZE(iwl3945_eeprom_band_5); IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count); - priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) * + priv->channel_info = kzalloc(sizeof(struct iwl3945_channel_info) * priv->channel_count, GFP_KERNEL); if (!priv->channel_info) { IWL_ERROR("Could not allocate channel_info\n"); @@ -5027,7 +5027,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv) * what just in the EEPROM) */ for (band = 1; band <= 5; band++) { - iwl_init_band_reference(priv, band, &eeprom_ch_count, + iwl3945_init_band_reference(priv, band, &eeprom_ch_count, &eeprom_ch_info, &eeprom_ch_index); /* Loop through each band adding each of the channels */ @@ -5120,7 +5120,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv) #define IWL_PASSIVE_DWELL_BASE (100) #define IWL_CHANNEL_TUNE_TIME 5 -static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, int phymode) +static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, int phymode) { if (phymode == MODE_IEEE80211A) return IWL_ACTIVE_DWELL_TIME_52; @@ -5128,14 +5128,14 @@ static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, int phymode) return IWL_ACTIVE_DWELL_TIME_24; } -static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, int phymode) +static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, int phymode) { - u16 active = iwl_get_active_dwell_time(priv, phymode); + u16 active = iwl3945_get_active_dwell_time(priv, phymode); u16 passive = (phymode != MODE_IEEE80211A) ? IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; - if (iwl_is_associated(priv)) { + if (iwl3945_is_associated(priv)) { /* If we're associated, we clamp the maximum passive * dwell time to be 98% of the beacon interval (minus * 2 * channel tune time) */ @@ -5151,30 +5151,30 @@ static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, int phymode) return passive; } -static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode, +static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode, u8 is_active, u8 direct_mask, - struct iwl_scan_channel *scan_ch) + struct iwl3945_scan_channel *scan_ch) { const struct ieee80211_channel *channels = NULL; const struct ieee80211_hw_mode *hw_mode; - const struct iwl_channel_info *ch_info; + const struct iwl3945_channel_info *ch_info; u16 passive_dwell = 0; u16 active_dwell = 0; int added, i; - hw_mode = iwl_get_hw_mode(priv, phymode); + hw_mode = iwl3945_get_hw_mode(priv, phymode); if (!hw_mode) return 0; channels = hw_mode->channels; - active_dwell = iwl_get_active_dwell_time(priv, phymode); - passive_dwell = iwl_get_passive_dwell_time(priv, phymode); + active_dwell = iwl3945_get_active_dwell_time(priv, phymode); + passive_dwell = iwl3945_get_passive_dwell_time(priv, phymode); for (i = 0, added = 0; i < hw_mode->num_channels; i++) { if (channels[i].chan == le16_to_cpu(priv->active_rxon.channel)) { - if (iwl_is_associated(priv)) { + if (iwl3945_is_associated(priv)) { IWL_DEBUG_SCAN ("Skipping current channel %d\n", le16_to_cpu(priv->active_rxon.channel)); @@ -5185,7 +5185,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode, scan_ch->channel = channels[i].chan; - ch_info = iwl_get_channel_info(priv, phymode, scan_ch->channel); + ch_info = iwl3945_get_channel_info(priv, phymode, scan_ch->channel); if (!is_channel_valid(ch_info)) { IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", scan_ch->channel); @@ -5236,7 +5236,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode, return added; } -static void iwl_reset_channel_flag(struct iwl_priv *priv) +static void iwl3945_reset_channel_flag(struct iwl3945_priv *priv) { int i, j; for (i = 0; i < 3; i++) { @@ -5246,13 +5246,13 @@ static void iwl_reset_channel_flag(struct iwl_priv *priv) } } -static void iwl_init_hw_rates(struct iwl_priv *priv, +static void iwl3945_init_hw_rates(struct iwl3945_priv *priv, struct ieee80211_rate *rates) { int i; for (i = 0; i < IWL_RATE_COUNT; i++) { - rates[i].rate = iwl_rates[i].ieee * 5; + rates[i].rate = iwl3945_rates[i].ieee * 5; rates[i].val = i; /* Rate scaling will work on indexes */ rates[i].val2 = i; rates[i].flags = IEEE80211_RATE_SUPPORTED; @@ -5264,7 +5264,7 @@ static void iwl_init_hw_rates(struct iwl_priv *priv, * If CCK 1M then set rate flag to CCK else CCK_2 * which is CCK | PREAMBLE2 */ - rates[i].flags |= (iwl_rates[i].plcp == 10) ? + rates[i].flags |= (iwl3945_rates[i].plcp == 10) ? IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2; } @@ -5275,11 +5275,11 @@ static void iwl_init_hw_rates(struct iwl_priv *priv, } /** - * iwl_init_geos - Initialize mac80211's geo/channel info based from eeprom + * iwl3945_init_geos - Initialize mac80211's geo/channel info based from eeprom */ -static int iwl_init_geos(struct iwl_priv *priv) +static int iwl3945_init_geos(struct iwl3945_priv *priv) { - struct iwl_channel_info *ch; + struct iwl3945_channel_info *ch; struct ieee80211_hw_mode *modes; struct ieee80211_channel *channels; struct ieee80211_channel *geo_ch; @@ -5325,7 +5325,7 @@ static int iwl_init_geos(struct iwl_priv *priv) /* 5.2GHz channels start after the 2.4GHz channels */ modes[A].mode = MODE_IEEE80211A; - modes[A].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; + modes[A].channels = &channels[ARRAY_SIZE(iwl3945_eeprom_band_1)]; modes[A].rates = &rates[4]; modes[A].num_rates = 8; /* just OFDM */ modes[A].num_channels = 0; @@ -5345,7 +5345,7 @@ static int iwl_init_geos(struct iwl_priv *priv) priv->ieee_channels = channels; priv->ieee_rates = rates; - iwl_init_hw_rates(priv, rates); + iwl3945_init_hw_rates(priv, rates); for (i = 0, geo_ch = channels; i < priv->channel_count; i++) { ch = &priv->channel_info[i]; @@ -5428,7 +5428,7 @@ static int iwl_init_geos(struct iwl_priv *priv) * ******************************************************************************/ -static void iwl_dealloc_ucode_pci(struct iwl_priv *priv) +static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv) { if (priv->ucode_code.v_addr != NULL) { pci_free_consistent(priv->pci_dev, @@ -5475,10 +5475,10 @@ static void iwl_dealloc_ucode_pci(struct iwl_priv *priv) } /** - * iwl_verify_inst_full - verify runtime uCode image in card vs. host, + * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host, * looking at all data. */ -static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) +static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 * image, u32 len) { u32 val; u32 save_len = len; @@ -5487,18 +5487,18 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) IWL_DEBUG_INFO("ucode inst image size is %u\n", len); - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) return rc; - iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); + iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); errcnt = 0; for (; len > 0; len -= sizeof(u32), image++) { /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log * if IWL_DL_IO is set */ - val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); + val = _iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { IWL_ERROR("uCode INST section is invalid at " "offset 0x%x, is 0x%x, s/b 0x%x\n", @@ -5510,7 +5510,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) } } - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); if (!errcnt) IWL_DEBUG_INFO("ucode image in INSTRUCTION memory is good\n"); @@ -5520,11 +5520,11 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) /** - * iwl_verify_inst_sparse - verify runtime uCode image in card vs. host, + * iwl3945_verify_inst_sparse - verify runtime uCode image in card vs. host, * using sample data 100 bytes apart. If these sample points are good, * it's a pretty good bet that everything between them is good, too. */ -static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) +static int iwl3945_verify_inst_sparse(struct iwl3945_priv *priv, __le32 *image, u32 len) { u32 val; int rc = 0; @@ -5533,7 +5533,7 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) IWL_DEBUG_INFO("ucode inst image size is %u\n", len); - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) return rc; @@ -5541,9 +5541,9 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log * if IWL_DL_IO is set */ - iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, + iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, i + RTC_INST_LOWER_BOUND); - val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); + val = _iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { #if 0 /* Enable this if you want to see details */ IWL_ERROR("uCode INST section is invalid at " @@ -5557,17 +5557,17 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) } } - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); return rc; } /** - * iwl_verify_ucode - determine which instruction image is in SRAM, + * iwl3945_verify_ucode - determine which instruction image is in SRAM, * and verify its contents */ -static int iwl_verify_ucode(struct iwl_priv *priv) +static int iwl3945_verify_ucode(struct iwl3945_priv *priv) { __le32 *image; u32 len; @@ -5576,7 +5576,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv) /* Try bootstrap */ image = (__le32 *)priv->ucode_boot.v_addr; len = priv->ucode_boot.len; - rc = iwl_verify_inst_sparse(priv, image, len); + rc = iwl3945_verify_inst_sparse(priv, image, len); if (rc == 0) { IWL_DEBUG_INFO("Bootstrap uCode is good in inst SRAM\n"); return 0; @@ -5585,7 +5585,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv) /* Try initialize */ image = (__le32 *)priv->ucode_init.v_addr; len = priv->ucode_init.len; - rc = iwl_verify_inst_sparse(priv, image, len); + rc = iwl3945_verify_inst_sparse(priv, image, len); if (rc == 0) { IWL_DEBUG_INFO("Initialize uCode is good in inst SRAM\n"); return 0; @@ -5594,7 +5594,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv) /* Try runtime/protocol */ image = (__le32 *)priv->ucode_code.v_addr; len = priv->ucode_code.len; - rc = iwl_verify_inst_sparse(priv, image, len); + rc = iwl3945_verify_inst_sparse(priv, image, len); if (rc == 0) { IWL_DEBUG_INFO("Runtime uCode is good in inst SRAM\n"); return 0; @@ -5606,14 +5606,14 @@ static int iwl_verify_ucode(struct iwl_priv *priv) * Selection of bootstrap image is arbitrary. */ image = (__le32 *)priv->ucode_boot.v_addr; len = priv->ucode_boot.len; - rc = iwl_verify_inst_full(priv, image, len); + rc = iwl3945_verify_inst_full(priv, image, len); return rc; } /* check contents of special bootstrap uCode SRAM */ -static int iwl_verify_bsm(struct iwl_priv *priv) +static int iwl3945_verify_bsm(struct iwl3945_priv *priv) { __le32 *image = priv->ucode_boot.v_addr; u32 len = priv->ucode_boot.len; @@ -5623,11 +5623,11 @@ static int iwl_verify_bsm(struct iwl_priv *priv) IWL_DEBUG_INFO("Begin verify bsm\n"); /* verify BSM SRAM contents */ - val = iwl_read_prph(priv, BSM_WR_DWCOUNT_REG); + val = iwl3945_read_prph(priv, BSM_WR_DWCOUNT_REG); for (reg = BSM_SRAM_LOWER_BOUND; reg < BSM_SRAM_LOWER_BOUND + len; reg += sizeof(u32), image ++) { - val = iwl_read_prph(priv, reg); + val = iwl3945_read_prph(priv, reg); if (val != le32_to_cpu(*image)) { IWL_ERROR("BSM uCode verification failed at " "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", @@ -5644,7 +5644,7 @@ static int iwl_verify_bsm(struct iwl_priv *priv) } /** - * iwl_load_bsm - Load bootstrap instructions + * iwl3945_load_bsm - Load bootstrap instructions * * BSM operation: * @@ -5675,7 +5675,7 @@ static int iwl_verify_bsm(struct iwl_priv *priv) * the runtime uCode instructions and the backup data cache into SRAM, * and re-launches the runtime uCode from where it left off. */ -static int iwl_load_bsm(struct iwl_priv *priv) +static int iwl3945_load_bsm(struct iwl3945_priv *priv) { __le32 *image = priv->ucode_boot.v_addr; u32 len = priv->ucode_boot.len; @@ -5696,7 +5696,7 @@ static int iwl_load_bsm(struct iwl_priv *priv) /* Tell bootstrap uCode where to find the "Initialize" uCode * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965. - * NOTE: iwl_initialize_alive_start() will replace these values, + * NOTE: iwl3945_initialize_alive_start() will replace these values, * after the "initialize" uCode has run, to point to * runtime/protocol instructions and backup data cache. */ pinst = priv->ucode_init.p_addr; @@ -5704,42 +5704,42 @@ static int iwl_load_bsm(struct iwl_priv *priv) inst_len = priv->ucode_init.len; data_len = priv->ucode_init_data.len; - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) return rc; - iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); - iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); + iwl3945_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + iwl3945_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + iwl3945_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); + iwl3945_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); /* Fill BSM memory with bootstrap instructions */ for (reg_offset = BSM_SRAM_LOWER_BOUND; reg_offset < BSM_SRAM_LOWER_BOUND + len; reg_offset += sizeof(u32), image++) - _iwl_write_prph(priv, reg_offset, + _iwl3945_write_prph(priv, reg_offset, le32_to_cpu(*image)); - rc = iwl_verify_bsm(priv); + rc = iwl3945_verify_bsm(priv); if (rc) { - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); return rc; } /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ - iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); - iwl_write_prph(priv, BSM_WR_MEM_DST_REG, + iwl3945_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); + iwl3945_write_prph(priv, BSM_WR_MEM_DST_REG, RTC_INST_LOWER_BOUND); - iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); + iwl3945_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); /* Load bootstrap code into instruction SRAM now, * to prepare to load "initialize" uCode */ - iwl_write_prph(priv, BSM_WR_CTRL_REG, + iwl3945_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); /* Wait for load of bootstrap uCode to finish */ for (i = 0; i < 100; i++) { - done = iwl_read_prph(priv, BSM_WR_CTRL_REG); + done = iwl3945_read_prph(priv, BSM_WR_CTRL_REG); if (!(done & BSM_WR_CTRL_REG_BIT_START)) break; udelay(10); @@ -5753,28 +5753,28 @@ static int iwl_load_bsm(struct iwl_priv *priv) /* Enable future boot loads whenever power management unit triggers it * (e.g. when powering back up after power-save shutdown) */ - iwl_write_prph(priv, BSM_WR_CTRL_REG, + iwl3945_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); return 0; } -static void iwl_nic_start(struct iwl_priv *priv) +static void iwl3945_nic_start(struct iwl3945_priv *priv) { /* Remove all resets to allow NIC to operate */ - iwl_write32(priv, CSR_RESET, 0); + iwl3945_write32(priv, CSR_RESET, 0); } /** - * iwl_read_ucode - Read uCode images from disk file. + * iwl3945_read_ucode - Read uCode images from disk file. * * Copy into buffers for card to fetch via bus-mastering */ -static int iwl_read_ucode(struct iwl_priv *priv) +static int iwl3945_read_ucode(struct iwl3945_priv *priv) { - struct iwl_ucode *ucode; + struct iwl3945_ucode *ucode; int rc = 0; const struct firmware *ucode_raw; /* firmware file name contains uCode/driver compatibility version */ @@ -5926,7 +5926,7 @@ static int iwl_read_ucode(struct iwl_priv *priv) priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); /* Runtime data (2nd block) - * NOTE: Copy into backup buffer will be done in iwl_up() */ + * NOTE: Copy into backup buffer will be done in iwl3945_up() */ src = &ucode->data[inst_size]; len = priv->ucode_data.len; IWL_DEBUG_INFO("Copying (but not loading) uCode data len %d\n", @@ -5966,7 +5966,7 @@ static int iwl_read_ucode(struct iwl_priv *priv) err_pci_alloc: IWL_ERROR("failed to allocate pci memory\n"); rc = -ENOMEM; - iwl_dealloc_ucode_pci(priv); + iwl3945_dealloc_ucode_pci(priv); err_release: release_firmware(ucode_raw); @@ -5977,7 +5977,7 @@ static int iwl_read_ucode(struct iwl_priv *priv) /** - * iwl_set_ucode_ptrs - Set uCode address location + * iwl3945_set_ucode_ptrs - Set uCode address location * * Tell initialization uCode where to find runtime uCode. * @@ -5985,7 +5985,7 @@ static int iwl_read_ucode(struct iwl_priv *priv) * We need to replace them to load runtime uCode inst and data, * and to save runtime data when powering down. */ -static int iwl_set_ucode_ptrs(struct iwl_priv *priv) +static int iwl3945_set_ucode_ptrs(struct iwl3945_priv *priv) { dma_addr_t pinst; dma_addr_t pdata; @@ -5997,24 +5997,24 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) pdata = priv->ucode_data_backup.p_addr; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } /* Tell bootstrap uCode where to find image to load */ - iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, + iwl3945_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + iwl3945_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + iwl3945_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, priv->ucode_data.len); /* Inst bytecount must be last to set up, bit 31 signals uCode * that all new ptr/size info is in place */ - iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, + iwl3945_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, priv->ucode_code.len | BSM_DRAM_INST_LOAD); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); @@ -6024,7 +6024,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) } /** - * iwl_init_alive_start - Called after REPLY_ALIVE notification received + * iwl3945_init_alive_start - Called after REPLY_ALIVE notification received * * Called after REPLY_ALIVE notification received from "initialize" uCode. * @@ -6034,7 +6034,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) * * Tell "initialize" uCode to go ahead and load the runtime uCode. */ -static void iwl_init_alive_start(struct iwl_priv *priv) +static void iwl3945_init_alive_start(struct iwl3945_priv *priv) { /* Check alive response for "valid" sign from uCode */ if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { @@ -6047,7 +6047,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv) /* Bootstrap uCode has loaded initialize uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "initialize" alive if code weren't properly loaded. */ - if (iwl_verify_ucode(priv)) { + if (iwl3945_verify_ucode(priv)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n"); @@ -6058,7 +6058,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv) * load and launch runtime uCode, which will send us another "Alive" * notification. */ IWL_DEBUG_INFO("Initialization Alive received.\n"); - if (iwl_set_ucode_ptrs(priv)) { + if (iwl3945_set_ucode_ptrs(priv)) { /* Runtime instruction load won't happen; * take it all the way back down so we can try again */ IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n"); @@ -6072,11 +6072,11 @@ static void iwl_init_alive_start(struct iwl_priv *priv) /** - * iwl_alive_start - called after REPLY_ALIVE notification received + * iwl3945_alive_start - called after REPLY_ALIVE notification received * from protocol/runtime uCode (initialization uCode's - * Alive gets handled by iwl_init_alive_start()). + * Alive gets handled by iwl3945_init_alive_start()). */ -static void iwl_alive_start(struct iwl_priv *priv) +static void iwl3945_alive_start(struct iwl3945_priv *priv) { int rc = 0; int thermal_spin = 0; @@ -6094,30 +6094,30 @@ static void iwl_alive_start(struct iwl_priv *priv) /* Initialize uCode has loaded Runtime uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "runtime" alive if code weren't properly loaded. */ - if (iwl_verify_ucode(priv)) { + if (iwl3945_verify_ucode(priv)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ IWL_DEBUG_INFO("Bad runtime uCode load.\n"); goto restart; } - iwl_clear_stations_table(priv); + iwl3945_clear_stations_table(priv); - rc = iwl_grab_nic_access(priv); + rc = iwl3945_grab_nic_access(priv); if (rc) { IWL_WARNING("Can not read rfkill status from adapter\n"); return; } - rfkill = iwl_read_prph(priv, APMG_RFKILL_REG); + rfkill = iwl3945_read_prph(priv, APMG_RFKILL_REG); IWL_DEBUG_INFO("RFKILL status: 0x%x\n", rfkill); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); if (rfkill & 0x1) { clear_bit(STATUS_RF_KILL_HW, &priv->status); /* if rfkill is not on, then wait for thermal * sensor in adapter to kick in */ - while (iwl_hw_get_temperature(priv) == 0) { + while (iwl3945_hw_get_temperature(priv) == 0) { thermal_spin++; udelay(10); } @@ -6134,28 +6134,28 @@ static void iwl_alive_start(struct iwl_priv *priv) /* Clear out the uCode error bit if it is set */ clear_bit(STATUS_FW_ERROR, &priv->status); - rc = iwl_init_channel_map(priv); + rc = iwl3945_init_channel_map(priv); if (rc) { IWL_ERROR("initializing regulatory failed: %d\n", rc); return; } - iwl_init_geos(priv); + iwl3945_init_geos(priv); - if (iwl_is_rfkill(priv)) + if (iwl3945_is_rfkill(priv)) return; if (!priv->mac80211_registered) { /* Unlock so any user space entry points can call back into * the driver without a deadlock... */ mutex_unlock(&priv->mutex); - iwl_rate_control_register(priv->hw); + iwl3945_rate_control_register(priv->hw); rc = ieee80211_register_hw(priv->hw); priv->hw->conf.beacon_int = 100; mutex_lock(&priv->mutex); if (rc) { - iwl_rate_control_unregister(priv->hw); + iwl3945_rate_control_unregister(priv->hw); IWL_ERROR("Failed to register network " "device (error %d)\n", rc); return; @@ -6163,33 +6163,33 @@ static void iwl_alive_start(struct iwl_priv *priv) priv->mac80211_registered = 1; - iwl_reset_channel_flag(priv); + iwl3945_reset_channel_flag(priv); } else ieee80211_start_queues(priv->hw); priv->active_rate = priv->rates_mask; priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; - iwl_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); + iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); - if (iwl_is_associated(priv)) { - struct iwl_rxon_cmd *active_rxon = - (struct iwl_rxon_cmd *)(&priv->active_rxon); + if (iwl3945_is_associated(priv)) { + struct iwl3945_rxon_cmd *active_rxon = + (struct iwl3945_rxon_cmd *)(&priv->active_rxon); memcpy(&priv->staging_rxon, &priv->active_rxon, sizeof(priv->staging_rxon)); active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; } else { /* Initialize our rx_config data */ - iwl_connection_init_rx_config(priv); + iwl3945_connection_init_rx_config(priv); memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); } /* Configure BT coexistence */ - iwl_send_bt_config(priv); + iwl3945_send_bt_config(priv); /* Configure the adapter for unassociated operation */ - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); /* At this point, the NIC is initialized and operational */ priv->notif_missed_beacons = 0; @@ -6200,7 +6200,7 @@ static void iwl_alive_start(struct iwl_priv *priv) IWL_DEBUG_INFO("ALIVE processing complete.\n"); if (priv->error_recovering) - iwl_error_recovery(priv); + iwl3945_error_recovery(priv); return; @@ -6208,9 +6208,9 @@ static void iwl_alive_start(struct iwl_priv *priv) queue_work(priv->workqueue, &priv->restart); } -static void iwl_cancel_deferred_work(struct iwl_priv *priv); +static void iwl3945_cancel_deferred_work(struct iwl3945_priv *priv); -static void __iwl_down(struct iwl_priv *priv) +static void __iwl3945_down(struct iwl3945_priv *priv) { unsigned long flags; int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status); @@ -6223,7 +6223,7 @@ static void __iwl_down(struct iwl_priv *priv) if (!exit_pending) set_bit(STATUS_EXIT_PENDING, &priv->status); - iwl_clear_stations_table(priv); + iwl3945_clear_stations_table(priv); /* Unblock any waiting calls */ wake_up_interruptible_all(&priv->wait_command_queue); @@ -6234,17 +6234,17 @@ static void __iwl_down(struct iwl_priv *priv) clear_bit(STATUS_EXIT_PENDING, &priv->status); /* stop and reset the on-board processor */ - iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); + iwl3945_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); /* tell the device to stop sending interrupts */ - iwl_disable_interrupts(priv); + iwl3945_disable_interrupts(priv); if (priv->mac80211_registered) ieee80211_stop_queues(priv->hw); - /* If we have not previously called iwl_init() then + /* If we have not previously called iwl3945_init() then * clear all bits but the RF Kill and SUSPEND bits and return */ - if (!iwl_is_init(priv)) { + if (!iwl3945_is_init(priv)) { priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << STATUS_RF_KILL_HW | test_bit(STATUS_RF_KILL_SW, &priv->status) << @@ -6266,49 +6266,49 @@ static void __iwl_down(struct iwl_priv *priv) STATUS_FW_ERROR; spin_lock_irqsave(&priv->lock, flags); - iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); + iwl3945_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); spin_unlock_irqrestore(&priv->lock, flags); - iwl_hw_txq_ctx_stop(priv); - iwl_hw_rxq_stop(priv); + iwl3945_hw_txq_ctx_stop(priv); + iwl3945_hw_rxq_stop(priv); spin_lock_irqsave(&priv->lock, flags); - if (!iwl_grab_nic_access(priv)) { - iwl_write_prph(priv, APMG_CLK_DIS_REG, + if (!iwl3945_grab_nic_access(priv)) { + iwl3945_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); } spin_unlock_irqrestore(&priv->lock, flags); udelay(5); - iwl_hw_nic_stop_master(priv); - iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); - iwl_hw_nic_reset(priv); + iwl3945_hw_nic_stop_master(priv); + iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); + iwl3945_hw_nic_reset(priv); exit: - memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); + memset(&priv->card_alive, 0, sizeof(struct iwl3945_alive_resp)); if (priv->ibss_beacon) dev_kfree_skb(priv->ibss_beacon); priv->ibss_beacon = NULL; /* clear out any free frames */ - iwl_clear_free_frames(priv); + iwl3945_clear_free_frames(priv); } -static void iwl_down(struct iwl_priv *priv) +static void iwl3945_down(struct iwl3945_priv *priv) { mutex_lock(&priv->mutex); - __iwl_down(priv); + __iwl3945_down(priv); mutex_unlock(&priv->mutex); - iwl_cancel_deferred_work(priv); + iwl3945_cancel_deferred_work(priv); } #define MAX_HW_RESTARTS 5 -static int __iwl_up(struct iwl_priv *priv) +static int __iwl3945_up(struct iwl3945_priv *priv) { DECLARE_MAC_BUF(mac); int rc, i; @@ -6329,26 +6329,26 @@ static int __iwl_up(struct iwl_priv *priv) return -EIO; } - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); + iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF); - rc = iwl_hw_nic_init(priv); + rc = iwl3945_hw_nic_init(priv); if (rc) { IWL_ERROR("Unable to int nic\n"); return rc; } /* make sure rfkill handshake bits are cleared */ - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); /* clear (again), then enable host interrupts */ - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl_enable_interrupts(priv); + iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF); + iwl3945_enable_interrupts(priv); /* really make sure rfkill handshake bits are cleared */ - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); /* Copy original ucode data image from disk into backup cache. * This will be used to initialize the on-board processor's @@ -6358,12 +6358,12 @@ static int __iwl_up(struct iwl_priv *priv) for (i = 0; i < MAX_HW_RESTARTS; i++) { - iwl_clear_stations_table(priv); + iwl3945_clear_stations_table(priv); /* load bootstrap state machine, * load bootstrap program into processor's memory, * prepare to load the "initialize" uCode */ - rc = iwl_load_bsm(priv); + rc = iwl3945_load_bsm(priv); if (rc) { IWL_ERROR("Unable to set up bootstrap uCode: %d\n", rc); @@ -6371,7 +6371,7 @@ static int __iwl_up(struct iwl_priv *priv) } /* start card; "initialize" will load runtime ucode */ - iwl_nic_start(priv); + iwl3945_nic_start(priv); /* MAC Address location in EEPROM same for 3945/4965 */ get_eeprom_mac(priv, priv->mac_addr); @@ -6386,7 +6386,7 @@ static int __iwl_up(struct iwl_priv *priv) } set_bit(STATUS_EXIT_PENDING, &priv->status); - __iwl_down(priv); + __iwl3945_down(priv); /* tried to restart and config the device for as long as our * patience could withstand */ @@ -6401,35 +6401,35 @@ static int __iwl_up(struct iwl_priv *priv) * *****************************************************************************/ -static void iwl_bg_init_alive_start(struct work_struct *data) +static void iwl3945_bg_init_alive_start(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, init_alive_start.work); + struct iwl3945_priv *priv = + container_of(data, struct iwl3945_priv, init_alive_start.work); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - iwl_init_alive_start(priv); + iwl3945_init_alive_start(priv); mutex_unlock(&priv->mutex); } -static void iwl_bg_alive_start(struct work_struct *data) +static void iwl3945_bg_alive_start(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, alive_start.work); + struct iwl3945_priv *priv = + container_of(data, struct iwl3945_priv, alive_start.work); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - iwl_alive_start(priv); + iwl3945_alive_start(priv); mutex_unlock(&priv->mutex); } -static void iwl_bg_rf_kill(struct work_struct *work) +static void iwl3945_bg_rf_kill(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill); + struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv, rf_kill); wake_up_interruptible(&priv->wait_command_queue); @@ -6438,7 +6438,7 @@ static void iwl_bg_rf_kill(struct work_struct *work) mutex_lock(&priv->mutex); - if (!iwl_is_rfkill(priv)) { + if (!iwl3945_is_rfkill(priv)) { IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL, "HW and/or SW RF Kill no longer active, restarting " "device\n"); @@ -6459,10 +6459,10 @@ static void iwl_bg_rf_kill(struct work_struct *work) #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) -static void iwl_bg_scan_check(struct work_struct *data) +static void iwl3945_bg_scan_check(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, scan_check.work); + struct iwl3945_priv *priv = + container_of(data, struct iwl3945_priv, scan_check.work); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; @@ -6475,22 +6475,22 @@ static void iwl_bg_scan_check(struct work_struct *data) jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) - iwl_send_scan_abort(priv); + iwl3945_send_scan_abort(priv); } mutex_unlock(&priv->mutex); } -static void iwl_bg_request_scan(struct work_struct *data) +static void iwl3945_bg_request_scan(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, request_scan); - struct iwl_host_cmd cmd = { + struct iwl3945_priv *priv = + container_of(data, struct iwl3945_priv, request_scan); + struct iwl3945_host_cmd cmd = { .id = REPLY_SCAN_CMD, - .len = sizeof(struct iwl_scan_cmd), + .len = sizeof(struct iwl3945_scan_cmd), .meta.flags = CMD_SIZE_HUGE, }; int rc = 0; - struct iwl_scan_cmd *scan; + struct iwl3945_scan_cmd *scan; struct ieee80211_conf *conf = NULL; u8 direct_mask; int phymode; @@ -6499,7 +6499,7 @@ static void iwl_bg_request_scan(struct work_struct *data) mutex_lock(&priv->mutex); - if (!iwl_is_ready(priv)) { + if (!iwl3945_is_ready(priv)) { IWL_WARNING("request scan called when driver not ready.\n"); goto done; } @@ -6528,7 +6528,7 @@ static void iwl_bg_request_scan(struct work_struct *data) goto done; } - if (iwl_is_rfkill(priv)) { + if (iwl3945_is_rfkill(priv)) { IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n"); goto done; } @@ -6544,7 +6544,7 @@ static void iwl_bg_request_scan(struct work_struct *data) } if (!priv->scan) { - priv->scan = kmalloc(sizeof(struct iwl_scan_cmd) + + priv->scan = kmalloc(sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE, GFP_KERNEL); if (!priv->scan) { rc = -ENOMEM; @@ -6552,12 +6552,12 @@ static void iwl_bg_request_scan(struct work_struct *data) } } scan = priv->scan; - memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE); + memset(scan, 0, sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE); scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; scan->quiet_time = IWL_ACTIVE_QUIET_TIME; - if (iwl_is_associated(priv)) { + if (iwl3945_is_associated(priv)) { u16 interval = 0; u32 extra; u32 suspend_time = 100; @@ -6594,14 +6594,14 @@ static void iwl_bg_request_scan(struct work_struct *data) if (priv->one_direct_scan) { IWL_DEBUG_SCAN ("Kicking off one direct scan for '%s'\n", - iwl_escape_essid(priv->direct_ssid, + iwl3945_escape_essid(priv->direct_ssid, priv->direct_ssid_len)); scan->direct_scan[0].id = WLAN_EID_SSID; scan->direct_scan[0].len = priv->direct_ssid_len; memcpy(scan->direct_scan[0].ssid, priv->direct_ssid, priv->direct_ssid_len); direct_mask = 1; - } else if (!iwl_is_associated(priv) && priv->essid_len) { + } else if (!iwl3945_is_associated(priv) && priv->essid_len) { scan->direct_scan[0].id = WLAN_EID_SSID; scan->direct_scan[0].len = priv->essid_len; memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); @@ -6612,7 +6612,7 @@ static void iwl_bg_request_scan(struct work_struct *data) /* We don't build a direct scan probe request; the uCode will do * that based on the direct_mask added to each channel entry */ scan->tx_cmd.len = cpu_to_le16( - iwl_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, + iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, IWL_MAX_SCAN_SIZE - sizeof(scan), 0)); scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; @@ -6648,23 +6648,23 @@ static void iwl_bg_request_scan(struct work_struct *data) if (direct_mask) IWL_DEBUG_SCAN ("Initiating direct scan for %s.\n", - iwl_escape_essid(priv->essid, priv->essid_len)); + iwl3945_escape_essid(priv->essid, priv->essid_len)); else IWL_DEBUG_SCAN("Initiating indirect scan.\n"); scan->channel_count = - iwl_get_channels_for_scan( + iwl3945_get_channels_for_scan( priv, phymode, 1, /* active */ direct_mask, (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); cmd.len += le16_to_cpu(scan->tx_cmd.len) + - scan->channel_count * sizeof(struct iwl_scan_channel); + scan->channel_count * sizeof(struct iwl3945_scan_channel); cmd.data = scan; scan->len = cpu_to_le16(cmd.len); set_bit(STATUS_SCAN_HW, &priv->status); - rc = iwl_send_cmd_sync(priv, &cmd); + rc = iwl3945_send_cmd_sync(priv, &cmd); if (rc) goto done; @@ -6680,45 +6680,45 @@ static void iwl_bg_request_scan(struct work_struct *data) mutex_unlock(&priv->mutex); } -static void iwl_bg_up(struct work_struct *data) +static void iwl3945_bg_up(struct work_struct *data) { - struct iwl_priv *priv = container_of(data, struct iwl_priv, up); + struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, up); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - __iwl_up(priv); + __iwl3945_up(priv); mutex_unlock(&priv->mutex); } -static void iwl_bg_restart(struct work_struct *data) +static void iwl3945_bg_restart(struct work_struct *data) { - struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); + struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, restart); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; - iwl_down(priv); + iwl3945_down(priv); queue_work(priv->workqueue, &priv->up); } -static void iwl_bg_rx_replenish(struct work_struct *data) +static void iwl3945_bg_rx_replenish(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, rx_replenish); + struct iwl3945_priv *priv = + container_of(data, struct iwl3945_priv, rx_replenish); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - iwl_rx_replenish(priv); + iwl3945_rx_replenish(priv); mutex_unlock(&priv->mutex); } -static void iwl_bg_post_associate(struct work_struct *data) +static void iwl3945_bg_post_associate(struct work_struct *data) { - struct iwl_priv *priv = container_of(data, struct iwl_priv, + struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, post_associate.work); int rc = 0; @@ -6744,16 +6744,16 @@ static void iwl_bg_post_associate(struct work_struct *data) mutex_unlock(&priv->mutex); return; } - iwl_scan_cancel_timeout(priv, 200); + iwl3945_scan_cancel_timeout(priv, 200); conf = ieee80211_get_hw_conf(priv->hw); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); - memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); - iwl_setup_rxon_timing(priv); - rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, + memset(&priv->rxon_timing, 0, sizeof(struct iwl3945_rxon_time_cmd)); + iwl3945_setup_rxon_timing(priv); + rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON_TIMING, sizeof(priv->rxon_timing), &priv->rxon_timing); if (rc) IWL_WARNING("REPLY_RXON_TIMING failed - " @@ -6782,26 +6782,26 @@ static void iwl_bg_post_associate(struct work_struct *data) } - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); switch (priv->iw_mode) { case IEEE80211_IF_TYPE_STA: - iwl_rate_scale_init(priv->hw, IWL_AP_ID); + iwl3945_rate_scale_init(priv->hw, IWL_AP_ID); break; case IEEE80211_IF_TYPE_IBSS: /* clear out the station table */ - iwl_clear_stations_table(priv); + iwl3945_clear_stations_table(priv); - iwl_add_station(priv, BROADCAST_ADDR, 0, 0); - iwl_add_station(priv, priv->bssid, 0, 0); + iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0); + iwl3945_add_station(priv, priv->bssid, 0, 0); iwl3945_sync_sta(priv, IWL_STA_ID, (priv->phymode == MODE_IEEE80211A)? IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, CMD_ASYNC); - iwl_rate_scale_init(priv->hw, IWL_STA_ID); - iwl_send_beacon_cmd(priv); + iwl3945_rate_scale_init(priv->hw, IWL_STA_ID); + iwl3945_send_beacon_cmd(priv); break; @@ -6811,33 +6811,33 @@ static void iwl_bg_post_associate(struct work_struct *data) break; } - iwl_sequence_reset(priv); + iwl3945_sequence_reset(priv); #ifdef CONFIG_IWL3945_QOS - iwl_activate_qos(priv, 0); + iwl3945_activate_qos(priv, 0); #endif /* CONFIG_IWL3945_QOS */ mutex_unlock(&priv->mutex); } -static void iwl_bg_abort_scan(struct work_struct *work) +static void iwl3945_bg_abort_scan(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); + struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv, abort_scan); - if (!iwl_is_ready(priv)) + if (!iwl3945_is_ready(priv)) return; mutex_lock(&priv->mutex); set_bit(STATUS_SCAN_ABORTING, &priv->status); - iwl_send_scan_abort(priv); + iwl3945_send_scan_abort(priv); mutex_unlock(&priv->mutex); } -static void iwl_bg_scan_completed(struct work_struct *work) +static void iwl3945_bg_scan_completed(struct work_struct *work) { - struct iwl_priv *priv = - container_of(work, struct iwl_priv, scan_completed); + struct iwl3945_priv *priv = + container_of(work, struct iwl3945_priv, scan_completed); IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n"); @@ -6849,7 +6849,7 @@ static void iwl_bg_scan_completed(struct work_struct *work) /* Since setting the TXPOWER may have been deferred while * performing the scan, fire one off */ mutex_lock(&priv->mutex); - iwl_hw_reg_send_txpower(priv); + iwl3945_hw_reg_send_txpower(priv); mutex_unlock(&priv->mutex); } @@ -6859,9 +6859,9 @@ static void iwl_bg_scan_completed(struct work_struct *work) * *****************************************************************************/ -static int iwl_mac_start(struct ieee80211_hw *hw) +static int iwl3945_mac_start(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter\n"); @@ -6870,7 +6870,7 @@ static int iwl_mac_start(struct ieee80211_hw *hw) priv->is_open = 1; - if (!iwl_is_rfkill(priv)) + if (!iwl3945_is_rfkill(priv)) ieee80211_start_queues(priv->hw); mutex_unlock(&priv->mutex); @@ -6878,9 +6878,9 @@ static int iwl_mac_start(struct ieee80211_hw *hw) return 0; } -static void iwl_mac_stop(struct ieee80211_hw *hw) +static void iwl3945_mac_stop(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter\n"); @@ -6890,19 +6890,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw) * RXON_FILTER_ASSOC_MSK BIT */ priv->is_open = 0; - iwl_scan_cancel_timeout(priv, 100); + iwl3945_scan_cancel_timeout(priv, 100); cancel_delayed_work(&priv->post_associate); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); mutex_unlock(&priv->mutex); IWL_DEBUG_MAC80211("leave\n"); } -static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, +static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, struct ieee80211_tx_control *ctl) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter\n"); @@ -6914,17 +6914,17 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, ctl->tx_rate); - if (iwl_tx_skb(priv, skb, ctl)) + if (iwl3945_tx_skb(priv, skb, ctl)) dev_kfree_skb_any(skb); IWL_DEBUG_MAC80211("leave\n"); return 0; } -static int iwl_mac_add_interface(struct ieee80211_hw *hw, +static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; unsigned long flags; DECLARE_MAC_BUF(mac); @@ -6947,7 +6947,7 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); } - iwl_set_mode(priv, conf->type); + iwl3945_set_mode(priv, conf->type); IWL_DEBUG_MAC80211("leave\n"); mutex_unlock(&priv->mutex); @@ -6956,22 +6956,22 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, } /** - * iwl_mac_config - mac80211 config callback + * iwl3945_mac_config - mac80211 config callback * * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to * be set inappropriately and the driver currently sets the hardware up to * use it whenever needed. */ -static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) +static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) { - struct iwl_priv *priv = hw->priv; - const struct iwl_channel_info *ch_info; + struct iwl3945_priv *priv = hw->priv; + const struct iwl3945_channel_info *ch_info; unsigned long flags; mutex_lock(&priv->mutex); IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); - if (!iwl_is_ready(priv)) { + if (!iwl3945_is_ready(priv)) { IWL_DEBUG_MAC80211("leave - not ready\n"); mutex_unlock(&priv->mutex); return -EIO; @@ -6979,7 +6979,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only * what is exposed through include/ declarations */ - if (unlikely(!iwl_param_disable_hw_scan && + if (unlikely(!iwl3945_param_disable_hw_scan && test_bit(STATUS_SCANNING, &priv->status))) { IWL_DEBUG_MAC80211("leave - scanning\n"); mutex_unlock(&priv->mutex); @@ -6988,7 +6988,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) spin_lock_irqsave(&priv->lock, flags); - ch_info = iwl_get_channel_info(priv, conf->phymode, conf->channel); + ch_info = iwl3945_get_channel_info(priv, conf->phymode, conf->channel); if (!is_channel_valid(ch_info)) { IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", conf->channel, conf->phymode); @@ -6998,26 +6998,26 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) return -EINVAL; } - iwl_set_rxon_channel(priv, conf->phymode, conf->channel); + iwl3945_set_rxon_channel(priv, conf->phymode, conf->channel); - iwl_set_flags_for_phymode(priv, conf->phymode); + iwl3945_set_flags_for_phymode(priv, conf->phymode); /* The list of supported rates and rate mask can be different * for each phymode; since the phymode may have changed, reset * the rate mask to what mac80211 lists */ - iwl_set_rate(priv); + iwl3945_set_rate(priv); spin_unlock_irqrestore(&priv->lock, flags); #ifdef IEEE80211_CONF_CHANNEL_SWITCH if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { - iwl_hw_channel_switch(priv, conf->channel); + iwl3945_hw_channel_switch(priv, conf->channel); mutex_unlock(&priv->mutex); return 0; } #endif - iwl_radio_kill_sw(priv, !conf->radio_enabled); + iwl3945_radio_kill_sw(priv, !conf->radio_enabled); if (!conf->radio_enabled) { IWL_DEBUG_MAC80211("leave - radio disabled\n"); @@ -7025,17 +7025,17 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) return 0; } - if (iwl_is_rfkill(priv)) { + if (iwl3945_is_rfkill(priv)) { IWL_DEBUG_MAC80211("leave - RF kill\n"); mutex_unlock(&priv->mutex); return -EIO; } - iwl_set_rate(priv); + iwl3945_set_rate(priv); if (memcmp(&priv->active_rxon, &priv->staging_rxon, sizeof(priv->staging_rxon))) - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); else IWL_DEBUG_INFO("No re-sending same RXON configuration.\n"); @@ -7046,7 +7046,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) return 0; } -static void iwl_config_ap(struct iwl_priv *priv) +static void iwl3945_config_ap(struct iwl3945_priv *priv) { int rc = 0; @@ -7058,12 +7058,12 @@ static void iwl_config_ap(struct iwl_priv *priv) /* RXON - unassoc (to set timing command) */ priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); /* RXON Timing */ - memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); - iwl_setup_rxon_timing(priv); - rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, + memset(&priv->rxon_timing, 0, sizeof(struct iwl3945_rxon_time_cmd)); + iwl3945_setup_rxon_timing(priv); + rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON_TIMING, sizeof(priv->rxon_timing), &priv->rxon_timing); if (rc) IWL_WARNING("REPLY_RXON_TIMING failed - " @@ -7093,20 +7093,20 @@ static void iwl_config_ap(struct iwl_priv *priv) } /* restore RXON assoc */ priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); - iwl_add_station(priv, BROADCAST_ADDR, 0, 0); + iwl3945_commit_rxon(priv); + iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0); } - iwl_send_beacon_cmd(priv); + iwl3945_send_beacon_cmd(priv); /* FIXME - we need to add code here to detect a totally new * configuration, reset the AP, unassoc, rxon timing, assoc, * clear sta table, add BCAST sta... */ } -static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, +static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, struct ieee80211_if_conf *conf) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; DECLARE_MAC_BUF(mac); unsigned long flags; int rc; @@ -7165,7 +7165,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, !is_multicast_ether_addr(conf->bssid)) { /* If there is currently a HW scan going on in the background * then we need to cancel it else the RXON below will fail. */ - if (iwl_scan_cancel_timeout(priv, 100)) { + if (iwl3945_scan_cancel_timeout(priv, 100)) { IWL_WARNING("Aborted scan still in progress " "after 100ms\n"); IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); @@ -7181,18 +7181,18 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, memcpy(priv->bssid, conf->bssid, ETH_ALEN); if (priv->iw_mode == IEEE80211_IF_TYPE_AP) - iwl_config_ap(priv); + iwl3945_config_ap(priv); else { - rc = iwl_commit_rxon(priv); + rc = iwl3945_commit_rxon(priv); if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) - iwl_add_station(priv, + iwl3945_add_station(priv, priv->active_rxon.bssid_addr, 1, 0); } } else { - iwl_scan_cancel_timeout(priv, 100); + iwl3945_scan_cancel_timeout(priv, 100); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); } spin_lock_irqsave(&priv->lock, flags); @@ -7210,31 +7210,31 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, return 0; } -static void iwl_configure_filter(struct ieee80211_hw *hw, +static void iwl3945_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, int mc_count, struct dev_addr_list *mc_list) { /* * XXX: dummy - * see also iwl_connection_init_rx_config + * see also iwl3945_connection_init_rx_config */ *total_flags = 0; } -static void iwl_mac_remove_interface(struct ieee80211_hw *hw, +static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter\n"); mutex_lock(&priv->mutex); - iwl_scan_cancel_timeout(priv, 100); + iwl3945_scan_cancel_timeout(priv, 100); cancel_delayed_work(&priv->post_associate); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); if (priv->interface_id == conf->if_id) { priv->interface_id = 0; @@ -7249,18 +7249,18 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw, } #define IWL_DELAY_NEXT_SCAN (HZ*2) -static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) +static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) { int rc = 0; unsigned long flags; - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter\n"); mutex_lock(&priv->mutex); spin_lock_irqsave(&priv->lock, flags); - if (!iwl_is_ready_rf(priv)) { + if (!iwl3945_is_ready_rf(priv)) { rc = -EIO; IWL_DEBUG_MAC80211("leave - not ready or exit pending\n"); goto out_unlock; @@ -7282,7 +7282,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) if (len) { IWL_DEBUG_SCAN("direct scan for " "%s [%d]\n ", - iwl_escape_essid(ssid, len), (int)len); + iwl3945_escape_essid(ssid, len), (int)len); priv->one_direct_scan = 1; priv->direct_ssid_len = (u8) @@ -7291,7 +7291,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) } else priv->one_direct_scan = 0; - rc = iwl_scan_initiate(priv); + rc = iwl3945_scan_initiate(priv); IWL_DEBUG_MAC80211("leave\n"); @@ -7302,17 +7302,17 @@ out_unlock: return rc; } -static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, +static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, const u8 *local_addr, const u8 *addr, struct ieee80211_key_conf *key) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; int rc = 0; u8 sta_id; IWL_DEBUG_MAC80211("enter\n"); - if (!iwl_param_hwcrypto) { + if (!iwl3945_param_hwcrypto) { IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n"); return -EOPNOTSUPP; } @@ -7321,7 +7321,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, /* only support pairwise keys */ return -EOPNOTSUPP; - sta_id = iwl_hw_find_station(priv, addr); + sta_id = iwl3945_hw_find_station(priv, addr); if (sta_id == IWL_INVALID_STATION) { DECLARE_MAC_BUF(mac); @@ -7332,24 +7332,24 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, mutex_lock(&priv->mutex); - iwl_scan_cancel_timeout(priv, 100); + iwl3945_scan_cancel_timeout(priv, 100); switch (cmd) { case SET_KEY: - rc = iwl_update_sta_key_info(priv, key, sta_id); + rc = iwl3945_update_sta_key_info(priv, key, sta_id); if (!rc) { - iwl_set_rxon_hwcrypto(priv, 1); - iwl_commit_rxon(priv); + iwl3945_set_rxon_hwcrypto(priv, 1); + iwl3945_commit_rxon(priv); key->hw_key_idx = sta_id; IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n"); key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; } break; case DISABLE_KEY: - rc = iwl_clear_sta_key_info(priv, sta_id); + rc = iwl3945_clear_sta_key_info(priv, sta_id); if (!rc) { - iwl_set_rxon_hwcrypto(priv, 0); - iwl_commit_rxon(priv); + iwl3945_set_rxon_hwcrypto(priv, 0); + iwl3945_commit_rxon(priv); IWL_DEBUG_MAC80211("disable hwcrypto key\n"); } break; @@ -7363,10 +7363,10 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, return rc; } -static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, +static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; #ifdef CONFIG_IWL3945_QOS unsigned long flags; int q; @@ -7374,7 +7374,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, IWL_DEBUG_MAC80211("enter\n"); - if (!iwl_is_ready_rf(priv)) { + if (!iwl3945_is_ready_rf(priv)) { IWL_DEBUG_MAC80211("leave - RF not ready\n"); return -EIO; } @@ -7407,9 +7407,9 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, mutex_lock(&priv->mutex); if (priv->iw_mode == IEEE80211_IF_TYPE_AP) - iwl_activate_qos(priv, 1); - else if (priv->assoc_id && iwl_is_associated(priv)) - iwl_activate_qos(priv, 0); + iwl3945_activate_qos(priv, 1); + else if (priv->assoc_id && iwl3945_is_associated(priv)) + iwl3945_activate_qos(priv, 0); mutex_unlock(&priv->mutex); @@ -7419,18 +7419,18 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, return 0; } -static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, +static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw, struct ieee80211_tx_queue_stats *stats) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; int i, avail; - struct iwl_tx_queue *txq; - struct iwl_queue *q; + struct iwl3945_tx_queue *txq; + struct iwl3945_queue *q; unsigned long flags; IWL_DEBUG_MAC80211("enter\n"); - if (!iwl_is_ready_rf(priv)) { + if (!iwl3945_is_ready_rf(priv)) { IWL_DEBUG_MAC80211("leave - RF not ready\n"); return -EIO; } @@ -7440,7 +7440,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, for (i = 0; i < AC_NUM; i++) { txq = &priv->txq[i]; q = &txq->q; - avail = iwl_queue_space(q); + avail = iwl3945_queue_space(q); stats->data[i].len = q->n_window - avail; stats->data[i].limit = q->n_window - q->high_mark; @@ -7454,7 +7454,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, return 0; } -static int iwl_mac_get_stats(struct ieee80211_hw *hw, +static int iwl3945_mac_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats) { IWL_DEBUG_MAC80211("enter\n"); @@ -7463,7 +7463,7 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw, return 0; } -static u64 iwl_mac_get_tsf(struct ieee80211_hw *hw) +static u64 iwl3945_mac_get_tsf(struct ieee80211_hw *hw) { IWL_DEBUG_MAC80211("enter\n"); IWL_DEBUG_MAC80211("leave\n"); @@ -7471,16 +7471,16 @@ static u64 iwl_mac_get_tsf(struct ieee80211_hw *hw) return 0; } -static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) +static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; unsigned long flags; mutex_lock(&priv->mutex); IWL_DEBUG_MAC80211("enter\n"); #ifdef CONFIG_IWL3945_QOS - iwl_reset_qos(priv); + iwl3945_reset_qos(priv); #endif cancel_delayed_work(&priv->post_associate); @@ -7507,9 +7507,9 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) * clear RXON_FILTER_ASSOC_MSK bit */ if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { - iwl_scan_cancel_timeout(priv, 100); + iwl3945_scan_cancel_timeout(priv, 100); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); } /* Per mac80211.h: This is only used in IBSS mode... */ @@ -7520,7 +7520,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) return; } - if (!iwl_is_ready_rf(priv)) { + if (!iwl3945_is_ready_rf(priv)) { IWL_DEBUG_MAC80211("leave - not ready\n"); mutex_unlock(&priv->mutex); return; @@ -7528,7 +7528,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) priv->only_active_channel = 0; - iwl_set_rate(priv); + iwl3945_set_rate(priv); mutex_unlock(&priv->mutex); @@ -7536,16 +7536,16 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) } -static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, +static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, struct ieee80211_tx_control *control) { - struct iwl_priv *priv = hw->priv; + struct iwl3945_priv *priv = hw->priv; unsigned long flags; mutex_lock(&priv->mutex); IWL_DEBUG_MAC80211("enter\n"); - if (!iwl_is_ready_rf(priv)) { + if (!iwl3945_is_ready_rf(priv)) { IWL_DEBUG_MAC80211("leave - RF not ready\n"); mutex_unlock(&priv->mutex); return -EIO; @@ -7570,7 +7570,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, spin_unlock_irqrestore(&priv->lock, flags); #ifdef CONFIG_IWL3945_QOS - iwl_reset_qos(priv); + iwl3945_reset_qos(priv); #endif queue_work(priv->workqueue, &priv->post_associate.work); @@ -7598,7 +7598,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, static ssize_t show_debug_level(struct device_driver *d, char *buf) { - return sprintf(buf, "0x%08X\n", iwl_debug_level); + return sprintf(buf, "0x%08X\n", iwl3945_debug_level); } static ssize_t store_debug_level(struct device_driver *d, const char *buf, size_t count) @@ -7611,7 +7611,7 @@ static ssize_t store_debug_level(struct device_driver *d, printk(KERN_INFO DRV_NAME ": %s is not in hex or decimal form.\n", buf); else - iwl_debug_level = val; + iwl3945_debug_level = val; return strnlen(buf, count); } @@ -7630,7 +7630,7 @@ static ssize_t show_rf_kill(struct device *d, * 2 - HW based RF kill active * 3 - Both HW and SW based RF kill active */ - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) | (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0); @@ -7641,10 +7641,10 @@ static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; mutex_lock(&priv->mutex); - iwl_radio_kill_sw(priv, buf[0] == '1'); + iwl3945_radio_kill_sw(priv, buf[0] == '1'); mutex_unlock(&priv->mutex); return count; @@ -7655,12 +7655,12 @@ static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); static ssize_t show_temperature(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; - if (!iwl_is_alive(priv)) + if (!iwl3945_is_alive(priv)) return -EAGAIN; - return sprintf(buf, "%d\n", iwl_hw_get_temperature(priv)); + return sprintf(buf, "%d\n", iwl3945_hw_get_temperature(priv)); } static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); @@ -7669,15 +7669,15 @@ static ssize_t show_rs_window(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = d->driver_data; - return iwl_fill_rs_info(priv->hw, buf, IWL_AP_ID); + struct iwl3945_priv *priv = d->driver_data; + return iwl3945_fill_rs_info(priv->hw, buf, IWL_AP_ID); } static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); static ssize_t show_tx_power(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; return sprintf(buf, "%d\n", priv->user_txpower_limit); } @@ -7685,7 +7685,7 @@ static ssize_t store_tx_power(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; char *p = (char *)buf; u32 val; @@ -7694,7 +7694,7 @@ static ssize_t store_tx_power(struct device *d, printk(KERN_INFO DRV_NAME ": %s is not in decimal form.\n", buf); else - iwl_hw_reg_set_txpower(priv, val); + iwl3945_hw_reg_set_txpower(priv, val); return count; } @@ -7704,7 +7704,7 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power); static ssize_t show_flags(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; return sprintf(buf, "0x%04X\n", priv->active_rxon.flags); } @@ -7713,19 +7713,19 @@ static ssize_t store_flags(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; u32 flags = simple_strtoul(buf, NULL, 0); mutex_lock(&priv->mutex); if (le32_to_cpu(priv->staging_rxon.flags) != flags) { /* Cancel any currently running scans... */ - if (iwl_scan_cancel_timeout(priv, 100)) + if (iwl3945_scan_cancel_timeout(priv, 100)) IWL_WARNING("Could not cancel scan.\n"); else { IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", flags); priv->staging_rxon.flags = cpu_to_le32(flags); - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); } } mutex_unlock(&priv->mutex); @@ -7738,7 +7738,7 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, show_flags, store_flags); static ssize_t show_filter_flags(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; return sprintf(buf, "0x%04X\n", le32_to_cpu(priv->active_rxon.filter_flags)); @@ -7748,20 +7748,20 @@ static ssize_t store_filter_flags(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; u32 filter_flags = simple_strtoul(buf, NULL, 0); mutex_lock(&priv->mutex); if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { /* Cancel any currently running scans... */ - if (iwl_scan_cancel_timeout(priv, 100)) + if (iwl3945_scan_cancel_timeout(priv, 100)) IWL_WARNING("Could not cancel scan.\n"); else { IWL_DEBUG_INFO("Committing rxon.filter_flags = " "0x%04X\n", filter_flags); priv->staging_rxon.filter_flags = cpu_to_le32(filter_flags); - iwl_commit_rxon(priv); + iwl3945_commit_rxon(priv); } } mutex_unlock(&priv->mutex); @@ -7775,20 +7775,20 @@ static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, static ssize_t show_tune(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; return sprintf(buf, "0x%04X\n", (priv->phymode << 8) | le16_to_cpu(priv->active_rxon.channel)); } -static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode); +static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv, u8 phymode); static ssize_t store_tune(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; char *p = (char *)buf; u16 tune = simple_strtoul(p, &p, 0); u8 phymode = (tune >> 8) & 0xff; @@ -7799,9 +7799,9 @@ static ssize_t store_tune(struct device *d, mutex_lock(&priv->mutex); if ((le16_to_cpu(priv->staging_rxon.channel) != channel) || (priv->phymode != phymode)) { - const struct iwl_channel_info *ch_info; + const struct iwl3945_channel_info *ch_info; - ch_info = iwl_get_channel_info(priv, phymode, channel); + ch_info = iwl3945_get_channel_info(priv, phymode, channel); if (!ch_info) { IWL_WARNING("Requested invalid phymode/channel " "combination: %d %d\n", phymode, channel); @@ -7810,18 +7810,18 @@ static ssize_t store_tune(struct device *d, } /* Cancel any currently running scans... */ - if (iwl_scan_cancel_timeout(priv, 100)) + if (iwl3945_scan_cancel_timeout(priv, 100)) IWL_WARNING("Could not cancel scan.\n"); else { IWL_DEBUG_INFO("Committing phymode and " "rxon.channel = %d %d\n", phymode, channel); - iwl_set_rxon_channel(priv, phymode, channel); - iwl_set_flags_for_phymode(priv, phymode); + iwl3945_set_rxon_channel(priv, phymode, channel); + iwl3945_set_flags_for_phymode(priv, phymode); - iwl_set_rate(priv); - iwl_commit_rxon(priv); + iwl3945_set_rate(priv); + iwl3945_commit_rxon(priv); } } mutex_unlock(&priv->mutex); @@ -7836,8 +7836,8 @@ static DEVICE_ATTR(tune, S_IWUSR | S_IRUGO, show_tune, store_tune); static ssize_t show_measurement(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); - struct iwl_spectrum_notification measure_report; + struct iwl3945_priv *priv = dev_get_drvdata(d); + struct iwl3945_spectrum_notification measure_report; u32 size = sizeof(measure_report), len = 0, ofs = 0; u8 *data = (u8 *) & measure_report; unsigned long flags; @@ -7869,7 +7869,7 @@ static ssize_t store_measurement(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl3945_priv *priv = dev_get_drvdata(d); struct ieee80211_measurement_params params = { .channel = le16_to_cpu(priv->active_rxon.channel), .start_time = cpu_to_le64(priv->last_tsf), @@ -7895,7 +7895,7 @@ static ssize_t store_measurement(struct device *d, IWL_DEBUG_INFO("Invoking measurement of type %d on " "channel %d (for '%s')\n", type, params.channel, buf); - iwl_get_measurement(priv, ¶ms, type); + iwl3945_get_measurement(priv, ¶ms, type); return count; } @@ -7907,7 +7907,7 @@ static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR, static ssize_t show_rate(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl3945_priv *priv = dev_get_drvdata(d); unsigned long flags; int i; @@ -7918,13 +7918,13 @@ static ssize_t show_rate(struct device *d, i = priv->stations[IWL_STA_ID].current_rate.s.rate; spin_unlock_irqrestore(&priv->sta_lock, flags); - i = iwl_rate_index_from_plcp(i); + i = iwl3945_rate_index_from_plcp(i); if (i == -1) return sprintf(buf, "0\n"); return sprintf(buf, "%d%s\n", - (iwl_rates[i].ieee >> 1), - (iwl_rates[i].ieee & 0x1) ? ".5" : ""); + (iwl3945_rates[i].ieee >> 1), + (iwl3945_rates[i].ieee & 0x1) ? ".5" : ""); } static DEVICE_ATTR(rate, S_IRUSR, show_rate, NULL); @@ -7933,7 +7933,7 @@ static ssize_t store_retry_rate(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl3945_priv *priv = dev_get_drvdata(d); priv->retry_rate = simple_strtoul(buf, NULL, 0); if (priv->retry_rate <= 0) @@ -7945,7 +7945,7 @@ static ssize_t store_retry_rate(struct device *d, static ssize_t show_retry_rate(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl3945_priv *priv = dev_get_drvdata(d); return sprintf(buf, "%d", priv->retry_rate); } @@ -7956,14 +7956,14 @@ static ssize_t store_power_level(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl3945_priv *priv = dev_get_drvdata(d); int rc; int mode; mode = simple_strtoul(buf, NULL, 0); mutex_lock(&priv->mutex); - if (!iwl_is_ready(priv)) { + if (!iwl3945_is_ready(priv)) { rc = -EAGAIN; goto out; } @@ -7974,7 +7974,7 @@ static ssize_t store_power_level(struct device *d, mode |= IWL_POWER_ENABLED; if (mode != priv->power_mode) { - rc = iwl_send_power_mode(priv, IWL_POWER_LEVEL(mode)); + rc = iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(mode)); if (rc) { IWL_DEBUG_MAC80211("failed setting power mode.\n"); goto out; @@ -8010,7 +8010,7 @@ static const s32 period_duration[] = { static ssize_t show_power_level(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl3945_priv *priv = dev_get_drvdata(d); int level = IWL_POWER_LEVEL(priv->power_mode); char *p = buf; @@ -8045,18 +8045,18 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, static ssize_t show_channels(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl3945_priv *priv = dev_get_drvdata(d); int len = 0, i; struct ieee80211_channel *channels = NULL; const struct ieee80211_hw_mode *hw_mode = NULL; int count = 0; - if (!iwl_is_ready(priv)) + if (!iwl3945_is_ready(priv)) return -EAGAIN; - hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211G); + hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211G); if (!hw_mode) - hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211B); + hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211B); if (hw_mode) { channels = hw_mode->channels; count = hw_mode->num_channels; @@ -8083,7 +8083,7 @@ static ssize_t show_channels(struct device *d, flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? "active/passive" : "passive only"); - hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211A); + hw_mode = iwl3945_get_hw_mode(priv, MODE_IEEE80211A); if (hw_mode) { channels = hw_mode->channels; count = hw_mode->num_channels; @@ -8119,17 +8119,17 @@ static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); static ssize_t show_statistics(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); - u32 size = sizeof(struct iwl_notif_statistics); + struct iwl3945_priv *priv = dev_get_drvdata(d); + u32 size = sizeof(struct iwl3945_notif_statistics); u32 len = 0, ofs = 0; u8 *data = (u8 *) & priv->statistics; int rc = 0; - if (!iwl_is_alive(priv)) + if (!iwl3945_is_alive(priv)) return -EAGAIN; mutex_lock(&priv->mutex); - rc = iwl_send_statistics_request(priv); + rc = iwl3945_send_statistics_request(priv); mutex_unlock(&priv->mutex); if (rc) { @@ -8157,9 +8157,9 @@ static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL); static ssize_t show_antenna(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl3945_priv *priv = dev_get_drvdata(d); - if (!iwl_is_alive(priv)) + if (!iwl3945_is_alive(priv)) return -EAGAIN; return sprintf(buf, "%d\n", priv->antenna); @@ -8170,7 +8170,7 @@ static ssize_t store_antenna(struct device *d, const char *buf, size_t count) { int ant; - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl3945_priv *priv = dev_get_drvdata(d); if (count == 0) return 0; @@ -8182,7 +8182,7 @@ static ssize_t store_antenna(struct device *d, if ((ant >= 0) && (ant <= 2)) { IWL_DEBUG_INFO("Setting antenna select to %d.\n", ant); - priv->antenna = (enum iwl_antenna)ant; + priv->antenna = (enum iwl3945_antenna)ant; } else IWL_DEBUG_INFO("Bad antenna select value %d.\n", ant); @@ -8195,8 +8195,8 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, show_antenna, store_antenna); static ssize_t show_status(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; - if (!iwl_is_alive(priv)) + struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data; + if (!iwl3945_is_alive(priv)) return -EAGAIN; return sprintf(buf, "0x%08x\n", (int)priv->status); } @@ -8210,7 +8210,7 @@ static ssize_t dump_error_log(struct device *d, char *p = (char *)buf; if (p[0] == '1') - iwl_dump_nic_error_log((struct iwl_priv *)d->driver_data); + iwl3945_dump_nic_error_log((struct iwl3945_priv *)d->driver_data); return strnlen(buf, count); } @@ -8224,7 +8224,7 @@ static ssize_t dump_event_log(struct device *d, char *p = (char *)buf; if (p[0] == '1') - iwl_dump_nic_event_log((struct iwl_priv *)d->driver_data); + iwl3945_dump_nic_event_log((struct iwl3945_priv *)d->driver_data); return strnlen(buf, count); } @@ -8237,34 +8237,34 @@ static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); * *****************************************************************************/ -static void iwl_setup_deferred_work(struct iwl_priv *priv) +static void iwl3945_setup_deferred_work(struct iwl3945_priv *priv) { priv->workqueue = create_workqueue(DRV_NAME); init_waitqueue_head(&priv->wait_command_queue); - INIT_WORK(&priv->up, iwl_bg_up); - INIT_WORK(&priv->restart, iwl_bg_restart); - INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish); - INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); - INIT_WORK(&priv->request_scan, iwl_bg_request_scan); - INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); - INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill); - INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); - INIT_DELAYED_WORK(&priv->post_associate, iwl_bg_post_associate); - INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); - INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); - INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); - - iwl_hw_setup_deferred_work(priv); + INIT_WORK(&priv->up, iwl3945_bg_up); + INIT_WORK(&priv->restart, iwl3945_bg_restart); + INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish); + INIT_WORK(&priv->scan_completed, iwl3945_bg_scan_completed); + INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan); + INIT_WORK(&priv->abort_scan, iwl3945_bg_abort_scan); + INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill); + INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); + INIT_DELAYED_WORK(&priv->post_associate, iwl3945_bg_post_associate); + INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); + INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); + INIT_DELAYED_WORK(&priv->scan_check, iwl3945_bg_scan_check); + + iwl3945_hw_setup_deferred_work(priv); tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) - iwl_irq_tasklet, (unsigned long)priv); + iwl3945_irq_tasklet, (unsigned long)priv); } -static void iwl_cancel_deferred_work(struct iwl_priv *priv) +static void iwl3945_cancel_deferred_work(struct iwl3945_priv *priv) { - iwl_hw_cancel_deferred_work(priv); + iwl3945_hw_cancel_deferred_work(priv); cancel_delayed_work_sync(&priv->init_alive_start); cancel_delayed_work(&priv->scan_check); @@ -8273,7 +8273,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv) cancel_work_sync(&priv->beacon_update); } -static struct attribute *iwl_sysfs_entries[] = { +static struct attribute *iwl3945_sysfs_entries[] = { &dev_attr_antenna.attr, &dev_attr_channels.attr, &dev_attr_dump_errors.attr, @@ -8297,45 +8297,45 @@ static struct attribute *iwl_sysfs_entries[] = { NULL }; -static struct attribute_group iwl_attribute_group = { +static struct attribute_group iwl3945_attribute_group = { .name = NULL, /* put in device directory */ - .attrs = iwl_sysfs_entries, + .attrs = iwl3945_sysfs_entries, }; -static struct ieee80211_ops iwl_hw_ops = { - .tx = iwl_mac_tx, - .start = iwl_mac_start, - .stop = iwl_mac_stop, - .add_interface = iwl_mac_add_interface, - .remove_interface = iwl_mac_remove_interface, - .config = iwl_mac_config, - .config_interface = iwl_mac_config_interface, - .configure_filter = iwl_configure_filter, - .set_key = iwl_mac_set_key, - .get_stats = iwl_mac_get_stats, - .get_tx_stats = iwl_mac_get_tx_stats, - .conf_tx = iwl_mac_conf_tx, - .get_tsf = iwl_mac_get_tsf, - .reset_tsf = iwl_mac_reset_tsf, - .beacon_update = iwl_mac_beacon_update, - .hw_scan = iwl_mac_hw_scan +static struct ieee80211_ops iwl3945_hw_ops = { + .tx = iwl3945_mac_tx, + .start = iwl3945_mac_start, + .stop = iwl3945_mac_stop, + .add_interface = iwl3945_mac_add_interface, + .remove_interface = iwl3945_mac_remove_interface, + .config = iwl3945_mac_config, + .config_interface = iwl3945_mac_config_interface, + .configure_filter = iwl3945_configure_filter, + .set_key = iwl3945_mac_set_key, + .get_stats = iwl3945_mac_get_stats, + .get_tx_stats = iwl3945_mac_get_tx_stats, + .conf_tx = iwl3945_mac_conf_tx, + .get_tsf = iwl3945_mac_get_tsf, + .reset_tsf = iwl3945_mac_reset_tsf, + .beacon_update = iwl3945_mac_beacon_update, + .hw_scan = iwl3945_mac_hw_scan }; -static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int err = 0; u32 pci_id; - struct iwl_priv *priv; + struct iwl3945_priv *priv; struct ieee80211_hw *hw; int i; - if (iwl_param_disable_hw_scan) { + if (iwl3945_param_disable_hw_scan) { IWL_DEBUG_INFO("Disabling hw_scan\n"); - iwl_hw_ops.hw_scan = NULL; + iwl3945_hw_ops.hw_scan = NULL; } - if ((iwl_param_queues_num > IWL_MAX_NUM_QUEUES) || - (iwl_param_queues_num < IWL_MIN_NUM_QUEUES)) { + if ((iwl3945_param_queues_num > IWL_MAX_NUM_QUEUES) || + (iwl3945_param_queues_num < IWL_MIN_NUM_QUEUES)) { IWL_ERROR("invalid queues_num, should be between %d and %d\n", IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES); err = -EINVAL; @@ -8344,7 +8344,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* mac80211 allocates memory for this device instance, including * space for this driver's private structure */ - hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwl_hw_ops); + hw = ieee80211_alloc_hw(sizeof(struct iwl3945_priv), &iwl3945_hw_ops); if (hw == NULL) { IWL_ERROR("Can not allocate network device\n"); err = -ENOMEM; @@ -8359,9 +8359,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->hw = hw; priv->pci_dev = pdev; - priv->antenna = (enum iwl_antenna)iwl_param_antenna; + priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna; #ifdef CONFIG_IWL3945_DEBUG - iwl_debug_level = iwl_param_debug; + iwl3945_debug_level = iwl3945_param_debug; atomic_set(&priv->restrict_refcnt, 0); #endif priv->retry_rate = 1; @@ -8400,7 +8400,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_master(pdev); - iwl_clear_stations_table(priv); + iwl3945_clear_stations_table(priv); priv->data_retry_limit = -1; priv->ieee_channels = NULL; @@ -8434,7 +8434,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* Initialize module parameter values here */ - if (iwl_param_disable) { + if (iwl3945_param_disable) { set_bit(STATUS_RF_KILL_SW, &priv->status); IWL_DEBUG_INFO("Radio disabled.\n"); } @@ -8469,36 +8469,36 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->is_abg ? "A" : ""); /* Device-specific setup */ - if (iwl_hw_set_hw_setting(priv)) { + if (iwl3945_hw_set_hw_setting(priv)) { IWL_ERROR("failed to set hw settings\n"); mutex_unlock(&priv->mutex); goto out_iounmap; } #ifdef CONFIG_IWL3945_QOS - if (iwl_param_qos_enable) + if (iwl3945_param_qos_enable) priv->qos_data.qos_enable = 1; - iwl_reset_qos(priv); + iwl3945_reset_qos(priv); priv->qos_data.qos_active = 0; priv->qos_data.qos_cap.val = 0; #endif /* CONFIG_IWL3945_QOS */ - iwl_set_rxon_channel(priv, MODE_IEEE80211G, 6); - iwl_setup_deferred_work(priv); - iwl_setup_rx_handlers(priv); + iwl3945_set_rxon_channel(priv, MODE_IEEE80211G, 6); + iwl3945_setup_deferred_work(priv); + iwl3945_setup_rx_handlers(priv); priv->rates_mask = IWL_RATES_MASK; /* If power management is turned on, default to AC mode */ priv->power_mode = IWL_POWER_AC; priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; - iwl_disable_interrupts(priv); + iwl3945_disable_interrupts(priv); pci_enable_msi(pdev); - err = request_irq(pdev->irq, iwl_isr, IRQF_SHARED, DRV_NAME, priv); + err = request_irq(pdev->irq, iwl3945_isr, IRQF_SHARED, DRV_NAME, priv); if (err) { IWL_ERROR("Error allocating IRQ %d\n", pdev->irq); goto out_disable_msi; @@ -8506,7 +8506,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mutex_lock(&priv->mutex); - err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group); + err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group); if (err) { IWL_ERROR("failed to create sysfs device attributes\n"); mutex_unlock(&priv->mutex); @@ -8515,7 +8515,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* fetch ucode file from disk, alloc and copy to bus-master buffers ... * ucode filename and max sizes are card-specific. */ - err = iwl_read_ucode(priv); + err = iwl3945_read_ucode(priv); if (err) { IWL_ERROR("Could not read microcode: %d\n", err); mutex_unlock(&priv->mutex); @@ -8531,9 +8531,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return 0; out_pci_alloc: - iwl_dealloc_ucode_pci(priv); + iwl3945_dealloc_ucode_pci(priv); - sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); + sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); out_release_irq: free_irq(pdev->irq, priv); @@ -8542,7 +8542,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_disable_msi(pdev); destroy_workqueue(priv->workqueue); priv->workqueue = NULL; - iwl_unset_hw_setting(priv); + iwl3945_unset_hw_setting(priv); out_iounmap: pci_iounmap(pdev, priv->hw_base); @@ -8557,9 +8557,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return err; } -static void iwl_pci_remove(struct pci_dev *pdev) +static void iwl3945_pci_remove(struct pci_dev *pdev) { - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct iwl3945_priv *priv = pci_get_drvdata(pdev); struct list_head *p, *q; int i; @@ -8570,36 +8570,36 @@ static void iwl_pci_remove(struct pci_dev *pdev) set_bit(STATUS_EXIT_PENDING, &priv->status); - iwl_down(priv); + iwl3945_down(priv); /* Free MAC hash list for ADHOC */ for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { list_del(p); - kfree(list_entry(p, struct iwl_ibss_seq, list)); + kfree(list_entry(p, struct iwl3945_ibss_seq, list)); } } - sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); + sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); - iwl_dealloc_ucode_pci(priv); + iwl3945_dealloc_ucode_pci(priv); if (priv->rxq.bd) - iwl_rx_queue_free(priv, &priv->rxq); - iwl_hw_txq_ctx_free(priv); + iwl3945_rx_queue_free(priv, &priv->rxq); + iwl3945_hw_txq_ctx_free(priv); - iwl_unset_hw_setting(priv); - iwl_clear_stations_table(priv); + iwl3945_unset_hw_setting(priv); + iwl3945_clear_stations_table(priv); if (priv->mac80211_registered) { ieee80211_unregister_hw(priv->hw); - iwl_rate_control_unregister(priv->hw); + iwl3945_rate_control_unregister(priv->hw); } /*netif_stop_queue(dev); */ flush_workqueue(priv->workqueue); - /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes + /* ieee80211_unregister_hw calls iwl3945_mac_stop, which flushes * priv->workqueue... so we can't take down the workqueue * until now... */ destroy_workqueue(priv->workqueue); @@ -8625,14 +8625,14 @@ static void iwl_pci_remove(struct pci_dev *pdev) #ifdef CONFIG_PM -static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) +static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state) { - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct iwl3945_priv *priv = pci_get_drvdata(pdev); set_bit(STATUS_IN_SUSPEND, &priv->status); /* Take down the device; powers it off, etc. */ - iwl_down(priv); + iwl3945_down(priv); if (priv->mac80211_registered) ieee80211_stop_queues(priv->hw); @@ -8644,7 +8644,7 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) return 0; } -static void iwl_resume(struct iwl_priv *priv) +static void iwl3945_resume(struct iwl3945_priv *priv) { unsigned long flags; @@ -8653,47 +8653,47 @@ static void iwl_resume(struct iwl_priv *priv) * Without all of the following, resume will not attempt to take * down the NIC (it shouldn't really need to) and will just try * and bring the NIC back up. However that fails during the - * ucode verification process. This then causes iwl_down to be - * called *after* iwl_hw_nic_init() has succeeded -- which + * ucode verification process. This then causes iwl3945_down to be + * called *after* iwl3945_hw_nic_init() has succeeded -- which * then lets the next init sequence succeed. So, we've * replicated all of that NIC init code here... */ - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); + iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl_hw_nic_init(priv); + iwl3945_hw_nic_init(priv); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF); + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); /* tell the device to stop sending interrupts */ - iwl_disable_interrupts(priv); + iwl3945_disable_interrupts(priv); spin_lock_irqsave(&priv->lock, flags); - iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); + iwl3945_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - if (!iwl_grab_nic_access(priv)) { - iwl_write_prph(priv, APMG_CLK_DIS_REG, + if (!iwl3945_grab_nic_access(priv)) { + iwl3945_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); - iwl_release_nic_access(priv); + iwl3945_release_nic_access(priv); } spin_unlock_irqrestore(&priv->lock, flags); udelay(5); - iwl_hw_nic_reset(priv); + iwl3945_hw_nic_reset(priv); /* Bring the device back up */ clear_bit(STATUS_IN_SUSPEND, &priv->status); queue_work(priv->workqueue, &priv->up); } -static int iwl_pci_resume(struct pci_dev *pdev) +static int iwl3945_pci_resume(struct pci_dev *pdev) { - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct iwl3945_priv *priv = pci_get_drvdata(pdev); int err; printk(KERN_INFO "Coming out of suspend...\n"); @@ -8710,7 +8710,7 @@ static int iwl_pci_resume(struct pci_dev *pdev) */ pci_write_config_byte(pdev, 0x41, 0x00); - iwl_resume(priv); + iwl3945_resume(priv); return 0; } @@ -8723,33 +8723,33 @@ static int iwl_pci_resume(struct pci_dev *pdev) * *****************************************************************************/ -static struct pci_driver iwl_driver = { +static struct pci_driver iwl3945_driver = { .name = DRV_NAME, - .id_table = iwl_hw_card_ids, - .probe = iwl_pci_probe, - .remove = __devexit_p(iwl_pci_remove), + .id_table = iwl3945_hw_card_ids, + .probe = iwl3945_pci_probe, + .remove = __devexit_p(iwl3945_pci_remove), #ifdef CONFIG_PM - .suspend = iwl_pci_suspend, - .resume = iwl_pci_resume, + .suspend = iwl3945_pci_suspend, + .resume = iwl3945_pci_resume, #endif }; -static int __init iwl_init(void) +static int __init iwl3945_init(void) { int ret; printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); - ret = pci_register_driver(&iwl_driver); + ret = pci_register_driver(&iwl3945_driver); if (ret) { IWL_ERROR("Unable to initialize PCI module\n"); return ret; } #ifdef CONFIG_IWL3945_DEBUG - ret = driver_create_file(&iwl_driver.driver, &driver_attr_debug_level); + ret = driver_create_file(&iwl3945_driver.driver, &driver_attr_debug_level); if (ret) { IWL_ERROR("Unable to create driver sysfs file\n"); - pci_unregister_driver(&iwl_driver); + pci_unregister_driver(&iwl3945_driver); return ret; } #endif @@ -8757,32 +8757,32 @@ static int __init iwl_init(void) return ret; } -static void __exit iwl_exit(void) +static void __exit iwl3945_exit(void) { #ifdef CONFIG_IWL3945_DEBUG - driver_remove_file(&iwl_driver.driver, &driver_attr_debug_level); + driver_remove_file(&iwl3945_driver.driver, &driver_attr_debug_level); #endif - pci_unregister_driver(&iwl_driver); + pci_unregister_driver(&iwl3945_driver); } -module_param_named(antenna, iwl_param_antenna, int, 0444); +module_param_named(antenna, iwl3945_param_antenna, int, 0444); MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); -module_param_named(disable, iwl_param_disable, int, 0444); +module_param_named(disable, iwl3945_param_disable, int, 0444); MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); -module_param_named(hwcrypto, iwl_param_hwcrypto, int, 0444); +module_param_named(hwcrypto, iwl3945_param_hwcrypto, int, 0444); MODULE_PARM_DESC(hwcrypto, "using hardware crypto engine (default 0 [software])\n"); -module_param_named(debug, iwl_param_debug, int, 0444); +module_param_named(debug, iwl3945_param_debug, int, 0444); MODULE_PARM_DESC(debug, "debug output mask"); -module_param_named(disable_hw_scan, iwl_param_disable_hw_scan, int, 0444); +module_param_named(disable_hw_scan, iwl3945_param_disable_hw_scan, int, 0444); MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); -module_param_named(queues_num, iwl_param_queues_num, int, 0444); +module_param_named(queues_num, iwl3945_param_queues_num, int, 0444); MODULE_PARM_DESC(queues_num, "number of hw queues."); /* QoS */ -module_param_named(qos_enable, iwl_param_qos_enable, int, 0444); +module_param_named(qos_enable, iwl3945_param_qos_enable, int, 0444); MODULE_PARM_DESC(qos_enable, "enable all QoS functionality"); -module_exit(iwl_exit); -module_init(iwl_init); +module_exit(iwl3945_exit); +module_init(iwl3945_init); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 07df6c1c102..41cabd61849 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -60,11 +60,11 @@ #include "iwl-helpers.h" #ifdef CONFIG_IWL4965_DEBUG -u32 iwl_debug_level; +u32 iwl4965_debug_level; #endif -static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_tx_queue *txq); +static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv, + struct iwl4965_tx_queue *txq); /****************************************************************************** * @@ -73,13 +73,13 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, ******************************************************************************/ /* module parameters */ -static int iwl_param_disable_hw_scan; -static int iwl_param_debug; -static int iwl_param_disable; /* def: enable radio */ -static int iwl_param_antenna; /* def: 0 = both antennas (use diversity) */ -int iwl_param_hwcrypto; /* def: using software encryption */ -static int iwl_param_qos_enable = 1; -int iwl_param_queues_num = IWL_MAX_NUM_QUEUES; +static int iwl4965_param_disable_hw_scan; +static int iwl4965_param_debug; +static int iwl4965_param_disable; /* def: enable radio */ +static int iwl4965_param_antenna; /* def: 0 = both antennas (use diversity) */ +int iwl4965_param_hwcrypto; /* def: using software encryption */ +static int iwl4965_param_qos_enable = 1; +int iwl4965_param_queues_num = IWL_MAX_NUM_QUEUES; /* * module name, copyright, version, etc. @@ -125,8 +125,8 @@ __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr) return NULL; } -static const struct ieee80211_hw_mode *iwl_get_hw_mode( - struct iwl_priv *priv, int mode) +static const struct ieee80211_hw_mode *iwl4965_get_hw_mode( + struct iwl4965_priv *priv, int mode) { int i; @@ -137,7 +137,7 @@ static const struct ieee80211_hw_mode *iwl_get_hw_mode( return NULL; } -static int iwl_is_empty_essid(const char *essid, int essid_len) +static int iwl4965_is_empty_essid(const char *essid, int essid_len) { /* Single white space is for Linksys APs */ if (essid_len == 1 && essid[0] == ' ') @@ -153,13 +153,13 @@ static int iwl_is_empty_essid(const char *essid, int essid_len) return 1; } -static const char *iwl_escape_essid(const char *essid, u8 essid_len) +static const char *iwl4965_escape_essid(const char *essid, u8 essid_len) { static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; const char *s = essid; char *d = escaped; - if (iwl_is_empty_essid(essid, essid_len)) { + if (iwl4965_is_empty_essid(essid, essid_len)) { memcpy(escaped, "", sizeof("")); return escaped; } @@ -177,10 +177,10 @@ static const char *iwl_escape_essid(const char *essid, u8 essid_len) return escaped; } -static void iwl_print_hex_dump(int level, void *p, u32 len) +static void iwl4965_print_hex_dump(int level, void *p, u32 len) { #ifdef CONFIG_IWL4965_DEBUG - if (!(iwl_debug_level & level)) + if (!(iwl4965_debug_level & level)) return; print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1, @@ -206,7 +206,7 @@ static void iwl_print_hex_dump(int level, void *p, u32 len) * and four transmit queues for data. ***************************************************/ -static int iwl_queue_space(const struct iwl_queue *q) +static int iwl4965_queue_space(const struct iwl4965_queue *q) { int s = q->read_ptr - q->write_ptr; @@ -223,25 +223,25 @@ static int iwl_queue_space(const struct iwl_queue *q) } /* XXX: n_bd must be power-of-two size */ -static inline int iwl_queue_inc_wrap(int index, int n_bd) +static inline int iwl4965_queue_inc_wrap(int index, int n_bd) { return ++index & (n_bd - 1); } /* XXX: n_bd must be power-of-two size */ -static inline int iwl_queue_dec_wrap(int index, int n_bd) +static inline int iwl4965_queue_dec_wrap(int index, int n_bd) { return --index & (n_bd - 1); } -static inline int x2_queue_used(const struct iwl_queue *q, int i) +static inline int x2_queue_used(const struct iwl4965_queue *q, int i) { return q->write_ptr > q->read_ptr ? (i >= q->read_ptr && i < q->write_ptr) : !(i < q->read_ptr && i >= q->write_ptr); } -static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) +static inline u8 get_cmd_index(struct iwl4965_queue *q, u32 index, int is_huge) { if (is_huge) return q->n_window; @@ -249,15 +249,15 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) return index & (q->n_window - 1); } -static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, +static int iwl4965_queue_init(struct iwl4965_priv *priv, struct iwl4965_queue *q, int count, int slots_num, u32 id) { q->n_bd = count; q->n_window = slots_num; q->id = id; - /* count must be power-of-two size, otherwise iwl_queue_inc_wrap - * and iwl_queue_dec_wrap are broken. */ + /* count must be power-of-two size, otherwise iwl4965_queue_inc_wrap + * and iwl4965_queue_dec_wrap are broken. */ BUG_ON(!is_power_of_2(count)); /* slots_num must be power-of-two size, otherwise @@ -277,8 +277,8 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, return 0; } -static int iwl_tx_queue_alloc(struct iwl_priv *priv, - struct iwl_tx_queue *txq, u32 id) +static int iwl4965_tx_queue_alloc(struct iwl4965_priv *priv, + struct iwl4965_tx_queue *txq, u32 id) { struct pci_dev *dev = priv->pci_dev; @@ -315,8 +315,8 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, return -ENOMEM; } -int iwl_tx_queue_init(struct iwl_priv *priv, - struct iwl_tx_queue *txq, int slots_num, u32 txq_id) +int iwl4965_tx_queue_init(struct iwl4965_priv *priv, + struct iwl4965_tx_queue *txq, int slots_num, u32 txq_id) { struct pci_dev *dev = priv->pci_dev; int len; @@ -325,14 +325,14 @@ int iwl_tx_queue_init(struct iwl_priv *priv, /* allocate command space + one big command for scan since scan * command is very huge the system will not have two scan at the * same time */ - len = sizeof(struct iwl_cmd) * slots_num; + len = sizeof(struct iwl4965_cmd) * slots_num; if (txq_id == IWL_CMD_QUEUE_NUM) len += IWL_MAX_SCAN_SIZE; txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); if (!txq->cmd) return -ENOMEM; - rc = iwl_tx_queue_alloc(priv, txq, txq_id); + rc = iwl4965_tx_queue_alloc(priv, txq, txq_id); if (rc) { pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); @@ -341,26 +341,26 @@ int iwl_tx_queue_init(struct iwl_priv *priv, txq->need_update = 0; /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise - * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ + * iwl4965_queue_inc_wrap and iwl4965_queue_dec_wrap are broken. */ BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); - iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); + iwl4965_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); - iwl_hw_tx_queue_init(priv, txq); + iwl4965_hw_tx_queue_init(priv, txq); return 0; } /** - * iwl_tx_queue_free - Deallocate DMA queue. + * iwl4965_tx_queue_free - Deallocate DMA queue. * @txq: Transmit queue to deallocate. * * Empty queue by removing and destroying all BD's. * Free all buffers. txq itself is not freed. * */ -void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) +void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq) { - struct iwl_queue *q = &txq->q; + struct iwl4965_queue *q = &txq->q; struct pci_dev *dev = priv->pci_dev; int len; @@ -369,10 +369,10 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) /* first, empty all BD's */ for (; q->write_ptr != q->read_ptr; - q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) - iwl_hw_txq_free_tfd(priv, txq); + q->read_ptr = iwl4965_queue_inc_wrap(q->read_ptr, q->n_bd)) + iwl4965_hw_txq_free_tfd(priv, txq); - len = sizeof(struct iwl_cmd) * q->n_window; + len = sizeof(struct iwl4965_cmd) * q->n_window; if (q->id == IWL_CMD_QUEUE_NUM) len += IWL_MAX_SCAN_SIZE; @@ -380,7 +380,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) /* free buffers belonging to queue itself */ if (txq->q.n_bd) - pci_free_consistent(dev, sizeof(struct iwl_tfd_frame) * + pci_free_consistent(dev, sizeof(struct iwl4965_tfd_frame) * txq->q.n_bd, txq->bd, txq->q.dma_addr); if (txq->txb) { @@ -392,12 +392,12 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) memset(txq, 0, sizeof(*txq)); } -const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; +const u8 iwl4965_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /*************** STATION TABLE MANAGEMENT **** * * NOTE: This needs to be overhauled to better synchronize between - * how the iwl-4965.c is using iwl_hw_find_station vs. iwl-3945.c + * how the iwl-4965.c is using iwl4965_hw_find_station vs. iwl-3945.c * * mac80211 should also be examined to determine if sta_info is duplicating * the functionality provided here @@ -406,7 +406,7 @@ const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /**************************************************************/ #if 0 /* temporary disable till we add real remove station */ -static u8 iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) +static u8 iwl4965_remove_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) { int index = IWL_INVALID_STATION; int i; @@ -443,7 +443,7 @@ out: } #endif -static void iwl_clear_stations_table(struct iwl_priv *priv) +static void iwl4965_clear_stations_table(struct iwl4965_priv *priv) { unsigned long flags; @@ -455,11 +455,11 @@ static void iwl_clear_stations_table(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->sta_lock, flags); } -u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) +u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, int is_ap, u8 flags) { int i; int index = IWL_INVALID_STATION; - struct iwl_station_entry *station; + struct iwl4965_station_entry *station; unsigned long flags_spin; DECLARE_MAC_BUF(mac); @@ -501,7 +501,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) station->used = 1; priv->num_stations++; - memset(&station->sta, 0, sizeof(struct iwl_addsta_cmd)); + memset(&station->sta, 0, sizeof(struct iwl4965_addsta_cmd)); memcpy(station->sta.sta.addr, addr, ETH_ALEN); station->sta.mode = 0; station->sta.sta.sta_id = index; @@ -515,14 +515,14 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) #endif /*CONFIG_IWL4965_HT*/ spin_unlock_irqrestore(&priv->sta_lock, flags_spin); - iwl_send_add_station(priv, &station->sta, flags); + iwl4965_send_add_station(priv, &station->sta, flags); return index; } /*************** DRIVER STATUS FUNCTIONS *****/ -static inline int iwl_is_ready(struct iwl_priv *priv) +static inline int iwl4965_is_ready(struct iwl4965_priv *priv) { /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are * set but EXIT_PENDING is not */ @@ -531,29 +531,29 @@ static inline int iwl_is_ready(struct iwl_priv *priv) !test_bit(STATUS_EXIT_PENDING, &priv->status); } -static inline int iwl_is_alive(struct iwl_priv *priv) +static inline int iwl4965_is_alive(struct iwl4965_priv *priv) { return test_bit(STATUS_ALIVE, &priv->status); } -static inline int iwl_is_init(struct iwl_priv *priv) +static inline int iwl4965_is_init(struct iwl4965_priv *priv) { return test_bit(STATUS_INIT, &priv->status); } -static inline int iwl_is_rfkill(struct iwl_priv *priv) +static inline int iwl4965_is_rfkill(struct iwl4965_priv *priv) { return test_bit(STATUS_RF_KILL_HW, &priv->status) || test_bit(STATUS_RF_KILL_SW, &priv->status); } -static inline int iwl_is_ready_rf(struct iwl_priv *priv) +static inline int iwl4965_is_ready_rf(struct iwl4965_priv *priv) { - if (iwl_is_rfkill(priv)) + if (iwl4965_is_rfkill(priv)) return 0; - return iwl_is_ready(priv); + return iwl4965_is_ready(priv); } /*************** HOST COMMAND QUEUE FUNCTIONS *****/ @@ -618,7 +618,7 @@ static const char *get_cmd_string(u8 cmd) #define HOST_COMPLETE_TIMEOUT (HZ / 2) /** - * iwl_enqueue_hcmd - enqueue a uCode command + * iwl4965_enqueue_hcmd - enqueue a uCode command * @priv: device private data point * @cmd: a point to the ucode command structure * @@ -626,13 +626,13 @@ static const char *get_cmd_string(u8 cmd) * failed. On success, it turns the index (> 0) of command in the * command queue. */ -static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +static int iwl4965_enqueue_hcmd(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd) { - struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; - struct iwl_queue *q = &txq->q; - struct iwl_tfd_frame *tfd; + struct iwl4965_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; + struct iwl4965_queue *q = &txq->q; + struct iwl4965_tfd_frame *tfd; u32 *control_flags; - struct iwl_cmd *out_cmd; + struct iwl4965_cmd *out_cmd; u32 idx; u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); dma_addr_t phys_addr; @@ -645,7 +645,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && !(cmd->meta.flags & CMD_SIZE_HUGE)); - if (iwl_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { + if (iwl4965_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) { IWL_ERROR("No space for Tx\n"); return -ENOSPC; } @@ -674,8 +674,8 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + - offsetof(struct iwl_cmd, hdr); - iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); + offsetof(struct iwl4965_cmd, hdr); + iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " "%d bytes at %d[%d]:%d\n", @@ -685,14 +685,14 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) txq->need_update = 1; ret = iwl4965_tx_queue_update_wr_ptr(priv, txq, 0); - q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); - iwl_tx_queue_update_write_ptr(priv, txq); + q->write_ptr = iwl4965_queue_inc_wrap(q->write_ptr, q->n_bd); + iwl4965_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->hcmd_lock, flags); return ret ? ret : idx; } -static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +static int iwl4965_send_cmd_async(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd) { int ret; @@ -707,16 +707,16 @@ static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return -EBUSY; - ret = iwl_enqueue_hcmd(priv, cmd); + ret = iwl4965_enqueue_hcmd(priv, cmd); if (ret < 0) { - IWL_ERROR("Error sending %s: iwl_enqueue_hcmd failed: %d\n", + IWL_ERROR("Error sending %s: iwl4965_enqueue_hcmd failed: %d\n", get_cmd_string(cmd->id), ret); return ret; } return 0; } -static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +static int iwl4965_send_cmd_sync(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd) { int cmd_idx; int ret; @@ -738,10 +738,10 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) if (cmd->meta.flags & CMD_WANT_SKB) cmd->meta.source = &cmd->meta; - cmd_idx = iwl_enqueue_hcmd(priv, cmd); + cmd_idx = iwl4965_enqueue_hcmd(priv, cmd); if (cmd_idx < 0) { ret = cmd_idx; - IWL_ERROR("Error sending %s: iwl_enqueue_hcmd failed: %d\n", + IWL_ERROR("Error sending %s: iwl4965_enqueue_hcmd failed: %d\n", get_cmd_string(cmd->id), ret); goto out; } @@ -785,7 +785,7 @@ static int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) cancel: if (cmd->meta.flags & CMD_WANT_SKB) { - struct iwl_cmd *qcmd; + struct iwl4965_cmd *qcmd; /* Cancel the CMD_WANT_SKB flag for the cmd in the * TX cmd queue. Otherwise in case the cmd comes @@ -804,60 +804,60 @@ out: return ret; } -int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) +int iwl4965_send_cmd(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd) { if (cmd->meta.flags & CMD_ASYNC) - return iwl_send_cmd_async(priv, cmd); + return iwl4965_send_cmd_async(priv, cmd); - return iwl_send_cmd_sync(priv, cmd); + return iwl4965_send_cmd_sync(priv, cmd); } -int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data) +int iwl4965_send_cmd_pdu(struct iwl4965_priv *priv, u8 id, u16 len, const void *data) { - struct iwl_host_cmd cmd = { + struct iwl4965_host_cmd cmd = { .id = id, .len = len, .data = data, }; - return iwl_send_cmd_sync(priv, &cmd); + return iwl4965_send_cmd_sync(priv, &cmd); } -static int __must_check iwl_send_cmd_u32(struct iwl_priv *priv, u8 id, u32 val) +static int __must_check iwl4965_send_cmd_u32(struct iwl4965_priv *priv, u8 id, u32 val) { - struct iwl_host_cmd cmd = { + struct iwl4965_host_cmd cmd = { .id = id, .len = sizeof(val), .data = &val, }; - return iwl_send_cmd_sync(priv, &cmd); + return iwl4965_send_cmd_sync(priv, &cmd); } -int iwl_send_statistics_request(struct iwl_priv *priv) +int iwl4965_send_statistics_request(struct iwl4965_priv *priv) { - return iwl_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0); + return iwl4965_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0); } /** - * iwl_rxon_add_station - add station into station table. + * iwl4965_rxon_add_station - add station into station table. * * there is only one AP station with id= IWL_AP_ID * NOTE: mutex must be held before calling the this fnction */ -static int iwl_rxon_add_station(struct iwl_priv *priv, +static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) { u8 sta_id; - sta_id = iwl_add_station(priv, addr, is_ap, 0); + sta_id = iwl4965_add_station_flags(priv, addr, is_ap, 0); iwl4965_add_station(priv, addr, is_ap); return sta_id; } /** - * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON + * iwl4965_set_rxon_channel - Set the phymode and channel values in staging RXON * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz * @channel: Any channel valid for the requested phymode @@ -866,9 +866,9 @@ static int iwl_rxon_add_station(struct iwl_priv *priv, * NOTE: Does not commit to the hardware; it sets appropriate bit fields * in the staging RXON flag structure based on the phymode */ -static int iwl_set_rxon_channel(struct iwl_priv *priv, u8 phymode, u16 channel) +static int iwl4965_set_rxon_channel(struct iwl4965_priv *priv, u8 phymode, u16 channel) { - if (!iwl_get_channel_info(priv, phymode, channel)) { + if (!iwl4965_get_channel_info(priv, phymode, channel)) { IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", channel, phymode); return -EINVAL; @@ -892,13 +892,13 @@ static int iwl_set_rxon_channel(struct iwl_priv *priv, u8 phymode, u16 channel) } /** - * iwl_check_rxon_cmd - validate RXON structure is valid + * iwl4965_check_rxon_cmd - validate RXON structure is valid * * NOTE: This is really only useful during development and can eventually * be #ifdef'd out once the driver is stable and folks aren't actively * making changes */ -static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) +static int iwl4965_check_rxon_cmd(struct iwl4965_rxon_cmd *rxon) { int error = 0; int counter = 1; @@ -958,21 +958,21 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) le16_to_cpu(rxon->channel)); if (error) { - IWL_ERROR("Not a valid iwl_rxon_assoc_cmd field values\n"); + IWL_ERROR("Not a valid iwl4965_rxon_assoc_cmd field values\n"); return -1; } return 0; } /** - * iwl_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit + * iwl4965_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit * @priv: staging_rxon is compared to active_rxon * * If the RXON structure is changing sufficient to require a new * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1 * to indicate a new tune is required. */ -static int iwl_full_rxon_required(struct iwl_priv *priv) +static int iwl4965_full_rxon_required(struct iwl4965_priv *priv) { /* These items are only settable from the full RXON command */ @@ -1012,19 +1012,19 @@ static int iwl_full_rxon_required(struct iwl_priv *priv) return 0; } -static int iwl_send_rxon_assoc(struct iwl_priv *priv) +static int iwl4965_send_rxon_assoc(struct iwl4965_priv *priv) { int rc = 0; - struct iwl_rx_packet *res = NULL; - struct iwl_rxon_assoc_cmd rxon_assoc; - struct iwl_host_cmd cmd = { + struct iwl4965_rx_packet *res = NULL; + struct iwl4965_rxon_assoc_cmd rxon_assoc; + struct iwl4965_host_cmd cmd = { .id = REPLY_RXON_ASSOC, .len = sizeof(rxon_assoc), .meta.flags = CMD_WANT_SKB, .data = &rxon_assoc, }; - const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; - const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; + const struct iwl4965_rxon_cmd *rxon1 = &priv->staging_rxon; + const struct iwl4965_rxon_cmd *rxon2 = &priv->active_rxon; if ((rxon1->flags == rxon2->flags) && (rxon1->filter_flags == rxon2->filter_flags) && @@ -1050,11 +1050,11 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv) priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; - rc = iwl_send_cmd_sync(priv, &cmd); + rc = iwl4965_send_cmd_sync(priv, &cmd); if (rc) return rc; - res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; + res = (struct iwl4965_rx_packet *)cmd.meta.u.skb->data; if (res->hdr.flags & IWL_CMD_FAILED_MSK) { IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n"); rc = -EIO; @@ -1067,37 +1067,37 @@ static int iwl_send_rxon_assoc(struct iwl_priv *priv) } /** - * iwl_commit_rxon - commit staging_rxon to hardware + * iwl4965_commit_rxon - commit staging_rxon to hardware * * The RXON command in staging_rxon is committed to the hardware and * the active_rxon structure is updated with the new data. This * function correctly transitions out of the RXON_ASSOC_MSK state if * a HW tune is required based on the RXON structure changes. */ -static int iwl_commit_rxon(struct iwl_priv *priv) +static int iwl4965_commit_rxon(struct iwl4965_priv *priv) { /* cast away the const for active_rxon in this function */ - struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; + struct iwl4965_rxon_cmd *active_rxon = (void *)&priv->active_rxon; DECLARE_MAC_BUF(mac); int rc = 0; - if (!iwl_is_alive(priv)) + if (!iwl4965_is_alive(priv)) return -1; /* always get timestamp with Rx frame */ priv->staging_rxon.flags |= RXON_FLG_TSF2HOST_MSK; - rc = iwl_check_rxon_cmd(&priv->staging_rxon); + rc = iwl4965_check_rxon_cmd(&priv->staging_rxon); if (rc) { IWL_ERROR("Invalid RXON configuration. Not committing.\n"); return -EINVAL; } /* If we don't need to send a full RXON, we can use - * iwl_rxon_assoc_cmd which is used to reconfigure filter + * iwl4965_rxon_assoc_cmd which is used to reconfigure filter * and other flags for the current radio configuration. */ - if (!iwl_full_rxon_required(priv)) { - rc = iwl_send_rxon_assoc(priv); + if (!iwl4965_full_rxon_required(priv)) { + rc = iwl4965_send_rxon_assoc(priv); if (rc) { IWL_ERROR("Error setting RXON_ASSOC " "configuration (%d).\n", rc); @@ -1124,13 +1124,13 @@ static int iwl_commit_rxon(struct iwl_priv *priv) * an RXON_ASSOC and the new config wants the associated mask enabled, * we must clear the associated from the active configuration * before we apply the new config */ - if (iwl_is_associated(priv) && + if (iwl4965_is_associated(priv) && (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) { IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - rc = iwl_send_cmd_pdu(priv, REPLY_RXON, - sizeof(struct iwl_rxon_cmd), + rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON, + sizeof(struct iwl4965_rxon_cmd), &priv->active_rxon); /* If the mask clearing failed then we set @@ -1153,14 +1153,14 @@ static int iwl_commit_rxon(struct iwl_priv *priv) print_mac(mac, priv->staging_rxon.bssid_addr)); /* Apply the new configuration */ - rc = iwl_send_cmd_pdu(priv, REPLY_RXON, - sizeof(struct iwl_rxon_cmd), &priv->staging_rxon); + rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON, + sizeof(struct iwl4965_rxon_cmd), &priv->staging_rxon); if (rc) { IWL_ERROR("Error setting new configuration (%d).\n", rc); return rc; } - iwl_clear_stations_table(priv); + iwl4965_clear_stations_table(priv); #ifdef CONFIG_IWL4965_SENSITIVITY if (!priv->error_recovering) @@ -1174,14 +1174,14 @@ static int iwl_commit_rxon(struct iwl_priv *priv) /* If we issue a new RXON command which required a tune then we must * send a new TXPOWER command or we won't be able to Tx any frames */ - rc = iwl_hw_reg_send_txpower(priv); + rc = iwl4965_hw_reg_send_txpower(priv); if (rc) { IWL_ERROR("Error setting Tx power (%d).\n", rc); return rc; } /* Add the broadcast address so we can send broadcast frames */ - if (iwl_rxon_add_station(priv, BROADCAST_ADDR, 0) == + if (iwl4965_rxon_add_station(priv, iwl4965_broadcast_addr, 0) == IWL_INVALID_STATION) { IWL_ERROR("Error adding BROADCAST address for transmit.\n"); return -EIO; @@ -1189,9 +1189,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv) /* If we have set the ASSOC_MSK and we are in BSS mode then * add the IWL_AP_ID to the station rate table */ - if (iwl_is_associated(priv) && + if (iwl4965_is_associated(priv) && (priv->iw_mode == IEEE80211_IF_TYPE_STA)) { - if (iwl_rxon_add_station(priv, priv->active_rxon.bssid_addr, 1) + if (iwl4965_rxon_add_station(priv, priv->active_rxon.bssid_addr, 1) == IWL_INVALID_STATION) { IWL_ERROR("Error adding AP address for transmit.\n"); return -EIO; @@ -1202,9 +1202,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv) return 0; } -static int iwl_send_bt_config(struct iwl_priv *priv) +static int iwl4965_send_bt_config(struct iwl4965_priv *priv) { - struct iwl_bt_cmd bt_cmd = { + struct iwl4965_bt_cmd bt_cmd = { .flags = 3, .lead_time = 0xAA, .max_kill = 1, @@ -1212,15 +1212,15 @@ static int iwl_send_bt_config(struct iwl_priv *priv) .kill_cts_mask = 0, }; - return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, - sizeof(struct iwl_bt_cmd), &bt_cmd); + return iwl4965_send_cmd_pdu(priv, REPLY_BT_CONFIG, + sizeof(struct iwl4965_bt_cmd), &bt_cmd); } -static int iwl_send_scan_abort(struct iwl_priv *priv) +static int iwl4965_send_scan_abort(struct iwl4965_priv *priv) { int rc = 0; - struct iwl_rx_packet *res; - struct iwl_host_cmd cmd = { + struct iwl4965_rx_packet *res; + struct iwl4965_host_cmd cmd = { .id = REPLY_SCAN_ABORT_CMD, .meta.flags = CMD_WANT_SKB, }; @@ -1233,13 +1233,13 @@ static int iwl_send_scan_abort(struct iwl_priv *priv) return 0; } - rc = iwl_send_cmd_sync(priv, &cmd); + rc = iwl4965_send_cmd_sync(priv, &cmd); if (rc) { clear_bit(STATUS_SCAN_ABORTING, &priv->status); return rc; } - res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; + res = (struct iwl4965_rx_packet *)cmd.meta.u.skb->data; if (res->u.status != CAN_ABORT_STATUS) { /* The scan abort will return 1 for success or * 2 for "failure". A failure condition can be @@ -1257,8 +1257,8 @@ static int iwl_send_scan_abort(struct iwl_priv *priv) return rc; } -static int iwl_card_state_sync_callback(struct iwl_priv *priv, - struct iwl_cmd *cmd, +static int iwl4965_card_state_sync_callback(struct iwl4965_priv *priv, + struct iwl4965_cmd *cmd, struct sk_buff *skb) { return 1; @@ -1274,9 +1274,9 @@ static int iwl_card_state_sync_callback(struct iwl_priv *priv, * When in the 'halt' state, the card is shut down and must be fully * restarted to come back on. */ -static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) +static int iwl4965_send_card_state(struct iwl4965_priv *priv, u32 flags, u8 meta_flag) { - struct iwl_host_cmd cmd = { + struct iwl4965_host_cmd cmd = { .id = REPLY_CARD_STATE_CMD, .len = sizeof(u32), .data = &flags, @@ -1284,22 +1284,22 @@ static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) }; if (meta_flag & CMD_ASYNC) - cmd.meta.u.callback = iwl_card_state_sync_callback; + cmd.meta.u.callback = iwl4965_card_state_sync_callback; - return iwl_send_cmd(priv, &cmd); + return iwl4965_send_cmd(priv, &cmd); } -static int iwl_add_sta_sync_callback(struct iwl_priv *priv, - struct iwl_cmd *cmd, struct sk_buff *skb) +static int iwl4965_add_sta_sync_callback(struct iwl4965_priv *priv, + struct iwl4965_cmd *cmd, struct sk_buff *skb) { - struct iwl_rx_packet *res = NULL; + struct iwl4965_rx_packet *res = NULL; if (!skb) { IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n"); return 1; } - res = (struct iwl_rx_packet *)skb->data; + res = (struct iwl4965_rx_packet *)skb->data; if (res->hdr.flags & IWL_CMD_FAILED_MSK) { IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", res->hdr.flags); @@ -1317,29 +1317,29 @@ static int iwl_add_sta_sync_callback(struct iwl_priv *priv, return 1; } -int iwl_send_add_station(struct iwl_priv *priv, - struct iwl_addsta_cmd *sta, u8 flags) +int iwl4965_send_add_station(struct iwl4965_priv *priv, + struct iwl4965_addsta_cmd *sta, u8 flags) { - struct iwl_rx_packet *res = NULL; + struct iwl4965_rx_packet *res = NULL; int rc = 0; - struct iwl_host_cmd cmd = { + struct iwl4965_host_cmd cmd = { .id = REPLY_ADD_STA, - .len = sizeof(struct iwl_addsta_cmd), + .len = sizeof(struct iwl4965_addsta_cmd), .meta.flags = flags, .data = sta, }; if (flags & CMD_ASYNC) - cmd.meta.u.callback = iwl_add_sta_sync_callback; + cmd.meta.u.callback = iwl4965_add_sta_sync_callback; else cmd.meta.flags |= CMD_WANT_SKB; - rc = iwl_send_cmd(priv, &cmd); + rc = iwl4965_send_cmd(priv, &cmd); if (rc || (flags & CMD_ASYNC)) return rc; - res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; + res = (struct iwl4965_rx_packet *)cmd.meta.u.skb->data; if (res->hdr.flags & IWL_CMD_FAILED_MSK) { IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", res->hdr.flags); @@ -1364,7 +1364,7 @@ int iwl_send_add_station(struct iwl_priv *priv, return rc; } -static int iwl_update_sta_key_info(struct iwl_priv *priv, +static int iwl4965_update_sta_key_info(struct iwl4965_priv *priv, struct ieee80211_key_conf *keyconf, u8 sta_id) { @@ -1398,28 +1398,28 @@ static int iwl_update_sta_key_info(struct iwl_priv *priv, spin_unlock_irqrestore(&priv->sta_lock, flags); IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n"); - iwl_send_add_station(priv, &priv->stations[sta_id].sta, 0); + iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, 0); return 0; } -static int iwl_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) +static int iwl4965_clear_sta_key_info(struct iwl4965_priv *priv, u8 sta_id) { unsigned long flags; spin_lock_irqsave(&priv->sta_lock, flags); - memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); - memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl_keyinfo)); + memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl4965_hw_key)); + memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl4965_keyinfo)); priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; spin_unlock_irqrestore(&priv->sta_lock, flags); IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n"); - iwl_send_add_station(priv, &priv->stations[sta_id].sta, 0); + iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, 0); return 0; } -static void iwl_clear_free_frames(struct iwl_priv *priv) +static void iwl4965_clear_free_frames(struct iwl4965_priv *priv) { struct list_head *element; @@ -1429,7 +1429,7 @@ static void iwl_clear_free_frames(struct iwl_priv *priv) while (!list_empty(&priv->free_frames)) { element = priv->free_frames.next; list_del(element); - kfree(list_entry(element, struct iwl_frame, list)); + kfree(list_entry(element, struct iwl4965_frame, list)); priv->frames_count--; } @@ -1440,9 +1440,9 @@ static void iwl_clear_free_frames(struct iwl_priv *priv) } } -static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv) +static struct iwl4965_frame *iwl4965_get_free_frame(struct iwl4965_priv *priv) { - struct iwl_frame *frame; + struct iwl4965_frame *frame; struct list_head *element; if (list_empty(&priv->free_frames)) { frame = kzalloc(sizeof(*frame), GFP_KERNEL); @@ -1457,21 +1457,21 @@ static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv) element = priv->free_frames.next; list_del(element); - return list_entry(element, struct iwl_frame, list); + return list_entry(element, struct iwl4965_frame, list); } -static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) +static void iwl4965_free_frame(struct iwl4965_priv *priv, struct iwl4965_frame *frame) { memset(frame, 0, sizeof(*frame)); list_add(&frame->list, &priv->free_frames); } -unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, +unsigned int iwl4965_fill_beacon_frame(struct iwl4965_priv *priv, struct ieee80211_hdr *hdr, const u8 *dest, int left) { - if (!iwl_is_associated(priv) || !priv->ibss_beacon || + if (!iwl4965_is_associated(priv) || !priv->ibss_beacon || ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && (priv->iw_mode != IEEE80211_IF_TYPE_AP))) return 0; @@ -1484,7 +1484,7 @@ unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, return priv->ibss_beacon->len; } -int iwl_rate_index_from_plcp(int plcp) +int iwl4965_rate_index_from_plcp(int plcp) { int i = 0; @@ -1502,34 +1502,34 @@ int iwl_rate_index_from_plcp(int plcp) (i <= IWL_LAST_OFDM_RATE)) return i; } else { - for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) - if (iwl_rates[i].plcp == (plcp &0xFF)) + for (i = 0; i < ARRAY_SIZE(iwl4965_rates); i++) + if (iwl4965_rates[i].plcp == (plcp &0xFF)) return i; } return -1; } -static u8 iwl_rate_get_lowest_plcp(int rate_mask) +static u8 iwl4965_rate_get_lowest_plcp(int rate_mask) { u8 i; for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID; - i = iwl_rates[i].next_ieee) { + i = iwl4965_rates[i].next_ieee) { if (rate_mask & (1 << i)) - return iwl_rates[i].plcp; + return iwl4965_rates[i].plcp; } return IWL_RATE_INVALID; } -static int iwl_send_beacon_cmd(struct iwl_priv *priv) +static int iwl4965_send_beacon_cmd(struct iwl4965_priv *priv) { - struct iwl_frame *frame; + struct iwl4965_frame *frame; unsigned int frame_size; int rc; u8 rate; - frame = iwl_get_free_frame(priv); + frame = iwl4965_get_free_frame(priv); if (!frame) { IWL_ERROR("Could not obtain free frame buffer for beacon " @@ -1538,22 +1538,22 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv) } if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) { - rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & + rate = iwl4965_rate_get_lowest_plcp(priv->active_rate_basic & 0xFF0); if (rate == IWL_INVALID_RATE) rate = IWL_RATE_6M_PLCP; } else { - rate = iwl_rate_get_lowest_plcp(priv->active_rate_basic & 0xF); + rate = iwl4965_rate_get_lowest_plcp(priv->active_rate_basic & 0xF); if (rate == IWL_INVALID_RATE) rate = IWL_RATE_1M_PLCP; } - frame_size = iwl_hw_get_beacon_cmd(priv, frame, rate); + frame_size = iwl4965_hw_get_beacon_cmd(priv, frame, rate); - rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, + rc = iwl4965_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, &frame->u.cmd[0]); - iwl_free_frame(priv, frame); + iwl4965_free_frame(priv, frame); return rc; } @@ -1564,22 +1564,22 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv) * ******************************************************************************/ -static void get_eeprom_mac(struct iwl_priv *priv, u8 *mac) +static void get_eeprom_mac(struct iwl4965_priv *priv, u8 *mac) { memcpy(mac, priv->eeprom.mac_address, 6); } /** - * iwl_eeprom_init - read EEPROM contents + * iwl4965_eeprom_init - read EEPROM contents * * Load the EEPROM from adapter into priv->eeprom * * NOTE: This routine uses the non-debug IO access functions. */ -int iwl_eeprom_init(struct iwl_priv *priv) +int iwl4965_eeprom_init(struct iwl4965_priv *priv) { u16 *e = (u16 *)&priv->eeprom; - u32 gp = iwl_read32(priv, CSR_EEPROM_GP); + u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP); u32 r; int sz = sizeof(priv->eeprom); int rc; @@ -1597,7 +1597,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) return -ENOENT; } - rc = iwl_eeprom_acquire_semaphore(priv); + rc = iwl4965_eeprom_acquire_semaphore(priv); if (rc < 0) { IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); return -ENOENT; @@ -1605,12 +1605,12 @@ int iwl_eeprom_init(struct iwl_priv *priv) /* eeprom is an array of 16bit values */ for (addr = 0; addr < sz; addr += sizeof(u16)) { - _iwl_write32(priv, CSR_EEPROM_REG, addr << 1); - _iwl_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); + _iwl4965_write32(priv, CSR_EEPROM_REG, addr << 1); + _iwl4965_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); for (i = 0; i < IWL_EEPROM_ACCESS_TIMEOUT; i += IWL_EEPROM_ACCESS_DELAY) { - r = _iwl_read_direct32(priv, CSR_EEPROM_REG); + r = _iwl4965_read_direct32(priv, CSR_EEPROM_REG); if (r & CSR_EEPROM_REG_READ_VALID_MSK) break; udelay(IWL_EEPROM_ACCESS_DELAY); @@ -1626,7 +1626,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) rc = 0; done: - iwl_eeprom_release_semaphore(priv); + iwl4965_eeprom_release_semaphore(priv); return rc; } @@ -1638,19 +1638,19 @@ done: #ifdef CONFIG_IWL4965_DEBUG /** - * iwl_report_frame - dump frame to syslog during debug sessions + * iwl4965_report_frame - dump frame to syslog during debug sessions * * hack this function to show different aspects of received frames, * including selective frame dumps. * group100 parameter selects whether to show 1 out of 100 good frames. * * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type - * info output is okay, but some of this stuff (e.g. iwl_rx_frame_stats) + * info output is okay, but some of this stuff (e.g. iwl4965_rx_frame_stats) * is 3945-specific and gives bad output for 4965. Need to split the * functionality, keep common stuff here. */ -void iwl_report_frame(struct iwl_priv *priv, - struct iwl_rx_packet *pkt, +void iwl4965_report_frame(struct iwl4965_priv *priv, + struct iwl4965_rx_packet *pkt, struct ieee80211_hdr *header, int group100) { u32 to_us; @@ -1672,9 +1672,9 @@ void iwl_report_frame(struct iwl_priv *priv, u8 agc; u16 sig_avg; u16 noise_diff; - struct iwl_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); - struct iwl_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); - struct iwl_rx_frame_end *rx_end = IWL_RX_END(pkt); + struct iwl4965_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); + struct iwl4965_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); + struct iwl4965_rx_frame_end *rx_end = IWL_RX_END(pkt); u8 *data = IWL_RX_DATA(pkt); /* MAC header */ @@ -1750,11 +1750,11 @@ void iwl_report_frame(struct iwl_priv *priv, else title = "Frame"; - rate = iwl_rate_index_from_plcp(rate_sym); + rate = iwl4965_rate_index_from_plcp(rate_sym); if (rate == -1) rate = 0; else - rate = iwl_rates[rate].ieee / 2; + rate = iwl4965_rates[rate].ieee / 2; /* print frame summary. * MAC addresses show just the last byte (for brevity), @@ -1776,25 +1776,25 @@ void iwl_report_frame(struct iwl_priv *priv, } } if (print_dump) - iwl_print_hex_dump(IWL_DL_RX, data, length); + iwl4965_print_hex_dump(IWL_DL_RX, data, length); } #endif -static void iwl_unset_hw_setting(struct iwl_priv *priv) +static void iwl4965_unset_hw_setting(struct iwl4965_priv *priv) { if (priv->hw_setting.shared_virt) pci_free_consistent(priv->pci_dev, - sizeof(struct iwl_shared), + sizeof(struct iwl4965_shared), priv->hw_setting.shared_virt, priv->hw_setting.shared_phys); } /** - * iwl_supported_rate_to_ie - fill in the supported rate in IE field + * iwl4965_supported_rate_to_ie - fill in the supported rate in IE field * * return : set the bit for each supported rate insert in ie */ -static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, +static u16 iwl4965_supported_rate_to_ie(u8 *ie, u16 supported_rate, u16 basic_rate, int *left) { u16 ret_rates = 0, bit; @@ -1805,7 +1805,7 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { if (bit & supported_rate) { ret_rates |= bit; - rates[*cnt] = iwl_rates[i].ieee | + rates[*cnt] = iwl4965_rates[i].ieee | ((bit & basic_rate) ? 0x80 : 0x00); (*cnt)++; (*left)--; @@ -1819,15 +1819,15 @@ static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, } #ifdef CONFIG_IWL4965_HT -void static iwl_set_ht_capab(struct ieee80211_hw *hw, +void static iwl4965_set_ht_capab(struct ieee80211_hw *hw, struct ieee80211_ht_capability *ht_cap, u8 use_wide_chan); #endif /** - * iwl_fill_probe_req - fill in all required fields and IE for probe request + * iwl4965_fill_probe_req - fill in all required fields and IE for probe request */ -static u16 iwl_fill_probe_req(struct iwl_priv *priv, +static u16 iwl4965_fill_probe_req(struct iwl4965_priv *priv, struct ieee80211_mgmt *frame, int left, int is_direct) { @@ -1843,9 +1843,9 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, len += 24; frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); - memcpy(frame->da, BROADCAST_ADDR, ETH_ALEN); + memcpy(frame->da, iwl4965_broadcast_addr, ETH_ALEN); memcpy(frame->sa, priv->mac_addr, ETH_ALEN); - memcpy(frame->bssid, BROADCAST_ADDR, ETH_ALEN); + memcpy(frame->bssid, iwl4965_broadcast_addr, ETH_ALEN); frame->seq_ctrl = 0; /* fill in our indirect SSID IE */ @@ -1890,11 +1890,11 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, active_rate_basic = active_rates & IWL_BASIC_RATES_MASK; cck_rates = IWL_CCK_RATES_MASK & active_rates; - ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, + ret_rates = iwl4965_supported_rate_to_ie(pos, cck_rates, active_rate_basic, &left); active_rates &= ~ret_rates; - ret_rates = iwl_supported_rate_to_ie(pos, active_rates, + ret_rates = iwl4965_supported_rate_to_ie(pos, active_rates, active_rate_basic, &left); active_rates &= ~ret_rates; @@ -1911,7 +1911,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, /* ... fill it in... */ *pos++ = WLAN_EID_EXT_SUPP_RATES; *pos = 0; - iwl_supported_rate_to_ie(pos, active_rates, + iwl4965_supported_rate_to_ie(pos, active_rates, active_rate_basic, &left); if (*pos > 0) len += 2 + *pos; @@ -1925,7 +1925,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, pos += (*pos) + 1; *pos++ = WLAN_EID_HT_CAPABILITY; *pos++ = sizeof(struct ieee80211_ht_capability); - iwl_set_ht_capab(NULL, (struct ieee80211_ht_capability *)pos, + iwl4965_set_ht_capab(NULL, (struct ieee80211_ht_capability *)pos, use_wide_chan); len += 2 + sizeof(struct ieee80211_ht_capability); } @@ -1939,15 +1939,15 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv, * QoS support */ #ifdef CONFIG_IWL4965_QOS -static int iwl_send_qos_params_command(struct iwl_priv *priv, - struct iwl_qosparam_cmd *qos) +static int iwl4965_send_qos_params_command(struct iwl4965_priv *priv, + struct iwl4965_qosparam_cmd *qos) { - return iwl_send_cmd_pdu(priv, REPLY_QOS_PARAM, - sizeof(struct iwl_qosparam_cmd), qos); + return iwl4965_send_cmd_pdu(priv, REPLY_QOS_PARAM, + sizeof(struct iwl4965_qosparam_cmd), qos); } -static void iwl_reset_qos(struct iwl_priv *priv) +static void iwl4965_reset_qos(struct iwl4965_priv *priv) { u16 cw_min = 15; u16 cw_max = 1023; @@ -2034,7 +2034,7 @@ static void iwl_reset_qos(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } -static void iwl_activate_qos(struct iwl_priv *priv, u8 force) +static void iwl4965_activate_qos(struct iwl4965_priv *priv, u8 force) { unsigned long flags; @@ -2062,12 +2062,12 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) spin_unlock_irqrestore(&priv->lock, flags); - if (force || iwl_is_associated(priv)) { + if (force || iwl4965_is_associated(priv)) { IWL_DEBUG_QOS("send QoS cmd with Qos active=%d FLAGS=0x%X\n", priv->qos_data.qos_active, priv->qos_data.def_qos_parm.qos_flags); - iwl_send_qos_params_command(priv, + iwl4965_send_qos_params_command(priv, &(priv->qos_data.def_qos_parm)); } } @@ -2090,7 +2090,7 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) /* default power management (not Tx power) table values */ /* for tim 0-10 */ -static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { +static struct iwl4965_power_vec_entry range_0[IWL_POWER_AC] = { {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0}, @@ -2100,7 +2100,7 @@ static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { }; /* for tim > 10 */ -static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { +static struct iwl4965_power_vec_entry range_1[IWL_POWER_AC] = { {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, @@ -2113,11 +2113,11 @@ static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} }; -int iwl_power_init_handle(struct iwl_priv *priv) +int iwl4965_power_init_handle(struct iwl4965_priv *priv) { int rc = 0, i; - struct iwl_power_mgr *pow_data; - int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_AC; + struct iwl4965_power_mgr *pow_data; + int size = sizeof(struct iwl4965_power_vec_entry) * IWL_POWER_AC; u16 pci_pm; IWL_DEBUG_POWER("Initialize power \n"); @@ -2136,7 +2136,7 @@ int iwl_power_init_handle(struct iwl_priv *priv) if (rc != 0) return 0; else { - struct iwl_powertable_cmd *cmd; + struct iwl4965_powertable_cmd *cmd; IWL_DEBUG_POWER("adjust power command flags\n"); @@ -2152,15 +2152,15 @@ int iwl_power_init_handle(struct iwl_priv *priv) return rc; } -static int iwl_update_power_cmd(struct iwl_priv *priv, - struct iwl_powertable_cmd *cmd, u32 mode) +static int iwl4965_update_power_cmd(struct iwl4965_priv *priv, + struct iwl4965_powertable_cmd *cmd, u32 mode) { int rc = 0, i; u8 skip; u32 max_sleep = 0; - struct iwl_power_vec_entry *range; + struct iwl4965_power_vec_entry *range; u8 period = 0; - struct iwl_power_mgr *pow_data; + struct iwl4965_power_mgr *pow_data; if (mode > IWL_POWER_INDEX_5) { IWL_DEBUG_POWER("Error invalid power mode \n"); @@ -2173,7 +2173,7 @@ static int iwl_update_power_cmd(struct iwl_priv *priv, else range = &pow_data->pwr_range_1[1]; - memcpy(cmd, &range[mode].cmd, sizeof(struct iwl_powertable_cmd)); + memcpy(cmd, &range[mode].cmd, sizeof(struct iwl4965_powertable_cmd)); #ifdef IWL_MAC80211_DISABLE if (priv->assoc_network != NULL) { @@ -2216,11 +2216,11 @@ static int iwl_update_power_cmd(struct iwl_priv *priv, return rc; } -static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) +static int iwl4965_send_power_mode(struct iwl4965_priv *priv, u32 mode) { u32 final_mode = mode; int rc; - struct iwl_powertable_cmd cmd; + struct iwl4965_powertable_cmd cmd; /* If on battery, set to 3, * if plugged into AC power, set to CAM ("continuously aware mode"), @@ -2239,9 +2239,9 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) cmd.keep_alive_beacons = 0; - iwl_update_power_cmd(priv, &cmd, final_mode); + iwl4965_update_power_cmd(priv, &cmd, final_mode); - rc = iwl_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); + rc = iwl4965_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); if (final_mode == IWL_POWER_MODE_CAM) clear_bit(STATUS_POWER_PMI, &priv->status); @@ -2251,7 +2251,7 @@ static int iwl_send_power_mode(struct iwl_priv *priv, u32 mode) return rc; } -int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) +int iwl4965_is_network_packet(struct iwl4965_priv *priv, struct ieee80211_hdr *header) { /* Filter incoming packets to determine if they are targeted toward * this network, discarding packets coming from ourselves */ @@ -2281,7 +2281,7 @@ int iwl_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x -static const char *iwl_get_tx_fail_reason(u32 status) +static const char *iwl4965_get_tx_fail_reason(u32 status) { switch (status & TX_STATUS_MSK) { case TX_STATUS_SUCCESS: @@ -2308,11 +2308,11 @@ static const char *iwl_get_tx_fail_reason(u32 status) } /** - * iwl_scan_cancel - Cancel any currently executing HW scan + * iwl4965_scan_cancel - Cancel any currently executing HW scan * * NOTE: priv->mutex is not required before calling this function */ -static int iwl_scan_cancel(struct iwl_priv *priv) +static int iwl4965_scan_cancel(struct iwl4965_priv *priv) { if (!test_bit(STATUS_SCAN_HW, &priv->status)) { clear_bit(STATUS_SCANNING, &priv->status); @@ -2335,17 +2335,17 @@ static int iwl_scan_cancel(struct iwl_priv *priv) } /** - * iwl_scan_cancel_timeout - Cancel any currently executing HW scan + * iwl4965_scan_cancel_timeout - Cancel any currently executing HW scan * @ms: amount of time to wait (in milliseconds) for scan to abort * * NOTE: priv->mutex must be held before calling this function */ -static int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) +static int iwl4965_scan_cancel_timeout(struct iwl4965_priv *priv, unsigned long ms) { unsigned long now = jiffies; int ret; - ret = iwl_scan_cancel(priv); + ret = iwl4965_scan_cancel(priv); if (ret && ms) { mutex_unlock(&priv->mutex); while (!time_after(jiffies, now + msecs_to_jiffies(ms)) && @@ -2359,7 +2359,7 @@ static int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) return ret; } -static void iwl_sequence_reset(struct iwl_priv *priv) +static void iwl4965_sequence_reset(struct iwl4965_priv *priv) { /* Reset ieee stats */ @@ -2370,13 +2370,13 @@ static void iwl_sequence_reset(struct iwl_priv *priv) priv->last_frag_num = -1; priv->last_packet_time = 0; - iwl_scan_cancel(priv); + iwl4965_scan_cancel(priv); } #define MAX_UCODE_BEACON_INTERVAL 4096 #define INTEL_CONN_LISTEN_INTERVAL __constant_cpu_to_le16(0xA) -static __le16 iwl_adjust_beacon_interval(u16 beacon_val) +static __le16 iwl4965_adjust_beacon_interval(u16 beacon_val) { u16 new_val = 0; u16 beacon_factor = 0; @@ -2389,7 +2389,7 @@ static __le16 iwl_adjust_beacon_interval(u16 beacon_val) return cpu_to_le16(new_val); } -static void iwl_setup_rxon_timing(struct iwl_priv *priv) +static void iwl4965_setup_rxon_timing(struct iwl4965_priv *priv) { u64 interval_tm_unit; u64 tsf, result; @@ -2419,14 +2419,14 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv) priv->rxon_timing.beacon_interval = cpu_to_le16(beacon_int); priv->rxon_timing.beacon_interval = - iwl_adjust_beacon_interval( + iwl4965_adjust_beacon_interval( le16_to_cpu(priv->rxon_timing.beacon_interval)); } priv->rxon_timing.atim_window = 0; } else { priv->rxon_timing.beacon_interval = - iwl_adjust_beacon_interval(conf->beacon_int); + iwl4965_adjust_beacon_interval(conf->beacon_int); /* TODO: we need to get atim_window from upper stack * for now we set to 0 */ priv->rxon_timing.atim_window = 0; @@ -2445,14 +2445,14 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv) le16_to_cpu(priv->rxon_timing.atim_window)); } -static int iwl_scan_initiate(struct iwl_priv *priv) +static int iwl4965_scan_initiate(struct iwl4965_priv *priv) { if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { IWL_ERROR("APs don't scan.\n"); return 0; } - if (!iwl_is_ready_rf(priv)) { + if (!iwl4965_is_ready_rf(priv)) { IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); return -EIO; } @@ -2479,9 +2479,9 @@ static int iwl_scan_initiate(struct iwl_priv *priv) return 0; } -static int iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) +static int iwl4965_set_rxon_hwcrypto(struct iwl4965_priv *priv, int hw_decrypt) { - struct iwl_rxon_cmd *rxon = &priv->staging_rxon; + struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; if (hw_decrypt) rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; @@ -2491,7 +2491,7 @@ static int iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) return 0; } -static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) +static void iwl4965_set_flags_for_phymode(struct iwl4965_priv *priv, u8 phymode) { if (phymode == MODE_IEEE80211A) { priv->staging_rxon.flags &= @@ -2499,7 +2499,7 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) | RXON_FLG_CCK_MSK); priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; } else { - /* Copied from iwl_bg_post_associate() */ + /* Copied from iwl4965_bg_post_associate() */ if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; else @@ -2517,9 +2517,9 @@ static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode) /* * initialize rxon structure with default values from eeprom */ -static void iwl_connection_init_rx_config(struct iwl_priv *priv) +static void iwl4965_connection_init_rx_config(struct iwl4965_priv *priv) { - const struct iwl_channel_info *ch_info; + const struct iwl4965_channel_info *ch_info; memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); @@ -2556,7 +2556,7 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv) priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; #endif - ch_info = iwl_get_channel_info(priv, priv->phymode, + ch_info = iwl4965_get_channel_info(priv, priv->phymode, le16_to_cpu(priv->staging_rxon.channel)); if (!ch_info) @@ -2576,7 +2576,7 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv) else priv->phymode = MODE_IEEE80211G; - iwl_set_flags_for_phymode(priv, priv->phymode); + iwl4965_set_flags_for_phymode(priv, priv->phymode); priv->staging_rxon.ofdm_basic_rates = (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; @@ -2592,15 +2592,15 @@ static void iwl_connection_init_rx_config(struct iwl_priv *priv) iwl4965_set_rxon_chain(priv); } -static int iwl_set_mode(struct iwl_priv *priv, int mode) +static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode) { - if (!iwl_is_ready_rf(priv)) + if (!iwl4965_is_ready_rf(priv)) return -EAGAIN; if (mode == IEEE80211_IF_TYPE_IBSS) { - const struct iwl_channel_info *ch_info; + const struct iwl4965_channel_info *ch_info; - ch_info = iwl_get_channel_info(priv, + ch_info = iwl4965_get_channel_info(priv, priv->phymode, le16_to_cpu(priv->staging_rxon.channel)); @@ -2612,7 +2612,7 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode) } cancel_delayed_work(&priv->scan_check); - if (iwl_scan_cancel_timeout(priv, 100)) { + if (iwl4965_scan_cancel_timeout(priv, 100)) { IWL_WARNING("Aborted scan still in progress after 100ms\n"); IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); return -EAGAIN; @@ -2620,23 +2620,23 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode) priv->iw_mode = mode; - iwl_connection_init_rx_config(priv); + iwl4965_connection_init_rx_config(priv); memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); - iwl_clear_stations_table(priv); + iwl4965_clear_stations_table(priv); - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); return 0; } -static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv, +static void iwl4965_build_tx_cmd_hwcrypto(struct iwl4965_priv *priv, struct ieee80211_tx_control *ctl, - struct iwl_cmd *cmd, + struct iwl4965_cmd *cmd, struct sk_buff *skb_frag, int last_frag) { - struct iwl_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo; + struct iwl4965_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo; switch (keyinfo->alg) { case ALG_CCMP: @@ -2679,8 +2679,8 @@ static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv, /* * handle build REPLY_TX command notification. */ -static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, - struct iwl_cmd *cmd, +static void iwl4965_build_tx_cmd_basic(struct iwl4965_priv *priv, + struct iwl4965_cmd *cmd, struct ieee80211_tx_control *ctrl, struct ieee80211_hdr *hdr, int is_unicast, u8 std_id) @@ -2739,7 +2739,7 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, cmd->cmd.tx.next_frame_len = 0; } -static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) +static int iwl4965_get_sta_id(struct iwl4965_priv *priv, struct ieee80211_hdr *hdr) { int sta_id; u16 fc = le16_to_cpu(hdr->frame_control); @@ -2760,7 +2760,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) /* If we are an AP, then find the station, or use BCAST */ case IEEE80211_IF_TYPE_AP: - sta_id = iwl_hw_find_station(priv, hdr->addr1); + sta_id = iwl4965_hw_find_station(priv, hdr->addr1); if (sta_id != IWL_INVALID_STATION) return sta_id; return priv->hw_setting.bcast_sta_id; @@ -2768,11 +2768,11 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) /* If this frame is part of a IBSS network, then we use the * target specific station id */ case IEEE80211_IF_TYPE_IBSS: - sta_id = iwl_hw_find_station(priv, hdr->addr1); + sta_id = iwl4965_hw_find_station(priv, hdr->addr1); if (sta_id != IWL_INVALID_STATION) return sta_id; - sta_id = iwl_add_station(priv, hdr->addr1, 0, CMD_ASYNC); + sta_id = iwl4965_add_station_flags(priv, hdr->addr1, 0, CMD_ASYNC); if (sta_id != IWL_INVALID_STATION) return sta_id; @@ -2780,7 +2780,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) IWL_DEBUG_DROP("Station %s not in station map. " "Defaulting to broadcast...\n", print_mac(mac, hdr->addr1)); - iwl_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); + iwl4965_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); return priv->hw_setting.bcast_sta_id; default: @@ -2792,18 +2792,18 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) /* * start REPLY_TX command process */ -static int iwl_tx_skb(struct iwl_priv *priv, +static int iwl4965_tx_skb(struct iwl4965_priv *priv, struct sk_buff *skb, struct ieee80211_tx_control *ctl) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct iwl_tfd_frame *tfd; + struct iwl4965_tfd_frame *tfd; u32 *control_flags; int txq_id = ctl->queue; - struct iwl_tx_queue *txq = NULL; - struct iwl_queue *q = NULL; + struct iwl4965_tx_queue *txq = NULL; + struct iwl4965_queue *q = NULL; dma_addr_t phys_addr; dma_addr_t txcmd_phys; - struct iwl_cmd *out_cmd = NULL; + struct iwl4965_cmd *out_cmd = NULL; u16 len, idx, len_org; u8 id, hdr_len, unicast; u8 sta_id; @@ -2815,7 +2815,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, int rc; spin_lock_irqsave(&priv->lock, flags); - if (iwl_is_rfkill(priv)) { + if (iwl4965_is_rfkill(priv)) { IWL_DEBUG_DROP("Dropping - RF KILL\n"); goto drop_unlock; } @@ -2844,16 +2844,16 @@ static int iwl_tx_skb(struct iwl_priv *priv, IWL_DEBUG_TX("Sending REASSOC frame\n"); #endif - if (!iwl_is_associated(priv) && + if (!iwl4965_is_associated(priv) && ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { - IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n"); + IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n"); goto drop_unlock; } spin_unlock_irqrestore(&priv->lock, flags); hdr_len = ieee80211_get_hdrlen(fc); - sta_id = iwl_get_sta_id(priv, hdr); + sta_id = iwl4965_get_sta_id(priv, hdr); if (sta_id == IWL_INVALID_STATION) { DECLARE_MAC_BUF(mac); @@ -2891,7 +2891,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, control_flags = (u32 *) tfd; idx = get_cmd_index(q, q->write_ptr, 0); - memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); + memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl4965_tx_info)); txq->txb[q->write_ptr].skb[0] = skb; memcpy(&(txq->txb[q->write_ptr].status.control), ctl, sizeof(struct ieee80211_tx_control)); @@ -2906,7 +2906,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, /* hdr = (struct ieee80211_hdr *)out_cmd->cmd.tx.hdr; */ len = priv->hw_setting.tx_cmd_len + - sizeof(struct iwl_cmd_header) + hdr_len; + sizeof(struct iwl4965_cmd_header) + hdr_len; len_org = len; len = (len + 3) & ~3; @@ -2916,20 +2916,20 @@ static int iwl_tx_skb(struct iwl_priv *priv, else len_org = 0; - txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx + - offsetof(struct iwl_cmd, hdr); + txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl4965_cmd) * idx + + offsetof(struct iwl4965_cmd, hdr); - iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); + iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) - iwl_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); + iwl4965_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); /* 802.11 null functions have no payload... */ len = skb->len - hdr_len; if (len) { phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, len, PCI_DMA_TODEVICE); - iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len); + iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len); } if (len_org) @@ -2939,10 +2939,10 @@ static int iwl_tx_skb(struct iwl_priv *priv, out_cmd->cmd.tx.len = cpu_to_le16(len); /* TODO need this for burst mode later on */ - iwl_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id); + iwl4965_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id); /* set is_hcca to 0; it probably will never be implemented */ - iwl_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); + iwl4965_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); iwl4965_tx_cmd(priv, out_cmd, sta_id, txcmd_phys, hdr, hdr_len, ctl, NULL); @@ -2958,27 +2958,27 @@ static int iwl_tx_skb(struct iwl_priv *priv, txq->need_update = 0; } - iwl_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, + iwl4965_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, sizeof(out_cmd->cmd.tx)); - iwl_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, + iwl4965_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, ieee80211_get_hdrlen(fc)); iwl4965_tx_queue_update_wr_ptr(priv, txq, len); - q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); - rc = iwl_tx_queue_update_write_ptr(priv, txq); + q->write_ptr = iwl4965_queue_inc_wrap(q->write_ptr, q->n_bd); + rc = iwl4965_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); if (rc) return rc; - if ((iwl_queue_space(q) < q->high_mark) + if ((iwl4965_queue_space(q) < q->high_mark) && priv->mac80211_registered) { if (wait_write_ptr) { spin_lock_irqsave(&priv->lock, flags); txq->need_update = 1; - iwl_tx_queue_update_write_ptr(priv, txq); + iwl4965_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); } @@ -2993,13 +2993,13 @@ drop: return -1; } -static void iwl_set_rate(struct iwl_priv *priv) +static void iwl4965_set_rate(struct iwl4965_priv *priv) { const struct ieee80211_hw_mode *hw = NULL; struct ieee80211_rate *rate; int i; - hw = iwl_get_hw_mode(priv, priv->phymode); + hw = iwl4965_get_hw_mode(priv, priv->phymode); if (!hw) { IWL_ERROR("Failed to set rate: unable to get hw mode\n"); return; @@ -3017,7 +3017,7 @@ static void iwl_set_rate(struct iwl_priv *priv) if ((rate->val < IWL_RATE_COUNT) && (rate->flags & IEEE80211_RATE_SUPPORTED)) { IWL_DEBUG_RATE("Adding rate index %d (plcp %d)%s\n", - rate->val, iwl_rates[rate->val].plcp, + rate->val, iwl4965_rates[rate->val].plcp, (rate->flags & IEEE80211_RATE_BASIC) ? "*" : ""); priv->active_rate |= (1 << rate->val); @@ -3025,7 +3025,7 @@ static void iwl_set_rate(struct iwl_priv *priv) priv->active_rate_basic |= (1 << rate->val); } else IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n", - rate->val, iwl_rates[rate->val].plcp); + rate->val, iwl4965_rates[rate->val].plcp); } IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n", @@ -3054,7 +3054,7 @@ static void iwl_set_rate(struct iwl_priv *priv) (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; } -static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) +static void iwl4965_radio_kill_sw(struct iwl4965_priv *priv, int disable_radio) { unsigned long flags; @@ -3065,21 +3065,21 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) disable_radio ? "OFF" : "ON"); if (disable_radio) { - iwl_scan_cancel(priv); + iwl4965_scan_cancel(priv); /* FIXME: This is a workaround for AP */ if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { spin_lock_irqsave(&priv->lock, flags); - iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_SW_BIT_RFKILL); spin_unlock_irqrestore(&priv->lock, flags); - iwl_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0); + iwl4965_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0); set_bit(STATUS_RF_KILL_SW, &priv->status); } return; } spin_lock_irqsave(&priv->lock, flags); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); clear_bit(STATUS_RF_KILL_SW, &priv->status); spin_unlock_irqrestore(&priv->lock, flags); @@ -3088,9 +3088,9 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) msleep(10); spin_lock_irqsave(&priv->lock, flags); - iwl_read32(priv, CSR_UCODE_DRV_GP1); - if (!iwl_grab_nic_access(priv)) - iwl_release_nic_access(priv); + iwl4965_read32(priv, CSR_UCODE_DRV_GP1); + if (!iwl4965_grab_nic_access(priv)) + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { @@ -3103,7 +3103,7 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio) return; } -void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, +void iwl4965_set_decrypted_flag(struct iwl4965_priv *priv, struct sk_buff *skb, u32 decrypt_res, struct ieee80211_rx_status *stats) { u16 fc = @@ -3135,13 +3135,13 @@ void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, } } -void iwl_handle_data_packet_monitor(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb, +void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb, void *data, short len, struct ieee80211_rx_status *stats, u16 phy_flags) { - struct iwl_rt_rx_hdr *iwl_rt; + struct iwl4965_rt_rx_hdr *iwl4965_rt; /* First cache any information we need before we overwrite * the information provided in the skb from the hardware */ @@ -3152,26 +3152,26 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv, __le16 phy_flags_hw = cpu_to_le16(phy_flags); /* We received data from the HW, so stop the watchdog */ - if (len > IWL_RX_BUF_SIZE - sizeof(*iwl_rt)) { + if (len > IWL_RX_BUF_SIZE - sizeof(*iwl4965_rt)) { IWL_DEBUG_DROP("Dropping too large packet in monitor\n"); return; } /* copy the frame data to write after where the radiotap header goes */ - iwl_rt = (void *)rxb->skb->data; - memmove(iwl_rt->payload, data, len); + iwl4965_rt = (void *)rxb->skb->data; + memmove(iwl4965_rt->payload, data, len); - iwl_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; - iwl_rt->rt_hdr.it_pad = 0; /* always good to zero */ + iwl4965_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; + iwl4965_rt->rt_hdr.it_pad = 0; /* always good to zero */ /* total header + data */ - iwl_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl_rt)); + iwl4965_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl4965_rt)); /* Set the size of the skb to the size of the frame */ - skb_put(rxb->skb, sizeof(*iwl_rt) + len); + skb_put(rxb->skb, sizeof(*iwl4965_rt) + len); /* Big bitfield of all the fields we provide in radiotap */ - iwl_rt->rt_hdr.it_present = + iwl4965_rt->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | (1 << IEEE80211_RADIOTAP_FLAGS) | (1 << IEEE80211_RADIOTAP_RATE) | @@ -3181,39 +3181,39 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv, (1 << IEEE80211_RADIOTAP_ANTENNA)); /* Zero the flags, we'll add to them as we go */ - iwl_rt->rt_flags = 0; + iwl4965_rt->rt_flags = 0; - iwl_rt->rt_tsf = cpu_to_le64(tsf); + iwl4965_rt->rt_tsf = cpu_to_le64(tsf); /* Convert to dBm */ - iwl_rt->rt_dbmsignal = signal; - iwl_rt->rt_dbmnoise = noise; + iwl4965_rt->rt_dbmsignal = signal; + iwl4965_rt->rt_dbmnoise = noise; /* Convert the channel frequency and set the flags */ - iwl_rt->rt_channelMHz = cpu_to_le16(stats->freq); + iwl4965_rt->rt_channelMHz = cpu_to_le16(stats->freq); if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) - iwl_rt->rt_chbitmask = + iwl4965_rt->rt_chbitmask = cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) - iwl_rt->rt_chbitmask = + iwl4965_rt->rt_chbitmask = cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); else /* 802.11g */ - iwl_rt->rt_chbitmask = + iwl4965_rt->rt_chbitmask = cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ)); - rate = iwl_rate_index_from_plcp(rate); + rate = iwl4965_rate_index_from_plcp(rate); if (rate == -1) - iwl_rt->rt_rate = 0; + iwl4965_rt->rt_rate = 0; else - iwl_rt->rt_rate = iwl_rates[rate].ieee; + iwl4965_rt->rt_rate = iwl4965_rates[rate].ieee; /* antenna number */ - iwl_rt->rt_antenna = + iwl4965_rt->rt_antenna = le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; /* set the preamble flag if we have it */ if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) - iwl_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + iwl4965_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; IWL_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); @@ -3225,7 +3225,7 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv, #define IWL_PACKET_RETRY_TIME HZ -int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) +int iwl4965_is_duplicate_packet(struct iwl4965_priv *priv, struct ieee80211_hdr *header) { u16 sc = le16_to_cpu(header->seq_ctrl); u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4; @@ -3236,12 +3236,12 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) switch (priv->iw_mode) { case IEEE80211_IF_TYPE_IBSS:{ struct list_head *p; - struct iwl_ibss_seq *entry = NULL; + struct iwl4965_ibss_seq *entry = NULL; u8 *mac = header->addr2; int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1); __list_for_each(p, &priv->ibss_mac_hash[index]) { - entry = list_entry(p, struct iwl_ibss_seq, list); + entry = list_entry(p, struct iwl4965_ibss_seq, list); if (!compare_ether_addr(entry->mac, mac)) break; } @@ -3304,7 +3304,7 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) * the lower 3 bytes is the time in usec within one beacon interval */ -static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval) +static u32 iwl4965_usecs_to_beacons(u32 usec, u32 beacon_interval) { u32 quot; u32 rem; @@ -3323,7 +3323,7 @@ static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval) * the same as HW timer counter counting down */ -static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) +static __le32 iwl4965_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) { u32 base_low = base & BEACON_TIME_MASK_LOW; u32 addon_low = addon & BEACON_TIME_MASK_LOW; @@ -3342,13 +3342,13 @@ static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) return cpu_to_le32(res); } -static int iwl_get_measurement(struct iwl_priv *priv, +static int iwl4965_get_measurement(struct iwl4965_priv *priv, struct ieee80211_measurement_params *params, u8 type) { - struct iwl_spectrum_cmd spectrum; - struct iwl_rx_packet *res; - struct iwl_host_cmd cmd = { + struct iwl4965_spectrum_cmd spectrum; + struct iwl4965_rx_packet *res; + struct iwl4965_host_cmd cmd = { .id = REPLY_SPECTRUM_MEASUREMENT_CMD, .data = (void *)&spectrum, .meta.flags = CMD_WANT_SKB, @@ -3358,9 +3358,9 @@ static int iwl_get_measurement(struct iwl_priv *priv, int spectrum_resp_status; int duration = le16_to_cpu(params->duration); - if (iwl_is_associated(priv)) + if (iwl4965_is_associated(priv)) add_time = - iwl_usecs_to_beacons( + iwl4965_usecs_to_beacons( le64_to_cpu(params->start_time) - priv->last_tsf, le16_to_cpu(priv->rxon_timing.beacon_interval)); @@ -3373,9 +3373,9 @@ static int iwl_get_measurement(struct iwl_priv *priv, cmd.len = sizeof(spectrum); spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); - if (iwl_is_associated(priv)) + if (iwl4965_is_associated(priv)) spectrum.start_time = - iwl_add_beacon_time(priv->last_beacon_time, + iwl4965_add_beacon_time(priv->last_beacon_time, add_time, le16_to_cpu(priv->rxon_timing.beacon_interval)); else @@ -3388,11 +3388,11 @@ static int iwl_get_measurement(struct iwl_priv *priv, spectrum.flags |= RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; - rc = iwl_send_cmd_sync(priv, &cmd); + rc = iwl4965_send_cmd_sync(priv, &cmd); if (rc) return rc; - res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; + res = (struct iwl4965_rx_packet *)cmd.meta.u.skb->data; if (res->hdr.flags & IWL_CMD_FAILED_MSK) { IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n"); rc = -EIO; @@ -3422,8 +3422,8 @@ static int iwl_get_measurement(struct iwl_priv *priv, } #endif -static void iwl_txstatus_to_ieee(struct iwl_priv *priv, - struct iwl_tx_info *tx_sta) +static void iwl4965_txstatus_to_ieee(struct iwl4965_priv *priv, + struct iwl4965_tx_info *tx_sta) { tx_sta->status.ack_signal = 0; @@ -3442,16 +3442,16 @@ static void iwl_txstatus_to_ieee(struct iwl_priv *priv, } /** - * iwl_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC. + * iwl4965_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC. * * When FW advances 'R' index, all entries between old and * new 'R' index need to be reclaimed. As result, some free space * forms. If there is enough free space (> low mark), wake Tx queue. */ -int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) +int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index) { - struct iwl_tx_queue *txq = &priv->txq[txq_id]; - struct iwl_queue *q = &txq->q; + struct iwl4965_tx_queue *txq = &priv->txq[txq_id]; + struct iwl4965_queue *q = &txq->q; int nfreed = 0; if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) { @@ -3461,13 +3461,13 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) return 0; } - for (index = iwl_queue_inc_wrap(index, q->n_bd); + for (index = iwl4965_queue_inc_wrap(index, q->n_bd); q->read_ptr != index; - q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { + q->read_ptr = iwl4965_queue_inc_wrap(q->read_ptr, q->n_bd)) { if (txq_id != IWL_CMD_QUEUE_NUM) { - iwl_txstatus_to_ieee(priv, + iwl4965_txstatus_to_ieee(priv, &(txq->txb[txq->q.read_ptr])); - iwl_hw_txq_free_tfd(priv, txq); + iwl4965_hw_txq_free_tfd(priv, txq); } else if (nfreed > 1) { IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, q->write_ptr, q->read_ptr); @@ -3476,7 +3476,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) nfreed++; } - if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) && + if (iwl4965_queue_space(q) > q->low_mark && (txq_id >= 0) && (txq_id != IWL_CMD_QUEUE_NUM) && priv->mac80211_registered) ieee80211_wake_queue(priv->hw, txq_id); @@ -3485,7 +3485,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) return nfreed; } -static int iwl_is_tx_success(u32 status) +static int iwl4965_is_tx_success(u32 status) { status &= TX_STATUS_MSK; return (status == TX_STATUS_SUCCESS) @@ -3500,19 +3500,19 @@ static int iwl_is_tx_success(u32 status) #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG -static inline int iwl_get_ra_sta_id(struct iwl_priv *priv, +static inline int iwl4965_get_ra_sta_id(struct iwl4965_priv *priv, struct ieee80211_hdr *hdr) { if (priv->iw_mode == IEEE80211_IF_TYPE_STA) return IWL_AP_ID; else { u8 *da = ieee80211_get_DA(hdr); - return iwl_hw_find_station(priv, da); + return iwl4965_hw_find_station(priv, da); } } -static struct ieee80211_hdr *iwl_tx_queue_get_hdr( - struct iwl_priv *priv, int txq_id, int idx) +static struct ieee80211_hdr *iwl4965_tx_queue_get_hdr( + struct iwl4965_priv *priv, int txq_id, int idx) { if (priv->txq[txq_id].txb[idx].skb[0]) return (struct ieee80211_hdr *)priv->txq[txq_id]. @@ -3520,16 +3520,16 @@ static struct ieee80211_hdr *iwl_tx_queue_get_hdr( return NULL; } -static inline u32 iwl_get_scd_ssn(struct iwl_tx_resp *tx_resp) +static inline u32 iwl4965_get_scd_ssn(struct iwl4965_tx_resp *tx_resp) { __le32 *scd_ssn = (__le32 *)((u32 *)&tx_resp->status + tx_resp->frame_count); return le32_to_cpu(*scd_ssn) & MAX_SN; } -static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, - struct iwl_ht_agg *agg, - struct iwl_tx_resp *tx_resp, +static int iwl4965_tx_status_reply_tx(struct iwl4965_priv *priv, + struct iwl4965_ht_agg *agg, + struct iwl4965_tx_resp *tx_resp, u16 start_idx) { u32 status; @@ -3549,7 +3549,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, agg->bitmap0 = agg->bitmap1 = 0; if (agg->frame_count == 1) { - struct iwl_tx_queue *txq ; + struct iwl4965_tx_queue *txq ; status = le32_to_cpu(frame_status[0]); txq_id = agg->txq_id; @@ -3564,16 +3564,16 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, tx_status->queue_length = tx_resp->bt_kill_count; tx_status->queue_length |= tx_resp->failure_rts; - tx_status->flags = iwl_is_tx_success(status)? + tx_status->flags = iwl4965_is_tx_success(status)? IEEE80211_TX_STATUS_ACK : 0; tx_status->control.tx_rate = - iwl_hw_get_rate_n_flags(tx_resp->rate_n_flags); + iwl4965_hw_get_rate_n_flags(tx_resp->rate_n_flags); /* FIXME: code repetition end */ IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n", status & 0xff, tx_resp->failure_frame); IWL_DEBUG_TX_REPLY("Rate Info rate_n_flags=%x\n", - iwl_hw_get_rate_n_flags(tx_resp->rate_n_flags)); + iwl4965_hw_get_rate_n_flags(tx_resp->rate_n_flags)); agg->wait_for_ba = 0; } else { @@ -3594,7 +3594,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, IWL_DEBUG_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n", agg->frame_count, txq_id, idx); - hdr = iwl_tx_queue_get_hdr(priv, txq_id, idx); + hdr = iwl4965_tx_queue_get_hdr(priv, txq_id, idx); sc = le16_to_cpu(hdr->seq_ctrl); if (idx != (SEQ_TO_SN(sc) & 0xff)) { @@ -3643,16 +3643,16 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, #endif #endif -static void iwl_rx_reply_tx(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_reply_tx(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; u16 sequence = le16_to_cpu(pkt->hdr.sequence); int txq_id = SEQ_TO_QUEUE(sequence); int index = SEQ_TO_INDEX(sequence); - struct iwl_tx_queue *txq = &priv->txq[txq_id]; + struct iwl4965_tx_queue *txq = &priv->txq[txq_id]; struct ieee80211_tx_status *tx_status; - struct iwl_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; + struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; u32 status = le32_to_cpu(tx_resp->status); #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG @@ -3671,10 +3671,10 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG if (txq->sched_retry) { - const u32 scd_ssn = iwl_get_scd_ssn(tx_resp); + const u32 scd_ssn = iwl4965_get_scd_ssn(tx_resp); struct ieee80211_hdr *hdr = - iwl_tx_queue_get_hdr(priv, txq_id, index); - struct iwl_ht_agg *agg = NULL; + iwl4965_tx_queue_get_hdr(priv, txq_id, index); + struct iwl4965_ht_agg *agg = NULL; __le16 *qc = ieee80211_get_qos_ctrl(hdr); if (qc == NULL) { @@ -3684,7 +3684,7 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, tid = le16_to_cpu(*qc) & 0xf; - sta_id = iwl_get_ra_sta_id(priv, hdr); + sta_id = iwl4965_get_ra_sta_id(priv, hdr); if (unlikely(sta_id == IWL_INVALID_STATION)) { IWL_ERROR("Station not known for\n"); return; @@ -3695,15 +3695,15 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, iwl4965_tx_status_reply_tx(priv, agg, tx_resp, index); if ((tx_resp->frame_count == 1) && - !iwl_is_tx_success(status)) { + !iwl4965_is_tx_success(status)) { /* TODO: send BAR */ } if ((txq->q.read_ptr != (scd_ssn & 0xff))) { - index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); + index = iwl4965_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn " "%d index %d\n", scd_ssn , index); - iwl_tx_queue_reclaim(priv, txq_id, index); + iwl4965_tx_queue_reclaim(priv, txq_id, index); } } else { #endif /* CONFIG_IWL4965_HT_AGG */ @@ -3716,19 +3716,19 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, tx_status->queue_length |= tx_resp->failure_rts; tx_status->flags = - iwl_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; + iwl4965_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; tx_status->control.tx_rate = - iwl_hw_get_rate_n_flags(tx_resp->rate_n_flags); + iwl4965_hw_get_rate_n_flags(tx_resp->rate_n_flags); IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x " - "retries %d\n", txq_id, iwl_get_tx_fail_reason(status), + "retries %d\n", txq_id, iwl4965_get_tx_fail_reason(status), status, le32_to_cpu(tx_resp->rate_n_flags), tx_resp->failure_frame); IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); if (index != -1) - iwl_tx_queue_reclaim(priv, txq_id, index); + iwl4965_tx_queue_reclaim(priv, txq_id, index); #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG } @@ -3740,11 +3740,11 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, } -static void iwl_rx_reply_alive(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_reply_alive(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_alive_resp *palive; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_alive_resp *palive; struct delayed_work *pwork; palive = &pkt->u.alive_frame; @@ -3758,12 +3758,12 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv, IWL_DEBUG_INFO("Initialization Alive received.\n"); memcpy(&priv->card_alive_init, &pkt->u.alive_frame, - sizeof(struct iwl_init_alive_resp)); + sizeof(struct iwl4965_init_alive_resp)); pwork = &priv->init_alive_start; } else { IWL_DEBUG_INFO("Runtime Alive received.\n"); memcpy(&priv->card_alive, &pkt->u.alive_frame, - sizeof(struct iwl_alive_resp)); + sizeof(struct iwl4965_alive_resp)); pwork = &priv->alive_start; } @@ -3776,19 +3776,19 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv, IWL_WARNING("uCode did not respond OK.\n"); } -static void iwl_rx_reply_add_sta(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_reply_add_sta(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); return; } -static void iwl_rx_reply_error(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_reply_error(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) " "seq 0x%04X ser 0x%08X\n", @@ -3801,23 +3801,23 @@ static void iwl_rx_reply_error(struct iwl_priv *priv, #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x -static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_csa(struct iwl4965_priv *priv, struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon; - struct iwl_csa_notification *csa = &(pkt->u.csa_notif); + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_rxon_cmd *rxon = (void *)&priv->active_rxon; + struct iwl4965_csa_notification *csa = &(pkt->u.csa_notif); IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", le16_to_cpu(csa->channel), le32_to_cpu(csa->status)); rxon->channel = csa->channel; priv->staging_rxon.channel = csa->channel; } -static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_spectrum_measure_notif(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_spectrum_notification *report = &(pkt->u.spectrum_notif); if (!report->state) { IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO, @@ -3830,31 +3830,31 @@ static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv, #endif } -static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_pm_sleep_notif(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { #ifdef CONFIG_IWL4965_DEBUG - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_sleep_notification *sleep = &(pkt->u.sleep_notif); IWL_DEBUG_RX("sleep mode: %d, src: %d\n", sleep->pm_sleep_mode, sleep->pm_wakeup_src); #endif } -static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_pm_debug_statistics_notif(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " "notification for %s:\n", le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); - iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); + iwl4965_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); } -static void iwl_bg_beacon_update(struct work_struct *work) +static void iwl4965_bg_beacon_update(struct work_struct *work) { - struct iwl_priv *priv = - container_of(work, struct iwl_priv, beacon_update); + struct iwl4965_priv *priv = + container_of(work, struct iwl4965_priv, beacon_update); struct sk_buff *beacon; /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ @@ -3873,16 +3873,16 @@ static void iwl_bg_beacon_update(struct work_struct *work) priv->ibss_beacon = beacon; mutex_unlock(&priv->mutex); - iwl_send_beacon_cmd(priv); + iwl4965_send_beacon_cmd(priv); } -static void iwl_rx_beacon_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_beacon_notif(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { #ifdef CONFIG_IWL4965_DEBUG - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_beacon_notif *beacon = &(pkt->u.beacon_status); - u8 rate = iwl_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_beacon_notif *beacon = &(pkt->u.beacon_status); + u8 rate = iwl4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); IWL_DEBUG_RX("beacon status %x retries %d iss %d " "tsf %d %d rate %d\n", @@ -3899,25 +3899,25 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv, } /* Service response to REPLY_SCAN_CMD (0x80) */ -static void iwl_rx_reply_scan(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_reply_scan(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { #ifdef CONFIG_IWL4965_DEBUG - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_scanreq_notification *notif = - (struct iwl_scanreq_notification *)pkt->u.raw; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_scanreq_notification *notif = + (struct iwl4965_scanreq_notification *)pkt->u.raw; IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status); #endif } /* Service SCAN_START_NOTIFICATION (0x82) */ -static void iwl_rx_scan_start_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_scan_start_notif(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_scanstart_notification *notif = - (struct iwl_scanstart_notification *)pkt->u.raw; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_scanstart_notification *notif = + (struct iwl4965_scanstart_notification *)pkt->u.raw; priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); IWL_DEBUG_SCAN("Scan start: " "%d [802.11%s] " @@ -3929,12 +3929,12 @@ static void iwl_rx_scan_start_notif(struct iwl_priv *priv, } /* Service SCAN_RESULTS_NOTIFICATION (0x83) */ -static void iwl_rx_scan_results_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_scan_results_notif(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_scanresults_notification *notif = - (struct iwl_scanresults_notification *)pkt->u.raw; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_scanresults_notification *notif = + (struct iwl4965_scanresults_notification *)pkt->u.raw; IWL_DEBUG_SCAN("Scan ch.res: " "%d [802.11%s] " @@ -3953,11 +3953,11 @@ static void iwl_rx_scan_results_notif(struct iwl_priv *priv, } /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ -static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_scan_complete_notif(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_scancomplete_notification *scan_notif = (void *)pkt->u.raw; IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", scan_notif->scanned_channels, @@ -4010,10 +4010,10 @@ reschedule: /* Handle notification from uCode that card's power state is changing * due to software, hardware, or critical temperature RFKILL */ -static void iwl_rx_card_state_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_rx_card_state_notif(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (void *)rxb->skb->data; + struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); unsigned long status = priv->status; @@ -4024,35 +4024,35 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | RF_CARD_DISABLED)) { - iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - if (!iwl_grab_nic_access(priv)) { - iwl_write_direct32( + if (!iwl4965_grab_nic_access(priv)) { + iwl4965_write_direct32( priv, HBUS_TARG_MBX_C, HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); } if (!(flags & RXON_CARD_DISABLED)) { - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - if (!iwl_grab_nic_access(priv)) { - iwl_write_direct32( + if (!iwl4965_grab_nic_access(priv)) { + iwl4965_write_direct32( priv, HBUS_TARG_MBX_C, HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); } } if (flags & RF_CARD_DISABLED) { - iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); - iwl_read32(priv, CSR_UCODE_DRV_GP1); - if (!iwl_grab_nic_access(priv)) - iwl_release_nic_access(priv); + iwl4965_read32(priv, CSR_UCODE_DRV_GP1); + if (!iwl4965_grab_nic_access(priv)) + iwl4965_release_nic_access(priv); } } @@ -4068,7 +4068,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, clear_bit(STATUS_RF_KILL_SW, &priv->status); if (!(flags & RXON_CARD_DISABLED)) - iwl_scan_cancel(priv); + iwl4965_scan_cancel(priv); if ((test_bit(STATUS_RF_KILL_HW, &status) != test_bit(STATUS_RF_KILL_HW, &priv->status)) || @@ -4080,7 +4080,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, } /** - * iwl_setup_rx_handlers - Initialize Rx handler callbacks + * iwl4965_setup_rx_handlers - Initialize Rx handler callbacks * * Setup the RX handlers for each of the reply types sent from the uCode * to the host. @@ -4088,20 +4088,20 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, * This function chains into the hardware specific files for them to setup * any hardware specific handlers as well. */ -static void iwl_setup_rx_handlers(struct iwl_priv *priv) +static void iwl4965_setup_rx_handlers(struct iwl4965_priv *priv) { - priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive; - priv->rx_handlers[REPLY_ADD_STA] = iwl_rx_reply_add_sta; - priv->rx_handlers[REPLY_ERROR] = iwl_rx_reply_error; - priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa; + priv->rx_handlers[REPLY_ALIVE] = iwl4965_rx_reply_alive; + priv->rx_handlers[REPLY_ADD_STA] = iwl4965_rx_reply_add_sta; + priv->rx_handlers[REPLY_ERROR] = iwl4965_rx_reply_error; + priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl4965_rx_csa; priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = - iwl_rx_spectrum_measure_notif; - priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_rx_pm_sleep_notif; + iwl4965_rx_spectrum_measure_notif; + priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl4965_rx_pm_sleep_notif; priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = - iwl_rx_pm_debug_statistics_notif; - priv->rx_handlers[BEACON_NOTIFICATION] = iwl_rx_beacon_notif; + iwl4965_rx_pm_debug_statistics_notif; + priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif; - /* NOTE: iwl_rx_statistics is different based on whether + /* NOTE: iwl4965_rx_statistics is different based on whether * the build is for the 3945 or the 4965. See the * corresponding implementation in iwl-XXXX.c * @@ -4109,40 +4109,40 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv) * discrete statistics request from the host as well as * for the periodic statistics notification from the uCode */ - priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl_hw_rx_statistics; - priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl_hw_rx_statistics; + priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl4965_hw_rx_statistics; + priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl4965_hw_rx_statistics; - priv->rx_handlers[REPLY_SCAN_CMD] = iwl_rx_reply_scan; - priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl_rx_scan_start_notif; + priv->rx_handlers[REPLY_SCAN_CMD] = iwl4965_rx_reply_scan; + priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl4965_rx_scan_start_notif; priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = - iwl_rx_scan_results_notif; + iwl4965_rx_scan_results_notif; priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = - iwl_rx_scan_complete_notif; - priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl_rx_card_state_notif; - priv->rx_handlers[REPLY_TX] = iwl_rx_reply_tx; + iwl4965_rx_scan_complete_notif; + priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl4965_rx_card_state_notif; + priv->rx_handlers[REPLY_TX] = iwl4965_rx_reply_tx; /* Setup hardware specific Rx handlers */ - iwl_hw_rx_handler_setup(priv); + iwl4965_hw_rx_handler_setup(priv); } /** - * iwl_tx_cmd_complete - Pull unused buffers off the queue and reclaim them + * iwl4965_tx_cmd_complete - Pull unused buffers off the queue and reclaim them * @rxb: Rx buffer to reclaim * * If an Rx buffer has an async callback associated with it the callback * will be executed. The attached skb (if present) will only be freed * if the callback returns 1 */ -static void iwl_tx_cmd_complete(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +static void iwl4965_tx_cmd_complete(struct iwl4965_priv *priv, + struct iwl4965_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; + struct iwl4965_rx_packet *pkt = (struct iwl4965_rx_packet *)rxb->skb->data; u16 sequence = le16_to_cpu(pkt->hdr.sequence); int txq_id = SEQ_TO_QUEUE(sequence); int index = SEQ_TO_INDEX(sequence); int huge = sequence & SEQ_HUGE_FRAME; int cmd_index; - struct iwl_cmd *cmd; + struct iwl4965_cmd *cmd; /* If a Tx command is being handled and it isn't in the actual * command queue then there a command routing bug has been introduced @@ -4163,7 +4163,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv, !cmd->meta.u.callback(priv, cmd, rxb->skb)) rxb->skb = NULL; - iwl_tx_queue_reclaim(priv, txq_id, index); + iwl4965_tx_queue_reclaim(priv, txq_id, index); if (!(cmd->meta.flags & CMD_ASYNC)) { clear_bit(STATUS_HCMD_ACTIVE, &priv->status); @@ -4205,7 +4205,7 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv, * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled * to replenish the iwl->rxq->rx_free. - * + In iwl_rx_replenish (scheduled) if 'processed' != 'read' then the + * + In iwl4965_rx_replenish (scheduled) if 'processed' != 'read' then the * iwl->rxq is replenished and the READ INDEX is updated (updating the * 'processed' and 'read' driver indexes as well) * + A received packet is processed and handed to the kernel network stack, @@ -4218,28 +4218,28 @@ static void iwl_tx_cmd_complete(struct iwl_priv *priv, * * Driver sequence: * - * iwl_rx_queue_alloc() Allocates rx_free - * iwl_rx_replenish() Replenishes rx_free list from rx_used, and calls - * iwl_rx_queue_restock - * iwl_rx_queue_restock() Moves available buffers from rx_free into Rx + * iwl4965_rx_queue_alloc() Allocates rx_free + * iwl4965_rx_replenish() Replenishes rx_free list from rx_used, and calls + * iwl4965_rx_queue_restock + * iwl4965_rx_queue_restock() Moves available buffers from rx_free into Rx * queue, updates firmware pointers, and updates * the WRITE index. If insufficient rx_free buffers - * are available, schedules iwl_rx_replenish + * are available, schedules iwl4965_rx_replenish * * -- enable interrupts -- - * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the + * ISR - iwl4965_rx() Detach iwl4965_rx_mem_buffers from pool up to the * READ INDEX, detaching the SKB from the pool. * Moves the packet buffer from queue to rx_used. - * Calls iwl_rx_queue_restock to refill any empty + * Calls iwl4965_rx_queue_restock to refill any empty * slots. * ... * */ /** - * iwl_rx_queue_space - Return number of free slots available in queue. + * iwl4965_rx_queue_space - Return number of free slots available in queue. */ -static int iwl_rx_queue_space(const struct iwl_rx_queue *q) +static int iwl4965_rx_queue_space(const struct iwl4965_rx_queue *q) { int s = q->read - q->write; if (s <= 0) @@ -4252,7 +4252,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q) } /** - * iwl_rx_queue_update_write_ptr - Update the write pointer for the RX queue + * iwl4965_rx_queue_update_write_ptr - Update the write pointer for the RX queue * * NOTE: This function has 3945 and 4965 specific code sections * but is declared in base due to the majority of the @@ -4260,7 +4260,7 @@ static int iwl_rx_queue_space(const struct iwl_rx_queue *q) * different) * */ -int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) +int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_rx_queue *q) { u32 reg = 0; int rc = 0; @@ -4272,23 +4272,23 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) goto exit_unlock; if (test_bit(STATUS_POWER_PMI, &priv->status)) { - reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); + reg = iwl4965_read32(priv, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - iwl_set_bit(priv, CSR_GP_CNTRL, + iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); goto exit_unlock; } - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) goto exit_unlock; - iwl_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, + iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); } else - iwl_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); + iwl4965_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); q->need_update = 0; @@ -4299,11 +4299,11 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) } /** - * iwl_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer. + * iwl4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer. * * NOTE: This function has 3945 and 4965 specific code paths in it. */ -static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv, +static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl4965_priv *priv, dma_addr_t dma_addr) { return cpu_to_le32((u32)(dma_addr >> 8)); @@ -4311,7 +4311,7 @@ static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv, /** - * iwl_rx_queue_restock - refill RX queue from pre-allocated pool + * iwl4965_rx_queue_restock - refill RX queue from pre-allocated pool * * If there are slots in the RX queue that need to be restocked, * and we have free pre-allocated buffers, fill the ranks as much @@ -4321,21 +4321,21 @@ static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv, * also updates the memory address in the firmware to reference the new * target buffer. */ -static int iwl_rx_queue_restock(struct iwl_priv *priv) +static int iwl4965_rx_queue_restock(struct iwl4965_priv *priv) { - struct iwl_rx_queue *rxq = &priv->rxq; + struct iwl4965_rx_queue *rxq = &priv->rxq; struct list_head *element; - struct iwl_rx_mem_buffer *rxb; + struct iwl4965_rx_mem_buffer *rxb; unsigned long flags; int write, rc; spin_lock_irqsave(&rxq->lock, flags); write = rxq->write & ~0x7; - while ((iwl_rx_queue_space(rxq) > 0) && (rxq->free_count)) { + while ((iwl4965_rx_queue_space(rxq) > 0) && (rxq->free_count)) { element = rxq->rx_free.next; - rxb = list_entry(element, struct iwl_rx_mem_buffer, list); + rxb = list_entry(element, struct iwl4965_rx_mem_buffer, list); list_del(element); - rxq->bd[rxq->write] = iwl_dma_addr2rbd_ptr(priv, rxb->dma_addr); + rxq->bd[rxq->write] = iwl4965_dma_addr2rbd_ptr(priv, rxb->dma_addr); rxq->queue[rxq->write] = rxb; rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; rxq->free_count--; @@ -4353,7 +4353,7 @@ static int iwl_rx_queue_restock(struct iwl_priv *priv) spin_lock_irqsave(&rxq->lock, flags); rxq->need_update = 1; spin_unlock_irqrestore(&rxq->lock, flags); - rc = iwl_rx_queue_update_write_ptr(priv, rxq); + rc = iwl4965_rx_queue_update_write_ptr(priv, rxq); if (rc) return rc; } @@ -4362,24 +4362,24 @@ static int iwl_rx_queue_restock(struct iwl_priv *priv) } /** - * iwl_rx_replenish - Move all used packet from rx_used to rx_free + * iwl4965_rx_replenish - Move all used packet from rx_used to rx_free * * When moving to rx_free an SKB is allocated for the slot. * - * Also restock the Rx queue via iwl_rx_queue_restock. + * Also restock the Rx queue via iwl4965_rx_queue_restock. * This is called as a scheduled work item (except for during initialization) */ -void iwl_rx_replenish(void *data) +void iwl4965_rx_replenish(void *data) { - struct iwl_priv *priv = data; - struct iwl_rx_queue *rxq = &priv->rxq; + struct iwl4965_priv *priv = data; + struct iwl4965_rx_queue *rxq = &priv->rxq; struct list_head *element; - struct iwl_rx_mem_buffer *rxb; + struct iwl4965_rx_mem_buffer *rxb; unsigned long flags; spin_lock_irqsave(&rxq->lock, flags); while (!list_empty(&rxq->rx_used)) { element = rxq->rx_used.next; - rxb = list_entry(element, struct iwl_rx_mem_buffer, list); + rxb = list_entry(element, struct iwl4965_rx_mem_buffer, list); rxb->skb = alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC); if (!rxb->skb) { @@ -4402,7 +4402,7 @@ void iwl_rx_replenish(void *data) spin_unlock_irqrestore(&rxq->lock, flags); spin_lock_irqsave(&priv->lock, flags); - iwl_rx_queue_restock(priv); + iwl4965_rx_queue_restock(priv); spin_unlock_irqrestore(&priv->lock, flags); } @@ -4411,7 +4411,7 @@ void iwl_rx_replenish(void *data) * This free routine walks the list of POOL entries and if SKB is set to * non NULL it is unmapped and freed */ -static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +static void iwl4965_rx_queue_free(struct iwl4965_priv *priv, struct iwl4965_rx_queue *rxq) { int i; for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { @@ -4428,9 +4428,9 @@ static void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) rxq->bd = NULL; } -int iwl_rx_queue_alloc(struct iwl_priv *priv) +int iwl4965_rx_queue_alloc(struct iwl4965_priv *priv) { - struct iwl_rx_queue *rxq = &priv->rxq; + struct iwl4965_rx_queue *rxq = &priv->rxq; struct pci_dev *dev = priv->pci_dev; int i; @@ -4451,7 +4451,7 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv) return 0; } -void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) +void iwl4965_rx_queue_reset(struct iwl4965_priv *priv, struct iwl4965_rx_queue *rxq) { unsigned long flags; int i; @@ -4498,7 +4498,7 @@ static u8 ratio2dB[100] = { /* Calculates a relative dB value from a ratio of linear * (i.e. not dB) signal levels. * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ -int iwl_calc_db_from_ratio(int sig_ratio) +int iwl4965_calc_db_from_ratio(int sig_ratio) { /* 1000:1 or higher just report as 60 dB */ if (sig_ratio >= 1000) @@ -4524,7 +4524,7 @@ int iwl_calc_db_from_ratio(int sig_ratio) /* Calculate an indication of rx signal quality (a percentage, not dBm!). * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info * about formulas used below. */ -int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) +int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm) { int sig_qual; int degradation = PERFECT_RSSI - rssi_dbm; @@ -4559,22 +4559,22 @@ int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) } /** - * iwl_rx_handle - Main entry function for receiving responses from the uCode + * iwl4965_rx_handle - Main entry function for receiving responses from the uCode * * Uses the priv->rx_handlers callback function array to invoke * the appropriate handlers, including command responses, * frame-received notifications, and other notifications. */ -static void iwl_rx_handle(struct iwl_priv *priv) +static void iwl4965_rx_handle(struct iwl4965_priv *priv) { - struct iwl_rx_mem_buffer *rxb; - struct iwl_rx_packet *pkt; - struct iwl_rx_queue *rxq = &priv->rxq; + struct iwl4965_rx_mem_buffer *rxb; + struct iwl4965_rx_packet *pkt; + struct iwl4965_rx_queue *rxq = &priv->rxq; u32 r, i; int reclaim; unsigned long flags; - r = iwl_hw_get_rx_read(priv); + r = iwl4965_hw_get_rx_read(priv); i = rxq->read; /* Rx interrupt, but nothing sent from uCode */ @@ -4594,7 +4594,7 @@ static void iwl_rx_handle(struct iwl_priv *priv) pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); - pkt = (struct iwl_rx_packet *)rxb->skb->data; + pkt = (struct iwl4965_rx_packet *)rxb->skb->data; /* Reclaim a command buffer only if this packet is a response * to a (driver-originated) command. @@ -4611,7 +4611,7 @@ static void iwl_rx_handle(struct iwl_priv *priv) /* Based on type of command response or notification, * handle those that need handling via function in - * rx_handlers table. See iwl_setup_rx_handlers() */ + * rx_handlers table. See iwl4965_setup_rx_handlers() */ if (priv->rx_handlers[pkt->hdr.cmd]) { IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR, "r = %d, i = %d, %s, 0x%02x\n", r, i, @@ -4627,10 +4627,10 @@ static void iwl_rx_handle(struct iwl_priv *priv) if (reclaim) { /* Invoke any callbacks, transfer the skb to caller, - * and fire off the (possibly) blocking iwl_send_cmd() + * and fire off the (possibly) blocking iwl4965_send_cmd() * as we reclaim the driver command queue */ if (rxb && rxb->skb) - iwl_tx_cmd_complete(priv, rxb); + iwl4965_tx_cmd_complete(priv, rxb); else IWL_WARNING("Claim null rxb?\n"); } @@ -4654,11 +4654,11 @@ static void iwl_rx_handle(struct iwl_priv *priv) /* Backtrack one entry */ priv->rxq.read = i; - iwl_rx_queue_restock(priv); + iwl4965_rx_queue_restock(priv); } -static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_tx_queue *txq) +static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv, + struct iwl4965_tx_queue *txq) { u32 reg = 0; int rc = 0; @@ -4672,27 +4672,27 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, /* wake up nic if it's powered down ... * uCode will wake up, and interrupt us again, so next * time we'll skip this part. */ - reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); + reg = iwl4965_read32(priv, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { IWL_DEBUG_INFO("Requesting wakeup, GP1 = 0x%x\n", reg); - iwl_set_bit(priv, CSR_GP_CNTRL, + iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); return rc; } /* restore this queue's parameters in nic hardware. */ - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) return rc; - iwl_write_direct32(priv, HBUS_TARG_WRPTR, + iwl4965_write_direct32(priv, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); /* else not in power-save mode, uCode will never sleep when we're * trying to tx (during RFKILL, we're not trying to tx). */ } else - iwl_write32(priv, HBUS_TARG_WRPTR, + iwl4965_write32(priv, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); txq->need_update = 0; @@ -4701,12 +4701,12 @@ static int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, } #ifdef CONFIG_IWL4965_DEBUG -static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) +static void iwl4965_print_rx_config_cmd(struct iwl4965_rxon_cmd *rxon) { DECLARE_MAC_BUF(mac); IWL_DEBUG_RADIO("RX CONFIG:\n"); - iwl_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); + iwl4965_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", @@ -4723,24 +4723,24 @@ static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) } #endif -static void iwl_enable_interrupts(struct iwl_priv *priv) +static void iwl4965_enable_interrupts(struct iwl4965_priv *priv) { IWL_DEBUG_ISR("Enabling interrupts\n"); set_bit(STATUS_INT_ENABLED, &priv->status); - iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); + iwl4965_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); } -static inline void iwl_disable_interrupts(struct iwl_priv *priv) +static inline void iwl4965_disable_interrupts(struct iwl4965_priv *priv) { clear_bit(STATUS_INT_ENABLED, &priv->status); /* disable interrupts from uCode/NIC to host */ - iwl_write32(priv, CSR_INT_MASK, 0x00000000); + iwl4965_write32(priv, CSR_INT_MASK, 0x00000000); /* acknowledge/clear/reset any interrupts still pending * from uCode or flow handler (Rx/Tx DMA) */ - iwl_write32(priv, CSR_INT, 0xffffffff); - iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); + iwl4965_write32(priv, CSR_INT, 0xffffffff); + iwl4965_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); IWL_DEBUG_ISR("Disabled interrupts\n"); } @@ -4767,7 +4767,7 @@ static const char *desc_lookup(int i) #define ERROR_START_OFFSET (1 * sizeof(u32)) #define ERROR_ELEM_SIZE (7 * sizeof(u32)) -static void iwl_dump_nic_error_log(struct iwl_priv *priv) +static void iwl4965_dump_nic_error_log(struct iwl4965_priv *priv) { u32 data2, line; u32 desc, time, count, base, data1; @@ -4776,18 +4776,18 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) base = le32_to_cpu(priv->card_alive.error_event_table_ptr); - if (!iwl_hw_valid_rtc_data_addr(base)) { + if (!iwl4965_hw_valid_rtc_data_addr(base)) { IWL_ERROR("Not valid error log pointer 0x%08X\n", base); return; } - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) { IWL_WARNING("Can not read from adapter at this time.\n"); return; } - count = iwl_read_targ_mem(priv, base); + count = iwl4965_read_targ_mem(priv, base); if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { IWL_ERROR("Start IWL Error Log Dump:\n"); @@ -4795,15 +4795,15 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) priv->status, priv->config, count); } - desc = iwl_read_targ_mem(priv, base + 1 * sizeof(u32)); - blink1 = iwl_read_targ_mem(priv, base + 3 * sizeof(u32)); - blink2 = iwl_read_targ_mem(priv, base + 4 * sizeof(u32)); - ilink1 = iwl_read_targ_mem(priv, base + 5 * sizeof(u32)); - ilink2 = iwl_read_targ_mem(priv, base + 6 * sizeof(u32)); - data1 = iwl_read_targ_mem(priv, base + 7 * sizeof(u32)); - data2 = iwl_read_targ_mem(priv, base + 8 * sizeof(u32)); - line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32)); - time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32)); + desc = iwl4965_read_targ_mem(priv, base + 1 * sizeof(u32)); + blink1 = iwl4965_read_targ_mem(priv, base + 3 * sizeof(u32)); + blink2 = iwl4965_read_targ_mem(priv, base + 4 * sizeof(u32)); + ilink1 = iwl4965_read_targ_mem(priv, base + 5 * sizeof(u32)); + ilink2 = iwl4965_read_targ_mem(priv, base + 6 * sizeof(u32)); + data1 = iwl4965_read_targ_mem(priv, base + 7 * sizeof(u32)); + data2 = iwl4965_read_targ_mem(priv, base + 8 * sizeof(u32)); + line = iwl4965_read_targ_mem(priv, base + 9 * sizeof(u32)); + time = iwl4965_read_targ_mem(priv, base + 11 * sizeof(u32)); IWL_ERROR("Desc Time " "data1 data2 line\n"); @@ -4813,17 +4813,17 @@ static void iwl_dump_nic_error_log(struct iwl_priv *priv) IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2, ilink1, ilink2); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); } #define EVENT_START_OFFSET (4 * sizeof(u32)) /** - * iwl_print_event_log - Dump error event log to syslog + * iwl4965_print_event_log - Dump error event log to syslog * - * NOTE: Must be called with iwl_grab_nic_access() already obtained! + * NOTE: Must be called with iwl4965_grab_nic_access() already obtained! */ -static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, +static void iwl4965_print_event_log(struct iwl4965_priv *priv, u32 start_idx, u32 num_events, u32 mode) { u32 i; @@ -4847,21 +4847,21 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, /* "time" is actually "data" for mode 0 (no timestamp). * place event id # at far right for easier visual parsing. */ for (i = 0; i < num_events; i++) { - ev = iwl_read_targ_mem(priv, ptr); + ev = iwl4965_read_targ_mem(priv, ptr); ptr += sizeof(u32); - time = iwl_read_targ_mem(priv, ptr); + time = iwl4965_read_targ_mem(priv, ptr); ptr += sizeof(u32); if (mode == 0) IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */ else { - data = iwl_read_targ_mem(priv, ptr); + data = iwl4965_read_targ_mem(priv, ptr); ptr += sizeof(u32); IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev); } } } -static void iwl_dump_nic_event_log(struct iwl_priv *priv) +static void iwl4965_dump_nic_event_log(struct iwl4965_priv *priv) { int rc; u32 base; /* SRAM byte address of event log header */ @@ -4872,29 +4872,29 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) u32 size; /* # entries that we'll print */ base = le32_to_cpu(priv->card_alive.log_event_table_ptr); - if (!iwl_hw_valid_rtc_data_addr(base)) { + if (!iwl4965_hw_valid_rtc_data_addr(base)) { IWL_ERROR("Invalid event log pointer 0x%08X\n", base); return; } - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) { IWL_WARNING("Can not read from adapter at this time.\n"); return; } /* event log header */ - capacity = iwl_read_targ_mem(priv, base); - mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32))); - num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32))); - next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32))); + capacity = iwl4965_read_targ_mem(priv, base); + mode = iwl4965_read_targ_mem(priv, base + (1 * sizeof(u32))); + num_wraps = iwl4965_read_targ_mem(priv, base + (2 * sizeof(u32))); + next_entry = iwl4965_read_targ_mem(priv, base + (3 * sizeof(u32))); size = num_wraps ? capacity : next_entry; /* bail out if nothing in log */ if (size == 0) { IWL_ERROR("Start IWL Event Log Dump: nothing in log\n"); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); return; } @@ -4904,31 +4904,31 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) /* if uCode has wrapped back to top of log, start at the oldest entry, * i.e the next one that uCode would fill. */ if (num_wraps) - iwl_print_event_log(priv, next_entry, + iwl4965_print_event_log(priv, next_entry, capacity - next_entry, mode); /* (then/else) start at top of log */ - iwl_print_event_log(priv, 0, next_entry, mode); + iwl4965_print_event_log(priv, 0, next_entry, mode); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); } /** - * iwl_irq_handle_error - called for HW or SW error interrupt from card + * iwl4965_irq_handle_error - called for HW or SW error interrupt from card */ -static void iwl_irq_handle_error(struct iwl_priv *priv) +static void iwl4965_irq_handle_error(struct iwl4965_priv *priv) { - /* Set the FW error flag -- cleared on iwl_down */ + /* Set the FW error flag -- cleared on iwl4965_down */ set_bit(STATUS_FW_ERROR, &priv->status); /* Cancel currently queued command. */ clear_bit(STATUS_HCMD_ACTIVE, &priv->status); #ifdef CONFIG_IWL4965_DEBUG - if (iwl_debug_level & IWL_DL_FW_ERRORS) { - iwl_dump_nic_error_log(priv); - iwl_dump_nic_event_log(priv); - iwl_print_rx_config_cmd(&priv->staging_rxon); + if (iwl4965_debug_level & IWL_DL_FW_ERRORS) { + iwl4965_dump_nic_error_log(priv); + iwl4965_dump_nic_event_log(priv); + iwl4965_print_rx_config_cmd(&priv->staging_rxon); } #endif @@ -4942,7 +4942,7 @@ static void iwl_irq_handle_error(struct iwl_priv *priv) IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS, "Restarting adapter due to uCode error.\n"); - if (iwl_is_associated(priv)) { + if (iwl4965_is_associated(priv)) { memcpy(&priv->recovery_rxon, &priv->active_rxon, sizeof(priv->recovery_rxon)); priv->error_recovering = 1; @@ -4951,16 +4951,16 @@ static void iwl_irq_handle_error(struct iwl_priv *priv) } } -static void iwl_error_recovery(struct iwl_priv *priv) +static void iwl4965_error_recovery(struct iwl4965_priv *priv) { unsigned long flags; memcpy(&priv->staging_rxon, &priv->recovery_rxon, sizeof(priv->staging_rxon)); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); - iwl_rxon_add_station(priv, priv->bssid, 1); + iwl4965_rxon_add_station(priv, priv->bssid, 1); spin_lock_irqsave(&priv->lock, flags); priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id); @@ -4968,7 +4968,7 @@ static void iwl_error_recovery(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } -static void iwl_irq_tasklet(struct iwl_priv *priv) +static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) { u32 inta, handled = 0; u32 inta_fh; @@ -4982,18 +4982,18 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) /* Ack/clear/reset pending uCode interrupts. * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, * and will clear only when CSR_FH_INT_STATUS gets cleared. */ - inta = iwl_read32(priv, CSR_INT); - iwl_write32(priv, CSR_INT, inta); + inta = iwl4965_read32(priv, CSR_INT); + iwl4965_write32(priv, CSR_INT, inta); /* Ack/clear/reset pending flow-handler (DMA) interrupts. * Any new interrupts that happen after this, either while we're * in this tasklet, or later, will show up in next ISR/tasklet. */ - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); - iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); + inta_fh = iwl4965_read32(priv, CSR_FH_INT_STATUS); + iwl4965_write32(priv, CSR_FH_INT_STATUS, inta_fh); #ifdef CONFIG_IWL4965_DEBUG - if (iwl_debug_level & IWL_DL_ISR) { - inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ + if (iwl4965_debug_level & IWL_DL_ISR) { + inta_mask = iwl4965_read32(priv, CSR_INT_MASK); /* just for debug */ IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); } @@ -5013,9 +5013,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) IWL_ERROR("Microcode HW error detected. Restarting.\n"); /* Tell the device to stop sending interrupts */ - iwl_disable_interrupts(priv); + iwl4965_disable_interrupts(priv); - iwl_irq_handle_error(priv); + iwl4965_irq_handle_error(priv); handled |= CSR_INT_BIT_HW_ERR; @@ -5025,7 +5025,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) } #ifdef CONFIG_IWL4965_DEBUG - if (iwl_debug_level & (IWL_DL_ISR)) { + if (iwl4965_debug_level & (IWL_DL_ISR)) { /* NIC fires this, but we don't use it, redundant with WAKEUP */ if (inta & CSR_INT_BIT_MAC_CLK_ACTV) IWL_DEBUG_ISR("Microcode started or stopped.\n"); @@ -5041,7 +5041,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) /* HW RF KILL switch toggled (4965 only) */ if (inta & CSR_INT_BIT_RF_KILL) { int hw_rf_kill = 0; - if (!(iwl_read32(priv, CSR_GP_CNTRL) & + if (!(iwl4965_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) hw_rf_kill = 1; @@ -5071,20 +5071,20 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) if (inta & CSR_INT_BIT_SW_ERR) { IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", inta); - iwl_irq_handle_error(priv); + iwl4965_irq_handle_error(priv); handled |= CSR_INT_BIT_SW_ERR; } /* uCode wakes up after power-down sleep */ if (inta & CSR_INT_BIT_WAKEUP) { IWL_DEBUG_ISR("Wakeup interrupt\n"); - iwl_rx_queue_update_write_ptr(priv, &priv->rxq); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[0]); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[1]); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[2]); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[3]); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[4]); - iwl_tx_queue_update_write_ptr(priv, &priv->txq[5]); + iwl4965_rx_queue_update_write_ptr(priv, &priv->rxq); + iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[0]); + iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[1]); + iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[2]); + iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[3]); + iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[4]); + iwl4965_tx_queue_update_write_ptr(priv, &priv->txq[5]); handled |= CSR_INT_BIT_WAKEUP; } @@ -5093,7 +5093,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) * Rx "responses" (frame-received notification), and other * notifications from uCode come through here*/ if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { - iwl_rx_handle(priv); + iwl4965_rx_handle(priv); handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); } @@ -5112,13 +5112,13 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) } /* Re-enable all interrupts */ - iwl_enable_interrupts(priv); + iwl4965_enable_interrupts(priv); #ifdef CONFIG_IWL4965_DEBUG - if (iwl_debug_level & (IWL_DL_ISR)) { - inta = iwl_read32(priv, CSR_INT); - inta_mask = iwl_read32(priv, CSR_INT_MASK); - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); + if (iwl4965_debug_level & (IWL_DL_ISR)) { + inta = iwl4965_read32(priv, CSR_INT); + inta_mask = iwl4965_read32(priv, CSR_INT_MASK); + inta_fh = iwl4965_read32(priv, CSR_FH_INT_STATUS); IWL_DEBUG_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); } @@ -5126,9 +5126,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } -static irqreturn_t iwl_isr(int irq, void *data) +static irqreturn_t iwl4965_isr(int irq, void *data) { - struct iwl_priv *priv = data; + struct iwl4965_priv *priv = data; u32 inta, inta_mask; u32 inta_fh; if (!priv) @@ -5140,12 +5140,12 @@ static irqreturn_t iwl_isr(int irq, void *data) * back-to-back ISRs and sporadic interrupts from our NIC. * If we have something to service, the tasklet will re-enable ints. * If we *don't* have something, we'll re-enable before leaving here. */ - inta_mask = iwl_read32(priv, CSR_INT_MASK); /* just for debug */ - iwl_write32(priv, CSR_INT_MASK, 0x00000000); + inta_mask = iwl4965_read32(priv, CSR_INT_MASK); /* just for debug */ + iwl4965_write32(priv, CSR_INT_MASK, 0x00000000); /* Discover which interrupts are active/pending */ - inta = iwl_read32(priv, CSR_INT); - inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); + inta = iwl4965_read32(priv, CSR_INT); + inta_fh = iwl4965_read32(priv, CSR_FH_INT_STATUS); /* Ignore interrupt if there's nothing in NIC to service. * This may be due to IRQ shared with another device, @@ -5165,7 +5165,7 @@ static irqreturn_t iwl_isr(int irq, void *data) IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); - /* iwl_irq_tasklet() will service interrupts and re-enable them */ + /* iwl4965_irq_tasklet() will service interrupts and re-enable them */ tasklet_schedule(&priv->irq_tasklet); unplugged: @@ -5174,18 +5174,18 @@ static irqreturn_t iwl_isr(int irq, void *data) none: /* re-enable interrupts here since we don't have anything to service. */ - iwl_enable_interrupts(priv); + iwl4965_enable_interrupts(priv); spin_unlock(&priv->lock); return IRQ_NONE; } /************************** EEPROM BANDS **************************** * - * The iwl_eeprom_band definitions below provide the mapping from the + * The iwl4965_eeprom_band definitions below provide the mapping from the * EEPROM contents to the specific channel number supported for each * band. * - * For example, iwl_priv->eeprom.band_3_channels[4] from the band_3 + * For example, iwl4965_priv->eeprom.band_3_channels[4] from the band_3 * definition below maps to physical channel 42 in the 5.2GHz spectrum. * The specific geography and calibration information for that channel * is contained in the eeprom map itself. @@ -5211,76 +5211,76 @@ static irqreturn_t iwl_isr(int irq, void *data) *********************************************************************/ /* 2.4 GHz */ -static const u8 iwl_eeprom_band_1[14] = { +static const u8 iwl4965_eeprom_band_1[14] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; /* 5.2 GHz bands */ -static const u8 iwl_eeprom_band_2[] = { +static const u8 iwl4965_eeprom_band_2[] = { 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 }; -static const u8 iwl_eeprom_band_3[] = { /* 5205-5320MHz */ +static const u8 iwl4965_eeprom_band_3[] = { /* 5205-5320MHz */ 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 }; -static const u8 iwl_eeprom_band_4[] = { /* 5500-5700MHz */ +static const u8 iwl4965_eeprom_band_4[] = { /* 5500-5700MHz */ 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 }; -static const u8 iwl_eeprom_band_5[] = { /* 5725-5825MHz */ +static const u8 iwl4965_eeprom_band_5[] = { /* 5725-5825MHz */ 145, 149, 153, 157, 161, 165 }; -static u8 iwl_eeprom_band_6[] = { /* 2.4 FAT channel */ +static u8 iwl4965_eeprom_band_6[] = { /* 2.4 FAT channel */ 1, 2, 3, 4, 5, 6, 7 }; -static u8 iwl_eeprom_band_7[] = { /* 5.2 FAT channel */ +static u8 iwl4965_eeprom_band_7[] = { /* 5.2 FAT channel */ 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 }; -static void iwl_init_band_reference(const struct iwl_priv *priv, int band, +static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, int band, int *eeprom_ch_count, - const struct iwl_eeprom_channel + const struct iwl4965_eeprom_channel **eeprom_ch_info, const u8 **eeprom_ch_index) { switch (band) { case 1: /* 2.4GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1); + *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_1); *eeprom_ch_info = priv->eeprom.band_1_channels; - *eeprom_ch_index = iwl_eeprom_band_1; + *eeprom_ch_index = iwl4965_eeprom_band_1; break; case 2: /* 5.2GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2); + *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_2); *eeprom_ch_info = priv->eeprom.band_2_channels; - *eeprom_ch_index = iwl_eeprom_band_2; + *eeprom_ch_index = iwl4965_eeprom_band_2; break; case 3: /* 5.2GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3); + *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_3); *eeprom_ch_info = priv->eeprom.band_3_channels; - *eeprom_ch_index = iwl_eeprom_band_3; + *eeprom_ch_index = iwl4965_eeprom_band_3; break; case 4: /* 5.2GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4); + *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_4); *eeprom_ch_info = priv->eeprom.band_4_channels; - *eeprom_ch_index = iwl_eeprom_band_4; + *eeprom_ch_index = iwl4965_eeprom_band_4; break; case 5: /* 5.2GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5); + *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_5); *eeprom_ch_info = priv->eeprom.band_5_channels; - *eeprom_ch_index = iwl_eeprom_band_5; + *eeprom_ch_index = iwl4965_eeprom_band_5; break; case 6: - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6); + *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_6); *eeprom_ch_info = priv->eeprom.band_24_channels; - *eeprom_ch_index = iwl_eeprom_band_6; + *eeprom_ch_index = iwl4965_eeprom_band_6; break; case 7: - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7); + *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_7); *eeprom_ch_info = priv->eeprom.band_52_channels; - *eeprom_ch_index = iwl_eeprom_band_7; + *eeprom_ch_index = iwl4965_eeprom_band_7; break; default: BUG(); @@ -5288,7 +5288,7 @@ static void iwl_init_band_reference(const struct iwl_priv *priv, int band, } } -const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv, +const struct iwl4965_channel_info *iwl4965_get_channel_info(const struct iwl4965_priv *priv, int phymode, u16 channel) { int i; @@ -5315,13 +5315,13 @@ const struct iwl_channel_info *iwl_get_channel_info(const struct iwl_priv *priv, #define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ ? # x " " : "") -static int iwl_init_channel_map(struct iwl_priv *priv) +static int iwl4965_init_channel_map(struct iwl4965_priv *priv) { int eeprom_ch_count = 0; const u8 *eeprom_ch_index = NULL; - const struct iwl_eeprom_channel *eeprom_ch_info = NULL; + const struct iwl4965_eeprom_channel *eeprom_ch_info = NULL; int band, ch; - struct iwl_channel_info *ch_info; + struct iwl4965_channel_info *ch_info; if (priv->channel_count) { IWL_DEBUG_INFO("Channel map already initialized.\n"); @@ -5337,15 +5337,15 @@ static int iwl_init_channel_map(struct iwl_priv *priv) IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n"); priv->channel_count = - ARRAY_SIZE(iwl_eeprom_band_1) + - ARRAY_SIZE(iwl_eeprom_band_2) + - ARRAY_SIZE(iwl_eeprom_band_3) + - ARRAY_SIZE(iwl_eeprom_band_4) + - ARRAY_SIZE(iwl_eeprom_band_5); + ARRAY_SIZE(iwl4965_eeprom_band_1) + + ARRAY_SIZE(iwl4965_eeprom_band_2) + + ARRAY_SIZE(iwl4965_eeprom_band_3) + + ARRAY_SIZE(iwl4965_eeprom_band_4) + + ARRAY_SIZE(iwl4965_eeprom_band_5); IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count); - priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) * + priv->channel_info = kzalloc(sizeof(struct iwl4965_channel_info) * priv->channel_count, GFP_KERNEL); if (!priv->channel_info) { IWL_ERROR("Could not allocate channel_info\n"); @@ -5360,7 +5360,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv) * what just in the EEPROM) */ for (band = 1; band <= 5; band++) { - iwl_init_band_reference(priv, band, &eeprom_ch_count, + iwl4965_init_band_reference(priv, band, &eeprom_ch_count, &eeprom_ch_info, &eeprom_ch_index); /* Loop through each band adding each of the channels */ @@ -5428,7 +5428,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv) int phymode; u8 fat_extension_chan; - iwl_init_band_reference(priv, band, &eeprom_ch_count, + iwl4965_init_band_reference(priv, band, &eeprom_ch_count, &eeprom_ch_info, &eeprom_ch_index); phymode = (band == 6) ? MODE_IEEE80211B : MODE_IEEE80211A; @@ -5481,7 +5481,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv) #define IWL_PASSIVE_DWELL_BASE (100) #define IWL_CHANNEL_TUNE_TIME 5 -static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, int phymode) +static inline u16 iwl4965_get_active_dwell_time(struct iwl4965_priv *priv, int phymode) { if (phymode == MODE_IEEE80211A) return IWL_ACTIVE_DWELL_TIME_52; @@ -5489,14 +5489,14 @@ static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, int phymode) return IWL_ACTIVE_DWELL_TIME_24; } -static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, int phymode) +static u16 iwl4965_get_passive_dwell_time(struct iwl4965_priv *priv, int phymode) { - u16 active = iwl_get_active_dwell_time(priv, phymode); + u16 active = iwl4965_get_active_dwell_time(priv, phymode); u16 passive = (phymode != MODE_IEEE80211A) ? IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; - if (iwl_is_associated(priv)) { + if (iwl4965_is_associated(priv)) { /* If we're associated, we clamp the maximum passive * dwell time to be 98% of the beacon interval (minus * 2 * channel tune time) */ @@ -5512,30 +5512,30 @@ static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, int phymode) return passive; } -static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode, +static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, u8 is_active, u8 direct_mask, - struct iwl_scan_channel *scan_ch) + struct iwl4965_scan_channel *scan_ch) { const struct ieee80211_channel *channels = NULL; const struct ieee80211_hw_mode *hw_mode; - const struct iwl_channel_info *ch_info; + const struct iwl4965_channel_info *ch_info; u16 passive_dwell = 0; u16 active_dwell = 0; int added, i; - hw_mode = iwl_get_hw_mode(priv, phymode); + hw_mode = iwl4965_get_hw_mode(priv, phymode); if (!hw_mode) return 0; channels = hw_mode->channels; - active_dwell = iwl_get_active_dwell_time(priv, phymode); - passive_dwell = iwl_get_passive_dwell_time(priv, phymode); + active_dwell = iwl4965_get_active_dwell_time(priv, phymode); + passive_dwell = iwl4965_get_passive_dwell_time(priv, phymode); for (i = 0, added = 0; i < hw_mode->num_channels; i++) { if (channels[i].chan == le16_to_cpu(priv->active_rxon.channel)) { - if (iwl_is_associated(priv)) { + if (iwl4965_is_associated(priv)) { IWL_DEBUG_SCAN ("Skipping current channel %d\n", le16_to_cpu(priv->active_rxon.channel)); @@ -5546,7 +5546,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode, scan_ch->channel = channels[i].chan; - ch_info = iwl_get_channel_info(priv, phymode, scan_ch->channel); + ch_info = iwl4965_get_channel_info(priv, phymode, scan_ch->channel); if (!is_channel_valid(ch_info)) { IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", scan_ch->channel); @@ -5597,7 +5597,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode, return added; } -static void iwl_reset_channel_flag(struct iwl_priv *priv) +static void iwl4965_reset_channel_flag(struct iwl4965_priv *priv) { int i, j; for (i = 0; i < 3; i++) { @@ -5607,13 +5607,13 @@ static void iwl_reset_channel_flag(struct iwl_priv *priv) } } -static void iwl_init_hw_rates(struct iwl_priv *priv, +static void iwl4965_init_hw_rates(struct iwl4965_priv *priv, struct ieee80211_rate *rates) { int i; for (i = 0; i < IWL_RATE_COUNT; i++) { - rates[i].rate = iwl_rates[i].ieee * 5; + rates[i].rate = iwl4965_rates[i].ieee * 5; rates[i].val = i; /* Rate scaling will work on indexes */ rates[i].val2 = i; rates[i].flags = IEEE80211_RATE_SUPPORTED; @@ -5625,7 +5625,7 @@ static void iwl_init_hw_rates(struct iwl_priv *priv, * If CCK 1M then set rate flag to CCK else CCK_2 * which is CCK | PREAMBLE2 */ - rates[i].flags |= (iwl_rates[i].plcp == 10) ? + rates[i].flags |= (iwl4965_rates[i].plcp == 10) ? IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2; } @@ -5638,11 +5638,11 @@ static void iwl_init_hw_rates(struct iwl_priv *priv, } /** - * iwl_init_geos - Initialize mac80211's geo/channel info based from eeprom + * iwl4965_init_geos - Initialize mac80211's geo/channel info based from eeprom */ -static int iwl_init_geos(struct iwl_priv *priv) +static int iwl4965_init_geos(struct iwl4965_priv *priv) { - struct iwl_channel_info *ch; + struct iwl4965_channel_info *ch; struct ieee80211_hw_mode *modes; struct ieee80211_channel *channels; struct ieee80211_channel *geo_ch; @@ -5690,7 +5690,7 @@ static int iwl_init_geos(struct iwl_priv *priv) /* 5.2GHz channels start after the 2.4GHz channels */ modes[A].mode = MODE_IEEE80211A; - modes[A].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; + modes[A].channels = &channels[ARRAY_SIZE(iwl4965_eeprom_band_1)]; modes[A].rates = rates; modes[A].num_rates = 8; /* just OFDM */ modes[A].rates = &rates[4]; @@ -5715,7 +5715,7 @@ static int iwl_init_geos(struct iwl_priv *priv) modes[G_11N].num_channels = 0; modes[A_11N].mode = MODE_IEEE80211A; - modes[A_11N].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; + modes[A_11N].channels = &channels[ARRAY_SIZE(iwl4965_eeprom_band_1)]; modes[A_11N].rates = &rates[4]; modes[A_11N].num_rates = 9; /* just OFDM */ modes[A_11N].num_channels = 0; @@ -5723,7 +5723,7 @@ static int iwl_init_geos(struct iwl_priv *priv) priv->ieee_channels = channels; priv->ieee_rates = rates; - iwl_init_hw_rates(priv, rates); + iwl4965_init_hw_rates(priv, rates); for (i = 0, geo_ch = channels; i < priv->channel_count; i++) { ch = &priv->channel_info[i]; @@ -5808,7 +5808,7 @@ static int iwl_init_geos(struct iwl_priv *priv) * ******************************************************************************/ -static void iwl_dealloc_ucode_pci(struct iwl_priv *priv) +static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv) { if (priv->ucode_code.v_addr != NULL) { pci_free_consistent(priv->pci_dev, @@ -5855,10 +5855,10 @@ static void iwl_dealloc_ucode_pci(struct iwl_priv *priv) } /** - * iwl_verify_inst_full - verify runtime uCode image in card vs. host, + * iwl4965_verify_inst_full - verify runtime uCode image in card vs. host, * looking at all data. */ -static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) +static int iwl4965_verify_inst_full(struct iwl4965_priv *priv, __le32 * image, u32 len) { u32 val; u32 save_len = len; @@ -5867,18 +5867,18 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) IWL_DEBUG_INFO("ucode inst image size is %u\n", len); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) return rc; - iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); + iwl4965_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND); errcnt = 0; for (; len > 0; len -= sizeof(u32), image++) { /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log * if IWL_DL_IO is set */ - val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); + val = _iwl4965_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { IWL_ERROR("uCode INST section is invalid at " "offset 0x%x, is 0x%x, s/b 0x%x\n", @@ -5890,7 +5890,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) } } - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); if (!errcnt) IWL_DEBUG_INFO @@ -5901,11 +5901,11 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) /** - * iwl_verify_inst_sparse - verify runtime uCode image in card vs. host, + * iwl4965_verify_inst_sparse - verify runtime uCode image in card vs. host, * using sample data 100 bytes apart. If these sample points are good, * it's a pretty good bet that everything between them is good, too. */ -static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) +static int iwl4965_verify_inst_sparse(struct iwl4965_priv *priv, __le32 *image, u32 len) { u32 val; int rc = 0; @@ -5914,7 +5914,7 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) IWL_DEBUG_INFO("ucode inst image size is %u\n", len); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) return rc; @@ -5922,9 +5922,9 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) /* read data comes through single port, auto-incr addr */ /* NOTE: Use the debugless read so we don't flood kernel log * if IWL_DL_IO is set */ - iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, + iwl4965_write_direct32(priv, HBUS_TARG_MEM_RADDR, i + RTC_INST_LOWER_BOUND); - val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); + val = _iwl4965_read_direct32(priv, HBUS_TARG_MEM_RDAT); if (val != le32_to_cpu(*image)) { #if 0 /* Enable this if you want to see details */ IWL_ERROR("uCode INST section is invalid at " @@ -5938,17 +5938,17 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) } } - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); return rc; } /** - * iwl_verify_ucode - determine which instruction image is in SRAM, + * iwl4965_verify_ucode - determine which instruction image is in SRAM, * and verify its contents */ -static int iwl_verify_ucode(struct iwl_priv *priv) +static int iwl4965_verify_ucode(struct iwl4965_priv *priv) { __le32 *image; u32 len; @@ -5957,7 +5957,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv) /* Try bootstrap */ image = (__le32 *)priv->ucode_boot.v_addr; len = priv->ucode_boot.len; - rc = iwl_verify_inst_sparse(priv, image, len); + rc = iwl4965_verify_inst_sparse(priv, image, len); if (rc == 0) { IWL_DEBUG_INFO("Bootstrap uCode is good in inst SRAM\n"); return 0; @@ -5966,7 +5966,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv) /* Try initialize */ image = (__le32 *)priv->ucode_init.v_addr; len = priv->ucode_init.len; - rc = iwl_verify_inst_sparse(priv, image, len); + rc = iwl4965_verify_inst_sparse(priv, image, len); if (rc == 0) { IWL_DEBUG_INFO("Initialize uCode is good in inst SRAM\n"); return 0; @@ -5975,7 +5975,7 @@ static int iwl_verify_ucode(struct iwl_priv *priv) /* Try runtime/protocol */ image = (__le32 *)priv->ucode_code.v_addr; len = priv->ucode_code.len; - rc = iwl_verify_inst_sparse(priv, image, len); + rc = iwl4965_verify_inst_sparse(priv, image, len); if (rc == 0) { IWL_DEBUG_INFO("Runtime uCode is good in inst SRAM\n"); return 0; @@ -5987,14 +5987,14 @@ static int iwl_verify_ucode(struct iwl_priv *priv) * Selection of bootstrap image is arbitrary. */ image = (__le32 *)priv->ucode_boot.v_addr; len = priv->ucode_boot.len; - rc = iwl_verify_inst_full(priv, image, len); + rc = iwl4965_verify_inst_full(priv, image, len); return rc; } /* check contents of special bootstrap uCode SRAM */ -static int iwl_verify_bsm(struct iwl_priv *priv) +static int iwl4965_verify_bsm(struct iwl4965_priv *priv) { __le32 *image = priv->ucode_boot.v_addr; u32 len = priv->ucode_boot.len; @@ -6004,11 +6004,11 @@ static int iwl_verify_bsm(struct iwl_priv *priv) IWL_DEBUG_INFO("Begin verify bsm\n"); /* verify BSM SRAM contents */ - val = iwl_read_prph(priv, BSM_WR_DWCOUNT_REG); + val = iwl4965_read_prph(priv, BSM_WR_DWCOUNT_REG); for (reg = BSM_SRAM_LOWER_BOUND; reg < BSM_SRAM_LOWER_BOUND + len; reg += sizeof(u32), image ++) { - val = iwl_read_prph(priv, reg); + val = iwl4965_read_prph(priv, reg); if (val != le32_to_cpu(*image)) { IWL_ERROR("BSM uCode verification failed at " "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", @@ -6025,7 +6025,7 @@ static int iwl_verify_bsm(struct iwl_priv *priv) } /** - * iwl_load_bsm - Load bootstrap instructions + * iwl4965_load_bsm - Load bootstrap instructions * * BSM operation: * @@ -6056,7 +6056,7 @@ static int iwl_verify_bsm(struct iwl_priv *priv) * the runtime uCode instructions and the backup data cache into SRAM, * and re-launches the runtime uCode from where it left off. */ -static int iwl_load_bsm(struct iwl_priv *priv) +static int iwl4965_load_bsm(struct iwl4965_priv *priv) { __le32 *image = priv->ucode_boot.v_addr; u32 len = priv->ucode_boot.len; @@ -6077,7 +6077,7 @@ static int iwl_load_bsm(struct iwl_priv *priv) /* Tell bootstrap uCode where to find the "Initialize" uCode * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965. - * NOTE: iwl_initialize_alive_start() will replace these values, + * NOTE: iwl4965_initialize_alive_start() will replace these values, * after the "initialize" uCode has run, to point to * runtime/protocol instructions and backup data cache. */ pinst = priv->ucode_init.p_addr >> 4; @@ -6085,42 +6085,42 @@ static int iwl_load_bsm(struct iwl_priv *priv) inst_len = priv->ucode_init.len; data_len = priv->ucode_init_data.len; - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) return rc; - iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); - iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); + iwl4965_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + iwl4965_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + iwl4965_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); + iwl4965_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); /* Fill BSM memory with bootstrap instructions */ for (reg_offset = BSM_SRAM_LOWER_BOUND; reg_offset < BSM_SRAM_LOWER_BOUND + len; reg_offset += sizeof(u32), image++) - _iwl_write_prph(priv, reg_offset, + _iwl4965_write_prph(priv, reg_offset, le32_to_cpu(*image)); - rc = iwl_verify_bsm(priv); + rc = iwl4965_verify_bsm(priv); if (rc) { - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); return rc; } /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ - iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); - iwl_write_prph(priv, BSM_WR_MEM_DST_REG, + iwl4965_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); + iwl4965_write_prph(priv, BSM_WR_MEM_DST_REG, RTC_INST_LOWER_BOUND); - iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); + iwl4965_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); /* Load bootstrap code into instruction SRAM now, * to prepare to load "initialize" uCode */ - iwl_write_prph(priv, BSM_WR_CTRL_REG, + iwl4965_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); /* Wait for load of bootstrap uCode to finish */ for (i = 0; i < 100; i++) { - done = iwl_read_prph(priv, BSM_WR_CTRL_REG); + done = iwl4965_read_prph(priv, BSM_WR_CTRL_REG); if (!(done & BSM_WR_CTRL_REG_BIT_START)) break; udelay(10); @@ -6134,28 +6134,28 @@ static int iwl_load_bsm(struct iwl_priv *priv) /* Enable future boot loads whenever power management unit triggers it * (e.g. when powering back up after power-save shutdown) */ - iwl_write_prph(priv, BSM_WR_CTRL_REG, + iwl4965_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); return 0; } -static void iwl_nic_start(struct iwl_priv *priv) +static void iwl4965_nic_start(struct iwl4965_priv *priv) { /* Remove all resets to allow NIC to operate */ - iwl_write32(priv, CSR_RESET, 0); + iwl4965_write32(priv, CSR_RESET, 0); } /** - * iwl_read_ucode - Read uCode images from disk file. + * iwl4965_read_ucode - Read uCode images from disk file. * * Copy into buffers for card to fetch via bus-mastering */ -static int iwl_read_ucode(struct iwl_priv *priv) +static int iwl4965_read_ucode(struct iwl4965_priv *priv) { - struct iwl_ucode *ucode; + struct iwl4965_ucode *ucode; int rc = 0; const struct firmware *ucode_raw; const char *name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode"; @@ -6311,7 +6311,7 @@ static int iwl_read_ucode(struct iwl_priv *priv) priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); /* Runtime data (2nd block) - * NOTE: Copy into backup buffer will be done in iwl_up() */ + * NOTE: Copy into backup buffer will be done in iwl4965_up() */ src = &ucode->data[inst_size]; len = priv->ucode_data.len; IWL_DEBUG_INFO("Copying (but not loading) uCode data len %d\n", @@ -6351,7 +6351,7 @@ static int iwl_read_ucode(struct iwl_priv *priv) err_pci_alloc: IWL_ERROR("failed to allocate pci memory\n"); rc = -ENOMEM; - iwl_dealloc_ucode_pci(priv); + iwl4965_dealloc_ucode_pci(priv); err_release: release_firmware(ucode_raw); @@ -6362,7 +6362,7 @@ static int iwl_read_ucode(struct iwl_priv *priv) /** - * iwl_set_ucode_ptrs - Set uCode address location + * iwl4965_set_ucode_ptrs - Set uCode address location * * Tell initialization uCode where to find runtime uCode. * @@ -6370,7 +6370,7 @@ static int iwl_read_ucode(struct iwl_priv *priv) * We need to replace them to load runtime uCode inst and data, * and to save runtime data when powering down. */ -static int iwl_set_ucode_ptrs(struct iwl_priv *priv) +static int iwl4965_set_ucode_ptrs(struct iwl4965_priv *priv) { dma_addr_t pinst; dma_addr_t pdata; @@ -6382,24 +6382,24 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) pdata = priv->ucode_data_backup.p_addr >> 4; spin_lock_irqsave(&priv->lock, flags); - rc = iwl_grab_nic_access(priv); + rc = iwl4965_grab_nic_access(priv); if (rc) { spin_unlock_irqrestore(&priv->lock, flags); return rc; } /* Tell bootstrap uCode where to find image to load */ - iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, + iwl4965_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); + iwl4965_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); + iwl4965_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, priv->ucode_data.len); /* Inst bytecount must be last to set up, bit 31 signals uCode * that all new ptr/size info is in place */ - iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, + iwl4965_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, priv->ucode_code.len | BSM_DRAM_INST_LOAD); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); @@ -6409,7 +6409,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) } /** - * iwl_init_alive_start - Called after REPLY_ALIVE notification received + * iwl4965_init_alive_start - Called after REPLY_ALIVE notification received * * Called after REPLY_ALIVE notification received from "initialize" uCode. * @@ -6419,7 +6419,7 @@ static int iwl_set_ucode_ptrs(struct iwl_priv *priv) * * Tell "initialize" uCode to go ahead and load the runtime uCode. */ -static void iwl_init_alive_start(struct iwl_priv *priv) +static void iwl4965_init_alive_start(struct iwl4965_priv *priv) { /* Check alive response for "valid" sign from uCode */ if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { @@ -6432,7 +6432,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv) /* Bootstrap uCode has loaded initialize uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "initialize" alive if code weren't properly loaded. */ - if (iwl_verify_ucode(priv)) { + if (iwl4965_verify_ucode(priv)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n"); @@ -6446,7 +6446,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv) * load and launch runtime uCode, which will send us another "Alive" * notification. */ IWL_DEBUG_INFO("Initialization Alive received.\n"); - if (iwl_set_ucode_ptrs(priv)) { + if (iwl4965_set_ucode_ptrs(priv)) { /* Runtime instruction load won't happen; * take it all the way back down so we can try again */ IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n"); @@ -6460,11 +6460,11 @@ static void iwl_init_alive_start(struct iwl_priv *priv) /** - * iwl_alive_start - called after REPLY_ALIVE notification received + * iwl4965_alive_start - called after REPLY_ALIVE notification received * from protocol/runtime uCode (initialization uCode's - * Alive gets handled by iwl_init_alive_start()). + * Alive gets handled by iwl4965_init_alive_start()). */ -static void iwl_alive_start(struct iwl_priv *priv) +static void iwl4965_alive_start(struct iwl4965_priv *priv) { int rc = 0; @@ -6480,14 +6480,14 @@ static void iwl_alive_start(struct iwl_priv *priv) /* Initialize uCode has loaded Runtime uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "runtime" alive if code weren't properly loaded. */ - if (iwl_verify_ucode(priv)) { + if (iwl4965_verify_ucode(priv)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ IWL_DEBUG_INFO("Bad runtime uCode load.\n"); goto restart; } - iwl_clear_stations_table(priv); + iwl4965_clear_stations_table(priv); rc = iwl4965_alive_notify(priv); if (rc) { @@ -6502,28 +6502,28 @@ static void iwl_alive_start(struct iwl_priv *priv) /* Clear out the uCode error bit if it is set */ clear_bit(STATUS_FW_ERROR, &priv->status); - rc = iwl_init_channel_map(priv); + rc = iwl4965_init_channel_map(priv); if (rc) { IWL_ERROR("initializing regulatory failed: %d\n", rc); return; } - iwl_init_geos(priv); + iwl4965_init_geos(priv); - if (iwl_is_rfkill(priv)) + if (iwl4965_is_rfkill(priv)) return; if (!priv->mac80211_registered) { /* Unlock so any user space entry points can call back into * the driver without a deadlock... */ mutex_unlock(&priv->mutex); - iwl_rate_control_register(priv->hw); + iwl4965_rate_control_register(priv->hw); rc = ieee80211_register_hw(priv->hw); priv->hw->conf.beacon_int = 100; mutex_lock(&priv->mutex); if (rc) { - iwl_rate_control_unregister(priv->hw); + iwl4965_rate_control_unregister(priv->hw); IWL_ERROR("Failed to register network " "device (error %d)\n", rc); return; @@ -6531,33 +6531,33 @@ static void iwl_alive_start(struct iwl_priv *priv) priv->mac80211_registered = 1; - iwl_reset_channel_flag(priv); + iwl4965_reset_channel_flag(priv); } else ieee80211_start_queues(priv->hw); priv->active_rate = priv->rates_mask; priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; - iwl_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); + iwl4965_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); - if (iwl_is_associated(priv)) { - struct iwl_rxon_cmd *active_rxon = - (struct iwl_rxon_cmd *)(&priv->active_rxon); + if (iwl4965_is_associated(priv)) { + struct iwl4965_rxon_cmd *active_rxon = + (struct iwl4965_rxon_cmd *)(&priv->active_rxon); memcpy(&priv->staging_rxon, &priv->active_rxon, sizeof(priv->staging_rxon)); active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; } else { /* Initialize our rx_config data */ - iwl_connection_init_rx_config(priv); + iwl4965_connection_init_rx_config(priv); memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); } /* Configure BT coexistence */ - iwl_send_bt_config(priv); + iwl4965_send_bt_config(priv); /* Configure the adapter for unassociated operation */ - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); /* At this point, the NIC is initialized and operational */ priv->notif_missed_beacons = 0; @@ -6567,7 +6567,7 @@ static void iwl_alive_start(struct iwl_priv *priv) IWL_DEBUG_INFO("ALIVE processing complete.\n"); if (priv->error_recovering) - iwl_error_recovery(priv); + iwl4965_error_recovery(priv); return; @@ -6575,9 +6575,9 @@ static void iwl_alive_start(struct iwl_priv *priv) queue_work(priv->workqueue, &priv->restart); } -static void iwl_cancel_deferred_work(struct iwl_priv *priv); +static void iwl4965_cancel_deferred_work(struct iwl4965_priv *priv); -static void __iwl_down(struct iwl_priv *priv) +static void __iwl4965_down(struct iwl4965_priv *priv) { unsigned long flags; int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status); @@ -6590,7 +6590,7 @@ static void __iwl_down(struct iwl_priv *priv) if (!exit_pending) set_bit(STATUS_EXIT_PENDING, &priv->status); - iwl_clear_stations_table(priv); + iwl4965_clear_stations_table(priv); /* Unblock any waiting calls */ wake_up_interruptible_all(&priv->wait_command_queue); @@ -6601,17 +6601,17 @@ static void __iwl_down(struct iwl_priv *priv) clear_bit(STATUS_EXIT_PENDING, &priv->status); /* stop and reset the on-board processor */ - iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); + iwl4965_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); /* tell the device to stop sending interrupts */ - iwl_disable_interrupts(priv); + iwl4965_disable_interrupts(priv); if (priv->mac80211_registered) ieee80211_stop_queues(priv->hw); - /* If we have not previously called iwl_init() then + /* If we have not previously called iwl4965_init() then * clear all bits but the RF Kill and SUSPEND bits and return */ - if (!iwl_is_init(priv)) { + if (!iwl4965_is_init(priv)) { priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << STATUS_RF_KILL_HW | test_bit(STATUS_RF_KILL_SW, &priv->status) << @@ -6633,49 +6633,49 @@ static void __iwl_down(struct iwl_priv *priv) STATUS_FW_ERROR; spin_lock_irqsave(&priv->lock, flags); - iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); + iwl4965_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); spin_unlock_irqrestore(&priv->lock, flags); - iwl_hw_txq_ctx_stop(priv); - iwl_hw_rxq_stop(priv); + iwl4965_hw_txq_ctx_stop(priv); + iwl4965_hw_rxq_stop(priv); spin_lock_irqsave(&priv->lock, flags); - if (!iwl_grab_nic_access(priv)) { - iwl_write_prph(priv, APMG_CLK_DIS_REG, + if (!iwl4965_grab_nic_access(priv)) { + iwl4965_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); } spin_unlock_irqrestore(&priv->lock, flags); udelay(5); - iwl_hw_nic_stop_master(priv); - iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); - iwl_hw_nic_reset(priv); + iwl4965_hw_nic_stop_master(priv); + iwl4965_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); + iwl4965_hw_nic_reset(priv); exit: - memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); + memset(&priv->card_alive, 0, sizeof(struct iwl4965_alive_resp)); if (priv->ibss_beacon) dev_kfree_skb(priv->ibss_beacon); priv->ibss_beacon = NULL; /* clear out any free frames */ - iwl_clear_free_frames(priv); + iwl4965_clear_free_frames(priv); } -static void iwl_down(struct iwl_priv *priv) +static void iwl4965_down(struct iwl4965_priv *priv) { mutex_lock(&priv->mutex); - __iwl_down(priv); + __iwl4965_down(priv); mutex_unlock(&priv->mutex); - iwl_cancel_deferred_work(priv); + iwl4965_cancel_deferred_work(priv); } #define MAX_HW_RESTARTS 5 -static int __iwl_up(struct iwl_priv *priv) +static int __iwl4965_up(struct iwl4965_priv *priv) { DECLARE_MAC_BUF(mac); int rc, i; @@ -6697,26 +6697,26 @@ static int __iwl_up(struct iwl_priv *priv) return -EIO; } - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); + iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF); - rc = iwl_hw_nic_init(priv); + rc = iwl4965_hw_nic_init(priv); if (rc) { IWL_ERROR("Unable to int nic\n"); return rc; } /* make sure rfkill handshake bits are cleared */ - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); /* clear (again), then enable host interrupts */ - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl_enable_interrupts(priv); + iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF); + iwl4965_enable_interrupts(priv); /* really make sure rfkill handshake bits are cleared */ - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); /* Copy original ucode data image from disk into backup cache. * This will be used to initialize the on-board processor's @@ -6727,7 +6727,7 @@ static int __iwl_up(struct iwl_priv *priv) /* If platform's RF_KILL switch is set to KILL, * wait for BIT_INT_RF_KILL interrupt before loading uCode * and getting things started */ - if (!(iwl_read32(priv, CSR_GP_CNTRL) & + if (!(iwl4965_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) hw_rf_kill = 1; @@ -6738,12 +6738,12 @@ static int __iwl_up(struct iwl_priv *priv) for (i = 0; i < MAX_HW_RESTARTS; i++) { - iwl_clear_stations_table(priv); + iwl4965_clear_stations_table(priv); /* load bootstrap state machine, * load bootstrap program into processor's memory, * prepare to load the "initialize" uCode */ - rc = iwl_load_bsm(priv); + rc = iwl4965_load_bsm(priv); if (rc) { IWL_ERROR("Unable to set up bootstrap uCode: %d\n", rc); @@ -6751,7 +6751,7 @@ static int __iwl_up(struct iwl_priv *priv) } /* start card; "initialize" will load runtime ucode */ - iwl_nic_start(priv); + iwl4965_nic_start(priv); /* MAC Address location in EEPROM same for 3945/4965 */ get_eeprom_mac(priv, priv->mac_addr); @@ -6766,7 +6766,7 @@ static int __iwl_up(struct iwl_priv *priv) } set_bit(STATUS_EXIT_PENDING, &priv->status); - __iwl_down(priv); + __iwl4965_down(priv); /* tried to restart and config the device for as long as our * patience could withstand */ @@ -6781,35 +6781,35 @@ static int __iwl_up(struct iwl_priv *priv) * *****************************************************************************/ -static void iwl_bg_init_alive_start(struct work_struct *data) +static void iwl4965_bg_init_alive_start(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, init_alive_start.work); + struct iwl4965_priv *priv = + container_of(data, struct iwl4965_priv, init_alive_start.work); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - iwl_init_alive_start(priv); + iwl4965_init_alive_start(priv); mutex_unlock(&priv->mutex); } -static void iwl_bg_alive_start(struct work_struct *data) +static void iwl4965_bg_alive_start(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, alive_start.work); + struct iwl4965_priv *priv = + container_of(data, struct iwl4965_priv, alive_start.work); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - iwl_alive_start(priv); + iwl4965_alive_start(priv); mutex_unlock(&priv->mutex); } -static void iwl_bg_rf_kill(struct work_struct *work) +static void iwl4965_bg_rf_kill(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill); + struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv, rf_kill); wake_up_interruptible(&priv->wait_command_queue); @@ -6818,7 +6818,7 @@ static void iwl_bg_rf_kill(struct work_struct *work) mutex_lock(&priv->mutex); - if (!iwl_is_rfkill(priv)) { + if (!iwl4965_is_rfkill(priv)) { IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL, "HW and/or SW RF Kill no longer active, restarting " "device\n"); @@ -6839,10 +6839,10 @@ static void iwl_bg_rf_kill(struct work_struct *work) #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) -static void iwl_bg_scan_check(struct work_struct *data) +static void iwl4965_bg_scan_check(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, scan_check.work); + struct iwl4965_priv *priv = + container_of(data, struct iwl4965_priv, scan_check.work); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; @@ -6855,22 +6855,22 @@ static void iwl_bg_scan_check(struct work_struct *data) jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) - iwl_send_scan_abort(priv); + iwl4965_send_scan_abort(priv); } mutex_unlock(&priv->mutex); } -static void iwl_bg_request_scan(struct work_struct *data) +static void iwl4965_bg_request_scan(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, request_scan); - struct iwl_host_cmd cmd = { + struct iwl4965_priv *priv = + container_of(data, struct iwl4965_priv, request_scan); + struct iwl4965_host_cmd cmd = { .id = REPLY_SCAN_CMD, - .len = sizeof(struct iwl_scan_cmd), + .len = sizeof(struct iwl4965_scan_cmd), .meta.flags = CMD_SIZE_HUGE, }; int rc = 0; - struct iwl_scan_cmd *scan; + struct iwl4965_scan_cmd *scan; struct ieee80211_conf *conf = NULL; u8 direct_mask; int phymode; @@ -6879,7 +6879,7 @@ static void iwl_bg_request_scan(struct work_struct *data) mutex_lock(&priv->mutex); - if (!iwl_is_ready(priv)) { + if (!iwl4965_is_ready(priv)) { IWL_WARNING("request scan called when driver not ready.\n"); goto done; } @@ -6908,7 +6908,7 @@ static void iwl_bg_request_scan(struct work_struct *data) goto done; } - if (iwl_is_rfkill(priv)) { + if (iwl4965_is_rfkill(priv)) { IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n"); goto done; } @@ -6924,7 +6924,7 @@ static void iwl_bg_request_scan(struct work_struct *data) } if (!priv->scan) { - priv->scan = kmalloc(sizeof(struct iwl_scan_cmd) + + priv->scan = kmalloc(sizeof(struct iwl4965_scan_cmd) + IWL_MAX_SCAN_SIZE, GFP_KERNEL); if (!priv->scan) { rc = -ENOMEM; @@ -6932,12 +6932,12 @@ static void iwl_bg_request_scan(struct work_struct *data) } } scan = priv->scan; - memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE); + memset(scan, 0, sizeof(struct iwl4965_scan_cmd) + IWL_MAX_SCAN_SIZE); scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; scan->quiet_time = IWL_ACTIVE_QUIET_TIME; - if (iwl_is_associated(priv)) { + if (iwl4965_is_associated(priv)) { u16 interval = 0; u32 extra; u32 suspend_time = 100; @@ -6967,14 +6967,14 @@ static void iwl_bg_request_scan(struct work_struct *data) if (priv->one_direct_scan) { IWL_DEBUG_SCAN ("Kicking off one direct scan for '%s'\n", - iwl_escape_essid(priv->direct_ssid, + iwl4965_escape_essid(priv->direct_ssid, priv->direct_ssid_len)); scan->direct_scan[0].id = WLAN_EID_SSID; scan->direct_scan[0].len = priv->direct_ssid_len; memcpy(scan->direct_scan[0].ssid, priv->direct_ssid, priv->direct_ssid_len); direct_mask = 1; - } else if (!iwl_is_associated(priv) && priv->essid_len) { + } else if (!iwl4965_is_associated(priv) && priv->essid_len) { scan->direct_scan[0].id = WLAN_EID_SSID; scan->direct_scan[0].len = priv->essid_len; memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); @@ -6985,7 +6985,7 @@ static void iwl_bg_request_scan(struct work_struct *data) /* We don't build a direct scan probe request; the uCode will do * that based on the direct_mask added to each channel entry */ scan->tx_cmd.len = cpu_to_le16( - iwl_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, + iwl4965_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, IWL_MAX_SCAN_SIZE - sizeof(scan), 0)); scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; @@ -6999,7 +6999,7 @@ static void iwl_bg_request_scan(struct work_struct *data) case 2: scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; scan->tx_cmd.rate_n_flags = - iwl_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, + iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, RATE_MCS_ANT_B_MSK|RATE_MCS_CCK_MSK); scan->good_CRC_th = 0; @@ -7008,7 +7008,7 @@ static void iwl_bg_request_scan(struct work_struct *data) case 1: scan->tx_cmd.rate_n_flags = - iwl_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, + iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, RATE_MCS_ANT_B_MSK); scan->good_CRC_th = IWL_GOOD_CRC_TH; phymode = MODE_IEEE80211A; @@ -7035,23 +7035,23 @@ static void iwl_bg_request_scan(struct work_struct *data) if (direct_mask) IWL_DEBUG_SCAN ("Initiating direct scan for %s.\n", - iwl_escape_essid(priv->essid, priv->essid_len)); + iwl4965_escape_essid(priv->essid, priv->essid_len)); else IWL_DEBUG_SCAN("Initiating indirect scan.\n"); scan->channel_count = - iwl_get_channels_for_scan( + iwl4965_get_channels_for_scan( priv, phymode, 1, /* active */ direct_mask, (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); cmd.len += le16_to_cpu(scan->tx_cmd.len) + - scan->channel_count * sizeof(struct iwl_scan_channel); + scan->channel_count * sizeof(struct iwl4965_scan_channel); cmd.data = scan; scan->len = cpu_to_le16(cmd.len); set_bit(STATUS_SCAN_HW, &priv->status); - rc = iwl_send_cmd_sync(priv, &cmd); + rc = iwl4965_send_cmd_sync(priv, &cmd); if (rc) goto done; @@ -7067,45 +7067,45 @@ static void iwl_bg_request_scan(struct work_struct *data) mutex_unlock(&priv->mutex); } -static void iwl_bg_up(struct work_struct *data) +static void iwl4965_bg_up(struct work_struct *data) { - struct iwl_priv *priv = container_of(data, struct iwl_priv, up); + struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv, up); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - __iwl_up(priv); + __iwl4965_up(priv); mutex_unlock(&priv->mutex); } -static void iwl_bg_restart(struct work_struct *data) +static void iwl4965_bg_restart(struct work_struct *data) { - struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); + struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv, restart); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; - iwl_down(priv); + iwl4965_down(priv); queue_work(priv->workqueue, &priv->up); } -static void iwl_bg_rx_replenish(struct work_struct *data) +static void iwl4965_bg_rx_replenish(struct work_struct *data) { - struct iwl_priv *priv = - container_of(data, struct iwl_priv, rx_replenish); + struct iwl4965_priv *priv = + container_of(data, struct iwl4965_priv, rx_replenish); if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; mutex_lock(&priv->mutex); - iwl_rx_replenish(priv); + iwl4965_rx_replenish(priv); mutex_unlock(&priv->mutex); } -static void iwl_bg_post_associate(struct work_struct *data) +static void iwl4965_bg_post_associate(struct work_struct *data) { - struct iwl_priv *priv = container_of(data, struct iwl_priv, + struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv, post_associate.work); int rc = 0; @@ -7131,16 +7131,16 @@ static void iwl_bg_post_associate(struct work_struct *data) mutex_unlock(&priv->mutex); return; } - iwl_scan_cancel_timeout(priv, 200); + iwl4965_scan_cancel_timeout(priv, 200); conf = ieee80211_get_hw_conf(priv->hw); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); - memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); - iwl_setup_rxon_timing(priv); - rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, + memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); + iwl4965_setup_rxon_timing(priv); + rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON_TIMING, sizeof(priv->rxon_timing), &priv->rxon_timing); if (rc) IWL_WARNING("REPLY_RXON_TIMING failed - " @@ -7179,22 +7179,22 @@ static void iwl_bg_post_associate(struct work_struct *data) } - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); switch (priv->iw_mode) { case IEEE80211_IF_TYPE_STA: - iwl_rate_scale_init(priv->hw, IWL_AP_ID); + iwl4965_rate_scale_init(priv->hw, IWL_AP_ID); break; case IEEE80211_IF_TYPE_IBSS: /* clear out the station table */ - iwl_clear_stations_table(priv); + iwl4965_clear_stations_table(priv); - iwl_rxon_add_station(priv, BROADCAST_ADDR, 0); - iwl_rxon_add_station(priv, priv->bssid, 0); - iwl_rate_scale_init(priv->hw, IWL_STA_ID); - iwl_send_beacon_cmd(priv); + iwl4965_rxon_add_station(priv, iwl4965_broadcast_addr, 0); + iwl4965_rxon_add_station(priv, priv->bssid, 0); + iwl4965_rate_scale_init(priv->hw, IWL_STA_ID); + iwl4965_send_beacon_cmd(priv); break; @@ -7204,7 +7204,7 @@ static void iwl_bg_post_associate(struct work_struct *data) break; } - iwl_sequence_reset(priv); + iwl4965_sequence_reset(priv); #ifdef CONFIG_IWL4965_SENSITIVITY /* Enable Rx differential gain and sensitivity calibrations */ @@ -7216,30 +7216,30 @@ static void iwl_bg_post_associate(struct work_struct *data) priv->assoc_station_added = 1; #ifdef CONFIG_IWL4965_QOS - iwl_activate_qos(priv, 0); + iwl4965_activate_qos(priv, 0); #endif /* CONFIG_IWL4965_QOS */ mutex_unlock(&priv->mutex); } -static void iwl_bg_abort_scan(struct work_struct *work) +static void iwl4965_bg_abort_scan(struct work_struct *work) { - struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); + struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv, abort_scan); - if (!iwl_is_ready(priv)) + if (!iwl4965_is_ready(priv)) return; mutex_lock(&priv->mutex); set_bit(STATUS_SCAN_ABORTING, &priv->status); - iwl_send_scan_abort(priv); + iwl4965_send_scan_abort(priv); mutex_unlock(&priv->mutex); } -static void iwl_bg_scan_completed(struct work_struct *work) +static void iwl4965_bg_scan_completed(struct work_struct *work) { - struct iwl_priv *priv = - container_of(work, struct iwl_priv, scan_completed); + struct iwl4965_priv *priv = + container_of(work, struct iwl4965_priv, scan_completed); IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n"); @@ -7251,7 +7251,7 @@ static void iwl_bg_scan_completed(struct work_struct *work) /* Since setting the TXPOWER may have been deferred while * performing the scan, fire one off */ mutex_lock(&priv->mutex); - iwl_hw_reg_send_txpower(priv); + iwl4965_hw_reg_send_txpower(priv); mutex_unlock(&priv->mutex); } @@ -7261,9 +7261,9 @@ static void iwl_bg_scan_completed(struct work_struct *work) * *****************************************************************************/ -static int iwl_mac_start(struct ieee80211_hw *hw) +static int iwl4965_mac_start(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter\n"); @@ -7272,7 +7272,7 @@ static int iwl_mac_start(struct ieee80211_hw *hw) priv->is_open = 1; - if (!iwl_is_rfkill(priv)) + if (!iwl4965_is_rfkill(priv)) ieee80211_start_queues(priv->hw); mutex_unlock(&priv->mutex); @@ -7280,9 +7280,9 @@ static int iwl_mac_start(struct ieee80211_hw *hw) return 0; } -static void iwl_mac_stop(struct ieee80211_hw *hw) +static void iwl4965_mac_stop(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter\n"); @@ -7292,19 +7292,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw) * RXON_FILTER_ASSOC_MSK BIT */ priv->is_open = 0; - iwl_scan_cancel_timeout(priv, 100); + iwl4965_scan_cancel_timeout(priv, 100); cancel_delayed_work(&priv->post_associate); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); mutex_unlock(&priv->mutex); IWL_DEBUG_MAC80211("leave\n"); } -static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, +static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, struct ieee80211_tx_control *ctl) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter\n"); @@ -7316,17 +7316,17 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, ctl->tx_rate); - if (iwl_tx_skb(priv, skb, ctl)) + if (iwl4965_tx_skb(priv, skb, ctl)) dev_kfree_skb_any(skb); IWL_DEBUG_MAC80211("leave\n"); return 0; } -static int iwl_mac_add_interface(struct ieee80211_hw *hw, +static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; unsigned long flags; DECLARE_MAC_BUF(mac); @@ -7348,7 +7348,7 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr)); memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); } - iwl_set_mode(priv, conf->type); + iwl4965_set_mode(priv, conf->type); IWL_DEBUG_MAC80211("leave\n"); mutex_unlock(&priv->mutex); @@ -7357,22 +7357,22 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw, } /** - * iwl_mac_config - mac80211 config callback + * iwl4965_mac_config - mac80211 config callback * * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to * be set inappropriately and the driver currently sets the hardware up to * use it whenever needed. */ -static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) +static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) { - struct iwl_priv *priv = hw->priv; - const struct iwl_channel_info *ch_info; + struct iwl4965_priv *priv = hw->priv; + const struct iwl4965_channel_info *ch_info; unsigned long flags; mutex_lock(&priv->mutex); IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); - if (!iwl_is_ready(priv)) { + if (!iwl4965_is_ready(priv)) { IWL_DEBUG_MAC80211("leave - not ready\n"); mutex_unlock(&priv->mutex); return -EIO; @@ -7380,7 +7380,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only * what is exposed through include/ declarations */ - if (unlikely(!iwl_param_disable_hw_scan && + if (unlikely(!iwl4965_param_disable_hw_scan && test_bit(STATUS_SCANNING, &priv->status))) { IWL_DEBUG_MAC80211("leave - scanning\n"); mutex_unlock(&priv->mutex); @@ -7389,7 +7389,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) spin_lock_irqsave(&priv->lock, flags); - ch_info = iwl_get_channel_info(priv, conf->phymode, conf->channel); + ch_info = iwl4965_get_channel_info(priv, conf->phymode, conf->channel); if (!is_channel_valid(ch_info)) { IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", conf->channel, conf->phymode); @@ -7411,26 +7411,26 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) priv->staging_rxon.flags = 0; #endif /* CONFIG_IWL4965_HT */ - iwl_set_rxon_channel(priv, conf->phymode, conf->channel); + iwl4965_set_rxon_channel(priv, conf->phymode, conf->channel); - iwl_set_flags_for_phymode(priv, conf->phymode); + iwl4965_set_flags_for_phymode(priv, conf->phymode); /* The list of supported rates and rate mask can be different * for each phymode; since the phymode may have changed, reset * the rate mask to what mac80211 lists */ - iwl_set_rate(priv); + iwl4965_set_rate(priv); spin_unlock_irqrestore(&priv->lock, flags); #ifdef IEEE80211_CONF_CHANNEL_SWITCH if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { - iwl_hw_channel_switch(priv, conf->channel); + iwl4965_hw_channel_switch(priv, conf->channel); mutex_unlock(&priv->mutex); return 0; } #endif - iwl_radio_kill_sw(priv, !conf->radio_enabled); + iwl4965_radio_kill_sw(priv, !conf->radio_enabled); if (!conf->radio_enabled) { IWL_DEBUG_MAC80211("leave - radio disabled\n"); @@ -7438,17 +7438,17 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) return 0; } - if (iwl_is_rfkill(priv)) { + if (iwl4965_is_rfkill(priv)) { IWL_DEBUG_MAC80211("leave - RF kill\n"); mutex_unlock(&priv->mutex); return -EIO; } - iwl_set_rate(priv); + iwl4965_set_rate(priv); if (memcmp(&priv->active_rxon, &priv->staging_rxon, sizeof(priv->staging_rxon))) - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); else IWL_DEBUG_INFO("No re-sending same RXON configuration.\n"); @@ -7459,7 +7459,7 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) return 0; } -static void iwl_config_ap(struct iwl_priv *priv) +static void iwl4965_config_ap(struct iwl4965_priv *priv) { int rc = 0; @@ -7471,12 +7471,12 @@ static void iwl_config_ap(struct iwl_priv *priv) /* RXON - unassoc (to set timing command) */ priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); /* RXON Timing */ - memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); - iwl_setup_rxon_timing(priv); - rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, + memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); + iwl4965_setup_rxon_timing(priv); + rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON_TIMING, sizeof(priv->rxon_timing), &priv->rxon_timing); if (rc) IWL_WARNING("REPLY_RXON_TIMING failed - " @@ -7508,23 +7508,23 @@ static void iwl_config_ap(struct iwl_priv *priv) } /* restore RXON assoc */ priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); #ifdef CONFIG_IWL4965_QOS - iwl_activate_qos(priv, 1); + iwl4965_activate_qos(priv, 1); #endif - iwl_rxon_add_station(priv, BROADCAST_ADDR, 0); + iwl4965_rxon_add_station(priv, iwl4965_broadcast_addr, 0); } - iwl_send_beacon_cmd(priv); + iwl4965_send_beacon_cmd(priv); /* FIXME - we need to add code here to detect a totally new * configuration, reset the AP, unassoc, rxon timing, assoc, * clear sta table, add BCAST sta... */ } -static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, +static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, struct ieee80211_if_conf *conf) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; DECLARE_MAC_BUF(mac); unsigned long flags; int rc; @@ -7581,7 +7581,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, !is_multicast_ether_addr(conf->bssid)) { /* If there is currently a HW scan going on in the background * then we need to cancel it else the RXON below will fail. */ - if (iwl_scan_cancel_timeout(priv, 100)) { + if (iwl4965_scan_cancel_timeout(priv, 100)) { IWL_WARNING("Aborted scan still in progress " "after 100ms\n"); IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); @@ -7597,18 +7597,18 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, memcpy(priv->bssid, conf->bssid, ETH_ALEN); if (priv->iw_mode == IEEE80211_IF_TYPE_AP) - iwl_config_ap(priv); + iwl4965_config_ap(priv); else { - rc = iwl_commit_rxon(priv); + rc = iwl4965_commit_rxon(priv); if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) - iwl_rxon_add_station( + iwl4965_rxon_add_station( priv, priv->active_rxon.bssid_addr, 1); } } else { - iwl_scan_cancel_timeout(priv, 100); + iwl4965_scan_cancel_timeout(priv, 100); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); } spin_lock_irqsave(&priv->lock, flags); @@ -7626,31 +7626,31 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, return 0; } -static void iwl_configure_filter(struct ieee80211_hw *hw, +static void iwl4965_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, int mc_count, struct dev_addr_list *mc_list) { /* * XXX: dummy - * see also iwl_connection_init_rx_config + * see also iwl4965_connection_init_rx_config */ *total_flags = 0; } -static void iwl_mac_remove_interface(struct ieee80211_hw *hw, +static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter\n"); mutex_lock(&priv->mutex); - iwl_scan_cancel_timeout(priv, 100); + iwl4965_scan_cancel_timeout(priv, 100); cancel_delayed_work(&priv->post_associate); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); if (priv->interface_id == conf->if_id) { priv->interface_id = 0; @@ -7663,11 +7663,10 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw, IWL_DEBUG_MAC80211("leave\n"); } -static void iwl_mac_erp_ie_changed(struct ieee80211_hw *hw, +static void iwl4965_mac_erp_ie_changed(struct ieee80211_hw *hw, u8 changes, int cts_protection, int preamble) { - - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; if (changes & IEEE80211_ERP_CHANGE_PREAMBLE) { if (preamble == WLAN_ERP_PREAMBLE_SHORT) @@ -7683,23 +7682,23 @@ static void iwl_mac_erp_ie_changed(struct ieee80211_hw *hw, priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; } - if (iwl_is_associated(priv)) - iwl_send_rxon_assoc(priv); + if (iwl4965_is_associated(priv)) + iwl4965_send_rxon_assoc(priv); } #define IWL_DELAY_NEXT_SCAN (HZ*2) -static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) +static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) { int rc = 0; unsigned long flags; - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter\n"); mutex_lock(&priv->mutex); spin_lock_irqsave(&priv->lock, flags); - if (!iwl_is_ready_rf(priv)) { + if (!iwl4965_is_ready_rf(priv)) { rc = -EIO; IWL_DEBUG_MAC80211("leave - not ready or exit pending\n"); goto out_unlock; @@ -7721,7 +7720,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) if (len) { IWL_DEBUG_SCAN("direct scan for " "%s [%d]\n ", - iwl_escape_essid(ssid, len), (int)len); + iwl4965_escape_essid(ssid, len), (int)len); priv->one_direct_scan = 1; priv->direct_ssid_len = (u8) @@ -7730,7 +7729,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) } else priv->one_direct_scan = 0; - rc = iwl_scan_initiate(priv); + rc = iwl4965_scan_initiate(priv); IWL_DEBUG_MAC80211("leave\n"); @@ -7741,18 +7740,18 @@ out_unlock: return rc; } -static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, +static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, const u8 *local_addr, const u8 *addr, struct ieee80211_key_conf *key) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; DECLARE_MAC_BUF(mac); int rc = 0; u8 sta_id; IWL_DEBUG_MAC80211("enter\n"); - if (!iwl_param_hwcrypto) { + if (!iwl4965_param_hwcrypto) { IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n"); return -EOPNOTSUPP; } @@ -7761,7 +7760,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, /* only support pairwise keys */ return -EOPNOTSUPP; - sta_id = iwl_hw_find_station(priv, addr); + sta_id = iwl4965_hw_find_station(priv, addr); if (sta_id == IWL_INVALID_STATION) { IWL_DEBUG_MAC80211("leave - %s not in station map.\n", print_mac(mac, addr)); @@ -7770,24 +7769,24 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, mutex_lock(&priv->mutex); - iwl_scan_cancel_timeout(priv, 100); + iwl4965_scan_cancel_timeout(priv, 100); switch (cmd) { case SET_KEY: - rc = iwl_update_sta_key_info(priv, key, sta_id); + rc = iwl4965_update_sta_key_info(priv, key, sta_id); if (!rc) { - iwl_set_rxon_hwcrypto(priv, 1); - iwl_commit_rxon(priv); + iwl4965_set_rxon_hwcrypto(priv, 1); + iwl4965_commit_rxon(priv); key->hw_key_idx = sta_id; IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n"); key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; } break; case DISABLE_KEY: - rc = iwl_clear_sta_key_info(priv, sta_id); + rc = iwl4965_clear_sta_key_info(priv, sta_id); if (!rc) { - iwl_set_rxon_hwcrypto(priv, 0); - iwl_commit_rxon(priv); + iwl4965_set_rxon_hwcrypto(priv, 0); + iwl4965_commit_rxon(priv); IWL_DEBUG_MAC80211("disable hwcrypto key\n"); } break; @@ -7801,10 +7800,10 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, return rc; } -static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, +static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; #ifdef CONFIG_IWL4965_QOS unsigned long flags; int q; @@ -7812,7 +7811,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, IWL_DEBUG_MAC80211("enter\n"); - if (!iwl_is_ready_rf(priv)) { + if (!iwl4965_is_ready_rf(priv)) { IWL_DEBUG_MAC80211("leave - RF not ready\n"); return -EIO; } @@ -7845,9 +7844,9 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, mutex_lock(&priv->mutex); if (priv->iw_mode == IEEE80211_IF_TYPE_AP) - iwl_activate_qos(priv, 1); - else if (priv->assoc_id && iwl_is_associated(priv)) - iwl_activate_qos(priv, 0); + iwl4965_activate_qos(priv, 1); + else if (priv->assoc_id && iwl4965_is_associated(priv)) + iwl4965_activate_qos(priv, 0); mutex_unlock(&priv->mutex); @@ -7857,18 +7856,18 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue, return 0; } -static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, +static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw, struct ieee80211_tx_queue_stats *stats) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; int i, avail; - struct iwl_tx_queue *txq; - struct iwl_queue *q; + struct iwl4965_tx_queue *txq; + struct iwl4965_queue *q; unsigned long flags; IWL_DEBUG_MAC80211("enter\n"); - if (!iwl_is_ready_rf(priv)) { + if (!iwl4965_is_ready_rf(priv)) { IWL_DEBUG_MAC80211("leave - RF not ready\n"); return -EIO; } @@ -7878,7 +7877,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, for (i = 0; i < AC_NUM; i++) { txq = &priv->txq[i]; q = &txq->q; - avail = iwl_queue_space(q); + avail = iwl4965_queue_space(q); stats->data[i].len = q->n_window - avail; stats->data[i].limit = q->n_window - q->high_mark; @@ -7892,7 +7891,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, return 0; } -static int iwl_mac_get_stats(struct ieee80211_hw *hw, +static int iwl4965_mac_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats) { IWL_DEBUG_MAC80211("enter\n"); @@ -7901,7 +7900,7 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw, return 0; } -static u64 iwl_mac_get_tsf(struct ieee80211_hw *hw) +static u64 iwl4965_mac_get_tsf(struct ieee80211_hw *hw) { IWL_DEBUG_MAC80211("enter\n"); IWL_DEBUG_MAC80211("leave\n"); @@ -7909,9 +7908,9 @@ static u64 iwl_mac_get_tsf(struct ieee80211_hw *hw) return 0; } -static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) +static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; unsigned long flags; mutex_lock(&priv->mutex); @@ -7926,7 +7925,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) /* if (priv->lq_mngr.agg_ctrl.granted_ba) iwl4965_turn_off_agg(priv, TID_ALL_SPECIFIED);*/ - memset(&(priv->lq_mngr.agg_ctrl), 0, sizeof(struct iwl_agg_control)); + memset(&(priv->lq_mngr.agg_ctrl), 0, sizeof(struct iwl4965_agg_control)); priv->lq_mngr.agg_ctrl.tid_traffic_load_threshold = 10; priv->lq_mngr.agg_ctrl.ba_timeout = 5000; priv->lq_mngr.agg_ctrl.auto_agg = 1; @@ -7937,7 +7936,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) #endif /* CONFIG_IWL4965_HT */ #ifdef CONFIG_IWL4965_QOS - iwl_reset_qos(priv); + iwl4965_reset_qos(priv); #endif cancel_delayed_work(&priv->post_associate); @@ -7966,9 +7965,9 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) * clear RXON_FILTER_ASSOC_MSK bit */ if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { - iwl_scan_cancel_timeout(priv, 100); + iwl4965_scan_cancel_timeout(priv, 100); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); } /* Per mac80211.h: This is only used in IBSS mode... */ @@ -7979,7 +7978,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) return; } - if (!iwl_is_ready_rf(priv)) { + if (!iwl4965_is_ready_rf(priv)) { IWL_DEBUG_MAC80211("leave - not ready\n"); mutex_unlock(&priv->mutex); return; @@ -7987,7 +7986,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) priv->only_active_channel = 0; - iwl_set_rate(priv); + iwl4965_set_rate(priv); mutex_unlock(&priv->mutex); @@ -7995,16 +7994,16 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) } -static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, +static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, struct ieee80211_tx_control *control) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; unsigned long flags; mutex_lock(&priv->mutex); IWL_DEBUG_MAC80211("enter\n"); - if (!iwl_is_ready_rf(priv)) { + if (!iwl4965_is_ready_rf(priv)) { IWL_DEBUG_MAC80211("leave - RF not ready\n"); mutex_unlock(&priv->mutex); return -EIO; @@ -8029,7 +8028,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, spin_unlock_irqrestore(&priv->lock, flags); #ifdef CONFIG_IWL4965_QOS - iwl_reset_qos(priv); + iwl4965_reset_qos(priv); #endif queue_work(priv->workqueue, &priv->post_associate.work); @@ -8156,11 +8155,11 @@ static int sta_ht_info_init(struct ieee80211_ht_capability *ht_cap, return 0; } -static int iwl_mac_conf_ht(struct ieee80211_hw *hw, +static int iwl4965_mac_conf_ht(struct ieee80211_hw *hw, struct ieee80211_ht_capability *ht_cap, struct ieee80211_ht_additional_info *ht_extra) { - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; int rs; IWL_DEBUG_MAC80211("enter: \n"); @@ -8186,7 +8185,7 @@ static int iwl_mac_conf_ht(struct ieee80211_hw *hw, } -static void iwl_set_ht_capab(struct ieee80211_hw *hw, +static void iwl4965_set_ht_capab(struct ieee80211_hw *hw, struct ieee80211_ht_capability *ht_cap, u8 use_wide_chan) { @@ -8214,11 +8213,11 @@ static void iwl_set_ht_capab(struct ieee80211_hw *hw, (cap.supported_chan_width_set) ? 0x1: 0x0; } -static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw, +static void iwl4965_mac_get_ht_capab(struct ieee80211_hw *hw, struct ieee80211_ht_capability *ht_cap) { u8 use_wide_channel = 1; - struct iwl_priv *priv = hw->priv; + struct iwl4965_priv *priv = hw->priv; IWL_DEBUG_MAC80211("enter: \n"); if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ) @@ -8228,7 +8227,7 @@ static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw, if (priv->phymode != MODE_IEEE80211A) use_wide_channel = 0; - iwl_set_ht_capab(hw, ht_cap, use_wide_channel); + iwl4965_set_ht_capab(hw, ht_cap, use_wide_channel); IWL_DEBUG_MAC80211("leave: \n"); } #endif /*CONFIG_IWL4965_HT*/ @@ -8251,7 +8250,7 @@ static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw, static ssize_t show_debug_level(struct device_driver *d, char *buf) { - return sprintf(buf, "0x%08X\n", iwl_debug_level); + return sprintf(buf, "0x%08X\n", iwl4965_debug_level); } static ssize_t store_debug_level(struct device_driver *d, const char *buf, size_t count) @@ -8264,7 +8263,7 @@ static ssize_t store_debug_level(struct device_driver *d, printk(KERN_INFO DRV_NAME ": %s is not in hex or decimal form.\n", buf); else - iwl_debug_level = val; + iwl4965_debug_level = val; return strnlen(buf, count); } @@ -8283,7 +8282,7 @@ static ssize_t show_rf_kill(struct device *d, * 2 - HW based RF kill active * 3 - Both HW and SW based RF kill active */ - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) | (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0); @@ -8294,10 +8293,10 @@ static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; mutex_lock(&priv->mutex); - iwl_radio_kill_sw(priv, buf[0] == '1'); + iwl4965_radio_kill_sw(priv, buf[0] == '1'); mutex_unlock(&priv->mutex); return count; @@ -8308,12 +8307,12 @@ static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); static ssize_t show_temperature(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; - if (!iwl_is_alive(priv)) + if (!iwl4965_is_alive(priv)) return -EAGAIN; - return sprintf(buf, "%d\n", iwl_hw_get_temperature(priv)); + return sprintf(buf, "%d\n", iwl4965_hw_get_temperature(priv)); } static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); @@ -8322,15 +8321,15 @@ static ssize_t show_rs_window(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = d->driver_data; - return iwl_fill_rs_info(priv->hw, buf, IWL_AP_ID); + struct iwl4965_priv *priv = d->driver_data; + return iwl4965_fill_rs_info(priv->hw, buf, IWL_AP_ID); } static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); static ssize_t show_tx_power(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; return sprintf(buf, "%d\n", priv->user_txpower_limit); } @@ -8338,7 +8337,7 @@ static ssize_t store_tx_power(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; char *p = (char *)buf; u32 val; @@ -8347,7 +8346,7 @@ static ssize_t store_tx_power(struct device *d, printk(KERN_INFO DRV_NAME ": %s is not in decimal form.\n", buf); else - iwl_hw_reg_set_txpower(priv, val); + iwl4965_hw_reg_set_txpower(priv, val); return count; } @@ -8357,7 +8356,7 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power); static ssize_t show_flags(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; return sprintf(buf, "0x%04X\n", priv->active_rxon.flags); } @@ -8366,19 +8365,19 @@ static ssize_t store_flags(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; u32 flags = simple_strtoul(buf, NULL, 0); mutex_lock(&priv->mutex); if (le32_to_cpu(priv->staging_rxon.flags) != flags) { /* Cancel any currently running scans... */ - if (iwl_scan_cancel_timeout(priv, 100)) + if (iwl4965_scan_cancel_timeout(priv, 100)) IWL_WARNING("Could not cancel scan.\n"); else { IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", flags); priv->staging_rxon.flags = cpu_to_le32(flags); - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); } } mutex_unlock(&priv->mutex); @@ -8391,7 +8390,7 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, show_flags, store_flags); static ssize_t show_filter_flags(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; return sprintf(buf, "0x%04X\n", le32_to_cpu(priv->active_rxon.filter_flags)); @@ -8401,20 +8400,20 @@ static ssize_t store_filter_flags(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; u32 filter_flags = simple_strtoul(buf, NULL, 0); mutex_lock(&priv->mutex); if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { /* Cancel any currently running scans... */ - if (iwl_scan_cancel_timeout(priv, 100)) + if (iwl4965_scan_cancel_timeout(priv, 100)) IWL_WARNING("Could not cancel scan.\n"); else { IWL_DEBUG_INFO("Committing rxon.filter_flags = " "0x%04X\n", filter_flags); priv->staging_rxon.filter_flags = cpu_to_le32(filter_flags); - iwl_commit_rxon(priv); + iwl4965_commit_rxon(priv); } } mutex_unlock(&priv->mutex); @@ -8428,20 +8427,20 @@ static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, static ssize_t show_tune(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; return sprintf(buf, "0x%04X\n", (priv->phymode << 8) | le16_to_cpu(priv->active_rxon.channel)); } -static void iwl_set_flags_for_phymode(struct iwl_priv *priv, u8 phymode); +static void iwl4965_set_flags_for_phymode(struct iwl4965_priv *priv, u8 phymode); static ssize_t store_tune(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; char *p = (char *)buf; u16 tune = simple_strtoul(p, &p, 0); u8 phymode = (tune >> 8) & 0xff; @@ -8452,9 +8451,9 @@ static ssize_t store_tune(struct device *d, mutex_lock(&priv->mutex); if ((le16_to_cpu(priv->staging_rxon.channel) != channel) || (priv->phymode != phymode)) { - const struct iwl_channel_info *ch_info; + const struct iwl4965_channel_info *ch_info; - ch_info = iwl_get_channel_info(priv, phymode, channel); + ch_info = iwl4965_get_channel_info(priv, phymode, channel); if (!ch_info) { IWL_WARNING("Requested invalid phymode/channel " "combination: %d %d\n", phymode, channel); @@ -8463,18 +8462,18 @@ static ssize_t store_tune(struct device *d, } /* Cancel any currently running scans... */ - if (iwl_scan_cancel_timeout(priv, 100)) + if (iwl4965_scan_cancel_timeout(priv, 100)) IWL_WARNING("Could not cancel scan.\n"); else { IWL_DEBUG_INFO("Committing phymode and " "rxon.channel = %d %d\n", phymode, channel); - iwl_set_rxon_channel(priv, phymode, channel); - iwl_set_flags_for_phymode(priv, phymode); + iwl4965_set_rxon_channel(priv, phymode, channel); + iwl4965_set_flags_for_phymode(priv, phymode); - iwl_set_rate(priv); - iwl_commit_rxon(priv); + iwl4965_set_rate(priv); + iwl4965_commit_rxon(priv); } } mutex_unlock(&priv->mutex); @@ -8489,8 +8488,8 @@ static DEVICE_ATTR(tune, S_IWUSR | S_IRUGO, show_tune, store_tune); static ssize_t show_measurement(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); - struct iwl_spectrum_notification measure_report; + struct iwl4965_priv *priv = dev_get_drvdata(d); + struct iwl4965_spectrum_notification measure_report; u32 size = sizeof(measure_report), len = 0, ofs = 0; u8 *data = (u8 *) & measure_report; unsigned long flags; @@ -8522,7 +8521,7 @@ static ssize_t store_measurement(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl4965_priv *priv = dev_get_drvdata(d); struct ieee80211_measurement_params params = { .channel = le16_to_cpu(priv->active_rxon.channel), .start_time = cpu_to_le64(priv->last_tsf), @@ -8548,7 +8547,7 @@ static ssize_t store_measurement(struct device *d, IWL_DEBUG_INFO("Invoking measurement of type %d on " "channel %d (for '%s')\n", type, params.channel, buf); - iwl_get_measurement(priv, ¶ms, type); + iwl4965_get_measurement(priv, ¶ms, type); return count; } @@ -8561,7 +8560,7 @@ static ssize_t store_retry_rate(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl4965_priv *priv = dev_get_drvdata(d); priv->retry_rate = simple_strtoul(buf, NULL, 0); if (priv->retry_rate <= 0) @@ -8573,7 +8572,7 @@ static ssize_t store_retry_rate(struct device *d, static ssize_t show_retry_rate(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl4965_priv *priv = dev_get_drvdata(d); return sprintf(buf, "%d", priv->retry_rate); } @@ -8584,14 +8583,14 @@ static ssize_t store_power_level(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl4965_priv *priv = dev_get_drvdata(d); int rc; int mode; mode = simple_strtoul(buf, NULL, 0); mutex_lock(&priv->mutex); - if (!iwl_is_ready(priv)) { + if (!iwl4965_is_ready(priv)) { rc = -EAGAIN; goto out; } @@ -8602,7 +8601,7 @@ static ssize_t store_power_level(struct device *d, mode |= IWL_POWER_ENABLED; if (mode != priv->power_mode) { - rc = iwl_send_power_mode(priv, IWL_POWER_LEVEL(mode)); + rc = iwl4965_send_power_mode(priv, IWL_POWER_LEVEL(mode)); if (rc) { IWL_DEBUG_MAC80211("failed setting power mode.\n"); goto out; @@ -8638,7 +8637,7 @@ static const s32 period_duration[] = { static ssize_t show_power_level(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl4965_priv *priv = dev_get_drvdata(d); int level = IWL_POWER_LEVEL(priv->power_mode); char *p = buf; @@ -8673,18 +8672,18 @@ static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, static ssize_t show_channels(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl4965_priv *priv = dev_get_drvdata(d); int len = 0, i; struct ieee80211_channel *channels = NULL; const struct ieee80211_hw_mode *hw_mode = NULL; int count = 0; - if (!iwl_is_ready(priv)) + if (!iwl4965_is_ready(priv)) return -EAGAIN; - hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211G); + hw_mode = iwl4965_get_hw_mode(priv, MODE_IEEE80211G); if (!hw_mode) - hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211B); + hw_mode = iwl4965_get_hw_mode(priv, MODE_IEEE80211B); if (hw_mode) { channels = hw_mode->channels; count = hw_mode->num_channels; @@ -8711,7 +8710,7 @@ static ssize_t show_channels(struct device *d, flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? "active/passive" : "passive only"); - hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211A); + hw_mode = iwl4965_get_hw_mode(priv, MODE_IEEE80211A); if (hw_mode) { channels = hw_mode->channels; count = hw_mode->num_channels; @@ -8747,17 +8746,17 @@ static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); static ssize_t show_statistics(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); - u32 size = sizeof(struct iwl_notif_statistics); + struct iwl4965_priv *priv = dev_get_drvdata(d); + u32 size = sizeof(struct iwl4965_notif_statistics); u32 len = 0, ofs = 0; u8 *data = (u8 *) & priv->statistics; int rc = 0; - if (!iwl_is_alive(priv)) + if (!iwl4965_is_alive(priv)) return -EAGAIN; mutex_lock(&priv->mutex); - rc = iwl_send_statistics_request(priv); + rc = iwl4965_send_statistics_request(priv); mutex_unlock(&priv->mutex); if (rc) { @@ -8785,9 +8784,9 @@ static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL); static ssize_t show_antenna(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl4965_priv *priv = dev_get_drvdata(d); - if (!iwl_is_alive(priv)) + if (!iwl4965_is_alive(priv)) return -EAGAIN; return sprintf(buf, "%d\n", priv->antenna); @@ -8798,7 +8797,7 @@ static ssize_t store_antenna(struct device *d, const char *buf, size_t count) { int ant; - struct iwl_priv *priv = dev_get_drvdata(d); + struct iwl4965_priv *priv = dev_get_drvdata(d); if (count == 0) return 0; @@ -8810,7 +8809,7 @@ static ssize_t store_antenna(struct device *d, if ((ant >= 0) && (ant <= 2)) { IWL_DEBUG_INFO("Setting antenna select to %d.\n", ant); - priv->antenna = (enum iwl_antenna)ant; + priv->antenna = (enum iwl4965_antenna)ant; } else IWL_DEBUG_INFO("Bad antenna select value %d.\n", ant); @@ -8823,8 +8822,8 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, show_antenna, store_antenna); static ssize_t show_status(struct device *d, struct device_attribute *attr, char *buf) { - struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; - if (!iwl_is_alive(priv)) + struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; + if (!iwl4965_is_alive(priv)) return -EAGAIN; return sprintf(buf, "0x%08x\n", (int)priv->status); } @@ -8838,7 +8837,7 @@ static ssize_t dump_error_log(struct device *d, char *p = (char *)buf; if (p[0] == '1') - iwl_dump_nic_error_log((struct iwl_priv *)d->driver_data); + iwl4965_dump_nic_error_log((struct iwl4965_priv *)d->driver_data); return strnlen(buf, count); } @@ -8852,7 +8851,7 @@ static ssize_t dump_event_log(struct device *d, char *p = (char *)buf; if (p[0] == '1') - iwl_dump_nic_event_log((struct iwl_priv *)d->driver_data); + iwl4965_dump_nic_event_log((struct iwl4965_priv *)d->driver_data); return strnlen(buf, count); } @@ -8865,34 +8864,34 @@ static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); * *****************************************************************************/ -static void iwl_setup_deferred_work(struct iwl_priv *priv) +static void iwl4965_setup_deferred_work(struct iwl4965_priv *priv) { priv->workqueue = create_workqueue(DRV_NAME); init_waitqueue_head(&priv->wait_command_queue); - INIT_WORK(&priv->up, iwl_bg_up); - INIT_WORK(&priv->restart, iwl_bg_restart); - INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish); - INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); - INIT_WORK(&priv->request_scan, iwl_bg_request_scan); - INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); - INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill); - INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); - INIT_DELAYED_WORK(&priv->post_associate, iwl_bg_post_associate); - INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); - INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); - INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); - - iwl_hw_setup_deferred_work(priv); + INIT_WORK(&priv->up, iwl4965_bg_up); + INIT_WORK(&priv->restart, iwl4965_bg_restart); + INIT_WORK(&priv->rx_replenish, iwl4965_bg_rx_replenish); + INIT_WORK(&priv->scan_completed, iwl4965_bg_scan_completed); + INIT_WORK(&priv->request_scan, iwl4965_bg_request_scan); + INIT_WORK(&priv->abort_scan, iwl4965_bg_abort_scan); + INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill); + INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update); + INIT_DELAYED_WORK(&priv->post_associate, iwl4965_bg_post_associate); + INIT_DELAYED_WORK(&priv->init_alive_start, iwl4965_bg_init_alive_start); + INIT_DELAYED_WORK(&priv->alive_start, iwl4965_bg_alive_start); + INIT_DELAYED_WORK(&priv->scan_check, iwl4965_bg_scan_check); + + iwl4965_hw_setup_deferred_work(priv); tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) - iwl_irq_tasklet, (unsigned long)priv); + iwl4965_irq_tasklet, (unsigned long)priv); } -static void iwl_cancel_deferred_work(struct iwl_priv *priv) +static void iwl4965_cancel_deferred_work(struct iwl4965_priv *priv) { - iwl_hw_cancel_deferred_work(priv); + iwl4965_hw_cancel_deferred_work(priv); cancel_delayed_work_sync(&priv->init_alive_start); cancel_delayed_work(&priv->scan_check); @@ -8901,7 +8900,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv) cancel_work_sync(&priv->beacon_update); } -static struct attribute *iwl_sysfs_entries[] = { +static struct attribute *iwl4965_sysfs_entries[] = { &dev_attr_antenna.attr, &dev_attr_channels.attr, &dev_attr_dump_errors.attr, @@ -8924,55 +8923,55 @@ static struct attribute *iwl_sysfs_entries[] = { NULL }; -static struct attribute_group iwl_attribute_group = { +static struct attribute_group iwl4965_attribute_group = { .name = NULL, /* put in device directory */ - .attrs = iwl_sysfs_entries, + .attrs = iwl4965_sysfs_entries, }; -static struct ieee80211_ops iwl_hw_ops = { - .tx = iwl_mac_tx, - .start = iwl_mac_start, - .stop = iwl_mac_stop, - .add_interface = iwl_mac_add_interface, - .remove_interface = iwl_mac_remove_interface, - .config = iwl_mac_config, - .config_interface = iwl_mac_config_interface, - .configure_filter = iwl_configure_filter, - .set_key = iwl_mac_set_key, - .get_stats = iwl_mac_get_stats, - .get_tx_stats = iwl_mac_get_tx_stats, - .conf_tx = iwl_mac_conf_tx, - .get_tsf = iwl_mac_get_tsf, - .reset_tsf = iwl_mac_reset_tsf, - .beacon_update = iwl_mac_beacon_update, - .erp_ie_changed = iwl_mac_erp_ie_changed, +static struct ieee80211_ops iwl4965_hw_ops = { + .tx = iwl4965_mac_tx, + .start = iwl4965_mac_start, + .stop = iwl4965_mac_stop, + .add_interface = iwl4965_mac_add_interface, + .remove_interface = iwl4965_mac_remove_interface, + .config = iwl4965_mac_config, + .config_interface = iwl4965_mac_config_interface, + .configure_filter = iwl4965_configure_filter, + .set_key = iwl4965_mac_set_key, + .get_stats = iwl4965_mac_get_stats, + .get_tx_stats = iwl4965_mac_get_tx_stats, + .conf_tx = iwl4965_mac_conf_tx, + .get_tsf = iwl4965_mac_get_tsf, + .reset_tsf = iwl4965_mac_reset_tsf, + .beacon_update = iwl4965_mac_beacon_update, + .erp_ie_changed = iwl4965_mac_erp_ie_changed, #ifdef CONFIG_IWL4965_HT - .conf_ht = iwl_mac_conf_ht, - .get_ht_capab = iwl_mac_get_ht_capab, + .conf_ht = iwl4965_mac_conf_ht, + .get_ht_capab = iwl4965_mac_get_ht_capab, #ifdef CONFIG_IWL4965_HT_AGG - .ht_tx_agg_start = iwl_mac_ht_tx_agg_start, - .ht_tx_agg_stop = iwl_mac_ht_tx_agg_stop, - .ht_rx_agg_start = iwl_mac_ht_rx_agg_start, - .ht_rx_agg_stop = iwl_mac_ht_rx_agg_stop, + .ht_tx_agg_start = iwl4965_mac_ht_tx_agg_start, + .ht_tx_agg_stop = iwl4965_mac_ht_tx_agg_stop, + .ht_rx_agg_start = iwl4965_mac_ht_rx_agg_start, + .ht_rx_agg_stop = iwl4965_mac_ht_rx_agg_stop, #endif /* CONFIG_IWL4965_HT_AGG */ #endif /* CONFIG_IWL4965_HT */ - .hw_scan = iwl_mac_hw_scan + .hw_scan = iwl4965_mac_hw_scan }; -static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int err = 0; - struct iwl_priv *priv; + struct iwl4965_priv *priv; struct ieee80211_hw *hw; int i; - if (iwl_param_disable_hw_scan) { + if (iwl4965_param_disable_hw_scan) { IWL_DEBUG_INFO("Disabling hw_scan\n"); - iwl_hw_ops.hw_scan = NULL; + iwl4965_hw_ops.hw_scan = NULL; } - if ((iwl_param_queues_num > IWL_MAX_NUM_QUEUES) || - (iwl_param_queues_num < IWL_MIN_NUM_QUEUES)) { + if ((iwl4965_param_queues_num > IWL_MAX_NUM_QUEUES) || + (iwl4965_param_queues_num < IWL_MIN_NUM_QUEUES)) { IWL_ERROR("invalid queues_num, should be between %d and %d\n", IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES); err = -EINVAL; @@ -8981,7 +8980,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* mac80211 allocates memory for this device instance, including * space for this driver's private structure */ - hw = ieee80211_alloc_hw(sizeof(struct iwl_priv), &iwl_hw_ops); + hw = ieee80211_alloc_hw(sizeof(struct iwl4965_priv), &iwl4965_hw_ops); if (hw == NULL) { IWL_ERROR("Can not allocate network device\n"); err = -ENOMEM; @@ -8996,9 +8995,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->hw = hw; priv->pci_dev = pdev; - priv->antenna = (enum iwl_antenna)iwl_param_antenna; + priv->antenna = (enum iwl4965_antenna)iwl4965_param_antenna; #ifdef CONFIG_IWL4965_DEBUG - iwl_debug_level = iwl_param_debug; + iwl4965_debug_level = iwl4965_param_debug; atomic_set(&priv->restrict_refcnt, 0); #endif priv->retry_rate = 1; @@ -9043,7 +9042,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_master(pdev); - iwl_clear_stations_table(priv); + iwl4965_clear_stations_table(priv); priv->data_retry_limit = -1; priv->ieee_channels = NULL; @@ -9077,7 +9076,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* Initialize module parameter values here */ - if (iwl_param_disable) { + if (iwl4965_param_disable) { set_bit(STATUS_RF_KILL_SW, &priv->status); IWL_DEBUG_INFO("Radio disabled.\n"); } @@ -9097,36 +9096,36 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ": Detected Intel Wireless WiFi Link 4965AGN\n"); /* Device-specific setup */ - if (iwl_hw_set_hw_setting(priv)) { + if (iwl4965_hw_set_hw_setting(priv)) { IWL_ERROR("failed to set hw settings\n"); mutex_unlock(&priv->mutex); goto out_iounmap; } #ifdef CONFIG_IWL4965_QOS - if (iwl_param_qos_enable) + if (iwl4965_param_qos_enable) priv->qos_data.qos_enable = 1; - iwl_reset_qos(priv); + iwl4965_reset_qos(priv); priv->qos_data.qos_active = 0; priv->qos_data.qos_cap.val = 0; #endif /* CONFIG_IWL4965_QOS */ - iwl_set_rxon_channel(priv, MODE_IEEE80211G, 6); - iwl_setup_deferred_work(priv); - iwl_setup_rx_handlers(priv); + iwl4965_set_rxon_channel(priv, MODE_IEEE80211G, 6); + iwl4965_setup_deferred_work(priv); + iwl4965_setup_rx_handlers(priv); priv->rates_mask = IWL_RATES_MASK; /* If power management is turned on, default to AC mode */ priv->power_mode = IWL_POWER_AC; priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; - iwl_disable_interrupts(priv); + iwl4965_disable_interrupts(priv); pci_enable_msi(pdev); - err = request_irq(pdev->irq, iwl_isr, IRQF_SHARED, DRV_NAME, priv); + err = request_irq(pdev->irq, iwl4965_isr, IRQF_SHARED, DRV_NAME, priv); if (err) { IWL_ERROR("Error allocating IRQ %d\n", pdev->irq); goto out_disable_msi; @@ -9134,7 +9133,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mutex_lock(&priv->mutex); - err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group); + err = sysfs_create_group(&pdev->dev.kobj, &iwl4965_attribute_group); if (err) { IWL_ERROR("failed to create sysfs device attributes\n"); mutex_unlock(&priv->mutex); @@ -9143,7 +9142,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* fetch ucode file from disk, alloc and copy to bus-master buffers ... * ucode filename and max sizes are card-specific. */ - err = iwl_read_ucode(priv); + err = iwl4965_read_ucode(priv); if (err) { IWL_ERROR("Could not read microcode: %d\n", err); mutex_unlock(&priv->mutex); @@ -9159,9 +9158,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return 0; out_pci_alloc: - iwl_dealloc_ucode_pci(priv); + iwl4965_dealloc_ucode_pci(priv); - sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); + sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); out_release_irq: free_irq(pdev->irq, priv); @@ -9170,7 +9169,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_disable_msi(pdev); destroy_workqueue(priv->workqueue); priv->workqueue = NULL; - iwl_unset_hw_setting(priv); + iwl4965_unset_hw_setting(priv); out_iounmap: pci_iounmap(pdev, priv->hw_base); @@ -9185,9 +9184,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return err; } -static void iwl_pci_remove(struct pci_dev *pdev) +static void iwl4965_pci_remove(struct pci_dev *pdev) { - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct iwl4965_priv *priv = pci_get_drvdata(pdev); struct list_head *p, *q; int i; @@ -9198,36 +9197,36 @@ static void iwl_pci_remove(struct pci_dev *pdev) set_bit(STATUS_EXIT_PENDING, &priv->status); - iwl_down(priv); + iwl4965_down(priv); /* Free MAC hash list for ADHOC */ for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { list_del(p); - kfree(list_entry(p, struct iwl_ibss_seq, list)); + kfree(list_entry(p, struct iwl4965_ibss_seq, list)); } } - sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); + sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); - iwl_dealloc_ucode_pci(priv); + iwl4965_dealloc_ucode_pci(priv); if (priv->rxq.bd) - iwl_rx_queue_free(priv, &priv->rxq); - iwl_hw_txq_ctx_free(priv); + iwl4965_rx_queue_free(priv, &priv->rxq); + iwl4965_hw_txq_ctx_free(priv); - iwl_unset_hw_setting(priv); - iwl_clear_stations_table(priv); + iwl4965_unset_hw_setting(priv); + iwl4965_clear_stations_table(priv); if (priv->mac80211_registered) { ieee80211_unregister_hw(priv->hw); - iwl_rate_control_unregister(priv->hw); + iwl4965_rate_control_unregister(priv->hw); } /*netif_stop_queue(dev); */ flush_workqueue(priv->workqueue); - /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes + /* ieee80211_unregister_hw calls iwl4965_mac_stop, which flushes * priv->workqueue... so we can't take down the workqueue * until now... */ destroy_workqueue(priv->workqueue); @@ -9253,14 +9252,14 @@ static void iwl_pci_remove(struct pci_dev *pdev) #ifdef CONFIG_PM -static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) +static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state) { - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct iwl4965_priv *priv = pci_get_drvdata(pdev); set_bit(STATUS_IN_SUSPEND, &priv->status); /* Take down the device; powers it off, etc. */ - iwl_down(priv); + iwl4965_down(priv); if (priv->mac80211_registered) ieee80211_stop_queues(priv->hw); @@ -9272,7 +9271,7 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) return 0; } -static void iwl_resume(struct iwl_priv *priv) +static void iwl4965_resume(struct iwl4965_priv *priv) { unsigned long flags; @@ -9281,47 +9280,47 @@ static void iwl_resume(struct iwl_priv *priv) * Without all of the following, resume will not attempt to take * down the NIC (it shouldn't really need to) and will just try * and bring the NIC back up. However that fails during the - * ucode verification process. This then causes iwl_down to be - * called *after* iwl_hw_nic_init() has succeeded -- which + * ucode verification process. This then causes iwl4965_down to be + * called *after* iwl4965_hw_nic_init() has succeeded -- which * then lets the next init sequence succeed. So, we've * replicated all of that NIC init code here... */ - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); + iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl_hw_nic_init(priv); + iwl4965_hw_nic_init(priv); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - iwl_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF); + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); /* tell the device to stop sending interrupts */ - iwl_disable_interrupts(priv); + iwl4965_disable_interrupts(priv); spin_lock_irqsave(&priv->lock, flags); - iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); + iwl4965_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - if (!iwl_grab_nic_access(priv)) { - iwl_write_prph(priv, APMG_CLK_DIS_REG, + if (!iwl4965_grab_nic_access(priv)) { + iwl4965_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); - iwl_release_nic_access(priv); + iwl4965_release_nic_access(priv); } spin_unlock_irqrestore(&priv->lock, flags); udelay(5); - iwl_hw_nic_reset(priv); + iwl4965_hw_nic_reset(priv); /* Bring the device back up */ clear_bit(STATUS_IN_SUSPEND, &priv->status); queue_work(priv->workqueue, &priv->up); } -static int iwl_pci_resume(struct pci_dev *pdev) +static int iwl4965_pci_resume(struct pci_dev *pdev) { - struct iwl_priv *priv = pci_get_drvdata(pdev); + struct iwl4965_priv *priv = pci_get_drvdata(pdev); int err; printk(KERN_INFO "Coming out of suspend...\n"); @@ -9338,7 +9337,7 @@ static int iwl_pci_resume(struct pci_dev *pdev) */ pci_write_config_byte(pdev, 0x41, 0x00); - iwl_resume(priv); + iwl4965_resume(priv); return 0; } @@ -9351,33 +9350,33 @@ static int iwl_pci_resume(struct pci_dev *pdev) * *****************************************************************************/ -static struct pci_driver iwl_driver = { +static struct pci_driver iwl4965_driver = { .name = DRV_NAME, - .id_table = iwl_hw_card_ids, - .probe = iwl_pci_probe, - .remove = __devexit_p(iwl_pci_remove), + .id_table = iwl4965_hw_card_ids, + .probe = iwl4965_pci_probe, + .remove = __devexit_p(iwl4965_pci_remove), #ifdef CONFIG_PM - .suspend = iwl_pci_suspend, - .resume = iwl_pci_resume, + .suspend = iwl4965_pci_suspend, + .resume = iwl4965_pci_resume, #endif }; -static int __init iwl_init(void) +static int __init iwl4965_init(void) { int ret; printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); - ret = pci_register_driver(&iwl_driver); + ret = pci_register_driver(&iwl4965_driver); if (ret) { IWL_ERROR("Unable to initialize PCI module\n"); return ret; } #ifdef CONFIG_IWL4965_DEBUG - ret = driver_create_file(&iwl_driver.driver, &driver_attr_debug_level); + ret = driver_create_file(&iwl4965_driver.driver, &driver_attr_debug_level); if (ret) { IWL_ERROR("Unable to create driver sysfs file\n"); - pci_unregister_driver(&iwl_driver); + pci_unregister_driver(&iwl4965_driver); return ret; } #endif @@ -9385,32 +9384,32 @@ static int __init iwl_init(void) return ret; } -static void __exit iwl_exit(void) +static void __exit iwl4965_exit(void) { #ifdef CONFIG_IWL4965_DEBUG - driver_remove_file(&iwl_driver.driver, &driver_attr_debug_level); + driver_remove_file(&iwl4965_driver.driver, &driver_attr_debug_level); #endif - pci_unregister_driver(&iwl_driver); + pci_unregister_driver(&iwl4965_driver); } -module_param_named(antenna, iwl_param_antenna, int, 0444); +module_param_named(antenna, iwl4965_param_antenna, int, 0444); MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); -module_param_named(disable, iwl_param_disable, int, 0444); +module_param_named(disable, iwl4965_param_disable, int, 0444); MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); -module_param_named(hwcrypto, iwl_param_hwcrypto, int, 0444); +module_param_named(hwcrypto, iwl4965_param_hwcrypto, int, 0444); MODULE_PARM_DESC(hwcrypto, "using hardware crypto engine (default 0 [software])\n"); -module_param_named(debug, iwl_param_debug, int, 0444); +module_param_named(debug, iwl4965_param_debug, int, 0444); MODULE_PARM_DESC(debug, "debug output mask"); -module_param_named(disable_hw_scan, iwl_param_disable_hw_scan, int, 0444); +module_param_named(disable_hw_scan, iwl4965_param_disable_hw_scan, int, 0444); MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); -module_param_named(queues_num, iwl_param_queues_num, int, 0444); +module_param_named(queues_num, iwl4965_param_queues_num, int, 0444); MODULE_PARM_DESC(queues_num, "number of hw queues."); /* QoS */ -module_param_named(qos_enable, iwl_param_qos_enable, int, 0444); +module_param_named(qos_enable, iwl4965_param_qos_enable, int, 0444); MODULE_PARM_DESC(qos_enable, "enable all QoS functionality"); -module_exit(iwl_exit); -module_init(iwl_init); +module_exit(iwl4965_exit); +module_init(iwl4965_init); -- cgit v1.2.3-70-g09d2 From 4900d6daadea8b32b8a6312e793977e18343cfe5 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Tue, 6 Nov 2007 22:06:27 -0800 Subject: remove unused iwl4965_init_hw_rates function The patch removes the unused function to fix a recursive bug caused by namespace change. Signed-off-by: Zhu Yi Signed-off-by: Reinette Chatre Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965.c | 8 -------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 -- 2 files changed, 10 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index f7c5ac3072c..9b8560d3315 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -4269,14 +4269,6 @@ static int iwl4965_tx_queue_agg_disable(struct iwl4965_priv *priv, u16 txq_id, #endif/* CONFIG_IWL4965_HT_AGG */ #endif /* CONFIG_IWL4965_HT */ -/* - * RATE SCALE CODE - */ -int iwl4965_init_hw_rates(struct iwl4965_priv *priv, struct ieee80211_rate *rates) -{ - return 0; -} - /** * iwl4965_add_station - Initialize a station's hardware rate table diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 41cabd61849..7d0b7c994d9 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -5633,8 +5633,6 @@ static void iwl4965_init_hw_rates(struct iwl4965_priv *priv, if (IWL_BASIC_RATES_MASK & (1 << i)) rates[i].flags |= IEEE80211_RATE_BASIC; } - - iwl4965_init_hw_rates(priv, rates); } /** -- cgit v1.2.3-70-g09d2 From 797a54c68e0eb551c60e3dc843627f967919a951 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Mon, 12 Nov 2007 11:37:43 +0800 Subject: iwl4965: fix rxon flags set to wrong value for A mode in .erp_ie_changed The patch fixes a bug that enables RXON_FLG_TGG_PROTECT_MSK erroneously for A mode in the erp_ie_changed mac80211 callback. Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 7d0b7c994d9..24dc40f2f4c 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -7674,7 +7674,7 @@ static void iwl4965_mac_erp_ie_changed(struct ieee80211_hw *hw, } if (changes & IEEE80211_ERP_CHANGE_PROTECTION) { - if (cts_protection) + if (cts_protection && (priv->phymode != MODE_IEEE80211A)) priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; else priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; -- cgit v1.2.3-70-g09d2 From 9a62f73b1a3bbd35a6f84fcd6636e672b09981ec Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Thu, 15 Nov 2007 16:27:36 -0500 Subject: iwlwifi: remove redundant initialization of final_mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem identified by Miguel Botón , alternate solution suggested by Zhu Yi , patch by me. :-) Cc: Miguel Botón Cc: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index e14e1333535..76186f85c13 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -2139,7 +2139,7 @@ static int iwl3945_update_power_cmd(struct iwl3945_priv *priv, static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode) { - u32 final_mode = mode; + u32 uninitialized_var(final_mode); int rc; struct iwl3945_powertable_cmd cmd; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 24dc40f2f4c..02433930f7e 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -2218,7 +2218,7 @@ static int iwl4965_update_power_cmd(struct iwl4965_priv *priv, static int iwl4965_send_power_mode(struct iwl4965_priv *priv, u32 mode) { - u32 final_mode = mode; + u32 uninitialized_var(final_mode); int rc; struct iwl4965_powertable_cmd cmd; -- cgit v1.2.3-70-g09d2 From 90e759d14cd58ea1e34042bab930ce434fa0e4fa Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 29 Nov 2007 11:09:41 +0800 Subject: iwlwifi: Support for uCode without init and bsm section This patch enables loading fw w/o init and bsm section. It also provides general cleanup of the rutine. Signed-off-by: Tomas Winkler Signed-off-by: Gregory Greenman Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 120 +++++++++++++-------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 122 +++++++++++++--------------- 2 files changed, 112 insertions(+), 130 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 76186f85c13..4fa85d874ef 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -5767,6 +5767,12 @@ static void iwl3945_nic_start(struct iwl3945_priv *priv) iwl3945_write32(priv, CSR_RESET, 0); } +static int iwl3945_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) +{ + desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr); + return (desc->v_addr != NULL) ? 0 : -ENOMEM; +} + /** * iwl3945_read_ucode - Read uCode images from disk file. * @@ -5775,7 +5781,7 @@ static void iwl3945_nic_start(struct iwl3945_priv *priv) static int iwl3945_read_ucode(struct iwl3945_priv *priv) { struct iwl3945_ucode *ucode; - int rc = 0; + int ret = 0; const struct firmware *ucode_raw; /* firmware file name contains uCode/driver compatibility version */ const char *name = "iwlwifi-3945" IWL3945_UCODE_API ".ucode"; @@ -5785,9 +5791,10 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) /* Ask kernel firmware_class module to get the boot firmware off disk. * request_firmware() is synchronous, file is in memory on return. */ - rc = request_firmware(&ucode_raw, name, &priv->pci_dev->dev); - if (rc < 0) { - IWL_ERROR("%s firmware file req failed: Reason %d\n", name, rc); + ret = request_firmware(&ucode_raw, name, &priv->pci_dev->dev); + if (ret < 0) { + IWL_ERROR("%s firmware file req failed: Reason %d\n", + name, ret); goto error; } @@ -5797,7 +5804,7 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) /* Make sure that we got at least our header! */ if (ucode_raw->size < sizeof(*ucode)) { IWL_ERROR("File size way too small!\n"); - rc = -EINVAL; + ret = -EINVAL; goto err_release; } @@ -5825,43 +5832,40 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) IWL_DEBUG_INFO("uCode file size %d too small\n", (int)ucode_raw->size); - rc = -EINVAL; + ret = -EINVAL; goto err_release; } /* Verify that uCode images will fit in card's SRAM */ if (inst_size > IWL_MAX_INST_SIZE) { - IWL_DEBUG_INFO("uCode instr len %d too large to fit in card\n", - (int)inst_size); - rc = -EINVAL; + IWL_DEBUG_INFO("uCode instr len %d too large to fit in\n", + inst_size); + ret = -EINVAL; goto err_release; } if (data_size > IWL_MAX_DATA_SIZE) { - IWL_DEBUG_INFO("uCode data len %d too large to fit in card\n", - (int)data_size); - rc = -EINVAL; + IWL_DEBUG_INFO("uCode data len %d too large to fit in\n", + data_size); + ret = -EINVAL; goto err_release; } if (init_size > IWL_MAX_INST_SIZE) { - IWL_DEBUG_INFO - ("uCode init instr len %d too large to fit in card\n", - (int)init_size); - rc = -EINVAL; + IWL_DEBUG_INFO("uCode init instr len %d too large to fit in\n", + init_size); + ret = -EINVAL; goto err_release; } if (init_data_size > IWL_MAX_DATA_SIZE) { - IWL_DEBUG_INFO - ("uCode init data len %d too large to fit in card\n", - (int)init_data_size); - rc = -EINVAL; + IWL_DEBUG_INFO("uCode init data len %d too large to fit in\n", + init_data_size); + ret = -EINVAL; goto err_release; } if (boot_size > IWL_MAX_BSM_SIZE) { - IWL_DEBUG_INFO - ("uCode boot instr len %d too large to fit in bsm\n", - (int)boot_size); - rc = -EINVAL; + IWL_DEBUG_INFO("uCode boot instr len %d too large to fit in\n", + boot_size); + ret = -EINVAL; goto err_release; } @@ -5871,56 +5875,45 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) * 1) unmodified from disk * 2) backup cache for save/restore during power-downs */ priv->ucode_code.len = inst_size; - priv->ucode_code.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_code.len, - &(priv->ucode_code.p_addr)); + iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); priv->ucode_data.len = data_size; - priv->ucode_data.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_data.len, - &(priv->ucode_data.p_addr)); + iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); priv->ucode_data_backup.len = data_size; - priv->ucode_data_backup.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_data_backup.len, - &(priv->ucode_data_backup.p_addr)); + iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || + !priv->ucode_data_backup.v_addr) + goto err_pci_alloc; /* Initialization instructions and data */ - priv->ucode_init.len = init_size; - priv->ucode_init.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_init.len, - &(priv->ucode_init.p_addr)); - - priv->ucode_init_data.len = init_data_size; - priv->ucode_init_data.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_init_data.len, - &(priv->ucode_init_data.p_addr)); + if (init_size && init_data_size) { + priv->ucode_init.len = init_size; + iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); + + priv->ucode_init_data.len = init_data_size; + iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); + + if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) + goto err_pci_alloc; + } /* Bootstrap (instructions only, no data) */ - priv->ucode_boot.len = boot_size; - priv->ucode_boot.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_boot.len, - &(priv->ucode_boot.p_addr)); + if (boot_size) { + priv->ucode_boot.len = boot_size; + iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); - if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || - !priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr || - !priv->ucode_boot.v_addr || !priv->ucode_data_backup.v_addr) - goto err_pci_alloc; + if (!priv->ucode_boot.v_addr) + goto err_pci_alloc; + } /* Copy images into buffers for card's bus-master reads ... */ /* Runtime instructions (first block of data in file) */ src = &ucode->data[0]; len = priv->ucode_code.len; - IWL_DEBUG_INFO("Copying (but not loading) uCode instr len %d\n", - (int)len); + IWL_DEBUG_INFO("Copying (but not loading) uCode instr len %Zd\n", len); memcpy(priv->ucode_code.v_addr, src, len); IWL_DEBUG_INFO("uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); @@ -5929,8 +5922,7 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) * NOTE: Copy into backup buffer will be done in iwl3945_up() */ src = &ucode->data[inst_size]; len = priv->ucode_data.len; - IWL_DEBUG_INFO("Copying (but not loading) uCode data len %d\n", - (int)len); + IWL_DEBUG_INFO("Copying (but not loading) uCode data len %Zd\n", len); memcpy(priv->ucode_data.v_addr, src, len); memcpy(priv->ucode_data_backup.v_addr, src, len); @@ -5938,8 +5930,8 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) if (init_size) { src = &ucode->data[inst_size + data_size]; len = priv->ucode_init.len; - IWL_DEBUG_INFO("Copying (but not loading) init instr len %d\n", - (int)len); + IWL_DEBUG_INFO("Copying (but not loading) init instr len %Zd\n", + len); memcpy(priv->ucode_init.v_addr, src, len); } @@ -5965,14 +5957,14 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) err_pci_alloc: IWL_ERROR("failed to allocate pci memory\n"); - rc = -ENOMEM; + ret = -ENOMEM; iwl3945_dealloc_ucode_pci(priv); err_release: release_firmware(ucode_raw); error: - return rc; + return ret; } diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 02433930f7e..921c662da38 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -6146,6 +6146,12 @@ static void iwl4965_nic_start(struct iwl4965_priv *priv) iwl4965_write32(priv, CSR_RESET, 0); } +static int iwl4965_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) +{ + desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr); + return (desc->v_addr != NULL) ? 0 : -ENOMEM; +} + /** * iwl4965_read_ucode - Read uCode images from disk file. * @@ -6154,7 +6160,7 @@ static void iwl4965_nic_start(struct iwl4965_priv *priv) static int iwl4965_read_ucode(struct iwl4965_priv *priv) { struct iwl4965_ucode *ucode; - int rc = 0; + int ret; const struct firmware *ucode_raw; const char *name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode"; u8 *src; @@ -6163,9 +6169,10 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) /* Ask kernel firmware_class module to get the boot firmware off disk. * request_firmware() is synchronous, file is in memory on return. */ - rc = request_firmware(&ucode_raw, name, &priv->pci_dev->dev); - if (rc < 0) { - IWL_ERROR("%s firmware file req failed: Reason %d\n", name, rc); + ret = request_firmware(&ucode_raw, name, &priv->pci_dev->dev); + if (ret < 0) { + IWL_ERROR("%s firmware file req failed: Reason %d\n", + name, ret); goto error; } @@ -6175,7 +6182,7 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) /* Make sure that we got at least our header! */ if (ucode_raw->size < sizeof(*ucode)) { IWL_ERROR("File size way too small!\n"); - rc = -EINVAL; + ret = -EINVAL; goto err_release; } @@ -6208,43 +6215,43 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) IWL_DEBUG_INFO("uCode file size %d too small\n", (int)ucode_raw->size); - rc = -EINVAL; + ret = -EINVAL; goto err_release; } /* Verify that uCode images will fit in card's SRAM */ if (inst_size > IWL_MAX_INST_SIZE) { - IWL_DEBUG_INFO("uCode instr len %d too large to fit in card\n", - (int)inst_size); - rc = -EINVAL; + IWL_DEBUG_INFO("uCode instr len %d too large to fit in\n", + inst_size); + ret = -EINVAL; goto err_release; } if (data_size > IWL_MAX_DATA_SIZE) { - IWL_DEBUG_INFO("uCode data len %d too large to fit in card\n", - (int)data_size); - rc = -EINVAL; + IWL_DEBUG_INFO("uCode data len %d too large to fit in\n", + data_size); + ret = -EINVAL; goto err_release; } if (init_size > IWL_MAX_INST_SIZE) { IWL_DEBUG_INFO - ("uCode init instr len %d too large to fit in card\n", - (int)init_size); - rc = -EINVAL; + ("uCode init instr len %d too large to fit in\n", + init_size); + ret = -EINVAL; goto err_release; } if (init_data_size > IWL_MAX_DATA_SIZE) { IWL_DEBUG_INFO - ("uCode init data len %d too large to fit in card\n", - (int)init_data_size); - rc = -EINVAL; + ("uCode init data len %d too large to fit in\n", + init_data_size); + ret = -EINVAL; goto err_release; } if (boot_size > IWL_MAX_BSM_SIZE) { IWL_DEBUG_INFO - ("uCode boot instr len %d too large to fit in bsm\n", - (int)boot_size); - rc = -EINVAL; + ("uCode boot instr len %d too large to fit in\n", + boot_size); + ret = -EINVAL; goto err_release; } @@ -6254,56 +6261,41 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) * 1) unmodified from disk * 2) backup cache for save/restore during power-downs */ priv->ucode_code.len = inst_size; - priv->ucode_code.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_code.len, - &(priv->ucode_code.p_addr)); + iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); priv->ucode_data.len = data_size; - priv->ucode_data.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_data.len, - &(priv->ucode_data.p_addr)); + iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); priv->ucode_data_backup.len = data_size; - priv->ucode_data_backup.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_data_backup.len, - &(priv->ucode_data_backup.p_addr)); - + iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); /* Initialization instructions and data */ - priv->ucode_init.len = init_size; - priv->ucode_init.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_init.len, - &(priv->ucode_init.p_addr)); - - priv->ucode_init_data.len = init_data_size; - priv->ucode_init_data.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_init_data.len, - &(priv->ucode_init_data.p_addr)); + if (init_size && init_data_size) { + priv->ucode_init.len = init_size; + iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); + + priv->ucode_init_data.len = init_data_size; + iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); + + if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) + goto err_pci_alloc; + } /* Bootstrap (instructions only, no data) */ - priv->ucode_boot.len = boot_size; - priv->ucode_boot.v_addr = - pci_alloc_consistent(priv->pci_dev, - priv->ucode_boot.len, - &(priv->ucode_boot.p_addr)); + if (boot_size) { + priv->ucode_boot.len = boot_size; + iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); - if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || - !priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr || - !priv->ucode_boot.v_addr || !priv->ucode_data_backup.v_addr) - goto err_pci_alloc; + if (!priv->ucode_boot.v_addr) + goto err_pci_alloc; + } /* Copy images into buffers for card's bus-master reads ... */ /* Runtime instructions (first block of data in file) */ src = &ucode->data[0]; len = priv->ucode_code.len; - IWL_DEBUG_INFO("Copying (but not loading) uCode instr len %d\n", - (int)len); + IWL_DEBUG_INFO("Copying (but not loading) uCode instr len %Zd\n", len); memcpy(priv->ucode_code.v_addr, src, len); IWL_DEBUG_INFO("uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); @@ -6312,8 +6304,7 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) * NOTE: Copy into backup buffer will be done in iwl4965_up() */ src = &ucode->data[inst_size]; len = priv->ucode_data.len; - IWL_DEBUG_INFO("Copying (but not loading) uCode data len %d\n", - (int)len); + IWL_DEBUG_INFO("Copying (but not loading) uCode data len %Zd\n", len); memcpy(priv->ucode_data.v_addr, src, len); memcpy(priv->ucode_data_backup.v_addr, src, len); @@ -6321,8 +6312,8 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) if (init_size) { src = &ucode->data[inst_size + data_size]; len = priv->ucode_init.len; - IWL_DEBUG_INFO("Copying (but not loading) init instr len %d\n", - (int)len); + IWL_DEBUG_INFO("Copying (but not loading) init instr len %Zd\n", + len); memcpy(priv->ucode_init.v_addr, src, len); } @@ -6330,16 +6321,15 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) if (init_data_size) { src = &ucode->data[inst_size + data_size + init_size]; len = priv->ucode_init_data.len; - IWL_DEBUG_INFO("Copying (but not loading) init data len %d\n", - (int)len); + IWL_DEBUG_INFO("Copying (but not loading) init data len %Zd\n", + len); memcpy(priv->ucode_init_data.v_addr, src, len); } /* Bootstrap instructions (5th block) */ src = &ucode->data[inst_size + data_size + init_size + init_data_size]; len = priv->ucode_boot.len; - IWL_DEBUG_INFO("Copying (but not loading) boot instr len %d\n", - (int)len); + IWL_DEBUG_INFO("Copying (but not loading) boot instr len %Zd\n", len); memcpy(priv->ucode_boot.v_addr, src, len); /* We have our copies now, allow OS release its copies */ @@ -6348,14 +6338,14 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) err_pci_alloc: IWL_ERROR("failed to allocate pci memory\n"); - rc = -ENOMEM; + ret = -ENOMEM; iwl4965_dealloc_ucode_pci(priv); err_release: release_firmware(ucode_raw); error: - return rc; + return ret; } -- cgit v1.2.3-70-g09d2 From 0054b34d295f0c77110c8c8ae5e3320ef40617b2 Mon Sep 17 00:00:00 2001 From: Reinette Chatre Date: Thu, 29 Nov 2007 11:09:42 +0800 Subject: iwlwifi: continue namespace changes - fix CONFIG variables - Remove HT code from iwl-3945.h - it is not needed here as 3945 does not support HT. The code ended up here during the header file split. - Modify a few places where the CONFIG variables were named incorrectly: all changes are to comments only. Signed-off-by: Reinette Chatre Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.h | 25 ------------------------- drivers/net/wireless/iwlwifi/iwl-4965.c | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +- 4 files changed, 3 insertions(+), 28 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index e5b345de3c6..02040ef10da 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -445,31 +445,6 @@ union iwl3945_ht_rate_supp { }; }; -#ifdef CONFIG_IWL3945_HT -#define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) -#define HT_IE_MAX_AMSDU_SIZE_4K (0) -#define CFG_HT_MPDU_DENSITY_2USEC (0x5) -#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC - -struct sta_ht_info { - u8 is_ht; - u16 rx_mimo_ps_mode; - u16 tx_mimo_ps_mode; - u16 control_channel; - u8 max_amsdu_size; - u8 ampdu_factor; - u8 mpdu_density; - u8 operating_mode; - u8 supported_chan_width; - u8 extension_chan_offset; - u8 is_green_field; - u8 sgf; - u8 supp_rates[16]; - u8 tx_chan_width; - u8 chan_width_cap; -}; -#endif /*CONFIG_IWL3945_HT */ - #ifdef CONFIG_IWL3945_QOS union iwl3945_qos_capabity { diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 9b8560d3315..5dee8e512c7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -4667,7 +4667,7 @@ void iwl4965_hw_setup_deferred_work(struct iwl4965_priv *priv) #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG INIT_WORK(&priv->agg_work, iwl4965_bg_agg_work); -#endif /* CONFIG_IWL4965_AGG */ +#endif /* CONFIG_IWL4965_HT_AGG */ #endif /* CONFIG_IWL4965_HT */ init_timer(&priv->statistics_periodic); priv->statistics_periodic.data = (unsigned long)priv; diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 4fa85d874ef..036e2f1a546 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -7362,7 +7362,7 @@ static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, int queue, #ifdef CONFIG_IWL3945_QOS unsigned long flags; int q; -#endif /* CONFIG_IWL_QOS */ +#endif /* CONFIG_IWL3945_QOS */ IWL_DEBUG_MAC80211("enter\n"); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 921c662da38..11ef1c0c5d0 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -7795,7 +7795,7 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, int queue, #ifdef CONFIG_IWL4965_QOS unsigned long flags; int q; -#endif /* CONFIG_IWL_QOS */ +#endif /* CONFIG_IWL4965_QOS */ IWL_DEBUG_MAC80211("enter\n"); -- cgit v1.2.3-70-g09d2 From 7762635547ad31ecb045e7073989e76ae13e6c54 Mon Sep 17 00:00:00 2001 From: Ben Cahill Date: Thu, 29 Nov 2007 11:09:44 +0800 Subject: iwl4965: add comments to rate scaling code Add comments to rate scaling code. Signed-off-by: Ben Cahill Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 467 ++++++++++++++++++++++++---- drivers/net/wireless/iwlwifi/iwl-4965-rs.h | 45 ++- drivers/net/wireless/iwlwifi/iwl-4965.h | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 3 + 4 files changed, 442 insertions(+), 75 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 8d3d9f72a8c..218c5a355dd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c @@ -47,13 +47,12 @@ #define IWL_NUMBER_TRY 1 #define IWL_HT_NUMBER_TRY 3 -#define IWL_RATE_MAX_WINDOW 62 -#define IWL_RATE_HIGH_TH 10880 -#define IWL_RATE_MIN_FAILURE_TH 6 -#define IWL_RATE_MIN_SUCCESS_TH 8 -#define IWL_RATE_DECREASE_TH 1920 -#define IWL_RATE_INCREASE_TH 8960 -#define IWL_RATE_SCALE_FLUSH_INTVL (2*HZ) /*2 seconds */ +#define IWL_RATE_MAX_WINDOW 62 /* # tx in history window */ +#define IWL_RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */ +#define IWL_RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */ + +/* max time to accum history 2 seconds */ +#define IWL_RATE_SCALE_FLUSH_INTVL (2*HZ) static u8 rs_ht_to_legacy[] = { IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, @@ -69,54 +68,74 @@ struct iwl4965_rate { u32 rate_n_flags; } __attribute__ ((packed)); +/** + * struct iwl4965_rate_scale_data -- tx success history for one rate + */ struct iwl4965_rate_scale_data { - u64 data; - s32 success_counter; - s32 success_ratio; - s32 counter; - s32 average_tpt; + u64 data; /* bitmap of successful frames */ + s32 success_counter; /* number of frames successful */ + s32 success_ratio; /* per-cent * 128 */ + s32 counter; /* number of frames attempted */ + s32 average_tpt; /* success ratio * expected throughput */ unsigned long stamp; }; +/** + * struct iwl4965_scale_tbl_info -- tx params and success history for all rates + * + * There are two of these in struct iwl_rate_scale_priv, + * one for "active", and one for "search". + */ struct iwl4965_scale_tbl_info { enum iwl4965_table_type lq_type; enum iwl4965_antenna_type antenna_type; - u8 is_SGI; - u8 is_fat; - u8 is_dup; - u8 action; - s32 *expected_tpt; - struct iwl4965_rate current_rate; - struct iwl4965_rate_scale_data win[IWL_RATE_COUNT]; + u8 is_SGI; /* 1 = short guard interval */ + u8 is_fat; /* 1 = 40 MHz channel width */ + u8 is_dup; /* 1 = duplicated data streams */ + u8 action; /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */ + s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ + struct iwl4965_rate current_rate; /* rate_n_flags, uCode API format */ + struct iwl4965_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ }; +/** + * struct iwl_rate_scale_priv -- driver's rate scaling private structure + * + * Pointer to this gets passed back and forth between driver and mac80211. + */ struct iwl4965_rate_scale_priv { - u8 active_tbl; - u8 enable_counter; - u8 stay_in_tbl; - u8 search_better_tbl; + u8 active_tbl; /* index of active table, range 0-1 */ + u8 enable_counter; /* indicates HT mode */ + u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ + u8 search_better_tbl; /* 1: currently trying alternate mode */ s32 last_tpt; + + /* The following determine when to search for a new mode */ u32 table_count_limit; - u32 max_failure_limit; - u32 max_success_limit; + u32 max_failure_limit; /* # failed frames before new search */ + u32 max_success_limit; /* # successful frames before new search */ u32 table_count; - u32 total_failed; - u32 total_success; - u32 flush_timer; - u8 action_counter; + u32 total_failed; /* total failed frames, any/all rates */ + u32 total_success; /* total successful frames, any/all rates */ + u32 flush_timer; /* time staying in mode before new search */ + + u8 action_counter; /* # mode-switch actions tried */ u8 antenna; u8 valid_antenna; u8 is_green; u8 is_dup; u8 phymode; u8 ibss_sta_added; + + /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ u32 supp_rates; u16 active_rate; u16 active_siso_rate; u16 active_mimo_rate; u16 active_rate_basic; + struct iwl4965_link_quality_cmd lq; - struct iwl4965_scale_tbl_info lq_info[LQ_SIZE]; + struct iwl4965_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ #ifdef CONFIG_MAC80211_DEBUGFS struct dentry *rs_sta_dbgfs_scale_table_file; struct dentry *rs_sta_dbgfs_stats_table_file; @@ -142,6 +161,12 @@ static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv, struct iwl4965_rate *mcs, int index) {} #endif + +/* + * Expected throughput metrics for following rates: + * 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 60 MBits + * "G" is the only table that supports CCK (the first 4 rates). + */ static s32 expected_tpt_A[IWL_RATE_COUNT] = { 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186, 186 }; @@ -244,6 +269,13 @@ static void rs_rate_scale_clear_window(struct iwl4965_rate_scale_data *window) window->stamp = 0; } +/** + * rs_collect_tx_data - Update the success/failure sliding window + * + * We keep a sliding window of the last 62 packets transmitted + * at this rate. window->data contains the bitmask of successful + * packets. + */ static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows, int scale_index, s32 tpt, u32 status) { @@ -255,10 +287,18 @@ static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows, if (scale_index < 0 || scale_index >= IWL_RATE_COUNT) return -EINVAL; + /* Select data for current tx bit rate */ window = &(windows[scale_index]); + /* + * Keep track of only the latest 62 tx frame attempts in this rate's + * history window; anything older isn't really relevant any more. + * If we have filled up the sliding window, drop the oldest attempt; + * if the oldest attempt (highest bit in bitmap) shows "success", + * subtract "1" from the success counter (this is the main reason + * we keep these bitmaps!). + */ if (window->counter >= win_size) { - window->counter = win_size - 1; mask = 1; mask = (mask << (win_size - 1)); @@ -268,7 +308,11 @@ static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows, } } + /* Increment frames-attempted counter */ window->counter = window->counter + 1; + + /* Shift bitmap by one frame (throw away oldest history), + * OR in "1", and increment "success" if this frame was successful. */ mask = window->data; window->data = (mask << 1); if (status != 0) { @@ -276,6 +320,7 @@ static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows, window->data |= 0x1; } + /* Calculate current success ratio, avoid divide-by-0! */ if (window->counter > 0) window->success_ratio = 128 * (100 * window->success_counter) / window->counter; @@ -284,17 +329,22 @@ static int rs_collect_tx_data(struct iwl4965_rate_scale_data *windows, fail_count = window->counter - window->success_counter; + /* Calculate average throughput, if we have enough history. */ if ((fail_count >= IWL_RATE_MIN_FAILURE_TH) || (window->success_counter >= IWL_RATE_MIN_SUCCESS_TH)) window->average_tpt = (window->success_ratio * tpt + 64) / 128; else window->average_tpt = IWL_INVALID_VALUE; + /* Tag this window as having been updated */ window->stamp = jiffies; return 0; } +/* + * Fill uCode API rate_n_flags field, based on "search" or "active" table. + */ static void rs_mcs_from_tbl(struct iwl4965_rate *mcs_rate, struct iwl4965_scale_tbl_info *tbl, int index, u8 use_green) @@ -349,6 +399,10 @@ static void rs_mcs_from_tbl(struct iwl4965_rate *mcs_rate, } } +/* + * Interpret uCode API's rate_n_flags format, + * fill "search" or "active" tx mode table. + */ static int rs_get_tbl_info_from_mcs(const struct iwl4965_rate *mcs_rate, int phymode, struct iwl4965_scale_tbl_info *tbl, int *rate_idx) @@ -362,11 +416,12 @@ static int rs_get_tbl_info_from_mcs(const struct iwl4965_rate *mcs_rate, *rate_idx = -1; return -EINVAL; } - tbl->is_SGI = 0; + tbl->is_SGI = 0; /* default legacy setup */ tbl->is_fat = 0; tbl->is_dup = 0; - tbl->antenna_type = ANT_BOTH; + tbl->antenna_type = ANT_BOTH; /* default MIMO setup */ + /* legacy rate format */ if (!(mcs_rate->rate_n_flags & RATE_MCS_HT_MSK)) { ant_msk = (mcs_rate->rate_n_flags & RATE_MCS_ANT_AB_MSK); @@ -386,6 +441,7 @@ static int rs_get_tbl_info_from_mcs(const struct iwl4965_rate *mcs_rate, } *rate_idx = index; + /* HT rate format, SISO (might be 20 MHz legacy or 40 MHz fat width) */ } else if (iwl4965_rate_get_rate(mcs_rate->rate_n_flags) <= IWL_RATE_SISO_60M_PLCP) { tbl->lq_type = LQ_SISO; @@ -410,6 +466,8 @@ static int rs_get_tbl_info_from_mcs(const struct iwl4965_rate *mcs_rate, tbl->is_dup = 1; *rate_idx = index; + + /* HT rate format, MIMO (might be 20 MHz legacy or 40 MHz fat width) */ } else { tbl->lq_type = LQ_MIMO; if (mcs_rate->rate_n_flags & RATE_MCS_SGI_MSK) @@ -564,8 +622,9 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data, rs_get_supported_rates(lq_data, NULL, tbl->lq_type, &rate_mask); - /* mask with station rate restriction */ + /* Mask with station rate restriction */ if (is_legacy(tbl->lq_type)) { + /* supp_rates has no CCK bits in A mode */ if (lq_data->phymode == (u8) MODE_IEEE80211A) rate_mask = (u16)(rate_mask & (lq_data->supp_rates << IWL_FIRST_OFDM_RATE)); @@ -573,7 +632,7 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data, rate_mask = (u16)(rate_mask & lq_data->supp_rates); } - /* if we did switched from HT to legacy check current rate */ + /* If we switched from HT to legacy, check current rate */ if (switch_to_legacy && (rate_mask & (1 << scale_index))) { rs_mcs_from_tbl(mcs_rate, tbl, scale_index, is_green); return; @@ -588,6 +647,9 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data, rs_mcs_from_tbl(mcs_rate, tbl, scale_index, is_green); } +/* + * mac80211 sends us Tx status + */ static void rs_tx_status(void *priv_rate, struct net_device *dev, struct sk_buff *skb, @@ -641,11 +703,14 @@ static void rs_tx_status(void *priv_rate, table = &lq->lq; active_index = lq->active_tbl; + /* Get mac80211 antenna info */ lq->antenna = (lq->valid_antenna & local->hw.conf.antenna_sel_tx); if (!lq->antenna) lq->antenna = lq->valid_antenna; + /* Ignore mac80211 antenna info for now */ lq->antenna = lq->valid_antenna; + curr_tbl = &(lq->lq_info[active_index]); search_tbl = &(lq->lq_info[(1 - active_index)]); window = (struct iwl4965_rate_scale_data *) @@ -664,6 +729,14 @@ static void rs_tx_status(void *priv_rate, return; } + /* + * Ignore this Tx frame response if its initial rate doesn't match + * that of latest Link Quality command. There may be stragglers + * from a previous Link Quality command, but we're no longer interested + * in those; they're either from the "active" mode while we're trying + * to check "search" mode, or a prior "search" mode after we've moved + * to a new "search" mode (which might become the new "active" mode). + */ if (retries && (tx_mcs.rate_n_flags != le32_to_cpu(table->rs_table[0].rate_n_flags))) { @@ -674,12 +747,17 @@ static void rs_tx_status(void *priv_rate, return; } + /* Update frame history window with "failure" for each Tx retry. */ while (retries) { + /* Look up the rate and other info used for each tx attempt. + * Each tx attempt steps one entry deeper in the rate table. */ tx_mcs.rate_n_flags = le32_to_cpu(table->rs_table[index].rate_n_flags); rs_get_tbl_info_from_mcs(&tx_mcs, priv->phymode, &tbl_type, &rs_index); + /* If type matches "search" table, + * add failure to "search" history */ if ((tbl_type.lq_type == search_tbl->lq_type) && (tbl_type.antenna_type == search_tbl->antenna_type) && (tbl_type.is_SGI == search_tbl->is_SGI)) { @@ -687,8 +765,10 @@ static void rs_tx_status(void *priv_rate, tpt = search_tbl->expected_tpt[rs_index]; else tpt = 0; - rs_collect_tx_data(search_win, - rs_index, tpt, 0); + rs_collect_tx_data(search_win, rs_index, tpt, 0); + + /* Else if type matches "current/active" table, + * add failure to "current/active" history */ } else if ((tbl_type.lq_type == curr_tbl->lq_type) && (tbl_type.antenna_type == curr_tbl->antenna_type) && (tbl_type.is_SGI == curr_tbl->is_SGI)) { @@ -698,6 +778,9 @@ static void rs_tx_status(void *priv_rate, tpt = 0; rs_collect_tx_data(window, rs_index, tpt, 0); } + + /* If not searching for a new mode, increment failed counter + * ... this helps determine when to start searching again */ if (lq->stay_in_tbl) lq->total_failed++; --retries; @@ -705,6 +788,11 @@ static void rs_tx_status(void *priv_rate, } + /* + * Find (by rate) the history window to update with final Tx attempt; + * if Tx was successful first try, use original rate, + * else look up the rate that was, finally, successful. + */ if (!tx_resp->retry_count) tx_mcs.rate_n_flags = tx_resp->control.tx_rate; else @@ -714,11 +802,14 @@ static void rs_tx_status(void *priv_rate, rs_get_tbl_info_from_mcs(&tx_mcs, priv->phymode, &tbl_type, &rs_index); + /* Update frame history window with "success" if Tx got ACKed ... */ if (tx_resp->flags & IEEE80211_TX_STATUS_ACK) status = 1; else status = 0; + /* If type matches "search" table, + * add final tx status to "search" history */ if ((tbl_type.lq_type == search_tbl->lq_type) && (tbl_type.antenna_type == search_tbl->antenna_type) && (tbl_type.is_SGI == search_tbl->is_SGI)) { @@ -728,6 +819,9 @@ static void rs_tx_status(void *priv_rate, tpt = 0; rs_collect_tx_data(search_win, rs_index, tpt, status); + + /* Else if type matches "current/active" table, + * add final tx status to "current/active" history */ } else if ((tbl_type.lq_type == curr_tbl->lq_type) && (tbl_type.antenna_type == curr_tbl->antenna_type) && (tbl_type.is_SGI == curr_tbl->is_SGI)) { @@ -738,6 +832,8 @@ static void rs_tx_status(void *priv_rate, rs_collect_tx_data(window, rs_index, tpt, status); } + /* If not searching for new mode, increment success/failed counter + * ... these help determine when to start searching again */ if (lq->stay_in_tbl) { if (status) lq->total_success++; @@ -745,6 +841,7 @@ static void rs_tx_status(void *priv_rate, lq->total_failed++; } + /* See if there's a better rate or modulation mode to try. */ rs_rate_scale_perform(priv, dev, hdr, sta); sta_info_put(sta); return; @@ -774,11 +871,19 @@ static u8 rs_is_other_ant_connected(u8 valid_antenna, return 0; } +/* + * Begin a period of staying with a selected modulation mode. + * Set "stay_in_tbl" flag to prevent any mode switches. + * Set frame tx success limits according to legacy vs. high-throughput, + * and reset overall (spanning all rates) tx success history statistics. + * These control how long we stay using same modulation mode before + * searching for a new mode. + */ static void rs_set_stay_in_table(u8 is_legacy, struct iwl4965_rate_scale_priv *lq_data) { IWL_DEBUG_HT("we are staying in the same table\n"); - lq_data->stay_in_tbl = 1; + lq_data->stay_in_tbl = 1; /* only place this gets set */ if (is_legacy) { lq_data->table_count_limit = IWL_LEGACY_TABLE_COUNT; lq_data->max_failure_limit = IWL_LEGACY_FAILURE_LIMIT; @@ -793,6 +898,9 @@ static void rs_set_stay_in_table(u8 is_legacy, lq_data->total_success = 0; } +/* + * Find correct throughput table for given mode of modulation + */ static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data, struct iwl4965_scale_tbl_info *tbl) { @@ -827,17 +935,33 @@ static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data, } #ifdef CONFIG_IWL4965_HT +/* + * Find starting rate for new "search" high-throughput mode of modulation. + * Goal is to find lowest expected rate (under perfect conditions) that is + * above the current measured throughput of "active" mode, to give new mode + * a fair chance to prove itself without too many challenges. + * + * This gets called when transitioning to more aggressive modulation + * (i.e. legacy to SISO or MIMO, or SISO to MIMO), as well as less aggressive + * (i.e. MIMO to SISO). When moving to MIMO, bit rate will typically need + * to decrease to match "active" throughput. When moving from MIMO to SISO, + * bit rate will typically need to increase, but not if performance was bad. + */ static s32 rs_get_best_rate(struct iwl4965_priv *priv, struct iwl4965_rate_scale_priv *lq_data, - struct iwl4965_scale_tbl_info *tbl, + struct iwl4965_scale_tbl_info *tbl, /* "search" */ u16 rate_mask, s8 index, s8 rate) { + /* "active" values */ struct iwl4965_scale_tbl_info *active_tbl = &(lq_data->lq_info[lq_data->active_tbl]); - s32 new_rate, high, low, start_hi; s32 active_sr = active_tbl->win[index].success_ratio; - s32 *tpt_tbl = tbl->expected_tpt; s32 active_tpt = active_tbl->expected_tpt[index]; + + /* expected "search" throughput */ + s32 *tpt_tbl = tbl->expected_tpt; + + s32 new_rate, high, low, start_hi; u16 high_low; new_rate = high = low = start_hi = IWL_RATE_INVALID; @@ -848,6 +972,21 @@ static s32 rs_get_best_rate(struct iwl4965_priv *priv, low = high_low & 0xff; high = (high_low >> 8) & 0xff; + /* + * Lower the "search" bit rate, to give new "search" mode + * approximately the same throughput as "active" if: + * + * 1) "Active" mode has been working modestly well (but not + * great), and expected "search" throughput (under perfect + * conditions) at candidate rate is above the actual + * measured "active" throughput (but less than expected + * "active" throughput under perfect conditions). + * OR + * 2) "Active" mode has been working perfectly or very well + * and expected "search" throughput (under perfect + * conditions) at candidate rate is above expected + * "active" throughput (under perfect conditions). + */ if ((((100 * tpt_tbl[rate]) > lq_data->last_tpt) && ((active_sr > IWL_RATE_DECREASE_TH) && (active_sr <= IWL_RATE_HIGH_TH) && @@ -855,21 +994,38 @@ static s32 rs_get_best_rate(struct iwl4965_priv *priv, ((active_sr >= IWL_RATE_SCALE_SWITCH) && (tpt_tbl[rate] > active_tpt))) { + /* (2nd or later pass) + * If we've already tried to raise the rate, and are + * now trying to lower it, use the higher rate. */ if (start_hi != IWL_RATE_INVALID) { new_rate = start_hi; break; } + new_rate = rate; + + /* Loop again with lower rate */ if (low != IWL_RATE_INVALID) rate = low; + + /* Lower rate not available, use the original */ else break; + + /* Else try to raise the "search" rate to match "active" */ } else { + /* (2nd or later pass) + * If we've already tried to lower the rate, and are + * now trying to raise it, use the lower rate. */ if (new_rate != IWL_RATE_INVALID) break; + + /* Loop again with higher rate */ else if (high != IWL_RATE_INVALID) { start_hi = high; rate = high; + + /* Higher rate not available, use the original */ } else { new_rate = rate; break; @@ -886,6 +1042,9 @@ static inline u8 rs_is_both_ant_supp(u8 valid_antenna) return (rs_is_ant_connected(valid_antenna, ANT_BOTH)); } +/* + * Set up search table for MIMO + */ static int rs_switch_to_mimo(struct iwl4965_priv *priv, struct iwl4965_rate_scale_priv *lq_data, struct iwl4965_scale_tbl_info *tbl, int index) @@ -906,6 +1065,7 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv, if (priv->current_assoc_ht.tx_mimo_ps_mode == IWL_MIMO_PS_STATIC) return -1; + /* Need both Tx chains/antennas to support MIMO */ if (!rs_is_both_ant_supp(lq_data->antenna)) return -1; @@ -943,6 +1103,9 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv, #endif /*CONFIG_IWL4965_HT */ } +/* + * Set up search table for SISO + */ static int rs_switch_to_siso(struct iwl4965_priv *priv, struct iwl4965_rate_scale_priv *lq_data, struct iwl4965_scale_tbl_info *tbl, int index) @@ -999,6 +1162,9 @@ static int rs_switch_to_siso(struct iwl4965_priv *priv, #endif /*CONFIG_IWL4965_HT */ } +/* + * Try to switch to new modulation mode from legacy + */ static int rs_move_legacy_other(struct iwl4965_priv *priv, struct iwl4965_rate_scale_priv *lq_data, int index) @@ -1020,12 +1186,17 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv, search_tbl->lq_type = LQ_NONE; lq_data->action_counter++; + + /* Don't change antenna if success has been great */ if (window->success_ratio >= IWL_RS_GOOD_RATIO) break; + + /* Don't change antenna if other one is not connected */ if (!rs_is_other_ant_connected(lq_data->antenna, tbl->antenna_type)) break; + /* Set up search table to try other antenna */ memcpy(search_tbl, tbl, sz); rs_toggle_antenna(&(search_tbl->current_rate), @@ -1036,6 +1207,8 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv, case IWL_LEGACY_SWITCH_SISO: IWL_DEBUG_HT("LQ: Legacy switch to SISO\n"); + + /* Set up search table to try SISO */ memcpy(search_tbl, tbl, sz); search_tbl->lq_type = LQ_SISO; search_tbl->is_SGI = 0; @@ -1051,6 +1224,8 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv, break; case IWL_LEGACY_SWITCH_MIMO: IWL_DEBUG_HT("LQ: Legacy switch MIMO\n"); + + /* Set up search table to try MIMO */ memcpy(search_tbl, tbl, sz); search_tbl->lq_type = LQ_MIMO; search_tbl->is_SGI = 0; @@ -1083,6 +1258,9 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv, } +/* + * Try to switch to new modulation mode from SISO + */ static int rs_move_siso_to_other(struct iwl4965_priv *priv, struct iwl4965_rate_scale_priv *lq_data, int index) @@ -1173,6 +1351,9 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv, return 0; } +/* + * Try to switch to new modulation mode from MIMO + */ static int rs_move_mimo_to_other(struct iwl4965_priv *priv, struct iwl4965_rate_scale_priv *lq_data, int index) @@ -1193,6 +1374,8 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv, case IWL_MIMO_SWITCH_ANTENNA_A: case IWL_MIMO_SWITCH_ANTENNA_B: IWL_DEBUG_HT("LQ: MIMO SWITCH TO SISO\n"); + + /* Set up new search table for SISO */ memcpy(search_tbl, tbl, sz); search_tbl->lq_type = LQ_SISO; search_tbl->is_SGI = 0; @@ -1212,6 +1395,8 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv, case IWL_MIMO_SWITCH_GI: IWL_DEBUG_HT("LQ: MIMO SWITCH TO GI\n"); + + /* Set up new search table for MIMO */ memcpy(search_tbl, tbl, sz); search_tbl->lq_type = LQ_MIMO; search_tbl->antenna_type = ANT_BOTH; @@ -1221,6 +1406,13 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv, else search_tbl->is_SGI = 1; lq_data->search_better_tbl = 1; + + /* + * If active table already uses the fastest possible + * modulation (dual stream with short guard interval), + * and it's working well, there's no need to look + * for a better type of modulation! + */ if ((tbl->lq_type == LQ_MIMO) && (tbl->is_SGI)) { s32 tpt = lq_data->last_tpt / 100; @@ -1253,6 +1445,13 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv, } +/* + * Check whether we should continue using same modulation mode, or + * begin search for a new mode, based on: + * 1) # tx successes or failures while using this mode + * 2) # times calling this function + * 3) elapsed time in this mode (not used, for now) + */ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data) { struct iwl4965_scale_tbl_info *tbl; @@ -1264,15 +1463,27 @@ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data) tbl = &(lq_data->lq_info[active_tbl]); + /* If we've been disallowing search, see if we should now allow it */ if (lq_data->stay_in_tbl) { + /* Elapsed time using current modulation mode */ if (lq_data->flush_timer) flush_interval_passed = time_after(jiffies, (unsigned long)(lq_data->flush_timer + IWL_RATE_SCALE_FLUSH_INTVL)); + /* For now, disable the elapsed time criterion */ flush_interval_passed = 0; + + /* + * Check if we should allow search for new modulation mode. + * If many frames have failed or succeeded, or we've used + * this same modulation for a long time, allow search, and + * reset history stats that keep track of whether we should + * allow a new search. Also (below) reset all bitmaps and + * stats in active history. + */ if ((lq_data->total_failed > lq_data->max_failure_limit) || (lq_data->total_success > lq_data->max_success_limit) || ((!lq_data->search_better_tbl) && (lq_data->flush_timer) @@ -1281,10 +1492,19 @@ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data) lq_data->total_failed, lq_data->total_success, flush_interval_passed); - lq_data->stay_in_tbl = 0; + + /* Allow search for new mode */ + lq_data->stay_in_tbl = 0; /* only place reset */ lq_data->total_failed = 0; lq_data->total_success = 0; lq_data->flush_timer = 0; + + /* + * Else if we've used this modulation mode enough repetitions + * (regardless of elapsed time or success/failure), reset + * history bitmaps and rate-specific stats for all rates in + * active table. + */ } else { lq_data->table_count++; if (lq_data->table_count >= @@ -1298,6 +1518,9 @@ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data) } } + /* If transitioning to allow "search", reset all history + * bitmaps and stats in active table (this will become the new + * "search" table). */ if (!lq_data->stay_in_tbl) { for (i = 0; i < IWL_RATE_COUNT; i++) rs_rate_scale_clear_window(&(tbl->win[i])); @@ -1305,6 +1528,9 @@ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data) } } +/* + * Do rate scaling and search for new modulation mode. + */ static void rs_rate_scale_perform(struct iwl4965_priv *priv, struct net_device *dev, struct ieee80211_hdr *hdr, @@ -1350,6 +1576,11 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, } lq_data = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv; + /* + * Select rate-scale / modulation-mode table to work with in + * the rest of this function: "search" if searching for better + * modulation mode, or "active" if doing rate scaling within a mode. + */ if (!lq_data->search_better_tbl) active_tbl = lq_data->active_tbl; else @@ -1358,11 +1589,13 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, tbl = &(lq_data->lq_info[active_tbl]); is_green = lq_data->is_green; + /* current tx rate */ index = sta->last_txrate; IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, tbl->lq_type); + /* rates available for this association, and for modulation mode */ rs_get_supported_rates(lq_data, hdr, tbl->lq_type, &rate_mask); @@ -1371,6 +1604,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, /* mask with station rate restriction */ if (is_legacy(tbl->lq_type)) { if (lq_data->phymode == (u8) MODE_IEEE80211A) + /* supp_rates has no CCK bits in A mode */ rate_scale_index_msk = (u16) (rate_mask & (lq_data->supp_rates << IWL_FIRST_OFDM_RATE)); else @@ -1383,11 +1617,13 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, if (!rate_scale_index_msk) rate_scale_index_msk = rate_mask; + /* If current rate is no longer supported on current association, + * or user changed preferences for rates, find a new supported rate. */ if (index < 0 || !((1 << index) & rate_scale_index_msk)) { index = IWL_INVALID_VALUE; update_lq = 1; - /* get the lowest available rate */ + /* get the highest available rate */ for (i = 0; i <= IWL_RATE_COUNT; i++) { if ((1 << i) & rate_scale_index_msk) index = i; @@ -1399,11 +1635,19 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, } } + /* Get expected throughput table and history window for current rate */ if (!tbl->expected_tpt) rs_get_expected_tpt_table(lq_data, tbl); window = &(tbl->win[index]); + /* + * If there is not enough history to calculate actual average + * throughput, keep analyzing results of more tx frames, without + * changing rate or mode (bypass most of the rest of this function). + * Set up new rate table in uCode only if old rate is not supported + * in current association (use new rate found above). + */ fail_count = window->counter - window->success_counter; if (((fail_count < IWL_RATE_MIN_FAILURE_TH) && (window->success_counter < IWL_RATE_MIN_SUCCESS_TH)) @@ -1411,8 +1655,15 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, IWL_DEBUG_RATE("LQ: still below TH succ %d total %d " "for index %d\n", window->success_counter, window->counter, index); + + /* Can't calculate this yet; not enough history */ window->average_tpt = IWL_INVALID_VALUE; + + /* Should we stay with this modulation mode, + * or search for a new one? */ rs_stay_in_table(lq_data); + + /* Set up new rate table in uCode, if needed */ if (update_lq) { rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green); rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq); @@ -1420,13 +1671,19 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, } goto out; + /* Else we have enough samples; calculate estimate of + * actual average throughput */ } else window->average_tpt = ((window->success_ratio * tbl->expected_tpt[index] + 64) / 128); + /* If we are searching for better modulation mode, check success. */ if (lq_data->search_better_tbl) { int success_limit = IWL_RATE_SCALE_SWITCH; + /* If good success, continue using the "search" mode; + * no need to send new link quality command, since we're + * continuing to use the setup that we've been trying. */ if ((window->success_ratio > success_limit) || (window->average_tpt > lq_data->last_tpt)) { if (!is_legacy(tbl->lq_type)) { @@ -1438,55 +1695,78 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, lq_data->last_tpt); lq_data->enable_counter = 1; } + /* Swap tables; "search" becomes "active" */ lq_data->active_tbl = active_tbl; current_tpt = window->average_tpt; + + /* Else poor success; go back to mode in "active" table */ } else { + /* Nullify "search" table */ tbl->lq_type = LQ_NONE; + + /* Revert to "active" table */ active_tbl = lq_data->active_tbl; tbl = &(lq_data->lq_info[active_tbl]); + /* Revert to "active" rate and throughput info */ index = iwl4965_rate_index_from_plcp( tbl->current_rate.rate_n_flags); + current_tpt = lq_data->last_tpt; + /* Need to set up a new rate table in uCode */ update_lq = 1; - current_tpt = lq_data->last_tpt; IWL_DEBUG_HT("XXY GO BACK TO OLD TABLE\n"); } + + /* Either way, we've made a decision; modulation mode + * search is done, allow rate adjustment next time. */ lq_data->search_better_tbl = 0; - done_search = 1; + done_search = 1; /* Don't switch modes below! */ goto lq_update; } + /* (Else) not in search of better modulation mode, try for better + * starting rate, while staying in this mode. */ high_low = rs_get_adjacent_rate(index, rate_scale_index_msk, tbl->lq_type); low = high_low & 0xff; high = (high_low >> 8) & 0xff; + /* Collect measured throughputs for current and adjacent rates */ current_tpt = window->average_tpt; - if (low != IWL_RATE_INVALID) low_tpt = tbl->win[low].average_tpt; - if (high != IWL_RATE_INVALID) high_tpt = tbl->win[high].average_tpt; - + /* Assume rate increase */ scale_action = 1; + /* Too many failures, decrease rate */ if ((window->success_ratio <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) { IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); scale_action = -1; + + /* No throughput measured yet for adjacent rates; try increase. */ } else if ((low_tpt == IWL_INVALID_VALUE) && (high_tpt == IWL_INVALID_VALUE)) scale_action = 1; + + /* Both adjacent throughputs are measured, but neither one has better + * throughput; we're using the best rate, don't change it! */ else if ((low_tpt != IWL_INVALID_VALUE) && (high_tpt != IWL_INVALID_VALUE) && (low_tpt < current_tpt) && (high_tpt < current_tpt)) scale_action = 0; + + /* At least one adjacent rate's throughput is measured, + * and may have better performance. */ else { + /* Higher adjacent rate's throughput is measured */ if (high_tpt != IWL_INVALID_VALUE) { + /* Higher rate has better throughput */ if (high_tpt > current_tpt) scale_action = 1; else { @@ -1494,7 +1774,10 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, ("decrease rate because of high tpt\n"); scale_action = -1; } + + /* Lower adjacent rate's throughput is measured */ } else if (low_tpt != IWL_INVALID_VALUE) { + /* Lower rate has better throughput */ if (low_tpt > current_tpt) { IWL_DEBUG_RATE ("decrease rate because of low tpt\n"); @@ -1504,23 +1787,30 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, } } + /* Sanity check; asked for decrease, but success rate or throughput + * has been good at old rate. Don't change it. */ if (scale_action == -1) { if ((low != IWL_RATE_INVALID) && ((window->success_ratio > IWL_RATE_HIGH_TH) || (current_tpt > (100 * tbl->expected_tpt[low])))) scale_action = 0; + + /* Sanity check; asked for increase, but success rate has not been great + * even at old rate, higher rate will be worse. Don't change it. */ } else if ((scale_action == 1) && (window->success_ratio < IWL_RATE_INCREASE_TH)) scale_action = 0; switch (scale_action) { case -1: + /* Decrease starting rate, update uCode's rate table */ if (low != IWL_RATE_INVALID) { update_lq = 1; index = low; } break; case 1: + /* Increase starting rate, update uCode's rate table */ if (high != IWL_RATE_INVALID) { update_lq = 1; index = high; @@ -1528,6 +1818,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, break; case 0: + /* No change */ default: break; } @@ -1537,16 +1828,28 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, index, scale_action, low, high, tbl->lq_type); lq_update: + /* Replace uCode's rate table for the destination station. */ if (update_lq) { rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green); rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq); rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC); } + + /* Should we stay with this modulation mode, or search for a new one? */ rs_stay_in_table(lq_data); + /* + * Search for new modulation mode if we're: + * 1) Not changing rates right now + * 2) Not just finishing up a search + * 3) Allowing a new search + */ if (!update_lq && !done_search && !lq_data->stay_in_tbl) { + /* Save current throughput to compare with "search" throughput*/ lq_data->last_tpt = current_tpt; + /* Select a new "search" modulation mode to try. + * If one is found, set up the new "search" table. */ if (is_legacy(tbl->lq_type)) rs_move_legacy_other(priv, lq_data, index); else if (is_siso(tbl->lq_type)) @@ -1554,11 +1857,14 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, else rs_move_mimo_to_other(priv, lq_data, index); + /* If new "search" mode was selected, set up in uCode table */ if (lq_data->search_better_tbl) { + /* Access the "search" table, clear its history. */ tbl = &(lq_data->lq_info[(1 - lq_data->active_tbl)]); for (i = 0; i < IWL_RATE_COUNT; i++) rs_rate_scale_clear_window(&(tbl->win[i])); + /* Use new "search" start rate */ index = iwl4965_rate_index_from_plcp( tbl->current_rate.rate_n_flags); @@ -1568,8 +1874,13 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, &lq_data->lq); rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC); } - tbl1 = &(lq_data->lq_info[lq_data->active_tbl]); + /* If the "active" (non-search) mode was legacy, + * and we've tried switching antennas, + * but we haven't been able to try HT modes (not available), + * stay with best antenna legacy modulation for a while + * before next round of mode comparisons. */ + tbl1 = &(lq_data->lq_info[lq_data->active_tbl]); if (is_legacy(tbl1->lq_type) && #ifdef CONFIG_IWL4965_HT !priv->current_assoc_ht.is_ht && @@ -1580,9 +1891,13 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, rs_set_stay_in_table(1, lq_data); } + /* If we're in an HT mode, and all 3 mode switch actions + * have been tried and compared, stay in this best modulation + * mode for a while before next round of mode comparisons. */ if (lq_data->enable_counter && (lq_data->action_counter >= IWL_ACTION_LIMIT)) { #ifdef CONFIG_IWL4965_HT_AGG + /* If appropriate, set up aggregation! */ if ((lq_data->last_tpt > TID_AGG_TPT_THREHOLD) && (priv->lq_mngr.agg_ctrl.auto_agg)) { priv->lq_mngr.agg_ctrl.tid_retry = @@ -1593,6 +1908,14 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, lq_data->action_counter = 0; rs_set_stay_in_table(0, lq_data); } + + /* + * Else, don't search for a new modulation mode. + * Put new timestamp in stay-in-modulation-mode flush timer if: + * 1) Not changing rates right now + * 2) Not just finishing up a search + * 3) flush timer is empty + */ } else { if ((!update_lq) && (!done_search) && (!lq_data->flush_timer)) lq_data->flush_timer = jiffies; @@ -1789,15 +2112,14 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, priv->assoc_station_added = 1; } + /* Find highest tx rate supported by hardware and destination station */ for (i = 0; i < mode->num_rates; i++) { if ((sta->supp_rates & BIT(i)) && (mode->rates[i].flags & IEEE80211_RATE_SUPPORTED)) sta->txrate = i; } sta->last_txrate = sta->txrate; - /* For MODE_IEEE80211A mode cck rate are at end - * rate table - */ + /* For MODE_IEEE80211A, cck rates are at end of rate table */ if (local->hw.conf.phymode == MODE_IEEE80211A) sta->last_txrate += IWL_FIRST_OFDM_RATE; @@ -1810,11 +2132,16 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, crl->active_rate_basic = priv->active_rate_basic; crl->phymode = priv->phymode; #ifdef CONFIG_IWL4965_HT + /* + * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), + * supp_rates[] does not; shift to convert format, force 9 MBits off. + */ crl->active_siso_rate = (priv->current_assoc_ht.supp_rates[0] << 1); crl->active_siso_rate |= (priv->current_assoc_ht.supp_rates[0] & 0x1); crl->active_siso_rate &= ~((u16)0x2); crl->active_siso_rate = crl->active_siso_rate << IWL_FIRST_OFDM_RATE; + /* Same here */ crl->active_mimo_rate = (priv->current_assoc_ht.supp_rates[1] << 1); crl->active_mimo_rate |= (priv->current_assoc_ht.supp_rates[1] & 0x1); crl->active_mimo_rate &= ~((u16)0x2); @@ -1844,11 +2171,14 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, struct iwl4965_rate new_rate; struct iwl4965_scale_tbl_info tbl_type = { 0 }; + /* Override starting rate (index 0) if needed for debug purposes */ rs_dbgfs_set_mcs(lq_data, tx_mcs, index); + /* Interpret rate_n_flags */ rs_get_tbl_info_from_mcs(tx_mcs, lq_data->phymode, &tbl_type, &rate_idx); + /* How many times should we repeat the initial rate? */ if (is_legacy(tbl_type.lq_type)) { ant_toggle_count = 1; repeat_rate = IWL_NUMBER_TRY; @@ -1857,19 +2187,27 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, lq_cmd->general_params.mimo_delimiter = is_mimo(tbl_type.lq_type) ? 1 : 0; + + /* Fill 1st table entry (index 0) */ lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(tx_mcs->rate_n_flags); new_rate.rate_n_flags = tx_mcs->rate_n_flags; if (is_mimo(tbl_type.lq_type) || (tbl_type.antenna_type == ANT_MAIN)) - lq_cmd->general_params.single_stream_ant_msk = 1; + lq_cmd->general_params.single_stream_ant_msk + = LINK_QUAL_ANT_A_MSK; else - lq_cmd->general_params.single_stream_ant_msk = 2; + lq_cmd->general_params.single_stream_ant_msk + = LINK_QUAL_ANT_B_MSK; index++; repeat_rate--; + /* Fill rest of rate table */ while (index < LINK_QUAL_MAX_RETRY_NUM) { + /* Repeat initial/next rate. + * For legacy IWL_NUMBER_TRY == 1, this loop will not execute. + * For HT IWL_HT_NUMBER_TRY == 3, this executes twice. */ while (repeat_rate > 0 && (index < LINK_QUAL_MAX_RETRY_NUM)) { if (is_legacy(tbl_type.lq_type)) { if (ant_toggle_count < @@ -1881,7 +2219,10 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, } } + /* Override next rate if needed for debug purposes */ rs_dbgfs_set_mcs(lq_data, &new_rate, index); + + /* Fill next table entry */ lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate.rate_n_flags); repeat_rate--; @@ -1891,12 +2232,17 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, rs_get_tbl_info_from_mcs(&new_rate, lq_data->phymode, &tbl_type, &rate_idx); + /* Indicate to uCode which entries might be MIMO. + * If initial rate was MIMO, this will finally end up + * as (IWL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */ if (is_mimo(tbl_type.lq_type)) lq_cmd->general_params.mimo_delimiter = index; + /* Get next rate */ rs_get_lower_rate(lq_data, &tbl_type, rate_idx, use_ht_possible, &new_rate); + /* How many times should we repeat the next rate? */ if (is_legacy(tbl_type.lq_type)) { if (ant_toggle_count < NUM_TRY_BEFORE_ANTENNA_TOGGLE) ant_toggle_count++; @@ -1908,9 +2254,14 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, } else repeat_rate = IWL_HT_NUMBER_TRY; + /* Don't allow HT rates after next pass. + * rs_get_lower_rate() will change type to LQ_A or LQ_G. */ use_ht_possible = 0; + /* Override next rate if needed for debug purposes */ rs_dbgfs_set_mcs(lq_data, &new_rate, index); + + /* Fill next table entry */ lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate.rate_n_flags); @@ -2006,9 +2357,9 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, else rs_priv->dbg_fixed.rate_n_flags = 0; - rs_priv->active_rate = 0x0FFF; - rs_priv->active_siso_rate = 0x1FD0; - rs_priv->active_mimo_rate = 0x1FD0; + rs_priv->active_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ + rs_priv->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ + rs_priv->active_mimo_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ IWL_DEBUG_RATE("sta_id %d rate 0x%X\n", rs_priv->lq.sta_id, rs_priv->dbg_fixed.rate_n_flags); @@ -2209,7 +2560,7 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) /* Display the average rate of all samples taken. * - * NOTE: We multiple # of samples by 2 since the IEEE measurement + * NOTE: We multiply # of samples by 2 since the IEEE measurement * added from iwl4965_rates is actually 2X the rate */ if (samples) count += sprintf(&buf[count], diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h index 4259099eae7..86f62d80905 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h @@ -30,10 +30,10 @@ #include "iwl-4965.h" struct iwl4965_rate_info { - u8 plcp; - u8 plcp_siso; - u8 plcp_mimo; - u8 ieee; + u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ + u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */ + u8 plcp_mimo; /* uCode API: IWL_RATE_MIMO_6M_PLCP, etc. */ + u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ u8 prev_ieee; /* previous rate in IEEE speeds */ u8 next_ieee; /* next rate in IEEE speeds */ u8 prev_rs; /* previous rate used in rs algo */ @@ -42,6 +42,7 @@ struct iwl4965_rate_info { u8 next_rs_tgg; /* next rate used in TGG rs algo */ }; +/* For driver (not uCode API) */ enum { IWL_RATE_1M_INDEX = 0, IWL_RATE_2M_INDEX, @@ -83,6 +84,7 @@ enum { #define IWL_RATE_5M_MASK (1<= IWL_FIRST_OFDM_RATE) && (i <= IWL_LAST_OFDM_RATE)) return i; + + /* 4965 legacy rate format, search for match in table */ } else { for (i = 0; i < ARRAY_SIZE(iwl4965_rates); i++) if (iwl4965_rates[i].plcp == (plcp &0xFF)) -- cgit v1.2.3-70-g09d2 From 9fbab5163aa8cb3a5aef845fbf67b0c1c85030b6 Mon Sep 17 00:00:00 2001 From: Ben Cahill Date: Thu, 29 Nov 2007 11:09:47 +0800 Subject: iwlwifi: clean up and clarify some comments after 3945/4965 split Clean up and clarify some comments after 3945/4965 split. Signed-off-by: Ben Cahill Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945-rs.h | 11 +- drivers/net/wireless/iwlwifi/iwl-4965-rs.h | 5 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 126 ++++++++------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 163 +++++++++++++--------------- 4 files changed, 132 insertions(+), 173 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h index 075f7de0976..e21a5bae687 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h @@ -28,8 +28,8 @@ #define __iwl_3945_rs_h__ struct iwl3945_rate_info { - u8 plcp; - u8 ieee; + u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ + u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ u8 prev_ieee; /* previous rate in IEEE speeds */ u8 next_ieee; /* next rate in IEEE speeds */ u8 prev_rs; /* previous rate used in rs algo */ @@ -38,9 +38,12 @@ struct iwl3945_rate_info { u8 next_rs_tgg; /* next rate used in TGG rs algo */ u8 table_rs_index; /* index in rate scale table cmd */ u8 prev_table_rs; /* prev in rate table cmd */ - }; +/* + * These serve as indexes into + * struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT]; + */ enum { IWL_RATE_1M_INDEX = 0, IWL_RATE_2M_INDEX, @@ -96,6 +99,7 @@ enum { #define IWL_RATE_5M_MASK (1< #include #include @@ -75,9 +65,9 @@ static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, /* module parameters */ static int iwl3945_param_disable_hw_scan; static int iwl3945_param_debug; -static int iwl3945_param_disable; /* def: enable radio */ -static int iwl3945_param_antenna; /* def: 0 = both antennas (use diversity) */ -int iwl3945_param_hwcrypto; /* def: using software encryption */ +static int iwl3945_param_disable; /* def: enable radio */ +static int iwl3945_param_antenna; /* def: 0 = both antennas (use diversity) */ +int iwl3945_param_hwcrypto; /* def: using software encryption */ static int iwl3945_param_qos_enable = 1; int iwl3945_param_queues_num = IWL_MAX_NUM_QUEUES; @@ -396,11 +386,7 @@ void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *t const u8 iwl3945_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /*************** STATION TABLE MANAGEMENT **** - * - * NOTE: This needs to be overhauled to better synchronize between - * how the iwl-4965.c is using iwl3945_hw_find_station vs. iwl-3945.c - * - * mac80211 should also be examined to determine if sta_info is duplicating + * mac80211 should be examined to determine if sta_info is duplicating * the functionality provided here */ @@ -956,12 +942,12 @@ static int iwl3945_check_rxon_cmd(struct iwl3945_rxon_cmd *rxon) } /** - * iwl3945_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit + * iwl3945_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed * @priv: staging_rxon is compared to active_rxon * - * If the RXON structure is changing sufficient to require a new - * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1 - * to indicate a new tune is required. + * If the RXON structure is changing enough to require a new tune, + * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that + * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. */ static int iwl3945_full_rxon_required(struct iwl3945_priv *priv) { @@ -1235,7 +1221,7 @@ static int iwl3945_card_state_sync_callback(struct iwl3945_priv *priv, /* * CARD_STATE_CMD * - * Use: Sets the internal card state to enable, disable, or halt + * Use: Sets the device's internal card state to enable, disable, or halt * * When in the 'enable' state the card operates as normal. * When in the 'disable' state, the card enters into a low power mode. @@ -1589,14 +1575,9 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv) /** * iwl3945_report_frame - dump frame to syslog during debug sessions * - * hack this function to show different aspects of received frames, + * You may hack this function to show different aspects of received frames, * including selective frame dumps. * group100 parameter selects whether to show 1 out of 100 good frames. - * - * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type - * info output is okay, but some of this stuff (e.g. iwl3945_rx_frame_stats) - * is 3945-specific and gives bad output for 4965. Need to split the - * functionality, keep common stuff here. */ void iwl3945_report_frame(struct iwl3945_priv *priv, struct iwl3945_rx_packet *pkt, @@ -3775,13 +3756,10 @@ static void iwl3945_setup_rx_handlers(struct iwl3945_priv *priv) iwl3945_rx_pm_debug_statistics_notif; priv->rx_handlers[BEACON_NOTIFICATION] = iwl3945_rx_beacon_notif; - /* NOTE: iwl3945_rx_statistics is different based on whether - * the build is for the 3945 or the 4965. See the - * corresponding implementation in iwl-XXXX.c - * - * The same handler is used for both the REPLY to a - * discrete statistics request from the host as well as - * for the periodic statistics notification from the uCode + /* + * The same handler is used for both the REPLY to a discrete + * statistics request from the host as well as for the periodic + * statistics notifications (after received beacons) from the uCode. */ priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl3945_hw_rx_statistics; priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl3945_hw_rx_statistics; @@ -3795,7 +3773,7 @@ static void iwl3945_setup_rx_handlers(struct iwl3945_priv *priv) priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl3945_rx_card_state_notif; priv->rx_handlers[REPLY_TX] = iwl3945_rx_reply_tx; - /* Setup hardware specific Rx handlers */ + /* Set up hardware specific Rx handlers */ iwl3945_hw_rx_handler_setup(priv); } @@ -3867,10 +3845,10 @@ static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv, * The queue is empty (no good data) if WRITE = READ - 1, and is full if * WRITE = READ. * - * During initialization the host sets up the READ queue position to the first + * During initialization, the host sets up the READ queue position to the first * INDEX position, and WRITE to the last (READ - 1 wrapped) * - * When the firmware places a packet in a buffer it will advance the READ index + * When the firmware places a packet in a buffer, it will advance the READ index * and fire the RX interrupt. The driver can then query the READ index and * process as many packets as possible, moving the WRITE index forward as it * resets the Rx queue buffers with new memory. @@ -3892,16 +3870,16 @@ static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv, * * Driver sequence: * - * iwl3945_rx_queue_alloc() Allocates rx_free - * iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls + * iwl3945_rx_queue_alloc() Allocates rx_free + * iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls * iwl3945_rx_queue_restock - * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx + * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx * queue, updates firmware pointers, and updates * the WRITE index. If insufficient rx_free buffers * are available, schedules iwl3945_rx_replenish * * -- enable interrupts -- - * ISR - iwl3945_rx() Detach iwl3945_rx_mem_buffers from pool up to the + * ISR - iwl3945_rx() Detach iwl3945_rx_mem_buffers from pool up to the * READ INDEX, detaching the SKB from the pool. * Moves the packet buffer from queue to rx_used. * Calls iwl3945_rx_queue_restock to refill any empty @@ -3927,12 +3905,6 @@ static int iwl3945_rx_queue_space(const struct iwl3945_rx_queue *q) /** * iwl3945_rx_queue_update_write_ptr - Update the write pointer for the RX queue - * - * NOTE: This function has 3945 and 4965 specific code sections - * but is declared in base due to the majority of the - * implementation being the same (only a numeric constant is - * different) - * */ int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, struct iwl3945_rx_queue *q) { @@ -3973,9 +3945,7 @@ int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, struct iwl3945_ } /** - * iwl3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer. - * - * NOTE: This function has 3945 and 4965 specific code paths in it. + * iwl3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr */ static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl3945_priv *priv, dma_addr_t dma_addr) @@ -3986,9 +3956,9 @@ static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl3945_priv *priv, /** * iwl3945_rx_queue_restock - refill RX queue from pre-allocated pool * - * If there are slots in the RX queue that need to be restocked, + * If there are slots in the RX queue that need to be restocked, * and we have free pre-allocated buffers, fill the ranks as much - * as we can pulling from rx_free. + * as we can, pulling from rx_free. * * This moves the 'write' index forward to catch up with 'processed', and * also updates the memory address in the firmware to reference the new @@ -4080,7 +4050,7 @@ void iwl3945_rx_replenish(void *data) } /* Assumes that the skb field of the buffers in 'pool' is kept accurate. - * If an SKB has been detached, the POOL needs to have it's SKB set to NULL + * If an SKB has been detached, the POOL needs to have its SKB set to NULL * This free routine walks the list of POOL entries and if SKB is set to * non NULL it is unmapped and freed */ @@ -4232,7 +4202,7 @@ int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm) } /** - * iwl3945_rx_handle - Main entry function for receiving responses from the uCode + * iwl3945_rx_handle - Main entry function for receiving responses from uCode * * Uses the priv->rx_handlers callback function array to invoke * the appropriate handlers, including command responses, @@ -4257,7 +4227,7 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv) while (i != r) { rxb = rxq->queue[i]; - /* If an RXB doesn't have a queue slot associated with it + /* If an RXB doesn't have a Rx queue slot associated with it, * then a bug has been introduced in the queue refilling * routines -- catch it here */ BUG_ON(rxb == NULL); @@ -4296,8 +4266,8 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv) } if (reclaim) { - /* Invoke any callbacks, transfer the skb to caller, - * and fire off the (possibly) blocking iwl3945_send_cmd() + /* Invoke any callbacks, transfer the skb to caller, and + * fire off the (possibly) blocking iwl3945_send_cmd() * as we reclaim the driver command queue */ if (rxb && rxb->skb) iwl3945_tx_cmd_complete(priv, rxb); @@ -4671,7 +4641,8 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv) #ifdef CONFIG_IWL3945_DEBUG if (iwl3945_debug_level & IWL_DL_ISR) { - inta_mask = iwl3945_read32(priv, CSR_INT_MASK); /* just for debug */ + /* just for debug */ + inta_mask = iwl3945_read32(priv, CSR_INT_MASK); IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); } @@ -4901,11 +4872,11 @@ static const u8 iwl3945_eeprom_band_1[14] = { }; /* 5.2 GHz bands */ -static const u8 iwl3945_eeprom_band_2[] = { +static const u8 iwl3945_eeprom_band_2[] = { /* 4915-5080MHz */ 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 }; -static const u8 iwl3945_eeprom_band_3[] = { /* 5205-5320MHz */ +static const u8 iwl3945_eeprom_band_3[] = { /* 5170-5320MHz */ 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 }; @@ -4929,7 +4900,7 @@ static void iwl3945_init_band_reference(const struct iwl3945_priv *priv, int ban *eeprom_ch_info = priv->eeprom.band_1_channels; *eeprom_ch_index = iwl3945_eeprom_band_1; break; - case 2: /* 5.2GHz band */ + case 2: /* 4.9GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_2); *eeprom_ch_info = priv->eeprom.band_2_channels; *eeprom_ch_index = iwl3945_eeprom_band_2; @@ -4939,12 +4910,12 @@ static void iwl3945_init_band_reference(const struct iwl3945_priv *priv, int ban *eeprom_ch_info = priv->eeprom.band_3_channels; *eeprom_ch_index = iwl3945_eeprom_band_3; break; - case 4: /* 5.2GHz band */ + case 4: /* 5.5GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_4); *eeprom_ch_info = priv->eeprom.band_4_channels; *eeprom_ch_index = iwl3945_eeprom_band_4; break; - case 5: /* 5.2GHz band */ + case 5: /* 5.7GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_5); *eeprom_ch_info = priv->eeprom.band_5_channels; *eeprom_ch_index = iwl3945_eeprom_band_5; @@ -5207,7 +5178,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode, scan_ch->active_dwell = cpu_to_le16(active_dwell); scan_ch->passive_dwell = cpu_to_le16(passive_dwell); - /* Set power levels to defaults */ + /* Set txpower levels to defaults */ scan_ch->tpc.dsp_atten = 110; /* scan_pwr_info->tpc.dsp_atten; */ @@ -5217,8 +5188,8 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode, else { scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); /* NOTE: if we were doing 6Mb OFDM for scans we'd use - * power level - scan_ch->tpc.tx_gain = ((1<<5) | (2 << 3)) | 3; + * power level: + * scan_ch->tpc.tx_gain = ((1<<5) | (2 << 3)) | 3; */ } @@ -5602,8 +5573,9 @@ static int iwl3945_verify_ucode(struct iwl3945_priv *priv) IWL_ERROR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); - /* Show first several data entries in instruction SRAM. - * Selection of bootstrap image is arbitrary. */ + /* Since nothing seems to match, show first several data entries in + * instruction SRAM, so maybe visual inspection will give a clue. + * Selection of bootstrap image (vs. other images) is arbitrary. */ image = (__le32 *)priv->ucode_boot.v_addr; len = priv->ucode_boot.len; rc = iwl3945_verify_inst_full(priv, image, len); @@ -5695,7 +5667,7 @@ static int iwl3945_load_bsm(struct iwl3945_priv *priv) return -EINVAL; /* Tell bootstrap uCode where to find the "Initialize" uCode - * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965. + * in host DRAM ... host DRAM physical address bits 31:0 for 3945. * NOTE: iwl3945_initialize_alive_start() will replace these values, * after the "initialize" uCode has run, to point to * runtime/protocol instructions and backup data cache. */ @@ -6020,12 +5992,8 @@ static int iwl3945_set_ucode_ptrs(struct iwl3945_priv *priv) * * Called after REPLY_ALIVE notification received from "initialize" uCode. * - * The 4965 "initialize" ALIVE reply contains calibration data for: - * Voltage, temperature, and MIMO tx gain correction, now stored in priv - * (3945 does not contain this data). - * * Tell "initialize" uCode to go ahead and load the runtime uCode. -*/ + */ static void iwl3945_init_alive_start(struct iwl3945_priv *priv) { /* Check alive response for "valid" sign from uCode */ @@ -6120,7 +6088,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv) } else set_bit(STATUS_RF_KILL_HW, &priv->status); - /* After the ALIVE response, we can process host commands */ + /* After the ALIVE response, we can send commands to 3945 uCode */ set_bit(STATUS_ALIVE, &priv->status); /* Clear out the uCode error bit if it is set */ @@ -6177,7 +6145,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv) memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); } - /* Configure BT coexistence */ + /* Configure Bluetooth device coexistence support */ iwl3945_send_bt_config(priv); /* Configure the adapter for unassociated operation */ @@ -6365,7 +6333,7 @@ static int __iwl3945_up(struct iwl3945_priv *priv) /* start card; "initialize" will load runtime ucode */ iwl3945_nic_start(priv); - /* MAC Address location in EEPROM same for 3945/4965 */ + /* MAC Address location in EEPROM is same for 3945/4965 */ get_eeprom_mac(priv, priv->mac_addr); IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 33eace75743..74c3d3917fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -27,16 +27,6 @@ * *****************************************************************************/ -/* - * NOTE: This file (iwl-base.c) is used to build to multiple hardware targets - * by defining IWL to either 3945 or 4965. The Makefile used when building - * the base targets will create base-3945.o and base-4965.o - * - * The eventual goal is to move as many of the #if IWL / #endif blocks out of - * this file and into the hardware specific implementation files (iwl-XXXX.c) - * and leave only the common (non #ifdef sprinkled) code in this file - */ - #include #include #include @@ -75,9 +65,9 @@ static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv, /* module parameters */ static int iwl4965_param_disable_hw_scan; static int iwl4965_param_debug; -static int iwl4965_param_disable; /* def: enable radio */ -static int iwl4965_param_antenna; /* def: 0 = both antennas (use diversity) */ -int iwl4965_param_hwcrypto; /* def: using software encryption */ +static int iwl4965_param_disable; /* def: enable radio */ +static int iwl4965_param_antenna; /* def: 0 = both antennas (use diversity) */ +int iwl4965_param_hwcrypto; /* def: using software encryption */ static int iwl4965_param_qos_enable = 1; int iwl4965_param_queues_num = IWL_MAX_NUM_QUEUES; @@ -395,11 +385,7 @@ void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *t const u8 iwl4965_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /*************** STATION TABLE MANAGEMENT **** - * - * NOTE: This needs to be overhauled to better synchronize between - * how the iwl-4965.c is using iwl4965_hw_find_station vs. iwl-3945.c - * - * mac80211 should also be examined to determine if sta_info is duplicating + * mac80211 should be examined to determine if sta_info is duplicating * the functionality provided here */ @@ -482,8 +468,8 @@ u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, int is_a } - /* These two conditions has the same outcome but keep them separate - since they have different meaning */ + /* These two conditions have the same outcome, but keep them separate + since they have different meanings */ if (unlikely(index == IWL_INVALID_STATION)) { spin_unlock_irqrestore(&priv->sta_lock, flags_spin); return index; @@ -843,8 +829,8 @@ int iwl4965_send_statistics_request(struct iwl4965_priv *priv) * iwl4965_rxon_add_station - add station into station table. * * there is only one AP station with id= IWL_AP_ID - * NOTE: mutex must be held before calling the this fnction -*/ + * NOTE: mutex must be held before calling this fnction + */ static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) { @@ -866,7 +852,8 @@ static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, * NOTE: Does not commit to the hardware; it sets appropriate bit fields * in the staging RXON flag structure based on the phymode */ -static int iwl4965_set_rxon_channel(struct iwl4965_priv *priv, u8 phymode, u16 channel) +static int iwl4965_set_rxon_channel(struct iwl4965_priv *priv, u8 phymode, + u16 channel) { if (!iwl4965_get_channel_info(priv, phymode, channel)) { IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", @@ -965,12 +952,12 @@ static int iwl4965_check_rxon_cmd(struct iwl4965_rxon_cmd *rxon) } /** - * iwl4965_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit + * iwl4965_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed * @priv: staging_rxon is compared to active_rxon * - * If the RXON structure is changing sufficient to require a new - * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1 - * to indicate a new tune is required. + * If the RXON structure is changing enough to require a new tune, + * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that + * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. */ static int iwl4965_full_rxon_required(struct iwl4965_priv *priv) { @@ -1267,7 +1254,7 @@ static int iwl4965_card_state_sync_callback(struct iwl4965_priv *priv, /* * CARD_STATE_CMD * - * Use: Sets the internal card state to enable, disable, or halt + * Use: Sets the device's internal card state to enable, disable, or halt * * When in the 'enable' state the card operates as normal. * When in the 'disable' state, the card enters into a low power mode. @@ -1643,14 +1630,12 @@ done: /** * iwl4965_report_frame - dump frame to syslog during debug sessions * - * hack this function to show different aspects of received frames, + * You may hack this function to show different aspects of received frames, * including selective frame dumps. * group100 parameter selects whether to show 1 out of 100 good frames. * - * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type - * info output is okay, but some of this stuff (e.g. iwl4965_rx_frame_stats) - * is 3945-specific and gives bad output for 4965. Need to split the - * functionality, keep common stuff here. + * TODO: This was originally written for 3945, need to audit for + * proper operation with 4965. */ void iwl4965_report_frame(struct iwl4965_priv *priv, struct iwl4965_rx_packet *pkt, @@ -2742,7 +2727,8 @@ static void iwl4965_build_tx_cmd_basic(struct iwl4965_priv *priv, cmd->cmd.tx.next_frame_len = 0; } -static int iwl4965_get_sta_id(struct iwl4965_priv *priv, struct ieee80211_hdr *hdr) +static int iwl4965_get_sta_id(struct iwl4965_priv *priv, + struct ieee80211_hdr *hdr) { int sta_id; u16 fc = le16_to_cpu(hdr->frame_control); @@ -4104,13 +4090,10 @@ static void iwl4965_setup_rx_handlers(struct iwl4965_priv *priv) iwl4965_rx_pm_debug_statistics_notif; priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif; - /* NOTE: iwl4965_rx_statistics is different based on whether - * the build is for the 3945 or the 4965. See the - * corresponding implementation in iwl-XXXX.c - * - * The same handler is used for both the REPLY to a - * discrete statistics request from the host as well as - * for the periodic statistics notification from the uCode + /* + * The same handler is used for both the REPLY to a discrete + * statistics request from the host as well as for the periodic + * statistics notifications (after received beacons) from the uCode. */ priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl4965_hw_rx_statistics; priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl4965_hw_rx_statistics; @@ -4124,7 +4107,7 @@ static void iwl4965_setup_rx_handlers(struct iwl4965_priv *priv) priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl4965_rx_card_state_notif; priv->rx_handlers[REPLY_TX] = iwl4965_rx_reply_tx; - /* Setup hardware specific Rx handlers */ + /* Set up hardware specific Rx handlers */ iwl4965_hw_rx_handler_setup(priv); } @@ -4178,9 +4161,11 @@ static void iwl4965_tx_cmd_complete(struct iwl4965_priv *priv, /* * Rx theory of operation * - * The host allocates 32 DMA target addresses and passes the host address - * to the firmware at register IWL_RFDS_TABLE_LOWER + N * RFD_SIZE where N is - * 0 to 31 + * Driver allocates a circular buffer of Receive Buffer Descriptors (RBDs), + * each of which point to Receive Buffers to be filled by 4965. These get + * used not only for Rx frames, but for any command response or notification + * from the 4965. The driver and 4965 manage the Rx buffers by means + * of indexes into the circular buffer. * * Rx Queue Indexes * The host/firmware share two index registers for managing the Rx buffers. @@ -4196,10 +4181,10 @@ static void iwl4965_tx_cmd_complete(struct iwl4965_priv *priv, * The queue is empty (no good data) if WRITE = READ - 1, and is full if * WRITE = READ. * - * During initialization the host sets up the READ queue position to the first + * During initialization, the host sets up the READ queue position to the first * INDEX position, and WRITE to the last (READ - 1 wrapped) * - * When the firmware places a packet in a buffer it will advance the READ index + * When the firmware places a packet in a buffer, it will advance the READ index * and fire the RX interrupt. The driver can then query the READ index and * process as many packets as possible, moving the WRITE index forward as it * resets the Rx queue buffers with new memory. @@ -4221,16 +4206,16 @@ static void iwl4965_tx_cmd_complete(struct iwl4965_priv *priv, * * Driver sequence: * - * iwl4965_rx_queue_alloc() Allocates rx_free - * iwl4965_rx_replenish() Replenishes rx_free list from rx_used, and calls + * iwl4965_rx_queue_alloc() Allocates rx_free + * iwl4965_rx_replenish() Replenishes rx_free list from rx_used, and calls * iwl4965_rx_queue_restock - * iwl4965_rx_queue_restock() Moves available buffers from rx_free into Rx + * iwl4965_rx_queue_restock() Moves available buffers from rx_free into Rx * queue, updates firmware pointers, and updates * the WRITE index. If insufficient rx_free buffers * are available, schedules iwl4965_rx_replenish * * -- enable interrupts -- - * ISR - iwl4965_rx() Detach iwl4965_rx_mem_buffers from pool up to the + * ISR - iwl4965_rx() Detach iwl4965_rx_mem_buffers from pool up to the * READ INDEX, detaching the SKB from the pool. * Moves the packet buffer from queue to rx_used. * Calls iwl4965_rx_queue_restock to refill any empty @@ -4256,12 +4241,6 @@ static int iwl4965_rx_queue_space(const struct iwl4965_rx_queue *q) /** * iwl4965_rx_queue_update_write_ptr - Update the write pointer for the RX queue - * - * NOTE: This function has 3945 and 4965 specific code sections - * but is declared in base due to the majority of the - * implementation being the same (only a numeric constant is - * different) - * */ int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_rx_queue *q) { @@ -4302,9 +4281,7 @@ int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_ } /** - * iwl4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer. - * - * NOTE: This function has 3945 and 4965 specific code paths in it. + * iwl4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr */ static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl4965_priv *priv, dma_addr_t dma_addr) @@ -4316,9 +4293,9 @@ static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl4965_priv *priv, /** * iwl4965_rx_queue_restock - refill RX queue from pre-allocated pool * - * If there are slots in the RX queue that need to be restocked, + * If there are slots in the RX queue that need to be restocked, * and we have free pre-allocated buffers, fill the ranks as much - * as we can pulling from rx_free. + * as we can, pulling from rx_free. * * This moves the 'write' index forward to catch up with 'processed', and * also updates the memory address in the firmware to reference the new @@ -4410,7 +4387,7 @@ void iwl4965_rx_replenish(void *data) } /* Assumes that the skb field of the buffers in 'pool' is kept accurate. - * If an SKB has been detached, the POOL needs to have it's SKB set to NULL + * If an SKB has been detached, the POOL needs to have its SKB set to NULL * This free routine walks the list of POOL entries and if SKB is set to * non NULL it is unmapped and freed */ @@ -4562,7 +4539,7 @@ int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm) } /** - * iwl4965_rx_handle - Main entry function for receiving responses from the uCode + * iwl4965_rx_handle - Main entry function for receiving responses from uCode * * Uses the priv->rx_handlers callback function array to invoke * the appropriate handlers, including command responses, @@ -4587,7 +4564,7 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) while (i != r) { rxb = rxq->queue[i]; - /* If an RXB doesn't have a queue slot associated with it + /* If an RXB doesn't have a Rx queue slot associated with it, * then a bug has been introduced in the queue refilling * routines -- catch it here */ BUG_ON(rxb == NULL); @@ -4629,8 +4606,8 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) } if (reclaim) { - /* Invoke any callbacks, transfer the skb to caller, - * and fire off the (possibly) blocking iwl4965_send_cmd() + /* Invoke any callbacks, transfer the skb to caller, and + * fire off the (possibly) blocking iwl4965_send_cmd() * as we reclaim the driver command queue */ if (rxb && rxb->skb) iwl4965_tx_cmd_complete(priv, rxb); @@ -4996,7 +4973,8 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) #ifdef CONFIG_IWL4965_DEBUG if (iwl4965_debug_level & IWL_DL_ISR) { - inta_mask = iwl4965_read32(priv, CSR_INT_MASK); /* just for debug */ + /* just for debug */ + inta_mask = iwl4965_read32(priv, CSR_INT_MASK); IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); } @@ -5041,7 +5019,7 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) /* Safely ignore these bits for debug checks below */ inta &= ~(CSR_INT_BIT_MAC_CLK_ACTV | CSR_INT_BIT_ALIVE); - /* HW RF KILL switch toggled (4965 only) */ + /* HW RF KILL switch toggled */ if (inta & CSR_INT_BIT_RF_KILL) { int hw_rf_kill = 0; if (!(iwl4965_read32(priv, CSR_GP_CNTRL) & @@ -5064,7 +5042,7 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) handled |= CSR_INT_BIT_RF_KILL; } - /* Chip got too hot and stopped itself (4965 only) */ + /* Chip got too hot and stopped itself */ if (inta & CSR_INT_BIT_CT_KILL) { IWL_ERROR("Microcode CT kill error detected.\n"); handled |= CSR_INT_BIT_CT_KILL; @@ -5219,11 +5197,11 @@ static const u8 iwl4965_eeprom_band_1[14] = { }; /* 5.2 GHz bands */ -static const u8 iwl4965_eeprom_band_2[] = { +static const u8 iwl4965_eeprom_band_2[] = { /* 4915-5080MHz */ 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 }; -static const u8 iwl4965_eeprom_band_3[] = { /* 5205-5320MHz */ +static const u8 iwl4965_eeprom_band_3[] = { /* 5170-5320MHz */ 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 }; @@ -5243,7 +5221,8 @@ static u8 iwl4965_eeprom_band_7[] = { /* 5.2 FAT channel */ 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 }; -static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, int band, +static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, + int band, int *eeprom_ch_count, const struct iwl4965_eeprom_channel **eeprom_ch_info, @@ -5255,7 +5234,7 @@ static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, int ban *eeprom_ch_info = priv->eeprom.band_1_channels; *eeprom_ch_index = iwl4965_eeprom_band_1; break; - case 2: /* 5.2GHz band */ + case 2: /* 4.9GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_2); *eeprom_ch_info = priv->eeprom.band_2_channels; *eeprom_ch_index = iwl4965_eeprom_band_2; @@ -5265,22 +5244,22 @@ static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, int ban *eeprom_ch_info = priv->eeprom.band_3_channels; *eeprom_ch_index = iwl4965_eeprom_band_3; break; - case 4: /* 5.2GHz band */ + case 4: /* 5.5GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_4); *eeprom_ch_info = priv->eeprom.band_4_channels; *eeprom_ch_index = iwl4965_eeprom_band_4; break; - case 5: /* 5.2GHz band */ + case 5: /* 5.7GHz band */ *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_5); *eeprom_ch_info = priv->eeprom.band_5_channels; *eeprom_ch_index = iwl4965_eeprom_band_5; break; - case 6: + case 6: /* 2.4GHz FAT channels */ *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_6); *eeprom_ch_info = priv->eeprom.band_24_channels; *eeprom_ch_index = iwl4965_eeprom_band_6; break; - case 7: + case 7: /* 5 GHz FAT channels */ *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_7); *eeprom_ch_info = priv->eeprom.band_52_channels; *eeprom_ch_index = iwl4965_eeprom_band_7; @@ -5549,7 +5528,8 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, scan_ch->channel = channels[i].chan; - ch_info = iwl4965_get_channel_info(priv, phymode, scan_ch->channel); + ch_info = iwl4965_get_channel_info(priv, phymode, + scan_ch->channel); if (!is_channel_valid(ch_info)) { IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", scan_ch->channel); @@ -5571,7 +5551,7 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, scan_ch->active_dwell = cpu_to_le16(active_dwell); scan_ch->passive_dwell = cpu_to_le16(passive_dwell); - /* Set power levels to defaults */ + /* Set txpower levels to defaults */ scan_ch->tpc.dsp_atten = 110; /* scan_pwr_info->tpc.dsp_atten; */ @@ -5581,8 +5561,8 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, else { scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); /* NOTE: if we were doing 6Mb OFDM for scans we'd use - * power level - scan_ch->tpc.tx_gain = ((1<<5) | (2 << 3)) | 3; + * power level: + * scan_ch->tpc.tx_gain = ((1<<5) | (2 << 3)) | 3; */ } @@ -5859,7 +5839,8 @@ static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv) * iwl4965_verify_inst_full - verify runtime uCode image in card vs. host, * looking at all data. */ -static int iwl4965_verify_inst_full(struct iwl4965_priv *priv, __le32 * image, u32 len) +static int iwl4965_verify_inst_full(struct iwl4965_priv *priv, __le32 * image, + u32 len) { u32 val; u32 save_len = len; @@ -5984,8 +5965,9 @@ static int iwl4965_verify_ucode(struct iwl4965_priv *priv) IWL_ERROR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); - /* Show first several data entries in instruction SRAM. - * Selection of bootstrap image is arbitrary. */ + /* Since nothing seems to match, show first several data entries in + * instruction SRAM, so maybe visual inspection will give a clue. + * Selection of bootstrap image (vs. other images) is arbitrary. */ image = (__le32 *)priv->ucode_boot.v_addr; len = priv->ucode_boot.len; rc = iwl4965_verify_inst_full(priv, image, len); @@ -6077,7 +6059,7 @@ static int iwl4965_load_bsm(struct iwl4965_priv *priv) return -EINVAL; /* Tell bootstrap uCode where to find the "Initialize" uCode - * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965. + * in host DRAM ... host DRAM physical address bits 35:4 for 4965. * NOTE: iwl4965_initialize_alive_start() will replace these values, * after the "initialize" uCode has run, to point to * runtime/protocol instructions and backup data cache. */ @@ -6487,7 +6469,7 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv) goto restart; } - /* After the ALIVE response, we can process host commands */ + /* After the ALIVE response, we can send host commands to 4965 uCode */ set_bit(STATUS_ALIVE, &priv->status); /* Clear out the uCode error bit if it is set */ @@ -6544,7 +6526,7 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv) memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); } - /* Configure BT coexistence */ + /* Configure Bluetooth device coexistence support */ iwl4965_send_bt_config(priv); /* Configure the adapter for unassociated operation */ @@ -6624,7 +6606,8 @@ static void __iwl4965_down(struct iwl4965_priv *priv) STATUS_FW_ERROR; spin_lock_irqsave(&priv->lock, flags); - iwl4965_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); + iwl4965_clear_bit(priv, CSR_GP_CNTRL, + CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); spin_unlock_irqrestore(&priv->lock, flags); iwl4965_hw_txq_ctx_stop(priv); @@ -6744,7 +6727,7 @@ static int __iwl4965_up(struct iwl4965_priv *priv) /* start card; "initialize" will load runtime ucode */ iwl4965_nic_start(priv); - /* MAC Address location in EEPROM same for 3945/4965 */ + /* MAC Address location in EEPROM is same for 3945/4965 */ get_eeprom_mac(priv, priv->mac_addr); IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); -- cgit v1.2.3-70-g09d2 From 8b6eaea8ec79b111a18a1c60333deb16ba27e6b3 Mon Sep 17 00:00:00 2001 From: "Cahill, Ben M" Date: Thu, 29 Nov 2007 11:09:54 +0800 Subject: iwlwifi: add comments, mostly on Tx queues Add comments, mostly on Tx queues Signed-off-by: Cahill, Ben M Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965.c | 252 ++++++++++++++++++++++++---- drivers/net/wireless/iwlwifi/iwl4965-base.c | 18 +- 2 files changed, 231 insertions(+), 39 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index d44166a599f..40c795eaaba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -144,7 +144,7 @@ int iwl4965_hw_rxq_stop(struct iwl4965_priv *priv) return rc; } - /* stop HW */ + /* stop Rx DMA */ iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); rc = iwl4965_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, (1 << 24), 1000); @@ -234,17 +234,22 @@ static int iwl4965_rx_init(struct iwl4965_priv *priv, struct iwl4965_rx_queue *r return rc; } - /* stop HW */ + /* Stop Rx DMA */ iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); + /* Reset driver's Rx queue write index */ iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); + + /* Tell device where to find RBD circular buffer in DRAM */ iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, rxq->dma_addr >> 8); + /* Tell device where in DRAM to update its Rx status */ iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, (priv->hw_setting.shared_phys + offsetof(struct iwl4965_shared, val0)) >> 4); + /* Enable Rx DMA, enable host interrupt, Rx buffer size 4k, 256 RBDs */ iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | @@ -263,6 +268,7 @@ static int iwl4965_rx_init(struct iwl4965_priv *priv, struct iwl4965_rx_queue *r return 0; } +/* Tell 4965 where to find the "keep warm" buffer */ static int iwl4965_kw_init(struct iwl4965_priv *priv) { unsigned long flags; @@ -297,6 +303,11 @@ static int iwl4965_kw_alloc(struct iwl4965_priv *priv) #define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ ? # x " " : "") +/** + * iwl4965_set_fat_chan_info - Copy fat channel info into driver's priv. + * + * Does not set up a command, or touch hardware. + */ int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode, u16 channel, const struct iwl4965_eeprom_channel *eeprom_ch, u8 fat_extension_channel) @@ -337,6 +348,9 @@ int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode, u16 channe return 0; } +/** + * iwl4965_kw_free - Free the "keep warm" buffer + */ static void iwl4965_kw_free(struct iwl4965_priv *priv) { struct pci_dev *dev = priv->pci_dev; @@ -363,9 +377,10 @@ static int iwl4965_txq_ctx_reset(struct iwl4965_priv *priv) iwl4965_kw_free(priv); + /* Free all tx/cmd queues and keep-warm buffer */ iwl4965_hw_txq_ctx_free(priv); - /* Tx CMD queue */ + /* Alloc keep-warm buffer */ rc = iwl4965_kw_alloc(priv); if (rc) { IWL_ERROR("Keep Warm allocation failed"); @@ -381,17 +396,20 @@ static int iwl4965_txq_ctx_reset(struct iwl4965_priv *priv) goto error_reset; } + /* Turn off all Tx DMA channels */ iwl4965_write_prph(priv, KDR_SCD_TXFACT, 0); iwl4965_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); + /* Tell 4965 where to find the keep-warm buffer */ rc = iwl4965_kw_init(priv); if (rc) { IWL_ERROR("kw_init failed\n"); goto error_reset; } - /* Tx queue(s) */ + /* Alloc and init all (default 16) Tx queues, + * including the command queue (#4) */ for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) { slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; @@ -545,6 +563,8 @@ int iwl4965_hw_nic_init(struct iwl4965_priv *priv) iwl4965_rx_queue_update_write_ptr(priv, rxq); spin_unlock_irqrestore(&priv->lock, flags); + + /* Allocate and init all Tx and Command queues */ rc = iwl4965_txq_ctx_reset(priv); if (rc) return rc; @@ -593,13 +613,16 @@ int iwl4965_hw_nic_stop_master(struct iwl4965_priv *priv) return rc; } +/** + * iwl4965_hw_txq_ctx_stop - Stop all Tx DMA channels, free Tx queue memory + */ void iwl4965_hw_txq_ctx_stop(struct iwl4965_priv *priv) { int txq_id; unsigned long flags; - /* reset TFD queues */ + /* Stop each Tx DMA channel, and wait for it to be idle */ for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) { spin_lock_irqsave(&priv->lock, flags); if (iwl4965_grab_nic_access(priv)) { @@ -617,6 +640,7 @@ void iwl4965_hw_txq_ctx_stop(struct iwl4965_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } + /* Deallocate memory for all Tx queues */ iwl4965_hw_txq_ctx_free(priv); } @@ -1586,16 +1610,23 @@ static void iwl4965_set_wr_ptrs(struct iwl4965_priv *priv, int txq_id, u32 index iwl4965_write_prph(priv, KDR_SCD_QUEUE_RDPTR(txq_id), index); } -/* - * Acquire priv->lock before calling this function ! +/** + * iwl4965_tx_queue_set_status - (optionally) start Tx/Cmd queue + * @tx_fifo_id: Tx DMA/FIFO channel (range 0-7) that the queue will feed + * @scd_retry: (1) Indicates queue will be used in aggregation mode + * + * NOTE: Acquire priv->lock before calling this function ! */ static void iwl4965_tx_queue_set_status(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq, int tx_fifo_id, int scd_retry) { int txq_id = txq->q.id; + + /* Find out whether to activate Tx queue */ int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0; + /* Set up and activate */ iwl4965_write_prph(priv, KDR_SCD_QUEUE_STATUS_BITS(txq_id), (active << SCD_QUEUE_STTS_REG_POS_ACTIVE) | (tx_fifo_id << SCD_QUEUE_STTS_REG_POS_TXF) | @@ -1606,7 +1637,7 @@ static void iwl4965_tx_queue_set_status(struct iwl4965_priv *priv, txq->sched_retry = scd_retry; IWL_DEBUG_INFO("%s %s Queue %d on AC %d\n", - active ? "Activete" : "Deactivate", + active ? "Activate" : "Deactivate", scd_retry ? "BA" : "AC", txq_id, tx_fifo_id); } @@ -1654,6 +1685,7 @@ int iwl4965_alive_notify(struct iwl4965_priv *priv) return rc; } + /* Clear 4965's internal Tx Scheduler data base */ priv->scd_base_addr = iwl4965_read_prph(priv, KDR_SCD_SRAM_BASE_ADDR); a = priv->scd_base_addr + SCD_CONTEXT_DATA_OFFSET; for (; a < priv->scd_base_addr + SCD_TX_STTS_BITMAP_OFFSET; a += 4) @@ -1663,20 +1695,29 @@ int iwl4965_alive_notify(struct iwl4965_priv *priv) for (; a < sizeof(u16) * priv->hw_setting.max_txq_num; a += 4) iwl4965_write_targ_mem(priv, a, 0); + /* Tel 4965 where to find Tx byte count tables */ iwl4965_write_prph(priv, KDR_SCD_DRAM_BASE_ADDR, (priv->hw_setting.shared_phys + offsetof(struct iwl4965_shared, queues_byte_cnt_tbls)) >> 10); + + /* Disable chain mode for all queues */ iwl4965_write_prph(priv, KDR_SCD_QUEUECHAIN_SEL, 0); - /* initiate the queues */ + /* Initialize each Tx queue (including the command queue) */ for (i = 0; i < priv->hw_setting.max_txq_num; i++) { + + /* TFD circular buffer read/write indexes */ iwl4965_write_prph(priv, KDR_SCD_QUEUE_RDPTR(i), 0); iwl4965_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); + + /* Max Tx Window size for Scheduler-ACK mode */ iwl4965_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(i), (SCD_WIN_SIZE << SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); + + /* Frame limit */ iwl4965_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(i) + sizeof(u32), @@ -1688,11 +1729,13 @@ int iwl4965_alive_notify(struct iwl4965_priv *priv) iwl4965_write_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << priv->hw_setting.max_txq_num) - 1); + /* Activate all Tx DMA/FIFO channels */ iwl4965_write_prph(priv, KDR_SCD_TXFACT, SCD_TXFACT_REG_TXFIFO_MASK(0, 7)); iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); - /* map qos queues to fifos one-to-one */ + + /* Map each Tx/cmd queue to its corresponding fifo */ for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) { int ac = default_queue_to_tx_fifo[i]; iwl4965_txq_ctx_activate(priv, i); @@ -1705,8 +1748,14 @@ int iwl4965_alive_notify(struct iwl4965_priv *priv) return 0; } +/** + * iwl4965_hw_set_hw_setting + * + * Called when initializing driver + */ int iwl4965_hw_set_hw_setting(struct iwl4965_priv *priv) { + /* Allocate area for Tx byte count tables and Rx queue status */ priv->hw_setting.shared_virt = pci_alloc_consistent(priv->pci_dev, sizeof(struct iwl4965_shared), @@ -1741,13 +1790,15 @@ void iwl4965_hw_txq_ctx_free(struct iwl4965_priv *priv) for (txq_id = 0; txq_id < priv->hw_setting.max_txq_num; txq_id++) iwl4965_tx_queue_free(priv, &priv->txq[txq_id]); + /* Keep-warm buffer */ iwl4965_kw_free(priv); } /** - * iwl4965_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] + * iwl4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] * - * Does NOT advance any indexes + * Does NOT advance any TFD circular buffer read/write indexes + * Does NOT free the TFD itself (which is within circular buffer) */ int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq) { @@ -1758,12 +1809,11 @@ int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue * int counter = 0; int index, is_odd; - /* classify bd */ + /* Host command buffers stay mapped in memory, nothing to clean */ if (txq->q.id == IWL_CMD_QUEUE_NUM) - /* nothing to cleanup after for host commands */ return 0; - /* sanity check */ + /* Sanity check on number of chunks */ counter = IWL_GET_BITS(*bd, num_tbs); if (counter > MAX_NUM_OF_TBS) { IWL_ERROR("Too many chunks: %i\n", counter); @@ -1771,8 +1821,8 @@ int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue * return 0; } - /* unmap chunks if any */ - + /* Unmap chunks, if any. + * TFD info for odd chunks is different format than for even chunks. */ for (i = 0; i < counter; i++) { index = i / 2; is_odd = i & 0x1; @@ -1792,6 +1842,7 @@ int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue * IWL_GET_BITS(bd->pa[index], tb1_len), PCI_DMA_TODEVICE); + /* Free SKB, if any, for this chunk */ if (txq->txb[txq->q.read_ptr].skb[i]) { struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[i]; @@ -1826,6 +1877,17 @@ static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) return 1; } +/** + * iwl4965_get_voltage_compensation - Power supply voltage comp for txpower + * + * Determines power supply voltage compensation for txpower calculations. + * Returns number of 1/2-dB steps to subtract from gain table index, + * to compensate for difference between power supply voltage during + * factory measurements, vs. current power supply voltage. + * + * Voltage indication is higher for lower voltage. + * Lower voltage requires more gain (lower gain table index). + */ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage, s32 current_voltage) { @@ -1913,6 +1975,14 @@ static s32 iwl4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2) } } +/** + * iwl4965_interpolate_chan - Interpolate factory measurements for one channel + * + * Interpolates factory measurements from the two sample channels within a + * sub-band, to apply to channel of interest. Interpolation is proportional to + * differences in channel frequencies, which is proportional to differences + * in channel number. + */ static int iwl4965_interpolate_chan(struct iwl4965_priv *priv, u32 channel, struct iwl4965_eeprom_calib_ch_info *chan_info) { @@ -2681,6 +2751,13 @@ unsigned int iwl4965_hw_get_beacon_cmd(struct iwl4965_priv *priv, return (sizeof(*tx_beacon_cmd) + frame_size); } +/* + * Tell 4965 where to find circular buffer of Tx Frame Descriptors for + * given Tx queue, and enable the DMA channel used for that queue. + * + * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA + * channels supported in hardware. + */ int iwl4965_hw_tx_queue_init(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq) { int rc; @@ -2694,8 +2771,11 @@ int iwl4965_hw_tx_queue_init(struct iwl4965_priv *priv, struct iwl4965_tx_queue return rc; } + /* Circular buffer (TFD queue in DRAM) physical base address */ iwl4965_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), txq->q.dma_addr >> 8); + + /* Enable DMA channel, using same id as for TFD queue */ iwl4965_write_direct32( priv, IWL_FH_TCSR_CHNL_TX_CONFIG_REG(txq_id), IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | @@ -2718,6 +2798,7 @@ int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl4965_priv *priv, void *ptr, struct iwl4965_tfd_frame *tfd = ptr; u32 num_tbs = IWL_GET_BITS(*tfd, num_tbs); + /* Each TFD can point to a maximum 20 Tx buffers */ if ((num_tbs >= MAX_NUM_OF_TBS) || (num_tbs < 0)) { IWL_ERROR("Error can not send more than %d chunks\n", MAX_NUM_OF_TBS); @@ -2759,6 +2840,9 @@ static void iwl4965_hw_card_show_info(struct iwl4965_priv *priv) #define IWL_TX_CRC_SIZE 4 #define IWL_TX_DELIMITER_SIZE 4 +/** + * iwl4965_tx_queue_update_wr_ptr - Set up entry in Tx byte-count array + */ int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq, u16 byte_cnt) { @@ -2771,9 +2855,11 @@ int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv, len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; + /* Set up byte count within first 256 entries */ IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. tfd_offset[txq->q.write_ptr], byte_cnt, len); + /* If within first 64 entries, duplicate at end */ if (txq->q.write_ptr < IWL4965_MAX_WIN_SIZE) IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. tfd_offset[IWL4965_QUEUE_SIZE + txq->q.write_ptr], @@ -2782,8 +2868,12 @@ int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv, return 0; } -/* Set up Rx receiver/antenna/chain usage in "staging" RXON image. - * This should not be used for scan command ... it puts data in wrong place. */ +/** + * iwl4965_set_rxon_chain - Set up Rx chain usage in "staging" RXON image + * + * Selects how many and which Rx receivers/antennas/chains to use. + * This should not be used for scan command ... it puts data in wrong place. + */ void iwl4965_set_rxon_chain(struct iwl4965_priv *priv) { u8 is_single = is_single_stream(priv); @@ -2931,6 +3021,9 @@ enum HT_STATUS { BA_STATUS_ACTIVE, }; +/** + * iwl4964_tl_ba_avail - Find out if an unused aggregation queue is available + */ static u8 iwl4964_tl_ba_avail(struct iwl4965_priv *priv) { int i; @@ -2939,6 +3032,8 @@ static u8 iwl4964_tl_ba_avail(struct iwl4965_priv *priv) u16 msk; lq = (struct iwl4965_lq_mngr *)&(priv->lq_mngr); + + /* Find out how many agg queues are in use */ for (i = 0; i < TID_MAX_LOAD_COUNT ; i++) { msk = 1 << i; if ((lq->agg_ctrl.granted_ba & msk) || @@ -3080,6 +3175,9 @@ void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid) } } +/** + * iwl4965_ba_status - Update driver's link quality mgr with tid's HT status + */ static void iwl4965_ba_status(struct iwl4965_priv *priv, u8 tid, enum HT_STATUS status) { @@ -3301,11 +3399,12 @@ int iwl4965_get_temperature(const struct iwl4965_priv *priv) } /* - * Temperature is only 23 bits so sign extend out to 32 + * Temperature is only 23 bits, so sign extend out to 32. * * NOTE If we haven't received a statistics notification yet * with an updated temperature, use R4 provided to us in the - * ALIVE response. */ + * "initialize" ALIVE response. + */ if (!test_bit(STATUS_TEMPERATURE, &priv->status)) vt = sign_extend(R4, 23); else @@ -4001,6 +4100,11 @@ static void iwl4965_rx_missed_beacon_notif(struct iwl4965_priv *priv, #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG +/** + * iwl4965_set_tx_status - Update driver's record of one Tx frame's status + * + * This will get sent to mac80211. + */ static void iwl4965_set_tx_status(struct iwl4965_priv *priv, int txq_id, int idx, u32 status, u32 retry_count, u32 rate) { @@ -4013,11 +4117,15 @@ static void iwl4965_set_tx_status(struct iwl4965_priv *priv, int txq_id, int idx } +/** + * iwl4965_sta_modify_enable_tid_tx - Enable Tx for this TID in station table + */ static void iwl4965_sta_modify_enable_tid_tx(struct iwl4965_priv *priv, int sta_id, int tid) { unsigned long flags; + /* Remove "disable" flag, to enable Tx for this TID */ spin_lock_irqsave(&priv->sta_lock, flags); priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX; priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); @@ -4028,6 +4136,12 @@ static void iwl4965_sta_modify_enable_tid_tx(struct iwl4965_priv *priv, } +/** + * iwl4965_tx_status_reply_compressed_ba - Update tx status from block-ack + * + * Go through block-ack's bitmap of ACK'd frames, update driver's record of + * ACK vs. not. This gets sent to mac80211, then to rate scaling algo. + */ static int iwl4965_tx_status_reply_compressed_ba(struct iwl4965_priv *priv, struct iwl4965_ht_agg *agg, struct iwl4965_compressed_ba_resp* @@ -4044,13 +4158,17 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl4965_priv *priv, IWL_ERROR("Received BA when not expected\n"); return -EINVAL; } + + /* Mark that the expected block-ack response arrived */ agg->wait_for_ba = 0; IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->ba_seq_ctl); + + /* Calculate shift to align block-ack bits with our Tx window bits */ sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl>>4); if (sh < 0) /* tbw something is wrong with indices */ sh += 0x100; - /* don't use 64 bits for now */ + /* don't use 64-bit values for now */ bitmap0 = resp_bitmap0 >> sh; bitmap1 = resp_bitmap1 >> sh; bitmap0 |= (resp_bitmap1 & ((1<bitmap0; bitmap1 &= agg->bitmap1; + /* For each frame attempted in aggregation, + * update driver's record of tx frame's status. */ for (i = 0; i < agg->frame_count ; i++) { int idx = (agg->start_idx + i) & 0xff; ack = bitmap0 & (1 << i); @@ -4080,11 +4200,22 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl4965_priv *priv, return 0; } +/** + * iwl4965_queue_dec_wrap - Decrement queue index, wrap back to end if needed + * @index -- current index + * @n_bd -- total number of entries in queue (s/b power of 2) + */ static inline int iwl4965_queue_dec_wrap(int index, int n_bd) { return (index == 0) ? n_bd - 1 : index - 1; } +/** + * iwl4965_rx_reply_compressed_ba - Handler for REPLY_COMPRESSED_BA + * + * Handles block-acknowledge notification from device, which reports success + * of frames sent via aggregation. + */ static void iwl4965_rx_reply_compressed_ba(struct iwl4965_priv *priv, struct iwl4965_rx_mem_buffer *rxb) { @@ -4093,7 +4224,12 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl4965_priv *priv, int index; struct iwl4965_tx_queue *txq = NULL; struct iwl4965_ht_agg *agg; + + /* "flow" corresponds to Tx queue */ u16 ba_resp_scd_flow = le16_to_cpu(ba_resp->scd_flow); + + /* "ssn" is start of block-ack Tx window, corresponds to index + * (in Tx queue's circular buffer) of first TFD/frame in window */ u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); if (ba_resp_scd_flow >= ARRAY_SIZE(priv->txq)) { @@ -4103,6 +4239,8 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl4965_priv *priv, txq = &priv->txq[ba_resp_scd_flow]; agg = &priv->stations[ba_resp->sta_id].tid[ba_resp->tid].agg; + + /* Find index just before block-ack window */ index = iwl4965_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); /* TODO: Need to get this copy more safely - now good for debug */ @@ -4128,22 +4266,35 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl4965_priv *priv, agg->bitmap0); } */ + + /* Update driver's record of ACK vs. not for each frame in window */ iwl4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); - /* releases all the TFDs until the SSN */ + + /* Release all TFDs before the SSN, i.e. all TFDs in front of + * block-ack window (we assume that they've been successfully + * transmitted ... if not, it's too late anyway). */ if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) iwl4965_tx_queue_reclaim(priv, ba_resp_scd_flow, index); } +/** + * iwl4965_tx_queue_stop_scheduler - Stop queue, but keep configuration + */ static void iwl4965_tx_queue_stop_scheduler(struct iwl4965_priv *priv, u16 txq_id) { + /* Simply stop the queue, but don't change any configuration; + * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ iwl4965_write_prph(priv, KDR_SCD_QUEUE_STATUS_BITS(txq_id), (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)| (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); } +/** + * iwl4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue + */ static int iwl4965_tx_queue_set_q2ratid(struct iwl4965_priv *priv, u16 ra_tid, u16 txq_id) { @@ -4169,7 +4320,10 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl4965_priv *priv, u16 ra_tid, } /** - * txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID + * iwl4965_tx_queue_agg_enable - Set up & enable aggregation for selected queue + * + * NOTE: txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID, + * i.e. it must be one of the higher queues used for aggregation */ static int iwl4965_tx_queue_agg_enable(struct iwl4965_priv *priv, int txq_id, int tx_fifo, int sta_id, int tid, @@ -4185,6 +4339,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl4965_priv *priv, int txq_id, ra_tid = BUILD_RAxTID(sta_id, tid); + /* Modify device's station table to Tx this TID */ iwl4965_sta_modify_enable_tid_tx(priv, sta_id, tid); spin_lock_irqsave(&priv->lock, flags); @@ -4194,19 +4349,22 @@ static int iwl4965_tx_queue_agg_enable(struct iwl4965_priv *priv, int txq_id, return rc; } + /* Stop this Tx queue before configuring it */ iwl4965_tx_queue_stop_scheduler(priv, txq_id); + /* Map receiver-address / traffic-ID to this queue */ iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); - + /* Set this queue as a chain-building queue */ iwl4965_set_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1<txq[txq_id].q.read_ptr = (ssn_idx & 0xff); priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); - - /* supposes that ssn_idx is valid (!= 0xFFF) */ iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); + /* Set up Tx window size and frame limit for this queue */ iwl4965_write_targ_mem(priv, priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(txq_id), (SCD_WIN_SIZE << SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & @@ -4219,6 +4377,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl4965_priv *priv, int txq_id, iwl4965_set_bits_prph(priv, KDR_SCD_INTERRUPT_MASK, (1 << txq_id)); + /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); iwl4965_release_nic_access(priv); @@ -4274,14 +4433,16 @@ static int iwl4965_tx_queue_agg_disable(struct iwl4965_priv *priv, u16 txq_id, /** * iwl4965_add_station - Initialize a station's hardware rate table * - * The uCode contains a table of fallback rates and retries per rate + * The uCode's station table contains a table of fallback rates * for automatic fallback during transmission. * - * NOTE: This initializes the table for a single retry per data rate - * which is not optimal. Setting up an intelligent retry per rate - * requires feedback from transmission, which isn't exposed through - * rc80211_simple which is what this driver is currently using. + * NOTE: This sets up a default set of values. These will be replaced later + * if the driver's iwl-4965-rs rate scaling algorithm is used, instead of + * rc80211_simple. * + * NOTE: Run REPLY_ADD_STA command to set up station table entry, before + * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD, + * which requires station table entry to exist). */ void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) { @@ -4291,8 +4452,8 @@ void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) }; u16 rate_flags; - /* Set up the rate scaling to start at 54M and fallback - * all the way to 1M in IEEE order and then spin on IEEE */ + /* Set up the rate scaling to start at selected rate, fall back + * all the way down to 1M in IEEE order, and then spin on 1M */ if (is_ap) r = IWL_RATE_54M_INDEX; else if (priv->phymode == MODE_IEEE80211A) @@ -4305,8 +4466,10 @@ void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) rate_flags |= RATE_MCS_CCK_MSK; + /* Use Tx antenna B only */ rate_flags |= RATE_MCS_ANT_B_MSK; rate_flags &= ~RATE_MCS_ANT_A_MSK; + link_cmd.rs_table[i].rate_n_flags = iwl4965_hw_set_rate_n_flags(iwl4965_rates[r].plcp, rate_flags); r = iwl4965_get_prev_ieee_rate(r); @@ -4374,6 +4537,7 @@ void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct sta_ht_info *ht_info) if (!ht_info->is_ht) return; + /* Set up channel bandwidth: 20 MHz only, or 20/40 mixed if fat ok */ if (iwl4965_is_fat_tx_allowed(priv, ht_info)) rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED_MSK; else @@ -4388,7 +4552,7 @@ void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct sta_ht_info *ht_info) return; } - /* Note: control channel is oposit to extension channel */ + /* Note: control channel is opposite of extension channel */ switch (ht_info->extension_chan_offset) { case IWL_EXT_CHANNEL_OFFSET_ABOVE: rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); @@ -4514,6 +4678,12 @@ static const u16 default_tid_to_tx_fifo[] = { IWL_TX_FIFO_AC3 }; +/* + * Find first available (lowest unused) Tx Queue, mark it "active". + * Called only when finding queue for aggregation. + * Should never return anything < 7, because they should already + * be in use as EDCA AC (0-3), Command (4), HCCA (5, 6). + */ static int iwl4965_txq_ctx_activate_free(struct iwl4965_priv *priv) { int txq_id; @@ -4537,6 +4707,7 @@ int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, struct iwl4965_tid_data *tid_data; DECLARE_MAC_BUF(mac); + /* Determine Tx DMA/FIFO channel for this Traffic ID */ if (likely(tid < ARRAY_SIZE(default_tid_to_tx_fifo))) tx_fifo = default_tid_to_tx_fifo[tid]; else @@ -4545,22 +4716,31 @@ int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, IWL_WARNING("iwl-AGG iwl4965_mac_ht_tx_agg_start on da=%s" " tid=%d\n", print_mac(mac, da), tid); + /* Get index into station table */ sta_id = iwl4965_hw_find_station(priv, da); if (sta_id == IWL_INVALID_STATION) return -ENXIO; + /* Find available Tx queue for aggregation */ txq_id = iwl4965_txq_ctx_activate_free(priv); if (txq_id == -1) return -ENXIO; spin_lock_irqsave(&priv->sta_lock, flags); tid_data = &priv->stations[sta_id].tid[tid]; + + /* Get starting sequence number for 1st frame in block ack window. + * We'll use least signif byte as 1st frame's index into Tx queue. */ ssn = SEQ_TO_SN(tid_data->seq_number); tid_data->agg.txq_id = txq_id; spin_unlock_irqrestore(&priv->sta_lock, flags); *start_seq_num = ssn; + + /* Update driver's link quality manager */ iwl4965_ba_status(priv, tid, BA_STATUS_ACTIVE); + + /* Set up and enable aggregation for selected Tx queue and FIFO */ return iwl4965_tx_queue_agg_enable(priv, txq_id, tx_fifo, sta_id, tid, ssn); } diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 74c3d3917fe..66aa938e316 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -305,6 +305,9 @@ static int iwl4965_tx_queue_alloc(struct iwl4965_priv *priv, return -ENOMEM; } +/** + * iwl4965_tx_queue_init - Allocate and initialize one tx/cmd queue + */ int iwl4965_tx_queue_init(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq, int slots_num, u32 txq_id) { @@ -312,9 +315,14 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv, int len; int rc = 0; - /* allocate command space + one big command for scan since scan - * command is very huge the system will not have two scan at the - * same time */ + /* + * Alloc buffer array for commands (Tx or other types of commands). + * For the command queue (#4), allocate command space + one big + * command for scan, since scan command is very huge; the system will + * not have two scans at the same time, so only one is needed. + * For normal Tx queues (all other queues), no super-size command + * space is needed. + */ len = sizeof(struct iwl4965_cmd) * slots_num; if (txq_id == IWL_CMD_QUEUE_NUM) len += IWL_MAX_SCAN_SIZE; @@ -322,6 +330,7 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv, if (!txq->cmd) return -ENOMEM; + /* Alloc driver data array and TFD circular buffer */ rc = iwl4965_tx_queue_alloc(priv, txq, txq_id); if (rc) { pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); @@ -333,8 +342,11 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv, /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise * iwl4965_queue_inc_wrap and iwl4965_queue_dec_wrap are broken. */ BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); + + /* Initialize queue's high/low-water marks, and head/tail indexes */ iwl4965_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); + /* Tell device where to find queue */ iwl4965_hw_tx_queue_init(priv, txq); return 0; -- cgit v1.2.3-70-g09d2 From 6440adb5760a897497c2b1ebdccc32c7944fd57f Mon Sep 17 00:00:00 2001 From: "Cahill, Ben M" Date: Thu, 29 Nov 2007 11:09:55 +0800 Subject: iwlwifi: add comments to iwl*-base.c Add comments to iwlXXXX-base.c Signed-off-by: Cahill, Ben M Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 215 +++++++++++++++++++++++----- drivers/net/wireless/iwlwifi/iwl4965-base.c | 212 ++++++++++++++++++++++----- 2 files changed, 356 insertions(+), 71 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index ba5146ffdf4..71e9b7c52d5 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -63,13 +63,13 @@ static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, ******************************************************************************/ /* module parameters */ -static int iwl3945_param_disable_hw_scan; -static int iwl3945_param_debug; -static int iwl3945_param_disable; /* def: enable radio */ +static int iwl3945_param_disable_hw_scan; /* def: 0 = use 3945's h/w scan */ +static int iwl3945_param_debug; /* def: 0 = minimal debug log messages */ +static int iwl3945_param_disable; /* def: 0 = enable radio */ static int iwl3945_param_antenna; /* def: 0 = both antennas (use diversity) */ -int iwl3945_param_hwcrypto; /* def: using software encryption */ -static int iwl3945_param_qos_enable = 1; -int iwl3945_param_queues_num = IWL_MAX_NUM_QUEUES; +int iwl3945_param_hwcrypto; /* def: 0 = use software encryption */ +static int iwl3945_param_qos_enable = 1; /* def: 1 = use quality of service */ +int iwl3945_param_queues_num = IWL_MAX_NUM_QUEUES; /* def: 8 Tx queues */ /* * module name, copyright, version, etc. @@ -184,17 +184,24 @@ static void iwl3945_print_hex_dump(int level, void *p, u32 len) * * Theory of operation * - * A queue is a circular buffers with 'Read' and 'Write' pointers. - * 2 empty entries always kept in the buffer to protect from overflow. + * A Tx or Rx queue resides in host DRAM, and is comprised of a circular buffer + * of buffer descriptors, each of which points to one or more data buffers for + * the device to read from or fill. Driver and device exchange status of each + * queue via "read" and "write" pointers. Driver keeps minimum of 2 empty + * entries in each circular buffer, to protect against confusing empty and full + * queue states. + * + * The device reads or writes the data in the queues via the device's several + * DMA/FIFO channels. Each queue is mapped to a single DMA channel. * * For Tx queue, there are low mark and high mark limits. If, after queuing * the packet for Tx, free space become < low mark, Tx queue stopped. When * reclaiming packets (on 'tx done IRQ), if free space become > high mark, * Tx queue resumed. * - * The IWL operates with six queues, one receive queue in the device's - * sram, one transmit queue for sending commands to the device firmware, - * and four transmit queues for data. + * The 3945 operates with six queues: One receive queue, one transmit queue + * (#4) for sending commands to the device firmware, and four transmit queues + * (#0-3) for data tx via EDCA. An additional 2 HCCA queues are unused. ***************************************************/ static int iwl3945_queue_space(const struct iwl3945_queue *q) @@ -213,13 +220,21 @@ static int iwl3945_queue_space(const struct iwl3945_queue *q) return s; } -/* XXX: n_bd must be power-of-two size */ +/** + * iwl3945_queue_inc_wrap - increment queue index, wrap back to beginning + * @index -- current index + * @n_bd -- total number of entries in queue (must be power of 2) + */ static inline int iwl3945_queue_inc_wrap(int index, int n_bd) { return ++index & (n_bd - 1); } -/* XXX: n_bd must be power-of-two size */ +/** + * iwl3945_queue_dec_wrap - increment queue index, wrap back to end + * @index -- current index + * @n_bd -- total number of entries in queue (must be power of 2) + */ static inline int iwl3945_queue_dec_wrap(int index, int n_bd) { return --index & (n_bd - 1); @@ -234,12 +249,17 @@ static inline int x2_queue_used(const struct iwl3945_queue *q, int i) static inline u8 get_cmd_index(struct iwl3945_queue *q, u32 index, int is_huge) { + /* This is for scan command, the big buffer at end of command array */ if (is_huge) - return q->n_window; + return q->n_window; /* must be power of 2 */ + /* Otherwise, use normal size buffers */ return index & (q->n_window - 1); } +/** + * iwl3945_queue_init - Initialize queue's high/low-water and read/write indexes + */ static int iwl3945_queue_init(struct iwl3945_priv *priv, struct iwl3945_queue *q, int count, int slots_num, u32 id) { @@ -268,11 +288,16 @@ static int iwl3945_queue_init(struct iwl3945_priv *priv, struct iwl3945_queue *q return 0; } +/** + * iwl3945_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue + */ static int iwl3945_tx_queue_alloc(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq, u32 id) { struct pci_dev *dev = priv->pci_dev; + /* Driver private data, only for Tx (not command) queues, + * not shared with device. */ if (id != IWL_CMD_QUEUE_NUM) { txq->txb = kmalloc(sizeof(txq->txb[0]) * TFD_QUEUE_SIZE_MAX, GFP_KERNEL); @@ -284,6 +309,8 @@ static int iwl3945_tx_queue_alloc(struct iwl3945_priv *priv, } else txq->txb = NULL; + /* Circular buffer of transmit frame descriptors (TFDs), + * shared with device */ txq->bd = pci_alloc_consistent(dev, sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX, &txq->q.dma_addr); @@ -306,6 +333,9 @@ static int iwl3945_tx_queue_alloc(struct iwl3945_priv *priv, return -ENOMEM; } +/** + * iwl3945_tx_queue_init - Allocate and initialize one tx/cmd queue + */ int iwl3945_tx_queue_init(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq, int slots_num, u32 txq_id) { @@ -313,9 +343,14 @@ int iwl3945_tx_queue_init(struct iwl3945_priv *priv, int len; int rc = 0; - /* allocate command space + one big command for scan since scan - * command is very huge the system will not have two scan at the - * same time */ + /* + * Alloc buffer array for commands (Tx or other types of commands). + * For the command queue (#4), allocate command space + one big + * command for scan, since scan command is very huge; the system will + * not have two scans at the same time, so only one is needed. + * For data Tx queues (all other queues), no super-size command + * space is needed. + */ len = sizeof(struct iwl3945_cmd) * slots_num; if (txq_id == IWL_CMD_QUEUE_NUM) len += IWL_MAX_SCAN_SIZE; @@ -323,6 +358,7 @@ int iwl3945_tx_queue_init(struct iwl3945_priv *priv, if (!txq->cmd) return -ENOMEM; + /* Alloc driver data array and TFD circular buffer */ rc = iwl3945_tx_queue_alloc(priv, txq, txq_id); if (rc) { pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); @@ -334,8 +370,11 @@ int iwl3945_tx_queue_init(struct iwl3945_priv *priv, /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise * iwl3945_queue_inc_wrap and iwl3945_queue_dec_wrap are broken. */ BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); + + /* Initialize queue high/low-water, head/tail indexes */ iwl3945_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); + /* Tell device where to find queue, enable DMA channel. */ iwl3945_hw_tx_queue_init(priv, txq); return 0; @@ -346,8 +385,8 @@ int iwl3945_tx_queue_init(struct iwl3945_priv *priv, * @txq: Transmit queue to deallocate. * * Empty queue by removing and destroying all BD's. - * Free all buffers. txq itself is not freed. - * + * Free all buffers. + * 0-fill, but do not free "txq" descriptor structure. */ void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq) { @@ -367,19 +406,21 @@ void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *t if (q->id == IWL_CMD_QUEUE_NUM) len += IWL_MAX_SCAN_SIZE; + /* De-alloc array of command/tx buffers */ pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); - /* free buffers belonging to queue itself */ + /* De-alloc circular buffer of TFDs */ if (txq->q.n_bd) pci_free_consistent(dev, sizeof(struct iwl3945_tfd_frame) * txq->q.n_bd, txq->bd, txq->q.dma_addr); + /* De-alloc array of per-TFD driver data */ if (txq->txb) { kfree(txq->txb); txq->txb = NULL; } - /* 0 fill whole structure */ + /* 0-fill queue descriptor structure */ memset(txq, 0, sizeof(*txq)); } @@ -392,6 +433,11 @@ const u8 iwl3945_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF /**************************************************************/ #if 0 /* temporary disable till we add real remove station */ +/** + * iwl3945_remove_station - Remove driver's knowledge of station. + * + * NOTE: This does not remove station from device's station table. + */ static u8 iwl3945_remove_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap) { int index = IWL_INVALID_STATION; @@ -428,6 +474,12 @@ out: return 0; } #endif + +/** + * iwl3945_clear_stations_table - Clear the driver's station table + * + * NOTE: This does not clear or otherwise alter the device's station table. + */ static void iwl3945_clear_stations_table(struct iwl3945_priv *priv) { unsigned long flags; @@ -440,7 +492,9 @@ static void iwl3945_clear_stations_table(struct iwl3945_priv *priv) spin_unlock_irqrestore(&priv->sta_lock, flags); } - +/** + * iwl3945_add_station - Add station to station tables in driver and device + */ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 flags) { int i; @@ -486,6 +540,7 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 station->used = 1; priv->num_stations++; + /* Set up the REPLY_ADD_STA command to send to device */ memset(&station->sta, 0, sizeof(struct iwl3945_addsta_cmd)); memcpy(station->sta.sta.addr, addr, ETH_ALEN); station->sta.mode = 0; @@ -504,6 +559,8 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 le16_to_cpu(station->sta.rate_n_flags); spin_unlock_irqrestore(&priv->sta_lock, flags_spin); + + /* Add station to device's station table */ iwl3945_send_add_station(priv, &station->sta, flags); return index; @@ -673,6 +730,8 @@ static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_c fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM); txq->need_update = 1; + + /* Increment and update queue's write index */ q->write_ptr = iwl3945_queue_inc_wrap(q->write_ptr, q->n_bd); ret = iwl3945_tx_queue_update_write_ptr(priv, txq); @@ -1511,7 +1570,7 @@ static void get_eeprom_mac(struct iwl3945_priv *priv, u8 *mac) /** * iwl3945_eeprom_init - read EEPROM contents * - * Load the EEPROM from adapter into priv->eeprom + * Load the EEPROM contents from adapter into priv->eeprom * * NOTE: This routine uses the non-debug IO access functions. */ @@ -1536,6 +1595,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv) return -ENOENT; } + /* Make sure driver (instead of uCode) is allowed to read EEPROM */ rc = iwl3945_eeprom_acquire_semaphore(priv); if (rc < 0) { IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); @@ -2631,21 +2691,23 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv, cmd->cmd.tx.next_frame_len = 0; } +/** + * iwl3945_get_sta_id - Find station's index within station table + */ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *hdr) { int sta_id; u16 fc = le16_to_cpu(hdr->frame_control); - /* If this frame is broadcast or not data then use the broadcast - * station id */ + /* If this frame is broadcast or management, use broadcast station id */ if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) || is_multicast_ether_addr(hdr->addr1)) return priv->hw_setting.bcast_sta_id; switch (priv->iw_mode) { - /* If this frame is part of a BSS network (we're a station), then - * we use the AP's station id */ + /* If we are a client station in a BSS network, use the special + * AP station entry (that's the only station we communicate with) */ case IEEE80211_IF_TYPE_STA: return IWL_AP_ID; @@ -2656,11 +2718,12 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h return sta_id; return priv->hw_setting.bcast_sta_id; - /* If this frame is part of a IBSS network, then we use the - * target specific station id */ + /* If this frame is going out to an IBSS network, find the station, + * or create a new station table entry */ case IEEE80211_IF_TYPE_IBSS: { DECLARE_MAC_BUF(mac); + /* Create new station table entry */ sta_id = iwl3945_hw_find_station(priv, hdr->addr1); if (sta_id != IWL_INVALID_STATION) return sta_id; @@ -2746,6 +2809,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, spin_unlock_irqrestore(&priv->lock, flags); hdr_len = ieee80211_get_hdrlen(fc); + + /* Find (or create) index into station table for destination station */ sta_id = iwl3945_get_sta_id(priv, hdr); if (sta_id == IWL_INVALID_STATION) { DECLARE_MAC_BUF(mac); @@ -2767,30 +2832,52 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, __constant_cpu_to_le16(IEEE80211_SCTL_FRAG)); seq_number += 0x10; } + + /* Descriptor for chosen Tx queue */ txq = &priv->txq[txq_id]; q = &txq->q; spin_lock_irqsave(&priv->lock, flags); + /* Set up first empty TFD within this queue's circular TFD buffer */ tfd = &txq->bd[q->write_ptr]; memset(tfd, 0, sizeof(*tfd)); control_flags = (u32 *) tfd; idx = get_cmd_index(q, q->write_ptr, 0); + /* Set up driver data for this TFD */ memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info)); txq->txb[q->write_ptr].skb[0] = skb; memcpy(&(txq->txb[q->write_ptr].status.control), ctl, sizeof(struct ieee80211_tx_control)); + + /* Init first empty entry in queue's array of Tx/cmd buffers */ out_cmd = &txq->cmd[idx]; memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx)); + + /* + * Set up the Tx-command (not MAC!) header. + * Store the chosen Tx queue and TFD index within the sequence field; + * after Tx, uCode's Tx response will return this value so driver can + * locate the frame within the tx queue and do post-tx processing. + */ out_cmd->hdr.cmd = REPLY_TX; out_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | INDEX_TO_SEQ(q->write_ptr))); - /* copy frags header */ + + /* Copy MAC header from skb into command buffer */ memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len); - /* hdr = (struct ieee80211_hdr *)out_cmd->cmd.tx.hdr; */ + /* + * Use the first empty entry in this queue's command buffer array + * to contain the Tx command and MAC header concatenated together + * (payload data will be in another buffer). + * Size of this varies, due to varying MAC header length. + * If end is not dword aligned, we'll have 2 extra bytes at the end + * of the MAC header (device reads on dword boundaries). + * We'll tell device about this padding later. + */ len = priv->hw_setting.tx_cmd_len + sizeof(struct iwl3945_cmd_header) + hdr_len; @@ -2802,15 +2889,20 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, else len_org = 0; + /* Physical address of this Tx command's header (not MAC header!), + * within command buffer array. */ txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl3945_cmd) * idx + offsetof(struct iwl3945_cmd, hdr); + /* Add buffer containing Tx command and MAC(!) header to TFD's + * first entry */ iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) iwl3945_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); - /* 802.11 null functions have no payload... */ + /* Set up TFD's 2nd entry to point directly to remainder of skb, + * if any (802.11 null frames have no payload). */ len = skb->len - hdr_len; if (len) { phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, @@ -2818,13 +2910,16 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len); } - /* If there is no payload, then only one TFD is used */ if (!len) + /* If there is no payload, then we use only one Tx buffer */ *control_flags = TFD_CTL_COUNT_SET(1); else + /* Else use 2 buffers. + * Tell 3945 about any padding after MAC header */ *control_flags = TFD_CTL_COUNT_SET(2) | TFD_CTL_PAD_SET(U32_PAD(len)); + /* Total # bytes to be transmitted */ len = (u16)skb->len; out_cmd->cmd.tx.len = cpu_to_le16(len); @@ -2854,6 +2949,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, iwl3945_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, ieee80211_get_hdrlen(fc)); + /* Tell device the write index *just past* this latest filled TFD */ q->write_ptr = iwl3945_queue_inc_wrap(q->write_ptr, q->n_bd); rc = iwl3945_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); @@ -3329,11 +3425,11 @@ static void iwl3945_txstatus_to_ieee(struct iwl3945_priv *priv, } /** - * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC. + * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd * - * When FW advances 'R' index, all entries between old and - * new 'R' index need to be reclaimed. As result, some free space - * forms. If there is enough free space (> low mark), wake Tx queue. + * When FW advances 'R' index, all entries between old and new 'R' index + * need to be reclaimed. As result, some free space forms. If there is + * enough free space (> low mark), wake the stack that feeds us. */ static int iwl3945_tx_queue_reclaim(struct iwl3945_priv *priv, int txq_id, int index) { @@ -3382,6 +3478,9 @@ static int iwl3945_is_tx_success(u32 status) * Generic RX handler implementations * ******************************************************************************/ +/** + * iwl3945_rx_reply_tx - Handle Tx response + */ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb) { @@ -3917,6 +4016,7 @@ int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, struct iwl3945_ if (q->need_update == 0) goto exit_unlock; + /* If power-saving is in use, make sure device is awake */ if (test_bit(STATUS_POWER_PMI, &priv->status)) { reg = iwl3945_read32(priv, CSR_UCODE_DRV_GP1); @@ -3930,10 +4030,14 @@ int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, struct iwl3945_ if (rc) goto exit_unlock; + /* Device expects a multiple of 8 */ iwl3945_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); iwl3945_release_nic_access(priv); + + /* Else device is assumed to be awake */ } else + /* Device expects a multiple of 8 */ iwl3945_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); @@ -3975,9 +4079,12 @@ static int iwl3945_rx_queue_restock(struct iwl3945_priv *priv) spin_lock_irqsave(&rxq->lock, flags); write = rxq->write & ~0x7; while ((iwl3945_rx_queue_space(rxq) > 0) && (rxq->free_count)) { + /* Get next free Rx buffer, remove from free list */ element = rxq->rx_free.next; rxb = list_entry(element, struct iwl3945_rx_mem_buffer, list); list_del(element); + + /* Point to Rx buffer via next RBD in circular buffer */ rxq->bd[rxq->write] = iwl3945_dma_addr2rbd_ptr(priv, rxb->dma_addr); rxq->queue[rxq->write] = rxb; rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; @@ -3990,7 +4097,8 @@ static int iwl3945_rx_queue_restock(struct iwl3945_priv *priv) queue_work(priv->workqueue, &priv->rx_replenish); - /* If we've added more space for the firmware to place data, tell it */ + /* If we've added more space for the firmware to place data, tell it. + * Increment device's write pointer in multiples of 8. */ if ((write != (rxq->write & ~0x7)) || (abs(rxq->write - rxq->read) > 7)) { spin_lock_irqsave(&rxq->lock, flags); @@ -4023,6 +4131,8 @@ void iwl3945_rx_replenish(void *data) while (!list_empty(&rxq->rx_used)) { element = rxq->rx_used.next; rxb = list_entry(element, struct iwl3945_rx_mem_buffer, list); + + /* Alloc a new receive buffer */ rxb->skb = alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC); if (!rxb->skb) { @@ -4036,6 +4146,8 @@ void iwl3945_rx_replenish(void *data) } priv->alloc_rxb_skb++; list_del(element); + + /* Get physical address of RB/SKB */ rxb->dma_addr = pci_map_single(priv->pci_dev, rxb->skb->data, IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); @@ -4080,12 +4192,16 @@ int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv) spin_lock_init(&rxq->lock); INIT_LIST_HEAD(&rxq->rx_free); INIT_LIST_HEAD(&rxq->rx_used); + + /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr); if (!rxq->bd) return -ENOMEM; + /* Fill the rx_used queue with _all_ of the Rx buffers */ for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) list_add_tail(&rxq->pool[i].list, &rxq->rx_used); + /* Set us so that we have processed and used all buffers, but have * not restocked the Rx queue with fresh buffers */ rxq->read = rxq->write = 0; @@ -4217,6 +4333,8 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv) int reclaim; unsigned long flags; + /* uCode's read index (stored in shared DRAM) indicates the last Rx + * buffer that the driver may process (last buffer filled by ucode). */ r = iwl3945_hw_get_rx_read(priv); i = rxq->read; @@ -4297,6 +4415,9 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv) iwl3945_rx_queue_restock(priv); } +/** + * iwl3945_tx_queue_update_write_ptr - Send new write index to hardware + */ static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq) { @@ -4926,6 +5047,11 @@ static void iwl3945_init_band_reference(const struct iwl3945_priv *priv, int ban } } +/** + * iwl3945_get_channel_info - Find driver's private channel info + * + * Based on band and channel number. + */ const struct iwl3945_channel_info *iwl3945_get_channel_info(const struct iwl3945_priv *priv, int phymode, u16 channel) { @@ -4953,6 +5079,9 @@ const struct iwl3945_channel_info *iwl3945_get_channel_info(const struct iwl3945 #define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ ? # x " " : "") +/** + * iwl3945_init_channel_map - Set up driver's info for all possible channels + */ static int iwl3945_init_channel_map(struct iwl3945_priv *priv) { int eeprom_ch_count = 0; @@ -5062,6 +5191,7 @@ static int iwl3945_init_channel_map(struct iwl3945_priv *priv) } } + /* Set up txpower settings in driver for all channels */ if (iwl3945_txpower_set_from_eeprom(priv)) return -EIO; @@ -8289,6 +8419,8 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e struct ieee80211_hw *hw; int i; + /* Disabling hardware scan means that mac80211 will perform scans + * "the hard way", rather than using device's scan. */ if (iwl3945_param_disable_hw_scan) { IWL_DEBUG_INFO("Disabling hw_scan\n"); iwl3945_hw_ops.hw_scan = NULL; @@ -8319,6 +8451,8 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e priv->hw = hw; priv->pci_dev = pdev; + + /* Select antenna (may be helpful if only one antenna is connected) */ priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna; #ifdef CONFIG_IWL3945_DEBUG iwl3945_debug_level = iwl3945_param_debug; @@ -8340,6 +8474,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e /* Tell mac80211 our Tx characteristics */ hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE; + /* 4 EDCA QOS priorities */ hw->queues = 4; spin_lock_init(&priv->lock); @@ -8360,6 +8495,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e pci_set_master(pdev); + /* Clear the driver's (not device's) station table */ iwl3945_clear_stations_table(priv); priv->data_retry_limit = -1; @@ -8379,9 +8515,11 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e err = pci_request_regions(pdev, DRV_NAME); if (err) goto out_pci_disable_device; + /* We disable the RETRY_TIMEOUT register (0x41) to keep * PCI Tx retries from interfering with C3 CPU state */ pci_write_config_byte(pdev, 0x41, 0x00); + priv->hw_base = pci_iomap(pdev, 0, 0); if (!priv->hw_base) { err = -ENODEV; @@ -8394,6 +8532,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e /* Initialize module parameter values here */ + /* Disable radio (SW RF KILL) via parameter when loading driver */ if (iwl3945_param_disable) { set_bit(STATUS_RF_KILL_SW, &priv->status); IWL_DEBUG_INFO("Radio disabled.\n"); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 66aa938e316..43ce645e4a6 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -63,13 +63,13 @@ static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv, ******************************************************************************/ /* module parameters */ -static int iwl4965_param_disable_hw_scan; -static int iwl4965_param_debug; +static int iwl4965_param_disable_hw_scan; /* def: 0 = use 4965's h/w scan */ +static int iwl4965_param_debug; /* def: 0 = minimal debug log messages */ static int iwl4965_param_disable; /* def: enable radio */ static int iwl4965_param_antenna; /* def: 0 = both antennas (use diversity) */ int iwl4965_param_hwcrypto; /* def: using software encryption */ -static int iwl4965_param_qos_enable = 1; -int iwl4965_param_queues_num = IWL_MAX_NUM_QUEUES; +static int iwl4965_param_qos_enable = 1; /* def: 1 = use quality of service */ +int iwl4965_param_queues_num = IWL_MAX_NUM_QUEUES; /* def: 16 Tx queues */ /* * module name, copyright, version, etc. @@ -183,17 +183,24 @@ static void iwl4965_print_hex_dump(int level, void *p, u32 len) * * Theory of operation * - * A queue is a circular buffers with 'Read' and 'Write' pointers. - * 2 empty entries always kept in the buffer to protect from overflow. + * A Tx or Rx queue resides in host DRAM, and is comprised of a circular buffer + * of buffer descriptors, each of which points to one or more data buffers for + * the device to read from or fill. Driver and device exchange status of each + * queue via "read" and "write" pointers. Driver keeps minimum of 2 empty + * entries in each circular buffer, to protect against confusing empty and full + * queue states. + * + * The device reads or writes the data in the queues via the device's several + * DMA/FIFO channels. Each queue is mapped to a single DMA channel. * * For Tx queue, there are low mark and high mark limits. If, after queuing * the packet for Tx, free space become < low mark, Tx queue stopped. When * reclaiming packets (on 'tx done IRQ), if free space become > high mark, * Tx queue resumed. * - * The IWL operates with six queues, one receive queue in the device's - * sram, one transmit queue for sending commands to the device firmware, - * and four transmit queues for data. + * The 4965 operates with up to 17 queues: One receive queue, one transmit + * queue (#4) for sending commands to the device firmware, and 15 other + * Tx queues that may be mapped to prioritized Tx DMA/FIFO channels. ***************************************************/ static int iwl4965_queue_space(const struct iwl4965_queue *q) @@ -212,13 +219,21 @@ static int iwl4965_queue_space(const struct iwl4965_queue *q) return s; } -/* XXX: n_bd must be power-of-two size */ +/** + * iwl4965_queue_inc_wrap - increment queue index, wrap back to beginning + * @index -- current index + * @n_bd -- total number of entries in queue (must be power of 2) + */ static inline int iwl4965_queue_inc_wrap(int index, int n_bd) { return ++index & (n_bd - 1); } -/* XXX: n_bd must be power-of-two size */ +/** + * iwl4965_queue_dec_wrap - decrement queue index, wrap back to end + * @index -- current index + * @n_bd -- total number of entries in queue (must be power of 2) + */ static inline int iwl4965_queue_dec_wrap(int index, int n_bd) { return --index & (n_bd - 1); @@ -233,12 +248,17 @@ static inline int x2_queue_used(const struct iwl4965_queue *q, int i) static inline u8 get_cmd_index(struct iwl4965_queue *q, u32 index, int is_huge) { + /* This is for scan command, the big buffer at end of command array */ if (is_huge) - return q->n_window; + return q->n_window; /* must be power of 2 */ + /* Otherwise, use normal size buffers */ return index & (q->n_window - 1); } +/** + * iwl4965_queue_init - Initialize queue's high/low-water and read/write indexes + */ static int iwl4965_queue_init(struct iwl4965_priv *priv, struct iwl4965_queue *q, int count, int slots_num, u32 id) { @@ -267,11 +287,16 @@ static int iwl4965_queue_init(struct iwl4965_priv *priv, struct iwl4965_queue *q return 0; } +/** + * iwl4965_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue + */ static int iwl4965_tx_queue_alloc(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq, u32 id) { struct pci_dev *dev = priv->pci_dev; + /* Driver private data, only for Tx (not command) queues, + * not shared with device. */ if (id != IWL_CMD_QUEUE_NUM) { txq->txb = kmalloc(sizeof(txq->txb[0]) * TFD_QUEUE_SIZE_MAX, GFP_KERNEL); @@ -283,6 +308,8 @@ static int iwl4965_tx_queue_alloc(struct iwl4965_priv *priv, } else txq->txb = NULL; + /* Circular buffer of transmit frame descriptors (TFDs), + * shared with device */ txq->bd = pci_alloc_consistent(dev, sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX, &txq->q.dma_addr); @@ -320,7 +347,7 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv, * For the command queue (#4), allocate command space + one big * command for scan, since scan command is very huge; the system will * not have two scans at the same time, so only one is needed. - * For normal Tx queues (all other queues), no super-size command + * For data Tx queues (all other queues), no super-size command * space is needed. */ len = sizeof(struct iwl4965_cmd) * slots_num; @@ -357,8 +384,8 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv, * @txq: Transmit queue to deallocate. * * Empty queue by removing and destroying all BD's. - * Free all buffers. txq itself is not freed. - * + * Free all buffers. + * 0-fill, but do not free "txq" descriptor structure. */ void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq) { @@ -378,19 +405,21 @@ void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *t if (q->id == IWL_CMD_QUEUE_NUM) len += IWL_MAX_SCAN_SIZE; + /* De-alloc array of command/tx buffers */ pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); - /* free buffers belonging to queue itself */ + /* De-alloc circular buffer of TFDs */ if (txq->q.n_bd) pci_free_consistent(dev, sizeof(struct iwl4965_tfd_frame) * txq->q.n_bd, txq->bd, txq->q.dma_addr); + /* De-alloc array of per-TFD driver data */ if (txq->txb) { kfree(txq->txb); txq->txb = NULL; } - /* 0 fill whole structure */ + /* 0-fill queue descriptor structure */ memset(txq, 0, sizeof(*txq)); } @@ -404,6 +433,11 @@ const u8 iwl4965_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF /**************************************************************/ #if 0 /* temporary disable till we add real remove station */ +/** + * iwl4965_remove_station - Remove driver's knowledge of station. + * + * NOTE: This does not remove station from device's station table. + */ static u8 iwl4965_remove_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) { int index = IWL_INVALID_STATION; @@ -441,6 +475,11 @@ out: } #endif +/** + * iwl4965_clear_stations_table - Clear the driver's station table + * + * NOTE: This does not clear or otherwise alter the device's station table. + */ static void iwl4965_clear_stations_table(struct iwl4965_priv *priv) { unsigned long flags; @@ -453,6 +492,9 @@ static void iwl4965_clear_stations_table(struct iwl4965_priv *priv) spin_unlock_irqrestore(&priv->sta_lock, flags); } +/** + * iwl4965_add_station_flags - Add station to tables in driver and device + */ u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, int is_ap, u8 flags) { int i; @@ -499,6 +541,7 @@ u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, int is_a station->used = 1; priv->num_stations++; + /* Set up the REPLY_ADD_STA command to send to device */ memset(&station->sta, 0, sizeof(struct iwl4965_addsta_cmd)); memcpy(station->sta.sta.addr, addr, ETH_ALEN); station->sta.mode = 0; @@ -513,6 +556,8 @@ u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, int is_a #endif /*CONFIG_IWL4965_HT*/ spin_unlock_irqrestore(&priv->sta_lock, flags_spin); + + /* Add station to device's station table */ iwl4965_send_add_station(priv, &station->sta, flags); return index; @@ -682,7 +727,11 @@ static int iwl4965_enqueue_hcmd(struct iwl4965_priv *priv, struct iwl4965_host_c fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM); txq->need_update = 1; + + /* Set up entry in queue's byte count circular buffer */ ret = iwl4965_tx_queue_update_wr_ptr(priv, txq, 0); + + /* Increment and update queue's write index */ q->write_ptr = iwl4965_queue_inc_wrap(q->write_ptr, q->n_bd); iwl4965_tx_queue_update_write_ptr(priv, txq); @@ -848,7 +897,10 @@ static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, { u8 sta_id; + /* Add station to device's station table */ sta_id = iwl4965_add_station_flags(priv, addr, is_ap, 0); + + /* Set up default rate scaling table in device's station table */ iwl4965_add_station(priv, addr, is_ap); return sta_id; @@ -1574,7 +1626,7 @@ static void get_eeprom_mac(struct iwl4965_priv *priv, u8 *mac) /** * iwl4965_eeprom_init - read EEPROM contents * - * Load the EEPROM from adapter into priv->eeprom + * Load the EEPROM contents from adapter into priv->eeprom * * NOTE: This routine uses the non-debug IO access functions. */ @@ -1599,6 +1651,7 @@ int iwl4965_eeprom_init(struct iwl4965_priv *priv) return -ENOENT; } + /* Make sure driver (instead of uCode) is allowed to read EEPROM */ rc = iwl4965_eeprom_acquire_semaphore(priv); if (rc < 0) { IWL_ERROR("Failed to acquire EEPROM semaphore.\n"); @@ -2739,6 +2792,11 @@ static void iwl4965_build_tx_cmd_basic(struct iwl4965_priv *priv, cmd->cmd.tx.next_frame_len = 0; } +/** + * iwl4965_get_sta_id - Find station's index within station table + * + * If new IBSS station, create new entry in station table + */ static int iwl4965_get_sta_id(struct iwl4965_priv *priv, struct ieee80211_hdr *hdr) { @@ -2746,16 +2804,15 @@ static int iwl4965_get_sta_id(struct iwl4965_priv *priv, u16 fc = le16_to_cpu(hdr->frame_control); DECLARE_MAC_BUF(mac); - /* If this frame is broadcast or not data then use the broadcast - * station id */ + /* If this frame is broadcast or management, use broadcast station id */ if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) || is_multicast_ether_addr(hdr->addr1)) return priv->hw_setting.bcast_sta_id; switch (priv->iw_mode) { - /* If this frame is part of a BSS network (we're a station), then - * we use the AP's station id */ + /* If we are a client station in a BSS network, use the special + * AP station entry (that's the only station we communicate with) */ case IEEE80211_IF_TYPE_STA: return IWL_AP_ID; @@ -2766,13 +2823,14 @@ static int iwl4965_get_sta_id(struct iwl4965_priv *priv, return sta_id; return priv->hw_setting.bcast_sta_id; - /* If this frame is part of a IBSS network, then we use the - * target specific station id */ + /* If this frame is going out to an IBSS network, find the station, + * or create a new station table entry */ case IEEE80211_IF_TYPE_IBSS: sta_id = iwl4965_hw_find_station(priv, hdr->addr1); if (sta_id != IWL_INVALID_STATION) return sta_id; + /* Create new station table entry */ sta_id = iwl4965_add_station_flags(priv, hdr->addr1, 0, CMD_ASYNC); if (sta_id != IWL_INVALID_STATION) @@ -2854,6 +2912,8 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, spin_unlock_irqrestore(&priv->lock, flags); hdr_len = ieee80211_get_hdrlen(fc); + + /* Find (or create) index into station table for destination station */ sta_id = iwl4965_get_sta_id(priv, hdr); if (sta_id == IWL_INVALID_STATION) { DECLARE_MAC_BUF(mac); @@ -2882,30 +2942,52 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, #endif /* CONFIG_IWL4965_HT_AGG */ #endif /* CONFIG_IWL4965_HT */ } + + /* Descriptor for chosen Tx queue */ txq = &priv->txq[txq_id]; q = &txq->q; spin_lock_irqsave(&priv->lock, flags); + /* Set up first empty TFD within this queue's circular TFD buffer */ tfd = &txq->bd[q->write_ptr]; memset(tfd, 0, sizeof(*tfd)); control_flags = (u32 *) tfd; idx = get_cmd_index(q, q->write_ptr, 0); + /* Set up driver data for this TFD */ memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl4965_tx_info)); txq->txb[q->write_ptr].skb[0] = skb; memcpy(&(txq->txb[q->write_ptr].status.control), ctl, sizeof(struct ieee80211_tx_control)); + + /* Set up first empty entry in queue's array of Tx/cmd buffers */ out_cmd = &txq->cmd[idx]; memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx)); + + /* + * Set up the Tx-command (not MAC!) header. + * Store the chosen Tx queue and TFD index within the sequence field; + * after Tx, uCode's Tx response will return this value so driver can + * locate the frame within the tx queue and do post-tx processing. + */ out_cmd->hdr.cmd = REPLY_TX; out_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | INDEX_TO_SEQ(q->write_ptr))); - /* copy frags header */ + + /* Copy MAC header from skb into command buffer */ memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len); - /* hdr = (struct ieee80211_hdr *)out_cmd->cmd.tx.hdr; */ + /* + * Use the first empty entry in this queue's command buffer array + * to contain the Tx command and MAC header concatenated together + * (payload data will be in another buffer). + * Size of this varies, due to varying MAC header length. + * If end is not dword aligned, we'll have 2 extra bytes at the end + * of the MAC header (device reads on dword boundaries). + * We'll tell device about this padding later. + */ len = priv->hw_setting.tx_cmd_len + sizeof(struct iwl4965_cmd_header) + hdr_len; @@ -2917,15 +2999,20 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, else len_org = 0; + /* Physical address of this Tx command's header (not MAC header!), + * within command buffer array. */ txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl4965_cmd) * idx + offsetof(struct iwl4965_cmd, hdr); + /* Add buffer containing Tx command and MAC(!) header to TFD's + * first entry */ iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) iwl4965_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); - /* 802.11 null functions have no payload... */ + /* Set up TFD's 2nd entry to point directly to remainder of skb, + * if any (802.11 null frames have no payload). */ len = skb->len - hdr_len; if (len) { phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, @@ -2933,9 +3020,11 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len); } + /* Tell 4965 about any 2-byte padding after MAC header */ if (len_org) out_cmd->cmd.tx.tx_flags |= TX_CMD_FLG_MH_PAD_MSK; + /* Total # bytes to be transmitted */ len = (u16)skb->len; out_cmd->cmd.tx.len = cpu_to_le16(len); @@ -2965,8 +3054,10 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, iwl4965_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, ieee80211_get_hdrlen(fc)); + /* Set up entry for this TFD in Tx byte-count array */ iwl4965_tx_queue_update_wr_ptr(priv, txq, len); + /* Tell device the write index *just past* this latest filled TFD */ q->write_ptr = iwl4965_queue_inc_wrap(q->write_ptr, q->n_bd); rc = iwl4965_tx_queue_update_write_ptr(priv, txq); spin_unlock_irqrestore(&priv->lock, flags); @@ -3443,11 +3534,11 @@ static void iwl4965_txstatus_to_ieee(struct iwl4965_priv *priv, } /** - * iwl4965_tx_queue_reclaim - Reclaim Tx queue entries no more used by NIC. + * iwl4965_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd * - * When FW advances 'R' index, all entries between old and - * new 'R' index need to be reclaimed. As result, some free space - * forms. If there is enough free space (> low mark), wake Tx queue. + * When FW advances 'R' index, all entries between old and new 'R' index + * need to be reclaimed. As result, some free space forms. If there is + * enough free space (> low mark), wake the stack that feeds us. */ int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index) { @@ -3528,6 +3619,10 @@ static inline u32 iwl4965_get_scd_ssn(struct iwl4965_tx_resp *tx_resp) return le32_to_cpu(*scd_ssn) & MAX_SN; } + +/** + * iwl4965_tx_status_reply_tx - Handle Tx rspnse for frames in aggregation queue + */ static int iwl4965_tx_status_reply_tx(struct iwl4965_priv *priv, struct iwl4965_ht_agg *agg, struct iwl4965_tx_resp *tx_resp, @@ -3542,14 +3637,16 @@ static int iwl4965_tx_status_reply_tx(struct iwl4965_priv *priv, u16 seq; if (agg->wait_for_ba) - IWL_DEBUG_TX_REPLY("got tx repsons w/o back\n"); + IWL_DEBUG_TX_REPLY("got tx response w/o block-ack\n"); agg->frame_count = tx_resp->frame_count; agg->start_idx = start_idx; agg->rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags); agg->bitmap0 = agg->bitmap1 = 0; + /* # frames attempted by Tx command */ if (agg->frame_count == 1) { + /* Only one frame was attempted; no block-ack will arrive */ struct iwl4965_tx_queue *txq ; status = le32_to_cpu(frame_status[0]); @@ -3578,9 +3675,11 @@ static int iwl4965_tx_status_reply_tx(struct iwl4965_priv *priv, agg->wait_for_ba = 0; } else { + /* Two or more frames were attempted; expect block-ack */ u64 bitmap = 0; int start = agg->start_idx; + /* Construct bit-map of pending frames within Tx window */ for (i = 0; i < agg->frame_count; i++) { u16 sc; status = le32_to_cpu(frame_status[i]); @@ -3644,6 +3743,9 @@ static int iwl4965_tx_status_reply_tx(struct iwl4965_priv *priv, #endif #endif +/** + * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response + */ static void iwl4965_rx_reply_tx(struct iwl4965_priv *priv, struct iwl4965_rx_mem_buffer *rxb) { @@ -4265,6 +4367,7 @@ int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_ if (q->need_update == 0) goto exit_unlock; + /* If power-saving is in use, make sure device is awake */ if (test_bit(STATUS_POWER_PMI, &priv->status)) { reg = iwl4965_read32(priv, CSR_UCODE_DRV_GP1); @@ -4278,10 +4381,14 @@ int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_ if (rc) goto exit_unlock; + /* Device expects a multiple of 8 */ iwl4965_write_direct32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); iwl4965_release_nic_access(priv); + + /* Else device is assumed to be awake */ } else + /* Device expects a multiple of 8 */ iwl4965_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); @@ -4324,9 +4431,12 @@ static int iwl4965_rx_queue_restock(struct iwl4965_priv *priv) spin_lock_irqsave(&rxq->lock, flags); write = rxq->write & ~0x7; while ((iwl4965_rx_queue_space(rxq) > 0) && (rxq->free_count)) { + /* Get next free Rx buffer, remove from free list */ element = rxq->rx_free.next; rxb = list_entry(element, struct iwl4965_rx_mem_buffer, list); list_del(element); + + /* Point to Rx buffer via next RBD in circular buffer */ rxq->bd[rxq->write] = iwl4965_dma_addr2rbd_ptr(priv, rxb->dma_addr); rxq->queue[rxq->write] = rxb; rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; @@ -4339,7 +4449,8 @@ static int iwl4965_rx_queue_restock(struct iwl4965_priv *priv) queue_work(priv->workqueue, &priv->rx_replenish); - /* If we've added more space for the firmware to place data, tell it */ + /* If we've added more space for the firmware to place data, tell it. + * Increment device's write pointer in multiples of 8. */ if ((write != (rxq->write & ~0x7)) || (abs(rxq->write - rxq->read) > 7)) { spin_lock_irqsave(&rxq->lock, flags); @@ -4372,6 +4483,8 @@ void iwl4965_rx_replenish(void *data) while (!list_empty(&rxq->rx_used)) { element = rxq->rx_used.next; rxb = list_entry(element, struct iwl4965_rx_mem_buffer, list); + + /* Alloc a new receive buffer */ rxb->skb = alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC); if (!rxb->skb) { @@ -4385,6 +4498,8 @@ void iwl4965_rx_replenish(void *data) } priv->alloc_rxb_skb++; list_del(element); + + /* Get physical address of RB/SKB */ rxb->dma_addr = pci_map_single(priv->pci_dev, rxb->skb->data, IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); @@ -4429,12 +4544,16 @@ int iwl4965_rx_queue_alloc(struct iwl4965_priv *priv) spin_lock_init(&rxq->lock); INIT_LIST_HEAD(&rxq->rx_free); INIT_LIST_HEAD(&rxq->rx_used); + + /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr); if (!rxq->bd) return -ENOMEM; + /* Fill the rx_used queue with _all_ of the Rx buffers */ for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) list_add_tail(&rxq->pool[i].list, &rxq->rx_used); + /* Set us so that we have processed and used all buffers, but have * not restocked the Rx queue with fresh buffers */ rxq->read = rxq->write = 0; @@ -4566,6 +4685,8 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) int reclaim; unsigned long flags; + /* uCode's read index (stored in shared DRAM) indicates the last Rx + * buffer that the driver may process (last buffer filled by ucode). */ r = iwl4965_hw_get_rx_read(priv); i = rxq->read; @@ -4649,6 +4770,9 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) iwl4965_rx_queue_restock(priv); } +/** + * iwl4965_tx_queue_update_write_ptr - Send new write index to hardware + */ static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq) { @@ -5282,6 +5406,11 @@ static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, } } +/** + * iwl4965_get_channel_info - Find driver's private channel info + * + * Based on band and channel number. + */ const struct iwl4965_channel_info *iwl4965_get_channel_info(const struct iwl4965_priv *priv, int phymode, u16 channel) { @@ -5309,6 +5438,9 @@ const struct iwl4965_channel_info *iwl4965_get_channel_info(const struct iwl4965 #define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ ? # x " " : "") +/** + * iwl4965_init_channel_map - Set up driver's info for all possible channels + */ static int iwl4965_init_channel_map(struct iwl4965_priv *priv) { int eeprom_ch_count = 0; @@ -5418,6 +5550,7 @@ static int iwl4965_init_channel_map(struct iwl4965_priv *priv) } } + /* Two additional EEPROM bands for 2.4 and 5 GHz FAT channels */ for (band = 6; band <= 7; band++) { int phymode; u8 fat_extension_chan; @@ -5425,7 +5558,9 @@ static int iwl4965_init_channel_map(struct iwl4965_priv *priv) iwl4965_init_band_reference(priv, band, &eeprom_ch_count, &eeprom_ch_info, &eeprom_ch_index); + /* EEPROM band 6 is 2.4, band 7 is 5 GHz */ phymode = (band == 6) ? MODE_IEEE80211B : MODE_IEEE80211A; + /* Loop through each band adding each of the channels */ for (ch = 0; ch < eeprom_ch_count; ch++) { @@ -5437,11 +5572,13 @@ static int iwl4965_init_channel_map(struct iwl4965_priv *priv) else fat_extension_chan = HT_IE_EXT_CHANNEL_ABOVE; + /* Set up driver's info for lower half */ iwl4965_set_fat_chan_info(priv, phymode, eeprom_ch_index[ch], &(eeprom_ch_info[ch]), fat_extension_chan); + /* Set up driver's info for upper half */ iwl4965_set_fat_chan_info(priv, phymode, (eeprom_ch_index[ch] + 4), &(eeprom_ch_info[ch]), @@ -8951,6 +9088,8 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e struct ieee80211_hw *hw; int i; + /* Disabling hardware scan means that mac80211 will perform scans + * "the hard way", rather than using device's scan. */ if (iwl4965_param_disable_hw_scan) { IWL_DEBUG_INFO("Disabling hw_scan\n"); iwl4965_hw_ops.hw_scan = NULL; @@ -9002,9 +9141,11 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e /* Tell mac80211 our Tx characteristics */ hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE; + /* Default value; 4 EDCA QOS priorities */ hw->queues = 4; #ifdef CONFIG_IWL4965_HT #ifdef CONFIG_IWL4965_HT_AGG + /* Enhanced value; more queues, to support 11n aggregation */ hw->queues = 16; #endif /* CONFIG_IWL4965_HT_AGG */ #endif /* CONFIG_IWL4965_HT */ @@ -9028,6 +9169,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e pci_set_master(pdev); + /* Clear the driver's (not device's) station table */ iwl4965_clear_stations_table(priv); priv->data_retry_limit = -1; @@ -9047,9 +9189,11 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e err = pci_request_regions(pdev, DRV_NAME); if (err) goto out_pci_disable_device; + /* We disable the RETRY_TIMEOUT register (0x41) to keep * PCI Tx retries from interfering with C3 CPU state */ pci_write_config_byte(pdev, 0x41, 0x00); + priv->hw_base = pci_iomap(pdev, 0, 0); if (!priv->hw_base) { err = -ENODEV; @@ -9062,6 +9206,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e /* Initialize module parameter values here */ + /* Disable radio (SW RF KILL) via parameter when loading driver */ if (iwl4965_param_disable) { set_bit(STATUS_RF_KILL_SW, &priv->status); IWL_DEBUG_INFO("Radio disabled.\n"); @@ -9076,6 +9221,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e priv->valid_antenna = 0x7; /* assume all 3 connected */ priv->ps_mode = IWL_MIMO_PS_NONE; + /* Choose which receivers/antennas to use */ iwl4965_set_rxon_chain(priv); printk(KERN_INFO DRV_NAME -- cgit v1.2.3-70-g09d2 From e3851447664113bccf9b23af0308e266872a735c Mon Sep 17 00:00:00 2001 From: Ben Cahill Date: Thu, 29 Nov 2007 11:10:07 +0800 Subject: iwlwifi: document 4965 Tx scheduler Document 4965 Tx scheduler Signed-off-by: Ben Cahill Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 268 +++++++++++++++++++++++++++- drivers/net/wireless/iwlwifi/iwl-prph.h | 14 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 + 3 files changed, 272 insertions(+), 12 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index b548b7979b4..d5d418e6192 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h @@ -1554,33 +1554,285 @@ enum { IWL_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl)) +/********************* START TX SCHEDULER *************************************/ + +/** + * 4965 Tx Scheduler + * + * The Tx Scheduler selects the next frame to be transmitted, chosing TFDs + * (Transmit Frame Descriptors) from up to 16 circular Tx queues resident in + * host DRAM. It steers each frame's Tx command (which contains the frame + * data) into one of up to 7 prioritized Tx DMA FIFO channels within the + * device. A queue maps to only one (selectable by driver) Tx DMA channel, + * but one DMA channel may take input from several queues. + * + * Tx DMA channels have dedicated purposes. For 4965, they are used as follows: + * + * 0 -- EDCA BK (background) frames, lowest priority + * 1 -- EDCA BE (best effort) frames, normal priority + * 2 -- EDCA VI (video) frames, higher priority + * 3 -- EDCA VO (voice) and management frames, highest priority + * 4 -- Commands (e.g. RXON, etc.) + * 5 -- HCCA short frames + * 6 -- HCCA long frames + * 7 -- not used by driver (device-internal only) + * + * Driver should normally map queues 0-6 to Tx DMA/FIFO channels 0-6. + * In addition, driver can map queues 7-15 to Tx DMA/FIFO channels 0-3 to + * support 11n aggregation via EDCA DMA channels. + * + * The driver sets up each queue to work in one of two modes: + * + * 1) Scheduler-Ack, in which the scheduler automatically supports a + * block-ack (BA) window of up to 64 TFDs. In this mode, each queue + * contains TFDs for a unique combination of Recipient Address (RA) + * and Traffic Identifier (TID), that is, traffic of a given + * Quality-Of-Service (QOS) priority, destined for a single station. + * + * In scheduler-ack mode, the scheduler keeps track of the Tx status of + * each frame within the BA window, including whether it's been transmitted, + * and whether it's been acknowledged by the receiving station. The device + * automatically processes block-acks received from the receiving STA, + * and reschedules un-acked frames to be retransmitted (successful + * Tx completion may end up being out-of-order). + * + * The driver must maintain the queue's Byte Count table in host DRAM + * (struct iwl4965_sched_queue_byte_cnt_tbl) for this mode. + * This mode does not support fragmentation. + * + * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order. + * The device may automatically retry Tx, but will retry only one frame + * at a time, until receiving ACK from receiving station, or reaching + * retry limit and giving up. + * + * The command queue (#4) must use this mode! + * This mode does not require use of the Byte Count table in host DRAM. + * + * Driver controls scheduler operation via 3 means: + * 1) Scheduler registers + * 2) Shared scheduler data base in internal 4956 SRAM + * 3) Shared data in host DRAM + * + * Initialization: + * + * When loading, driver should allocate memory for: + * 1) 16 TFD circular buffers, each with space for (typically) 256 TFDs. + * 2) 16 Byte Count circular buffers in 16 KBytes contiguous memory + * (1024 bytes for each queue). + * + * After receiving "Alive" response from uCode, driver must initialize + * the scheduler (especially for queue #4, the command queue, otherwise + * the driver can't issue commands!): + */ + +/** + * Max Tx window size is the max number of contiguous TFDs that the scheduler + * can keep track of at one time when creating block-ack chains of frames. + * Note that "64" matches the number of ack bits in a block-ack packet. + * Driver should use SCD_WIN_SIZE and SCD_FRAME_LIMIT values to initialize + * SCD_CONTEXT_QUEUE_OFFSET(x) values. + */ #define SCD_WIN_SIZE 64 #define SCD_FRAME_LIMIT 64 -/* SRAM structures */ -#define SCD_CONTEXT_DATA_OFFSET 0x380 -#define SCD_TX_STTS_BITMAP_OFFSET 0x400 -#define SCD_TRANSLATE_TBL_OFFSET 0x500 -#define SCD_CONTEXT_QUEUE_OFFSET(x) (SCD_CONTEXT_DATA_OFFSET + ((x) * 8)) -#define SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ - ((SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc) +/* SCD registers are internal, must be accessed via HBUS_TARG_PRPH regs */ +#define SCD_START_OFFSET 0xa02c00 + +/* + * 4965 tells driver SRAM address for internal scheduler structs via this reg. + * Value is valid only after "Alive" response from uCode. + */ +#define SCD_SRAM_BASE_ADDR (SCD_START_OFFSET + 0x0) +/* + * Driver may need to update queue-empty bits after changing queue's + * write and read pointers (indexes) during (re-)initialization (i.e. when + * scheduler is not tracking what's happening). + * Bit fields: + * 31-16: Write mask -- 1: update empty bit, 0: don't change empty bit + * 15-00: Empty state, one for each queue -- 1: empty, 0: non-empty + * NOTE: This register is not used by Linux driver. + */ +#define SCD_EMPTY_BITS (SCD_START_OFFSET + 0x4) + +/* + * Physical base address of array of byte count (BC) circular buffers (CBs). + * Each Tx queue has a BC CB in host DRAM to support Scheduler-ACK mode. + * This register points to BC CB for queue 0, must be on 1024-byte boundary. + * Others are spaced by 1024 bytes. + * Each BC CB is 2 bytes * (256 + 64) = 740 bytes, followed by 384 bytes pad. + * (Index into a queue's BC CB) = (index into queue's TFD CB) = (SSN & 0xff). + * Bit fields: + * 25-00: Byte Count CB physical address [35:10], must be 1024-byte aligned. + */ +#define SCD_DRAM_BASE_ADDR (SCD_START_OFFSET + 0x10) + +/* + * Enables any/all Tx DMA/FIFO channels. + * Scheduler generates requests for only the active channels. + * Set this to 0xff to enable all 8 channels (normal usage). + * Bit fields: + * 7- 0: Enable (1), disable (0), one bit for each channel 0-7 + */ +#define SCD_TXFACT (SCD_START_OFFSET + 0x1c) + +/* Mask to enable contiguous Tx DMA/FIFO channels between "lo" and "hi". */ #define SCD_TXFACT_REG_TXFIFO_MASK(lo, hi) \ ((1<<(hi))|((1<<(hi))-(1<<(lo)))) +/* + * Queue (x) Write Pointers (indexes, really!), one for each Tx queue. + * Initialized and updated by driver as new TFDs are added to queue. + * NOTE: If using Block Ack, index must correspond to frame's + * Start Sequence Number; index = (SSN & 0xff) + * NOTE: Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses? + */ +#define SCD_QUEUE_WRPTR(x) (SCD_START_OFFSET + 0x24 + (x) * 4) + +/* + * Queue (x) Read Pointers (indexes, really!), one for each Tx queue. + * For FIFO mode, index indicates next frame to transmit. + * For Scheduler-ACK mode, index indicates first frame in Tx window. + * Initialized by driver, updated by scheduler. + */ +#define SCD_QUEUE_RDPTR(x) (SCD_START_OFFSET + 0x64 + (x) * 4) + +/* + * Select which queues work in chain mode (1) vs. not (0). + * Use chain mode to build chains of aggregated frames. + * Bit fields: + * 31-16: Reserved + * 15-00: Mode, one bit for each queue -- 1: Chain mode, 0: one-at-a-time + * NOTE: If driver sets up queue for chain mode, it should be also set up + * Scheduler-ACK mode as well, via SCD_QUEUE_STATUS_BITS(x). + */ +#define SCD_QUEUECHAIN_SEL (SCD_START_OFFSET + 0xd0) + +/* + * Select which queues interrupt driver when scheduler increments + * a queue's read pointer (index). + * Bit fields: + * 31-16: Reserved + * 15-00: Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled + * NOTE: This functionality is apparently a no-op; driver relies on interrupts + * from Rx queue to read Tx command responses and update Tx queues. + */ +#define SCD_INTERRUPT_MASK (SCD_START_OFFSET + 0xe4) + +/* + * Queue search status registers. One for each queue. + * Sets up queue mode and assigns queue to Tx DMA channel. + * Bit fields: + * 19-10: Write mask/enable bits for bits 0-9 + * 9: Driver should init to "0" + * 8: Scheduler-ACK mode (1), non-Scheduler-ACK (i.e. FIFO) mode (0). + * Driver should init to "1" for aggregation mode, or "0" otherwise. + * 7-6: Driver should init to "0" + * 5: Window Size Left; indicates whether scheduler can request + * another TFD, based on window size, etc. Driver should init + * this bit to "1" for aggregation mode, or "0" for non-agg. + * 4-1: Tx FIFO to use (range 0-7). + * 0: Queue is active (1), not active (0). + * Other bits should be written as "0" + * + * NOTE: If enabling Scheduler-ACK mode, chain mode should also be enabled + * via SCD_QUEUECHAIN_SEL. + */ +#define SCD_QUEUE_STATUS_BITS(x) (SCD_START_OFFSET + 0x104 + (x) * 4) + +/* Bit field positions */ #define SCD_QUEUE_STTS_REG_POS_ACTIVE (0) #define SCD_QUEUE_STTS_REG_POS_TXF (1) #define SCD_QUEUE_STTS_REG_POS_WSL (5) #define SCD_QUEUE_STTS_REG_POS_SCD_ACK (8) + +/* Write masks */ #define SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (10) #define SCD_QUEUE_STTS_REG_MSK (0x0007FC00) +/** + * 4965 internal SRAM structures for scheduler, shared with driver ... + * + * Driver should clear and initialize the following areas after receiving + * "Alive" response from 4965 uCode, i.e. after initial + * uCode load, or after a uCode load done for error recovery: + * + * SCD_CONTEXT_DATA_OFFSET (size 128 bytes) + * SCD_TX_STTS_BITMAP_OFFSET (size 256 bytes) + * SCD_TRANSLATE_TBL_OFFSET (size 32 bytes) + * + * Driver accesses SRAM via HBUS_TARG_MEM_* registers. + * Driver reads base address of this scheduler area from SCD_SRAM_BASE_ADDR. + * All OFFSET values must be added to this base address. + */ + +/* + * Queue context. One 8-byte entry for each of 16 queues. + * + * Driver should clear this entire area (size 0x80) to 0 after receiving + * "Alive" notification from uCode. Additionally, driver should init + * each queue's entry as follows: + * + * LS Dword bit fields: + * 0-06: Max Tx window size for Scheduler-ACK. Driver should init to 64. + * + * MS Dword bit fields: + * 16-22: Frame limit. Driver should init to 10 (0xa). + * + * Driver should init all other bits to 0. + * + * Init must be done after driver receives "Alive" response from 4965 uCode, + * and when setting up queue for aggregation. + */ +#define SCD_CONTEXT_DATA_OFFSET 0x380 +#define SCD_CONTEXT_QUEUE_OFFSET(x) (SCD_CONTEXT_DATA_OFFSET + ((x) * 8)) + #define SCD_QUEUE_CTX_REG1_WIN_SIZE_POS (0) #define SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK (0x0000007F) - #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16) #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000) +/* + * Tx Status Bitmap + * + * Driver should clear this entire area (size 0x100) to 0 after receiving + * "Alive" notification from uCode. Area is used only by device itself; + * no other support (besides clearing) is required from driver. + */ +#define SCD_TX_STTS_BITMAP_OFFSET 0x400 + +/* + * RAxTID to queue translation mapping. + * + * When queue is in Scheduler-ACK mode, frames placed in a that queue must be + * for only one combination of receiver address (RA) and traffic ID (TID), i.e. + * one QOS priority level destined for one station (for this wireless link, + * not final destination). The SCD_TRANSLATE_TABLE area provides 16 16-bit + * mappings, one for each of the 16 queues. If queue is not in Scheduler-ACK + * mode, the device ignores the mapping value. + * + * Bit fields, for each 16-bit map: + * 15-9: Reserved, set to 0 + * 8-4: Index into device's station table for recipient station + * 3-0: Traffic ID (tid), range 0-15 + * + * Driver should clear this entire area (size 32 bytes) to 0 after receiving + * "Alive" notification from uCode. To update a 16-bit map value, driver + * must read a dword-aligned value from device SRAM, replace the 16-bit map + * value of interest, and write the dword value back into device SRAM. + */ +#define SCD_TRANSLATE_TBL_OFFSET 0x500 + +/* Find translation table dword to read/write for given queue */ +#define SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ + ((SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc) + +#define SCD_TXFIFO_POS_TID (0) +#define SCD_TXFIFO_POS_RA (4) +#define SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) + +/*********************** END TX SCHEDULER *************************************/ + static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags) { return le32_to_cpu(rate_n_flags) & 0xFF; diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index 137947dd269..4ba12163487 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h @@ -63,7 +63,10 @@ #ifndef __iwl_prph_h__ #define __iwl_prph_h__ - +/* + * Registers in this file are internal, not PCI bus memory mapped. + * Driver accesses these via HBUS_TARG_PRPH_* registers. + */ #define PRPH_BASE (0x00000) #define PRPH_END (0xFFFFF) @@ -225,8 +228,8 @@ #define BSM_SRAM_LOWER_BOUND (PRPH_BASE + 0x3800) #define BSM_SRAM_SIZE (1024) /* bytes */ -/* ALM SCD */ -/* SCD (Scheduler) */ + +/* 3945 Tx scheduler registers */ #define ALM_SCD_BASE (PRPH_BASE + 0x2E00) #define ALM_SCD_MODE_REG (ALM_SCD_BASE + 0x000) #define ALM_SCD_ARASTAT_REG (ALM_SCD_BASE + 0x004) @@ -236,7 +239,10 @@ #define ALM_SCD_SBYP_MODE_1_REG (ALM_SCD_BASE + 0x02C) #define ALM_SCD_SBYP_MODE_2_REG (ALM_SCD_BASE + 0x030) -/* 4965 SCD memory mapped registers */ +/* + * 4965 Tx Scheduler registers. + * Details are documented in iwl-4965-hw.h + */ #define KDR_SCD_BASE (PRPH_BASE + 0xa02c00) #define KDR_SCD_SRAM_BASE_ADDR (KDR_SCD_BASE + 0x0) diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 43ce645e4a6..e15986c33d0 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -201,6 +201,8 @@ static void iwl4965_print_hex_dump(int level, void *p, u32 len) * The 4965 operates with up to 17 queues: One receive queue, one transmit * queue (#4) for sending commands to the device firmware, and 15 other * Tx queues that may be mapped to prioritized Tx DMA/FIFO channels. + * + * See more detailed info in iwl-4965-hw.h. ***************************************************/ static int iwl4965_queue_space(const struct iwl4965_queue *q) -- cgit v1.2.3-70-g09d2 From 7878a5a4fcc5002e805c054730c4c5639c9d071d Mon Sep 17 00:00:00 2001 From: Mohamed Abbas Date: Thu, 29 Nov 2007 11:10:13 +0800 Subject: iwlwifi: enhance WPA authenication stability This patch enhanced WPA authenication stability by avoiding scan immediately followed by association. We don't do any scanning right after association in next several seconds. This will allow WPA authentication to take place without any interruption. Signed-off-by: Mohamed Abbas Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 9 +++++++++ drivers/net/wireless/iwlwifi/iwl-3945.h | 1 + drivers/net/wireless/iwlwifi/iwl-4965.c | 8 ++++++++ drivers/net/wireless/iwlwifi/iwl-4965.h | 1 + drivers/net/wireless/iwlwifi/iwl3945-base.c | 24 +++++++++++++++++------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 24 +++++++++++++++++------- 6 files changed, 53 insertions(+), 14 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 51b90309ce5..1b81545b94e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -285,6 +285,8 @@ static void iwl3945_handle_data_packet(struct iwl3945_priv *priv, int is_data, rxb->skb = NULL; } +#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) + static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb) { @@ -442,6 +444,13 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, case IEEE80211_STYPE_REASSOC_RESP:{ struct ieee80211_mgmt *mgnt = (struct ieee80211_mgmt *)header; + + /* We have just associated, give some + * time for the 4-way handshake if + * any. Don't start scan too early. */ + priv->next_scan_jiffies = jiffies + + IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; + priv->assoc_id = (~((1 << 15) | (1 << 14)) & le16_to_cpu(mgnt->u. assoc_resp.aid)); diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 75cef3ed951..1f82061221a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -752,6 +752,7 @@ struct iwl3945_priv { /* Scan related variables */ unsigned long last_scan_jiffies; + unsigned long next_scan_jiffies; unsigned long scan_start; unsigned long scan_pass_start; unsigned long scan_start_tsf; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 40c795eaaba..c8e7adfe414 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -3802,6 +3802,8 @@ static void iwl4965_update_ps_mode(struct iwl4965_priv *priv, u16 ps_bit, u8 *ad } } +#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) + /* Called for REPLY_4965_RX (legacy ABG frames), or * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, @@ -3973,6 +3975,12 @@ static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, struct ieee80211_mgmt *mgnt = (struct ieee80211_mgmt *)header; + /* We have just associated, give some + * time for the 4-way handshake if + * any. Don't start scan too early. */ + priv->next_scan_jiffies = jiffies + + IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; + priv->assoc_id = (~((1 << 15) | (1 << 14)) & le16_to_cpu(mgnt->u.assoc_resp.aid)); priv->assoc_capability = diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 2930c10b5ed..c0627386122 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -1082,6 +1082,7 @@ struct iwl4965_priv { /* Scan related variables */ unsigned long last_scan_jiffies; + unsigned long next_scan_jiffies; unsigned long scan_start; unsigned long scan_pass_start; unsigned long scan_start_tsf; diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 71e9b7c52d5..82c1e0d45cf 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -2800,7 +2800,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, IWL_DEBUG_TX("Sending REASSOC frame\n"); #endif - if (!iwl3945_is_associated(priv) && + /* drop all data frame if we are not associated */ + if (!iwl3945_is_associated(priv) && !priv->assoc_id && ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); goto drop_unlock; @@ -3737,6 +3738,7 @@ static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv, (priv->last_scan_jiffies, jiffies))); priv->last_scan_jiffies = jiffies; + priv->next_scan_jiffies = 0; } /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ @@ -3779,6 +3781,7 @@ static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv, } priv->last_scan_jiffies = jiffies; + priv->next_scan_jiffies = 0; IWL_DEBUG_INFO("Setting scan to off\n"); clear_bit(STATUS_SCANNING, &priv->status); @@ -6806,6 +6809,8 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data) mutex_unlock(&priv->mutex); } +#define IWL_DELAY_NEXT_SCAN (HZ*2) + static void iwl3945_bg_post_associate(struct work_struct *data) { struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, @@ -6906,6 +6911,8 @@ static void iwl3945_bg_post_associate(struct work_struct *data) #ifdef CONFIG_IWL3945_QOS iwl3945_activate_qos(priv, 0); #endif /* CONFIG_IWL3945_QOS */ + /* we have just associated, don't start scan too early */ + priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN; mutex_unlock(&priv->mutex); } @@ -7338,7 +7345,6 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, } -#define IWL_DELAY_NEXT_SCAN (HZ*2) static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) { int rc = 0; @@ -7362,16 +7368,20 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) goto out_unlock; } + /* we don't schedule scan within next_scan_jiffies period */ + if (priv->next_scan_jiffies && + time_after(priv->next_scan_jiffies, jiffies)) { + rc = -EAGAIN; + goto out_unlock; + } /* if we just finished scan ask for delay */ - if (priv->last_scan_jiffies && - time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, - jiffies)) { + if (priv->last_scan_jiffies && time_after(priv->last_scan_jiffies + + IWL_DELAY_NEXT_SCAN, jiffies)) { rc = -EAGAIN; goto out_unlock; } if (len) { - IWL_DEBUG_SCAN("direct scan for " - "%s [%d]\n ", + IWL_DEBUG_SCAN("direct scan for %s [%d]\n ", iwl3945_escape_essid(ssid, len), (int)len); priv->one_direct_scan = 1; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index e15986c33d0..670f611adf9 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -2905,7 +2905,8 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, IWL_DEBUG_TX("Sending REASSOC frame\n"); #endif - if (!iwl4965_is_associated(priv) && + /* drop all data frame if we are not associated */ + if (!iwl4965_is_associated(priv) && !priv->assoc_id && ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n"); goto drop_unlock; @@ -4055,6 +4056,7 @@ static void iwl4965_rx_scan_results_notif(struct iwl4965_priv *priv, (priv->last_scan_jiffies, jiffies))); priv->last_scan_jiffies = jiffies; + priv->next_scan_jiffies = 0; } /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ @@ -4097,6 +4099,7 @@ static void iwl4965_rx_scan_complete_notif(struct iwl4965_priv *priv, } priv->last_scan_jiffies = jiffies; + priv->next_scan_jiffies = 0; IWL_DEBUG_INFO("Setting scan to off\n"); clear_bit(STATUS_SCANNING, &priv->status); @@ -7228,6 +7231,8 @@ static void iwl4965_bg_rx_replenish(struct work_struct *data) mutex_unlock(&priv->mutex); } +#define IWL_DELAY_NEXT_SCAN (HZ*2) + static void iwl4965_bg_post_associate(struct work_struct *data) { struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv, @@ -7343,6 +7348,8 @@ static void iwl4965_bg_post_associate(struct work_struct *data) #ifdef CONFIG_IWL4965_QOS iwl4965_activate_qos(priv, 0); #endif /* CONFIG_IWL4965_QOS */ + /* we have just associated, don't start scan too early */ + priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN; mutex_unlock(&priv->mutex); } @@ -7811,7 +7818,6 @@ static void iwl4965_mac_erp_ie_changed(struct ieee80211_hw *hw, iwl4965_send_rxon_assoc(priv); } -#define IWL_DELAY_NEXT_SCAN (HZ*2) static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) { int rc = 0; @@ -7835,16 +7841,20 @@ static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) goto out_unlock; } + /* we don't schedule scan within next_scan_jiffies period */ + if (priv->next_scan_jiffies && + time_after(priv->next_scan_jiffies, jiffies)) { + rc = -EAGAIN; + goto out_unlock; + } /* if we just finished scan ask for delay */ - if (priv->last_scan_jiffies && - time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, - jiffies)) { + if (priv->last_scan_jiffies && time_after(priv->last_scan_jiffies + + IWL_DELAY_NEXT_SCAN, jiffies)) { rc = -EAGAIN; goto out_unlock; } if (len) { - IWL_DEBUG_SCAN("direct scan for " - "%s [%d]\n ", + IWL_DEBUG_SCAN("direct scan for %s [%d]\n ", iwl4965_escape_essid(ssid, len), (int)len); priv->one_direct_scan = 1; -- cgit v1.2.3-70-g09d2 From 5c0eef960bdb87a53ba390aab7b069b2bc8d7f6d Mon Sep 17 00:00:00 2001 From: Mohamed Abbas Date: Thu, 29 Nov 2007 11:10:14 +0800 Subject: iwlwifi: fix ucode assertion for RX queue overrun This patch allows the driver to restock the RX queue early if the RX queue is almost empty. This will help on avoiding any ucode assert for the RX overrun problem. Signed-off-by: Mohamed Abbas Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 37 ++++++++++++++++++++++++++-- drivers/net/wireless/iwlwifi/iwl4965-base.c | 38 +++++++++++++++++++++++++++-- 2 files changed, 71 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 82c1e0d45cf..3272608ced8 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -4123,9 +4123,8 @@ static int iwl3945_rx_queue_restock(struct iwl3945_priv *priv) * Also restock the Rx queue via iwl3945_rx_queue_restock. * This is called as a scheduled work item (except for during initialization) */ -void iwl3945_rx_replenish(void *data) +static void iwl3945_rx_allocate(struct iwl3945_priv *priv) { - struct iwl3945_priv *priv = data; struct iwl3945_rx_queue *rxq = &priv->rxq; struct list_head *element; struct iwl3945_rx_mem_buffer *rxb; @@ -4158,6 +4157,26 @@ void iwl3945_rx_replenish(void *data) rxq->free_count++; } spin_unlock_irqrestore(&rxq->lock, flags); +} + +/* + * this should be called while priv->lock is locked + */ +void __iwl3945_rx_replenish(void *data) +{ + struct iwl3945_priv *priv = data; + + iwl3945_rx_allocate(priv); + iwl3945_rx_queue_restock(priv); +} + + +void iwl3945_rx_replenish(void *data) +{ + struct iwl3945_priv *priv = data; + unsigned long flags; + + iwl3945_rx_allocate(priv); spin_lock_irqsave(&priv->lock, flags); iwl3945_rx_queue_restock(priv); @@ -4335,12 +4354,16 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv) u32 r, i; int reclaim; unsigned long flags; + u8 fill_rx = 0; + u32 count = 0; /* uCode's read index (stored in shared DRAM) indicates the last Rx * buffer that the driver may process (last buffer filled by ucode). */ r = iwl3945_hw_get_rx_read(priv); i = rxq->read; + if (iwl3945_rx_queue_space(rxq) > (RX_QUEUE_SIZE / 2)) + fill_rx = 1; /* Rx interrupt, but nothing sent from uCode */ if (i == r) IWL_DEBUG(IWL_DL_RX | IWL_DL_ISR, "r = %d, i = %d\n", r, i); @@ -4411,6 +4434,16 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv) list_add_tail(&rxb->list, &priv->rxq.rx_used); spin_unlock_irqrestore(&rxq->lock, flags); i = (i + 1) & RX_QUEUE_MASK; + /* If there are a lot of unused frames, + * restock the Rx queue so ucode won't assert. */ + if (fill_rx) { + count++; + if (count >= 8) { + priv->rxq.read = i; + __iwl3945_rx_replenish(priv); + count = 0; + } + } } /* Backtrack one entry */ diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 670f611adf9..6be38ce701f 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -4477,9 +4477,8 @@ static int iwl4965_rx_queue_restock(struct iwl4965_priv *priv) * Also restock the Rx queue via iwl4965_rx_queue_restock. * This is called as a scheduled work item (except for during initialization) */ -void iwl4965_rx_replenish(void *data) +static void iwl4965_rx_allocate(struct iwl4965_priv *priv) { - struct iwl4965_priv *priv = data; struct iwl4965_rx_queue *rxq = &priv->rxq; struct list_head *element; struct iwl4965_rx_mem_buffer *rxb; @@ -4512,6 +4511,26 @@ void iwl4965_rx_replenish(void *data) rxq->free_count++; } spin_unlock_irqrestore(&rxq->lock, flags); +} + +/* + * this should be called while priv->lock is locked +*/ +void __iwl4965_rx_replenish(void *data) +{ + struct iwl4965_priv *priv = data; + + iwl4965_rx_allocate(priv); + iwl4965_rx_queue_restock(priv); +} + + +void iwl4965_rx_replenish(void *data) +{ + struct iwl4965_priv *priv = data; + unsigned long flags; + + iwl4965_rx_allocate(priv); spin_lock_irqsave(&priv->lock, flags); iwl4965_rx_queue_restock(priv); @@ -4689,6 +4708,8 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) u32 r, i; int reclaim; unsigned long flags; + u8 fill_rx = 0; + u32 count = 0; /* uCode's read index (stored in shared DRAM) indicates the last Rx * buffer that the driver may process (last buffer filled by ucode). */ @@ -4699,6 +4720,9 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) if (i == r) IWL_DEBUG(IWL_DL_RX | IWL_DL_ISR, "r = %d, i = %d\n", r, i); + if (iwl4965_rx_queue_space(rxq) > (RX_QUEUE_SIZE / 2)) + fill_rx = 1; + while (i != r) { rxb = rxq->queue[i]; @@ -4768,6 +4792,16 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) list_add_tail(&rxb->list, &priv->rxq.rx_used); spin_unlock_irqrestore(&rxq->lock, flags); i = (i + 1) & RX_QUEUE_MASK; + /* If there are a lot of unused frames, + * restock the Rx queue so ucode wont assert. */ + if (fill_rx) { + count++; + if (count >= 8) { + priv->rxq.read = i; + __iwl4965_rx_replenish(priv); + count = 0; + } + } } /* Backtrack one entry */ -- cgit v1.2.3-70-g09d2 From fde3571fd8613483f1203d11394ae316c6b79a03 Mon Sep 17 00:00:00 2001 From: Mohamed Abbas Date: Thu, 29 Nov 2007 11:10:15 +0800 Subject: iwlwifi: avoid firmware command sending if rfkill is enabled This patch fixed a ucode timeout issue and worked code with suspend to disk. Signed-off-by: Mohamed Abbas Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 54 ++++++++++++++++++----------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 54 ++++++++++++++++++----------- 2 files changed, 66 insertions(+), 42 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 3272608ced8..dbb6eff7b8e 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -2546,9 +2546,6 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) { - if (!iwl3945_is_ready_rf(priv)) - return -EAGAIN; - if (mode == IEEE80211_IF_TYPE_IBSS) { const struct iwl3945_channel_info *ch_info; @@ -2563,13 +2560,6 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) } } - cancel_delayed_work(&priv->scan_check); - if (iwl3945_scan_cancel_timeout(priv, 100)) { - IWL_WARNING("Aborted scan still in progress after 100ms\n"); - IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); - return -EAGAIN; - } - priv->iw_mode = mode; iwl3945_connection_init_rx_config(priv); @@ -2577,6 +2567,17 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) iwl3945_clear_stations_table(priv); + /* dont commit rxon if rf-kill is on*/ + if (!iwl3945_is_ready_rf(priv)) + return -EAGAIN; + + cancel_delayed_work(&priv->scan_check); + if (iwl3945_scan_cancel_timeout(priv, 100)) { + IWL_WARNING("Aborted scan still in progress after 100ms\n"); + IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); + return -EAGAIN; + } + iwl3945_commit_rxon(priv); return 0; @@ -7020,6 +7021,12 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw) * RXON_FILTER_ASSOC_MSK BIT */ priv->is_open = 0; + if (!iwl3945_is_ready_rf(priv)) { + IWL_DEBUG_MAC80211("leave - RF not ready\n"); + mutex_unlock(&priv->mutex); + return; + } + iwl3945_scan_cancel_timeout(priv, 100); cancel_delayed_work(&priv->post_associate); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; @@ -7291,6 +7298,9 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, priv->ibss_beacon = conf->beacon; } + if (iwl3945_is_rfkill(priv)) + goto done; + if (conf->bssid && !is_zero_ether_addr(conf->bssid) && !is_multicast_ether_addr(conf->bssid)) { /* If there is currently a HW scan going on in the background @@ -7325,6 +7335,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, iwl3945_commit_rxon(priv); } + done: spin_lock_irqsave(&priv->lock, flags); if (!conf->ssid_len) memset(priv->essid, 0, IW_ESSID_MAX_SIZE); @@ -7361,11 +7372,12 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, mutex_lock(&priv->mutex); - iwl3945_scan_cancel_timeout(priv, 100); - cancel_delayed_work(&priv->post_associate); - priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl3945_commit_rxon(priv); - + if (iwl3945_is_ready_rf(priv)) { + iwl3945_scan_cancel_timeout(priv, 100); + cancel_delayed_work(&priv->post_associate); + priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; + iwl3945_commit_rxon(priv); + } if (priv->interface_id == conf->if_id) { priv->interface_id = 0; memset(priv->bssid, 0, ETH_ALEN); @@ -7636,6 +7648,12 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) spin_unlock_irqrestore(&priv->lock, flags); + if (!iwl3945_is_ready_rf(priv)) { + IWL_DEBUG_MAC80211("leave - not ready\n"); + mutex_unlock(&priv->mutex); + return; + } + /* we are restarting association process * clear RXON_FILTER_ASSOC_MSK bit */ @@ -7653,12 +7671,6 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) return; } - if (!iwl3945_is_ready_rf(priv)) { - IWL_DEBUG_MAC80211("leave - not ready\n"); - mutex_unlock(&priv->mutex); - return; - } - priv->only_active_channel = 0; iwl3945_set_rate(priv); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 6be38ce701f..b6e9a09b7e7 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -2649,9 +2649,6 @@ static void iwl4965_connection_init_rx_config(struct iwl4965_priv *priv) static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode) { - if (!iwl4965_is_ready_rf(priv)) - return -EAGAIN; - if (mode == IEEE80211_IF_TYPE_IBSS) { const struct iwl4965_channel_info *ch_info; @@ -2666,13 +2663,6 @@ static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode) } } - cancel_delayed_work(&priv->scan_check); - if (iwl4965_scan_cancel_timeout(priv, 100)) { - IWL_WARNING("Aborted scan still in progress after 100ms\n"); - IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); - return -EAGAIN; - } - priv->iw_mode = mode; iwl4965_connection_init_rx_config(priv); @@ -2680,6 +2670,17 @@ static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode) iwl4965_clear_stations_table(priv); + /* dont commit rxon if rf-kill is on*/ + if (!iwl4965_is_ready_rf(priv)) + return -EAGAIN; + + cancel_delayed_work(&priv->scan_check); + if (iwl4965_scan_cancel_timeout(priv, 100)) { + IWL_WARNING("Aborted scan still in progress after 100ms\n"); + IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); + return -EAGAIN; + } + iwl4965_commit_rxon(priv); return 0; @@ -7458,6 +7459,12 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw) * RXON_FILTER_ASSOC_MSK BIT */ priv->is_open = 0; + if (!iwl4965_is_ready_rf(priv)) { + IWL_DEBUG_MAC80211("leave - RF not ready\n"); + mutex_unlock(&priv->mutex); + return; + } + iwl4965_scan_cancel_timeout(priv, 100); cancel_delayed_work(&priv->post_associate); priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; @@ -7743,6 +7750,9 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, priv->ibss_beacon = conf->beacon; } + if (iwl4965_is_rfkill(priv)) + goto done; + if (conf->bssid && !is_zero_ether_addr(conf->bssid) && !is_multicast_ether_addr(conf->bssid)) { /* If there is currently a HW scan going on in the background @@ -7777,6 +7787,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, iwl4965_commit_rxon(priv); } + done: spin_lock_irqsave(&priv->lock, flags); if (!conf->ssid_len) memset(priv->essid, 0, IW_ESSID_MAX_SIZE); @@ -7813,11 +7824,12 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, mutex_lock(&priv->mutex); - iwl4965_scan_cancel_timeout(priv, 100); - cancel_delayed_work(&priv->post_associate); - priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl4965_commit_rxon(priv); - + if (iwl4965_is_ready_rf(priv)) { + iwl4965_scan_cancel_timeout(priv, 100); + cancel_delayed_work(&priv->post_associate); + priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; + iwl4965_commit_rxon(priv); + } if (priv->interface_id == conf->if_id) { priv->interface_id = 0; memset(priv->bssid, 0, ETH_ALEN); @@ -8130,6 +8142,12 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) spin_unlock_irqrestore(&priv->lock, flags); + if (!iwl4965_is_ready_rf(priv)) { + IWL_DEBUG_MAC80211("leave - not ready\n"); + mutex_unlock(&priv->mutex); + return; + } + /* we are restarting association process * clear RXON_FILTER_ASSOC_MSK bit */ @@ -8147,12 +8165,6 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) return; } - if (!iwl4965_is_ready_rf(priv)) { - IWL_DEBUG_MAC80211("leave - not ready\n"); - mutex_unlock(&priv->mutex); - return; - } - priv->only_active_channel = 0; iwl4965_set_rate(priv); -- cgit v1.2.3-70-g09d2 From d128394894d6489370e4e3466e799ec9e5a705a3 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 29 Nov 2007 11:10:16 +0800 Subject: iwlwifi: update version number to 1.2.22 Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index dbb6eff7b8e..ae352daeb3f 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -91,7 +91,7 @@ int iwl3945_param_queues_num = IWL_MAX_NUM_QUEUES; /* def: 8 Tx queues */ #define VS #endif -#define IWLWIFI_VERSION "1.1.19k" VD VS +#define IWLWIFI_VERSION "1.2.22k" VD VS #define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation" #define DRV_VERSION IWLWIFI_VERSION diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index b6e9a09b7e7..6a8c629ce0b 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -90,7 +90,7 @@ int iwl4965_param_queues_num = IWL_MAX_NUM_QUEUES; /* def: 16 Tx queues */ #define VS #endif -#define IWLWIFI_VERSION "1.1.19k" VD VS +#define IWLWIFI_VERSION "1.2.22k" VD VS #define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation" #define DRV_VERSION IWLWIFI_VERSION -- cgit v1.2.3-70-g09d2 From 76bb77e03f5b01fb83fb9fa79febba6e499f948b Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 22 Nov 2007 10:53:22 +0800 Subject: iwlwifi: cache mac80211 conf setting during a hardware scan This patch caches mac80211 configuration setting during a hardware scan for the iwlwifi drivers. Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.h | 1 + drivers/net/wireless/iwlwifi/iwl-4965.h | 1 + drivers/net/wireless/iwlwifi/iwl3945-base.c | 50 +++++++++++++++++++++-------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 50 +++++++++++++++++++++-------- 4 files changed, 74 insertions(+), 28 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 462936a74c1..263b0b71c0c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -714,6 +714,7 @@ struct iwl3945_priv { struct ieee80211_hw *hw; struct ieee80211_channel *ieee_channels; struct ieee80211_rate *ieee_rates; + struct ieee80211_conf *cache_conf; /* temporary frame storage list */ struct list_head free_frames; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 42ce27f2eee..dda2bfbcb05 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -1044,6 +1044,7 @@ struct iwl4965_priv { struct ieee80211_hw *hw; struct ieee80211_channel *ieee_channels; struct ieee80211_rate *ieee_rates; + struct ieee80211_conf *cache_conf; /* temporary frame storage list */ struct list_head free_frames; diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index ae352daeb3f..bab42a1351c 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -6965,6 +6965,8 @@ static void iwl3945_bg_abort_scan(struct work_struct *work) mutex_unlock(&priv->mutex); } +static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); + static void iwl3945_bg_scan_completed(struct work_struct *work) { struct iwl3945_priv *priv = @@ -6975,6 +6977,9 @@ static void iwl3945_bg_scan_completed(struct work_struct *work) if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; + if (priv->cache_conf) + iwl3945_mac_config(priv->hw, priv->cache_conf); + ieee80211_scan_completed(priv->hw); /* Since setting the TXPOWER may have been deferred while @@ -7104,23 +7109,38 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co struct iwl3945_priv *priv = hw->priv; const struct iwl3945_channel_info *ch_info; unsigned long flags; + int ret = 0; mutex_lock(&priv->mutex); IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); if (!iwl3945_is_ready(priv)) { IWL_DEBUG_MAC80211("leave - not ready\n"); - mutex_unlock(&priv->mutex); - return -EIO; + ret = -EIO; + goto out; } /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only * what is exposed through include/ declarations */ if (unlikely(!iwl3945_param_disable_hw_scan && test_bit(STATUS_SCANNING, &priv->status))) { - IWL_DEBUG_MAC80211("leave - scanning\n"); + + if (priv->cache_conf) + IWL_DEBUG_MAC80211("leave - still scanning\n"); + else { + /* Cache the configuration now so that we can + * replay it after the hardware scan is finished. */ + priv->cache_conf = kmalloc(sizeof(*conf), GFP_KERNEL); + if (priv->cache_conf) { + memcpy(priv->cache_conf, conf, sizeof(*conf)); + IWL_DEBUG_MAC80211("leave - scanning\n"); + } else { + IWL_DEBUG_MAC80211("leave - no memory\n"); + ret = -ENOMEM; + } + } mutex_unlock(&priv->mutex); - return 0; + return ret; } spin_lock_irqsave(&priv->lock, flags); @@ -7131,8 +7151,8 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co conf->channel, conf->phymode); IWL_DEBUG_MAC80211("leave - invalid channel\n"); spin_unlock_irqrestore(&priv->lock, flags); - mutex_unlock(&priv->mutex); - return -EINVAL; + ret = -EINVAL; + goto out; } iwl3945_set_rxon_channel(priv, conf->phymode, conf->channel); @@ -7149,8 +7169,7 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co #ifdef IEEE80211_CONF_CHANNEL_SWITCH if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { iwl3945_hw_channel_switch(priv, conf->channel); - mutex_unlock(&priv->mutex); - return 0; + goto out; } #endif @@ -7158,14 +7177,13 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co if (!conf->radio_enabled) { IWL_DEBUG_MAC80211("leave - radio disabled\n"); - mutex_unlock(&priv->mutex); - return 0; + goto out; } if (iwl3945_is_rfkill(priv)) { IWL_DEBUG_MAC80211("leave - RF kill\n"); - mutex_unlock(&priv->mutex); - return -EIO; + ret = -EIO; + goto out; } iwl3945_set_rate(priv); @@ -7178,9 +7196,13 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co IWL_DEBUG_MAC80211("leave\n"); +out: + if (priv->cache_conf) { + kfree(priv->cache_conf); + priv->cache_conf = NULL; + } mutex_unlock(&priv->mutex); - - return 0; + return ret; } static void iwl3945_config_ap(struct iwl3945_priv *priv) diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 6a8c629ce0b..8bc2634bb40 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -7403,6 +7403,8 @@ static void iwl4965_bg_abort_scan(struct work_struct *work) mutex_unlock(&priv->mutex); } +static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); + static void iwl4965_bg_scan_completed(struct work_struct *work) { struct iwl4965_priv *priv = @@ -7413,6 +7415,9 @@ static void iwl4965_bg_scan_completed(struct work_struct *work) if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; + if (priv->cache_conf) + iwl4965_mac_config(priv->hw, priv->cache_conf); + ieee80211_scan_completed(priv->hw); /* Since setting the TXPOWER may have been deferred while @@ -7541,23 +7546,38 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co struct iwl4965_priv *priv = hw->priv; const struct iwl4965_channel_info *ch_info; unsigned long flags; + int ret = 0; mutex_lock(&priv->mutex); IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); if (!iwl4965_is_ready(priv)) { IWL_DEBUG_MAC80211("leave - not ready\n"); - mutex_unlock(&priv->mutex); - return -EIO; + ret = -EIO; + goto out; } /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only * what is exposed through include/ declarations */ if (unlikely(!iwl4965_param_disable_hw_scan && test_bit(STATUS_SCANNING, &priv->status))) { - IWL_DEBUG_MAC80211("leave - scanning\n"); + + if (unlikely(priv->cache_conf)) + IWL_DEBUG_MAC80211("leave - still scanning\n"); + else { + /* Cache the configuration now so that we can + * replay it after the hardware scan is finished. */ + priv->cache_conf = kmalloc(sizeof(*conf), GFP_KERNEL); + if (priv->cache_conf) { + memcpy(priv->cache_conf, conf, sizeof(*conf)); + IWL_DEBUG_MAC80211("leave - scanning\n"); + } else { + IWL_DEBUG_MAC80211("leave - no memory\n"); + ret = -ENOMEM; + } + } mutex_unlock(&priv->mutex); - return 0; + return ret; } spin_lock_irqsave(&priv->lock, flags); @@ -7568,8 +7588,8 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co conf->channel, conf->phymode); IWL_DEBUG_MAC80211("leave - invalid channel\n"); spin_unlock_irqrestore(&priv->lock, flags); - mutex_unlock(&priv->mutex); - return -EINVAL; + ret = -EINVAL; + goto out; } #ifdef CONFIG_IWL4965_HT @@ -7598,8 +7618,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co #ifdef IEEE80211_CONF_CHANNEL_SWITCH if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { iwl4965_hw_channel_switch(priv, conf->channel); - mutex_unlock(&priv->mutex); - return 0; + goto out; } #endif @@ -7607,14 +7626,13 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co if (!conf->radio_enabled) { IWL_DEBUG_MAC80211("leave - radio disabled\n"); - mutex_unlock(&priv->mutex); - return 0; + goto out; } if (iwl4965_is_rfkill(priv)) { IWL_DEBUG_MAC80211("leave - RF kill\n"); - mutex_unlock(&priv->mutex); - return -EIO; + ret = -EIO; + goto out; } iwl4965_set_rate(priv); @@ -7627,9 +7645,13 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co IWL_DEBUG_MAC80211("leave\n"); +out: + if (priv->cache_conf) { + kfree(priv->cache_conf); + priv->cache_conf = NULL; + } mutex_unlock(&priv->mutex); - - return 0; + return ret; } static void iwl4965_config_ap(struct iwl4965_priv *priv) -- cgit v1.2.3-70-g09d2 From 9e0cc6de99792151b16dbd622b11ba6607a85b72 Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Mon, 26 Nov 2007 16:14:36 +0200 Subject: iwlwifi: 802.11n new framework structures preperation This patch removes unnecessary or duplicate 802.11n data from structures in the code, and prepares them for new mac80211's 802.11n framework Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 2 +- drivers/net/wireless/iwlwifi/iwl-4965.h | 28 +++++++++++----------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 -- 3 files changed, 12 insertions(+), 20 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 218c5a355dd..b4edadf96ec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c @@ -2123,7 +2123,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, if (local->hw.conf.phymode == MODE_IEEE80211A) sta->last_txrate += IWL_FIRST_OFDM_RATE; - crl->is_dup = priv->is_dup; + crl->is_dup = 0; crl->valid_antenna = priv->valid_antenna; crl->antenna = priv->antenna; crl->is_green = rs_use_green(priv); diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index dda2bfbcb05..c0e9747ca49 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -510,22 +510,23 @@ union iwl4965_ht_rate_supp { #define CFG_HT_MPDU_DENSITY_2USEC (0x5) #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC -struct sta_ht_info { +struct iwl_ht_info { + /* self configuration data */ u8 is_ht; - u16 rx_mimo_ps_mode; + u8 supported_chan_width; u16 tx_mimo_ps_mode; - u16 control_channel; + u8 is_green_field; + u8 sgf; u8 max_amsdu_size; u8 ampdu_factor; u8 mpdu_density; - u8 operating_mode; - u8 supported_chan_width; + u8 supp_mcs_set[16]; + /* BSS related data */ + u8 control_channel; u8 extension_chan_offset; - u8 is_green_field; - u8 sgf; /* HT_SHORT_GI_* short guard interval */ - u8 supp_rates[16]; u8 tx_chan_width; - u8 chan_width_cap; + u8 ht_protection; + u8 non_GF_STA_present; }; #endif /*CONFIG_IWL4965_HT */ @@ -1142,12 +1143,6 @@ struct iwl4965_priv { u8 call_post_assoc_from_beacon; u8 assoc_station_added; u8 use_ant_b_for_management_frame; /* Tx antenna selection */ - - /* High Throughput (HT) variables */ - u8 is_dup; - u8 is_ht_enabled; - u8 channel_width; /* 0=20MHZ, 1=40MHZ supported */ - u8 current_channel_width; u8 valid_antenna; /* Bit mask of antennas actually connected */ #ifdef CONFIG_IWL4965_SENSITIVITY struct iwl4965_sensitivity_data sensitivity_data; @@ -1157,9 +1152,8 @@ struct iwl4965_priv { #endif /*CONFIG_IWL4965_SENSITIVITY*/ #ifdef CONFIG_IWL4965_HT - struct sta_ht_info current_assoc_ht; + struct iwl_ht_info current_ht_config; #endif - u8 active_rate_ht[2]; u8 last_phy_res[100]; /* Rate scaling data */ diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 8bc2634bb40..4561933acb1 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -9296,8 +9296,6 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e priv->ps_mode = 0; priv->use_ant_b_for_management_frame = 1; /* start with ant B */ - priv->is_ht_enabled = 1; - priv->channel_width = IWL_CHANNEL_WIDTH_40MHZ; priv->valid_antenna = 0x7; /* assume all 3 connected */ priv->ps_mode = IWL_MIMO_PS_NONE; -- cgit v1.2.3-70-g09d2 From 326eeee807ca7ed4489cb21d4ebe8e52079c11c3 Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Mon, 26 Nov 2007 16:14:37 +0200 Subject: iwlwifi: 802.11n configuring hw_mode parameters to support HT in A/G This patch fills the mac80211's ieee80211_hw_mode structures with the needed 802.11n data needed for the new framework Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965.c | 24 ++++++++++++++++++++++++ drivers/net/wireless/iwlwifi/iwl-4965.h | 2 ++ drivers/net/wireless/iwlwifi/iwl4965-base.c | 24 +++++++----------------- 3 files changed, 33 insertions(+), 17 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index c8e7adfe414..fbabcb0394d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -3768,6 +3768,30 @@ static int parse_elems(u8 *start, size_t len, struct ieee802_11_elems *elems) return 0; } + +void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info, int mode) +{ + ht_info->cap = 0; + memset(ht_info->supp_mcs_set, 0, 16); + + ht_info->ht_supported = 1; + + if (mode == MODE_IEEE80211A) { + ht_info->cap |= (u16)IEEE80211_HT_CAP_SUP_WIDTH; + ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_40; + ht_info->supp_mcs_set[4] = 0x01; + } + ht_info->cap |= (u16)IEEE80211_HT_CAP_GRN_FLD; + ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_20; + ht_info->cap |= (u16)(IEEE80211_HT_CAP_MIMO_PS & + (IWL_MIMO_PS_NONE << 2)); + + ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; + ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF; + + ht_info->supp_mcs_set[0] = 0xFF; + ht_info->supp_mcs_set[1] = 0xFF; +} #endif /* CONFIG_IWL4965_HT */ static void iwl4965_sta_modify_ps_wake(struct iwl4965_priv *priv, int sta_id) diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index c0e9747ca49..5fd01149ebf 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -801,6 +801,8 @@ extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode, extern void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv); #ifdef CONFIG_IWL4965_HT +extern void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info, + int mode); #ifdef CONFIG_IWL4965_HT_AGG extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, u16 *start_seq_num); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 4561933acb1..d88363e766c 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -5822,10 +5822,8 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) A = 0, B = 1, G = 2, - A_11N = 3, - G_11N = 4, }; - int mode_count = 5; + int mode_count = 3; if (priv->modes) { IWL_DEBUG_INFO("Geography modes already initialized.\n"); @@ -5865,6 +5863,9 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) modes[A].num_rates = 8; /* just OFDM */ modes[A].rates = &rates[4]; modes[A].num_channels = 0; +#ifdef CONFIG_IWL4965_HT + iwl4965_init_ht_hw_capab(&modes[A].ht_info, MODE_IEEE80211A); +#endif modes[B].mode = MODE_IEEE80211B; modes[B].channels = channels; @@ -5877,18 +5878,9 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) modes[G].rates = rates; modes[G].num_rates = 12; /* OFDM & CCK */ modes[G].num_channels = 0; - - modes[G_11N].mode = MODE_IEEE80211G; - modes[G_11N].channels = channels; - modes[G_11N].num_rates = 13; /* OFDM & CCK */ - modes[G_11N].rates = rates; - modes[G_11N].num_channels = 0; - - modes[A_11N].mode = MODE_IEEE80211A; - modes[A_11N].channels = &channels[ARRAY_SIZE(iwl4965_eeprom_band_1)]; - modes[A_11N].rates = &rates[4]; - modes[A_11N].num_rates = 9; /* just OFDM */ - modes[A_11N].num_channels = 0; +#ifdef CONFIG_IWL4965_HT + iwl4965_init_ht_hw_capab(&modes[G].ht_info, MODE_IEEE80211G); +#endif priv->ieee_channels = channels; priv->ieee_rates = rates; @@ -5908,11 +5900,9 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) if (is_channel_a_band(ch)) { geo_ch = &modes[A].channels[modes[A].num_channels++]; - modes[A_11N].num_channels++; } else { geo_ch = &modes[B].channels[modes[B].num_channels++]; modes[G].num_channels++; - modes[G_11N].num_channels++; } geo_ch->freq = ieee80211chan2mhz(ch->channel); -- cgit v1.2.3-70-g09d2 From 8fb8803239debda77b90f7e4a5098067187d865e Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Mon, 26 Nov 2007 16:14:38 +0200 Subject: iwlwifi: 802.11n handling probe request HT IE This patch conforms the probe request's HT IE with the new structures used in iwlwifi HT. Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl4965-base.c | 62 +++++++++++++---------------- 1 file changed, 28 insertions(+), 34 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index d88363e766c..c2366c2d23b 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -1875,8 +1875,8 @@ static u16 iwl4965_supported_rate_to_ie(u8 *ie, u16 supported_rate, #ifdef CONFIG_IWL4965_HT void static iwl4965_set_ht_capab(struct ieee80211_hw *hw, - struct ieee80211_ht_capability *ht_cap, - u8 use_wide_chan); + struct ieee80211_ht_cap *ht_cap, + u8 use_current_config); #endif /** @@ -1889,6 +1889,9 @@ static u16 iwl4965_fill_probe_req(struct iwl4965_priv *priv, int len = 0; u8 *pos = NULL; u16 active_rates, ret_rates, cck_rates, active_rate_basic; +#ifdef CONFIG_IWL4965_HT + struct ieee80211_hw_mode *mode; +#endif /* CONFIG_IWL4965_HT */ /* Make sure there is enough space for the probe request, * two mandatory IEs and the data */ @@ -1972,17 +1975,14 @@ static u16 iwl4965_fill_probe_req(struct iwl4965_priv *priv, len += 2 + *pos; #ifdef CONFIG_IWL4965_HT - if (is_direct && priv->is_ht_enabled) { - u8 use_wide_chan = 1; - - if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ) - use_wide_chan = 0; + mode = priv->hw->conf.mode; + if (mode->ht_info.ht_supported) { pos += (*pos) + 1; *pos++ = WLAN_EID_HT_CAPABILITY; - *pos++ = sizeof(struct ieee80211_ht_capability); - iwl4965_set_ht_capab(NULL, (struct ieee80211_ht_capability *)pos, - use_wide_chan); - len += 2 + sizeof(struct ieee80211_ht_capability); + *pos++ = sizeof(struct ieee80211_ht_cap); + iwl4965_set_ht_capab(priv->hw, + (struct ieee80211_ht_cap *)pos, 0); + len += 2 + sizeof(struct ieee80211_ht_cap); } #endif /*CONFIG_IWL4965_HT */ @@ -8379,31 +8379,25 @@ static int iwl4965_mac_conf_ht(struct ieee80211_hw *hw, } static void iwl4965_set_ht_capab(struct ieee80211_hw *hw, - struct ieee80211_ht_capability *ht_cap, - u8 use_wide_chan) + struct ieee80211_ht_cap *ht_cap, + u8 use_current_config) { - union ht_cap_info cap; - union ht_param_info param_info; + struct ieee80211_conf *conf = &hw->conf; + struct ieee80211_hw_mode *mode = conf->mode; - memset(&cap, 0, sizeof(union ht_cap_info)); - memset(¶m_info, 0, sizeof(union ht_param_info)); - - cap.maximal_amsdu_size = HT_IE_MAX_AMSDU_SIZE_4K; - cap.green_field = 1; - cap.short_GI20 = 1; - cap.short_GI40 = 1; - cap.supported_chan_width_set = use_wide_chan; - cap.mimo_power_save_mode = 0x3; - - param_info.max_rx_ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; - param_info.mpdu_density = CFG_HT_MPDU_DENSITY_DEF; - ht_cap->capabilities_info = (__le16) cpu_to_le16(cap.val); - ht_cap->mac_ht_params_info = (u8) param_info.val; - - ht_cap->supported_mcs_set[0] = 0xff; - ht_cap->supported_mcs_set[1] = 0xff; - ht_cap->supported_mcs_set[4] = - (cap.supported_chan_width_set) ? 0x1: 0x0; + if (use_current_config) { + ht_cap->cap_info = cpu_to_le16(conf->ht_conf.cap); + memcpy(ht_cap->supp_mcs_set, + conf->ht_conf.supp_mcs_set, 16); + } else { + ht_cap->cap_info = cpu_to_le16(mode->ht_info.cap); + memcpy(ht_cap->supp_mcs_set, + mode->ht_info.supp_mcs_set, 16); + } + ht_cap->ampdu_params_info = + (mode->ht_info.ampdu_factor & IEEE80211_HT_CAP_AMPDU_FACTOR) | + ((mode->ht_info.ampdu_density << 2) & + IEEE80211_HT_CAP_AMPDU_DENSITY); } static void iwl4965_mac_get_ht_capab(struct ieee80211_hw *hw, -- cgit v1.2.3-70-g09d2 From fd105e79d19439d29a6561178fb5fe511e141f6b Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Mon, 26 Nov 2007 16:14:39 +0200 Subject: iwlwifi: 802.11n comply HT self configuration flow with mac80211 framework This patch conforms HW configuration changes according to new mac80211's HT framework Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965.c | 40 +++--- drivers/net/wireless/iwlwifi/iwl-4965.h | 6 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 186 +++++++--------------------- 3 files changed, 66 insertions(+), 166 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index fbabcb0394d..2724208aca7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -87,8 +87,8 @@ static int is_fat_channel(__le32 rxon_flags) static u8 is_single_stream(struct iwl4965_priv *priv) { #ifdef CONFIG_IWL4965_HT - if (!priv->is_ht_enabled || !priv->current_assoc_ht.is_ht || - (priv->active_rate_ht[1] == 0) || + if (!priv->current_ht_config.is_ht || + (priv->current_ht_config.supp_mcs_set[1] == 0) || (priv->ps_mode == IWL_MIMO_PS_STATIC)) return 1; #else @@ -4541,27 +4541,27 @@ static u8 iwl4965_is_channel_extension(struct iwl4965_priv *priv, int phymode, } static u8 iwl4965_is_fat_tx_allowed(struct iwl4965_priv *priv, - const struct sta_ht_info *ht_info) + struct ieee80211_ht_info *sta_ht_inf) { + struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config; - if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ) + if ((!iwl_ht_conf->is_ht) || + (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ) || + (iwl_ht_conf->extension_chan_offset == IWL_EXT_CHANNEL_OFFSET_AUTO)) return 0; - if (ht_info->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ) - return 0; - - if (ht_info->extension_chan_offset == IWL_EXT_CHANNEL_OFFSET_AUTO) - return 0; + if (sta_ht_inf) { + if ((!sta_ht_inf->ht_supported) || + (!sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH)) + return 0; + } - /* no fat tx allowed on 2.4GHZ */ - if (priv->phymode != MODE_IEEE80211A) - return 0; return (iwl4965_is_channel_extension(priv, priv->phymode, - ht_info->control_channel, - ht_info->extension_chan_offset)); + iwl_ht_conf->control_channel, + iwl_ht_conf->extension_chan_offset)); } -void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct sta_ht_info *ht_info) +void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct iwl_ht_info *ht_info) { struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; u32 val; @@ -4570,7 +4570,7 @@ void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct sta_ht_info *ht_info) return; /* Set up channel bandwidth: 20 MHz only, or 20/40 mixed if fat ok */ - if (iwl4965_is_fat_tx_allowed(priv, ht_info)) + if (iwl4965_is_fat_tx_allowed(priv, NULL)) rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED_MSK; else rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK | @@ -4600,20 +4600,18 @@ void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct sta_ht_info *ht_info) break; } - val = ht_info->operating_mode; + val = ht_info->ht_protection; rxon->flags |= cpu_to_le32(val << RXON_FLG_HT_OPERATING_MODE_POS); - priv->active_rate_ht[0] = ht_info->supp_rates[0]; - priv->active_rate_ht[1] = ht_info->supp_rates[1]; iwl4965_set_rxon_chain(priv); IWL_DEBUG_ASSOC("supported HT rate 0x%X %X " "rxon flags 0x%X operation mode :0x%X " "extension channel offset 0x%x " "control chan %d\n", - priv->active_rate_ht[0], priv->active_rate_ht[1], - le32_to_cpu(rxon->flags), ht_info->operating_mode, + ht_info->supp_mcs_set[0], ht_info->supp_mcs_set[1], + le32_to_cpu(rxon->flags), ht_info->ht_protection, ht_info->extension_chan_offset, ht_info->control_channel); return; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 5fd01149ebf..6fdfb4a3be9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -766,7 +766,6 @@ extern int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel); extern int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index); struct iwl4965_priv; -struct sta_ht_info; /* * Forward declare iwl-4965.c functions for iwl-base.c @@ -779,9 +778,6 @@ extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv, u16 byte_cnt); extern void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap); -extern void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, - struct sta_ht_info *ht_info); - extern void iwl4965_set_rxon_chain(struct iwl4965_priv *priv); extern int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd, u8 sta_id, dma_addr_t txcmd_phys, @@ -803,6 +799,8 @@ extern void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv); #ifdef CONFIG_IWL4965_HT extern void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info, int mode); +extern void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, + struct iwl_ht_info *ht_info); #ifdef CONFIG_IWL4965_HT_AGG extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, u16 *start_seq_num); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index c2366c2d23b..2c706395e0a 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -2111,7 +2111,7 @@ static void iwl4965_activate_qos(struct iwl4965_priv *priv, u8 force) QOS_PARAM_FLG_UPDATE_EDCA_MSK; #ifdef CONFIG_IWL4965_HT - if (priv->is_ht_enabled && priv->current_assoc_ht.is_ht) + if (priv->current_ht_config.is_ht) priv->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; #endif /* CONFIG_IWL4965_HT */ @@ -7304,13 +7304,8 @@ static void iwl4965_bg_post_associate(struct work_struct *data) priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; #ifdef CONFIG_IWL4965_HT - if (priv->is_ht_enabled && priv->current_assoc_ht.is_ht) - iwl4965_set_rxon_ht(priv, &priv->current_assoc_ht); - else { - priv->active_rate_ht[0] = 0; - priv->active_rate_ht[1] = 0; - priv->current_channel_width = IWL_CHANNEL_WIDTH_20MHZ; - } + if (priv->current_ht_config.is_ht) + iwl4965_set_rxon_ht(priv, &priv->current_ht_config); #endif /* CONFIG_IWL4965_HT*/ iwl4965_set_rxon_chain(priv); priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); @@ -8112,7 +8107,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) priv->lq_mngr.lq_ready = 0; #ifdef CONFIG_IWL4965_HT spin_lock_irqsave(&priv->lock, flags); - memset(&priv->current_assoc_ht, 0, sizeof(struct sta_ht_info)); + memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_info)); spin_unlock_irqrestore(&priv->lock, flags); #ifdef CONFIG_IWL4965_HT_AGG /* if (priv->lq_mngr.agg_ctrl.granted_ba) @@ -8232,132 +8227,61 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk } #ifdef CONFIG_IWL4965_HT -union ht_cap_info { - struct { - u16 advanced_coding_cap :1; - u16 supported_chan_width_set :1; - u16 mimo_power_save_mode :2; - u16 green_field :1; - u16 short_GI20 :1; - u16 short_GI40 :1; - u16 tx_stbc :1; - u16 rx_stbc :1; - u16 beam_forming :1; - u16 delayed_ba :1; - u16 maximal_amsdu_size :1; - u16 cck_mode_at_40MHz :1; - u16 psmp_support :1; - u16 stbc_ctrl_frame_support :1; - u16 sig_txop_protection_support :1; - }; - u16 val; -} __attribute__ ((packed)); - -union ht_param_info{ - struct { - u8 max_rx_ampdu_factor :2; - u8 mpdu_density :3; - u8 reserved :3; - }; - u8 val; -} __attribute__ ((packed)); - -union ht_exra_param_info { - struct { - u8 ext_chan_offset :2; - u8 tx_chan_width :1; - u8 rifs_mode :1; - u8 controlled_access_only :1; - u8 service_interval_granularity :3; - }; - u8 val; -} __attribute__ ((packed)); - -union ht_operation_mode{ - struct { - u16 op_mode :2; - u16 non_GF :1; - u16 reserved :13; - }; - u16 val; -} __attribute__ ((packed)); - -static int sta_ht_info_init(struct ieee80211_ht_capability *ht_cap, - struct ieee80211_ht_additional_info *ht_extra, - struct sta_ht_info *ht_info_ap, - struct sta_ht_info *ht_info) +static void iwl4965_ht_info_fill(struct ieee80211_conf *conf, + struct iwl4965_priv *priv) { - union ht_cap_info cap; - union ht_operation_mode op_mode; - union ht_param_info param_info; - union ht_exra_param_info extra_param_info; + struct iwl_ht_info *iwl_conf = &priv->current_ht_config; + struct ieee80211_ht_info *ht_conf = &conf->ht_conf; + struct ieee80211_ht_bss_info *ht_bss_conf = &conf->ht_bss_conf; IWL_DEBUG_MAC80211("enter: \n"); - if (!ht_info) { - IWL_DEBUG_MAC80211("leave: ht_info is NULL\n"); - return -1; + if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)) { + iwl_conf->is_ht = 0; + return; } - if (ht_cap) { - cap.val = (u16) le16_to_cpu(ht_cap->capabilities_info); - param_info.val = ht_cap->mac_ht_params_info; - ht_info->is_ht = 1; - if (cap.short_GI20) - ht_info->sgf |= 0x1; - if (cap.short_GI40) - ht_info->sgf |= 0x2; - ht_info->is_green_field = cap.green_field; - ht_info->max_amsdu_size = cap.maximal_amsdu_size; - ht_info->supported_chan_width = cap.supported_chan_width_set; - ht_info->tx_mimo_ps_mode = cap.mimo_power_save_mode; - memcpy(ht_info->supp_rates, ht_cap->supported_mcs_set, 16); - - ht_info->ampdu_factor = param_info.max_rx_ampdu_factor; - ht_info->mpdu_density = param_info.mpdu_density; - - IWL_DEBUG_MAC80211("SISO mask 0x%X MIMO mask 0x%X \n", - ht_cap->supported_mcs_set[0], - ht_cap->supported_mcs_set[1]); - - if (ht_info_ap) { - ht_info->control_channel = ht_info_ap->control_channel; - ht_info->extension_chan_offset = - ht_info_ap->extension_chan_offset; - ht_info->tx_chan_width = ht_info_ap->tx_chan_width; - ht_info->operating_mode = ht_info_ap->operating_mode; - } - - if (ht_extra) { - extra_param_info.val = ht_extra->ht_param; - ht_info->control_channel = ht_extra->control_chan; - ht_info->extension_chan_offset = - extra_param_info.ext_chan_offset; - ht_info->tx_chan_width = extra_param_info.tx_chan_width; - op_mode.val = (u16) - le16_to_cpu(ht_extra->operation_mode); - ht_info->operating_mode = op_mode.op_mode; - IWL_DEBUG_MAC80211("control channel %d\n", - ht_extra->control_chan); - } - } else - ht_info->is_ht = 0; - + iwl_conf->is_ht = 1; + priv->ps_mode = (u8)((ht_conf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2); + + if (ht_conf->cap & IEEE80211_HT_CAP_SGI_20) + iwl_conf->sgf |= 0x1; + if (ht_conf->cap & IEEE80211_HT_CAP_SGI_40) + iwl_conf->sgf |= 0x2; + + iwl_conf->is_green_field = !!(ht_conf->cap & IEEE80211_HT_CAP_GRN_FLD); + iwl_conf->max_amsdu_size = + !!(ht_conf->cap & IEEE80211_HT_CAP_MAX_AMSDU); + iwl_conf->supported_chan_width = + !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH); + iwl_conf->tx_mimo_ps_mode = + (u8)((ht_conf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2); + memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16); + + iwl_conf->control_channel = ht_bss_conf->primary_channel; + iwl_conf->extension_chan_offset = + ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_SEC_OFFSET; + iwl_conf->tx_chan_width = + !!(ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_WIDTH); + iwl_conf->ht_protection = + ht_bss_conf->bss_op_mode & IEEE80211_HT_IE_HT_PROTECTION; + iwl_conf->non_GF_STA_present = + !!(ht_bss_conf->bss_op_mode & IEEE80211_HT_IE_NON_GF_STA_PRSNT); + + IWL_DEBUG_MAC80211("control channel %d\n", + iwl_conf->control_channel); IWL_DEBUG_MAC80211("leave\n"); - return 0; } static int iwl4965_mac_conf_ht(struct ieee80211_hw *hw, - struct ieee80211_ht_capability *ht_cap, - struct ieee80211_ht_additional_info *ht_extra) + struct ieee80211_conf *conf) { struct iwl4965_priv *priv = hw->priv; - int rs; IWL_DEBUG_MAC80211("enter: \n"); - rs = sta_ht_info_init(ht_cap, ht_extra, NULL, &priv->current_assoc_ht); + iwl4965_ht_info_fill(conf, priv); iwl4965_set_rxon_chain(priv); if (priv && priv->assoc_id && @@ -8372,10 +8296,8 @@ static int iwl4965_mac_conf_ht(struct ieee80211_hw *hw, spin_unlock_irqrestore(&priv->lock, flags); } - IWL_DEBUG_MAC80211("leave: control channel %d\n", - ht_extra->control_chan); - return rs; - + IWL_DEBUG_MAC80211("leave:\n"); + return 0; } static void iwl4965_set_ht_capab(struct ieee80211_hw *hw, @@ -8400,23 +8322,6 @@ static void iwl4965_set_ht_capab(struct ieee80211_hw *hw, IEEE80211_HT_CAP_AMPDU_DENSITY); } -static void iwl4965_mac_get_ht_capab(struct ieee80211_hw *hw, - struct ieee80211_ht_capability *ht_cap) -{ - u8 use_wide_channel = 1; - struct iwl4965_priv *priv = hw->priv; - - IWL_DEBUG_MAC80211("enter: \n"); - if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ) - use_wide_channel = 0; - - /* no fat tx allowed on 2.4GHZ */ - if (priv->phymode != MODE_IEEE80211A) - use_wide_channel = 0; - - iwl4965_set_ht_capab(hw, ht_cap, use_wide_channel); - IWL_DEBUG_MAC80211("leave: \n"); -} #endif /*CONFIG_IWL4965_HT*/ /***************************************************************************** @@ -9134,7 +9039,6 @@ static struct ieee80211_ops iwl4965_hw_ops = { .erp_ie_changed = iwl4965_mac_erp_ie_changed, #ifdef CONFIG_IWL4965_HT .conf_ht = iwl4965_mac_conf_ht, - .get_ht_capab = iwl4965_mac_get_ht_capab, #ifdef CONFIG_IWL4965_HT_AGG .ht_tx_agg_start = iwl4965_mac_ht_tx_agg_start, .ht_tx_agg_stop = iwl4965_mac_ht_tx_agg_stop, -- cgit v1.2.3-70-g09d2 From 67d620357a186adc0f4e7d1f5b095ea2c77e7072 Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Mon, 26 Nov 2007 16:14:40 +0200 Subject: iwlwifi: 802.11n comply HT add station flow with mac80211 framework This patch conforms the addition of a new station to the iwlwifi station table according to the new mac80211's HT framework Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 8 ++++---- drivers/net/wireless/iwlwifi/iwl-4965.c | 28 +++++++++++----------------- drivers/net/wireless/iwlwifi/iwl-4965.h | 8 ++++---- drivers/net/wireless/iwlwifi/iwl4965-base.c | 23 +++++++++++++++++++---- 4 files changed, 38 insertions(+), 29 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index b4edadf96ec..503b9174516 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c @@ -2023,8 +2023,8 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, if (sta_id == IWL_INVALID_STATION) { IWL_DEBUG_RATE("LQ: ADD station %s\n", print_mac(mac, hdr->addr1)); - sta_id = iwl4965_add_station_flags(priv, - hdr->addr1, 0, CMD_ASYNC); + sta_id = iwl4965_add_station_flags(priv, hdr->addr1, + 0, CMD_ASYNC, NULL); } if ((sta_id != IWL_INVALID_STATION)) { lq->lq.sta_id = sta_id; @@ -2101,8 +2101,8 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, if (sta_id == IWL_INVALID_STATION) { IWL_DEBUG_RATE("LQ: ADD station %s\n", print_mac(mac, sta->addr)); - sta_id = iwl4965_add_station_flags(priv, - sta->addr, 0, CMD_ASYNC); + sta_id = iwl4965_add_station_flags(priv, sta->addr, + 0, CMD_ASYNC, NULL); } if ((sta_id != IWL_INVALID_STATION)) { crl->lq.sta_id = sta_id; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 2724208aca7..55d61000e34 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -4617,39 +4617,33 @@ void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct iwl_ht_info *ht_info) return; } -void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index) +void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index, + struct ieee80211_ht_info *sta_ht_inf) { __le32 sta_flags; - struct sta_ht_info *ht_info = &priv->current_assoc_ht; - priv->current_channel_width = IWL_CHANNEL_WIDTH_20MHZ; - if (!ht_info->is_ht) + if (!sta_ht_inf || !sta_ht_inf->ht_supported) goto done; sta_flags = priv->stations[index].sta.station_flags; - if (ht_info->tx_mimo_ps_mode == IWL_MIMO_PS_DYNAMIC) + if (((sta_ht_inf->cap & IEEE80211_HT_CAP_MIMO_PS >> 2)) + == IWL_MIMO_PS_DYNAMIC) sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK; else sta_flags &= ~STA_FLG_RTS_MIMO_PROT_MSK; sta_flags |= cpu_to_le32( - (u32)ht_info->ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS); + (u32)sta_ht_inf->ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS); sta_flags |= cpu_to_le32( - (u32)ht_info->mpdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); - - sta_flags &= (~STA_FLG_FAT_EN_MSK); - ht_info->tx_chan_width = IWL_CHANNEL_WIDTH_20MHZ; - ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_20MHZ; + (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); - if (iwl4965_is_fat_tx_allowed(priv, ht_info)) { + if (iwl4965_is_fat_tx_allowed(priv, sta_ht_inf)) sta_flags |= STA_FLG_FAT_EN_MSK; - ht_info->chan_width_cap = IWL_CHANNEL_WIDTH_40MHZ; - if (ht_info->supported_chan_width == IWL_CHANNEL_WIDTH_40MHZ) - ht_info->tx_chan_width = IWL_CHANNEL_WIDTH_40MHZ; - } - priv->current_channel_width = ht_info->tx_chan_width; + else + sta_flags &= (~STA_FLG_FAT_EN_MSK); + priv->stations[index].sta.station_flags = sta_flags; done: return; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 6fdfb4a3be9..50209e6cdd0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -649,8 +649,8 @@ struct iwl4965_driver_hw_info { struct iwl4965_addsta_cmd; extern int iwl4965_send_add_station(struct iwl4965_priv *priv, struct iwl4965_addsta_cmd *sta, u8 flags); -extern u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *bssid, - int is_ap, u8 flags); +extern u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, + int is_ap, u8 flags, void *ht_data); extern int iwl4965_is_network_packet(struct iwl4965_priv *priv, struct ieee80211_hdr *header); extern int iwl4965_power_init_handle(struct iwl4965_priv *priv); @@ -785,8 +785,6 @@ extern int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd struct ieee80211_tx_control *ctrl, void *sta_in); extern int iwl4965_alive_notify(struct iwl4965_priv *priv); extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode); -extern void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index); - extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv); extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags, u8 force); @@ -801,6 +799,8 @@ extern void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info, int mode); extern void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct iwl_ht_info *ht_info); +extern void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index, + struct ieee80211_ht_info *sta_ht_inf); #ifdef CONFIG_IWL4965_HT_AGG extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, u16 *start_seq_num); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 2c706395e0a..9f89f596283 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -497,7 +497,8 @@ static void iwl4965_clear_stations_table(struct iwl4965_priv *priv) /** * iwl4965_add_station_flags - Add station to tables in driver and device */ -u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, int is_ap, u8 flags) +u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, + int is_ap, u8 flags, void *ht_data) { int i; int index = IWL_INVALID_STATION; @@ -554,7 +555,8 @@ u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, int is_a /* BCAST station and IBSS stations do not work in HT mode */ if (index != priv->hw_setting.bcast_sta_id && priv->iw_mode != IEEE80211_IF_TYPE_IBSS) - iwl4965_set_ht_add_station(priv, index); + iwl4965_set_ht_add_station(priv, index, + (struct ieee80211_ht_info *) ht_data); #endif /*CONFIG_IWL4965_HT*/ spin_unlock_irqrestore(&priv->sta_lock, flags_spin); @@ -900,7 +902,19 @@ static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, u8 sta_id; /* Add station to device's station table */ - sta_id = iwl4965_add_station_flags(priv, addr, is_ap, 0); +#ifdef CONFIG_IWL4965_HT + struct ieee80211_conf *conf = &priv->hw->conf; + struct ieee80211_ht_info *cur_ht_config = &conf->ht_conf; + + if ((is_ap) && + (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) && + (priv->iw_mode == IEEE80211_IF_TYPE_STA)) + sta_id = iwl4965_add_station_flags(priv, addr, is_ap, + 0, cur_ht_config); + else +#endif /* CONFIG_IWL4965_HT */ + sta_id = iwl4965_add_station_flags(priv, addr, is_ap, + 0, NULL); /* Set up default rate scaling table in device's station table */ iwl4965_add_station(priv, addr, is_ap); @@ -2834,7 +2848,8 @@ static int iwl4965_get_sta_id(struct iwl4965_priv *priv, return sta_id; /* Create new station table entry */ - sta_id = iwl4965_add_station_flags(priv, hdr->addr1, 0, CMD_ASYNC); + sta_id = iwl4965_add_station_flags(priv, hdr->addr1, + 0, CMD_ASYNC, NULL); if (sta_id != IWL_INVALID_STATION) return sta_id; -- cgit v1.2.3-70-g09d2 From 9ee1ba474fc37bcaf6a958bf7e995006fc69893b Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Mon, 26 Nov 2007 16:14:42 +0200 Subject: iwlwifi: 802.11n add support to 8K A-MSDU Rx frames This patch give the iwlwifi the ability to support A-MSDU up to 8K Please notice - in order to work in 8K A-MSDU ucode support is needed, version 4.44.1.19 (soon to be published). 4K A-MSDU works in current ucode version as well. Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 3 --- drivers/net/wireless/iwlwifi/iwl-3945.c | 3 ++- drivers/net/wireless/iwlwifi/iwl-3945.h | 31 +++++++++++++++++++++++++++-- drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 11 +++++++--- drivers/net/wireless/iwlwifi/iwl-4965.c | 20 ++++++++++++++++--- drivers/net/wireless/iwlwifi/iwl-4965.h | 5 +++-- drivers/net/wireless/iwlwifi/iwl4965-base.c | 21 ++++++++++++------- 7 files changed, 73 insertions(+), 21 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h index ec619533fcd..2c955a6070f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h @@ -646,9 +646,6 @@ struct iwl3945_eeprom { #define RX_FREE_BUFFERS 64 #define RX_LOW_WATERMARK 8 -/* Size of one Rx buffer in host DRAM */ -#define IWL_RX_BUF_SIZE 3000 - /* Sizes and addresses for instruction and data memory (SRAM) in * 3945's embedded processor. Driver access is via HBUS_TARG_MEM_* regs. */ #define RTC_INST_LOWER_BOUND (0x000000) diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 1b81545b94e..7d15b33b9dc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -2229,7 +2229,8 @@ int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv) } priv->hw_setting.ac_queue_count = AC_NUM; - priv->hw_setting.rx_buffer_size = IWL_RX_BUF_SIZE; + priv->hw_setting.rx_buf_size = IWL_RX_BUF_SIZE; + priv->hw_setting.max_pkt_size = 2342; priv->hw_setting.tx_cmd_len = sizeof(struct iwl3945_tx_cmd); priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE; priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG; diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 263b0b71c0c..709203a4198 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -75,6 +75,7 @@ enum iwl3945_antenna { * else RTS for data/management frames where MPDU is larger * than RTS value. */ +#define IWL_RX_BUF_SIZE 3000U #define DEFAULT_RTS_THRESHOLD 2347U #define MIN_RTS_THRESHOLD 0U #define MAX_RTS_THRESHOLD 2347U @@ -452,6 +453,30 @@ union iwl3945_ht_rate_supp { }; }; +#ifdef CONFIG_IWL3945_HT +#define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) +#define CFG_HT_MPDU_DENSITY_2USEC (0x5) +#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC + +struct sta_ht_info { + u8 is_ht; + u16 rx_mimo_ps_mode; + u16 tx_mimo_ps_mode; + u16 control_channel; + u8 max_amsdu_size; + u8 ampdu_factor; + u8 mpdu_density; + u8 operating_mode; + u8 supported_chan_width; + u8 extension_chan_offset; + u8 is_green_field; + u8 sgf; + u8 supp_rates[16]; + u8 tx_chan_width; + u8 chan_width_cap; +}; +#endif /*CONFIG_IWL3945_HT */ + #ifdef CONFIG_IWL3945_QOS union iwl3945_qos_capabity { @@ -535,7 +560,8 @@ struct iwl3945_ibss_seq { * @ac_queue_count: # Tx queues for EDCA Access Categories (AC) * @tx_cmd_len: Size of Tx command (but not including frame itself) * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2) - * @rx_buffer_size: + * @rx_buf_size: + * @max_pkt_size: * @max_rxq_log: Log-base-2 of max_rxq_size * @max_stations: * @bcast_sta_id: @@ -547,7 +573,8 @@ struct iwl3945_driver_hw_info { u16 ac_queue_count; u16 tx_cmd_len; u16 max_rxq_size; - u32 rx_buffer_size; + u32 rx_buf_size; + u32 max_pkt_size; u16 max_rxq_log; u8 max_stations; u8 bcast_sta_id; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index d5d418e6192..7e7d6e497e0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h @@ -609,7 +609,8 @@ struct iwl4965_eeprom { #define RX_LOW_WATERMARK 8 /* Size of one Rx buffer in host DRAM */ -#define IWL_RX_BUF_SIZE (4 * 1024) +#define IWL_RX_BUF_SIZE_4K (4 * 1024) +#define IWL_RX_BUF_SIZE_8K (8 * 1024) /* Sizes and addresses for instruction and data memory (SRAM) in * 4965's embedded processor. Driver access is via HBUS_TARG_MEM_* regs. */ @@ -1457,13 +1458,17 @@ enum { #define FH_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MASK (0xC0000000) /* bits 30-31 */ #define FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT (20) -#define FH_RCSR_RX_CONFIG_RB_SIZE_BITSHIFT (16) +#define FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_BITSHIFT (4) +#define RX_RB_TIMEOUT (0x10) #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000) #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000) #define FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL (0x80000000) -#define IWL_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000) +#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000) +#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K (0x00010000) +#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_12K (0x00020000) +#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_16K (0x00030000) #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 55d61000e34..f65fd6e5fec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -226,6 +226,7 @@ static int iwl4965_rx_init(struct iwl4965_priv *priv, struct iwl4965_rx_queue *r { int rc; unsigned long flags; + unsigned int rb_size; spin_lock_irqsave(&priv->lock, flags); rc = iwl4965_grab_nic_access(priv); @@ -234,6 +235,11 @@ static int iwl4965_rx_init(struct iwl4965_priv *priv, struct iwl4965_rx_queue *r return rc; } + if (iwl4965_param_amsdu_size_8K) + rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K; + else + rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K; + /* Stop Rx DMA */ iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); @@ -253,7 +259,7 @@ static int iwl4965_rx_init(struct iwl4965_priv *priv, struct iwl4965_rx_queue *r iwl4965_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | - IWL_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K | + rb_size | /*0x10 << 4 | */ (RX_QUEUE_SIZE_LOG << FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT)); @@ -1771,7 +1777,11 @@ int iwl4965_hw_set_hw_setting(struct iwl4965_priv *priv) priv->hw_setting.tx_cmd_len = sizeof(struct iwl4965_tx_cmd); priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE; priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG; - + if (iwl4965_param_amsdu_size_8K) + priv->hw_setting.rx_buf_size = IWL_RX_BUF_SIZE_8K; + else + priv->hw_setting.rx_buf_size = IWL_RX_BUF_SIZE_4K; + priv->hw_setting.max_pkt_size = priv->hw_setting.rx_buf_size - 256; priv->hw_setting.max_stations = IWL4965_STATION_COUNT; priv->hw_setting.bcast_sta_id = IWL4965_BROADCAST_ID; return 0; @@ -3619,7 +3629,7 @@ static void iwl4965_handle_data_packet(struct iwl4965_priv *priv, int is_data, rx_start->byte_count = amsdu->byte_count; rx_end = (__le32 *) (((u8 *) hdr) + len); } - if (len > IWL_RX_BUF_SIZE || len < 16) { + if (len > priv->hw_setting.max_pkt_size || len < 16) { IWL_WARNING("byte count out of range [16,4K]" " : %d\n", len); return; @@ -3785,6 +3795,10 @@ void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info, int mode) ht_info->cap |= (u16)IEEE80211_HT_CAP_SGI_20; ht_info->cap |= (u16)(IEEE80211_HT_CAP_MIMO_PS & (IWL_MIMO_PS_NONE << 2)); + if (iwl4965_param_amsdu_size_8K) { + printk(KERN_DEBUG "iwl4965 in A-MSDU 8K support mode\n"); + ht_info->cap |= (u16)IEEE80211_HT_CAP_MAX_AMSDU; + } ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 50209e6cdd0..5a410e284b9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -60,6 +60,7 @@ extern struct pci_device_id iwl4965_hw_card_ids[]; /* Module parameters accessible from iwl-*.c */ extern int iwl4965_param_hwcrypto; extern int iwl4965_param_queues_num; +extern int iwl4965_param_amsdu_size_8K; enum iwl4965_antenna { IWL_ANTENNA_DIVERSITY, @@ -506,7 +507,6 @@ union iwl4965_ht_rate_supp { #ifdef CONFIG_IWL4965_HT #define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) -#define HT_IE_MAX_AMSDU_SIZE_4K (0) #define CFG_HT_MPDU_DENSITY_2USEC (0x5) #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC @@ -618,7 +618,8 @@ struct iwl4965_driver_hw_info { u16 ac_queue_count; u16 tx_cmd_len; u16 max_rxq_size; - u32 rx_buffer_size; + u32 rx_buf_size; + u32 max_pkt_size; u16 max_rxq_log; u8 max_stations; u8 bcast_sta_id; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 9f89f596283..3a9f14d8f26 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -70,6 +70,7 @@ static int iwl4965_param_antenna; /* def: 0 = both antennas (use diversity) */ int iwl4965_param_hwcrypto; /* def: using software encryption */ static int iwl4965_param_qos_enable = 1; /* def: 1 = use quality of service */ int iwl4965_param_queues_num = IWL_MAX_NUM_QUEUES; /* def: 16 Tx queues */ +int iwl4965_param_amsdu_size_8K; /* def: enable 8K amsdu size */ /* * module name, copyright, version, etc. @@ -3263,7 +3264,7 @@ void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv, __le16 phy_flags_hw = cpu_to_le16(phy_flags); /* We received data from the HW, so stop the watchdog */ - if (len > IWL_RX_BUF_SIZE - sizeof(*iwl4965_rt)) { + if (len > priv->hw_setting.rx_buf_size - sizeof(*iwl4965_rt)) { IWL_DEBUG_DROP("Dropping too large packet in monitor\n"); return; } @@ -4506,7 +4507,8 @@ static void iwl4965_rx_allocate(struct iwl4965_priv *priv) /* Alloc a new receive buffer */ rxb->skb = - alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC); + alloc_skb(priv->hw_setting.rx_buf_size, + __GFP_NOWARN | GFP_ATOMIC); if (!rxb->skb) { if (net_ratelimit()) printk(KERN_CRIT DRV_NAME @@ -4522,7 +4524,7 @@ static void iwl4965_rx_allocate(struct iwl4965_priv *priv) /* Get physical address of RB/SKB */ rxb->dma_addr = pci_map_single(priv->pci_dev, rxb->skb->data, - IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); + priv->hw_setting.rx_buf_size, PCI_DMA_FROMDEVICE); list_add_tail(&rxb->list, &rxq->rx_free); rxq->free_count++; } @@ -4565,7 +4567,8 @@ static void iwl4965_rx_queue_free(struct iwl4965_priv *priv, struct iwl4965_rx_q if (rxq->pool[i].skb != NULL) { pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, - IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); + priv->hw_setting.rx_buf_size, + PCI_DMA_FROMDEVICE); dev_kfree_skb(rxq->pool[i].skb); } } @@ -4616,7 +4619,8 @@ void iwl4965_rx_queue_reset(struct iwl4965_priv *priv, struct iwl4965_rx_queue * if (rxq->pool[i].skb != NULL) { pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, - IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); + priv->hw_setting.rx_buf_size, + PCI_DMA_FROMDEVICE); priv->alloc_rxb_skb--; dev_kfree_skb(rxq->pool[i].skb); rxq->pool[i].skb = NULL; @@ -4750,7 +4754,7 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) rxq->queue[i] = NULL; pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, - IWL_RX_BUF_SIZE, + priv->hw_setting.rx_buf_size, PCI_DMA_FROMDEVICE); pkt = (struct iwl4965_rx_packet *)rxb->skb->data; @@ -4803,7 +4807,8 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) } pci_unmap_single(priv->pci_dev, rxb->dma_addr, - IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); + priv->hw_setting.rx_buf_size, + PCI_DMA_FROMDEVICE); spin_lock_irqsave(&rxq->lock, flags); list_add_tail(&rxb->list, &priv->rxq.rx_used); spin_unlock_irqrestore(&rxq->lock, flags); @@ -9523,6 +9528,8 @@ MODULE_PARM_DESC(queues_num, "number of hw queues."); /* QoS */ module_param_named(qos_enable, iwl4965_param_qos_enable, int, 0444); MODULE_PARM_DESC(qos_enable, "enable all QoS functionality"); +module_param_named(amsdu_size_8K, iwl4965_param_amsdu_size_8K, int, 0444); +MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size"); module_exit(iwl4965_exit); module_init(iwl4965_init); -- cgit v1.2.3-70-g09d2 From 4fd1f8414664b3e834aa46cdbf8f0c12fc42a878 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Wed, 5 Dec 2007 20:59:58 +0200 Subject: iwlwifi: fix compliation warnings This patch fixes compilation warnings introduced by 'fix ucode assertion for RX queue overrun' patch Signed-off-by: Tomas Winkler Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index bab42a1351c..c366ad55f70 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -4163,7 +4163,7 @@ static void iwl3945_rx_allocate(struct iwl3945_priv *priv) /* * this should be called while priv->lock is locked */ -void __iwl3945_rx_replenish(void *data) +static void __iwl3945_rx_replenish(void *data) { struct iwl3945_priv *priv = data; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 3a9f14d8f26..7550594ed4f 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -4534,7 +4534,7 @@ static void iwl4965_rx_allocate(struct iwl4965_priv *priv) /* * this should be called while priv->lock is locked */ -void __iwl4965_rx_replenish(void *data) +static void __iwl4965_rx_replenish(void *data) { struct iwl4965_priv *priv = data; @@ -6038,7 +6038,7 @@ static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv) * iwl4965_verify_inst_full - verify runtime uCode image in card vs. host, * looking at all data. */ -static int iwl4965_verify_inst_full(struct iwl4965_priv *priv, __le32 * image, +static int iwl4965_verify_inst_full(struct iwl4965_priv *priv, __le32 *image, u32 len) { u32 val; -- cgit v1.2.3-70-g09d2 From bb54244be7d12c2a5985226061d598edb49c9078 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Wed, 5 Dec 2007 20:59:59 +0200 Subject: iwlwifi: add missing comments This patch add comments that escaped from the previous merge Signed-off-by: Tomas Winkler Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965.h | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 5a410e284b9..267ae75254f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -516,7 +516,7 @@ struct iwl_ht_info { u8 supported_chan_width; u16 tx_mimo_ps_mode; u8 is_green_field; - u8 sgf; + u8 sgf; /* HT_SHORT_GI_* short guard interval */ u8 max_amsdu_size; u8 ampdu_factor; u8 mpdu_density; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 7550594ed4f..14a1124e6ef 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -350,7 +350,7 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv, * For the command queue (#4), allocate command space + one big * command for scan, since scan command is very huge; the system will * not have two scans at the same time, so only one is needed. - * For data Tx queues (all other queues), no super-size command + * For normal Tx queues (all other queues), no super-size command * space is needed. */ len = sizeof(struct iwl4965_cmd) * slots_num; -- cgit v1.2.3-70-g09d2 From 12342c475f5de17071eaf24ea2938ba8dfe285f2 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 20 Dec 2007 11:27:32 +0800 Subject: iwlwifi: proper monitor support This patch changes the iwlwifi driver to properly support monitor interfaces after the filter flags change. The patch is originally created by Johannes Berg for iwl4965. I fixed some of the comments and created a similar patch for iwl3945. Signed-off-by: Johannes Berg Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 120 +++++++++++++++++++++++----- drivers/net/wireless/iwlwifi/iwl-3945.h | 36 +++------ drivers/net/wireless/iwlwifi/iwl-4965.c | 120 +++++++++++++++++++++++++--- drivers/net/wireless/iwlwifi/iwl-4965.h | 24 +----- drivers/net/wireless/iwlwifi/iwl3945-base.c | 109 +++---------------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 90 +-------------------- 6 files changed, 238 insertions(+), 261 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 7d15b33b9dc..a793cd11f73 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -35,9 +35,9 @@ #include #include #include -#include - #include +#include +#include #include "iwl-3945.h" #include "iwl-helpers.h" @@ -238,10 +238,102 @@ void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_b priv->last_statistics_time = jiffies; } +void iwl3945_add_radiotap(struct iwl3945_priv *priv, struct sk_buff *skb, + struct iwl3945_rx_frame_hdr *rx_hdr, + struct ieee80211_rx_status *stats) +{ + /* First cache any information we need before we overwrite + * the information provided in the skb from the hardware */ + s8 signal = stats->ssi; + s8 noise = 0; + int rate = stats->rate; + u64 tsf = stats->mactime; + __le16 phy_flags_hw = rx_hdr->phy_flags; + + struct iwl3945_rt_rx_hdr { + struct ieee80211_radiotap_header rt_hdr; + __le64 rt_tsf; /* TSF */ + u8 rt_flags; /* radiotap packet flags */ + u8 rt_rate; /* rate in 500kb/s */ + __le16 rt_channelMHz; /* channel in MHz */ + __le16 rt_chbitmask; /* channel bitfield */ + s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ + s8 rt_dbmnoise; + u8 rt_antenna; /* antenna number */ + } __attribute__ ((packed)) *iwl3945_rt; + + if (skb_headroom(skb) < sizeof(*iwl3945_rt)) { + if (net_ratelimit()) + printk(KERN_ERR "not enough headroom [%d] for " + "radiotap head [%d]\n", + skb_headroom(skb), sizeof(*iwl3945_rt)); + return; + } + + /* put radiotap header in front of 802.11 header and data */ + iwl3945_rt = (void *)skb_push(skb, sizeof(*iwl3945_rt)); + + /* initialise radiotap header */ + iwl3945_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; + iwl3945_rt->rt_hdr.it_pad = 0; + + /* total header + data */ + put_unaligned(cpu_to_le16(sizeof(*iwl3945_rt)), + &iwl3945_rt->rt_hdr.it_len); + + /* Indicate all the fields we add to the radiotap header */ + put_unaligned(cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | + (1 << IEEE80211_RADIOTAP_FLAGS) | + (1 << IEEE80211_RADIOTAP_RATE) | + (1 << IEEE80211_RADIOTAP_CHANNEL) | + (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | + (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | + (1 << IEEE80211_RADIOTAP_ANTENNA)), + &iwl3945_rt->rt_hdr.it_present); + + /* Zero the flags, we'll add to them as we go */ + iwl3945_rt->rt_flags = 0; + + put_unaligned(cpu_to_le64(tsf), &iwl3945_rt->rt_tsf); + + iwl3945_rt->rt_dbmsignal = signal; + iwl3945_rt->rt_dbmnoise = noise; + + /* Convert the channel frequency and set the flags */ + put_unaligned(cpu_to_le16(stats->freq), &iwl3945_rt->rt_channelMHz); + if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) + put_unaligned(cpu_to_le16(IEEE80211_CHAN_OFDM | + IEEE80211_CHAN_5GHZ), + &iwl3945_rt->rt_chbitmask); + else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) + put_unaligned(cpu_to_le16(IEEE80211_CHAN_CCK | + IEEE80211_CHAN_2GHZ), + &iwl3945_rt->rt_chbitmask); + else /* 802.11g */ + put_unaligned(cpu_to_le16(IEEE80211_CHAN_OFDM | + IEEE80211_CHAN_2GHZ), + &iwl3945_rt->rt_chbitmask); + + rate = iwl3945_rate_index_from_plcp(rate); + if (rate == -1) + iwl3945_rt->rt_rate = 0; + else + iwl3945_rt->rt_rate = iwl3945_rates[rate].ieee; + + /* antenna number */ + iwl3945_rt->rt_antenna = + le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; + + /* set the preamble flag if we have it */ + if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) + iwl3945_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + + stats->flag |= RX_FLAG_RADIOTAP; +} + static void iwl3945_handle_data_packet(struct iwl3945_priv *priv, int is_data, struct iwl3945_rx_mem_buffer *rxb, - struct ieee80211_rx_status *stats, - u16 phy_flags) + struct ieee80211_rx_status *stats) { struct ieee80211_hdr *hdr; struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data; @@ -261,15 +353,6 @@ static void iwl3945_handle_data_packet(struct iwl3945_priv *priv, int is_data, ("Dropping packet while interface is not open.\n"); return; } - if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { - if (iwl3945_param_hwcrypto) - iwl3945_set_decrypted_flag(priv, rxb->skb, - le32_to_cpu(rx_end->status), - stats); - iwl3945_handle_data_packet_monitor(priv, rxb, IWL_RX_DATA(pkt), - len, stats, phy_flags); - return; - } skb_reserve(rxb->skb, (void *)rx_hdr->payload - (void *)pkt); /* Set the size of the skb to the size of the frame */ @@ -281,6 +364,9 @@ static void iwl3945_handle_data_packet(struct iwl3945_priv *priv, int is_data, iwl3945_set_decrypted_flag(priv, rxb->skb, le32_to_cpu(rx_end->status), stats); + if (priv->add_radiotap) + iwl3945_add_radiotap(priv, rxb->skb, rx_hdr, stats); + ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); rxb->skb = NULL; } @@ -295,7 +381,6 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); struct ieee80211_hdr *header; - u16 phy_flags = le16_to_cpu(rx_hdr->phy_flags); u16 rx_stats_sig_avg = le16_to_cpu(rx_stats->sig_avg); u16 rx_stats_noise_diff = le16_to_cpu(rx_stats->noise_diff); struct ieee80211_rx_status stats = { @@ -325,7 +410,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, } if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { - iwl3945_handle_data_packet(priv, 1, rxb, &stats, phy_flags); + iwl3945_handle_data_packet(priv, 1, rxb, &stats); return; } @@ -479,7 +564,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, } } - iwl3945_handle_data_packet(priv, 0, rxb, &stats, phy_flags); + iwl3945_handle_data_packet(priv, 0, rxb, &stats); break; case IEEE80211_FTYPE_CTL: @@ -496,8 +581,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, print_mac(mac2, header->addr2), print_mac(mac3, header->addr3)); else - iwl3945_handle_data_packet(priv, 1, rxb, &stats, - phy_flags); + iwl3945_handle_data_packet(priv, 1, rxb, &stats); break; } } diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index bfa260654c5..f1aa4dc5aac 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -91,29 +91,6 @@ struct iwl3945_rx_mem_buffer { struct list_head list; }; -struct iwl3945_rt_rx_hdr { - struct ieee80211_radiotap_header rt_hdr; - __le64 rt_tsf; /* TSF */ - u8 rt_flags; /* radiotap packet flags */ - u8 rt_rate; /* rate in 500kb/s */ - __le16 rt_channelMHz; /* channel in MHz */ - __le16 rt_chbitmask; /* channel bitfield */ - s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ - s8 rt_dbmnoise; - u8 rt_antenna; /* antenna number */ - u8 payload[0]; /* payload... */ -} __attribute__ ((packed)); - -struct iwl3945_rt_tx_hdr { - struct ieee80211_radiotap_header rt_hdr; - u8 rt_rate; /* rate in 500kb/s */ - __le16 rt_channel; /* channel in mHz */ - __le16 rt_chbitmask; /* channel bitfield */ - s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ - u8 rt_antenna; /* antenna number */ - u8 payload[0]; /* payload... */ -} __attribute__ ((packed)); - /* * Generic queue structure * @@ -531,7 +508,7 @@ struct iwl3945_ibss_seq { }; /** - * struct iwl4965_driver_hw_info + * struct iwl3945_driver_hw_info * @max_txq_num: Max # Tx queues supported * @ac_queue_count: # Tx queues for EDCA Access Categories (AC) * @tx_cmd_len: Size of Tx command (but not including frame itself) @@ -725,6 +702,7 @@ struct iwl3945_priv { u8 phymode; int alloc_rxb_skb; + bool add_radiotap; void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb); @@ -980,6 +958,16 @@ static inline int is_channel_ibss(const struct iwl3945_channel_info *ch) return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; } +static inline int iwl3945_rate_index_from_plcp(int plcp) +{ + int i; + + for (i = 0; i < IWL_RATE_COUNT; i++) + if (iwl3945_rates[i].plcp == plcp) + return i; + return -1; +} + extern const struct iwl3945_channel_info *iwl3945_get_channel_info( const struct iwl3945_priv *priv, int phymode, u16 channel); diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index f65fd6e5fec..74999af3791 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "iwl-4965.h" #include "iwl-helpers.h" @@ -3588,6 +3589,111 @@ void iwl4965_hw_rx_statistics(struct iwl4965_priv *priv, struct iwl4965_rx_mem_b queue_work(priv->workqueue, &priv->txpower_work); } +static void iwl4965_add_radiotap(struct iwl4965_priv *priv, + struct sk_buff *skb, + struct iwl4965_rx_phy_res *rx_start, + struct ieee80211_rx_status *stats, + u32 ampdu_status) +{ + s8 signal = stats->ssi; + s8 noise = 0; + int rate = stats->rate; + u64 tsf = stats->mactime; + __le16 phy_flags_hw = rx_start->phy_flags; + struct iwl4965_rt_rx_hdr { + struct ieee80211_radiotap_header rt_hdr; + __le64 rt_tsf; /* TSF */ + u8 rt_flags; /* radiotap packet flags */ + u8 rt_rate; /* rate in 500kb/s */ + __le16 rt_channelMHz; /* channel in MHz */ + __le16 rt_chbitmask; /* channel bitfield */ + s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ + s8 rt_dbmnoise; + u8 rt_antenna; /* antenna number */ + } __attribute__ ((packed)) *iwl4965_rt; + + /* TODO: We won't have enough headroom for HT frames. Fix it later. */ + if (skb_headroom(skb) < sizeof(*iwl4965_rt)) { + if (net_ratelimit()) + printk(KERN_ERR "not enough headroom [%d] for " + "radiotap head [%d]\n", + skb_headroom(skb), sizeof(*iwl4965_rt)); + return; + } + + /* put radiotap header in front of 802.11 header and data */ + iwl4965_rt = (void *)skb_push(skb, sizeof(*iwl4965_rt)); + + /* initialise radiotap header */ + iwl4965_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; + iwl4965_rt->rt_hdr.it_pad = 0; + + /* total header + data */ + put_unaligned(cpu_to_le16(sizeof(*iwl4965_rt)), + &iwl4965_rt->rt_hdr.it_len); + + /* Indicate all the fields we add to the radiotap header */ + put_unaligned(cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | + (1 << IEEE80211_RADIOTAP_FLAGS) | + (1 << IEEE80211_RADIOTAP_RATE) | + (1 << IEEE80211_RADIOTAP_CHANNEL) | + (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | + (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | + (1 << IEEE80211_RADIOTAP_ANTENNA)), + &iwl4965_rt->rt_hdr.it_present); + + /* Zero the flags, we'll add to them as we go */ + iwl4965_rt->rt_flags = 0; + + put_unaligned(cpu_to_le64(tsf), &iwl4965_rt->rt_tsf); + + iwl4965_rt->rt_dbmsignal = signal; + iwl4965_rt->rt_dbmnoise = noise; + + /* Convert the channel frequency and set the flags */ + put_unaligned(cpu_to_le16(stats->freq), &iwl4965_rt->rt_channelMHz); + if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) + put_unaligned(cpu_to_le16(IEEE80211_CHAN_OFDM | + IEEE80211_CHAN_5GHZ), + &iwl4965_rt->rt_chbitmask); + else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) + put_unaligned(cpu_to_le16(IEEE80211_CHAN_CCK | + IEEE80211_CHAN_2GHZ), + &iwl4965_rt->rt_chbitmask); + else /* 802.11g */ + put_unaligned(cpu_to_le16(IEEE80211_CHAN_OFDM | + IEEE80211_CHAN_2GHZ), + &iwl4965_rt->rt_chbitmask); + + rate = iwl4965_rate_index_from_plcp(rate); + if (rate == -1) + iwl4965_rt->rt_rate = 0; + else + iwl4965_rt->rt_rate = iwl4965_rates[rate].ieee; + + /* + * "antenna number" + * + * It seems that the antenna field in the phy flags value + * is actually a bitfield. This is undefined by radiotap, + * it wants an actual antenna number but I always get "7" + * for most legacy frames I receive indicating that the + * same frame was received on all three RX chains. + * + * I think this field should be removed in favour of a + * new 802.11n radiotap field "RX chains" that is defined + * as a bitmask. + */ + iwl4965_rt->rt_antenna = + le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; + + /* set the preamble flag if appropriate */ + if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) + iwl4965_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + + stats->flag |= RX_FLAG_RADIOTAP; +} + static void iwl4965_handle_data_packet(struct iwl4965_priv *priv, int is_data, int include_phy, struct iwl4965_rx_mem_buffer *rxb, @@ -3630,8 +3736,7 @@ static void iwl4965_handle_data_packet(struct iwl4965_priv *priv, int is_data, rx_end = (__le32 *) (((u8 *) hdr) + len); } if (len > priv->hw_setting.max_pkt_size || len < 16) { - IWL_WARNING("byte count out of range [16,4K]" - " : %d\n", len); + IWL_WARNING("byte count out of range [16,4K] : %d\n", len); return; } @@ -3649,20 +3754,15 @@ static void iwl4965_handle_data_packet(struct iwl4965_priv *priv, int is_data, return; } - if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { - if (iwl4965_param_hwcrypto) - iwl4965_set_decrypted_flag(priv, rxb->skb, - ampdu_status, stats); - iwl4965_handle_data_packet_monitor(priv, rxb, hdr, len, stats, 0); - return; - } - stats->flag = 0; hdr = (struct ieee80211_hdr *)rxb->skb->data; if (iwl4965_param_hwcrypto) iwl4965_set_decrypted_flag(priv, rxb->skb, ampdu_status, stats); + if (priv->add_radiotap) + iwl4965_add_radiotap(priv, rxb->skb, rx_start, stats, ampdu_status); + ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); priv->alloc_rxb_skb--; rxb->skb = NULL; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 267ae75254f..9a975efc946 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -91,29 +91,6 @@ struct iwl4965_rx_mem_buffer { struct list_head list; }; -struct iwl4965_rt_rx_hdr { - struct ieee80211_radiotap_header rt_hdr; - __le64 rt_tsf; /* TSF */ - u8 rt_flags; /* radiotap packet flags */ - u8 rt_rate; /* rate in 500kb/s */ - __le16 rt_channelMHz; /* channel in MHz */ - __le16 rt_chbitmask; /* channel bitfield */ - s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ - s8 rt_dbmnoise; - u8 rt_antenna; /* antenna number */ - u8 payload[0]; /* payload... */ -} __attribute__ ((packed)); - -struct iwl4965_rt_tx_hdr { - struct ieee80211_radiotap_header rt_hdr; - u8 rt_rate; /* rate in 500kb/s */ - __le16 rt_channel; /* channel in mHz */ - __le16 rt_chbitmask; /* channel bitfield */ - s8 rt_dbmsignal; /* signal in dBm, kluged to signed */ - u8 rt_antenna; /* antenna number */ - u8 payload[0]; /* payload... */ -} __attribute__ ((packed)); - /* * Generic queue structure * @@ -1054,6 +1031,7 @@ struct iwl4965_priv { u8 phymode; int alloc_rxb_skb; + bool add_radiotap; void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv, struct iwl4965_rx_mem_buffer *rxb); diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index c366ad55f70..40b69182e4d 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -1497,16 +1497,6 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, return priv->ibss_beacon->len; } -static int iwl3945_rate_index_from_plcp(int plcp) -{ - int i = 0; - - for (i = 0; i < IWL_RATE_COUNT; i++) - if (iwl3945_rates[i].plcp == plcp) - return i; - return -1; -} - static u8 iwl3945_rate_get_lowest_plcp(int rate_mask) { u8 i; @@ -3121,94 +3111,6 @@ void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb, } } -void iwl3945_handle_data_packet_monitor(struct iwl3945_priv *priv, - struct iwl3945_rx_mem_buffer *rxb, - void *data, short len, - struct ieee80211_rx_status *stats, - u16 phy_flags) -{ - struct iwl3945_rt_rx_hdr *iwl3945_rt; - - /* First cache any information we need before we overwrite - * the information provided in the skb from the hardware */ - s8 signal = stats->ssi; - s8 noise = 0; - int rate = stats->rate; - u64 tsf = stats->mactime; - __le16 phy_flags_hw = cpu_to_le16(phy_flags); - - /* We received data from the HW, so stop the watchdog */ - if (len > IWL_RX_BUF_SIZE - sizeof(*iwl3945_rt)) { - IWL_DEBUG_DROP("Dropping too large packet in monitor\n"); - return; - } - - /* copy the frame data to write after where the radiotap header goes */ - iwl3945_rt = (void *)rxb->skb->data; - memmove(iwl3945_rt->payload, data, len); - - iwl3945_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; - iwl3945_rt->rt_hdr.it_pad = 0; /* always good to zero */ - - /* total header + data */ - iwl3945_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl3945_rt)); - - /* Set the size of the skb to the size of the frame */ - skb_put(rxb->skb, sizeof(*iwl3945_rt) + len); - - /* Big bitfield of all the fields we provide in radiotap */ - iwl3945_rt->rt_hdr.it_present = - cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | - (1 << IEEE80211_RADIOTAP_FLAGS) | - (1 << IEEE80211_RADIOTAP_RATE) | - (1 << IEEE80211_RADIOTAP_CHANNEL) | - (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | - (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | - (1 << IEEE80211_RADIOTAP_ANTENNA)); - - /* Zero the flags, we'll add to them as we go */ - iwl3945_rt->rt_flags = 0; - - iwl3945_rt->rt_tsf = cpu_to_le64(tsf); - - /* Convert to dBm */ - iwl3945_rt->rt_dbmsignal = signal; - iwl3945_rt->rt_dbmnoise = noise; - - /* Convert the channel frequency and set the flags */ - iwl3945_rt->rt_channelMHz = cpu_to_le16(stats->freq); - if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) - iwl3945_rt->rt_chbitmask = - cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); - else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) - iwl3945_rt->rt_chbitmask = - cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); - else /* 802.11g */ - iwl3945_rt->rt_chbitmask = - cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ)); - - rate = iwl3945_rate_index_from_plcp(rate); - if (rate == -1) - iwl3945_rt->rt_rate = 0; - else - iwl3945_rt->rt_rate = iwl3945_rates[rate].ieee; - - /* antenna number */ - iwl3945_rt->rt_antenna = - le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; - - /* set the preamble flag if we have it */ - if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) - iwl3945_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; - - IWL_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); - - stats->flag |= RX_FLAG_RADIOTAP; - ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); - rxb->skb = NULL; -} - - #define IWL_PACKET_RETRY_TIME HZ int iwl3945_is_duplicate_packet(struct iwl3945_priv *priv, struct ieee80211_hdr *header) @@ -4147,6 +4049,15 @@ static void iwl3945_rx_allocate(struct iwl3945_priv *priv) * more buffers it will schedule replenish */ break; } + + /* If radiotap head is required, reserve some headroom here. + * The physical head count is a variable rx_stats->phy_count. + * We reserve 4 bytes here. Plus these extra bytes, the + * headroom of the physical head should be enough for the + * radiotap head that iwl3945 supported. See iwl3945_rt. + */ + skb_reserve(rxb->skb, 4); + priv->alloc_rxb_skb++; list_del(element); @@ -7114,6 +7025,8 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co mutex_lock(&priv->mutex); IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); + priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); + if (!iwl3945_is_ready(priv)) { IWL_DEBUG_MAC80211("leave - not ready\n"); ret = -EIO; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 14a1124e6ef..07089754b54 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -41,7 +41,6 @@ #include #include -#include #include #include @@ -3247,93 +3246,6 @@ void iwl4965_set_decrypted_flag(struct iwl4965_priv *priv, struct sk_buff *skb, } } -void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv, - struct iwl4965_rx_mem_buffer *rxb, - void *data, short len, - struct ieee80211_rx_status *stats, - u16 phy_flags) -{ - struct iwl4965_rt_rx_hdr *iwl4965_rt; - - /* First cache any information we need before we overwrite - * the information provided in the skb from the hardware */ - s8 signal = stats->ssi; - s8 noise = 0; - int rate = stats->rate; - u64 tsf = stats->mactime; - __le16 phy_flags_hw = cpu_to_le16(phy_flags); - - /* We received data from the HW, so stop the watchdog */ - if (len > priv->hw_setting.rx_buf_size - sizeof(*iwl4965_rt)) { - IWL_DEBUG_DROP("Dropping too large packet in monitor\n"); - return; - } - - /* copy the frame data to write after where the radiotap header goes */ - iwl4965_rt = (void *)rxb->skb->data; - memmove(iwl4965_rt->payload, data, len); - - iwl4965_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; - iwl4965_rt->rt_hdr.it_pad = 0; /* always good to zero */ - - /* total header + data */ - iwl4965_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*iwl4965_rt)); - - /* Set the size of the skb to the size of the frame */ - skb_put(rxb->skb, sizeof(*iwl4965_rt) + len); - - /* Big bitfield of all the fields we provide in radiotap */ - iwl4965_rt->rt_hdr.it_present = - cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | - (1 << IEEE80211_RADIOTAP_FLAGS) | - (1 << IEEE80211_RADIOTAP_RATE) | - (1 << IEEE80211_RADIOTAP_CHANNEL) | - (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | - (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | - (1 << IEEE80211_RADIOTAP_ANTENNA)); - - /* Zero the flags, we'll add to them as we go */ - iwl4965_rt->rt_flags = 0; - - iwl4965_rt->rt_tsf = cpu_to_le64(tsf); - - /* Convert to dBm */ - iwl4965_rt->rt_dbmsignal = signal; - iwl4965_rt->rt_dbmnoise = noise; - - /* Convert the channel frequency and set the flags */ - iwl4965_rt->rt_channelMHz = cpu_to_le16(stats->freq); - if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK)) - iwl4965_rt->rt_chbitmask = - cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); - else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK) - iwl4965_rt->rt_chbitmask = - cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); - else /* 802.11g */ - iwl4965_rt->rt_chbitmask = - cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ)); - - rate = iwl4965_rate_index_from_plcp(rate); - if (rate == -1) - iwl4965_rt->rt_rate = 0; - else - iwl4965_rt->rt_rate = iwl4965_rates[rate].ieee; - - /* antenna number */ - iwl4965_rt->rt_antenna = - le16_to_cpu(phy_flags_hw & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; - - /* set the preamble flag if we have it */ - if (phy_flags_hw & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) - iwl4965_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; - - IWL_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); - - stats->flag |= RX_FLAG_RADIOTAP; - ieee80211_rx_irqsafe(priv->hw, rxb->skb, stats); - rxb->skb = NULL; -} - #define IWL_PACKET_RETRY_TIME HZ @@ -7556,6 +7468,8 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co mutex_lock(&priv->mutex); IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel); + priv->add_radiotap = !!(conf->flags & IEEE80211_CONF_RADIOTAP); + if (!iwl4965_is_ready(priv)) { IWL_DEBUG_MAC80211("leave - not ready\n"); ret = -EIO; -- cgit v1.2.3-70-g09d2 From a0646470e8a965df59054a5c82e53e5572bf04a0 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 20 Dec 2007 14:10:01 +0800 Subject: iwlwifi: skip mac80211 conf during a hardware scan and replay it afterwards This patch skips mac80211 configuration setting during a hardware scan and replays it afterwards for the iwlwifi drivers. Cc: Johannes Berg Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.h | 2 +- drivers/net/wireless/iwlwifi/iwl-4965.h | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 30 ++++++--------------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 32 +++++++---------------------- 4 files changed, 15 insertions(+), 51 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index f1aa4dc5aac..e97f1fb48b9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -406,6 +406,7 @@ struct iwl3945_rx_queue { #define STATUS_SCAN_HW 14 #define STATUS_POWER_PMI 15 #define STATUS_FW_ERROR 16 +#define STATUS_CONF_PENDING 17 #define MAX_TID_COUNT 9 @@ -694,7 +695,6 @@ struct iwl3945_priv { struct ieee80211_hw *hw; struct ieee80211_channel *ieee_channels; struct ieee80211_rate *ieee_rates; - struct ieee80211_conf *cache_conf; /* temporary frame storage list */ struct list_head free_frames; diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 9a975efc946..241f4448a4a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -425,6 +425,7 @@ struct iwl4965_rx_queue { #define STATUS_SCAN_HW 14 #define STATUS_POWER_PMI 15 #define STATUS_FW_ERROR 16 +#define STATUS_CONF_PENDING 17 #define MAX_TID_COUNT 9 @@ -1023,7 +1024,6 @@ struct iwl4965_priv { struct ieee80211_hw *hw; struct ieee80211_channel *ieee_channels; struct ieee80211_rate *ieee_rates; - struct ieee80211_conf *cache_conf; /* temporary frame storage list */ struct list_head free_frames; diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 40b69182e4d..8d603257b92 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -6888,8 +6888,8 @@ static void iwl3945_bg_scan_completed(struct work_struct *work) if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; - if (priv->cache_conf) - iwl3945_mac_config(priv->hw, priv->cache_conf); + if (test_bit(STATUS_CONF_PENDING, &priv->status)) + iwl3945_mac_config(priv->hw, ieee80211_get_hw_conf(priv->hw)); ieee80211_scan_completed(priv->hw); @@ -7033,27 +7033,12 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co goto out; } - /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only - * what is exposed through include/ declarations */ if (unlikely(!iwl3945_param_disable_hw_scan && test_bit(STATUS_SCANNING, &priv->status))) { - - if (priv->cache_conf) - IWL_DEBUG_MAC80211("leave - still scanning\n"); - else { - /* Cache the configuration now so that we can - * replay it after the hardware scan is finished. */ - priv->cache_conf = kmalloc(sizeof(*conf), GFP_KERNEL); - if (priv->cache_conf) { - memcpy(priv->cache_conf, conf, sizeof(*conf)); - IWL_DEBUG_MAC80211("leave - scanning\n"); - } else { - IWL_DEBUG_MAC80211("leave - no memory\n"); - ret = -ENOMEM; - } - } + IWL_DEBUG_MAC80211("leave - scanning\n"); + set_bit(STATUS_CONF_PENDING, &priv->status); mutex_unlock(&priv->mutex); - return ret; + return 0; } spin_lock_irqsave(&priv->lock, flags); @@ -7110,10 +7095,7 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co IWL_DEBUG_MAC80211("leave\n"); out: - if (priv->cache_conf) { - kfree(priv->cache_conf); - priv->cache_conf = NULL; - } + clear_bit(STATUS_CONF_PENDING, &priv->status); mutex_unlock(&priv->mutex); return ret; } diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 07089754b54..5a9fa42f999 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -7332,8 +7332,8 @@ static void iwl4965_bg_scan_completed(struct work_struct *work) if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; - if (priv->cache_conf) - iwl4965_mac_config(priv->hw, priv->cache_conf); + if (test_bit(STATUS_CONF_PENDING, &priv->status)) + iwl4965_mac_config(priv->hw, ieee80211_get_hw_conf(priv->hw)); ieee80211_scan_completed(priv->hw); @@ -7476,27 +7476,12 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co goto out; } - /* TODO: Figure out how to get ieee80211_local->sta_scanning w/ only - * what is exposed through include/ declarations */ if (unlikely(!iwl4965_param_disable_hw_scan && test_bit(STATUS_SCANNING, &priv->status))) { - - if (unlikely(priv->cache_conf)) - IWL_DEBUG_MAC80211("leave - still scanning\n"); - else { - /* Cache the configuration now so that we can - * replay it after the hardware scan is finished. */ - priv->cache_conf = kmalloc(sizeof(*conf), GFP_KERNEL); - if (priv->cache_conf) { - memcpy(priv->cache_conf, conf, sizeof(*conf)); - IWL_DEBUG_MAC80211("leave - scanning\n"); - } else { - IWL_DEBUG_MAC80211("leave - no memory\n"); - ret = -ENOMEM; - } - } + IWL_DEBUG_MAC80211("leave - scanning\n"); + set_bit(STATUS_CONF_PENDING, &priv->status); mutex_unlock(&priv->mutex); - return ret; + return 0; } spin_lock_irqsave(&priv->lock, flags); @@ -7564,12 +7549,9 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co IWL_DEBUG_MAC80211("leave\n"); -out: - if (priv->cache_conf) { - kfree(priv->cache_conf); - priv->cache_conf = NULL; - } mutex_unlock(&priv->mutex); +out: + clear_bit(STATUS_CONF_PENDING, &priv->status); return ret; } -- cgit v1.2.3-70-g09d2 From 0e5ce1f33049a823f508f4a3f53ba186b12396b8 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 22 Dec 2007 13:45:50 -0500 Subject: misc wireless annotations Signed-off-by: Al Viro Signed-off-by: John W. Linville --- drivers/net/wireless/adm8211.c | 8 ++++---- drivers/net/wireless/atmel.c | 30 ++++++++++++++--------------- drivers/net/wireless/iwlwifi/iwl3945-base.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl4965-base.c | 4 ++-- drivers/net/wireless/ray_cs.c | 2 +- drivers/net/wireless/wavelan_cs.p.h | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c index 5bf7913aadd..14d90a9409a 100644 --- a/drivers/net/wireless/adm8211.c +++ b/drivers/net/wireless/adm8211.c @@ -104,7 +104,7 @@ static int adm8211_read_eeprom(struct ieee80211_hw *dev) if (!priv->eeprom) return -ENOMEM; - eeprom_93cx6_multiread(&eeprom, 0, (__le16 __force *)priv->eeprom, words); + eeprom_93cx6_multiread(&eeprom, 0, (__le16 *)priv->eeprom, words); cr49 = le16_to_cpu(priv->eeprom->cr49); priv->rf_type = (cr49 >> 3) & 0x7; @@ -1867,9 +1867,9 @@ static int __devinit adm8211_probe(struct pci_dev *pdev, goto err_iounmap; } - *(u32 *)perm_addr = le32_to_cpu((__force __le32)ADM8211_CSR_READ(PAR0)); - *(u16 *)&perm_addr[4] = - le16_to_cpu((__force __le16)ADM8211_CSR_READ(PAR1) & 0xFFFF); + *(__le32 *)perm_addr = cpu_to_le32(ADM8211_CSR_READ(PAR0)); + *(__le16 *)&perm_addr[4] = + cpu_to_le16(ADM8211_CSR_READ(PAR1) & 0xFFFF); if (!is_valid_ether_addr(perm_addr)) { printk(KERN_WARNING "%s (adm8211): Invalid hwaddr in EEPROM!\n", diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 32fbaf20d27..63ec7a70ee7 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -2675,9 +2675,9 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } struct auth_body { - u16 alg; - u16 trans_seq; - u16 status; + __le16 alg; + __le16 trans_seq; + __le16 status; u8 el_id; u8 chall_text_len; u8 chall_text[253]; @@ -2712,9 +2712,9 @@ static void atmel_scan(struct atmel_private *priv, int specific_ssid) u8 SSID[MAX_SSID_LENGTH]; u8 scan_type; u8 channel; - u16 BSS_type; - u16 min_channel_time; - u16 max_channel_time; + __le16 BSS_type; + __le16 min_channel_time; + __le16 max_channel_time; u8 options; u8 SSID_size; } cmd; @@ -2757,7 +2757,7 @@ static void join(struct atmel_private *priv, int type) u8 SSID[MAX_SSID_LENGTH]; u8 BSS_type; /* this is a short in a scan command - weird */ u8 channel; - u16 timeout; + __le16 timeout; u8 SSID_size; u8 reserved; } cmd; @@ -2862,8 +2862,8 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc) int bodysize; struct ieee80211_hdr_4addr header; struct ass_req_format { - u16 capability; - u16 listen_interval; + __le16 capability; + __le16 listen_interval; u8 ap[6]; /* nothing after here directly accessible */ u8 ssid_el_id; u8 ssid_len; @@ -3084,9 +3084,9 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype) { struct ass_resp_format { - u16 capability; - u16 status; - u16 ass_id; + __le16 capability; + __le16 status; + __le16 ass_id; u8 el_id; u8 length; u8 rates[4]; @@ -3293,9 +3293,9 @@ static void atmel_management_frame(struct atmel_private *priv, never let an engineer loose with a data structure design. */ { struct beacon_format { - u64 timestamp; - u16 interval; - u16 capability; + __le64 timestamp; + __le16 interval; + __le16 capability; u8 ssid_el_id; u8 ssid_length; /* ssid here */ diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 8d603257b92..b662ff3b914 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -1566,7 +1566,7 @@ static void get_eeprom_mac(struct iwl3945_priv *priv, u8 *mac) */ int iwl3945_eeprom_init(struct iwl3945_priv *priv) { - u16 *e = (u16 *)&priv->eeprom; + __le16 *e = (__le16 *)&priv->eeprom; u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP); u32 r; int sz = sizeof(priv->eeprom); @@ -1609,7 +1609,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv) IWL_ERROR("Time out reading EEPROM[%d]", addr); return -ETIMEDOUT; } - e[addr / 2] = le16_to_cpu(r >> 16); + e[addr / 2] = cpu_to_le16(r >> 16); } return 0; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 5a9fa42f999..ce0574b087f 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -1648,7 +1648,7 @@ static void get_eeprom_mac(struct iwl4965_priv *priv, u8 *mac) */ int iwl4965_eeprom_init(struct iwl4965_priv *priv) { - u16 *e = (u16 *)&priv->eeprom; + __le16 *e = (__le16 *)&priv->eeprom; u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP); u32 r; int sz = sizeof(priv->eeprom); @@ -1692,7 +1692,7 @@ int iwl4965_eeprom_init(struct iwl4965_priv *priv) rc = -ETIMEDOUT; goto done; } - e[addr / 2] = le16_to_cpu(r >> 16); + e[addr / 2] = cpu_to_le16(r >> 16); } rc = 0; diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 8ba28a515d4..f3858ee36f3 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -998,7 +998,7 @@ static int ray_hw_xmit(unsigned char* data, int len, struct net_device* dev, static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx, unsigned char *data, int len) { - unsigned short int proto = ((struct ethhdr *)data)->h_proto; + __be16 proto = ((struct ethhdr *)data)->h_proto; if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */ DEBUG(3,"ray_cs translate_frame DIX II\n"); /* Copy LLC header to card buffer */ diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h index 4b9de0093a7..ca551a5d139 100644 --- a/drivers/net/wireless/wavelan_cs.p.h +++ b/drivers/net/wireless/wavelan_cs.p.h @@ -548,7 +548,7 @@ typedef struct wavepoint_beacon spec_id2, /* Unused */ pdu_type, /* Unused */ seq; /* WavePoint beacon sequence number */ - unsigned short domain_id, /* WavePoint Domain ID */ + __be16 domain_id, /* WavePoint Domain ID */ nwid; /* WavePoint NWID */ } wavepoint_beacon; -- cgit v1.2.3-70-g09d2 From 32bfd35d4b63bd63de4bb0d791ef049c3c868726 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 19 Dec 2007 01:31:26 +0100 Subject: mac80211: dont use interface indices in drivers This patch gets rid of the if_id stuff where possible in favour of a new per-virtual-interface structure "struct ieee80211_vif". This structure is located at the end of the per-interface structure and contains a variable length driver-use data area. This has two advantages: * removes the need to look up interfaces by if_id, this is better for working with network namespaces and performance * allows drivers to store and retrieve per-interface data without having to allocate own lists/hash tables Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- drivers/net/wireless/adm8211.c | 3 +- drivers/net/wireless/ath5k/base.c | 15 ++++--- drivers/net/wireless/ath5k/base.h | 2 +- drivers/net/wireless/ath5k/hw.c | 2 +- drivers/net/wireless/b43/b43.h | 5 +-- drivers/net/wireless/b43/main.c | 13 +++--- drivers/net/wireless/b43/xmit.c | 6 +-- drivers/net/wireless/b43legacy/b43legacy.h | 5 +-- drivers/net/wireless/b43legacy/main.c | 13 +++--- drivers/net/wireless/b43legacy/xmit.c | 6 +-- drivers/net/wireless/iwlwifi/iwl-3945.h | 2 +- drivers/net/wireless/iwlwifi/iwl-4965.h | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 28 ++++++------ drivers/net/wireless/iwlwifi/iwl4965-base.c | 28 ++++++------ drivers/net/wireless/p54common.c | 3 +- drivers/net/wireless/rt2x00/rt2x00.h | 5 ++- drivers/net/wireless/rt2x00/rt2x00mac.c | 5 ++- drivers/net/wireless/rtl8180.h | 2 +- drivers/net/wireless/rtl8180_dev.c | 11 +++-- drivers/net/wireless/rtl8187.h | 2 +- drivers/net/wireless/rtl8187_dev.c | 8 ++-- drivers/net/wireless/zd1211rw/zd_mac.c | 3 +- include/net/mac80211.h | 70 ++++++++++++++++++----------- net/mac80211/ieee80211.c | 12 ++--- net/mac80211/ieee80211_i.h | 8 ++++ net/mac80211/ieee80211_iface.c | 2 +- net/mac80211/sta_info.c | 27 ++++++++--- net/mac80211/tx.c | 46 +++++++++---------- net/mac80211/util.c | 45 +++++++------------ 29 files changed, 205 insertions(+), 174 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c index 14d90a9409a..79796186713 100644 --- a/drivers/net/wireless/adm8211.c +++ b/drivers/net/wireless/adm8211.c @@ -1312,7 +1312,8 @@ static int adm8211_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) return 0; } -static int adm8211_config_interface(struct ieee80211_hw *dev, int if_id, +static int adm8211_config_interface(struct ieee80211_hw *dev, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct adm8211_priv *priv = dev->priv; diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index d3d37282f3d..742616a03d5 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c @@ -178,7 +178,8 @@ static void ath5k_remove_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf); static int ath5k_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); -static int ath5k_config_interface(struct ieee80211_hw *hw, int if_id, +static int ath5k_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf); static void ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, @@ -2498,12 +2499,12 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, int ret; mutex_lock(&sc->lock); - if (sc->iface_id) { + if (sc->vif) { ret = 0; goto end; } - sc->iface_id = conf->if_id; + sc->vif = conf->vif; switch (conf->type) { case IEEE80211_IF_TYPE_STA: @@ -2528,10 +2529,10 @@ ath5k_remove_interface(struct ieee80211_hw *hw, struct ath5k_softc *sc = hw->priv; mutex_lock(&sc->lock); - if (sc->iface_id != conf->if_id) + if (sc->vif != conf->vif) goto end; - sc->iface_id = 0; + sc->vif = NULL; end: mutex_unlock(&sc->lock); } @@ -2549,7 +2550,7 @@ ath5k_config(struct ieee80211_hw *hw, } static int -ath5k_config_interface(struct ieee80211_hw *hw, int if_id, +ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct ath5k_softc *sc = hw->priv; @@ -2560,7 +2561,7 @@ ath5k_config_interface(struct ieee80211_hw *hw, int if_id, * be set to mac80211's value at ath5k_config(). */ sc->bintval = 1000 * 1000 / 1024; mutex_lock(&sc->lock); - if (sc->iface_id != if_id) { + if (sc->vif != vif) { ret = -EIO; goto unlock; } diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h index 927d67db3dc..7ba2223d224 100644 --- a/drivers/net/wireless/ath5k/base.h +++ b/drivers/net/wireless/ath5k/base.h @@ -123,7 +123,7 @@ struct ath5k_softc { unsigned int curmode; /* current phy mode */ struct ieee80211_channel *curchan; /* current h/w channel */ - int iface_id; /* add/remove_interface id */ + struct ieee80211_vif *vif; struct { u8 rxflags; /* radiotap rx flags */ diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c index 5623d7dc738..3b9336387df 100644 --- a/drivers/net/wireless/ath5k/hw.c +++ b/drivers/net/wireless/ath5k/hw.c @@ -533,7 +533,7 @@ static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah, * ieee80211_duration() for a brief description of * what rate we should choose to TX ACKs. */ tx_time = ieee80211_generic_frame_duration(sc->hw, - sc->iface_id, 10, control_rate->rate_kbps/100); + sc->vif, 10, control_rate->rate_kbps/100); ath5k_hw_reg_write(ah, tx_time, reg); diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 5a1a790a105..82bff51d559 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h @@ -625,10 +625,7 @@ struct b43_wl { * at a time. General information about this interface follows. */ - /* Opaque ID of the operating interface from the ieee80211 - * subsystem. Do not modify. - */ - int if_id; + struct ieee80211_vif *vif; /* The MAC address of the operating interface. */ u8 mac_addr[ETH_ALEN]; /* Current BSSID */ diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index ea63a992880..af3d24c559c 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c @@ -1169,7 +1169,7 @@ static void b43_write_probe_resp_plcp(struct b43_wldev *dev, plcp.data = 0; b43_generate_plcp_hdr(&plcp, size + FCS_LEN, rate); dur = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, size, + dev->wl->vif, size, B43_RATE_TO_BASE100KBPS(rate)); /* Write PLCP in two parts and timing for packet transfer */ tmp = le32_to_cpu(plcp.data); @@ -1226,7 +1226,7 @@ static u8 *b43_generate_probe_resp(struct b43_wldev *dev, hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); dur = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, *dest_size, + dev->wl->vif, *dest_size, B43_RATE_TO_BASE100KBPS(rate)); hdr->duration_id = dur; @@ -2928,7 +2928,7 @@ static void b43_op_configure_filter(struct ieee80211_hw *hw, } static int b43_op_config_interface(struct ieee80211_hw *hw, - int if_id, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct b43_wl *wl = hw_to_b43_wl(hw); @@ -2939,7 +2939,7 @@ static int b43_op_config_interface(struct ieee80211_hw *hw, return -ENODEV; mutex_lock(&wl->mutex); spin_lock_irqsave(&wl->irq_lock, flags); - B43_WARN_ON(wl->if_id != if_id); + B43_WARN_ON(wl->vif != vif); if (conf->bssid) memcpy(wl->bssid, conf->bssid, ETH_ALEN); else @@ -3445,7 +3445,7 @@ static int b43_op_add_interface(struct ieee80211_hw *hw, dev = wl->current_dev; wl->operating = 1; - wl->if_id = conf->if_id; + wl->vif = conf->vif; wl->if_type = conf->type; memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN); @@ -3473,7 +3473,8 @@ static void b43_op_remove_interface(struct ieee80211_hw *hw, mutex_lock(&wl->mutex); B43_WARN_ON(!wl->operating); - B43_WARN_ON(wl->if_id != conf->if_id); + B43_WARN_ON(wl->vif != conf->vif); + wl->vif = NULL; wl->operating = 0; diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 419aca1fc4f..5014213b775 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c @@ -221,7 +221,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev, } else { int fbrate_base100kbps = B43_RATE_TO_BASE100KBPS(rate_fb); txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, + txctl->vif, fragment_len, fbrate_base100kbps); } @@ -312,7 +312,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev, rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { - ieee80211_ctstoself_get(dev->wl->hw, dev->wl->if_id, + ieee80211_ctstoself_get(dev->wl->hw, txctl->vif, fragment_data, fragment_len, txctl, (struct ieee80211_cts *)(txhdr-> @@ -320,7 +320,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev, mac_ctl |= B43_TX4_MAC_SENDCTS; len = sizeof(struct ieee80211_cts); } else { - ieee80211_rts_get(dev->wl->hw, dev->wl->if_id, + ieee80211_rts_get(dev->wl->hw, txctl->vif, fragment_data, fragment_len, txctl, (struct ieee80211_rts *)(txhdr-> rts_frame)); diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h index e4de437b789..8352a4e1cfc 100644 --- a/drivers/net/wireless/b43legacy/b43legacy.h +++ b/drivers/net/wireless/b43legacy/b43legacy.h @@ -577,10 +577,7 @@ struct b43legacy_wl { * at a time. General information about this interface follows. */ - /* Opaque ID of the operating interface from the ieee80211 - * subsystem. Do not modify. - */ - int if_id; + struct ieee80211_vif *vif; /* MAC address (can be NULL). */ u8 mac_addr[ETH_ALEN]; /* Current BSSID (can be NULL). */ diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 575fd9a5874..2d5735ddad8 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c @@ -976,7 +976,7 @@ static void b43legacy_write_probe_resp_plcp(struct b43legacy_wldev *dev, plcp.data = 0; b43legacy_generate_plcp_hdr(&plcp, size + FCS_LEN, rate); dur = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, + dev->wl->vif, size, B43legacy_RATE_TO_100KBPS(rate)); /* Write PLCP in two parts and timing for packet transfer */ @@ -1042,7 +1042,7 @@ static u8 *b43legacy_generate_probe_resp(struct b43legacy_wldev *dev, hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); dur = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, + dev->wl->vif, *dest_size, B43legacy_RATE_TO_100KBPS(rate)); hdr->duration_id = dur; @@ -2647,7 +2647,7 @@ static void b43legacy_op_configure_filter(struct ieee80211_hw *hw, } static int b43legacy_op_config_interface(struct ieee80211_hw *hw, - int if_id, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); @@ -2658,7 +2658,7 @@ static int b43legacy_op_config_interface(struct ieee80211_hw *hw, return -ENODEV; mutex_lock(&wl->mutex); spin_lock_irqsave(&wl->irq_lock, flags); - B43legacy_WARN_ON(wl->if_id != if_id); + B43legacy_WARN_ON(wl->vif != vif); if (conf->bssid) memcpy(wl->bssid, conf->bssid, ETH_ALEN); else @@ -3177,7 +3177,7 @@ static int b43legacy_op_add_interface(struct ieee80211_hw *hw, dev = wl->current_dev; wl->operating = 1; - wl->if_id = conf->if_id; + wl->vif = conf->vif; wl->if_type = conf->type; memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN); @@ -3205,7 +3205,8 @@ static void b43legacy_op_remove_interface(struct ieee80211_hw *hw, mutex_lock(&wl->mutex); B43legacy_WARN_ON(!wl->operating); - B43legacy_WARN_ON(wl->if_id != conf->if_id); + B43legacy_WARN_ON(wl->vif != conf->vif); + wl->vif = NULL; wl->operating = 0; diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c index fa095d43237..e20c552442d 100644 --- a/drivers/net/wireless/b43legacy/xmit.c +++ b/drivers/net/wireless/b43legacy/xmit.c @@ -223,7 +223,7 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, } else { int fbrate_base100kbps = B43legacy_RATE_TO_100KBPS(rate_fb); txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, + txctl->vif, fragment_len, fbrate_base100kbps); } @@ -312,7 +312,7 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { ieee80211_ctstoself_get(dev->wl->hw, - dev->wl->if_id, + txctl->vif, fragment_data, fragment_len, txctl, (struct ieee80211_cts *) @@ -321,7 +321,7 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, len = sizeof(struct ieee80211_cts); } else { ieee80211_rts_get(dev->wl->hw, - dev->wl->if_id, + txctl->vif, fragment_data, fragment_len, txctl, (struct ieee80211_rts *) (txhdr->rts_frame)); diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index e97f1fb48b9..20b925f57e3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -863,7 +863,7 @@ struct iwl3945_priv { u32 timestamp1; u16 beacon_int; struct iwl3945_driver_hw_info hw_setting; - int interface_id; + struct ieee80211_vif *vif; /* Current association information needed to configure the * hardware */ diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 241f4448a4a..aad7f70bab7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -1212,7 +1212,7 @@ struct iwl4965_priv { u32 timestamp1; u16 beacon_int; struct iwl4965_driver_hw_info hw_setting; - int interface_id; + struct ieee80211_vif *vif; /* Current association information needed to configure the * hardware */ diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index b662ff3b914..1830e13d5cf 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -2767,8 +2767,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, goto drop_unlock; } - if (!priv->interface_id) { - IWL_DEBUG_DROP("Dropping - !priv->interface_id\n"); + if (!priv->vif) { + IWL_DEBUG_DROP("Dropping - !priv->vif\n"); goto drop_unlock; } @@ -3549,7 +3549,7 @@ static void iwl3945_bg_beacon_update(struct work_struct *work) struct sk_buff *beacon; /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ - beacon = ieee80211_beacon_get(priv->hw, priv->interface_id, NULL); + beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); if (!beacon) { IWL_ERROR("update beacon failed\n"); @@ -6780,7 +6780,7 @@ static void iwl3945_bg_post_associate(struct work_struct *data) mutex_lock(&priv->mutex); - if (!priv->interface_id || !priv->is_open) { + if (!priv->vif || !priv->is_open) { mutex_unlock(&priv->mutex); return; } @@ -6981,15 +6981,15 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, unsigned long flags; DECLARE_MAC_BUF(mac); - IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); + IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); - if (priv->interface_id) { - IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); + if (priv->vif) { + IWL_DEBUG_MAC80211("leave - vif != NULL\n"); return -EOPNOTSUPP; } spin_lock_irqsave(&priv->lock, flags); - priv->interface_id = conf->if_id; + priv->vif = conf->vif; spin_unlock_irqrestore(&priv->lock, flags); @@ -7157,7 +7157,8 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv) * clear sta table, add BCAST sta... */ } -static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, +static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct iwl3945_priv *priv = hw->priv; @@ -7179,7 +7180,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, mutex_lock(&priv->mutex); - IWL_DEBUG_MAC80211("enter: interface id %d\n", if_id); if (conf->bssid) IWL_DEBUG_MAC80211("bssid: %s\n", print_mac(mac, conf->bssid)); @@ -7196,8 +7196,8 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, return 0; } - if (priv->interface_id != if_id) { - IWL_DEBUG_MAC80211("leave - interface_id != if_id\n"); + if (priv->vif != vif) { + IWL_DEBUG_MAC80211("leave - priv->vif != vif\n"); mutex_unlock(&priv->mutex); return 0; } @@ -7295,8 +7295,8 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; iwl3945_commit_rxon(priv); } - if (priv->interface_id == conf->if_id) { - priv->interface_id = 0; + if (priv->vif == conf->vif) { + priv->vif = NULL; memset(priv->bssid, 0, ETH_ALEN); memset(priv->essid, 0, IW_ESSID_MAX_SIZE); priv->essid_len = 0; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index ce0574b087f..52eb37f4ac7 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -2897,8 +2897,8 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, goto drop_unlock; } - if (!priv->interface_id) { - IWL_DEBUG_DROP("Dropping - !priv->interface_id\n"); + if (!priv->vif) { + IWL_DEBUG_DROP("Dropping - !priv->vif\n"); goto drop_unlock; } @@ -3893,7 +3893,7 @@ static void iwl4965_bg_beacon_update(struct work_struct *work) struct sk_buff *beacon; /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ - beacon = ieee80211_beacon_get(priv->hw, priv->interface_id, NULL); + beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); if (!beacon) { IWL_ERROR("update beacon failed\n"); @@ -7214,7 +7214,7 @@ static void iwl4965_bg_post_associate(struct work_struct *data) mutex_lock(&priv->mutex); - if (!priv->interface_id || !priv->is_open) { + if (!priv->vif || !priv->is_open) { mutex_unlock(&priv->mutex); return; } @@ -7425,15 +7425,15 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, unsigned long flags; DECLARE_MAC_BUF(mac); - IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); + IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); - if (priv->interface_id) { - IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); + if (priv->vif) { + IWL_DEBUG_MAC80211("leave - vif != NULL\n"); return 0; } spin_lock_irqsave(&priv->lock, flags); - priv->interface_id = conf->if_id; + priv->vif = conf->vif; spin_unlock_irqrestore(&priv->lock, flags); @@ -7617,7 +7617,8 @@ static void iwl4965_config_ap(struct iwl4965_priv *priv) * clear sta table, add BCAST sta... */ } -static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, +static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct iwl4965_priv *priv = hw->priv; @@ -7637,7 +7638,6 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, mutex_lock(&priv->mutex); - IWL_DEBUG_MAC80211("enter: interface id %d\n", if_id); if (conf->bssid) IWL_DEBUG_MAC80211("bssid: %s\n", print_mac(mac, conf->bssid)); @@ -7654,8 +7654,8 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, return 0; } - if (priv->interface_id != if_id) { - IWL_DEBUG_MAC80211("leave - interface_id != if_id\n"); + if (priv->vif != vif) { + IWL_DEBUG_MAC80211("leave - priv->vif != vif\n"); mutex_unlock(&priv->mutex); return 0; } @@ -7753,8 +7753,8 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; iwl4965_commit_rxon(priv); } - if (priv->interface_id == conf->if_id) { - priv->interface_id = 0; + if (priv->vif == conf->vif) { + priv->vif = NULL; memset(priv->bssid, 0, ETH_ALEN); memset(priv->essid, 0, IW_ESSID_MAX_SIZE); priv->essid_len = 0; diff --git a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c index 9660fdd873a..5cda49aff3a 100644 --- a/drivers/net/wireless/p54common.c +++ b/drivers/net/wireless/p54common.c @@ -854,7 +854,8 @@ static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) return ret; } -static int p54_config_interface(struct ieee80211_hw *dev, int if_id, +static int p54_config_interface(struct ieee80211_hw *dev, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct p54_common *priv = dev->priv; diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 5fb9734ade8..94a8a7ce538 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h @@ -372,7 +372,7 @@ struct interface { * to us by the 80211 stack, and is used to request * new beacons. */ - int id; + struct ieee80211_vif *id; /* * Current working type (IEEE80211_IF_TYPE_*). @@ -929,7 +929,8 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, void rt2x00mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf); int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); -int rt2x00mac_config_interface(struct ieee80211_hw *hw, int if_id, +int rt2x00mac_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf); int rt2x00mac_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats); diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index e99d167d7df..1d67bcd46bc 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c @@ -181,7 +181,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, is_interface_present(intf)) return -ENOBUFS; - intf->id = conf->if_id; + intf->id = conf->vif; intf->type = conf->type; if (conf->type == IEEE80211_IF_TYPE_AP) memcpy(&intf->bssid, conf->mac_addr, ETH_ALEN); @@ -265,7 +265,8 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) } EXPORT_SYMBOL_GPL(rt2x00mac_config); -int rt2x00mac_config_interface(struct ieee80211_hw *hw, int if_id, +int rt2x00mac_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct rt2x00_dev *rt2x00dev = hw->priv; diff --git a/drivers/net/wireless/rtl8180.h b/drivers/net/wireless/rtl8180.h index 0b333cacbd8..2cbfe3c8081 100644 --- a/drivers/net/wireless/rtl8180.h +++ b/drivers/net/wireless/rtl8180.h @@ -90,8 +90,8 @@ struct rtl8180_priv { /* common between rtl818x drivers */ struct rtl818x_csr __iomem *map; const struct rtl818x_rf_ops *rf; + struct ieee80211_vif *vif; int mode; - int if_id; /* rtl8180 driver specific */ spinlock_t lock; diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c index 4b7b032c194..07f37b0ccf9 100644 --- a/drivers/net/wireless/rtl8180_dev.c +++ b/drivers/net/wireless/rtl8180_dev.c @@ -236,7 +236,8 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb, kmemdup(control, sizeof(*control), GFP_ATOMIC); if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) - rts_duration = ieee80211_rts_duration(dev, priv->if_id, skb->len, control); + rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len, + control); if (!priv->r8185) { unsigned int remainder; @@ -638,6 +639,8 @@ static int rtl8180_add_interface(struct ieee80211_hw *dev, return -EOPNOTSUPP; } + priv->vif = conf->vif; + rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0], cpu_to_le32(*(u32 *)conf->mac_addr)); @@ -653,6 +656,7 @@ static void rtl8180_remove_interface(struct ieee80211_hw *dev, { struct rtl8180_priv *priv = dev->priv; priv->mode = IEEE80211_IF_TYPE_MNTR; + priv->vif = NULL; } static int rtl8180_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) @@ -664,14 +668,13 @@ static int rtl8180_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) return 0; } -static int rtl8180_config_interface(struct ieee80211_hw *dev, int if_id, +static int rtl8180_config_interface(struct ieee80211_hw *dev, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct rtl8180_priv *priv = dev->priv; int i; - priv->if_id = if_id; - for (i = 0; i < ETH_ALEN; i++) rtl818x_iowrite8(priv, &priv->map->BSSID[i], conf->bssid[i]); diff --git a/drivers/net/wireless/rtl8187.h b/drivers/net/wireless/rtl8187.h index 26a4f1097b4..8680a0b6433 100644 --- a/drivers/net/wireless/rtl8187.h +++ b/drivers/net/wireless/rtl8187.h @@ -65,8 +65,8 @@ struct rtl8187_priv { /* common between rtl818x drivers */ struct rtl818x_csr *map; const struct rtl818x_rf_ops *rf; + struct ieee80211_vif *vif; int mode; - int if_id; /* rtl8187 specific */ struct ieee80211_channel channels[14]; diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index 8dab25a6599..0d71716d750 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c @@ -150,7 +150,8 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb, flags |= RTL8187_TX_FLAG_MORE_FRAG; if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { flags |= RTL8187_TX_FLAG_RTS; - rts_dur = ieee80211_rts_duration(dev, priv->if_id, skb->len, control); + rts_dur = ieee80211_rts_duration(dev, priv->vif, + skb->len, control); } if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) flags |= RTL8187_TX_FLAG_CTS; @@ -560,14 +561,13 @@ static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) return 0; } -static int rtl8187_config_interface(struct ieee80211_hw *dev, int if_id, +static int rtl8187_config_interface(struct ieee80211_hw *dev, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct rtl8187_priv *priv = dev->priv; int i; - priv->if_id = if_id; - for (i = 0; i < ETH_ALEN; i++) rtl818x_iowrite8(priv, &priv->map->BSSID[i], conf->bssid[i]); diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 7b869305048..3409cf97f5f 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c @@ -733,7 +733,8 @@ static int zd_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) return zd_chip_set_channel(&mac->chip, conf->channel); } -static int zd_op_config_interface(struct ieee80211_hw *hw, int if_id, +static int zd_op_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct zd_mac *mac = zd_hw_mac(hw); diff --git a/include/net/mac80211.h b/include/net/mac80211.h index be2a383b477..24a8ad3f507 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -280,6 +280,7 @@ struct ieee80211_low_level_stats { * the hardware to use given values (depending on what is supported). */ struct ieee80211_tx_control { + struct ieee80211_vif *vif; int tx_rate; /* Transmit rate, given as the hw specific value for the * rate (from struct ieee80211_rate) */ int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw @@ -332,7 +333,6 @@ struct ieee80211_tx_control { * packet dropping when probing higher rates, if hw * supports multiple retry rates. -1 = not used */ int type; /* internal */ - int ifindex; /* internal */ }; @@ -529,14 +529,26 @@ enum ieee80211_if_types { IEEE80211_IF_TYPE_VLAN, }; +/** + * struct ieee80211_vif - per-interface data + * + * Data in this structure is continually present for driver + * use during the life of a virtual interface. + * + * @drv_priv: data area for driver use, will always be aligned to + * sizeof(void *). + */ +struct ieee80211_vif { + /* must be last */ + u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); +}; + /** * struct ieee80211_if_init_conf - initial configuration of an interface * - * @if_id: internal interface ID. This number has no particular meaning to - * drivers and the only allowed usage is to pass it to - * ieee80211_beacon_get() and ieee80211_get_buffered_bc() functions. - * This field is not valid for monitor interfaces - * (interfaces of %IEEE80211_IF_TYPE_MNTR type). + * @vif: pointer to a driver-use per-interface structure. The pointer + * itself is also used for various functions including + * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). * @type: one of &enum ieee80211_if_types constants. Determines the type of * added/removed interface. * @mac_addr: pointer to MAC address of the interface. This pointer is valid @@ -553,8 +565,8 @@ enum ieee80211_if_types { * in pure monitor mode. */ struct ieee80211_if_init_conf { - int if_id; enum ieee80211_if_types type; + struct ieee80211_vif *vif; void *mac_addr; }; @@ -757,6 +769,9 @@ enum ieee80211_hw_flags { * @rate_control_algorithm: rate control algorithm for this hardware. * If unset (NULL), the default algorithm will be used. Must be * set before calling ieee80211_register_hw(). + * + * @vif_data_size: size (in bytes) of the drv_priv data area + * within &struct ieee80211_vif. */ struct ieee80211_hw { struct ieee80211_conf conf; @@ -767,6 +782,7 @@ struct ieee80211_hw { u32 flags; unsigned int extra_tx_headroom; int channel_change_time; + int vif_data_size; u8 queues; s8 max_rssi; s8 max_signal; @@ -1076,7 +1092,8 @@ struct ieee80211_ops { struct ieee80211_if_init_conf *conf); int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); int (*config_interface)(struct ieee80211_hw *hw, - int if_id, struct ieee80211_if_conf *conf); + struct ieee80211_vif *vif, + struct ieee80211_if_conf *conf); void (*configure_filter)(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, @@ -1094,7 +1111,7 @@ struct ieee80211_ops { int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); int (*set_retry_limit)(struct ieee80211_hw *hw, u32 short_retry, u32 long_retr); - void (*sta_notify)(struct ieee80211_hw *hw, int if_id, + void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum sta_notify_cmd, const u8 *addr); void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes, int cts_protection, int preamble); @@ -1309,7 +1326,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, /** * ieee80211_beacon_get - beacon generation function * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @control: will be filled with information needed to send this beacon. * * If the beacon frames are generated by the host system (i.e., not in @@ -1320,13 +1337,13 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, * is responsible of freeing it. */ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, - int if_id, + struct ieee80211_vif *vif, struct ieee80211_tx_control *control); /** * ieee80211_rts_get - RTS frame generation function * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame: pointer to the frame that is going to be protected by the RTS. * @frame_len: the frame length (in octets). * @frame_txctl: &struct ieee80211_tx_control of the frame. @@ -1337,7 +1354,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, * the next RTS frame from the 802.11 code. The low-level is responsible * for calling this function before and RTS frame is needed. */ -void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, +void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const void *frame, size_t frame_len, const struct ieee80211_tx_control *frame_txctl, struct ieee80211_rts *rts); @@ -1345,7 +1362,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, /** * ieee80211_rts_duration - Get the duration field for an RTS frame * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame_len: the length of the frame that is going to be protected by the RTS. * @frame_txctl: &struct ieee80211_tx_control of the frame. * @@ -1353,14 +1370,14 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, * the duration field, the low-level driver uses this function to receive * the duration field value in little-endian byteorder. */ -__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, - size_t frame_len, +__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_control *frame_txctl); /** * ieee80211_ctstoself_get - CTS-to-self frame generation function * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame: pointer to the frame that is going to be protected by the CTS-to-self. * @frame_len: the frame length (in octets). * @frame_txctl: &struct ieee80211_tx_control of the frame. @@ -1371,7 +1388,8 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, * the next CTS-to-self frame from the 802.11 code. The low-level is responsible * for calling this function before and CTS-to-self frame is needed. */ -void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, +void ieee80211_ctstoself_get(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, const void *frame, size_t frame_len, const struct ieee80211_tx_control *frame_txctl, struct ieee80211_cts *cts); @@ -1379,7 +1397,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, /** * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. * @frame_txctl: &struct ieee80211_tx_control of the frame. * @@ -1387,28 +1405,30 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, * the duration field, the low-level driver uses this function to receive * the duration field value in little-endian byteorder. */ -__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, +__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_control *frame_txctl); /** * ieee80211_generic_frame_duration - Calculate the duration field for a frame * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame_len: the length of the frame. * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. * * Calculate the duration field of some generic frame, given its * length and transmission rate (in 100kbps). */ -__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, +__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, int rate); /** * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @control: will be filled with information needed to send returned frame. * * Function for accessing buffered broadcast and multicast frames. If @@ -1427,7 +1447,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, * use common code for all beacons. */ struct sk_buff * -ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, +ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_tx_control *control); /** @@ -1517,7 +1537,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw); */ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, void (*iterator)(void *data, u8 *mac, - int if_id), + struct ieee80211_vif *vif), void *data); #endif /* MAC80211_H */ diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 4807e5215a7..42c27089f00 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c @@ -243,7 +243,7 @@ static int ieee80211_open(struct net_device *dev) sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET; /* fall through */ default: - conf.if_id = dev->ifindex; + conf.vif = &sdata->vif; conf.type = sdata->type; conf.mac_addr = dev->dev_addr; res = local->ops->add_interface(local_to_hw(local), &conf); @@ -378,7 +378,7 @@ static int ieee80211_stop(struct net_device *dev) sdata->u.sta.extra_ie_len = 0; /* fall through */ default: - conf.if_id = dev->ifindex; + conf.vif = &sdata->vif; conf.type = sdata->type; conf.mac_addr = dev->dev_addr; /* disable all keys for as long as this netdev is down */ @@ -515,7 +515,7 @@ static int __ieee80211_if_config(struct net_device *dev, conf.beacon_control = control; } return local->ops->config_interface(local_to_hw(local), - dev->ifindex, &conf); + &sdata->vif, &conf); } int ieee80211_if_config(struct net_device *dev) @@ -527,11 +527,13 @@ int ieee80211_if_config_beacon(struct net_device *dev) { struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_tx_control control; + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct sk_buff *skb; if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) return 0; - skb = ieee80211_beacon_get(local_to_hw(local), dev->ifindex, &control); + skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif, + &control); if (!skb) return -ENOMEM; return __ieee80211_if_config(dev, skb, &control); @@ -736,7 +738,7 @@ static void ieee80211_remove_tx_extra(struct ieee80211_local *local, struct ieee80211_tx_packet_data *pkt_data; pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; - pkt_data->ifindex = control->ifindex; + pkt_data->ifindex = vif_to_sdata(control->vif)->dev->ifindex; pkt_data->flags = 0; if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS) pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index b898b316bda..c551a7f379e 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -387,8 +387,16 @@ struct ieee80211_sub_if_data { struct dentry *default_key; } debugfs; #endif + /* must be last, dynamically sized area in this! */ + struct ieee80211_vif vif; }; +static inline +struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) +{ + return container_of(p, struct ieee80211_sub_if_data, vif); +} + #define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev) enum { diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c index 7cfd8660b23..b7206637880 100644 --- a/net/mac80211/ieee80211_iface.c +++ b/net/mac80211/ieee80211_iface.c @@ -47,7 +47,7 @@ int ieee80211_if_add(struct net_device *dev, const char *name, int ret; ASSERT_RTNL(); - ndev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), + ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size, name, ieee80211_if_setup); if (!ndev) return -ENOMEM; diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 1257c7aab2a..32e24176472 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -177,9 +177,16 @@ struct sta_info * sta_info_add(struct ieee80211_local *local, list_add(&sta->list, &local->sta_list); local->num_sta++; sta_info_hash_add(local, sta); - if (local->ops->sta_notify) - local->ops->sta_notify(local_to_hw(local), dev->ifindex, - STA_NOTIFY_ADD, addr); + if (local->ops->sta_notify) { + struct ieee80211_sub_if_data *sdata; + + sdata = IEEE80211_DEV_TO_SUB_IF(dev); + if (sdata->type == IEEE80211_IF_TYPE_VLAN) + sdata = sdata->u.vlan.ap; + + local->ops->sta_notify(local_to_hw(local), &sdata->vif, + STA_NOTIFY_ADD, addr); + } write_unlock_bh(&local->sta_lock); #ifdef CONFIG_MAC80211_VERBOSE_DEBUG @@ -247,9 +254,17 @@ void sta_info_free(struct sta_info *sta) ieee80211_key_free(sta->key); sta->key = NULL; - if (local->ops->sta_notify) - local->ops->sta_notify(local_to_hw(local), sta->dev->ifindex, - STA_NOTIFY_REMOVE, sta->addr); + if (local->ops->sta_notify) { + struct ieee80211_sub_if_data *sdata; + + sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); + + if (sdata->type == IEEE80211_IF_TYPE_VLAN) + sdata = sdata->u.vlan.ap; + + local->ops->sta_notify(local_to_hw(local), &sdata->vif, + STA_NOTIFY_REMOVE, sta->addr); + } rate_control_remove_sta_debugfs(sta); ieee80211_sta_debugfs_remove(sta); diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index f6194167253..1b772ee2fe1 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -999,9 +999,7 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, return TXRX_CONTINUE; } -/* Device in tx->dev has a reference added; use dev_put(tx->dev) when - * finished with it. - * +/* * NB: @tx is uninitialised when passed in here */ static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, @@ -1022,6 +1020,7 @@ static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, return -ENODEV; /* initialises tx with control */ __ieee80211_tx_prepare(tx, skb, dev, control); + dev_put(dev); return 0; } @@ -1252,7 +1251,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, } } - control.ifindex = odev->ifindex; + control.vif = &osdata->vif; control.type = osdata->type; if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS) control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS; @@ -1691,7 +1690,8 @@ static void ieee80211_beacon_add_tim(struct ieee80211_local *local, read_unlock_bh(&local->sta_lock); } -struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, +struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_tx_control *control) { struct ieee80211_local *local = hw_to_local(hw); @@ -1703,19 +1703,16 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, u8 *b_head, *b_tail; int bh_len, bt_len; - bdev = dev_get_by_index(&init_net, if_id); - if (bdev) { - sdata = IEEE80211_DEV_TO_SUB_IF(bdev); - ap = &sdata->u.ap; - dev_put(bdev); - } + sdata = vif_to_sdata(vif); + bdev = sdata->dev; + ap = &sdata->u.ap; if (!ap || sdata->type != IEEE80211_IF_TYPE_AP || !ap->beacon_head) { #ifdef CONFIG_MAC80211_VERBOSE_DEBUG if (net_ratelimit()) - printk(KERN_DEBUG "no beacon data avail for idx=%d " - "(%s)\n", if_id, bdev ? bdev->name : "N/A"); + printk(KERN_DEBUG "no beacon data avail for %s\n", + bdev->name); #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ return NULL; } @@ -1771,7 +1768,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, } EXPORT_SYMBOL(ieee80211_beacon_get); -void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, +void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const void *frame, size_t frame_len, const struct ieee80211_tx_control *frame_txctl, struct ieee80211_rts *rts) @@ -1781,13 +1778,14 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS; rts->frame_control = cpu_to_le16(fctl); - rts->duration = ieee80211_rts_duration(hw, if_id, frame_len, frame_txctl); + rts->duration = ieee80211_rts_duration(hw, vif, frame_len, + frame_txctl); memcpy(rts->ra, hdr->addr1, sizeof(rts->ra)); memcpy(rts->ta, hdr->addr2, sizeof(rts->ta)); } EXPORT_SYMBOL(ieee80211_rts_get); -void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, +void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const void *frame, size_t frame_len, const struct ieee80211_tx_control *frame_txctl, struct ieee80211_cts *cts) @@ -1797,13 +1795,15 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS; cts->frame_control = cpu_to_le16(fctl); - cts->duration = ieee80211_ctstoself_duration(hw, if_id, frame_len, frame_txctl); + cts->duration = ieee80211_ctstoself_duration(hw, vif, + frame_len, frame_txctl); memcpy(cts->ra, hdr->addr1, sizeof(cts->ra)); } EXPORT_SYMBOL(ieee80211_ctstoself_get); struct sk_buff * -ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, +ieee80211_get_buffered_bc(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_tx_control *control) { struct ieee80211_local *local = hw_to_local(hw); @@ -1816,12 +1816,9 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, struct ieee80211_sub_if_data *sdata; struct ieee80211_if_ap *bss = NULL; - bdev = dev_get_by_index(&init_net, if_id); - if (bdev) { - sdata = IEEE80211_DEV_TO_SUB_IF(bdev); - bss = &sdata->u.ap; - dev_put(bdev); - } + sdata = vif_to_sdata(vif); + bdev = sdata->dev; + if (!bss || sdata->type != IEEE80211_IF_TYPE_AP || !bss->beacon_head) return NULL; @@ -1857,7 +1854,6 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, if (res == TXRX_DROP || res == TXRX_QUEUED) break; } - dev_put(tx.dev); skb = tx.skb; /* handlers are allowed to change skb */ if (res == TXRX_DROP) { diff --git a/net/mac80211/util.c b/net/mac80211/util.c index adb85dd5098..15503ca3e94 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -302,44 +302,34 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, } /* Exported duration function for driver use */ -__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, +__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, int rate) { struct ieee80211_local *local = hw_to_local(hw); - struct net_device *bdev = dev_get_by_index(&init_net, if_id); - struct ieee80211_sub_if_data *sdata; + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); u16 dur; int erp; - if (unlikely(!bdev)) - return 0; - - sdata = IEEE80211_DEV_TO_SUB_IF(bdev); erp = ieee80211_is_erp_rate(hw->conf.phymode, rate); dur = ieee80211_frame_duration(local, frame_len, rate, erp, sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE); - dev_put(bdev); return cpu_to_le16(dur); } EXPORT_SYMBOL(ieee80211_generic_frame_duration); -__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, - size_t frame_len, +__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_control *frame_txctl) { struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_rate *rate; - struct net_device *bdev = dev_get_by_index(&init_net, if_id); - struct ieee80211_sub_if_data *sdata; + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); int short_preamble; int erp; u16 dur; - if (unlikely(!bdev)) - return 0; - - sdata = IEEE80211_DEV_TO_SUB_IF(bdev); short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; rate = frame_txctl->rts_rate; @@ -355,27 +345,22 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, dur += ieee80211_frame_duration(local, 10, rate->rate, erp, short_preamble); - dev_put(bdev); return cpu_to_le16(dur); } EXPORT_SYMBOL(ieee80211_rts_duration); -__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, +__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_control *frame_txctl) { struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_rate *rate; - struct net_device *bdev = dev_get_by_index(&init_net, if_id); - struct ieee80211_sub_if_data *sdata; + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); int short_preamble; int erp; u16 dur; - if (unlikely(!bdev)) - return 0; - - sdata = IEEE80211_DEV_TO_SUB_IF(bdev); short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; rate = frame_txctl->rts_rate; @@ -390,7 +375,6 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, erp, short_preamble); } - dev_put(bdev); return cpu_to_le16(dur); } EXPORT_SYMBOL(ieee80211_ctstoself_duration); @@ -475,10 +459,11 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw) } EXPORT_SYMBOL(ieee80211_wake_queues); -void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, - void (*iterator)(void *data, u8 *mac, - int if_id), - void *data) +void ieee80211_iterate_active_interfaces( + struct ieee80211_hw *hw, + void (*iterator)(void *data, u8 *mac, + struct ieee80211_vif *vif), + void *data) { struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_sub_if_data *sdata; @@ -501,7 +486,7 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, continue; if (netif_running(sdata->dev)) iterator(data, sdata->dev->dev_addr, - sdata->dev->ifindex); + &sdata->vif); } rcu_read_unlock(); -- cgit v1.2.3-70-g09d2 From 9ab461732a3cd8e7a7cf13cc46ed4c1ac7907824 Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Tue, 25 Dec 2007 17:00:38 +0200 Subject: iwlwifi: A-MPDU Rx flow enabled This patch enables the A-MPDU Rx flow. it contains several adjustments to new mac80211 A-MPDU Rx flow. Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965.c | 65 ++++++++++++++--------------- drivers/net/wireless/iwlwifi/iwl-4965.h | 7 ++-- drivers/net/wireless/iwlwifi/iwl4965-base.c | 3 +- 3 files changed, 35 insertions(+), 40 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 0f58acabb97..89e2c44bfcc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -3968,9 +3968,6 @@ static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, .antenna = 0, .rate = iwl4965_hw_get_rate(rx_start->rate_n_flags), .flag = 0, -#ifdef CONFIG_IWL4965_HT_AGG - .ordered = 0 -#endif /* CONFIG_IWL4965_HT_AGG */ }; u8 network_packet; @@ -4165,7 +4162,7 @@ static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, break; case IEEE80211_FTYPE_CTL: -#ifdef CONFIG_IWL4965_HT_AGG +#ifdef CONFIG_IWL4965_HT switch (fc & IEEE80211_FCTL_STYPE) { case IEEE80211_STYPE_BACK_REQ: IWL_DEBUG_HT("IEEE80211_STYPE_BACK_REQ arrived\n"); @@ -4176,7 +4173,6 @@ static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, break; } #endif - break; case IEEE80211_FTYPE_DATA: { @@ -4763,8 +4759,6 @@ void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index, return; } -#ifdef CONFIG_IWL4965_HT_AGG - static void iwl4965_sta_modify_add_ba_tid(struct iwl4965_priv *priv, int sta_id, int tid, u16 ssn) { @@ -4796,6 +4790,36 @@ static void iwl4965_sta_modify_del_ba_tid(struct iwl4965_priv *priv, iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); } +int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, + enum ieee80211_ampdu_mlme_action action, + const u8 *addr, u16 tid, u16 ssn) +{ + struct iwl4965_priv *priv = hw->priv; + int sta_id; + DECLARE_MAC_BUF(mac); + + IWL_DEBUG_HT("A-MPDU action on da=%s tid=%d ", + print_mac(mac, addr), tid); + sta_id = iwl4965_hw_find_station(priv, addr); + switch (action) { + case IEEE80211_AMPDU_RX_START: + IWL_DEBUG_HT("start Rx\n"); + iwl4965_sta_modify_add_ba_tid(priv, sta_id, tid, ssn); + break; + case IEEE80211_AMPDU_RX_STOP: + IWL_DEBUG_HT("stop Rx\n"); + iwl4965_sta_modify_del_ba_tid(priv, sta_id, tid); + break; + default: + IWL_DEBUG_HT("unknown\n"); + return -EINVAL; + break; + } + return 0; +} + +#ifdef CONFIG_IWL4965_HT_AGG + static const u16 default_tid_to_tx_fifo[] = { IWL_TX_FIFO_AC1, IWL_TX_FIFO_AC0, @@ -4925,33 +4949,6 @@ int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, return 0; } -int iwl4965_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da, - u16 tid, u16 start_seq_num) -{ - struct iwl4965_priv *priv = hw->priv; - int sta_id; - DECLARE_MAC_BUF(mac); - - IWL_WARNING("iwl-AGG iwl4965_mac_ht_rx_agg_start on da=%s" - " tid=%d\n", print_mac(mac, da), tid); - sta_id = iwl4965_hw_find_station(priv, da); - iwl4965_sta_modify_add_ba_tid(priv, sta_id, tid, start_seq_num); - return 0; -} - -int iwl4965_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, - u16 tid, int generator) -{ - struct iwl4965_priv *priv = hw->priv; - int sta_id; - DECLARE_MAC_BUF(mac); - - IWL_WARNING("iwl-AGG iwl4965_mac_ht_rx_agg_stop on da=%s tid=%d\n", - print_mac(mac, da), tid); - sta_id = iwl4965_hw_find_station(priv, da); - iwl4965_sta_modify_del_ba_tid(priv, sta_id, tid); - return 0; -} #endif /* CONFIG_IWL4965_HT_AGG */ #endif /* CONFIG_IWL4965_HT */ diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index aad7f70bab7..c38648216dc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -780,13 +780,12 @@ extern void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, struct iwl_ht_info *ht_info); extern void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index, struct ieee80211_ht_info *sta_ht_inf); +extern int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, + enum ieee80211_ampdu_mlme_action action, + const u8 *addr, u16 tid, u16 ssn); #ifdef CONFIG_IWL4965_HT_AGG extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, u16 tid, u16 *start_seq_num); -extern int iwl4965_mac_ht_rx_agg_start(struct ieee80211_hw *hw, u8 *da, - u16 tid, u16 start_seq_num); -extern int iwl4965_mac_ht_rx_agg_stop(struct ieee80211_hw *hw, u8 *da, - u16 tid, int generator); extern int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, int generator); extern void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 52eb37f4ac7..92bb7e13a1f 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -8955,11 +8955,10 @@ static struct ieee80211_ops iwl4965_hw_ops = { .erp_ie_changed = iwl4965_mac_erp_ie_changed, #ifdef CONFIG_IWL4965_HT .conf_ht = iwl4965_mac_conf_ht, + .ampdu_action = iwl4965_mac_ampdu_action, #ifdef CONFIG_IWL4965_HT_AGG .ht_tx_agg_start = iwl4965_mac_ht_tx_agg_start, .ht_tx_agg_stop = iwl4965_mac_ht_tx_agg_stop, - .ht_rx_agg_start = iwl4965_mac_ht_rx_agg_start, - .ht_rx_agg_stop = iwl4965_mac_ht_rx_agg_stop, #endif /* CONFIG_IWL4965_HT_AGG */ #endif /* CONFIG_IWL4965_HT */ .hw_scan = iwl4965_mac_hw_scan -- cgit v1.2.3-70-g09d2 From 471b3efdfccc257591331724145f8ccf8b3217e1 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 28 Dec 2007 14:32:58 +0100 Subject: mac80211: add unified BSS configuration This patch (based on Ron Rindjunsky's) creates a framework for a unified way to pass BSS configuration to drivers that require the information, e.g. for implementing power save mode. This patch introduces new ieee80211_bss_conf structure that is passed to the driver via the new bss_info_changed() callback when the BSS configuration changes. This new BSS configuration infrastructure adds the following new features: * drivers are notified of their association AID * drivers are notified of association status and replaces the erp_ie_changed() callback. The patch also does the relevant driver updates for the latter change. Signed-off-by: Ron Rindjunsky Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 6 +-- drivers/net/wireless/iwlwifi/iwl-4965.c | 6 +-- drivers/net/wireless/iwlwifi/iwl4965-base.c | 24 +++++++--- drivers/net/wireless/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500usb.c | 2 +- drivers/net/wireless/rt2x00/rt2x00.h | 6 ++- drivers/net/wireless/rt2x00/rt2x00dev.c | 13 ++++-- drivers/net/wireless/rt2x00/rt2x00mac.c | 16 ++++--- drivers/net/wireless/rt2x00/rt61pci.c | 2 +- drivers/net/wireless/rt2x00/rt73usb.c | 2 +- drivers/net/wireless/zd1211rw/zd_mac.c | 12 ++--- include/net/mac80211.h | 66 ++++++++++++++++++++------- net/mac80211/debugfs_netdev.c | 2 +- net/mac80211/ieee80211.c | 29 +++++++----- net/mac80211/ieee80211_i.h | 19 +++++--- net/mac80211/ieee80211_sta.c | 69 +++++++++++++++-------------- net/mac80211/tx.c | 13 +++--- net/mac80211/util.c | 12 ++--- 19 files changed, 183 insertions(+), 120 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index a793cd11f73..77e7202c026 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -520,10 +520,8 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, break; /* - * TODO: There is no callback function from upper - * stack to inform us when associated status. this - * work around to sniff assoc_resp management frame - * and finish the association process. + * TODO: Use the new callback function from + * mac80211 instead of sniffing these packets. */ case IEEE80211_STYPE_ASSOC_RESP: case IEEE80211_STYPE_REASSOC_RESP:{ diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 89e2c44bfcc..ed3f119b56c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -4095,10 +4095,8 @@ static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, break; /* - * TODO: There is no callback function from upper - * stack to inform us when associated status. this - * work around to sniff assoc_resp management frame - * and finish the association process. + * TODO: Use the new callback function from + * mac80211 instead of sniffing these packets. */ case IEEE80211_STYPE_ASSOC_RESP: case IEEE80211_STYPE_REASSOC_RESP: diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 92bb7e13a1f..2597c08a239 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -7764,25 +7764,35 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, IWL_DEBUG_MAC80211("leave\n"); } -static void iwl4965_mac_erp_ie_changed(struct ieee80211_hw *hw, - u8 changes, int cts_protection, int preamble) + +static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, + u32 changes) { struct iwl4965_priv *priv = hw->priv; - if (changes & IEEE80211_ERP_CHANGE_PREAMBLE) { - if (preamble == WLAN_ERP_PREAMBLE_SHORT) + if (changes & BSS_CHANGED_ERP_PREAMBLE) { + if (bss_conf->use_short_preamble) priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; else priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; } - if (changes & IEEE80211_ERP_CHANGE_PROTECTION) { - if (cts_protection && (priv->phymode != MODE_IEEE80211A)) + if (changes & BSS_CHANGED_ERP_CTS_PROT) { + if (bss_conf->use_cts_prot && (priv->phymode != MODE_IEEE80211A)) priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; else priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; } + if (changes & BSS_CHANGED_ASSOC) { + /* + * TODO: + * do stuff instead of sniffing assoc resp + */ + } + if (iwl4965_is_associated(priv)) iwl4965_send_rxon_assoc(priv); } @@ -8952,7 +8962,7 @@ static struct ieee80211_ops iwl4965_hw_ops = { .get_tsf = iwl4965_mac_get_tsf, .reset_tsf = iwl4965_mac_reset_tsf, .beacon_update = iwl4965_mac_beacon_update, - .erp_ie_changed = iwl4965_mac_erp_ie_changed, + .bss_info_changed = iwl4965_bss_info_changed, #ifdef CONFIG_IWL4965_HT .conf_ht = iwl4965_mac_conf_ht, .ampdu_action = iwl4965_mac_ampdu_action, diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index f4d0c779ac7..d6cba138c7a 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c @@ -1524,7 +1524,7 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = { .configure_filter = rt2400pci_configure_filter, .get_stats = rt2x00mac_get_stats, .set_retry_limit = rt2400pci_set_retry_limit, - .erp_ie_changed = rt2x00mac_erp_ie_changed, + .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2400pci_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt2400pci_get_tsf, diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 206b50ff831..e874fdcae20 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c @@ -1835,7 +1835,7 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = { .configure_filter = rt2500pci_configure_filter, .get_stats = rt2x00mac_get_stats, .set_retry_limit = rt2500pci_set_retry_limit, - .erp_ie_changed = rt2x00mac_erp_ie_changed, + .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2x00mac_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt2500pci_get_tsf, diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 6579718f36a..1933113d7ba 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c @@ -1776,7 +1776,7 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = { .config_interface = rt2x00mac_config_interface, .configure_filter = rt2500usb_configure_filter, .get_stats = rt2x00mac_get_stats, - .erp_ie_changed = rt2x00mac_erp_ie_changed, + .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2x00mac_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .beacon_update = rt2500usb_beacon_update, diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 94a8a7ce538..05927b908f8 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h @@ -936,8 +936,10 @@ int rt2x00mac_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats); int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw, struct ieee80211_tx_queue_stats *stats); -void rt2x00mac_erp_ie_changed(struct ieee80211_hw *hw, u8 changes, - int cts_protection, int preamble); +void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, + u32 changes); int rt2x00mac_conf_tx(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params); diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index b26c634f210..72cfe6f866f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c @@ -481,10 +481,17 @@ static void rt2x00lib_configuration_scheduled(struct work_struct *work) { struct rt2x00_dev *rt2x00dev = container_of(work, struct rt2x00_dev, config_work); - int preamble = !test_bit(CONFIG_SHORT_PREAMBLE, &rt2x00dev->flags); + struct ieee80211_bss_conf bss_conf; - rt2x00mac_erp_ie_changed(rt2x00dev->hw, - IEEE80211_ERP_CHANGE_PREAMBLE, 0, preamble); + bss_conf.use_short_preamble = + test_bit(CONFIG_SHORT_PREAMBLE, &rt2x00dev->flags); + + /* + * FIXME: shouldn't invoke it this way because all other contents + * of bss_conf is invalid. + */ + rt2x00mac_bss_info_changed(rt2x00dev->hw, rt2x00dev->interface.id, + &bss_conf, BSS_CHANGED_ERP_PREAMBLE); } /* diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 1d67bcd46bc..e3f15e518c7 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c @@ -342,23 +342,27 @@ int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw, } EXPORT_SYMBOL_GPL(rt2x00mac_get_tx_stats); -void rt2x00mac_erp_ie_changed(struct ieee80211_hw *hw, u8 changes, - int cts_protection, int preamble) +void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, + u32 changes) { struct rt2x00_dev *rt2x00dev = hw->priv; int short_preamble; int ack_timeout; int ack_consume_time; int difs; + int preamble; /* * We only support changing preamble mode. */ - if (!(changes & IEEE80211_ERP_CHANGE_PREAMBLE)) + if (!(changes & BSS_CHANGED_ERP_PREAMBLE)) return; - short_preamble = !preamble; - preamble = !!(preamble) ? PREAMBLE : SHORT_PREAMBLE; + short_preamble = bss_conf->use_short_preamble; + preamble = bss_conf->use_short_preamble ? + SHORT_PREAMBLE : PREAMBLE; difs = (hw->conf.flags & IEEE80211_CONF_SHORT_SLOT_TIME) ? SHORT_DIFS : DIFS; @@ -374,7 +378,7 @@ void rt2x00mac_erp_ie_changed(struct ieee80211_hw *hw, u8 changes, rt2x00dev->ops->lib->config_preamble(rt2x00dev, short_preamble, ack_timeout, ack_consume_time); } -EXPORT_SYMBOL_GPL(rt2x00mac_erp_ie_changed); +EXPORT_SYMBOL_GPL(rt2x00mac_bss_info_changed); int rt2x00mac_conf_tx(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params) diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 88d16980088..ab52f221cd7 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c @@ -2441,7 +2441,7 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = { .configure_filter = rt61pci_configure_filter, .get_stats = rt2x00mac_get_stats, .set_retry_limit = rt61pci_set_retry_limit, - .erp_ie_changed = rt2x00mac_erp_ie_changed, + .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2x00mac_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt61pci_get_tsf, diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 47ed3070ae0..f9518764aeb 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c @@ -2024,7 +2024,7 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = { .configure_filter = rt73usb_configure_filter, .get_stats = rt2x00mac_get_stats, .set_retry_limit = rt73usb_set_retry_limit, - .erp_ie_changed = rt2x00mac_erp_ie_changed, + .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2x00mac_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt73usb_get_tsf, diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 3409cf97f5f..49127e4b42c 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c @@ -849,17 +849,19 @@ static void set_rts_cts_work(struct work_struct *work) mutex_unlock(&mac->chip.mutex); } -static void zd_op_erp_ie_changed(struct ieee80211_hw *hw, u8 changes, - int cts_protection, int preamble) +static void zd_op_bss_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, + u32 changes) { struct zd_mac *mac = zd_hw_mac(hw); unsigned long flags; dev_dbg_f(zd_mac_dev(mac), "changes: %x\n", changes); - if (changes & IEEE80211_ERP_CHANGE_PREAMBLE) { + if (changes & BSS_CHANGED_ERP_PREAMBLE) { spin_lock_irqsave(&mac->lock, flags); - mac->short_preamble = !preamble; + mac->short_preamble = bss_conf->use_short_preamble; if (!mac->updating_rts_rate) { mac->updating_rts_rate = 1; /* FIXME: should disable TX here, until work has @@ -879,7 +881,7 @@ static const struct ieee80211_ops zd_ops = { .config = zd_op_config, .config_interface = zd_op_config_interface, .configure_filter = zd_op_configure_filter, - .erp_ie_changed = zd_op_erp_ie_changed, + .bss_info_changed = zd_op_bss_info_changed, }; struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 8a49c06dfd3..9083bafb63c 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -275,6 +275,43 @@ struct ieee80211_low_level_stats { unsigned int dot11RTSSuccessCount; }; +/** + * enum ieee80211_bss_change - BSS change notification flags + * + * These flags are used with the bss_info_changed() callback + * to indicate which BSS parameter changed. + * + * @BSS_CHANGED_ASSOC: association status changed (associated/disassociated), + * also implies a change in the AID. + * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed + * @BSS_CHANGED_ERP_PREAMBLE: preamble changed + */ +enum ieee80211_bss_change { + BSS_CHANGED_ASSOC = 1<<0, + BSS_CHANGED_ERP_CTS_PROT = 1<<1, + BSS_CHANGED_ERP_PREAMBLE = 1<<2, +}; + +/** + * struct ieee80211_bss_conf - holds the BSS's changing parameters + * + * This structure keeps information about a BSS (and an association + * to that BSS) that can change during the lifetime of the BSS. + * + * @assoc: association status + * @aid: association ID number, valid only when @assoc is true + * @use_cts_prot: use CTS protection + * @use_short_preamble: use 802.11b short preamble + */ +struct ieee80211_bss_conf { + /* association related data */ + bool assoc; + u16 aid; + /* erp related data */ + bool use_cts_prot; + bool use_short_preamble; +}; + /* Transmit control fields. This data structure is passed to low-level driver * with each TX frame. The low-level driver is responsible for configuring * the hardware to use given values (depending on what is supported). */ @@ -923,19 +960,6 @@ enum ieee80211_filter_flags { FIF_OTHER_BSS = 1<<6, }; -/** - * enum ieee80211_erp_change_flags - erp change flags - * - * These flags are used with the erp_ie_changed() callback in - * &struct ieee80211_ops to indicate which parameter(s) changed. - * @IEEE80211_ERP_CHANGE_PROTECTION: protection changed - * @IEEE80211_ERP_CHANGE_PREAMBLE: barker preamble mode changed - */ -enum ieee80211_erp_change_flags { - IEEE80211_ERP_CHANGE_PROTECTION = 1<<0, - IEEE80211_ERP_CHANGE_PREAMBLE = 1<<1, -}; - /** * enum ieee80211_ampdu_mlme_action - A-MPDU actions * @@ -1004,6 +1028,14 @@ enum ieee80211_ampdu_mlme_action { * @config_interface: Handler for configuration requests related to interfaces * (e.g. BSSID changes.) * + * @bss_info_changed: Handler for configuration requests related to BSS + * parameters that may vary during BSS's lifespan, and may affect low + * level driver (e.g. assoc/disassoc status, erp parameters). + * This function should not be used if no BSS has been set, unless + * for association indication. The @changed parameter indicates which + * of the bss parameters has changed when a call is made. This callback + * has to be atomic. + * * @configure_filter: Configure the device's RX filter. * See the section "Frame filtering" for more information. * This callback must be implemented and atomic. @@ -1038,8 +1070,6 @@ enum ieee80211_ampdu_mlme_action { * @sta_notify: Notifies low level driver about addition or removal * of assocaited station or AP. * - * @erp_ie_changed: Handle ERP IE change notifications. Must be atomic. - * * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), * bursting) for a hardware TX queue. The @queue parameter uses the * %IEEE80211_TX_QUEUE_* constants. Must be atomic. @@ -1096,6 +1126,10 @@ struct ieee80211_ops { int (*config_interface)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_if_conf *conf); + void (*bss_info_changed)(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *info, + u32 changed); void (*configure_filter)(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, @@ -1115,8 +1149,6 @@ struct ieee80211_ops { u32 short_retry, u32 long_retr); void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum sta_notify_cmd, const u8 *addr); - void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes, - int cts_protection, int preamble); int (*conf_tx)(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params); int (*get_tx_stats)(struct ieee80211_hw *hw, diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 3500fe0d380..829872a3ae8 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c @@ -118,7 +118,7 @@ static ssize_t ieee80211_if_fmt_flags( sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "", sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "", sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "", - sdata->flags & IEEE80211_SDATA_USE_PROTECTION ? "CTS prot\n" : ""); + sdata->bss_conf.use_cts_prot ? "CTS prot\n" : ""); } __IEEE80211_IF_FILE(flags); diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 859682eee54..17704021823 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c @@ -635,25 +635,30 @@ int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht, return 0; } -void ieee80211_erp_info_change_notify(struct net_device *dev, u8 changes) +void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, + u32 changed) { - struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - if (local->ops->erp_ie_changed) - local->ops->erp_ie_changed(local_to_hw(local), changes, - !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION), - !(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE)); + struct ieee80211_local *local = sdata->local; + + if (!changed) + return; + + if (local->ops->bss_info_changed) + local->ops->bss_info_changed(local_to_hw(local), + &sdata->vif, + &sdata->bss_conf, + changed); } void ieee80211_reset_erp_info(struct net_device *dev) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - sdata->flags &= ~(IEEE80211_SDATA_USE_PROTECTION | - IEEE80211_SDATA_SHORT_PREAMBLE); - ieee80211_erp_info_change_notify(dev, - IEEE80211_ERP_CHANGE_PROTECTION | - IEEE80211_ERP_CHANGE_PREAMBLE); + sdata->bss_conf.use_cts_prot = 0; + sdata->bss_conf.use_short_preamble = 0; + ieee80211_bss_info_change_notify(sdata, + BSS_CHANGED_ERP_CTS_PROT | + BSS_CHANGED_ERP_PREAMBLE); } void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 08a6c0cff69..72ecbf7bf96 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -291,12 +291,7 @@ struct ieee80211_if_sta { /* flags used in struct ieee80211_sub_if_data.flags */ #define IEEE80211_SDATA_ALLMULTI BIT(0) #define IEEE80211_SDATA_PROMISC BIT(1) -#define IEEE80211_SDATA_USE_PROTECTION BIT(2) /* CTS protect ERP frames */ -/* use short preamble with IEEE 802.11b: this flag is set when the AP or beacon - * generator reports that there are no present stations that cannot support short - * preambles */ -#define IEEE80211_SDATA_SHORT_PREAMBLE BIT(3) -#define IEEE80211_SDATA_USERSPACE_MLME BIT(4) +#define IEEE80211_SDATA_USERSPACE_MLME BIT(2) struct ieee80211_sub_if_data { struct list_head list; @@ -327,6 +322,15 @@ struct ieee80211_sub_if_data { struct ieee80211_key *keys[NUM_DEFAULT_KEYS]; struct ieee80211_key *default_key; + /* + * BSS configuration for this interface. + * + * FIXME: I feel bad putting this here when we already have a + * bss pointer, but the bss pointer is just wrong when + * you have multiple virtual STA mode interfaces... + * This needs to be fixed. + */ + struct ieee80211_bss_conf bss_conf; struct ieee80211_if_ap *bss; /* BSS that this device belongs to */ union { @@ -770,7 +774,8 @@ struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev, u8 *addr); int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason); int ieee80211_sta_disassociate(struct net_device *dev, u16 reason); -void ieee80211_erp_info_change_notify(struct net_device *dev, u8 changes); +void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, + u32 changed); void ieee80211_reset_erp_info(struct net_device *dev); int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, struct ieee80211_ht_info *ht_info); diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c index b1e7d17ee25..866eb807812 100644 --- a/net/mac80211/ieee80211_sta.c +++ b/net/mac80211/ieee80211_sta.c @@ -313,48 +313,42 @@ static void ieee80211_sta_wmm_params(struct net_device *dev, } -static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value) +static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata, + u8 erp_value) { - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; struct ieee80211_if_sta *ifsta = &sdata->u.sta; - int use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; - int preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0; - u8 changes = 0; + bool use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; + bool preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0; DECLARE_MAC_BUF(mac); + u32 changed = 0; - if (use_protection != !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION)) { + if (use_protection != bss_conf->use_cts_prot) { if (net_ratelimit()) { printk(KERN_DEBUG "%s: CTS protection %s (BSSID=" "%s)\n", - dev->name, + sdata->dev->name, use_protection ? "enabled" : "disabled", print_mac(mac, ifsta->bssid)); } - if (use_protection) - sdata->flags |= IEEE80211_SDATA_USE_PROTECTION; - else - sdata->flags &= ~IEEE80211_SDATA_USE_PROTECTION; - changes |= IEEE80211_ERP_CHANGE_PROTECTION; + bss_conf->use_cts_prot = use_protection; + changed |= BSS_CHANGED_ERP_CTS_PROT; } - if (preamble_mode != !(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE)) { + if (preamble_mode != bss_conf->use_short_preamble) { if (net_ratelimit()) { printk(KERN_DEBUG "%s: switched to %s barker preamble" " (BSSID=%s)\n", - dev->name, + sdata->dev->name, (preamble_mode == WLAN_ERP_PREAMBLE_SHORT) ? "short" : "long", print_mac(mac, ifsta->bssid)); } - if (preamble_mode) - sdata->flags &= ~IEEE80211_SDATA_SHORT_PREAMBLE; - else - sdata->flags |= IEEE80211_SDATA_SHORT_PREAMBLE; - changes |= IEEE80211_ERP_CHANGE_PREAMBLE; + bss_conf->use_short_preamble = preamble_mode; + changed |= BSS_CHANGED_ERP_PREAMBLE; } - if (changes) - ieee80211_erp_info_change_notify(dev, changes); + return changed; } int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, @@ -458,19 +452,16 @@ static void ieee80211_set_associated(struct net_device *dev, struct ieee80211_if_sta *ifsta, bool assoc) { - struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + struct ieee80211_local *local = sdata->local; union iwreq_data wrqu; - - if (!!(ifsta->flags & IEEE80211_STA_ASSOCIATED) == assoc) - return; + u32 changed = BSS_CHANGED_ASSOC; if (assoc) { - struct ieee80211_sub_if_data *sdata; struct ieee80211_sta_bss *bss; ifsta->flags |= IEEE80211_STA_ASSOCIATED; - sdata = IEEE80211_DEV_TO_SUB_IF(dev); if (sdata->vif.type != IEEE80211_IF_TYPE_STA) return; @@ -479,7 +470,8 @@ static void ieee80211_set_associated(struct net_device *dev, ifsta->ssid, ifsta->ssid_len); if (bss) { if (bss->has_erp_value) - ieee80211_handle_erp_ie(dev, bss->erp_value); + changed |= ieee80211_handle_erp_ie( + sdata, bss->erp_value); ieee80211_rx_bss_put(dev, bss); } @@ -499,6 +491,8 @@ static void ieee80211_set_associated(struct net_device *dev, wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); ifsta->last_probe = jiffies; ieee80211_led_assoc(local, assoc); + + ieee80211_bss_info_change_notify(sdata, changed); } static void ieee80211_set_disassoc(struct net_device *dev, @@ -1536,18 +1530,20 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev, } -static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev, +static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, struct ieee80211_if_sta *ifsta, struct ieee80211_mgmt *mgmt, size_t len, int reassoc) { - struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); + struct ieee80211_local *local = sdata->local; + struct net_device *dev = sdata->dev; struct ieee80211_hw_mode *mode; struct sta_info *sta; u32 rates; u16 capab_info, status_code, aid; struct ieee802_11_elems elems; + struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; u8 *pos; int i, j; DECLARE_MAC_BUF(mac); @@ -1620,6 +1616,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev, if (ifsta->assocresp_ies) memcpy(ifsta->assocresp_ies, pos, ifsta->assocresp_ies_len); + /* set AID, ieee80211_set_associated() will tell the driver */ + bss_conf->aid = aid; ieee80211_set_associated(dev, ifsta, 1); /* Add STA entry for the AP */ @@ -2099,6 +2097,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, struct ieee802_11_elems elems; struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_conf *conf = &local->hw.conf; + u32 changed = 0; ieee80211_rx_bss_info(dev, mgmt, len, rx_status, 1); @@ -2119,7 +2118,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); if (elems.erp_info && elems.erp_info_len >= 1) - ieee80211_handle_erp_ie(dev, elems.erp_info[0]); + changed |= ieee80211_handle_erp_ie(sdata, elems.erp_info[0]); if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param && local->ops->conf_ht && @@ -2142,6 +2141,8 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, elems.wmm_param_len); } + + ieee80211_bss_info_change_notify(sdata, changed); } @@ -2329,10 +2330,10 @@ static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev, ieee80211_rx_mgmt_auth(dev, ifsta, mgmt, skb->len); break; case IEEE80211_STYPE_ASSOC_RESP: - ieee80211_rx_mgmt_assoc_resp(dev, ifsta, mgmt, skb->len, 0); + ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 0); break; case IEEE80211_STYPE_REASSOC_RESP: - ieee80211_rx_mgmt_assoc_resp(dev, ifsta, mgmt, skb->len, 1); + ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 1); break; case IEEE80211_STYPE_DEAUTH: ieee80211_rx_mgmt_deauth(dev, ifsta, mgmt, skb->len); @@ -2787,7 +2788,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, break; } control.tx_rate = - ((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) && + (sdata->bss_conf.use_short_preamble && (ratesel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ? ratesel.rate->val2 : ratesel.rate->val; control.antenna_sel_tx = local->hw.conf.antenna_sel_tx; diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 51c0f00d02d..f9088fe34d5 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -176,7 +176,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, * to closest integer */ dur = ieee80211_frame_duration(local, 10, rate, erp, - tx->sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE); + tx->sdata->bss_conf.use_short_preamble); if (next_frag_len) { /* Frame is fragmented: duration increases with time needed to @@ -185,8 +185,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, /* next fragment */ dur += ieee80211_frame_duration(local, next_frag_len, txrate->rate, erp, - tx->sdata->flags & - IEEE80211_SDATA_SHORT_PREAMBLE); + tx->sdata->bss_conf.use_short_preamble); } return dur; @@ -605,7 +604,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx) tx->u.tx.control->alt_retry_rate = -1; if (tx->u.tx.mode->mode == MODE_IEEE80211G && - (tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) && + tx->sdata->bss_conf.use_cts_prot && (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && rsel.nonerp) { tx->u.tx.last_frag_rate = tx->u.tx.rate; if (rsel.probe) @@ -667,7 +666,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) if (mode->mode == MODE_IEEE80211G && (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) && (tx->flags & IEEE80211_TXRXD_TXUNICAST) && - (tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) && + tx->sdata->bss_conf.use_cts_prot && !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; @@ -676,7 +675,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) * available on the network at the current point in time. */ if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && (tx->u.tx.rate->flags & IEEE80211_RATE_PREAMBLE2) && - (tx->sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) && + tx->sdata->bss_conf.use_short_preamble && (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { tx->u.tx.control->tx_rate = tx->u.tx.rate->val2; } @@ -1754,7 +1753,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, } control->tx_rate = - ((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) && + (sdata->bss_conf.use_short_preamble && (rsel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ? rsel.rate->val2 : rsel.rate->val; control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; diff --git a/net/mac80211/util.c b/net/mac80211/util.c index ba81cf54281..5e631ce98d7 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -312,8 +312,8 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int erp; erp = ieee80211_is_erp_rate(hw->conf.phymode, rate); - dur = ieee80211_frame_duration(local, frame_len, rate, - erp, sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE); + dur = ieee80211_frame_duration(local, frame_len, rate, erp, + sdata->bss_conf.use_short_preamble); return cpu_to_le16(dur); } @@ -326,11 +326,11 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_rate *rate; struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - int short_preamble; + bool short_preamble; int erp; u16 dur; - short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; + short_preamble = sdata->bss_conf.use_short_preamble; rate = frame_txctl->rts_rate; erp = !!(rate->flags & IEEE80211_RATE_ERP); @@ -357,11 +357,11 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_rate *rate; struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - int short_preamble; + bool short_preamble; int erp; u16 dur; - short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; + short_preamble = sdata->bss_conf.use_short_preamble; rate = frame_txctl->rts_rate; erp = !!(rate->flags & IEEE80211_RATE_ERP); -- cgit v1.2.3-70-g09d2 From 87e4f7dfe56dbaa5470e047d991c077f8e479d21 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Mon, 14 Jan 2008 17:46:16 -0800 Subject: iwlwifi: remove iwl4965_tx_cmd This patch removes iwl4965_tx_cmd function and splits its content to iwl4965_hw_build_tx_cmd_rate, iwl4965_build_tx_cmd_basic, and iwl4965_tl_get_stats function. The latest one will be deprecated when traffic load will move to rate scale module. Signed-off-by: Tomas Winkler Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965.c | 112 +++++++++------------------- drivers/net/wireless/iwlwifi/iwl-4965.h | 6 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 19 ++++- 3 files changed, 55 insertions(+), 82 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index a94578889e1..e6a0397266f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -2673,19 +2673,23 @@ void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv, struct ieee80211_hdr *hdr, int sta_id, int is_hcca) { - u8 rate; + struct iwl4965_tx_cmd *tx = &cmd->cmd.tx; u8 rts_retry_limit = 0; u8 data_retry_limit = 0; - __le32 tx_flags; u16 fc = le16_to_cpu(hdr->frame_control); + u8 rate_plcp; + u16 rate_flags = 0; + int rate_idx = min(ctrl->tx_rate & 0xffff, IWL_RATE_COUNT - 1); - tx_flags = cmd->cmd.tx.tx_flags; - - rate = iwl4965_rates[ctrl->tx_rate].plcp; + rate_plcp = iwl4965_rates[rate_idx].plcp; rts_retry_limit = (is_hcca) ? RTS_HCCA_RETRY_LIMIT : RTS_DFAULT_RETRY_LIMIT; + if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE)) + rate_flags |= RATE_MCS_CCK_MSK; + + if (ieee80211_is_probe_response(fc)) { data_retry_limit = 3; if (data_retry_limit < rts_retry_limit) @@ -2696,26 +2700,38 @@ void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv, if (priv->data_retry_limit != -1) data_retry_limit = priv->data_retry_limit; - if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) { + + if (ieee80211_is_data(fc)) { + tx->initial_rate_index = 0; + tx->tx_flags |= TX_CMD_FLG_STA_RATE_MSK; + } else { switch (fc & IEEE80211_FCTL_STYPE) { case IEEE80211_STYPE_AUTH: case IEEE80211_STYPE_DEAUTH: case IEEE80211_STYPE_ASSOC_REQ: case IEEE80211_STYPE_REASSOC_REQ: - if (tx_flags & TX_CMD_FLG_RTS_MSK) { - tx_flags &= ~TX_CMD_FLG_RTS_MSK; - tx_flags |= TX_CMD_FLG_CTS_MSK; + if (tx->tx_flags & TX_CMD_FLG_RTS_MSK) { + tx->tx_flags &= ~TX_CMD_FLG_RTS_MSK; + tx->tx_flags |= TX_CMD_FLG_CTS_MSK; } break; default: break; } + + /* Alternate between antenna A and B for successive frames */ + if (priv->use_ant_b_for_management_frame) { + priv->use_ant_b_for_management_frame = 0; + rate_flags |= RATE_MCS_ANT_B_MSK; + } else { + priv->use_ant_b_for_management_frame = 1; + rate_flags |= RATE_MCS_ANT_A_MSK; + } } - cmd->cmd.tx.rts_retry_limit = rts_retry_limit; - cmd->cmd.tx.data_retry_limit = data_retry_limit; - cmd->cmd.tx.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate, 0); - cmd->cmd.tx.tx_flags = tx_flags; + tx->rts_retry_limit = rts_retry_limit; + tx->data_retry_limit = data_retry_limit; + tx->rate_n_flags = iwl4965_hw_set_rate_n_flags(rate_plcp, rate_flags); } int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv) @@ -3254,69 +3270,13 @@ static void iwl4965_bg_agg_work(struct work_struct *work) spin_unlock_irqrestore(&priv->lq_mngr.lock, flags); return; } -#endif /*CONFIG_IWL4965_HT_AGG */ -#endif /* CONFIG_IWL4965_HT */ -int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd, - u8 sta_id, dma_addr_t txcmd_phys, - struct ieee80211_hdr *hdr, u8 hdr_len, - struct ieee80211_tx_control *ctrl, void *sta_in) +/* TODO: move this functionality to rate scaling */ +void iwl4965_tl_get_stats(struct iwl4965_priv *priv, + struct ieee80211_hdr *hdr) { - struct iwl4965_tx_cmd *tx = &out_cmd->cmd.tx; - dma_addr_t scratch_phys; - u8 unicast = 0; - u8 is_data = 1; - u16 fc; - u16 rate_flags; - int rate_index = min(ctrl->tx_rate & 0xffff, IWL_RATE_COUNT - 1); -#ifdef CONFIG_IWL4965_HT -#ifdef CONFIG_IWL4965_HT_AGG - __le16 *qc; -#endif /*CONFIG_IWL4965_HT_AGG */ -#endif /* CONFIG_IWL4965_HT */ - - unicast = !is_multicast_ether_addr(hdr->addr1); - - fc = le16_to_cpu(hdr->frame_control); - if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) - is_data = 0; + __le16 *qc = ieee80211_get_qos_ctrl(hdr); - scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) + - offsetof(struct iwl4965_tx_cmd, scratch); - tx->dram_lsb_ptr = cpu_to_le32(scratch_phys); - tx->dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys); - - /* Hard coded to start at the highest retry fallback position - * until the 4965 specific rate control algorithm is tied in */ - tx->initial_rate_index = LINK_QUAL_MAX_RETRY_NUM - 1; - - /* Alternate between antenna A and B for successive frames */ - if (priv->use_ant_b_for_management_frame) { - priv->use_ant_b_for_management_frame = 0; - rate_flags = RATE_MCS_ANT_B_MSK; - } else { - priv->use_ant_b_for_management_frame = 1; - rate_flags = RATE_MCS_ANT_A_MSK; - } - - if (!unicast || !is_data) { - if ((rate_index >= IWL_FIRST_CCK_RATE) && - (rate_index <= IWL_LAST_CCK_RATE)) - rate_flags |= RATE_MCS_CCK_MSK; - } else { - tx->initial_rate_index = 0; - tx->tx_flags |= TX_CMD_FLG_STA_RATE_MSK; - } - - tx->rate_n_flags = iwl4965_hw_set_rate_n_flags(iwl4965_rates[rate_index].plcp, - rate_flags); - - if (ieee80211_is_back_request(fc)) - tx->tx_flags |= TX_CMD_FLG_ACK_MSK | - TX_CMD_FLG_IMM_BA_RSP_MASK; -#ifdef CONFIG_IWL4965_HT -#ifdef CONFIG_IWL4965_HT_AGG - qc = ieee80211_get_qos_ctrl(hdr); if (qc && (priv->iw_mode != IEEE80211_IF_TYPE_IBSS)) { u8 tid = 0; @@ -3334,11 +3294,11 @@ int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd, spin_unlock_irqrestore(&priv->lq_mngr.lock, flags); schedule_work(&priv->agg_work); } -#endif -#endif - return 0; } +#endif /*CONFIG_IWL4965_HT_AGG */ +#endif /* CONFIG_IWL4965_HT */ + /** * sign_extend - Sign extend a value using specified bit as sign-bit * diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index c38648216dc..78bc148c9f7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -758,10 +758,6 @@ extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv, extern void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap); extern void iwl4965_set_rxon_chain(struct iwl4965_priv *priv); -extern int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd, - u8 sta_id, dma_addr_t txcmd_phys, - struct ieee80211_hdr *hdr, u8 hdr_len, - struct ieee80211_tx_control *ctrl, void *sta_in); extern int iwl4965_alive_notify(struct iwl4965_priv *priv); extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode); extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv); @@ -789,6 +785,8 @@ extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, extern int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, u16 tid, int generator); extern void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid); +extern void iwl4965_tl_get_stats(struct iwl4965_priv *priv, + struct ieee80211_hdr *hdr); #endif /* CONFIG_IWL4965_HT_AGG */ #endif /*CONFIG_IWL4965_HT */ /* Structures, enum, and defines specific to the 4965 */ diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 2597c08a239..ad824c607f3 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -2772,6 +2772,10 @@ static void iwl4965_build_tx_cmd_basic(struct iwl4965_priv *priv, tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; } + if (ieee80211_is_back_request(fc)) + tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK; + + cmd->cmd.tx.sta_id = std_id; if (ieee80211_get_morefrag(hdr)) tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK; @@ -2880,6 +2884,7 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, struct iwl4965_queue *q = NULL; dma_addr_t phys_addr; dma_addr_t txcmd_phys; + dma_addr_t scratch_phys; struct iwl4965_cmd *out_cmd = NULL; u16 len, idx, len_org; u8 id, hdr_len, unicast; @@ -3053,8 +3058,18 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, /* set is_hcca to 0; it probably will never be implemented */ iwl4965_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); - iwl4965_tx_cmd(priv, out_cmd, sta_id, txcmd_phys, - hdr, hdr_len, ctl, NULL); + scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) + + offsetof(struct iwl4965_tx_cmd, scratch); + out_cmd->cmd.tx.dram_lsb_ptr = cpu_to_le32(scratch_phys); + out_cmd->cmd.tx.dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys); + +#ifdef CONFIG_IWL4965_HT_AGG +#ifdef CONFIG_IWL4965_HT + /* TODO: move this functionality to rate scaling */ + iwl4965_tl_get_stats(priv, hdr); +#endif /* CONFIG_IWL4965_HT_AGG */ +#endif /*CONFIG_IWL4965_HT */ + if (!ieee80211_get_morefrag(hdr)) { txq->need_update = 1; -- cgit v1.2.3-70-g09d2 From 5a66926aa9230810704fd5a127966215fd58881e Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Mon, 14 Jan 2008 17:46:18 -0800 Subject: iwlwifi: delay firmware loading from pci_probe to network interface open This patch moves the firmware loading (read firmware from disk and load it into the device SRAM) from pci_probe time to the first network interface open time. There are two reasons for doing this: 1. To support kernel buildin iwlwifi drivers. Because kernel initializes network devices subsystem before hard disk and SATA subsystem, it is impossible to get the firmware image from hard disk in the PCI probe handler. Thus delaying the firmware loading into the network interface open time is the way to go. Note, we only read the firmware image from hard disk the first time the interface is open. After this is succeeded, we cache the firmware image into the host memory. This is a performance gain when user open and close the interface multiple times and is necessary for device suspend and resume. 2. For better power saving. When the iwlwifi modules are loaded (or buildin the kernel) but the wireless network interface is not being used, it is a good practice the wireless device consumes as less power as possible. Unloading the firmware from the wireless device and unregister the driver's interrupt handler in the network interface close handler provides users a way to achieve this. User space network configuration tools (i.e NetworkManager) can also contribute here when it detects a wired cable is connected and close the wireless interface automatically. This patch also includes the pci_save/restore_state() fixed by Ian Schram upon the first version. Signed-off-by: Zhu Yi Signed-off-by: Ian Schram Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 8 -- drivers/net/wireless/iwlwifi/iwl-4965.c | 5 - drivers/net/wireless/iwlwifi/iwl3945-base.c | 183 ++++++++++++++++----------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 187 ++++++++++++++++------------ 4 files changed, 217 insertions(+), 166 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 77e7202c026..0779a23729e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -1004,14 +1004,6 @@ int iwl3945_hw_nic_init(struct iwl3945_priv *priv) CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM); } - spin_unlock_irqrestore(&priv->lock, flags); - - /* Initialize the EEPROM */ - rc = iwl3945_eeprom_init(priv); - if (rc) - return rc; - - spin_lock_irqsave(&priv->lock, flags); if (EEPROM_SKU_CAP_OP_MODE_MRC == priv->eeprom.sku_cap) { IWL_DEBUG_INFO("SKU OP mode is mrc\n"); iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG, diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index e6a0397266f..5fcc2a6f5bf 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -506,11 +506,6 @@ int iwl4965_hw_nic_init(struct iwl4965_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); - /* Read the EEPROM */ - rc = iwl4965_eeprom_init(priv); - if (rc) - return rc; - if (priv->eeprom.calib_version < EEPROM_TX_POWER_VERSION_NEW) { IWL_ERROR("Older EEPROM detected! Aborting.\n"); return -EINVAL; diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 1830e13d5cf..e0e9bbdf140 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -6179,31 +6179,12 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv) } iwl3945_init_geos(priv); + iwl3945_reset_channel_flag(priv); if (iwl3945_is_rfkill(priv)) return; - if (!priv->mac80211_registered) { - /* Unlock so any user space entry points can call back into - * the driver without a deadlock... */ - mutex_unlock(&priv->mutex); - iwl3945_rate_control_register(priv->hw); - rc = ieee80211_register_hw(priv->hw); - priv->hw->conf.beacon_int = 100; - mutex_lock(&priv->mutex); - - if (rc) { - iwl3945_rate_control_unregister(priv->hw); - IWL_ERROR("Failed to register network " - "device (error %d)\n", rc); - return; - } - - priv->mac80211_registered = 1; - - iwl3945_reset_channel_flag(priv); - } else - ieee80211_start_queues(priv->hw); + ieee80211_start_queues(priv->hw); priv->active_rate = priv->rates_mask; priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; @@ -6236,6 +6217,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv) iwl3945_reg_txpower_periodic(priv); IWL_DEBUG_INFO("ALIVE processing complete.\n"); + wake_up_interruptible(&priv->wait_command_queue); if (priv->error_recovering) iwl3945_error_recovery(priv); @@ -6348,7 +6330,6 @@ static void iwl3945_down(struct iwl3945_priv *priv) static int __iwl3945_up(struct iwl3945_priv *priv) { - DECLARE_MAC_BUF(mac); int rc, i; if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { @@ -6392,7 +6373,7 @@ static int __iwl3945_up(struct iwl3945_priv *priv) * This will be used to initialize the on-board processor's * data SRAM for a clean start when the runtime program first loads. */ memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr, - priv->ucode_data.len); + priv->ucode_data.len); for (i = 0; i < MAX_HW_RESTARTS; i++) { @@ -6411,13 +6392,6 @@ static int __iwl3945_up(struct iwl3945_priv *priv) /* start card; "initialize" will load runtime ucode */ iwl3945_nic_start(priv); - /* MAC Address location in EEPROM is same for 3945/4965 */ - get_eeprom_mac(priv, priv->mac_addr); - IWL_DEBUG_INFO("MAC address: %s\n", - print_mac(mac, priv->mac_addr)); - - SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); - IWL_DEBUG_INFO(DRV_NAME " is coming up\n"); return 0; @@ -6906,23 +6880,73 @@ static void iwl3945_bg_scan_completed(struct work_struct *work) * *****************************************************************************/ +#define UCODE_READY_TIMEOUT (2 * HZ) + static int iwl3945_mac_start(struct ieee80211_hw *hw) { struct iwl3945_priv *priv = hw->priv; + int ret; IWL_DEBUG_MAC80211("enter\n"); + if (pci_enable_device(priv->pci_dev)) { + IWL_ERROR("Fail to pci_enable_device\n"); + return -ENODEV; + } + pci_restore_state(priv->pci_dev); + pci_enable_msi(priv->pci_dev); + + ret = request_irq(priv->pci_dev->irq, iwl3945_isr, IRQF_SHARED, + DRV_NAME, priv); + if (ret) { + IWL_ERROR("Error allocating IRQ %d\n", priv->pci_dev->irq); + goto out_disable_msi; + } + /* we should be verifying the device is ready to be opened */ mutex_lock(&priv->mutex); - priv->is_open = 1; + memset(&priv->staging_rxon, 0, sizeof(struct iwl3945_rxon_cmd)); + /* fetch ucode file from disk, alloc and copy to bus-master buffers ... + * ucode filename and max sizes are card-specific. */ - if (!iwl3945_is_rfkill(priv)) - ieee80211_start_queues(priv->hw); + if (!priv->ucode_code.len) { + ret = iwl3945_read_ucode(priv); + if (ret) { + IWL_ERROR("Could not read microcode: %d\n", ret); + mutex_unlock(&priv->mutex); + goto out_release_irq; + } + } + IWL_DEBUG_INFO("Start UP work.\n"); + __iwl3945_up(priv); + + priv->is_open = 1; mutex_unlock(&priv->mutex); + + /* Wait for START_ALIVE from ucode. Otherwise callbacks from + * mac80211 will not be run successfully. */ + ret = wait_event_interruptible_timeout(priv->wait_command_queue, + test_bit(STATUS_READY, &priv->status), + UCODE_READY_TIMEOUT); + if (!ret) { + if (!test_bit(STATUS_READY, &priv->status)) { + IWL_ERROR("Wait for START_ALIVE timeout after %dms.\n", + jiffies_to_msecs(UCODE_READY_TIMEOUT)); + ret = -ETIMEDOUT; + goto out_release_irq; + } + } + IWL_DEBUG_MAC80211("leave\n"); return 0; + +out_release_irq: + free_irq(priv->pci_dev->irq, priv); +out_disable_msi: + pci_disable_msi(priv->pci_dev); + return ret; } static void iwl3945_mac_stop(struct ieee80211_hw *hw) @@ -6931,23 +6955,25 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw) IWL_DEBUG_MAC80211("enter\n"); - - mutex_lock(&priv->mutex); /* stop mac, cancel any scan request and clear * RXON_FILTER_ASSOC_MSK BIT */ priv->is_open = 0; - if (!iwl3945_is_ready_rf(priv)) { - IWL_DEBUG_MAC80211("leave - RF not ready\n"); + + if (iwl3945_is_ready_rf(priv)) { + mutex_lock(&priv->mutex); + iwl3945_scan_cancel_timeout(priv, 100); + cancel_delayed_work(&priv->post_associate); mutex_unlock(&priv->mutex); - return; } - iwl3945_scan_cancel_timeout(priv, 100); - cancel_delayed_work(&priv->post_associate); - priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl3945_commit_rxon(priv); - mutex_unlock(&priv->mutex); + iwl3945_down(priv); + + flush_workqueue(priv->workqueue); + free_irq(priv->pci_dev->irq, priv); + pci_disable_msi(priv->pci_dev); + pci_save_state(priv->pci_dev); + pci_disable_device(priv->pci_dev); IWL_DEBUG_MAC80211("leave\n"); } @@ -7000,11 +7026,12 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); } - iwl3945_set_mode(priv, conf->type); + if (iwl3945_is_ready(priv)) + iwl3945_set_mode(priv, conf->type); - IWL_DEBUG_MAC80211("leave\n"); mutex_unlock(&priv->mutex); + IWL_DEBUG_MAC80211("leave\n"); return 0; } @@ -7178,6 +7205,9 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, return 0; } + if (!iwl3945_is_alive(priv)) + return -EAGAIN; + mutex_lock(&priv->mutex); if (conf->bssid) @@ -8390,6 +8420,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e struct iwl3945_priv *priv; struct ieee80211_hw *hw; int i; + DECLARE_MAC_BUF(mac); /* Disabling hardware scan means that mac80211 will perform scans * "the hard way", rather than using device's scan. */ @@ -8542,7 +8573,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e /* Device-specific setup */ if (iwl3945_hw_set_hw_setting(priv)) { IWL_ERROR("failed to set hw settings\n"); - mutex_unlock(&priv->mutex); goto out_iounmap; } @@ -8567,50 +8597,53 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e iwl3945_disable_interrupts(priv); - pci_enable_msi(pdev); - - err = request_irq(pdev->irq, iwl3945_isr, IRQF_SHARED, DRV_NAME, priv); - if (err) { - IWL_ERROR("Error allocating IRQ %d\n", pdev->irq); - goto out_disable_msi; - } - - mutex_lock(&priv->mutex); - err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group); if (err) { IWL_ERROR("failed to create sysfs device attributes\n"); - mutex_unlock(&priv->mutex); goto out_release_irq; } - /* fetch ucode file from disk, alloc and copy to bus-master buffers ... - * ucode filename and max sizes are card-specific. */ - err = iwl3945_read_ucode(priv); + /* nic init */ + iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS, + CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); + + iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); + err = iwl3945_poll_bit(priv, CSR_GP_CNTRL, + CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, + CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); + if (err < 0) { + IWL_DEBUG_INFO("Failed to init the card\n"); + goto out_remove_sysfs; + } + /* Read the EEPROM */ + err = iwl3945_eeprom_init(priv); if (err) { - IWL_ERROR("Could not read microcode: %d\n", err); - mutex_unlock(&priv->mutex); - goto out_pci_alloc; + IWL_ERROR("Unable to init EEPROM\n"); + goto out_remove_sysfs; } + /* MAC Address location in EEPROM same for 3945/4965 */ + get_eeprom_mac(priv, priv->mac_addr); + IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); + SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); - mutex_unlock(&priv->mutex); - - IWL_DEBUG_INFO("Queueing UP work.\n"); + iwl3945_rate_control_register(priv->hw); + err = ieee80211_register_hw(priv->hw); + if (err) { + IWL_ERROR("Failed to register network device (error %d)\n", err); + goto out_remove_sysfs; + } - queue_work(priv->workqueue, &priv->up); + priv->hw->conf.beacon_int = 100; + priv->mac80211_registered = 1; + pci_save_state(pdev); + pci_disable_device(pdev); return 0; - out_pci_alloc: - iwl3945_dealloc_ucode_pci(priv); - + out_remove_sysfs: sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); out_release_irq: - free_irq(pdev->irq, priv); - - out_disable_msi: - pci_disable_msi(pdev); destroy_workqueue(priv->workqueue); priv->workqueue = NULL; iwl3945_unset_hw_setting(priv); @@ -8676,8 +8709,6 @@ static void iwl3945_pci_remove(struct pci_dev *pdev) destroy_workqueue(priv->workqueue); priv->workqueue = NULL; - free_irq(pdev->irq, priv); - pci_disable_msi(pdev); pci_iounmap(pdev, priv->hw_base); pci_release_regions(pdev); pci_disable_device(pdev); diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index ad824c607f3..98f09e6e9f8 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -6608,31 +6608,12 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv) } iwl4965_init_geos(priv); + iwl4965_reset_channel_flag(priv); if (iwl4965_is_rfkill(priv)) return; - if (!priv->mac80211_registered) { - /* Unlock so any user space entry points can call back into - * the driver without a deadlock... */ - mutex_unlock(&priv->mutex); - iwl4965_rate_control_register(priv->hw); - rc = ieee80211_register_hw(priv->hw); - priv->hw->conf.beacon_int = 100; - mutex_lock(&priv->mutex); - - if (rc) { - iwl4965_rate_control_unregister(priv->hw); - IWL_ERROR("Failed to register network " - "device (error %d)\n", rc); - return; - } - - priv->mac80211_registered = 1; - - iwl4965_reset_channel_flag(priv); - } else - ieee80211_start_queues(priv->hw); + ieee80211_start_queues(priv->hw); priv->active_rate = priv->rates_mask; priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; @@ -6663,7 +6644,9 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv) set_bit(STATUS_READY, &priv->status); iwl4965_rf_kill_ct_config(priv); + IWL_DEBUG_INFO("ALIVE processing complete.\n"); + wake_up_interruptible(&priv->wait_command_queue); if (priv->error_recovering) iwl4965_error_recovery(priv); @@ -6777,7 +6760,6 @@ static void iwl4965_down(struct iwl4965_priv *priv) static int __iwl4965_up(struct iwl4965_priv *priv) { - DECLARE_MAC_BUF(mac); int rc, i; u32 hw_rf_kill = 0; @@ -6822,7 +6804,7 @@ static int __iwl4965_up(struct iwl4965_priv *priv) * This will be used to initialize the on-board processor's * data SRAM for a clean start when the runtime program first loads. */ memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr, - priv->ucode_data.len); + priv->ucode_data.len); /* If platform's RF_KILL switch is set to KILL, * wait for BIT_INT_RF_KILL interrupt before loading uCode @@ -6853,13 +6835,6 @@ static int __iwl4965_up(struct iwl4965_priv *priv) /* start card; "initialize" will load runtime ucode */ iwl4965_nic_start(priv); - /* MAC Address location in EEPROM is same for 3945/4965 */ - get_eeprom_mac(priv, priv->mac_addr); - IWL_DEBUG_INFO("MAC address: %s\n", - print_mac(mac, priv->mac_addr)); - - SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); - IWL_DEBUG_INFO(DRV_NAME " is coming up\n"); return 0; @@ -7365,23 +7340,73 @@ static void iwl4965_bg_scan_completed(struct work_struct *work) * *****************************************************************************/ +#define UCODE_READY_TIMEOUT (2 * HZ) + static int iwl4965_mac_start(struct ieee80211_hw *hw) { struct iwl4965_priv *priv = hw->priv; + int ret; IWL_DEBUG_MAC80211("enter\n"); + if (pci_enable_device(priv->pci_dev)) { + IWL_ERROR("Fail to pci_enable_device\n"); + return -ENODEV; + } + pci_restore_state(priv->pci_dev); + pci_enable_msi(priv->pci_dev); + + ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED, + DRV_NAME, priv); + if (ret) { + IWL_ERROR("Error allocating IRQ %d\n", priv->pci_dev->irq); + goto out_disable_msi; + } + /* we should be verifying the device is ready to be opened */ mutex_lock(&priv->mutex); - priv->is_open = 1; + memset(&priv->staging_rxon, 0, sizeof(struct iwl4965_rxon_cmd)); + /* fetch ucode file from disk, alloc and copy to bus-master buffers ... + * ucode filename and max sizes are card-specific. */ - if (!iwl4965_is_rfkill(priv)) - ieee80211_start_queues(priv->hw); + if (!priv->ucode_code.len) { + ret = iwl4965_read_ucode(priv); + if (ret) { + IWL_ERROR("Could not read microcode: %d\n", ret); + mutex_unlock(&priv->mutex); + goto out_release_irq; + } + } + IWL_DEBUG_INFO("Start UP work.\n"); + __iwl4965_up(priv); + + priv->is_open = 1; mutex_unlock(&priv->mutex); + + /* Wait for START_ALIVE from ucode. Otherwise callbacks from + * mac80211 will not be run successfully. */ + ret = wait_event_interruptible_timeout(priv->wait_command_queue, + test_bit(STATUS_READY, &priv->status), + UCODE_READY_TIMEOUT); + if (!ret) { + if (!test_bit(STATUS_READY, &priv->status)) { + IWL_ERROR("Wait for START_ALIVE timeout after %dms.\n", + jiffies_to_msecs(UCODE_READY_TIMEOUT)); + ret = -ETIMEDOUT; + goto out_release_irq; + } + } + IWL_DEBUG_MAC80211("leave\n"); return 0; + +out_release_irq: + free_irq(priv->pci_dev->irq, priv); +out_disable_msi: + pci_disable_msi(priv->pci_dev); + return ret; } static void iwl4965_mac_stop(struct ieee80211_hw *hw) @@ -7390,23 +7415,25 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw) IWL_DEBUG_MAC80211("enter\n"); - - mutex_lock(&priv->mutex); /* stop mac, cancel any scan request and clear * RXON_FILTER_ASSOC_MSK BIT */ priv->is_open = 0; - if (!iwl4965_is_ready_rf(priv)) { - IWL_DEBUG_MAC80211("leave - RF not ready\n"); + + if (iwl4965_is_ready_rf(priv)) { + mutex_lock(&priv->mutex); + iwl4965_scan_cancel_timeout(priv, 100); + cancel_delayed_work(&priv->post_associate); mutex_unlock(&priv->mutex); - return; } - iwl4965_scan_cancel_timeout(priv, 100); - cancel_delayed_work(&priv->post_associate); - priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - iwl4965_commit_rxon(priv); - mutex_unlock(&priv->mutex); + iwl4965_down(priv); + + flush_workqueue(priv->workqueue); + free_irq(priv->pci_dev->irq, priv); + pci_disable_msi(priv->pci_dev); + pci_save_state(priv->pci_dev); + pci_disable_device(priv->pci_dev); IWL_DEBUG_MAC80211("leave\n"); } @@ -7458,11 +7485,13 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr)); memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); } - iwl4965_set_mode(priv, conf->type); - IWL_DEBUG_MAC80211("leave\n"); + if (iwl4965_is_ready(priv)) + iwl4965_set_mode(priv, conf->type); + mutex_unlock(&priv->mutex); + IWL_DEBUG_MAC80211("leave\n"); return 0; } @@ -7564,9 +7593,9 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co IWL_DEBUG_MAC80211("leave\n"); - mutex_unlock(&priv->mutex); out: clear_bit(STATUS_CONF_PENDING, &priv->status); + mutex_unlock(&priv->mutex); return ret; } @@ -7651,6 +7680,9 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, return 0; } + if (!iwl4965_is_alive(priv)) + return -EAGAIN; + mutex_lock(&priv->mutex); if (conf->bssid) @@ -8995,6 +9027,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e struct iwl4965_priv *priv; struct ieee80211_hw *hw; int i; + DECLARE_MAC_BUF(mac); /* Disabling hardware scan means that mac80211 will perform scans * "the hard way", rather than using device's scan. */ @@ -9136,7 +9169,6 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e /* Device-specific setup */ if (iwl4965_hw_set_hw_setting(priv)) { IWL_ERROR("failed to set hw settings\n"); - mutex_unlock(&priv->mutex); goto out_iounmap; } @@ -9161,50 +9193,53 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e iwl4965_disable_interrupts(priv); - pci_enable_msi(pdev); - - err = request_irq(pdev->irq, iwl4965_isr, IRQF_SHARED, DRV_NAME, priv); - if (err) { - IWL_ERROR("Error allocating IRQ %d\n", pdev->irq); - goto out_disable_msi; - } - - mutex_lock(&priv->mutex); - err = sysfs_create_group(&pdev->dev.kobj, &iwl4965_attribute_group); if (err) { IWL_ERROR("failed to create sysfs device attributes\n"); - mutex_unlock(&priv->mutex); goto out_release_irq; } - /* fetch ucode file from disk, alloc and copy to bus-master buffers ... - * ucode filename and max sizes are card-specific. */ - err = iwl4965_read_ucode(priv); + /* nic init */ + iwl4965_set_bit(priv, CSR_GIO_CHICKEN_BITS, + CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); + + iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); + err = iwl4965_poll_bit(priv, CSR_GP_CNTRL, + CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, + CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); + if (err < 0) { + IWL_DEBUG_INFO("Failed to init the card\n"); + goto out_remove_sysfs; + } + /* Read the EEPROM */ + err = iwl4965_eeprom_init(priv); if (err) { - IWL_ERROR("Could not read microcode: %d\n", err); - mutex_unlock(&priv->mutex); - goto out_pci_alloc; + IWL_ERROR("Unable to init EEPROM\n"); + goto out_remove_sysfs; } + /* MAC Address location in EEPROM same for 3945/4965 */ + get_eeprom_mac(priv, priv->mac_addr); + IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); + SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); - mutex_unlock(&priv->mutex); - - IWL_DEBUG_INFO("Queueing UP work.\n"); + iwl4965_rate_control_register(priv->hw); + err = ieee80211_register_hw(priv->hw); + if (err) { + IWL_ERROR("Failed to register network device (error %d)\n", err); + goto out_remove_sysfs; + } - queue_work(priv->workqueue, &priv->up); + priv->hw->conf.beacon_int = 100; + priv->mac80211_registered = 1; + pci_save_state(pdev); + pci_disable_device(pdev); return 0; - out_pci_alloc: - iwl4965_dealloc_ucode_pci(priv); - + out_remove_sysfs: sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); out_release_irq: - free_irq(pdev->irq, priv); - - out_disable_msi: - pci_disable_msi(pdev); destroy_workqueue(priv->workqueue); priv->workqueue = NULL; iwl4965_unset_hw_setting(priv); @@ -9270,8 +9305,6 @@ static void iwl4965_pci_remove(struct pci_dev *pdev) destroy_workqueue(priv->workqueue); priv->workqueue = NULL; - free_irq(pdev->irq, priv); - pci_disable_msi(pdev); pci_iounmap(pdev, priv->hw_base); pci_release_regions(pdev); pci_disable_device(pdev); -- cgit v1.2.3-70-g09d2 From e655b9f03f41c7a84fb74d6619abf844d7f2ab65 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 24 Jan 2008 02:19:38 -0800 Subject: iwlwifi: fix problem when rf_killswitch change during suspend/resume After we delay device initialization until interface up, there are more conditions for the hardware rf_kill switch states during suspend and resume. For example, before suspend we can have interface up or down, rf_kill enable or disable; before resume we can have rf_kill enable or disable. So there are totally 2^3 = 8 conditions to handle. This patch addressed this problem and makes sure every condition works correctly. This patch also merges the device suspend and resume handlers with the mac_start and mac_stop code since they are basically doing the same thing. Signed-off-by: Zhu Yi Signed-off-by: John W. Linville Signed-off-by: David S. Miller --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 124 ++++++++++---------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 133 +++++++++------------------- 2 files changed, 90 insertions(+), 167 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index e0e9bbdf140..b9a74f5eea5 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -6340,7 +6340,19 @@ static int __iwl3945_up(struct iwl3945_priv *priv) if (test_bit(STATUS_RF_KILL_SW, &priv->status)) { IWL_WARNING("Radio disabled by SW RF kill (module " "parameter)\n"); - return 0; + return -ENODEV; + } + + /* If platform's RF_KILL switch is NOT set to KILL */ + if (iwl3945_read32(priv, CSR_GP_CNTRL) & + CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) + clear_bit(STATUS_RF_KILL_HW, &priv->status); + else { + set_bit(STATUS_RF_KILL_HW, &priv->status); + if (!test_bit(STATUS_IN_SUSPEND, &priv->status)) { + IWL_WARNING("Radio disabled by HW RF Kill switch\n"); + return -ENODEV; + } } if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { @@ -6375,6 +6387,10 @@ static int __iwl3945_up(struct iwl3945_priv *priv) memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr, priv->ucode_data.len); + /* We return success when we resume from suspend and rf_kill is on. */ + if (test_bit(STATUS_RF_KILL_HW, &priv->status)) + return 0; + for (i = 0; i < MAX_HW_RESTARTS; i++) { iwl3945_clear_stations_table(priv); @@ -6919,12 +6935,18 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw) } } - IWL_DEBUG_INFO("Start UP work.\n"); - __iwl3945_up(priv); + ret = __iwl3945_up(priv); - priv->is_open = 1; mutex_unlock(&priv->mutex); + if (ret) + goto out_release_irq; + + IWL_DEBUG_INFO("Start UP work.\n"); + + if (test_bit(STATUS_IN_SUSPEND, &priv->status)) + return 0; + /* Wait for START_ALIVE from ucode. Otherwise callbacks from * mac80211 will not be run successfully. */ ret = wait_event_interruptible_timeout(priv->wait_command_queue, @@ -6939,6 +6961,7 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw) } } + priv->is_open = 1; IWL_DEBUG_MAC80211("leave\n"); return 0; @@ -6946,6 +6969,9 @@ out_release_irq: free_irq(priv->pci_dev->irq, priv); out_disable_msi: pci_disable_msi(priv->pci_dev); + pci_disable_device(priv->pci_dev); + priv->is_open = 0; + IWL_DEBUG_MAC80211("leave - failed\n"); return ret; } @@ -6955,12 +6981,17 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw) IWL_DEBUG_MAC80211("enter\n"); - /* stop mac, cancel any scan request and clear - * RXON_FILTER_ASSOC_MSK BIT - */ + if (!priv->is_open) { + IWL_DEBUG_MAC80211("leave - skip\n"); + return; + } + priv->is_open = 0; if (iwl3945_is_ready_rf(priv)) { + /* stop mac, cancel any scan request and clear + * RXON_FILTER_ASSOC_MSK BIT + */ mutex_lock(&priv->mutex); iwl3945_scan_cancel_timeout(priv, 100); cancel_delayed_work(&priv->post_associate); @@ -7334,7 +7365,6 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, mutex_unlock(&priv->mutex); IWL_DEBUG_MAC80211("leave\n"); - } static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) @@ -8731,89 +8761,27 @@ static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state) { struct iwl3945_priv *priv = pci_get_drvdata(pdev); - set_bit(STATUS_IN_SUSPEND, &priv->status); - - /* Take down the device; powers it off, etc. */ - iwl3945_down(priv); - - if (priv->mac80211_registered) - ieee80211_stop_queues(priv->hw); + if (priv->is_open) { + set_bit(STATUS_IN_SUSPEND, &priv->status); + iwl3945_mac_stop(priv->hw); + priv->is_open = 1; + } - pci_save_state(pdev); - pci_disable_device(pdev); pci_set_power_state(pdev, PCI_D3hot); return 0; } -static void iwl3945_resume(struct iwl3945_priv *priv) -{ - unsigned long flags; - - /* The following it a temporary work around due to the - * suspend / resume not fully initializing the NIC correctly. - * Without all of the following, resume will not attempt to take - * down the NIC (it shouldn't really need to) and will just try - * and bring the NIC back up. However that fails during the - * ucode verification process. This then causes iwl3945_down to be - * called *after* iwl3945_hw_nic_init() has succeeded -- which - * then lets the next init sequence succeed. So, we've - * replicated all of that NIC init code here... */ - - iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF); - - iwl3945_hw_nic_init(priv); - - iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, - CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - - /* tell the device to stop sending interrupts */ - iwl3945_disable_interrupts(priv); - - spin_lock_irqsave(&priv->lock, flags); - iwl3945_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - - if (!iwl3945_grab_nic_access(priv)) { - iwl3945_write_prph(priv, APMG_CLK_DIS_REG, - APMG_CLK_VAL_DMA_CLK_RQT); - iwl3945_release_nic_access(priv); - } - spin_unlock_irqrestore(&priv->lock, flags); - - udelay(5); - - iwl3945_hw_nic_reset(priv); - - /* Bring the device back up */ - clear_bit(STATUS_IN_SUSPEND, &priv->status); - queue_work(priv->workqueue, &priv->up); -} - static int iwl3945_pci_resume(struct pci_dev *pdev) { struct iwl3945_priv *priv = pci_get_drvdata(pdev); - int err; - - printk(KERN_INFO "Coming out of suspend...\n"); pci_set_power_state(pdev, PCI_D0); - err = pci_enable_device(pdev); - pci_restore_state(pdev); - /* - * Suspend/Resume resets the PCI configuration space, so we have to - * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries - * from interfering with C3 CPU state. pci_restore_state won't help - * here since it only restores the first 64 bytes pci config header. - */ - pci_write_config_byte(pdev, 0x41, 0x00); - - iwl3945_resume(priv); + if (priv->is_open) + iwl3945_mac_start(priv->hw); + clear_bit(STATUS_IN_SUSPEND, &priv->status); return 0; } diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 98f09e6e9f8..811e41b7f66 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -6761,7 +6761,6 @@ static void iwl4965_down(struct iwl4965_priv *priv) static int __iwl4965_up(struct iwl4965_priv *priv) { int rc, i; - u32 hw_rf_kill = 0; if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { IWL_WARNING("Exit pending; will not bring the NIC up\n"); @@ -6771,7 +6770,19 @@ static int __iwl4965_up(struct iwl4965_priv *priv) if (test_bit(STATUS_RF_KILL_SW, &priv->status)) { IWL_WARNING("Radio disabled by SW RF kill (module " "parameter)\n"); - return 0; + return -ENODEV; + } + + /* If platform's RF_KILL switch is NOT set to KILL */ + if (iwl4965_read32(priv, CSR_GP_CNTRL) & + CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) + clear_bit(STATUS_RF_KILL_HW, &priv->status); + else { + set_bit(STATUS_RF_KILL_HW, &priv->status); + if (!test_bit(STATUS_IN_SUSPEND, &priv->status)) { + IWL_WARNING("Radio disabled by HW RF Kill switch\n"); + return -ENODEV; + } } if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { @@ -6806,17 +6817,9 @@ static int __iwl4965_up(struct iwl4965_priv *priv) memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr, priv->ucode_data.len); - /* If platform's RF_KILL switch is set to KILL, - * wait for BIT_INT_RF_KILL interrupt before loading uCode - * and getting things started */ - if (!(iwl4965_read32(priv, CSR_GP_CNTRL) & - CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) - hw_rf_kill = 1; - - if (test_bit(STATUS_RF_KILL_HW, &priv->status) || hw_rf_kill) { - IWL_WARNING("Radio disabled by HW RF Kill switch\n"); + /* We return success when we resume from suspend and rf_kill is on. */ + if (test_bit(STATUS_RF_KILL_HW, &priv->status)) return 0; - } for (i = 0; i < MAX_HW_RESTARTS; i++) { @@ -7379,12 +7382,18 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw) } } - IWL_DEBUG_INFO("Start UP work.\n"); - __iwl4965_up(priv); + ret = __iwl4965_up(priv); - priv->is_open = 1; mutex_unlock(&priv->mutex); + if (ret) + goto out_release_irq; + + IWL_DEBUG_INFO("Start UP work done.\n"); + + if (test_bit(STATUS_IN_SUSPEND, &priv->status)) + return 0; + /* Wait for START_ALIVE from ucode. Otherwise callbacks from * mac80211 will not be run successfully. */ ret = wait_event_interruptible_timeout(priv->wait_command_queue, @@ -7399,6 +7408,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw) } } + priv->is_open = 1; IWL_DEBUG_MAC80211("leave\n"); return 0; @@ -7406,6 +7416,9 @@ out_release_irq: free_irq(priv->pci_dev->irq, priv); out_disable_msi: pci_disable_msi(priv->pci_dev); + pci_disable_device(priv->pci_dev); + priv->is_open = 0; + IWL_DEBUG_MAC80211("leave - failed\n"); return ret; } @@ -7415,12 +7428,17 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw) IWL_DEBUG_MAC80211("enter\n"); - /* stop mac, cancel any scan request and clear - * RXON_FILTER_ASSOC_MSK BIT - */ + if (!priv->is_open) { + IWL_DEBUG_MAC80211("leave - skip\n"); + return; + } + priv->is_open = 0; if (iwl4965_is_ready_rf(priv)) { + /* stop mac, cancel any scan request and clear + * RXON_FILTER_ASSOC_MSK BIT + */ mutex_lock(&priv->mutex); iwl4965_scan_cancel_timeout(priv, 100); cancel_delayed_work(&priv->post_associate); @@ -8152,7 +8170,6 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) mutex_unlock(&priv->mutex); IWL_DEBUG_MAC80211("leave\n"); - } static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, @@ -9327,89 +9344,27 @@ static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state) { struct iwl4965_priv *priv = pci_get_drvdata(pdev); - set_bit(STATUS_IN_SUSPEND, &priv->status); - - /* Take down the device; powers it off, etc. */ - iwl4965_down(priv); - - if (priv->mac80211_registered) - ieee80211_stop_queues(priv->hw); + if (priv->is_open) { + set_bit(STATUS_IN_SUSPEND, &priv->status); + iwl4965_mac_stop(priv->hw); + priv->is_open = 1; + } - pci_save_state(pdev); - pci_disable_device(pdev); pci_set_power_state(pdev, PCI_D3hot); return 0; } -static void iwl4965_resume(struct iwl4965_priv *priv) -{ - unsigned long flags; - - /* The following it a temporary work around due to the - * suspend / resume not fully initializing the NIC correctly. - * Without all of the following, resume will not attempt to take - * down the NIC (it shouldn't really need to) and will just try - * and bring the NIC back up. However that fails during the - * ucode verification process. This then causes iwl4965_down to be - * called *after* iwl4965_hw_nic_init() has succeeded -- which - * then lets the next init sequence succeed. So, we've - * replicated all of that NIC init code here... */ - - iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF); - - iwl4965_hw_nic_init(priv); - - iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, - CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF); - iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - - /* tell the device to stop sending interrupts */ - iwl4965_disable_interrupts(priv); - - spin_lock_irqsave(&priv->lock, flags); - iwl4965_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - - if (!iwl4965_grab_nic_access(priv)) { - iwl4965_write_prph(priv, APMG_CLK_DIS_REG, - APMG_CLK_VAL_DMA_CLK_RQT); - iwl4965_release_nic_access(priv); - } - spin_unlock_irqrestore(&priv->lock, flags); - - udelay(5); - - iwl4965_hw_nic_reset(priv); - - /* Bring the device back up */ - clear_bit(STATUS_IN_SUSPEND, &priv->status); - queue_work(priv->workqueue, &priv->up); -} - static int iwl4965_pci_resume(struct pci_dev *pdev) { struct iwl4965_priv *priv = pci_get_drvdata(pdev); - int err; - - printk(KERN_INFO "Coming out of suspend...\n"); pci_set_power_state(pdev, PCI_D0); - err = pci_enable_device(pdev); - pci_restore_state(pdev); - /* - * Suspend/Resume resets the PCI configuration space, so we have to - * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries - * from interfering with C3 CPU state. pci_restore_state won't help - * here since it only restores the first 64 bytes pci config header. - */ - pci_write_config_byte(pdev, 0x41, 0x00); - - iwl4965_resume(priv); + if (priv->is_open) + iwl4965_mac_start(priv->hw); + clear_bit(STATUS_IN_SUSPEND, &priv->status); return 0; } -- cgit v1.2.3-70-g09d2 From 98c92211462bb78fe0e869b43e1662e549e35fed Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Mon, 14 Jan 2008 17:46:20 -0800 Subject: iwlwifi: move uCode helper functions to iwl-helpers.h This patch adds iwl_free_fw_desc ucode helper function. It also moves ucode helper functions to iwl-helpers.h. Signed-off-by: Tomas Winkler Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-helpers.h | 18 ++++++++ drivers/net/wireless/iwlwifi/iwl3945-base.c | 66 ++++++----------------------- drivers/net/wireless/iwlwifi/iwl4965-base.c | 65 ++++++---------------------- 3 files changed, 42 insertions(+), 107 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h index 5228834758b..cd2eb184831 100644 --- a/drivers/net/wireless/iwlwifi/iwl-helpers.h +++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h @@ -257,4 +257,22 @@ static inline u8 iwl_get_dma_hi_address(dma_addr_t addr) return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0; } +/* TODO: Move fw_desc functions to iwl-pci.ko */ +static inline void iwl_free_fw_desc(struct pci_dev *pci_dev, + struct fw_desc *desc) +{ + if (desc->v_addr) + pci_free_consistent(pci_dev, desc->len, + desc->v_addr, desc->p_addr); + desc->v_addr = NULL; + desc->len = 0; +} + +static inline int iwl_alloc_fw_desc(struct pci_dev *pci_dev, + struct fw_desc *desc) +{ + desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr); + return (desc->v_addr != NULL) ? 0 : -ENOMEM; +} + #endif /* __iwl_helpers_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index b9a74f5eea5..d886962392e 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -5479,48 +5479,12 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv) static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv) { - if (priv->ucode_code.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_code.len, - priv->ucode_code.v_addr, - priv->ucode_code.p_addr); - priv->ucode_code.v_addr = NULL; - } - if (priv->ucode_data.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_data.len, - priv->ucode_data.v_addr, - priv->ucode_data.p_addr); - priv->ucode_data.v_addr = NULL; - } - if (priv->ucode_data_backup.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_data_backup.len, - priv->ucode_data_backup.v_addr, - priv->ucode_data_backup.p_addr); - priv->ucode_data_backup.v_addr = NULL; - } - if (priv->ucode_init.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_init.len, - priv->ucode_init.v_addr, - priv->ucode_init.p_addr); - priv->ucode_init.v_addr = NULL; - } - if (priv->ucode_init_data.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_init_data.len, - priv->ucode_init_data.v_addr, - priv->ucode_init_data.p_addr); - priv->ucode_init_data.v_addr = NULL; - } - if (priv->ucode_boot.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_boot.len, - priv->ucode_boot.v_addr, - priv->ucode_boot.p_addr); - priv->ucode_boot.v_addr = NULL; - } + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code); + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data); + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init); + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot); } /** @@ -5817,12 +5781,6 @@ static void iwl3945_nic_start(struct iwl3945_priv *priv) iwl3945_write32(priv, CSR_RESET, 0); } -static int iwl3945_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) -{ - desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr); - return (desc->v_addr != NULL) ? 0 : -ENOMEM; -} - /** * iwl3945_read_ucode - Read uCode images from disk file. * @@ -5925,13 +5883,13 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) * 1) unmodified from disk * 2) backup cache for save/restore during power-downs */ priv->ucode_code.len = inst_size; - iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); priv->ucode_data.len = data_size; - iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); priv->ucode_data_backup.len = data_size; - iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || !priv->ucode_data_backup.v_addr) @@ -5940,10 +5898,10 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) /* Initialization instructions and data */ if (init_size && init_data_size) { priv->ucode_init.len = init_size; - iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); priv->ucode_init_data.len = init_data_size; - iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) goto err_pci_alloc; @@ -5952,7 +5910,7 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv) /* Bootstrap (instructions only, no data) */ if (boot_size) { priv->ucode_boot.len = boot_size; - iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); if (!priv->ucode_boot.v_addr) goto err_pci_alloc; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 811e41b7f66..6361fe8478a 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -5917,48 +5917,12 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv) { - if (priv->ucode_code.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_code.len, - priv->ucode_code.v_addr, - priv->ucode_code.p_addr); - priv->ucode_code.v_addr = NULL; - } - if (priv->ucode_data.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_data.len, - priv->ucode_data.v_addr, - priv->ucode_data.p_addr); - priv->ucode_data.v_addr = NULL; - } - if (priv->ucode_data_backup.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_data_backup.len, - priv->ucode_data_backup.v_addr, - priv->ucode_data_backup.p_addr); - priv->ucode_data_backup.v_addr = NULL; - } - if (priv->ucode_init.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_init.len, - priv->ucode_init.v_addr, - priv->ucode_init.p_addr); - priv->ucode_init.v_addr = NULL; - } - if (priv->ucode_init_data.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_init_data.len, - priv->ucode_init_data.v_addr, - priv->ucode_init_data.p_addr); - priv->ucode_init_data.v_addr = NULL; - } - if (priv->ucode_boot.v_addr != NULL) { - pci_free_consistent(priv->pci_dev, - priv->ucode_boot.len, - priv->ucode_boot.v_addr, - priv->ucode_boot.p_addr); - priv->ucode_boot.v_addr = NULL; - } + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code); + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data); + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init); + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); + iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot); } /** @@ -6257,11 +6221,6 @@ static void iwl4965_nic_start(struct iwl4965_priv *priv) iwl4965_write32(priv, CSR_RESET, 0); } -static int iwl4965_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) -{ - desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr); - return (desc->v_addr != NULL) ? 0 : -ENOMEM; -} /** * iwl4965_read_ucode - Read uCode images from disk file. @@ -6372,21 +6331,21 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) * 1) unmodified from disk * 2) backup cache for save/restore during power-downs */ priv->ucode_code.len = inst_size; - iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); priv->ucode_data.len = data_size; - iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); priv->ucode_data_backup.len = data_size; - iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); /* Initialization instructions and data */ if (init_size && init_data_size) { priv->ucode_init.len = init_size; - iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); priv->ucode_init_data.len = init_data_size; - iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) goto err_pci_alloc; @@ -6395,7 +6354,7 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) /* Bootstrap (instructions only, no data) */ if (boot_size) { priv->ucode_boot.len = boot_size; - iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); + iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); if (!priv->ucode_boot.v_addr) goto err_pci_alloc; -- cgit v1.2.3-70-g09d2 From 71972664a4a2e149a1e2ae75ed90cf70ce5af6c2 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Mon, 14 Jan 2008 17:46:23 -0800 Subject: iwlwifi: Update iwlwifi version stamp to 1.2.23 Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index d886962392e..5b9dbddce55 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -91,7 +91,7 @@ int iwl3945_param_queues_num = IWL_MAX_NUM_QUEUES; /* def: 8 Tx queues */ #define VS #endif -#define IWLWIFI_VERSION "1.2.22k" VD VS +#define IWLWIFI_VERSION "1.2.23k" VD VS #define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation" #define DRV_VERSION IWLWIFI_VERSION diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 6361fe8478a..e34a477c8e3 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -90,7 +90,7 @@ int iwl4965_param_amsdu_size_8K; /* def: enable 8K amsdu size */ #define VS #endif -#define IWLWIFI_VERSION "1.2.22k" VD VS +#define IWLWIFI_VERSION "1.2.23k" VD VS #define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation" #define DRV_VERSION IWLWIFI_VERSION -- cgit v1.2.3-70-g09d2 From 8a1b02452862dd30980ad0ef493eed687bc81474 Mon Sep 17 00:00:00 2001 From: Reinette Chatre Date: Mon, 14 Jan 2008 17:46:25 -0800 Subject: iwlwifi: style fixes to usage of << and >> operators The << and >> operators need space on each side. Cc: Stefano Brivio Signed-off-by: Reinette Chatre Acked-by: Tomas Winkler Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945-commands.h | 12 ++--- drivers/net/wireless/iwlwifi/iwl-3945-debug.h | 58 ++++++++++++------------ drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 46 +++++++++---------- drivers/net/wireless/iwlwifi/iwl-3945-rs.h | 26 +++++------ drivers/net/wireless/iwlwifi/iwl-4965-commands.h | 40 ++++++++-------- drivers/net/wireless/iwlwifi/iwl-4965-debug.h | 58 ++++++++++++------------ drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 36 +++++++-------- drivers/net/wireless/iwlwifi/iwl-4965-rs.h | 28 ++++++------ drivers/net/wireless/iwlwifi/iwl-4965.c | 12 ++--- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +- 11 files changed, 160 insertions(+), 160 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h index 0c80ed5d7ea..46bb2c7d11d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h @@ -508,8 +508,8 @@ struct iwl3945_qosparam_cmd { #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ #define IWL_INVALID_STATION 255 -#define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2); -#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8); +#define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1 << 2); +#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1 << 8); /* Use in mode field. 1: modify existing entry, 0: add new station entry */ #define STA_CONTROL_MODIFY_MSK 0x01 @@ -1010,7 +1010,7 @@ struct iwl3945_rate_scaling_info { * For example, if you set 9MB (PLCP 0x0f) as the first * rate in the rate table, the bit mask for that rate * when passed through ofdm_basic_rates on the REPLY_RXON - * command would be bit 0 (1<<0) + * command would be bit 0 (1 << 0) */ struct iwl3945_rate_scaling_cmd { u8 table_id; @@ -1190,9 +1190,9 @@ struct iwl3945_spectrum_notification { */ #define IWL_POWER_VEC_SIZE 5 -#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1<<0) -#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1<<2) -#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1<<3) +#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le32(1 << 0) +#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le32(1 << 2) +#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le32(1 << 3) struct iwl3945_powertable_cmd { __le32 flags; __le32 rx_data_timeout; diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h index ebf016877fe..f853c6b9f76 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h @@ -75,44 +75,44 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...) * */ -#define IWL_DL_INFO (1<<0) -#define IWL_DL_MAC80211 (1<<1) -#define IWL_DL_HOST_COMMAND (1<<2) -#define IWL_DL_STATE (1<<3) +#define IWL_DL_INFO (1 << 0) +#define IWL_DL_MAC80211 (1 << 1) +#define IWL_DL_HOST_COMMAND (1 << 2) +#define IWL_DL_STATE (1 << 3) -#define IWL_DL_RADIO (1<<7) -#define IWL_DL_POWER (1<<8) -#define IWL_DL_TEMP (1<<9) +#define IWL_DL_RADIO (1 << 7) +#define IWL_DL_POWER (1 << 8) +#define IWL_DL_TEMP (1 << 9) -#define IWL_DL_NOTIF (1<<10) -#define IWL_DL_SCAN (1<<11) -#define IWL_DL_ASSOC (1<<12) -#define IWL_DL_DROP (1<<13) +#define IWL_DL_NOTIF (1 << 10) +#define IWL_DL_SCAN (1 << 11) +#define IWL_DL_ASSOC (1 << 12) +#define IWL_DL_DROP (1 << 13) -#define IWL_DL_TXPOWER (1<<14) +#define IWL_DL_TXPOWER (1 << 14) -#define IWL_DL_AP (1<<15) +#define IWL_DL_AP (1 << 15) -#define IWL_DL_FW (1<<16) -#define IWL_DL_RF_KILL (1<<17) -#define IWL_DL_FW_ERRORS (1<<18) +#define IWL_DL_FW (1 << 16) +#define IWL_DL_RF_KILL (1 << 17) +#define IWL_DL_FW_ERRORS (1 << 18) -#define IWL_DL_LED (1<<19) +#define IWL_DL_LED (1 << 19) -#define IWL_DL_RATE (1<<20) +#define IWL_DL_RATE (1 << 20) -#define IWL_DL_CALIB (1<<21) -#define IWL_DL_WEP (1<<22) -#define IWL_DL_TX (1<<23) -#define IWL_DL_RX (1<<24) -#define IWL_DL_ISR (1<<25) -#define IWL_DL_HT (1<<26) -#define IWL_DL_IO (1<<27) -#define IWL_DL_11H (1<<28) +#define IWL_DL_CALIB (1 << 21) +#define IWL_DL_WEP (1 << 22) +#define IWL_DL_TX (1 << 23) +#define IWL_DL_RX (1 << 24) +#define IWL_DL_ISR (1 << 25) +#define IWL_DL_HT (1 << 26) +#define IWL_DL_IO (1 << 27) +#define IWL_DL_11H (1 << 28) -#define IWL_DL_STATS (1<<29) -#define IWL_DL_TX_REPLY (1<<30) -#define IWL_DL_QOS (1<<31) +#define IWL_DL_STATS (1 << 29) +#define IWL_DL_TX_REPLY (1 << 30) +#define IWL_DL_QOS (1 << 31) #define IWL_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) #define IWL_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h index 2c955a6070f..6e0187393af 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h @@ -369,17 +369,17 @@ struct iwl3945_eeprom { /* interrupt flags in INTA, set by uCode or hardware (e.g. dma), * acknowledged (reset) by host writing "1" to flagged bits. */ -#define CSR_INT_BIT_FH_RX (1<<31) /* Rx DMA, cmd responses, FH_INT[17:16] */ -#define CSR_INT_BIT_HW_ERR (1<<29) /* DMA hardware error FH_INT[31] */ -#define CSR_INT_BIT_DNLD (1<<28) /* uCode Download */ -#define CSR_INT_BIT_FH_TX (1<<27) /* Tx DMA FH_INT[1:0] */ -#define CSR_INT_BIT_MAC_CLK_ACTV (1<<26) /* NIC controller's clock toggled on/off */ -#define CSR_INT_BIT_SW_ERR (1<<25) /* uCode error */ -#define CSR_INT_BIT_RF_KILL (1<<7) /* HW RFKILL switch GP_CNTRL[27] toggled */ -#define CSR_INT_BIT_CT_KILL (1<<6) /* Critical temp (chip too hot) rfkill */ -#define CSR_INT_BIT_SW_RX (1<<3) /* Rx, command responses, 3945 */ -#define CSR_INT_BIT_WAKEUP (1<<1) /* NIC controller waking up (pwr mgmt) */ -#define CSR_INT_BIT_ALIVE (1<<0) /* uCode interrupts once it initializes */ +#define CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */ +#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */ +#define CSR_INT_BIT_DNLD (1 << 28) /* uCode Download */ +#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */ +#define CSR_INT_BIT_MAC_CLK_ACTV (1 << 26) /* NIC controller's clock toggled on/off */ +#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */ +#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */ +#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */ +#define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses, 3945 */ +#define CSR_INT_BIT_WAKEUP (1 << 1) /* NIC controller waking up (pwr mgmt) */ +#define CSR_INT_BIT_ALIVE (1 << 0) /* uCode interrupts once it initializes */ #define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \ CSR_INT_BIT_HW_ERR | \ @@ -391,14 +391,14 @@ struct iwl3945_eeprom { CSR_INT_BIT_ALIVE) /* interrupt flags in FH (flow handler) (PCI busmaster DMA) */ -#define CSR_FH_INT_BIT_ERR (1<<31) /* Error */ -#define CSR_FH_INT_BIT_HI_PRIOR (1<<30) /* High priority Rx, bypass coalescing */ -#define CSR_FH_INT_BIT_RX_CHNL2 (1<<18) /* Rx channel 2 (3945 only) */ -#define CSR_FH_INT_BIT_RX_CHNL1 (1<<17) /* Rx channel 1 */ -#define CSR_FH_INT_BIT_RX_CHNL0 (1<<16) /* Rx channel 0 */ -#define CSR_FH_INT_BIT_TX_CHNL6 (1<<6) /* Tx channel 6 (3945 only) */ -#define CSR_FH_INT_BIT_TX_CHNL1 (1<<1) /* Tx channel 1 */ -#define CSR_FH_INT_BIT_TX_CHNL0 (1<<0) /* Tx channel 0 */ +#define CSR_FH_INT_BIT_ERR (1 << 31) /* Error */ +#define CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */ +#define CSR_FH_INT_BIT_RX_CHNL2 (1 << 18) /* Rx channel 2 (3945 only) */ +#define CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */ +#define CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */ +#define CSR_FH_INT_BIT_TX_CHNL6 (1 << 6) /* Tx channel 6 (3945 only) */ +#define CSR_FH_INT_BIT_TX_CHNL1 (1 << 1) /* Tx channel 1 */ +#define CSR_FH_INT_BIT_TX_CHNL0 (1 << 0) /* Tx channel 0 */ #define CSR_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \ CSR_FH_INT_BIT_RX_CHNL2 | \ @@ -629,10 +629,10 @@ struct iwl3945_eeprom { #define U32_PAD(n) ((4-(n))&0x3) -#define TFD_CTL_COUNT_SET(n) (n<<24) -#define TFD_CTL_COUNT_GET(ctl) ((ctl>>24) & 7) -#define TFD_CTL_PAD_SET(n) (n<<28) -#define TFD_CTL_PAD_GET(ctl) (ctl>>28) +#define TFD_CTL_COUNT_SET(n) (n << 24) +#define TFD_CTL_COUNT_GET(ctl) ((ctl >> 24) & 7) +#define TFD_CTL_PAD_SET(n) (n << 28) +#define TFD_CTL_PAD_GET(ctl) (ctl >> 28) #define TFD_TX_CMD_SLOTS 256 #define TFD_CMD_SLOTS 32 diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h index e21a5bae687..d5e9220f871 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h @@ -86,18 +86,18 @@ enum { }; /* #define vs. enum to keep from defaulting to 'large integer' */ -#define IWL_RATE_6M_MASK (1<beacon_silence_rssi_a & - ALL_BAND_FILTER)>>8); + ALL_BAND_FILTER) >> 8); silence_rssi_b = (u8)((rx_info->beacon_silence_rssi_b & - ALL_BAND_FILTER)>>8); + ALL_BAND_FILTER) >> 8); silence_rssi_c = (u8)((rx_info->beacon_silence_rssi_c & - ALL_BAND_FILTER)>>8); + ALL_BAND_FILTER) >> 8); val = max(silence_rssi_b, silence_rssi_c); max_silence_rssi = max(silence_rssi_a, (u8) val); @@ -4233,14 +4233,14 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl4965_priv *priv, IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->ba_seq_ctl); /* Calculate shift to align block-ack bits with our Tx window bits */ - sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl>>4); + sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl >> 4); if (sh < 0) /* tbw something is wrong with indices */ sh += 0x100; /* don't use 64-bit values for now */ bitmap0 = resp_bitmap0 >> sh; bitmap1 = resp_bitmap1 >> sh; - bitmap0 |= (resp_bitmap1 & ((1<frame_count > (64 - sh)) { IWL_DEBUG_TX_REPLY("more frames than bitmap size"); @@ -4425,7 +4425,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl4965_priv *priv, int txq_id, iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); /* Set this queue as a chain-building queue */ - iwl4965_set_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1<tpc.tx_gain = ((1 << 5) | (5 << 3)); /* NOTE: if we were doing 6Mb OFDM for scans we'd use * power level: - * scan_ch->tpc.tx_gain = ((1<<5) | (2 << 3)) | 3; + * scan_ch->tpc.tx_gain = ((1 << 5) | (2 << 3)) | 3; */ } diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index e34a477c8e3..c86da5cd1df 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -5698,7 +5698,7 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); /* NOTE: if we were doing 6Mb OFDM for scans we'd use * power level: - * scan_ch->tpc.tx_gain = ((1<<5) | (2 << 3)) | 3; + * scan_ch->tpc.tx_gain = ((1 << 5) | (2 << 3)) | 3; */ } -- cgit v1.2.3-70-g09d2