Эх сурвалжийг харах

qcacld-3.0: Convert ap policy config vendor cmd to host enum

Userspace provide below vendor attribute for low latency sap
concurrency
a. QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_AP_CONFIG

This userspace uses the below value defined in enum
qca_wlan_concurrent_ap_policy_config to specify concurrency
policy
a. QCA_WLAN_CONCURRENT_AP_POLICY_UNSPECIFIED = 0,
b. QCA_WLAN_CONCURRENT_AP_POLICY_GAMING_AUDIO = 1,
c. QCA_WLAN_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING = 2,

Convert this above enum value in host to use in concurrency
scenario.

Change-Id: Ibab06f528fd99d8c421376bd02e4c748e9556b70
CRs-Fixed: 3302418
Jyoti Kumari 2 жил өмнө
parent
commit
f0ddb3ec45

+ 2 - 0
components/mlme/core/inc/wlan_mlme_main.h

@@ -410,12 +410,14 @@ struct wait_for_key_timer {
  * @user_config_sap_ch_freq : Frequency from userspace to start SAP
  * @update_required_scc_sta_power: Change the 6 GHz power type of the
  * concurrent STA
+ * @ap_policy: Concurrent ap policy config
  */
 struct mlme_ap_config {
 	qdf_freq_t user_config_sap_ch_freq;
 #ifdef CONFIG_BAND_6GHZ
 	bool update_required_scc_sta_power;
 #endif
+	enum host_concurrent_ap_policy ap_policy;
 };
 
 /**

+ 31 - 0
components/mlme/dispatcher/inc/wlan_mlme_api.h

@@ -338,6 +338,37 @@ QDF_STATUS wlan_mlme_set_dual_sta_policy(struct wlan_objmgr_psoc *psoc,
 QDF_STATUS wlan_mlme_get_dual_sta_policy(struct wlan_objmgr_psoc *psoc,
 					 uint8_t *dual_sta_config);
 
+/**
+ * wlan_mlme_convert_ap_policy_config() - Convert vendor attr ap policy
+ * config to host enum
+ * @ap_config: Value to convert
+ *
+ * Return: enum host_concurrent_ap_policy
+ */
+enum host_concurrent_ap_policy
+wlan_mlme_convert_ap_policy_config(
+		enum qca_wlan_concurrent_ap_policy_config ap_config);
+
+/**
+ * wlan_mlme_set_ap_policy() - Set ap config policy value
+ * @vdev: pointer to vdev object
+ * @ap_cfg_policy: Value to be set from the caller
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+wlan_mlme_set_ap_policy(struct wlan_objmgr_vdev *vdev,
+			enum host_concurrent_ap_policy ap_cfg_policy);
+
+/**
+ * wlan_mlme_get_ap_policy() - Get ap config policy value
+ * @vdev: pointer to vdev object
+ *
+ * Return: enum host_concurrent_ap_policy
+ */
+enum host_concurrent_ap_policy
+wlan_mlme_get_ap_policy(struct wlan_objmgr_vdev *vdev);
+
 /**
  * wlan_mlme_get_prevent_link_down() - Get the prevent link down config
  * @psoc: pointer to psoc object

+ 13 - 0
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -2809,4 +2809,17 @@ struct wlan_mlme_features {
 	bool enable2x2;
 };
 #endif
+
+/**
+ * host_concurrent_ap_policy - Host concurrent AP policy value
+ * @HOST_CONCURRENT_AP_POLICY_UNSPECIFIED: Unspecified concurrent policy value
+ * @HOST_CONCURRENT_AP_POLICY_GAMING_AUDIO: Gaming audio concurrent policy value
+ * @HOST_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING: Lossless audio
+ * concurrent streaming policy value
+ */
+enum host_concurrent_ap_policy {
+	HOST_CONCURRENT_AP_POLICY_UNSPECIFIED = 0,
+	HOST_CONCURRENT_AP_POLICY_GAMING_AUDIO = 1,
+	HOST_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING = 2
+};
 #endif

+ 14 - 0
components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h

@@ -338,6 +338,20 @@ QDF_STATUS ucfg_mlme_get_dual_sta_policy(struct wlan_objmgr_psoc *psoc,
 	return wlan_mlme_get_dual_sta_policy(psoc, dual_sta_config);
 }
 
+/**
+ * ucfg_mlme_set_ap_policy() - Configures the AP policy value
+ * @vdev: pointer to vdev object
+ * @ap_cfg_policy: AP policy configuration value
+ *
+ * Return: QDF Status
+ */
+static inline
+QDF_STATUS ucfg_mlme_set_ap_policy(struct wlan_objmgr_vdev *vdev,
+				   enum host_concurrent_ap_policy ap_cfg_policy)
+{
+	return wlan_mlme_set_ap_policy(vdev, ap_cfg_policy);
+}
+
 /**
  * ucfg_mlme_get_prevent_link_down() - Get the prevent link down config
  * @psoc: pointer to psoc object

+ 50 - 0
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -286,6 +286,56 @@ QDF_STATUS wlan_mlme_get_dual_sta_policy(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+enum host_concurrent_ap_policy
+wlan_mlme_convert_ap_policy_config(
+		enum qca_wlan_concurrent_ap_policy_config ap_config)
+{
+	switch (ap_config) {
+	case QCA_WLAN_CONCURRENT_AP_POLICY_UNSPECIFIED:
+		return HOST_CONCURRENT_AP_POLICY_UNSPECIFIED;
+	case QCA_WLAN_CONCURRENT_AP_POLICY_GAMING_AUDIO:
+		return HOST_CONCURRENT_AP_POLICY_GAMING_AUDIO;
+	case QCA_WLAN_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING:
+		return HOST_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING;
+	default:
+		return HOST_CONCURRENT_AP_POLICY_UNSPECIFIED;
+	}
+}
+
+QDF_STATUS wlan_mlme_set_ap_policy(struct wlan_objmgr_vdev *vdev,
+				   enum host_concurrent_ap_policy ap_cfg_policy)
+
+{
+	struct mlme_legacy_priv *mlme_priv;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	mlme_priv->mlme_ap.ap_policy = ap_cfg_policy;
+	mlme_debug("Set ap_cfg_policy to :%d", mlme_priv->mlme_ap.ap_policy);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+enum host_concurrent_ap_policy
+wlan_mlme_get_ap_policy(struct wlan_objmgr_vdev *vdev)
+{
+	struct mlme_legacy_priv *mlme_priv;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
+		return HOST_CONCURRENT_AP_POLICY_UNSPECIFIED;
+	}
+
+	mlme_debug("Get ap_cfg_policy to :%d", mlme_priv->mlme_ap.ap_policy);
+
+	return mlme_priv->mlme_ap.ap_policy;
+}
+
 QDF_STATUS wlan_mlme_get_prevent_link_down(struct wlan_objmgr_psoc *psoc,
 					   bool *prevent_link_down)
 {

+ 122 - 48
core/hdd/src/wlan_hdd_cfg80211.c

@@ -14106,59 +14106,31 @@ wlan_hdd_cfg80211_sta_roam_policy(struct wiphy *wiphy,
 }
 
 const struct nla_policy
-wlan_hdd_set_dual_sta_policy[
-QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_MAX + 1] = {
-	[QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_CONFIG] = {.type = NLA_U8 },
+wlan_hdd_set_concurrent_session_policy[
+QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_MAX + 1] = {
+	[QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_STA_CONFIG] = {.type = NLA_U8 },
+	[QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_AP_CONFIG] = {.type = NLA_U8 },
 };
 
 /**
  * __wlan_hdd_cfg80211_dual_sta_policy() - Wrapper to configure the concurrent
  * session policies
- * @wiphy:    wiphy structure pointer
- * @wdev:     Wireless device structure pointer
- * @data:     Pointer to the data received
- * @data_len: Length of @data
+ * @hdd_ctx: Pointer to HDD context
+ * @tb: parsed attribute array
  *
  * Configure the concurrent session policies when multiple STA ifaces are
  * (getting) active.
  * Return: 0 on success; errno on failure
  */
-static int __wlan_hdd_cfg80211_dual_sta_policy(struct wiphy *wiphy,
-					       struct wireless_dev *wdev,
-					       const void *data, int data_len)
+static int __wlan_hdd_cfg80211_dual_sta_policy(struct hdd_context *hdd_ctx,
+					       struct nlattr **tb)
 {
-	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
-	struct nlattr *tb[
-		QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_MAX + 1];
 	QDF_STATUS status;
 	uint8_t dual_sta_config =
 		QCA_WLAN_CONCURRENT_STA_POLICY_UNBIASED;
 
-	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
-		hdd_err("Command not allowed in FTM mode");
-		return -EPERM;
-	}
-
-	if (wlan_hdd_validate_context(hdd_ctx)) {
-		hdd_err("Invalid hdd context");
-		return -EINVAL;
-	}
-
-	if (wlan_cfg80211_nla_parse(tb,
-			       QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_MAX,
-			       data, data_len,
-			       wlan_hdd_set_dual_sta_policy)) {
-		hdd_err("nla_parse failed");
-		return -EINVAL;
-	}
-
-	if (!tb[QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_CONFIG]) {
-		hdd_err("sta policy config attribute not present");
-		return -EINVAL;
-	}
-
 	dual_sta_config = nla_get_u8(
-			tb[QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_CONFIG]);
+			tb[QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_STA_CONFIG]);
 	hdd_debug("Concurrent STA policy : %d", dual_sta_config);
 
 	if (dual_sta_config > QCA_WLAN_CONCURRENT_STA_POLICY_UNBIASED)
@@ -14181,8 +14153,105 @@ static int __wlan_hdd_cfg80211_dual_sta_policy(struct wiphy *wiphy,
 }
 
 /**
- * wlan_hdd_cfg80211_dual_sta_policy() - Wrapper to configure the concurrent
+ * __wlan_hdd_cfg80211_ap_policy() - Wrapper to configure the concurrent
  * session policies
+ * @vdev: pointer to vdev
+ * @tb: parsed attribute array
+ *
+ * Configure the concurrent session policies when multiple STA ifaces are
+ * (getting) active.
+ * Return: 0 on success; errno on failure
+ */
+static int __wlan_hdd_cfg80211_ap_policy(struct wlan_objmgr_vdev *vdev,
+					 struct nlattr **tb)
+{
+	QDF_STATUS status;
+	uint8_t ap_cfg_policy;
+	uint8_t ap_config =
+			QCA_WLAN_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING;
+
+	ap_config = nla_get_u8(
+		tb[QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_AP_CONFIG]);
+	hdd_debug("AP policy : %d", ap_config);
+
+	if (ap_config > QCA_WLAN_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING) {
+		hdd_err_rl("Invalid concurrent policy ap config %d", ap_config);
+		return -EINVAL;
+	}
+
+	ap_cfg_policy = wlan_mlme_convert_ap_policy_config(ap_config);
+	status = ucfg_mlme_set_ap_policy(vdev, ap_cfg_policy);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("failed to set MLME ap config");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+/**
+ * __wlan_hdd_cfg80211_concurrent_session_policy() - Wrapper to configure the
+ * concurrent session policies
+ * @wiphy:    wiphy structure pointer
+ * @wdev:     Wireless device structure pointer
+ * @data:     Pointer to the data received
+ * @data_len: Length of @data
+ *
+ * Configure the concurrent session policies when low latency SAP or multiple
+ * STA ifaces are (getting) active.
+ * Return: 0 on success; errno on failure
+ */
+static int __wlan_hdd_cfg80211_concurrent_session_policy(
+						struct wiphy *wiphy,
+						struct wireless_dev *wdev,
+						const void *data, int data_len)
+{
+	struct net_device *ndev = wdev->netdev;
+	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(ndev);
+	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_MAX + 1];
+
+	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
+		hdd_err_rl("Command not allowed in FTM mode");
+		return -EPERM;
+	}
+
+	if (hdd_validate_adapter(adapter)) {
+		hdd_err_rl("Invalid adapter");
+		return -EINVAL;
+	}
+
+	if (wlan_hdd_validate_context(adapter->hdd_ctx)) {
+		hdd_err_rl("Invalid hdd context");
+		return -EINVAL;
+	}
+
+	if (wlan_cfg80211_nla_parse(
+				tb,
+				QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_MAX,
+				data, data_len,
+				wlan_hdd_set_concurrent_session_policy)) {
+		hdd_err_rl("nla_parse failed");
+		return -EINVAL;
+	}
+
+	if (!tb[QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_STA_CONFIG] &&
+	    !tb[QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_AP_CONFIG]) {
+		hdd_err_rl("concurrent session policy attr not present");
+		return -EINVAL;
+	}
+
+	if (tb[QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_STA_CONFIG])
+		__wlan_hdd_cfg80211_dual_sta_policy(adapter->hdd_ctx, tb);
+
+	if (tb[QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_AP_CONFIG])
+		__wlan_hdd_cfg80211_ap_policy(adapter->vdev, tb);
+
+	return 0;
+}
+
+/**
+ * wlan_hdd_cfg80211_concurrent_session_policy() -  Wrapper to configure the
+ * concurrent session policies
  * @wiphy:    wiphy structure pointer
  * @wdev:     Wireless device structure pointer
  * @data:     Pointer to the data received
@@ -14192,9 +14261,11 @@ static int __wlan_hdd_cfg80211_dual_sta_policy(struct wiphy *wiphy,
  * (getting) active.
  * Return: 0 on success; errno on failure
  */
-static int wlan_hdd_cfg80211_dual_sta_policy(struct wiphy *wiphy,
-					     struct wireless_dev *wdev,
-					     const void *data, int data_len)
+static int wlan_hdd_cfg80211_concurrent_session_policy(
+						struct wiphy *wiphy,
+						struct wireless_dev *wdev,
+						const void *data,
+						int data_len)
 {
 	int errno;
 	struct osif_vdev_sync *vdev_sync;
@@ -14203,8 +14274,10 @@ static int wlan_hdd_cfg80211_dual_sta_policy(struct wiphy *wiphy,
 	if (errno)
 		return errno;
 
-	errno = __wlan_hdd_cfg80211_dual_sta_policy(wiphy, wdev, data,
-						    data_len);
+	errno = __wlan_hdd_cfg80211_concurrent_session_policy(
+						wiphy, wdev, data,
+						data_len);
+
 
 	osif_vdev_sync_op_stop(vdev_sync);
 
@@ -17997,13 +18070,14 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
 		.info.subcmd =
-			QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_MULTI_STA_POLICY,
+			QCA_NL80211_VENDOR_SUBCMD_CONCURRENT_POLICY,
 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
-			WIPHY_VENDOR_CMD_NEED_NETDEV,
-		.doit = wlan_hdd_cfg80211_dual_sta_policy,
+			WIPHY_VENDOR_CMD_NEED_NETDEV |
+			WIPHY_VENDOR_CMD_NEED_RUNNING,
+		.doit = wlan_hdd_cfg80211_concurrent_session_policy,
 		vendor_command_policy(
-			wlan_hdd_set_dual_sta_policy,
-			QCA_WLAN_VENDOR_ATTR_CONCURRENT_STA_POLICY_MAX)
+			wlan_hdd_set_concurrent_session_policy,
+			QCA_WLAN_VENDOR_ATTR_CONCURRENT_POLICY_MAX)
 	},
 
 #ifdef FEATURE_WLAN_CH_AVOID