summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSkylar Chang <chiaweic@codeaurora.org>2016-03-01 17:16:17 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:09:44 -0700
commit14bf6793b8e8b7200666502688e5ca3d8032ce3e (patch)
treea050ddf0720aca932741c4fadd8396d6a723203b /include
parentd9ca088b7e70cf731191ed7d85e7ff9d96d9feee (diff)
msm: ipa3: support IPA driver
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ecm_ipa.h95
-rw-r--r--include/linux/ipa.h2598
-rw-r--r--include/linux/msm_gsi.h1178
-rw-r--r--include/linux/rndis_ipa.h102
-rw-r--r--include/uapi/linux/ipa_qmi_service_v01.h1617
-rw-r--r--include/uapi/linux/msm_ipa.h1740
-rw-r--r--include/uapi/linux/rmnet_ipa_fd_ioctl.h153
7 files changed, 7483 insertions, 0 deletions
diff --git a/include/linux/ecm_ipa.h b/include/linux/ecm_ipa.h
new file mode 100644
index 000000000000..5784e0383eab
--- /dev/null
+++ b/include/linux/ecm_ipa.h
@@ -0,0 +1,95 @@
+/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _ECM_IPA_H_
+#define _ECM_IPA_H_
+
+#include <linux/ipa.h>
+
+/*
+ * @priv: private data given upon ipa_connect
+ * @evt: event enum, should be IPA_WRITE_DONE
+ * @data: for tx path the data field is the sent socket buffer.
+ */
+typedef void (*ecm_ipa_callback)(void *priv,
+ enum ipa_dp_evt_type evt,
+ unsigned long data);
+
+/*
+ * struct ecm_ipa_params - parameters for ecm_ipa initialization API
+ *
+ * @device_ready_notify: callback supplied by USB core driver.
+ * This callback shall be called by the Netdev once the device
+ * is ready to recieve data from tethered PC.
+ * @ecm_ipa_rx_dp_notify: ecm_ipa will set this callback (out parameter).
+ * this callback shall be supplied for ipa_connect upon pipe
+ * connection (USB->IPA), once IPA driver receive data packets
+ * from USB pipe destined for Apps this callback will be called.
+ * @ecm_ipa_tx_dp_notify: ecm_ipa will set this callback (out parameter).
+ * this callback shall be supplied for ipa_connect upon pipe
+ * connection (IPA->USB), once IPA driver send packets destined
+ * for USB, IPA BAM will notify for Tx-complete.
+ * @priv: ecm_ipa will set this pointer (out parameter).
+ * This pointer will hold the network device for later interaction
+ * with ecm_ipa APIs
+ * @host_ethaddr: host Ethernet address in network order
+ * @device_ethaddr: device Ethernet address in network order
+ * @skip_ep_cfg: boolean field that determines if Apps-processor
+ * should or should not configure this end-point.
+ */
+struct ecm_ipa_params {
+ void (*device_ready_notify)(void);
+ ecm_ipa_callback ecm_ipa_rx_dp_notify;
+ ecm_ipa_callback ecm_ipa_tx_dp_notify;
+ u8 host_ethaddr[ETH_ALEN];
+ u8 device_ethaddr[ETH_ALEN];
+ void *private;
+ bool skip_ep_cfg;
+};
+
+
+#ifdef CONFIG_ECM_IPA
+
+int ecm_ipa_init(struct ecm_ipa_params *params);
+
+int ecm_ipa_connect(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl,
+ void *priv);
+
+int ecm_ipa_disconnect(void *priv);
+
+void ecm_ipa_cleanup(void *priv);
+
+#else /* CONFIG_ECM_IPA*/
+
+int ecm_ipa_init(struct ecm_ipa_params *params)
+{
+ return 0;
+}
+
+static inline int ecm_ipa_connect(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl,
+ void *priv)
+{
+ return 0;
+}
+
+static inline int ecm_ipa_disconnect(void *priv)
+{
+ return 0;
+}
+
+static inline void ecm_ipa_cleanup(void *priv)
+{
+
+}
+#endif /* CONFIG_ECM_IPA*/
+
+#endif /* _ECM_IPA_H_ */
diff --git a/include/linux/ipa.h b/include/linux/ipa.h
new file mode 100644
index 000000000000..0c618d31d4ce
--- /dev/null
+++ b/include/linux/ipa.h
@@ -0,0 +1,2598 @@
+/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _IPA_H_
+#define _IPA_H_
+
+#include <linux/msm_ipa.h>
+#include <linux/skbuff.h>
+#include <linux/types.h>
+#include <linux/msm-sps.h>
+#include <linux/if_ether.h>
+#include "linux/msm_gsi.h"
+
+#define IPA_APPS_MAX_BW_IN_MBPS 700
+/**
+ * enum ipa_transport_type
+ * transport type: either GSI or SPS
+ */
+enum ipa_transport_type {
+ IPA_TRANSPORT_TYPE_SPS,
+ IPA_TRANSPORT_TYPE_GSI
+};
+
+/**
+ * enum ipa_nat_en_type - NAT setting type in IPA end-point
+ */
+enum ipa_nat_en_type {
+ IPA_BYPASS_NAT,
+ IPA_SRC_NAT,
+ IPA_DST_NAT,
+};
+
+/**
+ * enum ipa_mode_type - mode setting type in IPA end-point
+ * @BASIC: basic mode
+ * @ENABLE_FRAMING_HDLC: not currently supported
+ * @ENABLE_DEFRAMING_HDLC: not currently supported
+ * @DMA: all data arriving IPA will not go through IPA logic blocks, this
+ * allows IPA to work as DMA for specific pipes.
+ */
+enum ipa_mode_type {
+ IPA_BASIC,
+ IPA_ENABLE_FRAMING_HDLC,
+ IPA_ENABLE_DEFRAMING_HDLC,
+ IPA_DMA,
+};
+
+/**
+ * enum ipa_aggr_en_type - aggregation setting type in IPA
+ * end-point
+ */
+enum ipa_aggr_en_type {
+ IPA_BYPASS_AGGR,
+ IPA_ENABLE_AGGR,
+ IPA_ENABLE_DEAGGR,
+};
+
+/**
+ * enum ipa_aggr_type - type of aggregation in IPA end-point
+ */
+enum ipa_aggr_type {
+ IPA_MBIM_16 = 0,
+ IPA_HDLC = 1,
+ IPA_TLP = 2,
+ IPA_RNDIS = 3,
+ IPA_GENERIC = 4,
+ IPA_QCMAP = 6,
+};
+
+/**
+ * enum ipa_aggr_mode - global aggregation mode
+ */
+enum ipa_aggr_mode {
+ IPA_MBIM,
+ IPA_QCNCM,
+};
+
+/**
+ * enum ipa_dp_evt_type - type of event client callback is
+ * invoked for on data path
+ * @IPA_RECEIVE: data is struct sk_buff
+ * @IPA_WRITE_DONE: data is struct sk_buff
+ */
+enum ipa_dp_evt_type {
+ IPA_RECEIVE,
+ IPA_WRITE_DONE,
+};
+
+/**
+ * enum hdr_total_len_or_pad_type - type vof alue held by TOTAL_LEN_OR_PAD
+ * field in header configuration register.
+ * @IPA_HDR_PAD: field is used as padding length
+ * @IPA_HDR_TOTAL_LEN: field is used as total length
+ */
+enum hdr_total_len_or_pad_type {
+ IPA_HDR_PAD = 0,
+ IPA_HDR_TOTAL_LEN = 1,
+};
+
+/**
+ * struct ipa_ep_cfg_nat - NAT configuration in IPA end-point
+ * @nat_en: This defines the default NAT mode for the pipe: in case of
+ * filter miss - the default NAT mode defines the NATing operation
+ * on the packet. Valid for Input Pipes only (IPA consumer)
+ */
+struct ipa_ep_cfg_nat {
+ enum ipa_nat_en_type nat_en;
+};
+
+/**
+ * struct ipa_ep_cfg_hdr - header configuration in IPA end-point
+ *
+ * @hdr_len:Header length in bytes to be added/removed. Assuming
+ * header len is constant per endpoint. Valid for
+ * both Input and Output Pipes
+ * @hdr_ofst_metadata_valid: 0: Metadata_Ofst value is invalid, i.e., no
+ * metadata within header.
+ * 1: Metadata_Ofst value is valid, i.e., metadata
+ * within header is in offset Metadata_Ofst Valid
+ * for Input Pipes only (IPA Consumer) (for output
+ * pipes, metadata already set within the header)
+ * @hdr_ofst_metadata: Offset within header in which metadata resides
+ * Size of metadata - 4bytes
+ * Example - Stream ID/SSID/mux ID.
+ * Valid for Input Pipes only (IPA Consumer) (for output
+ * pipes, metadata already set within the header)
+ * @hdr_additional_const_len: Defines the constant length that should be added
+ * to the payload length in order for IPA to update
+ * correctly the length field within the header
+ * (valid only in case Hdr_Ofst_Pkt_Size_Valid=1)
+ * Valid for Output Pipes (IPA Producer)
+ * @hdr_ofst_pkt_size_valid: 0: Hdr_Ofst_Pkt_Size value is invalid, i.e., no
+ * length field within the inserted header
+ * 1: Hdr_Ofst_Pkt_Size value is valid, i.e., a
+ * packet length field resides within the header
+ * Valid for Output Pipes (IPA Producer)
+ * @hdr_ofst_pkt_size: Offset within header in which packet size reside. Upon
+ * Header Insertion, IPA will update this field within the
+ * header with the packet length . Assumption is that
+ * header length field size is constant and is 2Bytes
+ * Valid for Output Pipes (IPA Producer)
+ * @hdr_a5_mux: Determines whether A5 Mux header should be added to the packet.
+ * This bit is valid only when Hdr_En=01(Header Insertion)
+ * SW should set this bit for IPA-to-A5 pipes.
+ * 0: Do not insert A5 Mux Header
+ * 1: Insert A5 Mux Header
+ * Valid for Output Pipes (IPA Producer)
+ * @hdr_remove_additional: bool switch, remove more of the header
+ * based on the aggregation configuration (register
+ * HDR_LEN_INC_DEAGG_HDR)
+ * @hdr_metadata_reg_valid: bool switch, metadata from
+ * register INIT_HDR_METADATA_n is valid.
+ * (relevant only for IPA Consumer pipes)
+ */
+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 - extended header configuration in IPA end-point
+ * @hdr_pad_to_alignment: Pad packet to specified alignment
+ * (2^pad to alignment value), i.e. value of 3 means pad to 2^3 = 8 bytes
+ * alignment. Alignment is to 0,2 up to 32 bytes (IPAv2 does not support 64
+ * byte alignment). Valid for Output Pipes only (IPA Producer).
+ * @hdr_total_len_or_pad_offset: Offset to length field containing either
+ * total length or pad length, per hdr_total_len_or_pad config
+ * @hdr_payload_len_inc_padding: 0-IPA_ENDP_INIT_HDR_n's
+ * HDR_OFST_PKT_SIZE does
+ * not includes padding bytes size, payload_len = packet length,
+ * 1-IPA_ENDP_INIT_HDR_n's HDR_OFST_PKT_SIZE includes
+ * padding bytes size, payload_len = packet length + padding
+ * @hdr_total_len_or_pad: field is used as PAD length ot as Total length
+ * (header + packet + padding)
+ * @hdr_total_len_or_pad_valid: 0-Ignore TOTAL_LEN_OR_PAD field, 1-Process
+ * TOTAL_LEN_OR_PAD field
+ * @hdr_little_endian: 0-Big Endian, 1-Little Endian
+ */
+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_mode - mode configuration in IPA end-point
+ * @mode: Valid for Input Pipes only (IPA Consumer)
+ * @dst: This parameter specifies the output pipe to which the packets
+ * will be routed to.
+ * This parameter is valid for Mode=DMA and not valid for
+ * Mode=Basic
+ * Valid for Input Pipes only (IPA Consumer)
+ */
+struct ipa_ep_cfg_mode {
+ enum ipa_mode_type mode;
+ enum ipa_client_type dst;
+};
+
+/**
+ * struct ipa_ep_cfg_aggr - aggregation configuration in IPA end-point
+ *
+ * @aggr_en: Valid for both Input and Output Pipes
+ * @aggr: aggregation type (Valid for both Input and Output Pipes)
+ * @aggr_byte_limit: Limit of aggregated packet size in KB (<=32KB) When set
+ * to 0, there is no size limitation on the aggregation.
+ * When both, Aggr_Byte_Limit and Aggr_Time_Limit are set
+ * to 0, there is no aggregation, every packet is sent
+ * independently according to the aggregation structure
+ * Valid for Output Pipes only (IPA Producer )
+ * @aggr_time_limit: Timer to close aggregated packet (<=32ms) When set to 0,
+ * there is no time limitation on the aggregation. When
+ * both, Aggr_Byte_Limit and Aggr_Time_Limit are set to 0,
+ * there is no aggregation, every packet is sent
+ * independently according to the aggregation structure
+ * Valid for Output Pipes only (IPA Producer)
+ * @aggr_pkt_limit: Defines if EOF close aggregation or not. if set to false
+ * HW closes aggregation (sends EOT) only based on its
+ * aggregation config (byte/time limit, etc). if set to
+ * true EOF closes aggregation in addition to HW based
+ * aggregation closure. Valid for Output Pipes only (IPA
+ * Producer). EOF affects only Pipes configured for
+ * generic aggregation.
+ */
+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;
+};
+
+/**
+ * struct ipa_ep_cfg_route - route configuration in IPA end-point
+ * @rt_tbl_hdl: Defines the default routing table index to be used in case there
+ * is no filter rule matching, valid for Input Pipes only (IPA
+ * Consumer). Clients should set this to 0 which will cause default
+ * v4 and v6 routes setup internally by IPA driver to be used for
+ * this end-point
+ */
+struct ipa_ep_cfg_route {
+ u32 rt_tbl_hdl;
+};
+
+/**
+ * struct ipa_ep_cfg_holb - head of line blocking configuration in IPA end-point
+ * @en: enable(1 => ok to drop pkt)/disable(0 => never drop pkt)
+ * @tmr_val: duration in units of 128 IPA clk clock cyles [0,511], 1 clk=1.28us
+ * IPAv2.5 support 32 bit HOLB timeout value, previous versions
+ * supports 16 bit
+ */
+struct ipa_ep_cfg_holb {
+ u16 en;
+ u32 tmr_val;
+};
+
+/**
+ * struct ipa_ep_cfg_deaggr - deaggregation configuration in IPA end-point
+ * @deaggr_hdr_len: Deaggregation Header length in bytes. Valid only for Input
+ * Pipes, which are configured for 'Generic' deaggregation.
+ * @packet_offset_valid: - 0: PACKET_OFFSET is not used, 1: PACKET_OFFSET is
+ * used.
+ * @packet_offset_location: Location of packet offset field, which specifies
+ * the offset to the packet from the start of the packet offset field.
+ * @max_packet_len: DEAGGR Max Packet Length in Bytes. A Packet with higher
+ * size wil be treated as an error. 0 - Packet Length is not Bound,
+ * IPA should not check for a Max Packet Length.
+ */
+struct ipa_ep_cfg_deaggr {
+ u32 deaggr_hdr_len;
+ bool packet_offset_valid;
+ u32 packet_offset_location;
+ u32 max_packet_len;
+};
+
+/**
+ * enum ipa_cs_offload - checksum offload setting
+ */
+enum ipa_cs_offload {
+ IPA_DISABLE_CS_OFFLOAD,
+ IPA_ENABLE_CS_OFFLOAD_UL,
+ IPA_ENABLE_CS_OFFLOAD_DL,
+ IPA_CS_RSVD
+};
+
+/**
+ * struct ipa_ep_cfg_cfg - IPA ENDP_INIT Configuration register
+ * @frag_offload_en: - 0 - IP packet fragment handling is disabled. IP packet
+ * fragments should be sent to SW. SW is responsible for
+ * configuring filter rules, and IP packet filter exception should be
+ * used to send all fragments to SW. 1 - IP packet fragment
+ * handling is enabled. IPA checks for fragments and uses frag
+ * rules table for processing fragments. Valid only for Input Pipes
+ * (IPA Consumer)
+ * @cs_offload_en: Checksum offload enable: 00: Disable checksum offload, 01:
+ * Enable checksum calculation offload (UL) - For output pipe
+ * (IPA producer) specifies that checksum trailer is to be added.
+ * For input pipe (IPA consumer) specifies presence of checksum
+ * header and IPA checksum calculation accordingly. 10: Enable
+ * checksum calculation offload (DL) - For output pipe (IPA
+ * producer) specifies that checksum trailer is to be added. For
+ * input pipe (IPA consumer) specifies IPA checksum calculation.
+ * 11: Reserved
+ * @cs_metadata_hdr_offset: Offset in Words (4 bytes) within header in which
+ * checksum meta info header (4 bytes) starts (UL). Values are 0-15, which
+ * mean 0 - 60 byte checksum header offset. Valid for input
+ * pipes only (IPA consumer)
+ */
+struct ipa_ep_cfg_cfg {
+ bool frag_offload_en;
+ enum ipa_cs_offload cs_offload_en;
+ u8 cs_metadata_hdr_offset;
+};
+
+/**
+ * struct ipa_ep_cfg_metadata_mask - Endpoint initialization hdr metadata mask
+ * @metadata_mask: Mask specifying which metadata bits to write to
+ * IPA_ENDP_INIT_HDR_n.s HDR_OFST_METADATA. Only
+ * masked metadata bits (set to 1) will be written. Valid for Output
+ * Pipes only (IPA Producer)
+ */
+struct ipa_ep_cfg_metadata_mask {
+ u32 metadata_mask;
+};
+
+/**
+ * struct ipa_ep_cfg_metadata - Meta Data configuration in IPA end-point
+ * @md: This defines the meta data from tx data descriptor
+ * @qmap_id: qmap id
+ */
+struct ipa_ep_cfg_metadata {
+ u32 qmap_id;
+};
+
+/**
+ * struct ipa_ep_cfg - configuration of IPA end-point
+ * @nat: NAT parmeters
+ * @hdr: Header parameters
+ * @hdr_ext: Extended header parameters
+ * @mode: Mode parameters
+ * @aggr: Aggregation parameters
+ * @deaggr: Deaggregation params
+ * @route: Routing parameters
+ * @cfg: Configuration register data
+ * @metadata_mask: Hdr metadata mask
+ * @meta: Meta Data
+ */
+struct ipa_ep_cfg {
+ struct ipa_ep_cfg_nat nat;
+ 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_ctrl - Control configuration in IPA end-point
+ * @ipa_ep_suspend: 0 - ENDP is enabled, 1 - ENDP is suspended (disabled).
+ * Valid for PROD Endpoints
+ * @ipa_ep_delay: 0 - ENDP is free-running, 1 - ENDP is delayed.
+ * SW controls the data flow of an endpoint usind this bit.
+ * Valid for CONS Endpoints
+ */
+struct ipa_ep_cfg_ctrl {
+ bool ipa_ep_suspend;
+ bool ipa_ep_delay;
+};
+
+/**
+ * x should be in bytes
+ */
+#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);
+
+/**
+ * struct ipa_connect_params - low-level client connect input parameters. Either
+ * client allocates the data and desc FIFO and specifies that in data+desc OR
+ * specifies sizes and pipe_mem pref and IPA does the allocation.
+ *
+ * @ipa_ep_cfg: IPA EP configuration
+ * @client: type of "client"
+ * @client_bam_hdl: client SPS handle
+ * @client_ep_idx: client PER EP index
+ * @priv: callback cookie
+ * @notify: callback
+ * priv - callback cookie evt - type of event data - data relevant
+ * to event. May not be valid. See event_type enum for valid
+ * cases.
+ * @desc_fifo_sz: size of desc FIFO
+ * @data_fifo_sz: size of data FIFO
+ * @pipe_mem_preferred: if true, try to alloc the FIFOs in pipe mem, fallback
+ * to sys mem if pipe mem alloc fails
+ * @desc: desc FIFO meta-data when client has allocated it
+ * @data: data FIFO meta-data when client has allocated it
+ * @skip_ep_cfg: boolean field that determines if EP should be configured
+ * by IPA driver
+ * @keep_ipa_awake: when true, IPA will not be clock gated
+ */
+struct ipa_connect_params {
+ struct ipa_ep_cfg ipa_ep_cfg;
+ enum ipa_client_type client;
+ unsigned long client_bam_hdl;
+ u32 client_ep_idx;
+ void *priv;
+ ipa_notify_cb notify;
+ u32 desc_fifo_sz;
+ u32 data_fifo_sz;
+ bool pipe_mem_preferred;
+ struct sps_mem_buffer desc;
+ struct sps_mem_buffer data;
+ bool skip_ep_cfg;
+ bool keep_ipa_awake;
+};
+
+/**
+ * struct ipa_sps_params - SPS related output parameters resulting from
+ * low/high level client connect
+ * @ipa_bam_hdl: IPA SPS handle
+ * @ipa_ep_idx: IPA PER EP index
+ * @desc: desc FIFO meta-data
+ * @data: data FIFO meta-data
+ */
+struct ipa_sps_params {
+ unsigned long ipa_bam_hdl;
+ u32 ipa_ep_idx;
+ struct sps_mem_buffer desc;
+ struct sps_mem_buffer data;
+};
+
+/**
+ * struct ipa_tx_intf - interface tx properties
+ * @num_props: number of tx properties
+ * @prop: the tx properties array
+ */
+struct ipa_tx_intf {
+ u32 num_props;
+ struct ipa_ioc_tx_intf_prop *prop;
+};
+
+/**
+ * struct ipa_rx_intf - interface rx properties
+ * @num_props: number of rx properties
+ * @prop: the rx properties array
+ */
+struct ipa_rx_intf {
+ u32 num_props;
+ struct ipa_ioc_rx_intf_prop *prop;
+};
+
+/**
+ * struct ipa_ext_intf - interface ext properties
+ * @excp_pipe_valid: is next field valid?
+ * @excp_pipe: exception packets should be routed to this pipe
+ * @num_props: number of ext properties
+ * @prop: the ext properties array
+ */
+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 - information needed to setup an IPA end-point
+ * in system-BAM mode
+ * @ipa_ep_cfg: IPA EP configuration
+ * @client: the type of client who "owns" the EP
+ * @desc_fifo_sz: size of desc FIFO
+ * @priv: callback cookie
+ * @notify: callback
+ * priv - callback cookie
+ * evt - type of event
+ * data - data relevant to event. May not be valid. See event_type
+ * enum for valid cases.
+ * @skip_ep_cfg: boolean field that determines if EP should be configured
+ * by IPA driver
+ * @keep_ipa_awake: when true, IPA will not be clock gated
+ */
+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 ipa_tx_meta - meta-data for the TX packet
+ * @dma_address: dma mapped address of TX packet
+ * @dma_address_valid: is above field valid?
+ */
+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 ipa_msg_free_fn - callback function
+ * @param buff - [in] the message payload to free
+ * @param len - [in] size of message payload
+ * @param type - [in] the message type
+ *
+ * Message callback registered by kernel client with IPA driver to
+ * free message payload after IPA driver processing is complete
+ *
+ * No return value
+ */
+typedef void (*ipa_msg_free_fn)(void *buff, u32 len, u32 type);
+
+/**
+ * typedef ipa_msg_pull_fn - callback function
+ * @param buff - [in] where to copy message payload
+ * @param len - [in] size of buffer to copy payload into
+ * @param type - [in] the message type
+ *
+ * Message callback registered by kernel client with IPA driver for
+ * IPA driver to pull messages from the kernel client upon demand from
+ * user-space
+ *
+ * Returns how many bytes were copied into the buffer.
+ */
+typedef int (*ipa_msg_pull_fn)(void *buff, u32 len, u32 type);
+
+/**
+ * enum ipa_voltage_level - IPA Voltage levels
+ */
+enum ipa_voltage_level {
+ IPA_VOLTAGE_UNSPECIFIED,
+ IPA_VOLTAGE_SVS = IPA_VOLTAGE_UNSPECIFIED,
+ IPA_VOLTAGE_NOMINAL,
+ IPA_VOLTAGE_TURBO,
+ IPA_VOLTAGE_MAX,
+};
+
+/**
+ * enum ipa_rm_event - IPA RM events
+ *
+ * Indicate the resource state change
+ */
+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 - information needed to
+ * register IPA RM client with IPA RM
+ *
+ * @user_data: IPA RM client provided information
+ * to be passed to notify_cb callback below
+ * @notify_cb: callback which is called by resource
+ * to notify the IPA RM client about its state
+ * change IPA RM client is expected to perform non
+ * blocking operations only in notify_cb and
+ * release notification context as soon as
+ * possible.
+ */
+struct ipa_rm_register_params {
+ void *user_data;
+ ipa_rm_notify_cb notify_cb;
+};
+
+/**
+ * struct ipa_rm_create_params - information needed to initialize
+ * the resource
+ * @name: resource name
+ * @floor_voltage: floor voltage needed for client to operate in maximum
+ * bandwidth.
+ * @reg_params: register parameters, contains are ignored
+ * for consumer resource NULL should be provided
+ * for consumer resource
+ * @request_resource: function which should be called to request resource,
+ * NULL should be provided for producer resource
+ * @release_resource: function which should be called to release resource,
+ * NULL should be provided for producer resource
+ *
+ * IPA RM client is expected to perform non blocking operations only
+ * in request_resource and release_resource functions and
+ * release notification context as soon as possible.
+ */
+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 - information regarding IPA RM client performance
+ * profile
+ *
+ * @max_bandwidth_mbps: maximum bandwidth need of the client in Mbps
+ */
+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_"
+
+/**
+ * enum teth_tethering_mode - Tethering mode (Rmnet / MBIM)
+ */
+enum teth_tethering_mode {
+ TETH_TETHERING_MODE_RMNET,
+ TETH_TETHERING_MODE_MBIM,
+ TETH_TETHERING_MODE_MAX,
+};
+
+/**
+ * teth_bridge_init_params - Parameters used for in/out USB API
+ * @usb_notify_cb: Callback function which should be used by the caller.
+ * Output parameter.
+ * @private_data: Data for the callback function. Should be used by the
+ * caller. Output parameter.
+ * @skip_ep_cfg: boolean field that determines if Apps-processor
+ * should or should not confiugre this end-point.
+ */
+struct teth_bridge_init_params {
+ ipa_notify_cb usb_notify_cb;
+ void *private_data;
+ enum ipa_client_type client;
+ bool skip_ep_cfg;
+};
+
+/**
+ * struct teth_bridge_connect_params - Parameters used in teth_bridge_connect()
+ * @ipa_usb_pipe_hdl: IPA to USB pipe handle, returned from ipa_connect()
+ * @usb_ipa_pipe_hdl: USB to IPA pipe handle, returned from ipa_connect()
+ * @tethering_mode: Rmnet or MBIM
+ * @ipa_client_type: IPA "client" name (IPA_CLIENT_USB#_PROD)
+ */
+struct teth_bridge_connect_params {
+ u32 ipa_usb_pipe_hdl;
+ u32 usb_ipa_pipe_hdl;
+ enum teth_tethering_mode tethering_mode;
+ enum ipa_client_type client_type;
+};
+
+/**
+ * struct ipa_tx_data_desc - information needed
+ * to send data packet to HW link: link to data descriptors
+ * priv: client specific private data
+ * @pyld_buffer: pointer to the data buffer that holds frame
+ * @pyld_len: length of the data packet
+ */
+struct ipa_tx_data_desc {
+ struct list_head link;
+ void *priv;
+ void *pyld_buffer;
+ u16 pyld_len;
+};
+
+/**
+ * struct ipa_rx_data - information needed
+ * to send to wlan driver on receiving data from ipa hw
+ * @skb: skb
+ * @dma_addr: DMA address of this Rx packet
+ */
+struct ipa_rx_data {
+ struct sk_buff *skb;
+ dma_addr_t dma_addr;
+};
+
+/**
+ * enum ipa_irq_type - IPA Interrupt Type
+ * Used to register handlers for IPA interrupts
+ *
+ * Below enum is a logical mapping and not the actual interrupt bit in HW
+ */
+enum ipa_irq_type {
+ IPA_BAD_SNOC_ACCESS_IRQ,
+ IPA_EOT_COAL_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_UC_TX_CMD_Q_NOT_FULL_IRQ,
+ IPA_UC_TO_PROC_ACK_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_IDLE_IRQ,
+ IPA_IRQ_MAX
+};
+
+/**
+ * struct ipa_tx_suspend_irq_data - interrupt data for IPA_TX_SUSPEND_IRQ
+ * @endpoints: bitmask of endpoints which case IPA_TX_SUSPEND_IRQ interrupt
+ * @dma_addr: DMA address of this Rx packet
+ */
+struct ipa_tx_suspend_irq_data {
+ u32 endpoints;
+};
+
+
+/**
+ * typedef ipa_irq_handler_t - irq handler/callback type
+ * @param ipa_irq_type - [in] interrupt type
+ * @param private_data - [in, out] the client private data
+ * @param interrupt_data - [out] interrupt information data
+ *
+ * callback registered by ipa_add_interrupt_handler function to
+ * handle a specific interrupt type
+ *
+ * No return value
+ */
+typedef void (*ipa_irq_handler_t)(enum ipa_irq_type interrupt,
+ void *private_data,
+ void *interrupt_data);
+
+/**
+ * struct IpaHwBamStats_t - Strucuture holding the BAM statistics
+ *
+ * @bamFifoFull : Number of times Bam Fifo got full - For In Ch: Good,
+ * For Out Ch: Bad
+ * @bamFifoEmpty : Number of times Bam Fifo got empty - For In Ch: Bad,
+ * For Out Ch: Good
+ * @bamFifoUsageHigh : Number of times Bam fifo usage went above 75% -
+ * For In Ch: Good, For Out Ch: Bad
+ * @bamFifoUsageLow : Number of times Bam fifo usage went below 25% -
+ * For In Ch: Bad, For Out Ch: Good
+*/
+struct IpaHwBamStats_t {
+ u32 bamFifoFull;
+ u32 bamFifoEmpty;
+ u32 bamFifoUsageHigh;
+ u32 bamFifoUsageLow;
+ u32 bamUtilCount;
+} __packed;
+
+/**
+ * struct IpaHwRingStats_t - Strucuture holding the Ring statistics
+ *
+ * @ringFull : Number of times Transfer Ring got full - For In Ch: Good,
+ * For Out Ch: Bad
+ * @ringEmpty : Number of times Transfer Ring got empty - For In Ch: Bad,
+ * For Out Ch: Good
+ * @ringUsageHigh : Number of times Transfer Ring usage went above 75% -
+ * For In Ch: Good, For Out Ch: Bad
+ * @ringUsageLow : Number of times Transfer Ring usage went below 25% -
+ * For In Ch: Bad, For Out Ch: Good
+*/
+struct IpaHwRingStats_t {
+ u32 ringFull;
+ u32 ringEmpty;
+ u32 ringUsageHigh;
+ u32 ringUsageLow;
+ u32 RingUtilCount;
+} __packed;
+
+/**
+ * struct IpaHwStatsWDIRxInfoData_t - Structure holding the WDI Rx channel
+ * structures
+ *
+ * @max_outstanding_pkts : Number of outstanding packets in Rx Ring
+ * @num_pkts_processed : Number of packets processed - cumulative
+ * @rx_ring_rp_value : Read pointer last advertized to the WLAN FW
+ * @rx_ind_ring_stats : Ring info
+ * @bam_stats : BAM info
+ * @num_bam_int_handled : Number of Bam Interrupts handled by FW
+ * @num_db : Number of times the doorbell was rung
+ * @num_unexpected_db : Number of unexpected doorbells
+ * @num_pkts_in_dis_uninit_state : number of completions we
+ * received in disabled or uninitialized state
+ * @num_ic_inj_vdev_change : Number of times the Imm Cmd is
+ * injected due to vdev_id change
+ * @num_ic_inj_fw_desc_change : Number of times the Imm Cmd is
+ * injected due to fw_desc change
+*/
+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 reserved1;
+ u32 reserved2;
+} __packed;
+
+/**
+ * struct IpaHwStatsWDITxInfoData_t - Structure holding the WDI Tx channel
+ * structures
+ *
+ * @num_pkts_processed : Number of packets processed - cumulative
+ * @copy_engine_doorbell_value : latest value of doorbell written to copy engine
+ * @num_db_fired : Number of DB from uC FW to Copy engine
+ * @tx_comp_ring_stats : ring info
+ * @bam_stats : BAM info
+ * @num_db : Number of times the doorbell was rung
+ * @num_unexpected_db : Number of unexpected doorbells
+ * @num_bam_int_handled : Number of Bam Interrupts handled by FW
+ * @num_bam_int_in_non_running_state : Number of Bam interrupts while not in
+ * Running state
+ * @num_qmb_int_handled : Number of QMB interrupts handled
+*/
+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_runnning_state;
+ u32 num_qmb_int_handled;
+ u32 num_bam_int_handled_while_wait_for_bam;
+} __packed;
+
+/**
+ * struct IpaHwStatsWDIInfoData_t - Structure holding the WDI channel structures
+ *
+ * @rx_ch_stats : RX stats
+ * @tx_ch_stats : TX stats
+*/
+struct IpaHwStatsWDIInfoData_t {
+ struct IpaHwStatsWDIRxInfoData_t rx_ch_stats;
+ struct IpaHwStatsWDITxInfoData_t tx_ch_stats;
+} __packed;
+
+
+/**
+ * struct ipa_wdi_ul_params - WDI_RX configuration
+ * @rdy_ring_base_pa: physical address of the base of the Rx ring (containing
+ * Rx buffers)
+ * @rdy_ring_size: size of the Rx ring in bytes
+ * @rdy_ring_rp_pa: physical address of the location through which IPA uc is
+ * expected to communicate about the Read pointer into the Rx Ring
+ */
+struct ipa_wdi_ul_params {
+ phys_addr_t rdy_ring_base_pa;
+ u32 rdy_ring_size;
+ phys_addr_t rdy_ring_rp_pa;
+};
+
+/**
+ * struct ipa_wdi_ul_params_smmu - WDI_RX configuration (with WLAN SMMU)
+ * @rdy_ring: SG table describing the Rx ring (containing Rx buffers)
+ * @rdy_ring_size: size of the Rx ring in bytes
+ * @rdy_ring_rp_pa: physical address of the location through which IPA uc is
+ * expected to communicate about the Read pointer into the Rx Ring
+ */
+struct ipa_wdi_ul_params_smmu {
+ struct sg_table rdy_ring;
+ u32 rdy_ring_size;
+ phys_addr_t rdy_ring_rp_pa;
+};
+
+/**
+ * struct ipa_wdi_dl_params - WDI_TX configuration
+ * @comp_ring_base_pa: physical address of the base of the Tx completion ring
+ * @comp_ring_size: size of the Tx completion ring in bytes
+ * @ce_ring_base_pa: physical address of the base of the Copy Engine Source
+ * Ring
+ * @ce_door_bell_pa: physical address of the doorbell that the IPA uC has to
+ * write into to trigger the copy engine
+ * @ce_ring_size: Copy Engine Ring size in bytes
+ * @num_tx_buffers: Number of pkt buffers allocated
+ */
+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;
+};
+
+/**
+ * struct ipa_wdi_dl_params_smmu - WDI_TX configuration (with WLAN SMMU)
+ * @comp_ring: SG table describing the Tx completion ring
+ * @comp_ring_size: size of the Tx completion ring in bytes
+ * @ce_ring: SG table describing the Copy Engine Source Ring
+ * @ce_door_bell_pa: physical address of the doorbell that the IPA uC has to
+ * write into to trigger the copy engine
+ * @ce_ring_size: Copy Engine Ring size in bytes
+ * @num_tx_buffers: Number of pkt buffers allocated
+ */
+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;
+};
+
+/**
+ * struct ipa_wdi_in_params - information provided by WDI client
+ * @sys: IPA EP configuration info
+ * @ul: WDI_RX configuration info
+ * @dl: WDI_TX configuration info
+ * @ul_smmu: WDI_RX configuration info when WLAN uses SMMU
+ * @dl_smmu: WDI_TX configuration info when WLAN uses SMMU
+ * @smmu_enabled: true if WLAN uses SMMU
+ */
+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;
+};
+
+/**
+ * struct ipa_wdi_out_params - information provided to WDI client
+ * @uc_door_bell_pa: physical address of IPA uc doorbell
+ * @clnt_hdl: opaque handle assigned to client
+ */
+struct ipa_wdi_out_params {
+ phys_addr_t uc_door_bell_pa;
+ u32 clnt_hdl;
+};
+
+/**
+ * struct ipa_wdi_db_params - information provided to retrieve
+ * physical address of uC doorbell
+ * @client: type of "client" (IPA_CLIENT_WLAN#_PROD/CONS)
+ * @uc_door_bell_pa: physical address of IPA uc doorbell
+ */
+struct ipa_wdi_db_params {
+ enum ipa_client_type client;
+ phys_addr_t uc_door_bell_pa;
+};
+
+/**
+ * struct ipa_wdi_uc_ready_params - uC ready CB parameters
+ * @is_uC_ready: uC loaded or not
+ * @priv : callback cookie
+ * @notify: callback
+ */
+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 - address info of a WLAN allocated buffer
+ * @pa: physical address of the buffer
+ * @iova: IOVA of the buffer as embedded inside the WDI descriptors
+ * @size: size in bytes of the buffer
+ * @result: result of map or unmap operations (out param)
+ *
+ * IPA driver will create/release IOMMU mapping in IPA SMMU from iova->pa
+ */
+struct ipa_wdi_buffer_info {
+ phys_addr_t pa;
+ unsigned long iova;
+ size_t size;
+ int result;
+};
+
+/**
+ * struct odu_bridge_params - parameters for odu bridge initialization API
+ *
+ * @netdev_name: network interface name
+ * @priv: private data that will be supplied to client's callback
+ * @tx_dp_notify: callback for handling SKB. the following event are supported:
+ * IPA_WRITE_DONE: will be called after client called to odu_bridge_tx_dp()
+ * Client is expected to free the skb.
+ * IPA_RECEIVE: will be called for delivering skb to APPS.
+ * Client is expected to deliver the skb to network stack.
+ * @send_dl_skb: callback for sending skb on downlink direction to adapter.
+ * Client is expected to free the skb.
+ * @device_ethaddr: device Ethernet address in network order.
+ * @ipa_desc_size: IPA Sys Pipe Desc Size
+ */
+struct odu_bridge_params {
+ const char *netdev_name;
+ void *priv;
+ ipa_notify_cb tx_dp_notify;
+ int (*send_dl_skb)(void *priv, struct sk_buff *skb);
+ u8 device_ethaddr[ETH_ALEN];
+ u32 ipa_desc_size;
+};
+
+/**
+ * enum ipa_mhi_event_type - event type for mhi callback
+ *
+ * @IPA_MHI_EVENT_READY: IPA MHI is ready and IPA uC is loaded. After getting
+ * this event MHI client is expected to call to ipa_mhi_start() API
+ * @IPA_MHI_EVENT_DATA_AVAILABLE: downlink data available on MHI channel
+ */
+enum ipa_mhi_event_type {
+ IPA_MHI_EVENT_READY,
+ IPA_MHI_EVENT_DATA_AVAILABLE,
+ IPA_MHI_EVENT_MAX,
+};
+
+typedef void (*mhi_client_cb)(void *priv, enum ipa_mhi_event_type event,
+ unsigned long data);
+
+/**
+ * struct ipa_mhi_msi_info - parameters for MSI (Message Signaled Interrupts)
+ * @addr_low: MSI lower base physical address
+ * @addr_hi: MSI higher base physical address
+ * @data: Data Pattern to use when generating the MSI
+ * @mask: Mask indicating number of messages assigned by the host to device
+ *
+ * msi value is written according to this formula:
+ * ((data & ~mask) | (mmio.msiVec & mask))
+ */
+struct ipa_mhi_msi_info {
+ u32 addr_low;
+ u32 addr_hi;
+ u32 data;
+ u32 mask;
+};
+
+/**
+ * struct ipa_mhi_init_params - parameters for IPA MHI initialization API
+ *
+ * @msi: MSI (Message Signaled Interrupts) parameters
+ * @mmio_addr: MHI MMIO physical address
+ * @first_ch_idx: First channel ID for hardware accelerated channels.
+ * @first_er_idx: First event ring ID for hardware accelerated channels.
+ * @assert_bit40: should assert bit 40 in order to access hots space.
+ * if PCIe iATU is configured then not need to assert bit40
+ * @notify: client callback
+ * @priv: client private data to be provided in client callback
+ * @test_mode: flag to indicate if IPA MHI is in unit test mode
+ */
+struct ipa_mhi_init_params {
+ struct ipa_mhi_msi_info msi;
+ u32 mmio_addr;
+ u32 first_ch_idx;
+ u32 first_er_idx;
+ bool assert_bit40;
+ mhi_client_cb notify;
+ void *priv;
+ bool test_mode;
+};
+
+/**
+ * struct ipa_mhi_start_params - parameters for IPA MHI start API
+ *
+ * @host_ctrl_addr: Base address of MHI control data structures
+ * @host_data_addr: Base address of MHI data buffers
+ * @channel_context_addr: channel context array address in host address space
+ * @event_context_addr: event context array address in host address space
+ */
+struct ipa_mhi_start_params {
+ u32 host_ctrl_addr;
+ u32 host_data_addr;
+ u64 channel_context_array_addr;
+ u64 event_context_array_addr;
+};
+
+/**
+ * struct ipa_mhi_connect_params - parameters for IPA MHI channel connect API
+ *
+ * @sys: IPA EP configuration info
+ * @channel_id: MHI channel id
+ */
+struct ipa_mhi_connect_params {
+ struct ipa_sys_connect_params sys;
+ u8 channel_id;
+};
+
+/* bit #40 in address should be asserted for MHI transfers over pcie */
+#define IPA_MHI_HOST_ADDR(addr) ((addr) | BIT_ULL(40))
+
+/**
+ * struct ipa_gsi_ep_config - IPA GSI endpoint configurations
+ *
+ * @ipa_ep_num: IPA EP pipe number
+ * @ipa_gsi_chan_num: GSI channel number
+ * @ipa_if_tlv: number of IPA_IF TLV
+ * @ipa_if_aos: number of IPA_IF AOS
+ * @ee: Execution environment
+ */
+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 ipa_usb_teth_prot {
+ IPA_USB_RNDIS = 0,
+ IPA_USB_ECM = 1,
+ IPA_USB_RMNET = 2,
+ IPA_USB_MBIM = 3,
+ IPA_USB_DIAG = 4,
+ IPA_USB_MAX_TETH_PROT_SIZE
+};
+
+/**
+ * ipa_usb_teth_params - parameters for RDNIS/ECM initialization API
+ *
+ * @host_ethaddr: host Ethernet address in network order
+ * @device_ethaddr: device Ethernet address in network order
+ */
+struct ipa_usb_teth_params {
+ u8 host_ethaddr[ETH_ALEN];
+ u8 device_ethaddr[ETH_ALEN];
+};
+
+enum ipa_usb_notify_event {
+ IPA_USB_DEVICE_READY,
+ IPA_USB_REMOTE_WAKEUP,
+ IPA_USB_SUSPEND_COMPLETED
+};
+
+enum ipa_usb_max_usb_packet_size {
+ IPA_USB_HIGH_SPEED_512B = 512,
+ IPA_USB_SUPER_SPEED_1024B = 1024
+};
+
+/**
+ * ipa_usb_xdci_chan_scratch - xDCI protocol SW config area of
+ * channel scratch
+ *
+ * @last_trb_addr: Address (LSB - based on alignment restrictions) of
+ * last TRB in queue. Used to identify roll over case
+ * @const_buffer_size: TRB buffer size in KB (similar to IPA aggregation
+ * configuration). Must be aligned to max USB Packet Size.
+ * Should be 1 <= const_buffer_size <= 31.
+ * @depcmd_low_addr: Used to generate "Update Transfer" command
+ * @depcmd_hi_addr: Used to generate "Update Transfer" command.
+ */
+struct ipa_usb_xdci_chan_scratch {
+ u16 last_trb_addr;
+ u8 const_buffer_size;
+ u32 depcmd_low_addr;
+ u8 depcmd_hi_addr;
+};
+
+/**
+ * ipa_usb_xdci_chan_params - xDCI channel related properties
+ *
+ * @client: type of "client"
+ * @ipa_ep_cfg: IPA EP configuration
+ * @keep_ipa_awake: when true, IPA will not be clock gated
+ * @teth_prot: tethering protocol for which the channel is created
+ * @gevntcount_low_addr: GEVNCOUNT low address for event scratch
+ * @gevntcount_hi_addr: GEVNCOUNT high address for event scratch
+ * @dir: channel direction
+ * @xfer_ring_len: length of transfer ring in bytes (must be integral
+ * multiple of transfer element size - 16B for xDCI)
+ * @xfer_ring_base_addr: physical base address of transfer ring. Address must be
+ * aligned to xfer_ring_len rounded to power of two
+ * @xfer_scratch: parameters for xDCI channel scratch
+ *
+ */
+struct ipa_usb_xdci_chan_params {
+ /* IPA EP params */
+ enum ipa_client_type client;
+ struct ipa_ep_cfg ipa_ep_cfg;
+ bool keep_ipa_awake;
+ enum ipa_usb_teth_prot teth_prot;
+ /* event ring params */
+ u32 gevntcount_low_addr;
+ u8 gevntcount_hi_addr;
+ /* transfer ring params */
+ enum gsi_chan_dir dir;
+ u16 xfer_ring_len;
+ u64 xfer_ring_base_addr;
+ struct ipa_usb_xdci_chan_scratch xfer_scratch;
+};
+
+/**
+ * ipa_usb_chan_out_params - out parameters for channel request
+ *
+ * @clnt_hdl: opaque client handle assigned by IPA to client
+ * @db_reg_phs_addr_lsb: Physical address of doorbell register where the 32
+ * LSBs of the doorbell value should be written
+ * @db_reg_phs_addr_msb: Physical address of doorbell register where the 32
+ * MSBs of the doorbell value should be written
+ *
+ */
+struct ipa_req_chan_out_params {
+ u32 clnt_hdl;
+ u32 db_reg_phs_addr_lsb;
+ u32 db_reg_phs_addr_msb;
+};
+
+/**
+ * ipa_usb_teth_prot_params - parameters for connecting RNDIS
+ *
+ * @max_xfer_size_bytes_to_dev: max size of UL packets in bytes
+ * @max_packet_number_to_dev: max number of UL aggregated packets
+ * @max_xfer_size_bytes_to_host: max size of DL packets in bytes
+ *
+ */
+struct ipa_usb_teth_prot_params {
+ u32 max_xfer_size_bytes_to_dev;
+ u32 max_packet_number_to_dev;
+ u32 max_xfer_size_bytes_to_host;
+};
+
+/**
+ * ipa_usb_xdci_connect_params - parameters required to start IN, OUT
+ * channels, and connect RNDIS/ECM/teth_bridge
+ *
+ * @max_pkt_size: high speed or full speed
+ * @ipa_to_usb_xferrscidx: Transfer Resource Index (XferRscIdx) for IN channel.
+ * The hardware-assigned transfer resource index for the
+ * transfer, which was returned in response to the
+ * Start Transfer command. This field is used for
+ * "Update Transfer" command.
+ * Should be 0 =< ipa_to_usb_xferrscidx <= 127.
+ * @ipa_to_usb_xferrscidx_valid: true if xferRscIdx should be updated for IN
+ * channel
+ * @usb_to_ipa_xferrscidx: Transfer Resource Index (XferRscIdx) for OUT channel
+ * Should be 0 =< usb_to_ipa_xferrscidx <= 127.
+ * @usb_to_ipa_xferrscidx_valid: true if xferRscIdx should be updated for OUT
+ * channel
+ * @teth_prot: tethering protocol
+ * @teth_prot_params: parameters for connecting the tethering protocol.
+ * @max_supported_bandwidth_mbps: maximum bandwidth need of the client in Mbps
+ */
+struct ipa_usb_xdci_connect_params {
+ enum ipa_usb_max_usb_packet_size max_pkt_size;
+ u8 ipa_to_usb_xferrscidx;
+ bool ipa_to_usb_xferrscidx_valid;
+ u8 usb_to_ipa_xferrscidx;
+ bool usb_to_ipa_xferrscidx_valid;
+ enum ipa_usb_teth_prot teth_prot;
+ struct ipa_usb_teth_prot_params teth_prot_params;
+ u32 max_supported_bandwidth_mbps;
+};
+
+#if defined CONFIG_IPA || defined CONFIG_IPA3
+
+/*
+ * Connect / Disconnect
+ */
+int ipa_connect(const struct ipa_connect_params *in, struct ipa_sps_params *sps,
+ u32 *clnt_hdl);
+int ipa_disconnect(u32 clnt_hdl);
+
+/*
+ * Resume / Suspend
+ */
+int ipa_reset_endpoint(u32 clnt_hdl);
+
+/*
+ * Remove ep delay
+ */
+int ipa_clear_endpoint_delay(u32 clnt_hdl);
+
+/*
+ * Configuration
+ */
+int ipa_cfg_ep(u32 clnt_hdl, const struct ipa_ep_cfg *ipa_ep_cfg);
+
+int ipa_cfg_ep_nat(u32 clnt_hdl, const struct ipa_ep_cfg_nat *ipa_ep_cfg);
+
+int ipa_cfg_ep_hdr(u32 clnt_hdl, const struct ipa_ep_cfg_hdr *ipa_ep_cfg);
+
+int ipa_cfg_ep_hdr_ext(u32 clnt_hdl,
+ const struct ipa_ep_cfg_hdr_ext *ipa_ep_cfg);
+
+int ipa_cfg_ep_mode(u32 clnt_hdl, const struct ipa_ep_cfg_mode *ipa_ep_cfg);
+
+int ipa_cfg_ep_aggr(u32 clnt_hdl, const struct ipa_ep_cfg_aggr *ipa_ep_cfg);
+
+int ipa_cfg_ep_deaggr(u32 clnt_hdl,
+ const struct ipa_ep_cfg_deaggr *ipa_ep_cfg);
+
+int ipa_cfg_ep_route(u32 clnt_hdl, const struct ipa_ep_cfg_route *ipa_ep_cfg);
+
+int ipa_cfg_ep_holb(u32 clnt_hdl, const struct ipa_ep_cfg_holb *ipa_ep_cfg);
+
+int ipa_cfg_ep_cfg(u32 clnt_hdl, const struct ipa_ep_cfg_cfg *ipa_ep_cfg);
+
+int ipa_cfg_ep_metadata_mask(u32 clnt_hdl, const struct ipa_ep_cfg_metadata_mask
+ *ipa_ep_cfg);
+
+int ipa_cfg_ep_holb_by_client(enum ipa_client_type client,
+ const struct ipa_ep_cfg_holb *ipa_ep_cfg);
+
+int ipa_cfg_ep_ctrl(u32 clnt_hdl, const struct ipa_ep_cfg_ctrl *ep_ctrl);
+
+/*
+ * Header removal / addition
+ */
+int ipa_add_hdr(struct ipa_ioc_add_hdr *hdrs);
+
+int ipa_del_hdr(struct ipa_ioc_del_hdr *hdls);
+
+int ipa_commit_hdr(void);
+
+int ipa_reset_hdr(void);
+
+int ipa_get_hdr(struct ipa_ioc_get_hdr *lookup);
+
+int ipa_put_hdr(u32 hdr_hdl);
+
+int ipa_copy_hdr(struct ipa_ioc_copy_hdr *copy);
+
+/*
+ * Header Processing Context
+ */
+int ipa_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs);
+
+int ipa_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls);
+
+/*
+ * Routing
+ */
+int ipa_add_rt_rule(struct ipa_ioc_add_rt_rule *rules);
+
+int ipa_del_rt_rule(struct ipa_ioc_del_rt_rule *hdls);
+
+int ipa_commit_rt(enum ipa_ip_type ip);
+
+int ipa_reset_rt(enum ipa_ip_type ip);
+
+int ipa_get_rt_tbl(struct ipa_ioc_get_rt_tbl *lookup);
+
+int ipa_put_rt_tbl(u32 rt_tbl_hdl);
+
+int ipa_query_rt_index(struct ipa_ioc_get_rt_tbl_indx *in);
+
+int ipa_mdfy_rt_rule(struct ipa_ioc_mdfy_rt_rule *rules);
+
+/*
+ * Filtering
+ */
+int ipa_add_flt_rule(struct ipa_ioc_add_flt_rule *rules);
+
+int ipa_del_flt_rule(struct ipa_ioc_del_flt_rule *hdls);
+
+int ipa_mdfy_flt_rule(struct ipa_ioc_mdfy_flt_rule *rules);
+
+int ipa_commit_flt(enum ipa_ip_type ip);
+
+int ipa_reset_flt(enum ipa_ip_type ip);
+
+/*
+ * NAT
+ */
+int allocate_nat_device(struct ipa_ioc_nat_alloc_mem *mem);
+
+int ipa_nat_init_cmd(struct ipa_ioc_v4_nat_init *init);
+
+int ipa_nat_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma);
+
+int ipa_nat_del_cmd(struct ipa_ioc_v4_nat_del *del);
+
+/*
+ * Messaging
+ */
+int ipa_send_msg(struct ipa_msg_meta *meta, void *buff,
+ ipa_msg_free_fn callback);
+int ipa_register_pull_msg(struct ipa_msg_meta *meta, ipa_msg_pull_fn callback);
+int ipa_deregister_pull_msg(struct ipa_msg_meta *meta);
+
+/*
+ * Interface
+ */
+int ipa_register_intf(const char *name, const struct ipa_tx_intf *tx,
+ const struct ipa_rx_intf *rx);
+int ipa_register_intf_ext(const char *name, const struct ipa_tx_intf *tx,
+ const struct ipa_rx_intf *rx,
+ const struct ipa_ext_intf *ext);
+int ipa_deregister_intf(const char *name);
+
+/*
+ * Aggregation
+ */
+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);
+
+/*
+ * Data path
+ */
+int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
+ struct ipa_tx_meta *metadata);
+
+/*
+ * To transfer multiple data packets
+ * While passing the data descriptor list, the anchor node
+ * should be of type struct ipa_tx_data_desc not list_head
+*/
+int ipa_tx_dp_mul(enum ipa_client_type dst,
+ struct ipa_tx_data_desc *data_desc);
+
+void ipa_free_skb(struct ipa_rx_data *);
+
+/*
+ * System pipes
+ */
+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_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats);
+u16 ipa_get_smem_restr_bytes(void);
+/*
+ * To retrieve doorbell physical address of
+ * wlan pipes
+ */
+int ipa_uc_wdi_get_dbpa(struct ipa_wdi_db_params *out);
+
+/*
+ * To register uC ready callback if uC not ready
+ * and also check uC readiness
+ * if uC not ready only, register callback
+ */
+int ipa_uc_reg_rdyCB(struct ipa_wdi_uc_ready_params *param);
+
+int ipa_create_wdi_mapping(u32 num_buffers, struct ipa_wdi_buffer_info *info);
+int ipa_release_wdi_mapping(u32 num_buffers, struct ipa_wdi_buffer_info *info);
+
+/*
+ * Resource manager
+ */
+int ipa_rm_create_resource(struct ipa_rm_create_params *create_params);
+
+int ipa_rm_delete_resource(enum ipa_rm_resource_name resource_name);
+
+int ipa_rm_register(enum ipa_rm_resource_name resource_name,
+ struct ipa_rm_register_params *reg_params);
+
+int ipa_rm_deregister(enum ipa_rm_resource_name resource_name,
+ struct ipa_rm_register_params *reg_params);
+
+int ipa_rm_set_perf_profile(enum ipa_rm_resource_name resource_name,
+ struct ipa_rm_perf_profile *profile);
+
+int ipa_rm_add_dependency(enum ipa_rm_resource_name resource_name,
+ enum ipa_rm_resource_name depends_on_name);
+
+int ipa_rm_add_dependency_sync(enum ipa_rm_resource_name resource_name,
+ enum ipa_rm_resource_name depends_on_name);
+
+int ipa_rm_delete_dependency(enum ipa_rm_resource_name resource_name,
+ enum ipa_rm_resource_name depends_on_name);
+
+int ipa_rm_request_resource(enum ipa_rm_resource_name resource_name);
+
+int ipa_rm_release_resource(enum ipa_rm_resource_name resource_name);
+
+int ipa_rm_notify_completion(enum ipa_rm_event event,
+ enum ipa_rm_resource_name resource_name);
+
+int ipa_rm_inactivity_timer_init(enum ipa_rm_resource_name resource_name,
+ unsigned long msecs);
+
+int ipa_rm_inactivity_timer_destroy(enum ipa_rm_resource_name resource_name);
+
+int ipa_rm_inactivity_timer_request_resource(
+ enum ipa_rm_resource_name resource_name);
+
+int ipa_rm_inactivity_timer_release_resource(
+ enum ipa_rm_resource_name resource_name);
+
+/*
+ * Tethering bridge (Rmnet / MBIM)
+ */
+int teth_bridge_init(struct teth_bridge_init_params *params);
+
+int teth_bridge_disconnect(enum ipa_client_type client);
+
+int teth_bridge_connect(struct teth_bridge_connect_params *connect_params);
+
+/*
+ * Tethering client info
+ */
+void ipa_set_client(int index, enum ipacm_client_enum client, bool uplink);
+
+enum ipacm_client_enum ipa_get_client(int pipe_idx);
+
+bool ipa_get_client_uplink(int pipe_idx);
+
+/*
+ * ODU bridge
+ */
+
+int odu_bridge_init(struct odu_bridge_params *params);
+
+int odu_bridge_connect(void);
+
+int odu_bridge_disconnect(void);
+
+int odu_bridge_tx_dp(struct sk_buff *skb, struct ipa_tx_meta *metadata);
+
+int odu_bridge_cleanup(void);
+
+/*
+ * IPADMA
+ */
+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);
+
+int ipa_dma_uc_memcpy(phys_addr_t dest, phys_addr_t src, int len);
+
+void ipa_dma_destroy(void);
+
+/*
+ * MHI
+ */
+int ipa_mhi_init(struct ipa_mhi_init_params *params);
+
+int ipa_mhi_start(struct ipa_mhi_start_params *params);
+
+int ipa_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl);
+
+int ipa_mhi_disconnect_pipe(u32 clnt_hdl);
+
+int ipa_mhi_suspend(bool force);
+
+int ipa_mhi_resume(void);
+
+void ipa_mhi_destroy(void);
+
+/*
+ * IPA_USB
+ */
+
+/**
+ * ipa_usb_init_teth_prot - Peripheral should call this function to initialize
+ * RNDIS/ECM/teth_bridge, prior to calling ipa_usb_xdci_connect()
+ *
+ * @usb_teth_type: tethering protocol type
+ * @teth_params: pointer to tethering protocol parameters.
+ * Should be struct ipa_usb_teth_params for RNDIS/ECM,
+ * or NULL for teth_bridge
+ * @ipa_usb_notify_cb: will be called to notify USB driver on certain events
+ * @user_data: cookie used for ipa_usb_notify_cb
+ *
+ * @Return 0 on success, negative on failure
+ */
+int ipa_usb_init_teth_prot(enum ipa_usb_teth_prot teth_prot,
+ struct ipa_usb_teth_params *teth_params,
+ int (*ipa_usb_notify_cb)(enum ipa_usb_notify_event,
+ void *),
+ void *user_data);
+
+/**
+ * ipa_usb_xdci_connect - Peripheral should call this function to start IN &
+ * OUT xDCI channels, and connect RNDIS/ECM/MBIM/RMNET.
+ * For DIAG, only starts IN channel.
+ *
+ * @ul_chan_params: parameters for allocating UL xDCI channel. containing
+ * required info on event and transfer rings, and IPA EP
+ * configuration
+ * @ul_out_params: [out] opaque client handle assigned by IPA to client & DB
+ * registers physical address for UL channel
+ * @dl_chan_params: parameters for allocating DL xDCI channel. containing
+ * required info on event and transfer rings, and IPA EP
+ * configuration
+ * @dl_out_params: [out] opaque client handle assigned by IPA to client & DB
+ * registers physical address for DL channel
+ * @connect_params: handles and scratch params of the required channels,
+ * tethering protocol and the tethering protocol parameters.
+ *
+ * Note: Should not be called from atomic context
+ *
+ * @Return 0 on success, negative on failure
+ */
+int ipa_usb_xdci_connect(struct ipa_usb_xdci_chan_params *ul_chan_params,
+ struct ipa_usb_xdci_chan_params *dl_chan_params,
+ struct ipa_req_chan_out_params *ul_out_params,
+ struct ipa_req_chan_out_params *dl_out_params,
+ struct ipa_usb_xdci_connect_params *connect_params);
+
+/**
+ * ipa_usb_xdci_disconnect - Peripheral should call this function to stop
+ * IN & OUT xDCI channels
+ * For DIAG, only stops IN channel.
+ *
+ * @ul_clnt_hdl: client handle received from ipa_usb_xdci_connect()
+ * for OUT channel
+ * @dl_clnt_hdl: client handle received from ipa_usb_xdci_connect()
+ * for IN channel
+ * @teth_prot: tethering protocol
+ *
+ * Note: Should not be called from atomic context
+ *
+ * @Return 0 on success, negative on failure
+ */
+int ipa_usb_xdci_disconnect(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
+ enum ipa_usb_teth_prot teth_prot);
+
+/**
+ * ipa_usb_deinit_teth_prot - Peripheral should call this function to deinit
+ * RNDIS/ECM/MBIM/RMNET
+ *
+ * @teth_prot: tethering protocol
+ *
+ * @Return 0 on success, negative on failure
+ */
+int ipa_usb_deinit_teth_prot(enum ipa_usb_teth_prot teth_prot);
+
+/**
+ * ipa_usb_xdci_suspend - Peripheral should call this function to suspend
+ * IN & OUT xDCI channels
+ *
+ * @ul_clnt_hdl: client handle previously obtained from
+ * ipa_usb_xdci_connect() for OUT channel
+ * @dl_clnt_hdl: client handle previously obtained from
+ * ipa_usb_xdci_connect() for IN channel
+ * @teth_prot: tethering protocol
+ *
+ * Note: Should not be called from atomic context
+ *
+ * @Return 0 on success, negative on failure
+ */
+int ipa_usb_xdci_suspend(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
+ enum ipa_usb_teth_prot teth_prot);
+
+/**
+ * ipa_usb_xdci_resume - Peripheral should call this function to resume
+ * IN & OUT xDCI channels
+ *
+ * @ul_clnt_hdl: client handle received from ipa_usb_xdci_connect()
+ * for OUT channel
+ * @dl_clnt_hdl: client handle received from ipa_usb_xdci_connect()
+ * for IN channel
+ *
+ * Note: Should not be called from atomic context
+ *
+ * @Return 0 on success, negative on failure
+ */
+int ipa_usb_xdci_resume(u32 ul_clnt_hdl, u32 dl_clnt_hdl);
+
+/*
+ * mux id
+ */
+int ipa_write_qmap_id(struct ipa_ioc_write_qmapid *param_in);
+
+/*
+ * interrupts
+ */
+int ipa_add_interrupt_handler(enum ipa_irq_type interrupt,
+ ipa_irq_handler_t handler,
+ bool deferred_flag,
+ void *private_data);
+
+int ipa_remove_interrupt_handler(enum ipa_irq_type interrupt);
+
+int ipa_restore_suspend_handler(void);
+
+/*
+ * Miscellaneous
+ */
+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);
+
+enum ipa_hw_type ipa_get_hw_type(void);
+
+bool ipa_is_client_handle_valid(u32 clnt_hdl);
+
+enum ipa_client_type ipa_get_client_mapping(int pipe_idx);
+
+enum ipa_rm_resource_name ipa_get_rm_resource_from_ep(int pipe_idx);
+
+bool ipa_get_modem_cfg_emb_pipe_flt(void);
+
+enum ipa_transport_type ipa_get_transport_type(void);
+
+struct device *ipa_get_dma_dev(void);
+struct iommu_domain *ipa_get_smmu_domain(void);
+
+int ipa_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count);
+
+struct ipa_gsi_ep_config *ipa_get_gsi_ep_info(int ipa_ep_idx);
+
+int ipa_stop_gsi_channel(u32 clnt_hdl);
+
+typedef void (*ipa_ready_cb)(void *user_data);
+
+/**
+* ipa_register_ipa_ready_cb() - register a callback to be invoked
+* when IPA core driver initialization is complete.
+*
+* @ipa_ready_cb: CB to be triggered.
+* @user_data: Data to be sent to the originator of the CB.
+*
+* Note: This function is expected to be utilized when ipa_is_ready
+* function returns false.
+* An IPA client may also use this function directly rather than
+* calling ipa_is_ready beforehand, as if this API returns -EEXIST,
+* this means IPA initialization is complete (and no callback will
+* be triggered).
+* When the callback is triggered, the client MUST perform his
+* operations in a different context.
+*
+* The function will return 0 on success, -ENOMEM on memory issues and
+* -EEXIST if IPA initialization is complete already.
+*/
+int ipa_register_ipa_ready_cb(void (*ipa_ready_cb)(void *user_data),
+ void *user_data);
+
+#else /* (CONFIG_IPA || CONFIG_IPA3) */
+
+/*
+ * Connect / Disconnect
+ */
+static inline int ipa_connect(const struct ipa_connect_params *in,
+ struct ipa_sps_params *sps, u32 *clnt_hdl)
+{
+ return -EPERM;
+}
+
+static inline int ipa_disconnect(u32 clnt_hdl)
+{
+ return -EPERM;
+}
+
+/*
+ * Resume / Suspend
+ */
+static inline int ipa_reset_endpoint(u32 clnt_hdl)
+{
+ return -EPERM;
+}
+
+/*
+ * Remove ep delay
+ */
+static inline int ipa_clear_endpoint_delay(u32 clnt_hdl)
+{
+ return -EPERM;
+}
+
+/*
+ * Configuration
+ */
+static inline int ipa_cfg_ep(u32 clnt_hdl,
+ const struct ipa_ep_cfg *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_nat(u32 clnt_hdl,
+ const struct ipa_ep_cfg_nat *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_hdr(u32 clnt_hdl,
+ const struct ipa_ep_cfg_hdr *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_hdr_ext(u32 clnt_hdl,
+ const struct ipa_ep_cfg_hdr_ext *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_mode(u32 clnt_hdl,
+ const struct ipa_ep_cfg_mode *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_aggr(u32 clnt_hdl,
+ const struct ipa_ep_cfg_aggr *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_deaggr(u32 clnt_hdl,
+ const struct ipa_ep_cfg_deaggr *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_route(u32 clnt_hdl,
+ const struct ipa_ep_cfg_route *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_holb(u32 clnt_hdl,
+ const struct ipa_ep_cfg_holb *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_cfg(u32 clnt_hdl,
+ const struct ipa_ep_cfg_cfg *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_metadata_mask(u32 clnt_hdl,
+ const struct ipa_ep_cfg_metadata_mask *ipa_ep_cfg)
+{
+ return -EPERM;
+}
+
+static inline int ipa_cfg_ep_ctrl(u32 clnt_hdl,
+ const struct ipa_ep_cfg_ctrl *ep_ctrl)
+{
+ return -EPERM;
+}
+
+/*
+ * Header removal / addition
+ */
+static inline int ipa_add_hdr(struct ipa_ioc_add_hdr *hdrs)
+{
+ return -EPERM;
+}
+
+static inline int ipa_del_hdr(struct ipa_ioc_del_hdr *hdls)
+{
+ return -EPERM;
+}
+
+static inline int ipa_commit_hdr(void)
+{
+ return -EPERM;
+}
+
+static inline int ipa_reset_hdr(void)
+{
+ return -EPERM;
+}
+
+static inline int ipa_get_hdr(struct ipa_ioc_get_hdr *lookup)
+{
+ return -EPERM;
+}
+
+static inline int ipa_put_hdr(u32 hdr_hdl)
+{
+ return -EPERM;
+}
+
+static inline int ipa_copy_hdr(struct ipa_ioc_copy_hdr *copy)
+{
+ return -EPERM;
+}
+
+/*
+ * Header Processing Context
+ */
+static inline int ipa_add_hdr_proc_ctx(
+ struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs)
+{
+ return -EPERM;
+}
+
+static inline int ipa_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls)
+{
+ return -EPERM;
+}
+/*
+ * Routing
+ */
+static inline int ipa_add_rt_rule(struct ipa_ioc_add_rt_rule *rules)
+{
+ return -EPERM;
+}
+
+static inline int ipa_del_rt_rule(struct ipa_ioc_del_rt_rule *hdls)
+{
+ return -EPERM;
+}
+
+static inline int ipa_commit_rt(enum ipa_ip_type ip)
+{
+ return -EPERM;
+}
+
+static inline int ipa_reset_rt(enum ipa_ip_type ip)
+{
+ return -EPERM;
+}
+
+static inline int ipa_get_rt_tbl(struct ipa_ioc_get_rt_tbl *lookup)
+{
+ return -EPERM;
+}
+
+static inline int ipa_put_rt_tbl(u32 rt_tbl_hdl)
+{
+ return -EPERM;
+}
+
+static inline int ipa_query_rt_index(struct ipa_ioc_get_rt_tbl_indx *in)
+{
+ return -EPERM;
+}
+
+static inline int ipa_mdfy_rt_rule(struct ipa_ioc_mdfy_rt_rule *rules)
+{
+ return -EPERM;
+}
+
+/*
+ * Filtering
+ */
+static inline int ipa_add_flt_rule(struct ipa_ioc_add_flt_rule *rules)
+{
+ return -EPERM;
+}
+
+static inline int ipa_del_flt_rule(struct ipa_ioc_del_flt_rule *hdls)
+{
+ return -EPERM;
+}
+
+static inline int ipa_mdfy_flt_rule(struct ipa_ioc_mdfy_flt_rule *rules)
+{
+ return -EPERM;
+}
+
+static inline int ipa_commit_flt(enum ipa_ip_type ip)
+{
+ return -EPERM;
+}
+
+static inline int ipa_reset_flt(enum ipa_ip_type ip)
+{
+ return -EPERM;
+}
+
+/*
+ * NAT
+ */
+static inline int allocate_nat_device(struct ipa_ioc_nat_alloc_mem *mem)
+{
+ return -EPERM;
+}
+
+
+static inline int ipa_nat_init_cmd(struct ipa_ioc_v4_nat_init *init)
+{
+ return -EPERM;
+}
+
+
+static inline int ipa_nat_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma)
+{
+ return -EPERM;
+}
+
+
+static inline int ipa_nat_del_cmd(struct ipa_ioc_v4_nat_del *del)
+{
+ return -EPERM;
+}
+
+/*
+ * Messaging
+ */
+static inline int ipa_send_msg(struct ipa_msg_meta *meta, void *buff,
+ ipa_msg_free_fn callback)
+{
+ return -EPERM;
+}
+
+static inline int ipa_register_pull_msg(struct ipa_msg_meta *meta,
+ ipa_msg_pull_fn callback)
+{
+ return -EPERM;
+}
+
+static inline int ipa_deregister_pull_msg(struct ipa_msg_meta *meta)
+{
+ return -EPERM;
+}
+
+/*
+ * Interface
+ */
+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_register_intf_ext(const char *name,
+ const struct ipa_tx_intf *tx,
+ const struct ipa_rx_intf *rx,
+ const struct ipa_ext_intf *ext)
+{
+ return -EPERM;
+}
+
+static inline int ipa_deregister_intf(const char *name)
+{
+ return -EPERM;
+}
+
+/*
+ * Aggregation
+ */
+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;
+}
+
+/*
+ * Data path
+ */
+static inline int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
+ struct ipa_tx_meta *metadata)
+{
+ return -EPERM;
+}
+
+/*
+ * To transfer multiple data packets
+ */
+static inline int ipa_tx_dp_mul(
+ enum ipa_client_type dst,
+ struct ipa_tx_data_desc *data_desc)
+{
+ return -EPERM;
+}
+
+static inline void ipa_free_skb(struct ipa_rx_data *rx_in)
+{
+ return;
+}
+
+/*
+ * System pipes
+ */
+static inline u16 ipa_get_smem_restr_bytes(void)
+{
+ return -EPERM;
+}
+
+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_uc_wdi_get_dbpa(
+ struct ipa_wdi_db_params *out)
+{
+ return -EPERM;
+}
+
+static inline int ipa_uc_reg_rdyCB(
+ struct ipa_wdi_uc_ready_params *param)
+{
+ return -EPERM;
+}
+
+
+/*
+ * Resource manager
+ */
+static inline int ipa_rm_create_resource(
+ struct ipa_rm_create_params *create_params)
+{
+ return -EPERM;
+}
+
+static inline int ipa_rm_delete_resource(
+ enum ipa_rm_resource_name resource_name)
+{
+ return -EPERM;
+}
+
+static inline int ipa_rm_register(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_deregister(enum ipa_rm_resource_name resource_name,
+ struct ipa_rm_register_params *reg_params)
+{
+ 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_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_init(
+ enum ipa_rm_resource_name resource_name,
+ unsigned long msecs)
+{
+ 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;
+}
+
+/*
+ * Tethering bridge (Rmnet / MBIM)
+ */
+static inline int teth_bridge_init(struct teth_bridge_init_params *params)
+{
+ return -EPERM;
+}
+
+static inline int teth_bridge_disconnect(enum ipa_client_type client)
+{
+ return -EPERM;
+}
+
+static inline int teth_bridge_connect(struct teth_bridge_connect_params
+ *connect_params)
+{
+ return -EPERM;
+}
+
+/*
+ * Tethering client info
+ */
+static inline void ipa_set_client(int index, enum ipacm_client_enum client,
+ bool uplink)
+{
+ return;
+}
+
+static inline enum ipacm_client_enum ipa_get_client(int pipe_idx)
+{
+ return -EPERM;
+}
+
+static inline bool ipa_get_client_uplink(int pipe_idx)
+{
+ return -EPERM;
+}
+
+
+/*
+ * ODU bridge
+ */
+static inline int odu_bridge_init(struct odu_bridge_params *params)
+{
+ return -EPERM;
+}
+
+static inline int odu_bridge_disconnect(void)
+{
+ return -EPERM;
+}
+
+static inline int odu_bridge_connect(void)
+{
+ return -EPERM;
+}
+
+static inline int odu_bridge_tx_dp(struct sk_buff *skb,
+ struct ipa_tx_meta *metadata)
+{
+ return -EPERM;
+}
+
+static inline int odu_bridge_cleanup(void)
+{
+ return -EPERM;
+}
+
+/*
+ * IPADMA
+ */
+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 int ipa_dma_uc_memcpy(phys_addr_t dest, phys_addr_t src, int len)
+{
+ return -EPERM;
+}
+
+static inline void ipa_dma_destroy(void)
+{
+ return;
+}
+
+/*
+ * MHI
+ */
+static inline int ipa_mhi_init(struct ipa_mhi_init_params *params)
+{
+ return -EPERM;
+}
+
+static inline int ipa_mhi_start(struct ipa_mhi_start_params *params)
+{
+ return -EPERM;
+}
+
+static inline int ipa_mhi_connect_pipe(struct ipa_mhi_connect_params *in,
+ u32 *clnt_hdl)
+{
+ return -EPERM;
+}
+
+static inline int ipa_mhi_disconnect_pipe(u32 clnt_hdl)
+{
+ return -EPERM;
+}
+
+static inline int ipa_mhi_suspend(bool force)
+{
+ return -EPERM;
+}
+
+static inline int ipa_mhi_resume(void)
+{
+ return -EPERM;
+}
+
+static inline void ipa_mhi_destroy(void)
+{
+ return;
+}
+
+/*
+ * IPA_USB
+ */
+
+static inline int ipa_usb_init_teth_prot(enum ipa_usb_teth_prot teth_prot,
+ struct ipa_usb_teth_params *teth_params,
+ int (*ipa_usb_notify_cb)(enum ipa_usb_notify_event,
+ void *),
+ void *user_data)
+{
+ return -EPERM;
+}
+
+static inline int ipa_usb_xdci_connect(
+ struct ipa_usb_xdci_chan_params *ul_chan_params,
+ struct ipa_usb_xdci_chan_params *dl_chan_params,
+ struct ipa_req_chan_out_params *ul_out_params,
+ struct ipa_req_chan_out_params *dl_out_params,
+ struct ipa_usb_xdci_connect_params *connect_params)
+{
+ return -EPERM;
+}
+
+static inline int ipa_usb_xdci_disconnect(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
+ enum ipa_usb_teth_prot teth_prot)
+{
+ return -EPERM;
+}
+
+static inline int ipa_usb_deinit_teth_prot(enum ipa_usb_teth_prot teth_prot)
+{
+ return -EPERM;
+}
+
+static inline int ipa_usb_xdci_suspend(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
+ enum ipa_usb_teth_prot teth_prot)
+{
+ return -EPERM;
+}
+
+static inline int ipa_usb_xdci_resume(u32 ul_clnt_hdl, u32 dl_clnt_hdl)
+{
+ return -EPERM;
+}
+
+/*
+ * mux id
+ */
+static inline int ipa_write_qmap_id(struct ipa_ioc_write_qmapid *param_in)
+{
+ return -EPERM;
+}
+
+/*
+ * interrupts
+ */
+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_remove_interrupt_handler(enum ipa_irq_type interrupt)
+{
+ return -EPERM;
+}
+
+static inline int ipa_restore_suspend_handler(void)
+{
+ return -EPERM;
+}
+
+/*
+ * Miscellaneous
+ */
+static inline void ipa_bam_reg_dump(void)
+{
+ return;
+}
+
+static inline int ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats)
+{
+ 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 void ipa_proxy_clk_vote(void)
+{
+}
+
+static inline void ipa_proxy_clk_unvote(void)
+{
+}
+
+static inline enum ipa_hw_type ipa_get_hw_type(void)
+{
+ return IPA_HW_None;
+}
+
+static inline bool ipa_is_client_handle_valid(u32 clnt_hdl)
+{
+ return -EINVAL;
+}
+
+static inline enum ipa_client_type ipa_get_client_mapping(int pipe_idx)
+{
+ return -EINVAL;
+}
+
+static inline enum ipa_rm_resource_name ipa_get_rm_resource_from_ep(
+ int pipe_idx)
+{
+ return -EFAULT;
+}
+
+static inline bool ipa_get_modem_cfg_emb_pipe_flt(void)
+{
+ return -EINVAL;
+}
+
+static inline enum ipa_transport_type ipa_get_transport_type(void)
+{
+ return -EFAULT;
+}
+
+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_create_wdi_mapping(u32 num_buffers,
+ struct ipa_wdi_buffer_info *info)
+{
+ return -EINVAL;
+}
+
+static inline int ipa_release_wdi_mapping(u32 num_buffers,
+ struct ipa_wdi_buffer_info *info)
+{
+ return -EINVAL;
+}
+
+static inline int ipa_disable_apps_wan_cons_deaggr(void)
+{
+ return -EINVAL;
+}
+
+static inline struct ipa_gsi_ep_config *ipa_get_gsi_ep_info(int ipa_ep_idx)
+{
+ return NULL;
+}
+
+static inline int ipa_stop_gsi_channel(u32 clnt_hdl)
+{
+ return -EPERM;
+}
+
+static inline int ipa_register_ipa_ready_cb(
+ void (*ipa_ready_cb)(void *user_data),
+ void *user_data)
+{
+ return -EPERM;
+}
+
+#endif /* (CONFIG_IPA || CONFIG_IPA3) */
+
+#endif /* _IPA_H_ */
diff --git a/include/linux/msm_gsi.h b/include/linux/msm_gsi.h
new file mode 100644
index 000000000000..4aedca7d6d7f
--- /dev/null
+++ b/include/linux/msm_gsi.h
@@ -0,0 +1,1178 @@
+/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#ifndef MSM_GSI_H
+#define MSM_GSI_H
+#include <linux/types.h>
+
+enum gsi_status {
+ GSI_STATUS_SUCCESS = 0,
+ GSI_STATUS_ERROR = 1,
+ GSI_STATUS_RING_INSUFFICIENT_SPACE = 2,
+ GSI_STATUS_RING_EMPTY = 3,
+ GSI_STATUS_RES_ALLOC_FAILURE = 4,
+ GSI_STATUS_BAD_STATE = 5,
+ GSI_STATUS_INVALID_PARAMS = 6,
+ GSI_STATUS_UNSUPPORTED_OP = 7,
+ GSI_STATUS_NODEV = 8,
+ GSI_STATUS_POLL_EMPTY = 9,
+ GSI_STATUS_EVT_RING_INCOMPATIBLE = 10,
+ GSI_STATUS_TIMED_OUT = 11,
+ GSI_STATUS_AGAIN = 12,
+};
+
+enum gsi_per_evt {
+ GSI_PER_EVT_GLOB_ERROR,
+ GSI_PER_EVT_GLOB_GP1,
+ GSI_PER_EVT_GLOB_GP2,
+ GSI_PER_EVT_GLOB_GP3,
+ GSI_PER_EVT_GENERAL_BREAK_POINT,
+ GSI_PER_EVT_GENERAL_BUS_ERROR,
+ GSI_PER_EVT_GENERAL_CMD_FIFO_OVERFLOW,
+ GSI_PER_EVT_GENERAL_MCS_STACK_OVERFLOW,
+};
+
+/**
+ * gsi_per_notify - Peripheral callback info
+ *
+ * @user_data: cookie supplied in gsi_register_device
+ * @evt_id: type of notification
+ * @err_desc: error related information
+ *
+ */
+struct gsi_per_notify {
+ void *user_data;
+ enum gsi_per_evt evt_id;
+ union {
+ uint16_t err_desc;
+ } data;
+};
+
+enum gsi_intr_type {
+ GSI_INTR_MSI = 0x0,
+ GSI_INTR_IRQ = 0x1
+};
+
+
+/**
+ * gsi_per_props - Peripheral related properties
+ *
+ * @ee: EE where this driver and peripheral driver runs
+ * @intr: control interrupt type
+ * @intvec: write data for MSI write
+ * @msi_addr: MSI address
+ * @irq: IRQ number
+ * @phys_addr: physical address of GSI block
+ * @size: register size of GSI block
+ * @notify_cb: general notification callback
+ * @req_clk_cb: callback to request peripheral clock
+ * granted should be set to true if request is completed
+ * synchronously, false otherwise (peripheral needs
+ * to call gsi_complete_clk_grant later when request is
+ * completed)
+ * if this callback is not provided, then GSI will assume
+ * peripheral is clocked at all times
+ * @rel_clk_cb: callback to release peripheral clock
+ * @user_data: cookie used for notifications
+ *
+ * All the callbacks are in interrupt context
+ *
+ */
+struct gsi_per_props {
+ unsigned int ee;
+ enum gsi_intr_type intr;
+ uint32_t intvec;
+ uint64_t msi_addr;
+ unsigned int irq;
+ phys_addr_t phys_addr;
+ unsigned long size;
+ void (*notify_cb)(struct gsi_per_notify *notify);
+ void (*req_clk_cb)(void *user_data, bool *granted);
+ int (*rel_clk_cb)(void *user_data);
+ void *user_data;
+};
+
+enum gsi_evt_err {
+ GSI_EVT_OUT_OF_BUFFERS_ERR = 0x0,
+ GSI_EVT_OUT_OF_RESOURCES_ERR = 0x1,
+ GSI_EVT_UNSUPPORTED_INTER_EE_OP_ERR = 0x2,
+ GSI_EVT_EVT_RING_EMPTY_ERR = 0x3,
+};
+
+/**
+ * gsi_evt_err_notify - event ring error callback info
+ *
+ * @user_data: cookie supplied in gsi_alloc_evt_ring
+ * @evt_id: type of error
+ * @err_desc: more info about the error
+ *
+ */
+struct gsi_evt_err_notify {
+ void *user_data;
+ enum gsi_evt_err evt_id;
+ uint16_t err_desc;
+};
+
+enum gsi_evt_chtype {
+ GSI_EVT_CHTYPE_MHI_EV = 0x0,
+ GSI_EVT_CHTYPE_XHCI_EV = 0x1,
+ GSI_EVT_CHTYPE_GPI_EV = 0x2,
+ GSI_EVT_CHTYPE_XDCI_EV = 0x3
+};
+
+enum gsi_evt_ring_elem_size {
+ GSI_EVT_RING_RE_SIZE_4B = 4,
+ GSI_EVT_RING_RE_SIZE_16B = 16,
+};
+
+/**
+ * gsi_evt_ring_props - Event ring related properties
+ *
+ * @intf: interface type (of the associated channel)
+ * @intr: interrupt type
+ * @re_size: size of event ring element
+ * @ring_len: length of ring in bytes (must be integral multiple of
+ * re_size)
+ * @ring_base_addr: physical base address of ring. Address must be aligned to
+ * ring_len rounded to power of two
+ * @ring_base_vaddr: virtual base address of ring (set to NULL when not
+ * applicable)
+ * @int_modt: cycles base interrupt moderation (32KHz clock)
+ * @int_modc: interrupt moderation packet counter
+ * @intvec: write data for MSI write
+ * @msi_addr: MSI address
+ * @rp_update_addr: physical address to which event read pointer should be
+ * written on every event generation. must be set to 0 when
+ * no update is desdired
+ * @exclusive: if true, only one GSI channel can be associated with this
+ * event ring. if false, the event ring can be shared among
+ * multiple GSI channels but in that case no polling
+ * (GSI_CHAN_MODE_POLL) is supported on any of those channels
+ * @err_cb: error notification callback
+ * @user_data: cookie used for error notifications
+ * @evchid_valid: is evchid valid?
+ * @evchid: the event ID that is being specifically requested (this is
+ * relevant for MHI where doorbell routing requires ERs to be
+ * physically contiguous)
+ */
+struct gsi_evt_ring_props {
+ enum gsi_evt_chtype intf;
+ enum gsi_intr_type intr;
+ enum gsi_evt_ring_elem_size re_size;
+ uint16_t ring_len;
+ uint64_t ring_base_addr;
+ void *ring_base_vaddr;
+ uint16_t int_modt;
+ uint8_t int_modc;
+ uint32_t intvec;
+ uint64_t msi_addr;
+ uint64_t rp_update_addr;
+ bool exclusive;
+ void (*err_cb)(struct gsi_evt_err_notify *notify);
+ void *user_data;
+ bool evchid_valid;
+ uint8_t evchid;
+};
+
+enum gsi_chan_mode {
+ GSI_CHAN_MODE_CALLBACK = 0x0,
+ GSI_CHAN_MODE_POLL = 0x1,
+};
+
+enum gsi_chan_prot {
+ GSI_CHAN_PROT_MHI = 0x0,
+ GSI_CHAN_PROT_XHCI = 0x1,
+ GSI_CHAN_PROT_GPI = 0x2,
+ GSI_CHAN_PROT_XDCI = 0x3
+};
+
+enum gsi_chan_dir {
+ GSI_CHAN_DIR_FROM_GSI = 0x0,
+ GSI_CHAN_DIR_TO_GSI = 0x1
+};
+
+enum gsi_max_prefetch {
+ GSI_ONE_PREFETCH_SEG = 0x0,
+ GSI_TWO_PREFETCH_SEG = 0x1
+};
+
+enum gsi_chan_evt {
+ GSI_CHAN_EVT_INVALID = 0x0,
+ GSI_CHAN_EVT_SUCCESS = 0x1,
+ GSI_CHAN_EVT_EOT = 0x2,
+ GSI_CHAN_EVT_OVERFLOW = 0x3,
+ GSI_CHAN_EVT_EOB = 0x4,
+ GSI_CHAN_EVT_OOB = 0x5,
+ GSI_CHAN_EVT_DB_MODE = 0x6,
+ GSI_CHAN_EVT_UNDEFINED = 0x10,
+ GSI_CHAN_EVT_RE_ERROR = 0x11,
+};
+
+/**
+ * gsi_chan_xfer_notify - Channel callback info
+ *
+ * @chan_user_data: cookie supplied in gsi_alloc_channel
+ * @xfer_user_data: cookie of the gsi_xfer_elem that caused the
+ * event to be generated
+ * @evt_id: type of event triggered by the associated TRE
+ * (corresponding to xfer_user_data)
+ * @bytes_xfered: number of bytes transferred by the associated TRE
+ * (corresponding to xfer_user_data)
+ *
+ */
+struct gsi_chan_xfer_notify {
+ void *chan_user_data;
+ void *xfer_user_data;
+ enum gsi_chan_evt evt_id;
+ uint16_t bytes_xfered;
+};
+
+enum gsi_chan_err {
+ GSI_CHAN_INVALID_TRE_ERR = 0x0,
+ GSI_CHAN_NON_ALLOCATED_EVT_ACCESS_ERR = 0x1,
+ GSI_CHAN_OUT_OF_BUFFERS_ERR = 0x2,
+ GSI_CHAN_OUT_OF_RESOURCES_ERR = 0x3,
+ GSI_CHAN_UNSUPPORTED_INTER_EE_OP_ERR = 0x4,
+ GSI_CHAN_HWO_1_ERR = 0x5
+};
+
+/**
+ * gsi_chan_err_notify - Channel general callback info
+ *
+ * @chan_user_data: cookie supplied in gsi_alloc_channel
+ * @evt_id: type of error
+ * @err_desc: more info about the error
+ *
+ */
+struct gsi_chan_err_notify {
+ void *chan_user_data;
+ enum gsi_chan_err evt_id;
+ uint16_t err_desc;
+};
+
+enum gsi_chan_ring_elem_size {
+ GSI_CHAN_RE_SIZE_4B = 4,
+ GSI_CHAN_RE_SIZE_16B = 16,
+ GSI_CHAN_RE_SIZE_32B = 32,
+};
+
+enum gsi_chan_use_db_eng {
+ GSI_CHAN_DIRECT_MODE = 0x0,
+ GSI_CHAN_DB_MODE = 0x1,
+};
+
+/**
+ * gsi_chan_props - Channel related properties
+ *
+ * @prot: interface type
+ * @dir: channel direction
+ * @ch_id: virtual channel ID
+ * @evt_ring_hdl: handle of associated event ring. set to ~0 if no
+ * event ring associated
+ * @re_size: size of channel ring element
+ * @ring_len: length of ring in bytes (must be integral multiple of
+ * re_size)
+ * @ring_base_addr: physical base address of ring. Address must be aligned to
+ * ring_len rounded to power of two
+ * @ring_base_vaddr: virtual base address of ring (set to NULL when not
+ * applicable)
+ * @use_db_eng: 0 => direct mode (doorbells are written directly to RE
+ * engine)
+ * 1 => DB mode (doorbells are written to DB engine)
+ * @max_prefetch: limit number of pre-fetch segments for channel
+ * @low_weight: low channel weight (priority of channel for RE engine
+ * round robin algorithm); must be >= 1
+ * @xfer_cb: transfer notification callback, this callback happens
+ * on event boundaries
+ *
+ * e.g. 1
+ *
+ * out TD with 3 REs
+ *
+ * RE1: EOT=0, EOB=0, CHAIN=1;
+ * RE2: EOT=0, EOB=0, CHAIN=1;
+ * RE3: EOT=1, EOB=0, CHAIN=0;
+ *
+ * the callback will be triggered for RE3 using the
+ * xfer_user_data of that RE
+ *
+ * e.g. 2
+ *
+ * in REs
+ *
+ * RE1: EOT=1, EOB=0, CHAIN=0;
+ * RE2: EOT=1, EOB=0, CHAIN=0;
+ * RE3: EOT=1, EOB=0, CHAIN=0;
+ *
+ * received packet consumes all of RE1, RE2 and part of RE3
+ * for EOT condition. there will be three callbacks in below
+ * order
+ *
+ * callback for RE1 using GSI_CHAN_EVT_OVERFLOW
+ * callback for RE2 using GSI_CHAN_EVT_OVERFLOW
+ * callback for RE3 using GSI_CHAN_EVT_EOT
+ *
+ * @err_cb: error notification callback
+ * @chan_user_data: cookie used for notifications
+ *
+ * All the callbacks are in interrupt context
+ *
+ */
+struct gsi_chan_props {
+ enum gsi_chan_prot prot;
+ enum gsi_chan_dir dir;
+ uint8_t ch_id;
+ unsigned long evt_ring_hdl;
+ enum gsi_chan_ring_elem_size re_size;
+ uint16_t ring_len;
+ uint64_t ring_base_addr;
+ void *ring_base_vaddr;
+ enum gsi_chan_use_db_eng use_db_eng;
+ enum gsi_max_prefetch max_prefetch;
+ uint8_t low_weight;
+ void (*xfer_cb)(struct gsi_chan_xfer_notify *notify);
+ void (*err_cb)(struct gsi_chan_err_notify *notify);
+ void *chan_user_data;
+};
+
+enum gsi_xfer_flag {
+ GSI_XFER_FLAG_CHAIN = 0x1,
+ GSI_XFER_FLAG_EOB = 0x100,
+ GSI_XFER_FLAG_EOT = 0x200,
+ GSI_XFER_FLAG_BEI = 0x400
+};
+
+enum gsi_xfer_elem_type {
+ GSI_XFER_ELEM_DATA,
+ GSI_XFER_ELEM_IMME_CMD,
+};
+
+/**
+ * gsi_xfer_elem - Metadata about a single transfer
+ *
+ * @addr: physical address of buffer
+ * @len: size of buffer for GSI_XFER_ELEM_DATA:
+ * for outbound transfers this is the number of bytes to
+ * transfer.
+ * for inbound transfers, this is the maximum number of
+ * bytes the host expects from device in this transfer
+ *
+ * immediate command opcode for GSI_XFER_ELEM_IMME_CMD
+ * @flags: transfer flags, OR of all the applicable flags
+ *
+ * GSI_XFER_FLAG_BEI: Block event interrupt
+ * 1: Event generated by this ring element must not assert
+ * an interrupt to the host
+ * 0: Event generated by this ring element must assert an
+ * interrupt to the host
+ *
+ * GSI_XFER_FLAG_EOT: Interrupt on end of transfer
+ * 1: If an EOT condition is encountered when processing
+ * this ring element, an event is generated by the device
+ * with its completion code set to EOT.
+ * 0: If an EOT condition is encountered for this ring
+ * element, a completion event is not be generated by the
+ * device, unless IEOB is 1
+ *
+ * GSI_XFER_FLAG_EOB: Interrupt on end of block
+ * 1: Device notifies host after processing this ring element
+ * by sending a completion event
+ * 0: Completion event is not required after processing this
+ * ring element
+ *
+ * GSI_XFER_FLAG_CHAIN: Chain bit that identifies the ring
+ * elements in a TD
+ *
+ * @type: transfer type
+ *
+ * GSI_XFER_ELEM_DATA: for all data transfers
+ * GSI_XFER_ELEM_IMME_CMD: for IPA immediate commands
+ *
+ * @xfer_user_data: cookie used in xfer_cb
+ *
+ */
+struct gsi_xfer_elem {
+ uint64_t addr;
+ uint16_t len;
+ uint16_t flags;
+ enum gsi_xfer_elem_type type;
+ void *xfer_user_data;
+};
+
+/**
+ * gsi_mhi_channel_scratch - MHI protocol SW config area of
+ * channel scratch
+ *
+ * @mhi_host_wp_addr: Valid only when UL/DL Sync En is asserted. Defines
+ * address in host from which channel write pointer
+ * should be read in polling mode
+ * @max_outstanding_tre: Used for the prefetch management sequence by the
+ * sequencer. Defines the maximum number of allowed
+ * outstanding TREs in IPA/GSI (in Bytes). RE engine
+ * prefetch will be limited by this configuration. It
+ * is suggested to configure this value with the IPA_IF
+ * channel AOS queue size. To disable the feature in
+ * doorbell mode (DB Mode=1) Maximum outstanding TREs
+ * should be set to 64KB (or any value larger or equal
+ * to ring length . RLEN)
+ * @assert_bit40: 1: bit #41 in address should be asserted upon
+ * IPA_IF.ProcessDescriptor routine (for MHI over PCIe
+ * transfers)
+ * 0: bit #41 in address should be deasserted upon
+ * IPA_IF.ProcessDescriptor routine (for non-MHI over
+ * PCIe transfers)
+ * @ul_dl_sync_en: When asserted, UL/DL synchronization feature is
+ * enabled for the channel. Supported only for predefined
+ * UL/DL endpoint pair
+ * @outstanding_threshold: Used for the prefetch management sequence by the
+ * sequencer. Defines the threshold (in Bytes) as to when
+ * to update the channel doorbell. Should be smaller than
+ * Maximum outstanding TREs. value.
+ */
+struct __packed gsi_mhi_channel_scratch {
+ uint64_t mhi_host_wp_addr;
+ uint32_t ul_dl_sync_en:1;
+ uint32_t assert_bit40:1;
+ uint32_t resvd1:14;
+ uint32_t max_outstanding_tre:16;
+ uint32_t resvd2:16;
+ uint32_t outstanding_threshold:16;
+};
+
+/**
+ * gsi_xdci_channel_scratch - xDCI protocol SW config area of
+ * channel scratch
+ *
+ * @const_buffer_size: TRB buffer size in KB (similar to IPA aggregationi
+ * configuration). Must be aligned to Max USB Packet Size
+ * @xferrscidx: Transfer Resource Index (XferRscIdx). The hardware-assigned
+ * transfer resource index for the transfer, which was
+ * returned in response to the Start Transfer command.
+ * This field is used for "Update Transfer" command
+ * @last_trb_addr: Address (LSB - based on alignment restrictions) of
+ * last TRB in queue. Used to identify rollover case
+ * @depcmd_low_addr: Used to generate "Update Transfer" command
+ * @max_outstanding_tre: Used for the prefetch management sequence by the
+ * sequencer. Defines the maximum number of allowed
+ * outstanding TREs in IPA/GSI (in Bytes). RE engine
+ * prefetch will be limited by this configuration. It
+ * is suggested to configure this value with the IPA_IF
+ * channel AOS queue size. To disable the feature in
+ * doorbell mode (DB Mode=1) Maximum outstanding TREs
+ * should be set to 64KB (or any value larger or equal
+ * to ring length . RLEN)
+ * @depcmd_hi_addr: Used to generate "Update Transfer" command
+ * @outstanding_threshold: Used for the prefetch management sequence by the
+ * sequencer. Defines the threshold (in Bytes) as to when
+ * to update the channel doorbell. Should be smaller than
+ * Maximum outstanding TREs. value.
+ */
+struct __packed gsi_xdci_channel_scratch {
+ uint32_t last_trb_addr:16;
+ uint32_t resvd1:4;
+ uint32_t xferrscidx:7;
+ uint32_t const_buffer_size:5;
+ uint32_t depcmd_low_addr;
+ uint32_t depcmd_hi_addr:8;
+ uint32_t resvd2:8;
+ uint32_t max_outstanding_tre:16;
+ uint32_t resvd3:16;
+ uint32_t outstanding_threshold:16;
+};
+
+/**
+ * gsi_channel_scratch - channel scratch SW config area
+ *
+ */
+union __packed gsi_channel_scratch {
+ struct __packed gsi_mhi_channel_scratch mhi;
+ struct __packed gsi_xdci_channel_scratch xdci;
+ struct __packed {
+ uint32_t word1;
+ uint32_t word2;
+ uint32_t word3;
+ uint32_t word4;
+ } data;
+};
+
+/**
+ * gsi_mhi_evt_scratch - MHI protocol SW config area of
+ * event scratch
+ *
+ * @ul_dl_sync_en: When asserted, UL/DL synchronization feature is enabled for
+ * the channel. Supported only for predefined UL/DL endpoint
+ * pair
+ */
+struct __packed gsi_mhi_evt_scratch {
+ uint32_t resvd1:31;
+ uint32_t ul_dl_sync_en:1;
+ uint32_t resvd2;
+};
+
+/**
+ * gsi_xdci_evt_scratch - xDCI protocol SW config area of
+ * event scratch
+ *
+ */
+struct __packed gsi_xdci_evt_scratch {
+ uint32_t gevntcount_low_addr;
+ uint32_t gevntcount_hi_addr:8;
+ uint32_t resvd1:24;
+};
+
+/**
+ * gsi_evt_scratch - event scratch SW config area
+ *
+ */
+union __packed gsi_evt_scratch {
+ struct __packed gsi_mhi_evt_scratch mhi;
+ struct __packed gsi_xdci_evt_scratch xdci;
+ struct __packed {
+ uint32_t word1;
+ uint32_t word2;
+ } data;
+};
+
+/**
+ * gsi_device_scratch - EE scratch config parameters
+ *
+ * @mhi_base_chan_idx_valid: is mhi_base_chan_idx valid?
+ * @mhi_base_chan_idx: base index of IPA MHI channel indexes.
+ * IPA MHI channel index = GSI channel ID +
+ * MHI base channel index
+ * @max_usb_pkt_size_valid: is max_usb_pkt_size valid?
+ * @max_usb_pkt_size: max USB packet size in bytes (valid values are
+ * 512 and 1024)
+ */
+struct gsi_device_scratch {
+ bool mhi_base_chan_idx_valid;
+ uint8_t mhi_base_chan_idx;
+ bool max_usb_pkt_size_valid;
+ uint16_t max_usb_pkt_size;
+};
+
+/**
+ * gsi_chan_info - information about channel occupancy
+ *
+ * @wp: channel write pointer (physical address)
+ * @rp: channel read pointer (physical address)
+ * @evt_valid: is evt* info valid?
+ * @evt_wp: event ring write pointer (physical address)
+ * @evt_rp: event ring read pointer (physical address)
+ */
+struct gsi_chan_info {
+ uint64_t wp;
+ uint64_t rp;
+ bool evt_valid;
+ uint64_t evt_wp;
+ uint64_t evt_rp;
+};
+
+#ifdef CONFIG_GSI
+/**
+ * gsi_register_device - Peripheral should call this function to
+ * register itself with GSI before invoking any other APIs
+ *
+ * @props: Peripheral properties
+ * @dev_hdl: Handle populated by GSI, opaque to client
+ *
+ * @Return -GSI_STATUS_AGAIN if request should be re-tried later
+ * other error codes for failure
+ */
+int gsi_register_device(struct gsi_per_props *props, unsigned long *dev_hdl);
+
+/**
+ * gsi_complete_clk_grant - Peripheral should call this function to
+ * grant the clock resource requested by GSI previously that could not
+ * be granted synchronously. GSI will release the clock resource using
+ * the rel_clk_cb when appropriate
+ *
+ * @dev_hdl: Client handle previously obtained from
+ * gsi_register_device
+ *
+ * @Return gsi_status
+ */
+int gsi_complete_clk_grant(unsigned long dev_hdl);
+
+/**
+ * gsi_write_device_scratch - Peripheral should call this function to
+ * write to the EE scratch area
+ *
+ * @dev_hdl: Client handle previously obtained from
+ * gsi_register_device
+ * @val: Value to write
+ *
+ * @Return gsi_status
+ */
+int gsi_write_device_scratch(unsigned long dev_hdl,
+ struct gsi_device_scratch *val);
+
+/**
+ * gsi_deregister_device - Peripheral should call this function to
+ * de-register itself with GSI
+ *
+ * @dev_hdl: Client handle previously obtained from
+ * gsi_register_device
+ * @force: When set to true, cleanup is performed even if there
+ * are in use resources like channels, event rings, etc.
+ * this would be used after GSI reset to recover from some
+ * fatal error
+ * When set to false, there must not exist any allocated
+ * channels and event rings.
+ *
+ * @Return gsi_status
+ */
+int gsi_deregister_device(unsigned long dev_hdl, bool force);
+
+/**
+ * gsi_alloc_evt_ring - Peripheral should call this function to
+ * allocate an event ring
+ *
+ * @props: Event ring properties
+ * @dev_hdl: Client handle previously obtained from
+ * gsi_register_device
+ * @evt_ring_hdl: Handle populated by GSI, opaque to client
+ *
+ * This function can sleep
+ *
+ * @Return gsi_status
+ */
+int gsi_alloc_evt_ring(struct gsi_evt_ring_props *props, unsigned long dev_hdl,
+ unsigned long *evt_ring_hdl);
+
+/**
+ * gsi_write_evt_ring_scratch - Peripheral should call this function to
+ * write to the scratch area of the event ring context
+ *
+ * @evt_ring_hdl: Client handle previously obtained from
+ * gsi_alloc_evt_ring
+ * @val: Value to write
+ *
+ * @Return gsi_status
+ */
+int gsi_write_evt_ring_scratch(unsigned long evt_ring_hdl,
+ union __packed gsi_evt_scratch val);
+
+/**
+ * gsi_dealloc_evt_ring - Peripheral should call this function to
+ * de-allocate an event ring. There should not exist any active
+ * channels using this event ring
+ *
+ * @evt_ring_hdl: Client handle previously obtained from
+ * gsi_alloc_evt_ring
+ *
+ * This function can sleep
+ *
+ * @Return gsi_status
+ */
+int gsi_dealloc_evt_ring(unsigned long evt_ring_hdl);
+
+/**
+ * gsi_query_evt_ring_db_addr - Peripheral should call this function to
+ * query the physical addresses of the event ring doorbell registers
+ *
+ * @evt_ring_hdl: Client handle previously obtained from
+ * gsi_alloc_evt_ring
+ * @db_addr_wp_lsb: Physical address of doorbell register where the 32
+ * LSBs of the doorbell value should be written
+ * @db_addr_wp_msb: Physical address of doorbell register where the 32
+ * MSBs of the doorbell value should be written
+ *
+ * @Return gsi_status
+ */
+int gsi_query_evt_ring_db_addr(unsigned long evt_ring_hdl,
+ uint32_t *db_addr_wp_lsb, uint32_t *db_addr_wp_msb);
+
+/**
+ * gsi_reset_evt_ring - Peripheral should call this function to
+ * reset an event ring to recover from error state
+ *
+ * @evt_ring_hdl: Client handle previously obtained from
+ * gsi_alloc_evt_ring
+ *
+ * This function can sleep
+ *
+ * @Return gsi_status
+ */
+int gsi_reset_evt_ring(unsigned long evt_ring_hdl);
+
+/**
+ * gsi_get_evt_ring_cfg - This function returns the current config
+ * of the specified event ring
+ *
+ * @evt_ring_hdl: Client handle previously obtained from
+ * gsi_alloc_evt_ring
+ * @props: where to copy properties to
+ * @scr: where to copy scratch info to
+ *
+ * @Return gsi_status
+ */
+int gsi_get_evt_ring_cfg(unsigned long evt_ring_hdl,
+ struct gsi_evt_ring_props *props, union gsi_evt_scratch *scr);
+
+/**
+ * gsi_set_evt_ring_cfg - This function applies the supplied config
+ * to the specified event ring.
+ *
+ * exclusive property of the event ring cannot be changed after
+ * gsi_alloc_evt_ring
+ *
+ * @evt_ring_hdl: Client handle previously obtained from
+ * gsi_alloc_evt_ring
+ * @props: the properties to apply
+ * @scr: the scratch info to apply
+ *
+ * @Return gsi_status
+ */
+int gsi_set_evt_ring_cfg(unsigned long evt_ring_hdl,
+ struct gsi_evt_ring_props *props, union gsi_evt_scratch *scr);
+
+/**
+ * gsi_alloc_channel - Peripheral should call this function to
+ * allocate a channel
+ *
+ * @props: Channel properties
+ * @dev_hdl: Client handle previously obtained from
+ * gsi_register_device
+ * @chan_hdl: Handle populated by GSI, opaque to client
+ *
+ * This function can sleep
+ *
+ * @Return gsi_status
+ */
+int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl,
+ unsigned long *chan_hdl);
+
+/**
+ * gsi_write_channel_scratch - Peripheral should call this function to
+ * write to the scratch area of the channel context
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ * @val: Value to write
+ *
+ * @Return gsi_status
+ */
+int gsi_write_channel_scratch(unsigned long chan_hdl,
+ union __packed gsi_channel_scratch val);
+
+/**
+ * gsi_start_channel - Peripheral should call this function to
+ * start a channel i.e put into running state
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ *
+ * This function can sleep
+ *
+ * @Return gsi_status
+ */
+int gsi_start_channel(unsigned long chan_hdl);
+
+/**
+ * gsi_stop_channel - Peripheral should call this function to
+ * stop a channel. Stop will happen on a packet boundary
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ *
+ * This function can sleep
+ *
+ * @Return -GSI_STATUS_AGAIN if client should call stop/stop_db again
+ * other error codes for failure
+ */
+int gsi_stop_channel(unsigned long chan_hdl);
+
+/**
+ * gsi_reset_channel - Peripheral should call this function to
+ * reset a channel to recover from error state
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ *
+ * This function can sleep
+ *
+ * @Return gsi_status
+ */
+int gsi_reset_channel(unsigned long chan_hdl);
+
+/**
+ * gsi_dealloc_channel - Peripheral should call this function to
+ * de-allocate a channel
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ *
+ * This function can sleep
+ *
+ * @Return gsi_status
+ */
+int gsi_dealloc_channel(unsigned long chan_hdl);
+
+/**
+ * gsi_stop_db_channel - Peripheral should call this function to
+ * stop a channel when all transfer elements till the doorbell
+ * have been processed
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ *
+ * This function can sleep
+ *
+ * @Return -GSI_STATUS_AGAIN if client should call stop/stop_db again
+ * other error codes for failure
+ */
+int gsi_stop_db_channel(unsigned long chan_hdl);
+
+/**
+ * gsi_query_channel_db_addr - Peripheral should call this function to
+ * query the physical addresses of the channel doorbell registers
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ * @db_addr_wp_lsb: Physical address of doorbell register where the 32
+ * LSBs of the doorbell value should be written
+ * @db_addr_wp_msb: Physical address of doorbell register where the 32
+ * MSBs of the doorbell value should be written
+ *
+ * @Return gsi_status
+ */
+int gsi_query_channel_db_addr(unsigned long chan_hdl,
+ uint32_t *db_addr_wp_lsb, uint32_t *db_addr_wp_msb);
+
+/**
+ * gsi_query_channel_info - Peripheral can call this function to query the
+ * channel and associated event ring (if any) status.
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ * @info: Where to read the values into
+ *
+ * @Return gsi_status
+ */
+int gsi_query_channel_info(unsigned long chan_hdl,
+ struct gsi_chan_info *info);
+
+/**
+ * gsi_is_channel_empty - Peripheral can call this function to query if
+ * the channel is empty. This is only applicable to GPI. "Empty" means
+ * GSI has consumed all descriptors for a TO_GSI channel and SW has
+ * processed all completed descriptors for a FROM_GSI channel.
+ *
+ * @chan_hdl: Client handle previously obtained from gsi_alloc_channel
+ * @is_empty: set by GSI based on channel emptiness
+ *
+ * @Return gsi_status
+ */
+int gsi_is_channel_empty(unsigned long chan_hdl, bool *is_empty);
+
+/**
+ * gsi_get_channel_cfg - This function returns the current config
+ * of the specified channel
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ * @props: where to copy properties to
+ * @scr: where to copy scratch info to
+ *
+ * @Return gsi_status
+ */
+int gsi_get_channel_cfg(unsigned long chan_hdl, struct gsi_chan_props *props,
+ union gsi_channel_scratch *scr);
+
+/**
+ * gsi_set_channel_cfg - This function applies the supplied config
+ * to the specified channel
+ *
+ * ch_id and evt_ring_hdl of the channel cannot be changed after
+ * gsi_alloc_channel
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ * @props: the properties to apply
+ * @scr: the scratch info to apply
+ *
+ * @Return gsi_status
+ */
+int gsi_set_channel_cfg(unsigned long chan_hdl, struct gsi_chan_props *props,
+ union gsi_channel_scratch *scr);
+
+/**
+ * gsi_poll_channel - Peripheral should call this function to query for
+ * completed transfer descriptors.
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ * @notify: Information about the completed transfer if any
+ *
+ * @Return gsi_status (GSI_STATUS_POLL_EMPTY is returned if no transfers
+ * completed)
+ */
+int gsi_poll_channel(unsigned long chan_hdl,
+ struct gsi_chan_xfer_notify *notify);
+
+/**
+ * gsi_config_channel_mode - Peripheral should call this function
+ * to configure the channel mode.
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ * @mode: Mode to move the channel into
+ *
+ * @Return gsi_status
+ */
+int gsi_config_channel_mode(unsigned long chan_hdl, enum gsi_chan_mode mode);
+
+/**
+ * gsi_queue_xfer - Peripheral should call this function
+ * to queue transfers on the given channel
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ * @num_xfers: Number of transfer in the array @ xfer
+ * @xfer: Array of num_xfers transfer descriptors
+ * @ring_db: If true, tell HW about these queued xfers
+ * If false, do not notify HW at this time
+ *
+ * @Return gsi_status
+ */
+int gsi_queue_xfer(unsigned long chan_hdl, uint16_t num_xfers,
+ struct gsi_xfer_elem *xfer, bool ring_db);
+
+/**
+ * gsi_start_xfer - Peripheral should call this function to
+ * inform HW about queued xfers
+ *
+ * @chan_hdl: Client handle previously obtained from
+ * gsi_alloc_channel
+ *
+ * @Return gsi_status
+ */
+int gsi_start_xfer(unsigned long chan_hdl);
+
+/**
+ * gsi_configure_regs - Peripheral should call this function
+ * to configure the GSI registers before/after the FW is
+ * loaded but before it is enabled.
+ *
+ * @gsi_base_addr: Base address of GSI register space
+ * @gsi_size: Mapping size of the GSI register space
+ * @per_base_addr: Base address of the peripheral using GSI
+ *
+ * @Return gsi_status
+ */
+int gsi_configure_regs(phys_addr_t gsi_base_addr, u32 gsi_size,
+ phys_addr_t per_base_addr);
+
+/**
+ * gsi_enable_fw - Peripheral should call this function
+ * to enable the GSI FW after the FW has been loaded to the SRAM.
+ *
+ * @gsi_base_addr: Base address of GSI register space
+ * @gsi_size: Mapping size of the GSI register space
+
+ * @Return gsi_status
+ */
+int gsi_enable_fw(phys_addr_t gsi_base_addr, u32 gsi_size);
+
+/*
+ * Here is a typical sequence of calls
+ *
+ * gsi_register_device
+ *
+ * gsi_write_device_scratch (if the protocol needs this)
+ *
+ * gsi_alloc_evt_ring (for as many event rings as needed)
+ * gsi_write_evt_ring_scratch
+ *
+ * gsi_alloc_channel (for as many channels as needed; channels can have
+ * no event ring, an exclusive event ring or a shared event ring)
+ * gsi_write_channel_scratch
+ * gsi_start_channel
+ * gsi_queue_xfer/gsi_start_xfer
+ * gsi_config_channel_mode/gsi_poll_channel (if clients wants to poll on
+ * xfer completions)
+ * gsi_stop_db_channel/gsi_stop_channel
+ *
+ * gsi_dealloc_channel
+ *
+ * gsi_dealloc_evt_ring
+ *
+ * gsi_deregister_device
+ *
+ */
+#else
+static inline int gsi_register_device(struct gsi_per_props *props,
+ unsigned long *dev_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_complete_clk_grant(unsigned long dev_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_write_device_scratch(unsigned long dev_hdl,
+ struct gsi_device_scratch *val)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_deregister_device(unsigned long dev_hdl, bool force)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_alloc_evt_ring(struct gsi_evt_ring_props *props,
+ unsigned long dev_hdl,
+ unsigned long *evt_ring_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_write_evt_ring_scratch(unsigned long evt_ring_hdl,
+ union __packed gsi_evt_scratch val)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_dealloc_evt_ring(unsigned long evt_ring_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_query_evt_ring_db_addr(unsigned long evt_ring_hdl,
+ uint32_t *db_addr_wp_lsb, uint32_t *db_addr_wp_msb)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_reset_evt_ring(unsigned long evt_ring_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_alloc_channel(struct gsi_chan_props *props,
+ unsigned long dev_hdl,
+ unsigned long *chan_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_write_channel_scratch(unsigned long chan_hdl,
+ union __packed gsi_channel_scratch val)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_start_channel(unsigned long chan_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_stop_channel(unsigned long chan_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_reset_channel(unsigned long chan_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_dealloc_channel(unsigned long chan_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_stop_db_channel(unsigned long chan_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_query_channel_db_addr(unsigned long chan_hdl,
+ uint32_t *db_addr_wp_lsb, uint32_t *db_addr_wp_msb)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_query_channel_info(unsigned long chan_hdl,
+ struct gsi_chan_info *info)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_is_channel_empty(unsigned long chan_hdl, bool *is_empty)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_poll_channel(unsigned long chan_hdl,
+ struct gsi_chan_xfer_notify *notify)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_config_channel_mode(unsigned long chan_hdl,
+ enum gsi_chan_mode mode)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_queue_xfer(unsigned long chan_hdl, uint16_t num_xfers,
+ struct gsi_xfer_elem *xfer, bool ring_db)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_start_xfer(unsigned long chan_hdl)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_get_channel_cfg(unsigned long chan_hdl,
+ struct gsi_chan_props *props,
+ union gsi_channel_scratch *scr)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_set_channel_cfg(unsigned long chan_hdl,
+ struct gsi_chan_props *props,
+ union gsi_channel_scratch *scr)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_get_evt_ring_cfg(unsigned long evt_ring_hdl,
+ struct gsi_evt_ring_props *props, union gsi_evt_scratch *scr)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_set_evt_ring_cfg(unsigned long evt_ring_hdl,
+ struct gsi_evt_ring_props *props, union gsi_evt_scratch *scr)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+
+static inline int gsi_configure_regs(phys_addr_t gsi_base_addr, u32 gsi_size,
+ phys_addr_t per_base_addr)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+static inline int gsi_enable_fw(phys_addr_t gsi_base_addr, u32 gsi_size)
+{
+ return -GSI_STATUS_UNSUPPORTED_OP;
+}
+#endif
+#endif
diff --git a/include/linux/rndis_ipa.h b/include/linux/rndis_ipa.h
new file mode 100644
index 000000000000..14cce939d485
--- /dev/null
+++ b/include/linux/rndis_ipa.h
@@ -0,0 +1,102 @@
+/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _RNDIS_IPA_H_
+#define _RNDIS_IPA_H_
+
+#include <linux/ipa.h>
+
+/*
+ * @priv: private data given upon ipa_connect
+ * @evt: event enum, should be IPA_WRITE_DONE
+ * @data: for tx path the data field is the sent socket buffer.
+ */
+typedef void (*ipa_callback)(void *priv,
+ enum ipa_dp_evt_type evt,
+ unsigned long data);
+
+/*
+ * struct ipa_usb_init_params - parameters for driver initialization API
+ *
+ * @device_ready_notify: callback supplied by USB core driver
+ * This callback shall be called by the Netdev once the device
+ * is ready to recieve data from tethered PC.
+ * @ipa_rx_notify: The network driver will set this callback (out parameter).
+ * this callback shall be supplied for ipa_connect upon pipe
+ * connection (USB->IPA), once IPA driver receive data packets
+ * from USB pipe destined for Apps this callback will be called.
+ * @ipa_tx_notify: The network driver will set this callback (out parameter).
+ * this callback shall be supplied for ipa_connect upon pipe
+ * connection (IPA->USB), once IPA driver send packets destined
+ * for USB, IPA BAM will notify for Tx-complete.
+ * @host_ethaddr: host Ethernet address in network order
+ * @device_ethaddr: device Ethernet address in network order
+ * @private: The network driver will set this pointer (out parameter).
+ * This pointer will hold the network device for later interaction
+ * with between USB driver and the network driver.
+ * @skip_ep_cfg: boolean field that determines if Apps-processor
+ * should or should not configure this end-point.
+ */
+struct ipa_usb_init_params {
+ void (*device_ready_notify)(void);
+ ipa_callback ipa_rx_notify;
+ ipa_callback ipa_tx_notify;
+ u8 host_ethaddr[ETH_ALEN];
+ u8 device_ethaddr[ETH_ALEN];
+ void *private;
+ bool skip_ep_cfg;
+};
+
+#ifdef CONFIG_RNDIS_IPA
+
+int rndis_ipa_init(struct ipa_usb_init_params *params);
+
+int rndis_ipa_pipe_connect_notify(u32 usb_to_ipa_hdl,
+ u32 ipa_to_usb_hdl,
+ u32 max_xfer_size_bytes_to_dev,
+ u32 max_packet_number_to_dev,
+ u32 max_xfer_size_bytes_to_host,
+ void *private);
+
+int rndis_ipa_pipe_disconnect_notify(void *private);
+
+void rndis_ipa_cleanup(void *private);
+
+#else /* CONFIG_RNDIS_IPA*/
+
+int rndis_ipa_init(struct ipa_usb_init_params *params)
+{
+ return 0;
+}
+
+int rndis_ipa_pipe_connect_notify(u32 usb_to_ipa_hdl,
+ u32 ipa_to_usb_hdl,
+ u32 max_xfer_size_bytes_to_dev,
+ u32 max_packet_number_to_dev,
+ u32 max_xfer_size_bytes_to_host,
+ void *private)
+{
+ return 0;
+}
+
+static inline int rndis_ipa_pipe_disconnect_notify(void *private)
+{
+ return 0;
+}
+
+static inline void rndis_ipa_cleanup(void *private)
+{
+
+}
+#endif /* CONFIG_RNDIS_IPA */
+
+#endif /* _RNDIS_IPA_H_ */
diff --git a/include/uapi/linux/ipa_qmi_service_v01.h b/include/uapi/linux/ipa_qmi_service_v01.h
new file mode 100644
index 000000000000..c26a3ccf3645
--- /dev/null
+++ b/include/uapi/linux/ipa_qmi_service_v01.h
@@ -0,0 +1,1617 @@
+/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * This header file defines the types and structures that were defined in
+ * ipa. It contains the constant values defined, enums, structures,
+ * messages, and service message IDs (in that order) Structures that were
+ * defined in the IDL as messages contain mandatory elements, optional
+ * elements, a combination of mandatory and optional elements (mandatory
+ * always come before optionals in the structure), or nothing (null message)
+
+ * An optional element in a message is preceded by a uint8_t value that must be
+ * set to true if the element is going to be included. When decoding a received
+ * message, the uint8_t values will be set to true or false by the decode
+ * routine, and should be checked before accessing the values that they
+ * correspond to.
+
+ * Variable sized arrays are defined as static sized arrays with an unsigned
+ * integer (32 bit) preceding it that must be set to the number of elements
+ * in the array that are valid. For Example:
+
+ * uint32_t test_opaque_len;
+ * uint8_t test_opaque[16];
+
+ * If only 4 elements are added to test_opaque[] then test_opaque_len must be
+ * set to 4 before sending the message. When decoding, the _len value is set
+ * by the decode routine and should be checked so that the correct number of
+ * elements in the array will be accessed.
+ */
+#ifndef IPA_QMI_SERVICE_V01_H
+#define IPA_QMI_SERVICE_V01_H
+
+#define QMI_IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS_V01 2
+#define QMI_IPA_IPFLTR_NUM_MEQ_32_EQNS_V01 2
+#define QMI_IPA_IPFLTR_NUM_IHL_MEQ_32_EQNS_V01 2
+#define QMI_IPA_IPFLTR_NUM_MEQ_128_EQNS_V01 2
+#define QMI_IPA_MAX_FILTERS_V01 64
+#define QMI_IPA_MAX_PIPES_V01 20
+#define QMI_IPA_MAX_APN_V01 8
+
+#define IPA_INT_MAX ((int)(~0U>>1))
+#define IPA_INT_MIN (-IPA_INT_MAX - 1)
+
+/* IPA definition as msm_qmi_interface.h */
+
+enum ipa_qmi_result_type_v01 {
+ /* To force a 32 bit signed enum. Do not change or use*/
+ IPA_QMI_RESULT_TYPE_MIN_ENUM_VAL_V01 = IPA_INT_MIN,
+ IPA_QMI_RESULT_SUCCESS_V01 = 0,
+ IPA_QMI_RESULT_FAILURE_V01 = 1,
+ IPA_QMI_RESULT_TYPE_MAX_ENUM_VAL_V01 = IPA_INT_MAX,
+};
+
+enum ipa_qmi_error_type_v01 {
+ /* To force a 32 bit signed enum. Do not change or use*/
+ IPA_QMI_ERROR_TYPE_MIN_ENUM_VAL_V01 = IPA_INT_MIN,
+ IPA_QMI_ERR_NONE_V01 = 0x0000,
+ IPA_QMI_ERR_MALFORMED_MSG_V01 = 0x0001,
+ IPA_QMI_ERR_NO_MEMORY_V01 = 0x0002,
+ IPA_QMI_ERR_INTERNAL_V01 = 0x0003,
+ IPA_QMI_ERR_CLIENT_IDS_EXHAUSTED_V01 = 0x0005,
+ IPA_QMI_ERR_INVALID_ID_V01 = 0x0029,
+ IPA_QMI_ERR_ENCODING_V01 = 0x003A,
+ IPA_QMI_ERR_INCOMPATIBLE_STATE_V01 = 0x005A,
+ IPA_QMI_ERR_NOT_SUPPORTED_V01 = 0x005E,
+ IPA_QMI_ERROR_TYPE_MAX_ENUM_VAL_V01 = IPA_INT_MAX,
+};
+
+struct ipa_qmi_response_type_v01 {
+ enum ipa_qmi_result_type_v01 result;
+ enum ipa_qmi_error_type_v01 error;
+};
+
+enum ipa_platform_type_enum_v01 {
+ IPA_PLATFORM_TYPE_ENUM_MIN_ENUM_VAL_V01 =
+ -2147483647, /* To force a 32 bit signed enum. Do not change or use */
+ QMI_IPA_PLATFORM_TYPE_INVALID_V01 = 0,
+ /* Invalid platform identifier */
+ QMI_IPA_PLATFORM_TYPE_TN_V01 = 1,
+ /* Platform identifier - Data card device */
+ QMI_IPA_PLATFORM_TYPE_LE_V01 = 2,
+ /* Platform identifier - Data router device */
+ QMI_IPA_PLATFORM_TYPE_MSM_ANDROID_V01 = 3,
+ /* Platform identifier - MSM device with Android HLOS */
+ QMI_IPA_PLATFORM_TYPE_MSM_WINDOWS_V01 = 4,
+ /* Platform identifier - MSM device with Windows HLOS */
+ QMI_IPA_PLATFORM_TYPE_MSM_QNX_V01 = 5,
+ /* Platform identifier - MSM device with QNX HLOS */
+ IPA_PLATFORM_TYPE_ENUM_MAX_ENUM_VAL_V01 = 2147483647
+ /* To force a 32 bit signed enum. Do not change or use */
+};
+
+struct ipa_hdr_tbl_info_type_v01 {
+ uint32_t modem_offset_start;
+ /* Offset from the start of IPA Shared memory from which
+ * modem driver may insert header table entries.
+ */
+ uint32_t modem_offset_end;
+ /* Offset from the start of IPA shared mem beyond which modem
+ * driver shall not insert header table entries. The space
+ * available for the modem driver shall include the
+ * modem_offset_start and modem_offset_end.
+ */
+}; /* Type */
+
+struct ipa_route_tbl_info_type_v01 {
+ uint32_t route_tbl_start_addr;
+ /* Identifies the start of the routing table. Denotes the offset
+ * from the start of the IPA Shared Mem
+ */
+
+ uint32_t num_indices;
+ /* Number of indices (starting from 0) that is being allocated to
+ * the modem. The number indicated here is also included in the
+ * allocation. The value of num_indices shall not exceed 31
+ * (5 bits used to specify the routing table index), unless there
+ * is a change in the hardware.
+ */
+}; /* Type */
+
+struct ipa_modem_mem_info_type_v01 {
+
+ uint32_t block_start_addr;
+ /* Identifies the start of the memory block allocated for the
+ * modem. Denotes the offset from the start of the IPA Shared Mem
+ */
+
+ uint32_t size;
+ /* Size of the block allocated for the modem driver */
+}; /* Type */
+
+struct ipa_hdr_proc_ctx_tbl_info_type_v01 {
+
+ uint32_t modem_offset_start;
+ /* Offset from the start of IPA shared memory from which the modem
+ * driver may insert header processing context table entries.
+ */
+
+ uint32_t modem_offset_end;
+ /* Offset from the start of IPA shared memory beyond which the modem
+ * driver may not insert header proc table entries. The space
+ * available for the modem driver includes modem_offset_start and
+ * modem_offset_end.
+ */
+}; /* Type */
+
+struct ipa_zip_tbl_info_type_v01 {
+
+ uint32_t modem_offset_start;
+ /* Offset from the start of IPA shared memory from which the modem
+ * driver may insert compression/decompression command entries.
+ */
+
+ uint32_t modem_offset_end;
+ /* Offset from the start of IPA shared memory beyond which the modem
+ * driver may not insert compression/decompression command entries.
+ * The space available for the modem driver includes
+ * modem_offset_start and modem_offset_end.
+ */
+}; /* Type */
+
+/**
+ * Request Message; Requests the modem IPA driver
+ * to perform initializtion
+ */
+struct ipa_init_modem_driver_req_msg_v01 {
+
+ /* Optional */
+ /* Platform info */
+ uint8_t platform_type_valid; /**< Must be set to true if platform_type
+ is being passed */
+ enum ipa_platform_type_enum_v01 platform_type;
+ /* Provides information about the platform (ex. TN/MN/LE/MSM,etc) */
+
+ /* Optional */
+ /* Header table info */
+ uint8_t hdr_tbl_info_valid;
+ /* Must be set to true if hdr_tbl_info is being passed */
+ struct ipa_hdr_tbl_info_type_v01 hdr_tbl_info;
+ /* Provides information about the header table */
+
+ /* Optional */
+ /* IPV4 Routing table info */
+ uint8_t v4_route_tbl_info_valid;
+ /* Must be set to true if v4_route_tbl_info is being passed */
+ struct ipa_route_tbl_info_type_v01 v4_route_tbl_info;
+ /* Provides information about the IPV4 routing table */
+
+ /* Optional */
+ /* IPV6 Routing table info */
+ uint8_t v6_route_tbl_info_valid; /**< Must be set to true if
+ v6_route_tbl_info is being passed */
+ struct ipa_route_tbl_info_type_v01 v6_route_tbl_info;
+ /* Provides information about the IPV6 routing table */
+
+ /* Optional */
+ /* IPV4 Filter table start address */
+ uint8_t v4_filter_tbl_start_addr_valid; /**< Must be set to true
+ if v4_filter_tbl_start_addr is being passed */
+ uint32_t v4_filter_tbl_start_addr;
+ /* Provides information about the starting address of IPV4 filter
+ * table in IPAv2 or non-hashable IPv4 filter table in IPAv3.
+ * Denotes the offset from the start of the IPA Shared Mem
+ */
+
+ /* Optional */
+ /* IPV6 Filter table start address */
+ uint8_t v6_filter_tbl_start_addr_valid;
+ /* Must be set to true if v6_filter_tbl_start_addr is being passed */
+ uint32_t v6_filter_tbl_start_addr;
+ /* Provides information about the starting address of IPV6 filter
+ * table in IPAv2 or non-hashable IPv6 filter table in IPAv3.
+ * Denotes the offset from the start of the IPA Shared Mem
+ */
+
+ /* Optional */
+ /* Modem memory block */
+ uint8_t modem_mem_info_valid;
+ /* Must be set to true if modem_mem_info is being passed */
+ struct ipa_modem_mem_info_type_v01 modem_mem_info;
+ /* Provides information about the start address and the size of
+ * the memory block that is being allocated to the modem driver.
+ * Denotes the physical address
+ */
+
+ /* Optional */
+ /* Destination end point for control commands from modem */
+ uint8_t ctrl_comm_dest_end_pt_valid; /**< Must be set to true if
+ ctrl_comm_dest_end_pt is being passed */
+ uint32_t ctrl_comm_dest_end_pt;
+ /* Provides information about the destination end point on the
+ * application processor to which the modem driver can send
+ * control commands. The value of this parameter cannot exceed
+ * 19 since IPA only supports 20 end points.
+ */
+
+ /* Optional */
+ /* Modem Bootup Information */
+ uint8_t is_ssr_bootup_valid; /**< Must be set to true if
+ is_ssr_bootup is being passed */
+ uint8_t is_ssr_bootup;
+ /* Specifies whether the modem is booting up after a modem only
+ * sub-system restart or not. This will let the modem driver
+ * know that it doesn't have to reinitialize some of the HW
+ * blocks because IPA has not been reset since the previous
+ * initialization.
+ */
+
+ /* Optional */
+ /* Header Processing Context Table Information */
+ uint8_t hdr_proc_ctx_tbl_info_valid;
+ /* Must be set to true if hdr_proc_ctx_tbl_info is being passed */
+ struct ipa_hdr_proc_ctx_tbl_info_type_v01 hdr_proc_ctx_tbl_info;
+ /* Provides information about the header processing context table.
+ */
+
+ /* Optional */
+ /* Compression Decompression Table Information */
+ uint8_t zip_tbl_info_valid;
+ /* Must be set to true if zip_tbl_info is being passed */
+ struct ipa_zip_tbl_info_type_v01 zip_tbl_info;
+ /* Provides information about the zip table.
+ */
+
+ /* Optional */
+ /* IPv4 Hashable Routing Table Information */
+ /** Must be set to true if v4_hash_route_tbl_info is being passed */
+ uint8_t v4_hash_route_tbl_info_valid;
+ struct ipa_route_tbl_info_type_v01 v4_hash_route_tbl_info;
+
+ /* Optional */
+ /* IPv6 Hashable Routing Table Information */
+ /** Must be set to true if v6_hash_route_tbl_info is being passed */
+ uint8_t v6_hash_route_tbl_info_valid;
+ struct ipa_route_tbl_info_type_v01 v6_hash_route_tbl_info;
+
+ /* Optional */
+ /* IPv4 Hashable Filter Table Start Address */
+ /** Must be set to true if v4_hash_filter_tbl_start_addr
+ is being passed */
+ uint8_t v4_hash_filter_tbl_start_addr_valid;
+ uint32_t v4_hash_filter_tbl_start_addr;
+ /** Identifies the starting address of the IPv4 hashable filter
+ table in IPAv3 onwards. Denotes the offset from the start of
+ the IPA shared memory.
+ */
+
+ /* Optional */
+ /* IPv6 Hashable Filter Table Start Address */
+ /** Must be set to true if v6_hash_filter_tbl_start_addr
+ is being passed */
+ uint8_t v6_hash_filter_tbl_start_addr_valid;
+ uint32_t v6_hash_filter_tbl_start_addr;
+ /** Identifies the starting address of the IPv6 hashable filter
+ table in IPAv3 onwards. Denotes the offset from the start of
+ the IPA shared memory.
+ */
+}; /* Message */
+
+/* Response Message; Requests the modem IPA driver about initialization */
+struct ipa_init_modem_driver_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /* Standard response type.*/
+
+ /* Optional */
+ /* Destination end point for control commands from master driver */
+ uint8_t ctrl_comm_dest_end_pt_valid;
+ /* Must be set to true if ctrl_comm_dest_ep is being passed */
+ uint32_t ctrl_comm_dest_end_pt;
+ /* Provides information about the destination end point on the
+ * modem processor to which the master driver can send control
+ * commands. The value of this parameter cannot exceed 19 since
+ * IPA only supports 20 end points. This field is looked at only
+ * if the result in TLV RESULT_CODE is QMI_RESULT_SUCCESS
+ */
+
+ /* Optional */
+ /* Default end point */
+ uint8_t default_end_pt_valid;
+ /* Must be set to true if default_end_pt is being passed */
+ uint32_t default_end_pt;
+ /* Provides information about the default end point. The master
+ * driver may or may not set the register in the hardware with
+ * this value. The value of this parameter cannot exceed 19
+ * since IPA only supports 20 end points. This field is looked
+ * at only if the result in TLV RESULT_CODE is QMI_RESULT_SUCCESS
+ */
+
+ /* Optional */
+ /* Modem Driver Initialization Pending */
+ uint8_t modem_driver_init_pending_valid;
+ /* Must be set to true if modem_driver_init_pending is being passed */
+ uint8_t modem_driver_init_pending;
+ /*
+ * Identifies if second level message handshake is needed
+ * between drivers to indicate when IPA HWP loading is completed.
+ * If this is set by modem driver, AP driver will need to wait
+ * for a INIT_MODEM_DRIVER_CMPLT message before communicating with
+ * IPA HWP.
+ */
+}; /* Message */
+
+/*
+ * Request Message; Request from Modem IPA driver to indicate
+ * modem driver init completion
+ */
+struct ipa_init_modem_driver_cmplt_req_msg_v01 {
+ /* Mandatory */
+ /* Modem Driver init complete status; */
+ uint8_t status;
+ /*
+ * Specifies whether the modem driver initialization is complete
+ * including the micro controller image loading.
+ */
+}; /* Message */
+
+/*
+ * Response Message; Request from Modem IPA driver to indicate
+ * modem driver init completion
+ */
+struct ipa_init_modem_driver_cmplt_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /**< Standard response type.*/
+}; /* Message */
+
+/* Request Message; This is the message that is exchanged between the
+ * control point and the service in order to register for indications.
+ */
+struct ipa_indication_reg_req_msg_v01 {
+ /* Optional */
+ /* Master driver initialization completion */
+ uint8_t master_driver_init_complete_valid;
+ /* Must be set to true if master_driver_init_complete is being passed */
+ uint8_t master_driver_init_complete;
+ /* If set to TRUE, this field indicates that the client is
+ * interested in getting indications about the completion
+ * of the initialization sequence of the master driver.
+ * Setting this field in the request message makes sense
+ * only when the QMI_IPA_INDICATION_REGISTER_REQ is being
+ * originated from the modem driver
+ */
+
+ /* Optional */
+ /* Data Usage Quota Reached */
+ uint8_t data_usage_quota_reached_valid;
+ /* Must be set to true if data_usage_quota_reached is being passed */
+ uint8_t data_usage_quota_reached;
+ /* If set to TRUE, this field indicates that the client wants to
+ * receive indications about reaching the data usage quota that
+ * previously set via QMI_IPA_SET_DATA_USAGE_QUOTA. Setting this field
+ * in the request message makes sense only when the
+ * QMI_IPA_INDICATION_REGISTER_REQ is being originated from the Master
+ * driver
+ */
+}; /* Message */
+
+
+/* Response Message; This is the message that is exchanged between the
+ * control point and the service in order to register for indications.
+ */
+struct ipa_indication_reg_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /**< Standard response type.*/
+}; /* Message */
+
+
+/* Indication Message; Indication sent to the Modem IPA driver from
+ * master IPA driver about initialization being complete.
+ */
+struct ipa_master_driver_init_complt_ind_msg_v01 {
+ /* Mandatory */
+ /* Master driver initialization completion status */
+ struct ipa_qmi_response_type_v01 master_driver_init_status;
+ /* Indicates the status of initialization. If everything went
+ * as expected, this field is set to SUCCESS. ERROR is set
+ * otherwise. Extended error info may be used to convey
+ * additional information about the error
+ */
+}; /* Message */
+
+struct ipa_ipfltr_range_eq_16_type_v01 {
+ uint8_t offset;
+ /* Specifies the offset from the IHL (Internet Header length) */
+
+ uint16_t range_low;
+ /* Specifies the lower bound of the range */
+
+ uint16_t range_high;
+ /* Specifies the upper bound of the range */
+}; /* Type */
+
+struct ipa_ipfltr_mask_eq_32_type_v01 {
+ uint8_t offset;
+ /* Specifies the offset either from IHL or from the start of
+ * the IP packet. This depends on the equation that this structure
+ * is used in.
+ */
+
+ uint32_t mask;
+ /* Specifies the mask that has to be used in the comparison.
+ * The field is ANDed with the mask and compared against the value.
+ */
+
+ uint32_t value;
+ /* Specifies the 32 bit value that used in the comparison. */
+}; /* Type */
+
+struct ipa_ipfltr_eq_16_type_v01 {
+ uint8_t offset;
+ /* Specifies the offset into the packet */
+
+ uint16_t value;
+ /* Specifies the 16 bit value that should be used in the comparison. */
+}; /* Type */
+
+struct ipa_ipfltr_eq_32_type_v01 {
+ uint8_t offset;
+ /* Specifies the offset into the packet */
+
+ uint32_t value;
+ /* Specifies the 32 bit value that should be used in the comparison. */
+}; /* Type */
+
+struct ipa_ipfltr_mask_eq_128_type_v01 {
+ uint8_t offset;
+ /* Specifies the offset into the packet */
+
+ uint8_t mask[16];
+ /* Specifies the mask that has to be used in the comparison.
+ * The field is ANDed with the mask and compared against the value.
+ */
+
+ uint8_t value[16];
+ /* Specifies the 128 bit value that should be used in the comparison. */
+}; /* Type */
+
+
+struct ipa_filter_rule_type_v01 {
+ uint16_t rule_eq_bitmap;
+ /* 16-bit Bitmask to indicate how many eqs are valid in this rule */
+
+ uint8_t tos_eq_present;
+ /* Specifies if a type of service check rule is present */
+
+ uint8_t tos_eq;
+ /* The value to check against the type of service (ipv4) field */
+
+ uint8_t protocol_eq_present;
+ /* Specifies if a protocol check rule is present */
+
+ uint8_t protocol_eq;
+ /* The value to check against the protocol field */
+
+ uint8_t num_ihl_offset_range_16;
+ /* The number of 16 bit range check rules at the location
+ * determined by IP header length plus a given offset offset
+ * in this rule. See the definition of the ipa_filter_range_eq_16
+ * for better understanding. The value of this field cannot exceed
+ * IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS which is set as 2
+ */
+
+ struct ipa_ipfltr_range_eq_16_type_v01
+ ihl_offset_range_16[QMI_IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS_V01];
+ /* Array of the registered IP header length offset 16 bit range
+ * check rules.
+ */
+
+ uint8_t num_offset_meq_32;
+ /* The number of 32 bit masked comparison rules present
+ * in this rule
+ */
+
+ struct ipa_ipfltr_mask_eq_32_type_v01
+ offset_meq_32[QMI_IPA_IPFLTR_NUM_MEQ_32_EQNS_V01];
+ /* An array of all the possible 32bit masked comparison rules
+ * in this rule
+ */
+
+ uint8_t tc_eq_present;
+ /* Specifies if the traffic class rule is present in this rule */
+
+ uint8_t tc_eq;
+ /* The value against which the IPV4 traffic class field has to
+ be checked */
+
+ uint8_t flow_eq_present;
+ /* Specifies if the "flow equals" rule is present in this rule */
+
+ uint32_t flow_eq;
+ /* The value against which the IPV6 flow field has to be checked */
+
+ uint8_t ihl_offset_eq_16_present;
+ /* Specifies if there is a 16 bit comparison required at the
+ * location in the packet determined by "Intenet Header length
+ * + specified offset"
+ */
+
+ struct ipa_ipfltr_eq_16_type_v01 ihl_offset_eq_16;
+ /* The 16 bit comparison equation */
+
+ uint8_t ihl_offset_eq_32_present;
+ /* Specifies if there is a 32 bit comparison required at the
+ * location in the packet determined by "Intenet Header length
+ * + specified offset"
+ */
+
+ struct ipa_ipfltr_eq_32_type_v01 ihl_offset_eq_32;
+ /* The 32 bit comparison equation */
+
+ uint8_t num_ihl_offset_meq_32;
+ /* The number of 32 bit masked comparison equations in this
+ * rule. The location of the packet to be compared is
+ * determined by the IP Header length + the give offset
+ */
+
+ struct ipa_ipfltr_mask_eq_32_type_v01
+ ihl_offset_meq_32[QMI_IPA_IPFLTR_NUM_IHL_MEQ_32_EQNS_V01];
+ /* Array of 32 bit masked comparison equations.
+ */
+
+ uint8_t num_offset_meq_128;
+ /* The number of 128 bit comparison equations in this rule */
+
+ struct ipa_ipfltr_mask_eq_128_type_v01
+ offset_meq_128[QMI_IPA_IPFLTR_NUM_MEQ_128_EQNS_V01];
+ /* Array of 128 bit comparison equations. The location in the
+ * packet is determined by the specified offset
+ */
+
+ uint8_t metadata_meq32_present;
+ /* Boolean indicating if the 32 bit masked comparison equation
+ * is present or not. Comparison is done against the metadata
+ * in IPA. Metadata can either be extracted from the packet
+ * header or from the "metadata" register.
+ */
+
+ struct ipa_ipfltr_mask_eq_32_type_v01
+ metadata_meq32;
+ /* The metadata 32 bit masked comparison equation */
+
+ uint8_t ipv4_frag_eq_present;
+ /* Specifies if the IPv4 Fragment equation is present in this rule */
+}; /* Type */
+
+
+enum ipa_ip_type_enum_v01 {
+ IPA_IP_TYPE_ENUM_MIN_ENUM_VAL_V01 = -2147483647,
+ /* To force a 32 bit signed enum. Do not change or use*/
+ QMI_IPA_IP_TYPE_INVALID_V01 = 0,
+ /* Invalid IP type identifier */
+ QMI_IPA_IP_TYPE_V4_V01 = 1,
+ /* IP V4 type */
+ QMI_IPA_IP_TYPE_V6_V01 = 2,
+ /* IP V6 type */
+ QMI_IPA_IP_TYPE_V4V6_V01 = 3,
+ /* Applies to both IP types */
+ IPA_IP_TYPE_ENUM_MAX_ENUM_VAL_V01 = 2147483647
+ /* To force a 32 bit signed enum. Do not change or use*/
+};
+
+
+enum ipa_filter_action_enum_v01 {
+ IPA_FILTER_ACTION_ENUM_MIN_ENUM_VAL_V01 = -2147483647,
+ /* To force a 32 bit signed enum. Do not change or use */
+ QMI_IPA_FILTER_ACTION_INVALID_V01 = 0,
+ /* Invalid action on filter hit */
+ QMI_IPA_FILTER_ACTION_SRC_NAT_V01 = 1,
+ /* Pass packet to NAT block for Source NAT */
+ QMI_IPA_FILTER_ACTION_DST_NAT_V01 = 2,
+ /* Pass packet to NAT block for Destination NAT */
+ QMI_IPA_FILTER_ACTION_ROUTING_V01 = 3,
+ /* Pass packet to Routing block */
+ QMI_IPA_FILTER_ACTION_EXCEPTION_V01 = 4,
+ /* Treat packet as exception and send to exception pipe */
+ IPA_FILTER_ACTION_ENUM_MAX_ENUM_VAL_V01 = 2147483647
+ /* To force a 32 bit signed enum. Do not change or use*/
+};
+
+struct ipa_filter_spec_type_v01 {
+ uint32_t filter_spec_identifier;
+ /* This field is used to identify a filter spec in the list
+ * of filter specs being sent from the client. This field
+ * is applicable only in the filter install request and response.
+ */
+
+ enum ipa_ip_type_enum_v01 ip_type;
+ /* This field identifies the IP type for which this rule is
+ * applicable. The driver needs to identify the filter table
+ * (V6 or V4) and this field is essential for that
+ */
+
+ struct ipa_filter_rule_type_v01 filter_rule;
+ /* This field specifies the rules in the filter spec. These rules
+ * are the ones that are matched against fields in the packet.
+ */
+
+ enum ipa_filter_action_enum_v01 filter_action;
+ /* This field specifies the action to be taken when a filter match
+ * occurs. The remote side should install this information into the
+ * hardware along with the filter equations.
+ */
+
+ uint8_t is_routing_table_index_valid;
+ /* Specifies whether the routing table index is present or not.
+ * If the action is "QMI_IPA_FILTER_ACTION_EXCEPTION", this
+ * parameter need not be provided.
+ */
+
+ uint32_t route_table_index;
+ /* This is the index in the routing table that should be used
+ * to route the packets if the filter rule is hit
+ */
+
+ uint8_t is_mux_id_valid;
+ /* Specifies whether the mux_id is valid */
+
+ uint32_t mux_id;
+ /* This field identifies the QMAP MUX ID. As a part of QMAP
+ * protocol, several data calls may be multiplexed over the
+ * same physical transport channel. This identifier is used to
+ * identify one such data call. The maximum value for this
+ * identifier is 255.
+ */
+}; /* Type */
+
+struct ipa_filter_spec_ex_type_v01 {
+ enum ipa_ip_type_enum_v01 ip_type;
+ /* This field identifies the IP type for which this rule is
+ * applicable. The driver needs to identify the filter table
+ * (V6 or V4) and this field is essential for that
+ */
+
+ struct ipa_filter_rule_type_v01 filter_rule;
+ /* This field specifies the rules in the filter spec. These rules
+ * are the ones that are matched against fields in the packet.
+ */
+
+ enum ipa_filter_action_enum_v01 filter_action;
+ /* This field specifies the action to be taken when a filter match
+ * occurs. The remote side should install this information into the
+ * hardware along with the filter equations.
+ */
+
+ uint8_t is_routing_table_index_valid;
+ /* Specifies whether the routing table index is present or not.
+ * If the action is "QMI_IPA_FILTER_ACTION_EXCEPTION", this
+ * parameter need not be provided.
+ */
+
+ uint32_t route_table_index;
+ /* This is the index in the routing table that should be used
+ * to route the packets if the filter rule is hit
+ */
+
+ uint8_t is_mux_id_valid;
+ /* Specifies whether the mux_id is valid */
+
+ uint32_t mux_id;
+ /* This field identifies the QMAP MUX ID. As a part of QMAP
+ * protocol, several data calls may be multiplexed over the
+ * same physical transport channel. This identifier is used to
+ * identify one such data call. The maximum value for this
+ * identifier is 255.
+ */
+
+ uint32_t rule_id;
+ /** Rule Id of the given filter. The Rule Id is populated in the rule
+ header when installing the rule in IPA.
+ */
+
+ uint8_t is_rule_hashable;
+ /** Specifies whether the given rule is hashable.
+ */
+}; /* Type */
+
+
+/* Request Message; This is the message that is exchanged between the
+ * control point and the service in order to request the installation
+ * of filtering rules in the hardware block by the remote side.
+ */
+struct ipa_install_fltr_rule_req_msg_v01 {
+ /* Optional */
+ /* IP type that this rule applies to
+ Filter specification to be installed in the hardware */
+ uint8_t filter_spec_list_valid;
+ /* Must be set to true if filter_spec_list is being passed */
+ uint32_t filter_spec_list_len;
+ /* Must be set to # of elements in filter_spec_list */
+ struct ipa_filter_spec_type_v01
+ filter_spec_list[QMI_IPA_MAX_FILTERS_V01];
+ /* This structure defines the list of filters that have
+ * to be installed in the hardware. The driver installing
+ * these rules shall do so in the same order as specified
+ * in this list.
+ */
+
+ /* Optional */
+ /* Pipe index to intall rule */
+ uint8_t source_pipe_index_valid;
+ /* Must be set to true if source_pipe_index is being passed */
+ uint32_t source_pipe_index;
+ /* This is the source pipe on which the filter rule is to be
+ * installed. The requestor may always not know the pipe
+ * indices. If not specified, the receiver shall install
+ * this rule on all the pipes that it controls through
+ * which data may be fed into IPA.
+ */
+
+ /* Optional */
+ /* Total number of IPv4 filters in the filter spec list */
+ uint8_t num_ipv4_filters_valid;
+ /* Must be set to true if num_ipv4_filters is being passed */
+ uint32_t num_ipv4_filters;
+ /* Number of IPv4 rules included in filter spec list */
+
+ /* Optional */
+ /* Total number of IPv6 filters in the filter spec list */
+ uint8_t num_ipv6_filters_valid;
+ /* Must be set to true if num_ipv6_filters is being passed */
+ uint32_t num_ipv6_filters;
+ /* Number of IPv6 rules included in filter spec list */
+
+ /* Optional */
+ /* List of XLAT filter indices in the filter spec list */
+ uint8_t xlat_filter_indices_list_valid;
+ /* Must be set to true if xlat_filter_indices_list
+ * is being passed
+ */
+ uint32_t xlat_filter_indices_list_len;
+ /* Must be set to # of elements in xlat_filter_indices_list */
+ uint32_t xlat_filter_indices_list[QMI_IPA_MAX_FILTERS_V01];
+ /* List of XLAT filter indices. Filter rules at specified indices
+ * will need to be modified by the receiver if the PDN is XLAT
+ * before installing them on the associated IPA consumer pipe.
+ */
+
+ /* Optional */
+ /* Extended Filter Specification */
+ uint8_t filter_spec_ex_list_valid;
+ /* Must be set to true if filter_spec_ex_list is being passed */
+ uint32_t filter_spec_ex_list_len;
+ /* Must be set to # of elements in filter_spec_ex_list */
+ struct ipa_filter_spec_ex_type_v01
+ filter_spec_ex_list[QMI_IPA_MAX_FILTERS_V01];
+ /*
+ * List of filter specifications of filters that must be installed in
+ * the IPAv3.x hardware.
+ * The driver installing these rules must do so in the same
+ * order as specified in this list.
+ */
+}; /* Message */
+
+struct ipa_filter_rule_identifier_to_handle_map_v01 {
+ uint32_t filter_spec_identifier;
+ /* This field is used to identify a filter spec in the list of
+ * filter specs being sent from the client. This field is
+ * applicable only in the filter install request and response.
+ */
+ uint32_t filter_handle;
+ /* This field is used to identify a rule in any subsequent message.
+ * This is a value that is provided by the server to the control
+ * point
+ */
+}; /* Type */
+
+/* Response Message; This is the message that is exchanged between the
+ * control point and the service in order to request the
+ * installation of filtering rules in the hardware block by
+ * the remote side.
+ */
+struct ipa_install_fltr_rule_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /* Standard response type.
+ * Standard response type. Contains the following data members:
+ * - qmi_result_type -- QMI_RESULT_SUCCESS or QMI_RESULT_FAILURE
+ * - qmi_error_type -- Error code. Possible error code values are
+ * described in the error codes section of each message definition.
+ */
+
+ /* Optional */
+ /* Filter Handle List */
+ uint8_t filter_handle_list_valid;
+ /* Must be set to true if filter_handle_list is being passed */
+ uint32_t filter_handle_list_len;
+ /* Must be set to # of elements in filter_handle_list */
+ struct ipa_filter_rule_identifier_to_handle_map_v01
+ filter_handle_list[QMI_IPA_MAX_FILTERS_V01];
+ /*
+ * List of handles returned to the control point. Each handle is
+ * mapped to the rule identifier that was specified in the
+ * request message. Any further reference to the rule is done
+ * using the filter handle.
+ */
+
+ /* Optional */
+ /* Rule id List */
+ uint8_t rule_id_valid;
+ /* Must be set to true if rule_id is being passed */
+ uint32_t rule_id_len;
+ /* Must be set to # of elements in rule_id */
+ uint32_t rule_id[QMI_IPA_MAX_FILTERS_V01];
+ /*
+ * List of rule ids returned to the control point.
+ * Any further reference to the rule is done using the
+ * filter rule id specified in this list.
+ */
+}; /* Message */
+
+struct ipa_filter_handle_to_index_map_v01 {
+ uint32_t filter_handle;
+ /* This is a handle that was given to the remote client that
+ * requested the rule addition.
+ */
+ uint32_t filter_index;
+ /* This index denotes the location in a filter table, where the
+ * filter rule has been installed. The maximum value of this
+ * field is 64.
+ */
+}; /* Type */
+
+/* Request Message; This is the message that is exchanged between the
+ * control point and the service in order to notify the remote driver
+ * of the installation of the filter rule supplied earlier by the
+ * remote driver.
+ */
+struct ipa_fltr_installed_notif_req_msg_v01 {
+ /* Mandatory */
+ /* Pipe index */
+ uint32_t source_pipe_index;
+ /* This is the source pipe on which the filter rule has been
+ * installed or was attempted to be installed
+ */
+
+ /* Mandatory */
+ /* Installation Status */
+ enum ipa_qmi_result_type_v01 install_status;
+ /* This is the status of installation. If this indicates
+ * SUCCESS, other optional fields carry additional
+ * information
+ */
+
+ /* Mandatory */
+ /* List of Filter Indices */
+ uint32_t filter_index_list_len;
+ /* Must be set to # of elements in filter_index_list */
+ struct ipa_filter_handle_to_index_map_v01
+ filter_index_list[QMI_IPA_MAX_FILTERS_V01];
+ /*
+ * Provides the list of filter indices and the corresponding
+ * filter handle. If the installation_status indicates a
+ * failure, the filter indices must be set to a reserve
+ * index (255).
+ */
+
+ /* Optional */
+ /* Embedded pipe index */
+ uint8_t embedded_pipe_index_valid;
+ /* Must be set to true if embedded_pipe_index is being passed */
+ uint32_t embedded_pipe_index;
+ /* This index denotes the embedded pipe number on which a call to
+ * the same PDN has been made. If this field is set, it denotes
+ * that this is a use case where PDN sharing is happening. The
+ * embedded pipe is used to send data from the embedded client
+ * in the device
+ */
+
+ /* Optional */
+ /* Retain Header Configuration */
+ uint8_t retain_header_valid;
+ /* Must be set to true if retain_header is being passed */
+ uint8_t retain_header;
+ /* This field indicates if the driver installing the rule has
+ * turned on the "retain header" bit. If this is true, the
+ * header that is removed by IPA is reinserted after the
+ * packet processing is completed.
+ */
+
+ /* Optional */
+ /* Embedded call Mux Id */
+ uint8_t embedded_call_mux_id_valid;
+ /**< Must be set to true if embedded_call_mux_id is being passed */
+ uint32_t embedded_call_mux_id;
+ /* This identifies one of the many calls that have been originated
+ * on the embedded pipe. This is how we identify the PDN gateway
+ * to which traffic from the source pipe has to flow.
+ */
+
+ /* Optional */
+ /* Total number of IPv4 filters in the filter index list */
+ uint8_t num_ipv4_filters_valid;
+ /* Must be set to true if num_ipv4_filters is being passed */
+ uint32_t num_ipv4_filters;
+ /* Number of IPv4 rules included in filter index list */
+
+ /* Optional */
+ /* Total number of IPv6 filters in the filter index list */
+ uint8_t num_ipv6_filters_valid;
+ /* Must be set to true if num_ipv6_filters is being passed */
+ uint32_t num_ipv6_filters;
+ /* Number of IPv6 rules included in filter index list */
+
+ /* Optional */
+ /* Start index on IPv4 filters installed on source pipe */
+ uint8_t start_ipv4_filter_idx_valid;
+ /* Must be set to true if start_ipv4_filter_idx is being passed */
+ uint32_t start_ipv4_filter_idx;
+ /* Start index of IPv4 rules in filter index list */
+
+ /* Optional */
+ /* Start index on IPv6 filters installed on source pipe */
+ uint8_t start_ipv6_filter_idx_valid;
+ /* Must be set to true if start_ipv6_filter_idx is being passed */
+ uint32_t start_ipv6_filter_idx;
+ /* Start index of IPv6 rules in filter index list */
+
+ /* Optional */
+ /* List of Rule Ids */
+ uint8_t rule_id_valid;
+ /* Must be set to true if rule_id is being passed */
+ uint32_t rule_id_len;
+ /* Must be set to # of elements in rule_id */
+ uint32_t rule_id[QMI_IPA_MAX_FILTERS_V01];
+ /*
+ * Provides the list of Rule Ids of rules added in IPA on the given
+ * source pipe index. If the install_status TLV indicates a
+ * failure, the Rule Ids in this list must be set to a reserved
+ * index (255).
+ */
+}; /* Message */
+
+/* Response Message; This is the message that is exchanged between the
+ * control point and the service in order to notify the remote driver
+ * of the installation of the filter rule supplied earlier by the
+ * remote driver.
+ */
+struct ipa_fltr_installed_notif_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /* Standard response type */
+}; /* Message */
+
+/* Request Message; Notifies the remote driver of the need to clear the data
+ * path to prevent the IPA from being blocked at the head of the processing
+ * pipeline
+ */
+struct ipa_enable_force_clear_datapath_req_msg_v01 {
+ /* Mandatory */
+ /* Pipe Mask */
+ uint32_t source_pipe_bitmask;
+ /* Set of consumer (source) pipes that must be clear of
+ * active data transfers.
+ */
+
+ /* Mandatory */
+ /* Request ID */
+ uint32_t request_id;
+ /* Identifies the ID of the request that is sent to the server
+ * The same request ID is used in the message to remove the force_clear
+ * request. The server is expected to keep track of the request ID and
+ * the source_pipe_bitmask so that it can revert as needed
+ */
+
+ /* Optional */
+ /* Source Throttle State */
+ uint8_t throttle_source_valid;
+ /* Must be set to true if throttle_source is being passed */
+ uint8_t throttle_source;
+ /* Specifies whether the server is to throttle the data from
+ * these consumer (source) pipes after clearing the exisiting
+ * data present in the IPA that were pulled from these pipes
+ * The server is expected to put all the source pipes in the
+ * source_pipe_bitmask in the same state
+ */
+}; /* Message */
+
+/* Response Message; Notifies the remote driver of the need to clear the
+ * data path to prevent the IPA from being blocked at the head of the
+ * processing pipeline
+ */
+struct ipa_enable_force_clear_datapath_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /* Standard response type */
+}; /* Message */
+
+/* Request Message; Notifies the remote driver that the forceful clearing
+ * of the data path can be lifted
+ */
+struct ipa_disable_force_clear_datapath_req_msg_v01 {
+ /* Mandatory */
+ /* Request ID */
+ uint32_t request_id;
+ /* Identifies the request that was sent to the server to
+ * forcibly clear the data path. This request simply undoes
+ * the operation done in that request
+ */
+}; /* Message */
+
+/* Response Message; Notifies the remote driver that the forceful clearing
+ * of the data path can be lifted
+ */
+struct ipa_disable_force_clear_datapath_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /* Standard response type */
+}; /* Message */
+
+enum ipa_peripheral_speed_enum_v01 {
+ IPA_PERIPHERAL_SPEED_ENUM_MIN_ENUM_VAL_V01 = -2147483647,
+ /* To force a 32 bit signed enum. Do not change or use */
+ QMI_IPA_PER_USB_FS_V01 = 1,
+ /* Full-speed USB connection */
+ QMI_IPA_PER_USB_HS_V01 = 2,
+ /* High-speed USB connection */
+ QMI_IPA_PER_USB_SS_V01 = 3,
+ /* Super-speed USB connection */
+ QMI_IPA_PER_WLAN_V01 = 4,
+ /* WLAN connection */
+ IPA_PERIPHERAL_SPEED_ENUM_MAX_ENUM_VAL_V01 = 2147483647
+ /* To force a 32 bit signed enum. Do not change or use*/
+};
+
+enum ipa_pipe_mode_enum_v01 {
+ IPA_PIPE_MODE_ENUM_MIN_ENUM_VAL_V01 = -2147483647,
+ /* To force a 32 bit signed enum. Do not change or use */
+ QMI_IPA_PIPE_MODE_HW_V01 = 1,
+ /* Pipe is connected with a hardware block */
+ QMI_IPA_PIPE_MODE_SW_V01 = 2,
+ /* Pipe is controlled by the software */
+ IPA_PIPE_MODE_ENUM_MAX_ENUM_VAL_V01 = 2147483647
+ /* To force a 32 bit signed enum. Do not change or use */
+};
+
+enum ipa_peripheral_type_enum_v01 {
+ IPA_PERIPHERAL_TYPE_ENUM_MIN_ENUM_VAL_V01 = -2147483647,
+ /* To force a 32 bit signed enum. Do not change or use */
+ QMI_IPA_PERIPHERAL_USB_V01 = 1,
+ /* Specifies a USB peripheral */
+ QMI_IPA_PERIPHERAL_HSIC_V01 = 2,
+ /* Specifies an HSIC peripheral */
+ QMI_IPA_PERIPHERAL_PCIE_V01 = 3,
+ /* Specifies a PCIe peripheral */
+ IPA_PERIPHERAL_TYPE_ENUM_MAX_ENUM_VAL_V01 = 2147483647
+ /* To force a 32 bit signed enum. Do not change or use */
+};
+
+struct ipa_config_req_msg_v01 {
+ /* Optional */
+ /* Peripheral Type */
+ uint8_t peripheral_type_valid;
+ /* Must be set to true if peripheral_type is being passed */
+ enum ipa_peripheral_type_enum_v01 peripheral_type;
+ /* Informs the remote driver about the perhipheral for
+ * which this configuration information is relevant. Values:
+ * - QMI_IPA_PERIPHERAL_USB (1) -- Specifies a USB peripheral
+ * - QMI_IPA_PERIPHERAL_HSIC(2) -- Specifies an HSIC peripheral
+ * - QMI_IPA_PERIPHERAL_PCIE(3) -- Specifies a PCIe peripheral
+ */
+
+ /* Optional */
+ /* HW Deaggregation Support */
+ uint8_t hw_deaggr_supported_valid;
+ /* Must be set to true if hw_deaggr_supported is being passed */
+ uint8_t hw_deaggr_supported;
+ /* Informs the remote driver whether the local IPA driver
+ * allows de-aggregation to be performed in the hardware
+ */
+
+ /* Optional */
+ /* Maximum Aggregation Frame Size */
+ uint8_t max_aggr_frame_size_valid;
+ /* Must be set to true if max_aggr_frame_size is being passed */
+ uint32_t max_aggr_frame_size;
+ /* Specifies the maximum size of the aggregated frame that
+ * the remote driver can expect from this execution environment
+ * - Valid range: 128 bytes to 32768 bytes
+ */
+
+ /* Optional */
+ /* IPA Ingress Pipe Mode */
+ uint8_t ipa_ingress_pipe_mode_valid;
+ /* Must be set to true if ipa_ingress_pipe_mode is being passed */
+
+ enum ipa_pipe_mode_enum_v01 ipa_ingress_pipe_mode;
+ /* Indicates to the remote driver if the ingress pipe into the
+ * IPA is in direct connection with another hardware block or
+ * if the producer of data to this ingress pipe is a software
+ * module. Values:
+ * -QMI_IPA_PIPE_MODE_HW(1) --Pipe is connected with hardware block
+ * -QMI_IPA_PIPE_MODE_SW(2) --Pipe is controlled by the software
+ */
+
+ /* Optional */
+ /* Peripheral Speed Info */
+ uint8_t peripheral_speed_info_valid;
+ /* Must be set to true if peripheral_speed_info is being passed */
+
+ enum ipa_peripheral_speed_enum_v01 peripheral_speed_info;
+ /* Indicates the speed that the peripheral connected to the IPA supports
+ * Values:
+ * - QMI_IPA_PER_USB_FS (1) -- Full-speed USB connection
+ * - QMI_IPA_PER_USB_HS (2) -- High-speed USB connection
+ * - QMI_IPA_PER_USB_SS (3) -- Super-speed USB connection
+ * - QMI_IPA_PER_WLAN (4) -- WLAN connection
+ */
+
+ /* Optional */
+ /* Downlink Accumulation Time limit */
+ uint8_t dl_accumulation_time_limit_valid;
+ /* Must be set to true if dl_accumulation_time_limit is being passed */
+ uint32_t dl_accumulation_time_limit;
+ /* Informs the remote driver about the time for which data
+ * is accumulated in the downlink direction before it is pushed into the
+ * IPA (downlink is with respect to the WWAN air interface)
+ * - Units: milliseconds
+ * - Maximum value: 255
+ */
+
+ /* Optional */
+ /* Downlink Accumulation Packet limit */
+ uint8_t dl_accumulation_pkt_limit_valid;
+ /* Must be set to true if dl_accumulation_pkt_limit is being passed */
+ uint32_t dl_accumulation_pkt_limit;
+ /* Informs the remote driver about the number of packets
+ * that are to be accumulated in the downlink direction before it is
+ * pushed into the IPA - Maximum value: 1023
+ */
+
+ /* Optional */
+ /* Downlink Accumulation Byte Limit */
+ uint8_t dl_accumulation_byte_limit_valid;
+ /* Must be set to true if dl_accumulation_byte_limit is being passed */
+ uint32_t dl_accumulation_byte_limit;
+ /* Inform the remote driver about the number of bytes
+ * that are to be accumulated in the downlink direction before it
+ * is pushed into the IPA - Maximum value: TBD
+ */
+
+ /* Optional */
+ /* Uplink Accumulation Time Limit */
+ uint8_t ul_accumulation_time_limit_valid;
+ /* Must be set to true if ul_accumulation_time_limit is being passed */
+ uint32_t ul_accumulation_time_limit;
+ /* Inform thes remote driver about the time for which data
+ * is to be accumulated in the uplink direction before it is pushed into
+ * the IPA (downlink is with respect to the WWAN air interface).
+ * - Units: milliseconds
+ * - Maximum value: 255
+ */
+
+ /* Optional */
+ /* HW Control Flags */
+ uint8_t hw_control_flags_valid;
+ /* Must be set to true if hw_control_flags is being passed */
+ uint32_t hw_control_flags;
+ /* Informs the remote driver about the hardware control flags:
+ * - Bit 0: IPA_HW_FLAG_HALT_SYSTEM_ON_NON_TERMINAL_FAILURE --
+ * Indicates to the hardware that it must not continue with
+ * any subsequent operation even if the failure is not terminal
+ * - Bit 1: IPA_HW_FLAG_NO_REPORT_MHI_CHANNEL_ERORR --
+ * Indicates to the hardware that it is not required to report
+ * channel errors to the host.
+ * - Bit 2: IPA_HW_FLAG_NO_REPORT_MHI_CHANNEL_WAKE_UP --
+ * Indicates to the hardware that it is not required to generate
+ * wake-up events to the host.
+ * - Bit 4: IPA_HW_FLAG_WORK_OVER_DDR --
+ * Indicates to the hardware that it is accessing addresses in
+ * the DDR and not over PCIe
+ * - Bit 5: IPA_HW_FLAG_INTERRUPT_MODE_CTRL_FLAG --
+ * Indicates whether the device must
+ * raise an event to let the host know that it is going into an
+ * interrupt mode (no longer polling for data/buffer availability)
+ */
+
+ /* Optional */
+ /* Uplink MSI Event Threshold */
+ uint8_t ul_msi_event_threshold_valid;
+ /* Must be set to true if ul_msi_event_threshold is being passed */
+ uint32_t ul_msi_event_threshold;
+ /* Informs the remote driver about the threshold that will
+ * cause an interrupt (MSI) to be fired to the host. This ensures
+ * that the remote driver does not accumulate an excesive number of
+ * events before firing an interrupt.
+ * This threshold is applicable for data moved in the UL direction.
+ * - Maximum value: 65535
+ */
+
+ /* Optional */
+ /* Downlink MSI Event Threshold */
+ uint8_t dl_msi_event_threshold_valid;
+ /* Must be set to true if dl_msi_event_threshold is being passed */
+ uint32_t dl_msi_event_threshold;
+ /* Informs the remote driver about the threshold that will
+ * cause an interrupt (MSI) to be fired to the host. This ensures
+ * that the remote driver does not accumulate an excesive number of
+ * events before firing an interrupt
+ * This threshold is applicable for data that is moved in the
+ * DL direction - Maximum value: 65535
+ */
+
+ /* Optional */
+ /* Uplink Fifo Size */
+ uint8_t ul_fifo_size_valid;
+ /* Must be set to true if ul_fifo_size is being passed */
+ uint32_t ul_fifo_size;
+ /*
+ * Informs the remote driver about the total Uplink xDCI
+ * buffer size that holds the complete aggregated frame
+ * or BAM data fifo size of the peripheral channel/pipe(in Bytes).
+ * This deprecates the max_aggr_frame_size field. This TLV
+ * deprecates max_aggr_frame_size TLV from version 1.9 onwards
+ * and the max_aggr_frame_size TLV will be ignored in the presence
+ * of this TLV.
+ */
+
+ /* Optional */
+ /* Downlink Fifo Size */
+ uint8_t dl_fifo_size_valid;
+ /* Must be set to true if dl_fifo_size is being passed */
+ uint32_t dl_fifo_size;
+ /*
+ * Informs the remote driver about the total Downlink xDCI buffering
+ * capacity or BAM data fifo size of the peripheral channel/pipe.
+ * (In Bytes). dl_fifo_size = n * dl_buf_size. This deprecates the
+ * max_aggr_frame_size field. If this value is set
+ * max_aggr_frame_size is ignored.
+ */
+
+ /* Optional */
+ /* Downlink Buffer Size */
+ uint8_t dl_buf_size_valid;
+ /* Must be set to true if dl_buf_size is being passed */
+ uint32_t dl_buf_size;
+ /* Informs the remote driver about the single xDCI buffer size.
+ This is applicable only in GSI mode(in Bytes).\n */
+}; /* Message */
+
+/* Response Message; Notifies the remote driver of the configuration
+ * information
+ */
+struct ipa_config_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /**< Standard response type.*/
+}; /* Message */
+
+enum ipa_stats_type_enum_v01 {
+ IPA_STATS_TYPE_ENUM_MIN_ENUM_VAL_V01 = -2147483647,
+ /* To force a 32 bit signed enum. Do not change or use */
+ QMI_IPA_STATS_TYPE_INVALID_V01 = 0,
+ /* Invalid stats type identifier */
+ QMI_IPA_STATS_TYPE_PIPE_V01 = 1,
+ /* Pipe stats type */
+ QMI_IPA_STATS_TYPE_FILTER_RULES_V01 = 2,
+ /* Filter rule stats type */
+ IPA_STATS_TYPE_ENUM_MAX_ENUM_VAL_V01 = 2147483647
+ /* To force a 32 bit signed enum. Do not change or use */
+};
+
+struct ipa_pipe_stats_info_type_v01 {
+ uint32_t pipe_index;
+ /* Pipe index for statistics to be retrieved. */
+
+ uint64_t num_ipv4_packets;
+ /* Accumulated number of IPv4 packets over this pipe. */
+
+ uint64_t num_ipv4_bytes;
+ /* Accumulated number of IPv4 bytes over this pipe. */
+
+ uint64_t num_ipv6_packets;
+ /* Accumulated number of IPv6 packets over this pipe. */
+
+ uint64_t num_ipv6_bytes;
+ /* Accumulated number of IPv6 bytes over this pipe. */
+};
+
+struct ipa_stats_type_filter_rule_v01 {
+ uint32_t filter_rule_index;
+ /* Filter rule index for statistics to be retrieved. */
+
+ uint64_t num_packets;
+ /* Accumulated number of packets over this filter rule. */
+};
+
+/* Request Message; Retrieve the data statistics collected on modem
+ * IPA driver.
+ */
+struct ipa_get_data_stats_req_msg_v01 {
+ /* Mandatory */
+ /* Stats Type */
+ enum ipa_stats_type_enum_v01 ipa_stats_type;
+ /* Indicates the type of statistics to be retrieved. */
+
+ /* Optional */
+ /* Reset Statistics */
+ uint8_t reset_stats_valid;
+ /* Must be set to true if reset_stats is being passed */
+ uint8_t reset_stats;
+ /* Option to reset the specific type of data statistics
+ * currently collected.
+ */
+}; /* Message */
+
+/* Response Message; Retrieve the data statistics collected
+ * on modem IPA driver.
+ */
+struct ipa_get_data_stats_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /* Standard response type. */
+
+ /* Optional */
+ /* Stats Type */
+ uint8_t ipa_stats_type_valid;
+ /* Must be set to true if ipa_stats_type is passed */
+ enum ipa_stats_type_enum_v01 ipa_stats_type;
+ /* Indicates the type of statistics that are retrieved. */
+
+ /* Optional */
+ /* Uplink Source Pipe Statistics List */
+ uint8_t ul_src_pipe_stats_list_valid;
+ /* Must be set to true if ul_src_pipe_stats_list is being passed */
+ uint32_t ul_src_pipe_stats_list_len;
+ /* Must be set to # of elements in ul_src_pipe_stats_list */
+ struct ipa_pipe_stats_info_type_v01
+ ul_src_pipe_stats_list[QMI_IPA_MAX_PIPES_V01];
+ /* List of all Uplink pipe statistics that are retrieved. */
+
+ /* Optional */
+ /* Downlink Destination Pipe Statistics List */
+ uint8_t dl_dst_pipe_stats_list_valid;
+ /* Must be set to true if dl_dst_pipe_stats_list is being passed */
+ uint32_t dl_dst_pipe_stats_list_len;
+ /* Must be set to # of elements in dl_dst_pipe_stats_list */
+ struct ipa_pipe_stats_info_type_v01
+ dl_dst_pipe_stats_list[QMI_IPA_MAX_PIPES_V01];
+ /* List of all Downlink pipe statistics that are retrieved. */
+
+ /* Optional */
+ /* Downlink Filter Rule Stats List */
+ uint8_t dl_filter_rule_stats_list_valid;
+ /* Must be set to true if dl_filter_rule_stats_list is being passed */
+ uint32_t dl_filter_rule_stats_list_len;
+ /* Must be set to # of elements in dl_filter_rule_stats_list */
+ struct ipa_stats_type_filter_rule_v01
+ dl_filter_rule_stats_list[QMI_IPA_MAX_FILTERS_V01];
+ /* List of all Downlink filter rule statistics retrieved. */
+}; /* Message */
+
+struct ipa_apn_data_stats_info_type_v01 {
+ uint32_t mux_id;
+ /* Indicates the MUX ID associated with the APN for which the data
+ * usage statistics is queried
+ */
+
+ uint64_t num_ul_packets;
+ /* Accumulated number of uplink packets corresponding to
+ * this Mux ID
+ */
+
+ uint64_t num_ul_bytes;
+ /* Accumulated number of uplink bytes corresponding to
+ * this Mux ID
+ */
+
+ uint64_t num_dl_packets;
+ /* Accumulated number of downlink packets corresponding
+ * to this Mux ID
+ */
+
+ uint64_t num_dl_bytes;
+ /* Accumulated number of downlink bytes corresponding to
+ * this Mux ID
+ */
+}; /* Type */
+
+/* Request Message; Retrieve the APN data statistics collected from modem */
+struct ipa_get_apn_data_stats_req_msg_v01 {
+ /* Optional */
+ /* Mux ID List */
+ uint8_t mux_id_list_valid;
+ /* Must be set to true if mux_id_list is being passed */
+ uint32_t mux_id_list_len;
+ /* Must be set to # of elements in mux_id_list */
+ uint32_t mux_id_list[QMI_IPA_MAX_APN_V01];
+ /* The list of MUX IDs associated with APNs for which the data usage
+ * statistics is being retrieved
+ */
+}; /* Message */
+
+/* Response Message; Retrieve the APN data statistics collected from modem */
+struct ipa_get_apn_data_stats_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /* Standard response type.*/
+
+ /* Optional */
+ /* APN Data Statistics List */
+ uint8_t apn_data_stats_list_valid;
+ /* Must be set to true if apn_data_stats_list is being passed */
+ uint32_t apn_data_stats_list_len;
+ /* Must be set to # of elements in apn_data_stats_list */
+ struct ipa_apn_data_stats_info_type_v01
+ apn_data_stats_list[QMI_IPA_MAX_APN_V01];
+ /* List of APN data retrieved as per request on mux_id.
+ * For now, only one APN monitoring is supported on modem driver.
+ * Making this as list for expandability to support more APNs in future.
+ */
+}; /* Message */
+
+struct ipa_data_usage_quota_info_type_v01 {
+ uint32_t mux_id;
+ /* Indicates the MUX ID associated with the APN for which the data usage
+ * quota needs to be set
+ */
+
+ uint64_t num_Mbytes;
+ /* Number of Mega-bytes of quota value to be set on this APN associated
+ * with this Mux ID.
+ */
+}; /* Type */
+
+/* Request Message; Master driver sets a data usage quota value on
+ * modem driver
+ */
+struct ipa_set_data_usage_quota_req_msg_v01 {
+ /* Optional */
+ /* APN Quota List */
+ uint8_t apn_quota_list_valid;
+ /* Must be set to true if apn_quota_list is being passed */
+ uint32_t apn_quota_list_len;
+ /* Must be set to # of elements in apn_quota_list */
+ struct ipa_data_usage_quota_info_type_v01
+ apn_quota_list[QMI_IPA_MAX_APN_V01];
+ /* The list of APNs on which a data usage quota to be set on modem
+ * driver. For now, only one APN monitoring is supported on modem
+ * driver. Making this as list for expandability to support more
+ * APNs in future.
+ */
+}; /* Message */
+
+/* Response Message; Master driver sets a data usage on modem driver. */
+struct ipa_set_data_usage_quota_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /* Standard response type.*/
+}; /* Message */
+
+/* Indication Message; Modem driver sends this indication to master
+ * driver when the data usage quota is reached
+ */
+struct ipa_data_usage_quota_reached_ind_msg_v01 {
+ /* Mandatory */
+ /* APN Quota List */
+ struct ipa_data_usage_quota_info_type_v01 apn;
+ /* This message indicates which APN has the previously set quota
+ * reached. For now, only one APN monitoring is supported on modem
+ * driver.
+ */
+}; /* Message */
+
+/* Request Message; Master driver request modem driver to terminate
+ * the current data usage quota monitoring session.
+ */
+struct ipa_stop_data_usage_quota_req_msg_v01 {
+ /* This element is a placeholder to prevent the declaration of
+ * an empty struct. DO NOT USE THIS FIELD UNDER ANY CIRCUMSTANCE
+ */
+ char __placeholder;
+}; /* Message */
+
+/* Response Message; Master driver request modem driver to terminate
+ * the current quota monitoring session.
+ */
+struct ipa_stop_data_usage_quota_resp_msg_v01 {
+ /* Mandatory */
+ /* Result Code */
+ struct ipa_qmi_response_type_v01 resp;
+ /**< Standard response type.*/
+}; /* Message */
+
+/*Service Message Definition*/
+#define QMI_IPA_INDICATION_REGISTER_REQ_V01 0x0020
+#define QMI_IPA_INDICATION_REGISTER_RESP_V01 0x0020
+#define QMI_IPA_INIT_MODEM_DRIVER_REQ_V01 0x0021
+#define QMI_IPA_INIT_MODEM_DRIVER_RESP_V01 0x0021
+#define QMI_IPA_MASTER_DRIVER_INIT_COMPLETE_IND_V01 0x0022
+#define QMI_IPA_INSTALL_FILTER_RULE_REQ_V01 0x0023
+#define QMI_IPA_INSTALL_FILTER_RULE_RESP_V01 0x0023
+#define QMI_IPA_FILTER_INSTALLED_NOTIF_REQ_V01 0x0024
+#define QMI_IPA_FILTER_INSTALLED_NOTIF_RESP_V01 0x0024
+#define QMI_IPA_ENABLE_FORCE_CLEAR_DATAPATH_REQ_V01 0x0025
+#define QMI_IPA_ENABLE_FORCE_CLEAR_DATAPATH_RESP_V01 0x0025
+#define QMI_IPA_DISABLE_FORCE_CLEAR_DATAPATH_REQ_V01 0x0026
+#define QMI_IPA_DISABLE_FORCE_CLEAR_DATAPATH_RESP_V01 0x0026
+#define QMI_IPA_CONFIG_REQ_V01 0x0027
+#define QMI_IPA_CONFIG_RESP_V01 0x0027
+#define QMI_IPA_DISABLE_LINK_LOW_PWR_STATE_REQ_V01 0x0028
+#define QMI_IPA_DISABLE_LINK_LOW_PWR_STATE_RESP_V01 0x0028
+#define QMI_IPA_ENABLE_LINK_LOW_PWR_STATE_REQ_V01 0x0029
+#define QMI_IPA_ENABLE_LINK_LOW_PWR_STATE_RESP_V01 0x0029
+#define QMI_IPA_GET_DATA_STATS_REQ_V01 0x0030
+#define QMI_IPA_GET_DATA_STATS_RESP_V01 0x0030
+#define QMI_IPA_GET_APN_DATA_STATS_REQ_V01 0x0031
+#define QMI_IPA_GET_APN_DATA_STATS_RESP_V01 0x0031
+#define QMI_IPA_SET_DATA_USAGE_QUOTA_REQ_V01 0x0032
+#define QMI_IPA_SET_DATA_USAGE_QUOTA_RESP_V01 0x0032
+#define QMI_IPA_DATA_USAGE_QUOTA_REACHED_IND_V01 0x0033
+#define QMI_IPA_STOP_DATA_USAGE_QUOTA_REQ_V01 0x0034
+#define QMI_IPA_STOP_DATA_USAGE_QUOTA_RESP_V01 0x0034
+#define QMI_IPA_INIT_MODEM_DRIVER_CMPLT_REQ_V01 0x0035
+#define QMI_IPA_INIT_MODEM_DRIVER_CMPLT_RESP_V01 0x0035
+
+/* add for max length*/
+#define QMI_IPA_INIT_MODEM_DRIVER_REQ_MAX_MSG_LEN_V01 134
+#define QMI_IPA_INIT_MODEM_DRIVER_RESP_MAX_MSG_LEN_V01 25
+#define QMI_IPA_INDICATION_REGISTER_REQ_MAX_MSG_LEN_V01 8
+#define QMI_IPA_INDICATION_REGISTER_RESP_MAX_MSG_LEN_V01 7
+#define QMI_IPA_INSTALL_FILTER_RULE_REQ_MAX_MSG_LEN_V01 22369
+#define QMI_IPA_INSTALL_FILTER_RULE_RESP_MAX_MSG_LEN_V01 783
+#define QMI_IPA_FILTER_INSTALLED_NOTIF_REQ_MAX_MSG_LEN_V01 834
+#define QMI_IPA_FILTER_INSTALLED_NOTIF_RESP_MAX_MSG_LEN_V01 7
+#define QMI_IPA_MASTER_DRIVER_INIT_COMPLETE_IND_MAX_MSG_LEN_V01 7
+#define QMI_IPA_DATA_USAGE_QUOTA_REACHED_IND_MAX_MSG_LEN_V01 15
+
+
+#define QMI_IPA_ENABLE_FORCE_CLEAR_DATAPATH_REQ_MAX_MSG_LEN_V01 18
+#define QMI_IPA_DISABLE_FORCE_CLEAR_DATAPATH_REQ_MAX_MSG_LEN_V01 7
+#define QMI_IPA_ENABLE_FORCE_CLEAR_DATAPATH_RESP_MAX_MSG_LEN_V01 7
+#define QMI_IPA_DISABLE_FORCE_CLEAR_DATAPATH_RESP_MAX_MSG_LEN_V01 7
+
+
+#define QMI_IPA_CONFIG_REQ_MAX_MSG_LEN_V01 102
+#define QMI_IPA_CONFIG_RESP_MAX_MSG_LEN_V01 7
+#define QMI_IPA_DISABLE_LINK_LOW_PWR_STATE_REQ_MAX_MSG_LEN_V01 18
+#define QMI_IPA_DISABLE_LINK_LOW_PWR_STATE_RESP_MAX_MSG_LEN_V01 7
+#define QMI_IPA_ENABLE_LINK_LOW_PWR_STATE_REQ_MAX_MSG_LEN_V01 7
+#define QMI_IPA_ENABLE_LINK_LOW_PWR_STATE_RESP_MAX_MSG_LEN_V01 7
+#define QMI_IPA_GET_DATA_STATS_REQ_MAX_MSG_LEN_V01 11
+#define QMI_IPA_GET_DATA_STATS_RESP_MAX_MSG_LEN_V01 2234
+#define QMI_IPA_GET_APN_DATA_STATS_REQ_MAX_MSG_LEN_V01 36
+#define QMI_IPA_GET_APN_DATA_STATS_RESP_MAX_MSG_LEN_V01 299
+#define QMI_IPA_SET_DATA_USAGE_QUOTA_REQ_MAX_MSG_LEN_V01 100
+#define QMI_IPA_SET_DATA_USAGE_QUOTA_RESP_MAX_MSG_LEN_V01 7
+#define QMI_IPA_STOP_DATA_USAGE_QUOTA_REQ_MAX_MSG_LEN_V01 0
+#define QMI_IPA_STOP_DATA_USAGE_QUOTA_RESP_MAX_MSG_LEN_V01 7
+
+#define QMI_IPA_INIT_MODEM_DRIVER_CMPLT_REQ_MAX_MSG_LEN_V01 4
+#define QMI_IPA_INIT_MODEM_DRIVER_CMPLT_RESP_MAX_MSG_LEN_V01 7
+
+/* Service Object Accessor */
+
+#endif/* IPA_QMI_SERVICE_V01_H */
diff --git a/include/uapi/linux/msm_ipa.h b/include/uapi/linux/msm_ipa.h
new file mode 100644
index 000000000000..65c0da195f02
--- /dev/null
+++ b/include/uapi/linux/msm_ipa.h
@@ -0,0 +1,1740 @@
+#ifndef _UAPI_MSM_IPA_H_
+#define _UAPI_MSM_IPA_H_
+
+#ifndef __KERNEL__
+#include <stdint.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#endif
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#include <linux/if_ether.h>
+
+/**
+ * unique magic number of the IPA device
+ */
+#define IPA_IOC_MAGIC 0xCF
+
+/**
+ * name of the default routing tables for v4 and v6
+ */
+#define IPA_DFLT_RT_TBL_NAME "ipa_dflt_rt"
+
+/**
+ * the commands supported by IPA driver
+ */
+#define IPA_IOCTL_ADD_HDR 0
+#define IPA_IOCTL_DEL_HDR 1
+#define IPA_IOCTL_ADD_RT_RULE 2
+#define IPA_IOCTL_DEL_RT_RULE 3
+#define IPA_IOCTL_ADD_FLT_RULE 4
+#define IPA_IOCTL_DEL_FLT_RULE 5
+#define IPA_IOCTL_COMMIT_HDR 6
+#define IPA_IOCTL_RESET_HDR 7
+#define IPA_IOCTL_COMMIT_RT 8
+#define IPA_IOCTL_RESET_RT 9
+#define IPA_IOCTL_COMMIT_FLT 10
+#define IPA_IOCTL_RESET_FLT 11
+#define IPA_IOCTL_DUMP 12
+#define IPA_IOCTL_GET_RT_TBL 13
+#define IPA_IOCTL_PUT_RT_TBL 14
+#define IPA_IOCTL_COPY_HDR 15
+#define IPA_IOCTL_QUERY_INTF 16
+#define IPA_IOCTL_QUERY_INTF_TX_PROPS 17
+#define IPA_IOCTL_QUERY_INTF_RX_PROPS 18
+#define IPA_IOCTL_GET_HDR 19
+#define IPA_IOCTL_PUT_HDR 20
+#define IPA_IOCTL_SET_FLT 21
+#define IPA_IOCTL_ALLOC_NAT_MEM 22
+#define IPA_IOCTL_V4_INIT_NAT 23
+#define IPA_IOCTL_NAT_DMA 24
+#define IPA_IOCTL_V4_DEL_NAT 26
+#define IPA_IOCTL_PULL_MSG 27
+#define IPA_IOCTL_GET_NAT_OFFSET 28
+#define IPA_IOCTL_RM_ADD_DEPENDENCY 29
+#define IPA_IOCTL_RM_DEL_DEPENDENCY 30
+#define IPA_IOCTL_GENERATE_FLT_EQ 31
+#define IPA_IOCTL_QUERY_INTF_EXT_PROPS 32
+#define IPA_IOCTL_QUERY_EP_MAPPING 33
+#define IPA_IOCTL_QUERY_RT_TBL_INDEX 34
+#define IPA_IOCTL_WRITE_QMAPID 35
+#define IPA_IOCTL_MDFY_FLT_RULE 36
+#define IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_ADD 37
+#define IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_DEL 38
+#define IPA_IOCTL_NOTIFY_WAN_EMBMS_CONNECTED 39
+#define IPA_IOCTL_ADD_HDR_PROC_CTX 40
+#define IPA_IOCTL_DEL_HDR_PROC_CTX 41
+#define IPA_IOCTL_MDFY_RT_RULE 42
+#define IPA_IOCTL_ADD_RT_RULE_AFTER 43
+#define IPA_IOCTL_ADD_FLT_RULE_AFTER 44
+#define IPA_IOCTL_GET_HW_VERSION 45
+#define IPA_IOCTL_MAX 46
+
+/**
+ * max size of the header to be inserted
+ */
+#define IPA_HDR_MAX_SIZE 64
+
+/**
+ * max size of the name of the resource (routing table, header)
+ */
+#define IPA_RESOURCE_NAME_MAX 32
+
+/**
+ * max number of interface properties
+ */
+#define IPA_NUM_PROPS_MAX 35
+
+/**
+ * size of the mac address
+ */
+#define IPA_MAC_ADDR_SIZE 6
+
+/**
+ * max number of mbim streams
+ */
+#define IPA_MBIM_MAX_STREAM_NUM 8
+
+/**
+ * the attributes of the rule (routing or filtering)
+ */
+#define IPA_FLT_TOS (1ul << 0)
+#define IPA_FLT_PROTOCOL (1ul << 1)
+#define IPA_FLT_SRC_ADDR (1ul << 2)
+#define IPA_FLT_DST_ADDR (1ul << 3)
+#define IPA_FLT_SRC_PORT_RANGE (1ul << 4)
+#define IPA_FLT_DST_PORT_RANGE (1ul << 5)
+#define IPA_FLT_TYPE (1ul << 6)
+#define IPA_FLT_CODE (1ul << 7)
+#define IPA_FLT_SPI (1ul << 8)
+#define IPA_FLT_SRC_PORT (1ul << 9)
+#define IPA_FLT_DST_PORT (1ul << 10)
+#define IPA_FLT_TC (1ul << 11)
+#define IPA_FLT_FLOW_LABEL (1ul << 12)
+#define IPA_FLT_NEXT_HDR (1ul << 13)
+#define IPA_FLT_META_DATA (1ul << 14)
+#define IPA_FLT_FRAGMENT (1ul << 15)
+#define IPA_FLT_TOS_MASKED (1ul << 16)
+#define IPA_FLT_MAC_SRC_ADDR_ETHER_II (1ul << 17)
+#define IPA_FLT_MAC_DST_ADDR_ETHER_II (1ul << 18)
+#define IPA_FLT_MAC_SRC_ADDR_802_3 (1ul << 19)
+#define IPA_FLT_MAC_DST_ADDR_802_3 (1ul << 20)
+#define IPA_FLT_MAC_ETHER_TYPE (1ul << 21)
+
+/**
+ * enum ipa_client_type - names for the various IPA "clients"
+ * these are from the perspective of the clients, for e.g.
+ * HSIC1_PROD means HSIC client is the producer and IPA is the
+ * consumer
+ */
+enum ipa_client_type {
+ IPA_CLIENT_PROD,
+ IPA_CLIENT_HSIC1_PROD = IPA_CLIENT_PROD,
+ IPA_CLIENT_WLAN1_PROD,
+ IPA_CLIENT_HSIC2_PROD,
+ IPA_CLIENT_USB2_PROD,
+ IPA_CLIENT_HSIC3_PROD,
+ IPA_CLIENT_USB3_PROD,
+ IPA_CLIENT_HSIC4_PROD,
+ IPA_CLIENT_USB4_PROD,
+ IPA_CLIENT_HSIC5_PROD,
+ IPA_CLIENT_USB_PROD,
+ IPA_CLIENT_A5_WLAN_AMPDU_PROD,
+ IPA_CLIENT_A2_EMBEDDED_PROD,
+ IPA_CLIENT_A2_TETHERED_PROD,
+ IPA_CLIENT_APPS_LAN_WAN_PROD,
+ IPA_CLIENT_APPS_CMD_PROD,
+ IPA_CLIENT_ODU_PROD,
+ IPA_CLIENT_MHI_PROD,
+ IPA_CLIENT_Q6_LAN_PROD,
+ IPA_CLIENT_Q6_WAN_PROD,
+ IPA_CLIENT_Q6_CMD_PROD,
+ IPA_CLIENT_MEMCPY_DMA_SYNC_PROD,
+ IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD,
+ IPA_CLIENT_Q6_DECOMP_PROD,
+ IPA_CLIENT_Q6_DECOMP2_PROD,
+ IPA_CLIENT_UC_USB_PROD,
+
+ /* Below PROD client type is only for test purpose */
+ IPA_CLIENT_TEST_PROD,
+ IPA_CLIENT_TEST1_PROD,
+ IPA_CLIENT_TEST2_PROD,
+ IPA_CLIENT_TEST3_PROD,
+ IPA_CLIENT_TEST4_PROD,
+
+ IPA_CLIENT_CONS,
+ IPA_CLIENT_HSIC1_CONS = IPA_CLIENT_CONS,
+ IPA_CLIENT_WLAN1_CONS,
+ IPA_CLIENT_HSIC2_CONS,
+ IPA_CLIENT_USB2_CONS,
+ IPA_CLIENT_WLAN2_CONS,
+ IPA_CLIENT_HSIC3_CONS,
+ IPA_CLIENT_USB3_CONS,
+ IPA_CLIENT_WLAN3_CONS,
+ IPA_CLIENT_HSIC4_CONS,
+ IPA_CLIENT_USB4_CONS,
+ IPA_CLIENT_WLAN4_CONS,
+ IPA_CLIENT_HSIC5_CONS,
+ IPA_CLIENT_USB_CONS,
+ IPA_CLIENT_USB_DPL_CONS,
+ IPA_CLIENT_A2_EMBEDDED_CONS,
+ IPA_CLIENT_A2_TETHERED_CONS,
+ IPA_CLIENT_A5_LAN_WAN_CONS,
+ IPA_CLIENT_APPS_LAN_CONS,
+ IPA_CLIENT_APPS_WAN_CONS,
+ IPA_CLIENT_ODU_EMB_CONS,
+ IPA_CLIENT_ODU_TETH_CONS,
+ IPA_CLIENT_MHI_CONS,
+ IPA_CLIENT_Q6_LAN_CONS,
+ IPA_CLIENT_Q6_WAN_CONS,
+ IPA_CLIENT_Q6_DUN_CONS,
+ IPA_CLIENT_MEMCPY_DMA_SYNC_CONS,
+ IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS,
+ IPA_CLIENT_Q6_DECOMP_CONS,
+ IPA_CLIENT_Q6_DECOMP2_CONS,
+ IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS,
+ /* Below CONS client type is only for test purpose */
+ IPA_CLIENT_TEST_CONS,
+ IPA_CLIENT_TEST1_CONS,
+ IPA_CLIENT_TEST2_CONS,
+ IPA_CLIENT_TEST3_CONS,
+ IPA_CLIENT_TEST4_CONS,
+
+ IPA_CLIENT_MAX,
+};
+
+#define IPA_CLIENT_IS_APPS_CONS(client) \
+ ((client) == IPA_CLIENT_APPS_LAN_CONS || \
+ (client) == IPA_CLIENT_APPS_WAN_CONS)
+
+#define IPA_CLIENT_IS_USB_CONS(client) \
+ ((client) == IPA_CLIENT_USB_CONS || \
+ (client) == IPA_CLIENT_USB2_CONS || \
+ (client) == IPA_CLIENT_USB3_CONS || \
+ (client) == IPA_CLIENT_USB_DPL_CONS || \
+ (client) == IPA_CLIENT_USB4_CONS)
+
+#define IPA_CLIENT_IS_WLAN_CONS(client) \
+ ((client) == IPA_CLIENT_WLAN1_CONS || \
+ (client) == IPA_CLIENT_WLAN2_CONS || \
+ (client) == IPA_CLIENT_WLAN3_CONS || \
+ (client) == IPA_CLIENT_WLAN4_CONS)
+
+#define IPA_CLIENT_IS_ODU_CONS(client) \
+ ((client) == IPA_CLIENT_ODU_EMB_CONS || \
+ (client) == IPA_CLIENT_ODU_TETH_CONS)
+
+#define IPA_CLIENT_IS_Q6_CONS(client) \
+ ((client) == IPA_CLIENT_Q6_LAN_CONS || \
+ (client) == IPA_CLIENT_Q6_WAN_CONS || \
+ (client) == IPA_CLIENT_Q6_DUN_CONS || \
+ (client) == IPA_CLIENT_Q6_DECOMP_CONS || \
+ (client) == IPA_CLIENT_Q6_DECOMP2_CONS || \
+ (client) == IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS)
+
+#define IPA_CLIENT_IS_Q6_PROD(client) \
+ ((client) == IPA_CLIENT_Q6_LAN_PROD || \
+ (client) == IPA_CLIENT_Q6_WAN_PROD || \
+ (client) == IPA_CLIENT_Q6_CMD_PROD || \
+ (client) == IPA_CLIENT_Q6_DECOMP_PROD || \
+ (client) == IPA_CLIENT_Q6_DECOMP2_PROD)
+
+#define IPA_CLIENT_IS_Q6_NON_ZIP_CONS(client) \
+ ((client) == IPA_CLIENT_Q6_LAN_CONS || \
+ (client) == IPA_CLIENT_Q6_WAN_CONS || \
+ (client) == IPA_CLIENT_Q6_DUN_CONS || \
+ (client) == IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS)
+
+#define IPA_CLIENT_IS_Q6_ZIP_CONS(client) \
+ ((client) == IPA_CLIENT_Q6_DECOMP_CONS || \
+ (client) == IPA_CLIENT_Q6_DECOMP2_CONS)
+
+#define IPA_CLIENT_IS_Q6_NON_ZIP_PROD(client) \
+ ((client) == IPA_CLIENT_Q6_LAN_PROD || \
+ (client) == IPA_CLIENT_Q6_WAN_PROD || \
+ (client) == IPA_CLIENT_Q6_CMD_PROD)
+
+#define IPA_CLIENT_IS_Q6_ZIP_PROD(client) \
+ ((client) == IPA_CLIENT_Q6_DECOMP_PROD || \
+ (client) == IPA_CLIENT_Q6_DECOMP2_PROD)
+
+#define IPA_CLIENT_IS_MEMCPY_DMA_CONS(client) \
+ ((client) == IPA_CLIENT_MEMCPY_DMA_SYNC_CONS || \
+ (client) == IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS)
+
+#define IPA_CLIENT_IS_MEMCPY_DMA_PROD(client) \
+ ((client) == IPA_CLIENT_MEMCPY_DMA_SYNC_PROD || \
+ (client) == IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD)
+
+#define IPA_CLIENT_IS_MHI_CONS(client) \
+ ((client) == IPA_CLIENT_MHI_CONS)
+
+#define IPA_CLIENT_IS_MHI(client) \
+ ((client) == IPA_CLIENT_MHI_CONS || \
+ (client) == IPA_CLIENT_MHI_PROD)
+
+#define IPA_CLIENT_IS_TEST_PROD(client) \
+ ((client) == IPA_CLIENT_TEST_PROD || \
+ (client) == IPA_CLIENT_TEST1_PROD || \
+ (client) == IPA_CLIENT_TEST2_PROD || \
+ (client) == IPA_CLIENT_TEST3_PROD || \
+ (client) == IPA_CLIENT_TEST4_PROD)
+
+#define IPA_CLIENT_IS_TEST_CONS(client) \
+ ((client) == IPA_CLIENT_TEST_CONS || \
+ (client) == IPA_CLIENT_TEST1_CONS || \
+ (client) == IPA_CLIENT_TEST2_CONS || \
+ (client) == IPA_CLIENT_TEST3_CONS || \
+ (client) == IPA_CLIENT_TEST4_CONS)
+
+#define IPA_CLIENT_IS_TEST(client) \
+ (IPA_CLIENT_IS_TEST_PROD(client) || IPA_CLIENT_IS_TEST_CONS(client))
+
+/**
+ * enum ipa_ip_type - Address family: IPv4 or IPv6
+ */
+enum ipa_ip_type {
+ IPA_IP_v4,
+ IPA_IP_v6,
+ IPA_IP_MAX
+};
+
+/**
+ * enum ipa_rule_type - Type of routing or filtering rule
+ * Hashable: Rule will be located at the hashable tables
+ * Non_Hashable: Rule will be located at the non-hashable tables
+ */
+enum ipa_rule_type {
+ IPA_RULE_HASHABLE,
+ IPA_RULE_NON_HASHABLE,
+ IPA_RULE_TYPE_MAX
+};
+
+/**
+ * enum ipa_flt_action - action field of filtering rule
+ *
+ * Pass to routing: 5'd0
+ * Pass to source NAT: 5'd1
+ * Pass to destination NAT: 5'd2
+ * Pass to default output pipe (e.g., Apps or Modem): 5'd3
+ */
+enum ipa_flt_action {
+ IPA_PASS_TO_ROUTING,
+ IPA_PASS_TO_SRC_NAT,
+ IPA_PASS_TO_DST_NAT,
+ IPA_PASS_TO_EXCEPTION
+};
+
+/**
+ * enum ipa_wlan_event - Events for wlan client
+ *
+ * wlan client connect: New wlan client connected
+ * wlan client disconnect: wlan client disconnected
+ * wlan client power save: wlan client moved to power save
+ * wlan client normal: wlan client moved out of power save
+ * sw routing enable: ipa routing is disabled
+ * sw routing disable: ipa routing is enabled
+ * wlan ap connect: wlan AP(access point) is up
+ * wlan ap disconnect: wlan AP(access point) is down
+ * wlan sta connect: wlan STA(station) is up
+ * wlan sta disconnect: wlan STA(station) is down
+ * wlan client connect ex: new wlan client connected
+ * wlan scc switch: wlan interfaces in scc mode
+ * wlan mcc switch: wlan interfaces in mcc mode
+ * wlan wdi enable: wdi data path completed
+ * wlan wdi disable: wdi data path teardown
+ */
+enum ipa_wlan_event {
+ WLAN_CLIENT_CONNECT,
+ WLAN_CLIENT_DISCONNECT,
+ WLAN_CLIENT_POWER_SAVE_MODE,
+ WLAN_CLIENT_NORMAL_MODE,
+ SW_ROUTING_ENABLE,
+ SW_ROUTING_DISABLE,
+ WLAN_AP_CONNECT,
+ WLAN_AP_DISCONNECT,
+ WLAN_STA_CONNECT,
+ WLAN_STA_DISCONNECT,
+ WLAN_CLIENT_CONNECT_EX,
+ WLAN_SWITCH_TO_SCC,
+ WLAN_SWITCH_TO_MCC,
+ WLAN_WDI_ENABLE,
+ WLAN_WDI_DISABLE,
+ IPA_WLAN_EVENT_MAX
+};
+
+/**
+ * enum ipa_wan_event - Events for wan client
+ *
+ * wan default route add/del
+ * wan embms connect: New wan embms interface connected
+ */
+enum ipa_wan_event {
+ WAN_UPSTREAM_ROUTE_ADD = IPA_WLAN_EVENT_MAX,
+ WAN_UPSTREAM_ROUTE_DEL,
+ WAN_EMBMS_CONNECT,
+ WAN_XLAT_CONNECT,
+ IPA_WAN_EVENT_MAX
+};
+
+enum ipa_ecm_event {
+ ECM_CONNECT = IPA_WAN_EVENT_MAX,
+ ECM_DISCONNECT,
+ IPA_ECM_EVENT_MAX,
+};
+
+enum ipa_tethering_stats_event {
+ IPA_TETHERING_STATS_UPDATE_STATS = IPA_ECM_EVENT_MAX,
+ IPA_TETHERING_STATS_UPDATE_NETWORK_STATS,
+ IPA_TETHERING_STATS_EVENT_MAX,
+ IPA_EVENT_MAX_NUM = IPA_TETHERING_STATS_EVENT_MAX
+};
+
+#define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM)
+
+/**
+ * enum ipa_rm_resource_name - IPA RM clients identification names
+ *
+ * Add new mapping to ipa_rm_dep_prod_index() / ipa_rm_dep_cons_index()
+ * when adding new entry to this enum.
+ */
+enum ipa_rm_resource_name {
+ IPA_RM_RESOURCE_PROD = 0,
+ IPA_RM_RESOURCE_Q6_PROD = IPA_RM_RESOURCE_PROD,
+ IPA_RM_RESOURCE_USB_PROD,
+ IPA_RM_RESOURCE_HSIC_PROD,
+ IPA_RM_RESOURCE_STD_ECM_PROD,
+ IPA_RM_RESOURCE_RNDIS_PROD,
+ IPA_RM_RESOURCE_WWAN_0_PROD,
+ IPA_RM_RESOURCE_WLAN_PROD,
+ IPA_RM_RESOURCE_ODU_ADAPT_PROD,
+ IPA_RM_RESOURCE_MHI_PROD,
+ IPA_RM_RESOURCE_PROD_MAX,
+
+ IPA_RM_RESOURCE_Q6_CONS = IPA_RM_RESOURCE_PROD_MAX,
+ IPA_RM_RESOURCE_USB_CONS,
+ IPA_RM_RESOURCE_HSIC_CONS,
+ IPA_RM_RESOURCE_WLAN_CONS,
+ IPA_RM_RESOURCE_APPS_CONS,
+ IPA_RM_RESOURCE_ODU_ADAPT_CONS,
+ IPA_RM_RESOURCE_MHI_CONS,
+ IPA_RM_RESOURCE_MAX
+};
+
+/**
+ * enum ipa_hw_type - IPA hardware version type
+ * @IPA_HW_None: IPA hardware version not defined
+ * @IPA_HW_v1_0: IPA hardware version 1.0
+ * @IPA_HW_v1_1: IPA hardware version 1.1
+ * @IPA_HW_v2_0: IPA hardware version 2.0
+ * @IPA_HW_v2_1: IPA hardware version 2.1
+ * @IPA_HW_v2_5: IPA hardware version 2.5
+ * @IPA_HW_v2_6: IPA hardware version 2.6
+ * @IPA_HW_v2_6L: IPA hardware version 2.6L
+ * @IPA_HW_v3_0: IPA hardware version 3.0
+ */
+enum ipa_hw_type {
+ IPA_HW_None = 0,
+ IPA_HW_v1_0 = 1,
+ IPA_HW_v1_1 = 2,
+ IPA_HW_v2_0 = 3,
+ IPA_HW_v2_1 = 4,
+ IPA_HW_v2_5 = 5,
+ IPA_HW_v2_6 = IPA_HW_v2_5,
+ IPA_HW_v2_6L = 6,
+ IPA_HW_v3_0 = 10,
+ IPA_HW_MAX
+};
+
+/**
+ * struct ipa_rule_attrib - attributes of a routing/filtering
+ * rule, all in LE
+ * @attrib_mask: what attributes are valid
+ * @src_port_lo: low port of src port range
+ * @src_port_hi: high port of src port range
+ * @dst_port_lo: low port of dst port range
+ * @dst_port_hi: high port of dst port range
+ * @type: ICMP/IGMP type
+ * @code: ICMP/IGMP code
+ * @spi: IPSec SPI
+ * @src_port: exact src port
+ * @dst_port: exact dst port
+ * @meta_data: meta-data val
+ * @meta_data_mask: meta-data mask
+ * @u.v4.tos: type of service
+ * @u.v4.protocol: protocol
+ * @u.v4.src_addr: src address value
+ * @u.v4.src_addr_mask: src address mask
+ * @u.v4.dst_addr: dst address value
+ * @u.v4.dst_addr_mask: dst address mask
+ * @u.v6.tc: traffic class
+ * @u.v6.flow_label: flow label
+ * @u.v6.next_hdr: next header
+ * @u.v6.src_addr: src address val
+ * @u.v6.src_addr_mask: src address mask
+ * @u.v6.dst_addr: dst address val
+ * @u.v6.dst_addr_mask: dst address mask
+ */
+struct ipa_rule_attrib {
+ uint32_t attrib_mask;
+ uint16_t src_port_lo;
+ uint16_t src_port_hi;
+ uint16_t dst_port_lo;
+ uint16_t dst_port_hi;
+ uint8_t type;
+ uint8_t code;
+ uint8_t tos_value;
+ uint8_t tos_mask;
+ uint32_t spi;
+ uint16_t src_port;
+ uint16_t dst_port;
+ uint32_t meta_data;
+ uint32_t meta_data_mask;
+ uint8_t src_mac_addr[ETH_ALEN];
+ uint8_t src_mac_addr_mask[ETH_ALEN];
+ uint8_t dst_mac_addr[ETH_ALEN];
+ uint8_t dst_mac_addr_mask[ETH_ALEN];
+ uint16_t ether_type;
+ union {
+ struct {
+ uint8_t tos;
+ uint8_t protocol;
+ uint32_t src_addr;
+ uint32_t src_addr_mask;
+ uint32_t dst_addr;
+ uint32_t dst_addr_mask;
+ } v4;
+ struct {
+ uint8_t tc;
+ uint32_t flow_label;
+ uint8_t next_hdr;
+ uint32_t src_addr[4];
+ uint32_t src_addr_mask[4];
+ uint32_t dst_addr[4];
+ uint32_t dst_addr_mask[4];
+ } v6;
+ } u;
+};
+
+/*! @brief The maximum number of Mask Equal 32 Eqns */
+#define IPA_IPFLTR_NUM_MEQ_32_EQNS 2
+
+/*! @brief The maximum number of IHL offset Mask Equal 32 Eqns */
+#define IPA_IPFLTR_NUM_IHL_MEQ_32_EQNS 2
+
+/*! @brief The maximum number of Mask Equal 128 Eqns */
+#define IPA_IPFLTR_NUM_MEQ_128_EQNS 2
+
+/*! @brief The maximum number of IHL offset Range Check 16 Eqns */
+#define IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS 2
+
+/*! @brief Offset and 16 bit comparison equation */
+struct ipa_ipfltr_eq_16 {
+ int8_t offset;
+ uint16_t value;
+};
+
+/*! @brief Offset and 32 bit comparison equation */
+struct ipa_ipfltr_eq_32 {
+ int8_t offset;
+ uint32_t value;
+};
+
+/*! @brief Offset and 128 bit masked comparison equation */
+struct ipa_ipfltr_mask_eq_128 {
+ int8_t offset;
+ uint8_t mask[16];
+ uint8_t value[16];
+};
+
+/*! @brief Offset and 32 bit masked comparison equation */
+struct ipa_ipfltr_mask_eq_32 {
+ int8_t offset;
+ uint32_t mask;
+ uint32_t value;
+};
+
+/*! @brief Equation for identifying a range. Ranges are inclusive */
+struct ipa_ipfltr_range_eq_16 {
+ int8_t offset;
+ uint16_t range_low;
+ uint16_t range_high;
+};
+
+/*! @brief Rule equations which are set according to DS filter installation */
+struct ipa_ipfltri_rule_eq {
+ /*! 16-bit Bitmask to indicate how many eqs are valid in this rule */
+ uint16_t rule_eq_bitmap;
+ /*! Specifies if a type of service check rule is present */
+ uint8_t tos_eq_present;
+ /*! The value to check against the type of service (ipv4) field */
+ uint8_t tos_eq;
+ /*! Specifies if a protocol check rule is present */
+ uint8_t protocol_eq_present;
+ /*! The value to check against the protocol (ipv6) field */
+ uint8_t protocol_eq;
+ /*! The number of ip header length offset 16 bit range check
+ * rules in this rule */
+ uint8_t num_ihl_offset_range_16;
+ /*! An array of the registered ip header length offset 16 bit
+ * range check rules */
+ struct ipa_ipfltr_range_eq_16
+ ihl_offset_range_16[IPA_IPFLTR_NUM_IHL_RANGE_16_EQNS];
+ /*! The number of mask equal 32 rules present in this rule */
+ uint8_t num_offset_meq_32;
+ /*! An array of all the possible mask equal 32 rules in this rule */
+ struct ipa_ipfltr_mask_eq_32
+ offset_meq_32[IPA_IPFLTR_NUM_MEQ_32_EQNS];
+ /*! Specifies if the traffic class rule is present in this rule */
+ uint8_t tc_eq_present;
+ /*! The value to check the traffic class (ipv4) field against */
+ uint8_t tc_eq;
+ /*! Specifies if the flow equals rule is present in this rule */
+ uint8_t fl_eq_present;
+ /*! The value to check the flow (ipv6) field against */
+ uint32_t fl_eq;
+ /*! The number of ip header length offset 16 bit equations in this
+ * rule */
+ uint8_t ihl_offset_eq_16_present;
+ /*! The ip header length offset 16 bit equation */
+ struct ipa_ipfltr_eq_16 ihl_offset_eq_16;
+ /*! The number of ip header length offset 32 bit equations in this
+ * rule */
+ uint8_t ihl_offset_eq_32_present;
+ /*! The ip header length offset 32 bit equation */
+ struct ipa_ipfltr_eq_32 ihl_offset_eq_32;
+ /*! The number of ip header length offset 32 bit mask equations in
+ * this rule */
+ uint8_t num_ihl_offset_meq_32;
+ /*! The ip header length offset 32 bit mask equation */
+ struct ipa_ipfltr_mask_eq_32
+ ihl_offset_meq_32[IPA_IPFLTR_NUM_IHL_MEQ_32_EQNS];
+ /*! The number of ip header length offset 128 bit equations in this
+ * rule */
+ uint8_t num_offset_meq_128;
+ /*! The ip header length offset 128 bit equation */
+ struct ipa_ipfltr_mask_eq_128
+ offset_meq_128[IPA_IPFLTR_NUM_MEQ_128_EQNS];
+ /*! The metadata 32 bit masked comparison equation present or not */
+ /* Metadata based rules are added internally by IPA driver */
+ uint8_t metadata_meq32_present;
+ /*! The metadata 32 bit masked comparison equation */
+ struct ipa_ipfltr_mask_eq_32 metadata_meq32;
+ /*! Specifies if the Fragment equation is present in this rule */
+ uint8_t ipv4_frag_eq_present;
+};
+
+/**
+ * struct ipa_flt_rule - attributes of a filtering rule
+ * @retain_hdr: bool switch to instruct IPA core to add back to the packet
+ * the header removed as part of header removal
+ * @to_uc: bool switch to pass packet to micro-controller
+ * @action: action field
+ * @rt_tbl_hdl: handle of table from "get"
+ * @attrib: attributes of the rule
+ * @eq_attrib: attributes of the rule in equation form (valid when
+ * eq_attrib_type is true)
+ * @rt_tbl_idx: index of RT table referred to by filter rule (valid when
+ * eq_attrib_type is true and non-exception action)
+ * @eq_attrib_type: true if equation level form used to specify attributes
+ * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit,
+ * IPA will use the rule and will not look for other rules that may have
+ * higher priority
+ * @hashable: bool switch. is this rule hashable or not?
+ * ipa uses hashable rules to cache their hit results to be used in
+ * consecutive packets
+ * @rule_id: rule_id to be assigned to the filter rule. In case client specifies
+ * rule_id as 0 the driver will assign a new rule_id
+ */
+struct ipa_flt_rule {
+ uint8_t retain_hdr;
+ uint8_t to_uc;
+ enum ipa_flt_action action;
+ uint32_t rt_tbl_hdl;
+ struct ipa_rule_attrib attrib;
+ struct ipa_ipfltri_rule_eq eq_attrib;
+ uint32_t rt_tbl_idx;
+ uint8_t eq_attrib_type;
+ uint8_t max_prio;
+ uint8_t hashable;
+ uint16_t rule_id;
+};
+
+/**
+ * enum ipa_hdr_l2_type - L2 header type
+ * IPA_HDR_L2_NONE: L2 header which isn't Ethernet II and isn't 802_3
+ * IPA_HDR_L2_ETHERNET_II: L2 header of type Ethernet II
+ * IPA_HDR_L2_802_3: L2 header of type 802_3
+ */
+enum ipa_hdr_l2_type {
+ IPA_HDR_L2_NONE,
+ IPA_HDR_L2_ETHERNET_II,
+ IPA_HDR_L2_802_3,
+ IPA_HDR_L2_MAX,
+};
+
+/**
+ * enum ipa_hdr_l2_type - Processing context type
+ * IPA_HDR_PROC_NONE: No processing context
+ * IPA_HDR_PROC_ETHII_TO_ETHII: Process Ethernet II to Ethernet II
+ * IPA_HDR_PROC_ETHII_TO_802_3: Process Ethernet II to 802_3
+ * IPA_HDR_PROC_802_3_TO_ETHII: Process 802_3 to Ethernet II
+ * IPA_HDR_PROC_802_3_TO_802_3: Process 802_3 to 802_3
+ */
+enum ipa_hdr_proc_type {
+ IPA_HDR_PROC_NONE,
+ IPA_HDR_PROC_ETHII_TO_ETHII,
+ IPA_HDR_PROC_ETHII_TO_802_3,
+ IPA_HDR_PROC_802_3_TO_ETHII,
+ IPA_HDR_PROC_802_3_TO_802_3,
+ IPA_HDR_PROC_MAX,
+};
+
+/**
+ * struct ipa_rt_rule - attributes of a routing rule
+ * @dst: dst "client"
+ * @hdr_hdl: handle to the dynamic header
+ it is not an index or an offset
+ * @hdr_proc_ctx_hdl: handle to header processing context. if it is provided
+ hdr_hdl shall be 0
+ * @attrib: attributes of the rule
+ * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit,
+ * IPA will use the rule and will not look for other rules that may have
+ * higher priority
+ * @hashable: bool switch. is this rule hashable or not?
+ * ipa uses hashable rules to cache their hit results to be used in
+ * consecutive packets
+ * @retain_hdr: bool switch to instruct IPA core to add back to the packet
+ * the header removed as part of header removal
+ */
+struct ipa_rt_rule {
+ enum ipa_client_type dst;
+ uint32_t hdr_hdl;
+ uint32_t hdr_proc_ctx_hdl;
+ struct ipa_rule_attrib attrib;
+ uint8_t max_prio;
+ uint8_t hashable;
+ uint8_t retain_hdr;
+};
+
+/**
+ * struct ipa_hdr_add - header descriptor includes in and out
+ * parameters
+ * @name: name of the header
+ * @hdr: actual header to be inserted
+ * @hdr_len: size of above header
+ * @type: l2 header type
+ * @is_partial: header not fully specified
+ * @hdr_hdl: out parameter, handle to header, valid when status is 0
+ * @status: out parameter, status of header add operation,
+ * 0 for success,
+ * -1 for failure
+ * @is_eth2_ofst_valid: is eth2_ofst field valid?
+ * @eth2_ofst: offset to start of Ethernet-II/802.3 header
+ */
+struct ipa_hdr_add {
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint8_t hdr[IPA_HDR_MAX_SIZE];
+ uint8_t hdr_len;
+ enum ipa_hdr_l2_type type;
+ uint8_t is_partial;
+ uint32_t hdr_hdl;
+ int status;
+ uint8_t is_eth2_ofst_valid;
+ uint16_t eth2_ofst;
+};
+
+/**
+ * struct ipa_ioc_add_hdr - header addition parameters (support
+ * multiple headers and commit)
+ * @commit: should headers be written to IPA HW also?
+ * @num_hdrs: num of headers that follow
+ * @ipa_hdr_add hdr: all headers need to go here back to
+ * back, no pointers
+ */
+struct ipa_ioc_add_hdr {
+ uint8_t commit;
+ uint8_t num_hdrs;
+ struct ipa_hdr_add hdr[0];
+};
+
+/**
+ * struct ipa_hdr_proc_ctx_add - processing context descriptor includes
+ * in and out parameters
+ * @type: processing context type
+ * @hdr_hdl: in parameter, handle to header
+ * @proc_ctx_hdl: out parameter, handle to proc_ctx, valid when status is 0
+ * @status: out parameter, status of header add operation,
+ * 0 for success,
+ * -1 for failure
+ */
+struct ipa_hdr_proc_ctx_add {
+ enum ipa_hdr_proc_type type;
+ uint32_t hdr_hdl;
+ uint32_t proc_ctx_hdl;
+ int status;
+};
+
+/**
+ * struct ipa_ioc_add_hdr - processing context addition parameters (support
+ * multiple processing context and commit)
+ * @commit: should processing context be written to IPA HW also?
+ * @num_proc_ctxs: num of processing context that follow
+ * @proc_ctx: all processing context need to go here back to
+ * back, no pointers
+ */
+struct ipa_ioc_add_hdr_proc_ctx {
+ uint8_t commit;
+ uint8_t num_proc_ctxs;
+ struct ipa_hdr_proc_ctx_add proc_ctx[0];
+};
+
+/**
+ * struct ipa_ioc_copy_hdr - retrieve a copy of the specified
+ * header - caller can then derive the complete header
+ * @name: name of the header resource
+ * @hdr: out parameter, contents of specified header,
+ * valid only when ioctl return val is non-negative
+ * @hdr_len: out parameter, size of above header
+ * valid only when ioctl return val is non-negative
+ * @type: l2 header type
+ * valid only when ioctl return val is non-negative
+ * @is_partial: out parameter, indicates whether specified header is partial
+ * valid only when ioctl return val is non-negative
+ * @is_eth2_ofst_valid: is eth2_ofst field valid?
+ * @eth2_ofst: offset to start of Ethernet-II/802.3 header
+ */
+struct ipa_ioc_copy_hdr {
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint8_t hdr[IPA_HDR_MAX_SIZE];
+ uint8_t hdr_len;
+ enum ipa_hdr_l2_type type;
+ uint8_t is_partial;
+ uint8_t is_eth2_ofst_valid;
+ uint16_t eth2_ofst;
+};
+
+/**
+ * struct ipa_ioc_get_hdr - header entry lookup parameters, if lookup was
+ * successful caller must call put to release the reference count when done
+ * @name: name of the header resource
+ * @hdl: out parameter, handle of header entry
+ * valid only when ioctl return val is non-negative
+ */
+struct ipa_ioc_get_hdr {
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint32_t hdl;
+};
+
+/**
+ * struct ipa_hdr_del - header descriptor includes in and out
+ * parameters
+ *
+ * @hdl: handle returned from header add operation
+ * @status: out parameter, status of header remove operation,
+ * 0 for success,
+ * -1 for failure
+ */
+struct ipa_hdr_del {
+ uint32_t hdl;
+ int status;
+};
+
+/**
+ * struct ipa_ioc_del_hdr - header deletion parameters (support
+ * multiple headers and commit)
+ * @commit: should headers be removed from IPA HW also?
+ * @num_hdls: num of headers being removed
+ * @ipa_hdr_del hdl: all handles need to go here back to back, no pointers
+ */
+struct ipa_ioc_del_hdr {
+ uint8_t commit;
+ uint8_t num_hdls;
+ struct ipa_hdr_del hdl[0];
+};
+
+/**
+ * struct ipa_hdr_proc_ctx_del - processing context descriptor includes
+ * in and out parameters
+ * @hdl: handle returned from processing context add operation
+ * @status: out parameter, status of header remove operation,
+ * 0 for success,
+ * -1 for failure
+ */
+struct ipa_hdr_proc_ctx_del {
+ uint32_t hdl;
+ int status;
+};
+
+/**
+ * ipa_ioc_del_hdr_proc_ctx - processing context deletion parameters (support
+ * multiple headers and commit)
+ * @commit: should processing contexts be removed from IPA HW also?
+ * @num_hdls: num of processing contexts being removed
+ * @ipa_hdr_proc_ctx_del hdl: all handles need to go here back to back,
+ * no pointers
+ */
+struct ipa_ioc_del_hdr_proc_ctx {
+ uint8_t commit;
+ uint8_t num_hdls;
+ struct ipa_hdr_proc_ctx_del hdl[0];
+};
+
+/**
+ * struct ipa_rt_rule_add - routing rule descriptor includes in
+ * and out parameters
+ * @rule: actual rule to be added
+ * @at_rear: add at back of routing table, it is NOT possible to add rules at
+ * the rear of the "default" routing tables
+ * @rt_rule_hdl: output parameter, handle to rule, valid when status is 0
+ * @status: output parameter, status of routing rule add operation,
+ * 0 for success,
+ * -1 for failure
+ */
+struct ipa_rt_rule_add {
+ struct ipa_rt_rule rule;
+ uint8_t at_rear;
+ uint32_t rt_rule_hdl;
+ int status;
+};
+
+/**
+ * struct ipa_ioc_add_rt_rule - routing rule addition parameters (supports
+ * multiple rules and commit);
+ *
+ * all rules MUST be added to same table
+ * @commit: should rules be written to IPA HW also?
+ * @ip: IP family of rule
+ * @rt_tbl_name: name of routing table resource
+ * @num_rules: number of routing rules that follow
+ * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers
+ */
+struct ipa_ioc_add_rt_rule {
+ uint8_t commit;
+ enum ipa_ip_type ip;
+ char rt_tbl_name[IPA_RESOURCE_NAME_MAX];
+ uint8_t num_rules;
+ struct ipa_rt_rule_add rules[0];
+};
+
+/**
+ * struct ipa_ioc_add_rt_rule_after - routing rule addition after a specific
+ * rule parameters(supports multiple rules and commit);
+ *
+ * all rules MUST be added to same table
+ * @commit: should rules be written to IPA HW also?
+ * @ip: IP family of rule
+ * @rt_tbl_name: name of routing table resource
+ * @num_rules: number of routing rules that follow
+ * @add_after_hdl: the rules will be added after this specific rule
+ * @ipa_rt_rule_add rules: all rules need to go back to back here, no pointers
+ * at_rear field will be ignored when using this IOCTL
+ */
+struct ipa_ioc_add_rt_rule_after {
+ uint8_t commit;
+ enum ipa_ip_type ip;
+ char rt_tbl_name[IPA_RESOURCE_NAME_MAX];
+ uint8_t num_rules;
+ uint32_t add_after_hdl;
+ struct ipa_rt_rule_add rules[0];
+};
+
+/**
+ * struct ipa_rt_rule_mdfy - routing rule descriptor includes
+ * in and out parameters
+ * @rule: actual rule to be added
+ * @rt_rule_hdl: handle to rule which supposed to modify
+ * @status: output parameter, status of routing rule modify operation,
+ * 0 for success,
+ * -1 for failure
+ *
+ */
+struct ipa_rt_rule_mdfy {
+ struct ipa_rt_rule rule;
+ uint32_t rt_rule_hdl;
+ int status;
+};
+
+/**
+ * struct ipa_ioc_mdfy_rt_rule - routing rule modify parameters (supports
+ * multiple rules and commit)
+ * @commit: should rules be written to IPA HW also?
+ * @ip: IP family of rule
+ * @num_rules: number of routing rules that follow
+ * @rules: all rules need to go back to back here, no pointers
+ */
+struct ipa_ioc_mdfy_rt_rule {
+ uint8_t commit;
+ enum ipa_ip_type ip;
+ uint8_t num_rules;
+ struct ipa_rt_rule_mdfy rules[0];
+};
+
+/**
+ * struct ipa_rt_rule_del - routing rule descriptor includes in
+ * and out parameters
+ * @hdl: handle returned from route rule add operation
+ * @status: output parameter, status of route rule delete operation,
+ * 0 for success,
+ * -1 for failure
+ */
+struct ipa_rt_rule_del {
+ uint32_t hdl;
+ int status;
+};
+
+/**
+ * struct ipa_ioc_del_rt_rule - routing rule deletion parameters (supports
+ * multiple headers and commit)
+ * @commit: should rules be removed from IPA HW also?
+ * @ip: IP family of rules
+ * @num_hdls: num of rules being removed
+ * @ipa_rt_rule_del hdl: all handles need to go back to back here, no pointers
+ */
+struct ipa_ioc_del_rt_rule {
+ uint8_t commit;
+ enum ipa_ip_type ip;
+ uint8_t num_hdls;
+ struct ipa_rt_rule_del hdl[0];
+};
+
+/**
+ * struct ipa_ioc_get_rt_tbl_indx - routing table index lookup parameters
+ * @ip: IP family of table
+ * @name: name of routing table resource
+ * @index: output parameter, routing table index, valid only when ioctl
+ * return val is non-negative
+ */
+struct ipa_ioc_get_rt_tbl_indx {
+ enum ipa_ip_type ip;
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint32_t idx;
+};
+
+/**
+ * struct ipa_flt_rule_add - filtering rule descriptor includes
+ * in and out parameters
+ * @rule: actual rule to be added
+ * @at_rear: add at back of filtering table?
+ * @flt_rule_hdl: out parameter, handle to rule, valid when status is 0
+ * @status: output parameter, status of filtering rule add operation,
+ * 0 for success,
+ * -1 for failure
+ *
+ */
+struct ipa_flt_rule_add {
+ struct ipa_flt_rule rule;
+ uint8_t at_rear;
+ uint32_t flt_rule_hdl;
+ int status;
+};
+
+/**
+ * struct ipa_ioc_add_flt_rule - filtering rule addition parameters (supports
+ * multiple rules and commit)
+ * all rules MUST be added to same table
+ * @commit: should rules be written to IPA HW also?
+ * @ip: IP family of rule
+ * @ep: which "clients" pipe does this rule apply to?
+ * valid only when global is 0
+ * @global: does this apply to global filter table of specific IP family
+ * @num_rules: number of filtering rules that follow
+ * @rules: all rules need to go back to back here, no pointers
+ */
+struct ipa_ioc_add_flt_rule {
+ uint8_t commit;
+ enum ipa_ip_type ip;
+ enum ipa_client_type ep;
+ uint8_t global;
+ uint8_t num_rules;
+ struct ipa_flt_rule_add rules[0];
+};
+
+/**
+ * struct ipa_ioc_add_flt_rule_after - filtering rule addition after specific
+ * rule parameters (supports multiple rules and commit)
+ * all rules MUST be added to same table
+ * @commit: should rules be written to IPA HW also?
+ * @ip: IP family of rule
+ * @ep: which "clients" pipe does this rule apply to?
+ * @num_rules: number of filtering rules that follow
+ * @add_after_hdl: rules will be added after the rule with this handle
+ * @rules: all rules need to go back to back here, no pointers. at rear field
+ * is ignored when using this IOCTL
+ */
+struct ipa_ioc_add_flt_rule_after {
+ uint8_t commit;
+ enum ipa_ip_type ip;
+ enum ipa_client_type ep;
+ uint8_t num_rules;
+ uint32_t add_after_hdl;
+ struct ipa_flt_rule_add rules[0];
+};
+
+/**
+ * struct ipa_flt_rule_mdfy - filtering rule descriptor includes
+ * in and out parameters
+ * @rule: actual rule to be added
+ * @flt_rule_hdl: handle to rule
+ * @status: output parameter, status of filtering rule modify operation,
+ * 0 for success,
+ * -1 for failure
+ *
+ */
+struct ipa_flt_rule_mdfy {
+ struct ipa_flt_rule rule;
+ uint32_t rule_hdl;
+ int status;
+};
+
+/**
+ * struct ipa_ioc_mdfy_flt_rule - filtering rule modify parameters (supports
+ * multiple rules and commit)
+ * @commit: should rules be written to IPA HW also?
+ * @ip: IP family of rule
+ * @num_rules: number of filtering rules that follow
+ * @rules: all rules need to go back to back here, no pointers
+ */
+struct ipa_ioc_mdfy_flt_rule {
+ uint8_t commit;
+ enum ipa_ip_type ip;
+ uint8_t num_rules;
+ struct ipa_flt_rule_mdfy rules[0];
+};
+
+/**
+ * struct ipa_flt_rule_del - filtering rule descriptor includes
+ * in and out parameters
+ *
+ * @hdl: handle returned from filtering rule add operation
+ * @status: output parameter, status of filtering rule delete operation,
+ * 0 for success,
+ * -1 for failure
+ */
+struct ipa_flt_rule_del {
+ uint32_t hdl;
+ int status;
+};
+
+/**
+ * struct ipa_ioc_del_flt_rule - filtering rule deletion parameters (supports
+ * multiple headers and commit)
+ * @commit: should rules be removed from IPA HW also?
+ * @ip: IP family of rules
+ * @num_hdls: num of rules being removed
+ * @hdl: all handles need to go back to back here, no pointers
+ */
+struct ipa_ioc_del_flt_rule {
+ uint8_t commit;
+ enum ipa_ip_type ip;
+ uint8_t num_hdls;
+ struct ipa_flt_rule_del hdl[0];
+};
+
+/**
+ * struct ipa_ioc_get_rt_tbl - routing table lookup parameters, if lookup was
+ * successful caller must call put to release the reference
+ * count when done
+ * @ip: IP family of table
+ * @name: name of routing table resource
+ * @htl: output parameter, handle of routing table, valid only when ioctl
+ * return val is non-negative
+ */
+struct ipa_ioc_get_rt_tbl {
+ enum ipa_ip_type ip;
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint32_t hdl;
+};
+
+/**
+ * struct ipa_ioc_query_intf - used to lookup number of tx and
+ * rx properties of interface
+ * @name: name of interface
+ * @num_tx_props: output parameter, number of tx properties
+ * valid only when ioctl return val is non-negative
+ * @num_rx_props: output parameter, number of rx properties
+ * valid only when ioctl return val is non-negative
+ * @num_ext_props: output parameter, number of ext properties
+ * valid only when ioctl return val is non-negative
+ * @excp_pipe: exception packets of this interface should be
+ * routed to this pipe
+ */
+struct ipa_ioc_query_intf {
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint32_t num_tx_props;
+ uint32_t num_rx_props;
+ uint32_t num_ext_props;
+ enum ipa_client_type excp_pipe;
+};
+
+/**
+ * struct ipa_ioc_tx_intf_prop - interface tx property
+ * @ip: IP family of routing rule
+ * @attrib: routing rule
+ * @dst_pipe: routing output pipe
+ * @alt_dst_pipe: alternate routing output pipe
+ * @hdr_name: name of associated header if any, empty string when no header
+ * @hdr_l2_type: type of associated header if any, use NONE when no header
+ */
+struct ipa_ioc_tx_intf_prop {
+ enum ipa_ip_type ip;
+ struct ipa_rule_attrib attrib;
+ enum ipa_client_type dst_pipe;
+ enum ipa_client_type alt_dst_pipe;
+ char hdr_name[IPA_RESOURCE_NAME_MAX];
+ enum ipa_hdr_l2_type hdr_l2_type;
+};
+
+/**
+ * struct ipa_ioc_query_intf_tx_props - interface tx propertie
+ * @name: name of interface
+ * @num_tx_props: number of TX properties
+ * @tx[0]: output parameter, the tx properties go here back to back
+ */
+struct ipa_ioc_query_intf_tx_props {
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint32_t num_tx_props;
+ struct ipa_ioc_tx_intf_prop tx[0];
+};
+
+/**
+ * struct ipa_ioc_ext_intf_prop - interface extended property
+ * @ip: IP family of routing rule
+ * @eq_attrib: attributes of the rule in equation form
+ * @action: action field
+ * @rt_tbl_idx: index of RT table referred to by filter rule
+ * @mux_id: MUX_ID
+ * @filter_hdl: handle of filter (as specified by provider of filter rule)
+ * @is_xlat_rule: it is xlat flt rule or not
+ */
+struct ipa_ioc_ext_intf_prop {
+ enum ipa_ip_type ip;
+ struct ipa_ipfltri_rule_eq eq_attrib;
+ enum ipa_flt_action action;
+ uint32_t rt_tbl_idx;
+ uint8_t mux_id;
+ uint32_t filter_hdl;
+ uint8_t is_xlat_rule;
+ uint32_t rule_id;
+ uint8_t is_rule_hashable;
+};
+
+/**
+ * struct ipa_ioc_query_intf_ext_props - interface ext propertie
+ * @name: name of interface
+ * @num_ext_props: number of EXT properties
+ * @ext[0]: output parameter, the ext properties go here back to back
+ */
+struct ipa_ioc_query_intf_ext_props {
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint32_t num_ext_props;
+ struct ipa_ioc_ext_intf_prop ext[0];
+};
+
+/**
+ * struct ipa_ioc_rx_intf_prop - interface rx property
+ * @ip: IP family of filtering rule
+ * @attrib: filtering rule
+ * @src_pipe: input pipe
+ * @hdr_l2_type: type of associated header if any, use NONE when no header
+ */
+struct ipa_ioc_rx_intf_prop {
+ enum ipa_ip_type ip;
+ struct ipa_rule_attrib attrib;
+ enum ipa_client_type src_pipe;
+ enum ipa_hdr_l2_type hdr_l2_type;
+};
+
+/**
+ * struct ipa_ioc_query_intf_rx_props - interface rx propertie
+ * @name: name of interface
+ * @num_rx_props: number of RX properties
+ * @rx: output parameter, the rx properties go here back to back
+ */
+struct ipa_ioc_query_intf_rx_props {
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint32_t num_rx_props;
+ struct ipa_ioc_rx_intf_prop rx[0];
+};
+
+/**
+ * struct ipa_ioc_nat_alloc_mem - nat table memory allocation
+ * properties
+ * @dev_name: input parameter, the name of table
+ * @size: input parameter, size of table in bytes
+ * @offset: output parameter, offset into page in case of system memory
+ */
+struct ipa_ioc_nat_alloc_mem {
+ char dev_name[IPA_RESOURCE_NAME_MAX];
+ size_t size;
+ off_t offset;
+};
+
+/**
+ * struct ipa_ioc_v4_nat_init - nat table initialization
+ * parameters
+ * @tbl_index: input parameter, index of the table
+ * @ipv4_rules_offset: input parameter, ipv4 rules address offset
+ * @expn_rules_offset: input parameter, ipv4 expansion rules address offset
+ * @index_offset: input parameter, index rules offset
+ * @index_expn_offset: input parameter, index expansion rules offset
+ * @table_entries: input parameter, ipv4 rules table size in entries
+ * @expn_table_entries: input parameter, ipv4 expansion rules table size
+ * @ip_addr: input parameter, public ip address
+ */
+struct ipa_ioc_v4_nat_init {
+ uint8_t tbl_index;
+ uint32_t ipv4_rules_offset;
+ uint32_t expn_rules_offset;
+
+ uint32_t index_offset;
+ uint32_t index_expn_offset;
+
+ uint16_t table_entries;
+ uint16_t expn_table_entries;
+ uint32_t ip_addr;
+};
+
+/**
+ * struct ipa_ioc_v4_nat_del - nat table delete parameter
+ * @table_index: input parameter, index of the table
+ * @public_ip_addr: input parameter, public ip address
+ */
+struct ipa_ioc_v4_nat_del {
+ uint8_t table_index;
+ uint32_t public_ip_addr;
+};
+
+/**
+ * struct ipa_ioc_nat_dma_one - nat dma command parameter
+ * @table_index: input parameter, index of the table
+ * @base_addr: type of table, from which the base address of the table
+ * can be inferred
+ * @offset: destination offset within the NAT table
+ * @data: data to be written.
+ */
+struct ipa_ioc_nat_dma_one {
+ uint8_t table_index;
+ uint8_t base_addr;
+
+ uint32_t offset;
+ uint16_t data;
+
+};
+
+/**
+ * struct ipa_ioc_nat_dma_cmd - To hold multiple nat dma commands
+ * @entries: number of dma commands in use
+ * @dma: data pointer to the dma commands
+ */
+struct ipa_ioc_nat_dma_cmd {
+ uint8_t entries;
+ struct ipa_ioc_nat_dma_one dma[0];
+
+};
+
+/**
+ * struct ipa_msg_meta - Format of the message meta-data.
+ * @msg_type: the type of the message
+ * @rsvd: reserved bits for future use.
+ * @msg_len: the length of the message in bytes
+ *
+ * For push model:
+ * Client in user-space should issue a read on the device (/dev/ipa) with a
+ * sufficiently large buffer in a continuous loop, call will block when there is
+ * no message to read. Upon return, client can read the ipa_msg_meta from start
+ * of buffer to find out type and length of message
+ * size of buffer supplied >= (size of largest message + size of metadata)
+ *
+ * For pull model:
+ * Client in user-space can also issue a pull msg IOCTL to device (/dev/ipa)
+ * with a payload containing space for the ipa_msg_meta and the message specific
+ * payload length.
+ * size of buffer supplied == (len of specific message + size of metadata)
+ */
+struct ipa_msg_meta {
+ uint8_t msg_type;
+ uint8_t rsvd;
+ uint16_t msg_len;
+};
+
+/**
+ * struct ipa_wlan_msg - To hold information about wlan client
+ * @name: name of the wlan interface
+ * @mac_addr: mac address of wlan client
+ *
+ * wlan drivers need to pass name of wlan iface and mac address of
+ * wlan client along with ipa_wlan_event, whenever a wlan client is
+ * connected/disconnected/moved to power save/come out of power save
+ */
+struct ipa_wlan_msg {
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint8_t mac_addr[IPA_MAC_ADDR_SIZE];
+};
+
+/**
+ * enum ipa_wlan_hdr_attrib_type - attribute type
+ * in wlan client header
+ *
+ * WLAN_HDR_ATTRIB_MAC_ADDR: attrib type mac address
+ * WLAN_HDR_ATTRIB_STA_ID: attrib type station id
+ */
+enum ipa_wlan_hdr_attrib_type {
+ WLAN_HDR_ATTRIB_MAC_ADDR,
+ WLAN_HDR_ATTRIB_STA_ID
+};
+
+/**
+ * struct ipa_wlan_hdr_attrib_val - header attribute value
+ * @attrib_type: type of attribute
+ * @offset: offset of attribute within header
+ * @u.mac_addr: mac address
+ * @u.sta_id: station id
+ */
+struct ipa_wlan_hdr_attrib_val {
+ enum ipa_wlan_hdr_attrib_type attrib_type;
+ uint8_t offset;
+ union {
+ uint8_t mac_addr[IPA_MAC_ADDR_SIZE];
+ uint8_t sta_id;
+ } u;
+};
+
+/**
+ * struct ipa_wlan_msg_ex - To hold information about wlan client
+ * @name: name of the wlan interface
+ * @num_of_attribs: number of attributes
+ * @attrib_val: holds attribute values
+ *
+ * wlan drivers need to pass name of wlan iface and mac address
+ * of wlan client or station id along with ipa_wlan_event,
+ * whenever a wlan client is connected/disconnected/moved to
+ * power save/come out of power save
+ */
+struct ipa_wlan_msg_ex {
+ char name[IPA_RESOURCE_NAME_MAX];
+ uint8_t num_of_attribs;
+ struct ipa_wlan_hdr_attrib_val attribs[0];
+};
+
+struct ipa_ecm_msg {
+ char name[IPA_RESOURCE_NAME_MAX];
+ int ifindex;
+};
+
+/**
+ * struct ipa_wan_msg - To hold information about wan client
+ * @name: name of the wan interface
+ *
+ * CnE need to pass the name of default wan iface when connected/disconnected.
+ * netmgr need to pass the name of wan eMBMS iface when connected.
+ */
+struct ipa_wan_msg {
+ char upstream_ifname[IPA_RESOURCE_NAME_MAX];
+ char tethered_ifname[IPA_RESOURCE_NAME_MAX];
+ enum ipa_ip_type ip;
+};
+
+/**
+ * struct ipa_ioc_rm_dependency - parameters for add/delete dependency
+ * @resource_name: name of dependent resource
+ * @depends_on_name: name of its dependency
+ */
+struct ipa_ioc_rm_dependency {
+ enum ipa_rm_resource_name resource_name;
+ enum ipa_rm_resource_name depends_on_name;
+};
+
+struct ipa_ioc_generate_flt_eq {
+ enum ipa_ip_type ip;
+ struct ipa_rule_attrib attrib;
+ struct ipa_ipfltri_rule_eq eq_attrib;
+};
+
+/**
+ * struct ipa_ioc_write_qmapid - to write mux id to endpoint meta register
+ * @mux_id: mux id of wan
+ */
+struct ipa_ioc_write_qmapid {
+ enum ipa_client_type client;
+ uint8_t qmap_id;
+};
+
+enum ipacm_client_enum {
+ IPACM_CLIENT_USB = 1,
+ IPACM_CLIENT_WLAN,
+ IPACM_CLIENT_MAX
+};
+/**
+ * actual IOCTLs supported by IPA driver
+ */
+#define IPA_IOC_ADD_HDR _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_ADD_HDR, \
+ struct ipa_ioc_add_hdr *)
+#define IPA_IOC_DEL_HDR _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_DEL_HDR, \
+ struct ipa_ioc_del_hdr *)
+#define IPA_IOC_ADD_RT_RULE _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_ADD_RT_RULE, \
+ struct ipa_ioc_add_rt_rule *)
+#define IPA_IOC_ADD_RT_RULE_AFTER _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_ADD_RT_RULE_AFTER, \
+ struct ipa_ioc_add_rt_rule_after *)
+#define IPA_IOC_DEL_RT_RULE _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_DEL_RT_RULE, \
+ struct ipa_ioc_del_rt_rule *)
+#define IPA_IOC_ADD_FLT_RULE _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_ADD_FLT_RULE, \
+ struct ipa_ioc_add_flt_rule *)
+#define IPA_IOC_ADD_FLT_RULE_AFTER _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_ADD_FLT_RULE_AFTER, \
+ struct ipa_ioc_add_flt_rule_after *)
+#define IPA_IOC_DEL_FLT_RULE _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_DEL_FLT_RULE, \
+ struct ipa_ioc_del_flt_rule *)
+#define IPA_IOC_COMMIT_HDR _IO(IPA_IOC_MAGIC,\
+ IPA_IOCTL_COMMIT_HDR)
+#define IPA_IOC_RESET_HDR _IO(IPA_IOC_MAGIC,\
+ IPA_IOCTL_RESET_HDR)
+#define IPA_IOC_COMMIT_RT _IOW(IPA_IOC_MAGIC, \
+ IPA_IOCTL_COMMIT_RT, \
+ enum ipa_ip_type)
+#define IPA_IOC_RESET_RT _IOW(IPA_IOC_MAGIC, \
+ IPA_IOCTL_RESET_RT, \
+ enum ipa_ip_type)
+#define IPA_IOC_COMMIT_FLT _IOW(IPA_IOC_MAGIC, \
+ IPA_IOCTL_COMMIT_FLT, \
+ enum ipa_ip_type)
+#define IPA_IOC_RESET_FLT _IOW(IPA_IOC_MAGIC, \
+ IPA_IOCTL_RESET_FLT, \
+ enum ipa_ip_type)
+#define IPA_IOC_DUMP _IO(IPA_IOC_MAGIC, \
+ IPA_IOCTL_DUMP)
+#define IPA_IOC_GET_RT_TBL _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_GET_RT_TBL, \
+ struct ipa_ioc_get_rt_tbl *)
+#define IPA_IOC_PUT_RT_TBL _IOW(IPA_IOC_MAGIC, \
+ IPA_IOCTL_PUT_RT_TBL, \
+ uint32_t)
+#define IPA_IOC_COPY_HDR _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_COPY_HDR, \
+ struct ipa_ioc_copy_hdr *)
+#define IPA_IOC_QUERY_INTF _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_QUERY_INTF, \
+ struct ipa_ioc_query_intf *)
+#define IPA_IOC_QUERY_INTF_TX_PROPS _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_QUERY_INTF_TX_PROPS, \
+ struct ipa_ioc_query_intf_tx_props *)
+#define IPA_IOC_QUERY_INTF_RX_PROPS _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_QUERY_INTF_RX_PROPS, \
+ struct ipa_ioc_query_intf_rx_props *)
+#define IPA_IOC_QUERY_INTF_EXT_PROPS _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_QUERY_INTF_EXT_PROPS, \
+ struct ipa_ioc_query_intf_ext_props *)
+#define IPA_IOC_GET_HDR _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_GET_HDR, \
+ struct ipa_ioc_get_hdr *)
+#define IPA_IOC_PUT_HDR _IOW(IPA_IOC_MAGIC, \
+ IPA_IOCTL_PUT_HDR, \
+ uint32_t)
+#define IPA_IOC_ALLOC_NAT_MEM _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_ALLOC_NAT_MEM, \
+ struct ipa_ioc_nat_alloc_mem *)
+#define IPA_IOC_V4_INIT_NAT _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_V4_INIT_NAT, \
+ struct ipa_ioc_v4_nat_init *)
+#define IPA_IOC_NAT_DMA _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_NAT_DMA, \
+ struct ipa_ioc_nat_dma_cmd *)
+#define IPA_IOC_V4_DEL_NAT _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_V4_DEL_NAT, \
+ struct ipa_ioc_v4_nat_del *)
+#define IPA_IOC_GET_NAT_OFFSET _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_GET_NAT_OFFSET, \
+ uint32_t *)
+#define IPA_IOC_SET_FLT _IOW(IPA_IOC_MAGIC, \
+ IPA_IOCTL_SET_FLT, \
+ uint32_t)
+#define IPA_IOC_PULL_MSG _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_PULL_MSG, \
+ struct ipa_msg_meta *)
+#define IPA_IOC_RM_ADD_DEPENDENCY _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_RM_ADD_DEPENDENCY, \
+ struct ipa_ioc_rm_dependency *)
+#define IPA_IOC_RM_DEL_DEPENDENCY _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_RM_DEL_DEPENDENCY, \
+ struct ipa_ioc_rm_dependency *)
+#define IPA_IOC_GENERATE_FLT_EQ _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_GENERATE_FLT_EQ, \
+ struct ipa_ioc_generate_flt_eq *)
+#define IPA_IOC_QUERY_EP_MAPPING _IOR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_QUERY_EP_MAPPING, \
+ uint32_t)
+#define IPA_IOC_QUERY_RT_TBL_INDEX _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_QUERY_RT_TBL_INDEX, \
+ struct ipa_ioc_get_rt_tbl_indx *)
+#define IPA_IOC_WRITE_QMAPID _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_WRITE_QMAPID, \
+ struct ipa_ioc_write_qmapid *)
+#define IPA_IOC_MDFY_FLT_RULE _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_MDFY_FLT_RULE, \
+ struct ipa_ioc_mdfy_flt_rule *)
+#define IPA_IOC_MDFY_RT_RULE _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_MDFY_RT_RULE, \
+ struct ipa_ioc_mdfy_rt_rule *)
+
+#define IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_ADD _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_ADD, \
+ struct ipa_wan_msg *)
+
+#define IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_DEL _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_NOTIFY_WAN_UPSTREAM_ROUTE_DEL, \
+ struct ipa_wan_msg *)
+#define IPA_IOC_NOTIFY_WAN_EMBMS_CONNECTED _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_NOTIFY_WAN_EMBMS_CONNECTED, \
+ struct ipa_wan_msg *)
+#define IPA_IOC_ADD_HDR_PROC_CTX _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_ADD_HDR_PROC_CTX, \
+ struct ipa_ioc_add_hdr_proc_ctx *)
+#define IPA_IOC_DEL_HDR_PROC_CTX _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_DEL_HDR_PROC_CTX, \
+ struct ipa_ioc_del_hdr_proc_ctx *)
+
+#define IPA_IOC_GET_HW_VERSION _IOWR(IPA_IOC_MAGIC, \
+ IPA_IOCTL_GET_HW_VERSION, \
+ enum ipa_hw_type *)
+
+/*
+ * unique magic number of the Tethering bridge ioctls
+ */
+#define TETH_BRIDGE_IOC_MAGIC 0xCE
+
+/*
+ * Ioctls supported by Tethering bridge driver
+ */
+#define TETH_BRIDGE_IOCTL_SET_BRIDGE_MODE 0
+#define TETH_BRIDGE_IOCTL_SET_AGGR_PARAMS 1
+#define TETH_BRIDGE_IOCTL_GET_AGGR_PARAMS 2
+#define TETH_BRIDGE_IOCTL_GET_AGGR_CAPABILITIES 3
+#define TETH_BRIDGE_IOCTL_MAX 4
+
+
+/**
+ * enum teth_link_protocol_type - link protocol (IP / Ethernet)
+ */
+enum teth_link_protocol_type {
+ TETH_LINK_PROTOCOL_IP,
+ TETH_LINK_PROTOCOL_ETHERNET,
+ TETH_LINK_PROTOCOL_MAX,
+};
+
+/**
+ * enum teth_aggr_protocol_type - Aggregation protocol (MBIM / TLP)
+ */
+enum teth_aggr_protocol_type {
+ TETH_AGGR_PROTOCOL_NONE,
+ TETH_AGGR_PROTOCOL_MBIM,
+ TETH_AGGR_PROTOCOL_TLP,
+ TETH_AGGR_PROTOCOL_MAX,
+};
+
+/**
+ * struct teth_aggr_params_link - Aggregation parameters for uplink/downlink
+ * @aggr_prot: Aggregation protocol (MBIM / TLP)
+ * @max_transfer_size_byte: Maximal size of aggregated packet in bytes.
+ * Default value is 16*1024.
+ * @max_datagrams: Maximal number of IP packets in an aggregated
+ * packet. Default value is 16
+ */
+struct teth_aggr_params_link {
+ enum teth_aggr_protocol_type aggr_prot;
+ uint32_t max_transfer_size_byte;
+ uint32_t max_datagrams;
+};
+
+
+/**
+ * struct teth_aggr_params - Aggregation parmeters
+ * @ul: Uplink parameters
+ * @dl: Downlink parmaeters
+ */
+struct teth_aggr_params {
+ struct teth_aggr_params_link ul;
+ struct teth_aggr_params_link dl;
+};
+
+/**
+ * struct teth_aggr_capabilities - Aggregation capabilities
+ * @num_protocols: Number of protocols described in the array
+ * @prot_caps[]: Array of aggregation capabilities per protocol
+ */
+struct teth_aggr_capabilities {
+ uint16_t num_protocols;
+ struct teth_aggr_params_link prot_caps[0];
+};
+
+/**
+ * struct teth_ioc_set_bridge_mode
+ * @link_protocol: link protocol (IP / Ethernet)
+ * @lcid: logical channel number
+ */
+struct teth_ioc_set_bridge_mode {
+ enum teth_link_protocol_type link_protocol;
+ uint16_t lcid;
+};
+
+/**
+ * struct teth_ioc_set_aggr_params
+ * @aggr_params: Aggregation parmeters
+ * @lcid: logical channel number
+ */
+struct teth_ioc_aggr_params {
+ struct teth_aggr_params aggr_params;
+ uint16_t lcid;
+};
+
+
+#define TETH_BRIDGE_IOC_SET_BRIDGE_MODE _IOW(TETH_BRIDGE_IOC_MAGIC, \
+ TETH_BRIDGE_IOCTL_SET_BRIDGE_MODE, \
+ struct teth_ioc_set_bridge_mode *)
+#define TETH_BRIDGE_IOC_SET_AGGR_PARAMS _IOW(TETH_BRIDGE_IOC_MAGIC, \
+ TETH_BRIDGE_IOCTL_SET_AGGR_PARAMS, \
+ struct teth_ioc_aggr_params *)
+#define TETH_BRIDGE_IOC_GET_AGGR_PARAMS _IOR(TETH_BRIDGE_IOC_MAGIC, \
+ TETH_BRIDGE_IOCTL_GET_AGGR_PARAMS, \
+ struct teth_ioc_aggr_params *)
+#define TETH_BRIDGE_IOC_GET_AGGR_CAPABILITIES _IOWR(TETH_BRIDGE_IOC_MAGIC, \
+ TETH_BRIDGE_IOCTL_GET_AGGR_CAPABILITIES, \
+ struct teth_aggr_capabilities *)
+
+/*
+ * unique magic number of the ODU bridge ioctls
+ */
+#define ODU_BRIDGE_IOC_MAGIC 0xCD
+
+/*
+ * Ioctls supported by ODU bridge driver
+ */
+#define ODU_BRIDGE_IOCTL_SET_MODE 0
+#define ODU_BRIDGE_IOCTL_SET_LLV6_ADDR 1
+#define ODU_BRIDGE_IOCTL_MAX 2
+
+/**
+ * enum odu_bridge_mode - bridge mode
+ * (ROUTER MODE / BRIDGE MODE)
+ */
+enum odu_bridge_mode {
+ ODU_BRIDGE_MODE_ROUTER,
+ ODU_BRIDGE_MODE_BRIDGE,
+ ODU_BRIDGE_MODE_MAX,
+};
+
+#define ODU_BRIDGE_IOC_SET_MODE _IOW(ODU_BRIDGE_IOC_MAGIC, \
+ ODU_BRIDGE_IOCTL_SET_MODE, \
+ enum odu_bridge_mode)
+
+#define ODU_BRIDGE_IOC_SET_LLV6_ADDR _IOW(ODU_BRIDGE_IOC_MAGIC, \
+ ODU_BRIDGE_IOCTL_SET_LLV6_ADDR, \
+ struct in6_addr *)
+
+#endif /* _UAPI_MSM_IPA_H_ */
diff --git a/include/uapi/linux/rmnet_ipa_fd_ioctl.h b/include/uapi/linux/rmnet_ipa_fd_ioctl.h
new file mode 100644
index 000000000000..cbffbf6c2925
--- /dev/null
+++ b/include/uapi/linux/rmnet_ipa_fd_ioctl.h
@@ -0,0 +1,153 @@
+/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _RMNET_IPA_FD_IOCTL_H
+#define _RMNET_IPA_FD_IOCTL_H
+
+#include <linux/ioctl.h>
+#include <linux/ipa_qmi_service_v01.h>
+#include <linux/msm_ipa.h>
+
+/**
+ * unique magic number of the IPA_WAN device
+ */
+#define WAN_IOC_MAGIC 0x69
+
+#define WAN_IOCTL_ADD_FLT_RULE 0
+#define WAN_IOCTL_ADD_FLT_INDEX 1
+#define WAN_IOCTL_VOTE_FOR_BW_MBPS 2
+#define WAN_IOCTL_POLL_TETHERING_STATS 3
+#define WAN_IOCTL_SET_DATA_QUOTA 4
+#define WAN_IOCTL_SET_TETHER_CLIENT_PIPE 5
+#define WAN_IOCTL_QUERY_TETHER_STATS 6
+#define WAN_IOCTL_RESET_TETHER_STATS 7
+#define WAN_IOCTL_QUERY_DL_FILTER_STATS 8
+
+/* User space may not have this defined. */
+#ifndef IFNAMSIZ
+#define IFNAMSIZ 16
+#endif
+
+/**
+ * struct wan_ioctl_poll_tethering_stats - structure used for
+ * WAN_IOCTL_POLL_TETHERING_STATS IOCTL.
+ *
+ * @polling_interval_secs: Polling interval in seconds.
+ * @reset_stats: Indicate whether to reset the stats (use 1) or not.
+ *
+ * The structure to be used by the user space in order to request for the
+ * tethering stats to be polled. Setting the interval to 0 indicates to stop
+ * the polling process.
+ */
+struct wan_ioctl_poll_tethering_stats {
+ uint64_t polling_interval_secs;
+ uint8_t reset_stats;
+};
+
+/**
+ * struct wan_ioctl_set_data_quota - structure used for
+ * WAN_IOCTL_SET_DATA_QUOTA IOCTL.
+ *
+ * @interface_name: Name of the interface on which to set the quota.
+ * @quota_mbytes: Quota (in Mbytes) for the above interface.
+ * @set_quota: Indicate whether to set the quota (use 1) or
+ * unset the quota.
+ *
+ * The structure to be used by the user space in order to request
+ * a quota to be set on a specific interface (by specifying its name).
+ */
+struct wan_ioctl_set_data_quota {
+ char interface_name[IFNAMSIZ];
+ uint64_t quota_mbytes;
+ uint8_t set_quota;
+};
+
+struct wan_ioctl_set_tether_client_pipe {
+ /* enum of tether interface */
+ enum ipacm_client_enum ipa_client;
+ uint8_t reset_client;
+ uint32_t ul_src_pipe_len;
+ uint32_t ul_src_pipe_list[QMI_IPA_MAX_PIPES_V01];
+ uint32_t dl_dst_pipe_len;
+ uint32_t dl_dst_pipe_list[QMI_IPA_MAX_PIPES_V01];
+};
+
+struct wan_ioctl_query_tether_stats {
+ /* Name of the upstream interface */
+ char upstreamIface[IFNAMSIZ];
+ /* Name of the tethered interface */
+ char tetherIface[IFNAMSIZ];
+ /* enum of tether interface */
+ enum ipacm_client_enum ipa_client;
+ 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 wan_ioctl_reset_tether_stats {
+ /* Name of the upstream interface, not support now */
+ char upstreamIface[IFNAMSIZ];
+ /* Indicate whether to reset the stats (use 1) or not */
+ uint8_t reset_stats;
+};
+
+struct wan_ioctl_query_dl_filter_stats {
+ /* Indicate whether to reset the filter stats (use 1) or not*/
+ uint8_t reset_stats;
+ /* Modem response QMI */
+ struct ipa_get_data_stats_resp_msg_v01 stats_resp;
+ /* provide right index to 1st firewall rule */
+ uint32_t index;
+};
+
+#define WAN_IOC_ADD_FLT_RULE _IOWR(WAN_IOC_MAGIC, \
+ WAN_IOCTL_ADD_FLT_RULE, \
+ struct ipa_install_fltr_rule_req_msg_v01 *)
+
+#define WAN_IOC_ADD_FLT_RULE_INDEX _IOWR(WAN_IOC_MAGIC, \
+ WAN_IOCTL_ADD_FLT_INDEX, \
+ struct ipa_fltr_installed_notif_req_msg_v01 *)
+
+#define WAN_IOC_VOTE_FOR_BW_MBPS _IOWR(WAN_IOC_MAGIC, \
+ WAN_IOCTL_VOTE_FOR_BW_MBPS, \
+ uint32_t *)
+
+#define WAN_IOC_POLL_TETHERING_STATS _IOWR(WAN_IOC_MAGIC, \
+ WAN_IOCTL_POLL_TETHERING_STATS, \
+ struct wan_ioctl_poll_tethering_stats *)
+
+#define WAN_IOC_SET_DATA_QUOTA _IOWR(WAN_IOC_MAGIC, \
+ WAN_IOCTL_SET_DATA_QUOTA, \
+ struct wan_ioctl_set_data_quota *)
+
+#define WAN_IOC_SET_TETHER_CLIENT_PIPE _IOWR(WAN_IOC_MAGIC, \
+ WAN_IOCTL_SET_TETHER_CLIENT_PIPE, \
+ struct wan_ioctl_set_tether_client_pipe *)
+
+#define WAN_IOC_QUERY_TETHER_STATS _IOWR(WAN_IOC_MAGIC, \
+ WAN_IOCTL_QUERY_TETHER_STATS, \
+ struct wan_ioctl_query_tether_stats *)
+
+#define WAN_IOC_RESET_TETHER_STATS _IOWR(WAN_IOC_MAGIC, \
+ WAN_IOCTL_RESET_TETHER_STATS, \
+ struct wan_ioctl_reset_tether_stats *)
+
+#define WAN_IOC_QUERY_DL_FILTER_STATS _IOWR(WAN_IOC_MAGIC, \
+ WAN_IOCTL_QUERY_DL_FILTER_STATS, \
+ struct wan_ioctl_query_dl_filter_stats *)
+
+#endif /* _RMNET_IPA_FD_IOCTL_H */