First part of unifying mt76x02_sta structure between mt76x0 and mt76x2.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
 
 #include "mt76.h"
 #include "mt76x02_regs.h"
+#include "mt76x02_mac.h"
 
 enum mt76x02_cipher_type
 mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data)
                __mt76_wr(dev, MT_WCID_DROP(idx), (val & ~bit) | (bit * drop));
 }
 EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_set_drop);
+
+void mt76x02_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq)
+{
+       struct mt76_txq *mtxq;
+
+       if (!txq)
+               return;
+
+       mtxq = (struct mt76_txq *) txq->drv_priv;
+       if (txq->sta) {
+               struct mt76x02_sta *sta;
+
+               sta = (struct mt76x02_sta *) txq->sta->drv_priv;
+               mtxq->wcid = &sta->wcid;
+       } else {
+               struct mt76x02_vif *mvif;
+
+               mvif = (struct mt76x02_vif *) txq->vif->drv_priv;
+               mtxq->wcid = &mvif->group_wcid;
+       }
+
+       mt76_txq_init(dev, txq);
+}
+EXPORT_SYMBOL_GPL(mt76x02_txq_init);
 
 #ifndef __MT76X02_MAC_H
 #define __MT76X02_MAC_H
 
+struct mt76x02_tx_status {
+       u8 valid:1;
+       u8 success:1;
+       u8 aggr:1;
+       u8 ack_req:1;
+       u8 wcid;
+       u8 pktid;
+       u8 retry;
+       u16 rate;
+} __packed __aligned(2);
+
 struct mt76x02_vif {
        u8 idx;
 
        struct mt76_wcid group_wcid;
 };
 
+struct mt76x02_sta {
+       struct mt76_wcid wcid; /* must be first */
+
+       struct mt76x02_vif *vif;
+       struct mt76x02_tx_status status;
+       int n_frames;
+};
+
 static inline bool mt76x02_wait_for_mac(struct mt76_dev *dev)
 {
        const u32 MAC_CSR0 = 0x1000;
        return false;
 }
 
+void mt76x02_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq);
+
 enum mt76x02_cipher_type
 mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data);
 
 
 #include "mt76x2.h"
 #include "mt76x02_mac.h"
 
-void mt76x2_txq_init(struct mt76x2_dev *dev, struct ieee80211_txq *txq)
-{
-       struct mt76_txq *mtxq;
-
-       if (!txq)
-               return;
-
-       mtxq = (struct mt76_txq *) txq->drv_priv;
-       if (txq->sta) {
-               struct mt76x2_sta *sta;
-
-               sta = (struct mt76x2_sta *) txq->sta->drv_priv;
-               mtxq->wcid = &sta->wcid;
-       } else {
-               struct mt76x02_vif *mvif;
-
-               mvif = (struct mt76x02_vif *) txq->vif->drv_priv;
-               mtxq->wcid = &mvif->group_wcid;
-       }
-
-       mt76_txq_init(&dev->mt76, txq);
-}
-EXPORT_SYMBOL_GPL(mt76x2_txq_init);
-
 int mt76x2_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                        struct ieee80211_ampdu_params *params)
 {
        mt76x02_mac_wcid_setup(&dev->mt76, idx, mvif->idx, sta->addr);
        mt76x02_mac_wcid_set_drop(&dev->mt76, idx, false);
        for (i = 0; i < ARRAY_SIZE(sta->txq); i++)
-               mt76x2_txq_init(dev, sta->txq[i]);
+               mt76x02_txq_init(&dev->mt76, sta->txq[i]);
 
        if (vif->type == NL80211_IFTYPE_AP)
                set_bit(MT_WCID_FLAG_CHECK_PS, &msta->wcid.flags);
 
        mvif->idx = idx;
        mvif->group_wcid.idx = MT_VIF_WCID(idx);
        mvif->group_wcid.hw_key_idx = -1;
-       mt76x2_txq_init(dev, vif->txq);
+       mt76x02_txq_init(&dev->mt76, vif->txq);
 
        return 0;
 }
 
        mvif->idx = idx;
        mvif->group_wcid.idx = MT_VIF_WCID(idx);
        mvif->group_wcid.hw_key_idx = -1;
-       mt76x2_txq_init(dev, vif->txq);
+       mt76x02_txq_init(&dev->mt76, vif->txq);
 
        return 0;
 }