diff --git a/components/action_oui/core/inc/wlan_action_oui_priv.h b/components/action_oui/core/inc/wlan_action_oui_priv.h index 114cfd6f0f..5dd7913ec2 100644 --- a/components/action_oui/core/inc/wlan_action_oui_priv.h +++ b/components/action_oui/core/inc/wlan_action_oui_priv.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 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 @@ -91,6 +91,8 @@ struct action_oui_priv { * @action_oui_enable: action oui enable * @action_oui_str: oui configuration strings * @total_extensions: total count of extensions from all actions + * @host_only_extensions: total host only only extensions from all actions + * @max_extensions: Max no. of extensions that can be configured to the firmware * @oui_priv: array of pointers used to refer each action info * @tx_ops: call-back functions to send OUIs to firmware */ @@ -99,6 +101,8 @@ struct action_oui_psoc_priv { bool action_oui_enable; uint8_t action_oui_str[ACTION_OUI_MAXIMUM_ID][ACTION_OUI_MAX_STR_LEN]; uint32_t total_extensions; + uint32_t host_only_extensions; + uint32_t max_extensions; struct action_oui_priv *oui_priv[ACTION_OUI_MAXIMUM_ID]; struct action_oui_tx_ops tx_ops; }; diff --git a/components/action_oui/core/src/wlan_action_oui_main.c b/components/action_oui/core/src/wlan_action_oui_main.c index d06894af0f..2181f28bd0 100644 --- a/components/action_oui/core/src/wlan_action_oui_main.c +++ b/components/action_oui/core/src/wlan_action_oui_main.c @@ -95,6 +95,9 @@ action_oui_destroy(struct action_oui_psoc_priv *psoc_priv) uint32_t i; psoc_priv->total_extensions = 0; + psoc_priv->max_extensions = 0; + psoc_priv->host_only_extensions = 0; + for (i = 0; i < ACTION_OUI_MAXIMUM_ID; i++) { oui_priv = psoc_priv->oui_priv[i]; psoc_priv->oui_priv[i] = NULL; @@ -233,6 +236,18 @@ static void action_oui_parse_config(struct wlan_objmgr_psoc *psoc) action_oui_err("Failed to parse action_oui str: %u", id); } + + /* FW allocates memory for the extensions only during init time. + * Therefore, send additional legspace for configuring new + * extensions during runtime. + * The current max value is default extensions count + 10. + */ + psoc_priv->max_extensions = psoc_priv->total_extensions - + psoc_priv->host_only_extensions + + ACTION_OUI_MAX_ADDNL_EXTENSIONS; + action_oui_debug("Extensions - Max: %d Total: %d host_only %d", + psoc_priv->max_extensions, psoc_priv->total_extensions, + psoc_priv->host_only_extensions); } static QDF_STATUS action_oui_send_config(struct wlan_objmgr_psoc *psoc) @@ -436,6 +451,13 @@ wlan_action_oui_cleanup(struct action_oui_psoc_priv *psoc_priv, psoc_priv->total_extensions--; else action_oui_err("unexpected total_extensions 0"); + + if (action_id >= ACTION_OUI_HOST_ONLY) { + if (!psoc_priv->host_only_extensions) + action_oui_err("unexpected total host extensions"); + else + psoc_priv->host_only_extensions--; + } } qdf_mutex_release(&oui_priv->extension_lock); diff --git a/components/action_oui/core/src/wlan_action_oui_parse.c b/components/action_oui/core/src/wlan_action_oui_parse.c index 5ca340bd99..d2faafabc2 100644 --- a/components/action_oui/core/src/wlan_action_oui_parse.c +++ b/components/action_oui/core/src/wlan_action_oui_parse.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 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 @@ -630,6 +630,12 @@ action_oui_parse(struct action_oui_psoc_priv *psoc_priv, break; } + if (action_id >= ACTION_OUI_HOST_ONLY) { + qdf_mutex_acquire(&oui_priv->extension_lock); + psoc_priv->host_only_extensions++; + qdf_mutex_release(&oui_priv->extension_lock); + } + oui_index++; if (oui_index == ACTION_OUI_MAX_EXTENSIONS) { if (str1) @@ -754,6 +760,16 @@ QDF_STATUS action_oui_send(struct action_oui_psoc_priv *psoc_priv, extension_list = &oui_priv->extension_list; qdf_mutex_acquire(&oui_priv->extension_lock); + if (psoc_priv->max_extensions - + (psoc_priv->total_extensions - psoc_priv->host_only_extensions) < 0) { + action_oui_err("total_extensions: %d exceeds max_extensions: %d, do not update", + psoc_priv->max_extensions, + (psoc_priv->total_extensions - + psoc_priv->host_only_extensions)); + qdf_mutex_release(&oui_priv->extension_lock); + return QDF_STATUS_E_FAILURE; + } + no_oui_extensions = qdf_list_size(extension_list); len = sizeof(*req) + no_oui_extensions * sizeof(*extension); req = qdf_mem_malloc(len); @@ -764,7 +780,7 @@ QDF_STATUS action_oui_send(struct action_oui_psoc_priv *psoc_priv, req->action_id = oui_priv->id; req->no_oui_extensions = no_oui_extensions; - req->total_no_oui_extensions = psoc_priv->total_extensions; + req->total_no_oui_extensions = psoc_priv->max_extensions; extension = req->extension; qdf_list_peek_front(extension_list, &node); diff --git a/components/action_oui/dispatcher/inc/wlan_action_oui_public_struct.h b/components/action_oui/dispatcher/inc/wlan_action_oui_public_struct.h index 31fca960d8..80fe4b553c 100644 --- a/components/action_oui/dispatcher/inc/wlan_action_oui_public_struct.h +++ b/components/action_oui/dispatcher/inc/wlan_action_oui_public_struct.h @@ -43,6 +43,17 @@ */ #define ACTION_OUI_MAX_EXTENSIONS 10 +/* + * Firmware allocates memory for the extensions only during init time. + * Therefore, inaddition to the total extensions configured during + * init time, driver has to add extra space to allow runtime extensions. + * + * Example: ACTION_OUI_11BE_OUI_ALLOW + * + * Max. value should be increased with the addition of new runtime extensions. + */ +#define ACTION_OUI_MAX_ADDNL_EXTENSIONS 10 + #define ACTION_OUI_MAX_OUI_LENGTH 5 #define ACTION_OUI_MAX_DATA_LENGTH 20 #define ACTION_OUI_MAX_DATA_MASK_LENGTH 3 @@ -124,14 +135,12 @@ enum action_oui_id { ACTION_OUI_SWITCH_TO_11N_MODE = 4, ACTION_OUI_CONNECT_1X1_WITH_1_CHAIN = 5, ACTION_OUI_DISABLE_AGGRESSIVE_TX = 6, - ACTION_OUI_FORCE_MAX_NSS = 7, - ACTION_OUI_DISABLE_AGGRESSIVE_EDCA = 8, - ACTION_OUI_DISABLE_TWT = 9, - ACTION_OUI_EXTEND_WOW_ITO = 10, - ACTION_OUI_11BE_OUI_ALLOW = 11, - ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE = 12, - ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL = 13, - ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN = 14, + ACTION_OUI_DISABLE_TWT = 7, + ACTION_OUI_EXTEND_WOW_ITO = 8, + ACTION_OUI_11BE_OUI_ALLOW = 9, + ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE = 10, + ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL = 11, + ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN = 12, /* host&fw interface add above here */ ACTION_OUI_HOST_ONLY, @@ -139,6 +148,8 @@ enum action_oui_id { ACTION_OUI_TAKE_ALL_BAND_INFO, ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ, ACTION_OUI_DISABLE_BFORMEE, + ACTION_OUI_FORCE_MAX_NSS, + ACTION_OUI_DISABLE_AGGRESSIVE_EDCA, ACTION_OUI_MAXIMUM_ID };