linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: Eliad Peller <eliad@wizery.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	Michal Kazior <michal.kazior@tieto.com>,
	sw@simonwunderlich.de, andrei.otcheretianski@intel.com
Subject: Re: [PATCH v9 1/5] cfg80211: refactor cfg80211_can_use_iftype_chan()
Date: Tue, 11 Mar 2014 15:09:04 +0200	[thread overview]
Message-ID: <1394543344.19973.8.camel@dubbel> (raw)
In-Reply-To: <CAB3XZEdhLOOT+6CYcqCMRBDBE66-EuXXkMiSLZmvedo+iZEZaA@mail.gmail.com>

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@intel.com> 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@intel.com>
> > ---
> [...]
> 
> > +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.


  reply	other threads:[~2014-03-11 13:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 21:31 [PATCH v9 0/5] cfg80211/mac80211: move interface combinations check to mac80211 Luciano Coelho
2014-03-10 21:31 ` [PATCH v9 1/5] cfg80211: refactor cfg80211_can_use_iftype_chan() Luciano Coelho
2014-03-11 10:40   ` Eliad Peller
2014-03-11 13:09     ` Luca Coelho [this message]
2014-03-10 21:31 ` [PATCH v9 2/5] cfg80211/mac80211: refactor cfg80211_chandef_dfs_required() Luciano Coelho
2014-03-11 10:45   ` Eliad Peller
2014-03-11 13:40     ` Luca Coelho
2014-03-10 21:31 ` [PATCH v9 3/5] cfg80211/mac80211: move interface counting for combination check to mac80211 Luciano Coelho
2014-03-10 21:31 ` [PATCH v9 4/5] cfg80211/mac80211: move combination check to mac80211 for ibss Luciano Coelho
2014-03-10 21:31 ` [PATCH v9 5/5] cfg80211/mac80211: move more combination checks to mac80211 Luciano Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394543344.19973.8.camel@dubbel \
    --to=luca@coelho.fi \
    --cc=andrei.otcheretianski@intel.com \
    --cc=eliad@wizery.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=michal.kazior@tieto.com \
    --cc=sw@simonwunderlich.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).