qcacmn: Compute the remaining max channel switch time

As per the spec,
"A STA affiliated with a non-AP MLD, that operates on Link2, transmits a
(Re)Association Request frame to AP2 requesting Link1 as one of the links
for multi-link setup. Since the (Re)Association Response frame is
transmitted by AP2 after the last Beacon frame on the initial operating
class/channel on Link1 and before the first beacon on the initial
operating class/channel is transmitted, AP2 includes the Max Channel
Switch Time element in the per-STA profile corresponding to AP1 in the
(Re)Association Response frame it transmits. The value carried in Max
Channel Switch Time element provides an estimate of time until the first
TBTT on the new channel on Link1."

Hence, calculate the remaining max channel switch time using the below
steps.

When host receives the CSA complete event with the CSA count 1, calculate
the Max channel switch time for each vdev by adding the below values,
	a) Host triggers the channel switch when CSA complete event is
	   received with the CSA count 0. The time difference between
	   CSA count 1 and CSA count 0 is one beacon interval. Hence, add
	   one beacon interval.
	b) Add the channel change time. The total time required to receive
	   CSA event handler from FW with CSA count 0, plus, the time required
	   to process the CSA complete event, plus, the time required to send
	   multi-vdev restart request for all the vdevs in the new channel and
	   send updated beacon template (only for non-DFS channel) is
	   approximately 1 second (added a few milliseconds as delta and
	   considered 16 AP vaps here).
	c) Add DFS CAC duration of the new channel if the new channel is DFS.
	d) Add one beacon interval time (time required to send the beacon on
	   the new channel after VDEV up).
	e) Store the sum of the above time values in max_chan_switch_time of
	   the vdev_mlme object.
	f) Save the current time when host receives CSA complete event with CSA
	   count as 1 in the last_bcn_ts_ms of the vdev_mlme object.

Calculate the remaining channels switch time using the below formula.
- Remaining channel switch time is equal to the time when the last beacon
  sent on the CSA triggered channel plus max channel switch time minus
  current time.

Reset the max channel switch time and the last beacon sent time after
sending the VDEV UP command to FW.

Change-Id: I7c03bfae5e159419a6c9462591aeb2d6c5b4fb87
CRs-Fixed: 3076245
This commit is contained in:
Shashikala Prabhu
2021-12-24 10:39:08 +05:30
committed by Madan Koyyalamudi
parent d162a849f1
commit 3090d55051
7 changed files with 248 additions and 0 deletions

View File

@@ -775,6 +775,7 @@ static int target_if_pdev_csa_status_event_handler(
struct target_psoc_info *tgt_hdl;
int i;
QDF_STATUS status;
struct wlan_lmac_if_mlme_rx_ops *rx_ops = NULL;
if (!scn || !data) {
mlme_err("Invalid input");
@@ -787,6 +788,12 @@ static int target_if_pdev_csa_status_event_handler(
return -EINVAL;
}
rx_ops = target_if_vdev_mgr_get_rx_ops(psoc);
if (!rx_ops || !rx_ops->vdev_mgr_set_max_channel_switch_time) {
mlme_err("No Rx Ops");
return -EINVAL;
}
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
mlme_err("wmi_handle is null");
@@ -807,6 +814,10 @@ static int target_if_pdev_csa_status_event_handler(
return -EINVAL;
}
if (csa_status.current_switch_count == 1)
rx_ops->vdev_mgr_set_max_channel_switch_time
(psoc, csa_status.vdev_ids, csa_status.num_vdevs);
if (wlan_psoc_nif_fw_ext_cap_get(psoc, WLAN_SOC_CEXT_CSA_TX_OFFLOAD)) {
for (i = 0; i < csa_status.num_vdevs; i++) {
if (!csa_status.current_switch_count)