linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Kazior <michal.kazior@tieto.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [RFC v3 12/13] cfg80211: add channel checking for iface combinations
Date: Tue, 26 Jun 2012 15:44:35 +0200	[thread overview]
Message-ID: <4FE9BCC3.7070704@tieto.com> (raw)
In-Reply-To: <1340717368.14634.36.camel@jlt3.sipsolutions.net>

Johannes Berg wrote:
> On Tue, 2012-06-26 at 14:30 +0200, Michal Kazior wrote:
>
>> +#define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
>
> Might make sense to put this into cfg80211.h, since e.g. hwsim could
> support this many channels?
>
>> +		cfg80211_get_chan_state(rdev, wdev_iter, &ch, &chmode);
>> +
>> +		switch (chmode) {
>> +		case CHAN_MODE_UNDEFINED:
>> +			break;
>> +		case CHAN_MODE_SHARED:
>> +			for (i = 0; i < CFG80211_MAX_NUM_DIFFERENT_CHANNELS; i++)
>> +				if (!used_channels[i] || used_channels[i] == ch)
>> +					break;
>> +
>> +			BUG_ON(i == CFG80211_MAX_NUM_DIFFERENT_CHANNELS);
>
> I'd prefer not to use BUG_ON(), maybe WARN_ON() and return some error?
> It seems it could actually happen with buggy drivers that suddenly go
> above their num_different_channels by switching around themselves or
> something?

Hmm.. Now that I think of it we could probably hit the BUG_ON normally. 
Suppose a driver supports num_different_channels == 
CFG80211_MAX_NUM_DIFFERENT_CHANNELS. If cfg80211_can_use_iftype_chan is 
called with another different channel we will hit the BUG_ON, no?

I think we should either do a WARN_ON_ONCE here, or nothing actually. 
And return -EBUSY of course.


-- 
Pozdrawiam / Best regards, Michal Kazior.

  reply	other threads:[~2012-06-26 13:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-26 12:30 [RFC v3] respect channels in iface combinations Michal Kazior
2012-06-26 12:30 ` [RFC v3 01/13] cfg80211: introduce cfg80211_stop_ap Michal Kazior
2012-06-26 12:30 ` [RFC v3 02/13] cfg80211: .stop_ap when interface is going down Michal Kazior
2012-06-26 12:30 ` [RFC v3 03/13] cfg80211: add channel tracking for AP and mesh Michal Kazior
2012-06-26 12:30 ` [RFC v3 04/13] cfg80211: track ibss fixed channel Michal Kazior
2012-06-26 12:30 ` [RFC v3 05/13] cfg80211: introduce cfg80211_get_chan_state Michal Kazior
2012-06-26 12:30 ` [RFC v3 06/13] cfg80211: track monitor interfaces count Michal Kazior
2012-06-26 12:30 ` [RFC v3 07/13] mac80211: refactor virtual monitor code Michal Kazior
2012-06-26 12:30 ` [RFC v3 08/13] cfg80211: refuse to .set_monitor_channel when non-monitors are present Michal Kazior
2012-06-26 12:30 ` [RFC v3 09/13] cfg80211: track monitor channel Michal Kazior
2012-06-26 12:30 ` [RFC v3 10/13] cfg80211: set initial " Michal Kazior
2012-06-26 12:30 ` [RFC v3 11/13] cfg80211/mac80211: remove .get_channel Michal Kazior
2012-06-26 13:22   ` Johannes Berg
2012-06-26 12:30 ` [RFC v3 12/13] cfg80211: add channel checking for iface combinations Michal Kazior
2012-06-26 13:29   ` Johannes Berg
2012-06-26 13:44     ` Michal Kazior [this message]
2012-06-26 15:32       ` Johannes Berg
2012-06-26 12:30 ` [RFC v3 13/13] cfg80211: respect iface combinations when starting operation Michal Kazior
2012-06-26 13:31 ` [RFC v3] respect channels in iface combinations Johannes Berg
2012-06-26 14:05   ` Michal Kazior

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=4FE9BCC3.7070704@tieto.com \
    --to=michal.kazior@tieto.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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).