diff --git a/cfg/inc/cfg_converged.h b/cfg/inc/cfg_converged.h index a26ac6d1db6e..87eecad0f285 100644 --- a/cfg/inc/cfg_converged.h +++ b/cfg/inc/cfg_converged.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020 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 @@ -25,6 +25,7 @@ #include #include "cfg_dp.h" +#include "cfg_hif.h" #include #ifdef WLAN_SUPPORT_GREEN_AP #include "cfg_green_ap_params.h" @@ -38,7 +39,8 @@ CFG_DP \ CFG_EXTSCAN_ALL \ CFG_GREEN_AP_ALL \ - CFG_SPECTRAL_ALL + CFG_SPECTRAL_ALL \ + CFG_HIF #endif /* __CFG_CONVERGED_H */ diff --git a/hif/inc/cfg_hif.h b/hif/inc/cfg_hif.h new file mode 100644 index 000000000000..41f0fd0bb77f --- /dev/null +++ b/hif/inc/cfg_hif.h @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2020 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. + */ + +#ifndef _CFG_HIF_H_ +#define _CFG_HIF_H_ + +/* Min/Max/default CE status srng timer threshold */ +#define WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_MIN 0 +#define WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_MAX 4096 +#define WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_DEFAULT 4096 + +/* Min/Max/default CE status srng batch count threshold */ +#define WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_MIN 0 +#define WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_MAX 512 +#define WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_DEFAULT 1 + +#ifdef WLAN_CE_INTERRUPT_THRESHOLD_CONFIG +/** + * + * ce_status_ring_timer_thresh - ce status srng timer threshold + * @Min: 0 + * @Max: 4096 + * @Default: 0 + * + * This ini specifies the timer threshold for CE status srng to + * indicate the interrupt to be fired whenever the timer threshold + * runs out. + * + * Supported Feature: interrupt threshold for CE status srng + * + * Usage: Internal + * + * + */ +#define CFG_CE_STATUS_RING_TIMER_THRESHOLD \ + CFG_INI_UINT("ce_status_ring_timer_threshold", \ + WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_MIN, \ + WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_MAX, \ + WLAN_CFG_CE_STATUS_RING_TIMER_THRESH_DEFAULT, \ + CFG_VALUE_OR_DEFAULT, \ + "CE Status ring timer threshold") + +/** + * + * ce_status_ring_batch_count_thresh - ce status srng batch count threshold + * @Min: 0 + * @Max: 512 + * @Default: 1 + * + * This ini specifies the batch count threshold for CE status srng to + * indicate the interrupt to be fired for a given number of packets in + * the ring. + * + * Supported Feature: interrupt threshold for CE status srng + * + * Usage: Internal + * + * + */ +#define CFG_CE_STATUS_RING_BATCH_COUNT_THRESHOLD \ + CFG_INI_UINT("ce_status_ring_batch_count_threshold", \ + WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_MIN, \ + WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_MAX, \ + WLAN_CFG_CE_STATUS_RING_BATCH_COUNT_THRESH_DEFAULT, \ + CFG_VALUE_OR_DEFAULT, \ + "CE Status ring batch count threshold") + +#define CFG_HIF \ + CFG(CFG_CE_STATUS_RING_TIMER_THRESHOLD) \ + CFG(CFG_CE_STATUS_RING_BATCH_COUNT_THRESHOLD) +#else +#define CFG_HIF +#endif /* WLAN_CE_INTERRUPT_THRESHOLD_CONFIG */ +#endif /* _CFG_HIF_H_ */ diff --git a/hif/inc/hif.h b/hif/inc/hif.h index f1db93afd2cb..2e28873dc43c 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -38,6 +38,7 @@ extern "C" { #ifdef IPA_OFFLOAD #include #endif +#include "cfg_ucfg_api.h" #define ENABLE_MBOX_DUMMY_SPACE_FEATURE 1 typedef void __iomem *A_target_id_t; @@ -834,9 +835,25 @@ void hif_disable_isr(struct hif_opaque_softc *hif_ctx); void hif_reset_soc(struct hif_opaque_softc *hif_ctx); void hif_save_htc_htt_config_endpoint(struct hif_opaque_softc *hif_ctx, int htc_htt_tx_endpoint); -struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, uint32_t mode, + +/** + * hif_open() - Create hif handle + * @qdf_ctx: qdf context + * @mode: Driver Mode + * @bus_type: Bus Type + * @cbk: CDS Callbacks + * @psoc: psoc object manager + * + * API to open HIF Context + * + * Return: HIF Opaque Pointer + */ +struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, + uint32_t mode, enum qdf_bus_type bus_type, - struct hif_driver_state_callbacks *cbk); + struct hif_driver_state_callbacks *cbk, + struct wlan_objmgr_psoc *psoc); + void hif_close(struct hif_opaque_softc *hif_ctx); QDF_STATUS hif_enable(struct hif_opaque_softc *hif_ctx, struct device *dev, void *bdev, const struct hif_bus_id *bid, @@ -1237,7 +1254,8 @@ hif_get_ce_service_max_yield_time(struct hif_opaque_softc *hif); * Return: void */ void hif_set_ce_service_max_rx_ind_flush(struct hif_opaque_softc *hif, - uint8_t ce_service_max_rx_ind_flush); + uint8_t ce_service_max_rx_ind_flush); + #ifdef OL_ATH_SMART_LOGGING /* * hif_log_ce_dump() - Copy all the CE DEST ring to buf diff --git a/hif/src/ce/ce_service_srng.c b/hif/src/ce/ce_service_srng.c index 4456f5758e5f..55584a70155b 100644 --- a/hif/src/ce/ce_service_srng.c +++ b/hif/src/ce/ce_service_srng.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2020 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 @@ -820,6 +820,34 @@ static void ce_srng_dest_ring_setup(struct hif_softc *scn, uint32_t ce_id, &ring_params); } +#ifdef WLAN_CE_INTERRUPT_THRESHOLD_CONFIG +/** + * ce_status_ring_config_int_threshold() - configure ce status ring interrupt + * thresholds + * @scn: hif handle + * @ring_params: ce srng params + * + * Return: None + */ +static inline +void ce_status_ring_config_int_threshold(struct hif_softc *scn, + struct hal_srng_params *ring_params) +{ + ring_params->intr_timer_thres_us = + scn->ini_cfg.ce_status_ring_timer_threshold; + ring_params->intr_batch_cntr_thres_entries = + scn->ini_cfg.ce_status_ring_batch_count_threshold; +} +#else +static inline +void ce_status_ring_config_int_threshold(struct hif_softc *scn, + struct hal_srng_params *ring_params) +{ + ring_params->intr_timer_thres_us = 0x1000; + ring_params->intr_batch_cntr_thres_entries = 0x1; +} +#endif /* WLAN_CE_INTERRUPT_THRESHOLD_CONFIG */ + static void ce_srng_status_ring_setup(struct hif_softc *scn, uint32_t ce_id, struct CE_ring_state *status_ring, struct CE_attr *attr) @@ -835,8 +863,7 @@ static void ce_srng_status_ring_setup(struct hif_softc *scn, uint32_t ce_id, ring_params.num_entries = status_ring->nentries; if (!(CE_ATTR_DISABLE_INTR & attr->flags)) { - ring_params.intr_timer_thres_us = 0x1000; - ring_params.intr_batch_cntr_thres_entries = 0x1; + ce_status_ring_config_int_threshold(scn, &ring_params); } status_ring->srng_ctx = hal_srng_setup(scn->hal_soc, CE_DST_STATUS, diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index 6b6e3a681fef..8ee43deb01f7 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -396,20 +396,41 @@ void *hif_get_dev_ba(struct hif_opaque_softc *hif_handle) return scn->mem; } qdf_export_symbol(hif_get_dev_ba); + +#ifdef WLAN_CE_INTERRUPT_THRESHOLD_CONFIG /** - * hif_open(): hif_open - * @qdf_ctx: QDF Context - * @mode: Driver Mode - * @bus_type: Bus Type - * @cbk: CDS Callbacks + * hif_get_cfg_from_psoc() - Retrieve ini cfg from psoc + * @scn: hif context + * @psoc: psoc objmgr handle * - * API to open HIF Context - * - * Return: HIF Opaque Pointer + * Return: None */ -struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, uint32_t mode, +static inline +void hif_get_cfg_from_psoc(struct hif_softc *scn, + struct wlan_objmgr_psoc *psoc) +{ + if (psoc) { + scn->ini_cfg.ce_status_ring_timer_threshold = + cfg_get(psoc, + CFG_CE_STATUS_RING_TIMER_THRESHOLD); + scn->ini_cfg.ce_status_ring_batch_count_threshold = + cfg_get(psoc, + CFG_CE_STATUS_RING_BATCH_COUNT_THRESHOLD); + } +} +#else +static inline +void hif_get_cfg_from_psoc(struct hif_softc *scn, + struct wlan_objmgr_psoc *psoc) +{ +} +#endif /* WLAN_CE_INTERRUPT_THRESHOLD_CONFIG */ + +struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, + uint32_t mode, enum qdf_bus_type bus_type, - struct hif_driver_state_callbacks *cbk) + struct hif_driver_state_callbacks *cbk, + struct wlan_objmgr_psoc *psoc) { struct hif_softc *scn; QDF_STATUS status = QDF_STATUS_SUCCESS; @@ -436,6 +457,9 @@ struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, uint32_t mode, qdf_mem_copy(&scn->callbacks, cbk, sizeof(struct hif_driver_state_callbacks)); scn->bus_type = bus_type; + + hif_get_cfg_from_psoc(scn, psoc); + hif_set_event_hist_mask(GET_HIF_OPAQUE_HDL(scn)); status = hif_bus_open(scn, bus_type); if (status != QDF_STATUS_SUCCESS) { @@ -496,6 +520,7 @@ void hif_close(struct hif_opaque_softc *hif_ctx) hif_uninit_rri_on_ddr(scn); hif_bus_close(scn); + qdf_mem_free(scn); } diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h index 8306e0193620..2d4a644b070c 100644 --- a/hif/src/hif_main.h +++ b/hif/src/hif_main.h @@ -154,6 +154,16 @@ struct ce_desc_hist { }; #endif /*defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)*/ +/** + * struct hif_cfg() - store ini config parameters in hif layer + * @ce_status_ring_timer_threshold: ce status ring timer threshold + * @ce_status_ring_batch_count_threshold: ce status ring batch count threshold + */ +struct hif_cfg { + uint16_t ce_status_ring_timer_threshold; + uint8_t ce_status_ring_batch_count_threshold; +}; + struct hif_softc { struct hif_opaque_softc osc; struct hif_config_info hif_config; @@ -227,6 +237,7 @@ struct hif_softc { #ifdef IPA_OFFLOAD qdf_shared_mem_t *ipa_ce_ring; #endif + struct hif_cfg ini_cfg; }; static inline