]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - net/mac80211/main.c
mac80211: support creating wiphy w/out creating wlanX
[mirror_ubuntu-artful-kernel.git] / net / mac80211 / main.c
index 0de7c93bf62b5a3352de711ab9deeaa21649d8a1..7d40e3f0a77be0141826caea0fd2ef3ca11f0727 100644 (file)
@@ -478,13 +478,9 @@ static const struct ieee80211_vht_cap mac80211_vht_capa_mod_mask = {
        },
 };
 
-static const u8 extended_capabilities[] = {
-       0, 0, 0, 0, 0, 0, 0,
-       WLAN_EXT_CAPA8_OPMODE_NOTIF,
-};
-
-struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
-                                       const struct ieee80211_ops *ops)
+struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
+                                          const struct ieee80211_ops *ops,
+                                          const char *requested_name)
 {
        struct ieee80211_local *local;
        int priv_size, i;
@@ -524,7 +520,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
         */
        priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
 
-       wiphy = wiphy_new(&mac80211_config_ops, priv_size);
+       wiphy = wiphy_new_nm(&mac80211_config_ops, priv_size, requested_name);
 
        if (!wiphy)
                return NULL;
@@ -539,10 +535,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
                        WIPHY_FLAG_REPORTS_OBSS |
                        WIPHY_FLAG_OFFCHAN_TX;
 
-       wiphy->extended_capabilities = extended_capabilities;
-       wiphy->extended_capabilities_mask = extended_capabilities;
-       wiphy->extended_capabilities_len = ARRAY_SIZE(extended_capabilities);
-
        if (ops->remain_on_channel)
                wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
 
@@ -591,6 +583,13 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
        wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask;
        wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask;
 
+       local->ext_capa[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF;
+
+       wiphy->extended_capabilities = local->ext_capa;
+       wiphy->extended_capabilities_mask = local->ext_capa;
+       wiphy->extended_capabilities_len =
+               ARRAY_SIZE(local->ext_capa);
+
        INIT_LIST_HEAD(&local->interfaces);
 
        __hw_addr_init(&local->mc_list);
@@ -651,7 +650,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
 
        return &local->hw;
 }
-EXPORT_SYMBOL(ieee80211_alloc_hw);
+EXPORT_SYMBOL(ieee80211_alloc_hw_nm);
 
 static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
 {
@@ -787,13 +786,14 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
                if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS))
                        return -EINVAL;
 
-               /* DFS currently not supported with channel context drivers */
+               /* DFS is not supported with multi-channel combinations yet */
                for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
                        const struct ieee80211_iface_combination *comb;
 
                        comb = &local->hw.wiphy->iface_combinations[i];
 
-                       if (comb->radar_detect_widths)
+                       if (comb->radar_detect_widths &&
+                           comb->num_different_channels > 1)
                                return -EINVAL;
                }
        }
@@ -958,6 +958,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)
                local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
 
+       /* mac80211 supports eCSA, if the driver supports STA CSA at all */
+       if (local->hw.flags & IEEE80211_HW_CHANCTX_STA_CSA)
+               local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING;
+
        local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CSA_COUNTERS_NUM;
 
        result = wiphy_register(local->hw.wiphy);
@@ -1019,7 +1023,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        }
 
        /* add one default STA interface if supported */
-       if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) {
+       if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) &&
+           !(hw->flags & IEEE80211_HW_NO_AUTO_VIF)) {
                result = ieee80211_if_add(local, "wlan%d", NULL,
                                          NL80211_IFTYPE_STATION, NULL);
                if (result)