qdf_nbuf.h 66 KB

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