OSDN Git Service

mt76: allow hw driver code to overwrite wiphy interface_modes
authorLorenzo Bianconi <lorenzo@kernel.org>
Fri, 28 May 2021 11:02:24 +0000 (13:02 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 19 Jun 2021 07:22:47 +0000 (09:22 +0200)
Move wiphy interface_modes configuration in mt76_alloc_device and
mt76_alloc_phy in order to be overwritten by hw specific code
since some drivers do not support all operating modes (mt7921
supports sta only in the current codebase)

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mac80211.c
drivers/net/wireless/mediatek/mt76/mt7921/init.c

index 447bc9a..49da219 100644 (file)
@@ -331,17 +331,6 @@ mt76_phy_init(struct mt76_phy *phy, struct ieee80211_hw *hw)
        ieee80211_hw_set(hw, MFP_CAPABLE);
        ieee80211_hw_set(hw, AP_LINK_PS);
        ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
-
-       wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
-       wiphy->interface_modes =
-               BIT(NL80211_IFTYPE_STATION) |
-               BIT(NL80211_IFTYPE_AP) |
-#ifdef CONFIG_MAC80211_MESH
-               BIT(NL80211_IFTYPE_MESH_POINT) |
-#endif
-               BIT(NL80211_IFTYPE_P2P_CLIENT) |
-               BIT(NL80211_IFTYPE_P2P_GO) |
-               BIT(NL80211_IFTYPE_ADHOC);
 }
 
 struct mt76_phy *
@@ -362,6 +351,17 @@ mt76_alloc_phy(struct mt76_dev *dev, unsigned int size,
        phy->hw = hw;
        phy->priv = hw->priv + phy_size;
 
+       hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
+       hw->wiphy->interface_modes =
+               BIT(NL80211_IFTYPE_STATION) |
+               BIT(NL80211_IFTYPE_AP) |
+#ifdef CONFIG_MAC80211_MESH
+               BIT(NL80211_IFTYPE_MESH_POINT) |
+#endif
+               BIT(NL80211_IFTYPE_P2P_CLIENT) |
+               BIT(NL80211_IFTYPE_P2P_GO) |
+               BIT(NL80211_IFTYPE_ADHOC);
+
        return phy;
 }
 EXPORT_SYMBOL_GPL(mt76_alloc_phy);
@@ -444,6 +444,17 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
        mutex_init(&dev->mcu.mutex);
        dev->tx_worker.fn = mt76_tx_worker;
 
+       hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
+       hw->wiphy->interface_modes =
+               BIT(NL80211_IFTYPE_STATION) |
+               BIT(NL80211_IFTYPE_AP) |
+#ifdef CONFIG_MAC80211_MESH
+               BIT(NL80211_IFTYPE_MESH_POINT) |
+#endif
+               BIT(NL80211_IFTYPE_P2P_CLIENT) |
+               BIT(NL80211_IFTYPE_P2P_GO) |
+               BIT(NL80211_IFTYPE_ADHOC);
+
        spin_lock_init(&dev->token_lock);
        idr_init(&dev->token);
 
index 99701cd..9253706 100644 (file)
@@ -62,6 +62,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)
        hw->vif_data_size = sizeof(struct mt7921_vif);
 
        wiphy->iface_combinations = if_comb;
+       wiphy->flags &= ~WIPHY_FLAG_IBSS_RSN;
+       wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
        wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
        wiphy->max_scan_ie_len = MT76_CONNAC_SCAN_IE_LEN;
        wiphy->max_scan_ssids = 4;