diff mbox series

cfg80211: Allow pre-CAC for self-managed wiphy

Message ID 20240429042723.2847389-1-quic_hprem@quicinc.com (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show
Series cfg80211: Allow pre-CAC for self-managed wiphy | expand

Commit Message

Harshitha Prem April 29, 2024, 4:27 a.m. UTC
Currently, to allow pre-CAC it requires both driver's regulatory domain
in wiphy and cfg80211 local regulatory domain to be same, along with the
region to be in ETSI.

But, for self-managed driver, some countries have mismatch between these
two regulatory domains and it would not allow for a pre-CAC. For example,
in ath12k driver (self-managed), country Sri Lanka (LK) is classified as
FCC domain as per cfg80211 local regulatory database but as per ath12k
driver it falls under ETSI domain then because of this mismatch, the
driver might not be able to do a pre-CAC.

Hence, add changes to allow pre-CAC based on wiphy's regulatory setting
if it is a self-managed wiphy.

Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
---
 net/wireless/reg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kalle Valo April 29, 2024, 7:35 a.m. UTC | #1
Harshitha Prem <quic_hprem@quicinc.com> writes:

> Currently, to allow pre-CAC it requires both driver's regulatory domain
> in wiphy and cfg80211 local regulatory domain to be same, along with the
> region to be in ETSI.
>
> But, for self-managed driver, some countries have mismatch between these
> two regulatory domains and it would not allow for a pre-CAC. For example,
> in ath12k driver (self-managed), country Sri Lanka (LK) is classified as
> FCC domain as per cfg80211 local regulatory database but as per ath12k
> driver it falls under ETSI domain then because of this mismatch, the
> driver might not be able to do a pre-CAC.
>
> Hence, add changes to allow pre-CAC based on wiphy's regulatory setting
> if it is a self-managed wiphy.
>
> Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>

"wifi:" missing from from title but I suspect no need to resend just
because of this.
Harshitha Prem April 29, 2024, 10:16 a.m. UTC | #2
On 4/29/2024 1:05 PM, Kalle Valo wrote:
> Harshitha Prem <quic_hprem@quicinc.com> writes:
> 
>> Currently, to allow pre-CAC it requires both driver's regulatory domain
>> in wiphy and cfg80211 local regulatory domain to be same, along with the
>> region to be in ETSI.
>>
>> But, for self-managed driver, some countries have mismatch between these
>> two regulatory domains and it would not allow for a pre-CAC. For example,
>> in ath12k driver (self-managed), country Sri Lanka (LK) is classified as
>> FCC domain as per cfg80211 local regulatory database but as per ath12k
>> driver it falls under ETSI domain then because of this mismatch, the
>> driver might not be able to do a pre-CAC.
>>
>> Hence, add changes to allow pre-CAC based on wiphy's regulatory setting
>> if it is a self-managed wiphy.
>>
>> Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
> 
> "wifi:" missing from from title but I suspect no need to resend just
> because of this.
> 
sure, missed it. Thank you for pointing out, I will take note of it.

Regards,
Harshitha
Johannes Berg May 3, 2024, 8:26 a.m. UTC | #3
On Mon, 2024-04-29 at 09:57 +0530, Harshitha Prem wrote:
> Currently, to allow pre-CAC it requires both driver's regulatory domain
> in wiphy and cfg80211 local regulatory domain to be same, along with the
> region to be in ETSI.

Any idea why that is?

> But, for self-managed driver, some countries have mismatch between these
> two regulatory domains and it would not allow for a pre-CAC. For example,
> in ath12k driver (self-managed), country Sri Lanka (LK) is classified as
> FCC domain as per cfg80211 local regulatory database but as per ath12k
> driver it falls under ETSI domain then because of this mismatch, the
> driver might not be able to do a pre-CAC.
> 
> Hence, add changes to allow pre-CAC based on wiphy's regulatory setting
> if it is a self-managed wiphy.

I don't see how that's really all that much more helpful than simply
removing the restriction? But then why is the restriction there?

johannes
Harshitha Prem May 6, 2024, 5:01 p.m. UTC | #4
On 5/3/2024 1:56 PM, Johannes Berg wrote:
> On Mon, 2024-04-29 at 09:57 +0530, Harshitha Prem wrote:
>> Currently, to allow pre-CAC it requires both driver's regulatory domain
>> in wiphy and cfg80211 local regulatory domain to be same, along with the
>> region to be in ETSI.
> 
> Any idea why that is?
> 
>> But, for self-managed driver, some countries have mismatch between these
>> two regulatory domains and it would not allow for a pre-CAC. For example,
>> in ath12k driver (self-managed), country Sri Lanka (LK) is classified as
>> FCC domain as per cfg80211 local regulatory database but as per ath12k
>> driver it falls under ETSI domain then because of this mismatch, the
>> driver might not be able to do a pre-CAC.
>>
>> Hence, add changes to allow pre-CAC based on wiphy's regulatory setting
>> if it is a self-managed wiphy.
> 
> I don't see how that's really all that much more helpful than simply
> removing the restriction? But then why is the restriction there?
> 
> johannes

Hi Johannes,

Seems like, there can be a possibility to have two wiphy devices with 
two different regulatory domains to be present on a single system and 
for cfg80211 to respect it. In this case, a core central regulatory 
domain will consist of the intersection between the two wiphy's 
regulatory domains. Because of this mostly, in case of DFS, in cfg80211 
apis like reg_get_dfs_region() , there is a check to ensure like if both 
the core central regulatory and device's regulatory are same.

Drivers which are not self managed can have this restriction, just to 
ensure to allow precac only if both matches or May be should we relax 
this restriction?  but I am quite not sure on the impact. Will try to 
analyze on this.

Thanks,
Harshitha.
diff mbox series

Patch

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 3cef0021a3db..e8cc38e37377 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -4214,7 +4214,8 @@  bool regulatory_pre_cac_allowed(struct wiphy *wiphy)
 		return pre_cac_allowed;
 	}
 
-	if (regd->dfs_region == wiphy_regd->dfs_region &&
+	if ((regd->dfs_region == wiphy_regd->dfs_region ||
+	     wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) &&
 	    wiphy_regd->dfs_region == NL80211_DFS_ETSI)
 		pre_cac_allowed = true;