Browse Source

qcacld-3.0: Add support for getting AP capabilities

Add support for sending the AP capabilities to SON module

Change-Id: I9308608e321aa21f6e0566958508ceaf78c5635b
CRs-Fixed: 3154537
anikkuma 3 years ago
parent
commit
05c26a216a

+ 13 - 0
components/son/dispatcher/inc/son_api.h

@@ -317,6 +317,19 @@ int wlan_son_set_cbs_wait_time(struct wlan_objmgr_vdev *vdev,
 int wlan_son_set_cbs_dwell_split_time(struct wlan_objmgr_vdev *vdev,
 				      uint32_t val);
 
+/**
+ * wlan_son_vdev_get_supported_txrx_streams() - get supported spatial streams
+ * @vdev: pointer to vdev
+ * @num_tx_streams: pointer to number of tx streams
+ * @num_rx_streams: pointer to number of rx streams
+ *
+ * Return: QDF_STATUS_SUCCESS on Success else failure.
+ */
+QDF_STATUS
+wlan_son_vdev_get_supported_txrx_streams(struct wlan_objmgr_vdev *vdev,
+					 uint32_t *num_tx_streams,
+					 uint32_t *num_rx_streams);
+
 #ifdef WLAN_FEATURE_SON
 /**
  * wlan_son_peer_is_kickout_allow() - Is peer is allowed to kickout

+ 22 - 0
components/son/dispatcher/inc/son_ucfg_api.h

@@ -203,6 +203,28 @@ QDF_STATUS ucfg_son_get_peer_rrm_info(struct element_info assoc_req_ies,
 				      uint8_t *rrmcaps,
 				      bool *is_beacon_meas_supported);
 
+/**
+ * ucfg_son_vdev_get_supported_txrx_streams() - get supported spatial streams
+ * @vdev: pointer to vdev
+ * @num_tx_streams: pointer to number of tx streams
+ * @num_rx_streams: pointer to number of rx streams
+ *
+ * Return: QDF_STATUS_SUCCESS on Success else failure.
+ */
+QDF_STATUS
+ucfg_son_vdev_get_supported_txrx_streams(struct wlan_objmgr_vdev *vdev,
+					 uint32_t *num_tx_streams,
+					 uint32_t *num_rx_streams);
+/**
+ * ucfg_son_get_vht_cap() - get the vht capability ie
+ * @psoc: psoc object
+ * @vht_caps: VHT caps bit fields
+ *
+ * Return: QDF_STATUS_SUCCESS on Success else failure.
+ */
+QDF_STATUS ucfg_son_get_vht_cap(struct wlan_objmgr_psoc *psoc,
+				int32_t *vht_caps);
+
 #ifdef WLAN_FEATURE_SON
 /* ucfg_son_disable_cbs() - son cbs disable
  * @vdev: vdev pointer

+ 33 - 0
components/son/dispatcher/src/son_api.c

@@ -1380,3 +1380,36 @@ QDF_STATUS wlan_son_get_peer_rrm_info(struct element_info assoc_req_ies,
 	}
 	return QDF_STATUS_E_RESOURCES;
 }
+
+QDF_STATUS
+wlan_son_vdev_get_supported_txrx_streams(struct wlan_objmgr_vdev *vdev,
+					 uint32_t *num_tx_streams,
+					 uint32_t *num_rx_streams)
+{
+	struct wlan_mlme_nss_chains *nss_cfg;
+	enum nss_chains_band_info band = NSS_CHAINS_BAND_MAX;
+	struct wlan_channel *chan;
+	qdf_freq_t chan_freq = 0;
+
+	nss_cfg = mlme_get_dynamic_vdev_config(vdev);
+	if (!nss_cfg)
+		return QDF_STATUS_NOT_INITIALIZED;
+
+	chan = wlan_vdev_get_active_channel(vdev);
+	if (chan)
+		chan_freq = chan->ch_freq;
+
+	if (WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq))
+		band = NSS_CHAINS_BAND_2GHZ;
+
+	if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq))
+		band = NSS_CHAINS_BAND_5GHZ;
+
+	if (band == NSS_CHAINS_BAND_MAX)
+		return QDF_STATUS_NOT_INITIALIZED;
+
+	*num_tx_streams = nss_cfg->tx_nss[band];
+	*num_rx_streams = nss_cfg->rx_nss[band];
+
+	return QDF_STATUS_SUCCESS;
+}

+ 22 - 0
components/son/dispatcher/src/son_ucfg_api.c

@@ -144,3 +144,25 @@ QDF_STATUS ucfg_son_get_peer_rrm_info(struct element_info assoc_req_ies,
 	return wlan_son_get_peer_rrm_info(assoc_req_ies, rrmcaps,
 					  is_beacon_meas_supported);
 }
+
+QDF_STATUS
+ucfg_son_vdev_get_supported_txrx_streams(struct wlan_objmgr_vdev *vdev,
+					 uint32_t *num_tx_streams,
+					 uint32_t *num_rx_streams)
+{
+	return wlan_son_vdev_get_supported_txrx_streams(vdev,
+							num_tx_streams,
+							num_rx_streams);
+}
+
+QDF_STATUS ucfg_son_get_vht_cap(struct wlan_objmgr_psoc *psoc,
+				int32_t *vht_caps)
+{
+	struct wlan_psoc_target_capability_info *target_cap =
+					lmac_get_target_cap(psoc);
+
+	if (!target_cap)
+		return QDF_STATUS_E_NULL_VALUE;
+	*vht_caps = target_cap->vht_cap_info;
+	return QDF_STATUS_SUCCESS;
+}

+ 72 - 0
os_if/son/src/os_if_son.c

@@ -880,6 +880,75 @@ enum ieee80211_phymode os_if_son_get_phymode(struct wlan_objmgr_vdev *vdev)
 }
 qdf_export_symbol(os_if_son_get_phymode);
 
+static QDF_STATUS os_if_son_get_apcap(struct wlan_objmgr_vdev *vdev,
+				      wlan_ap_cap *apcap)
+{
+	uint32_t num_rx_streams = 0;
+	uint32_t num_tx_streams = 0;
+	uint32_t  value;
+	struct mlme_ht_capabilities_info ht_cap_info;
+	struct wlan_objmgr_psoc *psoc;
+	tDot11fIEhe_cap he_cap = {0};
+	bool enabled;
+	QDF_STATUS status;
+	int32_t vht_caps = 0;
+
+	/* Number of supported tx and rx streams */
+	status = ucfg_son_vdev_get_supported_txrx_streams(vdev, &num_tx_streams,
+							  &num_rx_streams);
+	if (status != QDF_STATUS_SUCCESS) {
+		osif_err("Could not get txrx streams");
+		return status;
+	}
+
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		osif_err("null psoc");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	/* Fetch HT CAP */
+	status = ucfg_mlme_get_ht_cap_info(psoc, &ht_cap_info);
+	if (status == QDF_STATUS_SUCCESS) {
+		apcap->wlan_ap_ht_capabilities_valid = true;
+		qdf_mem_copy(&apcap->htcap.htcap, &ht_cap_info,
+			     sizeof(struct mlme_ht_capabilities_info));
+		apcap->htcap.max_tx_nss = num_tx_streams;
+		apcap->htcap.max_rx_nss = num_rx_streams;
+	}
+
+	/* Fetch VHT CAP */
+	status = ucfg_mlme_get_vht_enable2x2(psoc, &enabled);
+	if (enabled) {
+		apcap->wlan_ap_vht_capabilities_valid = 1;
+		ucfg_mlme_cfg_get_vht_tx_mcs_map(psoc, &value);
+		apcap->vhtcap.supp_tx_mcs = value;
+		ucfg_mlme_cfg_get_vht_rx_mcs_map(psoc, &value);
+		apcap->vhtcap.supp_rx_mcs = value;
+		apcap->vhtcap.max_tx_nss = num_tx_streams;
+		apcap->vhtcap.max_rx_nss = num_rx_streams;
+		if (ucfg_son_get_vht_cap(psoc, &vht_caps) == QDF_STATUS_SUCCESS)
+			apcap->vhtcap.vhtcap = vht_caps;
+	}
+
+	/* Fetch HE CAP */
+	ucfg_mlme_cfg_get_he_caps(psoc, &he_cap);
+	if (he_cap.present) {
+		apcap->wlan_ap_he_capabilities_valid = 1;
+		apcap->hecap.num_mcs_entries = MAP_MAX_HE_MCS;
+		apcap->hecap.max_tx_nss = num_tx_streams;
+		apcap->hecap.max_rx_nss = num_rx_streams;
+		apcap->hecap.he_su_ppdu_1x_ltf_800ns_gi =
+					he_cap.he_1x_ltf_800_gi_ppdu;
+		apcap->hecap.he_ndp_4x_ltf_3200ns_gi =
+					he_cap.he_4x_ltf_3200_gi_ndp;
+		apcap->hecap.he_su_bfer = he_cap.su_beamformer;
+		apcap->hecap.he_su_bfee = he_cap.su_beamformee;
+		apcap->hecap.he_mu_bfer = he_cap.mu_beamformer;
+	}
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS os_if_son_vdev_ops(struct wlan_objmgr_vdev *vdev,
 			      enum wlan_mlme_vdev_param type,
 			      void *data, void *ret)
@@ -929,6 +998,9 @@ QDF_STATUS os_if_son_vdev_ops(struct wlan_objmgr_vdev *vdev,
 		out->chan_util = os_if_son_get_chan_util(vdev);
 		break;
 	case VDEV_GET_APCAP:
+		if (!out)
+			return QDF_STATUS_E_INVAL;
+		return os_if_son_get_apcap(vdev, &out->apcap);
 		break;
 	case VDEV_GET_CONNECT_N_TX:
 		break;