qdf_nbuf.h 74 KB

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