Browse Source

qcacld-3.0: Add vendor cmd for ldpc/tx_stbc/rx_stbc

Add vendor cmd for ldpc/tx_stbc/rx_stbc.

Change-Id: Id932bc68f9282adc1f542ecc6212288b4ae59d38
CRs-Fixed: 2689414
Jingxiang Ge 4 years ago
parent
commit
3c19aa6dbb

+ 55 - 1
core/hdd/inc/wlan_hdd_cfg.h

@@ -329,4 +329,58 @@ bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx);
  * Return: None
  */
 void hdd_override_all_ps(struct hdd_context *hdd_ctx);
-#endif
+
+/**
+ * hdd_get_ldpc() - Get adapter LDPC
+ * @adapter: adapter being queried
+ * @value: where to store the value
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+int hdd_get_ldpc(struct hdd_adapter *adapter, int *value);
+
+/**
+ * hdd_set_ldpc() - Set adapter LDPC
+ * @adapter: adapter being modified
+ * @value: new LDPC value
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+int hdd_set_ldpc(struct hdd_adapter *adapter, int value);
+
+/**
+ * hdd_get_tx_stbc() - Get adapter TX STBC
+ * @adapter: adapter being queried
+ * @value: where to store the value
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value);
+
+/**
+ * hdd_set_tx_stbc() - Set adapter TX STBC
+ * @adapter: adapter being modified
+ * @value: new TX STBC value
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value);
+
+/**
+ * hdd_get_rx_stbc() - Get adapter RX STBC
+ * @adapter: adapter being queried
+ * @value: where to store the value
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value);
+
+/**
+ * hdd_set_rx_stbc() - Set adapter RX STBC
+ * @adapter: adapter being modified
+ * @value: new RX STBC value
+ *
+ * Return: 0 on success, negative errno on failure
+ */
+int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value);
+#endif /* end #if !defined(HDD_CONFIG_H__) */

+ 0 - 33
core/hdd/inc/wlan_hdd_wext.h

@@ -223,17 +223,6 @@ int hdd_priv_get_data(struct iw_point *p_priv_data,
 
 void *mem_alloc_copy_from_user_helper(const void *wrqu_data, size_t len);
 
-int hdd_get_ldpc(struct hdd_adapter *adapter, int *value);
-
-/**
- * hdd_set_ldpc() - Set adapter LDPC
- * @adapter: adapter being modified
- * @value: new LDPC value
- *
- * Return: 0 on success, negative errno on failure
- */
-int hdd_set_ldpc(struct hdd_adapter *adapter, int value);
-
 /**
  * hdd_we_set_short_gi() - Set adapter Short GI
  * @adapter: adapter being modified
@@ -243,28 +232,6 @@ int hdd_set_ldpc(struct hdd_adapter *adapter, int value);
  */
 int hdd_we_set_short_gi(struct hdd_adapter *adapter, int sgi);
 
-int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value);
-
-/**
- * hdd_set_tx_stbc() - Set adapter TX STBC
- * @adapter: adapter being modified
- * @value: new TX STBC value
- *
- * Return: 0 on success, negative errno on failure
- */
-int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value);
-
-int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value);
-
-/**
- * hdd_set_rx_stbc() - Set adapter RX STBC
- * @adapter: adapter being modified
- * @value: new RX STBC value
- *
- * Return: 0 on success, negative errno on failure
- */
-int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value);
-
 /**
  * hdd_assemble_rate_code() - assemble rate code to be sent to FW
  * @preamble: rate preamble

+ 180 - 0
core/hdd/src/wlan_hdd_cfg.c

@@ -1223,3 +1223,183 @@ skip_ht_cap_update:
 
 	return (status == false) ? QDF_STATUS_E_FAILURE : QDF_STATUS_SUCCESS;
 }
+
+int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
+{
+	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
+	int ret;
+
+	hdd_enter();
+	ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
+				WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
+	if (ret < 0) {
+		hdd_err("Failed to get LDPC value");
+	} else {
+		*value = ret;
+		ret = 0;
+	}
+	return ret;
+}
+
+int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
+{
+	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
+	int ret;
+	QDF_STATUS status;
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	struct mlme_ht_capabilities_info ht_cap_info;
+
+	hdd_debug("%d", value);
+
+	if (!mac_handle) {
+		hdd_err("NULL Mac handle");
+		return -EINVAL;
+	}
+
+	status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc, &ht_cap_info);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("Failed to get HT capability info");
+		return -EIO;
+	}
+
+	ht_cap_info.adv_coding_cap = value;
+	status = ucfg_mlme_set_ht_cap_info(hdd_ctx->psoc, ht_cap_info);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("Failed to set HT capability info");
+		return -EIO;
+	}
+	status = ucfg_mlme_cfg_set_vht_ldpc_coding_cap(hdd_ctx->psoc, value);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("Failed to set VHT LDPC capability info");
+		return -EIO;
+	}
+	ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
+				   WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
+				   value);
+	if (ret)
+		hdd_err("Failed to set LDPC value");
+	ret = sme_update_he_ldpc_supp(mac_handle, adapter->vdev_id, value);
+	if (ret)
+		hdd_err("Failed to set HE LDPC value");
+	ret = sme_set_auto_rate_ldpc(mac_handle, adapter->vdev_id,
+				     (value ? 0 : 1));
+
+	return ret;
+}
+
+int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
+{
+	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
+	int ret;
+
+	hdd_enter();
+	ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
+				WNI_CFG_HT_CAP_INFO_TX_STBC);
+	if (ret < 0) {
+		hdd_err("Failed to get TX STBC value");
+	} else {
+		*value = ret;
+		ret = 0;
+	}
+
+	return ret;
+}
+
+int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
+{
+	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	int ret;
+	QDF_STATUS status;
+	struct mlme_ht_capabilities_info ht_cap_info;
+
+	hdd_debug("%d", value);
+
+	if (!mac_handle) {
+		hdd_err("NULL Mac handle");
+		return -EINVAL;
+	}
+
+	if (value) {
+		/* make sure HT capabilities allow this */
+		status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
+						   &ht_cap_info);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			hdd_err("Failed to get HT capability info");
+			return -EIO;
+		}
+		if (!ht_cap_info.tx_stbc) {
+			hdd_err("TX STBC not supported");
+			return -EINVAL;
+		}
+	}
+	ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
+				   WNI_CFG_HT_CAP_INFO_TX_STBC,
+				   value);
+	if (ret)
+		hdd_err("Failed to set TX STBC value");
+	ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->vdev_id, value);
+	if (ret)
+		hdd_err("Failed to set HE TX STBC value");
+
+	return ret;
+}
+
+int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
+{
+	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
+	int ret;
+
+	hdd_enter();
+	ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
+				WNI_CFG_HT_CAP_INFO_RX_STBC);
+	if (ret < 0) {
+		hdd_err("Failed to get RX STBC value");
+	} else {
+		*value = ret;
+		ret = 0;
+	}
+
+	return ret;
+}
+
+int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
+{
+	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	int ret;
+	QDF_STATUS status;
+	struct mlme_ht_capabilities_info ht_cap_info;
+
+	hdd_debug("%d", value);
+
+	if (!mac_handle) {
+		hdd_err("NULL Mac handle");
+		return -EINVAL;
+	}
+
+	if (value) {
+		/* make sure HT capabilities allow this */
+		status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
+						   &ht_cap_info);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			hdd_err("Failed to get HT capability info");
+			return -EIO;
+		}
+		if (!ht_cap_info.rx_stbc) {
+			hdd_warn("RX STBC not supported");
+			return -EINVAL;
+		}
+	}
+	ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
+				   WNI_CFG_HT_CAP_INFO_RX_STBC,
+				   value);
+	if (ret)
+		hdd_err("Failed to set RX STBC value");
+
+	ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->vdev_id, value);
+	if (ret)
+		hdd_err("Failed to set HE RX STBC value");
+
+	return ret;
+}

+ 126 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -6710,6 +6710,9 @@ const struct nla_policy wlan_hdd_wifi_config_policy[
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_ROAM_REASON] = {.type = NLA_U8 },
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_TX_MSDU_AGGREGATION] = {.type = NLA_U8 },
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MSDU_AGGREGATION] = {.type = NLA_U8 },
+	[QCA_WLAN_VENDOR_ATTR_CONFIG_LDPC] = {.type = NLA_U8 },
+	[QCA_WLAN_VENDOR_ATTR_CONFIG_TX_STBC] = {.type = NLA_U8 },
+	[QCA_WLAN_VENDOR_ATTR_CONFIG_RX_STBC] = {.type = NLA_U8 },
 
 };
 
@@ -7097,6 +7100,45 @@ static int hdd_set_roam_reason_vsie_status(struct hdd_adapter *adapter,
 }
 #endif
 
+static int hdd_config_ldpc(struct hdd_adapter *adapter,
+			   const struct nlattr *attr)
+{
+	uint8_t ldpc;
+	int ret;
+
+	ldpc = nla_get_u8(attr);
+
+	ret = hdd_set_ldpc(adapter, ldpc);
+
+	return ret;
+}
+
+static int hdd_config_tx_stbc(struct hdd_adapter *adapter,
+			      const struct nlattr *attr)
+{
+	uint8_t tx_stbc;
+	int ret;
+
+	tx_stbc = nla_get_u8(attr);
+
+	ret = hdd_set_tx_stbc(adapter, tx_stbc);
+
+	return ret;
+}
+
+static int hdd_config_rx_stbc(struct hdd_adapter *adapter,
+			      const struct nlattr *attr)
+{
+	uint8_t rx_stbc;
+	int ret;
+
+	rx_stbc = nla_get_u8(attr);
+
+	ret = hdd_set_rx_stbc(adapter, rx_stbc);
+
+	return ret;
+}
+
 static int hdd_config_access_policy(struct hdd_adapter *adapter,
 				    struct nlattr *tb[])
 {
@@ -8097,6 +8139,12 @@ static const struct independent_setters independent_setters[] = {
 #endif
 	{QCA_WLAN_VENDOR_ATTR_CONFIG_ROAM_REASON,
 	 hdd_set_roam_reason_vsie_status},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_LDPC,
+	 hdd_config_ldpc},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_TX_STBC,
+	 hdd_config_tx_stbc},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_RX_STBC,
+	 hdd_config_rx_stbc},
 };
 
 #ifdef WLAN_FEATURE_ELNA
@@ -8171,6 +8219,75 @@ static int hdd_get_roam_reason_vsie_status(struct hdd_adapter *adapter,
 }
 #endif
 
+static int hdd_vendor_attr_ldpc_get(struct hdd_adapter *adapter,
+				    struct sk_buff *skb,
+				    const struct nlattr *attr)
+{
+	int ldpc;
+	int ret;
+
+	ret = hdd_get_ldpc(adapter, &ldpc);
+	if (ret) {
+		hdd_err("get ldpc failed");
+		return -EINVAL;
+	}
+
+	hdd_debug("ldpc %u", ldpc);
+	if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_CONFIG_LDPC,
+		       (uint8_t)ldpc)) {
+		hdd_err("nla_put failure");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int hdd_vendor_attr_tx_stbc_get(struct hdd_adapter *adapter,
+				       struct sk_buff *skb,
+				       const struct nlattr *attr)
+{
+	int tx_stbc;
+	int ret;
+
+	ret = hdd_get_tx_stbc(adapter, &tx_stbc);
+	if (ret) {
+		hdd_err("get tx_stbc failed");
+		return -EINVAL;
+	}
+
+	hdd_debug("tx_stbc %u", tx_stbc);
+	if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_CONFIG_TX_STBC,
+		       (uint8_t)tx_stbc)) {
+		hdd_err("nla_put failure");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int hdd_vendor_attr_rx_stbc_get(struct hdd_adapter *adapter,
+				       struct sk_buff *skb,
+				       const struct nlattr *attr)
+{
+	int rx_stbc;
+	int ret;
+
+	ret = hdd_get_rx_stbc(adapter, &rx_stbc);
+	if (ret) {
+		hdd_err("get rx_stbc failed");
+		return -EINVAL;
+	}
+
+	hdd_debug("rx_stbc %u", rx_stbc);
+	if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_CONFIG_RX_STBC,
+		       (uint8_t)rx_stbc)) {
+		hdd_err("nla_put failure");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 /**
  * hdd_get_tx_ampdu() - Get TX AMPDU
  * @adapter: Pointer to HDD adapter
@@ -8338,6 +8455,15 @@ static const struct config_getters config_getters[] = {
 	{QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MSDU_AGGREGATION,
 	 sizeof(uint8_t),
 	 hdd_get_rx_amsdu},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_LDPC,
+	 sizeof(uint8_t),
+	 hdd_vendor_attr_ldpc_get},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_TX_STBC,
+	 sizeof(uint8_t),
+	 hdd_vendor_attr_tx_stbc_get},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_RX_STBC,
+	 sizeof(uint8_t),
+	 hdd_vendor_attr_rx_stbc_get},
 };
 
 /**

+ 0 - 201
core/hdd/src/wlan_hdd_wext.c

@@ -3182,207 +3182,6 @@ static int hdd_we_dump_stats(struct hdd_adapter *adapter, int value)
 	return hdd_wlan_dump_stats(adapter, value);
 }
 
-/**
- * hdd_get_ldpc() - Get adapter LDPC
- * @adapter: adapter being queried
- * @value: where to store the value
- *
- * Return: 0 on success, negative errno on failure
- */
-int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
-{
-	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
-	int ret;
-
-	hdd_enter();
-	ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
-				WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
-	if (ret < 0) {
-		hdd_err("Failed to get LDPC value");
-	} else {
-		*value = ret;
-		ret = 0;
-	}
-	return ret;
-}
-
-int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
-{
-	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
-	int ret;
-	QDF_STATUS status;
-	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-	struct mlme_ht_capabilities_info ht_cap_info;
-
-	hdd_debug("%d", value);
-
-	if (!mac_handle) {
-		hdd_err("NULL Mac handle");
-		return -EINVAL;
-	}
-
-	status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc, &ht_cap_info);
-	if (QDF_STATUS_SUCCESS != status) {
-		hdd_err("Failed to get HT capability info");
-		return -EIO;
-	}
-
-	ht_cap_info.adv_coding_cap = value;
-	status = ucfg_mlme_set_ht_cap_info(hdd_ctx->psoc, ht_cap_info);
-	if (QDF_STATUS_SUCCESS != status) {
-		hdd_err("Failed to set HT capability info");
-		return -EIO;
-	}
-	status = ucfg_mlme_cfg_set_vht_ldpc_coding_cap(hdd_ctx->psoc, value);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		hdd_err("Failed to set VHT LDPC capability info");
-		return -EIO;
-	}
-	ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
-				   WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
-				   value);
-	if (ret)
-		hdd_err("Failed to set LDPC value");
-	ret = sme_update_he_ldpc_supp(mac_handle, adapter->vdev_id, value);
-	if (ret)
-		hdd_err("Failed to set HE LDPC value");
-	ret = sme_set_auto_rate_ldpc(mac_handle, adapter->vdev_id,
-				     (value ? 0 : 1));
-
-	return ret;
-}
-
-/**
- * hdd_get_tx_stbc() - Get adapter TX STBC
- * @adapter: adapter being queried
- * @value: where to store the value
- *
- * Return: 0 on success, negative errno on failure
- */
-int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
-{
-	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
-	int ret;
-
-	hdd_enter();
-	ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
-				WNI_CFG_HT_CAP_INFO_TX_STBC);
-	if (ret < 0) {
-		hdd_err("Failed to get TX STBC value");
-	} else {
-		*value = ret;
-		ret = 0;
-	}
-
-	return ret;
-}
-
-int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
-{
-	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
-	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-	int ret;
-	QDF_STATUS status;
-	struct mlme_ht_capabilities_info ht_cap_info;
-
-	hdd_debug("%d", value);
-
-	if (!mac_handle) {
-		hdd_err("NULL Mac handle");
-		return -EINVAL;
-	}
-
-	if (value) {
-		/* make sure HT capabilities allow this */
-		status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
-						   &ht_cap_info);
-		if (QDF_STATUS_SUCCESS != status) {
-			hdd_err("Failed to get HT capability info");
-			return -EIO;
-		}
-		if (!ht_cap_info.tx_stbc) {
-			hdd_err("TX STBC not supported");
-			return -EINVAL;
-		}
-	}
-	ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
-				   WNI_CFG_HT_CAP_INFO_TX_STBC,
-				   value);
-	if (ret)
-		hdd_err("Failed to set TX STBC value");
-	ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->vdev_id, value);
-	if (ret)
-		hdd_err("Failed to set HE TX STBC value");
-
-	return ret;
-}
-
-/**
- * hdd_get_rx_stbc() - Get adapter RX STBC
- * @adapter: adapter being queried
- * @value: where to store the value
- *
- * Return: 0 on success, negative errno on failure
- */
-int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
-{
-	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
-	int ret;
-
-	hdd_enter();
-	ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
-				WNI_CFG_HT_CAP_INFO_RX_STBC);
-	if (ret < 0) {
-		hdd_err("Failed to get RX STBC value");
-	} else {
-		*value = ret;
-		ret = 0;
-	}
-
-	return ret;
-}
-
-int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
-{
-	mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
-	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-	int ret;
-	QDF_STATUS status;
-	struct mlme_ht_capabilities_info ht_cap_info;
-
-	hdd_debug("%d", value);
-
-	if (!mac_handle) {
-		hdd_err("NULL Mac handle");
-		return -EINVAL;
-	}
-
-	if (value) {
-		/* make sure HT capabilities allow this */
-		status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
-						   &ht_cap_info);
-		if (QDF_STATUS_SUCCESS != status) {
-			hdd_err("Failed to get HT capability info");
-			return -EIO;
-		}
-		if (!ht_cap_info.rx_stbc) {
-			hdd_warn("RX STBC not supported");
-			return -EINVAL;
-		}
-	}
-	ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
-				   WNI_CFG_HT_CAP_INFO_RX_STBC,
-				   value);
-	if (ret)
-		hdd_err("Failed to set RX STBC value");
-
-	ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->vdev_id, value);
-	if (ret)
-		hdd_err("Failed to set HE RX STBC value");
-
-	return ret;
-}
-
 /**
  * iw_get_linkspeed() - Get current link speed ioctl
  * @dev: device upon which the ioctl was received