qdf_nbuf.h 90 KB

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