Răsfoiți Sursa

qcacld-3.0: Populate channel flags for vdev_mlme.des_chan

When vdev_mgr_start_send is introduced, the Dfs->dfs_curchan
will be filled from mlme "des_chan" by tgt_dfs_set_current_channel.
Set correct channel flags to des_chan so that dfs radar functions
can get correct channel information.

Change-Id: I643acadb97c3924261b45f598a50fa82d9a224e6
CRs-Fixed: 2529996
Liangwei Dong 5 ani în urmă
părinte
comite
a96e0027c1

+ 2 - 0
core/cds/src/cds_ieee80211_common_i.h

@@ -129,6 +129,8 @@ enum ieee80211_protmode {
 
 /* flagext */
 #define IEEE80211_CHAN_DFS              0x0002  /* DFS required on channel */
+/* DFS required on channel for 2nd band of 80+80*/
+#define IEEE80211_CHAN_DFS_CFREQ2       0x0004
 
 #define IEEE80211_SEQ_MASK      0xfff   /* sequence generator mask */
 #define MIN_SW_SEQ              0x100   /* minimum sequence for SW generate packect */

+ 49 - 0
core/mac/src/pe/lim/lim_utils.c

@@ -8446,6 +8446,10 @@ QDF_STATUS lim_set_ch_phy_mode(struct wlan_objmgr_vdev *vdev, uint8_t dot11mode)
 	des_chan = vdev->vdev_mlme.des_chan;
 	des_chan->ch_ieee = wlan_reg_freq_to_chan(mac_ctx->pdev,
 						  des_chan->ch_freq);
+	/*
+	 * Set ch_cfreq1 to ch_freq for 20Mhz. If BW is greater than 20 it
+	 * will be updated from ch_freq_seg1.
+	 */
 	des_chan->ch_cfreq1 = des_chan->ch_freq;
 	ch_width = des_chan->ch_width;
 	bw_val = wlan_reg_get_bw_value(ch_width);
@@ -8458,7 +8462,16 @@ QDF_STATUS lim_set_ch_phy_mode(struct wlan_objmgr_vdev *vdev, uint8_t dot11mode)
 			       bw_val);
 			ch_width = CH_WIDTH_20MHZ;
 			bw_val = 20;
+			if (des_chan->ch_cfreq1)
+				des_chan->ch_freq_seg1 =
+					wlan_reg_freq_to_chan(
+						mac_ctx->pdev,
+						des_chan->ch_cfreq1);
 		}
+	} else if (des_chan->ch_cfreq1) {
+		des_chan->ch_freq_seg1 =
+			wlan_reg_freq_to_chan(mac_ctx->pdev,
+					      des_chan->ch_cfreq1);
 	}
 	if (bw_val > 80) {
 		if (des_chan->ch_freq_seg2) {
@@ -8468,11 +8481,47 @@ QDF_STATUS lim_set_ch_phy_mode(struct wlan_objmgr_vdev *vdev, uint8_t dot11mode)
 			pe_err("Invalid cntr_freq for bw %d, drop to 80",
 			       bw_val);
 			des_chan->ch_cfreq2 = 0;
+			des_chan->ch_freq_seg2 = 0;
 			ch_width = CH_WIDTH_80MHZ;
 		}
 	} else {
 		des_chan->ch_cfreq2 = 0;
+		des_chan->ch_freq_seg2 = 0;
 	}
+
+	des_chan->ch_flags = 0;
+	switch (ch_width) {
+	case CH_WIDTH_20MHZ:
+		des_chan->ch_flags |= IEEE80211_CHAN_VHT20;
+		break;
+	case CH_WIDTH_40MHZ:
+		des_chan->ch_flags |= IEEE80211_CHAN_VHT40PLUS;
+		break;
+	case CH_WIDTH_80MHZ:
+		des_chan->ch_flags |= IEEE80211_CHAN_VHT80;
+		break;
+	case CH_WIDTH_80P80MHZ:
+		des_chan->ch_flags |= IEEE80211_CHAN_VHT80_80;
+		break;
+	case CH_WIDTH_160MHZ:
+		des_chan->ch_flags |= IEEE80211_CHAN_VHT160;
+		break;
+	default:
+		break;
+	}
+
+	if (WLAN_REG_IS_24GHZ_CH_FREQ(des_chan->ch_freq))
+		des_chan->ch_flags |= IEEE80211_CHAN_2GHZ;
+	else
+		des_chan->ch_flags |= IEEE80211_CHAN_5GHZ;
+
+	des_chan->ch_flagext = 0;
+	if (wlan_reg_is_dfs_for_freq(mac_ctx->pdev, des_chan->ch_freq))
+		des_chan->ch_flagext |= IEEE80211_CHAN_DFS;
+	if (des_chan->ch_cfreq2 &&
+	    wlan_reg_is_dfs_for_freq(mac_ctx->pdev, des_chan->ch_cfreq2))
+		des_chan->ch_flagext |= IEEE80211_CHAN_DFS_CFREQ2;
+
 	chan_mode = wma_chan_phy_mode(des_chan->ch_freq, ch_width,
 				      dot11mode);
 

+ 6 - 43
core/sap/src/sap_fsm.c

@@ -484,17 +484,13 @@ void sap_get_cac_dur_dfs_region(struct sap_context *sap_ctx,
 void sap_dfs_set_current_channel(void *ctx)
 {
 	struct sap_context *sap_ctx = ctx;
-	uint32_t ic_flags = 0;
-	uint16_t ic_flagext = 0;
-	uint8_t ic_ieee;
-	uint16_t ic_freq = sap_ctx->chan_freq;
 	uint8_t vht_seg0 = sap_ctx->csr_roamProfile.ch_params.center_freq_seg0;
 	uint8_t vht_seg1 = sap_ctx->csr_roamProfile.ch_params.center_freq_seg1;
 	struct wlan_objmgr_pdev *pdev;
 	struct mac_context *mac_ctx;
 	uint32_t use_nol = 0;
 	int error;
-	uint16_t sap_ch;
+	bool is_dfs;
 
 	mac_ctx = sap_get_mac_context();
 	if (!mac_ctx) {
@@ -509,47 +505,14 @@ void sap_dfs_set_current_channel(void *ctx)
 		return;
 	}
 
-	ic_ieee = wlan_reg_freq_to_chan(pdev, sap_ctx->chan_freq);
-	switch (sap_ctx->csr_roamProfile.ch_params.ch_width) {
-	case CH_WIDTH_20MHZ:
-		ic_flags |= IEEE80211_CHAN_VHT20;
-		break;
-	case CH_WIDTH_40MHZ:
-		ic_flags |= IEEE80211_CHAN_VHT40PLUS;
-		break;
-	case CH_WIDTH_80MHZ:
-		ic_flags |= IEEE80211_CHAN_VHT80;
-		break;
-	case CH_WIDTH_80P80MHZ:
-		ic_flags |= IEEE80211_CHAN_VHT80_80;
-		break;
-	case CH_WIDTH_160MHZ:
-		ic_flags |= IEEE80211_CHAN_VHT160;
-		break;
-	default:
-		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
-			  FL("Invalid channel width=%d"),
-			  sap_ctx->csr_roamProfile.ch_params.ch_width);
-		return;
-	}
-
-	if (WLAN_REG_IS_24GHZ_CH_FREQ(sap_ctx->chan_freq))
-		ic_flags |= IEEE80211_CHAN_2GHZ;
-	else
-		ic_flags |= IEEE80211_CHAN_5GHZ;
-
-	sap_ch = wlan_reg_freq_to_chan(pdev, sap_ctx->chan_freq);
-	if (wlan_reg_is_dfs_ch(pdev, sap_ch))
-		ic_flagext |= IEEE80211_CHAN_DFS;
+	is_dfs = wlan_reg_is_dfs_for_freq(pdev, sap_ctx->chan_freq);
 
 	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
-		  FL("freq=%d, channel=%d, seg0=%d, seg1=%d, flags=0x%x, ext flags=0x%x"),
-		  ic_freq, ic_ieee, vht_seg0, vht_seg1, ic_flags, ic_flagext);
-
-	tgt_dfs_set_current_channel(pdev, ic_freq, ic_flags,
-			ic_flagext, ic_ieee, vht_seg0, vht_seg1);
+		  FL("freq=%d, dfs %d seg0=%d, seg1=%d, bw %d"),
+		  sap_ctx->chan_freq, is_dfs, vht_seg0, vht_seg1,
+		  sap_ctx->csr_roamProfile.ch_params.ch_width);
 
-	if (wlan_reg_is_dfs_ch(pdev, sap_ch)) {
+	if (is_dfs) {
 		if (policy_mgr_concurrent_beaconing_sessions_running(
 		    mac_ctx->psoc)) {
 			uint16_t con_ch_freq;