All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>,
	linux-wireless@vger.kernel.org, victorg@ti.com,
	linville@tuxdriver.com, kgiori@qca.qualcomm.com,
	zefir.kurtisi@neratec.com, adrian@freebsd.org, j@w1.fi,
	coelho@ti.com, igalc@ti.com, nbd@nbd.name,
	mathias.kretschmer@fokus.fraunhofer.de,
	Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Subject: Re: [PATCHv6 3/6] nl80211/cfg80211: add radar detection command/event
Date: Thu, 17 Jan 2013 14:40:34 +0100	[thread overview]
Message-ID: <20130117134034.GC19552@pandem0nium> (raw)
In-Reply-To: <1358376672.15012.37.camel@jlt4.sipsolutions.net>

[-- Attachment #1: Type: text/plain, Size: 4734 bytes --]

On Wed, Jan 16, 2013 at 11:51:12PM +0100, Johannes Berg wrote:
> On Tue, 2013-01-08 at 14:04 +0100, Simon Wunderlich wrote:
> 
> 
> > + * @radar_detect_timeout: this timeout indicates the end of the channel
> > + *     availability check for radar channels (in jiffies), only after this
> > + *     period the user may initiate the tx on the channel.
> > + * @cac_started: indicates that channel availability check is started for this
> > + *     channel type.
> 
> So you're enforcing a certain CAC time, but not the time we are allowed
> to treat the channel as clear? Shouldn't *that* be in each channel
> struct, rather than the other stuff?
> 
> It also seems to me that "cac_started" isn't really all that relevant in
> the channel struct either. What seems relevant is the *result* of the
> CAC, and how long it's still valid, no?
> 

Actually there is no limit how long a channel is considered "available", at
least in ETSI. ETSI EN 301-893 v1.4.1 had a limit of 24 hours for that,
but that was removed in v1.5.1 and didn't re-appear since then (current is
v1.7.1).

But we can move the CAC/timeout in the wdev and have keep a flag field in
the channel struct instead, marking the channel as available, unavailable, etc.

What do you think?

> > +++ b/net/wireless/chan.c
> > @@ -287,14 +287,18 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
> >  			     struct cfg80211_chan_def *chandef)
> >  {
> >  	bool res;
> > +	u32 prohibited_flags;
> >  
> >  	trace_cfg80211_reg_can_beacon(wiphy, chandef);
> >  
> > -	res = cfg80211_chandef_usable(wiphy, chandef,
> > -				      IEEE80211_CHAN_DISABLED |
> > -				      IEEE80211_CHAN_PASSIVE_SCAN |
> > -				      IEEE80211_CHAN_NO_IBSS |
> > -				      IEEE80211_CHAN_RADAR);
> > +	prohibited_flags = IEEE80211_CHAN_DISABLED;
> > +
> > +	if (!(wiphy->features & NL80211_FEATURE_DFS))
> > +		prohibited_flags |= IEEE80211_CHAN_PASSIVE_SCAN |
> > +				    IEEE80211_CHAN_NO_IBSS |
> > +				    IEEE80211_CHAN_RADAR;
> 
> I have a feeling this change should take into account the channel width,
> and whether CAC completed successfully?
> 

All channels used for operation are checked already in cfg80211_chandef_usable()
for the flags.

If the channel width is supported at all is checked with cfg80211_can_use_iftype_chan()
before/after.

So I don't see the neccesity for further checking width, or am I missing something?

The CAC completed check is performed outside right now, but when we introduce
the available/unavailable flags as suggested above we can as well move this check
into cfg80211_reg_can_beacon().

> > +static int nl80211_start_radar_detection(struct sk_buff *skb,
> > +					 struct genl_info *info)
> > +{
> > +	struct cfg80211_registered_device *rdev = info->user_ptr[0];
> > +	struct net_device *dev = info->user_ptr[1];
> > +	struct wireless_dev *wdev = dev->ieee80211_ptr;
> > +	struct cfg80211_chan_def chandef;
> > +	int err;
> > +
> > +	if (!(rdev->wiphy.features & NL80211_FEATURE_DFS))
> > +		return -EOPNOTSUPP;
> > +
> > +	err = nl80211_parse_chandef(rdev, info, &chandef);
> > +	if (err)
> > +		return err;
> > +
> > +	if (!(chandef.chan->flags & IEEE80211_CHAN_RADAR))
> > +		return -EINVAL;
> > +
> > +	if (chandef.chan->cac_started)
> > +		return -EBUSY;
> > +
> > +	if (!rdev->ops->start_radar_detection)
> > +		return -EOPNOTSUPP;
> > +
> > +	mutex_lock(&rdev->devlist_mtx);
> > +	err = cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype,
> > +					   chandef.chan, CHAN_MODE_SHARED,
> > +					   BIT(chandef.width));
> > +	mutex_unlock(&rdev->devlist_mtx);
> > +
> > +	if (err)
> > +		return err;
> > +
> > +	err = rdev->ops->start_radar_detection(&rdev->wiphy, dev, &chandef);
> > +	if (!err) {
> > +		wdev->preset_chandef = chandef;
> > +		chandef.chan->cac_started = true;
> > +		chandef.chan->radar_detect_timeout = jiffies +
> > +			msecs_to_jiffies(NL80211_DFS_MIN_CAC_TIME_MS);
> > +	}
> > +
> > +	return err;
> > +}
> 
> This still seems somewhat wrong. For the duration of the CAC, the
> channel should be "locked" in some way, no? As it stands now, nothing
> prevents userspace from adding another vif and using it for something
> entirely different, while cfg80211 thinks the CAC is actually running.
> 

Hmm, we can put the "CAC state" in the wdev then, and use it for locking?

> > +	if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
> > +	    nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
> > +	    nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq))
> > +		goto nla_put_failure;
> 
> That should be the entire chandef info, and possibly the WDEV_ID too.

OK

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2013-01-17 13:40 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-08 13:04 [PATCHv6 0/6] Add DFS master ability Simon Wunderlich
2013-01-08 13:04 ` [PATCHv6 1/6] nl80211: check if channel can be used in join_ibss Simon Wunderlich
2013-01-16 22:35   ` Johannes Berg
2013-01-17 13:27     ` Simon Wunderlich
2013-01-08 13:04 ` [PATCHv6 2/6] cfg80211: check radar interface combinations Simon Wunderlich
2013-01-16 22:42   ` Johannes Berg
2013-01-16 22:44     ` Johannes Berg
2013-01-17 13:28       ` Simon Wunderlich
2013-01-30 16:34   ` Luciano Coelho
2013-01-30 16:56     ` Simon Wunderlich
2013-01-30 17:20       ` Luciano Coelho
2013-01-08 13:04 ` [PATCHv6 3/6] nl80211/cfg80211: add radar detection command/event Simon Wunderlich
2013-01-16 22:51   ` Johannes Berg
2013-01-17 13:40     ` Simon Wunderlich [this message]
2013-01-18 21:54       ` Johannes Berg
2013-01-21 10:44         ` Zefir Kurtisi
2013-01-23 12:49           ` Simon Wunderlich
2013-01-24 12:56             ` Zefir Kurtisi
2013-01-08 13:04 ` [PATCHv6 4/6] mac80211: " Simon Wunderlich
2013-01-16 22:59   ` Johannes Berg
2013-01-17 13:52     ` Simon Wunderlich
2013-01-18 22:00       ` Johannes Berg
2013-01-23 12:42         ` Simon Wunderlich
2013-01-08 13:04 ` [PATCHv6 5/6] mac80211: check radar interaction with scan and roc Simon Wunderlich
2013-01-16 23:00   ` Johannes Berg
2013-01-17 13:53     ` Simon Wunderlich
2013-01-08 13:04 ` [PATCHv6 6/6] nl80211: allow DFS in start_ap Simon Wunderlich
2013-01-16 23:22 ` [PATCHv6 0/6] Add DFS master ability Johannes Berg
2013-01-17 14:21   ` Simon Wunderlich
2013-01-18 22:08     ` Johannes Berg
2013-01-21 10:46       ` Zefir Kurtisi
2013-01-23 12:52         ` Simon Wunderlich
2013-01-24 12:19           ` Zefir Kurtisi
2013-01-23 12:57       ` Simon Wunderlich

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=20130117134034.GC19552@pandem0nium \
    --to=simon.wunderlich@s2003.tu-chemnitz.de \
    --cc=adrian@freebsd.org \
    --cc=coelho@ti.com \
    --cc=igalc@ti.com \
    --cc=j@w1.fi \
    --cc=johannes@sipsolutions.net \
    --cc=kgiori@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mathias.kretschmer@fokus.fraunhofer.de \
    --cc=nbd@nbd.name \
    --cc=siwu@hrz.tu-chemnitz.de \
    --cc=victorg@ti.com \
    --cc=zefir.kurtisi@neratec.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.