CSA: RIVA: Channel Switch Announce based on Beacon IE

Sta / p2p cli should follow the new channel without disconnection,
after Ap announce the CSA IE on its beacon on connected channel.
Based on beacon filter offload, whenever there is a change in IE,
Fw sends beacon to host. Host parse through the beacon, and trigger
CSA operation, by starting timer.

Existing Ch switch Req (WLAN_HAL_CH_SWITCH_REQ) does not have
reason of channel switch, so new WLAN_HAL_CH_SWITCH_V1_REQ has been
created to support required additional information for the FW.

Also capability bit CH_SWITCH_V1 , is used to support
legacy FW compatibility.
CRs-fixed: 588953

Change-Id: Idfe4b732bc5df471f368c87772046995e1e01412
diff --git a/riva/inc/wlan_hal_msg.h b/riva/inc/wlan_hal_msg.h
index 101bd1d..bd623a9 100644
--- a/riva/inc/wlan_hal_msg.h
+++ b/riva/inc/wlan_hal_msg.h
@@ -441,9 +441,15 @@
    WLAN_HAL_IP_FORWARD_TABLE_UPDATE_IND     = 232,
 
    WLAN_HAL_AVOID_FREQ_RANGE_IND            = 233,
+
+   /* Channel Switch Request version 1 */
+   WLAN_HAL_CH_SWITCH_V1_REQ                = 252,
+   WLAN_HAL_CH_SWITCH_V1_RSP                = 253,
+
    /* 2G4 HT40 OBSS scan */
    WLAN_HAL_START_HT40_OBSS_SCAN_IND        = 254,
    WLAN_HAL_STOP_HT40_OBSS_SCAN_IND         = 255,
+
   WLAN_HAL_MSG_MAX = WLAN_HAL_MSG_TYPE_MAX_ENUM_SIZE
 }tHalHostMsgType;
 
@@ -497,6 +503,20 @@
 
 typedef enum
 {
+   eHAL_CHANNEL_SWITCH_SOURCE_SCAN,
+   eHAL_CHANNEL_SWITCH_SOURCE_LISTEN,
+   eHAL_CHANNEL_SWITCH_SOURCE_MCC,
+   eHAL_CHANNEL_SWITCH_SOURCE_CSA,
+   eHAL_CHANNEL_SWITCH_SOURCE_CONFIG_BSS,
+   eHAL_CHANNEL_SWITCH_SOURCE_CONFIG_STA,
+   eHAL_CHANNEL_SWITCH_SOURCE_JOIN_REQ,
+   eHAL_CHANNEL_SWITCH_SOURCE_INNAV,
+   eHAL_CHANNEL_SWITCH_SOURCE_WCA,
+   eHAL_CHANNEL_SWITCH_SOURCE_MAX = WLAN_HAL_MAX_ENUM_SIZE
+} eHalChanSwitchSource;
+
+typedef enum
+{
     PHY_SINGLE_CHANNEL_CENTERED = 0,     // 20MHz IF bandwidth centered on IF carrier
     PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1,  // 40MHz IF bandwidth with lower 20MHz supporting the primary channel
     PHY_DOUBLE_CHANNEL_CENTERED = 2,     // 40MHz IF bandwidth centered on IF carrier
@@ -1085,6 +1105,11 @@
    tStartScanParams startScanParams;
 }  tHalStartScanReqMsg, *tpHalStartScanReqMsg;
 
+typedef PACKED_PRE struct PACKED_POST
+{
+   tHalMsgHeader header;
+}  tHalMotionEventReqMsg, *tpHalMotionEventReqMsg;
+
 /*---------------------------------------------------------------------------
   WLAN_HAL_START_SCAN_RSP
 ---------------------------------------------------------------------------*/
@@ -1704,10 +1729,10 @@
 // IFACE PERSONA for different Operating modes
 typedef enum
 {
-    HAL_IFACE_UNKNOWN,
-    HAL_IFACE_STA_MODE,
-    HAL_IFACE_P2P_MODE,
-    HAL_IFACE_MAX
+    HAL_IFACE_UNKNOWN=0,
+    HAL_IFACE_STA_MODE=1,
+    HAL_IFACE_P2P_MODE=2,
+    HAL_IFACE_MAX=0x7FFFFFFF,
 } tHalIfacePersona;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -2386,7 +2411,79 @@
 
 #endif
 
+/*---------------------------------------------------------------------------
+WLAN_HAL_CH_SWITCH_V1_REQ
+---------------------------------------------------------------------------*/
 
+typedef PACKED_PRE struct PACKED_POST
+{
+    /* Channel number */
+    tANI_U8 channelNumber;
+
+    /* Local power constraint */
+    tANI_U8 localPowerConstraint;
+
+    /*Secondary channel offset */
+    ePhyChanBondState secondaryChannelOffset;
+
+    //HAL fills in the tx power used for mgmt frames in this field.
+    tPowerdBm txMgmtPower;
+
+    /* Max TX power */
+    tPowerdBm maxTxPower;
+
+    /* Self STA MAC */
+    tSirMacAddr selfStaMacAddr;
+
+    /*VO WIFI comment: BSSID needed to identify session. As the request has
+     * power constraints, this should be applied only to that session
+     * Since MTU timing and EDCA are sessionized, this struct needs to be
+     * sessionized and bssid needs to be out of the VOWifi feature flag
+     * V IMP: Keep bssId field at the end of this msg. It is used to
+     * mantain backward compatbility by way of ignoring if using new
+     * host/old FW or old host/new FW since it is at the end of this struct
+     */
+    tSirMacAddr bssId;
+
+    /* Source of Channel Switch */
+    eHalChanSwitchSource channelSwitchSrc;
+} tSwitchChannelParams_V1, *tpSwitchChannelParams_V1;
+
+typedef PACKED_PRE struct PACKED_POST
+{
+    tHalMsgHeader header;
+    tSwitchChannelParams_V1 switchChannelParams_V1;
+} tSwitchChannelReqMsg_V1, *tpSwitchChannelReqMsg_V1;
+
+
+/*---------------------------------------------------------------------------
+WLAN_HAL_CH_SWITCH_V1_RSP
+---------------------------------------------------------------------------*/
+
+typedef PACKED_PRE struct PACKED_POST
+{
+    /* Status */
+    tANI_U32 status;
+
+    /* Channel number - same as in request*/
+    tANI_U8 channelNumber;
+
+    /* HAL fills in the tx power used for mgmt frames in this field */
+    tPowerdBm txMgmtPower;
+
+    /* BSSID needed to identify session - same as in request*/
+    tSirMacAddr bssId;
+
+    /* Source of Channel Switch */
+    eHalChanSwitchSource channelSwitchSrc;
+
+} tSwitchChannelRspParams_V1, *tpSwitchChannelRspParams_V1;
+
+typedef PACKED_PRE struct PACKED_POST
+{
+    tHalMsgHeader header;
+    tSwitchChannelRspParams_V1 channelSwitchRspParams_V1;
+} tSwitchChannelRspMsg_V1, *tpSwitchChannelRspMsg_V1;
 
 /*---------------------------------------------------------------------------
 WLAN_HAL_CH_SWITCH_REQ
@@ -6118,6 +6215,7 @@
     CH_SWITCH_V1           = 33,
     HT40_OBSS_SCAN         = 34,
     UPDATE_CHANNEL_LIST    = 35,
+
     MAX_FEATURE_SUPPORTED  = 128,
 } placeHolderInCapBitmap;
 
@@ -6140,6 +6238,7 @@
 #define IS_WLAN_ROAM_SCAN_OFFLOAD_SUPPORTED_BY_HOST (!!(halMsg_GetHostWlanFeatCaps(WLAN_ROAM_SCAN_OFFLOAD)))
 #define IS_IBSS_HEARTBEAT_OFFLOAD_SUPPORTED_BY_HOST (!!(halMsg_GetHostWlanFeatCaps(IBSS_HEARTBEAT_OFFLOAD)))
 #define IS_SCAN_OFFLOAD_SUPPORTED_BY_HOST (!!(halMsg_GetHostWlanFeatCaps(WLAN_SCAN_OFFLOAD)))
+#define IS_CH_SWITCH_V1_SUPPORTED_BY_HOST ((!!(halMsg_GetHostWlanFeatCaps(CH_SWITCH_V1))))
 
 tANI_U8 halMsg_GetHostWlanFeatCaps(tANI_U8 feat_enum_value);