diff mbox

[2/2] cfg80211: avoid reg-hints in self-managed only systems

Message ID 1420112563-3981-2-git-send-email-arik@wizery.com (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show

Commit Message

Arik Nemtsov Jan. 1, 2015, 11:42 a.m. UTC
When a system contains only self-managed regulatory devices all hints
from the regulatory core are ignored. Stop hint processing early in this
case. These systems usually don't have CRDA deployed, which results in
endless (irrelevent) logs of the form:
cfg80211: Calling CRDA to update world regulatory domain

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
---
 net/wireless/reg.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Johannes Berg Jan. 6, 2015, 10:56 a.m. UTC | #1
On Thu, 2015-01-01 at 13:42 +0200, Arik Nemtsov wrote:
> When a system contains only self-managed regulatory devices all hints
> from the regulatory core are ignored. Stop hint processing early in this
> case. These systems usually don't have CRDA deployed, which results in
> endless (irrelevent) logs of the form:
> cfg80211: Calling CRDA to update world regulatory domain

Applied.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg Jan. 6, 2015, 1:59 p.m. UTC | #2
On Tue, 2015-01-06 at 11:56 +0100, Johannes Berg wrote:
> On Thu, 2015-01-01 at 13:42 +0200, Arik Nemtsov wrote:
> > When a system contains only self-managed regulatory devices all hints
> > from the regulatory core are ignored. Stop hint processing early in this
> > case. These systems usually don't have CRDA deployed, which results in
> > endless (irrelevent) logs of the form:
> > cfg80211: Calling CRDA to update world regulatory domain
> 
> Applied.

I take that back - dropped again. This was causing spurious messages in
the hwsim test run VM, saying something like "couldn't set reg domain:
-7". Maybe at that point not a single wiphy existed?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arik Nemtsov Jan. 6, 2015, 2:04 p.m. UTC | #3
On Tue, Jan 6, 2015 at 3:59 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Tue, 2015-01-06 at 11:56 +0100, Johannes Berg wrote:
>> On Thu, 2015-01-01 at 13:42 +0200, Arik Nemtsov wrote:
>> > When a system contains only self-managed regulatory devices all hints
>> > from the regulatory core are ignored. Stop hint processing early in this
>> > case. These systems usually don't have CRDA deployed, which results in
>> > endless (irrelevent) logs of the form:
>> > cfg80211: Calling CRDA to update world regulatory domain
>>
>> Applied.
>
> I take that back - dropped again. This was causing spurious messages in
> the hwsim test run VM, saying something like "couldn't set reg domain:
> -7". Maybe at that point not a single wiphy existed?

Interesting. I guess I should fix this to only drop the request in
case there's at least one self-managed wiphy.

Arik
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arik Nemtsov Jan. 7, 2015, 1:38 p.m. UTC | #4
On Tue, Jan 6, 2015 at 4:04 PM, Arik Nemtsov <arik@wizery.com> wrote:
> On Tue, Jan 6, 2015 at 3:59 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
>> On Tue, 2015-01-06 at 11:56 +0100, Johannes Berg wrote:
>>> On Thu, 2015-01-01 at 13:42 +0200, Arik Nemtsov wrote:
>>> > When a system contains only self-managed regulatory devices all hints
>>> > from the regulatory core are ignored. Stop hint processing early in this
>>> > case. These systems usually don't have CRDA deployed, which results in
>>> > endless (irrelevent) logs of the form:
>>> > cfg80211: Calling CRDA to update world regulatory domain
>>>
>>> Applied.
>>
>> I take that back - dropped again. This was causing spurious messages in
>> the hwsim test run VM, saying something like "couldn't set reg domain:
>> -7". Maybe at that point not a single wiphy existed?
>
> Interesting. I guess I should fix this to only drop the request in
> case there's at least one self-managed wiphy.

Could you point me to the hwsim test that failed for you?
Also where is that message coming from? I don't see it in wpa_s or the kernel.

Arik
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg Jan. 7, 2015, 1:42 p.m. UTC | #5
On Wed, 2015-01-07 at 15:38 +0200, Arik Nemtsov wrote:
> On Tue, Jan 6, 2015 at 4:04 PM, Arik Nemtsov <arik@wizery.com> wrote:
> > On Tue, Jan 6, 2015 at 3:59 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
> >> On Tue, 2015-01-06 at 11:56 +0100, Johannes Berg wrote:
> >>> On Thu, 2015-01-01 at 13:42 +0200, Arik Nemtsov wrote:
> >>> > When a system contains only self-managed regulatory devices all hints
> >>> > from the regulatory core are ignored. Stop hint processing early in this
> >>> > case. These systems usually don't have CRDA deployed, which results in
> >>> > endless (irrelevent) logs of the form:
> >>> > cfg80211: Calling CRDA to update world regulatory domain
> >>>
> >>> Applied.
> >>
> >> I take that back - dropped again. This was causing spurious messages in
> >> the hwsim test run VM, saying something like "couldn't set reg domain:
> >> -7". Maybe at that point not a single wiphy existed?
> >
> > Interesting. I guess I should fix this to only drop the request in
> > case there's at least one self-managed wiphy.
> 
> Could you point me to the hwsim test that failed for you?

I don't think it was a specific test case - the message seems to have
come during boot. OTOH, I also reverted some of Eliad's patches, so
perhaps I should retest without those?

> Also where is that message coming from? I don't see it in wpa_s or the kernel.

I have no idea! I can't even explain where the -7 (-E2BIG) came from!

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arik Nemtsov Jan. 7, 2015, 1:45 p.m. UTC | #6
On Wed, Jan 7, 2015 at 3:42 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Wed, 2015-01-07 at 15:38 +0200, Arik Nemtsov wrote:
>> On Tue, Jan 6, 2015 at 4:04 PM, Arik Nemtsov <arik@wizery.com> wrote:
>> > On Tue, Jan 6, 2015 at 3:59 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
>> >> On Tue, 2015-01-06 at 11:56 +0100, Johannes Berg wrote:
>> >>> On Thu, 2015-01-01 at 13:42 +0200, Arik Nemtsov wrote:
>> >>> > When a system contains only self-managed regulatory devices all hints
>> >>> > from the regulatory core are ignored. Stop hint processing early in this
>> >>> > case. These systems usually don't have CRDA deployed, which results in
>> >>> > endless (irrelevent) logs of the form:
>> >>> > cfg80211: Calling CRDA to update world regulatory domain
>> >>>
>> >>> Applied.
>> >>
>> >> I take that back - dropped again. This was causing spurious messages in
>> >> the hwsim test run VM, saying something like "couldn't set reg domain:
>> >> -7". Maybe at that point not a single wiphy existed?
>> >
>> > Interesting. I guess I should fix this to only drop the request in
>> > case there's at least one self-managed wiphy.
>>
>> Could you point me to the hwsim test that failed for you?
>
> I don't think it was a specific test case - the message seems to have
> come during boot. OTOH, I also reverted some of Eliad's patches, so
> perhaps I should retest without those?

It's a good check to add anyway (at least one self-managed device).
Since the regulatory queues us the world-update core hint right away..
Not sure why I haven't encountered it, I'll try to introduce some
sleep() calls to reproduce. It's a real bug I believe.

>
>> Also where is that message coming from? I don't see it in wpa_s or the kernel.
>
> I have no idea! I can't even explain where the -7 (-E2BIG) came from!

Yea that's what I was after as well. :)

Arik
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 9b5662f..21b2095 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2102,6 +2102,22 @@  out_free:
 	reg_free_request(reg_request);
 }
 
+static bool reg_only_self_managed_wiphys(void)
+{
+	struct cfg80211_registered_device *rdev;
+	struct wiphy *wiphy;
+
+	ASSERT_RTNL();
+
+	list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
+		wiphy = &rdev->wiphy;
+		if (!(wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED))
+			return false;
+	}
+
+	return true;
+}
+
 /*
  * Processes regulatory hints, this is all the NL80211_REGDOM_SET_BY_*
  * Regulatory hints come on a first come first serve basis and we
@@ -2133,6 +2149,11 @@  static void reg_process_pending_hints(void)
 
 	spin_unlock(&reg_requests_lock);
 
+	if (reg_only_self_managed_wiphys()) {
+		reg_free_request(reg_request);
+		return;
+	}
+
 	reg_process_hint(reg_request);
 }