| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771 |
- /*
- ** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/nic_rx.c#3
- */
- /*! \file nic_rx.c
- \brief Functions that provide many rx-related functions
- This file includes the functions used to process RFB and dispatch RFBs to
- the appropriate related rx functions for protocols.
- */
- /*
- ** Log: nic_rx.c
- **
- ** 08 31 2012 yuche.tsai
- ** [ALPS00349585] [6577JB][WiFi direct][KE]Establish p2p connection while both device have connected to AP previously,
- ** one device reboots automatically with KE
- ** Fix possible KE when concurrent & disconnect.
- *
- * 07 17 2012 yuche.tsai
- * NULL
- * Let netdev bring up.
- *
- * 07 17 2012 yuche.tsai
- * NULL
- * Compile no error before trial run.
- *
- * 03 02 2012 terry.wu
- * NULL
- * Sync CFG80211 modification from branch 2,2.
- *
- * 02 14 2012 cp.wu
- * NULL
- * remove another assertion by error message dump
- *
- * 01 05 2012 tsaiyuan.hsu
- * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v
- * add timing measurement support for 802.11v.
- *
- * 11 19 2011 yuche.tsai
- * NULL
- * Update RSSI for P2P.
- *
- * 11 18 2011 yuche.tsai
- * NULL
- * CONFIG P2P support RSSI query, default turned off.
- *
- * 11 17 2011 tsaiyuan.hsu
- * [WCXRP00001115] [MT6620 Wi-Fi][DRV] avoid deactivating staRec when changing state 3 to 3.
- * avoid deactivating staRec when changing state from 3 to 3.
- *
- * 11 11 2011 wh.su
- * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
- * modify the xlog related code.
- *
- * 11 10 2011 eddie.chen
- * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
- * Modify the QM xlog level and remove LOG_FUNC.
- *
- * 11 09 2011 eddie.chen
- * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
- * Add xlog for beacon timeout and sta aging timeout.
- *
- * 11 08 2011 eddie.chen
- * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
- * Add xlog function.
- *
- * 11 07 2011 tsaiyuan.hsu
- * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
- * add debug counters and periodically dump counters for debugging.
- *
- * 10 21 2011 eddie.chen
- * [WCXRP00001051] [MT6620 Wi-Fi][Driver/Fw] Adjust the STA aging timeout
- * Add switch to ignore the STA aging timeout.
- *
- * 10 12 2011 wh.su
- * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP
- * adding the 802.11w related function and define .
- *
- * 08 26 2011 cp.wu
- * [WCXRP00000958] [MT6620 Wi-Fi][Driver] Extend polling timeout from 25ms to 1sec due to RF calibration might took
- * up to 600ms
- * extend polling RX response timeout period from 25ms to 1000ms.
- *
- * 08 11 2011 cp.wu
- * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time
- * sparse channel detection:
- * driver: collect sparse channel information with scan-done event
- *
- * 07 28 2011 chinghwa.yu
- * [WCXRP00000063] Update BCM CoEx design and settings
- * Add BWCS cmd and event.
- *
- * 07 27 2011 cp.wu
- * [WCXRP00000876] [MT5931][Drver] Decide to retain according to currently available RX counter and QUE_MGT used count
- * correct comment.
- *
- * 07 27 2011 cp.wu
- * [WCXRP00000876] [MT5931][Drver] Decide to retain according to currently available RX counter and QUE_MGT used count
- * take use of QUE_MGT exported function to estimate currently RX buffer usage count.
- *
- * 07 18 2011 chinghwa.yu
- * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm
- * Add CMD/Event for RDD and BWCS.
- *
- * 06 09 2011 tsaiyuan.hsu
- * [WCXRP00000760] [MT5931 Wi-Fi][FW] Refine rxmHandleMacRxDone to reduce code size
- * move send_auth at rxmHandleMacRxDone in firmware to driver to reduce code size.
- *
- * 05 11 2011 eddie.chen
- * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
- * Fix dest type when GO packet copying.
- *
- * 05 09 2011 eddie.chen
- * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet
- * Check free number before copying broadcast packet.
- *
- * 05 05 2011 cp.wu
- * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC
- * add delay after whole-chip resetting for MT5931 E1 ASIC.
- *
- * 04 18 2011 terry.wu
- * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED
- * Remove flag CFG_WIFI_DIRECT_MOVED.
- *
- * 04 12 2011 cm.chang
- * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency
- * .
- *
- * 04 08 2011 yuche.tsai
- * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO.
- * Add device discoverability support for GO.
- *
- * 04 01 2011 tsaiyuan.hsu
- * [WCXRP00000615] [MT 6620 Wi-Fi][Driver] Fix klocwork issues
- * fix the klocwork issues, 57500, 57501, 57502 and 57503.
- *
- * 03 19 2011 yuche.tsai
- * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct.
- * Add beacon timeout support for WiFi Direct Network.
- *
- * 03 18 2011 wh.su
- * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done
- * enable the Anti_piracy check at driver .
- *
- * 03 17 2011 cp.wu
- * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage
- * after system running for a long period
- * use pre-allocated buffer for storing enhanced interrupt response as well
- *
- * 03 15 2011 cp.wu
- * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous
- * memory consumption
- * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK
- * 2. Use common coalescing buffer for both TX/RX directions
- *
- *
- * 03 07 2011 wh.su
- * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
- * rename the define to anti_pviracy.
- *
- * 03 05 2011 wh.su
- * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
- * add the code to get the check rsponse and indicate to app.
- *
- * 03 02 2011 wh.su
- * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
- * Add security check code.
- *
- * 03 02 2011 cp.wu
- * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after
- * connection is built.
- * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI.
- *
- * 02 10 2011 yuche.tsai
- * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA
- * module.
- * Remove Station Record after Aging timeout.
- *
- * 02 10 2011 cp.wu
- * [WCXRP00000434] [MT6620 Wi-Fi][Driver] Obsolete unused event packet handlers
- * EVENT_ID_CONNECTION_STATUS has been obsoleted and no need to handle.
- *
- * 02 09 2011 yuche.tsai
- * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode.
- * Add MLME deauthentication support for Hot-Spot mode.
- *
- * 02 09 2011 eddie.chen
- * [WCXRP00000426] [MT6620 Wi-Fi][FW/Driver] Add STA aging timeout and defualtHwRatein AP mode
- * Adjust variable order.
- *
- * 02 08 2011 eddie.chen
- * [WCXRP00000426] [MT6620 Wi-Fi][FW/Driver] Add STA aging timeout and defualtHwRatein AP mode
- * Add event STA agint timeout
- *
- * 01 27 2011 tsaiyuan.hsu
- * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support
- * add roaming fsm
- * 1. not support 11r, only use strength of signal to determine roaming.
- * 2. not enable CFG_SUPPORT_ROAMING until completion of full test.
- * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw
- * 4. assume that change of link quality in smooth way.
- *
- * 01 26 2011 cm.chang
- * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
- * .
- *
- * 01 24 2011 eddie.chen
- * [WCXRP00000385] [MT6620 Wi-Fi][DRV] Add destination decision for forwarding packets
- * Remove comments.
- *
- * 01 24 2011 eddie.chen
- * [WCXRP00000385] [MT6620 Wi-Fi][DRV] Add destination decision for forwarding packets
- * Add destination decision in AP mode.
- *
- * 01 24 2011 cm.chang
- * [WCXRP00000384] [MT6620 Wi-Fi][Driver][FW] Handle 20/40 action frame in AP mode and stop ampdu timer when sta_rec
- * is freed
- * Process received 20/40 coexistence action frame for AP mode
- *
- * 01 24 2011 cp.wu
- * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving
- * 1. add an extra counter for tracking pending forward frames.
- * 2. notify TX service thread as well when there is pending forward frame
- * 3. correct build errors leaded by introduction of Wi-Fi direct separation module
- *
- * 01 12 2011 cp.wu
- * [WCXRP00000357] [MT6620 Wi-Fi][Driver][Bluetooth over Wi-Fi] add another net device interface for BT AMP
- * implementation of separate BT_OVER_WIFI data path.
- *
- * 12 29 2010 eddie.chen
- * [WCXRP00000322] Add WMM IE in beacon,
- Add per station flow control when STA is in PS
- * 1) PS flow control event
- *
- * 2) WMM IE in beacon, assoc resp, probe resp
- *
- * 12 15 2010 george.huang
- * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function
- * update beacon for NoA
- *
- * 11 01 2010 cp.wu
- * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver]
- * Add implementation for querying current TX rate from firmware auto rate module
- * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead
- * 2) Remove CNM CH-RECOVER event handling
- * 3) cfg read/write API renamed with kal prefix for unified naming rules.
- *
- * 10 27 2010 george.huang
- * [WCXRP00000127] [MT6620 Wi-Fi][Driver] Add a registry to disable Beacon Timeout function for SQA test by using E1 EVB
- * Support registry option for disable beacon lost detection.
- *
- * 10 20 2010 wh.su
- * NULL
- * add a cmd to reset the p2p key
- *
- * 10 20 2010 wh.su
- * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
- * Add the code to support disconnect p2p group
- *
- * 09 29 2010 wh.su
- * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue
- * fixed compilier error.
- *
- * 09 29 2010 wh.su
- * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue
- * [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue.
- *
- * 09 23 2010 cp.wu
- * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning
- * eliminate reference of CFG_RESPONSE_MAX_PKT_SIZE
- *
- * 09 21 2010 cp.wu
- * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS
- * associated
- * release RX packet to packet pool when in RF test mode
- *
- * 09 21 2010 cp.wu
- * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS
- @ associated
- * Do a complete reset with STA-REC null checking for RF test re-entry
- *
- * 09 08 2010 cp.wu
- * NULL
- * use static memory pool for storing IEs of scanning result.
- *
- * 09 07 2010 yuche.tsai
- * NULL
- * Add a common buffer, store the IE of a P2P device in this common buffer.
- *
- * 09 03 2010 kevin.huang
- * NULL
- * Refine #include sequence and solve recursive/nested #include issue
- *
- * 08 31 2010 kevin.huang
- * NULL
- * Use LINK LIST operation to process SCAN result
- *
- * 08 30 2010 cp.wu
- * NULL
- * eliminate klockwork errors
- *
- * 08 20 2010 cm.chang
- * NULL
- * Migrate RLM code to host from FW
- *
- * 08 20 2010 yuche.tsai
- * NULL
- * When enable WiFi Direct function, check each packet to tell which interface to indicate.
- *
- * 08 05 2010 yuche.tsai
- * NULL
- * Add P2P Device Discovery Function.
- *
- * 08 03 2010 cp.wu
- * NULL
- * surpress compilation warning.
- *
- * 08 03 2010 george.huang
- * NULL
- * handle event for updating NOA parameters indicated from FW
- *
- * 08 02 2010 yuche.tsai
- * NULL
- * Add support API for RX public action frame.
- *
- * 08 02 2010 jeffrey.chang
- * NULL
- * 1) modify tx service thread to avoid busy looping
- * 2) add spin lock declartion for linux build
- *
- * 07 30 2010 cp.wu
- * NULL
- * 1) BoW wrapper: use definitions instead of hard-coded constant for error code
- * 2) AIS-FSM: eliminate use of desired RF parameters, use prTargetBssDesc instead
- * 3) add handling for RX_PKT_DESTINATION_HOST_WITH_FORWARD for GO-broadcast frames
- *
- * 07 26 2010 yuche.tsai
- *
- * Update Device Capability Bitmap & Group Capability Bitmap from 16 bits to 8 bits.
- *
- * 07 24 2010 wh.su
- *
- * .support the Wi-Fi RSN
- *
- * 07 23 2010 cp.wu
- *
- * add AIS-FSM handling for beacon timeout event.
- *
- * 07 21 2010 yuche.tsai
- *
- * Add P2P Scan & Scan Result Parsing & Saving.
- *
- * 07 19 2010 cm.chang
- *
- * Set RLM parameters and enable CNM channel manager
- *
- * 07 19 2010 cp.wu
- *
- * [WPD00003833] [MT6620 and MT5931] Driver migration.
- * Add Ad-Hoc support to AIS-FSM
- *
- * 07 19 2010 jeffrey.chang
- *
- * Linux port modification
- *
- * 07 16 2010 yarco.yang
- *
- * 1. Support BSS Absence/Presence Event
- * 2. Support STA change PS mode Event
- * 3. Support BMC forwarding for AP mode.
- *
- * 07 15 2010 cp.wu
- *
- * sync. bluetooth-over-Wi-Fi interface to driver interface document v0.2.6.
- *
- * 07 08 2010 cp.wu
- *
- * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
- *
- * 07 07 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * fill ucStaRecIdx into SW_RFB_T.
- *
- * 07 02 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * 1) for event packet, no need to fill RFB.
- * 2) when wlanAdapterStart() failed, no need to initialize state machines
- * 3) after Beacon/ProbeResp parsing, corresponding BSS_DESC_T should be marked as IE-parsed
- *
- * 07 01 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * implementation of DRV-SCN and related mailbox message handling.
- *
- * 06 29 2010 yarco.yang
- * [WPD00003837][MT6620]Data Path Refine
- * replace g_rQM with Adpater->rQM
- *
- * 06 23 2010 yarco.yang
- * [WPD00003837][MT6620]Data Path Refine
- * Merge g_arStaRec[] into adapter->arStaRec[]
- *
- * 06 22 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * 1) add command warpper for STA-REC/BSS-INFO sync.
- * 2) enhance command packet sending procedure for non-oid part
- * 3) add command packet definitions for STA-REC/BSS-INFO sync.
- *
- * 06 21 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * refine TX-DONE callback.
- *
- * 06 21 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * implement TX_DONE callback path.
- *
- * 06 21 2010 yarco.yang
- * [WPD00003837][MT6620]Data Path Refine
- * Add TX Done Event handle entry
- *
- * 06 21 2010 wh.su
- * [WPD00003840][MT6620 5931] Security migration
- * remove duplicate variable for migration.
- *
- * 06 15 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * .
- *
- * 06 15 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * .
- *
- * 06 14 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * saa_fsm.c is migrated.
- *
- * 06 14 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * add management dispatching function table.
- *
- * 06 11 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * 1) migrate assoc.c.
- * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness
- * 3) add configuration options for CNM_MEM and RSN modules
- * 4) add data path for management frames
- * 5) eliminate rPacketInfo of MSDU_INFO_T
- *
- * 06 10 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * 1) eliminate CFG_CMD_EVENT_VERSION_0_9
- * 2) when disconnected, indicate nic directly (no event is needed)
- *
- * 06 08 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * cnm_timer has been migrated.
- *
- * 06 07 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * merge wlan_def.h.
- *
- * 06 07 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * sync with MT6620 driver for scan result replacement policy
- *
- * 06 06 2010 kevin.huang
- * [WPD00003832][MT6620 5931] Create driver base
- * [MT6620 5931] Create driver base
- *
- * 05 20 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS
- * 2) buffer statistics data for 2 seconds
- * 3) use default value for adhoc parameters instead of 0
- *
- * 05 19 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * 1) do not take timeout mechanism for power mode oids
- * 2) retrieve network type from connection status
- * 3) after disassciation, set radio state to off
- * 4) TCP option over IPv6 is supported
- *
- * 04 29 2010 wh.su
- * [WPD00003816][MT6620 Wi-Fi] Adding the security support
- * fixing the PMKID candicate indicate code.
- *
- * 04 28 2010 cp.wu
- * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
- * change prefix for data structure used to communicate with 802.11 PAL
- * to avoid ambiguous naming with firmware interface
- *
- * 04 27 2010 cp.wu
- * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
- * basic implementation for EVENT_BT_OVER_WIFI
- *
- * 04 23 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * surpress compiler warning
- *
- * 04 22 2010 jeffrey.chang
- * [WPD00003826]Initial import for Linux port
- *
- * 1) modify rx path code for supporting Wi-Fi direct
- * 2) modify config.h since Linux dont need to consider retaining packet
- *
- * 04 16 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * treat BUS access failure as kind of card removal.
- *
- * 04 14 2010 cp.wu
- * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
- * nicRxProcessEvent packet doesn't access spin-lock directly from now on.
- *
- * 04 14 2010 cp.wu
- * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
- * do not need to release the spin lock due to it is done inside nicGetPendingCmdInfo()
- *
- * 04 13 2010 cp.wu
- * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
- * add framework for BT-over-Wi-Fi support.
- * * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability
- * * * * * * * * * * * * * * * 2) command sequence number is now increased atomically
- * * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose
- *
- * 04 12 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * add channel frequency <-> number conversion
- *
- * 04 09 2010 jeffrey.chang
- * [WPD00003826]Initial import for Linux port
- * 1) add spinlock
- * 2) add KAPI for handling association info
- *
- * 04 07 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * rWlanInfo should be placed at adapter rather than glue due to most operations
- * * * * * are done in adapter layer.
- *
- * 04 07 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * eliminate direct access to prGlueInfo->eParamMediaStateIndicated from non-glue layer
- *
- * 04 06 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer
- *
- * 04 01 2010 jeffrey.chang
- * [WPD00003826]Initial import for Linux port
- * improve Linux supplicant compliance
- *
- * 03 31 2010 jeffrey.chang
- * [WPD00003826]Initial import for Linux port
- * fix ioctl which may cause cmdinfo memory leak
- *
- * 03 30 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * remove driver-land statistics.
- *
- * 03 29 2010 jeffrey.chang
- * [WPD00003826]Initial import for Linux port
- * improve none-glue code portability
- *
- * 03 28 2010 jeffrey.chang
- * [WPD00003826]Initial import for Linux port
- * rWlanInfo is modified before data is indicated to OS
- *
- * 03 28 2010 jeffrey.chang
- * [WPD00003826]Initial import for Linux port
- * rWlanInfo is modified before data is indicated to OS
- *
- * 03 26 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * add a temporary flag for integration with CMD/EVENT v0.9.
- *
- * 03 25 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * 1) correct OID_802_11_CONFIGURATION with frequency setting behavior.
- * * * the frequency is used for adhoc connection only
- * * * 2) update with SD1 v0.9 CMD/EVENT documentation
- *
- * 03 24 2010 jeffrey.chang
- * [WPD00003826]Initial import for Linux port
- * initial import for Linux port
- *
- * 03 24 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * .
- *
- * 03 24 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * generate information for OID_GEN_RCV_OK & OID_GEN_XMIT_OK
- * * * *
- *
- * 03 19 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * 1) add ACPI D0/D3 state switching support
- * * * * * * * * * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX
- * response
- *
- * 03 15 2010 kevin.huang
- * [WPD00003820][MT6620 Wi-Fi] Modify the code for meet the WHQL test
- * Add event for activate STA_RECORD_T
- *
- * 03 12 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * correct fgSetQuery/fgNeedResp check
- *
- * 03 11 2010 cp.wu
- * [WPD00003821][BUG] Host driver stops processing RX packets from HIF RX0
- * add RX starvation warning debug message controlled by CFG_HIF_RX_STARVATION_WARNING
- *
- * 03 10 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * code clean: removing unused variables and structure definitions
- *
- * 03 08 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * 1) add another spin-lock to protect MsduInfoList due to it might be accessed by different thread.
- * * * 2) change own-back acquiring procedure to wait for up to 16.67 seconds
- *
- * 03 02 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * 1) the use of prPendingOid revised, all accessing are now protected by spin lock
- * * * * 2) ensure wlanReleasePendingOid will clear all command queues
- *
- * 03 02 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * add mutex to avoid multiple access to qmTxQueue simultaneously.
- *
- * 02 26 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * move EVENT_ID_ASSOC_INFO from nic_rx.c to gl_kal_ndis_51.c
- * * 'cause it involves OS dependent data structure handling
- *
- * 02 25 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * correct behavior to prevent duplicated RX handling for RX0_DONE and RX1_DONE
- *
- * 02 24 2010 tehuang.liu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * Updated API interfaces for qmHandleEventRxAddBa() and qmHandleEventRxDelBa()
- *
- * 02 10 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * implement host-side firmware download logic
- *
- * 02 10 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * 1) remove unused function in nic_rx.c [which has been handled in que_mgt.c]
- * * * * * 2) firmware image length is now retrieved via NdisFileOpen
- * * * * * 3) firmware image is not structured by (P_IMG_SEC_HDR_T) anymore
- * * * * * 4) nicRxWaitResponse() revised
- * * * * * 5) another set of TQ counter default value is added for fw-download state
- * * * * * 6) Wi-Fi load address is now retrieved from registry too
- *
- * 02 09 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address
- * * * * * * * * 2. follow MSDN defined behavior when associates to another AP
- * * * * * * * * 3. for firmware download, packet size could be up to 2048 bytes
- *
- * 01 27 2010 wh.su
- * [WPD00003816][MT6620 Wi-Fi] Adding the security support
- * .
- *
- * 01 22 2010 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * implement following 802.11 OIDs:
- * * * * * * OID_802_11_RSSI,
- * * * * * * OID_802_11_RSSI_TRIGGER,
- * * * * * * OID_802_11_STATISTICS,
- * * * * * * OID_802_11_DISASSOCIATE,
- * * * * * * OID_802_11_POWER_MODE
- *
- * 12 30 2009 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * 1) According to CMD/EVENT documentation v0.8,
- * * * * * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used,
- * * * * * * * * * and result is retrieved by get ATInfo instead
- * * * * * * * * * 2) add 4 counter for recording aggregation statistics
- *
- * 12 23 2009 cp.wu
- * [WPD00001943]Create WiFi test driver framework on WinXP
- * add a precheck: if free sw rfb is not enough, do not invoke read transactionu1rwduu`wvpghlqg|fu+rp
- *
- * 12 22 2009 cp.wu
- * [WPD00003809][Bug] Host driver will crash when processing reordered MSDUs
- * The root cause is pointer accessing by mistake. After dequeued from reordering-buffer, handling logic should access
- * returned pointer instead of pointer which has been passed in before.
- ** \main\maintrunk.MT6620WiFiDriver_Prj\58 2009-12-17 13:40:33 GMT mtk02752
- ** always update prAdapter->rSDIOCtrl when enhanced response is read by RX
- ** \main\maintrunk.MT6620WiFiDriver_Prj\57 2009-12-16 18:01:38 GMT mtk02752
- ** if interrupt enhanced response is fetched by RX enhanced response, RX needs to invoke interrupt handlers too
- ** \main\maintrunk.MT6620WiFiDriver_Prj\56 2009-12-16 14:16:52 GMT mtk02752
- ** \main\maintrunk.MT6620WiFiDriver_Prj\55 2009-12-15 20:03:12 GMT mtk02752
- ** ASSERT when RX FreeSwRfb is not enough
- ** \main\maintrunk.MT6620WiFiDriver_Prj\54 2009-12-15 17:01:29 GMT mtk02752
- ** when CFG_SDIO_RX_ENHANCE is enabled, after enhanced response is read, rx procedure should process
- ** 1) TX_DONE_INT 2) D2H INT as well
- ** \main\maintrunk.MT6620WiFiDriver_Prj\53 2009-12-14 20:45:28 GMT mtk02752
- ** when CFG_SDIO_RX_ENHANCE is set, TC counter must be updated each time RX enhance response is read
- **
- ** \main\maintrunk.MT6620WiFiDriver_Prj\52 2009-12-14 11:34:16 GMT mtk02752
- ** correct a trivial logic issue
- ** \main\maintrunk.MT6620WiFiDriver_Prj\51 2009-12-14 10:28:25 GMT mtk02752
- ** add a protection to avoid out-of-boundary access
- ** \main\maintrunk.MT6620WiFiDriver_Prj\50 2009-12-10 16:55:18 GMT mtk02752
- ** code clean
- ** \main\maintrunk.MT6620WiFiDriver_Prj\49 2009-12-09 14:06:47 GMT MTK02468
- ** Added parsing event packets with EVENT_ID_RX_ADDBA or EVENT_ID_RX_DELBA
- ** \main\maintrunk.MT6620WiFiDriver_Prj\48 2009-12-08 17:37:51 GMT mtk02752
- ** handle EVENT_ID_TEST_STATUS as well
- ** \main\maintrunk.MT6620WiFiDriver_Prj\47 2009-12-04 17:59:11 GMT mtk02752
- ** to pass free-build compilation check
- ** \main\maintrunk.MT6620WiFiDriver_Prj\46 2009-12-04 12:09:52 GMT mtk02752
- ** correct trivial mistake
- ** \main\maintrunk.MT6620WiFiDriver_Prj\45 2009-12-04 11:53:37 GMT mtk02752
- ** all API should be compilable under SD1_SD3_DATAPATH_INTEGRATION == 0
- ** \main\maintrunk.MT6620WiFiDriver_Prj\44 2009-12-03 16:19:48 GMT mtk01461
- ** Fix the Connected Event
- ** \main\maintrunk.MT6620WiFiDriver_Prj\43 2009-11-30 10:56:18 GMT mtk02752
- ** 1st DW of WIFI_EVENT_T is shared with HIF_RX_HEADER_T
- ** \main\maintrunk.MT6620WiFiDriver_Prj\42 2009-11-30 10:11:27 GMT mtk02752
- ** implement replacement for bss scan result
- ** \main\maintrunk.MT6620WiFiDriver_Prj\41 2009-11-27 11:08:05 GMT mtk02752
- ** add flush for reset
- ** \main\maintrunk.MT6620WiFiDriver_Prj\40 2009-11-26 09:38:59 GMT mtk02752
- ** \main\maintrunk.MT6620WiFiDriver_Prj\39 2009-11-26 09:29:40 GMT mtk02752
- ** enable packet forwarding path (for AP mode)
- ** \main\maintrunk.MT6620WiFiDriver_Prj\38 2009-11-25 21:37:00 GMT mtk02752
- ** sync. with EVENT_SCAN_RESULT_T change, and add an assert for checking event size
- ** \main\maintrunk.MT6620WiFiDriver_Prj\37 2009-11-25 20:17:41 GMT mtk02752
- ** fill HIF_TX_HEADER_T.u2SeqNo
- ** \main\maintrunk.MT6620WiFiDriver_Prj\36 2009-11-25 18:18:57 GMT mtk02752
- ** buffer scan result to prGlueInfo->rWlanInfo.arScanResult directly.
- ** \main\maintrunk.MT6620WiFiDriver_Prj\35 2009-11-24 22:42:45 GMT mtk02752
- ** add nicRxAddScanResult() to prepare to handle SCAN_RESULT event (not implemented yet)
- ** \main\maintrunk.MT6620WiFiDriver_Prj\34 2009-11-24 20:51:41 GMT mtk02752
- ** integrate with SD1's data path API
- ** \main\maintrunk.MT6620WiFiDriver_Prj\33 2009-11-24 19:56:17 GMT mtk02752
- ** adopt P_HIF_RX_HEADER_T in new path
- ** \main\maintrunk.MT6620WiFiDriver_Prj\32 2009-11-23 20:31:21 GMT mtk02752
- ** payload to send into pfCmdDoneHandler() will not include WIFI_EVENT_T
- ** \main\maintrunk.MT6620WiFiDriver_Prj\31 2009-11-23 17:51:34 GMT mtk02752
- ** when event packet corresponding to some pendingOID is received, pendingOID should be cleared
- ** \main\maintrunk.MT6620WiFiDriver_Prj\30 2009-11-23 14:46:54 GMT mtk02752
- ** implement nicRxProcessEventPacket()
- ** \main\maintrunk.MT6620WiFiDriver_Prj\29 2009-11-17 22:40:54 GMT mtk01084
- ** \main\maintrunk.MT6620WiFiDriver_Prj\28 2009-11-16 21:48:22 GMT mtk02752
- ** add SD1_SD3_DATAPATH_INTEGRATION data path handling
- ** \main\maintrunk.MT6620WiFiDriver_Prj\27 2009-11-16 15:41:18 GMT mtk01084
- ** modify the length to be read in emu mode
- ** \main\maintrunk.MT6620WiFiDriver_Prj\26 2009-11-13 17:00:12 GMT mtk02752
- ** add blank function for event packet
- ** \main\maintrunk.MT6620WiFiDriver_Prj\25 2009-11-13 13:54:24 GMT mtk01084
- ** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-11-11 14:41:51 GMT mtk02752
- ** fix typo
- ** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-11-11 14:33:46 GMT mtk02752
- ** add protection when there is no packet avilable
- ** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-11-11 12:33:36 GMT mtk02752
- ** add RX1 read path for aggregated/enhanced/normal packet read procedures
- ** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-11-11 10:36:18 GMT mtk01084
- ** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-11-04 14:11:08 GMT mtk01084
- ** modify lines in RX aggregation
- ** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-10-30 18:17:23 GMT mtk01084
- ** modify RX aggregation handling
- ** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-10-29 19:56:12 GMT mtk01084
- ** modify HAL part
- ** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-10-23 16:08:34 GMT mtk01084
- ** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-10-13 21:59:20 GMT mtk01084
- ** update for new HW design
- ** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-10-02 13:59:08 GMT mtk01725
- ** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-05-21 23:39:05 GMT mtk01461
- ** Fix the paste error of RX STATUS in OOB of HIF Loopback CTRL
- ** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-05-20 12:25:32 GMT mtk01461
- ** Fix process of Read Done, and add u4MaxEventBufferLen to nicRxWaitResponse()
- ** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-05-18 21:13:18 GMT mtk01426
- ** Fixed compiler error
- ** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-05-18 21:05:29 GMT mtk01426
- ** Fixed nicRxSDIOAggReceiveRFBs() ASSERT issue
- ** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-04-28 10:38:43 GMT mtk01461
- ** Fix RX STATUS is DW align for SDIO_STATUS_ENHANCE mode and refine nicRxSDIOAggeceiveRFBs() for RX Aggregation
- ** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-04-22 09:12:17 GMT mtk01461
- ** Fix nicRxProcessHIFLoopbackPacket(), the size of HIF CTRL LENGTH field is 1 byte
- ** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-04-14 15:51:26 GMT mtk01426
- ** Update RX OOB Setting
- ** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-03 14:58:58 GMT mtk01426
- ** Fixed logical error
- ** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-01 10:58:31 GMT mtk01461
- ** Rename the HIF_PKT_TYPE_DATA
- ** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-23 21:51:18 GMT mtk01461
- ** Fix u4HeaderOffset in nicRxProcessHIFLoopbackPacket()
- ** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-18 21:02:58 GMT mtk01426
- ** Add CFG_SDIO_RX_ENHANCE and CFG_HIF_LOOPBACK support
- ** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-17 20:20:59 GMT mtk01426
- ** Add nicRxWaitResponse function
- ** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:26:01 GMT mtk01426
- ** Init for develop
- **
- */
- /*******************************************************************************
- * C O M P I L E R F L A G S
- ********************************************************************************
- */
- /*******************************************************************************
- * E X T E R N A L R E F E R E N C E S
- ********************************************************************************
- */
- #include "precomp.h"
- #ifndef LINUX
- #include <limits.h>
- #else
- #include <linux/limits.h>
- #endif
- #include "gl_os.h"
- #include "debug.h"
- #include "wlan_lib.h"
- #include "gl_wext.h"
- #include <linux/can/netlink.h>
- #include <net/netlink.h>
- #include <net/cfg80211.h>
- #include "gl_cfg80211.h"
- #include "gl_vendor.h"
- /*******************************************************************************
- * C O N S T A N T S
- ********************************************************************************
- */
- #define RX_RESPONSE_TIMEOUT (1000)
- /*******************************************************************************
- * D A T A T Y P E S
- ********************************************************************************
- */
- /*******************************************************************************
- * P U B L I C D A T A
- ********************************************************************************
- */
- /*******************************************************************************
- * P R I V A T E D A T A
- ********************************************************************************
- */
- #if CFG_MGMT_FRAME_HANDLING
- static PROCESS_RX_MGT_FUNCTION apfnProcessRxMgtFrame[MAX_NUM_OF_FC_SUBTYPES] = {
- #if CFG_SUPPORT_AAA
- aaaFsmRunEventRxAssoc, /* subtype 0000: Association request */
- #else
- NULL, /* subtype 0000: Association request */
- #endif /* CFG_SUPPORT_AAA */
- saaFsmRunEventRxAssoc, /* subtype 0001: Association response */
- #if CFG_SUPPORT_AAA
- aaaFsmRunEventRxAssoc, /* subtype 0010: Reassociation request */
- #else
- NULL, /* subtype 0010: Reassociation request */
- #endif /* CFG_SUPPORT_AAA */
- saaFsmRunEventRxAssoc, /* subtype 0011: Reassociation response */
- #if (CFG_SUPPORT_ADHOC) || (CFG_SUPPORT_AAA)
- bssProcessProbeRequest, /* subtype 0100: Probe request */
- #else
- NULL, /* subtype 0100: Probe request */
- #endif /* CFG_SUPPORT_ADHOC */
- scanProcessBeaconAndProbeResp, /* subtype 0101: Probe response */
- NULL, /* subtype 0110: reserved */
- NULL, /* subtype 0111: reserved */
- scanProcessBeaconAndProbeResp, /* subtype 1000: Beacon */
- NULL, /* subtype 1001: ATIM */
- saaFsmRunEventRxDisassoc, /* subtype 1010: Disassociation */
- authCheckRxAuthFrameTransSeq, /* subtype 1011: Authentication */
- saaFsmRunEventRxDeauth, /* subtype 1100: Deauthentication */
- nicRxProcessActionFrame, /* subtype 1101: Action */
- NULL, /* subtype 1110: reserved */
- NULL /* subtype 1111: reserved */
- };
- #endif
- /*******************************************************************************
- * M A C R O S
- ********************************************************************************
- */
- /*******************************************************************************
- * F U N C T I O N D E C L A R A T I O N S
- ********************************************************************************
- */
- /*******************************************************************************
- * F U N C T I O N S
- ********************************************************************************
- */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Initialize the RFBs
- *
- * @param prAdapter Pointer to the Adapter structure.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxInitialize(IN P_ADAPTER_T prAdapter)
- {
- P_RX_CTRL_T prRxCtrl;
- PUINT_8 pucMemHandle;
- P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
- UINT_32 i;
- DEBUGFUNC("nicRxInitialize");
- ASSERT(prAdapter);
- prRxCtrl = &prAdapter->rRxCtrl;
- /* 4 <0> Clear allocated memory. */
- kalMemZero((PVOID) prRxCtrl->pucRxCached, prRxCtrl->u4RxCachedSize);
- /* 4 <1> Initialize the RFB lists */
- QUEUE_INITIALIZE(&prRxCtrl->rFreeSwRfbList);
- QUEUE_INITIALIZE(&prRxCtrl->rReceivedRfbList);
- QUEUE_INITIALIZE(&prRxCtrl->rIndicatedRfbList);
- pucMemHandle = prRxCtrl->pucRxCached;
- for (i = CFG_RX_MAX_PKT_NUM; i != 0; i--) {
- prSwRfb = (P_SW_RFB_T) pucMemHandle;
- nicRxSetupRFB(prAdapter, prSwRfb);
- nicRxReturnRFB(prAdapter, prSwRfb);
- pucMemHandle += ALIGN_4(sizeof(SW_RFB_T));
- }
- ASSERT(prRxCtrl->rFreeSwRfbList.u4NumElem == CFG_RX_MAX_PKT_NUM);
- /* Check if the memory allocation consist with this initialization function */
- ASSERT((ULONG) (pucMemHandle - prRxCtrl->pucRxCached) == prRxCtrl->u4RxCachedSize);
- /* 4 <2> Clear all RX counters */
- RX_RESET_ALL_CNTS(prRxCtrl);
- #if CFG_SDIO_RX_AGG
- prRxCtrl->pucRxCoalescingBufPtr = prAdapter->pucCoalescingBufCached;
- HAL_CFG_MAX_HIF_RX_LEN_NUM(prAdapter, CFG_SDIO_MAX_RX_AGG_NUM);
- #else
- HAL_CFG_MAX_HIF_RX_LEN_NUM(prAdapter, 1);
- #endif
- #if CFG_HIF_STATISTICS
- prRxCtrl->u4TotalRxAccessNum = 0;
- prRxCtrl->u4TotalRxPacketNum = 0;
- #endif
- #if CFG_HIF_RX_STARVATION_WARNING
- prRxCtrl->u4QueuedCnt = 0;
- prRxCtrl->u4DequeuedCnt = 0;
- #endif
- } /* end of nicRxInitialize() */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Uninitialize the RFBs
- *
- * @param prAdapter Pointer to the Adapter structure.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxUninitialize(IN P_ADAPTER_T prAdapter)
- {
- P_RX_CTRL_T prRxCtrl;
- P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
- KAL_SPIN_LOCK_DECLARATION();
- ASSERT(prAdapter);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- nicRxFlush(prAdapter);
- do {
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- QUEUE_REMOVE_HEAD(&prRxCtrl->rReceivedRfbList, prSwRfb, P_SW_RFB_T);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- if (prSwRfb) {
- if (prSwRfb->pvPacket)
- kalPacketFree(prAdapter->prGlueInfo, prSwRfb->pvPacket);
- prSwRfb->pvPacket = NULL;
- } else {
- break;
- }
- } while (TRUE);
- do {
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- if (prSwRfb) {
- if (prSwRfb->pvPacket)
- kalPacketFree(prAdapter->prGlueInfo, prSwRfb->pvPacket);
- prSwRfb->pvPacket = NULL;
- } else {
- break;
- }
- } while (TRUE);
- } /* end of nicRxUninitialize() */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Fill RFB
- *
- * @param prAdapter pointer to the Adapter handler
- * @param prSWRfb specify the RFB to receive rx data
- *
- * @return (none)
- *
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxFillRFB(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
- {
- P_HIF_RX_HEADER_T prHifRxHdr;
- UINT_32 u4PktLen = 0;
- UINT_32 u4MacHeaderLen;
- UINT_32 u4HeaderOffset;
- DEBUGFUNC("nicRxFillRFB");
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- prHifRxHdr = prSwRfb->prHifRxHdr;
- ASSERT(prHifRxHdr);
- u4PktLen = prHifRxHdr->u2PacketLen;
- u4HeaderOffset = (UINT_32) (prHifRxHdr->ucHerderLenOffset & HIF_RX_HDR_HEADER_OFFSET_MASK);
- u4MacHeaderLen = (UINT_32) (prHifRxHdr->ucHerderLenOffset & HIF_RX_HDR_HEADER_LEN)
- >> HIF_RX_HDR_HEADER_LEN_OFFSET;
- /* DBGLOG(RX, TRACE, ("u4HeaderOffset = %d, u4MacHeaderLen = %d\n", */
- /* u4HeaderOffset, u4MacHeaderLen)); */
- prSwRfb->u2HeaderLen = (UINT_16) u4MacHeaderLen;
- prSwRfb->pvHeader = (PUINT_8) prHifRxHdr + HIF_RX_HDR_SIZE + u4HeaderOffset;
- prSwRfb->u2PacketLen = (UINT_16) (u4PktLen - (HIF_RX_HDR_SIZE + u4HeaderOffset));
- /* DBGLOG(RX, TRACE, ("Dump Rx packet, u2PacketLen = %d\n", prSwRfb->u2PacketLen)); */
- /* DBGLOG_MEM8(RX, TRACE, prSwRfb->pvHeader, prSwRfb->u2PacketLen); */
- #if 0
- if (prHifRxHdr->ucReorder & HIF_RX_HDR_80211_HEADER_FORMAT) {
- prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_802_11_FORMAT;
- DBGLOG(RX, TRACE, "HIF_RX_HDR_FLAG_802_11_FORMAT\n");
- }
- if (prHifRxHdr->ucReorder & HIF_RX_HDR_DO_REORDER) {
- prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_DO_REORDERING;
- DBGLOG(RX, TRACE, "HIF_RX_HDR_FLAG_DO_REORDERING\n");
- /* Get Seq. No and TID, Wlan Index info */
- if (prHifRxHdr->u2SeqNoTid & HIF_RX_HDR_BAR_FRAME) {
- prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_BAR_FRAME;
- DBGLOG(RX, TRACE, "HIF_RX_HDR_FLAG_BAR_FRAME\n");
- }
- prSwRfb->u2SSN = prHifRxHdr->u2SeqNoTid & HIF_RX_HDR_SEQ_NO_MASK;
- prSwRfb->ucTid = (UINT_8) ((prHifRxHdr->u2SeqNoTid & HIF_RX_HDR_TID_MASK)
- >> HIF_RX_HDR_TID_OFFSET);
- DBGLOG(RX, TRACE, "u2SSN = %d, ucTid = %d\n", prSwRfb->u2SSN, prSwRfb->ucTid);
- }
- if (prHifRxHdr->ucReorder & HIF_RX_HDR_WDS) {
- prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_AMP_WDS;
- DBGLOG(RX, TRACE, "HIF_RX_HDR_FLAG_AMP_WDS\n");
- }
- #endif
- }
- #if CFG_TCP_IP_CHKSUM_OFFLOAD || CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Fill checksum status in RFB
- *
- * @param prAdapter pointer to the Adapter handler
- * @param prSWRfb the RFB to receive rx data
- * @param u4TcpUdpIpCksStatus specify the Checksum status
- *
- * @return (none)
- *
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxFillChksumStatus(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb, IN UINT_32 u4TcpUdpIpCksStatus)
- {
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- if (prAdapter->u4CSUMFlags != CSUM_NOT_SUPPORTED) {
- if (u4TcpUdpIpCksStatus & RX_CS_TYPE_IPv4) { /* IPv4 packet */
- prSwRfb->aeCSUM[CSUM_TYPE_IPV6] = CSUM_RES_NONE;
- if (u4TcpUdpIpCksStatus & RX_CS_STATUS_IP) { /* IP packet csum failed */
- prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_FAILED;
- } else {
- prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_SUCCESS;
- }
- if (u4TcpUdpIpCksStatus & RX_CS_TYPE_TCP) { /* TCP packet */
- prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE;
- if (u4TcpUdpIpCksStatus & RX_CS_STATUS_TCP) { /* TCP packet csum failed */
- prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_FAILED;
- } else {
- prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_SUCCESS;
- }
- } else if (u4TcpUdpIpCksStatus & RX_CS_TYPE_UDP) { /* UDP packet */
- prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE;
- if (u4TcpUdpIpCksStatus & RX_CS_STATUS_UDP) { /* UDP packet csum failed */
- prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_FAILED;
- } else {
- prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_SUCCESS;
- }
- } else {
- prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE;
- prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE;
- }
- } else if (u4TcpUdpIpCksStatus & RX_CS_TYPE_IPv6) { /* IPv6 packet */
- prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_NONE;
- prSwRfb->aeCSUM[CSUM_TYPE_IPV6] = CSUM_RES_SUCCESS;
- if (u4TcpUdpIpCksStatus & RX_CS_TYPE_TCP) { /* TCP packet */
- prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE;
- if (u4TcpUdpIpCksStatus & RX_CS_STATUS_TCP) { /* TCP packet csum failed */
- prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_FAILED;
- } else {
- prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_SUCCESS;
- }
- } else if (u4TcpUdpIpCksStatus & RX_CS_TYPE_UDP) { /* UDP packet */
- prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE;
- if (u4TcpUdpIpCksStatus & RX_CS_STATUS_UDP) { /* UDP packet csum failed */
- prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_FAILED;
- } else {
- prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_SUCCESS;
- }
- } else {
- prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE;
- prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE;
- }
- } else {
- prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_NONE;
- prSwRfb->aeCSUM[CSUM_TYPE_IPV6] = CSUM_RES_NONE;
- }
- }
- }
- #endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Process packet doesn't need to do buffer reordering
- *
- * @param prAdapter pointer to the Adapter handler
- * @param prSWRfb the RFB to receive rx data
- *
- * @return (none)
- *
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxProcessPktWithoutReorder(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
- {
- P_RX_CTRL_T prRxCtrl;
- P_TX_CTRL_T prTxCtrl;
- BOOLEAN fgIsRetained = FALSE;
- UINT_32 u4CurrentRxBufferCount;
- P_STA_RECORD_T prStaRec = (P_STA_RECORD_T) NULL;
- DEBUGFUNC("nicRxProcessPktWithoutReorder");
- /* DBGLOG(RX, TRACE, ("\n")); */
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- prTxCtrl = &prAdapter->rTxCtrl;
- ASSERT(prTxCtrl);
- u4CurrentRxBufferCount = prRxCtrl->rFreeSwRfbList.u4NumElem;
- /* QM USED = $A, AVAILABLE COUNT = $B, INDICATED TO OS = $C
- * TOTAL = $A + $B + $C
- *
- * Case #1 (Retain)
- * -------------------------------------------------------
- * $A + $B < THRESHOLD := $A + $B + $C < THRESHOLD + $C := $TOTAL - THRESHOLD < $C
- * => $C used too much, retain
- *
- * Case #2 (Non-Retain)
- * -------------------------------------------------------
- * $A + $B > THRESHOLD := $A + $B + $C > THRESHOLD + $C := $TOTAL - THRESHOLD > $C
- * => still available for $C to use
- *
- */
- fgIsRetained = (((u4CurrentRxBufferCount +
- qmGetRxReorderQueuedBufferCount(prAdapter) +
- prTxCtrl->i4PendingFwdFrameCount) < CFG_RX_RETAINED_PKT_THRESHOLD) ? TRUE : FALSE);
- /* DBGLOG(RX, INFO, ("fgIsRetained = %d\n", fgIsRetained)); */
- if (kalProcessRxPacket(prAdapter->prGlueInfo,
- prSwRfb->pvPacket,
- prSwRfb->pvHeader,
- (UINT_32) prSwRfb->u2PacketLen, fgIsRetained, prSwRfb->aeCSUM) != WLAN_STATUS_SUCCESS) {
- DBGLOG(RX, ERROR, "kalProcessRxPacket return value != WLAN_STATUS_SUCCESS\n");
- ASSERT(0);
- nicRxReturnRFB(prAdapter, prSwRfb);
- return;
- }
- prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx);
- if (prStaRec) {
- #if CFG_ENABLE_WIFI_DIRECT
- if (prStaRec->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX && prAdapter->fgIsP2PRegistered == TRUE)
- GLUE_SET_PKT_FLAG_P2P(prSwRfb->pvPacket);
- #endif
- #if CFG_ENABLE_BT_OVER_WIFI
- if (prStaRec->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX)
- GLUE_SET_PKT_FLAG_PAL(prSwRfb->pvPacket);
- #endif
- /* record the count to pass to os */
- STATS_RX_PASS2OS_INC(prStaRec, prSwRfb);
- }
- prRxCtrl->apvIndPacket[prRxCtrl->ucNumIndPacket] = prSwRfb->pvPacket;
- prRxCtrl->ucNumIndPacket++;
- if (fgIsRetained) {
- prRxCtrl->apvRetainedPacket[prRxCtrl->ucNumRetainedPacket] = prSwRfb->pvPacket;
- prRxCtrl->ucNumRetainedPacket++;
- /* TODO : error handling of nicRxSetupRFB */
- nicRxSetupRFB(prAdapter, prSwRfb);
- nicRxReturnRFB(prAdapter, prSwRfb);
- } else {
- prSwRfb->pvPacket = NULL;
- nicRxReturnRFB(prAdapter, prSwRfb);
- }
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Process forwarding data packet
- *
- * @param prAdapter pointer to the Adapter handler
- * @param prSWRfb the RFB to receive rx data
- *
- * @return (none)
- *
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxProcessForwardPkt(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
- {
- P_MSDU_INFO_T prMsduInfo, prRetMsduInfoList;
- P_TX_CTRL_T prTxCtrl;
- P_RX_CTRL_T prRxCtrl;
- KAL_SPIN_LOCK_DECLARATION();
- DEBUGFUNC("nicRxProcessForwardPkt");
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- prTxCtrl = &prAdapter->rTxCtrl;
- prRxCtrl = &prAdapter->rRxCtrl;
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST);
- QUEUE_REMOVE_HEAD(&prTxCtrl->rFreeMsduInfoList, prMsduInfo, P_MSDU_INFO_T);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST);
- if (prMsduInfo && kalProcessRxPacket(prAdapter->prGlueInfo,
- prSwRfb->pvPacket,
- prSwRfb->pvHeader,
- (UINT_32) prSwRfb->u2PacketLen,
- prRxCtrl->rFreeSwRfbList.u4NumElem <
- CFG_RX_RETAINED_PKT_THRESHOLD ? TRUE : FALSE,
- prSwRfb->aeCSUM) == WLAN_STATUS_SUCCESS) {
- prMsduInfo->eSrc = TX_PACKET_FORWARDING;
- /* pack into MSDU_INFO_T */
- nicTxFillMsduInfo(prAdapter, prMsduInfo, (P_NATIVE_PACKET) (prSwRfb->pvPacket));
- /* Overwrite the ucNetworkType */
- prMsduInfo->ucNetworkType = HIF_RX_HDR_GET_NETWORK_IDX(prSwRfb->prHifRxHdr);
- /* release RX buffer (to rIndicatedRfbList) */
- prSwRfb->pvPacket = NULL;
- nicRxReturnRFB(prAdapter, prSwRfb);
- /* increase forward frame counter */
- GLUE_INC_REF_CNT(prTxCtrl->i4PendingFwdFrameCount);
- /* send into TX queue */
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE);
- prRetMsduInfoList = qmEnqueueTxPackets(prAdapter, prMsduInfo);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE);
- if (prRetMsduInfoList != NULL) { /* TX queue refuses queuing the packet */
- nicTxFreeMsduInfoPacket(prAdapter, prRetMsduInfoList);
- nicTxReturnMsduInfo(prAdapter, prRetMsduInfoList);
- }
- /* indicate service thread for sending */
- if (prTxCtrl->i4PendingFwdFrameCount > 0)
- kalSetEvent(prAdapter->prGlueInfo);
- } else /* no TX resource */
- nicRxReturnRFB(prAdapter, prSwRfb);
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Process broadcast data packet for both host and forwarding
- *
- * @param prAdapter pointer to the Adapter handler
- * @param prSWRfb the RFB to receive rx data
- *
- * @return (none)
- *
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxProcessGOBroadcastPkt(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
- {
- P_SW_RFB_T prSwRfbDuplicated;
- P_TX_CTRL_T prTxCtrl;
- P_RX_CTRL_T prRxCtrl;
- P_HIF_RX_HEADER_T prHifRxHdr;
- KAL_SPIN_LOCK_DECLARATION();
- DEBUGFUNC("nicRxProcessGOBroadcastPkt");
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- prTxCtrl = &prAdapter->rTxCtrl;
- prRxCtrl = &prAdapter->rRxCtrl;
- prHifRxHdr = prSwRfb->prHifRxHdr;
- ASSERT(prHifRxHdr);
- ASSERT(CFG_NUM_OF_QM_RX_PKT_NUM >= 16);
- if (prRxCtrl->rFreeSwRfbList.u4NumElem
- >= (CFG_RX_MAX_PKT_NUM - (CFG_NUM_OF_QM_RX_PKT_NUM - 16 /* Reserved for others */))) {
- /* 1. Duplicate SW_RFB_T */
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfbDuplicated, P_SW_RFB_T);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- if (prSwRfbDuplicated) {
- kalMemCopy(prSwRfbDuplicated->pucRecvBuff,
- prSwRfb->pucRecvBuff, ALIGN_4(prHifRxHdr->u2PacketLen + HIF_RX_HW_APPENDED_LEN));
- prSwRfbDuplicated->ucPacketType = HIF_RX_PKT_TYPE_DATA;
- prSwRfbDuplicated->ucStaRecIdx = (UINT_8) (prHifRxHdr->ucStaRecIdx);
- nicRxFillRFB(prAdapter, prSwRfbDuplicated);
- /* 2. Modify eDst */
- prSwRfbDuplicated->eDst = RX_PKT_DESTINATION_FORWARD;
- /* 4. Forward */
- nicRxProcessForwardPkt(prAdapter, prSwRfbDuplicated);
- }
- } else {
- DBGLOG(RX, WARN, "Stop to forward BMC packet due to less free Sw Rfb %u\n",
- prRxCtrl->rFreeSwRfbList.u4NumElem);
- }
- /* 3. Indicate to host */
- prSwRfb->eDst = RX_PKT_DESTINATION_HOST;
- nicRxProcessPktWithoutReorder(prAdapter, prSwRfb);
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Process HIF data packet
- *
- * @param prAdapter pointer to the Adapter handler
- * @param prSWRfb the RFB to receive rx data
- *
- * @return (none)
- *
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxProcessDataPacket(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
- {
- P_RX_CTRL_T prRxCtrl;
- P_SW_RFB_T prRetSwRfb, prNextSwRfb;
- P_HIF_RX_HEADER_T prHifRxHdr;
- P_STA_RECORD_T prStaRec;
- BOOLEAN fIsDummy = FALSE;
- DEBUGFUNC("nicRxProcessDataPacket");
- /* DBGLOG(RX, TRACE, ("\n")); */
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- prHifRxHdr = prSwRfb->prHifRxHdr;
- prRxCtrl = &prAdapter->rRxCtrl;
- fIsDummy = (prHifRxHdr->u2PacketLen >= 12) ? FALSE : TRUE;
- nicRxFillRFB(prAdapter, prSwRfb);
- #if CFG_TCP_IP_CHKSUM_OFFLOAD || CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60
- {
- UINT_32 u4TcpUdpIpCksStatus;
- u4TcpUdpIpCksStatus = *((PUINT_32) ((ULONG) prHifRxHdr + (UINT_32) (ALIGN_4(prHifRxHdr->u2PacketLen))));
- nicRxFillChksumStatus(prAdapter, prSwRfb, u4TcpUdpIpCksStatus);
- }
- #endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */
- prStaRec = cnmGetStaRecByIndex(prAdapter, prHifRxHdr->ucStaRecIdx);
- if (secCheckClassError(prAdapter, prSwRfb, prStaRec) == TRUE && prAdapter->fgTestMode == FALSE) {
- #if CFG_HIF_RX_STARVATION_WARNING
- prRxCtrl->u4QueuedCnt++;
- #endif
- prRetSwRfb = qmHandleRxPackets(prAdapter, prSwRfb);
- if (prRetSwRfb != NULL) {
- do {
- /* save next first */
- prNextSwRfb = (P_SW_RFB_T) QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T) prRetSwRfb);
- if (fIsDummy == TRUE) {
- nicRxReturnRFB(prAdapter, prRetSwRfb);
- RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT);
- DBGLOG(RX, WARN, "Drop Dummy Packets");
- } else {
- switch (prRetSwRfb->eDst) {
- case RX_PKT_DESTINATION_HOST:
- #if ARP_MONITER_ENABLE
- if (IS_STA_IN_AIS(prStaRec))
- qmHandleRxArpPackets(prAdapter, prRetSwRfb);
- #endif
- nicRxProcessPktWithoutReorder(prAdapter, prRetSwRfb);
- break;
- case RX_PKT_DESTINATION_FORWARD:
- nicRxProcessForwardPkt(prAdapter, prRetSwRfb);
- break;
- case RX_PKT_DESTINATION_HOST_WITH_FORWARD:
- nicRxProcessGOBroadcastPkt(prAdapter, prRetSwRfb);
- break;
- case RX_PKT_DESTINATION_NULL:
- nicRxReturnRFB(prAdapter, prRetSwRfb);
- RX_INC_CNT(prRxCtrl, RX_DST_NULL_DROP_COUNT);
- RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT);
- break;
- default:
- break;
- }
- }
- #if CFG_HIF_RX_STARVATION_WARNING
- prRxCtrl->u4DequeuedCnt++;
- #endif
- prRetSwRfb = prNextSwRfb;
- } while (prRetSwRfb);
- }
- } else {
- nicRxReturnRFB(prAdapter, prSwRfb);
- RX_INC_CNT(prRxCtrl, RX_CLASS_ERR_DROP_COUNT);
- RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT);
- }
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Process HIF event packet
- *
- * @param prAdapter pointer to the Adapter handler
- * @param prSWRfb the RFB to receive rx data
- *
- * @return (none)
- *
- */
- /*----------------------------------------------------------------------------*/
- UINT_8 nicRxProcessGSCNEvent(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
- {
- P_WIFI_EVENT_T prEvent;
- P_GLUE_INFO_T prGlueInfo;
- struct sk_buff *skb;
- struct wiphy *wiphy;
- UINT_32 real_num = 0;
- P_EVENT_GSCAN_SCAN_AVAILABLE_T prEventGscnAvailable;
- P_EVENT_GSCAN_RESULT_T prEventBuffer;
- P_WIFI_GSCAN_RESULT_T prEventGscnResult;
- INT_32 i4Status = -EINVAL;
- struct nlattr *attr;
- UINT_32 scan_id;
- UINT_8 scan_flag;
- P_EVENT_GSCAN_CAPABILITY_T prEventGscnCapbiblity;
- P_EVENT_GSCAN_SCAN_COMPLETE_T prEventGscnScnDone;
- P_WIFI_GSCAN_RESULT_T prEventGscnFullResult;
- P_PARAM_WIFI_GSCAN_RESULT prParamGscnFullResult;
- P_EVENT_GSCAN_SIGNIFICANT_CHANGE_T prEventGscnSignificantChange;
- P_EVENT_GSCAN_SIGNIFICANT_CHANGE_T prEventGscnGeofenceFound;
- P_PARAM_WIFI_GSCAN_RESULT prResults;
- DEBUGFUNC("nicRxProcessGSCNEvent");
- /* DBGLOG(RX, TRACE, ("\n")); */
- DBGLOG(SCN, INFO, "nicRxProcessGSCNEvent\n");
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- prEvent = (P_WIFI_EVENT_T) prSwRfb->pucRecvBuff;
- prGlueInfo = prAdapter->prGlueInfo;
- /* Push the data to the skb */
- wiphy = priv_to_wiphy(prGlueInfo);
- /* prGlueInfo-> */
- /* Event Handling */
- switch (prEvent->ucEID) {
- case EVENT_ID_GSCAN_SCAN_AVAILABLE:
- {
- DBGLOG(SCN, INFO, "EVENT_ID_GSCAN_SCAN_AVAILABLE\n");
- prEventGscnAvailable = (P_EVENT_GSCAN_SCAN_AVAILABLE_T) (prEvent->aucBuffer);
- memcpy(prEventGscnAvailable, (P_EVENT_GSCAN_SCAN_AVAILABLE_T) (prEvent->aucBuffer),
- sizeof(EVENT_GSCAN_SCAN_AVAILABLE_T));
- mtk_cfg80211_vendor_event_scan_results_available(wiphy, prGlueInfo->prDevHandler->ieee80211_ptr,
- prEventGscnAvailable->u2Num);
- }
- break;
- case EVENT_ID_GSCAN_RESULT:
- {
- DBGLOG(SCN, INFO, "EVENT_ID_GSCAN_RESULT 2\n");
- prEventBuffer = (P_EVENT_GSCAN_RESULT_T) (prEvent->aucBuffer);
- prEventGscnResult = prEventBuffer->rResult;
- /*
- the following event struct should moved to kal and use the kal api to avoid future porting effort
- */
- scan_id = prEventBuffer->u2ScanId;
- scan_flag = prEventBuffer->u2ScanFlags;
- real_num = prEventBuffer->u2NumOfResults;
- DBGLOG(SCN, INFO, "scan_id=%d, scan_flag =%d, real_num=%d\r\n", scan_id, scan_flag, real_num);
- skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(PARAM_WIFI_GSCAN_RESULT) * real_num);
- if (!skb) {
- DBGLOG(RX, TRACE, "%s allocate skb failed:%x\n", __func__, i4Status);
- return -ENOMEM;
- }
- attr = nla_nest_start(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS);
- /*NLA_PUT_U32(skb, GSCAN_ATTRIBUTE_SCAN_ID, scan_id);*/
- {
- unsigned int __tmp = scan_id;
- if (unlikely(nla_put(skb, GSCAN_ATTRIBUTE_SCAN_ID, sizeof(unsigned int), &__tmp) < 0))
- goto nla_put_failure;
- }
- /*NLA_PUT_U8(skb, GSCAN_ATTRIBUTE_SCAN_FLAGS, 1);*/
- {
- unsigned char __tmp = 1;
- if (unlikely(nla_put(skb, GSCAN_ATTRIBUTE_SCAN_FLAGS, sizeof(u8), &__tmp) < 0))
- goto nla_put_failure;
- }
- /*NLA_PUT_U32(skb, GSCAN_ATTRIBUTE_NUM_OF_RESULTS, real_num);*/
- {
- unsigned int __tmp = real_num;
- if (unlikely(nla_put(skb, GSCAN_ATTRIBUTE_NUM_OF_RESULTS,
- sizeof(unsigned int), &__tmp) < 0))
- goto nla_put_failure;
- }
- prResults = (P_PARAM_WIFI_GSCAN_RESULT) prEventGscnResult;
- if (prResults)
- DBGLOG(SCN, INFO, "ssid=%s, rssi=%d, channel=%d \r\n",
- prResults->ssid, prResults->rssi, prResults->channel);
- /*NLA_PUT(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS, sizeof(PARAM_WIFI_GSCAN_RESULT) * real_num,
- prResults);*/
- if (unlikely(nla_put(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS,
- sizeof(PARAM_WIFI_GSCAN_RESULT)*real_num, prResults) < 0))
- goto nla_put_failure;
- DBGLOG(SCN, INFO, "NLA_PUT scan results over\t");
- if (attr)
- nla_nest_end(skb, attr);
- /* report_events=1 */
- /*NLA_PUT_U8(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE, 1);*/
- {
- unsigned char __tmp = 1;
- if (unlikely(nla_put(skb, GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE,
- sizeof(unsigned int), &__tmp) < 0))
- goto nla_put_failure;
- }
- i4Status = cfg80211_vendor_cmd_reply(skb);
- skb = NULL;
- DBGLOG(SCN, INFO, " i4Status %d\n", i4Status);
- }
- break;
- case EVENT_ID_GSCAN_CAPABILITY:
- {
- DBGLOG(SCN, INFO, "EVENT_ID_GSCAN_CAPABILITY\n");
- prEventGscnCapbiblity = (P_EVENT_GSCAN_CAPABILITY_T) (prEvent->aucBuffer);
- memcpy(prEventGscnCapbiblity, (P_EVENT_GSCAN_CAPABILITY_T) (prEvent->aucBuffer),
- sizeof(EVENT_GSCAN_CAPABILITY_T));
- mtk_cfg80211_vendor_get_gscan_capabilities(wiphy, prGlueInfo->prDevHandler->ieee80211_ptr,
- prEventGscnCapbiblity, sizeof(EVENT_GSCAN_CAPABILITY_T));
- }
- break;
- case EVENT_ID_GSCAN_SCAN_COMPLETE:
- {
- DBGLOG(SCN, INFO, "EVENT_ID_GSCAN_SCAN_COMPLETE\n");
- prEventGscnScnDone = (P_EVENT_GSCAN_SCAN_COMPLETE_T) (prEvent->aucBuffer);
- memcpy(prEventGscnScnDone, (P_EVENT_GSCAN_SCAN_COMPLETE_T) (prEvent->aucBuffer),
- sizeof(EVENT_GSCAN_SCAN_COMPLETE_T));
- mtk_cfg80211_vendor_event_complete_scan(wiphy, prGlueInfo->prDevHandler->ieee80211_ptr,
- prEventGscnScnDone->ucScanState);
- }
- break;
- case EVENT_ID_GSCAN_FULL_RESULT:
- {
- DBGLOG(SCN, INFO, "EVENT_ID_GSCAN_FULL_RESULT\n");
- prEventGscnFullResult = kalMemAlloc(sizeof(WIFI_GSCAN_RESULT_T), VIR_MEM_TYPE);
- if (prEventGscnFullResult)
- memcpy(prEventGscnFullResult, (P_WIFI_GSCAN_RESULT_T) (prEvent->aucBuffer),
- sizeof(WIFI_GSCAN_RESULT_T));
- prParamGscnFullResult = kalMemAlloc(sizeof(PARAM_WIFI_GSCAN_RESULT), VIR_MEM_TYPE);
- if (prEventGscnFullResult && prParamGscnFullResult) {
- kalMemZero(prParamGscnFullResult, sizeof(PARAM_WIFI_GSCAN_RESULT));
- memcpy(prParamGscnFullResult, prEventGscnFullResult, sizeof(WIFI_GSCAN_RESULT_T));
- mtk_cfg80211_vendor_event_full_scan_results(wiphy,
- prGlueInfo->prDevHandler->ieee80211_ptr,
- prParamGscnFullResult,
- sizeof(PARAM_WIFI_GSCAN_RESULT));
- }
- }
- break;
- case EVENT_ID_GSCAN_SIGNIFICANT_CHANGE:
- {
- prEventGscnSignificantChange = (P_EVENT_GSCAN_SIGNIFICANT_CHANGE_T) (prEvent->aucBuffer);
- memcpy(prEventGscnSignificantChange, (P_EVENT_GSCAN_SIGNIFICANT_CHANGE_T) (prEvent->aucBuffer),
- sizeof(EVENT_GSCAN_SIGNIFICANT_CHANGE_T));
- }
- break;
- case EVENT_ID_GSCAN_GEOFENCE_FOUND:
- {
- prEventGscnGeofenceFound = (P_EVENT_GSCAN_SIGNIFICANT_CHANGE_T) (prEvent->aucBuffer);
- memcpy(prEventGscnGeofenceFound, (P_EVENT_GSCAN_SIGNIFICANT_CHANGE_T) (prEvent->aucBuffer),
- sizeof(EVENT_GSCAN_SIGNIFICANT_CHANGE_T));
- }
- break;
- default:
- DBGLOG(SCN, INFO, "not GSCN event ????\n");
- break;
- }
- DBGLOG(SCN, INFO, "Done with GSCN event handling\n");
- return real_num; /* cfg80211_vendor_cmd_reply(skb); */
- nla_put_failure:
- if (skb != NULL)
- kfree_skb(skb);
- DBGLOG(SCN, INFO, "nla_put_failure\n");
- return 0; /* cfg80211_vendor_cmd_reply(skb); */
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Process HIF event packet
- *
- * @param prAdapter pointer to the Adapter handler
- * @param prSWRfb the RFB to receive rx data
- *
- * @return (none)
- *
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxProcessEventPacket(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
- {
- P_CMD_INFO_T prCmdInfo;
- P_MSDU_INFO_T prMsduInfo;
- P_WIFI_EVENT_T prEvent;
- P_GLUE_INFO_T prGlueInfo;
- /*BOOLEAN fgKeepprSwRfb = FALSE;*/
- DEBUGFUNC("nicRxProcessEventPacket");
- /* DBGLOG(RX, TRACE, ("\n")); */
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- prEvent = (P_WIFI_EVENT_T) prSwRfb->pucRecvBuff;
- prGlueInfo = prAdapter->prGlueInfo;
- DBGLOG(RX, EVENT, "prEvent->ucEID = 0x%02x\n", prEvent->ucEID);
- /* Event Handling */
- switch (prEvent->ucEID) {
- case EVENT_ID_CMD_RESULT:
- prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
- if (prCmdInfo != NULL) {
- P_EVENT_CMD_RESULT prCmdResult;
- prCmdResult = (P_EVENT_CMD_RESULT) ((PUINT_8) prEvent + EVENT_HDR_SIZE);
- /* CMD_RESULT should be only in response to Set commands */
- ASSERT(prCmdInfo->fgSetQuery == FALSE || prCmdInfo->fgNeedResp == TRUE);
- if (prCmdResult->ucStatus == 0) { /* success */
- if (prCmdInfo->pfCmdDoneHandler) {
- prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prEvent->aucBuffer);
- } else if (prCmdInfo->fgIsOid == TRUE) {
- kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0,
- WLAN_STATUS_SUCCESS);
- }
- } else if (prCmdResult->ucStatus == 1) { /* reject */
- if (prCmdInfo->fgIsOid == TRUE)
- kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0,
- WLAN_STATUS_FAILURE);
- } else if (prCmdResult->ucStatus == 2) { /* unknown CMD */
- if (prCmdInfo->fgIsOid == TRUE)
- kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0,
- WLAN_STATUS_NOT_SUPPORTED);
- }
- /* return prCmdInfo */
- cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
- }
- break;
- #if 0
- case EVENT_ID_CONNECTION_STATUS:
- /* OBSELETE */
- {
- P_EVENT_CONNECTION_STATUS prConnectionStatus;
- prConnectionStatus = (P_EVENT_CONNECTION_STATUS) (prEvent->aucBuffer);
- DbgPrint("RX EVENT: EVENT_ID_CONNECTION_STATUS = %d\n", prConnectionStatus->ucMediaStatus);
- if (prConnectionStatus->ucMediaStatus == PARAM_MEDIA_STATE_DISCONNECTED) {
- /* disconnected */
- if (kalGetMediaStateIndicated(prGlueInfo) != PARAM_MEDIA_STATE_DISCONNECTED) {
- kalIndicateStatusAndComplete(prGlueInfo, WLAN_STATUS_MEDIA_DISCONNECT, NULL, 0);
- prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick();
- }
- } else if (prConnectionStatus->ucMediaStatus == PARAM_MEDIA_STATE_CONNECTED) {
- /* connected */
- prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick();
- /* fill information for association result */
- prAdapter->rWlanInfo.rCurrBssId.rSsid.u4SsidLen = prConnectionStatus->ucSsidLen;
- kalMemCopy(prAdapter->rWlanInfo.rCurrBssId.rSsid.aucSsid,
- prConnectionStatus->aucSsid, prConnectionStatus->ucSsidLen);
- kalMemCopy(prAdapter->rWlanInfo.rCurrBssId.arMacAddress,
- prConnectionStatus->aucBssid, MAC_ADDR_LEN);
- /* @FIXME */
- prAdapter->rWlanInfo.rCurrBssId.u4Privacy = prConnectionStatus->ucEncryptStatus;
- prAdapter->rWlanInfo.rCurrBssId.rRssi = 0; /* @FIXME */
- /* @FIXME */
- prAdapter->rWlanInfo.rCurrBssId.eNetworkTypeInUse = PARAM_NETWORK_TYPE_AUTOMODE;
- prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4BeaconPeriod
- = prConnectionStatus->u2BeaconPeriod;
- prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4ATIMWindow
- = prConnectionStatus->u2ATIMWindow;
- prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4DSConfig
- = prConnectionStatus->u4FreqInKHz;
- prAdapter->rWlanInfo.ucNetworkType = prConnectionStatus->ucNetworkType;
- switch (prConnectionStatus->ucInfraMode) {
- case 0:
- prAdapter->rWlanInfo.rCurrBssId.eOpMode = NET_TYPE_IBSS;
- break;
- case 1:
- prAdapter->rWlanInfo.rCurrBssId.eOpMode = NET_TYPE_INFRA;
- break;
- case 2:
- default:
- prAdapter->rWlanInfo.rCurrBssId.eOpMode = NET_TYPE_AUTO_SWITCH;
- break;
- }
- /* always indicate to OS according to MSDN (re-association/roaming) */
- kalIndicateStatusAndComplete(prGlueInfo, WLAN_STATUS_MEDIA_CONNECT, NULL, 0);
- }
- }
- break;
- case EVENT_ID_SCAN_RESULT:
- /* OBSELETE */
- break;
- #endif
- case EVENT_ID_RX_ADDBA:
- /* The FW indicates that an RX BA agreement will be established */
- qmHandleEventRxAddBa(prAdapter, prEvent);
- break;
- case EVENT_ID_RX_DELBA:
- /* The FW indicates that an RX BA agreement has been deleted */
- qmHandleEventRxDelBa(prAdapter, prEvent);
- break;
- case EVENT_ID_LINK_QUALITY:
- #if CFG_ENABLE_WIFI_DIRECT && CFG_SUPPORT_P2P_RSSI_QUERY
- if (prEvent->u2PacketLen == EVENT_HDR_SIZE + sizeof(EVENT_LINK_QUALITY_EX)) {
- P_EVENT_LINK_QUALITY_EX prLqEx = (P_EVENT_LINK_QUALITY_EX) (prEvent->aucBuffer);
- if (prLqEx->ucIsLQ0Rdy)
- nicUpdateLinkQuality(prAdapter, NETWORK_TYPE_AIS_INDEX, (P_EVENT_LINK_QUALITY) prLqEx);
- if (prLqEx->ucIsLQ1Rdy)
- nicUpdateLinkQuality(prAdapter, NETWORK_TYPE_P2P_INDEX, (P_EVENT_LINK_QUALITY) prLqEx);
- } else {
- /* For old FW, P2P may invoke link quality query, and make driver flag becone TRUE. */
- DBGLOG(P2P, WARN, "Old FW version, not support P2P RSSI query.\n");
- /* Must not use NETWORK_TYPE_P2P_INDEX, cause the structure is mismatch. */
- nicUpdateLinkQuality(prAdapter, NETWORK_TYPE_AIS_INDEX,
- (P_EVENT_LINK_QUALITY) (prEvent->aucBuffer));
- }
- #else
- nicUpdateLinkQuality(prAdapter, NETWORK_TYPE_AIS_INDEX, (P_EVENT_LINK_QUALITY) (prEvent->aucBuffer));
- #endif
- /* command response handling */
- prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
- if (prCmdInfo != NULL) {
- if (prCmdInfo->pfCmdDoneHandler)
- prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prEvent->aucBuffer);
- else if (prCmdInfo->fgIsOid)
- kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_SUCCESS);
- /* return prCmdInfo */
- cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
- }
- #ifndef LINUX
- if (prAdapter->rWlanInfo.eRssiTriggerType == ENUM_RSSI_TRIGGER_GREATER &&
- prAdapter->rWlanInfo.rRssiTriggerValue >= (PARAM_RSSI) (prAdapter->rLinkQuality.cRssi)) {
- prAdapter->rWlanInfo.eRssiTriggerType = ENUM_RSSI_TRIGGER_TRIGGERED;
- kalIndicateStatusAndComplete(prGlueInfo,
- WLAN_STATUS_MEDIA_SPECIFIC_INDICATION,
- (PVOID)&(prAdapter->rWlanInfo.rRssiTriggerValue),
- sizeof(PARAM_RSSI));
- } else if (prAdapter->rWlanInfo.eRssiTriggerType == ENUM_RSSI_TRIGGER_LESS
- && prAdapter->rWlanInfo.rRssiTriggerValue <= (PARAM_RSSI) (prAdapter->rLinkQuality.cRssi)) {
- prAdapter->rWlanInfo.eRssiTriggerType = ENUM_RSSI_TRIGGER_TRIGGERED;
- kalIndicateStatusAndComplete(prGlueInfo,
- WLAN_STATUS_MEDIA_SPECIFIC_INDICATION,
- (PVOID)&(prAdapter->rWlanInfo.rRssiTriggerValue),
- sizeof(PARAM_RSSI));
- }
- #endif
- break;
- case EVENT_ID_MIC_ERR_INFO:
- {
- P_EVENT_MIC_ERR_INFO prMicError;
- /* P_PARAM_AUTH_EVENT_T prAuthEvent; */
- P_STA_RECORD_T prStaRec;
- DBGLOG(RSN, EVENT, "EVENT_ID_MIC_ERR_INFO\n");
- prMicError = (P_EVENT_MIC_ERR_INFO) (prEvent->aucBuffer);
- prStaRec = cnmGetStaRecByAddress(prAdapter,
- (UINT_8) NETWORK_TYPE_AIS_INDEX,
- prAdapter->rWlanInfo.rCurrBssId.arMacAddress);
- ASSERT(prStaRec);
- if (prStaRec)
- rsnTkipHandleMICFailure(prAdapter, prStaRec, (BOOLEAN) prMicError->u4Flags);
- else
- DBGLOG(RSN, WARN, "No STA rec!!\n");
- #if 0
- prAuthEvent = (P_PARAM_AUTH_EVENT_T) prAdapter->aucIndicationEventBuffer;
- /* Status type: Authentication Event */
- prAuthEvent->rStatus.eStatusType = ENUM_STATUS_TYPE_AUTHENTICATION;
- /* Authentication request */
- prAuthEvent->arRequest[0].u4Length = sizeof(PARAM_AUTH_REQUEST_T);
- kalMemCopy((PVOID) prAuthEvent->arRequest[0].arBssid,
- (PVOID) prAdapter->rWlanInfo.rCurrBssId.arMacAddress,
- /* whsu:Todo? */PARAM_MAC_ADDR_LEN);
- if (prMicError->u4Flags != 0)
- prAuthEvent->arRequest[0].u4Flags = PARAM_AUTH_REQUEST_GROUP_ERROR;
- else
- prAuthEvent->arRequest[0].u4Flags = PARAM_AUTH_REQUEST_PAIRWISE_ERROR;
- kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
- WLAN_STATUS_MEDIA_SPECIFIC_INDICATION,
- (PVOID) prAuthEvent,
- sizeof(PARAM_STATUS_INDICATION_T) + sizeof(PARAM_AUTH_REQUEST_T));
- #endif
- }
- break;
- case EVENT_ID_ASSOC_INFO:
- {
- P_EVENT_ASSOC_INFO prAssocInfo;
- prAssocInfo = (P_EVENT_ASSOC_INFO) (prEvent->aucBuffer);
- kalHandleAssocInfo(prAdapter->prGlueInfo, prAssocInfo);
- }
- break;
- case EVENT_ID_802_11_PMKID:
- {
- P_PARAM_AUTH_EVENT_T prAuthEvent;
- PUINT_8 cp;
- UINT_32 u4LenOfUsedBuffer;
- prAuthEvent = (P_PARAM_AUTH_EVENT_T) prAdapter->aucIndicationEventBuffer;
- prAuthEvent->rStatus.eStatusType = ENUM_STATUS_TYPE_CANDIDATE_LIST;
- u4LenOfUsedBuffer = (UINT_32) (prEvent->u2PacketLen - 8);
- prAuthEvent->arRequest[0].u4Length = u4LenOfUsedBuffer;
- cp = (PUINT_8) &prAuthEvent->arRequest[0];
- /* Status type: PMKID Candidatelist Event */
- kalMemCopy(cp, (P_EVENT_PMKID_CANDIDATE_LIST_T) (prEvent->aucBuffer), prEvent->u2PacketLen - 8);
- kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
- WLAN_STATUS_MEDIA_SPECIFIC_INDICATION,
- (PVOID) prAuthEvent,
- sizeof(PARAM_STATUS_INDICATION_T) + u4LenOfUsedBuffer);
- }
- break;
- #if 0
- case EVENT_ID_ACTIVATE_STA_REC_T:
- {
- P_EVENT_ACTIVATE_STA_REC_T prActivateStaRec;
- prActivateStaRec = (P_EVENT_ACTIVATE_STA_REC_T) (prEvent->aucBuffer);
- DbgPrint("RX EVENT: EVENT_ID_ACTIVATE_STA_REC_T Index:%d, MAC:[%pM]\n",
- prActivateStaRec->ucStaRecIdx, prActivateStaRec->aucMacAddr);
- qmActivateStaRec(prAdapter,
- (UINT_32) prActivateStaRec->ucStaRecIdx,
- ((prActivateStaRec->fgIsQoS) ? TRUE : FALSE),
- prActivateStaRec->ucNetworkTypeIndex,
- ((prActivateStaRec->fgIsAP) ? TRUE : FALSE), prActivateStaRec->aucMacAddr);
- }
- break;
- case EVENT_ID_DEACTIVATE_STA_REC_T:
- {
- P_EVENT_DEACTIVATE_STA_REC_T prDeactivateStaRec;
- prDeactivateStaRec = (P_EVENT_DEACTIVATE_STA_REC_T) (prEvent->aucBuffer);
- DbgPrint("RX EVENT: EVENT_ID_DEACTIVATE_STA_REC_T Index:%d, MAC:[%pM]\n",
- prDeactivateStaRec->ucStaRecIdx, prActivateStaRec->aucMacAddr);
- qmDeactivateStaRec(prAdapter, prDeactivateStaRec->ucStaRecIdx);
- }
- break;
- #endif
- case EVENT_ID_SCAN_DONE:
- scnEventScanDone(prAdapter, (P_EVENT_SCAN_DONE) (prEvent->aucBuffer));
- break;
- case EVENT_ID_TX_DONE_STATUS:
- STATS_TX_PKT_DONE_INFO_DISPLAY(prAdapter, prEvent->aucBuffer);
- break;
- case EVENT_ID_TX_DONE:
- {
- P_EVENT_TX_DONE_T prTxDone;
- prTxDone = (P_EVENT_TX_DONE_T) (prEvent->aucBuffer);
- if (prTxDone->ucStatus)
- DBGLOG(RX, INFO, "EVENT_ID_TX_DONE PacketSeq:%u ucStatus: %u SN: %u\n",
- prTxDone->ucPacketSeq, prTxDone->ucStatus, prTxDone->u2SequenceNumber);
- /* call related TX Done Handler */
- prMsduInfo = nicGetPendingTxMsduInfo(prAdapter, prTxDone->ucPacketSeq);
- #if CFG_SUPPORT_802_11V_TIMING_MEASUREMENT
- DBGLOG(RX, TRACE, "EVENT_ID_TX_DONE u4TimeStamp = %x u2AirDelay = %x\n",
- prTxDone->au4Reserved1, prTxDone->au4Reserved2);
- wnmReportTimingMeas(prAdapter, prMsduInfo->ucStaRecIndex,
- prTxDone->au4Reserved1, prTxDone->au4Reserved1 + prTxDone->au4Reserved2);
- #endif
- if (prMsduInfo) {
- prMsduInfo->pfTxDoneHandler(prAdapter, prMsduInfo,
- (ENUM_TX_RESULT_CODE_T) (prTxDone->ucStatus));
- cnmMgtPktFree(prAdapter, prMsduInfo);
- }
- }
- break;
- case EVENT_ID_SLEEPY_NOTIFY:
- {
- P_EVENT_SLEEPY_NOTIFY prEventSleepyNotify;
- prEventSleepyNotify = (P_EVENT_SLEEPY_NOTIFY) (prEvent->aucBuffer);
- /* DBGLOG(RX, INFO, ("ucSleepyState = %d\n", prEventSleepyNotify->ucSleepyState)); */
- prAdapter->fgWiFiInSleepyState = (BOOLEAN) (prEventSleepyNotify->ucSleepyState);
- }
- break;
- case EVENT_ID_BT_OVER_WIFI:
- #if CFG_ENABLE_BT_OVER_WIFI
- {
- UINT_8 aucTmp[sizeof(AMPC_EVENT) + sizeof(BOW_LINK_DISCONNECTED)];
- P_EVENT_BT_OVER_WIFI prEventBtOverWifi;
- P_AMPC_EVENT prBowEvent;
- P_BOW_LINK_CONNECTED prBowLinkConnected;
- P_BOW_LINK_DISCONNECTED prBowLinkDisconnected;
- prEventBtOverWifi = (P_EVENT_BT_OVER_WIFI) (prEvent->aucBuffer);
- /* construct event header */
- prBowEvent = (P_AMPC_EVENT) aucTmp;
- if (prEventBtOverWifi->ucLinkStatus == 0) {
- /* Connection */
- prBowEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_CONNECTED;
- prBowEvent->rHeader.ucSeqNumber = 0;
- prBowEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_CONNECTED);
- /* fill event body */
- prBowLinkConnected = (P_BOW_LINK_CONNECTED) (prBowEvent->aucPayload);
- prBowLinkConnected->rChannel.ucChannelNum = prEventBtOverWifi->ucSelectedChannel;
- kalMemZero(prBowLinkConnected->aucPeerAddress, MAC_ADDR_LEN); /* @FIXME */
- kalIndicateBOWEvent(prAdapter->prGlueInfo, prBowEvent);
- } else {
- /* Disconnection */
- prBowEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_DISCONNECTED;
- prBowEvent->rHeader.ucSeqNumber = 0;
- prBowEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_DISCONNECTED);
- /* fill event body */
- prBowLinkDisconnected = (P_BOW_LINK_DISCONNECTED) (prBowEvent->aucPayload);
- prBowLinkDisconnected->ucReason = 0; /* @FIXME */
- kalMemZero(prBowLinkDisconnected->aucPeerAddress, MAC_ADDR_LEN); /* @FIXME */
- kalIndicateBOWEvent(prAdapter->prGlueInfo, prBowEvent);
- }
- }
- break;
- #endif
- case EVENT_ID_STATISTICS:
- /* buffer statistics for further query */
- prAdapter->fgIsStatValid = TRUE;
- prAdapter->rStatUpdateTime = kalGetTimeTick();
- kalMemCopy(&prAdapter->rStatStruct, prEvent->aucBuffer, sizeof(EVENT_STATISTICS));
- /* command response handling */
- prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
- if (prCmdInfo != NULL) {
- if (prCmdInfo->pfCmdDoneHandler)
- prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prEvent->aucBuffer);
- else if (prCmdInfo->fgIsOid)
- kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_SUCCESS);
- /* return prCmdInfo */
- cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
- }
- break;
- case EVENT_ID_CH_PRIVILEGE:
- cnmChMngrHandleChEvent(prAdapter, prEvent);
- break;
- case EVENT_ID_BSS_ABSENCE_PRESENCE:
- qmHandleEventBssAbsencePresence(prAdapter, prEvent);
- break;
- case EVENT_ID_STA_CHANGE_PS_MODE:
- qmHandleEventStaChangePsMode(prAdapter, prEvent);
- break;
- #if CFG_ENABLE_WIFI_DIRECT
- case EVENT_ID_STA_UPDATE_FREE_QUOTA:
- qmHandleEventStaUpdateFreeQuota(prAdapter, prEvent);
- break;
- #endif
- case EVENT_ID_BSS_BEACON_TIMEOUT:
- if (prAdapter->fgDisBcnLostDetection == FALSE) {
- P_EVENT_BSS_BEACON_TIMEOUT_T prEventBssBeaconTimeout;
- prEventBssBeaconTimeout = (P_EVENT_BSS_BEACON_TIMEOUT_T) (prEvent->aucBuffer);
- DBGLOG(RX, INFO, "Beacon Timeout Reason = %u\n", prEventBssBeaconTimeout->ucReason);
- if (prEventBssBeaconTimeout->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX) {
- /* Request stats report before beacon timeout */
- P_BSS_INFO_T prBssInfo;
- P_STA_RECORD_T prStaRec;
- prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]);
- if (prBssInfo) {
- prStaRec = cnmGetStaRecByAddress(prAdapter,
- NETWORK_TYPE_AIS_INDEX,
- prBssInfo->aucBSSID);
- if (prStaRec)
- STATS_ENV_REPORT_DETECT(prAdapter, prStaRec->ucIndex);
- }
- aisBssBeaconTimeout(prAdapter);
- }
- #if CFG_ENABLE_WIFI_DIRECT
- else if ((prAdapter->fgIsP2PRegistered) &&
- (prEventBssBeaconTimeout->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX))
- p2pFsmRunEventBeaconTimeout(prAdapter);
- #endif
- else {
- DBGLOG(RX, ERROR, "EVENT_ID_BSS_BEACON_TIMEOUT: (ucNetTypeIdx = %d)\n",
- prEventBssBeaconTimeout->ucNetTypeIndex);
- }
- }
- break;
- case EVENT_ID_UPDATE_NOA_PARAMS:
- #if CFG_ENABLE_WIFI_DIRECT
- if (prAdapter->fgIsP2PRegistered) {
- P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam;
- prEventUpdateNoaParam = (P_EVENT_UPDATE_NOA_PARAMS_T) (prEvent->aucBuffer);
- if (prEventUpdateNoaParam->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX) {
- p2pProcessEvent_UpdateNOAParam(prAdapter,
- prEventUpdateNoaParam->ucNetTypeIndex,
- prEventUpdateNoaParam);
- } else {
- ASSERT(0);
- }
- }
- #else
- ASSERT(0);
- #endif
- break;
- case EVENT_ID_STA_AGING_TIMEOUT:
- #if CFG_ENABLE_WIFI_DIRECT
- {
- if (prAdapter->fgDisStaAgingTimeoutDetection == FALSE) {
- P_EVENT_STA_AGING_TIMEOUT_T prEventStaAgingTimeout;
- P_STA_RECORD_T prStaRec;
- P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T) NULL;
- prEventStaAgingTimeout = (P_EVENT_STA_AGING_TIMEOUT_T) (prEvent->aucBuffer);
- prStaRec = cnmGetStaRecByIndex(prAdapter, prEventStaAgingTimeout->ucStaRecIdx);
- if (prStaRec == NULL)
- break;
- DBGLOG(RX, INFO, "EVENT_ID_STA_AGING_TIMEOUT %u %pM\n",
- prEventStaAgingTimeout->ucStaRecIdx,
- prStaRec->aucMacAddr);
- prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]);
- bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec);
- /* Call False Auth */
- if (prAdapter->fgIsP2PRegistered)
- p2pFuncDisconnect(prAdapter, prStaRec, TRUE, REASON_CODE_DISASSOC_INACTIVITY);
- }
- /* gDisStaAgingTimeoutDetection */
- }
- #endif
- break;
- case EVENT_ID_AP_OBSS_STATUS:
- #if CFG_ENABLE_WIFI_DIRECT
- if (prAdapter->fgIsP2PRegistered)
- rlmHandleObssStatusEventPkt(prAdapter, (P_EVENT_AP_OBSS_STATUS_T) prEvent->aucBuffer);
- #endif
- break;
- case EVENT_ID_ROAMING_STATUS:
- #if CFG_SUPPORT_ROAMING
- {
- P_ROAMING_PARAM_T prParam;
- prParam = (P_ROAMING_PARAM_T) (prEvent->aucBuffer);
- roamingFsmProcessEvent(prAdapter, prParam);
- }
- #endif /* CFG_SUPPORT_ROAMING */
- break;
- case EVENT_ID_SEND_DEAUTH:
- {
- P_WLAN_MAC_HEADER_T prWlanMacHeader;
- P_STA_RECORD_T prStaRec;
- prWlanMacHeader = (P_WLAN_MAC_HEADER_T) &prEvent->aucBuffer[0];
- DBGLOG(RSN, INFO, "nicRx: aucAddr1: %pM, nicRx: aucAddr2: %pM\n",
- prWlanMacHeader->aucAddr1, prWlanMacHeader->aucAddr2);
- prStaRec = cnmGetStaRecByAddress(prAdapter, NETWORK_TYPE_AIS_INDEX, prWlanMacHeader->aucAddr2);
- if (prStaRec != NULL && prStaRec->ucStaState == STA_STATE_3) {
- DBGLOG(RSN, WARN, "Ignore Deauth for Rx Class 3 error!\n");
- } else {
- /* receive packets without StaRec */
- prSwRfb->pvHeader = (P_WLAN_MAC_HEADER_T) &prEvent->aucBuffer[0];
- if (WLAN_STATUS_SUCCESS == authSendDeauthFrame(prAdapter,
- NULL,
- prSwRfb,
- REASON_CODE_CLASS_3_ERR,
- (PFN_TX_DONE_HANDLER) NULL))
- DBGLOG(RSN, INFO, "Send Deauth for Rx Class3 Error\n");
- else
- DBGLOG(RSN, WARN, "failed to send deauth for Rx class3 error\n");
- }
- }
- break;
- #if CFG_SUPPORT_RDD_TEST_MODE
- case EVENT_ID_UPDATE_RDD_STATUS:
- {
- P_EVENT_RDD_STATUS_T prEventRddStatus;
- prEventRddStatus = (P_EVENT_RDD_STATUS_T) (prEvent->aucBuffer);
- prAdapter->ucRddStatus = prEventRddStatus->ucRddStatus;
- }
- break;
- #endif
- #if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS
- case EVENT_ID_UPDATE_BWCS_STATUS:
- {
- P_PTA_IPC_T prEventBwcsStatus;
- prEventBwcsStatus = (P_PTA_IPC_T) (prEvent->aucBuffer);
- #if CFG_SUPPORT_BCM_BWCS_DEBUG
- DBGLOG(RSN, INFO,
- "BCM BWCS Event: %02x%02x%02x%02x\n",
- prEventBwcsStatus->u.aucBTPParams[0], prEventBwcsStatus->u.aucBTPParams[1],
- prEventBwcsStatus->u.aucBTPParams[2], prEventBwcsStatus->u.aucBTPParams[3]);
- DBGLOG(RSN, INFO,
- "BCM BWCS Event: BTPParams[0]:%02x, BTPParams[1]:%02x, BTPParams[2]:%02x, BTPParams[3]:%02x\n",
- prEventBwcsStatus->u.aucBTPParams[0], prEventBwcsStatus->u.aucBTPParams[1],
- prEventBwcsStatus->u.aucBTPParams[2], prEventBwcsStatus->u.aucBTPParams[3]);
- #endif
- kalIndicateStatusAndComplete(prAdapter->prGlueInfo,
- WLAN_STATUS_BWCS_UPDATE,
- (PVOID) prEventBwcsStatus, sizeof(PTA_IPC_T));
- }
- break;
- case EVENT_ID_UPDATE_BCM_DEBUG:
- {
- P_PTA_IPC_T prEventBwcsStatus;
- prEventBwcsStatus = (P_PTA_IPC_T) (prEvent->aucBuffer);
- #if CFG_SUPPORT_BCM_BWCS_DEBUG
- DBGLOG(RSN, INFO,
- "BCM FW status: %02x%02x%02x%02x\n",
- prEventBwcsStatus->u.aucBTPParams[0], prEventBwcsStatus->u.aucBTPParams[1],
- prEventBwcsStatus->u.aucBTPParams[2], prEventBwcsStatus->u.aucBTPParams[3]);
- DBGLOG(RSN, INFO,
- "BCM FW status: BTPParams[0]:%02x, BTPParams[1]:%02x, BTPParams[2]:%02x, BTPParams[3]:%02x\n",
- prEventBwcsStatus->u.aucBTPParams[0], prEventBwcsStatus->u.aucBTPParams[1],
- prEventBwcsStatus->u.aucBTPParams[2], prEventBwcsStatus->u.aucBTPParams[3];
- #endif
- }
- break;
- #endif
- case EVENT_ID_DEBUG_CODE: /* only for debug */
- {
- UINT_32 u4CodeId;
- DBGLOG(RSN, INFO, "[wlan-fw] function sequence: ");
- for (u4CodeId = 0; u4CodeId < 1000; u4CodeId++)
- DBGLOG(RSN, INFO, "%d ", prEvent->aucBuffer[u4CodeId]);
- DBGLOG(RSN, INFO, "\n\n");
- }
- break;
- case EVENT_ID_RFTEST_READY:
- /* command response handling */
- prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
- if (prCmdInfo != NULL) {
- if (prCmdInfo->pfCmdDoneHandler)
- prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prEvent->aucBuffer);
- else if (prCmdInfo->fgIsOid)
- kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_SUCCESS);
- /* return prCmdInfo */
- cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
- }
- break;
- case EVENT_ID_GSCAN_SCAN_AVAILABLE:
- case EVENT_ID_GSCAN_CAPABILITY:
- case EVENT_ID_GSCAN_SCAN_COMPLETE:
- case EVENT_ID_GSCAN_FULL_RESULT:
- case EVENT_ID_GSCAN_SIGNIFICANT_CHANGE:
- case EVENT_ID_GSCAN_GEOFENCE_FOUND:
- nicRxProcessGSCNEvent(prAdapter, prSwRfb);
- break;
- case EVENT_ID_GSCAN_RESULT:
- {
- UINT_8 realnum = 0;
- DBGLOG(SCN, TRACE, "nicRxProcessGSCNEvent ----->\n");
- realnum = nicRxProcessGSCNEvent(prAdapter, prSwRfb);
- DBGLOG(SCN, TRACE, "nicRxProcessGSCNEvent <-----\n");
- #if 0 /* workaround for FW events cnt mis-match with the actual reqirements from wifi_hal */
- if (g_GetResultsCmdCnt == 0) {
- DBGLOG(SCN, INFO,
- "FW report events more than the wifi_hal asked number, buffer the results\n");
- UINT_8 i = 0;
- for (i = 0; i < MAX_BUFFERED_GSCN_RESULTS; i++) {
- #if 1
- if (!g_arGscanResultsIndicateNumber[i]) {
- DBGLOG(SCN, INFO,
- "found available index %d to insert results number %d into buffer\r\n",
- i, realnum);
- g_arGscnResultsTempBuffer[i] = prSwRfb;
- g_arGscanResultsIndicateNumber[i] = realnum;
- g_GetResultsBufferedCnt++;
- fgKeepprSwRfb = TRUE;
- DBGLOG(SCN, INFO, "results buffered in index[%d] \r\n", i);
- break;
- }
- #endif
- }
- if (i == MAX_BUFFERED_GSCN_RESULTS)
- DBGLOG(SCN, INFO,
- "Gscn results buffer is full(all valid), no space to buffer result\r\n");
- } else if (g_GetResultsCmdCnt > 0) {
- DBGLOG(SCN, INFO, "FW report events match the wifi_hal asked number\n");
- g_GetResultsCmdCnt--;
- } else
- DBGLOG(SCN, INFO, "g_GetResultsCmdCnt < 0 ??? unexpected case\n");
- #endif
- /* end of workaround */
- }
- break;
- case EVENT_ID_NLO_DONE:
- prAdapter->rWifiVar.rScanInfo.fgPscnOnnning = FALSE;
- DBGLOG(INIT, INFO, "EVENT_ID_NLO_DONE\n");
- scnEventNloDone(prAdapter, (P_EVENT_NLO_DONE_T) (prEvent->aucBuffer));
- break;
- #if CFG_SUPPORT_BATCH_SCAN
- case EVENT_ID_BATCH_RESULT:
- DBGLOG(SCN, TRACE, "Got EVENT_ID_BATCH_RESULT");
- /* command response handling */
- prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
- if (prCmdInfo != NULL) {
- if (prCmdInfo->pfCmdDoneHandler)
- prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prEvent->aucBuffer);
- else if (prCmdInfo->fgIsOid)
- kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_SUCCESS);
- /* return prCmdInfo */
- cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
- }
- break;
- #endif /* CFG_SUPPORT_BATCH_SCAN */
- #if (CFG_SUPPORT_TDLS == 1)
- case EVENT_ID_TDLS:
- TdlsexEventHandle(prAdapter->prGlueInfo,
- (UINT8 *) prEvent->aucBuffer, (UINT32) (prEvent->u2PacketLen - 8));
- break;
- #endif /* CFG_SUPPORT_TDLS */
- #if (CFG_SUPPORT_STATISTICS == 1)
- case EVENT_ID_STATS_ENV:
- statsEventHandle(prAdapter->prGlueInfo,
- (UINT8 *) prEvent->aucBuffer, (UINT32) (prEvent->u2PacketLen - 8));
- break;
- #endif /* CFG_SUPPORT_STATISTICS */
- case EVENT_ID_FW_LOG_ENV:
- {
- P_EVENT_FW_LOG_T prEventLog;
- prEventLog = (P_EVENT_FW_LOG_T) (prEvent->aucBuffer);
- DBGLOG(RX, EVENT, "[F-L]%s\n", prEventLog->log);
- }
- break;
- default:
- prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum);
- if (prCmdInfo != NULL) {
- if (prCmdInfo->pfCmdDoneHandler)
- prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prEvent->aucBuffer);
- else if (prCmdInfo->fgIsOid)
- kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_SUCCESS);
- /* return prCmdInfo */
- cmdBufFreeCmdInfo(prAdapter, prCmdInfo);
- }
- break;
- }
- nicRxReturnRFB(prAdapter, prSwRfb);
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief nicRxProcessMgmtPacket is used to dispatch management frames
- * to corresponding modules
- *
- * @param prAdapter Pointer to the Adapter structure.
- * @param prSWRfb the RFB to receive rx data
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxProcessMgmtPacket(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
- {
- UINT_8 ucSubtype;
- #if CFG_SUPPORT_802_11W
- BOOLEAN fgMfgDrop = FALSE;
- #endif
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- nicRxFillRFB(prAdapter, prSwRfb);
- ucSubtype = (*(PUINT_8) (prSwRfb->pvHeader) & MASK_FC_SUBTYPE) >> OFFSET_OF_FC_SUBTYPE;
- #if 0 /* CFG_RX_PKTS_DUMP */
- {
- P_HIF_RX_HEADER_T prHifRxHdr;
- UINT_16 u2TxFrameCtrl;
- prHifRxHdr = prSwRfb->prHifRxHdr;
- u2TxFrameCtrl = (*(PUINT_8) (prSwRfb->pvHeader) & MASK_FRAME_TYPE);
- /* if (prAdapter->rRxCtrl.u4RxPktsDumpTypeMask & BIT(HIF_RX_PKT_TYPE_MANAGEMENT)) { */
- /* if (u2TxFrameCtrl == MAC_FRAME_BEACON || */
- /* u2TxFrameCtrl == MAC_FRAME_PROBE_RSP) { */
- DBGLOG(RX, INFO, "QM RX MGT: net %u sta idx %u wlan idx %u ssn %u ptype %u subtype %u 11 %u\n",
- (UINT_32) HIF_RX_HDR_GET_NETWORK_IDX(prHifRxHdr), prHifRxHdr->ucStaRecIdx,
- prSwRfb->ucWlanIdx, (UINT_32) HIF_RX_HDR_GET_SN(prHifRxHdr),/* The new SN of the frame */
- prSwRfb->ucPacketType, ucSubtype, HIF_RX_HDR_GET_80211_FLAG(prHifRxHdr));
- /* DBGLOG_MEM8(SW4, TRACE, (PUINT_8)prSwRfb->pvHeader, prSwRfb->u2PacketLen); */
- /* } */
- /* } */
- }
- #endif
- if ((prAdapter->fgTestMode == FALSE) && (prAdapter->prGlueInfo->fgIsRegistered == TRUE)) {
- #if CFG_MGMT_FRAME_HANDLING
- #if CFG_SUPPORT_802_11W
- fgMfgDrop = rsnCheckRxMgmt(prAdapter, prSwRfb, ucSubtype);
- if (fgMfgDrop) {
- #if DBG
- LOG_FUNC("QM RX MGT: Drop Unprotected Mgmt frame!!!\n");
- #endif
- nicRxReturnRFB(prAdapter, prSwRfb);
- RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT);
- return;
- }
- #endif
- if (apfnProcessRxMgtFrame[ucSubtype]) {
- switch (apfnProcessRxMgtFrame[ucSubtype] (prAdapter, prSwRfb)) {
- case WLAN_STATUS_PENDING:
- return;
- case WLAN_STATUS_SUCCESS:
- case WLAN_STATUS_FAILURE:
- break;
- default:
- DBGLOG(RX, WARN,
- "Unexpected MMPDU(0x%02X) returned with abnormal status\n", ucSubtype);
- break;
- }
- }
- #endif
- }
- nicRxReturnRFB(prAdapter, prSwRfb);
- }
- #if CFG_SUPPORT_WAKEUP_REASON_DEBUG
- static VOID nicRxCheckWakeupReason(P_SW_RFB_T prSwRfb)
- {
- PUINT_8 pvHeader = NULL;
- P_HIF_RX_HEADER_T prHifRxHdr;
- UINT_16 u2PktLen = 0;
- UINT_32 u4HeaderOffset;
- if (!prSwRfb)
- return;
- prHifRxHdr = prSwRfb->prHifRxHdr;
- if (!prHifRxHdr)
- return;
- switch (prSwRfb->ucPacketType) {
- case HIF_RX_PKT_TYPE_DATA:
- {
- UINT_16 u2Temp = 0;
- if (HIF_RX_HDR_GET_BAR_FLAG(prHifRxHdr)) {
- DBGLOG(RX, INFO, "BAR frame[SSN:%d, TID:%d] wakeup host\n",
- (UINT_16)HIF_RX_HDR_GET_SN(prHifRxHdr), (UINT_8)HIF_RX_HDR_GET_TID(prHifRxHdr));
- break;
- }
- u4HeaderOffset = (UINT_32)(prHifRxHdr->ucHerderLenOffset & HIF_RX_HDR_HEADER_OFFSET_MASK);
- pvHeader = (PUINT_8)prHifRxHdr + HIF_RX_HDR_SIZE + u4HeaderOffset;
- u2PktLen = (UINT_16)(prHifRxHdr->u2PacketLen - (HIF_RX_HDR_SIZE + u4HeaderOffset));
- if (!pvHeader) {
- DBGLOG(RX, ERROR, "data packet but pvHeader is NULL!\n");
- break;
- }
- u2Temp = (pvHeader[ETH_TYPE_LEN_OFFSET] << 8) | (pvHeader[ETH_TYPE_LEN_OFFSET + 1]);
- switch (u2Temp) {
- case ETH_P_IPV4:
- u2Temp = *(UINT_16 *) &pvHeader[ETH_HLEN + 4];
- DBGLOG(RX, INFO, "IP Packet from:%d.%d.%d.%d, IP ID 0x%04x wakeup host\n",
- pvHeader[ETH_HLEN + 12], pvHeader[ETH_HLEN + 13],
- pvHeader[ETH_HLEN + 14], pvHeader[ETH_HLEN + 15], u2Temp);
- break;
- case ETH_P_1X:
- case ETH_P_PRE_1X:
- #if CFG_SUPPORT_WAPI
- case ETH_WPI_1X:
- #endif
- case ETH_P_AARP:
- case ETH_P_IPV6:
- case ETH_P_IPX:
- case 0x8100: /* VLAN */
- case 0x890d: /* TDLS */
- DBGLOG(RX, INFO, "Data Packet, EthType 0x%04x wakeup host\n", u2Temp);
- break;
- default:
- DBGLOG(RX, WARN, "maybe abnormal data packet, EthType 0x%04x wakeup host, dump it\n",
- u2Temp);
- DBGLOG_MEM8(RX, INFO, pvHeader, u2PktLen > 50 ? 50:u2PacketLen);
- break;
- }
- break;
- }
- case HIF_RX_PKT_TYPE_EVENT:
- {
- P_WIFI_EVENT_T prEvent = (P_WIFI_EVENT_T) prSwRfb->pucRecvBuff;
- DBGLOG(RX, INFO, "Event 0x%02x wakeup host\n", prEvent->ucEID);
- break;
- }
- case HIF_RX_PKT_TYPE_MANAGEMENT:
- {
- UINT_8 ucSubtype;
- P_WLAN_MAC_MGMT_HEADER_T prWlanMgmtHeader;
- u4HeaderOffset = (UINT_32)(prHifRxHdr->ucHerderLenOffset & HIF_RX_HDR_HEADER_OFFSET_MASK);
- pvHeader = (PUINT_8)prHifRxHdr + HIF_RX_HDR_SIZE + u4HeaderOffset;
- if (!pvHeader) {
- DBGLOG(RX, ERROR, "Mgmt Frame but pvHeader is NULL!\n");
- break;
- }
- prWlanMgmtHeader = (P_WLAN_MAC_MGMT_HEADER_T)pvHeader;
- ucSubtype = (prWlanMgmtHeader->u2FrameCtrl & MASK_FC_SUBTYPE) >>
- OFFSET_OF_FC_SUBTYPE;
- DBGLOG(RX, INFO, "MGMT frame subtype: %d SeqCtrl %d wakeup host\n",
- ucSubtype, prWlanMgmtHeader->u2SeqCtrl);
- break;
- }
- default:
- DBGLOG(RX, WARN, "Unknown Packet %d wakeup host\n", prSwRfb->ucPacketType);
- break;
- }
- }
- #endif
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief nicProcessRFBs is used to process RFBs in the rReceivedRFBList queue.
- *
- * @param prAdapter Pointer to the Adapter structure.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxProcessRFBs(IN P_ADAPTER_T prAdapter)
- {
- P_RX_CTRL_T prRxCtrl;
- P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
- KAL_SPIN_LOCK_DECLARATION();
- DEBUGFUNC("nicRxProcessRFBs");
- ASSERT(prAdapter);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- prRxCtrl->ucNumIndPacket = 0;
- prRxCtrl->ucNumRetainedPacket = 0;
- do {
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- QUEUE_REMOVE_HEAD(&prRxCtrl->rReceivedRfbList, prSwRfb, P_SW_RFB_T);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- if (prSwRfb) {
- #if CFG_SUPPORT_WAKEUP_REASON_DEBUG
- if (kalIsWakeupByWlan(prAdapter))
- nicRxCheckWakeupReason(prSwRfb);
- #endif
- switch (prSwRfb->ucPacketType) {
- case HIF_RX_PKT_TYPE_DATA:
- nicRxProcessDataPacket(prAdapter, prSwRfb);
- break;
- case HIF_RX_PKT_TYPE_EVENT:
- nicRxProcessEventPacket(prAdapter, prSwRfb);
- break;
- case HIF_RX_PKT_TYPE_TX_LOOPBACK:
- #if (CONF_HIF_LOOPBACK_AUTO == 1)
- {
- kalDevLoopbkRxHandle(prAdapter, prSwRfb);
- nicRxReturnRFB(prAdapter, prSwRfb);
- }
- #else
- DBGLOG(RX, ERROR, "ucPacketType = %d\n", prSwRfb->ucPacketType);
- #endif /* CONF_HIF_LOOPBACK_AUTO */
- break;
- case HIF_RX_PKT_TYPE_MANAGEMENT:
- nicRxProcessMgmtPacket(prAdapter, prSwRfb);
- break;
- default:
- RX_INC_CNT(prRxCtrl, RX_TYPE_ERR_DROP_COUNT);
- RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT);
- DBGLOG(RX, ERROR, "ucPacketType = %d\n", prSwRfb->ucPacketType);
- nicRxReturnRFB(prAdapter, prSwRfb); /* need to free it */
- break;
- }
- } else {
- break;
- }
- } while (TRUE);
- if (prRxCtrl->ucNumIndPacket > 0) {
- RX_ADD_CNT(prRxCtrl, RX_DATA_INDICATION_COUNT, prRxCtrl->ucNumIndPacket);
- RX_ADD_CNT(prRxCtrl, RX_DATA_RETAINED_COUNT, prRxCtrl->ucNumRetainedPacket);
- /* DBGLOG(RX, INFO, ("%d packets indicated, Retained cnt = %d\n", */
- /* prRxCtrl->ucNumIndPacket, prRxCtrl->ucNumRetainedPacket)); */
- #if CFG_NATIVE_802_11
- kalRxIndicatePkts(prAdapter->prGlueInfo, (UINT_32) prRxCtrl->ucNumIndPacket,
- (UINT_32) prRxCtrl->ucNumRetainedPacket);
- #else
- kalRxIndicatePkts(prAdapter->prGlueInfo, prRxCtrl->apvIndPacket, (UINT_32) prRxCtrl->ucNumIndPacket);
- #endif
- }
- } /* end of nicRxProcessRFBs() */
- #if !CFG_SDIO_INTR_ENHANCE
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Read the rx data from data port and setup RFB
- *
- * @param prAdapter pointer to the Adapter handler
- * @param prSWRfb the RFB to receive rx data
- *
- * @retval WLAN_STATUS_SUCCESS: SUCCESS
- * @retval WLAN_STATUS_FAILURE: FAILURE
- *
- */
- /*----------------------------------------------------------------------------*/
- WLAN_STATUS nicRxReadBuffer(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb)
- {
- P_RX_CTRL_T prRxCtrl;
- PUINT_8 pucBuf;
- P_HIF_RX_HEADER_T prHifRxHdr;
- UINT_32 u4PktLen = 0, u4ReadBytes;
- WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS;
- BOOLEAN fgResult = TRUE;
- UINT_32 u4RegValue;
- UINT_32 rxNum;
- DEBUGFUNC("nicRxReadBuffer");
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- pucBuf = prSwRfb->pucRecvBuff;
- prHifRxHdr = prSwRfb->prHifRxHdr;
- ASSERT(pucBuf);
- DBGLOG(RX, TRACE, "pucBuf= 0x%x, prHifRxHdr= 0x%x\n", pucBuf, prHifRxHdr);
- do {
- /* Read the RFB DW length and packet length */
- HAL_MCR_RD(prAdapter, MCR_WRPLR, &u4RegValue);
- if (!fgResult) {
- DBGLOG(RX, ERROR, "Read RX Packet Lentgh Error\n");
- return WLAN_STATUS_FAILURE;
- }
- /* 20091021 move the line to get the HIF RX header (for RX0/1) */
- if (u4RegValue == 0) {
- DBGLOG(RX, ERROR, "No RX packet\n");
- return WLAN_STATUS_FAILURE;
- }
- u4PktLen = u4RegValue & BITS(0, 15);
- if (u4PktLen != 0) {
- rxNum = 0;
- } else {
- rxNum = 1;
- u4PktLen = (u4RegValue & BITS(16, 31)) >> 16;
- }
- DBGLOG(RX, TRACE, "RX%d: u4PktLen = %d\n", rxNum, u4PktLen);
- /* 4 <4> Read Entire RFB and packet, include HW appended DW (Checksum Status) */
- u4ReadBytes = ALIGN_4(u4PktLen) + 4;
- HAL_READ_RX_PORT(prAdapter, rxNum, u4ReadBytes, pucBuf, CFG_RX_MAX_PKT_SIZE);
- /* 20091021 move the line to get the HIF RX header */
- /* u4PktLen = (UINT_32)prHifRxHdr->u2PacketLen; */
- if (u4PktLen != (UINT_32) prHifRxHdr->u2PacketLen) {
- DBGLOG(RX, ERROR, "Read u4PktLen = %d, prHifRxHdr->u2PacketLen: %d\n",
- u4PktLen, prHifRxHdr->u2PacketLen);
- #if DBG
- dumpMemory8((PUINT_8) prHifRxHdr,
- (prHifRxHdr->u2PacketLen > 4096) ? 4096 : prHifRxHdr->u2PacketLen);
- #endif
- ASSERT(0);
- }
- /* u4PktLen is byte unit, not inlude HW appended DW */
- prSwRfb->ucPacketType = (UINT_8) (prHifRxHdr->u2PacketType & HIF_RX_HDR_PACKET_TYPE_MASK);
- DBGLOG(RX, TRACE, "ucPacketType = %d\n", prSwRfb->ucPacketType);
- prSwRfb->ucStaRecIdx = (UINT_8) (prHifRxHdr->ucStaRecIdx);
- /* fgResult will be updated in MACRO */
- if (!fgResult)
- return WLAN_STATUS_FAILURE;
- DBGLOG(RX, TRACE, "Dump RX buffer, length = 0x%x\n", u4ReadBytes);
- DBGLOG_MEM8(RX, TRACE, pucBuf, u4ReadBytes);
- } while (FALSE);
- return u4Status;
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Read frames from the data port, fill RFB
- * and put each frame into the rReceivedRFBList queue.
- *
- * @param prAdapter Pointer to the Adapter structure.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxReceiveRFBs(IN P_ADAPTER_T prAdapter)
- {
- P_RX_CTRL_T prRxCtrl;
- P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
- P_HIF_RX_HEADER_T prHifRxHdr;
- UINT_32 u4HwAppendDW;
- KAL_SPIN_LOCK_DECLARATION();
- DEBUGFUNC("nicRxReceiveRFBs");
- ASSERT(prAdapter);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- do {
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- if (!prSwRfb) {
- DBGLOG(RX, TRACE, "No More RFB\n");
- break;
- }
- /* need to consider */
- if (nicRxReadBuffer(prAdapter, prSwRfb) == WLAN_STATUS_FAILURE) {
- DBGLOG(RX, TRACE, "halRxFillRFB failed\n");
- nicRxReturnRFB(prAdapter, prSwRfb);
- break;
- }
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- QUEUE_INSERT_TAIL(&prRxCtrl->rReceivedRfbList, &prSwRfb->rQueEntry);
- RX_INC_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- prHifRxHdr = prSwRfb->prHifRxHdr;
- u4HwAppendDW = *((PUINT_32) ((ULONG) prHifRxHdr + (UINT_32) (ALIGN_4(prHifRxHdr->u2PacketLen))));
- DBGLOG(RX, TRACE, "u4HwAppendDW = 0x%x\n", u4HwAppendDW);
- DBGLOG(RX, TRACE, "u2PacketLen = 0x%x\n", prHifRxHdr->u2PacketLen);
- } while (FALSE); /* while (RX_STATUS_TEST_MORE_FLAG(u4HwAppendDW)); */
- return;
- } /* end of nicReceiveRFBs() */
- #else
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Read frames from the data port, fill RFB
- * and put each frame into the rReceivedRFBList queue.
- *
- * @param prAdapter Pointer to the Adapter structure.
- * @param u4DataPort Specify which port to read
- * @param u2RxLength Specify to the the rx packet length in Byte.
- * @param prSwRfb the RFB to receive rx data.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- WLAN_STATUS
- nicRxEnhanceReadBuffer(IN P_ADAPTER_T prAdapter,
- IN UINT_32 u4DataPort, IN UINT_16 u2RxLength, IN OUT P_SW_RFB_T prSwRfb)
- {
- P_RX_CTRL_T prRxCtrl;
- PUINT_8 pucBuf;
- P_HIF_RX_HEADER_T prHifRxHdr;
- UINT_32 u4PktLen = 0;
- WLAN_STATUS u4Status = WLAN_STATUS_FAILURE;
- BOOLEAN fgResult = TRUE;
- DEBUGFUNC("nicRxEnhanceReadBuffer");
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- pucBuf = prSwRfb->pucRecvBuff;
- ASSERT(pucBuf);
- prHifRxHdr = prSwRfb->prHifRxHdr;
- ASSERT(prHifRxHdr);
- /* DBGLOG(RX, TRACE, ("u2RxLength = %d\n", u2RxLength)); */
- do {
- /* 4 <1> Read RFB frame from MCR_WRDR0, include HW appended DW */
- HAL_READ_RX_PORT(prAdapter,
- u4DataPort, ALIGN_4(u2RxLength + HIF_RX_HW_APPENDED_LEN), pucBuf, CFG_RX_MAX_PKT_SIZE);
- if (!fgResult) {
- DBGLOG(RX, ERROR, "Read RX Packet Lentgh Error\n");
- break;
- }
- u4PktLen = (UINT_32) (prHifRxHdr->u2PacketLen);
- /* DBGLOG(RX, TRACE, ("u4PktLen = %d\n", u4PktLen)); */
- prSwRfb->ucPacketType = (UINT_8) (prHifRxHdr->u2PacketType & HIF_RX_HDR_PACKET_TYPE_MASK);
- /* DBGLOG(RX, TRACE, ("ucPacketType = %d\n", prSwRfb->ucPacketType)); */
- prSwRfb->ucStaRecIdx = (UINT_8) (prHifRxHdr->ucStaRecIdx);
- /* 4 <2> if the RFB dw size or packet size is zero */
- if (u4PktLen == 0) {
- DBGLOG(RX, ERROR, "Packet Length = %u\n", u4PktLen);
- ASSERT(0);
- break;
- }
- /* 4 <3> if the packet is too large or too small */
- if (u4PktLen > CFG_RX_MAX_PKT_SIZE) {
- DBGLOG(RX, TRACE, "Read RX Packet Lentgh Error (%u)\n", u4PktLen);
- ASSERT(0);
- break;
- }
- u4Status = WLAN_STATUS_SUCCESS;
- } while (FALSE);
- DBGLOG_MEM8(RX, TRACE, pucBuf, ALIGN_4(u2RxLength + HIF_RX_HW_APPENDED_LEN));
- return u4Status;
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Read frames from the data port for SDIO
- * I/F, fill RFB and put each frame into the rReceivedRFBList queue.
- *
- * @param prAdapter Pointer to the Adapter structure.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxSDIOReceiveRFBs(IN P_ADAPTER_T prAdapter)
- {
- P_SDIO_CTRL_T prSDIOCtrl;
- P_RX_CTRL_T prRxCtrl;
- P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
- UINT_32 i, rxNum;
- UINT_16 u2RxPktNum, u2RxLength = 0, u2Tmp = 0;
- KAL_SPIN_LOCK_DECLARATION();
- DEBUGFUNC("nicRxSDIOReceiveRFBs");
- ASSERT(prAdapter);
- prSDIOCtrl = prAdapter->prSDIOCtrl;
- ASSERT(prSDIOCtrl);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- for (rxNum = 0; rxNum < 2; rxNum++) {
- u2RxPktNum =
- (rxNum == 0 ? prSDIOCtrl->rRxInfo.u.u2NumValidRx0Len : prSDIOCtrl->rRxInfo.u.u2NumValidRx1Len);
- if (u2RxPktNum == 0)
- continue;
- for (i = 0; i < u2RxPktNum; i++) {
- if (rxNum == 0) {
- /* HAL_READ_RX_LENGTH */
- HAL_READ_RX_LENGTH(prAdapter, &u2RxLength, &u2Tmp);
- } else if (rxNum == 1) {
- /* HAL_READ_RX_LENGTH */
- HAL_READ_RX_LENGTH(prAdapter, &u2Tmp, &u2RxLength);
- }
- if (!u2RxLength)
- break;
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- if (!prSwRfb) {
- DBGLOG(RX, TRACE, "No More RFB\n");
- break;
- }
- ASSERT(prSwRfb);
- if (nicRxEnhanceReadBuffer(prAdapter, rxNum, u2RxLength, prSwRfb) == WLAN_STATUS_FAILURE) {
- DBGLOG(RX, TRACE, "nicRxEnhanceRxReadBuffer failed\n");
- nicRxReturnRFB(prAdapter, prSwRfb);
- break;
- }
- /* prSDIOCtrl->au4RxLength[i] = 0; */
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- QUEUE_INSERT_TAIL(&prRxCtrl->rReceivedRfbList, &prSwRfb->rQueEntry);
- RX_INC_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- }
- }
- prSDIOCtrl->rRxInfo.u.u2NumValidRx0Len = 0;
- prSDIOCtrl->rRxInfo.u.u2NumValidRx1Len = 0;
- } /* end of nicRxSDIOReceiveRFBs() */
- #endif /* CFG_SDIO_INTR_ENHANCE */
- #if CFG_SDIO_RX_AGG
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Read frames from the data port for SDIO with Rx aggregation enabled
- * I/F, fill RFB and put each frame into the rReceivedRFBList queue.
- *
- * @param prAdapter Pointer to the Adapter structure.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxSDIOAggReceiveRFBs(IN P_ADAPTER_T prAdapter)
- {
- P_ENHANCE_MODE_DATA_STRUCT_T prEnhDataStr;
- P_RX_CTRL_T prRxCtrl;
- P_SDIO_CTRL_T prSDIOCtrl;
- P_SW_RFB_T prSwRfb = (P_SW_RFB_T) NULL;
- UINT_32 u4RxLength;
- UINT_32 i, rxNum;
- UINT_32 u4RxAggCount = 0, u4RxAggLength = 0;
- UINT_32 u4RxAvailAggLen, u4CurrAvailFreeRfbCnt;
- PUINT_8 pucSrcAddr;
- P_HIF_RX_HEADER_T prHifRxHdr;
- BOOLEAN fgResult = TRUE;
- BOOLEAN fgIsRxEnhanceMode;
- UINT_16 u2RxPktNum;
- #if CFG_SDIO_RX_ENHANCE
- UINT_32 u4MaxLoopCount = CFG_MAX_RX_ENHANCE_LOOP_COUNT;
- #endif
- KAL_SPIN_LOCK_DECLARATION();
- DEBUGFUNC("nicRxSDIOAggReceiveRFBs");
- ASSERT(prAdapter);
- prEnhDataStr = prAdapter->prSDIOCtrl;
- prRxCtrl = &prAdapter->rRxCtrl;
- prSDIOCtrl = prAdapter->prSDIOCtrl;
- #if CFG_SDIO_RX_ENHANCE
- fgIsRxEnhanceMode = TRUE;
- #else
- fgIsRxEnhanceMode = FALSE;
- #endif
- do {
- #if CFG_SDIO_RX_ENHANCE
- /* to limit maximum loop for RX */
- u4MaxLoopCount--;
- if (u4MaxLoopCount == 0)
- break;
- #endif
- if (prEnhDataStr->rRxInfo.u.u2NumValidRx0Len == 0 && prEnhDataStr->rRxInfo.u.u2NumValidRx1Len == 0)
- break;
- for (rxNum = 0; rxNum < 2; rxNum++) {
- u2RxPktNum =
- (rxNum ==
- 0 ? prEnhDataStr->rRxInfo.u.u2NumValidRx0Len : prEnhDataStr->rRxInfo.u.u2NumValidRx1Len);
- /* if this assertion happened, it is most likely a F/W bug */
- ASSERT(u2RxPktNum <= 16);
- if (u2RxPktNum > 16)
- continue;
- if (u2RxPktNum == 0)
- continue;
- #if CFG_HIF_STATISTICS
- prRxCtrl->u4TotalRxAccessNum++;
- prRxCtrl->u4TotalRxPacketNum += u2RxPktNum;
- #endif
- u4CurrAvailFreeRfbCnt = prRxCtrl->rFreeSwRfbList.u4NumElem;
- /* if SwRfb is not enough, abort reading this time */
- if (u4CurrAvailFreeRfbCnt < u2RxPktNum) {
- #if CFG_HIF_RX_STARVATION_WARNING
- DbgPrint("FreeRfb is not enough: %d available, need %d\n", u4CurrAvailFreeRfbCnt,
- u2RxPktNum);
- DbgPrint("Queued Count: %d / Dequeud Count: %d\n", prRxCtrl->u4QueuedCnt,
- prRxCtrl->u4DequeuedCnt);
- #endif
- continue;
- }
- #if CFG_SDIO_RX_ENHANCE
- u4RxAvailAggLen =
- CFG_RX_COALESCING_BUFFER_SIZE - (sizeof(ENHANCE_MODE_DATA_STRUCT_T) +
- 4 /* extra HW padding */);
- #else
- u4RxAvailAggLen = CFG_RX_COALESCING_BUFFER_SIZE;
- #endif
- u4RxAggCount = 0;
- for (i = 0; i < u2RxPktNum; i++) {
- u4RxLength = (rxNum == 0 ?
- (UINT_32) prEnhDataStr->rRxInfo.u.au2Rx0Len[i] :
- (UINT_32) prEnhDataStr->rRxInfo.u.au2Rx1Len[i]);
- if (!u4RxLength) {
- ASSERT(0);
- break;
- }
- if (ALIGN_4(u4RxLength + HIF_RX_HW_APPENDED_LEN) < u4RxAvailAggLen) {
- if (u4RxAggCount < u4CurrAvailFreeRfbCnt) {
- u4RxAvailAggLen -= ALIGN_4(u4RxLength + HIF_RX_HW_APPENDED_LEN);
- u4RxAggCount++;
- } else {
- /* no FreeSwRfb for rx packet */
- ASSERT(0);
- break;
- }
- } else {
- /* CFG_RX_COALESCING_BUFFER_SIZE is not large enough */
- ASSERT(0);
- break;
- }
- }
- u4RxAggLength = (CFG_RX_COALESCING_BUFFER_SIZE - u4RxAvailAggLen);
- /* DBGLOG(RX, INFO, ("u4RxAggCount = %d, u4RxAggLength = %d\n", */
- /* u4RxAggCount, u4RxAggLength)); */
- HAL_READ_RX_PORT(prAdapter,
- rxNum,
- u4RxAggLength, prRxCtrl->pucRxCoalescingBufPtr, CFG_RX_COALESCING_BUFFER_SIZE);
- if (!fgResult) {
- DBGLOG(RX, ERROR, "Read RX Agg Packet Error\n");
- continue;
- }
- pucSrcAddr = prRxCtrl->pucRxCoalescingBufPtr;
- for (i = 0; i < u4RxAggCount; i++) {
- UINT_16 u2PktLength;
- u2PktLength = (rxNum == 0 ?
- prEnhDataStr->rRxInfo.u.au2Rx0Len[i] :
- prEnhDataStr->rRxInfo.u.au2Rx1Len[i]);
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- ASSERT(prSwRfb);
- kalMemCopy(prSwRfb->pucRecvBuff, pucSrcAddr,
- ALIGN_4(u2PktLength + HIF_RX_HW_APPENDED_LEN));
- /* record the rx time */
- STATS_RX_ARRIVE_TIME_RECORD(prSwRfb); /* ms */
- prHifRxHdr = prSwRfb->prHifRxHdr;
- ASSERT(prHifRxHdr);
- prSwRfb->ucPacketType =
- (UINT_8) (prHifRxHdr->u2PacketType & HIF_RX_HDR_PACKET_TYPE_MASK);
- /* DBGLOG(RX, TRACE, ("ucPacketType = %d\n", prSwRfb->ucPacketType)); */
- prSwRfb->ucStaRecIdx = (UINT_8) (prHifRxHdr->ucStaRecIdx);
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- QUEUE_INSERT_TAIL(&prRxCtrl->rReceivedRfbList, &prSwRfb->rQueEntry);
- RX_INC_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- pucSrcAddr += ALIGN_4(u2PktLength + HIF_RX_HW_APPENDED_LEN);
- /* prEnhDataStr->au4RxLength[i] = 0; */
- }
- #if CFG_SDIO_RX_ENHANCE
- kalMemCopy(prAdapter->prSDIOCtrl, (pucSrcAddr + 4), sizeof(ENHANCE_MODE_DATA_STRUCT_T));
- /* do the same thing what nicSDIOReadIntStatus() does */
- if ((prSDIOCtrl->u4WHISR & WHISR_TX_DONE_INT) == 0 &&
- (prSDIOCtrl->rTxInfo.au4WTSR[0] | prSDIOCtrl->rTxInfo.au4WTSR[1])) {
- prSDIOCtrl->u4WHISR |= WHISR_TX_DONE_INT;
- }
- if ((prSDIOCtrl->u4WHISR & BIT(31)) == 0 &&
- HAL_GET_MAILBOX_READ_CLEAR(prAdapter) == TRUE &&
- (prSDIOCtrl->u4RcvMailbox0 != 0 || prSDIOCtrl->u4RcvMailbox1 != 0)) {
- prSDIOCtrl->u4WHISR |= BIT(31);
- }
- /* dispatch to interrupt handler with RX bits masked */
- nicProcessIST_impl(prAdapter,
- prSDIOCtrl->u4WHISR & (~(WHISR_RX0_DONE_INT | WHISR_RX1_DONE_INT)));
- #endif
- }
- #if !CFG_SDIO_RX_ENHANCE
- prEnhDataStr->rRxInfo.u.u2NumValidRx0Len = 0;
- prEnhDataStr->rRxInfo.u.u2NumValidRx1Len = 0;
- #endif
- } while ((prEnhDataStr->rRxInfo.u.u2NumValidRx0Len || prEnhDataStr->rRxInfo.u.u2NumValidRx1Len)
- && fgIsRxEnhanceMode);
- }
- #endif /* CFG_SDIO_RX_AGG */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Setup a RFB and allocate the os packet to the RFB
- *
- * @param prAdapter Pointer to the Adapter structure.
- * @param prSwRfb Pointer to the RFB
- *
- * @retval WLAN_STATUS_SUCCESS
- * @retval WLAN_STATUS_RESOURCES
- */
- /*----------------------------------------------------------------------------*/
- WLAN_STATUS nicRxSetupRFB(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
- {
- PVOID pvPacket;
- PUINT_8 pucRecvBuff;
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- if (!prSwRfb->pvPacket) {
- kalMemZero(prSwRfb, sizeof(SW_RFB_T));
- pvPacket = kalPacketAlloc(prAdapter->prGlueInfo, CFG_RX_MAX_PKT_SIZE, &pucRecvBuff);
- if (pvPacket == NULL)
- return WLAN_STATUS_RESOURCES;
- prSwRfb->pvPacket = pvPacket;
- prSwRfb->pucRecvBuff = (PVOID) pucRecvBuff;
- } else {
- kalMemZero(((PUINT_8) prSwRfb + OFFSET_OF(SW_RFB_T, prHifRxHdr)),
- (sizeof(SW_RFB_T) - OFFSET_OF(SW_RFB_T, prHifRxHdr)));
- }
- prSwRfb->prHifRxHdr = (P_HIF_RX_HEADER_T) (prSwRfb->pucRecvBuff);
- return WLAN_STATUS_SUCCESS;
- } /* end of nicRxSetupRFB() */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief This routine is called to put a RFB back onto the "RFB with Buffer" list
- * or "RFB without buffer" list according to pvPacket.
- *
- * @param prAdapter Pointer to the Adapter structure.
- * @param prSwRfb Pointer to the RFB
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxReturnRFB(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
- {
- P_RX_CTRL_T prRxCtrl;
- P_QUE_ENTRY_T prQueEntry;
- KAL_SPIN_LOCK_DECLARATION();
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- prRxCtrl = &prAdapter->rRxCtrl;
- prQueEntry = &prSwRfb->rQueEntry;
- ASSERT(prQueEntry);
- /* The processing on this RFB is done, so put it back on the tail of
- our list */
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- if (prSwRfb->pvPacket) {
- /* QUEUE_INSERT_TAIL */
- QUEUE_INSERT_TAIL(&prRxCtrl->rFreeSwRfbList, prQueEntry);
- } else {
- /* QUEUE_INSERT_TAIL */
- QUEUE_INSERT_TAIL(&prRxCtrl->rIndicatedRfbList, prQueEntry);
- }
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE);
- } /* end of nicRxReturnRFB() */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Process rx interrupt. When the rx
- * Interrupt is asserted, it means there are frames in queue.
- *
- * @param prAdapter Pointer to the Adapter structure.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicProcessRxInterrupt(IN P_ADAPTER_T prAdapter)
- {
- ASSERT(prAdapter);
- #if CFG_SDIO_INTR_ENHANCE
- #if CFG_SDIO_RX_AGG
- nicRxSDIOAggReceiveRFBs(prAdapter);
- #else
- nicRxSDIOReceiveRFBs(prAdapter);
- #endif
- #else
- nicRxReceiveRFBs(prAdapter);
- #endif /* CFG_SDIO_INTR_ENHANCE */
- nicRxProcessRFBs(prAdapter);
- return;
- } /* end of nicProcessRxInterrupt() */
- #if CFG_TCP_IP_CHKSUM_OFFLOAD
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Used to update IP/TCP/UDP checksum statistics of RX Module.
- *
- * @param prAdapter Pointer to the Adapter structure.
- * @param aeCSUM The array of checksum result.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxUpdateCSUMStatistics(IN P_ADAPTER_T prAdapter, IN const ENUM_CSUM_RESULT_T aeCSUM[])
- {
- P_RX_CTRL_T prRxCtrl;
- ASSERT(prAdapter);
- ASSERT(aeCSUM);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- if ((aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_SUCCESS) ||
- (aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_SUCCESS)) {
- RX_INC_CNT(prRxCtrl, RX_CSUM_IP_SUCCESS_COUNT);
- } else if ((aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_FAILED) || (aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_FAILED)) {
- RX_INC_CNT(prRxCtrl, RX_CSUM_IP_FAILED_COUNT);
- } else if ((aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_NONE) && (aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_NONE)) {
- RX_INC_CNT(prRxCtrl, RX_CSUM_UNKNOWN_L3_PKT_COUNT);
- } else {
- ASSERT(0);
- }
- if (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_SUCCESS) {
- /* count success num */
- RX_INC_CNT(prRxCtrl, RX_CSUM_TCP_SUCCESS_COUNT);
- } else if (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_FAILED) {
- RX_INC_CNT(prRxCtrl, RX_CSUM_TCP_FAILED_COUNT);
- } else if (aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_SUCCESS) {
- RX_INC_CNT(prRxCtrl, RX_CSUM_UDP_SUCCESS_COUNT);
- } else if (aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_FAILED) {
- RX_INC_CNT(prRxCtrl, RX_CSUM_UDP_FAILED_COUNT);
- } else if ((aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_NONE) && (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_NONE)) {
- RX_INC_CNT(prRxCtrl, RX_CSUM_UNKNOWN_L4_PKT_COUNT);
- } else {
- ASSERT(0);
- }
- } /* end of nicRxUpdateCSUMStatistics() */
- #endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief This function is used to query current status of RX Module.
- *
- * @param prAdapter Pointer to the Adapter structure.
- * @param pucBuffer Pointer to the message buffer.
- * @param pu4Count Pointer to the buffer of message length count.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxQueryStatus(IN P_ADAPTER_T prAdapter, IN PUINT_8 pucBuffer, OUT PUINT_32 pu4Count)
- {
- P_RX_CTRL_T prRxCtrl;
- PUINT_8 pucCurrBuf = pucBuffer;
- ASSERT(prAdapter);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- /* if (pucBuffer) {} */ /* For Windows, we'll print directly instead of sprintf() */
- ASSERT(pu4Count);
- SPRINTF(pucCurrBuf, ("\n\nRX CTRL STATUS:"));
- SPRINTF(pucCurrBuf, ("\n==============="));
- SPRINTF(pucCurrBuf, ("\nFREE RFB w/i BUF LIST :%9u", prRxCtrl->rFreeSwRfbList.u4NumElem));
- SPRINTF(pucCurrBuf, ("\nFREE RFB w/o BUF LIST :%9u", prRxCtrl->rIndicatedRfbList.u4NumElem));
- SPRINTF(pucCurrBuf, ("\nRECEIVED RFB LIST :%9u", prRxCtrl->rReceivedRfbList.u4NumElem));
- SPRINTF(pucCurrBuf, ("\n\n"));
- /* *pu4Count = (UINT_32)((UINT_32)pucCurrBuf - (UINT_32)pucBuffer); */
- } /* end of nicRxQueryStatus() */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Clear RX related counters
- *
- * @param prAdapter Pointer of Adapter Data Structure
- *
- * @return - (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxClearStatistics(IN P_ADAPTER_T prAdapter)
- {
- P_RX_CTRL_T prRxCtrl;
- ASSERT(prAdapter);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- RX_RESET_ALL_CNTS(prRxCtrl);
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief This function is used to query current statistics of RX Module.
- *
- * @param prAdapter Pointer to the Adapter structure.
- * @param pucBuffer Pointer to the message buffer.
- * @param pu4Count Pointer to the buffer of message length count.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxQueryStatistics(IN P_ADAPTER_T prAdapter, IN PUINT_8 pucBuffer, OUT PUINT_32 pu4Count)
- {
- P_RX_CTRL_T prRxCtrl;
- PUINT_8 pucCurrBuf = pucBuffer;
- ASSERT(prAdapter);
- prRxCtrl = &prAdapter->rRxCtrl;
- ASSERT(prRxCtrl);
- /* if (pucBuffer) {} */ /* For Windows, we'll print directly instead of sprintf() */
- ASSERT(pu4Count);
- #define SPRINTF_RX_COUNTER(eCounter) \
- SPRINTF(pucCurrBuf, ("%-30s : %u\n", #eCounter, (UINT_32)prRxCtrl->au8Statistics[eCounter]))
- SPRINTF_RX_COUNTER(RX_MPDU_TOTAL_COUNT);
- SPRINTF_RX_COUNTER(RX_SIZE_ERR_DROP_COUNT);
- SPRINTF_RX_COUNTER(RX_DATA_INDICATION_COUNT);
- SPRINTF_RX_COUNTER(RX_DATA_RETURNED_COUNT);
- SPRINTF_RX_COUNTER(RX_DATA_RETAINED_COUNT);
- #if CFG_TCP_IP_CHKSUM_OFFLOAD || CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60
- SPRINTF_RX_COUNTER(RX_CSUM_TCP_FAILED_COUNT);
- SPRINTF_RX_COUNTER(RX_CSUM_UDP_FAILED_COUNT);
- SPRINTF_RX_COUNTER(RX_CSUM_IP_FAILED_COUNT);
- SPRINTF_RX_COUNTER(RX_CSUM_TCP_SUCCESS_COUNT);
- SPRINTF_RX_COUNTER(RX_CSUM_UDP_SUCCESS_COUNT);
- SPRINTF_RX_COUNTER(RX_CSUM_IP_SUCCESS_COUNT);
- SPRINTF_RX_COUNTER(RX_CSUM_UNKNOWN_L4_PKT_COUNT);
- SPRINTF_RX_COUNTER(RX_CSUM_UNKNOWN_L3_PKT_COUNT);
- SPRINTF_RX_COUNTER(RX_IP_V6_PKT_CCOUNT);
- #endif
- /* *pu4Count = (UINT_32)(pucCurrBuf - pucBuffer); */
- nicRxClearStatistics(prAdapter);
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Read the Response data from data port
- *
- * @param prAdapter pointer to the Adapter handler
- * @param pucRspBuffer pointer to the Response buffer
- *
- * @retval WLAN_STATUS_SUCCESS: Response packet has been read
- * @retval WLAN_STATUS_FAILURE: Read Response packet timeout or error occurred
- *
- */
- /*----------------------------------------------------------------------------*/
- WLAN_STATUS
- nicRxWaitResponse(IN P_ADAPTER_T prAdapter,
- IN UINT_8 ucPortIdx, OUT PUINT_8 pucRspBuffer, IN UINT_32 u4MaxRespBufferLen, OUT PUINT_32 pu4Length)
- {
- UINT_32 u4Value = 0, u4PktLen = 0;
- UINT_32 i = 0;
- WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS;
- BOOLEAN fgResult = TRUE;
- UINT_32 u4Time, u4Current;
- DEBUGFUNC("nicRxWaitResponse");
- ASSERT(prAdapter);
- ASSERT(pucRspBuffer);
- ASSERT(ucPortIdx < 2);
- u4Time = kalGetTimeTick();
- do {
- /* Read the packet length */
- HAL_MCR_RD(prAdapter, MCR_WRPLR, &u4Value);
- if (!fgResult) {
- DBGLOG(RX, ERROR, "Read Response Packet Error\n");
- return WLAN_STATUS_FAILURE;
- }
- if (ucPortIdx == 0)
- u4PktLen = u4Value & 0xFFFF;
- else
- u4PktLen = (u4Value >> 16) & 0xFFFF;
- /* DBGLOG(RX, TRACE, ("i = %d, u4PktLen = %d\n", i, u4PktLen)); */
- if (u4PktLen == 0) {
- /* timeout exceeding check */
- u4Current = kalGetTimeTick();
- if ((u4Current > u4Time) && ((u4Current - u4Time) > RX_RESPONSE_TIMEOUT)) {
- DBGLOG(RX, ERROR, "RX_RESPONSE_TIMEOUT1 %u %d %u\n", u4PktLen, i, u4Current);
- return WLAN_STATUS_FAILURE;
- } else if (u4Current < u4Time && ((u4Current + (0xFFFFFFFF - u4Time)) > RX_RESPONSE_TIMEOUT)) {
- DBGLOG(RX, ERROR, "RX_RESPONSE_TIMEOUT2 %u %d %u\n", u4PktLen, i, u4Current);
- return WLAN_STATUS_FAILURE;
- }
- /* Response packet is not ready */
- kalUdelay(50);
- i++;
- continue;
- }
- if (u4PktLen > u4MaxRespBufferLen) {
- /*
- TO: buffer is not enough but we still need to read all data from HIF to avoid
- HIF crazy.
- */
- DBGLOG(RX, ERROR,
- "Not enough Event Buffer: required length = 0x%x, available buffer length = %d\n",
- u4PktLen, u4MaxRespBufferLen);
- DBGLOG(RX, ERROR, "i = %d, u4PktLen = %u\n", i, u4PktLen);
- return WLAN_STATUS_FAILURE;
- }
- HAL_PORT_RD(prAdapter,
- ucPortIdx == 0 ? MCR_WRDR0 : MCR_WRDR1, u4PktLen, pucRspBuffer, u4MaxRespBufferLen);
- /* fgResult will be updated in MACRO */
- if (!fgResult) {
- DBGLOG(RX, ERROR, "Read Response Packet Error\n");
- return WLAN_STATUS_FAILURE;
- }
- DBGLOG(RX, TRACE, "Dump Response buffer, length = 0x%x\n", u4PktLen);
- DBGLOG_MEM8(RX, TRACE, pucRspBuffer, u4PktLen);
- *pu4Length = u4PktLen;
- break;
- } while (TRUE);
- return u4Status;
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Set filter to enable Promiscuous Mode
- *
- * @param prAdapter Pointer to the Adapter structure.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxEnablePromiscuousMode(IN P_ADAPTER_T prAdapter)
- {
- ASSERT(prAdapter);
- } /* end of nicRxEnablePromiscuousMode() */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief Set filter to disable Promiscuous Mode
- *
- * @param prAdapter Pointer to the Adapter structure.
- *
- * @return (none)
- */
- /*----------------------------------------------------------------------------*/
- VOID nicRxDisablePromiscuousMode(IN P_ADAPTER_T prAdapter)
- {
- ASSERT(prAdapter);
- } /* end of nicRxDisablePromiscuousMode() */
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief this function flushes all packets queued in reordering module
- *
- * @param prAdapter Pointer to the Adapter structure.
- *
- * @retval WLAN_STATUS_SUCCESS Flushed successfully
- */
- /*----------------------------------------------------------------------------*/
- WLAN_STATUS nicRxFlush(IN P_ADAPTER_T prAdapter)
- {
- P_SW_RFB_T prSwRfb;
- ASSERT(prAdapter);
- prSwRfb = qmFlushRxQueues(prAdapter);
- if (prSwRfb != NULL) {
- do {
- P_SW_RFB_T prNextSwRfb;
- /* save next first */
- prNextSwRfb = (P_SW_RFB_T) QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T) prSwRfb);
- /* free */
- nicRxReturnRFB(prAdapter, prSwRfb);
- prSwRfb = prNextSwRfb;
- } while (prSwRfb);
- }
- return WLAN_STATUS_SUCCESS;
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * @brief
- *
- * @param
- *
- * @retval
- */
- /*----------------------------------------------------------------------------*/
- WLAN_STATUS nicRxProcessActionFrame(IN P_ADAPTER_T prAdapter, IN P_SW_RFB_T prSwRfb)
- {
- P_WLAN_ACTION_FRAME prActFrame;
- ASSERT(prAdapter);
- ASSERT(prSwRfb);
- if (prSwRfb->u2PacketLen < sizeof(WLAN_ACTION_FRAME) - 1)
- return WLAN_STATUS_INVALID_PACKET;
- prActFrame = (P_WLAN_ACTION_FRAME) prSwRfb->pvHeader;
- DBGLOG(RX, INFO, "Category %u\n", prActFrame->ucCategory);
- switch (prActFrame->ucCategory) {
- case CATEGORY_PUBLIC_ACTION:
- if (HIF_RX_HDR_GET_NETWORK_IDX(prSwRfb->prHifRxHdr) == NETWORK_TYPE_AIS_INDEX)
- aisFuncValidateRxActionFrame(prAdapter, prSwRfb);
- #if CFG_ENABLE_WIFI_DIRECT
- else if (prAdapter->fgIsP2PRegistered) {
- rlmProcessPublicAction(prAdapter, prSwRfb);
- p2pFuncValidateRxActionFrame(prAdapter, prSwRfb);
- }
- #endif
- break;
- case CATEGORY_HT_ACTION:
- #if CFG_ENABLE_WIFI_DIRECT
- if (prAdapter->fgIsP2PRegistered)
- rlmProcessHtAction(prAdapter, prSwRfb);
- #endif
- break;
- case CATEGORY_VENDOR_SPECIFIC_ACTION:
- #if CFG_ENABLE_WIFI_DIRECT
- if (prAdapter->fgIsP2PRegistered)
- p2pFuncValidateRxActionFrame(prAdapter, prSwRfb);
- #endif
- break;
- #if CFG_SUPPORT_802_11W
- case CATEGORY_SA_QUERT_ACTION:
- {
- P_HIF_RX_HEADER_T prHifRxHdr;
- prHifRxHdr = prSwRfb->prHifRxHdr;
- if ((HIF_RX_HDR_GET_NETWORK_IDX(prHifRxHdr) == NETWORK_TYPE_AIS_INDEX)
- && prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection /* Use MFP */) {
- if (!(prHifRxHdr->ucReserved & CONTROL_FLAG_UC_MGMT_NO_ENC)) {
- /* MFP test plan 5.3.3.4 */
- rsnSaQueryAction(prAdapter, prSwRfb);
- } else {
- DBGLOG(RSN, TRACE, "Un-Protected SA Query, do nothing\n");
- }
- }
- }
- break;
- #endif
- #if CFG_SUPPORT_802_11V
- case CATEGORY_WNM_ACTION:
- {
- wnmWNMAction(prAdapter, prSwRfb);
- }
- break;
- #endif
- #if CFG_SUPPORT_DFS /* Add by Enlai */
- case CATEGORY_SPEC_MGT:
- {
- if (prAdapter->fgEnable5GBand == TRUE)
- rlmProcessSpecMgtAction(prAdapter, prSwRfb);
- }
- break;
- #endif
- #if (CFG_SUPPORT_TDLS == 1)
- case 12: /* shall not be here */
- /*
- A received TDLS Action frame with the Type field set to Management shall
- be discarded. Note that the TDLS Discovery Response frame is not a TDLS
- frame but a Public Action frame.
- */
- break;
- #endif /* CFG_SUPPORT_TDLS */
- default:
- break;
- } /* end of switch case */
- return WLAN_STATUS_SUCCESS;
- }
|