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

qcacld-3.0: Add support to send A-MSDU aggregation type to firmware

Add support to send A-MSDU aggregation type to firmware.

Change-Id: Id97efa6b7ff658b11462f9d6b6c8e79107e5f128
CRs-Fixed: 2234350
Arif Hussain 7 жил өмнө
parent
commit
0e24680997

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

@@ -6706,6 +6706,7 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 	uint16_t latency_level;
 
 	hdd_enter_dev(dev);
+	qdf_mem_zero(&request, sizeof(request));
 
 	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
 		hdd_err("Command not allowed in FTM mode");
@@ -6954,6 +6955,7 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 		request.rx_aggregation_size = nla_get_u8(
 			tb[QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MPDU_AGGREGATION]);
 		request.vdev_id = adapter->session_id;
+		request.aggr_type = WMI_VDEV_CUSTOM_AGGR_TYPE_AMPDU;
 
 		if (request.tx_aggregation_size >=
 					CFG_TX_AGGREGATION_SIZE_MIN &&

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

@@ -4782,6 +4782,11 @@ static int __iw_setint_getnone(struct net_device *dev,
 	case WE_SET_AMSDU:
 	{
 		hdd_debug("SET AMSDU val %d", set_value);
+		if (set_value > 1)
+			sme_set_amsdu(hdd_ctx->hHal, true);
+		else
+			sme_set_amsdu(hdd_ctx->hHal, false);
+
 		ret = wma_cli_set_command(adapter->session_id,
 					  GEN_VDEV_PARAM_AMSDU,
 					  set_value, GEN_CMD);

+ 1 - 0
core/mac/inc/ani_global.h

@@ -957,6 +957,7 @@ typedef struct sAniSirGlobal {
 	bool is_11k_offload_supported;
 	uint8_t reject_addba_req;
 	uint16_t usr_cfg_ba_buff_size;
+	bool is_usr_cfg_amsdu_enabled;
 	uint8_t no_ack_policy_cfg[MAX_NUM_AC];
 	uint32_t he_sgi_ltf_cfg_bit_mask;
 	struct mgmt_beacon_probe_filter bcn_filter;

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

@@ -6751,6 +6751,7 @@ struct sme_ndp_peer_ind {
 /**
  * struct sir_set_tx_rx_aggregation_size - sets tx rx aggregation size
  * @vdev_id: vdev id of the session
+ * @aggr_type: TX Aggregation Type (0=A-MPDU, 1=A-MSDU)
  * @tx_aggregation_size: Tx aggregation size
  * @tx_aggregation_size_be: Tx aggregation size for be queue
  * @tx_aggregation_size_bk: Tx aggregation size for bk queue
@@ -6760,6 +6761,7 @@ struct sme_ndp_peer_ind {
  */
 struct sir_set_tx_rx_aggregation_size {
 	uint8_t vdev_id;
+	wmi_vdev_custom_aggr_type_t aggr_type;
 	uint32_t tx_aggregation_size;
 	uint32_t tx_aggregation_size_be;
 	uint32_t tx_aggregation_size_bk;

+ 4 - 1
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -4780,7 +4780,10 @@ QDF_STATUS lim_send_addba_response_frame(tpAniSirGlobal mac_ctx,
 	frm.addba_param_set.buff_size = SIR_MAC_BA_DEFAULT_BUFF_SIZE;
 	if (mac_ctx->usr_cfg_ba_buff_size)
 		frm.addba_param_set.buff_size = mac_ctx->usr_cfg_ba_buff_size;
-	frm.addba_param_set.amsdu_supp = amsdu_support;
+	if (mac_ctx->is_usr_cfg_amsdu_enabled)
+		frm.addba_param_set.amsdu_supp = amsdu_support;
+	else
+		frm.addba_param_set.amsdu_supp = 0;
 	frm.addba_param_set.policy = SIR_MAC_BA_POLICY_IMMEDIATE;
 	frm.ba_timeout.timeout = batimeout;
 	if (addba_extn_present) {

+ 1 - 0
core/mac/src/sys/legacy/src/system/src/mac_init_api.c

@@ -138,6 +138,7 @@ tSirRetStatus mac_open(struct wlan_objmgr_psoc *psoc, tHalHandle *pHalHandle,
 	p_mac->mgmtSeqNum = WLAN_HOST_SEQ_NUM_MIN - 1;
 	p_mac->first_scan_done = false;
 	p_mac->he_sgi_ltf_cfg_bit_mask = DEF_HE_AUTO_SGI_LTF;
+	p_mac->is_usr_cfg_amsdu_enabled = true;
 
 	status =  pe_open(p_mac, cds_cfg);
 	if (eSIR_SUCCESS != status) {

+ 8 - 0
core/sme/inc/sme_api.h

@@ -2208,5 +2208,13 @@ bool sme_is_sta_key_exchange_in_progress(tHalHandle hal, uint8_t session_id);
 bool sme_validate_channel_list(tHalHandle hal,
 				      uint8_t *chan_list,
 				      uint8_t num_channels);
+/**
+ * sme_set_amsdu() - set amsdu enable/disable based on user cfg
+ * @hal: Pointer to HAL
+ * @enable: enable or disable
+ *
+ * Return: None
+ */
+void sme_set_amsdu(tHalHandle hal, bool enable);
 
 #endif /* #if !defined( __SME_API_H ) */

+ 7 - 0
core/sme/src/common/sme_api.c

@@ -16101,5 +16101,12 @@ bool sme_validate_channel_list(tHalHandle hal,
 
 		i++;
 	}
+
 	return true;
 }
+
+void sme_set_amsdu(tHalHandle hal, bool enable)
+{
+	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
+	mac_ctx->is_usr_cfg_amsdu_enabled = enable;
+}

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

@@ -2143,6 +2143,7 @@ struct cdp_vdev *wma_vdev_attach(tp_wma_handle wma_handle,
 	struct sir_set_tx_aggr_sw_retry_threshold tx_aggr_sw_retry_threshold;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
+	qdf_mem_zero(&tx_rx_aggregation_size, sizeof(tx_rx_aggregation_size));
 	WMA_LOGD("mac %pM, vdev_id %hu, type %d, sub_type %d, nss 2g %d, 5g %d",
 		self_sta_req->self_mac_addr, self_sta_req->session_id,
 		self_sta_req->type, self_sta_req->sub_type,
@@ -2236,6 +2237,7 @@ struct cdp_vdev *wma_vdev_attach(tp_wma_handle wma_handle,
 	tx_rx_aggregation_size.rx_aggregation_size =
 				self_sta_req->rx_aggregation_size;
 	tx_rx_aggregation_size.vdev_id = self_sta_req->session_id;
+	tx_rx_aggregation_size.aggr_type = WMI_VDEV_CUSTOM_AGGR_TYPE_AMPDU;
 
 	status = wma_set_tx_rx_aggregation_size(&tx_rx_aggregation_size);
 	if (status != QDF_STATUS_SUCCESS)

+ 16 - 4
core/wma/src/wma_features.c

@@ -4604,6 +4604,7 @@ QDF_STATUS wma_set_tx_rx_aggregation_size(
 
 	buf_ptr = (u_int8_t *) wmi_buf_data(buf);
 	cmd = (wmi_vdev_set_custom_aggr_size_cmd_fixed_param *) buf_ptr;
+	qdf_mem_zero(cmd, sizeof(*cmd));
 
 	WMITLV_SET_HDR(&cmd->tlv_header,
 		WMITLV_TAG_STRUC_wmi_vdev_set_custom_aggr_size_cmd_fixed_param,
@@ -4613,9 +4614,14 @@ QDF_STATUS wma_set_tx_rx_aggregation_size(
 	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;
+	/* bit 2 (aggr_type): TX Aggregation Type (0=A-MPDU, 1=A-MSDU) */
+	if (tx_rx_aggregation_size->aggr_type ==
+	    WMI_VDEV_CUSTOM_AGGR_TYPE_AMSDU)
+		cmd->enable_bitmap |= 0x04;
 
-	WMA_LOGD("tx aggr: %d rx aggr: %d vdev: %d",
-		cmd->tx_aggr_size, cmd->rx_aggr_size, cmd->vdev_id);
+	WMA_LOGD("tx aggr: %d rx aggr: %d vdev: %d enable_bitmap %d",
+		 cmd->tx_aggr_size, cmd->rx_aggr_size, cmd->vdev_id,
+		 cmd->enable_bitmap);
 
 	ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len,
 				WMI_VDEV_SET_CUSTOM_AGGR_SIZE_CMDID);
@@ -4672,6 +4678,7 @@ QDF_STATUS wma_set_tx_rx_aggregation_size_per_ac(
 
 		buf_ptr = (u_int8_t *)wmi_buf_data(buf);
 		cmd = (wmi_vdev_set_custom_aggr_size_cmd_fixed_param *)buf_ptr;
+		qdf_mem_zero(cmd, sizeof(*cmd));
 
 		WMITLV_SET_HDR(&cmd->tlv_header,
 			       WMITLV_TAG_STRUC_wmi_vdev_set_custom_aggr_size_cmd_fixed_param,
@@ -4685,10 +4692,15 @@ QDF_STATUS wma_set_tx_rx_aggregation_size_per_ac(
 		cmd->tx_aggr_size = tx_aggr_size[queue_num];
 		/* bit 5: tx_ac_enable, if set, ac bitmap is valid. */
 		cmd->enable_bitmap = 0x20 | queue_num;
+		/* bit 2 (aggr_type): TX Aggregation Type (0=A-MPDU, 1=A-MSDU) */
+		if (tx_rx_aggregation_size->aggr_type ==
+		    WMI_VDEV_CUSTOM_AGGR_TYPE_AMSDU)
+			cmd->enable_bitmap |= 0x04;
 
-		WMA_LOGD("queue_num: %d, tx aggr: %d rx aggr: %d vdev: %d",
+		WMA_LOGD("queue_num: %d, tx aggr: %d rx aggr: %d vdev: %d, bitmap: %d",
 			 queue_num, cmd->tx_aggr_size,
-			 cmd->rx_aggr_size, cmd->vdev_id);
+			 cmd->rx_aggr_size, cmd->vdev_id,
+			 cmd->enable_bitmap);
 
 		ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len,
 					WMI_VDEV_SET_CUSTOM_AGGR_SIZE_CMDID);

+ 9 - 16
core/wma/src/wma_main.c

@@ -1099,6 +1099,7 @@ static void wma_process_cli_set_cmd(tp_wma_handle wma,
 	struct sir_set_tx_rx_aggregation_size aggr;
 
 	WMA_LOGD("wmihandle %pK", wma->wmi_handle);
+	qdf_mem_zero(&aggr, sizeof(aggr));
 
 	if (NULL == pMac) {
 		WMA_LOGE("%s: Failed to get pMac", __func__);
@@ -1179,6 +1180,7 @@ static void wma_process_cli_set_cmd(tp_wma_handle wma,
 			 privcmd->param_value);
 
 		switch (privcmd->param_id) {
+		case GEN_VDEV_PARAM_AMSDU:
 		case GEN_VDEV_PARAM_AMPDU:
 			if (soc) {
 				ret = cdp_aggr_cfg(soc, vdev,
@@ -1194,6 +1196,13 @@ static void wma_process_cli_set_cmd(tp_wma_handle wma,
 					privcmd->param_value;
 				aggr.rx_aggregation_size =
 					privcmd->param_value;
+				if (privcmd->param_id == GEN_VDEV_PARAM_AMSDU)
+					aggr.aggr_type =
+						WMI_VDEV_CUSTOM_AGGR_TYPE_AMSDU;
+				else
+					aggr.aggr_type =
+						WMI_VDEV_CUSTOM_AGGR_TYPE_AMPDU;
+
 				ret = wma_set_tx_rx_aggregation_size(&aggr);
 				if (QDF_IS_STATUS_ERROR(ret)) {
 					WMA_LOGE("set_aggr_size failed ret %d",
@@ -1205,22 +1214,6 @@ static void wma_process_cli_set_cmd(tp_wma_handle wma,
 				return;
 			}
 			break;
-		case GEN_VDEV_PARAM_AMSDU:
-			/*
-			 * Firmware currently does not support set operation
-			 * for AMSDU. It may cause crash if the configuration
-			 * is sent to firmware.
-			 * Firmware enhancement will advertise a service bit
-			 * to enable AMSDU configuration through WMI. Then
-			 * add the WMI command to configure AMSDU parameter.
-			 * For the older chipset that does not advertise the
-			 * service bit, enable the following legacy code:
-			 *    ol_txrx_aggr_cfg(vdev, 0, privcmd->param_value);
-			 *    intr[privcmd->param_vdev_id].config.amsdu =
-			 *            privcmd->param_value;
-			 */
-			WMA_LOGE("SET GEN_VDEV_PARAM_AMSDU command is currently not supported");
-			break;
 		case GEN_PARAM_CRASH_INJECT:
 			if (QDF_GLOBAL_FTM_MODE  == cds_get_conparam())
 				WMA_LOGE("Crash inject not allowed in FTM mode");