Browse Source

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
chunquan 3 years ago
parent
commit
406c530769

+ 1 - 1
components/cfg/cfg_all.h

@@ -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 \

+ 0 - 843
components/ipa/core/inc/wlan_ipa_core.h

@@ -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_ */

+ 0 - 548
components/ipa/core/inc/wlan_ipa_main.h

@@ -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_ */

+ 0 - 800
components/ipa/core/inc/wlan_ipa_priv.h

@@ -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_ */

+ 0 - 4412
components/ipa/core/src/wlan_ipa_core.c

@@ -1,4412 +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 "wlan_ipa_core.h"
-#include "wlan_ipa_main.h"
-#include "wlan_hdd_main.h"
-#include <ol_txrx.h>
-#include "cdp_txrx_ipa.h"
-#include "wal_rx_desc.h"
-#include "qdf_str.h"
-#include "sir_api.h"
-#include "host_diag_core_event.h"
-#include "wlan_objmgr_vdev_obj.h"
-#include "qdf_platform.h"
-
-static struct wlan_ipa_priv *gp_ipa;
-static void wlan_ipa_set_pending_tx_timer(struct wlan_ipa_priv *ipa_ctx);
-static void wlan_ipa_reset_pending_tx_timer(struct wlan_ipa_priv *ipa_ctx);
-
-
-static struct wlan_ipa_iface_2_client {
-	qdf_ipa_client_type_t cons_client;
-	qdf_ipa_client_type_t prod_client;
-} wlan_ipa_iface_2_client[WLAN_IPA_CLIENT_MAX_IFACE] = {
-	{
-		QDF_IPA_CLIENT_WLAN2_CONS, QDF_IPA_CLIENT_WLAN1_PROD
-	}, {
-		QDF_IPA_CLIENT_MCC2_CONS,  QDF_IPA_CLIENT_WLAN1_PROD
-	}, {
-		QDF_IPA_CLIENT_WLAN4_CONS, QDF_IPA_CLIENT_WLAN1_PROD
-	}
-};
-
-/* Local Function Prototypes */
-static void wlan_ipa_i2w_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
-			    unsigned long data);
-static void wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
-			    unsigned long data);
-
-/**
- * wlan_ipa_uc_sta_is_enabled() - Is STA mode IPA uC offload enabled?
- * @ipa_cfg: IPA config
- *
- * Return: true if STA mode IPA uC offload is enabled, false otherwise
- */
-static inline bool wlan_ipa_uc_sta_is_enabled(struct wlan_ipa_config *ipa_cfg)
-{
-	return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_UC_STA_ENABLE_MASK);
-}
-
-/**
- * wlan_ipa_is_pre_filter_enabled() - Is IPA pre-filter enabled?
- * @ipa_cfg: IPA config
- *
- * Return: true if pre-filter is enabled, otherwise false
- */
-static inline
-bool wlan_ipa_is_pre_filter_enabled(struct wlan_ipa_config *ipa_cfg)
-{
-	return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg,
-					 WLAN_IPA_PRE_FILTER_ENABLE_MASK);
-}
-
-/**
- * wlan_ipa_is_ipv6_enabled() - Is IPA IPv6 enabled?
- * @ipa_cfg: IPA config
- *
- * Return: true if IPv6 is enabled, otherwise false
- */
-static inline bool wlan_ipa_is_ipv6_enabled(struct wlan_ipa_config *ipa_cfg)
-{
-	return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_IPV6_ENABLE_MASK);
-}
-
-/**
- * wlan_ipa_is_sta_only_offload_enabled() - Is IPA STA only offload enabled
- *
- * STA only IPA offload is needed on MDM platforms to support
- * tethering scenarios in STA-SAP configurations when SAP is idle.
- *
- * Currently in STA-SAP configurations, IPA pipes are enabled only
- * when a wifi client is connected to SAP.
- *
- * Impact of this API is only limited to when IPA pipes are enabled
- * and disabled. To take effect, WLAN_IPA_UC_STA_ENABLE_MASK needs to
- * set to 1.
- *
- * Return: true if MDM_PLATFORM is defined, false otherwise
- */
-#ifdef MDM_PLATFORM
-static inline bool wlan_ipa_is_sta_only_offload_enabled(void)
-{
-	return true;
-}
-#else
-static inline bool wlan_ipa_is_sta_only_offload_enabled(void)
-{
-	return false;
-}
-#endif
-
-/**
- * wlan_ipa_msg_free_fn() - Free an IPA message
- * @buff: pointer to the IPA message
- * @len: length of the IPA message
- * @type: type of IPA message
- *
- * Return: None
- */
-static void wlan_ipa_msg_free_fn(void *buff, uint32_t len, uint32_t type)
-{
-	ipa_debug("msg type:%d, len:%d", type, len);
-	qdf_mem_free(buff);
-}
-
-/**
- * wlan_ipa_uc_loaded_uc_cb() - IPA UC loaded event callback
- * @priv_ctxt: IPA context
- *
- * Will be called by IPA context.
- * It's atomic context, then should be scheduled to kworker thread
- *
- * Return: None
- */
-static void wlan_ipa_uc_loaded_uc_cb(void *priv_ctxt)
-{
-	struct wlan_ipa_priv *ipa_ctx;
-	struct op_msg_type *msg;
-	struct uc_op_work_struct *uc_op_work;
-
-	if (!ipa_cb_is_ready()) {
-		ipa_info("IPA is not READY");
-		return;
-	}
-
-	if (!priv_ctxt) {
-		ipa_err("Invalid IPA context");
-		return;
-	}
-
-	ipa_ctx = priv_ctxt;
-
-	uc_op_work = &ipa_ctx->uc_op_work[WLAN_IPA_UC_OPCODE_UC_READY];
-	if (!list_empty(&uc_op_work->work.work.entry)) {
-		/* uc_op_work is not initialized yet */
-		ipa_ctx->uc_loaded = true;
-		return;
-	}
-
-	msg = qdf_mem_malloc(sizeof(*msg));
-	if (!msg)
-		return;
-
-	msg->op_code = WLAN_IPA_UC_OPCODE_UC_READY;
-
-	/* When the same uC OPCODE is already pended, just return */
-	if (uc_op_work->msg)
-		goto done;
-
-	uc_op_work->msg = msg;
-
-	if (!qdf_atomic_read(&ipa_ctx->deinit_in_prog)) {
-		qdf_sched_work(0, &uc_op_work->work);
-	} else {
-		uc_op_work->msg = NULL;
-		goto done;
-	}
-
-	/* work handler will free the msg buffer */
-	return;
-
-done:
-	qdf_mem_free(msg);
-}
-
-struct wlan_ipa_priv *wlan_ipa_get_obj_context(void)
-{
-	return gp_ipa;
-}
-
-/**
- * wlan_ipa_send_pkt_to_tl() - Send an IPA packet to TL
- * @iface_context: interface-specific IPA context
- * @ipa_tx_desc: packet data descriptor
- *
- * Return: None
- */
-static void wlan_ipa_send_pkt_to_tl(
-		struct wlan_ipa_iface_context *iface_context,
-		qdf_ipa_rx_data_t *ipa_tx_desc)
-{
-	struct wlan_ipa_priv *ipa_ctx = iface_context->ipa_ctx;
-	struct wlan_objmgr_pdev *pdev;
-	struct wlan_objmgr_psoc *psoc;
-	qdf_device_t osdev;
-	qdf_nbuf_t skb;
-	struct wlan_ipa_tx_desc *tx_desc;
-	qdf_dma_addr_t paddr;
-	QDF_STATUS status;
-
-	if (!ipa_ctx)
-		return;
-	pdev = ipa_ctx->pdev;
-	psoc = wlan_pdev_get_psoc(pdev);
-	osdev = wlan_psoc_get_qdf_dev(psoc);
-
-	qdf_spin_lock_bh(&iface_context->interface_lock);
-	/*
-	 * During CAC period, data packets shouldn't be sent over the air so
-	 * drop all the packets here
-	 */
-	if (iface_context->device_mode == QDF_SAP_MODE ||
-	    iface_context->device_mode == QDF_P2P_GO_MODE) {
-		if (ipa_ctx->dfs_cac_block_tx) {
-			ipa_free_skb(ipa_tx_desc);
-			qdf_spin_unlock_bh(&iface_context->interface_lock);
-			iface_context->stats.num_tx_cac_drop++;
-			wlan_ipa_wdi_rm_try_release(ipa_ctx);
-			return;
-		}
-	}
-
-	if (!osdev) {
-		ipa_free_skb(ipa_tx_desc);
-		iface_context->stats.num_tx_drop++;
-		qdf_spin_unlock_bh(&iface_context->interface_lock);
-		wlan_ipa_wdi_rm_try_release(ipa_ctx);
-		return;
-	}
-	qdf_spin_unlock_bh(&iface_context->interface_lock);
-
-	skb = QDF_IPA_RX_DATA_SKB(ipa_tx_desc);
-
-	qdf_mem_zero(skb->cb, sizeof(skb->cb));
-
-	/* Store IPA Tx buffer ownership into SKB CB */
-	qdf_nbuf_ipa_owned_set(skb);
-
-	if (qdf_mem_smmu_s1_enabled(osdev)) {
-		status = qdf_nbuf_map(osdev, skb, QDF_DMA_TO_DEVICE);
-		if (QDF_IS_STATUS_SUCCESS(status)) {
-			paddr = qdf_nbuf_get_frag_paddr(skb, 0);
-		} else {
-			ipa_free_skb(ipa_tx_desc);
-			qdf_spin_lock_bh(&iface_context->interface_lock);
-			iface_context->stats.num_tx_drop++;
-			qdf_spin_unlock_bh(&iface_context->interface_lock);
-			wlan_ipa_wdi_rm_try_release(ipa_ctx);
-			return;
-		}
-	} else {
-		paddr = QDF_IPA_RX_DATA_DMA_ADDR(ipa_tx_desc);
-	}
-
-	if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config)) {
-		qdf_nbuf_mapped_paddr_set(skb,
-					  paddr +
-					  WLAN_IPA_WLAN_FRAG_HEADER +
-					  WLAN_IPA_WLAN_IPA_HEADER);
-		QDF_IPA_RX_DATA_SKB_LEN(ipa_tx_desc) -=
-			WLAN_IPA_WLAN_FRAG_HEADER + WLAN_IPA_WLAN_IPA_HEADER;
-	} else {
-		qdf_nbuf_mapped_paddr_set(skb, paddr);
-	}
-
-	qdf_spin_lock_bh(&ipa_ctx->q_lock);
-	/* get free Tx desc and assign ipa_tx_desc pointer */
-	if (ipa_ctx->tx_desc_free_list.count &&
-	    qdf_list_remove_front(&ipa_ctx->tx_desc_free_list,
-				  (qdf_list_node_t **)&tx_desc) ==
-							QDF_STATUS_SUCCESS) {
-		tx_desc->ipa_tx_desc_ptr = ipa_tx_desc;
-		ipa_ctx->stats.num_tx_desc_q_cnt++;
-		qdf_spin_unlock_bh(&ipa_ctx->q_lock);
-		/* Store Tx Desc index into SKB CB */
-		QDF_NBUF_CB_TX_IPA_PRIV(skb) = tx_desc->id;
-	} else {
-		ipa_ctx->stats.num_tx_desc_error++;
-		qdf_spin_unlock_bh(&ipa_ctx->q_lock);
-
-		if (qdf_mem_smmu_s1_enabled(osdev)) {
-			if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config))
-				qdf_nbuf_mapped_paddr_set(skb, paddr);
-
-			qdf_nbuf_unmap(osdev, skb, QDF_DMA_TO_DEVICE);
-		}
-
-		qdf_ipa_free_skb(ipa_tx_desc);
-		wlan_ipa_wdi_rm_try_release(ipa_ctx);
-		return;
-	}
-
-	skb = cdp_ipa_tx_send_data_frame(cds_get_context(QDF_MODULE_ID_SOC),
-					 iface_context->session_id,
-					 QDF_IPA_RX_DATA_SKB(ipa_tx_desc));
-	if (skb) {
-		qdf_nbuf_free(skb);
-		iface_context->stats.num_tx_err++;
-		return;
-	}
-
-	atomic_inc(&ipa_ctx->tx_ref_cnt);
-
-	iface_context->stats.num_tx++;
-}
-
-/**
- * wlan_ipa_forward() - handle packet forwarding to wlan tx
- * @ipa_ctx: pointer to ipa ipa context
- * @iface_ctx: interface context
- * @skb: data pointer
- *
- * if exception packet has set forward bit, copied new packet should be
- * forwarded to wlan tx. if wlan subsystem is in suspend state, packet should
- * put into pm queue and tx procedure will be differed
- *
- * Return: None
- */
-static void wlan_ipa_forward(struct wlan_ipa_priv *ipa_ctx,
-			     struct wlan_ipa_iface_context *iface_ctx,
-			     qdf_nbuf_t skb)
-{
-	struct wlan_ipa_pm_tx_cb *pm_tx_cb;
-
-	qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-
-	/* Set IPA ownership for intra-BSS Tx packets to avoid skb_orphan */
-	qdf_nbuf_ipa_owned_set(skb);
-
-	/* WLAN subsystem is in suspend, put in queue */
-	if (ipa_ctx->suspended) {
-		qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-		ipa_info_rl("Tx in suspend, put in queue");
-		qdf_mem_zero(skb->cb, sizeof(skb->cb));
-		pm_tx_cb = (struct wlan_ipa_pm_tx_cb *)skb->cb;
-		pm_tx_cb->exception = true;
-		pm_tx_cb->iface_context = iface_ctx;
-		qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-		qdf_nbuf_queue_add(&ipa_ctx->pm_queue_head, skb);
-		qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-		ipa_ctx->stats.num_tx_queued++;
-	} else {
-		/* Resume, put packet into WLAN TX */
-		qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-
-		if (ipa_ctx->softap_xmit) {
-			if (ipa_ctx->softap_xmit(skb, iface_ctx->dev)) {
-				ipa_err_rl("packet Tx fail");
-				ipa_ctx->stats.num_tx_fwd_err++;
-			} else {
-				ipa_ctx->stats.num_tx_fwd_ok++;
-			}
-		} else {
-			dev_kfree_skb_any(skb);
-		}
-	}
-}
-
-/**
- * wlan_ipa_intrabss_forward() - Forward intra bss packets.
- * @ipa_ctx: pointer to IPA IPA struct
- * @iface_ctx: ipa interface context
- * @desc: Firmware descriptor
- * @skb: Data buffer
- *
- * Return:
- *      WLAN_IPA_FORWARD_PKT_NONE
- *      WLAN_IPA_FORWARD_PKT_DISCARD
- *      WLAN_IPA_FORWARD_PKT_LOCAL_STACK
- *
- */
-
-static enum wlan_ipa_forward_type wlan_ipa_intrabss_forward(
-		struct wlan_ipa_priv *ipa_ctx,
-		struct wlan_ipa_iface_context *iface_ctx,
-		uint8_t desc,
-		qdf_nbuf_t skb)
-{
-	int ret = WLAN_IPA_FORWARD_PKT_NONE;
-	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
-
-	if ((desc & FW_RX_DESC_FORWARD_M)) {
-		if (cdp_tx_desc_thresh_reached(soc, iface_ctx->session_id)) {
-			/* Drop the packet*/
-			ipa_ctx->stats.num_tx_fwd_err++;
-			goto drop_pkt;
-		}
-
-		ipa_debug_rl("Forward packet to Tx (fw_desc=%d)", desc);
-		ipa_ctx->ipa_tx_forward++;
-
-		if ((desc & FW_RX_DESC_DISCARD_M)) {
-			wlan_ipa_forward(ipa_ctx, iface_ctx, skb);
-			ipa_ctx->ipa_rx_internal_drop_count++;
-			ipa_ctx->ipa_rx_discard++;
-			ret = WLAN_IPA_FORWARD_PKT_DISCARD;
-		} else {
-			struct sk_buff *cloned_skb = skb_clone(skb, GFP_ATOMIC);
-
-			if (cloned_skb)
-				wlan_ipa_forward(ipa_ctx, iface_ctx,
-						 cloned_skb);
-			else
-				ipa_err_rl("tx skb alloc failed");
-			ret = WLAN_IPA_FORWARD_PKT_LOCAL_STACK;
-		}
-	}
-	return ret;
-
-drop_pkt:
-	dev_kfree_skb_any(skb);
-	ret = WLAN_IPA_FORWARD_PKT_DISCARD;
-	return ret;
-}
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \
-	defined(CONFIG_IPA_WDI_UNIFIED_API)
-/*
- * TODO: Get WDI version through FW capabilities
- */
-#if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) || \
-    defined(QCA_WIFI_QCA6490) || defined(QCA_WIFI_QCA6750) || \
-    defined(QCA_WIFI_WCN7850)
-static inline void wlan_ipa_wdi_get_wdi_version(struct wlan_ipa_priv *ipa_ctx)
-{
-	ipa_ctx->wdi_version = IPA_WDI_3;
-}
-#elif defined(QCA_WIFI_3_0)
-static inline void wlan_ipa_wdi_get_wdi_version(struct wlan_ipa_priv *ipa_ctx)
-{
-	ipa_ctx->wdi_version = IPA_WDI_2;
-}
-#else
-static inline void wlan_ipa_wdi_get_wdi_version(struct wlan_ipa_priv *ipa_ctx)
-{
-	ipa_ctx->wdi_version = IPA_WDI_1;
-}
-#endif
-
-static inline bool wlan_ipa_wdi_is_smmu_enabled(struct wlan_ipa_priv *ipa_ctx,
-					       qdf_device_t osdev)
-{
-	return ipa_ctx->is_smmu_enabled && qdf_mem_smmu_s1_enabled(osdev);
-}
-
-static inline QDF_STATUS
-wlan_ipa_wdi_setup(struct wlan_ipa_priv *ipa_ctx,
-		   qdf_device_t osdev)
-{
-	qdf_ipa_sys_connect_params_t *sys_in = NULL;
-	int i;
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-
-	sys_in = qdf_mem_malloc(sizeof(*sys_in) * WLAN_IPA_MAX_IFACE);
-	if (!sys_in)
-		return QDF_STATUS_E_NOMEM;
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++)
-		qdf_mem_copy(sys_in + i,
-			     &ipa_ctx->sys_pipe[i].ipa_sys_params,
-			     sizeof(qdf_ipa_sys_connect_params_t));
-
-	qdf_status = cdp_ipa_setup(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id,
-				   wlan_ipa_i2w_cb, wlan_ipa_w2i_cb,
-				   wlan_ipa_wdi_meter_notifier_cb,
-				   ipa_ctx->config->desc_size,
-				   ipa_ctx,
-				   wlan_ipa_is_rm_enabled(ipa_ctx->config),
-				   &ipa_ctx->tx_pipe_handle,
-				   &ipa_ctx->rx_pipe_handle,
-				   wlan_ipa_wdi_is_smmu_enabled(ipa_ctx, osdev),
-				   sys_in, ipa_ctx->over_gsi);
-
-	qdf_mem_free(sys_in);
-
-	return qdf_status;
-}
-
-#ifdef FEATURE_METERING
-/**
- * wlan_ipa_wdi_init_metering() - IPA WDI metering init
- * @ipa_ctx: IPA context
- * @in: IPA WDI in param
- *
- * Return: QDF_STATUS
- */
-static inline void wlan_ipa_wdi_init_metering(struct wlan_ipa_priv *ipa_ctxt,
-					      qdf_ipa_wdi_init_in_params_t *in)
-{
-	QDF_IPA_WDI_INIT_IN_PARAMS_WDI_NOTIFY(in) =
-				wlan_ipa_wdi_meter_notifier_cb;
-}
-#else
-static inline void wlan_ipa_wdi_init_metering(struct wlan_ipa_priv *ipa_ctxt,
-					      qdf_ipa_wdi_init_in_params_t *in)
-{
-}
-#endif
-
-/**
- * wlan_ipa_wdi_init() - IPA WDI init
- * @ipa_ctx: IPA context
- *
- * Return: QDF_STATUS
- */
-static inline QDF_STATUS wlan_ipa_wdi_init(struct wlan_ipa_priv *ipa_ctx)
-{
-	qdf_ipa_wdi_init_in_params_t in;
-	qdf_ipa_wdi_init_out_params_t out;
-	int ret;
-
-	ipa_ctx->uc_loaded = false;
-
-	qdf_mem_zero(&in, sizeof(in));
-	qdf_mem_zero(&out, sizeof(out));
-
-	QDF_IPA_WDI_INIT_IN_PARAMS_WDI_VERSION(&in) = ipa_ctx->wdi_version;
-	QDF_IPA_WDI_INIT_IN_PARAMS_NOTIFY(&in) = wlan_ipa_uc_loaded_uc_cb;
-	QDF_IPA_WDI_INIT_IN_PARAMS_PRIV(&in) = ipa_ctx;
-	wlan_ipa_wdi_init_metering(ipa_ctx, &in);
-
-	ret = qdf_ipa_wdi_init(&in, &out);
-	if (ret) {
-		ipa_err("ipa_wdi_init failed with ret=%d", ret);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	ipa_ctx->over_gsi =
-		QDF_IPA_WDI_INIT_OUT_PARAMS_IS_OVER_GSI(&out);
-	ipa_ctx->is_smmu_enabled =
-		QDF_IPA_WDI_INIT_OUT_PARAMS_IS_SMMU_ENABLED(&out);
-	ipa_info("ipa_over_gsi: %d, is_smmu_enabled: %d",
-		 ipa_ctx->over_gsi, ipa_ctx->is_smmu_enabled);
-
-	if (QDF_IPA_WDI_INIT_OUT_PARAMS_IS_UC_READY(&out)) {
-		ipa_debug("IPA uC READY");
-		ipa_ctx->uc_loaded = true;
-	} else {
-		ipa_info("IPA uc not ready");
-		return QDF_STATUS_E_BUSY;
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-
-static inline int wlan_ipa_wdi_cleanup(void)
-{
-	int ret;
-
-	ret = qdf_ipa_wdi_cleanup();
-	if (ret)
-		ipa_info("ipa_wdi_cleanup failed ret=%d", ret);
-	return ret;
-}
-
-static inline int wlan_ipa_wdi_setup_sys_pipe(struct wlan_ipa_priv *ipa_ctx,
-					     struct ipa_sys_connect_params *sys,
-					     uint32_t *handle)
-{
-	return 0;
-}
-
-static inline int wlan_ipa_wdi_teardown_sys_pipe(struct wlan_ipa_priv *ipa_ctx,
-						uint32_t handle)
-{
-	return 0;
-}
-
-/**
- * wlan_ipa_pm_flush() - flush queued packets
- * @work: pointer to the scheduled work
- *
- * Called during PM resume to send packets to TL which were queued
- * while host was in the process of suspending.
- *
- * Return: None
- */
-static void wlan_ipa_pm_flush(void *data)
-{
-	struct wlan_ipa_priv *ipa_ctx = (struct wlan_ipa_priv *)data;
-	struct wlan_ipa_pm_tx_cb *pm_tx_cb = NULL;
-	qdf_nbuf_t skb;
-	uint32_t dequeued = 0;
-
-	qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-	while (((skb = qdf_nbuf_queue_remove(&ipa_ctx->pm_queue_head)) !=
-	       NULL)) {
-		qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-
-		pm_tx_cb = (struct wlan_ipa_pm_tx_cb *)skb->cb;
-		dequeued++;
-
-		if (pm_tx_cb->exception) {
-			if (ipa_ctx->softap_xmit &&
-			    pm_tx_cb->iface_context->dev) {
-				ipa_ctx->softap_xmit(skb,
-						pm_tx_cb->iface_context->dev);
-				ipa_ctx->stats.num_tx_fwd_ok++;
-			} else {
-				dev_kfree_skb_any(skb);
-			}
-		} else {
-			wlan_ipa_send_pkt_to_tl(pm_tx_cb->iface_context,
-						pm_tx_cb->ipa_tx_desc);
-		}
-
-		qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-	}
-	qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-
-	ipa_ctx->stats.num_tx_dequeued += dequeued;
-	if (dequeued > ipa_ctx->stats.num_max_pm_queue)
-		ipa_ctx->stats.num_max_pm_queue = dequeued;
-}
-
-int wlan_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr)
-{
-	if (!ipa_cb_is_ready()) {
-		ipa_info("IPA is not READY");
-		return 0;
-	}
-
-	if (!num_buf) {
-		ipa_info("No buffers to map/unmap");
-		return 0;
-	}
-
-	if (map)
-		return qdf_ipa_wdi_create_smmu_mapping(num_buf, buf_arr);
-	else
-		return qdf_ipa_wdi_release_smmu_mapping(num_buf, buf_arr);
-}
-
-#ifdef MDM_PLATFORM
-/**
- * is_rx_dest_bridge_dev() - is RX skb bridge device terminated
- * @iface_ctx: pointer to WLAN IPA interface context
- * @nbuf: skb buffer
- *
- * Check if skb is destined for bridge device, where SAP is a bridge
- * port of it.
- *
- * FIXME: If there's a BH lockless API to check if destination MAC
- * address is a valid peer, this check can be deleted. Currently
- * dp_find_peer_by_addr() is used to check if destination MAC
- * is a valid peer. Since WLAN IPA RX is in process context,
- * qdf_spin_lock_bh in dp_find_peer_by_addr() turns to spin_lock_bh
- * and this BH lock hurts netif_rx.
- *
- * Return: true/false
- */
-static bool is_rx_dest_bridge_dev(struct wlan_ipa_iface_context *iface_ctx,
-				  qdf_nbuf_t nbuf)
-{
-	qdf_netdev_t master_ndev;
-	qdf_netdev_t ndev;
-	struct ethhdr *eh;
-	uint8_t da_is_bcmc;
-	bool ret;
-
-	/*
-	 * WDI 3.0 skb->cb[] info from IPA driver
-	 * skb->cb[0] = vdev_id
-	 * skb->cb[1].bit#1 = da_is_bcmc
-	 */
-	da_is_bcmc = ((uint8_t)nbuf->cb[1]) & 0x2;
-	if (da_is_bcmc)
-		return false;
-
-	ndev = iface_ctx->dev;
-	if (!ndev)
-		return false;
-
-	if (!netif_is_bridge_port(ndev))
-		return false;
-
-	rcu_read_lock();
-
-	master_ndev = netdev_master_upper_dev_get_rcu(ndev);
-	if (!master_ndev) {
-		ret = false;
-		goto out;
-	}
-
-	eh = (struct ethhdr *)qdf_nbuf_data(nbuf);
-	if (qdf_mem_cmp(eh->h_dest, master_ndev->dev_addr, QDF_MAC_ADDR_SIZE)) {
-		ret = false;
-		goto out;
-	}
-
-	ret = true;
-
-out:
-	rcu_read_unlock();
-	return ret;
-}
-#else /* !MDM_PLATFORM */
-static bool is_rx_dest_bridge_dev(struct wlan_ipa_iface_context *iface_ctx,
-				  qdf_nbuf_t nbuf)
-{
-	return false;
-}
-#endif /* MDM_PLATFORM */
-
-static enum wlan_ipa_forward_type
-wlan_ipa_rx_intrabss_fwd(struct wlan_ipa_priv *ipa_ctx,
-			 struct wlan_ipa_iface_context *iface_ctx,
-			 qdf_nbuf_t nbuf)
-{
-	uint8_t fw_desc = 0;
-	bool fwd_success;
-	int ret;
-
-	/* legacy intra-bss fowarding for WDI 1.0 and 2.0 */
-	if (ipa_ctx->wdi_version != IPA_WDI_3) {
-		fw_desc = (uint8_t)nbuf->cb[1];
-		return wlan_ipa_intrabss_forward(ipa_ctx, iface_ctx, fw_desc,
-						 nbuf);
-	}
-
-	if (is_rx_dest_bridge_dev(iface_ctx, nbuf)) {
-		fwd_success = 0;
-		ret = WLAN_IPA_FORWARD_PKT_LOCAL_STACK;
-		goto exit;
-	}
-
-	if (cdp_ipa_rx_intrabss_fwd(ipa_ctx->dp_soc, iface_ctx->session_id,
-				    nbuf, &fwd_success)) {
-		ipa_ctx->ipa_rx_internal_drop_count++;
-		ipa_ctx->ipa_rx_discard++;
-
-		ret = WLAN_IPA_FORWARD_PKT_DISCARD;
-	} else {
-		ret = WLAN_IPA_FORWARD_PKT_LOCAL_STACK;
-	}
-
-exit:
-	if (fwd_success)
-		ipa_ctx->stats.num_tx_fwd_ok++;
-	else
-		ipa_ctx->stats.num_tx_fwd_err++;
-
-	return ret;
-}
-
-#else /* CONFIG_IPA_WDI_UNIFIED_API */
-
-static inline void wlan_ipa_wdi_get_wdi_version(struct wlan_ipa_priv *ipa_ctx)
-{
-}
-
-static inline int wlan_ipa_wdi_is_smmu_enabled(struct wlan_ipa_priv *ipa_ctx,
-					       qdf_device_t osdev)
-{
-	return qdf_mem_smmu_s1_enabled(osdev);
-}
-
-static inline QDF_STATUS wlan_ipa_wdi_setup(struct wlan_ipa_priv *ipa_ctx,
-					    qdf_device_t osdev)
-{
-	return cdp_ipa_setup(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id,
-			     wlan_ipa_i2w_cb, wlan_ipa_w2i_cb,
-			     wlan_ipa_wdi_meter_notifier_cb,
-			     ipa_ctx->config->desc_size,
-			     ipa_ctx, wlan_ipa_is_rm_enabled(ipa_ctx->config),
-			     &ipa_ctx->tx_pipe_handle,
-			     &ipa_ctx->rx_pipe_handle);
-}
-
-static inline QDF_STATUS wlan_ipa_wdi_init(struct wlan_ipa_priv *ipa_ctx)
-{
-	struct ipa_wdi_uc_ready_params uc_ready_param;
-
-	ipa_ctx->uc_loaded = false;
-	uc_ready_param.priv = (void *)ipa_ctx;
-	uc_ready_param.notify = wlan_ipa_uc_loaded_uc_cb;
-	if (qdf_ipa_uc_reg_rdyCB(&uc_ready_param)) {
-		ipa_info("UC Ready CB register fail");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	if (true == uc_ready_param.is_uC_ready) {
-		ipa_info("UC Ready");
-		ipa_ctx->uc_loaded = true;
-	} else {
-		return QDF_STATUS_E_BUSY;
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-
-static inline int wlan_ipa_wdi_cleanup(void)
-{
-	int ret;
-
-	ret = qdf_ipa_uc_dereg_rdyCB();
-	if (ret)
-		ipa_info("UC Ready CB deregister fail");
-	return ret;
-}
-
-static inline int wlan_ipa_wdi_setup_sys_pipe(
-		struct wlan_ipa_priv *ipa_ctx,
-		struct ipa_sys_connect_params *sys, uint32_t *handle)
-{
-	return qdf_ipa_setup_sys_pipe(sys, handle);
-}
-
-static inline int wlan_ipa_wdi_teardown_sys_pipe(
-		struct wlan_ipa_priv *ipa_ctx,
-		uint32_t handle)
-{
-	return qdf_ipa_teardown_sys_pipe(handle);
-}
-
-/**
- * wlan_ipa_pm_flush() - flush queued packets
- * @work: pointer to the scheduled work
- *
- * Called during PM resume to send packets to TL which were queued
- * while host was in the process of suspending.
- *
- * Return: None
- */
-static void wlan_ipa_pm_flush(void *data)
-{
-	struct wlan_ipa_priv *ipa_ctx = (struct wlan_ipa_priv *)data;
-	struct wlan_ipa_pm_tx_cb *pm_tx_cb = NULL;
-	qdf_nbuf_t skb;
-	uint32_t dequeued = 0;
-
-	qdf_wake_lock_acquire(&ipa_ctx->wake_lock,
-			      WIFI_POWER_EVENT_WAKELOCK_IPA);
-	qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-	while (((skb = qdf_nbuf_queue_remove(&ipa_ctx->pm_queue_head)) !=
-	       NULL)) {
-		qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-
-		pm_tx_cb = (struct wlan_ipa_pm_tx_cb *)skb->cb;
-		dequeued++;
-
-		if (pm_tx_cb->exception) {
-			if (ipa_ctx->softap_xmit &&
-			    pm_tx_cb->iface_context->dev) {
-				ipa_ctx->softap_xmit(skb,
-						pm_tx_cb->iface_context->dev);
-				ipa_ctx->stats.num_tx_fwd_ok++;
-			} else {
-				dev_kfree_skb_any(skb);
-			}
-		} else {
-			wlan_ipa_send_pkt_to_tl(pm_tx_cb->iface_context,
-						pm_tx_cb->ipa_tx_desc);
-		}
-
-		qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-	}
-	qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-	qdf_wake_lock_release(&ipa_ctx->wake_lock,
-			      WIFI_POWER_EVENT_WAKELOCK_IPA);
-
-	ipa_ctx->stats.num_tx_dequeued += dequeued;
-	if (dequeued > ipa_ctx->stats.num_max_pm_queue)
-		ipa_ctx->stats.num_max_pm_queue = dequeued;
-}
-
-int wlan_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr)
-{
-	if (!num_buf) {
-		ipa_info("No buffers to map/unmap");
-		return 0;
-	}
-
-	if (map)
-		return qdf_ipa_wdi_create_smmu_mapping(num_buf, buf_arr);
-	else
-		return qdf_ipa_wdi_release_smmu_mapping(num_buf, buf_arr);
-}
-
-static enum wlan_ipa_forward_type
-wlan_ipa_rx_intrabss_fwd(struct wlan_ipa_priv *ipa_ctx,
-			 struct wlan_ipa_iface_context *iface_ctx,
-			 qdf_nbuf_t nbuf)
-{
-	uint8_t fw_desc;
-
-	fw_desc = (uint8_t)nbuf->cb[1];
-
-	return wlan_ipa_intrabss_forward(ipa_ctx, iface_ctx, fw_desc, nbuf);
-}
-
-#endif /* CONFIG_IPA_WDI_UNIFIED_API */
-
-/**
- * wlan_ipa_send_sta_eapol_to_nw() - Send Rx EAPOL pkt for STA to Kernel
- * @skb: network buffer
- *
- * Called when a EAPOL packet is received via IPA Exception path
- * before wlan_ipa_setup_iface is done for STA.
- *
- * Return: 0 on success, err_code for failure.
- */
-static int wlan_ipa_send_sta_eapol_to_nw(qdf_nbuf_t skb)
-{
-	struct wlan_ipa_priv *ipa_ctx = gp_ipa;
-	struct hdd_context *hdd_ctx;
-	struct hdd_adapter *adapter;
-	struct ethhdr *eh;
-
-	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
-	if (!hdd_ctx) {
-		ipa_err_rl("Invalid hdd_context");
-		return -EINVAL;
-	}
-
-	eh = (struct ethhdr *)qdf_nbuf_data(skb);
-	adapter = hdd_get_adapter_by_macaddr(hdd_ctx, eh->h_dest);
-	if (hdd_validate_adapter(adapter)) {
-		ipa_err_rl("Invalid adapter");
-		return -EINVAL;
-	}
-	if (adapter->device_mode != QDF_STA_MODE) {
-		ipa_err_rl("device_mode is not STA");
-		return -EINVAL;
-	}
-
-	skb->destructor = wlan_ipa_uc_rt_debug_destructor;
-
-	if (ipa_ctx->send_to_nw)
-		ipa_ctx->send_to_nw(skb, adapter->dev);
-
-	ipa_ctx->ipa_rx_net_send_count++;
-	ipa_ctx->stats.num_rx_no_iface_eapol++;
-
-	return 0;
-}
-
-/**
- * wlan_ipa_send_skb_to_network() - Send skb to kernel
- * @skb: network buffer
- * @iface_ctx: IPA interface context
- *
- * Called when a network buffer is received which should not be routed
- * to the IPA module.
- *
- * Return: None
- */
-static void
-wlan_ipa_send_skb_to_network(qdf_nbuf_t skb,
-			     struct wlan_ipa_iface_context *iface_ctx)
-{
-	struct wlan_ipa_priv *ipa_ctx = gp_ipa;
-
-	if (!iface_ctx->dev) {
-		ipa_debug_rl("Invalid interface");
-		ipa_ctx->ipa_rx_internal_drop_count++;
-		dev_kfree_skb_any(skb);
-		return;
-	}
-
-	skb->destructor = wlan_ipa_uc_rt_debug_destructor;
-
-	if (ipa_ctx->send_to_nw)
-		ipa_ctx->send_to_nw(skb, iface_ctx->dev);
-
-	ipa_ctx->ipa_rx_net_send_count++;
-}
-
-/**
- * wlan_ipa_eapol_intrabss_fwd_check() - Check if eapol pkt intrabss fwd is
- *  allowed or not
- * @ipa_ctx: IPA global context
- * @vdev_id: vdev id
- * @nbuf: network buffer
- *
- * Return: true if intrabss fwd is allowed for eapol else false
- */
-static bool
-wlan_ipa_eapol_intrabss_fwd_check(struct wlan_ipa_priv *ipa_ctx,
-				  uint8_t vdev_id, qdf_nbuf_t nbuf)
-{
-	uint8_t *vdev_mac_addr;
-
-	vdev_mac_addr = cdp_get_vdev_mac_addr(ipa_ctx->dp_soc, vdev_id);
-
-	if (!vdev_mac_addr)
-		return false;
-
-	if (qdf_mem_cmp(qdf_nbuf_data(nbuf) + QDF_NBUF_DEST_MAC_OFFSET,
-			vdev_mac_addr, QDF_MAC_ADDR_SIZE))
-		return false;
-
-	return true;
-}
-
-#ifdef MDM_PLATFORM
-static void
-wlan_ipa_set_sap_client_auth(struct wlan_ipa_priv *ipa_ctx, uint8_t *peer_mac,
-			     uint8_t is_authenticated)
-{
-	uint8_t idx;
-	struct ipa_uc_stas_map *sta_map;
-
-	for (idx = 0; idx < WLAN_IPA_MAX_STA_COUNT; idx++) {
-		sta_map = &ipa_ctx->assoc_stas_map[idx];
-		if (sta_map->is_reserved &&
-		    qdf_is_macaddr_equal(&sta_map->mac_addr,
-					 (struct qdf_mac_addr *)peer_mac)) {
-			sta_map->is_authenticated = is_authenticated;
-			break;
-		}
-	}
-}
-
-static inline uint8_t
-wlan_ipa_get_sap_client_auth(struct wlan_ipa_priv *ipa_ctx, uint8_t *peer_mac)
-{
-	uint8_t idx;
-	struct ipa_uc_stas_map *sta_map;
-
-	for (idx = 0; idx < WLAN_IPA_MAX_STA_COUNT; idx++) {
-		sta_map = &ipa_ctx->assoc_stas_map[idx];
-		if (sta_map->is_reserved &&
-		    qdf_is_macaddr_equal(&sta_map->mac_addr,
-					 (struct qdf_mac_addr *)peer_mac)) {
-			return sta_map->is_authenticated;
-		}
-	}
-
-	return false;
-}
-
-static inline uint8_t
-wlan_ipa_is_peer_authenticated(ol_txrx_soc_handle dp_soc,
-			       struct wlan_ipa_iface_context *iface,
-			       uint8_t *peer_mac)
-{
-	uint8_t is_authenticated = false;
-
-	if (iface->device_mode == QDF_SAP_MODE) {
-		is_authenticated = wlan_ipa_get_sap_client_auth(iface->ipa_ctx,
-								peer_mac);
-		if (is_authenticated)
-			return is_authenticated;
-		is_authenticated = cdp_peer_state_get(dp_soc,
-						      iface->session_id,
-						      peer_mac);
-		if (is_authenticated == OL_TXRX_PEER_STATE_AUTH)
-			wlan_ipa_set_sap_client_auth(iface->ipa_ctx,
-						     peer_mac,
-						     true);
-		else
-			is_authenticated = false;
-
-	} else if (iface->device_mode == QDF_STA_MODE) {
-		is_authenticated = iface->is_authenticated;
-		if (is_authenticated)
-			return is_authenticated;
-		is_authenticated = cdp_peer_state_get(dp_soc,
-						      iface->session_id,
-						      peer_mac);
-		if (is_authenticated == OL_TXRX_PEER_STATE_AUTH)
-			iface->is_authenticated = true;
-		else
-			is_authenticated = false;
-	}
-
-	return is_authenticated;
-}
-#else
-static void
-wlan_ipa_set_sap_client_auth(struct wlan_ipa_priv *ipa_ctx, uint8_t *peer_mac,
-			     uint8_t is_authenticated)
-{}
-
-static inline bool
-wlan_ipa_is_peer_authenticated(ol_txrx_soc_handle dp_soc,
-			       struct wlan_ipa_iface_context *iface,
-			       uint8_t *peer_mac)
-{
-	uint8_t is_authenticated = 0;
-
-	is_authenticated = cdp_peer_state_get(dp_soc,
-					      iface->session_id,
-					      peer_mac);
-
-	return (is_authenticated == OL_TXRX_PEER_STATE_AUTH);
-}
-#endif
-/**
- * __wlan_ipa_w2i_cb() - WLAN to IPA callback handler
- * @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
- */
-static void __wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
-			      unsigned long data)
-{
-	struct wlan_ipa_priv *ipa_ctx = NULL;
-	qdf_nbuf_t skb;
-	uint8_t iface_id;
-	uint8_t session_id = 0xff;
-	struct wlan_ipa_iface_context *iface_context;
-	bool is_eapol_wapi = false;
-	struct qdf_mac_addr peer_mac_addr = QDF_MAC_ADDR_ZERO_INIT;
-
-	ipa_ctx = (struct wlan_ipa_priv *)priv;
-	if (!ipa_ctx) {
-		if (evt == IPA_RECEIVE) {
-			skb = (qdf_nbuf_t)data;
-			dev_kfree_skb_any(skb);
-		}
-		return;
-	}
-
-	switch (evt) {
-	case IPA_RECEIVE:
-		skb = (qdf_nbuf_t) data;
-		if (wlan_ipa_uc_is_enabled(ipa_ctx->config)) {
-			session_id = (uint8_t)skb->cb[0];
-			iface_id = ipa_ctx->vdev_to_iface[session_id];
-			ipa_ctx->stats.num_rx_excep++;
-			qdf_nbuf_pull_head(skb, WLAN_IPA_UC_WLAN_CLD_HDR_LEN);
-		} else {
-			iface_id = WLAN_IPA_GET_IFACE_ID(skb->data);
-			qdf_nbuf_pull_head(skb, WLAN_IPA_WLAN_CLD_HDR_LEN);
-		}
-
-		if (iface_id >= WLAN_IPA_MAX_IFACE) {
-			ipa_err_rl("Invalid iface_id %u,session_id %x %x %x %x",
-				   iface_id, session_id, (uint8_t)skb->cb[1],
-				   (uint8_t)skb->cb[2], (uint8_t)skb->cb[3]);
-
-			if (qdf_nbuf_is_ipv4_eapol_pkt(skb)) {
-				ipa_err_rl("EAPOL pkt. Sending to NW!");
-				if (!wlan_ipa_send_sta_eapol_to_nw(skb))
-					break;
-			}
-			ipa_err_rl("Pkt Dropped!");
-			ipa_ctx->ipa_rx_internal_drop_count++;
-			dev_kfree_skb_any(skb);
-			return;
-		}
-
-		iface_context = &ipa_ctx->iface_context[iface_id];
-		if (iface_context->session_id == WLAN_IPA_MAX_SESSION) {
-			ipa_err_rl("session_id of iface_id %u is invalid:%d",
-				   iface_id, iface_context->session_id);
-			ipa_ctx->ipa_rx_internal_drop_count++;
-			dev_kfree_skb_any(skb);
-			return;
-		}
-		iface_context->stats.num_rx_ipa_excep++;
-
-		if (iface_context->device_mode == QDF_STA_MODE)
-			qdf_copy_macaddr(&peer_mac_addr, &iface_context->bssid);
-		else if (iface_context->device_mode == QDF_SAP_MODE)
-			qdf_mem_copy(&peer_mac_addr.bytes[0],
-				     qdf_nbuf_data(skb) +
-				     QDF_NBUF_SRC_MAC_OFFSET,
-				     QDF_MAC_ADDR_SIZE);
-
-		if (qdf_nbuf_is_ipv4_eapol_pkt(skb)) {
-			is_eapol_wapi = true;
-			if (iface_context->device_mode == QDF_SAP_MODE &&
-			    !wlan_ipa_eapol_intrabss_fwd_check(ipa_ctx,
-					      iface_context->session_id, skb)) {
-				ipa_err_rl("EAPOL intrabss fwd drop DA:" QDF_MAC_ADDR_FMT,
-					   QDF_MAC_ADDR_REF(qdf_nbuf_data(skb) +
-					   QDF_NBUF_DEST_MAC_OFFSET));
-				ipa_ctx->ipa_rx_internal_drop_count++;
-				dev_kfree_skb_any(skb);
-				return;
-			}
-		} else if (qdf_nbuf_is_ipv4_wapi_pkt(skb)) {
-			is_eapol_wapi = true;
-		}
-
-		/*
-		 * Check for peer authorized state before allowing
-		 * non-EAPOL/WAPI frames to be intrabss forwarded
-		 * or submitted to stack.
-		 */
-		if (!wlan_ipa_is_peer_authenticated(ipa_ctx->dp_soc,
-						    iface_context,
-						    &peer_mac_addr.bytes[0]) &&
-		    !is_eapol_wapi) {
-			ipa_err_rl("Non EAPOL/WAPI packet received when peer " QDF_MAC_ADDR_FMT " is unauthorized",
-				   QDF_MAC_ADDR_REF(peer_mac_addr.bytes));
-			ipa_ctx->ipa_rx_internal_drop_count++;
-			dev_kfree_skb_any(skb);
-			return;
-		}
-
-		/* Disable to forward Intra-BSS Rx packets when
-		 * ap_isolate=1 in hostapd.conf
-		 */
-		if (!ipa_ctx->disable_intrabss_fwd[session_id] &&
-		    iface_context->device_mode == QDF_SAP_MODE) {
-			/*
-			 * When INTRA_BSS_FWD_OFFLOAD is enabled, FW will send
-			 * all Rx packets to IPA uC, which need to be forwarded
-			 * to other interface.
-			 * And, IPA driver will send back to WLAN host driver
-			 * through exception pipe with fw_desc field set by FW.
-			 * Here we are checking fw_desc field for FORWARD bit
-			 * set, and forward to Tx. Then copy to kernel stack
-			 * only when DISCARD bit is not set.
-			 */
-			if (WLAN_IPA_FORWARD_PKT_DISCARD ==
-			    wlan_ipa_rx_intrabss_fwd(ipa_ctx, iface_context,
-						     skb))
-				break;
-		} else {
-			ipa_debug_rl("Intra-BSS fwd disabled for session_id %u",
-				     session_id);
-		}
-
-		wlan_ipa_send_skb_to_network(skb, iface_context);
-		break;
-
-	default:
-		ipa_err_rl("w2i cb wrong event: 0x%x", evt);
-		return;
-	}
-}
-
-#ifndef MDM_PLATFORM
-/**
- * wlan_ipa_w2i_cb() - SSR wrapper for __wlan_ipa_w2i_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
- */
-static void wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
-			    unsigned long data)
-{
-	struct qdf_op_sync *op_sync;
-
-	if (qdf_op_protect(&op_sync)) {
-		if (evt == IPA_RECEIVE) {
-			struct wlan_ipa_priv *ipa_ctx = priv;
-			qdf_nbuf_t skb = (qdf_nbuf_t)data;
-
-			ipa_ctx->ipa_rx_internal_drop_count++;
-			dev_kfree_skb_any(skb);
-		}
-
-		return;
-	}
-
-	__wlan_ipa_w2i_cb(priv, evt, data);
-
-	qdf_op_unprotect(op_sync);
-}
-#else /* MDM_PLATFORM */
-static void wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
-			    unsigned long data)
-{
-	__wlan_ipa_w2i_cb(priv, evt, data);
-}
-#endif /* MDM_PLATFORM */
-
-#ifndef QCA_LL_TX_FLOW_CONTROL_V2
-
-/**
- * __wlan_ipa_i2w_cb() - IPA to WLAN callback
- * @priv: pointer to private data registered with IPA (we register a
- *	pointer to the interface-specific IPA context)
- * @evt: the IPA event which triggered the callback
- * @data: data associated with the event
- *
- * Return: None
- */
-static void __wlan_ipa_i2w_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
-			      unsigned long data)
-{
-	struct wlan_ipa_priv *ipa_ctx = NULL;
-	qdf_ipa_rx_data_t *ipa_tx_desc;
-	struct wlan_ipa_iface_context *iface_context;
-	qdf_nbuf_t skb;
-	struct wlan_ipa_pm_tx_cb *pm_tx_cb = NULL;
-
-	iface_context = (struct wlan_ipa_iface_context *)priv;
-	ipa_tx_desc = (qdf_ipa_rx_data_t *)data;
-	ipa_ctx = iface_context->ipa_ctx;
-
-	if (evt != IPA_RECEIVE) {
-		ipa_err_rl("Event is not IPA_RECEIVE");
-		ipa_free_skb(ipa_tx_desc);
-		iface_context->stats.num_tx_drop++;
-		return;
-	}
-
-	skb = QDF_IPA_RX_DATA_SKB(ipa_tx_desc);
-
-	/*
-	 * If PROD resource is not requested here then there may be cases where
-	 * IPA hardware may be clocked down because of not having proper
-	 * dependency graph between WLAN CONS and modem PROD pipes. Adding the
-	 * workaround to request PROD resource while data is going over CONS
-	 * pipe to prevent the IPA hardware clockdown.
-	 */
-	wlan_ipa_wdi_rm_request(ipa_ctx);
-
-	qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-	/*
-	 * If host is still suspended then queue the packets and these will be
-	 * drained later when resume completes. When packet is arrived here and
-	 * host is suspended, this means that there is already resume is in
-	 * progress.
-	 */
-	if (ipa_ctx->suspended) {
-		qdf_mem_zero(skb->cb, sizeof(skb->cb));
-		pm_tx_cb = (struct wlan_ipa_pm_tx_cb *)skb->cb;
-		pm_tx_cb->iface_context = iface_context;
-		pm_tx_cb->ipa_tx_desc = ipa_tx_desc;
-		qdf_nbuf_queue_add(&ipa_ctx->pm_queue_head, skb);
-		ipa_ctx->stats.num_tx_queued++;
-
-		qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-		return;
-	}
-
-	qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-
-	/*
-	 * If we are here means, host is not suspended, wait for the work queue
-	 * to finish.
-	 */
-	qdf_flush_work(&ipa_ctx->pm_work);
-
-	return wlan_ipa_send_pkt_to_tl(iface_context, ipa_tx_desc);
-}
-
-/**
- * wlan_ipa_i2w_cb() - IPA to WLAN callback
- * @priv: pointer to private data registered with IPA (we register a
- *	pointer to the interface-specific IPA context)
- * @evt: the IPA event which triggered the callback
- * @data: data associated with the event
- *
- * Return: None
- */
-static void wlan_ipa_i2w_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
-			    unsigned long data)
-{
-	struct qdf_op_sync *op_sync;
-
-	if (qdf_op_protect(&op_sync)) {
-		qdf_ipa_rx_data_t *ipa_tx_desc = (qdf_ipa_rx_data_t *)data;
-		struct wlan_ipa_iface_context *iface_context = priv;
-
-		ipa_free_skb(ipa_tx_desc);
-		iface_context->stats.num_tx_drop++;
-
-		return;
-	}
-
-	__wlan_ipa_i2w_cb(priv, evt, data);
-
-	qdf_op_unprotect(op_sync);
-}
-
-#else /* QCA_LL_TX_FLOW_CONTROL_V2 */
-
-/**
- * wlan_ipa_i2w_cb() - IPA to WLAN callback
- * @priv: pointer to private data registered with IPA (we register a
- *	pointer to the interface-specific IPA context)
- * @evt: the IPA event which triggered the callback
- * @data: data associated with the event
- *
- * Return: None
- */
-static void wlan_ipa_i2w_cb(void *priv, qdf_ipa_dp_evt_type_t evt,
-			    unsigned long data)
-{
-}
-
-#endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
-
-QDF_STATUS wlan_ipa_suspend(struct wlan_ipa_priv *ipa_ctx)
-{
-	/*
-	 * Check if IPA is ready for suspend, If we are here means, there is
-	 * high chance that suspend would go through but just to avoid any race
-	 * condition after suspend started, these checks are conducted before
-	 * allowing to suspend.
-	 */
-	if (atomic_read(&ipa_ctx->tx_ref_cnt))
-		return QDF_STATUS_E_AGAIN;
-
-	if (!wlan_ipa_is_rm_released(ipa_ctx))
-		return QDF_STATUS_E_AGAIN;
-
-	qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-	ipa_ctx->suspended = true;
-	qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-
-	if (ipa_ctx->config->ipa_force_voting &&
-	    !ipa_ctx->ipa_pipes_down)
-		wlan_ipa_set_perf_level(ipa_ctx,
-					ipa_ctx->config->bus_bw_high,
-					ipa_ctx->config->bus_bw_high);
-
-	return QDF_STATUS_SUCCESS;
-}
-
-QDF_STATUS wlan_ipa_resume(struct wlan_ipa_priv *ipa_ctx)
-{
-	qdf_sched_work(0, &ipa_ctx->pm_work);
-
-	qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-	ipa_ctx->suspended = false;
-	qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-
-	return QDF_STATUS_SUCCESS;
-}
-
-QDF_STATUS wlan_ipa_uc_enable_pipes(struct wlan_ipa_priv *ipa_ctx)
-{
-	int result;
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-
-	ipa_debug("enter");
-
-	qdf_spin_lock_bh(&ipa_ctx->enable_disable_lock);
-	if (ipa_ctx->pipes_enable_in_progress) {
-		ipa_warn("IPA Pipes Enable in progress");
-		qdf_spin_unlock_bh(&ipa_ctx->enable_disable_lock);
-		return QDF_STATUS_E_ALREADY;
-	}
-	ipa_ctx->pipes_enable_in_progress = true;
-	qdf_spin_unlock_bh(&ipa_ctx->enable_disable_lock);
-
-	if (qdf_atomic_read(&ipa_ctx->waiting_on_pending_tx))
-		wlan_ipa_reset_pending_tx_timer(ipa_ctx);
-
-	if (qdf_atomic_read(&ipa_ctx->pipes_disabled)) {
-		result = cdp_ipa_enable_pipes(ipa_ctx->dp_soc,
-					      ipa_ctx->dp_pdev_id);
-		if (result) {
-			ipa_err("Enable IPA WDI PIPE failed: ret=%d", result);
-			qdf_status = QDF_STATUS_E_FAILURE;
-			goto end;
-		}
-		qdf_atomic_set(&ipa_ctx->pipes_disabled, 0);
-	}
-
-	qdf_event_reset(&ipa_ctx->ipa_resource_comp);
-
-	if (qdf_atomic_read(&ipa_ctx->autonomy_disabled)) {
-		cdp_ipa_enable_autonomy(ipa_ctx->dp_soc,
-					ipa_ctx->dp_pdev_id);
-		qdf_atomic_set(&ipa_ctx->autonomy_disabled, 0);
-	}
-end:
-	qdf_spin_lock_bh(&ipa_ctx->enable_disable_lock);
-	if (!qdf_atomic_read(&ipa_ctx->autonomy_disabled) &&
-	    !qdf_atomic_read(&ipa_ctx->pipes_disabled))
-		ipa_ctx->ipa_pipes_down = false;
-
-	ipa_ctx->pipes_enable_in_progress = false;
-	qdf_spin_unlock_bh(&ipa_ctx->enable_disable_lock);
-
-	ipa_debug("exit: ipa_pipes_down=%d", ipa_ctx->ipa_pipes_down);
-	return qdf_status;
-}
-
-QDF_STATUS
-wlan_ipa_uc_disable_pipes(struct wlan_ipa_priv *ipa_ctx, bool force_disable)
-{
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-
-	ipa_debug("enter: force_disable %u autonomy_disabled %u pipes_disabled %u",
-		  force_disable,
-		  qdf_atomic_read(&ipa_ctx->autonomy_disabled),
-		  qdf_atomic_read(&ipa_ctx->pipes_disabled));
-
-	qdf_spin_lock_bh(&ipa_ctx->enable_disable_lock);
-	if (ipa_ctx->ipa_pipes_down || ipa_ctx->pipes_down_in_progress) {
-		qdf_spin_unlock_bh(&ipa_ctx->enable_disable_lock);
-		ipa_info("IPA WDI Pipes are already deactivated");
-		return QDF_STATUS_E_ALREADY;
-	}
-	ipa_ctx->pipes_down_in_progress = true;
-	qdf_spin_unlock_bh(&ipa_ctx->enable_disable_lock);
-
-
-	if (!qdf_atomic_read(&ipa_ctx->autonomy_disabled)) {
-		cdp_ipa_disable_autonomy(ipa_ctx->dp_soc,
-					 ipa_ctx->dp_pdev_id);
-		qdf_atomic_set(&ipa_ctx->autonomy_disabled, 1);
-	}
-
-	if (!qdf_atomic_read(&ipa_ctx->pipes_disabled)) {
-		if (!force_disable) {
-			wlan_ipa_set_pending_tx_timer(ipa_ctx);
-		} else {
-			qdf_status = cdp_ipa_disable_pipes(ipa_ctx->dp_soc,
-							   ipa_ctx->dp_pdev_id);
-			if (QDF_IS_STATUS_ERROR(qdf_status)) {
-				ipa_err("Disable IPA WDI PIPE failed: ret=%u",
-					qdf_status);
-				qdf_status = QDF_STATUS_E_FAILURE;
-				goto end;
-			}
-			qdf_atomic_set(&ipa_ctx->pipes_disabled, 1);
-			wlan_ipa_reset_pending_tx_timer(ipa_ctx);
-		}
-	}
-
-end:
-	qdf_spin_lock_bh(&ipa_ctx->enable_disable_lock);
-	if (qdf_atomic_read(&ipa_ctx->pipes_disabled) &&
-	    qdf_atomic_read(&ipa_ctx->autonomy_disabled)) {
-		ipa_ctx->ipa_pipes_down = true;
-	}
-	ipa_ctx->pipes_down_in_progress = false;
-	qdf_spin_unlock_bh(&ipa_ctx->enable_disable_lock);
-
-	ipa_debug("exit: ipa_pipes_down %u autonomy_disabled %u pipes_disabled %u",
-		  ipa_ctx->ipa_pipes_down,
-		  qdf_atomic_read(&ipa_ctx->autonomy_disabled),
-		  qdf_atomic_read(&ipa_ctx->pipes_disabled));
-	return qdf_status;
-}
-
-/**
- * wlan_ipa_uc_find_add_assoc_sta() - Find associated station
- * @ipa_ctx: Global IPA IPA context
- * @sta_add: Should station be added
- * @mac_addr: mac address of station being queried
- *
- * Return: true if the station was found
- */
-static bool wlan_ipa_uc_find_add_assoc_sta(struct wlan_ipa_priv *ipa_ctx,
-					   bool sta_add,
-					   uint8_t *mac_addr)
-{
-	bool sta_found = false;
-	uint8_t idx;
-
-	for (idx = 0; idx < WLAN_IPA_MAX_STA_COUNT; idx++) {
-		if ((ipa_ctx->assoc_stas_map[idx].is_reserved) &&
-		    (qdf_is_macaddr_equal(
-			&ipa_ctx->assoc_stas_map[idx].mac_addr,
-			(struct qdf_mac_addr *)mac_addr))) {
-			sta_found = true;
-			break;
-		}
-	}
-	if (sta_add && sta_found) {
-		ipa_err("STA already exist, cannot add: " QDF_MAC_ADDR_FMT,
-			QDF_MAC_ADDR_REF(mac_addr));
-		return sta_found;
-	}
-	if (sta_add) {
-		for (idx = 0; idx < WLAN_IPA_MAX_STA_COUNT; idx++) {
-			if (!ipa_ctx->assoc_stas_map[idx].is_reserved) {
-				ipa_ctx->assoc_stas_map[idx].is_reserved = true;
-				qdf_mem_copy(&ipa_ctx->assoc_stas_map[idx].
-					     mac_addr, mac_addr,
-					     QDF_NET_ETH_LEN);
-				return sta_found;
-			}
-		}
-	}
-	if (!sta_add && !sta_found) {
-		ipa_info("STA does not exist, cannot delete: "
-			 QDF_MAC_ADDR_FMT, QDF_MAC_ADDR_REF(mac_addr));
-		return sta_found;
-	}
-	if (!sta_add) {
-		for (idx = 0; idx < WLAN_IPA_MAX_STA_COUNT; idx++) {
-			if ((ipa_ctx->assoc_stas_map[idx].is_reserved) &&
-			    (qdf_is_macaddr_equal(
-				&ipa_ctx->assoc_stas_map[idx].mac_addr,
-				(struct qdf_mac_addr *)mac_addr))) {
-				ipa_ctx->assoc_stas_map[idx].is_reserved =
-					false;
-				qdf_mem_zero(
-					&ipa_ctx->assoc_stas_map[idx].mac_addr,
-					QDF_NET_ETH_LEN);
-				return sta_found;
-			}
-		}
-	}
-
-	return sta_found;
-}
-
-/**
- * wlan_ipa_get_ifaceid() - Get IPA context interface ID
- * @ipa_ctx: IPA context
- * @session_id: Session ID
- *
- * Return: None
- */
-static int wlan_ipa_get_ifaceid(struct wlan_ipa_priv *ipa_ctx,
-				uint8_t session_id)
-{
-	struct wlan_ipa_iface_context *iface_ctx;
-	int i;
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_ctx = &ipa_ctx->iface_context[i];
-		if (iface_ctx->session_id == session_id)
-			break;
-	}
-
-	return i;
-}
-
-/**
- * wlan_ipa_cleanup_iface() - Cleanup IPA on a given interface
- * @iface_context: interface-specific IPA context
- *
- * Return: None
- */
-static void wlan_ipa_cleanup_iface(struct wlan_ipa_iface_context *iface_context,
-				   uint8_t *mac_addr)
-{
-	struct wlan_ipa_priv *ipa_ctx = iface_context->ipa_ctx;
-
-	ipa_debug("enter");
-	ipa_err("net:%pK mode:%d MAC:"QDF_MAC_ADDR_FMT" id:%d",
-		iface_context->dev, iface_context->device_mode,
-		QDF_MAC_ADDR_REF(mac_addr), iface_context->session_id);
-
-	if (iface_context->session_id == WLAN_IPA_MAX_SESSION)
-		return;
-
-	if (mac_addr && qdf_mem_cmp(iface_context->mac_addr,
-				    mac_addr, QDF_MAC_ADDR_SIZE)) {
-		ipa_err("MAC mismatch "QDF_MAC_ADDR_FMT":"QDF_MAC_ADDR_FMT"",
-			QDF_MAC_ADDR_REF(mac_addr),
-			QDF_MAC_ADDR_REF(iface_context->mac_addr));
-	}
-
-	if (cdp_ipa_cleanup_iface(ipa_ctx->dp_soc,
-				  iface_context->dev->name,
-				  wlan_ipa_is_ipv6_enabled(ipa_ctx->config))) {
-		ipa_err("ipa_cleanup_iface failed");
-	}
-
-	if (iface_context->device_mode == QDF_SAP_MODE)
-		ipa_ctx->num_sap_connected--;
-
-	qdf_spin_lock_bh(&iface_context->interface_lock);
-	if (qdf_atomic_read(&iface_context->disconn_count) ==
-			qdf_atomic_read(&iface_context->conn_count) - 1) {
-		qdf_atomic_inc(&iface_context->disconn_count);
-	} else {
-		ipa_err("connect/disconnect out of sync");
-		QDF_BUG(0);
-	}
-
-	iface_context->is_authenticated = false;
-	iface_context->dev = NULL;
-	iface_context->device_mode = QDF_MAX_NO_OF_MODE;
-	iface_context->session_id = WLAN_IPA_MAX_SESSION;
-	qdf_mem_set(iface_context->mac_addr, QDF_MAC_ADDR_SIZE, 0);
-	qdf_spin_unlock_bh(&iface_context->interface_lock);
-	iface_context->ifa_address = 0;
-	qdf_zero_macaddr(&iface_context->bssid);
-	if (!iface_context->ipa_ctx->num_iface) {
-		ipa_err("NUM INTF 0, Invalid");
-		QDF_ASSERT(0);
-	}
-	iface_context->ipa_ctx->num_iface--;
-	ipa_debug("exit: num_iface=%d", iface_context->ipa_ctx->num_iface);
-}
-
-#ifndef QCA_LL_TX_FLOW_CONTROL_V2
-
-/**
- * wlan_ipa_nbuf_cb() - IPA TX complete callback
- * @skb: packet buffer which was transmitted
- *
- * Return: None
- */
-static void wlan_ipa_nbuf_cb(qdf_nbuf_t skb)
-{
-	struct wlan_ipa_priv *ipa_ctx = gp_ipa;
-	qdf_ipa_rx_data_t *ipa_tx_desc;
-	struct wlan_ipa_tx_desc *tx_desc;
-	uint16_t id;
-	struct wlan_objmgr_pdev *pdev;
-	struct wlan_objmgr_psoc *psoc;
-	qdf_device_t osdev;
-
-	if (!qdf_nbuf_ipa_owned_get(skb)) {
-		dev_kfree_skb_any(skb);
-		return;
-	}
-
-	if (!ipa_ctx)
-		return;
-	pdev = ipa_ctx->pdev;
-	psoc = wlan_pdev_get_psoc(pdev);
-	osdev = wlan_psoc_get_qdf_dev(psoc);
-
-	if (osdev && qdf_mem_smmu_s1_enabled(osdev)) {
-		if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config)) {
-			qdf_dma_addr_t paddr = QDF_NBUF_CB_PADDR(skb);
-
-			qdf_nbuf_mapped_paddr_set(skb,
-						  paddr -
-						  WLAN_IPA_WLAN_FRAG_HEADER -
-						  WLAN_IPA_WLAN_IPA_HEADER);
-		}
-
-		qdf_nbuf_unmap(osdev, skb, QDF_DMA_TO_DEVICE);
-	}
-
-	/* Get Tx desc pointer from SKB CB */
-	id = QDF_NBUF_CB_TX_IPA_PRIV(skb);
-	tx_desc = &ipa_ctx->tx_desc_pool[id];
-	ipa_tx_desc = tx_desc->ipa_tx_desc_ptr;
-
-	/* Return Tx Desc to IPA */
-	qdf_ipa_free_skb(ipa_tx_desc);
-
-	/* Return to free tx desc list */
-	qdf_spin_lock_bh(&ipa_ctx->q_lock);
-	tx_desc->ipa_tx_desc_ptr = NULL;
-	qdf_list_insert_back(&ipa_ctx->tx_desc_free_list, &tx_desc->node);
-	ipa_ctx->stats.num_tx_desc_q_cnt--;
-	qdf_spin_unlock_bh(&ipa_ctx->q_lock);
-
-	ipa_ctx->stats.num_tx_comp_cnt++;
-
-	qdf_atomic_dec(&ipa_ctx->tx_ref_cnt);
-
-	wlan_ipa_wdi_rm_try_release(ipa_ctx);
-}
-
-#else /* QCA_LL_TX_FLOW_CONTROL_V2 */
-
-/**
- * wlan_ipa_nbuf_cb() - IPA TX complete callback
- * @skb: packet buffer which was transmitted
- *
- * Return: None
- */
-static void wlan_ipa_nbuf_cb(qdf_nbuf_t skb)
-{
-	dev_kfree_skb_any(skb);
-}
-
-#endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
-
-#ifdef IPA_WDI3_TX_TWO_PIPES
-#define WLAN_IPA_SESSION_ID_SHIFT 1
-static uint8_t wlan_ipa_set_session_id(uint8_t session_id, bool is_2g_iface)
-{
-	return (session_id << WLAN_IPA_SESSION_ID_SHIFT) | is_2g_iface;
-}
-#else
-static uint8_t wlan_ipa_set_session_id(uint8_t session_id, bool is_2g_iface)
-{
-	return session_id;
-}
-#endif
-
-/**
- * wlan_ipa_setup_iface() - Setup IPA on a given interface
- * @ipa_ctx: IPA IPA global context
- * @net_dev: Interface net device
- * @device_mode: Net interface device mode
- * @adapter: Interface upon which IPA is being setup
- * @session_id: Station ID of the API instance
- * @mac_addr: MAC addr of the API instance
- * @is_2g_iface: true if Net interface is operating on 2G band, otherwise false
- *
- * Return: QDF STATUS
- */
-static QDF_STATUS wlan_ipa_setup_iface(struct wlan_ipa_priv *ipa_ctx,
-				       qdf_netdev_t net_dev,
-				       uint8_t device_mode,
-				       uint8_t session_id,
-				       uint8_t *mac_addr,
-				       bool is_2g_iface)
-{
-	struct wlan_ipa_iface_context *iface_context = NULL;
-	int i;
-	QDF_STATUS status;
-
-	ipa_err("net:%pK mode:%d MAC:"QDF_MAC_ADDR_FMT" id:%d",
-		net_dev, device_mode, QDF_MAC_ADDR_REF(mac_addr), session_id);
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_context = &(ipa_ctx->iface_context[i]);
-		if (iface_context->dev == net_dev) {
-			if (iface_context->device_mode == device_mode) {
-				/**
-				 * Lower layer may send multiple START_BSS_EVENT
-				 * in DFS mode or during channel change.
-				 * Since these indications are sent by lower
-				 * layer as SAP updates and IPA doesn't have to
-				 * do anything for these updates so ignoring!
-				 */
-				if (device_mode == QDF_SAP_MODE) {
-					ipa_debug("found iface %u device_mode %u",
-						  i, device_mode);
-					return QDF_STATUS_SUCCESS;
-				} else if (device_mode == QDF_STA_MODE &&
-					   qdf_mem_cmp(
-						   iface_context->mac_addr,
-						   mac_addr,
-						   QDF_MAC_ADDR_SIZE) == 0) {
-					ipa_err("same STA iface already connected");
-				}
-
-			}
-
-			ipa_err("Obsolete iface %u found, device_mode %u, will remove it.",
-				i, iface_context->device_mode);
-			wlan_ipa_cleanup_iface(iface_context, NULL);
-		} else if (iface_context->session_id == session_id) {
-			ipa_err("Obsolete iface %u found, net_dev %pK, will remove it.",
-				i, iface_context->dev);
-			wlan_ipa_cleanup_iface(iface_context, NULL);
-		}
-	}
-
-	if (WLAN_IPA_MAX_IFACE == ipa_ctx->num_iface) {
-		ipa_err("Max interface reached %d", WLAN_IPA_MAX_IFACE);
-		status = QDF_STATUS_E_NOMEM;
-		iface_context = NULL;
-		QDF_ASSERT(0);
-		goto end;
-	}
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		if (ipa_ctx->iface_context[i].session_id ==
-						WLAN_IPA_MAX_SESSION) {
-			iface_context = &(ipa_ctx->iface_context[i]);
-			break;
-		}
-	}
-
-	if (!iface_context) {
-		ipa_err("All the IPA interfaces are in use");
-		status = QDF_STATUS_E_NOMEM;
-		QDF_ASSERT(0);
-		goto end;
-	}
-
-	qdf_spin_lock_bh(&iface_context->interface_lock);
-	if (qdf_atomic_read(&iface_context->conn_count) ==
-			qdf_atomic_read(&iface_context->disconn_count)) {
-		qdf_atomic_inc(&iface_context->conn_count);
-	} else {
-		ipa_err("connect/disconnect out of sync");
-		QDF_BUG(0);
-	}
-
-	iface_context->dev = net_dev;
-	iface_context->device_mode = device_mode;
-	iface_context->session_id = session_id;
-	qdf_mem_copy(iface_context->mac_addr, mac_addr, QDF_MAC_ADDR_SIZE);
-	qdf_spin_unlock_bh(&iface_context->interface_lock);
-
-	status = cdp_ipa_setup_iface(ipa_ctx->dp_soc, net_dev->name,
-				     net_dev->dev_addr,
-				     iface_context->prod_client,
-				     iface_context->cons_client,
-				     wlan_ipa_set_session_id(session_id,
-							     is_2g_iface),
-				     wlan_ipa_is_ipv6_enabled(ipa_ctx->config));
-	if (status != QDF_STATUS_SUCCESS)
-		goto end;
-
-	/* Register IPA Tx desc free callback */
-	qdf_nbuf_reg_free_cb(wlan_ipa_nbuf_cb);
-
-	ipa_ctx->num_iface++;
-
-	if (device_mode == QDF_SAP_MODE)
-		ipa_ctx->num_sap_connected++;
-
-	ipa_debug("exit: num_iface=%d", ipa_ctx->num_iface);
-
-	return status;
-
-end:
-	if (iface_context)
-		wlan_ipa_cleanup_iface(iface_context, mac_addr);
-
-	return status;
-}
-
-#if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) || \
-    defined(QCA_WIFI_QCA6490) || defined(QCA_WIFI_QCA6750) || \
-    defined(QCA_WIFI_WCN7850)
-
-#ifdef QCA_CONFIG_RPS
-void ipa_set_rps(struct wlan_ipa_priv *ipa_ctx, enum QDF_OPMODE mode,
-		 bool enable)
-{
-	struct wlan_ipa_iface_context *iface_ctx;
-	wlan_ipa_rps_enable cb = ipa_ctx->rps_enable;
-	int i;
-
-	if (!cb)
-		return;
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_ctx = &ipa_ctx->iface_context[i];
-		if (iface_ctx->device_mode == mode)
-			cb(iface_ctx->session_id, enable);
-	}
-}
-#endif
-
-#ifdef QCA_CONFIG_RPS
-/**
- * wlan_ipa_uc_handle_first_con() - Handle first uC IPA connection
- * @ipa_ctx: IPA context
- *
- * Return: QDF STATUS
- */
-static QDF_STATUS wlan_ipa_uc_handle_first_con(struct wlan_ipa_priv *ipa_ctx)
-{
-	ipa_debug("enter");
-
-	if (qdf_ipa_get_lan_rx_napi() && (ipa_ctx->num_sap_connected > 1)) {
-		ipa_debug("Multiple SAP connected. Not enabling pipes. Exit");
-		return QDF_STATUS_E_PERM;
-	}
-
-	if (qdf_ipa_get_lan_rx_napi() && ipa_ctx->sta_connected)
-		ipa_set_rps(ipa_ctx, QDF_STA_MODE, true);
-
-	if (wlan_ipa_uc_enable_pipes(ipa_ctx) != QDF_STATUS_SUCCESS) {
-		ipa_err("IPA WDI Pipe activation failed");
-		return QDF_STATUS_E_BUSY;
-	}
-
-	ipa_debug("exit");
-
-	return QDF_STATUS_SUCCESS;
-}
-#else
-static QDF_STATUS wlan_ipa_uc_handle_first_con(struct wlan_ipa_priv *ipa_ctx)
-{
-	ipa_debug("enter");
-
-	if (wlan_ipa_uc_enable_pipes(ipa_ctx) != QDF_STATUS_SUCCESS) {
-		ipa_err("IPA WDI Pipe activation failed");
-		return QDF_STATUS_E_BUSY;
-	}
-
-	ipa_debug("exit");
-
-	return QDF_STATUS_SUCCESS;
-}
-#endif
-
-static
-void wlan_ipa_uc_handle_last_discon(struct wlan_ipa_priv *ipa_ctx,
-				    bool force_disable)
-{
-	ipa_debug("enter");
-
-	wlan_ipa_uc_disable_pipes(ipa_ctx, force_disable);
-
-	if (qdf_ipa_get_lan_rx_napi() && ipa_ctx->sta_connected)
-		ipa_set_rps(ipa_ctx, QDF_STA_MODE, false);
-
-	ipa_debug("exit: IPA WDI Pipes deactivated");
-}
-
-bool wlan_ipa_is_fw_wdi_activated(struct wlan_ipa_priv *ipa_ctx)
-{
-	return !ipa_ctx->ipa_pipes_down;
-}
-
-/* Time(ms) to wait for pending TX comps after last SAP client disconnects */
-#define WLAN_IPA_TX_PENDING_TIMEOUT_MS 15000
-
-static void wlan_ipa_set_pending_tx_timer(struct wlan_ipa_priv *ipa_ctx)
-{
-	ipa_ctx->pending_tx_start_ticks = qdf_system_ticks();
-	qdf_atomic_set(&ipa_ctx->waiting_on_pending_tx, 1);
-	ipa_info("done. pending_tx_start_ticks %llu wait_on_pending %u",
-		 ipa_ctx->pending_tx_start_ticks,
-		 qdf_atomic_read(&ipa_ctx->waiting_on_pending_tx));
-}
-
-bool wlan_ipa_is_tx_pending(struct wlan_ipa_priv *ipa_ctx)
-{
-	bool ret = false;
-	uint64_t diff_ms = 0;
-	uint64_t current_ticks = 0;
-
-	if (!ipa_ctx) {
-		ipa_err("IPA private context is NULL");
-		return false;
-	}
-
-	if (!qdf_atomic_read(&ipa_ctx->waiting_on_pending_tx)) {
-		ipa_debug("nothing pending");
-		return false;
-	}
-
-	current_ticks = qdf_system_ticks();
-
-	diff_ms = qdf_system_ticks_to_msecs(current_ticks -
-					    ipa_ctx->pending_tx_start_ticks);
-
-	if (diff_ms < WLAN_IPA_TX_PENDING_TIMEOUT_MS) {
-		ret = true;
-	} else {
-		ipa_debug("disabling pipes");
-		wlan_ipa_uc_disable_pipes(ipa_ctx, true);
-	}
-
-	ipa_debug("diff_ms %llu pending_tx_start_ticks %llu current_ticks %llu wait_on_pending %u",
-		  diff_ms, ipa_ctx->pending_tx_start_ticks, current_ticks,
-		  qdf_atomic_read(&ipa_ctx->waiting_on_pending_tx));
-
-	return ret;
-}
-
-static void wlan_ipa_reset_pending_tx_timer(struct wlan_ipa_priv *ipa_ctx)
-{
-	ipa_ctx->pending_tx_start_ticks = 0;
-	qdf_atomic_set(&ipa_ctx->waiting_on_pending_tx, 0);
-	ipa_info("done");
-}
-
-#else
-
-/**
- * wlan_ipa_uc_handle_first_con() - Handle first uC IPA connection
- * @ipa_ctx: IPA context
- *
- * Return: QDF STATUS
- */
-static QDF_STATUS wlan_ipa_uc_handle_first_con(struct wlan_ipa_priv *ipa_ctx)
-{
-	ipa_debug("enter");
-
-	ipa_ctx->activated_fw_pipe = 0;
-	ipa_ctx->resource_loading = true;
-
-	/* If RM feature enabled
-	 * Request PROD Resource first
-	 * PROD resource may return sync or async manners
-	 */
-	if (wlan_ipa_is_rm_enabled(ipa_ctx->config)) {
-		if (!wlan_ipa_wdi_rm_request_resource(ipa_ctx,
-						IPA_RM_RESOURCE_WLAN_PROD)) {
-			/* RM PROD request sync return
-			 * enable pipe immediately
-			 */
-			if (wlan_ipa_uc_enable_pipes(ipa_ctx)) {
-				ipa_err("IPA WDI Pipe activation failed");
-				ipa_ctx->resource_loading = false;
-				return QDF_STATUS_E_BUSY;
-			}
-		} else {
-			ipa_err("IPA WDI Pipe activation deferred");
-		}
-	} else {
-		/* RM Disabled
-		 * Just enabled all the PIPEs
-		 */
-		if (wlan_ipa_uc_enable_pipes(ipa_ctx)) {
-			ipa_err("IPA WDI Pipe activation failed");
-			ipa_ctx->resource_loading = false;
-			return QDF_STATUS_E_BUSY;
-		}
-		ipa_ctx->resource_loading = false;
-	}
-
-	ipa_debug("exit");
-
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * wlan_ipa_uc_handle_last_discon() - Handle last uC IPA disconnection
- * @ipa_ctx: IPA context
- * @force_disable: force IPA pipes disablement
- *
- * Return: None
- */
-static
-void wlan_ipa_uc_handle_last_discon(struct wlan_ipa_priv *ipa_ctx,
-				    bool force_disable)
-{
-	ipa_debug("enter");
-
-	ipa_ctx->resource_unloading = true;
-	qdf_event_reset(&ipa_ctx->ipa_resource_comp);
-	ipa_info("Disable FW RX PIPE");
-	cdp_ipa_set_active(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id, false, false);
-
-	ipa_debug("exit: IPA WDI Pipes deactivated");
-}
-
-bool wlan_ipa_is_fw_wdi_activated(struct wlan_ipa_priv *ipa_ctx)
-{
-	return (WLAN_IPA_UC_NUM_WDI_PIPE == ipa_ctx->activated_fw_pipe);
-}
-
-static inline
-void wlan_ipa_set_pending_tx_timer(struct wlan_ipa_priv *ipa_ctx)
-{
-}
-
-bool wlan_ipa_is_tx_pending(struct wlan_ipa_priv *ipa_ctx)
-{
-	return false;
-}
-
-static inline
-void wlan_ipa_reset_pending_tx_timer(struct wlan_ipa_priv *ipa_ctx)
-{
-}
-
-#endif
-
-static inline
-bool wlan_sap_no_client_connected(struct wlan_ipa_priv *ipa_ctx)
-{
-	return !(ipa_ctx->sap_num_connected_sta);
-}
-
-static inline
-bool wlan_sta_is_connected(struct wlan_ipa_priv *ipa_ctx)
-{
-	return ipa_ctx->sta_connected;
-}
-
-static inline
-bool wlan_ipa_uc_is_loaded(struct wlan_ipa_priv *ipa_ctx)
-{
-	return ipa_ctx->uc_loaded;
-}
-
-#ifdef INTRA_BSS_FWD_OFFLOAD
-/**
- * wlan_ipa_intrabss_enable_disable() - wdi intrabss enable/disable notify to fw
- * @ipa_ctx: global IPA context
- * @offload_type: MCC or SCC
- * @session_id: Session Id
- * @enable: intrabss enable or disable
- *
- * Return: none
- */
-static void wlan_ipa_intrabss_enable_disable(struct wlan_ipa_priv *ipa_ctx,
-					     uint8_t session_id,
-					     bool enable)
-{
-	struct ipa_intrabss_control_params intrabss_req = {0};
-	uint32_t intra_bss_fwd = 0;
-
-	if (!enable || ipa_ctx->disable_intrabss_fwd[session_id]) {
-		ipa_debug("%s: ipa_offload->enable=%d, rx_fwd_disabled=%d",
-			  __func__, enable,
-			  ipa_ctx->disable_intrabss_fwd[session_id]);
-		intra_bss_fwd = 1;
-	}
-
-	intrabss_req.vdev_id = session_id;
-	intrabss_req.enable = intra_bss_fwd;
-
-	if (QDF_STATUS_SUCCESS !=
-	    ipa_send_intrabss_enable_disable(ipa_ctx->pdev, &intrabss_req)) {
-		ipa_err("intrabss offload vdev_id=%d, enable=%d failure",
-			session_id, intra_bss_fwd);
-	}
-}
-#else
-static inline
-void wlan_ipa_intrabss_enable_disable(struct wlan_ipa_priv *ipa_ctx,
-				      uint8_t session_id,
-				      bool enable)
-{}
-#endif
-
-/**
- * wlan_ipa_uc_offload_enable_disable() - wdi enable/disable notify to fw
- * @ipa_ctx: global IPA context
- * @offload_type: MCC or SCC
- * @session_id: Session Id
- * @enable: TX offload enable or disable
- *
- * Return: none
- */
-static void wlan_ipa_uc_offload_enable_disable(struct wlan_ipa_priv *ipa_ctx,
-					       uint32_t offload_type,
-					       uint8_t session_id,
-					       bool enable)
-{
-
-	struct ipa_uc_offload_control_params req = {0};
-
-	if (session_id >= WLAN_IPA_MAX_SESSION) {
-		ipa_err("invalid session id: %d", session_id);
-		return;
-	}
-
-	if (enable == ipa_ctx->vdev_offload_enabled[session_id]) {
-		ipa_info("IPA offload status is already set");
-		ipa_info("offload_type=%d, vdev_id=%d, enable=%d",
-			 offload_type, session_id, enable);
-		return;
-	}
-
-	ipa_info("offload_type=%d, session_id=%d, enable=%d",
-		 offload_type, session_id, enable);
-
-	req.offload_type = offload_type;
-	req.vdev_id = session_id;
-	req.enable = enable;
-
-	if (QDF_STATUS_SUCCESS !=
-	    ipa_send_uc_offload_enable_disable(ipa_ctx->pdev, &req)) {
-		ipa_err("Fail to enable IPA offload");
-		ipa_err("offload type=%d, vdev_id=%d, enable=%d",
-			offload_type, session_id, enable);
-	} else {
-		ipa_ctx->vdev_offload_enabled[session_id] = enable;
-	}
-
-	wlan_ipa_intrabss_enable_disable(ipa_ctx, session_id, enable);
-}
-
-#ifdef WDI3_STATS_BW_MONITOR
-static void wlan_ipa_uc_bw_monitor(struct wlan_ipa_priv *ipa_ctx, bool stop)
-{
-	qdf_ipa_wdi_bw_info_t bw_info;
-	uint32_t bw_low = ipa_ctx->config->ipa_bw_low;
-	uint32_t bw_medium = ipa_ctx->config->ipa_bw_medium;
-	uint32_t bw_high = ipa_ctx->config->ipa_bw_high;
-	int ret;
-
-	bw_info.num = WLAN_IPA_UC_BW_MONITOR_LEVEL;
-	/* IPA uc will mobitor three bw levels for wlan client */
-	QDF_IPA_WDI_BW_INFO_THRESHOLD_LEVEL_1(&bw_info) = bw_low;
-	QDF_IPA_WDI_BW_INFO_THRESHOLD_LEVEL_2(&bw_info) = bw_medium;
-	QDF_IPA_WDI_BW_INFO_THRESHOLD_LEVEL_3(&bw_info) = bw_high;
-	QDF_IPA_WDI_BW_INFO_START_STOP(&bw_info) = stop;
-
-	ret = qdf_ipa_uc_bw_monitor(&bw_info);
-	if (ret)
-		ipa_err("ipa uc bw monitor fails");
-
-	if (!stop) {
-		cdp_ipa_set_perf_level(ipa_ctx->dp_soc,
-				       QDF_IPA_CLIENT_WLAN2_CONS,
-				       ipa_ctx->config->ipa_bw_low);
-		ipa_ctx->curr_bw_level = WLAN_IPA_BW_LEVEL_LOW;
-	}
-
-	ipa_debug("ipa uc bw monitor %s", stop ? "stop" : "start");
-}
-#else
-static inline
-void wlan_ipa_uc_bw_monitor(struct wlan_ipa_priv *ipa_ctx, bool stop)
-{
-}
-#endif
-
-/**
- * wlan_ipa_send_msg() - Allocate and send message to IPA
- * @net_dev: Interface net device
- * @type: event enum of type ipa_wlan_event
- * @mac_address: MAC address associated with the event
- *
- * Return: QDF STATUS
- */
-static QDF_STATUS wlan_ipa_send_msg(qdf_netdev_t net_dev,
-				    qdf_ipa_wlan_event type,
-				    uint8_t *mac_addr)
-{
-	qdf_ipa_msg_meta_t meta;
-	qdf_ipa_wlan_msg_t *msg;
-
-	QDF_IPA_MSG_META_MSG_LEN(&meta) = sizeof(qdf_ipa_wlan_msg_t);
-
-	msg = qdf_mem_malloc(QDF_IPA_MSG_META_MSG_LEN(&meta));
-	if (!msg)
-		return QDF_STATUS_E_NOMEM;
-
-	QDF_IPA_SET_META_MSG_TYPE(&meta, type);
-	strlcpy(QDF_IPA_WLAN_MSG_NAME(msg), net_dev->name, IPA_RESOURCE_NAME_MAX);
-	qdf_mem_copy(QDF_IPA_WLAN_MSG_MAC_ADDR(msg), mac_addr, QDF_NET_ETH_LEN);
-
-	ipa_debug("%s: Evt: %d", QDF_IPA_WLAN_MSG_NAME(msg), QDF_IPA_MSG_META_MSG_TYPE(&meta));
-
-	if (qdf_ipa_send_msg(&meta, msg, wlan_ipa_msg_free_fn)) {
-		ipa_err("%s: Evt: %d fail",
-			QDF_IPA_WLAN_MSG_NAME(msg),
-			QDF_IPA_MSG_META_MSG_TYPE(&meta));
-		qdf_mem_free(msg);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-
-#ifdef QCA_CONFIG_RPS
-void wlan_ipa_handle_multiple_sap_evt(struct wlan_ipa_priv *ipa_ctx,
-				      qdf_ipa_wlan_event type)
-{
-	struct wlan_ipa_iface_context *iface_ctx;
-	int i;
-
-	if (type ==  QDF_IPA_AP_DISCONNECT) {
-		ipa_debug("Multiple SAP disconnecting. Enabling IPA");
-
-		if (ipa_ctx->sap_num_connected_sta > 0)
-			wlan_ipa_uc_handle_first_con(ipa_ctx);
-
-		for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-			iface_ctx = &ipa_ctx->iface_context[i];
-
-			if (iface_ctx->device_mode == QDF_SAP_MODE) {
-				wlan_ipa_uc_offload_enable_disable(ipa_ctx,
-							SIR_AP_RX_DATA_OFFLOAD,
-							iface_ctx->session_id,
-							true);
-				break;
-			}
-		}
-	} else if (type ==  QDF_IPA_AP_CONNECT) {
-		ipa_debug("Multiple SAP connected. Disabling IPA");
-
-		for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-			iface_ctx = &ipa_ctx->iface_context[i];
-
-			if (iface_ctx->device_mode == QDF_SAP_MODE) {
-				wlan_ipa_uc_offload_enable_disable(ipa_ctx,
-							SIR_AP_RX_DATA_OFFLOAD,
-							iface_ctx->session_id,
-							false);
-			}
-		}
-
-		if (!ipa_ctx->ipa_pipes_down)
-			wlan_ipa_uc_disable_pipes(ipa_ctx, true);
-	}
-}
-#endif
-
-static inline void
-wlan_ipa_save_bssid_iface_ctx(struct wlan_ipa_priv *ipa_ctx, uint8_t iface_id,
-			      uint8_t *mac_addr)
-{
-	qdf_mem_copy(ipa_ctx->iface_context[iface_id].bssid.bytes,
-		     mac_addr, QDF_MAC_ADDR_SIZE);
-}
-
-/**
- * __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: @net_dev is 2G or not for QDF_IPA_STA_CONNECT and
- *		 QDF_IPA_AP_CONNECT
- *
- * This function is meant to be called from within wlan_ipa_ctx.c
- *
- * Return: QDF STATUS
- */
-static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode,
-				      uint8_t session_id,
-				      qdf_ipa_wlan_event type,
-				      uint8_t *mac_addr, bool is_2g_iface)
-{
-	struct wlan_ipa_priv *ipa_ctx = gp_ipa;
-	struct wlan_ipa_iface_context *iface_ctx = NULL;
-	qdf_ipa_msg_meta_t meta;
-	qdf_ipa_wlan_msg_t *msg;
-	qdf_ipa_wlan_msg_ex_t *msg_ex = NULL;
-	int i;
-	QDF_STATUS status;
-	uint8_t sta_session_id = WLAN_IPA_MAX_SESSION;
-	struct wlan_objmgr_pdev *pdev;
-	struct wlan_objmgr_psoc *psoc;
-	struct wlan_objmgr_vdev *vdev;
-
-	ipa_debug("%s: EVT: %d, MAC: "QDF_MAC_ADDR_FMT", session_id: %u",
-		  net_dev->name, type, QDF_MAC_ADDR_REF(mac_addr), session_id);
-
-	if (type >= QDF_IPA_WLAN_EVENT_MAX)
-		return QDF_STATUS_E_INVAL;
-
-	if (wlan_ipa_uc_is_enabled(ipa_ctx->config) &&
-	    !wlan_ipa_uc_sta_is_enabled(ipa_ctx->config) &&
-	    (device_mode != QDF_SAP_MODE)) {
-		return QDF_STATUS_SUCCESS;
-	}
-
-	pdev = ipa_ctx->pdev;
-	psoc = wlan_pdev_get_psoc(pdev);
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, session_id,
-						    WLAN_IPA_ID);
-	QDF_BUG(session_id < WLAN_IPA_MAX_SESSION);
-
-	if (vdev)
-		wlan_objmgr_vdev_release_ref(vdev, WLAN_IPA_ID);
-	else
-		ipa_err("vdev is NULL, session_id: %u", session_id);
-
-	if (ipa_ctx->sta_connected) {
-		iface_ctx = wlan_ipa_get_iface(ipa_ctx, QDF_STA_MODE);
-		if (iface_ctx)
-			sta_session_id = iface_ctx->session_id;
-		else
-			ipa_err("sta iface_ctx is NULL");
-	}
-
-	/*
-	 * During IPA UC resource loading/unloading new events can be issued.
-	 */
-	if (wlan_ipa_uc_is_enabled(ipa_ctx->config) &&
-	    (ipa_ctx->resource_loading || ipa_ctx->resource_unloading)) {
-		unsigned int pending_event_count;
-		struct wlan_ipa_uc_pending_event *pending_event = NULL;
-
-		ipa_info("Event:%d IPA resource %s inprogress", type,
-			 ipa_ctx->resource_loading ?
-			 "load" : "unload");
-
-		/* Wait until completion of the long/unloading */
-		status = qdf_wait_for_event_completion(
-				&ipa_ctx->ipa_resource_comp,
-				IPA_RESOURCE_COMP_WAIT_TIME);
-		if (status != QDF_STATUS_SUCCESS) {
-			/*
-			 * If timed out, store the events separately and
-			 * handle them later.
-			 */
-			ipa_info("IPA resource %s timed out",
-				  ipa_ctx->resource_loading ?
-				  "load" : "unload");
-
-			if (type == QDF_IPA_AP_DISCONNECT) {
-				wlan_ipa_uc_offload_enable_disable(ipa_ctx,
-						SIR_AP_RX_DATA_OFFLOAD,
-						session_id, false);
-			} else if (type == QDF_IPA_CLIENT_CONNECT_EX &&
-				   wlan_sap_no_client_connected(ipa_ctx)) {
-				if (wlan_sta_is_connected(ipa_ctx) &&
-				    wlan_ipa_uc_is_loaded(ipa_ctx) &&
-				    wlan_ipa_uc_sta_is_enabled(ipa_ctx->
-							       config) &&
-				    !wlan_ipa_is_sta_only_offload_enabled()) {
-					wlan_ipa_uc_offload_enable_disable(
-							ipa_ctx,
-							SIR_STA_RX_DATA_OFFLOAD,
-							sta_session_id, true);
-				}
-			}
-
-			qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-
-			pending_event_count =
-				qdf_list_size(&ipa_ctx->pending_event);
-			if (pending_event_count >=
-			    WLAN_IPA_MAX_PENDING_EVENT_COUNT) {
-				ipa_info("Reached max pending evt count");
-				qdf_list_remove_front(
-					&ipa_ctx->pending_event,
-					(qdf_list_node_t **)&pending_event);
-			} else {
-				pending_event =
-					(struct wlan_ipa_uc_pending_event *)
-					qdf_mem_malloc(sizeof(
-					struct wlan_ipa_uc_pending_event));
-			}
-
-			if (!pending_event) {
-				qdf_mutex_release(&ipa_ctx->ipa_lock);
-				return QDF_STATUS_E_NOMEM;
-			}
-
-			pending_event->net_dev = net_dev;
-			pending_event->device_mode = device_mode;
-			pending_event->session_id = session_id;
-			pending_event->type = type;
-			pending_event->is_loading = ipa_ctx->resource_loading;
-			qdf_mem_copy(pending_event->mac_addr,
-				     mac_addr, QDF_MAC_ADDR_SIZE);
-			pending_event->is_2g_iface = is_2g_iface;
-			qdf_list_insert_back(&ipa_ctx->pending_event,
-					     &pending_event->node);
-
-			qdf_mutex_release(&ipa_ctx->ipa_lock);
-
-			/* Cleanup interface */
-			if (type == QDF_IPA_STA_DISCONNECT ||
-			    type == QDF_IPA_AP_DISCONNECT) {
-				for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-					iface_ctx = &ipa_ctx->iface_context[i];
-					if (iface_ctx->dev == net_dev) {
-						wlan_ipa_cleanup_iface(
-								iface_ctx,
-								mac_addr);
-						break;
-					}
-				}
-
-				if (qdf_ipa_get_lan_rx_napi() &&
-				    ipa_ctx->num_sap_connected == 1) {
-					wlan_ipa_handle_multiple_sap_evt(ipa_ctx,
-									 type);
-				}
-			}
-
-			return QDF_STATUS_SUCCESS;
-		}
-		ipa_info("IPA resource %s completed",
-			 ipa_ctx->resource_loading ?
-			 "load" : "unload");
-	}
-
-	ipa_ctx->stats.event[type]++;
-
-	QDF_IPA_SET_META_MSG_TYPE(&meta, type);
-	switch (type) {
-	case QDF_IPA_STA_CONNECT:
-		qdf_mutex_acquire(&ipa_ctx->event_lock);
-
-		/* STA already connected and without disconnect, connect again
-		 * This is Roaming scenario, clean up ipa iface first, then add
-		 * ipa iface later, sta_connected-- first, sta_connected++
-		 * later to reflect real sta number on DUT.
-		 */
-		if (ipa_ctx->sta_connected) {
-			iface_ctx = wlan_ipa_get_iface_by_mode_netdev(
-					ipa_ctx, net_dev, QDF_STA_MODE);
-			if (iface_ctx) {
-				ipa_ctx->sta_connected--;
-				wlan_ipa_cleanup_iface(iface_ctx, NULL);
-			}
-			status = wlan_ipa_send_msg(net_dev,
-						   QDF_IPA_STA_DISCONNECT,
-						   mac_addr);
-			if (status != QDF_STATUS_SUCCESS) {
-				ipa_err("QDF_IPA_STA_DISCONNECT send failed %u",
-					status);
-				qdf_mutex_release(&ipa_ctx->event_lock);
-				goto end;
-			}
-		}
-
-		status = wlan_ipa_setup_iface(ipa_ctx, net_dev, device_mode,
-					      session_id, mac_addr,
-					      is_2g_iface);
-		if (status != QDF_STATUS_SUCCESS) {
-			ipa_err("wlan_ipa_setup_iface failed %u", status);
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			goto end;
-		}
-
-		ipa_ctx->vdev_to_iface[session_id] =
-				wlan_ipa_get_ifaceid(ipa_ctx, session_id);
-
-		wlan_ipa_save_bssid_iface_ctx(ipa_ctx,
-					     ipa_ctx->vdev_to_iface[session_id],
-					     mac_addr);
-
-		if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config) &&
-		    (ipa_ctx->sap_num_connected_sta > 0 ||
-		     wlan_ipa_is_sta_only_offload_enabled()) &&
-		    !ipa_ctx->sta_connected) {
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			wlan_ipa_uc_offload_enable_disable(ipa_ctx,
-				SIR_STA_RX_DATA_OFFLOAD, session_id,
-				true);
-			qdf_mutex_acquire(&ipa_ctx->event_lock);
-			qdf_atomic_set(&ipa_ctx->stats_quota, 1);
-		}
-
-		if (!wlan_ipa_is_sta_only_offload_enabled()) {
-			ipa_debug("IPA STA only offload not enabled");
-		} else if (ipa_ctx->uc_loaded &&
-			   !ipa_ctx->sap_num_connected_sta &&
-			   !ipa_ctx->sta_connected) {
-			status = wlan_ipa_uc_handle_first_con(ipa_ctx);
-			if (status) {
-				qdf_mutex_release(&ipa_ctx->event_lock);
-				ipa_info("handle 1st conn failed %d", status);
-				wlan_ipa_uc_offload_enable_disable(
-						ipa_ctx,
-						SIR_STA_RX_DATA_OFFLOAD,
-						session_id,
-						false);
-				ipa_ctx->vdev_to_iface[session_id] =
-				    WLAN_IPA_MAX_SESSION;
-				goto end;
-			}
-		}
-
-		ipa_ctx->sta_connected++;
-
-		if (qdf_ipa_get_lan_rx_napi() && ipa_ctx->sap_num_connected_sta)
-			ipa_set_rps_per_vdev(ipa_ctx, session_id, true);
-
-		qdf_mutex_release(&ipa_ctx->event_lock);
-
-		ipa_debug("sta_connected=%d vdev_to_iface[%u] %u",
-			 ipa_ctx->sta_connected,
-			 session_id,
-			 ipa_ctx->vdev_to_iface[session_id]);
-		break;
-
-	case QDF_IPA_AP_CONNECT:
-		qdf_mutex_acquire(&ipa_ctx->event_lock);
-
-		/* For DFS channel we get two start_bss event (before and after
-		 * CAC). Also when ACS range includes both DFS and non DFS
-		 * channels, we could possibly change channel many times due to
-		 * RADAR detection and chosen channel may not be a DFS channels.
-		 * So dont return error here. Just discard the event.
-		 */
-		if (ipa_ctx->vdev_to_iface[session_id] !=
-				WLAN_IPA_MAX_SESSION) {
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			return 0;
-		}
-
-		status = wlan_ipa_setup_iface(ipa_ctx, net_dev, device_mode,
-					      session_id, mac_addr,
-					      is_2g_iface);
-		if (status != QDF_STATUS_SUCCESS) {
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			ipa_err("%s: Evt: %d, Interface setup failed",
-				msg_ex->name, QDF_IPA_MSG_META_MSG_TYPE(&meta));
-			goto end;
-		}
-
-		if (wlan_ipa_uc_is_enabled(ipa_ctx->config)) {
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			if (qdf_ipa_get_lan_rx_napi() &&
-			    (ipa_ctx->num_sap_connected > 1)) {
-				wlan_ipa_handle_multiple_sap_evt(ipa_ctx, type);
-			} else {
-				wlan_ipa_uc_offload_enable_disable(ipa_ctx,
-							SIR_AP_RX_DATA_OFFLOAD,
-							session_id, true);
-			}
-			qdf_mutex_acquire(&ipa_ctx->event_lock);
-		}
-
-		ipa_ctx->vdev_to_iface[session_id] =
-				wlan_ipa_get_ifaceid(ipa_ctx, session_id);
-		ipa_debug("vdev_to_iface[%u]=%u",
-			 session_id,
-			 ipa_ctx->vdev_to_iface[session_id]);
-		qdf_mutex_release(&ipa_ctx->event_lock);
-		break;
-
-	case QDF_IPA_STA_DISCONNECT:
-		qdf_mutex_acquire(&ipa_ctx->event_lock);
-
-		if (!ipa_ctx->sta_connected) {
-			struct wlan_ipa_iface_context *iface;
-
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			ipa_info("%s: Evt: %d, STA already disconnected",
-				 msg_ex->name,
-				 QDF_IPA_MSG_META_MSG_TYPE(&meta));
-
-			iface = wlan_ipa_get_iface_by_mode_netdev(ipa_ctx,
-								  net_dev,
-								  QDF_STA_MODE);
-			if (iface)
-				wlan_ipa_cleanup_iface(iface, mac_addr);
-
-			return QDF_STATUS_E_INVAL;
-		}
-
-		ipa_ctx->sta_connected--;
-
-		if (!wlan_ipa_uc_is_enabled(ipa_ctx->config)) {
-			ipa_debug("%s: IPA UC OFFLOAD NOT ENABLED",
-				  msg_ex->name);
-		} else {
-			/*
-			 * Disable IPA pipes when
-			 * 1. STA is the last interface or
-			 * 2. STA only offload enabled and no clients connected
-			 * to SAP
-			 */
-			if ((ipa_ctx->num_iface == 1 ||
-			     (wlan_ipa_is_sta_only_offload_enabled() &&
-			      !ipa_ctx->sap_num_connected_sta)) &&
-			    wlan_ipa_is_fw_wdi_activated(ipa_ctx) &&
-			    !ipa_ctx->ipa_pipes_down &&
-			    (ipa_ctx->resource_unloading == false)) {
-				if (cds_is_driver_unloading()) {
-					/*
-					 * We disable WDI pipes directly here
-					 * since IPA_OPCODE_TX/RX_SUSPEND
-					 * message will not be processed when
-					 * unloading WLAN driver is in progress
-					 */
-					wlan_ipa_uc_disable_pipes(ipa_ctx,
-								  true);
-				} else {
-					wlan_ipa_uc_handle_last_discon(ipa_ctx,
-								       true);
-				}
-			}
-		}
-
-		if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config) &&
-		    (ipa_ctx->sap_num_connected_sta > 0 ||
-		     wlan_ipa_is_sta_only_offload_enabled())) {
-			qdf_atomic_set(&ipa_ctx->stats_quota, 0);
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			wlan_ipa_uc_offload_enable_disable(ipa_ctx,
-				SIR_STA_RX_DATA_OFFLOAD, session_id, false);
-			qdf_mutex_acquire(&ipa_ctx->event_lock);
-		}
-
-		ipa_ctx->vdev_to_iface[session_id] = WLAN_IPA_MAX_SESSION;
-		ipa_debug("vdev_to_iface[%u]=%u", session_id,
-			  ipa_ctx->vdev_to_iface[session_id]);
-
-		iface_ctx = wlan_ipa_get_iface_by_mode_netdev(ipa_ctx,
-							      net_dev,
-							      QDF_STA_MODE);
-		if (iface_ctx)
-			wlan_ipa_cleanup_iface(iface_ctx, mac_addr);
-
-		if (qdf_ipa_get_lan_rx_napi() && ipa_ctx->sap_num_connected_sta)
-			ipa_set_rps_per_vdev(ipa_ctx, session_id, false);
-
-		qdf_mutex_release(&ipa_ctx->event_lock);
-
-		ipa_debug("sta_connected=%d", ipa_ctx->sta_connected);
-		break;
-
-	case QDF_IPA_AP_DISCONNECT:
-		qdf_mutex_acquire(&ipa_ctx->event_lock);
-
-		if ((ipa_ctx->num_iface == 1) &&
-		    wlan_ipa_is_fw_wdi_activated(ipa_ctx) &&
-		    !ipa_ctx->ipa_pipes_down &&
-		    (ipa_ctx->resource_unloading == false)) {
-			if (cds_is_driver_unloading()) {
-				/*
-				 * We disable WDI pipes directly here since
-				 * IPA_OPCODE_TX/RX_SUSPEND message will not be
-				 * processed when unloading WLAN driver is in
-				 * progress
-				 */
-				wlan_ipa_uc_disable_pipes(ipa_ctx, true);
-			} else {
-				/*
-				 * This shouldn't happen :
-				 * No interface left but WDI pipes are still
-				 * active - force close WDI pipes
-				 */
-				ipa_err("No interface left but WDI pipes are still active");
-				wlan_ipa_uc_handle_last_discon(ipa_ctx, true);
-			}
-		}
-
-		if (wlan_ipa_uc_is_enabled(ipa_ctx->config)) {
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			wlan_ipa_uc_offload_enable_disable(ipa_ctx,
-				SIR_AP_RX_DATA_OFFLOAD, session_id, false);
-			qdf_mutex_acquire(&ipa_ctx->event_lock);
-			ipa_ctx->vdev_to_iface[session_id] =
-				WLAN_IPA_MAX_SESSION;
-			ipa_debug("vdev_to_iface[%u]=%u",
-				 session_id,
-				 ipa_ctx->vdev_to_iface[session_id]);
-		}
-
-		for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-			iface_ctx = &ipa_ctx->iface_context[i];
-			if (iface_ctx->dev == net_dev) {
-				wlan_ipa_cleanup_iface(iface_ctx, mac_addr);
-				break;
-			}
-		}
-
-		if (qdf_ipa_get_lan_rx_napi() &&
-		    (ipa_ctx->num_sap_connected == 1))
-			wlan_ipa_handle_multiple_sap_evt(ipa_ctx, type);
-
-		qdf_mutex_release(&ipa_ctx->event_lock);
-		break;
-
-	case QDF_IPA_CLIENT_CONNECT_EX:
-		if (!wlan_ipa_uc_is_enabled(ipa_ctx->config)) {
-			ipa_debug("%s: Evt: %d, IPA UC OFFLOAD NOT ENABLED",
-				  net_dev->name, type);
-			return QDF_STATUS_SUCCESS;
-		}
-
-		qdf_mutex_acquire(&ipa_ctx->event_lock);
-		if (wlan_ipa_uc_find_add_assoc_sta(ipa_ctx, true,
-						   mac_addr)) {
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			ipa_err("%s: STA found, addr: " QDF_MAC_ADDR_FMT,
-				net_dev->name,
-				QDF_MAC_ADDR_REF(mac_addr));
-			return QDF_STATUS_SUCCESS;
-		}
-
-		/* Enable IPA UC Data PIPEs when first STA connected */
-		if (ipa_ctx->sap_num_connected_sta == 0 &&
-				ipa_ctx->uc_loaded == true) {
-
-			if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config) &&
-			    ipa_ctx->sta_connected &&
-			    !wlan_ipa_is_sta_only_offload_enabled()) {
-				qdf_mutex_release(&ipa_ctx->event_lock);
-				wlan_ipa_uc_offload_enable_disable(ipa_ctx,
-							SIR_STA_RX_DATA_OFFLOAD,
-							sta_session_id, true);
-				qdf_mutex_acquire(&ipa_ctx->event_lock);
-				qdf_atomic_set(&ipa_ctx->stats_quota, 1);
-			}
-
-			/*
-			 * IPA pipes already enabled if STA only offload
-			 * is enabled and STA is connected to remote AP.
-			 */
-			if (wlan_ipa_is_sta_only_offload_enabled() &&
-			    ipa_ctx->sta_connected) {
-				ipa_debug("IPA pipes already enabled");
-			} else if (wlan_ipa_uc_handle_first_con(ipa_ctx)) {
-				ipa_info("%s: handle 1st con fail",
-					 net_dev->name);
-
-				if (wlan_ipa_uc_sta_is_enabled(
-					ipa_ctx->config) &&
-				    ipa_ctx->sta_connected &&
-				    !wlan_ipa_is_sta_only_offload_enabled()) {
-					qdf_atomic_set(&ipa_ctx->stats_quota,
-						       0);
-					qdf_mutex_release(&ipa_ctx->event_lock);
-					wlan_ipa_uc_offload_enable_disable(
-							ipa_ctx,
-							SIR_STA_RX_DATA_OFFLOAD,
-							sta_session_id, false);
-				} else {
-					qdf_mutex_release(&ipa_ctx->event_lock);
-				}
-
-				return QDF_STATUS_E_BUSY;
-			}
-			wlan_ipa_uc_bw_monitor(ipa_ctx, false);
-			ipa_info("first sap client connected");
-		}
-
-		ipa_ctx->sap_num_connected_sta++;
-
-		qdf_mutex_release(&ipa_ctx->event_lock);
-
-		QDF_IPA_SET_META_MSG_TYPE(&meta, type);
-		QDF_IPA_MSG_META_MSG_LEN(&meta) =
-			(sizeof(qdf_ipa_wlan_msg_ex_t) +
-				sizeof(qdf_ipa_wlan_hdr_attrib_val_t));
-		msg_ex = qdf_mem_malloc(QDF_IPA_MSG_META_MSG_LEN(&meta));
-		if (!msg_ex)
-			return QDF_STATUS_E_NOMEM;
-
-		strlcpy(msg_ex->name, net_dev->name,
-			IPA_RESOURCE_NAME_MAX);
-		msg_ex->num_of_attribs = 1;
-		msg_ex->attribs[0].attrib_type = WLAN_HDR_ATTRIB_MAC_ADDR;
-		if (wlan_ipa_uc_is_enabled(ipa_ctx->config)) {
-			msg_ex->attribs[0].offset =
-				WLAN_IPA_UC_WLAN_HDR_DES_MAC_OFFSET;
-		} else {
-			msg_ex->attribs[0].offset =
-				WLAN_IPA_WLAN_HDR_DES_MAC_OFFSET;
-		}
-		memcpy(msg_ex->attribs[0].u.mac_addr, mac_addr,
-		       IPA_MAC_ADDR_SIZE);
-
-		if (qdf_ipa_send_msg(&meta, msg_ex, wlan_ipa_msg_free_fn)) {
-			ipa_info("%s: Evt: %d send ipa msg fail",
-				 net_dev->name, type);
-			qdf_mem_free(msg_ex);
-			return QDF_STATUS_E_FAILURE;
-		}
-		ipa_ctx->stats.num_send_msg++;
-
-		ipa_debug("sap_num_connected_sta=%d",
-			  ipa_ctx->sap_num_connected_sta);
-
-		return QDF_STATUS_SUCCESS;
-
-	case WLAN_CLIENT_DISCONNECT:
-		if (!wlan_ipa_uc_is_enabled(ipa_ctx->config)) {
-			ipa_debug("%s: IPA UC OFFLOAD NOT ENABLED",
-				  msg_ex->name);
-			return QDF_STATUS_SUCCESS;
-		}
-
-		qdf_mutex_acquire(&ipa_ctx->event_lock);
-		wlan_ipa_set_sap_client_auth(ipa_ctx, mac_addr, false);
-		if (!ipa_ctx->sap_num_connected_sta) {
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			ipa_debug("%s: Evt: %d, Client already disconnected",
-				  msg_ex->name,
-				  QDF_IPA_MSG_META_MSG_TYPE(&meta));
-
-			return QDF_STATUS_SUCCESS;
-		}
-		if (!wlan_ipa_uc_find_add_assoc_sta(ipa_ctx, false,
-						    mac_addr)) {
-			qdf_mutex_release(&ipa_ctx->event_lock);
-			ipa_debug("%s: STA NOT found, not valid: "
-				QDF_MAC_ADDR_FMT,
-				msg_ex->name, QDF_MAC_ADDR_REF(mac_addr));
-
-			return QDF_STATUS_SUCCESS;
-		}
-		ipa_ctx->sap_num_connected_sta--;
-
-		/*
-		 * Disable IPA pipes when
-		 * 1. last client disconnected and
-		 * 2. STA is not connected if STA only offload is enabled
-		 */
-		if (!ipa_ctx->sap_num_connected_sta &&
-		    ipa_ctx->uc_loaded &&
-		    !(wlan_ipa_is_sta_only_offload_enabled() &&
-		      ipa_ctx->sta_connected)) {
-			if ((false == ipa_ctx->resource_unloading) &&
-			    wlan_ipa_is_fw_wdi_activated(ipa_ctx) &&
-			    !ipa_ctx->ipa_pipes_down) {
-				if (cds_is_driver_unloading()) {
-					/*
-					 * We disable WDI pipes directly here
-					 * since IPA_OPCODE_TX/RX_SUSPEND
-					 * message will not be processed when
-					 * unloading WLAN driver is in progress
-					 */
-
-					wlan_ipa_uc_bw_monitor(ipa_ctx, true);
-					wlan_ipa_uc_disable_pipes(ipa_ctx,
-								  true);
-				} else {
-					/*
-					 * If STA is connected, wait for IPA TX
-					 * completions before disabling
-					 * IPA pipes
-					 */
-					wlan_ipa_uc_handle_last_discon(ipa_ctx,
-								       !ipa_ctx->sta_connected);
-					wlan_ipa_uc_bw_monitor(ipa_ctx, true);
-				}
-				ipa_info("last sap client disconnected");
-			}
-
-			if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config) &&
-			    ipa_ctx->sta_connected &&
-			    !wlan_ipa_is_sta_only_offload_enabled()) {
-				qdf_atomic_set(&ipa_ctx->stats_quota, 0);
-				qdf_mutex_release(&ipa_ctx->event_lock);
-				wlan_ipa_uc_offload_enable_disable(ipa_ctx,
-							SIR_STA_RX_DATA_OFFLOAD,
-							sta_session_id, false);
-			} else {
-				qdf_mutex_release(&ipa_ctx->event_lock);
-			}
-		} else {
-			qdf_mutex_release(&ipa_ctx->event_lock);
-		}
-
-		ipa_debug("sap_num_connected_sta=%d",
-			  ipa_ctx->sap_num_connected_sta);
-		break;
-
-	default:
-		return QDF_STATUS_SUCCESS;
-	}
-
-	QDF_IPA_MSG_META_MSG_LEN(&meta) = sizeof(qdf_ipa_wlan_msg_t);
-	msg = qdf_mem_malloc(QDF_IPA_MSG_META_MSG_LEN(&meta));
-	if (!msg)
-		return QDF_STATUS_E_NOMEM;
-
-	QDF_IPA_SET_META_MSG_TYPE(&meta, type);
-	strlcpy(QDF_IPA_WLAN_MSG_NAME(msg), net_dev->name,
-		IPA_RESOURCE_NAME_MAX);
-	qdf_mem_copy(QDF_IPA_WLAN_MSG_MAC_ADDR(msg), mac_addr, QDF_NET_ETH_LEN);
-
-	ipa_debug("%s: Evt: %d", QDF_IPA_WLAN_MSG_NAME(msg),
-		  QDF_IPA_MSG_META_MSG_TYPE(&meta));
-
-	if (qdf_ipa_send_msg(&meta, msg, wlan_ipa_msg_free_fn)) {
-
-		ipa_err("%s: Evt: %d fail",
-			QDF_IPA_WLAN_MSG_NAME(msg),
-			QDF_IPA_MSG_META_MSG_TYPE(&meta));
-		qdf_mem_free(msg);
-
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	ipa_ctx->stats.num_send_msg++;
-
-end:
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * wlan_host_to_ipa_wlan_event() - convert wlan_ipa_wlan_event to ipa_wlan_event
- * @wlan_ipa_event_type: event to be converted to an ipa_wlan_event
- *
- * Return: qdf_ipa_wlan_event representing the wlan_ipa_wlan_event
- */
-static qdf_ipa_wlan_event
-wlan_host_to_ipa_wlan_event(enum wlan_ipa_wlan_event wlan_ipa_event_type)
-{
-	qdf_ipa_wlan_event ipa_event;
-
-	switch (wlan_ipa_event_type) {
-	case WLAN_IPA_CLIENT_CONNECT:
-		ipa_event = QDF_IPA_CLIENT_CONNECT;
-		break;
-	case WLAN_IPA_CLIENT_DISCONNECT:
-		ipa_event = QDF_IPA_CLIENT_DISCONNECT;
-		break;
-	case WLAN_IPA_AP_CONNECT:
-		ipa_event = QDF_IPA_AP_CONNECT;
-		break;
-	case WLAN_IPA_AP_DISCONNECT:
-		ipa_event = QDF_IPA_AP_DISCONNECT;
-		break;
-	case WLAN_IPA_STA_CONNECT:
-		ipa_event = QDF_IPA_STA_CONNECT;
-		break;
-	case WLAN_IPA_STA_DISCONNECT:
-		ipa_event = QDF_IPA_STA_DISCONNECT;
-		break;
-	case WLAN_IPA_CLIENT_CONNECT_EX:
-		ipa_event = QDF_IPA_CLIENT_CONNECT_EX;
-		break;
-	case WLAN_IPA_WLAN_EVENT_MAX:
-	default:
-		ipa_event =  QDF_IPA_WLAN_EVENT_MAX;
-		break;
-	}
-
-	return ipa_event;
-}
-
-#ifdef IPA_P2P_SUPPORT
-/**
- * wlan_ipa_device_mode_switch() - Switch P2p GO/CLI to SAP/STA mode
- * @device_mode: device mode
- *
- * Return: New device mode after switching
- */
-static uint8_t wlan_ipa_device_mode_switch(uint8_t device_mode)
-{
-	switch (device_mode) {
-	case QDF_P2P_CLIENT_MODE:
-		return QDF_STA_MODE;
-	case QDF_P2P_GO_MODE:
-		return QDF_SAP_MODE;
-	default:
-		break;
-	}
-
-	return device_mode;
-}
-#else
-static uint8_t wlan_ipa_device_mode_switch(uint8_t device_mode)
-{
-	return device_mode;
-}
-#endif
-
-/**
- * wlan_ipa_wlan_evt() - SSR wrapper for __wlan_ipa_wlan_evt
- * @net_dev: Interface net device
- * @device_mode: Net interface device mode
- * @session_id: session id for the event
- * @ipa_event_type: event enum of type wlan_ipa_wlan_event
- * @mac_address: MAC address associated with the event
- * @is_2g_iface: @net_dev is 2g interface or not
- *
- * 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)
-{
-	qdf_ipa_wlan_event type = wlan_host_to_ipa_wlan_event(ipa_event_type);
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-
-	device_mode = wlan_ipa_device_mode_switch(device_mode);
-
-	/* Data path offload only support for STA and SAP mode */
-	if ((device_mode == QDF_STA_MODE) ||
-	    (device_mode == QDF_SAP_MODE))
-		status  = __wlan_ipa_wlan_evt(net_dev, device_mode,
-					      session_id, type, mac_addr,
-					      is_2g_iface);
-
-	return status;
-}
-
-/**
- * wlan_ipa_uc_proc_pending_event() - Process IPA uC pending events
- * @ipa_ctx: Global IPA IPA context
- * @is_loading: Indicate if invoked during loading
- *
- * Return: None
- */
-static void
-wlan_ipa_uc_proc_pending_event(struct wlan_ipa_priv *ipa_ctx, bool is_loading)
-{
-	unsigned int pending_event_count;
-	struct wlan_ipa_uc_pending_event *pending_event = NULL;
-
-	pending_event_count = qdf_list_size(&ipa_ctx->pending_event);
-	ipa_debug("Pending Event Count %d",  pending_event_count);
-	if (!pending_event_count) {
-		ipa_debug("No Pending Event");
-		return;
-	}
-
-	qdf_list_remove_front(&ipa_ctx->pending_event,
-			(qdf_list_node_t **)&pending_event);
-	while (pending_event) {
-		struct wlan_objmgr_pdev *pdev = ipa_ctx->pdev;
-		struct wlan_objmgr_psoc *psoc = wlan_pdev_get_psoc(pdev);
-		struct wlan_objmgr_vdev *vdev =
-				wlan_objmgr_get_vdev_by_id_from_psoc(psoc,
-					pending_event->session_id,
-					WLAN_IPA_ID);
-		if (pending_event->is_loading == is_loading && vdev) {
-			__wlan_ipa_wlan_evt(pending_event->net_dev,
-					   pending_event->device_mode,
-					   pending_event->session_id,
-					   pending_event->type,
-					   pending_event->mac_addr,
-					   pending_event->is_2g_iface);
-		}
-
-		if (vdev)
-			wlan_objmgr_vdev_release_ref(vdev, WLAN_IPA_ID);
-		qdf_mem_free(pending_event);
-		pending_event = NULL;
-		qdf_list_remove_front(&ipa_ctx->pending_event,
-				      (qdf_list_node_t **)&pending_event);
-	}
-}
-
-#ifndef QCA_LL_TX_FLOW_CONTROL_V2
-
-/**
- * wlan_ipa_free_tx_desc_list() - Free IPA Tx desc list
- * @ipa_ctx: IPA context
- *
- * Return: None
- */
-static inline void wlan_ipa_free_tx_desc_list(struct wlan_ipa_priv *ipa_ctx)
-{
-	int i;
-	qdf_ipa_rx_data_t *ipa_tx_desc;
-	uint32_t pool_size;
-
-	if (!ipa_ctx->tx_desc_pool)
-		return;
-
-	qdf_spin_lock_bh(&ipa_ctx->q_lock);
-	pool_size = ipa_ctx->tx_desc_free_list.max_size;
-	for (i = 0; i < pool_size; i++) {
-		ipa_tx_desc = ipa_ctx->tx_desc_pool[i].ipa_tx_desc_ptr;
-		if (ipa_tx_desc)
-			qdf_ipa_free_skb(ipa_tx_desc);
-
-		if (ipa_ctx->tx_desc_free_list.count &&
-		    qdf_list_remove_node(&ipa_ctx->tx_desc_free_list,
-					 &ipa_ctx->tx_desc_pool[i].node) !=
-							QDF_STATUS_SUCCESS)
-			ipa_err("Failed to remove node from tx desc freelist");
-	}
-	qdf_spin_unlock_bh(&ipa_ctx->q_lock);
-
-	qdf_list_destroy(&ipa_ctx->tx_desc_free_list);
-	qdf_mem_free(ipa_ctx->tx_desc_pool);
-	ipa_ctx->tx_desc_pool = NULL;
-
-	ipa_ctx->stats.num_tx_desc_q_cnt = 0;
-	ipa_ctx->stats.num_tx_desc_error = 0;
-}
-
-/**
- * wlan_ipa_alloc_tx_desc_free_list() - Allocate IPA Tx desc list
- * @ipa_ctx: IPA context
- *
- * Return: QDF_STATUS
- */
-static QDF_STATUS
-wlan_ipa_alloc_tx_desc_free_list(struct wlan_ipa_priv *ipa_ctx)
-{
-	int i;
-	uint32_t max_desc_cnt;
-
-	max_desc_cnt = ipa_ctx->config->txbuf_count;
-
-	ipa_ctx->tx_desc_pool = qdf_mem_malloc(sizeof(struct wlan_ipa_tx_desc) *
-					       max_desc_cnt);
-	if (!ipa_ctx->tx_desc_pool)
-		return QDF_STATUS_E_NOMEM;
-
-	qdf_list_create(&ipa_ctx->tx_desc_free_list, max_desc_cnt);
-
-	qdf_spin_lock_bh(&ipa_ctx->q_lock);
-	for (i = 0; i < max_desc_cnt; i++) {
-		ipa_ctx->tx_desc_pool[i].id = i;
-		ipa_ctx->tx_desc_pool[i].ipa_tx_desc_ptr = NULL;
-		qdf_list_insert_back(&ipa_ctx->tx_desc_free_list,
-				     &ipa_ctx->tx_desc_pool[i].node);
-	}
-
-	ipa_ctx->stats.num_tx_desc_q_cnt = 0;
-	ipa_ctx->stats.num_tx_desc_error = 0;
-
-	qdf_spin_unlock_bh(&ipa_ctx->q_lock);
-
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * wlan_ipa_setup_tx_sys_pipe() - Setup IPA Tx system pipes
- * @ipa_ctx: Global IPA IPA context
- * @desc_fifo_sz: Number of descriptors
- *
- * Return: 0 on success, negative errno on error
- */
-static int wlan_ipa_setup_tx_sys_pipe(struct wlan_ipa_priv *ipa_ctx,
-				     int32_t desc_fifo_sz)
-{
-	int i, ret = 0;
-	qdf_ipa_sys_connect_params_t *ipa;
-
-	/*setup TX pipes */
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		ipa = &ipa_ctx->sys_pipe[i].ipa_sys_params;
-
-		ipa->client = wlan_ipa_iface_2_client[i].cons_client;
-		ipa->desc_fifo_sz = desc_fifo_sz;
-		ipa->priv = &ipa_ctx->iface_context[i];
-		ipa->notify = wlan_ipa_i2w_cb;
-
-		if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config)) {
-			ipa->ipa_ep_cfg.hdr.hdr_len =
-				WLAN_IPA_UC_WLAN_TX_HDR_LEN;
-			ipa->ipa_ep_cfg.nat.nat_en = IPA_BYPASS_NAT;
-			ipa->ipa_ep_cfg.hdr.hdr_ofst_pkt_size_valid = 1;
-			ipa->ipa_ep_cfg.hdr.hdr_ofst_pkt_size = 0;
-			ipa->ipa_ep_cfg.hdr.hdr_additional_const_len =
-				WLAN_IPA_UC_WLAN_8023_HDR_SIZE;
-			ipa->ipa_ep_cfg.hdr_ext.hdr_little_endian = true;
-		} else {
-			ipa->ipa_ep_cfg.hdr.hdr_len = WLAN_IPA_WLAN_TX_HDR_LEN;
-		}
-		ipa->ipa_ep_cfg.mode.mode = IPA_BASIC;
-
-		ret = wlan_ipa_wdi_setup_sys_pipe(ipa_ctx, ipa,
-				&ipa_ctx->sys_pipe[i].conn_hdl);
-		if (ret) {
-			ipa_err("Failed for pipe %d ret: %d", i, ret);
-			return ret;
-		}
-		ipa_ctx->sys_pipe[i].conn_hdl_valid = 1;
-	}
-
-	return ret;
-}
-#else /* QCA_LL_TX_FLOW_CONTROL_V2 */
-
-/**
- * wlan_ipa_free_tx_desc_list() - Free IPA Tx desc list
- * @ipa_ctx: IPA context
- *
- * Return: None
- */
-static inline void wlan_ipa_free_tx_desc_list(struct wlan_ipa_priv *ipa_ctx)
-{
-}
-
-/**
- * wlan_ipa_alloc_tx_desc_free_list() - Allocate IPA Tx desc list
- * @ipa_ctx: IPA context
- *
- * Return: QDF_STATUS
- */
-static QDF_STATUS
-wlan_ipa_alloc_tx_desc_free_list(struct wlan_ipa_priv *ipa_ctx)
-{
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * wlan_ipa_setup_tx_sys_pipe() - Setup IPA Tx system pipes
- * @ipa_ctx: IPA context
- * @desc_fifo_sz: Number of descriptors
- *
- * Return: 0 on success, negative errno on error
- */
-static int wlan_ipa_setup_tx_sys_pipe(struct wlan_ipa_priv *ipa_ctx,
-				     int32_t desc_fifo_sz)
-{
-	/*
-	 * The Tx system pipes are not needed for MCC when TX_FLOW_CONTROL_V2
-	 * is enabled, where per vdev descriptors are supported in firmware.
-	 */
-	return 0;
-}
-#endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
-
-#if defined(CONFIG_IPA_WDI_UNIFIED_API) && defined(IPA_WDI3_GSI)
-/**
- * wlan_ipa_get_rx_ipa_client() - Get IPA RX ipa client
- * @ipa_ctx: IPA context
- *
- * Return: rx ipa sys client
- */
-static inline uint8_t wlan_ipa_get_rx_ipa_client(struct wlan_ipa_priv *ipa_ctx)
-{
-	if (ipa_ctx->over_gsi)
-		return IPA_CLIENT_WLAN2_PROD;
-	else
-		return IPA_CLIENT_WLAN1_PROD;
-}
-
-/**
- * wlan_ipa_uc_send_wdi_control_msg() - Set WDI control message
- * @ctrl: WDI control value
- *
- * Send WLAN_WDI_ENABLE for ctrl = true and WLAN_WDI_DISABLE otherwise.
- *
- * Return: QDF_STATUS
- */
-static QDF_STATUS wlan_ipa_uc_send_wdi_control_msg(bool ctrl)
-{
-	return QDF_STATUS_SUCCESS;
-}
-
-#else
-static inline uint8_t wlan_ipa_get_rx_ipa_client(struct wlan_ipa_priv *ipa_ctx)
-{
-	return IPA_CLIENT_WLAN1_PROD;
-}
-
-static QDF_STATUS wlan_ipa_uc_send_wdi_control_msg(bool ctrl)
-{
-	struct wlan_ipa_priv *ipa_ctx = gp_ipa;
-	qdf_ipa_msg_meta_t meta;
-	qdf_ipa_wlan_msg_t *ipa_msg;
-	int ret = 0;
-
-	/* WDI enable message to IPA */
-	QDF_IPA_MSG_META_MSG_LEN(&meta) = sizeof(*ipa_msg);
-	ipa_msg = qdf_mem_malloc(QDF_IPA_MSG_META_MSG_LEN(&meta));
-	if (!ipa_msg)
-		return QDF_STATUS_E_NOMEM;
-
-	if (ctrl) {
-		QDF_IPA_SET_META_MSG_TYPE(&meta, QDF_WDI_ENABLE);
-		ipa_ctx->stats.event[QDF_WDI_ENABLE]++;
-	} else {
-		QDF_IPA_SET_META_MSG_TYPE(&meta, QDF_WDI_DISABLE);
-		ipa_ctx->stats.event[QDF_WDI_DISABLE]++;
-	}
-
-	ipa_debug("ipa_send_msg(Evt:%d)", QDF_IPA_MSG_META_MSG_TYPE(&meta));
-	ret = qdf_ipa_send_msg(&meta, ipa_msg, wlan_ipa_msg_free_fn);
-	if (ret) {
-		ipa_err("ipa_send_msg(Evt:%d)-fail=%d",
-			QDF_IPA_MSG_META_MSG_TYPE(&meta), ret);
-		qdf_mem_free(ipa_msg);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-#endif
-
-/**
- * wlan_ipa_setup_rx_sys_pipe() - Setup IPA Rx system pipes
- * @ipa_ctx: Global IPA IPA context
- * @desc_fifo_sz: Number of descriptors
- *
- * Return: 0 on success, negative errno on error
- */
-static int wlan_ipa_setup_rx_sys_pipe(struct wlan_ipa_priv *ipa_ctx,
-				     int32_t desc_fifo_sz)
-{
-	int ret = 0;
-	qdf_ipa_sys_connect_params_t *ipa;
-
-	/*
-	 * Hard code it here, this can be extended if in case
-	 * PROD pipe is also per interface.
-	 * Right now there is no advantage of doing this.
-	 */
-	ipa = &ipa_ctx->sys_pipe[WLAN_IPA_RX_PIPE].ipa_sys_params;
-
-	ipa->client = wlan_ipa_get_rx_ipa_client(ipa_ctx);
-	ipa->desc_fifo_sz = desc_fifo_sz;
-	ipa->priv = ipa_ctx;
-	ipa->notify = wlan_ipa_w2i_cb;
-
-	ipa->ipa_ep_cfg.nat.nat_en = IPA_BYPASS_NAT;
-	ipa->ipa_ep_cfg.hdr.hdr_len = WLAN_IPA_WLAN_RX_HDR_LEN;
-	ipa->ipa_ep_cfg.hdr.hdr_ofst_metadata_valid = 1;
-	ipa->ipa_ep_cfg.mode.mode = IPA_BASIC;
-
-	ret = qdf_ipa_setup_sys_pipe(ipa,
-			&ipa_ctx->sys_pipe[WLAN_IPA_RX_PIPE].conn_hdl);
-	if (ret) {
-		ipa_err("Failed for RX pipe: %d", ret);
-		return ret;
-	}
-	ipa_ctx->sys_pipe[WLAN_IPA_RX_PIPE].conn_hdl_valid = 1;
-
-	return ret;
-}
-
-/**
- * wlan_ipa_teardown_sys_pipe() - Tear down all IPA Sys pipes
- * @ipa_ctx: Global IPA IPA context
- *
- * Return: None
- */
-static void wlan_ipa_teardown_sys_pipe(struct wlan_ipa_priv *ipa_ctx)
-{
-	int ret, i;
-
-	if (!ipa_ctx)
-		return;
-
-	for (i = 0; i < WLAN_IPA_MAX_SYSBAM_PIPE; i++) {
-		if (ipa_ctx->sys_pipe[i].conn_hdl_valid) {
-			ret = wlan_ipa_wdi_teardown_sys_pipe(ipa_ctx,
-							     ipa_ctx->sys_pipe[i].conn_hdl);
-			if (ret)
-				ipa_err("Failed:%d", ret);
-
-			ipa_ctx->sys_pipe[i].conn_hdl_valid = 0;
-		}
-	}
-
-	wlan_ipa_free_tx_desc_list(ipa_ctx);
-}
-
-/**
- * wlan_ipa_setup_sys_pipe() - Setup all IPA system pipes
- * @ipa_ctx: Global IPA IPA context
- *
- * Return: 0 on success, negative errno on error
- */
-static int wlan_ipa_setup_sys_pipe(struct wlan_ipa_priv *ipa_ctx)
-{
-	int ret = 0;
-	uint32_t desc_fifo_sz;
-
-	/* The maximum number of descriptors that can be provided to a BAM at
-	 * once is one less than the total number of descriptors that the buffer
-	 * can contain.
-	 * If max_num_of_descriptors = (BAM_PIPE_DESCRIPTOR_FIFO_SIZE / sizeof
-	 * (SPS_DESCRIPTOR)), then (max_num_of_descriptors - 1) descriptors can
-	 * be provided at once.
-	 * Because of above requirement, one extra descriptor will be added to
-	 * make sure hardware always has one descriptor.
-	 */
-	desc_fifo_sz = ipa_ctx->config->desc_size
-		       + SPS_DESC_SIZE;
-
-	ret = wlan_ipa_setup_tx_sys_pipe(ipa_ctx, desc_fifo_sz);
-	if (ret) {
-		ipa_err("Failed for TX pipe: %d", ret);
-		goto setup_sys_pipe_fail;
-	}
-
-	if (!wlan_ipa_uc_sta_is_enabled(ipa_ctx->config)) {
-		ret = wlan_ipa_setup_rx_sys_pipe(ipa_ctx, desc_fifo_sz);
-		if (ret) {
-			ipa_err("Failed for RX pipe: %d", ret);
-			goto setup_sys_pipe_fail;
-		}
-	}
-
-       /* Allocate free Tx desc list */
-	ret = wlan_ipa_alloc_tx_desc_free_list(ipa_ctx);
-	if (ret)
-		goto setup_sys_pipe_fail;
-
-	return ret;
-
-setup_sys_pipe_fail:
-	wlan_ipa_teardown_sys_pipe(ipa_ctx);
-
-	return ret;
-}
-
-#ifndef QCA_LL_TX_FLOW_CONTROL_V2
-QDF_STATUS wlan_ipa_send_mcc_scc_msg(struct wlan_ipa_priv *ipa_ctx,
-				     bool mcc_mode)
-{
-	qdf_ipa_msg_meta_t meta;
-	qdf_ipa_wlan_msg_t *msg;
-	int ret;
-
-	if (!wlan_ipa_uc_sta_is_enabled(ipa_ctx->config))
-		return QDF_STATUS_SUCCESS;
-
-	/* Send SCC/MCC Switching event to IPA */
-	QDF_IPA_MSG_META_MSG_LEN(&meta) = sizeof(*msg);
-	msg = qdf_mem_malloc(QDF_IPA_MSG_META_MSG_LEN(&meta));
-	if (!msg)
-		return QDF_STATUS_E_NOMEM;
-
-	if (mcc_mode) {
-		QDF_IPA_SET_META_MSG_TYPE(&meta, QDF_SWITCH_TO_MCC);
-		ipa_ctx->stats.event[QDF_SWITCH_TO_MCC]++;
-	} else {
-		QDF_IPA_SET_META_MSG_TYPE(&meta, QDF_SWITCH_TO_SCC);
-		ipa_ctx->stats.event[QDF_SWITCH_TO_SCC]++;
-	}
-
-	WLAN_IPA_LOG(QDF_TRACE_LEVEL_DEBUG,
-		    "ipa_send_msg(Evt:%d)",
-		    QDF_IPA_MSG_META_MSG_TYPE(&meta));
-
-	ret = qdf_ipa_send_msg(&meta, msg, wlan_ipa_msg_free_fn);
-
-	if (ret) {
-		ipa_err("ipa_send_msg(Evt:%d) - fail=%d",
-			QDF_IPA_MSG_META_MSG_TYPE(&meta), ret);
-		qdf_mem_free(msg);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-
-static void wlan_ipa_mcc_work_handler(void *data)
-{
-	struct wlan_ipa_priv *ipa_ctx = (struct wlan_ipa_priv *)data;
-
-	wlan_ipa_send_mcc_scc_msg(ipa_ctx, ipa_ctx->mcc_mode);
-}
-#endif
-
-/**
- * wlan_ipa_setup() - IPA initialization function
- * @ipa_ctx: IPA context
- * @ipa_cfg: IPA config
- *
- * Allocate ipa_ctx resources, ipa pipe resource and register
- * wlan interface with IPA module.
- *
- * Return: QDF_STATUS enumeration
- */
-QDF_STATUS wlan_ipa_setup(struct wlan_ipa_priv *ipa_ctx,
-			  struct wlan_ipa_config *ipa_cfg)
-{
-	int ret, i;
-	struct wlan_ipa_iface_context *iface_context = NULL;
-	QDF_STATUS status;
-
-	ipa_debug("enter");
-
-	gp_ipa = ipa_ctx;
-	ipa_ctx->num_iface = 0;
-	ipa_ctx->config = ipa_cfg;
-
-	wlan_ipa_wdi_get_wdi_version(ipa_ctx);
-
-	/* Create the interface context */
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_context = &ipa_ctx->iface_context[i];
-		iface_context->ipa_ctx = ipa_ctx;
-		iface_context->cons_client =
-			wlan_ipa_iface_2_client[i].cons_client;
-		iface_context->prod_client =
-			wlan_ipa_iface_2_client[i].prod_client;
-		iface_context->iface_id = i;
-		iface_context->dev = NULL;
-		iface_context->device_mode = QDF_MAX_NO_OF_MODE;
-		iface_context->session_id = WLAN_IPA_MAX_SESSION;
-		qdf_atomic_init(&iface_context->conn_count);
-		qdf_atomic_init(&iface_context->disconn_count);
-		qdf_spinlock_create(&iface_context->interface_lock);
-	}
-
-	qdf_create_work(0, &ipa_ctx->pm_work, wlan_ipa_pm_flush, ipa_ctx);
-	qdf_spinlock_create(&ipa_ctx->pm_lock);
-	qdf_spinlock_create(&ipa_ctx->q_lock);
-	qdf_spinlock_create(&ipa_ctx->enable_disable_lock);
-	ipa_ctx->pipes_down_in_progress = false;
-	ipa_ctx->pipes_enable_in_progress = false;
-	qdf_nbuf_queue_init(&ipa_ctx->pm_queue_head);
-	qdf_list_create(&ipa_ctx->pending_event, 1000);
-	qdf_mutex_create(&ipa_ctx->event_lock);
-	qdf_mutex_create(&ipa_ctx->ipa_lock);
-	qdf_atomic_init(&ipa_ctx->deinit_in_prog);
-
-	status = wlan_ipa_wdi_setup_rm(ipa_ctx);
-	if (status != QDF_STATUS_SUCCESS)
-		goto fail_setup_rm;
-
-	for (i = 0; i < WLAN_IPA_MAX_SYSBAM_PIPE; i++)
-		qdf_mem_zero(&ipa_ctx->sys_pipe[i],
-			     sizeof(struct wlan_ipa_sys_pipe));
-
-	if (wlan_ipa_uc_is_enabled(ipa_ctx->config)) {
-		qdf_mem_zero(&ipa_ctx->stats, sizeof(ipa_ctx->stats));
-		ipa_ctx->sap_num_connected_sta = 0;
-		ipa_ctx->ipa_tx_packets_diff = 0;
-		ipa_ctx->ipa_rx_packets_diff = 0;
-		ipa_ctx->ipa_p_tx_packets = 0;
-		ipa_ctx->ipa_p_rx_packets = 0;
-		ipa_ctx->resource_loading = false;
-		ipa_ctx->resource_unloading = false;
-		ipa_ctx->num_sap_connected = 0;
-		ipa_ctx->sta_connected = 0;
-		ipa_ctx->ipa_pipes_down = true;
-		qdf_atomic_set(&ipa_ctx->pipes_disabled, 1);
-		qdf_atomic_set(&ipa_ctx->autonomy_disabled, 1);
-		ipa_ctx->wdi_enabled = false;
-
-		status = wlan_ipa_wdi_init(ipa_ctx);
-		if (status == QDF_STATUS_SUCCESS) {
-			/* Setup IPA system pipes */
-			if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config)) {
-				ret = wlan_ipa_setup_sys_pipe(ipa_ctx);
-				if (ret)
-					goto ipa_wdi_destroy;
-
-				qdf_create_work(0, &ipa_ctx->mcc_work,
-						wlan_ipa_mcc_work_handler,
-						ipa_ctx);
-			}
-		} else if (status == QDF_STATUS_E_BUSY) {
-			ret = wlan_ipa_uc_send_wdi_control_msg(false);
-			if (ret) {
-				ipa_err("IPA WDI msg send failed: ret=%d", ret);
-				goto ipa_wdi_destroy;
-			}
-		} else {
-			ipa_err("IPA WDI init failed: ret=%d", status);
-			goto ipa_wdi_destroy;
-		}
-	} else {
-		ret = wlan_ipa_setup_sys_pipe(ipa_ctx);
-		if (ret)
-			goto ipa_wdi_destroy;
-	}
-
-	qdf_event_create(&ipa_ctx->ipa_resource_comp);
-
-	ipa_debug("exit: success");
-
-	return QDF_STATUS_SUCCESS;
-
-ipa_wdi_destroy:
-	wlan_ipa_wdi_destroy_rm(ipa_ctx);
-
-fail_setup_rm:
-	qdf_spinlock_destroy(&ipa_ctx->pm_lock);
-	qdf_spinlock_destroy(&ipa_ctx->q_lock);
-	qdf_spinlock_destroy(&ipa_ctx->enable_disable_lock);
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_context = &ipa_ctx->iface_context[i];
-		qdf_spinlock_destroy(&iface_context->interface_lock);
-	}
-	qdf_mutex_destroy(&ipa_ctx->event_lock);
-	qdf_mutex_destroy(&ipa_ctx->ipa_lock);
-	qdf_list_destroy(&ipa_ctx->pending_event);
-	gp_ipa = NULL;
-	ipa_debug("exit: fail");
-
-	return QDF_STATUS_E_FAILURE;
-}
-
-void wlan_ipa_flush(struct wlan_ipa_priv *ipa_ctx)
-{
-	qdf_nbuf_t skb;
-	struct wlan_ipa_pm_tx_cb *pm_tx_cb;
-
-	if (!wlan_ipa_is_enabled(ipa_ctx->config))
-		return;
-
-	qdf_cancel_work(&ipa_ctx->pm_work);
-
-	qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-
-	while (((skb = qdf_nbuf_queue_remove(&ipa_ctx->pm_queue_head))
-	       != NULL)) {
-		qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-
-		pm_tx_cb = (struct wlan_ipa_pm_tx_cb *)skb->cb;
-
-		if (pm_tx_cb->exception) {
-			dev_kfree_skb_any(skb);
-		} else {
-			if (pm_tx_cb->ipa_tx_desc)
-				ipa_free_skb(pm_tx_cb->ipa_tx_desc);
-		}
-
-		qdf_spin_lock_bh(&ipa_ctx->pm_lock);
-	}
-	qdf_spin_unlock_bh(&ipa_ctx->pm_lock);
-}
-
-QDF_STATUS wlan_ipa_cleanup(struct wlan_ipa_priv *ipa_ctx)
-{
-	struct wlan_ipa_iface_context *iface_context;
-	int i;
-
-	if (!ipa_cb_is_ready())
-		return QDF_STATUS_SUCCESS;
-
-	if (!wlan_ipa_uc_is_enabled(ipa_ctx->config))
-		wlan_ipa_teardown_sys_pipe(ipa_ctx);
-
-	/* Teardown IPA sys_pipe for MCC */
-	if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config)) {
-		wlan_ipa_teardown_sys_pipe(ipa_ctx);
-		if (ipa_ctx->uc_loaded)
-			qdf_cancel_work(&ipa_ctx->mcc_work);
-	}
-
-	wlan_ipa_wdi_destroy_rm(ipa_ctx);
-
-	wlan_ipa_flush(ipa_ctx);
-
-	qdf_spinlock_destroy(&ipa_ctx->pm_lock);
-	qdf_spinlock_destroy(&ipa_ctx->q_lock);
-	qdf_spinlock_destroy(&ipa_ctx->enable_disable_lock);
-
-	/* destroy the interface lock */
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_context = &ipa_ctx->iface_context[i];
-		qdf_spinlock_destroy(&iface_context->interface_lock);
-	}
-
-	if (wlan_ipa_uc_is_enabled(ipa_ctx->config)) {
-		wlan_ipa_wdi_cleanup();
-		qdf_mutex_destroy(&ipa_ctx->event_lock);
-		qdf_mutex_destroy(&ipa_ctx->ipa_lock);
-		qdf_list_destroy(&ipa_ctx->pending_event);
-
-	}
-
-	gp_ipa = NULL;
-
-	return QDF_STATUS_SUCCESS;
-}
-
-struct wlan_ipa_iface_context
-*wlan_ipa_get_iface(struct wlan_ipa_priv *ipa_ctx, uint8_t mode)
-{
-	struct wlan_ipa_iface_context *iface_ctx = NULL;
-	int i;
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_ctx = &ipa_ctx->iface_context[i];
-
-		if (iface_ctx->device_mode == mode)
-			return iface_ctx;
-	}
-
-	return NULL;
-}
-
-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)
-{
-	struct wlan_ipa_iface_context *iface_ctx = NULL;
-	int i;
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_ctx = &ipa_ctx->iface_context[i];
-
-		if (iface_ctx->device_mode == mode && iface_ctx->dev == ndev)
-			return iface_ctx;
-	}
-
-	return NULL;
-}
-
-void wlan_ipa_set_mcc_mode(struct wlan_ipa_priv *ipa_ctx, bool mcc_mode)
-{
-	if (!wlan_ipa_uc_sta_is_enabled(ipa_ctx->config))
-		return;
-
-	if (ipa_ctx->mcc_mode == mcc_mode)
-		return;
-
-	ipa_ctx->mcc_mode = mcc_mode;
-	qdf_sched_work(0, &ipa_ctx->mcc_work);
-}
-
-/**
- * wlan_ipa_uc_loaded_handler() - Process IPA uC loaded indication
- * @ipa_ctx: ipa ipa local context
- *
- * Will handle IPA UC image loaded indication comes from IPA kernel
- *
- * Return: None
- */
-static void wlan_ipa_uc_loaded_handler(struct wlan_ipa_priv *ipa_ctx)
-{
-	struct wlan_objmgr_pdev *pdev = ipa_ctx->pdev;
-	struct wlan_objmgr_psoc *psoc = wlan_pdev_get_psoc(pdev);
-	qdf_device_t qdf_dev = wlan_psoc_get_qdf_dev(psoc);
-	QDF_STATUS status;
-
-	ipa_info("UC READY");
-
-	if (true == ipa_ctx->uc_loaded) {
-		ipa_info("UC already loaded");
-		return;
-	}
-
-	if (!qdf_dev) {
-		ipa_err("qdf_dev is null");
-		return;
-	}
-
-	if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config)) {
-		/* Setup IPA system pipes */
-		status = wlan_ipa_setup_sys_pipe(ipa_ctx);
-		if (status) {
-			ipa_err("Fail to setup sys pipes (status=%d)", status);
-			return;
-		}
-		qdf_create_work(0, &ipa_ctx->mcc_work,
-				wlan_ipa_mcc_work_handler, ipa_ctx);
-	}
-
-	/* Connect pipe */
-	status = wlan_ipa_wdi_setup(ipa_ctx, qdf_dev);
-	if (status) {
-		ipa_err("Failure to setup IPA pipes (status=%d)",
-			status);
-		goto connect_pipe_fail;
-	}
-	/* Setup the Tx buffer SMMU mapings */
-	status = cdp_ipa_tx_buf_smmu_mapping(ipa_ctx->dp_soc,
-					     ipa_ctx->dp_pdev_id);
-	if (status) {
-		ipa_err("Failure to map Tx buffers for IPA(status=%d)",
-			status);
-		goto smmu_map_fail;
-	}
-	ipa_info("TX buffers mapped to IPA");
-	cdp_ipa_set_doorbell_paddr(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id);
-	wlan_ipa_init_metering(ipa_ctx);
-
-	if (QDF_IS_STATUS_ERROR(wlan_ipa_init_perf_level(ipa_ctx)))
-		ipa_err("Failed to init perf level");
-
-	/*
-	 * Enable IPA/FW PIPEs if
-	 * 1. any clients connected to SAP or
-	 * 2. STA connected to remote AP if STA only offload is enabled
-	 */
-	if (ipa_ctx->sap_num_connected_sta ||
-	    (wlan_ipa_is_sta_only_offload_enabled() &&
-	     ipa_ctx->sta_connected)) {
-		ipa_debug("Client already connected, enable IPA/FW PIPEs");
-		wlan_ipa_uc_handle_first_con(ipa_ctx);
-	}
-
-	ipa_ctx->uc_loaded = true;
-
-	return;
-
-smmu_map_fail:
-	qdf_ipa_wdi_disconn_pipes();
-
-connect_pipe_fail:
-	if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config)) {
-		qdf_cancel_work(&ipa_ctx->mcc_work);
-		wlan_ipa_teardown_sys_pipe(ipa_ctx);
-	}
-}
-
-/**
- * wlan_ipa_uc_op_cb() - IPA uC operation callback
- * @op_msg: operation message received from firmware
- * @usr_ctxt: user context registered with TL (we register the IPA Global
- *	context)
- *
- * Return: None
- */
-static void wlan_ipa_uc_op_cb(struct op_msg_type *op_msg,
-			      struct wlan_ipa_priv *ipa_ctx)
-{
-	struct op_msg_type *msg = op_msg;
-	struct ipa_uc_fw_stats *uc_fw_stat;
-
-	if (!ipa_ctx || !op_msg) {
-		ipa_err("INVALID ARG");
-		return;
-	}
-
-	if (msg->op_code >= WLAN_IPA_UC_OPCODE_MAX) {
-		ipa_err("INVALID OPCODE %d",  msg->op_code);
-		qdf_mem_free(op_msg);
-		return;
-	}
-
-	ipa_debug("OPCODE=%d", msg->op_code);
-
-	if ((msg->op_code == WLAN_IPA_UC_OPCODE_TX_RESUME) ||
-	    (msg->op_code == WLAN_IPA_UC_OPCODE_RX_RESUME)) {
-		qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-		ipa_ctx->activated_fw_pipe++;
-		if (wlan_ipa_is_fw_wdi_activated(ipa_ctx)) {
-			ipa_ctx->resource_loading = false;
-			qdf_event_set(&ipa_ctx->ipa_resource_comp);
-			if (ipa_ctx->wdi_enabled == false) {
-				ipa_ctx->wdi_enabled = true;
-				if (wlan_ipa_uc_send_wdi_control_msg(true) == 0)
-					wlan_ipa_send_mcc_scc_msg(ipa_ctx,
-							ipa_ctx->mcc_mode);
-			}
-			wlan_ipa_uc_proc_pending_event(ipa_ctx, true);
-			if (ipa_ctx->pending_cons_req)
-				wlan_ipa_wdi_rm_notify_completion(
-						QDF_IPA_RM_RESOURCE_GRANTED,
-						QDF_IPA_RM_RESOURCE_WLAN_CONS);
-			ipa_ctx->pending_cons_req = false;
-		}
-		qdf_mutex_release(&ipa_ctx->ipa_lock);
-	} else if ((msg->op_code == WLAN_IPA_UC_OPCODE_TX_SUSPEND) ||
-	    (msg->op_code == WLAN_IPA_UC_OPCODE_RX_SUSPEND)) {
-		qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-
-		if (msg->op_code == WLAN_IPA_UC_OPCODE_RX_SUSPEND) {
-			wlan_ipa_uc_disable_pipes(ipa_ctx, true);
-			ipa_info("Disable FW TX PIPE");
-			cdp_ipa_set_active(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id,
-					   false, true);
-		}
-
-		ipa_ctx->activated_fw_pipe--;
-		if (!ipa_ctx->activated_fw_pipe) {
-			/*
-			 * Async return success from FW
-			 * Disable/suspend all the PIPEs
-			 */
-			ipa_ctx->resource_unloading = false;
-			qdf_event_set(&ipa_ctx->ipa_resource_comp);
-			if (wlan_ipa_is_rm_enabled(ipa_ctx->config))
-				wlan_ipa_wdi_rm_release_resource(ipa_ctx,
-						QDF_IPA_RM_RESOURCE_WLAN_PROD);
-			wlan_ipa_uc_proc_pending_event(ipa_ctx, false);
-			ipa_ctx->pending_cons_req = false;
-		}
-		qdf_mutex_release(&ipa_ctx->ipa_lock);
-	} else if ((msg->op_code == WLAN_IPA_UC_OPCODE_STATS) &&
-		(ipa_ctx->stat_req_reason == WLAN_IPA_UC_STAT_REASON_DEBUG)) {
-		uc_fw_stat = (struct ipa_uc_fw_stats *)
-			((uint8_t *)op_msg + sizeof(struct op_msg_type));
-
-		/* WLAN FW WDI stats */
-		wlan_ipa_print_fw_wdi_stats(ipa_ctx, uc_fw_stat);
-	} else if ((msg->op_code == WLAN_IPA_UC_OPCODE_STATS) &&
-		(ipa_ctx->stat_req_reason == WLAN_IPA_UC_STAT_REASON_BW_CAL)) {
-		/* STATs from FW */
-		uc_fw_stat = (struct ipa_uc_fw_stats *)
-			((uint8_t *)op_msg + sizeof(struct op_msg_type));
-		qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-		ipa_ctx->ipa_tx_packets_diff = BW_GET_DIFF(
-			uc_fw_stat->tx_pkts_completed,
-			ipa_ctx->ipa_p_tx_packets);
-		ipa_ctx->ipa_rx_packets_diff = BW_GET_DIFF(
-			(uc_fw_stat->rx_num_ind_drop_no_space +
-			uc_fw_stat->rx_num_ind_drop_no_buf +
-			uc_fw_stat->rx_num_pkts_indicated),
-			ipa_ctx->ipa_p_rx_packets);
-
-		ipa_ctx->ipa_p_tx_packets = uc_fw_stat->tx_pkts_completed;
-		ipa_ctx->ipa_p_rx_packets =
-			(uc_fw_stat->rx_num_ind_drop_no_space +
-			uc_fw_stat->rx_num_ind_drop_no_buf +
-			uc_fw_stat->rx_num_pkts_indicated);
-		qdf_mutex_release(&ipa_ctx->ipa_lock);
-	} else if (msg->op_code == WLAN_IPA_UC_OPCODE_UC_READY) {
-		qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-		wlan_ipa_uc_loaded_handler(ipa_ctx);
-		qdf_mutex_release(&ipa_ctx->ipa_lock);
-	} else if (wlan_ipa_uc_op_metering(ipa_ctx, op_msg)) {
-		ipa_err("Invalid message: op_code=%d, reason=%d",
-			msg->op_code, ipa_ctx->stat_req_reason);
-	}
-
-	qdf_mem_free(op_msg);
-}
-
-/**
- * __wlan_ipa_uc_fw_op_event_handler - IPA uC FW OPvent handler
- * @data: uC OP work
- *
- * Return: None
- */
-static void __wlan_ipa_uc_fw_op_event_handler(void *data)
-{
-	struct op_msg_type *msg;
-	struct uc_op_work_struct *uc_op_work =
-				(struct uc_op_work_struct *)data;
-	struct wlan_ipa_priv *ipa_ctx = gp_ipa;
-
-	msg = uc_op_work->msg;
-	uc_op_work->msg = NULL;
-	ipa_debug("posted msg %d", msg->op_code);
-
-	wlan_ipa_uc_op_cb(msg, ipa_ctx);
-}
-
-/**
- * wlan_ipa_uc_fw_op_event_handler - SSR wrapper for
- * __wlan_ipa_uc_fw_op_event_handler
- * @data: uC OP work
- *
- * Return: None
- */
-static void wlan_ipa_uc_fw_op_event_handler(void *data)
-{
-	if (qdf_is_recovering()) {
-		ipa_err("in recovering");
-		return;
-	}
-
-	__wlan_ipa_uc_fw_op_event_handler(data);
-}
-
-/**
- * wlan_ipa_uc_op_event_handler() - IPA UC OP event handler
- * @op_msg: operation message received from firmware
- * @ipa_ctx: Global IPA context
- *
- * Return: None
- */
-static void wlan_ipa_uc_op_event_handler(uint8_t *op_msg, void *ctx)
-{
-	struct wlan_ipa_priv *ipa_ctx = (struct wlan_ipa_priv *)ctx;
-	struct op_msg_type *msg;
-	struct uc_op_work_struct *uc_op_work;
-
-	if (!ipa_ctx)
-		goto end;
-
-	msg = (struct op_msg_type *)op_msg;
-
-	if (msg->op_code >= WLAN_IPA_UC_OPCODE_MAX) {
-		ipa_err("Invalid OP Code (%d)", msg->op_code);
-		goto end;
-	}
-
-	uc_op_work = &ipa_ctx->uc_op_work[msg->op_code];
-	if (uc_op_work->msg) {
-		/* When the same uC OPCODE is already pended, just return */
-		goto end;
-	}
-
-	uc_op_work->msg = msg;
-	qdf_sched_work(0, &uc_op_work->work);
-	return;
-
-end:
-	qdf_mem_free(op_msg);
-}
-
-QDF_STATUS wlan_ipa_uc_ol_init(struct wlan_ipa_priv *ipa_ctx,
-			       qdf_device_t osdev)
-{
-	uint8_t i;
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-
-	if (!wlan_ipa_uc_is_enabled(ipa_ctx->config))
-		return QDF_STATUS_SUCCESS;
-
-	ipa_debug("enter");
-
-	if (!osdev) {
-		ipa_err("osdev null");
-		status = QDF_STATUS_E_FAILURE;
-		goto fail_return;
-	}
-
-	for (i = 0; i < WLAN_IPA_MAX_SESSION; i++) {
-		ipa_ctx->vdev_to_iface[i] = WLAN_IPA_MAX_SESSION;
-		ipa_ctx->vdev_offload_enabled[i] = false;
-		ipa_ctx->disable_intrabss_fwd[i] = false;
-	}
-
-	if (cdp_ipa_get_resource(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id)) {
-		ipa_err("IPA UC resource alloc fail");
-		status = QDF_STATUS_E_FAILURE;
-		goto fail_return;
-	}
-
-	for (i = 0; i < WLAN_IPA_UC_OPCODE_MAX; i++) {
-		ipa_ctx->uc_op_work[i].osdev = osdev;
-		ipa_ctx->uc_op_work[i].msg = NULL;
-		qdf_create_work(0, &ipa_ctx->uc_op_work[i].work,
-				wlan_ipa_uc_fw_op_event_handler,
-				&ipa_ctx->uc_op_work[i]);
-	}
-
-	if (true == ipa_ctx->uc_loaded) {
-		status = wlan_ipa_wdi_setup(ipa_ctx, osdev);
-		if (status) {
-			ipa_err("Failure to setup IPA pipes (status=%d)",
-				status);
-			status = QDF_STATUS_E_FAILURE;
-
-			if (wlan_ipa_uc_sta_is_enabled(ipa_ctx->config)) {
-				qdf_cancel_work(&ipa_ctx->mcc_work);
-				wlan_ipa_teardown_sys_pipe(ipa_ctx);
-			}
-			ipa_ctx->uc_loaded = false;
-
-			goto fail_return;
-		}
-
-		/* Setup the Tx buffer SMMU mapings */
-		status = cdp_ipa_tx_buf_smmu_mapping(ipa_ctx->dp_soc,
-						     ipa_ctx->dp_pdev_id);
-		if (status) {
-			ipa_err("Failure to map Tx buffers for IPA(status=%d)",
-				status);
-			return status;
-		}
-		ipa_info("TX buffers mapped to IPA");
-		cdp_ipa_set_doorbell_paddr(ipa_ctx->dp_soc,
-					   ipa_ctx->dp_pdev_id);
-		wlan_ipa_init_metering(ipa_ctx);
-
-		if (wlan_ipa_init_perf_level(ipa_ctx) != QDF_STATUS_SUCCESS)
-			ipa_err("Failed to init perf level");
-	}
-
-	cdp_ipa_register_op_cb(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id,
-			       wlan_ipa_uc_op_event_handler, (void *)ipa_ctx);
-fail_return:
-	ipa_debug("exit: status=%d", status);
-	return status;
-}
-
-/**
- * wlan_ipa_cleanup_pending_event() - Cleanup IPA pending event list
- * @ipa_ctx: pointer to IPA IPA struct
- *
- * Return: none
- */
-static void wlan_ipa_cleanup_pending_event(struct wlan_ipa_priv *ipa_ctx)
-{
-	struct wlan_ipa_uc_pending_event *pending_event = NULL;
-
-	while (qdf_list_remove_front(&ipa_ctx->pending_event,
-		(qdf_list_node_t **)&pending_event) == QDF_STATUS_SUCCESS)
-		qdf_mem_free(pending_event);
-}
-
-QDF_STATUS wlan_ipa_uc_ol_deinit(struct wlan_ipa_priv *ipa_ctx)
-{
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	int i;
-
-	ipa_debug("enter");
-
-	if (!wlan_ipa_uc_is_enabled(ipa_ctx->config))
-		return status;
-
-	wlan_ipa_uc_disable_pipes(ipa_ctx, true);
-
-	cdp_ipa_deregister_op_cb(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id);
-	qdf_atomic_set(&ipa_ctx->deinit_in_prog, 1);
-
-	for (i = 0; i < WLAN_IPA_UC_OPCODE_MAX; i++) {
-		qdf_cancel_work(&ipa_ctx->uc_op_work[i].work);
-		qdf_mem_free(ipa_ctx->uc_op_work[i].msg);
-		ipa_ctx->uc_op_work[i].msg = NULL;
-	}
-
-	if (true == ipa_ctx->uc_loaded) {
-		cdp_ipa_tx_buf_smmu_unmapping(ipa_ctx->dp_soc,
-					      ipa_ctx->dp_pdev_id);
-		status = cdp_ipa_cleanup(ipa_ctx->dp_soc,
-					 ipa_ctx->dp_pdev_id,
-					 ipa_ctx->tx_pipe_handle,
-					 ipa_ctx->rx_pipe_handle);
-		if (status)
-			ipa_err("Failure to cleanup IPA pipes (status=%d)",
-				status);
-	}
-
-	qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-	wlan_ipa_cleanup_pending_event(ipa_ctx);
-	qdf_mutex_release(&ipa_ctx->ipa_lock);
-
-	ipa_debug("exit: ret=%d", status);
-	return status;
-}
-
-/**
- * wlan_ipa_uc_send_evt() - send event to ipa
- * @net_dev: Interface net device
- * @type: event type
- * @mac_addr: pointer to mac address
- *
- * Send event to IPA driver
- *
- * Return: QDF_STATUS
- */
-static QDF_STATUS wlan_ipa_uc_send_evt(qdf_netdev_t net_dev,
-				       qdf_ipa_wlan_event type,
-				       uint8_t *mac_addr)
-{
-	struct wlan_ipa_priv *ipa_ctx = gp_ipa;
-	qdf_ipa_msg_meta_t meta;
-	qdf_ipa_wlan_msg_t *msg;
-
-	QDF_IPA_MSG_META_MSG_LEN(&meta) = sizeof(qdf_ipa_wlan_msg_t);
-	msg = qdf_mem_malloc(QDF_IPA_MSG_META_MSG_LEN(&meta));
-	if (!msg)
-		return QDF_STATUS_E_NOMEM;
-
-	QDF_IPA_SET_META_MSG_TYPE(&meta, type);
-	qdf_str_lcopy(QDF_IPA_WLAN_MSG_NAME(msg), net_dev->name,
-		      IPA_RESOURCE_NAME_MAX);
-	qdf_mem_copy(QDF_IPA_WLAN_MSG_MAC_ADDR(msg), mac_addr, QDF_NET_ETH_LEN);
-
-	if (qdf_ipa_send_msg(&meta, msg, wlan_ipa_msg_free_fn)) {
-		ipa_err("%s: Evt: %d fail",
-			QDF_IPA_WLAN_MSG_NAME(msg),
-			QDF_IPA_MSG_META_MSG_TYPE(&meta));
-		qdf_mem_free(msg);
-
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	ipa_ctx->stats.num_send_msg++;
-
-	return QDF_STATUS_SUCCESS;
-}
-
-void wlan_ipa_uc_cleanup_sta(struct wlan_ipa_priv *ipa_ctx,
-			     qdf_netdev_t net_dev)
-{
-	struct wlan_ipa_iface_context *iface_ctx;
-	int i;
-
-	ipa_debug("enter");
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_ctx = &ipa_ctx->iface_context[i];
-		if (iface_ctx && iface_ctx->device_mode == QDF_STA_MODE &&
-		    iface_ctx->dev && iface_ctx->dev == net_dev) {
-			wlan_ipa_uc_send_evt(net_dev, QDF_IPA_STA_DISCONNECT,
-					     net_dev->dev_addr);
-			wlan_ipa_cleanup_iface(iface_ctx, NULL);
-		}
-	}
-
-	ipa_debug("exit");
-}
-
-QDF_STATUS wlan_ipa_uc_disconnect_ap(struct wlan_ipa_priv *ipa_ctx,
-				     qdf_netdev_t net_dev)
-{
-	struct wlan_ipa_iface_context *iface_ctx;
-	QDF_STATUS status;
-
-	ipa_debug("enter");
-
-	iface_ctx = wlan_ipa_get_iface(ipa_ctx, QDF_SAP_MODE);
-	if (iface_ctx)
-		status = wlan_ipa_uc_send_evt(net_dev, QDF_IPA_AP_DISCONNECT,
-					      net_dev->dev_addr);
-	else
-		return QDF_STATUS_E_INVAL;
-
-	ipa_debug("exit :%d", status);
-
-	return status;
-}
-
-void wlan_ipa_cleanup_dev_iface(struct wlan_ipa_priv *ipa_ctx,
-				qdf_netdev_t net_dev)
-{
-	struct wlan_ipa_iface_context *iface_ctx;
-	int i;
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_ctx = &ipa_ctx->iface_context[i];
-		if (iface_ctx->dev == net_dev) {
-			wlan_ipa_cleanup_iface(iface_ctx, NULL);
-			break;
-		}
-	}
-}
-
-void wlan_ipa_uc_ssr_cleanup(struct wlan_ipa_priv *ipa_ctx)
-{
-	struct wlan_ipa_iface_context *iface;
-	int i;
-
-	ipa_info("enter");
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface = &ipa_ctx->iface_context[i];
-		if (iface->dev) {
-			if (iface->device_mode == QDF_SAP_MODE)
-				wlan_ipa_uc_send_evt(iface->dev,
-						     QDF_IPA_AP_DISCONNECT,
-						     iface->dev->dev_addr);
-			else if (iface->device_mode == QDF_STA_MODE)
-				wlan_ipa_uc_send_evt(iface->dev,
-						     QDF_IPA_STA_DISCONNECT,
-						     iface->dev->dev_addr);
-			wlan_ipa_cleanup_iface(iface, NULL);
-		}
-	}
-}
-
-void wlan_ipa_fw_rejuvenate_send_msg(struct wlan_ipa_priv *ipa_ctx)
-{
-	qdf_ipa_msg_meta_t meta;
-	qdf_ipa_wlan_msg_t *msg;
-	int ret;
-
-	meta.msg_len = sizeof(*msg);
-	msg = qdf_mem_malloc(meta.msg_len);
-	if (!msg)
-		return;
-
-	QDF_IPA_SET_META_MSG_TYPE(&meta, QDF_FWR_SSR_BEFORE_SHUTDOWN);
-	ipa_debug("ipa_send_msg(Evt:%d)",
-		  meta.msg_type);
-	ret = qdf_ipa_send_msg(&meta, msg, wlan_ipa_msg_free_fn);
-
-	if (ret) {
-		ipa_err("ipa_send_msg(Evt:%d)-fail=%d",
-			meta.msg_type, ret);
-		qdf_mem_free(msg);
-	}
-	ipa_ctx->stats.num_send_msg++;
-}
-
-void wlan_ipa_flush_pending_vdev_events(struct wlan_ipa_priv *ipa_ctx,
-					uint8_t vdev_id)
-{
-	struct wlan_ipa_uc_pending_event *event;
-	struct wlan_ipa_uc_pending_event *next_event;
-
-	qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-
-	qdf_list_for_each_del(&ipa_ctx->pending_event, event, next_event,
-			      node) {
-		if (event->session_id == vdev_id) {
-			qdf_list_remove_node(&ipa_ctx->pending_event,
-					     &event->node);
-			qdf_mem_free(event);
-		}
-	}
-
-	qdf_mutex_release(&ipa_ctx->ipa_lock);
-}

+ 0 - 842
components/ipa/core/src/wlan_ipa_main.c

@@ -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);
-}
-

+ 0 - 508
components/ipa/core/src/wlan_ipa_rm.c

@@ -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 */

+ 0 - 1043
components/ipa/core/src/wlan_ipa_stats.c

@@ -1,1043 +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 "wlan_ipa_main.h"
-#include "wlan_ipa_core.h"
-#include "cdp_txrx_ipa.h"
-#include "qdf_platform.h"
-
-/**
- * wlan_ipa_uc_rt_debug_host_fill - fill rt debug buffer
- * @ctext: pointer to ipa context.
- *
- * If rt debug enabled, periodically called, and fill debug buffer
- *
- * Return: none
- */
-static void wlan_ipa_uc_rt_debug_host_fill(void *ctext)
-{
-	struct wlan_ipa_priv *ipa_ctx = ctext;
-	struct uc_rt_debug_info *dump_info = NULL;
-
-	if (!ipa_ctx)
-		return;
-
-	qdf_mutex_acquire(&ipa_ctx->rt_debug_lock);
-	dump_info = &ipa_ctx->rt_bug_buffer[
-		ipa_ctx->rt_buf_fill_index % WLAN_IPA_UC_RT_DEBUG_BUF_COUNT];
-
-	dump_info->time = (uint64_t)qdf_mc_timer_get_system_time();
-	dump_info->ipa_excep_count = ipa_ctx->stats.num_rx_excep;
-	dump_info->rx_drop_count = ipa_ctx->ipa_rx_internal_drop_count;
-	dump_info->net_sent_count = ipa_ctx->ipa_rx_net_send_count;
-	dump_info->tx_fwd_count = ipa_ctx->ipa_tx_forward;
-	dump_info->tx_fwd_ok_count = ipa_ctx->stats.num_tx_fwd_ok;
-	dump_info->rx_discard_count = ipa_ctx->ipa_rx_discard;
-	dump_info->rx_destructor_call = ipa_ctx->ipa_rx_destructor_count;
-	ipa_ctx->rt_buf_fill_index++;
-	qdf_mutex_release(&ipa_ctx->rt_debug_lock);
-
-	qdf_mc_timer_start(&ipa_ctx->rt_debug_fill_timer,
-		WLAN_IPA_UC_RT_DEBUG_FILL_INTERVAL);
-}
-
-void wlan_ipa_uc_rt_debug_host_dump(struct wlan_ipa_priv *ipa_ctx)
-{
-	unsigned int dump_count;
-	unsigned int dump_index;
-	struct uc_rt_debug_info *dump_info = NULL;
-
-	if (!wlan_ipa_is_rt_debugging_enabled(ipa_ctx->config)) {
-		ipa_debug("IPA RT debug is not enabled");
-		return;
-	}
-
-	ipa_info("========= WLAN-IPA DEBUG BUF DUMP ==========\n");
-	ipa_info("     TM     :   EXEP   :   DROP   :   NETS   :   FWOK"
-		 ":   TXFD   :   DSTR   :   DSCD\n");
-
-	qdf_mutex_acquire(&ipa_ctx->rt_debug_lock);
-	for (dump_count = 0;
-		dump_count < WLAN_IPA_UC_RT_DEBUG_BUF_COUNT;
-		dump_count++) {
-		dump_index = (ipa_ctx->rt_buf_fill_index + dump_count) %
-			WLAN_IPA_UC_RT_DEBUG_BUF_COUNT;
-		dump_info = &ipa_ctx->rt_bug_buffer[dump_index];
-		ipa_info("%12llu:%10llu:%10llu:%10llu:%10llu:%10llu:%10llu:%10llu\n",
-			dump_info->time, dump_info->ipa_excep_count,
-			dump_info->rx_drop_count, dump_info->net_sent_count,
-			dump_info->tx_fwd_ok_count, dump_info->tx_fwd_count,
-			dump_info->rx_destructor_call,
-			dump_info->rx_discard_count);
-	}
-	qdf_mutex_release(&ipa_ctx->rt_debug_lock);
-}
-
-/**
- * wlan_ipa_uc_rt_debug_handler - periodic memory health monitor handler
- * @ctext: pointer to ipa context.
- *
- * periodically called by timer expire
- * will try to alloc dummy memory and detect out of memory condition
- * if out of memory detected, dump wlan-ipa stats
- *
- * Return: none
- */
-static void wlan_ipa_uc_rt_debug_handler(void *ctext)
-{
-	struct wlan_ipa_priv *ipa_ctx = ctext;
-	void *dummy_ptr = NULL;
-
-	if (!wlan_ipa_is_rt_debugging_enabled(ipa_ctx->config)) {
-		ipa_debug("IPA RT debug is not enabled");
-		return;
-	}
-
-	/* Allocate dummy buffer periodically and free immediately. this will
-	 * proactively detect OOM and if allocation fails dump ipa stats
-	 */
-	dummy_ptr = qdf_mem_malloc(WLAN_IPA_UC_DEBUG_DUMMY_MEM_SIZE);
-	if (!dummy_ptr) {
-		wlan_ipa_uc_rt_debug_host_dump(ipa_ctx);
-		wlan_ipa_uc_stat_request(ipa_ctx,
-					 WLAN_IPA_UC_STAT_REASON_DEBUG);
-	} else {
-		qdf_mem_free(dummy_ptr);
-	}
-
-	qdf_mc_timer_start(&ipa_ctx->rt_debug_timer,
-		WLAN_IPA_UC_RT_DEBUG_PERIOD);
-}
-
-void wlan_ipa_uc_rt_debug_destructor(qdf_nbuf_t nbuff)
-{
-	struct wlan_ipa_priv *ipa_ctx = wlan_ipa_get_obj_context();
-
-	if (!ipa_ctx) {
-		ipa_err("invalid ipa context");
-		return;
-	}
-
-	ipa_ctx->ipa_rx_destructor_count++;
-}
-
-void wlan_ipa_uc_rt_debug_deinit(struct wlan_ipa_priv *ipa_ctx)
-{
-	qdf_mutex_destroy(&ipa_ctx->rt_debug_lock);
-
-	if (!wlan_ipa_is_rt_debugging_enabled(ipa_ctx->config)) {
-		ipa_debug("IPA RT debug is not enabled");
-		return;
-	}
-
-	if (QDF_TIMER_STATE_STOPPED !=
-		qdf_mc_timer_get_current_state(&ipa_ctx->rt_debug_fill_timer)) {
-		qdf_mc_timer_stop(&ipa_ctx->rt_debug_fill_timer);
-	}
-	qdf_mc_timer_destroy(&ipa_ctx->rt_debug_fill_timer);
-
-	if (QDF_TIMER_STATE_STOPPED !=
-		qdf_mc_timer_get_current_state(&ipa_ctx->rt_debug_timer)) {
-		qdf_mc_timer_stop(&ipa_ctx->rt_debug_timer);
-	}
-	qdf_mc_timer_destroy(&ipa_ctx->rt_debug_timer);
-}
-
-void wlan_ipa_uc_rt_debug_init(struct wlan_ipa_priv *ipa_ctx)
-{
-	qdf_mutex_create(&ipa_ctx->rt_debug_lock);
-	ipa_ctx->rt_buf_fill_index = 0;
-	qdf_mem_zero(ipa_ctx->rt_bug_buffer,
-		sizeof(struct uc_rt_debug_info) *
-		WLAN_IPA_UC_RT_DEBUG_BUF_COUNT);
-	ipa_ctx->ipa_tx_forward = 0;
-	ipa_ctx->ipa_rx_discard = 0;
-	ipa_ctx->ipa_rx_net_send_count = 0;
-	ipa_ctx->ipa_rx_internal_drop_count = 0;
-	ipa_ctx->ipa_rx_destructor_count = 0;
-
-	/* Reatime debug enable on feature enable */
-	if (!wlan_ipa_is_rt_debugging_enabled(ipa_ctx->config)) {
-		ipa_debug("IPA RT debug is not enabled");
-		return;
-	}
-
-	qdf_mc_timer_init(&ipa_ctx->rt_debug_fill_timer, QDF_TIMER_TYPE_SW,
-		wlan_ipa_uc_rt_debug_host_fill, (void *)ipa_ctx);
-	qdf_mc_timer_start(&ipa_ctx->rt_debug_fill_timer,
-		WLAN_IPA_UC_RT_DEBUG_FILL_INTERVAL);
-
-	qdf_mc_timer_init(&ipa_ctx->rt_debug_timer, QDF_TIMER_TYPE_SW,
-		wlan_ipa_uc_rt_debug_handler, (void *)ipa_ctx);
-	qdf_mc_timer_start(&ipa_ctx->rt_debug_timer,
-		WLAN_IPA_UC_RT_DEBUG_PERIOD);
-
-}
-
-/**
- * wlan_ipa_dump_ipa_ctx() - dump entries in IPA IPA struct
- * @ipa_ctx: IPA context
- *
- * Dump entries in struct ipa_ctx
- *
- * Return: none
- */
-static void wlan_ipa_dump_ipa_ctx(struct wlan_ipa_priv *ipa_ctx)
-{
-	int i;
-
-	/* IPA IPA */
-	ipa_info("\n==== IPA IPA ====\n"
-		"num_iface: %d\n"
-		"rm_state: %d\n"
-		"rm_lock: %pK\n"
-		"uc_rm_work: %pK\n"
-		"uc_op_work: %pK\n"
-		"wake_lock: %pK\n"
-		"wake_lock_work: %pK\n"
-		"wake_lock_released: %d\n"
-		"tx_ref_cnt: %d\n"
-		"pm_queue_head----\n"
-		"\thead: %pK\n"
-		"\ttail: %pK\n"
-		"\tqlen: %d\n"
-		"pm_work: %pK\n"
-		"pm_lock: %pK\n"
-		"suspended: %d\n",
-		ipa_ctx->num_iface,
-		ipa_ctx->rm_state,
-		&ipa_ctx->rm_lock,
-		&ipa_ctx->uc_rm_work,
-		&ipa_ctx->uc_op_work,
-		&ipa_ctx->wake_lock,
-		&ipa_ctx->wake_lock_work,
-		ipa_ctx->wake_lock_released,
-		ipa_ctx->tx_ref_cnt.counter,
-		ipa_ctx->pm_queue_head.head,
-		ipa_ctx->pm_queue_head.tail,
-		ipa_ctx->pm_queue_head.qlen,
-		&ipa_ctx->pm_work,
-		&ipa_ctx->pm_lock,
-		ipa_ctx->suspended);
-
-	ipa_info("\nq_lock: %pK\n"
-		"pend_desc_head----\n"
-		"\tnext: %pK\n"
-		"\tprev: %pK\n"
-		"stats: %pK\n"
-		"curr_prod_bw: %d\n"
-		"curr_cons_bw: %d\n"
-		"activated_fw_pipe: %d\n"
-		"sap_num_connected_sta: %d\n"
-		"sta_connected: %d\n",
-		&ipa_ctx->q_lock,
-		ipa_ctx->pend_desc_head.next,
-		ipa_ctx->pend_desc_head.prev,
-		&ipa_ctx->stats,
-		ipa_ctx->curr_prod_bw,
-		ipa_ctx->curr_cons_bw,
-		ipa_ctx->activated_fw_pipe,
-		ipa_ctx->sap_num_connected_sta,
-		(unsigned int)ipa_ctx->sta_connected);
-
-	ipa_info("\ntx_pipe_handle: 0x%x\n"
-		"rx_pipe_handle: 0x%x\n"
-		"resource_loading: %d\n"
-		"resource_unloading: %d\n"
-		"pending_cons_req: %d\n"
-		"pending_event----\n"
-		"\tanchor.next: %pK\n"
-		"\tanchor.prev: %pK\n"
-		"\tcount: %d\n"
-		"\tmax_size: %d\n"
-		"event_lock: %pK\n"
-		"ipa_tx_packets_diff: %d\n"
-		"ipa_rx_packets_diff: %d\n"
-		"ipa_p_tx_packets: %d\n"
-		"ipa_p_rx_packets: %d\n"
-		"stat_req_reason: %d\n",
-		ipa_ctx->tx_pipe_handle,
-		ipa_ctx->rx_pipe_handle,
-		ipa_ctx->resource_loading,
-		ipa_ctx->resource_unloading,
-		ipa_ctx->pending_cons_req,
-		ipa_ctx->pending_event.anchor.next,
-		ipa_ctx->pending_event.anchor.prev,
-		ipa_ctx->pending_event.count,
-		ipa_ctx->pending_event.max_size,
-		&ipa_ctx->event_lock,
-		ipa_ctx->ipa_tx_packets_diff,
-		ipa_ctx->ipa_rx_packets_diff,
-		ipa_ctx->ipa_p_tx_packets,
-		ipa_ctx->ipa_p_rx_packets,
-		ipa_ctx->stat_req_reason);
-
-	ipa_info("\ncons_pipe_in----\n"
-		"\tsys: %pK\n"
-		"\tdl.comp_ring_base_pa: 0x%x\n"
-		"\tdl.comp_ring_size: %d\n"
-		"\tdl.ce_ring_base_pa: 0x%x\n"
-		"\tdl.ce_door_bell_pa: 0x%x\n"
-		"\tdl.ce_ring_size: %d\n"
-		"\tdl.num_tx_buffers: %d\n"
-		"prod_pipe_in----\n"
-		"\tsys: %pK\n"
-		"\tul.rdy_ring_base_pa: 0x%x\n"
-		"\tul.rdy_ring_size: %d\n"
-		"\tul.rdy_ring_rp_pa: 0x%x\n"
-		"uc_loaded: %d\n"
-		"wdi_enabled: %d\n"
-		"rt_debug_fill_timer: %pK\n"
-		"rt_debug_lock: %pK\n"
-		"ipa_lock: %pK\n",
-		&ipa_ctx->cons_pipe_in.sys,
-		(unsigned int)ipa_ctx->cons_pipe_in.u.dl.comp_ring_base_pa,
-		ipa_ctx->cons_pipe_in.u.dl.comp_ring_size,
-		(unsigned int)ipa_ctx->cons_pipe_in.u.dl.ce_ring_base_pa,
-		(unsigned int)ipa_ctx->cons_pipe_in.u.dl.ce_door_bell_pa,
-		ipa_ctx->cons_pipe_in.u.dl.ce_ring_size,
-		ipa_ctx->cons_pipe_in.u.dl.num_tx_buffers,
-		&ipa_ctx->prod_pipe_in.sys,
-		(unsigned int)ipa_ctx->prod_pipe_in.u.ul.rdy_ring_base_pa,
-		ipa_ctx->prod_pipe_in.u.ul.rdy_ring_size,
-		(unsigned int)ipa_ctx->prod_pipe_in.u.ul.rdy_ring_rp_pa,
-		ipa_ctx->uc_loaded,
-		ipa_ctx->wdi_enabled,
-		&ipa_ctx->rt_debug_fill_timer,
-		&ipa_ctx->rt_debug_lock,
-		&ipa_ctx->ipa_lock);
-
-	ipa_info("\nvdev_to_iface----");
-	for (i = 0; i < WLAN_IPA_MAX_SESSION; i++)
-		ipa_info("\n\t[%d]=%d", i, ipa_ctx->vdev_to_iface[i]);
-
-	QDF_TRACE(QDF_MODULE_ID_IPA, QDF_TRACE_LEVEL_INFO,
-		"\nvdev_offload_enabled----");
-	for (i = 0; i < WLAN_IPA_MAX_SESSION; i++)
-		ipa_info("\n\t[%d]=%d", i, ipa_ctx->vdev_offload_enabled[i]);
-
-	QDF_TRACE(QDF_MODULE_ID_IPA, QDF_TRACE_LEVEL_INFO,
-		"\nassoc_stas_map ----");
-	for (i = 0; i < WLAN_IPA_MAX_STA_COUNT; i++) {
-		ipa_info("\n\t[%d]: is_reserved=%d mac: " QDF_MAC_ADDR_FMT, i,
-			 ipa_ctx->assoc_stas_map[i].is_reserved,
-			 QDF_MAC_ADDR_REF(
-				ipa_ctx->assoc_stas_map[i].mac_addr.bytes));
-	}
-}
-
-/**
- * wlan_ipa_dump_sys_pipe() - dump IPA IPA SYS Pipe struct
- * @ipa_ctx: IPA IPA struct
- *
- * Dump entire struct wlan_ipa_sys_pipe
- *
- * Return: none
- */
-static void wlan_ipa_dump_sys_pipe(struct wlan_ipa_priv *ipa_ctx)
-{
-	int i;
-
-	/* IPA SYS Pipes */
-	ipa_info("==== IPA SYS Pipes ====");
-
-	for (i = 0; i < WLAN_IPA_MAX_SYSBAM_PIPE; i++) {
-		struct wlan_ipa_sys_pipe *sys_pipe;
-		qdf_ipa_sys_connect_params_t *ipa_sys_params;
-
-		sys_pipe = &ipa_ctx->sys_pipe[i];
-		ipa_sys_params = &sys_pipe->ipa_sys_params;
-
-		ipa_info("\nsys_pipe[%d]----\n"
-			"\tconn_hdl: 0x%x\n"
-			"\tconn_hdl_valid: %d\n"
-			"\tnat_en: %d\n"
-			"\thdr_len %d\n"
-			"\thdr_additional_const_len: %d\n"
-			"\thdr_ofst_pkt_size_valid: %d\n"
-			"\thdr_ofst_pkt_size: %d\n"
-			"\thdr_little_endian: %d\n"
-			"\tmode: %d\n"
-			"\tclient: %d\n"
-			"\tdesc_fifo_sz: %d\n"
-			"\tpriv: %pK\n"
-			"\tnotify: %pK\n"
-			"\tskip_ep_cfg: %d\n"
-			"\tkeep_ipa_awake: %d\n",
-			i,
-			sys_pipe->conn_hdl,
-			sys_pipe->conn_hdl_valid,
-			QDF_IPA_SYS_PARAMS_NAT_EN(ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_HDR_LEN(ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_HDR_ADDITIONAL_CONST_LEN(
-				ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_HDR_OFST_PKT_SIZE_VALID(
-				ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_HDR_OFST_PKT_SIZE(ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_HDR_LITTLE_ENDIAN(ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_MODE(ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_CLIENT(ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_DESC_FIFO_SZ(ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_PRIV(ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_NOTIFY(ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_SKIP_EP_CFG(ipa_sys_params),
-			QDF_IPA_SYS_PARAMS_KEEP_IPA_AWAKE(ipa_sys_params));
-	}
-}
-
-/**
- * wlan_ipa_dump_iface_context() - dump IPA IPA Interface Context struct
- * @ipa_ctx: IPA IPA struct
- *
- * Dump entire struct wlan_ipa_iface_context
- *
- * Return: none
- */
-static void wlan_ipa_dump_iface_context(struct wlan_ipa_priv *ipa_ctx)
-{
-	int i;
-
-	/* IPA Interface Contexts */
-	ipa_info("\n==== IPA Interface Contexts ====\n");
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		struct wlan_ipa_iface_context *iface_context;
-
-		iface_context = &ipa_ctx->iface_context[i];
-
-		ipa_info("\niface_context[%d]----\n"
-			"\tipa_ctx: %pK\n"
-			"\tsession_id: %d\n"
-			"\tcons_client: %d\n"
-			"\tprod_client: %d\n"
-			"\tiface_id: %d\n"
-			"\tinterface_lock: %pK\n"
-			"\tifa_address: 0x%x\n",
-			i,
-			iface_context->ipa_ctx,
-			iface_context->session_id,
-			iface_context->cons_client,
-			iface_context->prod_client,
-			iface_context->iface_id,
-			&iface_context->interface_lock,
-			iface_context->ifa_address);
-	}
-}
-
-void wlan_ipa_dump_info(struct wlan_ipa_priv *ipa_ctx)
-{
-	wlan_ipa_dump_ipa_ctx(ipa_ctx);
-	wlan_ipa_dump_sys_pipe(ipa_ctx);
-	wlan_ipa_dump_iface_context(ipa_ctx);
-}
-
-void wlan_ipa_uc_stat_query(struct wlan_ipa_priv *ipa_ctx,
-			    uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff)
-{
-	*ipa_tx_diff = 0;
-	*ipa_rx_diff = 0;
-
-	qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-	if (wlan_ipa_is_fw_wdi_activated(ipa_ctx) &&
-	    (false == ipa_ctx->resource_loading)) {
-		*ipa_tx_diff = ipa_ctx->ipa_tx_packets_diff;
-		*ipa_rx_diff = ipa_ctx->ipa_rx_packets_diff;
-	}
-	qdf_mutex_release(&ipa_ctx->ipa_lock);
-}
-
-void wlan_ipa_uc_stat_request(struct wlan_ipa_priv *ipa_ctx, uint8_t reason)
-{
-	qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-	if (wlan_ipa_is_fw_wdi_activated(ipa_ctx) &&
-	    (false == ipa_ctx->resource_loading)) {
-		ipa_ctx->stat_req_reason = reason;
-		cdp_ipa_get_stat(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id);
-		qdf_mutex_release(&ipa_ctx->ipa_lock);
-	} else {
-		qdf_mutex_release(&ipa_ctx->ipa_lock);
-	}
-}
-
-/**
- * wlan_ipa_print_session_info - Print IPA session info
- * @ipa_ctx: IPA context
- *
- * Return: None
- */
-static void wlan_ipa_print_session_info(struct wlan_ipa_priv *ipa_ctx)
-{
-	struct wlan_ipa_uc_pending_event *event = NULL, *next = NULL;
-	struct wlan_ipa_iface_context *iface_context = NULL;
-	int i;
-
-	ipa_info("\n==== IPA SESSION INFO ====\n"
-		"NUM IFACE: %d\n"
-		"RM STATE: %d\n"
-		"ACTIVATED FW PIPE: %d\n"
-		"SAP NUM STAs: %d\n"
-		"STA CONNECTED: %d\n"
-		"CONCURRENT MODE: %s\n"
-		"RSC LOADING: %d\n"
-		"RSC UNLOADING: %d\n"
-		"PENDING CONS REQ: %d\n"
-		"IPA PIPES DOWN: %d\n"
-		"IPA UC LOADED: %d\n"
-		"IPA WDI ENABLED: %d\n"
-		"NUM SEND MSG: %d\n"
-		"NUM FREE MSG: %d\n",
-		ipa_ctx->num_iface,
-		ipa_ctx->rm_state,
-		ipa_ctx->activated_fw_pipe,
-		ipa_ctx->sap_num_connected_sta,
-		ipa_ctx->sta_connected,
-		(ipa_ctx->mcc_mode ? "MCC" : "SCC"),
-		ipa_ctx->resource_loading,
-		ipa_ctx->resource_unloading,
-		ipa_ctx->pending_cons_req,
-		ipa_ctx->ipa_pipes_down,
-		ipa_ctx->uc_loaded,
-		ipa_ctx->wdi_enabled,
-		(unsigned int)ipa_ctx->stats.num_send_msg,
-		(unsigned int)ipa_ctx->stats.num_free_msg);
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-		iface_context = &ipa_ctx->iface_context[i];
-
-		if (iface_context->session_id == WLAN_IPA_MAX_SESSION)
-			continue;
-
-		ipa_info("\nIFACE[%d]: mode:%d, offload:%d",
-			 i, iface_context->device_mode,
-			 ipa_ctx->vdev_offload_enabled[iface_context->
-						       session_id]);
-	}
-
-	for (i = 0; i < QDF_IPA_WLAN_EVENT_MAX; i++)
-		ipa_info("\nEVENT[%d]=%d",
-			 i, ipa_ctx->stats.event[i]);
-
-	i = 0;
-	qdf_list_peek_front(&ipa_ctx->pending_event,
-			(qdf_list_node_t **)&event);
-	while (event) {
-		ipa_info("PENDING EVENT[%d]: EVT:%s, MAC:"QDF_MAC_ADDR_FMT,
-			 i, wlan_ipa_wlan_event_to_str(event->type),
-			 QDF_MAC_ADDR_REF(event->mac_addr));
-
-		qdf_list_peek_next(&ipa_ctx->pending_event,
-				   (qdf_list_node_t *)event,
-				   (qdf_list_node_t **)&next);
-		event = next;
-		next = NULL;
-		i++;
-	}
-}
-
-/**
- * wlan_ipa_print_txrx_stats - Print IPA IPA TX/RX stats
- * @ipa_ctx: IPA context
- *
- * Return: None
- */
-static void wlan_ipa_print_txrx_stats(struct wlan_ipa_priv *ipa_ctx)
-{
-	int i;
-	struct wlan_ipa_iface_context *iface_context = NULL;
-
-	ipa_info("\n==== IPA IPA TX/RX STATS ====\n"
-		"NUM RM GRANT: %llu\n"
-		"NUM RM RELEASE: %llu\n"
-		"NUM RM GRANT IMM: %llu\n"
-		"NUM CONS PERF REQ: %llu\n"
-		"NUM PROD PERF REQ: %llu\n"
-		"NUM RX DROP: %llu\n"
-		"NUM EXCP PKT: %llu\n"
-		"NUM TX FWD OK: %llu\n"
-		"NUM TX FWD ERR: %llu\n"
-		"NUM TX DESC Q CNT: %llu\n"
-		"NUM TX DESC ERROR: %llu\n"
-		"NUM TX COMP CNT: %llu\n"
-		"NUM TX QUEUED: %llu\n"
-		"NUM TX DEQUEUED: %llu\n"
-		"NUM MAX PM QUEUE: %llu\n"
-		"TX REF CNT: %d\n"
-		"SUSPENDED: %d\n"
-		"PEND DESC HEAD: %pK\n"
-		"TX DESC LIST: %pK\n",
-		ipa_ctx->stats.num_rm_grant,
-		ipa_ctx->stats.num_rm_release,
-		ipa_ctx->stats.num_rm_grant_imm,
-		ipa_ctx->stats.num_cons_perf_req,
-		ipa_ctx->stats.num_prod_perf_req,
-		ipa_ctx->stats.num_rx_drop,
-		ipa_ctx->stats.num_rx_excep,
-		ipa_ctx->stats.num_tx_fwd_ok,
-		ipa_ctx->stats.num_tx_fwd_err,
-		ipa_ctx->stats.num_tx_desc_q_cnt,
-		ipa_ctx->stats.num_tx_desc_error,
-		ipa_ctx->stats.num_tx_comp_cnt,
-		ipa_ctx->stats.num_tx_queued,
-		ipa_ctx->stats.num_tx_dequeued,
-		ipa_ctx->stats.num_max_pm_queue,
-		ipa_ctx->tx_ref_cnt.counter,
-		ipa_ctx->suspended,
-		&ipa_ctx->pend_desc_head,
-		&ipa_ctx->tx_desc_free_list);
-
-	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
-
-		iface_context = &ipa_ctx->iface_context[i];
-		if (iface_context->session_id == WLAN_IPA_MAX_SESSION)
-			continue;
-
-		ipa_info("IFACE[%d]: TX:%llu, TX DROP:%llu, TX ERR:%llu,"
-			 " TX CAC DROP:%llu, RX IPA EXCEP:%llu",
-			 i, iface_context->stats.num_tx,
-			 iface_context->stats.num_tx_drop,
-			 iface_context->stats.num_tx_err,
-			 iface_context->stats.num_tx_cac_drop,
-			 iface_context->stats.num_rx_ipa_excep);
-	}
-}
-
-void wlan_ipa_print_fw_wdi_stats(struct wlan_ipa_priv *ipa_ctx,
-				 struct ipa_uc_fw_stats *uc_fw_stat)
-{
-	ipa_info("\n==== WLAN FW WDI TX STATS ====\n"
-		"COMP RING SIZE: %d\n"
-		"COMP RING DBELL IND VAL : %d\n"
-		"COMP RING DBELL CACHED VAL : %d\n"
-		"PKTS ENQ : %d\n"
-		"PKTS COMP : %d\n"
-		"IS SUSPEND : %d\n",
-		uc_fw_stat->tx_comp_ring_size,
-		uc_fw_stat->tx_comp_ring_dbell_ind_val,
-		uc_fw_stat->tx_comp_ring_dbell_cached_val,
-		uc_fw_stat->tx_pkts_enqueued,
-		uc_fw_stat->tx_pkts_completed,
-		uc_fw_stat->tx_is_suspend);
-
-	ipa_info("\n==== WLAN FW WDI RX STATS ====\n"
-		"IND RING SIZE: %d\n"
-		"IND RING DBELL IND VAL : %d\n"
-		"IND RING DBELL CACHED VAL : %d\n"
-		"RDY IND CACHE VAL : %d\n"
-		"RFIL IND : %d\n"
-		"NUM PKT INDICAT : %d\n"
-		"BUF REFIL : %d\n"
-		"NUM DROP NO SPC : %d\n"
-		"NUM DROP NO BUF : %d\n"
-		"IS SUSPND : %d\n",
-		uc_fw_stat->rx_ind_ring_size,
-		uc_fw_stat->rx_ind_ring_dbell_ind_val,
-		uc_fw_stat->rx_ind_ring_dbell_ind_cached_val,
-		uc_fw_stat->rx_ind_ring_rd_idx_cached_val,
-		uc_fw_stat->rx_refill_idx,
-		uc_fw_stat->rx_num_pkts_indicated,
-		uc_fw_stat->rx_buf_refilled,
-		uc_fw_stat->rx_num_ind_drop_no_space,
-		uc_fw_stat->rx_num_ind_drop_no_buf,
-		uc_fw_stat->rx_is_suspend);
-}
-
-/**
- * wlan_ipa_print_ipa_wdi_stats - Print IPA WDI stats
- * @ipa_ctx: IPA context
- *
- * Return: None
- */
-static void wlan_ipa_print_ipa_wdi_stats(struct wlan_ipa_priv *ipa_ctx)
-{
-	qdf_ipa_hw_stats_wdi_info_data_t ipa_stat;
-
-	qdf_ipa_get_wdi_stats(&ipa_stat);
-
-	ipa_info("\n==== IPA WDI TX STATS ====\n"
-		"NUM PROCD : %d\n"
-		"CE DBELL : 0x%x\n"
-		"NUM DBELL FIRED : %d\n"
-		"COMP RNG FULL : %d\n"
-		"COMP RNG EMPT : %d\n"
-		"COMP RNG USE HGH : %d\n"
-		"COMP RNG USE LOW : %d\n"
-		"BAM FIFO FULL : %d\n"
-		"BAM FIFO EMPT : %d\n"
-		"BAM FIFO USE HGH : %d\n"
-		"BAM FIFO USE LOW : %d\n"
-		"NUM DBELL : %d\n"
-		"NUM UNEXP DBELL : %d\n"
-		"NUM BAM INT HDL : 0x%x\n"
-		"NUM QMB INT HDL : 0x%x\n",
-		ipa_stat.tx_ch_stats.num_pkts_processed,
-		ipa_stat.tx_ch_stats.copy_engine_doorbell_value,
-		ipa_stat.tx_ch_stats.num_db_fired,
-		ipa_stat.tx_ch_stats.tx_comp_ring_stats.ringFull,
-		ipa_stat.tx_ch_stats.tx_comp_ring_stats.ringEmpty,
-		ipa_stat.tx_ch_stats.tx_comp_ring_stats.ringUsageHigh,
-		ipa_stat.tx_ch_stats.tx_comp_ring_stats.ringUsageLow,
-		ipa_stat.tx_ch_stats.bam_stats.bamFifoFull,
-		ipa_stat.tx_ch_stats.bam_stats.bamFifoEmpty,
-		ipa_stat.tx_ch_stats.bam_stats.bamFifoUsageHigh,
-		ipa_stat.tx_ch_stats.bam_stats.bamFifoUsageLow,
-		ipa_stat.tx_ch_stats.num_db,
-		ipa_stat.tx_ch_stats.num_unexpected_db,
-		ipa_stat.tx_ch_stats.num_bam_int_handled,
-		ipa_stat.tx_ch_stats.num_qmb_int_handled);
-
-	ipa_info("\n==== IPA WDI RX STATS ====\n"
-		"MAX OST PKT : %d\n"
-		"NUM PKT PRCSD : %d\n"
-		"RNG RP : 0x%x\n"
-		"IND RNG FULL : %d\n"
-		"IND RNG EMPT : %d\n"
-		"IND RNG USE HGH : %d\n"
-		"IND RNG USE LOW : %d\n"
-		"BAM FIFO FULL : %d\n"
-		"BAM FIFO EMPT : %d\n"
-		"BAM FIFO USE HGH : %d\n"
-		"BAM FIFO USE LOW : %d\n"
-		"NUM DB : %d\n"
-		"NUM UNEXP DB : %d\n"
-		"NUM BAM INT HNDL : 0x%x\n",
-		ipa_stat.rx_ch_stats.max_outstanding_pkts,
-		ipa_stat.rx_ch_stats.num_pkts_processed,
-		ipa_stat.rx_ch_stats.rx_ring_rp_value,
-		ipa_stat.rx_ch_stats.rx_ind_ring_stats.ringFull,
-		ipa_stat.rx_ch_stats.rx_ind_ring_stats.ringEmpty,
-		ipa_stat.rx_ch_stats.rx_ind_ring_stats.ringUsageHigh,
-		ipa_stat.rx_ch_stats.rx_ind_ring_stats.ringUsageLow,
-		ipa_stat.rx_ch_stats.bam_stats.bamFifoFull,
-		ipa_stat.rx_ch_stats.bam_stats.bamFifoEmpty,
-		ipa_stat.rx_ch_stats.bam_stats.bamFifoUsageHigh,
-		ipa_stat.rx_ch_stats.bam_stats.bamFifoUsageLow,
-		ipa_stat.rx_ch_stats.num_db,
-		ipa_stat.rx_ch_stats.num_unexpected_db,
-		ipa_stat.rx_ch_stats.num_bam_int_handled);
-}
-
-void wlan_ipa_uc_info(struct wlan_ipa_priv *ipa_ctx)
-{
-	wlan_ipa_print_session_info(ipa_ctx);
-}
-
-void wlan_ipa_uc_stat(struct wlan_ipa_priv *ipa_ctx)
-{
-	/* IPA IPA TX/RX stats */
-	wlan_ipa_print_txrx_stats(ipa_ctx);
-	/* IPA WDI stats */
-	wlan_ipa_print_ipa_wdi_stats(ipa_ctx);
-	/* WLAN FW WDI stats */
-	wlan_ipa_uc_stat_request(ipa_ctx, WLAN_IPA_UC_STAT_REASON_DEBUG);
-}
-
-#ifdef FEATURE_METERING
-
-#ifdef WDI3_STATS_UPDATE
-#ifdef WDI3_STATS_BW_MONITOR
-/**
- * __wlan_ipa_wdi_meter_notifier_cb() - WLAN to IPA callback handler.
- * IPA calls to get WLAN stats or set quota limit.
- * @priv: pointer to private data registered with IPA (we register a
- *	  pointer to the IPA context)
- * @evt: the IPA event which triggered the callback
- * @data: data associated with the event
- *
- * Return: None
- */
-static void __wlan_ipa_wdi_meter_notifier_cb(qdf_ipa_wdi_meter_evt_type_t evt,
-					     void *data)
-{
-	struct wlan_ipa_priv *ipa_ctx = wlan_ipa_get_obj_context();
-	struct qdf_ipa_inform_wlan_bw *bw_info;
-	uint8_t bw_level_index;
-	uint64_t throughput;
-
-	if (evt != IPA_INFORM_WLAN_BW)
-		return;
-
-	bw_info = data;
-	bw_level_index = QDF_IPA_INFORM_WLAN_BW_INDEX(bw_info);
-	throughput = QDF_IPA_INFORM_WLAN_BW_THROUGHPUT(bw_info);
-	ipa_debug("bw_info idx:%d tp:%llu", bw_level_index, throughput);
-
-	if (bw_level_index == ipa_ctx->curr_bw_level)
-		return;
-
-	if (bw_level_index == WLAN_IPA_BW_LEVEL_LOW) {
-		cdp_ipa_set_perf_level(ipa_ctx->dp_soc,
-				       QDF_IPA_CLIENT_WLAN2_CONS,
-				       ipa_ctx->config->ipa_bw_low);
-		ipa_ctx->curr_bw_level = WLAN_IPA_BW_LEVEL_LOW;
-	} else if (bw_level_index == WLAN_IPA_BW_LEVEL_MEDIUM) {
-		cdp_ipa_set_perf_level(ipa_ctx->dp_soc,
-				       QDF_IPA_CLIENT_WLAN2_CONS,
-				       ipa_ctx->config->ipa_bw_medium);
-		ipa_ctx->curr_bw_level = WLAN_IPA_BW_LEVEL_MEDIUM;
-	} else if (bw_level_index == WLAN_IPA_BW_LEVEL_HIGH) {
-		cdp_ipa_set_perf_level(ipa_ctx->dp_soc,
-				       QDF_IPA_CLIENT_WLAN2_CONS,
-				       ipa_ctx->config->ipa_bw_high);
-		ipa_ctx->curr_bw_level = WLAN_IPA_BW_LEVEL_HIGH;
-	}
-
-	ipa_debug("Requested BW level: %d", ipa_ctx->curr_bw_level);
-}
-
-#else
-static void __wlan_ipa_wdi_meter_notifier_cb(qdf_ipa_wdi_meter_evt_type_t evt,
-					     void *data)
-{
-}
-#endif
-
-void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx, uint64_t sta_tx,
-			      uint64_t ap_tx)
-{
-	qdf_ipa_wdi_tx_info_t tx_stats;
-
-	if (!qdf_atomic_read(&ipa_ctx->stats_quota))
-		return;
-
-	QDF_IPA_WDI_TX_INFO_STA_TX_BYTES(&tx_stats) = sta_tx;
-	QDF_IPA_WDI_TX_INFO_SAP_TX_BYTES(&tx_stats) = ap_tx;
-
-	qdf_ipa_wdi_wlan_stats(&tx_stats);
-}
-
-#else
-
-/**
- * wlan_ipa_uc_sharing_stats_request() - Get IPA stats from IPA.
- * @ipa_ctx: IPA context
- * @reset_stats: reset stat countis after response
- *
- * Return: None
- */
-static void wlan_ipa_uc_sharing_stats_request(struct wlan_ipa_priv *ipa_ctx,
-					      uint8_t reset_stats)
-{
-	qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-	if (false == ipa_ctx->resource_loading) {
-		qdf_mutex_release(&ipa_ctx->ipa_lock);
-		cdp_ipa_uc_get_share_stats(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id,
-					   reset_stats);
-	} else {
-		qdf_mutex_release(&ipa_ctx->ipa_lock);
-	}
-}
-
-/**
- * wlan_ipa_uc_set_quota() - Set quota limit bytes from IPA.
- * @ipa_ctx: IPA context
- * @set_quota: when 1, FW starts quota monitoring
- * @quota_bytes: quota limit in bytes
- *
- * Return: None
- */
-static void wlan_ipa_uc_set_quota(struct wlan_ipa_priv *ipa_ctx,
-				  uint8_t set_quota,
-				  uint64_t quota_bytes)
-{
-	ipa_info("SET_QUOTA: set_quota=%d, quota_bytes=%llu",
-		 set_quota, quota_bytes);
-
-	qdf_mutex_acquire(&ipa_ctx->ipa_lock);
-	if (false == ipa_ctx->resource_loading) {
-		qdf_mutex_release(&ipa_ctx->ipa_lock);
-		cdp_ipa_uc_set_quota(ipa_ctx->dp_soc, ipa_ctx->dp_pdev_id,
-				     quota_bytes);
-	} else {
-		qdf_mutex_release(&ipa_ctx->ipa_lock);
-	}
-}
-
-/**
- * __wlan_ipa_wdi_meter_notifier_cb() - WLAN to IPA callback handler.
- * IPA calls to get WLAN stats or set quota limit.
- * @priv: pointer to private data registered with IPA (we register a
- *	  pointer to the IPA context)
- * @evt: the IPA event which triggered the callback
- * @data: data associated with the event
- *
- * Return: None
- */
-static void __wlan_ipa_wdi_meter_notifier_cb(qdf_ipa_wdi_meter_evt_type_t evt,
-					     void *data)
-{
-	struct wlan_ipa_priv *ipa_ctx = wlan_ipa_get_obj_context();
-	struct wlan_ipa_iface_context *iface_ctx;
-	qdf_ipa_get_wdi_sap_stats_t *wdi_sap_stats;
-	qdf_ipa_set_wifi_quota_t *ipa_set_quota;
-	QDF_STATUS status;
-
-	ipa_debug("event=%d", evt);
-
-	iface_ctx = wlan_ipa_get_iface(ipa_ctx, QDF_STA_MODE);
-	if (!iface_ctx) {
-		ipa_err_rl("IPA uC share stats failed - no iface");
-		return;
-	}
-
-	switch (evt) {
-	case IPA_GET_WDI_SAP_STATS:
-		/* fill-up ipa_get_wdi_sap_stats structure after getting
-		 * ipa_uc_fw_stats from FW
-		 */
-		wdi_sap_stats = data;
-
-		qdf_event_reset(&ipa_ctx->ipa_uc_sharing_stats_comp);
-		wlan_ipa_uc_sharing_stats_request(ipa_ctx,
-			QDF_IPA_GET_WDI_SAP_STATS_RESET_STATS(wdi_sap_stats));
-		status = qdf_wait_for_event_completion(
-			&ipa_ctx->ipa_uc_sharing_stats_comp,
-			IPA_UC_SHARING_STATES_WAIT_TIME);
-		if (!QDF_IS_STATUS_SUCCESS(status)) {
-			ipa_err("IPA uC share stats request timed out");
-			QDF_IPA_GET_WDI_SAP_STATS_STATS_VALID(wdi_sap_stats)
-				= 0;
-		} else {
-			QDF_IPA_GET_WDI_SAP_STATS_STATS_VALID(wdi_sap_stats)
-				= 1;
-
-			QDF_IPA_GET_WDI_SAP_STATS_IPV4_RX_PACKETS(wdi_sap_stats)
-				= ipa_ctx->ipa_sharing_stats.ipv4_rx_packets;
-			QDF_IPA_GET_WDI_SAP_STATS_IPV4_RX_BYTES(wdi_sap_stats)
-				= ipa_ctx->ipa_sharing_stats.ipv4_rx_bytes;
-			QDF_IPA_GET_WDI_SAP_STATS_IPV6_RX_PACKETS(wdi_sap_stats)
-				= ipa_ctx->ipa_sharing_stats.ipv6_rx_packets;
-			QDF_IPA_GET_WDI_SAP_STATS_IPV6_RX_BYTES(wdi_sap_stats)
-				= ipa_ctx->ipa_sharing_stats.ipv6_rx_bytes;
-			QDF_IPA_GET_WDI_SAP_STATS_IPV4_TX_PACKETS(wdi_sap_stats)
-				= ipa_ctx->ipa_sharing_stats.ipv4_tx_packets;
-			QDF_IPA_GET_WDI_SAP_STATS_IPV4_TX_BYTES(wdi_sap_stats)
-				= ipa_ctx->ipa_sharing_stats.ipv4_tx_bytes;
-			QDF_IPA_GET_WDI_SAP_STATS_IPV6_TX_PACKETS(wdi_sap_stats)
-				= ipa_ctx->ipa_sharing_stats.ipv6_tx_packets;
-			QDF_IPA_GET_WDI_SAP_STATS_IPV6_TX_BYTES(wdi_sap_stats)
-				= ipa_ctx->ipa_sharing_stats.ipv6_tx_bytes;
-		}
-		break;
-
-	case IPA_SET_WIFI_QUOTA:
-		/* get ipa_set_wifi_quota structure from IPA and pass to FW
-		 * through quota_exceeded field in ipa_uc_fw_stats
-		 */
-		ipa_set_quota = data;
-
-		qdf_event_reset(&ipa_ctx->ipa_uc_set_quota_comp);
-		wlan_ipa_uc_set_quota(ipa_ctx, ipa_set_quota->set_quota,
-				      ipa_set_quota->quota_bytes);
-
-		status = qdf_wait_for_event_completion(
-				&ipa_ctx->ipa_uc_set_quota_comp,
-				IPA_UC_SET_QUOTA_WAIT_TIME);
-		if (!QDF_IS_STATUS_SUCCESS(status)) {
-			ipa_err("IPA uC set quota request timed out");
-			QDF_IPA_SET_WIFI_QUOTA_SET_VALID(ipa_set_quota)	= 0;
-		} else {
-			QDF_IPA_SET_WIFI_QUOTA_BYTES(ipa_set_quota) =
-				((uint64_t)(ipa_ctx->ipa_quota_rsp.quota_hi)
-				  <<32)|ipa_ctx->ipa_quota_rsp.quota_lo;
-			QDF_IPA_SET_WIFI_QUOTA_SET_VALID(ipa_set_quota)	=
-				ipa_ctx->ipa_quota_rsp.success;
-		}
-		break;
-
-	default:
-		break;
-	}
-}
-
-QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx,
-				   struct op_msg_type *op_msg)
-{
-	struct op_msg_type *msg = op_msg;
-	struct ipa_uc_sharing_stats *uc_sharing_stats;
-	struct ipa_uc_quota_rsp *uc_quota_rsp;
-	struct ipa_uc_quota_ind *uc_quota_ind;
-	struct wlan_ipa_iface_context *iface_ctx;
-	uint64_t quota_bytes;
-
-	if (msg->op_code == WLAN_IPA_UC_OPCODE_SHARING_STATS) {
-		/* fill-up ipa_uc_sharing_stats structure from FW */
-		uc_sharing_stats = (struct ipa_uc_sharing_stats *)
-			     ((uint8_t *)op_msg + sizeof(struct op_msg_type));
-
-		memcpy(&ipa_ctx->ipa_sharing_stats, uc_sharing_stats,
-		       sizeof(struct ipa_uc_sharing_stats));
-
-		qdf_event_set(&ipa_ctx->ipa_uc_sharing_stats_comp);
-	} else if (msg->op_code == WLAN_IPA_UC_OPCODE_QUOTA_RSP) {
-		/* received set quota response */
-		uc_quota_rsp = (struct ipa_uc_quota_rsp *)
-			     ((uint8_t *)op_msg + sizeof(struct op_msg_type));
-
-		memcpy(&ipa_ctx->ipa_quota_rsp, uc_quota_rsp,
-		       sizeof(struct ipa_uc_quota_rsp));
-
-		qdf_event_set(&ipa_ctx->ipa_uc_set_quota_comp);
-	} else if (msg->op_code == WLAN_IPA_UC_OPCODE_QUOTA_IND) {
-		/* hit quota limit */
-		uc_quota_ind = (struct ipa_uc_quota_ind *)
-			     ((uint8_t *)op_msg + sizeof(struct op_msg_type));
-
-		ipa_ctx->ipa_quota_ind.quota_bytes =
-					uc_quota_ind->quota_bytes;
-
-		/* send quota exceeded indication to IPA */
-		iface_ctx = wlan_ipa_get_iface(ipa_ctx, QDF_STA_MODE);
-		quota_bytes = uc_quota_ind->quota_bytes;
-		if (iface_ctx)
-			qdf_ipa_broadcast_wdi_quota_reach_ind(
-							iface_ctx->dev->ifindex,
-							quota_bytes);
-		else
-			ipa_err("Failed quota_reach_ind: NULL interface");
-	} else {
-		return QDF_STATUS_E_INVAL;
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-#endif /* WDI3_STATS_UPDATE */
-
-/**
- * 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 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)
-{
-	struct qdf_op_sync *op_sync;
-
-	if (qdf_op_protect(&op_sync))
-		return;
-
-	__wlan_ipa_wdi_meter_notifier_cb(evt, data);
-
-	qdf_op_unprotect(op_sync);
-}
-#endif /* FEATURE_METERING */

+ 0 - 210
components/ipa/dispatcher/inc/cfg_ipa.h

@@ -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_ */

+ 0 - 101
components/ipa/dispatcher/inc/wlan_ipa_obj_mgmt_api.h

@@ -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_ */

+ 0 - 107
components/ipa/dispatcher/inc/wlan_ipa_public_struct.h

@@ -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_ */

+ 0 - 47
components/ipa/dispatcher/inc/wlan_ipa_tgt_api.h

@@ -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_ */

+ 0 - 664
components/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h

@@ -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_ */

+ 0 - 293
components/ipa/dispatcher/src/wlan_ipa_obj_mgmt_api.c

@@ -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;
-}

+ 0 - 76
components/ipa/dispatcher/src/wlan_ipa_tgt_api.c

@@ -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;
-}
-

+ 0 - 248
components/ipa/dispatcher/src/wlan_ipa_ucfg_api.c

@@ -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);
-}

+ 0 - 50
components/target_if/ipa/inc/target_if_ipa.h

@@ -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_ */
-

+ 0 - 82
components/target_if/ipa/src/target_if_ipa.c

@@ -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;
-}

+ 2 - 0
core/hdd/src/wlan_hdd_main.c

@@ -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,