ipa.h 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _IPA_H_
  7. #define _IPA_H_
  8. #include <linux/if_ether.h>
  9. #include <linux/ip.h>
  10. #include <linux/ipv6.h>
  11. #include <linux/msm_ipa.h>
  12. #include <linux/skbuff.h>
  13. #include <linux/types.h>
  14. #include <linux/ipa_qmi_service_v01.h>
  15. #include <linux/msm_gsi.h>
  16. #define IPA_APPS_MAX_BW_IN_MBPS 700
  17. #define IPA_BW_THRESHOLD_MAX 3
  18. #define IPA_MAX_CH_STATS_SUPPORTED 5
  19. #define IPA_EP_ARR_SIZE 2
  20. #define IPA_EP_PER_REG 32
  21. /* Notifiers for rmnet driver */
  22. #define BUFF_ABOVE_HIGH_THRESHOLD_FOR_DEFAULT_PIPE 1
  23. #define BUFF_ABOVE_HIGH_THRESHOLD_FOR_COAL_PIPE 2
  24. #define BUFF_BELOW_LOW_THRESHOLD_FOR_DEFAULT_PIPE 3
  25. #define BUFF_BELOW_LOW_THRESHOLD_FOR_COAL_PIPE 4
  26. #define BUFF_ABOVE_HIGH_THRESHOLD_FOR_LL_PIPE 5
  27. #define BUFF_BELOW_LOW_THRESHOLD_FOR_LL_PIPE 6
  28. #define FREE_PAGE_TASK_SCHEDULED 7
  29. #define FREE_PAGE_TASK_SCHEDULED_LL 8
  30. /**
  31. * the attributes of the socksv5 options
  32. */
  33. #define IPA_SOCKSv5_ENTRY_VALID (1ul << 0)
  34. #define IPA_SOCKSv5_IPV4 (1ul << 1)
  35. #define IPA_SOCKSv5_IPV6 (1ul << 2)
  36. #define IPA_SOCKSv5_OPT_TS (1ul << 3)
  37. #define IPA_SOCKSv5_OPT_SACK (1ul << 4)
  38. #define IPA_SOCKSv5_OPT_WS_STC (1ul << 5)
  39. #define IPA_SOCKSv5_OPT_WS_DMC (1ul << 6)
  40. #define IPA_SOCKsv5_ADD_COM_ID 15
  41. #define IPA_SOCKsv5_ADD_V6_V4_COM_PM 1
  42. #define IPA_SOCKsv5_ADD_V4_V6_COM_PM 2
  43. #define IPA_SOCKsv5_ADD_V6_V6_COM_PM 3
  44. /**
  45. * enum ipa_transport_type
  46. * transport type: either GSI or SPS
  47. */
  48. enum ipa_transport_type {
  49. IPA_TRANSPORT_TYPE_SPS,
  50. IPA_TRANSPORT_TYPE_GSI
  51. };
  52. /**
  53. * enum ipa_nat_en_type - NAT setting type in IPA end-point
  54. */
  55. enum ipa_nat_en_type {
  56. IPA_BYPASS_NAT,
  57. IPA_SRC_NAT,
  58. IPA_DST_NAT,
  59. };
  60. /**
  61. * enum ipa_ipv6ct_en_type - IPv6CT setting type in IPA end-point
  62. */
  63. enum ipa_ipv6ct_en_type {
  64. IPA_BYPASS_IPV6CT,
  65. IPA_ENABLE_IPV6CT,
  66. };
  67. /**
  68. * enum ipa_mode_type - mode setting type in IPA end-point
  69. * @BASIC: basic mode
  70. * @ENABLE_FRAMING_HDLC: not currently supported
  71. * @ENABLE_DEFRAMING_HDLC: not currently supported
  72. * @DMA: all data arriving IPA will not go through IPA logic blocks, this
  73. * allows IPA to work as DMA for specific pipes.
  74. */
  75. enum ipa_mode_type {
  76. IPA_BASIC,
  77. IPA_ENABLE_FRAMING_HDLC,
  78. IPA_ENABLE_DEFRAMING_HDLC,
  79. IPA_DMA,
  80. };
  81. /**
  82. * enum ipa_aggr_en_type - aggregation setting type in IPA
  83. * end-point
  84. */
  85. enum ipa_aggr_en_type {
  86. IPA_BYPASS_AGGR,
  87. IPA_ENABLE_AGGR,
  88. IPA_ENABLE_DEAGGR,
  89. };
  90. /**
  91. * enum ipa_aggr_type - type of aggregation in IPA end-point
  92. */
  93. enum ipa_aggr_type {
  94. IPA_MBIM_16 = 0,
  95. IPA_HDLC = 1,
  96. IPA_TLP = 2,
  97. IPA_RNDIS = 3,
  98. IPA_GENERIC = 4,
  99. IPA_COALESCE = 5,
  100. IPA_QCMAP = 6,
  101. };
  102. /**
  103. * enum ipa_aggr_mode - global aggregation mode
  104. */
  105. enum ipa_aggr_mode {
  106. IPA_MBIM_AGGR,
  107. IPA_QCNCM_AGGR,
  108. };
  109. /**
  110. * enum ipa_dp_evt_type - type of event client callback is
  111. * invoked for on data path
  112. * @IPA_RECEIVE: data is struct sk_buff
  113. * @IPA_WRITE_DONE: data is struct sk_buff
  114. */
  115. enum ipa_dp_evt_type {
  116. IPA_RECEIVE,
  117. IPA_WRITE_DONE,
  118. };
  119. /**
  120. * enum hdr_total_len_or_pad_type - type of value held by TOTAL_LEN_OR_PAD
  121. * field in header configuration register.
  122. * @IPA_HDR_PAD: field is used as padding length
  123. * @IPA_HDR_TOTAL_LEN: field is used as total length
  124. */
  125. enum hdr_total_len_or_pad_type {
  126. IPA_HDR_PAD = 0,
  127. IPA_HDR_TOTAL_LEN = 1,
  128. };
  129. /**
  130. * struct ipa_ep_cfg_nat - NAT configuration in IPA end-point
  131. * @nat_en: This defines the default NAT mode for the pipe: in case of
  132. * filter miss - the default NAT mode defines the NATing operation
  133. * on the packet. Valid for Input Pipes only (IPA consumer)
  134. * @nat_exc_suppress: 1 - NAT exception is supressed and packet will be
  135. * routed using configured routing tables.
  136. * 0 - NAT exception is allowed and packets will be routed to exception
  137. * pipe. Valid for input pipes only (IPA consumer)
  138. */
  139. struct ipa_ep_cfg_nat {
  140. enum ipa_nat_en_type nat_en;
  141. bool nat_exc_suppress;
  142. };
  143. /**
  144. * struct ipa_ep_cfg_conn_track - IPv6 Connection tracking configuration in
  145. * IPA end-point
  146. * @conn_track_en: Defines speculative conn_track action, means if specific
  147. * pipe needs to have UL/DL IPv6 Connection Tracking or Bypass
  148. * IPv6 Connection Tracking. 0: Bypass IPv6 Connection Tracking
  149. * 1: IPv6 UL/DL Connection Tracking.
  150. * Valid for Input Pipes only (IPA consumer)
  151. */
  152. struct ipa_ep_cfg_conn_track {
  153. enum ipa_ipv6ct_en_type conn_track_en;
  154. };
  155. /**
  156. * 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. * Starting IPA4.5, this field in H/W requires more bits
  178. * to support larger range, but no spare bits to use.
  179. * So the MSB part is done thourgh the EXT register.
  180. * When accessing this register, need to access the EXT
  181. * register as well.
  182. * @hdr_ofst_pkt_size_valid: 0: Hdr_Ofst_Pkt_Size value is invalid, i.e., no
  183. * length field within the inserted header
  184. * 1: Hdr_Ofst_Pkt_Size value is valid, i.e., a
  185. * packet length field resides within the header
  186. * Valid for Output Pipes (IPA Producer)
  187. * @hdr_ofst_pkt_size: Offset within header in which packet size reside. Upon
  188. * Header Insertion, IPA will update this field within the
  189. * header with the packet length . Assumption is that
  190. * header length field size is constant and is 2Bytes
  191. * Valid for Output Pipes (IPA Producer)
  192. * Starting IPA4.5, this field in H/W requires more bits
  193. * to support larger range, but no spare bits to use.
  194. * So the MSB part is done thourgh the EXT register.
  195. * When accessing this register, need to access the EXT
  196. * register as well.
  197. * @hdr_a5_mux: Determines whether A5 Mux header should be added to the packet.
  198. * This bit is valid only when Hdr_En=01(Header Insertion)
  199. * SW should set this bit for IPA-to-A5 pipes.
  200. * 0: Do not insert A5 Mux Header
  201. * 1: Insert A5 Mux Header
  202. * Valid for Output Pipes (IPA Producer)
  203. * @hdr_remove_additional: bool switch, remove more of the header
  204. * based on the aggregation configuration (register
  205. * HDR_LEN_INC_DEAGG_HDR)
  206. * @hdr_metadata_reg_valid: bool switch, metadata from
  207. * register INIT_HDR_METADATA_n is valid.
  208. * (relevant only for IPA Consumer pipes)
  209. * Starting IPA4.5, this parameter is irrelevant and H/W
  210. * assumes it is always valid.
  211. */
  212. struct ipa_ep_cfg_hdr {
  213. u32 hdr_len;
  214. u32 hdr_ofst_metadata_valid;
  215. u32 hdr_ofst_metadata;
  216. u32 hdr_additional_const_len;
  217. u32 hdr_ofst_pkt_size_valid;
  218. u32 hdr_ofst_pkt_size;
  219. u32 hdr_a5_mux;
  220. u32 hdr_remove_additional;
  221. u32 hdr_metadata_reg_valid;
  222. };
  223. /**
  224. * struct ipa_ep_cfg_hdr_ext - extended header configuration in IPA end-point
  225. * @hdr_pad_to_alignment: Pad packet to specified alignment
  226. * (2^pad to alignment value), i.e. value of 3 means pad to 2^3 = 8 bytes
  227. * alignment. Alignment is to 0,2 up to 32 bytes (IPAv2 does not support 64
  228. * byte alignment). Valid for Output Pipes only (IPA Producer).
  229. * @hdr_total_len_or_pad_offset: Offset to length field containing either
  230. * total length or pad length, per hdr_total_len_or_pad config
  231. * @hdr_payload_len_inc_padding: 0-IPA_ENDP_INIT_HDR_n's
  232. * HDR_OFST_PKT_SIZE does
  233. * not includes padding bytes size, payload_len = packet length,
  234. * 1-IPA_ENDP_INIT_HDR_n's HDR_OFST_PKT_SIZE includes
  235. * padding bytes size, payload_len = packet length + padding
  236. * @hdr_total_len_or_pad: field is used as PAD length ot as Total length
  237. * (header + packet + padding)
  238. * @hdr_total_len_or_pad_valid: 0-Ignore TOTAL_LEN_OR_PAD field, 1-Process
  239. * TOTAL_LEN_OR_PAD field
  240. * @hdr_little_endian: 0-Big Endian, 1-Little Endian
  241. * @hdr: The header structure. Used starting IPA4.5 where part of the info
  242. * at the header structure is implemented via the EXT register at the H/W
  243. * @hdr_bytes_to_remove_valid: 0-Ignore hdr_bytes_to_remove field, 1-Process
  244. * hdr_bytes_to_remove field
  245. * @hdr_bytes_to_remove: desired bytes to remove from top of the packet for
  246. * partial L2 header retention
  247. */
  248. struct ipa_ep_cfg_hdr_ext {
  249. u32 hdr_pad_to_alignment;
  250. u32 hdr_total_len_or_pad_offset;
  251. bool hdr_payload_len_inc_padding;
  252. enum hdr_total_len_or_pad_type hdr_total_len_or_pad;
  253. bool hdr_total_len_or_pad_valid;
  254. bool hdr_little_endian;
  255. struct ipa_ep_cfg_hdr *hdr;
  256. bool hdr_bytes_to_remove_valid;
  257. u32 hdr_bytes_to_remove;
  258. };
  259. /**
  260. * struct ipa_ep_cfg_mode - mode configuration in IPA end-point
  261. * @mode: Valid for Input Pipes only (IPA Consumer)
  262. * @dst: This parameter specifies the output pipe to which the packets
  263. * will be routed to.
  264. * This parameter is valid for Mode=DMA and not valid for
  265. * Mode=Basic
  266. * Valid for Input Pipes only (IPA Consumer)
  267. */
  268. struct ipa_ep_cfg_mode {
  269. enum ipa_mode_type mode;
  270. enum ipa_client_type dst;
  271. };
  272. /**
  273. * struct ipa_ep_cfg_aggr - aggregation configuration in IPA end-point
  274. *
  275. * @aggr_en: Valid for both Input and Output Pipes
  276. * @aggr: aggregation type (Valid for both Input and Output Pipes)
  277. * @aggr_byte_limit: Limit of aggregated packet size in KB (<=32KB) When set
  278. * to 0, there is no size limitation on the aggregation.
  279. * When both, Aggr_Byte_Limit and Aggr_Time_Limit are set
  280. * to 0, there is no aggregation, every packet is sent
  281. * independently according to the aggregation structure
  282. * Valid for Output Pipes only (IPA Producer )
  283. * @aggr_time_limit: Timer to close aggregated packet When set to 0,
  284. * there is no time limitation on the aggregation. When
  285. * both, Aggr_Byte_Limit and Aggr_Time_Limit are set to 0,
  286. * there is no aggregation, every packet is sent
  287. * independently according to the aggregation structure
  288. * Valid for Output Pipes only (IPA Producer).
  289. * Time unit is -->> usec <<--
  290. * @aggr_pkt_limit: Defines if EOF close aggregation or not. if set to false
  291. * HW closes aggregation (sends EOT) only based on its
  292. * aggregation config (byte/time limit, etc). if set to
  293. * true EOF closes aggregation in addition to HW based
  294. * aggregation closure. Valid for Output Pipes only (IPA
  295. * Producer). EOF affects only Pipes configured for
  296. * generic aggregation.
  297. * @aggr_hard_byte_limit_en: If set to 1, byte-limit aggregation for this
  298. * pipe will apply a hard-limit behavior which will not
  299. * allow frames to be closed with more than byte-limit
  300. * bytes. If set to 0, previous byte-limit behavior
  301. * will apply - frames close once a packet causes the
  302. * accumulated byte-count to cross the byte-limit
  303. * threshold (closed frame will contain that packet).
  304. * @aggr_sw_eof_active: 0: EOF does not close aggregation. HW closes aggregation
  305. * (sends EOT) only based on its aggregation config
  306. * (byte/time limit, etc).
  307. * 1: EOF closes aggregation in addition to HW based
  308. * aggregation closure. Valid for Output Pipes only (IPA
  309. * Producer). EOF affects only Pipes configured for generic
  310. * aggregation.
  311. * @pulse_generator: Pulse generator number to be used.
  312. * For internal use.
  313. * Supported starting IPA4.5.
  314. * @scaled_time: Time limit in accordance to the pulse generator
  315. * granularity.
  316. * For internal use
  317. * Supported starting IPA4.5
  318. * @aggr_coal_l2: enable L2 coalescing on the specifid dest pipe,
  319. * work only if AGGR_TYPE set to AGGR_TYPE_COALESCING.
  320. * Supported starting IPA5.5
  321. */
  322. struct ipa_ep_cfg_aggr {
  323. enum ipa_aggr_en_type aggr_en;
  324. enum ipa_aggr_type aggr;
  325. u32 aggr_byte_limit;
  326. u32 aggr_time_limit;
  327. u32 aggr_pkt_limit;
  328. u32 aggr_hard_byte_limit_en;
  329. bool aggr_sw_eof_active;
  330. u8 pulse_generator;
  331. u8 scaled_time;
  332. bool aggr_coal_l2;
  333. };
  334. /**
  335. * struct ipa_ep_cfg_route - route configuration in IPA end-point
  336. * @rt_tbl_hdl: Defines the default routing table index to be used in case there
  337. * is no filter rule matching, valid for Input Pipes only (IPA
  338. * Consumer). Clients should set this to 0 which will cause default
  339. * v4 and v6 routes setup internally by IPA driver to be used for
  340. * this end-point
  341. */
  342. struct ipa_ep_cfg_route {
  343. u32 rt_tbl_hdl;
  344. };
  345. /**
  346. * struct ipa_ep_cfg_holb - head of line blocking configuration in IPA end-point
  347. * @en: enable(1 => ok to drop pkt)/disable(0 => never drop pkt)
  348. * @tmr_val: duration in units of 128 IPA clk clock cyles [0,511], 1 clk=1.28us
  349. * IPAv2.5 support 32 bit HOLB timeout value, previous versions
  350. * supports 16 bit
  351. * IPAv4.2: splitting timer value into 2 fields. Timer value is:
  352. * BASE_VALUE * (2^SCALE)
  353. * IPA4.5: tmr_val is in -->>msec<<--. Range is dynamic based
  354. * on H/W configuration. (IPA4.5 absolute maximum is 0.65535*31 -> ~20sec).
  355. * @base_val : IPA4.2 only field. base value of the timer.
  356. * @scale : IPA4.2 only field. scale value for timer.
  357. * @pulse_generator: Pulse generator number to be used.
  358. * For internal use.
  359. * Supported starting IPA4.5.
  360. * @scaled_time: Time limit in accordance to the pulse generator granularity
  361. * For internal use
  362. * Supported starting IPA4.5
  363. */
  364. struct ipa_ep_cfg_holb {
  365. u32 tmr_val;
  366. u32 base_val;
  367. u32 scale;
  368. u16 en;
  369. u8 pulse_generator;
  370. u8 scaled_time;
  371. };
  372. /**
  373. * struct ipa_ep_cfg_deaggr - deaggregation configuration in IPA end-point
  374. * @deaggr_hdr_len: Deaggregation Header length in bytes. Valid only for Input
  375. * Pipes, which are configured for 'Generic' deaggregation.
  376. * @syspipe_err_detection - If set to 1, enables error detection for
  377. * de-aggregration. Valid only for Input Pipes, which are configured
  378. * for 'Generic' deaggregation.
  379. * Note: if this bit is set, de-aggregated frames must be contiguous
  380. * in memory.
  381. * @packet_offset_valid: - 0: PACKET_OFFSET is not used, 1: PACKET_OFFSET is
  382. * used.
  383. * @packet_offset_location: Location of packet offset field, which specifies
  384. * the offset to the packet from the start of the packet offset field.
  385. * @ignore_min_pkt_err - Ignore packets smaller than header. This is intended
  386. * for use in RNDIS de-aggregated pipes, to silently ignore a redundant
  387. * 1-byte trailer in MSFT implementation.
  388. * @max_packet_len: DEAGGR Max Packet Length in Bytes. A Packet with higher
  389. * size wil be treated as an error. 0 - Packet Length is not Bound,
  390. * IPA should not check for a Max Packet Length.
  391. */
  392. struct ipa_ep_cfg_deaggr {
  393. u32 deaggr_hdr_len;
  394. bool syspipe_err_detection;
  395. bool packet_offset_valid;
  396. u32 packet_offset_location;
  397. bool ignore_min_pkt_err;
  398. u32 max_packet_len;
  399. };
  400. /**
  401. * enum ipa_cs_offload - checksum offload setting
  402. */
  403. enum ipa_cs_offload {
  404. IPA_DISABLE_CS_OFFLOAD,
  405. /*
  406. * For enum value = 1, we check the csum required/valid bit which is the
  407. * same bit used for both DL and UL but have different meanings.
  408. * For UL pipe, HW checks if it needs to perform Csum caluclation.
  409. * For DL pipe, HW checks if the csum is valid or invalid
  410. */
  411. IPA_ENABLE_CS_OFFLOAD_UL,
  412. IPA_ENABLE_CS_DL_QMAP = IPA_ENABLE_CS_OFFLOAD_UL,
  413. IPA_ENABLE_CS_OFFLOAD_DL,
  414. IPA_CS_RSVD
  415. };
  416. /**
  417. * struct ipa_ep_cfg_cfg - IPA ENDP_INIT Configuration register
  418. * @frag_offload_en: - 0 - IP packet fragment handling is disabled. IP packet
  419. * fragments should be sent to SW. SW is responsible for
  420. * configuring filter rules, and IP packet filter exception should be
  421. * used to send all fragments to SW. 1 - IP packet fragment
  422. * handling is enabled. IPA checks for fragments and uses frag
  423. * rules table for processing fragments. Valid only for Input Pipes
  424. * (IPA Consumer)
  425. * @cs_offload_en: Checksum offload enable: 00: Disable checksum offload, 01:
  426. * Enable checksum calculation offload (UL) - For output pipe
  427. * (IPA producer) specifies that checksum trailer is to be added.
  428. * For input pipe (IPA consumer) specifies presence of checksum
  429. * header and IPA checksum calculation accordingly. 10: Enable
  430. * checksum calculation offload (DL) - For output pipe (IPA
  431. * producer) specifies that checksum trailer is to be added. For
  432. * input pipe (IPA consumer) specifies IPA checksum calculation.
  433. * 11: Reserved
  434. * @cs_metadata_hdr_offset: Offset in Words (4 bytes) within header in which
  435. * checksum metadata info header (4 bytes) starts (UL). Values are 0-15, which
  436. * mean 0 - 60 byte checksum header offset. Valid for input
  437. * pipes only (IPA consumer)
  438. * @gen_qmb_master_sel: Select bit for ENDP GEN-QMB master. This is used to
  439. * separate DDR & PCIe transactions in-order to limit them as
  440. * a group (using MAX_WRITES/READS limiation). Valid for input and
  441. * output pipes (IPA consumer+producer)
  442. * @pipe_replicate_en: 1 - For consumer pipe - consumer DPL will be active.
  443. * For producer pipe - producer DPL will be active.
  444. * 0 - packet replication disabled for both consumer and producer pipe.
  445. * Supported from IPA5.5 onwards.
  446. */
  447. struct ipa_ep_cfg_cfg {
  448. bool frag_offload_en;
  449. enum ipa_cs_offload cs_offload_en;
  450. u8 cs_metadata_hdr_offset;
  451. u8 gen_qmb_master_sel;
  452. u8 tx_instance;
  453. bool pipe_replicate_en;
  454. };
  455. /**
  456. * struct ipa_ep_cfg_prod_cfg - IPA ENDP_INIT Producer Configuration register
  457. * @tx_instance: - 0 - select TX_0 instance.
  458. * 1 - select TX_1 instance.
  459. * @tsp_enable: boolean to indicate TSP-enablement per producer pipe.
  460. * @max_output_size_drop_enable: enable policing by max output size for TSP
  461. * feature. In case of TSP_ENABLE == 1 + valid egress_tc, max output size
  462. * policing will be valid regardless to this bit.
  463. * @tsp_idx: TSP producer-index. Controls pointer to producer-rate database.
  464. * Valid only when TSP_ENABLE field is set. Value should be unique.
  465. * @max_output_size: max output size allowed per producer. Value is in 64-byte
  466. * resolution for TSP feature
  467. * @egress_tc_lowest: Lowest egress traffic-class index assignes to this
  468. * producer.
  469. * @egress_tc_highest: Highest egress traffic-class index assignes to this
  470. * producer.
  471. */
  472. struct ipa_ep_cfg_prod_cfg {
  473. u8 tx_instance;
  474. bool tsp_enable;
  475. bool max_output_size_drop_enable;
  476. u8 tsp_idx;
  477. u8 max_output_size;
  478. u8 egress_tc_lowest;
  479. u8 egress_tc_highest;
  480. };
  481. /**
  482. * struct ipa_ep_cfg_metadata_mask - Endpoint initialization hdr metadata mask
  483. * @metadata_mask: Mask specifying which metadata bits to write to
  484. * IPA_ENDP_INIT_HDR_n.s HDR_OFST_METADATA. Only
  485. * masked metadata bits (set to 1) will be written. Valid for Output
  486. * Pipes only (IPA Producer)
  487. */
  488. struct ipa_ep_cfg_metadata_mask {
  489. u32 metadata_mask;
  490. };
  491. /**
  492. * struct ipa_ep_cfg_metadata - Metadata configuration in IPA end-point
  493. * @md: This defines the metadata from tx data descriptor
  494. * @qmap_id: qmap id
  495. */
  496. struct ipa_ep_cfg_metadata {
  497. u32 qmap_id;
  498. };
  499. /**
  500. * struct ipa_ep_cfg_seq - HPS/DPS sequencer type configuration in IPA end-point
  501. * @set_dynamic: 0 - HPS/DPS seq type is configured statically,
  502. * 1 - HPS/DPS seq type is set to seq_type
  503. * @seq_type: HPS/DPS sequencer type configuration
  504. */
  505. struct ipa_ep_cfg_seq {
  506. bool set_dynamic;
  507. int seq_type;
  508. };
  509. /**
  510. * struct ipa_ep_cfg_ulso - ULSO configurations
  511. * @ipid_min_max_idx: A value in the range [0, 2]. Determines the registers
  512. * pair from which to read the minimum and maximum of IPv4 packets ID. It
  513. * is set to 0 as this range is platform specific and there is no need for
  514. * more than one pair values for this range. The minimum and maximum values
  515. * are taken from the device tree in pre_init and are stored in dedicated
  516. * registers.
  517. * @is_ulso_pipe: Indicates whether the pipe is in ulso operation mode.
  518. */
  519. struct ipa_ep_cfg_ulso {
  520. int ipid_min_max_idx;
  521. bool is_ulso_pipe;
  522. };
  523. /**
  524. * struct ipa_ep_cfg - configuration of IPA end-point
  525. * @nat: NAT parameters
  526. * @conn_track: IPv6CT parameters
  527. * @hdr: Header parameters
  528. * @hdr_ext: Extended header parameters
  529. * @mode: Mode parameters
  530. * @aggr: Aggregation parameters
  531. * @deaggr: Deaggregation params
  532. * @route: Routing parameters
  533. * @cfg: Configuration register data
  534. * @metadata_mask: Hdr metadata mask
  535. * @meta: Metadata
  536. * @seq: HPS/DPS sequencers configuration
  537. * @ulso: ULSO configuration
  538. * @prod_cfg: Producer specific Configuration register data
  539. */
  540. struct ipa_ep_cfg {
  541. struct ipa_ep_cfg_nat nat;
  542. struct ipa_ep_cfg_conn_track conn_track;
  543. struct ipa_ep_cfg_hdr hdr;
  544. struct ipa_ep_cfg_hdr_ext hdr_ext;
  545. struct ipa_ep_cfg_mode mode;
  546. struct ipa_ep_cfg_aggr aggr;
  547. struct ipa_ep_cfg_deaggr deaggr;
  548. struct ipa_ep_cfg_route route;
  549. struct ipa_ep_cfg_cfg cfg;
  550. struct ipa_ep_cfg_metadata_mask metadata_mask;
  551. struct ipa_ep_cfg_metadata meta;
  552. struct ipa_ep_cfg_seq seq;
  553. struct ipa_ep_cfg_ulso ulso;
  554. struct ipa_ep_cfg_prod_cfg prod_cfg;
  555. };
  556. /**
  557. * struct ipa_ep_cfg_ctrl - Control configuration in IPA end-point
  558. * @ipa_ep_suspend: 0 - ENDP is enabled, 1 - ENDP is suspended (disabled).
  559. * Valid for PROD Endpoints
  560. * @ipa_ep_delay: 0 - ENDP is free-running, 1 - ENDP is delayed.
  561. * SW controls the data flow of an endpoint usind this bit.
  562. * Valid for CONS Endpoints
  563. */
  564. struct ipa_ep_cfg_ctrl {
  565. bool ipa_ep_suspend;
  566. bool ipa_ep_delay;
  567. };
  568. /**
  569. * x should be in bytes
  570. */
  571. #define IPA_NUM_OF_FIFO_DESC(x) (x/sizeof(struct sps_iovec))
  572. typedef void (*ipa_notify_cb)(void *priv, enum ipa_dp_evt_type evt,
  573. unsigned long data);
  574. /**
  575. * enum ipa_wdi_meter_evt_type - type of event client callback is
  576. * for AP+STA mode metering
  577. * @IPA_GET_WDI_SAP_STATS: get IPA_stats betwen SAP and STA -
  578. * use ipa_get_wdi_sap_stats structure
  579. * @IPA_SET_WIFI_QUOTA: set quota limit on STA -
  580. * use ipa_set_wifi_quota structure
  581. * @IPA_SET_WLAN_BW: set wlan BW -
  582. * use ipa_set_wlan_bw structure
  583. */
  584. enum ipa_wdi_meter_evt_type {
  585. IPA_GET_WDI_SAP_STATS,
  586. IPA_SET_WIFI_QUOTA,
  587. IPA_INFORM_WLAN_BW,
  588. };
  589. struct ipa_get_wdi_sap_stats {
  590. /* indicate to reset stats after query */
  591. uint8_t reset_stats;
  592. /* indicate valid stats from wlan-fw */
  593. uint8_t stats_valid;
  594. /* Tx: SAP->STA */
  595. uint64_t ipv4_tx_packets;
  596. uint64_t ipv4_tx_bytes;
  597. /* Rx: STA->SAP */
  598. uint64_t ipv4_rx_packets;
  599. uint64_t ipv4_rx_bytes;
  600. uint64_t ipv6_tx_packets;
  601. uint64_t ipv6_tx_bytes;
  602. uint64_t ipv6_rx_packets;
  603. uint64_t ipv6_rx_bytes;
  604. };
  605. /**
  606. * struct ipa_set_wifi_quota - structure used for
  607. * IPA_SET_WIFI_QUOTA.
  608. *
  609. * @quota_bytes: Quota (in bytes) for the STA interface.
  610. * @set_quota: Indicate whether to set the quota (use 1) or
  611. * unset the quota.
  612. *
  613. */
  614. struct ipa_set_wifi_quota {
  615. uint64_t quota_bytes;
  616. uint8_t set_quota;
  617. /* indicate valid quota set from wlan-fw */
  618. uint8_t set_valid;
  619. };
  620. /**
  621. * struct ipa_inform_wlan_bw - structure used for
  622. * IPA_INFORM_WLAN_BW.
  623. *
  624. * @index: Indicate which bw-index hit
  625. * @throughput: throughput usage
  626. *
  627. */
  628. struct ipa_inform_wlan_bw {
  629. uint8_t index;
  630. uint64_t throughput;
  631. };
  632. typedef void (*ipa_wdi_meter_notifier_cb)(enum ipa_wdi_meter_evt_type evt,
  633. void *data);
  634. /**
  635. * struct ipa_tx_intf - interface tx properties
  636. * @num_props: number of tx properties
  637. * @prop: the tx properties array
  638. */
  639. struct ipa_tx_intf {
  640. u32 num_props;
  641. struct ipa_ioc_tx_intf_prop *prop;
  642. };
  643. /**
  644. * struct ipa_rx_intf - interface rx properties
  645. * @num_props: number of rx properties
  646. * @prop: the rx properties array
  647. */
  648. struct ipa_rx_intf {
  649. u32 num_props;
  650. struct ipa_ioc_rx_intf_prop *prop;
  651. };
  652. /**
  653. * struct ipa_ext_intf - interface ext properties
  654. * @excp_pipe_valid: is next field valid?
  655. * @excp_pipe: exception packets should be routed to this pipe
  656. * @num_props: number of ext properties
  657. * @prop: the ext properties array
  658. */
  659. struct ipa_ext_intf {
  660. bool excp_pipe_valid;
  661. enum ipa_client_type excp_pipe;
  662. u32 num_props;
  663. struct ipa_ioc_ext_intf_prop *prop;
  664. };
  665. /**
  666. * struct ipa_sys_connect_params - information needed to setup an IPA end-point
  667. * in system-BAM mode
  668. * @ipa_ep_cfg: IPA EP configuration
  669. * @client: the type of client who "owns" the EP
  670. * @desc_fifo_sz: size of desc FIFO. This number is used to allocate the desc
  671. * fifo for BAM. For GSI, this size is used by IPA driver as a
  672. * baseline to calculate the GSI ring size in the following way:
  673. * For PROD pipes, GSI ring is 4 * desc_fifo_sz.
  674. For PROD pipes, GSI ring is 2 * desc_fifo_sz.
  675. * @priv: callback cookie
  676. * @notify: callback
  677. * priv - callback cookie
  678. * evt - type of event
  679. * data - data relevant to event. May not be valid. See event_type
  680. * enum for valid cases.
  681. * @skip_ep_cfg: boolean field that determines if EP should be configured
  682. * by IPA driver
  683. * @keep_ipa_awake: when true, IPA will not be clock gated
  684. * @napi_enabled: when true, IPA call client callback to start polling
  685. * @bypass_agg: when true, IPA bypasses the aggregation
  686. * @int_modt: GSI event ring interrupt moderation time
  687. * cycles base interrupt moderation (32KHz clock)
  688. * @int_modc: GSI event ring interrupt moderation packet counter
  689. * @buff_size: Actual buff size of rx_pkt
  690. * @ext_ioctl_v2: Flag to determine whether ioctl_v2 received
  691. */
  692. struct ipa_sys_connect_params {
  693. struct ipa_ep_cfg ipa_ep_cfg;
  694. enum ipa_client_type client;
  695. u32 desc_fifo_sz;
  696. void *priv;
  697. ipa_notify_cb notify;
  698. bool skip_ep_cfg;
  699. bool keep_ipa_awake;
  700. struct napi_struct *napi_obj;
  701. bool recycle_enabled;
  702. bool bypass_agg;
  703. u32 int_modt;
  704. u32 int_modc;
  705. u32 buff_size;
  706. bool ext_ioctl_v2;
  707. };
  708. /**
  709. * struct ipa_tx_meta - metadata for the TX packet
  710. * @dma_address: dma mapped address of TX packet
  711. * @dma_address_valid: is above field valid?
  712. */
  713. struct ipa_tx_meta {
  714. u8 pkt_init_dst_ep;
  715. bool pkt_init_dst_ep_valid;
  716. bool pkt_init_dst_ep_remote;
  717. dma_addr_t dma_address;
  718. bool dma_address_valid;
  719. };
  720. /**
  721. * typedef ipa_msg_free_fn - callback function
  722. * @param buff - [in] the message payload to free
  723. * @param len - [in] size of message payload
  724. * @param type - [in] the message type
  725. *
  726. * Message callback registered by kernel client with IPA driver to
  727. * free message payload after IPA driver processing is complete
  728. *
  729. * No return value
  730. */
  731. typedef void (*ipa_msg_free_fn)(void *buff, u32 len, u32 type);
  732. /**
  733. * typedef ipa_msg_pull_fn - callback function
  734. * @param buff - [in] where to copy message payload
  735. * @param len - [in] size of buffer to copy payload into
  736. * @param type - [in] the message type
  737. *
  738. * Message callback registered by kernel client with IPA driver for
  739. * IPA driver to pull messages from the kernel client upon demand from
  740. * user-space
  741. *
  742. * Returns how many bytes were copied into the buffer.
  743. */
  744. typedef int (*ipa_msg_pull_fn)(void *buff, u32 len, u32 type);
  745. /**
  746. * enum ipa_voltage_level - IPA Voltage levels
  747. */
  748. enum ipa_voltage_level {
  749. IPA_VOLTAGE_UNSPECIFIED,
  750. IPA_VOLTAGE_SVS2 = IPA_VOLTAGE_UNSPECIFIED,
  751. IPA_VOLTAGE_SVS,
  752. IPA_VOLTAGE_NOMINAL,
  753. IPA_VOLTAGE_TURBO,
  754. IPA_VOLTAGE_MAX,
  755. };
  756. /**
  757. * enum ipa_rm_event - IPA RM events
  758. *
  759. * Indicate the resource state change
  760. */
  761. enum ipa_rm_event {
  762. IPA_RM_RESOURCE_GRANTED,
  763. IPA_RM_RESOURCE_RELEASED
  764. };
  765. typedef void (*ipa_rm_notify_cb)(void *user_data,
  766. enum ipa_rm_event event,
  767. unsigned long data);
  768. /**
  769. * struct ipa_rm_register_params - information needed to
  770. * register IPA RM client with IPA RM
  771. *
  772. * @user_data: IPA RM client provided information
  773. * to be passed to notify_cb callback below
  774. * @notify_cb: callback which is called by resource
  775. * to notify the IPA RM client about its state
  776. * change IPA RM client is expected to perform non
  777. * blocking operations only in notify_cb and
  778. * release notification context as soon as
  779. * possible.
  780. */
  781. struct ipa_rm_register_params {
  782. void *user_data;
  783. ipa_rm_notify_cb notify_cb;
  784. };
  785. /**
  786. * struct ipa_rm_create_params - information needed to initialize
  787. * the resource
  788. * @name: resource name
  789. * @floor_voltage: floor voltage needed for client to operate in maximum
  790. * bandwidth.
  791. * @reg_params: register parameters, contains are ignored
  792. * for consumer resource NULL should be provided
  793. * for consumer resource
  794. * @request_resource: function which should be called to request resource,
  795. * NULL should be provided for producer resource
  796. * @release_resource: function which should be called to release resource,
  797. * NULL should be provided for producer resource
  798. *
  799. * IPA RM client is expected to perform non blocking operations only
  800. * in request_resource and release_resource functions and
  801. * release notification context as soon as possible.
  802. */
  803. struct ipa_rm_create_params {
  804. enum ipa_rm_resource_name name;
  805. enum ipa_voltage_level floor_voltage;
  806. struct ipa_rm_register_params reg_params;
  807. int (*request_resource)(void);
  808. int (*release_resource)(void);
  809. };
  810. /**
  811. * struct ipa_rm_perf_profile - information regarding IPA RM client performance
  812. * profile
  813. *
  814. * @max_bandwidth_mbps: maximum bandwidth need of the client in Mbps
  815. */
  816. struct ipa_rm_perf_profile {
  817. u32 max_supported_bandwidth_mbps;
  818. };
  819. #define A2_MUX_HDR_NAME_V4_PREF "dmux_hdr_v4_"
  820. #define A2_MUX_HDR_NAME_V6_PREF "dmux_hdr_v6_"
  821. /**
  822. * struct ipa_tx_data_desc - information needed
  823. * to send data packet to HW link: link to data descriptors
  824. * priv: client specific private data
  825. * @pyld_buffer: pointer to the data buffer that holds frame
  826. * @pyld_len: length of the data packet
  827. */
  828. struct ipa_tx_data_desc {
  829. struct list_head link;
  830. void *priv;
  831. void *pyld_buffer;
  832. u16 pyld_len;
  833. };
  834. /**
  835. * struct ipa_rx_data - information needed
  836. * to send to wlan driver on receiving data from ipa hw
  837. * @skb: skb
  838. * @dma_addr: DMA address of this Rx packet
  839. */
  840. struct ipa_rx_data {
  841. struct sk_buff *skb;
  842. dma_addr_t dma_addr;
  843. };
  844. /**
  845. * enum ipa_irq_type - IPA Interrupt Type
  846. * Used to register handlers for IPA interrupts
  847. *
  848. * Below enum is a logical mapping and not the actual interrupt bit in HW
  849. */
  850. enum ipa_irq_type {
  851. IPA_BAD_SNOC_ACCESS_IRQ,
  852. IPA_UC_IRQ_0,
  853. IPA_UC_IRQ_1,
  854. IPA_UC_IRQ_2,
  855. IPA_UC_IRQ_3,
  856. IPA_UC_IN_Q_NOT_EMPTY_IRQ,
  857. IPA_UC_RX_CMD_Q_NOT_FULL_IRQ,
  858. IPA_PROC_TO_UC_ACK_Q_NOT_EMPTY_IRQ,
  859. IPA_RX_ERR_IRQ,
  860. IPA_DEAGGR_ERR_IRQ,
  861. IPA_TX_ERR_IRQ,
  862. IPA_STEP_MODE_IRQ,
  863. IPA_PROC_ERR_IRQ,
  864. IPA_TX_SUSPEND_IRQ,
  865. IPA_TX_HOLB_DROP_IRQ,
  866. IPA_BAM_GSI_IDLE_IRQ,
  867. IPA_PIPE_YELLOW_MARKER_BELOW_IRQ,
  868. IPA_PIPE_RED_MARKER_BELOW_IRQ,
  869. IPA_PIPE_YELLOW_MARKER_ABOVE_IRQ,
  870. IPA_PIPE_RED_MARKER_ABOVE_IRQ,
  871. IPA_UCP_IRQ,
  872. IPA_DCMP_IRQ,
  873. IPA_GSI_EE_IRQ,
  874. IPA_GSI_IPA_IF_TLV_RCVD_IRQ,
  875. IPA_GSI_UC_IRQ,
  876. IPA_TLV_LEN_MIN_DSM_IRQ,
  877. IPA_DRBIP_PKT_EXCEED_MAX_SIZE_IRQ,
  878. IPA_DRBIP_DATA_SCTR_CFG_ERROR_IRQ,
  879. IPA_DRBIP_IMM_CMD_NO_FLSH_HZRD_IRQ,
  880. IPA_IRQ_MAX
  881. };
  882. /**
  883. * typedef ipa_irq_handler_t - irq handler/callback type
  884. * @param ipa_irq_type - [in] interrupt type
  885. * @param private_data - [in, out] the client private data
  886. * @param interrupt_data - [out] interrupt information data
  887. *
  888. * callback registered by ipa_add_interrupt_handler function to
  889. * handle a specific interrupt type
  890. *
  891. * No return value
  892. */
  893. typedef void (*ipa_irq_handler_t)(enum ipa_irq_type interrupt,
  894. void *private_data,
  895. void *interrupt_data);
  896. /**
  897. * struct IpaHwBamStats_t - Structure holding the BAM statistics
  898. *
  899. * @bamFifoFull : Number of times Bam Fifo got full - For In Ch: Good,
  900. * For Out Ch: Bad
  901. * @bamFifoEmpty : Number of times Bam Fifo got empty - For In Ch: Bad,
  902. * For Out Ch: Good
  903. * @bamFifoUsageHigh : Number of times Bam fifo usage went above 75% -
  904. * For In Ch: Good, For Out Ch: Bad
  905. * @bamFifoUsageLow : Number of times Bam fifo usage went below 25% -
  906. * For In Ch: Bad, For Out Ch: Good
  907. */
  908. struct IpaHwBamStats_t {
  909. u32 bamFifoFull;
  910. u32 bamFifoEmpty;
  911. u32 bamFifoUsageHigh;
  912. u32 bamFifoUsageLow;
  913. u32 bamUtilCount;
  914. } __packed;
  915. /**
  916. * struct IpaHwRingStats_t - Structure holding the Ring statistics
  917. *
  918. * @ringFull : Number of times Transfer Ring got full - For In Ch: Good,
  919. * For Out Ch: Bad
  920. * @ringEmpty : Number of times Transfer Ring got empty - For In Ch: Bad,
  921. * For Out Ch: Good
  922. * @ringUsageHigh : Number of times Transfer Ring usage went above 75% -
  923. * For In Ch: Good, For Out Ch: Bad
  924. * @ringUsageLow : Number of times Transfer Ring usage went below 25% -
  925. * For In Ch: Bad, For Out Ch: Good
  926. */
  927. struct IpaHwRingStats_t {
  928. u32 ringFull;
  929. u32 ringEmpty;
  930. u32 ringUsageHigh;
  931. u32 ringUsageLow;
  932. u32 RingUtilCount;
  933. } __packed;
  934. /**
  935. * struct ipa_uc_dbg_rtk_ring_stats - uC dbg stats info for RTK
  936. * offloading protocol
  937. * @commStats: common stats
  938. * @trCount: transfer ring count
  939. * @erCount: event ring count
  940. * @totalAosCount: total AoS completion count
  941. * @busyTime: total busy time
  942. */
  943. struct ipa_uc_dbg_rtk_ring_stats {
  944. struct IpaHwRingStats_t commStats;
  945. u32 trCount;
  946. u32 erCount;
  947. u32 totalAosCount;
  948. u64 busyTime;
  949. } __packed;
  950. /**
  951. * struct IpaHwStatsWDIRxInfoData_t - Structure holding the WDI Rx channel
  952. * structures
  953. *
  954. * @max_outstanding_pkts : Number of outstanding packets in Rx Ring
  955. * @num_pkts_processed : Number of packets processed - cumulative
  956. * @rx_ring_rp_value : Read pointer last advertized to the WLAN FW
  957. * @rx_ind_ring_stats : Ring info
  958. * @bam_stats : BAM info
  959. * @num_bam_int_handled : Number of Bam Interrupts handled by FW
  960. * @num_db : Number of times the doorbell was rung
  961. * @num_unexpected_db : Number of unexpected doorbells
  962. * @num_pkts_in_dis_uninit_state : number of completions we
  963. * received in disabled or uninitialized state
  964. * @num_ic_inj_vdev_change : Number of times the Imm Cmd is
  965. * injected due to vdev_id change
  966. * @num_ic_inj_fw_desc_change : Number of times the Imm Cmd is
  967. * injected due to fw_desc change
  968. * @num_qmb_int_handled : Number of QMB interrupts handled
  969. */
  970. struct IpaHwStatsWDIRxInfoData_t {
  971. u32 max_outstanding_pkts;
  972. u32 num_pkts_processed;
  973. u32 rx_ring_rp_value;
  974. struct IpaHwRingStats_t rx_ind_ring_stats;
  975. struct IpaHwBamStats_t bam_stats;
  976. u32 num_bam_int_handled;
  977. u32 num_db;
  978. u32 num_unexpected_db;
  979. u32 num_pkts_in_dis_uninit_state;
  980. u32 num_ic_inj_vdev_change;
  981. u32 num_ic_inj_fw_desc_change;
  982. u32 num_qmb_int_handled;
  983. u32 reserved1;
  984. u32 reserved2;
  985. } __packed;
  986. /**
  987. * struct IpaHwStatsWDITxInfoData_t - Structure holding the WDI Tx channel
  988. * structures
  989. *
  990. * @num_pkts_processed : Number of packets processed - cumulative
  991. * @copy_engine_doorbell_value : latest value of doorbell written to copy engine
  992. * @num_db_fired : Number of DB from uC FW to Copy engine
  993. * @tx_comp_ring_stats : ring info
  994. * @bam_stats : BAM info
  995. * @num_db : Number of times the doorbell was rung
  996. * @num_unexpected_db : Number of unexpected doorbells
  997. * @num_bam_int_handled : Number of Bam Interrupts handled by FW
  998. * @num_bam_int_in_non_running_state : Number of Bam interrupts while not in
  999. * Running state
  1000. * @num_qmb_int_handled : Number of QMB interrupts handled
  1001. */
  1002. struct IpaHwStatsWDITxInfoData_t {
  1003. u32 num_pkts_processed;
  1004. u32 copy_engine_doorbell_value;
  1005. u32 num_db_fired;
  1006. struct IpaHwRingStats_t tx_comp_ring_stats;
  1007. struct IpaHwBamStats_t bam_stats;
  1008. u32 num_db;
  1009. u32 num_unexpected_db;
  1010. u32 num_bam_int_handled;
  1011. u32 num_bam_int_in_non_running_state;
  1012. u32 num_qmb_int_handled;
  1013. u32 num_bam_int_handled_while_wait_for_bam;
  1014. } __packed;
  1015. /**
  1016. * struct IpaHwStatsWDIInfoData_t - Structure holding the WDI channel structures
  1017. *
  1018. * @rx_ch_stats : RX stats
  1019. * @tx_ch_stats : TX stats
  1020. */
  1021. struct IpaHwStatsWDIInfoData_t {
  1022. struct IpaHwStatsWDIRxInfoData_t rx_ch_stats;
  1023. struct IpaHwStatsWDITxInfoData_t tx_ch_stats;
  1024. } __packed;
  1025. /**
  1026. * struct ipa_wdi_ul_params - WDI_RX configuration
  1027. * @rdy_ring_base_pa: physical address of the base of the Rx ring (containing
  1028. * Rx buffers)
  1029. * @rdy_ring_size: size of the Rx ring in bytes
  1030. * @rdy_ring_rp_pa: physical address of the location through which IPA uc is
  1031. * reading (WDI-1.0)
  1032. * @rdy_comp_ring_base_pa: physical address of the base of the Rx completion
  1033. * ring (WDI-2.0)
  1034. * @rdy_comp_ring_wp_pa: physical address of the location through which IPA
  1035. * uc is writing (WDI-2.0)
  1036. * @rdy_comp_ring_size: size of the Rx_completion ring in bytes
  1037. * expected to communicate about the Read pointer into the Rx Ring
  1038. */
  1039. struct ipa_wdi_ul_params {
  1040. phys_addr_t rdy_ring_base_pa;
  1041. u32 rdy_ring_size;
  1042. phys_addr_t rdy_ring_rp_pa;
  1043. phys_addr_t rdy_comp_ring_base_pa;
  1044. phys_addr_t rdy_comp_ring_wp_pa;
  1045. u32 rdy_comp_ring_size;
  1046. u32 *rdy_ring_rp_va;
  1047. u32 *rdy_comp_ring_wp_va;
  1048. bool is_txr_rn_db_pcie_addr;
  1049. bool is_evt_rn_db_pcie_addr;
  1050. };
  1051. /**
  1052. * struct ipa_wdi_ul_params_smmu - WDI_RX configuration (with WLAN SMMU)
  1053. * @rdy_ring: SG table describing the Rx ring (containing Rx buffers)
  1054. * @rdy_ring_size: size of the Rx ring in bytes
  1055. * @rdy_ring_rp_pa: physical address of the location through which IPA uc is
  1056. * expected to communicate about the Read pointer into the Rx Ring
  1057. */
  1058. struct ipa_wdi_ul_params_smmu {
  1059. struct sg_table rdy_ring;
  1060. u32 rdy_ring_size;
  1061. phys_addr_t rdy_ring_rp_pa;
  1062. struct sg_table rdy_comp_ring;
  1063. phys_addr_t rdy_comp_ring_wp_pa;
  1064. u32 rdy_comp_ring_size;
  1065. u32 *rdy_ring_rp_va;
  1066. u32 *rdy_comp_ring_wp_va;
  1067. bool is_txr_rn_db_pcie_addr;
  1068. bool is_evt_rn_db_pcie_addr;
  1069. };
  1070. /**
  1071. * struct ipa_wdi_dl_params - WDI_TX configuration
  1072. * @comp_ring_base_pa: physical address of the base of the Tx completion ring
  1073. * @comp_ring_size: size of the Tx completion ring in bytes
  1074. * @ce_ring_base_pa: physical address of the base of the Copy Engine Source
  1075. * Ring
  1076. * @ce_door_bell_pa: physical address of the doorbell that the IPA uC has to
  1077. * write into to trigger the copy engine
  1078. * @ce_ring_size: Copy Engine Ring size in bytes
  1079. * @num_tx_buffers: Number of pkt buffers allocated
  1080. */
  1081. struct ipa_wdi_dl_params {
  1082. phys_addr_t comp_ring_base_pa;
  1083. u32 comp_ring_size;
  1084. phys_addr_t ce_ring_base_pa;
  1085. phys_addr_t ce_door_bell_pa;
  1086. u32 ce_ring_size;
  1087. u32 num_tx_buffers;
  1088. bool is_txr_rn_db_pcie_addr;
  1089. bool is_evt_rn_db_pcie_addr;
  1090. };
  1091. /**
  1092. * struct ipa_wdi_dl_params_smmu - WDI_TX configuration (with WLAN SMMU)
  1093. * @comp_ring: SG table describing the Tx completion ring
  1094. * @comp_ring_size: size of the Tx completion ring in bytes
  1095. * @ce_ring: SG table describing the Copy Engine Source Ring
  1096. * @ce_door_bell_pa: physical address of the doorbell that the IPA uC has to
  1097. * write into to trigger the copy engine
  1098. * @ce_ring_size: Copy Engine Ring size in bytes
  1099. * @num_tx_buffers: Number of pkt buffers allocated
  1100. */
  1101. struct ipa_wdi_dl_params_smmu {
  1102. struct sg_table comp_ring;
  1103. u32 comp_ring_size;
  1104. struct sg_table ce_ring;
  1105. phys_addr_t ce_door_bell_pa;
  1106. u32 ce_ring_size;
  1107. u32 num_tx_buffers;
  1108. bool is_txr_rn_db_pcie_addr;
  1109. bool is_evt_rn_db_pcie_addr;
  1110. };
  1111. /**
  1112. * struct ipa_wdi_in_params - information provided by WDI client
  1113. * @sys: IPA EP configuration info
  1114. * @ul: WDI_RX configuration info
  1115. * @dl: WDI_TX configuration info
  1116. * @ul_smmu: WDI_RX configuration info when WLAN uses SMMU
  1117. * @dl_smmu: WDI_TX configuration info when WLAN uses SMMU
  1118. * @smmu_enabled: true if WLAN uses SMMU
  1119. * @ipa_wdi_meter_notifier_cb: Get WDI stats and quato info
  1120. */
  1121. struct ipa_wdi_in_params {
  1122. struct ipa_sys_connect_params sys;
  1123. union {
  1124. struct ipa_wdi_ul_params ul;
  1125. struct ipa_wdi_dl_params dl;
  1126. struct ipa_wdi_ul_params_smmu ul_smmu;
  1127. struct ipa_wdi_dl_params_smmu dl_smmu;
  1128. } u;
  1129. bool smmu_enabled;
  1130. #ifdef IPA_WAN_MSG_IPv6_ADDR_GW_LEN
  1131. ipa_wdi_meter_notifier_cb wdi_notify;
  1132. #endif
  1133. };
  1134. enum ipa_upstream_type {
  1135. IPA_UPSTEAM_MODEM = 1,
  1136. IPA_UPSTEAM_WLAN,
  1137. IPA_UPSTEAM_MAX
  1138. };
  1139. /**
  1140. * struct ipa_wdi_out_params - information provided to WDI client
  1141. * @uc_door_bell_pa: physical address of IPA uc doorbell
  1142. * @clnt_hdl: opaque handle assigned to client
  1143. */
  1144. struct ipa_wdi_out_params {
  1145. phys_addr_t uc_door_bell_pa;
  1146. u32 clnt_hdl;
  1147. };
  1148. /**
  1149. * struct ipa_wdi_db_params - information provided to retrieve
  1150. * physical address of uC doorbell
  1151. * @client: type of "client" (IPA_CLIENT_WLAN#_PROD/CONS)
  1152. * @uc_door_bell_pa: physical address of IPA uc doorbell
  1153. */
  1154. struct ipa_wdi_db_params {
  1155. enum ipa_client_type client;
  1156. phys_addr_t uc_door_bell_pa;
  1157. };
  1158. /**
  1159. * struct ipa_wdi_uc_ready_params - uC ready CB parameters
  1160. * @is_uC_ready: uC loaded or not
  1161. * @priv : callback cookie
  1162. * @notify: callback
  1163. */
  1164. typedef void (*ipa_uc_ready_cb)(void *priv);
  1165. struct ipa_wdi_uc_ready_params {
  1166. bool is_uC_ready;
  1167. void *priv;
  1168. ipa_uc_ready_cb notify;
  1169. };
  1170. /**
  1171. * struct ipa_wdi_buffer_info - address info of a WLAN allocated buffer
  1172. * @pa: physical address of the buffer
  1173. * @iova: IOVA of the buffer as embedded inside the WDI descriptors
  1174. * @size: size in bytes of the buffer
  1175. * @result: result of map or unmap operations (out param)
  1176. *
  1177. * IPA driver will create/release IOMMU mapping in IPA SMMU from iova->pa
  1178. */
  1179. struct ipa_wdi_buffer_info {
  1180. phys_addr_t pa;
  1181. unsigned long iova;
  1182. size_t size;
  1183. int result;
  1184. };
  1185. /**
  1186. * struct ipa_wdi_bw_info - address info of a WLAN allocated buffer
  1187. * @threshold: throughput wants to be monitored
  1188. * @num: number of threshold entries
  1189. * @stop: true to stop monitoring
  1190. *
  1191. * IPA driver will create/release IOMMU mapping in IPA SMMU from iova->pa
  1192. */
  1193. struct ipa_wdi_bw_info {
  1194. uint64_t threshold[IPA_BW_THRESHOLD_MAX];
  1195. int num;
  1196. bool stop;
  1197. };
  1198. /**
  1199. * struct ipa_wdi_tx_info - sw tx info from WLAN
  1200. * @sta_tx: sw tx stats on sta interface
  1201. * @ap_tx: sw tx stats on ap interface
  1202. *
  1203. * IPA driver will create/release IOMMU mapping in IPA SMMU from iova->pa
  1204. */
  1205. struct ipa_wdi_tx_info {
  1206. uint64_t sta_tx;
  1207. uint64_t ap_tx;
  1208. };
  1209. /**
  1210. * struct ipa_gsi_ep_config - IPA GSI endpoint configurations
  1211. *
  1212. * @ipa_ep_num: IPA EP pipe number
  1213. * @ipa_gsi_chan_num: GSI channel number
  1214. * @ipa_if_tlv: number of IPA_IF TLV
  1215. * @ipa_if_aos: number of IPA_IF AOS
  1216. * @ee: Execution environment
  1217. * @prefetch_mode: Prefetch mode to be used
  1218. * @prefetch_threshold: Prefetch empty level threshold.
  1219. * relevant for smart and free prefetch modes
  1220. */
  1221. struct ipa_gsi_ep_config {
  1222. int ipa_ep_num;
  1223. int ipa_gsi_chan_num;
  1224. int ipa_if_tlv;
  1225. int ipa_if_aos;
  1226. int ee;
  1227. enum gsi_prefetch_mode prefetch_mode;
  1228. uint8_t prefetch_threshold;
  1229. };
  1230. /**
  1231. * struct ipa_smmu_in_params - information provided from client
  1232. * @ipa_smmu_client_type: clinet requesting for the smmu info.
  1233. */
  1234. enum ipa_smmu_client_type {
  1235. IPA_SMMU_WLAN_CLIENT,
  1236. IPA_SMMU_AP_CLIENT,
  1237. IPA_SMMU_WIGIG_CLIENT,
  1238. IPA_SMMU_WLAN1_CLIENT,
  1239. IPA_SMMU_ETH_CLIENT,
  1240. IPA_SMMU_ETH1_CLIENT,
  1241. IPA_SMMU_CLIENT_MAX
  1242. };
  1243. struct ipa_smmu_in_params {
  1244. enum ipa_smmu_client_type smmu_client;
  1245. };
  1246. /**
  1247. * struct ipa_smmu_out_params - information provided to IPA client
  1248. * @smmu_enable: IPA S1 SMMU enable/disable status
  1249. * @shared_cb: is client CB shared (mappings should be done by client only)
  1250. */
  1251. struct ipa_smmu_out_params {
  1252. bool smmu_enable;
  1253. bool shared_cb;
  1254. };
  1255. struct iphdr_rsv {
  1256. struct iphdr ipv4_temp; /* 20 bytes */
  1257. uint32_t rsv1;
  1258. uint32_t rsv2;
  1259. uint32_t rsv3;
  1260. uint32_t rsv4;
  1261. uint32_t rsv5;
  1262. } __packed;
  1263. union ip_hdr_temp {
  1264. struct iphdr_rsv ipv4_rsv; /* 40 bytes */
  1265. struct ipv6hdr ipv6_temp; /* 40 bytes */
  1266. } __packed;
  1267. struct ipa_socksv5_uc_tmpl {
  1268. uint16_t cmd_id;
  1269. uint16_t rsv;
  1270. uint32_t cmd_param;
  1271. uint16_t pkt_count;
  1272. uint16_t rsv2;
  1273. uint32_t byte_count;
  1274. union ip_hdr_temp ip_hdr;
  1275. /* 2B src/dst port */
  1276. uint16_t src_port;
  1277. uint16_t dst_port;
  1278. /* attribute mask */
  1279. uint32_t ipa_sockv5_mask;
  1280. /* reqquired update 4B/4B Seq/Ack/SACK */
  1281. uint32_t out_irs;
  1282. uint32_t out_iss;
  1283. uint32_t in_irs;
  1284. uint32_t in_iss;
  1285. /* option 10B: time-stamp */
  1286. uint32_t out_ircv_tsval;
  1287. uint32_t in_ircv_tsecr;
  1288. uint32_t out_ircv_tsecr;
  1289. uint32_t in_ircv_tsval;
  1290. /* option 2B: window-scaling/dynamic */
  1291. uint16_t in_isnd_wscale:4;
  1292. uint16_t out_isnd_wscale:4;
  1293. uint16_t in_ircv_wscale:4;
  1294. uint16_t out_ircv_wscale:4;
  1295. uint16_t MAX_WINDOW_SIZE;
  1296. /* 11*4 + 40 bytes = 84 bytes */
  1297. uint32_t rsv3;
  1298. uint32_t rsv4;
  1299. uint32_t rsv5;
  1300. uint32_t rsv6;
  1301. uint32_t rsv7;
  1302. uint32_t rsv8;
  1303. uint32_t rsv9;
  1304. } __packed;
  1305. /*reserve 16 bytes : 16 bytes+ 40 bytes + 44 bytes = 100 bytes (28 bytes left)*/
  1306. struct ipa_socksv5_info {
  1307. /* ipa-uc info */
  1308. struct ipa_socksv5_uc_tmpl ul_out;
  1309. struct ipa_socksv5_uc_tmpl dl_out;
  1310. /* ipacm info */
  1311. struct ipacm_socksv5_info ul_in;
  1312. struct ipacm_socksv5_info dl_in;
  1313. /* output: handle (index) */
  1314. uint16_t handle;
  1315. };
  1316. struct ipa_ipv6_nat_uc_tmpl {
  1317. uint16_t cmd_id;
  1318. uint16_t rsv;
  1319. uint32_t cmd_param;
  1320. uint16_t pkt_count;
  1321. uint16_t rsv2;
  1322. uint32_t byte_count;
  1323. uint64_t private_address_lsb;
  1324. uint64_t private_address_msb;
  1325. uint64_t public_address_lsb;
  1326. uint64_t public_address_msb;
  1327. uint16_t private_port;
  1328. uint16_t public_port;
  1329. uint32_t rsv3;
  1330. uint64_t rsv4;
  1331. uint64_t rsv5;
  1332. uint64_t rsv6;
  1333. uint64_t rsv7;
  1334. uint64_t rsv8;
  1335. uint64_t rsv9;
  1336. uint64_t rsv10;
  1337. uint64_t rsv11;
  1338. uint64_t rsv12;
  1339. } __packed;
  1340. #if IS_ENABLED(CONFIG_IPA3)
  1341. /*
  1342. * Configuration
  1343. */
  1344. /**
  1345. * ipa_cfg_ep_ctrl() - IPA end-point Control configuration
  1346. * @clnt_hdl: [in] opaque client handle assigned by IPA to client
  1347. * @ipa_ep_cfg_ctrl: [in] IPA end-point configuration params
  1348. *
  1349. * Returns: 0 on success, negative on failure
  1350. */
  1351. int ipa_cfg_ep_ctrl(u32 clnt_hdl, const struct ipa_ep_cfg_ctrl *ep_ctrl);
  1352. /*
  1353. * Routing
  1354. */
  1355. /**
  1356. * ipa_add_rt_rule() - Add the specified routing rules to SW and optionally
  1357. * commit to IPA HW
  1358. * @rules: [inout] set of routing rules to add
  1359. *
  1360. * Returns: 0 on success, negative on failure
  1361. *
  1362. * Note: Should not be called from atomic context
  1363. */
  1364. int ipa_add_rt_rule(struct ipa_ioc_add_rt_rule *rules);
  1365. /**
  1366. * ipa_put_rt_tbl() - Release the specified routing table handle
  1367. * @rt_tbl_hdl: [in] the routing table handle to release
  1368. *
  1369. * Returns: 0 on success, negative on failure
  1370. *
  1371. * Note: Should not be called from atomic context
  1372. */
  1373. int ipa_put_rt_tbl(u32 rt_tbl_hdl);
  1374. /*
  1375. * Interface
  1376. */
  1377. int ipa_register_intf(const char *name,
  1378. const struct ipa_tx_intf *tx,
  1379. const struct ipa_rx_intf *rx);
  1380. int ipa_deregister_intf(const char *name);
  1381. /*
  1382. * Aggregation
  1383. */
  1384. /**
  1385. * ipa_set_aggr_mode() - Set the aggregation mode which is a global setting
  1386. * @mode: [in] the desired aggregation mode for e.g. straight MBIM, QCNCM,
  1387. * etc
  1388. *
  1389. * Returns: 0 on success
  1390. */
  1391. int ipa_set_aggr_mode(enum ipa_aggr_mode mode);
  1392. /**
  1393. * ipa_set_qcncm_ndp_sig() - Set the NDP signature used for QCNCM aggregation
  1394. * mode
  1395. * @sig: [in] the first 3 bytes of QCNCM NDP signature (expected to be
  1396. * "QND")
  1397. *
  1398. * Set the NDP signature used for QCNCM aggregation mode. The fourth byte
  1399. * (expected to be 'P') needs to be set using the header addition mechanism
  1400. *
  1401. * Returns: 0 on success, negative on failure
  1402. */
  1403. int ipa_set_qcncm_ndp_sig(char sig[3]);
  1404. /**
  1405. * ipa_set_single_ndp_per_mbim() - Enable/disable single NDP per MBIM frame
  1406. * configuration
  1407. * @enable: [in] true for single NDP/MBIM; false otherwise
  1408. *
  1409. * Returns: 0 on success
  1410. */
  1411. int ipa_set_single_ndp_per_mbim(bool enable);
  1412. /*
  1413. * interrupts
  1414. */
  1415. /**
  1416. * ipa_add_interrupt_handler() - Adds handler to an interrupt type
  1417. * @interrupt: Interrupt type
  1418. * @handler: The handler to be added
  1419. * @deferred_flag: whether the handler processing should be deferred in
  1420. * a workqueue
  1421. * @private_data: the client's private data
  1422. *
  1423. * Adds handler to an interrupt type and enable the specific bit
  1424. * in IRQ_EN register, associated interrupt in IRQ_STTS register will be enabled
  1425. */
  1426. int ipa_add_interrupt_handler(enum ipa_irq_type interrupt,
  1427. ipa_irq_handler_t handler,
  1428. bool deferred_flag,
  1429. void *private_data);
  1430. /**
  1431. * ipa_restore_suspend_handler() - restores the original suspend IRQ handler
  1432. * as it was registered in the IPA init sequence.
  1433. * Return codes:
  1434. * 0: success
  1435. * -EPERM: failed to remove current handler or failed to add original handler
  1436. */
  1437. int ipa_restore_suspend_handler(void);
  1438. /*
  1439. * Messaging
  1440. */
  1441. /**
  1442. * ipa_send_msg() - Send "message" from kernel client to IPA driver
  1443. * @metadata: [in] message metadata
  1444. * @buff: [in] the payload for message
  1445. * @callback: [in] free callback
  1446. *
  1447. * Client supplies the message metadata and payload which IPA driver buffers
  1448. * till read by user-space. After read from user space IPA driver invokes the
  1449. * callback supplied to free the message payload. Client must not touch/free
  1450. * the message payload after calling this API.
  1451. *
  1452. * Returns: 0 on success, negative on failure
  1453. *
  1454. * Note: Should not be called from atomic context
  1455. */
  1456. int ipa_send_msg(struct ipa_msg_meta *metadata, void *buff,
  1457. ipa_msg_free_fn callback);
  1458. /*
  1459. * Data path
  1460. */
  1461. /**
  1462. * ipa_tx_dp() - Data-path tx handler
  1463. * @dst: [in] which IPA destination to route tx packets to
  1464. * @skb: [in] the packet to send
  1465. * @metadata: [in] TX packet metadata
  1466. *
  1467. * Data-path tx handler, this is used for both SW data-path which by-passes most
  1468. * IPA HW blocks AND the regular HW data-path for WLAN AMPDU traffic only. If
  1469. * dst is a "valid" CONS type, then SW data-path is used. If dst is the
  1470. * WLAN_AMPDU PROD type, then HW data-path for WLAN AMPDU is used. Anything else
  1471. * is an error. For errors, client needs to free the skb as needed. For success,
  1472. * IPA driver will later invoke client callback if one was supplied. That
  1473. * callback should free the skb. If no callback supplied, IPA driver will free
  1474. * the skb internally
  1475. *
  1476. * The function will use two descriptors for this send command
  1477. * (for A5_WLAN_AMPDU_PROD only one desciprtor will be sent),
  1478. * the first descriptor will be used to inform the IPA hardware that
  1479. * apps need to push data into the IPA (IP_PACKET_INIT immediate command).
  1480. * Once this send was done from SPS point-of-view the IPA driver will
  1481. * get notified by the supplied callback - ipa_sps_irq_tx_comp()
  1482. *
  1483. * ipa_sps_irq_tx_comp will call to the user supplied
  1484. * callback (from ipa_connect)
  1485. *
  1486. * Returns: 0 on success, negative on failure
  1487. */
  1488. int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
  1489. struct ipa_tx_meta *metadata);
  1490. /*
  1491. * ipa_rmnet_ctl_xmit - QMAP Flow control TX
  1492. *
  1493. * @skb - tx QMAP control packet
  1494. *
  1495. * Note: This need to be called after client receive rmnet_ctl_
  1496. * ready_cb and want to send TX flow control message.
  1497. *
  1498. * This funciton will return 0 on success, -EAGAIN if pipe if full.
  1499. */
  1500. int ipa_rmnet_ctl_xmit(struct sk_buff *skb);
  1501. /*
  1502. * ipa_rmnet_ll_xmit - Low lat data Tx
  1503. *
  1504. * @skb - tx low lat data packet
  1505. *
  1506. * Note: This need to be called after client receive rmnet_ll_
  1507. * ready_cb and want to send TX ll data message.
  1508. *
  1509. * This funciton will return 0 on success, -EAGAIN if pipe if full.
  1510. */
  1511. int ipa_rmnet_ll_xmit(struct sk_buff *skb);
  1512. /*
  1513. * ipa_register_notifier - Register for IPA atomic notifier
  1514. *
  1515. * @fn_ptr - Function pointer to get the notification
  1516. *
  1517. * This funciton will return 0 on success, -EAGAIN if reg fails.
  1518. */
  1519. int ipa_register_notifier(void *fn_ptr);
  1520. /*
  1521. * ipa_unregister_notifier - Unregister for IPA atomic notifier
  1522. *
  1523. * @fn_ptr - Same function pointer used to get the notification
  1524. *
  1525. * This funciton will return 0 on success, -EAGAIN if reg fails.
  1526. */
  1527. int ipa_unregister_notifier(void *fn_ptr);
  1528. void ipa_free_skb(struct ipa_rx_data *data);
  1529. /*
  1530. * System pipes
  1531. */
  1532. /**
  1533. * ipa_setup_sys_pipe() - Setup an IPA end-point in system-BAM mode and perform
  1534. * IPA EP configuration
  1535. * @sys_in: [in] input needed to setup BAM pipe and configure EP
  1536. * @clnt_hdl: [out] client handle
  1537. *
  1538. * - configure the end-point registers with the supplied
  1539. * parameters from the user.
  1540. * - call SPS APIs to create a system-to-bam connection with IPA.
  1541. * - allocate descriptor FIFO
  1542. * - register callback function(ipa_sps_irq_rx_notify or
  1543. * ipa_sps_irq_tx_notify - depends on client type) in case the driver is
  1544. * not configured to pulling mode
  1545. *
  1546. * Returns: 0 on success, negative on failure
  1547. */
  1548. int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl);
  1549. /**
  1550. * ipa_teardown_sys_pipe() - Teardown the system-BAM pipe and cleanup IPA EP
  1551. * @clnt_hdl: [in] the handle obtained from ipa_setup_sys_pipe
  1552. *
  1553. * Returns: 0 on success, negative on failure
  1554. */
  1555. int ipa_teardown_sys_pipe(u32 clnt_hdl);
  1556. int ipa_connect_wdi_pipe(struct ipa_wdi_in_params *in,
  1557. struct ipa_wdi_out_params *out);
  1558. int ipa_disconnect_wdi_pipe(u32 clnt_hdl);
  1559. int ipa_enable_wdi_pipe(u32 clnt_hdl);
  1560. int ipa_disable_wdi_pipe(u32 clnt_hdl);
  1561. int ipa_resume_wdi_pipe(u32 clnt_hdl);
  1562. int ipa_suspend_wdi_pipe(u32 clnt_hdl);
  1563. int ipa_reg_uc_rdyCB(struct ipa_wdi_uc_ready_params *param);
  1564. int ipa_dereg_uc_rdyCB(void);
  1565. int ipa_add_hdr(struct ipa_ioc_add_hdr *hdrs);
  1566. int ipa_del_hdr(struct ipa_ioc_del_hdr *hdls);
  1567. int ipa_get_hdr(struct ipa_ioc_get_hdr *lookup);
  1568. /**
  1569. * ipa_get_wdi_stats() - Query WDI statistics from uc
  1570. * @stats: [inout] stats blob from client populated by driver
  1571. *
  1572. * Returns: 0 on success, negative on failure
  1573. *
  1574. * @note Cannot be called from atomic context
  1575. *
  1576. */
  1577. int ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats);
  1578. int ipa_uc_bw_monitor(struct ipa_wdi_bw_info *info);
  1579. /**
  1580. * ipa_broadcast_wdi_quota_reach_ind() - quota reach
  1581. * @uint32_t fid: [in] input netdev ID
  1582. * @uint64_t num_bytes: [in] used bytes
  1583. *
  1584. * Returns: 0 on success, negative on failure
  1585. */
  1586. int ipa_broadcast_wdi_quota_reach_ind(uint32_t fid,
  1587. uint64_t num_bytes);
  1588. /*
  1589. * To retrieve doorbell physical address of
  1590. * wlan pipes
  1591. */
  1592. int ipa_uc_wdi_get_dbpa(struct ipa_wdi_db_params *out);
  1593. /*
  1594. * IPADMA
  1595. */
  1596. /**
  1597. * ipa_dma_init() -Initialize IPADMA.
  1598. *
  1599. * This function initialize all IPADMA internal data and connect in dma:
  1600. * MEMCPY_DMA_SYNC_PROD ->MEMCPY_DMA_SYNC_CONS
  1601. * MEMCPY_DMA_ASYNC_PROD->MEMCPY_DMA_SYNC_CONS
  1602. *
  1603. * Return codes: 0: success
  1604. * -EFAULT: IPADMA is already initialized
  1605. * -ENOMEM: allocating memory error
  1606. * -EPERM: pipe connection failed
  1607. */
  1608. int ipa_dma_init(void);
  1609. /**
  1610. * ipa_dma_enable() -Vote for IPA clocks.
  1611. *
  1612. *Return codes: 0: success
  1613. * -EINVAL: IPADMA is not initialized
  1614. * -EPERM: Operation not permitted as ipa_dma is already
  1615. * enabled
  1616. */
  1617. int ipa_dma_enable(void);
  1618. /**
  1619. * ipa_dma_disable()- Unvote for IPA clocks.
  1620. *
  1621. * enter to power save mode.
  1622. *
  1623. * Return codes: 0: success
  1624. * -EINVAL: IPADMA is not initialized
  1625. * -EPERM: Operation not permitted as ipa_dma is already
  1626. * disabled
  1627. * -EFAULT: can not disable ipa_dma as there are pending
  1628. * memcopy works
  1629. */
  1630. int ipa_dma_disable(void);
  1631. /**
  1632. * ipa_dma_sync_memcpy()- Perform synchronous memcpy using IPA.
  1633. *
  1634. * @dest: physical address to store the copied data.
  1635. * @src: physical address of the source data to copy.
  1636. * @len: number of bytes to copy.
  1637. *
  1638. * Return codes: 0: success
  1639. * -EINVAL: invalid params
  1640. * -EPERM: operation not permitted as ipa_dma isn't enable or
  1641. * initialized
  1642. * -SPS_ERROR: on sps faliures
  1643. * -EFAULT: other
  1644. */
  1645. int ipa_dma_sync_memcpy(u64 dest, u64 src, int len);
  1646. /**
  1647. * ipa_dma_async_memcpy()- Perform asynchronous memcpy using IPA.
  1648. *
  1649. * @dest: physical address to store the copied data.
  1650. * @src: physical address of the source data to copy.
  1651. * @len: number of bytes to copy.
  1652. * @user_cb: callback function to notify the client when the copy was done.
  1653. * @user_param: cookie for user_cb.
  1654. *
  1655. * Return codes: 0: success
  1656. * -EINVAL: invalid params
  1657. * -EPERM: operation not permitted as ipa_dma isn't enable or
  1658. * initialized
  1659. * -SPS_ERROR: on sps faliures
  1660. * -EFAULT: descr fifo is full.
  1661. */
  1662. int ipa_dma_async_memcpy(u64 dest, u64 src, int len,
  1663. void (*user_cb)(void *user1), void *user_param);
  1664. /**
  1665. * ipa_dma_destroy() -teardown IPADMA pipes and release ipadma.
  1666. *
  1667. * this is a blocking function, returns just after destroying IPADMA.
  1668. */
  1669. void ipa_dma_destroy(void);
  1670. /*
  1671. * Miscellaneous
  1672. */
  1673. void ipa_bam_reg_dump(void);
  1674. int ipa_get_ep_mapping(enum ipa_client_type client);
  1675. bool ipa_is_ready(void);
  1676. void ipa_proxy_clk_vote(void);
  1677. void ipa_proxy_clk_unvote(void);
  1678. enum ipa_hw_type ipa_get_hw_type(void);
  1679. const struct ipa_gsi_ep_config *ipa_get_gsi_ep_info(
  1680. enum ipa_client_type client);
  1681. int ipa_stop_gsi_channel(u32 clnt_hdl);
  1682. typedef void (*ipa_ready_cb)(void *user_data);
  1683. typedef void (*ipa_rmnet_ctl_ready_cb)(void *user_data);
  1684. typedef void (*ipa_rmnet_ctl_stop_cb)(void *user_data);
  1685. typedef void (*ipa_rmnet_ctl_rx_notify_cb)(void *user_data, void *rx_data);
  1686. typedef void (*ipa_rmnet_ll_ready_cb)(void *user_data);
  1687. typedef void (*ipa_rmnet_ll_stop_cb)(void *user_data);
  1688. typedef void (*ipa_rmnet_ll_rx_notify_cb)(void *user_data, void *rx_data);
  1689. int ipa_get_default_aggr_time_limit(enum ipa_client_type client,
  1690. u32 *default_aggr_time_limit);
  1691. /**
  1692. * ipa_register_ipa_ready_cb() - register a callback to be invoked
  1693. * when IPA core driver initialization is complete.
  1694. *
  1695. * @ipa_ready_cb: CB to be triggered.
  1696. * @user_data: Data to be sent to the originator of the CB.
  1697. *
  1698. * Note: This function is expected to be utilized when ipa_is_ready
  1699. * function returns false.
  1700. * An IPA client may also use this function directly rather than
  1701. * calling ipa_is_ready beforehand, as if this API returns -EEXIST,
  1702. * this means IPA initialization is complete (and no callback will
  1703. * be triggered).
  1704. * When the callback is triggered, the client MUST perform his
  1705. * operations in a different context.
  1706. *
  1707. * The function will return 0 on success, -ENOMEM on memory issues and
  1708. * -EEXIST if IPA initialization is complete already.
  1709. */
  1710. int ipa_register_ipa_ready_cb(void (*ipa_ready_cb)(void *user_data),
  1711. void *user_data);
  1712. /**
  1713. * ipa_register_rmnet_ctl_cb() - register callbacks to be invoked
  1714. * to rmnet_ctl for qmap flow control pipes setup/teardown/rx_notify.
  1715. *
  1716. * @ipa_rmnet_ctl_ready_cb: CB to be called when pipes setup.
  1717. * @user_data1: user_data for ipa_rmnet_ctl_ready_cb.
  1718. * @ipa_rmnet_ctl_stop_cb: CB to be called when pipes teardown.
  1719. * @user_data2: user_data for ipa_rmnet_ctl_stop_cb.
  1720. * @ipa_rmnet_ctl_rx_notify_cb: CB to be called when receive rx pkts.
  1721. * @user_data3: user_data for ipa_rmnet_ctl_rx_notify_cb.
  1722. * @rx_data: RX data buffer.
  1723. *
  1724. * Note: This function is expected to be utilized for rmnet_ctl
  1725. * module when new qmap flow control is enabled.
  1726. *
  1727. * The function will return 0 on success, -EAGAIN if IPA not ready,
  1728. * -ENXIO is feature is not enabled, -EEXIST if already called.
  1729. */
  1730. int ipa_register_rmnet_ctl_cb(
  1731. void (*ipa_rmnet_ctl_ready_cb)(void *user_data1),
  1732. void *user_data1,
  1733. void (*ipa_rmnet_ctl_stop_cb)(void *user_data2),
  1734. void *user_data2,
  1735. void (*ipa_rmnet_ctl_rx_notify_cb)(void *user_data3, void *rx_data),
  1736. void *user_data3);
  1737. /**
  1738. * ipa_unregister_rmnet_ctl_cb() - unregister callbacks to be
  1739. * invoked to rmnet_ctl for qmap flow control pipes
  1740. * setup/teardown/rx_notify.
  1741. *
  1742. * Note: This function is expected to be utilized for rmnet_ctl
  1743. * module when new qmap flow control is enabled.
  1744. *
  1745. * The function will return 0 on success, -EAGAIN if IPA not ready,
  1746. * -ENXIO is feature is not enabled.
  1747. */
  1748. int ipa_unregister_rmnet_ctl_cb(void);
  1749. /**
  1750. * ipa_register_rmnet_ll_cb() - register callbacks to be invoked
  1751. * to rmnet_ll for low latency data pipes setup/teardown/rx_notify.
  1752. *
  1753. * @ipa_rmnet_ll_ready_cb: CB to be called when pipes setup.
  1754. * @user_data1: user_data for ipa_rmnet_ctl_ready_cb.
  1755. * @ipa_rmnet_ll_stop_cb: CB to be called when pipes teardown.
  1756. * @user_data2: user_data for ipa_rmnet_ctl_stop_cb.
  1757. * @ipa_rmnet_ll_rx_notify_cb: CB to be called when receive rx pkts.
  1758. * @user_data3: user_data for ipa_rmnet_ctl_rx_notify_cb.
  1759. * @rx_data: RX data buffer.
  1760. *
  1761. * Note: This function is expected to be utilized for rmnet_ll
  1762. * module.
  1763. *
  1764. * The function will return 0 on success, -EAGAIN if IPA not ready,
  1765. * -ENXIO is feature is not enabled, -EEXIST if already called.
  1766. */
  1767. int ipa_register_rmnet_ll_cb(
  1768. void (*ipa_rmnet_ll_ready_cb)(void *user_data1),
  1769. void *user_data1,
  1770. void (*ipa_rmnet_ll_stop_cb)(void *user_data2),
  1771. void *user_data2,
  1772. void (*ipa_rmnet_ll_rx_notify_cb)(void *user_data3, void *rx_data),
  1773. void *user_data3);
  1774. /**
  1775. * ipa_unregister_rmnet_ll_cb() - unregister callbacks to be
  1776. * invoked to rmnet_ll for low lat data pipes
  1777. * setup/teardown/rx_notify.
  1778. *
  1779. * Note: This function is expected to be utilized for rmnet_ll
  1780. * module.
  1781. *
  1782. * The function will return 0 on success, -EAGAIN if IPA not ready,
  1783. * -ENXIO is feature is not enabled.
  1784. */
  1785. int ipa_unregister_rmnet_ll_cb(void);
  1786. int ipa_get_smmu_params(struct ipa_smmu_in_params *in,
  1787. struct ipa_smmu_out_params *out);
  1788. /**
  1789. * ipa_is_vlan_mode - check if a LAN driver should load in VLAN mode
  1790. * @iface - type of vlan capable device
  1791. * @res - query result: true for vlan mode, false for non vlan mode
  1792. *
  1793. * API must be called after ipa_is_ready() returns true, otherwise it will fail
  1794. *
  1795. * Returns: 0 on success, negative on failure
  1796. */
  1797. int ipa_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res);
  1798. /**
  1799. * ipa_get_lan_rx_napi - returns true if NAPI is enabled in the LAN RX dp
  1800. */
  1801. bool ipa_get_lan_rx_napi(void);
  1802. /*
  1803. * ipa_add_socksv5_conn - add socksv5 info to ipa driver
  1804. */
  1805. int ipa_add_socksv5_conn(struct ipa_socksv5_info *info);
  1806. /*
  1807. * ipa_del_socksv5_conn - del socksv5 info to ipa driver
  1808. */
  1809. int ipa_del_socksv5_conn(uint32_t handle);
  1810. int ipa_mhi_handle_ipa_config_req(struct ipa_config_req_msg_v01 *config_req);
  1811. int ipa_wigig_save_regs(void);
  1812. #else /* IS_ENABLED(CONFIG_IPA3) */
  1813. /*
  1814. * Configuration
  1815. */
  1816. static inline int ipa_cfg_ep_ctrl(u32 clnt_hdl,
  1817. const struct ipa_ep_cfg_ctrl *ep_ctrl)
  1818. {
  1819. return -EPERM;
  1820. }
  1821. /*
  1822. * Routing
  1823. */
  1824. static inline int ipa_add_rt_rule(struct ipa_ioc_add_rt_rule *rules)
  1825. {
  1826. return -EPERM;
  1827. }
  1828. static inline int ipa_put_rt_tbl(u32 rt_tbl_hdl)
  1829. {
  1830. return -EPERM;
  1831. }
  1832. /*
  1833. * Interface
  1834. */
  1835. static inline int ipa_register_intf(const char *name,
  1836. const struct ipa_tx_intf *tx,
  1837. const struct ipa_rx_intf *rx)
  1838. {
  1839. return -EPERM;
  1840. }
  1841. /*
  1842. * Aggregation
  1843. */
  1844. static inline int ipa_set_aggr_mode(enum ipa_aggr_mode mode)
  1845. {
  1846. return -EPERM;
  1847. }
  1848. static inline int ipa_set_qcncm_ndp_sig(char sig[3])
  1849. {
  1850. return -EPERM;
  1851. }
  1852. static inline int ipa_set_single_ndp_per_mbim(bool enable)
  1853. {
  1854. return -EPERM;
  1855. }
  1856. /*
  1857. * interrupts
  1858. */
  1859. static inline int ipa_add_interrupt_handler(enum ipa_irq_type interrupt,
  1860. ipa_irq_handler_t handler,
  1861. bool deferred_flag,
  1862. void *private_data)
  1863. {
  1864. return -EPERM;
  1865. }
  1866. static inline int ipa_restore_suspend_handler(void)
  1867. {
  1868. return -EPERM;
  1869. }
  1870. /*
  1871. * Messaging
  1872. */
  1873. static inline int ipa_send_msg(struct ipa_msg_meta *metadata, void *buff,
  1874. ipa_msg_free_fn callback)
  1875. {
  1876. return -EPERM;
  1877. }
  1878. /*
  1879. * Data path
  1880. */
  1881. static inline int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
  1882. struct ipa_tx_meta *metadata)
  1883. {
  1884. return -EPERM;
  1885. }
  1886. /*
  1887. * QMAP Flow control TX
  1888. */
  1889. static inline int ipa_rmnet_ctl_xmit(struct sk_buff *skb)
  1890. {
  1891. return -EPERM;
  1892. }
  1893. /*
  1894. * Low Latency data Tx
  1895. */
  1896. static inline int ipa_rmnet_ll_xmit(struct sk_buff *skb)
  1897. {
  1898. return -EPERM;
  1899. }
  1900. /*
  1901. * Yellow water mark notifier register
  1902. */
  1903. static inline int ipa_register_notifier(void *fn_ptr)
  1904. {
  1905. return -EPERM;
  1906. }
  1907. /*
  1908. * Yellow water mark notifier unregister
  1909. */
  1910. static inline int ipa_unregister_notifier(void *fn_ptr)
  1911. {
  1912. return -EPERM;
  1913. }
  1914. static inline void ipa_free_skb(struct ipa_rx_data *rx_in)
  1915. {
  1916. }
  1917. /*
  1918. * System pipes
  1919. */
  1920. static inline int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in,
  1921. u32 *clnt_hdl)
  1922. {
  1923. return -EPERM;
  1924. }
  1925. static inline int ipa_teardown_sys_pipe(u32 clnt_hdl)
  1926. {
  1927. return -EPERM;
  1928. }
  1929. static inline int ipa_connect_wdi_pipe(struct ipa_wdi_in_params *in,
  1930. struct ipa_wdi_out_params *out)
  1931. {
  1932. return -EPERM;
  1933. }
  1934. static inline int ipa_disconnect_wdi_pipe(u32 clnt_hdl)
  1935. {
  1936. return -EPERM;
  1937. }
  1938. static inline int ipa_enable_wdi_pipe(u32 clnt_hdl)
  1939. {
  1940. return -EPERM;
  1941. }
  1942. static inline int ipa_disable_wdi_pipe(u32 clnt_hdl)
  1943. {
  1944. return -EPERM;
  1945. }
  1946. static inline int ipa_resume_wdi_pipe(u32 clnt_hdl)
  1947. {
  1948. return -EPERM;
  1949. }
  1950. static inline int ipa_suspend_wdi_pipe(u32 clnt_hdl)
  1951. {
  1952. return -EPERM;
  1953. }
  1954. static inline int ipa_broadcast_wdi_quota_reach_ind(uint32_t fid,
  1955. uint64_t num_bytes)
  1956. {
  1957. return -EPERM;
  1958. }
  1959. static inline int ipa_uc_wdi_get_dbpa(
  1960. struct ipa_wdi_db_params *out)
  1961. {
  1962. return -EPERM;
  1963. }
  1964. /*
  1965. * IPADMA
  1966. */
  1967. static inline int ipa_dma_init(void)
  1968. {
  1969. return -EPERM;
  1970. }
  1971. static inline int ipa_dma_enable(void)
  1972. {
  1973. return -EPERM;
  1974. }
  1975. static inline int ipa_dma_disable(void)
  1976. {
  1977. return -EPERM;
  1978. }
  1979. static inline int ipa_dma_sync_memcpy(phys_addr_t dest, phys_addr_t src
  1980. , int len)
  1981. {
  1982. return -EPERM;
  1983. }
  1984. static inline int ipa_dma_async_memcpy(phys_addr_t dest, phys_addr_t src
  1985. , int len, void (*user_cb)(void *user1),
  1986. void *user_param)
  1987. {
  1988. return -EPERM;
  1989. }
  1990. static inline void ipa_dma_destroy(void)
  1991. {
  1992. }
  1993. /*
  1994. * Miscellaneous
  1995. */
  1996. static inline int ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats)
  1997. {
  1998. return -EPERM;
  1999. }
  2000. static inline int ipa_uc_bw_monitor(struct ipa_wdi_bw_info *info)
  2001. {
  2002. return -EPERM;
  2003. }
  2004. static inline int ipa_get_ep_mapping(enum ipa_client_type client)
  2005. {
  2006. return -EPERM;
  2007. }
  2008. static inline bool ipa_is_ready(void)
  2009. {
  2010. return false;
  2011. }
  2012. static inline enum ipa_hw_type ipa_get_hw_type(void)
  2013. {
  2014. return IPA_HW_None;
  2015. }
  2016. static inline int ipa_register_ipa_ready_cb(
  2017. void (*ipa_ready_cb)(void *user_data),
  2018. void *user_data)
  2019. {
  2020. return -EPERM;
  2021. }
  2022. static inline int ipa_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res)
  2023. {
  2024. return -EPERM;
  2025. }
  2026. static inline bool ipa_get_lan_rx_napi(void)
  2027. {
  2028. return false;
  2029. }
  2030. static inline int ipa_add_socksv5_conn(struct ipa_socksv5_info *info)
  2031. {
  2032. return -EPERM;
  2033. }
  2034. static inline int ipa_del_socksv5_conn(uint32_t handle)
  2035. {
  2036. return -EPERM;
  2037. }
  2038. static inline const struct ipa_gsi_ep_config *ipa_get_gsi_ep_info(
  2039. enum ipa_client_type client)
  2040. {
  2041. return NULL;
  2042. }
  2043. static inline int ipa_stop_gsi_channel(u32 clnt_hdl)
  2044. {
  2045. return -EPERM;
  2046. }
  2047. static inline int ipa_register_rmnet_ctl_cb(
  2048. void (*ipa_rmnet_ctl_ready_cb)(void *user_data1),
  2049. void *user_data1,
  2050. void (*ipa_rmnet_ctl_stop_cb)(void *user_data2),
  2051. void *user_data2,
  2052. void (*ipa_rmnet_ctl_rx_notify_cb)(void *user_data3, void *rx_data),
  2053. void *user_data3)
  2054. {
  2055. return -EPERM;
  2056. }
  2057. static inline int ipa_unregister_rmnet_ctl_cb(void)
  2058. {
  2059. return -EPERM;
  2060. }
  2061. static inline int ipa3_uc_reg_rdyCB(
  2062. struct ipa_wdi_uc_ready_params *inout)
  2063. {
  2064. return -EPERM;
  2065. }
  2066. static inline int ipa_register_rmnet_ll_cb(
  2067. void (*ipa_rmnet_ll_ready_cb)(void *user_data1),
  2068. void *user_data1,
  2069. void (*ipa_rmnet_ll_stop_cb)(void *user_data2),
  2070. void *user_data2,
  2071. void (*ipa_rmnet_ll_rx_notify_cb)(void *user_data3, void *rx_data),
  2072. void *user_data3)
  2073. {
  2074. return -EPERM;
  2075. }
  2076. static inline int ipa_get_default_aggr_time_limit(enum ipa_client_type client,
  2077. u32 *default_aggr_time_limit)
  2078. {
  2079. return -EPERM;
  2080. }
  2081. static inline int ipa_unregister_rmnet_ll_cb(void)
  2082. {
  2083. return -EPERM;
  2084. }
  2085. #endif /* IS_ENABLED(CONFIG_IPA3) */
  2086. /* stubs - to be removed once dependent drivers remove references */
  2087. static inline int ipa_reset_endpoint(u32 clnt_hdl)
  2088. {
  2089. return -EPERM;
  2090. }
  2091. static inline int ipa_clear_endpoint_delay(u32 clnt_hdl)
  2092. {
  2093. return -EPERM;
  2094. }
  2095. static inline int ipa_commit_hdr(void)
  2096. {
  2097. return -EPERM;
  2098. }
  2099. static inline int ipa_put_hdr(u32 hdr_hdl)
  2100. {
  2101. return -EPERM;
  2102. }
  2103. static inline int ipa_deregister_pull_msg(struct ipa_msg_meta *metadata)
  2104. {
  2105. return -EPERM;
  2106. }
  2107. /*
  2108. * Miscellaneous
  2109. */
  2110. static inline int ipa_rm_delete_resource(
  2111. enum ipa_rm_resource_name resource_name)
  2112. {
  2113. return -EPERM;
  2114. }
  2115. static inline int ipa_rm_deregister(
  2116. enum ipa_rm_resource_name resource_name,
  2117. struct ipa_rm_register_params *reg_params)
  2118. {
  2119. return -EPERM;
  2120. }
  2121. static inline int ipa_rm_set_perf_profile(
  2122. enum ipa_rm_resource_name resource_name,
  2123. struct ipa_rm_perf_profile *profile)
  2124. {
  2125. return -EPERM;
  2126. }
  2127. static inline int ipa_rm_add_dependency(
  2128. enum ipa_rm_resource_name resource_name,
  2129. enum ipa_rm_resource_name depends_on_name)
  2130. {
  2131. return -EPERM;
  2132. }
  2133. static inline int ipa_rm_add_dependency_sync(
  2134. enum ipa_rm_resource_name resource_name,
  2135. enum ipa_rm_resource_name depends_on_name)
  2136. {
  2137. return -EPERM;
  2138. }
  2139. static inline int ipa_rm_delete_dependency(
  2140. enum ipa_rm_resource_name resource_name,
  2141. enum ipa_rm_resource_name depends_on_name)
  2142. {
  2143. return -EPERM;
  2144. }
  2145. static inline int ipa_rm_request_resource(
  2146. enum ipa_rm_resource_name resource_name)
  2147. {
  2148. return -EPERM;
  2149. }
  2150. static inline int ipa_rm_inactivity_timer_init(
  2151. enum ipa_rm_resource_name resource_name,
  2152. unsigned long msecs)
  2153. {
  2154. return -EPERM;
  2155. }
  2156. static inline int ipa_rm_release_resource(
  2157. enum ipa_rm_resource_name resource_name)
  2158. {
  2159. return -EPERM;
  2160. }
  2161. static inline int ipa_rm_notify_completion(enum ipa_rm_event event,
  2162. enum ipa_rm_resource_name resource_name)
  2163. {
  2164. return -EPERM;
  2165. }
  2166. static inline int ipa_rm_inactivity_timer_destroy(
  2167. enum ipa_rm_resource_name resource_name)
  2168. {
  2169. return -EPERM;
  2170. }
  2171. static inline int ipa_rm_inactivity_timer_request_resource(
  2172. enum ipa_rm_resource_name resource_name)
  2173. {
  2174. return -EPERM;
  2175. }
  2176. static inline int ipa_rm_inactivity_timer_release_resource(
  2177. enum ipa_rm_resource_name resource_name)
  2178. {
  2179. return -EPERM;
  2180. }
  2181. static inline enum ipa_rm_resource_name ipa_get_rm_resource_from_ep(
  2182. int pipe_idx)
  2183. {
  2184. return -EPERM;
  2185. }
  2186. static inline bool ipa_is_client_handle_valid(u32 clnt_hdl)
  2187. {
  2188. return false;
  2189. }
  2190. static inline enum ipa_client_type ipa_get_client_mapping(int pipe_idx)
  2191. {
  2192. return -EPERM;
  2193. }
  2194. static inline bool ipa_get_modem_cfg_emb_pipe_flt(void)
  2195. {
  2196. return false;
  2197. }
  2198. static inline enum ipa_transport_type ipa_get_transport_type(void)
  2199. {
  2200. return IPA_TRANSPORT_TYPE_GSI;
  2201. }
  2202. static inline struct device *ipa_get_dma_dev(void)
  2203. {
  2204. return NULL;
  2205. }
  2206. static inline struct iommu_domain *ipa_get_smmu_domain(void)
  2207. {
  2208. return NULL;
  2209. }
  2210. static inline int ipa_disable_apps_wan_cons_deaggr(
  2211. uint32_t agg_size, uint32_t agg_count)
  2212. {
  2213. return -EPERM;
  2214. }
  2215. #endif /* _IPA_H_ */