* [PATCH 01/28] iwlwifi: fix a lot of checkpatch.pl warnings [not found] <11865584251026-git-send-email-yi.zhu@intel.com> @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 02/28] iwlwifi: add more Kconfig options Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-3945-rs.c | 4 +- drivers/net/wireless/iwl-3945.c | 81 ++++++------ drivers/net/wireless/iwl-4965-rs.c | 96 +++++++------- drivers/net/wireless/iwl-4965.c | 176 ++++++++++++------------ drivers/net/wireless/iwl-4965.h | 4 +- drivers/net/wireless/iwl-base.c | 266 +++++++++++++++++------------------- drivers/net/wireless/iwl-helpers.h | 5 +- drivers/net/wireless/iwl-io.h | 28 ++-- drivers/net/wireless/iwlwifi.h | 14 +- 9 files changed, 325 insertions(+), 349 deletions(-) diff --git a/drivers/net/wireless/iwl-3945-rs.c b/drivers/net/wireless/iwl-3945-rs.c index 0dfafc9..8a98eb8 100644 --- a/drivers/net/wireless/iwl-3945-rs.c +++ b/drivers/net/wireless/iwl-3945-rs.c @@ -745,9 +745,9 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate, IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); scale_action = -1; } else if ((low_tpt == IWL_INVALID_VALUE) && - (high_tpt == IWL_INVALID_VALUE)) { + (high_tpt == IWL_INVALID_VALUE)) scale_action = 1; - } else if ((low_tpt != IWL_INVALID_VALUE) && + else if ((low_tpt != IWL_INVALID_VALUE) && (high_tpt != IWL_INVALID_VALUE) && (low_tpt < current_tpt) && (high_tpt < current_tpt)) { diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c index 6074ae0..8e78ad5 100644 --- a/drivers/net/wireless/iwl-3945.c +++ b/drivers/net/wireless/iwl-3945.c @@ -168,12 +168,12 @@ void iwl_disable_events(struct iwl_priv *priv) IWL_DEBUG_INFO("Disabling selected uCode log events at 0x%x\n", disable_ptr); rc = iwl_grab_restricted_access(priv); - for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++) { + for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++) iwl_write_restricted_mem(priv, disable_ptr + (i * sizeof(u32)), evt_disable[i]); - } + iwl_release_restricted_access(priv); } else { IWL_DEBUG_INFO("Selected uCode log events may be disabled\n"); @@ -943,9 +943,8 @@ int iwl_hw_nic_init(struct iwl_priv *priv) IWL_DEBUG_INFO("SKU OP mode is mrc\n"); iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC); - } else { + } else IWL_DEBUG_INFO("SKU OP mode is basic\n"); - } if ((priv->eeprom.board_revision & 0xF0) == 0xD0) { IWL_DEBUG_INFO("3945ABG revision is 0x%X\n", @@ -1076,10 +1075,10 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv) reg_val = iwl_read32(priv, CSR_GP_CNTRL); if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE == - (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE)) { + (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE)) IWL_DEBUG_INFO ("Card in power save, master is already stopped\n"); - } else { + else { rc = iwl_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, @@ -1190,8 +1189,8 @@ static int iwl_hw_reg_txpower_get_temperature(struct iwl_priv *priv) /* if really really hot(?), * substitute the 3rd band/group's temp measured at factory */ if (priv->last_temperature > 100) - temperature = - (s16)le16_to_cpu(priv->eeprom.groups[2].temperature); + temperature = (s16) le16_to_cpu( + priv->eeprom.groups[2].temperature); else /* else use most recent "sane" value from driver */ temperature = priv->last_temperature; } @@ -1325,7 +1324,7 @@ static struct iwl_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = { {3, 113}, {3, 106}, {3, 102}, - {3, 95}}, /* 2.4 GHz, lowest power */ + {3, 95} }, /* 2.4 GHz, lowest power */ { {251, 127}, /* 5.x GHz, highest power */ {251, 120}, @@ -1404,7 +1403,7 @@ static struct iwl_tx_power power_gain_table[2][IWL_MAX_GAIN_ENTRIES] = { {35, 113}, {35, 107}, {35, 99}, - {3, 120}} /* 5.x GHz, lowest power */ + {3, 120} } /* 5.x GHz, lowest power */ }; static inline u8 iwl_hw_reg_fix_power_index(int index) @@ -1426,7 +1425,7 @@ static inline u8 iwl_hw_reg_fix_power_index(int index) * or 6 Mbit (OFDM) rates. */ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, - s32 rate_index, const s8 * clip_pwrs, + s32 rate_index, const s8 *clip_pwrs, struct iwl_channel_info *ch_info, int band_index) { @@ -1456,11 +1455,6 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index, - (power - ch_info->power_info [IWL_RATE_6M_INDEX].requested_power) * 2; -#if 0 - IWL_DEBUG_POWER("chnl %d scan power index %d\n", - ch_info->channel, power_index); -#endif - /* store reference index that we use when adjusting *all* scan * powers. So we can accommodate user (all channel) or spectrum * management (single channel) power changes "between" temperature @@ -1541,9 +1535,9 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) * * This does *not* send anything to NIC, just sets up ch_info for one channel. * - * NOTE:reg_compensate_for_temperature_dif() *must* be run after this to - * properly fill out the scan powers, and actual h/w gain settings, - * and send changes to NIC + * NOTE: reg_compensate_for_temperature_dif() *must* be run after this to + * 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) @@ -1602,12 +1596,13 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv, } /** - * iwl_hw_reg_get_channel_txpower_limit - returns new power limit for channel + * iwl_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_channel_txpower_limit(struct iwl_channel_info *ch_info) + * 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) { s8 max_power; @@ -1621,6 +1616,7 @@ static int iwl_hw_reg_get_channel_txpower_limit(struct iwl_channel_info *ch_info else #endif max_power = ch_info->eeprom.max_power_avg; + return min(max_power, ch_info->max_power_avg); } @@ -1657,7 +1653,8 @@ 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, ref_temp); + delta_index = iwl_hw_reg_adjust_power_by_temp(temperature, + ref_temp); /* set tx power value for all rates, OFDM and CCK */ for (rate_index = 0; rate_index < IWL_RATE_COUNT; @@ -1720,7 +1717,7 @@ 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_channel_txpower_limit(ch_info); + max_power = iwl_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; @@ -1784,15 +1781,19 @@ void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) mutex_unlock(&priv->mutex); } -/* iwl_hw_reg_get_chnl_grp_index - find the channel-group index (0-4) for the channel. +/** + * iwl_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. * - * ... used when initializing channel-info structs. - * NOTE: These channel groups do *NOT* match the bands above! - * These channel groups are based on factory-tested channels; - * 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_chnl_grp_index(struct iwl_priv *priv, - const struct iwl_channel_info *ch_info) + * NOTE: These channel groups do *NOT* match the bands above! + * These channel groups are based on factory-tested channels; + * 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) { struct iwl_eeprom_txpower_group *ch_grp = &priv->eeprom.groups[0]; u8 group; @@ -1827,7 +1828,7 @@ static u16 iwl_hw_reg_get_chnl_grp_index(struct iwl_priv *priv, */ static int iwl_hw_reg_get_matched_power_index(struct iwl_priv *priv, s8 requested_power, - s32 setting_index, s32 * new_index) + s32 setting_index, s32 *new_index) { const struct iwl_eeprom_txpower_group *chnl_grp = NULL; s32 index0, index1; @@ -1982,17 +1983,17 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv) continue; /* find this channel's channel group (*not* "band") index */ - ch_info->group_index = iwl_hw_reg_get_chnl_grp_index(priv, ch_info); + ch_info->group_index = + iwl_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, - (s16)le16_to_cpu( - priv->eeprom.groups[ch_info->group_index].temperature)); + delta_index = iwl_hw_reg_adjust_power_by_temp(temperature, + (s16) le16_to_cpu(priv->eeprom.groups[ + ch_info->group_index].temperature)); IWL_DEBUG_POWER("Delta index for channel %d: %d [%d]\n", ch_info->channel, delta_index, temperature + diff --git a/drivers/net/wireless/iwl-4965-rs.c b/drivers/net/wireless/iwl-4965-rs.c index 7d4a980..07fe911 100644 --- a/drivers/net/wireless/iwl-4965-rs.c +++ b/drivers/net/wireless/iwl-4965-rs.c @@ -203,10 +203,9 @@ static int rs_send_lq_cmd(struct iwl_priv *priv, lq->general_params.single_stream_ant_msk, lq->general_params.dual_stream_ant_msk); #ifdef CONFIG_IWLWIFI_DEBUG - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { + for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) IWL_DEBUG_RATE("lq index %d 0x%X\n", i, lq->rate_scale_table[i].rate_n_flags); - } #endif if (flags & CMD_ASYNC) @@ -217,16 +216,15 @@ static int rs_send_lq_cmd(struct iwl_priv *priv, return rc; } -static int rs_rate_scale_clear_window(struct iwl_rate_scale_data - *window) +static int rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) { - window->data = 0; window->success_counter = 0; window->success_ratio = IWL_INVALID_VALUE; window->counter = 0; window->average_tpt = IWL_INVALID_VALUE; window->stamp = 0; + return 0; } @@ -266,20 +264,19 @@ static int rs_collect_tx_data(struct iwl_rate_scale_data *windows, window->data |= 0x1; } - if (window->counter > 0) { + if (window->counter > 0) window->success_ratio = 128 * (100 * window->success_counter) / window->counter; - } else + else window->success_ratio = IWL_INVALID_VALUE; - fail_count = window->counter - window->success_counter; + 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); + window->average_tpt = (window->success_ratio * tpt + 64) / 128; else - window->average_tpt = IWL_INVALID_VALUE; + window->average_tpt = IWL_INVALID_VALUE; window->stamp = jiffies; @@ -456,9 +453,9 @@ static inline s8 rs_use_green(struct iwl_priv *priv) * */ static void rs_get_supported_rates(struct iwl_rate_scale_priv *lq_data, - struct ieee80211_hdr *hdr, - enum iwl_table_type rate_type, - u16 * data_rate) + struct ieee80211_hdr *hdr, + enum iwl_table_type rate_type, + u16 *data_rate) { if (is_legacy(rate_type)) *data_rate = lq_data->active_rate; @@ -469,8 +466,8 @@ static void rs_get_supported_rates(struct iwl_rate_scale_priv *lq_data, *data_rate = lq_data->active_mimo_rate; } - if (hdr && (is_multicast_ether_addr(hdr->addr1)) - && (lq_data->active_rate_basic)) + if (hdr && is_multicast_ether_addr(hdr->addr1) && + lq_data->active_rate_basic) *data_rate = lq_data->active_rate_basic; } @@ -1501,9 +1498,9 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, current_tpt = window->average_tpt; - if (low != IWL_RATE_INVALID) { + if (low != IWL_RATE_INVALID) low_tpt = tbl->win[low].average_tpt; - } + if (high != IWL_RATE_INVALID) high_tpt = tbl->win[high].average_tpt; @@ -1515,14 +1512,14 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); scale_action = -1; } else if ((low_tpt == IWL_INVALID_VALUE) && - (high_tpt == IWL_INVALID_VALUE)) { + (high_tpt == IWL_INVALID_VALUE)) scale_action = 1; - } else if ((low_tpt != IWL_INVALID_VALUE) && - (high_tpt != IWL_INVALID_VALUE) - && (low_tpt < current_tpt) - && (high_tpt < current_tpt)) { + else if ((low_tpt != IWL_INVALID_VALUE) && + (high_tpt != IWL_INVALID_VALUE) && + (low_tpt < current_tpt) && + (high_tpt < current_tpt)) scale_action = 0; - } else { + else { if (high_tpt != IWL_INVALID_VALUE) { if (high_tpt > current_tpt) scale_action = 1; @@ -1557,7 +1554,6 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, index = low; } break; - case 1: if (high != IWL_RATE_INVALID) { update_lq = 1; @@ -1565,30 +1561,29 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, } break; - case 0: - default: break; } - IWL_DEBUG_HT - ("choose rate scale index %d action %d low %d high %d\n", - index, scale_action, low, high); + IWL_DEBUG_HT("choose rate scale index %d action %d low %d high %d\n", + index, scale_action, low, high); lq_update: if (update_lq) { rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green); rs_fill_link_cmd(lq_data, &mcs_rate, &(lq_data->lq), sta); + if (!rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC)) lq_data->commit_lq = 0; else lq_data->commit_lq = 1; } rs_stay_in_table(lq_data); - if (!update_lq - && !done_search && !lq_data->stay_in_tbl) { + + if (!update_lq && !done_search && !lq_data->stay_in_tbl) { lq_data->last_tpt = current_tpt; + if (is_legacy(tbl->lq_type)) rs_move_legacy_other(priv, lq_data, index); else if (is_siso(tbl->lq_type)) @@ -1602,18 +1597,19 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, rs_rate_scale_clear_window(&(tbl->win[i])); index = iwl_rate_index_from_plcp( - tbl->current_rate.rate_n_flags); + tbl->current_rate.rate_n_flags); IWL_DEBUG_HT("Switch current mcs: %X index: %d\n", tbl->current_rate.rate_n_flags, index); rs_fill_link_cmd(lq_data, &tbl->current_rate, - &(lq_data->lq), sta); + &(lq_data->lq), sta); if (!rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC)) lq_data->commit_lq = 0; else lq_data->commit_lq = 1; } tbl1 = &(lq_data->lq_info[lq_data->active_tbl]); + if (is_legacy(tbl1->lq_type) && #ifdef CONFIG_IWLWIFI_HT !priv->current_assoc_ht.is_ht && @@ -1642,12 +1638,14 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, lq_data->flush_timer = jiffies; } - out: +out: rs_mcs_from_tbl(&tbl->current_rate, tbl, index, is_green); i = index; sta->last_txrate = i; + /* sta->txrate is an index to A mode rates which start - * at IWL_FIRST_OFDM_RATE */ + * at IWL_FIRST_OFDM_RATE + */ if ((lq_data->phymode == (u8) MODE_IEEE80211A) || (lq_data->phymode == (u8) MODE_ATHEROS_TURBO)) sta->txrate = i - IWL_FIRST_OFDM_RATE; @@ -1793,9 +1791,8 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate, done: sta_info_put(sta); - if ((i < 0) || (i > IWL_RATE_COUNT)) { + if ((i < 0) || (i > IWL_RATE_COUNT)) return rs_get_lowest_rate(local); - } return &priv->ieee_rates[i]; } @@ -1927,7 +1924,8 @@ static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, repeat_cur_rate = IWL_HT_NUMBER_TRY; lq_cmd->rate_scale_table[index].rate_n_flags = tx_mcs->rate_n_flags; - lq_cmd->general_params.mimo_delimiter = is_mimo(tbl_type.lq_type) ? 1 : 0; + lq_cmd->general_params.mimo_delimiter = + is_mimo(tbl_type.lq_type) ? 1 : 0; new_rate.rate_n_flags = tx_mcs->rate_n_flags; if (is_mimo(tbl_type.lq_type) || (tbl_type.antenna_type == ANT_MAIN)) @@ -1940,8 +1938,9 @@ static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, while (index < LINK_QUAL_MAX_RETRY_NUM) { while (repeat_cur_rate && (index < LINK_QUAL_MAX_RETRY_NUM)) { - if (is_legacy(tbl_type.lq_type)){ - if (ant_toggle_count < NUM_TRY_BEFORE_ANTENNA_TOGGLE) + if (is_legacy(tbl_type.lq_type)) { + if (ant_toggle_count < + NUM_TRY_BEFORE_ANTENNA_TOGGLE) ant_toggle_count++; else { rs_toggle_antenna(&new_rate, &tbl_type); @@ -1954,13 +1953,13 @@ static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, index++; } rs_get_tbl_info_from_mcs(&lq_cmd->rate_scale_table[index - 1], - lq_data->phymode, - &tbl_type, &rate_idx); + lq_data->phymode, &tbl_type, + &rate_idx); if (is_mimo(tbl_type.lq_type)) lq_cmd->general_params.mimo_delimiter = index; rs_get_lower_rate(lq_data, &tbl_type, rate_idx, - use_ht_possible, &new_rate, sta); + use_ht_possible, &new_rate, sta); if (is_legacy(tbl_type.lq_type)) { if (ant_toggle_count < NUM_TRY_BEFORE_ANTENNA_TOGGLE) @@ -1970,21 +1969,20 @@ static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, ant_toggle_count = 1; } repeat_cur_rate = IWL_NUMBER_TRY; - } else { + } else repeat_cur_rate = IWL_HT_NUMBER_TRY; - } use_ht_possible = 0; lq_cmd->rate_scale_table[index].rate_n_flags = - new_rate.rate_n_flags; - /*lq_cmd->rate_scale_table[index].rate_n_flags = 0x800d; */ + new_rate.rate_n_flags; + /* lq_cmd->rate_scale_table[index].rate_n_flags = 0x800d; */ index++; repeat_cur_rate--; } - /*lq_cmd->rate_scale_table[0].rate_n_flags = 0x800d; */ + /* lq_cmd->rate_scale_table[0].rate_n_flags = 0x800d; */ lq_cmd->general_params.dual_stream_ant_msk = 3; lq_cmd->agg_params.agg_dis_start_th = 3; diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index 2e97e6b..6b8fd73 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -105,7 +105,7 @@ static u8 is_single_stream(struct iwl_priv *priv) * This does not determine *which* chains to use, just how many. */ static int iwl4965_get_rx_chain_counter(struct iwl_priv *priv, - u8 * idle_state, u8 * rx_state) + u8 *idle_state, u8 *rx_state) { u8 is_single = is_single_stream(priv); u8 is_cam = (priv->status & STATUS_POWER_PMI) ? 0 : 1; @@ -205,21 +205,17 @@ static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) u32 val; rc = pci_read_config_dword(priv->pci_dev, 0x0C8, &val); - if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) { + if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) iwl_set_bits_mask_restricted_reg( priv, ALM_APMG_PS_CTL, APMG_PS_CTRL_REG_VAL_POWER_SRC_VAUX, ~APMG_PS_CTRL_REG_MSK_POWER_SRC); - - } - } else { + } else iwl_set_bits_mask_restricted_reg( priv, ALM_APMG_PS_CTL, APMG_PS_CTRL_REG_VAL_POWER_SRC_VMAIN, ~APMG_PS_CTRL_REG_MSK_POWER_SRC); - } - iwl_release_restricted_access(priv); spin_unlock_irqrestore(&priv->lock, flags); @@ -262,7 +258,6 @@ static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) */ iwl_release_restricted_access(priv); - spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -279,9 +274,9 @@ static int iwl4965_kw_init(struct iwl_priv *priv) goto out; iwl_write_restricted(priv, IWL_FH_KW_MEM_ADDR_REG, - (priv->kw.dma_addr >> 4)); + priv->kw.dma_addr >> 4); iwl_release_restricted_access(priv); - out: +out: spin_unlock_irqrestore(&priv->lock, flags); return rc; } @@ -290,6 +285,7 @@ static int iwl4965_kw_alloc(struct iwl_priv *priv) { struct pci_dev *dev = priv->pci_dev; struct iwl_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); if (!kw->v_addr) @@ -301,38 +297,37 @@ 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, - int channel, +int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, int channel, const struct iwl_eeprom_channel *eeprom_ch, u8 fat_extension_channel) { struct iwl_channel_info *ch_info; - ch_info = (struct iwl_channel_info *)iwl_get_channel_info(priv, - phymode, - channel); + ch_info = (struct iwl_channel_info *) + iwl_get_channel_info(priv, phymode, channel); + if (!is_channel_valid(ch_info)) return -1; - IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s%s(" BIT_FMT8 - " %ddBm): Ad-Hoc %ssupported\n", - ch_info->channel, - is_channel_a_band(ch_info) ? - "5.2" : "2.4", - CHECK_AND_PRINT(IBSS), - CHECK_AND_PRINT(ACTIVE), - CHECK_AND_PRINT(RADAR), - CHECK_AND_PRINT(WIDE), - CHECK_AND_PRINT(NARROW), - CHECK_AND_PRINT(DFS), - BIT_ARG8(eeprom_ch->flags), - eeprom_ch-> - max_power_avg, - ((eeprom_ch-> - flags & EEPROM_CHANNEL_IBSS) - && !(eeprom_ch-> - flags & EEPROM_CHANNEL_RADAR)) - ? "" : "not "); + IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s%s(" BIT_FMT8 + " %ddBm): Ad-Hoc %ssupported\n", + ch_info->channel, + is_channel_a_band(ch_info) ? + "5.2" : "2.4", + CHECK_AND_PRINT(IBSS), + CHECK_AND_PRINT(ACTIVE), + CHECK_AND_PRINT(RADAR), + CHECK_AND_PRINT(WIDE), + CHECK_AND_PRINT(NARROW), + CHECK_AND_PRINT(DFS), + BIT_ARG8(eeprom_ch->flags), + eeprom_ch-> + max_power_avg, + ((eeprom_ch-> + flags & EEPROM_CHANNEL_IBSS) + && !(eeprom_ch-> + flags & EEPROM_CHANNEL_RADAR)) + ? "" : "not "); ch_info->fat_eeprom = *eeprom_ch; ch_info->fat_max_power_avg = eeprom_ch->max_power_avg; @@ -349,11 +344,11 @@ static void iwl4965_kw_free(struct iwl_priv *priv) { struct pci_dev *dev = priv->pci_dev; struct iwl_kw *kw = &priv->kw; + if (kw->v_addr) { pci_free_consistent(dev, kw->size, kw->v_addr, kw->dma_addr); memset(kw, 0, sizeof(*kw)); } - } /** @@ -581,10 +576,10 @@ int iwl_hw_nic_stop_master(struct iwl_priv *priv) reg_val = iwl_read32(priv, CSR_GP_CNTRL); if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE == - (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE)) { + (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE)) IWL_DEBUG_INFO ("Card in power save, master is already stopped\n"); - } else { + else { rc = iwl_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, @@ -923,10 +918,8 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, data->auto_corr_cck_mrc = max((u32)AUTO_CORR_MIN_CCK_MRC, val); - } else { + } else IWL_DEBUG_CALIB("... but not changing sensitivity\n"); - } - /* Else we got a healthy number of false alarms, keep status quo */ } else { @@ -946,9 +939,10 @@ static int iwl4965_sens_energy_cck(struct iwl_priv *priv, } /* Make sure the energy threshold does not go above the measured - * energy of the desired Rx signals (reduced by backoff margin), - * or else we might start missing Rx frames. - * Lower value is higher energy, so we use max()! */ + * energy of the desired Rx signals (reduced by backoff margin), + * or else we might start missing Rx frames. + * Lower value is higher energy, so we use max()! + */ data->nrg_th_cck = max(max_nrg_cck, data->nrg_th_cck); IWL_DEBUG_CALIB("new nrg_th_cck %u\n", data->nrg_th_cck); @@ -1016,10 +1010,9 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, max((u32)AUTO_CORR_MIN_OFDM_MRC_X1, val); } - else { + else IWL_DEBUG_CALIB("min FA %u < norm FA %u < max FA %u OK\n", min_false_alarms, false_alarms, max_false_alarms); - } return 0; } @@ -1392,9 +1385,8 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv, data->delta_gain_code[i] = (data->delta_gain_code[i] | (1 << 2)); - } else { + } else data->delta_gain_code[i] = 0; - } } IWL_DEBUG_CALIB("delta_gain_codes: a %d b %d c %d\n", data->delta_gain_code[0], @@ -1561,10 +1553,9 @@ static void iwl4965_bg_sensitivity_work(struct work_struct *work) IWL_SENS_CALIB_NEED_REINIT) { iwl4965_init_sensitivity(priv, CMD_ASYNC, 0); priv->sensitivity_data.state = IWL_SENS_CALIB_ALLOWED; - } else { + } else iwl4965_sensitivity_calibration(priv, &priv->statistics); - } } mutex_unlock(&priv->mutex); @@ -1614,24 +1605,24 @@ static void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index) /* * Acquire priv->lock before calling this function ! */ -static void iwl4965_tx_queue_set_status(struct iwl_priv *priv, struct iwl_tx_queue *txq, - int tx_fifo_id, int scd_retry) +static void iwl4965_tx_queue_set_status(struct iwl_priv *priv, + struct iwl_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_restricted_reg(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)| - (scd_retry << SCD_QUEUE_STTS_REG_POS_SCD_ACK)| + iwl_write_restricted_reg(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) | + (scd_retry << SCD_QUEUE_STTS_REG_POS_SCD_ACK) | SCD_QUEUE_STTS_REG_MSK); txq->sched_retry = scd_retry; IWL_DEBUG_INFO("%s %s Queue %d on AC %d\n", - (active ? "Activete" : "Deactivate"), + active ? "Activete" : "Deactivate", scd_retry ? "BA" : "AC", txq_id, tx_fifo_id); } @@ -1718,7 +1709,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv) SCD_TXFACT_REG_TXFIFO_MASK(0, 7)); iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); - iwl4965_txq_ctx_activate(priv,IWL_CMD_QUEUE_NUM); + iwl4965_txq_ctx_activate(priv, IWL_CMD_QUEUE_NUM); iwl4965_tx_queue_set_status(priv, &priv->txq[IWL_CMD_QUEUE_NUM], IWL_CMD_FIFO_NUM, 0); /* map qos queues to fifos one-to-one */ @@ -1850,7 +1841,7 @@ int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) #define IWL_TX_POWER_CCK_COMPENSATION_B_STEP (9) #define IWL_TX_POWER_CCK_COMPENSATION_C_STEP (5) -static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 * res) +static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) { s32 sign = 1; @@ -3093,21 +3084,21 @@ static void iwl4965_turn_on_agg_for_tid(struct iwl_priv *priv, spin_lock_irqsave(&priv->lq_mngr.lock, flags); if (!available_queues) { - if (auto_agg) { + if (auto_agg) lq->agg_ctrl.tid_retry |= tid_msk; - } else { + else { lq->agg_ctrl.requested_ba &= ~tid_msk; lq->agg_ctrl.wait_for_agg_status &= ~tid_msk; } } else if ((auto_agg) && - ((load <= lq->agg_ctrl.tid_traffic_load_threshold) - || ((lq->agg_ctrl.wait_for_agg_status & tid_msk)))) { + ((load <= lq->agg_ctrl.tid_traffic_load_threshold) || + ((lq->agg_ctrl.wait_for_agg_status & tid_msk)))) lq->agg_ctrl.tid_retry |= tid_msk; - } else { + else { lq->agg_ctrl.wait_for_agg_status |= tid_msk; spin_unlock_irqrestore(&priv->lq_mngr.lock, flags); iwl4965_perform_addba(priv, tid, 0x40, - lq->agg_ctrl.ba_timeout); + lq->agg_ctrl.ba_timeout); spin_lock_irqsave(&priv->lq_mngr.lock, flags); } } @@ -3122,13 +3113,13 @@ static void iwl4965_turn_on_agg(struct iwl_priv *priv, u8 tid) lq = (struct iwl_lq_mngr *)&(priv->lq_mngr); if ((tid < TID_MAX_LOAD_COUNT)) - iwl4965_turn_on_agg_for_tid(priv, lq, lq->agg_ctrl.auto_agg, tid); + iwl4965_turn_on_agg_for_tid(priv, lq, lq->agg_ctrl.auto_agg, + tid); else if (tid == TID_ALL_SPECIFIED) { if (lq->agg_ctrl.requested_ba) { for (tid = 0; tid < TID_MAX_LOAD_COUNT; tid++) iwl4965_turn_on_agg_for_tid(priv, lq, - lq->agg_ctrl.auto_agg, - tid); + lq->agg_ctrl.auto_agg, tid); } else { spin_lock_irqsave(&priv->lq_mngr.lock, flags); lq->agg_ctrl.tid_retry = 0; @@ -3138,6 +3129,7 @@ static void iwl4965_turn_on_agg(struct iwl_priv *priv, u8 tid) } } + void iwl4965_turn_off_agg(struct iwl_priv *priv, u8 tid) { u32 tid_msk; @@ -3715,7 +3707,7 @@ struct ieee802_11_elems { u8 ht_extra_param_len; }; -static int parse_elems(u8 * start, size_t len, struct ieee802_11_elems *elems) +static int parse_elems(u8 *start, size_t len, struct ieee802_11_elems *elems) { size_t left = len; u8 *pos = start; @@ -3792,9 +3784,9 @@ static void iwl4965_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) if (sta_id != IWL_INVALID_STATION) { u8 sta_awake = priv->stations[sta_id]. ps_status == STA_PS_STATUS_WAKE; - if (sta_awake && ps_bit) { + if (sta_awake && ps_bit) priv->stations[sta_id].ps_status = STA_PS_STATUS_SLEEP; - } else if (!sta_awake && !ps_bit) { + else if (!sta_awake && !ps_bit) { iwl4965_sta_modify_ps_wake(priv, sta_id); priv->stations[sta_id].ps_status = STA_PS_STATUS_WAKE; } @@ -4074,7 +4066,7 @@ static void iwl4965_rx_reply_rx_phy(struct iwl_priv *priv, sizeof(struct iwl4965_rx_phy_res)); } -static void iwl4965_rx_missed_beacon_notif (struct iwl_priv *priv, +static void iwl4965_rx_missed_beacon_notif(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { @@ -4099,8 +4091,8 @@ static void iwl4965_rx_missed_beacon_notif (struct iwl_priv *priv, #ifdef CONFIG_IWLWIFI_HT #ifdef CONFIG_IWLWIFI_HT_AGG -static void iwl4965_set_tx_status(struct iwl_priv *priv,int txq_id, int idx, - u32 status,u32 retry_count, u32 rate) +static void iwl4965_set_tx_status(struct iwl_priv *priv, int txq_id, int idx, + u32 status, u32 retry_count, u32 rate) { struct ieee80211_tx_status *tx_status = &(priv->txq[txq_id].txb[idx].status); @@ -4110,8 +4102,8 @@ 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, int sta_id, - int tid) +static void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, + int sta_id, int tid) { unsigned long lock_flags; @@ -4120,6 +4112,7 @@ static void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, int sta_id, priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le32(~(1 << tid)); priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; spin_unlock_irqrestore(&priv->sta_lock, lock_flags); + iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); } @@ -4299,16 +4292,15 @@ int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, int tx_fifo, /* supposes that ssn_idx is valid (!= 0xFFF) */ iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); - iwl_write_restricted_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 + 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 + - 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); + 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_restricted_reg(priv, SCD_INTERRUPT_MASK, (1 << txq_id)); @@ -4352,7 +4344,7 @@ int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); iwl_clear_bits_restricted_reg(priv, SCD_INTERRUPT_MASK, (1 << txq_id)); - iwl4965_txq_ctx_deactivate(priv,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); @@ -4384,7 +4376,7 @@ 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 iwl_priv *priv, const u8 *addr, int is_ap) { int i, r; struct iwl_link_quality_cmd link_cmd = { @@ -4404,9 +4396,9 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 * addr, int is_ap) r = IWL_RATE_1M_INDEX; while (i < LINK_QUAL_MAX_RETRY_NUM) { - if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) { + if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) table[i].rate_n_flags |= RATE_MCS_CCK_MSK; - } + table[i].s.rate = iwl_rates[r].plcp; table[i].rate_n_flags |= RATE_MCS_ANT_B_MSK; table[i].rate_n_flags &= ~RATE_MCS_ANT_A_MSK; @@ -4524,6 +4516,7 @@ void iwl4965_set_rxon_ht(struct iwl_priv *priv, ht_info->extension_chan_offset, ht_info->control_chan); return; } + void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index, u8 need_to_lock) { @@ -4627,6 +4620,7 @@ static const u16 default_tid_to_ac[] = { static int iwl_txq_ctx_activate_free(struct iwl_priv *priv) { int txq_id; + for (txq_id = 0; txq_id < IWL4965_NUM_QUEUES; txq_id++) if (!test_and_set_bit(txq_id, &priv->txq_ctx_active_msk)) return txq_id; @@ -4650,8 +4644,8 @@ 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=" MAC_FMT " tid=%d\n", - MAC_ARG(da), tid); + IWL_WARNING("iwl-AGG iwl_mac_ht_tx_agg_start on da=" MAC_FMT + " tid=%d\n", MAC_ARG(da), tid); sta_id = iwl_hw_find_station(priv, da); if (sta_id == IWL_INVALID_STATION) diff --git a/drivers/net/wireless/iwl-4965.h b/drivers/net/wireless/iwl-4965.h index 7fa17ee..db4a02e 100644 --- a/drivers/net/wireless/iwl-4965.h +++ b/drivers/net/wireless/iwl-4965.h @@ -36,7 +36,7 @@ struct sta_ht_info; */ static inline void iwl_eeprom_release_semaphore(struct iwl_priv *priv) {} -static inline void iwl4965_add_station(struct iwl_priv *priv, const u8 * addr, +static inline void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) {} static inline void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct sta_ht_info *ht_info) {} @@ -77,7 +77,7 @@ extern void iwl_eeprom_release_semaphore(struct iwl_priv *priv); extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq, u16 byte_cnt); -extern void iwl4965_add_station(struct iwl_priv *priv, const u8 * addr, +extern void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap); extern void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct sta_ht_info *ht_info); diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 9a5041a..d082a10 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -72,11 +72,11 @@ u32 iwl_debug_level; ******************************************************************************/ /* module parameters */ -int iwl_param_disable_hw_scan = 0; -int iwl_param_debug = 0; -int iwl_param_disable = 0; /* def: enable radio */ -int iwl_param_antenna = 0; /* def: 0 = both antennas (use diversity) */ -int iwl_param_hwcrypto = 0; /* def: using software encryption */ +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) */ +int iwl_param_hwcrypto; /* def: using software encryption */ int iwl_param_qos_enable = 1; /* @@ -293,13 +293,13 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) /* 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)) { + q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd)) iwl_hw_tx_queue_free_tfd(priv, txq); - } len = sizeof(txq->cmd[0]) * q->n_window; if (q->id == IWL_CMD_QUEUE_NUM); - len += IWL_MAX_SCAN_SIZE; + len += IWL_MAX_SCAN_SIZE; + pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); /* free buffers belonging to queue itself */ @@ -329,13 +329,14 @@ const u8 BROADCAST_ADDR[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /**************************************************************/ -static u8 iwl_remove_station(struct iwl_priv *priv, const u8 * bssid, int is_ap) +static u8 iwl_remove_station(struct iwl_priv *priv, const u8 *bssid, int is_ap) { int index = IWL_INVALID_STATION; int i; unsigned long flags; spin_lock_irqsave(&priv->sta_lock, flags); + if (is_ap) { index = IWL_AP_ID; if ((priv->stations[index].used)) @@ -344,17 +345,17 @@ static u8 iwl_remove_station(struct iwl_priv *priv, const u8 * bssid, int is_ap) index = IWL_BROADCAST_ID; if ((priv->stations[index].used)) priv->stations[index].used = 0; - } else + } else { for (i = IWL_STA_ID; i < priv->num_stations + IWL_STA_ID; i++) { if (priv->stations[i].used && - !compare_ether_addr( - priv->stations[i].sta.sta.addr, bssid)) { + !compare_ether_addr(priv->stations[i].sta.sta.addr, + bssid)) { index = i; priv->stations[index].used = 0; break; } } - + } if (index != IWL_INVALID_STATION) { if (priv->num_stations > 0) priv->num_stations--; @@ -371,12 +372,12 @@ static void iwl_clear_stations_table(struct iwl_priv *priv) spin_lock_irqsave(&priv->sta_lock, flags); priv->num_stations = 0; - memset(priv->stations, 0, - IWL_STATION_COUNT * sizeof(struct iwl_station_entry)); + memset(priv->stations, 0, sizeof(priv->stations)); + spin_unlock_irqrestore(&priv->sta_lock, flags); } -u8 iwl_add_station(struct iwl_priv *priv, const u8 * bssid, int is_ap, u8 flags) +u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid, int is_ap, u8 flags) { int i = IWL_STATION_COUNT; int index = IWL_INVALID_STATION; @@ -398,7 +399,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 * bssid, int is_ap, u8 flags) !compare_ether_addr(priv->stations[index].sta.sta.addr, bssid)) goto done; - } else + } else { for (i = IWL_STA_ID; i < priv->num_stations + IWL_STA_ID; i++) { if (priv->stations[i].used && !compare_ether_addr(priv->stations[i].sta.sta.addr, @@ -409,6 +410,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 * bssid, int is_ap, u8 flags) index == IWL_INVALID_STATION) index = i; } + } if (index != IWL_INVALID_STATION) i = index; @@ -437,8 +439,8 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 * bssid, int is_ap, u8 flags) station->sta.station_flags |= STA_FLG_TX_RATE_MSK; - station->current_rate.rate_n_flags = le16_to_cpu( - station->sta.rate_n_flags); + station->current_rate.rate_n_flags = + le16_to_cpu(station->sta.rate_n_flags); #endif #if IWL == 4965 @@ -822,18 +824,18 @@ int iwl_send_statistics_request(struct iwl_priv *priv) * NOTE: mutex must be held before calling the this fnction */ static int iwl_rxon_add_station(struct iwl_priv *priv, - const u8 * addr, int is_ap) + const u8 *addr, int is_ap) { - u8 i; + u8 rc; /* Remove this station if it happens to already exist */ iwl_remove_station(priv, addr, is_ap); - i = iwl_add_station(priv, addr, is_ap, 0); + rc = iwl_add_station(priv, addr, is_ap, 0); iwl4965_add_station(priv, addr, is_ap); - return i; + return rc; } /** @@ -1470,8 +1472,8 @@ static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) list_add(&frame->list, &priv->free_frames); } -int iwl_fill_beacon_frame(struct iwl_priv *priv, - struct ieee80211_hdr *hdr, const u8 * dest, int left) +int iwl_fill_beacon_frame(struct iwl_priv *priv, struct ieee80211_hdr *hdr, + const u8 *dest, int left) { if (!iwl_is_associated(priv) || !priv->ibss_beacon || @@ -1528,7 +1530,7 @@ 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 iwl_priv *priv, u8 *mac) { memcpy(mac, priv->eeprom.mac_address, 6); } @@ -1678,9 +1680,9 @@ void iwl_report_frame(struct iwl_priv *priv, if (to_us && (frame_ctl & ~IEEE80211_FCTL_PROTECTED) == (IEEE80211_FCTL_FROMDS | IEEE80211_FTYPE_DATA)) { dataframe = 1; - if (!group100) { + if (!group100) print_summary = 1; /* print each frame */ - } else if (priv->framecnt_to_us < 100) { + else if (priv->framecnt_to_us < 100) { priv->framecnt_to_us++; print_summary = 0; } else { @@ -1731,12 +1733,12 @@ void iwl_report_frame(struct iwl_priv *priv, /* print frame summary. * MAC addresses show just the last byte (for brevity), * but you can hack it to show more, if you'd like to. */ - if (dataframe) { + if (dataframe) IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, " "len=%u, rssi=%d, chnl=%d, rate=%u, \n", title, frame_ctl, header->addr1[5], length, rssi, channel, rate); - } else { + else { /* src/dst addresses assume managed mode */ IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, " "src=0x%02x, rssi=%u, tim=%lu usec, " @@ -1766,7 +1768,7 @@ static void iwl_unset_hw_setting(struct iwl_priv *priv) * * 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 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, u16 basic_rate, int max_count) { u16 ret_rates = 0, bit; @@ -2046,7 +2048,7 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force) #define NOSLP 0, 0, 0 #define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK, 0, 0 #endif -#define SLP_TIMEOUT(T) __constant_cpu_to_le32((T) * MSEC_TO_USEC) +#define SLP_TIMEOUT(T) __constant_cpu_to_le32((T) * MSEC_TO_USEC) #define SLP_VEC(X0, X1, X2, X3, X4) {__constant_cpu_to_le32(X0), \ __constant_cpu_to_le32(X1), \ __constant_cpu_to_le32(X2), \ @@ -2068,11 +2070,15 @@ 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] = { {{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}, - {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 0xFF)}, 0}, - {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(100), SLP_VEC(2, 6, 9, 9, 0xFF)}, 0}, + {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), + SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, + {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), + SLP_VEC(2, 4, 6, 7, 0xFF)}, 0}, + {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(100), + SLP_VEC(2, 6, 9, 9, 0xFF)}, 0}, {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(25), SLP_VEC(2, 7, 9, 9, 0xFF)}, 0}, - {{SLP, SLP_TIMEOUT(25), SLP_TIMEOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} + {{SLP, SLP_TIMEOUT(25), SLP_TIMEOUT(25), + SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} }; int iwl_power_init_handle(struct iwl_priv *priv) @@ -2863,7 +2869,6 @@ static int iwl_tx_skb(struct iwl_priv *priv, #endif /* CONFIG_IWLWIFI_HT_AGG */ #endif /* CONFIG_IWLWIFI_HT */ #endif - } txq = &priv->txq[txq_id]; @@ -2895,13 +2900,13 @@ static int iwl_tx_skb(struct iwl_priv *priv, len_org = len; len = (len + 3) & ~3; - if (len_org != len) { + if (len_org != len) len_org = 1; - } else + 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 iwl_cmd) * idx + + offsetof(struct iwl_cmd, hdr); iwl_hw_tx_queue_attach_buffer_to_tfd(priv, tfd, txcmd_phys, len); @@ -2911,13 +2916,11 @@ static int iwl_tx_skb(struct iwl_priv *priv, /* 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); + phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, + len, PCI_DMA_TODEVICE); iwl_hw_tx_queue_attach_buffer_to_tfd(priv, tfd, phys_addr, len); } - #if IWL == 3945 /* If there is no payload, then only one TFD is used */ if (!len) @@ -2946,9 +2949,9 @@ static int iwl_tx_skb(struct iwl_priv *priv, out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; #endif - if (!(ieee80211_get_morefrag(hdr))) { + if (!ieee80211_get_morefrag(hdr)) { txq->need_update = 1; - if ( qc ) { + if (qc) { u8 tid = (u8)(le16_to_cpu(*qc) & 0xf); priv->stations[sta_id].tid[tid].seq_number = seq_number; @@ -3018,10 +3021,9 @@ static void iwl_set_rate(struct iwl_priv *priv) priv->active_rate |= (1 << rate->val); if (rate->flags & IEEE80211_RATE_BASIC) priv->active_rate_basic |= (1 << rate->val); - } else { + } else IWL_DEBUG_RATE("Not adding rate %d (plcp %d)\n", rate->val, iwl_rates[rate->val].plcp); - } } IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n", @@ -3503,8 +3505,8 @@ static int iwl_is_tx_success(u32 status) * ******************************************************************************/ #if IWL == 4965 -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWLWIFI_HT_AGG static inline int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) @@ -3546,24 +3548,23 @@ int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, int txq_id, idx; u16 seq; - if (agg->wait_for_ba) { + if (agg->wait_for_ba) IWL_DEBUG_TX_REPLY("got tx repsons w/o back\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; + if (agg->frame_count == 1) { status = le32_to_cpu(frame_status[0]); seq = status >> 16; idx = SEQ_TO_INDEX(seq); txq_id = SEQ_TO_QUEUE(seq); -/* FIXME: code repetition */ + /* FIXME: code repetition */ IWL_DEBUG_TX_REPLY("FrameCnt = %d, StartIdx=%d idx=%d\n", - agg->frame_count, agg->start_idx, idx); + agg->frame_count, agg->start_idx, idx); tx_status = &(priv->txq[txq_id].txb[idx].status); tx_status->retry_count = tx_resp->failure_frame; @@ -3575,9 +3576,7 @@ int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, IEEE80211_TX_STATUS_ACK : 0; tx_status->control.tx_rate = iwl_hw_get_rate_n_flags(tx_resp->rate_n_flags); - -/* FIXME: code repetition end */ - + /* FIXME: code repetition end */ IWL_DEBUG_TX_REPLY("1 Frame 0x%x idx %d failure :%d\n", status & 0xff, idx, tx_resp->failure_frame); @@ -3588,16 +3587,15 @@ int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, } else { u64 bitmap = 0; int start = agg->start_idx; - for (i = 0; i < agg->frame_count; i++) { + for (i = 0; i < agg->frame_count; i++) { status = le32_to_cpu(frame_status[i]); seq = status >> 16; idx = SEQ_TO_INDEX(seq); txq_id = SEQ_TO_QUEUE(seq); - if (status & - (AGG_TX_STATE_FEW_BYTES_MSK| - AGG_TX_STATE_ABORT_MSK)) + if (status & (AGG_TX_STATE_FEW_BYTES_MSK | + AGG_TX_STATE_ABORT_MSK)) continue; IWL_DEBUG_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n", @@ -3613,7 +3611,6 @@ int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, return -1; } - IWL_DEBUG_TX_REPLY("AGG Frame i=%d idx %d seq=%d\n", i, idx, SEQ_TO_SN(hdr->seq_ctrl)); @@ -3623,9 +3620,9 @@ int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, bitmap = bitmap << sh; sh = 0; start = idx; - } else if ( sh < -64) { + } else if ( sh < -64) sh = 0xff - (start - idx); - } else if (sh < 0) { + else if (sh < 0) { sh = start - idx; start = idx; bitmap = bitmap << sh; @@ -3641,9 +3638,8 @@ int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, agg->start_idx = start; agg->rate_n_flags = cpu_to_le32(tx_resp->rate_n_flags); IWL_DEBUG_TX_REPLY("Frames %d start_idx=%d bitmap=0x%x\n", - agg->frame_count, - agg->start_idx, - agg->bitmap0); + agg->frame_count, agg->start_idx, + agg->bitmap0); if (bitmap) agg->wait_for_ba = 1; @@ -3666,8 +3662,8 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, struct iwl_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; u32 status = le32_to_cpu(tx_resp->status); #if IWL == 4965 -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWLWIFI_HT_AGG int tid, sta_id; #endif #endif @@ -3682,16 +3678,16 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, } #if IWL == 4965 -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWLWIFI_HT_AGG if (txq->sched_retry) { const u32 scd_ssn = iwl_get_scd_ssn(tx_resp); - struct ieee80211_hdr *hdr = iwl_tx_queue_get_hdr(priv, txq_id, - index); + struct ieee80211_hdr *hdr = + iwl_tx_queue_get_hdr(priv, txq_id, index); struct iwl_ht_agg *agg = NULL; __le16 *qc = ieee80211_get_qos_ctrl(hdr); - if(qc == NULL) { + if (qc == NULL) { IWL_ERROR("BUG_ON qc is null!!!!\n"); return; } @@ -3715,8 +3711,8 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, if (txq->q.last_used != (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); + IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn " + "%d index %d\n", scd_ssn , index); iwl_tx_queue_reclaim(priv, txq_id, index); } } else { @@ -3734,31 +3730,27 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, iwl_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; #if IWL == 3945 - tx_status->control.tx_rate = iwl_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, tx_resp->rate, tx_resp->failure_frame); - #elif IWL == 4965 - tx_status->control.tx_rate = iwl_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), - status, le32_to_cpu(tx_resp->rate_n_flags), - tx_resp->failure_frame); + "retries %d\n", txq_id, iwl_get_tx_fail_reason(status), + status, le32_to_cpu(tx_resp->rate_n_flags), + tx_resp->failure_frame); #endif IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); if (index != -1) iwl_tx_queue_reclaim(priv, txq_id, index); #if IWL == 4965 -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG +#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWLWIFI_HT_AGG } #endif /* CONFIG_IWLWIFI_HT_AGG */ #endif /* CONFIG_IWLWIFI_HT */ @@ -3770,7 +3762,7 @@ 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) + struct iwl_rx_mem_buffer *rxb) { struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_alive_resp *palive; @@ -4550,16 +4542,16 @@ int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) * This formula is a least squares fit of data points collected and * compared with a reference system that had a percentage (%) display * for signal quality. */ - } else { - sig_qual = - (100 * (RSSI_RANGE * RSSI_RANGE) - - degradation * (15 * RSSI_RANGE + 62 * degradation)) / - (RSSI_RANGE * RSSI_RANGE); - } + } else + sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - + degradation * (15 * RSSI_RANGE + 62 * degradation)) / + (RSSI_RANGE * RSSI_RANGE); + if (sig_qual > 100) sig_qual = 100; else if (sig_qual < 1) sig_qual = 0; + return sig_qual; } @@ -4687,10 +4679,9 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *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 { + } else iwl_write32(priv, HBUS_TARG_WRPTR, txq->q.first_empty | (txq_id << 8)); - } txq->need_update = 0; @@ -4698,7 +4689,6 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, } #ifdef CONFIG_IWLWIFI_DEBUG - static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) { IWL_DEBUG_RADIO("RX CONFIG:\n"); @@ -4722,7 +4712,6 @@ static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) MAC_ARG(rxon->bssid_addr)); IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id)); } - #endif static void iwl_enable_interrupts(struct iwl_priv *priv) @@ -4887,9 +4876,9 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, ptr += sizeof(u32); time = iwl_read_restricted_mem(priv, ptr); ptr += sizeof(u32); - if (mode == 0) { + if (mode == 0) IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */ - } else { + else { data = iwl_read_restricted_mem(priv, ptr); ptr += sizeof(u32); IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev); @@ -4938,11 +4927,10 @@ static void iwl_dump_nic_event_log(struct iwl_priv *priv) size, num_wraps); /* 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) { + * i.e the next one that uCode would fill. */ + if (num_wraps) iwl_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); @@ -5188,8 +5176,8 @@ static irqreturn_t iwl_isr(int irq, void *data) goto none; } - IWL_DEBUG_ISR ("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", - inta, inta_mask, inta_fh); + 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 */ tasklet_schedule(&priv->irq_tasklet); @@ -5612,9 +5600,9 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, int phymode, /*scan_pwr_info->tpc.tx_gain; */ if ((phymode == MODE_IEEE80211A) || - (phymode == MODE_ATHEROS_TURBO)) { + (phymode == MODE_ATHEROS_TURBO)) scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; - } else { + else { scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); /* NOTE: if we were doing 6Mb OFDM for scans we'd use * power level @@ -5665,7 +5653,7 @@ static void iwl_init_hw_rates(struct iwl_priv *priv, * which is CCK | PREAMBLE2 */ rates[i].flags |= (iwl_rates[i].plcp == 10) ? - IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2; + IEEE80211_RATE_CCK : IEEE80211_RATE_CCK_2; } /* Set up which ones are basic rates... */ @@ -5966,7 +5954,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 * image, u32 len) * 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 iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) { u32 val; int rc = 0; @@ -6009,7 +5997,7 @@ static int iwl_verify_inst_sparse(struct iwl_priv *priv, __le32 * image, u32 len * iwl_verify_ucode - determine which instruction image is in SRAM, * and verify its contents */ -static int iwl_verify_ucode(struct iwl_priv * priv) +static int iwl_verify_ucode(struct iwl_priv *priv) { __le32 *image; u32 len; @@ -6055,7 +6043,7 @@ static int iwl_verify_ucode(struct iwl_priv * priv) /* check contents of special bootstrap uCode SRAM */ -static int iwl_verify_bsm(struct iwl_priv * priv) +static int iwl_verify_bsm(struct iwl_priv *priv) { __le32 *image = priv->ucode_boot.v_addr; u32 len = priv->ucode_boot.len; @@ -6117,7 +6105,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 iwl_load_bsm(struct iwl_priv *priv) { __le32 *image = priv->ucode_boot.v_addr; u32 len = priv->ucode_boot.len; @@ -6164,7 +6152,8 @@ static int iwl_load_bsm(struct iwl_priv * priv) 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, le32_to_cpu( *image)); + _iwl_write_restricted_reg(priv, reg_offset, + le32_to_cpu(*image)); rc = iwl_verify_bsm(priv); if (rc) { @@ -6648,12 +6637,12 @@ static void iwl_alive_start(struct iwl_priv *priv) iwl_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); - if (iwl_is_associated(priv)) { + if (iwl_is_associated(priv)) { struct iwl_rxon_cmd *active_rxon = (struct iwl_rxon_cmd *)(&priv->active_rxon); memcpy(&priv->staging_rxon, &priv->active_rxon, - sizeof(priv->staging_rxon)); + sizeof(priv->staging_rxon)); active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; } else { /* Initialize our rx_config data */ @@ -7087,9 +7076,8 @@ static void iwl_bg_request_scan(struct work_struct *data) scan->direct_scan[0].len = priv->essid_len; memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); direct_mask = 1; - } else { + } else direct_mask = 0; - } /* We don't build a direct scan probe request; the uCode will do * that based on the direct_mask added to each channel entry */ @@ -7621,9 +7609,9 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, IWL_DEBUG_MAC80211("bssid was set to: " MAC_FMT "\n", MAC_ARG(conf->bssid)); } - if (priv->ibss_beacon) { + if (priv->ibss_beacon) dev_kfree_skb(priv->ibss_beacon); - } + priv->ibss_beacon = conf->beacon; } @@ -7700,7 +7688,7 @@ 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 iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) { int rc = 0; unsigned long flags; @@ -7750,7 +7738,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 * ssid, size_t len) return rc; } -static int iwl_mac_set_key(struct ieee80211_hw *hw, set_key_cmd cmd, u8 * addr, +static int iwl_mac_set_key(struct ieee80211_hw *hw, set_key_cmd cmd, u8 *addr, struct ieee80211_key_conf *key, int aid) { struct iwl_priv *priv = hw->priv; @@ -8051,7 +8039,7 @@ union ht_cap_info { u16 sig_txop_protection_support :1; }; u16 val; -}__attribute__ ((packed)); +} __attribute__ ((packed)); union ht_param_info{ struct { @@ -8060,9 +8048,9 @@ union ht_param_info{ u8 reserved :3; }; u8 val; -}__attribute__ ((packed)); +} __attribute__ ((packed)); -union ht_exra_param_info{ +union ht_exra_param_info { struct { u8 ext_chan_offset :2; u8 tx_chan_width :1; @@ -8071,7 +8059,7 @@ union ht_exra_param_info{ u8 service_interval_granularity :3; }; u8 val; -}__attribute__ ((packed)); +} __attribute__ ((packed)); union ht_operation_mode{ struct { @@ -8080,7 +8068,7 @@ union ht_operation_mode{ u16 reserved :13; }; u16 val; -}__attribute__ ((packed)); +} __attribute__ ((packed)); static int sta_ht_info_init(struct ieee80211_ht_capability *ht_cap, @@ -8361,9 +8349,9 @@ static ssize_t store_flags(struct device *d, mutex_lock(&priv->mutex); if (priv->staging_rxon.flags != flags) { /* Cancel any currently running scans... */ - if (iwl_scan_cancel(priv, 100)) { + if (iwl_scan_cancel(priv, 100)) IWL_WARNING("Could not cancel scan.\n"); - } else { + else { IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", flags); priv->staging_rxon.flags = flags; @@ -8395,9 +8383,9 @@ static ssize_t store_filter_flags(struct device *d, mutex_lock(&priv->mutex); if (priv->staging_rxon.filter_flags != filter_flags) { /* Cancel any currently running scans... */ - if (iwl_scan_cancel(priv, 100)) { + if (iwl_scan_cancel(priv, 100)) IWL_WARNING("Could not cancel scan.\n"); - } else { + else { IWL_DEBUG_INFO("Committing rxon.filter_flags = " "0x%04X\n", filter_flags); priv->staging_rxon.filter_flags = filter_flags; @@ -8449,9 +8437,9 @@ static ssize_t store_tune(struct device *d, } /* Cancel any currently running scans... */ - if (iwl_scan_cancel(priv, 100)) { + if (iwl_scan_cancel(priv, 100)) IWL_WARNING("Could not cancel scan.\n"); - } else { + else { IWL_DEBUG_INFO("Committing phymode and " "rxon.channel = %d %d\n", phymode, channel); @@ -8708,7 +8696,7 @@ static ssize_t show_channels(struct device *d, "Displaying %d channels in 2.4GHz band " "(802.11bg):\n", count); - for (i = 0; i < count; i++) { + for (i = 0; i < count; i++) len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n", channels[i].chan, channels[i].power_level, @@ -8723,7 +8711,6 @@ static ssize_t show_channels(struct device *d, channels[i]. flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? "active/passive" : "passive only"); - } hw_mode = iwl_get_hw_mode(priv, MODE_IEEE80211A); if (hw_mode) { @@ -8734,12 +8721,10 @@ static ssize_t show_channels(struct device *d, count = 0; } - len += - sprintf(&buf[len], - "Displaying %d channels in 5.2GHz band " - "(802.11a):\n", count); + len += sprintf(&buf[len], "Displaying %d channels in 5.2GHz band " + "(802.11a):\n", count); - for (i = 0; i < count; i++) { + for (i = 0; i < count; i++) len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n", channels[i].chan, channels[i].power_level, @@ -8754,7 +8739,6 @@ static ssize_t show_channels(struct device *d, channels[i]. flag & IEEE80211_CHAN_W_ACTIVE_SCAN ? "active/passive" : "passive only"); - } return len; } diff --git a/drivers/net/wireless/iwl-helpers.h b/drivers/net/wireless/iwl-helpers.h index 94dbb38..c0ea48e 100644 --- a/drivers/net/wireless/iwl-helpers.h +++ b/drivers/net/wireless/iwl-helpers.h @@ -314,9 +314,8 @@ static inline const char *iwl_escape_essid(const char *essid, u8 essid_len) *d++ = '\\'; *d++ = '0'; s++; - } else { + } else *d++ = *s++; - } } *d = '\0'; return escaped; @@ -334,7 +333,7 @@ static inline unsigned long elapsed_jiffies(unsigned long start, static inline int snprint_line(char *buf, size_t count, - const u8 * data, u32 len, u32 ofs) + const u8 *data, u32 len, u32 ofs) { int out, i, j, l; char c; diff --git a/drivers/net/wireless/iwl-io.h b/drivers/net/wireless/iwl-io.h index e870cd8..0ae031a 100644 --- a/drivers/net/wireless/iwl-io.h +++ b/drivers/net/wireless/iwl-io.h @@ -178,10 +178,9 @@ static inline int _iwl_grab_restricted_access(struct iwl_priv *priv) IWL_DEBUG_RF_KILL("Wait for complete power-down, " "gpctl = 0x%08x\n", gp_ctl); mdelay(10); - } else { + } else IWL_DEBUG_RF_KILL("power-down complete, " - "gpctl = 0x%08x\n", gp_ctl); - } + "gpctl = 0x%08x\n", gp_ctl); } /* this bit wakes up the NIC */ @@ -268,7 +267,7 @@ static inline u32 __iwl_read_restricted(const char *f, u32 l, #define iwl_read_restricted(p, r) _iwl_read_restricted(p, r) #endif -static void inline _iwl_write_restricted(struct iwl_priv *priv, +static inline void _iwl_write_restricted(struct iwl_priv *priv, u32 reg, u32 value) { _iwl_write32(priv, reg, value); @@ -285,9 +284,10 @@ static void __iwl_write_restricted(u32 line, __iwl_write_restricted(__LINE__, priv, reg, value) static inline void iwl_write_buffer_restricted(struct iwl_priv *priv, - u32 reg, u32 len, u32 * values) + 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); @@ -308,19 +308,19 @@ static inline int _iwl_poll_restricted_bit(struct iwl_priv *priv, return -ETIMEDOUT; } + static inline int __iwl_poll_restricted_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); + if (unlikely(rc == -ETIMEDOUT)) - IWL_DEBUG_IO - ("poll_restricted_bit(0x%08X, 0x%08X) - timedout - %s %d\n", - addr, mask, f, l); + IWL_DEBUG_IO("poll_restricted_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); + IWL_DEBUG_IO("poll_restricted_bit(0x%08X, 0x%08X) = 0x%08X " + "- %s %d\n", addr, mask, rc, f, l); return rc; } @@ -383,7 +383,7 @@ static inline void __iwl_set_bits_restricted_reg(u32 line, struct iwl_priv #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)) -static void inline __iwl_set_bits_mask_restricted_reg(u32 line, struct iwl_priv +static inline void __iwl_set_bits_mask_restricted_reg(u32 line, struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) { @@ -417,7 +417,7 @@ static inline void iwl_write_restricted_mem(struct iwl_priv *priv, u32 addr, static inline void iwl_write_restricted_mem_buffer(struct iwl_priv *priv, u32 addr, u32 len, - u32 * values) + u32 *values) { iwl_write_restricted(priv, HBUS_TARG_MEM_WADDR, addr); for (; 0 < len; len -= sizeof(u32), values++) @@ -426,7 +426,7 @@ static inline void iwl_write_restricted_mem_buffer(struct iwl_priv *priv, static inline void iwl_write_restricted_reg_buffer(struct iwl_priv *priv, u32 reg, u32 len, - u8 * values) + u8 *values) { u32 reg_offset = reg; u32 aligment = reg & 0x3; diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h index 3de6425..002f8e8 100644 --- a/drivers/net/wireless/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi.h @@ -520,11 +520,11 @@ struct fw_image_desc { /* 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 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 */ + __le32 boot_size; /* bytes of bootstrap instructions */ u8 data[0]; /* data in same order as "size" elements */ }; @@ -590,7 +590,7 @@ 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, +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); @@ -631,7 +631,7 @@ extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, extern int __must_check iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); extern int iwl_fill_beacon_frame(struct iwl_priv *priv, - struct ieee80211_hdr *hdr, const u8 * dest, + 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); @@ -715,7 +715,7 @@ extern int iwl4965_get_temperature(const struct iwl_priv *priv); * 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 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid); extern int iwl_hw_channel_switch(struct iwl_priv *priv, u8 channel); extern int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index); -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 02/28] iwlwifi: add more Kconfig options 2007-08-08 7:33 ` [PATCH 01/28] iwlwifi: fix a lot of checkpatch.pl warnings Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 03/28] iwlwifi: Endianity fix for 4965 rate scaling Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Add IWLWIFI_SENSITIVITY, IWLWIFI_SPECTRUM_MEASUREMENT, and IWLWIFI_QOS. Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/Kconfig | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index daa7c9e..a9f97ab 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig @@ -768,6 +768,29 @@ config IWLWIFI_DEBUG as the debug information can assist others in helping you resolve any problems you may encounter. +config IWLWIFI_SENSITIVITY + bool "Enable Sensitivity Calibration in iwlwifi drivers" + depends on IWLWIFI + default y + ---help--- + This option will enable sensitivity calibration for the iwlwifi + drivers. + +config IWLWIFI_SPECTRUM_MEASUREMENT + bool "Enable Spectrum Measurement in iwlwifi drivers" + depends on IWLWIFI + default y + ---help--- + This option will enable spectrum measurement for the iwlwifi drivers. + +config IWLWIFI_QOS + bool "Enable Wireless QoS in iwlwifi drivers" + depends on IWLWIFI + default y + ---help--- + This option will enable wireless quality of service (QoS) for the + iwlwifi drivers. + config IWLWIFI_HT bool "Enable 802.11n HT features in iwlwifi drivers" depends on EXPERIMENTAL -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 03/28] iwlwifi: Endianity fix for 4965 rate scaling 2007-08-08 7:33 ` [PATCH 02/28] iwlwifi: add more Kconfig options Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 04/28] iwlwifi: Endianity fix for 4965 rx chain selection Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Tomas Winkler, Zhu Yi From: Tomas Winkler <tomas.winkler@intel.com> This patch fixes endianity issues in 4965 rate scaling algorithm. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-4965-hw.h | 4 ++- drivers/net/wireless/iwl-4965-rs.c | 54 ++++++++++++++++++++++------------- drivers/net/wireless/iwl-4965.c | 18 ++++++------ drivers/net/wireless/iwl-commands.h | 11 ------- 4 files changed, 46 insertions(+), 41 deletions(-) diff --git a/drivers/net/wireless/iwl-4965-hw.h b/drivers/net/wireless/iwl-4965-hw.h index d7b69f5..fc9f506 100644 --- a/drivers/net/wireless/iwl-4965-hw.h +++ b/drivers/net/wireless/iwl-4965-hw.h @@ -314,7 +314,9 @@ struct iwl_link_quality_cmd { __le16 control; struct iwl_link_qual_general_params general_params; struct iwl_link_qual_agg_params agg_params; - struct iwl_rate rate_scale_table[LINK_QUAL_MAX_RETRY_NUM]; + struct { + __le32 rate_n_flags; + } rs_table[LINK_QUAL_MAX_RETRY_NUM]; __le32 reserved2; } __attribute__ ((packed)); diff --git a/drivers/net/wireless/iwl-4965-rs.c b/drivers/net/wireless/iwl-4965-rs.c index 07fe911..3fab3c9 100644 --- a/drivers/net/wireless/iwl-4965-rs.c +++ b/drivers/net/wireless/iwl-4965-rs.c @@ -69,6 +69,17 @@ static u8 rs_ht_to_legacy[] = { IWL_RATE_48M_INDEX, IWL_RATE_54M_INDEX }; +struct iwl_rate { + union { + struct { + u8 rate; + u8 flags; + u16 ext_flags; + } s; + u32 rate_n_flags; + }; +} __attribute__ ((packed)); + struct iwl_rate_scale_data { u64 data; s32 success_counter; @@ -205,7 +216,7 @@ static int rs_send_lq_cmd(struct iwl_priv *priv, #ifdef CONFIG_IWLWIFI_DEBUG for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) IWL_DEBUG_RATE("lq index %d 0x%X\n", - i, lq->rate_scale_table[i].rate_n_flags); + i, lq->rs_table[i].rate_n_flags); #endif if (flags & CMD_ASYNC) @@ -340,8 +351,8 @@ int static rs_mcs_from_tbl(struct iwl_rate *mcs_rate, return rc; } -static int rs_get_tbl_info_from_mcs(struct iwl_rate *mcs_rate, int phymode, - struct iwl_scale_tbl_info *tbl, +static int rs_get_tbl_info_from_mcs(const struct iwl_rate *mcs_rate, + int phymode, struct iwl_scale_tbl_info *tbl, int *rate_idx) { int index; @@ -665,17 +676,17 @@ static void rs_tx_status(void *priv_rate, } if (retries && - (tx_mcs.rate_n_flags != table->rate_scale_table[0].rate_n_flags)) { + (tx_mcs.rate_n_flags != table->rs_table[0].rate_n_flags)) { IWL_DEBUG_RATE("initial rate does not match 0x%x 0x%x\n", tx_mcs.rate_n_flags, - table->rate_scale_table[0].rate_n_flags); + table->rs_table[0].rate_n_flags); sta_info_put(sta); return; } while (retries) { tx_mcs.rate_n_flags = - table->rate_scale_table[index].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); @@ -708,7 +719,7 @@ static void rs_tx_status(void *priv_rate, tx_mcs.rate_n_flags = tx_resp->control.tx_rate; else tx_mcs.rate_n_flags = - table->rate_scale_table[index].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); @@ -1572,7 +1583,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, lq_update: if (update_lq) { rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green); - rs_fill_link_cmd(lq_data, &mcs_rate, &(lq_data->lq), sta); + rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq, sta); if (!rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC)) lq_data->commit_lq = 0; @@ -1773,7 +1784,7 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate, } if ((sta_id != IWL_INVALID_STATION)) { lq->lq.sta_id = sta_id; - lq->lq.rate_scale_table[0].rate_n_flags = 0; + lq->lq.rs_table[0].rate_n_flags = 0; lq->ibss_sta_added = 1; lq->commit_lq = 1; rs_initialize_lq(priv, sta); @@ -1858,7 +1869,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, } if ((sta_id != IWL_INVALID_STATION)) { crl->lq.sta_id = sta_id; - crl->lq.rate_scale_table[0].rate_n_flags = 0; + crl->lq.rs_table[0].rate_n_flags = 0; } priv->lq_mngr.lq_ready = 1; } @@ -1912,6 +1923,7 @@ static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, u8 use_ht_possible = 1; u8 repeat_cur_rate = 0; struct iwl_rate new_rate; + struct iwl_rate tbl_rate; struct iwl_scale_tbl_info tbl_type = { 0 }; rs_get_tbl_info_from_mcs(tx_mcs, lq_data->phymode, @@ -1923,7 +1935,8 @@ static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, } else repeat_cur_rate = IWL_HT_NUMBER_TRY; - lq_cmd->rate_scale_table[index].rate_n_flags = tx_mcs->rate_n_flags; + lq_cmd->rs_table[index].rate_n_flags = + cpu_to_le32(tx_mcs->rate_n_flags); lq_cmd->general_params.mimo_delimiter = is_mimo(tbl_type.lq_type) ? 1 : 0; new_rate.rate_n_flags = tx_mcs->rate_n_flags; @@ -1947,13 +1960,14 @@ static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, ant_toggle_count = 1; } } - lq_cmd->rate_scale_table[index].rate_n_flags = - new_rate.rate_n_flags; + lq_cmd->rs_table[index].rate_n_flags = + cpu_to_le32(new_rate.rate_n_flags); repeat_cur_rate--; index++; } - rs_get_tbl_info_from_mcs(&lq_cmd->rate_scale_table[index - 1], - lq_data->phymode, &tbl_type, + tbl_rate.rate_n_flags = + le32_to_cpu(lq_cmd->rs_table[index - 1].rate_n_flags); + rs_get_tbl_info_from_mcs(&tbl_rate, lq_data->phymode, &tbl_type, &rate_idx); if (is_mimo(tbl_type.lq_type)) lq_cmd->general_params.mimo_delimiter = index; @@ -1974,19 +1988,19 @@ static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data, use_ht_possible = 0; - lq_cmd->rate_scale_table[index].rate_n_flags = - new_rate.rate_n_flags; - /* lq_cmd->rate_scale_table[index].rate_n_flags = 0x800d; */ + lq_cmd->rs_table[index].rate_n_flags = + cpu_to_le32(new_rate.rate_n_flags); + /* lq_cmd->rs_table[index].rate_n_flags = 0x800d; */ index++; repeat_cur_rate--; } - /* lq_cmd->rate_scale_table[0].rate_n_flags = 0x800d; */ + /* lq_cmd->rs_table[0].rate_n_flags = 0x800d; */ lq_cmd->general_params.dual_stream_ant_msk = 3; lq_cmd->agg_params.agg_dis_start_th = 3; - lq_cmd->agg_params.agg_time_limit = 4000; + lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000); return rc; } diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index 6b8fd73..58ea2a1 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -4382,11 +4382,10 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) struct iwl_link_quality_cmd link_cmd = { .reserved1 = 0, }; - struct iwl_rate *table = link_cmd.rate_scale_table; + 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 */ - i = 0; if (is_ap) r = IWL_RATE_54M_INDEX; else if ((priv->phymode == MODE_IEEE80211A) || @@ -4395,21 +4394,22 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) else r = IWL_RATE_1M_INDEX; - while (i < LINK_QUAL_MAX_RETRY_NUM) { + for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { + rate_flags = 0; if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) - table[i].rate_n_flags |= RATE_MCS_CCK_MSK; + rate_flags |= RATE_MCS_CCK_MSK; - table[i].s.rate = iwl_rates[r].plcp; - table[i].rate_n_flags |= RATE_MCS_ANT_B_MSK; - table[i].rate_n_flags &= ~RATE_MCS_ANT_A_MSK; + 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); - i++; } link_cmd.general_params.single_stream_ant_msk = 2; link_cmd.general_params.dual_stream_ant_msk = 3; link_cmd.agg_params.agg_dis_start_th = 3; - link_cmd.agg_params.agg_time_limit = 4000; + link_cmd.agg_params.agg_time_limit = cpu_to_le16(4000); /* Update the rate scaling for control frame Tx to AP */ link_cmd.sta_id = is_ap ? IWL_AP_ID : IWL_BROADCAST_ID; diff --git a/drivers/net/wireless/iwl-commands.h b/drivers/net/wireless/iwl-commands.h index 1942c8c..2327ec3 100644 --- a/drivers/net/wireless/iwl-commands.h +++ b/drivers/net/wireless/iwl-commands.h @@ -214,17 +214,6 @@ struct iwl_rate { __le16 rate_n_flags; }; } __attribute__ ((packed)); -#elif IWL == 4965 -struct iwl_rate { - union { - struct { - u8 rate; - u8 flags; - __le16 ext_flags; - } s; - __le32 rate_n_flags; - }; -} __attribute__ ((packed)); #endif struct iwl_dram_scratch { -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 04/28] iwlwifi: Endianity fix for 4965 rx chain selection 2007-08-08 7:33 ` [PATCH 03/28] iwlwifi: Endianity fix for 4965 rate scaling Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 05/28] iwlwifi: optimize iwl_queue_{inc|dec}_wrap implementation Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Tomas Winkler, Gregory Greenman, Zhu Yi From: Tomas Winkler <tomas.winkler@intel.com> This patch fixes endianity for rx chain setting. Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-4965-hw.h | 14 +++++++------- drivers/net/wireless/iwl-base.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/iwl-4965-hw.h b/drivers/net/wireless/iwl-4965-hw.h index fc9f506..106f7c0 100644 --- a/drivers/net/wireless/iwl-4965-hw.h +++ b/drivers/net/wireless/iwl-4965-hw.h @@ -244,18 +244,18 @@ struct iwl_channel_switch_notif { #define RXON_FLG_CHANNEL_MODE_PURE_40_MSK 0x02000000 #define RXON_FLG_CHANNEL_MODE_MIXED_MSK 0x04000000 -#define RXON_RX_CHAIN_DRIVER_FORCE_MSK (0x1<<0) -#define RXON_RX_CHAIN_VALID_MSK (0x7<<1) +#define RXON_RX_CHAIN_DRIVER_FORCE_MSK __constant_cpu_to_le16(0x1<<0) +#define RXON_RX_CHAIN_VALID_MSK __constant_cpu_to_le16(0x7<<1) #define RXON_RX_CHAIN_VALID_POS (1) -#define RXON_RX_CHAIN_FORCE_SEL_MSK (0x7<<4) +#define RXON_RX_CHAIN_FORCE_SEL_MSK __constant_cpu_to_le16(0x7<<4) #define RXON_RX_CHAIN_FORCE_SEL_POS (4) -#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK (0x7<<7) +#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK __constant_cpu_to_le16(0x7<<7) #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) -#define RXON_RX_CHAIN_CNT_MSK (0x3<<10) +#define RXON_RX_CHAIN_CNT_MSK __constant_cpu_to_le16(0x3<<10) #define RXON_RX_CHAIN_CNT_POS (10) -#define RXON_RX_CHAIN_MIMO_CNT_MSK (0x3<<12) +#define RXON_RX_CHAIN_MIMO_CNT_MSK __constant_cpu_to_le16(0x3<<12) #define RXON_RX_CHAIN_MIMO_CNT_POS (12) -#define RXON_RX_CHAIN_MIMO_FORCE_MSK (0x1<<14) +#define RXON_RX_CHAIN_MIMO_FORCE_MSK __constant_cpu_to_le16(0x1<<14) #define RXON_RX_CHAIN_MIMO_FORCE_POS (14) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index d082a10..4d73b86 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -7135,9 +7135,9 @@ static void iwl_bg_request_scan(struct work_struct *data) * Avoid A (0x1) because of its off-channel reception on A-band. * MIMO is not used here, but value is required to make uCode happy. */ scan->rx_chain = RXON_RX_CHAIN_DRIVER_FORCE_MSK | - (0x7 << RXON_RX_CHAIN_VALID_POS) | + cpu_to_le16((0x7 << RXON_RX_CHAIN_VALID_POS) | (0x6 << RXON_RX_CHAIN_FORCE_SEL_POS) | - (0x7 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS); + (0x7 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS)); #endif if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 05/28] iwlwifi: optimize iwl_queue_{inc|dec}_wrap implementation 2007-08-08 7:33 ` [PATCH 04/28] iwlwifi: Endianity fix for 4965 rx chain selection Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 06/28] iwlwifi: use mask operation to replace '%' for index calculation Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi This patch optimizes implementation of iwl_queue_inc_wrap and iwl_queue_inc_wrap based on the fact the hardware queue is power-of-two size. We also add BUG_ON and BUILD_BUG_ON check for queue size against is_power_of_2 in case future hardwares break this rule. Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-base.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 4d73b86..becaeea 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -160,14 +160,16 @@ static int iwl_queue_space(const struct iwl_queue *q) return s; } +/* XXX: n_bd must be power-of-two size */ static inline int iwl_queue_inc_wrap(int index, int n_bd) { - return (++index == n_bd) ? 0 : index; + 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) { - return (index == 0) ? n_bd - 1 : index - 1; + return --index & (n_bd - 1); } static inline int x2_queue_used(const struct iwl_queue *q, int i) @@ -192,6 +194,10 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, 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. */ + BUG_ON(!is_power_of_2(count)); + q->low_mark = q->n_window / 4; if (q->low_mark < 4) q->low_mark = 4; @@ -266,9 +272,13 @@ int iwl_tx_queue_init(struct iwl_priv *priv, return -ENOMEM; } - 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. */ + 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); + iwl_hw_tx_queue_init(priv, txq); return 0; -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 06/28] iwlwifi: use mask operation to replace '%' for index calculation 2007-08-08 7:33 ` [PATCH 05/28] iwlwifi: optimize iwl_queue_{inc|dec}_wrap implementation Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 07/28] iwlwifi: make local functions static Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi This patch replaces index calculation with '%' to mask operation. Note, this is only applicable for power-of-two size. Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-4965.c | 2 +- drivers/net/wireless/iwl-base.c | 18 +++++++++++------- drivers/net/wireless/iwl-hw.h | 1 + drivers/net/wireless/iwlwifi.h | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index 58ea2a1..c93c607 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -2048,7 +2048,7 @@ static struct iwl_txpower_comp_entry { static s32 get_min_power_index(s32 rate_power_index, u32 band) { if (!band) { - if ((rate_power_index % 8) <= 4) + if ((rate_power_index & 7) <= 4) return MIN_TX_GAIN_INDEX_52GHZ_EXT; } return MIN_TX_GAIN_INDEX; diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index becaeea..18c4a23 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -184,7 +184,7 @@ static inline u8 get_next_cmd_index(struct iwl_queue *q, u32 index, int is_huge) if (is_huge) return q->n_window; - return (u8) (index % q->n_window); + return index & (q->n_window - 1); } static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, @@ -198,6 +198,10 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, * and iwl_queue_dec_wrap are broken. */ BUG_ON(!is_power_of_2(count)); + /* slots_num must be power-of-two size, otherwise + * get_next_cmd_index is broken. */ + BUG_ON(!is_power_of_2(slots_num)); + q->low_mark = q->n_window / 4; if (q->low_mark < 4) q->low_mark = 4; @@ -3247,7 +3251,7 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) struct list_head *p; struct iwl_ibss_seq *entry = NULL; u8 *mac = header->addr2; - int index = mac[5] % IWL_IBSS_MAC_HASH_SIZE; + int index = mac[5] & (IWL_IBSS_MAC_HASH_SIZE - 1); __list_for_each(p, &priv->ibss_mac_hash[index]) { entry = @@ -3325,8 +3329,8 @@ static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval) if (!interval || !usec) return 0; - quot = (usec / interval) % 0x100; - rem = (usec % interval) % BEACON_TIME_MASK_LOW; + quot = (usec / interval) & (BEACON_TIME_MASK_HIGH >> 24); + rem = (usec % interval) & BEACON_TIME_MASK_LOW; return (quot << 24) + rem; } @@ -4344,7 +4348,7 @@ int iwl_rx_queue_restock(struct iwl_priv *priv) rxq->bd[rxq->write] = iwl_dma_addr2rbd_ptr(priv, rxb->dma_addr); rxq->queue[rxq->write] = rxb; - rxq->write = (rxq->write + 1) % RX_QUEUE_SIZE; + rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; rxq->free_count--; } spin_unlock_irqrestore(&rxq->lock, flags); @@ -4647,7 +4651,7 @@ static void iwl_rx_handle(struct iwl_priv *priv) spin_lock_irqsave(&rxq->lock, flags); list_add_tail(&rxb->list, &priv->rxq.rx_used); spin_unlock_irqrestore(&rxq->lock, flags); - i = (i + 1) % RX_QUEUE_SIZE; + i = (i + 1) & RX_QUEUE_MASK; } /* Backtrack one entry */ @@ -8562,7 +8566,7 @@ static ssize_t show_rate(struct device *d, return sprintf(buf, "%d%s\n", (iwl_rates[i].ieee >> 1), - (iwl_rates[i].ieee % 2) ? ".5" : ""); + (iwl_rates[i].ieee & 0x1) ? ".5" : ""); } static DEVICE_ATTR(rate, S_IRUSR, show_rate, NULL); diff --git a/drivers/net/wireless/iwl-hw.h b/drivers/net/wireless/iwl-hw.h index 933a367..e01f29c 100644 --- a/drivers/net/wireless/iwl-hw.h +++ b/drivers/net/wireless/iwl-hw.h @@ -1076,6 +1076,7 @@ struct statistics { #define NUM_TFD_CHUNKS 4 #define RX_QUEUE_SIZE 256 +#define RX_QUEUE_MASK 255 #define RX_QUEUE_SIZE_LOG 8 /* diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h index 002f8e8..be94217 100644 --- a/drivers/net/wireless/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi.h @@ -528,7 +528,7 @@ struct iwl_ucode { u8 data[0]; /* data in same order as "size" elements */ }; -#define IWL_IBSS_MAC_HASH_SIZE 31 +#define IWL_IBSS_MAC_HASH_SIZE 32 struct iwl_ibss_seq { u8 mac[ETH_ALEN]; -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 07/28] iwlwifi: make local functions static 2007-08-08 7:33 ` [PATCH 06/28] iwlwifi: use mask operation to replace '%' for index calculation Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 08/28] iwlwifi: some coding styles cleanup Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-4965.c | 9 +++++---- drivers/net/wireless/iwl-base.c | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index c93c607..8175b48 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -4257,8 +4257,9 @@ 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 */ -int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, int tx_fifo, - int sta_id, int tid, u16 ssn_idx) +static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, + int tx_fifo, int sta_id, int tid, + u16 ssn_idx) { unsigned long flags; int rc; @@ -4315,8 +4316,8 @@ int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, int tx_fifo, /** * txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID */ -int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, - u16 ssn_idx, u8 tx_fifo) +static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, + u16 ssn_idx, u8 tx_fifo) { unsigned long flags; int rc; diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 18c4a23..e58dcfa 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -310,7 +310,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd)) iwl_hw_tx_queue_free_tfd(priv, txq); - len = sizeof(txq->cmd[0]) * q->n_window; + len = sizeof(struct iwl_cmd) * q->n_window; if (q->id == IWL_CMD_QUEUE_NUM); len += IWL_MAX_SCAN_SIZE; @@ -3549,7 +3549,7 @@ static inline u32 iwl_get_scd_ssn(struct iwl_tx_resp *tx_resp) return le32_to_cpu(*scd_ssn & MAX_SN); } -int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, +static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, struct iwl_ht_agg *agg, struct iwl_tx_resp *tx_resp, u16 start_idx) -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 08/28] iwlwifi: some coding styles cleanup 2007-08-08 7:33 ` [PATCH 07/28] iwlwifi: make local functions static Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 09/28] iwlwifi: replace unnecessary GFP_ATOMIC with GFP_KERNEL Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-base.c | 54 ++++++++++++++++----------------------- 1 files changed, 22 insertions(+), 32 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index e58dcfa..8f55f0d 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -901,15 +901,15 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) int counter = 1; if (rxon->flags & RXON_FLG_BAND_24G_MSK) { - error |= - le32_to_cpu(rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK); - error |= le32_to_cpu(rxon->flags & RXON_FLG_RADAR_DETECT_MSK); + error |= le32_to_cpu(rxon->flags & + (RXON_FLG_TGJ_NARROW_BAND_MSK | + RXON_FLG_RADAR_DETECT_MSK)); if (error) IWL_WARNING("check 24G fields %d | %d\n", counter++, error); } else { - error |= ((rxon->flags & RXON_FLG_SHORT_SLOT_MSK) != - RXON_FLG_SHORT_SLOT_MSK); + error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ? + 0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK); if (error) IWL_WARNING("check 52 fields %d | %d\n", counter++, error); @@ -917,7 +917,6 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) if (error) IWL_WARNING("check 52 CCK %d | %d\n", counter++, error); - } error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1; if (error) @@ -925,7 +924,7 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) /* make sure basic rates 6Mbps and 1Mbps are supported */ error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) && - ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0)); + ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0)); if (error) IWL_WARNING("check basic rate %d | %d\n", counter++, error); @@ -933,43 +932,39 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon) if (error) IWL_WARNING("check assoc id %d | %d\n", counter++, error); - error |= ((rxon->flags & - (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) == - (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)); + error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) + == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)); if (error) IWL_WARNING("check CCK and short slot %d | %d\n", counter++, error); error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) - == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)); + == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)); if (error) IWL_WARNING("check CCK & auto detect %d | %d\n", counter++, error); - error |= ((rxon->flags & - (RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK)) == - RXON_FLG_TGG_PROTECT_MSK); + error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | + RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK); if (error) - IWL_WARNING("check TGG %d | %d\n", counter++, error); + IWL_WARNING("check TGG and auto detect %d | %d\n", + counter++, error); #if IWL == 3945 if ((rxon->flags & RXON_FLG_DIS_DIV_MSK)) - error |= ((rxon->flags & - (RXON_FLG_ANT_B_MSK | RXON_FLG_ANT_A_MSK)) == 0); + error |= ((rxon->flags & (RXON_FLG_ANT_B_MSK | + RXON_FLG_ANT_A_MSK)) == 0); if (error) IWL_WARNING("check antenna %d %d\n", counter++, error); #endif - if (error) IWL_WARNING("Tuning to channel %d\n", le16_to_cpu(rxon->channel)); if (error) { - IWL_ERROR - ("Error not a valid iwl_rxon_assoc_cmd field values\n"); + IWL_ERROR("Not a valid iwl_rxon_assoc_cmd field values\n"); return -1; } - return 0; } @@ -1512,7 +1507,7 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv) frame = iwl_get_free_frame(priv); if (!frame) { - IWL_ERROR("Coult not obtain free frame buffer for beacon " + IWL_ERROR("Could not obtain free frame buffer for beacon " "command.\n"); return -ENOMEM; } @@ -1642,9 +1637,6 @@ void iwl_report_frame(struct iwl_priv *priv, u32 print_dump = 0; /* set to 1 to dump all frames' contents */ u32 hundred = 0; u32 dataframe = 0; - - /* these are declared without "=" to avoid compiler warnings if we - * don't use them in the debug messages below */ u16 frame_ctl; u16 seq_ctl; u16 channel; @@ -1659,7 +1651,6 @@ 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); @@ -2325,12 +2316,10 @@ static int iwl_scan_cancel(struct iwl_priv *priv, unsigned long ms) } else IWL_DEBUG_SCAN("Scan abort already in progress.\n"); - mutex_unlock(&priv->mutex); if (ms) - while (!time_after(jiffies, - now + msecs_to_jiffies(ms)) && - priv->status & STATUS_SCANNING) + while (!time_after(jiffies, now + msecs_to_jiffies(ms)) + && priv->status & STATUS_SCANNING) msleep(1); mutex_lock(&priv->mutex); @@ -3914,8 +3903,9 @@ static void iwl_rx_reply_scan(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { struct iwl_rx_packet *pkt = (void *)rxb->skb->data; - struct iwl_scanreq_notification *notif = - (struct iwl_scanreq_notification *)pkt->u.raw; + struct iwl_scanstart_notification *notif = + (struct iwl_scanstart_notification *)pkt->u.raw; + IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status); } -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 09/28] iwlwifi: replace unnecessary GFP_ATOMIC with GFP_KERNEL 2007-08-08 7:33 ` [PATCH 08/28] iwlwifi: some coding styles cleanup Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 10/28] iwlwifi: remove priv stuff zeroing in iwl_pci_probe Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-base.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 8f55f0d..ca4edd2 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -222,7 +222,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, if (id != IWL_CMD_QUEUE_NUM) { txq->txb = kmalloc(sizeof(txq->txb[0]) * - TFD_QUEUE_SIZE_MAX, GFP_ATOMIC); + TFD_QUEUE_SIZE_MAX, GFP_KERNEL); if (!txq->txb) { IWL_ERROR("kmalloc for auxilary BD " "structures failed\n"); @@ -1460,7 +1460,7 @@ static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv) struct iwl_frame *frame; struct list_head *element; if (list_empty(&priv->free_frames)) { - frame = kzalloc(sizeof(*frame), GFP_ATOMIC); + frame = kzalloc(sizeof(*frame), GFP_KERNEL); if (!frame) { IWL_ERROR("Could not allocate frame!\n"); return NULL; @@ -5706,19 +5706,19 @@ static int iwl_init_geos(struct iwl_priv *priv) } modes = kzalloc(sizeof(struct ieee80211_hw_mode) * mode_count, - GFP_ATOMIC); + GFP_KERNEL); if (!modes) return -ENOMEM; channels = kzalloc(sizeof(struct ieee80211_channel) * - priv->channel_count, GFP_ATOMIC); + priv->channel_count, GFP_KERNEL); if (!channels) { kfree(modes); return -ENOMEM; } rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_MAX_RATES + 1)), - GFP_ATOMIC); + GFP_KERNEL); if (!rates) { kfree(modes); kfree(channels); @@ -7014,7 +7014,7 @@ static void iwl_bg_request_scan(struct work_struct *data) if (!priv->scan) { priv->scan = kmalloc(sizeof(struct iwl_scan_cmd) + - IWL_MAX_SCAN_SIZE, GFP_ATOMIC); + IWL_MAX_SCAN_SIZE, GFP_KERNEL); if (!priv->scan) { rc = -ENOMEM; goto done; -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 10/28] iwlwifi: remove priv stuff zeroing in iwl_pci_probe 2007-08-08 7:33 ` [PATCH 09/28] iwlwifi: replace unnecessary GFP_ATOMIC with GFP_KERNEL Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 11/28] iwlwifi: add name for some PCI configuration space registers Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Remove priv stuff zeroing in iwl_pci_probe() since priv is already zeroed by ieee80211_alloc_hw(). Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-base.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index ca4edd2..e419391 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -9045,9 +9045,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) iwl_clear_stations_table(priv); - memset(&(priv->txq[0]), 0, - sizeof(struct iwl_tx_queue) * IWL_MAX_NUM_QUEUES); - memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp)); priv->data_retry_limit = -1; priv->ieee_channels = NULL; priv->ieee_rates = NULL; @@ -9138,7 +9135,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } #ifdef CONFIG_IWLWIFI_QOS - memset(&priv->qos_data, 0, sizeof(struct iwl_qos_info)); if (iwl_param_qos_enable) priv->qos_data.qos_enable = 1; priv->qos_data.qos_active = 0; -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 11/28] iwlwifi: add name for some PCI configuration space registers 2007-08-08 7:33 ` [PATCH 10/28] iwlwifi: remove priv stuff zeroing in iwl_pci_probe Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 12/28] iwlwifi: shorten some structure and function names Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-3945.c | 3 ++- drivers/net/wireless/iwl-4965.c | 8 +++++--- drivers/net/wireless/iwl-hw.h | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c index 8e78ad5..50c21aa 100644 --- a/drivers/net/wireless/iwl-3945.c +++ b/drivers/net/wireless/iwl-3945.c @@ -721,7 +721,8 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) if (!pwr_max) { u32 val; - rc = pci_read_config_dword(priv->pci_dev, 0x0C8, &val); + 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, ALM_APMG_PS_CTL, diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index 8175b48..d334951 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -203,7 +203,8 @@ static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) if (!pwr_max) { u32 val; - rc = pci_read_config_dword(priv->pci_dev, 0x0C8, &val); + 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( @@ -476,9 +477,10 @@ int iwl_hw_nic_init(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); if ((rev_id & 0x80) == 0x80 && (rev_id & 0x7f) < 8) { - pci_read_config_dword(priv->pci_dev, 0xe8, &val); + pci_read_config_dword(priv->pci_dev, PCI_REG_WUM8, &val); /* Enable No Snoop field */ - pci_write_config_dword(priv->pci_dev, 0xe8, val & ~(1 << 11)); + pci_write_config_dword(priv->pci_dev, PCI_REG_WUM8, + val & ~(1 << 11)); } spin_unlock_irqrestore(&priv->lock, flags); diff --git a/drivers/net/wireless/iwl-hw.h b/drivers/net/wireless/iwl-hw.h index e01f29c..f371794 100644 --- a/drivers/net/wireless/iwl-hw.h +++ b/drivers/net/wireless/iwl-hw.h @@ -179,6 +179,8 @@ struct iwl_error_resp { } __attribute__ ((packed)); #define PCI_LINK_CTRL 0x0F0 +#define PCI_POWER_SOURCE 0x0C8 +#define PCI_REG_WUM8 0x0E8 /* * Rx config defines & structure -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 12/28] iwlwifi: shorten some structure and function names 2007-08-08 7:33 ` [PATCH 11/28] iwlwifi: add name for some PCI configuration space registers Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 13/28] iwlwifi: define iwl_rx_reply_scan only when CONFIG_IWLWIFI_DEBUG enabled Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-3945.c | 1 - drivers/net/wireless/iwl-4965.c | 79 +++++++++++++------------------------ drivers/net/wireless/iwl-base.c | 10 +---- drivers/net/wireless/iwl-eeprom.h | 15 +++---- drivers/net/wireless/iwl-io.h | 10 ++--- 5 files changed, 41 insertions(+), 74 deletions(-) diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c index 50c21aa..c4441db 100644 --- a/drivers/net/wireless/iwl-3945.c +++ b/drivers/net/wireless/iwl-3945.c @@ -307,7 +307,6 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, .rate = rx_hdr->rate, .flag = 0, }; - u8 network_packet; int snr; diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index d334951..0cbe798 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -660,10 +660,6 @@ int iwl_hw_nic_reset(struct iwl_priv *priv) iwl_release_restricted_access(priv); } - spin_unlock_irqrestore(&priv->lock, flags); - - spin_lock_irqsave(&priv->lock, flags); - priv->status &= ~STATUS_HCMD_ACTIVE; wake_up_interruptible(&priv->wait_command_queue); @@ -1894,7 +1890,7 @@ iwl4965_get_channel_txpower_info(struct iwl_priv *priv, u8 phymode, u8 channel) return ch_info; } -static s32 iwl4965_get_txatten_group_from_channel(u32 channel) +static s32 iwl4965_get_tx_atten_grp(u32 channel) { if (channel >= CALIB_IWL_TX_ATTEN_GR5_FCH && channel <= CALIB_IWL_TX_ATTEN_GR5_LCH) @@ -1922,22 +1918,18 @@ static s32 iwl4965_get_txatten_group_from_channel(u32 channel) static u32 iwl4965_get_sub_band(const struct iwl_priv *priv, u32 channel) { - s32 sub_band = -1; + s32 b = -1; - for (sub_band = 0; sub_band < EEPROM_TX_POWER_BANDS; sub_band++) { - - if (priv->eeprom.calib_info.band_info_tbl[sub_band].ch_from == - 0) + for (b = 0; b < EEPROM_TX_POWER_BANDS; b++) { + if (priv->eeprom.calib_info.band_info[b].ch_from == 0) continue; - if ((channel >= - priv->eeprom.calib_info.band_info_tbl[sub_band].ch_from) - && (channel <= - priv->eeprom.calib_info.band_info_tbl[sub_band].ch_to)) + if ((channel >= priv->eeprom.calib_info.band_info[b].ch_from) + && (channel <= priv->eeprom.calib_info.band_info[b].ch_to)) break; } - return sub_band; + return b; } static s32 iwl4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2) @@ -1952,16 +1944,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_channel_info *chan_info) +static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel, + struct iwl_eeprom_calib_ch_info *chan_info) { s32 s = -1; u32 c; u32 m; - const struct iwl_eeprom_calib_measurement *m1; - const struct iwl_eeprom_calib_measurement *m2; - struct iwl_eeprom_calib_measurement *omeas; + const struct iwl_eeprom_calib_measure *m1; + const struct iwl_eeprom_calib_measure *m2; + struct iwl_eeprom_calib_measure *omeas; u32 ch_i1; u32 ch_i2; @@ -1971,8 +1962,8 @@ static int iwl4965_interpolate_chan( return -1; } - ch_i1 = priv->eeprom.calib_info.band_info_tbl[s].ch1.ch_num; - ch_i2 = priv->eeprom.calib_info.band_info_tbl[s].ch2.ch_num; + ch_i1 = priv->eeprom.calib_info.band_info[s].ch1.ch_num; + ch_i2 = priv->eeprom.calib_info.band_info[s].ch2.ch_num; chan_info->ch_num = (u8) channel; IWL_DEBUG_TXPOWER("channel %d subband %d factory cal ch %d & %d\n", @@ -1980,9 +1971,9 @@ static int iwl4965_interpolate_chan( for (c = 0; c < EEPROM_TX_POWER_TX_CHAINS; c++) { for (m = 0; m < EEPROM_TX_POWER_MEASUREMENTS; m++) { - m1 = &(priv->eeprom.calib_info.band_info_tbl[s].ch1. + m1 = &(priv->eeprom.calib_info.band_info[s].ch1. measurements[c][m]); - m2 = &(priv->eeprom.calib_info.band_info_tbl[s].ch2. + m2 = &(priv->eeprom.calib_info.band_info[s].ch2. measurements[c][m]); omeas = &(chan_info->measurements[c][m]); @@ -2299,12 +2290,12 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u8 channel, s32 current_temp; s32 reg_limit; s32 current_regulatory; - s32 txatten_group = CALIB_CH_GROUP_MAX; + s32 txatten_grp = CALIB_CH_GROUP_MAX; int i = 0; int c; const struct iwl_channel_info *ch_info = NULL; - struct iwl_eeprom_calib_channel_info ch_eeprom_info; - const struct iwl_eeprom_calib_measurement *measurement; + struct iwl_eeprom_calib_ch_info ch_eeprom_info; + const struct iwl_eeprom_calib_measure *measurement; s16 voltage; s32 init_voltage; s32 voltage_compensation; @@ -2344,12 +2335,12 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u8 channel, /* get txatten group, used to select 1) thermal txpower adjustment * and 2) mimo txpower balance between Tx chains. */ - txatten_group = iwl4965_get_txatten_group_from_channel(channel); - if (txatten_group < 0) + txatten_grp = iwl4965_get_tx_atten_grp(channel); + if (txatten_grp < 0) return -EINVAL; IWL_DEBUG_TXPOWER("channel %d belongs to txatten group %d\n", - channel, txatten_group); + channel, txatten_grp); if (is_fat) { if (ctrl_chan_high) @@ -2407,18 +2398,12 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u8 channel, current_temp = min(priv->temperature, IWL_TX_POWER_TEMPERATURE_MAX); current_temp = KELVIN_TO_CELSIUS(current_temp); - if (-40 > current_temp) { - IWL_WARNING("Invalid temperature %d, can't calculate " - "txpower\n", current_temp); - return -EINVAL; - } - /* select thermal txpower adjustment params, based on channel group * (same frequency group used for mimo txatten adjustment) */ degrees_per_05db_num = - tx_power_cmp_tble[txatten_group].degrees_per_05db_a; + tx_power_cmp_tble[txatten_grp].degrees_per_05db_a; degrees_per_05db_denom = - tx_power_cmp_tble[txatten_group].degrees_per_05db_a_denom; + tx_power_cmp_tble[txatten_grp].degrees_per_05db_a_denom; /* get per-chain txpower values from factory measurements */ for (c = 0; c < 2; c++) { @@ -2486,7 +2471,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u8 channel, if (is_mimo_rate) atten_value = priv->card_alive_init. - tx_atten[txatten_group][c]; + tx_atten[txatten_grp][c]; else atten_value = 0; @@ -2765,11 +2750,6 @@ int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) return 0; } -static inline u32 iwl4965_get_dma_lo_address(dma_addr_t addr) -{ - return (u32) (addr & 0xffffffff); -} - static inline u8 iwl4965_get_dma_hi_address(dma_addr_t addr) { return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0; @@ -2792,8 +2772,7 @@ int iwl_hw_tx_queue_attach_buffer_to_tfd(struct iwl_priv *priv, is_odd = num_tbs & 0x1; if (!is_odd) { - tfd->pa[index].tb1_addr = cpu_to_le32( - iwl4965_get_dma_lo_address(addr)); + tfd->pa[index].tb1_addr = cpu_to_le32(addr); IWL_SET_BITS(tfd->pa[index], tb1_addr_hi, iwl4965_get_dma_hi_address(addr)); IWL_SET_BITS(tfd->pa[index], tb1_len, len); @@ -3281,8 +3260,7 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + offsetof(struct iwl_tx_cmd, scratch); - tx->dram_lsb_ptr = cpu_to_le32( - iwl4965_get_dma_lo_address(scratch_phys)); + tx->dram_lsb_ptr = cpu_to_le32(scratch_phys); tx->dram_msb_ptr = iwl4965_get_dma_hi_address(scratch_phys); /* Hard coded to start at the highest retry fallback position @@ -3802,7 +3780,6 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) { struct iwl_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. */ @@ -3810,7 +3787,6 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, struct iwl4965_rx_phy_res *rx_start = (include_phy) ? (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1]; - __le32 *rx_end; unsigned int len = 0; struct ieee80211_hdr *header; @@ -4098,6 +4074,7 @@ static void iwl4965_set_tx_status(struct iwl_priv *priv, int txq_id, int idx, { struct ieee80211_tx_status *tx_status = &(priv->txq[txq_id].txb[idx].status); + tx_status->flags = status?IEEE80211_TX_STATUS_ACK:0; tx_status->retry_count += retry_count; tx_status->control.tx_rate = rate; diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index e419391..dad9649 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -4296,8 +4296,8 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q) if (rc) goto exit_unlock; - iwl_write_restricted(priv, - FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); + iwl_write_restricted(priv, FH_RSCSR_CHNL0_WPTR, + q->write & ~0x7); iwl_release_restricted_access(priv); } else iwl_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7); @@ -6745,11 +6745,7 @@ void iwl_down(struct iwl_priv *priv) udelay(5); iwl_hw_nic_stop_master(priv); - - spin_lock_irqsave(&priv->lock, flags); iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); - spin_unlock_irqrestore(&priv->lock, flags); - iwl_hw_nic_reset(priv); exit: @@ -9328,9 +9324,7 @@ 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); - spin_unlock_irqrestore(&priv->lock, flags); - spin_lock_irqsave(&priv->lock, flags); if (!iwl_grab_restricted_access(priv)) { iwl_write_restricted_reg(priv, ALM_APMG_CLK_DIS, APMG_CLK_REG_VAL_DMA_CLK_RQT); diff --git a/drivers/net/wireless/iwl-eeprom.h b/drivers/net/wireless/iwl-eeprom.h index 19d7028..c6b0faa 100644 --- a/drivers/net/wireless/iwl-eeprom.h +++ b/drivers/net/wireless/iwl-eeprom.h @@ -187,32 +187,31 @@ struct iwl_eeprom_temperature_corr { #define EEPROM_TX_POWER_VERSION (2) #define EEPROM_TX_POWER_VERSION_NEW (5) -struct iwl_eeprom_calib_measurement { +struct iwl_eeprom_calib_measure { u8 temperature; u8 gain_idx; u8 actual_pow; s8 pa_det; } __attribute__ ((packed)); -struct iwl_eeprom_calib_channel_info { +struct iwl_eeprom_calib_ch_info { u8 ch_num; - struct iwl_eeprom_calib_measurement - measurements[EEPROM_TX_POWER_TX_CHAINS][EEPROM_TX_POWER_MEASUREMENTS]; + 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_channel_info ch1; - struct iwl_eeprom_calib_channel_info ch2; + 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; __le16 voltage; /* signed */ - struct iwl_eeprom_calib_subband_info - band_info_tbl[EEPROM_TX_POWER_BANDS]; + struct iwl_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS]; } __attribute__ ((packed)); #endif diff --git a/drivers/net/wireless/iwl-io.h b/drivers/net/wireless/iwl-io.h index 0ae031a..3f8cb06 100644 --- a/drivers/net/wireless/iwl-io.h +++ b/drivers/net/wireless/iwl-io.h @@ -415,18 +415,16 @@ static inline void iwl_write_restricted_mem(struct iwl_priv *priv, u32 addr, iwl_write_restricted(priv, HBUS_TARG_MEM_WDAT, val); } -static inline void iwl_write_restricted_mem_buffer(struct iwl_priv *priv, - u32 addr, u32 len, - u32 *values) +static inline void iwl_write_restricted_mems(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++) iwl_write_restricted(priv, HBUS_TARG_MEM_WDAT, *values); } -static inline void iwl_write_restricted_reg_buffer(struct iwl_priv *priv, - u32 reg, u32 len, - u8 *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; -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 13/28] iwlwifi: define iwl_rx_reply_scan only when CONFIG_IWLWIFI_DEBUG enabled 2007-08-08 7:33 ` [PATCH 12/28] iwlwifi: shorten some structure and function names Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 14/28] iwlwifi: remove redundant quotes Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-base.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index dad9649..8863953 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -3902,11 +3902,13 @@ 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 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl_scanstart_notification *notif = (struct iwl_scanstart_notification *)pkt->u.raw; IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status); +#endif } static void iwl_rx_scan_start_notif(struct iwl_priv *priv, -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 14/28] iwlwifi: remove redundant quotes 2007-08-08 7:33 ` [PATCH 13/28] iwlwifi: define iwl_rx_reply_scan only when CONFIG_IWLWIFI_DEBUG enabled Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 15/28] iwlwifi: Endianity fix for rxon host commands Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Ian Schram, Zhu Yi From: Ian Schram <ischram@telenet.be> Remove some redundant quotes that probably originated from moving code around. Signed-of-by: Ian Schram <ischram@telenet.be> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-base.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 8863953..25931f5 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -1326,7 +1326,7 @@ static int iwl_add_sta_sync_callback(struct iwl_priv *priv, struct iwl_rx_packet *res = NULL; if (!skb) { - IWL_ERROR("Error: Response NULL in " "REPLY_ADD_STA.\n"); + IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n"); return 1; } @@ -2589,8 +2589,8 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode) cancel_delayed_work(&priv->scan_check); priv->status &= ~STATUS_SCAN_PENDING; if (iwl_scan_cancel(priv, 100)) { - IWL_WARNING("Aborted scan still in progress " "after 100ms\n"); - IWL_DEBUG_MAC80211("leaving - scan abort " "failed.\n"); + IWL_WARNING("Aborted scan still in progress after 100ms\n"); + IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); return -EAGAIN; } @@ -7624,7 +7624,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id, if (iwl_scan_cancel(priv, 100)) { IWL_WARNING("Aborted scan still in progress " "after 100ms\n"); - IWL_DEBUG_MAC80211("leaving - scan abort " "failed.\n"); + IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); mutex_unlock(&priv->mutex); return -EAGAIN; } -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 15/28] iwlwifi: Endianity fix for rxon host commands 2007-08-08 7:33 ` [PATCH 14/28] iwlwifi: remove redundant quotes Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 16/28] iwlwifi: Endianity fix for beacon host command Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Tomas Winkler, Gregory Greenman, Zhu Yi From: Tomas Winkler <tomas.winkler@intel.com> This patch fixes left over endianity issues in rxon host command. Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-4965-hw.h | 21 +++++++++++---------- drivers/net/wireless/iwl-4965.c | 10 ++++++---- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/iwl-4965-hw.h b/drivers/net/wireless/iwl-4965-hw.h index 106f7c0..bb814cf 100644 --- a/drivers/net/wireless/iwl-4965-hw.h +++ b/drivers/net/wireless/iwl-4965-hw.h @@ -229,20 +229,21 @@ struct iwl_channel_switch_notif { /********************* END TXPOWER *****************************************/ /* HT flags */ -#define RXON_FLG_CONTROL_CHANNEL_LOCATION_MSK 0x400000 -#define RXON_FLG_CONTROL_CHANNEL_LOC_LOW_MSK 0x000000 -#define RXON_FLG_CONTROL_CHANNEL_LOC_HIGH_MSK 0x400000 +#define RXON_FLG_CONTROL_CHANNEL_LOCATION_POS (22) +#define RXON_FLG_CONTROL_CHANNEL_LOCATION_MSK __constant_cpu_to_le32(0x1<<22) +#define RXON_FLG_CONTROL_CHANNEL_LOC_LOW_MSK __constant_cpu_to_le32(0x0<<22) +#define RXON_FLG_CONTROL_CHANNEL_LOC_HIGH_MSK __constant_cpu_to_le32(0x1<<22) #define RXON_FLG_HT_OPERATING_MODE_POS (23) -/*yshevet - bug fix */ -#define RXON_FLG_HT_PROT_MSK 0x800000 -#define RXON_FLG_FAT_PROT_MSK 0x1000000 + +#define RXON_FLG_HT_PROT_MSK __constant_cpu_to_le32(0x1<<23) +#define RXON_FLG_FAT_PROT_MSK __constant_cpu_to_le32(0x2<<23) #define RXON_FLG_CHANNEL_MODE_POS (25) -#define RXON_FLG_CHANNEL_MODE_MSK 0x06000000 -#define RXON_FLG_CHANNEL_MODE_LEGACY_MSK 0x00000000 -#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK 0x02000000 -#define RXON_FLG_CHANNEL_MODE_MIXED_MSK 0x04000000 +#define RXON_FLG_CHANNEL_MODE_MSK __constant_cpu_to_le32(0x3<<25) +#define RXON_FLG_CHANNEL_MODE_LEGACY_MSK __constant_cpu_to_le32(0x0<<25) +#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK __constant_cpu_to_le32(0x1<<25) +#define RXON_FLG_CHANNEL_MODE_MIXED_MSK __constant_cpu_to_le32(0x2<<25) #define RXON_RX_CHAIN_DRIVER_FORCE_MSK __constant_cpu_to_le16(0x1<<0) #define RXON_RX_CHAIN_VALID_MSK __constant_cpu_to_le16(0x7<<1) diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index 0cbe798..5999be5 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -79,7 +79,7 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { IWL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */ }; -static int is_fat_channel(u32 rxon_flags) +static int is_fat_channel(__le32 rxon_flags) { return (rxon_flags & RXON_FLG_CHANNEL_MODE_PURE_40_MSK) || (rxon_flags & RXON_FLG_CHANNEL_MODE_MIXED_MSK); @@ -2859,12 +2859,14 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv) * Just after first association, iwl4965_noise_calibration() * checks which antennas actually *are* connected. */ priv->staging_rxon.rx_chain |= - (priv->valid_antenna << RXON_RX_CHAIN_VALID_POS); + cpu_to_le16(priv->valid_antenna << RXON_RX_CHAIN_VALID_POS); /* How many receivers should we use? */ iwl4965_get_rx_chain_counter(priv, &idle_state, &rx_state); - priv->staging_rxon.rx_chain |= (rx_state << RXON_RX_CHAIN_MIMO_CNT_POS); - priv->staging_rxon.rx_chain |= (idle_state << RXON_RX_CHAIN_CNT_POS); + priv->staging_rxon.rx_chain |= + cpu_to_le16(rx_state << RXON_RX_CHAIN_MIMO_CNT_POS); + priv->staging_rxon.rx_chain |= + cpu_to_le16(idle_state << RXON_RX_CHAIN_CNT_POS); if (!is_single && !(priv->status & STATUS_POWER_PMI) && (rx_state >= 2)) priv->staging_rxon.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 16/28] iwlwifi: Endianity fix for beacon host command 2007-08-08 7:33 ` [PATCH 15/28] iwlwifi: Endianity fix for rxon host commands Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 17/28] iwlwifi: Endianity fix for channel number Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Tomas Winkler, Gregory Greenman, Zhu Yi From: Tomas Winkler <tomas.winkler@intel.com> This patch fixes endianity issues in beacon host command Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-3945.c | 9 +++++---- drivers/net/wireless/iwl-4965.c | 9 +++++---- drivers/net/wireless/iwl-base.c | 8 +++++--- drivers/net/wireless/iwlwifi.h | 8 ++++---- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c index c4441db..d209873 100644 --- a/drivers/net/wireless/iwl-3945.c +++ b/drivers/net/wireless/iwl-3945.c @@ -2232,24 +2232,25 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv) return 0; } -int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, +unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, struct iwl_frame *frame, u8 rate) { struct iwl_tx_beacon_cmd *tx_beacon_cmd; - int frame_size; + unsigned int frame_size; tx_beacon_cmd = (struct iwl_tx_beacon_cmd *)&frame->u; memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); tx_beacon_cmd->tx.sta_id = IWL_BROADCAST_ID; - tx_beacon_cmd->tx.stop_time.life_time = 0xFFFFFFFF; + tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; frame_size = iwl_fill_beacon_frame(priv, tx_beacon_cmd->frame, BROADCAST_ADDR, sizeof(frame->u) - sizeof(*tx_beacon_cmd)); - tx_beacon_cmd->tx.len = frame_size; + BUG_ON(frame_size > MAX_MPDU_SIZE); + tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); tx_beacon_cmd->tx.rate = rate; tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index 5999be5..e907f06 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -2695,24 +2695,25 @@ int iwl_hw_get_temperature(struct iwl_priv *priv) return priv->temperature; } -int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, +unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, struct iwl_frame *frame, u8 rate) { struct iwl_tx_beacon_cmd *tx_beacon_cmd; - int frame_size; + unsigned int frame_size; tx_beacon_cmd = &frame->u.beacon; memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); tx_beacon_cmd->tx.sta_id = IWL_BROADCAST_ID; - tx_beacon_cmd->tx.stop_time.life_time = 0xFFFFFFFF; + tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; frame_size = iwl_fill_beacon_frame(priv, tx_beacon_cmd->frame, BROADCAST_ADDR, sizeof(frame->u) - sizeof(*tx_beacon_cmd)); - tx_beacon_cmd->tx.len = frame_size; + BUG_ON(frame_size > MAX_MPDU_SIZE); + tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP)) tx_beacon_cmd->tx.rate_n_flags = diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 25931f5..8f19494 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -1481,8 +1481,9 @@ static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) list_add(&frame->list, &priv->free_frames); } -int iwl_fill_beacon_frame(struct iwl_priv *priv, struct ieee80211_hdr *hdr, - const u8 *dest, int left) +unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, + struct ieee80211_hdr *hdr, + const u8 *dest, int left) { if (!iwl_is_associated(priv) || !priv->ibss_beacon || @@ -1501,7 +1502,8 @@ int iwl_fill_beacon_frame(struct iwl_priv *priv, struct ieee80211_hdr *hdr, static int iwl_send_beacon_cmd(struct iwl_priv *priv) { struct iwl_frame *frame; - int frame_size, rc; + unsigned int frame_size; + int rc; u8 rate; frame = iwl_get_free_frame(priv); diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h index be94217..6fea9a4 100644 --- a/drivers/net/wireless/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi.h @@ -630,9 +630,9 @@ 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 int iwl_fill_beacon_frame(struct iwl_priv *priv, - struct ieee80211_hdr *hdr, const u8 *dest, - int left); +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); @@ -692,7 +692,7 @@ extern int iwl_tx_queue_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); extern int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq); -extern int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, +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, -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 17/28] iwlwifi: Endianity fix for channel number 2007-08-08 7:33 ` [PATCH 16/28] iwlwifi: Endianity fix for beacon host command Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 18/28] iwlwifi: shorten more function names Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Tomas Winkler, Zhu Yi From: Tomas Winkler <tomas.winkler@intel.com> This patch fixes endinaity issue for channel number. It tries to introduce some more consistency in channel number type (u16). Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-3945.c | 4 +--- drivers/net/wireless/iwl-4965.c | 22 ++++++++++------------ drivers/net/wireless/iwl-4965.h | 4 ++-- drivers/net/wireless/iwl-base.c | 4 ++-- drivers/net/wireless/iwl-channel.h | 2 +- drivers/net/wireless/iwlwifi.h | 2 +- 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c index d209873..a9a1921 100644 --- a/drivers/net/wireless/iwl-3945.c +++ b/drivers/net/wireless/iwl-3945.c @@ -1695,7 +1695,6 @@ int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) { struct iwl_channel_info *ch_info; s8 max_power; - u8 channel; u8 a_band; u8 i; @@ -1713,7 +1712,6 @@ int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) for (i = 0; i < priv->channel_count; i++) { ch_info = &priv->channel_info[i]; a_band = is_channel_a_band(ch_info); - channel = ch_info->channel; /* find minimum power of all user and regulatory constraints * (does not consider h/w clipping limitations) */ @@ -1736,7 +1734,7 @@ int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) } /* will add 3945 channel switch cmd handling later */ -int iwl_hw_channel_switch(struct iwl_priv *priv, u8 channel) +int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel) { return 0; } diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index e907f06..a3e6603 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -298,7 +298,7 @@ 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, int channel, +int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel, const struct iwl_eeprom_channel *eeprom_ch, u8 fat_extension_channel) { @@ -1878,7 +1878,7 @@ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage, } static const struct iwl_channel_info * -iwl4965_get_channel_txpower_info(struct iwl_priv *priv, u8 phymode, u8 channel) +iwl4965_get_channel_txpower_info(struct iwl_priv *priv, u8 phymode, u16 channel) { const struct iwl_channel_info *ch_info; @@ -1890,7 +1890,7 @@ iwl4965_get_channel_txpower_info(struct iwl_priv *priv, u8 phymode, u8 channel) return ch_info; } -static s32 iwl4965_get_tx_atten_grp(u32 channel) +static s32 iwl4965_get_tx_atten_grp(u16 channel) { if (channel >= CALIB_IWL_TX_ATTEN_GR5_FCH && channel <= CALIB_IWL_TX_ATTEN_GR5_LCH) @@ -2277,7 +2277,7 @@ static const struct gain_entry gain_table[2][108] = { } }; -static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u8 channel, +static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, u8 is_fat, u8 ctrl_chan_high, struct iwl_tx_power_db *tx_power_tbl) { @@ -2549,7 +2549,6 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) struct iwl_tx_power_table_cmd cmd = { 0 }; int rc = 0; u8 band = 0; - u8 channel = 0; u8 is_fat = 0; u8 ctrl_chan_high = 0; @@ -2565,8 +2564,6 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) (priv->phymode == MODE_IEEE80211G) || (priv->phymode == MODE_ATHEROS_TURBOG)) ? 1 : 0; - channel = priv->active_rxon.channel; - is_fat = is_fat_channel(priv->active_rxon.flags); if (is_fat && @@ -2574,11 +2571,12 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) ctrl_chan_high = 1; cmd.band = band; - cmd.channel = channel; + cmd.channel = priv->active_rxon.channel; cmd.channel_normal_width = 0; - rc = iwl4965_fill_txpower_tbl(priv, band, channel, is_fat, - ctrl_chan_high, &cmd.tx_power); + rc = iwl4965_fill_txpower_tbl(priv, band, + le32_to_cpu(priv->active_rxon.channel), + is_fat, ctrl_chan_high, &cmd.tx_power); if (rc) return rc; @@ -2586,7 +2584,7 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) return rc; } -int iwl_hw_channel_switch(struct iwl_priv *priv, u8 channel) +int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel) { int rc; u8 band = 0; @@ -4404,7 +4402,7 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) #ifdef CONFIG_IWLWIFI_HT static u8 iwl_is_channel_extension(struct iwl_priv *priv, int phymode, - int channel, u8 extension_chan_offset) + u16 channel, u8 extension_chan_offset) { const struct iwl_channel_info *ch_info; diff --git a/drivers/net/wireless/iwl-4965.h b/drivers/net/wireless/iwl-4965.h index db4a02e..5a3266f 100644 --- a/drivers/net/wireless/iwl-4965.h +++ b/drivers/net/wireless/iwl-4965.h @@ -63,7 +63,7 @@ static inline void iwl4965_chain_noise_reset(struct iwl_priv *priv) {} static inline void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force) {} static inline int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, - int channel, + u16 channel, const struct iwl_eeprom_channel *eeprom_ch, u8 fat_extension_channel) { return 0; } static inline void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) {} @@ -98,7 +98,7 @@ extern void iwl4965_chain_noise_reset(struct iwl_priv *priv); extern void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force); extern int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, - int channel, + u16 channel, const struct iwl_eeprom_channel *eeprom_ch, u8 fat_extension_channel); extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv); diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 8f19494..3b08c7c 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -5314,7 +5314,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, - int phymode, int channel) + int phymode, u16 channel) { int i; @@ -8503,7 +8503,7 @@ static ssize_t store_measurement(struct device *d, { struct iwl_priv *priv = dev_get_drvdata(d); struct ieee80211_measurement_params params = { - .channel = priv->active_rxon.channel, + .channel = le16_to_cpu(priv->active_rxon.channel), .start_time = priv->last_tsf, .duration = 1, }; diff --git a/drivers/net/wireless/iwl-channel.h b/drivers/net/wireless/iwl-channel.h index d320c2b..97da370 100644 --- a/drivers/net/wireless/iwl-channel.h +++ b/drivers/net/wireless/iwl-channel.h @@ -158,6 +158,6 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch) } extern const struct iwl_channel_info *iwl_get_channel_info( - const struct iwl_priv *priv, int phymode, int channel); + const struct iwl_priv *priv, int phymode, u16 channel); #endif diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h index 6fea9a4..029b590 100644 --- a/drivers/net/wireless/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi.h @@ -717,6 +717,6 @@ 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, u8 channel); +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); #endif -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 18/28] iwlwifi: shorten more function names 2007-08-08 7:33 ` [PATCH 17/28] iwlwifi: Endianity fix for channel number Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 19/28] iwlwifi: make iwl_get_bits inline function from macro Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-3945.c | 8 ++++---- drivers/net/wireless/iwl-4965.c | 8 ++++---- drivers/net/wireless/iwl-base.c | 10 +++++----- drivers/net/wireless/iwlwifi.h | 9 +++------ 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c index a9a1921..ce9688c 100644 --- a/drivers/net/wireless/iwl-3945.c +++ b/drivers/net/wireless/iwl-3945.c @@ -490,8 +490,8 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, } } -int iwl_hw_tx_queue_attach_buffer_to_tfd(struct iwl_priv *priv, - void *ptr, dma_addr_t addr, u16 len) +int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, + dma_addr_t addr, u16 len) { int count; u32 pad; @@ -518,11 +518,11 @@ int iwl_hw_tx_queue_attach_buffer_to_tfd(struct iwl_priv *priv, } /** - * iwl_hw_tx_queue_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.last_used] * * Does NOT advance any indexes */ -int iwl_hw_tx_queue_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) +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]; diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index a3e6603..de5b541 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -1762,11 +1762,11 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) } /** - * iwl_hw_tx_queue_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.last_used] * * Does NOT advance any indexes */ -int iwl_hw_tx_queue_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) +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]; @@ -2754,8 +2754,8 @@ static inline u8 iwl4965_get_dma_hi_address(dma_addr_t addr) return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0; } -int iwl_hw_tx_queue_attach_buffer_to_tfd(struct iwl_priv *priv, - void *ptr, dma_addr_t addr, u16 len) +int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, + dma_addr_t addr, u16 len) { int index, is_odd; struct iwl_tfd_frame *tfd = ptr; diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 3b08c7c..94d5ac8 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -308,7 +308,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) /* 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)) - iwl_hw_tx_queue_free_tfd(priv, txq); + iwl_hw_txq_free_tfd(priv, txq); len = sizeof(struct iwl_cmd) * q->n_window; if (q->id == IWL_CMD_QUEUE_NUM); @@ -622,7 +622,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + offsetof(struct iwl_cmd, hdr); - iwl_hw_tx_queue_attach_buffer_to_tfd(priv, tfd, phys_addr, fix_size); + iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); #if IWL == 3945 pad = U32_PAD(out_cmd->meta.len); @@ -2913,7 +2913,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx + offsetof(struct iwl_cmd, hdr); - iwl_hw_tx_queue_attach_buffer_to_tfd(priv, tfd, txcmd_phys, len); + iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); if (ctl->key_idx != -1) iwl_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); @@ -2923,7 +2923,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, if (len) { phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, len, PCI_DMA_TODEVICE); - iwl_hw_tx_queue_attach_buffer_to_tfd(priv, tfd, phys_addr, len); + iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len); } #if IWL == 3945 @@ -3477,7 +3477,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) if (txq_id != IWL_CMD_QUEUE_NUM) { iwl_txstatus_to_ieee(priv, &(txq->txb[txq->q.last_used])); - iwl_hw_tx_queue_free_tfd(priv, txq); + iwl_hw_txq_free_tfd(priv, txq); } else is_next = 1; } diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h index 029b590..5b826bf 100644 --- a/drivers/net/wireless/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi.h @@ -683,13 +683,10 @@ 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_tx_queue_attach_buffer_to_tfd( - struct iwl_priv *priv, void *tfd, dma_addr_t addr, u16 len); -extern int iwl_hw_tx_queue_free_tfd(struct iwl_priv *priv, - struct iwl_tx_queue *txq); +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_tx_queue_free_tfd(struct iwl_priv *priv, - struct iwl_tx_queue *txq); 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, -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 19/28] iwlwifi: make iwl_get_bits inline function from macro 2007-08-08 7:33 ` [PATCH 18/28] iwlwifi: shorten more function names Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 20/28] iwlwifi: remove BIT_FMT and BIT_ARG Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Make iwl_get_bits and iwl_set_bits inline functions from the original macro implementation. Add IWL_SET_BITS16 for 16-bits value setting. Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-4965.c | 6 ++-- drivers/net/wireless/iwl-helpers.h | 53 +++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index de5b541..258879c 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -2815,11 +2815,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_BITS(shared_data->queues_byte_cnt_tbls[txq_id]. - tfd_offset[txq->q.first_empty], byte_cnt, len); + IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. + tfd_offset[txq->q.first_empty], byte_cnt, len); if (txq->q.first_empty < IWL4965_MAX_WIN_SIZE) - IWL_SET_BITS(shared_data->queues_byte_cnt_tbls[txq_id]. + IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. tfd_offset[IWL4965_QUEUE_SIZE + txq->q.first_empty], byte_cnt, len); diff --git a/drivers/net/wireless/iwl-helpers.h b/drivers/net/wireless/iwl-helpers.h index c0ea48e..6281e3d 100644 --- a/drivers/net/wireless/iwl-helpers.h +++ b/drivers/net/wireless/iwl-helpers.h @@ -59,13 +59,14 @@ * NOTE: If used from IWL_GET_BITS then pos and len are compile-constants and * will collapse to minimal code by the compiler. */ -#define iwl_get_bits(src, pos, len) \ -({ \ - u32 __tmp = le32_to_cpu(src); \ - __tmp >>= pos; \ - __tmp &= (1UL << len) - 1; \ - __tmp; \ -}) +static inline u32 iwl_get_bits(__le32 src, u8 pos, u8 len) +{ + u32 tmp = le32_to_cpu(src); + + tmp >>= pos; + tmp &= (1UL << len) - 1; + return tmp; +} /** * iwl_set_bits - Set a hardware bit-field value @@ -80,13 +81,23 @@ * NOTE: If used IWL_SET_BITS pos and len will be compile-constants and * will collapse to minimal code by the compiler. */ -#define iwl_set_bits(dst, pos, len, val) \ -({ \ - u32 __tmp = le32_to_cpu(*dst); \ - __tmp &= ~((1ULL << (pos+len)) - (1 << pos)); \ - __tmp |= (val & ((1UL << len) - 1)) << pos; \ - *dst = cpu_to_le32(__tmp); \ -}) +static inline void iwl_set_bits(__le32 *dst, u8 pos, u8 len, int val) +{ + u32 tmp = le32_to_cpu(*dst); + + tmp &= ~((1UL << (pos + len)) - (1UL << pos)); + tmp |= (val & ((1UL << len) - 1)) << pos; + *dst = cpu_to_le32(tmp); +} + +static inline void iwl_set_bits16(__le16 *dst, u8 pos, u8 len, int val) +{ + u32 tmp = le16_to_cpu(*dst); + + tmp &= ~((1UL << (pos + len)) - (1UL << pos)); + tmp |= (val & ((1UL << len) - 1)) << pos; + *dst = cpu_to_le16(tmp); +} /* * The bit-field definitions in iwl-xxxx-hw.h are in the form of: @@ -110,18 +121,16 @@ * and iwl_{get,set}_bits. * */ -#define _IWL_SET_BITS(s, d, o, l, v) \ - iwl_set_bits(&s.d, o, l, v) - #define IWL_SET_BITS(s, sym, v) \ - _IWL_SET_BITS((s), IWL_ ## sym ## _SYM, IWL_ ## sym ## _POS, \ - IWL_ ## sym ## _LEN, (v)) + iwl_set_bits(&(s).IWL_ ## sym ## _SYM, IWL_ ## sym ## _POS, \ + IWL_ ## sym ## _LEN, (v)) -#define _IWL_GET_BITS(s, v, o, l) \ - iwl_get_bits(s.v, o, l) +#define IWL_SET_BITS16(s, sym, v) \ + iwl_set_bits16(&(s).IWL_ ## sym ## _SYM, IWL_ ## sym ## _POS, \ + IWL_ ## sym ## _LEN, (v)) #define IWL_GET_BITS(s, sym) \ - _IWL_GET_BITS((s), IWL_ ## sym ## _SYM, IWL_ ## sym ## _POS, \ + iwl_get_bits((s).IWL_ ## sym ## _SYM, IWL_ ## sym ## _POS, \ IWL_ ## sym ## _LEN) /* Debug and printf string expansion helpers for printing bitfields */ -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 20/28] iwlwifi: remove BIT_FMT and BIT_ARG 2007-08-08 7:33 ` [PATCH 19/28] iwlwifi: make iwl_get_bits inline function from macro Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 21/28] iwlwifi: remove WLAN_FC_GET_TYPE macros Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-3945.c | 8 +++----- drivers/net/wireless/iwl-4965.c | 15 ++++++--------- drivers/net/wireless/iwl-base.c | 24 +++++++++--------------- drivers/net/wireless/iwl-helpers.h | 25 ++----------------------- 4 files changed, 20 insertions(+), 52 deletions(-) diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c index ce9688c..6cec308 100644 --- a/drivers/net/wireless/iwl-3945.c +++ b/drivers/net/wireless/iwl-3945.c @@ -659,11 +659,9 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, /* CCK */ cmd->cmd.tx.supp_rates[1] = (rate_mask >> 8) & 0xF; - IWL_DEBUG_RATE("Tx sta id: %d, rate: %d (plcp), flags: " BIT_FMT16 " " - "cck/ofdm mask: 0x%x/0x%x\n", - sta_id, - cmd->cmd.tx.rate, - BIT_ARG16(le32_to_cpu(cmd->cmd.tx.tx_flags)), + IWL_DEBUG_RATE("Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " + "cck/ofdm mask: 0x%x/0x%x\n", sta_id, + cmd->cmd.tx.rate, le32_to_cpu(cmd->cmd.tx.tx_flags), cmd->cmd.tx.supp_rates[1], cmd->cmd.tx.supp_rates[0]); } diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index 258879c..76c0c98 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -310,7 +310,7 @@ int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel, if (!is_channel_valid(ch_info)) return -1; - IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s%s(" BIT_FMT8 + IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x" " %ddBm): Ad-Hoc %ssupported\n", ch_info->channel, is_channel_a_band(ch_info) ? @@ -321,14 +321,11 @@ int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel, CHECK_AND_PRINT(WIDE), CHECK_AND_PRINT(NARROW), CHECK_AND_PRINT(DFS), - BIT_ARG8(eeprom_ch->flags), - eeprom_ch-> - max_power_avg, - ((eeprom_ch-> - flags & EEPROM_CHANNEL_IBSS) - && !(eeprom_ch-> - flags & EEPROM_CHANNEL_RADAR)) - ? "" : "not "); + eeprom_ch->flags, + eeprom_ch->max_power_avg, + ((eeprom_ch->flags & EEPROM_CHANNEL_IBSS) + && !(eeprom_ch->flags & EEPROM_CHANNEL_RADAR)) ? + "" : "not "); ch_info->fat_eeprom = *eeprom_ch; ch_info->fat_max_power_avg = eeprom_ch->max_power_avg; diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 94d5ac8..7514928 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -4702,18 +4702,13 @@ static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) IWL_DEBUG_RADIO("RX CONFIG:\n"); printk_buf(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 " BIT_FMT32 "\n", - le32_to_cpu(rxon->flags), - BIT_ARG32(le32_to_cpu(rxon->flags))); - IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x " BIT_FMT32 "\n", - le32_to_cpu(rxon->filter_flags), - BIT_ARG32(le32_to_cpu(rxon->filter_flags))); + IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); + IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", + le32_to_cpu(rxon->filter_flags)); IWL_DEBUG_RADIO("u8 dev_type: 0x%x\n", rxon->dev_type); - IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x " BIT_FMT8 "\n", - rxon->ofdm_basic_rates, - BIT_ARG8(rxon->ofdm_basic_rates)); - IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x " BIT_FMT8 "\n", - rxon->cck_basic_rates, BIT_ARG8(rxon->cck_basic_rates)); + IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n", + rxon->ofdm_basic_rates); + IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates); IWL_DEBUG_RADIO("u8[6] node_addr: " MAC_FMT "\n", MAC_ARG(rxon->node_addr)); IWL_DEBUG_RADIO("u8[6] bssid_addr: " MAC_FMT "\n", @@ -5421,7 +5416,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv) ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; ch_info->min_power = 0; - IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(" BIT_FMT8 + IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x" " %ddBm): Ad-Hoc %ssupported\n", ch_info->channel, is_channel_a_band(ch_info) ? @@ -5432,9 +5427,8 @@ static int iwl_init_channel_map(struct iwl_priv *priv) CHECK_AND_PRINT(WIDE), CHECK_AND_PRINT(NARROW), CHECK_AND_PRINT(DFS), - BIT_ARG8(eeprom_ch_info[ch].flags), - eeprom_ch_info[ch]. - max_power_avg, + eeprom_ch_info[ch].flags, + eeprom_ch_info[ch].max_power_avg, ((eeprom_ch_info[ch]. flags & EEPROM_CHANNEL_IBSS) && !(eeprom_ch_info[ch]. diff --git a/drivers/net/wireless/iwl-helpers.h b/drivers/net/wireless/iwl-helpers.h index 6281e3d..46084f2 100644 --- a/drivers/net/wireless/iwl-helpers.h +++ b/drivers/net/wireless/iwl-helpers.h @@ -85,14 +85,14 @@ static inline void iwl_set_bits(__le32 *dst, u8 pos, u8 len, int val) { u32 tmp = le32_to_cpu(*dst); - tmp &= ~((1UL << (pos + len)) - (1UL << pos)); + tmp &= ~(((1UL << len) - 1) << pos); tmp |= (val & ((1UL << len) - 1)) << pos; *dst = cpu_to_le32(tmp); } static inline void iwl_set_bits16(__le16 *dst, u8 pos, u8 len, int val) { - u32 tmp = le16_to_cpu(*dst); + u16 tmp = le16_to_cpu(*dst); tmp &= ~((1UL << (pos + len)) - (1UL << pos)); tmp |= (val & ((1UL << len) - 1)) << pos; @@ -133,27 +133,6 @@ static inline void iwl_set_bits16(__le16 *dst, u8 pos, u8 len, int val) iwl_get_bits((s).IWL_ ## sym ## _SYM, IWL_ ## sym ## _POS, \ IWL_ ## sym ## _LEN) -/* Debug and printf string expansion helpers for printing bitfields */ -#define BIT_FMT8 "%c%c%c%c-%c%c%c%c" -#define BIT_FMT16 BIT_FMT8 ":" BIT_FMT8 -#define BIT_FMT32 BIT_FMT16 " " BIT_FMT16 - -#define BITC(x, y) (((x>>y) & 1) ? '1' : '0') -#define BIT_ARG8(x) \ -BITC(x, 7), BITC(x, 6), BITC(x, 5), BITC(x, 4), \ -BITC(x, 3), BITC(x, 2), BITC(x, 1), BITC(x, 0) - -#define BIT_ARG16(x) \ -BITC(x, 15), BITC(x, 14), BITC(x, 13), BITC(x, 12), \ -BITC(x, 11), BITC(x, 10), BITC(x, 9), BITC(x, 8), \ -BIT_ARG8(x) - -#define BIT_ARG32(x) \ -BITC(x, 31), BITC(x, 30), BITC(x, 29), BITC(x, 28), \ -BITC(x, 27), BITC(x, 26), BITC(x, 25), BITC(x, 24), \ -BITC(x, 23), BITC(x, 22), BITC(x, 21), BITC(x, 20), \ -BITC(x, 19), BITC(x, 18), BITC(x, 17), BITC(x, 16), \ -BIT_ARG16(x) #define KELVIN_TO_CELSIUS(x) ((x)-273) #define CELSIUS_TO_KELVIN(x) ((x)+273) -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 21/28] iwlwifi: remove WLAN_FC_GET_TYPE macros 2007-08-08 7:33 ` [PATCH 20/28] iwlwifi: remove BIT_FMT and BIT_ARG Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 22/28] iwlwifi: replace private snprint_line with common hex_dump_xxx Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Use IEEE80211_FCTL_FTYPE directly. Also make some inline function unlined. Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-3945.c | 9 ++- drivers/net/wireless/iwl-4965.c | 14 +++-- drivers/net/wireless/iwl-base.c | 78 ++++++++++++++++++++--- drivers/net/wireless/iwl-helpers.h | 122 ++++++++---------------------------- drivers/net/wireless/iwlwifi.h | 1 + 5 files changed, 111 insertions(+), 113 deletions(-) diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c index 6cec308..53fba5d 100644 --- a/drivers/net/wireless/iwl-3945.c +++ b/drivers/net/wireless/iwl-3945.c @@ -395,9 +395,10 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, priv->last_rx_noise = stats.noise; } - switch (WLAN_FC_GET_TYPE(le16_to_cpu(header->frame_control))) { + switch (le16_to_cpu(header->frame_control) & IEEE80211_FCTL_FTYPE) { case IEEE80211_FTYPE_MGMT: - switch (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_control))) { + switch (le16_to_cpu(header->frame_control) & + IEEE80211_FCTL_STYPE) { case IEEE80211_STYPE_PROBE_RESP: case IEEE80211_STYPE_BEACON:{ /* If this is a beacon or probe response for @@ -632,8 +633,8 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, if (priv->data_retry_limit != -1) data_retry_limit = priv->data_retry_limit; - if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) { - switch (WLAN_FC_GET_STYPE(fc)) { + if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) { + switch (fc & IEEE80211_FCTL_STYPE) { case IEEE80211_STYPE_AUTH: case IEEE80211_STYPE_DEAUTH: case IEEE80211_STYPE_ASSOC_REQ: diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index 76c0c98..631bd19 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -2655,8 +2655,10 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, if (priv->data_retry_limit != -1) data_retry_limit = priv->data_retry_limit; - if (WLAN_FC_GET_TYPE(hdr->frame_control) == IEEE80211_FTYPE_MGMT) { - switch (WLAN_FC_GET_STYPE(hdr->frame_control)) { + if ((le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_FTYPE) + == IEEE80211_FTYPE_MGMT) { + switch (le16_to_cpu(hdr->frame_control) & + IEEE80211_FCTL_STYPE) { case IEEE80211_STYPE_AUTH: case IEEE80211_STYPE_DEAUTH: case IEEE80211_STYPE_ASSOC_REQ: @@ -3233,7 +3235,7 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, unicast = !is_multicast_ether_addr(hdr->addr1); fc = le16_to_cpu(hdr->frame_control); - if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_DATA) + if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) is_data = 0; memcpy(&cmd, &(out_cmd->cmd.tx), sizeof(struct iwl_tx_cmd)); @@ -3896,13 +3898,13 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, } fc = le16_to_cpu(header->frame_control); - switch (WLAN_FC_GET_TYPE(fc)) { + switch (fc & IEEE80211_FCTL_FTYPE) { case IEEE80211_FTYPE_MGMT: if (priv->iw_mode == IEEE80211_IF_TYPE_AP) iwl4965_update_ps_mode(priv, fc & IEEE80211_FCTL_PM, header->addr2); - switch (WLAN_FC_GET_STYPE(fc)) { + switch (fc & IEEE80211_FCTL_STYPE) { case IEEE80211_STYPE_PROBE_RESP: case IEEE80211_STYPE_BEACON: if ((priv->iw_mode == IEEE80211_IF_TYPE_STA && @@ -3990,7 +3992,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, case IEEE80211_FTYPE_CTL: #ifdef CONFIG_IWLWIFI_HT_AGG - switch (WLAN_FC_GET_STYPE(fc)) { + switch (fc & IEEE80211_FCTL_STYPE) { case IEEE80211_STYPE_BACK_REQ: IWL_DEBUG_HT("IEEE80211_STYPE_BACK_REQ arrived\n"); iwl4965_handle_data_packet(priv, 0, include_phy, diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 7514928..efd4762 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -122,6 +122,68 @@ MODULE_VERSION(DRV_VERSION); MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_LICENSE("GPL"); +__le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr) +{ + u16 fc = le16_to_cpu(hdr->frame_control); + int hdr_len = ieee80211_get_hdrlen(fc); + + if ((fc & 0x00cc) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) + return (__le16 *) ((u8 *) hdr + hdr_len - QOS_CONTROL_LEN); + return NULL; +} + +static const struct ieee80211_hw_mode *iwl_get_hw_mode( + struct iwl_priv *priv, int mode) +{ + int i; + + for (i = 0; i < 3; i++) + if (priv->modes[i].mode == mode) + return &priv->modes[i]; + + return NULL; +} + +static int iwl_is_empty_essid(const char *essid, int essid_len) +{ + /* Single white space is for Linksys APs */ + if (essid_len == 1 && essid[0] == ' ') + return 1; + + /* Otherwise, if the entire essid is 0, we assume it is hidden */ + while (essid_len) { + essid_len--; + if (essid[essid_len] != '\0') + return 0; + } + + return 1; +} + +static const char *iwl_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)) { + memcpy(escaped, "<hidden>", sizeof("<hidden>")); + return escaped; + } + + essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE); + while (essid_len--) { + if (*s == '\0') { + *d++ = '\\'; + *d++ = '0'; + s++; + } else + *d++ = *s++; + } + *d = '\0'; + return escaped; +} + /*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** * DMA services * @@ -2693,7 +2755,7 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; if (!(ctrl->flags & IEEE80211_TXCTL_NO_ACK)) { tx_flags |= TX_CMD_FLG_ACK_MSK; - if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) + if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; if (ieee80211_is_probe_response(fc) && !(le16_to_cpu(hdr->seq_ctrl) & 0xf)) @@ -2726,9 +2788,9 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv, tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK; tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); - if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) { - if (((WLAN_FC_GET_STYPE(fc)) == IEEE80211_STYPE_ASSOC_REQ) || - ((WLAN_FC_GET_STYPE(fc)) == IEEE80211_STYPE_REASSOC_REQ)) + 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); else @@ -2749,7 +2811,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) /* If this frame is broadcast or not data then use the broadcast * station id */ - if ((WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_DATA) || + if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) || is_multicast_ether_addr(hdr->addr1)) return IWL_BROADCAST_ID; @@ -2838,7 +2900,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, #endif if (!iwl_is_associated(priv) && - (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA)) { + ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n"); goto drop; } @@ -3232,8 +3294,8 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv, int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) { u16 sc = le16_to_cpu(header->seq_ctrl); - u16 seq = WLAN_GET_SEQ_SEQ(sc); - u16 frag = WLAN_GET_SEQ_FRAG(sc); + u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4; + u16 frag = sc & IEEE80211_SCTL_FRAG; u16 *last_seq, *last_frag; unsigned long *last_time; diff --git a/drivers/net/wireless/iwl-helpers.h b/drivers/net/wireless/iwl-helpers.h index 46084f2..6ac119f 100644 --- a/drivers/net/wireless/iwl-helpers.h +++ b/drivers/net/wireless/iwl-helpers.h @@ -145,139 +145,97 @@ static inline struct ieee80211_conf *ieee80211_get_hw_conf( return &hw->conf; } -static inline const struct ieee80211_hw_mode *iwl_get_hw_mode( - struct iwl_priv *priv, int mode) -{ - int i; - - for (i = 0; i < 3; i++) - if (priv->modes[i].mode == mode) - return &priv->modes[i]; - - return NULL; -} - -#define WLAN_FC_GET_TYPE(fc) (((fc) & IEEE80211_FCTL_FTYPE)) -#define WLAN_FC_GET_STYPE(fc) (((fc) & IEEE80211_FCTL_STYPE)) -#define WLAN_GET_SEQ_FRAG(seq) ((seq) & 0x000f) -#define WLAN_GET_SEQ_SEQ(seq) ((seq) >> 4) - #define QOS_CONTROL_LEN 2 -static inline __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr) -{ - u16 fc = le16_to_cpu(hdr->frame_control); - int hdr_len = ieee80211_get_hdrlen(fc); - if ( (fc & 0x00cc) == (IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) - return (__le16 *) ((u8 *) hdr + hdr_len - QOS_CONTROL_LEN); - return NULL; -} - #define IEEE80211_STYPE_BACK_REQ 0x0080 #define IEEE80211_STYPE_BACK 0x0090 static inline int ieee80211_is_management(u16 fc) { - return WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT; + return (fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT; } static inline int ieee80211_is_control(u16 fc) { - return WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL; + return (fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL; } static inline int ieee80211_is_data(u16 fc) { - return WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA; + return (fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA; } static inline int ieee80211_is_back_request(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_BACK_REQ); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BACK_REQ); } static inline int ieee80211_is_probe_response(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_PROBE_RESP); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP); } static inline int ieee80211_is_probe_request(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_PROBE_REQ); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_REQ); } static inline int ieee80211_is_beacon(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_BEACON); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON); } static inline int ieee80211_is_atim(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_ATIM); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ATIM); } static inline int ieee80211_is_assoc_request(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_ASSOC_REQ); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ); } static inline int ieee80211_is_assoc_response(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_ASSOC_RESP); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_RESP); } static inline int ieee80211_is_auth(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_ASSOC_REQ); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ); } static inline int ieee80211_is_deauth(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_ASSOC_REQ); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ); } static inline int ieee80211_is_disassoc(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_ASSOC_REQ); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ); } static inline int ieee80211_is_reassoc_request(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_REASSOC_REQ); + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_REASSOC_REQ); } static inline int ieee80211_is_reassoc_response(u16 fc) { - return (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT) && - (WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_REASSOC_RESP); -} - -static inline int iwl_is_empty_essid(const char *essid, int essid_len) -{ - /* Single white space is for Linksys APs */ - if (essid_len == 1 && essid[0] == ' ') - return 1; - - /* Otherwise, if the entire essid is 0, we assume it is hidden */ - while (essid_len) { - essid_len--; - if (essid[essid_len] != '\0') - return 0; - } - - return 1; + return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && + ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_REASSOC_RESP); } static inline int iwl_check_bits(unsigned long field, unsigned long mask) @@ -285,30 +243,6 @@ static inline int iwl_check_bits(unsigned long field, unsigned long mask) return ((field & mask) == mask) ? 1 : 0; } -static inline const char *iwl_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)) { - memcpy(escaped, "<hidden>", sizeof("<hidden>")); - return escaped; - } - - essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE); - while (essid_len--) { - if (*s == '\0') { - *d++ = '\\'; - *d++ = '0'; - s++; - } else - *d++ = *s++; - } - *d = '\0'; - return escaped; -} - static inline unsigned long elapsed_jiffies(unsigned long start, unsigned long end) { @@ -318,8 +252,6 @@ static inline unsigned long elapsed_jiffies(unsigned long start, return end + (MAX_JIFFY_OFFSET - start); } - - static inline int snprint_line(char *buf, size_t count, const u8 *data, u32 len, u32 ofs) { diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h index 5b826bf..1279a2b 100644 --- a/drivers/net/wireless/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi.h @@ -639,6 +639,7 @@ 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]; -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 22/28] iwlwifi: replace private snprint_line with common hex_dump_xxx 2007-08-08 7:33 ` [PATCH 21/28] iwlwifi: remove WLAN_FC_GET_TYPE macros Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 23/28] iwlwifi: Endianity fix for frame control Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-base.c | 45 ++++++++++++++++++++++++----------- drivers/net/wireless/iwl-helpers.h | 21 ---------------- 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index efd4762..2c107e7 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -184,6 +184,23 @@ 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) +{ +#ifdef CONFIG_IWLWIFI_DEBUG + u32 ofs = 0; + + if (!(iwl_debug_level & level)) + return; + + while (len) { + print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, + 16, 1, p + ofs, len, 1); + ofs += 16; + len -= min(len, 16U); + } +#endif +} + /*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** * DMA services * @@ -1819,7 +1836,7 @@ void iwl_report_frame(struct iwl_priv *priv, } } if (print_dump) - printk_buf(IWL_DL_RX, data, length); + iwl_print_hex_dump(IWL_DL_RX, data, length); } #endif @@ -2836,7 +2853,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) IWL_DEBUG_DROP("Station " MAC_FMT " not in station map. " "Defaulting to broadcast...\n", MAC_ARG(hdr->addr1)); - printk_buf(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); + iwl_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); return IWL_BROADCAST_ID; } @@ -3028,10 +3045,11 @@ static int iwl_tx_skb(struct iwl_priv *priv, txq->need_update = 0; } - printk_buf(IWL_DL_TX, out_cmd->cmd.payload, sizeof(out_cmd->cmd.tx)); + iwl_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, + sizeof(out_cmd->cmd.tx)); - printk_buf(IWL_DL_TX, (u8 *) out_cmd->cmd.tx.hdr, - ieee80211_get_hdrlen(fc)); + iwl_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); @@ -3939,7 +3957,7 @@ static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv, IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " "notification for %s:\n", le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); - printk_buf(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); + iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); } static void iwl_rx_beacon_notif(struct iwl_priv *priv, @@ -4762,7 +4780,7 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon) { IWL_DEBUG_RADIO("RX CONFIG:\n"); - printk_buf(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); + iwl_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", @@ -8525,7 +8543,6 @@ static ssize_t show_measurement(struct device *d, { struct iwl_priv *priv = dev_get_drvdata(d); struct iwl_spectrum_notification measure_report; - u32 size = sizeof(measure_report), len = 0, ofs = 0; u8 *data = (u8 *) & measure_report; unsigned long flags; @@ -8540,9 +8557,9 @@ static ssize_t show_measurement(struct device *d, spin_unlock_irqrestore(&priv->lock, flags); while (size && (PAGE_SIZE - len)) { - len += - snprint_line(&buf[len], PAGE_SIZE - len, - &data[ofs], min(size, 16U), ofs); + hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len, + PAGE_SIZE - len, 1); + len = strlen(buf); if (PAGE_SIZE - len) buf[len++] = '\n'; @@ -8828,9 +8845,9 @@ static ssize_t show_statistics(struct device *d, } while (size && (PAGE_SIZE - len)) { - len += - snprint_line(&buf[len], PAGE_SIZE - len, - &data[ofs], min(size, 16U), ofs); + hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len, + PAGE_SIZE - len, 1); + len = strlen(buf); if (PAGE_SIZE - len) buf[len++] = '\n'; diff --git a/drivers/net/wireless/iwl-helpers.h b/drivers/net/wireless/iwl-helpers.h index 6ac119f..78b536e 100644 --- a/drivers/net/wireless/iwl-helpers.h +++ b/drivers/net/wireless/iwl-helpers.h @@ -287,25 +287,4 @@ static inline int snprint_line(char *buf, size_t count, return out; } -#ifdef CONFIG_IWLWIFI_DEBUG -static inline void printk_buf(int level, const void *p, u32 len) -{ - const u8 *data = p; - char line[81]; - u32 ofs = 0; - if (!(iwl_debug_level & level)) - return; - - while (len) { - snprint_line(line, sizeof(line), &data[ofs], - min(len, 16U), ofs); - printk(KERN_DEBUG "%s\n", line); - ofs += 16; - len -= min(len, 16U); - } -} -#else -#define printk_buf(level, p, len) do {} while (0) -#endif - #endif /* __iwl_helpers_h__ */ -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 23/28] iwlwifi: Endianity fix for frame control 2007-08-08 7:33 ` [PATCH 22/28] iwlwifi: replace private snprint_line with common hex_dump_xxx Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 24/28] iwlwifi: Endianity fix for ct kill configuration Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Tomas Winkler, Zhu Yi From: Tomas Winkler <tomas.winkler@intel.com> This patch fixes endianity issue for frame control field in iwl_hw_build_tx_cmd_rate function. In addition it converts frame_ctl to fc to align name convention in driver. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-4965.c | 9 ++++----- drivers/net/wireless/iwl-base.c | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index 631bd19..eca9eed 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -2637,6 +2637,7 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, u8 rts_retry_limit = 0; u8 data_retry_limit = 0; __le32 tx_flags; + u16 fc = le16_to_cpu(hdr->frame_control); tx_flags = cmd->cmd.tx.tx_flags; @@ -2645,7 +2646,7 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, rts_retry_limit = (is_hcca) ? RTS_HCCA_RETRY_LIMIT : RTS_DFAULT_RETRY_LIMIT; - if (ieee80211_is_probe_response(hdr->frame_control)) { + if (ieee80211_is_probe_response(fc)) { data_retry_limit = 3; if (data_retry_limit < rts_retry_limit) rts_retry_limit = data_retry_limit; @@ -2655,10 +2656,8 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, if (priv->data_retry_limit != -1) data_retry_limit = priv->data_retry_limit; - if ((le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_FTYPE) - == IEEE80211_FTYPE_MGMT) { - switch (le16_to_cpu(hdr->frame_control) & - IEEE80211_FCTL_STYPE) { + if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) { + switch (fc & IEEE80211_FCTL_STYPE) { case IEEE80211_STYPE_AUTH: case IEEE80211_STYPE_DEAUTH: case IEEE80211_STYPE_ASSOC_REQ: diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 2c107e7..a6cac9c 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -1718,7 +1718,7 @@ void iwl_report_frame(struct iwl_priv *priv, u32 print_dump = 0; /* set to 1 to dump all frames' contents */ u32 hundred = 0; u32 dataframe = 0; - u16 frame_ctl; + u16 fc; u16 seq_ctl; u16 channel; u16 phy_flags; @@ -1738,7 +1738,7 @@ void iwl_report_frame(struct iwl_priv *priv, u8 *data = IWL_RX_DATA(pkt); /* MAC header */ - frame_ctl = le16_to_cpu(header->frame_control); + fc = le16_to_cpu(header->frame_control); seq_ctl = le16_to_cpu(header->seq_ctrl); /* metadata */ @@ -1763,7 +1763,7 @@ void iwl_report_frame(struct iwl_priv *priv, /* if data frame is to us and all is good, * (optionally) print summary for only 1 out of every 100 */ - if (to_us && (frame_ctl & ~IEEE80211_FCTL_PROTECTED) == + if (to_us && (fc & ~IEEE80211_FCTL_PROTECTED) == (IEEE80211_FCTL_FROMDS | IEEE80211_FTYPE_DATA)) { dataframe = 1; if (!group100) @@ -1787,25 +1787,25 @@ void iwl_report_frame(struct iwl_priv *priv, if (hundred) title = "100Frames"; - else if (frame_ctl & IEEE80211_FCTL_RETRY) + else if (fc & IEEE80211_FCTL_RETRY) title = "Retry"; - else if (ieee80211_is_assoc_response(frame_ctl)) + else if (ieee80211_is_assoc_response(fc)) title = "AscRsp"; - else if (ieee80211_is_reassoc_response(frame_ctl)) + else if (ieee80211_is_reassoc_response(fc)) title = "RasRsp"; - else if (ieee80211_is_probe_response(frame_ctl)) { + else if (ieee80211_is_probe_response(fc)) { title = "PrbRsp"; print_dump = 1; /* dump frame contents */ - } else if (ieee80211_is_beacon(frame_ctl)) { + } else if (ieee80211_is_beacon(fc)) { title = "Beacon"; print_dump = 1; /* dump frame contents */ - } else if (ieee80211_is_atim(frame_ctl)) + } else if (ieee80211_is_atim(fc)) title = "ATIM"; - else if (ieee80211_is_auth(frame_ctl)) + else if (ieee80211_is_auth(fc)) title = "Auth"; - else if (ieee80211_is_deauth(frame_ctl)) + else if (ieee80211_is_deauth(fc)) title = "DeAuth"; - else if (ieee80211_is_disassoc(frame_ctl)) + else if (ieee80211_is_disassoc(fc)) title = "DisAssoc"; else title = "Frame"; @@ -1822,14 +1822,14 @@ void iwl_report_frame(struct iwl_priv *priv, if (dataframe) IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, " "len=%u, rssi=%d, chnl=%d, rate=%u, \n", - title, frame_ctl, header->addr1[5], + title, fc, header->addr1[5], length, rssi, channel, rate); else { /* src/dst addresses assume managed mode */ IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, " "src=0x%02x, rssi=%u, tim=%lu usec, " "phy=0x%02x, chnl=%d\n", - title, frame_ctl, header->addr1[5], + title, fc, header->addr1[5], header->addr3[5], rssi, tsf_low - priv->scan_start_tsf, phy_flags, channel); -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 24/28] iwlwifi: Endianity fix for ct kill configuration 2007-08-08 7:33 ` [PATCH 23/28] iwlwifi: Endianity fix for frame control Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 25/28] iwlwifi: remove unused snprint_line Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Tomas Winkler, Zhu Yi From: Tomas Winkler <tomas.winkler@intel.com> This patch fixes endinianity and style issuse in ct kill host command. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-4965.c | 12 ++++++------ drivers/net/wireless/iwl-commands.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c index eca9eed..6b6ab52 100644 --- a/drivers/net/wireless/iwl-4965.c +++ b/drivers/net/wireless/iwl-4965.c @@ -713,8 +713,9 @@ static void iwl4965_bg_statistics_work(struct work_struct *work) void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) { struct iwl_ct_kill_config cmd; - u32 R1 = 0, R2 = 0, R3 = 0; - u32 temp_th = 0; + u32 R1, R2, R3; + u32 temp_th; + u32 crit_temperature; unsigned long flags; int rc = 0; @@ -735,15 +736,14 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) temp_th = CELSIUS_TO_KELVIN(TM_CT_KILL_THRESHOLD); - cmd.critical_temperature_R = ((temp_th * (R3-R1))/CT_LIMIT_CONST) + R2; + 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, REPLY_CT_KILL_CONFIG_CMD, sizeof(cmd), &cmd); if (rc) IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n"); else - IWL_WARNING("REPLY_CT_KILL_CONFIG_CMD succeeded\n"); - - return; + IWL_DEBUG_INFO("REPLY_CT_KILL_CONFIG_CMD succeeded\n"); } #ifdef CONFIG_IWLWIFI_SENSITIVITY diff --git a/drivers/net/wireless/iwl-commands.h b/drivers/net/wireless/iwl-commands.h index 2327ec3..1d2c091 100644 --- a/drivers/net/wireless/iwl-commands.h +++ b/drivers/net/wireless/iwl-commands.h @@ -560,9 +560,9 @@ struct iwl_missed_beacon_notif { } __attribute__ ((packed)); struct iwl_ct_kill_config { - u32 reserved; - u32 critical_temperature_M; - u32 critical_temperature_R; + __le32 reserved; + __le32 critical_temperature_M; + __le32 critical_temperature_R; } __attribute__ ((packed)); /* * Add/Modify Station Command & Response -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 25/28] iwlwifi: remove unused snprint_line 2007-08-08 7:33 ` [PATCH 24/28] iwlwifi: Endianity fix for ct kill configuration Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 26/28] iwlwifi: Enhance ISR/RX/CMD debug messages Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Zhu Yi Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-helpers.h | 35 ----------------------------------- 1 files changed, 0 insertions(+), 35 deletions(-) diff --git a/drivers/net/wireless/iwl-helpers.h b/drivers/net/wireless/iwl-helpers.h index 78b536e..e2a8d95 100644 --- a/drivers/net/wireless/iwl-helpers.h +++ b/drivers/net/wireless/iwl-helpers.h @@ -252,39 +252,4 @@ static inline unsigned long elapsed_jiffies(unsigned long start, return end + (MAX_JIFFY_OFFSET - start); } -static inline int snprint_line(char *buf, size_t count, - const u8 *data, u32 len, u32 ofs) -{ - int out, i, j, l; - char c; - - out = snprintf(buf, count, "%08X", ofs); - - for (l = 0, i = 0; i < 2; i++) { - out += snprintf(buf + out, count - out, " "); - for (j = 0; j < 8 && l < len; j++, l++) - out += - snprintf(buf + out, count - out, "%02X ", - data[(i * 8 + j)]); - for (; j < 8; j++) - out += snprintf(buf + out, count - out, " "); - } - out += snprintf(buf + out, count - out, " "); - for (l = 0, i = 0; i < 2; i++) { - out += snprintf(buf + out, count - out, " "); - for (j = 0; j < 8 && l < len; j++, l++) { - c = data[(i * 8 + j)]; - if (!isascii(c) || !isprint(c)) - c = '.'; - - out += snprintf(buf + out, count - out, "%c", c); - } - - for (; j < 8; j++) - out += snprintf(buf + out, count - out, " "); - } - - return out; -} - #endif /* __iwl_helpers_h__ */ -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 26/28] iwlwifi: Enhance ISR/RX/CMD debug messages 2007-08-08 7:33 ` [PATCH 25/28] iwlwifi: remove unused snprint_line Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 27/28] iwlwifi: Correct missing hardware detection in iwl_isr() Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Ben Cahill, Zhu Yi From: Ben Cahill <ben.m.cahill@intel.com> This patch enhances ISR/RX/CMD debug messages and make sure all commands are in get_cmd_string(). It also removes 2 unused commands and enhance comments. Signed-off-by: Ben Cahill <ben.m.cahill@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-base.c | 84 +++++++++++++++++++++++----------- drivers/net/wireless/iwl-commands.h | 5 +-- 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index a6cac9c..ad7e67c 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -593,41 +593,61 @@ static inline int iwl_is_ready_rf(struct iwl_priv *priv) static const char *get_cmd_string(u8 cmd) { switch (cmd) { - IWL_CMD(SCAN_START_NOTIFICATION); - IWL_CMD(SCAN_RESULTS_NOTIFICATION); - IWL_CMD(SCAN_COMPLETE_NOTIFICATION); - IWL_CMD(STATISTICS_NOTIFICATION); IWL_CMD(REPLY_ALIVE); IWL_CMD(REPLY_ERROR); - IWL_CMD(REPLY_RXON_ASSOC); IWL_CMD(REPLY_RXON); + IWL_CMD(REPLY_RXON_ASSOC); IWL_CMD(REPLY_QOS_PARAM); IWL_CMD(REPLY_RXON_TIMING); IWL_CMD(REPLY_ADD_STA); +#if IWL == 3945 + IWL_CMD(REPLY_REMOVE_STA); + IWL_CMD(REPLY_REMOVE_ALL_STA); + IWL_CMD(REPLY_3945_RX); +#endif IWL_CMD(REPLY_TX); IWL_CMD(REPLY_BCON); +#if IWL == 4965 + IWL_CMD(REPLY_SHUTDOWN); +#endif IWL_CMD(REPLY_RATE_SCALE); IWL_CMD(REPLY_LEDS_CMD); + IWL_CMD(REPLY_TX_LINK_QUALITY_CMD); + IWL_CMD(RADAR_NOTIFICATION); + IWL_CMD(REPLY_QUIET_CMD); + IWL_CMD(REPLY_CHANNEL_SWITCH); + IWL_CMD(CHANNEL_SWITCH_NOTIFICATION); + IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD); + IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION); + IWL_CMD(POWER_TABLE_CMD); + IWL_CMD(PM_SLEEP_NOTIFICATION); + IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC); + IWL_CMD(REPLY_SCAN_CMD); IWL_CMD(REPLY_SCAN_ABORT_CMD); + IWL_CMD(SCAN_START_NOTIFICATION); + IWL_CMD(SCAN_RESULTS_NOTIFICATION); + IWL_CMD(SCAN_COMPLETE_NOTIFICATION); + IWL_CMD(BEACON_NOTIFICATION); IWL_CMD(REPLY_TX_BEACON); - IWL_CMD(REPLY_BT_CONFIG); - IWL_CMD(REPLY_SCAN_CMD); + IWL_CMD(WHO_IS_AWAKE_NOTIFICATION); + IWL_CMD(QUIET_NOTIFICATION); IWL_CMD(REPLY_TX_PWR_TABLE_CMD); + IWL_CMD(MEASURE_ABORT_NOTIFICATION); + IWL_CMD(REPLY_BT_CONFIG); IWL_CMD(REPLY_STATISTICS_CMD); + IWL_CMD(STATISTICS_NOTIFICATION); IWL_CMD(REPLY_CARD_STATE_CMD); - IWL_CMD(REPLY_TX_LINK_QUALITY_CMD); -#if IWL == 3945 - IWL_CMD(REPLY_3945_RX); -#elif IWL == 4965 - IWL_CMD(MISSED_BEACONS_NOTIFICATION_TH_CMD); + IWL_CMD(CARD_STATE_NOTIFICATION); + IWL_CMD(MISSED_BEACONS_NOTIFICATION); +#if IWL == 4965 IWL_CMD(REPLY_CT_KILL_CONFIG_CMD); IWL_CMD(SENSITIVITY_CMD); - IWL_CMD(REPLY_RX_MPDU_CMD); + IWL_CMD(REPLY_PHY_CALIBRATION_CMD); IWL_CMD(REPLY_RX_PHY_CMD); + IWL_CMD(REPLY_RX_MPDU_CMD); IWL_CMD(REPLY_4965_RX); + IWL_CMD(REPLY_COMPRESSED_BA); #endif - case POWER_TABLE_CMD: - return "POWER_TABLE_CMD"; default: return "UNKNOWN"; @@ -4647,8 +4667,8 @@ int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) * iwl_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 response and 802.11 - * frame availability. + * the appropriate handlers, including command responses, + * frame-received notifications, and other notifications. */ static void iwl_rx_handle(struct iwl_priv *priv) { @@ -4662,6 +4682,10 @@ static void iwl_rx_handle(struct iwl_priv *priv) r = iwl_hw_get_rx_read(priv); i = rxq->read; + /* 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); + while (i != r) { rxb = rxq->queue[i]; @@ -4677,7 +4701,12 @@ static void iwl_rx_handle(struct iwl_priv *priv) PCI_DMA_FROMDEVICE); pkt = (struct iwl_rx_packet *)rxb->skb->data; - /* need to reclaim cmd buffer(s) */ + /* Reclaim a command buffer only if this packet is a response + * to a (driver-originated) command. + * If the packet (e.g. Rx frame) originated from uCode, + * there is no command buffer to reclaim. + * Ucode should set SEQ_RX_FRAME bit if ucode-originated, + * but apparently a few don't get set; catch them here. */ reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) && #if IWL == 4965 (pkt->hdr.cmd != REPLY_RX_PHY_CMD) && @@ -4690,21 +4719,22 @@ static void iwl_rx_handle(struct iwl_priv *priv) * handle those that need handling via function in * rx_handlers table. See iwl_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, + get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); - IWL_DEBUG(IWL_DL_RX | IWL_DL_ISR, - "r = %d, i = %d, rx_handler %s\n", r, i, - get_cmd_string(pkt->hdr.cmd)); } else { /* No handling needed */ - IWL_DEBUG_HC("UNHANDLED - #0x%02x %s\n", - pkt->hdr.cmd, - get_cmd_string(pkt->hdr.cmd)); + IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR, + "r %d i %d No handler needed for %s, 0x%02x\n", + r, i, get_cmd_string(pkt->hdr.cmd), + pkt->hdr.cmd); } if (reclaim) { - /* Invoke any callbacks, transfer the skb to - * caller, and fire off the (possibly) blocking - * iwl_send_cmd() via as we reclaim the queue... */ + /* Invoke any callbacks, transfer the skb to caller, + * and fire off the (possibly) blocking iwl_send_cmd() + * as we reclaim the driver command queue */ if (rxb && rxb->skb) iwl_tx_cmd_complete(priv, rxb); else diff --git a/drivers/net/wireless/iwl-commands.h b/drivers/net/wireless/iwl-commands.h index 1d2c091..eecb6f6 100644 --- a/drivers/net/wireless/iwl-commands.h +++ b/drivers/net/wireless/iwl-commands.h @@ -130,8 +130,6 @@ enum { REPLY_TX_PWR_TABLE_CMD = 0x97, MEASURE_ABORT_NOTIFICATION = 0x99, - REPLY_CALIBRATION_TUNE = 0x9a, - /* BT config command */ REPLY_BT_CONFIG = 0x9b, REPLY_STATISTICS_CMD = 0x9c, @@ -143,15 +141,14 @@ enum { /* Missed beacons notification */ MISSED_BEACONS_NOTIFICATION = 0xa2, - MISSED_BEACONS_NOTIFICATION_TH_CMD = 0xa3, #if IWL == 4965 REPLY_CT_KILL_CONFIG_CMD = 0xa4, SENSITIVITY_CMD = 0xa8, REPLY_PHY_CALIBRATION_CMD = 0xb0, - REPLY_4965_RX = 0xc3, REPLY_RX_PHY_CMD = 0xc0, REPLY_RX_MPDU_CMD = 0xc1, + REPLY_4965_RX = 0xc3, REPLY_COMPRESSED_BA = 0xc5, #endif REPLY_MAX = 0xff -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 27/28] iwlwifi: Correct missing hardware detection in iwl_isr() 2007-08-08 7:33 ` [PATCH 26/28] iwlwifi: Enhance ISR/RX/CMD debug messages Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 2007-08-08 7:33 ` [PATCH 28/28] iwlwifi: Streamline irq_tasklet() when ISR debug not used Zhu Yi 0 siblings, 1 reply; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Ben Cahill, Zhu Yi From: Ben Cahill <ben.m.cahill@intel.com> This patch corrects missing hardware detection in iwl_isr(). Signed-off-by: Ben Cahill <ben.m.cahill@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-base.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index ad7e67c..881945d 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -5282,8 +5282,7 @@ static irqreturn_t iwl_isr(int irq, void *data) goto none; } - if ((inta == 0xFFFFFFFF) || (inta == 0xa5a5a5a5) - || (inta == 0x5a5a5a5a)) { + if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { /* Hardware disappeared */ IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); goto none; -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH 28/28] iwlwifi: Streamline irq_tasklet() when ISR debug not used 2007-08-08 7:33 ` [PATCH 27/28] iwlwifi: Correct missing hardware detection in iwl_isr() Zhu Yi @ 2007-08-08 7:33 ` Zhu Yi 0 siblings, 0 replies; 28+ messages in thread From: Zhu Yi @ 2007-08-08 7:33 UTC (permalink / raw) To: linville; +Cc: linux-wireless, Cahill, Ben M, Zhu Yi From: Cahill, Ben M <ben.m.cahill@intel.com> This patch streamlines irq_tasklet() when ISR debug is not used. It also reports MAC_CLK_ACTV interrupt bit and enhance comments. Signed-off-by: Cahill, Ben M <ben.m.cahill@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> --- drivers/net/wireless/iwl-base.c | 35 +++++++++++++++++++++++++---------- 1 files changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c index 881945d..15965fc 100644 --- a/drivers/net/wireless/iwl-base.c +++ b/drivers/net/wireless/iwl-base.c @@ -5125,10 +5125,13 @@ 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); - inta_mask = iwl_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); +#ifdef CONFIG_IWLWIFI_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", + inta, inta_mask, inta_fh); + } +#endif /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not * atomic, make sure that inta covers all the interrupts that @@ -5155,6 +5158,21 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) return; } +#ifdef CONFIG_IWLWIFI_DEBUG + if (iwl_debug_level & (IWL_DL_ISR)) { + /* NIC fires this, but we don't use it, redundant with WAKEUP */ + if (inta & BIT_INT_MAC_CLK_ACTV) + IWL_DEBUG_ISR("Microcode started or stopped.\n"); + + /* Alive notification via Rx interrupt will do the real work */ + if (inta & BIT_INT_ALIVE) + IWL_DEBUG_ISR("Alive interrupt\n"); + } +#endif + /* Safely ignore these bits for debug checks below */ + inta &= ~(BIT_INT_MAC_CLK_ACTV | BIT_INT_ALIVE); + + /* HW RF KILL switch toggled (4965 only) */ if (inta & BIT_INT_RF_KILL) { int hw_rf_kill = 0; if (!(iwl_read32(priv, CSR_GP_CNTRL) & @@ -5175,11 +5193,13 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) handled |= BIT_INT_RF_KILL; } + /* Chip got too hot and stopped itself (4965 only) */ if (inta & BIT_INT_CT_KILL) { IWL_ERROR("Microcode CT kill error detected.\n"); handled |= BIT_INT_CT_KILL; } + /* Error detected by uCode */ if (inta & BIT_INT_SWERROR) { IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", inta); @@ -5187,6 +5207,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) handled |= BIT_INT_SWERROR; } + /* uCode wakes up after power-down sleep */ if (inta & BIT_INT_WAKEUP) { IWL_DEBUG_ISR("Wakeup interrupt\n"); iwl_rx_queue_update_write_ptr(priv, &priv->rxq); @@ -5200,12 +5221,6 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) handled |= BIT_INT_WAKEUP; } - /* Alive notification via Rx interrupt will do the real work */ - if (inta & BIT_INT_ALIVE) { - IWL_DEBUG_ISR("Alive interrupt\n"); - handled |= BIT_INT_ALIVE; - } - /* All uCode command responses, including Tx command responses, * Rx "responses" (frame-received notification), and other * notifications from uCode come through here*/ -- 1.5.2 ^ permalink raw reply related [flat|nested] 28+ messages in thread
end of thread, other threads:[~2007-08-08 7:38 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <11865584251026-git-send-email-yi.zhu@intel.com>
2007-08-08 7:33 ` [PATCH 01/28] iwlwifi: fix a lot of checkpatch.pl warnings Zhu Yi
2007-08-08 7:33 ` [PATCH 02/28] iwlwifi: add more Kconfig options Zhu Yi
2007-08-08 7:33 ` [PATCH 03/28] iwlwifi: Endianity fix for 4965 rate scaling Zhu Yi
2007-08-08 7:33 ` [PATCH 04/28] iwlwifi: Endianity fix for 4965 rx chain selection Zhu Yi
2007-08-08 7:33 ` [PATCH 05/28] iwlwifi: optimize iwl_queue_{inc|dec}_wrap implementation Zhu Yi
2007-08-08 7:33 ` [PATCH 06/28] iwlwifi: use mask operation to replace '%' for index calculation Zhu Yi
2007-08-08 7:33 ` [PATCH 07/28] iwlwifi: make local functions static Zhu Yi
2007-08-08 7:33 ` [PATCH 08/28] iwlwifi: some coding styles cleanup Zhu Yi
2007-08-08 7:33 ` [PATCH 09/28] iwlwifi: replace unnecessary GFP_ATOMIC with GFP_KERNEL Zhu Yi
2007-08-08 7:33 ` [PATCH 10/28] iwlwifi: remove priv stuff zeroing in iwl_pci_probe Zhu Yi
2007-08-08 7:33 ` [PATCH 11/28] iwlwifi: add name for some PCI configuration space registers Zhu Yi
2007-08-08 7:33 ` [PATCH 12/28] iwlwifi: shorten some structure and function names Zhu Yi
2007-08-08 7:33 ` [PATCH 13/28] iwlwifi: define iwl_rx_reply_scan only when CONFIG_IWLWIFI_DEBUG enabled Zhu Yi
2007-08-08 7:33 ` [PATCH 14/28] iwlwifi: remove redundant quotes Zhu Yi
2007-08-08 7:33 ` [PATCH 15/28] iwlwifi: Endianity fix for rxon host commands Zhu Yi
2007-08-08 7:33 ` [PATCH 16/28] iwlwifi: Endianity fix for beacon host command Zhu Yi
2007-08-08 7:33 ` [PATCH 17/28] iwlwifi: Endianity fix for channel number Zhu Yi
2007-08-08 7:33 ` [PATCH 18/28] iwlwifi: shorten more function names Zhu Yi
2007-08-08 7:33 ` [PATCH 19/28] iwlwifi: make iwl_get_bits inline function from macro Zhu Yi
2007-08-08 7:33 ` [PATCH 20/28] iwlwifi: remove BIT_FMT and BIT_ARG Zhu Yi
2007-08-08 7:33 ` [PATCH 21/28] iwlwifi: remove WLAN_FC_GET_TYPE macros Zhu Yi
2007-08-08 7:33 ` [PATCH 22/28] iwlwifi: replace private snprint_line with common hex_dump_xxx Zhu Yi
2007-08-08 7:33 ` [PATCH 23/28] iwlwifi: Endianity fix for frame control Zhu Yi
2007-08-08 7:33 ` [PATCH 24/28] iwlwifi: Endianity fix for ct kill configuration Zhu Yi
2007-08-08 7:33 ` [PATCH 25/28] iwlwifi: remove unused snprint_line Zhu Yi
2007-08-08 7:33 ` [PATCH 26/28] iwlwifi: Enhance ISR/RX/CMD debug messages Zhu Yi
2007-08-08 7:33 ` [PATCH 27/28] iwlwifi: Correct missing hardware detection in iwl_isr() Zhu Yi
2007-08-08 7:33 ` [PATCH 28/28] iwlwifi: Streamline irq_tasklet() when ISR debug not used Zhu Yi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).