qdf_nbuf.h 92 KB

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