Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0aa920ec authored by Yu Wang's avatar Yu Wang
Browse files

qcacld-3.0: enhance oui based iot aggr size processing

Check the configured IOT OUIs in Beacon/Probe Response
IEs, but not in Associate Response IEs, because some APs
won't add its specific OUI in Associate Response frame.

Change-Id: I3aedeef0a5dbecd4bed41eb47a9374e654509746
CRs-Fixed: 2955964
parent 497aa3ac
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -494,8 +494,6 @@ typedef struct sSirAssocRsp {
	uint16_t hlp_data_len;
	uint8_t hlp_data[FILS_MAX_HLP_DATA_LEN];
#endif
	uint32_t iot_amsdu_sz;
	uint32_t iot_ampdu_sz;
} tSirAssocRsp, *tpSirAssocRsp;

#ifdef FEATURE_WLAN_ESE
+87 −23
Original line number Diff line number Diff line
@@ -605,6 +605,88 @@ static void clean_up_ft_sha384(tpSirAssocRsp assoc_rsp, bool sha384_akm)
	}
}

/**
 * lim_get_iot_aggr_sz() - check and get IOT aggr size for configured OUI
 *
 * @mac_ctx: Pointer to Global MAC structure
 * @ie_ptr: Pointer to starting IE in Beacon/Probe Response
 * @ie_len: Length of all IEs combined
 * @amsdu_sz: pointer to buffer to store AMSDU size
 * @ampdu_sz: pointer to buffer to store AMPDU size
 *
 * This function is called to find configured vendor specific OUIs
 * from the IEs in Beacon/Probe Response frames, if one of the OUI is
 * present, get the configured aggr size for the OUI.
 *
 * Return: true if found, false otherwise.
 */
static bool
lim_get_iot_aggr_sz(struct mac_context *mac, uint8_t *ie_ptr, uint32_t ie_len,
		    uint32_t *amsdu_sz, uint32_t *ampdu_sz)
{
	const uint8_t *oui, *vendor_ie;
	struct wlan_mlme_iot *iot;
	uint32_t oui_len, aggr_num;
	int i;

	iot = &mac->mlme_cfg->iot;
	aggr_num = iot->aggr_num;
	if (!aggr_num)
		return false;

	for (i = 0; i < aggr_num; i++) {
		oui = iot->aggr[i].oui;
		oui_len = iot->aggr[i].oui_len;
		vendor_ie = wlan_get_vendor_ie_ptr_from_oui(oui, oui_len,
							    ie_ptr, ie_len);
		if (!vendor_ie)
			continue;

		*amsdu_sz = iot->aggr[i].amsdu_sz;
		*ampdu_sz = iot->aggr[i].ampdu_sz;
		return true;
	}

	return false;
}

/**
 * lim_update_iot_aggr_sz() - check and update IOT aggr size
 *
 * @mac_ctx: Pointer to Global MAC structure
 * @ie_ptr: Pointer to starting IE in Beacon/Probe Response
 * @ie_len: Length of all IEs combined
 * @session_entry: A pointer to session entry
 *
 * This function is called to find configured vendor specific OUIs
 * from the IEs in Beacon/Probe Response frames, and set the aggr
 * size accordingly.
 *
 * Return: None
 */
static void
lim_update_iot_aggr_sz(struct mac_context *mac_ctx, uint8_t *ie_ptr,
		       uint32_t ie_len, struct pe_session *session_entry)
{
	int ret;
	uint32_t amsdu_sz, ampdu_sz;
	bool iot_hit;

	if (!ie_ptr || !ie_len)
		return;

	iot_hit = lim_get_iot_aggr_sz(mac_ctx, ie_ptr, ie_len,
				      &amsdu_sz, &ampdu_sz);
	if (!iot_hit)
		return;

	pe_debug("Try to set iot amsdu size: %u", amsdu_sz);
	ret = wma_cli_set_command(session_entry->smeSessionId,
				  GEN_VDEV_PARAM_AMSDU, amsdu_sz, GEN_CMD);
	if (ret)
		pe_err("Failed to set iot amsdu size: %d", ret);
}

/**
 * lim_process_assoc_rsp_frame() - Processes assoc response
 * @mac_ctx: Pointer to Global MAC structure
@@ -624,7 +706,7 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
			    uint32_t reassoc_frame_len,
			    uint8_t subtype, struct pe_session *session_entry)
{
	uint8_t *body;
	uint8_t *body, *ie;
	uint16_t caps, ie_len;
	uint32_t frame_len;
	tSirMacAddr current_bssid;
@@ -643,8 +725,6 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
	QDF_STATUS status;
	enum ani_akm_type auth_type;
	bool sha384_akm;
	int ret;
	uint8_t amsdu_sz;

	assoc_cnf.resultCode = eSIR_SME_SUCCESS;
	/* Update PE session Id */
@@ -1048,23 +1128,6 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
	pe_debug("Successfully Associated with BSS " QDF_MAC_ADDR_FMT,
		 QDF_MAC_ADDR_REF(hdr->sa));

	/*
	 * If fail to get the global max amsdu size, or the value is
	 * 0 (which means FW automode selection), and it hits 'iot_amsdu_sz'
	 * when parsing vendor IEs in assoc rsp frame, set this iot amsdu size.
	 */
	status = ucfg_mlme_get_max_amsdu_num(mac_ctx->psoc, &amsdu_sz);
	if ((QDF_IS_STATUS_ERROR(status) || !amsdu_sz) &&
	    assoc_rsp->iot_amsdu_sz) {
		pe_debug("Try to set iot amsdu size: %u",
			 assoc_rsp->iot_amsdu_sz);
		ret = wma_cli_set_command(session_entry->smeSessionId,
					  GEN_VDEV_PARAM_AMSDU,
					  assoc_rsp->iot_amsdu_sz, GEN_CMD);
		if (ret)
			pe_err("Failed to set iot amsdu size: %d", ret);
	}

#ifdef FEATURE_WLAN_ESE
	if (session_entry->eseContext.tsm.tsmInfo.state)
		session_entry->eseContext.tsm.tsmMetrics.RoamingCount = 0;
@@ -1105,9 +1168,10 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
	 */
	ie_len = lim_get_ielen_from_bss_description(
		&session_entry->lim_join_req->bssDescription);
	lim_extract_ap_capabilities(mac_ctx,
		(uint8_t *)session_entry->lim_join_req->bssDescription.ieFields,
		ie_len, beacon);
	ie = (uint8_t *)session_entry->lim_join_req->bssDescription.ieFields;
	lim_update_iot_aggr_sz(mac_ctx, ie, ie_len, session_entry);

	lim_extract_ap_capabilities(mac_ctx, ie, ie_len, beacon);
	lim_update_assoc_sta_datas(mac_ctx, sta_ds, assoc_rsp,
				   session_entry, beacon);

+0 −33
Original line number Diff line number Diff line
@@ -3288,35 +3288,6 @@ QDF_STATUS wlan_parse_ftie_sha384(uint8_t *frame, uint32_t frame_len,
	return QDF_STATUS_SUCCESS;
}

static void
sir_get_iot_aggr_sz(struct mac_context *mac, uint8_t *ie_ptr, uint32_t ie_len,
		    uint32_t *amsdu_sz, uint32_t *ampdu_sz)
{
	const uint8_t *oui, *vendor_ie;
	struct wlan_mlme_iot *iot;
	uint32_t oui_len, aggr_num;
	int i;

	iot = &mac->mlme_cfg->iot;
	aggr_num = iot->aggr_num;
	if (!aggr_num)
		return;

	for (i = 0; i < aggr_num; i++) {
		oui = iot->aggr[i].oui;
		oui_len = iot->aggr[i].oui_len;
		vendor_ie = wlan_get_vendor_ie_ptr_from_oui(oui, oui_len,
							    ie_ptr, ie_len);
		if (vendor_ie) {
			*amsdu_sz = iot->aggr[i].amsdu_sz;
			*ampdu_sz = iot->aggr[i].ampdu_sz;
			pe_debug("Found oui[%s] amsdu %u, ampdu %u",
				 oui, *amsdu_sz, *ampdu_sz);
			break;
		}
	}
}

QDF_STATUS
sir_convert_assoc_resp_frame2_struct(struct mac_context *mac,
				     struct pe_session *session_entry,
@@ -3486,10 +3457,6 @@ sir_convert_assoc_resp_frame2_struct(struct mac_context *mac,
			     sizeof(tDot11fIEFTInfo));
	}

	sir_get_iot_aggr_sz(mac, ie_ptr, ie_len,
			    &pAssocRsp->iot_amsdu_sz,
			    &pAssocRsp->iot_ampdu_sz);

	if (ar->num_RICDataDesc && ar->num_RICDataDesc <= 2) {
		for (cnt = 0; cnt < ar->num_RICDataDesc; cnt++) {
			if (ar->RICDataDesc[cnt].present) {