Commit bb0ae4cf authored by Sean Wang's avatar Sean Wang Committed by Felix Fietkau

mt76: mt7921: add MU EDCA cmd support

Add MU EDCA MCU command support to update MU AC parameter record field
from the access point.
Co-developed-by: default avatarEric-SY Chang <Eric-SY.Chang@mediatek.com>
Signed-off-by: default avatarEric-SY Chang <Eric-SY.Chang@mediatek.com>
Tested-by: default avatarEric-SY Chang <Eric-SY.Chang@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent e0710ca9
...@@ -572,6 +572,7 @@ enum { ...@@ -572,6 +572,7 @@ enum {
MCU_CMD_SCHED_SCAN_ENABLE = MCU_CE_PREFIX | 0x61, MCU_CMD_SCHED_SCAN_ENABLE = MCU_CE_PREFIX | 0x61,
MCU_CMD_SCHED_SCAN_REQ = MCU_CE_PREFIX | 0x62, MCU_CMD_SCHED_SCAN_REQ = MCU_CE_PREFIX | 0x62,
MCU_CMD_GET_NIC_CAPAB = MCU_CE_PREFIX | 0x8a, MCU_CMD_GET_NIC_CAPAB = MCU_CE_PREFIX | 0x8a,
MCU_CMD_SET_MU_EDCA_PARMS = MCU_CE_PREFIX | 0xb0,
MCU_CMD_REG_WRITE = MCU_CE_PREFIX | 0xc0, MCU_CMD_REG_WRITE = MCU_CE_PREFIX | 0xc0,
MCU_CMD_REG_READ = MCU_CE_PREFIX | MCU_QUERY_MASK | 0xc0, MCU_CMD_REG_READ = MCU_CE_PREFIX | MCU_QUERY_MASK | 0xc0,
MCU_CMD_CHIP_CONFIG = MCU_CE_PREFIX | 0xca, MCU_CMD_CHIP_CONFIG = MCU_CE_PREFIX | 0xca,
......
...@@ -974,7 +974,30 @@ int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif) ...@@ -974,7 +974,30 @@ int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif)
.total = IEEE80211_NUM_ACS, .total = IEEE80211_NUM_ACS,
}; };
struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
int ac; struct mu_edca {
u8 cw_min;
u8 cw_max;
u8 aifsn;
u8 acm;
u8 timer;
u8 padding[3];
};
struct mt7921_mcu_mu_tx {
u8 ver;
u8 pad0;
__le16 len;
u8 bss_idx;
u8 qos;
u8 wmm_idx;
u8 pad1;
struct mu_edca edca[IEEE80211_NUM_ACS];
u8 pad3[32];
} __packed req_mu = {
.bss_idx = mvif->mt76.idx,
.qos = vif->bss_conf.qos,
.wmm_idx = mvif->mt76.wmm_idx,
};
int ac, ret;
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
struct ieee80211_tx_queue_params *q = &mvif->queue_params[ac]; struct ieee80211_tx_queue_params *q = &mvif->queue_params[ac];
...@@ -995,8 +1018,34 @@ int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif) ...@@ -995,8 +1018,34 @@ int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif)
else else
e->cw_max = cpu_to_le16(10); e->cw_max = cpu_to_le16(10);
} }
return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EDCA_UPDATE, &req,
ret = mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EDCA_UPDATE, &req,
sizeof(req), true); sizeof(req), true);
if (ret)
return ret;
if (!vif->bss_conf.he_support)
return 0;
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
struct ieee80211_he_mu_edca_param_ac_rec *q;
struct mu_edca *e;
int to_aci[] = {1, 0, 2, 3};
if (!mvif->queue_params[ac].mu_edca)
break;
q = &mvif->queue_params[ac].mu_edca_param_rec;
e = &(req_mu.edca[to_aci[ac]]);
e->cw_min = q->ecw_min_max & 0xf;
e->cw_max = (q->ecw_min_max & 0xf0) >> 4;
e->aifsn = q->aifsn;
e->timer = q->mu_edca_timer;
}
return mt76_mcu_send_msg(&dev->mt76, MCU_CMD_SET_MU_EDCA_PARMS, &req_mu,
sizeof(req_mu), false);
} }
int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd) int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment