qdf_nbuf.h 75 KB

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