Pārlūkot izejas kodu

qcacld-3.0: Set Tx/Rx aggregation size

qcacld-2.0 to qcacld-3.0 propagation

Add changes to set Tx/Rx aggregation size. Also, add ini parameters
for Tx/Rx aggregation sizes.

Change-Id: Ia5811bf7cf7081989fde5c8cdcca84b42120b90c
CRs-Fixed: 990161
Padma, Santhosh Kumar 8 gadi atpakaļ
vecāks
revīzija
a71196710c

+ 20 - 0
core/hdd/inc/wlan_hdd_cfg.h

@@ -2822,6 +2822,24 @@ typedef enum {
 #define CFG_SELF_GEN_FRM_PWR_MAX      (0xffff)
 #define CFG_SELF_GEN_FRM_PWR_DEFAULT  (0)
 
+/*
+ * gTxAggregationSize gives an option to configure Tx aggregation size
+ * in no of MPDUs. This can be useful in debugging throughput issues
+ */
+#define CFG_TX_AGGREGATION_SIZE      "gTxAggregationSize"
+#define CFG_TX_AGGREGATION_SIZE_MIN      (0)
+#define CFG_TX_AGGREGATION_SIZE_MAX      (64)
+#define CFG_TX_AGGREGATION_SIZE_DEFAULT  (64)
+
+/*
+ * gRxAggregationSize gives an option to configure Rx aggregation size
+ * in no of MPDUs. This can be useful in debugging throughput issues
+ */
+#define CFG_RX_AGGREGATION_SIZE      "gRxAggregationSize"
+#define CFG_RX_AGGREGATION_SIZE_MIN      (1)
+#define CFG_RX_AGGREGATION_SIZE_MAX      (64)
+#define CFG_RX_AGGREGATION_SIZE_DEFAULT  (64)
+
 /*
  * fine timing measurement capability information
  *
@@ -4163,6 +4181,8 @@ struct hdd_config {
 	uint8_t sifs_burst_duration;
 	bool goptimize_chan_avoid_event;
 	bool enable_go_cts2self_for_sta;
+	uint32_t tx_aggregation_size;
+	uint32_t rx_aggregation_size;
 };
 
 #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var))

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

@@ -3985,6 +3985,20 @@ REG_TABLE_ENTRY g_registry_table[] = {
 			CFG_OPTIMIZE_CA_EVENT_DEFAULT,
 			CFG_OPTIMIZE_CA_EVENT_DISABLE,
 			CFG_OPTIMIZE_CA_EVENT_ENABLE),
+
+	REG_VARIABLE(CFG_TX_AGGREGATION_SIZE, WLAN_PARAM_Integer,
+		struct hdd_config, tx_aggregation_size,
+		VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		CFG_TX_AGGREGATION_SIZE_DEFAULT,
+		CFG_TX_AGGREGATION_SIZE_MIN,
+		CFG_TX_AGGREGATION_SIZE_MAX),
+
+	REG_VARIABLE(CFG_RX_AGGREGATION_SIZE, WLAN_PARAM_Integer,
+		struct hdd_config, rx_aggregation_size,
+		VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		CFG_RX_AGGREGATION_SIZE_DEFAULT,
+		CFG_RX_AGGREGATION_SIZE_MIN,
+		CFG_RX_AGGREGATION_SIZE_MAX),
 };
 
 /**
@@ -7154,6 +7168,11 @@ QDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx)
 		CSR_STA_ROAM_POLICY_DFS_ENABLED;
 	smeConfig->csrConfig.sta_roam_policy_params.skip_unsafe_channels = 0;
 
+	smeConfig->csrConfig.tx_aggregation_size =
+			pHddCtx->config->tx_aggregation_size;
+	smeConfig->csrConfig.rx_aggregation_size =
+			pHddCtx->config->rx_aggregation_size;
+
 	status = sme_update_config(pHddCtx->hHal, smeConfig);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
 		hddLog(LOGE, "sme_update_config() return failure %d",

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

@@ -3870,6 +3870,8 @@ wlan_hdd_wifi_config_policy[QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR] = {.type = NLA_U16 },
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME] = {.type = NLA_U32 },
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND] = {.type = NLA_U8 },
+	[QCA_WLAN_VENDOR_ATTR_CONFIG_TX_MPDU_AGGREGATION] = {.type = NLA_U8 },
+	[QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MPDU_AGGREGATION] = {.type = NLA_U8 },
 };
 
 /**
@@ -3938,6 +3940,8 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 	bool vendor_ie_present = false, access_policy_present = false;
 	uint16_t scan_ie_len = 0;
 	uint8_t *scan_ie;
+	struct sir_set_tx_rx_aggregation_size request;
+	QDF_STATUS qdf_status;
 
 	ENTER_DEV(dev);
 
@@ -4096,6 +4100,44 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 		} else
 			ret_val = -EPERM;
 	}
+
+	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_TX_MPDU_AGGREGATION] ||
+	    tb[QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MPDU_AGGREGATION]) {
+		/* if one is specified, both must be specified */
+		if (!tb[QCA_WLAN_VENDOR_ATTR_CONFIG_TX_MPDU_AGGREGATION] ||
+		    !tb[QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MPDU_AGGREGATION]) {
+			hdd_err("Both TX and RX MPDU Aggregation required");
+			return -EINVAL;
+		}
+
+		request.tx_aggregation_size = nla_get_u8(
+			tb[QCA_WLAN_VENDOR_ATTR_CONFIG_TX_MPDU_AGGREGATION]);
+		request.rx_aggregation_size = nla_get_u8(
+			tb[QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MPDU_AGGREGATION]);
+		request.vdev_id = adapter->sessionId;
+
+		if (request.tx_aggregation_size >=
+					CFG_TX_AGGREGATION_SIZE_MIN &&
+			request.tx_aggregation_size <=
+					CFG_TX_AGGREGATION_SIZE_MAX &&
+			request.rx_aggregation_size >=
+					CFG_RX_AGGREGATION_SIZE_MIN &&
+			request.rx_aggregation_size <=
+					CFG_RX_AGGREGATION_SIZE_MAX) {
+			qdf_status = wma_set_tx_rx_aggregation_size(&request);
+			if (qdf_status != QDF_STATUS_SUCCESS) {
+				hdd_err("failed to set aggr sizes err %d",
+					qdf_status);
+				ret_val = -EPERM;
+			}
+		} else {
+			hdd_err("TX %d RX %d MPDU aggr size not in range",
+				request.tx_aggregation_size,
+				request.rx_aggregation_size);
+			ret_val = -EINVAL;
+		}
+	}
+
 	return ret_val;
 }
 

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

@@ -2319,6 +2319,10 @@ enum qca_access_policy {
  * @QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR: stats avg. factor
  * @QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME: guard time
  * @QCA_WLAN_VENDOR_ATTR_CONFIG_FINE_TIME_MEASUREMENT: fine time measurement
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_TX_MPDU_AGGREGATION:
+ *      Tx aggregation size (8-bit unsigned value)
+ * @QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MPDU_AGGREGATION:
+ *       Rx aggregation size (8-bit unsigned value)
  * @QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES: Update the default scan IEs
  * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_COMMAND:
  *                         Unsigned 32-bit value attribute for generic commands
@@ -2349,6 +2353,10 @@ enum qca_wlan_vendor_config {
 	QCA_WLAN_VENDOR_ATTR_CONFIG_FINE_TIME_MEASUREMENT,
 	QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS,
 	QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND,
+
+	QCA_WLAN_VENDOR_ATTR_CONFIG_TX_MPDU_AGGREGATION,
+	QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MPDU_AGGREGATION,
+
 	/* Attribute used to set scan default IEs to the driver.
 	*
 	* These IEs can be used by scan operations that will be initiated by

+ 12 - 0
core/mac/inc/sir_api.h

@@ -6450,6 +6450,18 @@ struct sme_ndp_peer_ind {
 
 #endif /* WLAN_FEATURE_NAN_DATAPATH */
 
+/**
+ * struct sir_set_tx_rx_aggregation_size - sets tx rx aggregation size
+ * @vdev_id: vdev id of the session
+ * @tx_aggregation_size: Tx aggregation size
+ * @rx_aggregation_size: Rx aggregation size
+ */
+struct sir_set_tx_rx_aggregation_size {
+	uint8_t vdev_id;
+	uint32_t tx_aggregation_size;
+	uint32_t rx_aggregation_size;
+};
+
 /**
  * struct sir_p2p_lo_start - p2p listen offload start
  * @vdev_id: vdev identifier

+ 4 - 0
core/mac/src/pe/lim/lim_process_mlm_req_messages.c

@@ -595,6 +595,10 @@ lim_mlm_add_bss(tpAniSirGlobal mac_ctx,
 	if (QDF_IBSS_MODE == addbss_param->halPersona) {
 		addbss_param->nss_2g = mac_ctx->vdev_type_nss_2g.ibss;
 		addbss_param->nss_5g = mac_ctx->vdev_type_nss_5g.ibss;
+		addbss_param->tx_aggregation_size =
+			mac_ctx->roam.configParam.tx_aggregation_size;
+		addbss_param->rx_aggregation_size =
+			mac_ctx->roam.configParam.rx_aggregation_size;
 	}
 	lim_log(mac_ctx, LOG2, FL("dot11_mode:%d nss value:%d"),
 			addbss_param->dot11_mode, addbss_param->nss);

+ 2 - 0
core/sme/inc/csr_api.h

@@ -1305,6 +1305,8 @@ typedef struct tagCsrConfigParam {
 	enum wmi_dwelltime_adaptive_mode scan_adaptive_dwell_mode;
 	enum wmi_dwelltime_adaptive_mode roamscan_adaptive_dwell_mode;
 	struct csr_sta_roam_policy_params sta_roam_policy_params;
+	uint32_t tx_aggregation_size;
+	uint32_t rx_aggregation_size;
 } tCsrConfigParam;
 
 /* Tush */

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

@@ -666,6 +666,8 @@ typedef struct tagCsrConfig {
 	enum wmi_dwelltime_adaptive_mode scan_adaptive_dwell_mode;
 	enum wmi_dwelltime_adaptive_mode roamscan_adaptive_dwell_mode;
 	struct csr_sta_roam_policy_params sta_roam_policy;
+	uint32_t tx_aggregation_size;
+	uint32_t rx_aggregation_size;
 } tCsrConfig;
 
 typedef struct tagCsrChannelPowerInfo {

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

@@ -2518,6 +2518,11 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac,
 		pMac->roam.configParam.sta_roam_policy.skip_unsafe_channels =
 			pParam->sta_roam_policy_params.skip_unsafe_channels;
 
+		pMac->roam.configParam.tx_aggregation_size =
+			pParam->tx_aggregation_size;
+		pMac->roam.configParam.rx_aggregation_size =
+			pParam->rx_aggregation_size;
+
 	}
 	return status;
 }
@@ -2726,6 +2731,10 @@ QDF_STATUS csr_get_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam)
 		pMac->roam.configParam.sta_roam_policy.dfs_mode;
 	pParam->sta_roam_policy_params.skip_unsafe_channels =
 		pMac->roam.configParam.sta_roam_policy.skip_unsafe_channels;
+	pParam->tx_aggregation_size =
+		pMac->roam.configParam.tx_aggregation_size;
+	pParam->rx_aggregation_size =
+		pMac->roam.configParam.rx_aggregation_size;
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -15300,6 +15309,10 @@ QDF_STATUS csr_process_add_sta_session_command(tpAniSirGlobal pMac,
 	add_sta_self_req->sub_type = pAddStaReq->subType;
 	add_sta_self_req->nss_2g = nss_2g;
 	add_sta_self_req->nss_5g = nss_5g;
+	add_sta_self_req->tx_aggregation_size =
+			pMac->roam.configParam.tx_aggregation_size;
+	add_sta_self_req->rx_aggregation_size =
+			pMac->roam.configParam.rx_aggregation_size;
 
 	msg.type = WMA_ADD_STA_SELF_REQ;
 	msg.reserved = 0;

+ 2 - 0
core/wma/inc/wma_api.h

@@ -314,4 +314,6 @@ QDF_STATUS wma_encrypt_decrypt_msg(WMA_HANDLE wma,
  */
 QDF_STATUS wma_set_cts2self_for_p2p_go(void *wma_handle,
 		uint32_t cts2self_for_p2p_go);
+QDF_STATUS wma_set_tx_rx_aggregation_size
+	(struct sir_set_tx_rx_aggregation_size *tx_rx_aggregation_size);
 #endif

+ 4 - 0
core/wma/inc/wma_if.h

@@ -514,6 +514,8 @@ typedef struct {
 	uint8_t nss_2g;
 	uint8_t nss_5g;
 	uint8_t beacon_tx_rate;
+	uint32_t tx_aggregation_size;
+	uint32_t rx_aggregation_size;
 } tAddBssParams, *tpAddBssParams;
 
 /**
@@ -1151,6 +1153,8 @@ struct add_sta_self_params {
 	uint8_t nss_2g;
 	uint8_t nss_5g;
 	uint32_t status;
+	uint32_t tx_aggregation_size;
+	uint32_t rx_aggregation_size;
 };
 
 /**

+ 12 - 0
core/wma/src/wma_dev_if.c

@@ -1530,6 +1530,7 @@ ol_txrx_vdev_handle wma_vdev_attach(tp_wma_handle wma_handle,
 	cds_msg_t sme_msg = { 0 };
 	struct vdev_create_params params = { 0 };
 	u_int8_t vdev_id;
+	struct sir_set_tx_rx_aggregation_size tx_rx_aggregation_size;
 
 	if (NULL == mac) {
 		WMA_LOGE("%s: Failed to get mac", __func__);
@@ -1609,6 +1610,17 @@ ol_txrx_vdev_handle wma_vdev_attach(tp_wma_handle wma_handle,
 		     self_sta_req->self_mac_addr,
 		     sizeof(wma_handle->interfaces[self_sta_req->session_id].
 			    addr));
+
+	tx_rx_aggregation_size.tx_aggregation_size =
+				self_sta_req->tx_aggregation_size;
+	tx_rx_aggregation_size.rx_aggregation_size =
+				self_sta_req->rx_aggregation_size;
+	tx_rx_aggregation_size.vdev_id = self_sta_req->session_id;
+
+	status = wma_set_tx_rx_aggregation_size(&tx_rx_aggregation_size);
+	if (status != QDF_STATUS_SUCCESS)
+		WMA_LOGE("failed to set aggregation sizes(err=%d)", status);
+
 	switch (self_sta_req->type) {
 	case WMI_VDEV_TYPE_STA:
 		if (wlan_cfg_get_int(mac, WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD,

+ 65 - 0
core/wma/src/wma_features.c

@@ -7918,6 +7918,71 @@ QDF_STATUS wma_set_bpf_instructions(tp_wma_handle wma,
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * wma_set_tx_rx_aggregation_size() - sets tx rx aggregation sizes
+ * @tx_rx_aggregation_size: aggregation size parameters
+ *
+ * This function sets tx rx aggregation sizes
+ *
+ * Return: VOS_STATUS_SUCCESS on success, error number otherwise
+ */
+QDF_STATUS wma_set_tx_rx_aggregation_size(
+	struct sir_set_tx_rx_aggregation_size *tx_rx_aggregation_size)
+{
+	tp_wma_handle wma_handle;
+	wmi_vdev_set_custom_aggr_size_cmd_fixed_param *cmd;
+	int32_t len;
+	wmi_buf_t buf;
+	u_int8_t *buf_ptr;
+	int ret;
+
+	wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
+
+	if (!tx_rx_aggregation_size) {
+		WMA_LOGE("%s: invalid pointer", __func__);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (!wma_handle) {
+		WMA_LOGE("%s: WMA context is invald!", __func__);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	len = sizeof(*cmd);
+	buf = wmi_buf_alloc(wma_handle->wmi_handle, len);
+
+	if (!buf) {
+		WMA_LOGE("%s: Failed allocate wmi buffer", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	buf_ptr = (u_int8_t *) wmi_buf_data(buf);
+	cmd = (wmi_vdev_set_custom_aggr_size_cmd_fixed_param *) buf_ptr;
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_vdev_set_custom_aggr_size_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+			wmi_vdev_set_custom_aggr_size_cmd_fixed_param));
+
+	cmd->vdev_id = tx_rx_aggregation_size->vdev_id;
+	cmd->tx_aggr_size = tx_rx_aggregation_size->tx_aggregation_size;
+	cmd->rx_aggr_size = tx_rx_aggregation_size->rx_aggregation_size;
+
+	WMA_LOGI("tx aggr: %d rx aggr: %d vdev: %d",
+		cmd->tx_aggr_size, cmd->rx_aggr_size, cmd->vdev_id);
+
+	ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len,
+				WMI_VDEV_SET_CUSTOM_AGGR_SIZE_CMDID);
+	if (ret) {
+		WMA_LOGE("%s: Failed to send aggregation size command",
+				__func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  *  wma_p2p_lo_start() - P2P listen offload start
  *  @params: p2p listen offload parameters