qcacld-3.0: Move ipa code to cmn and fix compile

Fix compile error, and register a common api

Change-Id: If296dfe70529e1ef6e0bb3094b6fa63aa4c0b8d6
CRs-Fixed: 3081328
This commit is contained in:
chunquan
2021-11-24 11:26:29 +08:00
committed by Madan Koyyalamudi
parent 16f53c0c2d
commit 406c530769
19 changed files with 3 additions and 10875 deletions

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-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
@@ -58,7 +59,6 @@
CFG_POLICY_MGR_ALL \
CFG_HDD_ALL \
CFG_HDD_DP_ALL \
CFG_IPA \
CFG_LEGACY_DP_ALL \
CFG_MLME_ALL \
CFG_NAN_ALL \

View File

@@ -1,843 +0,0 @@
/*
* Copyright (c) 2013-2021 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 _WLAN_IPA_CORE_H_
#define _WLAN_IPA_CORE_H_
#ifdef IPA_OFFLOAD
#include "wlan_ipa_priv.h"
#include "wlan_ipa_public_struct.h"
/**
* wlan_ipa_is_enabled() - Is IPA enabled?
* @ipa_cfg: IPA config
*
* Return: true if IPA is enabled, false otherwise
*/
static inline bool wlan_ipa_is_enabled(struct wlan_ipa_config *ipa_cfg)
{
return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_ENABLE_MASK);
}
/**
* wlan_ipa_uc_is_enabled() - Is IPA UC enabled?
* @ipa_cfg: IPA config
*
* Return: true if IPA UC is enabled, false otherwise
*/
static inline bool wlan_ipa_uc_is_enabled(struct wlan_ipa_config *ipa_cfg)
{
return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_UC_ENABLE_MASK);
}
/**
* wlan_ipa_is_rt_debugging_enabled() - Is IPA RT debugging enabled?
* @ipa_cfg: IPA config
*
* Return: true if IPA RT debugging is enabled, false otherwise
*/
static inline
bool wlan_ipa_is_rt_debugging_enabled(struct wlan_ipa_config *ipa_cfg)
{
return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg,
WLAN_IPA_REAL_TIME_DEBUGGING);
}
/**
* wlan_ipa_setup - IPA initialize and setup
* @ipa_ctx: IPA priv obj
* @ipa_cfg: IPA config
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_setup(struct wlan_ipa_priv *ipa_ctx,
struct wlan_ipa_config *ipa_cfg);
/**
* wlan_ipa_get_obj_context - Get IPA OBJ context
*
* Return: IPA context
*/
struct wlan_ipa_priv *wlan_ipa_get_obj_context(void);
/**
* wlan_ipa_cleanup - IPA cleanup
* @ipa_ctx: IPA priv obj
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_cleanup(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_uc_enable_pipes() - Enable IPA uC pipes
* @ipa_ctx: IPA context
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_uc_enable_pipes(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_uc_disable_pipes() - Disable IPA uC pipes
* @ipa_ctx: IPA context
* @force_disable: If true, immediately disable IPA pipes. If false, wait for
* pending IPA WLAN TX completions
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_uc_disable_pipes(struct wlan_ipa_priv *ipa_ctx,
bool force_disable);
/**
* wlan_ipa_is_tx_pending() - Check if IPA TX Completions are pending
* @ipa_ctx: IPA context
*
* Return: bool
*/
bool wlan_ipa_is_tx_pending(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_set_perf_level() - Set IPA performance level
* @ipa_ctx: IPA context
* @tx_packets: Number of packets transmitted in the last sample period
* @rx_packets: Number of packets received in the last sample period
*
* Return: QDF STATUS
*/
QDF_STATUS wlan_ipa_set_perf_level(struct wlan_ipa_priv *ipa_ctx,
uint64_t tx_packets, uint64_t rx_packets);
/**
* wlan_ipa_init_perf_level() - Initialize IPA performance level
* @ipa_ctx: IPA context
*
* If IPA clock scaling is disabled, initialize perf level to maximum.
* Else set the lowest level to start with.
*
* Return: QDF STATUS
*/
QDF_STATUS wlan_ipa_init_perf_level(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_get_iface() - Get IPA interface
* @ipa_ctx: IPA context
* @mode: Interface device mode
*
* Return: IPA interface address
*/
struct wlan_ipa_iface_context
*wlan_ipa_get_iface(struct wlan_ipa_priv *ipa_ctx, uint8_t mode);
/**
* wlan_ipa_get_iface_by_mode_netdev() - Get IPA interface
* @ipa_ctx: IPA context
* @ndev: Interface netdev pointer
* @mode: Interface device mode
*
* Return: IPA interface address
*/
struct wlan_ipa_iface_context *
wlan_ipa_get_iface_by_mode_netdev(struct wlan_ipa_priv *ipa_ctx,
qdf_netdev_t ndev, uint8_t mode);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) && \
!defined(CONFIG_IPA_WDI_UNIFIED_API)
/**
* wlan_ipa_is_rm_enabled() - Is IPA RM enabled?
* @ipa_cfg: IPA config
*
* Return: true if IPA RM is enabled, false otherwise
*/
static inline bool wlan_ipa_is_rm_enabled(struct wlan_ipa_config *ipa_cfg)
{
return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_RM_ENABLE_MASK);
}
/**
* wlan_ipa_is_clk_scaling_enabled() - Is IPA clock scaling enabled?
* @ipa_cfg: IPA config
*
* Return: true if IPA clock scaling is enabled, false otherwise
*/
static inline
bool wlan_ipa_is_clk_scaling_enabled(struct wlan_ipa_config *ipa_cfg)
{
return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg,
WLAN_IPA_CLK_SCALING_ENABLE_MASK |
WLAN_IPA_RM_ENABLE_MASK);
}
/**
* wlan_ipa_wdi_rm_request_resource() - IPA WDI request resource
* @ipa_ctx: IPA context
* @res_name: IPA RM resource name
*
* Return: 0 on success, negative errno on error
*/
static inline
int wlan_ipa_wdi_rm_request_resource(struct wlan_ipa_priv *ipa_ctx,
qdf_ipa_rm_resource_name_t res_name)
{
return qdf_ipa_rm_request_resource(res_name);
}
/**
* wlan_ipa_wdi_rm_release_resource() - IPA WDI release resource
* @ipa_ctx: IPA context
* @res_name: IPA RM resource name
*
* Return: 0 on success, negative errno on error
*/
static inline
int wlan_ipa_wdi_rm_release_resource(struct wlan_ipa_priv *ipa_ctx,
qdf_ipa_rm_resource_name_t res_name)
{
return qdf_ipa_rm_release_resource(res_name);
}
/**
* wlan_ipa_wdi_rm_request() - Request resource from IPA
* @ipa_ctx: IPA context
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_wdi_rm_request(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_wdi_rm_try_release() - Attempt to release IPA resource
* @ipa_ctx: IPA context
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_wdi_rm_try_release(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_wdi_setup_rm() - Setup IPA resource management
* @ipa_ctx: IPA context
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_wdi_setup_rm(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_wdi_destroy_rm() - Destroy IPA resources
* @ipa_ctx: IPA context
*
* Destroys all resources associated with the IPA resource manager
*
* Return: None
*/
void wlan_ipa_wdi_destroy_rm(struct wlan_ipa_priv *ipa_ctx);
static inline
int wlan_ipa_wdi_rm_notify_completion(qdf_ipa_rm_event_t event,
qdf_ipa_rm_resource_name_t res_name)
{
return qdf_ipa_rm_notify_completion(event, res_name);
}
static inline
int wlan_ipa_wdi_rm_inactivity_timer_destroy(
qdf_ipa_rm_resource_name_t res_name)
{
return qdf_ipa_rm_inactivity_timer_destroy(res_name);
}
bool wlan_ipa_is_rm_released(struct wlan_ipa_priv *ipa_ctx);
#else /* CONFIG_IPA_WDI_UNIFIED_API */
/**
* wlan_ipa_is_rm_enabled() - Is IPA RM enabled?
* @ipa_cfg: IPA config
*
* IPA RM is deprecated and IPA PM is involved. WLAN driver
* has no control over IPA PM and thus we could regard IPA
* RM as always enabled for power efficiency.
*
* Return: true
*/
static inline bool wlan_ipa_is_rm_enabled(struct wlan_ipa_config *ipa_cfg)
{
return true;
}
/**
* wlan_ipa_is_clk_scaling_enabled() - Is IPA clock scaling enabled?
* @ipa_cfg: IPA config
*
* Return: true if IPA clock scaling is enabled, false otherwise
*/
static inline
bool wlan_ipa_is_clk_scaling_enabled(struct wlan_ipa_config *ipa_cfg)
{
return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg,
WLAN_IPA_CLK_SCALING_ENABLE_MASK);
}
static inline int wlan_ipa_wdi_rm_request_resource(
struct wlan_ipa_priv *ipa_ctx,
qdf_ipa_rm_resource_name_t res_name)
{
return 0;
}
static inline int wlan_ipa_wdi_rm_release_resource(
struct wlan_ipa_priv *ipa_ctx,
qdf_ipa_rm_resource_name_t res_name)
{
return 0;
}
static inline QDF_STATUS wlan_ipa_wdi_setup_rm(struct wlan_ipa_priv *ipa_ctx)
{
return 0;
}
static inline int wlan_ipa_wdi_destroy_rm(struct wlan_ipa_priv *ipa_ctx)
{
return 0;
}
static inline QDF_STATUS wlan_ipa_wdi_rm_request(struct wlan_ipa_priv *ipa_ctx)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS wlan_ipa_wdi_rm_try_release(struct wlan_ipa_priv
*ipa_ctx)
{
return QDF_STATUS_SUCCESS;
}
static inline
int wlan_ipa_wdi_rm_notify_completion(qdf_ipa_rm_event_t event,
qdf_ipa_rm_resource_name_t res_name)
{
return 0;
}
static inline
int wlan_ipa_wdi_rm_inactivity_timer_destroy(
qdf_ipa_rm_resource_name_t res_name)
{
return 0;
}
static inline
bool wlan_ipa_is_rm_released(struct wlan_ipa_priv *ipa_ctx)
{
return true;
}
#endif /* CONFIG_IPA_WDI_UNIFIED_API */
#ifdef FEATURE_METERING
#ifndef WDI3_STATS_UPDATE
/**
* wlan_ipa_uc_op_metering() - IPA uC operation for stats and quota limit
* @ipa_ctx: IPA context
* @op_msg: operation message received from firmware
*
* Return: QDF_STATUS enumeration
*/
QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx,
struct op_msg_type *op_msg);
#else
static inline
QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx,
struct op_msg_type *op_msg)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* wlan_ipa_wdi_meter_notifier_cb() - SSR wrapper for
* __wlan_ipa_wdi_meter_notifier_cb
* @priv: pointer to private data registered with IPA (we register a
* pointer to the global IPA context)
* @evt: the IPA event which triggered the callback
* @data: data associated with the event
*
* Return: None
*/
void wlan_ipa_wdi_meter_notifier_cb(qdf_ipa_wdi_meter_evt_type_t evt,
void *data);
/**
* wlan_ipa_init_metering() - IPA metering stats completion event reset
* @ipa_ctx: IPA context
*
* Return: QDF_STATUS enumeration
*/
void wlan_ipa_init_metering(struct wlan_ipa_priv *ipa_ctx);
#ifdef WDI3_STATS_UPDATE
/**
* wlan_ipa_update_tx_stats() - send embedded tx traffic in bytes to IPA
* @ipa_ctx: IPA context
* @sta_tx: tx in bytes on sta interface
* @sap_tx: tx in bytes on sap interface
*
* Return: void
*/
void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx, uint64_t sta_tx,
uint64_t sap_tx);
#else
static inline void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx,
uint64_t sta_tx, uint64_t sap_tx)
{
}
#endif /* WDI3_STATS_UPDATE */
#else
static inline
QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx,
struct op_msg_type *op_msg)
{
return QDF_STATUS_SUCCESS;
}
static inline void wlan_ipa_wdi_meter_notifier_cb(void)
{
}
static inline void wlan_ipa_init_metering(struct wlan_ipa_priv *ipa_ctx)
{
}
static inline void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx,
uint64_t sta_tx, uint64_t sap_tx)
{
}
#endif /* FEATURE_METERING */
/**
* wlan_ipa_uc_stat() - Print IPA uC stats
* @ipa_ctx: IPA context
*
* Return: None
*/
void wlan_ipa_uc_stat(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_uc_info() - Print IPA uC resource and session information
* @ipa_ctx: IPA context
*
* Return: None
*/
void wlan_ipa_uc_info(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_print_fw_wdi_stats() - Print FW IPA WDI stats
* @ipa_ctx: IPA context
*
* Return: None
*/
void wlan_ipa_print_fw_wdi_stats(struct wlan_ipa_priv *ipa_ctx,
struct ipa_uc_fw_stats *uc_fw_stat);
/**
* wlan_ipa_uc_stat_request() - Get IPA stats from IPA
* @ipa_ctx: IPA context
* @reason: STAT REQ Reason
*
* Return: None
*/
void wlan_ipa_uc_stat_request(struct wlan_ipa_priv *ipa_ctx, uint8_t reason);
/**
* wlan_ipa_uc_stat_query() - Query the IPA stats
* @ipa_ctx: IPA context
* @ipa_tx_diff: tx packet count diff from previous tx packet count
* @ipa_rx_diff: rx packet count diff from previous rx packet count
*
* Return: None
*/
void wlan_ipa_uc_stat_query(struct wlan_ipa_priv *ipa_ctx,
uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff);
/**
* wlan_ipa_dump_info() - dump IPA IPA struct
* @ipa_ctx: IPA context
*
* Dump entire struct ipa_ctx
*
* Return: none
*/
void wlan_ipa_dump_info(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_uc_rt_debug_host_dump - dump rt debug buffer
* @ipa_ctx: IPA context
*
* If rt debug enabled, dump debug buffer contents based on requirement
*
* Return: none
*/
void wlan_ipa_uc_rt_debug_host_dump(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_uc_rt_debug_destructor() - called by data packet free
* @nbuff: packet pinter
*
* when free data packet, will be invoked by wlan client and will increase
* free counter
*
* Return: none
*/
void wlan_ipa_uc_rt_debug_destructor(qdf_nbuf_t nbuff);
/**
* wlan_ipa_uc_rt_debug_deinit() - remove resources to handle rt debugging
* @ipa_ctx: IPA context
*
* free all rt debugging resources
*
* Return: none
*/
void wlan_ipa_uc_rt_debug_deinit(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_uc_rt_debug_init() - initialize resources to handle rt debugging
* @ipa_ctx: IPA context
*
* alloc and initialize all rt debugging resources
*
* Return: none
*/
void wlan_ipa_uc_rt_debug_init(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_reg_sap_xmit_cb() - Register upper layer SAP cb to transmit
* @ipa_ctx: IPA context
* @cb: callback
*
* Return: None
*/
static inline
void wlan_ipa_reg_sap_xmit_cb(struct wlan_ipa_priv *ipa_ctx,
wlan_ipa_softap_xmit cb)
{
ipa_ctx->softap_xmit = cb;
}
/**
* wlan_ipa_reg_send_to_nw_cb() - Register cb to send IPA Rx packet to network
* @ipa_ctx: IPA context
* @cb: callback
*
* Return: None
*/
static inline
void wlan_ipa_reg_send_to_nw_cb(struct wlan_ipa_priv *ipa_ctx,
wlan_ipa_send_to_nw cb)
{
ipa_ctx->send_to_nw = cb;
}
#ifdef QCA_CONFIG_RPS
/**
* wlan_ipa_reg_rps_enable_cb() - Register callback to enable RPS
* @ipa_ctx: IPA context
* @cb: callback
*
* Return: None
*/
static inline
void wlan_ipa_reg_rps_enable_cb(struct wlan_ipa_priv *ipa_ctx,
wlan_ipa_rps_enable cb)
{
ipa_ctx->rps_enable = cb;
}
/**
* ipa_set_rps_enable(): Enable/disable RPS for all interfaces of specific mode
* @ipa_ctx: IPA context
* @mode: mode of interface for which RPS needs to be enabled
* @enable: Set true to enable RPS
*
* Return: None
*/
void ipa_set_rps(struct wlan_ipa_priv *ipa_ctx, enum QDF_OPMODE mode,
bool enable);
/**
* ipa_set_rps_per_vdev(): Enable/disable RPS for a specific vdev
* @ipa_ctx: IPA context
* @vdev_id: vdev id for which RPS needs to be enabled
* @enable: Set true to enable RPS
*
* Return: None
*/
static inline
void ipa_set_rps_per_vdev(struct wlan_ipa_priv *ipa_ctx, uint8_t vdev_id,
bool enable)
{
if (ipa_ctx->rps_enable)
ipa_ctx->rps_enable(vdev_id, enable);
}
/**
* wlan_ipa_handle_multiple_sap_evt() - Handle multiple SAP connect/disconnect
* @ipa_ctx: IPA global context
* @type: IPA event type.
*
* This function is used to disable pipes when multiple SAP are connected and
* enable pipes back when only one SAP is connected.
*
* Return: None
*/
void wlan_ipa_handle_multiple_sap_evt(struct wlan_ipa_priv *ipa_ctx,
qdf_ipa_wlan_event type);
#else
static inline
void ipa_set_rps(struct wlan_ipa_priv *ipa_ctx, enum QDF_OPMODE mode,
bool enable)
{
}
static inline
void ipa_set_rps_per_vdev(struct wlan_ipa_priv *ipa_ctx, uint8_t vdev_id,
bool enable)
{
}
static inline
void wlan_ipa_handle_multiple_sap_evt(struct wlan_ipa_priv *ipa_ctx,
qdf_ipa_wlan_event type)
{
}
#endif
/**
* wlan_ipa_set_mcc_mode() - Set MCC mode
* @ipa_ctx: IPA context
* @mcc_mode: 1=MCC/0=SCC
*
* Return: void
*/
void wlan_ipa_set_mcc_mode(struct wlan_ipa_priv *ipa_ctx, bool mcc_mode);
/**
* wlan_ipa_set_dfs_cac_tx() - Set DFS cac tx block
* @ipa_ctx: IPA context
* @tx_block: dfs cac tx block
*
* Return: void
*/
static inline
void wlan_ipa_set_dfs_cac_tx(struct wlan_ipa_priv *ipa_ctx, bool tx_block)
{
ipa_ctx->dfs_cac_block_tx = tx_block;
}
/**
* wlan_ipa_set_ap_ibss_fwd() - Set AP intra bss forward
* @ipa_ctx: IPA context
* @session_id: vdev id
* @intra_bss: 1 to disable ap intra bss forward and 0 to enable ap intra bss
* forward
*
* Return: void
*/
static inline
void wlan_ipa_set_ap_ibss_fwd(struct wlan_ipa_priv *ipa_ctx, uint8_t session_id,
bool intra_bss)
{
if (session_id >= WLAN_IPA_MAX_SESSION)
return;
ipa_ctx->disable_intrabss_fwd[session_id] = intra_bss;
}
/**
* wlan_ipa_uc_ol_init() - Initialize IPA uC offload
* @ipa_ctx: IPA context
* @osdev: Parent device instance
*
* This function is called to update IPA pipe configuration with resources
* allocated by wlan driver (cds_pre_enable) before enabling it in FW
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_uc_ol_init(struct wlan_ipa_priv *ipa_ctx,
qdf_device_t osdev);
/**
* wlan_ipa_uc_ol_deinit() - Disconnect IPA TX and RX pipes
* @ipa_ctx: IPA context
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_uc_ol_deinit(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_flush() - flush IPA exception path SKB's
* @ipa_ctx: IPA context
*
* Return: None
*/
void wlan_ipa_flush(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_suspend() - Suspend IPA
* @ipa_ctx: IPA context
*
* Return: QDF STATUS
*/
QDF_STATUS wlan_ipa_suspend(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_resume() - Resume IPA
* @ipa_ctx: IPA context
*
* Return: QDF STATUS
*/
QDF_STATUS wlan_ipa_resume(struct wlan_ipa_priv *ipa_ctx);
#ifndef QCA_LL_TX_FLOW_CONTROL_V2
/**
* wlan_ipa_send_mcc_scc_msg() - Send IPA WLAN_SWITCH_TO_MCC/SCC message
* @ipa_ctx: IPA context
* @mcc_mode: 0=MCC/1=SCC
*
* Return: QDF STATUS
*/
QDF_STATUS wlan_ipa_send_mcc_scc_msg(struct wlan_ipa_priv *ipa_ctx,
bool mcc_mode);
#else
static inline
QDF_STATUS wlan_ipa_send_mcc_scc_msg(struct wlan_ipa_priv *ipa_ctx,
bool mcc_mode)
{
return QDF_STATUS_SUCCESS;
}
static inline void wlan_ipa_mcc_work_handler(void *data)
{
}
#endif
/**
* wlan_ipa_wlan_evt() - IPA event handler
* @net_dev: Interface net device
* @device_mode: Net interface device mode
* @session_id: session id for the event
* @type: event enum of type ipa_wlan_event
* @mac_address: MAC address associated with the event
* @is_2g_iface: true if interface is operating on 2G band, otherwise false
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode,
uint8_t session_id,
enum wlan_ipa_wlan_event ipa_event_type,
uint8_t *mac_addr, bool is_2g_iface);
/**
* wlan_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC
* @map: Map / unmap operation
* @num_buf: Number of buffers in array
* @buf_arr: Buffer array of DMA mem mapping info
*
* This API maps/unmaps WLAN-IPA buffers if SMMU S1 translation
* is enabled.
*
* Return: Status of map operation
*/
int wlan_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr);
/**
* wlan_ipa_is_fw_wdi_activated() - Is FW WDI actived?
* @ipa_ctx: IPA contex
*
* Return: true if FW WDI actived, false otherwise
*/
bool wlan_ipa_is_fw_wdi_activated(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_uc_cleanup_sta - disconnect and cleanup sta iface
* @ipa_ctx: IPA context
* @net_dev: Interface net device
*
* Send disconnect sta event to IPA driver and cleanup IPA iface
* if not yet done
*
* Return: void
*/
void wlan_ipa_uc_cleanup_sta(struct wlan_ipa_priv *ipa_ctx,
qdf_netdev_t net_dev);
/**
* wlan_ipa_uc_disconnect_ap() - send ap disconnect event
* @ipa_ctx: IPA context
* @net_dev: Interface net device
*
* Send disconnect ap event to IPA driver
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_uc_disconnect_ap(struct wlan_ipa_priv *ipa_ctx,
qdf_netdev_t net_dev);
/**
* wlan_ipa_cleanup_dev_iface() - Clean up net dev IPA interface
* @ipa_ctx: IPA context
* @net_dev: Interface net device
*
* Return: None
*/
void wlan_ipa_cleanup_dev_iface(struct wlan_ipa_priv *ipa_ctx,
qdf_netdev_t net_dev);
/**
* wlan_ipa_uc_ssr_cleanup() - handle IPA UC clean up during SSR
* @ipa_ctx: IPA context
*
* Return: None
*/
void wlan_ipa_uc_ssr_cleanup(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_fw_rejuvenate_send_msg() - send fw rejuvenate message to IPA driver
* @ipa_ctx: IPA context
*
* Return: void
*/
void wlan_ipa_fw_rejuvenate_send_msg(struct wlan_ipa_priv *ipa_ctx);
/**
* wlan_ipa_flush_pending_vdev_events() - flush pending vdev ipa events
* @ipa_ctx: IPA context
* vdev_id: vdev id
*
* This function is to flush vdev wlan ipa pending events
*
* Return: None
*/
void wlan_ipa_flush_pending_vdev_events(struct wlan_ipa_priv *ipa_ctx,
uint8_t vdev_id);
#endif /* IPA_OFFLOAD */
#endif /* _WLAN_IPA_CORE_H_ */

View File

@@ -1,548 +0,0 @@
/*
* Copyright (c) 2018-2021 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: declare various api which shall be used by
* IPA user configuration and target interface
*/
#ifndef _WLAN_IPA_MAIN_H_
#define _WLAN_IPA_MAIN_H_
#ifdef IPA_OFFLOAD
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_objmgr_pdev_obj.h>
#include <wlan_ipa_public_struct.h>
#include <wlan_ipa_priv.h>
#define ipa_fatal(params...) \
QDF_TRACE_FATAL(QDF_MODULE_ID_IPA, params)
#define ipa_err(params...) \
QDF_TRACE_ERROR(QDF_MODULE_ID_IPA, params)
#define ipa_warn(params...) \
QDF_TRACE_WARN(QDF_MODULE_ID_IPA, params)
#define ipa_info(params...) \
QDF_TRACE_INFO(QDF_MODULE_ID_IPA, params)
#define ipa_debug(params...) \
QDF_TRACE_DEBUG(QDF_MODULE_ID_IPA, params)
#define ipa_nofl_fatal(params...) \
QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_IPA, params)
#define ipa_nofl_err(params...) \
QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_IPA, params)
#define ipa_nofl_warn(params...) \
QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_IPA, params)
#define ipa_nofl_info(params...) \
QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_IPA, params)
#define ipa_nofl_debug(params...) \
QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_IPA, params)
#define ipa_fatal_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_IPA, params)
#define ipa_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_IPA, params)
#define ipa_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_IPA, params)
#define ipa_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_IPA, params)
#define ipa_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_IPA, params)
#define IPA_ENTER() \
QDF_TRACE_ENTER(QDF_MODULE_ID_IPA, "enter")
#define IPA_EXIT() \
QDF_TRACE_EXIT(QDF_MODULE_ID_IPA, "exit")
/**
* ipa_check_hw_present() - get IPA hw status
*
* ipa_uc_reg_rdyCB is not directly designed to check
* ipa hw status. This is an undocumented function which
* has confirmed with IPA team.
*
* Return: true - ipa hw present
* false - ipa hw not present
*/
bool ipa_check_hw_present(void);
/**
* wlan_get_pdev_ipa_obj() - private API to get ipa pdev object
* @pdev: pdev object
*
* Return: ipa object
*/
static inline struct wlan_ipa_priv *
ipa_pdev_get_priv_obj(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *pdev_obj;
pdev_obj = (struct wlan_ipa_priv *)
wlan_objmgr_pdev_get_comp_private_obj(pdev,
WLAN_UMAC_COMP_IPA);
return pdev_obj;
}
/**
* ipa_priv_obj_get_pdev() - API to get pdev from IPA object
* @ipa_obj: IPA object
*
* Return: pdev object
*/
static inline struct wlan_objmgr_pdev *
ipa_priv_obj_get_pdev(struct wlan_ipa_priv *ipa_obj)
{
return ipa_obj->pdev;
}
/**
* ipa_is_hw_support() - Is IPA HW support?
*
* Return: true if IPA HW is present or false otherwise
*/
bool ipa_is_hw_support(void);
/**
* ipa_config_mem_alloc() - IPA config allocation
*
* Return: QDF_STATUS_SUCCESS on success
*/
QDF_STATUS ipa_config_mem_alloc(void);
/**
* ipa_config_mem_free() - IPA config mem free
*
* Return: None
*/
void ipa_config_mem_free(void);
/**
* ipa_config_is_enabled() - Is IPA config enabled?
*
* Return: true if IPA is enabled in IPA config
*/
bool ipa_config_is_enabled(void);
/**
* ipa_config_is_uc_enabled() - Is IPA uC config enabled?
*
* Return: true if IPA uC is enabled in IPA config
*/
bool ipa_config_is_uc_enabled(void);
/**
* ipa_obj_setup() - IPA obj initialization and setup
* @ipa_ctx: IPA obj context
*
* Return: QDF_STATUS_SUCCESS on success
*/
QDF_STATUS ipa_obj_setup(struct wlan_ipa_priv *ipa_ctx);
/**
* ipa_obj_cleanup() - IPA obj cleanup
* @ipa_ctx: IPA obj context
*
* Return: QDF_STATUS_SUCCESS on success
*/
QDF_STATUS ipa_obj_cleanup(struct wlan_ipa_priv *ipa_ctx);
/**
* ipa_send_uc_offload_enable_disable() - wdi enable/disable notify to fw
* @pdev: objmgr pdev object
* @req: ipa offload control request
*
* Return: QDF status success or failure
*/
QDF_STATUS ipa_send_uc_offload_enable_disable(struct wlan_objmgr_pdev *pdev,
struct ipa_uc_offload_control_params *req);
/**
* ipa_send_intrabss_enable_disable() - wdi intrabss enable/disable notify to fw
* @pdev: objmgr pdev object
* @req: ipa intrabss control request
*
* Return: QDF status success or failure
*/
QDF_STATUS
ipa_send_intrabss_enable_disable(struct wlan_objmgr_pdev *pdev,
struct ipa_intrabss_control_params *req);
/**
* ipa_set_dp_handle() - set dp soc handle
* @psoc: psoc handle
* @dp_soc: dp soc handle
*
* Return: None
*/
void ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc, void *dp_soc);
/**
* ipa_set_pdev_id() - set dp pdev id
* @psoc: psoc handle
* @pdev_id: dp txrx physical device id
*
* Return: None
*/
void ipa_set_pdev_id(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id);
/**
* ipa_rm_set_perf_level() - set ipa rm perf level
* @pdev: pdev handle
* @tx_packets: packets transmitted in the last sample period
* @rx_packets: packets received in the last sample period
*
* Return: QDF_STATUS
*/
QDF_STATUS ipa_rm_set_perf_level(struct wlan_objmgr_pdev *pdev,
uint64_t tx_packets, uint64_t rx_packets);
/**
* ipa_uc_info() - Print IPA uC resource and session information
* @pdev: pdev obj
*
* Return: None
*/
void ipa_uc_info(struct wlan_objmgr_pdev *pdev);
/**
* ipa_uc_stat() - Print IPA uC stats
* @pdev: pdev obj
*
* Return: None
*/
void ipa_uc_stat(struct wlan_objmgr_pdev *pdev);
/**
* ipa_uc_rt_debug_host_dump() - IPA rt debug host dump
* @pdev: pdev obj
*
* Return: None
*/
void ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev);
/**
* ipa_dump_info() - Dump IPA context information
* @pdev: pdev obj
*
* Return: None
*/
void ipa_dump_info(struct wlan_objmgr_pdev *pdev);
/**
* ipa_uc_stat_request() - Get IPA stats from IPA.
* @pdev: pdev obj
* @reason: STAT REQ Reason
*
* Return: None
*/
void ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
uint8_t reason);
/**
* ipa_uc_stat_query() - Query the IPA stats
* @pdev: pdev obj
* @ipa_tx_diff: tx packet count diff from previous tx packet count
* @ipa_rx_diff: rx packet count diff from previous rx packet count
*
* Return: None
*/
void ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff);
/**
* ipa_reg_sap_xmit_cb() - Register upper layer SAP cb to transmit
* @pdev: pdev obj
* @cb: callback
*
* Return: None
*/
void ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_softap_xmit cb);
/**
* ipa_reg_send_to_nw_cb() - Register cb to send IPA Rx packet to network
* @pdev: pdev obj
* @cb: callback
*
* Return: None
*/
void ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_send_to_nw cb);
#ifdef QCA_CONFIG_RPS
/**
* ipa_reg_rps_enable_cb() - Register cb to enable RPS
* @pdev: pdev obj
* @cb: callback
*
* Return: None
*/
void ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_rps_enable cb);
#endif
/**
* ipa_set_mcc_mode() - Set MCC mode
* @pdev: pdev obj
* @mcc_mode: 0=MCC/1=SCC
*
* Return: void
*/
void ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode);
/**
* ipa_set_dfs_cac_tx() - Set DFS cac tx block
* @pdev: pdev obj
* @tx_block: dfs cac tx block
*
* Return: void
*/
void ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block);
/**
* ipa_set_ap_ibss_fwd() - Set AP intra bss forward
* @pdev: pdev obj
* @session_id: vdev id
* @intra_bss: enable or disable ap intra bss forward
*
* Return: void
*/
void ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, uint8_t session_id,
bool intra_bss);
/**
* ipa_uc_force_pipe_shutdown() - Force IPA pipe shutdown
* @pdev: pdev obj
*
* Return: void
*/
void ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev);
/**
* ipa_flush() - flush IPA exception path SKB's
* @pdev: pdev obj
*
* Return: None
*/
void ipa_flush(struct wlan_objmgr_pdev *pdev);
/**
* ipa_suspend() - Suspend IPA
* @pdev: pdev obj
*
* Return: QDF STATUS
*/
QDF_STATUS ipa_suspend(struct wlan_objmgr_pdev *pdev);
/**
* ipa_resume() - Resume IPA
* @pdev: pdev obj
*
* Return: None
*/
QDF_STATUS ipa_resume(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_uc_ol_init() - Initialize IPA uC offload
* @pdev: pdev obj
* @osdev: OS dev
*
* Return: QDF STATUS
*/
QDF_STATUS ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
qdf_device_t osdev);
/**
* ucfg_ipa_uc_ol_deinit() - Deinitialize IPA uC offload
* @pdev: pdev obj
*
* Return: QDF STATUS
*/
QDF_STATUS ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev);
/**
* ipa_is_tx_pending() - Check if IPA WLAN TX completions are pending
* @pdev: pdev obj
*
* Return: bool if pending TX for IPA.
*/
bool ipa_is_tx_pending(struct wlan_objmgr_pdev *pdev);
/**
* ipa_send_mcc_scc_msg() - Send IPA WLAN_SWITCH_TO_MCC/SCC message
* @pdev: pdev obj
* @mcc_mode: 0=MCC/1=SCC
*
* Return: QDF STATUS
*/
QDF_STATUS ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
bool mcc_mode);
/**
* ipa_wlan_evt() - IPA event handler
* @pdev: pdev obj
* @net_dev: Interface net device
* @device_mode: Net interface device mode
* @session_id: session id for the event
* @type: event enum of type ipa_wlan_event
* @mac_address: MAC address associated with the event
* @is_2g_iface: true if interface is operating on 2G band, otherwise false
*
* Return: QDF_STATUS
*/
QDF_STATUS ipa_wlan_evt(struct wlan_objmgr_pdev *pdev, qdf_netdev_t net_dev,
uint8_t device_mode, uint8_t session_id,
enum wlan_ipa_wlan_event ipa_event_type,
uint8_t *mac_addr, bool is_2g_iface);
/**
* ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC
* @map: Map / unmap operation
* @num_buf: Number of buffers in array
* @buf_arr: Buffer array of DMA mem mapping info
*
* Return: Status of map operation
*/
int ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr);
/**
* ipa_is_fw_wdi_activated - Is FW WDI activated?
* @pdev: pdev obj
*
* Return: true if FW WDI activated, false otherwise
*/
bool ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev);
/**
* ipa_uc_cleanup_sta() - disconnect and cleanup sta iface
* @pdev: pdev obj
* @net_dev: Interface net device
*
* Send disconnect sta event to IPA driver and cleanup IPA iface,
* if not yet done
*
* Return: void
*/
void ipa_uc_cleanup_sta(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev);
/**
* ipa_uc_disconnect_ap() - send ap disconnect event
* @pdev: pdev obj
* @net_dev: Interface net device
*
* Send disconnect ap event to IPA driver
*
* Return: QDF_STATUS
*/
QDF_STATUS ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev);
/**
* ipa_cleanup_dev_iface() - Clean up net dev IPA interface
* @pdev: pdev obj
* @net_dev: Interface net device
*
* Return: None
*/
void ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev);
/**
* ipa_uc_ssr_cleanup() - handle IPA UC cleanup during SSR
* @pdev: pdev obj
*
* Return: None
*/
void ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev);
/**
* ipa_fw_rejuvenate_send_msg() - send fw rejuvenate message to IPA driver
* @pdev: pdev obj
*
* Return: None
*/
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_component_config_free() - Free ipa config
*
* Return: None
*/
void ipa_component_config_free(void);
/**
* 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);
/**
* ipa_update_tx_stats() - Update embedded tx traffic in bytes to IPA
* @pdev: pdev obj
* @sta_tx: tx in bytes on sta vdev
* @ap_tx: tx in bytes on sap vdev
*
* Return: None
*/
void ipa_update_tx_stats(struct wlan_objmgr_pdev *pdev, uint64_t sta_tx,
uint64_t ap_tx);
/**
* ipa_flush_pending_vdev_events() - flush pending vdev wlan ipa events
* @pdev: pdev obj
* @vdev_id: vdev id
*
* Return: None
*/
void ipa_flush_pending_vdev_events(struct wlan_objmgr_pdev *pdev,
uint8_t vdev_id);
/**
* ipa_cb_is_ready() - Is IPA register callback is invoked
*
* Return: true if IPA register callback is invoked or false
* otherwise
*/
bool ipa_cb_is_ready(void);
/**
* ipa_init_deinit_lock() - lock ipa init deinit lock
*
* Return: None
*/
void ipa_init_deinit_lock(void);
/**
* ipa_init_deinit_unlock() - unlock ipa init deinit lock
*
* Return: None
*/
void ipa_init_deinit_unlock(void);
#else /* Not IPA_OFFLOAD */
typedef QDF_STATUS (*wlan_ipa_softap_xmit)(qdf_nbuf_t nbuf, qdf_netdev_t dev);
typedef void (*wlan_ipa_send_to_nw)(qdf_nbuf_t nbuf, qdf_netdev_t dev);
typedef void (*wlan_ipa_rps_enable)(uint8_t vdev_id, bool enable);
#endif /* IPA_OFFLOAD */
#endif /* end of _WLAN_IPA_MAIN_H_ */

View File

@@ -1,800 +0,0 @@
/*
* Copyright (c) 2013-2021 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: Declare various struct, macros which are used privately in IPA
* component.
*/
#ifndef _WLAN_IPA_PRIV_STRUCT_H_
#define _WLAN_IPA_PRIV_STRUCT_H_
#ifdef IPA_OFFLOAD
#include <linux/version.h>
#include <linux/kernel.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \
defined(CONFIG_IPA_WDI_UNIFIED_API)
#include <qdf_ipa_wdi3.h>
#else
#include <qdf_ipa.h>
#endif
#include <qdf_net_types.h>
#include <qdf_mc_timer.h>
#include <qdf_list.h>
#include <qdf_defer.h>
#include "qdf_delayed_work.h"
#include <qdf_event.h>
#include "wlan_ipa_public_struct.h"
#define WLAN_IPA_RX_INACTIVITY_MSEC_DELAY 1000
#define WLAN_IPA_UC_WLAN_8023_HDR_SIZE 14
#define WLAN_IPA_UC_NUM_WDI_PIPE 2
#define WLAN_IPA_UC_MAX_PENDING_EVENT 33
#define WLAN_IPA_UC_DEBUG_DUMMY_MEM_SIZE 32000
#define WLAN_IPA_UC_RT_DEBUG_PERIOD 300
#define WLAN_IPA_UC_RT_DEBUG_BUF_COUNT 30
#define WLAN_IPA_UC_RT_DEBUG_FILL_INTERVAL 10000
#define WLAN_IPA_WLAN_HDR_DES_MAC_OFFSET 0
#define WLAN_IPA_MAX_IFACE MAX_IPA_IFACE
#define WLAN_IPA_CLIENT_MAX_IFACE 3
#define WLAN_IPA_MAX_SYSBAM_PIPE 4
#define WLAN_IPA_MAX_SESSION 5
#ifdef WLAN_MAX_CLIENTS_ALLOWED
#define WLAN_IPA_MAX_STA_COUNT WLAN_MAX_CLIENTS_ALLOWED
#else
#define WLAN_IPA_MAX_STA_COUNT 41
#endif
#define WLAN_IPA_RX_PIPE WLAN_IPA_MAX_IFACE
#define WLAN_IPA_ENABLE_MASK BIT(0)
#define WLAN_IPA_PRE_FILTER_ENABLE_MASK BIT(1)
#define WLAN_IPA_IPV6_ENABLE_MASK BIT(2)
#define WLAN_IPA_RM_ENABLE_MASK BIT(3)
#define WLAN_IPA_CLK_SCALING_ENABLE_MASK BIT(4)
#define WLAN_IPA_UC_ENABLE_MASK BIT(5)
#define WLAN_IPA_UC_STA_ENABLE_MASK BIT(6)
#define WLAN_IPA_REAL_TIME_DEBUGGING BIT(8)
#define WLAN_IPA_MAX_BANDWIDTH 800
#define WLAN_IPA_MAX_PENDING_EVENT_COUNT 20
#define IPA_WLAN_RX_SOFTIRQ_THRESH 32
#define WLAN_IPA_UC_BW_MONITOR_LEVEL 3
/**
* enum - IPA UC operation message
*
* @WLAN_IPA_UC_OPCODE_TX_SUSPEND: IPA WDI TX pipe suspend
* @WLAN_IPA_UC_OPCODE_TX_RESUME: IPA WDI TX pipe resume
* @WLAN_IPA_UC_OPCODE_RX_SUSPEND: IPA WDI RX pipe suspend
* @WLAN_IPA_UC_OPCODE_RX_RESUME: IPA WDI RX pipe resume
* @WLAN_IPA_UC_OPCODE_STATS: IPA UC stats
* @WLAN_IPA_UC_OPCODE_SHARING_STATS: IPA UC sharing stats
* @WLAN_IPA_UC_OPCODE_QUOTA_RSP: IPA UC quota response
* @WLAN_IPA_UC_OPCODE_QUOTA_IND: IPA UC quota indication
* @WLAN_IPA_UC_OPCODE_UC_READY: IPA UC ready indication
* @WLAN_IPA_UC_OPCODE_MAX: IPA UC max operation code
*/
enum wlan_ipa_uc_op_code {
WLAN_IPA_UC_OPCODE_TX_SUSPEND = 0,
WLAN_IPA_UC_OPCODE_TX_RESUME = 1,
WLAN_IPA_UC_OPCODE_RX_SUSPEND = 2,
WLAN_IPA_UC_OPCODE_RX_RESUME = 3,
WLAN_IPA_UC_OPCODE_STATS = 4,
#ifdef FEATURE_METERING
WLAN_IPA_UC_OPCODE_SHARING_STATS = 5,
WLAN_IPA_UC_OPCODE_QUOTA_RSP = 6,
WLAN_IPA_UC_OPCODE_QUOTA_IND = 7,
#endif
WLAN_IPA_UC_OPCODE_UC_READY = 8,
/* keep this last */
WLAN_IPA_UC_OPCODE_MAX
};
/**
* enum - Reason codes for stat query
*
* @WLAN_IPA_UC_STAT_REASON_NONE: Initial value
* @WLAN_IPA_UC_STAT_REASON_DEBUG: For debug/info
* @WLAN_IPA_UC_STAT_REASON_BW_CAL: For bandwidth calibration
* @WLAN_IPA_UC_STAT_REASON_DUMP_INFO: For debug info dump
*/
enum {
WLAN_IPA_UC_STAT_REASON_NONE,
WLAN_IPA_UC_STAT_REASON_DEBUG,
WLAN_IPA_UC_STAT_REASON_BW_CAL
};
/**
* enum wlan_ipa_rm_state - IPA resource manager state
* @WLAN_IPA_RM_RELEASED: PROD pipe resource released
* @WLAN_IPA_RM_GRANT_PENDING: PROD pipe resource requested but not granted yet
* @WLAN_IPA_RM_GRANTED: PROD pipe resource granted
*/
enum wlan_ipa_rm_state {
WLAN_IPA_RM_RELEASED,
WLAN_IPA_RM_GRANT_PENDING,
WLAN_IPA_RM_GRANTED,
};
/**
* enum wlan_ipa_forward_type: Type of forward packet received from IPA
* @WLAN_IPA_FORWARD_PKT_NONE: No forward packet
* @WLAN_IPA_FORWARD_PKT_LOCAL_STACK: Packet forwarded to kernel network stack
* @WLAN_IPA_FORWARD_PKT_DISCARD: Discarded packet before sending to kernel
*/
enum wlan_ipa_forward_type {
WLAN_IPA_FORWARD_PKT_NONE = 0,
WLAN_IPA_FORWARD_PKT_LOCAL_STACK = 1,
WLAN_IPA_FORWARD_PKT_DISCARD = 2
};
/**
* enum wlan_ipa_bw_level -ipa bandwidth level
* @WLAN_IPA_BW_LEVEL_LOW: vote for low bandwidth
* @WLAN_IPA_BW_LEVEL_MEDIUM: vote for medium bandwidth
* @WLAN_IPA_BW_LEVEL_HIGH: vote for high bandwidth
*/
enum wlan_ipa_bw_level {
WLAN_IPA_BW_LEVEL_LOW,
WLAN_IPA_BW_LEVEL_MEDIUM,
WLAN_IPA_BW_LEVEL_HIGH,
};
/**
* struct llc_snap_hdr - LLC snap header
* @dsap: Destination service access point
* @ssap: Source service access point
* @resv: Reserved for future use
* @eth_type: Ether type
*/
struct llc_snap_hdr {
uint8_t dsap;
uint8_t ssap;
uint8_t resv[4];
qdf_be16_t eth_type;
} qdf_packed;
/**
* struct wlan_ipa_tx_hdr - header type which IPA should handle to TX packet
* @eth: ether II header
* @llc_snap: LLC snap header
*/
struct wlan_ipa_tx_hdr {
qdf_ether_header_t eth;
struct llc_snap_hdr llc_snap;
} qdf_packed;
/**
* struct frag_header - fragment header type registered to IPA hardware
* @length: fragment length
* @reserved1: Reserved not used
* @reserved2: Reserved not used
*/
#if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) || \
defined(QCA_WIFI_QCA6490) || defined(QCA_WIFI_QCA6750) || \
defined(QCA_WIFI_WCN7850)
struct frag_header {
uint8_t reserved[0];
};
#elif defined(QCA_WIFI_3_0)
struct frag_header {
uint16_t length;
uint32_t reserved1;
uint32_t reserved2;
} qdf_packed;
#else
struct frag_header {
uint32_t
length:16,
reserved16:16;
uint32_t reserved2;
} qdf_packed;
#endif
/**
* struct ipa_header - ipa header type registered to IPA hardware
* @vdev_id: vdev id
* @reserved: Reserved not used
*/
#if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) || \
defined(QCA_WIFI_QCA6490) || defined(QCA_WIFI_QCA6750) || \
defined(QCA_WIFI_WCN7850)
struct ipa_header {
uint8_t reserved[0];
};
#else
struct ipa_header {
uint32_t
vdev_id:8, /* vdev_id field is LSB of IPA DESC */
reserved:24;
} qdf_packed;
#endif
/**
* struct wlan_ipa_uc_tx_hdr - full tx header registered to IPA hardware
* @frag_hd: fragment header
* @ipa_hd: ipa header
* @eth: ether II header
*/
struct wlan_ipa_uc_tx_hdr {
struct frag_header frag_hd;
struct ipa_header ipa_hd;
qdf_ether_header_t eth;
} qdf_packed;
/**
* struct wlan_ipa_cld_hdr - IPA CLD Header
* @reserved: reserved fields
* @iface_id: interface ID
* @sta_id: Station ID
*
* Packed 32-bit structure
* +----------+----------+--------------+--------+
* | Reserved | QCMAP ID | interface id | STA ID |
* +----------+----------+--------------+--------+
*/
struct wlan_ipa_cld_hdr {
uint8_t reserved[2];
uint8_t iface_id;
uint8_t sta_id;
} qdf_packed;
/**
* struct wlan_ipa_rx_hdr - IPA RX header
* @cld_hdr: IPA CLD header
* @eth: ether II header
*/
struct wlan_ipa_rx_hdr {
struct wlan_ipa_cld_hdr cld_hdr;
qdf_ether_header_t eth;
} qdf_packed;
/**
* struct wlan_ipa_pm_tx_cb - PM resume TX callback
* @exception: Exception packet
* @iface_context: Interface context
* @ipa_tx_desc: IPA TX descriptor
*/
struct wlan_ipa_pm_tx_cb {
bool exception;
struct wlan_ipa_iface_context *iface_context;
qdf_ipa_rx_data_t *ipa_tx_desc;
};
/**
* struct wlan_ipa_sys_pipe - IPA system pipe
* @conn_hdl: IPA system pipe connection handle
* @conn_hdl_valid: IPA system pipe valid flag
* @ipa_sys_params: IPA system pipe params
*/
struct wlan_ipa_sys_pipe {
uint32_t conn_hdl;
uint8_t conn_hdl_valid;
qdf_ipa_sys_connect_params_t ipa_sys_params;
};
/**
* struct wlan_ipa_iface_stats - IPA system pipe
* @num_tx: Number of TX packets
* @num_tx_drop: Number of TX packet drops
* @num_tx_err: Number of TX packet errors
* @num_tx_cac_drop: Number of TX packet drop due to CAC
* @num_rx_ipa_excep: Number of RX IPA exception packets
*/
struct wlan_ipa_iface_stats {
uint64_t num_tx;
uint64_t num_tx_drop;
uint64_t num_tx_err;
uint64_t num_tx_cac_drop;
uint64_t num_rx_ipa_excep;
};
/* IPA private context structure */
struct wlan_ipa_priv;
/**
* struct wlan_ipa_iface_context - IPA interface context
* @ipa_ctx: IPA private context
* @cons_client: IPA consumer pipe
* @prod_client: IPA producer pipe
* @prod_client: IPA producer pipe
* @iface_id: IPA interface ID
* @dev: Net device structure
* @device_mode: Interface device mode
* @session_id: Session ID
* @interface_lock: Interface lock
* @ifa_address: Interface address
* @stats: Interface stats
* @bssid: BSSID. valid only for sta iface ctx
* @is_authenticated: is peer authenticated
*/
struct wlan_ipa_iface_context {
struct wlan_ipa_priv *ipa_ctx;
qdf_ipa_client_type_t cons_client;
qdf_ipa_client_type_t prod_client;
uint8_t iface_id; /* This iface ID */
qdf_netdev_t dev;
enum QDF_OPMODE device_mode;
uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
qdf_atomic_t conn_count;
qdf_atomic_t disconn_count;
uint8_t session_id;
qdf_spinlock_t interface_lock;
uint32_t ifa_address;
struct wlan_ipa_iface_stats stats;
struct qdf_mac_addr bssid;
uint8_t is_authenticated;
};
/**
* struct wlan_ipa_stats - IPA system stats
* @event: WLAN IPA event record
* @num_send_msg: Number of sent IPA messages
* @num_rm_grant: Number of times IPA RM resource granted
* @num_rm_release: Number of times IPA RM resource released
* @num_rm_grant_imm: Number of immediate IPA RM granted
e @num_cons_perf_req: Number of CONS pipe perf request
* @num_prod_perf_req: Number of PROD pipe perf request
* @num_rx_drop: Number of RX packet drops
* @num_tx_desc_q_cnt: Number of TX descriptor queue count
* @num_tx_desc_err: Number of TX descriptor error
* @num_tx_comp_cnt: Number of TX qdf_event_t count
* @num_tx_queued: Number of TX queued
* @num_tx_dequeued: Number of TX dequeued
* @num_max_pm_queue: Number of packets in PM queue
* @num_rx_excep: Number of RX IPA exception packets
* @num_rx_no_iface_eapol: No of EAPOL pkts before iface setup
* @num_tx_fwd_ok: Number of TX forward packet success
* @num_tx_fwd_err: Number of TX forward packet failures
*/
struct wlan_ipa_stats {
uint32_t event[QDF_IPA_WLAN_EVENT_MAX];
uint64_t num_send_msg;
uint64_t num_free_msg;
uint64_t num_rm_grant;
uint64_t num_rm_release;
uint64_t num_rm_grant_imm;
uint64_t num_cons_perf_req;
uint64_t num_prod_perf_req;
uint64_t num_rx_drop;
uint64_t num_tx_desc_q_cnt;
uint64_t num_tx_desc_error;
uint64_t num_tx_comp_cnt;
uint64_t num_tx_queued;
uint64_t num_tx_dequeued;
uint64_t num_max_pm_queue;
uint64_t num_rx_excep;
uint64_t num_rx_no_iface_eapol;
uint64_t num_tx_fwd_ok;
uint64_t num_tx_fwd_err;
};
/**
* struct ipa_uc_stas_map - IPA UC assoc station map
* @is_reserved: STA reserved flag
* @is_authenticated: is peer authenticated
* @mac_addr: Station mac address
*/
struct ipa_uc_stas_map {
bool is_reserved;
struct qdf_mac_addr mac_addr;
uint8_t is_authenticated;
};
/**
* struct op_msg_type - IPA operation message type
* @msg_t: Message type
* @rsvd: Reserved
* @op_code: IPA Operation type
* @len: IPA message length
* @rsvd_snd: Reserved
*/
struct op_msg_type {
uint8_t msg_t;
uint8_t rsvd;
uint16_t op_code;
uint16_t len;
uint16_t rsvd_snd;
};
/**
* struct ipa_uc_fw_stats - IPA FW stats
* @tx_comp_ring_size: TX completion ring size
* @txcomp_ring_dbell_addr: TX comp ring door bell address
* @txcomp_ring_dbell_ind_val: TX cop ring door bell indication
* @txcomp_ring_dbell_cached_val: TX cop ring cached value
* @txpkts_enqueued: TX packets enqueued
* @txpkts_completed: TX packets completed
* @tx_is_suspend: TX suspend flag
* @tx_reserved: Reserved for TX stat
* @rx_ind_ring_base: RX indication ring base addess
* @rx_ind_ring_size: RX indication ring size
* @rx_ind_ring_dbell_addr: RX indication ring doorbell address
* @rx_ind_ring_dbell_ind_val: RX indication ring doorbell indication
* @rx_ind_ring_dbell_ind_cached_val: RX indication ring doorbell cached value
* @rx_ind_ring_rdidx_addr: RX indication ring read index address
* @rx_ind_ring_rd_idx_cached_val: RX indication ring read index cached value
* @rx_refill_idx: RX ring refill index
* @rx_num_pkts_indicated: Number of RX packets indicated
* @rx_buf_refilled: Number of RX buffer refilled
* @rx_num_ind_drop_no_space: Number of RX indication drops due to no space
* @rx_num_ind_drop_no_buf: Number of RX indication drops due to no buffer
* @rx_is_suspend: RX suspend flag
* @rx_reserved: Reserved for RX stat
*/
struct ipa_uc_fw_stats {
uint32_t tx_comp_ring_base;
uint32_t tx_comp_ring_size;
uint32_t tx_comp_ring_dbell_addr;
uint32_t tx_comp_ring_dbell_ind_val;
uint32_t tx_comp_ring_dbell_cached_val;
uint32_t tx_pkts_enqueued;
uint32_t tx_pkts_completed;
uint32_t tx_is_suspend;
uint32_t tx_reserved;
uint32_t rx_ind_ring_base;
uint32_t rx_ind_ring_size;
uint32_t rx_ind_ring_dbell_addr;
uint32_t rx_ind_ring_dbell_ind_val;
uint32_t rx_ind_ring_dbell_ind_cached_val;
uint32_t rx_ind_ring_rdidx_addr;
uint32_t rx_ind_ring_rd_idx_cached_val;
uint32_t rx_refill_idx;
uint32_t rx_num_pkts_indicated;
uint32_t rx_buf_refilled;
uint32_t rx_num_ind_drop_no_space;
uint32_t rx_num_ind_drop_no_buf;
uint32_t rx_is_suspend;
uint32_t rx_reserved;
};
/**
* struct wlan_ipa_uc_pending_event - WLAN IPA UC pending event
* @node: Pending event list node
* @type: WLAN IPA event type
* @device_mode: Device mode
* @session_id: Session ID
* @mac_addr: Mac address
* @is_loading: Driver loading flag
* @is_2g_iface: true if interface is operating on 2G band, otherwise false
*/
struct wlan_ipa_uc_pending_event {
qdf_list_node_t node;
qdf_ipa_wlan_event type;
qdf_netdev_t net_dev;
uint8_t device_mode;
uint8_t session_id;
uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
bool is_loading;
bool is_2g_iface;
};
/**
* struct uc_rm_work_struct
* @work: uC RM work
* @event: IPA RM event
*/
struct uc_rm_work_struct {
qdf_work_t work;
qdf_ipa_rm_event_t event;
};
/**
* struct uc_op_work_struct
* @work: uC OP work
* @msg: OP message
* @osdev: poiner to qdf net device, used by osif_psoc_sync_trans_start_wait
*/
struct uc_op_work_struct {
qdf_work_t work;
struct op_msg_type *msg;
qdf_device_t osdev;
};
/**
* struct uc_rt_debug_info
* @time: system time
* @ipa_excep_count: IPA exception packet count
* @rx_drop_count: IPA Rx drop packet count
* @net_sent_count: IPA Rx packet sent to network stack count
* @rx_discard_count: IPA Rx discard packet count
* @tx_fwd_ok_count: IPA Tx forward success packet count
* @tx_fwd_count: IPA Tx forward packet count
* @rx_destructor_call: IPA Rx packet destructor count
*/
struct uc_rt_debug_info {
uint64_t time;
uint64_t ipa_excep_count;
uint64_t rx_drop_count;
uint64_t net_sent_count;
uint64_t rx_discard_count;
uint64_t tx_fwd_ok_count;
uint64_t tx_fwd_count;
uint64_t rx_destructor_call;
};
#ifdef FEATURE_METERING
/**
* struct ipa_uc_sharing_stats - IPA UC sharing stats
* @ipv4_rx_packets: IPv4 RX packets
* @ipv4_rx_bytes: IPv4 RX bytes
* @ipv6_rx_packets: IPv6 RX packets
* @ipv6_rx_bytes: IPv6 RX bytes
* @ipv4_tx_packets: IPv4 TX packets
* @ipv4_tx_bytes: IPv4 TX bytes
* @ipv6_tx_packets: IPv4 TX packets
* @ipv6_tx_bytes: IPv6 TX bytes
*/
struct ipa_uc_sharing_stats {
uint64_t ipv4_rx_packets;
uint64_t ipv4_rx_bytes;
uint64_t ipv6_rx_packets;
uint64_t ipv6_rx_bytes;
uint64_t ipv4_tx_packets;
uint64_t ipv4_tx_bytes;
uint64_t ipv6_tx_packets;
uint64_t ipv6_tx_bytes;
};
/**
* struct ipa_uc_quota_rsp - IPA UC quota response
* @success: Success or fail flag
* @reserved[3]: Reserved
* @quota_lo: Quota limit low bytes
* @quota_hi: Quota limit high bytes
*/
struct ipa_uc_quota_rsp {
uint8_t success;
uint8_t reserved[3];
uint32_t quota_lo;
uint32_t quota_hi;
};
/**
* struct ipa_uc_quota_ind
* @quota_bytes: Quota bytes to set
*/
struct ipa_uc_quota_ind {
uint64_t quota_bytes;
};
#endif
/**
* struct wlan_ipa_tx_desc
* @node: TX descriptor node
* @priv: pointer to priv list entry
* @id: Tx desc idex
* @ipa_tx_desc_ptr: pointer to IPA Tx descriptor
*/
struct wlan_ipa_tx_desc {
qdf_list_node_t node;
void *priv;
uint32_t id;
qdf_ipa_rx_data_t *ipa_tx_desc_ptr;
};
typedef QDF_STATUS (*wlan_ipa_softap_xmit)(qdf_nbuf_t nbuf, qdf_netdev_t dev);
typedef void (*wlan_ipa_send_to_nw)(qdf_nbuf_t nbuf, qdf_netdev_t dev);
/**
* typedef wlan_ipa_rps_enable - Enable/disable RPS for adapter using vdev id
* @vdev_id: vdev_id of adapter
* @enable: Set true to enable RPS
*/
typedef void (*wlan_ipa_rps_enable)(uint8_t vdev_id, bool enable);
/* IPA private context structure definition */
struct wlan_ipa_priv {
struct wlan_objmgr_pdev *pdev;
struct wlan_ipa_sys_pipe sys_pipe[WLAN_IPA_MAX_SYSBAM_PIPE];
struct wlan_ipa_iface_context iface_context[WLAN_IPA_MAX_IFACE];
uint8_t num_iface;
void *dp_soc;
uint8_t dp_pdev_id;
struct wlan_ipa_config *config;
enum wlan_ipa_rm_state rm_state;
/*
* IPA driver can send RM notifications with IRQ disabled so using qdf
* APIs as it is taken care gracefully. Without this, kernel would throw
* an warning if spin_lock_bh is used while IRQ is disabled
*/
qdf_spinlock_t rm_lock;
struct uc_rm_work_struct uc_rm_work;
struct uc_op_work_struct uc_op_work[WLAN_IPA_UC_OPCODE_MAX];
qdf_wake_lock_t wake_lock;
struct qdf_delayed_work wake_lock_work;
bool wake_lock_released;
qdf_atomic_t tx_ref_cnt;
qdf_nbuf_queue_t pm_queue_head;
qdf_work_t pm_work;
qdf_spinlock_t pm_lock;
bool suspended;
qdf_spinlock_t q_lock;
qdf_spinlock_t enable_disable_lock;
/* Flag to indicate wait on pending TX completions */
qdf_atomic_t waiting_on_pending_tx;
/* Timer ticks to keep track of time after which pipes are disabled */
uint64_t pending_tx_start_ticks;
/* Indicates if cdp_ipa_disable_autonomy is called for IPA pipes */
qdf_atomic_t autonomy_disabled;
/* Indicates if cdp_disable_ipa_pipes has been called for IPA pipes */
qdf_atomic_t pipes_disabled;
/*
* IPA pipes are considered "down" when both autonomy_disabled and
* ipa_pipes_disabled are set
*/
bool ipa_pipes_down;
/* Flag for mutual exclusion during IPA disable pipes */
bool pipes_down_in_progress;
/* Flag for mutual exclusion during IPA enable pipes */
bool pipes_enable_in_progress;
qdf_list_node_t pend_desc_head;
struct wlan_ipa_tx_desc *tx_desc_pool;
qdf_list_t tx_desc_free_list;
struct wlan_ipa_stats stats;
uint32_t curr_prod_bw;
uint32_t curr_cons_bw;
uint8_t activated_fw_pipe;
uint8_t num_sap_connected;
uint8_t sap_num_connected_sta;
uint8_t sta_connected;
uint32_t tx_pipe_handle;
uint32_t rx_pipe_handle;
bool resource_loading;
bool resource_unloading;
bool pending_cons_req;
struct ipa_uc_stas_map assoc_stas_map[WLAN_IPA_MAX_STA_COUNT];
qdf_list_t pending_event;
qdf_mutex_t event_lock;
uint32_t ipa_tx_packets_diff;
uint32_t ipa_rx_packets_diff;
uint32_t ipa_p_tx_packets;
uint32_t ipa_p_rx_packets;
uint32_t stat_req_reason;
uint64_t ipa_tx_forward;
uint64_t ipa_rx_discard;
uint64_t ipa_rx_net_send_count;
uint64_t ipa_rx_internal_drop_count;
uint64_t ipa_rx_destructor_count;
qdf_mc_timer_t rt_debug_timer;
struct uc_rt_debug_info rt_bug_buffer[WLAN_IPA_UC_RT_DEBUG_BUF_COUNT];
unsigned int rt_buf_fill_index;
qdf_ipa_wdi_in_params_t cons_pipe_in;
qdf_ipa_wdi_in_params_t prod_pipe_in;
bool uc_loaded;
bool wdi_enabled;
bool over_gsi;
qdf_mc_timer_t rt_debug_fill_timer;
qdf_mutex_t rt_debug_lock;
qdf_mutex_t ipa_lock;
uint8_t vdev_to_iface[WLAN_IPA_MAX_SESSION];
bool vdev_offload_enabled[WLAN_IPA_MAX_SESSION];
bool mcc_mode;
qdf_work_t mcc_work;
bool disable_intrabss_fwd[WLAN_IPA_MAX_SESSION];
bool dfs_cac_block_tx;
#ifdef FEATURE_METERING
struct ipa_uc_sharing_stats ipa_sharing_stats;
struct ipa_uc_quota_rsp ipa_quota_rsp;
struct ipa_uc_quota_ind ipa_quota_ind;
qdf_event_t ipa_uc_sharing_stats_comp;
qdf_event_t ipa_uc_set_quota_comp;
#endif
wlan_ipa_softap_xmit softap_xmit;
wlan_ipa_send_to_nw send_to_nw;
ipa_uc_offload_control_req ipa_tx_op;
ipa_intrabss_control_req ipa_intrabss_op;
#ifdef QCA_CONFIG_RPS
/*Callback to enable RPS for STA in STA+SAP scenario*/
wlan_ipa_rps_enable rps_enable;
#endif
qdf_event_t ipa_resource_comp;
uint32_t wdi_version;
bool is_smmu_enabled; /* IPA caps returned from ipa_wdi_init */
qdf_atomic_t stats_quota;
uint8_t curr_bw_level;
qdf_atomic_t deinit_in_prog;
};
#define WLAN_IPA_WLAN_FRAG_HEADER sizeof(struct frag_header)
#define WLAN_IPA_WLAN_IPA_HEADER sizeof(struct ipa_header)
#define WLAN_IPA_WLAN_CLD_HDR_LEN sizeof(struct wlan_ipa_cld_hdr)
#define WLAN_IPA_UC_WLAN_CLD_HDR_LEN 0
#define WLAN_IPA_WLAN_TX_HDR_LEN sizeof(struct wlan_ipa_tx_hdr)
#define WLAN_IPA_UC_WLAN_TX_HDR_LEN sizeof(struct wlan_ipa_uc_tx_hdr)
#define WLAN_IPA_WLAN_RX_HDR_LEN sizeof(struct wlan_ipa_rx_hdr)
#define WLAN_IPA_UC_WLAN_HDR_DES_MAC_OFFSET \
(WLAN_IPA_WLAN_FRAG_HEADER + WLAN_IPA_WLAN_IPA_HEADER)
#define WLAN_IPA_GET_IFACE_ID(_data) \
(((struct wlan_ipa_cld_hdr *) (_data))->iface_id)
#define WLAN_IPA_LOG(LVL, fmt, args ...) \
QDF_TRACE(QDF_MODULE_ID_IPA, LVL, \
"%s:%d: "fmt, __func__, __LINE__, ## args)
#define WLAN_IPA_IS_CONFIG_ENABLED(_ipa_cfg, _mask) \
(((_ipa_cfg)->ipa_config & (_mask)) == (_mask))
#define BW_GET_DIFF(_x, _y) (unsigned long)((ULONG_MAX - (_y)) + (_x) + 1)
#define IPA_RESOURCE_COMP_WAIT_TIME 500
#ifdef FEATURE_METERING
#define IPA_UC_SHARING_STATES_WAIT_TIME 500
#define IPA_UC_SET_QUOTA_WAIT_TIME 500
#endif
/**
* wlan_ipa_wlan_event_to_str() - convert IPA WLAN event to string
* @event: IPA WLAN event to be converted to a string
*
* Return: ASCII string representing the IPA WLAN event
*/
static inline char *wlan_ipa_wlan_event_to_str(qdf_ipa_wlan_event event)
{
switch (event) {
CASE_RETURN_STRING(QDF_IPA_CLIENT_CONNECT);
CASE_RETURN_STRING(QDF_IPA_CLIENT_DISCONNECT);
CASE_RETURN_STRING(QDF_IPA_AP_CONNECT);
CASE_RETURN_STRING(QDF_IPA_AP_DISCONNECT);
CASE_RETURN_STRING(QDF_IPA_STA_CONNECT);
CASE_RETURN_STRING(QDF_IPA_STA_DISCONNECT);
CASE_RETURN_STRING(QDF_IPA_CLIENT_CONNECT_EX);
CASE_RETURN_STRING(QDF_SWITCH_TO_SCC);
CASE_RETURN_STRING(QDF_SWITCH_TO_MCC);
CASE_RETURN_STRING(QDF_WDI_ENABLE);
CASE_RETURN_STRING(QDF_WDI_DISABLE);
default:
return "UNKNOWN";
}
}
/**
* wlan_ipa_get_iface() - Get IPA interface
* @ipa_ctx: IPA context
* @mode: Interface device mode
*
* Return: IPA interface address
*/
struct wlan_ipa_iface_context
*wlan_ipa_get_iface(struct wlan_ipa_priv *ipa_ctx, uint8_t mode);
#endif /* IPA_OFFLOAD */
#endif /* _WLAN_IPA_PRIV_STRUCT_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,842 +0,0 @@
/*
* Copyright (c) 2018-2021 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: contains ipa component main function definitions
*/
#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;
bool ipa_check_hw_present(void)
{
/* Check if ipa hw is enabled */
if (qdf_ipa_uc_reg_rdyCB(NULL) != -EPERM) {
g_ipa_hw_support = true;
return true;
} else {
return false;
}
}
QDF_STATUS ipa_config_mem_alloc(void)
{
struct wlan_ipa_config *ipa_cfg;
if (g_ipa_config)
return QDF_STATUS_SUCCESS;
ipa_cfg = qdf_mem_malloc(sizeof(*ipa_cfg));
if (!ipa_cfg)
return QDF_STATUS_E_NOMEM;
g_ipa_config = ipa_cfg;
return QDF_STATUS_SUCCESS;
}
void ipa_config_mem_free(void)
{
if (!g_ipa_config) {
ipa_err("IPA config already freed");
return;
}
qdf_mem_free(g_ipa_config);
g_ipa_config = NULL;
}
bool ipa_is_hw_support(void)
{
return g_ipa_hw_support;
}
bool ipa_config_is_enabled(void)
{
return g_ipa_config ? wlan_ipa_is_enabled(g_ipa_config) : 0;
}
bool ipa_config_is_uc_enabled(void)
{
return g_ipa_config ? wlan_ipa_uc_is_enabled(g_ipa_config) : 0;
}
QDF_STATUS ipa_obj_setup(struct wlan_ipa_priv *ipa_ctx)
{
return wlan_ipa_setup(ipa_ctx, g_ipa_config);
}
QDF_STATUS ipa_obj_cleanup(struct wlan_ipa_priv *ipa_ctx)
{
return wlan_ipa_cleanup(ipa_ctx);
}
QDF_STATUS ipa_send_uc_offload_enable_disable(struct wlan_objmgr_pdev *pdev,
struct ipa_uc_offload_control_params *req)
{
return tgt_ipa_uc_offload_enable_disable(pdev, req);
}
QDF_STATUS
ipa_send_intrabss_enable_disable(struct wlan_objmgr_pdev *pdev,
struct ipa_intrabss_control_params *req)
{
return tgt_ipa_intrabss_enable_disable(pdev, req);
}
void ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc, void *dp_soc)
{
struct wlan_objmgr_pdev *pdev;
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
pdev = wlan_objmgr_get_pdev_by_id(psoc, 0,
WLAN_IPA_ID);
if (!pdev) {
ipa_err("Failed to get pdev handle");
return;
}
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
wlan_objmgr_pdev_release_ref(pdev, WLAN_IPA_ID);
return;
}
ipa_obj->dp_soc = dp_soc;
wlan_objmgr_pdev_release_ref(pdev, WLAN_IPA_ID);
}
void ipa_set_pdev_id(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id)
{
struct wlan_objmgr_pdev *pdev;
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
pdev = wlan_objmgr_get_pdev_by_id(psoc, 0,
WLAN_IPA_ID);
if (!pdev) {
ipa_err("Failed to get pdev handle");
return;
}
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
wlan_objmgr_pdev_release_ref(pdev, WLAN_IPA_ID);
return;
}
ipa_obj->dp_pdev_id = pdev_id;
wlan_objmgr_pdev_release_ref(pdev, WLAN_IPA_ID);
}
QDF_STATUS ipa_rm_set_perf_level(struct wlan_objmgr_pdev *pdev,
uint64_t tx_packets, uint64_t rx_packets)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return QDF_STATUS_SUCCESS;
}
if (!ipa_cb_is_ready())
return QDF_STATUS_SUCCESS;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return QDF_STATUS_E_FAILURE;
}
return wlan_ipa_set_perf_level(ipa_obj, tx_packets, rx_packets);
}
void ipa_uc_info(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_uc_info(ipa_obj);
}
void ipa_uc_stat(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_uc_stat(ipa_obj);
}
void ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_uc_rt_debug_host_dump(ipa_obj);
}
void ipa_dump_info(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_dump_info(ipa_obj);
}
void ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev, uint8_t reason)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_uc_stat_request(ipa_obj, reason);
}
void ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_uc_stat_query(ipa_obj, ipa_tx_diff, ipa_rx_diff);
}
void ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev, wlan_ipa_softap_xmit cb)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_reg_sap_xmit_cb(ipa_obj, cb);
}
void ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_send_to_nw cb)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_reg_send_to_nw_cb(ipa_obj, cb);
}
#ifdef QCA_CONFIG_RPS
void ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_rps_enable cb)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_reg_rps_enable_cb(ipa_obj, cb);
}
#endif
void ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_set_mcc_mode(ipa_obj, mcc_mode);
}
void ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_set_dfs_cac_tx(ipa_obj, tx_block);
}
void ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, uint8_t session_id,
bool intra_bss)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_set_ap_ibss_fwd(ipa_obj, session_id, intra_bss);
}
void ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!pdev) {
ipa_debug("objmgr pdev is null!");
return;
}
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
wlan_ipa_uc_disable_pipes(ipa_obj, true);
}
void ipa_flush(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return;
}
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_flush(ipa_obj);
}
QDF_STATUS ipa_suspend(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return QDF_STATUS_SUCCESS;
}
if (!ipa_cb_is_ready())
return QDF_STATUS_SUCCESS;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return QDF_STATUS_E_FAILURE;
}
return wlan_ipa_suspend(ipa_obj);
}
QDF_STATUS ipa_resume(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return QDF_STATUS_SUCCESS;
}
if (!ipa_cb_is_ready())
return QDF_STATUS_SUCCESS;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return QDF_STATUS_E_FAILURE;
}
return wlan_ipa_resume(ipa_obj);
}
QDF_STATUS ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
qdf_device_t osdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return QDF_STATUS_SUCCESS;
}
if (!ipa_cb_is_ready())
return QDF_STATUS_SUCCESS;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return QDF_STATUS_E_FAILURE;
}
return wlan_ipa_uc_ol_init(ipa_obj, osdev);
}
bool ipa_is_tx_pending(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return QDF_STATUS_SUCCESS;
}
if (!ipa_cb_is_ready())
return QDF_STATUS_SUCCESS;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
return wlan_ipa_is_tx_pending(ipa_obj);
}
QDF_STATUS ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
QDF_STATUS status;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return QDF_STATUS_SUCCESS;
}
ipa_init_deinit_lock();
if (!ipa_cb_is_ready()) {
ipa_debug("ipa is not ready");
status = QDF_STATUS_SUCCESS;
goto out;
}
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
status = QDF_STATUS_E_FAILURE;
goto out;
}
status = wlan_ipa_uc_ol_deinit(ipa_obj);
out:
ipa_init_deinit_unlock();
return status;
}
QDF_STATUS ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
bool mcc_mode)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("ipa is disabled");
return QDF_STATUS_SUCCESS;
}
if (!ipa_cb_is_ready())
return QDF_STATUS_SUCCESS;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return QDF_STATUS_E_FAILURE;
}
return wlan_ipa_send_mcc_scc_msg(ipa_obj, mcc_mode);
}
QDF_STATUS ipa_wlan_evt(struct wlan_objmgr_pdev *pdev, qdf_netdev_t net_dev,
uint8_t device_mode, uint8_t session_id,
enum wlan_ipa_wlan_event ipa_event_type,
uint8_t *mac_addr, bool is_2g_iface)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_cb_is_ready())
return QDF_STATUS_SUCCESS;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return QDF_STATUS_E_FAILURE;
}
return wlan_ipa_wlan_evt(net_dev, device_mode, session_id,
ipa_event_type, mac_addr, is_2g_iface);
}
int ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr)
{
return wlan_ipa_uc_smmu_map(map, num_buf, buf_arr);
}
bool ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug_rl("ipa is disabled");
return false;
}
if (!ipa_cb_is_ready()) {
ipa_debug("ipa is not ready");
return false;
}
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err_rl("IPA object is NULL");
return false;
}
return wlan_ipa_is_fw_wdi_activated(ipa_obj);
}
void ipa_uc_cleanup_sta(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_cb_is_ready()) {
ipa_debug("ipa is not ready");
return;
}
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_uc_cleanup_sta(ipa_obj, net_dev);
}
QDF_STATUS ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_cb_is_ready())
return QDF_STATUS_SUCCESS;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return QDF_STATUS_E_FAILURE;
}
return wlan_ipa_uc_disconnect_ap(ipa_obj, net_dev);
}
void ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_cleanup_dev_iface(ipa_obj, net_dev);
}
void ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_uc_ssr_cleanup(ipa_obj);
}
void ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev)
{
struct wlan_ipa_priv *ipa_obj;
if (!pdev) {
ipa_debug("objmgr pdev is null!");
return;
}
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
return wlan_ipa_fw_rejuvenate_send_msg(ipa_obj);
}
void ipa_component_config_update(struct wlan_objmgr_psoc *psoc)
{
QDF_STATUS status;
status = ipa_config_mem_alloc();
if (QDF_IS_STATUS_ERROR(status)) {
ipa_err("Failed to alloc g_ipa_config");
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);
g_ipa_config->ipa_force_voting =
cfg_get(psoc, CFG_DP_IPA_ENABLE_FORCE_VOTING);
}
void ipa_component_config_free(void)
{
ipa_info("Free the IPA config memory");
ipa_config_mem_free();
}
uint32_t ipa_get_tx_buf_count(void)
{
return g_ipa_config ? g_ipa_config->txbuf_count : 0;
}
void ipa_update_tx_stats(struct wlan_objmgr_pdev *pdev, uint64_t sta_tx,
uint64_t ap_tx)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
wlan_ipa_update_tx_stats(ipa_obj, sta_tx, ap_tx);
}
void ipa_flush_pending_vdev_events(struct wlan_objmgr_pdev *pdev,
uint8_t vdev_id)
{
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled())
return;
if (!ipa_cb_is_ready())
return;
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
wlan_ipa_flush_pending_vdev_events(ipa_obj, vdev_id);
}

View File

@@ -1,508 +0,0 @@
/*
* Copyright (c) 2013-2021 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.
*/
/* Include Files */
#include "qdf_delayed_work.h"
#include "wlan_ipa_core.h"
#include "wlan_ipa_main.h"
#include "cdp_txrx_ipa.h"
#include "host_diag_core_event.h"
QDF_STATUS wlan_ipa_set_perf_level(struct wlan_ipa_priv *ipa_ctx,
uint64_t tx_packets,
uint64_t rx_packets)
{
int ret;
uint32_t next_bw;
uint64_t total_packets = tx_packets + rx_packets;
if ((!wlan_ipa_is_enabled(ipa_ctx->config)) ||
(!wlan_ipa_is_clk_scaling_enabled(ipa_ctx->config)))
return 0;
if (total_packets > (ipa_ctx->config->bus_bw_high / 2))
next_bw = ipa_ctx->config->ipa_bw_high;
else if (total_packets > (ipa_ctx->config->bus_bw_medium / 2))
next_bw = ipa_ctx->config->ipa_bw_medium;
else
next_bw = ipa_ctx->config->ipa_bw_low;
if (ipa_ctx->curr_cons_bw != next_bw) {
ipa_debug("Requesting IPA perf curr: %d, next: %d",
ipa_ctx->curr_cons_bw, next_bw);
ret = cdp_ipa_set_perf_level(ipa_ctx->dp_soc,
QDF_IPA_CLIENT_WLAN1_CONS,
next_bw);
if (ret) {
ipa_err("RM CONS set perf profile failed: %d", ret);
return QDF_STATUS_E_FAILURE;
}
ret = cdp_ipa_set_perf_level(ipa_ctx->dp_soc,
QDF_IPA_CLIENT_WLAN1_PROD,
next_bw);
if (ret) {
ipa_err("RM PROD set perf profile failed: %d", ret);
return QDF_STATUS_E_FAILURE;
}
ipa_ctx->curr_cons_bw = next_bw;
ipa_ctx->stats.num_cons_perf_req++;
}
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_ipa_init_perf_level(struct wlan_ipa_priv *ipa_ctx)
{
int ret;
/* Set lowest bandwidth to start with */
if (wlan_ipa_is_clk_scaling_enabled(ipa_ctx->config))
return wlan_ipa_set_perf_level(ipa_ctx, 0, 0);
ipa_debug("IPA clk scaling disabled. Set perf level to maximum %d",
WLAN_IPA_MAX_BANDWIDTH);
ret = cdp_ipa_set_perf_level(ipa_ctx->dp_soc,
QDF_IPA_CLIENT_WLAN1_CONS,
WLAN_IPA_MAX_BANDWIDTH);
if (ret) {
ipa_err("CONS set perf profile failed: %d", ret);
return QDF_STATUS_E_FAILURE;
}
ret = cdp_ipa_set_perf_level(ipa_ctx->dp_soc,
QDF_IPA_CLIENT_WLAN1_PROD,
WLAN_IPA_MAX_BANDWIDTH);
if (ret) {
ipa_err("PROD set perf profile failed: %d", ret);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
#ifdef FEATURE_METERING
void wlan_ipa_init_metering(struct wlan_ipa_priv *ipa_ctx)
{
qdf_event_create(&ipa_ctx->ipa_uc_sharing_stats_comp);
qdf_event_create(&ipa_ctx->ipa_uc_set_quota_comp);
}
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)) && \
!defined(CONFIG_IPA_WDI_UNIFIED_API)
/**
* wlan_ipa_rm_cons_release() - WLAN consumer resource release handler
*
* Callback function registered with IPA that is called when IPA wants
* to release the WLAN consumer resource
*
* Return: 0 if the request is granted, negative errno otherwise
*/
static int wlan_ipa_rm_cons_release(void)
{
return 0;
}
/**
* wlan_ipa_wdi_rm_request() - Request resource from IPA
* @ipa_ctx: IPA context
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_ipa_wdi_rm_request(struct wlan_ipa_priv *ipa_ctx)
{
int ret;
if (!wlan_ipa_is_rm_enabled(ipa_ctx->config))
return QDF_STATUS_SUCCESS;
qdf_spin_lock_bh(&ipa_ctx->rm_lock);
switch (ipa_ctx->rm_state) {
case WLAN_IPA_RM_GRANTED:
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
return QDF_STATUS_SUCCESS;
case WLAN_IPA_RM_GRANT_PENDING:
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
return QDF_STATUS_E_PENDING;
case WLAN_IPA_RM_RELEASED:
ipa_ctx->rm_state = WLAN_IPA_RM_GRANT_PENDING;
break;
}
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
ret = qdf_ipa_rm_inactivity_timer_request_resource(
QDF_IPA_RM_RESOURCE_WLAN_PROD);
qdf_spin_lock_bh(&ipa_ctx->rm_lock);
if (ret == 0) {
ipa_ctx->rm_state = WLAN_IPA_RM_GRANTED;
ipa_ctx->stats.num_rm_grant_imm++;
}
if (ipa_ctx->wake_lock_released) {
qdf_wake_lock_acquire(&ipa_ctx->wake_lock,
WIFI_POWER_EVENT_WAKELOCK_IPA);
ipa_ctx->wake_lock_released = false;
}
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
qdf_delayed_work_stop_sync(&ipa_ctx->wake_lock_work);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS wlan_ipa_wdi_rm_try_release(struct wlan_ipa_priv *ipa_ctx)
{
int ret;
if (!wlan_ipa_is_rm_enabled(ipa_ctx->config))
return QDF_STATUS_SUCCESS;
if (qdf_atomic_read(&ipa_ctx->tx_ref_cnt))
return QDF_STATUS_E_AGAIN;
qdf_spin_lock_bh(&ipa_ctx->pm_lock);
if (!qdf_nbuf_is_queue_empty(&ipa_ctx->pm_queue_head)) {
qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
return QDF_STATUS_E_AGAIN;
}
qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
qdf_spin_lock_bh(&ipa_ctx->rm_lock);
switch (ipa_ctx->rm_state) {
case WLAN_IPA_RM_GRANTED:
break;
case WLAN_IPA_RM_GRANT_PENDING:
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
return QDF_STATUS_E_PENDING;
case WLAN_IPA_RM_RELEASED:
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
return QDF_STATUS_SUCCESS;
}
/* IPA driver returns immediately so set the state here to avoid any
* race condition.
*/
ipa_ctx->rm_state = WLAN_IPA_RM_RELEASED;
ipa_ctx->stats.num_rm_release++;
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
ret = qdf_ipa_rm_inactivity_timer_release_resource(
QDF_IPA_RM_RESOURCE_WLAN_PROD);
if (qdf_unlikely(ret != 0)) {
qdf_spin_lock_bh(&ipa_ctx->rm_lock);
ipa_ctx->rm_state = WLAN_IPA_RM_GRANTED;
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
QDF_ASSERT(0);
ipa_warn("rm_inactivity_timer_release_resource ret fail");
}
/*
* If wake_lock is released immediately, kernel would try to suspend
* immediately as well, Just avoid ping-pong between suspend-resume
* while there is healthy amount of data transfer going on by
* releasing the wake_lock after some delay.
*/
qdf_delayed_work_start(&ipa_ctx->wake_lock_work,
WLAN_IPA_RX_INACTIVITY_MSEC_DELAY);
return QDF_STATUS_SUCCESS;
}
/**
* wlan_ipa_uc_rm_notify_handler() - IPA uC resource notification handler
* @ipa_ctx: IPA context
* @event: IPA RM event
*
* Return: None
*/
static void
wlan_ipa_uc_rm_notify_handler(struct wlan_ipa_priv *ipa_ctx,
qdf_ipa_rm_event_t event)
{
if (!wlan_ipa_is_rm_enabled(ipa_ctx->config))
return;
ipa_debug("event code %d", event);
switch (event) {
case QDF_IPA_RM_RESOURCE_GRANTED:
/* Differed RM Granted */
qdf_mutex_acquire(&ipa_ctx->ipa_lock);
if ((!ipa_ctx->resource_unloading) &&
(!ipa_ctx->activated_fw_pipe)) {
wlan_ipa_uc_enable_pipes(ipa_ctx);
ipa_ctx->resource_loading = false;
}
qdf_mutex_release(&ipa_ctx->ipa_lock);
break;
case QDF_IPA_RM_RESOURCE_RELEASED:
/* Differed RM Released */
ipa_ctx->resource_unloading = false;
break;
default:
ipa_err("invalid event code %d", event);
break;
}
}
/**
* wlan_ipa_uc_rm_notify_defer() - Defer IPA uC notification
* * @data: IPA context
*
* This function is called when a resource manager event is received
* from firmware in interrupt context. This function will defer the
* handling to the OL RX thread
*
* Return: None
*/
static void wlan_ipa_uc_rm_notify_defer(void *data)
{
struct wlan_ipa_priv *ipa_ctx = data;
qdf_ipa_rm_event_t event;
struct uc_rm_work_struct *uc_rm_work = &ipa_ctx->uc_rm_work;
event = uc_rm_work->event;
wlan_ipa_uc_rm_notify_handler(ipa_ctx, event);
}
/**
* wlan_ipa_wake_lock_timer_func() - Wake lock work handler
* @data: IPA context
*
* When IPA resources are released in wlan_ipa_wdi_rm_try_release() we do
* not want to immediately release the wake lock since the system
* would then potentially try to suspend when there is a healthy data
* rate. Deferred work is scheduled and this function handles the
* work. When this function is called, if the IPA resource is still
* released then we release the wake lock.
*
* Return: None
*/
static void wlan_ipa_wake_lock_timer_func(void *data)
{
struct wlan_ipa_priv *ipa_ctx = data;
qdf_spin_lock_bh(&ipa_ctx->rm_lock);
if (ipa_ctx->rm_state != WLAN_IPA_RM_RELEASED)
goto end;
ipa_ctx->wake_lock_released = true;
qdf_wake_lock_release(&ipa_ctx->wake_lock,
WIFI_POWER_EVENT_WAKELOCK_IPA);
end:
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
}
/**
* wlan_ipa_rm_cons_request() - WLAN consumer resource request handler
*
* Callback function registered with IPA that is called when IPA wants
* to access the WLAN consumer resource
*
* Return: 0 if the request is granted, negative errno otherwise
*/
static int wlan_ipa_rm_cons_request(void)
{
struct wlan_ipa_priv *ipa_ctx;
QDF_STATUS status = QDF_STATUS_SUCCESS;
ipa_ctx = wlan_ipa_get_obj_context();
if (ipa_ctx->resource_loading) {
ipa_err("IPA resource loading in progress");
ipa_ctx->pending_cons_req = true;
status = QDF_STATUS_E_PENDING;
} else if (ipa_ctx->resource_unloading) {
ipa_err("IPA resource unloading in progress");
ipa_ctx->pending_cons_req = true;
status = QDF_STATUS_E_PERM;
}
return qdf_status_to_os_return(status);
}
/**
* wlan_ipa_rm_notify() - IPA resource manager notifier callback
* @user_data: user data registered with IPA
* @event: the IPA resource manager event that occurred
* @data: the data associated with the event
*
* Return: None
*/
static void wlan_ipa_rm_notify(void *user_data, qdf_ipa_rm_event_t event,
unsigned long data)
{
struct wlan_ipa_priv *ipa_ctx = user_data;
if (qdf_unlikely(!ipa_ctx))
return;
if (!wlan_ipa_is_rm_enabled(ipa_ctx->config))
return;
ipa_debug("Evt: %d", event);
switch (event) {
case QDF_IPA_RM_RESOURCE_GRANTED:
if (wlan_ipa_uc_is_enabled(ipa_ctx->config)) {
/* RM Notification comes with ISR context
* it should be serialized into work queue to avoid
* ISR sleep problem
*/
ipa_ctx->uc_rm_work.event = event;
qdf_sched_work(0, &ipa_ctx->uc_rm_work.work);
break;
}
qdf_spin_lock_bh(&ipa_ctx->rm_lock);
ipa_ctx->rm_state = WLAN_IPA_RM_GRANTED;
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
ipa_ctx->stats.num_rm_grant++;
break;
case QDF_IPA_RM_RESOURCE_RELEASED:
ipa_debug("RM Release");
ipa_ctx->resource_unloading = false;
break;
default:
ipa_err("Unknown RM Evt: %d", event);
break;
}
}
QDF_STATUS wlan_ipa_wdi_setup_rm(struct wlan_ipa_priv *ipa_ctx)
{
qdf_ipa_rm_create_params_t create_params;
QDF_STATUS status;
int ret;
if (!wlan_ipa_is_rm_enabled(ipa_ctx->config))
return 0;
qdf_create_work(0, &ipa_ctx->uc_rm_work.work,
wlan_ipa_uc_rm_notify_defer, ipa_ctx);
qdf_mem_zero(&create_params, sizeof(create_params));
create_params.name = QDF_IPA_RM_RESOURCE_WLAN_PROD;
create_params.reg_params.user_data = ipa_ctx;
create_params.reg_params.notify_cb = wlan_ipa_rm_notify;
create_params.floor_voltage = QDF_IPA_VOLTAGE_LEVEL;
ret = qdf_ipa_rm_create_resource(&create_params);
if (ret) {
ipa_err("Create RM resource failed: %d", ret);
goto setup_rm_fail;
}
qdf_mem_zero(&create_params, sizeof(create_params));
create_params.name = QDF_IPA_RM_RESOURCE_WLAN_CONS;
create_params.request_resource = wlan_ipa_rm_cons_request;
create_params.release_resource = wlan_ipa_rm_cons_release;
create_params.floor_voltage = QDF_IPA_VOLTAGE_LEVEL;
ret = qdf_ipa_rm_create_resource(&create_params);
if (ret) {
ipa_err("Create RM CONS resource failed: %d", ret);
goto delete_prod;
}
qdf_ipa_rm_add_dependency(QDF_IPA_RM_RESOURCE_WLAN_PROD,
QDF_IPA_RM_RESOURCE_APPS_CONS);
ret = qdf_ipa_rm_inactivity_timer_init(QDF_IPA_RM_RESOURCE_WLAN_PROD,
WLAN_IPA_RX_INACTIVITY_MSEC_DELAY);
if (ret) {
ipa_err("Timer init failed: %d", ret);
goto timer_init_failed;
}
status = qdf_delayed_work_create(&ipa_ctx->wake_lock_work,
wlan_ipa_wake_lock_timer_func,
ipa_ctx);
if (QDF_IS_STATUS_ERROR(status))
goto timer_destroy;
qdf_wake_lock_create(&ipa_ctx->wake_lock, "wlan_ipa");
qdf_spinlock_create(&ipa_ctx->rm_lock);
ipa_ctx->rm_state = WLAN_IPA_RM_RELEASED;
ipa_ctx->wake_lock_released = true;
qdf_atomic_set(&ipa_ctx->tx_ref_cnt, 0);
return QDF_STATUS_SUCCESS;
timer_destroy:
qdf_ipa_rm_inactivity_timer_destroy(QDF_IPA_RM_RESOURCE_WLAN_PROD);
timer_init_failed:
qdf_ipa_rm_delete_resource(QDF_IPA_RM_RESOURCE_APPS_CONS);
delete_prod:
qdf_ipa_rm_delete_resource(QDF_IPA_RM_RESOURCE_WLAN_PROD);
setup_rm_fail:
return QDF_STATUS_E_FAILURE;
}
void wlan_ipa_wdi_destroy_rm(struct wlan_ipa_priv *ipa_ctx)
{
int ret;
if (!wlan_ipa_is_rm_enabled(ipa_ctx->config))
return;
qdf_wake_lock_destroy(&ipa_ctx->wake_lock);
qdf_delayed_work_destroy(&ipa_ctx->wake_lock_work);
qdf_cancel_work(&ipa_ctx->uc_rm_work.work);
qdf_spinlock_destroy(&ipa_ctx->rm_lock);
qdf_ipa_rm_inactivity_timer_destroy(QDF_IPA_RM_RESOURCE_WLAN_PROD);
ret = qdf_ipa_rm_delete_resource(QDF_IPA_RM_RESOURCE_WLAN_CONS);
if (ret)
ipa_err("RM CONS resource delete failed %d", ret);
ret = qdf_ipa_rm_delete_resource(QDF_IPA_RM_RESOURCE_WLAN_PROD);
if (ret)
ipa_err("RM PROD resource delete failed %d", ret);
}
bool wlan_ipa_is_rm_released(struct wlan_ipa_priv *ipa_ctx)
{
qdf_spin_lock_bh(&ipa_ctx->rm_lock);
if (ipa_ctx->rm_state != WLAN_IPA_RM_RELEASED) {
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
return false;
}
qdf_spin_unlock_bh(&ipa_ctx->rm_lock);
return true;
}
#endif /* CONFIG_IPA_WDI_UNIFIED_API */

File diff suppressed because it is too large Load Diff

View File

@@ -1,210 +0,0 @@
/*
* Copyright (c) 2012-2019 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
*/
/*
* <ini>
* gIPAConfig - IPA configuration
* @Min: 0
* @Max: 0xFFFFFFFF
* @Default: 0
*
* This ini specifies the IPA configuration
*
* Related: N/A
*
* Supported Feature: IPA
*
* Usage: Internal
*
* </ini>
*/
#define CFG_DP_IPA_OFFLOAD_CONFIG \
CFG_INI_UINT("gIPAConfig", \
0, \
0xFFFFFFFF, \
0, \
CFG_VALUE_OR_DEFAULT, "IPA offload configuration")
/*
* <ini>
* 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
*
* </ini>
*/
#define CFG_DP_IPA_DESC_SIZE \
CFG_INI_UINT("gIPADescSize", \
800, \
8000, \
800, \
CFG_VALUE_OR_DEFAULT, "IPA DESC SIZE")
/*
* <ini>
* 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
*
* </ini>
*/
#define CFG_DP_IPA_HIGH_BANDWIDTH_MBPS \
CFG_INI_UINT("gIPAHighBandwidthMbps", \
200, \
1000, \
400, \
CFG_VALUE_OR_DEFAULT, "IPA high bw threshold")
/*
* <ini>
* gIPAMediumBandwidthMbps - 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
*
* </ini>
*/
#define CFG_DP_IPA_MEDIUM_BANDWIDTH_MBPS \
CFG_INI_UINT("gIPAMediumBandwidthMbps", \
100, \
400, \
200, \
CFG_VALUE_OR_DEFAULT, "IPA medium bw threshold")
/*
* <ini>
* gIPALowBandwidthMbps - 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
*
* </ini>
*/
#define CFG_DP_IPA_LOW_BANDWIDTH_MBPS \
CFG_INI_UINT("gIPALowBandwidthMbps", \
0, \
100, \
100, \
CFG_VALUE_OR_DEFAULT, "IPA low bw threshold")
/*
* <ini>
* gIPAForceVotingEnable - IPA force voting enable
* @Default: false
*
* This ini specifies to enable IPA force voting
*
* Related: N/A
*
* Supported Feature: IPA
*
* Usage: Internal
*
* </ini>
*/
#define CFG_DP_IPA_ENABLE_FORCE_VOTING \
CFG_INI_BOOL("gIPAForceVotingEnable", \
false, "Ctrl to enable force voting")
/*
* <ini>
* 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
*
* </ini>
*/
#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_ENABLE_FORCE_VOTING) \
CFG(CFG_DP_IPA_UC_TX_BUF_COUNT)
#endif /* _CFG_IPA_H_ */

View File

@@ -1,101 +0,0 @@
/*
* Copyright (c) 2018, 2020-2021 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: Declare public API related to the wlan ipa called by north bound
*/
#ifndef _WLAN_IPA_OBJ_MGMT_H_
#define _WLAN_IPA_OBJ_MGMT_H_
#include "wlan_ipa_public_struct.h"
#include "wlan_objmgr_pdev_obj.h"
#include "wlan_ipa_main.h"
#ifdef IPA_OFFLOAD
/**
* ipa_init() - IPA module initialization
*
* Return: QDF_STATUS_SUCCESS on success
*/
QDF_STATUS ipa_init(void);
/**
* ipa_deinit() - IPA module deinitialization
*
* Return: QDF_STATUS_SUCCESS on success
*/
QDF_STATUS ipa_deinit(void);
/**
* ipa_register_is_ipa_ready() - Register IPA ready callback
* @pdev: pointer to pdev
*
* Return: QDF_STATUS_SUCCESS on success
*/
QDF_STATUS ipa_register_is_ipa_ready(struct wlan_objmgr_pdev *pdev);
/**
* ipa_disable_register_cb() - Reset the IPA is ready flag
*
* Return: Set the ipa_is_ready flag to false when module is
* unloaded to indicate that ipa ready cb is not registered
*/
void ipa_disable_register_cb(void);
/**
* wlan_ipa_config_is_enabled() - api to get IPA enable status
*
* Return: true - ipa is enabled
* false - ipa is not enabled
*/
static inline bool wlan_ipa_config_is_enabled(void)
{
return ipa_config_is_enabled();
}
#else
static inline QDF_STATUS ipa_init(void)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS ipa_deinit(void)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS ipa_register_is_ipa_ready(
struct wlan_objmgr_pdev *pdev)
{
return QDF_STATUS_SUCCESS;
}
static inline void ipa_disable_register_cb(void)
{
}
static inline bool wlan_ipa_config_is_enabled(void)
{
return false;
}
#endif /* IPA_OFFLOAD */
#endif /* _WLAN_IPA_OBJ_MGMT_H_ */

View File

@@ -1,107 +0,0 @@
/*
* 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
* 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: contains ipa public structure definitions
*/
#ifndef _WLAN_IPA_PUBLIC_STRUCT_H_
#define _WLAN_IPA_PUBLIC_STRUCT_H_
#include <wlan_cmn.h>
#include <qdf_status.h>
#include <wlan_objmgr_psoc_obj.h>
/**
* struct wlan_ipa_config
* @ipa_config: IPA config
* @desc_size: IPA descriptor size
* @txbuf_count: TX buffer count
* @bus_bw_high: Bus bandwidth high threshold
* @bus_bw_medium: Bus bandwidth medium threshold
* @bus_bw_low: Bus bandwidth low threshold
* @ipa_bw_high: IPA bandwidth high threshold
* @ipa_bw_medium: IPA bandwidth medium threshold
* @ipa_bw_low: IPA bandwidth low threshold
* @ipa_force_voting: support force bw voting
*/
struct wlan_ipa_config {
uint32_t ipa_config;
uint32_t desc_size;
uint32_t txbuf_count;
uint32_t bus_bw_high;
uint32_t bus_bw_medium;
uint32_t bus_bw_low;
uint32_t ipa_bw_high;
uint32_t ipa_bw_medium;
uint32_t ipa_bw_low;
bool ipa_force_voting;
};
/**
* enum wlan_ipa_wlan_event - WLAN IPA events
* @WLAN_IPA_CLIENT_CONNECT: Client Connects
* @WLAN_IPA_CLIENT_DISCONNECT: Client Disconnects
* @WLAN_IPA_AP_CONNECT: SoftAP is started
* @WLAN_IPA_AP_DISCONNECT: SoftAP is stopped
* @WLAN_IPA_STA_CONNECT: STA associates to AP
* @WLAN_IPA_STA_DISCONNECT: STA dissociates from AP
* @WLAN_IPA_CLIENT_CONNECT_EX: Peer associates/re-associates to softap
* @WLAN_IPA_WLAN_EVENT_MAX: Max value for the enum
*/
enum wlan_ipa_wlan_event {
WLAN_IPA_CLIENT_CONNECT,
WLAN_IPA_CLIENT_DISCONNECT,
WLAN_IPA_AP_CONNECT,
WLAN_IPA_AP_DISCONNECT,
WLAN_IPA_STA_CONNECT,
WLAN_IPA_STA_DISCONNECT,
WLAN_IPA_CLIENT_CONNECT_EX,
WLAN_IPA_WLAN_EVENT_MAX
};
/**
* struct ipa_uc_offload_control_params - ipa offload control params
* @offload_type: ipa offload type
* @vdev_id: vdev id
* @enable: ipa offload enable/disable
*/
struct ipa_uc_offload_control_params {
uint32_t offload_type;
uint32_t vdev_id;
uint32_t enable;
};
/**
* struct ipa_intrabss_control_params - ipa intrabss control params
* @vdev_id: vdev id
* @enable: ipa intrabss enable/disable
*/
struct ipa_intrabss_control_params {
uint32_t vdev_id;
uint32_t enable;
};
/* fp to send IPA UC offload cmd */
typedef QDF_STATUS (*ipa_uc_offload_control_req)(struct wlan_objmgr_psoc *psoc,
struct ipa_uc_offload_control_params *req);
/* fp to send IPA intrabss cmd */
typedef QDF_STATUS (*ipa_intrabss_control_req)(struct wlan_objmgr_psoc *psoc,
struct ipa_intrabss_control_params *req);
#endif /* end of _WLAN_IPA_PUBLIC_STRUCT_H_ */

View File

@@ -1,47 +0,0 @@
/*
* 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
* 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: Declare public API for wlan ipa to interact with target/WMI
*/
#ifndef _WLAN_IPA_TGT_API_H_
#define _WLAN_IPA_TGT_API_H_
#include "wlan_ipa_public_struct.h"
/**
* tgt_ipa_uc_offload_enable_disable() - send ipa offload control to target if
* @pdev: objmgr pdev object
* @req: ipa offload control request
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_ipa_uc_offload_enable_disable(struct wlan_objmgr_pdev *pdev,
struct ipa_uc_offload_control_params *req);
/**
* tgt_ipa_intrabss_enable_disable() - send ipa intrabss control to target if
* @pdev: objmgr pdev object
* @req: ipa intrabss control request
*
* Return: QDF_STATUS
*/
QDF_STATUS
tgt_ipa_intrabss_enable_disable(struct wlan_objmgr_pdev *pdev,
struct ipa_intrabss_control_params *req);
#endif /* _WLAN_IPA_TGT_API_H_ */

View File

@@ -1,664 +0,0 @@
/*
* Copyright (c) 2018-2021 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: Declare public API related to the wlan ipa called by north bound
*/
#ifndef _WLAN_IPA_UCFG_API_H_
#define _WLAN_IPA_UCFG_API_H_
#include "wlan_ipa_public_struct.h"
#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
/**
* ucfg_ipa_is_present() - get IPA hw status
*
* ipa_uc_reg_rdyCB is not directly designed to check
* ipa hw status. This is an undocumented function which
* has confirmed with IPA team.
*
* Return: true - ipa hw present
* false - ipa hw not present
*/
bool ucfg_ipa_is_present(void);
/**
* ucfg_ipa_is_ready() - get IPA ready status
*
* After ipa_ready_cb() is registered and later invoked by IPA
* driver, ipa ready status flag is updated in wlan driver.
* Unless IPA ready callback is invoked and ready status is
* updated none of the IPA APIs should be invoked.
*
* Return: true - ipa is ready
* false - ipa is not ready
*/
bool ucfg_ipa_is_ready(void);
/**
* ucfg_ipa_is_enabled() - get IPA enable status
*
* Return: true - ipa is enabled
* false - ipa is not enabled
*/
bool ucfg_ipa_is_enabled(void);
/**
* ucfg_ipa_uc_is_enabled() - get IPA uC enable status
*
* Return: true - ipa uC is enabled
* false - ipa uC is not enabled
*/
bool ucfg_ipa_uc_is_enabled(void);
/**
* ucfg_ipa_set_dp_handle() - register DP handle
* @psoc: psoc handle
* @dp_soc: data path soc handle
*
* Return: None
*/
void ucfg_ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc,
void *dp_soc);
/**
* ucfg_ipa_set_pdev_id() - register pdev id
* @psoc: psoc handle
* @pdev_id: data path txrx pdev id
*
* Return: None
*/
void ucfg_ipa_set_pdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t pdev_id);
/**
* ucfg_ipa_set_perf_level() - Set IPA perf level
* @pdev: pdev obj
* @tx_packets: Number of packets transmitted in the last sample period
* @rx_packets: Number of packets received in the last sample period
*
* Return: QDF_STATUS_SUCCESS on success
*/
QDF_STATUS ucfg_ipa_set_perf_level(struct wlan_objmgr_pdev *pdev,
uint64_t tx_packets, uint64_t rx_packets);
/**
* ucfg_ipa_uc_info() - Print IPA uC resource and session information
* @pdev: pdev obj
*
* Return: None
*/
void ucfg_ipa_uc_info(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_uc_stat() - Print IPA uC stats
* @pdev: pdev obj
*
* Return: None
*/
void ucfg_ipa_uc_stat(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_uc_rt_debug_host_dump() - IPA rt debug host dump
* @pdev: pdev obj
*
* Return: None
*/
void ucfg_ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_dump_info() - Dump IPA context information
* @pdev: pdev obj
*
* Return: None
*/
void ucfg_ipa_dump_info(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_uc_stat_request() - Get IPA stats from IPA.
* @pdev: pdev obj
* @reason: STAT REQ Reason
*
* Return: None
*/
void ucfg_ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
uint8_t reason);
/**
* ucfg_ipa_uc_stat_query() - Query the IPA stats
* @pdev: pdev obj
* @ipa_tx_diff: tx packet count diff from previous tx packet count
* @ipa_rx_diff: rx packet count diff from previous rx packet count
*
* Return: None
*/
void ucfg_ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff);
/**
* ucfg_ipa_reg_sap_xmit_cb() - Register upper layer SAP cb to transmit
* @pdev: pdev obj
* @cb: callback
*
* Return: None
*/
void ucfg_ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_softap_xmit cb);
/**
* ucfg_ipa_reg_send_to_nw_cb() - Register cb to send IPA Rx packet to network
* @pdev: pdev obj
* @cb: callback
*
* Return: None
*/
void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_send_to_nw cb);
/**
* ucfg_ipa_reg_rps_enable_cb() - Register cb to enable RPS
* @pdev: pdev obj
* @cb: callback
*
* Return: None
*/
#ifdef QCA_CONFIG_RPS
void ucfg_ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_rps_enable cb);
#else
static inline
void ucfg_ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_rps_enable cb)
{
}
#endif
/**
* ucfg_ipa_set_mcc_mode() - Set MCC mode
* @pdev: pdev obj
* @mcc_mode: 0=MCC/1=SCC
*
* Return: void
*/
void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode);
/**
* ucfg_ipa_set_dfs_cac_tx() - Set DFS cac tx block
* @pdev: pdev obj
* @tx_block: dfs cac tx block
*
* Return: void
*/
void ucfg_ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block);
/**
* ucfg_ipa_set_ap_ibss_fwd() - Set AP intra bss forward
* @pdev: pdev obj
* @session_id: vdev id
* @intra_bss: enable or disable ap intra bss forward
*
* Return: void
*/
void ucfg_ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, uint8_t session_id,
bool intra_bss);
/**
* ucfg_ipa_uc_force_pipe_shutdown() - Force shutdown IPA pipe
* @pdev: pdev obj
*
* Return: void
*/
void ucfg_ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_flush() - flush IPA exception path SKB's
* @pdev: pdev obj
*
* Return: None
*/
void ucfg_ipa_flush(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_suspend() - Suspend IPA
* @pdev: pdev obj
*
* Return: QDF STATUS
*/
QDF_STATUS ucfg_ipa_suspend(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_resume() - Resume IPA
* @pdev: pdev obj
*
* Return: QDF STATUS
*/
QDF_STATUS ucfg_ipa_resume(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_uc_ol_init() - Initialize IPA uC offload
* @pdev: pdev obj
* @osdev: OS dev
*
* Return: QDF STATUS
*/
QDF_STATUS ucfg_ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
qdf_device_t osdev);
/**
* ucfg_ipa_uc_ol_deinit() - Deinitialize IPA uC offload
* @pdev: pdev obj
*
* Return: QDF STATUS
*/
QDF_STATUS ucfg_ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_is_tx_pending() - Check if IPA WLAN TX completions are pending
* @pdev: pdev obj
*
* Return: bool if pending TX for IPA.
*/
bool ucfg_ipa_is_tx_pending(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_send_mcc_scc_msg() - Send IPA WLAN_SWITCH_TO_MCC/SCC message
* @mcc_mode: 0=MCC/1=SCC
*
* Return: QDF STATUS
*/
QDF_STATUS ucfg_ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
bool mcc_mode);
/**
* ucfg_ipa_wlan_evt() - IPA event handler
* @pdev: pdev obj
* @net_dev: Interface net device
* @device_mode: Net interface device mode
* @session_id: session id for the event
* @type: event enum of type ipa_wlan_event
* @mac_address: MAC address associated with the event
* @is_2g_iface: true if interface is operating on 2G band, otherwise false
*
* Return: QDF_STATUS
*/
QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev, uint8_t device_mode,
uint8_t session_id,
enum wlan_ipa_wlan_event ipa_event_type,
uint8_t *mac_addr, bool is_2g_iface);
/**
* ucfg_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC
* @map: Map / unmap operation
* @num_buf: Number of buffers in array
* @buf_arr: Buffer array of DMA mem mapping info
*
* Return: Status of map operation
*/
int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr);
/**
* ucfg_ipa_is_fw_wdi_activated - Is FW WDI activated?
* @pdev: pdev obj
*
* Return: true if FW WDI activated, false otherwise
*/
bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_uc_cleanup_sta() - disconnect and cleanup sta iface
* @pdev: pdev obj
* @net_dev: Interface net device
*
* Send disconnect sta event to IPA driver and cleanup IPA iface,
* if not yet done
*
* Return: void
*/
void ucfg_ipa_uc_cleanup_sta(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev);
/**
* ucfg_ipa_uc_disconnect_ap() - send ap disconnect event
* @pdev: pdev obj
* @net_dev: Interface net device
*
* Send disconnect ap event to IPA driver during SSR
*
* Return: QDF_STATUS
*/
QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev);
/**
* ucfg_ipa_cleanup_dev_iface() - Clean up net dev IPA interface
* @pdev: pdev obj
* @net_dev: Interface net device
*
*
* Return: None
*/
void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev);
/**
* ucfg_ipa_uc_ssr_cleanup() - Handle IPA cleanup for SSR
* @pdev: pdev obj
*
* From hostside do cleanup such as deregister IPA interafces
* and send disconnect events so that it will be sync after SSR
*
* Return: None
*/
void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev);
/**
* ucfg_ipa_fw_rejuvenate_send_msg() - Send msg to IPA driver in FW rejuvenate
* @pdev: pdev obj
*
* Return: None
*/
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_ipa_component_config_free() - Free IPA component config
*
* Return: None
*/
void ucfg_ipa_component_config_free(void);
/**
* 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);
/**
* ucfg_ipa_update_tx_stats() - send embedded tx traffic in bytes to IPA
* @pdev: pdev obj
* @sta_tx: tx in bytes on sta vdev
* @ap_tx: tx in bytes on sap vdev
*
* Return: void
*/
void ucfg_ipa_update_tx_stats(struct wlan_objmgr_pdev *pdev, uint64_t sta_tx,
uint64_t ap_tx);
/**
* ucfg_ipa_flush_pending_vdev_events() - flush pending vdev wlan ipa events
* @pdev: pdev obj
* @vdev_id: vdev id
*
* Return: None
*/
void ucfg_ipa_flush_pending_vdev_events(struct wlan_objmgr_pdev *pdev,
uint8_t vdev_id);
#else
static inline bool ucfg_ipa_is_present(void)
{
return false;
}
static inline bool ucfg_ipa_is_ready(void)
{
return false;
}
static inline void ucfg_ipa_update_config(struct wlan_ipa_config *config)
{
}
static inline bool ucfg_ipa_is_enabled(void)
{
return false;
}
static inline bool ucfg_ipa_uc_is_enabled(void)
{
return false;
}
static inline
QDF_STATUS ucfg_ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc,
void *dp_soc)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_ipa_set_pdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t pdev_id)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_ipa_set_perf_level(struct wlan_objmgr_pdev *pdev,
uint64_t tx_packets, uint64_t rx_packets)
{
return QDF_STATUS_SUCCESS;
}
static inline
void ucfg_ipa_uc_info(struct wlan_objmgr_pdev *pdev)
{
}
static inline
void ucfg_ipa_uc_stat(struct wlan_objmgr_pdev *pdev)
{
}
static inline
void ucfg_ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev)
{
}
static inline
void ucfg_ipa_dump_info(struct wlan_objmgr_pdev *pdev)
{
}
static inline
void ucfg_ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
uint8_t reason)
{
}
static inline
void ucfg_ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff)
{
}
static inline
void ucfg_ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_softap_xmit cb)
{
}
static inline
void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_send_to_nw cb)
{
}
static inline
void ucfg_ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_rps_enable cb)
{
}
static inline
void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode)
{
}
static inline
void ucfg_ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block)
{
}
static inline
void ucfg_ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, uint8_t session_id,
bool intra_bss)
{
}
static inline
void ucfg_ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev)
{
}
static inline
void ucfg_ipa_flush(struct wlan_objmgr_pdev *pdev)
{
}
static inline
QDF_STATUS ucfg_ipa_suspend(struct wlan_objmgr_pdev *pdev)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_ipa_resume(struct wlan_objmgr_pdev *pdev)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
qdf_device_t osdev)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev)
{
return QDF_STATUS_SUCCESS;
}
static inline bool ucfg_ipa_is_tx_pending(struct wlan_objmgr_pdev *pdev)
{
return false;
}
static inline
QDF_STATUS ucfg_ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
bool mcc_mode)
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev, uint8_t device_mode,
uint8_t session_id,
enum wlan_ipa_wlan_event ipa_event_type,
uint8_t *mac_addr, bool is_2g_iface)
{
return QDF_STATUS_SUCCESS;
}
static inline
int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr)
{
return 0;
}
static inline
bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev)
{
return false;
}
static inline
void ucfg_ipa_uc_cleanup_sta(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev)
{
}
static inline
QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev)
{
return QDF_STATUS_SUCCESS;
}
static inline
void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev)
{
}
static inline
void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev)
{
}
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
void ucfg_ipa_component_config_free(void)
{
}
static inline
uint32_t ucfg_ipa_get_tx_buf_count(void)
{
return 0;
}
static inline
void ucfg_ipa_update_tx_stats(struct wlan_objmgr_pdev *pdev, uint64_t sta_tx,
uint64_t ap_tx)
{
}
static inline
void ucfg_ipa_flush_pending_vdev_events(struct wlan_objmgr_pdev *pdev,
uint8_t vdev_id)
{
}
#endif /* IPA_OFFLOAD */
#endif /* _WLAN_IPA_UCFG_API_H_ */

View File

@@ -1,293 +0,0 @@
/*
* Copyright (c) 2018, 2020-2021 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: public API related to the wlan ipa called by north bound HDD/OSIF
*/
#include "wlan_ipa_obj_mgmt_api.h"
#include "wlan_ipa_main.h"
#include "wlan_objmgr_global_obj.h"
#include "target_if_ipa.h"
#include "wlan_ipa_ucfg_api.h"
#include "qdf_platform.h"
static bool g_ipa_is_ready;
static qdf_mutex_t g_init_deinit_lock;
bool ipa_cb_is_ready(void)
{
return g_ipa_is_ready;
}
void ipa_disable_register_cb(void)
{
ipa_debug("Don't register ready cb with IPA driver");
g_ipa_is_ready = false;
}
void ipa_init_deinit_lock(void)
{
qdf_mutex_acquire(&g_init_deinit_lock);
}
void ipa_init_deinit_unlock(void)
{
qdf_mutex_release(&g_init_deinit_lock);
}
/**
* ipa_pdev_obj_destroy_notification() - IPA pdev object destroy notification
* @pdev: pdev handle
* @arg_list: arguments list
*
* Return: QDF_STATUS_SUCCESS on success
*/
static QDF_STATUS
ipa_pdev_obj_destroy_notification(struct wlan_objmgr_pdev *pdev,
void *arg_list)
{
QDF_STATUS status;
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_debug("IPA is disabled");
return QDF_STATUS_SUCCESS;
}
ipa_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
WLAN_UMAC_COMP_IPA);
if (!ipa_obj) {
ipa_err("Failed to get ipa pdev object");
return QDF_STATUS_E_FAILURE;
}
status = wlan_objmgr_pdev_component_obj_detach(pdev,
WLAN_UMAC_COMP_IPA,
ipa_obj);
if (QDF_IS_STATUS_ERROR(status))
ipa_err("Failed to detatch ipa pdev object");
ipa_obj_cleanup(ipa_obj);
qdf_mem_free(ipa_obj);
ipa_disable_register_cb();
return status;
}
/**
* ipa_pdev_obj_create_notification() - IPA pdev object creation notification
* @pdev: pdev handle
* @arg_list: arguments list
*
* Return: QDF_STATUS_SUCCESS on success
*/
static QDF_STATUS
ipa_pdev_obj_create_notification(struct wlan_objmgr_pdev *pdev,
void *arg_list)
{
QDF_STATUS status;
struct wlan_ipa_priv *ipa_obj;
ipa_debug("ipa pdev created");
if (!ipa_config_is_enabled()) {
ipa_info("IPA is disabled");
return QDF_STATUS_SUCCESS;
}
ipa_obj = qdf_mem_malloc(sizeof(*ipa_obj));
if (!ipa_obj)
return QDF_STATUS_E_NOMEM;
status = wlan_objmgr_pdev_component_obj_attach(pdev,
WLAN_UMAC_COMP_IPA,
(void *)ipa_obj,
QDF_STATUS_SUCCESS);
if (QDF_IS_STATUS_ERROR(status)) {
ipa_err("Failed to attach pdev ipa component");
qdf_mem_free(ipa_obj);
return status;
}
ipa_obj->pdev = pdev;
target_if_ipa_register_tx_ops(&ipa_obj->ipa_tx_op);
target_if_ipa_register_intrabss_ops(&ipa_obj->ipa_intrabss_op);
ipa_debug("ipa pdev attached");
return status;
}
static void ipa_register_ready_cb(void *user_data)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct wlan_ipa_priv *ipa_obj = (struct wlan_ipa_priv *)user_data;
struct wlan_objmgr_pdev *pdev;
struct wlan_objmgr_psoc *psoc;
qdf_device_t qdf_dev;
if (!ipa_config_is_enabled()) {
ipa_info("IPA config is disabled");
return;
}
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return;
}
/* Validate driver state to determine ipa_obj is valid or not */
if (qdf_is_driver_state_module_stop()) {
ipa_err("Driver modules stop in-progress or done");
return;
}
ipa_init_deinit_lock();
/*
* Meanwhile acquiring lock, driver stop modules can happen in parallel,
* validate driver state once again to proceed with IPA init.
*/
if (qdf_is_driver_state_module_stop()) {
ipa_err("Driver modules stop in-progress/done, releasing lock");
goto out;
}
pdev = ipa_priv_obj_get_pdev(ipa_obj);
psoc = wlan_pdev_get_psoc(pdev);
qdf_dev = wlan_psoc_get_qdf_dev(psoc);
if (!qdf_dev) {
ipa_err("QDF device context is NULL");
goto out;
}
g_ipa_is_ready = true;
ipa_info("IPA ready callback invoked: ipa_register_ready_cb");
status = ipa_obj_setup(ipa_obj);
if (QDF_IS_STATUS_ERROR(status)) {
ipa_err("Failed to setup ipa component");
wlan_objmgr_pdev_component_obj_detach(pdev,
WLAN_UMAC_COMP_IPA,
ipa_obj);
qdf_mem_free(ipa_obj);
ipa_disable_register_cb();
goto out;
}
if (ucfg_ipa_uc_ol_init(pdev, qdf_dev)) {
ipa_err("IPA ucfg_ipa_uc_ol_init failed");
goto out;
}
out:
ipa_init_deinit_unlock();
}
QDF_STATUS ipa_register_is_ipa_ready(struct wlan_objmgr_pdev *pdev)
{
int ret;
struct wlan_ipa_priv *ipa_obj;
if (!ipa_config_is_enabled()) {
ipa_info("IPA config is disabled");
return QDF_STATUS_SUCCESS;
}
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return QDF_STATUS_E_FAILURE;
}
ret = qdf_ipa_register_ipa_ready_cb(ipa_register_ready_cb,
(void *)ipa_obj);
if (ret == -EEXIST) {
ipa_info("IPA is ready, invoke callback");
ipa_register_ready_cb((void *)ipa_obj);
} else if (ret) {
ipa_err("Failed to check IPA readiness %d", ret);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ipa_init(void)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
ipa_info("ipa module dispatcher init");
if (!ipa_check_hw_present()) {
ipa_info("ipa hw not present");
return status;
}
status = wlan_objmgr_register_pdev_create_handler(WLAN_UMAC_COMP_IPA,
ipa_pdev_obj_create_notification, NULL);
if (QDF_IS_STATUS_ERROR(status)) {
ipa_err("Failed to register pdev create handler for ipa");
return status;
}
status = wlan_objmgr_register_pdev_destroy_handler(WLAN_UMAC_COMP_IPA,
ipa_pdev_obj_destroy_notification, NULL);
if (QDF_IS_STATUS_ERROR(status)) {
ipa_err("Failed to register pdev destroy handler for ipa");
goto fail_delete_pdev;
}
qdf_mutex_create(&g_init_deinit_lock);
return status;
fail_delete_pdev:
wlan_objmgr_unregister_pdev_create_handler(WLAN_UMAC_COMP_IPA,
ipa_pdev_obj_create_notification, NULL);
return status;
}
QDF_STATUS ipa_deinit(void)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
ipa_info("ipa module dispatcher deinit");
if (!ipa_is_hw_support()) {
ipa_info("ipa hw is not present");
return status;
}
if (!ipa_config_is_enabled()) {
ipa_info("ipa is disabled");
return status;
}
qdf_mutex_destroy(&g_init_deinit_lock);
status = wlan_objmgr_unregister_pdev_destroy_handler(WLAN_UMAC_COMP_IPA,
ipa_pdev_obj_destroy_notification, NULL);
if (QDF_IS_STATUS_ERROR(status))
ipa_err("Failed to unregister pdev destroy handler");
status = wlan_objmgr_unregister_pdev_create_handler(WLAN_UMAC_COMP_IPA,
ipa_pdev_obj_create_notification, NULL);
if (QDF_IS_STATUS_ERROR(status))
ipa_err("Failed to unregister pdev create handler");
return status;
}

View File

@@ -1,76 +0,0 @@
/*
* Copyright (c) 2018, 2020-2021 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: Implements public API for ipa to interact with target/WMI
*/
#include "wlan_ipa_tgt_api.h"
#include "wlan_ipa_main.h"
#include "wlan_ipa_public_struct.h"
#include <wlan_objmgr_global_obj.h>
#include <wlan_objmgr_pdev_obj.h>
QDF_STATUS tgt_ipa_uc_offload_enable_disable(struct wlan_objmgr_pdev *pdev,
struct ipa_uc_offload_control_params *req)
{
struct wlan_ipa_priv *ipa_obj;
struct wlan_objmgr_psoc *psoc;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
IPA_ENTER();
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return QDF_STATUS_E_INVAL;
}
psoc = wlan_pdev_get_psoc(pdev);
if (ipa_obj->ipa_tx_op)
status = ipa_obj->ipa_tx_op(psoc, req);
IPA_EXIT();
return status;
}
QDF_STATUS
tgt_ipa_intrabss_enable_disable(struct wlan_objmgr_pdev *pdev,
struct ipa_intrabss_control_params *req)
{
struct wlan_ipa_priv *ipa_obj;
struct wlan_objmgr_psoc *psoc;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
IPA_ENTER();
ipa_obj = ipa_pdev_get_priv_obj(pdev);
if (!ipa_obj) {
ipa_err("IPA object is NULL");
return QDF_STATUS_E_INVAL;
}
psoc = wlan_pdev_get_psoc(pdev);
if (ipa_obj->ipa_intrabss_op)
status = ipa_obj->ipa_intrabss_op(psoc, req);
IPA_EXIT();
return status;
}

View File

@@ -1,248 +0,0 @@
/*
* Copyright (c) 2018-2021 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: public API related to the wlan ipa called by north bound HDD/OSIF
*/
#include "wlan_ipa_ucfg_api.h"
#include "wlan_ipa_main.h"
#include "cfg_ucfg_api.h"
bool ucfg_ipa_is_present(void)
{
return ipa_is_hw_support();
}
bool ucfg_ipa_is_ready(void)
{
return ipa_cb_is_ready();
}
bool ucfg_ipa_is_enabled(void)
{
return ipa_config_is_enabled();
}
bool ucfg_ipa_uc_is_enabled(void)
{
return ipa_config_is_uc_enabled();
}
void ucfg_ipa_set_pdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t pdev_id)
{
return ipa_set_pdev_id(psoc, pdev_id);
}
void ucfg_ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc,
void *dp_soc)
{
return ipa_set_dp_handle(psoc, dp_soc);
}
QDF_STATUS ucfg_ipa_set_perf_level(struct wlan_objmgr_pdev *pdev,
uint64_t tx_packets, uint64_t rx_packets)
{
return ipa_rm_set_perf_level(pdev, tx_packets, rx_packets);
}
void ucfg_ipa_uc_info(struct wlan_objmgr_pdev *pdev)
{
return ipa_uc_info(pdev);
}
void ucfg_ipa_uc_stat(struct wlan_objmgr_pdev *pdev)
{
return ipa_uc_stat(pdev);
}
void ucfg_ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev)
{
return ipa_uc_rt_debug_host_dump(pdev);
}
void ucfg_ipa_dump_info(struct wlan_objmgr_pdev *pdev)
{
return ipa_dump_info(pdev);
}
void ucfg_ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
uint8_t reason)
{
return ipa_uc_stat_request(pdev, reason);
}
void ucfg_ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff)
{
return ipa_uc_stat_query(pdev, ipa_tx_diff, ipa_rx_diff);
}
void ucfg_ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_softap_xmit cb)
{
return ipa_reg_sap_xmit_cb(pdev, cb);
}
void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_send_to_nw cb)
{
return ipa_reg_send_to_nw_cb(pdev, cb);
}
#ifdef QCA_CONFIG_RPS
void ucfg_ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
wlan_ipa_rps_enable cb)
{
return ipa_reg_rps_enable_cb(pdev, cb);
}
#endif
void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode)
{
return ipa_set_mcc_mode(pdev, mcc_mode);
}
void ucfg_ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block)
{
return ipa_set_dfs_cac_tx(pdev, tx_block);
}
void ucfg_ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, uint8_t session_id,
bool intra_bss)
{
return ipa_set_ap_ibss_fwd(pdev, session_id, intra_bss);
}
void ucfg_ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev)
{
return ipa_uc_force_pipe_shutdown(pdev);
}
void ucfg_ipa_flush(struct wlan_objmgr_pdev *pdev)
{
return ipa_flush(pdev);
}
QDF_STATUS ucfg_ipa_suspend(struct wlan_objmgr_pdev *pdev)
{
return ipa_suspend(pdev);
}
QDF_STATUS ucfg_ipa_resume(struct wlan_objmgr_pdev *pdev)
{
return ipa_resume(pdev);
}
QDF_STATUS ucfg_ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
qdf_device_t osdev)
{
return ipa_uc_ol_init(pdev, osdev);
}
QDF_STATUS ucfg_ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev)
{
return ipa_uc_ol_deinit(pdev);
}
bool ucfg_ipa_is_tx_pending(struct wlan_objmgr_pdev *pdev)
{
return ipa_is_tx_pending(pdev);
}
QDF_STATUS ucfg_ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
bool mcc_mode)
{
return ipa_send_mcc_scc_msg(pdev, mcc_mode);
}
QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev, uint8_t device_mode,
uint8_t session_id,
enum wlan_ipa_wlan_event ipa_event_type,
uint8_t *mac_addr, bool is_2g_iface)
{
return ipa_wlan_evt(pdev, net_dev, device_mode, session_id,
ipa_event_type, mac_addr, is_2g_iface);
}
int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr)
{
return ipa_uc_smmu_map(map, num_buf, buf_arr);
}
bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev)
{
return ipa_is_fw_wdi_activated(pdev);
}
void ucfg_ipa_uc_cleanup_sta(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev)
{
return ipa_uc_cleanup_sta(pdev, net_dev);
}
QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev)
{
return ipa_uc_disconnect_ap(pdev, net_dev);
}
void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
qdf_netdev_t net_dev)
{
return ipa_cleanup_dev_iface(pdev, net_dev);
}
void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev)
{
return ipa_uc_ssr_cleanup(pdev);
}
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);
}
void ucfg_ipa_component_config_free(void)
{
ipa_component_config_free();
}
uint32_t ucfg_ipa_get_tx_buf_count(void)
{
return ipa_get_tx_buf_count();
}
void ucfg_ipa_update_tx_stats(struct wlan_objmgr_pdev *pdev, uint64_t sta_tx,
uint64_t ap_tx)
{
ipa_update_tx_stats(pdev, sta_tx, ap_tx);
}
void ucfg_ipa_flush_pending_vdev_events(struct wlan_objmgr_pdev *pdev,
uint8_t vdev_id)
{
ipa_flush_pending_vdev_events(pdev, vdev_id);
}

View File

@@ -1,50 +0,0 @@
/*
* 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
* 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: Declare various api/struct which shall be used
* by ipa component for wmi cmd (tx path)
*/
#ifndef _TARGET_IF_IPA_H_
#define _TARGET_IF_IPA_H_
#ifdef IPA_OFFLOAD
#include "wlan_ipa_public_struct.h"
/**
* target_if_ipa_register_tx_ops() - Register IPA component TX OPS
* @ipa_tx_op: IPA if transmit op
*
* Return: None
*/
void target_if_ipa_register_tx_ops(ipa_uc_offload_control_req *ipa_tx_op);
/**
* target_if_ipa_register_intrabss_ops() - Register IPA component INTRABSS OPS
* @ipa_intrabss_op: IPA if intrabss transmit op
*
* Return: None
*/
void
target_if_ipa_register_intrabss_ops(ipa_intrabss_control_req *ipa_intrabss_op);
#endif /* IPA_OFFLOAD */
#endif /* _TARGET_IF_IPA_H_ */

View File

@@ -1,82 +0,0 @@
/*
* 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
* 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: Target interface file for disa component to
* Implement api's which shall be used by ipa component
* in target if internally.
*/
#include <target_if.h>
#include <qdf_status.h>
#include <wmi_unified_api.h>
#include <wmi_unified_priv.h>
#include <wmi_unified_param.h>
#include <target_if_ipa.h>
#include <wlan_objmgr_psoc_obj.h>
/**
* target_if_ipa_uc_offload_control_req() - send IPA offload control to FW
* @psoc: pointer to PSOC object
* @req: IPA UC offload enable/disable control param
*
* Return: QDF_STATUS_SUCCESS on success
*/
static QDF_STATUS
target_if_ipa_uc_offload_control_req(struct wlan_objmgr_psoc *psoc,
struct ipa_uc_offload_control_params *req)
{
return wmi_unified_ipa_offload_control_cmd(
get_wmi_unified_hdl_from_psoc(psoc), req);
}
void target_if_ipa_register_tx_ops(ipa_uc_offload_control_req *ipa_tx_op)
{
*ipa_tx_op = target_if_ipa_uc_offload_control_req;
}
/**
* target_if_ipa_intrabss_control_req() - send IPA intrabss control to FW
* @psoc: pointer to PSOC object
* @req: IPA intra bss enable/disable control param
*
* Return: QDF_STATUS_SUCCESS on success
*/
static QDF_STATUS
target_if_ipa_intrabss_control_req(struct wlan_objmgr_psoc *psoc,
struct ipa_intrabss_control_params *req)
{
struct vdev_set_params param = {0};
wmi_unified_t wmi_handle;
wmi_handle = (wmi_unified_t)get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle)
return QDF_STATUS_E_FAILURE;
param.vdev_id = req->vdev_id;
param.param_id = WMI_VDEV_PARAM_INTRA_BSS_FWD;
param.param_value = req->enable;
return wmi_unified_vdev_set_param_send(wmi_handle, &param);
}
void
target_if_ipa_register_intrabss_ops(ipa_intrabss_control_req *ipa_intrabss_op)
{
*ipa_intrabss_op = target_if_ipa_intrabss_control_req;
}

View File

@@ -4747,6 +4747,8 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit)
hdd_ctx->driver_status = DRIVER_MODULES_ENABLED;
hdd_nofl_debug("Wlan transitioned (now ENABLED)");
ucfg_ipa_reg_is_driver_unloading_cb(hdd_ctx->pdev,
cds_is_driver_unloading);
ucfg_ipa_reg_sap_xmit_cb(hdd_ctx->pdev,
hdd_softap_ipa_start_xmit);
ucfg_ipa_reg_send_to_nw_cb(hdd_ctx->pdev,