mt76: connac: move mt76_connac_mcu_bss_omac_tlv in connac module
authorLorenzo Bianconi <lorenzo@kernel.org>
Thu, 23 Dec 2021 12:07:30 +0000 (13:07 +0100)
committerFelix Fietkau <nbd@nbd.name>
Thu, 3 Feb 2022 12:57:57 +0000 (13:57 +0100)
Move mt7915_mcu_bss_omac_tlv/mt7615_mcu_bss_omac_tlv in connac module
since it is shared between mt7615 and mt7915 drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
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

index 759dcf0..7c48bce 100644 (file)
@@ -836,47 +836,6 @@ mt7615_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
        return 0;
 }
 
-static void
-mt7615_mcu_bss_omac_tlv(struct sk_buff *skb, struct ieee80211_vif *vif)
-{
-       struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
-       u8 omac_idx = mvif->mt76.omac_idx;
-       struct bss_info_omac *omac;
-       struct tlv *tlv;
-       u32 type = 0;
-
-       tlv = mt76_connac_mcu_add_tlv(skb, BSS_INFO_OMAC, sizeof(*omac));
-
-       switch (vif->type) {
-       case NL80211_IFTYPE_MONITOR:
-       case NL80211_IFTYPE_MESH_POINT:
-       case NL80211_IFTYPE_AP:
-               if (vif->p2p)
-                       type = CONNECTION_P2P_GO;
-               else
-                       type = CONNECTION_INFRA_AP;
-               break;
-       case NL80211_IFTYPE_STATION:
-               if (vif->p2p)
-                       type = CONNECTION_P2P_GC;
-               else
-                       type = CONNECTION_INFRA_STA;
-               break;
-       case NL80211_IFTYPE_ADHOC:
-               type = CONNECTION_IBSS_ADHOC;
-               break;
-       default:
-               WARN_ON(1);
-               break;
-       }
-
-       omac = (struct bss_info_omac *)tlv;
-       omac->conn_type = cpu_to_le32(type);
-       omac->omac_idx = mvif->mt76.omac_idx;
-       omac->band_idx = mvif->mt76.band_idx;
-       omac->hw_bss_idx = omac_idx > EXT_BSSID_START ? HW_BSSID_0 : omac_idx;
-}
-
 /* SIFS 20us + 512 byte beacon tranmitted by 1Mbps (3906us) */
 #define BCN_TX_ESTIMATE_TIME (4096 + 20)
 static void
@@ -913,7 +872,7 @@ mt7615_mcu_add_bss(struct mt7615_phy *phy, struct ieee80211_vif *vif,
                return PTR_ERR(skb);
 
        if (enable)
-               mt7615_mcu_bss_omac_tlv(skb, vif);
+               mt76_connac_mcu_bss_omac_tlv(skb, vif);
 
        mt7615_mcu_bss_basic_tlv(skb, vif, sta, phy, enable);
 
index 7a7009b..44be4e6 100644 (file)
@@ -316,6 +316,48 @@ mt76_connac_mcu_alloc_wtbl_req(struct mt76_dev *dev, struct mt76_wcid *wcid,
 }
 EXPORT_SYMBOL_GPL(mt76_connac_mcu_alloc_wtbl_req);
 
+void mt76_connac_mcu_bss_omac_tlv(struct sk_buff *skb,
+                                 struct ieee80211_vif *vif)
+{
+       struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
+       u8 omac_idx = mvif->omac_idx;
+       struct bss_info_omac *omac;
+       struct tlv *tlv;
+       u32 type = 0;
+
+       switch (vif->type) {
+       case NL80211_IFTYPE_MONITOR:
+       case NL80211_IFTYPE_MESH_POINT:
+       case NL80211_IFTYPE_AP:
+               if (vif->p2p)
+                       type = CONNECTION_P2P_GO;
+               else
+                       type = CONNECTION_INFRA_AP;
+               break;
+       case NL80211_IFTYPE_STATION:
+               if (vif->p2p)
+                       type = CONNECTION_P2P_GC;
+               else
+                       type = CONNECTION_INFRA_STA;
+               break;
+       case NL80211_IFTYPE_ADHOC:
+               type = CONNECTION_IBSS_ADHOC;
+               break;
+       default:
+               WARN_ON(1);
+               break;
+       }
+
+       tlv = mt76_connac_mcu_add_tlv(skb, BSS_INFO_OMAC, sizeof(*omac));
+
+       omac = (struct bss_info_omac *)tlv;
+       omac->conn_type = cpu_to_le32(type);
+       omac->omac_idx = mvif->omac_idx;
+       omac->band_idx = mvif->band_idx;
+       omac->hw_bss_idx = omac_idx > EXT_BSSID_START ? HW_BSSID_0 : omac_idx;
+}
+EXPORT_SYMBOL_GPL(mt76_connac_mcu_bss_omac_tlv);
+
 void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
                                   struct ieee80211_vif *vif,
                                   struct ieee80211_sta *sta,
index fc9a084..ec37225 100644 (file)
@@ -1592,4 +1592,7 @@ int mt76_connac_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
                            struct mt76_connac_sta_key_conf *sta_key_conf,
                            struct ieee80211_key_conf *key, int mcu_cmd,
                            struct mt76_wcid *wcid, enum set_key_cmd cmd);
+
+void mt76_connac_mcu_bss_omac_tlv(struct sk_buff *skb,
+                                 struct ieee80211_vif *vif);
 #endif /* __MT76_CONNAC_MCU_H */
index ec7ca7e..20dc4de 100644 (file)
@@ -552,43 +552,6 @@ mt7915_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
        return 0;
 }
 
-static void
-mt7915_mcu_bss_omac_tlv(struct sk_buff *skb, struct ieee80211_vif *vif)
-{
-       struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
-       struct bss_info_omac *omac;
-       struct tlv *tlv;
-       u32 type = 0;
-       u8 idx;
-
-       tlv = mt76_connac_mcu_add_tlv(skb, BSS_INFO_OMAC, sizeof(*omac));
-
-       switch (vif->type) {
-       case NL80211_IFTYPE_MONITOR:
-       case NL80211_IFTYPE_MESH_POINT:
-       case NL80211_IFTYPE_AP:
-               type = CONNECTION_INFRA_AP;
-               break;
-       case NL80211_IFTYPE_STATION:
-               type = CONNECTION_INFRA_STA;
-               break;
-       case NL80211_IFTYPE_ADHOC:
-               type = CONNECTION_IBSS_ADHOC;
-               break;
-       default:
-               WARN_ON(1);
-               break;
-       }
-
-       omac = (struct bss_info_omac *)tlv;
-       idx = mvif->mt76.omac_idx > EXT_BSSID_START ? HW_BSSID_0
-                                                   : mvif->mt76.omac_idx;
-       omac->conn_type = cpu_to_le32(type);
-       omac->omac_idx = mvif->mt76.omac_idx;
-       omac->band_idx = mvif->mt76.band_idx;
-       omac->hw_bss_idx = idx;
-}
-
 struct mt7915_he_obss_narrow_bw_ru_data {
        bool tolerated;
 };
@@ -837,7 +800,7 @@ int mt7915_mcu_add_bss_info(struct mt7915_phy *phy,
 
        /* bss_omac must be first */
        if (enable)
-               mt7915_mcu_bss_omac_tlv(skb, vif);
+               mt76_connac_mcu_bss_omac_tlv(skb, vif);
 
        mt7915_mcu_bss_basic_tlv(skb, vif, phy, enable);