[][MAC80211][hostapd][refactor AP/STA CSA handling flow]

Refactor AP/STA CSA handling flow.

There were two problems in the original CSA handling flow.
1. STA could not differentiate 20 MHz from 40 MHz when parsing CSA IE.
2. STA did not support a channel switch to 320 MHz.

These problems were mostly caused by hostapd/ma`c80211 not following new
802.11 standard.
To fix above two problems, a new CSA flow that follows new 802.11
standard is added.

In the AP side:
1. when creating Wide Bandwidth Channel Switch IE, fill the subfields
   according to band and PHY mode
   a. 2 GHz: no such IE
   b. 5 GHz: VHT operation
   c. 6 GHz: VHT operation in HE mode and HE operation in EHT mode

In the STA side:
1. Add the utilities to convert op_class to nl80211_chan_def
2. There are two way to convert CSA-related IEs to
    a. use the subfield op_class from ECSA, then convert it to
       nl80211_chan_def by utilities added in item 1.
    b. use the Wide Bandwidth Channel Switch IE to fill VHT/HE
       operation, then convert it to nl80211_chan_def. This way is
       prefered. This way is used only if the ECSA IE is not presented.

In 6 GHz, because of the ambiguous definition of the subfields of the
Wide Bandwidth Channel Switch IE, we check the combination of new
channel width, ccfs0 and ccfs1 to build the correct chandef.


Change-Id: I36ca00b30987de53914c0c3122dcef62de996fc3
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7921181
3 files changed