Skip to content

Commit 6247c3b

Browse files
author
Kalle Valo
committed
Merge tag 'mt76-for-kvalo-2020-06-07' of https://github.com/nbd168/wireless
mt76 patches for 5.8 * tx queueing fixes for mt7615/22/63 * locking fix # gpg: Signature made Sun 07 Jun 2020 06:17:47 PM EEST using DSA key ID 02A76EF5 # gpg: Good signature from "Felix Fietkau <[email protected]>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 75D1 1A7D 91A7 710F 4900 42EF D77D 141D 02A7 6EF5
2 parents ea0cca6 + 7f88314 commit 6247c3b

File tree

13 files changed

+75
-46
lines changed

13 files changed

+75
-46
lines changed

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/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

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
397397
struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
398398
struct mt7615_dev *dev = mt7615_hw_dev(hw);
399399

400+
queue = mt7615_lmac_mapping(dev, queue);
400401
queue += mvif->wmm_idx * MT7615_MAX_WMM_SETS;
401402

402403
return mt7615_mcu_set_wmm(dev, queue, params);
@@ -735,9 +736,12 @@ static void
735736
mt7615_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
736737
{
737738
struct mt7615_phy *phy = mt7615_hw_phy(hw);
739+
struct mt7615_dev *dev = phy->dev;
738740

741+
mutex_lock(&dev->mt76.mutex);
739742
phy->coverage_class = max_t(s16, coverage_class, 0);
740743
mt7615_mac_set_timing(phy);
744+
mutex_unlock(&dev->mt76.mutex);
741745
}
742746

743747
static int

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
146146
static const struct mt76_driver_ops drv_ops = {
147147
/* txwi_size = txd size + txp size */
148148
.txwi_size = MT_TXD_SIZE + sizeof(struct mt7615_txp_common),
149-
.drv_flags = MT_DRV_TXWI_NO_FREE,
149+
.drv_flags = MT_DRV_TXWI_NO_FREE | MT_DRV_HW_MGMT_TXQ,
150150
.survey_flags = SURVEY_INFO_TIME_TX |
151151
SURVEY_INFO_TIME_RX |
152152
SURVEY_INFO_TIME_BSS_RX,

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,21 @@ struct mt7615_dev {
282282
struct list_head wd_head;
283283
};
284284

285+
enum tx_pkt_queue_idx {
286+
MT_LMAC_AC00,
287+
MT_LMAC_AC01,
288+
MT_LMAC_AC02,
289+
MT_LMAC_AC03,
290+
MT_LMAC_ALTX0 = 0x10,
291+
MT_LMAC_BMC0,
292+
MT_LMAC_BCN0,
293+
MT_LMAC_PSMP0,
294+
MT_LMAC_ALTX1,
295+
MT_LMAC_BMC1,
296+
MT_LMAC_BCN1,
297+
MT_LMAC_PSMP1,
298+
};
299+
285300
enum {
286301
HW_BSSID_0 = 0x0,
287302
HW_BSSID_1,
@@ -447,6 +462,21 @@ static inline u16 mt7615_wtbl_size(struct mt7615_dev *dev)
447462
return MT7615_WTBL_SIZE;
448463
}
449464

465+
static inline u8 mt7615_lmac_mapping(struct mt7615_dev *dev, u8 ac)
466+
{
467+
static const u8 lmac_queue_map[] = {
468+
[IEEE80211_AC_BK] = MT_LMAC_AC00,
469+
[IEEE80211_AC_BE] = MT_LMAC_AC01,
470+
[IEEE80211_AC_VI] = MT_LMAC_AC02,
471+
[IEEE80211_AC_VO] = MT_LMAC_AC03,
472+
};
473+
474+
if (WARN_ON_ONCE(ac >= ARRAY_SIZE(lmac_queue_map)))
475+
return MT_LMAC_AC01; /* BE */
476+
477+
return lmac_queue_map[ac];
478+
}
479+
450480
void mt7615_dma_reset(struct mt7615_dev *dev);
451481
void mt7615_scan_work(struct work_struct *work);
452482
void mt7615_roc_work(struct work_struct *work);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static int mt7663u_probe(struct usb_interface *usb_intf,
270270
{
271271
static const struct mt76_driver_ops drv_ops = {
272272
.txwi_size = MT_USB_TXD_SIZE,
273-
.drv_flags = MT_DRV_RX_DMA_HDR,
273+
.drv_flags = MT_DRV_RX_DMA_HDR | MT_DRV_HW_MGMT_TXQ,
274274
.tx_prepare_skb = mt7663u_tx_prepare_skb,
275275
.tx_complete_skb = mt7663u_tx_complete_skb,
276276
.tx_status_data = mt7663u_tx_status_data,

0 commit comments

Comments
 (0)