From johannes at sipsolutions.net  Fri Jan 17 04:51:50 2014
From: johannes at sipsolutions.net (Johannes Berg)
Date: Fri, 17 Jan 2014 10:51:50 +0100
Subject: [wireless-regdb] [PATCH] regdb: Republic of Korea: fix double rule
Message-ID: <1389952310.6858.1.camel@jlt4.sipsolutions.net>

From: Johannes Berg <johannes.berg at intel.com>

There's no need to have a 20 MHz and a 40 MHz rule that are
other wise completely the same, remove the 20 MHz one.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 db.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/db.txt b/db.txt
index fcab208..bf99234 100644
--- a/db.txt
+++ b/db.txt
@@ -467,7 +467,6 @@ country KP: DFS-JP
 	(5735 - 5815 @ 80), (30)
 
 country KR: DFS-JP
-	(2402 - 2482 @ 20), (20)
 	(2402 - 2482 @ 40), (20)
 	(5170 - 5250 @ 80), (20)
 	(5250 - 5330 @ 80), (20), DFS
-- 
1.8.5.1





From mcgrof at do-not-panic.com  Fri Jan 24 18:02:11 2014
From: mcgrof at do-not-panic.com (Luis R. Rodriguez)
Date: Fri, 24 Jan 2014 15:02:11 -0800
Subject: [wireless-regdb] CRDA: Build Fail: Database signature
	verification failed
In-Reply-To: <CABPxzYLu+yjkfsi13BXG8sKoySu_CwtN+uSgwwYdiXdEq8sGMw@mail.gmail.com>
References: <CABPxzYJSBagxbz4nd8=Qt_HbG4ecqe=-cbzi0N4JDPCwDE42Mg@mail.gmail.com>
 <CABPxzYLu+yjkfsi13BXG8sKoySu_CwtN+uSgwwYdiXdEq8sGMw@mail.gmail.com>
Message-ID: <CAB=NE6U7zy8MeO4qLuWsEC_t69JKkS2=98crGrp4073=5WHU9Q@mail.gmail.com>

On Mon, Dec 16, 2013 at 11:14 PM, Krishna Chaitanya
<chaitanya.mgit at gmail.com> wrote:
> On Tue, Dec 17, 2013 at 12:20 PM, Krishna Chaitanya
> <chaitanya.mgit at gmail.com> wrote:
>> Hi,
>>
>> With the latest git source, i am seeing a build failure with the below error.
>>
>>   LD   crda
>>   CC   intersect.o
>>   LD   intersect
>>   CC   regdbdump.o
>>   LD   regdbdump
>>   CC   db2rd.o
>>   LD   db2rd
>>   CC   optimize.o
>>   LD   optimize
>>   CHK  /usr/lib/crda/regulatory.bin
>> Database signature verification failed.
>> Invalid or empty regulatory file, note: a binary regulatory file should be used.
>> make: *** [verify] Error 234
>>
>> Is there something wrong with the certificate?
>>
> Additional info:
>
> # regdbdump /usr/lib/crda/regulatory.bin
> Database signature verification failed.
> #  ls -l /usr/lib/crda/regulatory.bin
> -rw-r--r-- 1 root root 3344 Dec 16 17:34 /usr/lib/crda/regulatory.bin
>
> regualtory.bin copied from wireless-regdb latest git.

John, what ever happened with this, I forget.

  Luis


From mcgrof at do-not-panic.com  Fri Jan 24 19:09:06 2014
From: mcgrof at do-not-panic.com (Luis R. Rodriguez)
Date: Fri, 24 Jan 2014 16:09:06 -0800
Subject: [wireless-regdb] [PATCH v2 3/6] cfg80211: Enable GO operation
 on additional channels
In-Reply-To: <1389801162-14488-4-git-send-email-ilan.peer@intel.com>
References: <1389801162-14488-1-git-send-email-ilan.peer@intel.com>
 <1389801162-14488-4-git-send-email-ilan.peer@intel.com>
Message-ID: <20140125000901.GA28512@garbanzo.do-not-panic.com>

On Wed, Jan 15, 2014 at 05:52:39PM +0200, Ilan Peer wrote:
> Allow GO operation on a channel marked with IEEE80211_CHAN_GO_CONCURRENT
> iff there is an active station interface that is associated to
> an AP operating on the same channel in 2.4 or the same UNII band in 5.2
> (assuming that the AP is an authorized master)
> 
> Note that this is a permissive approach to the FCC definitions,
> that require a clear assessment that the device operating the AP is
> an authorized master, i.e., with radar detection and DFS capabilities.
> 
> It is assumed that such restrictions are enforced by user space.
> Furthermore, it is assumed, that if the conditions that allowed for
> the operation of the GO on such a channel change, i.e., the station
> interface disconnected from the AP, it is the responsibility of user
> space to evacuate the GO from the channel.

You may be interested in perhaps picking up my regulatory quiescing patch.
Can you check and let me know?

> diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
> index 81c05e4..f4012fc 100644
> --- a/net/wireless/Kconfig
> +++ b/net/wireless/Kconfig
> @@ -102,6 +102,15 @@ config CFG80211_REG_CELLULAR_HINTS
>  	  This option adds support for drivers that can receive regulatory
>  	  hints from cellular base stations
>  
> +config CFG80211_REG_SOFT_CONFIGURATIONS

Please use something specific to P2P, maybe
CFG80211_REG_P2P_RELAX or something. It would be good
to also provide a reference to a URL on wireless.kernel.org
on documentation about an example userspace instance or effort
that is doing this.

> diff --git a/net/wireless/chan.c b/net/wireless/chan.c
> index 78559b5..d47856b 100644
> --- a/net/wireless/chan.c
> +++ b/net/wireless/chan.c
> @@ -605,15 +605,77 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
>  }
>  EXPORT_SYMBOL(cfg80211_chandef_usable);
>  
> +#ifdef CONFIG_CFG80211_REG_SOFT_CONFIGURATIONS

Please use config_enabled(CONFIG_FOO) check to simplify this.

> +/* For GO only, check if the channel can be used under permissive conditions
> + * mandated by the some regulatory bodies, i.e., the channel is marked with
> + * IEEE80211_CHAN_GO_CONCURRENT and there is an additional station interface
> + * associated to an AP on the same channel or on the same UNII band
> + * (assuming that the AP is an authorized master).
> + */

Comments go like this:

/*
 * somet suff
 * bladsf
 */

> +static bool cfg80211_go_permissive_chan(struct cfg80211_registered_device *rdev,
> +					struct ieee80211_channel *chan)
> +{
> +	struct wireless_dev *wdev_iter;
> +
> +	ASSERT_RTNL();
> +
> +	if (!(chan->flags & IEEE80211_CHAN_GO_CONCURRENT))
> +		return false;
> +
> +	list_for_each_entry(wdev_iter, &rdev->wdev_list, list) {
> +		struct ieee80211_channel *other_chan = NULL;
> +
> +		if (wdev_iter->iftype != NL80211_IFTYPE_STATION ||
> +		    !netif_running(wdev_iter->netdev))
> +				continue;
> +

<--

> +		wdev_lock(wdev_iter);
> +		if (wdev_iter->current_bss)
> +			other_chan = wdev_iter->current_bss->pub.channel;
> +		wdev_unlock(wdev_iter);

-->

This is begging to be added as a helper.

> +
> +		if (!other_chan)
> +			continue;
> +
> +		if (chan == other_chan) {
> +			return true;

No need to use braces for one liners and since you are returning
no need to indent the code below, as the else is implicit. This
in practice helps reduce general code identation.

Likeywise you can follow by a check for ! 5 GHz and bail if, and save
yourself the identation on the negative.

> +static bool cfg80211_go_permissive_chan(struct cfg80211_registered_device *rdev,
> +					struct ieee80211_channel *chan)
> +{
> +	return false;
> +}
> +#endif /* CONFIG_CFG80211_REG_SOFT_CONFIGURATIONS */

Please review chan.c well and make a call (you decide) if this
belongs on chan.c or reg.c.

> +
>  bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
> -			     struct cfg80211_chan_def *chandef)
> +			     struct cfg80211_chan_def *chandef,
> +			     enum nl80211_iftype iftype)
>  {
> +	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
>  	bool res;
>  	u32 prohibited_flags = IEEE80211_CHAN_DISABLED |
> -			       IEEE80211_CHAN_NO_IR |
>  			       IEEE80211_CHAN_RADAR;
>  
> -	trace_cfg80211_reg_can_beacon(wiphy, chandef);
> +	trace_cfg80211_reg_can_beacon(wiphy, chandef, iftype);
> +
> +	/* Under certain conditions suggested by the some regulatory bodies
> +	 * a GO can operate on channels marked with IEEE80211_NO_IR
> +	 * so set this flag only if such relaxations are not enabled and
> +	 * the conditions are not met.

Comment style.

> +	 */
> +	if (iftype != NL80211_IFTYPE_P2P_GO ||
> +	    !cfg80211_go_permissive_chan(rdev, chandef->chan))
> +		prohibited_flags |= IEEE80211_CHAN_NO_IR;

Please add a wiphy regulatory feature flag here that allows
device drivers to disable this, this can be enabled by default.
Practice shows regulatory stuff varies and I can imagine other
vendors wanting to consider disabling for some customers or
builds for whatever unestablished reasons.

> diff --git a/net/wireless/reg.h b/net/wireless/reg.h
> index cc4c2c0..1ef2daa 100644
> --- a/net/wireless/reg.h
> +++ b/net/wireless/reg.h
> @@ -102,4 +102,16 @@ void regulatory_hint_country_ie(struct wiphy *wiphy,
>   */
>  void regulatory_hint_disconnect(void);
>  
> +/**
> + * cfg80211_get_unii - get a value specifying the U-NII band the frequency
> + * belongs too.

One liners for top description on kdoc IIRC.

> + * @freq: the frequency for which we want to get the UNII band.
> +
> + * U-NII bands are defined by the FCC in C.F.R 47 part 15.
> + *
> + * Returns -EINVAL if freq is invalid, 1 for UNII-1, 2 for UNII-2,
> + * 3 for UNII-2e, 4 for UNII-3.

What's your source for UNII definition? Can you provide a URL?

  Luis


From linville at tuxdriver.com  Fri Jan 24 19:01:13 2014
From: linville at tuxdriver.com (John W. Linville)
Date: Fri, 24 Jan 2014 19:01:13 -0500
Subject: [wireless-regdb] CRDA: Build Fail: Database signature
	verification failed
In-Reply-To: <CAB=NE6U7zy8MeO4qLuWsEC_t69JKkS2=98crGrp4073=5WHU9Q@mail.gmail.com>
References: <CABPxzYJSBagxbz4nd8=Qt_HbG4ecqe=-cbzi0N4JDPCwDE42Mg@mail.gmail.com>
 <CABPxzYLu+yjkfsi13BXG8sKoySu_CwtN+uSgwwYdiXdEq8sGMw@mail.gmail.com>
 <CAB=NE6U7zy8MeO4qLuWsEC_t69JKkS2=98crGrp4073=5WHU9Q@mail.gmail.com>
Message-ID: <20140125000113.GO4309@tuxdriver.com>

On Fri, Jan 24, 2014 at 03:02:11PM -0800, Luis R. Rodriguez wrote:
> On Mon, Dec 16, 2013 at 11:14 PM, Krishna Chaitanya
> <chaitanya.mgit at gmail.com> wrote:
> > On Tue, Dec 17, 2013 at 12:20 PM, Krishna Chaitanya
> > <chaitanya.mgit at gmail.com> wrote:
> >> Hi,
> >>
> >> With the latest git source, i am seeing a build failure with the below error.
> >>
> >>   LD   crda
> >>   CC   intersect.o
> >>   LD   intersect
> >>   CC   regdbdump.o
> >>   LD   regdbdump
> >>   CC   db2rd.o
> >>   LD   db2rd
> >>   CC   optimize.o
> >>   LD   optimize
> >>   CHK  /usr/lib/crda/regulatory.bin
> >> Database signature verification failed.
> >> Invalid or empty regulatory file, note: a binary regulatory file should be used.
> >> make: *** [verify] Error 234
> >>
> >> Is there something wrong with the certificate?
> >>
> > Additional info:
> >
> > # regdbdump /usr/lib/crda/regulatory.bin
> > Database signature verification failed.
> > #  ls -l /usr/lib/crda/regulatory.bin
> > -rw-r--r-- 1 root root 3344 Dec 16 17:34 /usr/lib/crda/regulatory.bin
> >
> > regualtory.bin copied from wireless-regdb latest git.
> 
> John, what ever happened with this, I forget.

I thought these issues were resolved...?

-- 
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.


From mcgrof at do-not-panic.com  Fri Jan 24 19:20:05 2014
From: mcgrof at do-not-panic.com (Luis R. Rodriguez)
Date: Fri, 24 Jan 2014 16:20:05 -0800
Subject: [wireless-regdb] [PATCH v2 4/6] cfg80211: Add an option to hint
	indoor operation
In-Reply-To: <1389801162-14488-5-git-send-email-ilan.peer@intel.com>
References: <1389801162-14488-1-git-send-email-ilan.peer@intel.com>
 <1389801162-14488-5-git-send-email-ilan.peer@intel.com>
Message-ID: <20140125002002.GB28512@garbanzo.do-not-panic.com>

On Wed, Jan 15, 2014 at 05:52:40PM +0200, Ilan Peer wrote:
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 212b5c2..0361035 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -110,6 +110,14 @@ const struct ieee80211_regdomain __rcu *cfg80211_regdomain;
>   */
>  static int reg_num_devs_support_basehint;
>  
> +/*
> + * State variable indicating if the platform on which the devices
> + * are attached is operating in an indoor environment. The state variable
> + * is relevant for all registered devices.
> + * Note: currently not protected by any synchronization primitive.
> + */
> +static bool reg_is_indoor;
> +

See if it makes sense to instead start building up a single reg
data structure that has a slew of members. That's welcomed as a
separate patch later...

> @@ -1475,6 +1493,11 @@ reg_process_hint_user(struct regulatory_request *user_request)
>  		return treatment;
>  	}
>  
> +	if (reg_request_indoor(user_request) && treatment == REG_REQ_OK) {
> +		reg_is_indoor = true;
> +		return REG_REQ_OK;
> +	}
> +

Are you setting this to false when we disconnect (reset regulatory)?
You should.

> @@ -1658,9 +1681,6 @@ static void reg_process_hint(struct regulatory_request *reg_request)
>  	struct wiphy *wiphy = NULL;
>  	enum reg_request_treatment treatment;
>  
> -	if (WARN_ON(!reg_request->alpha2))
> -		return;
> -

last_request checks for the alpha2 are abundent... you'd
have to go review such use cases... One strategy might be
to not treat this as a pure regulatory request but rather
a hint of information, ie, not override last_request for
this type of request.

> @@ -2482,6 +2518,19 @@ int cfg80211_get_unii(int freq)
>  	return -EINVAL;
>  }
>  
> +bool regulatory_ir_allowed(struct ieee80211_channel *chan)
> +{
> +#ifdef CONFIG_CFG80211_REG_SOFT_CONFIGURATIONS
> +	if (reg_is_indoor && (chan->flags & IEEE80211_CHAN_INDOOR_ONLY))
> +		return true;
> +#endif /* CONFIG_CFG80211_REG_SOFT_CONFIGURATIONS */

config_enabled() would make this look sexier.

> @@ -2502,6 +2551,8 @@ int __init regulatory_init(void)
>  	user_alpha2[0] = '9';
>  	user_alpha2[1] = '7';
>  
> +	reg_is_indoor = false;

Yeah this is not needed as during init this will be false, but you
do want to ensure you set this to flase during reset of regulatory.

  Luis


From mcgrof at do-not-panic.com  Fri Jan 24 19:21:36 2014
From: mcgrof at do-not-panic.com (Luis R. Rodriguez)
Date: Fri, 24 Jan 2014 16:21:36 -0800
Subject: [wireless-regdb] [PATCH v2 6/6] mac80211: Enable initiating
 radiation on indoor channels
In-Reply-To: <1389801162-14488-7-git-send-email-ilan.peer@intel.com>
References: <1389801162-14488-1-git-send-email-ilan.peer@intel.com>
 <1389801162-14488-7-git-send-email-ilan.peer@intel.com>
Message-ID: <20140125002134.GC28512@garbanzo.do-not-panic.com>

On Wed, Jan 15, 2014 at 05:52:42PM +0200, Ilan Peer wrote:
> +		if (!regulatory_ir_allowed(req->channels[0]) ||

Please keep in mind that the feature flag on the wiphy would
be used in your regulatory_ir_allowed() routine.

  Luis


From mcgrof at do-not-panic.com  Fri Jan 24 19:24:18 2014
From: mcgrof at do-not-panic.com (Luis R. Rodriguez)
Date: Fri, 24 Jan 2014 16:24:18 -0800
Subject: [wireless-regdb] [PATCH v2 0/6] Enable additional channels for
	use
In-Reply-To: <1389801162-14488-1-git-send-email-ilan.peer@intel.com>
References: <1389801162-14488-1-git-send-email-ilan.peer@intel.com>
Message-ID: <20140125002416.GD28512@garbanzo.do-not-panic.com>

On Wed, Jan 15, 2014 at 05:52:36PM +0200, Ilan Peer wrote:
> Hi Luis,
> 
> I'm resending this patch set. Any chance you could review it?

Looks good but needs a bit of work. In particular the biggest
concern I have is the last_request thing, and the feature flag
on the wiphy. Other than that, tons of cleanup and one last
requirement: please document this on the wireless wiki on the
regulatory page, once accepted.

http://wireless.kernel.org/en/developers/Regulatory/processing_rules

  Luis


From johannes at sipsolutions.net  Fri Jan 31 09:11:19 2014
From: johannes at sipsolutions.net (Johannes Berg)
Date: Fri, 31 Jan 2014 15:11:19 +0100
Subject: [wireless-regdb] [PATCH v3 3/6] cfg80211: Enable GO operation
 on additional channels
In-Reply-To: <1390818118-27261-4-git-send-email-ilan.peer@intel.com>
 (sfid-20140127_112147_514798_01405A03)
References: <1390818118-27261-1-git-send-email-ilan.peer@intel.com>
 <1390818118-27261-4-git-send-email-ilan.peer@intel.com>
 (sfid-20140127_112147_514798_01405A03)
Message-ID: <1391177479.4141.23.camel@jlt4.sipsolutions.net>

On Mon, 2014-01-27 at 12:21 +0200, Ilan Peer wrote:

> It is assumed that such restrictions are enforced by user space.
> Furthermore, it is assumed, that if the conditions that allowed for
> the operation of the GO on such a channel change, i.e., the station
> interface disconnected from the AP, it is the responsibility of user
> space to evacuate the GO from the channel.

For the latter here, don't we need some sort of flag with userspace
saying "trust me, I know what I'm doing"? Or put another way - how does
this not make us break compliance when running with old versions of
wpa_supplicant?

johannes



From johannes at sipsolutions.net  Fri Jan 31 09:13:54 2014
From: johannes at sipsolutions.net (Johannes Berg)
Date: Fri, 31 Jan 2014 15:13:54 +0100
Subject: [wireless-regdb] [PATCH v3 4/6] cfg80211: Add an option to hint
	indoor operation
In-Reply-To: <1390818118-27261-5-git-send-email-ilan.peer@intel.com>
 (sfid-20140127_112047_079973_9230A036)
References: <1390818118-27261-1-git-send-email-ilan.peer@intel.com>
 <1390818118-27261-5-git-send-email-ilan.peer@intel.com>
 (sfid-20140127_112047_079973_9230A036)
Message-ID: <1391177634.4141.24.camel@jlt4.sipsolutions.net>

On Mon, 2014-01-27 at 12:21 +0200, Ilan Peer wrote:

>  	switch (user_reg_hint_type) {
>  	case NL80211_USER_REG_HINT_USER:
>  	case NL80211_USER_REG_HINT_CELL_BASE:
> -		break;
> +		if (!info->attrs[NL80211_ATTR_REG_ALPHA2])
> +			return -EINVAL;
> +
> +		data = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]);
> +		return regulatory_hint_user(data, user_reg_hint_type);
> +	case NL80211_USER_REG_HINT_INDOOR:
> +		return regulatory_hint_indoor_user();
>  	default:
>  		return -EINVAL;
>  	}
>  
> -	r = regulatory_hint_user(data, user_reg_hint_type);
> -
> -	return r;
> +	return 0;

Isn't that "return 0" dead code now?

johannes



