diff --git a/mlme/core/src/wlan_mlme_main.c b/mlme/core/src/wlan_mlme_main.c index 62a06e4ae7..b69cd36be0 100644 --- a/mlme/core/src/wlan_mlme_main.c +++ b/mlme/core/src/wlan_mlme_main.c @@ -146,6 +146,18 @@ static void mlme_init_generic_cfg(struct wlan_objmgr_psoc *psoc, static void mlme_init_edca_ani_cfg(struct wlan_mlme_edca_params *edca_params) { + /* initialize the max allowed array length for read/write */ + edca_params->ani_acbe_l.max_len = CFG_EDCA_DATA_LEN; + edca_params->ani_acbk_l.max_len = CFG_EDCA_DATA_LEN; + edca_params->ani_acvi_l.max_len = CFG_EDCA_DATA_LEN; + edca_params->ani_acvo_l.max_len = CFG_EDCA_DATA_LEN; + + edca_params->ani_acbe_b.max_len = CFG_EDCA_DATA_LEN; + edca_params->ani_acbk_b.max_len = CFG_EDCA_DATA_LEN; + edca_params->ani_acvi_b.max_len = CFG_EDCA_DATA_LEN; + edca_params->ani_acvo_b.max_len = CFG_EDCA_DATA_LEN; + + /* parse the ETSI edca parameters from cfg string for BK,BE,VI,VO ac */ qdf_uint8_array_parse(cfg_default(CFG_EDCA_ANI_ACBK_LOCAL), edca_params->ani_acbk_l.data, CFG_EDCA_DATA_LEN, @@ -189,6 +201,18 @@ static void mlme_init_edca_ani_cfg(struct wlan_mlme_edca_params *edca_params) static void mlme_init_edca_wme_cfg(struct wlan_mlme_edca_params *edca_params) { + /* initialize the max allowed array length for read/write */ + edca_params->wme_acbk_l.max_len = CFG_EDCA_DATA_LEN; + edca_params->wme_acbe_l.max_len = CFG_EDCA_DATA_LEN; + edca_params->wme_acvi_l.max_len = CFG_EDCA_DATA_LEN; + edca_params->wme_acvo_l.max_len = CFG_EDCA_DATA_LEN; + + edca_params->wme_acbk_b.max_len = CFG_EDCA_DATA_LEN; + edca_params->wme_acbe_b.max_len = CFG_EDCA_DATA_LEN; + edca_params->wme_acvi_b.max_len = CFG_EDCA_DATA_LEN; + edca_params->wme_acvo_b.max_len = CFG_EDCA_DATA_LEN; + + /* parse the WME edca parameters from cfg string for BK,BE,VI,VO ac */ qdf_uint8_array_parse(cfg_default(CFG_EDCA_WME_ACBK_LOCAL), edca_params->wme_acbk_l.data, CFG_EDCA_DATA_LEN, @@ -232,6 +256,18 @@ static void mlme_init_edca_wme_cfg(struct wlan_mlme_edca_params *edca_params) static void mlme_init_edca_etsi_cfg(struct wlan_mlme_edca_params *edca_params) { + /* initialize the max allowed array length for read/write */ + edca_params->etsi_acbe_l.max_len = CFG_EDCA_DATA_LEN; + edca_params->etsi_acbk_l.max_len = CFG_EDCA_DATA_LEN; + edca_params->etsi_acvi_l.max_len = CFG_EDCA_DATA_LEN; + edca_params->etsi_acvo_l.max_len = CFG_EDCA_DATA_LEN; + + edca_params->etsi_acbe_b.max_len = CFG_EDCA_DATA_LEN; + edca_params->etsi_acbk_b.max_len = CFG_EDCA_DATA_LEN; + edca_params->etsi_acvi_b.max_len = CFG_EDCA_DATA_LEN; + edca_params->etsi_acvo_b.max_len = CFG_EDCA_DATA_LEN; + + /* parse the ETSI edca parameters from cfg string for BK,BE,VI,VO ac */ qdf_uint8_array_parse(cfg_default(CFG_EDCA_ETSI_ACBK_LOCAL), edca_params->etsi_acbk_l.data, CFG_EDCA_DATA_LEN, diff --git a/mlme/dispatcher/inc/wlan_mlme_api.h b/mlme/dispatcher/inc/wlan_mlme_api.h index 4803ffd485..2dfd9d0100 100644 --- a/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/mlme/dispatcher/inc/wlan_mlme_api.h @@ -25,9 +25,43 @@ #include #include #include - #include "sme_api.h" +/** + * wlan_mlme_get_cfg_str() - Copy the uint8_t array for a particular CFG + * @dst: pointer to the destination buffer. + * @cfg_str: pointer to the cfg string structure + * @len: length to be copied + * + * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE + */ +QDF_STATUS wlan_mlme_get_cfg_str(uint8_t *dst, struct mlme_cfg_str *cfg_str, + qdf_size_t *len); + +/** + * wlan_mlme_set_cfg_str() - Set values for a particular CFG + * @src: pointer to the source buffer. + * @dst_cfg_str: pointer to the cfg string structure to be modified + * @len: length to be written + * + * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE + */ +QDF_STATUS wlan_mlme_set_cfg_str(uint8_t *src, struct mlme_cfg_str *dst_cfg_str, + qdf_size_t len); + +/** + * wlan_mlme_get_edca_params() - get the EDCA parameters corresponding to the + * edca profile access category + * @edca_params: pointer to mlme edca parameters structure + * @data: data to which the parameter is to be copied + * @edca_ac: edca ac type enum passed to get the cfg value + * + * Return QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE + * + */ +QDF_STATUS wlan_mlme_get_edca_params(struct wlan_mlme_edca_params *edca_params, + uint8_t *data, enum e_edca_type edca_ac); + /** * wlan_mlme_get_ht_cap_info() - Get the HT cap info config * @psoc: pointer to psoc object diff --git a/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/mlme/dispatcher/inc/wlan_mlme_public_struct.h index 332dfd763c..08632f719a 100644 --- a/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -28,17 +28,20 @@ #define CFG_PMKID_MODES_OKC (0x1) #define CFG_PMKID_MODES_PMKSA_CACHING (0x2) -#define CFG_EDCA_DATA_LEN 17 +#define CFG_STR_DATA_LEN 17 +#define CFG_EDCA_DATA_LEN 17 /** * struct mlme_cfg_str - generic structure for all mlme CFG string items * - * @len: length of the string + * @max_len: maximum data length allowed + * @len: valid no. of elements of the data * @data: uint8_t array to store values */ struct mlme_cfg_str { + qdf_size_t max_len; qdf_size_t len; - uint8_t data[CFG_EDCA_DATA_LEN]; + uint8_t data[CFG_STR_DATA_LEN]; }; /** @@ -96,25 +99,37 @@ enum e_edca_type { edca_etsi_acvo_bcast }; +#define CFG_EDCA_PROFILE_ACM_IDX 0 +#define CFG_EDCA_PROFILE_AIFSN_IDX 1 +#define CFG_EDCA_PROFILE_CWMINA_IDX 2 +#define CFG_EDCA_PROFILE_CWMAXA_IDX 4 +#define CFG_EDCA_PROFILE_TXOPA_IDX 6 +#define CFG_EDCA_PROFILE_CWMINB_IDX 7 +#define CFG_EDCA_PROFILE_CWMAXB_IDX 9 +#define CFG_EDCA_PROFILE_TXOPB_IDX 11 +#define CFG_EDCA_PROFILE_CWMING_IDX 12 +#define CFG_EDCA_PROFILE_CWMAXG_IDX 14 +#define CFG_EDCA_PROFILE_TXOPG_IDX 16 + /** * struct mlme_edca_params - EDCA pramaters related config items * - * @ani_acbk_l: EDCA parameters for ANI local access category background - * @ani_acbe_l: EDCA parameters for ANI local access category best effort - * @ani_acvi_l: EDCA parameters for ANI local access category video - * @ani_acvo_l: EDCA parameters for ANI local access category voice - * @ani_acbk_b: EDCA parameters for ANI bcast access category background - * @ani_acbe_b: EDCA parameters for ANI bcast access category best effort - * @ani_acvi_b: EDCA parameters for ANI bcast access category video - * @ani_acvo_b: EDCA parameters for ANI bcast access category voice - * @wme_acbk_l: EDCA parameters for WME local access category background - * @wme_acbe_l: EDCA parameters for WME local access category best effort - * @wme_acvi_l: EDCA parameters for WME local access category video - * @wme_acvo_l: EDCA parameters for WME local access category voice - * @wme_acbk_b: EDCA parameters for WME bcast access category background - * @wme_acbe_b: EDCA parameters for WME bcast access category best effort - * @wme_acvi_b: EDCA parameters for WME bcast access category video - * @wme_acvo_b: EDCA parameters for WME bcast access category voice + * @ani_acbk_l: EDCA parameters for ANI local access category background + * @ani_acbe_l: EDCA parameters for ANI local access category best effort + * @ani_acvi_l: EDCA parameters for ANI local access category video + * @ani_acvo_l: EDCA parameters for ANI local access category voice + * @ani_acbk_b: EDCA parameters for ANI bcast access category background + * @ani_acbe_b: EDCA parameters for ANI bcast access category best effort + * @ani_acvi_b: EDCA parameters for ANI bcast access category video + * @ani_acvo_b: EDCA parameters for ANI bcast access category voice + * @wme_acbk_l: EDCA parameters for WME local access category background + * @wme_acbe_l: EDCA parameters for WME local access category best effort + * @wme_acvi_l: EDCA parameters for WME local access category video + * @wme_acvo_l: EDCA parameters for WME local access category voice + * @wme_acbk_b: EDCA parameters for WME bcast access category background + * @wme_acbe_b: EDCA parameters for WME bcast access category best effort + * @wme_acvi_b: EDCA parameters for WME bcast access category video + * @wme_acvo_b: EDCA parameters for WME bcast access category voice * @etsi_acbk_l: EDCA parameters for ETSI local access category background * @etsi_acbe_l: EDCA parameters for ETSI local access category best effort * @etsi_acvi_l: EDCA parameters for ETSI local access category video diff --git a/mlme/dispatcher/src/wlan_mlme_api.c b/mlme/dispatcher/src/wlan_mlme_api.c index f287bb1160..934030d4fd 100644 --- a/mlme/dispatcher/src/wlan_mlme_api.c +++ b/mlme/dispatcher/src/wlan_mlme_api.c @@ -25,6 +25,35 @@ #include "wma_types.h" #include "wmi_unified.h" +QDF_STATUS wlan_mlme_get_cfg_str(uint8_t *dst, struct mlme_cfg_str *cfg_str, + qdf_size_t *len) +{ + if (*len < cfg_str->len) { + mlme_err("Invalid len %zd", *len); + return QDF_STATUS_E_INVAL; + } + + *len = cfg_str->len; + qdf_mem_copy(dst, cfg_str->data, *len); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_mlme_set_cfg_str(uint8_t *src, struct mlme_cfg_str *dst_cfg_str, + qdf_size_t len) +{ + if (len > dst_cfg_str->max_len) { + mlme_err("Invalid len %zd (>%zd)", len, + dst_cfg_str->max_len); + return QDF_STATUS_E_INVAL; + } + + dst_cfg_str->len = len; + qdf_mem_copy(dst_cfg_str->data, src, len); + + return QDF_STATUS_SUCCESS; +} + QDF_STATUS wlan_mlme_get_ht_cap_info(struct wlan_objmgr_psoc *psoc, struct mlme_ht_capabilities_info *ht_cap_info) @@ -518,3 +547,135 @@ QDF_STATUS wlan_mlme_set_enable_bcast_probe_rsp(struct wlan_objmgr_psoc *psoc, mlme_obj->cfg.oce.enable_bcast_probe_rsp = value; return QDF_STATUS_SUCCESS; } + +QDF_STATUS wlan_mlme_get_edca_params(struct wlan_mlme_edca_params *edca_params, + uint8_t *data, enum e_edca_type edca_ac) +{ + qdf_size_t len; + + switch (edca_ac) { + case edca_ani_acbe_local: + len = edca_params->ani_acbe_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->ani_acbe_l, &len); + break; + + case edca_ani_acbk_local: + len = edca_params->ani_acbk_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->ani_acbk_l, &len); + break; + + case edca_ani_acvi_local: + len = edca_params->ani_acvi_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->ani_acvi_l, &len); + break; + + case edca_ani_acvo_local: + len = edca_params->ani_acvo_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->ani_acvo_l, &len); + break; + + case edca_ani_acbk_bcast: + len = edca_params->ani_acbk_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->ani_acbk_b, &len); + break; + + case edca_ani_acbe_bcast: + len = edca_params->ani_acbe_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->ani_acbe_b, &len); + break; + + case edca_ani_acvi_bcast: + len = edca_params->ani_acvi_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->ani_acvi_b, &len); + break; + + case edca_ani_acvo_bcast: + len = edca_params->ani_acvo_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->ani_acvo_b, &len); + break; + + case edca_wme_acbe_local: + len = edca_params->wme_acbe_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->wme_acbe_l, &len); + break; + + case edca_wme_acbk_local: + len = edca_params->wme_acbk_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->wme_acbk_l, &len); + break; + + case edca_wme_acvi_local: + len = edca_params->wme_acvi_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->wme_acvi_l, &len); + break; + + case edca_wme_acvo_local: + len = edca_params->wme_acvo_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->wme_acvo_l, &len); + break; + + case edca_wme_acbe_bcast: + len = edca_params->wme_acbe_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->wme_acbe_b, &len); + break; + + case edca_wme_acbk_bcast: + len = edca_params->wme_acbk_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->wme_acbk_b, &len); + break; + + case edca_wme_acvi_bcast: + len = edca_params->wme_acvi_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->wme_acvi_b, &len); + break; + + case edca_wme_acvo_bcast: + len = edca_params->wme_acvo_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->wme_acvo_b, &len); + break; + + case edca_etsi_acbe_local: + len = edca_params->etsi_acbe_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->etsi_acbe_l, &len); + break; + + case edca_etsi_acbk_local: + len = edca_params->etsi_acbk_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->etsi_acbk_l, &len); + break; + + case edca_etsi_acvi_local: + len = edca_params->etsi_acvi_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->etsi_acvi_l, &len); + break; + + case edca_etsi_acvo_local: + len = edca_params->etsi_acvo_l.len; + wlan_mlme_get_cfg_str(data, &edca_params->etsi_acvo_l, &len); + break; + + case edca_etsi_acbe_bcast: + len = edca_params->etsi_acbe_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->etsi_acbe_b, &len); + break; + + case edca_etsi_acbk_bcast: + len = edca_params->etsi_acbk_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->etsi_acbk_b, &len); + break; + + case edca_etsi_acvi_bcast: + len = edca_params->etsi_acvi_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->etsi_acvi_b, &len); + break; + + case edca_etsi_acvo_bcast: + len = edca_params->etsi_acvo_b.len; + wlan_mlme_get_cfg_str(data, &edca_params->etsi_acvo_b, &len); + break; + default: + mlme_err("Invalid edca access category"); + return QDF_STATUS_E_INVAL; + } + return QDF_STATUS_SUCCESS; +}