qdf_nbuf.h 88 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531
  1. /*
  2. * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * DOC: qdf_nbuf_public network buffer API
  20. * This file defines the network buffer abstraction.
  21. */
  22. #ifndef _QDF_NBUF_H
  23. #define _QDF_NBUF_H
  24. #include <qdf_util.h>
  25. #include <qdf_types.h>
  26. #include <qdf_lock.h>
  27. #include <i_qdf_trace.h>
  28. #include <i_qdf_nbuf.h>
  29. #include <qdf_net_types.h>
  30. #define IPA_NBUF_OWNER_ID 0xaa55aa55
  31. #define QDF_NBUF_PKT_TRAC_TYPE_EAPOL 0x02
  32. #define QDF_NBUF_PKT_TRAC_TYPE_DHCP 0x04
  33. #define QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION 0x08
  34. #define QDF_NBUF_PKT_TRAC_TYPE_ARP 0x10
  35. #define QDF_NBUF_PKT_TRAC_TYPE_ICMP 0x20
  36. #define QDF_NBUF_PKT_TRAC_TYPE_ICMPv6 0x40
  37. #define QDF_NBUF_PKT_TRAC_MAX_STRING 12
  38. #define QDF_NBUF_PKT_TRAC_PROTO_STRING 4
  39. #define QDF_NBUF_PKT_ERROR 1
  40. #define QDF_NBUF_TRAC_IPV4_OFFSET 14
  41. #define QDF_NBUF_TRAC_IPV4_HEADER_MASK 0xF
  42. #define QDF_NBUF_TRAC_IPV4_HEADER_SIZE 20
  43. #define QDF_NBUF_TRAC_DHCP_SRV_PORT 67
  44. #define QDF_NBUF_TRAC_DHCP_CLI_PORT 68
  45. #define QDF_NBUF_TRAC_ETH_TYPE_OFFSET 12
  46. #define QDF_NBUF_TRAC_EAPOL_ETH_TYPE 0x888E
  47. #define QDF_NBUF_TRAC_WAPI_ETH_TYPE 0x88b4
  48. #define QDF_NBUF_TRAC_ARP_ETH_TYPE 0x0806
  49. #define QDF_NBUF_PKT_IPV4_DSCP_MASK 0xFC
  50. #define QDF_NBUF_PKT_IPV4_DSCP_SHIFT 0x02
  51. #define QDF_NBUF_TRAC_TDLS_ETH_TYPE 0x890D
  52. #define QDF_NBUF_TRAC_IPV4_ETH_TYPE 0x0800
  53. #define QDF_NBUF_TRAC_IPV6_ETH_TYPE 0x86dd
  54. #define QDF_NBUF_DEST_MAC_OFFSET 0
  55. #define QDF_NBUF_SRC_MAC_OFFSET 6
  56. #define QDF_NBUF_TRAC_IPV4_PROTO_TYPE_OFFSET 23
  57. #define QDF_NBUF_TRAC_IPV4_DEST_ADDR_OFFSET 30
  58. #define QDF_NBUF_TRAC_IPV4_SRC_ADDR_OFFSET 26
  59. #define QDF_NBUF_TRAC_IPV6_PROTO_TYPE_OFFSET 20
  60. #define QDF_NBUF_TRAC_IPV4_ADDR_MCAST_MASK 0xE0000000
  61. #define QDF_NBUF_TRAC_IPV4_ADDR_BCAST_MASK 0xF0000000
  62. #define QDF_NBUF_TRAC_IPV6_DEST_ADDR_OFFSET 38
  63. #define QDF_NBUF_TRAC_IPV6_DEST_ADDR 0xFF00
  64. #define QDF_NBUF_TRAC_IPV6_OFFSET 14
  65. #define QDF_NBUF_TRAC_IPV6_HEADER_SIZE 40
  66. #define QDF_NBUF_TRAC_ICMP_TYPE 1
  67. #define QDF_NBUF_TRAC_TCP_TYPE 6
  68. #define QDF_NBUF_TRAC_TCP_FLAGS_OFFSET (47 - 34)
  69. #define QDF_NBUF_TRAC_TCP_ACK_OFFSET (42 - 34)
  70. #define QDF_NBUF_TRAC_TCP_HEADER_LEN_OFFSET (46 - 34)
  71. #define QDF_NBUF_TRAC_TCP_ACK_MASK 0x10
  72. #define QDF_NBUF_TRAC_TCP_SPORT_OFFSET (34 - 34)
  73. #define QDF_NBUF_TRAC_TCP_DPORT_OFFSET (36 - 34)
  74. #define QDF_NBUF_TRAC_UDP_TYPE 17
  75. #define QDF_NBUF_TRAC_ICMPV6_TYPE 0x3a
  76. #define QDF_NBUF_TRAC_DHCP6_SRV_PORT 547
  77. #define QDF_NBUF_TRAC_DHCP6_CLI_PORT 546
  78. /* EAPOL Related MASK */
  79. #define EAPOL_PACKET_TYPE_OFFSET 15
  80. #define EAPOL_KEY_INFO_OFFSET 19
  81. #define EAPOL_PKT_LEN_OFFSET 16
  82. #define EAPOL_KEY_LEN_OFFSET 21
  83. #define EAPOL_MASK 0x8013
  84. #define EAPOL_M1_BIT_MASK 0x8000
  85. #define EAPOL_M2_BIT_MASK 0x0001
  86. #define EAPOL_M3_BIT_MASK 0x8013
  87. #define EAPOL_M4_BIT_MASK 0x0003
  88. /* ARP Related MASK */
  89. #define QDF_NBUF_PKT_ARP_OPCODE_OFFSET 20
  90. #define QDF_NBUF_PKT_ARPOP_REQ 1
  91. #define QDF_NBUF_PKT_ARPOP_REPLY 2
  92. #define QDF_NBUF_PKT_ARP_SRC_IP_OFFSET 28
  93. #define QDF_NBUF_PKT_ARP_TGT_IP_OFFSET 38
  94. /* ICMPv4 Related MASK */
  95. #define QDF_NBUF_PKT_ICMPv4_OPCODE_OFFSET 34
  96. #define QDF_NBUF_PKT_ICMPv4OP_REQ 0x08
  97. #define QDF_NBUF_PKT_ICMPv4OP_REPLY 0x00
  98. #define QDF_NBUF_PKT_ICMPv4_SRC_IP_OFFSET 26
  99. #define QDF_NBUF_PKT_ICMPv4_TGT_IP_OFFSET 30
  100. /* TCP Related MASK */
  101. #define QDF_NBUF_PKT_TCP_OPCODE_OFFSET 47
  102. #define QDF_NBUF_PKT_TCPOP_SYN 0x02
  103. #define QDF_NBUF_PKT_TCPOP_SYN_ACK 0x12
  104. #define QDF_NBUF_PKT_TCPOP_ACK 0x10
  105. #define QDF_NBUF_PKT_TCP_SRC_PORT_OFFSET 34
  106. #define QDF_NBUF_PKT_TCP_DST_PORT_OFFSET 36
  107. /* DNS Related MASK */
  108. #define QDF_NBUF_PKT_DNS_OVER_UDP_OPCODE_OFFSET 44
  109. #define QDF_NBUF_PKT_DNSOP_BITMAP 0xF800
  110. #define QDF_NBUF_PKT_DNSOP_STANDARD_QUERY 0x0000
  111. #define QDF_NBUF_PKT_DNSOP_STANDARD_RESPONSE 0x8000
  112. #define QDF_NBUF_PKT_DNS_SRC_PORT_OFFSET 34
  113. #define QDF_NBUF_PKT_DNS_DST_PORT_OFFSET 36
  114. #define QDF_NBUF_PKT_DNS_NAME_OVER_UDP_OFFSET 54
  115. #define QDF_NBUF_PKT_DNS_STANDARD_PORT 53
  116. /* Tracked Packet types */
  117. #define QDF_NBUF_TX_PKT_INVALID 0
  118. #define QDF_NBUF_TX_PKT_DATA_TRACK 1
  119. #define QDF_NBUF_TX_PKT_MGMT_TRACK 2
  120. #define QDF_NBUF_RX_PKT_DATA_TRACK 3
  121. /* Different Packet states */
  122. #define QDF_NBUF_TX_PKT_HDD 1
  123. #define QDF_NBUF_TX_PKT_TXRX_ENQUEUE 2
  124. #define QDF_NBUF_TX_PKT_TXRX_DEQUEUE 3
  125. #define QDF_NBUF_TX_PKT_TXRX 4
  126. #define QDF_NBUF_TX_PKT_HTT 5
  127. #define QDF_NBUF_TX_PKT_HTC 6
  128. #define QDF_NBUF_TX_PKT_HIF 7
  129. #define QDF_NBUF_TX_PKT_CE 8
  130. #define QDF_NBUF_TX_PKT_FREE 9
  131. #define QDF_NBUF_TX_PKT_STATE_MAX 10
  132. #define QDF_NBUF_TX_PKT_LI_DP 11
  133. /* qdf_nbuf allocate and map max retry threshold when failed */
  134. #define QDF_NBUF_ALLOC_MAP_RETRY_THRESHOLD 20
  135. /* Enable flag to print TSO specific prints in datapath */
  136. #ifdef TSO_DEBUG_LOG_ENABLE
  137. #define TSO_DEBUG(fmt, args ...) \
  138. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_NONE, \
  139. fmt, ## args)
  140. #else
  141. #define TSO_DEBUG(fmt, args ...)
  142. #endif
  143. #define IEEE80211_AMPDU_FLAG 0x01
  144. #ifdef GET_MSDU_AGGREGATION
  145. #define IEEE80211_AMSDU_FLAG 0x02
  146. #endif
  147. #define MAX_CHAIN 8
  148. #define QDF_MON_STATUS_MPDU_FCS_BMAP_NWORDS 8
  149. /**
  150. * struct mon_rx_status - This will have monitor mode rx_status extracted from
  151. * htt_rx_desc used later to update radiotap information.
  152. * @tsft: Time Synchronization Function timer
  153. * @ppdu_timestamp: Timestamp in the PPDU_START TLV
  154. * @preamble_type: Preamble type in radio header
  155. * @chan_freq: Capture channel frequency
  156. * @chan_num: Capture channel number
  157. * @chan_flags: Bitmap of Channel flags, IEEE80211_CHAN_TURBO,
  158. * IEEE80211_CHAN_CCK...
  159. * @ht_flags: HT flags, only present for HT frames.
  160. * @vht_flags: VHT flags, only present for VHT frames.
  161. * @vht_flag_values1-5: Contains corresponding data for flags field
  162. * @he_flags: HE (11ax) flags, only present in HE frames
  163. * @he_mu_flags: HE-MU (11ax) flags, only present in HE frames
  164. * @he_mu_other_flags: HE-MU-OTHER (11ax) flags, only present in HE frames
  165. * @he_sig_A1_known: HE (11ax) sig A1 known field
  166. * @he_sig_A2_known: HE (11ax) sig A2 known field
  167. * @he_sig_b_common: HE (11ax) sig B common field
  168. * @he_sig_b_common_known: HE (11ax) sig B common known field
  169. * @l_sig_a_info: L_SIG_A value coming in Rx descriptor
  170. * @l_sig_b_info: L_SIG_B value coming in Rx descriptor
  171. * @rate: Rate in terms 500Kbps
  172. * @rtap_flags: Bit map of available fields in the radiotap
  173. * @ant_signal_db: Rx packet RSSI
  174. * @nr_ant: Number of Antennas used for streaming
  175. * @mcs: MCS index of Rx frame
  176. * @ht_mcs: MCS index for HT RX frames
  177. * @nss: Number of spatial streams
  178. * @bw: bandwidth of rx frame
  179. * @is_stbc: Is STBC enabled
  180. * @sgi: Rx frame short guard interval
  181. * @he_re: HE range extension
  182. * @ldpc: ldpc enabled
  183. * @beamformed: Is frame beamformed.
  184. * @he_sig_b_common_RU[4]: HE (11ax) common RU assignment index
  185. * @rssi_comb: Combined RSSI
  186. * @rssi[MAX_CHAIN]: 8 bits RSSI per 20Mhz per chain
  187. * @duration: 802.11 Duration
  188. * @frame_control_info_valid: field indicates if fc value is valid
  189. * @frame_control: frame control field
  190. * @ast_index: AST table hash index
  191. * @tid: QoS traffic tid number
  192. * @rs_fcs_err: FCS error flag
  193. * @rs_flags: Flags to indicate AMPDU or AMSDU aggregation
  194. * @cck_flag: Flag to indicate CCK modulation
  195. * @ofdm_flag: Flag to indicate OFDM modulation
  196. * @ulofdma_flag: Flag to indicate UL OFDMA PPDU
  197. * @he_per_user_1: HE per user info1
  198. * @he_per_user_2: HE per user info2
  199. * @he_per_user_position: HE per user position info
  200. * @he_per_user_known: HE per user known info
  201. * @he_flags1: HE flags
  202. * @he_flags2: HE flags
  203. * @he_RU[4]: HE RU assignment index
  204. * @he_data1: HE property of received frame
  205. * @he_data2: HE property of received frame
  206. * @he_data3: HE property of received frame
  207. * @he_data4: HE property of received frame
  208. * @he_data5: HE property of received frame
  209. * @prev_ppdu_id: ppdu_id in previously received message
  210. * @ppdu_id: Id of the PLCP protocol data unit
  211. *
  212. * The following variables are not coming from the TLVs.
  213. * These variables are placeholders for passing information to update_radiotap
  214. * function.
  215. * @device_id: Device ID coming from sub-system (PCI, AHB etc..)
  216. * @chan_noise_floor: Channel Noise Floor for the pdev
  217. * @data_sequence_control_info_valid: field to indicate validity of seq control
  218. * @first_data_seq_ctrl: Sequence ctrl field of first data frame
  219. * @rxpcu_filter_pass: Flag which indicates whether RX packets are received in
  220. * BSS mode(not in promisc mode)
  221. * @rssi_chain: Rssi chain per nss per bw
  222. */
  223. struct mon_rx_status {
  224. uint64_t tsft;
  225. uint32_t ppdu_timestamp;
  226. uint32_t preamble_type;
  227. uint16_t chan_freq;
  228. uint16_t chan_num;
  229. uint16_t chan_flags;
  230. uint16_t ht_flags;
  231. uint16_t vht_flags;
  232. uint16_t vht_flag_values6;
  233. uint16_t he_flags;
  234. uint16_t he_mu_flags;
  235. uint16_t he_mu_other_flags;
  236. uint16_t he_sig_A1_known;
  237. uint16_t he_sig_A2_known;
  238. uint16_t he_sig_b_common;
  239. uint16_t he_sig_b_common_known;
  240. uint32_t l_sig_a_info;
  241. uint32_t l_sig_b_info;
  242. uint8_t rate;
  243. uint8_t rtap_flags;
  244. uint8_t ant_signal_db;
  245. uint8_t nr_ant;
  246. uint8_t mcs;
  247. uint8_t ht_mcs;
  248. uint8_t nss;
  249. uint16_t tcp_msdu_count;
  250. uint16_t udp_msdu_count;
  251. uint16_t other_msdu_count;
  252. uint8_t bw;
  253. uint8_t vht_flag_values1;
  254. uint8_t vht_flag_values2;
  255. uint8_t vht_flag_values3[4];
  256. uint8_t vht_flag_values4;
  257. uint8_t vht_flag_values5;
  258. uint8_t is_stbc;
  259. uint8_t sgi;
  260. uint8_t he_re;
  261. uint8_t ldpc;
  262. uint8_t beamformed;
  263. uint8_t he_sig_b_common_RU[4];
  264. int8_t rssi_comb;
  265. uint64_t rssi[MAX_CHAIN];
  266. uint8_t reception_type;
  267. uint16_t duration;
  268. uint8_t frame_control_info_valid;
  269. uint16_t frame_control;
  270. uint32_t ast_index;
  271. uint32_t tid;
  272. uint8_t rs_fcs_err;
  273. uint8_t rs_flags;
  274. uint8_t cck_flag;
  275. uint8_t ofdm_flag;
  276. uint8_t ulofdma_flag;
  277. /* New HE radiotap fields */
  278. uint16_t he_per_user_1;
  279. uint16_t he_per_user_2;
  280. uint8_t he_per_user_position;
  281. uint8_t he_per_user_known;
  282. uint16_t he_flags1;
  283. uint16_t he_flags2;
  284. uint8_t he_RU[4];
  285. uint16_t he_data1;
  286. uint16_t he_data2;
  287. uint16_t he_data3;
  288. uint16_t he_data4;
  289. uint16_t he_data5;
  290. uint16_t he_data6;
  291. uint32_t ppdu_len;
  292. uint32_t prev_ppdu_id;
  293. uint32_t ppdu_id;
  294. uint32_t device_id;
  295. int16_t chan_noise_floor;
  296. uint8_t monitor_direct_used;
  297. uint8_t data_sequence_control_info_valid;
  298. uint16_t first_data_seq_ctrl;
  299. uint8_t ltf_size;
  300. uint8_t rxpcu_filter_pass;
  301. int8_t rssi_chain[8][8];
  302. uint32_t rx_antenna;
  303. };
  304. /**
  305. * struct mon_rx_user_status - This will have monitor mode per user rx_status
  306. * extracted from hardware TLV.
  307. * @mcs: MCS index of Rx frame
  308. * @nss: Number of spatial streams
  309. * @ofdma_info_valid: OFDMA info below is valid
  310. * @dl_ofdma_ru_start_index: OFDMA RU start index
  311. * @dl_ofdma_ru_width: OFDMA total RU width
  312. * @ast_index: AST table hash index
  313. * @tid: QoS traffic tid number
  314. * @tcp_msdu_count: tcp protocol msdu count
  315. * @udp_msdu_count: udp protocol msdu count
  316. * @other_msdu_count: other protocol msdu count
  317. * @frame_control: frame control field
  318. * @frame_control_info_valid: field indicates if fc value is valid
  319. * @data_sequence_control_info_valid: field to indicate validity of seq control
  320. * @first_data_seq_ctrl: Sequence ctrl field of first data frame
  321. * @preamble_type: Preamble type in radio header
  322. * @ht_flags: HT flags, only present for HT frames.
  323. * @vht_flags: VHT flags, only present for VHT frames.
  324. * @he_flags: HE (11ax) flags, only present in HE frames
  325. * @rtap_flags: Bit map of available fields in the radiotap
  326. * @rs_flags: Flags to indicate AMPDU or AMSDU aggregation
  327. * @mpdu_cnt_fcs_ok: mpdu count received with fcs ok
  328. * @mpdu_cnt_fcs_err: mpdu count received with fcs ok bitmap
  329. * @mpdu_fcs_ok_bitmap: mpdu with fcs ok bitmap
  330. * @mpdu_ok_byte_count: mpdu byte count with fcs ok
  331. * @mpdu_err_byte_count: mpdu byte count with fcs err
  332. */
  333. struct mon_rx_user_status {
  334. uint32_t mcs:4,
  335. nss:3,
  336. ofdma_info_valid:1,
  337. dl_ofdma_ru_start_index:7,
  338. dl_ofdma_ru_width:7,
  339. dl_ofdma_ru_size:8;
  340. uint32_t ul_ofdma_user_v0_word0;
  341. uint32_t ul_ofdma_user_v0_word1;
  342. uint32_t ast_index;
  343. uint32_t tid;
  344. uint16_t tcp_msdu_count;
  345. uint16_t udp_msdu_count;
  346. uint16_t other_msdu_count;
  347. uint16_t frame_control;
  348. uint8_t frame_control_info_valid;
  349. uint8_t data_sequence_control_info_valid;
  350. uint16_t first_data_seq_ctrl;
  351. uint32_t preamble_type;
  352. uint16_t ht_flags;
  353. uint16_t vht_flags;
  354. uint16_t he_flags;
  355. uint8_t rtap_flags;
  356. uint8_t rs_flags;
  357. uint32_t mpdu_cnt_fcs_ok;
  358. uint32_t mpdu_cnt_fcs_err;
  359. uint32_t mpdu_fcs_ok_bitmap[QDF_MON_STATUS_MPDU_FCS_BMAP_NWORDS];
  360. uint32_t mpdu_ok_byte_count;
  361. uint32_t mpdu_err_byte_count;
  362. };
  363. /**
  364. * struct qdf_radiotap_vendor_ns - Vendor Namespace header as per
  365. * Radiotap spec: https://www.radiotap.org/fields/Vendor%20Namespace.html
  366. * @oui: Vendor OUI
  367. * @selector: sub_namespace selector
  368. * @skip_length: How many bytes of Vendor Namespace data that follows
  369. */
  370. struct qdf_radiotap_vendor_ns {
  371. uint8_t oui[3];
  372. uint8_t selector;
  373. uint16_t skip_length;
  374. } __attribute__((__packed__));
  375. /**
  376. * strcut qdf_radiotap_vendor_ns_ath - Combined QTI Vendor NS
  377. * including the Radiotap specified Vendor Namespace header and
  378. * QTI specific Vendor Namespace data
  379. * @lsig: L_SIG_A (or L_SIG)
  380. * @device_id: Device Identification
  381. * @lsig_b: L_SIG_B
  382. * @ppdu_start_timestamp: Timestamp from RX_PPDU_START TLV
  383. */
  384. struct qdf_radiotap_vendor_ns_ath {
  385. struct qdf_radiotap_vendor_ns hdr;
  386. /* QTI specific data follows */
  387. uint32_t lsig;
  388. uint32_t device_id;
  389. uint32_t lsig_b;
  390. uint32_t ppdu_start_timestamp;
  391. } __attribute__((__packed__));
  392. /* Masks for HE SIG known fields in mon_rx_status structure */
  393. #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU0 0x00000001
  394. #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU1 0x00000002
  395. #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU2 0x00000004
  396. #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU3 0x00000008
  397. #define QDF_MON_STATUS_HE_SIG_B_USER_KNOWN_SIG_B_ALL 0x00fe0000
  398. #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_SU 0x00000000
  399. #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_EXT_SU 0x40000000
  400. #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_TRIG 0xc0000000
  401. /* DHCP Related Mask */
  402. #define QDF_DHCP_OPTION53 (0x35)
  403. #define QDF_DHCP_OPTION53_LENGTH (1)
  404. #define QDF_DHCP_OPTION53_OFFSET (0x11A)
  405. #define QDF_DHCP_OPTION53_LENGTH_OFFSET (0x11B)
  406. #define QDF_DHCP_OPTION53_STATUS_OFFSET (0x11C)
  407. #define DHCP_PKT_LEN_OFFSET 16
  408. #define DHCP_TRANSACTION_ID_OFFSET 46
  409. #define QDF_DHCP_DISCOVER (1)
  410. #define QDF_DHCP_OFFER (2)
  411. #define QDF_DHCP_REQUEST (3)
  412. #define QDF_DHCP_DECLINE (4)
  413. #define QDF_DHCP_ACK (5)
  414. #define QDF_DHCP_NAK (6)
  415. #define QDF_DHCP_RELEASE (7)
  416. #define QDF_DHCP_INFORM (8)
  417. /* ARP Related Mask */
  418. #define ARP_SUB_TYPE_OFFSET 20
  419. #define ARP_REQUEST (1)
  420. #define ARP_RESPONSE (2)
  421. /* IPV4 header fields offset values */
  422. #define IPV4_PKT_LEN_OFFSET 16
  423. #define IPV4_TCP_SEQ_NUM_OFFSET 38
  424. #define IPV4_SRC_ADDR_OFFSET 26
  425. #define IPV4_DST_ADDR_OFFSET 30
  426. #define IPV4_SRC_PORT_OFFSET 34
  427. #define IPV4_DST_PORT_OFFSET 36
  428. /* IPV4 ICMP Related Mask */
  429. #define ICMP_SEQ_NUM_OFFSET 40
  430. #define ICMP_SUBTYPE_OFFSET 34
  431. #define ICMP_REQUEST 0x08
  432. #define ICMP_RESPONSE 0x00
  433. #define IPV6_ADDR_STR "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:"\
  434. "%02x%02x:%02x%02x"
  435. /* IPV6 header fields offset values */
  436. #define IPV6_PKT_LEN_OFFSET 18
  437. #define IPV6_TCP_SEQ_NUM_OFFSET 58
  438. #define IPV6_SRC_ADDR_OFFSET 22
  439. #define IPV6_DST_ADDR_OFFSET 38
  440. #define IPV6_SRC_PORT_OFFSET 54
  441. #define IPV6_DST_PORT_OFFSET 56
  442. /* IPV6 ICMPV6 Related Mask */
  443. #define ICMPV6_SEQ_NUM_OFFSET 60
  444. #define ICMPV6_SUBTYPE_OFFSET 54
  445. #define ICMPV6_REQUEST 0x80
  446. #define ICMPV6_RESPONSE 0x81
  447. #define ICMPV6_RS 0x85
  448. #define ICMPV6_RA 0x86
  449. #define ICMPV6_NS 0x87
  450. #define ICMPV6_NA 0x88
  451. #define QDF_NBUF_IPA_CHECK_MASK 0x80000000
  452. /* HE Radiotap data1 Mask */
  453. #define QDF_MON_STATUS_HE_SU_FORMAT_TYPE 0x0000
  454. #define QDF_MON_STATUS_HE_EXT_SU_FORMAT_TYPE 0x0001
  455. #define QDF_MON_STATUS_HE_MU_FORMAT_TYPE 0x0002
  456. #define QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE 0x0003
  457. #define QDF_MON_STATUS_HE_BEAM_CHANGE_KNOWN 0x0008
  458. #define QDF_MON_STATUS_HE_DL_UL_KNOWN 0x0010
  459. #define QDF_MON_STATUS_HE_MCS_KNOWN 0x0020
  460. #define QDF_MON_STATUS_HE_DCM_KNOWN 0x0040
  461. #define QDF_MON_STATUS_HE_CODING_KNOWN 0x0080
  462. #define QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN 0x0100
  463. #define QDF_MON_STATUS_HE_STBC_KNOWN 0x0200
  464. #define QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN 0x4000
  465. #define QDF_MON_STATUS_HE_DOPPLER_KNOWN 0x8000
  466. #define QDF_MON_STATUS_HE_BSS_COLOR_KNOWN 0x0004
  467. /* HE Radiotap data2 Mask */
  468. #define QDF_MON_STATUS_HE_GI_KNOWN 0x0002
  469. #define QDF_MON_STATUS_TXBF_KNOWN 0x0010
  470. #define QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN 0x0020
  471. #define QDF_MON_STATUS_TXOP_KNOWN 0x0040
  472. #define QDF_MON_STATUS_LTF_SYMBOLS_KNOWN 0x0004
  473. #define QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN 0x0008
  474. #define QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN 0x0080
  475. /* HE radiotap data3 shift values */
  476. #define QDF_MON_STATUS_BEAM_CHANGE_SHIFT 6
  477. #define QDF_MON_STATUS_DL_UL_SHIFT 7
  478. #define QDF_MON_STATUS_TRANSMIT_MCS_SHIFT 8
  479. #define QDF_MON_STATUS_DCM_SHIFT 12
  480. #define QDF_MON_STATUS_CODING_SHIFT 13
  481. #define QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT 14
  482. #define QDF_MON_STATUS_STBC_SHIFT 15
  483. /* HE radiotap data4 shift values */
  484. #define QDF_MON_STATUS_STA_ID_SHIFT 4
  485. /* HE radiotap data5 */
  486. #define QDF_MON_STATUS_GI_SHIFT 4
  487. #define QDF_MON_STATUS_HE_LTF_SIZE_SHIFT 6
  488. #define QDF_MON_STATUS_HE_LTF_SYM_SHIFT 8
  489. #define QDF_MON_STATUS_TXBF_SHIFT 14
  490. #define QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT 15
  491. #define QDF_MON_STATUS_PRE_FEC_PAD_SHIFT 12
  492. /* HE radiotap data6 */
  493. #define QDF_MON_STATUS_DOPPLER_SHIFT 4
  494. #define QDF_MON_STATUS_TXOP_SHIFT 8
  495. /* HE radiotap HE-MU flags1 */
  496. #define QDF_MON_STATUS_SIG_B_MCS_KNOWN 0x0010
  497. #define QDF_MON_STATUS_SIG_B_DCM_KNOWN 0x0040
  498. #define QDF_MON_STATUS_SIG_B_SYM_NUM_KNOWN 0x8000
  499. #define QDF_MON_STATUS_RU_0_KNOWN 0x0100
  500. #define QDF_MON_STATUS_RU_1_KNOWN 0x0200
  501. #define QDF_MON_STATUS_RU_2_KNOWN 0x0400
  502. #define QDF_MON_STATUS_RU_3_KNOWN 0x0800
  503. #define QDF_MON_STATUS_DCM_FLAG_1_SHIFT 5
  504. #define QDF_MON_STATUS_SPATIAL_REUSE_MU_KNOWN 0x0100
  505. #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_1_KNOWN 0x4000
  506. /* HE radiotap HE-MU flags2 */
  507. #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT 3
  508. #define QDF_MON_STATUS_BW_KNOWN 0x0004
  509. #define QDF_MON_STATUS_NUM_SIG_B_SYMBOLS_SHIFT 4
  510. #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_KNOWN 0x0100
  511. #define QDF_MON_STATUS_NUM_SIG_B_FLAG_2_SHIFT 9
  512. #define QDF_MON_STATUS_LTF_FLAG_2_SYMBOLS_SHIFT 12
  513. #define QDF_MON_STATUS_LTF_KNOWN 0x8000
  514. /* HE radiotap per_user_1 */
  515. #define QDF_MON_STATUS_STA_SPATIAL_SHIFT 11
  516. #define QDF_MON_STATUS_TXBF_SHIFT 14
  517. #define QDF_MON_STATUS_RESERVED_SET_TO_1_SHIFT 19
  518. #define QDF_MON_STATUS_STA_CODING_SHIFT 20
  519. /* HE radiotap per_user_2 */
  520. #define QDF_MON_STATUS_STA_MCS_SHIFT 4
  521. #define QDF_MON_STATUS_STA_DCM_SHIFT 5
  522. /* HE radiotap per user known */
  523. #define QDF_MON_STATUS_USER_FIELD_POSITION_KNOWN 0x01
  524. #define QDF_MON_STATUS_STA_ID_PER_USER_KNOWN 0x02
  525. #define QDF_MON_STATUS_STA_NSTS_KNOWN 0x04
  526. #define QDF_MON_STATUS_STA_TX_BF_KNOWN 0x08
  527. #define QDF_MON_STATUS_STA_SPATIAL_CONFIG_KNOWN 0x10
  528. #define QDF_MON_STATUS_STA_MCS_KNOWN 0x20
  529. #define QDF_MON_STATUS_STA_DCM_KNOWN 0x40
  530. #define QDF_MON_STATUS_STA_CODING_KNOWN 0x80
  531. /**
  532. * qdf_proto_type - protocol type
  533. * @QDF_PROTO_TYPE_DHCP - DHCP
  534. * @QDF_PROTO_TYPE_EAPOL - EAPOL
  535. * @QDF_PROTO_TYPE_ARP - ARP
  536. * @QDF_PROTO_TYPE_MGMT - MGMT
  537. * @QDF_PROTO_TYPE_ICMP - ICMP
  538. * @QDF_PROTO_TYPE_ICMPv6 - ICMPv6
  539. * QDF_PROTO_TYPE_EVENT - EVENT
  540. */
  541. enum qdf_proto_type {
  542. QDF_PROTO_TYPE_DHCP,
  543. QDF_PROTO_TYPE_EAPOL,
  544. QDF_PROTO_TYPE_ARP,
  545. QDF_PROTO_TYPE_MGMT,
  546. QDF_PROTO_TYPE_ICMP,
  547. QDF_PROTO_TYPE_ICMPv6,
  548. QDF_PROTO_TYPE_EVENT,
  549. QDF_PROTO_TYPE_MAX
  550. };
  551. /**
  552. * qdf_reception_type - reception type used by lithium phy TLV
  553. * @QDF_RECEPTION_TYPE_ULOFMDA - UL OFDMA
  554. * @QDF_RECEPTION_TYPE_ULMIMO - UL MIMO
  555. * @QQDF_RECEPTION_TYPE_FRAMELESS - Frame less
  556. * @QDF_RECEPTION_TYPE_OTHER - All the other types
  557. */
  558. enum qdf_reception_type {
  559. QDF_RECEPTION_TYPE_ULOFMDA,
  560. QDF_RECEPTION_TYPE_ULMIMO,
  561. QDF_RECEPTION_TYPE_OTHER,
  562. QDF_RECEPTION_TYPE_FRAMELESS
  563. };
  564. /**
  565. * cb_ftype - Frame type information in skb cb
  566. * @CB_FTYPE_INVALID - Invalid
  567. * @CB_FTYPE_MCAST2UCAST - Multicast to Unicast converted packet
  568. * @CB_FTYPE_TSO - TCP Segmentation Offload
  569. * @CB_FTYPE_TSO_SG - TSO Scatter Gather
  570. * @CB_FTYPE_SG - Scatter Gather
  571. * @CB_FTYPE_INTRABSS_FWD - Intra BSS forwarding
  572. * @CB_FTYPE_RX_INFO - Rx information
  573. * @CB_FTYPE_MESH_RX_INFO - Mesh Rx information
  574. * @CB_FTYPE_MESH_TX_INFO - Mesh Tx information
  575. * @CB_FTYPE_DMS - Directed Multicast Service
  576. */
  577. enum cb_ftype {
  578. CB_FTYPE_INVALID = 0,
  579. CB_FTYPE_MCAST2UCAST = 1,
  580. CB_FTYPE_TSO = 2,
  581. CB_FTYPE_TSO_SG = 3,
  582. CB_FTYPE_SG = 4,
  583. CB_FTYPE_INTRABSS_FWD = 5,
  584. CB_FTYPE_RX_INFO = 6,
  585. CB_FTYPE_MESH_RX_INFO = 7,
  586. CB_FTYPE_MESH_TX_INFO = 8,
  587. CB_FTYPE_DMS = 9,
  588. };
  589. /**
  590. * qdf_proto_subtype - subtype of packet
  591. * @QDF_PROTO_EAPOL_M1 - EAPOL 1/4
  592. * @QDF_PROTO_EAPOL_M2 - EAPOL 2/4
  593. * @QDF_PROTO_EAPOL_M3 - EAPOL 3/4
  594. * @QDF_PROTO_EAPOL_M4 - EAPOL 4/4
  595. * @QDF_PROTO_DHCP_DISCOVER - discover
  596. * @QDF_PROTO_DHCP_REQUEST - request
  597. * @QDF_PROTO_DHCP_OFFER - offer
  598. * @QDF_PROTO_DHCP_ACK - ACK
  599. * @QDF_PROTO_DHCP_NACK - NACK
  600. * @QDF_PROTO_DHCP_RELEASE - release
  601. * @QDF_PROTO_DHCP_INFORM - inform
  602. * @QDF_PROTO_DHCP_DECLINE - decline
  603. * @QDF_PROTO_ARP_REQ - arp request
  604. * @QDF_PROTO_ARP_RES - arp response
  605. * @QDF_PROTO_ICMP_REQ - icmp request
  606. * @QDF_PROTO_ICMP_RES - icmp response
  607. * @QDF_PROTO_ICMPV6_REQ - icmpv6 request
  608. * @QDF_PROTO_ICMPV6_RES - icmpv6 response
  609. * @QDF_PROTO_ICMPV6_RS - icmpv6 rs packet
  610. * @QDF_PROTO_ICMPV6_RA - icmpv6 ra packet
  611. * @QDF_PROTO_ICMPV6_NS - icmpv6 ns packet
  612. * @QDF_PROTO_ICMPV6_NA - icmpv6 na packet
  613. * @QDF_PROTO_IPV4_UDP - ipv4 udp
  614. * @QDF_PROTO_IPV4_TCP - ipv4 tcp
  615. * @QDF_PROTO_IPV6_UDP - ipv6 udp
  616. * @QDF_PROTO_IPV6_TCP - ipv6 tcp
  617. * @QDF_PROTO_MGMT_ASSOC -assoc
  618. * @QDF_PROTO_MGMT_DISASSOC - disassoc
  619. * @QDF_PROTO_MGMT_AUTH - auth
  620. * @QDF_PROTO_MGMT_DEAUTH - deauth
  621. * QDF_ROAM_SYNCH - roam synch indication from fw
  622. * QDF_ROAM_COMPLETE - roam complete cmd to fw
  623. * QDF_ROAM_EVENTID - roam eventid from fw
  624. */
  625. enum qdf_proto_subtype {
  626. QDF_PROTO_INVALID,
  627. QDF_PROTO_EAPOL_M1,
  628. QDF_PROTO_EAPOL_M2,
  629. QDF_PROTO_EAPOL_M3,
  630. QDF_PROTO_EAPOL_M4,
  631. QDF_PROTO_DHCP_DISCOVER,
  632. QDF_PROTO_DHCP_REQUEST,
  633. QDF_PROTO_DHCP_OFFER,
  634. QDF_PROTO_DHCP_ACK,
  635. QDF_PROTO_DHCP_NACK,
  636. QDF_PROTO_DHCP_RELEASE,
  637. QDF_PROTO_DHCP_INFORM,
  638. QDF_PROTO_DHCP_DECLINE,
  639. QDF_PROTO_ARP_REQ,
  640. QDF_PROTO_ARP_RES,
  641. QDF_PROTO_ICMP_REQ,
  642. QDF_PROTO_ICMP_RES,
  643. QDF_PROTO_ICMPV6_REQ,
  644. QDF_PROTO_ICMPV6_RES,
  645. QDF_PROTO_ICMPV6_RS,
  646. QDF_PROTO_ICMPV6_RA,
  647. QDF_PROTO_ICMPV6_NS,
  648. QDF_PROTO_ICMPV6_NA,
  649. QDF_PROTO_IPV4_UDP,
  650. QDF_PROTO_IPV4_TCP,
  651. QDF_PROTO_IPV6_UDP,
  652. QDF_PROTO_IPV6_TCP,
  653. QDF_PROTO_MGMT_ASSOC,
  654. QDF_PROTO_MGMT_DISASSOC,
  655. QDF_PROTO_MGMT_AUTH,
  656. QDF_PROTO_MGMT_DEAUTH,
  657. QDF_ROAM_SYNCH,
  658. QDF_ROAM_COMPLETE,
  659. QDF_ROAM_EVENTID,
  660. QDF_PROTO_SUBTYPE_MAX
  661. };
  662. /**
  663. * @qdf_nbuf_t - Platform indepedent packet abstraction
  664. */
  665. typedef __qdf_nbuf_t qdf_nbuf_t;
  666. /**
  667. * typedef qdf_nbuf_queue_head_t - Platform indepedent nbuf queue head
  668. */
  669. typedef __qdf_nbuf_queue_head_t qdf_nbuf_queue_head_t;
  670. /**
  671. * @qdf_dma_map_cb_t - Dma map callback prototype
  672. */
  673. typedef void (*qdf_dma_map_cb_t)(void *arg, qdf_nbuf_t buf,
  674. qdf_dma_map_t dmap);
  675. /**
  676. * @qdf_nbuf_queue_t - Platform independent packet queue abstraction
  677. */
  678. typedef __qdf_nbuf_queue_t qdf_nbuf_queue_t;
  679. /* BUS/DMA mapping routines */
  680. static inline QDF_STATUS
  681. qdf_nbuf_dmamap_create(qdf_device_t osdev, qdf_dma_map_t *dmap)
  682. {
  683. return __qdf_nbuf_dmamap_create(osdev, dmap);
  684. }
  685. static inline void
  686. qdf_nbuf_dmamap_destroy(qdf_device_t osdev, qdf_dma_map_t dmap)
  687. {
  688. __qdf_nbuf_dmamap_destroy(osdev, dmap);
  689. }
  690. static inline void
  691. qdf_nbuf_dmamap_set_cb(qdf_dma_map_t dmap, qdf_dma_map_cb_t cb, void *arg)
  692. {
  693. __qdf_nbuf_dmamap_set_cb(dmap, cb, arg);
  694. }
  695. static inline void
  696. qdf_nbuf_set_send_complete_flag(qdf_nbuf_t buf, bool flag)
  697. {
  698. __qdf_nbuf_set_send_complete_flag(buf, flag);
  699. }
  700. #ifdef NBUF_MAP_UNMAP_DEBUG
  701. /**
  702. * qdf_nbuf_map_check_for_leaks() - check for nbut map leaks
  703. *
  704. * Check for net buffers that have been mapped, but never unmapped.
  705. *
  706. * Returns: None
  707. */
  708. void qdf_nbuf_map_check_for_leaks(void);
  709. QDF_STATUS qdf_nbuf_map_debug(qdf_device_t osdev,
  710. qdf_nbuf_t buf,
  711. qdf_dma_dir_t dir,
  712. const char *func,
  713. uint32_t line);
  714. #define qdf_nbuf_map(osdev, buf, dir) \
  715. qdf_nbuf_map_debug(osdev, buf, dir, __func__, __LINE__)
  716. void qdf_nbuf_unmap_debug(qdf_device_t osdev,
  717. qdf_nbuf_t buf,
  718. qdf_dma_dir_t dir,
  719. const char *func,
  720. uint32_t line);
  721. #define qdf_nbuf_unmap(osdev, buf, dir) \
  722. qdf_nbuf_unmap_debug(osdev, buf, dir, __func__, __LINE__)
  723. QDF_STATUS qdf_nbuf_map_single_debug(qdf_device_t osdev,
  724. qdf_nbuf_t buf,
  725. qdf_dma_dir_t dir,
  726. const char *func,
  727. uint32_t line);
  728. #define qdf_nbuf_map_single(osdev, buf, dir) \
  729. qdf_nbuf_map_single_debug(osdev, buf, dir, __func__, __LINE__)
  730. void qdf_nbuf_unmap_single_debug(qdf_device_t osdev,
  731. qdf_nbuf_t buf,
  732. qdf_dma_dir_t dir,
  733. const char *func,
  734. uint32_t line);
  735. #define qdf_nbuf_unmap_single(osdev, buf, dir) \
  736. qdf_nbuf_unmap_single_debug(osdev, buf, dir, __func__, __LINE__)
  737. QDF_STATUS qdf_nbuf_map_nbytes_debug(qdf_device_t osdev,
  738. qdf_nbuf_t buf,
  739. qdf_dma_dir_t dir,
  740. int nbytes,
  741. const char *func,
  742. uint32_t line);
  743. #define qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes) \
  744. qdf_nbuf_map_nbytes_debug(osdev, buf, dir, nbytes, __func__, __LINE__)
  745. void qdf_nbuf_unmap_nbytes_debug(qdf_device_t osdev,
  746. qdf_nbuf_t buf,
  747. qdf_dma_dir_t dir,
  748. int nbytes,
  749. const char *func,
  750. uint32_t line);
  751. #define qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes) \
  752. qdf_nbuf_unmap_nbytes_debug(osdev, buf, dir, nbytes, __func__, __LINE__)
  753. QDF_STATUS qdf_nbuf_map_nbytes_single_debug(qdf_device_t osdev,
  754. qdf_nbuf_t buf,
  755. qdf_dma_dir_t dir,
  756. int nbytes,
  757. const char *func,
  758. uint32_t line);
  759. #define qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes) \
  760. qdf_nbuf_map_nbytes_single_debug(osdev, buf, dir, nbytes, \
  761. __func__, __LINE__)
  762. void qdf_nbuf_unmap_nbytes_single_debug(qdf_device_t osdev,
  763. qdf_nbuf_t buf,
  764. qdf_dma_dir_t dir,
  765. int nbytes,
  766. const char *func,
  767. uint32_t line);
  768. #define qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes) \
  769. qdf_nbuf_unmap_nbytes_single_debug(osdev, buf, dir, nbytes, \
  770. __func__, __LINE__)
  771. #else /* NBUF_MAP_UNMAP_DEBUG */
  772. static inline void qdf_nbuf_map_check_for_leaks(void) {}
  773. static inline QDF_STATUS
  774. qdf_nbuf_map(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  775. {
  776. return __qdf_nbuf_map(osdev, buf, dir);
  777. }
  778. static inline void
  779. qdf_nbuf_unmap(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  780. {
  781. __qdf_nbuf_unmap(osdev, buf, dir);
  782. }
  783. static inline QDF_STATUS
  784. qdf_nbuf_map_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  785. {
  786. return __qdf_nbuf_map_single(osdev, buf, dir);
  787. }
  788. static inline void
  789. qdf_nbuf_unmap_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  790. {
  791. __qdf_nbuf_unmap_single(osdev, buf, dir);
  792. }
  793. static inline QDF_STATUS
  794. qdf_nbuf_map_nbytes(qdf_device_t osdev, qdf_nbuf_t buf,
  795. qdf_dma_dir_t dir, int nbytes)
  796. {
  797. return __qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes);
  798. }
  799. static inline void
  800. qdf_nbuf_unmap_nbytes(qdf_device_t osdev,
  801. qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  802. {
  803. __qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes);
  804. }
  805. static inline QDF_STATUS
  806. qdf_nbuf_map_nbytes_single(
  807. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  808. {
  809. return __qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes);
  810. }
  811. static inline void
  812. qdf_nbuf_unmap_nbytes_single(
  813. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  814. {
  815. return __qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes);
  816. }
  817. #endif /* NBUF_MAP_UNMAP_DEBUG */
  818. /**
  819. * qdf_nbuf_queue_head_dequeue() - dequeue nbuf from the head of queue
  820. * @nbuf_queue_head: pointer to nbuf queue head
  821. *
  822. * Return: pointer to network buffer dequeued
  823. */
  824. static inline
  825. qdf_nbuf_t qdf_nbuf_queue_head_dequeue(qdf_nbuf_queue_head_t *nbuf_queue_head)
  826. {
  827. return __qdf_nbuf_queue_head_dequeue(nbuf_queue_head);
  828. }
  829. /**
  830. * qdf_nbuf_queue_head_qlen() - length of the queue
  831. * @nbuf_queue_head: pointer to nbuf queue head
  832. *
  833. * Return: length of queue (number of nbufs) pointed by qdf_nbuf_queue_head_t
  834. */
  835. static inline
  836. uint32_t qdf_nbuf_queue_head_qlen(qdf_nbuf_queue_head_t *nbuf_queue_head)
  837. {
  838. return __qdf_nbuf_queue_head_qlen(nbuf_queue_head);
  839. }
  840. /**
  841. * qdf_nbuf_queue_head_enqueue_tail() - enqueue nbuf into queue tail
  842. * @nbuf_queue_head: pointer to nbuf queue head
  843. * @nbuf: nbuf to be enqueued
  844. *
  845. * Return: None
  846. */
  847. static inline
  848. void qdf_nbuf_queue_head_enqueue_tail(qdf_nbuf_queue_head_t *nbuf_queue_head,
  849. qdf_nbuf_t nbuf)
  850. {
  851. return __qdf_nbuf_queue_head_enqueue_tail(nbuf_queue_head, nbuf);
  852. }
  853. /**
  854. * qdf_nbuf_queue_head_init() - initialize qdf_nbuf_queue_head_t
  855. * @nbuf_queue_head: pointer to nbuf queue head to be initialized
  856. *
  857. * Return: None
  858. */
  859. static inline
  860. void qdf_nbuf_queue_head_init(qdf_nbuf_queue_head_t *nbuf_queue_head)
  861. {
  862. return __qdf_nbuf_queue_head_init(nbuf_queue_head);
  863. }
  864. /**
  865. * qdf_nbuf_queue_head_purge() - purge qdf_nbuf_queue_head_t
  866. * @nbuf_queue_head: pointer to nbuf queue head to be purged
  867. *
  868. * Return: None
  869. */
  870. static inline
  871. void qdf_nbuf_queue_head_purge(qdf_nbuf_queue_head_t *nbuf_queue_head)
  872. {
  873. return __qdf_nbuf_queue_head_purge(nbuf_queue_head);
  874. }
  875. static inline void
  876. qdf_nbuf_sync_for_cpu(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  877. {
  878. __qdf_nbuf_sync_for_cpu(osdev, buf, dir);
  879. }
  880. static inline int qdf_nbuf_get_num_frags(qdf_nbuf_t buf)
  881. {
  882. return __qdf_nbuf_get_num_frags(buf);
  883. }
  884. /**
  885. * qdf_nbuf_get_frag_len() - get fragment length
  886. * @buf: Network buffer
  887. * @frag_num: Fragment number
  888. *
  889. * Return: Fragment length
  890. */
  891. static inline int qdf_nbuf_get_frag_len(qdf_nbuf_t buf, int frag_num)
  892. {
  893. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  894. return __qdf_nbuf_get_frag_len(buf, frag_num);
  895. }
  896. /**
  897. * qdf_nbuf_get_frag_vaddr() - get fragment virtual address
  898. * @buf: Network buffer
  899. * @frag_num: Fragment number
  900. *
  901. * Return: Fragment virtual address
  902. */
  903. static inline unsigned char *qdf_nbuf_get_frag_vaddr(qdf_nbuf_t buf,
  904. int frag_num)
  905. {
  906. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  907. return __qdf_nbuf_get_frag_vaddr(buf, frag_num);
  908. }
  909. /**
  910. * qdf_nbuf_get_frag_vaddr_always() - get fragment virtual address
  911. * @buf: Network buffer
  912. *
  913. * Return: Fragment virtual address
  914. */
  915. static inline unsigned char *
  916. qdf_nbuf_get_frag_vaddr_always(qdf_nbuf_t buf)
  917. {
  918. return __qdf_nbuf_get_frag_vaddr_always(buf);
  919. }
  920. /**
  921. * qdf_nbuf_get_frag_paddr() - get physical address for skb linear buffer
  922. * or skb fragment, based on frag_num passed
  923. * @buf: Network buffer
  924. * @frag_num: Fragment number
  925. *
  926. * Return: Fragment physical address
  927. */
  928. static inline qdf_dma_addr_t qdf_nbuf_get_frag_paddr(qdf_nbuf_t buf,
  929. unsigned int frag_num)
  930. {
  931. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  932. return __qdf_nbuf_get_frag_paddr(buf, frag_num);
  933. }
  934. /**
  935. * qdf_nbuf_get_tx_frag_paddr() - get physical address for skb fragments only
  936. * @buf: Network buffer
  937. *
  938. * Return: Fragment physical address
  939. * Usage guideline: Use “qdf_nbuf_frag_map()” to dma map the specific
  940. * skb fragment , followed by “qdf_nbuf_get_tx_frag_paddr”
  941. */
  942. static inline qdf_dma_addr_t qdf_nbuf_get_tx_frag_paddr(qdf_nbuf_t buf)
  943. {
  944. return __qdf_nbuf_get_tx_frag_paddr(buf);
  945. }
  946. /**
  947. * qdf_nbuf_get_frag_is_wordstream() - is fragment wordstream
  948. * @buf: Network buffer
  949. * @frag_num: Fragment number
  950. *
  951. * Return: Fragment wordstream or not
  952. */
  953. static inline int qdf_nbuf_get_frag_is_wordstream(qdf_nbuf_t buf, int frag_num)
  954. {
  955. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  956. return __qdf_nbuf_get_frag_is_wordstream(buf, frag_num);
  957. }
  958. /**
  959. * qdf_nbuf_set_frag_is_wordstream() - set fragment wordstream
  960. * @buf: Network buffer
  961. * @frag_num: Fragment number
  962. * @is_wordstream: Wordstream
  963. *
  964. * Return: none
  965. */
  966. static inline void
  967. qdf_nbuf_set_frag_is_wordstream(qdf_nbuf_t buf,
  968. int frag_num, int is_wordstream)
  969. {
  970. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  971. __qdf_nbuf_set_frag_is_wordstream(buf, frag_num, is_wordstream);
  972. }
  973. static inline void
  974. qdf_nbuf_set_vdev_ctx(qdf_nbuf_t buf, uint8_t vdev_id)
  975. {
  976. __qdf_nbuf_set_vdev_ctx(buf, vdev_id);
  977. }
  978. static inline void
  979. qdf_nbuf_set_tx_ftype(qdf_nbuf_t buf, enum cb_ftype type)
  980. {
  981. __qdf_nbuf_set_tx_ftype(buf, type);
  982. }
  983. static inline void
  984. qdf_nbuf_set_rx_ftype(qdf_nbuf_t buf, enum cb_ftype type)
  985. {
  986. __qdf_nbuf_set_rx_ftype(buf, type);
  987. }
  988. static inline uint8_t
  989. qdf_nbuf_get_vdev_ctx(qdf_nbuf_t buf)
  990. {
  991. return __qdf_nbuf_get_vdev_ctx(buf);
  992. }
  993. static inline enum cb_ftype qdf_nbuf_get_tx_ftype(qdf_nbuf_t buf)
  994. {
  995. return __qdf_nbuf_get_tx_ftype(buf);
  996. }
  997. static inline enum cb_ftype qdf_nbuf_get_rx_ftype(qdf_nbuf_t buf)
  998. {
  999. return __qdf_nbuf_get_rx_ftype(buf);
  1000. }
  1001. static inline qdf_dma_addr_t
  1002. qdf_nbuf_mapped_paddr_get(qdf_nbuf_t buf)
  1003. {
  1004. return __qdf_nbuf_mapped_paddr_get(buf);
  1005. }
  1006. static inline void
  1007. qdf_nbuf_mapped_paddr_set(qdf_nbuf_t buf, qdf_dma_addr_t paddr)
  1008. {
  1009. __qdf_nbuf_mapped_paddr_set(buf, paddr);
  1010. }
  1011. static inline void
  1012. qdf_nbuf_frag_push_head(qdf_nbuf_t buf,
  1013. int frag_len, char *frag_vaddr,
  1014. qdf_dma_addr_t frag_paddr)
  1015. {
  1016. __qdf_nbuf_frag_push_head(buf, frag_len, frag_vaddr, frag_paddr);
  1017. }
  1018. #define qdf_nbuf_num_frags_init(_nbuf) __qdf_nbuf_num_frags_init((_nbuf))
  1019. /**
  1020. * qdf_nbuf_set_rx_chfrag_start() - set msdu start bit
  1021. * @buf: Network buffer
  1022. * @val: 0/1
  1023. *
  1024. * Return: void
  1025. */
  1026. static inline void
  1027. qdf_nbuf_set_rx_chfrag_start(qdf_nbuf_t buf, uint8_t val)
  1028. {
  1029. __qdf_nbuf_set_rx_chfrag_start(buf, val);
  1030. }
  1031. /**
  1032. * qdf_nbuf_is_rx_chfrag_start() - get msdu start bit
  1033. * @buf: Network buffer
  1034. *
  1035. * Return: integer value - 0/1
  1036. */
  1037. static inline int qdf_nbuf_is_rx_chfrag_start(qdf_nbuf_t buf)
  1038. {
  1039. return __qdf_nbuf_is_rx_chfrag_start(buf);
  1040. }
  1041. /**
  1042. * qdf_nbuf_set_rx_chfrag_cont() - set msdu continuation bit
  1043. * @buf: Network buffer
  1044. * @val: 0/1
  1045. *
  1046. * Return: void
  1047. */
  1048. static inline void
  1049. qdf_nbuf_set_rx_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
  1050. {
  1051. __qdf_nbuf_set_rx_chfrag_cont(buf, val);
  1052. }
  1053. /**
  1054. * qdf_nbuf_is_rx_chfrag_cont() - get msdu continuation bit
  1055. * @buf: Network buffer
  1056. *
  1057. * Return: integer value - 0/1
  1058. */
  1059. static inline int qdf_nbuf_is_rx_chfrag_cont(qdf_nbuf_t buf)
  1060. {
  1061. return __qdf_nbuf_is_rx_chfrag_cont(buf);
  1062. }
  1063. /**
  1064. * qdf_nbuf_set_rx_chfrag_end() - set msdu end bit
  1065. * @buf: Network buffer
  1066. * @val: 0/1
  1067. *
  1068. * Return: void
  1069. */
  1070. static inline void qdf_nbuf_set_rx_chfrag_end(qdf_nbuf_t buf, uint8_t val)
  1071. {
  1072. __qdf_nbuf_set_rx_chfrag_end(buf, val);
  1073. }
  1074. /**
  1075. * qdf_nbuf_is_rx_chfrag_end() - set msdu end bit
  1076. * @buf: Network buffer
  1077. *
  1078. * Return: integer value - 0/1
  1079. */
  1080. static inline int qdf_nbuf_is_rx_chfrag_end(qdf_nbuf_t buf)
  1081. {
  1082. return __qdf_nbuf_is_rx_chfrag_end(buf);
  1083. }
  1084. /**
  1085. * qdf_nbuf_set_da_mcbc() - set da is mcbc
  1086. * @buf: Network buffer
  1087. * @val: 0/1
  1088. *
  1089. * Return: void
  1090. */
  1091. static inline void
  1092. qdf_nbuf_set_da_mcbc(qdf_nbuf_t buf, uint8_t val)
  1093. {
  1094. __qdf_nbuf_set_da_mcbc(buf, val);
  1095. }
  1096. /**
  1097. * qdf_nbuf_is_da_mcbc() - get da is mcbc bit
  1098. * @buf: Network buffer
  1099. *
  1100. * Return: integer value - 0/1
  1101. */
  1102. static inline int qdf_nbuf_is_da_mcbc(qdf_nbuf_t buf)
  1103. {
  1104. return __qdf_nbuf_is_da_mcbc(buf);
  1105. }
  1106. /**
  1107. * qdf_nbuf_set_da_valid() - set da valid bit
  1108. * @buf: Network buffer
  1109. * @val: 0/1
  1110. *
  1111. * Return: void
  1112. */
  1113. static inline void qdf_nbuf_set_da_valid(qdf_nbuf_t buf, uint8_t val)
  1114. {
  1115. __qdf_nbuf_set_da_valid(buf, val);
  1116. }
  1117. /**
  1118. * qdf_nbuf_is_da_valid() - get da valid bit
  1119. * @buf: Network buffer
  1120. *
  1121. * Return: integer value - 0/1
  1122. */
  1123. static inline int qdf_nbuf_is_da_valid(qdf_nbuf_t buf)
  1124. {
  1125. return __qdf_nbuf_is_da_valid(buf);
  1126. }
  1127. /**
  1128. * qdf_nbuf_set_sa_valid() - set sa valid bit
  1129. * @buf: Network buffer
  1130. * @val: 0/1
  1131. *
  1132. * Return: void
  1133. */
  1134. static inline void qdf_nbuf_set_sa_valid(qdf_nbuf_t buf, uint8_t val)
  1135. {
  1136. __qdf_nbuf_set_sa_valid(buf, val);
  1137. }
  1138. /**
  1139. * qdf_nbuf_is_sa_valid() - get da valid bit
  1140. * @buf: Network buffer
  1141. *
  1142. * Return: integer value - 0/1
  1143. */
  1144. static inline int qdf_nbuf_is_sa_valid(qdf_nbuf_t buf)
  1145. {
  1146. return __qdf_nbuf_is_sa_valid(buf);
  1147. }
  1148. /**
  1149. * qdf_nbuf_set_raw_frame() - set raw_frame bit
  1150. * @buf: Network buffer
  1151. * @val: 0/1
  1152. *
  1153. * Return: void
  1154. */
  1155. static inline void qdf_nbuf_set_raw_frame(qdf_nbuf_t buf, uint8_t val)
  1156. {
  1157. __qdf_nbuf_set_raw_frame(buf, val);
  1158. }
  1159. /**
  1160. * qdf_nbuf_is_raw_frame() - get raw_frame bit
  1161. * @buf: Network buffer
  1162. *
  1163. * Return: integer value - 0/1
  1164. */
  1165. static inline int qdf_nbuf_is_raw_frame(qdf_nbuf_t buf)
  1166. {
  1167. return __qdf_nbuf_is_raw_frame(buf);
  1168. }
  1169. /**
  1170. * qdf_nbuf_set_tid_val() - set tid_val
  1171. * @buf: Network buffer
  1172. * @val: 4 bits tid value
  1173. */
  1174. static inline void qdf_nbuf_set_tid_val(qdf_nbuf_t buf, uint8_t val)
  1175. {
  1176. __qdf_nbuf_set_tid_val(buf, val);
  1177. }
  1178. /**
  1179. * qdf_nbuf_get_tid_val() - get tid_val
  1180. * @buf: Network buffer
  1181. *
  1182. * Return: integer value[4 bits tid value]
  1183. */
  1184. static inline uint8_t qdf_nbuf_get_tid_val(qdf_nbuf_t buf)
  1185. {
  1186. return __qdf_nbuf_get_tid_val(buf);
  1187. }
  1188. /**
  1189. * qdf_nbuf_set_frag_list() - set frag list bit
  1190. * @buf: Network buffer
  1191. * @val: 0/1
  1192. *
  1193. * Return: void
  1194. */
  1195. static inline void qdf_nbuf_set_is_frag(qdf_nbuf_t buf, uint8_t val)
  1196. {
  1197. __qdf_nbuf_set_is_frag(buf, val);
  1198. }
  1199. /**
  1200. * qdf_nbuf_is_sa_valid() - get da frag list bit
  1201. * @buf: Network buffer
  1202. *
  1203. * Return: integer value - 0/1
  1204. */
  1205. static inline int qdf_nbuf_is_frag(qdf_nbuf_t buf)
  1206. {
  1207. return __qdf_nbuf_is_frag(buf);
  1208. }
  1209. /**
  1210. * qdf_nbuf_set_tx_chfrag_start() - set msdu start bit
  1211. * @buf: Network buffer
  1212. * @val: 0/1
  1213. *
  1214. * Return: void
  1215. */
  1216. static inline void
  1217. qdf_nbuf_set_tx_chfrag_start(qdf_nbuf_t buf, uint8_t val)
  1218. {
  1219. __qdf_nbuf_set_tx_chfrag_start(buf, val);
  1220. }
  1221. /**
  1222. * qdf_nbuf_is_tx_chfrag_start() - get msdu start bit
  1223. * @buf: Network buffer
  1224. *
  1225. * Return: integer value - 0/1
  1226. */
  1227. static inline int qdf_nbuf_is_tx_chfrag_start(qdf_nbuf_t buf)
  1228. {
  1229. return __qdf_nbuf_is_tx_chfrag_start(buf);
  1230. }
  1231. /**
  1232. * qdf_nbuf_set_tx_chfrag_cont() - set msdu continuation bit
  1233. * @buf: Network buffer
  1234. * @val: 0/1
  1235. *
  1236. * Return: void
  1237. */
  1238. static inline void
  1239. qdf_nbuf_set_tx_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
  1240. {
  1241. __qdf_nbuf_set_tx_chfrag_cont(buf, val);
  1242. }
  1243. /**
  1244. * qdf_nbuf_is_tx_chfrag_cont() - get msdu continuation bit
  1245. * @buf: Network buffer
  1246. *
  1247. * Return: integer value - 0/1
  1248. */
  1249. static inline int qdf_nbuf_is_tx_chfrag_cont(qdf_nbuf_t buf)
  1250. {
  1251. return __qdf_nbuf_is_tx_chfrag_cont(buf);
  1252. }
  1253. /**
  1254. * qdf_nbuf_set_tx_chfrag_end() - set msdu end bit
  1255. * @buf: Network buffer
  1256. * @val: 0/1
  1257. *
  1258. * Return: void
  1259. */
  1260. static inline void qdf_nbuf_set_tx_chfrag_end(qdf_nbuf_t buf, uint8_t val)
  1261. {
  1262. __qdf_nbuf_set_tx_chfrag_end(buf, val);
  1263. }
  1264. /**
  1265. * qdf_nbuf_is_tx_chfrag_end() - set msdu end bit
  1266. * @buf: Network buffer
  1267. *
  1268. * Return: integer value - 0/1
  1269. */
  1270. static inline int qdf_nbuf_is_tx_chfrag_end(qdf_nbuf_t buf)
  1271. {
  1272. return __qdf_nbuf_is_tx_chfrag_end(buf);
  1273. }
  1274. static inline void
  1275. qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg)
  1276. {
  1277. __qdf_nbuf_dma_map_info(bmap, sg);
  1278. }
  1279. /**
  1280. * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
  1281. * @buf: Network buffer
  1282. *
  1283. * Return: 1 - this is a jumbo packet 0 - not a jumbo packet
  1284. */
  1285. static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf)
  1286. {
  1287. return __qdf_nbuf_is_tso(nbuf);
  1288. }
  1289. /**
  1290. * qdf_nbuf_get_users() - function to get the number of users referencing this
  1291. * network buffer
  1292. *
  1293. * @nbuf: network buffer
  1294. *
  1295. * Return: number of user references to nbuf.
  1296. */
  1297. static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf)
  1298. {
  1299. return __qdf_nbuf_get_users(nbuf);
  1300. }
  1301. /**
  1302. * qdf_nbuf_next() - get the next packet in the linked list
  1303. * @buf: Network buffer
  1304. *
  1305. * This function can be used when nbufs are directly linked into a list,
  1306. * rather than using a separate network buffer queue object.
  1307. *
  1308. * Return: next network buffer in the linked list
  1309. */
  1310. static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf)
  1311. {
  1312. return __qdf_nbuf_next(buf);
  1313. }
  1314. #ifdef NBUF_MEMORY_DEBUG
  1315. void qdf_net_buf_debug_init(void);
  1316. void qdf_net_buf_debug_exit(void);
  1317. void qdf_net_buf_debug_clean(void);
  1318. void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
  1319. const char *func_name, uint32_t line_num);
  1320. /**
  1321. * qdf_net_buf_debug_update_node() - update nbuf in debug hash table
  1322. *
  1323. * Return: none
  1324. */
  1325. void qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, const char *func_name,
  1326. uint32_t line_num);
  1327. void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf);
  1328. /**
  1329. * qdf_net_buf_debug_acquire_skb() - acquire skb to avoid memory leak
  1330. * @net_buf: Network buf holding head segment (single)
  1331. * @func_name: pointer to function name
  1332. * @line_num: line number
  1333. *
  1334. * WLAN driver module's SKB which are allocated by network stack are
  1335. * suppose to call this API before freeing it such that the SKB
  1336. * is not reported as memory leak.
  1337. *
  1338. * Return: none
  1339. */
  1340. void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
  1341. const char *func_name,
  1342. uint32_t line_num);
  1343. void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf);
  1344. /* nbuf allocation rouines */
  1345. #define qdf_nbuf_alloc(d, s, r, a, p) \
  1346. qdf_nbuf_alloc_debug(d, s, r, a, p, __func__, __LINE__)
  1347. qdf_nbuf_t qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size,
  1348. int reserve, int align, int prio,
  1349. const char *func, uint32_t line);
  1350. #define qdf_nbuf_free(d) \
  1351. qdf_nbuf_free_debug(d, __func__, __LINE__)
  1352. void qdf_nbuf_free_debug(qdf_nbuf_t nbuf, const char *func, uint32_t line);
  1353. #define qdf_nbuf_clone(buf) \
  1354. qdf_nbuf_clone_debug(buf, __func__, __LINE__)
  1355. /**
  1356. * qdf_nbuf_clone_debug() - clone the nbuf (copy is readonly)
  1357. * @buf: nbuf to clone from
  1358. * @func: name of the calling function
  1359. * @line: line number of the callsite
  1360. *
  1361. * This function clones the nbuf and creates a memory tracking
  1362. * node corresponding to that cloned skbuff structure.
  1363. *
  1364. * Return: cloned buffer
  1365. */
  1366. qdf_nbuf_t qdf_nbuf_clone_debug(qdf_nbuf_t buf, const char *func,
  1367. uint32_t line);
  1368. #define qdf_nbuf_copy(buf) \
  1369. qdf_nbuf_copy_debug(buf, __func__, __LINE__)
  1370. /**
  1371. * qdf_nbuf_copy_debug() - returns a private copy of the buf
  1372. * @buf: nbuf to copy from
  1373. * @func: name of the calling function
  1374. * @line: line number of the callsite
  1375. *
  1376. * This API returns a private copy of the buf, the buf returned is completely
  1377. * modifiable by callers. It also creates a memory tracking node corresponding
  1378. * to that new skbuff structure.
  1379. *
  1380. * Return: copied buffer
  1381. */
  1382. qdf_nbuf_t qdf_nbuf_copy_debug(qdf_nbuf_t buf, const char *func, uint32_t line);
  1383. #else /* NBUF_MEMORY_DEBUG */
  1384. static inline void qdf_net_buf_debug_init(void) {}
  1385. static inline void qdf_net_buf_debug_exit(void) {}
  1386. static inline void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
  1387. const char *func_name,
  1388. uint32_t line_num)
  1389. {
  1390. }
  1391. static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
  1392. {
  1393. }
  1394. static inline void
  1395. qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, const char *func_name,
  1396. uint32_t line_num)
  1397. {
  1398. }
  1399. /* Nbuf allocation rouines */
  1400. #define qdf_nbuf_alloc(osdev, size, reserve, align, prio) \
  1401. qdf_nbuf_alloc_fl(osdev, size, reserve, align, prio, \
  1402. __func__, __LINE__)
  1403. static inline qdf_nbuf_t
  1404. qdf_nbuf_alloc_fl(qdf_device_t osdev, qdf_size_t size, int reserve, int align,
  1405. int prio, const char *func, uint32_t line)
  1406. {
  1407. return __qdf_nbuf_alloc(osdev, size, reserve, align, prio, func, line);
  1408. }
  1409. static inline void qdf_nbuf_free(qdf_nbuf_t buf)
  1410. {
  1411. if (qdf_likely(buf))
  1412. __qdf_nbuf_free(buf);
  1413. }
  1414. /**
  1415. * qdf_nbuf_clone() - clone the nbuf (copy is readonly)
  1416. * @buf: Pointer to network buffer
  1417. *
  1418. * This function clones the nbuf and returns new sk_buff
  1419. * structure.
  1420. *
  1421. * Return: cloned skb
  1422. */
  1423. static inline qdf_nbuf_t qdf_nbuf_clone(qdf_nbuf_t buf)
  1424. {
  1425. return __qdf_nbuf_clone(buf);
  1426. }
  1427. /**
  1428. * qdf_nbuf_copy() - returns a private copy of the buf
  1429. * @buf: Pointer to network buffer
  1430. *
  1431. * This API returns a private copy of the buf, the buf returned is completely
  1432. * modifiable by callers
  1433. *
  1434. * Return: skb or NULL
  1435. */
  1436. static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf)
  1437. {
  1438. return __qdf_nbuf_copy(buf);
  1439. }
  1440. #endif /* NBUF_MEMORY_DEBUG */
  1441. #ifdef WLAN_FEATURE_FASTPATH
  1442. /**
  1443. * qdf_nbuf_init_fast() - before put buf into pool,turn it to init state
  1444. *
  1445. * @buf: buf instance
  1446. * Return: data pointer of this buf where new data has to be
  1447. * put, or NULL if there is not enough room in this buf.
  1448. */
  1449. void qdf_nbuf_init_fast(qdf_nbuf_t nbuf);
  1450. #endif /* WLAN_FEATURE_FASTPATH */
  1451. /**
  1452. * @qdf_nbuf_list_free() - free a list of nbufs
  1453. * @buf_list: A list of nbufs to be freed
  1454. *
  1455. * Return: none
  1456. */
  1457. static inline void qdf_nbuf_list_free(qdf_nbuf_t buf_list)
  1458. {
  1459. while (buf_list) {
  1460. qdf_nbuf_t next = qdf_nbuf_next(buf_list);
  1461. qdf_nbuf_free(buf_list);
  1462. buf_list = next;
  1463. }
  1464. }
  1465. static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err)
  1466. {
  1467. qdf_nbuf_list_free(buf_list);
  1468. }
  1469. static inline void qdf_nbuf_ref(qdf_nbuf_t buf)
  1470. {
  1471. __qdf_nbuf_ref(buf);
  1472. }
  1473. static inline int qdf_nbuf_shared(qdf_nbuf_t buf)
  1474. {
  1475. return __qdf_nbuf_shared(buf);
  1476. }
  1477. static inline QDF_STATUS qdf_nbuf_cat(qdf_nbuf_t dst, qdf_nbuf_t src)
  1478. {
  1479. return __qdf_nbuf_cat(dst, src);
  1480. }
  1481. /**
  1482. * @qdf_nbuf_copy_bits() - return the length of the copy bits for skb
  1483. * @skb: SKB pointer
  1484. * @offset: offset
  1485. * @len: Length
  1486. * @to: To
  1487. *
  1488. * Return: int32_t
  1489. */
  1490. static inline int32_t
  1491. qdf_nbuf_copy_bits(qdf_nbuf_t nbuf, uint32_t offset, uint32_t len, void *to)
  1492. {
  1493. return __qdf_nbuf_copy_bits(nbuf, offset, len, to);
  1494. }
  1495. /* nbuf manipulation routines */
  1496. /**
  1497. * @qdf_nbuf_head() - return the address of an nbuf's buffer
  1498. * @buf: netbuf
  1499. *
  1500. * Return: head address
  1501. */
  1502. static inline uint8_t *qdf_nbuf_head(qdf_nbuf_t buf)
  1503. {
  1504. return __qdf_nbuf_head(buf);
  1505. }
  1506. /**
  1507. * qdf_nbuf_data() - Return the address of the start of data within an nbuf
  1508. * @buf: Network buffer
  1509. *
  1510. * Return: Data address
  1511. */
  1512. static inline uint8_t *qdf_nbuf_data(qdf_nbuf_t buf)
  1513. {
  1514. return __qdf_nbuf_data(buf);
  1515. }
  1516. /**
  1517. * qdf_nbuf_data_addr() - Return the address of skb->data
  1518. * @buf: Network buffer
  1519. *
  1520. * Return: Data address
  1521. */
  1522. static inline uint8_t *qdf_nbuf_data_addr(qdf_nbuf_t buf)
  1523. {
  1524. return __qdf_nbuf_data_addr(buf);
  1525. }
  1526. /**
  1527. * qdf_nbuf_headroom() - amount of headroom int the current nbuf
  1528. * @buf: Network buffer
  1529. *
  1530. * Return: Amount of head room
  1531. */
  1532. static inline uint32_t qdf_nbuf_headroom(qdf_nbuf_t buf)
  1533. {
  1534. return __qdf_nbuf_headroom(buf);
  1535. }
  1536. /**
  1537. * qdf_nbuf_tailroom() - amount of tail space available
  1538. * @buf: Network buffer
  1539. *
  1540. * Return: amount of tail room
  1541. */
  1542. static inline uint32_t qdf_nbuf_tailroom(qdf_nbuf_t buf)
  1543. {
  1544. return __qdf_nbuf_tailroom(buf);
  1545. }
  1546. /**
  1547. * qdf_nbuf_push_head() - push data in the front
  1548. * @buf: Network buf instance
  1549. * @size: Size to be pushed
  1550. *
  1551. * Return: New data pointer of this buf after data has been pushed,
  1552. * or NULL if there is not enough room in this buf.
  1553. */
  1554. static inline uint8_t *qdf_nbuf_push_head(qdf_nbuf_t buf, qdf_size_t size)
  1555. {
  1556. return __qdf_nbuf_push_head(buf, size);
  1557. }
  1558. /**
  1559. * qdf_nbuf_put_tail() - puts data in the end
  1560. * @buf: Network buf instance
  1561. * @size: Size to be pushed
  1562. *
  1563. * Return: Data pointer of this buf where new data has to be
  1564. * put, or NULL if there is not enough room in this buf.
  1565. */
  1566. static inline uint8_t *qdf_nbuf_put_tail(qdf_nbuf_t buf, qdf_size_t size)
  1567. {
  1568. return __qdf_nbuf_put_tail(buf, size);
  1569. }
  1570. /**
  1571. * qdf_nbuf_pull_head() - pull data out from the front
  1572. * @buf: Network buf instance
  1573. * @size: Size to be popped
  1574. *
  1575. * Return: New data pointer of this buf after data has been popped,
  1576. * or NULL if there is not sufficient data to pull.
  1577. */
  1578. static inline uint8_t *qdf_nbuf_pull_head(qdf_nbuf_t buf, qdf_size_t size)
  1579. {
  1580. return __qdf_nbuf_pull_head(buf, size);
  1581. }
  1582. /**
  1583. * qdf_nbuf_trim_tail() - trim data out from the end
  1584. * @buf: Network buf instance
  1585. * @size: Size to be popped
  1586. *
  1587. * Return: none
  1588. */
  1589. static inline void qdf_nbuf_trim_tail(qdf_nbuf_t buf, qdf_size_t size)
  1590. {
  1591. __qdf_nbuf_trim_tail(buf, size);
  1592. }
  1593. /**
  1594. * qdf_nbuf_len() - get the length of the buf
  1595. * @buf: Network buf instance
  1596. *
  1597. * Return: total length of this buf.
  1598. */
  1599. static inline qdf_size_t qdf_nbuf_len(qdf_nbuf_t buf)
  1600. {
  1601. return __qdf_nbuf_len(buf);
  1602. }
  1603. /**
  1604. * qdf_nbuf_set_pktlen() - set the length of the buf
  1605. * @buf: Network buf instance
  1606. * @size: Size to be set
  1607. *
  1608. * Return: none
  1609. */
  1610. static inline void qdf_nbuf_set_pktlen(qdf_nbuf_t buf, uint32_t len)
  1611. {
  1612. __qdf_nbuf_set_pktlen(buf, len);
  1613. }
  1614. /**
  1615. * qdf_nbuf_reserve() - trim data out from the end
  1616. * @buf: Network buf instance
  1617. * @size: Size to be popped
  1618. *
  1619. * Return: none
  1620. */
  1621. static inline void qdf_nbuf_reserve(qdf_nbuf_t buf, qdf_size_t size)
  1622. {
  1623. __qdf_nbuf_reserve(buf, size);
  1624. }
  1625. /**
  1626. * qdf_nbuf_set_data_pointer() - set data pointer
  1627. * @buf: Network buf instance
  1628. * @data: data pointer
  1629. *
  1630. * Return: none
  1631. */
  1632. static inline void qdf_nbuf_set_data_pointer(qdf_nbuf_t buf, uint8_t *data)
  1633. {
  1634. __qdf_nbuf_set_data_pointer(buf, data);
  1635. }
  1636. /**
  1637. * qdf_nbuf_set_len() - set data length
  1638. * @buf: Network buf instance
  1639. * @len: data length
  1640. * Return: none
  1641. */
  1642. static inline void qdf_nbuf_set_len(qdf_nbuf_t buf, uint32_t len)
  1643. {
  1644. __qdf_nbuf_set_len(buf, len);
  1645. }
  1646. /**
  1647. * qdf_nbuf_set_tail_pointer() - set data tail pointer
  1648. * @buf: Network buf instance
  1649. * @len: length of data
  1650. *
  1651. * Return: none
  1652. */
  1653. static inline void qdf_nbuf_set_tail_pointer(qdf_nbuf_t buf, int len)
  1654. {
  1655. __qdf_nbuf_set_tail_pointer(buf, len);
  1656. }
  1657. /**
  1658. * qdf_nbuf_reset() - reset the buffer data and pointer
  1659. * @buf: Network buf instance
  1660. * @reserve: reserve
  1661. * @align: align
  1662. *
  1663. * Return: none
  1664. */
  1665. static inline void qdf_nbuf_reset(qdf_nbuf_t buf, int reserve, int align)
  1666. {
  1667. __qdf_nbuf_reset(buf, reserve, align);
  1668. }
  1669. /**
  1670. * qdf_nbuf_dev_scratch_is_supported() - dev_scratch support for network buffer
  1671. * in kernel
  1672. *
  1673. * Return: true if dev_scratch is supported
  1674. * false if dev_scratch is not supported
  1675. */
  1676. static inline bool qdf_nbuf_is_dev_scratch_supported(void)
  1677. {
  1678. return __qdf_nbuf_is_dev_scratch_supported();
  1679. }
  1680. /**
  1681. * qdf_nbuf_get_dev_scratch() - get dev_scratch of network buffer
  1682. * @buf: Pointer to network buffer
  1683. *
  1684. * Return: dev_scratch if dev_scratch supported
  1685. * 0 if dev_scratch not supported
  1686. */
  1687. static inline unsigned long qdf_nbuf_get_dev_scratch(qdf_nbuf_t buf)
  1688. {
  1689. return __qdf_nbuf_get_dev_scratch(buf);
  1690. }
  1691. /**
  1692. * qdf_nbuf_set_dev_scratch() - set dev_scratch of network buffer
  1693. * @buf: Pointer to network buffer
  1694. * @value: value to be set in dev_scratch of network buffer
  1695. *
  1696. * Return: void
  1697. */
  1698. static inline void qdf_nbuf_set_dev_scratch(qdf_nbuf_t buf, unsigned long value)
  1699. {
  1700. __qdf_nbuf_set_dev_scratch(buf, value);
  1701. }
  1702. /**
  1703. * qdf_nbuf_peek_header() - return the data pointer & length of the header
  1704. * @buf: Network nbuf
  1705. * @addr: Data pointer
  1706. * @len: Length of the data
  1707. *
  1708. * Return: none
  1709. */
  1710. static inline void
  1711. qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len)
  1712. {
  1713. __qdf_nbuf_peek_header(buf, addr, len);
  1714. }
  1715. /* nbuf queue routines */
  1716. /**
  1717. * qdf_nbuf_queue_init() - initialize buf queue
  1718. * @head: Network buf queue head
  1719. *
  1720. * Return: none
  1721. */
  1722. static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head)
  1723. {
  1724. __qdf_nbuf_queue_init(head);
  1725. }
  1726. /**
  1727. * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue
  1728. * @head: Network buf queue head
  1729. * @buf: Network buf
  1730. *
  1731. * Return: none
  1732. */
  1733. static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  1734. {
  1735. __qdf_nbuf_queue_add(head, buf);
  1736. }
  1737. /**
  1738. * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue
  1739. * @head: Network buf queue head
  1740. * @buf: Network buf
  1741. *
  1742. * Return: none
  1743. */
  1744. static inline void
  1745. qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  1746. {
  1747. __qdf_nbuf_queue_insert_head(head, buf);
  1748. }
  1749. /**
  1750. * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue
  1751. * @head: Network buf queue head
  1752. *
  1753. * Return: The head buf in the buf queue.
  1754. */
  1755. static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head)
  1756. {
  1757. return __qdf_nbuf_queue_remove(head);
  1758. }
  1759. /**
  1760. * qdf_nbuf_queue_len() - get the length of the queue
  1761. * @head: Network buf queue head
  1762. *
  1763. * Return: length of the queue
  1764. */
  1765. static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head)
  1766. {
  1767. return __qdf_nbuf_queue_len(head);
  1768. }
  1769. /**
  1770. * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer
  1771. * @buf: Network buffer
  1772. *
  1773. * Return: next buffer/packet
  1774. */
  1775. static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf)
  1776. {
  1777. return __qdf_nbuf_queue_next(buf);
  1778. }
  1779. /**
  1780. * @qdf_nbuf_is_queue_empty() - check if the buf queue is empty
  1781. * @nbq: Network buf queue handle
  1782. *
  1783. * Return: true if queue is empty
  1784. * false if queue is not emty
  1785. */
  1786. static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq)
  1787. {
  1788. return __qdf_nbuf_is_queue_empty(nbq);
  1789. }
  1790. static inline qdf_nbuf_queue_t *
  1791. qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src)
  1792. {
  1793. return __qdf_nbuf_queue_append(dest, src);
  1794. }
  1795. static inline void
  1796. qdf_nbuf_queue_free(qdf_nbuf_queue_t *head)
  1797. {
  1798. __qdf_nbuf_queue_free(head);
  1799. }
  1800. static inline qdf_nbuf_t
  1801. qdf_nbuf_queue_first(qdf_nbuf_queue_t *head)
  1802. {
  1803. return __qdf_nbuf_queue_first(head);
  1804. }
  1805. static inline qdf_nbuf_t
  1806. qdf_nbuf_queue_last(qdf_nbuf_queue_t *head)
  1807. {
  1808. return __qdf_nbuf_queue_last(head);
  1809. }
  1810. /**
  1811. * qdf_nbuf_get_protocol() - return the protocol value of the skb
  1812. * @skb: Pointer to network buffer
  1813. *
  1814. * Return: skb protocol
  1815. */
  1816. static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb)
  1817. {
  1818. return __qdf_nbuf_get_protocol(skb);
  1819. }
  1820. /**
  1821. * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb
  1822. * @skb: Pointer to network buffer
  1823. *
  1824. * Return: skb ip_summed
  1825. */
  1826. static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb)
  1827. {
  1828. return __qdf_nbuf_get_ip_summed(skb);
  1829. }
  1830. /**
  1831. * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb
  1832. * @skb: Pointer to network buffer
  1833. * @ip_summed: ip checksum
  1834. *
  1835. * Return: none
  1836. */
  1837. static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb,
  1838. uint8_t ip_summed)
  1839. {
  1840. __qdf_nbuf_set_ip_summed(skb, ip_summed);
  1841. }
  1842. /**
  1843. * qdf_nbuf_set_next() - add a packet to a linked list
  1844. * @this_buf: Predecessor buffer
  1845. * @next_buf: Successor buffer
  1846. *
  1847. * This function can be used to directly link nbufs, rather than using
  1848. * a separate network buffer queue object.
  1849. *
  1850. * Return: none
  1851. */
  1852. static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  1853. {
  1854. __qdf_nbuf_set_next(this_buf, next_buf);
  1855. }
  1856. /* nbuf extension routines */
  1857. /**
  1858. * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new
  1859. * nbuf
  1860. * @this_buf: predecessor buffer
  1861. * @next_buf: successor buffer
  1862. *
  1863. * This function is used to link up many nbufs containing a single logical
  1864. * packet - not a collection of packets. Do not use for linking the first
  1865. * extension to the head
  1866. *
  1867. * Return: none
  1868. */
  1869. static inline void
  1870. qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  1871. {
  1872. __qdf_nbuf_set_next_ext(this_buf, next_buf);
  1873. }
  1874. /**
  1875. * qdf_nbuf_next_ext() - get the next packet extension in the linked list
  1876. * @buf: Network buffer
  1877. *
  1878. * Return: Next network buffer in the linked list
  1879. */
  1880. static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf)
  1881. {
  1882. return __qdf_nbuf_next_ext(buf);
  1883. }
  1884. /**
  1885. * qdf_nbuf_append_ext_list() - link list of packet extensions to the head
  1886. * segment
  1887. * @head_buf: Network buf holding head segment (single)
  1888. * @ext_list: Network buf list holding linked extensions to the head
  1889. * @ext_len: Total length of all buffers in the extension list
  1890. *
  1891. * This function is used to link up a list of packet extensions (seg1, 2,
  1892. * ...) to the nbuf holding the head segment (seg0)
  1893. *
  1894. * Return: none
  1895. */
  1896. static inline void
  1897. qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list,
  1898. qdf_size_t ext_len)
  1899. {
  1900. __qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len);
  1901. }
  1902. /**
  1903. * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list.
  1904. * @head_buf: Network buf holding head segment (single)
  1905. *
  1906. * This ext_list is populated when we have Jumbo packet, for example in case of
  1907. * monitor mode amsdu packet reception, and are stiched using frags_list.
  1908. *
  1909. * Return: Network buf list holding linked extensions from head buf.
  1910. */
  1911. static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf)
  1912. {
  1913. return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf);
  1914. }
  1915. /**
  1916. * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand
  1917. * @buf: Network buffer
  1918. *
  1919. * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame
  1920. */
  1921. static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf)
  1922. {
  1923. return __qdf_nbuf_get_tx_cksum(buf);
  1924. }
  1925. /**
  1926. * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to
  1927. * indicate checksum info to the stack.
  1928. * @buf: Network buffer
  1929. * @cksum: Checksum
  1930. *
  1931. * Return: none
  1932. */
  1933. static inline void
  1934. qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum)
  1935. {
  1936. __qdf_nbuf_set_rx_cksum(buf, cksum);
  1937. }
  1938. /**
  1939. * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf
  1940. * @buf: Network buffer
  1941. *
  1942. * Return: TID value
  1943. */
  1944. static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf)
  1945. {
  1946. return __qdf_nbuf_get_tid(buf);
  1947. }
  1948. /**
  1949. * qdf_nbuf_set_tid() - this function sets the TID value in nbuf
  1950. * @buf: Network buffer
  1951. * @tid: TID value
  1952. *
  1953. * Return: none
  1954. */
  1955. static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid)
  1956. {
  1957. __qdf_nbuf_set_tid(buf, tid);
  1958. }
  1959. /**
  1960. * qdf_nbuf_get_exemption_type() - this function extracts the exemption type
  1961. * from nbuf
  1962. * @buf: Network buffer
  1963. *
  1964. * Return: Exemption type
  1965. */
  1966. static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf)
  1967. {
  1968. return __qdf_nbuf_get_exemption_type(buf);
  1969. }
  1970. /**
  1971. * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given
  1972. * offset
  1973. * @buf: Network buffer
  1974. * @proto: Protocol
  1975. *
  1976. * Return: none
  1977. */
  1978. static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto)
  1979. {
  1980. __qdf_nbuf_set_protocol(buf, proto);
  1981. }
  1982. /**
  1983. * qdf_nbuf_trace_get_proto_type() - this function return packet proto type
  1984. * @buf: Network buffer
  1985. *
  1986. * Return: Packet protocol type
  1987. */
  1988. static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf)
  1989. {
  1990. return __qdf_nbuf_trace_get_proto_type(buf);
  1991. }
  1992. /**
  1993. * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback
  1994. * @cb_func_ptr: Callback pointer
  1995. *
  1996. * Return: none
  1997. */
  1998. static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr)
  1999. {
  2000. __qdf_nbuf_reg_trace_cb(cb_func_ptr);
  2001. }
  2002. /**
  2003. * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download
  2004. * @buf: Network buffer
  2005. * @candi: Candidate of parallel download frame
  2006. *
  2007. * This function stores a flag specifying this TX frame is suitable for
  2008. * downloading though a 2nd TX data pipe that is used for short frames for
  2009. * protocols that can accept out-of-order delivery.
  2010. *
  2011. * Return: none
  2012. */
  2013. static inline void
  2014. qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi)
  2015. {
  2016. __qdf_nbuf_set_tx_htt2_frm(buf, candi);
  2017. }
  2018. /**
  2019. * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download
  2020. * @buf: Network buffer
  2021. *
  2022. * This function return whether this TX frame is allow to download though a 2nd
  2023. * TX data pipe or not.
  2024. *
  2025. * Return: none
  2026. */
  2027. static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf)
  2028. {
  2029. return __qdf_nbuf_get_tx_htt2_frm(buf);
  2030. }
  2031. /**
  2032. * qdf_nbuf_get_dhcp_subtype() - get the subtype
  2033. * of DHCP packet.
  2034. * @buf: Pointer to DHCP packet buffer
  2035. *
  2036. * This func. returns the subtype of DHCP packet.
  2037. *
  2038. * Return: subtype of the DHCP packet.
  2039. */
  2040. static inline enum qdf_proto_subtype
  2041. qdf_nbuf_get_dhcp_subtype(qdf_nbuf_t buf)
  2042. {
  2043. return __qdf_nbuf_data_get_dhcp_subtype(qdf_nbuf_data(buf));
  2044. }
  2045. /**
  2046. * qdf_nbuf_data_get_dhcp_subtype() - get the subtype
  2047. * of DHCP packet.
  2048. * @buf: Pointer to DHCP packet data buffer
  2049. *
  2050. * This func. returns the subtype of DHCP packet.
  2051. *
  2052. * Return: subtype of the DHCP packet.
  2053. */
  2054. static inline enum qdf_proto_subtype
  2055. qdf_nbuf_data_get_dhcp_subtype(uint8_t *data)
  2056. {
  2057. return __qdf_nbuf_data_get_dhcp_subtype(data);
  2058. }
  2059. /**
  2060. * qdf_nbuf_get_eapol_subtype() - get the subtype
  2061. * of EAPOL packet.
  2062. * @buf: Pointer to EAPOL packet buffer
  2063. *
  2064. * This func. returns the subtype of EAPOL packet.
  2065. *
  2066. * Return: subtype of the EAPOL packet.
  2067. */
  2068. static inline enum qdf_proto_subtype
  2069. qdf_nbuf_get_eapol_subtype(qdf_nbuf_t buf)
  2070. {
  2071. return __qdf_nbuf_data_get_eapol_subtype(qdf_nbuf_data(buf));
  2072. }
  2073. /**
  2074. * qdf_nbuf_data_get_eapol_subtype() - get the subtype
  2075. * of EAPOL packet.
  2076. * @data: Pointer to EAPOL packet data buffer
  2077. *
  2078. * This func. returns the subtype of EAPOL packet.
  2079. *
  2080. * Return: subtype of the EAPOL packet.
  2081. */
  2082. static inline enum qdf_proto_subtype
  2083. qdf_nbuf_data_get_eapol_subtype(uint8_t *data)
  2084. {
  2085. return __qdf_nbuf_data_get_eapol_subtype(data);
  2086. }
  2087. /**
  2088. * qdf_nbuf_get_arp_subtype() - get the subtype
  2089. * of ARP packet.
  2090. * @buf: Pointer to ARP packet buffer
  2091. *
  2092. * This func. returns the subtype of ARP packet.
  2093. *
  2094. * Return: subtype of the ARP packet.
  2095. */
  2096. static inline enum qdf_proto_subtype
  2097. qdf_nbuf_get_arp_subtype(qdf_nbuf_t buf)
  2098. {
  2099. return __qdf_nbuf_data_get_arp_subtype(qdf_nbuf_data(buf));
  2100. }
  2101. /**
  2102. * qdf_nbuf_data_get_arp_subtype() - get the subtype
  2103. * of ARP packet.
  2104. * @data: Pointer to ARP packet data buffer
  2105. *
  2106. * This func. returns the subtype of ARP packet.
  2107. *
  2108. * Return: subtype of the ARP packet.
  2109. */
  2110. static inline enum qdf_proto_subtype
  2111. qdf_nbuf_data_get_arp_subtype(uint8_t *data)
  2112. {
  2113. return __qdf_nbuf_data_get_arp_subtype(data);
  2114. }
  2115. /**
  2116. * qdf_nbuf_get_icmp_subtype() - get the subtype
  2117. * of IPV4 ICMP packet.
  2118. * @buf: Pointer to IPV4 ICMP packet buffer
  2119. *
  2120. * This func. returns the subtype of ICMP packet.
  2121. *
  2122. * Return: subtype of the ICMP packet.
  2123. */
  2124. static inline enum qdf_proto_subtype
  2125. qdf_nbuf_get_icmp_subtype(qdf_nbuf_t buf)
  2126. {
  2127. return __qdf_nbuf_data_get_icmp_subtype(qdf_nbuf_data(buf));
  2128. }
  2129. /**
  2130. * qdf_nbuf_data_get_icmp_subtype() - get the subtype
  2131. * of IPV4 ICMP packet.
  2132. * @data: Pointer to IPV4 ICMP packet data buffer
  2133. *
  2134. * This func. returns the subtype of ICMP packet.
  2135. *
  2136. * Return: subtype of the ICMP packet.
  2137. */
  2138. static inline enum qdf_proto_subtype
  2139. qdf_nbuf_data_get_icmp_subtype(uint8_t *data)
  2140. {
  2141. return __qdf_nbuf_data_get_icmp_subtype(data);
  2142. }
  2143. /**
  2144. * qdf_nbuf_get_icmpv6_subtype() - get the subtype
  2145. * of IPV6 ICMPV6 packet.
  2146. * @buf: Pointer to IPV6 ICMPV6 packet buffer
  2147. *
  2148. * This func. returns the subtype of ICMPV6 packet.
  2149. *
  2150. * Return: subtype of the ICMPV6 packet.
  2151. */
  2152. static inline enum qdf_proto_subtype
  2153. qdf_nbuf_get_icmpv6_subtype(qdf_nbuf_t buf)
  2154. {
  2155. return __qdf_nbuf_data_get_icmpv6_subtype(qdf_nbuf_data(buf));
  2156. }
  2157. /**
  2158. * qdf_nbuf_data_get_icmpv6_subtype() - get the subtype
  2159. * of IPV6 ICMPV6 packet.
  2160. * @data: Pointer to IPV6 ICMPV6 packet data buffer
  2161. *
  2162. * This func. returns the subtype of ICMPV6 packet.
  2163. *
  2164. * Return: subtype of the ICMPV6 packet.
  2165. */
  2166. static inline enum qdf_proto_subtype
  2167. qdf_nbuf_data_get_icmpv6_subtype(uint8_t *data)
  2168. {
  2169. return __qdf_nbuf_data_get_icmpv6_subtype(data);
  2170. }
  2171. /**
  2172. * qdf_nbuf_data_get_ipv4_proto() - get the proto type
  2173. * of IPV4 packet.
  2174. * @data: Pointer to IPV4 packet data buffer
  2175. *
  2176. * This func. returns the proto type of IPV4 packet.
  2177. *
  2178. * Return: proto type of IPV4 packet.
  2179. */
  2180. static inline uint8_t
  2181. qdf_nbuf_data_get_ipv4_proto(uint8_t *data)
  2182. {
  2183. return __qdf_nbuf_data_get_ipv4_proto(data);
  2184. }
  2185. /**
  2186. * qdf_nbuf_data_get_ipv6_proto() - get the proto type
  2187. * of IPV6 packet.
  2188. * @data: Pointer to IPV6 packet data buffer
  2189. *
  2190. * This func. returns the proto type of IPV6 packet.
  2191. *
  2192. * Return: proto type of IPV6 packet.
  2193. */
  2194. static inline uint8_t
  2195. qdf_nbuf_data_get_ipv6_proto(uint8_t *data)
  2196. {
  2197. return __qdf_nbuf_data_get_ipv6_proto(data);
  2198. }
  2199. /**
  2200. * qdf_nbuf_is_ipv4_pkt() - check if packet is a ipv4 packet or not
  2201. * @buf: buffer
  2202. *
  2203. * This api is for Tx packets.
  2204. *
  2205. * Return: true if packet is ipv4 packet
  2206. */
  2207. static inline
  2208. bool qdf_nbuf_is_ipv4_pkt(qdf_nbuf_t buf)
  2209. {
  2210. return __qdf_nbuf_data_is_ipv4_pkt(qdf_nbuf_data(buf));
  2211. }
  2212. /**
  2213. * qdf_nbuf_data_is_ipv4_pkt() - check if packet is a ipv4 packet or not
  2214. * @data: data
  2215. *
  2216. * This api is for Tx packets.
  2217. *
  2218. * Return: true if packet is ipv4 packet
  2219. */
  2220. static inline
  2221. bool qdf_nbuf_data_is_ipv4_pkt(uint8_t *data)
  2222. {
  2223. return __qdf_nbuf_data_is_ipv4_pkt(data);
  2224. }
  2225. /**
  2226. * qdf_nbuf_is_ipv4_dhcp_pkt() - check if packet is a dhcp packet or not
  2227. * @buf: buffer
  2228. *
  2229. * This api is for ipv4 packet.
  2230. *
  2231. * Return: true if packet is DHCP packet
  2232. */
  2233. static inline
  2234. bool qdf_nbuf_is_ipv4_dhcp_pkt(qdf_nbuf_t buf)
  2235. {
  2236. return __qdf_nbuf_data_is_ipv4_dhcp_pkt(qdf_nbuf_data(buf));
  2237. }
  2238. /**
  2239. * qdf_nbuf_data_is_ipv4_dhcp_pkt() - check if it is DHCP packet.
  2240. * @data: Pointer to DHCP packet data buffer
  2241. *
  2242. * This func. checks whether it is a DHCP packet or not.
  2243. *
  2244. * Return: true if it is a DHCP packet
  2245. * false if not
  2246. */
  2247. static inline
  2248. bool qdf_nbuf_data_is_ipv4_dhcp_pkt(uint8_t *data)
  2249. {
  2250. return __qdf_nbuf_data_is_ipv4_dhcp_pkt(data);
  2251. }
  2252. /**
  2253. * qdf_nbuf_data_is_ipv6_dhcp_pkt() - check if it is DHCP packet.
  2254. * @data: Pointer to DHCP packet data buffer
  2255. *
  2256. * This func. checks whether it is a DHCP packet or not.
  2257. *
  2258. * Return: true if it is a DHCP packet
  2259. * false if not
  2260. */
  2261. static inline
  2262. bool qdf_nbuf_is_ipv6_dhcp_pkt(qdf_nbuf_t buf)
  2263. {
  2264. return __qdf_nbuf_data_is_ipv6_dhcp_pkt(qdf_nbuf_data(buf));
  2265. }
  2266. /**
  2267. * qdf_nbuf_is_ipv4_eapol_pkt() - check if packet is a eapol packet or not
  2268. * @buf: buffer
  2269. *
  2270. * This api is for ipv4 packet.
  2271. *
  2272. * Return: true if packet is EAPOL packet
  2273. */
  2274. static inline
  2275. bool qdf_nbuf_is_ipv4_eapol_pkt(qdf_nbuf_t buf)
  2276. {
  2277. return __qdf_nbuf_data_is_ipv4_eapol_pkt(qdf_nbuf_data(buf));
  2278. }
  2279. /**
  2280. * qdf_nbuf_data_is_ipv4_eapol_pkt() - check if it is EAPOL packet.
  2281. * @data: Pointer to EAPOL packet data buffer
  2282. *
  2283. * This func. checks whether it is a EAPOL packet or not.
  2284. *
  2285. * Return: true if it is a EAPOL packet
  2286. * false if not
  2287. */
  2288. static inline
  2289. bool qdf_nbuf_data_is_ipv4_eapol_pkt(uint8_t *data)
  2290. {
  2291. return __qdf_nbuf_data_is_ipv4_eapol_pkt(data);
  2292. }
  2293. /**
  2294. * qdf_nbuf_is_ipv4_wapi_pkt() - check if packet is a wapi packet or not
  2295. * @buf: buffer
  2296. *
  2297. * This api is for ipv4 packet.
  2298. *
  2299. * Return: true if packet is WAPI packet
  2300. */
  2301. static inline
  2302. bool qdf_nbuf_is_ipv4_wapi_pkt(qdf_nbuf_t buf)
  2303. {
  2304. return __qdf_nbuf_is_ipv4_wapi_pkt(buf);
  2305. }
  2306. /**
  2307. * qdf_nbuf_is_ipv4_tdls_pkt() - check if packet is a tdls packet or not
  2308. * @buf: buffer
  2309. *
  2310. * This api is for ipv4 packet.
  2311. *
  2312. * Return: true if packet is TDLS packet
  2313. */
  2314. static inline
  2315. bool qdf_nbuf_is_ipv4_tdls_pkt(qdf_nbuf_t buf)
  2316. {
  2317. return __qdf_nbuf_is_ipv4_tdls_pkt(buf);
  2318. }
  2319. /**
  2320. * qdf_nbuf_is_ipv4_arp_pkt() - check if packet is a arp packet or not
  2321. * @buf: buffer
  2322. *
  2323. * This api is for ipv4 packet.
  2324. *
  2325. * Return: true if packet is ARP packet
  2326. */
  2327. static inline
  2328. bool qdf_nbuf_is_ipv4_arp_pkt(qdf_nbuf_t buf)
  2329. {
  2330. return __qdf_nbuf_data_is_ipv4_arp_pkt(qdf_nbuf_data(buf));
  2331. }
  2332. /**
  2333. * qdf_nbuf_data_is_ipv4_arp_pkt() - check if it is ARP packet.
  2334. * @data: Pointer to ARP packet data buffer
  2335. *
  2336. * This func. checks whether it is a ARP packet or not.
  2337. *
  2338. * Return: TRUE if it is a ARP packet
  2339. * FALSE if not
  2340. */
  2341. static inline
  2342. bool qdf_nbuf_data_is_ipv4_arp_pkt(uint8_t *data)
  2343. {
  2344. return __qdf_nbuf_data_is_ipv4_arp_pkt(data);
  2345. }
  2346. /**
  2347. * qdf_nbuf_data_is_arp_req() - check if ARP packet is request.
  2348. * @buf: buffer
  2349. *
  2350. * This func. checks whether it is a ARP request or not.
  2351. *
  2352. * Return: true if it is a ARP request or FALSE if not
  2353. */
  2354. static inline
  2355. bool qdf_nbuf_data_is_arp_req(qdf_nbuf_t buf)
  2356. {
  2357. return __qdf_nbuf_data_is_arp_req(qdf_nbuf_data(buf));
  2358. }
  2359. /**
  2360. * qdf_nbuf_data_is_arp_rsp() - check if ARP packet is response.
  2361. * @buf: buffer
  2362. *
  2363. * This func. checks whether it is a ARP response or not.
  2364. *
  2365. * Return: true if it is a ARP response or FALSE if not
  2366. */
  2367. static inline
  2368. bool qdf_nbuf_data_is_arp_rsp(qdf_nbuf_t buf)
  2369. {
  2370. return __qdf_nbuf_data_is_arp_rsp(qdf_nbuf_data(buf));
  2371. }
  2372. /**
  2373. * qdf_nbuf_data_get_arp_src_ip() - get ARP packet source IP gateway.
  2374. * @buf: buffer
  2375. *
  2376. * Return: ARP packet source IP value.
  2377. */
  2378. static inline
  2379. uint32_t qdf_nbuf_get_arp_src_ip(qdf_nbuf_t buf)
  2380. {
  2381. return __qdf_nbuf_get_arp_src_ip(qdf_nbuf_data(buf));
  2382. }
  2383. /**
  2384. * qdf_nbuf_data_get_arp_tgt_ip() - get ARP packet target IP gateway.
  2385. * @buf: buffer
  2386. *
  2387. * Return: ARP packet target IP value.
  2388. */
  2389. static inline
  2390. uint32_t qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_t buf)
  2391. {
  2392. return __qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_data(buf));
  2393. }
  2394. /**
  2395. * qdf_nbuf_get_dns_domain_name() - get dns domain name of required length
  2396. * @buf: buffer
  2397. * @len: length to copy
  2398. *
  2399. * Return: dns domain name
  2400. */
  2401. static inline
  2402. uint8_t *qdf_nbuf_get_dns_domain_name(qdf_nbuf_t buf, uint32_t len)
  2403. {
  2404. return __qdf_nbuf_get_dns_domain_name(qdf_nbuf_data(buf), len);
  2405. }
  2406. /**
  2407. * qdf_nbuf_data_is_dns_query() - check if skb data is a dns query
  2408. * @buf: buffer
  2409. *
  2410. * Return: true if packet is dns query packet.
  2411. * false otherwise.
  2412. */
  2413. static inline
  2414. bool qdf_nbuf_data_is_dns_query(qdf_nbuf_t buf)
  2415. {
  2416. return __qdf_nbuf_data_is_dns_query(qdf_nbuf_data(buf));
  2417. }
  2418. /**
  2419. * qdf_nbuf_data_is_dns_response() - check if skb data is a dns response
  2420. * @buf: buffer
  2421. *
  2422. * Return: true if packet is dns response packet.
  2423. * false otherwise.
  2424. */
  2425. static inline
  2426. bool qdf_nbuf_data_is_dns_response(qdf_nbuf_t buf)
  2427. {
  2428. return __qdf_nbuf_data_is_dns_response(qdf_nbuf_data(buf));
  2429. }
  2430. /**
  2431. * qdf_nbuf_data_is_tcp_syn() - check if skb data is a tcp syn
  2432. * @buf: buffer
  2433. *
  2434. * Return: true if packet is tcp syn packet.
  2435. * false otherwise.
  2436. */
  2437. static inline
  2438. bool qdf_nbuf_data_is_tcp_syn(qdf_nbuf_t buf)
  2439. {
  2440. return __qdf_nbuf_data_is_tcp_syn(qdf_nbuf_data(buf));
  2441. }
  2442. /**
  2443. * qdf_nbuf_data_is_tcp_syn_ack() - check if skb data is a tcp syn ack
  2444. * @buf: buffer
  2445. *
  2446. * Return: true if packet is tcp syn ack packet.
  2447. * false otherwise.
  2448. */
  2449. static inline
  2450. bool qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_t buf)
  2451. {
  2452. return __qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_data(buf));
  2453. }
  2454. /**
  2455. * qdf_nbuf_data_is_tcp_ack() - check if skb data is a tcp ack
  2456. * @buf: buffer
  2457. *
  2458. * Return: true if packet is tcp ack packet.
  2459. * false otherwise.
  2460. */
  2461. static inline
  2462. bool qdf_nbuf_data_is_tcp_ack(qdf_nbuf_t buf)
  2463. {
  2464. return __qdf_nbuf_data_is_tcp_ack(qdf_nbuf_data(buf));
  2465. }
  2466. /**
  2467. * qdf_nbuf_data_get_tcp_src_port() - get tcp src port
  2468. * @buf: buffer
  2469. *
  2470. * Return: tcp source port value.
  2471. */
  2472. static inline
  2473. uint16_t qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_t buf)
  2474. {
  2475. return __qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_data(buf));
  2476. }
  2477. /**
  2478. * qdf_nbuf_data_get_tcp_dst_port() - get tcp dst port
  2479. * @buf: buffer
  2480. *
  2481. * Return: tcp destination port value.
  2482. */
  2483. static inline
  2484. uint16_t qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_t buf)
  2485. {
  2486. return __qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_data(buf));
  2487. }
  2488. /**
  2489. * qdf_nbuf_data_is_icmpv4_req() - check if ICMPv4 packet is request.
  2490. * @buf: buffer
  2491. *
  2492. * This func. checks whether it is a ICMPv4 request or not.
  2493. *
  2494. * Return: true if it is a ICMPv4 request or fALSE if not
  2495. */
  2496. static inline
  2497. bool qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_t buf)
  2498. {
  2499. return __qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_data(buf));
  2500. }
  2501. /**
  2502. * qdf_nbuf_data_is_icmpv4_rsp() - check if ICMPv4 packet is res
  2503. * @buf: buffer
  2504. *
  2505. * Return: true if packet is icmpv4 response
  2506. * false otherwise.
  2507. */
  2508. static inline
  2509. bool qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_t buf)
  2510. {
  2511. return __qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_data(buf));
  2512. }
  2513. /**
  2514. * qdf_nbuf_get_icmpv4_src_ip() - get icmpv4 src IP
  2515. * @buf: buffer
  2516. *
  2517. * Return: icmpv4 packet source IP value.
  2518. */
  2519. static inline
  2520. uint32_t qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_t buf)
  2521. {
  2522. return __qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_data(buf));
  2523. }
  2524. /**
  2525. * qdf_nbuf_data_get_icmpv4_tgt_ip() - get icmpv4 target IP
  2526. * @buf: buffer
  2527. *
  2528. * Return: icmpv4 packet target IP value.
  2529. */
  2530. static inline
  2531. uint32_t qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_t buf)
  2532. {
  2533. return __qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_data(buf));
  2534. }
  2535. /**
  2536. * qdf_nbuf_is_ipv6_pkt() - check if it is IPV6 packet.
  2537. * @buf: Pointer to IPV6 packet buffer
  2538. *
  2539. * This func. checks whether it is a IPV6 packet or not.
  2540. *
  2541. * Return: TRUE if it is a IPV6 packet
  2542. * FALSE if not
  2543. */
  2544. static inline
  2545. bool qdf_nbuf_is_ipv6_pkt(qdf_nbuf_t buf)
  2546. {
  2547. return __qdf_nbuf_data_is_ipv6_pkt(qdf_nbuf_data(buf));
  2548. }
  2549. /**
  2550. * qdf_nbuf_data_is_ipv6_pkt() - check if it is IPV6 packet.
  2551. * @data: Pointer to IPV6 packet data buffer
  2552. *
  2553. * This func. checks whether it is a IPV6 packet or not.
  2554. *
  2555. * Return: TRUE if it is a IPV6 packet
  2556. * FALSE if not
  2557. */
  2558. static inline
  2559. bool qdf_nbuf_data_is_ipv6_pkt(uint8_t *data)
  2560. {
  2561. return __qdf_nbuf_data_is_ipv6_pkt(data);
  2562. }
  2563. /**
  2564. * qdf_nbuf_data_is_ipv4_mcast_pkt() - check if it is IPV4 multicast packet.
  2565. * @data: Pointer to IPV4 packet data buffer
  2566. *
  2567. * This func. checks whether it is a IPV4 multicast packet or not.
  2568. *
  2569. * Return: TRUE if it is a IPV4 multicast packet
  2570. * FALSE if not
  2571. */
  2572. static inline
  2573. bool qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data)
  2574. {
  2575. return __qdf_nbuf_data_is_ipv4_mcast_pkt(data);
  2576. }
  2577. /**
  2578. * qdf_nbuf_data_is_ipv6_mcast_pkt() - check if it is IPV6 multicast packet.
  2579. * @data: Pointer to IPV6 packet data buffer
  2580. *
  2581. * This func. checks whether it is a IPV6 multicast packet or not.
  2582. *
  2583. * Return: TRUE if it is a IPV6 multicast packet
  2584. * FALSE if not
  2585. */
  2586. static inline
  2587. bool qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data)
  2588. {
  2589. return __qdf_nbuf_data_is_ipv6_mcast_pkt(data);
  2590. }
  2591. /**
  2592. * qdf_nbuf_is_icmp_pkt() - check if it is IPV4 ICMP packet.
  2593. * @buf: Pointer to IPV4 ICMP packet buffer
  2594. *
  2595. * This func. checks whether it is a ICMP packet or not.
  2596. *
  2597. * Return: TRUE if it is a ICMP packet
  2598. * FALSE if not
  2599. */
  2600. static inline
  2601. bool qdf_nbuf_is_icmp_pkt(qdf_nbuf_t buf)
  2602. {
  2603. return __qdf_nbuf_data_is_icmp_pkt(qdf_nbuf_data(buf));
  2604. }
  2605. /**
  2606. * qdf_nbuf_data_is_icmp_pkt() - check if it is IPV4 ICMP packet.
  2607. * @data: Pointer to IPV4 ICMP packet data buffer
  2608. *
  2609. * This func. checks whether it is a ICMP packet or not.
  2610. *
  2611. * Return: TRUE if it is a ICMP packet
  2612. * FALSE if not
  2613. */
  2614. static inline
  2615. bool qdf_nbuf_data_is_icmp_pkt(uint8_t *data)
  2616. {
  2617. return __qdf_nbuf_data_is_icmp_pkt(data);
  2618. }
  2619. /**
  2620. * qdf_nbuf_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
  2621. * @buf: Pointer to IPV6 ICMPV6 packet buffer
  2622. *
  2623. * This func. checks whether it is a ICMPV6 packet or not.
  2624. *
  2625. * Return: TRUE if it is a ICMPV6 packet
  2626. * FALSE if not
  2627. */
  2628. static inline
  2629. bool qdf_nbuf_is_icmpv6_pkt(qdf_nbuf_t buf)
  2630. {
  2631. return __qdf_nbuf_data_is_icmpv6_pkt(qdf_nbuf_data(buf));
  2632. }
  2633. /**
  2634. * qdf_nbuf_data_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
  2635. * @data: Pointer to IPV6 ICMPV6 packet data buffer
  2636. *
  2637. * This func. checks whether it is a ICMPV6 packet or not.
  2638. *
  2639. * Return: TRUE if it is a ICMPV6 packet
  2640. * FALSE if not
  2641. */
  2642. static inline
  2643. bool qdf_nbuf_data_is_icmpv6_pkt(uint8_t *data)
  2644. {
  2645. return __qdf_nbuf_data_is_icmpv6_pkt(data);
  2646. }
  2647. /**
  2648. * qdf_nbuf_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
  2649. * @buf: Pointer to IPV4 UDP packet buffer
  2650. *
  2651. * This func. checks whether it is a IPV4 UDP packet or not.
  2652. *
  2653. * Return: TRUE if it is a IPV4 UDP packet
  2654. * FALSE if not
  2655. */
  2656. static inline
  2657. bool qdf_nbuf_is_ipv4_udp_pkt(qdf_nbuf_t buf)
  2658. {
  2659. return __qdf_nbuf_data_is_ipv4_udp_pkt(qdf_nbuf_data(buf));
  2660. }
  2661. /**
  2662. * qdf_nbuf_data_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
  2663. * @data: Pointer to IPV4 UDP packet data buffer
  2664. *
  2665. * This func. checks whether it is a IPV4 UDP packet or not.
  2666. *
  2667. * Return: TRUE if it is a IPV4 UDP packet
  2668. * FALSE if not
  2669. */
  2670. static inline
  2671. bool qdf_nbuf_data_is_ipv4_udp_pkt(uint8_t *data)
  2672. {
  2673. return __qdf_nbuf_data_is_ipv4_udp_pkt(data);
  2674. }
  2675. /**
  2676. * qdf_nbuf_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
  2677. * @buf: Pointer to IPV4 TCP packet buffer
  2678. *
  2679. * This func. checks whether it is a IPV4 TCP packet or not.
  2680. *
  2681. * Return: TRUE if it is a IPV4 TCP packet
  2682. * FALSE if not
  2683. */
  2684. static inline
  2685. bool qdf_nbuf_is_ipv4_tcp_pkt(qdf_nbuf_t buf)
  2686. {
  2687. return __qdf_nbuf_data_is_ipv4_tcp_pkt(qdf_nbuf_data(buf));
  2688. }
  2689. /**
  2690. * qdf_nbuf_data_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
  2691. * @data: Pointer to IPV4 TCP packet data buffer
  2692. *
  2693. * This func. checks whether it is a IPV4 TCP packet or not.
  2694. *
  2695. * Return: TRUE if it is a IPV4 TCP packet
  2696. * FALSE if not
  2697. */
  2698. static inline
  2699. bool qdf_nbuf_data_is_ipv4_tcp_pkt(uint8_t *data)
  2700. {
  2701. return __qdf_nbuf_data_is_ipv4_tcp_pkt(data);
  2702. }
  2703. /**
  2704. * qdf_nbuf_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
  2705. * @buf: Pointer to IPV6 UDP packet buffer
  2706. *
  2707. * This func. checks whether it is a IPV6 UDP packet or not.
  2708. *
  2709. * Return: TRUE if it is a IPV6 UDP packet
  2710. * FALSE if not
  2711. */
  2712. static inline
  2713. bool qdf_nbuf_is_ipv6_udp_pkt(qdf_nbuf_t buf)
  2714. {
  2715. return __qdf_nbuf_data_is_ipv6_udp_pkt(qdf_nbuf_data(buf));
  2716. }
  2717. /**
  2718. * qdf_nbuf_data_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
  2719. * @data: Pointer to IPV6 UDP packet data buffer
  2720. *
  2721. * This func. checks whether it is a IPV6 UDP packet or not.
  2722. *
  2723. * Return: TRUE if it is a IPV6 UDP packet
  2724. * FALSE if not
  2725. */
  2726. static inline
  2727. bool qdf_nbuf_data_is_ipv6_udp_pkt(uint8_t *data)
  2728. {
  2729. return __qdf_nbuf_data_is_ipv6_udp_pkt(data);
  2730. }
  2731. /**
  2732. * qdf_nbuf_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
  2733. * @buf: Pointer to IPV6 TCP packet buffer
  2734. *
  2735. * This func. checks whether it is a IPV6 TCP packet or not.
  2736. *
  2737. * Return: TRUE if it is a IPV6 TCP packet
  2738. * FALSE if not
  2739. */
  2740. static inline
  2741. bool qdf_nbuf_is_ipv6_tcp_pkt(qdf_nbuf_t buf)
  2742. {
  2743. return __qdf_nbuf_data_is_ipv6_tcp_pkt(qdf_nbuf_data(buf));
  2744. }
  2745. /**
  2746. * qdf_nbuf_data_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
  2747. * @data: Pointer to IPV6 TCP packet data buffer
  2748. *
  2749. * This func. checks whether it is a IPV6 TCP packet or not.
  2750. *
  2751. * Return: TRUE if it is a IPV6 TCP packet
  2752. * FALSE if not
  2753. */
  2754. static inline
  2755. bool qdf_nbuf_data_is_ipv6_tcp_pkt(uint8_t *data)
  2756. {
  2757. return __qdf_nbuf_data_is_ipv6_tcp_pkt(data);
  2758. }
  2759. /**
  2760. * qdf_nbuf_is_bcast_pkt() - check if it is broadcast packet.
  2761. * @buf: Network buffer
  2762. *
  2763. * This func. checks whether packet is broadcast or not.
  2764. *
  2765. * Return: TRUE if it is broadcast packet
  2766. * FALSE if not
  2767. */
  2768. static inline
  2769. bool qdf_nbuf_is_bcast_pkt(qdf_nbuf_t buf)
  2770. {
  2771. return __qdf_nbuf_is_bcast_pkt(buf);
  2772. }
  2773. /**
  2774. * qdf_nbuf_reset_num_frags() - decrement the number of fragments
  2775. * @buf: Network buffer
  2776. *
  2777. * Return: Number of fragments
  2778. */
  2779. static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf)
  2780. {
  2781. __qdf_nbuf_reset_num_frags(buf);
  2782. }
  2783. /**
  2784. * qdf_dmaaddr_to_32s - return high and low parts of dma_addr
  2785. *
  2786. * Returns the high and low 32-bits of the DMA addr in the provided ptrs
  2787. *
  2788. * Return: N/A
  2789. */
  2790. static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
  2791. uint32_t *lo, uint32_t *hi)
  2792. {
  2793. return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi);
  2794. }
  2795. /**
  2796. * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO
  2797. * network buffer into segments
  2798. * @nbuf: network buffer to be segmented
  2799. * @tso_info: This is the output. The information about the
  2800. * TSO segments will be populated within this.
  2801. *
  2802. * This function fragments a TCP jumbo packet into smaller
  2803. * segments to be transmitted by the driver. It chains the TSO
  2804. * segments created into a list.
  2805. *
  2806. * Return: number of TSO segments
  2807. */
  2808. static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev,
  2809. qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info)
  2810. {
  2811. return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info);
  2812. }
  2813. /**
  2814. * qdf_nbuf_unmap_tso_segment() - function to dma unmap TSO segment element
  2815. *
  2816. * @osdev: qdf device handle
  2817. * @tso_seg: TSO segment element to be unmapped
  2818. * @is_last_seg: whether this is last tso seg or not
  2819. *
  2820. * Return: none
  2821. */
  2822. static inline void qdf_nbuf_unmap_tso_segment(qdf_device_t osdev,
  2823. struct qdf_tso_seg_elem_t *tso_seg,
  2824. bool is_last_seg)
  2825. {
  2826. return __qdf_nbuf_unmap_tso_segment(osdev, tso_seg, is_last_seg);
  2827. }
  2828. /**
  2829. * qdf_nbuf_get_tso_num_seg() - function to calculate the number
  2830. * of TCP segments within the TSO jumbo packet
  2831. * @nbuf: TSO jumbo network buffer to be segmented
  2832. *
  2833. * This function calculates the number of TCP segments that the
  2834. network buffer can be divided into.
  2835. *
  2836. * Return: number of TCP segments
  2837. */
  2838. static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf)
  2839. {
  2840. return __qdf_nbuf_get_tso_num_seg(nbuf);
  2841. }
  2842. /**
  2843. * qdf_nbuf_inc_users() - function to increment the number of
  2844. * users referencing this network buffer
  2845. *
  2846. * @nbuf: network buffer
  2847. *
  2848. * This function increments the number of users referencing this
  2849. * network buffer
  2850. *
  2851. * Return: the network buffer
  2852. */
  2853. static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf)
  2854. {
  2855. return __qdf_nbuf_inc_users(nbuf);
  2856. }
  2857. /**
  2858. * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb
  2859. *
  2860. * @nbuf: Network buffer (skb on linux)
  2861. *
  2862. * This function returns the values of data_attr field
  2863. * in struct cvg_nbuf_cb{}, to which skb->cb is typecast.
  2864. * This value is actually the value programmed in CE descriptor.
  2865. *
  2866. * Return: Value of data_attr
  2867. */
  2868. static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf)
  2869. {
  2870. return __qdf_nbuf_data_attr_get(buf);
  2871. }
  2872. /**
  2873. * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb
  2874. *
  2875. * @nbuf: Network buffer (skb on linux)
  2876. * @data_attr: Value to be stored cvg_nbuf_cb->data_attr
  2877. *
  2878. * This function stores the value to be programmed in CE
  2879. * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{}
  2880. *
  2881. * Return: void
  2882. */
  2883. static inline
  2884. void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr)
  2885. {
  2886. __qdf_nbuf_data_attr_set(buf, data_attr);
  2887. }
  2888. /**
  2889. * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata
  2890. *
  2891. * @nbuf: Network buffer (skb on linux)
  2892. *
  2893. * This function parses the payload to figure out relevant
  2894. * Tx meta-data e.g. whether to enable tx_classify bit
  2895. * in CE.
  2896. *
  2897. * Return: void
  2898. */
  2899. #define qdf_nbuf_tx_info_get __qdf_nbuf_tx_info_get
  2900. void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state);
  2901. void qdf_nbuf_tx_desc_count_display(void);
  2902. void qdf_nbuf_tx_desc_count_clear(void);
  2903. static inline qdf_nbuf_t
  2904. qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom)
  2905. {
  2906. return __qdf_nbuf_realloc_headroom(buf, headroom);
  2907. }
  2908. static inline qdf_nbuf_t
  2909. qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom)
  2910. {
  2911. return __qdf_nbuf_realloc_tailroom(buf, tailroom);
  2912. }
  2913. static inline qdf_nbuf_t
  2914. qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom)
  2915. {
  2916. return __qdf_nbuf_expand(buf, headroom, tailroom);
  2917. }
  2918. static inline int
  2919. qdf_nbuf_linearize(qdf_nbuf_t buf)
  2920. {
  2921. return __qdf_nbuf_linearize(buf);
  2922. }
  2923. #ifdef NBUF_MEMORY_DEBUG
  2924. #define qdf_nbuf_unshare(d) \
  2925. qdf_nbuf_unshare_debug(d, __func__, __LINE__)
  2926. static inline qdf_nbuf_t
  2927. qdf_nbuf_unshare_debug(qdf_nbuf_t buf, const char *func_name, uint32_t line_num)
  2928. {
  2929. qdf_nbuf_t unshared_buf;
  2930. unshared_buf = __qdf_nbuf_unshare(buf);
  2931. if (qdf_likely(buf != unshared_buf)) {
  2932. qdf_net_buf_debug_delete_node(buf);
  2933. qdf_net_buf_debug_add_node(unshared_buf, 0,
  2934. func_name, line_num);
  2935. }
  2936. return unshared_buf;
  2937. }
  2938. #else
  2939. static inline qdf_nbuf_t
  2940. qdf_nbuf_unshare(qdf_nbuf_t buf)
  2941. {
  2942. return __qdf_nbuf_unshare(buf);
  2943. }
  2944. #endif
  2945. static inline bool
  2946. qdf_nbuf_is_cloned(qdf_nbuf_t buf)
  2947. {
  2948. return __qdf_nbuf_is_cloned(buf);
  2949. }
  2950. static inline void
  2951. qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg)
  2952. {
  2953. __qdf_nbuf_frag_info(buf, sg);
  2954. }
  2955. static inline qdf_nbuf_tx_cksum_t
  2956. qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where)
  2957. {
  2958. return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where);
  2959. }
  2960. static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf)
  2961. {
  2962. __qdf_nbuf_reset_ctxt(nbuf);
  2963. }
  2964. static inline void qdf_nbuf_init(qdf_nbuf_t buf)
  2965. {
  2966. __qdf_nbuf_init(buf);
  2967. }
  2968. static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf)
  2969. {
  2970. return __qdf_nbuf_network_header(buf);
  2971. }
  2972. static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf)
  2973. {
  2974. return __qdf_nbuf_transport_header(buf);
  2975. }
  2976. static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf)
  2977. {
  2978. return __qdf_nbuf_tcp_tso_size(buf);
  2979. }
  2980. static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf)
  2981. {
  2982. return __qdf_nbuf_get_cb(nbuf);
  2983. }
  2984. static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf)
  2985. {
  2986. return __qdf_nbuf_get_nr_frags(nbuf);
  2987. }
  2988. static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf)
  2989. {
  2990. return __qdf_nbuf_headlen(buf);
  2991. }
  2992. static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev,
  2993. qdf_nbuf_t buf, int offset,
  2994. qdf_dma_dir_t dir, int cur_frag)
  2995. {
  2996. return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag);
  2997. }
  2998. static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf)
  2999. {
  3000. return __qdf_nbuf_tso_tcp_v4(buf);
  3001. }
  3002. static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf)
  3003. {
  3004. return __qdf_nbuf_tso_tcp_v6(buf);
  3005. }
  3006. static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf)
  3007. {
  3008. return __qdf_nbuf_tcp_seq(buf);
  3009. }
  3010. static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf)
  3011. {
  3012. return __qdf_nbuf_l2l3l4_hdr_len(buf);
  3013. }
  3014. static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf)
  3015. {
  3016. return __qdf_nbuf_is_nonlinear(buf);
  3017. }
  3018. static inline uint32_t
  3019. qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num)
  3020. {
  3021. return __qdf_nbuf_get_frag_size(buf, frag_num);
  3022. }
  3023. static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf)
  3024. {
  3025. return __qdf_nbuf_get_priority(buf);
  3026. }
  3027. static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p)
  3028. {
  3029. __qdf_nbuf_set_priority(buf, p);
  3030. }
  3031. static inline void qdf_nbuf_record_rx_queue(qdf_nbuf_t buf, uint32_t queue_id)
  3032. {
  3033. __qdf_nbuf_record_rx_queue(buf, queue_id);
  3034. }
  3035. static inline uint16_t
  3036. qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf)
  3037. {
  3038. return __qdf_nbuf_get_queue_mapping(buf);
  3039. }
  3040. static inline uint8_t *
  3041. qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf)
  3042. {
  3043. return __qdf_nbuf_get_priv_ptr(buf);
  3044. }
  3045. /**
  3046. * qdf_nbuf_update_radiotap() - update radiotap at head of nbuf.
  3047. * @rx_status: rx_status containing required info to update radiotap
  3048. * @nbuf: Pointer to nbuf
  3049. * @headroom_sz: Available headroom size
  3050. *
  3051. * Return: radiotap length.
  3052. */
  3053. unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status,
  3054. qdf_nbuf_t nbuf, uint32_t headroom_sz);
  3055. /**
  3056. * qdf_nbuf_mark_wakeup_frame() - mark wakeup frame.
  3057. * @buf: Pointer to nbuf
  3058. *
  3059. * Return: None
  3060. */
  3061. static inline void
  3062. qdf_nbuf_mark_wakeup_frame(qdf_nbuf_t buf)
  3063. {
  3064. __qdf_nbuf_mark_wakeup_frame(buf);
  3065. }
  3066. /**
  3067. * qdf_nbuf_reg_free_cb - Registers nbuf free callback
  3068. * @cb_func_ptr: Callback pointer
  3069. *
  3070. * This function registers nbuf free callback
  3071. *
  3072. * Return: void
  3073. */
  3074. static inline void
  3075. qdf_nbuf_reg_free_cb(qdf_nbuf_free_t cb_func_ptr)
  3076. {
  3077. __qdf_nbuf_reg_free_cb(cb_func_ptr);
  3078. }
  3079. /**
  3080. * qdf_nbuf_set_timestamp() - set the timestamp for frame
  3081. *
  3082. * @buf: sk buff
  3083. *
  3084. * Return: void
  3085. */
  3086. static inline void
  3087. qdf_nbuf_set_timestamp(struct sk_buff *skb)
  3088. {
  3089. __qdf_nbuf_set_timestamp(skb);
  3090. }
  3091. /**
  3092. * qdf_nbuf_get_timestamp() - get the timestamp for frame
  3093. *
  3094. * @buf: sk buff
  3095. *
  3096. * Return: timestamp stored in skb in ms
  3097. */
  3098. static inline uint64_t
  3099. qdf_nbuf_get_timestamp(struct sk_buff *skb)
  3100. {
  3101. return __qdf_nbuf_get_timestamp(skb);
  3102. }
  3103. /**
  3104. * qdf_nbuf_get_timedelta_ms() - get time difference in ms
  3105. *
  3106. * @buf: sk buff
  3107. *
  3108. * Return: time difference ms
  3109. */
  3110. static inline uint64_t
  3111. qdf_nbuf_get_timedelta_ms(struct sk_buff *skb)
  3112. {
  3113. return __qdf_nbuf_get_timedelta_ms(skb);
  3114. }
  3115. /**
  3116. * qdf_nbuf_get_timedelta_us() - get time difference in micro seconds
  3117. *
  3118. * @buf: sk buff
  3119. *
  3120. * Return: time difference in micro seconds
  3121. */
  3122. static inline uint64_t
  3123. qdf_nbuf_get_timedelta_us(struct sk_buff *skb)
  3124. {
  3125. return __qdf_nbuf_get_timedelta_us(skb);
  3126. }
  3127. /**
  3128. * qdf_nbuf_count_get() - get global nbuf gauge
  3129. *
  3130. * Return: global nbuf gauge
  3131. */
  3132. static inline int qdf_nbuf_count_get(void)
  3133. {
  3134. return __qdf_nbuf_count_get();
  3135. }
  3136. /**
  3137. * qdf_nbuf_count_inc() - increment nbuf global count
  3138. *
  3139. * @buf: sk buff
  3140. *
  3141. * Return: void
  3142. */
  3143. static inline void qdf_nbuf_count_inc(qdf_nbuf_t buf)
  3144. {
  3145. return __qdf_nbuf_count_inc(buf);
  3146. }
  3147. /**
  3148. * qdf_nbuf_count_dec() - decrement nbuf global count
  3149. *
  3150. * @buf: sk buff
  3151. *
  3152. * Return: void
  3153. */
  3154. static inline void qdf_nbuf_count_dec(qdf_nbuf_t buf)
  3155. {
  3156. return __qdf_nbuf_count_dec(buf);
  3157. }
  3158. /**
  3159. * qdf_nbuf_mod_init() - Intialization routine for qdf_nbuf
  3160. *
  3161. * Return void
  3162. */
  3163. static inline void qdf_nbuf_mod_init(void)
  3164. {
  3165. return __qdf_nbuf_mod_init();
  3166. }
  3167. /**
  3168. * qdf_nbuf_mod_init() - Unintialization routine for qdf_nbuf
  3169. *
  3170. * Return void
  3171. */
  3172. static inline void qdf_nbuf_mod_exit(void)
  3173. {
  3174. return __qdf_nbuf_mod_exit();
  3175. }
  3176. /**
  3177. * qdf_nbuf_orphan() - orphan a nbuf
  3178. * @buf: Pointer to network buffer
  3179. *
  3180. * If a buffer currently has an owner then we call the
  3181. * owner's destructor function
  3182. *
  3183. * Return: void
  3184. */
  3185. static inline void qdf_nbuf_orphan(qdf_nbuf_t buf)
  3186. {
  3187. return __qdf_nbuf_orphan(buf);
  3188. }
  3189. #ifdef CONFIG_NBUF_AP_PLATFORM
  3190. #include <i_qdf_nbuf_api_w.h>
  3191. #else
  3192. #include <i_qdf_nbuf_api_m.h>
  3193. #endif
  3194. #endif /* _QDF_NBUF_H */