提交图

455 次代码提交

作者 SHA1 备注 提交日期
sheenam monga
2fd2127a4e qcacmn: Update Regulatory Database to 38th version
Add below changes as part of 38th Reg DB version
    a.) Add superdomain FCC2_6G_010, APL4_6G_11 and APL5_6G_12.
    b.) Add sub 6G domain APL25, APL26 and APL27 reg rules for new domain.
    c.) Add APL25, APL26 and APL27 RD for 5G.
    c.) Add 6G support for BELGIUM, BRAZIL, CANADA and COSTA_RICA.
    d.) Change reg domain pair id for AUSTRALIA, CHILE,
	MOROCCO, HONG_KONG & MEXICO.
    e.) Add CHNA 2g reg domain.

Change-Id: I80be14ccc2845261a0816e9e7d7931b40e5d0927
CRs-Fixed: 3083299
2021-12-01 22:45:20 -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
Vignesh U
422905b63c qcacmn: Handle NULL regulatory_psoc_priv_obj
The reg_get_psoc_obj() may return NULL for invalid psoc object.

The wlan_regulatory_psoc_priv_obj becomes NULL in case of NULL psoc object.
This scenario is not considered in reg_get_reg_rules_for_pdev() and its
callers. Handle the NULL regulatory_psoc_priv_obj scenarios.

Change-Id: I5b039d362a76985995e0d4d4a95cd1a00b1f0991
CRs-Fixed: 3040335
2021-11-16 01:17:13 -08:00
Lincoln Tran
2f9ac643f6 qcacmn: Don't update channel if it is disabled
If a channel is disabled when changing the band settings, a subsequent
function such as modifying for indoor channels can override this state.
Add a check in the indoor channel modification to make sure channel is
not disabled first, before proceeding.

Change-Id: Ic47391ca2ceaee7dc0909e0c81b06b81d49d3893
CRs-fixed: 3071801
2021-11-12 06:20:12 -08:00
sheenam monga
a4ba2f1844 qcacmn: Update Regulatory Database to 37th version
Add below changes as part of 37th Reg DB version
    a.) Add superdomain FCC1_6G_09 for US AFC Testing
    b.) Add sub 6G domain FCC1_6G_09 reg rules for new domain.
    c.) Add 6G support for GERMANY, ICELAND, PERU and NORWAY.
    d.) Change reg domain pair id for TANZANIA and SOUTH_AFRICA.

Change-Id: I7af2778954c65f85b727453a0a0527e2d4d09089
CRs-Fixed: 3064525
2021-11-02 19:32:21 -07:00
sheenam monga
00cb0d5ed0 qcacmn: Update Regulatory Database to 36th version
Add below changes as part of 36th Reg DB version
a.) Update FCC1_CLI_LPI_REGULAR_6G to FCC1_CLI_LPI_DEFAULT_6G.
b.) Add sub 6g domains APL3_AP_VLP_6G and APL3_AP_LPI_6G and
    reg rules for new domains.
c.) Add superdomain FCC1_6G_07 and APL3_6G_08 for Brazil and UAE

Change-Id: I2d379762f9d5953c47c88e08511fe227ea25ce85
CRs-Fixed: 3057765
2021-11-02 19:32:17 -07: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
Hariharan Basuthkar
ef0a6ab42b qcacmn: Trigger ACS only if AFC master chan list is non-empty
When the AFC response has a disjoint set of CFIs and frequency range,
the ACS trigger is called even though the AFC master channel list is
empty.

Due to this, ACS happens even though the AP's destination power
mode is LPI.

To fix this issue, call ACS trigger only if the AFC master channel list
is non-empty.

Change-Id: I217d23827b34ac577649b82b278a203bf01fa1f6
CRs-Fixed: 3052805
2021-10-21 07:31:07 -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
Vignesh U
9abbd66770 qcacmn: Do not allow to set same 6G AP power mode
The API that takes in the input 6G AP power type and updates current
channel list, allows setting the same power type which is not needed and
is a costly operation.

Change-Id: Ia690f40a6796a0db243f0abd15f2eebc8340d1d9
CRs-Fixed: 3051502
2021-10-07 04:46:08 -07:00
Vignesh U
c47cd3f96c qcacmn: Reset AFC power event received status
The power event received status is set when AFC power event is received
and is reset unconditionally when AFC expiry event received.

Reset AFC power event received status only on receiving AFC expiry event
with sub-type AFC_EXPIRY_EVENT_SWITCH_TO_LPI.

Change-Id: Ib7c1d12cbc2797ddbb19d73fd38d82d100adf3d3
2021-10-07 04:46:04 -07:00
Hariharan Basuthkar
7a1cdfbd43 qcacmn: Intersect CFIs with SP chan list and AFC frequency range
When the frequency ranges and channel frequency indices in the AFC
server response are not the same, the current channel list has
channels enabled, that are absent in the CFIs.

This is because the AFC master channel list is built by intersecting
the frequency ranges in the AFC frequency object and state of the
channels in the SP AP master channel list.

To fix this issue, build the AFC master channel list by intersecting
the frequency ranges in the AFC frequency object and state of the
channels along with the CFIs received in the AFC channel objects from
the target.

Change-Id: I12cc54f90b75b9a7be491e7dd2e9c101be6dd1f6
CRs-Fixed: 3042040
2021-10-06 04:22:38 -07:00
Rhythm Patwa
e60e11bb76 qcacmn: Add QDF module ID for AFC
Add QDF module ID for AFC debug logs.

Change-Id: I741b85df50e3bf23b0ff5096270f0dd7a20679e3
2021-10-05 07:36:50 -07:00
Hariharan Basuthkar
006d4dc049 qcacmn: Check in SP channel list before enabling in AFC master list
When the AFC dummy server sends the frequency range with only the
UNII-6 channels, the AP still moves to SP and comes up on the
UNII-6 channel.

In reg_fill_max_psd_in_afc_chan_list, the channels are enabled in the
AFC master channel list only based on the frequency ranges present
in the AFC frequency object. There is no condition present to check
if the channels are supported by the reg_rules sent by the target
in the WMI_REG_CHAN_LIST_CC_EXT_EVENT.

To fix this issue, before enabling the channel in AFC master channel
list, check if the channel is also enabled in the SP AP master channel
list.

Change-Id: I2cbe69acf13bff57662f77eeab70e3f3a3240196
CRs-Fixed: 3042428
2021-10-01 07:52:01 -07:00
Ananya Barat
c2bca12b79 qcacmn: Modify get bonding pair function to accommodate 320 MHz bandwidth
Following are the changes:
1. Add macros relevant to the addition of the 320 MHz root to the preCAC
   tree.

2. Adding 320MHz bandwidth in switch case and separating
   'case CH_WIDTH_320MHZ' using a compile time macro ( 11BE), forces us
   to use the macro inside the function, which is not allowed by the
   coding guideline.

   Convert the "switch case" mapping (which is generally a binary search)
   into a linear search of a mapping (BW -> bonded pair) array , thereby
   using the macro WLAN_FEATURE_11BE to separate the 320MHz bandwidth
   in the data structure space instead of doing the separation inside
   the function space.

Change-Id: Iaab2328deef1cb7b2ff82bafe5d3cd2ea137e725
2021-09-30 06:27:30 -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
Vijay Krishnan
d57b561f80 qcacmn: Check Global Opclass if no Opclass present
In IEEE80211 spec, US Opclass is not supporting the 5.9Ghz
channels, therefore whenever 5.9Ghz channels are enabled,
while adding channel switch IE element, if there is no Opclass
available for the destination frequency, then check the Global
Opclass table for the destination frequency and select the
appropriate Opclass number.

Change-Id: I495576555db7dbb6fb5d5a77a3b17ec5b83cf286
CRs-Fixed: 3020692
2021-09-22 00:57:27 -07:00
Hariharan Basuthkar
72fea5404a qcacmn: Add separate APIs to find chan enums
When the 6G AP comes up on a SP mode, the current channel list has
channel 97 (6435 MHz center frequency) enabled, even though the
BDF reg_rule and AFC frequency object has the range 5925-6425 MHz.

When 6425 is given as the input to reg_find_chan_enum_for_6g, it also
returns the enum corresponding to 6435, which is incorrect.

To fix this issue, add two new functions
reg_find_low_limit_chan_enum_for_6g and
reg_find_high_limit_chan_enum_for_6g to find the lower channel enum and
upper channel enum respectively. In reg_fill_max_psd_in_afc_chan_list,
call reg_find_low_limit_chan_enum_for_6g instead of
reg_find_chan_enum_for_6g to find the lower channel enum, and
call reg_find_high_limit_chan_enum_for_6g to find the right upper
channel enum.

Change-Id: Ib5738242b453e1abf641034240ce019865e46377
CRs-Fixed: 3033667
2021-09-21 09:30:34 -07:00
Hariharan Basuthkar
b98c3e9250 qcacmn: Disable intersected AFC channels while switching to LPI
When SWITCH_TO_LPI event subtype or WMI_AFC_EVENT_ID is received,
disable the intersected channels in the AFC channel list.

Change-Id: Iee79b26953299d332c6f8925c8f21651fbd1f00c
CRs-Fixed: 3034456
2021-09-16 05:09:39 -07:00
Vijay Krishnan
4637290552 qcacmn: Remove 6G domain check on Maschan list
If a country does not support 6G, then the 6G channel list is not
appended to the master channel list. Due to this, 6G center frequency
in the master channel list is zero. This leads to the problem in the
intersection of channels and chip range in the 5G Radio.

When the target sends the WMI_REG_CHAN_LIST_CC_EXT_EVENT, do not set
the is_6g_channel_list_populated flag based on the presence of a 6G
subdomain code. The flag should be set to true whenever the event is
received.

Change-Id: Ice714c961512fc1d86f8553b9870ab7385bbe9d5
CRs-Fixed: 3007334
2021-09-08 14:55:38 -07:00
Hariharan Basuthkar
9a9f5974af qcacmn: Break from the loop when EIRP power is filled
In reg_search_afc_power_info_for_freq, break from the loop when EIRP
power is filled.

Change-Id: Id559f4a92fe7945370e6a334b4dc1e7c1d9d7adf
CRs-Fixed: 3031979
2021-09-08 14:55:28 -07:00
Vignesh U
cd59d89a50 qcacmn: Reset AFC power event received status
The power event received status is set when AFC power event is received
but is not reset when AFC expiry event received.

Reset AFC power event received status on receiving AFC expiry event.

Change-Id: I6e3415682b682e7a0f5d15a190d4cf72f5ff935a
2021-09-07 07:59:11 -07:00
Hariharan Basuthkar
d386ccb51a qcacmn: Check the num of reg_rules before setting AP power type
In reg_set_ap_pwr_and_update_chan_list, before setting the AP power type
check the number of reg_rules present for the input AP power type.

Change-Id: I3af82cf8b7ff6ed7525b5284390361a618da4140
CRs-Fixed: 3030223
2021-09-06 13:57:54 -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
Hariharan Basuthkar
94e4707d98 qcacmn: Update 6G ap power type for every FW load
When the host driver is insmod-ed, and first time the pdev object
is created, the AP power mode starts with LPI. When the FW sends the AFC
power values, the Host switches to SP mode.

If 'wifi down and wifi up' happens, all the VAPs are deleted but
pdev object is retained in the memory. Since, during 'wifi down and
wifi up' the FW is reloaded again, the FW starts with LPI always.
However, since pdev object already exists the AP power mode variable
in the regulatory private object has the same old power mode.

To fix the problem described above, update the power mode whenever
the WMI_REG_CHAN_LIST_CC_EXT_EVENT is received from the target.

Change-Id: I7a349e4defcd50cd46117d8ee55bbe8c7c8f7e80
CRs-Fixed: 3028659
2021-09-03 11:03:50 -07:00
Vignesh U
fc7e74f044 qcacmn: Create intersected AFC channel before calling ACS
ACS needs the intersection of SP channel and the channel list in the AFC
response.

Create intersected AFC channel before calling ACS.

Change-Id: I9443edfc4d8b31edf5ae7e040c0743de9a0851b3
CRs-Fixed: 3023930
2021-09-03 03:25:12 -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
e1708ea080 qcacmn: Add a condition in reg_compute_chan_to_freq for 6G channel 2
When 6G IEEE channel 2 (5935 MHz) is enabled in the master channel list,
and if the channel 1 (5955 MHz) is the input to the API
reg_compute_chan_to_freq, the API returns 0 as the output channel
frequency.

Since the IEEE number 2 is greater than 1 (but in terms of frequency it
is a lesser value), the break condition in the for-loop gets
satisfied, and since the enum of channel 2 is equal to MIN_6GHZ_CHANNEL,
the API returns 0.

To fix this issue, in reg_chan_band_to_freq, handle 6G channel 2 as a
special case by directly returning its frequency, and also
skip it from the search space of reg_compute_chan_to_freq.

Change-Id: Ief79ee2d93f4d547688e10113a8105a763c767f8
CRs-Fixed: 3013255
2021-09-02 23:58:12 -07:00
Hariharan Basuthkar
b136efc7a5 qcacmn: Intersect AFC and SP regulatory power
While appending one of the 6g_master_channel lists (based on power
type) to the master channel list, if the power type is standard power,
intersect the standard power list with the afc power list and append
the intersected list to the master channel list if the afc power
list is available.

Change-Id: I606e765a4abd5cd71cf35a13ac799fdec8e87ffd
CRs-Fixed: 3023853
2021-09-02 14:32:05 -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
8c2dd12d3c qcacmn: Fix driver crash observed during AFC request processing
Currently the AFC request buffer is being freed twice in
reg_free_expiry_afc_info and tgt_afc_event_handler.
Make changes to free the AFC req buffer only once.

Change-Id: I6d0f5c783a124da40eae6166132f7d7132cf76e4
2021-09-01 17:13:31 -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
bd02b05aa5 qcacmn: Move repetitive function bodies into a single function
The body of the two following functions:
1)reg_get_num_sp_freq_ranges,
2)reg_cp_freq_ranges
have much in common.

Move the common part into a single function in order to optimize code size.

Change-Id: Ice9e925ef0e64baa41f867a92a3c3d2902374d74
CRs-Fixed: 3019338
2021-08-27 08:08:53 -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
005cd559fa qcacmn: Remove identical function bodies to avoid update errors
In change Ia98b97f4cfe47dcd94bfa54f3dd7be13c8696532, the function
'reg_psd_2_eirp' is defined twice:
1)when WLAN_FEATURE_11BE defined
2)when WLAN_FEATURE_11BE is not defined.

However, both the functions are same except that (2) has the following
statement of 3 lines(marked by lines beginning with '>>'):

>>case BW_320_MHZ:
>>ten_log_bw = 25; /* 10* 2.50514 = 25.0514 */
>>break;

and (1) does not have the 3 lines.
Both the functions require identical updates for their the common part.
However, it is very likely to miss updating one function and update
the other function.  Or do different updates for the common part.
Similarly for the non-common part, the function that does not need the
non-common part also may get updated. Therefore, having multiple
identical function bodies for the same function under conditional
compilation is not a good design choice.

Convert the mapping (psd+bw -> eirp) done through 'switch case' into a
linear search through a lookup table. Refactor the code so that there
is only one function body and the non-common part moves to the lookup
table under the conditional compilation.

Change-Id: Ic2c6e7dff5a2fed9d1c6624b042d2be023cafcfc
CRs-Fixed: 3005569
2021-08-04 18:04:33 -07:00
Ananya Barat
8a78eac3b2 qcacmn: Build 5.9GHz channels for Legacy chipsets
With the current implementation, the 5.9 GHz channels are disabled in
reg_modify_chan_list_for_5dot9_ghz_channels if the chipset is not a
FO chipset.

Put the check for FO under the macro CONFIG_REG_CLIENT which is enabled
only for STA target, as for AP target we need the 5.9GHz channels to be
enabled in the legacy chipsets (non Lithium) if the bdf bit is enabled.

Change-Id: I97c8b4f5140ecf635f1203bf43b29c294cd8a751
CRs-Fixed: 3001808
2021-08-03 15:13:43 -07:00
Lincoln Tran
75e0ad7352 qcacmn: Print the freq in fail case when getting its enum
Update the invalid freq print with the actual frequency value for easier
debug.

Change-Id: I4e5bafaf902e19f4d070a7b140a2317a0988abf6
CRs-fixed: 3001345
2021-08-03 12:06:46 -07:00
Priyadarshnee Srinivasan
1ad426e648 Revert "qcacmn: Update the max_bw of the reg chan only during CC change"
The max-bw of a reg channel is not updated properly when the regulatory
channel list changes via cmds like setch144. Channel 144 (set via setCh144)
in Japan supports a maximum width of 80 though the reg rules read
160 (CHAN_5490_5730_6). Reducing the maximum bandwidth to 80
is done in reg_modify_chan_list_for_max_chwidth() API which does not
get invoked when setCH144 cmd gets invoked.

reg_modify_chan_list_for_max_chwidth API must be invoked
whenever regulatory channel list is modified. Hence invoke this API from
reg_compute_pdev_current_chan_list.
(Revert ChangeID: I36fb19f727c62bc86d61d81494ca1791a33cf99e)

CRs-Fixed: 2993289
Change-Id: Ic4c372cea0185366fbec387dbf2316cecb288fce
2021-07-31 09:34:36 -07:00
Lincoln Tran
a4102c7377 qcacmn: Validate bonded chan ptr before dereferencing
In reg_get_5g_bonded_chan_array_for_freq, check if bonded channel
pointer is valid before dereferencing. This will help prevent potential
crash when the pointer is invalid. Also, add debug prints to allow
easier detection of issue.

Change-Id: I2891204101cd3b256ecc90d44f76c6fbb6d450b7
CRs-fixed: 2992744
2021-07-28 04:30:38 -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