qcacmn: Restructure dfs_check_for_cac_start API

In dfs_check_for_cac_start API, the following checks (in addition
to few more unchanged ones) are done:
  1. If CAC timer is running, is the current channel a subset of the
     CAC started channel (dfs_cac_started_chan).
  2. If CAC timer is not running, is the current channel a subset of the
     last CAC started channel and was the last CAC not aborted.

The variable dfs_cac_started_chan is filled when CAC timer is started. It
is then reset only if, after vdev response, if the new channel is non DFS
or when the next CAC timer is started (with new channel value).

With the above logic, the cases where CAC is not skipped for a DFS
channel (e.g. preCACed channel) is not taken care of.

Consider the following scenario:
 1. The current channel is 100 and the preCAC is completed on all
    channels.
 2. When CAC is started on this channel (100), the dfs_cac_started_chan
    becomes 100.
 3. If radar is found on 100 and the new channel selected is one
    of the preCACed DFS channels, CAC is skipped.
    dfs_cac_started_chan still remains 100.
 4. After NOL timeout, if the radio is switched back to 100, the last
    CAC started channel is 100 and new channel is also 100, which results
    in CAC being skipped.

Rewrite the dfs_check_for_cac_start logic by checking the following:
  1. If CAC timer is running, check if the current channel is a
     subset of dfs_cac_started_chan.
  2. If CAC timer is not running, check if the current channel is a
     subset of previous channel (input).

Clear the dfs_cac_started_chan when the CAC timer stops or expires.

Also, in the API "dfs_is_subset_channel", while checking if one channel
is a subset of another, the DFS subchannels are determined based on the
channel flags. This is handled for two cases:
 1. If secondary channel alone is DFS.
 2. If primary and secondary channels are DFS.

The case "If primary channel alone is DFS" is not handled.

In case of channel 116HT80_80 with secondary 80 being non DFS,
all subchannels are considered as DFS subchannels.

Add a new API "dfs_find_dfs_sub_channels" where all the above
mentioned cases of DFS channels are handled to find proper DFS
subchannels.

Change-Id: I893430ff010746c84ce340323b25c17af25bc45a
CRs-Fixed: 2504840
4 files changed