qdf_nbuf.h 89 KB

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