]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/net/wireless/mac80211_hwsim.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux.git] / drivers / net / wireless / mac80211_hwsim.c
index 0838af04d681a3e37f71b8d47cb58435ffbac5fb..7437faae7cf26395b706a598635eead4fcea2c6d 100644 (file)
@@ -2644,7 +2644,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
        enum nl80211_band band;
        const struct ieee80211_ops *ops = &mac80211_hwsim_ops;
        struct net *net;
-       int idx;
+       int idx, i;
        int n_limits = 0;
 
        if (WARN_ON(param->channels > 1 && !param->use_chanctx))
@@ -2768,12 +2768,23 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
                goto failed_hw;
        }
 
+       data->if_combination.max_interfaces = 0;
+       for (i = 0; i < n_limits; i++)
+               data->if_combination.max_interfaces +=
+                       data->if_limits[i].max;
+
        data->if_combination.n_limits = n_limits;
-       data->if_combination.max_interfaces = 2048;
        data->if_combination.limits = data->if_limits;
 
-       hw->wiphy->iface_combinations = &data->if_combination;
-       hw->wiphy->n_iface_combinations = 1;
+       /*
+        * If we actually were asked to support combinations,
+        * advertise them - if there's only a single thing like
+        * only IBSS then don't advertise it as combinations.
+        */
+       if (data->if_combination.max_interfaces > 1) {
+               hw->wiphy->iface_combinations = &data->if_combination;
+               hw->wiphy->n_iface_combinations = 1;
+       }
 
        if (param->ciphers) {
                memcpy(data->ciphers, param->ciphers,
@@ -3620,35 +3631,29 @@ static int hwsim_dump_radio_nl(struct sk_buff *skb,
 static const struct genl_ops hwsim_ops[] = {
        {
                .cmd = HWSIM_CMD_REGISTER,
-               .policy = hwsim_genl_policy,
                .doit = hwsim_register_received_nl,
                .flags = GENL_UNS_ADMIN_PERM,
        },
        {
                .cmd = HWSIM_CMD_FRAME,
-               .policy = hwsim_genl_policy,
                .doit = hwsim_cloned_frame_received_nl,
        },
        {
                .cmd = HWSIM_CMD_TX_INFO_FRAME,
-               .policy = hwsim_genl_policy,
                .doit = hwsim_tx_info_frame_received_nl,
        },
        {
                .cmd = HWSIM_CMD_NEW_RADIO,
-               .policy = hwsim_genl_policy,
                .doit = hwsim_new_radio_nl,
                .flags = GENL_UNS_ADMIN_PERM,
        },
        {
                .cmd = HWSIM_CMD_DEL_RADIO,
-               .policy = hwsim_genl_policy,
                .doit = hwsim_del_radio_nl,
                .flags = GENL_UNS_ADMIN_PERM,
        },
        {
                .cmd = HWSIM_CMD_GET_RADIO,
-               .policy = hwsim_genl_policy,
                .doit = hwsim_get_radio_nl,
                .dumpit = hwsim_dump_radio_nl,
        },
@@ -3658,6 +3663,7 @@ static struct genl_family hwsim_genl_family __ro_after_init = {
        .name = "MAC80211_HWSIM",
        .version = 1,
        .maxattr = HWSIM_ATTR_MAX,
+       .policy = hwsim_genl_policy,
        .netnsok = true,
        .module = THIS_MODULE,
        .ops = hwsim_ops,