Skip to content

Commit 7f88314

Browse files
LorenzoBianconinbd168
authored andcommitted
mt76: overwrite qid for non-bufferable mgmt frames
Overwrite hw queue id for non-bufferable management frames if the hw support always txq (altxq) in order to be in sync with mac txwi code Fixes: cdad487 ("mt76: mt7615: add dma and tx queue initialization for MT7622") Fixes: f40ac0f ("mt76: mt7615: introduce mt7663e support") Suggested-by: Felix Fietkau <[email protected]> Tested-by: Sean Wang <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
1 parent a07292e commit 7f88314

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
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/mt7615/dma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
mt7615_lmac_mapping(dev, 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/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/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,

drivers/net/wireless/mediatek/mt76/tx.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,13 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
264264
skb_set_queue_mapping(skb, qid);
265265
}
266266

267+
if ((dev->drv->drv_flags & MT_DRV_HW_MGMT_TXQ) &&
268+
!ieee80211_is_data(hdr->frame_control) &&
269+
!ieee80211_is_bufferable_mmpdu(hdr->frame_control)) {
270+
qid = MT_TXQ_PSD;
271+
skb_set_queue_mapping(skb, qid);
272+
}
273+
267274
if (!(wcid->tx_info & MT_WCID_TX_INFO_SET))
268275
ieee80211_get_tx_rates(info->control.vif, sta, skb,
269276
info->control.rates, 1);

0 commit comments

Comments
 (0)