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