diff --git a/cfg/cfg_all.h b/cfg/cfg_all.h index 88f23b2f5e..ee6134880c 100644 --- a/cfg/cfg_all.h +++ b/cfg/cfg_all.h @@ -20,6 +20,7 @@ #include "cfg_converged.h" #include "cfg_mlme.h" #include "cfg_fwol.h" +#include "cfg_ipa.h" #ifdef CONVERGED_P2P_ENABLE #include "wlan_p2p_cfg.h" @@ -49,6 +50,7 @@ CFG_FWOL_ALL \ CFG_HDD_ALL \ CFG_HDD_DP_ALL \ + CFG_IPA \ CFG_MLME_ALL \ CFG_NAN_ALL \ CFG_P2P_ALL \ diff --git a/ipa/core/inc/wlan_ipa_main.h b/ipa/core/inc/wlan_ipa_main.h index 4efb7f6489..19c24922b1 100644 --- a/ipa/core/inc/wlan_ipa_main.h +++ b/ipa/core/inc/wlan_ipa_main.h @@ -114,14 +114,6 @@ QDF_STATUS ipa_config_mem_alloc(void); */ void ipa_config_mem_free(void); -/** - * ipa_config_update() - IPA component config update - * @config: IPA config - * - * Return: None - */ -void ipa_config_update(struct wlan_ipa_config *config); - /** * ipa_config_is_enabled() - Is IPA config enabled? * @@ -422,5 +414,20 @@ void ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev); */ void ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev); +/** + * ipa_component_config_update() - update ipa config from psoc + * @psoc: psoc obj + * + * Return: None + */ +void ipa_component_config_update(struct wlan_objmgr_psoc *psoc); + +/** + * ipa_get_tx_buf_count() - get IPA config tx buffer count + * + * Return: IPA config tx buffer count + */ + +uint32_t ipa_get_tx_buf_count(void); #endif /* IPA_OFFLOAD */ #endif /* end of _WLAN_IPA_MAIN_H_ */ diff --git a/ipa/core/src/wlan_ipa_main.c b/ipa/core/src/wlan_ipa_main.c index c4e2c048a5..fd110582b8 100644 --- a/ipa/core/src/wlan_ipa_main.c +++ b/ipa/core/src/wlan_ipa_main.c @@ -23,6 +23,7 @@ #include "wlan_ipa_main.h" #include "wlan_ipa_core.h" #include "wlan_ipa_tgt_api.h" +#include "cfg_ucfg_api.h" static struct wlan_ipa_config *g_ipa_config; static bool g_ipa_hw_support; @@ -69,16 +70,6 @@ bool ipa_is_hw_support(void) return g_ipa_hw_support; } -void ipa_config_update(struct wlan_ipa_config *config) -{ - if (!g_ipa_config) { - ipa_err("IPA config already freed"); - return; - } - - qdf_mem_copy(g_ipa_config, config, sizeof(*g_ipa_config)); -} - bool ipa_config_is_enabled(void) { return g_ipa_config ? wlan_ipa_is_enabled(g_ipa_config) : 0; @@ -602,3 +593,36 @@ void ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev) return wlan_ipa_fw_rejuvenate_send_msg(ipa_obj); } + +void ipa_component_config_update(struct wlan_objmgr_psoc *psoc) +{ + if (!g_ipa_config) { + ipa_err("g_ipa_config is NULL"); + return; + } + + g_ipa_config->ipa_config = + cfg_get(psoc, CFG_DP_IPA_OFFLOAD_CONFIG); + g_ipa_config->desc_size = + cfg_get(psoc, CFG_DP_IPA_DESC_SIZE); + g_ipa_config->txbuf_count = + qdf_rounddown_pow_of_two(cfg_get(psoc, + CFG_DP_IPA_UC_TX_BUF_COUNT)); + g_ipa_config->ipa_bw_high = + cfg_get(psoc, CFG_DP_IPA_HIGH_BANDWIDTH_MBPS); + g_ipa_config->ipa_bw_medium = + cfg_get(psoc, CFG_DP_IPA_MEDIUM_BANDWIDTH_MBPS); + g_ipa_config->ipa_bw_low = + cfg_get(psoc, CFG_DP_IPA_LOW_BANDWIDTH_MBPS); + g_ipa_config->bus_bw_high = + cfg_get(psoc, CFG_DP_BUS_BANDWIDTH_HIGH_THRESHOLD); + g_ipa_config->bus_bw_medium = + cfg_get(psoc, CFG_DP_BUS_BANDWIDTH_MEDIUM_THRESHOLD); + g_ipa_config->bus_bw_low = + cfg_get(psoc, CFG_DP_BUS_BANDWIDTH_LOW_THRESHOLD); +} + +uint32_t ipa_get_tx_buf_count(void) +{ + return g_ipa_config ? g_ipa_config->txbuf_count : 0; +} diff --git a/ipa/dispatcher/inc/cfg_ipa.h b/ipa/dispatcher/inc/cfg_ipa.h new file mode 100644 index 0000000000..117da5a552 --- /dev/null +++ b/ipa/dispatcher/inc/cfg_ipa.h @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2012-2018 The Linux Foundation. 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 + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: This file contains definitions of Data Path configuration. + */ + +#ifndef _CFG_IPA_H_ +#define _CFG_IPA_H_ + +#include "cfg_define.h" + +/* DP INI Declerations */ +/* + * IPA Offload configuration - Each bit enables a feature + * bit0 - IPA Enable + * bit1 - IPA Pre filter enable + * bit2 - IPv6 enable + * bit3 - IPA Resource Manager (RM) enable + * bit4 - IPA Clock scaling enable + */ + +/* + * + * gIPAConfig - IPA configuration + * @Min: 0 + * @Max: 0xFFFFFFFF + * @Default: 0 + * + * This ini specifies the IPA configuration + * + * Related: N/A + * + * Supported Feature: IPA + * + * Usage: Internal + * + * + */ +#define CFG_DP_IPA_OFFLOAD_CONFIG \ + CFG_INI_UINT("gIPAConfig", \ + 0, \ + 0xFFFFFFFF, \ + 0, \ + CFG_VALUE_OR_DEFAULT, "IPA offload configuration") + +/* + * + * GIPADescSize - IPA descriptor size + * @Min: 800 + * @Max: 8000 + * @Default: 800 + * + * This ini specifies the IPA descriptor size + * + * Related: N/A + * + * Supported Feature: IPA + * + * Usage: Internal + * + * + */ + #define CFG_DP_IPA_DESC_SIZE \ + CFG_INI_UINT("GIPADescSize", \ + 800, \ + 8000, \ + 800, \ + CFG_VALUE_OR_DEFAULT, "IPA DESC SIZE") + +/* + * + * gIPAHighBandwidthMbps - IPA high bw threshold + * @Min: 200 + * @Max: 1000 + * @Default: 400 + * + * This ini specifies the IPA high bw threshold + * + * Related: N/A + * + * Supported Feature: IPA + * + * Usage: Internal + * + * + */ + #define CFG_DP_IPA_HIGH_BANDWIDTH_MBPS \ + CFG_INI_UINT("gIPAHighBandwidthMbps", \ + 200, \ + 1000, \ + 400, \ + CFG_VALUE_OR_DEFAULT, "IPA high bw threshold") + +/* + * + * gIPAHighBandwidthMbps - IPA medium bw threshold + * @Min: 100 + * @Max: 400 + * @Default: 200 + * + * This ini specifies the IPA medium bw threshold + * + * Related: N/A + * + * Supported Feature: IPA + * + * Usage: Internal + * + * + */ + #define CFG_DP_IPA_MEDIUM_BANDWIDTH_MBPS \ + CFG_INI_UINT("gIPAMediumBandwidthMbps", \ + 100, \ + 400, \ + 200, \ + CFG_VALUE_OR_DEFAULT, "IPA medium bw threshold") + +/* + * + * gIPAHighBandwidthMbps - IPA low bw threshold + * @Min: 0 + * @Max: 100 + * @Default: 100 + * + * This ini specifies the IPA low bw threshold + * + * Related: N/A + * + * Supported Feature: IPA + * + * Usage: Internal + * + * + */ + #define CFG_DP_IPA_LOW_BANDWIDTH_MBPS \ + CFG_INI_UINT("gIPALowBandwidthMbps", \ + 0, \ + 100, \ + 100, \ + CFG_VALUE_OR_DEFAULT, "IPA low bw threshold") + +/* + * + * IpaUcTxBufCount - IPA tx buffer count + * @Min: 0 + * @Max: 2048 + * @Default: 512 + * + * This ini specifies the IPA tx buffer count + * + * Related: N/A + * + * Supported Feature: IPA + * + * Usage: Internal + * + * + */ + #define CFG_DP_IPA_UC_TX_BUF_COUNT \ + CFG_INI_UINT("IpaUcTxBufCount", \ + 0, \ + 2048, \ + 512, \ + CFG_VALUE_OR_DEFAULT, "IPA tx buffer count") + +#define CFG_IPA \ + CFG(CFG_DP_IPA_OFFLOAD_CONFIG) \ + CFG(CFG_DP_IPA_DESC_SIZE) \ + CFG(CFG_DP_IPA_HIGH_BANDWIDTH_MBPS) \ + CFG(CFG_DP_IPA_MEDIUM_BANDWIDTH_MBPS) \ + CFG(CFG_DP_IPA_LOW_BANDWIDTH_MBPS) \ + CFG(CFG_DP_IPA_UC_TX_BUF_COUNT) + +#endif /* _CFG_IPA_H_ */ diff --git a/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h b/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h index d10db6a177..6a2de01514 100644 --- a/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h +++ b/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h @@ -26,6 +26,7 @@ #include "wlan_ipa_obj_mgmt_api.h" #include "wlan_objmgr_pdev_obj.h" #include "qdf_types.h" +#include "wlan_ipa_main.h" #ifdef IPA_OFFLOAD @@ -57,13 +58,6 @@ bool ucfg_ipa_is_enabled(void); */ bool ucfg_ipa_uc_is_enabled(void); -/** - * ucfg_ipa_update_config() - Update IPA component config - * - * Return: None - */ -void ucfg_ipa_update_config(struct wlan_ipa_config *config); - /** * ucfg_ipa_set_dp_handle() - register DP handle * @psoc: psoc handle @@ -332,6 +326,21 @@ void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev); */ void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev); +/** + * ucfg_ipa_component_config_update() - update IPA component config + * @psoc: pointer to psoc object + * + * Return: None + */ +void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_get_ipa_tx_buf_count() - get IPA tx buffer count + * + * Return: IPA tx buffer count + */ +uint32_t ucfg_ipa_get_tx_buf_count(void); + #else static inline bool ucfg_ipa_is_present(void) @@ -517,5 +526,16 @@ static inline void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev) { } + +static inline +void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc) +{ +} + +static inline +uint32_t ucfg_ipa_get_tx_buf_count(void) +{ + return 0; +} #endif /* IPA_OFFLOAD */ #endif /* _WLAN_IPA_UCFG_API_H_ */ diff --git a/ipa/dispatcher/src/wlan_ipa_ucfg_api.c b/ipa/dispatcher/src/wlan_ipa_ucfg_api.c index 314e4abbeb..fd1802b1da 100644 --- a/ipa/dispatcher/src/wlan_ipa_ucfg_api.c +++ b/ipa/dispatcher/src/wlan_ipa_ucfg_api.c @@ -21,6 +21,8 @@ #include "wlan_ipa_ucfg_api.h" #include "wlan_ipa_main.h" +#include "cfg_ucfg_api.h" + bool ucfg_ipa_is_present(void) { @@ -49,11 +51,6 @@ void ucfg_ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc, return ipa_set_dp_handle(psoc, dp_soc); } -void ucfg_ipa_update_config(struct wlan_ipa_config *config) -{ - ipa_config_update(config); -} - QDF_STATUS ucfg_ipa_set_perf_level(struct wlan_objmgr_pdev *pdev, uint64_t tx_packets, uint64_t rx_packets) { @@ -196,3 +193,13 @@ void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev) { return ipa_fw_rejuvenate_send_msg(pdev); } + +void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc) +{ + ipa_component_config_update(psoc); +} + +uint32_t ucfg_ipa_get_tx_buf_count(void) +{ + return ipa_get_tx_buf_count(); +}