Index: hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/wpa_supplicant/wpa_supplicant.c
+++ hostapd-2021-02-20-59e9794c/wpa_supplicant/wpa_supplicant.c
@@ -2430,6 +2430,22 @@ static int drv_supports_vht(struct wpa_s
 	return mode->vht_capab != 0;
 }
 
+static bool ibss_mesh_is_80mhz_avail(int channel, struct hostapd_hw_modes *mode)
+{
+	int i;
+
+	for (i = channel; i < channel + 16; i += 4) {
+		struct hostapd_channel_data *chan;
+
+		chan = hw_get_channel_chan(mode, i, NULL);
+		if (!chan)
+			return false;
+
+		if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
+			return false;
+	}
+	return true;
+}
 
 void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
 			  const struct wpa_ssid *ssid,
@@ -2443,6 +2459,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
 	unsigned int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955,
 				6035, 6115, 6195, 6275, 6355, 6435, 6515,
 				6595, 6675, 6755, 6835, 6915, 6995 };
+	unsigned int bw160[] = { 5955, 6115, 6275, 6435, 6595, 6755, 6915 };
 	struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL;
 	u8 channel;
 	int i, chan_idx, ht40 = -1, res, obss_scan = !(ssid->noscan);
@@ -2685,25 +2702,34 @@ skip_to_6ghz:
 	if (j == ARRAY_SIZE(bw80))
 		return;
 
-	for (i = freq->channel; i < freq->channel + 16; i += 4) {
-		struct hostapd_channel_data *chan;
-
-		chan = hw_get_channel_chan(mode, i, NULL);
-		if (!chan)
-			return;
-
-		/* Back to HT configuration if channel not usable */
-		if (chan->flag & HOSTAPD_CHAN_DISABLED)
-			return;
-		if (chan->flag & (HOSTAPD_CHAN_RADAR | HOSTAPD_CHAN_NO_IR))
-			if (!dfs_enabled)
-				return;
-	}
+	/* Back to HT configuration if channel not usable */
+	if (!ibss_mesh_is_80mhz_avail(freq->channel, mode))
+		return;
 
 	chwidth = CHANWIDTH_80MHZ;
 	seg0 = freq->channel + 6;
 	seg1 = 0;
 
+	/* setup center_freq1 for 6G 160MHz */
+	if ((mode->he_capab[ieee80211_mode].phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] &
+	     HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G) && is_6ghz) {
+
+		for (j = 0; j < ARRAY_SIZE(bw160); j++) {
+			if (freq->freq == bw160[j]) {
+				/* In 160MHz, Initial four 20MHz channels validated before,
+				 * check remaining four 20MHz channels in total 160MHz bandwidth
+				 */
+				int channel = freq->channel + 16;
+
+				if (!ibss_mesh_is_80mhz_avail(channel, mode))
+					return;
+
+				chwidth = CHANWIDTH_160MHZ;
+				seg0 = freq->channel + 14;
+			}
+		}
+	}
+
 	if (ssid->max_oper_chwidth == CHANWIDTH_80P80MHZ) {
 		/* setup center_freq2, bandwidth */
 		for (k = 0; k < ARRAY_SIZE(bw80); k++) {
