Merge "[Add support to change bridge of a wifi interface]"
diff --git a/src/logan_wifi/wifi_hal.c b/src/logan_wifi/wifi_hal.c
index c6ccc38..d8e558a 100644
--- a/src/logan_wifi/wifi_hal.c
+++ b/src/logan_wifi/wifi_hal.c
@@ -3689,7 +3689,7 @@
 	int bss_idx;
 	char dat_file[MAX_BUF_SIZE] = {0};
 	int res;
-	struct params params[2];
+	struct params params[3];
 	struct vow_group_en_param atc_en_param;
 
 	wifi_getMaxRadioNumber(&max_radio_num);
@@ -3724,13 +3724,15 @@
 		params[0].value = enable ? "1" : "0";
 		params[1].name = "VOW_BW_Ctrl";
 		params[1].value = enable ? "1" : "0";
+		params[2].name = "VOW_Airtime_Ctrl_En";
+		params[2].value = enable ? "1;1;1;1;1;0;0;0;0;0;0;0;0;0;0" : "0;0;0;0;0;0;0;0;0;0;0;0;0;0;0";
 
 		res = snprintf(dat_file, sizeof(dat_file), "%s%d.dat", LOGAN_DAT_FILE, radio_idx);
 		if (os_snprintf_error(sizeof(dat_file), res)) {
 			wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
 			return RETURN_ERR;
 		}
-		wifi_datfileWrite(dat_file, params, 2);
+		wifi_datfileWrite(dat_file, params, 3);
 	}
 
     return RETURN_OK;
@@ -6366,9 +6368,10 @@
 INT wifi_getRadioOperatingChannelBandwidth(INT radioIndex, CHAR *output_string) //Tr181
 {
 	char buf[32] = {0};
-	int ret = 0, res;
+	int ret = 0, res, len = 0;
 	BOOL radio_enable = FALSE;
-	unsigned char bw;
+	//unsigned char bw;
+	char interface_name[64] = {0};
 
 	WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
 
@@ -6384,15 +6387,18 @@
 		WIFI_ENTRY_EXIT_DEBUG("Radio %d is not enable failed %s: %d \n", radioIndex, __func__, __LINE__);
 		return RETURN_OK;
 	}
-	if (mtk_wifi_get_radio_info(radioIndex, MTK_NL80211_VENDOR_ATTR_GET_BAND_INFO_BANDWIDTH,
-		get_bandwidth_handler, &bw)!= RETURN_OK) {
-		wifi_debug(DEBUG_ERROR, "send MTK_NL80211_VENDOR_ATTR_GET_BAND_INFO_BANDWIDTH cmd fails\n");
+
+	if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
 		return RETURN_ERR;
+
+	ret = _syscmd_secure(buf, sizeof(buf), "iw dev %s info | grep 'width' | cut -d  ' ' -f6 | tr -d '\\n'", interface_name);
+	if(ret) {
+		wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
 	}
 
-	ret = bwidx_to_string(bw, buf);
-	if (ret) {
-		wifi_debug(DEBUG_ERROR, "bwidx_to_string fails\n");
+	len = strlen(buf);
+	if ((ret != 0) || (len == 0))  {
+		wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
 		return RETURN_ERR;
 	}
 
@@ -19800,6 +19806,8 @@
 			bandwidth = 80;
 		else if (operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_160MHZ || operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_80_80MHZ)
 			bandwidth = 160;
+		else if (operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_320MHZ)
+			bandwidth = 320;
 
 		if (operationParam->autoChannelEnabled) {
 			if (wifi_pushRadioChannel2(index, 0, bandwidth, operationParam->csa_beacon_count) != RETURN_OK) {
@@ -20042,6 +20050,7 @@
 	else if (!strcmp(buf, "40MHz")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_40MHZ;
 	else if (!strcmp(buf, "80MHz")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_80MHZ;
 	else if (!strcmp(buf, "160MHz")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_160MHZ;
+	else if (!strcmp(buf, "320MHz")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_320MHZ;
 	else
 	{
 		wifi_debug(DEBUG_ERROR, "Unknown channel bandwidth: %s\n", buf);
@@ -20065,6 +20074,9 @@
 		operationParam->variant |= WIFI_80211_VARIANT_AC;
 	if (mode & WIFI_MODE_AX)
 		operationParam->variant |= WIFI_80211_VARIANT_AX;
+	if (mode & WIFI_MODE_BE)
+		operationParam->variant |= WIFI_80211_VARIANT_BE;
+
 	if (wifi_getRadioDCSEnable(index, &operationParam->DCSEnabled) != RETURN_OK) {
 		wifi_debug(DEBUG_ERROR, "wifi_getRadioDCSEnable return error.\n");
 		return RETURN_ERR;
@@ -20650,7 +20662,7 @@
 
 		vap_info = &map->vap_array[i];
 
-		if (vap_info->u.bss_info.enabled == FALSE /* || enable == FALSE*/) {
+		if (vap_info->u.bss_info.enabled == FALSE) {
 			wifi_getApEnable(vap_info->vap_index, &apEnable);
             if (apEnable) {
 				wifi_setApEnable(vap_info->vap_index, FALSE);
@@ -21005,24 +21017,29 @@
 		rcap->channelWidth[i] |= (WIFI_CHANNELBANDWIDTH_20MHZ |
 								WIFI_CHANNELBANDWIDTH_40MHZ);
 
-	}
-	else if (rcap->band[i] & (WIFI_FREQUENCY_5_BAND ) || rcap->band[i] & (WIFI_FREQUENCY_6_BAND)) {
+	} else if (rcap->band[i] & (WIFI_FREQUENCY_5_BAND ) || rcap->band[i] & (WIFI_FREQUENCY_6_BAND)) {
 		rcap->channelWidth[i] |= (WIFI_CHANNELBANDWIDTH_20MHZ |
 								WIFI_CHANNELBANDWIDTH_40MHZ |
 								WIFI_CHANNELBANDWIDTH_80MHZ | WIFI_CHANNELBANDWIDTH_160MHZ);
+	} else if (rcap->band[i] & (WIFI_FREQUENCY_6_BAND)) {
+		rcap->channelWidth[i] |= (WIFI_CHANNELBANDWIDTH_20MHZ |
+								WIFI_CHANNELBANDWIDTH_40MHZ |
+								WIFI_CHANNELBANDWIDTH_80MHZ | 
+								WIFI_CHANNELBANDWIDTH_160MHZ | 
+								WIFI_CHANNELBANDWIDTH_320MHZ);
 	}
 
 
 	/* mode - all supported variants */
 	// rcap->mode[i] = WIFI_80211_VARIANT_H;
 	if (rcap->band[i] & WIFI_FREQUENCY_2_4_BAND ) {
-		rcap->mode[i] = ( WIFI_80211_VARIANT_B | WIFI_80211_VARIANT_G | WIFI_80211_VARIANT_N | WIFI_80211_VARIANT_AX );
+		rcap->mode[i] = ( WIFI_80211_VARIANT_B | WIFI_80211_VARIANT_G | WIFI_80211_VARIANT_N | WIFI_80211_VARIANT_AX | WIFI_80211_VARIANT_BE);
 	}
 	else if (rcap->band[i] & WIFI_FREQUENCY_5_BAND ) {
-		rcap->mode[i] = ( WIFI_80211_VARIANT_A | WIFI_80211_VARIANT_N | WIFI_80211_VARIANT_AC | WIFI_80211_VARIANT_AX );
+		rcap->mode[i] = ( WIFI_80211_VARIANT_A | WIFI_80211_VARIANT_N | WIFI_80211_VARIANT_AC | WIFI_80211_VARIANT_AX | WIFI_80211_VARIANT_BE);
 	}
 	else if (rcap->band[i] & WIFI_FREQUENCY_6_BAND) {
-		rcap->mode[i] = ( WIFI_80211_VARIANT_AX );
+		rcap->mode[i] = ( WIFI_80211_VARIANT_AX | WIFI_80211_VARIANT_BE);
 	}
 	rcap->maxBitRate[i] = ( rcap->band[i] & WIFI_FREQUENCY_2_4_BAND ) ? 300 :
 		((rcap->band[i] & WIFI_FREQUENCY_5_BAND) ? 1734 : 0);