blob: 46ee6da36749933b1557d2bb6c4ec3b1138af4ce [file] [log] [blame]
Utkarsh Saxena971a03c2017-01-22 22:04:13 +05301/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
Amir Levy9659e592016-10-27 18:08:27 +03002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _IPA_H_
14#define _IPA_H_
15
16#include <linux/msm_ipa.h>
17#include <linux/skbuff.h>
18#include <linux/types.h>
19#include <linux/msm-sps.h>
20#include <linux/if_ether.h>
21#include "linux/msm_gsi.h"
22
23#define IPA_APPS_MAX_BW_IN_MBPS 700
24/**
25 * enum ipa_transport_type
26 * transport type: either GSI or SPS
27 */
28enum ipa_transport_type {
29 IPA_TRANSPORT_TYPE_SPS,
30 IPA_TRANSPORT_TYPE_GSI
31};
32
33/**
34 * enum ipa_nat_en_type - NAT setting type in IPA end-point
35 */
36enum ipa_nat_en_type {
37 IPA_BYPASS_NAT,
38 IPA_SRC_NAT,
39 IPA_DST_NAT,
40};
41
42/**
Amir Levy479cfdd2017-10-26 12:23:14 +030043 * enum ipa_ipv6ct_en_type - IPv6CT setting type in IPA end-point
44 */
Amir Levydc65f4c2017-07-06 09:49:50 +030045enum ipa_ipv6ct_en_type {
46 IPA_BYPASS_IPV6CT,
47 IPA_ENABLE_IPV6CT,
48};
49
50/**
Amir Levy9659e592016-10-27 18:08:27 +030051 * enum ipa_mode_type - mode setting type in IPA end-point
52 * @BASIC: basic mode
53 * @ENABLE_FRAMING_HDLC: not currently supported
54 * @ENABLE_DEFRAMING_HDLC: not currently supported
55 * @DMA: all data arriving IPA will not go through IPA logic blocks, this
56 * allows IPA to work as DMA for specific pipes.
57 */
58enum ipa_mode_type {
59 IPA_BASIC,
60 IPA_ENABLE_FRAMING_HDLC,
61 IPA_ENABLE_DEFRAMING_HDLC,
62 IPA_DMA,
63};
64
65/**
66 * enum ipa_aggr_en_type - aggregation setting type in IPA
67 * end-point
68 */
69enum ipa_aggr_en_type {
70 IPA_BYPASS_AGGR,
71 IPA_ENABLE_AGGR,
72 IPA_ENABLE_DEAGGR,
73};
74
75/**
76 * enum ipa_aggr_type - type of aggregation in IPA end-point
77 */
78enum ipa_aggr_type {
79 IPA_MBIM_16 = 0,
80 IPA_HDLC = 1,
81 IPA_TLP = 2,
82 IPA_RNDIS = 3,
83 IPA_GENERIC = 4,
84 IPA_QCMAP = 6,
85};
86
87/**
88 * enum ipa_aggr_mode - global aggregation mode
89 */
90enum ipa_aggr_mode {
91 IPA_MBIM_AGGR,
92 IPA_QCNCM_AGGR,
93};
94
95/**
96 * enum ipa_dp_evt_type - type of event client callback is
97 * invoked for on data path
98 * @IPA_RECEIVE: data is struct sk_buff
99 * @IPA_WRITE_DONE: data is struct sk_buff
100 */
101enum ipa_dp_evt_type {
102 IPA_RECEIVE,
103 IPA_WRITE_DONE,
104 IPA_CLIENT_START_POLL,
105 IPA_CLIENT_COMP_NAPI,
106};
107
108/**
Skylar Changfcf36c22016-10-04 14:15:25 -0700109 * enum hdr_total_len_or_pad_type - type of value held by TOTAL_LEN_OR_PAD
Amir Levy9659e592016-10-27 18:08:27 +0300110 * field in header configuration register.
111 * @IPA_HDR_PAD: field is used as padding length
112 * @IPA_HDR_TOTAL_LEN: field is used as total length
113 */
114enum hdr_total_len_or_pad_type {
115 IPA_HDR_PAD = 0,
116 IPA_HDR_TOTAL_LEN = 1,
117};
118
119/**
Amir Levy2da9d452017-12-12 10:09:46 +0200120* enum ipa_vlan_ifaces - vlan interfaces types
121* @IPA_VLAN_IF_EMAC: used for EMAC ethernet device
122* @IPA_VLAN_IF_RNDIS: used for RNDIS USB device
123* @IPA_VLAN_IF_ECM: used for ECM USB device
124*/
125enum ipa_vlan_ifaces {
126 IPA_VLAN_IF_EMAC,
127 IPA_VLAN_IF_RNDIS,
128 IPA_VLAN_IF_ECM,
129 IPA_VLAN_IF_MAX
130};
131
132/**
Amir Levy9659e592016-10-27 18:08:27 +0300133 * struct ipa_ep_cfg_nat - NAT configuration in IPA end-point
134 * @nat_en: This defines the default NAT mode for the pipe: in case of
135 * filter miss - the default NAT mode defines the NATing operation
136 * on the packet. Valid for Input Pipes only (IPA consumer)
137 */
138struct ipa_ep_cfg_nat {
139 enum ipa_nat_en_type nat_en;
140};
141
142/**
Amir Levydc65f4c2017-07-06 09:49:50 +0300143 * struct ipa_ep_cfg_conn_track - IPv6 Connection tracking configuration in
144 * IPA end-point
145 * @conn_track_en: Defines speculative conn_track action, means if specific
Amir Levy479cfdd2017-10-26 12:23:14 +0300146 * pipe needs to have UL/DL IPv6 Connection Tracking or Bypass
Amir Levydc65f4c2017-07-06 09:49:50 +0300147 * IPv6 Connection Tracking. 0: Bypass IPv6 Connection Tracking
148 * 1: IPv6 UL/DL Connection Tracking.
149 * Valid for Input Pipes only (IPA consumer)
150 */
151struct ipa_ep_cfg_conn_track {
152 enum ipa_ipv6ct_en_type conn_track_en;
153};
154
155/**
Amir Levy9659e592016-10-27 18:08:27 +0300156 * struct ipa_ep_cfg_hdr - header configuration in IPA end-point
157 *
158 * @hdr_len:Header length in bytes to be added/removed. Assuming
159 * header len is constant per endpoint. Valid for
160 * both Input and Output Pipes
161 * @hdr_ofst_metadata_valid: 0: Metadata_Ofst value is invalid, i.e., no
162 * metadata within header.
163 * 1: Metadata_Ofst value is valid, i.e., metadata
164 * within header is in offset Metadata_Ofst Valid
165 * for Input Pipes only (IPA Consumer) (for output
166 * pipes, metadata already set within the header)
167 * @hdr_ofst_metadata: Offset within header in which metadata resides
168 * Size of metadata - 4bytes
169 * Example - Stream ID/SSID/mux ID.
170 * Valid for Input Pipes only (IPA Consumer) (for output
171 * pipes, metadata already set within the header)
172 * @hdr_additional_const_len: Defines the constant length that should be added
173 * to the payload length in order for IPA to update
174 * correctly the length field within the header
175 * (valid only in case Hdr_Ofst_Pkt_Size_Valid=1)
176 * Valid for Output Pipes (IPA Producer)
177 * @hdr_ofst_pkt_size_valid: 0: Hdr_Ofst_Pkt_Size value is invalid, i.e., no
178 * length field within the inserted header
179 * 1: Hdr_Ofst_Pkt_Size value is valid, i.e., a
180 * packet length field resides within the header
181 * Valid for Output Pipes (IPA Producer)
182 * @hdr_ofst_pkt_size: Offset within header in which packet size reside. Upon
183 * Header Insertion, IPA will update this field within the
184 * header with the packet length . Assumption is that
185 * header length field size is constant and is 2Bytes
186 * Valid for Output Pipes (IPA Producer)
187 * @hdr_a5_mux: Determines whether A5 Mux header should be added to the packet.
188 * This bit is valid only when Hdr_En=01(Header Insertion)
189 * SW should set this bit for IPA-to-A5 pipes.
190 * 0: Do not insert A5 Mux Header
191 * 1: Insert A5 Mux Header
192 * Valid for Output Pipes (IPA Producer)
193 * @hdr_remove_additional: bool switch, remove more of the header
194 * based on the aggregation configuration (register
195 * HDR_LEN_INC_DEAGG_HDR)
196 * @hdr_metadata_reg_valid: bool switch, metadata from
197 * register INIT_HDR_METADATA_n is valid.
198 * (relevant only for IPA Consumer pipes)
199 */
200struct ipa_ep_cfg_hdr {
201 u32 hdr_len;
202 u32 hdr_ofst_metadata_valid;
203 u32 hdr_ofst_metadata;
204 u32 hdr_additional_const_len;
205 u32 hdr_ofst_pkt_size_valid;
206 u32 hdr_ofst_pkt_size;
207 u32 hdr_a5_mux;
208 u32 hdr_remove_additional;
209 u32 hdr_metadata_reg_valid;
210};
211
212/**
213 * struct ipa_ep_cfg_hdr_ext - extended header configuration in IPA end-point
214 * @hdr_pad_to_alignment: Pad packet to specified alignment
215 * (2^pad to alignment value), i.e. value of 3 means pad to 2^3 = 8 bytes
216 * alignment. Alignment is to 0,2 up to 32 bytes (IPAv2 does not support 64
217 * byte alignment). Valid for Output Pipes only (IPA Producer).
218 * @hdr_total_len_or_pad_offset: Offset to length field containing either
219 * total length or pad length, per hdr_total_len_or_pad config
220 * @hdr_payload_len_inc_padding: 0-IPA_ENDP_INIT_HDR_n's
221 * HDR_OFST_PKT_SIZE does
222 * not includes padding bytes size, payload_len = packet length,
223 * 1-IPA_ENDP_INIT_HDR_n's HDR_OFST_PKT_SIZE includes
224 * padding bytes size, payload_len = packet length + padding
225 * @hdr_total_len_or_pad: field is used as PAD length ot as Total length
226 * (header + packet + padding)
227 * @hdr_total_len_or_pad_valid: 0-Ignore TOTAL_LEN_OR_PAD field, 1-Process
228 * TOTAL_LEN_OR_PAD field
229 * @hdr_little_endian: 0-Big Endian, 1-Little Endian
230 */
231struct ipa_ep_cfg_hdr_ext {
232 u32 hdr_pad_to_alignment;
233 u32 hdr_total_len_or_pad_offset;
234 bool hdr_payload_len_inc_padding;
235 enum hdr_total_len_or_pad_type hdr_total_len_or_pad;
236 bool hdr_total_len_or_pad_valid;
237 bool hdr_little_endian;
238};
239
240/**
241 * struct ipa_ep_cfg_mode - mode configuration in IPA end-point
242 * @mode: Valid for Input Pipes only (IPA Consumer)
243 * @dst: This parameter specifies the output pipe to which the packets
244 * will be routed to.
245 * This parameter is valid for Mode=DMA and not valid for
246 * Mode=Basic
247 * Valid for Input Pipes only (IPA Consumer)
248 */
249struct ipa_ep_cfg_mode {
250 enum ipa_mode_type mode;
251 enum ipa_client_type dst;
252};
253
254/**
255 * struct ipa_ep_cfg_aggr - aggregation configuration in IPA end-point
256 *
257 * @aggr_en: Valid for both Input and Output Pipes
258 * @aggr: aggregation type (Valid for both Input and Output Pipes)
259 * @aggr_byte_limit: Limit of aggregated packet size in KB (<=32KB) When set
260 * to 0, there is no size limitation on the aggregation.
261 * When both, Aggr_Byte_Limit and Aggr_Time_Limit are set
262 * to 0, there is no aggregation, every packet is sent
263 * independently according to the aggregation structure
264 * Valid for Output Pipes only (IPA Producer )
265 * @aggr_time_limit: Timer to close aggregated packet (<=32ms) When set to 0,
266 * there is no time limitation on the aggregation. When
267 * both, Aggr_Byte_Limit and Aggr_Time_Limit are set to 0,
268 * there is no aggregation, every packet is sent
269 * independently according to the aggregation structure
270 * Valid for Output Pipes only (IPA Producer)
271 * @aggr_pkt_limit: Defines if EOF close aggregation or not. if set to false
272 * HW closes aggregation (sends EOT) only based on its
273 * aggregation config (byte/time limit, etc). if set to
274 * true EOF closes aggregation in addition to HW based
275 * aggregation closure. Valid for Output Pipes only (IPA
276 * Producer). EOF affects only Pipes configured for
277 * generic aggregation.
278 * @aggr_hard_byte_limit_en: If set to 1, byte-limit aggregation for this
279 * pipe will apply a hard-limit behavior which will not
280 * allow frames to be closed with more than byte-limit
281 * bytes. If set to 0, previous byte-limit behavior
282 * will apply - frames close once a packet causes the
283 * accumulated byte-count to cross the byte-limit
284 * threshold (closed frame will contain that packet).
285 * @aggr_sw_eof_active: 0: EOF does not close aggregation. HW closes aggregation
286 * (sends EOT) only based on its aggregation config
287 * (byte/time limit, etc).
288 * 1: EOF closes aggregation in addition to HW based
289 * aggregation closure. Valid for Output Pipes only (IPA
290 * Producer). EOF affects only Pipes configured for generic
291 * aggregation.
292 */
293struct ipa_ep_cfg_aggr {
294 enum ipa_aggr_en_type aggr_en;
295 enum ipa_aggr_type aggr;
296 u32 aggr_byte_limit;
297 u32 aggr_time_limit;
298 u32 aggr_pkt_limit;
299 u32 aggr_hard_byte_limit_en;
300 bool aggr_sw_eof_active;
301};
302
303/**
304 * struct ipa_ep_cfg_route - route configuration in IPA end-point
305 * @rt_tbl_hdl: Defines the default routing table index to be used in case there
306 * is no filter rule matching, valid for Input Pipes only (IPA
307 * Consumer). Clients should set this to 0 which will cause default
308 * v4 and v6 routes setup internally by IPA driver to be used for
309 * this end-point
310 */
311struct ipa_ep_cfg_route {
312 u32 rt_tbl_hdl;
313};
314
315/**
316 * struct ipa_ep_cfg_holb - head of line blocking configuration in IPA end-point
317 * @en: enable(1 => ok to drop pkt)/disable(0 => never drop pkt)
318 * @tmr_val: duration in units of 128 IPA clk clock cyles [0,511], 1 clk=1.28us
319 * IPAv2.5 support 32 bit HOLB timeout value, previous versions
320 * supports 16 bit
321 */
322struct ipa_ep_cfg_holb {
323 u16 en;
324 u32 tmr_val;
325};
326
327/**
328 * struct ipa_ep_cfg_deaggr - deaggregation configuration in IPA end-point
329 * @deaggr_hdr_len: Deaggregation Header length in bytes. Valid only for Input
330 * Pipes, which are configured for 'Generic' deaggregation.
331 * @packet_offset_valid: - 0: PACKET_OFFSET is not used, 1: PACKET_OFFSET is
332 * used.
333 * @packet_offset_location: Location of packet offset field, which specifies
334 * the offset to the packet from the start of the packet offset field.
335 * @max_packet_len: DEAGGR Max Packet Length in Bytes. A Packet with higher
336 * size wil be treated as an error. 0 - Packet Length is not Bound,
337 * IPA should not check for a Max Packet Length.
338 */
339struct ipa_ep_cfg_deaggr {
340 u32 deaggr_hdr_len;
341 bool packet_offset_valid;
342 u32 packet_offset_location;
343 u32 max_packet_len;
344};
345
346/**
347 * enum ipa_cs_offload - checksum offload setting
348 */
349enum ipa_cs_offload {
350 IPA_DISABLE_CS_OFFLOAD,
351 IPA_ENABLE_CS_OFFLOAD_UL,
352 IPA_ENABLE_CS_OFFLOAD_DL,
353 IPA_CS_RSVD
354};
355
356/**
357 * struct ipa_ep_cfg_cfg - IPA ENDP_INIT Configuration register
358 * @frag_offload_en: - 0 - IP packet fragment handling is disabled. IP packet
359 * fragments should be sent to SW. SW is responsible for
360 * configuring filter rules, and IP packet filter exception should be
361 * used to send all fragments to SW. 1 - IP packet fragment
362 * handling is enabled. IPA checks for fragments and uses frag
363 * rules table for processing fragments. Valid only for Input Pipes
364 * (IPA Consumer)
365 * @cs_offload_en: Checksum offload enable: 00: Disable checksum offload, 01:
366 * Enable checksum calculation offload (UL) - For output pipe
367 * (IPA producer) specifies that checksum trailer is to be added.
368 * For input pipe (IPA consumer) specifies presence of checksum
369 * header and IPA checksum calculation accordingly. 10: Enable
370 * checksum calculation offload (DL) - For output pipe (IPA
371 * producer) specifies that checksum trailer is to be added. For
372 * input pipe (IPA consumer) specifies IPA checksum calculation.
373 * 11: Reserved
374 * @cs_metadata_hdr_offset: Offset in Words (4 bytes) within header in which
375 * checksum meta info header (4 bytes) starts (UL). Values are 0-15, which
376 * mean 0 - 60 byte checksum header offset. Valid for input
377 * pipes only (IPA consumer)
378 * @gen_qmb_master_sel: Select bit for ENDP GEN-QMB master. This is used to
379 * separate DDR & PCIe transactions in-order to limit them as
380 * a group (using MAX_WRITES/READS limiation). Valid for input and
381 * output pipes (IPA consumer+producer)
382 */
383struct ipa_ep_cfg_cfg {
384 bool frag_offload_en;
385 enum ipa_cs_offload cs_offload_en;
386 u8 cs_metadata_hdr_offset;
387 u8 gen_qmb_master_sel;
388};
389
390/**
391 * struct ipa_ep_cfg_metadata_mask - Endpoint initialization hdr metadata mask
392 * @metadata_mask: Mask specifying which metadata bits to write to
393 * IPA_ENDP_INIT_HDR_n.s HDR_OFST_METADATA. Only
394 * masked metadata bits (set to 1) will be written. Valid for Output
395 * Pipes only (IPA Producer)
396 */
397struct ipa_ep_cfg_metadata_mask {
398 u32 metadata_mask;
399};
400
401/**
402 * struct ipa_ep_cfg_metadata - Meta Data configuration in IPA end-point
403 * @md: This defines the meta data from tx data descriptor
404 * @qmap_id: qmap id
405 */
406struct ipa_ep_cfg_metadata {
407 u32 qmap_id;
408};
409
410/**
411 * struct ipa_ep_cfg_seq - HPS/DPS sequencer type configuration in IPA end-point
412 * @set_dynamic: 0 - HPS/DPS seq type is configured statically,
413 * 1 - HPS/DPS seq type is set to seq_type
414 * @seq_type: HPS/DPS sequencer type configuration
415 */
416struct ipa_ep_cfg_seq {
417 bool set_dynamic;
418 int seq_type;
419};
420
421/**
422 * struct ipa_ep_cfg - configuration of IPA end-point
Amir Levy479cfdd2017-10-26 12:23:14 +0300423 * @nat: NAT parameters
424 * @conn_track: IPv6CT parameters
Amir Levy9659e592016-10-27 18:08:27 +0300425 * @hdr: Header parameters
426 * @hdr_ext: Extended header parameters
427 * @mode: Mode parameters
428 * @aggr: Aggregation parameters
429 * @deaggr: Deaggregation params
430 * @route: Routing parameters
431 * @cfg: Configuration register data
432 * @metadata_mask: Hdr metadata mask
433 * @meta: Meta Data
434 * @seq: HPS/DPS sequencers configuration
435 */
436struct ipa_ep_cfg {
437 struct ipa_ep_cfg_nat nat;
Amir Levydc65f4c2017-07-06 09:49:50 +0300438 struct ipa_ep_cfg_conn_track conn_track;
Amir Levy9659e592016-10-27 18:08:27 +0300439 struct ipa_ep_cfg_hdr hdr;
440 struct ipa_ep_cfg_hdr_ext hdr_ext;
441 struct ipa_ep_cfg_mode mode;
442 struct ipa_ep_cfg_aggr aggr;
443 struct ipa_ep_cfg_deaggr deaggr;
444 struct ipa_ep_cfg_route route;
445 struct ipa_ep_cfg_cfg cfg;
446 struct ipa_ep_cfg_metadata_mask metadata_mask;
447 struct ipa_ep_cfg_metadata meta;
448 struct ipa_ep_cfg_seq seq;
449};
450
451/**
452 * struct ipa_ep_cfg_ctrl - Control configuration in IPA end-point
453 * @ipa_ep_suspend: 0 - ENDP is enabled, 1 - ENDP is suspended (disabled).
454 * Valid for PROD Endpoints
455 * @ipa_ep_delay: 0 - ENDP is free-running, 1 - ENDP is delayed.
456 * SW controls the data flow of an endpoint usind this bit.
457 * Valid for CONS Endpoints
458 */
459struct ipa_ep_cfg_ctrl {
460 bool ipa_ep_suspend;
461 bool ipa_ep_delay;
462};
463
464/**
465 * x should be in bytes
466 */
467#define IPA_NUM_OF_FIFO_DESC(x) (x/sizeof(struct sps_iovec))
468typedef void (*ipa_notify_cb)(void *priv, enum ipa_dp_evt_type evt,
469 unsigned long data);
470
471/**
Skylar Changfcf36c22016-10-04 14:15:25 -0700472 * enum ipa_wdi_meter_evt_type - type of event client callback is
473 * for AP+STA mode metering
474 * @IPA_GET_WDI_SAP_STATS: get IPA_stats betwen SAP and STA -
475 * use ipa_get_wdi_sap_stats structure
476 * @IPA_SET_WIFI_QUOTA: set quota limit on STA -
477 * use ipa_set_wifi_quota structure
478 */
479enum ipa_wdi_meter_evt_type {
480 IPA_GET_WDI_SAP_STATS,
481 IPA_SET_WIFI_QUOTA,
482};
483
484struct ipa_get_wdi_sap_stats {
485 /* indicate to reset stats after query */
486 uint8_t reset_stats;
487 /* indicate valid stats from wlan-fw */
488 uint8_t stats_valid;
489 /* Tx: SAP->STA */
490 uint64_t ipv4_tx_packets;
491 uint64_t ipv4_tx_bytes;
492 /* Rx: STA->SAP */
493 uint64_t ipv4_rx_packets;
494 uint64_t ipv4_rx_bytes;
495 uint64_t ipv6_tx_packets;
496 uint64_t ipv6_tx_bytes;
497 uint64_t ipv6_rx_packets;
498 uint64_t ipv6_rx_bytes;
499};
500
501/**
502 * struct ipa_set_wifi_quota - structure used for
503 * IPA_SET_WIFI_QUOTA.
504 *
505 * @quota_bytes: Quota (in bytes) for the STA interface.
506 * @set_quota: Indicate whether to set the quota (use 1) or
507 * unset the quota.
508 *
509 */
510struct ipa_set_wifi_quota {
511 uint64_t quota_bytes;
512 uint8_t set_quota;
513 /* indicate valid quota set from wlan-fw */
514 uint8_t set_valid;
515};
516
517typedef void (*ipa_wdi_meter_notifier_cb)(enum ipa_wdi_meter_evt_type evt,
518 void *data);
519
520/**
Amir Levy9659e592016-10-27 18:08:27 +0300521 * struct ipa_connect_params - low-level client connect input parameters. Either
522 * client allocates the data and desc FIFO and specifies that in data+desc OR
523 * specifies sizes and pipe_mem pref and IPA does the allocation.
524 *
525 * @ipa_ep_cfg: IPA EP configuration
526 * @client: type of "client"
527 * @client_bam_hdl: client SPS handle
528 * @client_ep_idx: client PER EP index
529 * @priv: callback cookie
530 * @notify: callback
531 * priv - callback cookie evt - type of event data - data relevant
532 * to event. May not be valid. See event_type enum for valid
533 * cases.
534 * @desc_fifo_sz: size of desc FIFO
535 * @data_fifo_sz: size of data FIFO
536 * @pipe_mem_preferred: if true, try to alloc the FIFOs in pipe mem, fallback
537 * to sys mem if pipe mem alloc fails
538 * @desc: desc FIFO meta-data when client has allocated it
539 * @data: data FIFO meta-data when client has allocated it
540 * @skip_ep_cfg: boolean field that determines if EP should be configured
541 * by IPA driver
542 * @keep_ipa_awake: when true, IPA will not be clock gated
543 */
544struct ipa_connect_params {
545 struct ipa_ep_cfg ipa_ep_cfg;
546 enum ipa_client_type client;
547 unsigned long client_bam_hdl;
548 u32 client_ep_idx;
549 void *priv;
550 ipa_notify_cb notify;
551 u32 desc_fifo_sz;
552 u32 data_fifo_sz;
553 bool pipe_mem_preferred;
554 struct sps_mem_buffer desc;
555 struct sps_mem_buffer data;
556 bool skip_ep_cfg;
557 bool keep_ipa_awake;
558};
559
560/**
561 * struct ipa_sps_params - SPS related output parameters resulting from
562 * low/high level client connect
563 * @ipa_bam_hdl: IPA SPS handle
564 * @ipa_ep_idx: IPA PER EP index
565 * @desc: desc FIFO meta-data
566 * @data: data FIFO meta-data
567 */
568struct ipa_sps_params {
569 unsigned long ipa_bam_hdl;
570 u32 ipa_ep_idx;
571 struct sps_mem_buffer desc;
572 struct sps_mem_buffer data;
573};
574
575/**
576 * struct ipa_tx_intf - interface tx properties
577 * @num_props: number of tx properties
578 * @prop: the tx properties array
579 */
580struct ipa_tx_intf {
581 u32 num_props;
582 struct ipa_ioc_tx_intf_prop *prop;
583};
584
585/**
586 * struct ipa_rx_intf - interface rx properties
587 * @num_props: number of rx properties
588 * @prop: the rx properties array
589 */
590struct ipa_rx_intf {
591 u32 num_props;
592 struct ipa_ioc_rx_intf_prop *prop;
593};
594
595/**
596 * struct ipa_ext_intf - interface ext properties
597 * @excp_pipe_valid: is next field valid?
598 * @excp_pipe: exception packets should be routed to this pipe
599 * @num_props: number of ext properties
600 * @prop: the ext properties array
601 */
602struct ipa_ext_intf {
603 bool excp_pipe_valid;
604 enum ipa_client_type excp_pipe;
605 u32 num_props;
606 struct ipa_ioc_ext_intf_prop *prop;
607};
608
609/**
610 * struct ipa_sys_connect_params - information needed to setup an IPA end-point
611 * in system-BAM mode
612 * @ipa_ep_cfg: IPA EP configuration
613 * @client: the type of client who "owns" the EP
614 * @desc_fifo_sz: size of desc FIFO. This number is used to allocate the desc
615 * fifo for BAM. For GSI, this size is used by IPA driver as a
616 * baseline to calculate the GSI ring size in the following way:
617 * For PROD pipes, GSI ring is 4 * desc_fifo_sz.
618 For PROD pipes, GSI ring is 2 * desc_fifo_sz.
619 * @priv: callback cookie
620 * @notify: callback
621 * priv - callback cookie
622 * evt - type of event
623 * data - data relevant to event. May not be valid. See event_type
624 * enum for valid cases.
625 * @skip_ep_cfg: boolean field that determines if EP should be configured
626 * by IPA driver
627 * @keep_ipa_awake: when true, IPA will not be clock gated
628 * @napi_enabled: when true, IPA call client callback to start polling
629 */
630struct ipa_sys_connect_params {
631 struct ipa_ep_cfg ipa_ep_cfg;
632 enum ipa_client_type client;
633 u32 desc_fifo_sz;
634 void *priv;
635 ipa_notify_cb notify;
636 bool skip_ep_cfg;
637 bool keep_ipa_awake;
638 bool napi_enabled;
Gidon Studinski3021a6f2016-11-10 12:48:48 +0200639 bool recycle_enabled;
Amir Levy9659e592016-10-27 18:08:27 +0300640};
641
642/**
643 * struct ipa_tx_meta - meta-data for the TX packet
644 * @dma_address: dma mapped address of TX packet
645 * @dma_address_valid: is above field valid?
646 */
647struct ipa_tx_meta {
648 u8 pkt_init_dst_ep;
649 bool pkt_init_dst_ep_valid;
650 bool pkt_init_dst_ep_remote;
651 dma_addr_t dma_address;
652 bool dma_address_valid;
653};
654
655/**
656 * typedef ipa_msg_free_fn - callback function
657 * @param buff - [in] the message payload to free
658 * @param len - [in] size of message payload
659 * @param type - [in] the message type
660 *
661 * Message callback registered by kernel client with IPA driver to
662 * free message payload after IPA driver processing is complete
663 *
664 * No return value
665 */
666typedef void (*ipa_msg_free_fn)(void *buff, u32 len, u32 type);
667
668/**
669 * typedef ipa_msg_pull_fn - callback function
670 * @param buff - [in] where to copy message payload
671 * @param len - [in] size of buffer to copy payload into
672 * @param type - [in] the message type
673 *
674 * Message callback registered by kernel client with IPA driver for
675 * IPA driver to pull messages from the kernel client upon demand from
676 * user-space
677 *
678 * Returns how many bytes were copied into the buffer.
679 */
680typedef int (*ipa_msg_pull_fn)(void *buff, u32 len, u32 type);
681
682/**
683 * enum ipa_voltage_level - IPA Voltage levels
684 */
685enum ipa_voltage_level {
686 IPA_VOLTAGE_UNSPECIFIED,
Skylar Chang448d8b82017-08-08 17:30:32 -0700687 IPA_VOLTAGE_SVS2 = IPA_VOLTAGE_UNSPECIFIED,
688 IPA_VOLTAGE_SVS,
Amir Levy9659e592016-10-27 18:08:27 +0300689 IPA_VOLTAGE_NOMINAL,
690 IPA_VOLTAGE_TURBO,
691 IPA_VOLTAGE_MAX,
692};
693
694/**
695 * enum ipa_rm_event - IPA RM events
696 *
697 * Indicate the resource state change
698 */
699enum ipa_rm_event {
700 IPA_RM_RESOURCE_GRANTED,
701 IPA_RM_RESOURCE_RELEASED
702};
703
704typedef void (*ipa_rm_notify_cb)(void *user_data,
705 enum ipa_rm_event event,
706 unsigned long data);
707/**
708 * struct ipa_rm_register_params - information needed to
709 * register IPA RM client with IPA RM
710 *
711 * @user_data: IPA RM client provided information
712 * to be passed to notify_cb callback below
713 * @notify_cb: callback which is called by resource
714 * to notify the IPA RM client about its state
715 * change IPA RM client is expected to perform non
716 * blocking operations only in notify_cb and
717 * release notification context as soon as
718 * possible.
719 */
720struct ipa_rm_register_params {
721 void *user_data;
722 ipa_rm_notify_cb notify_cb;
723};
724
725/**
726 * struct ipa_rm_create_params - information needed to initialize
727 * the resource
728 * @name: resource name
729 * @floor_voltage: floor voltage needed for client to operate in maximum
730 * bandwidth.
731 * @reg_params: register parameters, contains are ignored
732 * for consumer resource NULL should be provided
733 * for consumer resource
734 * @request_resource: function which should be called to request resource,
735 * NULL should be provided for producer resource
736 * @release_resource: function which should be called to release resource,
737 * NULL should be provided for producer resource
738 *
739 * IPA RM client is expected to perform non blocking operations only
740 * in request_resource and release_resource functions and
741 * release notification context as soon as possible.
742 */
743struct ipa_rm_create_params {
744 enum ipa_rm_resource_name name;
745 enum ipa_voltage_level floor_voltage;
746 struct ipa_rm_register_params reg_params;
747 int (*request_resource)(void);
748 int (*release_resource)(void);
749};
750
751/**
752 * struct ipa_rm_perf_profile - information regarding IPA RM client performance
753 * profile
754 *
755 * @max_bandwidth_mbps: maximum bandwidth need of the client in Mbps
756 */
757struct ipa_rm_perf_profile {
758 u32 max_supported_bandwidth_mbps;
759};
760
761#define A2_MUX_HDR_NAME_V4_PREF "dmux_hdr_v4_"
762#define A2_MUX_HDR_NAME_V6_PREF "dmux_hdr_v6_"
763
764/**
765 * enum teth_tethering_mode - Tethering mode (Rmnet / MBIM)
766 */
767enum teth_tethering_mode {
768 TETH_TETHERING_MODE_RMNET,
769 TETH_TETHERING_MODE_MBIM,
770 TETH_TETHERING_MODE_MAX,
771};
772
773/**
774 * teth_bridge_init_params - Parameters used for in/out USB API
775 * @usb_notify_cb: Callback function which should be used by the caller.
776 * Output parameter.
777 * @private_data: Data for the callback function. Should be used by the
778 * caller. Output parameter.
779 * @skip_ep_cfg: boolean field that determines if Apps-processor
780 * should or should not confiugre this end-point.
781 */
782struct teth_bridge_init_params {
783 ipa_notify_cb usb_notify_cb;
784 void *private_data;
785 enum ipa_client_type client;
786 bool skip_ep_cfg;
787};
788
789/**
790 * struct teth_bridge_connect_params - Parameters used in teth_bridge_connect()
791 * @ipa_usb_pipe_hdl: IPA to USB pipe handle, returned from ipa_connect()
792 * @usb_ipa_pipe_hdl: USB to IPA pipe handle, returned from ipa_connect()
793 * @tethering_mode: Rmnet or MBIM
794 * @ipa_client_type: IPA "client" name (IPA_CLIENT_USB#_PROD)
795 */
796struct teth_bridge_connect_params {
797 u32 ipa_usb_pipe_hdl;
798 u32 usb_ipa_pipe_hdl;
799 enum teth_tethering_mode tethering_mode;
800 enum ipa_client_type client_type;
801};
802
803/**
804 * struct ipa_tx_data_desc - information needed
805 * to send data packet to HW link: link to data descriptors
806 * priv: client specific private data
807 * @pyld_buffer: pointer to the data buffer that holds frame
808 * @pyld_len: length of the data packet
809 */
810struct ipa_tx_data_desc {
811 struct list_head link;
812 void *priv;
813 void *pyld_buffer;
814 u16 pyld_len;
815};
816
817/**
818 * struct ipa_rx_data - information needed
819 * to send to wlan driver on receiving data from ipa hw
820 * @skb: skb
821 * @dma_addr: DMA address of this Rx packet
822 */
823struct ipa_rx_data {
824 struct sk_buff *skb;
825 dma_addr_t dma_addr;
826};
827
828/**
829 * enum ipa_irq_type - IPA Interrupt Type
830 * Used to register handlers for IPA interrupts
831 *
832 * Below enum is a logical mapping and not the actual interrupt bit in HW
833 */
834enum ipa_irq_type {
835 IPA_BAD_SNOC_ACCESS_IRQ,
836 IPA_EOT_COAL_IRQ,
837 IPA_UC_IRQ_0,
838 IPA_UC_IRQ_1,
839 IPA_UC_IRQ_2,
840 IPA_UC_IRQ_3,
841 IPA_UC_IN_Q_NOT_EMPTY_IRQ,
842 IPA_UC_RX_CMD_Q_NOT_FULL_IRQ,
843 IPA_UC_TX_CMD_Q_NOT_FULL_IRQ,
844 IPA_UC_TO_PROC_ACK_Q_NOT_FULL_IRQ,
845 IPA_PROC_TO_UC_ACK_Q_NOT_EMPTY_IRQ,
846 IPA_RX_ERR_IRQ,
847 IPA_DEAGGR_ERR_IRQ,
848 IPA_TX_ERR_IRQ,
849 IPA_STEP_MODE_IRQ,
850 IPA_PROC_ERR_IRQ,
851 IPA_TX_SUSPEND_IRQ,
852 IPA_TX_HOLB_DROP_IRQ,
853 IPA_BAM_IDLE_IRQ,
Amir Levya59ed3f2017-03-05 17:30:55 +0200854 IPA_GSI_IDLE_IRQ = IPA_BAM_IDLE_IRQ,
Amir Levy9659e592016-10-27 18:08:27 +0300855 IPA_IRQ_MAX
856};
857
858/**
859 * struct ipa_tx_suspend_irq_data - interrupt data for IPA_TX_SUSPEND_IRQ
860 * @endpoints: bitmask of endpoints which case IPA_TX_SUSPEND_IRQ interrupt
861 * @dma_addr: DMA address of this Rx packet
862 */
863struct ipa_tx_suspend_irq_data {
864 u32 endpoints;
865};
866
867
868/**
869 * typedef ipa_irq_handler_t - irq handler/callback type
870 * @param ipa_irq_type - [in] interrupt type
871 * @param private_data - [in, out] the client private data
872 * @param interrupt_data - [out] interrupt information data
873 *
874 * callback registered by ipa_add_interrupt_handler function to
875 * handle a specific interrupt type
876 *
877 * No return value
878 */
879typedef void (*ipa_irq_handler_t)(enum ipa_irq_type interrupt,
880 void *private_data,
881 void *interrupt_data);
882
883/**
884 * struct IpaHwBamStats_t - Strucuture holding the BAM statistics
885 *
886 * @bamFifoFull : Number of times Bam Fifo got full - For In Ch: Good,
887 * For Out Ch: Bad
888 * @bamFifoEmpty : Number of times Bam Fifo got empty - For In Ch: Bad,
889 * For Out Ch: Good
890 * @bamFifoUsageHigh : Number of times Bam fifo usage went above 75% -
891 * For In Ch: Good, For Out Ch: Bad
892 * @bamFifoUsageLow : Number of times Bam fifo usage went below 25% -
893 * For In Ch: Bad, For Out Ch: Good
894*/
895struct IpaHwBamStats_t {
896 u32 bamFifoFull;
897 u32 bamFifoEmpty;
898 u32 bamFifoUsageHigh;
899 u32 bamFifoUsageLow;
900 u32 bamUtilCount;
901} __packed;
902
903/**
904 * struct IpaHwRingStats_t - Strucuture holding the Ring statistics
905 *
906 * @ringFull : Number of times Transfer Ring got full - For In Ch: Good,
907 * For Out Ch: Bad
908 * @ringEmpty : Number of times Transfer Ring got empty - For In Ch: Bad,
909 * For Out Ch: Good
910 * @ringUsageHigh : Number of times Transfer Ring usage went above 75% -
911 * For In Ch: Good, For Out Ch: Bad
912 * @ringUsageLow : Number of times Transfer Ring usage went below 25% -
913 * For In Ch: Bad, For Out Ch: Good
914*/
915struct IpaHwRingStats_t {
916 u32 ringFull;
917 u32 ringEmpty;
918 u32 ringUsageHigh;
919 u32 ringUsageLow;
920 u32 RingUtilCount;
921} __packed;
922
923/**
924 * struct IpaHwStatsWDIRxInfoData_t - Structure holding the WDI Rx channel
925 * structures
926 *
927 * @max_outstanding_pkts : Number of outstanding packets in Rx Ring
928 * @num_pkts_processed : Number of packets processed - cumulative
929 * @rx_ring_rp_value : Read pointer last advertized to the WLAN FW
930 * @rx_ind_ring_stats : Ring info
931 * @bam_stats : BAM info
932 * @num_bam_int_handled : Number of Bam Interrupts handled by FW
933 * @num_db : Number of times the doorbell was rung
934 * @num_unexpected_db : Number of unexpected doorbells
935 * @num_pkts_in_dis_uninit_state : number of completions we
936 * received in disabled or uninitialized state
937 * @num_ic_inj_vdev_change : Number of times the Imm Cmd is
938 * injected due to vdev_id change
939 * @num_ic_inj_fw_desc_change : Number of times the Imm Cmd is
940 * injected due to fw_desc change
Utkarsh Saxena971a03c2017-01-22 22:04:13 +0530941 * @num_qmb_int_handled : Number of QMB interrupts handled
Amir Levy9659e592016-10-27 18:08:27 +0300942*/
943struct IpaHwStatsWDIRxInfoData_t {
944 u32 max_outstanding_pkts;
945 u32 num_pkts_processed;
946 u32 rx_ring_rp_value;
947 struct IpaHwRingStats_t rx_ind_ring_stats;
948 struct IpaHwBamStats_t bam_stats;
949 u32 num_bam_int_handled;
950 u32 num_db;
951 u32 num_unexpected_db;
952 u32 num_pkts_in_dis_uninit_state;
953 u32 num_ic_inj_vdev_change;
954 u32 num_ic_inj_fw_desc_change;
Utkarsh Saxena971a03c2017-01-22 22:04:13 +0530955 u32 num_qmb_int_handled;
Amir Levy9659e592016-10-27 18:08:27 +0300956 u32 reserved1;
957 u32 reserved2;
958} __packed;
959
960/**
961 * struct IpaHwStatsWDITxInfoData_t - Structure holding the WDI Tx channel
962 * structures
963 *
964 * @num_pkts_processed : Number of packets processed - cumulative
965 * @copy_engine_doorbell_value : latest value of doorbell written to copy engine
966 * @num_db_fired : Number of DB from uC FW to Copy engine
967 * @tx_comp_ring_stats : ring info
968 * @bam_stats : BAM info
969 * @num_db : Number of times the doorbell was rung
970 * @num_unexpected_db : Number of unexpected doorbells
971 * @num_bam_int_handled : Number of Bam Interrupts handled by FW
972 * @num_bam_int_in_non_running_state : Number of Bam interrupts while not in
973 * Running state
974 * @num_qmb_int_handled : Number of QMB interrupts handled
975*/
976struct IpaHwStatsWDITxInfoData_t {
977 u32 num_pkts_processed;
978 u32 copy_engine_doorbell_value;
979 u32 num_db_fired;
980 struct IpaHwRingStats_t tx_comp_ring_stats;
981 struct IpaHwBamStats_t bam_stats;
982 u32 num_db;
983 u32 num_unexpected_db;
984 u32 num_bam_int_handled;
985 u32 num_bam_int_in_non_running_state;
986 u32 num_qmb_int_handled;
987 u32 num_bam_int_handled_while_wait_for_bam;
988} __packed;
989
990/**
991 * struct IpaHwStatsWDIInfoData_t - Structure holding the WDI channel structures
992 *
993 * @rx_ch_stats : RX stats
994 * @tx_ch_stats : TX stats
995*/
996struct IpaHwStatsWDIInfoData_t {
997 struct IpaHwStatsWDIRxInfoData_t rx_ch_stats;
998 struct IpaHwStatsWDITxInfoData_t tx_ch_stats;
999} __packed;
1000
1001
1002/**
1003 * struct ipa_wdi_ul_params - WDI_RX configuration
1004 * @rdy_ring_base_pa: physical address of the base of the Rx ring (containing
1005 * Rx buffers)
1006 * @rdy_ring_size: size of the Rx ring in bytes
1007 * @rdy_ring_rp_pa: physical address of the location through which IPA uc is
1008 * reading (WDI-1.0)
1009 * @rdy_comp_ring_base_pa: physical address of the base of the Rx completion
1010 * ring (WDI-2.0)
1011 * @rdy_comp_ring_wp_pa: physical address of the location through which IPA
1012 * uc is writing (WDI-2.0)
1013 * @rdy_comp_ring_size: size of the Rx_completion ring in bytes
1014 * expected to communicate about the Read pointer into the Rx Ring
1015 */
1016struct ipa_wdi_ul_params {
1017 phys_addr_t rdy_ring_base_pa;
1018 u32 rdy_ring_size;
1019 phys_addr_t rdy_ring_rp_pa;
1020 phys_addr_t rdy_comp_ring_base_pa;
1021 phys_addr_t rdy_comp_ring_wp_pa;
1022 u32 rdy_comp_ring_size;
1023 u32 *rdy_ring_rp_va;
1024 u32 *rdy_comp_ring_wp_va;
1025};
1026
1027/**
1028 * struct ipa_wdi_ul_params_smmu - WDI_RX configuration (with WLAN SMMU)
1029 * @rdy_ring: SG table describing the Rx ring (containing Rx buffers)
1030 * @rdy_ring_size: size of the Rx ring in bytes
1031 * @rdy_ring_rp_pa: physical address of the location through which IPA uc is
1032 * expected to communicate about the Read pointer into the Rx Ring
1033 */
1034struct ipa_wdi_ul_params_smmu {
1035 struct sg_table rdy_ring;
1036 u32 rdy_ring_size;
1037 phys_addr_t rdy_ring_rp_pa;
1038 struct sg_table rdy_comp_ring;
1039 phys_addr_t rdy_comp_ring_wp_pa;
1040 u32 rdy_comp_ring_size;
1041 u32 *rdy_ring_rp_va;
1042 u32 *rdy_comp_ring_wp_va;
1043};
1044
1045/**
1046 * struct ipa_wdi_dl_params - WDI_TX configuration
1047 * @comp_ring_base_pa: physical address of the base of the Tx completion ring
1048 * @comp_ring_size: size of the Tx completion ring in bytes
1049 * @ce_ring_base_pa: physical address of the base of the Copy Engine Source
1050 * Ring
1051 * @ce_door_bell_pa: physical address of the doorbell that the IPA uC has to
1052 * write into to trigger the copy engine
1053 * @ce_ring_size: Copy Engine Ring size in bytes
1054 * @num_tx_buffers: Number of pkt buffers allocated
1055 */
1056struct ipa_wdi_dl_params {
1057 phys_addr_t comp_ring_base_pa;
1058 u32 comp_ring_size;
1059 phys_addr_t ce_ring_base_pa;
1060 phys_addr_t ce_door_bell_pa;
1061 u32 ce_ring_size;
1062 u32 num_tx_buffers;
1063};
1064
1065/**
1066 * struct ipa_wdi_dl_params_smmu - WDI_TX configuration (with WLAN SMMU)
1067 * @comp_ring: SG table describing the Tx completion ring
1068 * @comp_ring_size: size of the Tx completion ring in bytes
1069 * @ce_ring: SG table describing the Copy Engine Source Ring
1070 * @ce_door_bell_pa: physical address of the doorbell that the IPA uC has to
1071 * write into to trigger the copy engine
1072 * @ce_ring_size: Copy Engine Ring size in bytes
1073 * @num_tx_buffers: Number of pkt buffers allocated
1074 */
1075struct ipa_wdi_dl_params_smmu {
1076 struct sg_table comp_ring;
1077 u32 comp_ring_size;
1078 struct sg_table ce_ring;
1079 phys_addr_t ce_door_bell_pa;
1080 u32 ce_ring_size;
1081 u32 num_tx_buffers;
1082};
1083
1084/**
1085 * struct ipa_wdi_in_params - information provided by WDI client
1086 * @sys: IPA EP configuration info
1087 * @ul: WDI_RX configuration info
1088 * @dl: WDI_TX configuration info
1089 * @ul_smmu: WDI_RX configuration info when WLAN uses SMMU
1090 * @dl_smmu: WDI_TX configuration info when WLAN uses SMMU
1091 * @smmu_enabled: true if WLAN uses SMMU
Skylar Changfcf36c22016-10-04 14:15:25 -07001092 * @ipa_wdi_meter_notifier_cb: Get WDI stats and quato info
Amir Levy9659e592016-10-27 18:08:27 +03001093 */
1094struct ipa_wdi_in_params {
1095 struct ipa_sys_connect_params sys;
1096 union {
1097 struct ipa_wdi_ul_params ul;
1098 struct ipa_wdi_dl_params dl;
1099 struct ipa_wdi_ul_params_smmu ul_smmu;
1100 struct ipa_wdi_dl_params_smmu dl_smmu;
1101 } u;
1102 bool smmu_enabled;
Skylar Changfcf36c22016-10-04 14:15:25 -07001103#ifdef IPA_WAN_MSG_IPv6_ADDR_GW_LEN
1104 ipa_wdi_meter_notifier_cb wdi_notify;
1105#endif
Amir Levy9659e592016-10-27 18:08:27 +03001106};
1107
Skylar Chang6b41f8d2016-11-01 12:50:11 -07001108enum ipa_upstream_type {
1109 IPA_UPSTEAM_MODEM = 1,
1110 IPA_UPSTEAM_WLAN,
1111 IPA_UPSTEAM_MAX
1112};
1113
Amir Levy9659e592016-10-27 18:08:27 +03001114/**
1115 * struct ipa_wdi_out_params - information provided to WDI client
1116 * @uc_door_bell_pa: physical address of IPA uc doorbell
1117 * @clnt_hdl: opaque handle assigned to client
1118 */
1119struct ipa_wdi_out_params {
1120 phys_addr_t uc_door_bell_pa;
1121 u32 clnt_hdl;
1122};
1123
1124/**
1125 * struct ipa_wdi_db_params - information provided to retrieve
1126 * physical address of uC doorbell
1127 * @client: type of "client" (IPA_CLIENT_WLAN#_PROD/CONS)
1128 * @uc_door_bell_pa: physical address of IPA uc doorbell
1129 */
1130struct ipa_wdi_db_params {
1131 enum ipa_client_type client;
1132 phys_addr_t uc_door_bell_pa;
1133};
1134
1135/**
1136 * struct ipa_wdi_uc_ready_params - uC ready CB parameters
1137 * @is_uC_ready: uC loaded or not
1138 * @priv : callback cookie
1139 * @notify: callback
1140 */
1141typedef void (*ipa_uc_ready_cb)(void *priv);
1142struct ipa_wdi_uc_ready_params {
1143 bool is_uC_ready;
1144 void *priv;
1145 ipa_uc_ready_cb notify;
1146};
1147
1148/**
1149 * struct ipa_wdi_buffer_info - address info of a WLAN allocated buffer
1150 * @pa: physical address of the buffer
1151 * @iova: IOVA of the buffer as embedded inside the WDI descriptors
1152 * @size: size in bytes of the buffer
1153 * @result: result of map or unmap operations (out param)
1154 *
1155 * IPA driver will create/release IOMMU mapping in IPA SMMU from iova->pa
1156 */
1157struct ipa_wdi_buffer_info {
1158 phys_addr_t pa;
1159 unsigned long iova;
1160 size_t size;
1161 int result;
1162};
1163
1164/**
1165 * struct ipa_gsi_ep_config - IPA GSI endpoint configurations
1166 *
1167 * @ipa_ep_num: IPA EP pipe number
1168 * @ipa_gsi_chan_num: GSI channel number
1169 * @ipa_if_tlv: number of IPA_IF TLV
1170 * @ipa_if_aos: number of IPA_IF AOS
1171 * @ee: Execution environment
1172 */
1173struct ipa_gsi_ep_config {
1174 int ipa_ep_num;
1175 int ipa_gsi_chan_num;
1176 int ipa_if_tlv;
1177 int ipa_if_aos;
1178 int ee;
1179};
1180
Skylar Chang48afa052017-10-25 09:32:57 -07001181/**
1182 * struct ipa_tz_unlock_reg_info - Used in order unlock regions of memory by TZ
1183 * @reg_addr - Physical address of the start of the region
1184 * @size - Size of the region in bytes
1185 */
1186struct ipa_tz_unlock_reg_info {
1187 u64 reg_addr;
1188 u64 size;
1189};
1190
Michael Adisumartad04e6d62017-11-09 17:46:35 -08001191/**
1192 * struct ipa_smmu_in_params - information provided from client
1193 * @ipa_smmu_client_type: clinet requesting for the smmu info.
1194 */
1195
1196enum ipa_smmu_client_type {
1197 IPA_SMMU_WLAN_CLIENT,
1198 IPA_SMMU_CLIENT_MAX
1199};
1200
1201struct ipa_smmu_in_params {
1202 enum ipa_smmu_client_type smmu_client;
1203};
1204
1205/**
1206 * struct ipa_smmu_out_params - information provided to IPA client
1207 * @ipa_smmu_s1_enable: IPA S1 SMMU enable/disable status
1208 */
1209struct ipa_smmu_out_params {
1210 bool smmu_enable;
1211};
1212
Amir Levy9659e592016-10-27 18:08:27 +03001213#if defined CONFIG_IPA || defined CONFIG_IPA3
1214
1215/*
1216 * Connect / Disconnect
1217 */
1218int ipa_connect(const struct ipa_connect_params *in, struct ipa_sps_params *sps,
1219 u32 *clnt_hdl);
1220int ipa_disconnect(u32 clnt_hdl);
1221
1222/*
1223 * Resume / Suspend
1224 */
1225int ipa_reset_endpoint(u32 clnt_hdl);
1226
1227/*
1228 * Remove ep delay
1229 */
1230int ipa_clear_endpoint_delay(u32 clnt_hdl);
1231
1232/*
1233 * Disable ep
1234 */
1235int ipa_disable_endpoint(u32 clnt_hdl);
1236
1237/*
1238 * Configuration
1239 */
1240int ipa_cfg_ep(u32 clnt_hdl, const struct ipa_ep_cfg *ipa_ep_cfg);
1241
1242int ipa_cfg_ep_nat(u32 clnt_hdl, const struct ipa_ep_cfg_nat *ipa_ep_cfg);
1243
Amir Levydc65f4c2017-07-06 09:49:50 +03001244int ipa_cfg_ep_conn_track(u32 clnt_hdl,
1245 const struct ipa_ep_cfg_conn_track *ep_conn_track);
1246
Amir Levy9659e592016-10-27 18:08:27 +03001247int ipa_cfg_ep_hdr(u32 clnt_hdl, const struct ipa_ep_cfg_hdr *ipa_ep_cfg);
1248
1249int ipa_cfg_ep_hdr_ext(u32 clnt_hdl,
1250 const struct ipa_ep_cfg_hdr_ext *ipa_ep_cfg);
1251
1252int ipa_cfg_ep_mode(u32 clnt_hdl, const struct ipa_ep_cfg_mode *ipa_ep_cfg);
1253
1254int ipa_cfg_ep_aggr(u32 clnt_hdl, const struct ipa_ep_cfg_aggr *ipa_ep_cfg);
1255
1256int ipa_cfg_ep_deaggr(u32 clnt_hdl,
1257 const struct ipa_ep_cfg_deaggr *ipa_ep_cfg);
1258
1259int ipa_cfg_ep_route(u32 clnt_hdl, const struct ipa_ep_cfg_route *ipa_ep_cfg);
1260
1261int ipa_cfg_ep_holb(u32 clnt_hdl, const struct ipa_ep_cfg_holb *ipa_ep_cfg);
1262
1263int ipa_cfg_ep_cfg(u32 clnt_hdl, const struct ipa_ep_cfg_cfg *ipa_ep_cfg);
1264
1265int ipa_cfg_ep_metadata_mask(u32 clnt_hdl, const struct ipa_ep_cfg_metadata_mask
1266 *ipa_ep_cfg);
1267
1268int ipa_cfg_ep_holb_by_client(enum ipa_client_type client,
1269 const struct ipa_ep_cfg_holb *ipa_ep_cfg);
1270
1271int ipa_cfg_ep_ctrl(u32 clnt_hdl, const struct ipa_ep_cfg_ctrl *ep_ctrl);
1272
1273/*
1274 * Header removal / addition
1275 */
1276int ipa_add_hdr(struct ipa_ioc_add_hdr *hdrs);
1277
1278int ipa_del_hdr(struct ipa_ioc_del_hdr *hdls);
1279
1280int ipa_commit_hdr(void);
1281
1282int ipa_reset_hdr(void);
1283
1284int ipa_get_hdr(struct ipa_ioc_get_hdr *lookup);
1285
1286int ipa_put_hdr(u32 hdr_hdl);
1287
1288int ipa_copy_hdr(struct ipa_ioc_copy_hdr *copy);
1289
1290/*
1291 * Header Processing Context
1292 */
1293int ipa_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs);
1294
1295int ipa_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls);
1296
1297/*
1298 * Routing
1299 */
1300int ipa_add_rt_rule(struct ipa_ioc_add_rt_rule *rules);
1301
1302int ipa_del_rt_rule(struct ipa_ioc_del_rt_rule *hdls);
1303
1304int ipa_commit_rt(enum ipa_ip_type ip);
1305
1306int ipa_reset_rt(enum ipa_ip_type ip);
1307
1308int ipa_get_rt_tbl(struct ipa_ioc_get_rt_tbl *lookup);
1309
1310int ipa_put_rt_tbl(u32 rt_tbl_hdl);
1311
1312int ipa_query_rt_index(struct ipa_ioc_get_rt_tbl_indx *in);
1313
1314int ipa_mdfy_rt_rule(struct ipa_ioc_mdfy_rt_rule *rules);
1315
1316/*
1317 * Filtering
1318 */
1319int ipa_add_flt_rule(struct ipa_ioc_add_flt_rule *rules);
1320
1321int ipa_del_flt_rule(struct ipa_ioc_del_flt_rule *hdls);
1322
1323int ipa_mdfy_flt_rule(struct ipa_ioc_mdfy_flt_rule *rules);
1324
1325int ipa_commit_flt(enum ipa_ip_type ip);
1326
1327int ipa_reset_flt(enum ipa_ip_type ip);
1328
1329/*
Amir Levy479cfdd2017-10-26 12:23:14 +03001330 * NAT\IPv6CT
Amir Levy9659e592016-10-27 18:08:27 +03001331 */
Amir Levy479cfdd2017-10-26 12:23:14 +03001332int ipa_allocate_nat_device(struct ipa_ioc_nat_alloc_mem *mem);
1333int ipa_allocate_nat_table(struct ipa_ioc_nat_ipv6ct_table_alloc *table_alloc);
1334int ipa_allocate_ipv6ct_table(
1335 struct ipa_ioc_nat_ipv6ct_table_alloc *table_alloc);
Amir Levy9659e592016-10-27 18:08:27 +03001336
1337int ipa_nat_init_cmd(struct ipa_ioc_v4_nat_init *init);
Amir Levy479cfdd2017-10-26 12:23:14 +03001338int ipa_ipv6ct_init_cmd(struct ipa_ioc_ipv6ct_init *init);
Amir Levy9659e592016-10-27 18:08:27 +03001339
1340int ipa_nat_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma);
Amir Levy479cfdd2017-10-26 12:23:14 +03001341int ipa_table_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma);
Amir Levy9659e592016-10-27 18:08:27 +03001342
1343int ipa_nat_del_cmd(struct ipa_ioc_v4_nat_del *del);
Amir Levy479cfdd2017-10-26 12:23:14 +03001344int ipa_del_nat_table(struct ipa_ioc_nat_ipv6ct_table_del *del);
1345int ipa_del_ipv6ct_table(struct ipa_ioc_nat_ipv6ct_table_del *del);
1346
1347int ipa_nat_mdfy_pdn(struct ipa_ioc_nat_pdn_entry *mdfy_pdn);
Amir Levy9659e592016-10-27 18:08:27 +03001348
1349/*
1350 * Messaging
1351 */
1352int ipa_send_msg(struct ipa_msg_meta *meta, void *buff,
1353 ipa_msg_free_fn callback);
1354int ipa_register_pull_msg(struct ipa_msg_meta *meta, ipa_msg_pull_fn callback);
1355int ipa_deregister_pull_msg(struct ipa_msg_meta *meta);
1356
1357/*
1358 * Interface
1359 */
1360int ipa_register_intf(const char *name, const struct ipa_tx_intf *tx,
1361 const struct ipa_rx_intf *rx);
1362int ipa_register_intf_ext(const char *name, const struct ipa_tx_intf *tx,
1363 const struct ipa_rx_intf *rx,
1364 const struct ipa_ext_intf *ext);
1365int ipa_deregister_intf(const char *name);
1366
1367/*
1368 * Aggregation
1369 */
1370int ipa_set_aggr_mode(enum ipa_aggr_mode mode);
1371
1372int ipa_set_qcncm_ndp_sig(char sig[3]);
1373
1374int ipa_set_single_ndp_per_mbim(bool enable);
1375
1376/*
1377 * Data path
1378 */
1379int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
1380 struct ipa_tx_meta *metadata);
1381
1382/*
1383 * To transfer multiple data packets
1384 * While passing the data descriptor list, the anchor node
1385 * should be of type struct ipa_tx_data_desc not list_head
1386*/
1387int ipa_tx_dp_mul(enum ipa_client_type dst,
1388 struct ipa_tx_data_desc *data_desc);
1389
1390void ipa_free_skb(struct ipa_rx_data *);
1391int ipa_rx_poll(u32 clnt_hdl, int budget);
1392void ipa_recycle_wan_skb(struct sk_buff *skb);
1393
1394/*
1395 * System pipes
1396 */
1397int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl);
1398
1399int ipa_teardown_sys_pipe(u32 clnt_hdl);
1400
1401int ipa_connect_wdi_pipe(struct ipa_wdi_in_params *in,
1402 struct ipa_wdi_out_params *out);
1403int ipa_disconnect_wdi_pipe(u32 clnt_hdl);
1404int ipa_enable_wdi_pipe(u32 clnt_hdl);
1405int ipa_disable_wdi_pipe(u32 clnt_hdl);
1406int ipa_resume_wdi_pipe(u32 clnt_hdl);
1407int ipa_suspend_wdi_pipe(u32 clnt_hdl);
1408int ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats);
1409u16 ipa_get_smem_restr_bytes(void);
Skylar Changfcf36c22016-10-04 14:15:25 -07001410int ipa_broadcast_wdi_quota_reach_ind(uint32_t fid,
1411 uint64_t num_bytes);
1412
Amir Levy9659e592016-10-27 18:08:27 +03001413/*
1414 * To retrieve doorbell physical address of
1415 * wlan pipes
1416 */
1417int ipa_uc_wdi_get_dbpa(struct ipa_wdi_db_params *out);
1418
1419/*
1420 * To register uC ready callback if uC not ready
1421 * and also check uC readiness
1422 * if uC not ready only, register callback
1423 */
1424int ipa_uc_reg_rdyCB(struct ipa_wdi_uc_ready_params *param);
1425/*
1426 * To de-register uC ready callback
1427 */
1428int ipa_uc_dereg_rdyCB(void);
1429
1430int ipa_create_wdi_mapping(u32 num_buffers, struct ipa_wdi_buffer_info *info);
1431int ipa_release_wdi_mapping(u32 num_buffers, struct ipa_wdi_buffer_info *info);
1432
1433/*
1434 * Resource manager
1435 */
1436int ipa_rm_create_resource(struct ipa_rm_create_params *create_params);
1437
1438int ipa_rm_delete_resource(enum ipa_rm_resource_name resource_name);
1439
1440int ipa_rm_register(enum ipa_rm_resource_name resource_name,
1441 struct ipa_rm_register_params *reg_params);
1442
1443int ipa_rm_deregister(enum ipa_rm_resource_name resource_name,
1444 struct ipa_rm_register_params *reg_params);
1445
1446int ipa_rm_set_perf_profile(enum ipa_rm_resource_name resource_name,
1447 struct ipa_rm_perf_profile *profile);
1448
1449int ipa_rm_add_dependency(enum ipa_rm_resource_name resource_name,
1450 enum ipa_rm_resource_name depends_on_name);
1451
1452int ipa_rm_add_dependency_sync(enum ipa_rm_resource_name resource_name,
1453 enum ipa_rm_resource_name depends_on_name);
1454
1455int ipa_rm_delete_dependency(enum ipa_rm_resource_name resource_name,
1456 enum ipa_rm_resource_name depends_on_name);
1457
1458int ipa_rm_request_resource(enum ipa_rm_resource_name resource_name);
1459
1460int ipa_rm_release_resource(enum ipa_rm_resource_name resource_name);
1461
1462int ipa_rm_notify_completion(enum ipa_rm_event event,
1463 enum ipa_rm_resource_name resource_name);
1464
1465int ipa_rm_inactivity_timer_init(enum ipa_rm_resource_name resource_name,
1466 unsigned long msecs);
1467
1468int ipa_rm_inactivity_timer_destroy(enum ipa_rm_resource_name resource_name);
1469
1470int ipa_rm_inactivity_timer_request_resource(
1471 enum ipa_rm_resource_name resource_name);
1472
1473int ipa_rm_inactivity_timer_release_resource(
1474 enum ipa_rm_resource_name resource_name);
1475
1476/*
1477 * Tethering bridge (Rmnet / MBIM)
1478 */
1479int teth_bridge_init(struct teth_bridge_init_params *params);
1480
1481int teth_bridge_disconnect(enum ipa_client_type client);
1482
1483int teth_bridge_connect(struct teth_bridge_connect_params *connect_params);
1484
1485/*
1486 * Tethering client info
1487 */
1488void ipa_set_client(int index, enum ipacm_client_enum client, bool uplink);
1489
1490enum ipacm_client_enum ipa_get_client(int pipe_idx);
1491
1492bool ipa_get_client_uplink(int pipe_idx);
1493
1494/*
1495 * IPADMA
1496 */
1497int ipa_dma_init(void);
1498
1499int ipa_dma_enable(void);
1500
1501int ipa_dma_disable(void);
1502
1503int ipa_dma_sync_memcpy(u64 dest, u64 src, int len);
1504
1505int ipa_dma_async_memcpy(u64 dest, u64 src, int len,
1506 void (*user_cb)(void *user1), void *user_param);
1507
1508int ipa_dma_uc_memcpy(phys_addr_t dest, phys_addr_t src, int len);
1509
1510void ipa_dma_destroy(void);
1511
1512/*
1513 * mux id
1514 */
1515int ipa_write_qmap_id(struct ipa_ioc_write_qmapid *param_in);
1516
1517/*
1518 * interrupts
1519 */
1520int ipa_add_interrupt_handler(enum ipa_irq_type interrupt,
1521 ipa_irq_handler_t handler,
1522 bool deferred_flag,
1523 void *private_data);
1524
1525int ipa_remove_interrupt_handler(enum ipa_irq_type interrupt);
1526
1527int ipa_restore_suspend_handler(void);
1528
1529/*
1530 * Miscellaneous
1531 */
1532void ipa_bam_reg_dump(void);
1533
1534int ipa_get_ep_mapping(enum ipa_client_type client);
1535
1536bool ipa_is_ready(void);
1537
1538void ipa_proxy_clk_vote(void);
1539void ipa_proxy_clk_unvote(void);
1540
1541enum ipa_hw_type ipa_get_hw_type(void);
1542
1543bool ipa_is_client_handle_valid(u32 clnt_hdl);
1544
1545enum ipa_client_type ipa_get_client_mapping(int pipe_idx);
1546
1547enum ipa_rm_resource_name ipa_get_rm_resource_from_ep(int pipe_idx);
1548
1549bool ipa_get_modem_cfg_emb_pipe_flt(void);
1550
1551enum ipa_transport_type ipa_get_transport_type(void);
1552
1553struct device *ipa_get_dma_dev(void);
1554struct iommu_domain *ipa_get_smmu_domain(void);
1555
1556int ipa_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count);
1557
Amir Levy3be373c2017-03-05 16:31:30 +02001558const struct ipa_gsi_ep_config *ipa_get_gsi_ep_info
1559 (enum ipa_client_type client);
Amir Levy9659e592016-10-27 18:08:27 +03001560
1561int ipa_stop_gsi_channel(u32 clnt_hdl);
1562
1563typedef void (*ipa_ready_cb)(void *user_data);
1564
1565/**
1566* ipa_register_ipa_ready_cb() - register a callback to be invoked
1567* when IPA core driver initialization is complete.
1568*
1569* @ipa_ready_cb: CB to be triggered.
1570* @user_data: Data to be sent to the originator of the CB.
1571*
1572* Note: This function is expected to be utilized when ipa_is_ready
1573* function returns false.
1574* An IPA client may also use this function directly rather than
1575* calling ipa_is_ready beforehand, as if this API returns -EEXIST,
1576* this means IPA initialization is complete (and no callback will
1577* be triggered).
1578* When the callback is triggered, the client MUST perform his
1579* operations in a different context.
1580*
1581* The function will return 0 on success, -ENOMEM on memory issues and
1582* -EEXIST if IPA initialization is complete already.
1583*/
1584int ipa_register_ipa_ready_cb(void (*ipa_ready_cb)(void *user_data),
1585 void *user_data);
1586
Skylar Chang48afa052017-10-25 09:32:57 -07001587/**
1588 * ipa_tz_unlock_reg - Unlocks memory regions so that they become accessible
1589 * from AP.
1590 * @reg_info - Pointer to array of memory regions to unlock
1591 * @num_regs - Number of elements in the array
1592 *
1593 * Converts the input array of regions to a struct that TZ understands and
1594 * issues an SCM call.
1595 * Also flushes the memory cache to DDR in order to make sure that TZ sees the
1596 * correct data structure.
1597 *
1598 * Returns: 0 on success, negative on failure
1599 */
1600int ipa_tz_unlock_reg(struct ipa_tz_unlock_reg_info *reg_info, u16 num_regs);
Michael Adisumartad04e6d62017-11-09 17:46:35 -08001601int ipa_get_smmu_params(struct ipa_smmu_in_params *in,
1602 struct ipa_smmu_out_params *out);
Amir Levy2da9d452017-12-12 10:09:46 +02001603/**
1604 * ipa_is_vlan_mode - check if a LAN driver should load in VLAN mode
1605 * @iface - type of vlan capable device
1606 * @res - query result: true for vlan mode, false for non vlan mode
1607 *
1608 * API must be called after ipa_is_ready() returns true, otherwise it will fail
1609 *
1610 * Returns: 0 on success, negative on failure
1611 */
1612int ipa_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res);
Amir Levy9659e592016-10-27 18:08:27 +03001613#else /* (CONFIG_IPA || CONFIG_IPA3) */
1614
1615/*
1616 * Connect / Disconnect
1617 */
1618static inline int ipa_connect(const struct ipa_connect_params *in,
1619 struct ipa_sps_params *sps, u32 *clnt_hdl)
1620{
1621 return -EPERM;
1622}
1623
1624static inline int ipa_disconnect(u32 clnt_hdl)
1625{
1626 return -EPERM;
1627}
1628
1629/*
1630 * Resume / Suspend
1631 */
1632static inline int ipa_reset_endpoint(u32 clnt_hdl)
1633{
1634 return -EPERM;
1635}
1636
1637/*
1638 * Remove ep delay
1639 */
1640static inline int ipa_clear_endpoint_delay(u32 clnt_hdl)
1641{
1642 return -EPERM;
1643}
1644
1645/*
1646 * Disable ep
1647 */
1648static inline int ipa_disable_endpoint(u32 clnt_hdl)
1649{
1650 return -EPERM;
1651}
1652
1653/*
1654 * Configuration
1655 */
1656static inline int ipa_cfg_ep(u32 clnt_hdl,
1657 const struct ipa_ep_cfg *ipa_ep_cfg)
1658{
1659 return -EPERM;
1660}
1661
1662static inline int ipa_cfg_ep_nat(u32 clnt_hdl,
1663 const struct ipa_ep_cfg_nat *ipa_ep_cfg)
1664{
1665 return -EPERM;
1666}
1667
Amir Levydc65f4c2017-07-06 09:49:50 +03001668static inline int ipa_cfg_ep_conn_track(u32 clnt_hdl,
1669 const struct ipa_ep_cfg_conn_track *ep_conn_track)
1670{
1671 return -EPERM
1672}
1673
Amir Levy9659e592016-10-27 18:08:27 +03001674static inline int ipa_cfg_ep_hdr(u32 clnt_hdl,
1675 const struct ipa_ep_cfg_hdr *ipa_ep_cfg)
1676{
1677 return -EPERM;
1678}
1679
1680static inline int ipa_cfg_ep_hdr_ext(u32 clnt_hdl,
1681 const struct ipa_ep_cfg_hdr_ext *ipa_ep_cfg)
1682{
1683 return -EPERM;
1684}
1685
1686static inline int ipa_cfg_ep_mode(u32 clnt_hdl,
1687 const struct ipa_ep_cfg_mode *ipa_ep_cfg)
1688{
1689 return -EPERM;
1690}
1691
1692static inline int ipa_cfg_ep_aggr(u32 clnt_hdl,
1693 const struct ipa_ep_cfg_aggr *ipa_ep_cfg)
1694{
1695 return -EPERM;
1696}
1697
1698static inline int ipa_cfg_ep_deaggr(u32 clnt_hdl,
1699 const struct ipa_ep_cfg_deaggr *ipa_ep_cfg)
1700{
1701 return -EPERM;
1702}
1703
1704static inline int ipa_cfg_ep_route(u32 clnt_hdl,
1705 const struct ipa_ep_cfg_route *ipa_ep_cfg)
1706{
1707 return -EPERM;
1708}
1709
1710static inline int ipa_cfg_ep_holb(u32 clnt_hdl,
1711 const struct ipa_ep_cfg_holb *ipa_ep_cfg)
1712{
1713 return -EPERM;
1714}
1715
1716static inline int ipa_cfg_ep_cfg(u32 clnt_hdl,
1717 const struct ipa_ep_cfg_cfg *ipa_ep_cfg)
1718{
1719 return -EPERM;
1720}
1721
1722static inline int ipa_cfg_ep_metadata_mask(u32 clnt_hdl,
1723 const struct ipa_ep_cfg_metadata_mask *ipa_ep_cfg)
1724{
1725 return -EPERM;
1726}
1727
1728static inline int ipa_cfg_ep_ctrl(u32 clnt_hdl,
1729 const struct ipa_ep_cfg_ctrl *ep_ctrl)
1730{
1731 return -EPERM;
1732}
1733
1734/*
1735 * Header removal / addition
1736 */
1737static inline int ipa_add_hdr(struct ipa_ioc_add_hdr *hdrs)
1738{
1739 return -EPERM;
1740}
1741
1742static inline int ipa_del_hdr(struct ipa_ioc_del_hdr *hdls)
1743{
1744 return -EPERM;
1745}
1746
1747static inline int ipa_commit_hdr(void)
1748{
1749 return -EPERM;
1750}
1751
1752static inline int ipa_reset_hdr(void)
1753{
1754 return -EPERM;
1755}
1756
1757static inline int ipa_get_hdr(struct ipa_ioc_get_hdr *lookup)
1758{
1759 return -EPERM;
1760}
1761
1762static inline int ipa_put_hdr(u32 hdr_hdl)
1763{
1764 return -EPERM;
1765}
1766
1767static inline int ipa_copy_hdr(struct ipa_ioc_copy_hdr *copy)
1768{
1769 return -EPERM;
1770}
1771
1772/*
1773 * Header Processing Context
1774 */
1775static inline int ipa_add_hdr_proc_ctx(
1776 struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs)
1777{
1778 return -EPERM;
1779}
1780
1781static inline int ipa_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls)
1782{
1783 return -EPERM;
1784}
1785/*
1786 * Routing
1787 */
1788static inline int ipa_add_rt_rule(struct ipa_ioc_add_rt_rule *rules)
1789{
1790 return -EPERM;
1791}
1792
1793static inline int ipa_del_rt_rule(struct ipa_ioc_del_rt_rule *hdls)
1794{
1795 return -EPERM;
1796}
1797
1798static inline int ipa_commit_rt(enum ipa_ip_type ip)
1799{
1800 return -EPERM;
1801}
1802
1803static inline int ipa_reset_rt(enum ipa_ip_type ip)
1804{
1805 return -EPERM;
1806}
1807
1808static inline int ipa_get_rt_tbl(struct ipa_ioc_get_rt_tbl *lookup)
1809{
1810 return -EPERM;
1811}
1812
1813static inline int ipa_put_rt_tbl(u32 rt_tbl_hdl)
1814{
1815 return -EPERM;
1816}
1817
1818static inline int ipa_query_rt_index(struct ipa_ioc_get_rt_tbl_indx *in)
1819{
1820 return -EPERM;
1821}
1822
1823static inline int ipa_mdfy_rt_rule(struct ipa_ioc_mdfy_rt_rule *rules)
1824{
1825 return -EPERM;
1826}
1827
1828/*
1829 * Filtering
1830 */
1831static inline int ipa_add_flt_rule(struct ipa_ioc_add_flt_rule *rules)
1832{
1833 return -EPERM;
1834}
1835
1836static inline int ipa_del_flt_rule(struct ipa_ioc_del_flt_rule *hdls)
1837{
1838 return -EPERM;
1839}
1840
1841static inline int ipa_mdfy_flt_rule(struct ipa_ioc_mdfy_flt_rule *rules)
1842{
1843 return -EPERM;
1844}
1845
1846static inline int ipa_commit_flt(enum ipa_ip_type ip)
1847{
1848 return -EPERM;
1849}
1850
1851static inline int ipa_reset_flt(enum ipa_ip_type ip)
1852{
1853 return -EPERM;
1854}
1855
1856/*
1857 * NAT
1858 */
Amir Levy479cfdd2017-10-26 12:23:14 +03001859static inline int ipa_allocate_nat_device(struct ipa_ioc_nat_alloc_mem *mem)
Amir Levy9659e592016-10-27 18:08:27 +03001860{
1861 return -EPERM;
1862}
1863
Amir Levy479cfdd2017-10-26 12:23:14 +03001864static inline int ipa_allocate_nat_table(
1865 struct ipa_ioc_nat_ipv6ct_table_alloc *table_alloc)
1866{
1867 return -EPERM;
1868}
1869
1870static inline int ipa_allocate_ipv6ct_table(
1871 struct ipa_ioc_nat_ipv6ct_table_alloc *table_alloc)
1872{
1873 return -EPERM;
1874}
Amir Levy9659e592016-10-27 18:08:27 +03001875
1876static inline int ipa_nat_init_cmd(struct ipa_ioc_v4_nat_init *init)
1877{
1878 return -EPERM;
1879}
1880
Amir Levy479cfdd2017-10-26 12:23:14 +03001881static inline int ipa_ipv6ct_init_cmd(struct ipa_ioc_ipv6ct_init *init)
1882{
1883 return -EPERM;
1884}
Amir Levy9659e592016-10-27 18:08:27 +03001885
1886static inline int ipa_nat_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma)
1887{
1888 return -EPERM;
1889}
1890
Amir Levy479cfdd2017-10-26 12:23:14 +03001891static inline int ipa_table_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma)
1892{
1893 return -EPERM;
1894}
Amir Levy9659e592016-10-27 18:08:27 +03001895
1896static inline int ipa_nat_del_cmd(struct ipa_ioc_v4_nat_del *del)
1897{
1898 return -EPERM;
1899}
1900
Amir Levy479cfdd2017-10-26 12:23:14 +03001901static inline int ipa_del_nat_table(struct ipa_ioc_nat_ipv6ct_table_del *del)
1902{
1903 return -EPERM;
1904}
1905
1906static inline int ipa_del_ipv6ct_table(
1907 struct ipa_ioc_nat_ipv6ct_table_del *del)
1908{
1909 return -EPERM;
1910}
1911
1912static inline int ipa_nat_mdfy_pdn(struct ipa_ioc_nat_pdn_entry *mdfy_pdn)
1913{
1914 return -EPERM;
1915}
1916
Amir Levy9659e592016-10-27 18:08:27 +03001917/*
1918 * Messaging
1919 */
1920static inline int ipa_send_msg(struct ipa_msg_meta *meta, void *buff,
1921 ipa_msg_free_fn callback)
1922{
1923 return -EPERM;
1924}
1925
1926static inline int ipa_register_pull_msg(struct ipa_msg_meta *meta,
1927 ipa_msg_pull_fn callback)
1928{
1929 return -EPERM;
1930}
1931
1932static inline int ipa_deregister_pull_msg(struct ipa_msg_meta *meta)
1933{
1934 return -EPERM;
1935}
1936
1937/*
1938 * Interface
1939 */
1940static inline int ipa_register_intf(const char *name,
1941 const struct ipa_tx_intf *tx,
1942 const struct ipa_rx_intf *rx)
1943{
1944 return -EPERM;
1945}
1946
1947static inline int ipa_register_intf_ext(const char *name,
1948 const struct ipa_tx_intf *tx,
1949 const struct ipa_rx_intf *rx,
1950 const struct ipa_ext_intf *ext)
1951{
1952 return -EPERM;
1953}
1954
1955static inline int ipa_deregister_intf(const char *name)
1956{
1957 return -EPERM;
1958}
1959
1960/*
1961 * Aggregation
1962 */
1963static inline int ipa_set_aggr_mode(enum ipa_aggr_mode mode)
1964{
1965 return -EPERM;
1966}
1967
1968static inline int ipa_set_qcncm_ndp_sig(char sig[3])
1969{
1970 return -EPERM;
1971}
1972
1973static inline int ipa_set_single_ndp_per_mbim(bool enable)
1974{
1975 return -EPERM;
1976}
1977
1978/*
1979 * Data path
1980 */
1981static inline int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
1982 struct ipa_tx_meta *metadata)
1983{
1984 return -EPERM;
1985}
1986
1987/*
1988 * To transfer multiple data packets
1989 */
1990static inline int ipa_tx_dp_mul(
1991 enum ipa_client_type dst,
1992 struct ipa_tx_data_desc *data_desc)
1993{
1994 return -EPERM;
1995}
1996
1997static inline void ipa_free_skb(struct ipa_rx_data *rx_in)
1998{
1999}
2000
2001static inline int ipa_rx_poll(u32 clnt_hdl, int budget)
2002{
2003 return -EPERM;
2004}
2005
2006static inline void ipa_recycle_wan_skb(struct sk_buff *skb)
2007{
2008}
2009
2010/*
2011 * System pipes
2012 */
2013static inline u16 ipa_get_smem_restr_bytes(void)
2014{
2015 return -EPERM;
2016}
2017
2018static inline int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in,
2019 u32 *clnt_hdl)
2020{
2021 return -EPERM;
2022}
2023
2024static inline int ipa_teardown_sys_pipe(u32 clnt_hdl)
2025{
2026 return -EPERM;
2027}
2028
2029static inline int ipa_connect_wdi_pipe(struct ipa_wdi_in_params *in,
2030 struct ipa_wdi_out_params *out)
2031{
2032 return -EPERM;
2033}
2034
2035static inline int ipa_disconnect_wdi_pipe(u32 clnt_hdl)
2036{
2037 return -EPERM;
2038}
2039
2040static inline int ipa_enable_wdi_pipe(u32 clnt_hdl)
2041{
2042 return -EPERM;
2043}
2044
2045static inline int ipa_disable_wdi_pipe(u32 clnt_hdl)
2046{
2047 return -EPERM;
2048}
2049
2050static inline int ipa_resume_wdi_pipe(u32 clnt_hdl)
2051{
2052 return -EPERM;
2053}
2054
2055static inline int ipa_suspend_wdi_pipe(u32 clnt_hdl)
2056{
2057 return -EPERM;
2058}
2059
Skylar Changfcf36c22016-10-04 14:15:25 -07002060static inline int ipa_broadcast_wdi_quota_reach_ind(uint32_t fid,
2061 uint64_t num_bytes)
2062{
2063 return -EPERM;
2064}
2065
Amir Levy9659e592016-10-27 18:08:27 +03002066static inline int ipa_uc_wdi_get_dbpa(
2067 struct ipa_wdi_db_params *out)
2068{
2069 return -EPERM;
2070}
2071
2072static inline int ipa_uc_reg_rdyCB(
2073 struct ipa_wdi_uc_ready_params *param)
2074{
2075 return -EPERM;
2076}
2077
2078static inline int ipa_uc_dereg_rdyCB(void)
2079{
2080 return -EPERM;
2081}
2082
2083
2084/*
2085 * Resource manager
2086 */
2087static inline int ipa_rm_create_resource(
2088 struct ipa_rm_create_params *create_params)
2089{
2090 return -EPERM;
2091}
2092
2093static inline int ipa_rm_delete_resource(
2094 enum ipa_rm_resource_name resource_name)
2095{
2096 return -EPERM;
2097}
2098
2099static inline int ipa_rm_register(enum ipa_rm_resource_name resource_name,
2100 struct ipa_rm_register_params *reg_params)
2101{
2102 return -EPERM;
2103}
2104
2105static inline int ipa_rm_set_perf_profile(
2106 enum ipa_rm_resource_name resource_name,
2107 struct ipa_rm_perf_profile *profile)
2108{
2109 return -EPERM;
2110}
2111
2112static inline int ipa_rm_deregister(enum ipa_rm_resource_name resource_name,
2113 struct ipa_rm_register_params *reg_params)
2114{
2115 return -EPERM;
2116}
2117
2118static inline int ipa_rm_add_dependency(
2119 enum ipa_rm_resource_name resource_name,
2120 enum ipa_rm_resource_name depends_on_name)
2121{
2122 return -EPERM;
2123}
2124
2125static inline int ipa_rm_add_dependency_sync(
2126 enum ipa_rm_resource_name resource_name,
2127 enum ipa_rm_resource_name depends_on_name)
2128{
2129 return -EPERM;
2130}
2131
2132static inline int ipa_rm_delete_dependency(
2133 enum ipa_rm_resource_name resource_name,
2134 enum ipa_rm_resource_name depends_on_name)
2135{
2136 return -EPERM;
2137}
2138
2139static inline int ipa_rm_request_resource(
2140 enum ipa_rm_resource_name resource_name)
2141{
2142 return -EPERM;
2143}
2144
2145static inline int ipa_rm_release_resource(
2146 enum ipa_rm_resource_name resource_name)
2147{
2148 return -EPERM;
2149}
2150
2151static inline int ipa_rm_notify_completion(enum ipa_rm_event event,
2152 enum ipa_rm_resource_name resource_name)
2153{
2154 return -EPERM;
2155}
2156
2157static inline int ipa_rm_inactivity_timer_init(
2158 enum ipa_rm_resource_name resource_name,
2159 unsigned long msecs)
2160{
2161 return -EPERM;
2162}
2163
2164static inline int ipa_rm_inactivity_timer_destroy(
2165 enum ipa_rm_resource_name resource_name)
2166{
2167 return -EPERM;
2168}
2169
2170static inline int ipa_rm_inactivity_timer_request_resource(
2171 enum ipa_rm_resource_name resource_name)
2172{
2173 return -EPERM;
2174}
2175
2176static inline int ipa_rm_inactivity_timer_release_resource(
2177 enum ipa_rm_resource_name resource_name)
2178{
2179 return -EPERM;
2180}
2181
2182/*
2183 * Tethering bridge (Rmnet / MBIM)
2184 */
2185static inline int teth_bridge_init(struct teth_bridge_init_params *params)
2186{
2187 return -EPERM;
2188}
2189
2190static inline int teth_bridge_disconnect(enum ipa_client_type client)
2191{
2192 return -EPERM;
2193}
2194
2195static inline int teth_bridge_connect(struct teth_bridge_connect_params
2196 *connect_params)
2197{
2198 return -EPERM;
2199}
2200
2201/*
2202 * Tethering client info
2203 */
2204static inline void ipa_set_client(int index, enum ipacm_client_enum client,
2205 bool uplink)
2206{
2207}
2208
2209static inline enum ipacm_client_enum ipa_get_client(int pipe_idx)
2210{
2211 return -EPERM;
2212}
2213
2214static inline bool ipa_get_client_uplink(int pipe_idx)
2215{
2216 return -EPERM;
2217}
2218
2219/*
2220 * IPADMA
2221 */
2222static inline int ipa_dma_init(void)
2223{
2224 return -EPERM;
2225}
2226
2227static inline int ipa_dma_enable(void)
2228{
2229 return -EPERM;
2230}
2231
2232static inline int ipa_dma_disable(void)
2233{
2234 return -EPERM;
2235}
2236
2237static inline int ipa_dma_sync_memcpy(phys_addr_t dest, phys_addr_t src
2238 , int len)
2239{
2240 return -EPERM;
2241}
2242
2243static inline int ipa_dma_async_memcpy(phys_addr_t dest, phys_addr_t src
2244 , int len, void (*user_cb)(void *user1),
2245 void *user_param)
2246{
2247 return -EPERM;
2248}
2249
2250static inline int ipa_dma_uc_memcpy(phys_addr_t dest, phys_addr_t src, int len)
2251{
2252 return -EPERM;
2253}
2254
2255static inline void ipa_dma_destroy(void)
2256{
2257}
2258
2259/*
2260 * mux id
2261 */
2262static inline int ipa_write_qmap_id(struct ipa_ioc_write_qmapid *param_in)
2263{
2264 return -EPERM;
2265}
2266
2267/*
2268 * interrupts
2269 */
2270static inline int ipa_add_interrupt_handler(enum ipa_irq_type interrupt,
2271 ipa_irq_handler_t handler,
2272 bool deferred_flag,
2273 void *private_data)
2274{
2275 return -EPERM;
2276}
2277
2278static inline int ipa_remove_interrupt_handler(enum ipa_irq_type interrupt)
2279{
2280 return -EPERM;
2281}
2282
2283static inline int ipa_restore_suspend_handler(void)
2284{
2285 return -EPERM;
2286}
2287
2288/*
2289 * Miscellaneous
2290 */
2291static inline void ipa_bam_reg_dump(void)
2292{
2293}
2294
2295static inline int ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats)
2296{
2297 return -EPERM;
2298}
2299
2300static inline int ipa_get_ep_mapping(enum ipa_client_type client)
2301{
2302 return -EPERM;
2303}
2304
2305static inline bool ipa_is_ready(void)
2306{
2307 return false;
2308}
2309
2310static inline void ipa_proxy_clk_vote(void)
2311{
2312}
2313
2314static inline void ipa_proxy_clk_unvote(void)
2315{
2316}
2317
2318static inline enum ipa_hw_type ipa_get_hw_type(void)
2319{
2320 return IPA_HW_None;
2321}
2322
2323static inline bool ipa_is_client_handle_valid(u32 clnt_hdl)
2324{
2325 return -EINVAL;
2326}
2327
2328static inline enum ipa_client_type ipa_get_client_mapping(int pipe_idx)
2329{
2330 return -EINVAL;
2331}
2332
2333static inline enum ipa_rm_resource_name ipa_get_rm_resource_from_ep(
2334 int pipe_idx)
2335{
2336 return -EFAULT;
2337}
2338
2339static inline bool ipa_get_modem_cfg_emb_pipe_flt(void)
2340{
2341 return -EINVAL;
2342}
2343
2344static inline enum ipa_transport_type ipa_get_transport_type(void)
2345{
2346 return -EFAULT;
2347}
2348
2349static inline struct device *ipa_get_dma_dev(void)
2350{
2351 return NULL;
2352}
2353
2354static inline struct iommu_domain *ipa_get_smmu_domain(void)
2355{
2356 return NULL;
2357}
2358
2359static inline int ipa_create_wdi_mapping(u32 num_buffers,
2360 struct ipa_wdi_buffer_info *info)
2361{
2362 return -EINVAL;
2363}
2364
2365static inline int ipa_release_wdi_mapping(u32 num_buffers,
2366 struct ipa_wdi_buffer_info *info)
2367{
2368 return -EINVAL;
2369}
2370
2371static inline int ipa_disable_apps_wan_cons_deaggr(void)
2372{
2373 return -EINVAL;
2374}
2375
Amir Levy3be373c2017-03-05 16:31:30 +02002376static inline const struct ipa_gsi_ep_config *ipa_get_gsi_ep_info
2377 (enum ipa_client_type client)
Amir Levy9659e592016-10-27 18:08:27 +03002378{
2379 return NULL;
2380}
2381
2382static inline int ipa_stop_gsi_channel(u32 clnt_hdl)
2383{
2384 return -EPERM;
2385}
2386
2387static inline int ipa_register_ipa_ready_cb(
2388 void (*ipa_ready_cb)(void *user_data),
2389 void *user_data)
2390{
2391 return -EPERM;
2392}
2393
Skylar Chang48afa052017-10-25 09:32:57 -07002394static inline int ipa_tz_unlock_reg(struct ipa_tz_unlock_reg_info *reg_info,
2395 u16 num_regs)
2396{
2397 return -EPERM;
2398}
2399
Michael Adisumartad04e6d62017-11-09 17:46:35 -08002400
2401static inline int ipa_get_smmu_params(struct ipa_smmu_in_params *in,
2402 struct ipa_smmu_out_params *out)
2403{
2404 return -EPERM;
2405}
Amir Levy2da9d452017-12-12 10:09:46 +02002406
2407static inline int ipa_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res)
2408{
2409 return -EPERM;
2410}
Amir Levy9659e592016-10-27 18:08:27 +03002411#endif /* (CONFIG_IPA || CONFIG_IPA3) */
2412
2413#endif /* _IPA_H_ */