Skip to content

Commit d113c0f

Browse files
committed
Merge tag 'wireless-drivers-2020-07-13' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers
Kalle Valo says: ==================== wireless-drivers fixes for v5.8 First set of fixes for v5.8. Various important fixes for iwlwifi and mt76. iwlwifi * fix sleeping under RCU * fix a kernel crash when using compressed firmware images mt76 * tx queueing fixes for mt7615/22/63 * locking fix * fix a crash during watchdog reset * fix memory leaks ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 46ef5b8 + dc7bd30 commit d113c0f

File tree

18 files changed

+120
-68
lines changed

18 files changed

+120
-68
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ static int iwl_dbg_tlv_alloc_trigger(struct iwl_trans *trans,
271271
{
272272
struct iwl_fw_ini_trigger_tlv *trig = (void *)tlv->data;
273273
u32 tp = le32_to_cpu(trig->time_point);
274+
struct iwl_ucode_tlv *dup = NULL;
275+
int ret;
274276

275277
if (le32_to_cpu(tlv->length) < sizeof(*trig))
276278
return -EINVAL;
@@ -283,10 +285,20 @@ static int iwl_dbg_tlv_alloc_trigger(struct iwl_trans *trans,
283285
return -EINVAL;
284286
}
285287

286-
if (!le32_to_cpu(trig->occurrences))
288+
if (!le32_to_cpu(trig->occurrences)) {
289+
dup = kmemdup(tlv, sizeof(*tlv) + le32_to_cpu(tlv->length),
290+
GFP_KERNEL);
291+
if (!dup)
292+
return -ENOMEM;
293+
trig = (void *)dup->data;
287294
trig->occurrences = cpu_to_le32(-1);
295+
tlv = dup;
296+
}
297+
298+
ret = iwl_dbg_tlv_add(tlv, &trans->dbg.time_point[tp].trig_list);
299+
kfree(dup);
288300

289-
return iwl_dbg_tlv_add(tlv, &trans->dbg.time_point[tp].trig_list);
301+
return ret;
290302
}
291303

292304
static int (*dbg_tlv_alloc[])(struct iwl_trans *trans,

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,17 +1189,15 @@ static int iwl_mvm_inactivity_check(struct iwl_mvm *mvm, u8 alloc_for_sta)
11891189
for_each_set_bit(i, &changetid_queues, IWL_MAX_HW_QUEUES)
11901190
iwl_mvm_change_queue_tid(mvm, i);
11911191

1192+
rcu_read_unlock();
1193+
11921194
if (free_queue >= 0 && alloc_for_sta != IWL_MVM_INVALID_STA) {
11931195
ret = iwl_mvm_free_inactive_queue(mvm, free_queue, queue_owner,
11941196
alloc_for_sta);
1195-
if (ret) {
1196-
rcu_read_unlock();
1197+
if (ret)
11971198
return ret;
1198-
}
11991199
}
12001200

1201-
rcu_read_unlock();
1202-
12031201
return free_queue;
12041202
}
12051203

drivers/net/wireless/mediatek/mt76/mt76.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ struct mt76_hw_cap {
301301
#define MT_DRV_TX_ALIGNED4_SKBS BIT(1)
302302
#define MT_DRV_SW_RX_AIRTIME BIT(2)
303303
#define MT_DRV_RX_DMA_HDR BIT(3)
304+
#define MT_DRV_HW_MGMT_TXQ BIT(4)
304305

305306
struct mt76_driver_ops {
306307
u32 drv_flags;

drivers/net/wireless/mediatek/mt76/mt7603/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,10 @@ mt7603_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
642642
{
643643
struct mt7603_dev *dev = hw->priv;
644644

645+
mutex_lock(&dev->mt76.mutex);
645646
dev->coverage_class = max_t(s16, coverage_class, 0);
646647
mt7603_mac_set_timing(dev);
648+
mutex_unlock(&dev->mt76.mutex);
647649
}
648650

649651
static void mt7603_tx(struct ieee80211_hw *hw,

drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,22 +234,23 @@ mt7615_queues_acq(struct seq_file *s, void *data)
234234
int i;
235235

236236
for (i = 0; i < 16; i++) {
237-
int j, acs = i / 4, index = i % 4;
237+
int j, wmm_idx = i % MT7615_MAX_WMM_SETS;
238+
int acs = i / MT7615_MAX_WMM_SETS;
238239
u32 ctrl, val, qlen = 0;
239240

240-
val = mt76_rr(dev, MT_PLE_AC_QEMPTY(acs, index));
241+
val = mt76_rr(dev, MT_PLE_AC_QEMPTY(acs, wmm_idx));
241242
ctrl = BIT(31) | BIT(15) | (acs << 8);
242243

243244
for (j = 0; j < 32; j++) {
244245
if (val & BIT(j))
245246
continue;
246247

247248
mt76_wr(dev, MT_PLE_FL_Q0_CTRL,
248-
ctrl | (j + (index << 5)));
249+
ctrl | (j + (wmm_idx << 5)));
249250
qlen += mt76_get_field(dev, MT_PLE_FL_Q3_CTRL,
250251
GENMASK(11, 0));
251252
}
252-
seq_printf(s, "AC%d%d: queued=%d\n", acs, index, qlen);
253+
seq_printf(s, "AC%d%d: queued=%d\n", wmm_idx, acs, qlen);
253254
}
254255

255256
return 0;

drivers/net/wireless/mediatek/mt76/mt7615/dma.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ static int
3636
mt7622_init_tx_queues_multi(struct mt7615_dev *dev)
3737
{
3838
static const u8 wmm_queue_map[] = {
39-
MT7622_TXQ_AC0,
40-
MT7622_TXQ_AC1,
41-
MT7622_TXQ_AC2,
42-
MT7622_TXQ_AC3,
39+
[IEEE80211_AC_BK] = MT7622_TXQ_AC0,
40+
[IEEE80211_AC_BE] = MT7622_TXQ_AC1,
41+
[IEEE80211_AC_VI] = MT7622_TXQ_AC2,
42+
[IEEE80211_AC_VO] = MT7622_TXQ_AC3,
4343
};
4444
int ret;
4545
int i;
@@ -100,6 +100,7 @@ mt7615_tx_cleanup(struct mt7615_dev *dev)
100100
int i;
101101

102102
mt76_queue_tx_cleanup(dev, MT_TXQ_MCU, false);
103+
mt76_queue_tx_cleanup(dev, MT_TXQ_PSD, false);
103104
if (is_mt7615(&dev->mt76)) {
104105
mt76_queue_tx_cleanup(dev, MT_TXQ_BE, false);
105106
} else {

drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ static int mt7615_eeprom_load(struct mt7615_dev *dev, u32 addr)
7272
{
7373
int ret;
7474

75-
ret = mt76_eeprom_init(&dev->mt76, MT7615_EEPROM_SIZE +
76-
MT7615_EEPROM_EXTRA_DATA);
75+
ret = mt76_eeprom_init(&dev->mt76, MT7615_EEPROM_FULL_SIZE);
7776
if (ret < 0)
7877
return ret;
7978

drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define MT7615_EEPROM_TXDPD_SIZE 216
1818
#define MT7615_EEPROM_TXDPD_COUNT (44 + 3)
1919

20-
#define MT7615_EEPROM_EXTRA_DATA (MT7615_EEPROM_TXDPD_OFFSET + \
20+
#define MT7615_EEPROM_FULL_SIZE (MT7615_EEPROM_TXDPD_OFFSET + \
2121
MT7615_EEPROM_TXDPD_COUNT * \
2222
MT7615_EEPROM_TXDPD_SIZE)
2323

drivers/net/wireless/mediatek/mt76/mt7615/mac.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -526,22 +526,16 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
526526
fc_type = (le16_to_cpu(fc) & IEEE80211_FCTL_FTYPE) >> 2;
527527
fc_stype = (le16_to_cpu(fc) & IEEE80211_FCTL_STYPE) >> 4;
528528

529-
if (ieee80211_is_data(fc) || ieee80211_is_bufferable_mmpdu(fc)) {
530-
q_idx = wmm_idx * MT7615_MAX_WMM_SETS +
531-
skb_get_queue_mapping(skb);
532-
p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
533-
} else if (beacon) {
534-
if (ext_phy)
535-
q_idx = MT_LMAC_BCN1;
536-
else
537-
q_idx = MT_LMAC_BCN0;
529+
if (beacon) {
538530
p_fmt = MT_TX_TYPE_FW;
531+
q_idx = ext_phy ? MT_LMAC_BCN1 : MT_LMAC_BCN0;
532+
} else if (skb_get_queue_mapping(skb) >= MT_TXQ_PSD) {
533+
p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
534+
q_idx = ext_phy ? MT_LMAC_ALTX1 : MT_LMAC_ALTX0;
539535
} else {
540-
if (ext_phy)
541-
q_idx = MT_LMAC_ALTX1;
542-
else
543-
q_idx = MT_LMAC_ALTX0;
544536
p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
537+
q_idx = wmm_idx * MT7615_MAX_WMM_SETS +
538+
mt7615_lmac_mapping(dev, skb_get_queue_mapping(skb));
545539
}
546540

547541
val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len + sz_txd) |

drivers/net/wireless/mediatek/mt76/mt7615/mac.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,21 +124,6 @@ enum tx_pkt_type {
124124
MT_TX_TYPE_FW,
125125
};
126126

127-
enum tx_pkt_queue_idx {
128-
MT_LMAC_AC00,
129-
MT_LMAC_AC01,
130-
MT_LMAC_AC02,
131-
MT_LMAC_AC03,
132-
MT_LMAC_ALTX0 = 0x10,
133-
MT_LMAC_BMC0,
134-
MT_LMAC_BCN0,
135-
MT_LMAC_PSMP0,
136-
MT_LMAC_ALTX1,
137-
MT_LMAC_BMC1,
138-
MT_LMAC_BCN1,
139-
MT_LMAC_PSMP1,
140-
};
141-
142127
enum tx_port_idx {
143128
MT_TX_PORT_IDX_LMAC,
144129
MT_TX_PORT_IDX_MCU

0 commit comments

Comments
 (0)