Commit Graph

20 Commits

Author SHA1 Message Date
Vignesh U
171c65dccd qcacmn: Prevent random channel selection to choose UNII1 channels
Spur or leakage transmissions is observed in Spruce HW in
frequencies from 5260MHz to 5320MHz when one of the following
conditions is true,
i) The AP is transmitting in 52/56/60/64 in 80MHz mode and then the  AP
moves to the adjacent channel 36/44/48 in 80MHz mode and starts
transmitting.
ii) The AP is transmitting in 36/44/48/52/56/60/64 in 160MHz mode and then
the  AP moves to the adjacent channel 36/44/48 in 80MHz mode and starts
transmitting.
In order to prevent random channel selection to cause spur restrict the
above given channel movements for Spruce target alone.

Change-Id: I27b558ec5544076430f66c84b056ab65f9e43c8c
CRs-Fixed: 2975473
2021-07-16 03:55:15 -07:00
Vignesh U
336f699034 qcacmn: Store and populate the DFS channel state array
Add an enum to encode various DFS channel states.

The dfs channel states are represented using a per dfs array object rather
than maintaining a channel state field for each channel (since dfs channel
states are not required for 2G and 6G channels).

The size of the array is approximately 30 because
first_dfs_chan = 52
last_dfs_chan = 161(in case of ETSI EN302 502)
channel_spacing = difference between 2 consecutive 5G channels = 4

size_of_the_array = (last_dfs_chan - first_dfs_chan) / channel_spacing
                  = (161 - 52) / 4
                  = 27.25
                  ~= 30;

The dfs channel array is indexed by hashing the frequency. The conversion
(hash function) is as follows:

given_chan_number = (given_chan_frequency - 5000) / 5;
where 5 is: 5Mhz  = minimum IEEE chan bandwidth.

array_index = (given_chan_number - first_dfs_chan) / channel_spacing;

Add the following functionalities:
1) initialize the DFS channel state array.
2) update the channel state array.
3) read the channel state array.
4) convert the channel frequency to channel state array index.
5) convert the dfs channel event to dfs channel state.

Change-Id: I7921571fcc80b43a7ef7caf92c34b016fe396e45
CRs-Fixed: 2823529
2020-12-05 07:27:49 -08:00
gaurank kathpalia
fe1cbc425d qcacmn: Filter out the 6ghz chan freq from valid freq list
Currently the driver does not have a support to
filter out the 6ghz frequencies from the valid freq
list, and hence there is a high chance of selecting
the 6ghz freq as an operating freq for SAP, which
the legacy clients won't be able to scan.

Fix is to add a support for filtering out the 6ghz
frequencies from the valid freq list.

Change-Id: I8e3552a254e2b79cc1fc09da3e1e06ac378cbb07
CRs-Fixed: 2801414
2020-11-10 04:57:42 -08:00
Vignesh Mohan
cb9f7ad948 qcacmn: Add APIs to find preCAC status of the given channel
Introduce DFS utils APIs to find preCAC status of the given
channel.

Change-Id: If47411af82b43b9dcff04ba2f84cdb10ec9ca1f1
2020-08-18 11:01:02 -07:00
Ananya Barat
bc798a3c5c qcacmn: Rename the RCAC State Machine events, states & APIs
Both (ETSI) PreCAC and RCAC are going to use use the same state
machine. The state machine drives the Agile engine and not very specific
to RCAC or PreCAC, therefore let the state machine be called agile state
machine and change the names of all the associated variables accordingly.

In this preparatory change, modify names of all APIs, states and events
to make them common to Agile RCAC and Agile PreCAC

Change-Id: I67858839589145bf4377a7eafec7c21ca4823141
CRs-Fixed: 2711104
2020-08-02 08:57:54 -07:00
Vignesh Mohan
a208da2cfc qcacmn: Post various events to the RCAC state machine
Trigger Rolling CAC SM events from
 - NOL expiry (EV_RCAC_START) to trigger RCAC START with a
   new channel if possible and not already running.
 - Agile radar (EV_ADFS_RADAR_FOUND) to restart RCAC with a
   new random channel.
 - vdev restart (EV_RCAC_STOP) to stop the running RCAC when
   the primary channel changes. Start will be based on the
   availability of the new channel.

In case of the rolling CAC feature, a channel is programmed to
the agile detector on which CAC is running continuously.
Introduce an API that finds an RCAC completed channel and return
the channel params which will be used for the next channel
change.

Also add a boolean argument in  dfs_set_current_channel api to
indicate if the dfs current channel is updated in the API
"dfs_set_current_channel".

CRs-Fixed: 2674621
Change-Id: Ica54a57f131cd54e47138f1cbeef2dd0023390ed
2020-05-01 07:00:26 -07:00
bings
868ce7c912 qcacmn: Include device sleep time in the NOL timeout value
'jiffies' does not include the device sleep time.
Use qdf_get_monotonic_boottime to monitor lapse of time for nol.

Change-Id: I6e00e003b8ee3d456ac4ec62b23fdaa02d577672
CRs-Fixed: 2652692
2020-04-27 21:32:17 -07:00
Vignesh Mohan
a23f9384c4 qcacmn: Add states events and API declarations for RCAC SM
As part of the Rolling CAC State Machine, introduce three state
enums (INIT, RUNNING and COMPLETE) and the corresponding state
events.

Introduce generic APIs such as dfs_rcac_sm_create,
dfs_rcac_sm_destroy and dfs_rcac_sm_deliver_evt for rolling
CAC State machine operations.

CRs-Fixed: 2659666
Change-Id: I528db71aa7d21dced7e47ff4f9cccfbfe94c8c21
2020-04-24 01:29:16 -07:00
Shashikala Prabhu
ee42cb1f26 qcacmn: Use chan freq for restricted 80+80 MHz boundary check
Instead of channel number, use channel frequency for restricted 80+80MHz
boundary  check.

Change-Id: I2fa65c3b1d102acd6b64b4c6e1583d2bc29484d1
CRs-Fixed: 2645155
2020-03-27 15:00:05 -07:00
Vignesh Mohan
2b0ff06748 qcacmn: Add support for Bangradar with detector ID
Provide support for bangradar with detector ID as one of the parameters.
Add the parameter as part of the packed arguments to be sent to FW.

Also add APIs for basic sanity check of bangradar params and packing
bangradar params inside an 32 bit unsigned integer.

CRs-Fixed: 2646549
Change-Id: Ie781bc9421b7ac0d407eb01814c9242c7f988884
2020-03-23 23:13:52 -07:00
Vignesh Mohan
86eba5902e qcacmn: Reinit DFS after HW mode switch (phase 2)
Supported dynamic HW mode switches:
DBS (full band 5G and 2G) <-> DBS_SBS (low band 5G, high band 5G and 2G)

Description of the changes:

1. NOL conversion:
  a. Introduce a temporary NOL list copy structure in DFS psoc obj.
  b. When mode switch is triggered:
    i.   Stop the NOL timers and clear the data, to avoid processing NOL
         expiry during mode switch.
    ii.  Allocate the psoc NOL copy for the target num_radios.
    iii. Store the NOL data of each radio to the target pdev ID
         (pdev ID after mode switch) in the psoc NOL copy,
	 using a unified mux/demux API.
  c. After mode switch is completed:
    i.   Resume NOL by re-initializing the list from the temporary psoc
         copy.
    ii.  Free the psoc copy after mode switch is complete.
    iii. Note: changes are made to support pause and resume of NOL,
         increasing NOL timeout by a few milliseconds.

2. PreCAC list conversion:
  a. When mode switch is triggered:
    i. Stop the existing preCAC timer and send ADFS abort command to FW.
  b. When mode switch is completed:
    i.  Unify/separate the preCAC list if the target mode is DBS/DBS_SBS
        respectively, using a single API.
    ii. Start ADFS again.

3. Radar detection lock:
  a. While detecting radar, acquire a lock to avoid handling user triggered
     mode_switch during this process. Release the lock once radar
     processing is completed and CSA start is triggered.

4. Radar detection/CAC completion defer during mode switch:
  a. While detecting radar or CAC completion, check if mode switch is
     in progress. If yes, defer the processing and wait for mode switch to
     complete before handling the events.
  b. Note: Precedence is Radar over CAC, i.e., if CAC processing is waiting
     and radar is received, CAC completion is no longer handled.

CRs-Fixed: 2580403
Change-Id: I506f3b569bad2e351c6f336e50f203cf5fa8b223
2020-01-11 22:28:17 -08:00
Shashikala Prabhu
52ee85cf6f qcacmn: Add support to choose 160MHz random channel for Pine
Pine supports restricted 80+80 MHz only on cfreq=5690 and cfreq=5775. If AP
detects RADAR in this channel, it chooses new 80+80 MHz random channel
which is not supported by Pine because, notion of 80+80 is not present in
current channel in regulatory component. Hence, as a temporary fix we
change the invalid 80+80 MHz channel to 160 MHz or lower.

Change-Id: I749607236a1dd7b9c7aa93ff889b65adcbb4191c
CRs-Fixed: 2570057
2019-12-06 01:52:32 -08:00
Hangtian Zhu
62547ed826 qcacmn: Enable configurable dfs_pri_multiplier
Enable configurable dfs_pri_multiplier. The ETSI typ2 type3 radar
detection ratio is lower than expected(>80%) while channel loading is
high(>30%). The host improvement for this are:
	1. Add configurable dfs_pri_multiplier, controlled by
	   DFS_PRI_MULTIPLIER. Default value 2, min 1, max 10.
	2. Lower adrastea ETSI type 2/3/4 radar filter rssi_threshold,
	   controlled by DFS_OVERRIDE_RF_THRESHOLD, dfs log shows that
	   QCS405 target report RSSI range [18, 45] while radar power
	   is 3 dbm. By using default rssi_threshold 24 will reject
	   many radar pulses, which leads to low detection ratio.
	3. Calculate deltapri for each searchpri based on dfs_pri_multiplier
	   in dfs_count_the_other_delay_elements(), check deltapri
	   between [1, dfs_pri_multiplier] * refpri and searchpri, if
	   the primargin is desired, mark it as matched pulse.
	4. Pick lowpri as refpri for the radar filter with
	   rf_ignore_pri_window equals to 0 while DFS_PRI_MULTIPLIER is
	   enabled. Observed original findref logic has some problems
	   which selects refpri is bigger than lowpri, which leads to
	   the lowpri pulses pri_match are set to 0, and in this case,
	   radar was not detected. Example for the issue, assume
	   rf->rf_pulseid 34 (ETSI type 2) has 7 pulses with pri:
	   1489, 2978, 2978, 2978, 1489, 2978, 1489 us in this case,
	   highscore is 4 (2978), scoreindex is 5, refpri is 2978, which
	   leads to: index 0, 4, 6 pulses with pri_match 0 in
	   dfs_count_the_other_delay_elements(). The fix is to select
	   lowpri as refpri(1489 in this case).

Change-Id: I1f3ca3298c9ab1f1e2651ad6b4a0a4810f83f8a1
CRs-Fixed: 2531811
2019-10-01 02:16:19 -07:00
Vignesh U
2810202a98 qcacmn: Add support to inject synthetic radar pulses
Add structure definitions, function declarations and
definitions supporting radartool to inject synthetic
radar pulses.

Change-Id: Ie7af0437bd2d6051bc3cb80b6e88f4337eefe77b
CRs-Fixed: 2484584
2019-08-01 01:40:21 -07:00
phadiman
b68fa39efd qcacmn: Add DFS Radar Event Notifications
Add event notifications to userspace
    1. Radar Detect
    2. CAC Start
    3. CAC Complete
    4. NOL Start
    5. NOL Complete

CRs-Fixed: 2448199
Change-Id: I5deaa53c922fe4e149e7198b287e31d3876d49d4
2019-05-13 13:11:38 -07:00
Vignesh Mohan
94e1f2308f qcacmn: Unify radar simulation commands
Replace all three radar simulation commands with a single variant which
will perform required functionality based on its number of arguments.

Existing variants of radar simulation commands:

    1). Bangradar:
          Description: Adds all subchannels of segment ID "0" in the
                       current channel to NOL.
          Syntax: radartool -i wifi0 bangradar.

    2). Second Segment Bangradar:
          Description: Adds all subchannels of segment ID "1" of the
                       current channel to NOL.
          Syntax: radartool -i wifi0 secondSegmentBangradar.

    3). Enhanced Bangradar:
          Description: Adds the radar infected subchannels computed based
                       on segment ID (X), chirp information (Y) and
                       frequency offset (Z) to NOL.
          Syntax: radartool -i wifi0 bangradarenh X Y Z.
                  where,
                    X - Segment ID.
                    Y - Is chirp/non chirp.
                    Z - Frequency offset.

New radar simulation command:
     Bangradar:
     Types of usage:
       1). No arguments:
           Description: Adds all subchannels in the current channel to NOL.
           Syntax: radartool -i wifi0 bangradar.

       2). 1 Argument:
           Description: Adds all subchannels of segment ID "X" of the
                        current channel to NOL.
           Syntax: radartool -i wifi0 bangradar X

       3). 3 Arguments:
           Description: Adds the radar infected subchannels computed based
                        on segment ID (X), chirp information (Y) and
                        frequency offset (Z) to NOL.
           Syntax: radartool -i wifi0 bangradar X Y Z
                  where,
                    X - Segment ID.
                    Y - Is chirp/non chirp.
                    Z - Frequency offset.

All other combinations of arguments will result in error (insufficient
arguments).

Change-Id: I10c86d78bf46c075e65f93ad0f0143f328f5c7be
CRs-Fixed: 2373228
2019-01-24 12:30:31 -08:00
Arif Hussain
273e871dc0 qcacmn: Add Japan W53 channel flag support
Add support to exclude/include Japan W53 channels
in random channel selection.

Change-Id: I359d6bb68e2737b64b77f6f3ad27f83fd33d3da8
CRs-Fixed: 2371013
2019-01-01 17:06:14 -08:00
Priyadarshnee S
d3173ca81c qcacmn: Handle scan failure and vdev start caused by NOL violation
This commit includes the following changes:
Send usenol pdev param to FW.
Set and get dfs_disable_radar_marking flag.
Handle scan failure due to NOL violation.

Change-Id: I814f6381145f98eccf465af730734238c60d8896
CRs-Fixed: 2328894
2018-10-18 02:17:07 -07:00
Shaakir Mohamed
cbc53dd023 qcacmn: Add support for reduced BW-Agile DFS
When the beaconing channel is not affected by radar,
reduce bandwidth of the AP while retaining the beaconing (control) channel.
Since all subchannels were in ISM there is no need to perform CAC.
Random channel selection is run if primary beaconing channel is affected
by radar, wherein CAC will be run for new primary and secondary.

Change-Id: I3c141a02449361e2290086f4c15f7b3eb08c6115
CRs-Fixed: 2284350
2018-08-21 01:51:26 -07:00
Shashikala Prabhu
2a9f2a0525 qcacmn: Rename dfs_ioctl.h as wlan_dfs_ioctl.h
Rename dfs_ioctl.h file as wlan_dfs_ioctl.h and
move it from cmn_services directory to dfs dispatcher.

Change-Id: I75e0337bd84b71cf77975656423f78f9b016285f
CRs-Fixed: 2127833
2017-11-21 07:32:05 -08:00