Commit dcdecb12 authored by Ryder Lee's avatar Ryder Lee Committed by Felix Fietkau

mt76: mt7915: add a fixed AC queue mapping

In MT7915, hardware queue map is flexible. However, certain firmware modules
like MU and U-APSD presume a fixed queue order to adapt some devices that have
DMA scheduler with a strict order, so this patch can help in the long run.
Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent b876658b
...@@ -593,7 +593,7 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi, ...@@ -593,7 +593,7 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi,
if (ieee80211_is_data(fc) || ieee80211_is_bufferable_mmpdu(fc)) { if (ieee80211_is_data(fc) || ieee80211_is_bufferable_mmpdu(fc)) {
q_idx = wmm_idx * MT7915_MAX_WMM_SETS + q_idx = wmm_idx * MT7915_MAX_WMM_SETS +
skb_get_queue_mapping(skb); mt7915_lmac_mapping(dev, skb_get_queue_mapping(skb));
p_fmt = MT_TX_TYPE_CT; p_fmt = MT_TX_TYPE_CT;
} else if (beacon) { } else if (beacon) {
q_idx = MT_LMAC_BCN0; q_idx = MT_LMAC_BCN0;
......
...@@ -149,16 +149,6 @@ enum tx_pkt_type { ...@@ -149,16 +149,6 @@ enum tx_pkt_type {
MT_TX_TYPE_FW, MT_TX_TYPE_FW,
}; };
enum tx_pkt_queue_idx {
MT_LMAC_AC00,
MT_LMAC_AC01,
MT_LMAC_AC02,
MT_LMAC_AC03,
MT_LMAC_ALTX0 = 0x10,
MT_LMAC_BMC0 = 0x10,
MT_LMAC_BCN0 = 0x12,
};
enum tx_port_idx { enum tx_port_idx {
MT_TX_PORT_IDX_LMAC, MT_TX_PORT_IDX_LMAC,
MT_TX_PORT_IDX_MCU MT_TX_PORT_IDX_MCU
......
...@@ -350,9 +350,12 @@ static int ...@@ -350,9 +350,12 @@ static int
mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
const struct ieee80211_tx_queue_params *params) const struct ieee80211_tx_queue_params *params)
{ {
struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
/* no need to update right away, we'll get BSS_CHANGED_QOS */ /* no need to update right away, we'll get BSS_CHANGED_QOS */
queue = mt7915_lmac_mapping(dev, queue);
mvif->wmm[queue].cw_min = params->cw_min; mvif->wmm[queue].cw_min = params->cw_min;
mvif->wmm[queue].cw_max = params->cw_max; mvif->wmm[queue].cw_max = params->cw_max;
mvif->wmm[queue].aifs = params->aifs; mvif->wmm[queue].aifs = params->aifs;
......
...@@ -199,6 +199,16 @@ enum { ...@@ -199,6 +199,16 @@ enum {
EXT_BSSID_END EXT_BSSID_END
}; };
enum {
MT_LMAC_AC00,
MT_LMAC_AC01,
MT_LMAC_AC02,
MT_LMAC_AC03,
MT_LMAC_ALTX0 = 0x10,
MT_LMAC_BMC0,
MT_LMAC_BCN0,
};
enum { enum {
MT_RX_SEL0, MT_RX_SEL0,
MT_RX_SEL1, MT_RX_SEL1,
...@@ -254,6 +264,21 @@ mt7915_ext_phy(struct mt7915_dev *dev) ...@@ -254,6 +264,21 @@ mt7915_ext_phy(struct mt7915_dev *dev)
return phy->priv; return phy->priv;
} }
static inline u8 mt7915_lmac_mapping(struct mt7915_dev *dev, u8 ac)
{
static const u8 lmac_queue_map[] = {
[IEEE80211_AC_BK] = MT_LMAC_AC00,
[IEEE80211_AC_BE] = MT_LMAC_AC01,
[IEEE80211_AC_VI] = MT_LMAC_AC02,
[IEEE80211_AC_VO] = MT_LMAC_AC03,
};
if (WARN_ON_ONCE(ac >= ARRAY_SIZE(lmac_queue_map)))
return MT_LMAC_AC01; /* BE */
return lmac_queue_map[ac];
}
static inline void static inline void
mt7915_set_aggr_state(struct mt7915_sta *msta, u8 tid, mt7915_set_aggr_state(struct mt7915_sta *msta, u8 tid,
enum mt7915_ampdu_state state) enum mt7915_ampdu_state state)
......
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