Commit Graph

253 Commits

Author SHA1 Message Date
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
Hariharan Basuthkar
c4a60f425c qcacmn: Add REG_AFC_CMD_RESET_AFC to enum reg_afc_cmd_type
Add a new member REG_AFC_CMD_RESET_AFC to enum reg_afc_cmd_type.

Change-Id: I73110cc899eb454936aef6e7d112679bc106aab0
CRs-Fixed: 3106098
2022-01-21 01:53:59 -08:00
sheenam monga
0bff382086 qcacmn: Add support to get power type string
Add support to get reg power type string from
reg power type enum value.

Change-Id: I73df51a2494eb0246f395343df8f921991a2b80a
CRs-Fixed: 3111420
2022-01-20 10:00:58 -08:00
Abhishek Singh
f8e482d488 qcacmn: Remove unused SBS specific code
Remove unused SBS specific code.

Change-Id: I2e35eee885b2a70fd78ff48acc9d2a96e9573b77
CRs-Fixed: 3093793
2021-12-16 23:12:53 -08:00
Gururaj Pandurangi
4e553bab35 qcacmn: Allow STA in LPI mode if AP ctry US and advertises LPI
The existing logic is if STA and AP have different ctry code,
and STA is in ETSI, then it operates in VLP mode irrespective
of AP ctry.
New logic would be if AP ctry is US and if it advertises LPI
power type in HE ops IE via beacon, then STA can advance to
LPI mode.

Change-Id: Ifbee7052854277c3d21ccd21b65b79edb5e89f46
CRs-Fixed: 3084589
2021-12-15 13:40:41 -08:00
Ashish
2cb0e9b21e qcacmn: Move reg_get_6g_ap_master_chan_list out of AFC flag
Currently api wlan_reg_get_6g_ap_master_chan_list is declared
and defined under CONFIG_AFC_SUPPORT feature flag, since this is
a generic API and can be used by other functionalities as well.

With this change move wlan_reg_get_6g_ap_master_chan_list api
out of CONFIG_AFC_SUPPORT feature flag.

Change-Id: Ifa7b27895b4660bbf248fc2827472ba50c9df9a4
CRs-Fixed: 3090281
2021-12-14 14:09:29 -08:00
Gururaj Pandurangi
fb6af4edcd qcacmn: Allow scan/connection if RF test mode/Safe mode enabled
Currently if AP and STA have different ctry codes, STA should
operate in VLP mode. And if STA ctry code is US, then scan and
connection are not allowed as US VLP is not supported yet.
However, if RF test mode or Wi-Fi Safe Mode is enabled, allow
scan and connection on this AP and STA can operate in LPI mode.

Change-Id: I513657b8e274ef07eb9e9b5fc265722cb01525de
CRs-Fixed: 3079537
2021-11-23 18:18:00 -08:00
Ashish Kumar Dhanotiya
91dbd69b0e qcacmn: In restart case invoke regulatory callbacks only once
Currently driver invokes regulatory callbacks after pdev create
and from reg cc event processing. In case of restart of the
driver because of SSR or idle restart, driver ignores the default
country and sets the user set country which was there before SSR
or idle shutdown. Now driver continues restart and creates pdev.
During pdev creation it propagates reg rules from psoc to pdev
which was there in psoc before shutdown and after pdev creation
it invokes the regulatory callbacks, as part of this hdd dynamic
callback is invoked and it tries to schedule the regulatory work.
Since idle restart is a vdev operation so driver is not able to
schedule the work as it does not get the dsc op and it waits for
500 ms to reschedule the work. In this 500ms time driver gets the
response of the set country command which was sent to fw to set
user country. This command also invokes the hdd dynamic callback
and regulatory work gets scheduled and scan channel list command
is sent to fw.
Now if any scan is going on in the FW and after 500ms if first
work gets rescheduled, it again sends the scan channel list to fw
which cancels the ongoing scan.

To address issue, add a change to not invoke regulatory callbacks
from pdev creation if user country set is pending.

Change-Id: I5686163644409ef19507c19ae31f7f1e7892931f
CRs-Fixed: 3054603
2021-10-22 06:14:50 -07:00
Vignesh Mohan
862db46074 qcacmn: Add preference to HT40+ over HT40- in 2G channels till 8
In reg_set_channel_params for 2G, if the input mode is HT40,
the primary channel is <= channel 8 (2447) and the secondary frequency
is not provided, add an API to fetch the secondary frequency,
giving preference to HT40+ over HT40- mode.

Change-Id: If1538e14f9ab427c9f9a12ee2eb0d9e28bbf8b86
CRs-Fixed: 3050678
2021-10-18 09:43:19 -07:00
Shiva Krishna Pittala
697dce6937 qcacmn: Add an API to check if a given channel width is supported
Add an API to check if a given channel width is supported on a given pdev
by looking at its wireless modes.

CRs-Fixed: 3042932
Change-Id: I7194412b147147eba00dbe860875e46dac602b5b
2021-09-27 22:22:28 -07:00
Shiva Krishna Pittala
29817dce94 qcacmn: Move REGDMN and wireless modes to reg_services_public_struct.h
There is a requirement to use REGDMN and wireless modes in UMAC layer of
the cmndev component. As the WMI_HOST_REGDMN modes currently are defined in
WMI layer, we can't use them directly in the UMAC layer. Hence move them
to the reg_services_public_struct.h and rename them as HOST_REGDMN modes.
Replace all WMI_HOST_REGDMN instances with HOST_REGDMN. Wireless modes are
currently defined in WIN component, use them to cmndev component.

CRs-Fixed: 3044590
Change-Id: Iee5fa1745a1a44b834334746b10bdbb6f6563a0a
2021-09-27 22:22:23 -07:00
Hariharan Basuthkar
479b0d31a1 qcacmn: Fix the issues pointed out by KW in the regulatory module
Fix the issues pointed out by KW :

1) https://kwdbprod16.qualcomm.com:8070/review/insight-review.html#
   issuedetails_goto:problemid=222576,project=CRM_NHSS_QSDK_11_5_P

   Initialize dbg_id in reg_process_afc_power_event.

2) https://kwdbprod16.qualcomm.com:8070/review/insight-review.html#
   issuedetails_goto:problemid=222579,project=CRM_NHSS_QSDK_11_5_P

   In ucfg_reg_get_partial_afc_req_info, add a sanity check for afc_req
   to prevent NULL pointer dereference.

3) https://kwdbprod16.qualcomm.com:8070/review/insight-review.html#
   issuedetails_goto:problemid=222580,project=CRM_NHSS_QSDK_11_5_P

   Add a sanity check for afc_chan_obj to prevent NULL pointer
   dereference.

Change-Id: I0481fda6d08590312a863a33a1823a0b07fa194e
CRs-Fixed: 3043280
2021-09-25 06:03:29 -07:00
Hariharan Basuthkar
8fbbf2af16 qcacmn: Fix a compilation error in ucfg_reg_get_partial_afc_req_info
Fix a compilation error in ucfg_reg_get_partial_afc_req_info, when
CONFIG_AFC_SUPPORT is enabled.

Change-Id: I9834170b08bd72ee4201284c22211e3b1e5fc560
CRs-Fixed: 3029969
2021-09-04 23:16:19 -07:00
Vignesh U
a4b1ed87f0 qcacmn: Fix compilation error in reg_get_partial_afc_req_info
The function reg_get_partial_afc_req_info() declaration is different from
its definition prototype.

Change-Id: Idd36e1343dd2af1d5ecaf3b8dcbaf7dc6839d560
CRs-Fixed: 3023862
2021-09-03 03:25:07 -07:00
Hariharan Basuthkar
033605a031 qcacmn: Add a dispatcher API to read the ini AFC config
Add a regulatory dispatcher API to fetch the value of AFC action
from the ini config.

Change-Id: I053262f98991a656d1919817ce37227202a46bc3
CRs-Fixed: 2997899
2021-09-01 21:38:11 -07:00
Hariharan Basuthkar
258d7f4c16 qcacmn: Implement the 6G AFC power event processing
Add regulatory functions to handle the WMI_AFC_EVENTID. This
includes processing the AFC power information received from the FW,
and constructing the AFC channel list in the regulatory component.

Change-Id: I5da8fc7faae847476f88ff35b20e6444115af7f1
CRs-Fixed: 3023789
2021-08-31 14:44:50 -07:00
Abhijit Pradhan
575da29354 qcacmn: Find the frequency ranges for AFC request
The regulatory rules contain the frequency ranges that are supported
by the current regulatory domain. Also every radio has a chip range
which indicates the range of frequencies supported by the radio. To
find the list of frequencies for the AFC request, add each regulatory
frequency range that are within the chip range to the AFC list of
frequency ranges. If a regulatory range has a partial overlap with the
chip range add only the overlapping part of the range to the AFC list
of frequency ranges.

Change-Id: Ida3e2217783db82fef2825c6a6603e79ef65951b
CRs-Fixed: 3019336
2021-08-27 08:08:48 -07:00
Hariharan Basuthkar
0b8e97ac32 qcacmn: Add dispatcher APIs for AFC in the regulatory
1) Add an ucfg dispatcher for reg_afc_start.
2) Add an API wlan_reg_get_afc_req_id, to fetch AFC request id.
3) Add an API wlan_reg_is_afc_expiry_event_received, to check if the AFC
   expiry event is received from the target.

Change-Id: I45841706c500e74632b60546d945cde4d634a5d2
CRs-Fixed: 3011675
2021-08-27 05:44:45 -07:00
Liangwei Dong
71ba53089e qcacmn: Add API wlan_reg_get_next_lower_bandwidth
Export regulatory API wlan_reg_get_next_lower_bandwidth to
get next lower bandwidth of given channel bandwidth.

Change-Id: Id86d83c1bf738061d325b23d3f46b77d45eaeca5
CRs-Fixed: 3021976
2021-08-26 20:56:17 -07:00
Hariharan Basuthkar
d2ef66d69a qcacmn: Get AFC mas_chan_list and check if AFC power event is received
Add an API wlan_reg_is_afc_power_event_received, to check if AFC power
event is received.

Add an API wlan_reg_get_6g_afc_mas_chan_list. to get the AFC master
channel list.

Export wlan_reg_get_6g_afc_chan_list so that it can be used by
APIs outside the UMAC module.

Change-Id: I09338a41f38e4db03f00ef2c15e9a0b7805f649e
CRs-Fixed: 2991293
2021-08-21 17:28:20 -07:00
Rhythm Patwa
c3aaef41d8 qcacmn: Export symbol for use in offload module
Export ucfg_reg_register_afc_req_rx_callback symbol for use
in offload module.

Change-Id: I6cd2e479aadb1c4d50b7341ea361b1fee20a1ba8
2021-08-21 02:07:48 -07:00
Hariharan Basuthkar
ea19d1eaca qcacmn: Create afc regulatory structure and variables
Create a new struct afc_regulatory_info to store the parameters
received in the WMI_AFC_EVENTID.

Also add the following members to the wlan_regulatory_pdev_priv_obj:

1) bool is_6g_afc_power_event_received
2) bool is_6g_afc_expiry_event_received
3) struct regulatory_channel afc_chan_list[NUM_6GHZ_CHANNELS]
4) struct regulatory_channel mas_chan_list_6g_afc[NUM_6GHZ_CHANNELS]

Change-Id: I27ae8545e28bc2ca1c7004d2d2adcc539dc9a8f9
CRs-Fixed: 3017210
2021-08-20 17:30:49 -07:00
Lin Bai
858a29eec9 qcacmn: Move unsafe info to regulator msg
If two channel avoid event reported by FW back to back, flag
psoc_priv_obj->ch_avoid_ind of 2nd event set by
reg_process_ch_avoid_event may be modified when processing
1st event in reg_call_chan_change_cbks, from
scheduler_thread context.

Copy chan avoid info to message post to scheduler to avoid
such timing issue.

Change-Id: I8fd5e7e8f2d9b2117a5c6a54fd8b64659e10f7d6
CRs-Fixed: 3012331
2021-08-17 18:03:27 -07:00
Abhijit Pradhan
53df6c1211 qcacmn: Refactor the opclass tables to optimize memory
Instead of using a fixed sized array of cfis for every operating class row,
which occupies a large amount of unused memory for many operating class
rows, use a pointer to an array and the length of the array so that each
row uses only the right amount of the memory required.

Change-Id: Ifc9974b7dc7c71b2e51b2a93a8d5c08f4fa89dfc
CRs-Fixed: 3009346
2021-08-10 23:24:43 -07:00
Abhijit Pradhan
a6e6827a7a qcacmn: Remove the unnecessary spaces from a commit
Change Ia0676c03cef9c7b010762326e535477beefe36ac added a few extra space.
Remove them.

Change-Id: I5780e3a377c0f4272d6b377015ec80449cfc4f5a
CRs-Fixed: 3005569
2021-08-04 18:04:37 -07:00
Abhijit Pradhan
5ee593e754 qcacmn: Create AFC partial request information in Regulatory
The AFC server sends an AFC response after processing the AFC request.
The AFC Request has a set of request objects: Location,Request ID,
Frequency ranges, Global operating classes, Minimum desired power etc.

The Request ID is generated by FW/target and is sent to HOST
regulatory via the AFC START/RENEW WMI event. On receiving the event,
the HOST creates a partial AFC request by filling frequency ranges,
Global operating classes and minimum desired power. The partial
request is then sent to MLME and finally to AFC application.
The request is called partial because the Device Description and
Location Information are not known to regulatory and not filled in by
the regulatory. They are filled in to create the final AFC request by
the AFC application.

Change-Id: Ia0676c03cef9c7b010762326e535477beefe36ac
CRs-Fixed: 2997956
2021-07-26 11:35:35 -07:00
Abhijit Pradhan
0e0afa5c4c qcacmn: Convert psd to EIRP for a given bandwidth
Convert PSD+BW to EIRP using the following formula
EIRP = PSD + 10 * log10(BW)

Since all the variables are integers, there are some
roundoff/truncation errors.

Change-Id: Ia98b97f4cfe47dcd94bfa54f3dd7be13c8696532
CRs-Fixed: 2995322
2021-07-21 17:15:05 -07:00
Abhijit Pradhan
987106e191 qcacmn: Get ap master and afc chan list
For various channel power calculations and comparisons,
the AP masters channels and afc channellists are needed.
Add APIs to get them.

Change-Id: Iff89c8aa402e786f5a1502c0e5b0b948e9a5d33c
CRs-Fixed: 2995322
2021-07-21 17:15:01 -07:00
Hariharan Basuthkar
82ee5ef227 qcacmn: Add regulatory support to send AFC cmd to the FW
Add core regulatory APIs to send the WMI_AFC_CMDID to the FW.

Change-Id: I1e2b7d936583a199d1be032895802740ee9f19a1
CRs-Fixed: 2975227
2021-07-14 10:32:56 -07:00
Utkarsh Bhatnagar
32647bf109 qcacmn: Cleanup reg_cache_channel_state
Cleanup reg_cache_channel_state and the
related code with it.
Also, changed the logic so as to compare
channel freq instead of channel number in
reg_modify_chan_list_for_cached_channels()

Change-Id: I424b6886ed18f73bae0d2b36e36a9ddc1819688b
CRs-Fixed: 2908016
2021-07-10 19:37:32 -07:00
Chaoli Zhou
6f15f8170e qcacmn: Support extended avoid frequency list updating
Add regulatory API to support updating extended avoid
frequency list from HDD to regulatory component. Then
populate the new final current channel list and secondary
channel list.

Change-Id: Icda683c30bd7f8e51a5fd930712658ce35eff418
CRs-Fixed: 2975136
2021-07-09 14:58:04 -07:00
Hariharan Basuthkar
72a9b8d0ec qcacmn: Export the API wlan_reg_set_ap_pwr_and_update_chan_list
Export the API wlan_reg_set_ap_pwr_and_update_chan_list so that it can
be used by APIs outside the UMAC module.

Change-Id: I5205f22bb9d6c4e28688c2db03478d46e6a3d200
CRs-Fixed: 2984261
2021-07-06 11:55:08 -07:00
Hariharan Basuthkar
140f495b6c qcacmn: Export ucfg_reg_get_cur_6g_ap_pwr_type to use outside UMAC
Export the ucfg API ucfg_reg_get_cur_6g_ap_pwr_type, so that it can be
used by the APIs outside the UMAC module.

Change-Id: I46a23f2d3a2545dcc07373f664b419c125f557e1
CRs-Fixed: 2981562
2021-07-02 09:41:42 -07:00
Ashish Kumar Dhanotiya
09f8d73a48 qcacmn: Add support for 320MHz in get 5g bonded state API
Currently reg_get_5g_bonded_channel_state_for_freq,
reg_get_bonded_chan_entry and reg_get_bw_value apis don't
have support for 320MHz BW.
With this change add support for 320 MHz in above APIs.

Change-Id: I9a5563464a8969d19315a10013fd21f805dae184
CRs-Fixed: 2975464
2021-07-01 13:44:31 -07:00
Gururaj Pandurangi
ea4286f808 qcacmn: Add new API to update ap power type for 6G roam
Add a new API reg_get_6g_power_type_for_ctry to update ap
power type when STA roams in/out of 6GHz channel. It is
invoked during initial connection and sch beacon process
during roaming.

Change-Id: I994d912da79597cf71477fc632c8e678008271a5
CRs-Fixed: 2968243
2021-06-29 21:39:22 -07:00
Hariharan Basuthkar
2234d80a72 qcacmn: Make 6G edge channel APIs common
Currently the 6G edge channel feature is MCC specific.
Make the 6G edge channel feature common for WIN and MCC.

Change-Id: I723b6db1d74dca5a911eede4ec6e6167f6b3e6bc
CRs-Fixed: 2976871
2021-06-25 07:20:05 -07:00
Ashish Kumar Dhanotiya
433c6f024a qcacmn: Cleanup code under CONFIG_CHAN_NUM_API feature flag
As part of regulatory cleanup, Cleanup code under
CONFIG_CHAN_NUM_API feature flag.

Change-Id: I3add81605ea939b3631396154ed3f07f59493f24
CRs-Fixed: 2953646
2021-06-22 03:54:03 -07:00