wifi: mt76: mt7925: extend mt7925_get_phy_mode for per-link STA
authorSean Wang <sean.wang@mediatek.com>
Thu, 13 Jun 2024 03:02:29 +0000 (20:02 -0700)
committerFelix Fietkau <nbd@nbd.name>
Tue, 9 Jul 2024 21:01:56 +0000 (23:01 +0200)
Extend mt7925_get_phy_mode with the per-link STA configuration.

The patch we created is a prerequisite to enable the MLO function in the
driver. It is purely a refactoring patch so the functionality should
remain unchanged.

Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20240613030241.5771-36-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c

index a059532f383a1347e5da74a5b93f77de27c5d894..a1a07bbca7b385f106dda74927dac80ba8116921 100644 (file)
@@ -1307,7 +1307,8 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
 EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_ba);
 
 u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
-                           enum nl80211_band band, struct ieee80211_sta *sta)
+                           enum nl80211_band band,
+                           struct ieee80211_link_sta *link_sta)
 {
        struct mt76_dev *dev = phy->dev;
        const struct ieee80211_sta_he_cap *he_cap;
@@ -1318,10 +1319,10 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
        if (is_connac_v1(dev))
                return 0x38;
 
-       if (sta) {
-               ht_cap = &sta->deflink.ht_cap;
-               vht_cap = &sta->deflink.vht_cap;
-               he_cap = &sta->deflink.he_cap;
+       if (link_sta) {
+               ht_cap = &link_sta->ht_cap;
+               vht_cap = &link_sta->vht_cap;
+               he_cap = &link_sta->he_cap;
        } else {
                struct ieee80211_supported_band *sband;
 
index 994136285815106aa26f06f4c9acf1e2a2ecf431..b56896cdd4d8867f03aba073f25a0c0bec018853 100644 (file)
@@ -1995,7 +1995,8 @@ mt76_connac_get_he_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif);
 const struct ieee80211_sta_eht_cap *
 mt76_connac_get_eht_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif);
 u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
-                           enum nl80211_band band, struct ieee80211_sta *sta);
+                           enum nl80211_band band,
+                           struct ieee80211_link_sta *sta);
 u8 mt76_connac_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif,
                                enum nl80211_band band);
 
index 9599adf104b160bbc5e703a34d6f95f51cca4b69..590ee510eb7c79f1a25149311c0f3e1d74122154 100644 (file)
@@ -1503,7 +1503,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
 
        ra->valid = true;
        ra->auto_rate = true;
-       ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
+       ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, &sta->deflink);
        ra->channel = chandef->chan->hw_value;
        ra->bw = sta->deflink.bandwidth;
        ra->phy.bw = sta->deflink.bandwidth;
index c6902009fd28c9641c87f951b98641771aea4a65..c19c6a0be597610a34fd12123e93bfb58489e4b1 100644 (file)
@@ -2115,7 +2115,7 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb,
                basic_req->nonht_basic_phy = cpu_to_le16(PHY_TYPE_OFDM_INDEX);
 
        memcpy(basic_req->bssid, link_conf->bssid, ETH_ALEN);
-       basic_req->phymode = mt76_connac_get_phy_mode(phy, vif, band, sta);
+       basic_req->phymode = mt76_connac_get_phy_mode(phy, vif, band, link_sta);
        basic_req->bcn_interval = cpu_to_le16(link_conf->beacon_int);
        basic_req->dtim_period = link_conf->dtim_period;
        basic_req->bmc_tx_wlan_idx = cpu_to_le16(wlan_idx);
index 2c857867780095082c1af1f9df41e44bb2e1d6ca..15905c0bfa8ad1385dc5a98c23f6259a30daf3b3 100644 (file)
@@ -2002,7 +2002,7 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev,
 
        ra->valid = true;
        ra->auto_rate = true;
-       ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
+       ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, &sta->deflink);
        ra->channel = chandef->chan->hw_value;
        ra->bw = (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_320) ?
                 CMD_CBW_320MHZ : sta->deflink.bandwidth;