qdf_nbuf.h 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349
  1. /*
  2. * Copyright (c) 2014-2017 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_nbuf.h>
  36. #include <i_qdf_trace.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_MAX_STRING 12
  45. #define QDF_NBUF_PKT_TRAC_PROTO_STRING 4
  46. #define QDF_NBUF_PKT_ERROR 1
  47. #define QDF_NBUF_TRAC_IPV4_OFFSET 14
  48. #define QDF_NBUF_TRAC_IPV4_HEADER_SIZE 20
  49. #define QDF_NBUF_TRAC_DHCP_SRV_PORT 67
  50. #define QDF_NBUF_TRAC_DHCP_CLI_PORT 68
  51. #define QDF_NBUF_TRAC_ETH_TYPE_OFFSET 12
  52. #define QDF_NBUF_TRAC_EAPOL_ETH_TYPE 0x888E
  53. #define QDF_NBUF_TRAC_WAPI_ETH_TYPE 0x88b4
  54. #define QDF_NBUF_TRAC_ARP_ETH_TYPE 0x0806
  55. #define QDF_NBUF_TRAC_IPV4_ETH_TYPE 0x0800
  56. #define QDF_NBUF_TRAC_IPV6_ETH_TYPE 0x86dd
  57. #define QDF_NBUF_DEST_MAC_OFFSET 0
  58. #define QDF_NBUF_SRC_MAC_OFFSET 6
  59. #define QDF_NBUF_TRAC_IPV4_PROTO_TYPE_OFFSET 23
  60. #define QDF_NBUF_TRAC_IPV4_DEST_ADDR_OFFSET 30
  61. #define QDF_NBUF_TRAC_IPV6_PROTO_TYPE_OFFSET 20
  62. #define QDF_NBUF_TRAC_IPV4_ADDR_MCAST_MASK 0xE0000000
  63. #define QDF_NBUF_TRAC_IPV4_ADDR_BCAST_MASK 0xF0000000
  64. #define QDF_NBUF_TRAC_IPV6_DEST_ADDR_OFFSET 38
  65. #define QDF_NBUF_TRAC_IPV6_DEST_ADDR 0xFF00
  66. #define QDF_NBUF_TRAC_ICMP_TYPE 1
  67. #define QDF_NBUF_TRAC_TCP_TYPE 6
  68. #define QDF_NBUF_TRAC_UDP_TYPE 17
  69. #define QDF_NBUF_TRAC_ICMPV6_TYPE 0x3a
  70. /* EAPOL Related MASK */
  71. #define EAPOL_PACKET_TYPE_OFFSET 15
  72. #define EAPOL_KEY_INFO_OFFSET 19
  73. #define EAPOL_PKT_LEN_OFFSET 16
  74. #define EAPOL_KEY_LEN_OFFSET 21
  75. #define EAPOL_MASK 0x8013
  76. #define EAPOL_M1_BIT_MASK 0x8000
  77. #define EAPOL_M2_BIT_MASK 0x0001
  78. #define EAPOL_M3_BIT_MASK 0x8013
  79. #define EAPOL_M4_BIT_MASK 0x0003
  80. /* Tracked Packet types */
  81. #define QDF_NBUF_TX_PKT_INVALID 0
  82. #define QDF_NBUF_TX_PKT_DATA_TRACK 1
  83. #define QDF_NBUF_TX_PKT_MGMT_TRACK 2
  84. /* Different Packet states */
  85. #define QDF_NBUF_TX_PKT_HDD 1
  86. #define QDF_NBUF_TX_PKT_TXRX_ENQUEUE 2
  87. #define QDF_NBUF_TX_PKT_TXRX_DEQUEUE 3
  88. #define QDF_NBUF_TX_PKT_TXRX 4
  89. #define QDF_NBUF_TX_PKT_HTT 5
  90. #define QDF_NBUF_TX_PKT_HTC 6
  91. #define QDF_NBUF_TX_PKT_HIF 7
  92. #define QDF_NBUF_TX_PKT_CE 8
  93. #define QDF_NBUF_TX_PKT_FREE 9
  94. #define QDF_NBUF_TX_PKT_STATE_MAX 10
  95. #define QDF_NBUF_TX_PKT_LI_DP 11
  96. /* Enable flag to print TSO specific prints in datapath */
  97. #ifdef TSO_DEBUG_LOG_ENABLE
  98. #define TSO_DEBUG(fmt, args ...) \
  99. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_NONE, \
  100. fmt, ## args)
  101. #else
  102. #define TSO_DEBUG(fmt, args ...)
  103. #endif
  104. /**
  105. * struct mon_rx_status - This will have monitor mode rx_status extracted from
  106. * htt_rx_desc used later to update radiotap information.
  107. * @tsft: Time Synchronization Function timer
  108. * @he_sig_A1: HE (11ax) sig A1 field
  109. * @he_sig_A2: HE (11ax) sig A1 field
  110. * @he_sig_b_user: HE (11ax) sig B user field
  111. * @he_sig_b_user_known: HE (11ax) sig B user known field
  112. * @chan_freq: Capture channel frequency
  113. * @chan_num: Capture channel number
  114. * @chan_flags: Bitmap of Channel flags, IEEE80211_CHAN_TURBO,
  115. * IEEE80211_CHAN_CCK...
  116. * @ht_flags: HT flags, only present for HT frames.
  117. * @vht_flags: VHT flags, only present for VHT frames.
  118. * @vht_flag_values1-5: Contains corresponding data for flags field
  119. * @he_flags: HE (11ax) flags, only present in HE frames
  120. * @he_sig_A1_known: HE (11ax) sig A1 known field
  121. * @he_sig_A2_known: HE (11ax) sig A2 known field
  122. * @he_sig_b_common: HE (11ax) sig B common field
  123. * @he_sig_b_common_known: HE (11ax) sig B common known field
  124. * @rate: Rate in terms 500Kbps
  125. * @rtap_flags: Bit map of available fields in the radiotap
  126. * @ant_signal_db: Rx packet RSSI
  127. * @nr_ant: Number of Antennas used for streaming
  128. * @mcs: MCS index of Rx frame
  129. * @bw: bandwidth of rx frame
  130. * @is_stbc: Is STBC enabled
  131. * @sgi: Rx frame short guard interval
  132. * @ldpc: ldpc enabled
  133. * @beamformed: Is frame beamformed.
  134. * @he_sig_b_common_RU[4]: HE (11ax) common RU assignment index
  135. */
  136. struct mon_rx_status {
  137. uint64_t tsft;
  138. uint32_t he_sig_A1;
  139. uint32_t he_sig_A2;
  140. uint32_t he_sig_b_user;
  141. uint32_t he_sig_b_user_known;
  142. uint16_t chan_freq;
  143. uint16_t chan_num;
  144. uint16_t chan_flags;
  145. uint16_t ht_flags;
  146. uint16_t vht_flags;
  147. uint16_t vht_flag_values6;
  148. uint16_t he_flags;
  149. uint16_t he_sig_A1_known;
  150. uint16_t he_sig_A2_known;
  151. uint16_t he_sig_b_common;
  152. uint16_t he_sig_b_common_known;
  153. uint8_t rate;
  154. uint8_t rtap_flags;
  155. uint8_t ant_signal_db;
  156. uint8_t nr_ant;
  157. uint8_t mcs;
  158. uint8_t bw;
  159. uint8_t vht_flag_values1;
  160. uint8_t vht_flag_values2;
  161. uint8_t vht_flag_values3[4];
  162. uint8_t vht_flag_values4;
  163. uint8_t vht_flag_values5;
  164. uint8_t is_stbc;
  165. uint8_t sgi;
  166. uint8_t ldpc;
  167. uint8_t beamformed;
  168. uint8_t he_sig_b_common_RU[4];
  169. };
  170. /* Masks for HE SIG known fields in mon_rx_status structure */
  171. #define QDF_MON_STATUS_HE_SIG_A1_SU_KNOWN_ALL 0x000007ff
  172. #define QDF_MON_STATUS_HE_SIG_A1_MU_KNOWN_ALL 0x000003ff
  173. #define QDF_MON_STATUS_HE_SIG_A2_SU_KNOWN_ALL 0x00000ffd
  174. #define QDF_MON_STATUS_HE_SIG_A2_MU_KNOWN_ALL 0x00000ffd
  175. #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU0 0x00000001
  176. #define QDF_MON_STATUS_HE_SIG_B_USER_KNOWN_SIG_B_ALL 0x00fe0000
  177. #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_SU 0x00000000
  178. #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_EXT_SU 0x40000000
  179. #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_MU 0x80000000
  180. #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_TRIG 0xc0000000
  181. /* DHCP Related Mask */
  182. #define QDF_DHCP_OPTION53 (0x35)
  183. #define QDF_DHCP_OPTION53_LENGTH (1)
  184. #define QDF_DHCP_OPTION53_OFFSET (0x11A)
  185. #define QDF_DHCP_OPTION53_LENGTH_OFFSET (0x11B)
  186. #define QDF_DHCP_OPTION53_STATUS_OFFSET (0x11C)
  187. #define DHCP_PKT_LEN_OFFSET 16
  188. #define DHCP_TRANSACTION_ID_OFFSET 46
  189. #define QDF_DHCP_DISCOVER (1)
  190. #define QDF_DHCP_OFFER (2)
  191. #define QDF_DHCP_REQUEST (3)
  192. #define QDF_DHCP_DECLINE (4)
  193. #define QDF_DHCP_ACK (5)
  194. #define QDF_DHCP_NAK (6)
  195. #define QDF_DHCP_RELEASE (7)
  196. #define QDF_DHCP_INFORM (8)
  197. /* ARP Related Mask */
  198. #define ARP_SUB_TYPE_OFFSET 20
  199. #define ARP_REQUEST (1)
  200. #define ARP_RESPONSE (2)
  201. /* IPV4 header fields offset values */
  202. #define IPV4_PKT_LEN_OFFSET 16
  203. #define IPV4_TCP_SEQ_NUM_OFFSET 38
  204. #define IPV4_SRC_ADDR_OFFSET 26
  205. #define IPV4_DST_ADDR_OFFSET 30
  206. #define IPV4_SRC_PORT_OFFSET 34
  207. #define IPV4_DST_PORT_OFFSET 36
  208. /* IPV4 ICMP Related Mask */
  209. #define ICMP_SEQ_NUM_OFFSET 40
  210. #define ICMP_SUBTYPE_OFFSET 34
  211. #define ICMP_REQUEST 0x08
  212. #define ICMP_RESPONSE 0x00
  213. #define IPV6_ADDR_STR "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:"\
  214. "%02x%02x:%02x%02x"
  215. /* IPV6 header fields offset values */
  216. #define IPV6_PKT_LEN_OFFSET 18
  217. #define IPV6_TCP_SEQ_NUM_OFFSET 58
  218. #define IPV6_SRC_ADDR_OFFSET 22
  219. #define IPV6_DST_ADDR_OFFSET 38
  220. #define IPV6_SRC_PORT_OFFSET 54
  221. #define IPV6_DST_PORT_OFFSET 56
  222. /* IPV6 ICMPV6 Related Mask */
  223. #define ICMPV6_SEQ_NUM_OFFSET 60
  224. #define ICMPV6_SUBTYPE_OFFSET 54
  225. #define ICMPV6_REQUEST 0x80
  226. #define ICMPV6_RESPONSE 0x81
  227. #define ICMPV6_RS 0x85
  228. #define ICMPV6_RA 0x86
  229. #define ICMPV6_NS 0x87
  230. #define ICMPV6_NA 0x88
  231. #define QDF_NBUF_IPA_CHECK_MASK 0x80000000
  232. /**
  233. * qdf_proto_type - protocol type
  234. * @QDF_PROTO_TYPE_DHCP - DHCP
  235. * @QDF_PROTO_TYPE_EAPOL - EAPOL
  236. * @QDF_PROTO_TYPE_ARP - ARP
  237. * @QDF_PROTO_TYPE_MGMT - MGMT
  238. * @QDF_PROTO_TYPE_ICMP - ICMP
  239. * QDF_PROTO_TYPE_EVENT - EVENT
  240. */
  241. enum qdf_proto_type {
  242. QDF_PROTO_TYPE_DHCP,
  243. QDF_PROTO_TYPE_EAPOL,
  244. QDF_PROTO_TYPE_ARP,
  245. QDF_PROTO_TYPE_MGMT,
  246. QDF_PROTO_TYPE_ICMP,
  247. QDF_PROTO_TYPE_EVENT,
  248. QDF_PROTO_TYPE_MAX
  249. };
  250. /**
  251. * qdf_proto_subtype - subtype of packet
  252. * @QDF_PROTO_EAPOL_M1 - EAPOL 1/4
  253. * @QDF_PROTO_EAPOL_M2 - EAPOL 2/4
  254. * @QDF_PROTO_EAPOL_M3 - EAPOL 3/4
  255. * @QDF_PROTO_EAPOL_M4 - EAPOL 4/4
  256. * @QDF_PROTO_DHCP_DISCOVER - discover
  257. * @QDF_PROTO_DHCP_REQUEST - request
  258. * @QDF_PROTO_DHCP_OFFER - offer
  259. * @QDF_PROTO_DHCP_ACK - ACK
  260. * @QDF_PROTO_DHCP_NACK - NACK
  261. * @QDF_PROTO_DHCP_RELEASE - release
  262. * @QDF_PROTO_DHCP_INFORM - inform
  263. * @QDF_PROTO_DHCP_DECLINE - decline
  264. * @QDF_PROTO_ARP_REQ - arp request
  265. * @QDF_PROTO_ARP_RES - arp response
  266. * @QDF_PROTO_ICMP_REQ - icmp request
  267. * @QDF_PROTO_ICMP_RES - icmp response
  268. * @QDF_PROTO_ICMPV6_REQ - icmpv6 request
  269. * @QDF_PROTO_ICMPV6_RES - icmpv6 response
  270. * @QDF_PROTO_ICMPV6_RS - icmpv6 rs packet
  271. * @QDF_PROTO_ICMPV6_RA - icmpv6 ra packet
  272. * @QDF_PROTO_ICMPV6_NS - icmpv6 ns packet
  273. * @QDF_PROTO_ICMPV6_NA - icmpv6 na packet
  274. * @QDF_PROTO_IPV4_UDP - ipv4 udp
  275. * @QDF_PROTO_IPV4_TCP - ipv4 tcp
  276. * @QDF_PROTO_IPV6_UDP - ipv6 udp
  277. * @QDF_PROTO_IPV6_TCP - ipv6 tcp
  278. * @QDF_PROTO_MGMT_ASSOC -assoc
  279. * @QDF_PROTO_MGMT_DISASSOC - disassoc
  280. * @QDF_PROTO_MGMT_AUTH - auth
  281. * @QDF_PROTO_MGMT_DEAUTH - deauth
  282. * QDF_ROAM_SYNCH - roam synch indication from fw
  283. * QDF_ROAM_COMPLETE - roam complete cmd to fw
  284. * QDF_ROAM_EVENTID - roam eventid from fw
  285. */
  286. enum qdf_proto_subtype {
  287. QDF_PROTO_INVALID,
  288. QDF_PROTO_EAPOL_M1,
  289. QDF_PROTO_EAPOL_M2,
  290. QDF_PROTO_EAPOL_M3,
  291. QDF_PROTO_EAPOL_M4,
  292. QDF_PROTO_DHCP_DISCOVER,
  293. QDF_PROTO_DHCP_REQUEST,
  294. QDF_PROTO_DHCP_OFFER,
  295. QDF_PROTO_DHCP_ACK,
  296. QDF_PROTO_DHCP_NACK,
  297. QDF_PROTO_DHCP_RELEASE,
  298. QDF_PROTO_DHCP_INFORM,
  299. QDF_PROTO_DHCP_DECLINE,
  300. QDF_PROTO_ARP_REQ,
  301. QDF_PROTO_ARP_RES,
  302. QDF_PROTO_ICMP_REQ,
  303. QDF_PROTO_ICMP_RES,
  304. QDF_PROTO_ICMPV6_REQ,
  305. QDF_PROTO_ICMPV6_RES,
  306. QDF_PROTO_ICMPV6_RS,
  307. QDF_PROTO_ICMPV6_RA,
  308. QDF_PROTO_ICMPV6_NS,
  309. QDF_PROTO_ICMPV6_NA,
  310. QDF_PROTO_IPV4_UDP,
  311. QDF_PROTO_IPV4_TCP,
  312. QDF_PROTO_IPV6_UDP,
  313. QDF_PROTO_IPV6_TCP,
  314. QDF_PROTO_MGMT_ASSOC,
  315. QDF_PROTO_MGMT_DISASSOC,
  316. QDF_PROTO_MGMT_AUTH,
  317. QDF_PROTO_MGMT_DEAUTH,
  318. QDF_ROAM_SYNCH,
  319. QDF_ROAM_COMPLETE,
  320. QDF_ROAM_EVENTID,
  321. QDF_PROTO_SUBTYPE_MAX
  322. };
  323. /**
  324. * @qdf_nbuf_t - Platform indepedent packet abstraction
  325. */
  326. typedef __qdf_nbuf_t qdf_nbuf_t;
  327. /**
  328. * @qdf_dma_map_cb_t - Dma map callback prototype
  329. */
  330. typedef void (*qdf_dma_map_cb_t)(void *arg, qdf_nbuf_t buf,
  331. qdf_dma_map_t dmap);
  332. /**
  333. * @qdf_nbuf_queue_t - Platform independent packet queue abstraction
  334. */
  335. typedef __qdf_nbuf_queue_t qdf_nbuf_queue_t;
  336. /* BUS/DMA mapping routines */
  337. static inline QDF_STATUS
  338. qdf_nbuf_dmamap_create(qdf_device_t osdev, qdf_dma_map_t *dmap)
  339. {
  340. return __qdf_nbuf_dmamap_create(osdev, dmap);
  341. }
  342. static inline void
  343. qdf_nbuf_dmamap_destroy(qdf_device_t osdev, qdf_dma_map_t dmap)
  344. {
  345. __qdf_nbuf_dmamap_destroy(osdev, dmap);
  346. }
  347. static inline void
  348. qdf_nbuf_dmamap_set_cb(qdf_dma_map_t dmap, qdf_dma_map_cb_t cb, void *arg)
  349. {
  350. __qdf_nbuf_dmamap_set_cb(dmap, cb, arg);
  351. }
  352. static inline void
  353. qdf_nbuf_set_send_complete_flag(qdf_nbuf_t buf, bool flag)
  354. {
  355. __qdf_nbuf_set_send_complete_flag(buf, flag);
  356. }
  357. static inline QDF_STATUS
  358. qdf_nbuf_map(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  359. {
  360. return __qdf_nbuf_map(osdev, buf, dir);
  361. }
  362. static inline void
  363. qdf_nbuf_unmap(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  364. {
  365. __qdf_nbuf_unmap(osdev, buf, dir);
  366. }
  367. static inline QDF_STATUS
  368. qdf_nbuf_map_nbytes(qdf_device_t osdev, qdf_nbuf_t buf,
  369. qdf_dma_dir_t dir, int nbytes)
  370. {
  371. return __qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes);
  372. }
  373. static inline void
  374. qdf_nbuf_unmap_nbytes(qdf_device_t osdev,
  375. qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  376. {
  377. __qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes);
  378. }
  379. static inline void
  380. qdf_nbuf_sync_for_cpu(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  381. {
  382. __qdf_nbuf_sync_for_cpu(osdev, buf, dir);
  383. }
  384. static inline QDF_STATUS
  385. qdf_nbuf_map_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  386. {
  387. return __qdf_nbuf_map_single(osdev, buf, dir);
  388. }
  389. static inline QDF_STATUS
  390. qdf_nbuf_map_nbytes_single(
  391. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  392. {
  393. return __qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes);
  394. }
  395. static inline void
  396. qdf_nbuf_unmap_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  397. {
  398. __qdf_nbuf_unmap_single(osdev, buf, dir);
  399. }
  400. static inline void
  401. qdf_nbuf_unmap_nbytes_single(
  402. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  403. {
  404. return __qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes);
  405. }
  406. static inline int qdf_nbuf_get_num_frags(qdf_nbuf_t buf)
  407. {
  408. return __qdf_nbuf_get_num_frags(buf);
  409. }
  410. /**
  411. * qdf_nbuf_get_frag_len() - get fragment length
  412. * @buf: Network buffer
  413. * @frag_num: Fragment number
  414. *
  415. * Return: Fragment length
  416. */
  417. static inline int qdf_nbuf_get_frag_len(qdf_nbuf_t buf, int frag_num)
  418. {
  419. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  420. return __qdf_nbuf_get_frag_len(buf, frag_num);
  421. }
  422. /**
  423. * qdf_nbuf_get_frag_vaddr() - get fragment virtual address
  424. * @buf: Network buffer
  425. * @frag_num: Fragment number
  426. *
  427. * Return: Fragment virtual address
  428. */
  429. static inline unsigned char *qdf_nbuf_get_frag_vaddr(qdf_nbuf_t buf,
  430. int frag_num)
  431. {
  432. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  433. return __qdf_nbuf_get_frag_vaddr(buf, frag_num);
  434. }
  435. /**
  436. * qdf_nbuf_get_frag_vaddr_always() - get fragment virtual address
  437. * @buf: Network buffer
  438. *
  439. * Return: Fragment virtual address
  440. */
  441. static inline unsigned char *
  442. qdf_nbuf_get_frag_vaddr_always(qdf_nbuf_t buf)
  443. {
  444. return __qdf_nbuf_get_frag_vaddr_always(buf);
  445. }
  446. /**
  447. * qdf_nbuf_get_frag_paddr() - get fragment physical address
  448. * @buf: Network buffer
  449. * @frag_num: Fragment number
  450. *
  451. * Return: Fragment physical address
  452. */
  453. static inline qdf_dma_addr_t qdf_nbuf_get_frag_paddr(qdf_nbuf_t buf,
  454. unsigned int frag_num)
  455. {
  456. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  457. return __qdf_nbuf_get_frag_paddr(buf, frag_num);
  458. }
  459. /**
  460. * qdf_nbuf_get_frag_is_wordstream() - is fragment wordstream
  461. * @buf: Network buffer
  462. * @frag_num: Fragment number
  463. *
  464. * Return: Fragment wordstream or not
  465. */
  466. static inline int qdf_nbuf_get_frag_is_wordstream(qdf_nbuf_t buf, int frag_num)
  467. {
  468. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  469. return __qdf_nbuf_get_frag_is_wordstream(buf, frag_num);
  470. }
  471. static inline int qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf)
  472. {
  473. return __qdf_nbuf_ipa_owned_get(buf);
  474. }
  475. static inline void qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf)
  476. {
  477. __qdf_nbuf_ipa_owned_set(buf);
  478. }
  479. static inline int qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf)
  480. {
  481. return __qdf_nbuf_ipa_priv_get(buf);
  482. }
  483. static inline void qdf_nbuf_ipa_priv_set(qdf_nbuf_t buf, uint32_t priv)
  484. {
  485. QDF_BUG(!(priv & QDF_NBUF_IPA_CHECK_MASK));
  486. __qdf_nbuf_ipa_priv_set(buf, priv);
  487. }
  488. /**
  489. * qdf_nbuf_set_frag_is_wordstream() - set fragment wordstream
  490. * @buf: Network buffer
  491. * @frag_num: Fragment number
  492. * @is_wordstream: Wordstream
  493. *
  494. * Return: none
  495. */
  496. static inline void
  497. qdf_nbuf_set_frag_is_wordstream(qdf_nbuf_t buf,
  498. int frag_num, int is_wordstream)
  499. {
  500. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  501. __qdf_nbuf_set_frag_is_wordstream(buf, frag_num, is_wordstream);
  502. }
  503. static inline void
  504. qdf_nbuf_set_vdev_ctx(qdf_nbuf_t buf, void *vdev_ctx)
  505. {
  506. __qdf_nbuf_set_vdev_ctx(buf, vdev_ctx);
  507. }
  508. static inline void
  509. qdf_nbuf_set_ftype(qdf_nbuf_t buf, uint8_t type)
  510. {
  511. __qdf_nbuf_set_ftype(buf, type);
  512. }
  513. static inline void
  514. qdf_nbuf_set_fctx_type(qdf_nbuf_t buf, void *ctx, uint8_t type)
  515. {
  516. __qdf_nbuf_set_fctx_type(buf, ctx, type);
  517. }
  518. static inline void *
  519. qdf_nbuf_get_vdev_ctx(qdf_nbuf_t buf)
  520. {
  521. return __qdf_nbuf_get_vdev_ctx(buf);
  522. }
  523. static inline void *qdf_nbuf_get_fctx(qdf_nbuf_t buf)
  524. {
  525. return __qdf_nbuf_get_fctx(buf);
  526. }
  527. static inline uint8_t qdf_nbuf_get_ftype(qdf_nbuf_t buf)
  528. {
  529. return __qdf_nbuf_get_ftype(buf);
  530. }
  531. static inline qdf_dma_addr_t
  532. qdf_nbuf_mapped_paddr_get(qdf_nbuf_t buf)
  533. {
  534. return __qdf_nbuf_mapped_paddr_get(buf);
  535. }
  536. static inline void
  537. qdf_nbuf_mapped_paddr_set(qdf_nbuf_t buf, qdf_dma_addr_t paddr)
  538. {
  539. __qdf_nbuf_mapped_paddr_set(buf, paddr);
  540. }
  541. static inline void
  542. qdf_nbuf_frag_push_head(qdf_nbuf_t buf,
  543. int frag_len, char *frag_vaddr,
  544. qdf_dma_addr_t frag_paddr)
  545. {
  546. __qdf_nbuf_frag_push_head(buf, frag_len, frag_vaddr, frag_paddr);
  547. }
  548. #define qdf_nbuf_num_frags_init(_nbuf) __qdf_nbuf_num_frags_init((_nbuf))
  549. /**
  550. * qdf_nbuf_set_chfrag_start() - set msdu start bit
  551. * @buf: Network buffer
  552. * @val: 0/1
  553. *
  554. * Return: void
  555. */
  556. static inline void
  557. qdf_nbuf_set_chfrag_start(qdf_nbuf_t buf, uint8_t val)
  558. {
  559. __qdf_nbuf_set_chfrag_start(buf, val);
  560. }
  561. /**
  562. * qdf_nbuf_is_chfrag_start() - get msdu start bit
  563. * @buf: Network buffer
  564. *
  565. * Return: integer value - 0/1
  566. */
  567. static inline int qdf_nbuf_is_chfrag_start(qdf_nbuf_t buf)
  568. {
  569. return __qdf_nbuf_is_chfrag_start(buf);
  570. }
  571. /**
  572. * qdf_nbuf_set_chfrag_cont() - set msdu continuation bit
  573. * @buf: Network buffer
  574. * @val: 0/1
  575. *
  576. * Return: void
  577. */
  578. static inline void
  579. qdf_nbuf_set_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
  580. {
  581. __qdf_nbuf_set_chfrag_cont(buf, val);
  582. }
  583. /**
  584. * qdf_nbuf_is_chfrag_cont() - get msdu continuation bit
  585. * @buf: Network buffer
  586. *
  587. * Return: integer value - 0/1
  588. */
  589. static inline int qdf_nbuf_is_chfrag_cont(qdf_nbuf_t buf)
  590. {
  591. return __qdf_nbuf_is_chfrag_cont(buf);
  592. }
  593. /**
  594. * qdf_nbuf_set_chfrag_end() - set msdu end bit
  595. * @buf: Network buffer
  596. * @val: 0/1
  597. *
  598. * Return: void
  599. */
  600. static inline void qdf_nbuf_set_chfrag_end(qdf_nbuf_t buf, uint8_t val)
  601. {
  602. __qdf_nbuf_set_chfrag_end(buf, val);
  603. }
  604. /**
  605. * qdf_nbuf_is_chfrag_end() - set msdu end bit
  606. * @buf: Network buffer
  607. *
  608. * Return: integer value - 0/1
  609. */
  610. static inline int qdf_nbuf_is_chfrag_end(qdf_nbuf_t buf)
  611. {
  612. return __qdf_nbuf_is_chfrag_end(buf);
  613. }
  614. static inline void
  615. qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg)
  616. {
  617. __qdf_nbuf_dma_map_info(bmap, sg);
  618. }
  619. /**
  620. * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
  621. * @buf: Network buffer
  622. *
  623. * Return: 1 - this is a jumbo packet 0 - not a jumbo packet
  624. */
  625. static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf)
  626. {
  627. return __qdf_nbuf_is_tso(nbuf);
  628. }
  629. /**
  630. * qdf_nbuf_get_users() - function to get the number of users referencing this
  631. * network buffer
  632. *
  633. * @nbuf: network buffer
  634. *
  635. * Return: number of user references to nbuf.
  636. */
  637. static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf)
  638. {
  639. return __qdf_nbuf_get_users(nbuf);
  640. }
  641. /**
  642. * qdf_nbuf_next() - get the next packet in the linked list
  643. * @buf: Network buffer
  644. *
  645. * This function can be used when nbufs are directly linked into a list,
  646. * rather than using a separate network buffer queue object.
  647. *
  648. * Return: next network buffer in the linked list
  649. */
  650. static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf)
  651. {
  652. return __qdf_nbuf_next(buf);
  653. }
  654. #ifdef MEMORY_DEBUG
  655. void qdf_net_buf_debug_init(void);
  656. void qdf_net_buf_debug_exit(void);
  657. void qdf_net_buf_debug_clean(void);
  658. void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
  659. uint8_t *file_name, uint32_t line_num);
  660. void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf);
  661. /**
  662. * qdf_net_buf_debug_acquire_skb() - acquire skb to avoid memory leak
  663. * @net_buf: Network buf holding head segment (single)
  664. * @file_name: pointer to file name
  665. * @line_num: line number
  666. *
  667. * WLAN driver module's SKB which are allocated by network stack are
  668. * suppose to call this API before freeing it such that the SKB
  669. * is not reported as memory leak.
  670. *
  671. * Return: none
  672. */
  673. void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
  674. uint8_t *file_name, uint32_t line_num);
  675. void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf);
  676. /* nbuf allocation rouines */
  677. #define qdf_nbuf_alloc(d, s, r, a, p) \
  678. qdf_nbuf_alloc_debug(d, s, r, a, p, __FILE__, __LINE__)
  679. static inline qdf_nbuf_t
  680. qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size, int reserve,
  681. int align, int prio, uint8_t *file_name,
  682. uint32_t line_num)
  683. {
  684. qdf_nbuf_t net_buf;
  685. net_buf = __qdf_nbuf_alloc(osdev, size, reserve, align, prio);
  686. /* Store SKB in internal QDF tracking table */
  687. if (qdf_likely(net_buf))
  688. qdf_net_buf_debug_add_node(net_buf, size, file_name, line_num);
  689. return net_buf;
  690. }
  691. static inline void qdf_nbuf_free(qdf_nbuf_t net_buf)
  692. {
  693. if (qdf_nbuf_is_tso(net_buf) &&
  694. qdf_nbuf_get_users(net_buf) > 1)
  695. goto free_buf;
  696. /* Remove SKB from internal QDF tracking table */
  697. if (qdf_likely(net_buf))
  698. qdf_net_buf_debug_delete_node(net_buf);
  699. free_buf:
  700. __qdf_nbuf_free(net_buf);
  701. }
  702. #define qdf_nbuf_clone(buf) \
  703. qdf_nbuf_clone_debug(buf, __FILE__, __LINE__)
  704. /**
  705. * qdf_nbuf_clone_debug() - clone the nbuf (copy is readonly)
  706. * @buf: nbuf to clone from
  707. * @file_name: pointer to file name
  708. * @line_num: line number
  709. *
  710. * This function clones the nbuf and creates a memory tracking
  711. * node corresponding to that cloned skbuff structure.
  712. *
  713. * Return: cloned buffer
  714. */
  715. static inline qdf_nbuf_t
  716. qdf_nbuf_clone_debug(qdf_nbuf_t buf, uint8_t *file_name,
  717. uint32_t line_num)
  718. {
  719. qdf_nbuf_t cloned_buf;
  720. cloned_buf = __qdf_nbuf_clone(buf);
  721. /* Store SKB in internal QDF tracking table */
  722. if (qdf_likely(cloned_buf))
  723. qdf_net_buf_debug_add_node(cloned_buf, 0, file_name, line_num);
  724. return cloned_buf;
  725. }
  726. #define qdf_nbuf_copy(buf) \
  727. qdf_nbuf_copy_debug(buf, __FILE__, __LINE__)
  728. /**
  729. * qdf_nbuf_copy_debug() - returns a private copy of the buf
  730. * @buf: nbuf to copy from
  731. * @file_name: pointer to file name
  732. * @line_num: line number
  733. *
  734. * This API returns a private copy of the buf, the buf returned is completely
  735. * modifiable by callers. It also creates a memory tracking node corresponding
  736. * to that new skbuff structure.
  737. *
  738. * Return: copied buffer
  739. */
  740. static inline qdf_nbuf_t
  741. qdf_nbuf_copy_debug(qdf_nbuf_t buf, uint8_t *file_name,
  742. uint32_t line_num)
  743. {
  744. qdf_nbuf_t copied_buf;
  745. copied_buf = __qdf_nbuf_copy(buf);
  746. /* Store SKB in internal QDF tracking table */
  747. if (qdf_likely(copied_buf))
  748. qdf_net_buf_debug_add_node(copied_buf, 0, file_name, line_num);
  749. return copied_buf;
  750. }
  751. #else
  752. static inline void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
  753. uint8_t *file_name, uint32_t line_num)
  754. {
  755. }
  756. static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
  757. {
  758. return;
  759. }
  760. /* Nbuf allocation rouines */
  761. static inline qdf_nbuf_t
  762. qdf_nbuf_alloc(qdf_device_t osdev,
  763. qdf_size_t size, int reserve, int align, int prio)
  764. {
  765. return __qdf_nbuf_alloc(osdev, size, reserve, align, prio);
  766. }
  767. static inline void qdf_nbuf_free(qdf_nbuf_t buf)
  768. {
  769. __qdf_nbuf_free(buf);
  770. }
  771. /**
  772. * qdf_nbuf_clone() - clone the nbuf (copy is readonly)
  773. * @buf: Pointer to network buffer
  774. *
  775. * This function clones the nbuf and returns new sk_buff
  776. * structure.
  777. *
  778. * Return: cloned skb
  779. */
  780. static inline qdf_nbuf_t qdf_nbuf_clone(qdf_nbuf_t buf)
  781. {
  782. return __qdf_nbuf_clone(buf);
  783. }
  784. /**
  785. * qdf_nbuf_copy() - returns a private copy of the buf
  786. * @buf: Pointer to network buffer
  787. *
  788. * This API returns a private copy of the buf, the buf returned is completely
  789. * modifiable by callers
  790. *
  791. * Return: skb or NULL
  792. */
  793. static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf)
  794. {
  795. return __qdf_nbuf_copy(buf);
  796. }
  797. #endif
  798. #ifdef WLAN_FEATURE_FASTPATH
  799. /**
  800. * qdf_nbuf_init_fast() - before put buf into pool,turn it to init state
  801. *
  802. * @buf: buf instance
  803. * Return: data pointer of this buf where new data has to be
  804. * put, or NULL if there is not enough room in this buf.
  805. */
  806. static inline void qdf_nbuf_init_fast(qdf_nbuf_t nbuf)
  807. {
  808. atomic_set(&nbuf->users, 1);
  809. nbuf->data = nbuf->head + NET_SKB_PAD;
  810. skb_reset_tail_pointer(nbuf);
  811. }
  812. #endif /* WLAN_FEATURE_FASTPATH */
  813. static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err)
  814. {
  815. while (buf_list) {
  816. qdf_nbuf_t next = qdf_nbuf_next(buf_list);
  817. qdf_nbuf_free(buf_list);
  818. buf_list = next;
  819. }
  820. }
  821. static inline void qdf_nbuf_ref(qdf_nbuf_t buf)
  822. {
  823. __qdf_nbuf_ref(buf);
  824. }
  825. static inline int qdf_nbuf_shared(qdf_nbuf_t buf)
  826. {
  827. return __qdf_nbuf_shared(buf);
  828. }
  829. static inline QDF_STATUS qdf_nbuf_cat(qdf_nbuf_t dst, qdf_nbuf_t src)
  830. {
  831. return __qdf_nbuf_cat(dst, src);
  832. }
  833. /**
  834. * @qdf_nbuf_copy_bits() - return the length of the copy bits for skb
  835. * @skb: SKB pointer
  836. * @offset: offset
  837. * @len: Length
  838. * @to: To
  839. *
  840. * Return: int32_t
  841. */
  842. static inline int32_t
  843. qdf_nbuf_copy_bits(qdf_nbuf_t nbuf, uint32_t offset, uint32_t len, void *to)
  844. {
  845. return __qdf_nbuf_copy_bits(nbuf, offset, len, to);
  846. }
  847. /* nbuf manipulation routines */
  848. /**
  849. * @qdf_nbuf_head() - return the address of an nbuf's buffer
  850. * @buf: netbuf
  851. *
  852. * Return: head address
  853. */
  854. static inline uint8_t *qdf_nbuf_head(qdf_nbuf_t buf)
  855. {
  856. return __qdf_nbuf_head(buf);
  857. }
  858. /**
  859. * qdf_nbuf_data() - Return the address of the start of data within an nbuf
  860. * @buf: Network buffer
  861. *
  862. * Return: Data address
  863. */
  864. static inline uint8_t *qdf_nbuf_data(qdf_nbuf_t buf)
  865. {
  866. return __qdf_nbuf_data(buf);
  867. }
  868. /**
  869. * qdf_nbuf_data_addr() - Return the address of skb->data
  870. * @buf: Network buffer
  871. *
  872. * Return: Data address
  873. */
  874. static inline uint8_t *qdf_nbuf_data_addr(qdf_nbuf_t buf)
  875. {
  876. return __qdf_nbuf_data_addr(buf);
  877. }
  878. /**
  879. * qdf_nbuf_headroom() - amount of headroom int the current nbuf
  880. * @buf: Network buffer
  881. *
  882. * Return: Amount of head room
  883. */
  884. static inline uint32_t qdf_nbuf_headroom(qdf_nbuf_t buf)
  885. {
  886. return __qdf_nbuf_headroom(buf);
  887. }
  888. /**
  889. * qdf_nbuf_tailroom() - amount of tail space available
  890. * @buf: Network buffer
  891. *
  892. * Return: amount of tail room
  893. */
  894. static inline uint32_t qdf_nbuf_tailroom(qdf_nbuf_t buf)
  895. {
  896. return __qdf_nbuf_tailroom(buf);
  897. }
  898. /**
  899. * qdf_nbuf_push_head() - push data in the front
  900. * @buf: Network buf instance
  901. * @size: Size to be pushed
  902. *
  903. * Return: New data pointer of this buf after data has been pushed,
  904. * or NULL if there is not enough room in this buf.
  905. */
  906. static inline uint8_t *qdf_nbuf_push_head(qdf_nbuf_t buf, qdf_size_t size)
  907. {
  908. return __qdf_nbuf_push_head(buf, size);
  909. }
  910. /**
  911. * qdf_nbuf_put_tail() - puts data in the end
  912. * @buf: Network buf instance
  913. * @size: Size to be pushed
  914. *
  915. * Return: Data pointer of this buf where new data has to be
  916. * put, or NULL if there is not enough room in this buf.
  917. */
  918. static inline uint8_t *qdf_nbuf_put_tail(qdf_nbuf_t buf, qdf_size_t size)
  919. {
  920. return __qdf_nbuf_put_tail(buf, size);
  921. }
  922. /**
  923. * qdf_nbuf_pull_head() - pull data out from the front
  924. * @buf: Network buf instance
  925. * @size: Size to be popped
  926. *
  927. * Return: New data pointer of this buf after data has been popped,
  928. * or NULL if there is not sufficient data to pull.
  929. */
  930. static inline uint8_t *qdf_nbuf_pull_head(qdf_nbuf_t buf, qdf_size_t size)
  931. {
  932. return __qdf_nbuf_pull_head(buf, size);
  933. }
  934. /**
  935. * qdf_nbuf_trim_tail() - trim data out from the end
  936. * @buf: Network buf instance
  937. * @size: Size to be popped
  938. *
  939. * Return: none
  940. */
  941. static inline void qdf_nbuf_trim_tail(qdf_nbuf_t buf, qdf_size_t size)
  942. {
  943. __qdf_nbuf_trim_tail(buf, size);
  944. }
  945. /**
  946. * qdf_nbuf_len() - get the length of the buf
  947. * @buf: Network buf instance
  948. *
  949. * Return: total length of this buf.
  950. */
  951. static inline qdf_size_t qdf_nbuf_len(qdf_nbuf_t buf)
  952. {
  953. return __qdf_nbuf_len(buf);
  954. }
  955. /**
  956. * qdf_nbuf_set_pktlen() - set the length of the buf
  957. * @buf: Network buf instance
  958. * @size: Size to be set
  959. *
  960. * Return: none
  961. */
  962. static inline void qdf_nbuf_set_pktlen(qdf_nbuf_t buf, uint32_t len)
  963. {
  964. __qdf_nbuf_set_pktlen(buf, len);
  965. }
  966. /**
  967. * qdf_nbuf_reserve() - trim data out from the end
  968. * @buf: Network buf instance
  969. * @size: Size to be popped
  970. *
  971. * Return: none
  972. */
  973. static inline void qdf_nbuf_reserve(qdf_nbuf_t buf, qdf_size_t size)
  974. {
  975. __qdf_nbuf_reserve(buf, size);
  976. }
  977. /**
  978. * qdf_nbuf_peek_header() - return the data pointer & length of the header
  979. * @buf: Network nbuf
  980. * @addr: Data pointer
  981. * @len: Length of the data
  982. *
  983. * Return: none
  984. */
  985. static inline void
  986. qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len)
  987. {
  988. __qdf_nbuf_peek_header(buf, addr, len);
  989. }
  990. /* nbuf queue routines */
  991. /**
  992. * qdf_nbuf_queue_init() - initialize buf queue
  993. * @head: Network buf queue head
  994. *
  995. * Return: none
  996. */
  997. static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head)
  998. {
  999. __qdf_nbuf_queue_init(head);
  1000. }
  1001. /**
  1002. * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue
  1003. * @head: Network buf queue head
  1004. * @buf: Network buf
  1005. *
  1006. * Return: none
  1007. */
  1008. static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  1009. {
  1010. __qdf_nbuf_queue_add(head, buf);
  1011. }
  1012. /**
  1013. * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue
  1014. * @head: Network buf queue head
  1015. * @buf: Network buf
  1016. *
  1017. * Return: none
  1018. */
  1019. static inline void
  1020. qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  1021. {
  1022. __qdf_nbuf_queue_insert_head(head, buf);
  1023. }
  1024. /**
  1025. * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue
  1026. * @head: Network buf queue head
  1027. *
  1028. * Return: The head buf in the buf queue.
  1029. */
  1030. static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head)
  1031. {
  1032. return __qdf_nbuf_queue_remove(head);
  1033. }
  1034. /**
  1035. * qdf_nbuf_queue_len() - get the length of the queue
  1036. * @head: Network buf queue head
  1037. *
  1038. * Return: length of the queue
  1039. */
  1040. static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head)
  1041. {
  1042. return __qdf_nbuf_queue_len(head);
  1043. }
  1044. /**
  1045. * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer
  1046. * @buf: Network buffer
  1047. *
  1048. * Return: next buffer/packet
  1049. */
  1050. static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf)
  1051. {
  1052. return __qdf_nbuf_queue_next(buf);
  1053. }
  1054. /**
  1055. * @qdf_nbuf_is_queue_empty() - check if the buf queue is empty
  1056. * @nbq: Network buf queue handle
  1057. *
  1058. * Return: true if queue is empty
  1059. * false if queue is not emty
  1060. */
  1061. static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq)
  1062. {
  1063. return __qdf_nbuf_is_queue_empty(nbq);
  1064. }
  1065. static inline qdf_nbuf_queue_t *
  1066. qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src)
  1067. {
  1068. return __qdf_nbuf_queue_append(dest, src);
  1069. }
  1070. static inline void
  1071. qdf_nbuf_queue_free(qdf_nbuf_queue_t *head)
  1072. {
  1073. __qdf_nbuf_queue_free(head);
  1074. }
  1075. static inline qdf_nbuf_t
  1076. qdf_nbuf_queue_first(qdf_nbuf_queue_t *head)
  1077. {
  1078. return __qdf_nbuf_queue_first(head);
  1079. }
  1080. /**
  1081. * qdf_nbuf_get_protocol() - return the protocol value of the skb
  1082. * @skb: Pointer to network buffer
  1083. *
  1084. * Return: skb protocol
  1085. */
  1086. static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb)
  1087. {
  1088. return __qdf_nbuf_get_protocol(skb);
  1089. }
  1090. /**
  1091. * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb
  1092. * @skb: Pointer to network buffer
  1093. *
  1094. * Return: skb ip_summed
  1095. */
  1096. static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb)
  1097. {
  1098. return __qdf_nbuf_get_ip_summed(skb);
  1099. }
  1100. /**
  1101. * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb
  1102. * @skb: Pointer to network buffer
  1103. * @ip_summed: ip checksum
  1104. *
  1105. * Return: none
  1106. */
  1107. static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb,
  1108. uint8_t ip_summed)
  1109. {
  1110. __qdf_nbuf_set_ip_summed(skb, ip_summed);
  1111. }
  1112. /**
  1113. * qdf_nbuf_set_next() - add a packet to a linked list
  1114. * @this_buf: Predecessor buffer
  1115. * @next_buf: Successor buffer
  1116. *
  1117. * This function can be used to directly link nbufs, rather than using
  1118. * a separate network buffer queue object.
  1119. *
  1120. * Return: none
  1121. */
  1122. static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  1123. {
  1124. __qdf_nbuf_set_next(this_buf, next_buf);
  1125. }
  1126. /* nbuf extension routines */
  1127. /**
  1128. * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new
  1129. * nbuf
  1130. * @this_buf: predecessor buffer
  1131. * @next_buf: successor buffer
  1132. *
  1133. * This function is used to link up many nbufs containing a single logical
  1134. * packet - not a collection of packets. Do not use for linking the first
  1135. * extension to the head
  1136. *
  1137. * Return: none
  1138. */
  1139. static inline void
  1140. qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  1141. {
  1142. __qdf_nbuf_set_next_ext(this_buf, next_buf);
  1143. }
  1144. /**
  1145. * qdf_nbuf_next_ext() - get the next packet extension in the linked list
  1146. * @buf: Network buffer
  1147. *
  1148. * Return: Next network buffer in the linked list
  1149. */
  1150. static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf)
  1151. {
  1152. return __qdf_nbuf_next_ext(buf);
  1153. }
  1154. /**
  1155. * qdf_nbuf_append_ext_list() - link list of packet extensions to the head
  1156. * segment
  1157. * @head_buf: Network buf holding head segment (single)
  1158. * @ext_list: Network buf list holding linked extensions to the head
  1159. * @ext_len: Total length of all buffers in the extension list
  1160. *
  1161. * This function is used to link up a list of packet extensions (seg1, 2,
  1162. * ...) to the nbuf holding the head segment (seg0)
  1163. *
  1164. * Return: none
  1165. */
  1166. static inline void
  1167. qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list,
  1168. qdf_size_t ext_len)
  1169. {
  1170. __qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len);
  1171. }
  1172. /**
  1173. * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list.
  1174. * @head_buf: Network buf holding head segment (single)
  1175. *
  1176. * This ext_list is populated when we have Jumbo packet, for example in case of
  1177. * monitor mode amsdu packet reception, and are stiched using frags_list.
  1178. *
  1179. * Return: Network buf list holding linked extensions from head buf.
  1180. */
  1181. static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf)
  1182. {
  1183. return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf);
  1184. }
  1185. /**
  1186. * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand
  1187. * @buf: Network buffer
  1188. *
  1189. * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame
  1190. */
  1191. static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf)
  1192. {
  1193. return __qdf_nbuf_get_tx_cksum(buf);
  1194. }
  1195. /**
  1196. * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to
  1197. * indicate checksum info to the stack.
  1198. * @buf: Network buffer
  1199. * @cksum: Checksum
  1200. *
  1201. * Return: none
  1202. */
  1203. static inline void
  1204. qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum)
  1205. {
  1206. __qdf_nbuf_set_rx_cksum(buf, cksum);
  1207. }
  1208. /**
  1209. * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf
  1210. * @buf: Network buffer
  1211. *
  1212. * Return: TID value
  1213. */
  1214. static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf)
  1215. {
  1216. return __qdf_nbuf_get_tid(buf);
  1217. }
  1218. /**
  1219. * qdf_nbuf_set_tid() - this function sets the TID value in nbuf
  1220. * @buf: Network buffer
  1221. * @tid: TID value
  1222. *
  1223. * Return: none
  1224. */
  1225. static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid)
  1226. {
  1227. __qdf_nbuf_set_tid(buf, tid);
  1228. }
  1229. /**
  1230. * qdf_nbuf_get_exemption_type() - this function extracts the exemption type
  1231. * from nbuf
  1232. * @buf: Network buffer
  1233. *
  1234. * Return: Exemption type
  1235. */
  1236. static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf)
  1237. {
  1238. return __qdf_nbuf_get_exemption_type(buf);
  1239. }
  1240. /**
  1241. * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given
  1242. * offset
  1243. * @buf: Network buffer
  1244. * @proto: Protocol
  1245. *
  1246. * Return: none
  1247. */
  1248. static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto)
  1249. {
  1250. __qdf_nbuf_set_protocol(buf, proto);
  1251. }
  1252. /**
  1253. * qdf_nbuf_trace_get_proto_type() - this function return packet proto type
  1254. * @buf: Network buffer
  1255. *
  1256. * Return: Packet protocol type
  1257. */
  1258. static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf)
  1259. {
  1260. return __qdf_nbuf_trace_get_proto_type(buf);
  1261. }
  1262. /**
  1263. * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback
  1264. * @cb_func_ptr: Callback pointer
  1265. *
  1266. * Return: none
  1267. */
  1268. static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr)
  1269. {
  1270. __qdf_nbuf_reg_trace_cb(cb_func_ptr);
  1271. }
  1272. /**
  1273. * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download
  1274. * @buf: Network buffer
  1275. * @candi: Candidate of parallel download frame
  1276. *
  1277. * This function stores a flag specifying this TX frame is suitable for
  1278. * downloading though a 2nd TX data pipe that is used for short frames for
  1279. * protocols that can accept out-of-order delivery.
  1280. *
  1281. * Return: none
  1282. */
  1283. static inline void
  1284. qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi)
  1285. {
  1286. __qdf_nbuf_set_tx_htt2_frm(buf, candi);
  1287. }
  1288. /**
  1289. * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download
  1290. * @buf: Network buffer
  1291. *
  1292. * This function return whether this TX frame is allow to download though a 2nd
  1293. * TX data pipe or not.
  1294. *
  1295. * Return: none
  1296. */
  1297. static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf)
  1298. {
  1299. return __qdf_nbuf_get_tx_htt2_frm(buf);
  1300. }
  1301. /**
  1302. * qdf_nbuf_get_dhcp_subtype() - get the subtype
  1303. * of DHCP packet.
  1304. * @buf: Pointer to DHCP packet buffer
  1305. *
  1306. * This func. returns the subtype of DHCP packet.
  1307. *
  1308. * Return: subtype of the DHCP packet.
  1309. */
  1310. static inline enum qdf_proto_subtype
  1311. qdf_nbuf_get_dhcp_subtype(qdf_nbuf_t buf)
  1312. {
  1313. return __qdf_nbuf_data_get_dhcp_subtype(qdf_nbuf_data(buf));
  1314. }
  1315. /**
  1316. * qdf_nbuf_data_get_dhcp_subtype() - get the subtype
  1317. * of DHCP packet.
  1318. * @buf: Pointer to DHCP packet data buffer
  1319. *
  1320. * This func. returns the subtype of DHCP packet.
  1321. *
  1322. * Return: subtype of the DHCP packet.
  1323. */
  1324. static inline enum qdf_proto_subtype
  1325. qdf_nbuf_data_get_dhcp_subtype(uint8_t *data)
  1326. {
  1327. return __qdf_nbuf_data_get_dhcp_subtype(data);
  1328. }
  1329. /**
  1330. * qdf_nbuf_get_eapol_subtype() - get the subtype
  1331. * of EAPOL packet.
  1332. * @buf: Pointer to EAPOL packet buffer
  1333. *
  1334. * This func. returns the subtype of EAPOL packet.
  1335. *
  1336. * Return: subtype of the EAPOL packet.
  1337. */
  1338. static inline enum qdf_proto_subtype
  1339. qdf_nbuf_get_eapol_subtype(qdf_nbuf_t buf)
  1340. {
  1341. return __qdf_nbuf_data_get_eapol_subtype(qdf_nbuf_data(buf));
  1342. }
  1343. /**
  1344. * qdf_nbuf_data_get_eapol_subtype() - get the subtype
  1345. * of EAPOL packet.
  1346. * @data: Pointer to EAPOL packet data buffer
  1347. *
  1348. * This func. returns the subtype of EAPOL packet.
  1349. *
  1350. * Return: subtype of the EAPOL packet.
  1351. */
  1352. static inline enum qdf_proto_subtype
  1353. qdf_nbuf_data_get_eapol_subtype(uint8_t *data)
  1354. {
  1355. return __qdf_nbuf_data_get_eapol_subtype(data);
  1356. }
  1357. /**
  1358. * qdf_nbuf_get_arp_subtype() - get the subtype
  1359. * of ARP packet.
  1360. * @buf: Pointer to ARP packet buffer
  1361. *
  1362. * This func. returns the subtype of ARP packet.
  1363. *
  1364. * Return: subtype of the ARP packet.
  1365. */
  1366. static inline enum qdf_proto_subtype
  1367. qdf_nbuf_get_arp_subtype(qdf_nbuf_t buf)
  1368. {
  1369. return __qdf_nbuf_data_get_arp_subtype(qdf_nbuf_data(buf));
  1370. }
  1371. /**
  1372. * qdf_nbuf_data_get_arp_subtype() - get the subtype
  1373. * of ARP packet.
  1374. * @data: Pointer to ARP packet data buffer
  1375. *
  1376. * This func. returns the subtype of ARP packet.
  1377. *
  1378. * Return: subtype of the ARP packet.
  1379. */
  1380. static inline enum qdf_proto_subtype
  1381. qdf_nbuf_data_get_arp_subtype(uint8_t *data)
  1382. {
  1383. return __qdf_nbuf_data_get_arp_subtype(data);
  1384. }
  1385. /**
  1386. * qdf_nbuf_get_icmp_subtype() - get the subtype
  1387. * of IPV4 ICMP packet.
  1388. * @buf: Pointer to IPV4 ICMP packet buffer
  1389. *
  1390. * This func. returns the subtype of ICMP packet.
  1391. *
  1392. * Return: subtype of the ICMP packet.
  1393. */
  1394. static inline enum qdf_proto_subtype
  1395. qdf_nbuf_get_icmp_subtype(qdf_nbuf_t buf)
  1396. {
  1397. return __qdf_nbuf_data_get_icmp_subtype(qdf_nbuf_data(buf));
  1398. }
  1399. /**
  1400. * qdf_nbuf_data_get_icmp_subtype() - get the subtype
  1401. * of IPV4 ICMP packet.
  1402. * @data: Pointer to IPV4 ICMP packet data buffer
  1403. *
  1404. * This func. returns the subtype of ICMP packet.
  1405. *
  1406. * Return: subtype of the ICMP packet.
  1407. */
  1408. static inline enum qdf_proto_subtype
  1409. qdf_nbuf_data_get_icmp_subtype(uint8_t *data)
  1410. {
  1411. return __qdf_nbuf_data_get_icmp_subtype(data);
  1412. }
  1413. /**
  1414. * qdf_nbuf_get_icmpv6_subtype() - get the subtype
  1415. * of IPV6 ICMPV6 packet.
  1416. * @buf: Pointer to IPV6 ICMPV6 packet buffer
  1417. *
  1418. * This func. returns the subtype of ICMPV6 packet.
  1419. *
  1420. * Return: subtype of the ICMPV6 packet.
  1421. */
  1422. static inline enum qdf_proto_subtype
  1423. qdf_nbuf_get_icmpv6_subtype(qdf_nbuf_t buf)
  1424. {
  1425. return __qdf_nbuf_data_get_icmpv6_subtype(qdf_nbuf_data(buf));
  1426. }
  1427. /**
  1428. * qdf_nbuf_data_get_icmpv6_subtype() - get the subtype
  1429. * of IPV6 ICMPV6 packet.
  1430. * @data: Pointer to IPV6 ICMPV6 packet data buffer
  1431. *
  1432. * This func. returns the subtype of ICMPV6 packet.
  1433. *
  1434. * Return: subtype of the ICMPV6 packet.
  1435. */
  1436. static inline enum qdf_proto_subtype
  1437. qdf_nbuf_data_get_icmpv6_subtype(uint8_t *data)
  1438. {
  1439. return __qdf_nbuf_data_get_icmpv6_subtype(data);
  1440. }
  1441. /**
  1442. * qdf_nbuf_data_get_ipv4_proto() - get the proto type
  1443. * of IPV4 packet.
  1444. * @data: Pointer to IPV4 packet data buffer
  1445. *
  1446. * This func. returns the proto type of IPV4 packet.
  1447. *
  1448. * Return: proto type of IPV4 packet.
  1449. */
  1450. static inline uint8_t
  1451. qdf_nbuf_data_get_ipv4_proto(uint8_t *data)
  1452. {
  1453. return __qdf_nbuf_data_get_ipv4_proto(data);
  1454. }
  1455. /**
  1456. * qdf_nbuf_data_get_ipv6_proto() - get the proto type
  1457. * of IPV6 packet.
  1458. * @data: Pointer to IPV6 packet data buffer
  1459. *
  1460. * This func. returns the proto type of IPV6 packet.
  1461. *
  1462. * Return: proto type of IPV6 packet.
  1463. */
  1464. static inline uint8_t
  1465. qdf_nbuf_data_get_ipv6_proto(uint8_t *data)
  1466. {
  1467. return __qdf_nbuf_data_get_ipv6_proto(data);
  1468. }
  1469. /**
  1470. * qdf_nbuf_is_ipv4_pkt() - check if packet is a ipv4 packet or not
  1471. * @buf: buffer
  1472. *
  1473. * This api is for Tx packets.
  1474. *
  1475. * Return: true if packet is ipv4 packet
  1476. */
  1477. static inline
  1478. bool qdf_nbuf_is_ipv4_pkt(qdf_nbuf_t buf)
  1479. {
  1480. return __qdf_nbuf_data_is_ipv4_pkt(qdf_nbuf_data(buf));
  1481. }
  1482. /**
  1483. * qdf_nbuf_data_is_ipv4_pkt() - check if packet is a ipv4 packet or not
  1484. * @data: data
  1485. *
  1486. * This api is for Tx packets.
  1487. *
  1488. * Return: true if packet is ipv4 packet
  1489. */
  1490. static inline
  1491. bool qdf_nbuf_data_is_ipv4_pkt(uint8_t *data)
  1492. {
  1493. return __qdf_nbuf_data_is_ipv4_pkt(data);
  1494. }
  1495. /**
  1496. * qdf_nbuf_is_ipv4_dhcp_pkt() - check if packet is a dhcp packet or not
  1497. * @buf: buffer
  1498. *
  1499. * This api is for ipv4 packet.
  1500. *
  1501. * Return: true if packet is DHCP packet
  1502. */
  1503. static inline
  1504. bool qdf_nbuf_is_ipv4_dhcp_pkt(qdf_nbuf_t buf)
  1505. {
  1506. return __qdf_nbuf_data_is_ipv4_dhcp_pkt(qdf_nbuf_data(buf));
  1507. }
  1508. /**
  1509. * qdf_nbuf_data_is_ipv4_dhcp_pkt() - check if it is DHCP packet.
  1510. * @data: Pointer to DHCP packet data buffer
  1511. *
  1512. * This func. checks whether it is a DHCP packet or not.
  1513. *
  1514. * Return: true if it is a DHCP packet
  1515. * false if not
  1516. */
  1517. static inline
  1518. bool qdf_nbuf_data_is_ipv4_dhcp_pkt(uint8_t *data)
  1519. {
  1520. return __qdf_nbuf_data_is_ipv4_dhcp_pkt(data);
  1521. }
  1522. /**
  1523. * qdf_nbuf_is_ipv4_eapol_pkt() - check if packet is a eapol packet or not
  1524. * @buf: buffer
  1525. *
  1526. * This api is for ipv4 packet.
  1527. *
  1528. * Return: true if packet is EAPOL packet
  1529. */
  1530. static inline
  1531. bool qdf_nbuf_is_ipv4_eapol_pkt(qdf_nbuf_t buf)
  1532. {
  1533. return __qdf_nbuf_data_is_ipv4_eapol_pkt(qdf_nbuf_data(buf));
  1534. }
  1535. /**
  1536. * qdf_nbuf_data_is_ipv4_eapol_pkt() - check if it is EAPOL packet.
  1537. * @data: Pointer to EAPOL packet data buffer
  1538. *
  1539. * This func. checks whether it is a EAPOL packet or not.
  1540. *
  1541. * Return: true if it is a EAPOL packet
  1542. * false if not
  1543. */
  1544. static inline
  1545. bool qdf_nbuf_data_is_ipv4_eapol_pkt(uint8_t *data)
  1546. {
  1547. return __qdf_nbuf_data_is_ipv4_eapol_pkt(data);
  1548. }
  1549. /**
  1550. * qdf_nbuf_is_ipv4_wapi_pkt() - check if packet is a wapi packet or not
  1551. * @buf: buffer
  1552. *
  1553. * This api is for ipv4 packet.
  1554. *
  1555. * Return: true if packet is WAPI packet
  1556. */
  1557. static inline
  1558. bool qdf_nbuf_is_ipv4_wapi_pkt(qdf_nbuf_t buf)
  1559. {
  1560. return __qdf_nbuf_is_ipv4_wapi_pkt(buf);
  1561. }
  1562. /**
  1563. * qdf_nbuf_is_ipv4_arp_pkt() - check if packet is a arp packet or not
  1564. * @buf: buffer
  1565. *
  1566. * This api is for ipv4 packet.
  1567. *
  1568. * Return: true if packet is ARP packet
  1569. */
  1570. static inline
  1571. bool qdf_nbuf_is_ipv4_arp_pkt(qdf_nbuf_t buf)
  1572. {
  1573. return __qdf_nbuf_data_is_ipv4_arp_pkt(qdf_nbuf_data(buf));
  1574. }
  1575. /**
  1576. * qdf_nbuf_data_is_ipv4_arp_pkt() - check if it is ARP packet.
  1577. * @data: Pointer to ARP packet data buffer
  1578. *
  1579. * This func. checks whether it is a ARP packet or not.
  1580. *
  1581. * Return: TRUE if it is a ARP packet
  1582. * FALSE if not
  1583. */
  1584. static inline
  1585. bool qdf_nbuf_data_is_ipv4_arp_pkt(uint8_t *data)
  1586. {
  1587. return __qdf_nbuf_data_is_ipv4_arp_pkt(data);
  1588. }
  1589. /**
  1590. * qdf_nbuf_is_ipv6_pkt() - check if it is IPV6 packet.
  1591. * @buf: Pointer to IPV6 packet buffer
  1592. *
  1593. * This func. checks whether it is a IPV6 packet or not.
  1594. *
  1595. * Return: TRUE if it is a IPV6 packet
  1596. * FALSE if not
  1597. */
  1598. static inline
  1599. bool qdf_nbuf_is_ipv6_pkt(qdf_nbuf_t buf)
  1600. {
  1601. return __qdf_nbuf_data_is_ipv6_pkt(qdf_nbuf_data(buf));
  1602. }
  1603. /**
  1604. * qdf_nbuf_data_is_ipv6_pkt() - check if it is IPV6 packet.
  1605. * @data: Pointer to IPV6 packet data buffer
  1606. *
  1607. * This func. checks whether it is a IPV6 packet or not.
  1608. *
  1609. * Return: TRUE if it is a IPV6 packet
  1610. * FALSE if not
  1611. */
  1612. static inline
  1613. bool qdf_nbuf_data_is_ipv6_pkt(uint8_t *data)
  1614. {
  1615. return __qdf_nbuf_data_is_ipv6_pkt(data);
  1616. }
  1617. /**
  1618. * qdf_nbuf_data_is_ipv4_mcast_pkt() - check if it is IPV4 multicast packet.
  1619. * @data: Pointer to IPV4 packet data buffer
  1620. *
  1621. * This func. checks whether it is a IPV4 multicast packet or not.
  1622. *
  1623. * Return: TRUE if it is a IPV4 multicast packet
  1624. * FALSE if not
  1625. */
  1626. static inline
  1627. bool qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data)
  1628. {
  1629. return __qdf_nbuf_data_is_ipv4_mcast_pkt(data);
  1630. }
  1631. /**
  1632. * qdf_nbuf_data_is_ipv6_mcast_pkt() - check if it is IPV6 multicast packet.
  1633. * @data: Pointer to IPV6 packet data buffer
  1634. *
  1635. * This func. checks whether it is a IPV6 multicast packet or not.
  1636. *
  1637. * Return: TRUE if it is a IPV6 multicast packet
  1638. * FALSE if not
  1639. */
  1640. static inline
  1641. bool qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data)
  1642. {
  1643. return __qdf_nbuf_data_is_ipv6_mcast_pkt(data);
  1644. }
  1645. /**
  1646. * qdf_nbuf_is_icmp_pkt() - check if it is IPV4 ICMP packet.
  1647. * @buf: Pointer to IPV4 ICMP packet buffer
  1648. *
  1649. * This func. checks whether it is a ICMP packet or not.
  1650. *
  1651. * Return: TRUE if it is a ICMP packet
  1652. * FALSE if not
  1653. */
  1654. static inline
  1655. bool qdf_nbuf_is_icmp_pkt(qdf_nbuf_t buf)
  1656. {
  1657. return __qdf_nbuf_data_is_icmp_pkt(qdf_nbuf_data(buf));
  1658. }
  1659. /**
  1660. * qdf_nbuf_data_is_icmp_pkt() - check if it is IPV4 ICMP packet.
  1661. * @data: Pointer to IPV4 ICMP packet data buffer
  1662. *
  1663. * This func. checks whether it is a ICMP packet or not.
  1664. *
  1665. * Return: TRUE if it is a ICMP packet
  1666. * FALSE if not
  1667. */
  1668. static inline
  1669. bool qdf_nbuf_data_is_icmp_pkt(uint8_t *data)
  1670. {
  1671. return __qdf_nbuf_data_is_icmp_pkt(data);
  1672. }
  1673. /**
  1674. * qdf_nbuf_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
  1675. * @buf: Pointer to IPV6 ICMPV6 packet buffer
  1676. *
  1677. * This func. checks whether it is a ICMPV6 packet or not.
  1678. *
  1679. * Return: TRUE if it is a ICMPV6 packet
  1680. * FALSE if not
  1681. */
  1682. static inline
  1683. bool qdf_nbuf_is_icmpv6_pkt(qdf_nbuf_t buf)
  1684. {
  1685. return __qdf_nbuf_data_is_icmpv6_pkt(qdf_nbuf_data(buf));
  1686. }
  1687. /**
  1688. * qdf_nbuf_data_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
  1689. * @data: Pointer to IPV6 ICMPV6 packet data buffer
  1690. *
  1691. * This func. checks whether it is a ICMPV6 packet or not.
  1692. *
  1693. * Return: TRUE if it is a ICMPV6 packet
  1694. * FALSE if not
  1695. */
  1696. static inline
  1697. bool qdf_nbuf_data_is_icmpv6_pkt(uint8_t *data)
  1698. {
  1699. return __qdf_nbuf_data_is_icmpv6_pkt(data);
  1700. }
  1701. /**
  1702. * qdf_nbuf_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
  1703. * @buf: Pointer to IPV4 UDP packet buffer
  1704. *
  1705. * This func. checks whether it is a IPV4 UDP packet or not.
  1706. *
  1707. * Return: TRUE if it is a IPV4 UDP packet
  1708. * FALSE if not
  1709. */
  1710. static inline
  1711. bool qdf_nbuf_is_ipv4_udp_pkt(qdf_nbuf_t buf)
  1712. {
  1713. return __qdf_nbuf_data_is_ipv4_udp_pkt(qdf_nbuf_data(buf));
  1714. }
  1715. /**
  1716. * qdf_nbuf_data_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
  1717. * @data: Pointer to IPV4 UDP packet data buffer
  1718. *
  1719. * This func. checks whether it is a IPV4 UDP packet or not.
  1720. *
  1721. * Return: TRUE if it is a IPV4 UDP packet
  1722. * FALSE if not
  1723. */
  1724. static inline
  1725. bool qdf_nbuf_data_is_ipv4_udp_pkt(uint8_t *data)
  1726. {
  1727. return __qdf_nbuf_data_is_ipv4_udp_pkt(data);
  1728. }
  1729. /**
  1730. * qdf_nbuf_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
  1731. * @buf: Pointer to IPV4 TCP packet buffer
  1732. *
  1733. * This func. checks whether it is a IPV4 TCP packet or not.
  1734. *
  1735. * Return: TRUE if it is a IPV4 TCP packet
  1736. * FALSE if not
  1737. */
  1738. static inline
  1739. bool qdf_nbuf_is_ipv4_tcp_pkt(qdf_nbuf_t buf)
  1740. {
  1741. return __qdf_nbuf_data_is_ipv4_tcp_pkt(qdf_nbuf_data(buf));
  1742. }
  1743. /**
  1744. * qdf_nbuf_data_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
  1745. * @data: Pointer to IPV4 TCP packet data buffer
  1746. *
  1747. * This func. checks whether it is a IPV4 TCP packet or not.
  1748. *
  1749. * Return: TRUE if it is a IPV4 TCP packet
  1750. * FALSE if not
  1751. */
  1752. static inline
  1753. bool qdf_nbuf_data_is_ipv4_tcp_pkt(uint8_t *data)
  1754. {
  1755. return __qdf_nbuf_data_is_ipv4_tcp_pkt(data);
  1756. }
  1757. /**
  1758. * qdf_nbuf_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
  1759. * @buf: Pointer to IPV6 UDP packet buffer
  1760. *
  1761. * This func. checks whether it is a IPV6 UDP packet or not.
  1762. *
  1763. * Return: TRUE if it is a IPV6 UDP packet
  1764. * FALSE if not
  1765. */
  1766. static inline
  1767. bool qdf_nbuf_is_ipv6_udp_pkt(qdf_nbuf_t buf)
  1768. {
  1769. return __qdf_nbuf_data_is_ipv6_udp_pkt(qdf_nbuf_data(buf));
  1770. }
  1771. /**
  1772. * qdf_nbuf_data_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
  1773. * @data: Pointer to IPV6 UDP packet data buffer
  1774. *
  1775. * This func. checks whether it is a IPV6 UDP packet or not.
  1776. *
  1777. * Return: TRUE if it is a IPV6 UDP packet
  1778. * FALSE if not
  1779. */
  1780. static inline
  1781. bool qdf_nbuf_data_is_ipv6_udp_pkt(uint8_t *data)
  1782. {
  1783. return __qdf_nbuf_data_is_ipv6_udp_pkt(data);
  1784. }
  1785. /**
  1786. * qdf_nbuf_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
  1787. * @buf: Pointer to IPV6 TCP packet buffer
  1788. *
  1789. * This func. checks whether it is a IPV6 TCP packet or not.
  1790. *
  1791. * Return: TRUE if it is a IPV6 TCP packet
  1792. * FALSE if not
  1793. */
  1794. static inline
  1795. bool qdf_nbuf_is_ipv6_tcp_pkt(qdf_nbuf_t buf)
  1796. {
  1797. return __qdf_nbuf_data_is_ipv6_tcp_pkt(qdf_nbuf_data(buf));
  1798. }
  1799. /**
  1800. * qdf_nbuf_data_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
  1801. * @data: Pointer to IPV6 TCP packet data buffer
  1802. *
  1803. * This func. checks whether it is a IPV6 TCP packet or not.
  1804. *
  1805. * Return: TRUE if it is a IPV6 TCP packet
  1806. * FALSE if not
  1807. */
  1808. static inline
  1809. bool qdf_nbuf_data_is_ipv6_tcp_pkt(uint8_t *data)
  1810. {
  1811. return __qdf_nbuf_data_is_ipv6_tcp_pkt(data);
  1812. }
  1813. /**
  1814. * qdf_invalidate_range() - invalidate virtual address range
  1815. * @start: start address of the address range
  1816. * @end: end address of the address range
  1817. *
  1818. * Note that this function does not write back the cache entries.
  1819. *
  1820. * Return: none
  1821. */
  1822. static inline void qdf_invalidate_range(void *start, void *end)
  1823. {
  1824. __qdf_invalidate_range(start, end);
  1825. }
  1826. /**
  1827. * qdf_nbuf_reset_num_frags() - decrement the number of fragments
  1828. * @buf: Network buffer
  1829. *
  1830. * Return: Number of fragments
  1831. */
  1832. static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf)
  1833. {
  1834. __qdf_nbuf_reset_num_frags(buf);
  1835. }
  1836. /**
  1837. * qdf_dmaaddr_to_32s - return high and low parts of dma_addr
  1838. *
  1839. * Returns the high and low 32-bits of the DMA addr in the provided ptrs
  1840. *
  1841. * Return: N/A
  1842. */
  1843. static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
  1844. uint32_t *lo, uint32_t *hi)
  1845. {
  1846. return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi);
  1847. }
  1848. /**
  1849. * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO
  1850. * network buffer into segments
  1851. * @nbuf: network buffer to be segmented
  1852. * @tso_info: This is the output. The information about the
  1853. * TSO segments will be populated within this.
  1854. *
  1855. * This function fragments a TCP jumbo packet into smaller
  1856. * segments to be transmitted by the driver. It chains the TSO
  1857. * segments created into a list.
  1858. *
  1859. * Return: number of TSO segments
  1860. */
  1861. static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev,
  1862. qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info)
  1863. {
  1864. return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info);
  1865. }
  1866. /**
  1867. * qdf_nbuf_unmap_tso_segment() - function to dma unmap TSO segment element
  1868. *
  1869. * @osdev: qdf device handle
  1870. * @tso_seg: TSO segment element to be unmapped
  1871. * @is_last_seg: whether this is last tso seg or not
  1872. *
  1873. * Return: none
  1874. */
  1875. static inline void qdf_nbuf_unmap_tso_segment(qdf_device_t osdev,
  1876. struct qdf_tso_seg_elem_t *tso_seg,
  1877. bool is_last_seg)
  1878. {
  1879. return __qdf_nbuf_unmap_tso_segment(osdev, tso_seg, is_last_seg);
  1880. }
  1881. /**
  1882. * qdf_nbuf_get_tso_num_seg() - function to calculate the number
  1883. * of TCP segments within the TSO jumbo packet
  1884. * @nbuf: TSO jumbo network buffer to be segmented
  1885. *
  1886. * This function calculates the number of TCP segments that the
  1887. network buffer can be divided into.
  1888. *
  1889. * Return: number of TCP segments
  1890. */
  1891. static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf)
  1892. {
  1893. return __qdf_nbuf_get_tso_num_seg(nbuf);
  1894. }
  1895. /**
  1896. * qdf_nbuf_inc_users() - function to increment the number of
  1897. * users referencing this network buffer
  1898. *
  1899. * @nbuf: network buffer
  1900. *
  1901. * This function increments the number of users referencing this
  1902. * network buffer
  1903. *
  1904. * Return: the network buffer
  1905. */
  1906. static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf)
  1907. {
  1908. return __qdf_nbuf_inc_users(nbuf);
  1909. }
  1910. /**
  1911. * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb
  1912. *
  1913. * @nbuf: Network buffer (skb on linux)
  1914. *
  1915. * This function returns the values of data_attr field
  1916. * in struct cvg_nbuf_cb{}, to which skb->cb is typecast.
  1917. * This value is actually the value programmed in CE descriptor.
  1918. *
  1919. * Return: Value of data_attr
  1920. */
  1921. static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf)
  1922. {
  1923. return __qdf_nbuf_data_attr_get(buf);
  1924. }
  1925. /**
  1926. * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb
  1927. *
  1928. * @nbuf: Network buffer (skb on linux)
  1929. * @data_attr: Value to be stored cvg_nbuf_cb->data_attr
  1930. *
  1931. * This function stores the value to be programmed in CE
  1932. * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{}
  1933. *
  1934. * Return: void
  1935. */
  1936. static inline
  1937. void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr)
  1938. {
  1939. __qdf_nbuf_data_attr_set(buf, data_attr);
  1940. }
  1941. /**
  1942. * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata
  1943. *
  1944. * @nbuf: Network buffer (skb on linux)
  1945. *
  1946. * This function parses the payload to figure out relevant
  1947. * Tx meta-data e.g. whether to enable tx_classify bit
  1948. * in CE.
  1949. *
  1950. * Return: void
  1951. */
  1952. #define qdf_nbuf_tx_info_get __qdf_nbuf_tx_info_get
  1953. void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state);
  1954. void qdf_nbuf_tx_desc_count_display(void);
  1955. void qdf_nbuf_tx_desc_count_clear(void);
  1956. static inline qdf_nbuf_t
  1957. qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom)
  1958. {
  1959. return __qdf_nbuf_realloc_headroom(buf, headroom);
  1960. }
  1961. static inline qdf_nbuf_t
  1962. qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom)
  1963. {
  1964. return __qdf_nbuf_realloc_tailroom(buf, tailroom);
  1965. }
  1966. static inline qdf_nbuf_t
  1967. qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom)
  1968. {
  1969. return __qdf_nbuf_expand(buf, headroom, tailroom);
  1970. }
  1971. static inline qdf_nbuf_t
  1972. qdf_nbuf_unshare(qdf_nbuf_t buf)
  1973. {
  1974. return __qdf_nbuf_unshare(buf);
  1975. }
  1976. static inline bool
  1977. qdf_nbuf_is_cloned(qdf_nbuf_t buf)
  1978. {
  1979. return __qdf_nbuf_is_cloned(buf);
  1980. }
  1981. static inline void
  1982. qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg)
  1983. {
  1984. __qdf_nbuf_frag_info(buf, sg);
  1985. }
  1986. static inline qdf_nbuf_tx_cksum_t
  1987. qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where)
  1988. {
  1989. return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where);
  1990. }
  1991. static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf)
  1992. {
  1993. __qdf_nbuf_reset_ctxt(nbuf);
  1994. }
  1995. static inline void
  1996. qdf_nbuf_set_rx_info(__qdf_nbuf_t nbuf, void *info, uint32_t len)
  1997. {
  1998. __qdf_nbuf_set_rx_info(nbuf, info, len);
  1999. }
  2000. static inline void *qdf_nbuf_get_rx_info(__qdf_nbuf_t nbuf)
  2001. {
  2002. return __qdf_nbuf_get_rx_info(nbuf);
  2003. }
  2004. static inline void qdf_nbuf_init(qdf_nbuf_t buf)
  2005. {
  2006. __qdf_nbuf_init(buf);
  2007. }
  2008. static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf)
  2009. {
  2010. return __qdf_nbuf_network_header(buf);
  2011. }
  2012. static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf)
  2013. {
  2014. return __qdf_nbuf_transport_header(buf);
  2015. }
  2016. static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf)
  2017. {
  2018. return __qdf_nbuf_tcp_tso_size(buf);
  2019. }
  2020. static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf)
  2021. {
  2022. return __qdf_nbuf_get_cb(nbuf);
  2023. }
  2024. static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf)
  2025. {
  2026. return __qdf_nbuf_get_nr_frags(nbuf);
  2027. }
  2028. static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf)
  2029. {
  2030. return __qdf_nbuf_headlen(buf);
  2031. }
  2032. static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev,
  2033. qdf_nbuf_t buf, int offset,
  2034. qdf_dma_dir_t dir, int cur_frag)
  2035. {
  2036. return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag);
  2037. }
  2038. static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf)
  2039. {
  2040. return __qdf_nbuf_tso_tcp_v4(buf);
  2041. }
  2042. static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf)
  2043. {
  2044. return __qdf_nbuf_tso_tcp_v6(buf);
  2045. }
  2046. static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf)
  2047. {
  2048. return __qdf_nbuf_tcp_seq(buf);
  2049. }
  2050. static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf)
  2051. {
  2052. return __qdf_nbuf_l2l3l4_hdr_len(buf);
  2053. }
  2054. static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf)
  2055. {
  2056. return __qdf_nbuf_is_nonlinear(buf);
  2057. }
  2058. static inline uint32_t
  2059. qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num)
  2060. {
  2061. return __qdf_nbuf_get_frag_size(buf, frag_num);
  2062. }
  2063. static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf)
  2064. {
  2065. return __qdf_nbuf_get_priority(buf);
  2066. }
  2067. static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p)
  2068. {
  2069. __qdf_nbuf_set_priority(buf, p);
  2070. }
  2071. static inline uint16_t
  2072. qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf)
  2073. {
  2074. return __qdf_nbuf_get_queue_mapping(buf);
  2075. }
  2076. static inline uint8_t *
  2077. qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf)
  2078. {
  2079. return __qdf_nbuf_get_priv_ptr(buf);
  2080. }
  2081. /**
  2082. * qdf_nbuf_update_radiotap() - update radiotap at head of nbuf.
  2083. * @rx_status: rx_status containing required info to update radiotap
  2084. * @nbuf: Pointer to nbuf
  2085. * @headroom_sz: Available headroom size
  2086. *
  2087. * Return: radiotap length.
  2088. */
  2089. unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status,
  2090. qdf_nbuf_t nbuf, uint32_t headroom_sz);
  2091. /**
  2092. * qdf_nbuf_mark_wakeup_frame() - mark wakeup frame.
  2093. * @buf: Pointer to nbuf
  2094. *
  2095. * Return: None
  2096. */
  2097. static inline void
  2098. qdf_nbuf_mark_wakeup_frame(qdf_nbuf_t buf)
  2099. {
  2100. __qdf_nbuf_mark_wakeup_frame(buf);
  2101. }
  2102. /**
  2103. * qdf_nbuf_reg_free_cb - Registers nbuf free callback
  2104. * @cb_func_ptr: Callback pointer
  2105. *
  2106. * This function registers nbuf free callback
  2107. *
  2108. * Return: void
  2109. */
  2110. static inline void
  2111. qdf_nbuf_reg_free_cb(qdf_nbuf_free_t cb_func_ptr)
  2112. {
  2113. __qdf_nbuf_reg_free_cb(cb_func_ptr);
  2114. }
  2115. #endif /* _QDF_NBUF_H */