Search Linux Wireless

Re: [PATCH v9 1/5] cfg80211: refactor cfg80211_can_use_iftype_chan()

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

 



On Tue, 2014-03-11 at 12:40 +0200, Eliad Peller wrote:
> On Mon, Mar 10, 2014 at 11:31 PM, Luciano Coelho
> <luciano.coelho@xxxxxxxxx> wrote:
> > Separate the code that counts the interface types and channels from
> > the code that check the interface combinations.  The new function that
> > checks for combinations is exported so it can be called by the
> > drivers.
> >
> > This is done in preparation for moving the interface combinations
> > checks out of cfg80211.
> >
> > Signed-off-by: Luciano Coelho <luciano.coelho@xxxxxxxxx>
> > ---
> [...]
> 
> > +int cfg80211_check_combinations(struct wiphy *wiphy,
> > +                               const int num_different_channels,
> > +                               const u8 radar_detect,
> > +                               const int iftype_num[NUM_NL80211_IFTYPES])
> > +{
> > +       int i, j, iftype;
> > +       int num_interfaces = 0;
> > +       u32 used_iftypes = 0;
> > +
> > +       for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) {
> > +               num_interfaces += iftype_num[iftype];
> > +               if (iftype_num[iftype] > 0)
> > +                       used_iftypes |= BIT(iftype);
> > +       }
> > +
> [...]
> 
> > +
> > +               for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) {
> > +                       if (wiphy->software_iftypes & BIT(iftype))
> > +                               continue;
> > +                       for (j = 0; j < c->n_limits; j++) {
> > +                               all_iftypes |= limits[j].types;
> > +                               if (!(limits[j].types & BIT(iftype)))
> > +                                       continue;
> > +                               if (limits[j].max < iftype_num[iftype])
> > +                                       goto cont;
> > +                               limits[j].max -= iftype_num[iftype];
> > +                       }
> > +               }
> > +
> > +               if (radar_detect && !(c->radar_detect_widths & radar_detect))
> > +                       goto cont;
> > +
> > +               /* Finally check that all iftypes that we're currently
> > +                * using are actually part of this combination. If they
> > +                * aren't then we can't use this combination and have
> > +                * to continue to the next.
> > +                */
> > +               if ((all_iftypes & used_iftypes) != used_iftypes)
> > +                       goto cont;
> > +
> if software_iftypes will be passed to this function, this check will
> fail (as they exist only in used_iftypes).

Good point, I guess I should skip SW interface types in the iterator
where I mark the user interfaces above...

--
Luca.

--
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