Prechádzať zdrojové kódy

qcacld-3.0: Fix getting wrong nss issue for dual APs case

In the dual APs DBS case, hdd_get_sap_operating_band
always return the operating band of last adapter and
might not be the current adapter's operating band,
which is not right.
So adding this fix to get operating frequency of
current adapter and then convert to according band,
then get the correct nss info.

Change-Id: Ief171d9b3d66937bede5fbe65be031bdc19529c8
CRs-Fix: 3043735
Chaoli Zhou 3 rokov pred
rodič
commit
90edf483e5

+ 16 - 8
core/hdd/src/wlan_hdd_cfg.c

@@ -1343,16 +1343,18 @@ QDF_STATUS hdd_get_nss(struct hdd_adapter *adapter, uint8_t *nss)
 
 /**
  * hdd_get_sap_tx_nss() - get the sap tx nss
- * @vdev: Pointer to vdev
+ * @adapter: Pointer to adapter
  * @hdd_ctx: Pointer to hdd context
+ * @vdev: Pointer to vdev
  * @tx_nss: pointer to tx_nss
  *
  * get the sap tx nss
  *
  * Return: None
  */
-static QDF_STATUS hdd_get_sap_tx_nss(struct wlan_objmgr_vdev *vdev,
+static QDF_STATUS hdd_get_sap_tx_nss(struct hdd_adapter *adapter,
 				     struct hdd_context *hdd_ctx,
+				     struct wlan_objmgr_vdev *vdev,
 				     uint8_t *tx_nss)
 {
 	struct wlan_mlme_nss_chains *dynamic_cfg;
@@ -1366,7 +1368,9 @@ static QDF_STATUS hdd_get_sap_tx_nss(struct wlan_objmgr_vdev *vdev,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	operating_band = hdd_get_sap_operating_band(hdd_ctx);
+	operating_band = hdd_get_sap_operating_band_by_adapter(adapter);
+	if (operating_band == BAND_UNKNOWN)
+		return QDF_STATUS_E_INVAL;
 	sme_get_sap_vdev_type_nss(mac_handle, &vdev_nss, operating_band);
 	if (hdd_ctx->dynamic_nss_chains_support) {
 		dynamic_cfg = mlme_get_dynamic_vdev_config(vdev);
@@ -1451,7 +1455,7 @@ QDF_STATUS hdd_get_tx_nss(struct hdd_adapter *adapter, uint8_t *tx_nss)
 
 	if (adapter->device_mode == QDF_SAP_MODE ||
 	    adapter->device_mode == QDF_P2P_GO_MODE)
-		status = hdd_get_sap_tx_nss(vdev, hdd_ctx, tx_nss);
+		status = hdd_get_sap_tx_nss(adapter, hdd_ctx, vdev, tx_nss);
 	else
 		status = hdd_get_sta_tx_nss(adapter, hdd_ctx, vdev, tx_nss);
 	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_ID);
@@ -1461,16 +1465,18 @@ QDF_STATUS hdd_get_tx_nss(struct hdd_adapter *adapter, uint8_t *tx_nss)
 
 /**
  * hdd_get_sap_rx_nss() - get the sap rx nss
- * @vdev: Pointer to vdev
+ * @adapter: Pointer to adapter
  * @hdd_ctx: Pointer to hdd context
+ * @vdev: Pointer to vdev
  * @rx_nss: pointer to rx_nss
  *
  * get the sap tx nss
  *
  * Return: None
  */
-static QDF_STATUS hdd_get_sap_rx_nss(struct wlan_objmgr_vdev *vdev,
+static QDF_STATUS hdd_get_sap_rx_nss(struct hdd_adapter *adapter,
 				     struct hdd_context *hdd_ctx,
+				     struct wlan_objmgr_vdev *vdev,
 				     uint8_t *rx_nss)
 {
 	struct wlan_mlme_nss_chains *dynamic_cfg;
@@ -1484,7 +1490,9 @@ static QDF_STATUS hdd_get_sap_rx_nss(struct wlan_objmgr_vdev *vdev,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	operating_band = hdd_get_sap_operating_band(hdd_ctx);
+	operating_band = hdd_get_sap_operating_band_by_adapter(adapter);
+	if (operating_band == BAND_UNKNOWN)
+		return QDF_STATUS_E_INVAL;
 	sme_get_sap_vdev_type_nss(mac_handle, &vdev_nss, operating_band);
 	if (hdd_ctx->dynamic_nss_chains_support) {
 		dynamic_cfg = mlme_get_dynamic_vdev_config(vdev);
@@ -1569,7 +1577,7 @@ QDF_STATUS hdd_get_rx_nss(struct hdd_adapter *adapter, uint8_t *rx_nss)
 
 	if (adapter->device_mode == QDF_SAP_MODE ||
 	    adapter->device_mode == QDF_P2P_GO_MODE)
-		status = hdd_get_sap_rx_nss(vdev, hdd_ctx, rx_nss);
+		status = hdd_get_sap_rx_nss(adapter, hdd_ctx, vdev, rx_nss);
 	else
 		status = hdd_get_sta_rx_nss(adapter, hdd_ctx, vdev, rx_nss);
 	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_ID);

+ 31 - 11
core/hdd/src/wlan_hdd_cfg80211.c

@@ -12429,6 +12429,34 @@ static enum sta_roam_policy_dfs_mode wlan_hdd_get_sta_roam_dfs_mode(
 	}
 }
 
+/*
+ * hdd_get_sap_operating_band_by_adapter:  Get current adapter operating band
+ * for sap.
+ * @adapter: Pointer to adapter
+ *
+ * Return : Corresponding band for SAP operating channel
+ */
+uint8_t hdd_get_sap_operating_band_by_adapter(struct hdd_adapter *adapter)
+{
+	uint32_t operating_chan_freq;
+	uint8_t sap_operating_band = 0;
+
+	if (adapter->device_mode != QDF_SAP_MODE &&
+	    adapter->device_mode != QDF_P2P_GO_MODE)
+		return BAND_UNKNOWN;
+
+	operating_chan_freq = adapter->session.ap.operating_chan_freq;
+	if (WLAN_REG_IS_24GHZ_CH_FREQ(operating_chan_freq))
+		sap_operating_band = BAND_2G;
+	else if (WLAN_REG_IS_5GHZ_CH_FREQ(operating_chan_freq) ||
+		 WLAN_REG_IS_6GHZ_CHAN_FREQ(operating_chan_freq))
+		sap_operating_band = BAND_5G;
+	else
+		sap_operating_band = BAND_UNKNOWN;
+
+	return sap_operating_band;
+}
+
 /*
  * hdd_get_sap_operating_band:  Get current operating channel
  * for sap.
@@ -12439,8 +12467,7 @@ static enum sta_roam_policy_dfs_mode wlan_hdd_get_sta_roam_dfs_mode(
 uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx)
 {
 	struct hdd_adapter *adapter, *next_adapter = NULL;
-	uint32_t  operating_chan_freq;
-	uint8_t sap_operating_band = 0;
+	uint8_t operating_band = 0;
 	wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_SAP_OPERATING_BAND;
 
 	hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
@@ -12450,19 +12477,12 @@ uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx)
 			continue;
 		}
 
-		operating_chan_freq = adapter->session.ap.operating_chan_freq;
-		if (WLAN_REG_IS_24GHZ_CH_FREQ(operating_chan_freq))
-			sap_operating_band = BAND_2G;
-		else if (WLAN_REG_IS_5GHZ_CH_FREQ(operating_chan_freq) ||
-			 WLAN_REG_IS_6GHZ_CHAN_FREQ(operating_chan_freq))
-			sap_operating_band = BAND_5G;
-		else
-			sap_operating_band = BAND_ALL;
+		operating_band = hdd_get_sap_operating_band_by_adapter(adapter);
 
 		hdd_adapter_dev_put_debug(adapter, dbgid);
 	}
 
-	return sap_operating_band;
+	return operating_band;
 }
 
 const struct nla_policy

+ 10 - 0
core/hdd/src/wlan_hdd_cfg80211.h

@@ -621,6 +621,16 @@ enum hdd_chain_mode {
  */
 void hdd_set_rate_bw(struct rate_info *info, enum hdd_rate_info_bw hdd_bw);
 
+/*
+ * hdd_get_sap_operating_band_by_adapter: Get current adapter operating channel
+ * for sap.
+ * @adapter: Pointer to adapter
+ *
+ * Return : Corresponding band for SAP operating channel
+ */
+
+uint8_t hdd_get_sap_operating_band_by_adapter(struct hdd_adapter *adapter);
+
 /*
  * hdd_get_sap_operating_band:  Get current operating channel
  * for sap.