Search Linux Wireless

Re: [PATCH v4 3/4] cfg80211/mac80211: move interface counting for combination check to mac80211

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24 February 2014 21:54, Luciano Coelho <luca@xxxxxxxxx> wrote:

[...]

> --- a/net/mac80211/util.c
> +++ b/net/mac80211/util.c
> @@ -2801,3 +2801,79 @@ void ieee80211_recalc_dtim(struct ieee80211_local *local,
>
>         ps->dtim_count = dtim_count;
>  }
> +
> +int ieee80211_check_combinations(struct ieee80211_local *local,
> +                                struct ieee80211_sub_if_data *sdata,
> +                                const struct cfg80211_chan_def *chandef,
> +                                enum ieee80211_chanctx_mode chanmode,
> +                                u8 radar_detect)
> +{
> +       struct ieee80211_sub_if_data *sdata_iter;
> +       enum nl80211_iftype iftype = sdata->wdev.iftype;
> +       u32 used_iftypes = 0;
> +       int num[NUM_NL80211_IFTYPES];
> +       struct ieee80211_chanctx *ctx;
> +       int num_different_channels = 1;
> +       int total = 1;
> +
> +       lockdep_assert_held(&local->chanctx_mtx);
> +
> +       if (WARN_ON(hweight32(radar_detect) > 1))
> +               return -EINVAL;
> +
> +       if (WARN_ON(chanmode == IEEE80211_CHANCTX_SHARED && !chandef->chan))
> +               return -EINVAL;
> +
> +       if (WARN_ON(iftype >= NUM_NL80211_IFTYPES))
> +               return -EINVAL;
> +
> +       /* Always allow software iftypes */
> +       if (local->hw.wiphy->software_iftypes & BIT(iftype)) {
> +               if (radar_detect)
> +                       return -EINVAL;
> +               return 0;
> +       }
> +
> +       memset(num, 0, sizeof(num));
> +
> +       if (iftype != NL80211_IFTYPE_UNSPECIFIED) {
> +               used_iftypes = BIT(iftype);
> +               num[iftype] = 1;
> +       }
> +

> +       list_for_each_entry(ctx, &local->chanctx_list, list) {
> +               if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) {
> +                       num_different_channels++;
> +                       continue;
> +               }
> +               if ((chanmode == IEEE80211_CHANCTX_SHARED) &&
> +                   cfg80211_chandef_compatible(chandef,
> +                                               &ctx->conf.def))
> +                       continue;
> +               num_different_channels++;
> +               if (ctx->conf.radar_enabled)
> +                       radar_detect |= BIT(ctx->conf.def.width);
> +       }

Hmm.. now that I think about it -- is it correct to skip updating
radar_detect when a chanctx is exclusive? Shouldn't the radar_enabled
check be done at the beginning of each iteration?


Michał
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux