qdf_nbuf.h 64 KB

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