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

Commit 497aa3ac authored by Yu Wang's avatar Yu Wang
Browse files

qcacld-3.0: add ini for setting oui based aggr size

Add ini 'cfg_tx_iot_aggr', it gives an option to
configure Tx aggregation size in no. of MPDUs/MSDUs
for specified OUI. This can be useful for IOT issues.

Format of the configuration:
  cfg_tx_iot_aggr=<OUI-1>,<MSDU-1>,<MPDU-1>,<OUI-2>,<MSDU-2>,<MPDU-2>...
  MSDU/MPDU means the max tx aggregation size in no. of MSDUs/MPDUs,
  0 means not specified.

For example:
  cfg_tx_iot_aggr=112233,2,0,445566,3,32,778899,0,64
  If vendor OUI-1("\x11\x22\x33") is found in assoc resp,
    set tx amsdu size to 2;
  If vendor OUI-2("\x44\x55\x66") is found in assoc resp,
    set tx amsdu size to 3, set tx ampdu size to 32;
  If vendor OUI-3("\x77\x88\x99") is found in assoc resp,
    set tx ampdu size to 64.

Change-Id: Idcf370a4bf93ca299ce1126eaba4394be1ab5b9d
CRs-Fixed: 2849203
parent ba2ffb16
Loading
Loading
Loading
Loading
+121 −0
Original line number Diff line number Diff line
@@ -2393,6 +2393,126 @@ mlme_init_dot11_mode_cfg(struct wlan_objmgr_psoc *psoc,
	dot11_mode->vdev_type_dot11_mode = cfg_get(psoc, CFG_VDEV_DOT11_MODE);
}

/**
 * mlme_iot_parse_aggr_info - parse aggr related items in ini
 *
 * @psoc: PSOC pointer
 * @iot: IOT related CFG items
 *
 * Return: None
 */
static void
mlme_iot_parse_aggr_info(struct wlan_objmgr_psoc *psoc,
			 struct wlan_mlme_iot *iot)
{
	char *aggr_info, *oui, *msdu, *mpdu, *aggr_info_temp;
	uint32_t ampdu_sz, amsdu_sz, index = 0, oui_len, cfg_str_len;
	struct wlan_iot_aggr *aggr_info_list;
	const char *cfg_str;
	int ret;

	cfg_str = cfg_get(psoc, CFG_TX_IOT_AGGR);
	if (!cfg_str)
		return;

	cfg_str_len = qdf_str_len(cfg_str);
	if (!cfg_str_len)
		return;

	aggr_info = qdf_mem_malloc(cfg_str_len + 1);
	if (!aggr_info)
		return;

	aggr_info_list = iot->aggr;
	qdf_mem_copy(aggr_info, cfg_str, cfg_str_len);
	aggr_info_temp = aggr_info;
	while (aggr_info_temp) {
		/* skip possible spaces before oui string */
		mlme_legacy_err("aggr_info=[%s]", aggr_info_temp);
		while (*aggr_info_temp == ' ')
			aggr_info_temp++;

		oui = strsep(&aggr_info_temp, ",");
		if (!oui) {
			mlme_legacy_err("oui error");
			goto end;
		}

		oui_len = qdf_str_len(oui) / 2;
		if (oui_len > sizeof(aggr_info_list[index].oui)) {
			mlme_legacy_err("size error");
			goto end;
		}

		amsdu_sz = 0;
		msdu = strsep(&aggr_info_temp, ",");
		if (!msdu) {
			mlme_legacy_err("msdu error");
			goto end;
		}

		ret = kstrtou32(msdu, 10, &amsdu_sz);
		if (ret || amsdu_sz > IOT_AGGR_MSDU_MAX_NUM) {
			mlme_legacy_err("invalid msdu no. %s [%u]",
					msdu, amsdu_sz);
			goto end;
		}

		ampdu_sz = 0;
		mpdu = strsep(&aggr_info_temp, ",");
		if (!mpdu) {
			mlme_legacy_err("mpdu error");
			goto end;
		}

		ret = kstrtou32(mpdu, 10, &ampdu_sz);
		if (ret || ampdu_sz > IOT_AGGR_MPDU_MAX_NUM) {
			mlme_legacy_err("invalid mpdu no. %s [%u]",
					mpdu, ampdu_sz);
			goto end;
		}

		mlme_legacy_debug("id %u oui[%s] len %u msdu %u mpdu %u",
				  index, oui, oui_len, amsdu_sz, ampdu_sz);

		ret = qdf_hex_str_to_binary(aggr_info_list[index].oui,
					    oui, oui_len);
		if (ret) {
			mlme_legacy_err("oui error: %d", ret);
			goto end;
		}

		aggr_info_list[index].amsdu_sz = amsdu_sz;
		aggr_info_list[index].ampdu_sz = ampdu_sz;
		aggr_info_list[index].oui_len = oui_len;
		index++;
		if (index >= IOT_AGGR_INFO_MAX_NUM) {
			mlme_legacy_err("exceed max num, index = %d", index);
			break;
		}
	}
	iot->aggr_num = index;

end:
	mlme_legacy_debug("configured aggr num %d", iot->aggr_num);
	qdf_mem_free(aggr_info);
}

/**
 * mlme_iot_parse_aggr_info - parse IOT related items in ini
 *
 * @psoc: PSOC pointer
 * @iot: IOT related CFG items
 *
 * Return: None
 */
static void
mlme_init_iot_cfg(struct wlan_objmgr_psoc *psoc,
		  struct wlan_mlme_iot *iot)
{
	mlme_iot_parse_aggr_info(psoc, iot);
}

QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
	struct wlan_mlme_psoc_ext_obj *mlme_obj;
@@ -2445,6 +2565,7 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
	mlme_init_btm_cfg(psoc, &mlme_cfg->btm);
	mlme_init_roam_score_config(psoc, mlme_cfg);
	mlme_init_ratemask_cfg(psoc, &mlme_cfg->ratemask_cfg);
	mlme_init_iot_cfg(psoc, &mlme_cfg->iot);

	return status;
}
+49 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -498,6 +499,51 @@
			1, \
			"Enable UAPSD for SAP")

#define IOT_AGGR_INFO_MAX_LEN 500
#define IOT_AGGR_INFO_MAX_NUM 32
#define IOT_AGGR_MSDU_MAX_NUM 6
#define IOT_AGGR_MPDU_MAX_NUM 512
/*
 * <ini>
 * cfg_tx_iot_aggr - OUI based tx aggr size for msdu/mpdu
 *
 * This ini gives an option to configure Tx aggregation size
 * in no. of MPDUs/MSDUs for specified OUI.
 * This can be useful for IOT issues.
 *
 * Format of the configuration:
 * cfg_tx_iot_aggr=<OUI-1>,<MSDU-1>,<MPDU-1>,<OUI-2>,<MSDU-2>,<MPDU-2>...
 * MSDU: 0..IOT_AGGR_MSDU_MAX_NUM, the max tx aggregation size in no. of MSDUs,
 *       0 means not specified.
 * MPDU: 0..IOT_AGGR_MPDU_MAX_NUM, the max tx aggregation size in no. of MPDUs,
 *       0 means not specified.
 * Note: MSDU-x/MPDU-x are the max values, FW will take decision for actual
 *   AMSDU/AMPDU size on different platforms.
 *
 * For example:
 *   cfg_tx_iot_aggr=112233,2,0,445566,3,32,778899,0,64
 *   If vendor OUI-1("\x11\x22\x33") is found in assoc resp,
 *   set tx amsdu size to 2;
 *   If vendor OUI-2("\x44\x55\x66") is found in assoc resp,
 *   set tx amsdu size to 3, set tx ampdu size to 32;
 *   If vendor OUI-3("\x77\x88\x99") is found in assoc resp,
 *   set tx ampdu size to 64.
 *
 * Related: IOT
 *
 * Supported Feature: IOT
 *
 * Usage: External
 *
 * </ini>
 */
#define CFG_TX_IOT_AGGR CFG_INI_STRING( \
		"cfg_tx_iot_aggr", \
		0, \
		IOT_AGGR_INFO_MAX_LEN, \
		"", \
		"Used to configure OUI based tx aggr size for msdu/mpdu")

#define CFG_QOS_ALL \
	CFG(CFG_SAP_MAX_INACTIVITY_OVERRIDE) \
	CFG(CFG_TX_AGGREGATION_SIZE) \
@@ -516,6 +562,7 @@
	CFG(CFG_TX_NON_AGGR_SW_RETRY_VI) \
	CFG(CFG_TX_NON_AGGR_SW_RETRY_VO) \
	CFG(CFG_TX_NON_AGGR_SW_RETRY) \
	CFG(CFG_SAP_QOS_UAPSD)
	CFG(CFG_SAP_QOS_UAPSD) \
	CFG(CFG_TX_IOT_AGGR)

#endif /* __CFG_MLME_QOS_H */
+30 −0
Original line number Diff line number Diff line
@@ -2378,6 +2378,34 @@ struct wlan_mlme_reg {
	bool enable_nan_on_indoor_channels;
};

#define IOT_AGGR_INFO_MAX_NUM 32

/**
 * struct wlan_iot_aggr - IOT related AGGR rule
 *
 * @oui: OUI for the rule
 * @oui_len: length of the OUI
 * @ampdu_sz: max aggregation size in no. of MPDUs
 * @amsdu_sz: max aggregation size in no. of MSDUs
 */
struct wlan_iot_aggr {
	uint8_t oui[OUI_LENGTH];
	uint32_t oui_len;
	uint32_t ampdu_sz;
	uint32_t amsdu_sz;
};

/**
 * struct wlan_mlme_iot - IOT related CFG Items
 *
 * @aggr: aggr rules
 * @aggr_num: number of the configured aggr rules
 */
struct wlan_mlme_iot {
	struct wlan_iot_aggr aggr[IOT_AGGR_INFO_MAX_NUM];
	uint32_t aggr_num;
};

/**
 * struct wlan_mlme_cfg - MLME config items
 * @chainmask_cfg: VHT chainmask related cfg items
@@ -2421,6 +2449,7 @@ struct wlan_mlme_reg {
 * @trig_score_delta: Roam score delta value for various roam triggers
 * @trig_min_rssi: Expected minimum RSSI value of candidate AP for
 * various roam triggers
 * @iot: IOT related CFG items
 */
struct wlan_mlme_cfg {
	struct wlan_mlme_chainmask chainmask_cfg;
@@ -2465,6 +2494,7 @@ struct wlan_mlme_cfg {
	struct roam_trigger_score_delta trig_score_delta[NUM_OF_ROAM_TRIGGERS];
	struct roam_trigger_min_rssi trig_min_rssi[NUM_OF_ROAM_MIN_RSSI];
	struct wlan_mlme_ratemask ratemask_cfg;
	struct wlan_mlme_iot iot;
};

enum pkt_origin {
+3 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -493,6 +494,8 @@ 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
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -43,6 +44,7 @@
#include "lim_process_fils.h"
#include "wlan_blm_api.h"
#include "wlan_mlme_twt_api.h"
#include "wlan_mlme_ucfg_api.h"

/**
 * lim_update_stads_htcap() - Updates station Descriptor HT capability
@@ -641,6 +643,8 @@ 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 */
@@ -1043,6 +1047,24 @@ 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;
Loading