wifi: mt76: move rate info in mt76_vif
authorLorenzo Bianconi <lorenzo@kernel.org>
Thu, 22 Jun 2023 16:50:30 +0000 (18:50 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 25 Jul 2023 19:59:43 +0000 (21:59 +0200)
This is a preliminary patch to introduce mt76_connac3 mac library used
by WiFi7 chipsets (e.g. mt7996).

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76.h
drivers/net/wireless/mediatek/mt76/mt7996/mac.c
drivers/net/wireless/mediatek/mt76/mt7996/main.c
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h

index 8ec77682d8e90d80b9d86f81af46520b677bf73c..878087257ea7e45c56c42d8ea20bb77a1aba193e 100644 (file)
@@ -705,6 +705,9 @@ struct mt76_vif {
        u8 wmm_idx;
        u8 scan_seq_num;
        u8 cipher;
+       u8 basic_rates_idx;
+       u8 mcast_rates_idx;
+       u8 beacon_rates_idx;
 };
 
 struct mt76_phy {
index dfe70e0ff3297aa39c8a1b571ea0ee8e1850e0e8..6fc9260a2e924f61cf815193a36d7e4a49102235 100644 (file)
@@ -1013,7 +1013,7 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
        u8 band_idx = (info->hw_queue & MT_TX_HW_QUEUE_PHY) >> 2;
        u8 p_fmt, q_idx, omac_idx = 0, wmm_idx = 0;
        bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
-       struct mt7996_vif *mvif;
+       struct mt76_vif *mvif;
        u16 tx_count = 15;
        u32 val;
        bool beacon = !!(changed & (BSS_CHANGED_BEACON |
@@ -1021,11 +1021,11 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
        bool inband_disc = !!(changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP |
                                         BSS_CHANGED_FILS_DISCOVERY));
 
-       mvif = vif ? (struct mt7996_vif *)vif->drv_priv : NULL;
+       mvif = vif ? (struct mt76_vif *)vif->drv_priv : NULL;
        if (mvif) {
-               omac_idx = mvif->mt76.omac_idx;
-               wmm_idx = mvif->mt76.wmm_idx;
-               band_idx = mvif->mt76.band_idx;
+               omac_idx = mvif->omac_idx;
+               wmm_idx = mvif->wmm_idx;
+               band_idx = mvif->band_idx;
        }
 
        if (inband_disc) {
index 54858cfc9342344b10d8d8651e771f1d47c513e6..c3a479dc3f533c147459472281816f6725345bcb 100644 (file)
@@ -223,9 +223,9 @@ static int mt7996_add_interface(struct ieee80211_hw *hw,
        vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_4ADDR;
 
        if (phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ)
-               mvif->basic_rates_idx = MT7996_BASIC_RATES_TBL + 4;
+               mvif->mt76.basic_rates_idx = MT7996_BASIC_RATES_TBL + 4;
        else
-               mvif->basic_rates_idx = MT7996_BASIC_RATES_TBL;
+               mvif->mt76.basic_rates_idx = MT7996_BASIC_RATES_TBL;
 
        mt7996_init_bitrate_mask(vif);
 
@@ -505,7 +505,7 @@ static u8
 mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                       bool beacon, bool mcast)
 {
-       struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+       struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
        struct mt76_phy *mphy = hw->priv;
        u16 rate;
        u8 i, idx, ht;
@@ -517,7 +517,7 @@ mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                struct mt7996_dev *dev = mt7996_hw_dev(hw);
 
                /* must odd index */
-               idx = MT7996_BEACON_RATES_TBL + 2 * (mvif->mt76.idx % 20);
+               idx = MT7996_BEACON_RATES_TBL + 2 * (mvif->idx % 20);
                mt7996_mac_set_fixed_rate_table(dev, idx, rate);
                return idx;
        }
@@ -555,7 +555,7 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
                                    struct ieee80211_bss_conf *info,
                                    u64 changed)
 {
-       struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+       struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
        struct mt7996_phy *phy = mt7996_hw_phy(hw);
        struct mt7996_dev *dev = mt7996_hw_dev(hw);
 
index 611f6450520b54efdf322495ecb1bb0848777fd5..4a30db49ef33fa6ecba170ba38d975ec2456f940 100644 (file)
@@ -604,7 +604,7 @@ static void
 mt7996_mcu_bss_bmc_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
                       struct mt7996_phy *phy)
 {
-       struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+       struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
        struct bss_rate_tlv *bmc;
        struct cfg80211_chan_def *chandef = &phy->mt76->chandef;
        enum nl80211_band band = chandef->chan->band;
index 79cb71c16264aa9678bfa8cf51e695b8a7dff6c4..726c222e8e1e3a120092e36b3fdde0a330503442 100644 (file)
@@ -128,10 +128,6 @@ struct mt7996_vif {
 
        struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
        struct cfg80211_bitrate_mask bitrate_mask;
-
-       u8 basic_rates_idx;
-       u8 mcast_rates_idx;
-       u8 beacon_rates_idx;
 };
 
 /* crash-dump */