Re: [PATCH v2 4/4] cfg80211: Allow usermode to query wiphy specific regd info

2014-11-21 Thread Luis R. Rodriguez
On Fri, Nov 21, 2014 at 11:33:43AM +0200, Arik Nemtsov wrote:
> On Thu, Nov 20, 2014 at 10:54 PM, Luis R. Rodriguez  wrote:
> >>
> >> Then it gets the global one, and it knows it via a wiphy attribute:
> >>
> >>   (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) &&
> >> +   (nla_put_flag(msg, 
> >> NL80211_ATTR_WIPHY_SELF_MANAGED_REG)))
> >> +   goto nla_put_failure;
> >>
> >> (we won't do this put_flag if it's global)
> >
> > You can still follow this on wpa_s for REGULATORY_WIPHY_SELF_MANAGED, and
> > the other type that uses wiphy->regd would still follow the global 
> > regdomain.
> > The other flag I'm looking for is more informational for userspace in 
> > particular
> > 'iw reg get' (for central and all devices) or 'iw reg get dev wlan0'.
> 
> I'm not sure why another flag is needed for userspace.

wiphy->regd will be used for REGULATORY_WIPHY_SELF_MANAGED and also on
devices that regulatory_hint() is called. Even though users of regulatory_hint()
will still abide by an intersection its useful to display that device's
regulatory domain in userspace, for that you'd need to distinguish it from
REGULATORY_WIPHY_SELF_MANAGED so another flag is needed. Showing that
regulatory domain will be informational.

> If we have
> SELF_MANAGED, we'll return the per-wiphy one (if a wiphy_idx is given
> to us of course). For validation purposes, the global one is used in
> other cases. And for CUSTOM_REG, we'll return the global one (we don't
> have the per-wiphy information in cfg80211).

Atheros cards always use CUSTOM_REG first, then later if they determine
the card was programmed with an alpha2 regulatory_hint() is called and
the CUSTOM_REG flag cleared. Regardless if wiphy->regd is set it would
be useful to have that information available.

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


Re: [PATCH v2 4/4] cfg80211: Allow usermode to query wiphy specific regd info

2014-11-21 Thread Arik Nemtsov
On Thu, Nov 20, 2014 at 10:54 PM, Luis R. Rodriguez  wrote:
>>
>> Then it gets the global one, and it knows it via a wiphy attribute:
>>
>>   (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) &&
>> +   (nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)))
>> +   goto nla_put_failure;
>>
>> (we won't do this put_flag if it's global)
>
> You can still follow this on wpa_s for REGULATORY_WIPHY_SELF_MANAGED, and
> the other type that uses wiphy->regd would still follow the global regdomain.
> The other flag I'm looking for is more informational for userspace in 
> particular
> 'iw reg get' (for central and all devices) or 'iw reg get dev wlan0'.

I'm not sure why another flag is needed for userspace. If we have
SELF_MANAGED, we'll return the per-wiphy one (if a wiphy_idx is given
to us of course). For validation purposes, the global one is used in
other cases. And for CUSTOM_REG, we'll return the global one (we don't
have the per-wiphy information in cfg80211).

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


Re: [PATCH v2 4/4] cfg80211: Allow usermode to query wiphy specific regd info

2014-11-20 Thread Luis R. Rodriguez
On Thu, Nov 20, 2014 at 06:47:24PM +0200, Arik Nemtsov wrote:
> On Thu, Nov 20, 2014 at 5:22 PM, Johannes Berg
>  wrote:
> > On Sun, 2014-11-16 at 13:06 +0200, Arik Nemtsov wrote:
> >
> >> We intend to add a patch to wpa_s to always add the wiphy_idx to
> >> NL80211_CMD_GET_REG. With the current approach only drivers with
> >> SELF_MANAGED_REG will get wiphy->regd back. This is ok since these are
> >> new drivers, which are familiar with this API.
> >>
> >> But if we use your suggestion and always return wiphy->regd, then some
> >> driver like ath9k that uses regulatory_hint() will now get it's
> >> private regd returned to the wpa_s that manages it. I'm not saying
> >> it's necessarily bad, but it's different than what was returned
> >> before. The cfg80211 regdomain is intersected with wiphy->regd, so now
> >> ath9k will start getting more permissive channels in usermode.
> >>
> >> So we thought it's best to enable the new behavior only if the driver
> >> explicitly wants it, using a new regulatory flag.
> >
> > How does this work the other way around - i.e. a newer wpa_s requesting
> > per-wiphy information but it not being present?
> 
> Then it gets the global one, and it knows it via a wiphy attribute:
> 
>   (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) &&
> +   (nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)))
> +   goto nla_put_failure;
> 
> (we won't do this put_flag if it's global)

You can still follow this on wpa_s for REGULATORY_WIPHY_SELF_MANAGED, and
the other type that uses wiphy->regd would still follow the global regdomain.
The other flag I'm looking for is more informational for userspace in particular
'iw reg get' (for central and all devices) or 'iw reg get dev wlan0'.

> The supplicant patches are not up yet, but I think for now we will
> just act according to the global one. Anyway it has the option to
> change policy, since it knows.
> 
> >
> > It seems to me that either way what the kernel should return is the
> > information that will actually be applied when validated, which is of
> > course not possible when there are wiphy-specific regdomains and a
> > global one is requested (unless there's just one wiphy, which might be
> > something to consider making work?)
> 
> Well the cfg80211 regdomain is always intersected with all wiphy->regd
> in the system, so the global one is always less permissive.
> This is of course true before REGULATORY_WIPHY_SELF_MANAGED - in this
> case wiphy->regd will not affect the global regd.

The discrepancy is a long term issue when device combing but it seems folks
dealing with REGULATORY_WIPHY_SELF_MANAGED are OK with supporting whatever
issues come up.

> With CUSTOM_REG we have a special case, since the regulatory code
> doesn't set wiphy->regd, it just applies a user supplied regd to the
> wiphy channels (which get validated).

Its a custom world regdom, its a minimum base set. New information is
always welcomed to help it comply further, and that's what happens.

> If the user also happens to set  wiphy->regd himself with CUSTOM_REG,
> then it makes sense to return the per-wiphy one. The global regd is
> meaningless anyway for CUSTOM_REG, and the per-wiphy one might be too.
> But I guess we can return it if it's there?

When CUSTOM_REG is used we already have code that deals with what is
allowed or now given new hints from different sources, wpa_s can
and should rely on the channel information state it is in already.
All the intersection logic is already dealt for the device. The only
thing wpa_s could probably care more about from the regulatory data is
the actual ISO3166 alpha2 used for country IEs.

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


Re: [PATCH v2 4/4] cfg80211: Allow usermode to query wiphy specific regd info

2014-11-20 Thread Arik Nemtsov
On Thu, Nov 20, 2014 at 5:22 PM, Johannes Berg
 wrote:
> On Sun, 2014-11-16 at 13:06 +0200, Arik Nemtsov wrote:
>
>> We intend to add a patch to wpa_s to always add the wiphy_idx to
>> NL80211_CMD_GET_REG. With the current approach only drivers with
>> SELF_MANAGED_REG will get wiphy->regd back. This is ok since these are
>> new drivers, which are familiar with this API.
>>
>> But if we use your suggestion and always return wiphy->regd, then some
>> driver like ath9k that uses regulatory_hint() will now get it's
>> private regd returned to the wpa_s that manages it. I'm not saying
>> it's necessarily bad, but it's different than what was returned
>> before. The cfg80211 regdomain is intersected with wiphy->regd, so now
>> ath9k will start getting more permissive channels in usermode.
>>
>> So we thought it's best to enable the new behavior only if the driver
>> explicitly wants it, using a new regulatory flag.
>
> How does this work the other way around - i.e. a newer wpa_s requesting
> per-wiphy information but it not being present?

Then it gets the global one, and it knows it via a wiphy attribute:

  (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) &&
+   (nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)))
+   goto nla_put_failure;

(we won't do this put_flag if it's global)

The supplicant patches are not up yet, but I think for now we will
just act according to the global one. Anyway it has the option to
change policy, since it knows.

>
> It seems to me that either way what the kernel should return is the
> information that will actually be applied when validated, which is of
> course not possible when there are wiphy-specific regdomains and a
> global one is requested (unless there's just one wiphy, which might be
> something to consider making work?)

Well the cfg80211 regdomain is always intersected with all wiphy->regd
in the system, so the global one is always less permissive.
This is of course true before REGULATORY_WIPHY_SELF_MANAGED - in this
case wiphy->regd will not affect the global regd.

With CUSTOM_REG we have a special case, since the regulatory code
doesn't set wiphy->regd, it just applies a user supplied regd to the
wiphy channels (which get validated).
If the user also happens to set  wiphy->regd himself with CUSTOM_REG,
then it makes sense to return the per-wiphy one. The global regd is
meaningless anyway for CUSTOM_REG, and the per-wiphy one might be too.
But I guess we can return it if it's there?

>
> I also don't actually see a driver regulatory flag in this patch, as
> expected, so not sure what exactly you're talking about above?

The regulatory flag is in the previous patch and is called
REGULATORY_WIPHY_SELF_MANAGED. The relevant code here is:

+   if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
+   regdom = get_wiphy_regdom(wiphy);

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


Re: [PATCH v2 4/4] cfg80211: Allow usermode to query wiphy specific regd info

2014-11-20 Thread Johannes Berg
On Sun, 2014-11-16 at 13:06 +0200, Arik Nemtsov wrote:

> We intend to add a patch to wpa_s to always add the wiphy_idx to
> NL80211_CMD_GET_REG. With the current approach only drivers with
> SELF_MANAGED_REG will get wiphy->regd back. This is ok since these are
> new drivers, which are familiar with this API.
> 
> But if we use your suggestion and always return wiphy->regd, then some
> driver like ath9k that uses regulatory_hint() will now get it's
> private regd returned to the wpa_s that manages it. I'm not saying
> it's necessarily bad, but it's different than what was returned
> before. The cfg80211 regdomain is intersected with wiphy->regd, so now
> ath9k will start getting more permissive channels in usermode.
> 
> So we thought it's best to enable the new behavior only if the driver
> explicitly wants it, using a new regulatory flag.

How does this work the other way around - i.e. a newer wpa_s requesting
per-wiphy information but it not being present?

It seems to me that either way what the kernel should return is the
information that will actually be applied when validated, which is of
course not possible when there are wiphy-specific regdomains and a
global one is requested (unless there's just one wiphy, which might be
something to consider making work?)

I also don't actually see a driver regulatory flag in this patch, as
expected, so not sure what exactly you're talking about above?

johannes

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


Re: [PATCH v2 4/4] cfg80211: Allow usermode to query wiphy specific regd info

2014-11-16 Thread Arik Nemtsov
On Fri, Nov 14, 2014 at 1:13 AM, Luis R. Rodriguez  wrote:
> On Thu, Nov 13, 2014 at 06:13:39PM +0200, Arik Nemtsov wrote:
>> From: Jonathan Doron 
>>
>> Allow usermode to query wiphy-specific regd info, for drivers that use
>> wiphy-specific regulatory management.
>>
>> Use the existing API for sending regdomain info to usermode, but return
>> the wiphy-specific regd in case wiphy index is provided and the driver
>> employs wiphy-specific management. This implies user and kernel-mode
>> support for the feature and is backward compatible.
>
> This patch does not address my feedback about making this generic
> to any wiphy->regd.

Copy-pasting my previous reply:

Well always sending wiphy->regd whenever it is set is easy, but it
might be problematic I guess:

We intend to add a patch to wpa_s to always add the wiphy_idx to
NL80211_CMD_GET_REG. With the current approach only drivers with
SELF_MANAGED_REG will get wiphy->regd back. This is ok since these are
new drivers, which are familiar with this API.

But if we use your suggestion and always return wiphy->regd, then some
driver like ath9k that uses regulatory_hint() will now get it's
private regd returned to the wpa_s that manages it. I'm not saying
it's necessarily bad, but it's different than what was returned
before. The cfg80211 regdomain is intersected with wiphy->regd, so now
ath9k will start getting more permissive channels in usermode.

So we thought it's best to enable the new behavior only if the driver
explicitly wants it, using a new regulatory flag.

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


Re: [PATCH v2 4/4] cfg80211: Allow usermode to query wiphy specific regd info

2014-11-13 Thread Luis R. Rodriguez
On Thu, Nov 13, 2014 at 06:13:39PM +0200, Arik Nemtsov wrote:
> From: Jonathan Doron 
> 
> Allow usermode to query wiphy-specific regd info, for drivers that use
> wiphy-specific regulatory management.
> 
> Use the existing API for sending regdomain info to usermode, but return
> the wiphy-specific regd in case wiphy index is provided and the driver
> employs wiphy-specific management. This implies user and kernel-mode
> support for the feature and is backward compatible.

This patch does not address my feedback about making this generic
to any wiphy->regd.

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