/* SPDX-License-Identifier: GPL-2.0-only */


#ifndef _IPA_H_
#define _IPA_H_

#include <linux/if_ether.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/msm_ipa.h>
#include <linux/skbuff.h>
#include <linux/types.h>
#include <linux/ipa_qmi_service_v01.h>
#include <linux/msm_gsi.h>

#define IPA_APPS_MAX_BW_IN_MBPS 700
#define IPA_BW_THRESHOLD_MAX 3

#define IPA_MAX_CH_STATS_SUPPORTED 5
#define IPA_EP_ARR_SIZE 2
#define IPA_EP_PER_REG 32


#define BUFF_ABOVE_HIGH_THRESHOLD_FOR_DEFAULT_PIPE        1
#define BUFF_ABOVE_HIGH_THRESHOLD_FOR_COAL_PIPE           2
#define BUFF_BELOW_LOW_THRESHOLD_FOR_DEFAULT_PIPE         3
#define BUFF_BELOW_LOW_THRESHOLD_FOR_COAL_PIPE            4
#define BUFF_ABOVE_HIGH_THRESHOLD_FOR_LL_PIPE             5
#define BUFF_BELOW_LOW_THRESHOLD_FOR_LL_PIPE              6
#define FREE_PAGE_TASK_SCHEDULED                          7
#define FREE_PAGE_TASK_SCHEDULED_LL                       8


#define IPA_SOCKSv5_ENTRY_VALID	(1ul << 0)
#define IPA_SOCKSv5_IPV4	(1ul << 1)
#define IPA_SOCKSv5_IPV6	(1ul << 2)
#define IPA_SOCKSv5_OPT_TS	(1ul << 3)
#define IPA_SOCKSv5_OPT_SACK	(1ul << 4)
#define IPA_SOCKSv5_OPT_WS_STC	(1ul << 5)
#define IPA_SOCKSv5_OPT_WS_DMC	(1ul << 6)

#define IPA_SOCKsv5_ADD_COM_ID		15
#define IPA_SOCKsv5_ADD_V6_V4_COM_PM	1
#define IPA_SOCKsv5_ADD_V4_V6_COM_PM	2
#define IPA_SOCKsv5_ADD_V6_V6_COM_PM	3


enum ipa_transport_type {
	IPA_TRANSPORT_TYPE_SPS,
	IPA_TRANSPORT_TYPE_GSI
};


enum ipa_nat_en_type {
	IPA_BYPASS_NAT,
	IPA_SRC_NAT,
	IPA_DST_NAT,
};


enum ipa_ipv6ct_en_type {
	IPA_BYPASS_IPV6CT,
	IPA_ENABLE_IPV6CT,
};


enum ipa_mode_type {
	IPA_BASIC,
	IPA_ENABLE_FRAMING_HDLC,
	IPA_ENABLE_DEFRAMING_HDLC,
	IPA_DMA,
};


enum ipa_aggr_en_type {
	IPA_BYPASS_AGGR,
	IPA_ENABLE_AGGR,
	IPA_ENABLE_DEAGGR,
};


enum ipa_aggr_type {
	IPA_MBIM_16 = 0,
	IPA_HDLC    = 1,
	IPA_TLP     = 2,
	IPA_RNDIS   = 3,
	IPA_GENERIC = 4,
	IPA_COALESCE = 5,
	IPA_QCMAP   = 6,
};


enum ipa_aggr_mode {
	IPA_MBIM_AGGR,
	IPA_QCNCM_AGGR,
};


enum ipa_dp_evt_type {
	IPA_RECEIVE,
	IPA_WRITE_DONE,
};


enum hdr_total_len_or_pad_type {
	IPA_HDR_PAD = 0,
	IPA_HDR_TOTAL_LEN = 1,
};


struct ipa_ep_cfg_nat {
	enum ipa_nat_en_type nat_en;
	bool nat_exc_suppress;
};


struct ipa_ep_cfg_conn_track {
	enum ipa_ipv6ct_en_type conn_track_en;
};


struct ipa_ep_cfg_hdr {
	u32  hdr_len;
	u32  hdr_ofst_metadata_valid;
	u32  hdr_ofst_metadata;
	u32  hdr_additional_const_len;
	u32  hdr_ofst_pkt_size_valid;
	u32  hdr_ofst_pkt_size;
	u32  hdr_a5_mux;
	u32  hdr_remove_additional;
	u32  hdr_metadata_reg_valid;
};


struct ipa_ep_cfg_hdr_ext {
	u32 hdr_pad_to_alignment;
	u32 hdr_total_len_or_pad_offset;
	bool hdr_payload_len_inc_padding;
	enum hdr_total_len_or_pad_type hdr_total_len_or_pad;
	bool hdr_total_len_or_pad_valid;
	bool hdr_little_endian;
	struct ipa_ep_cfg_hdr *hdr;
	bool hdr_bytes_to_remove_valid;
	u32 hdr_bytes_to_remove;
};


struct ipa_ep_cfg_mode {
	enum ipa_mode_type mode;
	enum ipa_client_type dst;
};


struct ipa_ep_cfg_aggr {
	enum ipa_aggr_en_type aggr_en;
	enum ipa_aggr_type aggr;
	u32 aggr_byte_limit;
	u32 aggr_time_limit;
	u32 aggr_pkt_limit;
	u32 aggr_hard_byte_limit_en;
	bool aggr_sw_eof_active;
	u8 pulse_generator;
	u8 scaled_time;
	bool aggr_coal_l2;
};


struct ipa_ep_cfg_route {
	u32 rt_tbl_hdl;
};


struct ipa_ep_cfg_holb {
	u32 tmr_val;
	u32 base_val;
	u32 scale;
	u16 en;
	u8 pulse_generator;
	u8 scaled_time;
};


struct ipa_ep_cfg_deaggr {
	u32 deaggr_hdr_len;
	bool syspipe_err_detection;
	bool packet_offset_valid;
	u32 packet_offset_location;
	bool ignore_min_pkt_err;
	u32 max_packet_len;
};


enum ipa_cs_offload {
	IPA_DISABLE_CS_OFFLOAD,
	
	IPA_ENABLE_CS_OFFLOAD_UL,
	IPA_ENABLE_CS_DL_QMAP = IPA_ENABLE_CS_OFFLOAD_UL,
	IPA_ENABLE_CS_OFFLOAD_DL,
	IPA_CS_RSVD
};


struct ipa_ep_cfg_cfg {
	bool frag_offload_en;
	enum ipa_cs_offload cs_offload_en;
	u8 cs_metadata_hdr_offset;
	u8 gen_qmb_master_sel;
	u8 tx_instance;
	bool pipe_replicate_en;
};


struct ipa_ep_cfg_prod_cfg {
	u8 tx_instance;
	bool tsp_enable;
	bool max_output_size_drop_enable;
	u8 tsp_idx;
	u8 max_output_size;
	u8 egress_tc_lowest;
	u8 egress_tc_highest;
};


struct ipa_ep_cfg_metadata_mask {
	u32 metadata_mask;
};


struct ipa_ep_cfg_metadata {
	u32 qmap_id;
};


struct ipa_ep_cfg_seq {
	bool set_dynamic;
	int seq_type;
};


struct ipa_ep_cfg_ulso {
	int ipid_min_max_idx;
	bool is_ulso_pipe;
};


struct ipa_ep_cfg {
	struct ipa_ep_cfg_nat nat;
	struct ipa_ep_cfg_conn_track conn_track;
	struct ipa_ep_cfg_hdr hdr;
	struct ipa_ep_cfg_hdr_ext hdr_ext;
	struct ipa_ep_cfg_mode mode;
	struct ipa_ep_cfg_aggr aggr;
	struct ipa_ep_cfg_deaggr deaggr;
	struct ipa_ep_cfg_route route;
	struct ipa_ep_cfg_cfg cfg;
	struct ipa_ep_cfg_metadata_mask metadata_mask;
	struct ipa_ep_cfg_metadata meta;
	struct ipa_ep_cfg_seq seq;
	struct ipa_ep_cfg_ulso ulso;
	struct ipa_ep_cfg_prod_cfg prod_cfg;
};


struct ipa_ep_cfg_ctrl {
	bool ipa_ep_suspend;
	bool ipa_ep_delay;
};


#define IPA_NUM_OF_FIFO_DESC(x) (x/sizeof(struct sps_iovec))
typedef void (*ipa_notify_cb)(void *priv, enum ipa_dp_evt_type evt,
		       unsigned long data);


enum ipa_wdi_meter_evt_type {
	IPA_GET_WDI_SAP_STATS,
	IPA_SET_WIFI_QUOTA,
	IPA_INFORM_WLAN_BW,
};

struct ipa_get_wdi_sap_stats {
	
	uint8_t reset_stats;
	
	uint8_t stats_valid;
	
	uint64_t ipv4_tx_packets;
	uint64_t ipv4_tx_bytes;
	
	uint64_t ipv4_rx_packets;
	uint64_t ipv4_rx_bytes;
	uint64_t ipv6_tx_packets;
	uint64_t ipv6_tx_bytes;
	uint64_t ipv6_rx_packets;
	uint64_t ipv6_rx_bytes;
};


struct ipa_set_wifi_quota {
	uint64_t quota_bytes;
	uint8_t  set_quota;
	
	uint8_t set_valid;
};


struct ipa_inform_wlan_bw {
	uint8_t  index;
	uint64_t throughput;
};

typedef void (*ipa_wdi_meter_notifier_cb)(enum ipa_wdi_meter_evt_type evt,
		       void *data);



struct ipa_tx_intf {
	u32 num_props;
	struct ipa_ioc_tx_intf_prop *prop;
};


struct ipa_rx_intf {
	u32 num_props;
	struct ipa_ioc_rx_intf_prop *prop;
};


struct ipa_ext_intf {
	bool excp_pipe_valid;
	enum ipa_client_type excp_pipe;
	u32 num_props;
	struct ipa_ioc_ext_intf_prop *prop;
};


struct ipa_sys_connect_params {
	struct ipa_ep_cfg ipa_ep_cfg;
	enum ipa_client_type client;
	u32 desc_fifo_sz;
	void *priv;
	ipa_notify_cb notify;
	bool skip_ep_cfg;
	bool keep_ipa_awake;
	struct napi_struct *napi_obj;
	bool recycle_enabled;
	bool bypass_agg;
	u32 int_modt;
	u32 int_modc;
	u32 buff_size;
	bool ext_ioctl_v2;
};


struct ipa_tx_meta {
	u8 pkt_init_dst_ep;
	bool pkt_init_dst_ep_valid;
	bool pkt_init_dst_ep_remote;
	dma_addr_t dma_address;
	bool dma_address_valid;
};


typedef void (*ipa_msg_free_fn)(void *buff, u32 len, u32 type);


typedef int (*ipa_msg_pull_fn)(void *buff, u32 len, u32 type);


enum ipa_voltage_level {
	IPA_VOLTAGE_UNSPECIFIED,
	IPA_VOLTAGE_SVS2 = IPA_VOLTAGE_UNSPECIFIED,
	IPA_VOLTAGE_SVS,
	IPA_VOLTAGE_NOMINAL,
	IPA_VOLTAGE_TURBO,
	IPA_VOLTAGE_MAX,
};


enum ipa_rm_event {
	IPA_RM_RESOURCE_GRANTED,
	IPA_RM_RESOURCE_RELEASED
};

typedef void (*ipa_rm_notify_cb)(void *user_data,
		enum ipa_rm_event event,
		unsigned long data);

struct ipa_rm_register_params {
	void *user_data;
	ipa_rm_notify_cb notify_cb;
};


struct ipa_rm_create_params {
	enum ipa_rm_resource_name name;
	enum ipa_voltage_level floor_voltage;
	struct ipa_rm_register_params reg_params;
	int (*request_resource)(void);
	int (*release_resource)(void);
};


struct ipa_rm_perf_profile {
	u32 max_supported_bandwidth_mbps;
};

#define A2_MUX_HDR_NAME_V4_PREF "dmux_hdr_v4_"
#define A2_MUX_HDR_NAME_V6_PREF "dmux_hdr_v6_"


struct ipa_tx_data_desc {
	struct list_head link;
	void *priv;
	void *pyld_buffer;
	u16  pyld_len;
};


struct ipa_rx_data {
	struct sk_buff *skb;
	dma_addr_t dma_addr;
};


enum ipa_irq_type {
	IPA_BAD_SNOC_ACCESS_IRQ,
	IPA_UC_IRQ_0,
	IPA_UC_IRQ_1,
	IPA_UC_IRQ_2,
	IPA_UC_IRQ_3,
	IPA_UC_IN_Q_NOT_EMPTY_IRQ,
	IPA_UC_RX_CMD_Q_NOT_FULL_IRQ,
	IPA_PROC_TO_UC_ACK_Q_NOT_EMPTY_IRQ,
	IPA_RX_ERR_IRQ,
	IPA_DEAGGR_ERR_IRQ,
	IPA_TX_ERR_IRQ,
	IPA_STEP_MODE_IRQ,
	IPA_PROC_ERR_IRQ,
	IPA_TX_SUSPEND_IRQ,
	IPA_TX_HOLB_DROP_IRQ,
	IPA_BAM_GSI_IDLE_IRQ,
	IPA_PIPE_YELLOW_MARKER_BELOW_IRQ,
	IPA_PIPE_RED_MARKER_BELOW_IRQ,
	IPA_PIPE_YELLOW_MARKER_ABOVE_IRQ,
	IPA_PIPE_RED_MARKER_ABOVE_IRQ,
	IPA_UCP_IRQ,
	IPA_DCMP_IRQ,
	IPA_GSI_EE_IRQ,
	IPA_GSI_IPA_IF_TLV_RCVD_IRQ,
	IPA_GSI_UC_IRQ,
	IPA_TLV_LEN_MIN_DSM_IRQ,
	IPA_DRBIP_PKT_EXCEED_MAX_SIZE_IRQ,
	IPA_DRBIP_DATA_SCTR_CFG_ERROR_IRQ,
	IPA_DRBIP_IMM_CMD_NO_FLSH_HZRD_IRQ,
	IPA_IRQ_MAX
};


typedef void (*ipa_irq_handler_t)(enum ipa_irq_type interrupt,
				void *private_data,
				void *interrupt_data);


struct IpaHwBamStats_t {
	u32 bamFifoFull;
	u32 bamFifoEmpty;
	u32 bamFifoUsageHigh;
	u32 bamFifoUsageLow;
	u32 bamUtilCount;
} __packed;


struct IpaHwRingStats_t {
	u32 ringFull;
	u32 ringEmpty;
	u32 ringUsageHigh;
	u32 ringUsageLow;
	u32 RingUtilCount;
} __packed;


struct ipa_uc_dbg_rtk_ring_stats {
	struct IpaHwRingStats_t commStats;
	u32 trCount;
	u32 erCount;
	u32 totalAosCount;
	u64 busyTime;
} __packed;


struct IpaHwStatsWDIRxInfoData_t {
	u32 max_outstanding_pkts;
	u32 num_pkts_processed;
	u32 rx_ring_rp_value;
	struct IpaHwRingStats_t rx_ind_ring_stats;
	struct IpaHwBamStats_t bam_stats;
	u32 num_bam_int_handled;
	u32 num_db;
	u32 num_unexpected_db;
	u32 num_pkts_in_dis_uninit_state;
	u32 num_ic_inj_vdev_change;
	u32 num_ic_inj_fw_desc_change;
	u32 num_qmb_int_handled;
	u32 reserved1;
	u32 reserved2;
} __packed;


struct IpaHwStatsWDITxInfoData_t {
	u32 num_pkts_processed;
	u32 copy_engine_doorbell_value;
	u32 num_db_fired;
	struct IpaHwRingStats_t tx_comp_ring_stats;
	struct IpaHwBamStats_t bam_stats;
	u32 num_db;
	u32 num_unexpected_db;
	u32 num_bam_int_handled;
	u32 num_bam_int_in_non_running_state;
	u32 num_qmb_int_handled;
	u32 num_bam_int_handled_while_wait_for_bam;
} __packed;


struct IpaHwStatsWDIInfoData_t {
	struct IpaHwStatsWDIRxInfoData_t rx_ch_stats;
	struct IpaHwStatsWDITxInfoData_t tx_ch_stats;
} __packed;



struct ipa_wdi_ul_params {
	phys_addr_t rdy_ring_base_pa;
	u32 rdy_ring_size;
	phys_addr_t rdy_ring_rp_pa;
	phys_addr_t rdy_comp_ring_base_pa;
	phys_addr_t rdy_comp_ring_wp_pa;
	u32 rdy_comp_ring_size;
	u32 *rdy_ring_rp_va;
	u32 *rdy_comp_ring_wp_va;
	bool is_txr_rn_db_pcie_addr;
	bool is_evt_rn_db_pcie_addr;
};


struct ipa_wdi_ul_params_smmu {
	struct sg_table rdy_ring;
	u32 rdy_ring_size;
	phys_addr_t rdy_ring_rp_pa;
	struct sg_table rdy_comp_ring;
	phys_addr_t rdy_comp_ring_wp_pa;
	u32 rdy_comp_ring_size;
	u32 *rdy_ring_rp_va;
	u32 *rdy_comp_ring_wp_va;
	bool is_txr_rn_db_pcie_addr;
	bool is_evt_rn_db_pcie_addr;
};


struct ipa_wdi_dl_params {
	phys_addr_t comp_ring_base_pa;
	u32 comp_ring_size;
	phys_addr_t ce_ring_base_pa;
	phys_addr_t ce_door_bell_pa;
	u32 ce_ring_size;
	u32 num_tx_buffers;
	bool is_txr_rn_db_pcie_addr;
	bool is_evt_rn_db_pcie_addr;
};


struct ipa_wdi_dl_params_smmu {
	struct sg_table comp_ring;
	u32 comp_ring_size;
	struct sg_table ce_ring;
	phys_addr_t ce_door_bell_pa;
	u32 ce_ring_size;
	u32 num_tx_buffers;
	bool is_txr_rn_db_pcie_addr;
	bool is_evt_rn_db_pcie_addr;
};


struct ipa_wdi_in_params {
	struct ipa_sys_connect_params sys;
	union {
		struct ipa_wdi_ul_params ul;
		struct ipa_wdi_dl_params dl;
		struct ipa_wdi_ul_params_smmu ul_smmu;
		struct ipa_wdi_dl_params_smmu dl_smmu;
	} u;
	bool smmu_enabled;
#ifdef IPA_WAN_MSG_IPv6_ADDR_GW_LEN
	ipa_wdi_meter_notifier_cb wdi_notify;
#endif
};

enum ipa_upstream_type {
	IPA_UPSTEAM_MODEM = 1,
	IPA_UPSTEAM_WLAN,
	IPA_UPSTEAM_MAX
};


struct ipa_wdi_out_params {
	phys_addr_t uc_door_bell_pa;
	u32 clnt_hdl;
};


struct ipa_wdi_db_params {
	enum ipa_client_type client;
	phys_addr_t uc_door_bell_pa;
};


typedef void (*ipa_uc_ready_cb)(void *priv);
struct ipa_wdi_uc_ready_params {
	bool is_uC_ready;
	void *priv;
	ipa_uc_ready_cb notify;
};


struct ipa_wdi_buffer_info {
	phys_addr_t pa;
	unsigned long iova;
	size_t size;
	int result;
};


struct ipa_wdi_bw_info {
	uint64_t threshold[IPA_BW_THRESHOLD_MAX];
	int num;
	bool stop;
};


struct ipa_wdi_tx_info {
	uint64_t sta_tx;
	uint64_t ap_tx;
};


struct ipa_gsi_ep_config {
	int ipa_ep_num;
	int ipa_gsi_chan_num;
	int ipa_if_tlv;
	int ipa_if_aos;
	int ee;
	enum gsi_prefetch_mode prefetch_mode;
	uint8_t prefetch_threshold;
};



enum ipa_smmu_client_type {
	IPA_SMMU_WLAN_CLIENT,
	IPA_SMMU_AP_CLIENT,
	IPA_SMMU_WIGIG_CLIENT,
	IPA_SMMU_WLAN1_CLIENT,
	IPA_SMMU_ETH_CLIENT,
	IPA_SMMU_ETH1_CLIENT,
	IPA_SMMU_CLIENT_MAX
};

struct ipa_smmu_in_params {
	enum ipa_smmu_client_type smmu_client;
};


struct ipa_smmu_out_params {
	bool smmu_enable;
	bool shared_cb;
};

struct iphdr_rsv {
	struct iphdr ipv4_temp;  
	uint32_t rsv1;
	uint32_t rsv2;
	uint32_t rsv3;
	uint32_t rsv4;
	uint32_t rsv5;
} __packed;

union ip_hdr_temp {
	struct iphdr_rsv ipv4_rsv;	
	struct ipv6hdr ipv6_temp;	
} __packed;

struct ipa_socksv5_uc_tmpl {
	uint16_t cmd_id;
	uint16_t rsv;
	uint32_t cmd_param;
	uint16_t pkt_count;
	uint16_t rsv2;
	uint32_t byte_count;
	union ip_hdr_temp ip_hdr;
	
	uint16_t src_port;
	uint16_t dst_port;

	
	uint32_t ipa_sockv5_mask;

	
	uint32_t out_irs;
	uint32_t out_iss;
	uint32_t in_irs;
	uint32_t in_iss;

	
	uint32_t out_ircv_tsval;
	uint32_t in_ircv_tsecr;
	uint32_t out_ircv_tsecr;
	uint32_t in_ircv_tsval;

	
	uint16_t in_isnd_wscale:4;
	uint16_t out_isnd_wscale:4;
	uint16_t in_ircv_wscale:4;
	uint16_t out_ircv_wscale:4;
	uint16_t MAX_WINDOW_SIZE;
	
	uint32_t rsv3;
	uint32_t rsv4;
	uint32_t rsv5;
	uint32_t rsv6;
	uint32_t rsv7;
	uint32_t rsv8;
	uint32_t rsv9;
} __packed;


struct ipa_socksv5_info {
	
	struct ipa_socksv5_uc_tmpl ul_out;
	struct ipa_socksv5_uc_tmpl dl_out;

	
	struct ipacm_socksv5_info ul_in;
	struct ipacm_socksv5_info dl_in;

	
	uint16_t handle;
};

struct ipa_ipv6_nat_uc_tmpl {
	uint16_t cmd_id;
	uint16_t rsv;
	uint32_t cmd_param;
	uint16_t pkt_count;
	uint16_t rsv2;
	uint32_t byte_count;
	uint64_t private_address_lsb;
	uint64_t private_address_msb;
	uint64_t public_address_lsb;
	uint64_t public_address_msb;
	uint16_t private_port;
	uint16_t public_port;
	uint32_t rsv3;
	uint64_t rsv4;
	uint64_t rsv5;
	uint64_t rsv6;
	uint64_t rsv7;
	uint64_t rsv8;
	uint64_t rsv9;
	uint64_t rsv10;
	uint64_t rsv11;
	uint64_t rsv12;
} __packed;

#if IS_ENABLED(CONFIG_IPA3)



int ipa_cfg_ep_ctrl(u32 clnt_hdl, const struct ipa_ep_cfg_ctrl *ep_ctrl);




int ipa_add_rt_rule(struct ipa_ioc_add_rt_rule *rules);


int ipa_put_rt_tbl(u32 rt_tbl_hdl);


int ipa_register_intf(const char *name,
	const struct ipa_tx_intf *tx,
	const struct ipa_rx_intf *rx);
int ipa_deregister_intf(const char *name);





int ipa_set_aggr_mode(enum ipa_aggr_mode mode);


int ipa_set_qcncm_ndp_sig(char sig[3]);


int ipa_set_single_ndp_per_mbim(bool enable);





int ipa_add_interrupt_handler(enum ipa_irq_type interrupt,
	ipa_irq_handler_t handler,
	bool deferred_flag,
	void *private_data);


int ipa_restore_suspend_handler(void);




int ipa_send_msg(struct ipa_msg_meta *metadata, void *buff,
		  ipa_msg_free_fn callback);




int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
		struct ipa_tx_meta *metadata);


int ipa_rmnet_ctl_xmit(struct sk_buff *skb);


int ipa_rmnet_ll_xmit(struct sk_buff *skb);


int ipa_register_notifier(void *fn_ptr);


int ipa_unregister_notifier(void *fn_ptr);

void ipa_free_skb(struct ipa_rx_data *data);




int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl);


int ipa_teardown_sys_pipe(u32 clnt_hdl);

int ipa_connect_wdi_pipe(struct ipa_wdi_in_params *in,
		struct ipa_wdi_out_params *out);
int ipa_disconnect_wdi_pipe(u32 clnt_hdl);
int ipa_enable_wdi_pipe(u32 clnt_hdl);
int ipa_disable_wdi_pipe(u32 clnt_hdl);
int ipa_resume_wdi_pipe(u32 clnt_hdl);
int ipa_suspend_wdi_pipe(u32 clnt_hdl);
int ipa_reg_uc_rdyCB(struct ipa_wdi_uc_ready_params *param);
int ipa_dereg_uc_rdyCB(void);
int ipa_add_hdr(struct ipa_ioc_add_hdr *hdrs);
int ipa_del_hdr(struct ipa_ioc_del_hdr *hdls);
int ipa_get_hdr(struct ipa_ioc_get_hdr *lookup);

int ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats);
int ipa_uc_bw_monitor(struct ipa_wdi_bw_info *info);


int ipa_broadcast_wdi_quota_reach_ind(uint32_t fid,
		uint64_t num_bytes);


int ipa_uc_wdi_get_dbpa(struct ipa_wdi_db_params *out);


 
int ipa_dma_init(void);


int ipa_dma_enable(void);


int ipa_dma_disable(void);


int ipa_dma_sync_memcpy(u64 dest, u64 src, int len);


int ipa_dma_async_memcpy(u64 dest, u64 src, int len,
			void (*user_cb)(void *user1), void *user_param);



void ipa_dma_destroy(void);


void ipa_bam_reg_dump(void);

int ipa_get_ep_mapping(enum ipa_client_type client);

bool ipa_is_ready(void);

void ipa_proxy_clk_vote(void);
void ipa_proxy_clk_unvote(void);

#if IS_ENABLED(CONFIG_DEEPSLEEP) || IS_ENABLED(CONFIG_HIBERNATION)
int ipa_fmwk_deepsleep_entry_ipa(void);

int ipa_fmwk_deepsleep_exit_ipa(void);
#endif

enum ipa_hw_type ipa_get_hw_type(void);

const struct ipa_gsi_ep_config *ipa_get_gsi_ep_info(
	enum ipa_client_type client);

int ipa_stop_gsi_channel(u32 clnt_hdl);

typedef void (*ipa_ready_cb)(void *user_data);

typedef void (*ipa_rmnet_ctl_ready_cb)(void *user_data);

typedef void (*ipa_rmnet_ctl_stop_cb)(void *user_data);

typedef void (*ipa_rmnet_ctl_rx_notify_cb)(void *user_data, void *rx_data);

typedef void (*ipa_rmnet_ll_ready_cb)(void *user_data);

typedef void (*ipa_rmnet_ll_stop_cb)(void *user_data);

typedef void (*ipa_rmnet_ll_rx_notify_cb)(void *user_data, void *rx_data);

int ipa_get_default_aggr_time_limit(enum ipa_client_type client,
	u32 *default_aggr_time_limit);


int ipa_register_ipa_ready_cb(void (*ipa_ready_cb)(void *user_data),
			      void *user_data);


int ipa_register_rmnet_ctl_cb(
	void (*ipa_rmnet_ctl_ready_cb)(void *user_data1),
	void *user_data1,
	void (*ipa_rmnet_ctl_stop_cb)(void *user_data2),
	void *user_data2,
	void (*ipa_rmnet_ctl_rx_notify_cb)(void *user_data3, void *rx_data),
	void *user_data3);


int ipa_unregister_rmnet_ctl_cb(void);


int ipa_register_rmnet_ll_cb(
	void (*ipa_rmnet_ll_ready_cb)(void *user_data1),
	void *user_data1,
	void (*ipa_rmnet_ll_stop_cb)(void *user_data2),
	void *user_data2,
	void (*ipa_rmnet_ll_rx_notify_cb)(void *user_data3, void *rx_data),
	void *user_data3);


int ipa_unregister_rmnet_ll_cb(void);

int ipa_get_smmu_params(struct ipa_smmu_in_params *in,
	struct ipa_smmu_out_params *out);

int ipa_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res);


bool ipa_get_lan_rx_napi(void);

int ipa_add_socksv5_conn(struct ipa_socksv5_info *info);


int ipa_del_socksv5_conn(uint32_t handle);

int ipa_mhi_handle_ipa_config_req(struct ipa_config_req_msg_v01 *config_req);
int ipa_wigig_save_regs(void);


static inline int ipa_uc_reg_rdyCB(
	struct ipa_wdi_uc_ready_params *inout)
{
	return -EFAULT;
}

#else 


static inline int ipa_cfg_ep_ctrl(u32 clnt_hdl,
	const struct ipa_ep_cfg_ctrl *ep_ctrl)
{
	return -EPERM;
}


static inline int ipa_add_rt_rule(struct ipa_ioc_add_rt_rule *rules)
{
	return -EPERM;
}

static inline int ipa_put_rt_tbl(u32 rt_tbl_hdl)
{
	return -EPERM;
}


static inline int ipa_register_intf(const char *name,
	const struct ipa_tx_intf *tx,
	const struct ipa_rx_intf *rx)
{
	return -EPERM;
}


static inline int ipa_set_aggr_mode(enum ipa_aggr_mode mode)
{
	return -EPERM;
}

static inline int ipa_set_qcncm_ndp_sig(char sig[3])
{
	return -EPERM;
}

static inline int ipa_set_single_ndp_per_mbim(bool enable)
{
	return -EPERM;
}


static inline int ipa_add_interrupt_handler(enum ipa_irq_type interrupt,
	ipa_irq_handler_t handler,
	bool deferred_flag,
	void *private_data)
{
	return -EPERM;
}

static inline int ipa_restore_suspend_handler(void)
{
	return -EPERM;
}


static inline int ipa_send_msg(struct ipa_msg_meta *metadata, void *buff,
		ipa_msg_free_fn callback)
{
	return -EPERM;
}


static inline int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
		struct ipa_tx_meta *metadata)
{
	return -EPERM;
}


static inline int ipa_rmnet_ctl_xmit(struct sk_buff *skb)
{
	return -EPERM;
}


static inline int ipa_rmnet_ll_xmit(struct sk_buff *skb)
{
	return -EPERM;
}


static inline int ipa_register_notifier(void *fn_ptr)
{
	return -EPERM;
}


static inline int ipa_unregister_notifier(void *fn_ptr)
{
	return -EPERM;
}

static inline void ipa_free_skb(struct ipa_rx_data *rx_in)
{
}



static inline int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in,
		u32 *clnt_hdl)
{
	return -EPERM;
}

static inline int ipa_teardown_sys_pipe(u32 clnt_hdl)
{
	return -EPERM;
}

static inline int ipa_connect_wdi_pipe(struct ipa_wdi_in_params *in,
		struct ipa_wdi_out_params *out)
{
	return -EPERM;
}

static inline int ipa_disconnect_wdi_pipe(u32 clnt_hdl)
{
	return -EPERM;
}

static inline int ipa_enable_wdi_pipe(u32 clnt_hdl)
{
	return -EPERM;
}

static inline int ipa_disable_wdi_pipe(u32 clnt_hdl)
{
	return -EPERM;
}

static inline int ipa_resume_wdi_pipe(u32 clnt_hdl)
{
	return -EPERM;
}

static inline int ipa_suspend_wdi_pipe(u32 clnt_hdl)
{
	return -EPERM;
}

static inline int ipa_broadcast_wdi_quota_reach_ind(uint32_t fid,
		uint64_t num_bytes)
{
	return -EPERM;
}

static inline int ipa_uc_wdi_get_dbpa(
	struct ipa_wdi_db_params *out)
{
	return -EPERM;
}


static inline int ipa_dma_init(void)
{
	return -EPERM;
}

static inline int ipa_dma_enable(void)
{
	return -EPERM;
}

static inline int ipa_dma_disable(void)
{
	return -EPERM;
}

static inline int ipa_dma_sync_memcpy(phys_addr_t dest, phys_addr_t src
			, int len)
{
	return -EPERM;
}

static inline int ipa_dma_async_memcpy(phys_addr_t dest, phys_addr_t src
			, int len, void (*user_cb)(void *user1),
			void *user_param)
{
	return -EPERM;
}

static inline void ipa_dma_destroy(void)
{
}



static inline int ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats)
{
	return -EPERM;
}

static inline int ipa_uc_bw_monitor(struct ipa_wdi_bw_info *info)
{
	return -EPERM;
}

static inline int ipa_get_ep_mapping(enum ipa_client_type client)
{
	return -EPERM;
}

static inline bool ipa_is_ready(void)
{
	return false;
}

static inline int ipa_fmwk_deepsleep_entry_ipa(void)
{
	return -EPERM;
}

static inline int ipa_fmwk_deepsleep_exit_ipa(void)
{
	return -EPERM;
}

static inline enum ipa_hw_type ipa_get_hw_type(void)
{
	return IPA_HW_None;
}

static inline int ipa_register_ipa_ready_cb(
	void (*ipa_ready_cb)(void *user_data),
	void *user_data)
{
	return -EPERM;
}

static inline int ipa_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res)
{
	return -EPERM;
}

static inline bool ipa_get_lan_rx_napi(void)
{
	return false;
}

static inline int ipa_add_socksv5_conn(struct ipa_socksv5_info *info)
{
	return -EPERM;
}

static inline int ipa_del_socksv5_conn(uint32_t handle)
{
	return -EPERM;
}

static inline const struct ipa_gsi_ep_config *ipa_get_gsi_ep_info(
	enum ipa_client_type client)
{
	return NULL;
}

static inline int ipa_stop_gsi_channel(u32 clnt_hdl)
{
	return -EPERM;
}

static inline int ipa_register_rmnet_ctl_cb(
	void (*ipa_rmnet_ctl_ready_cb)(void *user_data1),
	void *user_data1,
	void (*ipa_rmnet_ctl_stop_cb)(void *user_data2),
	void *user_data2,
	void (*ipa_rmnet_ctl_rx_notify_cb)(void *user_data3, void *rx_data),
	void *user_data3)
{
	return -EPERM;
}

static inline int ipa_unregister_rmnet_ctl_cb(void)
{
	return -EPERM;
}

static inline int ipa_uc_reg_rdyCB(
	struct ipa_wdi_uc_ready_params *inout)
{
	return -EPERM;
}

static inline int ipa_register_rmnet_ll_cb(
	void (*ipa_rmnet_ll_ready_cb)(void *user_data1),
	void *user_data1,
	void (*ipa_rmnet_ll_stop_cb)(void *user_data2),
	void *user_data2,
	void (*ipa_rmnet_ll_rx_notify_cb)(void *user_data3, void *rx_data),
	void *user_data3)
{
	return -EPERM;
}

static inline int ipa_get_default_aggr_time_limit(enum ipa_client_type client,
	u32 *default_aggr_time_limit)
{
	return -EPERM;
}

static inline int ipa_unregister_rmnet_ll_cb(void)
{
	return -EPERM;
}

#endif 


static inline int ipa_reset_endpoint(u32 clnt_hdl)
{
	return -EPERM;
}

static inline int ipa_clear_endpoint_delay(u32 clnt_hdl)
{
	return -EPERM;
}

static inline int ipa_commit_hdr(void)
{
	return -EPERM;
}

static inline int ipa_put_hdr(u32 hdr_hdl)
{
	return -EPERM;
}

static inline int ipa_deregister_pull_msg(struct ipa_msg_meta *metadata)
{
	return -EPERM;
}


static inline int ipa_rm_delete_resource(
	enum ipa_rm_resource_name resource_name)
{
	return -EPERM;
}

static inline int ipa_rm_deregister(
	enum ipa_rm_resource_name resource_name,
	struct ipa_rm_register_params *reg_params)
{
	return -EPERM;
}

static inline int ipa_rm_set_perf_profile(
	enum ipa_rm_resource_name resource_name,
	struct ipa_rm_perf_profile *profile)
{
	return -EPERM;
}

static inline int ipa_rm_add_dependency(
	enum ipa_rm_resource_name resource_name,
	enum ipa_rm_resource_name depends_on_name)
{
	return -EPERM;
}

static inline int ipa_rm_add_dependency_sync(
	enum ipa_rm_resource_name resource_name,
	enum ipa_rm_resource_name depends_on_name)
{
	return -EPERM;
}

static inline int ipa_rm_delete_dependency(
	enum ipa_rm_resource_name resource_name,
	enum ipa_rm_resource_name depends_on_name)
{
	return -EPERM;
}

static inline int ipa_rm_request_resource(
	enum ipa_rm_resource_name resource_name)
{
	return -EPERM;
}

static inline int ipa_rm_inactivity_timer_init(
	enum ipa_rm_resource_name resource_name,
	unsigned long msecs)
{
	return -EPERM;
}

static inline int ipa_rm_release_resource(
	enum ipa_rm_resource_name resource_name)
{
	return -EPERM;
}

static inline int ipa_rm_notify_completion(enum ipa_rm_event event,
	enum ipa_rm_resource_name resource_name)
{
	return -EPERM;
}

static inline int ipa_rm_inactivity_timer_destroy(
	enum ipa_rm_resource_name resource_name)
{
	return -EPERM;
}

static inline int ipa_rm_inactivity_timer_request_resource(
	enum ipa_rm_resource_name resource_name)
{
	return -EPERM;
}

static inline int ipa_rm_inactivity_timer_release_resource(
	enum ipa_rm_resource_name resource_name)
{
	return -EPERM;
}

static inline enum ipa_rm_resource_name ipa_get_rm_resource_from_ep(
	int pipe_idx)
{
	return -EPERM;
}

static inline bool ipa_is_client_handle_valid(u32 clnt_hdl)
{
	return false;
}

static inline enum ipa_client_type ipa_get_client_mapping(int pipe_idx)
{
	return -EPERM;
}

static inline bool ipa_get_modem_cfg_emb_pipe_flt(void)
{
	return false;
}

static inline enum ipa_transport_type ipa_get_transport_type(void)
{
	return IPA_TRANSPORT_TYPE_GSI;
}

static inline struct device *ipa_get_dma_dev(void)
{
	return NULL;
}

static inline struct iommu_domain *ipa_get_smmu_domain(void)
{
	return NULL;
}

static inline int ipa_disable_apps_wan_cons_deaggr(
	uint32_t agg_size, uint32_t agg_count)
{
	return -EPERM;
}

static inline int ipa_uc_dereg_rdyCB(void)
{
	return -EPERM;
}

#endif 
