qdf_nbuf.h 80 KB

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