Browse Source

qcacld-3.0: Add phymode parameter in hdd_chan_change_notify

Information in struct ch_params_s are the same for 11g and
11n ht20, so phymode is still needed to distinguish them.

Change-Id: I5ddfc011b4fd3b11c975f8b2df3a270e8141e622
CRs-Fixed: 2073580
bings 7 years ago
parent
commit
58ce86229c

+ 2 - 1
core/hdd/inc/wlan_hdd_main.h

@@ -2082,7 +2082,8 @@ int hdd_update_components_config(hdd_context_t *hdd_ctx);
 
 QDF_STATUS hdd_chan_change_notify(hdd_adapter_t *adapter,
 		struct net_device *dev,
-		struct hdd_chan_change_params chan_change);
+		struct hdd_chan_change_params chan_change,
+		bool legacy_phymode);
 int wlan_hdd_set_channel(struct wiphy *wiphy,
 		struct net_device *dev,
 		struct cfg80211_chan_def *chandef,

+ 2 - 1
core/hdd/src/wlan_hdd_assoc.c

@@ -4824,7 +4824,8 @@ static void hdd_roam_channel_switch_handler(hdd_adapter_t *adapter,
 	else
 		cfg80211_put_bss(wiphy, bss);
 
-	status = hdd_chan_change_notify(adapter, adapter->dev, chan_change);
+	status = hdd_chan_change_notify(adapter, adapter->dev, chan_change,
+				roam_info->mode == SIR_SME_PHY_MODE_LEGACY);
 	if (QDF_IS_STATUS_ERROR(status))
 		hdd_err("channel change notification failed");
 

+ 25 - 6
core/hdd/src/wlan_hdd_hostapd.c

@@ -630,9 +630,10 @@ static int hdd_stop_bss_link(hdd_adapter_t *pHostapdAdapter,
 
 /**
  * hdd_chan_change_notify() - Function to notify hostapd about channel change
- * @hostapd_adapter	hostapd adapter
+ * @hostapd_adapter:	hostapd adapter
  * @dev:		Net device structure
  * @chan_change:	New channel change parameters
+ * @legacy_phymode:	is the phymode legacy
  *
  * This function is used to notify hostapd about the channel change
  *
@@ -641,7 +642,8 @@ static int hdd_stop_bss_link(hdd_adapter_t *pHostapdAdapter,
  */
 QDF_STATUS hdd_chan_change_notify(hdd_adapter_t *adapter,
 		struct net_device *dev,
-		struct hdd_chan_change_params chan_change)
+		struct hdd_chan_change_params chan_change,
+		bool legacy_phymode)
 {
 	struct ieee80211_channel *chan;
 	struct cfg80211_chan_def chandef;
@@ -669,7 +671,9 @@ QDF_STATUS hdd_chan_change_notify(hdd_adapter_t *adapter,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	if (chan_change.chan_params.ch_width) {
+	if (legacy_phymode) {
+		channel_type = NL80211_CHAN_NO_HT;
+	} else {
 		switch (chan_change.chan_params.sec_ch_offset) {
 		case PHY_SINGLE_CHANNEL_CENTERED:
 			channel_type = NL80211_CHAN_HT20;
@@ -684,8 +688,6 @@ QDF_STATUS hdd_chan_change_notify(hdd_adapter_t *adapter,
 			channel_type = NL80211_CHAN_NO_HT;
 			break;
 		}
-	} else {
-		channel_type = NL80211_CHAN_NO_HT;
 	}
 
 	cfg80211_chandef_create(&chandef, chan, channel_type);
@@ -1075,6 +1077,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 	struct hdd_chan_change_params chan_change;
 	int ret = 0;
 	struct ch_params sap_ch_param = {0};
+	eCsrPhyMode phy_mode;
+	bool legacy_phymode;
 
 	dev = (struct net_device *)usrDataForCallback;
 	if (!dev) {
@@ -2008,6 +2012,21 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 			pSapEvent->sapevt.sap_ch_selected.ht_sec_ch,
 			&sap_ch_param);
 
+		phy_mode = wlan_sap_get_phymode(
+				WLAN_HDD_GET_SAP_CTX_PTR(pHostapdAdapter));
+
+		switch (phy_mode) {
+		case eCSR_DOT11_MODE_11n:
+		case eCSR_DOT11_MODE_11n_ONLY:
+		case eCSR_DOT11_MODE_11ac:
+		case eCSR_DOT11_MODE_11ac_ONLY:
+			legacy_phymode = false;
+			break;
+		default:
+			legacy_phymode = true;
+			break;
+		}
+
 		chan_change.chan =
 			pSapEvent->sapevt.sap_ch_selected.pri_ch;
 		chan_change.chan_params.ch_width =
@@ -2020,7 +2039,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 			pSapEvent->sapevt.sap_ch_selected.vht_seg1_center_ch;
 
 		return hdd_chan_change_notify(pHostapdAdapter, dev,
-					      chan_change);
+					      chan_change, legacy_phymode);
 	case eSAP_ACS_SCAN_SUCCESS_EVENT:
 		return hdd_handle_acs_scan_event(pSapEvent, pHostapdAdapter);
 

+ 10 - 0
core/sap/inc/sap_api.h

@@ -1009,6 +1009,16 @@ QDF_STATUS wlansap_set_dfs_preferred_channel_location(tHalHandle hHal,
 		uint8_t dfs_Preferred_Channels_location);
 QDF_STATUS wlansap_set_dfs_target_chnl(tHalHandle hHal,
 			uint8_t target_channel);
+
+/**
+ * wlan_sap_get_phymode() - Returns sap phymode.
+ * @ctx:	Pointer to cds Context or Sap Context.
+ *
+ * This function provides the SAP current phymode.
+ *
+ * Return: phymode
+ */
+eCsrPhyMode wlan_sap_get_phymode(void *ctx);
 uint32_t wlan_sap_get_vht_ch_width(void *ctx);
 void wlan_sap_set_vht_ch_width(void *ctx, uint32_t vht_channel_width);
 QDF_STATUS wlansap_update_sap_config_add_ie(tsap_Config_t *pConfig,

+ 13 - 0
core/sap/src/sap_module.c

@@ -746,6 +746,19 @@ wlansap_set_scan_acs_channel_params(tsap_Config_t *pconfig,
 
 	return status;
 }
+
+eCsrPhyMode wlan_sap_get_phymode(void *ctx)
+{
+	ptSapContext sap_ctx = CDS_GET_SAP_CB(ctx);
+
+	if (!sap_ctx) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
+			FL("Invalid SAP pointer from ctx"));
+		return 0;
+	}
+	return sap_ctx->csr_roamProfile.phyMode;
+}
+
 /**
  * wlan_sap_get_vht_ch_width() - Returns SAP VHT channel width.
  * @ctx:	Pointer to cds Context or Sap Context based on MBSSID

+ 10 - 0
core/sme/inc/csr_internal.h

@@ -1093,6 +1093,16 @@ typedef struct tagCsrRoamStruct {
 	 (eCSR_DOT11_MODE_11ax & (phyMode)) || \
 	 (eCSR_DOT11_MODE_AUTO & (phyMode)))
 
+#define CSR_IS_PHY_MODE_11n(phy_mode) \
+	((eCSR_DOT11_MODE_11n == phy_mode) || \
+	 (eCSR_DOT11_MODE_11n_ONLY == phy_mode) || \
+	 (eCSR_DOT11_MODE_11ac == phy_mode) || \
+	 (eCSR_DOT11_MODE_11ac_ONLY == phy_mode))
+
+#define CSR_IS_PHY_MODE_11ac(phy_mode) \
+	((eCSR_DOT11_MODE_11ac == phy_mode) || \
+	 (eCSR_DOT11_MODE_11ac_ONLY == phy_mode))
+
 /*
  * this function returns true if the NIC is operating exclusively in
  * the 2.4 GHz band, meaning. it is NOT operating in the 5.0 GHz band.

+ 7 - 0
core/sme/src/csr/csr_api_roam.c

@@ -10880,6 +10880,13 @@ csr_roam_chk_lnk_swt_ch_ind(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr)
 				pSwitchChnInd->chan_params.center_freq_seg0;
 		roamInfo.chan_info.band_center_freq2 =
 				pSwitchChnInd->chan_params.center_freq_seg1;
+		if (CSR_IS_PHY_MODE_11ac(mac_ctx->roam.configParam.phyMode))
+			roamInfo.mode = SIR_SME_PHY_MODE_VHT;
+		else if (CSR_IS_PHY_MODE_11n(mac_ctx->roam.configParam.phyMode))
+			roamInfo.mode = SIR_SME_PHY_MODE_HT;
+		else
+			roamInfo.mode = SIR_SME_PHY_MODE_LEGACY;
+
 		status = csr_roam_call_callback(mac_ctx, sessionId,
 				&roamInfo, 0, eCSR_ROAM_STA_CHANNEL_SWITCH,
 				eCSR_ROAM_RESULT_NONE);