qdf_nbuf.h 75 KB

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