Commit Graph

289 Commits

Author SHA1 Message Date
Ashish Kumar Dhanotiya
498761949d qcacmn: Update regulatory APIs to use super channel list
Since there are multiple power modes in 6 GHz, the current channel list
alone is not enough to represent the capability of the chip or
device. Given a channel, in many cases it may be required to know all
the power modes that are supported by this channel.

To represent this information per channel, the concept of a super
channel list is introduced. Update regulatory APIs to use
super channel list.

Change-Id: I2e292125d6b667c2c28e4b1326f47f8ccc81e5a9
CRs-Fixed: 3159628
2022-07-15 22:26:13 -07:00
Vignesh Mohan
216322b1de qcacmn: Use formula to get IEEE from frequency
Instead of looping through the current channel list, which takes O(N),
use the existing formula to directly convert frequency to
IEEE channel number, which will take O(1). This will reduce the CPU load.

CRs-Fixed: 3230932
Change-Id: I38e3a67c6ef4295cea3a8a57f3a853651445f0b5
2022-07-13 00:22:13 -07:00
Amith A
5bb1139116 qcacmn: Add API reg_is_supr_entry_mode_disabled to check AFC_NOT_DONE flag
Add an API reg_is_supr_entry_mode_disabled to check if
REGULATORY_CHAN_AFC_NOT_DONE is cleared for a given frequency and
input power mode.

Change-Id: I6ca851bbe89e6003d8084856eb30b4796d01616e
CRs-Fixed: 3230917
2022-07-09 09:59:36 -07:00
Divya R
60da953337 qcacmn: Reduce CPU Overhead
Remove memcpy allocated to get maxbw.
Use the reg_get_min_max_bw_reg_chan_list function
to get directly from regulatory channel.

bonded_chan_ptr2 for channel width 40 removed since its redundantly
calculated in functions
reg_set_5g_channel_params_for_freq/reg_set_5g_channel_params_for_pwrmode.

This helps to reduce cpu overhead by 3% when scan for each beacon
processed.

Change-Id: I89e3c0970ea41c8b86320c2de5b4822dfb27e248
CRs-Fixed: 3229766
2022-07-05 06:32:59 -07:00
Huashan Qu
5ec471e872 qcacmn: Fix compile error for function wlan_reg_get_eirp_pwr()
When CONFIG_BAND_6GHZ is undefined, it will report missing-prototypes
compile error for function wlan_reg_get_eirp_pwr().

Add 'static inline' for function wlan_reg_get_eirp_pwr() to fix
compile error.

CRs-Fixed: 3227164
Change-Id: I9db007fee3aa0061aa9a8e030e45738c0953f36a
2022-06-23 12:58:19 -07:00
Priyadarshnee Srinivasan
47812b3daa qcacmn: Add a dispatcher API for reg_get_eirp_pwr
Add a dispatcher API for reg_get_eirp_pwr().
Also export dispatcher APIs that are invoked by other modules.

CRs-Fixed: 3220143
Change-Id: I40459352046285a04142dc57e1f643b10ac59150
2022-06-22 16:43:01 -07:00
Priyadarshnee Srinivasan
15ba95b476 qcacmn: Add reg API to convert eirp to PSD power
Add reg API to convert eirp to PSD power based on the
formula: psd = eirp - ten_log10(channel bw)

CRs-Fixed: 3210379
Change-Id: I93506f8262f3fd752e22326e0604d6c8ec5383c9
2022-06-16 18:49:56 -07:00
Priyadarshnee Srinivasan
63af575866 qcacmn: Add AFC changes for 320 MHz
Fetch sub-channels of 320 MHz in reg_get_subchannels_for_opclass
API.
Change MAX_AFC_BW to 320 and REG_MAX_20M_SUB_CH to 16 in case of
11BE.
Add cen320 as an input to reg_get_best_pwr_mode to fetch the eirp
afc power for the corresponding cen320 from the afc response.
Add dispatcher API for reg_get_chan_state_for_320.
Add band_center_320 as an argument to reg_get_chan_state_for_320
to fetch the channel state for the input 320 MHz band center.
Add logic in reg_find_eirp_in_afc_eirp_obj to fetch the eirp power
for the given center freq.

CRs-Fixed: 3211744
Change-Id: Ic37bfe6790385836f81a156dd6ccc071245ea1bb
2022-06-16 09:15:40 -07:00
Amith A
443a1971d7 qcacmn: Add enum for AFC Stop Tx event and its handler
Add enum REG_AFC_EXPIRY_EVENT_STOP_TX, which is mapped to
WMI_AFC_EXPIRY_EVENT_STOP_TX, to reg_afc_expiry_event_subtype and handle
the event in the exact way as REG_AFC_EXPIRY_EVENT_SWITCH_TO_LPI event is
handled.

Change-Id: I5289ea1b51e0c2d7573e60a23ded69295252f8d6
CRs-Fixed: 3209048
2022-06-12 06:13:41 -07:00
Ananya Barat
089b42bd52 qcacmn: Add an API to check if STA VAP connection is allowed
Add API reg_is_sta_connect_allowed and it's wrapper function
wlan_reg_is_sta_connect_allowed to check if STA VAP connection is
allowed.

Change-Id: I7316545cf199deb6ceb64aa2bb30287fc9b8a34a
CRs-Fixed: 3195189
2022-06-11 03:31:02 -07:00
Ananya Barat
66f86adec8 qcacmn: Return true from wlan_reg_is_afc_done if AFC/6GHz is not supported
When either of the macros CONFIG_AFC_SUPPORT or CONFIG_BAND_6GHZ are not
defined, the function wlan_reg_is_afc_done returned false by default.
As a result, the upper layer set all the 6GHz channels to NO_IR and the
vap was unable to come up.

Fix this by returning true from wlan_reg_is_afc_done when either of those
macros are not defined.

Change-Id: I4acb564023d2a2b318ba1497fd858a02987c117a
CRs-Fixed: 3214096
2022-06-08 17:10:22 -07:00
Bing Sun
96ad1f2828 qcacmn: Add API to extract puncture bitmap based on new bandwidth
Puncture bitmap is binding with channel bandwidth. If the STA can't
support bandwidth as AP broadcasts, STA need extract puncture bitmap
based on the negotiated bandwidth.
Add API to extract puncture bitmap based on new bandwidth.

Change-Id: I089d010c6b327ba20e21aec0b8110323108cbda3
CRs-Fixed: 3207683
2022-06-08 11:48:05 -07:00
Sheenam Monga
8ce62d6104 qcacmn: Don't set power mode to VLP for all countries
Set LPI power mode for countries & domain that don't support
VLP.

Change-Id: I799a0d5beb23a4f0f613269d981ce61c86bcb5c1
CRs-Fixed: 3200465
2022-05-27 12:16:21 -07:00
Ananya Barat
5e6a3b7993 qcacmn: Add API to check if AFC is complete
Add API reg_is_afc_done and it's wrapper wlan_reg_is_afc_done to check
if AFC response enables a given frequency.

Change-Id: I953139762fd5c06ce19edc1d807edf41126f6f2b
CRs-Fixed: 3195189
2022-05-26 00:03:08 -07:00
Ananya Barat
6593844e79 qcacmn: Set/unset AFC not done bit for super channel entries
To add AFC outdoor device deployment support,set the AP power type as
REG_STANDARD_POWER_AP during the creation of regulatory pdev private
object. Update the flag REGULATORY_CHAN_AFC_NOT_DONE in super channel
list based on the AFC_POWER_EVENT. On receiving the SWITCH_TO_LPI event,
if no LPI channels are present return an error. If LPI channels are
present move to LPI mode and update the channel list both in presence and
absence of ACS.

Change-Id: Ib4653a83d4c7ea2ec5212f9ba4d517c0e7e5027a
CRs-Fixed: 3195189
2022-05-26 00:02:55 -07:00
Surya Prakash Sivaraj
7f57fa1bd9 qcacmn: Add sta_sap_scc_on_indoor_channel var to psoc/pdev
Add the variable sta_sap_scc_on_indoor_channel in
psoc and pdev reg objmgr, to access the INI value of
sta_sap_scc_on_indoor_chan

Change-Id: Ie0c41d75d0f617274743f5196e65dab93414b7eb
CRs-Fixed: 3191788
2022-05-13 04:20:54 -07:00
Kai Chen
81f0e6a247 qcacmn: Add AFC device deployment type support
Add AFC regulatory target interface to support AFC device
deployment indoor or outdoor type in init sequence between
FW and host

Change-Id: I3caed77e943fdcaa947cb7e514c88b68604f55a3
CRs-Fixed: 3190262
2022-05-10 22:12:29 -07:00
Kai Chen
90907bdedd qcacmn: Add AFC device deployment type support
Add AFC device deployment type support in regulatory pdev
private object and add API to return the deployment type

Change-Id: I45e44766b25b21ce3024d73f4ed7a4daf3ecb026
CRs-Fixed: 3190240
2022-05-10 22:12:22 -07:00
Hariharan Basuthkar
263d5b8138 qcacmn: Add an API to get best power mode based on freq and bw
Add an API wlan_reg_get_best_pwr_mode, to get the best_power_mode
based on AP's primary channel center frequency and AP's operating
bandwidth. The best power mode that has the maximum EIRP power
allowed for operation among the 3 AP types, i.e, LPI, SP and VLP is
chosen as the best power mode.

For example:

If primary channel center frequency = 6115 MHz and AP's operating bandwidth
is 80 dbm. If,
LPI EIRP = 30 dbm
SP EIRP = 33 dbm,
VLP EIRP = 27 dbm,
then the best power mode returned is SP.

Also, remove the static declaration of reg_get_subchannels_for_opclass
so that it can be called by wlan_reg_get_best_pwr_mode.

Change-Id: I89b6bc35b5c15a49e2d49265c8685f9d291fb48e
CRs-Fixed: 3163714
2022-04-27 13:01:54 -07:00
Sriranjani N
bd723869dd qcacmn: Change the datatype of resp_id
The datatype of resp_id in
wmi_afc_power_event_param is 32 bit.

Change the datatype of resp_id from
uint8_t to uint32_t
in the structure reg_fw_afc_power_event,
to write
QCA_WLAN_VENDOR_ATTR_AFC_POWER_EVT_RESP_ID
in the
QCA_WLAN_VENDOR_AFC_POWER_UPDATE_COMPLETE_EVENT

Change-Id: I910921908ddc24290e2b89732fa223a16aeb9981
CRs-Fixed: 3159542
2022-04-14 05:09:11 -07:00
Priyadarshnee Srinivasan
2534a0683e qcacmn: Get opclass details for current hwmode
Iterate through the opclass table and fetch the opclass
details for the channel widths supported by the current
hardware mode.

CRs-Fixed: 3168892
Change-Id: I9b418999e3745529e3db5bae3a46569e0d1bdc02
2022-04-11 13:02:23 -07:00
Bing Sun
37a48b157f qcacmn: provide is_create_punc_bitmap when generateing puncture
Puncture is one of 11be feature. Even 11be compile macro is defined,
Dut can start AP with non-11be mode. Regulatory component has no idea
whether it should consider puncture or not. Puncture should be a
configurable parameter from caller.
When updating channel state, puncture should be considered for 11BE
AP. is_create_punc_bitmap should be set in struct ch_params and pass
it to reg_get_5g_bonded_channel_state_for_pwrmode.

Change-Id: I96fb131f2df201a827ab7d98ca099a38b008e0d3
CRs-Fixed: 3160259
2022-04-08 01:57:29 -07:00
Linux Build Service Account
a8a9edfab6 Merge "qcacmn: Add non-6g definitions of regulatory API" 2022-03-29 19:37:45 -07:00
Vignesh U
07a565b1a1 qcacmn: Add non-6g definitions of regulatory API
The API reg_get_ch_state_based_on_nol_flag() is a common API and in its
definition it calls the API
wlan_reg_get_5g_bonded_channel_state_for_pwrmode() which is defined for
the 6G specific macro CONFIG_REG_6G_PWRMODE. For non-6G callers, this
function is not defined and will lead to implicit declaration compilation
error.

Add a non-6G version of the API
wlan_reg_get_5g_bonded_channel_state_for_pwrmode() so that, it can be
called in reg_get_ch_state_based_on_nol_flag() even for non-6G PFs.

Change-Id: I810af65c7580f9a5dbfb2df25530dd95261e2a80
CRs-Fixed: 3161629
2022-03-29 16:59:58 -07:00
Hariharan Basuthkar
17078fff36 qcacmn: Rename is_treat_nol_as_disabled to treat_nol_chan_as_disabled
Rename is_treat_nol_as_disabled and is_treat_nol_as_dis to
treat_nol_chan_as_disabled in the regulatory component.

Change-Id: I3f372ee1707b40e2bdcd5ca53b77e6b8f76c456b
CRs-Fixed: 3157756
2022-03-29 05:07:43 -07:00
Vignesh U
9e1d5d198b qcacmn: Get all the channel list for 6G band
Get the channel list for 6G band for a given power mode. When the power
mode is REG_BEST_PWR_MODE the 6G channels will contain all the channels
supported by the reg domain irrespective of the power mode.

Change-Id: Ia1a3757685d477a2a2565eb89422fc039ca3b5dd
CRs-Fixed: 3141999
2022-03-23 04:49:54 -07:00
Jianmin Zhu
ee27003447 qcacmn: Fix build issue on kernel5.10
Fix build issue on kernel5.10.

error: implicit conversion from enumeration type 'enum reg_6g_ap_type'
to different enumeration type 'enum supported_6g_pwr_types'
[-Werror,-Wenum-conversion].

Change-Id: Ib15ed20036f2472b567acee2e4d24d3e6bfe1956
CRs-Fixed: 3154541
2022-03-21 22:01:30 -07:00
Hariharan Basuthkar
b844c62799 qcacmn: Add reg API to treat NOL chan as disabled/enabled
By default, the regulatory module considers NOL channels as disabled
and these channels are excluded in channel search algorithm.

However, there are use cases where a search for NOL channel
is done and regulatory module fails to fetch the channel param.
Hence create an infrastructure to consider NOL channels
as "enabled" / "disabled" as per user's choice during channel search.
Setting "is_treat_nol_chan_as_disabled" flag to true considers
NOL channels as disabled and punctured.

The callers of reg_fill_channel_list() and
reg_set_channel_params_for_freq() APIs should set the flag
"is_treat_nol_chan_as_disabled" as per the desired use case.

CRs-Fixed: 3134870
Change-Id: Iae7cea18ecfd5e9972ea8e6934828898a6cd1e74
2022-03-21 01:28:30 -07:00
Vijay Krishnan
9bc8adec02 qcacmn: Store the threshold freq in regulatory
If a Radio supports 6G band channels, the ACS is expected to give
priority to a set of channels that are above a certain (threshold)
frequency.

Store the extracted threshold frequency from WMI into regulatory
component.

Add a new API reg_get_thresh_priority_freq to get the threshold
frequency received from the target.

CRs-Fixed: 3143318
Change-Id: I8676ce56e68b5a4eb4e4b64415dc293e086472f0
2022-03-17 03:44:52 -07:00
Sheenam Monga
b17d8fc57f qcacmn: Avoid compilation error when 6G disabled
Currently definition of wlan_reg_get_power_string is
present for 6G only which may cause compilation issue
when 6G is disabled.

Fix is to add definition of wlan_reg_get_power_string
for both 6g enable and disable case to avoid any compilation
issue.

Change-Id: Iaad8f16543306e6ac09e76546062fae554124c1e
CRs-Fixed: 3150997
2022-03-16 11:14:21 -07:00
Priyadarshnee Srinivasan
307e380442 qcacmn: Add reg opclass changes for 320MHZ
Add opclass changes to support 320MHZ in 11BE

CRs-Fixed: 3135023
Change-Id: I57827cf0f5f056df0dceee0a6225d4ea7219cce9
2022-03-15 20:44:09 -07:00
Jianmin Zhu
5be34e1968 qcacmn: Fix build error
For platforms which CONFIG_BAND_6GHZ undefined, build failed for
implicit declaration of function
reg_convert_supported_6g_pwr_type_to_ap_pwr_type.

Change-Id: Iefaef8ea64f76f07e040403ada145c99c29db19a
CRs-Fixed: 3147319
2022-03-11 04:53:03 -08:00
Vignesh U
1f1b921796 qcacmn: Add supported 6g power types dispatcher APIS
Add the supported 6g power types dispatcher APIs to
i) get the best 6g power for a given frequency.
ii) convert input 6g ap power type to supported 6g power type enum.
iii) get the 6g ap power type from supported 6g power type enum.

Change-Id: I4b8bce5f23c7c0b95f9192ff20d90a908b3e0bd7
CRs-Fixed: 3110989
2022-03-08 04:20:07 -08:00
Deeksha Gupta
8944151a4b qcacmn: Add reg API to check for enable channel state
Add new reg API to check if frequency is active (non-passive) 
or not from the secondary channel list.
The API checks the channel state against CHANNEL_STATE_ENABLE.

Change-Id: If41850563e680659ea815f09207ec0b854a2f040
CRs-Fixed: 3136785
2022-03-02 16:15:22 -08:00
Abhijit Pradhan
3f95481d0e qcacmn: Add powermode APIs under a new macro
Use  CONFIG_REG_ 6G_PWR_MODE for the new API.
Use "_for_pwrmode" as suffix for the new functions.

Change-Id: I9b84944a59062277b76bc48877c47ea5afada0ec
CRs-Fixed: 3133023
2022-02-28 12:57:10 -08:00
Hariharan Basuthkar
e7b559d010 qcacmn: Replace reg curchan with 6g ap power based chan list
The consumers of the current channel list may want to search through 6G
channels that are not part of current channel list and belong to channel
list of different power mode.

Therefore, replace the regulatory current channel list with that of 6G
power based channel list.

Change-Id: Ie2ff8bbfb50a5f95f584b134b18246cb28b1c406
CRs-Fixed: 3110987
2022-02-28 12:57:03 -08:00
Balaji Pothunoori
37411ce595 qcacmn: disable reg channels based on ini check
Disable ini channels based on coex_unsafe_chan_reg_disable
ini configuration.

Change-Id: Ia3acbc133cab4865d8ad69992e893be91439f837
CRs-Fixed: 3129049
2022-02-16 22:27:07 -08:00
Ananya Barat
6ee7701aab qcacmn: Add APIs to query min and max chanwidth supported by channel
1. Add reg_get_min_chwidth to return the max chanwidth supported by
regulatory given the primary frequency and the pdev.

2. Add reg_get_max_chwidth to return the max chanwidth supported by
regulatory given the primary frequency and the pdev.

3. Add dispatcher functions for both

Change-Id: Ia21198fe778d32b1673e5dd30c8cd621cded2c45
CRs-Fixed: 3098311
2022-02-15 17:27:45 -08:00
Shashikala Prabhu
4905072179 qcacmn: Use the correct datatype for wireless modes
Wireless mode is of datatype uint64_t but in some places, it is used
as uint32_t.

In this change, replaced 'uint32_t wireless_modes' with
'uint64_t wireless_modes'.

Change-Id: I13b5781ddb14fc0131668e1710df19ae75eb1e34
CRs-Fixed: 3119562
2022-02-08 07:44:41 -08:00
Bing Sun
fd0ac6014b qcacmn: Refine 5g bonded channel state with static puncturing
Refine reg_get_5g_bonded_channel_state_for_freq with static puncturing.
Update channel state as CHANNEL_STATE_DFS or CHANNEL_STATE_ENABLE if
its puncture bitmap is valid with given bandwidth.

Change-Id: I3503c8bcf6094b9c98056809f1c304747ba97667
CRs-Fixed: 3106240
2022-02-07 20:22:11 -08:00
Vignesh U
2806fac2c3 qcacmn: Add reg_get_pwrmode_chan_list API
Add reg_get_pwrmode_chan_list() which will take an input 6G power mode
and will use super channel list to build the 6G power mode based channel
list.

The 2G and 5G portion of this channel list will be same as the current
channel list and if the input power mode is REG_CURRENT_PWR_MODE, then
also the current channel list is copied to the given buffer.

If the input 6G power mode is REG_BEST_PWR_MODE then all the 6G frequencies
supported by the current country will be present and will indicate the
power values of the best power mode possible for that entry.

For other 6G power types only the 6G portion of the channel list is
modified as per the input 6g power mode.

Change-Id: Ib22399ac950af87ee64ecdb78089bb2ff5221f69
2022-02-07 16:41:35 -08:00
Vignesh U
dcec4534a1 qcacmn: Based on input 6g power mode find if freq is enabled or not
Add the new sets of APIs that checks if given freq is enabled on given
power mode's channel list.

Also, remove reg_is_chan_disabled() and replace the callers with
reg_is_chan_disabled_and_not_nol().

Change-Id: I65ee6b8dde629b0e31b050b478300a8ba5ae5b4a
2022-02-01 23:36:04 -08:00
Hariharan Basuthkar
08f1f6b1af qcacmn: Send AFC power event data to user application
Add an API to register a callback function that will be called when
the AFC power event is received from the AFC server. The second parameter
of the callback function is 'reg_fw_afc_power_event' structure which
holds the entire power event so that callback function can process the
part or whole of the power event.

Change-Id: I2d6247e54f92c02e9b4ec98bec678e662f1009f4
CRs-Fixed: 3114593
2022-02-01 21:04:25 -08:00
Balaji Pothunoori
1dfa348eea qcacmn: change restriction mask to uint32_t from uint8_t
This change is to update restriction mask to uint32_t from uint8_t
as per QCA_WLAN_VENDOR_ATTR_AVOID_FREQUENCY_IFACES_BITMASK.

Change-Id: If5a6748425502b1f27654a2e6bfa0e5c2b8556de
CRs-Fixed: 3118988
2022-01-28 06:30:09 -08:00
Bing Sun
96599ce00e qcacmn: Change reg_punc_pattern to reg_punc_bitmap
Puncture bitmap is different from Puncture pattern.
A bit in the puncture bitmap is set to 1 to indicate the corresponding
20 MHz subchannel is punctured and set to 0 to indicate the
corresponding 20 MHz subchannel is not punctured. Puncture pattern
is the reverse of puncture bitmap.

From the use of reg_punc_pattern, it should be puncture bitmap.
Rename reg_punc_pattern to reg_punc_bitmap.

Change-Id: I1c7fc1b689ba724862761dc10f72a543679bb85e
CRs-Fixed: 3108165
2022-01-28 00:53:55 -08:00
Vignesh U
573fae9a5d qcacmn: Add reg_is_chan_disabled_and_not_nol API
Add reg_is_chan_disabled that is used to check if channel
is disabled or not in given channel list.

Rename the API to reg_is_chan_disabled_and_not_nol.

Change-Id: I2b05b0cea0472fc924634ae921e77842f0608a11
2022-01-27 06:59:30 -08:00
Amith Ajith
ac8933ef2e qcacmn: Move partial offload regulatory under macro
Create macro WLAN_REG_PARTIAL_OFFLOAD and move partial offload
regulatory code under it.

Change-Id: If37798abb86deee0bef6e339577da797342c31a4
2022-01-27 03:13:01 -08:00
Hariharan Basuthkar
4e9dad300a qcacmn: Add an API to get a super channel list entry
Add an API wlan_reg_get_superchan_entry to get a super channel list
entry for a given input channel index.

Change-Id: Ia231669872c15998549aff6262d66766b8cec5c2
CRs-Fixed: 3098998
2022-01-26 10:59:58 -08:00
Hariharan Basuthkar
3d2e170e10 qcacmn: Add support for 6G super channel list
Since there are multiple power modes in 6G, the current channel list
alone is not enough to represent the capability of the chip or
device. Given a channel, in many cases it may be required to know all
the power modes that are supported by this channel.

To represent this information per channel, the concept of a super
channel list is introduced. This super channel list is essentially a
mapping between a channel and supported power modes, and
their associated attributes, such as power values, Indoor/Outdoor etc.

The 6G super channel list is stored in the regulatory pdev private
object.

Change-Id: I8657fed17823929c87110aa7a6cf24fe898bb78f
CRs-Fixed: 3098998
2022-01-26 10:59:48 -08:00
Balaji Pothunoori
7192d90810 qcacmn: update unsafe channel list for SAP for freq extcmd
Currently unsafe channel list updated from firmware using
"wmi_wlan_freq_avoid_event_id".

This change is to update unsafe channel list for vendor
QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_EXT which we receive from
userspace.

Change-Id: I57ff334e9cf47468c30bc6884a9ead0a65a92eab
CRs-Fixed: 3103275
2022-01-24 14:41:12 -08:00