qdf_nbuf.h 60 KB

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