iwlwifi: updates intended for v5.1 2019-01-31
cover iwlwifi: updates intended for v5.1 2019-01-31
From: Luca Coelho <[email protected]>
Hi,
Here's the sixth set of patches intended for v5.1. It's the usual development, new features, cleanups and bugfixes.
The changes are:
* More work on the new debugging infrastructure;
* HE radiotap;
* More fixes for static analyzer reported issues;
* General bugfixes;
* Other cleanups and small fixes;
As usual, I'm pushing this to a pending branch, for kbuild bot, and will send a pull-request later.
Please review.
Cheers,
Luca.
Avigail Grinstein (1):
iwlwifi: mvm: support absolute thresholds in bf configuration
Johannes Berg (8):
iwlwifi: mvm: remove redundant condition
iwlwifi: dvm: use %u for sscanf() into unsigned variable
iwlwifi: mvm: add HE TB PPDU SIG-A BW to radiotap
iwlwifi: move config structs to C file
iwlwifi: mvm: don't hide HE radiotap data in SKB
iwlwifi: refactor NIC init sequence
iwlwifi: mvm: fix RFH config command with >=10 CPUs
iwlwifi: implement BISR HW workaround for 22260 devices
Liad Kaufman (2):
iwlwifi: mvm: add tlc command name to output
iwlwifi: mvm: config mac ctxt to HE before TLC
Naftali Goldstein (1):
iwlwifi: mvm: add description to second BAD_COMMAND assert number
Sara Sharon (2):
iwlwifi: mvm: limit AMSDU size to 8K
iwlwifi: mvm: fix RSS config command
Shahar S Matityahu (7):
iwlwifi: dbg_ini: remove redundant dram buffer allocation
iwlwifi: dbg_ini: align struct iwl_fw_ini_region_cfg to the FW
iwlwifi: dbg_ini: create new dump flow and implement prph dump
iwlwifi: dbg_ini: implement csr memory dump
iwlwifi: dbg_ini: implement device internal memory dump
iwlwifi: dbg_ini: implement paging memory dump
iwlwifi: fix send hcmd timeout recovery flow
.../net/wireless/intel/iwlwifi/cfg/22000.c | 3 + .../net/wireless/intel/iwlwifi/dvm/debugfs.c | 3 +- .../wireless/intel/iwlwifi/fw/api/dbg-tlv.h | 40 +- .../net/wireless/intel/iwlwifi/fw/api/power.h | 11 +- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 450 ++++++++++++------ drivers/net/wireless/intel/iwlwifi/fw/dbg.h | 4 + .../wireless/intel/iwlwifi/fw/error-dump.h | 42 +- drivers/net/wireless/intel/iwlwifi/fw/file.h | 3 + drivers/net/wireless/intel/iwlwifi/fw/img.h | 19 +- .../net/wireless/intel/iwlwifi/fw/runtime.h | 2 +- .../net/wireless/intel/iwlwifi/iwl-config.h | 35 +- .../net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 23 +- .../wireless/intel/iwlwifi/iwl-eeprom-read.c | 47 +- drivers/net/wireless/intel/iwlwifi/iwl-io.c | 72 +++ drivers/net/wireless/intel/iwlwifi/iwl-io.h | 5 + .../net/wireless/intel/iwlwifi/iwl-trans.h | 18 + drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 32 +- .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 3 +- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 + drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 1 + .../net/wireless/intel/iwlwifi/mvm/power.c | 20 +- drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 7 +- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 68 ++- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 8 +- .../net/wireless/intel/iwlwifi/mvm/utils.c | 19 +- .../wireless/intel/iwlwifi/pcie/ctxt-info.c | 6 +- .../wireless/intel/iwlwifi/pcie/internal.h | 19 +- .../wireless/intel/iwlwifi/pcie/trans-gen2.c | 21 +- .../net/wireless/intel/iwlwifi/pcie/trans.c | 102 ++-- .../net/wireless/intel/iwlwifi/pcie/tx-gen2.c | 8 +- drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 8 +- include/net/ieee80211_radiotap.h | 6 + 32 files changed, 716 insertions(+), 393 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/21 iwlwifi: mvm: limit AMSDU size to 8K
From: Sara Sharon <[email protected]>
Typically, when not in HE mode, we will not perform well with AMSDUs bigger than 8K.
--- drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/rs.c +6 -1
@@ -1757,7 +1757,12 @@ static void rs_set_amsdu_len(struct iwl_mvm *mvm, struct ieee80211_sta *sta,else mvmsta->amsdu_enabled =0xFFFF ; - mvmsta->max_amsdu_len = sta->max_amsdu_len; +if (mvmsta->vif->bss_conf.he_support && + !iwlwifi_mod_params.disable_11ax) + mvmsta->max_amsdu_len = sta->max_amsdu_len; +else + mvmsta->max_amsdu_len =min_t (int, sta->max_amsdu_len,8500 ); + sta->max_rc_amsdu_len = mvmsta->max_amsdu_len;for (i =0 ; i <IWL_MAX_TID_COUNT ; i++) {
Signature · 1 line
2.20.1
PATCH 2/21 iwlwifi: mvm: remove redundant condition
In reply to Luca CoelhoFrom: Johannes Berg <[email protected]>
In iwl_mvm_sta_alloc_queue_tvqm(), we know that we have a station, so no need to check it.
--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +3 -5
@@ -791,11 +791,9 @@ static int iwl_mvm_sta_alloc_queue_tvqm(struct iwl_mvm *mvm,if (queue <0 )return queue; -if (sta) { - mvmtxq->txq_id = queue; - mvm->tvqm_info[queue].txq_tid = tid; - mvm->tvqm_info[queue].sta_id = mvmsta->sta_id; - } + mvmtxq->txq_id = queue; + mvm->tvqm_info[queue].txq_tid = tid; + mvm->tvqm_info[queue].sta_id = mvmsta->sta_id;IWL_DEBUG_TX_QUEUES (mvm,"Allocated queue is %d\n" , queue);
Signature · 1 line
2.20.1
PATCH 3/21 iwlwifi: mvm: add tlc command name to output
In reply to Luca CoelhoFrom: Liad Kaufman <[email protected]>
Instead of having the command appear as "UNKNOWN" in the dmesg, add the name to it.
--- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +1 -0
@@ -445,6 +445,7 @@ static const struct iwl_hcmd_names iwl_mvm_data_path_names[] = {HCMD_NAME (TRIGGER_RX_QUEUES_NOTIF_CMD ),HCMD_NAME (STA_HE_CTXT_CMD ),HCMD_NAME (RFH_QUEUE_CONFIG_CMD ), +HCMD_NAME (TLC_MNG_CONFIG_CMD ),HCMD_NAME (CHEST_COLLECTOR_FILTER_CONFIG_CMD ),HCMD_NAME (STA_PM_NOTIF ), HCMD_NAME(MU_GROUP_MGMT_NOTIF),
Signature · 1 line
2.20.1
PATCH 4/21 iwlwifi: mvm: config mac ctxt to HE before TLC
In reply to Luca CoelhoFrom: Liad Kaufman <[email protected]>
If we have a station connecting HE, make sure that the MAC ctxt is updated with indication of this before setting the TLC rates via the TLC manager command.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 3 +-- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +1 -2
@@ -706,8 +706,7 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,if (vif->probe_req_reg && vif->bss_conf.assoc && vif->p2p) cmd.filter_flags |=cpu_to_le32 (MAC_FILTER_IN_PROBE_REQUEST ); -if (vif->bss_conf.assoc && vif->bss_conf.he_support && - !iwlwifi_mod_params.disable_11ax) { +if (vif->bss_conf.he_support && !iwlwifi_mod_params.disable_11ax) { cmd.filter_flags |=cpu_to_le32 (MAC_FILTER_IN_11AX );if (vif->bss_conf.twt_requester) ctxt_sta->data_policy |=cpu_to_le32 (TWT_SUPPORTED );
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +4 -0
@@ -3066,11 +3066,15 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, }else if (old_state ==IEEE80211_STA_AUTH && new_state ==IEEE80211_STA_ASSOC ) {if (vif->type ==NL80211_IFTYPE_AP ) { + vif->bss_conf.he_support = sta->he_cap.has_he; mvmvif->ap_assoc_sta_count++;iwl_mvm_mac_ctxt_changed (mvm, vif, false,NULL );if (vif->bss_conf.he_support && !iwlwifi_mod_params.disable_11ax)iwl_mvm_cfg_he_sta (mvm, vif, mvm_sta->sta_id); + }else if (vif->type ==NL80211_IFTYPE_STATION ) { + vif->bss_conf.he_support = sta->he_cap.has_he; +iwl_mvm_mac_ctxt_changed (mvm, vif, false,NULL ); } iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band,
Signature · 1 line
2.20.1
PATCH 5/21 iwlwifi: dvm: use %u for sscanf() into unsigned variable
In reply to Luca CoelhoFrom: Johannes Berg <[email protected]>
Use %u instead of using %d which looks signed but then won't get signed output if using an unsigned variable. It doesn't matter much, but be consistent.
--- drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c +2 -1
@@ -3,6 +3,7 @@* GPL LICENSE SUMMARY * * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. +* Copyright (C) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -2238,7 +2239,7 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file, buf_size =min (count,sizeof (buf) -1 );if (copy_from_user (buf, user_buf, buf_size))return -EFAULT ; -if (sscanf (buf,"%d" , &event_log_flag) !=1 ) +if (sscanf (buf,"%u" , &event_log_flag) !=1 )return -EFAULT ;if (event_log_flag ==1 )iwl_dump_nic_event_log (priv, true,NULL );
Signature · 1 line
2.20.1
PATCH 6/21 iwlwifi: dbg_ini: remove redundant dram buffer allocation
In reply to Luca CoelhoFrom: Shahar S Matityahu <[email protected]>
There are several flows in that can cause redundant allocation.
In case the driver reaches the maximum amount of blocks allowed, it allocates the buffer and only then checks if it reached the maximum amount of blocks and return without freeing the buffer, causing a memory leak.
Solve this by moving the check of the amount of buffers being used before the allocation.
In case there was an assert, the apply points are being reused, causing that for each assert, the driver allocates a new redundant buffer.
Solve this by adding a new is_alloc field to indicate if the driver already allocated memory for the requested buffer.
Also, split iwl_fw_dbg_buffer_allocation function into iwl_fw_dbg_buffer_allocation and iwl_fw_dbg_buffer_apply to increase the clearity of the flow.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 89 +++++++++++-------- drivers/net/wireless/intel/iwlwifi/fw/img.h | 19 ++-- .../net/wireless/intel/iwlwifi/fw/runtime.h | 2 +- .../net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 23 ++++- 4 files changed, 85 insertions(+), 48 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +54 -35
@@ -1131,7 +1131,7 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,if (WARN_ON (reg_id >=ARRAY_SIZE (fwrt->dump.active_regs)))continue ; - reg = fwrt->dump.active_regs[reg_id].reg; + reg = fwrt->dump.active_regs[reg_id];if (WARN (!reg,"Unassigned region %d\n" , reg_id))continue ;
@@ -1197,7 +1197,7 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,if (reg_id >=ARRAY_SIZE (fwrt->dump.active_regs))continue ; - reg = fwrt->dump.active_regs[reg_id].reg; + reg = fwrt->dump.active_regs[reg_id];/* Don't warn, get_trigger_len already warned */ if (!reg)continue ;
@@ -1667,27 +1667,13 @@ void iwl_fw_dbg_read_d3_debug_data(struct iwl_fw_runtime *fwrt)IWL_EXPORT_SYMBOL (iwl_fw_dbg_read_d3_debug_data);static void -iwl_fw_dbg_buffer_allocation (struct iwl_fw_runtime *fwrt, -struct iwl_fw_ini_allocation_tlv *alloc) +iwl_fw_dbg_buffer_allocation (struct iwl_fw_runtime *fwrt,u32 size) {struct iwl_trans *trans = fwrt->trans; -struct iwl_ldbg_config_cmd ldbg_cmd = { - .type =cpu_to_le32 (BUFFER_ALLOCATION ), - }; -struct iwl_buffer_allocation_cmd *cmd = &ldbg_cmd.buffer_allocation; -struct iwl_host_cmd hcmd = { - .id =LDBG_CONFIG_CMD , - .flags =CMD_ASYNC , - .data[0 ] = &ldbg_cmd, - .len[0 ] =sizeof (ldbg_cmd), - };void *virtual_addr =NULL ; -u32 size =le32_to_cpu (alloc->size);dma_addr_t phys_addr; -if (!trans->num_blocks && -le32_to_cpu (alloc->buffer_location) != -IWL_FW_INI_LOCATION_DRAM_PATH ) +if (WARN_ON_ONCE (trans->num_blocks ==ARRAY_SIZE (trans->fw_mon)))return ; virtual_addr =
@@ -1699,25 +1685,52 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt,if (!virtual_addr)IWL_ERR (fwrt,"Failed to allocate debug memory\n" ); -if (WARN_ON_ONCE (trans->num_blocks ==ARRAY_SIZE (trans->fw_mon))) -return ; - trans->fw_mon[trans->num_blocks].block = virtual_addr; trans->fw_mon[trans->num_blocks].physical = phys_addr; trans->fw_mon[trans->num_blocks].size = size; trans->num_blocks++;IWL_DEBUG_FW (trans,"Allocated debug block of size %d\n" , size); +} + +static void iwl_fw_dbg_buffer_apply (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_allocation_data *alloc) +{ +struct iwl_trans *trans = fwrt->trans; +struct iwl_ldbg_config_cmd ldbg_cmd = { + .type =cpu_to_le32 (BUFFER_ALLOCATION ), + }; +struct iwl_buffer_allocation_cmd *cmd = &ldbg_cmd.buffer_allocation; +struct iwl_host_cmd hcmd = { + .id =LDBG_CONFIG_CMD , + .flags =CMD_ASYNC , + .data[0 ] = &ldbg_cmd, + .len[0 ] =sizeof (ldbg_cmd), + }; +int block_idx = trans->num_blocks; + +if (le32_to_cpu (alloc->tlv.buffer_location) != +IWL_FW_INI_LOCATION_DRAM_PATH ) +return ; + +if (!alloc->is_alloc) { +iwl_fw_dbg_buffer_allocation (fwrt, +le32_to_cpu (alloc->tlv.size)); +if (block_idx == trans->num_blocks) +return ; + alloc->is_alloc =1 ; + }/* First block is assigned via registers / context info */ if (trans->num_blocks ==1 )return ; cmd->num_frags =cpu_to_le32 (1 ); - cmd->fragments[0 ].address =cpu_to_le64 (phys_addr); - cmd->fragments[0 ].size = alloc->size; - cmd->allocation_id = alloc->allocation_id; - cmd->buffer_location = alloc->buffer_location; + cmd->fragments[0 ].address = +cpu_to_le64 (trans->fw_mon[block_idx].physical); + cmd->fragments[0 ].size = alloc->tlv.size; + cmd->allocation_id = alloc->tlv.allocation_id; + cmd->buffer_location = alloc->tlv.buffer_location;iwl_trans_send_cmd (trans, &hcmd); }
@@ -1746,9 +1759,8 @@ static void iwl_fw_dbg_update_regions(struct iwl_fw_runtime *fwrt,int i, size =le32_to_cpu (tlv->num_regions);for (i =0 ; i < size; i++) { -struct iwl_fw_ini_region_cfg *reg = iter; +struct iwl_fw_ini_region_cfg *reg = iter, **active;int id =le32_to_cpu (reg->region_id); -struct iwl_fw_ini_active_regs *active;if (WARN (id >=ARRAY_SIZE (fwrt->dump.active_regs),"Invalid region id %d for apply point %d\n" , id, pnt))
@@ -1756,17 +1768,14 @@ static void iwl_fw_dbg_update_regions(struct iwl_fw_runtime *fwrt, active = &fwrt->dump.active_regs[id]; -if (ext && active->apply_point == pnt) -IWL_WARN (fwrt->trans, -"External region TLV overrides FW default %x\n" , - id); +if (*active) +IWL_WARN (fwrt->trans,"region TLV %d override\n" , id);IWL_DEBUG_FW (fwrt,"%s: apply point %d, activating region ID %d\n" , __func__, pnt, id); - active->reg = reg; - active->apply_point = pnt; + *active = reg;if (le32_to_cpu (reg->region_type) !=IWL_FW_INI_REGION_DRAM_BUFFER )
@@ -1842,9 +1851,13 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,u32 type =le32_to_cpu (tlv->type);switch (type) { -case IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION : -iwl_fw_dbg_buffer_allocation (fwrt, ini_tlv); +case IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION : { +struct iwl_fw_ini_allocation_data *buf_alloc = ini_tlv; + +iwl_fw_dbg_buffer_apply (fwrt, ini_tlv); + iter +=sizeof (buf_alloc->is_alloc);break ; + }case IWL_UCODE_TLV_TYPE_HCMD :if (pnt <IWL_FW_INI_APPLY_AFTER_ALIVE ) { IWL_ERR(fwrt,
@@ -1875,6 +1888,12 @@ void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, enum iwl_fw_ini_apply_point apply_point) {void *data = &fwrt->trans->apply_points[apply_point]; +int i; + +if (apply_point ==IWL_FW_INI_APPLY_EARLY ) { +for (i =0 ; i <IWL_FW_INI_MAX_REGION_ID ; i++) + fwrt->dump.active_regs[i] =NULL ; + }_iwl_fw_dbg_apply_point (fwrt, data, apply_point, false);
drivers/net/wireless/intel/iwlwifi/fw/img.h +9 -10
@@ -222,6 +222,15 @@ struct iwl_fw_dbg {u32 dump_mask; }; +/** +* @tlv: the buffer allocation tlv +* @is_alloc: indicates if the buffer was already allocated +*/ +struct iwl_fw_ini_allocation_data { +struct iwl_fw_ini_allocation_tlv tlv; +u32 is_alloc; +} __packed; +/** * struct iwl_fw_ini_active_triggers * @active: is this trigger active
@@ -236,16 +245,6 @@ struct iwl_fw_ini_active_triggers {struct iwl_fw_ini_trigger *conf_ext; }; -/** -* struct iwl_fw_ini_active_regs -* @reg: active region from TLV -* @apply_point: apply point where it became active -*/ -struct iwl_fw_ini_active_regs { -struct iwl_fw_ini_region_cfg *reg; -enum iwl_fw_ini_apply_point apply_point; -}; -/** * struct iwl_fw - variables associated with the firmware *
drivers/net/wireless/intel/iwlwifi/fw/runtime.h +1 -1
@@ -139,7 +139,7 @@ struct iwl_fw_runtime {/* ts of the beginning of a non-collect fw dbg data period */ unsigned long non_collect_ts_start[IWL_FW_TRIGGER_ID_NUM -1 ];u32 *d3_debug_data; -struct iwl_fw_ini_active_regs active_regs[IWL_FW_INI_MAX_REGION_ID ]; +struct iwl_fw_ini_region_cfg *active_regs[IWL_FW_INI_MAX_REGION_ID ];struct iwl_fw_ini_active_triggers active_trigs[IWL_FW_TRIGGER_ID_NUM ];u32 lmac_err_id[MAX_NUM_LMAC ];u32 umac_err_id;
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +21 -2
@@ -71,6 +71,7 @@ void iwl_fw_dbg_copy_tlv(struct iwl_trans *trans, struct iwl_ucode_tlv *tlv,u32 apply_point =le32_to_cpu (header->apply_point);int copy_size =le32_to_cpu (tlv->length) +sizeof (*tlv); +int offset_size = copy_size;if (WARN_ONCE (apply_point >=IWL_FW_INI_APPLY_NUM ,"Invalid apply point id %d\n" , apply_point))
@@ -81,17 +82,25 @@ void iwl_fw_dbg_copy_tlv(struct iwl_trans *trans, struct iwl_ucode_tlv *tlv,else data = &trans->apply_points[apply_point]; +/* add room for is_alloc field in &iwl_fw_ini_allocation_data struct */ +if (le32_to_cpu (tlv->type) ==IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION ) { +struct iwl_fw_ini_allocation_data *buf_alloc = + (void *)tlv->data; + + offset_size +=sizeof (buf_alloc->is_alloc); + } +/* * Make sure we still have room to copy this TLV. Offset points to the * location the last copy ended. */ -if (WARN_ONCE (data->offset + copy_size > data->size, +if (WARN_ONCE (data->offset + offset_size > data->size,"Not enough memory for apply point %d\n" , apply_point))return ;memcpy (data->data + data->offset, (void *)tlv, copy_size); - data->offset += copy_size; + data->offset += offset_size; } void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data,
@@ -129,6 +138,16 @@ void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data,if (WARN_ON (apply >=IWL_FW_INI_APPLY_NUM ))continue ; +/* add room for is_alloc field in &iwl_fw_ini_allocation_data +* struct +*/ +if (tlv_type ==IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION ) { +struct iwl_fw_ini_allocation_data *buf_alloc = + (void *)tlv->data; + + size[apply] +=sizeof (buf_alloc->is_alloc); + } + size[apply] +=sizeof (*tlv) + tlv_len; }
Signature · 1 line
2.20.1
PATCH 7/21 iwlwifi: mvm: add HE TB PPDU SIG-A BW to radiotap
In reply to Luca CoelhoFrom: Johannes Berg <[email protected]>
Expose the trigger-based PPDU SIG-A bandwidth to radiotap in the newly defined bits thereof.
--- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 21 +++++++++++++------ include/net/ieee80211_radiotap.h | 6 ++++++ 2 files changed, 21 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +15 -6
@@ -960,6 +960,7 @@ iwl_mvm_decode_he_phy_ru_alloc(struct iwl_mvm_rx_phy_data *phy_data,* the TSF/timers are not be transmitted in HE-MU. */ u8 ru =le32_get_bits (phy_data->d1,IWL_RX_PHY_DATA1_HE_RU_ALLOC_MASK ); +u32 he_type = rate_n_flags &RATE_MCS_HE_TYPE_MSK ;u8 offs =0 ; rx_status->bw =RATE_INFO_BW_HE_RU ;
@@ -1002,19 +1003,27 @@ iwl_mvm_decode_he_phy_ru_alloc(struct iwl_mvm_rx_phy_data *phy_data, he->data2 |=cpu_to_le16 (IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC ); -if (he_mu) {#define CHECK_BW (bw) \ BUILD_BUG_ON(IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_ ## bw ## MHZ != \ + RATE_MCS_CHAN_WIDTH_##bw >> RATE_MCS_CHAN_WIDTH_POS); \ + BUILD_BUG_ON(IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_ ## bw ## MHZ != \ RATE_MCS_CHAN_WIDTH_##bw >> RATE_MCS_CHAN_WIDTH_POS) -CHECK_BW (20 ); -CHECK_BW (40 ); -CHECK_BW (80 ); -CHECK_BW (160 ); +CHECK_BW (20 ); +CHECK_BW (40 ); +CHECK_BW (80 ); +CHECK_BW (160 ); + +if (he_mu) he_mu->flags2 |=le16_encode_bits (FIELD_GET (RATE_MCS_CHAN_WIDTH_MSK , rate_n_flags),IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW ); - } +else if (he_type ==RATE_MCS_HE_TYPE_TRIG ) + he->data6 |= +cpu_to_le16 (IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN ) | +le16_encode_bits (FIELD_GET (RATE_MCS_CHAN_WIDTH_MSK , + rate_n_flags), +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW ); } static void iwl_mvm_decode_he_phy_data(struct iwl_mvm *mvm,
include/net/ieee80211_radiotap.h +6 -0
@@ -291,6 +291,12 @@ enum ieee80211_radiotap_he_bits {IEEE80211_RADIOTAP_HE_DATA6_NSTS =0x000f ,IEEE80211_RADIOTAP_HE_DATA6_DOPPLER =0x0010 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN =0x0020 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW =0x00c0 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_20MHZ =0 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_40MHZ =1 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_80MHZ =2 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_160MHZ =3 ,IEEE80211_RADIOTAP_HE_DATA6_TXOP =0x7f00 , IEEE80211_RADIOTAP_HE_DATA6_MIDAMBLE_PDCTY = 0x8000, };
Signature · 1 line
2.20.1
Re: [PATCH 07/21] iwlwifi: mvm: add HE TB PPDU SIG-A BW to radiotap
Quoted 7 lines · Luca Coelho
From: Johannes Berg <[email protected]>
Expose the trigger-based PPDU SIG-A bandwidth to radiotap in the newly defined bits thereof.
Signed-off-by Johannes Berg <[email protected]>Signed-off-by Luca Coelho <[email protected]>
[...]
Quoted 5 lines
include/net/ieee80211_radiotap.h +0
-0@@ -291,6 +291,12 @@ enum ieee80211_radiotap_he_bits { IEEE80211_RADIOTAP_HE_DATA6_NSTS = 0x000f,
include/net/ieee80211_radiotap.h enum ieee80211_radiotap_he_bits { · line 302
Quoted 10 lines
include/net/ieee80211_radiotap.h +6
-0IEEE80211_RADIOTAP_HE_DATA6_DOPPLER =0x0010 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN =0x0020 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW =0x00c0 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_20MHZ =0 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_40MHZ =1 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_80MHZ =2 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_160MHZ =3 ,IEEE80211_RADIOTAP_HE_DATA6_TXOP =0x7f00 , IEEE80211_RADIOTAP_HE_DATA6_MIDAMBLE_PDCTY = 0x8000, };
Johannes, as you wrote the patch I take it that you are ok to push this via wireless-drivers-next?
Signature · 1 line
Kalle Valo
Johannes Berg
maintainerRe: [PATCH 07/21] iwlwifi: mvm: add HE TB PPDU SIG-A BW to radiotap
Quoted 16 lines · Kalle Valo
Quoted 7 lines · Luca Coelho
From: Johannes Berg <[email protected]>
Expose the trigger-based PPDU SIG-A bandwidth to radiotap in the newly defined bits thereof.
Signed-off-by Johannes Berg <[email protected]>Signed-off-by Luca Coelho <[email protected]>[...]
Quoted 4 lines
include/net/ieee80211_radiotap.h +0
-0@@ -291,6 +291,12 @@ enum ieee80211_radiotap_he_bits {
Quoted 14 lines
include/net/ieee80211_radiotap.h enum ieee80211_radiotap_he_bits { · line 302
Quoted 11 lines
include/net/ieee80211_radiotap.h +6
-0IEEE80211_RADIOTAP_HE_DATA6_NSTS =0x000f ,IEEE80211_RADIOTAP_HE_DATA6_DOPPLER =0x0010 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN =0x0020 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW =0x00c0 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_20MHZ =0 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_40MHZ =1 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_80MHZ =2 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_160MHZ =3 ,IEEE80211_RADIOTAP_HE_DATA6_TXOP =0x7f00 , IEEE80211_RADIOTAP_HE_DATA6_MIDAMBLE_PDCTY = 0x8000, };Johannes, as you wrote the patch I take it that you are ok to push this via wireless-drivers-next?
Oops, maybe I should've split that, but it doesn't really matter much. Sure, take it.
johannes
Re: [PATCH 07/21] iwlwifi: mvm: add HE TB PPDU SIG-A BW to radiotap
Quoted 32 lines · Johannes Berg
Quoted 16 lines · Kalle Valo
Quoted 7 lines · Luca Coelho
From: Johannes Berg <[email protected]>
Expose the trigger-based PPDU SIG-A bandwidth to radiotap in the newly defined bits thereof.
Signed-off-by Johannes Berg <[email protected]>Signed-off-by Luca Coelho <[email protected]>[...]
Quoted 4 lines
include/net/ieee80211_radiotap.h +0
-0@@ -291,6 +291,12 @@ enum ieee80211_radiotap_he_bits {Quoted 14 lines
include/net/ieee80211_radiotap.h enum ieee80211_radiotap_he_bits { · line 302
Quoted 11 lines
include/net/ieee80211_radiotap.h +6
-0IEEE80211_RADIOTAP_HE_DATA6_NSTS =0x000f ,IEEE80211_RADIOTAP_HE_DATA6_DOPPLER =0x0010 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN =0x0020 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW =0x00c0 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_20MHZ =0 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_40MHZ =1 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_80MHZ =2 , +IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_160MHZ =3 ,IEEE80211_RADIOTAP_HE_DATA6_TXOP =0x7f00 , IEEE80211_RADIOTAP_HE_DATA6_MIDAMBLE_PDCTY = 0x8000, };Johannes, as you wrote the patch I take it that you are ok to push this via wireless-drivers-next?
Quoted 1 line
Oops, maybe I should've split that, but it doesn't really matter much.
IMHO splitting does not make any sense, we had four changes to ieee80211_radiotap.h last year so the chance of conflicts is low :) Just wanted to make sure you are ok with this.
Quoted 1 line
Sure, take it.
Great, thanks. I'll pull this now.
Signature · 1 line
Kalle Valo
PATCH 8/21 iwlwifi: move config structs to C file
In reply to Luca CoelhoFrom: Johannes Berg <[email protected]>
Even if they're static const, there's no need to duplicate the structs every time they're included and used. Move them to an appropriate C file instead.
Also remove useless parentheses along the way.
--- .../net/wireless/intel/iwlwifi/iwl-config.h | 31 ++---------------- drivers/net/wireless/intel/iwlwifi/iwl-io.c | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 29 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-config.h +2 -29
@@ -445,35 +445,8 @@ struct iwl_cfg {u32 d3_debug_data_length; }; -static const struct iwl_csr_params iwl_csr_v1 = { - .flag_mac_clock_ready =0 , - .flag_val_mac_access_en =0 , - .flag_init_done =2 , - .flag_mac_access_req =3 , - .flag_sw_reset =7 , - .flag_master_dis =8 , - .flag_stop_master =9 , - .addr_sw_reset = (CSR_BASE +0x020 ), - .mac_addr0_otp =0x380 , - .mac_addr1_otp =0x384 , - .mac_addr0_strap =0x388 , - .mac_addr1_strap =0x38C -}; - -static const struct iwl_csr_params iwl_csr_v2 = { - .flag_init_done =6 , - .flag_mac_clock_ready =20 , - .flag_val_mac_access_en =20 , - .flag_mac_access_req =21 , - .flag_master_dis =28 , - .flag_stop_master =29 , - .flag_sw_reset =31 , - .addr_sw_reset = (CSR_BASE +0x024 ), - .mac_addr0_otp =0x30 , - .mac_addr1_otp =0x34 , - .mac_addr0_strap =0x38 , - .mac_addr1_strap =0x3C -}; +extern const struct iwl_csr_params iwl_csr_v1; +extern const struct iwl_csr_params iwl_csr_v2;/* * This list declares the config structures for all devices.
drivers/net/wireless/intel/iwlwifi/iwl-io.c +32 -0
@@ -7,6 +7,7 @@* * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2015 - 2016 Intel Deutschland GmbH +* Copyright (C) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as
@@ -28,6 +29,7 @@* * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2015 - 2016 Intel Deutschland GmbH +* Copyright (C) 2018 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -68,6 +70,36 @@#include "iwl-prph.h" #include "iwl-fh.h" +const struct iwl_csr_params iwl_csr_v1 = { + .flag_mac_clock_ready =0 , + .flag_val_mac_access_en =0 , + .flag_init_done =2 , + .flag_mac_access_req =3 , + .flag_sw_reset =7 , + .flag_master_dis =8 , + .flag_stop_master =9 , + .addr_sw_reset =CSR_BASE +0x020 , + .mac_addr0_otp =0x380 , + .mac_addr1_otp =0x384 , + .mac_addr0_strap =0x388 , + .mac_addr1_strap =0x38C +}; + +const struct iwl_csr_params iwl_csr_v2 = { + .flag_init_done =6 , + .flag_mac_clock_ready =20 , + .flag_val_mac_access_en =20 , + .flag_mac_access_req =21 , + .flag_master_dis =28 , + .flag_stop_master =29 , + .flag_sw_reset =31 , + .addr_sw_reset =CSR_BASE +0x024 , + .mac_addr0_otp =0x30 , + .mac_addr1_otp =0x34 , + .mac_addr0_strap =0x38 , + .mac_addr1_strap =0x3C +}; +void iwl_write8 (struct iwl_trans *trans,u32 ofs,u8 val) {trace_iwlwifi_dev_iowrite8 (trans->dev, ofs, val);
Signature · 1 line
2.20.1
PATCH 9/21 iwlwifi: mvm: add description to second BAD_COMMAND assert number
In reply to Luca CoelhoFrom: Naftali Goldstein <[email protected]>
Depending on exactly what happens in the FW, an invalid host-command could result in either assert 0x38 or 0x39. Add 0x39 to the assert-name table.
--- drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/mvm/utils.c +1 -0
@@ -294,6 +294,7 @@ static const struct { { "SYSASSERT", 0x35 }, { "UCODE_VERSION_MISMATCH", 0x37 }, { "BAD_COMMAND", 0x38 }, + { "BAD_COMMAND", 0x39 }, { "NMI_INTERRUPT_DATA_ACTION_PT", 0x3C }, { "FATAL_ERROR", 0x3D }, { "NMI_TRM_HW_ERR", 0x46 },
Signature · 1 line
2.20.1
PATCH 10/21 iwlwifi: mvm: don't hide HE radiotap data in SKB
In reply to Luca CoelhoFrom: Johannes Berg <[email protected]>
Hiding the HE radiotap data for further processing of the SKB just caused another bug when adding the L-SIG data. Simply stop doing this and adjust the skb->data pointer accordingly when we need to get the 802.11 header.
While at it, also verify and fix the data alignment, we need to add 2 bytes padding with the vendor data to ensure the whole length of all radiotap headers is a multiple of 4.
--- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 47 ++++++++++++++----- 1 file changed, 36 insertions(+), 11 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +36 -11
@@ -66,11 +66,37 @@#include "mvm.h" #include "fw-api.h" +static void *iwl_mvm_skb_get_hdr (struct sk_buff *skb) +{ +struct ieee80211_rx_status *rx_status =IEEE80211_SKB_RXCB (skb); +u8 *data = skb->data; + +/* Alignment concerns */ +BUILD_BUG_ON (sizeof (struct ieee80211_radiotap_he ) %4 ); +BUILD_BUG_ON (sizeof (struct ieee80211_radiotap_he_mu ) %4 ); +BUILD_BUG_ON (sizeof (struct ieee80211_radiotap_lsig ) %4 ); +BUILD_BUG_ON (sizeof (struct ieee80211_vendor_radiotap ) %4 ); + +if (rx_status->flag &RX_FLAG_RADIOTAP_HE ) + data +=sizeof (struct ieee80211_radiotap_he ); +if (rx_status->flag &RX_FLAG_RADIOTAP_HE_MU ) + data +=sizeof (struct ieee80211_radiotap_he_mu ); +if (rx_status->flag &RX_FLAG_RADIOTAP_LSIG ) + data +=sizeof (struct ieee80211_radiotap_lsig ); +if (rx_status->flag &RX_FLAG_RADIOTAP_VENDOR_DATA ) { +struct ieee80211_vendor_radiotap *radiotap = (void *)data; + + data +=sizeof (*radiotap) + radiotap->len + radiotap->pad; + } + +return data; +} +static inline int iwl_mvm_check_pn (struct iwl_mvm *mvm,struct sk_buff *skb,int queue,struct ieee80211_sta *sta) {struct iwl_mvm_sta *mvmsta; -struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; +struct ieee80211_hdr *hdr =iwl_mvm_skb_get_hdr (skb);struct ieee80211_rx_status *stats =IEEE80211_SKB_RXCB (skb);struct iwl_mvm_key_pn *ptk_pn;int res;
@@ -197,12 +223,15 @@ static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm, {struct ieee80211_rx_status *rx_status =IEEE80211_SKB_RXCB (skb);struct ieee80211_vendor_radiotap *radiotap; -int size =sizeof (*radiotap) +sizeof (__le16); +const int size =sizeof (*radiotap) +sizeof (__le16);if (!mvm->cur_aid)return ; - radiotap =skb_put (skb, size); +/* ensure alignment */ +BUILD_BUG_ON ((size +2 ) %4 ); + + radiotap =skb_put (skb, size +2 ); radiotap->align =1 ;/* Intel OUI */ radiotap->oui[0 ] =0xf6 ;
@@ -212,10 +241,12 @@ static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm, radiotap->subns =1 ; radiotap->present =0x1 ; radiotap->len = size -sizeof (*radiotap); - radiotap->pad =0 ; + radiotap->pad =2 ;/* fill the data now */ memcpy (radiotap->data, &mvm->cur_aid,sizeof (mvm->cur_aid)); +/* and clear the padding */ +memset (radiotap->data +sizeof (__le16),0 , radiotap->pad); rx_status->flag |=RX_FLAG_RADIOTAP_VENDOR_DATA ; }
@@ -663,7 +694,7 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,struct sk_buff *skb, struct iwl_rx_mpdu_desc *desc) { - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_hdr *hdr = iwl_mvm_skb_get_hdr(skb);struct iwl_mvm_sta *mvm_sta;struct iwl_mvm_baid_data *baid_data;struct iwl_mvm_reorder_buffer *buffer;
@@ -1174,22 +1205,16 @@ static void iwl_mvm_rx_he(struct iwl_mvm *mvm, struct sk_buff *skb, .flags2 = cpu_to_le16(IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN | IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_KNOWN), }; -unsigned int radiotap_len =0 ; he =skb_put_data (skb, &known,sizeof (known)); - radiotap_len +=sizeof (known); rx_status->flag |=RX_FLAG_RADIOTAP_HE ;if (phy_data->info_type ==IWL_RX_PHY_INFO_TYPE_HE_MU || phy_data->info_type ==IWL_RX_PHY_INFO_TYPE_HE_MU_EXT ) { he_mu =skb_put_data (skb, &mu_known,sizeof (mu_known)); - radiotap_len +=sizeof (mu_known); rx_status->flag |=RX_FLAG_RADIOTAP_HE_MU ; } -/* temporarily hide the radiotap data */ -__skb_pull (skb, radiotap_len); -/* report the AMPDU-EOF bit on single frames */ if (!queue && !(phy_info &IWL_RX_MPDU_PHY_AMPDU )) { rx_status->flag |=RX_FLAG_AMPDU_DETAILS ;
Signature · 1 line
2.20.1
PATCH 11/21 iwlwifi: mvm: support absolute thresholds in bf configuration
In reply to Luca CoelhoFrom: Avigail Grinstein <[email protected]>
Update iwl_beacon_filter_cmd to supportBEACON_FILTER_CONFIG_API_S_VER_4.
Currently driver configs them to be zero
(i.e. disable them, so no change is applied).
--- .../net/wireless/intel/iwlwifi/fw/api/power.h | 11 +++++++++- drivers/net/wireless/intel/iwlwifi/fw/file.h | 3 +++ .../net/wireless/intel/iwlwifi/mvm/power.c | 20 ++++++++++++++++++- 3 files changed, 32 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/power.h +10 -1
@@ -470,6 +470,13 @@ struct iwl_geo_tx_power_profiles_resp {* @ba_escape_timer: Fully receive and parse beacon if no beacons were passed * for a longer period of time then this escape-timeout. Units: Beacons. * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled. +* @bf_threshold_absolute_low: See below. +* @bf_threshold_absolute_high: Send Beacon to driver if Energy value calculated +* for this beacon crossed this absolute threshold. For the 'Increase' +* direction the bf_energy_absolute_low[i] is used. For the 'Decrease' +* direction the bf_energy_absolute_high[i] is used. Zero value means +* that this specific threshold is ignored for beacon filtering, and +* beacon will not be forced to be sent to driver due to this setting. */ struct iwl_beacon_filter_cmd {__le32 bf_energy_delta;
@@ -483,7 +490,9 @@ struct iwl_beacon_filter_cmd {__le32 bf_escape_timer;__le32 ba_escape_timer;__le32 ba_enable_beacon_abort; -} __packed; +__le32 bf_threshold_absolute_low[2 ]; +__le32 bf_threshold_absolute_high[2 ]; +} __packed;/* BEACON_FILTER_CONFIG_API_S_VER_4 */ /* Beacon filtering and beacon abort */ #define IWL_BF_ENERGY_DELTA_DEFAULT 5
drivers/net/wireless/intel/iwlwifi/fw/file.h +3 -0
@@ -265,6 +265,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_api_t;* the REDUCE_TX_POWER_CMD. * @IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF: This ucode supports the short * version of the beacon notification. +* @IWL_UCODE_TLV_API_BEACON_FILTER_V4: This ucode supports v4 of +* BEACON_FILTER_CONFIG_API_S_VER_4. * * @NUM_IWL_UCODE_TLV_API: number of bits used */
@@ -290,6 +292,7 @@ enum iwl_ucode_tlv_api {IWL_UCODE_TLV_API_FRAG_EBS = (__force iwl_ucode_tlv_api_t )44 ,IWL_UCODE_TLV_API_REDUCE_TX_POWER = (__force iwl_ucode_tlv_api_t )45 ,IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF = (__force iwl_ucode_tlv_api_t )46 , +IWL_UCODE_TLV_API_BEACON_FILTER_V4 = (__force iwl_ucode_tlv_api_t )47 , NUM_IWL_UCODE_TLV_API#ifdef __CHECKER__
drivers/net/wireless/intel/iwlwifi/mvm/power.c +19 -1
@@ -8,6 +8,7 @@* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH * Copyright(c) 2015 - 2017 Intel Deutschland GmbH +* Copyright (C) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -30,6 +31,7 @@* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH * Copyright(c) 2015 - 2017 Intel Deutschland GmbH +* Copyright (C) 2018 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -79,6 +81,8 @@ int iwl_mvm_beacon_filter_send_cmd(struct iwl_mvm *mvm, struct iwl_beacon_filter_cmd *cmd, u32 flags) { +u16 len; +IWL_DEBUG_POWER (mvm,"ba_enable_beacon_abort is: %d\n" ,le32_to_cpu (cmd->ba_enable_beacon_abort)); IWL_DEBUG_POWER(mvm, "ba_escape_timer is: %d\n",
@@ -101,9 +105,23 @@ int iwl_mvm_beacon_filter_send_cmd(struct iwl_mvm *mvm, le32_to_cpu(cmd->bf_temp_fast_filter));IWL_DEBUG_POWER (mvm,"bf_temp_slow_filter is: %d\n" ,le32_to_cpu (cmd->bf_temp_slow_filter)); +IWL_DEBUG_POWER (mvm,"bf_threshold_absolute_low is: %d, %d\n" , +le32_to_cpu (cmd->bf_threshold_absolute_low[0 ]), +le32_to_cpu (cmd->bf_threshold_absolute_low[1 ])); + +IWL_DEBUG_POWER (mvm,"bf_threshold_absolute_high is: %d, %d\n" , +le32_to_cpu (cmd->bf_threshold_absolute_high[0 ]), +le32_to_cpu (cmd->bf_threshold_absolute_high[1 ])); + +if (fw_has_api (&mvm->fw->ucode_capa, +IWL_UCODE_TLV_API_BEACON_FILTER_V4 )) + len =sizeof (struct iwl_beacon_filter_cmd ); +else + len = offsetof(struct iwl_beacon_filter_cmd , + bf_threshold_absolute_low);return iwl_mvm_send_cmd_pdu (mvm,REPLY_BEACON_FILTERING_CMD , flags, -sizeof (struct iwl_beacon_filter_cmd ), cmd); + len, cmd); } static
Signature · 1 line
2.20.1
PATCH 12/21 iwlwifi: mvm: fix RSS config command
In reply to Luca CoelhoFrom: Sara Sharon <[email protected]>
The hash mask is a bitmap, so we should use BIT() on the enum values.
--- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/fw.c +6 -6
@@ -105,12 +105,12 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)int i;struct iwl_rss_config_cmd cmd = { .flags =cpu_to_le32 (IWL_RSS_ENABLE ), - .hash_mask =IWL_RSS_HASH_TYPE_IPV4_TCP | -IWL_RSS_HASH_TYPE_IPV4_UDP | -IWL_RSS_HASH_TYPE_IPV4_PAYLOAD | -IWL_RSS_HASH_TYPE_IPV6_TCP | -IWL_RSS_HASH_TYPE_IPV6_UDP | -IWL_RSS_HASH_TYPE_IPV6_PAYLOAD , + .hash_mask =BIT (IWL_RSS_HASH_TYPE_IPV4_TCP ) | +BIT (IWL_RSS_HASH_TYPE_IPV4_UDP ) | +BIT (IWL_RSS_HASH_TYPE_IPV4_PAYLOAD ) | +BIT (IWL_RSS_HASH_TYPE_IPV6_TCP ) | +BIT (IWL_RSS_HASH_TYPE_IPV6_UDP ) | +BIT (IWL_RSS_HASH_TYPE_IPV6_PAYLOAD ), };if (mvm->trans->num_rx_queues ==1 )
Signature · 1 line
2.20.1
PATCH 13/21 iwlwifi: dbg_ini: align struct iwl_fw_ini_region_cfg to the FW
In reply to Luca CoelhoFrom: Shahar S Matityahu <[email protected]>
New fields were added to struct iwl_fw_ini_region_cfg. add those field and apply the changes the result from this change
offset field is used to differentiate between the different LMACs and any memory access to the region addresses should be base_addr + offset.
A fifo struct is to hold the meta data needed for fifo regions
Also move range_data_size and num_of_ranges into a struct under the union to be aligned to the struct in the FW.
--- .../wireless/intel/iwlwifi/fw/api/dbg-tlv.h | 40 +++++++++++++++--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 41 ++++++++++++------- 2 files changed, 60 insertions(+), 21 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h +34 -6
@@ -133,6 +133,33 @@ struct iwl_fw_ini_debug_flow_tlv {#define IWL_FW_INI_MAX_REGION_ID 64#define IWL_FW_INI_MAX_NAME 32 + +/** +* struct iwl_fw_ini_region_cfg_internal - meta data of internal memory region +* @num_of_range: the amount of ranges in the region +* @range_data_size: size of the data to read per range, in bytes. +*/ +struct iwl_fw_ini_region_cfg_internal { +__le32 num_of_ranges; +__le32 range_data_size; +} __packed;/* FW_DEBUG_TLV_REGION_NIC_INTERNAL_RANGES_S */ + +/** +* struct iwl_fw_ini_region_cfg_fifos - meta data of fifos region +* @lmac1_id: bit map of lmac1 fifos to include in the region. +* @lmac2_id: bit map of lmac2 fifos to include in the region. +* @num_of_registers: number of prph registers in the region, each register is +* 4 bytes size. +* @header_only: none zero value indicates that this region does not include +* fifo data and includes only the given registers. +*/ +struct iwl_fw_ini_region_cfg_fifos { +__le32 lmac1_id; +__le32 lmac2_id; +__le32 num_of_registers; +__le32 header_only; +} __packed;/* FW_DEBUG_TLV_REGION_FIFOS_S */ +/** * struct iwl_fw_ini_region_cfg * @region_id: ID of this dump configuration
@@ -140,11 +167,11 @@ struct iwl_fw_ini_debug_flow_tlv {* @num_regions: amount of regions in the address array. * @name_len: name length * @name: file name to use for this region -* @num_of_range: the amount of ranges in the region. +* @internal: used in case the region uses internal memory. * @allocation_id: For DRAM type field substitutes for allocation_id -* @range_data_size: size of the data to read per range, in bytes. -* @start_addr: array of addresses. for type IWL_FW_INI_REGION_DRAM_BUFFER, -* 1 entry. For any other case, num_of_ranges entries. +* @fifos: used in case of fifos region. +* @offset: offset to use for each memory base address +* @start_addr: array of addresses. */ struct iwl_fw_ini_region_cfg {__le32 region_id;
@@ -152,10 +179,11 @@ struct iwl_fw_ini_region_cfg {__le32 name_len;u8 name[IWL_FW_INI_MAX_NAME ];union { -__le32 num_of_ranges; +struct iwl_fw_ini_region_cfg_internal internal;__le32 allocation_id; +struct iwl_fw_ini_region_cfg_fifos fifos; }; -__le32 range_data_size; +__le32 offset;__le32 start_addr[]; } __packed;/* FW_DEBUG_TLV_REGION_CONFIG_S */
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +26 -15
99 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 14/21 iwlwifi: dbg_ini: create new dump flow and implement prph dump
In reply to Luca CoelhoFrom: Shahar S Matityahu <[email protected]>
Create a skeleton to unite all memory dumps in ini mode. Implement prph dump with the new skeleton.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 164 +++++++++++++----- drivers/net/wireless/intel/iwlwifi/fw/dbg.h | 4 + .../wireless/intel/iwlwifi/fw/error-dump.h | 34 ++++ 3 files changed, 163 insertions(+), 39 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +125 -39
@@ -1062,33 +1062,6 @@ _iwl_fw_error_dump(struct iwl_fw_runtime *fwrt,return dump_file; } -static void iwl_dump_prph_ini (struct iwl_trans *trans, -struct iwl_fw_error_dump_data **data, -struct iwl_fw_ini_region_cfg *reg) -{ -struct iwl_fw_error_dump_prph *prph; -unsigned long flags; -u32 i, size =le32_to_cpu (reg->internal.num_of_ranges); - -IWL_DEBUG_INFO (trans,"WRT PRPH dump\n" ); - -if (!iwl_trans_grab_nic_access (trans, &flags)) -return ; - -for (i =0 ; i < size; i++) { - (*data)->type =cpu_to_le32 (IWL_FW_ERROR_DUMP_PRPH ); - (*data)->len = -cpu_to_le32 (le32_to_cpu (reg->internal.range_data_size) + -sizeof (*prph)); - prph = (void *)(*data)->data; - prph->prph_start = reg->start_addr[i]; - prph->data[0 ] =cpu_to_le32 (iwl_read_prph_no_grab (trans, -le32_to_cpu (prph->prph_start))); - *data =iwl_fw_error_next_data (*data); - } -iwl_trans_release_nic_access (trans, &flags); -} -static void iwl_dump_csr_ini (struct iwl_trans *trans,struct iwl_fw_error_dump_data **data,struct iwl_fw_ini_region_cfg *reg)
@@ -1114,20 +1087,131 @@ static void iwl_dump_csr_ini(struct iwl_trans *trans, } } +static int iwl_dump_ini_prph_iter (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_error_dump_range *range, +struct iwl_fw_ini_region_cfg *reg, +int idx) +{ +__le32 *val = range->data; +u32 addr, prph_val, offset =le32_to_cpu (reg->offset); +int i; + + range->start_addr = reg->start_addr[idx]; + range->range_data_size = reg->internal.range_data_size; +for (i =0 ; i <le32_to_cpu (reg->internal.range_data_size); i +=4 ) { + addr =le32_to_cpu (range->start_addr) + i; + prph_val =iwl_read_prph (fwrt->trans, addr + offset); +if (prph_val ==0x5a5a5a5a ) +return -1 ; + *val++ =cpu_to_le32 (prph_val); + } +return le32_to_cpu (range->range_data_size); +} + +static struct iwl_fw_ini_error_dump_range +*iwl_dump_ini_mem_fill_header (struct iwl_fw_runtime *fwrt,void *data) +{ +struct iwl_fw_ini_error_dump *dump = data; + +return dump->ranges; +} + +static u32 iwl_dump_ini_mem_get_size (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_region_cfg *reg) +{ +return le32_to_cpu (reg->internal.num_of_ranges) * +le32_to_cpu (reg->internal.range_data_size); +} + +static u32 iwl_dump_ini_mem_ranges (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_region_cfg *reg) +{ +return le32_to_cpu (reg->internal.num_of_ranges); +} + +/** +* struct iwl_dump_ini_mem_ops - ini memory dump operations +* @get_num_of_ranges: returns the number of memory ranges in the region. +* @get_size: returns the size of the region data without headers. +* @fill_mem_hdr: fills region type specific headers and returns the first +* range or NULL if failed to fill headers. +* @fill_range: copies a given memory range into the dump. +* Returns the size of the range or -1 otherwise. +*/ +struct iwl_dump_ini_mem_ops { +u32 (*get_num_of_ranges)(struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_region_cfg *reg); +u32 (*get_size)(struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_region_cfg *reg); +struct iwl_fw_ini_error_dump_range * + (*fill_mem_hdr)(struct iwl_fw_runtime *fwrt,void *data); +int (*fill_range)(struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_error_dump_range *range, +struct iwl_fw_ini_region_cfg *reg,int idx); +}; + +/** +* iwl_dump_ini_mem - copy a memory region into the dump +* @fwrt: fw runtime struct. +* @data: dump memory data. +* @reg: region to copy to the dump. +*/ +static void +iwl_dump_ini_mem (struct iwl_fw_runtime *fwrt, +enum iwl_fw_ini_region_type type, +struct iwl_fw_error_dump_data **data, +struct iwl_fw_ini_region_cfg *reg, +struct iwl_dump_ini_mem_ops *ops) +{ +struct iwl_fw_ini_error_dump_header *header = (void *)(*data)->data; +struct iwl_fw_ini_error_dump_range *range; +u32 num_of_ranges, i; + +if (WARN_ON (!ops || !ops->get_num_of_ranges || !ops->get_size || + !ops->fill_mem_hdr || !ops->fill_range)) +return ; + + num_of_ranges = ops->get_num_of_ranges (fwrt, reg); + + (*data)->type =cpu_to_le32 (type |INI_DUMP_BIT ); + (*data)->len =cpu_to_le32 (sizeof (*header) + num_of_ranges * +sizeof (*range) + ops->get_size (fwrt, reg)); + + header->num_of_ranges =cpu_to_le32 (num_of_ranges); + header->name_len =cpu_to_le32 (min_t (int,IWL_FW_INI_MAX_NAME , +le32_to_cpu (reg->name_len))); +memcpy (header->name, reg->name,le32_to_cpu (header->name_len)); + + range = ops->fill_mem_hdr (fwrt, header); +if (!range) +return ; + +for (i =0 ; i < num_of_ranges; i++) { +int range_data_size = ops->fill_range (fwrt, range, reg, i); + +if (range_data_size <0 ) { +IWL_ERR (fwrt,"Failed to dump region type %d\n" , type); +return ; + } + range = ((void *)range) +sizeof (*range) + range_data_size; + } + *data =iwl_fw_error_next_data (*data); +} +static int iwl_fw_ini_get_trigger_len (struct iwl_fw_runtime *fwrt,struct iwl_fw_ini_trigger *trigger) { -int i, num, size =0 , hdr_len =sizeof (struct iwl_fw_error_dump_data ); +int i, size =0 , hdr_len =sizeof (struct iwl_fw_error_dump_data ); +u32 dump_header_len =sizeof (struct iwl_fw_ini_error_dump ); +u32 range_header_len =sizeof (struct iwl_fw_ini_error_dump_range );if (!trigger || !trigger->num_regions)return 0 ; - num =le32_to_cpu (trigger->num_regions); -for (i =0 ; i < num; i++) { +for (i =0 ; i <le32_to_cpu (trigger->num_regions); i++) {u32 reg_id =le32_to_cpu (trigger->data[i]);struct iwl_fw_ini_region_cfg *reg;enum iwl_fw_ini_region_type type; -u32 num_entries;if (WARN_ON (reg_id >=ARRAY_SIZE (fwrt->dump.active_regs)))continue ;
@@ -1137,8 +1221,6 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,continue ; type =le32_to_cpu (reg->region_type); - num_entries =le32_to_cpu (reg->internal.num_of_ranges); -switch (type) {case IWL_FW_INI_REGION_DEVICE_MEMORY : size += hdr_len +
@@ -1148,10 +1230,9 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,case IWL_FW_INI_REGION_PERIPHERY_MAC :case IWL_FW_INI_REGION_PERIPHERY_PHY :case IWL_FW_INI_REGION_PERIPHERY_AUX : - size += num_entries * - (hdr_len + -sizeof (struct iwl_fw_error_dump_prph ) + -sizeof (u32)); + size += hdr_len + dump_header_len + range_header_len * +iwl_dump_ini_mem_ranges (fwrt, reg) + +iwl_dump_ini_mem_get_size (fwrt, reg);break ;case IWL_FW_INI_REGION_TXF : size +=iwl_fw_txf_len (fwrt, &fwrt->smem_cfg);
@@ -1168,7 +1249,7 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt, PAGING_BLOCK_SIZE);break ;case IWL_FW_INI_REGION_CSR : - size += num_entries * + size +=le32_to_cpu (reg->internal.num_of_ranges) * (hdr_len +le32_to_cpu (reg->internal.range_data_size));break ;
@@ -1195,6 +1276,7 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,u32 reg_id =le32_to_cpu (trigger->data[i]);enum iwl_fw_ini_region_type type;struct iwl_fw_ini_region_cfg *reg; +struct iwl_dump_ini_mem_ops ops;if (reg_id >=ARRAY_SIZE (fwrt->dump.active_regs))continue ;
@@ -1223,7 +1305,11 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,case IWL_FW_INI_REGION_PERIPHERY_MAC :case IWL_FW_INI_REGION_PERIPHERY_PHY :case IWL_FW_INI_REGION_PERIPHERY_AUX : -iwl_dump_prph_ini (fwrt->trans, data, reg); + ops.get_num_of_ranges = iwl_dump_ini_mem_ranges; + ops.get_size = iwl_dump_ini_mem_get_size; + ops.fill_mem_hdr = iwl_dump_ini_mem_fill_header; + ops.fill_range = iwl_dump_ini_prph_iter; +iwl_dump_ini_mem (fwrt, type, data, reg, &ops);break ;case IWL_FW_INI_REGION_DRAM_BUFFER : *dump_mask |=BIT (IWL_FW_ERROR_DUMP_FW_MONITOR );
drivers/net/wireless/intel/iwlwifi/fw/dbg.h +4 -0
@@ -441,4 +441,8 @@ void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, enum iwl_fw_ini_apply_point apply_point);void iwl_fwrt_stop_device (struct iwl_fw_runtime *fwrt); + +/* This bit is used to differentiate the legacy dump from the ini dump */ +#define INI_DUMP_BIT BIT(31) +#endif /* __iwl_fw_dbg_h__ */
drivers/net/wireless/intel/iwlwifi/fw/error-dump.h +34 -0
@@ -290,6 +290,40 @@ struct iwl_fw_error_dump_named_mem {u8 data[]; }; +/** +* struct iwl_fw_ini_error_dump_range - range of memory +* @start_addr: the start address of this range +* @range_data_size: the size of this range, in bytes +* @data: the actual memory +*/ +struct iwl_fw_ini_error_dump_range { +__le32 start_addr; +__le32 range_data_size; +__le32 data[]; +} __packed; + +/** +* struct iwl_fw_ini_error_dump_header - ini region dump header +* @num_of_ranges: number of ranges in this region +* @name_len: number of bytes allocated to the name string of this region +* @name: name of the region +*/ +struct iwl_fw_ini_error_dump_header { +__le32 num_of_ranges; +__le32 name_len; +u8 name[IWL_FW_INI_MAX_NAME ]; +}; + +/** +* struct iwl_fw_ini_error_dump - ini region dump +* @header: the header of this region +* @ranges: the memory ranges of this this region +*/ +struct iwl_fw_ini_error_dump { +struct iwl_fw_ini_error_dump_header header; +struct iwl_fw_ini_error_dump_range ranges[]; +} __packed; +/** * struct iwl_fw_error_dump_rb - content of an Receive Buffer * @index: the index of the Receive Buffer in the Rx queue
Signature · 1 line
2.20.1
PATCH 15/21 iwlwifi: dbg_ini: implement csr memory dump
In reply to Luca CoelhoFrom: Shahar S Matityahu <[email protected]>
Implement csr memory dump in the new dump mechanism.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 56 +++++++++------------ 1 file changed, 25 insertions(+), 31 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +25 -31
@@ -1062,31 +1062,6 @@ _iwl_fw_error_dump(struct iwl_fw_runtime *fwrt,return dump_file; } -static void iwl_dump_csr_ini (struct iwl_trans *trans, -struct iwl_fw_error_dump_data **data, -struct iwl_fw_ini_region_cfg *reg) -{ -int i, num =le32_to_cpu (reg->internal.num_of_ranges); -u32 size =le32_to_cpu (reg->internal.range_data_size); - -IWL_DEBUG_INFO (trans,"WRT CSR dump\n" ); - -for (i =0 ; i < num; i++) { -u32 add =le32_to_cpu (reg->start_addr[i]); -__le32 *val; -int j; - - (*data)->type =cpu_to_le32 (IWL_FW_ERROR_DUMP_CSR ); - (*data)->len =cpu_to_le32 (size); - val = (void *)(*data)->data; - -for (j =0 ; j < size; j +=4 ) - *val++ =cpu_to_le32 (iwl_trans_read32 (trans, j + add)); - - *data =iwl_fw_error_next_data (*data); - } -} - static int iwl_dump_ini_prph_iter(struct iwl_fw_runtime *fwrt, struct iwl_fw_ini_error_dump_range *range, struct iwl_fw_ini_region_cfg *reg,
@@ -1108,6 +1083,25 @@ static int iwl_dump_ini_prph_iter(struct iwl_fw_runtime *fwrt,return le32_to_cpu (range->range_data_size); } +static int iwl_dump_ini_csr_iter (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_error_dump_range *range, +struct iwl_fw_ini_region_cfg *reg, +int idx) +{ +__le32 *val = range->data; +u32 addr, offset =le32_to_cpu (reg->offset); +int i; + + range->start_addr = reg->start_addr[idx]; + range->range_data_size = reg->internal.range_data_size; +for (i =0 ; i <le32_to_cpu (reg->internal.range_data_size); i +=4 ) { + addr =le32_to_cpu (range->start_addr) + i; + *val++ =cpu_to_le32 (iwl_trans_read32 (fwrt->trans, + addr + offset)); + } +return le32_to_cpu (range->range_data_size); +} +static struct iwl_fw_ini_error_dump_range *iwl_dump_ini_mem_fill_header (struct iwl_fw_runtime *fwrt,void *data) {
@@ -1230,6 +1224,7 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,case IWL_FW_INI_REGION_PERIPHERY_MAC :case IWL_FW_INI_REGION_PERIPHERY_PHY :case IWL_FW_INI_REGION_PERIPHERY_AUX : +case IWL_FW_INI_REGION_CSR : size += hdr_len + dump_header_len + range_header_len *iwl_dump_ini_mem_ranges (fwrt, reg) +iwl_dump_ini_mem_get_size (fwrt, reg);
@@ -1248,11 +1243,6 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,sizeof (struct iwl_fw_error_dump_paging ) + PAGING_BLOCK_SIZE);break ; -case IWL_FW_INI_REGION_CSR : - size +=le32_to_cpu (reg->internal.num_of_ranges) * - (hdr_len + -le32_to_cpu (reg->internal.range_data_size)); -break ;case IWL_FW_INI_REGION_DRAM_BUFFER :/* Transport takes care of DRAM dumping */ case IWL_FW_INI_REGION_INTERNAL_BUFFER :
@@ -1327,7 +1317,11 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,iwl_fw_dump_rxf (fwrt, data);break ;case IWL_FW_INI_REGION_CSR : -iwl_dump_csr_ini (fwrt->trans, data, reg); + ops.get_num_of_ranges = iwl_dump_ini_mem_ranges; + ops.get_size = iwl_dump_ini_mem_get_size; + ops.fill_mem_hdr = iwl_dump_ini_mem_fill_header; + ops.fill_range = iwl_dump_ini_csr_iter; +iwl_dump_ini_mem (fwrt, type, data, reg, &ops);break ;case IWL_FW_INI_REGION_DRAM_IMR :case IWL_FW_INI_REGION_INTERNAL_BUFFER :
Signature · 1 line
2.20.1
PATCH 16/21 iwlwifi: dbg_ini: implement device internal memory dump
In reply to Luca CoelhoFrom: Shahar S Matityahu <[email protected]>
Implement device internal memory dump in the new dump mechanism.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 60 +++++++------------ .../wireless/intel/iwlwifi/fw/error-dump.h | 16 ----- 2 files changed, 21 insertions(+), 55 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +21 -39
@@ -707,28 +707,6 @@ static void iwl_fw_dump_mem(struct iwl_fw_runtime *fwrt,IWL_DEBUG_INFO (fwrt,"WRT memory dump. Type=%u\n" , dump_mem->type); } -static void iwl_fw_dump_named_mem (struct iwl_fw_runtime *fwrt, -struct iwl_fw_error_dump_data **dump_data, -u32 len,u32 ofs,u8 *name,u8 name_len) -{ -struct iwl_fw_error_dump_named_mem *dump_mem; - -if (!len) -return ; - - (*dump_data)->type =cpu_to_le32 (IWL_FW_ERROR_DUMP_MEM ); - (*dump_data)->len =cpu_to_le32 (len +sizeof (*dump_mem)); - dump_mem = (void *)(*dump_data)->data; - dump_mem->type =cpu_to_le32 (IWL_FW_ERROR_DUMP_MEM_NAMED_MEM ); - dump_mem->offset =cpu_to_le32 (ofs); - dump_mem->name_len = name_len; -memcpy (dump_mem->name, name, name_len); -iwl_trans_read_mem_bytes (fwrt->trans, ofs, dump_mem->data, len); - *dump_data =iwl_fw_error_next_data (*dump_data); - -IWL_DEBUG_INFO (fwrt,"WRT memory dump. Type=%u\n" , dump_mem->type); -} -#define ADD_LEN (len, item_len, const_len) \ do {size_t item = item_len; len += (!!item) * const_len + item; } \ while (0)
@@ -1102,6 +1080,21 @@ static int iwl_dump_ini_csr_iter(struct iwl_fw_runtime *fwrt,return le32_to_cpu (range->range_data_size); } +static int iwl_dump_ini_dev_mem_iter (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_error_dump_range *range, +struct iwl_fw_ini_region_cfg *reg, +int idx) +{ +u32 addr =le32_to_cpu (range->start_addr); +u32 offset =le32_to_cpu (reg->offset); + + range->start_addr = reg->start_addr[idx]; + range->range_data_size = reg->internal.range_data_size; +iwl_trans_read_mem_bytes (fwrt->trans, addr + offset, range->data, +le32_to_cpu (reg->internal.range_data_size)); +return le32_to_cpu (range->range_data_size); +} +static struct iwl_fw_ini_error_dump_range *iwl_dump_ini_mem_fill_header (struct iwl_fw_runtime *fwrt,void *data) {
@@ -1217,10 +1210,6 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt, type =le32_to_cpu (reg->region_type);switch (type) {case IWL_FW_INI_REGION_DEVICE_MEMORY : - size += hdr_len + -sizeof (struct iwl_fw_error_dump_named_mem ) + -le32_to_cpu (reg->internal.range_data_size); -break ;case IWL_FW_INI_REGION_PERIPHERY_MAC :case IWL_FW_INI_REGION_PERIPHERY_PHY :case IWL_FW_INI_REGION_PERIPHERY_AUX :
@@ -1278,20 +1267,13 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt, type =le32_to_cpu (reg->region_type);switch (type) { -case IWL_FW_INI_REGION_DEVICE_MEMORY : { -u32 num_of_ranges = -le32_to_cpu (reg->internal.num_of_ranges); -u32 range_data_size = -le32_to_cpu (reg->internal.range_data_size); - -if (WARN_ON (num_of_ranges) >1 ) -continue ; -iwl_fw_dump_named_mem (fwrt, data, range_data_size, -le32_to_cpu (reg->start_addr[0 ]), - reg->name, -le32_to_cpu (reg->name_len)); +case IWL_FW_INI_REGION_DEVICE_MEMORY : + ops.get_num_of_ranges = iwl_dump_ini_mem_ranges; + ops.get_size = iwl_dump_ini_mem_get_size; + ops.fill_mem_hdr = iwl_dump_ini_mem_fill_header; + ops.fill_range = iwl_dump_ini_dev_mem_iter; +iwl_dump_ini_mem (fwrt, type, data, reg, &ops);break ; - }case IWL_FW_INI_REGION_PERIPHERY_MAC :case IWL_FW_INI_REGION_PERIPHERY_PHY :case IWL_FW_INI_REGION_PERIPHERY_AUX :
drivers/net/wireless/intel/iwlwifi/fw/error-dump.h +0 -16
@@ -274,22 +274,6 @@ struct iwl_fw_error_dump_mem {u8 data[]; }; -/** -* struct iwl_fw_error_dump_named_mem - chunk of memory -* @type: &enum iwl_fw_error_dump_mem_type -* @offset: the offset from which the memory was read -* @name_len: name length -* @name: file name -* @data: the content of the memory -*/ -struct iwl_fw_error_dump_named_mem { -__le32 type; -__le32 offset; -u8 name_len; -u8 name[32 ]; -u8 data[]; -}; -/** * struct iwl_fw_ini_error_dump_range - range of memory * @start_addr: the start address of this range
Signature · 1 line
2.20.1
PATCH 17/21 iwlwifi: dbg_ini: implement paging memory dump
In reply to Luca CoelhoFrom: Shahar S Matityahu <[email protected]>
Implement paging memory dump in the new dump mechanism.
To support this change, moved iwl_self_init_dram strcut from trans_pcie to trans so that it will accessible via fw_runtime.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 114 ++++++++++++++++-- .../net/wireless/intel/iwlwifi/iwl-trans.h | 15 +++ .../wireless/intel/iwlwifi/pcie/ctxt-info.c | 6 +- .../wireless/intel/iwlwifi/pcie/internal.h | 18 +-- .../net/wireless/intel/iwlwifi/pcie/trans.c | 10 +- 5 files changed, 125 insertions(+), 38 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +102 -12
@@ -1095,6 +1095,43 @@ static int iwl_dump_ini_dev_mem_iter(struct iwl_fw_runtime *fwrt,return le32_to_cpu (range->range_data_size); } +static int +iwl_dump_ini_paging_gen2_iter (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_error_dump_range *range, +struct iwl_fw_ini_region_cfg *reg, +int idx) +{ +u32 page_size = fwrt->trans->init_dram.paging[idx].size; + + range->start_addr =cpu_to_le32 (idx); + range->range_data_size =cpu_to_le32 (page_size); +memcpy (range->data, fwrt->trans->init_dram.paging[idx].block, + page_size); +return le32_to_cpu (range->range_data_size); +} + +static int iwl_dump_ini_paging_iter (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_error_dump_range *range, +struct iwl_fw_ini_region_cfg *reg, +int idx) +{ +/* increase idx by 1 since the pages are from 1 to +* fwrt->num_of_paging_blk + 1 +*/ +struct page *page = fwrt->fw_paging_db[++idx].fw_paging_block; +dma_addr_t addr = fwrt->fw_paging_db[idx].fw_paging_phys; +u32 page_size = fwrt->fw_paging_db[idx].fw_paging_size; + + range->start_addr =cpu_to_le32 (idx); + range->range_data_size =cpu_to_le32 (page_size); +dma_sync_single_for_cpu (fwrt->trans->dev, addr, page_size, +DMA_BIDIRECTIONAL ); +memcpy (range->data,page_address (page), page_size); +dma_sync_single_for_device (fwrt->trans->dev, addr, page_size, +DMA_BIDIRECTIONAL ); +return le32_to_cpu (range->range_data_size); +} +static struct iwl_fw_ini_error_dump_range *iwl_dump_ini_mem_fill_header (struct iwl_fw_runtime *fwrt,void *data) {
@@ -1110,12 +1147,46 @@ static u32 iwl_dump_ini_mem_get_size(struct iwl_fw_runtime *fwrt,le32_to_cpu (reg->internal.range_data_size); } +static u32 iwl_dump_ini_paging_gen2_get_size (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_region_cfg *reg) +{ +int i; +u32 size =0 ; + +for (i =0 ; i < fwrt->trans->init_dram.paging_cnt; i++) + size += fwrt->trans->init_dram.paging[i].size; +return size; +} + +static u32 iwl_dump_ini_paging_get_size (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_region_cfg *reg) +{ +int i; +u32 size =0 ; + +for (i =1 ; i <= fwrt->num_of_paging_blk; i++) + size += fwrt->fw_paging_db[i].fw_paging_size; +return size; +} +static u32 iwl_dump_ini_mem_ranges (struct iwl_fw_runtime *fwrt,struct iwl_fw_ini_region_cfg *reg) {return le32_to_cpu (reg->internal.num_of_ranges); } +static u32 iwl_dump_ini_paging_gen2_ranges (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_region_cfg *reg) +{ +return fwrt->trans->init_dram.paging_cnt; +} + +static u32 iwl_dump_ini_paging_ranges (struct iwl_fw_runtime *fwrt, +struct iwl_fw_ini_region_cfg *reg) +{ +return fwrt->num_of_paging_blk; +} +/** * struct iwl_dump_ini_mem_ops - ini memory dump operations * @get_num_of_ranges: returns the number of memory ranges in the region.
@@ -1224,14 +1295,21 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,case IWL_FW_INI_REGION_RXF : size +=iwl_fw_rxf_len (fwrt, &fwrt->smem_cfg);break ; -case IWL_FW_INI_REGION_PAGING : -if (!iwl_fw_dbg_is_paging_enabled (fwrt)) -break ; - size += fwrt->num_of_paging_blk * - (hdr_len + -sizeof (struct iwl_fw_error_dump_paging ) + -PAGING_BLOCK_SIZE ); +case IWL_FW_INI_REGION_PAGING : { + size += hdr_len + dump_header_len; +if (iwl_fw_dbg_is_paging_enabled (fwrt)) { + size += range_header_len * +iwl_dump_ini_paging_ranges (fwrt, reg) + +iwl_dump_ini_paging_get_size (fwrt, reg); + }else { + size += range_header_len * +iwl_dump_ini_paging_gen2_ranges (fwrt, + reg) + +iwl_dump_ini_paging_gen2_get_size (fwrt, + reg); + }break ; + }case IWL_FW_INI_REGION_DRAM_BUFFER :/* Transport takes care of DRAM dumping */ case IWL_FW_INI_REGION_INTERNAL_BUFFER :
@@ -1286,12 +1364,24 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,case IWL_FW_INI_REGION_DRAM_BUFFER : *dump_mask |=BIT (IWL_FW_ERROR_DUMP_FW_MONITOR );break ; -case IWL_FW_INI_REGION_PAGING : -if (iwl_fw_dbg_is_paging_enabled (fwrt)) -iwl_dump_paging (fwrt, data); -else - *dump_mask |=BIT (IWL_FW_ERROR_DUMP_PAGING ); +case IWL_FW_INI_REGION_PAGING : { + ops.fill_mem_hdr = iwl_dump_ini_mem_fill_header; +if (iwl_fw_dbg_is_paging_enabled (fwrt)) { + ops.get_num_of_ranges = + iwl_dump_ini_paging_ranges; + ops.get_size = iwl_dump_ini_paging_get_size; + ops.fill_range = iwl_dump_ini_paging_iter; + }else { + ops.get_num_of_ranges = + iwl_dump_ini_paging_gen2_ranges; + ops.get_size = + iwl_dump_ini_paging_gen2_get_size; + ops.fill_range = iwl_dump_ini_paging_gen2_iter; + } + +iwl_dump_ini_mem (fwrt, type, data, reg, &ops);break ; + }case IWL_FW_INI_REGION_TXF :iwl_fw_dump_txf (fwrt, data);break ;
drivers/net/wireless/intel/iwlwifi/iwl-trans.h +15 -0
@@ -700,6 +700,20 @@ struct iwl_dram_data {int size; }; +/** +* struct iwl_self_init_dram - dram data used by self init process +* @fw: lmac and umac dram data +* @fw_cnt: total number of items in array +* @paging: paging dram data +* @paging_cnt: total number of items in array +*/ +struct iwl_self_init_dram { +struct iwl_dram_data *fw; +int fw_cnt; +struct iwl_dram_data *paging; +int paging_cnt; +}; +/** * struct iwl_trans - transport common data *
@@ -794,6 +808,7 @@ struct iwl_trans {u8 dbg_n_dest_reg;int num_blocks;struct iwl_dram_data fw_mon[IWL_FW_INI_APPLY_NUM ]; +struct iwl_self_init_dram init_dram;enum iwl_plat_pm_mode system_pm_mode;enum iwl_plat_pm_mode runtime_pm_mode;
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c +2 -4
@@ -59,8 +59,7 @@void iwl_pcie_ctxt_info_free_paging (struct iwl_trans *trans) { -struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans); -struct iwl_self_init_dram *dram = &trans_pcie->init_dram; +struct iwl_self_init_dram *dram = &trans->init_dram;int i;if (!dram->paging) {
@@ -83,8 +82,7 @@ int iwl_pcie_init_fw_sec(struct iwl_trans *trans,const struct fw_img *fw, struct iwl_context_info_dram *ctxt_dram) { - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); -struct iwl_self_init_dram *dram = &trans_pcie->init_dram; + struct iwl_self_init_dram *dram = &trans->init_dram;int i, ret, lmac_cnt, umac_cnt, paging_cnt; if (WARN(dram->paging,
drivers/net/wireless/intel/iwlwifi/pcie/internal.h +1 -17
@@ -453,20 +453,6 @@ enum iwl_image_response_code { IWL_IMAGE_RESP_FAIL = 2, }; -/** -* struct iwl_self_init_dram - dram data used by self init process -* @fw: lmac and umac dram data -* @fw_cnt: total number of items in array -* @paging: paging dram data -* @paging_cnt: total number of items in array -*/ -struct iwl_self_init_dram { -struct iwl_dram_data *fw; -int fw_cnt; -struct iwl_dram_data *paging; -int paging_cnt; -}; -/** * struct cont_rec: continuous recording data structure * @prev_wr_ptr: the last address that was read in monitor_data
@@ -554,7 +540,6 @@ struct iwl_trans_pcie {dma_addr_t prph_info_dma_addr;dma_addr_t prph_scratch_dma_addr;dma_addr_t iml_dma_addr; -struct iwl_self_init_dram init_dram;struct iwl_trans *trans;struct net_device napi_dev;
@@ -813,8 +798,7 @@ static inline int iwl_pcie_ctxt_info_alloc_dma(struct iwl_trans *trans,static inline void iwl_pcie_ctxt_info_free_fw_img (struct iwl_trans *trans) { -struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans); -struct iwl_self_init_dram *dram = &trans_pcie->init_dram; +struct iwl_self_init_dram *dram = &trans->init_dram;int i;if (!dram->fw) {
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +5 -5
@@ -3220,10 +3220,10 @@ static struct iwl_trans_dump_data/* Paged memory for gen2 HW */ if (trans->cfg->gen2 && dump_mask &BIT (IWL_FW_ERROR_DUMP_PAGING )) -for (i =0 ; i < trans_pcie->init_dram.paging_cnt; i++) +for (i =0 ; i < trans->init_dram.paging_cnt; i++) len +=sizeof (*data) +sizeof (struct iwl_fw_error_dump_paging ) + - trans_pcie->init_dram.paging[i].size; + trans->init_dram.paging[i].size; dump_data =vzalloc (len);if (!dump_data)
@@ -3275,16 +3275,16 @@ static struct iwl_trans_dump_data/* Paged memory for gen2 HW */ if (trans->cfg->gen2 && dump_mask &BIT (IWL_FW_ERROR_DUMP_PAGING )) { -for (i =0 ; i < trans_pcie->init_dram.paging_cnt; i++) { +for (i =0 ; i < trans->init_dram.paging_cnt; i++) {struct iwl_fw_error_dump_paging *paging; -u32 page_len = trans_pcie->init_dram.paging[i].size; +u32 page_len = trans->init_dram.paging[i].size; data->type =cpu_to_le32 (IWL_FW_ERROR_DUMP_PAGING ); data->len =cpu_to_le32 (sizeof (*paging) + page_len); paging = (void *)data->data; paging->index =cpu_to_le32 (i);memcpy (paging->data, - trans_pcie->init_dram.paging[i].block, page_len); + trans->init_dram.paging[i].block, page_len); data =iwl_fw_error_next_data (data); len +=sizeof (*data) +sizeof (*paging) + page_len;
Signature · 1 line
2.20.1
PATCH 18/21 iwlwifi: fix send hcmd timeout recovery flow
In reply to Luca CoelhoFrom: Shahar S Matityahu <[email protected]>
Both iwl_trans_fw_error and iwl_force_nmi initiate async recovery flow. Calling them both is redundant and causing a race.
Solve this by removing the call to iwl_trans_fw_error.
--- .../net/wireless/intel/iwlwifi/iwl-trans.h | 3 +++ .../wireless/intel/iwlwifi/pcie/internal.h | 1 + .../net/wireless/intel/iwlwifi/pcie/trans.c | 25 +++++++++++++++++++ .../net/wireless/intel/iwlwifi/pcie/tx-gen2.c | 8 +++--- drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 8 +++--- 5 files changed, 35 insertions(+), 10 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-trans.h +3 -0
@@ -688,6 +688,9 @@ enum iwl_plat_pm_mode {*/ #define IWL_TRANS_IDLE_TIMEOUT 2000 +/* Max time to wait for nmi interrupt */ +#define IWL_TRANS_NMI_TIMEOUT (HZ / 4) +/** * struct iwl_dram_data * @physical: page phy pointer
drivers/net/wireless/intel/iwlwifi/pcie/internal.h +1 -0
@@ -1036,6 +1036,7 @@ static inline bool iwl_pcie_dbg_on(struct iwl_trans *trans)void iwl_trans_pcie_rf_kill (struct iwl_trans *trans,bool state);void iwl_trans_pcie_dump_regs (struct iwl_trans *trans); +void iwl_trans_sync_nmi (struct iwl_trans *trans);#ifdef CONFIG_IWLWIFI_DEBUGFS int iwl_trans_pcie_dbgfs_register (struct iwl_trans *trans);
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +25 -0
@@ -3650,3 +3650,28 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,iwl_trans_free (trans);return ERR_PTR (ret); } + +void iwl_trans_sync_nmi (struct iwl_trans *trans) +{ +unsigned long timeout = jiffies +IWL_TRANS_NMI_TIMEOUT ; + +iwl_disable_interrupts (trans); +iwl_force_nmi (trans); +while (time_after (timeout, jiffies)) { +u32 inta_hw =iwl_read32 (trans, +CSR_MSIX_HW_INT_CAUSES_AD ); + +/* Error detected by uCode */ +if (inta_hw &MSIX_HW_INT_CAUSES_REG_SW_ERR ) { +/* Clear causes register */ +iwl_write32 (trans,CSR_MSIX_HW_INT_CAUSES_AD , + inta_hw & +MSIX_HW_INT_CAUSES_REG_SW_ERR ); +break ; + } + +mdelay (1 ); + } +iwl_enable_interrupts (trans); +iwl_trans_fw_error (trans); +}
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +3 -5
@@ -6,7 +6,7 @@* GPL LICENSE SUMMARY * * Copyright(c) 2017 Intel Deutschland GmbH -* Copyright(c) 2018 Intel Corporation +* Copyright(c) 2018 - 2019 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -20,7 +20,7 @@* BSD LICENSE * * Copyright(c) 2017 Intel Deutschland GmbH -* Copyright(c) 2018 Intel Corporation +* Copyright(c) 2018 - 2019 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -965,9 +965,7 @@ static int iwl_pcie_gen2_send_hcmd_sync(struct iwl_trans *trans, cmd_str); ret = -ETIMEDOUT ; -iwl_force_nmi (trans); -iwl_trans_fw_error (trans); - +iwl_trans_sync_nmi (trans); goto cancel; }
drivers/net/wireless/intel/iwlwifi/pcie/tx.c +3 -5
@@ -8,7 +8,7 @@* Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH -* Copyright(c) 2018 Intel Corporation +* Copyright(c) 2018 - 2019 Intel Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@* Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH -* Copyright(c) 2018 Intel Corporation +* Copyright(c) 2018 - 2019 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -1942,9 +1942,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans, iwl_get_cmd_string(trans, cmd->id)); ret = -ETIMEDOUT ; -iwl_force_nmi (trans); -iwl_trans_fw_error (trans); - +iwl_trans_sync_nmi (trans); goto cancel; }
Signature · 1 line
2.20.1
PATCH 19/21 iwlwifi: refactor NIC init sequence
In reply to Luca CoelhoFrom: Johannes Berg <[email protected]>
The typical sequence of setting INIT_DONE and then waiting for clock stabilisation is going to need a new workarounds, so first of all refactor it.
--- .../wireless/intel/iwlwifi/iwl-eeprom-read.c | 47 ++++++------- drivers/net/wireless/intel/iwlwifi/iwl-io.c | 30 +++++++++ drivers/net/wireless/intel/iwlwifi/iwl-io.h | 5 ++ .../net/wireless/intel/iwlwifi/mvm/utils.c | 18 +---- .../wireless/intel/iwlwifi/pcie/trans-gen2.c | 21 +----- .../net/wireless/intel/iwlwifi/pcie/trans.c | 67 +++---------------- 6 files changed, 66 insertions(+), 122 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-eeprom-read.c +19 -28
@@ -193,34 +193,25 @@ static int iwl_init_otp_access(struct iwl_trans *trans) {int ret; -/* Enable 40MHz radio clock */ -iwl_write32 (trans,CSR_GP_CNTRL , -iwl_read32 (trans,CSR_GP_CNTRL ) | -BIT (trans->cfg->csr->flag_init_done)); - -/* wait for clock to be ready */ - ret =iwl_poll_bit (trans,CSR_GP_CNTRL , -BIT (trans->cfg->csr->flag_mac_clock_ready), -BIT (trans->cfg->csr->flag_mac_clock_ready), -25000 ); -if (ret <0 ) { -IWL_ERR (trans,"Time out access OTP\n" ); - }else { -iwl_set_bits_prph (trans,APMG_PS_CTRL_REG , -APMG_PS_CTRL_VAL_RESET_REQ ); -udelay (5 ); -iwl_clear_bits_prph (trans,APMG_PS_CTRL_REG , -APMG_PS_CTRL_VAL_RESET_REQ ); - -/* -* CSR auto clock gate disable bit - -* this is only applicable for HW with OTP shadow RAM -*/ -if (trans->cfg->base_params->shadow_ram_support) -iwl_set_bit (trans,CSR_DBG_LINK_PWR_MGMT_REG , -CSR_RESET_LINK_PWR_MGMT_DISABLED ); - } -return ret; + ret =iwl_finish_nic_init (trans); +if (ret) +return ret; + +iwl_set_bits_prph (trans,APMG_PS_CTRL_REG , +APMG_PS_CTRL_VAL_RESET_REQ ); +udelay (5 ); +iwl_clear_bits_prph (trans,APMG_PS_CTRL_REG , +APMG_PS_CTRL_VAL_RESET_REQ ); + +/* +* CSR auto clock gate disable bit - +* this is only applicable for HW with OTP shadow RAM +*/ +if (trans->cfg->base_params->shadow_ram_support) +iwl_set_bit (trans,CSR_DBG_LINK_PWR_MGMT_REG , +CSR_RESET_LINK_PWR_MGMT_DISABLED ); + +return 0 ; } static int iwl_read_otp_word(struct iwl_trans *trans, u16 addr,
drivers/net/wireless/intel/iwlwifi/iwl-io.c +30 -0
@@ -488,3 +488,33 @@ int iwl_dump_fh(struct iwl_trans *trans, char **buf)return 0 ; } + +int iwl_finish_nic_init (struct iwl_trans *trans) +{ +int err; + +/* +* Set "initialization complete" bit to move adapter from +* D0U* --> D0A* (powered-up active) state. +*/ +iwl_set_bit (trans,CSR_GP_CNTRL , +BIT (trans->cfg->csr->flag_init_done)); + +if (trans->cfg->device_family ==IWL_DEVICE_FAMILY_8000 ) +udelay (2 ); + +/* +* Wait for clock stabilization; once stabilized, access to +* device-internal resources is supported, e.g. iwl_write_prph() +* and accesses to uCode SRAM. +*/ + err =iwl_poll_bit (trans,CSR_GP_CNTRL , +BIT (trans->cfg->csr->flag_mac_clock_ready), +BIT (trans->cfg->csr->flag_mac_clock_ready), +25000 ); +if (err <0 ) +IWL_DEBUG_INFO (trans,"Failed to wake NIC\n" ); + +return err <0 ? err :0 ; +} +IWL_EXPORT_SYMBOL (iwl_finish_nic_init);
drivers/net/wireless/intel/iwlwifi/iwl-io.h +5 -0
@@ -5,6 +5,8 @@* * GPL LICENSE SUMMARY * +* Copyright (C) 2018 Intel Corporation +* * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation.
@@ -23,6 +25,7 @@* * BSD LICENSE * +* Copyright (C) 2018 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -96,6 +99,8 @@ void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs,void iwl_clear_bits_prph (struct iwl_trans *trans,u32 ofs,u32 mask);void iwl_force_nmi (struct iwl_trans *trans); +int iwl_finish_nic_init (struct iwl_trans *trans); +/* Error handling */ int iwl_dump_fh (struct iwl_trans *trans,char **buf);
drivers/net/wireless/intel/iwlwifi/mvm/utils.c +2 -16
@@ -523,23 +523,9 @@ static void iwl_mvm_dump_lmac_error_log(struct iwl_mvm *mvm, u8 lmac_num)/* reset the device */ iwl_trans_sw_reset (trans); -/* set INIT_DONE flag */ -iwl_set_bit (trans,CSR_GP_CNTRL , -BIT (trans->cfg->csr->flag_init_done)); - -/* and wait for clock stabilization */ -if (trans->cfg->device_family ==IWL_DEVICE_FAMILY_8000 ) -udelay (2 ); - - err =iwl_poll_bit (trans,CSR_GP_CNTRL , -BIT (trans->cfg->csr->flag_mac_clock_ready), -BIT (trans->cfg->csr->flag_mac_clock_ready), -25000 ); -if (err <0 ) { -IWL_DEBUG_INFO (trans, -"Failed to reset the card for the dump\n" ); + err =iwl_finish_nic_init (trans); +if (err)return ; - } }iwl_trans_read_mem_bytes (trans, base, &table,sizeof (table));
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +2 -19
@@ -92,26 +92,9 @@ int iwl_pcie_gen2_apm_init(struct iwl_trans *trans)iwl_pcie_apm_config (trans); -/* -* Set "initialization complete" bit to move adapter from -* D0U* --> D0A* (powered-up active) state. -*/ -iwl_set_bit (trans,CSR_GP_CNTRL , -BIT (trans->cfg->csr->flag_init_done)); - -/* -* Wait for clock stabilization; once stabilized, access to -* device-internal resources is supported, e.g. iwl_write_prph() -* and accesses to uCode SRAM. -*/ - ret =iwl_poll_bit (trans,CSR_GP_CNTRL , -BIT (trans->cfg->csr->flag_mac_clock_ready), -BIT (trans->cfg->csr->flag_mac_clock_ready), -25000 ); -if (ret <0 ) { -IWL_DEBUG_INFO (trans,"Failed to init the card\n" ); + ret =iwl_finish_nic_init (trans); +if (ret)return ret; - }set_bit (STATUS_DEVICE_ENABLED , &trans->status);
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +8 -59
95 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 20/21 iwlwifi: mvm: fix RFH config command with >=10 CPUs
In reply to Luca CoelhoFrom: Johannes Berg <[email protected]>
If we have >=10 (logical) CPUs, our command size exceeds the internal buffer size and the command fails; fix that by using IWL_HCMD_DFL_NOCOPY for the command that's allocated anyway.
While at it, also fix the leak of cmd, and use struct_size() to calculate its size.
--- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/fw.c +14 -6
@@ -127,13 +127,17 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)static int iwl_configure_rxq (struct iwl_mvm *mvm) { -int i, num_queues, size; +int i, num_queues, size, ret;struct iwl_rfh_queue_config *cmd; +struct iwl_host_cmd hcmd = { + .id =WIDE_ID (DATA_PATH_GROUP ,RFH_QUEUE_CONFIG_CMD ), + .dataflags[0 ] =IWL_HCMD_DFL_NOCOPY , + };/* Do not configure default queue, it is configured via context info */ num_queues = mvm->trans->num_rx_queues -1 ; - size =sizeof (*cmd) + num_queues *sizeof (struct iwl_rfh_queue_data ); + size =struct_size (cmd, data, num_queues); cmd =kzalloc (size,GFP_KERNEL );if (!cmd)
@@ -154,10 +158,14 @@ static int iwl_configure_rxq(struct iwl_mvm *mvm) cmd->data[i].fr_bd_wid =cpu_to_le32 (data.fr_bd_wid); } -return iwl_mvm_send_cmd_pdu (mvm, -WIDE_ID (DATA_PATH_GROUP , -RFH_QUEUE_CONFIG_CMD ), -0 , size, cmd); + hcmd.data[0 ] = cmd; + hcmd.len[0 ] = size; + + ret =iwl_mvm_send_cmd (mvm, &hcmd); + +kfree (cmd); + +return ret; }static int iwl_mvm_send_dqa_cmd (struct iwl_mvm *mvm)
Signature · 1 line
2.20.1
PATCH 21/21 iwlwifi: implement BISR HW workaround for 22260 devices
In reply to Luca CoelhoFrom: Johannes Berg <[email protected]>
There's a small hardware bug in 22260 devices which thus require a few more delays during initialization. Implement this workaround.
--- drivers/net/wireless/intel/iwlwifi/cfg/22000.c | 3 +++ drivers/net/wireless/intel/iwlwifi/iwl-config.h | 4 +++- drivers/net/wireless/intel/iwlwifi/iwl-io.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/cfg/22000.c +3 -0
@@ -220,6 +220,7 @@ const struct iwl_cfg iwl22260_2ax_cfg = {* HT size; mac80211 would otherwise pick the HE max (256) by default. */ .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, + .bisr_workaround = 1, };const struct iwl_cfg killer1650x_2ax_cfg = {
@@ -232,6 +233,7 @@ const struct iwl_cfg killer1650x_2ax_cfg = {* HT size; mac80211 would otherwise pick the HE max (256) by default. */ .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, + .bisr_workaround = 1, };const struct iwl_cfg killer1650w_2ax_cfg = {
@@ -244,6 +246,7 @@ const struct iwl_cfg killer1650w_2ax_cfg = {* HT size; mac80211 would otherwise pick the HE max (256) by default. */ .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, + .bisr_workaround = 1, };/*
drivers/net/wireless/intel/iwlwifi/iwl-config.h +3 -1
@@ -379,6 +379,7 @@ struct iwl_csr_params {* @nvm_type: see &enum iwl_nvm_type * @d3_debug_data_base_addr: base address where D3 debug data is stored * @d3_debug_data_length: length of the D3 debug data +* @bisr_workaround: BISR hardware workaround (for 22260 series devices) * * We enable the driver to be backward compatible wrt. hardware features. * API differences in uCode shouldn't be handled here but through TLVs
@@ -428,7 +429,8 @@ struct iwl_cfg { use_tfh:1, gen2:1, cdb:1, - dbgc_supported:1; + dbgc_supported:1, + bisr_workaround:1;u8 valid_tx_ant;u8 valid_rx_ant;u8 non_shared_ant;
drivers/net/wireless/intel/iwlwifi/iwl-io.c +10 -0
@@ -493,6 +493,11 @@ int iwl_finish_nic_init(struct iwl_trans *trans) {int err; +if (trans->cfg->bisr_workaround) { +/* ensure the TOP FSM isn't still in previous reset */ +mdelay (2 ); + } +/* * Set "initialization complete" bit to move adapter from * D0U* --> D0A* (powered-up active) state.
@@ -515,6 +520,11 @@ int iwl_finish_nic_init(struct iwl_trans *trans)if (err <0 )IWL_DEBUG_INFO (trans,"Failed to wake NIC\n" ); +if (trans->cfg->bisr_workaround) { +/* ensure BISR shift has finished */ +udelay (200 ); + } +return err <0 ? err :0 ; }IWL_EXPORT_SYMBOL (iwl_finish_nic_init);
Signature · 1 line
2.20.1