Skip to content

Commit 3425997

Browse files
committed
Merge tag 'wireless-drivers-for-davem-2019-04-30' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers
Kalle Valo says: ==================== wireless-drivers fixes for 5.1 Third set of fixes for 5.1. iwlwifi * fix an oops when creating debugfs entries * fix bug when trying to capture debugging info while in rfkill * prevent potential uninitialized memory dumps into debugging logs * fix some initialization parameters for AX210 devices * fix an oops with non-MSIX devices * fix an oops when we receive a packet with bogus lengths * fix a bug that prevented 5350 devices from working * fix a small merge damage from the previous series mwifiex * fig regression with resume on SDIO ath10k * fix locking problem with crashdump * fix warnings during suspend and resume Also note that this pull conflicts with net-next. And I want to emphasie that it's really net-next, so when you pull this to net tree it should go without conflicts. Stephen reported the conflict here: https://lkml.kernel.org/r/[email protected] In iwlwifi oddly commit 154d489 adds the IS_ERR_OR_NULL() in wireless-drivers but commit c9af752 removes the whole check in wireless-drivers-next. The fix is easy, just drop the whole check for mvmvif->dbgfs_dir in iwlwifi/mvm/debugfs-vif.c, it's unneeded anyway. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents a622b40 + 7a0f8ad commit 3425997

File tree

17 files changed

+88
-35
lines changed

17 files changed

+88
-35
lines changed

drivers/net/wireless/ath/ath10k/ce.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ void ath10k_ce_dump_registers(struct ath10k *ar,
18551855
struct ath10k_ce_crash_data ce_data;
18561856
u32 addr, id;
18571857

1858-
lockdep_assert_held(&ar->data_lock);
1858+
lockdep_assert_held(&ar->dump_mutex);
18591859

18601860
ath10k_err(ar, "Copy Engine register dump:\n");
18611861

drivers/net/wireless/ath/ath10k/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3119,6 +3119,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
31193119
goto err_free_wq;
31203120

31213121
mutex_init(&ar->conf_mutex);
3122+
mutex_init(&ar->dump_mutex);
31223123
spin_lock_init(&ar->data_lock);
31233124

31243125
INIT_LIST_HEAD(&ar->peers);

drivers/net/wireless/ath/ath10k/core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,9 @@ struct ath10k {
10631063
/* prevents concurrent FW reconfiguration */
10641064
struct mutex conf_mutex;
10651065

1066+
/* protects coredump data */
1067+
struct mutex dump_mutex;
1068+
10661069
/* protects shared structure data */
10671070
spinlock_t data_lock;
10681071

drivers/net/wireless/ath/ath10k/coredump.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)
11021102
{
11031103
struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data;
11041104

1105-
lockdep_assert_held(&ar->data_lock);
1105+
lockdep_assert_held(&ar->dump_mutex);
11061106

11071107
if (ath10k_coredump_mask == 0)
11081108
/* coredump disabled */
@@ -1146,7 +1146,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
11461146
if (!buf)
11471147
return NULL;
11481148

1149-
spin_lock_bh(&ar->data_lock);
1149+
mutex_lock(&ar->dump_mutex);
11501150

11511151
dump_data = (struct ath10k_dump_file_data *)(buf);
11521152
strlcpy(dump_data->df_magic, "ATH10K-FW-DUMP",
@@ -1213,7 +1213,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
12131213
sofar += sizeof(*dump_tlv) + crash_data->ramdump_buf_len;
12141214
}
12151215

1216-
spin_unlock_bh(&ar->data_lock);
1216+
mutex_unlock(&ar->dump_mutex);
12171217

12181218
return dump_data;
12191219
}

drivers/net/wireless/ath/ath10k/mac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5774,7 +5774,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
57745774
}
57755775

57765776
if (changed & BSS_CHANGED_MCAST_RATE &&
5777-
!WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) {
5777+
!ath10k_mac_vif_chan(arvif->vif, &def)) {
57785778
band = def.chan->band;
57795779
rateidx = vif->bss_conf.mcast_rate[band] - 1;
57805780

@@ -5812,7 +5812,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
58125812
}
58135813

58145814
if (changed & BSS_CHANGED_BASIC_RATES) {
5815-
if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) {
5815+
if (ath10k_mac_vif_chan(vif, &def)) {
58165816
mutex_unlock(&ar->conf_mutex);
58175817
return;
58185818
}

drivers/net/wireless/ath/ath10k/pci.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ static void ath10k_pci_dump_registers(struct ath10k *ar,
14411441
__le32 reg_dump_values[REG_DUMP_COUNT_QCA988X] = {};
14421442
int i, ret;
14431443

1444-
lockdep_assert_held(&ar->data_lock);
1444+
lockdep_assert_held(&ar->dump_mutex);
14451445

14461446
ret = ath10k_pci_diag_read_hi(ar, &reg_dump_values[0],
14471447
hi_failure_state,
@@ -1656,7 +1656,7 @@ static void ath10k_pci_dump_memory(struct ath10k *ar,
16561656
int ret, i;
16571657
u8 *buf;
16581658

1659-
lockdep_assert_held(&ar->data_lock);
1659+
lockdep_assert_held(&ar->dump_mutex);
16601660

16611661
if (!crash_data)
16621662
return;
@@ -1734,14 +1734,19 @@ static void ath10k_pci_dump_memory(struct ath10k *ar,
17341734
}
17351735
}
17361736

1737-
static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
1737+
static void ath10k_pci_fw_dump_work(struct work_struct *work)
17381738
{
1739+
struct ath10k_pci *ar_pci = container_of(work, struct ath10k_pci,
1740+
dump_work);
17391741
struct ath10k_fw_crash_data *crash_data;
1742+
struct ath10k *ar = ar_pci->ar;
17401743
char guid[UUID_STRING_LEN + 1];
17411744

1742-
spin_lock_bh(&ar->data_lock);
1745+
mutex_lock(&ar->dump_mutex);
17431746

1747+
spin_lock_bh(&ar->data_lock);
17441748
ar->stats.fw_crash_counter++;
1749+
spin_unlock_bh(&ar->data_lock);
17451750

17461751
crash_data = ath10k_coredump_new(ar);
17471752

@@ -1756,11 +1761,18 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
17561761
ath10k_ce_dump_registers(ar, crash_data);
17571762
ath10k_pci_dump_memory(ar, crash_data);
17581763

1759-
spin_unlock_bh(&ar->data_lock);
1764+
mutex_unlock(&ar->dump_mutex);
17601765

17611766
queue_work(ar->workqueue, &ar->restart_work);
17621767
}
17631768

1769+
static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
1770+
{
1771+
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1772+
1773+
queue_work(ar->workqueue, &ar_pci->dump_work);
1774+
}
1775+
17641776
void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
17651777
int force)
17661778
{
@@ -3442,6 +3454,8 @@ int ath10k_pci_setup_resource(struct ath10k *ar)
34423454
spin_lock_init(&ar_pci->ps_lock);
34433455
mutex_init(&ar_pci->ce_diag_mutex);
34443456

3457+
INIT_WORK(&ar_pci->dump_work, ath10k_pci_fw_dump_work);
3458+
34453459
timer_setup(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry, 0);
34463460

34473461
if (QCA_REV_6174(ar) || QCA_REV_9377(ar))

drivers/net/wireless/ath/ath10k/pci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ struct ath10k_pci {
121121
/* For protecting ce_diag */
122122
struct mutex ce_diag_mutex;
123123

124+
struct work_struct dump_work;
125+
124126
struct ath10k_ce ce;
125127
struct timer_list rx_post_retry;
126128

drivers/net/wireless/intel/iwlwifi/cfg/22000.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static const struct iwl_ht_params iwl_22000_ht_params = {
201201
#define IWL_DEVICE_AX210 \
202202
IWL_DEVICE_AX200_COMMON, \
203203
.device_family = IWL_DEVICE_FAMILY_AX210, \
204-
.base_params = &iwl_22000_base_params, \
204+
.base_params = &iwl_22560_base_params, \
205205
.csr = &iwl_csr_v1, \
206206
.min_txq_size = 128
207207

drivers/net/wireless/intel/iwlwifi/cfg/5000.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/******************************************************************************
22
*
33
* Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
4-
* Copyright(c) 2018 Intel Corporation
4+
* Copyright(c) 2018 - 2019 Intel Corporation
55
*
66
* This program is free software; you can redistribute it and/or modify it
77
* under the terms of version 2 of the GNU General Public License as
@@ -136,6 +136,7 @@ const struct iwl_cfg iwl5350_agn_cfg = {
136136
.ht_params = &iwl5000_ht_params,
137137
.led_mode = IWL_LED_BLINK,
138138
.internal_wimax_coex = true,
139+
.csr = &iwl_csr_v1,
139140
};
140141

141142
#define IWL_DEVICE_5150 \

drivers/net/wireless/intel/iwlwifi/fw/file.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct iwl_ucode_header {
9393
} u;
9494
};
9595

96-
#define IWL_UCODE_INI_TLV_GROUP BIT(24)
96+
#define IWL_UCODE_INI_TLV_GROUP 0x1000000
9797

9898
/*
9999
* new TLV uCode file layout
@@ -148,11 +148,14 @@ enum iwl_ucode_tlv_type {
148148
IWL_UCODE_TLV_UMAC_DEBUG_ADDRS = 54,
149149
IWL_UCODE_TLV_LMAC_DEBUG_ADDRS = 55,
150150
IWL_UCODE_TLV_FW_RECOVERY_INFO = 57,
151-
IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION = IWL_UCODE_INI_TLV_GROUP | 0x1,
152-
IWL_UCODE_TLV_TYPE_HCMD = IWL_UCODE_INI_TLV_GROUP | 0x2,
153-
IWL_UCODE_TLV_TYPE_REGIONS = IWL_UCODE_INI_TLV_GROUP | 0x3,
154-
IWL_UCODE_TLV_TYPE_TRIGGERS = IWL_UCODE_INI_TLV_GROUP | 0x4,
155-
IWL_UCODE_TLV_TYPE_DEBUG_FLOW = IWL_UCODE_INI_TLV_GROUP | 0x5,
151+
152+
IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION = IWL_UCODE_INI_TLV_GROUP + 0x1,
153+
IWL_UCODE_TLV_DEBUG_BASE = IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION,
154+
IWL_UCODE_TLV_TYPE_HCMD = IWL_UCODE_INI_TLV_GROUP + 0x2,
155+
IWL_UCODE_TLV_TYPE_REGIONS = IWL_UCODE_INI_TLV_GROUP + 0x3,
156+
IWL_UCODE_TLV_TYPE_TRIGGERS = IWL_UCODE_INI_TLV_GROUP + 0x4,
157+
IWL_UCODE_TLV_TYPE_DEBUG_FLOW = IWL_UCODE_INI_TLV_GROUP + 0x5,
158+
IWL_UCODE_TLV_DEBUG_MAX = IWL_UCODE_TLV_TYPE_DEBUG_FLOW,
156159

157160
/* TLVs 0x1000-0x2000 are for internal driver usage */
158161
IWL_UCODE_TLV_FW_DBG_DUMP_LST = 0x1000,

drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data,
126126
len -= ALIGN(tlv_len, 4);
127127
data += sizeof(*tlv) + ALIGN(tlv_len, 4);
128128

129-
if (!(tlv_type & IWL_UCODE_INI_TLV_GROUP))
129+
if (tlv_type < IWL_UCODE_TLV_DEBUG_BASE ||
130+
tlv_type > IWL_UCODE_TLV_DEBUG_MAX)
130131
continue;
131132

132133
hdr = (void *)&tlv->data[0];

drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,7 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
774774
return;
775775

776776
mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir);
777-
778-
if (!mvmvif->dbgfs_dir) {
777+
if (IS_ERR_OR_NULL(mvmvif->dbgfs_dir)) {
779778
IWL_ERR(mvm, "Failed to create debugfs directory under %pd\n",
780779
dbgfs_dir);
781780
return;

drivers/net/wireless/intel/iwlwifi/mvm/fw.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,9 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
11211121
ret = iwl_mvm_load_rt_fw(mvm);
11221122
if (ret) {
11231123
IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret);
1124-
iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER);
1124+
if (ret != -ERFKILL)
1125+
iwl_fw_dbg_error_collect(&mvm->fwrt,
1126+
FW_DBG_TRIGGER_DRIVER);
11251127
goto error;
11261128
}
11271129

drivers/net/wireless/intel/iwlwifi/mvm/ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
834834
mutex_lock(&mvm->mutex);
835835
iwl_mvm_ref(mvm, IWL_MVM_REF_INIT_UCODE);
836836
err = iwl_run_init_mvm_ucode(mvm, true);
837-
if (err)
837+
if (err && err != -ERFKILL)
838838
iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER);
839839
if (!iwlmvm_mod_params.init_dbg || !err)
840840
iwl_mvm_stop_device(mvm);

drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb,
169169
}
170170

171171
/* iwl_mvm_create_skb Adds the rxb to a new skb */
172-
static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr,
173-
u16 len, u8 crypt_len,
174-
struct iwl_rx_cmd_buffer *rxb)
172+
static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
173+
struct ieee80211_hdr *hdr, u16 len, u8 crypt_len,
174+
struct iwl_rx_cmd_buffer *rxb)
175175
{
176176
struct iwl_rx_packet *pkt = rxb_addr(rxb);
177177
struct iwl_rx_mpdu_desc *desc = (void *)pkt->data;
@@ -204,6 +204,20 @@ static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr,
204204
* present before copying packet data.
205205
*/
206206
hdrlen += crypt_len;
207+
208+
if (WARN_ONCE(headlen < hdrlen,
209+
"invalid packet lengths (hdrlen=%d, len=%d, crypt_len=%d)\n",
210+
hdrlen, len, crypt_len)) {
211+
/*
212+
* We warn and trace because we want to be able to see
213+
* it in trace-cmd as well.
214+
*/
215+
IWL_DEBUG_RX(mvm,
216+
"invalid packet lengths (hdrlen=%d, len=%d, crypt_len=%d)\n",
217+
hdrlen, len, crypt_len);
218+
return -EINVAL;
219+
}
220+
207221
skb_put_data(skb, hdr, hdrlen);
208222
skb_put_data(skb, (u8 *)hdr + hdrlen + pad_len, headlen - hdrlen);
209223

@@ -216,6 +230,8 @@ static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr,
216230
skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset,
217231
fraglen, rxb->truesize);
218232
}
233+
234+
return 0;
219235
}
220236

221237
static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm,
@@ -1671,7 +1687,11 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
16711687
rx_status->boottime_ns = ktime_get_boot_ns();
16721688
}
16731689

1674-
iwl_mvm_create_skb(skb, hdr, len, crypt_len, rxb);
1690+
if (iwl_mvm_create_skb(mvm, skb, hdr, len, crypt_len, rxb)) {
1691+
kfree_skb(skb);
1692+
goto out;
1693+
}
1694+
16751695
if (!iwl_mvm_reorder(mvm, napi, queue, sta, skb, desc))
16761696
iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue,
16771697
sta, csi);

drivers/net/wireless/intel/iwlwifi/pcie/trans.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3644,20 +3644,27 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
36443644

36453645
void iwl_trans_pcie_sync_nmi(struct iwl_trans *trans)
36463646
{
3647+
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
36473648
unsigned long timeout = jiffies + IWL_TRANS_NMI_TIMEOUT;
3649+
u32 inta_addr, sw_err_bit;
3650+
3651+
if (trans_pcie->msix_enabled) {
3652+
inta_addr = CSR_MSIX_HW_INT_CAUSES_AD;
3653+
sw_err_bit = MSIX_HW_INT_CAUSES_REG_SW_ERR;
3654+
} else {
3655+
inta_addr = CSR_INT;
3656+
sw_err_bit = CSR_INT_BIT_SW_ERR;
3657+
}
36483658

36493659
iwl_disable_interrupts(trans);
36503660
iwl_force_nmi(trans);
36513661
while (time_after(timeout, jiffies)) {
3652-
u32 inta_hw = iwl_read32(trans,
3653-
CSR_MSIX_HW_INT_CAUSES_AD);
3662+
u32 inta_hw = iwl_read32(trans, inta_addr);
36543663

36553664
/* Error detected by uCode */
3656-
if (inta_hw & MSIX_HW_INT_CAUSES_REG_SW_ERR) {
3665+
if (inta_hw & sw_err_bit) {
36573666
/* Clear causes register */
3658-
iwl_write32(trans, CSR_MSIX_HW_INT_CAUSES_AD,
3659-
inta_hw &
3660-
MSIX_HW_INT_CAUSES_REG_SW_ERR);
3667+
iwl_write32(trans, inta_addr, inta_hw & sw_err_bit);
36613668
break;
36623669
}
36633670

drivers/net/wireless/marvell/mwifiex/sdio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static int mwifiex_sdio_resume(struct device *dev)
181181

182182
adapter = card->adapter;
183183

184-
if (test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) {
184+
if (!test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) {
185185
mwifiex_dbg(adapter, WARN,
186186
"device already resumed\n");
187187
return 0;

0 commit comments

Comments
 (0)