0006-mac80211-backport-from-trunk-r46760.patch 724 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Tue, 1 Sep 2015 18:50:16 +0200
  3. Subject: mac80211: backport from trunk r46760
  4. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  5. index a1eedce..04dfd3b 100644
  6. --- a/package/kernel/mac80211/Makefile
  7. +++ b/package/kernel/mac80211/Makefile
  8. @@ -10,11 +10,11 @@ include $(INCLUDE_DIR)/kernel.mk
  9. PKG_NAME:=mac80211
  10. -PKG_VERSION:=2015-03-09
  11. -PKG_RELEASE:=3
  12. +PKG_VERSION:=2015-07-21
  13. +PKG_RELEASE:=1
  14. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  15. PKG_BACKPORT_VERSION:=
  16. -PKG_MD5SUM:=6d4b04e4ce8a1f54dabfb04f4709453c
  17. +PKG_MD5SUM:=ec529acfb9c942daf8116e5cff47c999
  18. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  19. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  20. @@ -31,7 +31,7 @@ PKG_DRIVERS = \
  21. mwl8k mwifiex-pcie net-hermes net-hermes-pci net-hermes-plx net-hermes-pcmcia \
  22. iwl-legacy iwl3945 iwl4965 iwlagn wlcore wl12xx wl18xx lib80211 \
  23. rtlwifi rtlwifi-pci rtlwifi-usb rtl8192c-common rtl8192ce rtl8192se \
  24. - rtl8192de rtl8192cu
  25. + rtl8192de rtl8192cu mt7601u
  26. PKG_CONFIG_DEPENDS:= \
  27. CONFIG_PACKAGE_kmod-mac80211 \
  28. @@ -60,7 +60,6 @@ define KernelPackage/mac80211/Default
  29. SUBMENU:=$(WMENU)
  30. URL:=https://wireless.wiki.kernel.org/
  31. MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  32. - DEPENDS:=@!TARGET_uml
  33. endef
  34. define KernelPackage/cfg80211
  35. @@ -79,7 +78,7 @@ endef
  36. define KernelPackage/mac80211
  37. $(call KernelPackage/mac80211/Default)
  38. TITLE:=Linux 802.11 Wireless Networking Stack
  39. - DEPENDS+= +kmod-crypto-core +kmod-crypto-arc4 +kmod-crypto-aes +kmod-cfg80211 +hostapd-common
  40. + DEPENDS+= +kmod-crypto-core +kmod-crypto-arc4 +kmod-cfg80211 +hostapd-common
  41. KCONFIG:=\
  42. CONFIG_AVERAGE=y
  43. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  44. @@ -128,7 +127,7 @@ endef
  45. $(eval $(call Download,linux-firmware))
  46. PKG_ATH10K_LINUX_FIRMWARE_NAME:=ath10k-firmware
  47. -PKG_ATH10K_LINUX_FIRMWARE_VERSION:=da0f85d924226ee30c46e037120621c9e192b39e
  48. +PKG_ATH10K_LINUX_FIRMWARE_VERSION:=b46f3e01a6c1f9150fb4612ef53611d714565842
  49. PKG_ATH10K_LINUX_FIRMWARE_SOURCE:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION).tar.bz2
  50. PKG_ATH10K_LINUX_FIRMWARE_PROTO:=git
  51. PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  52. @@ -516,7 +515,7 @@ define KernelPackage/ath/config
  53. bool "Atheros wireless debugging"
  54. help
  55. Say Y, if you want to debug atheros wireless drivers.
  56. - Right now only ath9k makes use of this.
  57. + Only ath9k & ath10k make use of this.
  58. config PACKAGE_ATH_DFS
  59. bool "Enable DFS support"
  60. @@ -624,17 +623,9 @@ endef
  61. define KernelPackage/ath10k/config
  62. if PACKAGE_kmod-ath10k
  63. - config ATH10K_STA_FW
  64. - bool "Firmware optimized for STA operation"
  65. - default n
  66. - help
  67. - Use the ath10k firmware optimized for wireless client instead
  68. - of access point operation.
  69. -
  70. config ATH10K_API2_FW
  71. bool "Firmware optimized for AP operation (v10.1 / API v2)"
  72. default n
  73. - depends on !ATH10K_STA_FW
  74. help
  75. Use the ath10k firmware from the 10.1 SDK using API v2 optimized
  76. for access point operation if the default firmware keeps crashing.
  77. @@ -704,10 +695,31 @@ define KernelPackage/mac80211-hwsim
  78. AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  79. endef
  80. +PKG_MT7601U_FW_NAME:=DPO_MT7601U_LinuxSTA
  81. +PKG_MT7601U_FW_VERSION:=3.0.0.4_20130913
  82. +PKG_MT7601U_FW_MD5SUM:=5f440dccc8bc952745a191994fc34699
  83. +PKG_MT7601U_FW_SOURCE:=$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION).tar.bz2
  84. +PKG_MT7601U_FW_SOURCE_URL:=http://www.mediatek.com/AmazonS3/Downloads/linux/
  85. +define Download/mt7601u-firmware
  86. + FILE:=$(PKG_MT7601U_FW_SOURCE)
  87. + URL:=$(PKG_MT7601U_FW_SOURCE_URL)
  88. + MD5SUM:=$(PKG_MT7601U_FW_MD5SUM)
  89. + SUBDIR:=$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION)
  90. +endef
  91. +$(eval $(call Download,mt7601u-firmware))
  92. +
  93. +define KernelPackage/mt7601u
  94. + $(call KernelPackage/mac80211/Default)
  95. + TITLE:=MT7601U-based USB dongles Wireless Driver
  96. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT @USB_SUPPORT +kmod-usb-core
  97. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko
  98. + AUTOLOAD:=$(call AutoProbe,mt7601)
  99. +endef
  100. +
  101. define KernelPackage/net-libipw
  102. $(call KernelPackage/mac80211/Default)
  103. TITLE:=libipw for ipw2100 and ipw2200
  104. - DEPENDS:=@PCI_SUPPORT +kmod-crypto-core +kmod-crypto-arc4 +kmod-crypto-aes +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  105. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-core +kmod-crypto-arc4 +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  106. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/libipw.ko
  107. AUTOLOAD:=$(call AutoProbe,libipw)
  108. endef
  109. @@ -1602,6 +1614,8 @@ config-$(CONFIG_BRCMFMAC_PCIE) += BRCMFMAC_PCIE
  110. config-$(CONFIG_PACKAGE_BRCM80211_DEBUG) += BRCMDBG
  111. config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
  112. +config-$(call config_package,mt7601u) += MT7601U
  113. +config-y += WL_MEDIATEK
  114. config-$(call config_package,rt2x00-lib) += RT2X00 RT2X00_LIB
  115. config-$(call config_package,rt2x00-pci) += RT2X00_LIB_PCI
  116. @@ -1704,6 +1718,7 @@ define Build/Prepare
  117. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  118. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_LINUX_FIRMWARE_SOURCE)
  119. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  120. + $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_MT7601U_FW_SOURCE)
  121. rm -rf \
  122. $(PKG_BUILD_DIR)/include/linux/ssb \
  123. $(PKG_BUILD_DIR)/include/linux/bcma \
  124. @@ -1866,21 +1881,24 @@ define KernelPackage/ath10k/install
  125. $(INSTALL_DATA) \
  126. $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/ath10k/QCA988X/hw2.0/board.bin \
  127. $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  128. -ifeq ($(CONFIG_ATH10K_STA_FW),y)
  129. - $(INSTALL_DATA) \
  130. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/main/firmware-2.bin_999.999.0.636 \
  131. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  132. -else ifeq ($(CONFIG_ATH10K_API2_FW),y)
  133. +ifeq ($(CONFIG_ATH10K_API2_FW),y)
  134. $(INSTALL_DATA) \
  135. $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.1/firmware-2.bin_10.1.467.2-1 \
  136. $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  137. else
  138. $(INSTALL_DATA) \
  139. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/firmware-4.bin_10.2.4.45 \
  140. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-4.bin
  141. + $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/untested/firmware-5.bin_10.2.4.70-2 \
  142. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  143. endif
  144. endef
  145. +define KernelPackage/mt7601u/install
  146. + $(INSTALL_DIR) $(1)/lib/firmware
  147. + $(INSTALL_DATA) \
  148. + $(PKG_BUILD_DIR)/$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION)/mcu/bin/MT7601.bin \
  149. + $(1)/lib/firmware/mt7601u.bin
  150. +endef
  151. +
  152. define KernelPackage/mwl8k/install
  153. $(INSTALL_DIR) $(1)/lib/firmware/mwl8k
  154. $(INSTALL_DATA) \
  155. @@ -2065,6 +2083,7 @@ $(eval $(call KernelPackage,rtl8192de))
  156. $(eval $(call KernelPackage,rtl8192cu))
  157. $(eval $(call KernelPackage,zd1211rw))
  158. $(eval $(call KernelPackage,mac80211-hwsim))
  159. +$(eval $(call KernelPackage,mt7601u))
  160. $(eval $(call KernelPackage,ath9k-common))
  161. $(eval $(call KernelPackage,ath9k))
  162. $(eval $(call KernelPackage,ath9k-htc))
  163. diff --git a/package/kernel/mac80211/files/regdb.txt b/package/kernel/mac80211/files/regdb.txt
  164. index ba95fc6..84413fd 100644
  165. --- a/package/kernel/mac80211/files/regdb.txt
  166. +++ b/package/kernel/mac80211/files/regdb.txt
  167. @@ -6,7 +6,7 @@ country 00:
  168. # Channel 14. Only JP enables this and for 802.11b only
  169. (2474 - 2494 @ 20), (20), NO-IR, NO-OFDM
  170. # Channel 36 - 48
  171. - (5170 - 5250 @ 80), (20)
  172. + (5170 - 5250 @ 80), (20), AUTO-BW
  173. # Channel 52 - 64
  174. (5250 - 5330 @ 80), (20), NO-IR, DFS, AUTO-BW
  175. # Channel 100 - 144
  176. @@ -54,8 +54,8 @@ country AL: DFS-ETSI
  177. country AM: DFS-ETSI
  178. (2402 - 2482 @ 40), (20)
  179. - (5170 - 5250 @ 80), (18)
  180. - (5250 - 5330 @ 80), (18), DFS
  181. + (5170 - 5250 @ 20), (18)
  182. + (5250 - 5330 @ 20), (18), DFS
  183. country AN: DFS-ETSI
  184. (2402 - 2482 @ 40), (20)
  185. @@ -85,7 +85,7 @@ country AT: DFS-ETSI
  186. # 60 gHz band channels 1-4, ref: Etsi En 302 567
  187. (57000 - 66000 @ 2160), (40)
  188. -country AU:
  189. +country AU: DFS-ETSI
  190. (2402 - 2482 @ 40), (20)
  191. (5170 - 5250 @ 80), (17), AUTO-BW
  192. (5250 - 5330 @ 80), (24), DFS, AUTO-BW
  193. @@ -141,14 +141,20 @@ country BG: DFS-ETSI
  194. (5170 - 5250 @ 80), (20), AUTO-BW
  195. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  196. (5490 - 5710 @ 160), (27), DFS
  197. + # 5 gHz Short Range Devices, ref:
  198. + # Etsi EN 300 440-1
  199. + # Etsi EN 300 440-2
  200. + # http://crc.bg/files/_bg/Spisak_2015.pdf
  201. + # http://crc.bg/files/_bg/Pravila_2015_resh24.pdf
  202. + (5725 - 5875 @ 80), (14)
  203. # 60 gHz band channels 1-4, ref: Etsi En 302 567
  204. (57000 - 66000 @ 2160), (40)
  205. country BH: DFS-JP
  206. (2402 - 2482 @ 40), (20)
  207. - (5170 - 5250 @ 80), (20)
  208. - (5250 - 5330 @ 80), (20), DFS
  209. - (5735 - 5835 @ 80), (20)
  210. + (5170 - 5250 @ 20), (20)
  211. + (5250 - 5330 @ 20), (20), DFS
  212. + (5735 - 5835 @ 20), (20)
  213. country BL: DFS-ETSI
  214. (2402 - 2482 @ 40), (20)
  215. @@ -263,10 +269,10 @@ country CO: DFS-FCC
  216. country CR: DFS-FCC
  217. (2402 - 2482 @ 40), (20)
  218. - (5170 - 5250 @ 80), (17)
  219. - (5250 - 5330 @ 80), (24), DFS
  220. - (5490 - 5730 @ 80), (24), DFS
  221. - (5735 - 5835 @ 80), (30)
  222. + (5170 - 5250 @ 20), (17)
  223. + (5250 - 5330 @ 20), (24), DFS
  224. + (5490 - 5730 @ 20), (24), DFS
  225. + (5735 - 5835 @ 20), (30)
  226. country CX: DFS-FCC
  227. (2402 - 2482 @ 40), (20)
  228. @@ -349,10 +355,10 @@ country DZ: DFS-JP
  229. country EC: DFS-FCC
  230. (2402 - 2482 @ 40), (20)
  231. - (5170 - 5250 @ 80), (17)
  232. - (5250 - 5330 @ 80), (24), DFS
  233. - (5490 - 5730 @ 80), (24), DFS
  234. - (5735 - 5835 @ 80), (30)
  235. + (5170 - 5250 @ 20), (17)
  236. + (5250 - 5330 @ 20), (24), DFS
  237. + (5490 - 5730 @ 20), (24), DFS
  238. + (5735 - 5835 @ 20), (30)
  239. country EE: DFS-ETSI
  240. (2402 - 2482 @ 40), (20)
  241. @@ -364,8 +370,8 @@ country EE: DFS-ETSI
  242. country EG: DFS-ETSI
  243. (2402 - 2482 @ 40), (20)
  244. - (5170 - 5250 @ 80), (20)
  245. - (5250 - 5330 @ 80), (20), DFS
  246. + (5170 - 5250 @ 40), (20)
  247. + (5250 - 5330 @ 40), (20), DFS
  248. # Orden IET/787/2013, de 25 de abril, por la que se aprueba
  249. # el cuadro nacional de atribución de frecuencias.
  250. @@ -474,10 +480,10 @@ country GT: DFS-FCC
  251. country GU: DFS-FCC
  252. (2402 - 2472 @ 40), (30)
  253. - (5170 - 5250 @ 80), (17)
  254. - (5250 - 5330 @ 80), (24), DFS
  255. - (5490 - 5730 @ 80), (24), DFS
  256. - (5735 - 5835 @ 80), (30)
  257. + (5170 - 5250 @ 20), (17)
  258. + (5250 - 5330 @ 20), (24), DFS
  259. + (5490 - 5730 @ 20), (24), DFS
  260. + (5735 - 5835 @ 20), (30)
  261. country GY:
  262. (2402 - 2482 @ 40), (30)
  263. @@ -522,8 +528,8 @@ country HU: DFS-ETSI
  264. country ID: DFS-JP
  265. # ref: http://www.postel.go.id/content/ID/regulasi/standardisasi/kepdir/bwa%205,8%20ghz.pdf
  266. - (2402 - 2482 @ 40), (20)
  267. - (5735 - 5815 @ 80), (23)
  268. + (2402 - 2482 @ 20), (20)
  269. + (5735 - 5815 @ 20), (23)
  270. country IE: DFS-ETSI
  271. (2402 - 2482 @ 40), (20)
  272. @@ -584,6 +590,9 @@ country JP: DFS-JP
  273. (5170 - 5250 @ 80), (20), AUTO-BW
  274. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  275. (5490 - 5710 @ 160), (23), DFS
  276. + # 60 GHz band channels 2-4 at 10mW,
  277. + # ref: http://www.arib.or.jp/english/html/overview/doc/1-STD-T74v1_1.pdf
  278. + (59000 - 66000 @ 2160), (10 mW)
  279. country KE: DFS-JP
  280. (2402 - 2482 @ 40), (20)
  281. @@ -607,11 +616,11 @@ country KN: DFS-ETSI
  282. (5735 - 5815 @ 80), (30)
  283. country KP: DFS-JP
  284. - (2402 - 2482 @ 40), (20)
  285. - (5170 - 5250 @ 80), (20), AUTO-BW
  286. - (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  287. - (5490 - 5630 @ 80), (30), DFS
  288. - (5735 - 5815 @ 80), (30)
  289. + (2402 - 2482 @ 20), (20)
  290. + (5170 - 5250 @ 20), (20)
  291. + (5250 - 5330 @ 20), (20), DFS
  292. + (5490 - 5630 @ 20), (30), DFS
  293. + (5735 - 5815 @ 20), (30)
  294. country KR: DFS-JP
  295. (2402 - 2482 @ 40), (20)
  296. @@ -659,10 +668,10 @@ country LI: DFS-ETSI
  297. country LK: DFS-FCC
  298. (2402 - 2482 @ 40), (20)
  299. - (5170 - 5250 @ 80), (17)
  300. - (5250 - 5330 @ 80), (24), DFS
  301. - (5490 - 5730 @ 80), (24), DFS
  302. - (5735 - 5835 @ 80), (30)
  303. + (5170 - 5250 @ 20), (17)
  304. + (5250 - 5330 @ 20), (24), DFS
  305. + (5490 - 5730 @ 20), (24), DFS
  306. + (5735 - 5835 @ 20), (30)
  307. # Source:
  308. # http://lca.org.ls/images/documents/lesotho_national_frequency_allocation_plan.pdf
  309. @@ -751,11 +760,12 @@ country MN: DFS-FCC
  310. (5490 - 5730 @ 160), (24), DFS
  311. (5735 - 5835 @ 80), (30)
  312. -country MO:
  313. - (2402 - 2482 @ 40), (20)
  314. - (5170 - 5250 @ 40), (23)
  315. - (5250 - 5330 @ 40), (23), DFS
  316. - (5735 - 5835 @ 40), (30)
  317. +country MO: DFS-FCC
  318. + (2402 - 2482 @ 40), (23)
  319. + (5170 - 5250 @ 80), (23), AUTO-BW
  320. + (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  321. + (5490 - 5730 @ 160), (30), DFS
  322. + (5735 - 5835 @ 80), (30)
  323. country MP: DFS-FCC
  324. (2402 - 2472 @ 40), (30)
  325. @@ -793,6 +803,14 @@ country MU: DFS-FCC
  326. (5490 - 5730 @ 160), (24), DFS
  327. (5735 - 5835 @ 80), (30)
  328. +# Source:
  329. +# http://www.cam.gov.mv/docs/tech_standards/TAM-TS-100-2004-WLAN.pdf
  330. +country MV: DFS-ETSI
  331. + (2400 - 2483.5 @ 40), (100 mW)
  332. + (5150 - 5250 @ 80), (200 mW), AUTO-BW
  333. + (5250 - 5350 @ 80), (100 mW), DFS, AUTO-BW
  334. + (5725 - 5850 @ 80), (100 mW)
  335. +
  336. country MW: DFS-ETSI
  337. (2402 - 2482 @ 40), (20)
  338. (5170 - 5250 @ 80), (20), AUTO-BW
  339. @@ -812,6 +830,11 @@ country MY: DFS-FCC
  340. (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  341. (5735 - 5835 @ 80), (30)
  342. +country NG: DFS-ETSI
  343. + (2402 - 2482 @ 40), (20)
  344. + (5250 - 5330 @ 80), (30), DFS
  345. + (5735 - 5835 @ 80), (30)
  346. +
  347. country NI: DFS-FCC
  348. (2402 - 2472 @ 40), (30)
  349. (5170 - 5250 @ 80), (24), AUTO-BW
  350. @@ -848,7 +871,7 @@ country NP: DFS-JP
  351. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  352. (5735 - 5835 @ 80), (20)
  353. -country NZ: DFS-FCC
  354. +country NZ: DFS-ETSI
  355. (2402 - 2482 @ 40), (30)
  356. (5170 - 5250 @ 80), (17), AUTO-BW
  357. (5250 - 5330 @ 80), (24), DFS, AUTO-BW
  358. @@ -971,10 +994,12 @@ country RS: DFS-ETSI
  359. country RU: DFS-ETSI
  360. (2402 - 2482 @ 40), (20)
  361. - (5170 - 5250 @ 80), (20)
  362. - (5250 - 5330 @ 80), (20), DFS
  363. - (5650 - 5730 @ 80), (30), DFS
  364. - (5735 - 5835 @ 80), (30)
  365. + (5170 - 5250 @ 40), (20)
  366. + (5250 - 5330 @ 40), (20), DFS
  367. + (5650 - 5730 @ 40), (30), DFS
  368. + (5735 - 5835 @ 40), (30)
  369. + # 60 GHz band channels 1-4, ref: Changes to NLA 124_Order №129_22042015.pdf
  370. + (57000 - 66000 @ 2160), (40)
  371. country RW: DFS-FCC
  372. (2402 - 2482 @ 40), (20)
  373. @@ -1037,9 +1062,9 @@ country SR: DFS-ETSI
  374. country SV: DFS-FCC
  375. (2402 - 2482 @ 40), (20)
  376. - (5170 - 5250 @ 80), (17)
  377. - (5250 - 5330 @ 80), (23), DFS
  378. - (5735 - 5835 @ 80), (30)
  379. + (5170 - 5250 @ 20), (17)
  380. + (5250 - 5330 @ 20), (23), DFS
  381. + (5735 - 5835 @ 20), (30)
  382. country SY:
  383. (2402 - 2482 @ 40), (20)
  384. @@ -1099,6 +1124,10 @@ country TW: DFS-JP
  385. (5650 - 5710 @ 40), (30), DFS
  386. (5735 - 5835 @ 80), (30)
  387. +country TZ:
  388. + (2402 - 2482 @ 40), (20)
  389. + (5735 - 5835 @ 80), (30)
  390. +
  391. # Source:
  392. # #914 / 06 Sep 2007: http://www.ucrf.gov.ua/uk/doc/nkrz/1196068874
  393. # #1174 / 23 Oct 2008: http://www.nkrz.gov.ua/uk/activities/ruling/1225269361
  394. @@ -1125,6 +1154,7 @@ country US: DFS-FCC
  395. (2402 - 2472 @ 40), (30)
  396. (5170 - 5250 @ 80), (17), AUTO-BW
  397. (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  398. + (5490 - 5730 @ 160), (23), DFS
  399. (5735 - 5835 @ 80), (30)
  400. # 60g band
  401. # reference: http://cfr.regstoday.com/47cfr15.aspx#47_CFR_15p255
  402. @@ -1192,6 +1222,12 @@ country WF: DFS-ETSI
  403. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  404. (5490 - 5710 @ 160), (27), DFS
  405. +country WS: DFS-ETSI
  406. + (2402 - 2482 @ 40), (20)
  407. + (5170 - 5250 @ 40), (20)
  408. + (5250 - 5330 @ 40), (20), DFS
  409. + (5490 - 5710 @ 40), (27), DFS
  410. +
  411. country YE:
  412. (2402 - 2482 @ 40), (20)
  413. diff --git a/package/kernel/mac80211/patches/001-fix_build.patch b/package/kernel/mac80211/patches/001-fix_build.patch
  414. index 818983e..402649d 100644
  415. --- a/package/kernel/mac80211/patches/001-fix_build.patch
  416. +++ b/package/kernel/mac80211/patches/001-fix_build.patch
  417. @@ -27,7 +27,7 @@
  418. @set -e ; test -f .local-symbols || ( \
  419. echo "/--------------" ;\
  420. echo "| You shouldn't run make in the backports tree, but only in" ;\
  421. -@@ -60,56 +62,60 @@ mrproper:
  422. +@@ -60,57 +62,61 @@ mrproper:
  423. echo "| (that isn't currently running.)" ;\
  424. echo "\\--" ;\
  425. false)
  426. @@ -56,11 +56,12 @@
  427. - done \
  428. - ) > Kconfig.kernel ;\
  429. - kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  430. -- sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  431. +- sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  432. - test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  433. - test "$$kver" != "" ;\
  434. - kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  435. -- kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  436. +- kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  437. +- kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  438. - print=0 ;\
  439. - for v in $$kvers ; do \
  440. - if [ "$$print" = "1" ] ; then \
  441. @@ -111,11 +112,12 @@
  442. +
  443. +Kconfig.versions: Kconfig.kernel
  444. + @kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  445. -+ sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  446. ++ sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  447. + test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  448. + test "$$kver" != "" ;\
  449. + kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  450. -+ kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  451. ++ kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  452. ++ kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  453. + print=0 ;\
  454. + for v in $$kvers ; do \
  455. + if [ "$$print" = "1" ] ; then \
  456. diff --git a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch b/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  457. deleted file mode 100644
  458. index d48a723..0000000
  459. --- a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  460. +++ /dev/null
  461. @@ -1,10 +0,0 @@
  462. ---- a/backport-include/linux/debugfs.h
  463. -+++ b/backport-include/linux/debugfs.h
  464. -@@ -3,6 +3,7 @@
  465. - #include_next <linux/debugfs.h>
  466. - #include <linux/version.h>
  467. - #include <generated/utsrelease.h>
  468. -+#include <linux/device.h>
  469. -
  470. - #if defined(CONFIG_DEBUG_FS)
  471. - struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
  472. diff --git a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch b/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  473. deleted file mode 100644
  474. index e07f323..0000000
  475. --- a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  476. +++ /dev/null
  477. @@ -1,16 +0,0 @@
  478. ---- a/net/mac80211/iface.c
  479. -+++ b/net/mac80211/iface.c
  480. -@@ -1858,6 +1858,13 @@ void ieee80211_remove_interfaces(struct
  481. - }
  482. - mutex_unlock(&local->iflist_mtx);
  483. - unregister_netdevice_many(&unreg_list);
  484. -+#if (!(LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,45) && \
  485. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) && \
  486. -+ !(LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,9) && \
  487. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) && \
  488. -+ (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)))
  489. -+ list_del(&unreg_list);
  490. -+#endif
  491. -
  492. - list_for_each_entry_safe(sdata, tmp, &wdev_list, list) {
  493. - list_del(&sdata->list);
  494. diff --git a/package/kernel/mac80211/patches/020-add_mpls_h.patch b/package/kernel/mac80211/patches/020-add_mpls_h.patch
  495. deleted file mode 100644
  496. index e5310bc..0000000
  497. --- a/package/kernel/mac80211/patches/020-add_mpls_h.patch
  498. +++ /dev/null
  499. @@ -1,37 +0,0 @@
  500. ---- /dev/null
  501. -+++ b/include/uapi/linux/mpls.h
  502. -@@ -0,0 +1,34 @@
  503. -+#ifndef _UAPI_MPLS_H
  504. -+#define _UAPI_MPLS_H
  505. -+
  506. -+#include <linux/types.h>
  507. -+#include <asm/byteorder.h>
  508. -+
  509. -+/* Reference: RFC 5462, RFC 3032
  510. -+ *
  511. -+ * 0 1 2 3
  512. -+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  513. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  514. -+ * | Label | TC |S| TTL |
  515. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  516. -+ *
  517. -+ * Label: Label Value, 20 bits
  518. -+ * TC: Traffic Class field, 3 bits
  519. -+ * S: Bottom of Stack, 1 bit
  520. -+ * TTL: Time to Live, 8 bits
  521. -+ */
  522. -+
  523. -+struct mpls_label {
  524. -+ __be32 entry;
  525. -+};
  526. -+
  527. -+#define MPLS_LS_LABEL_MASK 0xFFFFF000
  528. -+#define MPLS_LS_LABEL_SHIFT 12
  529. -+#define MPLS_LS_TC_MASK 0x00000E00
  530. -+#define MPLS_LS_TC_SHIFT 9
  531. -+#define MPLS_LS_S_MASK 0x00000100
  532. -+#define MPLS_LS_S_SHIFT 8
  533. -+#define MPLS_LS_TTL_MASK 0x000000FF
  534. -+#define MPLS_LS_TTL_SHIFT 0
  535. -+
  536. -+#endif /* _UAPI_MPLS_H */
  537. diff --git a/package/kernel/mac80211/patches/020-backports-do-not-add-debugfs_create_devm_seqfile-on-.patch b/package/kernel/mac80211/patches/020-backports-do-not-add-debugfs_create_devm_seqfile-on-.patch
  538. new file mode 100644
  539. index 0000000..97f678c
  540. --- /dev/null
  541. +++ b/package/kernel/mac80211/patches/020-backports-do-not-add-debugfs_create_devm_seqfile-on-.patch
  542. @@ -0,0 +1,33 @@
  543. +From e15e9231e7a9f81f5264d294fd3fd96a20d92516 Mon Sep 17 00:00:00 2001
  544. +From: Hauke Mehrtens <hauke@hauke-m.de>
  545. +Date: Sat, 25 Jul 2015 15:19:17 +0200
  546. +Subject: [PATCH 3/3] backports: do not add debugfs_create_devm_seqfile() on
  547. + recent kernel versions
  548. +
  549. +An #ifdef for the kernel version was missing around the header of
  550. +debugfs_create_devm_seqfile() and the LINUX_BACKPORT() was also not
  551. +done.
  552. +
  553. +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  554. +---
  555. + backport/backport-include/linux/debugfs.h | 3 +++
  556. + 1 file changed, 3 insertions(+)
  557. +
  558. +--- a/backport-include/linux/debugfs.h
  559. ++++ b/backport-include/linux/debugfs.h
  560. +@@ -5,6 +5,8 @@
  561. + #include <linux/device.h>
  562. + #include <generated/utsrelease.h>
  563. +
  564. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  565. ++#define debugfs_create_devm_seqfile LINUX_BACKPORT(debugfs_create_devm_seqfile)
  566. + #if defined(CONFIG_DEBUG_FS)
  567. + struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
  568. + struct dentry *parent,
  569. +@@ -20,5 +22,6 @@ static inline struct dentry *debugfs_cre
  570. + return ERR_PTR(-ENODEV);
  571. + }
  572. + #endif /* CONFIG_DEBUG_FS */
  573. ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  574. +
  575. + #endif /* __BACKPORT_DEBUGFS_H_ */
  576. diff --git a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch b/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  577. deleted file mode 100644
  578. index dce217f..0000000
  579. --- a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  580. +++ /dev/null
  581. @@ -1,104 +0,0 @@
  582. ---- a/drivers/bcma/driver_pci.c
  583. -+++ b/drivers/bcma/driver_pci.c
  584. -@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcm
  585. - }
  586. - EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
  587. -
  588. --int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  589. -- bool enable)
  590. --{
  591. -- struct pci_dev *pdev;
  592. -- u32 coremask, tmp;
  593. -- int err = 0;
  594. --
  595. -- if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  596. -- /* This bcma device is not on a PCI host-bus. So the IRQs are
  597. -- * not routed through the PCI core.
  598. -- * So we must not enable routing through the PCI core. */
  599. -- goto out;
  600. -- }
  601. --
  602. -- pdev = bus->host_pci;
  603. --
  604. -- err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  605. -- if (err)
  606. -- goto out;
  607. --
  608. -- coremask = BIT(core->core_index) << 8;
  609. -- if (enable)
  610. -- tmp |= coremask;
  611. -- else
  612. -- tmp &= ~coremask;
  613. --
  614. -- err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  615. --
  616. --out:
  617. -- return err;
  618. --}
  619. --EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl);
  620. --
  621. - static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
  622. - {
  623. - u32 w;
  624. ---- a/drivers/bcma/host_pci.c
  625. -+++ b/drivers/bcma/host_pci.c
  626. -@@ -351,3 +351,37 @@ void bcma_host_pci_down(struct bcma_bus
  627. - bcma_core_pci_down(&bus->drv_pci[0]);
  628. - }
  629. - EXPORT_SYMBOL_GPL(bcma_host_pci_down);
  630. -+
  631. -+/* See also si_pci_setup */
  632. -+int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  633. -+ bool enable)
  634. -+{
  635. -+ struct pci_dev *pdev;
  636. -+ u32 coremask, tmp;
  637. -+ int err = 0;
  638. -+
  639. -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  640. -+ /* This bcma device is not on a PCI host-bus. So the IRQs are
  641. -+ * not routed through the PCI core.
  642. -+ * So we must not enable routing through the PCI core. */
  643. -+ goto out;
  644. -+ }
  645. -+
  646. -+ pdev = bus->host_pci;
  647. -+
  648. -+ err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  649. -+ if (err)
  650. -+ goto out;
  651. -+
  652. -+ coremask = BIT(core->core_index) << 8;
  653. -+ if (enable)
  654. -+ tmp |= coremask;
  655. -+ else
  656. -+ tmp &= ~coremask;
  657. -+
  658. -+ err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  659. -+
  660. -+out:
  661. -+ return err;
  662. -+}
  663. -+EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl);
  664. ---- a/drivers/net/wireless/b43/main.c
  665. -+++ b/drivers/net/wireless/b43/main.c
  666. -@@ -4866,7 +4866,7 @@ static int b43_wireless_core_init(struct
  667. - switch (dev->dev->bus_type) {
  668. - #ifdef CPTCFG_B43_BCMA
  669. - case B43_BUS_BCMA:
  670. -- bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
  671. -+ bcma_host_pci_irq_ctl(dev->dev->bdev->bus,
  672. - dev->dev->bdev, true);
  673. - bcma_host_pci_up(dev->dev->bdev->bus);
  674. - break;
  675. ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
  676. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
  677. -@@ -4959,7 +4959,7 @@ static int brcms_b_up_prep(struct brcms_
  678. - * Configure pci/pcmcia here instead of in brcms_c_attach()
  679. - * to allow mfg hotswap: down, hotswap (chip power cycle), up.
  680. - */
  681. -- bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  682. -+ bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  683. - true);
  684. -
  685. - /*
  686. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  687. index d307949..4fbab23 100644
  688. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  689. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  690. @@ -1,6 +1,6 @@
  691. --- a/.local-symbols
  692. +++ b/.local-symbols
  693. -@@ -344,40 +344,3 @@ USB_CDC_PHONET=
  694. +@@ -449,43 +449,6 @@ USB_CDC_PHONET=
  695. USB_IPHETH=
  696. USB_SIERRA_NET=
  697. USB_VL600=
  698. @@ -32,26 +32,18 @@
  699. -BCMA_BLOCKIO=
  700. -BCMA_HOST_PCI_POSSIBLE=
  701. -BCMA_HOST_PCI=
  702. --BCMA_DRIVER_PCI_HOSTMODE=
  703. -BCMA_HOST_SOC=
  704. -BCMA_DRIVER_PCI=
  705. +-BCMA_DRIVER_PCI_HOSTMODE=
  706. -BCMA_DRIVER_MIPS=
  707. -BCMA_SFLASH=
  708. -BCMA_NFLASH=
  709. -BCMA_DRIVER_GMAC_CMN=
  710. -BCMA_DRIVER_GPIO=
  711. -BCMA_DEBUG=
  712. ---- a/Makefile.kernel
  713. -+++ b/Makefile.kernel
  714. -@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  715. - obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  716. - #obj-$(CPTCFG_BT) += net/bluetooth/
  717. - #obj-$(CPTCFG_BT) += drivers/bluetooth/
  718. --obj-$(CPTCFG_SSB) += drivers/ssb/
  719. --obj-$(CPTCFG_BCMA) += drivers/bcma/
  720. - #obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  721. - obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  722. - #obj-$(CPTCFG_NFC) += net/nfc/
  723. + NFC=
  724. + NFC_DIGITAL=
  725. + NFC_NCI=
  726. --- a/drivers/net/wireless/b43/main.c
  727. +++ b/drivers/net/wireless/b43/main.c
  728. @@ -2866,7 +2866,7 @@ static struct ssb_device *b43_ssb_gpio_d
  729. @@ -63,7 +55,7 @@
  730. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  731. #else
  732. return bus->chipco.dev;
  733. -@@ -4907,7 +4907,7 @@ static int b43_wireless_core_init(struct
  734. +@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  735. }
  736. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  737. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  738. @@ -116,12 +108,23 @@
  739. --- a/Kconfig.sources
  740. +++ b/Kconfig.sources
  741. @@ -9,9 +9,6 @@ source "$BACKPORT_DIR/drivers/net/wirele
  742. - #source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  743. + source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  744. source "$BACKPORT_DIR/drivers/net/usb/Kconfig"
  745. -source "$BACKPORT_DIR/drivers/ssb/Kconfig"
  746. -source "$BACKPORT_DIR/drivers/bcma/Kconfig"
  747. -
  748. - #source "$BACKPORT_DIR/net/nfc/Kconfig"
  749. + source "$BACKPORT_DIR/net/nfc/Kconfig"
  750. - #source "$BACKPORT_DIR/drivers/media/Kconfig"
  751. + source "$BACKPORT_DIR/drivers/media/Kconfig"
  752. +--- a/Makefile.kernel
  753. ++++ b/Makefile.kernel
  754. +@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  755. + obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  756. + obj-$(CPTCFG_BT) += net/bluetooth/
  757. + obj-$(CPTCFG_BT) += drivers/bluetooth/
  758. +-obj-$(CPTCFG_SSB) += drivers/ssb/
  759. +-obj-$(CPTCFG_BCMA) += drivers/bcma/
  760. + obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  761. + obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  762. + obj-$(CPTCFG_NFC) += net/nfc/
  763. diff --git a/package/kernel/mac80211/patches/090-linux_3_18_12_compat.patch b/package/kernel/mac80211/patches/090-linux_3_18_12_compat.patch
  764. deleted file mode 100644
  765. index 85c5280..0000000
  766. --- a/package/kernel/mac80211/patches/090-linux_3_18_12_compat.patch
  767. +++ /dev/null
  768. @@ -1,29 +0,0 @@
  769. ---- a/backport-include/linux/wait.h
  770. -+++ b/backport-include/linux/wait.h
  771. -@@ -23,7 +23,7 @@ backport_wait_on_bit_io(void *word, int
  772. -
  773. - #endif
  774. -
  775. --#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  776. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  777. - #define WQ_FLAG_WOKEN 0x02
  778. -
  779. - #define wait_woken LINUX_BACKPORT(wait_woken)
  780. ---- a/compat/backport-3.19.c
  781. -+++ b/compat/backport-3.19.c
  782. -@@ -15,6 +15,7 @@
  783. - #include <linux/netdevice.h>
  784. - #include <linux/debugfs.h>
  785. -
  786. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  787. - static inline bool is_kthread_should_stop(void)
  788. - {
  789. - return (current->flags & PF_KTHREAD) && kthread_should_stop();
  790. -@@ -79,6 +80,7 @@ int woken_wake_function(wait_queue_t *wa
  791. - return default_wake_function(wait, mode, sync, key);
  792. - }
  793. - EXPORT_SYMBOL(woken_wake_function);
  794. -+#endif
  795. -
  796. - #ifdef __BACKPORT_NETDEV_RSS_KEY_FILL
  797. - u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
  798. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  799. new file mode 100644
  800. index 0000000..07dde54
  801. --- /dev/null
  802. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  803. @@ -0,0 +1,376 @@
  804. +--- a/net/mac80211/Kconfig
  805. ++++ b/net/mac80211/Kconfig
  806. +@@ -5,8 +5,6 @@ config MAC80211
  807. + depends on CRYPTO
  808. + depends on CRYPTO_ARC4
  809. + depends on CRYPTO_AES
  810. +- select BPAUTO_CRYPTO_CCM
  811. +- depends on CRYPTO_GCM
  812. + depends on CRC32
  813. + select BPAUTO_AVERAGE
  814. + ---help---
  815. +--- a/net/mac80211/Makefile
  816. ++++ b/net/mac80211/Makefile
  817. +@@ -15,9 +15,7 @@ mac80211-y := \
  818. + michael.o \
  819. + tkip.o \
  820. + aes_ccm.o \
  821. +- aes_gcm.o \
  822. + aes_cmac.o \
  823. +- aes_gmac.o \
  824. + cfg.o \
  825. + ethtool.o \
  826. + rx.o \
  827. +--- a/net/mac80211/aes_ccm.c
  828. ++++ b/net/mac80211/aes_ccm.c
  829. +@@ -13,89 +13,132 @@
  830. + #include <linux/types.h>
  831. + #include <linux/err.h>
  832. + #include <crypto/aead.h>
  833. ++#include <crypto/aes.h>
  834. +
  835. + #include <net/mac80211.h>
  836. + #include "key.h"
  837. + #include "aes_ccm.h"
  838. +
  839. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  840. +- u8 *data, size_t data_len, u8 *mic,
  841. +- size_t mic_len)
  842. ++static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0,
  843. ++ u8 *a, u8 *b)
  844. + {
  845. +- struct scatterlist sg[3];
  846. ++ int i;
  847. ++
  848. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  849. ++
  850. ++ /* Extra Authenticate-only data (always two AES blocks) */
  851. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  852. ++ aad[i] ^= b[i];
  853. ++ crypto_cipher_encrypt_one(tfm, b, aad);
  854. ++
  855. ++ aad += AES_BLOCK_SIZE;
  856. ++
  857. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  858. ++ aad[i] ^= b[i];
  859. ++ crypto_cipher_encrypt_one(tfm, a, aad);
  860. +
  861. +- char aead_req_data[sizeof(struct aead_request) +
  862. +- crypto_aead_reqsize(tfm)]
  863. +- __aligned(__alignof__(struct aead_request));
  864. +- struct aead_request *aead_req = (void *) aead_req_data;
  865. ++ /* Mask out bits from auth-only-b_0 */
  866. ++ b_0[0] &= 0x07;
  867. +
  868. +- memset(aead_req, 0, sizeof(aead_req_data));
  869. ++ /* S_0 is used to encrypt T (= MIC) */
  870. ++ b_0[14] = 0;
  871. ++ b_0[15] = 0;
  872. ++ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  873. ++}
  874. +
  875. +- sg_init_table(sg, 3);
  876. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  877. +- sg_set_buf(&sg[1], data, data_len);
  878. +- sg_set_buf(&sg[2], mic, mic_len);
  879. +
  880. +- aead_request_set_tfm(aead_req, tfm);
  881. +- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
  882. +- aead_request_set_ad(aead_req, sg[0].length);
  883. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  884. ++ u8 *data, size_t data_len, u8 *mic,
  885. ++ size_t mic_len)
  886. ++{
  887. ++ int i, j, last_len, num_blocks;
  888. ++ u8 b[AES_BLOCK_SIZE];
  889. ++ u8 s_0[AES_BLOCK_SIZE];
  890. ++ u8 e[AES_BLOCK_SIZE];
  891. ++ u8 *pos, *cpos;
  892. ++
  893. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  894. ++ last_len = data_len % AES_BLOCK_SIZE;
  895. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
  896. ++
  897. ++ /* Process payload blocks */
  898. ++ pos = data;
  899. ++ cpos = data;
  900. ++ for (j = 1; j <= num_blocks; j++) {
  901. ++ int blen = (j == num_blocks && last_len) ?
  902. ++ last_len : AES_BLOCK_SIZE;
  903. ++
  904. ++ /* Authentication followed by encryption */
  905. ++ for (i = 0; i < blen; i++)
  906. ++ b[i] ^= pos[i];
  907. ++ crypto_cipher_encrypt_one(tfm, b, b);
  908. ++
  909. ++ b_0[14] = (j >> 8) & 0xff;
  910. ++ b_0[15] = j & 0xff;
  911. ++ crypto_cipher_encrypt_one(tfm, e, b_0);
  912. ++ for (i = 0; i < blen; i++)
  913. ++ *cpos++ = *pos++ ^ e[i];
  914. ++ }
  915. +
  916. +- crypto_aead_encrypt(aead_req);
  917. ++ for (i = 0; i < mic_len; i++)
  918. ++ mic[i] = b[i] ^ s_0[i];
  919. + }
  920. +
  921. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  922. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  923. + u8 *data, size_t data_len, u8 *mic,
  924. + size_t mic_len)
  925. + {
  926. +- struct scatterlist sg[3];
  927. +- char aead_req_data[sizeof(struct aead_request) +
  928. +- crypto_aead_reqsize(tfm)]
  929. +- __aligned(__alignof__(struct aead_request));
  930. +- struct aead_request *aead_req = (void *) aead_req_data;
  931. +-
  932. +- if (data_len == 0)
  933. +- return -EINVAL;
  934. +-
  935. +- memset(aead_req, 0, sizeof(aead_req_data));
  936. +-
  937. +- sg_init_table(sg, 3);
  938. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  939. +- sg_set_buf(&sg[1], data, data_len);
  940. +- sg_set_buf(&sg[2], mic, mic_len);
  941. +-
  942. +- aead_request_set_tfm(aead_req, tfm);
  943. +- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
  944. +- aead_request_set_ad(aead_req, sg[0].length);
  945. ++ int i, j, last_len, num_blocks;
  946. ++ u8 *pos, *cpos;
  947. ++ u8 a[AES_BLOCK_SIZE];
  948. ++ u8 b[AES_BLOCK_SIZE];
  949. ++ u8 s_0[AES_BLOCK_SIZE];
  950. ++
  951. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  952. ++ last_len = data_len % AES_BLOCK_SIZE;
  953. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, a, b);
  954. ++
  955. ++ /* Process payload blocks */
  956. ++ cpos = data;
  957. ++ pos = data;
  958. ++ for (j = 1; j <= num_blocks; j++) {
  959. ++ int blen = (j == num_blocks && last_len) ?
  960. ++ last_len : AES_BLOCK_SIZE;
  961. ++
  962. ++ /* Decryption followed by authentication */
  963. ++ b_0[14] = (j >> 8) & 0xff;
  964. ++ b_0[15] = j & 0xff;
  965. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  966. ++ for (i = 0; i < blen; i++) {
  967. ++ *pos = *cpos++ ^ b[i];
  968. ++ a[i] ^= *pos++;
  969. ++ }
  970. ++ crypto_cipher_encrypt_one(tfm, a, a);
  971. ++ }
  972. ++
  973. ++ for (i = 0; i < mic_len; i++) {
  974. ++ if ((mic[i] ^ s_0[i]) != a[i])
  975. ++ return -1;
  976. ++ }
  977. +
  978. +- return crypto_aead_decrypt(aead_req);
  979. ++ return 0;
  980. + }
  981. +
  982. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  983. +- size_t key_len,
  984. +- size_t mic_len)
  985. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  986. ++ size_t key_len,
  987. ++ size_t mic_len)
  988. + {
  989. +- struct crypto_aead *tfm;
  990. +- int err;
  991. ++ struct crypto_cipher *tfm;
  992. +
  993. +- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  994. +- if (IS_ERR(tfm))
  995. +- return tfm;
  996. +-
  997. +- err = crypto_aead_setkey(tfm, key, key_len);
  998. +- if (err)
  999. +- goto free_aead;
  1000. +- err = crypto_aead_setauthsize(tfm, mic_len);
  1001. +- if (err)
  1002. +- goto free_aead;
  1003. ++ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  1004. ++ if (!IS_ERR(tfm))
  1005. ++ crypto_cipher_setkey(tfm, key, key_len);
  1006. +
  1007. + return tfm;
  1008. +-
  1009. +-free_aead:
  1010. +- crypto_free_aead(tfm);
  1011. +- return ERR_PTR(err);
  1012. + }
  1013. +
  1014. +-void ieee80211_aes_key_free(struct crypto_aead *tfm)
  1015. ++
  1016. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  1017. + {
  1018. +- crypto_free_aead(tfm);
  1019. ++ crypto_free_cipher(tfm);
  1020. + }
  1021. +--- a/net/mac80211/aes_ccm.h
  1022. ++++ b/net/mac80211/aes_ccm.h
  1023. +@@ -12,15 +12,15 @@
  1024. +
  1025. + #include <linux/crypto.h>
  1026. +
  1027. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  1028. +- size_t key_len,
  1029. +- size_t mic_len);
  1030. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  1031. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  1032. ++ size_t key_len,
  1033. ++ size_t mic_len);
  1034. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  1035. + u8 *data, size_t data_len, u8 *mic,
  1036. + size_t mic_len);
  1037. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  1038. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  1039. + u8 *data, size_t data_len, u8 *mic,
  1040. + size_t mic_len);
  1041. +-void ieee80211_aes_key_free(struct crypto_aead *tfm);
  1042. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  1043. +
  1044. + #endif /* AES_CCM_H */
  1045. +--- a/net/mac80211/aes_gcm.h
  1046. ++++ b/net/mac80211/aes_gcm.h
  1047. +@@ -11,12 +11,28 @@
  1048. +
  1049. + #include <linux/crypto.h>
  1050. +
  1051. +-void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  1052. +- u8 *data, size_t data_len, u8 *mic);
  1053. +-int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  1054. +- u8 *data, size_t data_len, u8 *mic);
  1055. +-struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  1056. +- size_t key_len);
  1057. +-void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  1058. ++static inline void
  1059. ++ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  1060. ++ u8 *data, size_t data_len, u8 *mic)
  1061. ++{
  1062. ++}
  1063. ++
  1064. ++static inline int
  1065. ++ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  1066. ++ u8 *data, size_t data_len, u8 *mic)
  1067. ++{
  1068. ++ return -EOPNOTSUPP;
  1069. ++}
  1070. ++
  1071. ++static inline struct crypto_aead *
  1072. ++ieee80211_aes_gcm_key_setup_encrypt(const u8 key[], size_t key_len)
  1073. ++{
  1074. ++ return NULL;
  1075. ++}
  1076. ++
  1077. ++static inline void
  1078. ++ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  1079. ++{
  1080. ++}
  1081. +
  1082. + #endif /* AES_GCM_H */
  1083. +--- a/net/mac80211/aes_gmac.h
  1084. ++++ b/net/mac80211/aes_gmac.h
  1085. +@@ -11,10 +11,22 @@
  1086. +
  1087. + #include <linux/crypto.h>
  1088. +
  1089. +-struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  1090. +- size_t key_len);
  1091. +-int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  1092. +- const u8 *data, size_t data_len, u8 *mic);
  1093. +-void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  1094. ++static inline struct crypto_aead *
  1095. ++ieee80211_aes_gmac_key_setup(const u8 key[], size_t key_len)
  1096. ++{
  1097. ++ return NULL;
  1098. ++}
  1099. ++
  1100. ++static inline int
  1101. ++ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  1102. ++ const u8 *data, size_t data_len, u8 *mic)
  1103. ++{
  1104. ++ return -EOPNOTSUPP;
  1105. ++}
  1106. ++
  1107. ++static inline void
  1108. ++ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  1109. ++{
  1110. ++}
  1111. +
  1112. + #endif /* AES_GMAC_H */
  1113. +--- a/net/mac80211/key.h
  1114. ++++ b/net/mac80211/key.h
  1115. +@@ -84,7 +84,7 @@ struct ieee80211_key {
  1116. + * Management frames.
  1117. + */
  1118. + u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  1119. +- struct crypto_aead *tfm;
  1120. ++ struct crypto_cipher *tfm;
  1121. + u32 replays; /* dot11RSNAStatsCCMPReplays */
  1122. + } ccmp;
  1123. + struct {
  1124. +--- a/net/mac80211/wpa.c
  1125. ++++ b/net/mac80211/wpa.c
  1126. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1127. + }
  1128. +
  1129. +
  1130. +-static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  1131. ++static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
  1132. ++ u16 data_len)
  1133. + {
  1134. + __le16 mask_fc;
  1135. + int a4_included, mgmt;
  1136. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  1137. + else
  1138. + qos_tid = 0;
  1139. +
  1140. +- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  1141. +- * mode authentication are not allowed to collide, yet both are derived
  1142. +- * from this vector b_0. We only set L := 1 here to indicate that the
  1143. +- * data size can be represented in (L+1) bytes. The CCM layer will take
  1144. +- * care of storing the data length in the top (L+1) bytes and setting
  1145. +- * and clearing the other bits as is required to derive the two IVs.
  1146. +- */
  1147. +- b_0[0] = 0x1;
  1148. ++ /* First block, b_0 */
  1149. ++ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  1150. +
  1151. + /* Nonce: Nonce Flags | A2 | PN
  1152. + * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  1153. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  1154. + b_0[1] = qos_tid | (mgmt << 4);
  1155. + memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  1156. + memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  1157. ++ /* l(m) */
  1158. ++ put_unaligned_be16(data_len, &b_0[14]);
  1159. +
  1160. + /* AAD (extra authenticate-only data) / masked 802.11 header
  1161. + * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  1162. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1163. + return 0;
  1164. +
  1165. + pos += IEEE80211_CCMP_HDR_LEN;
  1166. +- ccmp_special_blocks(skb, pn, b_0, aad);
  1167. ++ ccmp_special_blocks(skb, pn, b_0, aad, len);
  1168. + ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  1169. + skb_put(skb, mic_len), mic_len);
  1170. +
  1171. +@@ -531,7 +528,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1172. + u8 aad[2 * AES_BLOCK_SIZE];
  1173. + u8 b_0[AES_BLOCK_SIZE];
  1174. + /* hardware didn't decrypt/verify MIC */
  1175. +- ccmp_special_blocks(skb, pn, b_0, aad);
  1176. ++ ccmp_special_blocks(skb, pn, b_0, aad, data_len);
  1177. +
  1178. + if (ieee80211_aes_ccm_decrypt(
  1179. + key->u.ccmp.tfm, b_0, aad,
  1180. diff --git a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch b/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  1181. deleted file mode 100644
  1182. index ceca952..0000000
  1183. --- a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  1184. +++ /dev/null
  1185. @@ -1,2055 +0,0 @@
  1186. -This patch reverts the following commits from wireless-testing:
  1187. -
  1188. -8ade538bf39b1ee53418528fdacd36b8e65621b9
  1189. -56c52da2d554f081e8fce58ecbcf6a40c605b95b
  1190. -2b2ba0db1c820d04d5143452d70012cd44d7b578
  1191. -00b9cfa3ff38401bd70c34b250ca13e5ea347b4a
  1192. -4f031fa9f188b2b0641ac20087d9e16bcfb4e49d
  1193. -6e1ee5d2e9e411892b5d84e3ea93e3fc88ac786c
  1194. -30ef7ef9672d92ab2cac37f60a31955c118321e7
  1195. -f359d3fe832e49eeec2232b2af5a9e3aee6b4862 (only the changes in aes_cmac.{c,h})
  1196. -7ec7c4a9a686c608315739ab6a2b0527a240883c
  1197. ----
  1198. -
  1199. ---- a/include/linux/ieee80211.h
  1200. -+++ b/include/linux/ieee80211.h
  1201. -@@ -1017,15 +1017,6 @@ struct ieee80211_mmie {
  1202. - u8 mic[8];
  1203. - } __packed;
  1204. -
  1205. --/* Management MIC information element (IEEE 802.11w) for GMAC and CMAC-256 */
  1206. --struct ieee80211_mmie_16 {
  1207. -- u8 element_id;
  1208. -- u8 length;
  1209. -- __le16 key_id;
  1210. -- u8 sequence_number[6];
  1211. -- u8 mic[16];
  1212. --} __packed;
  1213. --
  1214. - struct ieee80211_vendor_ie {
  1215. - u8 element_id;
  1216. - u8 len;
  1217. ---- a/include/net/mac80211.h
  1218. -+++ b/include/net/mac80211.h
  1219. -@@ -1306,8 +1306,8 @@ struct ieee80211_vif *wdev_to_ieee80211_
  1220. - * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
  1221. - * that the key is pairwise rather then a shared key.
  1222. - * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a
  1223. -- * CCMP/GCMP key if it requires CCMP/GCMP encryption of management frames
  1224. -- * (MFP) to be done in software.
  1225. -+ * CCMP key if it requires CCMP encryption of management frames (MFP) to
  1226. -+ * be done in software.
  1227. - * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
  1228. - * if space should be prepared for the IV, but the IV
  1229. - * itself should not be generated. Do not set together with
  1230. -@@ -1322,7 +1322,7 @@ struct ieee80211_vif *wdev_to_ieee80211_
  1231. - * RX, if your crypto engine can't deal with TX you can also set the
  1232. - * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
  1233. - * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
  1234. -- * driver for a CCMP/GCMP key to indicate that is requires IV generation
  1235. -+ * driver for a CCMP key to indicate that is requires IV generation
  1236. - * only for managment frames (MFP).
  1237. - * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the
  1238. - * driver for a key to indicate that sufficient tailroom must always
  1239. -@@ -4112,10 +4112,6 @@ void ieee80211_aes_cmac_calculate_k1_k2(
  1240. - * reverse order than in packet)
  1241. - * @aes_cmac: PN data, most significant byte first (big endian,
  1242. - * reverse order than in packet)
  1243. -- * @aes_gmac: PN data, most significant byte first (big endian,
  1244. -- * reverse order than in packet)
  1245. -- * @gcmp: PN data, most significant byte first (big endian,
  1246. -- * reverse order than in packet)
  1247. - */
  1248. - struct ieee80211_key_seq {
  1249. - union {
  1250. -@@ -4129,12 +4125,6 @@ struct ieee80211_key_seq {
  1251. - struct {
  1252. - u8 pn[6];
  1253. - } aes_cmac;
  1254. -- struct {
  1255. -- u8 pn[6];
  1256. -- } aes_gmac;
  1257. -- struct {
  1258. -- u8 pn[6];
  1259. -- } gcmp;
  1260. - };
  1261. - };
  1262. -
  1263. -@@ -4159,7 +4149,7 @@ void ieee80211_get_key_tx_seq(struct iee
  1264. - * ieee80211_get_key_rx_seq - get key RX sequence counter
  1265. - *
  1266. - * @keyconf: the parameter passed with the set key
  1267. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  1268. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  1269. - * the value on TID 0 is also used for non-QoS frames. For
  1270. - * CMAC, only TID 0 is valid.
  1271. - * @seq: buffer to receive the sequence data
  1272. -@@ -4195,7 +4185,7 @@ void ieee80211_set_key_tx_seq(struct iee
  1273. - * ieee80211_set_key_rx_seq - set key RX sequence counter
  1274. - *
  1275. - * @keyconf: the parameter passed with the set key
  1276. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  1277. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  1278. - * the value on TID 0 is also used for non-QoS frames. For
  1279. - * CMAC, only TID 0 is valid.
  1280. - * @seq: new sequence data
  1281. ---- a/net/mac80211/Kconfig
  1282. -+++ b/net/mac80211/Kconfig
  1283. -@@ -5,8 +5,6 @@ config MAC80211
  1284. - depends on CRYPTO
  1285. - depends on CRYPTO_ARC4
  1286. - depends on CRYPTO_AES
  1287. -- select BPAUTO_CRYPTO_CCM
  1288. -- depends on CRYPTO_GCM
  1289. - depends on CRC32
  1290. - select BPAUTO_AVERAGE
  1291. - ---help---
  1292. ---- a/net/mac80211/Makefile
  1293. -+++ b/net/mac80211/Makefile
  1294. -@@ -15,9 +15,7 @@ mac80211-y := \
  1295. - michael.o \
  1296. - tkip.o \
  1297. - aes_ccm.o \
  1298. -- aes_gcm.o \
  1299. - aes_cmac.o \
  1300. -- aes_gmac.o \
  1301. - cfg.o \
  1302. - ethtool.o \
  1303. - rx.o \
  1304. ---- a/net/mac80211/aes_ccm.c
  1305. -+++ b/net/mac80211/aes_ccm.c
  1306. -@@ -2,8 +2,6 @@
  1307. - * Copyright 2003-2004, Instant802 Networks, Inc.
  1308. - * Copyright 2005-2006, Devicescape Software, Inc.
  1309. - *
  1310. -- * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
  1311. -- *
  1312. - * This program is free software; you can redistribute it and/or modify
  1313. - * it under the terms of the GNU General Public License version 2 as
  1314. - * published by the Free Software Foundation.
  1315. -@@ -19,82 +17,134 @@
  1316. - #include "key.h"
  1317. - #include "aes_ccm.h"
  1318. -
  1319. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  1320. -- u8 *data, size_t data_len, u8 *mic,
  1321. -- size_t mic_len)
  1322. -+static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a)
  1323. -+{
  1324. -+ int i;
  1325. -+ u8 *b_0, *aad, *b, *s_0;
  1326. -+
  1327. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  1328. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  1329. -+ b = scratch;
  1330. -+ s_0 = scratch + AES_BLOCK_SIZE;
  1331. -+
  1332. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  1333. -+
  1334. -+ /* Extra Authenticate-only data (always two AES blocks) */
  1335. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  1336. -+ aad[i] ^= b[i];
  1337. -+ crypto_cipher_encrypt_one(tfm, b, aad);
  1338. -+
  1339. -+ aad += AES_BLOCK_SIZE;
  1340. -+
  1341. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  1342. -+ aad[i] ^= b[i];
  1343. -+ crypto_cipher_encrypt_one(tfm, a, aad);
  1344. -+
  1345. -+ /* Mask out bits from auth-only-b_0 */
  1346. -+ b_0[0] &= 0x07;
  1347. -+
  1348. -+ /* S_0 is used to encrypt T (= MIC) */
  1349. -+ b_0[14] = 0;
  1350. -+ b_0[15] = 0;
  1351. -+ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  1352. -+}
  1353. -+
  1354. -+
  1355. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  1356. -+ u8 *data, size_t data_len,
  1357. -+ u8 *cdata, u8 *mic)
  1358. - {
  1359. -- struct scatterlist assoc, pt, ct[2];
  1360. -+ int i, j, last_len, num_blocks;
  1361. -+ u8 *pos, *cpos, *b, *s_0, *e, *b_0;
  1362. -
  1363. -- char aead_req_data[sizeof(struct aead_request) +
  1364. -- crypto_aead_reqsize(tfm)]
  1365. -- __aligned(__alignof__(struct aead_request));
  1366. -- struct aead_request *aead_req = (void *) aead_req_data;
  1367. --
  1368. -- memset(aead_req, 0, sizeof(aead_req_data));
  1369. --
  1370. -- sg_init_one(&pt, data, data_len);
  1371. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  1372. -- sg_init_table(ct, 2);
  1373. -- sg_set_buf(&ct[0], data, data_len);
  1374. -- sg_set_buf(&ct[1], mic, mic_len);
  1375. --
  1376. -- aead_request_set_tfm(aead_req, tfm);
  1377. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  1378. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, b_0);
  1379. -+ b = scratch;
  1380. -+ s_0 = scratch + AES_BLOCK_SIZE;
  1381. -+ e = scratch + 2 * AES_BLOCK_SIZE;
  1382. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  1383. -+
  1384. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  1385. -+ last_len = data_len % AES_BLOCK_SIZE;
  1386. -+ aes_ccm_prepare(tfm, scratch, b);
  1387. -+
  1388. -+ /* Process payload blocks */
  1389. -+ pos = data;
  1390. -+ cpos = cdata;
  1391. -+ for (j = 1; j <= num_blocks; j++) {
  1392. -+ int blen = (j == num_blocks && last_len) ?
  1393. -+ last_len : AES_BLOCK_SIZE;
  1394. -+
  1395. -+ /* Authentication followed by encryption */
  1396. -+ for (i = 0; i < blen; i++)
  1397. -+ b[i] ^= pos[i];
  1398. -+ crypto_cipher_encrypt_one(tfm, b, b);
  1399. -+
  1400. -+ b_0[14] = (j >> 8) & 0xff;
  1401. -+ b_0[15] = j & 0xff;
  1402. -+ crypto_cipher_encrypt_one(tfm, e, b_0);
  1403. -+ for (i = 0; i < blen; i++)
  1404. -+ *cpos++ = *pos++ ^ e[i];
  1405. -+ }
  1406. -
  1407. -- crypto_aead_encrypt(aead_req);
  1408. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++)
  1409. -+ mic[i] = b[i] ^ s_0[i];
  1410. - }
  1411. -
  1412. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  1413. -- u8 *data, size_t data_len, u8 *mic,
  1414. -- size_t mic_len)
  1415. -+
  1416. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  1417. -+ u8 *cdata, size_t data_len, u8 *mic, u8 *data)
  1418. - {
  1419. -- struct scatterlist assoc, pt, ct[2];
  1420. -- char aead_req_data[sizeof(struct aead_request) +
  1421. -- crypto_aead_reqsize(tfm)]
  1422. -- __aligned(__alignof__(struct aead_request));
  1423. -- struct aead_request *aead_req = (void *) aead_req_data;
  1424. --
  1425. -- if (data_len == 0)
  1426. -- return -EINVAL;
  1427. --
  1428. -- memset(aead_req, 0, sizeof(aead_req_data));
  1429. --
  1430. -- sg_init_one(&pt, data, data_len);
  1431. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  1432. -- sg_init_table(ct, 2);
  1433. -- sg_set_buf(&ct[0], data, data_len);
  1434. -- sg_set_buf(&ct[1], mic, mic_len);
  1435. --
  1436. -- aead_request_set_tfm(aead_req, tfm);
  1437. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  1438. -- aead_request_set_crypt(aead_req, ct, &pt, data_len + mic_len, b_0);
  1439. -+ int i, j, last_len, num_blocks;
  1440. -+ u8 *pos, *cpos, *b, *s_0, *a, *b_0;
  1441. -+
  1442. -+ b = scratch;
  1443. -+ s_0 = scratch + AES_BLOCK_SIZE;
  1444. -+ a = scratch + 2 * AES_BLOCK_SIZE;
  1445. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  1446. -+
  1447. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  1448. -+ last_len = data_len % AES_BLOCK_SIZE;
  1449. -+ aes_ccm_prepare(tfm, scratch, a);
  1450. -+
  1451. -+ /* Process payload blocks */
  1452. -+ cpos = cdata;
  1453. -+ pos = data;
  1454. -+ for (j = 1; j <= num_blocks; j++) {
  1455. -+ int blen = (j == num_blocks && last_len) ?
  1456. -+ last_len : AES_BLOCK_SIZE;
  1457. -+
  1458. -+ /* Decryption followed by authentication */
  1459. -+ b_0[14] = (j >> 8) & 0xff;
  1460. -+ b_0[15] = j & 0xff;
  1461. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  1462. -+ for (i = 0; i < blen; i++) {
  1463. -+ *pos = *cpos++ ^ b[i];
  1464. -+ a[i] ^= *pos++;
  1465. -+ }
  1466. -+ crypto_cipher_encrypt_one(tfm, a, a);
  1467. -+ }
  1468. -+
  1469. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) {
  1470. -+ if ((mic[i] ^ s_0[i]) != a[i])
  1471. -+ return -1;
  1472. -+ }
  1473. -
  1474. -- return crypto_aead_decrypt(aead_req);
  1475. -+ return 0;
  1476. - }
  1477. -
  1478. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  1479. -- size_t key_len,
  1480. -- size_t mic_len)
  1481. -+
  1482. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])
  1483. - {
  1484. -- struct crypto_aead *tfm;
  1485. -- int err;
  1486. -+ struct crypto_cipher *tfm;
  1487. -
  1488. -- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  1489. -- if (IS_ERR(tfm))
  1490. -- return tfm;
  1491. --
  1492. -- err = crypto_aead_setkey(tfm, key, key_len);
  1493. -- if (!err)
  1494. -- err = crypto_aead_setauthsize(tfm, mic_len);
  1495. -- if (!err)
  1496. -- return tfm;
  1497. -+ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  1498. -+ if (!IS_ERR(tfm))
  1499. -+ crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
  1500. -
  1501. -- crypto_free_aead(tfm);
  1502. -- return ERR_PTR(err);
  1503. -+ return tfm;
  1504. - }
  1505. -
  1506. --void ieee80211_aes_key_free(struct crypto_aead *tfm)
  1507. -+
  1508. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  1509. - {
  1510. -- crypto_free_aead(tfm);
  1511. -+ crypto_free_cipher(tfm);
  1512. - }
  1513. ---- a/net/mac80211/aes_ccm.h
  1514. -+++ b/net/mac80211/aes_ccm.h
  1515. -@@ -12,15 +12,13 @@
  1516. -
  1517. - #include <linux/crypto.h>
  1518. -
  1519. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  1520. -- size_t key_len,
  1521. -- size_t mic_len);
  1522. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  1523. -- u8 *data, size_t data_len, u8 *mic,
  1524. -- size_t mic_len);
  1525. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  1526. -- u8 *data, size_t data_len, u8 *mic,
  1527. -- size_t mic_len);
  1528. --void ieee80211_aes_key_free(struct crypto_aead *tfm);
  1529. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]);
  1530. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  1531. -+ u8 *data, size_t data_len,
  1532. -+ u8 *cdata, u8 *mic);
  1533. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  1534. -+ u8 *cdata, size_t data_len,
  1535. -+ u8 *mic, u8 *data);
  1536. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  1537. -
  1538. - #endif /* AES_CCM_H */
  1539. ---- a/net/mac80211/aes_cmac.c
  1540. -+++ b/net/mac80211/aes_cmac.c
  1541. -@@ -18,8 +18,8 @@
  1542. - #include "key.h"
  1543. - #include "aes_cmac.h"
  1544. -
  1545. -+#define AES_CMAC_KEY_LEN 16
  1546. - #define CMAC_TLEN 8 /* CMAC TLen = 64 bits (8 octets) */
  1547. --#define CMAC_TLEN_256 16 /* CMAC TLen = 128 bits (16 octets) */
  1548. - #define AAD_LEN 20
  1549. -
  1550. -
  1551. -@@ -35,9 +35,9 @@ static void gf_mulx(u8 *pad)
  1552. - pad[AES_BLOCK_SIZE - 1] ^= 0x87;
  1553. - }
  1554. -
  1555. --static void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  1556. -- const u8 *addr[], const size_t *len, u8 *mac,
  1557. -- size_t mac_len)
  1558. -+
  1559. -+static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  1560. -+ const u8 *addr[], const size_t *len, u8 *mac)
  1561. - {
  1562. - u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
  1563. - const u8 *pos, *end;
  1564. -@@ -88,7 +88,7 @@ static void aes_cmac_vector(struct crypt
  1565. - for (i = 0; i < AES_BLOCK_SIZE; i++)
  1566. - pad[i] ^= cbc[i];
  1567. - crypto_cipher_encrypt_one(tfm, pad, pad);
  1568. -- memcpy(mac, pad, mac_len);
  1569. -+ memcpy(mac, pad, CMAC_TLEN);
  1570. - }
  1571. -
  1572. -
  1573. -@@ -107,35 +107,17 @@ void ieee80211_aes_cmac(struct crypto_ci
  1574. - addr[2] = zero;
  1575. - len[2] = CMAC_TLEN;
  1576. -
  1577. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN);
  1578. -+ aes_128_cmac_vector(tfm, 3, addr, len, mic);
  1579. - }
  1580. -
  1581. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  1582. -- const u8 *data, size_t data_len, u8 *mic)
  1583. --{
  1584. -- const u8 *addr[3];
  1585. -- size_t len[3];
  1586. -- u8 zero[CMAC_TLEN_256];
  1587. --
  1588. -- memset(zero, 0, CMAC_TLEN_256);
  1589. -- addr[0] = aad;
  1590. -- len[0] = AAD_LEN;
  1591. -- addr[1] = data;
  1592. -- len[1] = data_len - CMAC_TLEN_256;
  1593. -- addr[2] = zero;
  1594. -- len[2] = CMAC_TLEN_256;
  1595. --
  1596. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN_256);
  1597. --}
  1598. -
  1599. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  1600. -- size_t key_len)
  1601. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[])
  1602. - {
  1603. - struct crypto_cipher *tfm;
  1604. -
  1605. - tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  1606. - if (!IS_ERR(tfm))
  1607. -- crypto_cipher_setkey(tfm, key, key_len);
  1608. -+ crypto_cipher_setkey(tfm, key, AES_CMAC_KEY_LEN);
  1609. -
  1610. - return tfm;
  1611. - }
  1612. ---- a/net/mac80211/aes_cmac.h
  1613. -+++ b/net/mac80211/aes_cmac.h
  1614. -@@ -11,12 +11,9 @@
  1615. -
  1616. - #include <linux/crypto.h>
  1617. -
  1618. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  1619. -- size_t key_len);
  1620. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]);
  1621. - void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,
  1622. - const u8 *data, size_t data_len, u8 *mic);
  1623. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  1624. -- const u8 *data, size_t data_len, u8 *mic);
  1625. - void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm);
  1626. -
  1627. - #endif /* AES_CMAC_H */
  1628. ---- a/net/mac80211/aes_gcm.c
  1629. -+++ /dev/null
  1630. -@@ -1,95 +0,0 @@
  1631. --/*
  1632. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  1633. -- *
  1634. -- * This program is free software; you can redistribute it and/or modify
  1635. -- * it under the terms of the GNU General Public License version 2 as
  1636. -- * published by the Free Software Foundation.
  1637. -- */
  1638. --
  1639. --#include <linux/kernel.h>
  1640. --#include <linux/types.h>
  1641. --#include <linux/crypto.h>
  1642. --#include <linux/err.h>
  1643. --#include <crypto/aes.h>
  1644. --
  1645. --#include <net/mac80211.h>
  1646. --#include "key.h"
  1647. --#include "aes_gcm.h"
  1648. --
  1649. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  1650. -- u8 *data, size_t data_len, u8 *mic)
  1651. --{
  1652. -- struct scatterlist assoc, pt, ct[2];
  1653. --
  1654. -- char aead_req_data[sizeof(struct aead_request) +
  1655. -- crypto_aead_reqsize(tfm)]
  1656. -- __aligned(__alignof__(struct aead_request));
  1657. -- struct aead_request *aead_req = (void *)aead_req_data;
  1658. --
  1659. -- memset(aead_req, 0, sizeof(aead_req_data));
  1660. --
  1661. -- sg_init_one(&pt, data, data_len);
  1662. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  1663. -- sg_init_table(ct, 2);
  1664. -- sg_set_buf(&ct[0], data, data_len);
  1665. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  1666. --
  1667. -- aead_request_set_tfm(aead_req, tfm);
  1668. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  1669. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, j_0);
  1670. --
  1671. -- crypto_aead_encrypt(aead_req);
  1672. --}
  1673. --
  1674. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  1675. -- u8 *data, size_t data_len, u8 *mic)
  1676. --{
  1677. -- struct scatterlist assoc, pt, ct[2];
  1678. -- char aead_req_data[sizeof(struct aead_request) +
  1679. -- crypto_aead_reqsize(tfm)]
  1680. -- __aligned(__alignof__(struct aead_request));
  1681. -- struct aead_request *aead_req = (void *)aead_req_data;
  1682. --
  1683. -- if (data_len == 0)
  1684. -- return -EINVAL;
  1685. --
  1686. -- memset(aead_req, 0, sizeof(aead_req_data));
  1687. --
  1688. -- sg_init_one(&pt, data, data_len);
  1689. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  1690. -- sg_init_table(ct, 2);
  1691. -- sg_set_buf(&ct[0], data, data_len);
  1692. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  1693. --
  1694. -- aead_request_set_tfm(aead_req, tfm);
  1695. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  1696. -- aead_request_set_crypt(aead_req, ct, &pt,
  1697. -- data_len + IEEE80211_GCMP_MIC_LEN, j_0);
  1698. --
  1699. -- return crypto_aead_decrypt(aead_req);
  1700. --}
  1701. --
  1702. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  1703. -- size_t key_len)
  1704. --{
  1705. -- struct crypto_aead *tfm;
  1706. -- int err;
  1707. --
  1708. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  1709. -- if (IS_ERR(tfm))
  1710. -- return tfm;
  1711. --
  1712. -- err = crypto_aead_setkey(tfm, key, key_len);
  1713. -- if (!err)
  1714. -- err = crypto_aead_setauthsize(tfm, IEEE80211_GCMP_MIC_LEN);
  1715. -- if (!err)
  1716. -- return tfm;
  1717. --
  1718. -- crypto_free_aead(tfm);
  1719. -- return ERR_PTR(err);
  1720. --}
  1721. --
  1722. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  1723. --{
  1724. -- crypto_free_aead(tfm);
  1725. --}
  1726. ---- a/net/mac80211/aes_gcm.h
  1727. -+++ /dev/null
  1728. -@@ -1,22 +0,0 @@
  1729. --/*
  1730. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  1731. -- *
  1732. -- * This program is free software; you can redistribute it and/or modify
  1733. -- * it under the terms of the GNU General Public License version 2 as
  1734. -- * published by the Free Software Foundation.
  1735. -- */
  1736. --
  1737. --#ifndef AES_GCM_H
  1738. --#define AES_GCM_H
  1739. --
  1740. --#include <linux/crypto.h>
  1741. --
  1742. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  1743. -- u8 *data, size_t data_len, u8 *mic);
  1744. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  1745. -- u8 *data, size_t data_len, u8 *mic);
  1746. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  1747. -- size_t key_len);
  1748. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  1749. --
  1750. --#endif /* AES_GCM_H */
  1751. ---- a/net/mac80211/aes_gmac.c
  1752. -+++ /dev/null
  1753. -@@ -1,84 +0,0 @@
  1754. --/*
  1755. -- * AES-GMAC for IEEE 802.11 BIP-GMAC-128 and BIP-GMAC-256
  1756. -- * Copyright 2015, Qualcomm Atheros, Inc.
  1757. -- *
  1758. -- * This program is free software; you can redistribute it and/or modify
  1759. -- * it under the terms of the GNU General Public License version 2 as
  1760. -- * published by the Free Software Foundation.
  1761. -- */
  1762. --
  1763. --#include <linux/kernel.h>
  1764. --#include <linux/types.h>
  1765. --#include <linux/crypto.h>
  1766. --#include <linux/err.h>
  1767. --#include <crypto/aes.h>
  1768. --
  1769. --#include <net/mac80211.h>
  1770. --#include "key.h"
  1771. --#include "aes_gmac.h"
  1772. --
  1773. --#define GMAC_MIC_LEN 16
  1774. --#define GMAC_NONCE_LEN 12
  1775. --#define AAD_LEN 20
  1776. --
  1777. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  1778. -- const u8 *data, size_t data_len, u8 *mic)
  1779. --{
  1780. -- struct scatterlist sg[3], ct[1];
  1781. -- char aead_req_data[sizeof(struct aead_request) +
  1782. -- crypto_aead_reqsize(tfm)]
  1783. -- __aligned(__alignof__(struct aead_request));
  1784. -- struct aead_request *aead_req = (void *)aead_req_data;
  1785. -- u8 zero[GMAC_MIC_LEN], iv[AES_BLOCK_SIZE];
  1786. --
  1787. -- if (data_len < GMAC_MIC_LEN)
  1788. -- return -EINVAL;
  1789. --
  1790. -- memset(aead_req, 0, sizeof(aead_req_data));
  1791. --
  1792. -- memset(zero, 0, GMAC_MIC_LEN);
  1793. -- sg_init_table(sg, 3);
  1794. -- sg_set_buf(&sg[0], aad, AAD_LEN);
  1795. -- sg_set_buf(&sg[1], data, data_len - GMAC_MIC_LEN);
  1796. -- sg_set_buf(&sg[2], zero, GMAC_MIC_LEN);
  1797. --
  1798. -- memcpy(iv, nonce, GMAC_NONCE_LEN);
  1799. -- memset(iv + GMAC_NONCE_LEN, 0, sizeof(iv) - GMAC_NONCE_LEN);
  1800. -- iv[AES_BLOCK_SIZE - 1] = 0x01;
  1801. --
  1802. -- sg_init_table(ct, 1);
  1803. -- sg_set_buf(&ct[0], mic, GMAC_MIC_LEN);
  1804. --
  1805. -- aead_request_set_tfm(aead_req, tfm);
  1806. -- aead_request_set_assoc(aead_req, sg, AAD_LEN + data_len);
  1807. -- aead_request_set_crypt(aead_req, NULL, ct, 0, iv);
  1808. --
  1809. -- crypto_aead_encrypt(aead_req);
  1810. --
  1811. -- return 0;
  1812. --}
  1813. --
  1814. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  1815. -- size_t key_len)
  1816. --{
  1817. -- struct crypto_aead *tfm;
  1818. -- int err;
  1819. --
  1820. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  1821. -- if (IS_ERR(tfm))
  1822. -- return tfm;
  1823. --
  1824. -- err = crypto_aead_setkey(tfm, key, key_len);
  1825. -- if (!err)
  1826. -- return tfm;
  1827. -- if (!err)
  1828. -- err = crypto_aead_setauthsize(tfm, GMAC_MIC_LEN);
  1829. --
  1830. -- crypto_free_aead(tfm);
  1831. -- return ERR_PTR(err);
  1832. --}
  1833. --
  1834. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  1835. --{
  1836. -- crypto_free_aead(tfm);
  1837. --}
  1838. ---- a/net/mac80211/aes_gmac.h
  1839. -+++ /dev/null
  1840. -@@ -1,20 +0,0 @@
  1841. --/*
  1842. -- * Copyright 2015, Qualcomm Atheros, Inc.
  1843. -- *
  1844. -- * This program is free software; you can redistribute it and/or modify
  1845. -- * it under the terms of the GNU General Public License version 2 as
  1846. -- * published by the Free Software Foundation.
  1847. -- */
  1848. --
  1849. --#ifndef AES_GMAC_H
  1850. --#define AES_GMAC_H
  1851. --
  1852. --#include <linux/crypto.h>
  1853. --
  1854. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  1855. -- size_t key_len);
  1856. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  1857. -- const u8 *data, size_t data_len, u8 *mic);
  1858. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  1859. --
  1860. --#endif /* AES_GMAC_H */
  1861. ---- a/net/mac80211/cfg.c
  1862. -+++ b/net/mac80211/cfg.c
  1863. -@@ -162,13 +162,8 @@ static int ieee80211_add_key(struct wiph
  1864. - return -EINVAL;
  1865. - break;
  1866. - case WLAN_CIPHER_SUITE_CCMP:
  1867. -- case WLAN_CIPHER_SUITE_CCMP_256:
  1868. - case WLAN_CIPHER_SUITE_AES_CMAC:
  1869. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  1870. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  1871. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  1872. - case WLAN_CIPHER_SUITE_GCMP:
  1873. -- case WLAN_CIPHER_SUITE_GCMP_256:
  1874. - break;
  1875. - default:
  1876. - cs = ieee80211_cs_get(local, params->cipher, sdata->vif.type);
  1877. -@@ -353,7 +348,6 @@ static int ieee80211_get_key(struct wiph
  1878. - params.seq_len = 6;
  1879. - break;
  1880. - case WLAN_CIPHER_SUITE_CCMP:
  1881. -- case WLAN_CIPHER_SUITE_CCMP_256:
  1882. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  1883. - seq[0] = pn64;
  1884. - seq[1] = pn64 >> 8;
  1885. -@@ -365,35 +359,10 @@ static int ieee80211_get_key(struct wiph
  1886. - params.seq_len = 6;
  1887. - break;
  1888. - case WLAN_CIPHER_SUITE_AES_CMAC:
  1889. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  1890. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  1891. - seq[0] = pn64;
  1892. - seq[1] = pn64 >> 8;
  1893. - seq[2] = pn64 >> 16;
  1894. -- seq[3] = pn64 >> 24;
  1895. -- seq[4] = pn64 >> 32;
  1896. -- seq[5] = pn64 >> 40;
  1897. -- params.seq = seq;
  1898. -- params.seq_len = 6;
  1899. -- break;
  1900. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  1901. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  1902. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  1903. -- seq[0] = pn64;
  1904. -- seq[1] = pn64 >> 8;
  1905. -- seq[2] = pn64 >> 16;
  1906. -- seq[3] = pn64 >> 24;
  1907. -- seq[4] = pn64 >> 32;
  1908. -- seq[5] = pn64 >> 40;
  1909. -- params.seq = seq;
  1910. -- params.seq_len = 6;
  1911. -- break;
  1912. -- case WLAN_CIPHER_SUITE_GCMP:
  1913. -- case WLAN_CIPHER_SUITE_GCMP_256:
  1914. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  1915. -- seq[0] = pn64;
  1916. -- seq[1] = pn64 >> 8;
  1917. -- seq[2] = pn64 >> 16;
  1918. - seq[3] = pn64 >> 24;
  1919. - seq[4] = pn64 >> 32;
  1920. - seq[5] = pn64 >> 40;
  1921. ---- a/net/mac80211/debugfs_key.c
  1922. -+++ b/net/mac80211/debugfs_key.c
  1923. -@@ -94,33 +94,17 @@ static ssize_t key_tx_spec_read(struct f
  1924. - key->u.tkip.tx.iv16);
  1925. - break;
  1926. - case WLAN_CIPHER_SUITE_CCMP:
  1927. -- case WLAN_CIPHER_SUITE_CCMP_256:
  1928. - pn = atomic64_read(&key->u.ccmp.tx_pn);
  1929. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  1930. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  1931. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  1932. - break;
  1933. - case WLAN_CIPHER_SUITE_AES_CMAC:
  1934. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  1935. - pn = atomic64_read(&key->u.aes_cmac.tx_pn);
  1936. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  1937. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  1938. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  1939. - break;
  1940. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  1941. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  1942. -- pn = atomic64_read(&key->u.aes_gmac.tx_pn);
  1943. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  1944. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  1945. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  1946. -- break;
  1947. -- case WLAN_CIPHER_SUITE_GCMP:
  1948. -- case WLAN_CIPHER_SUITE_GCMP_256:
  1949. -- pn = atomic64_read(&key->u.gcmp.tx_pn);
  1950. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  1951. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  1952. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  1953. -- break;
  1954. - default:
  1955. - return 0;
  1956. - }
  1957. -@@ -150,7 +134,6 @@ static ssize_t key_rx_spec_read(struct f
  1958. - len = p - buf;
  1959. - break;
  1960. - case WLAN_CIPHER_SUITE_CCMP:
  1961. -- case WLAN_CIPHER_SUITE_CCMP_256:
  1962. - for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  1963. - rpn = key->u.ccmp.rx_pn[i];
  1964. - p += scnprintf(p, sizeof(buf)+buf-p,
  1965. -@@ -161,7 +144,6 @@ static ssize_t key_rx_spec_read(struct f
  1966. - len = p - buf;
  1967. - break;
  1968. - case WLAN_CIPHER_SUITE_AES_CMAC:
  1969. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  1970. - rpn = key->u.aes_cmac.rx_pn;
  1971. - p += scnprintf(p, sizeof(buf)+buf-p,
  1972. - "%02x%02x%02x%02x%02x%02x\n",
  1973. -@@ -169,26 +151,6 @@ static ssize_t key_rx_spec_read(struct f
  1974. - rpn[3], rpn[4], rpn[5]);
  1975. - len = p - buf;
  1976. - break;
  1977. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  1978. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  1979. -- rpn = key->u.aes_gmac.rx_pn;
  1980. -- p += scnprintf(p, sizeof(buf)+buf-p,
  1981. -- "%02x%02x%02x%02x%02x%02x\n",
  1982. -- rpn[0], rpn[1], rpn[2],
  1983. -- rpn[3], rpn[4], rpn[5]);
  1984. -- len = p - buf;
  1985. -- break;
  1986. -- case WLAN_CIPHER_SUITE_GCMP:
  1987. -- case WLAN_CIPHER_SUITE_GCMP_256:
  1988. -- for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  1989. -- rpn = key->u.gcmp.rx_pn[i];
  1990. -- p += scnprintf(p, sizeof(buf)+buf-p,
  1991. -- "%02x%02x%02x%02x%02x%02x\n",
  1992. -- rpn[0], rpn[1], rpn[2],
  1993. -- rpn[3], rpn[4], rpn[5]);
  1994. -- }
  1995. -- len = p - buf;
  1996. -- break;
  1997. - default:
  1998. - return 0;
  1999. - }
  2000. -@@ -205,23 +167,12 @@ static ssize_t key_replays_read(struct f
  2001. -
  2002. - switch (key->conf.cipher) {
  2003. - case WLAN_CIPHER_SUITE_CCMP:
  2004. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2005. - len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays);
  2006. - break;
  2007. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2008. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2009. - len = scnprintf(buf, sizeof(buf), "%u\n",
  2010. - key->u.aes_cmac.replays);
  2011. - break;
  2012. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2013. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2014. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  2015. -- key->u.aes_gmac.replays);
  2016. -- break;
  2017. -- case WLAN_CIPHER_SUITE_GCMP:
  2018. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2019. -- len = scnprintf(buf, sizeof(buf), "%u\n", key->u.gcmp.replays);
  2020. -- break;
  2021. - default:
  2022. - return 0;
  2023. - }
  2024. -@@ -238,15 +189,9 @@ static ssize_t key_icverrors_read(struct
  2025. -
  2026. - switch (key->conf.cipher) {
  2027. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2028. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2029. - len = scnprintf(buf, sizeof(buf), "%u\n",
  2030. - key->u.aes_cmac.icverrors);
  2031. - break;
  2032. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2033. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2034. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  2035. -- key->u.aes_gmac.icverrors);
  2036. -- break;
  2037. - default:
  2038. - return 0;
  2039. - }
  2040. ---- a/net/mac80211/key.c
  2041. -+++ b/net/mac80211/key.c
  2042. -@@ -24,8 +24,6 @@
  2043. - #include "debugfs_key.h"
  2044. - #include "aes_ccm.h"
  2045. - #include "aes_cmac.h"
  2046. --#include "aes_gmac.h"
  2047. --#include "aes_gcm.h"
  2048. -
  2049. -
  2050. - /**
  2051. -@@ -164,13 +162,7 @@ static int ieee80211_key_enable_hw_accel
  2052. - case WLAN_CIPHER_SUITE_WEP104:
  2053. - case WLAN_CIPHER_SUITE_TKIP:
  2054. - case WLAN_CIPHER_SUITE_CCMP:
  2055. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2056. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2057. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2058. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2059. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2060. -- case WLAN_CIPHER_SUITE_GCMP:
  2061. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2062. - /* all of these we can do in software - if driver can */
  2063. - if (ret == 1)
  2064. - return 0;
  2065. -@@ -394,26 +386,7 @@ ieee80211_key_alloc(u32 cipher, int idx,
  2066. - * Initialize AES key state here as an optimization so that
  2067. - * it does not need to be initialized for every packet.
  2068. - */
  2069. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  2070. -- key_data, key_len, IEEE80211_CCMP_MIC_LEN);
  2071. -- if (IS_ERR(key->u.ccmp.tfm)) {
  2072. -- err = PTR_ERR(key->u.ccmp.tfm);
  2073. -- kfree(key);
  2074. -- return ERR_PTR(err);
  2075. -- }
  2076. -- break;
  2077. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2078. -- key->conf.iv_len = IEEE80211_CCMP_256_HDR_LEN;
  2079. -- key->conf.icv_len = IEEE80211_CCMP_256_MIC_LEN;
  2080. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  2081. -- for (j = 0; j < IEEE80211_CCMP_256_PN_LEN; j++)
  2082. -- key->u.ccmp.rx_pn[i][j] =
  2083. -- seq[IEEE80211_CCMP_256_PN_LEN - j - 1];
  2084. -- /* Initialize AES key state here as an optimization so that
  2085. -- * it does not need to be initialized for every packet.
  2086. -- */
  2087. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  2088. -- key_data, key_len, IEEE80211_CCMP_256_MIC_LEN);
  2089. -+ key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(key_data);
  2090. - if (IS_ERR(key->u.ccmp.tfm)) {
  2091. - err = PTR_ERR(key->u.ccmp.tfm);
  2092. - kfree(key);
  2093. -@@ -421,12 +394,8 @@ ieee80211_key_alloc(u32 cipher, int idx,
  2094. - }
  2095. - break;
  2096. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2097. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2098. - key->conf.iv_len = 0;
  2099. -- if (cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  2100. -- key->conf.icv_len = sizeof(struct ieee80211_mmie);
  2101. -- else
  2102. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  2103. -+ key->conf.icv_len = sizeof(struct ieee80211_mmie);
  2104. - if (seq)
  2105. - for (j = 0; j < IEEE80211_CMAC_PN_LEN; j++)
  2106. - key->u.aes_cmac.rx_pn[j] =
  2107. -@@ -436,51 +405,13 @@ ieee80211_key_alloc(u32 cipher, int idx,
  2108. - * it does not need to be initialized for every packet.
  2109. - */
  2110. - key->u.aes_cmac.tfm =
  2111. -- ieee80211_aes_cmac_key_setup(key_data, key_len);
  2112. -+ ieee80211_aes_cmac_key_setup(key_data);
  2113. - if (IS_ERR(key->u.aes_cmac.tfm)) {
  2114. - err = PTR_ERR(key->u.aes_cmac.tfm);
  2115. - kfree(key);
  2116. - return ERR_PTR(err);
  2117. - }
  2118. - break;
  2119. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2120. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2121. -- key->conf.iv_len = 0;
  2122. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  2123. -- if (seq)
  2124. -- for (j = 0; j < IEEE80211_GMAC_PN_LEN; j++)
  2125. -- key->u.aes_gmac.rx_pn[j] =
  2126. -- seq[IEEE80211_GMAC_PN_LEN - j - 1];
  2127. -- /* Initialize AES key state here as an optimization so that
  2128. -- * it does not need to be initialized for every packet.
  2129. -- */
  2130. -- key->u.aes_gmac.tfm =
  2131. -- ieee80211_aes_gmac_key_setup(key_data, key_len);
  2132. -- if (IS_ERR(key->u.aes_gmac.tfm)) {
  2133. -- err = PTR_ERR(key->u.aes_gmac.tfm);
  2134. -- kfree(key);
  2135. -- return ERR_PTR(err);
  2136. -- }
  2137. -- break;
  2138. -- case WLAN_CIPHER_SUITE_GCMP:
  2139. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2140. -- key->conf.iv_len = IEEE80211_GCMP_HDR_LEN;
  2141. -- key->conf.icv_len = IEEE80211_GCMP_MIC_LEN;
  2142. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  2143. -- for (j = 0; j < IEEE80211_GCMP_PN_LEN; j++)
  2144. -- key->u.gcmp.rx_pn[i][j] =
  2145. -- seq[IEEE80211_GCMP_PN_LEN - j - 1];
  2146. -- /* Initialize AES key state here as an optimization so that
  2147. -- * it does not need to be initialized for every packet.
  2148. -- */
  2149. -- key->u.gcmp.tfm = ieee80211_aes_gcm_key_setup_encrypt(key_data,
  2150. -- key_len);
  2151. -- if (IS_ERR(key->u.gcmp.tfm)) {
  2152. -- err = PTR_ERR(key->u.gcmp.tfm);
  2153. -- kfree(key);
  2154. -- return ERR_PTR(err);
  2155. -- }
  2156. -- break;
  2157. - default:
  2158. - if (cs) {
  2159. - size_t len = (seq_len > MAX_PN_LEN) ?
  2160. -@@ -502,24 +433,10 @@ ieee80211_key_alloc(u32 cipher, int idx,
  2161. -
  2162. - static void ieee80211_key_free_common(struct ieee80211_key *key)
  2163. - {
  2164. -- switch (key->conf.cipher) {
  2165. -- case WLAN_CIPHER_SUITE_CCMP:
  2166. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2167. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_CCMP)
  2168. - ieee80211_aes_key_free(key->u.ccmp.tfm);
  2169. -- break;
  2170. -- case WLAN_CIPHER_SUITE_AES_CMAC:
  2171. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2172. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  2173. - ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
  2174. -- break;
  2175. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2176. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2177. -- ieee80211_aes_gmac_key_free(key->u.aes_gmac.tfm);
  2178. -- break;
  2179. -- case WLAN_CIPHER_SUITE_GCMP:
  2180. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2181. -- ieee80211_aes_gcm_key_free(key->u.gcmp.tfm);
  2182. -- break;
  2183. -- }
  2184. - kzfree(key);
  2185. - }
  2186. -
  2187. -@@ -826,7 +743,6 @@ void ieee80211_get_key_tx_seq(struct iee
  2188. - seq->tkip.iv16 = key->u.tkip.tx.iv16;
  2189. - break;
  2190. - case WLAN_CIPHER_SUITE_CCMP:
  2191. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2192. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  2193. - seq->ccmp.pn[5] = pn64;
  2194. - seq->ccmp.pn[4] = pn64 >> 8;
  2195. -@@ -836,7 +752,6 @@ void ieee80211_get_key_tx_seq(struct iee
  2196. - seq->ccmp.pn[0] = pn64 >> 40;
  2197. - break;
  2198. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2199. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2200. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  2201. - seq->ccmp.pn[5] = pn64;
  2202. - seq->ccmp.pn[4] = pn64 >> 8;
  2203. -@@ -845,26 +760,6 @@ void ieee80211_get_key_tx_seq(struct iee
  2204. - seq->ccmp.pn[1] = pn64 >> 32;
  2205. - seq->ccmp.pn[0] = pn64 >> 40;
  2206. - break;
  2207. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2208. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2209. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  2210. -- seq->ccmp.pn[5] = pn64;
  2211. -- seq->ccmp.pn[4] = pn64 >> 8;
  2212. -- seq->ccmp.pn[3] = pn64 >> 16;
  2213. -- seq->ccmp.pn[2] = pn64 >> 24;
  2214. -- seq->ccmp.pn[1] = pn64 >> 32;
  2215. -- seq->ccmp.pn[0] = pn64 >> 40;
  2216. -- break;
  2217. -- case WLAN_CIPHER_SUITE_GCMP:
  2218. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2219. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  2220. -- seq->gcmp.pn[5] = pn64;
  2221. -- seq->gcmp.pn[4] = pn64 >> 8;
  2222. -- seq->gcmp.pn[3] = pn64 >> 16;
  2223. -- seq->gcmp.pn[2] = pn64 >> 24;
  2224. -- seq->gcmp.pn[1] = pn64 >> 32;
  2225. -- seq->gcmp.pn[0] = pn64 >> 40;
  2226. -- break;
  2227. - default:
  2228. - WARN_ON(1);
  2229. - }
  2230. -@@ -887,7 +782,6 @@ void ieee80211_get_key_rx_seq(struct iee
  2231. - seq->tkip.iv16 = key->u.tkip.rx[tid].iv16;
  2232. - break;
  2233. - case WLAN_CIPHER_SUITE_CCMP:
  2234. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2235. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  2236. - return;
  2237. - if (tid < 0)
  2238. -@@ -897,29 +791,11 @@ void ieee80211_get_key_rx_seq(struct iee
  2239. - memcpy(seq->ccmp.pn, pn, IEEE80211_CCMP_PN_LEN);
  2240. - break;
  2241. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2242. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2243. - if (WARN_ON(tid != 0))
  2244. - return;
  2245. - pn = key->u.aes_cmac.rx_pn;
  2246. - memcpy(seq->aes_cmac.pn, pn, IEEE80211_CMAC_PN_LEN);
  2247. - break;
  2248. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2249. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2250. -- if (WARN_ON(tid != 0))
  2251. -- return;
  2252. -- pn = key->u.aes_gmac.rx_pn;
  2253. -- memcpy(seq->aes_gmac.pn, pn, IEEE80211_GMAC_PN_LEN);
  2254. -- break;
  2255. -- case WLAN_CIPHER_SUITE_GCMP:
  2256. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2257. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  2258. -- return;
  2259. -- if (tid < 0)
  2260. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  2261. -- else
  2262. -- pn = key->u.gcmp.rx_pn[tid];
  2263. -- memcpy(seq->gcmp.pn, pn, IEEE80211_GCMP_PN_LEN);
  2264. -- break;
  2265. - }
  2266. - }
  2267. - EXPORT_SYMBOL(ieee80211_get_key_rx_seq);
  2268. -@@ -938,7 +814,6 @@ void ieee80211_set_key_tx_seq(struct iee
  2269. - key->u.tkip.tx.iv16 = seq->tkip.iv16;
  2270. - break;
  2271. - case WLAN_CIPHER_SUITE_CCMP:
  2272. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2273. - pn64 = (u64)seq->ccmp.pn[5] |
  2274. - ((u64)seq->ccmp.pn[4] << 8) |
  2275. - ((u64)seq->ccmp.pn[3] << 16) |
  2276. -@@ -948,7 +823,6 @@ void ieee80211_set_key_tx_seq(struct iee
  2277. - atomic64_set(&key->u.ccmp.tx_pn, pn64);
  2278. - break;
  2279. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2280. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2281. - pn64 = (u64)seq->aes_cmac.pn[5] |
  2282. - ((u64)seq->aes_cmac.pn[4] << 8) |
  2283. - ((u64)seq->aes_cmac.pn[3] << 16) |
  2284. -@@ -957,26 +831,6 @@ void ieee80211_set_key_tx_seq(struct iee
  2285. - ((u64)seq->aes_cmac.pn[0] << 40);
  2286. - atomic64_set(&key->u.aes_cmac.tx_pn, pn64);
  2287. - break;
  2288. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2289. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2290. -- pn64 = (u64)seq->aes_gmac.pn[5] |
  2291. -- ((u64)seq->aes_gmac.pn[4] << 8) |
  2292. -- ((u64)seq->aes_gmac.pn[3] << 16) |
  2293. -- ((u64)seq->aes_gmac.pn[2] << 24) |
  2294. -- ((u64)seq->aes_gmac.pn[1] << 32) |
  2295. -- ((u64)seq->aes_gmac.pn[0] << 40);
  2296. -- atomic64_set(&key->u.aes_gmac.tx_pn, pn64);
  2297. -- break;
  2298. -- case WLAN_CIPHER_SUITE_GCMP:
  2299. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2300. -- pn64 = (u64)seq->gcmp.pn[5] |
  2301. -- ((u64)seq->gcmp.pn[4] << 8) |
  2302. -- ((u64)seq->gcmp.pn[3] << 16) |
  2303. -- ((u64)seq->gcmp.pn[2] << 24) |
  2304. -- ((u64)seq->gcmp.pn[1] << 32) |
  2305. -- ((u64)seq->gcmp.pn[0] << 40);
  2306. -- atomic64_set(&key->u.gcmp.tx_pn, pn64);
  2307. -- break;
  2308. - default:
  2309. - WARN_ON(1);
  2310. - break;
  2311. -@@ -1000,7 +854,6 @@ void ieee80211_set_key_rx_seq(struct iee
  2312. - key->u.tkip.rx[tid].iv16 = seq->tkip.iv16;
  2313. - break;
  2314. - case WLAN_CIPHER_SUITE_CCMP:
  2315. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2316. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  2317. - return;
  2318. - if (tid < 0)
  2319. -@@ -1010,29 +863,11 @@ void ieee80211_set_key_rx_seq(struct iee
  2320. - memcpy(pn, seq->ccmp.pn, IEEE80211_CCMP_PN_LEN);
  2321. - break;
  2322. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2323. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2324. - if (WARN_ON(tid != 0))
  2325. - return;
  2326. - pn = key->u.aes_cmac.rx_pn;
  2327. - memcpy(pn, seq->aes_cmac.pn, IEEE80211_CMAC_PN_LEN);
  2328. - break;
  2329. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2330. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2331. -- if (WARN_ON(tid != 0))
  2332. -- return;
  2333. -- pn = key->u.aes_gmac.rx_pn;
  2334. -- memcpy(pn, seq->aes_gmac.pn, IEEE80211_GMAC_PN_LEN);
  2335. -- break;
  2336. -- case WLAN_CIPHER_SUITE_GCMP:
  2337. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2338. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  2339. -- return;
  2340. -- if (tid < 0)
  2341. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  2342. -- else
  2343. -- pn = key->u.gcmp.rx_pn[tid];
  2344. -- memcpy(pn, seq->gcmp.pn, IEEE80211_GCMP_PN_LEN);
  2345. -- break;
  2346. - default:
  2347. - WARN_ON(1);
  2348. - break;
  2349. ---- a/net/mac80211/key.h
  2350. -+++ b/net/mac80211/key.h
  2351. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  2352. - * Management frames.
  2353. - */
  2354. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  2355. -- struct crypto_aead *tfm;
  2356. -+ struct crypto_cipher *tfm;
  2357. - u32 replays; /* dot11RSNAStatsCCMPReplays */
  2358. - } ccmp;
  2359. - struct {
  2360. -@@ -95,24 +95,6 @@ struct ieee80211_key {
  2361. - u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  2362. - } aes_cmac;
  2363. - struct {
  2364. -- atomic64_t tx_pn;
  2365. -- u8 rx_pn[IEEE80211_GMAC_PN_LEN];
  2366. -- struct crypto_aead *tfm;
  2367. -- u32 replays; /* dot11RSNAStatsCMACReplays */
  2368. -- u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  2369. -- } aes_gmac;
  2370. -- struct {
  2371. -- atomic64_t tx_pn;
  2372. -- /* Last received packet number. The first
  2373. -- * IEEE80211_NUM_TIDS counters are used with Data
  2374. -- * frames and the last counter is used with Robust
  2375. -- * Management frames.
  2376. -- */
  2377. -- u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_GCMP_PN_LEN];
  2378. -- struct crypto_aead *tfm;
  2379. -- u32 replays; /* dot11RSNAStatsGCMPReplays */
  2380. -- } gcmp;
  2381. -- struct {
  2382. - /* generic cipher scheme */
  2383. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][MAX_PN_LEN];
  2384. - } gen;
  2385. ---- a/net/mac80211/main.c
  2386. -+++ b/net/mac80211/main.c
  2387. -@@ -666,15 +666,9 @@ static int ieee80211_init_cipher_suites(
  2388. - WLAN_CIPHER_SUITE_WEP104,
  2389. - WLAN_CIPHER_SUITE_TKIP,
  2390. - WLAN_CIPHER_SUITE_CCMP,
  2391. -- WLAN_CIPHER_SUITE_CCMP_256,
  2392. -- WLAN_CIPHER_SUITE_GCMP,
  2393. -- WLAN_CIPHER_SUITE_GCMP_256,
  2394. -
  2395. - /* keep last -- depends on hw flags! */
  2396. -- WLAN_CIPHER_SUITE_AES_CMAC,
  2397. -- WLAN_CIPHER_SUITE_BIP_CMAC_256,
  2398. -- WLAN_CIPHER_SUITE_BIP_GMAC_128,
  2399. -- WLAN_CIPHER_SUITE_BIP_GMAC_256,
  2400. -+ WLAN_CIPHER_SUITE_AES_CMAC
  2401. - };
  2402. -
  2403. - if (local->hw.flags & IEEE80211_HW_SW_CRYPTO_CONTROL ||
  2404. -@@ -713,7 +707,7 @@ static int ieee80211_init_cipher_suites(
  2405. - local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  2406. -
  2407. - if (!have_mfp)
  2408. -- local->hw.wiphy->n_cipher_suites -= 4;
  2409. -+ local->hw.wiphy->n_cipher_suites--;
  2410. -
  2411. - if (!have_wep) {
  2412. - local->hw.wiphy->cipher_suites += 2;
  2413. -@@ -730,42 +724,32 @@ static int ieee80211_init_cipher_suites(
  2414. - /* Driver specifies cipher schemes only (but not cipher suites
  2415. - * including the schemes)
  2416. - *
  2417. -- * We start counting ciphers defined by schemes, TKIP, CCMP,
  2418. -- * CCMP-256, GCMP, and GCMP-256
  2419. -+ * We start counting ciphers defined by schemes, TKIP and CCMP
  2420. - */
  2421. -- n_suites = local->hw.n_cipher_schemes + 5;
  2422. -+ n_suites = local->hw.n_cipher_schemes + 2;
  2423. -
  2424. - /* check if we have WEP40 and WEP104 */
  2425. - if (have_wep)
  2426. - n_suites += 2;
  2427. -
  2428. -- /* check if we have AES_CMAC, BIP-CMAC-256, BIP-GMAC-128,
  2429. -- * BIP-GMAC-256
  2430. -- */
  2431. -+ /* check if we have AES_CMAC */
  2432. - if (have_mfp)
  2433. -- n_suites += 4;
  2434. -+ n_suites++;
  2435. -
  2436. - suites = kmalloc(sizeof(u32) * n_suites, GFP_KERNEL);
  2437. - if (!suites)
  2438. - return -ENOMEM;
  2439. -
  2440. - suites[w++] = WLAN_CIPHER_SUITE_CCMP;
  2441. -- suites[w++] = WLAN_CIPHER_SUITE_CCMP_256;
  2442. - suites[w++] = WLAN_CIPHER_SUITE_TKIP;
  2443. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP;
  2444. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP_256;
  2445. -
  2446. - if (have_wep) {
  2447. - suites[w++] = WLAN_CIPHER_SUITE_WEP40;
  2448. - suites[w++] = WLAN_CIPHER_SUITE_WEP104;
  2449. - }
  2450. -
  2451. -- if (have_mfp) {
  2452. -+ if (have_mfp)
  2453. - suites[w++] = WLAN_CIPHER_SUITE_AES_CMAC;
  2454. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_CMAC_256;
  2455. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_128;
  2456. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_256;
  2457. -- }
  2458. -
  2459. - for (r = 0; r < local->hw.n_cipher_schemes; r++)
  2460. - suites[w++] = cs[r].cipher;
  2461. ---- a/net/mac80211/rx.c
  2462. -+++ b/net/mac80211/rx.c
  2463. -@@ -647,7 +647,6 @@ static int ieee80211_get_mmie_keyidx(str
  2464. - {
  2465. - struct ieee80211_mgmt *hdr = (struct ieee80211_mgmt *) skb->data;
  2466. - struct ieee80211_mmie *mmie;
  2467. -- struct ieee80211_mmie_16 *mmie16;
  2468. -
  2469. - if (skb->len < 24 + sizeof(*mmie) || !is_multicast_ether_addr(hdr->da))
  2470. - return -1;
  2471. -@@ -657,18 +656,11 @@ static int ieee80211_get_mmie_keyidx(str
  2472. -
  2473. - mmie = (struct ieee80211_mmie *)
  2474. - (skb->data + skb->len - sizeof(*mmie));
  2475. -- if (mmie->element_id == WLAN_EID_MMIE &&
  2476. -- mmie->length == sizeof(*mmie) - 2)
  2477. -- return le16_to_cpu(mmie->key_id);
  2478. --
  2479. -- mmie16 = (struct ieee80211_mmie_16 *)
  2480. -- (skb->data + skb->len - sizeof(*mmie16));
  2481. -- if (skb->len >= 24 + sizeof(*mmie16) &&
  2482. -- mmie16->element_id == WLAN_EID_MMIE &&
  2483. -- mmie16->length == sizeof(*mmie16) - 2)
  2484. -- return le16_to_cpu(mmie16->key_id);
  2485. -+ if (mmie->element_id != WLAN_EID_MMIE ||
  2486. -+ mmie->length != sizeof(*mmie) - 2)
  2487. -+ return -1;
  2488. -
  2489. -- return -1;
  2490. -+ return le16_to_cpu(mmie->key_id);
  2491. - }
  2492. -
  2493. - static int iwl80211_get_cs_keyid(const struct ieee80211_cipher_scheme *cs,
  2494. -@@ -1658,27 +1650,11 @@ ieee80211_rx_h_decrypt(struct ieee80211_
  2495. - result = ieee80211_crypto_tkip_decrypt(rx);
  2496. - break;
  2497. - case WLAN_CIPHER_SUITE_CCMP:
  2498. -- result = ieee80211_crypto_ccmp_decrypt(
  2499. -- rx, IEEE80211_CCMP_MIC_LEN);
  2500. -- break;
  2501. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2502. -- result = ieee80211_crypto_ccmp_decrypt(
  2503. -- rx, IEEE80211_CCMP_256_MIC_LEN);
  2504. -+ result = ieee80211_crypto_ccmp_decrypt(rx);
  2505. - break;
  2506. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2507. - result = ieee80211_crypto_aes_cmac_decrypt(rx);
  2508. - break;
  2509. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2510. -- result = ieee80211_crypto_aes_cmac_256_decrypt(rx);
  2511. -- break;
  2512. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2513. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2514. -- result = ieee80211_crypto_aes_gmac_decrypt(rx);
  2515. -- break;
  2516. -- case WLAN_CIPHER_SUITE_GCMP:
  2517. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2518. -- result = ieee80211_crypto_gcmp_decrypt(rx);
  2519. -- break;
  2520. - default:
  2521. - result = ieee80211_crypto_hw_decrypt(rx);
  2522. - }
  2523. -@@ -1805,9 +1781,7 @@ ieee80211_rx_h_defragment(struct ieee802
  2524. - /* This is the first fragment of a new frame. */
  2525. - entry = ieee80211_reassemble_add(rx->sdata, frag, seq,
  2526. - rx->seqno_idx, &(rx->skb));
  2527. -- if (rx->key &&
  2528. -- (rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP ||
  2529. -- rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP_256) &&
  2530. -+ if (rx->key && rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP &&
  2531. - ieee80211_has_protected(fc)) {
  2532. - int queue = rx->security_idx;
  2533. - /* Store CCMP PN so that we can verify that the next
  2534. -@@ -1836,9 +1810,7 @@ ieee80211_rx_h_defragment(struct ieee802
  2535. - int i;
  2536. - u8 pn[IEEE80211_CCMP_PN_LEN], *rpn;
  2537. - int queue;
  2538. -- if (!rx->key ||
  2539. -- (rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP &&
  2540. -- rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP_256))
  2541. -+ if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP)
  2542. - return RX_DROP_UNUSABLE;
  2543. - memcpy(pn, entry->last_pn, IEEE80211_CCMP_PN_LEN);
  2544. - for (i = IEEE80211_CCMP_PN_LEN - 1; i >= 0; i--) {
  2545. ---- a/net/mac80211/tx.c
  2546. -+++ b/net/mac80211/tx.c
  2547. -@@ -626,9 +626,6 @@ ieee80211_tx_h_select_key(struct ieee802
  2548. - tx->key = NULL;
  2549. - break;
  2550. - case WLAN_CIPHER_SUITE_CCMP:
  2551. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2552. -- case WLAN_CIPHER_SUITE_GCMP:
  2553. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2554. - if (!ieee80211_is_data_present(hdr->frame_control) &&
  2555. - !ieee80211_use_mfp(hdr->frame_control, tx->sta,
  2556. - tx->skb))
  2557. -@@ -639,9 +636,6 @@ ieee80211_tx_h_select_key(struct ieee802
  2558. - ieee80211_is_mgmt(hdr->frame_control);
  2559. - break;
  2560. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2561. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2562. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2563. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2564. - if (!ieee80211_is_mgmt(hdr->frame_control))
  2565. - tx->key = NULL;
  2566. - break;
  2567. -@@ -1017,21 +1011,9 @@ ieee80211_tx_h_encrypt(struct ieee80211_
  2568. - case WLAN_CIPHER_SUITE_TKIP:
  2569. - return ieee80211_crypto_tkip_encrypt(tx);
  2570. - case WLAN_CIPHER_SUITE_CCMP:
  2571. -- return ieee80211_crypto_ccmp_encrypt(
  2572. -- tx, IEEE80211_CCMP_MIC_LEN);
  2573. -- case WLAN_CIPHER_SUITE_CCMP_256:
  2574. -- return ieee80211_crypto_ccmp_encrypt(
  2575. -- tx, IEEE80211_CCMP_256_MIC_LEN);
  2576. -+ return ieee80211_crypto_ccmp_encrypt(tx);
  2577. - case WLAN_CIPHER_SUITE_AES_CMAC:
  2578. - return ieee80211_crypto_aes_cmac_encrypt(tx);
  2579. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  2580. -- return ieee80211_crypto_aes_cmac_256_encrypt(tx);
  2581. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  2582. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  2583. -- return ieee80211_crypto_aes_gmac_encrypt(tx);
  2584. -- case WLAN_CIPHER_SUITE_GCMP:
  2585. -- case WLAN_CIPHER_SUITE_GCMP_256:
  2586. -- return ieee80211_crypto_gcmp_encrypt(tx);
  2587. - default:
  2588. - return ieee80211_crypto_hw_encrypt(tx);
  2589. - }
  2590. ---- a/net/mac80211/wpa.c
  2591. -+++ b/net/mac80211/wpa.c
  2592. -@@ -22,8 +22,6 @@
  2593. - #include "tkip.h"
  2594. - #include "aes_ccm.h"
  2595. - #include "aes_cmac.h"
  2596. --#include "aes_gmac.h"
  2597. --#include "aes_gcm.h"
  2598. - #include "wpa.h"
  2599. -
  2600. - ieee80211_tx_result
  2601. -@@ -304,15 +302,22 @@ ieee80211_crypto_tkip_decrypt(struct iee
  2602. - }
  2603. -
  2604. -
  2605. --static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  2606. -+static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
  2607. -+ int encrypted)
  2608. - {
  2609. - __le16 mask_fc;
  2610. - int a4_included, mgmt;
  2611. - u8 qos_tid;
  2612. -- u16 len_a;
  2613. -+ u8 *b_0, *aad;
  2614. -+ u16 data_len, len_a;
  2615. - unsigned int hdrlen;
  2616. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2617. -
  2618. -+ memset(scratch, 0, 6 * AES_BLOCK_SIZE);
  2619. -+
  2620. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  2621. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  2622. -+
  2623. - /*
  2624. - * Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  2625. - * Retry, PwrMgt, MoreData; set Protected
  2626. -@@ -334,21 +339,20 @@ static void ccmp_special_blocks(struct s
  2627. - else
  2628. - qos_tid = 0;
  2629. -
  2630. -- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  2631. -- * mode authentication are not allowed to collide, yet both are derived
  2632. -- * from this vector b_0. We only set L := 1 here to indicate that the
  2633. -- * data size can be represented in (L+1) bytes. The CCM layer will take
  2634. -- * care of storing the data length in the top (L+1) bytes and setting
  2635. -- * and clearing the other bits as is required to derive the two IVs.
  2636. -- */
  2637. -- b_0[0] = 0x1;
  2638. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN;
  2639. -+ if (encrypted)
  2640. -+ data_len -= IEEE80211_CCMP_MIC_LEN;
  2641. -
  2642. -+ /* First block, b_0 */
  2643. -+ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  2644. - /* Nonce: Nonce Flags | A2 | PN
  2645. - * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  2646. - */
  2647. - b_0[1] = qos_tid | (mgmt << 4);
  2648. - memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  2649. - memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  2650. -+ /* l(m) */
  2651. -+ put_unaligned_be16(data_len, &b_0[14]);
  2652. -
  2653. - /* AAD (extra authenticate-only data) / masked 802.11 header
  2654. - * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  2655. -@@ -395,8 +399,7 @@ static inline void ccmp_hdr2pn(u8 *pn, u
  2656. - }
  2657. -
  2658. -
  2659. --static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb,
  2660. -- unsigned int mic_len)
  2661. -+static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  2662. - {
  2663. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  2664. - struct ieee80211_key *key = tx->key;
  2665. -@@ -405,8 +408,7 @@ static int ccmp_encrypt_skb(struct ieee8
  2666. - u8 *pos;
  2667. - u8 pn[6];
  2668. - u64 pn64;
  2669. -- u8 aad[2 * AES_BLOCK_SIZE];
  2670. -- u8 b_0[AES_BLOCK_SIZE];
  2671. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  2672. -
  2673. - if (info->control.hw_key &&
  2674. - !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  2675. -@@ -427,7 +429,7 @@ static int ccmp_encrypt_skb(struct ieee8
  2676. - if (info->control.hw_key)
  2677. - tail = 0;
  2678. - else
  2679. -- tail = mic_len;
  2680. -+ tail = IEEE80211_CCMP_MIC_LEN;
  2681. -
  2682. - if (WARN_ON(skb_tailroom(skb) < tail ||
  2683. - skb_headroom(skb) < IEEE80211_CCMP_HDR_LEN))
  2684. -@@ -460,24 +462,23 @@ static int ccmp_encrypt_skb(struct ieee8
  2685. - return 0;
  2686. -
  2687. - pos += IEEE80211_CCMP_HDR_LEN;
  2688. -- ccmp_special_blocks(skb, pn, b_0, aad);
  2689. -- ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  2690. -- skb_put(skb, mic_len), mic_len);
  2691. -+ ccmp_special_blocks(skb, pn, scratch, 0);
  2692. -+ ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len,
  2693. -+ pos, skb_put(skb, IEEE80211_CCMP_MIC_LEN));
  2694. -
  2695. - return 0;
  2696. - }
  2697. -
  2698. -
  2699. - ieee80211_tx_result
  2700. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  2701. -- unsigned int mic_len)
  2702. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
  2703. - {
  2704. - struct sk_buff *skb;
  2705. -
  2706. - ieee80211_tx_set_protected(tx);
  2707. -
  2708. - skb_queue_walk(&tx->skbs, skb) {
  2709. -- if (ccmp_encrypt_skb(tx, skb, mic_len) < 0)
  2710. -+ if (ccmp_encrypt_skb(tx, skb) < 0)
  2711. - return TX_DROP;
  2712. - }
  2713. -
  2714. -@@ -486,8 +487,7 @@ ieee80211_crypto_ccmp_encrypt(struct iee
  2715. -
  2716. -
  2717. - ieee80211_rx_result
  2718. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  2719. -- unsigned int mic_len)
  2720. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
  2721. - {
  2722. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  2723. - int hdrlen;
  2724. -@@ -504,7 +504,8 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  2725. - !ieee80211_is_robust_mgmt_frame(skb))
  2726. - return RX_CONTINUE;
  2727. -
  2728. -- data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len;
  2729. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN -
  2730. -+ IEEE80211_CCMP_MIC_LEN;
  2731. - if (!rx->sta || data_len < 0)
  2732. - return RX_DROP_UNUSABLE;
  2733. -
  2734. -@@ -526,23 +527,23 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  2735. - }
  2736. -
  2737. - if (!(status->flag & RX_FLAG_DECRYPTED)) {
  2738. -- u8 aad[2 * AES_BLOCK_SIZE];
  2739. -- u8 b_0[AES_BLOCK_SIZE];
  2740. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  2741. - /* hardware didn't decrypt/verify MIC */
  2742. -- ccmp_special_blocks(skb, pn, b_0, aad);
  2743. -+ ccmp_special_blocks(skb, pn, scratch, 1);
  2744. -
  2745. - if (ieee80211_aes_ccm_decrypt(
  2746. -- key->u.ccmp.tfm, b_0, aad,
  2747. -+ key->u.ccmp.tfm, scratch,
  2748. - skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
  2749. - data_len,
  2750. -- skb->data + skb->len - mic_len, mic_len))
  2751. -+ skb->data + skb->len - IEEE80211_CCMP_MIC_LEN,
  2752. -+ skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
  2753. - return RX_DROP_UNUSABLE;
  2754. - }
  2755. -
  2756. - memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
  2757. -
  2758. - /* Remove CCMP header and MIC */
  2759. -- if (pskb_trim(skb, skb->len - mic_len))
  2760. -+ if (pskb_trim(skb, skb->len - IEEE80211_CCMP_MIC_LEN))
  2761. - return RX_DROP_UNUSABLE;
  2762. - memmove(skb->data + IEEE80211_CCMP_HDR_LEN, skb->data, hdrlen);
  2763. - skb_pull(skb, IEEE80211_CCMP_HDR_LEN);
  2764. -@@ -550,229 +551,6 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  2765. - return RX_CONTINUE;
  2766. - }
  2767. -
  2768. --static void gcmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *j_0, u8 *aad)
  2769. --{
  2770. -- __le16 mask_fc;
  2771. -- u8 qos_tid;
  2772. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2773. --
  2774. -- memcpy(j_0, hdr->addr2, ETH_ALEN);
  2775. -- memcpy(&j_0[ETH_ALEN], pn, IEEE80211_GCMP_PN_LEN);
  2776. -- j_0[13] = 0;
  2777. -- j_0[14] = 0;
  2778. -- j_0[AES_BLOCK_SIZE - 1] = 0x01;
  2779. --
  2780. -- /* AAD (extra authenticate-only data) / masked 802.11 header
  2781. -- * FC | A1 | A2 | A3 | SC | [A4] | [QC]
  2782. -- */
  2783. -- put_unaligned_be16(ieee80211_hdrlen(hdr->frame_control) - 2, &aad[0]);
  2784. -- /* Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  2785. -- * Retry, PwrMgt, MoreData; set Protected
  2786. -- */
  2787. -- mask_fc = hdr->frame_control;
  2788. -- mask_fc &= ~cpu_to_le16(IEEE80211_FCTL_RETRY |
  2789. -- IEEE80211_FCTL_PM | IEEE80211_FCTL_MOREDATA);
  2790. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  2791. -- mask_fc &= ~cpu_to_le16(0x0070);
  2792. -- mask_fc |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2793. --
  2794. -- put_unaligned(mask_fc, (__le16 *)&aad[2]);
  2795. -- memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN);
  2796. --
  2797. -- /* Mask Seq#, leave Frag# */
  2798. -- aad[22] = *((u8 *)&hdr->seq_ctrl) & 0x0f;
  2799. -- aad[23] = 0;
  2800. --
  2801. -- if (ieee80211_is_data_qos(hdr->frame_control))
  2802. -- qos_tid = *ieee80211_get_qos_ctl(hdr) &
  2803. -- IEEE80211_QOS_CTL_TID_MASK;
  2804. -- else
  2805. -- qos_tid = 0;
  2806. --
  2807. -- if (ieee80211_has_a4(hdr->frame_control)) {
  2808. -- memcpy(&aad[24], hdr->addr4, ETH_ALEN);
  2809. -- aad[30] = qos_tid;
  2810. -- aad[31] = 0;
  2811. -- } else {
  2812. -- memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN);
  2813. -- aad[24] = qos_tid;
  2814. -- }
  2815. --}
  2816. --
  2817. --static inline void gcmp_pn2hdr(u8 *hdr, const u8 *pn, int key_id)
  2818. --{
  2819. -- hdr[0] = pn[5];
  2820. -- hdr[1] = pn[4];
  2821. -- hdr[2] = 0;
  2822. -- hdr[3] = 0x20 | (key_id << 6);
  2823. -- hdr[4] = pn[3];
  2824. -- hdr[5] = pn[2];
  2825. -- hdr[6] = pn[1];
  2826. -- hdr[7] = pn[0];
  2827. --}
  2828. --
  2829. --static inline void gcmp_hdr2pn(u8 *pn, const u8 *hdr)
  2830. --{
  2831. -- pn[0] = hdr[7];
  2832. -- pn[1] = hdr[6];
  2833. -- pn[2] = hdr[5];
  2834. -- pn[3] = hdr[4];
  2835. -- pn[4] = hdr[1];
  2836. -- pn[5] = hdr[0];
  2837. --}
  2838. --
  2839. --static int gcmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  2840. --{
  2841. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2842. -- struct ieee80211_key *key = tx->key;
  2843. -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2844. -- int hdrlen, len, tail;
  2845. -- u8 *pos;
  2846. -- u8 pn[6];
  2847. -- u64 pn64;
  2848. -- u8 aad[2 * AES_BLOCK_SIZE];
  2849. -- u8 j_0[AES_BLOCK_SIZE];
  2850. --
  2851. -- if (info->control.hw_key &&
  2852. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  2853. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) &&
  2854. -- !((info->control.hw_key->flags &
  2855. -- IEEE80211_KEY_FLAG_GENERATE_IV_MGMT) &&
  2856. -- ieee80211_is_mgmt(hdr->frame_control))) {
  2857. -- /* hwaccel has no need for preallocated room for GCMP
  2858. -- * header or MIC fields
  2859. -- */
  2860. -- return 0;
  2861. -- }
  2862. --
  2863. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2864. -- len = skb->len - hdrlen;
  2865. --
  2866. -- if (info->control.hw_key)
  2867. -- tail = 0;
  2868. -- else
  2869. -- tail = IEEE80211_GCMP_MIC_LEN;
  2870. --
  2871. -- if (WARN_ON(skb_tailroom(skb) < tail ||
  2872. -- skb_headroom(skb) < IEEE80211_GCMP_HDR_LEN))
  2873. -- return -1;
  2874. --
  2875. -- pos = skb_push(skb, IEEE80211_GCMP_HDR_LEN);
  2876. -- memmove(pos, pos + IEEE80211_GCMP_HDR_LEN, hdrlen);
  2877. -- skb_set_network_header(skb, skb_network_offset(skb) +
  2878. -- IEEE80211_GCMP_HDR_LEN);
  2879. --
  2880. -- /* the HW only needs room for the IV, but not the actual IV */
  2881. -- if (info->control.hw_key &&
  2882. -- (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))
  2883. -- return 0;
  2884. --
  2885. -- hdr = (struct ieee80211_hdr *)pos;
  2886. -- pos += hdrlen;
  2887. --
  2888. -- pn64 = atomic64_inc_return(&key->u.gcmp.tx_pn);
  2889. --
  2890. -- pn[5] = pn64;
  2891. -- pn[4] = pn64 >> 8;
  2892. -- pn[3] = pn64 >> 16;
  2893. -- pn[2] = pn64 >> 24;
  2894. -- pn[1] = pn64 >> 32;
  2895. -- pn[0] = pn64 >> 40;
  2896. --
  2897. -- gcmp_pn2hdr(pos, pn, key->conf.keyidx);
  2898. --
  2899. -- /* hwaccel - with software GCMP header */
  2900. -- if (info->control.hw_key)
  2901. -- return 0;
  2902. --
  2903. -- pos += IEEE80211_GCMP_HDR_LEN;
  2904. -- gcmp_special_blocks(skb, pn, j_0, aad);
  2905. -- ieee80211_aes_gcm_encrypt(key->u.gcmp.tfm, j_0, aad, pos, len,
  2906. -- skb_put(skb, IEEE80211_GCMP_MIC_LEN));
  2907. --
  2908. -- return 0;
  2909. --}
  2910. --
  2911. --ieee80211_tx_result
  2912. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx)
  2913. --{
  2914. -- struct sk_buff *skb;
  2915. --
  2916. -- ieee80211_tx_set_protected(tx);
  2917. --
  2918. -- skb_queue_walk(&tx->skbs, skb) {
  2919. -- if (gcmp_encrypt_skb(tx, skb) < 0)
  2920. -- return TX_DROP;
  2921. -- }
  2922. --
  2923. -- return TX_CONTINUE;
  2924. --}
  2925. --
  2926. --ieee80211_rx_result
  2927. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx)
  2928. --{
  2929. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  2930. -- int hdrlen;
  2931. -- struct ieee80211_key *key = rx->key;
  2932. -- struct sk_buff *skb = rx->skb;
  2933. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  2934. -- u8 pn[IEEE80211_GCMP_PN_LEN];
  2935. -- int data_len;
  2936. -- int queue;
  2937. --
  2938. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2939. --
  2940. -- if (!ieee80211_is_data(hdr->frame_control) &&
  2941. -- !ieee80211_is_robust_mgmt_frame(skb))
  2942. -- return RX_CONTINUE;
  2943. --
  2944. -- data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN -
  2945. -- IEEE80211_GCMP_MIC_LEN;
  2946. -- if (!rx->sta || data_len < 0)
  2947. -- return RX_DROP_UNUSABLE;
  2948. --
  2949. -- if (status->flag & RX_FLAG_DECRYPTED) {
  2950. -- if (!pskb_may_pull(rx->skb, hdrlen + IEEE80211_GCMP_HDR_LEN))
  2951. -- return RX_DROP_UNUSABLE;
  2952. -- } else {
  2953. -- if (skb_linearize(rx->skb))
  2954. -- return RX_DROP_UNUSABLE;
  2955. -- }
  2956. --
  2957. -- gcmp_hdr2pn(pn, skb->data + hdrlen);
  2958. --
  2959. -- queue = rx->security_idx;
  2960. --
  2961. -- if (memcmp(pn, key->u.gcmp.rx_pn[queue], IEEE80211_GCMP_PN_LEN) <= 0) {
  2962. -- key->u.gcmp.replays++;
  2963. -- return RX_DROP_UNUSABLE;
  2964. -- }
  2965. --
  2966. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  2967. -- u8 aad[2 * AES_BLOCK_SIZE];
  2968. -- u8 j_0[AES_BLOCK_SIZE];
  2969. -- /* hardware didn't decrypt/verify MIC */
  2970. -- gcmp_special_blocks(skb, pn, j_0, aad);
  2971. --
  2972. -- if (ieee80211_aes_gcm_decrypt(
  2973. -- key->u.gcmp.tfm, j_0, aad,
  2974. -- skb->data + hdrlen + IEEE80211_GCMP_HDR_LEN,
  2975. -- data_len,
  2976. -- skb->data + skb->len - IEEE80211_GCMP_MIC_LEN))
  2977. -- return RX_DROP_UNUSABLE;
  2978. -- }
  2979. --
  2980. -- memcpy(key->u.gcmp.rx_pn[queue], pn, IEEE80211_GCMP_PN_LEN);
  2981. --
  2982. -- /* Remove GCMP header and MIC */
  2983. -- if (pskb_trim(skb, skb->len - IEEE80211_GCMP_MIC_LEN))
  2984. -- return RX_DROP_UNUSABLE;
  2985. -- memmove(skb->data + IEEE80211_GCMP_HDR_LEN, skb->data, hdrlen);
  2986. -- skb_pull(skb, IEEE80211_GCMP_HDR_LEN);
  2987. --
  2988. -- return RX_CONTINUE;
  2989. --}
  2990. --
  2991. - static ieee80211_tx_result
  2992. - ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  2993. - struct sk_buff *skb)
  2994. -@@ -956,48 +734,6 @@ ieee80211_crypto_aes_cmac_encrypt(struct
  2995. - return TX_CONTINUE;
  2996. - }
  2997. -
  2998. --ieee80211_tx_result
  2999. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx)
  3000. --{
  3001. -- struct sk_buff *skb;
  3002. -- struct ieee80211_tx_info *info;
  3003. -- struct ieee80211_key *key = tx->key;
  3004. -- struct ieee80211_mmie_16 *mmie;
  3005. -- u8 aad[20];
  3006. -- u64 pn64;
  3007. --
  3008. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  3009. -- return TX_DROP;
  3010. --
  3011. -- skb = skb_peek(&tx->skbs);
  3012. --
  3013. -- info = IEEE80211_SKB_CB(skb);
  3014. --
  3015. -- if (info->control.hw_key)
  3016. -- return TX_CONTINUE;
  3017. --
  3018. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  3019. -- return TX_DROP;
  3020. --
  3021. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  3022. -- mmie->element_id = WLAN_EID_MMIE;
  3023. -- mmie->length = sizeof(*mmie) - 2;
  3024. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  3025. --
  3026. -- /* PN = PN + 1 */
  3027. -- pn64 = atomic64_inc_return(&key->u.aes_cmac.tx_pn);
  3028. --
  3029. -- bip_ipn_set64(mmie->sequence_number, pn64);
  3030. --
  3031. -- bip_aad(skb, aad);
  3032. --
  3033. -- /* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128)
  3034. -- */
  3035. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  3036. -- skb->data + 24, skb->len - 24, mmie->mic);
  3037. --
  3038. -- return TX_CONTINUE;
  3039. --}
  3040. -
  3041. - ieee80211_rx_result
  3042. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
  3043. -@@ -1045,160 +781,6 @@ ieee80211_crypto_aes_cmac_decrypt(struct
  3044. -
  3045. - /* Remove MMIE */
  3046. - skb_trim(skb, skb->len - sizeof(*mmie));
  3047. --
  3048. -- return RX_CONTINUE;
  3049. --}
  3050. --
  3051. --ieee80211_rx_result
  3052. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx)
  3053. --{
  3054. -- struct sk_buff *skb = rx->skb;
  3055. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  3056. -- struct ieee80211_key *key = rx->key;
  3057. -- struct ieee80211_mmie_16 *mmie;
  3058. -- u8 aad[20], mic[16], ipn[6];
  3059. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  3060. --
  3061. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  3062. -- return RX_CONTINUE;
  3063. --
  3064. -- /* management frames are already linear */
  3065. --
  3066. -- if (skb->len < 24 + sizeof(*mmie))
  3067. -- return RX_DROP_UNUSABLE;
  3068. --
  3069. -- mmie = (struct ieee80211_mmie_16 *)
  3070. -- (skb->data + skb->len - sizeof(*mmie));
  3071. -- if (mmie->element_id != WLAN_EID_MMIE ||
  3072. -- mmie->length != sizeof(*mmie) - 2)
  3073. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  3074. --
  3075. -- bip_ipn_swap(ipn, mmie->sequence_number);
  3076. --
  3077. -- if (memcmp(ipn, key->u.aes_cmac.rx_pn, 6) <= 0) {
  3078. -- key->u.aes_cmac.replays++;
  3079. -- return RX_DROP_UNUSABLE;
  3080. -- }
  3081. --
  3082. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  3083. -- /* hardware didn't decrypt/verify MIC */
  3084. -- bip_aad(skb, aad);
  3085. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  3086. -- skb->data + 24, skb->len - 24, mic);
  3087. -- if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  3088. -- key->u.aes_cmac.icverrors++;
  3089. -- return RX_DROP_UNUSABLE;
  3090. -- }
  3091. -- }
  3092. --
  3093. -- memcpy(key->u.aes_cmac.rx_pn, ipn, 6);
  3094. --
  3095. -- /* Remove MMIE */
  3096. -- skb_trim(skb, skb->len - sizeof(*mmie));
  3097. --
  3098. -- return RX_CONTINUE;
  3099. --}
  3100. --
  3101. --ieee80211_tx_result
  3102. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx)
  3103. --{
  3104. -- struct sk_buff *skb;
  3105. -- struct ieee80211_tx_info *info;
  3106. -- struct ieee80211_key *key = tx->key;
  3107. -- struct ieee80211_mmie_16 *mmie;
  3108. -- struct ieee80211_hdr *hdr;
  3109. -- u8 aad[20];
  3110. -- u64 pn64;
  3111. -- u8 nonce[12];
  3112. --
  3113. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  3114. -- return TX_DROP;
  3115. --
  3116. -- skb = skb_peek(&tx->skbs);
  3117. --
  3118. -- info = IEEE80211_SKB_CB(skb);
  3119. --
  3120. -- if (info->control.hw_key)
  3121. -- return TX_CONTINUE;
  3122. --
  3123. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  3124. -- return TX_DROP;
  3125. --
  3126. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  3127. -- mmie->element_id = WLAN_EID_MMIE;
  3128. -- mmie->length = sizeof(*mmie) - 2;
  3129. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  3130. --
  3131. -- /* PN = PN + 1 */
  3132. -- pn64 = atomic64_inc_return(&key->u.aes_gmac.tx_pn);
  3133. --
  3134. -- bip_ipn_set64(mmie->sequence_number, pn64);
  3135. --
  3136. -- bip_aad(skb, aad);
  3137. --
  3138. -- hdr = (struct ieee80211_hdr *)skb->data;
  3139. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  3140. -- bip_ipn_swap(nonce + ETH_ALEN, mmie->sequence_number);
  3141. --
  3142. -- /* MIC = AES-GMAC(IGTK, AAD || Management Frame Body || MMIE, 128) */
  3143. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  3144. -- skb->data + 24, skb->len - 24, mmie->mic) < 0)
  3145. -- return TX_DROP;
  3146. --
  3147. -- return TX_CONTINUE;
  3148. --}
  3149. --
  3150. --ieee80211_rx_result
  3151. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx)
  3152. --{
  3153. -- struct sk_buff *skb = rx->skb;
  3154. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  3155. -- struct ieee80211_key *key = rx->key;
  3156. -- struct ieee80211_mmie_16 *mmie;
  3157. -- u8 aad[20], mic[16], ipn[6], nonce[12];
  3158. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  3159. --
  3160. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  3161. -- return RX_CONTINUE;
  3162. --
  3163. -- /* management frames are already linear */
  3164. --
  3165. -- if (skb->len < 24 + sizeof(*mmie))
  3166. -- return RX_DROP_UNUSABLE;
  3167. --
  3168. -- mmie = (struct ieee80211_mmie_16 *)
  3169. -- (skb->data + skb->len - sizeof(*mmie));
  3170. -- if (mmie->element_id != WLAN_EID_MMIE ||
  3171. -- mmie->length != sizeof(*mmie) - 2)
  3172. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  3173. --
  3174. -- bip_ipn_swap(ipn, mmie->sequence_number);
  3175. --
  3176. -- if (memcmp(ipn, key->u.aes_gmac.rx_pn, 6) <= 0) {
  3177. -- key->u.aes_gmac.replays++;
  3178. -- return RX_DROP_UNUSABLE;
  3179. -- }
  3180. --
  3181. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  3182. -- /* hardware didn't decrypt/verify MIC */
  3183. -- bip_aad(skb, aad);
  3184. --
  3185. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  3186. -- memcpy(nonce + ETH_ALEN, ipn, 6);
  3187. --
  3188. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  3189. -- skb->data + 24, skb->len - 24,
  3190. -- mic) < 0 ||
  3191. -- memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  3192. -- key->u.aes_gmac.icverrors++;
  3193. -- return RX_DROP_UNUSABLE;
  3194. -- }
  3195. -- }
  3196. --
  3197. -- memcpy(key->u.aes_gmac.rx_pn, ipn, 6);
  3198. --
  3199. -- /* Remove MMIE */
  3200. -- skb_trim(skb, skb->len - sizeof(*mmie));
  3201. -
  3202. - return RX_CONTINUE;
  3203. - }
  3204. ---- a/net/mac80211/wpa.h
  3205. -+++ b/net/mac80211/wpa.h
  3206. -@@ -24,32 +24,17 @@ ieee80211_rx_result
  3207. - ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx);
  3208. -
  3209. - ieee80211_tx_result
  3210. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  3211. -- unsigned int mic_len);
  3212. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx);
  3213. - ieee80211_rx_result
  3214. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  3215. -- unsigned int mic_len);
  3216. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx);
  3217. -
  3218. - ieee80211_tx_result
  3219. - ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx);
  3220. --ieee80211_tx_result
  3221. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx);
  3222. - ieee80211_rx_result
  3223. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx);
  3224. --ieee80211_rx_result
  3225. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx);
  3226. --ieee80211_tx_result
  3227. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx);
  3228. --ieee80211_rx_result
  3229. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx);
  3230. - ieee80211_tx_result
  3231. - ieee80211_crypto_hw_encrypt(struct ieee80211_tx_data *tx);
  3232. - ieee80211_rx_result
  3233. - ieee80211_crypto_hw_decrypt(struct ieee80211_rx_data *rx);
  3234. -
  3235. --ieee80211_tx_result
  3236. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx);
  3237. --ieee80211_rx_result
  3238. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx);
  3239. --
  3240. - #endif /* WPA_H */
  3241. diff --git a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  3242. index 41a3c4f..cff6d89 100644
  3243. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  3244. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  3245. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  3246. --- a/net/mac80211/cfg.c
  3247. +++ b/net/mac80211/cfg.c
  3248. -@@ -856,7 +856,6 @@ static int ieee80211_stop_ap(struct wiph
  3249. +@@ -886,7 +886,6 @@ static int ieee80211_stop_ap(struct wiph
  3250. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  3251. __sta_info_flush(sdata, true);
  3252. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  3253. index de79bd2..5fc9454 100644
  3254. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  3255. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  3256. @@ -18,7 +18,7 @@
  3257. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  3258. unsigned long data, void *arg)
  3259. {
  3260. -@@ -1057,14 +1057,14 @@ int ieee80211_register_hw(struct ieee802
  3261. +@@ -1086,14 +1086,14 @@ int ieee80211_register_hw(struct ieee802
  3262. if (result)
  3263. goto fail_pm_qos;
  3264. @@ -35,7 +35,7 @@
  3265. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  3266. result = register_inet6addr_notifier(&local->ifa6_notifier);
  3267. if (result)
  3268. -@@ -1073,13 +1073,13 @@ int ieee80211_register_hw(struct ieee802
  3269. +@@ -1102,13 +1102,13 @@ int ieee80211_register_hw(struct ieee802
  3270. return 0;
  3271. @@ -52,7 +52,7 @@
  3272. fail_ifa:
  3273. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  3274. &local->network_latency_notifier);
  3275. -@@ -1124,10 +1124,10 @@ void ieee80211_unregister_hw(struct ieee
  3276. +@@ -1141,10 +1141,10 @@ void ieee80211_unregister_hw(struct ieee
  3277. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  3278. &local->network_latency_notifier);
  3279. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  3280. index 47dcec3..29f05c4 100644
  3281. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  3282. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  3283. @@ -1,6 +1,6 @@
  3284. --- a/net/mac80211/cfg.c
  3285. +++ b/net/mac80211/cfg.c
  3286. -@@ -1963,7 +1963,7 @@ static int ieee80211_scan(struct wiphy *
  3287. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  3288. * the frames sent while scanning on other channel will be
  3289. * lost)
  3290. */
  3291. diff --git a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  3292. new file mode 100644
  3293. index 0000000..bddb15a
  3294. --- /dev/null
  3295. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  3296. @@ -0,0 +1,31 @@
  3297. +From: Felix Fietkau <nbd@openwrt.org>
  3298. +Date: Sun, 7 Jun 2015 13:53:35 +0200
  3299. +Subject: [PATCH] ath9k: force rx_clear when disabling rx
  3300. +
  3301. +This makes stopping Rx more reliable and should reduce the frequency of
  3302. +Rx related DMA stop warnings
  3303. +
  3304. +Cc: stable@vger.kernel.org
  3305. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3306. +---
  3307. +
  3308. +--- a/drivers/net/wireless/ath/ath9k/mac.c
  3309. ++++ b/drivers/net/wireless/ath/ath9k/mac.c
  3310. +@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  3311. +
  3312. + ath9k_ani_reset(ah, is_scanning);
  3313. +
  3314. +- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  3315. ++ REG_CLR_BIT(ah, AR_DIAG_SW,
  3316. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  3317. + }
  3318. + EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  3319. +
  3320. + void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  3321. + {
  3322. +- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  3323. ++ REG_SET_BIT(ah, AR_DIAG_SW,
  3324. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  3325. +
  3326. + ath9k_hw_disable_mib_counters(ah);
  3327. + }
  3328. diff --git a/package/kernel/mac80211/patches/300-mac80211-add-an-intermediate-software-queue-implemen.patch b/package/kernel/mac80211/patches/300-mac80211-add-an-intermediate-software-queue-implemen.patch
  3329. deleted file mode 100644
  3330. index 237121b..0000000
  3331. --- a/package/kernel/mac80211/patches/300-mac80211-add-an-intermediate-software-queue-implemen.patch
  3332. +++ /dev/null
  3333. @@ -1,882 +0,0 @@
  3334. -From: Felix Fietkau <nbd@openwrt.org>
  3335. -Date: Tue, 18 Nov 2014 23:58:51 +0100
  3336. -Subject: [PATCH] mac80211: add an intermediate software queue implementation
  3337. -
  3338. -This allows drivers to request per-vif and per-sta-tid queues from which
  3339. -they can pull frames. This makes it easier to keep the hardware queues
  3340. -short, and to improve fairness between clients and vifs.
  3341. -
  3342. -The task of scheduling packet transmission is left up to the driver -
  3343. -queueing is controlled by mac80211. Drivers can only dequeue packets by
  3344. -calling ieee80211_tx_dequeue. This makes it possible to add active queue
  3345. -management later without changing drivers using this code.
  3346. -
  3347. -This can also be used as a starting point to implement A-MSDU
  3348. -aggregation in a way that does not add artificially induced latency.
  3349. -
  3350. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3351. ----
  3352. -
  3353. ---- a/include/net/mac80211.h
  3354. -+++ b/include/net/mac80211.h
  3355. -@@ -84,6 +84,39 @@
  3356. - *
  3357. - */
  3358. -
  3359. -+/**
  3360. -+ * DOC: mac80211 software tx queueing
  3361. -+ *
  3362. -+ * mac80211 provides an optional intermediate queueing implementation designed
  3363. -+ * to allow the driver to keep hardware queues short and provide some fairness
  3364. -+ * between different stations/interfaces.
  3365. -+ * In this model, the driver pulls data frames from the mac80211 queue instead
  3366. -+ * of letting mac80211 push them via drv_tx().
  3367. -+ * Other frames (e.g. control or management) are still pushed using drv_tx().
  3368. -+ *
  3369. -+ * Drivers indicate that they use this model by implementing the .wake_tx_queue
  3370. -+ * driver operation.
  3371. -+ *
  3372. -+ * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with a
  3373. -+ * single per-vif queue for multicast data frames.
  3374. -+ *
  3375. -+ * The driver is expected to initialize its private per-queue data for stations
  3376. -+ * and interfaces in the .add_interface and .sta_add ops.
  3377. -+ *
  3378. -+ * The driver can't access the queue directly. To dequeue a frame, it calls
  3379. -+ * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
  3380. -+ * calls the .wake_tx_queue driver op.
  3381. -+ *
  3382. -+ * For AP powersave TIM handling, the driver only needs to indicate if it has
  3383. -+ * buffered packets in the driver specific data structures by calling
  3384. -+ * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
  3385. -+ * struct, mac80211 sets the appropriate TIM PVB bits and calls
  3386. -+ * .release_buffered_frames().
  3387. -+ * In that callback the driver is therefore expected to release its own
  3388. -+ * buffered frames and afterwards also frames from the ieee80211_txq (obtained
  3389. -+ * via the usual ieee80211_tx_dequeue).
  3390. -+ */
  3391. -+
  3392. - struct device;
  3393. -
  3394. - /**
  3395. -@@ -1246,6 +1279,7 @@ enum ieee80211_vif_flags {
  3396. - * monitor interface (if that is requested.)
  3397. - * @drv_priv: data area for driver use, will always be aligned to
  3398. - * sizeof(void *).
  3399. -+ * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
  3400. - */
  3401. - struct ieee80211_vif {
  3402. - enum nl80211_iftype type;
  3403. -@@ -1257,6 +1291,8 @@ struct ieee80211_vif {
  3404. - u8 cab_queue;
  3405. - u8 hw_queue[IEEE80211_NUM_ACS];
  3406. -
  3407. -+ struct ieee80211_txq *txq;
  3408. -+
  3409. - struct ieee80211_chanctx_conf __rcu *chanctx_conf;
  3410. -
  3411. - u32 driver_flags;
  3412. -@@ -1501,6 +1537,7 @@ struct ieee80211_sta_rates {
  3413. - * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
  3414. - * valid if the STA is a TDLS peer in the first place.
  3415. - * @mfp: indicates whether the STA uses management frame protection or not.
  3416. -+ * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  3417. - */
  3418. - struct ieee80211_sta {
  3419. - u32 supp_rates[IEEE80211_NUM_BANDS];
  3420. -@@ -1519,6 +1556,8 @@ struct ieee80211_sta {
  3421. - bool tdls_initiator;
  3422. - bool mfp;
  3423. -
  3424. -+ struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  3425. -+
  3426. - /* must be last */
  3427. - u8 drv_priv[0] __aligned(sizeof(void *));
  3428. - };
  3429. -@@ -1547,6 +1586,27 @@ struct ieee80211_tx_control {
  3430. - };
  3431. -
  3432. - /**
  3433. -+ * struct ieee80211_txq - Software intermediate tx queue
  3434. -+ *
  3435. -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  3436. -+ * @sta: station table entry, %NULL for per-vif queue
  3437. -+ * @tid: the TID for this queue (unused for per-vif queue)
  3438. -+ * @ac: the AC for this queue
  3439. -+ *
  3440. -+ * The driver can obtain packets from this queue by calling
  3441. -+ * ieee80211_tx_dequeue().
  3442. -+ */
  3443. -+struct ieee80211_txq {
  3444. -+ struct ieee80211_vif *vif;
  3445. -+ struct ieee80211_sta *sta;
  3446. -+ u8 tid;
  3447. -+ u8 ac;
  3448. -+
  3449. -+ /* must be last */
  3450. -+ u8 drv_priv[0] __aligned(sizeof(void *));
  3451. -+};
  3452. -+
  3453. -+/**
  3454. - * enum ieee80211_hw_flags - hardware flags
  3455. - *
  3456. - * These flags are used to indicate hardware capabilities to
  3457. -@@ -1770,6 +1830,8 @@ enum ieee80211_hw_flags {
  3458. - * within &struct ieee80211_sta.
  3459. - * @chanctx_data_size: size (in bytes) of the drv_priv data area
  3460. - * within &struct ieee80211_chanctx_conf.
  3461. -+ * @txq_data_size: size (in bytes) of the drv_priv data area
  3462. -+ * within @struct ieee80211_txq.
  3463. - *
  3464. - * @max_rates: maximum number of alternate rate retry stages the hw
  3465. - * can handle.
  3466. -@@ -1818,6 +1880,9 @@ enum ieee80211_hw_flags {
  3467. - * @n_cipher_schemes: a size of an array of cipher schemes definitions.
  3468. - * @cipher_schemes: a pointer to an array of cipher scheme definitions
  3469. - * supported by HW.
  3470. -+ *
  3471. -+ * @txq_ac_max_pending: maximum number of frames per AC pending in all txq
  3472. -+ * entries for a vif.
  3473. - */
  3474. - struct ieee80211_hw {
  3475. - struct ieee80211_conf conf;
  3476. -@@ -1830,6 +1895,7 @@ struct ieee80211_hw {
  3477. - int vif_data_size;
  3478. - int sta_data_size;
  3479. - int chanctx_data_size;
  3480. -+ int txq_data_size;
  3481. - u16 queues;
  3482. - u16 max_listen_interval;
  3483. - s8 max_signal;
  3484. -@@ -1846,6 +1912,7 @@ struct ieee80211_hw {
  3485. - u8 uapsd_max_sp_len;
  3486. - u8 n_cipher_schemes;
  3487. - const struct ieee80211_cipher_scheme *cipher_schemes;
  3488. -+ int txq_ac_max_pending;
  3489. - };
  3490. -
  3491. - /**
  3492. -@@ -3007,6 +3074,8 @@ enum ieee80211_reconfig_type {
  3493. - * response template is provided, together with the location of the
  3494. - * switch-timing IE within the template. The skb can only be used within
  3495. - * the function call.
  3496. -+ *
  3497. -+ * @wake_tx_queue: Called when new packets have been added to the queue.
  3498. - */
  3499. - struct ieee80211_ops {
  3500. - void (*tx)(struct ieee80211_hw *hw,
  3501. -@@ -3238,6 +3307,9 @@ struct ieee80211_ops {
  3502. - void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
  3503. - struct ieee80211_vif *vif,
  3504. - struct ieee80211_tdls_ch_sw_params *params);
  3505. -+
  3506. -+ void (*wake_tx_queue)(struct ieee80211_hw *hw,
  3507. -+ struct ieee80211_txq *txq);
  3508. - };
  3509. -
  3510. - /**
  3511. -@@ -5249,4 +5321,15 @@ void ieee80211_unreserve_tid(struct ieee
  3512. - */
  3513. - size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
  3514. - const u8 *ids, int n_ids, size_t offset);
  3515. -+
  3516. -+/**
  3517. -+ * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
  3518. -+ *
  3519. -+ * @hw: pointer as obtained from ieee80211_alloc_hw()
  3520. -+ * @txq: pointer obtained from station or virtual interface
  3521. -+ *
  3522. -+ * Returns the skb if successful, %NULL if no frame was available.
  3523. -+ */
  3524. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  3525. -+ struct ieee80211_txq *txq);
  3526. - #endif /* MAC80211_H */
  3527. ---- a/net/mac80211/driver-ops.h
  3528. -+++ b/net/mac80211/driver-ops.h
  3529. -@@ -1367,4 +1367,16 @@ drv_tdls_recv_channel_switch(struct ieee
  3530. - trace_drv_return_void(local);
  3531. - }
  3532. -
  3533. -+static inline void drv_wake_tx_queue(struct ieee80211_local *local,
  3534. -+ struct txq_info *txq)
  3535. -+{
  3536. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
  3537. -+
  3538. -+ if (!check_sdata_in_driver(sdata))
  3539. -+ return;
  3540. -+
  3541. -+ trace_drv_wake_tx_queue(local, sdata, txq);
  3542. -+ local->ops->wake_tx_queue(&local->hw, &txq->txq);
  3543. -+}
  3544. -+
  3545. - #endif /* __MAC80211_DRIVER_OPS */
  3546. ---- a/net/mac80211/ieee80211_i.h
  3547. -+++ b/net/mac80211/ieee80211_i.h
  3548. -@@ -809,6 +809,19 @@ struct mac80211_qos_map {
  3549. - struct rcu_head rcu_head;
  3550. - };
  3551. -
  3552. -+enum txq_info_flags {
  3553. -+ IEEE80211_TXQ_STOP,
  3554. -+ IEEE80211_TXQ_AMPDU,
  3555. -+};
  3556. -+
  3557. -+struct txq_info {
  3558. -+ struct sk_buff_head queue;
  3559. -+ unsigned long flags;
  3560. -+
  3561. -+ /* keep last! */
  3562. -+ struct ieee80211_txq txq;
  3563. -+};
  3564. -+
  3565. - struct ieee80211_sub_if_data {
  3566. - struct list_head list;
  3567. -
  3568. -@@ -853,6 +866,7 @@ struct ieee80211_sub_if_data {
  3569. - bool control_port_no_encrypt;
  3570. - int encrypt_headroom;
  3571. -
  3572. -+ atomic_t txqs_len[IEEE80211_NUM_ACS];
  3573. - struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
  3574. - struct mac80211_qos_map __rcu *qos_map;
  3575. -
  3576. -@@ -1453,6 +1467,10 @@ static inline struct ieee80211_local *hw
  3577. - return container_of(hw, struct ieee80211_local, hw);
  3578. - }
  3579. -
  3580. -+static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
  3581. -+{
  3582. -+ return container_of(txq, struct txq_info, txq);
  3583. -+}
  3584. -
  3585. - static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
  3586. - {
  3587. -@@ -1905,6 +1923,9 @@ static inline bool ieee80211_can_run_wor
  3588. - return true;
  3589. - }
  3590. -
  3591. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  3592. -+ struct sta_info *sta,
  3593. -+ struct txq_info *txq, int tid);
  3594. - void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
  3595. - u16 transaction, u16 auth_alg, u16 status,
  3596. - const u8 *extra, size_t extra_len, const u8 *bssid,
  3597. ---- a/net/mac80211/iface.c
  3598. -+++ b/net/mac80211/iface.c
  3599. -@@ -969,6 +969,13 @@ static void ieee80211_do_stop(struct iee
  3600. - }
  3601. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  3602. -
  3603. -+ if (sdata->vif.txq) {
  3604. -+ struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  3605. -+
  3606. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  3607. -+ atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  3608. -+ }
  3609. -+
  3610. - if (local->open_count == 0)
  3611. - ieee80211_clear_tx_pending(local);
  3612. -
  3613. -@@ -1674,6 +1681,7 @@ int ieee80211_if_add(struct ieee80211_lo
  3614. - {
  3615. - struct net_device *ndev = NULL;
  3616. - struct ieee80211_sub_if_data *sdata = NULL;
  3617. -+ struct txq_info *txqi;
  3618. - int ret, i;
  3619. - int txqs = 1;
  3620. -
  3621. -@@ -1693,10 +1701,18 @@ int ieee80211_if_add(struct ieee80211_lo
  3622. - ieee80211_assign_perm_addr(local, wdev->address, type);
  3623. - memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
  3624. - } else {
  3625. -+ int size = ALIGN(sizeof(*sdata) + local->hw.vif_data_size,
  3626. -+ sizeof(void *));
  3627. -+ int txq_size = 0;
  3628. -+
  3629. -+ if (local->ops->wake_tx_queue)
  3630. -+ txq_size += sizeof(struct txq_info) +
  3631. -+ local->hw.txq_data_size;
  3632. -+
  3633. - if (local->hw.queues >= IEEE80211_NUM_ACS)
  3634. - txqs = IEEE80211_NUM_ACS;
  3635. -
  3636. -- ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size,
  3637. -+ ndev = alloc_netdev_mqs(size + txq_size,
  3638. - name, NET_NAME_UNKNOWN,
  3639. - ieee80211_if_setup, txqs, 1);
  3640. - if (!ndev)
  3641. -@@ -1731,6 +1747,11 @@ int ieee80211_if_add(struct ieee80211_lo
  3642. - memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN);
  3643. - memcpy(sdata->name, ndev->name, IFNAMSIZ);
  3644. -
  3645. -+ if (txq_size) {
  3646. -+ txqi = netdev_priv(ndev) + size;
  3647. -+ ieee80211_init_tx_queue(sdata, NULL, txqi, 0);
  3648. -+ }
  3649. -+
  3650. - sdata->dev = ndev;
  3651. - }
  3652. -
  3653. ---- a/net/mac80211/main.c
  3654. -+++ b/net/mac80211/main.c
  3655. -@@ -1019,6 +1019,9 @@ int ieee80211_register_hw(struct ieee802
  3656. -
  3657. - local->dynamic_ps_forced_timeout = -1;
  3658. -
  3659. -+ if (!local->hw.txq_ac_max_pending)
  3660. -+ local->hw.txq_ac_max_pending = 64;
  3661. -+
  3662. - result = ieee80211_wep_init(local);
  3663. - if (result < 0)
  3664. - wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
  3665. ---- a/net/mac80211/sta_info.c
  3666. -+++ b/net/mac80211/sta_info.c
  3667. -@@ -118,6 +118,16 @@ static void __cleanup_single_sta(struct
  3668. - atomic_dec(&ps->num_sta_ps);
  3669. - }
  3670. -
  3671. -+ if (sta->sta.txq[0]) {
  3672. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  3673. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  3674. -+ int n = skb_queue_len(&txqi->queue);
  3675. -+
  3676. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  3677. -+ atomic_sub(n, &sdata->txqs_len[txqi->txq.ac]);
  3678. -+ }
  3679. -+ }
  3680. -+
  3681. - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
  3682. - local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]);
  3683. - ieee80211_purge_tx_queue(&local->hw, &sta->ps_tx_buf[ac]);
  3684. -@@ -234,6 +244,8 @@ void sta_info_free(struct ieee80211_loca
  3685. -
  3686. - sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
  3687. -
  3688. -+ if (sta->sta.txq[0])
  3689. -+ kfree(to_txq_info(sta->sta.txq[0]));
  3690. - kfree(rcu_dereference_raw(sta->sta.rates));
  3691. - kfree(sta);
  3692. - }
  3693. -@@ -285,11 +297,12 @@ struct sta_info *sta_info_alloc(struct i
  3694. - const u8 *addr, gfp_t gfp)
  3695. - {
  3696. - struct ieee80211_local *local = sdata->local;
  3697. -+ struct ieee80211_hw *hw = &local->hw;
  3698. - struct sta_info *sta;
  3699. - struct timespec uptime;
  3700. - int i;
  3701. -
  3702. -- sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp);
  3703. -+ sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp);
  3704. - if (!sta)
  3705. - return NULL;
  3706. -
  3707. -@@ -321,11 +334,25 @@ struct sta_info *sta_info_alloc(struct i
  3708. - for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++)
  3709. - ewma_init(&sta->chain_signal_avg[i], 1024, 8);
  3710. -
  3711. -- if (sta_prepare_rate_control(local, sta, gfp)) {
  3712. -- kfree(sta);
  3713. -- return NULL;
  3714. -+ if (local->ops->wake_tx_queue) {
  3715. -+ void *txq_data;
  3716. -+ int size = sizeof(struct txq_info) +
  3717. -+ ALIGN(hw->txq_data_size, sizeof(void *));
  3718. -+
  3719. -+ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp);
  3720. -+ if (!txq_data)
  3721. -+ goto free;
  3722. -+
  3723. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  3724. -+ struct txq_info *txq = txq_data + i * size;
  3725. -+
  3726. -+ ieee80211_init_tx_queue(sdata, sta, txq, i);
  3727. -+ }
  3728. - }
  3729. -
  3730. -+ if (sta_prepare_rate_control(local, sta, gfp))
  3731. -+ goto free_txq;
  3732. -+
  3733. - for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
  3734. - /*
  3735. - * timer_to_tid must be initialized with identity mapping
  3736. -@@ -346,7 +373,7 @@ struct sta_info *sta_info_alloc(struct i
  3737. - if (sdata->vif.type == NL80211_IFTYPE_AP ||
  3738. - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  3739. - struct ieee80211_supported_band *sband =
  3740. -- local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)];
  3741. -+ hw->wiphy->bands[ieee80211_get_sdata_band(sdata)];
  3742. - u8 smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >>
  3743. - IEEE80211_HT_CAP_SM_PS_SHIFT;
  3744. - /*
  3745. -@@ -371,6 +398,13 @@ struct sta_info *sta_info_alloc(struct i
  3746. - sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
  3747. -
  3748. - return sta;
  3749. -+
  3750. -+free_txq:
  3751. -+ if (sta->sta.txq[0])
  3752. -+ kfree(to_txq_info(sta->sta.txq[0]));
  3753. -+free:
  3754. -+ kfree(sta);
  3755. -+ return NULL;
  3756. - }
  3757. -
  3758. - static int sta_info_insert_check(struct sta_info *sta)
  3759. -@@ -640,6 +674,8 @@ static void __sta_info_recalc_tim(struct
  3760. -
  3761. - indicate_tim |=
  3762. - sta->driver_buffered_tids & tids;
  3763. -+ indicate_tim |=
  3764. -+ sta->txq_buffered_tids & tids;
  3765. - }
  3766. -
  3767. - done:
  3768. -@@ -1071,7 +1107,7 @@ void ieee80211_sta_ps_deliver_wakeup(str
  3769. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  3770. - struct ieee80211_local *local = sdata->local;
  3771. - struct sk_buff_head pending;
  3772. -- int filtered = 0, buffered = 0, ac;
  3773. -+ int filtered = 0, buffered = 0, ac, i;
  3774. - unsigned long flags;
  3775. - struct ps_data *ps;
  3776. -
  3777. -@@ -1090,10 +1126,22 @@ void ieee80211_sta_ps_deliver_wakeup(str
  3778. -
  3779. - BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1);
  3780. - sta->driver_buffered_tids = 0;
  3781. -+ sta->txq_buffered_tids = 0;
  3782. -
  3783. - if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
  3784. - drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
  3785. -
  3786. -+ if (sta->sta.txq[0]) {
  3787. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  3788. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  3789. -+
  3790. -+ if (!skb_queue_len(&txqi->queue))
  3791. -+ continue;
  3792. -+
  3793. -+ drv_wake_tx_queue(local, txqi);
  3794. -+ }
  3795. -+ }
  3796. -+
  3797. - skb_queue_head_init(&pending);
  3798. -
  3799. - /* sync with ieee80211_tx_h_unicast_ps_buf */
  3800. -@@ -1275,8 +1323,10 @@ ieee80211_sta_ps_deliver_response(struct
  3801. - /* if we already have frames from software, then we can't also
  3802. - * release from hardware queues
  3803. - */
  3804. -- if (skb_queue_empty(&frames))
  3805. -+ if (skb_queue_empty(&frames)) {
  3806. - driver_release_tids |= sta->driver_buffered_tids & tids;
  3807. -+ driver_release_tids |= sta->txq_buffered_tids & tids;
  3808. -+ }
  3809. -
  3810. - if (driver_release_tids) {
  3811. - /* If the driver has data on more than one TID then
  3812. -@@ -1447,6 +1497,9 @@ ieee80211_sta_ps_deliver_response(struct
  3813. -
  3814. - sta_info_recalc_tim(sta);
  3815. - } else {
  3816. -+ unsigned long tids = sta->txq_buffered_tids & driver_release_tids;
  3817. -+ int tid;
  3818. -+
  3819. - /*
  3820. - * We need to release a frame that is buffered somewhere in the
  3821. - * driver ... it'll have to handle that.
  3822. -@@ -1466,8 +1519,22 @@ ieee80211_sta_ps_deliver_response(struct
  3823. - * that the TID(s) became empty before returning here from the
  3824. - * release function.
  3825. - * Either way, however, when the driver tells us that the TID(s)
  3826. -- * became empty we'll do the TIM recalculation.
  3827. -+ * became empty or we find that a txq became empty, we'll do the
  3828. -+ * TIM recalculation.
  3829. - */
  3830. -+
  3831. -+ if (!sta->sta.txq[0])
  3832. -+ return;
  3833. -+
  3834. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  3835. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  3836. -+
  3837. -+ if (!(tids & BIT(tid)) || skb_queue_len(&txqi->queue))
  3838. -+ continue;
  3839. -+
  3840. -+ sta_info_recalc_tim(sta);
  3841. -+ break;
  3842. -+ }
  3843. - }
  3844. - }
  3845. -
  3846. ---- a/net/mac80211/sta_info.h
  3847. -+++ b/net/mac80211/sta_info.h
  3848. -@@ -274,6 +274,7 @@ struct sta_ampdu_mlme {
  3849. - * entered power saving state, these are also delivered to
  3850. - * the station when it leaves powersave or polls for frames
  3851. - * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
  3852. -+ * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on
  3853. - * @rx_packets: Number of MSDUs received from this STA
  3854. - * @rx_bytes: Number of bytes received from this STA
  3855. - * @last_rx: time (in jiffies) when last frame was received from this STA
  3856. -@@ -368,6 +369,7 @@ struct sta_info {
  3857. - struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];
  3858. - struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];
  3859. - unsigned long driver_buffered_tids;
  3860. -+ unsigned long txq_buffered_tids;
  3861. -
  3862. - /* Updated from RX path only, no locking requirements */
  3863. - unsigned long rx_packets;
  3864. ---- a/net/mac80211/trace.h
  3865. -+++ b/net/mac80211/trace.h
  3866. -@@ -2312,6 +2312,37 @@ TRACE_EVENT(drv_tdls_recv_channel_switch
  3867. - )
  3868. - );
  3869. -
  3870. -+TRACE_EVENT(drv_wake_tx_queue,
  3871. -+ TP_PROTO(struct ieee80211_local *local,
  3872. -+ struct ieee80211_sub_if_data *sdata,
  3873. -+ struct txq_info *txq),
  3874. -+
  3875. -+ TP_ARGS(local, sdata, txq),
  3876. -+
  3877. -+ TP_STRUCT__entry(
  3878. -+ LOCAL_ENTRY
  3879. -+ VIF_ENTRY
  3880. -+ STA_ENTRY
  3881. -+ __field(u8, ac)
  3882. -+ __field(u8, tid)
  3883. -+ ),
  3884. -+
  3885. -+ TP_fast_assign(
  3886. -+ struct ieee80211_sta *sta = txq->txq.sta;
  3887. -+
  3888. -+ LOCAL_ASSIGN;
  3889. -+ VIF_ASSIGN;
  3890. -+ STA_ASSIGN;
  3891. -+ __entry->ac = txq->txq.ac;
  3892. -+ __entry->tid = txq->txq.tid;
  3893. -+ ),
  3894. -+
  3895. -+ TP_printk(
  3896. -+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " ac:%d tid:%d",
  3897. -+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->ac, __entry->tid
  3898. -+ )
  3899. -+);
  3900. -+
  3901. - #ifdef CPTCFG_MAC80211_MESSAGE_TRACING
  3902. - #undef TRACE_SYSTEM
  3903. - #define TRACE_SYSTEM mac80211_msg
  3904. ---- a/net/mac80211/tx.c
  3905. -+++ b/net/mac80211/tx.c
  3906. -@@ -776,12 +776,22 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  3907. - return TX_CONTINUE;
  3908. - }
  3909. -
  3910. -+static __le16 ieee80211_tx_next_seq(struct sta_info *sta, int tid)
  3911. -+{
  3912. -+ u16 *seq = &sta->tid_seq[tid];
  3913. -+ __le16 ret = cpu_to_le16(*seq);
  3914. -+
  3915. -+ /* Increase the sequence number. */
  3916. -+ *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  3917. -+
  3918. -+ return ret;
  3919. -+}
  3920. -+
  3921. - static ieee80211_tx_result debug_noinline
  3922. - ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
  3923. - {
  3924. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
  3925. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
  3926. -- u16 *seq;
  3927. - u8 *qc;
  3928. - int tid;
  3929. -
  3930. -@@ -832,13 +842,10 @@ ieee80211_tx_h_sequence(struct ieee80211
  3931. -
  3932. - qc = ieee80211_get_qos_ctl(hdr);
  3933. - tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
  3934. -- seq = &tx->sta->tid_seq[tid];
  3935. - tx->sta->tx_msdu[tid]++;
  3936. -
  3937. -- hdr->seq_ctrl = cpu_to_le16(*seq);
  3938. --
  3939. -- /* Increase the sequence number. */
  3940. -- *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  3941. -+ if (!tx->sta->sta.txq[0])
  3942. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);
  3943. -
  3944. - return TX_CONTINUE;
  3945. - }
  3946. -@@ -1067,7 +1074,7 @@ static bool ieee80211_tx_prep_agg(struct
  3947. - * nothing -- this aggregation session is being started
  3948. - * but that might still fail with the driver
  3949. - */
  3950. -- } else {
  3951. -+ } else if (!tx->sta->sta.txq[tid]) {
  3952. - spin_lock(&tx->sta->lock);
  3953. - /*
  3954. - * Need to re-check now, because we may get here
  3955. -@@ -1201,13 +1208,102 @@ ieee80211_tx_prepare(struct ieee80211_su
  3956. - return TX_CONTINUE;
  3957. - }
  3958. -
  3959. -+static void ieee80211_drv_tx(struct ieee80211_local *local,
  3960. -+ struct ieee80211_vif *vif,
  3961. -+ struct ieee80211_sta *pubsta,
  3962. -+ struct sk_buff *skb)
  3963. -+{
  3964. -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  3965. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
  3966. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  3967. -+ struct ieee80211_tx_control control = {
  3968. -+ .sta = pubsta,
  3969. -+ };
  3970. -+ struct ieee80211_txq *txq = NULL;
  3971. -+ struct txq_info *txqi;
  3972. -+ u8 ac;
  3973. -+
  3974. -+ if (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)
  3975. -+ goto tx_normal;
  3976. -+
  3977. -+ if (!ieee80211_is_data(hdr->frame_control))
  3978. -+ goto tx_normal;
  3979. -+
  3980. -+ if (pubsta) {
  3981. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
  3982. -+
  3983. -+ txq = pubsta->txq[tid];
  3984. -+ } else if (vif) {
  3985. -+ txq = vif->txq;
  3986. -+ }
  3987. -+
  3988. -+ if (!txq)
  3989. -+ goto tx_normal;
  3990. -+
  3991. -+ ac = txq->ac;
  3992. -+ txqi = to_txq_info(txq);
  3993. -+ atomic_inc(&sdata->txqs_len[ac]);
  3994. -+ if (atomic_read(&sdata->txqs_len[ac]) >= local->hw.txq_ac_max_pending)
  3995. -+ netif_stop_subqueue(sdata->dev, ac);
  3996. -+
  3997. -+ skb_queue_tail(&txqi->queue, skb);
  3998. -+ drv_wake_tx_queue(local, txqi);
  3999. -+
  4000. -+ return;
  4001. -+
  4002. -+tx_normal:
  4003. -+ drv_tx(local, &control, skb);
  4004. -+}
  4005. -+
  4006. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  4007. -+ struct ieee80211_txq *txq)
  4008. -+{
  4009. -+ struct ieee80211_local *local = hw_to_local(hw);
  4010. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif);
  4011. -+ struct txq_info *txqi = container_of(txq, struct txq_info, txq);
  4012. -+ struct ieee80211_hdr *hdr;
  4013. -+ struct sk_buff *skb = NULL;
  4014. -+ u8 ac = txq->ac;
  4015. -+
  4016. -+ spin_lock_bh(&txqi->queue.lock);
  4017. -+
  4018. -+ if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags))
  4019. -+ goto out;
  4020. -+
  4021. -+ skb = __skb_dequeue(&txqi->queue);
  4022. -+ if (!skb)
  4023. -+ goto out;
  4024. -+
  4025. -+ atomic_dec(&sdata->txqs_len[ac]);
  4026. -+ if (__netif_subqueue_stopped(sdata->dev, ac))
  4027. -+ ieee80211_propagate_queue_wake(local, sdata->vif.hw_queue[ac]);
  4028. -+
  4029. -+ hdr = (struct ieee80211_hdr *)skb->data;
  4030. -+ if (txq->sta && ieee80211_is_data_qos(hdr->frame_control)) {
  4031. -+ struct sta_info *sta = container_of(txq->sta, struct sta_info,
  4032. -+ sta);
  4033. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  4034. -+
  4035. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, txq->tid);
  4036. -+ if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
  4037. -+ info->flags |= IEEE80211_TX_CTL_AMPDU;
  4038. -+ else
  4039. -+ info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  4040. -+ }
  4041. -+
  4042. -+out:
  4043. -+ spin_unlock_bh(&txqi->queue.lock);
  4044. -+
  4045. -+ return skb;
  4046. -+}
  4047. -+EXPORT_SYMBOL(ieee80211_tx_dequeue);
  4048. -+
  4049. - static bool ieee80211_tx_frags(struct ieee80211_local *local,
  4050. - struct ieee80211_vif *vif,
  4051. - struct ieee80211_sta *sta,
  4052. - struct sk_buff_head *skbs,
  4053. - bool txpending)
  4054. - {
  4055. -- struct ieee80211_tx_control control;
  4056. - struct sk_buff *skb, *tmp;
  4057. - unsigned long flags;
  4058. -
  4059. -@@ -1265,10 +1361,9 @@ static bool ieee80211_tx_frags(struct ie
  4060. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  4061. -
  4062. - info->control.vif = vif;
  4063. -- control.sta = sta;
  4064. -
  4065. - __skb_unlink(skb, skbs);
  4066. -- drv_tx(local, &control, skb);
  4067. -+ ieee80211_drv_tx(local, vif, sta, skb);
  4068. - }
  4069. -
  4070. - return true;
  4071. ---- a/net/mac80211/util.c
  4072. -+++ b/net/mac80211/util.c
  4073. -@@ -308,6 +308,11 @@ void ieee80211_propagate_queue_wake(stru
  4074. - for (ac = 0; ac < n_acs; ac++) {
  4075. - int ac_queue = sdata->vif.hw_queue[ac];
  4076. -
  4077. -+ if (local->ops->wake_tx_queue &&
  4078. -+ (atomic_read(&sdata->txqs_len[ac]) >
  4079. -+ local->hw.txq_ac_max_pending))
  4080. -+ continue;
  4081. -+
  4082. - if (ac_queue == queue ||
  4083. - (sdata->vif.cab_queue == queue &&
  4084. - local->queue_stop_reasons[ac_queue] == 0 &&
  4085. -@@ -3307,3 +3312,20 @@ u8 *ieee80211_add_wmm_info_ie(u8 *buf, u
  4086. -
  4087. - return buf;
  4088. - }
  4089. -+
  4090. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  4091. -+ struct sta_info *sta,
  4092. -+ struct txq_info *txqi, int tid)
  4093. -+{
  4094. -+ skb_queue_head_init(&txqi->queue);
  4095. -+ txqi->txq.vif = &sdata->vif;
  4096. -+
  4097. -+ if (sta) {
  4098. -+ txqi->txq.sta = &sta->sta;
  4099. -+ sta->sta.txq[tid] = &txqi->txq;
  4100. -+ txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  4101. -+ } else {
  4102. -+ sdata->vif.txq = &txqi->txq;
  4103. -+ txqi->txq.ac = IEEE80211_AC_BE;
  4104. -+ }
  4105. -+}
  4106. ---- a/net/mac80211/rx.c
  4107. -+++ b/net/mac80211/rx.c
  4108. -@@ -1176,6 +1176,7 @@ static void sta_ps_start(struct sta_info
  4109. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  4110. - struct ieee80211_local *local = sdata->local;
  4111. - struct ps_data *ps;
  4112. -+ int tid;
  4113. -
  4114. - if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
  4115. - sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
  4116. -@@ -1189,6 +1190,18 @@ static void sta_ps_start(struct sta_info
  4117. - drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
  4118. - ps_dbg(sdata, "STA %pM aid %d enters power save mode\n",
  4119. - sta->sta.addr, sta->sta.aid);
  4120. -+
  4121. -+ if (!sta->sta.txq[0])
  4122. -+ return;
  4123. -+
  4124. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  4125. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  4126. -+
  4127. -+ if (!skb_queue_len(&txqi->queue))
  4128. -+ set_bit(tid, &sta->txq_buffered_tids);
  4129. -+ else
  4130. -+ clear_bit(tid, &sta->txq_buffered_tids);
  4131. -+ }
  4132. - }
  4133. -
  4134. - static void sta_ps_end(struct sta_info *sta)
  4135. ---- a/net/mac80211/agg-tx.c
  4136. -+++ b/net/mac80211/agg-tx.c
  4137. -@@ -188,6 +188,43 @@ ieee80211_wake_queue_agg(struct ieee8021
  4138. - __release(agg_queue);
  4139. - }
  4140. -
  4141. -+static void
  4142. -+ieee80211_agg_stop_txq(struct sta_info *sta, int tid)
  4143. -+{
  4144. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  4145. -+ struct txq_info *txqi;
  4146. -+
  4147. -+ if (!txq)
  4148. -+ return;
  4149. -+
  4150. -+ txqi = to_txq_info(txq);
  4151. -+
  4152. -+ /* Lock here to protect against further seqno updates on dequeue */
  4153. -+ spin_lock_bh(&txqi->queue.lock);
  4154. -+ set_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  4155. -+ spin_unlock_bh(&txqi->queue.lock);
  4156. -+}
  4157. -+
  4158. -+static void
  4159. -+ieee80211_agg_start_txq(struct sta_info *sta, int tid, bool enable)
  4160. -+{
  4161. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  4162. -+ struct txq_info *txqi;
  4163. -+
  4164. -+ if (!txq)
  4165. -+ return;
  4166. -+
  4167. -+ txqi = to_txq_info(txq);
  4168. -+
  4169. -+ if (enable)
  4170. -+ set_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  4171. -+ else
  4172. -+ clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  4173. -+
  4174. -+ clear_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  4175. -+ drv_wake_tx_queue(sta->sdata->local, txqi);
  4176. -+}
  4177. -+
  4178. - /*
  4179. - * splice packets from the STA's pending to the local pending,
  4180. - * requires a call to ieee80211_agg_splice_finish later
  4181. -@@ -247,6 +284,7 @@ static void ieee80211_remove_tid_tx(stru
  4182. - ieee80211_assign_tid_tx(sta, tid, NULL);
  4183. -
  4184. - ieee80211_agg_splice_finish(sta->sdata, tid);
  4185. -+ ieee80211_agg_start_txq(sta, tid, false);
  4186. -
  4187. - kfree_rcu(tid_tx, rcu_head);
  4188. - }
  4189. -@@ -418,6 +456,8 @@ void ieee80211_tx_ba_session_handle_star
  4190. - */
  4191. - clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
  4192. -
  4193. -+ ieee80211_agg_stop_txq(sta, tid);
  4194. -+
  4195. - /*
  4196. - * Make sure no packets are being processed. This ensures that
  4197. - * we have a valid starting sequence number and that in-flight
  4198. -@@ -440,6 +480,8 @@ void ieee80211_tx_ba_session_handle_star
  4199. - ieee80211_agg_splice_finish(sdata, tid);
  4200. - spin_unlock_bh(&sta->lock);
  4201. -
  4202. -+ ieee80211_agg_start_txq(sta, tid, false);
  4203. -+
  4204. - kfree_rcu(tid_tx, rcu_head);
  4205. - return;
  4206. - }
  4207. -@@ -666,6 +708,8 @@ static void ieee80211_agg_tx_operational
  4208. - ieee80211_agg_splice_finish(sta->sdata, tid);
  4209. -
  4210. - spin_unlock_bh(&sta->lock);
  4211. -+
  4212. -+ ieee80211_agg_start_txq(sta, tid, true);
  4213. - }
  4214. -
  4215. - void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
  4216. diff --git a/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch
  4217. new file mode 100644
  4218. index 0000000..4faac0d
  4219. --- /dev/null
  4220. +++ b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch
  4221. @@ -0,0 +1,121 @@
  4222. +From: Felix Fietkau <nbd@openwrt.org>
  4223. +Date: Thu, 2 Jul 2015 15:20:56 +0200
  4224. +Subject: [PATCH] ath9k: limit retries for powersave response frames
  4225. +
  4226. +In some cases, the channel might be busy enough that an ath9k AP's
  4227. +response to PS-Poll frames might be too slow and the station has already
  4228. +gone to sleep. To avoid wasting too much airtime on this, limit the
  4229. +number of retries on such frames and ensure that no sample rate gets
  4230. +used.
  4231. +
  4232. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4233. +---
  4234. +
  4235. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  4236. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  4237. +@@ -147,10 +147,25 @@ static void ath_send_bar(struct ath_atx_
  4238. + }
  4239. +
  4240. + static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
  4241. +- struct ath_buf *bf)
  4242. ++ struct ath_buf *bf, bool ps)
  4243. + {
  4244. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
  4245. ++
  4246. ++ if (ps) {
  4247. ++ /* Clear the first rate to avoid using a sample rate for PS frames */
  4248. ++ info->control.rates[0].idx = -1;
  4249. ++ info->control.rates[0].count = 0;
  4250. ++ }
  4251. ++
  4252. + ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
  4253. + ARRAY_SIZE(bf->rates));
  4254. ++ if (!ps)
  4255. ++ return;
  4256. ++
  4257. ++ if (bf->rates[0].count > 2)
  4258. ++ bf->rates[0].count = 2;
  4259. ++
  4260. ++ bf->rates[1].idx = -1;
  4261. + }
  4262. +
  4263. + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
  4264. +@@ -1430,7 +1445,7 @@ ath_tx_form_burst(struct ath_softc *sc,
  4265. + if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  4266. + break;
  4267. +
  4268. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  4269. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  4270. + } while (1);
  4271. + }
  4272. +
  4273. +@@ -1461,7 +1476,7 @@ static bool ath_tx_sched_aggr(struct ath
  4274. + return false;
  4275. + }
  4276. +
  4277. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  4278. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  4279. + if (aggr)
  4280. + last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
  4281. + tid_q, &aggr_len);
  4282. +@@ -1653,7 +1668,7 @@ void ath9k_release_buffered_frames(struc
  4283. +
  4284. + __skb_unlink(bf->bf_mpdu, tid_q);
  4285. + list_add_tail(&bf->list, &bf_q);
  4286. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  4287. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  4288. + if (bf_isampdu(bf)) {
  4289. + ath_tx_addto_baw(sc, tid, bf);
  4290. + bf->bf_state.bf_type &= ~BUF_AGGR;
  4291. +@@ -2318,7 +2333,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  4292. + struct ath_txq *txq = txctl->txq;
  4293. + struct ath_atx_tid *tid = NULL;
  4294. + struct ath_buf *bf;
  4295. +- bool queue, skip_uapsd = false, ps_resp;
  4296. ++ bool queue, ps_resp;
  4297. + int q, ret;
  4298. +
  4299. + if (vif)
  4300. +@@ -2365,13 +2380,13 @@ int ath_tx_start(struct ieee80211_hw *hw
  4301. + if (!txctl->an)
  4302. + txctl->an = &avp->mcast_node;
  4303. + queue = true;
  4304. +- skip_uapsd = true;
  4305. ++ ps_resp = false;
  4306. + }
  4307. +
  4308. + if (txctl->an && queue)
  4309. + tid = ath_get_skb_tid(sc, txctl->an, skb);
  4310. +
  4311. +- if (!skip_uapsd && ps_resp) {
  4312. ++ if (ps_resp) {
  4313. + ath_txq_unlock(sc, txq);
  4314. + txq = sc->tx.uapsdq;
  4315. + ath_txq_lock(sc, txq);
  4316. +@@ -2409,7 +2424,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  4317. + if (txctl->paprd)
  4318. + bf->bf_state.bfs_paprd_timestamp = jiffies;
  4319. +
  4320. +- ath_set_rates(vif, sta, bf);
  4321. ++ ath_set_rates(vif, sta, bf, ps_resp);
  4322. + ath_tx_send_normal(sc, txq, tid, skb);
  4323. +
  4324. + out:
  4325. +@@ -2448,7 +2463,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw
  4326. + break;
  4327. +
  4328. + bf->bf_lastbf = bf;
  4329. +- ath_set_rates(vif, NULL, bf);
  4330. ++ ath_set_rates(vif, NULL, bf, false);
  4331. + ath_buf_set_rate(sc, bf, &info, fi->framelen, false);
  4332. + duration += info.rates[0].PktDuration;
  4333. + if (bf_tail)
  4334. +@@ -2968,7 +2983,7 @@ int ath9k_tx99_send(struct ath_softc *sc
  4335. + return -EINVAL;
  4336. + }
  4337. +
  4338. +- ath_set_rates(sc->tx99_vif, NULL, bf);
  4339. ++ ath_set_rates(sc->tx99_vif, NULL, bf, false);
  4340. +
  4341. + ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);
  4342. + ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum);
  4343. diff --git a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch b/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  4344. deleted file mode 100644
  4345. index 465d943..0000000
  4346. --- a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  4347. +++ /dev/null
  4348. @@ -1,125 +0,0 @@
  4349. -From: Johannes Berg <johannes.berg@intel.com>
  4350. -Date: Wed, 11 Mar 2015 09:14:15 +0100
  4351. -Subject: [PATCH] mac80211: lock rate control
  4352. -
  4353. -Both minstrel (reported by Sven Eckelmann) and the iwlwifi rate
  4354. -control aren't properly taking concurrency into account. It's
  4355. -likely that the same is true for other rate control algorithms.
  4356. -
  4357. -In the case of minstrel this manifests itself in crashes when an
  4358. -update and other data access are run concurrently, for example
  4359. -when the stations change bandwidth or similar. In iwlwifi, this
  4360. -can cause firmware crashes.
  4361. -
  4362. -Since fixing all rate control algorithms will be very difficult,
  4363. -just provide locking for invocations. This protects the internal
  4364. -data structures the algorithms maintain.
  4365. -
  4366. -I've manipulated hostapd to test this, by having it change its
  4367. -advertised bandwidth roughly ever 150ms. At the same time, I'm
  4368. -running a flood ping between the client and the AP, which causes
  4369. -this race of update vs. get_rate/status to easily happen on the
  4370. -client. With this change, the system survives this test.
  4371. -
  4372. -Reported-by: Sven Eckelmann <sven@open-mesh.com>
  4373. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4374. ----
  4375. -
  4376. ---- a/net/mac80211/rate.c
  4377. -+++ b/net/mac80211/rate.c
  4378. -@@ -683,7 +683,13 @@ void rate_control_get_rate(struct ieee80
  4379. - if (sdata->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
  4380. - return;
  4381. -
  4382. -- ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  4383. -+ if (ista) {
  4384. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  4385. -+ ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  4386. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  4387. -+ } else {
  4388. -+ ref->ops->get_rate(ref->priv, NULL, NULL, txrc);
  4389. -+ }
  4390. -
  4391. - if (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_RC_TABLE)
  4392. - return;
  4393. ---- a/net/mac80211/rate.h
  4394. -+++ b/net/mac80211/rate.h
  4395. -@@ -42,10 +42,12 @@ static inline void rate_control_tx_statu
  4396. - if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
  4397. - return;
  4398. -
  4399. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  4400. - if (ref->ops->tx_status)
  4401. - ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
  4402. - else
  4403. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  4404. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  4405. - }
  4406. -
  4407. - static inline void
  4408. -@@ -64,7 +66,9 @@ rate_control_tx_status_noskb(struct ieee
  4409. - if (WARN_ON_ONCE(!ref->ops->tx_status_noskb))
  4410. - return;
  4411. -
  4412. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  4413. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  4414. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  4415. - }
  4416. -
  4417. - static inline void rate_control_rate_init(struct sta_info *sta)
  4418. -@@ -91,8 +95,10 @@ static inline void rate_control_rate_ini
  4419. -
  4420. - sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  4421. -
  4422. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  4423. - ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  4424. - priv_sta);
  4425. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  4426. - rcu_read_unlock();
  4427. - set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  4428. - }
  4429. -@@ -115,18 +121,20 @@ static inline void rate_control_rate_upd
  4430. - return;
  4431. - }
  4432. -
  4433. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  4434. - ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  4435. - ista, priv_sta, changed);
  4436. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  4437. - rcu_read_unlock();
  4438. - }
  4439. - drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  4440. - }
  4441. -
  4442. - static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  4443. -- struct ieee80211_sta *sta,
  4444. -- gfp_t gfp)
  4445. -+ struct sta_info *sta, gfp_t gfp)
  4446. - {
  4447. -- return ref->ops->alloc_sta(ref->priv, sta, gfp);
  4448. -+ spin_lock_init(&sta->rate_ctrl_lock);
  4449. -+ return ref->ops->alloc_sta(ref->priv, &sta->sta, gfp);
  4450. - }
  4451. -
  4452. - static inline void rate_control_free_sta(struct sta_info *sta)
  4453. ---- a/net/mac80211/sta_info.c
  4454. -+++ b/net/mac80211/sta_info.c
  4455. -@@ -286,7 +286,7 @@ static int sta_prepare_rate_control(stru
  4456. -
  4457. - sta->rate_ctrl = local->rate_ctrl;
  4458. - sta->rate_ctrl_priv = rate_control_alloc_sta(sta->rate_ctrl,
  4459. -- &sta->sta, gfp);
  4460. -+ sta, gfp);
  4461. - if (!sta->rate_ctrl_priv)
  4462. - return -ENOMEM;
  4463. -
  4464. ---- a/net/mac80211/sta_info.h
  4465. -+++ b/net/mac80211/sta_info.h
  4466. -@@ -349,6 +349,7 @@ struct sta_info {
  4467. - u8 ptk_idx;
  4468. - struct rate_control_ref *rate_ctrl;
  4469. - void *rate_ctrl_priv;
  4470. -+ spinlock_t rate_ctrl_lock;
  4471. - spinlock_t lock;
  4472. -
  4473. - struct work_struct drv_deliver_wk;
  4474. diff --git a/package/kernel/mac80211/patches/302-ath10k-Delay-device-access-after-cold-reset.patch b/package/kernel/mac80211/patches/302-ath10k-Delay-device-access-after-cold-reset.patch
  4475. new file mode 100644
  4476. index 0000000..820aa9a
  4477. --- /dev/null
  4478. +++ b/package/kernel/mac80211/patches/302-ath10k-Delay-device-access-after-cold-reset.patch
  4479. @@ -0,0 +1,56 @@
  4480. +From: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
  4481. +Date: Fri, 3 Jul 2015 11:45:42 +0530
  4482. +Subject: [PATCH] ath10k: Delay device access after cold reset
  4483. +
  4484. +It is observed that during cold reset pcie access right
  4485. +after a write operation to SOC_GLOBAL_RESET_ADDRESS causes
  4486. +Data Bus Error and system hard lockup. The reason
  4487. +for bus error is that pcie needs some time to get
  4488. +back to stable state for any transaction during cold reset. Add
  4489. +delay of 20 msecs after write of SOC_GLOBAL_RESET_ADDRESS
  4490. +to fix this issue.
  4491. +
  4492. +Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
  4493. +---
  4494. +
  4495. +--- a/drivers/net/wireless/ath/ath10k/pci.c
  4496. ++++ b/drivers/net/wireless/ath/ath10k/pci.c
  4497. +@@ -2761,7 +2761,6 @@ static int ath10k_pci_wait_for_target_in
  4498. +
  4499. + static int ath10k_pci_cold_reset(struct ath10k *ar)
  4500. + {
  4501. +- int i;
  4502. + u32 val;
  4503. +
  4504. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot cold reset\n");
  4505. +@@ -2777,23 +2776,18 @@ static int ath10k_pci_cold_reset(struct
  4506. + val |= 1;
  4507. + ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
  4508. +
  4509. +- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
  4510. +- if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
  4511. +- RTC_STATE_COLD_RESET_MASK)
  4512. +- break;
  4513. +- msleep(1);
  4514. +- }
  4515. ++ /* After writing into SOC_GLOBAL_RESET to put device into
  4516. ++ * reset and pulling out of reset pcie may not be stable
  4517. ++ * for any immediate pcie register access and cause bus error,
  4518. ++ * add delay before any pcie access request to fix this issue.
  4519. ++ */
  4520. ++ msleep(20);
  4521. +
  4522. + /* Pull Target, including PCIe, out of RESET. */
  4523. + val &= ~1;
  4524. + ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
  4525. +
  4526. +- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
  4527. +- if (!(ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
  4528. +- RTC_STATE_COLD_RESET_MASK))
  4529. +- break;
  4530. +- msleep(1);
  4531. +- }
  4532. ++ msleep(20);
  4533. +
  4534. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot cold reset complete\n");
  4535. +
  4536. diff --git a/package/kernel/mac80211/patches/302-ath9k-restart-only-triggering-DFS-detector-line.patch b/package/kernel/mac80211/patches/302-ath9k-restart-only-triggering-DFS-detector-line.patch
  4537. deleted file mode 100644
  4538. index e54e16e..0000000
  4539. --- a/package/kernel/mac80211/patches/302-ath9k-restart-only-triggering-DFS-detector-line.patch
  4540. +++ /dev/null
  4541. @@ -1,21 +0,0 @@
  4542. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  4543. -Date: Tue, 10 Mar 2015 17:49:29 +0100
  4544. -Subject: [PATCH] ath9k: restart only triggering DFS detector line
  4545. -
  4546. -To support HT40 DFS mode, a triggering detector must
  4547. -reset only itself but not other detector lines.
  4548. -
  4549. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  4550. ----
  4551. -
  4552. ---- a/drivers/net/wireless/ath/dfs_pattern_detector.c
  4553. -+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
  4554. -@@ -289,7 +289,7 @@ dpd_add_pulse(struct dfs_pattern_detecto
  4555. - "count=%d, count_false=%d\n",
  4556. - event->freq, pd->rs->type_id,
  4557. - ps->pri, ps->count, ps->count_falses);
  4558. -- channel_detector_reset(dpd, cd);
  4559. -+ pd->reset(pd, dpd->last_pulse_ts);
  4560. - return true;
  4561. - }
  4562. - }
  4563. diff --git a/package/kernel/mac80211/patches/303-ath9k-add-DFS-support-for-extension-channel.patch b/package/kernel/mac80211/patches/303-ath9k-add-DFS-support-for-extension-channel.patch
  4564. deleted file mode 100644
  4565. index ed268ea..0000000
  4566. --- a/package/kernel/mac80211/patches/303-ath9k-add-DFS-support-for-extension-channel.patch
  4567. +++ /dev/null
  4568. @@ -1,76 +0,0 @@
  4569. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  4570. -Date: Tue, 10 Mar 2015 17:49:30 +0100
  4571. -Subject: [PATCH] ath9k: add DFS support for extension channel
  4572. -
  4573. -In HT40 modes, pulse events on primary and extension
  4574. -channel are processed individually. If valid, a pulse
  4575. -event will be fed into the detector
  4576. -* for primary frequency, or
  4577. -* for extension frequency (+/-20MHz based on HT40-mode)
  4578. -* or both
  4579. -
  4580. -With that, a 40MHz radar will result in two individual
  4581. -radar events.
  4582. -
  4583. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  4584. ----
  4585. -
  4586. ---- a/drivers/net/wireless/ath/ath9k/dfs.c
  4587. -+++ b/drivers/net/wireless/ath/ath9k/dfs.c
  4588. -@@ -126,8 +126,19 @@ ath9k_postprocess_radar_event(struct ath
  4589. - DFS_STAT_INC(sc, pulses_detected);
  4590. - return true;
  4591. - }
  4592. --#undef PRI_CH_RADAR_FOUND
  4593. --#undef EXT_CH_RADAR_FOUND
  4594. -+
  4595. -+static void
  4596. -+ath9k_dfs_process_radar_pulse(struct ath_softc *sc, struct pulse_event *pe)
  4597. -+{
  4598. -+ struct dfs_pattern_detector *pd = sc->dfs_detector;
  4599. -+ DFS_STAT_INC(sc, pulses_processed);
  4600. -+ if (pd == NULL)
  4601. -+ return;
  4602. -+ if (!pd->add_pulse(pd, pe))
  4603. -+ return;
  4604. -+ DFS_STAT_INC(sc, radar_detected);
  4605. -+ ieee80211_radar_detected(sc->hw);
  4606. -+}
  4607. -
  4608. - /*
  4609. - * DFS: check PHY-error for radar pulse and feed the detector
  4610. -@@ -176,18 +187,21 @@ void ath9k_dfs_process_phyerr(struct ath
  4611. - ard.pulse_length_pri = vdata_end[-3];
  4612. - pe.freq = ah->curchan->channel;
  4613. - pe.ts = mactime;
  4614. -- if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
  4615. -- struct dfs_pattern_detector *pd = sc->dfs_detector;
  4616. -- ath_dbg(common, DFS,
  4617. -- "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, "
  4618. -- "width=%d, rssi=%d, delta_ts=%llu\n",
  4619. -- pe.freq, pe.ts, pe.width, pe.rssi,
  4620. -- pe.ts - sc->dfs_prev_pulse_ts);
  4621. -- sc->dfs_prev_pulse_ts = pe.ts;
  4622. -- DFS_STAT_INC(sc, pulses_processed);
  4623. -- if (pd != NULL && pd->add_pulse(pd, &pe)) {
  4624. -- DFS_STAT_INC(sc, radar_detected);
  4625. -- ieee80211_radar_detected(sc->hw);
  4626. -- }
  4627. -+ if (!ath9k_postprocess_radar_event(sc, &ard, &pe))
  4628. -+ return;
  4629. -+
  4630. -+ ath_dbg(common, DFS,
  4631. -+ "ath9k_dfs_process_phyerr: type=%d, freq=%d, ts=%llu, "
  4632. -+ "width=%d, rssi=%d, delta_ts=%llu\n",
  4633. -+ ard.pulse_bw_info, pe.freq, pe.ts, pe.width, pe.rssi,
  4634. -+ pe.ts - sc->dfs_prev_pulse_ts);
  4635. -+ sc->dfs_prev_pulse_ts = pe.ts;
  4636. -+ if (ard.pulse_bw_info & PRI_CH_RADAR_FOUND)
  4637. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  4638. -+ if (ard.pulse_bw_info & EXT_CH_RADAR_FOUND) {
  4639. -+ pe.freq += IS_CHAN_HT40PLUS(ah->curchan) ? 20 : -20;
  4640. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  4641. - }
  4642. - }
  4643. -+#undef PRI_CH_RADAR_FOUND
  4644. -+#undef EXT_CH_RADAR_FOUND
  4645. diff --git a/package/kernel/mac80211/patches/303-ath9k-add-fast-xmit-support.patch b/package/kernel/mac80211/patches/303-ath9k-add-fast-xmit-support.patch
  4646. new file mode 100644
  4647. index 0000000..139015c
  4648. --- /dev/null
  4649. +++ b/package/kernel/mac80211/patches/303-ath9k-add-fast-xmit-support.patch
  4650. @@ -0,0 +1,17 @@
  4651. +From: Felix Fietkau <nbd@openwrt.org>
  4652. +Date: Mon, 11 May 2015 18:35:20 +0200
  4653. +Subject: [PATCH] ath9k: add fast-xmit support
  4654. +
  4655. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4656. +---
  4657. +
  4658. +--- a/drivers/net/wireless/ath/ath9k/init.c
  4659. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  4660. +@@ -826,6 +826,7 @@ static void ath9k_set_hw_capab(struct at
  4661. + ieee80211_hw_set(hw, SIGNAL_DBM);
  4662. + ieee80211_hw_set(hw, RX_INCLUDES_FCS);
  4663. + ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
  4664. ++ ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
  4665. +
  4666. + if (ath9k_ps_enable)
  4667. + ieee80211_hw_set(hw, SUPPORTS_PS);
  4668. diff --git a/package/kernel/mac80211/patches/304-ath9k-allow-40MHz-radar-detection-width.patch b/package/kernel/mac80211/patches/304-ath9k-allow-40MHz-radar-detection-width.patch
  4669. deleted file mode 100644
  4670. index e1eab64..0000000
  4671. --- a/package/kernel/mac80211/patches/304-ath9k-allow-40MHz-radar-detection-width.patch
  4672. +++ /dev/null
  4673. @@ -1,19 +0,0 @@
  4674. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  4675. -Date: Tue, 10 Mar 2015 17:49:31 +0100
  4676. -Subject: [PATCH] ath9k: allow 40MHz radar detection width
  4677. -
  4678. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  4679. ----
  4680. -
  4681. ---- a/drivers/net/wireless/ath/ath9k/init.c
  4682. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  4683. -@@ -763,7 +763,8 @@ static const struct ieee80211_iface_comb
  4684. - .num_different_channels = 1,
  4685. - .beacon_int_infra_match = true,
  4686. - .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  4687. -- BIT(NL80211_CHAN_WIDTH_20),
  4688. -+ BIT(NL80211_CHAN_WIDTH_20) |
  4689. -+ BIT(NL80211_CHAN_WIDTH_40),
  4690. - }
  4691. - #endif
  4692. - };
  4693. diff --git a/package/kernel/mac80211/patches/304-ath9k-remove-struct-ath_atx_ac.patch b/package/kernel/mac80211/patches/304-ath9k-remove-struct-ath_atx_ac.patch
  4694. new file mode 100644
  4695. index 0000000..9f04276
  4696. --- /dev/null
  4697. +++ b/package/kernel/mac80211/patches/304-ath9k-remove-struct-ath_atx_ac.patch
  4698. @@ -0,0 +1,385 @@
  4699. +From: Felix Fietkau <nbd@openwrt.org>
  4700. +Date: Sat, 4 Apr 2015 18:39:06 +0200
  4701. +Subject: [PATCH] ath9k: remove struct ath_atx_ac
  4702. +
  4703. +struct ath_atx_ac contains a list of active TIDs belonging to one WMM AC.
  4704. +This patch changes the code to track active station TIDs in the txq directly.
  4705. +
  4706. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4707. +---
  4708. +
  4709. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  4710. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  4711. +@@ -173,14 +173,6 @@ struct ath_txq {
  4712. + struct sk_buff_head complete_q;
  4713. + };
  4714. +
  4715. +-struct ath_atx_ac {
  4716. +- struct ath_txq *txq;
  4717. +- struct list_head list;
  4718. +- struct list_head tid_q;
  4719. +- bool clear_ps_filter;
  4720. +- bool sched;
  4721. +-};
  4722. +-
  4723. + struct ath_frame_info {
  4724. + struct ath_buf *bf;
  4725. + u16 framelen;
  4726. +@@ -243,7 +235,7 @@ struct ath_atx_tid {
  4727. + struct sk_buff_head buf_q;
  4728. + struct sk_buff_head retry_q;
  4729. + struct ath_node *an;
  4730. +- struct ath_atx_ac *ac;
  4731. ++ struct ath_txq *txq;
  4732. + unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
  4733. + u16 seq_start;
  4734. + u16 seq_next;
  4735. +@@ -255,6 +247,7 @@ struct ath_atx_tid {
  4736. + s8 bar_index;
  4737. + bool sched;
  4738. + bool active;
  4739. ++ bool clear_ps_filter;
  4740. + };
  4741. +
  4742. + struct ath_node {
  4743. +@@ -262,7 +255,6 @@ struct ath_node {
  4744. + struct ieee80211_sta *sta; /* station struct we're part of */
  4745. + struct ieee80211_vif *vif; /* interface with which we're associated */
  4746. + struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
  4747. +- struct ath_atx_ac ac[IEEE80211_NUM_ACS];
  4748. +
  4749. + u16 maxampdu;
  4750. + u8 mpdudensity;
  4751. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  4752. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  4753. +@@ -106,7 +106,6 @@ void ath_txq_unlock_complete(struct ath_
  4754. + static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq,
  4755. + struct ath_atx_tid *tid)
  4756. + {
  4757. +- struct ath_atx_ac *ac = tid->ac;
  4758. + struct list_head *list;
  4759. + struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv;
  4760. + struct ath_chanctx *ctx = avp->chanctx;
  4761. +@@ -118,15 +117,8 @@ static void ath_tx_queue_tid(struct ath_
  4762. + return;
  4763. +
  4764. + tid->sched = true;
  4765. +- list_add_tail(&tid->list, &ac->tid_q);
  4766. +-
  4767. +- if (ac->sched)
  4768. +- return;
  4769. +-
  4770. +- ac->sched = true;
  4771. +-
  4772. + list = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
  4773. +- list_add_tail(&ac->list, list);
  4774. ++ list_add_tail(&tid->list, list);
  4775. + }
  4776. +
  4777. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  4778. +@@ -223,7 +215,7 @@ static struct sk_buff *ath_tid_dequeue(s
  4779. + static void
  4780. + ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid)
  4781. + {
  4782. +- struct ath_txq *txq = tid->ac->txq;
  4783. ++ struct ath_txq *txq = tid->txq;
  4784. + struct ieee80211_tx_info *tx_info;
  4785. + struct sk_buff *skb, *tskb;
  4786. + struct ath_buf *bf;
  4787. +@@ -252,7 +244,7 @@ ath_tx_tid_change_state(struct ath_softc
  4788. +
  4789. + static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  4790. + {
  4791. +- struct ath_txq *txq = tid->ac->txq;
  4792. ++ struct ath_txq *txq = tid->txq;
  4793. + struct sk_buff *skb;
  4794. + struct ath_buf *bf;
  4795. + struct list_head bf_head;
  4796. +@@ -659,7 +651,7 @@ static void ath_tx_complete_aggr(struct
  4797. + ath_tx_queue_tid(sc, txq, tid);
  4798. +
  4799. + if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
  4800. +- tid->ac->clear_ps_filter = true;
  4801. ++ tid->clear_ps_filter = true;
  4802. + }
  4803. + }
  4804. +
  4805. +@@ -749,7 +741,7 @@ static u32 ath_lookup_rate(struct ath_so
  4806. + struct ieee80211_tx_rate *rates;
  4807. + u32 max_4ms_framelen, frmlen;
  4808. + u16 aggr_limit, bt_aggr_limit, legacy = 0;
  4809. +- int q = tid->ac->txq->mac80211_qnum;
  4810. ++ int q = tid->txq->mac80211_qnum;
  4811. + int i;
  4812. +
  4813. + skb = bf->bf_mpdu;
  4814. +@@ -1486,8 +1478,8 @@ static bool ath_tx_sched_aggr(struct ath
  4815. + if (list_empty(&bf_q))
  4816. + return false;
  4817. +
  4818. +- if (tid->ac->clear_ps_filter || tid->an->no_ps_filter) {
  4819. +- tid->ac->clear_ps_filter = false;
  4820. ++ if (tid->clear_ps_filter || tid->an->no_ps_filter) {
  4821. ++ tid->clear_ps_filter = false;
  4822. + tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  4823. + }
  4824. +
  4825. +@@ -1506,7 +1498,7 @@ int ath_tx_aggr_start(struct ath_softc *
  4826. +
  4827. + an = (struct ath_node *)sta->drv_priv;
  4828. + txtid = ATH_AN_2_TID(an, tid);
  4829. +- txq = txtid->ac->txq;
  4830. ++ txq = txtid->txq;
  4831. +
  4832. + ath_txq_lock(sc, txq);
  4833. +
  4834. +@@ -1540,7 +1532,7 @@ void ath_tx_aggr_stop(struct ath_softc *
  4835. + {
  4836. + struct ath_node *an = (struct ath_node *)sta->drv_priv;
  4837. + struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
  4838. +- struct ath_txq *txq = txtid->ac->txq;
  4839. ++ struct ath_txq *txq = txtid->txq;
  4840. +
  4841. + ath_txq_lock(sc, txq);
  4842. + txtid->active = false;
  4843. +@@ -1553,7 +1545,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
  4844. + struct ath_node *an)
  4845. + {
  4846. + struct ath_atx_tid *tid;
  4847. +- struct ath_atx_ac *ac;
  4848. + struct ath_txq *txq;
  4849. + bool buffered;
  4850. + int tidno;
  4851. +@@ -1561,8 +1552,7 @@ void ath_tx_aggr_sleep(struct ieee80211_
  4852. + for (tidno = 0, tid = &an->tid[tidno];
  4853. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  4854. +
  4855. +- ac = tid->ac;
  4856. +- txq = ac->txq;
  4857. ++ txq = tid->txq;
  4858. +
  4859. + ath_txq_lock(sc, txq);
  4860. +
  4861. +@@ -1576,11 +1566,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
  4862. + tid->sched = false;
  4863. + list_del(&tid->list);
  4864. +
  4865. +- if (ac->sched) {
  4866. +- ac->sched = false;
  4867. +- list_del(&ac->list);
  4868. +- }
  4869. +-
  4870. + ath_txq_unlock(sc, txq);
  4871. +
  4872. + ieee80211_sta_set_buffered(sta, tidno, buffered);
  4873. +@@ -1590,18 +1575,16 @@ void ath_tx_aggr_sleep(struct ieee80211_
  4874. + void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
  4875. + {
  4876. + struct ath_atx_tid *tid;
  4877. +- struct ath_atx_ac *ac;
  4878. + struct ath_txq *txq;
  4879. + int tidno;
  4880. +
  4881. + for (tidno = 0, tid = &an->tid[tidno];
  4882. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  4883. +
  4884. +- ac = tid->ac;
  4885. +- txq = ac->txq;
  4886. ++ txq = tid->txq;
  4887. +
  4888. + ath_txq_lock(sc, txq);
  4889. +- ac->clear_ps_filter = true;
  4890. ++ tid->clear_ps_filter = true;
  4891. +
  4892. + if (ath_tid_has_buffered(tid)) {
  4893. + ath_tx_queue_tid(sc, txq, tid);
  4894. +@@ -1621,7 +1604,7 @@ void ath_tx_aggr_resume(struct ath_softc
  4895. +
  4896. + an = (struct ath_node *)sta->drv_priv;
  4897. + tid = ATH_AN_2_TID(an, tidno);
  4898. +- txq = tid->ac->txq;
  4899. ++ txq = tid->txq;
  4900. +
  4901. + ath_txq_lock(sc, txq);
  4902. +
  4903. +@@ -1660,7 +1643,7 @@ void ath9k_release_buffered_frames(struc
  4904. +
  4905. + tid = ATH_AN_2_TID(an, i);
  4906. +
  4907. +- ath_txq_lock(sc, tid->ac->txq);
  4908. ++ ath_txq_lock(sc, tid->txq);
  4909. + while (nframes > 0) {
  4910. + bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
  4911. + if (!bf)
  4912. +@@ -1684,7 +1667,7 @@ void ath9k_release_buffered_frames(struc
  4913. + if (an->sta && !ath_tid_has_buffered(tid))
  4914. + ieee80211_sta_set_buffered(an->sta, i, false);
  4915. + }
  4916. +- ath_txq_unlock_complete(sc, tid->ac->txq);
  4917. ++ ath_txq_unlock_complete(sc, tid->txq);
  4918. + }
  4919. +
  4920. + if (list_empty(&bf_q))
  4921. +@@ -1933,9 +1916,8 @@ void ath_tx_cleanupq(struct ath_softc *s
  4922. + void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
  4923. + {
  4924. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4925. +- struct ath_atx_ac *ac, *last_ac;
  4926. + struct ath_atx_tid *tid, *last_tid;
  4927. +- struct list_head *ac_list;
  4928. ++ struct list_head *tid_list;
  4929. + bool sent = false;
  4930. +
  4931. + if (txq->mac80211_qnum < 0)
  4932. +@@ -1945,63 +1927,46 @@ void ath_txq_schedule(struct ath_softc *
  4933. + return;
  4934. +
  4935. + spin_lock_bh(&sc->chan_lock);
  4936. +- ac_list = &sc->cur_chan->acq[txq->mac80211_qnum];
  4937. ++ tid_list = &sc->cur_chan->acq[txq->mac80211_qnum];
  4938. +
  4939. +- if (list_empty(ac_list)) {
  4940. ++ if (list_empty(tid_list)) {
  4941. + spin_unlock_bh(&sc->chan_lock);
  4942. + return;
  4943. + }
  4944. +
  4945. + rcu_read_lock();
  4946. +
  4947. +- last_ac = list_entry(ac_list->prev, struct ath_atx_ac, list);
  4948. +- while (!list_empty(ac_list)) {
  4949. ++ last_tid = list_entry(tid_list->prev, struct ath_atx_tid, list);
  4950. ++ while (!list_empty(tid_list)) {
  4951. + bool stop = false;
  4952. +
  4953. + if (sc->cur_chan->stopped)
  4954. + break;
  4955. +
  4956. +- ac = list_first_entry(ac_list, struct ath_atx_ac, list);
  4957. +- last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
  4958. +- list_del(&ac->list);
  4959. +- ac->sched = false;
  4960. +-
  4961. +- while (!list_empty(&ac->tid_q)) {
  4962. +-
  4963. +- tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
  4964. +- list);
  4965. +- list_del(&tid->list);
  4966. +- tid->sched = false;
  4967. +-
  4968. +- if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  4969. +- sent = true;
  4970. +-
  4971. +- /*
  4972. +- * add tid to round-robin queue if more frames
  4973. +- * are pending for the tid
  4974. +- */
  4975. +- if (ath_tid_has_buffered(tid))
  4976. +- ath_tx_queue_tid(sc, txq, tid);
  4977. ++ tid = list_first_entry(tid_list, struct ath_atx_tid, list);
  4978. ++ list_del(&tid->list);
  4979. ++ tid->sched = false;
  4980. +
  4981. +- if (stop || tid == last_tid)
  4982. +- break;
  4983. +- }
  4984. ++ if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  4985. ++ sent = true;
  4986. +
  4987. +- if (!list_empty(&ac->tid_q) && !ac->sched) {
  4988. +- ac->sched = true;
  4989. +- list_add_tail(&ac->list, ac_list);
  4990. +- }
  4991. ++ /*
  4992. ++ * add tid to round-robin queue if more frames
  4993. ++ * are pending for the tid
  4994. ++ */
  4995. ++ if (ath_tid_has_buffered(tid))
  4996. ++ ath_tx_queue_tid(sc, txq, tid);
  4997. +
  4998. + if (stop)
  4999. + break;
  5000. +
  5001. +- if (ac == last_ac) {
  5002. ++ if (tid == last_tid) {
  5003. + if (!sent)
  5004. + break;
  5005. +
  5006. + sent = false;
  5007. +- last_ac = list_entry(ac_list->prev,
  5008. +- struct ath_atx_ac, list);
  5009. ++ last_tid = list_entry(tid_list->prev,
  5010. ++ struct ath_atx_tid, list);
  5011. + }
  5012. + }
  5013. +
  5014. +@@ -2391,10 +2356,10 @@ int ath_tx_start(struct ieee80211_hw *hw
  5015. + txq = sc->tx.uapsdq;
  5016. + ath_txq_lock(sc, txq);
  5017. + } else if (txctl->an && queue) {
  5018. +- WARN_ON(tid->ac->txq != txctl->txq);
  5019. ++ WARN_ON(tid->txq != txctl->txq);
  5020. +
  5021. + if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
  5022. +- tid->ac->clear_ps_filter = true;
  5023. ++ tid->clear_ps_filter = true;
  5024. +
  5025. + /*
  5026. + * Add this frame to software queue for scheduling later
  5027. +@@ -2888,7 +2853,6 @@ int ath_tx_init(struct ath_softc *sc, in
  5028. + void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
  5029. + {
  5030. + struct ath_atx_tid *tid;
  5031. +- struct ath_atx_ac *ac;
  5032. + int tidno, acno;
  5033. +
  5034. + for (tidno = 0, tid = &an->tid[tidno];
  5035. +@@ -2901,24 +2865,16 @@ void ath_tx_node_init(struct ath_softc *
  5036. + tid->baw_head = tid->baw_tail = 0;
  5037. + tid->sched = false;
  5038. + tid->active = false;
  5039. ++ tid->clear_ps_filter = true;
  5040. + __skb_queue_head_init(&tid->buf_q);
  5041. + __skb_queue_head_init(&tid->retry_q);
  5042. + acno = TID_TO_WME_AC(tidno);
  5043. +- tid->ac = &an->ac[acno];
  5044. +- }
  5045. +-
  5046. +- for (acno = 0, ac = &an->ac[acno];
  5047. +- acno < IEEE80211_NUM_ACS; acno++, ac++) {
  5048. +- ac->sched = false;
  5049. +- ac->clear_ps_filter = true;
  5050. +- ac->txq = sc->tx.txq_map[acno];
  5051. +- INIT_LIST_HEAD(&ac->tid_q);
  5052. ++ tid->txq = sc->tx.txq_map[acno];
  5053. + }
  5054. + }
  5055. +
  5056. + void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
  5057. + {
  5058. +- struct ath_atx_ac *ac;
  5059. + struct ath_atx_tid *tid;
  5060. + struct ath_txq *txq;
  5061. + int tidno;
  5062. +@@ -2926,8 +2882,7 @@ void ath_tx_node_cleanup(struct ath_soft
  5063. + for (tidno = 0, tid = &an->tid[tidno];
  5064. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  5065. +
  5066. +- ac = tid->ac;
  5067. +- txq = ac->txq;
  5068. ++ txq = tid->txq;
  5069. +
  5070. + ath_txq_lock(sc, txq);
  5071. +
  5072. +@@ -2936,11 +2891,6 @@ void ath_tx_node_cleanup(struct ath_soft
  5073. + tid->sched = false;
  5074. + }
  5075. +
  5076. +- if (ac->sched) {
  5077. +- list_del(&ac->list);
  5078. +- tid->ac->sched = false;
  5079. +- }
  5080. +-
  5081. + ath_tid_drain(sc, txq, tid);
  5082. + tid->active = false;
  5083. +
  5084. diff --git a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch b/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  5085. deleted file mode 100644
  5086. index 4cfa53f..0000000
  5087. --- a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  5088. +++ /dev/null
  5089. @@ -1,137 +0,0 @@
  5090. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  5091. -Date: Wed, 4 Mar 2015 05:12:10 +0300
  5092. -Subject: [PATCH] ath5k: channel change fix
  5093. -
  5094. -ath5k updates the channel pointer and after that it stops the Rx logic
  5095. -and apply channel to HW. In case of channel switch, such sequence
  5096. -creates a small window when a frame, which is received on the old
  5097. -channel is considered as a frame received on the new one.
  5098. -
  5099. -The most notable consequence of this situation occurs during the switch
  5100. -from 2 GHz band (CCK+OFDM) to the 5GHz band (OFDM-only). Frame received
  5101. -with CCK rate, e.g. beacon received at the 1mbps, causes the following
  5102. -warning:
  5103. -
  5104. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  5105. - invalid hw_rix: 1a
  5106. - [..]
  5107. - Call Trace:
  5108. - [<802656a8>] show_stack+0x48/0x70
  5109. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  5110. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  5111. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  5112. - [<8028ac64>] tasklet_action+0x8c/0xf0
  5113. - [<80075804>] __do_softirq+0x180/0x32c
  5114. - [<80196ce8>] irq_exit+0x54/0x70
  5115. - [<80041848>] ret_from_irq+0x0/0x4
  5116. - [<80182fdc>] ioread32+0x4/0xc
  5117. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  5118. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  5119. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  5120. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  5121. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  5122. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  5123. - [<8022c3f4>] process_one_work+0x28c/0x400
  5124. - [<802df8f8>] worker_thread+0x258/0x3c0
  5125. - [<801b5710>] kthread+0xe0/0xec
  5126. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  5127. -
  5128. -The easiest way to reproduce this warning is to run scan with dualband
  5129. -NIC in noisy environments, when the channel 11 runs multiple APs. In my
  5130. -tests if the APs num >= 12, the warning appears in the first few
  5131. -seconds of scanning.
  5132. -
  5133. -In order to fix this, the Rx disable code moved to a higher level and
  5134. -placed before the channel pointer update. This is also makes the code a
  5135. -bit more symmetrical, since we disable and enable the Rx in the same
  5136. -function.
  5137. -
  5138. -In fact, at the pointer update time new frames should not appear,
  5139. -because interrupt generation at this point should already be disabled.
  5140. -The next patch should address this issue.
  5141. -
  5142. -CC: Jiri Slaby <jirislaby@gmail.com>
  5143. -CC: Nick Kossifidis <mickflemm@gmail.com>
  5144. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  5145. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  5146. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  5147. -Tested-by: Eric Bree <ebree@nltinc.com>
  5148. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  5149. ----
  5150. -
  5151. ---- a/drivers/net/wireless/ath/ath5k/base.c
  5152. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  5153. -@@ -2858,7 +2858,7 @@ ath5k_reset(struct ath5k_hw *ah, struct
  5154. - {
  5155. - struct ath_common *common = ath5k_hw_common(ah);
  5156. - int ret, ani_mode;
  5157. -- bool fast;
  5158. -+ bool fast = chan && modparam_fastchanswitch ? 1 : 0;
  5159. -
  5160. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  5161. -
  5162. -@@ -2876,11 +2876,29 @@ ath5k_reset(struct ath5k_hw *ah, struct
  5163. - * so we should also free any remaining
  5164. - * tx buffers */
  5165. - ath5k_drain_tx_buffs(ah);
  5166. -+
  5167. -+ /* Stop PCU */
  5168. -+ ath5k_hw_stop_rx_pcu(ah);
  5169. -+
  5170. -+ /* Stop DMA
  5171. -+ *
  5172. -+ * Note: If DMA didn't stop continue
  5173. -+ * since only a reset will fix it.
  5174. -+ */
  5175. -+ ret = ath5k_hw_dma_stop(ah);
  5176. -+
  5177. -+ /* RF Bus grant won't work if we have pending
  5178. -+ * frames
  5179. -+ */
  5180. -+ if (ret && fast) {
  5181. -+ ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  5182. -+ "DMA didn't stop, falling back to normal reset\n");
  5183. -+ fast = false;
  5184. -+ }
  5185. -+
  5186. - if (chan)
  5187. - ah->curchan = chan;
  5188. -
  5189. -- fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0;
  5190. --
  5191. - ret = ath5k_hw_reset(ah, ah->opmode, ah->curchan, fast, skip_pcu);
  5192. - if (ret) {
  5193. - ATH5K_ERR(ah, "can't reset hardware (%d)\n", ret);
  5194. ---- a/drivers/net/wireless/ath/ath5k/reset.c
  5195. -+++ b/drivers/net/wireless/ath/ath5k/reset.c
  5196. -@@ -1169,30 +1169,6 @@ ath5k_hw_reset(struct ath5k_hw *ah, enum
  5197. - if (ah->ah_version == AR5K_AR5212)
  5198. - ath5k_hw_set_sleep_clock(ah, false);
  5199. -
  5200. -- /*
  5201. -- * Stop PCU
  5202. -- */
  5203. -- ath5k_hw_stop_rx_pcu(ah);
  5204. --
  5205. -- /*
  5206. -- * Stop DMA
  5207. -- *
  5208. -- * Note: If DMA didn't stop continue
  5209. -- * since only a reset will fix it.
  5210. -- */
  5211. -- ret = ath5k_hw_dma_stop(ah);
  5212. --
  5213. -- /* RF Bus grant won't work if we have pending
  5214. -- * frames */
  5215. -- if (ret && fast) {
  5216. -- ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  5217. -- "DMA didn't stop, falling back to normal reset\n");
  5218. -- fast = false;
  5219. -- /* Non fatal, just continue with
  5220. -- * normal reset */
  5221. -- ret = 0;
  5222. -- }
  5223. --
  5224. - mode = channel->hw_value;
  5225. - switch (mode) {
  5226. - case AR5K_MODE_11A:
  5227. diff --git a/package/kernel/mac80211/patches/305-ath9k-remove-the-sched-field-in-struct-ath_atx_tid.patch b/package/kernel/mac80211/patches/305-ath9k-remove-the-sched-field-in-struct-ath_atx_tid.patch
  5228. new file mode 100644
  5229. index 0000000..ec860dc
  5230. --- /dev/null
  5231. +++ b/package/kernel/mac80211/patches/305-ath9k-remove-the-sched-field-in-struct-ath_atx_tid.patch
  5232. @@ -0,0 +1,90 @@
  5233. +From: Felix Fietkau <nbd@openwrt.org>
  5234. +Date: Sat, 4 Apr 2015 18:42:33 +0200
  5235. +Subject: [PATCH] ath9k: remove the sched field in struct ath_atx_tid
  5236. +
  5237. +Use list_empty(&tid->list) instead
  5238. +
  5239. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5240. +---
  5241. +
  5242. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  5243. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  5244. +@@ -245,7 +245,6 @@ struct ath_atx_tid {
  5245. + int baw_tail; /* next unused tx buffer slot */
  5246. +
  5247. + s8 bar_index;
  5248. +- bool sched;
  5249. + bool active;
  5250. + bool clear_ps_filter;
  5251. + };
  5252. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  5253. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  5254. +@@ -113,12 +113,9 @@ static void ath_tx_queue_tid(struct ath_
  5255. + if (!ctx)
  5256. + return;
  5257. +
  5258. +- if (tid->sched)
  5259. +- return;
  5260. +-
  5261. +- tid->sched = true;
  5262. + list = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
  5263. +- list_add_tail(&tid->list, list);
  5264. ++ if (list_empty(&tid->list))
  5265. ++ list_add_tail(&tid->list, list);
  5266. + }
  5267. +
  5268. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  5269. +@@ -1556,15 +1553,14 @@ void ath_tx_aggr_sleep(struct ieee80211_
  5270. +
  5271. + ath_txq_lock(sc, txq);
  5272. +
  5273. +- if (!tid->sched) {
  5274. ++ if (list_empty(&tid->list)) {
  5275. + ath_txq_unlock(sc, txq);
  5276. + continue;
  5277. + }
  5278. +
  5279. + buffered = ath_tid_has_buffered(tid);
  5280. +
  5281. +- tid->sched = false;
  5282. +- list_del(&tid->list);
  5283. ++ list_del_init(&tid->list);
  5284. +
  5285. + ath_txq_unlock(sc, txq);
  5286. +
  5287. +@@ -1944,8 +1940,7 @@ void ath_txq_schedule(struct ath_softc *
  5288. + break;
  5289. +
  5290. + tid = list_first_entry(tid_list, struct ath_atx_tid, list);
  5291. +- list_del(&tid->list);
  5292. +- tid->sched = false;
  5293. ++ list_del_init(&tid->list);
  5294. +
  5295. + if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  5296. + sent = true;
  5297. +@@ -2863,11 +2858,11 @@ void ath_tx_node_init(struct ath_softc *
  5298. + tid->seq_start = tid->seq_next = 0;
  5299. + tid->baw_size = WME_MAX_BA;
  5300. + tid->baw_head = tid->baw_tail = 0;
  5301. +- tid->sched = false;
  5302. + tid->active = false;
  5303. + tid->clear_ps_filter = true;
  5304. + __skb_queue_head_init(&tid->buf_q);
  5305. + __skb_queue_head_init(&tid->retry_q);
  5306. ++ INIT_LIST_HEAD(&tid->list);
  5307. + acno = TID_TO_WME_AC(tidno);
  5308. + tid->txq = sc->tx.txq_map[acno];
  5309. + }
  5310. +@@ -2886,10 +2881,8 @@ void ath_tx_node_cleanup(struct ath_soft
  5311. +
  5312. + ath_txq_lock(sc, txq);
  5313. +
  5314. +- if (tid->sched) {
  5315. +- list_del(&tid->list);
  5316. +- tid->sched = false;
  5317. +- }
  5318. ++ if (!list_empty(&tid->list))
  5319. ++ list_del_init(&tid->list);
  5320. +
  5321. + ath_tid_drain(sc, txq, tid);
  5322. + tid->active = false;
  5323. diff --git a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch b/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  5324. deleted file mode 100644
  5325. index 85a1904..0000000
  5326. --- a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  5327. +++ /dev/null
  5328. @@ -1,96 +0,0 @@
  5329. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  5330. -Date: Wed, 4 Mar 2015 05:12:11 +0300
  5331. -Subject: [PATCH] ath5k: fix reset race
  5332. -
  5333. -To prepare for reset ath5k should finish all asynchronous tasks. At
  5334. -first, it disables the interrupt generation, then it waits for the
  5335. -interrupt handler and tasklets completion, and then proceeds to the HW
  5336. -configuration update. But it does not consider that the interrupt
  5337. -handler or tasklet re-enables the interrupt generation. And we fall in a
  5338. -situation when ath5k assumes that interrupts are disabled, but it is
  5339. -not.
  5340. -
  5341. -This can lead to different consequences, such as reception of the frame,
  5342. -when we do not expect it. Under certain circumstances, this can lead to
  5343. -the following warning:
  5344. -
  5345. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  5346. - invalid hw_rix: 1a
  5347. - [..]
  5348. - Call Trace:
  5349. - [<802656a8>] show_stack+0x48/0x70
  5350. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  5351. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  5352. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  5353. - [<8028ac64>] tasklet_action+0x8c/0xf0
  5354. - [<80075804>] __do_softirq+0x180/0x32c
  5355. - [<80196ce8>] irq_exit+0x54/0x70
  5356. - [<80041848>] ret_from_irq+0x0/0x4
  5357. - [<80182fdc>] ioread32+0x4/0xc
  5358. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  5359. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  5360. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  5361. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  5362. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  5363. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  5364. - [<8022c3f4>] process_one_work+0x28c/0x400
  5365. - [<802df8f8>] worker_thread+0x258/0x3c0
  5366. - [<801b5710>] kthread+0xe0/0xec
  5367. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  5368. -
  5369. -Fix this issue by adding a new status flag, which forbids to re-enable
  5370. -the interrupt generation until the HW configuration is completed.
  5371. -
  5372. -Note: previous patch, which reorders the Rx disable code helps to avoid
  5373. -the above warning, but not fixes the root cause of unexpected frame
  5374. -receiving.
  5375. -
  5376. -CC: Jiri Slaby <jirislaby@gmail.com>
  5377. -CC: Nick Kossifidis <mickflemm@gmail.com>
  5378. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  5379. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  5380. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  5381. -Tested-by: Eric Bree <ebree@nltinc.com>
  5382. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  5383. ----
  5384. -
  5385. ---- a/drivers/net/wireless/ath/ath5k/ath5k.h
  5386. -+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  5387. -@@ -1283,6 +1283,7 @@ struct ath5k_hw {
  5388. - #define ATH_STAT_PROMISC 1
  5389. - #define ATH_STAT_LEDSOFT 2 /* enable LED gpio status */
  5390. - #define ATH_STAT_STARTED 3 /* opened & irqs enabled */
  5391. -+#define ATH_STAT_RESET 4 /* hw reset */
  5392. -
  5393. - unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
  5394. - unsigned int fif_filter_flags; /* Current FIF_* filter flags */
  5395. ---- a/drivers/net/wireless/ath/ath5k/base.c
  5396. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  5397. -@@ -1523,6 +1523,9 @@ ath5k_set_current_imask(struct ath5k_hw
  5398. - enum ath5k_int imask;
  5399. - unsigned long flags;
  5400. -
  5401. -+ if (test_bit(ATH_STAT_RESET, ah->status))
  5402. -+ return;
  5403. -+
  5404. - spin_lock_irqsave(&ah->irqlock, flags);
  5405. - imask = ah->imask;
  5406. - if (ah->rx_pending)
  5407. -@@ -2862,6 +2865,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  5408. -
  5409. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  5410. -
  5411. -+ __set_bit(ATH_STAT_RESET, ah->status);
  5412. -+
  5413. - ath5k_hw_set_imr(ah, 0);
  5414. - synchronize_irq(ah->irq);
  5415. - ath5k_stop_tasklets(ah);
  5416. -@@ -2952,6 +2957,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  5417. - */
  5418. - /* ath5k_chan_change(ah, c); */
  5419. -
  5420. -+ __clear_bit(ATH_STAT_RESET, ah->status);
  5421. -+
  5422. - ath5k_beacon_config(ah);
  5423. - /* intrs are enabled by ath5k_beacon_config */
  5424. -
  5425. diff --git a/package/kernel/mac80211/patches/306-mac80211-Deinline-rate_control_rate_init-rate_contro.patch b/package/kernel/mac80211/patches/306-mac80211-Deinline-rate_control_rate_init-rate_contro.patch
  5426. new file mode 100644
  5427. index 0000000..928c93b
  5428. --- /dev/null
  5429. +++ b/package/kernel/mac80211/patches/306-mac80211-Deinline-rate_control_rate_init-rate_contro.patch
  5430. @@ -0,0 +1,161 @@
  5431. +From: Denys Vlasenko <dvlasenk@redhat.com>
  5432. +Date: Wed, 15 Jul 2015 14:56:06 +0200
  5433. +Subject: [PATCH] mac80211: Deinline rate_control_rate_init,
  5434. + rate_control_rate_update
  5435. +
  5436. +With this .config: http://busybox.net/~vda/kernel_config,
  5437. +after deinlining these functions have sizes and callsite counts
  5438. +as follows:
  5439. +
  5440. +rate_control_rate_init: 554 bytes, 8 calls
  5441. +rate_control_rate_update: 1596 bytes, 5 calls
  5442. +
  5443. +Total size reduction: about 11 kbytes.
  5444. +
  5445. +Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
  5446. +CC: John Linville <linville@tuxdriver.com>
  5447. +CC: Michal Kazior <michal.kazior@tieto.com>
  5448. +CC: Johannes Berg <johannes.berg@intel.com>
  5449. +Cc: linux-wireless@vger.kernel.org
  5450. +Cc: netdev@vger.kernel.org
  5451. +CC: linux-kernel@vger.kernel.org
  5452. +---
  5453. +
  5454. +--- a/net/mac80211/rate.c
  5455. ++++ b/net/mac80211/rate.c
  5456. +@@ -29,6 +29,65 @@ module_param(ieee80211_default_rc_algo,
  5457. + MODULE_PARM_DESC(ieee80211_default_rc_algo,
  5458. + "Default rate control algorithm for mac80211 to use");
  5459. +
  5460. ++void rate_control_rate_init(struct sta_info *sta)
  5461. ++{
  5462. ++ struct ieee80211_local *local = sta->sdata->local;
  5463. ++ struct rate_control_ref *ref = sta->rate_ctrl;
  5464. ++ struct ieee80211_sta *ista = &sta->sta;
  5465. ++ void *priv_sta = sta->rate_ctrl_priv;
  5466. ++ struct ieee80211_supported_band *sband;
  5467. ++ struct ieee80211_chanctx_conf *chanctx_conf;
  5468. ++
  5469. ++ ieee80211_sta_set_rx_nss(sta);
  5470. ++
  5471. ++ if (!ref)
  5472. ++ return;
  5473. ++
  5474. ++ rcu_read_lock();
  5475. ++
  5476. ++ chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  5477. ++ if (WARN_ON(!chanctx_conf)) {
  5478. ++ rcu_read_unlock();
  5479. ++ return;
  5480. ++ }
  5481. ++
  5482. ++ sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  5483. ++
  5484. ++ spin_lock_bh(&sta->rate_ctrl_lock);
  5485. ++ ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  5486. ++ priv_sta);
  5487. ++ spin_unlock_bh(&sta->rate_ctrl_lock);
  5488. ++ rcu_read_unlock();
  5489. ++ set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  5490. ++}
  5491. ++
  5492. ++void rate_control_rate_update(struct ieee80211_local *local,
  5493. ++ struct ieee80211_supported_band *sband,
  5494. ++ struct sta_info *sta, u32 changed)
  5495. ++{
  5496. ++ struct rate_control_ref *ref = local->rate_ctrl;
  5497. ++ struct ieee80211_sta *ista = &sta->sta;
  5498. ++ void *priv_sta = sta->rate_ctrl_priv;
  5499. ++ struct ieee80211_chanctx_conf *chanctx_conf;
  5500. ++
  5501. ++ if (ref && ref->ops->rate_update) {
  5502. ++ rcu_read_lock();
  5503. ++
  5504. ++ chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  5505. ++ if (WARN_ON(!chanctx_conf)) {
  5506. ++ rcu_read_unlock();
  5507. ++ return;
  5508. ++ }
  5509. ++
  5510. ++ spin_lock_bh(&sta->rate_ctrl_lock);
  5511. ++ ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  5512. ++ ista, priv_sta, changed);
  5513. ++ spin_unlock_bh(&sta->rate_ctrl_lock);
  5514. ++ rcu_read_unlock();
  5515. ++ }
  5516. ++ drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  5517. ++}
  5518. ++
  5519. + int ieee80211_rate_control_register(const struct rate_control_ops *ops)
  5520. + {
  5521. + struct rate_control_alg *alg;
  5522. +--- a/net/mac80211/rate.h
  5523. ++++ b/net/mac80211/rate.h
  5524. +@@ -71,64 +71,10 @@ rate_control_tx_status_noskb(struct ieee
  5525. + spin_unlock_bh(&sta->rate_ctrl_lock);
  5526. + }
  5527. +
  5528. +-static inline void rate_control_rate_init(struct sta_info *sta)
  5529. +-{
  5530. +- struct ieee80211_local *local = sta->sdata->local;
  5531. +- struct rate_control_ref *ref = sta->rate_ctrl;
  5532. +- struct ieee80211_sta *ista = &sta->sta;
  5533. +- void *priv_sta = sta->rate_ctrl_priv;
  5534. +- struct ieee80211_supported_band *sband;
  5535. +- struct ieee80211_chanctx_conf *chanctx_conf;
  5536. +-
  5537. +- ieee80211_sta_set_rx_nss(sta);
  5538. +-
  5539. +- if (!ref)
  5540. +- return;
  5541. +-
  5542. +- rcu_read_lock();
  5543. +-
  5544. +- chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  5545. +- if (WARN_ON(!chanctx_conf)) {
  5546. +- rcu_read_unlock();
  5547. +- return;
  5548. +- }
  5549. +-
  5550. +- sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  5551. +-
  5552. +- spin_lock_bh(&sta->rate_ctrl_lock);
  5553. +- ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  5554. +- priv_sta);
  5555. +- spin_unlock_bh(&sta->rate_ctrl_lock);
  5556. +- rcu_read_unlock();
  5557. +- set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  5558. +-}
  5559. +-
  5560. +-static inline void rate_control_rate_update(struct ieee80211_local *local,
  5561. ++void rate_control_rate_init(struct sta_info *sta);
  5562. ++void rate_control_rate_update(struct ieee80211_local *local,
  5563. + struct ieee80211_supported_band *sband,
  5564. +- struct sta_info *sta, u32 changed)
  5565. +-{
  5566. +- struct rate_control_ref *ref = local->rate_ctrl;
  5567. +- struct ieee80211_sta *ista = &sta->sta;
  5568. +- void *priv_sta = sta->rate_ctrl_priv;
  5569. +- struct ieee80211_chanctx_conf *chanctx_conf;
  5570. +-
  5571. +- if (ref && ref->ops->rate_update) {
  5572. +- rcu_read_lock();
  5573. +-
  5574. +- chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  5575. +- if (WARN_ON(!chanctx_conf)) {
  5576. +- rcu_read_unlock();
  5577. +- return;
  5578. +- }
  5579. +-
  5580. +- spin_lock_bh(&sta->rate_ctrl_lock);
  5581. +- ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  5582. +- ista, priv_sta, changed);
  5583. +- spin_unlock_bh(&sta->rate_ctrl_lock);
  5584. +- rcu_read_unlock();
  5585. +- }
  5586. +- drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  5587. +-}
  5588. ++ struct sta_info *sta, u32 changed);
  5589. +
  5590. + static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  5591. + struct sta_info *sta, gfp_t gfp)
  5592. diff --git a/package/kernel/mac80211/patches/307-ath9k-fix-tracking-of-enabled-AP-beacons.patch b/package/kernel/mac80211/patches/307-ath9k-fix-tracking-of-enabled-AP-beacons.patch
  5593. deleted file mode 100644
  5594. index ab9771e..0000000
  5595. --- a/package/kernel/mac80211/patches/307-ath9k-fix-tracking-of-enabled-AP-beacons.patch
  5596. +++ /dev/null
  5597. @@ -1,76 +0,0 @@
  5598. -From: Felix Fietkau <nbd@openwrt.org>
  5599. -Date: Thu, 12 Mar 2015 17:10:50 +0100
  5600. -Subject: [PATCH] ath9k: fix tracking of enabled AP beacons
  5601. -
  5602. -sc->nbcnvifs tracks assigned beacon slots, not enabled beacons.
  5603. -Therefore, it cannot be used to decide if cur_conf->enable_beacon (bool)
  5604. -should be updated, or if beacons have been enabled already.
  5605. -With the current code (depending on the order of calls), beacons often
  5606. -do not get enabled in an AP+STA setup.
  5607. -To fix tracking of enabled beacons, convert cur_conf->enable_beacon to a
  5608. -bitmask of enabled beacon slots.
  5609. -
  5610. -Cc: stable@vger.kernel.org
  5611. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5612. ----
  5613. -
  5614. ---- a/drivers/net/wireless/ath/ath9k/beacon.c
  5615. -+++ b/drivers/net/wireless/ath/ath9k/beacon.c
  5616. -@@ -219,12 +219,15 @@ void ath9k_beacon_remove_slot(struct ath
  5617. - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  5618. - struct ath_vif *avp = (void *)vif->drv_priv;
  5619. - struct ath_buf *bf = avp->av_bcbuf;
  5620. -+ struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  5621. -
  5622. - ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  5623. - avp->av_bslot);
  5624. -
  5625. - tasklet_disable(&sc->bcon_tasklet);
  5626. -
  5627. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  5628. -+
  5629. - if (bf && bf->bf_mpdu) {
  5630. - struct sk_buff *skb = bf->bf_mpdu;
  5631. - dma_unmap_single(sc->dev, bf->bf_buf_addr,
  5632. -@@ -521,8 +524,7 @@ static bool ath9k_allow_beacon_config(st
  5633. - }
  5634. -
  5635. - if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  5636. -- if ((vif->type != NL80211_IFTYPE_AP) ||
  5637. -- (sc->nbcnvifs > 1)) {
  5638. -+ if (vif->type != NL80211_IFTYPE_AP) {
  5639. - ath_dbg(common, CONFIG,
  5640. - "An AP interface is already present !\n");
  5641. - return false;
  5642. -@@ -616,12 +618,14 @@ void ath9k_beacon_config(struct ath_soft
  5643. - * enabling/disabling SWBA.
  5644. - */
  5645. - if (changed & BSS_CHANGED_BEACON_ENABLED) {
  5646. -- if (!bss_conf->enable_beacon &&
  5647. -- (sc->nbcnvifs <= 1)) {
  5648. -- cur_conf->enable_beacon = false;
  5649. -- } else if (bss_conf->enable_beacon) {
  5650. -- cur_conf->enable_beacon = true;
  5651. -- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  5652. -+ bool enabled = cur_conf->enable_beacon;
  5653. -+
  5654. -+ if (!bss_conf->enable_beacon) {
  5655. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  5656. -+ } else {
  5657. -+ cur_conf->enable_beacon |= BIT(avp->av_bslot);
  5658. -+ if (!enabled)
  5659. -+ ath9k_cache_beacon_config(sc, ctx, bss_conf);
  5660. - }
  5661. - }
  5662. -
  5663. ---- a/drivers/net/wireless/ath/ath9k/common.h
  5664. -+++ b/drivers/net/wireless/ath/ath9k/common.h
  5665. -@@ -54,7 +54,7 @@ struct ath_beacon_config {
  5666. - u16 dtim_period;
  5667. - u16 bmiss_timeout;
  5668. - u8 dtim_count;
  5669. -- bool enable_beacon;
  5670. -+ u8 enable_beacon;
  5671. - bool ibss_creator;
  5672. - u32 nexttbtt;
  5673. - u32 intval;
  5674. diff --git a/package/kernel/mac80211/patches/307-mac80211-Deinline-drv_sta_state.patch b/package/kernel/mac80211/patches/307-mac80211-Deinline-drv_sta_state.patch
  5675. new file mode 100644
  5676. index 0000000..474c409
  5677. --- /dev/null
  5678. +++ b/package/kernel/mac80211/patches/307-mac80211-Deinline-drv_sta_state.patch
  5679. @@ -0,0 +1,116 @@
  5680. +From: Denys Vlasenko <dvlasenk@redhat.com>
  5681. +Date: Wed, 15 Jul 2015 14:56:05 +0200
  5682. +Subject: [PATCH] mac80211: Deinline drv_sta_state
  5683. +
  5684. +With this .config: http://busybox.net/~vda/kernel_config,
  5685. +after deinlining the function size is 3132 bytes and there are
  5686. +7 callsites.
  5687. +
  5688. +Total size reduction: about 20 kbytes.
  5689. +
  5690. +Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
  5691. +CC: John Linville <linville@tuxdriver.com>
  5692. +CC: Michal Kazior <michal.kazior@tieto.com>
  5693. +Cc: Johannes Berg <johannes.berg@intel.com>
  5694. +Cc: linux-wireless@vger.kernel.org
  5695. +Cc: netdev@vger.kernel.org
  5696. +CC: linux-kernel@vger.kernel.org
  5697. +---
  5698. + create mode 100644 net/mac80211/driver-ops.c
  5699. +
  5700. +--- a/net/mac80211/Makefile
  5701. ++++ b/net/mac80211/Makefile
  5702. +@@ -3,6 +3,7 @@ obj-$(CPTCFG_MAC80211) += mac80211.o
  5703. + # mac80211 objects
  5704. + mac80211-y := \
  5705. + main.o status.o \
  5706. ++ driver-ops.o \
  5707. + sta_info.o \
  5708. + wep.o \
  5709. + wpa.o \
  5710. +--- /dev/null
  5711. ++++ b/net/mac80211/driver-ops.c
  5712. +@@ -0,0 +1,41 @@
  5713. ++/*
  5714. ++ * This program is free software; you can redistribute it and/or modify
  5715. ++ * it under the terms of the GNU General Public License version 2 as
  5716. ++ * published by the Free Software Foundation.
  5717. ++ */
  5718. ++#include <net/mac80211.h>
  5719. ++#include "ieee80211_i.h"
  5720. ++#include "trace.h"
  5721. ++#include "driver-ops.h"
  5722. ++
  5723. ++__must_check
  5724. ++int drv_sta_state(struct ieee80211_local *local,
  5725. ++ struct ieee80211_sub_if_data *sdata,
  5726. ++ struct sta_info *sta,
  5727. ++ enum ieee80211_sta_state old_state,
  5728. ++ enum ieee80211_sta_state new_state)
  5729. ++{
  5730. ++ int ret = 0;
  5731. ++
  5732. ++ might_sleep();
  5733. ++
  5734. ++ sdata = get_bss_sdata(sdata);
  5735. ++ if (!check_sdata_in_driver(sdata))
  5736. ++ return -EIO;
  5737. ++
  5738. ++ trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  5739. ++ if (local->ops->sta_state) {
  5740. ++ ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  5741. ++ old_state, new_state);
  5742. ++ } else if (old_state == IEEE80211_STA_AUTH &&
  5743. ++ new_state == IEEE80211_STA_ASSOC) {
  5744. ++ ret = drv_sta_add(local, sdata, &sta->sta);
  5745. ++ if (ret == 0)
  5746. ++ sta->uploaded = true;
  5747. ++ } else if (old_state == IEEE80211_STA_ASSOC &&
  5748. ++ new_state == IEEE80211_STA_AUTH) {
  5749. ++ drv_sta_remove(local, sdata, &sta->sta);
  5750. ++ }
  5751. ++ trace_drv_return_int(local, ret);
  5752. ++ return ret;
  5753. ++}
  5754. +--- a/net/mac80211/driver-ops.h
  5755. ++++ b/net/mac80211/driver-ops.h
  5756. +@@ -573,37 +573,12 @@ static inline void drv_sta_pre_rcu_remov
  5757. + trace_drv_return_void(local);
  5758. + }
  5759. +
  5760. +-static inline __must_check
  5761. ++__must_check
  5762. + int drv_sta_state(struct ieee80211_local *local,
  5763. + struct ieee80211_sub_if_data *sdata,
  5764. + struct sta_info *sta,
  5765. + enum ieee80211_sta_state old_state,
  5766. +- enum ieee80211_sta_state new_state)
  5767. +-{
  5768. +- int ret = 0;
  5769. +-
  5770. +- might_sleep();
  5771. +-
  5772. +- sdata = get_bss_sdata(sdata);
  5773. +- if (!check_sdata_in_driver(sdata))
  5774. +- return -EIO;
  5775. +-
  5776. +- trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  5777. +- if (local->ops->sta_state) {
  5778. +- ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  5779. +- old_state, new_state);
  5780. +- } else if (old_state == IEEE80211_STA_AUTH &&
  5781. +- new_state == IEEE80211_STA_ASSOC) {
  5782. +- ret = drv_sta_add(local, sdata, &sta->sta);
  5783. +- if (ret == 0)
  5784. +- sta->uploaded = true;
  5785. +- } else if (old_state == IEEE80211_STA_ASSOC &&
  5786. +- new_state == IEEE80211_STA_AUTH) {
  5787. +- drv_sta_remove(local, sdata, &sta->sta);
  5788. +- }
  5789. +- trace_drv_return_int(local, ret);
  5790. +- return ret;
  5791. +-}
  5792. ++ enum ieee80211_sta_state new_state);
  5793. +
  5794. + static inline void drv_sta_rc_update(struct ieee80211_local *local,
  5795. + struct ieee80211_sub_if_data *sdata,
  5796. diff --git a/package/kernel/mac80211/patches/308-ath9k-Fix-NF-CCA-limits-for-AR9287-and-AR9227.patch b/package/kernel/mac80211/patches/308-ath9k-Fix-NF-CCA-limits-for-AR9287-and-AR9227.patch
  5797. new file mode 100644
  5798. index 0000000..1a3a9d4
  5799. --- /dev/null
  5800. +++ b/package/kernel/mac80211/patches/308-ath9k-Fix-NF-CCA-limits-for-AR9287-and-AR9227.patch
  5801. @@ -0,0 +1,30 @@
  5802. +From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  5803. +Date: Wed, 22 Jul 2015 10:42:43 +0200
  5804. +Subject: [PATCH] ath9k: Fix NF CCA limits for AR9287 and AR9227
  5805. +
  5806. +The FreeBSD driver [0] uses the same 2G values as for the AR9280 chips.
  5807. +Using the same values in ath9k results in much better throughput for me.
  5808. +
  5809. +Before this patch I had a huge amount of packet loss (sometimes up to
  5810. +40%) and the max transfer speed was somewhere around 5Mbit/s. With this
  5811. +patch applied I have zero packet loss and ten times the throughput.
  5812. +My device uses a AR9227 which is the PCI variant of the AR9287.
  5813. +
  5814. +[0] http://bxr.su/FreeBSD/sys/dev/ath/ath_hal/ar9002/ar9287.h
  5815. +
  5816. +Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  5817. +---
  5818. +
  5819. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  5820. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  5821. +@@ -610,8 +610,8 @@
  5822. + #define AR_PHY_CCA_MIN_GOOD_VAL_9271_2GHZ -127
  5823. + #define AR_PHY_CCA_MAX_GOOD_VAL_9271_2GHZ -116
  5824. +
  5825. +-#define AR_PHY_CCA_NOM_VAL_9287_2GHZ -120
  5826. ++#define AR_PHY_CCA_NOM_VAL_9287_2GHZ -112
  5827. + #define AR_PHY_CCA_MIN_GOOD_VAL_9287_2GHZ -127
  5828. +-#define AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ -110
  5829. ++#define AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ -97
  5830. +
  5831. + #endif
  5832. diff --git a/package/kernel/mac80211/patches/308-mac80211-minstrel_ht-fix-rounding-issue-in-MCS-durat.patch b/package/kernel/mac80211/patches/308-mac80211-minstrel_ht-fix-rounding-issue-in-MCS-durat.patch
  5833. deleted file mode 100644
  5834. index d132636..0000000
  5835. --- a/package/kernel/mac80211/patches/308-mac80211-minstrel_ht-fix-rounding-issue-in-MCS-durat.patch
  5836. +++ /dev/null
  5837. @@ -1,43 +0,0 @@
  5838. -From: Felix Fietkau <nbd@openwrt.org>
  5839. -Date: Fri, 13 Mar 2015 10:49:40 +0100
  5840. -Subject: [PATCH] mac80211: minstrel_ht: fix rounding issue in MCS duration
  5841. - calculation
  5842. -
  5843. -On very high MCS bitrates, the calculated duration of rates that are
  5844. -next to each other can be very imprecise, due to the small packet size
  5845. -used as reference (1200 bytes).
  5846. -This is most visible in VHT80 nss=2 MCS8/9, for which minstrel shows the
  5847. -same throughput when the probability is also the same. This leads to a
  5848. -bad rate selection for such rates.
  5849. -
  5850. -Fix this issue by introducing an average A-MPDU size factor into the
  5851. -calculation.
  5852. -
  5853. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5854. ----
  5855. -
  5856. ---- a/net/mac80211/rc80211_minstrel_ht.c
  5857. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  5858. -@@ -17,10 +17,11 @@
  5859. - #include "rc80211_minstrel.h"
  5860. - #include "rc80211_minstrel_ht.h"
  5861. -
  5862. -+#define AVG_AMPDU_SIZE 16
  5863. - #define AVG_PKT_SIZE 1200
  5864. -
  5865. - /* Number of bits for an average sized packet */
  5866. --#define MCS_NBITS (AVG_PKT_SIZE << 3)
  5867. -+#define MCS_NBITS ((AVG_PKT_SIZE * AVG_AMPDU_SIZE) << 3)
  5868. -
  5869. - /* Number of symbols for a packet with (bps) bits per symbol */
  5870. - #define MCS_NSYMS(bps) DIV_ROUND_UP(MCS_NBITS, (bps))
  5871. -@@ -33,7 +34,8 @@
  5872. - )
  5873. -
  5874. - /* Transmit duration for the raw data part of an average sized packet */
  5875. --#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
  5876. -+#define MCS_DURATION(streams, sgi, bps) \
  5877. -+ (MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) / AVG_AMPDU_SIZE)
  5878. -
  5879. - #define BW_20 0
  5880. - #define BW_40 1
  5881. diff --git a/package/kernel/mac80211/patches/309-ath9k-disable-TPC-support-again-for-now.patch b/package/kernel/mac80211/patches/309-ath9k-disable-TPC-support-again-for-now.patch
  5882. deleted file mode 100644
  5883. index 945fbce..0000000
  5884. --- a/package/kernel/mac80211/patches/309-ath9k-disable-TPC-support-again-for-now.patch
  5885. +++ /dev/null
  5886. @@ -1,22 +0,0 @@
  5887. -From: Felix Fietkau <nbd@openwrt.org>
  5888. -Date: Sun, 15 Mar 2015 08:02:37 +0100
  5889. -Subject: [PATCH] ath9k: disable TPC support again (for now)
  5890. -
  5891. -TPC support has been observed to cause some tx power fluctuations on
  5892. -some devices with at least AR934x and AR938x chips.
  5893. -Disable it for now until the bugs have been found and fixed
  5894. -
  5895. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5896. ----
  5897. -
  5898. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  5899. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  5900. -@@ -424,7 +424,7 @@ static void ath9k_hw_init_defaults(struc
  5901. - ah->power_mode = ATH9K_PM_UNDEFINED;
  5902. - ah->htc_reset_init = true;
  5903. -
  5904. -- ah->tpc_enabled = true;
  5905. -+ ah->tpc_enabled = false;
  5906. -
  5907. - ah->ani_function = ATH9K_ANI_ALL;
  5908. - if (!AR_SREV_9300_20_OR_LATER(ah))
  5909. diff --git a/package/kernel/mac80211/patches/309-mac80211-make-local-tx_headroom-a-multiple-of-4.patch b/package/kernel/mac80211/patches/309-mac80211-make-local-tx_headroom-a-multiple-of-4.patch
  5910. new file mode 100644
  5911. index 0000000..e8e9617
  5912. --- /dev/null
  5913. +++ b/package/kernel/mac80211/patches/309-mac80211-make-local-tx_headroom-a-multiple-of-4.patch
  5914. @@ -0,0 +1,20 @@
  5915. +From: Felix Fietkau <nbd@openwrt.org>
  5916. +Date: Thu, 30 Jul 2015 14:12:25 +0200
  5917. +Subject: [PATCH] mac80211: make local->tx_headroom a multiple of 4
  5918. +
  5919. +This ensures that mac80211 generated management frames and beacons are
  5920. +aligned before being passed to the driver
  5921. +
  5922. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5923. +---
  5924. +
  5925. +--- a/net/mac80211/main.c
  5926. ++++ b/net/mac80211/main.c
  5927. +@@ -1031,6 +1031,7 @@ int ieee80211_register_hw(struct ieee802
  5928. + */
  5929. + local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
  5930. + IEEE80211_TX_STATUS_HEADROOM);
  5931. ++ local->tx_headroom = ALIGN(local->tx_headroom, 4);
  5932. +
  5933. + debugfs_hw_add(local);
  5934. +
  5935. diff --git a/package/kernel/mac80211/patches/310-mac80211-don-t-look-up-stations-for-multicast-addres.patch b/package/kernel/mac80211/patches/310-mac80211-don-t-look-up-stations-for-multicast-addres.patch
  5936. deleted file mode 100644
  5937. index bd3050e..0000000
  5938. --- a/package/kernel/mac80211/patches/310-mac80211-don-t-look-up-stations-for-multicast-addres.patch
  5939. +++ /dev/null
  5940. @@ -1,21 +0,0 @@
  5941. -From: Johannes Berg <johannes.berg@intel.com>
  5942. -Date: Tue, 24 Feb 2015 00:28:18 +0100
  5943. -Subject: [PATCH] mac80211: don't look up stations for multicast addresses
  5944. -
  5945. -Since multicast addresses don't exist as stations, don't attempt
  5946. -to look them up in the hashtable on TX.
  5947. -
  5948. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5949. ----
  5950. -
  5951. ---- a/net/mac80211/tx.c
  5952. -+++ b/net/mac80211/tx.c
  5953. -@@ -1161,7 +1161,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  5954. - tx->sdata->control_port_protocol == tx->skb->protocol) {
  5955. - tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  5956. - }
  5957. -- if (!tx->sta)
  5958. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  5959. - tx->sta = sta_info_get(sdata, hdr->addr1);
  5960. -
  5961. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  5962. diff --git a/package/kernel/mac80211/patches/310-mac80211-fix-invalid-read-in-minstrel_sort_best_tp_r.patch b/package/kernel/mac80211/patches/310-mac80211-fix-invalid-read-in-minstrel_sort_best_tp_r.patch
  5963. new file mode 100644
  5964. index 0000000..51a315c
  5965. --- /dev/null
  5966. +++ b/package/kernel/mac80211/patches/310-mac80211-fix-invalid-read-in-minstrel_sort_best_tp_r.patch
  5967. @@ -0,0 +1,34 @@
  5968. +From: Adrien Schildknecht <adrien+dev@schischi.me>
  5969. +Date: Tue, 28 Jul 2015 10:30:16 +0200
  5970. +Subject: [PATCH] mac80211: fix invalid read in minstrel_sort_best_tp_rates()
  5971. +
  5972. +At the last iteration of the loop, j may equal zero and thus
  5973. +tp_list[j - 1] causes an invalid read.
  5974. +Changed the logic of the loop so that j - 1 is always >= 0.
  5975. +
  5976. +Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
  5977. +---
  5978. +
  5979. +--- a/net/mac80211/rc80211_minstrel.c
  5980. ++++ b/net/mac80211/rc80211_minstrel.c
  5981. +@@ -92,14 +92,15 @@ int minstrel_get_tp_avg(struct minstrel_
  5982. + static inline void
  5983. + minstrel_sort_best_tp_rates(struct minstrel_sta_info *mi, int i, u8 *tp_list)
  5984. + {
  5985. +- int j = MAX_THR_RATES;
  5986. +- struct minstrel_rate_stats *tmp_mrs = &mi->r[j - 1].stats;
  5987. ++ int j;
  5988. ++ struct minstrel_rate_stats *tmp_mrs;
  5989. + struct minstrel_rate_stats *cur_mrs = &mi->r[i].stats;
  5990. +
  5991. +- while (j > 0 && (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) >
  5992. +- minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))) {
  5993. +- j--;
  5994. ++ for (j = MAX_THR_RATES; j > 0; --j) {
  5995. + tmp_mrs = &mi->r[tp_list[j - 1]].stats;
  5996. ++ if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) <=
  5997. ++ minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))
  5998. ++ break;
  5999. + }
  6000. +
  6001. + if (j < MAX_THR_RATES - 1)
  6002. diff --git a/package/kernel/mac80211/patches/311-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch b/package/kernel/mac80211/patches/311-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  6003. new file mode 100644
  6004. index 0000000..e44f121
  6005. --- /dev/null
  6006. +++ b/package/kernel/mac80211/patches/311-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  6007. @@ -0,0 +1,45 @@
  6008. +From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
  6009. +Date: Thu, 9 Jul 2015 13:43:18 +0530
  6010. +Subject: [PATCH] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
  6011. +
  6012. +There's already a generic implementation so use that instead.
  6013. +
  6014. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6015. +---
  6016. +
  6017. +--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  6018. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  6019. +@@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(st
  6020. + }
  6021. + }
  6022. +
  6023. +-static void atomic_orr(int val, atomic_t *v)
  6024. +-{
  6025. +- int old_val;
  6026. +-
  6027. +- old_val = atomic_read(v);
  6028. +- while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
  6029. +- old_val = atomic_read(v);
  6030. +-}
  6031. +-
  6032. + static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
  6033. + {
  6034. + struct brcmf_core *buscore;
  6035. +@@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struc
  6036. + if (val) {
  6037. + brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
  6038. + bus->sdcnt.f1regdata++;
  6039. +- atomic_orr(val, &bus->intstatus);
  6040. ++ atomic_or(val, &bus->intstatus);
  6041. + }
  6042. +
  6043. + return ret;
  6044. +@@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  6045. +
  6046. + /* Keep still-pending events for next scheduling */
  6047. + if (intstatus)
  6048. +- atomic_orr(intstatus, &bus->intstatus);
  6049. ++ atomic_or(intstatus, &bus->intstatus);
  6050. +
  6051. + brcmf_sdio_clrintr(bus);
  6052. +
  6053. diff --git a/package/kernel/mac80211/patches/311-mac80211-remove-drop_unencrypted-code.patch b/package/kernel/mac80211/patches/311-mac80211-remove-drop_unencrypted-code.patch
  6054. deleted file mode 100644
  6055. index b2475b9..0000000
  6056. --- a/package/kernel/mac80211/patches/311-mac80211-remove-drop_unencrypted-code.patch
  6057. +++ /dev/null
  6058. @@ -1,130 +0,0 @@
  6059. -From: Johannes Berg <johannes.berg@intel.com>
  6060. -Date: Fri, 20 Mar 2015 11:41:58 +0100
  6061. -Subject: [PATCH] mac80211: remove drop_unencrypted code
  6062. -
  6063. -This mechanism was historic, and only ever used by IBSS, which
  6064. -also doesn't need to have it as it properly manages station's
  6065. -802.1X PAE state (or, with WEP, always has a key.)
  6066. -
  6067. -Remove the mechanism to clean up the code.
  6068. -
  6069. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6070. ----
  6071. -
  6072. ---- a/net/mac80211/debugfs.c
  6073. -+++ b/net/mac80211/debugfs.c
  6074. -@@ -274,8 +274,6 @@ void debugfs_hw_add(struct ieee80211_loc
  6075. - #ifdef CPTCFG_MAC80211_DEBUG_COUNTERS
  6076. - DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
  6077. - DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
  6078. -- DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
  6079. -- local->tx_handlers_drop_unencrypted);
  6080. - DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
  6081. - local->tx_handlers_drop_fragment);
  6082. - DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
  6083. ---- a/net/mac80211/debugfs_netdev.c
  6084. -+++ b/net/mac80211/debugfs_netdev.c
  6085. -@@ -177,7 +177,6 @@ static ssize_t ieee80211_if_write_##name
  6086. - IEEE80211_IF_FILE_R(name)
  6087. -
  6088. - /* common attributes */
  6089. --IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
  6090. - IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
  6091. - HEX);
  6092. - IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
  6093. -@@ -562,7 +561,6 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDu
  6094. -
  6095. - static void add_common_files(struct ieee80211_sub_if_data *sdata)
  6096. - {
  6097. -- DEBUGFS_ADD(drop_unencrypted);
  6098. - DEBUGFS_ADD(rc_rateidx_mask_2ghz);
  6099. - DEBUGFS_ADD(rc_rateidx_mask_5ghz);
  6100. - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
  6101. ---- a/net/mac80211/ibss.c
  6102. -+++ b/net/mac80211/ibss.c
  6103. -@@ -249,8 +249,6 @@ static void __ieee80211_sta_join_ibss(st
  6104. - if (presp)
  6105. - kfree_rcu(presp, rcu_head);
  6106. -
  6107. -- sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
  6108. --
  6109. - /* make a copy of the chandef, it could be modified below. */
  6110. - chandef = *req_chandef;
  6111. - chan = chandef.chan;
  6112. -@@ -1289,8 +1287,6 @@ static void ieee80211_sta_create_ibss(st
  6113. -
  6114. - if (ifibss->privacy)
  6115. - capability |= WLAN_CAPABILITY_PRIVACY;
  6116. -- else
  6117. -- sdata->drop_unencrypted = 0;
  6118. -
  6119. - __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
  6120. - &ifibss->chandef, ifibss->basic_rates,
  6121. ---- a/net/mac80211/ieee80211_i.h
  6122. -+++ b/net/mac80211/ieee80211_i.h
  6123. -@@ -842,8 +842,6 @@ struct ieee80211_sub_if_data {
  6124. -
  6125. - unsigned long state;
  6126. -
  6127. -- int drop_unencrypted;
  6128. --
  6129. - char name[IFNAMSIZ];
  6130. -
  6131. - /* Fragment table for host-based reassembly */
  6132. -@@ -1289,7 +1287,6 @@ struct ieee80211_local {
  6133. - /* TX/RX handler statistics */
  6134. - unsigned int tx_handlers_drop;
  6135. - unsigned int tx_handlers_queued;
  6136. -- unsigned int tx_handlers_drop_unencrypted;
  6137. - unsigned int tx_handlers_drop_fragment;
  6138. - unsigned int tx_handlers_drop_wep;
  6139. - unsigned int tx_handlers_drop_not_assoc;
  6140. ---- a/net/mac80211/iface.c
  6141. -+++ b/net/mac80211/iface.c
  6142. -@@ -1535,7 +1535,6 @@ int ieee80211_if_change_type(struct ieee
  6143. - }
  6144. -
  6145. - /* reset some values that shouldn't be kept across type changes */
  6146. -- sdata->drop_unencrypted = 0;
  6147. - if (type == NL80211_IFTYPE_STATION)
  6148. - sdata->u.mgd.use_4addr = false;
  6149. -
  6150. ---- a/net/mac80211/rx.c
  6151. -+++ b/net/mac80211/rx.c
  6152. -@@ -1897,8 +1897,7 @@ static int ieee80211_drop_unencrypted(st
  6153. - /* Drop unencrypted frames if key is set. */
  6154. - if (unlikely(!ieee80211_has_protected(fc) &&
  6155. - !ieee80211_is_nullfunc(fc) &&
  6156. -- ieee80211_is_data(fc) &&
  6157. -- (rx->key || rx->sdata->drop_unencrypted)))
  6158. -+ ieee80211_is_data(fc) && rx->key))
  6159. - return -EACCES;
  6160. -
  6161. - return 0;
  6162. ---- a/net/mac80211/tx.c
  6163. -+++ b/net/mac80211/tx.c
  6164. -@@ -594,23 +594,8 @@ ieee80211_tx_h_select_key(struct ieee802
  6165. - else if (!is_multicast_ether_addr(hdr->addr1) &&
  6166. - (key = rcu_dereference(tx->sdata->default_unicast_key)))
  6167. - tx->key = key;
  6168. -- else if (info->flags & IEEE80211_TX_CTL_INJECTED)
  6169. -+ else
  6170. - tx->key = NULL;
  6171. -- else if (!tx->sdata->drop_unencrypted)
  6172. -- tx->key = NULL;
  6173. -- else if (tx->skb->protocol == tx->sdata->control_port_protocol)
  6174. -- tx->key = NULL;
  6175. -- else if (ieee80211_is_robust_mgmt_frame(tx->skb) &&
  6176. -- !(ieee80211_is_action(hdr->frame_control) &&
  6177. -- tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))
  6178. -- tx->key = NULL;
  6179. -- else if (ieee80211_is_mgmt(hdr->frame_control) &&
  6180. -- !ieee80211_is_robust_mgmt_frame(tx->skb))
  6181. -- tx->key = NULL;
  6182. -- else {
  6183. -- I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
  6184. -- return TX_DROP;
  6185. -- }
  6186. -
  6187. - if (tx->key) {
  6188. - bool skip_hw = false;
  6189. diff --git a/package/kernel/mac80211/patches/312-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch b/package/kernel/mac80211/patches/312-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  6190. new file mode 100644
  6191. index 0000000..bb27115
  6192. --- /dev/null
  6193. +++ b/package/kernel/mac80211/patches/312-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  6194. @@ -0,0 +1,46 @@
  6195. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6196. +Date: Thu, 20 Aug 2015 00:16:42 +0200
  6197. +Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
  6198. + addresses
  6199. +MIME-Version: 1.0
  6200. +Content-Type: text/plain; charset=UTF-8
  6201. +Content-Transfer-Encoding: 8bit
  6202. +
  6203. +Broadcom is working on better reflection of interface combinations. With
  6204. +upcoming patches we may have 1st combination supporting less interfaces
  6205. +than others.
  6206. +To don't run out of addresses check all combinations to find the one
  6207. +with the greatest max_interfaces value.
  6208. +
  6209. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6210. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6211. +---
  6212. +
  6213. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  6214. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  6215. +@@ -5786,7 +5786,9 @@ static void brcmf_wiphy_wowl_params(stru
  6216. + static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  6217. + {
  6218. + struct brcmf_pub *drvr = ifp->drvr;
  6219. ++ const struct ieee80211_iface_combination *combo;
  6220. + struct ieee80211_supported_band *band;
  6221. ++ u16 max_interfaces = 0;
  6222. + __le32 bandlist[3];
  6223. + u32 n_bands;
  6224. + int err, i;
  6225. +@@ -5799,8 +5801,13 @@ static int brcmf_setup_wiphy(struct wiph
  6226. + if (err)
  6227. + return err;
  6228. +
  6229. +- for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  6230. +- i < ARRAY_SIZE(drvr->addresses); i++) {
  6231. ++ for (i = 0, combo = wiphy->iface_combinations;
  6232. ++ i < wiphy->n_iface_combinations; i++, combo++) {
  6233. ++ max_interfaces = max(max_interfaces, combo->max_interfaces);
  6234. ++ }
  6235. ++
  6236. ++ for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
  6237. ++ i++) {
  6238. + u8 *addr = drvr->addresses[i].addr;
  6239. +
  6240. + memcpy(addr, drvr->mac, ETH_ALEN);
  6241. diff --git a/package/kernel/mac80211/patches/312-mac80211-don-t-look-up-destination-station-twice.patch b/package/kernel/mac80211/patches/312-mac80211-don-t-look-up-destination-station-twice.patch
  6242. deleted file mode 100644
  6243. index 02a7fab..0000000
  6244. --- a/package/kernel/mac80211/patches/312-mac80211-don-t-look-up-destination-station-twice.patch
  6245. +++ /dev/null
  6246. @@ -1,71 +0,0 @@
  6247. -From: Johannes Berg <johannes.berg@intel.com>
  6248. -Date: Fri, 20 Mar 2015 16:24:21 +0100
  6249. -Subject: [PATCH] mac80211: don't look up destination station twice
  6250. -
  6251. -There's no need to look up the destination station twice while
  6252. -building the 802.11 header for a given frame if the frame will
  6253. -actually be transmitted to the station we initially looked up.
  6254. -
  6255. -This happens for 4-addr VLAN interfaces and TDLS connections, which
  6256. -both directly send the frame to the station they looked up, though
  6257. -in the case of TDLS some station conditions need to be checked.
  6258. -
  6259. -To avoid that, add a variable indicating that we've looked up the
  6260. -station that the frame is going to be transmitted to, and avoid the
  6261. -lookup/flag checking if it already has been done.
  6262. -
  6263. -In the TDLS case, also move the authorized/wme_sta flag assignment
  6264. -to the correct place, i.e. only when that station is really used.
  6265. -Before this change, the new lookup should always have succeeded so
  6266. -that the potentially erroneous data would be overwritten.
  6267. -
  6268. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6269. ----
  6270. -
  6271. ---- a/net/mac80211/tx.c
  6272. -+++ b/net/mac80211/tx.c
  6273. -@@ -1894,6 +1894,7 @@ static struct sk_buff *ieee80211_build_h
  6274. - bool wme_sta = false, authorized = false, tdls_auth = false;
  6275. - bool tdls_peer = false, tdls_setup_frame = false;
  6276. - bool multicast;
  6277. -+ bool have_station = false;
  6278. - u16 info_id = 0;
  6279. - struct ieee80211_chanctx_conf *chanctx_conf;
  6280. - struct ieee80211_sub_if_data *ap_sdata;
  6281. -@@ -1918,6 +1919,7 @@ static struct sk_buff *ieee80211_build_h
  6282. - hdrlen = 30;
  6283. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  6284. - wme_sta = sta->sta.wme;
  6285. -+ have_station = true;
  6286. - }
  6287. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  6288. - u.ap);
  6289. -@@ -2034,9 +2036,6 @@ static struct sk_buff *ieee80211_build_h
  6290. - if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) {
  6291. - sta = sta_info_get(sdata, skb->data);
  6292. - if (sta) {
  6293. -- authorized = test_sta_flag(sta,
  6294. -- WLAN_STA_AUTHORIZED);
  6295. -- wme_sta = sta->sta.wme;
  6296. - tdls_peer = test_sta_flag(sta,
  6297. - WLAN_STA_TDLS_PEER);
  6298. - tdls_auth = test_sta_flag(sta,
  6299. -@@ -2068,6 +2067,9 @@ static struct sk_buff *ieee80211_build_h
  6300. - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
  6301. - memcpy(hdr.addr3, sdata->u.mgd.bssid, ETH_ALEN);
  6302. - hdrlen = 24;
  6303. -+ have_station = true;
  6304. -+ authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  6305. -+ wme_sta = sta->sta.wme;
  6306. - } else if (sdata->u.mgd.use_4addr &&
  6307. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  6308. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  6309. -@@ -2130,7 +2132,7 @@ static struct sk_buff *ieee80211_build_h
  6310. - * in AP mode)
  6311. - */
  6312. - multicast = is_multicast_ether_addr(hdr.addr1);
  6313. -- if (!multicast) {
  6314. -+ if (!multicast && !have_station) {
  6315. - sta = sta_info_get(sdata, hdr.addr1);
  6316. - if (sta) {
  6317. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  6318. diff --git a/package/kernel/mac80211/patches/313-brcmfmac-correct-interface-combination-info.patch b/package/kernel/mac80211/patches/313-brcmfmac-correct-interface-combination-info.patch
  6319. new file mode 100644
  6320. index 0000000..baee295
  6321. --- /dev/null
  6322. +++ b/package/kernel/mac80211/patches/313-brcmfmac-correct-interface-combination-info.patch
  6323. @@ -0,0 +1,204 @@
  6324. +From: Arend van Spriel <arend@broadcom.com>
  6325. +Date: Thu, 20 Aug 2015 22:06:03 +0200
  6326. +Subject: [PATCH] brcmfmac: correct interface combination info
  6327. +
  6328. +The interface combination provided by brcmfmac did not truly reflect
  6329. +the combinations supported by driver and/or firmware.
  6330. +
  6331. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  6332. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  6333. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  6334. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  6335. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  6336. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6337. +---
  6338. +
  6339. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  6340. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  6341. +@@ -5695,63 +5695,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  6342. + }
  6343. + };
  6344. +
  6345. ++/**
  6346. ++ * brcmf_setup_ifmodes() - determine interface modes and combinations.
  6347. ++ *
  6348. ++ * @wiphy: wiphy object.
  6349. ++ * @ifp: interface object needed for feat module api.
  6350. ++ *
  6351. ++ * The interface modes and combinations are determined dynamically here
  6352. ++ * based on firmware functionality.
  6353. ++ *
  6354. ++ * no p2p and no mbss:
  6355. ++ *
  6356. ++ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  6357. ++ *
  6358. ++ * no p2p and mbss:
  6359. ++ *
  6360. ++ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  6361. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  6362. ++ *
  6363. ++ * p2p, no mchan, and mbss:
  6364. ++ *
  6365. ++ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
  6366. ++ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  6367. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  6368. ++ *
  6369. ++ * p2p, mchan, and mbss:
  6370. ++ *
  6371. ++ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  6372. ++ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  6373. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  6374. ++ */
  6375. + static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  6376. + {
  6377. + struct ieee80211_iface_combination *combo = NULL;
  6378. +- struct ieee80211_iface_limit *limits = NULL;
  6379. +- int i = 0, max_iface_cnt;
  6380. ++ struct ieee80211_iface_limit *c0_limits = NULL;
  6381. ++ struct ieee80211_iface_limit *p2p_limits = NULL;
  6382. ++ struct ieee80211_iface_limit *mbss_limits = NULL;
  6383. ++ bool mbss, p2p;
  6384. ++ int i, c, n_combos;
  6385. +
  6386. +- combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  6387. ++ mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
  6388. ++ p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
  6389. ++
  6390. ++ n_combos = 1 + !!p2p + !!mbss;
  6391. ++ combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
  6392. + if (!combo)
  6393. + goto err;
  6394. +
  6395. +- limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  6396. +- if (!limits)
  6397. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  6398. ++ if (!c0_limits)
  6399. + goto err;
  6400. +
  6401. ++ if (p2p) {
  6402. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  6403. ++ if (!p2p_limits)
  6404. ++ goto err;
  6405. ++ }
  6406. ++
  6407. ++ if (mbss) {
  6408. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  6409. ++ if (!mbss_limits)
  6410. ++ goto err;
  6411. ++ }
  6412. ++
  6413. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  6414. + BIT(NL80211_IFTYPE_ADHOC) |
  6415. + BIT(NL80211_IFTYPE_AP);
  6416. +
  6417. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  6418. +- combo->num_different_channels = 2;
  6419. +- else
  6420. +- combo->num_different_channels = 1;
  6421. +-
  6422. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  6423. +- limits[i].max = 1;
  6424. +- limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  6425. +- limits[i].max = 4;
  6426. +- limits[i++].types = BIT(NL80211_IFTYPE_AP);
  6427. +- max_iface_cnt = 5;
  6428. +- } else {
  6429. +- limits[i].max = 2;
  6430. +- limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  6431. +- BIT(NL80211_IFTYPE_AP);
  6432. +- max_iface_cnt = 2;
  6433. +- }
  6434. +-
  6435. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  6436. ++ c = 0;
  6437. ++ i = 0;
  6438. ++ combo[c].num_different_channels = 1;
  6439. ++ c0_limits[i].max = 1;
  6440. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  6441. ++ if (p2p) {
  6442. ++ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  6443. ++ combo[c].num_different_channels = 2;
  6444. + wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  6445. + BIT(NL80211_IFTYPE_P2P_GO) |
  6446. + BIT(NL80211_IFTYPE_P2P_DEVICE);
  6447. +- limits[i].max = 1;
  6448. +- limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  6449. +- BIT(NL80211_IFTYPE_P2P_GO);
  6450. +- limits[i].max = 1;
  6451. +- limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  6452. +- max_iface_cnt += 2;
  6453. +- }
  6454. +- combo->max_interfaces = max_iface_cnt;
  6455. +- combo->limits = limits;
  6456. +- combo->n_limits = i;
  6457. ++ c0_limits[i].max = 1;
  6458. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  6459. ++ c0_limits[i].max = 1;
  6460. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  6461. ++ BIT(NL80211_IFTYPE_P2P_GO);
  6462. ++ } else {
  6463. ++ c0_limits[i].max = 1;
  6464. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  6465. ++ }
  6466. ++ combo[c].max_interfaces = i;
  6467. ++ combo[c].n_limits = i;
  6468. ++ combo[c].limits = c0_limits;
  6469. ++
  6470. ++ if (p2p) {
  6471. ++ c++;
  6472. ++ i = 0;
  6473. ++ combo[c].num_different_channels = 1;
  6474. ++ p2p_limits[i].max = 1;
  6475. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  6476. ++ p2p_limits[i].max = 1;
  6477. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  6478. ++ p2p_limits[i].max = 1;
  6479. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  6480. ++ p2p_limits[i].max = 1;
  6481. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  6482. ++ combo[c].max_interfaces = i;
  6483. ++ combo[c].n_limits = i;
  6484. ++ combo[c].limits = p2p_limits;
  6485. ++ }
  6486. +
  6487. ++ if (mbss) {
  6488. ++ c++;
  6489. ++ combo[c].beacon_int_infra_match = true;
  6490. ++ combo[c].num_different_channels = 1;
  6491. ++ mbss_limits[0].max = 4;
  6492. ++ mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  6493. ++ combo[c].max_interfaces = 4;
  6494. ++ combo[c].n_limits = 1;
  6495. ++ combo[c].limits = mbss_limits;
  6496. ++ }
  6497. ++ wiphy->n_iface_combinations = n_combos;
  6498. + wiphy->iface_combinations = combo;
  6499. +- wiphy->n_iface_combinations = 1;
  6500. + return 0;
  6501. +
  6502. + err:
  6503. +- kfree(limits);
  6504. ++ kfree(c0_limits);
  6505. ++ kfree(p2p_limits);
  6506. ++ kfree(mbss_limits);
  6507. + kfree(combo);
  6508. + return -ENOMEM;
  6509. + }
  6510. +@@ -6080,11 +6149,15 @@ static void brcmf_cfg80211_reg_notifier(
  6511. +
  6512. + static void brcmf_free_wiphy(struct wiphy *wiphy)
  6513. + {
  6514. ++ int i;
  6515. ++
  6516. + if (!wiphy)
  6517. + return;
  6518. +
  6519. +- if (wiphy->iface_combinations)
  6520. +- kfree(wiphy->iface_combinations->limits);
  6521. ++ if (wiphy->iface_combinations) {
  6522. ++ for (i = 0; i < wiphy->n_iface_combinations; i++)
  6523. ++ kfree(wiphy->iface_combinations[i].limits);
  6524. ++ }
  6525. + kfree(wiphy->iface_combinations);
  6526. + if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  6527. + kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  6528. diff --git a/package/kernel/mac80211/patches/313-mac80211-drop-4-addr-VLAN-frames-earlier-if-not-conn.patch b/package/kernel/mac80211/patches/313-mac80211-drop-4-addr-VLAN-frames-earlier-if-not-conn.patch
  6529. deleted file mode 100644
  6530. index 4125351..0000000
  6531. --- a/package/kernel/mac80211/patches/313-mac80211-drop-4-addr-VLAN-frames-earlier-if-not-conn.patch
  6532. +++ /dev/null
  6533. @@ -1,27 +0,0 @@
  6534. -From: Johannes Berg <johannes.berg@intel.com>
  6535. -Date: Fri, 20 Mar 2015 16:24:22 +0100
  6536. -Subject: [PATCH] mac80211: drop 4-addr VLAN frames earlier if not
  6537. - connected
  6538. -
  6539. -If there's no station on the 4-addr VLAN interface, then frames
  6540. -cannot be transmitted. Drop such frames earlier, before setting
  6541. -up all the information for them.
  6542. -
  6543. -We should keep the old check though since that code might be used
  6544. -for other internally-generated frames.
  6545. -
  6546. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6547. ----
  6548. -
  6549. ---- a/net/mac80211/tx.c
  6550. -+++ b/net/mac80211/tx.c
  6551. -@@ -1920,6 +1920,9 @@ static struct sk_buff *ieee80211_build_h
  6552. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  6553. - wme_sta = sta->sta.wme;
  6554. - have_station = true;
  6555. -+ } else if (sdata->wdev.use_4addr) {
  6556. -+ ret = -ENOLINK;
  6557. -+ goto free;
  6558. - }
  6559. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  6560. - u.ap);
  6561. diff --git a/package/kernel/mac80211/patches/314-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch b/package/kernel/mac80211/patches/314-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  6562. new file mode 100644
  6563. index 0000000..9768ef2
  6564. --- /dev/null
  6565. +++ b/package/kernel/mac80211/patches/314-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  6566. @@ -0,0 +1,87 @@
  6567. +From: Franky Lin <frankyl@broadcom.com>
  6568. +Date: Thu, 20 Aug 2015 22:06:04 +0200
  6569. +Subject: [PATCH] brcmfmac: add debugfs entry for msgbuf statistics
  6570. +
  6571. +Expose ring buffer read/write pointers and other useful statistics
  6572. +through debugfs.
  6573. +
  6574. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  6575. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  6576. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  6577. +Signed-off-by: Franky Lin <frankyl@broadcom.com>
  6578. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  6579. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6580. +---
  6581. +
  6582. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  6583. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  6584. +@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct
  6585. + }
  6586. + }
  6587. +
  6588. ++#ifdef DEBUG
  6589. ++static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  6590. ++{
  6591. ++ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  6592. ++ struct brcmf_pub *drvr = bus_if->drvr;
  6593. ++ struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  6594. ++ struct brcmf_commonring *commonring;
  6595. ++ u16 i;
  6596. ++ struct brcmf_flowring_ring *ring;
  6597. ++ struct brcmf_flowring_hash *hash;
  6598. ++
  6599. ++ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
  6600. ++ seq_printf(seq, "h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n",
  6601. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  6602. ++ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
  6603. ++ seq_printf(seq, "h2d_rx_submit: rp %4u, wp %4u, depth %4u\n",
  6604. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  6605. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
  6606. ++ seq_printf(seq, "d2h_ctl_cmplt: rp %4u, wp %4u, depth %4u\n",
  6607. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  6608. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
  6609. ++ seq_printf(seq, "d2h_tx_cmplt: rp %4u, wp %4u, depth %4u\n",
  6610. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  6611. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
  6612. ++ seq_printf(seq, "d2h_rx_cmplt: rp %4u, wp %4u, depth %4u\n",
  6613. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  6614. ++
  6615. ++ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
  6616. ++ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
  6617. ++ seq_puts(seq, "Active flowrings:\n");
  6618. ++ hash = msgbuf->flow->hash;
  6619. ++ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
  6620. ++ if (!msgbuf->flow->rings[i])
  6621. ++ continue;
  6622. ++ ring = msgbuf->flow->rings[i];
  6623. ++ if (ring->status != RING_OPEN)
  6624. ++ continue;
  6625. ++ commonring = msgbuf->flowrings[i];
  6626. ++ hash = &msgbuf->flow->hash[ring->hash_id];
  6627. ++ seq_printf(seq, "id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n"
  6628. ++ " ifidx %u, fifo %u, da %pM\n",
  6629. ++ i, commonring->r_ptr, commonring->w_ptr,
  6630. ++ skb_queue_len(&ring->skblist), ring->blocked,
  6631. ++ hash->ifidx, hash->fifo, hash->mac);
  6632. ++ }
  6633. ++
  6634. ++ return 0;
  6635. ++}
  6636. ++#else
  6637. ++static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  6638. ++{
  6639. ++ return 0;
  6640. ++}
  6641. ++#endif
  6642. +
  6643. + int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
  6644. + {
  6645. +@@ -1460,6 +1514,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  6646. + spin_lock_init(&msgbuf->flowring_work_lock);
  6647. + INIT_LIST_HEAD(&msgbuf->work_queue);
  6648. +
  6649. ++ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read);
  6650. ++
  6651. + return 0;
  6652. +
  6653. + fail:
  6654. diff --git a/package/kernel/mac80211/patches/314-mac80211-mesh-avoid-pointless-station-lookup.patch b/package/kernel/mac80211/patches/314-mac80211-mesh-avoid-pointless-station-lookup.patch
  6655. deleted file mode 100644
  6656. index 9105a64..0000000
  6657. --- a/package/kernel/mac80211/patches/314-mac80211-mesh-avoid-pointless-station-lookup.patch
  6658. +++ /dev/null
  6659. @@ -1,33 +0,0 @@
  6660. -From: Johannes Berg <johannes.berg@intel.com>
  6661. -Date: Fri, 20 Mar 2015 16:24:23 +0100
  6662. -Subject: [PATCH] mac80211: mesh: avoid pointless station lookup
  6663. -
  6664. -In ieee80211_build_hdr(), the station is looked up to build the
  6665. -header correctly (QoS field) and to check for authorization. For
  6666. -mesh, authorization isn't checked here, and QoS capability is
  6667. -mandatory, so the station lookup can be avoided.
  6668. -
  6669. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6670. ----
  6671. -
  6672. ---- a/net/mac80211/tx.c
  6673. -+++ b/net/mac80211/tx.c
  6674. -@@ -2130,12 +2130,14 @@ static struct sk_buff *ieee80211_build_h
  6675. - }
  6676. -
  6677. - /*
  6678. -- * There's no need to try to look up the destination
  6679. -- * if it is a multicast address (which can only happen
  6680. -- * in AP mode)
  6681. -+ * There's no need to try to look up the destination station
  6682. -+ * if it is a multicast address. In mesh, there's no need to
  6683. -+ * look up the station at all as it always must be QoS capable
  6684. -+ * and mesh mode checks authorization later.
  6685. - */
  6686. - multicast = is_multicast_ether_addr(hdr.addr1);
  6687. -- if (!multicast && !have_station) {
  6688. -+ if (!multicast && !have_station &&
  6689. -+ !ieee80211_vif_is_mesh(&sdata->vif)) {
  6690. - sta = sta_info_get(sdata, hdr.addr1);
  6691. - if (sta) {
  6692. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  6693. diff --git a/package/kernel/mac80211/patches/315-brcmfmac-make-use-of-cfg80211_check_combinations.patch b/package/kernel/mac80211/patches/315-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  6694. new file mode 100644
  6695. index 0000000..281f02b
  6696. --- /dev/null
  6697. +++ b/package/kernel/mac80211/patches/315-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  6698. @@ -0,0 +1,83 @@
  6699. +From: Arend van Spriel <arend@broadcom.com>
  6700. +Date: Thu, 20 Aug 2015 22:06:05 +0200
  6701. +Subject: [PATCH] brcmfmac: make use of cfg80211_check_combinations()
  6702. +
  6703. +Use cfg80211_check_combinations() so we can bail out early when an
  6704. +interface add or change results in an invalid combination.
  6705. +
  6706. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  6707. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  6708. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  6709. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  6710. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6711. +---
  6712. +
  6713. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  6714. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  6715. +@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 le
  6716. + return NULL;
  6717. + }
  6718. +
  6719. ++static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
  6720. ++ struct brcmf_cfg80211_vif *vif,
  6721. ++ enum nl80211_iftype new_type)
  6722. ++{
  6723. ++ int iftype_num[NUM_NL80211_IFTYPES];
  6724. ++ struct brcmf_cfg80211_vif *pos;
  6725. ++
  6726. ++ memset(&iftype_num[0], 0, sizeof(iftype_num));
  6727. ++ list_for_each_entry(pos, &cfg->vif_list, list)
  6728. ++ if (pos == vif)
  6729. ++ iftype_num[new_type]++;
  6730. ++ else
  6731. ++ iftype_num[pos->wdev.iftype]++;
  6732. ++
  6733. ++ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  6734. ++}
  6735. ++
  6736. ++static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
  6737. ++ enum nl80211_iftype new_type)
  6738. ++{
  6739. ++ int iftype_num[NUM_NL80211_IFTYPES];
  6740. ++ struct brcmf_cfg80211_vif *pos;
  6741. ++
  6742. ++ memset(&iftype_num[0], 0, sizeof(iftype_num));
  6743. ++ list_for_each_entry(pos, &cfg->vif_list, list)
  6744. ++ iftype_num[pos->wdev.iftype]++;
  6745. ++
  6746. ++ iftype_num[new_type]++;
  6747. ++ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  6748. ++}
  6749. +
  6750. + static void convert_key_from_CPU(struct brcmf_wsec_key *key,
  6751. + struct brcmf_wsec_key_le *key_le)
  6752. +@@ -663,8 +693,14 @@ static struct wireless_dev *brcmf_cfg802
  6753. + struct vif_params *params)
  6754. + {
  6755. + struct wireless_dev *wdev;
  6756. ++ int err;
  6757. +
  6758. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  6759. ++ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  6760. ++ if (err) {
  6761. ++ brcmf_err("iface validation failed: err=%d\n", err);
  6762. ++ return ERR_PTR(err);
  6763. ++ }
  6764. + switch (type) {
  6765. + case NL80211_IFTYPE_ADHOC:
  6766. + case NL80211_IFTYPE_STATION:
  6767. +@@ -823,8 +859,12 @@ brcmf_cfg80211_change_iface(struct wiphy
  6768. + s32 ap = 0;
  6769. + s32 err = 0;
  6770. +
  6771. +- brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
  6772. +-
  6773. ++ brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  6774. ++ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  6775. ++ if (err) {
  6776. ++ brcmf_err("iface validation failed: err=%d\n", err);
  6777. ++ return err;
  6778. ++ }
  6779. + switch (type) {
  6780. + case NL80211_IFTYPE_MONITOR:
  6781. + case NL80211_IFTYPE_WDS:
  6782. diff --git a/package/kernel/mac80211/patches/315-mac80211-avoid-duplicate-TX-path-station-lookup.patch b/package/kernel/mac80211/patches/315-mac80211-avoid-duplicate-TX-path-station-lookup.patch
  6783. deleted file mode 100644
  6784. index d143025..0000000
  6785. --- a/package/kernel/mac80211/patches/315-mac80211-avoid-duplicate-TX-path-station-lookup.patch
  6786. +++ /dev/null
  6787. @@ -1,267 +0,0 @@
  6788. -From: Johannes Berg <johannes.berg@intel.com>
  6789. -Date: Fri, 20 Mar 2015 14:18:27 +0100
  6790. -Subject: [PATCH] mac80211: avoid duplicate TX path station lookup
  6791. -
  6792. -Instead of looking up the destination station twice in the TX path
  6793. -(first to build the header, and then for control processing), save
  6794. -it when building the header and use it later in the TX path.
  6795. -
  6796. -To avoid having to look up the station in the many callers, allow
  6797. -those to pass %NULL which keeps the existing lookup.
  6798. -
  6799. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6800. ----
  6801. -
  6802. ---- a/net/mac80211/cfg.c
  6803. -+++ b/net/mac80211/cfg.c
  6804. -@@ -3565,7 +3565,7 @@ static int ieee80211_probe_client(struct
  6805. - nullfunc->qos_ctrl = cpu_to_le16(7);
  6806. -
  6807. - local_bh_disable();
  6808. -- ieee80211_xmit(sdata, skb);
  6809. -+ ieee80211_xmit(sdata, sta, skb);
  6810. - local_bh_enable();
  6811. - rcu_read_unlock();
  6812. -
  6813. ---- a/net/mac80211/ieee80211_i.h
  6814. -+++ b/net/mac80211/ieee80211_i.h
  6815. -@@ -1775,7 +1775,8 @@ void mac80211_ev_michael_mic_failure(str
  6816. - gfp_t gfp);
  6817. - void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
  6818. - bool bss_notify);
  6819. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
  6820. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  6821. -+ struct sta_info *sta, struct sk_buff *skb);
  6822. -
  6823. - void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
  6824. - struct sk_buff *skb, int tid,
  6825. ---- a/net/mac80211/sta_info.c
  6826. -+++ b/net/mac80211/sta_info.c
  6827. -@@ -1279,7 +1279,7 @@ static void ieee80211_send_null_response
  6828. - }
  6829. -
  6830. - info->band = chanctx_conf->def.chan->band;
  6831. -- ieee80211_xmit(sdata, skb);
  6832. -+ ieee80211_xmit(sdata, sta, skb);
  6833. - rcu_read_unlock();
  6834. - }
  6835. -
  6836. ---- a/net/mac80211/tx.c
  6837. -+++ b/net/mac80211/tx.c
  6838. -@@ -1110,11 +1110,13 @@ static bool ieee80211_tx_prep_agg(struct
  6839. -
  6840. - /*
  6841. - * initialises @tx
  6842. -+ * pass %NULL for the station if unknown, a valid pointer if known
  6843. -+ * or an ERR_PTR() if the station is known not to exist
  6844. - */
  6845. - static ieee80211_tx_result
  6846. - ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
  6847. - struct ieee80211_tx_data *tx,
  6848. -- struct sk_buff *skb)
  6849. -+ struct sta_info *sta, struct sk_buff *skb)
  6850. - {
  6851. - struct ieee80211_local *local = sdata->local;
  6852. - struct ieee80211_hdr *hdr;
  6853. -@@ -1137,17 +1139,22 @@ ieee80211_tx_prepare(struct ieee80211_su
  6854. -
  6855. - hdr = (struct ieee80211_hdr *) skb->data;
  6856. -
  6857. -- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  6858. -- tx->sta = rcu_dereference(sdata->u.vlan.sta);
  6859. -- if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
  6860. -- return TX_DROP;
  6861. -- } else if (info->flags & (IEEE80211_TX_CTL_INJECTED |
  6862. -- IEEE80211_TX_INTFL_NL80211_FRAME_TX) ||
  6863. -- tx->sdata->control_port_protocol == tx->skb->protocol) {
  6864. -- tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  6865. -+ if (likely(sta)) {
  6866. -+ if (!IS_ERR(sta))
  6867. -+ tx->sta = sta;
  6868. -+ } else {
  6869. -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  6870. -+ tx->sta = rcu_dereference(sdata->u.vlan.sta);
  6871. -+ if (!tx->sta && sdata->wdev.use_4addr)
  6872. -+ return TX_DROP;
  6873. -+ } else if (info->flags & (IEEE80211_TX_INTFL_NL80211_FRAME_TX |
  6874. -+ IEEE80211_TX_CTL_INJECTED) ||
  6875. -+ tx->sdata->control_port_protocol == tx->skb->protocol) {
  6876. -+ tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  6877. -+ }
  6878. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  6879. -+ tx->sta = sta_info_get(sdata, hdr->addr1);
  6880. - }
  6881. -- if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  6882. -- tx->sta = sta_info_get(sdata, hdr->addr1);
  6883. -
  6884. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  6885. - !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
  6886. -@@ -1485,7 +1492,7 @@ bool ieee80211_tx_prepare_skb(struct iee
  6887. - struct ieee80211_tx_data tx;
  6888. - struct sk_buff *skb2;
  6889. -
  6890. -- if (ieee80211_tx_prepare(sdata, &tx, skb) == TX_DROP)
  6891. -+ if (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP)
  6892. - return false;
  6893. -
  6894. - info->band = band;
  6895. -@@ -1518,7 +1525,8 @@ EXPORT_SYMBOL(ieee80211_tx_prepare_skb);
  6896. - * Returns false if the frame couldn't be transmitted but was queued instead.
  6897. - */
  6898. - static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
  6899. -- struct sk_buff *skb, bool txpending)
  6900. -+ struct sta_info *sta, struct sk_buff *skb,
  6901. -+ bool txpending)
  6902. - {
  6903. - struct ieee80211_local *local = sdata->local;
  6904. - struct ieee80211_tx_data tx;
  6905. -@@ -1534,7 +1542,7 @@ static bool ieee80211_tx(struct ieee8021
  6906. -
  6907. - /* initialises tx */
  6908. - led_len = skb->len;
  6909. -- res_prepare = ieee80211_tx_prepare(sdata, &tx, skb);
  6910. -+ res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
  6911. -
  6912. - if (unlikely(res_prepare == TX_DROP)) {
  6913. - ieee80211_free_txskb(&local->hw, skb);
  6914. -@@ -1590,7 +1598,8 @@ static int ieee80211_skb_resize(struct i
  6915. - return 0;
  6916. - }
  6917. -
  6918. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
  6919. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  6920. -+ struct sta_info *sta, struct sk_buff *skb)
  6921. - {
  6922. - struct ieee80211_local *local = sdata->local;
  6923. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6924. -@@ -1625,7 +1634,7 @@ void ieee80211_xmit(struct ieee80211_sub
  6925. - }
  6926. -
  6927. - ieee80211_set_qos_hdr(sdata, skb);
  6928. -- ieee80211_tx(sdata, skb, false);
  6929. -+ ieee80211_tx(sdata, sta, skb, false);
  6930. - }
  6931. -
  6932. - static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  6933. -@@ -1846,7 +1855,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  6934. - goto fail_rcu;
  6935. -
  6936. - info->band = chandef->chan->band;
  6937. -- ieee80211_xmit(sdata, skb);
  6938. -+ ieee80211_xmit(sdata, NULL, skb);
  6939. - rcu_read_unlock();
  6940. -
  6941. - return NETDEV_TX_OK;
  6942. -@@ -1877,7 +1886,8 @@ fail:
  6943. - * Returns: the (possibly reallocated) skb or an ERR_PTR() code
  6944. - */
  6945. - static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
  6946. -- struct sk_buff *skb, u32 info_flags)
  6947. -+ struct sk_buff *skb, u32 info_flags,
  6948. -+ struct sta_info **sta_out)
  6949. - {
  6950. - struct ieee80211_local *local = sdata->local;
  6951. - struct ieee80211_tx_info *info;
  6952. -@@ -1920,6 +1930,7 @@ static struct sk_buff *ieee80211_build_h
  6953. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  6954. - wme_sta = sta->sta.wme;
  6955. - have_station = true;
  6956. -+ *sta_out = sta;
  6957. - } else if (sdata->wdev.use_4addr) {
  6958. - ret = -ENOLINK;
  6959. - goto free;
  6960. -@@ -2073,6 +2084,7 @@ static struct sk_buff *ieee80211_build_h
  6961. - have_station = true;
  6962. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  6963. - wme_sta = sta->sta.wme;
  6964. -+ *sta_out = sta;
  6965. - } else if (sdata->u.mgd.use_4addr &&
  6966. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  6967. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  6968. -@@ -2136,13 +2148,18 @@ static struct sk_buff *ieee80211_build_h
  6969. - * and mesh mode checks authorization later.
  6970. - */
  6971. - multicast = is_multicast_ether_addr(hdr.addr1);
  6972. -- if (!multicast && !have_station &&
  6973. -- !ieee80211_vif_is_mesh(&sdata->vif)) {
  6974. -- sta = sta_info_get(sdata, hdr.addr1);
  6975. -+ if (multicast) {
  6976. -+ *sta_out = ERR_PTR(-ENOENT);
  6977. -+ } else if (!have_station && !ieee80211_vif_is_mesh(&sdata->vif)) {
  6978. -+ if (sdata->control_port_protocol == skb->protocol)
  6979. -+ sta = sta_info_get_bss(sdata, hdr.addr1);
  6980. -+ else
  6981. -+ sta = sta_info_get(sdata, hdr.addr1);
  6982. - if (sta) {
  6983. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  6984. - wme_sta = sta->sta.wme;
  6985. - }
  6986. -+ *sta_out = sta ?: ERR_PTR(-ENOENT);
  6987. - }
  6988. -
  6989. - /* For mesh, the use of the QoS header is mandatory */
  6990. -@@ -2320,6 +2337,7 @@ void __ieee80211_subif_start_xmit(struct
  6991. - u32 info_flags)
  6992. - {
  6993. - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  6994. -+ struct sta_info *sta = NULL;
  6995. -
  6996. - if (unlikely(skb->len < ETH_HLEN)) {
  6997. - kfree_skb(skb);
  6998. -@@ -2328,7 +2346,7 @@ void __ieee80211_subif_start_xmit(struct
  6999. -
  7000. - rcu_read_lock();
  7001. -
  7002. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  7003. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta);
  7004. - if (IS_ERR(skb))
  7005. - goto out;
  7006. -
  7007. -@@ -2336,7 +2354,7 @@ void __ieee80211_subif_start_xmit(struct
  7008. - dev->stats.tx_bytes += skb->len;
  7009. - dev->trans_start = jiffies;
  7010. -
  7011. -- ieee80211_xmit(sdata, skb);
  7012. -+ ieee80211_xmit(sdata, sta, skb);
  7013. - out:
  7014. - rcu_read_unlock();
  7015. - }
  7016. -@@ -2364,10 +2382,11 @@ ieee80211_build_data_template(struct iee
  7017. - .local = sdata->local,
  7018. - .sdata = sdata,
  7019. - };
  7020. -+ struct sta_info *sta_ignore;
  7021. -
  7022. - rcu_read_lock();
  7023. -
  7024. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  7025. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta_ignore);
  7026. - if (IS_ERR(skb))
  7027. - goto out;
  7028. -
  7029. -@@ -2425,7 +2444,7 @@ static bool ieee80211_tx_pending_skb(str
  7030. - return true;
  7031. - }
  7032. - info->band = chanctx_conf->def.chan->band;
  7033. -- result = ieee80211_tx(sdata, skb, true);
  7034. -+ result = ieee80211_tx(sdata, NULL, skb, true);
  7035. - } else {
  7036. - struct sk_buff_head skbs;
  7037. -
  7038. -@@ -3163,7 +3182,7 @@ ieee80211_get_buffered_bc(struct ieee802
  7039. -
  7040. - if (sdata->vif.type == NL80211_IFTYPE_AP)
  7041. - sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
  7042. -- if (!ieee80211_tx_prepare(sdata, &tx, skb))
  7043. -+ if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
  7044. - break;
  7045. - dev_kfree_skb_any(skb);
  7046. - }
  7047. -@@ -3295,6 +3314,6 @@ void __ieee80211_tx_skb_tid_band(struct
  7048. - */
  7049. - local_bh_disable();
  7050. - IEEE80211_SKB_CB(skb)->band = band;
  7051. -- ieee80211_xmit(sdata, skb);
  7052. -+ ieee80211_xmit(sdata, NULL, skb);
  7053. - local_bh_enable();
  7054. - }
  7055. diff --git a/package/kernel/mac80211/patches/316-brcmfmac-block-the-correct-flowring-when-backup-queu.patch b/package/kernel/mac80211/patches/316-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  7056. new file mode 100644
  7057. index 0000000..2d5f7b9
  7058. --- /dev/null
  7059. +++ b/package/kernel/mac80211/patches/316-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  7060. @@ -0,0 +1,48 @@
  7061. +From: Franky Lin <frankyl@broadcom.com>
  7062. +Date: Thu, 20 Aug 2015 22:06:06 +0200
  7063. +Subject: [PATCH] brcmfmac: block the correct flowring when backup queue
  7064. + overflow
  7065. +
  7066. +brcmf_flowring_block blocks the last active flowring under the same
  7067. +interface instead of the one provided by caller. This could lead to a
  7068. +dead lock of netif stop if there are more than one flowring under the
  7069. +interface and the traffic is high enough so brcmf_flowring_enqueue can
  7070. +not unblock the ring right away.
  7071. +
  7072. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7073. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  7074. +Signed-off-by: Franky Lin <frankyl@broadcom.com>
  7075. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7076. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7077. +---
  7078. +
  7079. +--- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  7080. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  7081. +@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct
  7082. + spin_lock_irqsave(&flow->block_lock, flags);
  7083. +
  7084. + ring = flow->rings[flowid];
  7085. ++ if (ring->blocked == blocked) {
  7086. ++ spin_unlock_irqrestore(&flow->block_lock, flags);
  7087. ++ return;
  7088. ++ }
  7089. + ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  7090. +
  7091. + currently_blocked = false;
  7092. + for (i = 0; i < flow->nrofrings; i++) {
  7093. +- if (flow->rings[i]) {
  7094. ++ if ((flow->rings[i]) && (i != flowid)) {
  7095. + ring = flow->rings[i];
  7096. + if ((ring->status == RING_OPEN) &&
  7097. + (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
  7098. +@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct
  7099. + }
  7100. + }
  7101. + }
  7102. +- ring->blocked = blocked;
  7103. +- if (currently_blocked == blocked) {
  7104. ++ flow->rings[flowid]->blocked = blocked;
  7105. ++ if (currently_blocked) {
  7106. + spin_unlock_irqrestore(&flow->block_lock, flags);
  7107. + return;
  7108. + }
  7109. diff --git a/package/kernel/mac80211/patches/316-mac80211-reduce-log-spam-from-ieee80211_handle_pwr_c.patch b/package/kernel/mac80211/patches/316-mac80211-reduce-log-spam-from-ieee80211_handle_pwr_c.patch
  7110. deleted file mode 100644
  7111. index 77a82c2..0000000
  7112. --- a/package/kernel/mac80211/patches/316-mac80211-reduce-log-spam-from-ieee80211_handle_pwr_c.patch
  7113. +++ /dev/null
  7114. @@ -1,38 +0,0 @@
  7115. -From: John Linville <linville@tuxdriver.com>
  7116. -Date: Tue, 31 Mar 2015 10:49:14 -0400
  7117. -Subject: [PATCH] mac80211: reduce log spam from ieee80211_handle_pwr_constr
  7118. -
  7119. -This changes a couple of messages from sdata_info to sdata_dbg.
  7120. -This should reduce some log spam, as reported here:
  7121. -
  7122. - https://bugzilla.redhat.com/show_bug.cgi?id=1206468
  7123. -
  7124. -Signed-off-by: John W. Linville <linville@tuxdriver.com>
  7125. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7126. ----
  7127. -
  7128. ---- a/net/mac80211/mlme.c
  7129. -+++ b/net/mac80211/mlme.c
  7130. -@@ -1347,15 +1347,15 @@ static u32 ieee80211_handle_pwr_constr(s
  7131. - */
  7132. - if (has_80211h_pwr &&
  7133. - (!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) {
  7134. -- sdata_info(sdata,
  7135. -- "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  7136. -- pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  7137. -- sdata->u.mgd.bssid);
  7138. -+ sdata_dbg(sdata,
  7139. -+ "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  7140. -+ pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  7141. -+ sdata->u.mgd.bssid);
  7142. - new_ap_level = pwr_level_80211h;
  7143. - } else { /* has_cisco_pwr is always true here. */
  7144. -- sdata_info(sdata,
  7145. -- "Limiting TX power to %d dBm as advertised by %pM\n",
  7146. -- pwr_level_cisco, sdata->u.mgd.bssid);
  7147. -+ sdata_dbg(sdata,
  7148. -+ "Limiting TX power to %d dBm as advertised by %pM\n",
  7149. -+ pwr_level_cisco, sdata->u.mgd.bssid);
  7150. - new_ap_level = pwr_level_cisco;
  7151. - }
  7152. -
  7153. diff --git a/package/kernel/mac80211/patches/317-brcmfmac-Fix-race-condition-in-msgbuf-ioctl-processi.patch b/package/kernel/mac80211/patches/317-brcmfmac-Fix-race-condition-in-msgbuf-ioctl-processi.patch
  7154. deleted file mode 100644
  7155. index e005fe7..0000000
  7156. --- a/package/kernel/mac80211/patches/317-brcmfmac-Fix-race-condition-in-msgbuf-ioctl-processi.patch
  7157. +++ /dev/null
  7158. @@ -1,35 +0,0 @@
  7159. -From: Hante Meuleman <meuleman@broadcom.com>
  7160. -Date: Fri, 6 Mar 2015 18:40:41 +0100
  7161. -Subject: [PATCH] brcmfmac: Fix race condition in msgbuf ioctl processing.
  7162. -
  7163. -Msgbuf is using a wait_event_timeout to wait for the response on
  7164. -an ioctl. The wakeup routine uses waitqueue_active to see if
  7165. -wait_event_timeout has been called. There is a chance that the
  7166. -response arrives before wait_event_timeout is called, this
  7167. -will result in situation that wait_event_timeout never gets
  7168. -woken again and assumed result will be a timeout. This patch
  7169. -removes that errornous situation by always setting the
  7170. -ctl_completed var before checking for queue active.
  7171. -
  7172. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  7173. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7174. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  7175. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7176. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7177. ----
  7178. -
  7179. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  7180. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  7181. -@@ -481,10 +481,9 @@ static int brcmf_msgbuf_ioctl_resp_wait(
  7182. -
  7183. - static void brcmf_msgbuf_ioctl_resp_wake(struct brcmf_msgbuf *msgbuf)
  7184. - {
  7185. -- if (waitqueue_active(&msgbuf->ioctl_resp_wait)) {
  7186. -- msgbuf->ctl_completed = true;
  7187. -+ msgbuf->ctl_completed = true;
  7188. -+ if (waitqueue_active(&msgbuf->ioctl_resp_wait))
  7189. - wake_up(&msgbuf->ioctl_resp_wait);
  7190. -- }
  7191. - }
  7192. -
  7193. -
  7194. diff --git a/package/kernel/mac80211/patches/317-brcmfmac-bump-highest-event-number-for-4339-firmware.patch b/package/kernel/mac80211/patches/317-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  7195. new file mode 100644
  7196. index 0000000..7378401
  7197. --- /dev/null
  7198. +++ b/package/kernel/mac80211/patches/317-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  7199. @@ -0,0 +1,52 @@
  7200. +From: Arend van Spriel <arend@broadcom.com>
  7201. +Date: Thu, 20 Aug 2015 22:06:07 +0200
  7202. +Subject: [PATCH] brcmfmac: bump highest event number for 4339 firmware
  7203. +
  7204. +The event mask length is determined by the highest event number
  7205. +that is specified in the driver. When this length is shorter than
  7206. +firmware expects setting event mask will fail and device becomes
  7207. +pretty useless. This issue was reported with bcm4339 firmware that
  7208. +was recently released.
  7209. +
  7210. +Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  7211. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  7212. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  7213. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7214. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  7215. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7216. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7217. +---
  7218. +
  7219. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  7220. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  7221. +@@ -85,7 +85,6 @@ struct brcmf_event;
  7222. + BRCMF_ENUM_DEF(IF, 54) \
  7223. + BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \
  7224. + BRCMF_ENUM_DEF(RSSI, 56) \
  7225. +- BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
  7226. + BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
  7227. + BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
  7228. + BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
  7229. +@@ -103,8 +102,7 @@ struct brcmf_event;
  7230. + BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
  7231. + BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
  7232. + BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
  7233. +- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
  7234. +- BRCMF_ENUM_DEF(PSTA_PRIMARY_INTF_IND, 128)
  7235. ++ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
  7236. +
  7237. + #define BRCMF_ENUM_DEF(id, val) \
  7238. + BRCMF_E_##id = (val),
  7239. +@@ -112,7 +110,11 @@ struct brcmf_event;
  7240. + /* firmware event codes sent by the dongle */
  7241. + enum brcmf_fweh_event_code {
  7242. + BRCMF_FWEH_EVENT_ENUM_DEFLIST
  7243. +- BRCMF_E_LAST
  7244. ++ /* this determines event mask length which must match
  7245. ++ * minimum length check in device firmware so it is
  7246. ++ * hard-coded here.
  7247. ++ */
  7248. ++ BRCMF_E_LAST = 139
  7249. + };
  7250. + #undef BRCMF_ENUM_DEF
  7251. +
  7252. diff --git a/package/kernel/mac80211/patches/318-brcmfmac-Update-msgbuf-commonring-size-for-improved-.patch b/package/kernel/mac80211/patches/318-brcmfmac-Update-msgbuf-commonring-size-for-improved-.patch
  7253. deleted file mode 100644
  7254. index c2cd1c5..0000000
  7255. --- a/package/kernel/mac80211/patches/318-brcmfmac-Update-msgbuf-commonring-size-for-improved-.patch
  7256. +++ /dev/null
  7257. @@ -1,30 +0,0 @@
  7258. -From: Hante Meuleman <meuleman@broadcom.com>
  7259. -Date: Wed, 18 Mar 2015 13:25:23 +0100
  7260. -Subject: [PATCH] brcmfmac: Update msgbuf commonring size for improved
  7261. - throughput.
  7262. -
  7263. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  7264. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7265. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  7266. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7267. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7268. ----
  7269. -
  7270. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  7271. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  7272. -@@ -17,11 +17,11 @@
  7273. -
  7274. - #ifdef CPTCFG_BRCMFMAC_PROTO_MSGBUF
  7275. -
  7276. --#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20
  7277. --#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256
  7278. --#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 20
  7279. -+#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 64
  7280. -+#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 512
  7281. -+#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 64
  7282. - #define BRCMF_D2H_MSGRING_TX_COMPLETE_MAX_ITEM 1024
  7283. --#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 256
  7284. -+#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 512
  7285. - #define BRCMF_H2D_TXFLOWRING_MAX_ITEM 512
  7286. -
  7287. - #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE 40
  7288. diff --git a/package/kernel/mac80211/patches/319-ath9k_htc-add-new-WMI_REG_RMW_CMDID-command.patch b/package/kernel/mac80211/patches/319-ath9k_htc-add-new-WMI_REG_RMW_CMDID-command.patch
  7289. deleted file mode 100644
  7290. index 6af69eb..0000000
  7291. --- a/package/kernel/mac80211/patches/319-ath9k_htc-add-new-WMI_REG_RMW_CMDID-command.patch
  7292. +++ /dev/null
  7293. @@ -1,307 +0,0 @@
  7294. -From: Oleksij Rempel <linux@rempel-privat.de>
  7295. -Date: Sun, 22 Mar 2015 19:29:46 +0100
  7296. -Subject: [PATCH] ath9k_htc: add new WMI_REG_RMW_CMDID command
  7297. -
  7298. -Since usb bus add extra delay on each request, a command
  7299. -with read + write requests is too expensive. We can dramtically
  7300. -reduce usb load by moving this command to firmware.
  7301. -
  7302. -In my tests, this patch will reduce channel scan time
  7303. -for about 5-10 seconds.
  7304. -
  7305. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  7306. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7307. ----
  7308. -
  7309. ---- a/drivers/net/wireless/ath/ath.h
  7310. -+++ b/drivers/net/wireless/ath/ath.h
  7311. -@@ -131,6 +131,9 @@ struct ath_ops {
  7312. - void (*enable_write_buffer)(void *);
  7313. - void (*write_flush) (void *);
  7314. - u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
  7315. -+ void (*enable_rmw_buffer)(void *);
  7316. -+ void (*rmw_flush) (void *);
  7317. -+
  7318. - };
  7319. -
  7320. - struct ath_common;
  7321. ---- a/drivers/net/wireless/ath/ath9k/htc.h
  7322. -+++ b/drivers/net/wireless/ath/ath9k/htc.h
  7323. -@@ -444,6 +444,10 @@ static inline void ath9k_htc_stop_btcoex
  7324. - #define OP_BT_SCAN BIT(4)
  7325. - #define OP_TSF_RESET BIT(6)
  7326. -
  7327. -+enum htc_op_flags {
  7328. -+ HTC_FWFLAG_NO_RMW,
  7329. -+};
  7330. -+
  7331. - struct ath9k_htc_priv {
  7332. - struct device *dev;
  7333. - struct ieee80211_hw *hw;
  7334. -@@ -482,6 +486,7 @@ struct ath9k_htc_priv {
  7335. - bool reconfig_beacon;
  7336. - unsigned int rxfilter;
  7337. - unsigned long op_flags;
  7338. -+ unsigned long fw_flags;
  7339. -
  7340. - struct ath9k_hw_cal_data caldata;
  7341. - struct ath_spec_scan_priv spec_priv;
  7342. ---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  7343. -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  7344. -@@ -376,17 +376,139 @@ static void ath9k_regwrite_flush(void *h
  7345. - mutex_unlock(&priv->wmi->multi_write_mutex);
  7346. - }
  7347. -
  7348. --static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  7349. -+static void ath9k_reg_rmw_buffer(void *hw_priv,
  7350. -+ u32 reg_offset, u32 set, u32 clr)
  7351. -+{
  7352. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  7353. -+ struct ath_common *common = ath9k_hw_common(ah);
  7354. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  7355. -+ u32 rsp_status;
  7356. -+ int r;
  7357. -+
  7358. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  7359. -+
  7360. -+ /* Store the register/value */
  7361. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].reg =
  7362. -+ cpu_to_be32(reg_offset);
  7363. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].set =
  7364. -+ cpu_to_be32(set);
  7365. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].clr =
  7366. -+ cpu_to_be32(clr);
  7367. -+
  7368. -+ priv->wmi->multi_rmw_idx++;
  7369. -+
  7370. -+ /* If the buffer is full, send it out. */
  7371. -+ if (priv->wmi->multi_rmw_idx == MAX_RMW_CMD_NUMBER) {
  7372. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  7373. -+ (u8 *) &priv->wmi->multi_rmw,
  7374. -+ sizeof(struct register_write) * priv->wmi->multi_rmw_idx,
  7375. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  7376. -+ 100);
  7377. -+ if (unlikely(r)) {
  7378. -+ ath_dbg(common, WMI,
  7379. -+ "REGISTER RMW FAILED, multi len: %d\n",
  7380. -+ priv->wmi->multi_rmw_idx);
  7381. -+ }
  7382. -+ priv->wmi->multi_rmw_idx = 0;
  7383. -+ }
  7384. -+
  7385. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  7386. -+}
  7387. -+
  7388. -+static void ath9k_reg_rmw_flush(void *hw_priv)
  7389. - {
  7390. -- u32 val;
  7391. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  7392. -+ struct ath_common *common = ath9k_hw_common(ah);
  7393. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  7394. -+ u32 rsp_status;
  7395. -+ int r;
  7396. -+
  7397. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  7398. -+ return;
  7399. -+
  7400. -+ atomic_dec(&priv->wmi->m_rmw_cnt);
  7401. -+
  7402. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  7403. -+
  7404. -+ if (priv->wmi->multi_rmw_idx) {
  7405. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  7406. -+ (u8 *) &priv->wmi->multi_rmw,
  7407. -+ sizeof(struct register_rmw) * priv->wmi->multi_rmw_idx,
  7408. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  7409. -+ 100);
  7410. -+ if (unlikely(r)) {
  7411. -+ ath_dbg(common, WMI,
  7412. -+ "REGISTER RMW FAILED, multi len: %d\n",
  7413. -+ priv->wmi->multi_rmw_idx);
  7414. -+ }
  7415. -+ priv->wmi->multi_rmw_idx = 0;
  7416. -+ }
  7417. -
  7418. -- val = ath9k_regread(hw_priv, reg_offset);
  7419. -- val &= ~clr;
  7420. -- val |= set;
  7421. -- ath9k_regwrite(hw_priv, val, reg_offset);
  7422. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  7423. -+}
  7424. -+
  7425. -+static void ath9k_enable_rmw_buffer(void *hw_priv)
  7426. -+{
  7427. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  7428. -+ struct ath_common *common = ath9k_hw_common(ah);
  7429. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  7430. -+
  7431. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  7432. -+ return;
  7433. -+
  7434. -+ atomic_inc(&priv->wmi->m_rmw_cnt);
  7435. -+}
  7436. -+
  7437. -+static u32 ath9k_reg_rmw_single(void *hw_priv,
  7438. -+ u32 reg_offset, u32 set, u32 clr)
  7439. -+{
  7440. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  7441. -+ struct ath_common *common = ath9k_hw_common(ah);
  7442. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  7443. -+ struct register_rmw buf, buf_ret;
  7444. -+ int ret;
  7445. -+ u32 val = 0;
  7446. -+
  7447. -+ buf.reg = cpu_to_be32(reg_offset);
  7448. -+ buf.set = cpu_to_be32(set);
  7449. -+ buf.clr = cpu_to_be32(clr);
  7450. -+
  7451. -+ ret = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  7452. -+ (u8 *) &buf, sizeof(buf),
  7453. -+ (u8 *) &buf_ret, sizeof(buf_ret),
  7454. -+ 100);
  7455. -+ if (unlikely(ret)) {
  7456. -+ ath_dbg(common, WMI, "REGISTER RMW FAILED:(0x%04x, %d)\n",
  7457. -+ reg_offset, ret);
  7458. -+ }
  7459. - return val;
  7460. - }
  7461. -
  7462. -+static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  7463. -+{
  7464. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  7465. -+ struct ath_common *common = ath9k_hw_common(ah);
  7466. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  7467. -+
  7468. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags)) {
  7469. -+ u32 val;
  7470. -+
  7471. -+ val = REG_READ(ah, reg_offset);
  7472. -+ val &= ~clr;
  7473. -+ val |= set;
  7474. -+ REG_WRITE(ah, reg_offset, val);
  7475. -+
  7476. -+ return 0;
  7477. -+ }
  7478. -+
  7479. -+ if (atomic_read(&priv->wmi->m_rmw_cnt))
  7480. -+ ath9k_reg_rmw_buffer(hw_priv, reg_offset, set, clr);
  7481. -+ else
  7482. -+ ath9k_reg_rmw_single(hw_priv, reg_offset, set, clr);
  7483. -+
  7484. -+ return 0;
  7485. -+}
  7486. -+
  7487. - static void ath_usb_read_cachesize(struct ath_common *common, int *csz)
  7488. - {
  7489. - *csz = L1_CACHE_BYTES >> 2;
  7490. -@@ -501,6 +623,8 @@ static int ath9k_init_priv(struct ath9k_
  7491. - ah->reg_ops.write = ath9k_regwrite;
  7492. - ah->reg_ops.enable_write_buffer = ath9k_enable_regwrite_buffer;
  7493. - ah->reg_ops.write_flush = ath9k_regwrite_flush;
  7494. -+ ah->reg_ops.enable_rmw_buffer = ath9k_enable_rmw_buffer;
  7495. -+ ah->reg_ops.rmw_flush = ath9k_reg_rmw_flush;
  7496. - ah->reg_ops.rmw = ath9k_reg_rmw;
  7497. - priv->ah = ah;
  7498. -
  7499. -@@ -686,6 +810,12 @@ static int ath9k_init_firmware_version(s
  7500. - return -EINVAL;
  7501. - }
  7502. -
  7503. -+ if (priv->fw_version_major == 1 && priv->fw_version_minor < 4)
  7504. -+ set_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags);
  7505. -+
  7506. -+ dev_info(priv->dev, "FW RMW support: %s\n",
  7507. -+ test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags) ? "Off" : "On");
  7508. -+
  7509. - return 0;
  7510. - }
  7511. -
  7512. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  7513. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  7514. -@@ -100,6 +100,18 @@
  7515. - (_ah)->reg_ops.write_flush((_ah)); \
  7516. - } while (0)
  7517. -
  7518. -+#define ENABLE_REG_RMW_BUFFER(_ah) \
  7519. -+ do { \
  7520. -+ if ((_ah)->reg_ops.enable_rmw_buffer) \
  7521. -+ (_ah)->reg_ops.enable_rmw_buffer((_ah)); \
  7522. -+ } while (0)
  7523. -+
  7524. -+#define REG_RMW_BUFFER_FLUSH(_ah) \
  7525. -+ do { \
  7526. -+ if ((_ah)->reg_ops.rmw_flush) \
  7527. -+ (_ah)->reg_ops.rmw_flush((_ah)); \
  7528. -+ } while (0)
  7529. -+
  7530. - #define PR_EEP(_s, _val) \
  7531. - do { \
  7532. - len += scnprintf(buf + len, size - len, "%20s : %10d\n",\
  7533. ---- a/drivers/net/wireless/ath/ath9k/wmi.c
  7534. -+++ b/drivers/net/wireless/ath/ath9k/wmi.c
  7535. -@@ -61,6 +61,8 @@ static const char *wmi_cmd_to_name(enum
  7536. - return "WMI_REG_READ_CMDID";
  7537. - case WMI_REG_WRITE_CMDID:
  7538. - return "WMI_REG_WRITE_CMDID";
  7539. -+ case WMI_REG_RMW_CMDID:
  7540. -+ return "WMI_REG_RMW_CMDID";
  7541. - case WMI_RC_STATE_CHANGE_CMDID:
  7542. - return "WMI_RC_STATE_CHANGE_CMDID";
  7543. - case WMI_RC_RATE_UPDATE_CMDID:
  7544. -@@ -101,6 +103,7 @@ struct wmi *ath9k_init_wmi(struct ath9k_
  7545. - spin_lock_init(&wmi->event_lock);
  7546. - mutex_init(&wmi->op_mutex);
  7547. - mutex_init(&wmi->multi_write_mutex);
  7548. -+ mutex_init(&wmi->multi_rmw_mutex);
  7549. - init_completion(&wmi->cmd_wait);
  7550. - INIT_LIST_HEAD(&wmi->pending_tx_events);
  7551. - tasklet_init(&wmi->wmi_event_tasklet, ath9k_wmi_event_tasklet,
  7552. ---- a/drivers/net/wireless/ath/ath9k/wmi.h
  7553. -+++ b/drivers/net/wireless/ath/ath9k/wmi.h
  7554. -@@ -112,6 +112,7 @@ enum wmi_cmd_id {
  7555. - WMI_TX_STATS_CMDID,
  7556. - WMI_RX_STATS_CMDID,
  7557. - WMI_BITRATE_MASK_CMDID,
  7558. -+ WMI_REG_RMW_CMDID,
  7559. - };
  7560. -
  7561. - enum wmi_event_id {
  7562. -@@ -125,12 +126,19 @@ enum wmi_event_id {
  7563. - };
  7564. -
  7565. - #define MAX_CMD_NUMBER 62
  7566. -+#define MAX_RMW_CMD_NUMBER 15
  7567. -
  7568. - struct register_write {
  7569. - __be32 reg;
  7570. - __be32 val;
  7571. - };
  7572. -
  7573. -+struct register_rmw {
  7574. -+ __be32 reg;
  7575. -+ __be32 set;
  7576. -+ __be32 clr;
  7577. -+} __packed;
  7578. -+
  7579. - struct ath9k_htc_tx_event {
  7580. - int count;
  7581. - struct __wmi_event_txstatus txs;
  7582. -@@ -156,10 +164,18 @@ struct wmi {
  7583. -
  7584. - spinlock_t wmi_lock;
  7585. -
  7586. -+ /* multi write section */
  7587. - atomic_t mwrite_cnt;
  7588. - struct register_write multi_write[MAX_CMD_NUMBER];
  7589. - u32 multi_write_idx;
  7590. - struct mutex multi_write_mutex;
  7591. -+
  7592. -+ /* multi rmw section */
  7593. -+ atomic_t m_rmw_cnt;
  7594. -+ struct register_rmw multi_rmw[MAX_RMW_CMD_NUMBER];
  7595. -+ u32 multi_rmw_idx;
  7596. -+ struct mutex multi_rmw_mutex;
  7597. -+
  7598. - };
  7599. -
  7600. - struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv);
  7601. diff --git a/package/kernel/mac80211/patches/319-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch b/package/kernel/mac80211/patches/319-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  7602. new file mode 100644
  7603. index 0000000..97444b3
  7604. --- /dev/null
  7605. +++ b/package/kernel/mac80211/patches/319-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  7606. @@ -0,0 +1,138 @@
  7607. +From: Arend van Spriel <arend@broadcom.com>
  7608. +Date: Wed, 26 Aug 2015 22:14:53 +0200
  7609. +Subject: [PATCH] brcmfmac: consolidate ifp lookup in driver core
  7610. +
  7611. +In rx path the firmware provide an interface index which is used to
  7612. +map to a struct brcmf_if instance. However, this involves some trick
  7613. +that is done in two places. This is changed by having driver core
  7614. +providing brcmf_get_ifp() function.
  7615. +
  7616. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  7617. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  7618. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7619. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7620. +---
  7621. +
  7622. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  7623. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  7624. +@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  7625. + struct sk_buff *pktbuf)
  7626. + {
  7627. + struct brcmf_proto_bcdc_header *h;
  7628. ++ struct brcmf_if *ifp;
  7629. +
  7630. + brcmf_dbg(BCDC, "Enter\n");
  7631. +
  7632. +@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  7633. + trace_brcmf_bcdchdr(pktbuf->data);
  7634. + h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  7635. +
  7636. +- *ifidx = BCDC_GET_IF_IDX(h);
  7637. +- if (*ifidx >= BRCMF_MAX_IFS) {
  7638. +- brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
  7639. ++ ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  7640. ++ if (IS_ERR_OR_NULL(ifp)) {
  7641. ++ brcmf_dbg(INFO, "no matching ifp found\n");
  7642. + return -EBADE;
  7643. + }
  7644. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  7645. +- * events this is easy because it contains the bssidx which maps
  7646. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  7647. +- * bssidx 1 is used for p2p0 and no data can be received or
  7648. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  7649. +- */
  7650. +- if (*ifidx)
  7651. +- (*ifidx)++;
  7652. +-
  7653. + if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  7654. + BCDC_PROTO_VER) {
  7655. + brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  7656. +- brcmf_ifname(drvr, *ifidx), h->flags);
  7657. ++ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  7658. + return -EBADE;
  7659. + }
  7660. +
  7661. + if (h->flags & BCDC_FLAG_SUM_GOOD) {
  7662. + brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  7663. +- brcmf_ifname(drvr, *ifidx), h->flags);
  7664. ++ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  7665. + pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  7666. + }
  7667. +
  7668. +@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  7669. +
  7670. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  7671. + if (do_fws)
  7672. +- brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf);
  7673. ++ brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  7674. ++ pktbuf);
  7675. + else
  7676. + skb_pull(pktbuf, h->data_offset << 2);
  7677. +
  7678. + if (pktbuf->len == 0)
  7679. + return -ENODATA;
  7680. ++
  7681. ++ *ifidx = ifp->ifidx;
  7682. + return 0;
  7683. + }
  7684. +
  7685. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  7686. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  7687. +@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drv
  7688. + return "<if_none>";
  7689. + }
  7690. +
  7691. ++struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  7692. ++{
  7693. ++ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  7694. ++ brcmf_err("ifidx %d out of range\n", ifidx);
  7695. ++ return ERR_PTR(-ERANGE);
  7696. ++ }
  7697. ++
  7698. ++ /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  7699. ++ * events this is easy because it contains the bssidx which maps
  7700. ++ * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  7701. ++ * bssidx 1 is used for p2p0 and no data can be received or
  7702. ++ * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  7703. ++ */
  7704. ++ if (ifidx)
  7705. ++ ifidx++;
  7706. ++
  7707. ++ return drvr->iflist[ifidx];
  7708. ++}
  7709. ++
  7710. + static void _brcmf_set_multicast_list(struct work_struct *work)
  7711. + {
  7712. + struct brcmf_if *ifp;
  7713. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  7714. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  7715. +@@ -202,7 +202,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  7716. +
  7717. + /* Return pointer to interface name */
  7718. + char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  7719. +-
  7720. ++struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  7721. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  7722. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  7723. + char *name, u8 *mac_addr);
  7724. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  7725. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  7726. +@@ -1081,16 +1081,8 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  7727. + {
  7728. + struct brcmf_if *ifp;
  7729. +
  7730. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  7731. +- * events this is easy because it contains the bssidx which maps
  7732. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  7733. +- * bssidx 1 is used for p2p0 and no data can be received or
  7734. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  7735. +- */
  7736. +- if (ifidx)
  7737. +- (ifidx)++;
  7738. +- ifp = msgbuf->drvr->iflist[ifidx];
  7739. +- if (!ifp || !ifp->ndev) {
  7740. ++ ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  7741. ++ if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  7742. + brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  7743. + brcmu_pkt_buf_free_skb(skb);
  7744. + return;
  7745. diff --git a/package/kernel/mac80211/patches/320-ath9k-ar9271_hw_pa_cal-use-defs-instead-of-magin-num.patch b/package/kernel/mac80211/patches/320-ath9k-ar9271_hw_pa_cal-use-defs-instead-of-magin-num.patch
  7746. deleted file mode 100644
  7747. index c4dd1af..0000000
  7748. --- a/package/kernel/mac80211/patches/320-ath9k-ar9271_hw_pa_cal-use-defs-instead-of-magin-num.patch
  7749. +++ /dev/null
  7750. @@ -1,89 +0,0 @@
  7751. -From: Oleksij Rempel <linux@rempel-privat.de>
  7752. -Date: Sun, 22 Mar 2015 19:29:47 +0100
  7753. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal - use defs instead of magin
  7754. - numbers
  7755. -
  7756. -This function uses mixed styles for register names/numbers which
  7757. -is make harder reading and optimisation.
  7758. -
  7759. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  7760. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7761. ----
  7762. -
  7763. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  7764. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  7765. -@@ -430,22 +430,22 @@ static void ar9271_hw_pa_cal(struct ath_
  7766. - u32 regVal;
  7767. - unsigned int i;
  7768. - u32 regList[][2] = {
  7769. -- { 0x786c, 0 },
  7770. -- { 0x7854, 0 },
  7771. -- { 0x7820, 0 },
  7772. -- { 0x7824, 0 },
  7773. -- { 0x7868, 0 },
  7774. -- { 0x783c, 0 },
  7775. -- { 0x7838, 0 } ,
  7776. -- { 0x7828, 0 } ,
  7777. -+ { AR9285_AN_TOP3, 0 },
  7778. -+ { AR9285_AN_RXTXBB1, 0 },
  7779. -+ { AR9285_AN_RF2G1, 0 },
  7780. -+ { AR9285_AN_RF2G2, 0 },
  7781. -+ { AR9285_AN_TOP2, 0 },
  7782. -+ { AR9285_AN_RF2G8, 0 },
  7783. -+ { AR9285_AN_RF2G7, 0 } ,
  7784. -+ { AR9285_AN_RF2G3, 0 } ,
  7785. - };
  7786. -
  7787. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  7788. - regList[i][1] = REG_READ(ah, regList[i][0]);
  7789. -
  7790. -- regVal = REG_READ(ah, 0x7834);
  7791. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  7792. - regVal &= (~(0x1));
  7793. -- REG_WRITE(ah, 0x7834, regVal);
  7794. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  7795. - regVal = REG_READ(ah, 0x9808);
  7796. - regVal |= (0x1 << 27);
  7797. - REG_WRITE(ah, 0x9808, regVal);
  7798. -@@ -477,7 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  7799. - * does not matter since we turn it off
  7800. - */
  7801. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  7802. --
  7803. -+ /* 7828, b0-11, ccom=fff */
  7804. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  7805. -
  7806. - /* Set:
  7807. -@@ -490,15 +490,16 @@ static void ar9271_hw_pa_cal(struct ath_
  7808. -
  7809. - /* find off_6_1; */
  7810. - for (i = 6; i > 0; i--) {
  7811. -- regVal = REG_READ(ah, 0x7834);
  7812. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  7813. - regVal |= (1 << (20 + i));
  7814. -- REG_WRITE(ah, 0x7834, regVal);
  7815. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  7816. - udelay(1);
  7817. - /* regVal = REG_READ(ah, 0x7834); */
  7818. - regVal &= (~(0x1 << (20 + i)));
  7819. -- regVal |= (MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9)
  7820. -+ regVal |= (MS(REG_READ(ah, AR9285_AN_RF2G9),
  7821. -+ AR9285_AN_RXTXBB1_SPARE9)
  7822. - << (20 + i));
  7823. -- REG_WRITE(ah, 0x7834, regVal);
  7824. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  7825. - }
  7826. -
  7827. - regVal = (regVal >> 20) & 0x7f;
  7828. -@@ -517,9 +518,9 @@ static void ar9271_hw_pa_cal(struct ath_
  7829. -
  7830. - ENABLE_REGWRITE_BUFFER(ah);
  7831. -
  7832. -- regVal = REG_READ(ah, 0x7834);
  7833. -+ regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  7834. - regVal |= 0x1;
  7835. -- REG_WRITE(ah, 0x7834, regVal);
  7836. -+ REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  7837. - regVal = REG_READ(ah, 0x9808);
  7838. - regVal &= (~(0x1 << 27));
  7839. - REG_WRITE(ah, 0x9808, regVal);
  7840. diff --git a/package/kernel/mac80211/patches/320-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch b/package/kernel/mac80211/patches/320-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  7841. new file mode 100644
  7842. index 0000000..632714c
  7843. --- /dev/null
  7844. +++ b/package/kernel/mac80211/patches/320-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  7845. @@ -0,0 +1,222 @@
  7846. +From: Arend van Spriel <arend@broadcom.com>
  7847. +Date: Wed, 26 Aug 2015 22:14:54 +0200
  7848. +Subject: [PATCH] brcmfmac: make brcmf_proto_hdrpull() return struct
  7849. + brcmf_if instance
  7850. +
  7851. +Avoid spreading the ifidx in the driver, but have it return the
  7852. +struct brcmf_if instance.
  7853. +
  7854. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  7855. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  7856. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7857. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7858. +---
  7859. +
  7860. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  7861. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  7862. +@@ -272,11 +272,11 @@ brcmf_proto_bcdc_hdrpush(struct brcmf_pu
  7863. + }
  7864. +
  7865. + static int
  7866. +-brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  7867. +- struct sk_buff *pktbuf)
  7868. ++brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  7869. ++ struct sk_buff *pktbuf, struct brcmf_if **ifp)
  7870. + {
  7871. + struct brcmf_proto_bcdc_header *h;
  7872. +- struct brcmf_if *ifp;
  7873. ++ struct brcmf_if *tmp_if;
  7874. +
  7875. + brcmf_dbg(BCDC, "Enter\n");
  7876. +
  7877. +@@ -290,21 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  7878. + trace_brcmf_bcdchdr(pktbuf->data);
  7879. + h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  7880. +
  7881. +- ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  7882. +- if (IS_ERR_OR_NULL(ifp)) {
  7883. ++ tmp_if = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  7884. ++ if (!tmp_if) {
  7885. + brcmf_dbg(INFO, "no matching ifp found\n");
  7886. + return -EBADE;
  7887. + }
  7888. + if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  7889. + BCDC_PROTO_VER) {
  7890. + brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  7891. +- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  7892. ++ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  7893. + return -EBADE;
  7894. + }
  7895. +
  7896. + if (h->flags & BCDC_FLAG_SUM_GOOD) {
  7897. + brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  7898. +- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  7899. ++ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  7900. + pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  7901. + }
  7902. +
  7903. +@@ -312,7 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  7904. +
  7905. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  7906. + if (do_fws)
  7907. +- brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  7908. ++ brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  7909. + pktbuf);
  7910. + else
  7911. + skb_pull(pktbuf, h->data_offset << 2);
  7912. +@@ -320,7 +320,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  7913. + if (pktbuf->len == 0)
  7914. + return -ENODATA;
  7915. +
  7916. +- *ifidx = ifp->ifidx;
  7917. ++ *ifp = tmp_if;
  7918. + return 0;
  7919. + }
  7920. +
  7921. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  7922. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  7923. +@@ -87,7 +87,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  7924. + {
  7925. + if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  7926. + brcmf_err("ifidx %d out of range\n", ifidx);
  7927. +- return ERR_PTR(-ERANGE);
  7928. ++ return NULL;
  7929. + }
  7930. +
  7931. + /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  7932. +@@ -539,17 +539,15 @@ void brcmf_rx_frame(struct device *dev,
  7933. + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  7934. + struct brcmf_pub *drvr = bus_if->drvr;
  7935. + struct brcmf_skb_reorder_data *rd;
  7936. +- u8 ifidx;
  7937. + int ret;
  7938. +
  7939. + brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  7940. +
  7941. + /* process and remove protocol-specific header */
  7942. +- ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb);
  7943. +- ifp = drvr->iflist[ifidx];
  7944. ++ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  7945. +
  7946. + if (ret || !ifp || !ifp->ndev) {
  7947. +- if ((ret != -ENODATA) && ifp)
  7948. ++ if (ret != -ENODATA && ifp)
  7949. + ifp->stats.rx_errors++;
  7950. + brcmu_pkt_buf_free_skb(skb);
  7951. + return;
  7952. +@@ -592,17 +590,17 @@ void brcmf_txcomplete(struct device *dev
  7953. + {
  7954. + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  7955. + struct brcmf_pub *drvr = bus_if->drvr;
  7956. +- u8 ifidx;
  7957. ++ struct brcmf_if *ifp;
  7958. +
  7959. + /* await txstatus signal for firmware if active */
  7960. + if (brcmf_fws_fc_active(drvr->fws)) {
  7961. + if (!success)
  7962. + brcmf_fws_bustxfail(drvr->fws, txp);
  7963. + } else {
  7964. +- if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp))
  7965. ++ if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  7966. + brcmu_pkt_buf_free_skb(txp);
  7967. + else
  7968. +- brcmf_txfinalize(drvr, txp, ifidx, success);
  7969. ++ brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  7970. + }
  7971. + }
  7972. +
  7973. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  7974. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  7975. +@@ -1448,7 +1448,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  7976. + struct sk_buff *skb;
  7977. + struct brcmf_skbuff_cb *skcb;
  7978. + struct brcmf_fws_mac_descriptor *entry = NULL;
  7979. +- u8 ifidx;
  7980. ++ struct brcmf_if *ifp;
  7981. +
  7982. + brcmf_dbg(DATA, "flags %d\n", flags);
  7983. +
  7984. +@@ -1497,15 +1497,16 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  7985. + }
  7986. + brcmf_fws_macdesc_return_req_credit(skb);
  7987. +
  7988. +- if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) {
  7989. ++ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp);
  7990. ++ if (ret) {
  7991. + brcmu_pkt_buf_free_skb(skb);
  7992. + return -EINVAL;
  7993. + }
  7994. + if (!remove_from_hanger)
  7995. +- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx,
  7996. ++ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  7997. + genbit, seq);
  7998. + if (remove_from_hanger || ret)
  7999. +- brcmf_txfinalize(fws->drvr, skb, ifidx, true);
  8000. ++ brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  8001. +
  8002. + return 0;
  8003. + }
  8004. +@@ -1848,7 +1849,7 @@ static int brcmf_fws_commit_skb(struct b
  8005. + entry->transit_count--;
  8006. + if (entry->suppressed)
  8007. + entry->suppr_transit_count--;
  8008. +- brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
  8009. ++ (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
  8010. + goto rollback;
  8011. + }
  8012. +
  8013. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  8014. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  8015. +@@ -522,7 +522,7 @@ static int brcmf_msgbuf_set_dcmd(struct
  8016. +
  8017. +
  8018. + static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  8019. +- u8 *ifidx, struct sk_buff *skb)
  8020. ++ struct sk_buff *skb, struct brcmf_if **ifp)
  8021. + {
  8022. + return -ENODEV;
  8023. + }
  8024. +@@ -1082,7 +1082,7 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  8025. + struct brcmf_if *ifp;
  8026. +
  8027. + ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  8028. +- if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  8029. ++ if (!ifp || !ifp->ndev) {
  8030. + brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  8031. + brcmu_pkt_buf_free_skb(skb);
  8032. + return;
  8033. +--- a/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  8034. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  8035. +@@ -24,8 +24,8 @@ enum proto_addr_mode {
  8036. +
  8037. +
  8038. + struct brcmf_proto {
  8039. +- int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  8040. +- struct sk_buff *skb);
  8041. ++ int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  8042. ++ struct sk_buff *skb, struct brcmf_if **ifp);
  8043. + int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
  8044. + void *buf, uint len);
  8045. + int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
  8046. +@@ -46,9 +46,19 @@ int brcmf_proto_attach(struct brcmf_pub
  8047. + void brcmf_proto_detach(struct brcmf_pub *drvr);
  8048. +
  8049. + static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  8050. +- u8 *ifidx, struct sk_buff *skb)
  8051. ++ struct sk_buff *skb,
  8052. ++ struct brcmf_if **ifp)
  8053. + {
  8054. +- return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
  8055. ++ struct brcmf_if *tmp = NULL;
  8056. ++
  8057. ++ /* assure protocol is always called with
  8058. ++ * non-null initialized pointer.
  8059. ++ */
  8060. ++ if (ifp)
  8061. ++ *ifp = NULL;
  8062. ++ else
  8063. ++ ifp = &tmp;
  8064. ++ return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
  8065. + }
  8066. + static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  8067. + uint cmd, void *buf, uint len)
  8068. diff --git a/package/kernel/mac80211/patches/321-ath9k-ar9271_hw_pa_cal-use-proper-makroses.patch b/package/kernel/mac80211/patches/321-ath9k-ar9271_hw_pa_cal-use-proper-makroses.patch
  8069. deleted file mode 100644
  8070. index f05287d..0000000
  8071. --- a/package/kernel/mac80211/patches/321-ath9k-ar9271_hw_pa_cal-use-proper-makroses.patch
  8072. +++ /dev/null
  8073. @@ -1,79 +0,0 @@
  8074. -From: Oleksij Rempel <linux@rempel-privat.de>
  8075. -Date: Sun, 22 Mar 2015 19:29:48 +0100
  8076. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use proper makroses.
  8077. -
  8078. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  8079. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  8080. ----
  8081. -
  8082. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  8083. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  8084. -@@ -443,33 +443,30 @@ static void ar9271_hw_pa_cal(struct ath_
  8085. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  8086. - regList[i][1] = REG_READ(ah, regList[i][0]);
  8087. -
  8088. -- regVal = REG_READ(ah, AR9285_AN_RF2G6);
  8089. -- regVal &= (~(0x1));
  8090. -- REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  8091. -- regVal = REG_READ(ah, 0x9808);
  8092. -- regVal |= (0x1 << 27);
  8093. -- REG_WRITE(ah, 0x9808, regVal);
  8094. --
  8095. -+ /* 7834, b1=0 */
  8096. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  8097. -+ /* 9808, b27=1 */
  8098. -+ REG_SET_BIT(ah, 0x9808, 1 << 27);
  8099. - /* 786c,b23,1, pwddac=1 */
  8100. -- REG_RMW_FIELD(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC, 1);
  8101. -+ REG_SET_BIT(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC);
  8102. - /* 7854, b5,1, pdrxtxbb=1 */
  8103. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1, 1);
  8104. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1);
  8105. - /* 7854, b7,1, pdv2i=1 */
  8106. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I, 1);
  8107. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I);
  8108. - /* 7854, b8,1, pddacinterface=1 */
  8109. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF, 1);
  8110. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF);
  8111. - /* 7824,b12,0, offcal=0 */
  8112. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL, 0);
  8113. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL);
  8114. - /* 7838, b1,0, pwddb=0 */
  8115. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB, 0);
  8116. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB);
  8117. - /* 7820,b11,0, enpacal=0 */
  8118. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL, 0);
  8119. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL);
  8120. - /* 7820,b25,1, pdpadrv1=0 */
  8121. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1, 0);
  8122. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1);
  8123. - /* 7820,b24,0, pdpadrv2=0 */
  8124. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2, 0);
  8125. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2);
  8126. - /* 7820,b23,0, pdpaout=0 */
  8127. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT, 0);
  8128. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT);
  8129. - /* 783c,b14-16,7, padrvgn2tab_0=7 */
  8130. - REG_RMW_FIELD(ah, AR9285_AN_RF2G8, AR9285_AN_RF2G8_PADRVGN2TAB0, 7);
  8131. - /*
  8132. -@@ -516,15 +513,13 @@ static void ar9271_hw_pa_cal(struct ath_
  8133. - ah->pacal_info.prev_offset = regVal;
  8134. - }
  8135. -
  8136. -- ENABLE_REGWRITE_BUFFER(ah);
  8137. -
  8138. -- regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  8139. -- regVal |= 0x1;
  8140. -- REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  8141. -- regVal = REG_READ(ah, 0x9808);
  8142. -- regVal &= (~(0x1 << 27));
  8143. -- REG_WRITE(ah, 0x9808, regVal);
  8144. -+ /* 7834, b1=1 */
  8145. -+ REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  8146. -+ /* 9808, b27=0 */
  8147. -+ REG_CLR_BIT(ah, 0x9808, 1 << 27);
  8148. -
  8149. -+ ENABLE_REGWRITE_BUFFER(ah);
  8150. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  8151. - REG_WRITE(ah, regList[i][0], regList[i][1]);
  8152. -
  8153. diff --git a/package/kernel/mac80211/patches/321-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch b/package/kernel/mac80211/patches/321-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  8154. new file mode 100644
  8155. index 0000000..3360cbc
  8156. --- /dev/null
  8157. +++ b/package/kernel/mac80211/patches/321-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  8158. @@ -0,0 +1,87 @@
  8159. +From: Arend van Spriel <arend@broadcom.com>
  8160. +Date: Wed, 26 Aug 2015 22:14:55 +0200
  8161. +Subject: [PATCH] brcmfmac: change parameters for
  8162. + brcmf_remove_interface()
  8163. +
  8164. +Just pass the interface to be removed, ie. the struct brcmf_if instance.
  8165. +
  8166. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  8167. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  8168. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  8169. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  8170. +---
  8171. +
  8172. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  8173. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  8174. +@@ -4983,7 +4983,7 @@ brcmf_notify_connect_status_ap(struct br
  8175. + brcmf_dbg(CONN, "AP mode link down\n");
  8176. + complete(&cfg->vif_disabled);
  8177. + if (ifp->vif->mbss)
  8178. +- brcmf_remove_interface(ifp->drvr, ifp->bssidx);
  8179. ++ brcmf_remove_interface(ifp);
  8180. + return 0;
  8181. + }
  8182. +
  8183. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  8184. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  8185. +@@ -887,12 +887,13 @@ static void brcmf_del_if(struct brcmf_pu
  8186. + }
  8187. + }
  8188. +
  8189. +-void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx)
  8190. ++void brcmf_remove_interface(struct brcmf_if *ifp)
  8191. + {
  8192. +- if (drvr->iflist[bssidx]) {
  8193. +- brcmf_fws_del_interface(drvr->iflist[bssidx]);
  8194. +- brcmf_del_if(drvr, bssidx);
  8195. +- }
  8196. ++ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  8197. ++ return;
  8198. ++
  8199. ++ brcmf_fws_del_interface(ifp);
  8200. ++ brcmf_del_if(ifp->drvr, ifp->bssidx);
  8201. + }
  8202. +
  8203. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  8204. +@@ -1122,7 +1123,7 @@ void brcmf_detach(struct device *dev)
  8205. +
  8206. + /* make sure primary interface removed last */
  8207. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  8208. +- brcmf_remove_interface(drvr, i);
  8209. ++ brcmf_remove_interface(drvr->iflist[i]);
  8210. +
  8211. + brcmf_cfg80211_detach(drvr->config);
  8212. +
  8213. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  8214. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  8215. +@@ -206,7 +206,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  8216. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  8217. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  8218. + char *name, u8 *mac_addr);
  8219. +-void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx);
  8220. ++void brcmf_remove_interface(struct brcmf_if *ifp);
  8221. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  8222. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  8223. + enum brcmf_netif_stop_reason reason, bool state);
  8224. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  8225. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  8226. +@@ -222,7 +222,7 @@ static void brcmf_fweh_handle_if_event(s
  8227. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  8228. +
  8229. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  8230. +- brcmf_remove_interface(drvr, ifevent->bssidx);
  8231. ++ brcmf_remove_interface(ifp);
  8232. + }
  8233. +
  8234. + /**
  8235. +--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  8236. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  8237. +@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  8238. + {
  8239. + cfg80211_unregister_wdev(&vif->wdev);
  8240. + p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  8241. +- brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  8242. ++ brcmf_remove_interface(vif->ifp);
  8243. + brcmf_free_vif(vif);
  8244. + }
  8245. +
  8246. diff --git a/package/kernel/mac80211/patches/322-ath9k-ar9271_hw_pa_cal-use-RMW-buffer.patch b/package/kernel/mac80211/patches/322-ath9k-ar9271_hw_pa_cal-use-RMW-buffer.patch
  8247. deleted file mode 100644
  8248. index 7247369..0000000
  8249. --- a/package/kernel/mac80211/patches/322-ath9k-ar9271_hw_pa_cal-use-RMW-buffer.patch
  8250. +++ /dev/null
  8251. @@ -1,48 +0,0 @@
  8252. -From: Oleksij Rempel <linux@rempel-privat.de>
  8253. -Date: Sun, 22 Mar 2015 19:29:49 +0100
  8254. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use RMW buffer
  8255. -
  8256. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  8257. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  8258. ----
  8259. -
  8260. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  8261. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  8262. -@@ -436,13 +436,14 @@ static void ar9271_hw_pa_cal(struct ath_
  8263. - { AR9285_AN_RF2G2, 0 },
  8264. - { AR9285_AN_TOP2, 0 },
  8265. - { AR9285_AN_RF2G8, 0 },
  8266. -- { AR9285_AN_RF2G7, 0 } ,
  8267. -- { AR9285_AN_RF2G3, 0 } ,
  8268. -+ { AR9285_AN_RF2G7, 0 },
  8269. -+ { AR9285_AN_RF2G3, 0 },
  8270. - };
  8271. -
  8272. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  8273. - regList[i][1] = REG_READ(ah, regList[i][0]);
  8274. -
  8275. -+ ENABLE_REG_RMW_BUFFER(ah);
  8276. - /* 7834, b1=0 */
  8277. - REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  8278. - /* 9808, b27=1 */
  8279. -@@ -476,6 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  8280. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  8281. - /* 7828, b0-11, ccom=fff */
  8282. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  8283. -+ REG_RMW_BUFFER_FLUSH(ah);
  8284. -
  8285. - /* Set:
  8286. - * localmode=1,bmode=1,bmoderxtx=1,synthon=1,
  8287. -@@ -514,10 +516,12 @@ static void ar9271_hw_pa_cal(struct ath_
  8288. - }
  8289. -
  8290. -
  8291. -+ ENABLE_REG_RMW_BUFFER(ah);
  8292. - /* 7834, b1=1 */
  8293. - REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  8294. - /* 9808, b27=0 */
  8295. - REG_CLR_BIT(ah, 0x9808, 1 << 27);
  8296. -+ REG_RMW_BUFFER_FLUSH(ah);
  8297. -
  8298. - ENABLE_REGWRITE_BUFFER(ah);
  8299. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  8300. diff --git a/package/kernel/mac80211/patches/322-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch b/package/kernel/mac80211/patches/322-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  8301. new file mode 100644
  8302. index 0000000..2b61f4e
  8303. --- /dev/null
  8304. +++ b/package/kernel/mac80211/patches/322-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  8305. @@ -0,0 +1,92 @@
  8306. +From: Arend van Spriel <arend@broadcom.com>
  8307. +Date: Wed, 26 Aug 2015 22:14:56 +0200
  8308. +Subject: [PATCH] brcmfmac: only call brcmf_cfg80211_detach() when attach
  8309. + was successful
  8310. +
  8311. +In brcmf_bus_start() the function brcmf_cfg80211_attach() is called which
  8312. +may fail. If this happens we should not call brcmf_cfg80211_detach() in
  8313. +the failure path as it will result in NULL pointer dereference:
  8314. +
  8315. + brcmf_fweh_activate_events: Set event_msgs error (-5)
  8316. + brcmf_bus_start: failed: -5
  8317. + brcmf_sdio_firmware_callback: dongle is not responding
  8318. + BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
  8319. + IP: [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  8320. + PGD 0
  8321. + Oops: 0000 [#1] SMP
  8322. + Modules linked in: brcmfmac(O) brcmutil(O) cfg80211 auth_rpcgss
  8323. + CPU: 1 PID: 45 Comm: kworker/1:1 Tainted: G O
  8324. + Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  8325. + Workqueue: events request_firmware_work_func
  8326. + task: ffff880036c09ac0 ti: ffff880036dd4000 task.ti: ffff880036dd4000
  8327. + RIP: 0010:[<ffffffff811e8f08>] [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  8328. + RSP: 0018:ffff880036dd7a28 EFLAGS: 00010246
  8329. + RAX: ffff880036c09ac0 RBX: 0000000000000000 RCX: 000000007fffffff
  8330. + RDX: 0000000000000000 RSI: ffffffff816578b9 RDI: 0000000000000000
  8331. + RBP: ffff880036dd7a48 R08: 0000000000000000 R09: ffff880036c0b340
  8332. + R10: 00000000000002ec R11: ffff880036dd7b08 R12: ffffffff816578b9
  8333. + R13: 0000000000000000 R14: ffffffff816578b9 R15: ffff8800c6c87000
  8334. + FS: 0000000000000000(0000) GS:ffff88012bc40000(0000) knlGS:0000000000000000
  8335. + CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  8336. + CR2: 0000000000000068 CR3: 0000000001a0b000 CR4: 00000000000006e0
  8337. + Stack:
  8338. + 0000000000000000 ffffffff816578b9 0000000000000000 ffff8800c0d003c8
  8339. + ffff880036dd7a78 ffffffff811e8ff5 0000000ffffffff1 ffffffff81a9b060
  8340. + ffff8800c789f880 ffff8800c0d00000 ffff880036dd7a98 ffffffff811ebe0d
  8341. + Call Trace:
  8342. + [<ffffffff811e8ff5>] kernfs_find_and_get_ns+0x35/0x60
  8343. + [<ffffffff811ebe0d>] sysfs_unmerge_group+0x1d/0x60
  8344. + [<ffffffff81404ef2>] dpm_sysfs_remove+0x22/0x60
  8345. + [<ffffffff813f9db9>] device_del+0x49/0x240
  8346. + [<ffffffff815da768>] rfkill_unregister+0x58/0xc0
  8347. + [<ffffffffa06bd91b>] wiphy_unregister+0xab/0x2f0 [cfg80211]
  8348. + [<ffffffffa0742fe3>] brcmf_cfg80211_detach+0x23/0x50 [brcmfmac]
  8349. + [<ffffffffa074d986>] brcmf_detach+0x86/0xe0 [brcmfmac]
  8350. + [<ffffffffa0757de8>] brcmf_sdio_remove+0x48/0x120 [brcmfmac]
  8351. + [<ffffffffa0758ed9>] brcmf_sdiod_remove+0x29/0xd0 [brcmfmac]
  8352. + [<ffffffffa0759031>] brcmf_ops_sdio_remove+0xb1/0x110 [brcmfmac]
  8353. + [<ffffffffa001c267>] sdio_bus_remove+0x37/0x100 [mmc_core]
  8354. + [<ffffffff813fe026>] __device_release_driver+0x96/0x130
  8355. + [<ffffffff813fe0e3>] device_release_driver+0x23/0x30
  8356. + [<ffffffffa0754bc8>] brcmf_sdio_firmware_callback+0x2a8/0x5d0 [brcmfmac]
  8357. + [<ffffffffa074deaf>] brcmf_fw_request_nvram_done+0x15f/0x5e0 [brcmfmac]
  8358. + [<ffffffff8140142f>] ? devres_add+0x3f/0x50
  8359. + [<ffffffff810642b5>] ? usermodehelper_read_unlock+0x15/0x20
  8360. + [<ffffffff81400000>] ? platform_match+0x70/0xa0
  8361. + [<ffffffff8140f400>] request_firmware_work_func+0x30/0x60
  8362. + [<ffffffff8106828c>] process_one_work+0x14c/0x3d0
  8363. + [<ffffffff8106862a>] worker_thread+0x11a/0x450
  8364. + [<ffffffff81068510>] ? process_one_work+0x3d0/0x3d0
  8365. + [<ffffffff8106d692>] kthread+0xd2/0xf0
  8366. + [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  8367. + [<ffffffff815ed35f>] ret_from_fork+0x3f/0x70
  8368. + [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  8369. + Code: e9 40 fe ff ff 48 89 d8 eb 87 66 0f 1f 84 00 00 00 00 00 66 66 66 66
  8370. + 90 55 48 89 e5 41 56 49 89 f6 41 55 49 89 d5 31 d2 41 54 53 <0f> b7
  8371. + 47 68 48 8b 5f 48 66 c1 e8 05 83 e0 01 4d 85 ed 0f b6 c8
  8372. + RIP [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  8373. + RSP <ffff880036dd7a28>
  8374. + CR2: 0000000000000068
  8375. + ---[ end trace 87d6ec0d3fe46740 ]---
  8376. +
  8377. +Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  8378. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  8379. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  8380. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  8381. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  8382. +---
  8383. +
  8384. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  8385. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  8386. +@@ -1049,7 +1049,10 @@ int brcmf_bus_start(struct device *dev)
  8387. + fail:
  8388. + if (ret < 0) {
  8389. + brcmf_err("failed: %d\n", ret);
  8390. +- brcmf_cfg80211_detach(drvr->config);
  8391. ++ if (drvr->config) {
  8392. ++ brcmf_cfg80211_detach(drvr->config);
  8393. ++ drvr->config = NULL;
  8394. ++ }
  8395. + if (drvr->fws) {
  8396. + brcmf_fws_del_interface(ifp);
  8397. + brcmf_fws_deinit(drvr);
  8398. diff --git a/package/kernel/mac80211/patches/323-ath9k-add-multi_read-to-be-compatible-with-ath9k_htc.patch b/package/kernel/mac80211/patches/323-ath9k-add-multi_read-to-be-compatible-with-ath9k_htc.patch
  8399. deleted file mode 100644
  8400. index 246bb9d..0000000
  8401. --- a/package/kernel/mac80211/patches/323-ath9k-add-multi_read-to-be-compatible-with-ath9k_htc.patch
  8402. +++ /dev/null
  8403. @@ -1,35 +0,0 @@
  8404. -From: Oleksij Rempel <linux@rempel-privat.de>
  8405. -Date: Sun, 22 Mar 2015 19:29:50 +0100
  8406. -Subject: [PATCH] ath9k: add multi_read to be compatible with ath9k_htc
  8407. -
  8408. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  8409. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  8410. ----
  8411. -
  8412. ---- a/drivers/net/wireless/ath/ath9k/init.c
  8413. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  8414. -@@ -141,6 +141,16 @@ static unsigned int ath9k_ioread32(void
  8415. - return val;
  8416. - }
  8417. -
  8418. -+static void ath9k_multi_ioread32(void *hw_priv, u32 *addr,
  8419. -+ u32 *val, u16 count)
  8420. -+{
  8421. -+ int i;
  8422. -+
  8423. -+ for (i = 0; i < count; i++)
  8424. -+ val[i] = ath9k_ioread32(hw_priv, addr[i]);
  8425. -+}
  8426. -+
  8427. -+
  8428. - static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset,
  8429. - u32 set, u32 clr)
  8430. - {
  8431. -@@ -530,6 +540,7 @@ static int ath9k_init_softc(u16 devid, s
  8432. - ah->hw = sc->hw;
  8433. - ah->hw_version.devid = devid;
  8434. - ah->reg_ops.read = ath9k_ioread32;
  8435. -+ ah->reg_ops.multi_read = ath9k_multi_ioread32;
  8436. - ah->reg_ops.write = ath9k_iowrite32;
  8437. - ah->reg_ops.rmw = ath9k_reg_rmw;
  8438. - pCap = &ah->caps;
  8439. diff --git a/package/kernel/mac80211/patches/323-brcmfmac-correct-detection-of-p2pdev-interface-event.patch b/package/kernel/mac80211/patches/323-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  8440. new file mode 100644
  8441. index 0000000..868b0a8
  8442. --- /dev/null
  8443. +++ b/package/kernel/mac80211/patches/323-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  8444. @@ -0,0 +1,105 @@
  8445. +From: Arend van Spriel <arend@broadcom.com>
  8446. +Date: Wed, 26 Aug 2015 22:14:57 +0200
  8447. +Subject: [PATCH] brcmfmac: correct detection of p2pdev interface event
  8448. +
  8449. +The p2pdev interface is setup in firmware resulting in a interface
  8450. +event. This event has role and no-if flag. When role is p2p client
  8451. +and no-if flag is set it indicates that this is the p2pdev interface.
  8452. +This info is used in handling the event and adding interface in the
  8453. +driver.
  8454. +
  8455. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  8456. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  8457. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  8458. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  8459. +---
  8460. +
  8461. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  8462. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  8463. +@@ -795,7 +795,7 @@ fail:
  8464. + }
  8465. +
  8466. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  8467. +- char *name, u8 *mac_addr)
  8468. ++ bool is_p2pdev, char *name, u8 *mac_addr)
  8469. + {
  8470. + struct brcmf_if *ifp;
  8471. + struct net_device *ndev;
  8472. +@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  8473. + }
  8474. + }
  8475. +
  8476. +- if (!brcmf_p2p_enable && bssidx == 1) {
  8477. ++ if (!brcmf_p2p_enable && is_p2pdev) {
  8478. + /* this is P2P_DEVICE interface */
  8479. + brcmf_dbg(INFO, "allocate non-netdev interface\n");
  8480. + ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
  8481. +@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
  8482. + brcmf_dbg(TRACE, "\n");
  8483. +
  8484. + /* add primary networking interface */
  8485. +- ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL);
  8486. ++ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
  8487. + if (IS_ERR(ifp))
  8488. + return PTR_ERR(ifp);
  8489. +
  8490. + if (brcmf_p2p_enable)
  8491. +- p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL);
  8492. ++ p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  8493. + else
  8494. + p2p_ifp = NULL;
  8495. + if (IS_ERR(p2p_ifp))
  8496. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  8497. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  8498. +@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drv
  8499. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  8500. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  8501. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  8502. +- char *name, u8 *mac_addr);
  8503. ++ bool is_p2pdev, char *name, u8 *mac_addr);
  8504. + void brcmf_remove_interface(struct brcmf_if *ifp);
  8505. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  8506. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  8507. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  8508. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  8509. +@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(s
  8510. + {
  8511. + struct brcmf_if_event *ifevent = data;
  8512. + struct brcmf_if *ifp;
  8513. ++ bool is_p2pdev;
  8514. + int err = 0;
  8515. +
  8516. + brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  8517. +@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(s
  8518. + ifevent->flags, ifevent->role);
  8519. +
  8520. + /* The P2P Device interface event must not be ignored
  8521. +- * contrary to what firmware tells us. The only way to
  8522. +- * distinguish the P2P Device is by looking at the ifidx
  8523. +- * and bssidx received.
  8524. ++ * contrary to what firmware tells us.
  8525. + */
  8526. +- if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
  8527. +- (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  8528. ++ is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  8529. ++ ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  8530. ++ if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  8531. + brcmf_dbg(EVENT, "event can be ignored\n");
  8532. + return;
  8533. + }
  8534. + if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  8535. +- brcmf_err("invalid interface index: %u\n",
  8536. +- ifevent->ifidx);
  8537. ++ brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  8538. + return;
  8539. + }
  8540. +
  8541. +@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(s
  8542. + brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  8543. + emsg->addr);
  8544. + ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  8545. +- emsg->ifname, emsg->addr);
  8546. ++ is_p2pdev, emsg->ifname, emsg->addr);
  8547. + if (IS_ERR(ifp))
  8548. + return;
  8549. + brcmf_fws_add_interface(ifp);
  8550. diff --git a/package/kernel/mac80211/patches/324-ath9k-add-new-function-ath9k_hw_read_array.patch b/package/kernel/mac80211/patches/324-ath9k-add-new-function-ath9k_hw_read_array.patch
  8551. deleted file mode 100644
  8552. index 2eda1c9..0000000
  8553. --- a/package/kernel/mac80211/patches/324-ath9k-add-new-function-ath9k_hw_read_array.patch
  8554. +++ /dev/null
  8555. @@ -1,69 +0,0 @@
  8556. -From: Oleksij Rempel <linux@rempel-privat.de>
  8557. -Date: Sun, 22 Mar 2015 19:29:51 +0100
  8558. -Subject: [PATCH] ath9k: add new function ath9k_hw_read_array
  8559. -
  8560. -REG_READ generate most overhead on usb bus. It send and read micro packages
  8561. -and reduce usb bandwidth. To reduce this overhead we should read in batches.
  8562. -
  8563. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  8564. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  8565. ----
  8566. -
  8567. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  8568. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  8569. -@@ -121,6 +121,36 @@ void ath9k_hw_write_array(struct ath_hw
  8570. - REGWRITE_BUFFER_FLUSH(ah);
  8571. - }
  8572. -
  8573. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size)
  8574. -+{
  8575. -+ u32 *tmp_reg_list, *tmp_data;
  8576. -+ int i;
  8577. -+
  8578. -+ tmp_reg_list = kmalloc(size * sizeof(u32), GFP_KERNEL);
  8579. -+ if (!tmp_reg_list) {
  8580. -+ dev_err(ah->dev, "%s: tmp_reg_list: alloc filed\n", __func__);
  8581. -+ return;
  8582. -+ }
  8583. -+
  8584. -+ tmp_data = kmalloc(size * sizeof(u32), GFP_KERNEL);
  8585. -+ if (!tmp_data) {
  8586. -+ dev_err(ah->dev, "%s tmp_data: alloc filed\n", __func__);
  8587. -+ goto error_tmp_data;
  8588. -+ }
  8589. -+
  8590. -+ for (i = 0; i < size; i++)
  8591. -+ tmp_reg_list[i] = array[i][0];
  8592. -+
  8593. -+ REG_READ_MULTI(ah, tmp_reg_list, tmp_data, size);
  8594. -+
  8595. -+ for (i = 0; i < size; i++)
  8596. -+ array[i][1] = tmp_data[i];
  8597. -+
  8598. -+ kfree(tmp_data);
  8599. -+error_tmp_data:
  8600. -+ kfree(tmp_reg_list);
  8601. -+}
  8602. -+
  8603. - u32 ath9k_hw_reverse_bits(u32 val, u32 n)
  8604. - {
  8605. - u32 retval;
  8606. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  8607. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  8608. -@@ -138,6 +138,8 @@
  8609. -
  8610. - #define REG_WRITE_ARRAY(iniarray, column, regWr) \
  8611. - ath9k_hw_write_array(ah, iniarray, column, &(regWr))
  8612. -+#define REG_READ_ARRAY(ah, array, size) \
  8613. -+ ath9k_hw_read_array(ah, array, size)
  8614. -
  8615. - #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
  8616. - #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
  8617. -@@ -1020,6 +1022,7 @@ void ath9k_hw_synth_delay(struct ath_hw
  8618. - bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
  8619. - void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array,
  8620. - int column, unsigned int *writecnt);
  8621. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size);
  8622. - u32 ath9k_hw_reverse_bits(u32 val, u32 n);
  8623. - u16 ath9k_hw_computetxtime(struct ath_hw *ah,
  8624. - u8 phy, int kbps,
  8625. diff --git a/package/kernel/mac80211/patches/324-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch b/package/kernel/mac80211/patches/324-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  8626. new file mode 100644
  8627. index 0000000..abd6681
  8628. --- /dev/null
  8629. +++ b/package/kernel/mac80211/patches/324-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  8630. @@ -0,0 +1,126 @@
  8631. +From: Arend van Spriel <arend@broadcom.com>
  8632. +Date: Wed, 26 Aug 2015 22:14:58 +0200
  8633. +Subject: [PATCH] brcmfmac: use brcmf_get_ifp() to map ifidx to struct
  8634. + brcmf_if instance
  8635. +
  8636. +The knowledge on how to map the interface index to a struct brcmf_if
  8637. +instance is in brcmf_get_ifp() so use that function when only the
  8638. +interface index is known instead of accessing brcmf_pub::iflist
  8639. +directly.
  8640. +
  8641. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  8642. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  8643. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  8644. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  8645. +---
  8646. +
  8647. +--- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  8648. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  8649. +@@ -149,7 +149,7 @@ static s32 brcmf_btcoex_params_read(stru
  8650. + static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
  8651. + bool trump_sco)
  8652. + {
  8653. +- struct brcmf_if *ifp = btci->cfg->pub->iflist[0];
  8654. ++ struct brcmf_if *ifp = brcmf_get_ifp(btci->cfg->pub, 0);
  8655. +
  8656. + if (trump_sco && !btci->saved_regs_part2) {
  8657. + /* this should reduce eSCO agressive
  8658. +@@ -468,7 +468,7 @@ int brcmf_btcoex_set_mode(struct brcmf_c
  8659. + {
  8660. + struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  8661. + struct brcmf_btcoex_info *btci = cfg->btcoex;
  8662. +- struct brcmf_if *ifp = cfg->pub->iflist[0];
  8663. ++ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  8664. +
  8665. + switch (mode) {
  8666. + case BRCMF_BTCOEX_DISABLED:
  8667. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  8668. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  8669. +@@ -6213,7 +6213,7 @@ static void brcmf_free_wiphy(struct wiph
  8670. + struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  8671. + struct device *busdev)
  8672. + {
  8673. +- struct net_device *ndev = drvr->iflist[0]->ndev;
  8674. ++ struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  8675. + struct brcmf_cfg80211_info *cfg;
  8676. + struct wiphy *wiphy;
  8677. + struct brcmf_cfg80211_vif *vif;
  8678. +--- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  8679. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  8680. +@@ -121,7 +121,7 @@ static void brcmf_feat_iovar_int_set(str
  8681. +
  8682. + void brcmf_feat_attach(struct brcmf_pub *drvr)
  8683. + {
  8684. +- struct brcmf_if *ifp = drvr->iflist[0];
  8685. ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  8686. +
  8687. + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  8688. + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  8689. +--- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  8690. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  8691. +@@ -221,7 +221,7 @@ static void brcmf_flowring_block(struct
  8692. +
  8693. + bus_if = dev_get_drvdata(flow->dev);
  8694. + drvr = bus_if->drvr;
  8695. +- ifp = drvr->iflist[ifidx];
  8696. ++ ifp = brcmf_get_ifp(drvr, ifidx);
  8697. + brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
  8698. +
  8699. + spin_unlock_irqrestore(&flow->block_lock, flags);
  8700. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  8701. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  8702. +@@ -334,7 +334,7 @@ void brcmf_fweh_attach(struct brcmf_pub
  8703. + void brcmf_fweh_detach(struct brcmf_pub *drvr)
  8704. + {
  8705. + struct brcmf_fweh_info *fweh = &drvr->fweh;
  8706. +- struct brcmf_if *ifp = drvr->iflist[0];
  8707. ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  8708. + s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  8709. +
  8710. + if (ifp) {
  8711. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  8712. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  8713. +@@ -972,7 +972,7 @@ static void
  8714. + brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
  8715. + u8 if_id)
  8716. + {
  8717. +- struct brcmf_if *ifp = fws->drvr->iflist[!if_id ? 0 : if_id + 1];
  8718. ++ struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id);
  8719. +
  8720. + if (WARN_ON(!ifp))
  8721. + return;
  8722. +@@ -2118,6 +2118,7 @@ static int brcmf_debugfs_fws_stats_read(
  8723. + int brcmf_fws_init(struct brcmf_pub *drvr)
  8724. + {
  8725. + struct brcmf_fws_info *fws;
  8726. ++ struct brcmf_if *ifp;
  8727. + u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS;
  8728. + int rc;
  8729. + u32 mode;
  8730. +@@ -2177,21 +2178,22 @@ int brcmf_fws_init(struct brcmf_pub *drv
  8731. + * continue. Set mode back to none indicating not enabled.
  8732. + */
  8733. + fws->fw_signals = true;
  8734. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) {
  8735. ++ ifp = brcmf_get_ifp(drvr, 0);
  8736. ++ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  8737. + brcmf_err("failed to set bdcv2 tlv signaling\n");
  8738. + fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  8739. + fws->fw_signals = false;
  8740. + }
  8741. +
  8742. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1))
  8743. ++ if (brcmf_fil_iovar_int_set(ifp, "ampdu_hostreorder", 1))
  8744. + brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n");
  8745. +
  8746. + /* Enable seq number reuse, if supported */
  8747. +- if (brcmf_fil_iovar_int_get(drvr->iflist[0], "wlfc_mode", &mode) == 0) {
  8748. ++ if (brcmf_fil_iovar_int_get(ifp, "wlfc_mode", &mode) == 0) {
  8749. + if (BRCMF_FWS_MODE_GET_REUSESEQ(mode)) {
  8750. + mode = 0;
  8751. + BRCMF_FWS_MODE_SET_REUSESEQ(mode, 1);
  8752. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0],
  8753. ++ if (brcmf_fil_iovar_int_set(ifp,
  8754. + "wlfc_mode", mode) == 0) {
  8755. + BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1);
  8756. + }
  8757. diff --git a/package/kernel/mac80211/patches/325-ath9k-ar9271_hw_pa_cal-use-REG_READ_ARRAY.patch b/package/kernel/mac80211/patches/325-ath9k-ar9271_hw_pa_cal-use-REG_READ_ARRAY.patch
  8758. deleted file mode 100644
  8759. index 4e4888f..0000000
  8760. --- a/package/kernel/mac80211/patches/325-ath9k-ar9271_hw_pa_cal-use-REG_READ_ARRAY.patch
  8761. +++ /dev/null
  8762. @@ -1,24 +0,0 @@
  8763. -From: Oleksij Rempel <linux@rempel-privat.de>
  8764. -Date: Sun, 22 Mar 2015 19:29:52 +0100
  8765. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use REG_READ_ARRAY
  8766. -
  8767. -insted of reading each register separatly
  8768. -and waste 4ms on each operation, we can
  8769. -use one shot read.
  8770. -
  8771. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  8772. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  8773. ----
  8774. -
  8775. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  8776. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  8777. -@@ -440,8 +440,7 @@ static void ar9271_hw_pa_cal(struct ath_
  8778. - { AR9285_AN_RF2G3, 0 },
  8779. - };
  8780. -
  8781. -- for (i = 0; i < ARRAY_SIZE(regList); i++)
  8782. -- regList[i][1] = REG_READ(ah, regList[i][0]);
  8783. -+ REG_READ_ARRAY(ah, regList, ARRAY_SIZE(regList));
  8784. -
  8785. - ENABLE_REG_RMW_BUFFER(ah);
  8786. - /* 7834, b1=0 */
  8787. diff --git a/package/kernel/mac80211/patches/325-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch b/package/kernel/mac80211/patches/325-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  8788. new file mode 100644
  8789. index 0000000..23a7b6f
  8790. --- /dev/null
  8791. +++ b/package/kernel/mac80211/patches/325-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  8792. @@ -0,0 +1,122 @@
  8793. +From: Arend van Spriel <arend@broadcom.com>
  8794. +Date: Wed, 26 Aug 2015 22:14:59 +0200
  8795. +Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  8796. + brcmf_txfinalize()
  8797. +
  8798. +Most call sites of brcmf_txfinalize already have struct brcmf_if
  8799. +instance so pass that to brcmf_txfinalize() as the function
  8800. +needs it anyway.
  8801. +
  8802. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  8803. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  8804. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  8805. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  8806. +---
  8807. +
  8808. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  8809. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  8810. +@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  8811. + brcmf_netif_rx(ifp, skb);
  8812. + }
  8813. +
  8814. +-void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  8815. +- bool success)
  8816. ++void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  8817. + {
  8818. +- struct brcmf_if *ifp;
  8819. + struct ethhdr *eh;
  8820. + u16 type;
  8821. +
  8822. +- ifp = drvr->iflist[ifidx];
  8823. +- if (!ifp)
  8824. +- goto done;
  8825. +-
  8826. + eh = (struct ethhdr *)(txp->data);
  8827. + type = ntohs(eh->h_proto);
  8828. +
  8829. +@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  8830. +
  8831. + if (!success)
  8832. + ifp->stats.tx_errors++;
  8833. +-done:
  8834. ++
  8835. + brcmu_pkt_buf_free_skb(txp);
  8836. + }
  8837. +
  8838. +@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  8839. + if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  8840. + brcmu_pkt_buf_free_skb(txp);
  8841. + else
  8842. +- brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  8843. ++ brcmf_txfinalize(ifp, txp, success);
  8844. + }
  8845. + }
  8846. +
  8847. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  8848. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  8849. +@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  8850. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  8851. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  8852. + enum brcmf_netif_stop_reason reason, bool state);
  8853. +-void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  8854. +- bool success);
  8855. ++void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  8856. + void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  8857. +
  8858. + /* Sets dongle media info (drv_version, mac address). */
  8859. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  8860. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  8861. +@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  8862. + ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  8863. + genbit, seq);
  8864. + if (remove_from_hanger || ret)
  8865. +- brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  8866. ++ brcmf_txfinalize(ifp, skb, true);
  8867. +
  8868. + return 0;
  8869. + }
  8870. +@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  8871. + if (fws->avoid_queueing) {
  8872. + rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  8873. + if (rc < 0)
  8874. +- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  8875. ++ brcmf_txfinalize(ifp, skb, false);
  8876. + return rc;
  8877. + }
  8878. +
  8879. +@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  8880. + brcmf_fws_schedule_deq(fws);
  8881. + } else {
  8882. + brcmf_err("drop skb: no hanger slot\n");
  8883. +- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  8884. ++ brcmf_txfinalize(ifp, skb, false);
  8885. + rc = -ENOMEM;
  8886. + }
  8887. + brcmf_fws_unlock(fws);
  8888. +@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  8889. + ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  8890. + brcmf_fws_lock(fws);
  8891. + if (ret < 0)
  8892. +- brcmf_txfinalize(drvr, skb, ifidx,
  8893. +- false);
  8894. ++ brcmf_txfinalize(brcmf_get_ifp(drvr,
  8895. ++ ifidx),
  8896. ++ skb, false);
  8897. + if (fws->bus_flow_blocked)
  8898. + break;
  8899. + }
  8900. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  8901. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  8902. +@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  8903. + commonring = msgbuf->flowrings[flowid];
  8904. + atomic_dec(&commonring->outstanding_tx);
  8905. +
  8906. +- brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  8907. ++ /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  8908. ++ * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  8909. ++ */
  8910. ++ brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  8911. ++ skb, true);
  8912. + }
  8913. +
  8914. +
  8915. diff --git a/package/kernel/mac80211/patches/326-ath9k-use-one-shot-read-in-ath9k_hw_update_mibstats.patch b/package/kernel/mac80211/patches/326-ath9k-use-one-shot-read-in-ath9k_hw_update_mibstats.patch
  8916. deleted file mode 100644
  8917. index a22cd1d..0000000
  8918. --- a/package/kernel/mac80211/patches/326-ath9k-use-one-shot-read-in-ath9k_hw_update_mibstats.patch
  8919. +++ /dev/null
  8920. @@ -1,39 +0,0 @@
  8921. -From: Oleksij Rempel <linux@rempel-privat.de>
  8922. -Date: Sun, 22 Mar 2015 19:29:53 +0100
  8923. -Subject: [PATCH] ath9k: use one shot read in ath9k_hw_update_mibstats
  8924. -
  8925. -this will reduce some overhead on usb bus.
  8926. -
  8927. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  8928. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  8929. ----
  8930. -
  8931. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  8932. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  8933. -@@ -107,11 +107,21 @@ static const struct ani_cck_level_entry
  8934. - static void ath9k_hw_update_mibstats(struct ath_hw *ah,
  8935. - struct ath9k_mib_stats *stats)
  8936. - {
  8937. -- stats->ackrcv_bad += REG_READ(ah, AR_ACK_FAIL);
  8938. -- stats->rts_bad += REG_READ(ah, AR_RTS_FAIL);
  8939. -- stats->fcs_bad += REG_READ(ah, AR_FCS_FAIL);
  8940. -- stats->rts_good += REG_READ(ah, AR_RTS_OK);
  8941. -- stats->beacons += REG_READ(ah, AR_BEACON_CNT);
  8942. -+ u32 addr[5] = {AR_RTS_OK, AR_RTS_FAIL, AR_ACK_FAIL,
  8943. -+ AR_FCS_FAIL, AR_BEACON_CNT};
  8944. -+ u32 data[5];
  8945. -+
  8946. -+ REG_READ_MULTI(ah, &addr[0], &data[0], 5);
  8947. -+ /* AR_RTS_OK */
  8948. -+ stats->rts_good += data[0];
  8949. -+ /* AR_RTS_FAIL */
  8950. -+ stats->rts_bad += data[1];
  8951. -+ /* AR_ACK_FAIL */
  8952. -+ stats->ackrcv_bad += data[2];
  8953. -+ /* AR_FCS_FAIL */
  8954. -+ stats->fcs_bad += data[3];
  8955. -+ /* AR_BEACON_CNT */
  8956. -+ stats->beacons += data[4];
  8957. - }
  8958. -
  8959. - static void ath9k_ani_restart(struct ath_hw *ah)
  8960. diff --git a/package/kernel/mac80211/patches/326-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch b/package/kernel/mac80211/patches/326-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  8961. new file mode 100644
  8962. index 0000000..8ddc0a6
  8963. --- /dev/null
  8964. +++ b/package/kernel/mac80211/patches/326-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  8965. @@ -0,0 +1,92 @@
  8966. +From: Arend van Spriel <arend@broadcom.com>
  8967. +Date: Wed, 26 Aug 2015 22:15:00 +0200
  8968. +Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
  8969. + index
  8970. +
  8971. +Because the P2P Device interface in firmware uses the same interface
  8972. +index as the primary interface we use the bsscfg index as index in the
  8973. +struct brcmf_pub::iflist. However, in the data path we get the interface
  8974. +index and not the bsscfg index. So we need a mapping of interface index
  8975. +to bsscfg index, which can be determined upon handle adding the interface.
  8976. +
  8977. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  8978. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  8979. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  8980. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  8981. +---
  8982. +
  8983. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  8984. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  8985. +@@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
  8986. +
  8987. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  8988. + {
  8989. ++ struct brcmf_if *ifp;
  8990. ++ s32 bssidx;
  8991. ++
  8992. + if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  8993. + brcmf_err("ifidx %d out of range\n", ifidx);
  8994. + return NULL;
  8995. + }
  8996. +
  8997. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  8998. +- * events this is easy because it contains the bssidx which maps
  8999. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  9000. +- * bssidx 1 is used for p2p0 and no data can be received or
  9001. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  9002. +- */
  9003. +- if (ifidx)
  9004. +- ifidx++;
  9005. ++ ifp = NULL;
  9006. ++ bssidx = drvr->if2bss[ifidx];
  9007. ++ if (bssidx >= 0)
  9008. ++ ifp = drvr->iflist[bssidx];
  9009. +
  9010. +- return drvr->iflist[ifidx];
  9011. ++ return ifp;
  9012. + }
  9013. +
  9014. + static void _brcmf_set_multicast_list(struct work_struct *work)
  9015. +@@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  9016. +
  9017. + ifp = netdev_priv(ndev);
  9018. + ifp->ndev = ndev;
  9019. ++ /* store mapping ifidx to bssidx */
  9020. ++ drvr->if2bss[ifidx] = bssidx;
  9021. + }
  9022. +
  9023. + ifp->drvr = drvr;
  9024. +@@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
  9025. + struct brcmf_if *ifp;
  9026. +
  9027. + ifp = drvr->iflist[bssidx];
  9028. ++ drvr->if2bss[ifp->ifidx] = -1;
  9029. + drvr->iflist[bssidx] = NULL;
  9030. + if (!ifp) {
  9031. + brcmf_err("Null interface, idx=%d\n", bssidx);
  9032. +@@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
  9033. + }
  9034. + brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  9035. + if (ifp->ndev) {
  9036. ++ drvr->if2bss[ifp->ifidx] = -1;
  9037. + if (bssidx == 0) {
  9038. + if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  9039. + rtnl_lock();
  9040. +@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  9041. + if (!drvr)
  9042. + return -ENOMEM;
  9043. +
  9044. ++ memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  9045. + mutex_init(&drvr->proto_block);
  9046. +
  9047. + /* Link to bus module */
  9048. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  9049. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  9050. +@@ -122,6 +122,7 @@ struct brcmf_pub {
  9051. + struct mac_address addresses[BRCMF_MAX_IFS];
  9052. +
  9053. + struct brcmf_if *iflist[BRCMF_MAX_IFS];
  9054. ++ s32 if2bss[BRCMF_MAX_IFS];
  9055. +
  9056. + struct mutex proto_block;
  9057. + unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  9058. diff --git a/package/kernel/mac80211/patches/327-ath9k-ath9k_hw_loadnf-use-REG_RMW.patch b/package/kernel/mac80211/patches/327-ath9k-ath9k_hw_loadnf-use-REG_RMW.patch
  9059. deleted file mode 100644
  9060. index e5a362f..0000000
  9061. --- a/package/kernel/mac80211/patches/327-ath9k-ath9k_hw_loadnf-use-REG_RMW.patch
  9062. +++ /dev/null
  9063. @@ -1,71 +0,0 @@
  9064. -From: Oleksij Rempel <linux@rempel-privat.de>
  9065. -Date: Sun, 22 Mar 2015 19:29:54 +0100
  9066. -Subject: [PATCH] ath9k: ath9k_hw_loadnf: use REG_RMW
  9067. -
  9068. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  9069. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9070. ----
  9071. -
  9072. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  9073. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  9074. -@@ -238,7 +238,6 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  9075. - {
  9076. - struct ath9k_nfcal_hist *h = NULL;
  9077. - unsigned i, j;
  9078. -- int32_t val;
  9079. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  9080. - struct ath_common *common = ath9k_hw_common(ah);
  9081. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  9082. -@@ -246,6 +245,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  9083. - if (ah->caldata)
  9084. - h = ah->caldata->nfCalHist;
  9085. -
  9086. -+ ENABLE_REG_RMW_BUFFER(ah);
  9087. - for (i = 0; i < NUM_NF_READINGS; i++) {
  9088. - if (chainmask & (1 << i)) {
  9089. - s16 nfval;
  9090. -@@ -258,10 +258,8 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  9091. - else
  9092. - nfval = default_nf;
  9093. -
  9094. -- val = REG_READ(ah, ah->nf_regs[i]);
  9095. -- val &= 0xFFFFFE00;
  9096. -- val |= (((u32) nfval << 1) & 0x1ff);
  9097. -- REG_WRITE(ah, ah->nf_regs[i], val);
  9098. -+ REG_RMW(ah, ah->nf_regs[i],
  9099. -+ (((u32) nfval << 1) & 0x1ff), 0x1ff);
  9100. - }
  9101. - }
  9102. -
  9103. -@@ -274,6 +272,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  9104. - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
  9105. - AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  9106. - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  9107. -+ REG_RMW_BUFFER_FLUSH(ah);
  9108. -
  9109. - /*
  9110. - * Wait for load to complete, should be fast, a few 10s of us.
  9111. -@@ -309,19 +308,17 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  9112. - * by the median we just loaded. This will be initial (and max) value
  9113. - * of next noise floor calibration the baseband does.
  9114. - */
  9115. -- ENABLE_REGWRITE_BUFFER(ah);
  9116. -+ ENABLE_REG_RMW_BUFFER(ah);
  9117. - for (i = 0; i < NUM_NF_READINGS; i++) {
  9118. - if (chainmask & (1 << i)) {
  9119. - if ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(chan))
  9120. - continue;
  9121. -
  9122. -- val = REG_READ(ah, ah->nf_regs[i]);
  9123. -- val &= 0xFFFFFE00;
  9124. -- val |= (((u32) (-50) << 1) & 0x1ff);
  9125. -- REG_WRITE(ah, ah->nf_regs[i], val);
  9126. -+ REG_RMW(ah, ah->nf_regs[i],
  9127. -+ (((u32) (-50) << 1) & 0x1ff), 0x1ff);
  9128. - }
  9129. - }
  9130. -- REGWRITE_BUFFER_FLUSH(ah);
  9131. -+ REG_RMW_BUFFER_FLUSH(ah);
  9132. -
  9133. - return 0;
  9134. - }
  9135. diff --git a/package/kernel/mac80211/patches/327-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch b/package/kernel/mac80211/patches/327-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  9136. new file mode 100644
  9137. index 0000000..a0a798b
  9138. --- /dev/null
  9139. +++ b/package/kernel/mac80211/patches/327-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  9140. @@ -0,0 +1,103 @@
  9141. +From: Arend van Spriel <arend@broadcom.com>
  9142. +Date: Wed, 26 Aug 2015 22:15:01 +0200
  9143. +Subject: [PATCH] brcmfmac: add dedicated debug level for firmware
  9144. + console logging
  9145. +
  9146. +Both PCIe and SDIO devices have the possibility to log the firmware
  9147. +console output in kernel log. For PCIe it is logged when PCIE debug
  9148. +level is enabled. For SDIO it is logged when user specifies a non-zero
  9149. +console interval through debugfs. This patch tries to make it a
  9150. +bit more consistent. The firmware console output is only logged when
  9151. +FWCON debug level is enabled.
  9152. +
  9153. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9154. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9155. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9156. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  9157. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9158. +---
  9159. +
  9160. +--- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  9161. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  9162. +@@ -37,6 +37,7 @@
  9163. + #define BRCMF_SDIO_VAL 0x00020000
  9164. + #define BRCMF_MSGBUF_VAL 0x00040000
  9165. + #define BRCMF_PCIE_VAL 0x00080000
  9166. ++#define BRCMF_FWCON_VAL 0x00100000
  9167. +
  9168. + /* set default print format */
  9169. + #undef pr_fmt
  9170. +@@ -78,6 +79,7 @@ do { \
  9171. + #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  9172. + #define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
  9173. + #define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
  9174. ++#define BRCMF_FWCON_ON() (brcmf_msg_level & BRCMF_FWCON_VAL)
  9175. +
  9176. + #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  9177. +
  9178. +@@ -90,6 +92,7 @@ do { \
  9179. + #define BRCMF_GLOM_ON() 0
  9180. + #define BRCMF_EVENT_ON() 0
  9181. + #define BRCMF_FIL_ON() 0
  9182. ++#define BRCMF_FWCON_ON() 0
  9183. +
  9184. + #endif /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  9185. +
  9186. +--- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  9187. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  9188. +@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(
  9189. + addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
  9190. + console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
  9191. +
  9192. +- brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
  9193. ++ brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
  9194. + console->base_addr, console->buf_addr, console->bufsize);
  9195. + }
  9196. +
  9197. +@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(
  9198. + u8 ch;
  9199. + u32 newidx;
  9200. +
  9201. ++ if (!BRCMF_FWCON_ON())
  9202. ++ return;
  9203. ++
  9204. + console = &devinfo->shared.console;
  9205. + addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
  9206. + newidx = brcmf_pcie_read_tcm32(devinfo, addr);
  9207. +@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(
  9208. + }
  9209. + if (ch == '\n') {
  9210. + console->log_str[console->log_idx] = 0;
  9211. +- brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  9212. ++ pr_debug("CONSOLE: %s", console->log_str);
  9213. + console->log_idx = 0;
  9214. + }
  9215. + }
  9216. +--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  9217. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  9218. +@@ -123,6 +123,7 @@ struct rte_console {
  9219. +
  9220. + #define BRCMF_FIRSTREAD (1 << 6)
  9221. +
  9222. ++#define BRCMF_CONSOLE 10 /* watchdog interval to poll console */
  9223. +
  9224. + /* SBSDIO_DEVICE_CTL */
  9225. +
  9226. +@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(st
  9227. + if (IS_ERR_OR_NULL(dentry))
  9228. + return;
  9229. +
  9230. ++ bus->console_interval = BRCMF_CONSOLE;
  9231. ++
  9232. + brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
  9233. + brcmf_debugfs_add_entry(drvr, "counters",
  9234. + brcmf_debugfs_sdio_count_read);
  9235. +@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(stru
  9236. + }
  9237. + #ifdef DEBUG
  9238. + /* Poll for console output periodically */
  9239. +- if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
  9240. ++ if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
  9241. + bus->console_interval != 0) {
  9242. + bus->console.count += BRCMF_WD_POLL_MS;
  9243. + if (bus->console.count >= bus->console_interval) {
  9244. diff --git a/package/kernel/mac80211/patches/328-ath9k-write-buffer-related-optimisation-in-ar5008_hw.patch b/package/kernel/mac80211/patches/328-ath9k-write-buffer-related-optimisation-in-ar5008_hw.patch
  9245. deleted file mode 100644
  9246. index 01c8011..0000000
  9247. --- a/package/kernel/mac80211/patches/328-ath9k-write-buffer-related-optimisation-in-ar5008_hw.patch
  9248. +++ /dev/null
  9249. @@ -1,27 +0,0 @@
  9250. -From: Oleksij Rempel <linux@rempel-privat.de>
  9251. -Date: Sun, 22 Mar 2015 19:29:55 +0100
  9252. -Subject: [PATCH] ath9k: write buffer related optimisation in
  9253. - ar5008_hw_set_channel_regs
  9254. -
  9255. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  9256. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9257. ----
  9258. -
  9259. ---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  9260. -+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  9261. -@@ -681,12 +681,13 @@ static void ar5008_hw_set_channel_regs(s
  9262. - phymode |= AR_PHY_FC_DYN2040_PRI_CH;
  9263. -
  9264. - }
  9265. -+ ENABLE_REGWRITE_BUFFER(ah);
  9266. - REG_WRITE(ah, AR_PHY_TURBO, phymode);
  9267. -
  9268. -+ /* This function do only REG_WRITE, so
  9269. -+ * we can include it to REGWRITE_BUFFER. */
  9270. - ath9k_hw_set11nmac2040(ah, chan);
  9271. -
  9272. -- ENABLE_REGWRITE_BUFFER(ah);
  9273. --
  9274. - REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S);
  9275. - REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S);
  9276. -
  9277. diff --git a/package/kernel/mac80211/patches/328-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch b/package/kernel/mac80211/patches/328-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  9278. new file mode 100644
  9279. index 0000000..53e7ede
  9280. --- /dev/null
  9281. +++ b/package/kernel/mac80211/patches/328-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  9282. @@ -0,0 +1,34 @@
  9283. +From: Arend van Spriel <arend@broadcom.com>
  9284. +Date: Wed, 26 Aug 2015 22:15:02 +0200
  9285. +Subject: [PATCH] brcmfmac: remove ifidx parameter from
  9286. + brcmf_fws_txstatus_suppressed()
  9287. +
  9288. +The brcmf_fws_txstatus_suppressed() function prototype specifies an
  9289. +ifidx parameter which is not used within the function implementation.
  9290. +
  9291. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9292. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9293. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9294. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9295. +---
  9296. +
  9297. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  9298. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  9299. +@@ -1398,7 +1398,7 @@ done:
  9300. + }
  9301. +
  9302. + static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo,
  9303. +- struct sk_buff *skb, u8 ifidx,
  9304. ++ struct sk_buff *skb,
  9305. + u32 genbit, u16 seq)
  9306. + {
  9307. + struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac;
  9308. +@@ -1503,7 +1503,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  9309. + return -EINVAL;
  9310. + }
  9311. + if (!remove_from_hanger)
  9312. +- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  9313. ++ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb,
  9314. + genbit, seq);
  9315. + if (remove_from_hanger || ret)
  9316. + brcmf_txfinalize(ifp, skb, true);
  9317. diff --git a/package/kernel/mac80211/patches/329-ath9k-ath9k_hw_set_4k_power_cal_tabl-use-rmw-buffer.patch b/package/kernel/mac80211/patches/329-ath9k-ath9k_hw_set_4k_power_cal_tabl-use-rmw-buffer.patch
  9318. deleted file mode 100644
  9319. index e5219f2..0000000
  9320. --- a/package/kernel/mac80211/patches/329-ath9k-ath9k_hw_set_4k_power_cal_tabl-use-rmw-buffer.patch
  9321. +++ /dev/null
  9322. @@ -1,26 +0,0 @@
  9323. -From: Oleksij Rempel <linux@rempel-privat.de>
  9324. -Date: Sun, 22 Mar 2015 19:29:56 +0100
  9325. -Subject: [PATCH] ath9k: ath9k_hw_set_4k_power_cal_tabl: use rmw buffer
  9326. -
  9327. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  9328. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9329. ----
  9330. -
  9331. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  9332. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  9333. -@@ -389,6 +389,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  9334. - }
  9335. - }
  9336. -
  9337. -+ ENABLE_REG_RMW_BUFFER(ah);
  9338. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
  9339. - (numXpdGain - 1) & 0x3);
  9340. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
  9341. -@@ -396,6 +397,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  9342. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
  9343. - xpdGainValues[1]);
  9344. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, 0);
  9345. -+ REG_RMW_BUFFER_FLUSH(ah);
  9346. -
  9347. - for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
  9348. - regChainOffset = i * 0x1000;
  9349. diff --git a/package/kernel/mac80211/patches/329-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch b/package/kernel/mac80211/patches/329-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  9350. new file mode 100644
  9351. index 0000000..bb05235
  9352. --- /dev/null
  9353. +++ b/package/kernel/mac80211/patches/329-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  9354. @@ -0,0 +1,97 @@
  9355. +From: Arend van Spriel <arend@broadcom.com>
  9356. +Date: Wed, 26 Aug 2015 22:15:03 +0200
  9357. +Subject: [PATCH] brcmfmac: change prototype for brcmf_fws_hdrpull()
  9358. +
  9359. +Instead of passing ifidx and drvr just pass struct brcmf_if pointer
  9360. +which holds both parameters.
  9361. +
  9362. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9363. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9364. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9365. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9366. +---
  9367. +
  9368. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  9369. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  9370. +@@ -312,8 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  9371. +
  9372. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  9373. + if (do_fws)
  9374. +- brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  9375. +- pktbuf);
  9376. ++ brcmf_fws_hdrpull(tmp_if, h->data_offset << 2, pktbuf);
  9377. + else
  9378. + skb_pull(pktbuf, h->data_offset << 2);
  9379. +
  9380. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  9381. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  9382. +@@ -1616,11 +1616,10 @@ static int brcmf_fws_notify_bcmc_credit_
  9383. + return 0;
  9384. + }
  9385. +
  9386. +-int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  9387. +- struct sk_buff *skb)
  9388. ++void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  9389. + {
  9390. + struct brcmf_skb_reorder_data *rd;
  9391. +- struct brcmf_fws_info *fws = drvr->fws;
  9392. ++ struct brcmf_fws_info *fws = ifp->drvr->fws;
  9393. + u8 *signal_data;
  9394. + s16 data_len;
  9395. + u8 type;
  9396. +@@ -1630,20 +1629,20 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  9397. + s32 err;
  9398. +
  9399. + brcmf_dbg(HDRS, "enter: ifidx %d, skblen %u, sig %d\n",
  9400. +- ifidx, skb->len, signal_len);
  9401. ++ ifp->ifidx, skb->len, siglen);
  9402. +
  9403. +- WARN_ON(signal_len > skb->len);
  9404. ++ WARN_ON(siglen > skb->len);
  9405. +
  9406. +- if (!signal_len)
  9407. +- return 0;
  9408. ++ if (!siglen)
  9409. ++ return;
  9410. + /* if flow control disabled, skip to packet data and leave */
  9411. + if ((!fws) || (!fws->fw_signals)) {
  9412. +- skb_pull(skb, signal_len);
  9413. +- return 0;
  9414. ++ skb_pull(skb, siglen);
  9415. ++ return;
  9416. + }
  9417. +
  9418. + fws->stats.header_pulls++;
  9419. +- data_len = signal_len;
  9420. ++ data_len = siglen;
  9421. + signal_data = skb->data;
  9422. +
  9423. + status = BRCMF_FWS_RET_OK_NOSCHEDULE;
  9424. +@@ -1731,14 +1730,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  9425. + /* signalling processing result does
  9426. + * not affect the actual ethernet packet.
  9427. + */
  9428. +- skb_pull(skb, signal_len);
  9429. ++ skb_pull(skb, siglen);
  9430. +
  9431. + /* this may be a signal-only packet
  9432. + */
  9433. + if (skb->len == 0)
  9434. + fws->stats.header_only_pkt++;
  9435. +-
  9436. +- return 0;
  9437. + }
  9438. +
  9439. + static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
  9440. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  9441. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  9442. +@@ -21,8 +21,7 @@
  9443. + int brcmf_fws_init(struct brcmf_pub *drvr);
  9444. + void brcmf_fws_deinit(struct brcmf_pub *drvr);
  9445. + bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
  9446. +-int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  9447. +- struct sk_buff *skb);
  9448. ++void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
  9449. + int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);
  9450. +
  9451. + void brcmf_fws_reset_interface(struct brcmf_if *ifp);
  9452. diff --git a/package/kernel/mac80211/patches/330-ath9k-use-rmw-buffer-in-ath9k_hw_set_operating_mode-.patch b/package/kernel/mac80211/patches/330-ath9k-use-rmw-buffer-in-ath9k_hw_set_operating_mode-.patch
  9453. deleted file mode 100644
  9454. index 6ce3f40..0000000
  9455. --- a/package/kernel/mac80211/patches/330-ath9k-use-rmw-buffer-in-ath9k_hw_set_operating_mode-.patch
  9456. +++ /dev/null
  9457. @@ -1,43 +0,0 @@
  9458. -From: Oleksij Rempel <linux@rempel-privat.de>
  9459. -Date: Sun, 22 Mar 2015 19:29:57 +0100
  9460. -Subject: [PATCH] ath9k: use rmw buffer in ath9k_hw_set_operating_mode
  9461. - and ath9k_hw_reset
  9462. -
  9463. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  9464. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9465. ----
  9466. -
  9467. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  9468. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  9469. -@@ -1227,6 +1227,7 @@ static void ath9k_hw_set_operating_mode(
  9470. - u32 mask = AR_STA_ID1_STA_AP | AR_STA_ID1_ADHOC;
  9471. - u32 set = AR_STA_ID1_KSRCH_MODE;
  9472. -
  9473. -+ ENABLE_REG_RMW_BUFFER(ah);
  9474. - switch (opmode) {
  9475. - case NL80211_IFTYPE_ADHOC:
  9476. - if (!AR_SREV_9340_13(ah)) {
  9477. -@@ -1248,6 +1249,7 @@ static void ath9k_hw_set_operating_mode(
  9478. - break;
  9479. - }
  9480. - REG_RMW(ah, AR_STA_ID1, set, mask);
  9481. -+ REG_RMW_BUFFER_FLUSH(ah);
  9482. - }
  9483. -
  9484. - void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
  9485. -@@ -1960,6 +1962,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  9486. - if (!ath9k_hw_mci_is_enabled(ah))
  9487. - REG_WRITE(ah, AR_OBS, 8);
  9488. -
  9489. -+ ENABLE_REG_RMW_BUFFER(ah);
  9490. - if (ah->config.rx_intr_mitigation) {
  9491. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, ah->config.rimt_last);
  9492. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, ah->config.rimt_first);
  9493. -@@ -1969,6 +1972,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  9494. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300);
  9495. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750);
  9496. - }
  9497. -+ REG_RMW_BUFFER_FLUSH(ah);
  9498. -
  9499. - ath9k_hw_init_bb(ah, chan);
  9500. -
  9501. diff --git a/package/kernel/mac80211/patches/330-brcmfmac-introduce-brcmf_net_detach-function.patch b/package/kernel/mac80211/patches/330-brcmfmac-introduce-brcmf_net_detach-function.patch
  9502. new file mode 100644
  9503. index 0000000..0651a2f
  9504. --- /dev/null
  9505. +++ b/package/kernel/mac80211/patches/330-brcmfmac-introduce-brcmf_net_detach-function.patch
  9506. @@ -0,0 +1,99 @@
  9507. +From: Arend van Spriel <arend@broadcom.com>
  9508. +Date: Wed, 26 Aug 2015 22:15:04 +0200
  9509. +Subject: [PATCH] brcmfmac: introduce brcmf_net_detach() function
  9510. +
  9511. +In case of error during brcmf_bus_start() the network interfaces were
  9512. +freed using free_netdev(). However, the interfaces may have additional
  9513. +memory allocated which is not freed. The netdev has destructor set to
  9514. +brcmf_cfg80211_free_netdev() which frees the additional memory if
  9515. +allocated and call free_netdev(). The brcmf_net_detach() either calls
  9516. +brcmf_cfg80211_free_netdev() directly or uses unregister_netdev() when
  9517. +struct net_device::reg_state indicates the netdev was registered.
  9518. +
  9519. +Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  9520. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9521. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9522. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9523. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9524. +---
  9525. +
  9526. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9527. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9528. +@@ -4747,7 +4747,8 @@ void brcmf_cfg80211_free_netdev(struct n
  9529. + ifp = netdev_priv(ndev);
  9530. + vif = ifp->vif;
  9531. +
  9532. +- brcmf_free_vif(vif);
  9533. ++ if (vif)
  9534. ++ brcmf_free_vif(vif);
  9535. + free_netdev(ndev);
  9536. + }
  9537. +
  9538. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  9539. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  9540. +@@ -718,8 +718,6 @@ int brcmf_net_attach(struct brcmf_if *if
  9541. + }
  9542. +
  9543. + brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
  9544. +-
  9545. +- ndev->destructor = brcmf_cfg80211_free_netdev;
  9546. + return 0;
  9547. +
  9548. + fail:
  9549. +@@ -729,6 +727,14 @@ fail:
  9550. + return -EBADE;
  9551. + }
  9552. +
  9553. ++static void brcmf_net_detach(struct net_device *ndev)
  9554. ++{
  9555. ++ if (ndev->reg_state == NETREG_REGISTERED)
  9556. ++ unregister_netdev(ndev);
  9557. ++ else
  9558. ++ brcmf_cfg80211_free_netdev(ndev);
  9559. ++}
  9560. ++
  9561. + static int brcmf_net_p2p_open(struct net_device *ndev)
  9562. + {
  9563. + brcmf_dbg(TRACE, "Enter\n");
  9564. +@@ -805,8 +811,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  9565. + ifp->ndev->name);
  9566. + if (ifidx) {
  9567. + netif_stop_queue(ifp->ndev);
  9568. +- unregister_netdev(ifp->ndev);
  9569. +- free_netdev(ifp->ndev);
  9570. ++ brcmf_net_detach(ifp->ndev);
  9571. + drvr->iflist[bssidx] = NULL;
  9572. + } else {
  9573. + brcmf_err("ignore IF event\n");
  9574. +@@ -828,6 +833,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  9575. + if (!ndev)
  9576. + return ERR_PTR(-ENOMEM);
  9577. +
  9578. ++ ndev->destructor = brcmf_cfg80211_free_netdev;
  9579. + ifp = netdev_priv(ndev);
  9580. + ifp->ndev = ndev;
  9581. + /* store mapping ifidx to bssidx */
  9582. +@@ -879,8 +885,7 @@ static void brcmf_del_if(struct brcmf_pu
  9583. + cancel_work_sync(&ifp->setmacaddr_work);
  9584. + cancel_work_sync(&ifp->multicast_work);
  9585. + }
  9586. +- /* unregister will take care of freeing it */
  9587. +- unregister_netdev(ifp->ndev);
  9588. ++ brcmf_net_detach(ifp->ndev);
  9589. + }
  9590. + }
  9591. +
  9592. +@@ -1056,11 +1061,11 @@ fail:
  9593. + brcmf_fws_deinit(drvr);
  9594. + }
  9595. + if (drvr->iflist[0]) {
  9596. +- free_netdev(ifp->ndev);
  9597. ++ brcmf_net_detach(ifp->ndev);
  9598. + drvr->iflist[0] = NULL;
  9599. + }
  9600. + if (p2p_ifp) {
  9601. +- free_netdev(p2p_ifp->ndev);
  9602. ++ brcmf_net_detach(p2p_ifp->ndev);
  9603. + drvr->iflist[1] = NULL;
  9604. + }
  9605. + return ret;
  9606. diff --git a/package/kernel/mac80211/patches/331-ath9k-ath9k_hw_4k_set_board_values-use-rmw-buffer.patch b/package/kernel/mac80211/patches/331-ath9k-ath9k_hw_4k_set_board_values-use-rmw-buffer.patch
  9607. deleted file mode 100644
  9608. index edd6160..0000000
  9609. --- a/package/kernel/mac80211/patches/331-ath9k-ath9k_hw_4k_set_board_values-use-rmw-buffer.patch
  9610. +++ /dev/null
  9611. @@ -1,26 +0,0 @@
  9612. -From: Oleksij Rempel <linux@rempel-privat.de>
  9613. -Date: Sun, 22 Mar 2015 19:29:58 +0100
  9614. -Subject: [PATCH] ath9k: ath9k_hw_4k_set_board_values: use rmw buffer
  9615. -
  9616. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  9617. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9618. ----
  9619. -
  9620. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  9621. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  9622. -@@ -1082,6 +1082,7 @@ static void ath9k_hw_4k_set_board_values
  9623. - mask = BIT(0)|BIT(5)|BIT(10)|BIT(15)|BIT(20)|BIT(25);
  9624. - pwrctrl = mask * bb_desired_scale;
  9625. - clr = mask * 0x1f;
  9626. -+ ENABLE_REG_RMW_BUFFER(ah);
  9627. - REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr);
  9628. - REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr);
  9629. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr);
  9630. -@@ -1096,6 +1097,7 @@ static void ath9k_hw_4k_set_board_values
  9631. - clr = mask * 0x1f;
  9632. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr);
  9633. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr);
  9634. -+ REG_RMW_BUFFER_FLUSH(ah);
  9635. - }
  9636. - }
  9637. -
  9638. diff --git a/package/kernel/mac80211/patches/331-brcmfmac-Reset-PCIE-devices-after-recognition.patch b/package/kernel/mac80211/patches/331-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  9639. new file mode 100644
  9640. index 0000000..5a7e447
  9641. --- /dev/null
  9642. +++ b/package/kernel/mac80211/patches/331-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  9643. @@ -0,0 +1,193 @@
  9644. +From: Hante Meuleman <meuleman@broadcom.com>
  9645. +Date: Thu, 27 Aug 2015 16:14:06 +0200
  9646. +Subject: [PATCH] brcmfmac: Reset PCIE devices after recognition.
  9647. +
  9648. +When PCIE type devices are being FW reloaded without being properly
  9649. +reset then the device ends up in a locked state, requiring the
  9650. +device to be completely powered down. This patch adds a reset
  9651. +through watchdog at the moment the device (cores) has been
  9652. +recognized. This will solve warm reboot issues.
  9653. +
  9654. +Cc: Rafal Milecki <zajec5@gmail.com>
  9655. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9656. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9657. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9658. +Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9659. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9660. +---
  9661. +
  9662. +--- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  9663. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  9664. +@@ -101,6 +101,9 @@
  9665. + /* ARM Cortex M3 core, ID 0x82a */
  9666. + #define BCM4329_CORE_ARM_BASE 0x18002000
  9667. +
  9668. ++/* Max possibly supported memory size (limited by IO mapped memory) */
  9669. ++#define BRCMF_CHIP_MAX_MEMSIZE (4 * 1024 * 1024)
  9670. ++
  9671. + #define CORE_SB(base, field) \
  9672. + (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  9673. + #define SBCOREREV(sbidh) \
  9674. +@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct
  9675. + brcmf_err("RAM size is undetermined\n");
  9676. + return -ENOMEM;
  9677. + }
  9678. ++
  9679. ++ if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
  9680. ++ brcmf_err("RAM size is incorrect\n");
  9681. ++ return -ENOMEM;
  9682. ++ }
  9683. ++
  9684. + return 0;
  9685. + }
  9686. +
  9687. +@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct
  9688. +
  9689. + /* assure chip is passive for core access */
  9690. + brcmf_chip_set_passive(&ci->pub);
  9691. ++
  9692. ++ /* Call bus specific reset function now. Cores have been determined
  9693. ++ * but further access may require a chip specific reset at this point.
  9694. ++ */
  9695. ++ if (ci->ops->reset) {
  9696. ++ ci->ops->reset(ci->ctx, &ci->pub);
  9697. ++ brcmf_chip_set_passive(&ci->pub);
  9698. ++ }
  9699. ++
  9700. + return brcmf_chip_get_raminfo(ci);
  9701. + }
  9702. +
  9703. +--- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  9704. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  9705. +@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
  9706. + u32 (*read32)(void *ctx, u32 addr);
  9707. + void (*write32)(void *ctx, u32 addr, u32 value);
  9708. + int (*prepare)(void *ctx);
  9709. ++ int (*reset)(void *ctx, struct brcmf_chip *chip);
  9710. + int (*setup)(void *ctx, struct brcmf_chip *chip);
  9711. + void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  9712. + };
  9713. +--- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  9714. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  9715. +@@ -74,6 +74,8 @@ enum brcmf_pcie_state {
  9716. + #define BRCMF_PCIE_REG_INTMASK 0x94
  9717. + #define BRCMF_PCIE_REG_SBMBX 0x98
  9718. +
  9719. ++#define BRCMF_PCIE_REG_LINK_STATUS_CTRL 0xBC
  9720. ++
  9721. + #define BRCMF_PCIE_PCIE2REG_INTMASK 0x24
  9722. + #define BRCMF_PCIE_PCIE2REG_MAILBOXINT 0x48
  9723. + #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C
  9724. +@@ -466,6 +468,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
  9725. +
  9726. + static void brcmf_pcie_reset_device(struct brcmf_pciedev_info *devinfo)
  9727. + {
  9728. ++ struct brcmf_core *core;
  9729. + u16 cfg_offset[] = { BRCMF_PCIE_CFGREG_STATUS_CMD,
  9730. + BRCMF_PCIE_CFGREG_PM_CSR,
  9731. + BRCMF_PCIE_CFGREG_MSI_CAP,
  9732. +@@ -484,32 +487,38 @@ static void brcmf_pcie_reset_device(stru
  9733. + if (!devinfo->ci)
  9734. + return;
  9735. +
  9736. ++ /* Disable ASPM */
  9737. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  9738. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  9739. +- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  9740. +- lsc = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  9741. ++ pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  9742. ++ &lsc);
  9743. + val = lsc & (~BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB);
  9744. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, val);
  9745. ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  9746. ++ val);
  9747. +
  9748. ++ /* Watchdog reset */
  9749. + brcmf_pcie_select_core(devinfo, BCMA_CORE_CHIPCOMMON);
  9750. + WRITECC32(devinfo, watchdog, 4);
  9751. + msleep(100);
  9752. +
  9753. ++ /* Restore ASPM */
  9754. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  9755. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  9756. +- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  9757. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, lsc);
  9758. ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  9759. ++ lsc);
  9760. +
  9761. +- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  9762. +- for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  9763. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  9764. +- cfg_offset[i]);
  9765. +- val = brcmf_pcie_read_reg32(devinfo,
  9766. +- BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  9767. +- brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  9768. +- cfg_offset[i], val);
  9769. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  9770. +- val);
  9771. ++ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
  9772. ++ if (core->rev <= 13) {
  9773. ++ for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  9774. ++ brcmf_pcie_write_reg32(devinfo,
  9775. ++ BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  9776. ++ cfg_offset[i]);
  9777. ++ val = brcmf_pcie_read_reg32(devinfo,
  9778. ++ BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  9779. ++ brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  9780. ++ cfg_offset[i], val);
  9781. ++ brcmf_pcie_write_reg32(devinfo,
  9782. ++ BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  9783. ++ val);
  9784. ++ }
  9785. + }
  9786. + }
  9787. +
  9788. +@@ -519,8 +528,6 @@ static void brcmf_pcie_attach(struct brc
  9789. + u32 config;
  9790. +
  9791. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  9792. +- if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0)
  9793. +- brcmf_pcie_reset_device(devinfo);
  9794. + /* BAR1 window may not be sized properly */
  9795. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  9796. + brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR, 0x4e0);
  9797. +@@ -1636,6 +1643,23 @@ static int brcmf_pcie_buscoreprep(void *
  9798. + }
  9799. +
  9800. +
  9801. ++static int brcmf_pcie_buscore_reset(void *ctx, struct brcmf_chip *chip)
  9802. ++{
  9803. ++ struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  9804. ++ u32 val;
  9805. ++
  9806. ++ devinfo->ci = chip;
  9807. ++ brcmf_pcie_reset_device(devinfo);
  9808. ++
  9809. ++ val = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  9810. ++ if (val != 0xffffffff)
  9811. ++ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  9812. ++ val);
  9813. ++
  9814. ++ return 0;
  9815. ++}
  9816. ++
  9817. ++
  9818. + static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  9819. + u32 rstvec)
  9820. + {
  9821. +@@ -1647,6 +1671,7 @@ static void brcmf_pcie_buscore_activate(
  9822. +
  9823. + static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  9824. + .prepare = brcmf_pcie_buscoreprep,
  9825. ++ .reset = brcmf_pcie_buscore_reset,
  9826. + .activate = brcmf_pcie_buscore_activate,
  9827. + .read32 = brcmf_pcie_buscore_read32,
  9828. + .write32 = brcmf_pcie_buscore_write32,
  9829. +@@ -1814,7 +1839,6 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  9830. + brcmf_pcie_intr_disable(devinfo);
  9831. +
  9832. + brcmf_detach(&pdev->dev);
  9833. +- brcmf_pcie_reset_device(devinfo);
  9834. +
  9835. + kfree(bus->bus_priv.pcie);
  9836. + kfree(bus->msgbuf->flowrings);
  9837. diff --git a/package/kernel/mac80211/patches/332-ath9k-ath9k_hw_analog_shift_rmw-use-REG_RMW.patch b/package/kernel/mac80211/patches/332-ath9k-ath9k_hw_analog_shift_rmw-use-REG_RMW.patch
  9838. deleted file mode 100644
  9839. index 3ce4428..0000000
  9840. --- a/package/kernel/mac80211/patches/332-ath9k-ath9k_hw_analog_shift_rmw-use-REG_RMW.patch
  9841. +++ /dev/null
  9842. @@ -1,27 +0,0 @@
  9843. -From: Oleksij Rempel <linux@rempel-privat.de>
  9844. -Date: Sun, 22 Mar 2015 19:29:59 +0100
  9845. -Subject: [PATCH] ath9k: ath9k_hw_analog_shift_rmw: use REG_RMW
  9846. -
  9847. -use REG_RMW in ath9k_hw_analog_shift_rmw.
  9848. -It will double execution speed on usb bus.
  9849. -
  9850. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  9851. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9852. ----
  9853. -
  9854. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  9855. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  9856. -@@ -27,12 +27,7 @@ void ath9k_hw_analog_shift_regwrite(stru
  9857. - void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask,
  9858. - u32 shift, u32 val)
  9859. - {
  9860. -- u32 regVal;
  9861. --
  9862. -- regVal = REG_READ(ah, reg) & ~mask;
  9863. -- regVal |= (val << shift) & mask;
  9864. --
  9865. -- REG_WRITE(ah, reg, regVal);
  9866. -+ REG_RMW(ah, reg, ((val << shift) & mask), mask);
  9867. -
  9868. - if (ah->config.analog_shiftreg)
  9869. - udelay(100);
  9870. diff --git a/package/kernel/mac80211/patches/333-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_4k_set_.patch b/package/kernel/mac80211/patches/333-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_4k_set_.patch
  9871. deleted file mode 100644
  9872. index 8f12b36..0000000
  9873. --- a/package/kernel/mac80211/patches/333-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_4k_set_.patch
  9874. +++ /dev/null
  9875. @@ -1,47 +0,0 @@
  9876. -From: Oleksij Rempel <linux@rempel-privat.de>
  9877. -Date: Sun, 22 Mar 2015 19:30:01 +0100
  9878. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  9879. - ath9k_hw_4k_set_gain
  9880. -
  9881. -it is possible to reduce time needed for this function
  9882. -by rplacing REG_WRITE with REG_RMW (plus dummy 0) and putt all commands
  9883. -in same buffer.
  9884. -
  9885. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  9886. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9887. ----
  9888. -
  9889. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  9890. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  9891. -@@ -772,15 +772,14 @@ static void ath9k_hw_4k_set_gain(struct
  9892. - struct ar5416_eeprom_4k *eep,
  9893. - u8 txRxAttenLocal)
  9894. - {
  9895. -- REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0,
  9896. -- pModal->antCtrlChain[0]);
  9897. --
  9898. -- REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0),
  9899. -- (REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) &
  9900. -- ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
  9901. -- AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
  9902. -- SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  9903. -- SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
  9904. -+ ENABLE_REG_RMW_BUFFER(ah);
  9905. -+ REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0,
  9906. -+ pModal->antCtrlChain[0], 0);
  9907. -+
  9908. -+ REG_RMW(ah, AR_PHY_TIMING_CTRL4(0),
  9909. -+ SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  9910. -+ SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF),
  9911. -+ AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF);
  9912. -
  9913. - if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
  9914. - AR5416_EEP_MINOR_VER_3) {
  9915. -@@ -819,6 +818,7 @@ static void ath9k_hw_4k_set_gain(struct
  9916. - AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
  9917. - REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
  9918. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]);
  9919. -+ REG_RMW_BUFFER_FLUSH(ah);
  9920. - }
  9921. -
  9922. - /*
  9923. diff --git a/package/kernel/mac80211/patches/334-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_def_set.patch b/package/kernel/mac80211/patches/334-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_def_set.patch
  9924. deleted file mode 100644
  9925. index f26e059..0000000
  9926. --- a/package/kernel/mac80211/patches/334-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_def_set.patch
  9927. +++ /dev/null
  9928. @@ -1,67 +0,0 @@
  9929. -From: Oleksij Rempel <linux@rempel-privat.de>
  9930. -Date: Sun, 22 Mar 2015 19:30:03 +0100
  9931. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  9932. - ath9k_hw_def_set_gain
  9933. -
  9934. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  9935. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9936. ----
  9937. -
  9938. ---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
  9939. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
  9940. -@@ -466,6 +466,7 @@ static void ath9k_hw_def_set_gain(struct
  9941. - struct ar5416_eeprom_def *eep,
  9942. - u8 txRxAttenLocal, int regChainOffset, int i)
  9943. - {
  9944. -+ ENABLE_REG_RMW_BUFFER(ah);
  9945. - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
  9946. - txRxAttenLocal = pModal->txRxAttenCh[i];
  9947. -
  9948. -@@ -483,16 +484,12 @@ static void ath9k_hw_def_set_gain(struct
  9949. - AR_PHY_GAIN_2GHZ_XATTEN2_DB,
  9950. - pModal->xatten2Db[i]);
  9951. - } else {
  9952. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  9953. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  9954. -- ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
  9955. -- | SM(pModal-> bswMargin[i],
  9956. -- AR_PHY_GAIN_2GHZ_BSW_MARGIN));
  9957. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  9958. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  9959. -- ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
  9960. -- | SM(pModal->bswAtten[i],
  9961. -- AR_PHY_GAIN_2GHZ_BSW_ATTEN));
  9962. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  9963. -+ SM(pModal-> bswMargin[i], AR_PHY_GAIN_2GHZ_BSW_MARGIN),
  9964. -+ AR_PHY_GAIN_2GHZ_BSW_MARGIN);
  9965. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  9966. -+ SM(pModal->bswAtten[i], AR_PHY_GAIN_2GHZ_BSW_ATTEN),
  9967. -+ AR_PHY_GAIN_2GHZ_BSW_ATTEN);
  9968. - }
  9969. - }
  9970. -
  9971. -@@ -504,17 +501,14 @@ static void ath9k_hw_def_set_gain(struct
  9972. - AR_PHY_RXGAIN + regChainOffset,
  9973. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]);
  9974. - } else {
  9975. -- REG_WRITE(ah,
  9976. -- AR_PHY_RXGAIN + regChainOffset,
  9977. -- (REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) &
  9978. -- ~AR_PHY_RXGAIN_TXRX_ATTEN)
  9979. -- | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN));
  9980. -- REG_WRITE(ah,
  9981. -- AR_PHY_GAIN_2GHZ + regChainOffset,
  9982. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  9983. -- ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
  9984. -- SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
  9985. -+ REG_RMW(ah, AR_PHY_RXGAIN + regChainOffset,
  9986. -+ SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN),
  9987. -+ AR_PHY_RXGAIN_TXRX_ATTEN);
  9988. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  9989. -+ SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN),
  9990. -+ AR_PHY_GAIN_2GHZ_RXTX_MARGIN);
  9991. - }
  9992. -+ REG_RMW_BUFFER_FLUSH(ah);
  9993. - }
  9994. -
  9995. - static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
  9996. diff --git a/package/kernel/mac80211/patches/335-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch b/package/kernel/mac80211/patches/335-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch
  9997. deleted file mode 100644
  9998. index 5e63a80..0000000
  9999. --- a/package/kernel/mac80211/patches/335-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch
  10000. +++ /dev/null
  10001. @@ -1,44 +0,0 @@
  10002. -From: Hante Meuleman <meuleman@broadcom.com>
  10003. -Date: Fri, 6 Mar 2015 18:40:38 +0100
  10004. -Subject: [PATCH] brcmfmac: Fix oops when SDIO device is removed.
  10005. -
  10006. -On removal of SDIO card both functions of card will be getting
  10007. -a remove call. When the first is hanging in ctrl frame xmit then
  10008. -the second will cause oops. This patch fixes the xmit ctrl
  10009. -handling in case of serious errors and also limits the handling
  10010. -for remove to function 1 only.
  10011. -
  10012. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10013. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10014. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10015. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  10016. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10017. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10018. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10019. ----
  10020. -
  10021. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  10022. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  10023. -@@ -1194,7 +1194,7 @@ static void brcmf_ops_sdio_remove(struct
  10024. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  10025. - brcmf_dbg(SDIO, "Function: %d\n", func->num);
  10026. -
  10027. -- if (func->num != 1 && func->num != 2)
  10028. -+ if (func->num != 1)
  10029. - return;
  10030. -
  10031. - bus_if = dev_get_drvdata(&func->dev);
  10032. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10033. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10034. -@@ -2740,6 +2740,11 @@ static void brcmf_sdio_dpc(struct brcmf_
  10035. - if ((bus->sdiodev->state != BRCMF_SDIOD_DATA) || (err != 0)) {
  10036. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  10037. - atomic_set(&bus->intstatus, 0);
  10038. -+ if (bus->ctrl_frame_stat) {
  10039. -+ bus->ctrl_frame_err = -ENODEV;
  10040. -+ bus->ctrl_frame_stat = false;
  10041. -+ brcmf_sdio_wait_event_wakeup(bus);
  10042. -+ }
  10043. - } else if (atomic_read(&bus->intstatus) ||
  10044. - atomic_read(&bus->ipend) > 0 ||
  10045. - (!atomic_read(&bus->fcstate) &&
  10046. diff --git a/package/kernel/mac80211/patches/336-brcmfmac-Simplify-watchdog-sleep.patch b/package/kernel/mac80211/patches/336-brcmfmac-Simplify-watchdog-sleep.patch
  10047. deleted file mode 100644
  10048. index 201da75..0000000
  10049. --- a/package/kernel/mac80211/patches/336-brcmfmac-Simplify-watchdog-sleep.patch
  10050. +++ /dev/null
  10051. @@ -1,157 +0,0 @@
  10052. -From: Hante Meuleman <meuleman@broadcom.com>
  10053. -Date: Fri, 6 Mar 2015 18:40:39 +0100
  10054. -Subject: [PATCH] brcmfmac: Simplify watchdog sleep.
  10055. -
  10056. -The watchdog thread is used to put the SDIO bus to sleep when the
  10057. -system is idling. This patch simplifies the way it is determined
  10058. -when sleep can be entered.
  10059. -
  10060. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10061. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10062. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10063. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  10064. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10065. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10066. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10067. ----
  10068. -
  10069. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10070. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10071. -@@ -485,10 +485,9 @@ struct brcmf_sdio {
  10072. - #endif /* DEBUG */
  10073. -
  10074. - uint clkstate; /* State of sd and backplane clock(s) */
  10075. -- bool activity; /* Activity flag for clock down */
  10076. - s32 idletime; /* Control for activity timeout */
  10077. -- s32 idlecount; /* Activity timeout counter */
  10078. -- s32 idleclock; /* How to set bus driver when idle */
  10079. -+ s32 idlecount; /* Activity timeout counter */
  10080. -+ s32 idleclock; /* How to set bus driver when idle */
  10081. - bool rxflow_mode; /* Rx flow control mode */
  10082. - bool rxflow; /* Is rx flow control on */
  10083. - bool alp_only; /* Don't use HT clock (ALP only) */
  10084. -@@ -511,6 +510,7 @@ struct brcmf_sdio {
  10085. - struct workqueue_struct *brcmf_wq;
  10086. - struct work_struct datawork;
  10087. - atomic_t dpc_tskcnt;
  10088. -+ atomic_t dpc_running;
  10089. -
  10090. - bool txoff; /* Transmit flow-controlled */
  10091. - struct brcmf_sdio_count sdcnt;
  10092. -@@ -959,13 +959,8 @@ static int brcmf_sdio_clkctl(struct brcm
  10093. - brcmf_dbg(SDIO, "Enter\n");
  10094. -
  10095. - /* Early exit if we're already there */
  10096. -- if (bus->clkstate == target) {
  10097. -- if (target == CLK_AVAIL) {
  10098. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  10099. -- bus->activity = true;
  10100. -- }
  10101. -+ if (bus->clkstate == target)
  10102. - return 0;
  10103. -- }
  10104. -
  10105. - switch (target) {
  10106. - case CLK_AVAIL:
  10107. -@@ -975,7 +970,6 @@ static int brcmf_sdio_clkctl(struct brcm
  10108. - /* Now request HT Avail on the backplane */
  10109. - brcmf_sdio_htclk(bus, true, pendok);
  10110. - brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  10111. -- bus->activity = true;
  10112. - break;
  10113. -
  10114. - case CLK_SDONLY:
  10115. -@@ -1024,17 +1018,6 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  10116. -
  10117. - /* Going to sleep */
  10118. - if (sleep) {
  10119. -- /* Don't sleep if something is pending */
  10120. -- if (atomic_read(&bus->intstatus) ||
  10121. -- atomic_read(&bus->ipend) > 0 ||
  10122. -- bus->ctrl_frame_stat ||
  10123. -- (!atomic_read(&bus->fcstate) &&
  10124. -- brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  10125. -- data_ok(bus))) {
  10126. -- err = -EBUSY;
  10127. -- goto done;
  10128. -- }
  10129. --
  10130. - clkcsr = brcmf_sdiod_regrb(bus->sdiodev,
  10131. - SBSDIO_FUNC1_CHIPCLKCSR,
  10132. - &err);
  10133. -@@ -1045,11 +1028,7 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  10134. - SBSDIO_ALP_AVAIL_REQ, &err);
  10135. - }
  10136. - err = brcmf_sdio_kso_control(bus, false);
  10137. -- /* disable watchdog */
  10138. -- if (!err)
  10139. -- brcmf_sdio_wd_timer(bus, 0);
  10140. - } else {
  10141. -- bus->idlecount = 0;
  10142. - err = brcmf_sdio_kso_control(bus, true);
  10143. - }
  10144. - if (err) {
  10145. -@@ -3566,7 +3545,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  10146. - queue_work(bus->brcmf_wq, &bus->datawork);
  10147. - }
  10148. -
  10149. --static bool brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  10150. -+static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  10151. - {
  10152. - brcmf_dbg(TIMER, "Enter\n");
  10153. -
  10154. -@@ -3627,22 +3606,21 @@ static bool brcmf_sdio_bus_watchdog(stru
  10155. - #endif /* DEBUG */
  10156. -
  10157. - /* On idle timeout clear activity flag and/or turn off clock */
  10158. -- if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  10159. -- if (++bus->idlecount >= bus->idletime) {
  10160. -+ if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  10161. -+ (atomic_read(&bus->dpc_running) == 0) &&
  10162. -+ (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  10163. -+ bus->idlecount++;
  10164. -+ if (bus->idlecount > bus->idletime) {
  10165. -+ brcmf_dbg(SDIO, "idle\n");
  10166. -+ sdio_claim_host(bus->sdiodev->func[1]);
  10167. -+ brcmf_sdio_wd_timer(bus, 0);
  10168. - bus->idlecount = 0;
  10169. -- if (bus->activity) {
  10170. -- bus->activity = false;
  10171. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  10172. -- } else {
  10173. -- brcmf_dbg(SDIO, "idle\n");
  10174. -- sdio_claim_host(bus->sdiodev->func[1]);
  10175. -- brcmf_sdio_bus_sleep(bus, true, false);
  10176. -- sdio_release_host(bus->sdiodev->func[1]);
  10177. -- }
  10178. -+ brcmf_sdio_bus_sleep(bus, true, false);
  10179. -+ sdio_release_host(bus->sdiodev->func[1]);
  10180. - }
  10181. -+ } else {
  10182. -+ bus->idlecount = 0;
  10183. - }
  10184. --
  10185. -- return (atomic_read(&bus->ipend) > 0);
  10186. - }
  10187. -
  10188. - static void brcmf_sdio_dataworker(struct work_struct *work)
  10189. -@@ -3651,8 +3629,11 @@ static void brcmf_sdio_dataworker(struct
  10190. - datawork);
  10191. -
  10192. - while (atomic_read(&bus->dpc_tskcnt)) {
  10193. -+ atomic_set(&bus->dpc_running, 1);
  10194. - atomic_set(&bus->dpc_tskcnt, 0);
  10195. - brcmf_sdio_dpc(bus);
  10196. -+ bus->idlecount = 0;
  10197. -+ atomic_set(&bus->dpc_running, 0);
  10198. - }
  10199. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  10200. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  10201. -@@ -4154,6 +4135,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  10202. - }
  10203. - /* Initialize DPC thread */
  10204. - atomic_set(&bus->dpc_tskcnt, 0);
  10205. -+ atomic_set(&bus->dpc_running, 0);
  10206. -
  10207. - /* Assign bus interface call back */
  10208. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  10209. diff --git a/package/kernel/mac80211/patches/337-brcmfmac-Fix-possible-race-condition.patch b/package/kernel/mac80211/patches/337-brcmfmac-Fix-possible-race-condition.patch
  10210. deleted file mode 100644
  10211. index 3a2de7a..0000000
  10212. --- a/package/kernel/mac80211/patches/337-brcmfmac-Fix-possible-race-condition.patch
  10213. +++ /dev/null
  10214. @@ -1,83 +0,0 @@
  10215. -From: Hante Meuleman <meuleman@broadcom.com>
  10216. -Date: Fri, 6 Mar 2015 18:40:40 +0100
  10217. -Subject: [PATCH] brcmfmac: Fix possible race-condition.
  10218. -
  10219. -SDIO is using a "shared" variable to handoff ctl frames to DPC
  10220. -and to see when they are done. In a timeout situation this can
  10221. -lead to erroneous situation where DPC started to handle the ctl
  10222. -frame while the timeout expired. This patch will fix this by
  10223. -adding locking around the shared variable.
  10224. -
  10225. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10226. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10227. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10228. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  10229. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10230. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10231. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10232. ----
  10233. -
  10234. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10235. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10236. -@@ -2700,11 +2700,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  10237. - if (bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL) &&
  10238. - data_ok(bus)) {
  10239. - sdio_claim_host(bus->sdiodev->func[1]);
  10240. -- err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  10241. -- bus->ctrl_frame_len);
  10242. -+ if (bus->ctrl_frame_stat) {
  10243. -+ err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  10244. -+ bus->ctrl_frame_len);
  10245. -+ bus->ctrl_frame_err = err;
  10246. -+ bus->ctrl_frame_stat = false;
  10247. -+ }
  10248. - sdio_release_host(bus->sdiodev->func[1]);
  10249. -- bus->ctrl_frame_err = err;
  10250. -- bus->ctrl_frame_stat = false;
  10251. - brcmf_sdio_wait_event_wakeup(bus);
  10252. - }
  10253. - /* Send queued frames (limit 1 if rx may still be pending) */
  10254. -@@ -2720,9 +2722,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  10255. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  10256. - atomic_set(&bus->intstatus, 0);
  10257. - if (bus->ctrl_frame_stat) {
  10258. -- bus->ctrl_frame_err = -ENODEV;
  10259. -- bus->ctrl_frame_stat = false;
  10260. -- brcmf_sdio_wait_event_wakeup(bus);
  10261. -+ sdio_claim_host(bus->sdiodev->func[1]);
  10262. -+ if (bus->ctrl_frame_stat) {
  10263. -+ bus->ctrl_frame_err = -ENODEV;
  10264. -+ bus->ctrl_frame_stat = false;
  10265. -+ brcmf_sdio_wait_event_wakeup(bus);
  10266. -+ }
  10267. -+ sdio_release_host(bus->sdiodev->func[1]);
  10268. - }
  10269. - } else if (atomic_read(&bus->intstatus) ||
  10270. - atomic_read(&bus->ipend) > 0 ||
  10271. -@@ -2930,15 +2936,20 @@ brcmf_sdio_bus_txctl(struct device *dev,
  10272. - brcmf_sdio_trigger_dpc(bus);
  10273. - wait_event_interruptible_timeout(bus->ctrl_wait, !bus->ctrl_frame_stat,
  10274. - msecs_to_jiffies(CTL_DONE_TIMEOUT));
  10275. --
  10276. -- if (!bus->ctrl_frame_stat) {
  10277. -+ ret = 0;
  10278. -+ if (bus->ctrl_frame_stat) {
  10279. -+ sdio_claim_host(bus->sdiodev->func[1]);
  10280. -+ if (bus->ctrl_frame_stat) {
  10281. -+ brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  10282. -+ bus->ctrl_frame_stat = false;
  10283. -+ ret = -ETIMEDOUT;
  10284. -+ }
  10285. -+ sdio_release_host(bus->sdiodev->func[1]);
  10286. -+ }
  10287. -+ if (!ret) {
  10288. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  10289. - bus->ctrl_frame_err);
  10290. - ret = bus->ctrl_frame_err;
  10291. -- } else {
  10292. -- brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  10293. -- bus->ctrl_frame_stat = false;
  10294. -- ret = -ETIMEDOUT;
  10295. - }
  10296. -
  10297. - if (ret)
  10298. diff --git a/package/kernel/mac80211/patches/338-brcmfmac-Add-support-for-BCM4345-SDIO-chipset.patch b/package/kernel/mac80211/patches/338-brcmfmac-Add-support-for-BCM4345-SDIO-chipset.patch
  10299. deleted file mode 100644
  10300. index c9eb900..0000000
  10301. --- a/package/kernel/mac80211/patches/338-brcmfmac-Add-support-for-BCM4345-SDIO-chipset.patch
  10302. +++ /dev/null
  10303. @@ -1,86 +0,0 @@
  10304. -From: Syed Asifful Dayyan <syedd@broadcom.com>
  10305. -Date: Fri, 6 Mar 2015 18:40:42 +0100
  10306. -Subject: [PATCH] brcmfmac: Add support for BCM4345 SDIO chipset.
  10307. -
  10308. -These changes add support for BCM4345 SDIO chipset.
  10309. -
  10310. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10311. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10312. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10313. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  10314. -Signed-off-by: Syed Asifful Dayyan <syedd@broadcom.com>
  10315. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10316. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10317. ----
  10318. -
  10319. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  10320. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  10321. -@@ -1096,6 +1096,7 @@ static const struct sdio_device_id brcmf
  10322. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  10323. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  10324. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  10325. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  10326. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  10327. - { /* end: all zeroes */ }
  10328. - };
  10329. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  10330. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  10331. -@@ -491,6 +491,10 @@ static void brcmf_chip_get_raminfo(struc
  10332. - case BRCM_CC_43362_CHIP_ID:
  10333. - ci->pub.ramsize = 0x3c000;
  10334. - break;
  10335. -+ case BRCM_CC_4345_CHIP_ID:
  10336. -+ ci->pub.ramsize = 0xc8000;
  10337. -+ ci->pub.rambase = 0x198000;
  10338. -+ break;
  10339. - case BRCM_CC_4339_CHIP_ID:
  10340. - case BRCM_CC_4354_CHIP_ID:
  10341. - case BRCM_CC_4356_CHIP_ID:
  10342. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10343. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10344. -@@ -617,6 +617,8 @@ static const struct sdiod_drive_str sdio
  10345. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  10346. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  10347. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  10348. -+#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  10349. -+#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  10350. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  10351. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  10352. -
  10353. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  10354. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  10355. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  10356. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  10357. -+MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  10358. -+MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  10359. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  10360. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  10361. -
  10362. -@@ -669,6 +673,7 @@ static const struct brcmf_firmware_names
  10363. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  10364. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  10365. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  10366. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  10367. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  10368. - };
  10369. -
  10370. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  10371. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  10372. -@@ -37,6 +37,7 @@
  10373. - #define BRCM_CC_43362_CHIP_ID 43362
  10374. - #define BRCM_CC_4335_CHIP_ID 0x4335
  10375. - #define BRCM_CC_4339_CHIP_ID 0x4339
  10376. -+#define BRCM_CC_4345_CHIP_ID 0x4345
  10377. - #define BRCM_CC_4354_CHIP_ID 0x4354
  10378. - #define BRCM_CC_4356_CHIP_ID 0x4356
  10379. - #define BRCM_CC_43566_CHIP_ID 43566
  10380. ---- a/include/linux/mmc/sdio_ids.h
  10381. -+++ b/include/linux/mmc/sdio_ids.h
  10382. -@@ -33,6 +33,7 @@
  10383. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  10384. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  10385. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  10386. -+#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  10387. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  10388. -
  10389. - #define SDIO_VENDOR_ID_INTEL 0x0089
  10390. diff --git a/package/kernel/mac80211/patches/339-brcmfmac-remove-duplication-of-ramsize-info.patch b/package/kernel/mac80211/patches/339-brcmfmac-remove-duplication-of-ramsize-info.patch
  10391. deleted file mode 100644
  10392. index 7a688c4..0000000
  10393. --- a/package/kernel/mac80211/patches/339-brcmfmac-remove-duplication-of-ramsize-info.patch
  10394. +++ /dev/null
  10395. @@ -1,48 +0,0 @@
  10396. -From: Arend van Spriel <arend@broadcom.com>
  10397. -Date: Wed, 11 Mar 2015 16:11:27 +0100
  10398. -Subject: [PATCH] brcmfmac: remove duplication of ramsize info
  10399. -
  10400. -Removing the ramsize from the brcmf_sdio structure to avoid
  10401. -duplication. The information is available in brcmf_chip
  10402. -structure.
  10403. -
  10404. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10405. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10406. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10407. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10408. ----
  10409. -
  10410. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10411. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10412. -@@ -432,8 +432,6 @@ struct brcmf_sdio {
  10413. - struct brcmf_sdio_dev *sdiodev; /* sdio device handler */
  10414. - struct brcmf_chip *ci; /* Chip info struct */
  10415. -
  10416. -- u32 ramsize; /* Size of RAM in SOCRAM (bytes) */
  10417. --
  10418. - u32 hostintmask; /* Copy of Host Interrupt Mask */
  10419. - atomic_t intstatus; /* Intstatus bits (events) pending */
  10420. - atomic_t fcstate; /* State of dongle flow-control */
  10421. -@@ -1075,7 +1073,7 @@ static int brcmf_sdio_readshared(struct
  10422. - struct sdpcm_shared_le sh_le;
  10423. - __le32 addr_le;
  10424. -
  10425. -- shaddr = bus->ci->rambase + bus->ramsize - 4;
  10426. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  10427. -
  10428. - /*
  10429. - * Read last word in socram to determine
  10430. -@@ -3871,13 +3869,6 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  10431. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  10432. - brcmf_sdio_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength);
  10433. -
  10434. -- /* Get info on the SOCRAM cores... */
  10435. -- bus->ramsize = bus->ci->ramsize;
  10436. -- if (!(bus->ramsize)) {
  10437. -- brcmf_err("failed to find SOCRAM memory!\n");
  10438. -- goto fail;
  10439. -- }
  10440. --
  10441. - /* Set card control so an SDIO card reset does a WLAN backplane reset */
  10442. - reg_val = brcmf_sdiod_regrb(bus->sdiodev,
  10443. - SDIO_CCCR_BRCM_CARDCTRL, &err);
  10444. diff --git a/package/kernel/mac80211/patches/340-brcmfmac-always-perform-cores-checks.patch b/package/kernel/mac80211/patches/340-brcmfmac-always-perform-cores-checks.patch
  10445. deleted file mode 100644
  10446. index e2a2074..0000000
  10447. --- a/package/kernel/mac80211/patches/340-brcmfmac-always-perform-cores-checks.patch
  10448. +++ /dev/null
  10449. @@ -1,74 +0,0 @@
  10450. -From: Arend van Spriel <arend@broadcom.com>
  10451. -Date: Wed, 11 Mar 2015 16:11:28 +0100
  10452. -Subject: [PATCH] brcmfmac: always perform cores checks
  10453. -
  10454. -Instead of checking the cores in the chip only if CONFIG_BRCMDBG
  10455. -is selected perform the check always and extend it with more sanity
  10456. -checking.
  10457. -
  10458. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10459. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10460. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10461. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10462. ----
  10463. -
  10464. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  10465. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  10466. -@@ -419,13 +419,13 @@ static struct brcmf_core *brcmf_chip_add
  10467. - return &core->pub;
  10468. - }
  10469. -
  10470. --#ifdef DEBUG
  10471. - /* safety check for chipinfo */
  10472. - static int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  10473. - {
  10474. - struct brcmf_core_priv *core;
  10475. - bool need_socram = false;
  10476. - bool has_socram = false;
  10477. -+ bool cpu_found = false;
  10478. - int idx = 1;
  10479. -
  10480. - list_for_each_entry(core, &ci->cores, list) {
  10481. -@@ -435,12 +435,14 @@ static int brcmf_chip_cores_check(struct
  10482. -
  10483. - switch (core->pub.id) {
  10484. - case BCMA_CORE_ARM_CM3:
  10485. -+ cpu_found = true;
  10486. - need_socram = true;
  10487. - break;
  10488. - case BCMA_CORE_INTERNAL_MEM:
  10489. - has_socram = true;
  10490. - break;
  10491. - case BCMA_CORE_ARM_CR4:
  10492. -+ cpu_found = true;
  10493. - if (ci->pub.rambase == 0) {
  10494. - brcmf_err("RAM base not provided with ARM CR4 core\n");
  10495. - return -ENOMEM;
  10496. -@@ -451,19 +453,21 @@ static int brcmf_chip_cores_check(struct
  10497. - }
  10498. - }
  10499. -
  10500. -+ if (!cpu_found) {
  10501. -+ brcmf_err("CPU core not detected\n");
  10502. -+ return -ENXIO;
  10503. -+ }
  10504. - /* check RAM core presence for ARM CM3 core */
  10505. - if (need_socram && !has_socram) {
  10506. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  10507. - return -ENODEV;
  10508. - }
  10509. -+ if (!ci->pub.ramsize) {
  10510. -+ brcmf_err("RAM size is undetermined\n");
  10511. -+ return -ENOMEM;
  10512. -+ }
  10513. - return 0;
  10514. - }
  10515. --#else /* DEBUG */
  10516. --static inline int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  10517. --{
  10518. -- return 0;
  10519. --}
  10520. --#endif
  10521. -
  10522. - static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  10523. - {
  10524. diff --git a/package/kernel/mac80211/patches/341-brcmfmac-rename-chip-download-functions.patch b/package/kernel/mac80211/patches/341-brcmfmac-rename-chip-download-functions.patch
  10525. deleted file mode 100644
  10526. index a272800..0000000
  10527. --- a/package/kernel/mac80211/patches/341-brcmfmac-rename-chip-download-functions.patch
  10528. +++ /dev/null
  10529. @@ -1,240 +0,0 @@
  10530. -From: Arend van Spriel <arend@broadcom.com>
  10531. -Date: Wed, 11 Mar 2015 16:11:29 +0100
  10532. -Subject: [PATCH] brcmfmac: rename chip download functions
  10533. -
  10534. -The functions brcmf_chip_[enter/exit]_download() are not exclusively
  10535. -used for firmware download so rename these more appropriate.
  10536. -
  10537. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10538. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10539. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10540. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10541. ----
  10542. -
  10543. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  10544. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  10545. -@@ -807,7 +807,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  10546. - err = -EINVAL;
  10547. - if (WARN_ON(!ops->prepare))
  10548. - err = -EINVAL;
  10549. -- if (WARN_ON(!ops->exit_dl))
  10550. -+ if (WARN_ON(!ops->activate))
  10551. - err = -EINVAL;
  10552. - if (err < 0)
  10553. - return ERR_PTR(-EINVAL);
  10554. -@@ -905,7 +905,7 @@ void brcmf_chip_resetcore(struct brcmf_c
  10555. - }
  10556. -
  10557. - static void
  10558. --brcmf_chip_cm3_enterdl(struct brcmf_chip_priv *chip)
  10559. -+brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  10560. - {
  10561. - struct brcmf_core *core;
  10562. -
  10563. -@@ -919,7 +919,7 @@ brcmf_chip_cm3_enterdl(struct brcmf_chip
  10564. - brcmf_chip_resetcore(core, 0, 0, 0);
  10565. - }
  10566. -
  10567. --static bool brcmf_chip_cm3_exitdl(struct brcmf_chip_priv *chip)
  10568. -+static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  10569. - {
  10570. - struct brcmf_core *core;
  10571. -
  10572. -@@ -929,7 +929,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  10573. - return false;
  10574. - }
  10575. -
  10576. -- chip->ops->exit_dl(chip->ctx, &chip->pub, 0);
  10577. -+ chip->ops->activate(chip->ctx, &chip->pub, 0);
  10578. -
  10579. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CM3);
  10580. - brcmf_chip_resetcore(core, 0, 0, 0);
  10581. -@@ -938,7 +938,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  10582. - }
  10583. -
  10584. - static inline void
  10585. --brcmf_chip_cr4_enterdl(struct brcmf_chip_priv *chip)
  10586. -+brcmf_chip_cr4_set_passive(struct brcmf_chip_priv *chip)
  10587. - {
  10588. - struct brcmf_core *core;
  10589. -
  10590. -@@ -951,11 +951,11 @@ brcmf_chip_cr4_enterdl(struct brcmf_chip
  10591. - D11_BCMA_IOCTL_PHYCLOCKEN);
  10592. - }
  10593. -
  10594. --static bool brcmf_chip_cr4_exitdl(struct brcmf_chip_priv *chip, u32 rstvec)
  10595. -+static bool brcmf_chip_cr4_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
  10596. - {
  10597. - struct brcmf_core *core;
  10598. -
  10599. -- chip->ops->exit_dl(chip->ctx, &chip->pub, rstvec);
  10600. -+ chip->ops->activate(chip->ctx, &chip->pub, rstvec);
  10601. -
  10602. - /* restore ARM */
  10603. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CR4);
  10604. -@@ -964,7 +964,7 @@ static bool brcmf_chip_cr4_exitdl(struct
  10605. - return true;
  10606. - }
  10607. -
  10608. --void brcmf_chip_enter_download(struct brcmf_chip *pub)
  10609. -+void brcmf_chip_set_passive(struct brcmf_chip *pub)
  10610. - {
  10611. - struct brcmf_chip_priv *chip;
  10612. - struct brcmf_core *arm;
  10613. -@@ -974,14 +974,14 @@ void brcmf_chip_enter_download(struct br
  10614. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  10615. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  10616. - if (arm) {
  10617. -- brcmf_chip_cr4_enterdl(chip);
  10618. -+ brcmf_chip_cr4_set_passive(chip);
  10619. - return;
  10620. - }
  10621. -
  10622. -- brcmf_chip_cm3_enterdl(chip);
  10623. -+ brcmf_chip_cm3_set_passive(chip);
  10624. - }
  10625. -
  10626. --bool brcmf_chip_exit_download(struct brcmf_chip *pub, u32 rstvec)
  10627. -+bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
  10628. - {
  10629. - struct brcmf_chip_priv *chip;
  10630. - struct brcmf_core *arm;
  10631. -@@ -991,9 +991,9 @@ bool brcmf_chip_exit_download(struct brc
  10632. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  10633. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  10634. - if (arm)
  10635. -- return brcmf_chip_cr4_exitdl(chip, rstvec);
  10636. -+ return brcmf_chip_cr4_set_active(chip, rstvec);
  10637. -
  10638. -- return brcmf_chip_cm3_exitdl(chip);
  10639. -+ return brcmf_chip_cm3_set_active(chip);
  10640. - }
  10641. -
  10642. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
  10643. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  10644. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  10645. -@@ -64,7 +64,7 @@ struct brcmf_core {
  10646. - * @write32: write 32-bit value over bus.
  10647. - * @prepare: prepare bus for core configuration.
  10648. - * @setup: bus-specific core setup.
  10649. -- * @exit_dl: exit download state.
  10650. -+ * @active: chip becomes active.
  10651. - * The callback should use the provided @rstvec when non-zero.
  10652. - */
  10653. - struct brcmf_buscore_ops {
  10654. -@@ -72,7 +72,7 @@ struct brcmf_buscore_ops {
  10655. - void (*write32)(void *ctx, u32 addr, u32 value);
  10656. - int (*prepare)(void *ctx);
  10657. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  10658. -- void (*exit_dl)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  10659. -+ void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  10660. - };
  10661. -
  10662. - struct brcmf_chip *brcmf_chip_attach(void *ctx,
  10663. -@@ -84,8 +84,8 @@ bool brcmf_chip_iscoreup(struct brcmf_co
  10664. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  10665. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  10666. - u32 postreset);
  10667. --void brcmf_chip_enter_download(struct brcmf_chip *ci);
  10668. --bool brcmf_chip_exit_download(struct brcmf_chip *ci, u32 rstvec);
  10669. -+void brcmf_chip_set_passive(struct brcmf_chip *ci);
  10670. -+bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec);
  10671. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub);
  10672. -
  10673. - #endif /* BRCMF_AXIDMP_H */
  10674. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  10675. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  10676. -@@ -509,7 +509,7 @@ static void brcmf_pcie_attach(struct brc
  10677. -
  10678. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  10679. - {
  10680. -- brcmf_chip_enter_download(devinfo->ci);
  10681. -+ brcmf_chip_set_passive(devinfo->ci);
  10682. -
  10683. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  10684. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  10685. -@@ -536,7 +536,7 @@ static int brcmf_pcie_exit_download_stat
  10686. - brcmf_chip_resetcore(core, 0, 0, 0);
  10687. - }
  10688. -
  10689. -- return !brcmf_chip_exit_download(devinfo->ci, resetintr);
  10690. -+ return !brcmf_chip_set_active(devinfo->ci, resetintr);
  10691. - }
  10692. -
  10693. -
  10694. -@@ -1566,8 +1566,8 @@ static int brcmf_pcie_buscoreprep(void *
  10695. - }
  10696. -
  10697. -
  10698. --static void brcmf_pcie_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  10699. -- u32 rstvec)
  10700. -+static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  10701. -+ u32 rstvec)
  10702. - {
  10703. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  10704. -
  10705. -@@ -1577,7 +1577,7 @@ static void brcmf_pcie_buscore_exitdl(vo
  10706. -
  10707. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  10708. - .prepare = brcmf_pcie_buscoreprep,
  10709. -- .exit_dl = brcmf_pcie_buscore_exitdl,
  10710. -+ .activate = brcmf_pcie_buscore_activate,
  10711. - .read32 = brcmf_pcie_buscore_read32,
  10712. - .write32 = brcmf_pcie_buscore_write32,
  10713. - };
  10714. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10715. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10716. -@@ -3357,7 +3357,7 @@ static int brcmf_sdio_download_firmware(
  10717. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  10718. -
  10719. - /* Keep arm in reset */
  10720. -- brcmf_chip_enter_download(bus->ci);
  10721. -+ brcmf_chip_set_passive(bus->ci);
  10722. -
  10723. - rstvec = get_unaligned_le32(fw->data);
  10724. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  10725. -@@ -3378,7 +3378,7 @@ static int brcmf_sdio_download_firmware(
  10726. - }
  10727. -
  10728. - /* Take arm out of reset */
  10729. -- if (!brcmf_chip_exit_download(bus->ci, rstvec)) {
  10730. -+ if (!brcmf_chip_set_active(bus->ci, rstvec)) {
  10731. - brcmf_err("error getting out of ARM core reset\n");
  10732. - goto err;
  10733. - }
  10734. -@@ -3771,8 +3771,8 @@ static int brcmf_sdio_buscoreprep(void *
  10735. - return 0;
  10736. - }
  10737. -
  10738. --static void brcmf_sdio_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  10739. -- u32 rstvec)
  10740. -+static void brcmf_sdio_buscore_activate(void *ctx, struct brcmf_chip *chip,
  10741. -+ u32 rstvec)
  10742. - {
  10743. - struct brcmf_sdio_dev *sdiodev = ctx;
  10744. - struct brcmf_core *core;
  10745. -@@ -3815,7 +3815,7 @@ static void brcmf_sdio_buscore_write32(v
  10746. -
  10747. - static const struct brcmf_buscore_ops brcmf_sdio_buscore_ops = {
  10748. - .prepare = brcmf_sdio_buscoreprep,
  10749. -- .exit_dl = brcmf_sdio_buscore_exitdl,
  10750. -+ .activate = brcmf_sdio_buscore_activate,
  10751. - .read32 = brcmf_sdio_buscore_read32,
  10752. - .write32 = brcmf_sdio_buscore_write32,
  10753. - };
  10754. -@@ -4239,12 +4239,11 @@ void brcmf_sdio_remove(struct brcmf_sdio
  10755. - sdio_claim_host(bus->sdiodev->func[1]);
  10756. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  10757. - /* Leave the device in state where it is
  10758. -- * 'quiet'. This is done by putting it in
  10759. -- * download_state which essentially resets
  10760. -- * all necessary cores.
  10761. -+ * 'passive'. This is done by resetting all
  10762. -+ * necessary cores.
  10763. - */
  10764. - msleep(20);
  10765. -- brcmf_chip_enter_download(bus->ci);
  10766. -+ brcmf_chip_set_passive(bus->ci);
  10767. - brcmf_sdio_clkctl(bus, CLK_NONE, false);
  10768. - sdio_release_host(bus->sdiodev->func[1]);
  10769. - }
  10770. diff --git a/package/kernel/mac80211/patches/342-brcmfmac-assure-device-is-ready-for-download-after-b.patch b/package/kernel/mac80211/patches/342-brcmfmac-assure-device-is-ready-for-download-after-b.patch
  10771. deleted file mode 100644
  10772. index 6b1dd81..0000000
  10773. --- a/package/kernel/mac80211/patches/342-brcmfmac-assure-device-is-ready-for-download-after-b.patch
  10774. +++ /dev/null
  10775. @@ -1,61 +0,0 @@
  10776. -From: Arend van Spriel <arend@broadcom.com>
  10777. -Date: Wed, 11 Mar 2015 16:11:30 +0100
  10778. -Subject: [PATCH] brcmfmac: assure device is ready for download after
  10779. - brcmf_chip_attach()
  10780. -
  10781. -Make the brcmf_chip_attach() function responsible for putting the
  10782. -device in a state where it is accessible for firmware download.
  10783. -
  10784. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10785. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10786. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10787. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10788. ----
  10789. -
  10790. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  10791. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  10792. -@@ -786,12 +786,6 @@ static int brcmf_chip_setup(struct brcmf
  10793. - if (chip->ops->setup)
  10794. - ret = chip->ops->setup(chip->ctx, pub);
  10795. -
  10796. -- /*
  10797. -- * Make sure any on-chip ARM is off (in case strapping is wrong),
  10798. -- * or downloaded code was already running.
  10799. -- */
  10800. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  10801. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CR4);
  10802. - return ret;
  10803. - }
  10804. -
  10805. -@@ -833,6 +827,8 @@ struct brcmf_chip *brcmf_chip_attach(voi
  10806. - if (err < 0)
  10807. - goto fail;
  10808. -
  10809. -+ /* assure chip is passive for download */
  10810. -+ brcmf_chip_set_passive(&chip->pub);
  10811. - return &chip->pub;
  10812. -
  10813. - fail:
  10814. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  10815. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  10816. -@@ -509,8 +509,6 @@ static void brcmf_pcie_attach(struct brc
  10817. -
  10818. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  10819. - {
  10820. -- brcmf_chip_set_passive(devinfo->ci);
  10821. --
  10822. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  10823. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  10824. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_ARMCR4REG_BANKIDX,
  10825. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10826. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  10827. -@@ -3356,9 +3356,6 @@ static int brcmf_sdio_download_firmware(
  10828. - sdio_claim_host(bus->sdiodev->func[1]);
  10829. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  10830. -
  10831. -- /* Keep arm in reset */
  10832. -- brcmf_chip_set_passive(bus->ci);
  10833. --
  10834. - rstvec = get_unaligned_le32(fw->data);
  10835. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  10836. -
  10837. diff --git a/package/kernel/mac80211/patches/343-brcmfmac-extract-ram-size-info-from-internal-memory-.patch b/package/kernel/mac80211/patches/343-brcmfmac-extract-ram-size-info-from-internal-memory-.patch
  10838. deleted file mode 100644
  10839. index bcc2ed4..0000000
  10840. --- a/package/kernel/mac80211/patches/343-brcmfmac-extract-ram-size-info-from-internal-memory-.patch
  10841. +++ /dev/null
  10842. @@ -1,367 +0,0 @@
  10843. -From: Arend van Spriel <arend@broadcom.com>
  10844. -Date: Wed, 11 Mar 2015 16:11:31 +0100
  10845. -Subject: [PATCH] brcmfmac: extract ram size info from internal memory
  10846. - registers
  10847. -
  10848. -Instead of hard-coded memory sizes it is possible to obtain that
  10849. -information from the internal memory registers.
  10850. -
  10851. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10852. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10853. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10854. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10855. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10856. ----
  10857. -
  10858. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  10859. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  10860. -@@ -100,9 +100,6 @@
  10861. - #define BCM4329_CORE_SOCRAM_BASE 0x18003000
  10862. - /* ARM Cortex M3 core, ID 0x82a */
  10863. - #define BCM4329_CORE_ARM_BASE 0x18002000
  10864. --#define BCM4329_RAMSIZE 0x48000
  10865. --/* bcm43143 */
  10866. --#define BCM43143_RAMSIZE 0x70000
  10867. -
  10868. - #define CORE_SB(base, field) \
  10869. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  10870. -@@ -150,6 +147,78 @@ struct sbconfig {
  10871. - u32 sbidhigh; /* identification */
  10872. - };
  10873. -
  10874. -+/* bankidx and bankinfo reg defines corerev >= 8 */
  10875. -+#define SOCRAM_BANKINFO_RETNTRAM_MASK 0x00010000
  10876. -+#define SOCRAM_BANKINFO_SZMASK 0x0000007f
  10877. -+#define SOCRAM_BANKIDX_ROM_MASK 0x00000100
  10878. -+
  10879. -+#define SOCRAM_BANKIDX_MEMTYPE_SHIFT 8
  10880. -+/* socram bankinfo memtype */
  10881. -+#define SOCRAM_MEMTYPE_RAM 0
  10882. -+#define SOCRAM_MEMTYPE_R0M 1
  10883. -+#define SOCRAM_MEMTYPE_DEVRAM 2
  10884. -+
  10885. -+#define SOCRAM_BANKINFO_SZBASE 8192
  10886. -+#define SRCI_LSS_MASK 0x00f00000
  10887. -+#define SRCI_LSS_SHIFT 20
  10888. -+#define SRCI_SRNB_MASK 0xf0
  10889. -+#define SRCI_SRNB_SHIFT 4
  10890. -+#define SRCI_SRBSZ_MASK 0xf
  10891. -+#define SRCI_SRBSZ_SHIFT 0
  10892. -+#define SR_BSZ_BASE 14
  10893. -+
  10894. -+struct sbsocramregs {
  10895. -+ u32 coreinfo;
  10896. -+ u32 bwalloc;
  10897. -+ u32 extracoreinfo;
  10898. -+ u32 biststat;
  10899. -+ u32 bankidx;
  10900. -+ u32 standbyctrl;
  10901. -+
  10902. -+ u32 errlogstatus; /* rev 6 */
  10903. -+ u32 errlogaddr; /* rev 6 */
  10904. -+ /* used for patching rev 3 & 5 */
  10905. -+ u32 cambankidx;
  10906. -+ u32 cambankstandbyctrl;
  10907. -+ u32 cambankpatchctrl;
  10908. -+ u32 cambankpatchtblbaseaddr;
  10909. -+ u32 cambankcmdreg;
  10910. -+ u32 cambankdatareg;
  10911. -+ u32 cambankmaskreg;
  10912. -+ u32 PAD[1];
  10913. -+ u32 bankinfo; /* corev 8 */
  10914. -+ u32 bankpda;
  10915. -+ u32 PAD[14];
  10916. -+ u32 extmemconfig;
  10917. -+ u32 extmemparitycsr;
  10918. -+ u32 extmemparityerrdata;
  10919. -+ u32 extmemparityerrcnt;
  10920. -+ u32 extmemwrctrlandsize;
  10921. -+ u32 PAD[84];
  10922. -+ u32 workaround;
  10923. -+ u32 pwrctl; /* corerev >= 2 */
  10924. -+ u32 PAD[133];
  10925. -+ u32 sr_control; /* corerev >= 15 */
  10926. -+ u32 sr_status; /* corerev >= 15 */
  10927. -+ u32 sr_address; /* corerev >= 15 */
  10928. -+ u32 sr_data; /* corerev >= 15 */
  10929. -+};
  10930. -+
  10931. -+#define SOCRAMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  10932. -+
  10933. -+#define ARMCR4_CAP (0x04)
  10934. -+#define ARMCR4_BANKIDX (0x40)
  10935. -+#define ARMCR4_BANKINFO (0x44)
  10936. -+#define ARMCR4_BANKPDA (0x4C)
  10937. -+
  10938. -+#define ARMCR4_TCBBNB_MASK 0xf0
  10939. -+#define ARMCR4_TCBBNB_SHIFT 4
  10940. -+#define ARMCR4_TCBANB_MASK 0xf
  10941. -+#define ARMCR4_TCBANB_SHIFT 0
  10942. -+
  10943. -+#define ARMCR4_BSZ_MASK 0x3f
  10944. -+#define ARMCR4_BSZ_MULT 8192
  10945. -+
  10946. - struct brcmf_core_priv {
  10947. - struct brcmf_core pub;
  10948. - u32 wrapbase;
  10949. -@@ -443,10 +512,6 @@ static int brcmf_chip_cores_check(struct
  10950. - break;
  10951. - case BCMA_CORE_ARM_CR4:
  10952. - cpu_found = true;
  10953. -- if (ci->pub.rambase == 0) {
  10954. -- brcmf_err("RAM base not provided with ARM CR4 core\n");
  10955. -- return -ENOMEM;
  10956. -- }
  10957. - break;
  10958. - default:
  10959. - break;
  10960. -@@ -462,60 +527,160 @@ static int brcmf_chip_cores_check(struct
  10961. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  10962. - return -ENODEV;
  10963. - }
  10964. -- if (!ci->pub.ramsize) {
  10965. -- brcmf_err("RAM size is undetermined\n");
  10966. -- return -ENOMEM;
  10967. -- }
  10968. - return 0;
  10969. - }
  10970. -
  10971. --static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  10972. -+static u32 brcmf_chip_core_read32(struct brcmf_core_priv *core, u16 reg)
  10973. - {
  10974. -- switch (ci->pub.chip) {
  10975. -- case BRCM_CC_4329_CHIP_ID:
  10976. -- ci->pub.ramsize = BCM4329_RAMSIZE;
  10977. -- break;
  10978. -- case BRCM_CC_43143_CHIP_ID:
  10979. -- ci->pub.ramsize = BCM43143_RAMSIZE;
  10980. -- break;
  10981. -- case BRCM_CC_43241_CHIP_ID:
  10982. -- ci->pub.ramsize = 0x90000;
  10983. -- break;
  10984. -- case BRCM_CC_4330_CHIP_ID:
  10985. -- ci->pub.ramsize = 0x48000;
  10986. -- break;
  10987. -+ return core->chip->ops->read32(core->chip->ctx, core->pub.base + reg);
  10988. -+}
  10989. -+
  10990. -+static void brcmf_chip_core_write32(struct brcmf_core_priv *core,
  10991. -+ u16 reg, u32 val)
  10992. -+{
  10993. -+ core->chip->ops->write32(core->chip->ctx, core->pub.base + reg, val);
  10994. -+}
  10995. -+
  10996. -+static bool brcmf_chip_socram_banksize(struct brcmf_core_priv *core, u8 idx,
  10997. -+ u32 *banksize)
  10998. -+{
  10999. -+ u32 bankinfo;
  11000. -+ u32 bankidx = (SOCRAM_MEMTYPE_RAM << SOCRAM_BANKIDX_MEMTYPE_SHIFT);
  11001. -+
  11002. -+ bankidx |= idx;
  11003. -+ brcmf_chip_core_write32(core, SOCRAMREGOFFS(bankidx), bankidx);
  11004. -+ bankinfo = brcmf_chip_core_read32(core, SOCRAMREGOFFS(bankinfo));
  11005. -+ *banksize = (bankinfo & SOCRAM_BANKINFO_SZMASK) + 1;
  11006. -+ *banksize *= SOCRAM_BANKINFO_SZBASE;
  11007. -+ return !!(bankinfo & SOCRAM_BANKINFO_RETNTRAM_MASK);
  11008. -+}
  11009. -+
  11010. -+static void brcmf_chip_socram_ramsize(struct brcmf_core_priv *sr, u32 *ramsize,
  11011. -+ u32 *srsize)
  11012. -+{
  11013. -+ u32 coreinfo;
  11014. -+ uint nb, banksize, lss;
  11015. -+ bool retent;
  11016. -+ int i;
  11017. -+
  11018. -+ *ramsize = 0;
  11019. -+ *srsize = 0;
  11020. -+
  11021. -+ if (WARN_ON(sr->pub.rev < 4))
  11022. -+ return;
  11023. -+
  11024. -+ if (!brcmf_chip_iscoreup(&sr->pub))
  11025. -+ brcmf_chip_resetcore(&sr->pub, 0, 0, 0);
  11026. -+
  11027. -+ /* Get info for determining size */
  11028. -+ coreinfo = brcmf_chip_core_read32(sr, SOCRAMREGOFFS(coreinfo));
  11029. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  11030. -+
  11031. -+ if ((sr->pub.rev <= 7) || (sr->pub.rev == 12)) {
  11032. -+ banksize = (coreinfo & SRCI_SRBSZ_MASK);
  11033. -+ lss = (coreinfo & SRCI_LSS_MASK) >> SRCI_LSS_SHIFT;
  11034. -+ if (lss != 0)
  11035. -+ nb--;
  11036. -+ *ramsize = nb * (1 << (banksize + SR_BSZ_BASE));
  11037. -+ if (lss != 0)
  11038. -+ *ramsize += (1 << ((lss - 1) + SR_BSZ_BASE));
  11039. -+ } else {
  11040. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  11041. -+ for (i = 0; i < nb; i++) {
  11042. -+ retent = brcmf_chip_socram_banksize(sr, i, &banksize);
  11043. -+ *ramsize += banksize;
  11044. -+ if (retent)
  11045. -+ *srsize += banksize;
  11046. -+ }
  11047. -+ }
  11048. -+
  11049. -+ /* hardcoded save&restore memory sizes */
  11050. -+ switch (sr->chip->pub.chip) {
  11051. - case BRCM_CC_4334_CHIP_ID:
  11052. -- case BRCM_CC_43340_CHIP_ID:
  11053. -- ci->pub.ramsize = 0x80000;
  11054. -+ if (sr->chip->pub.chiprev < 2)
  11055. -+ *srsize = (32 * 1024);
  11056. - break;
  11057. -- case BRCM_CC_4335_CHIP_ID:
  11058. -- ci->pub.ramsize = 0xc0000;
  11059. -- ci->pub.rambase = 0x180000;
  11060. -- break;
  11061. -- case BRCM_CC_43362_CHIP_ID:
  11062. -- ci->pub.ramsize = 0x3c000;
  11063. -+ default:
  11064. - break;
  11065. -+ }
  11066. -+}
  11067. -+
  11068. -+/** Return the TCM-RAM size of the ARMCR4 core. */
  11069. -+static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
  11070. -+{
  11071. -+ u32 corecap;
  11072. -+ u32 memsize = 0;
  11073. -+ u32 nab;
  11074. -+ u32 nbb;
  11075. -+ u32 totb;
  11076. -+ u32 bxinfo;
  11077. -+ u32 idx;
  11078. -+
  11079. -+ corecap = brcmf_chip_core_read32(cr4, ARMCR4_CAP);
  11080. -+
  11081. -+ nab = (corecap & ARMCR4_TCBANB_MASK) >> ARMCR4_TCBANB_SHIFT;
  11082. -+ nbb = (corecap & ARMCR4_TCBBNB_MASK) >> ARMCR4_TCBBNB_SHIFT;
  11083. -+ totb = nab + nbb;
  11084. -+
  11085. -+ for (idx = 0; idx < totb; idx++) {
  11086. -+ brcmf_chip_core_write32(cr4, ARMCR4_BANKIDX, idx);
  11087. -+ bxinfo = brcmf_chip_core_read32(cr4, ARMCR4_BANKINFO);
  11088. -+ memsize += ((bxinfo & ARMCR4_BSZ_MASK) + 1) * ARMCR4_BSZ_MULT;
  11089. -+ }
  11090. -+
  11091. -+ return memsize;
  11092. -+}
  11093. -+
  11094. -+static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
  11095. -+{
  11096. -+ switch (ci->pub.chip) {
  11097. - case BRCM_CC_4345_CHIP_ID:
  11098. -- ci->pub.ramsize = 0xc8000;
  11099. -- ci->pub.rambase = 0x198000;
  11100. -- break;
  11101. -+ return 0x198000;
  11102. -+ case BRCM_CC_4335_CHIP_ID:
  11103. - case BRCM_CC_4339_CHIP_ID:
  11104. - case BRCM_CC_4354_CHIP_ID:
  11105. - case BRCM_CC_4356_CHIP_ID:
  11106. - case BRCM_CC_43567_CHIP_ID:
  11107. - case BRCM_CC_43569_CHIP_ID:
  11108. - case BRCM_CC_43570_CHIP_ID:
  11109. -- ci->pub.ramsize = 0xc0000;
  11110. -- ci->pub.rambase = 0x180000;
  11111. -- break;
  11112. - case BRCM_CC_43602_CHIP_ID:
  11113. -- ci->pub.ramsize = 0xf0000;
  11114. -- ci->pub.rambase = 0x180000;
  11115. -- break;
  11116. -+ return 0x180000;
  11117. - default:
  11118. - brcmf_err("unknown chip: %s\n", ci->pub.name);
  11119. - break;
  11120. - }
  11121. -+ return 0;
  11122. -+}
  11123. -+
  11124. -+static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  11125. -+{
  11126. -+ struct brcmf_core_priv *mem_core;
  11127. -+ struct brcmf_core *mem;
  11128. -+
  11129. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_ARM_CR4);
  11130. -+ if (mem) {
  11131. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  11132. -+ ci->pub.ramsize = brcmf_chip_tcm_ramsize(mem_core);
  11133. -+ ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
  11134. -+ if (!ci->pub.rambase) {
  11135. -+ brcmf_err("RAM base not provided with ARM CR4 core\n");
  11136. -+ return -EINVAL;
  11137. -+ }
  11138. -+ } else {
  11139. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_INTERNAL_MEM);
  11140. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  11141. -+ brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  11142. -+ &ci->pub.srsize);
  11143. -+ }
  11144. -+ brcmf_dbg(INFO, "RAM: base=0x%x size=%d (0x%x) sr=%d (0x%x)\n",
  11145. -+ ci->pub.rambase, ci->pub.ramsize, ci->pub.ramsize,
  11146. -+ ci->pub.srsize, ci->pub.srsize);
  11147. -+
  11148. -+ if (!ci->pub.ramsize) {
  11149. -+ brcmf_err("RAM size is undetermined\n");
  11150. -+ return -ENOMEM;
  11151. -+ }
  11152. -+ return 0;
  11153. - }
  11154. -
  11155. - static u32 brcmf_chip_dmp_get_desc(struct brcmf_chip_priv *ci, u32 *eromaddr,
  11156. -@@ -668,6 +833,7 @@ static int brcmf_chip_recognition(struct
  11157. - struct brcmf_core *core;
  11158. - u32 regdata;
  11159. - u32 socitype;
  11160. -+ int ret;
  11161. -
  11162. - /* Get CC core rev
  11163. - * Chipid is assume to be at offset 0 from SI_ENUM_BASE
  11164. -@@ -720,9 +886,13 @@ static int brcmf_chip_recognition(struct
  11165. - return -ENODEV;
  11166. - }
  11167. -
  11168. -- brcmf_chip_get_raminfo(ci);
  11169. --
  11170. -- return brcmf_chip_cores_check(ci);
  11171. -+ ret = brcmf_chip_cores_check(ci);
  11172. -+ if (ret)
  11173. -+ return ret;
  11174. -+
  11175. -+ /* assure chip is passive for core access */
  11176. -+ brcmf_chip_set_passive(&ci->pub);
  11177. -+ return brcmf_chip_get_raminfo(ci);
  11178. - }
  11179. -
  11180. - static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id)
  11181. -@@ -827,8 +997,6 @@ struct brcmf_chip *brcmf_chip_attach(voi
  11182. - if (err < 0)
  11183. - goto fail;
  11184. -
  11185. -- /* assure chip is passive for download */
  11186. -- brcmf_chip_set_passive(&chip->pub);
  11187. - return &chip->pub;
  11188. -
  11189. - fail:
  11190. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  11191. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  11192. -@@ -30,7 +30,8 @@
  11193. - * @pmucaps: PMU capabilities.
  11194. - * @pmurev: PMU revision.
  11195. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  11196. -- * @ramsize: amount of RAM on chip.
  11197. -+ * @ramsize: amount of RAM on chip including retention.
  11198. -+ * @srsize: amount of retention RAM on chip.
  11199. - * @name: string representation of the chip identifier.
  11200. - */
  11201. - struct brcmf_chip {
  11202. -@@ -41,6 +42,7 @@ struct brcmf_chip {
  11203. - u32 pmurev;
  11204. - u32 rambase;
  11205. - u32 ramsize;
  11206. -+ u32 srsize;
  11207. - char name[8];
  11208. - };
  11209. -
  11210. diff --git a/package/kernel/mac80211/patches/344-brcmfmac-take-save-restore-memory-into-account-for-S.patch b/package/kernel/mac80211/patches/344-brcmfmac-take-save-restore-memory-into-account-for-S.patch
  11211. deleted file mode 100644
  11212. index 69618a7..0000000
  11213. --- a/package/kernel/mac80211/patches/344-brcmfmac-take-save-restore-memory-into-account-for-S.patch
  11214. +++ /dev/null
  11215. @@ -1,96 +0,0 @@
  11216. -From: Arend van Spriel <arend@broadcom.com>
  11217. -Date: Wed, 11 Mar 2015 16:11:32 +0100
  11218. -Subject: [PATCH] brcmfmac: take save&restore memory into account for SDIO
  11219. - shared info
  11220. -
  11221. -The firmware provides pointer to SDIO shared information at end of
  11222. -RAM during firmware initialization. End of RAM is obviously determined
  11223. -by the actual ram size, but part of that may be used for save&restore
  11224. -memory. In that case another location in RAM will hold the pointer.
  11225. -
  11226. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11227. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11228. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11229. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11230. ----
  11231. -
  11232. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  11233. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  11234. -@@ -1067,44 +1067,47 @@ static inline bool brcmf_sdio_valid_shar
  11235. - static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
  11236. - struct sdpcm_shared *sh)
  11237. - {
  11238. -- u32 addr;
  11239. -+ u32 addr = 0;
  11240. - int rv;
  11241. - u32 shaddr = 0;
  11242. - struct sdpcm_shared_le sh_le;
  11243. - __le32 addr_le;
  11244. -
  11245. -- shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  11246. -+ sdio_claim_host(bus->sdiodev->func[1]);
  11247. -+ brcmf_sdio_bus_sleep(bus, false, false);
  11248. -
  11249. - /*
  11250. - * Read last word in socram to determine
  11251. - * address of sdpcm_shared structure
  11252. - */
  11253. -- sdio_claim_host(bus->sdiodev->func[1]);
  11254. -- brcmf_sdio_bus_sleep(bus, false, false);
  11255. -- rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4);
  11256. -- sdio_release_host(bus->sdiodev->func[1]);
  11257. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  11258. -+ if (!bus->ci->rambase && brcmf_chip_sr_capable(bus->ci))
  11259. -+ shaddr -= bus->ci->srsize;
  11260. -+ rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr,
  11261. -+ (u8 *)&addr_le, 4);
  11262. - if (rv < 0)
  11263. -- return rv;
  11264. --
  11265. -- addr = le32_to_cpu(addr_le);
  11266. --
  11267. -- brcmf_dbg(SDIO, "sdpcm_shared address 0x%08X\n", addr);
  11268. -+ goto fail;
  11269. -
  11270. - /*
  11271. - * Check if addr is valid.
  11272. - * NVRAM length at the end of memory should have been overwritten.
  11273. - */
  11274. -+ addr = le32_to_cpu(addr_le);
  11275. - if (!brcmf_sdio_valid_shared_address(addr)) {
  11276. -- brcmf_err("invalid sdpcm_shared address 0x%08X\n",
  11277. -- addr);
  11278. -- return -EINVAL;
  11279. -+ brcmf_err("invalid sdpcm_shared address 0x%08X\n", addr);
  11280. -+ rv = -EINVAL;
  11281. -+ goto fail;
  11282. - }
  11283. -
  11284. -+ brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr);
  11285. -+
  11286. - /* Read hndrte_shared structure */
  11287. - rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, (u8 *)&sh_le,
  11288. - sizeof(struct sdpcm_shared_le));
  11289. - if (rv < 0)
  11290. -- return rv;
  11291. -+ goto fail;
  11292. -+
  11293. -+ sdio_release_host(bus->sdiodev->func[1]);
  11294. -
  11295. - /* Endianness */
  11296. - sh->flags = le32_to_cpu(sh_le.flags);
  11297. -@@ -1121,8 +1124,13 @@ static int brcmf_sdio_readshared(struct
  11298. - sh->flags & SDPCM_SHARED_VERSION_MASK);
  11299. - return -EPROTO;
  11300. - }
  11301. --
  11302. - return 0;
  11303. -+
  11304. -+fail:
  11305. -+ brcmf_err("unable to obtain sdpcm_shared info: rv=%d (addr=0x%x)\n",
  11306. -+ rv, addr);
  11307. -+ sdio_release_host(bus->sdiodev->func[1]);
  11308. -+ return rv;
  11309. - }
  11310. -
  11311. - static void brcmf_sdio_get_console_addr(struct brcmf_sdio *bus)
  11312. diff --git a/package/kernel/mac80211/patches/345-brcmfmac-fix-watchdog-timer-regression.patch b/package/kernel/mac80211/patches/345-brcmfmac-fix-watchdog-timer-regression.patch
  11313. deleted file mode 100644
  11314. index 1b10dbb..0000000
  11315. --- a/package/kernel/mac80211/patches/345-brcmfmac-fix-watchdog-timer-regression.patch
  11316. +++ /dev/null
  11317. @@ -1,59 +0,0 @@
  11318. -From: Arend van Spriel <arend@broadcom.com>
  11319. -Date: Wed, 11 Mar 2015 16:11:33 +0100
  11320. -Subject: [PATCH] brcmfmac: fix watchdog timer regression
  11321. -
  11322. -The watchdog timer is used to put the device in a low-power mode when
  11323. -it is idle for some time. This timer is stopped during that mode and
  11324. -should be restarted upon activity. This has been broken by commit
  11325. -d4150fced0365 ("brcmfmac: Simplify watchdog sleep."). This patch
  11326. -restores the behaviour as it was before that commit.
  11327. -
  11328. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  11329. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11330. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11331. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11332. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11333. ----
  11334. -
  11335. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  11336. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  11337. -@@ -972,7 +972,6 @@ static int brcmf_sdio_clkctl(struct brcm
  11338. - brcmf_sdio_sdclk(bus, true);
  11339. - /* Now request HT Avail on the backplane */
  11340. - brcmf_sdio_htclk(bus, true, pendok);
  11341. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  11342. - break;
  11343. -
  11344. - case CLK_SDONLY:
  11345. -@@ -984,7 +983,6 @@ static int brcmf_sdio_clkctl(struct brcm
  11346. - else
  11347. - brcmf_err("request for %d -> %d\n",
  11348. - bus->clkstate, target);
  11349. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  11350. - break;
  11351. -
  11352. - case CLK_NONE:
  11353. -@@ -993,7 +991,6 @@ static int brcmf_sdio_clkctl(struct brcm
  11354. - brcmf_sdio_htclk(bus, false, false);
  11355. - /* Now remove the SD clock */
  11356. - brcmf_sdio_sdclk(bus, false);
  11357. -- brcmf_sdio_wd_timer(bus, 0);
  11358. - break;
  11359. - }
  11360. - #ifdef DEBUG
  11361. -@@ -1048,6 +1045,7 @@ end:
  11362. - brcmf_sdio_clkctl(bus, CLK_NONE, pendok);
  11363. - } else {
  11364. - brcmf_sdio_clkctl(bus, CLK_AVAIL, pendok);
  11365. -+ brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  11366. - }
  11367. - bus->sleeping = sleep;
  11368. - brcmf_dbg(SDIO, "new state %s\n",
  11369. -@@ -4242,6 +4240,7 @@ void brcmf_sdio_remove(struct brcmf_sdio
  11370. - if (bus->ci) {
  11371. - if (bus->sdiodev->state != BRCMF_SDIOD_NOMEDIUM) {
  11372. - sdio_claim_host(bus->sdiodev->func[1]);
  11373. -+ brcmf_sdio_wd_timer(bus, 0);
  11374. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  11375. - /* Leave the device in state where it is
  11376. - * 'passive'. This is done by resetting all
  11377. diff --git a/package/kernel/mac80211/patches/346-brcmfmac-avoid-runtime-pm-for-sdio-host-controller.patch b/package/kernel/mac80211/patches/346-brcmfmac-avoid-runtime-pm-for-sdio-host-controller.patch
  11378. deleted file mode 100644
  11379. index af76f13..0000000
  11380. --- a/package/kernel/mac80211/patches/346-brcmfmac-avoid-runtime-pm-for-sdio-host-controller.patch
  11381. +++ /dev/null
  11382. @@ -1,44 +0,0 @@
  11383. -From: Arend van Spriel <arend@broadcom.com>
  11384. -Date: Wed, 18 Mar 2015 13:25:21 +0100
  11385. -Subject: [PATCH] brcmfmac: avoid runtime-pm for sdio host controller
  11386. -
  11387. -Several host controllers supporting runtime-pm are causing issues
  11388. -with our sdio wireless cards because they disable the sdio interrupt
  11389. -upon going into runtime suspend. This patch avoids that by doing
  11390. -a pm_runtime_forbid() call during the probe. Tested with Sony Vaio
  11391. -Duo 13 which uses sdhci-acpi host controller.
  11392. -
  11393. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11394. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11395. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11396. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11397. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11398. ----
  11399. -
  11400. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  11401. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  11402. -@@ -29,6 +29,7 @@
  11403. - #include <linux/mmc/host.h>
  11404. - #include <linux/platform_device.h>
  11405. - #include <linux/platform_data/brcmfmac-sdio.h>
  11406. -+#include <linux/pm_runtime.h>
  11407. - #include <linux/suspend.h>
  11408. - #include <linux/errno.h>
  11409. - #include <linux/module.h>
  11410. -@@ -1006,6 +1007,7 @@ static int brcmf_sdiod_remove(struct brc
  11411. - sg_free_table(&sdiodev->sgtable);
  11412. - sdiodev->sbwad = 0;
  11413. -
  11414. -+ pm_runtime_allow(sdiodev->func[1]->card->host->parent);
  11415. - return 0;
  11416. - }
  11417. -
  11418. -@@ -1074,7 +1076,7 @@ static int brcmf_sdiod_probe(struct brcm
  11419. - ret = -ENODEV;
  11420. - goto out;
  11421. - }
  11422. --
  11423. -+ pm_runtime_forbid(host->parent);
  11424. - out:
  11425. - if (ret)
  11426. - brcmf_sdiod_remove(sdiodev);
  11427. diff --git a/package/kernel/mac80211/patches/347-brcmfmac-Add-necessary-memory-barriers-for-SDIO.patch b/package/kernel/mac80211/patches/347-brcmfmac-Add-necessary-memory-barriers-for-SDIO.patch
  11428. deleted file mode 100644
  11429. index c419cc6..0000000
  11430. --- a/package/kernel/mac80211/patches/347-brcmfmac-Add-necessary-memory-barriers-for-SDIO.patch
  11431. +++ /dev/null
  11432. @@ -1,171 +0,0 @@
  11433. -From: Hante Meuleman <meuleman@broadcom.com>
  11434. -Date: Wed, 18 Mar 2015 13:25:22 +0100
  11435. -Subject: [PATCH] brcmfmac: Add necessary memory barriers for SDIO.
  11436. -
  11437. -SDIO uses a thread to handle all communication with the device,
  11438. -for this data is exchanged between threads. This data needs proper
  11439. -memory barriers to make sure that data "exchange" is going correct.
  11440. -
  11441. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11442. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11443. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11444. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  11445. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11446. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11447. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11448. ----
  11449. -
  11450. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  11451. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  11452. -@@ -507,8 +507,8 @@ struct brcmf_sdio {
  11453. -
  11454. - struct workqueue_struct *brcmf_wq;
  11455. - struct work_struct datawork;
  11456. -- atomic_t dpc_tskcnt;
  11457. -- atomic_t dpc_running;
  11458. -+ bool dpc_triggered;
  11459. -+ bool dpc_running;
  11460. -
  11461. - bool txoff; /* Transmit flow-controlled */
  11462. - struct brcmf_sdio_count sdcnt;
  11463. -@@ -2713,6 +2713,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  11464. - err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  11465. - bus->ctrl_frame_len);
  11466. - bus->ctrl_frame_err = err;
  11467. -+ wmb();
  11468. - bus->ctrl_frame_stat = false;
  11469. - }
  11470. - sdio_release_host(bus->sdiodev->func[1]);
  11471. -@@ -2734,6 +2735,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  11472. - sdio_claim_host(bus->sdiodev->func[1]);
  11473. - if (bus->ctrl_frame_stat) {
  11474. - bus->ctrl_frame_err = -ENODEV;
  11475. -+ wmb();
  11476. - bus->ctrl_frame_stat = false;
  11477. - brcmf_sdio_wait_event_wakeup(bus);
  11478. - }
  11479. -@@ -2744,7 +2746,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  11480. - (!atomic_read(&bus->fcstate) &&
  11481. - brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  11482. - data_ok(bus))) {
  11483. -- atomic_inc(&bus->dpc_tskcnt);
  11484. -+ bus->dpc_triggered = true;
  11485. - }
  11486. - }
  11487. -
  11488. -@@ -2940,6 +2942,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  11489. - /* Send from dpc */
  11490. - bus->ctrl_frame_buf = msg;
  11491. - bus->ctrl_frame_len = msglen;
  11492. -+ wmb();
  11493. - bus->ctrl_frame_stat = true;
  11494. -
  11495. - brcmf_sdio_trigger_dpc(bus);
  11496. -@@ -2958,6 +2961,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  11497. - if (!ret) {
  11498. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  11499. - bus->ctrl_frame_err);
  11500. -+ rmb();
  11501. - ret = bus->ctrl_frame_err;
  11502. - }
  11503. -
  11504. -@@ -3526,8 +3530,8 @@ done:
  11505. -
  11506. - void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus)
  11507. - {
  11508. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  11509. -- atomic_inc(&bus->dpc_tskcnt);
  11510. -+ if (!bus->dpc_triggered) {
  11511. -+ bus->dpc_triggered = true;
  11512. - queue_work(bus->brcmf_wq, &bus->datawork);
  11513. - }
  11514. - }
  11515. -@@ -3558,7 +3562,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  11516. - if (!bus->intr)
  11517. - brcmf_err("isr w/o interrupt configured!\n");
  11518. -
  11519. -- atomic_inc(&bus->dpc_tskcnt);
  11520. -+ bus->dpc_triggered = true;
  11521. - queue_work(bus->brcmf_wq, &bus->datawork);
  11522. - }
  11523. -
  11524. -@@ -3578,7 +3582,7 @@ static void brcmf_sdio_bus_watchdog(stru
  11525. - if (!bus->intr ||
  11526. - (bus->sdcnt.intrcount == bus->sdcnt.lastintrs)) {
  11527. -
  11528. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  11529. -+ if (!bus->dpc_triggered) {
  11530. - u8 devpend;
  11531. -
  11532. - sdio_claim_host(bus->sdiodev->func[1]);
  11533. -@@ -3596,7 +3600,7 @@ static void brcmf_sdio_bus_watchdog(stru
  11534. - bus->sdcnt.pollcnt++;
  11535. - atomic_set(&bus->ipend, 1);
  11536. -
  11537. -- atomic_inc(&bus->dpc_tskcnt);
  11538. -+ bus->dpc_triggered = true;
  11539. - queue_work(bus->brcmf_wq, &bus->datawork);
  11540. - }
  11541. - }
  11542. -@@ -3623,17 +3627,21 @@ static void brcmf_sdio_bus_watchdog(stru
  11543. - #endif /* DEBUG */
  11544. -
  11545. - /* On idle timeout clear activity flag and/or turn off clock */
  11546. -- if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  11547. -- (atomic_read(&bus->dpc_running) == 0) &&
  11548. -- (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  11549. -- bus->idlecount++;
  11550. -- if (bus->idlecount > bus->idletime) {
  11551. -- brcmf_dbg(SDIO, "idle\n");
  11552. -- sdio_claim_host(bus->sdiodev->func[1]);
  11553. -- brcmf_sdio_wd_timer(bus, 0);
  11554. -+ if (!bus->dpc_triggered) {
  11555. -+ rmb();
  11556. -+ if ((!bus->dpc_running) && (bus->idletime > 0) &&
  11557. -+ (bus->clkstate == CLK_AVAIL)) {
  11558. -+ bus->idlecount++;
  11559. -+ if (bus->idlecount > bus->idletime) {
  11560. -+ brcmf_dbg(SDIO, "idle\n");
  11561. -+ sdio_claim_host(bus->sdiodev->func[1]);
  11562. -+ brcmf_sdio_wd_timer(bus, 0);
  11563. -+ bus->idlecount = 0;
  11564. -+ brcmf_sdio_bus_sleep(bus, true, false);
  11565. -+ sdio_release_host(bus->sdiodev->func[1]);
  11566. -+ }
  11567. -+ } else {
  11568. - bus->idlecount = 0;
  11569. -- brcmf_sdio_bus_sleep(bus, true, false);
  11570. -- sdio_release_host(bus->sdiodev->func[1]);
  11571. - }
  11572. - } else {
  11573. - bus->idlecount = 0;
  11574. -@@ -3645,13 +3653,14 @@ static void brcmf_sdio_dataworker(struct
  11575. - struct brcmf_sdio *bus = container_of(work, struct brcmf_sdio,
  11576. - datawork);
  11577. -
  11578. -- while (atomic_read(&bus->dpc_tskcnt)) {
  11579. -- atomic_set(&bus->dpc_running, 1);
  11580. -- atomic_set(&bus->dpc_tskcnt, 0);
  11581. -+ bus->dpc_running = true;
  11582. -+ wmb();
  11583. -+ while (ACCESS_ONCE(bus->dpc_triggered)) {
  11584. -+ bus->dpc_triggered = false;
  11585. - brcmf_sdio_dpc(bus);
  11586. - bus->idlecount = 0;
  11587. -- atomic_set(&bus->dpc_running, 0);
  11588. - }
  11589. -+ bus->dpc_running = false;
  11590. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  11591. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  11592. - brcmf_sdiod_try_freeze(bus->sdiodev);
  11593. -@@ -4144,8 +4153,8 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  11594. - bus->watchdog_tsk = NULL;
  11595. - }
  11596. - /* Initialize DPC thread */
  11597. -- atomic_set(&bus->dpc_tskcnt, 0);
  11598. -- atomic_set(&bus->dpc_running, 0);
  11599. -+ bus->dpc_triggered = false;
  11600. -+ bus->dpc_running = false;
  11601. -
  11602. - /* Assign bus interface call back */
  11603. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  11604. diff --git a/package/kernel/mac80211/patches/348-brcmfmac-Remove-unnecessary-new-line-in-pcie-console.patch b/package/kernel/mac80211/patches/348-brcmfmac-Remove-unnecessary-new-line-in-pcie-console.patch
  11605. deleted file mode 100644
  11606. index 1bc98a0..0000000
  11607. --- a/package/kernel/mac80211/patches/348-brcmfmac-Remove-unnecessary-new-line-in-pcie-console.patch
  11608. +++ /dev/null
  11609. @@ -1,26 +0,0 @@
  11610. -From: Hante Meuleman <meuleman@broadcom.com>
  11611. -Date: Wed, 18 Mar 2015 13:25:24 +0100
  11612. -Subject: [PATCH] brcmfmac: Remove unnecessary new-line in pcie console
  11613. - logging.
  11614. -
  11615. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11616. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11617. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11618. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11619. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11620. ----
  11621. -
  11622. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  11623. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  11624. -@@ -651,10 +651,9 @@ static void brcmf_pcie_bus_console_read(
  11625. - console->log_str[console->log_idx] = ch;
  11626. - console->log_idx++;
  11627. - }
  11628. --
  11629. - if (ch == '\n') {
  11630. - console->log_str[console->log_idx] = 0;
  11631. -- brcmf_dbg(PCIE, "CONSOLE: %s\n", console->log_str);
  11632. -+ brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  11633. - console->log_idx = 0;
  11634. - }
  11635. - }
  11636. diff --git a/package/kernel/mac80211/patches/349-brcmfmac-add-MODULE_FIRMWARE-macros-for-bcm4356-PCIe.patch b/package/kernel/mac80211/patches/349-brcmfmac-add-MODULE_FIRMWARE-macros-for-bcm4356-PCIe.patch
  11637. deleted file mode 100644
  11638. index fcf0bf3..0000000
  11639. --- a/package/kernel/mac80211/patches/349-brcmfmac-add-MODULE_FIRMWARE-macros-for-bcm4356-PCIe.patch
  11640. +++ /dev/null
  11641. @@ -1,26 +0,0 @@
  11642. -From: Arend van Spriel <arend@broadcom.com>
  11643. -Date: Wed, 18 Mar 2015 13:25:25 +0100
  11644. -Subject: [PATCH] brcmfmac: add MODULE_FIRMWARE() macros for bcm4356 PCIe
  11645. - device
  11646. -
  11647. -The BCM4356 PCIe wireless device was added recently but overlooked
  11648. -the fact that the MODULE_FIRMWARE() macros were missing for the
  11649. -firmwares needed by this device.
  11650. -
  11651. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11652. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11653. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11654. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11655. ----
  11656. -
  11657. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  11658. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  11659. -@@ -189,6 +189,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME
  11660. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  11661. - MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  11662. - MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  11663. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  11664. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  11665. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  11666. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  11667. -
  11668. diff --git a/package/kernel/mac80211/patches/350-brcmfmac-add-support-for-BCM43430-SDIO-chipset.patch b/package/kernel/mac80211/patches/350-brcmfmac-add-support-for-BCM43430-SDIO-chipset.patch
  11669. deleted file mode 100644
  11670. index b3e9bc9..0000000
  11671. --- a/package/kernel/mac80211/patches/350-brcmfmac-add-support-for-BCM43430-SDIO-chipset.patch
  11672. +++ /dev/null
  11673. @@ -1,138 +0,0 @@
  11674. -From: Arend van Spriel <arend@broadcom.com>
  11675. -Date: Wed, 18 Mar 2015 13:25:26 +0100
  11676. -Subject: [PATCH] brcmfmac: add support for BCM43430 SDIO chipset
  11677. -
  11678. -This patch added support for the BCM43430 802.11n SDIO chipset.
  11679. -
  11680. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11681. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  11682. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11683. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11684. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11685. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11686. ----
  11687. -
  11688. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  11689. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  11690. -@@ -1098,6 +1098,7 @@ static const struct sdio_device_id brcmf
  11691. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  11692. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  11693. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  11694. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
  11695. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  11696. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  11697. - { /* end: all zeroes */ }
  11698. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  11699. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  11700. -@@ -600,6 +600,12 @@ static void brcmf_chip_socram_ramsize(st
  11701. - if (sr->chip->pub.chiprev < 2)
  11702. - *srsize = (32 * 1024);
  11703. - break;
  11704. -+ case BRCM_CC_43430_CHIP_ID:
  11705. -+ /* assume sr for now as we can not check
  11706. -+ * firmware sr capability at this point.
  11707. -+ */
  11708. -+ *srsize = (64 * 1024);
  11709. -+ break;
  11710. - default:
  11711. - break;
  11712. - }
  11713. -@@ -1072,6 +1078,7 @@ static void
  11714. - brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  11715. - {
  11716. - struct brcmf_core *core;
  11717. -+ struct brcmf_core_priv *sr;
  11718. -
  11719. - brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  11720. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_80211);
  11721. -@@ -1081,6 +1088,13 @@ brcmf_chip_cm3_set_passive(struct brcmf_
  11722. - D11_BCMA_IOCTL_PHYCLOCKEN);
  11723. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_INTERNAL_MEM);
  11724. - brcmf_chip_resetcore(core, 0, 0, 0);
  11725. -+
  11726. -+ /* disable bank #3 remap for this device */
  11727. -+ if (chip->pub.chip == BRCM_CC_43430_CHIP_ID) {
  11728. -+ sr = container_of(core, struct brcmf_core_priv, pub);
  11729. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankidx), 3);
  11730. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankpda), 0);
  11731. -+ }
  11732. - }
  11733. -
  11734. - static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  11735. -@@ -1188,6 +1202,10 @@ bool brcmf_chip_sr_capable(struct brcmf_
  11736. - addr = CORE_CC_REG(base, chipcontrol_data);
  11737. - reg = chip->ops->read32(chip->ctx, addr);
  11738. - return (reg & pmu_cc3_mask) != 0;
  11739. -+ case BRCM_CC_43430_CHIP_ID:
  11740. -+ addr = CORE_CC_REG(base, sr_control1);
  11741. -+ reg = chip->ops->read32(chip->ctx, addr);
  11742. -+ return reg != 0;
  11743. - default:
  11744. - addr = CORE_CC_REG(base, pmucapabilities_ext);
  11745. - reg = chip->ops->read32(chip->ctx, addr);
  11746. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  11747. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  11748. -@@ -615,6 +615,8 @@ static const struct sdiod_drive_str sdio
  11749. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  11750. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  11751. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  11752. -+#define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  11753. -+#define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  11754. - #define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  11755. - #define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  11756. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  11757. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  11758. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  11759. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  11760. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  11761. -+MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  11762. -+MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  11763. - MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  11764. - MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  11765. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  11766. -@@ -671,6 +675,7 @@ static const struct brcmf_firmware_names
  11767. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  11768. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  11769. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  11770. -+ { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  11771. - { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  11772. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  11773. - };
  11774. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  11775. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  11776. -@@ -37,6 +37,7 @@
  11777. - #define BRCM_CC_43362_CHIP_ID 43362
  11778. - #define BRCM_CC_4335_CHIP_ID 0x4335
  11779. - #define BRCM_CC_4339_CHIP_ID 0x4339
  11780. -+#define BRCM_CC_43430_CHIP_ID 43430
  11781. - #define BRCM_CC_4345_CHIP_ID 0x4345
  11782. - #define BRCM_CC_4354_CHIP_ID 0x4354
  11783. - #define BRCM_CC_4356_CHIP_ID 0x4356
  11784. ---- a/drivers/net/wireless/brcm80211/include/chipcommon.h
  11785. -+++ b/drivers/net/wireless/brcm80211/include/chipcommon.h
  11786. -@@ -183,7 +183,14 @@ struct chipcregs {
  11787. - u8 uart1lsr;
  11788. - u8 uart1msr;
  11789. - u8 uart1scratch;
  11790. -- u32 PAD[126];
  11791. -+ u32 PAD[62];
  11792. -+
  11793. -+ /* save/restore, corerev >= 48 */
  11794. -+ u32 sr_capability; /* 0x500 */
  11795. -+ u32 sr_control0; /* 0x504 */
  11796. -+ u32 sr_control1; /* 0x508 */
  11797. -+ u32 gpio_control; /* 0x50C */
  11798. -+ u32 PAD[60];
  11799. -
  11800. - /* PMU registers (corerev >= 20) */
  11801. - u32 pmucontrol; /* 0x600 */
  11802. ---- a/include/linux/mmc/sdio_ids.h
  11803. -+++ b/include/linux/mmc/sdio_ids.h
  11804. -@@ -33,6 +33,7 @@
  11805. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  11806. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  11807. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  11808. -+#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
  11809. - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  11810. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  11811. -
  11812. diff --git a/package/kernel/mac80211/patches/351-brcmfmac-only-support-the-BCM43455-7-device.patch b/package/kernel/mac80211/patches/351-brcmfmac-only-support-the-BCM43455-7-device.patch
  11813. deleted file mode 100644
  11814. index c3d7bc2..0000000
  11815. --- a/package/kernel/mac80211/patches/351-brcmfmac-only-support-the-BCM43455-7-device.patch
  11816. +++ /dev/null
  11817. @@ -1,50 +0,0 @@
  11818. -From: Arend van Spriel <arend@broadcom.com>
  11819. -Date: Wed, 18 Mar 2015 13:25:27 +0100
  11820. -Subject: [PATCH] brcmfmac: only support the BCM43455/7 device
  11821. -
  11822. -Recently support was added for the BCM4345 SDIO chipset by
  11823. -commit 9c51026509d7 ("brcmfmac: Add support for BCM4345 SDIO chipset")
  11824. -however this was verified using a BCM43455 device, which is
  11825. -a more recent revision of the chip. This patch assure that
  11826. -older revisions are not probed as they would fail.
  11827. -
  11828. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11829. -Reviewed-by: Syed Asifful Dayyan <syedd@broadcom.com>
  11830. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11831. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11832. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11833. ----
  11834. -
  11835. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  11836. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  11837. -@@ -617,8 +617,8 @@ static const struct sdiod_drive_str sdio
  11838. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  11839. - #define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  11840. - #define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  11841. --#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  11842. --#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  11843. -+#define BCM43455_FIRMWARE_NAME "brcm/brcmfmac43455-sdio.bin"
  11844. -+#define BCM43455_NVRAM_NAME "brcm/brcmfmac43455-sdio.txt"
  11845. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  11846. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  11847. -
  11848. -@@ -644,8 +644,8 @@ MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  11849. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  11850. - MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  11851. - MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  11852. --MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  11853. --MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  11854. -+MODULE_FIRMWARE(BCM43455_FIRMWARE_NAME);
  11855. -+MODULE_FIRMWARE(BCM43455_NVRAM_NAME);
  11856. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  11857. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  11858. -
  11859. -@@ -676,7 +676,7 @@ static const struct brcmf_firmware_names
  11860. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  11861. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  11862. - { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  11863. -- { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  11864. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43455) },
  11865. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  11866. - };
  11867. -
  11868. diff --git a/package/kernel/mac80211/patches/352-brcmfmac-remove-support-for-unreleased-BCM4354-PCIe.patch b/package/kernel/mac80211/patches/352-brcmfmac-remove-support-for-unreleased-BCM4354-PCIe.patch
  11869. deleted file mode 100644
  11870. index a62cfdf..0000000
  11871. --- a/package/kernel/mac80211/patches/352-brcmfmac-remove-support-for-unreleased-BCM4354-PCIe.patch
  11872. +++ /dev/null
  11873. @@ -1,52 +0,0 @@
  11874. -From: Arend van Spriel <arend@broadcom.com>
  11875. -Date: Wed, 18 Mar 2015 13:25:28 +0100
  11876. -Subject: [PATCH] brcmfmac: remove support for unreleased BCM4354 PCIe
  11877. -
  11878. -There are no known BCM4354 PCIe devices released so removing
  11879. -support from the driver until proven otherwise.
  11880. -
  11881. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11882. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11883. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11884. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11885. ----
  11886. -
  11887. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  11888. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  11889. -@@ -47,8 +47,6 @@ enum brcmf_pcie_state {
  11890. -
  11891. - #define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  11892. - #define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  11893. --#define BRCMF_PCIE_4354_FW_NAME "brcm/brcmfmac4354-pcie.bin"
  11894. --#define BRCMF_PCIE_4354_NVRAM_NAME "brcm/brcmfmac4354-pcie.txt"
  11895. - #define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  11896. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  11897. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  11898. -@@ -187,8 +185,6 @@ enum brcmf_pcie_state {
  11899. -
  11900. - MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  11901. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  11902. --MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  11903. --MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  11904. - MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  11905. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  11906. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  11907. -@@ -1327,10 +1323,6 @@ static int brcmf_pcie_get_fwnames(struct
  11908. - fw_name = BRCMF_PCIE_43602_FW_NAME;
  11909. - nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  11910. - break;
  11911. -- case BRCM_CC_4354_CHIP_ID:
  11912. -- fw_name = BRCMF_PCIE_4354_FW_NAME;
  11913. -- nvram_name = BRCMF_PCIE_4354_NVRAM_NAME;
  11914. -- break;
  11915. - case BRCM_CC_4356_CHIP_ID:
  11916. - fw_name = BRCMF_PCIE_4356_FW_NAME;
  11917. - nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  11918. -@@ -1855,7 +1847,6 @@ cleanup:
  11919. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  11920. -
  11921. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  11922. -- BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_DEVICE_ID),
  11923. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  11924. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  11925. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  11926. diff --git a/package/kernel/mac80211/patches/353-brcmfmac-disable-MBSS-feature-for-BCM43362.patch b/package/kernel/mac80211/patches/353-brcmfmac-disable-MBSS-feature-for-BCM43362.patch
  11927. deleted file mode 100644
  11928. index 366ff85..0000000
  11929. --- a/package/kernel/mac80211/patches/353-brcmfmac-disable-MBSS-feature-for-BCM43362.patch
  11930. +++ /dev/null
  11931. @@ -1,28 +0,0 @@
  11932. -From: Arend van Spriel <arend@broadcom.com>
  11933. -Date: Fri, 20 Mar 2015 22:18:17 +0100
  11934. -Subject: [PATCH] brcmfmac: disable MBSS feature for BCM43362
  11935. -
  11936. -The BCM43362 firmware falsely reports it is capable of providing
  11937. -MBSS. As a result AP mode no longer works for this device. Therefor
  11938. -disable MBSS in the driver for this chipset.
  11939. -
  11940. -Cc: stable@vger.kernel.org # 3.19.y
  11941. -Reported-by: Jorg Krause <jkrause@posteo.de>
  11942. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11943. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11944. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11945. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11946. ----
  11947. -
  11948. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  11949. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  11950. -@@ -126,7 +126,8 @@ void brcmf_feat_attach(struct brcmf_pub
  11951. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  11952. - if (drvr->bus_if->wowl_supported)
  11953. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  11954. -- brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  11955. -+ if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  11956. -+ brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  11957. -
  11958. - /* set chip related quirks */
  11959. - switch (drvr->bus_if->chip) {
  11960. diff --git a/package/kernel/mac80211/patches/354-brcmfmac-use-static-superset-of-channels-for-wiphy-b.patch b/package/kernel/mac80211/patches/354-brcmfmac-use-static-superset-of-channels-for-wiphy-b.patch
  11961. deleted file mode 100644
  11962. index 6e461f6..0000000
  11963. --- a/package/kernel/mac80211/patches/354-brcmfmac-use-static-superset-of-channels-for-wiphy-b.patch
  11964. +++ /dev/null
  11965. @@ -1,300 +0,0 @@
  11966. -From: Arend van Spriel <arend@broadcom.com>
  11967. -Date: Tue, 14 Apr 2015 20:10:24 +0200
  11968. -Subject: [PATCH] brcmfmac: use static superset of channels for wiphy
  11969. - bands
  11970. -
  11971. -The driver was constructing a list of channels per wiphy band
  11972. -by querying the device. This list is not what the hardware is
  11973. -able to do as it is already filtered by the country setting in
  11974. -the device. As user-space may change the country this would
  11975. -require updating the channel list which is not recommended [1].
  11976. -This patch introduces a superset of channels. The individual
  11977. -channels are disabled appropriately by querying the device.
  11978. -
  11979. -[1] http://mid.gmane.org/1426706320.3001.21.camel@sipsolutions.net
  11980. -
  11981. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11982. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  11983. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11984. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11985. ----
  11986. -
  11987. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11988. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11989. -@@ -129,13 +129,47 @@ static struct ieee80211_rate __wl_rates[
  11990. - RATETAB_ENT(BRCM_RATE_54M, 0),
  11991. - };
  11992. -
  11993. --#define wl_a_rates (__wl_rates + 4)
  11994. --#define wl_a_rates_size 8
  11995. - #define wl_g_rates (__wl_rates + 0)
  11996. --#define wl_g_rates_size 12
  11997. -+#define wl_g_rates_size ARRAY_SIZE(__wl_rates)
  11998. -+#define wl_a_rates (__wl_rates + 4)
  11999. -+#define wl_a_rates_size (wl_g_rates_size - 4)
  12000. -+
  12001. -+#define CHAN2G(_channel, _freq) { \
  12002. -+ .band = IEEE80211_BAND_2GHZ, \
  12003. -+ .center_freq = (_freq), \
  12004. -+ .hw_value = (_channel), \
  12005. -+ .flags = IEEE80211_CHAN_DISABLED, \
  12006. -+ .max_antenna_gain = 0, \
  12007. -+ .max_power = 30, \
  12008. -+}
  12009. -+
  12010. -+#define CHAN5G(_channel) { \
  12011. -+ .band = IEEE80211_BAND_5GHZ, \
  12012. -+ .center_freq = 5000 + (5 * (_channel)), \
  12013. -+ .hw_value = (_channel), \
  12014. -+ .flags = IEEE80211_CHAN_DISABLED, \
  12015. -+ .max_antenna_gain = 0, \
  12016. -+ .max_power = 30, \
  12017. -+}
  12018. -+
  12019. -+static struct ieee80211_channel __wl_2ghz_channels[] = {
  12020. -+ CHAN2G(1, 2412), CHAN2G(2, 2417), CHAN2G(3, 2422), CHAN2G(4, 2427),
  12021. -+ CHAN2G(5, 2432), CHAN2G(6, 2437), CHAN2G(7, 2442), CHAN2G(8, 2447),
  12022. -+ CHAN2G(9, 2452), CHAN2G(10, 2457), CHAN2G(11, 2462), CHAN2G(12, 2467),
  12023. -+ CHAN2G(13, 2472), CHAN2G(14, 2484)
  12024. -+};
  12025. -+
  12026. -+static struct ieee80211_channel __wl_5ghz_channels[] = {
  12027. -+ CHAN5G(34), CHAN5G(36), CHAN5G(38), CHAN5G(40), CHAN5G(42),
  12028. -+ CHAN5G(44), CHAN5G(46), CHAN5G(48), CHAN5G(52), CHAN5G(56),
  12029. -+ CHAN5G(60), CHAN5G(64), CHAN5G(100), CHAN5G(104), CHAN5G(108),
  12030. -+ CHAN5G(112), CHAN5G(116), CHAN5G(120), CHAN5G(124), CHAN5G(128),
  12031. -+ CHAN5G(132), CHAN5G(136), CHAN5G(140), CHAN5G(144), CHAN5G(149),
  12032. -+ CHAN5G(153), CHAN5G(157), CHAN5G(161), CHAN5G(165)
  12033. -+};
  12034. -
  12035. - /* Band templates duplicated per wiphy. The channel info
  12036. -- * is filled in after querying the device.
  12037. -+ * above is added to the band during setup.
  12038. - */
  12039. - static const struct ieee80211_supported_band __wl_band_2ghz = {
  12040. - .band = IEEE80211_BAND_2GHZ,
  12041. -@@ -143,7 +177,7 @@ static const struct ieee80211_supported_
  12042. - .n_bitrates = wl_g_rates_size,
  12043. - };
  12044. -
  12045. --static const struct ieee80211_supported_band __wl_band_5ghz_a = {
  12046. -+static const struct ieee80211_supported_band __wl_band_5ghz = {
  12047. - .band = IEEE80211_BAND_5GHZ,
  12048. - .bitrates = wl_a_rates,
  12049. - .n_bitrates = wl_a_rates_size,
  12050. -@@ -5252,40 +5286,6 @@ dongle_scantime_out:
  12051. - return err;
  12052. - }
  12053. -
  12054. --/* Filter the list of channels received from firmware counting only
  12055. -- * the 20MHz channels. The wiphy band data only needs those which get
  12056. -- * flagged to indicate if they can take part in higher bandwidth.
  12057. -- */
  12058. --static void brcmf_count_20mhz_channels(struct brcmf_cfg80211_info *cfg,
  12059. -- struct brcmf_chanspec_list *chlist,
  12060. -- u32 chcnt[])
  12061. --{
  12062. -- u32 total = le32_to_cpu(chlist->count);
  12063. -- struct brcmu_chan ch;
  12064. -- int i;
  12065. --
  12066. -- for (i = 0; i < total; i++) {
  12067. -- ch.chspec = (u16)le32_to_cpu(chlist->element[i]);
  12068. -- cfg->d11inf.decchspec(&ch);
  12069. --
  12070. -- /* Firmware gives a ordered list. We skip non-20MHz
  12071. -- * channels is 2G. For 5G we can abort upon reaching
  12072. -- * a non-20MHz channel in the list.
  12073. -- */
  12074. -- if (ch.bw != BRCMU_CHAN_BW_20) {
  12075. -- if (ch.band == BRCMU_CHAN_BAND_5G)
  12076. -- break;
  12077. -- else
  12078. -- continue;
  12079. -- }
  12080. --
  12081. -- if (ch.band == BRCMU_CHAN_BAND_2G)
  12082. -- chcnt[0] += 1;
  12083. -- else if (ch.band == BRCMU_CHAN_BAND_5G)
  12084. -- chcnt[1] += 1;
  12085. -- }
  12086. --}
  12087. --
  12088. - static void brcmf_update_bw40_channel_flag(struct ieee80211_channel *channel,
  12089. - struct brcmu_chan *ch)
  12090. - {
  12091. -@@ -5321,7 +5321,6 @@ static int brcmf_construct_chaninfo(stru
  12092. - u32 i, j;
  12093. - u32 total;
  12094. - u32 chaninfo;
  12095. -- u32 chcnt[2] = { 0, 0 };
  12096. - u32 index;
  12097. -
  12098. - pbuf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
  12099. -@@ -5338,42 +5337,15 @@ static int brcmf_construct_chaninfo(stru
  12100. - goto fail_pbuf;
  12101. - }
  12102. -
  12103. -- brcmf_count_20mhz_channels(cfg, list, chcnt);
  12104. - wiphy = cfg_to_wiphy(cfg);
  12105. -- if (chcnt[0]) {
  12106. -- band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  12107. -- GFP_KERNEL);
  12108. -- if (band == NULL) {
  12109. -- err = -ENOMEM;
  12110. -- goto fail_pbuf;
  12111. -- }
  12112. -- band->channels = kcalloc(chcnt[0], sizeof(*channel),
  12113. -- GFP_KERNEL);
  12114. -- if (band->channels == NULL) {
  12115. -- kfree(band);
  12116. -- err = -ENOMEM;
  12117. -- goto fail_pbuf;
  12118. -- }
  12119. -- band->n_channels = 0;
  12120. -- wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  12121. -- }
  12122. -- if (chcnt[1]) {
  12123. -- band = kmemdup(&__wl_band_5ghz_a, sizeof(__wl_band_5ghz_a),
  12124. -- GFP_KERNEL);
  12125. -- if (band == NULL) {
  12126. -- err = -ENOMEM;
  12127. -- goto fail_band2g;
  12128. -- }
  12129. -- band->channels = kcalloc(chcnt[1], sizeof(*channel),
  12130. -- GFP_KERNEL);
  12131. -- if (band->channels == NULL) {
  12132. -- kfree(band);
  12133. -- err = -ENOMEM;
  12134. -- goto fail_band2g;
  12135. -- }
  12136. -- band->n_channels = 0;
  12137. -- wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  12138. -- }
  12139. -+ band = wiphy->bands[IEEE80211_BAND_2GHZ];
  12140. -+ if (band)
  12141. -+ for (i = 0; i < band->n_channels; i++)
  12142. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  12143. -+ band = wiphy->bands[IEEE80211_BAND_5GHZ];
  12144. -+ if (band)
  12145. -+ for (i = 0; i < band->n_channels; i++)
  12146. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  12147. -
  12148. - total = le32_to_cpu(list->count);
  12149. - for (i = 0; i < total; i++) {
  12150. -@@ -5388,6 +5360,8 @@ static int brcmf_construct_chaninfo(stru
  12151. - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
  12152. - continue;
  12153. - }
  12154. -+ if (!band)
  12155. -+ continue;
  12156. - if (!(bw_cap[band->band] & WLC_BW_40MHZ_BIT) &&
  12157. - ch.bw == BRCMU_CHAN_BW_40)
  12158. - continue;
  12159. -@@ -5415,9 +5389,9 @@ static int brcmf_construct_chaninfo(stru
  12160. - } else if (ch.bw == BRCMU_CHAN_BW_40) {
  12161. - brcmf_update_bw40_channel_flag(&channel[index], &ch);
  12162. - } else {
  12163. -- /* disable other bandwidths for now as mentioned
  12164. -- * order assure they are enabled for subsequent
  12165. -- * chanspecs.
  12166. -+ /* enable the channel and disable other bandwidths
  12167. -+ * for now as mentioned order assure they are enabled
  12168. -+ * for subsequent chanspecs.
  12169. - */
  12170. - channel[index].flags = IEEE80211_CHAN_NO_HT40 |
  12171. - IEEE80211_CHAN_NO_80MHZ;
  12172. -@@ -5436,16 +5410,8 @@ static int brcmf_construct_chaninfo(stru
  12173. - IEEE80211_CHAN_NO_IR;
  12174. - }
  12175. - }
  12176. -- if (index == band->n_channels)
  12177. -- band->n_channels++;
  12178. - }
  12179. -- kfree(pbuf);
  12180. -- return 0;
  12181. -
  12182. --fail_band2g:
  12183. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  12184. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]);
  12185. -- wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
  12186. - fail_pbuf:
  12187. - kfree(pbuf);
  12188. - return err;
  12189. -@@ -5778,7 +5744,12 @@ static void brcmf_wiphy_wowl_params(stru
  12190. -
  12191. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  12192. - {
  12193. -+ struct ieee80211_supported_band *band;
  12194. - struct ieee80211_iface_combination ifc_combo;
  12195. -+ __le32 bandlist[3];
  12196. -+ u32 n_bands;
  12197. -+ int err, i;
  12198. -+
  12199. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  12200. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  12201. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  12202. -@@ -5820,7 +5791,52 @@ static int brcmf_setup_wiphy(struct wiph
  12203. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL))
  12204. - brcmf_wiphy_wowl_params(wiphy);
  12205. -
  12206. -- return brcmf_setup_wiphybands(wiphy);
  12207. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
  12208. -+ sizeof(bandlist));
  12209. -+ if (err) {
  12210. -+ brcmf_err("could not obtain band info: err=%d\n", err);
  12211. -+ return err;
  12212. -+ }
  12213. -+ /* first entry in bandlist is number of bands */
  12214. -+ n_bands = le32_to_cpu(bandlist[0]);
  12215. -+ for (i = 1; i <= n_bands && i < ARRAY_SIZE(bandlist); i++) {
  12216. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_2G)) {
  12217. -+ band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  12218. -+ GFP_KERNEL);
  12219. -+ if (!band)
  12220. -+ return -ENOMEM;
  12221. -+
  12222. -+ band->channels = kmemdup(&__wl_2ghz_channels,
  12223. -+ sizeof(__wl_2ghz_channels),
  12224. -+ GFP_KERNEL);
  12225. -+ if (!band->channels) {
  12226. -+ kfree(band);
  12227. -+ return -ENOMEM;
  12228. -+ }
  12229. -+
  12230. -+ band->n_channels = ARRAY_SIZE(__wl_2ghz_channels);
  12231. -+ wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  12232. -+ }
  12233. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_5G)) {
  12234. -+ band = kmemdup(&__wl_band_5ghz, sizeof(__wl_band_5ghz),
  12235. -+ GFP_KERNEL);
  12236. -+ if (!band)
  12237. -+ return -ENOMEM;
  12238. -+
  12239. -+ band->channels = kmemdup(&__wl_5ghz_channels,
  12240. -+ sizeof(__wl_5ghz_channels),
  12241. -+ GFP_KERNEL);
  12242. -+ if (!band->channels) {
  12243. -+ kfree(band);
  12244. -+ return -ENOMEM;
  12245. -+ }
  12246. -+
  12247. -+ band->n_channels = ARRAY_SIZE(__wl_5ghz_channels);
  12248. -+ wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  12249. -+ }
  12250. -+ }
  12251. -+ err = brcmf_setup_wiphybands(wiphy);
  12252. -+ return err;
  12253. - }
  12254. -
  12255. - static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
  12256. -@@ -6011,6 +6027,9 @@ static void brcmf_cfg80211_reg_notifier(
  12257. -
  12258. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  12259. - {
  12260. -+ if (!wiphy)
  12261. -+ return;
  12262. -+
  12263. - kfree(wiphy->iface_combinations);
  12264. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  12265. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  12266. diff --git a/package/kernel/mac80211/patches/355-brcmfmac-update-wiphy-band-information-upon-updating.patch b/package/kernel/mac80211/patches/355-brcmfmac-update-wiphy-band-information-upon-updating.patch
  12267. deleted file mode 100644
  12268. index a0c22eb..0000000
  12269. --- a/package/kernel/mac80211/patches/355-brcmfmac-update-wiphy-band-information-upon-updating.patch
  12270. +++ /dev/null
  12271. @@ -1,29 +0,0 @@
  12272. -From: Arend van Spriel <arend@broadcom.com>
  12273. -Date: Tue, 14 Apr 2015 20:10:25 +0200
  12274. -Subject: [PATCH] brcmfmac: update wiphy band information upon updating
  12275. - regulatory domain
  12276. -
  12277. -When change the country code the available channels may change. So
  12278. -the wiphy bands should be updated accordingly.
  12279. -
  12280. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  12281. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12282. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12283. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12284. ----
  12285. -
  12286. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  12287. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  12288. -@@ -6022,7 +6022,11 @@ static void brcmf_cfg80211_reg_notifier(
  12289. - memset(&ccreq, 0, sizeof(ccreq));
  12290. - ccreq.rev = cpu_to_le32(-1);
  12291. - memcpy(ccreq.ccode, req->alpha2, sizeof(req->alpha2));
  12292. -- brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  12293. -+ if (brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq))) {
  12294. -+ brcmf_err("firmware rejected country setting\n");
  12295. -+ return;
  12296. -+ }
  12297. -+ brcmf_setup_wiphybands(wiphy);
  12298. - }
  12299. -
  12300. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  12301. diff --git a/package/kernel/mac80211/patches/356-brcmfmac-add-description-for-feature-flags.patch b/package/kernel/mac80211/patches/356-brcmfmac-add-description-for-feature-flags.patch
  12302. deleted file mode 100644
  12303. index 193f507..0000000
  12304. --- a/package/kernel/mac80211/patches/356-brcmfmac-add-description-for-feature-flags.patch
  12305. +++ /dev/null
  12306. @@ -1,24 +0,0 @@
  12307. -From: Arend van Spriel <arend@broadcom.com>
  12308. -Date: Tue, 14 Apr 2015 20:10:26 +0200
  12309. -Subject: [PATCH] brcmfmac: add description for feature flags
  12310. -
  12311. -Some feature flags were not described in the header file. Adding
  12312. -the description.
  12313. -
  12314. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12315. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12316. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12317. ----
  12318. -
  12319. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  12320. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  12321. -@@ -19,7 +19,9 @@
  12322. - /*
  12323. - * Features:
  12324. - *
  12325. -+ * MBSS: multiple BSSID support (eg. guest network in AP mode).
  12326. - * MCHAN: multi-channel for concurrent P2P.
  12327. -+ * WOWL: Wake-On-WLAN.
  12328. - */
  12329. - #define BRCMF_FEAT_LIST \
  12330. - BRCMF_FEAT_DEF(MBSS) \
  12331. diff --git a/package/kernel/mac80211/patches/357-brcmfmac-make-scheduled-scan-support-conditional.patch b/package/kernel/mac80211/patches/357-brcmfmac-make-scheduled-scan-support-conditional.patch
  12332. deleted file mode 100644
  12333. index 42330b4..0000000
  12334. --- a/package/kernel/mac80211/patches/357-brcmfmac-make-scheduled-scan-support-conditional.patch
  12335. +++ /dev/null
  12336. @@ -1,51 +0,0 @@
  12337. -From: Arend van Spriel <arend@broadcom.com>
  12338. -Date: Tue, 14 Apr 2015 20:10:27 +0200
  12339. -Subject: [PATCH] brcmfmac: make scheduled scan support conditional
  12340. -
  12341. -The scheduled scan support depends on firmware supporting the PNO
  12342. -feature. This feature is optional so add a feature flag for this
  12343. -in the driver and announce scheduled scan support accordingly.
  12344. -
  12345. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12346. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12347. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12348. ----
  12349. -
  12350. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  12351. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  12352. -@@ -5782,7 +5782,8 @@ static int brcmf_setup_wiphy(struct wiph
  12353. - wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM;
  12354. - wiphy->mgmt_stypes = brcmf_txrx_stypes;
  12355. - wiphy->max_remain_on_channel_duration = 5000;
  12356. -- brcmf_wiphy_pno_params(wiphy);
  12357. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO))
  12358. -+ brcmf_wiphy_pno_params(wiphy);
  12359. -
  12360. - /* vendor commands/events support */
  12361. - wiphy->vendor_commands = brcmf_vendor_cmds;
  12362. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  12363. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  12364. -@@ -124,6 +124,7 @@ void brcmf_feat_attach(struct brcmf_pub
  12365. - struct brcmf_if *ifp = drvr->iflist[0];
  12366. -
  12367. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  12368. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  12369. - if (drvr->bus_if->wowl_supported)
  12370. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  12371. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  12372. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  12373. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  12374. -@@ -21,11 +21,13 @@
  12375. - *
  12376. - * MBSS: multiple BSSID support (eg. guest network in AP mode).
  12377. - * MCHAN: multi-channel for concurrent P2P.
  12378. -+ * PNO: preferred network offload.
  12379. - * WOWL: Wake-On-WLAN.
  12380. - */
  12381. - #define BRCMF_FEAT_LIST \
  12382. - BRCMF_FEAT_DEF(MBSS) \
  12383. - BRCMF_FEAT_DEF(MCHAN) \
  12384. -+ BRCMF_FEAT_DEF(PNO) \
  12385. - BRCMF_FEAT_DEF(WOWL)
  12386. - /*
  12387. - * Quirks:
  12388. diff --git a/package/kernel/mac80211/patches/358-brcmfmac-add-support-for-BCM4324-rev-B5-chipset.patch b/package/kernel/mac80211/patches/358-brcmfmac-add-support-for-BCM4324-rev-B5-chipset.patch
  12389. deleted file mode 100644
  12390. index b859d46..0000000
  12391. --- a/package/kernel/mac80211/patches/358-brcmfmac-add-support-for-BCM4324-rev-B5-chipset.patch
  12392. +++ /dev/null
  12393. @@ -1,43 +0,0 @@
  12394. -From: Arend van Spriel <arend@broadcom.com>
  12395. -Date: Tue, 14 Apr 2015 20:10:28 +0200
  12396. -Subject: [PATCH] brcmfmac: add support for BCM4324 rev B5 chipset
  12397. -
  12398. -This patch adds support for the BCM4324 B5 revision. This device
  12399. -is similar to BCM43241 from driver and firmware perspective. It
  12400. -is known to be used in Lenovo Thinkpad Tablet devices.
  12401. -
  12402. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12403. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12404. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12405. ----
  12406. -
  12407. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12408. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12409. -@@ -601,6 +601,8 @@ static const struct sdiod_drive_str sdio
  12410. - #define BCM43241B0_NVRAM_NAME "brcm/brcmfmac43241b0-sdio.txt"
  12411. - #define BCM43241B4_FIRMWARE_NAME "brcm/brcmfmac43241b4-sdio.bin"
  12412. - #define BCM43241B4_NVRAM_NAME "brcm/brcmfmac43241b4-sdio.txt"
  12413. -+#define BCM43241B5_FIRMWARE_NAME "brcm/brcmfmac43241b5-sdio.bin"
  12414. -+#define BCM43241B5_NVRAM_NAME "brcm/brcmfmac43241b5-sdio.txt"
  12415. - #define BCM4329_FIRMWARE_NAME "brcm/brcmfmac4329-sdio.bin"
  12416. - #define BCM4329_NVRAM_NAME "brcm/brcmfmac4329-sdio.txt"
  12417. - #define BCM4330_FIRMWARE_NAME "brcm/brcmfmac4330-sdio.bin"
  12418. -@@ -628,6 +630,8 @@ MODULE_FIRMWARE(BCM43241B0_FIRMWARE_NAME
  12419. - MODULE_FIRMWARE(BCM43241B0_NVRAM_NAME);
  12420. - MODULE_FIRMWARE(BCM43241B4_FIRMWARE_NAME);
  12421. - MODULE_FIRMWARE(BCM43241B4_NVRAM_NAME);
  12422. -+MODULE_FIRMWARE(BCM43241B5_FIRMWARE_NAME);
  12423. -+MODULE_FIRMWARE(BCM43241B5_NVRAM_NAME);
  12424. - MODULE_FIRMWARE(BCM4329_FIRMWARE_NAME);
  12425. - MODULE_FIRMWARE(BCM4329_NVRAM_NAME);
  12426. - MODULE_FIRMWARE(BCM4330_FIRMWARE_NAME);
  12427. -@@ -667,7 +671,8 @@ enum brcmf_firmware_type {
  12428. - static const struct brcmf_firmware_names brcmf_fwname_data[] = {
  12429. - { BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43143) },
  12430. - { BRCM_CC_43241_CHIP_ID, 0x0000001F, BRCMF_FIRMWARE_NVRAM(BCM43241B0) },
  12431. -- { BRCM_CC_43241_CHIP_ID, 0xFFFFFFE0, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  12432. -+ { BRCM_CC_43241_CHIP_ID, 0x00000020, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  12433. -+ { BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43241B5) },
  12434. - { BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4329) },
  12435. - { BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4330) },
  12436. - { BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4334) },
  12437. diff --git a/package/kernel/mac80211/patches/359-brcmfmac-process-interrupt-regardless-sdiod-state.patch b/package/kernel/mac80211/patches/359-brcmfmac-process-interrupt-regardless-sdiod-state.patch
  12438. deleted file mode 100644
  12439. index d420308..0000000
  12440. --- a/package/kernel/mac80211/patches/359-brcmfmac-process-interrupt-regardless-sdiod-state.patch
  12441. +++ /dev/null
  12442. @@ -1,27 +0,0 @@
  12443. -From: Arend van Spriel <arend@broadcom.com>
  12444. -Date: Tue, 14 Apr 2015 20:10:29 +0200
  12445. -Subject: [PATCH] brcmfmac: process interrupt regardless sdiod state
  12446. -
  12447. -When the sdio bus state is not ready to process we abort the
  12448. -interrupt service routine. This is not wanted as it keeps the
  12449. -interrupt source active. Better clear the interrupt source.
  12450. -
  12451. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12452. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12453. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12454. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12455. ----
  12456. -
  12457. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12458. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12459. -@@ -3555,10 +3555,6 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  12460. - return;
  12461. - }
  12462. -
  12463. -- if (bus->sdiodev->state != BRCMF_SDIOD_DATA) {
  12464. -- brcmf_err("bus is down. we have nothing to do\n");
  12465. -- return;
  12466. -- }
  12467. - /* Count the interrupt call */
  12468. - bus->sdcnt.intrcount++;
  12469. - if (in_interrupt())
  12470. diff --git a/package/kernel/mac80211/patches/360-brcmfmac-fix-sdio-suspend-and-resume.patch b/package/kernel/mac80211/patches/360-brcmfmac-fix-sdio-suspend-and-resume.patch
  12471. deleted file mode 100644
  12472. index ac5584e..0000000
  12473. --- a/package/kernel/mac80211/patches/360-brcmfmac-fix-sdio-suspend-and-resume.patch
  12474. +++ /dev/null
  12475. @@ -1,68 +0,0 @@
  12476. -From: Arend van Spriel <arend@broadcom.com>
  12477. -Date: Tue, 14 Apr 2015 20:10:30 +0200
  12478. -Subject: [PATCH] brcmfmac: fix sdio suspend and resume
  12479. -
  12480. -commit 330b4e4be937 ("brcmfmac: Add wowl support for SDIO devices.")
  12481. -changed the behaviour by removing the MMC_PM_KEEP_POWER flag for
  12482. -non-wowl scenario, which needs to be restored. Another necessary
  12483. -change is to mark the card as being non-removable. With this in place
  12484. -the suspend resume test passes successfully doing:
  12485. -
  12486. - # echo devices > /sys/power/pm_test
  12487. - # echo mem > /sys/power/state
  12488. -
  12489. -Note that power may still be switched off when system is going
  12490. -in S3 state.
  12491. -
  12492. -Reported-by: Fu, Zhonghui <<zhonghui.fu@linux.intel.com>
  12493. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12494. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12495. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12496. ----
  12497. -
  12498. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  12499. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  12500. -@@ -1011,6 +1011,14 @@ static int brcmf_sdiod_remove(struct brc
  12501. - return 0;
  12502. - }
  12503. -
  12504. -+static void brcmf_sdiod_host_fixup(struct mmc_host *host)
  12505. -+{
  12506. -+ /* runtime-pm powers off the device */
  12507. -+ pm_runtime_forbid(host->parent);
  12508. -+ /* avoid removal detection upon resume */
  12509. -+ host->caps |= MMC_CAP_NONREMOVABLE;
  12510. -+}
  12511. -+
  12512. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  12513. - {
  12514. - struct sdio_func *func;
  12515. -@@ -1076,7 +1084,7 @@ static int brcmf_sdiod_probe(struct brcm
  12516. - ret = -ENODEV;
  12517. - goto out;
  12518. - }
  12519. -- pm_runtime_forbid(host->parent);
  12520. -+ brcmf_sdiod_host_fixup(host);
  12521. - out:
  12522. - if (ret)
  12523. - brcmf_sdiod_remove(sdiodev);
  12524. -@@ -1246,15 +1254,15 @@ static int brcmf_ops_sdio_suspend(struct
  12525. - brcmf_sdiod_freezer_on(sdiodev);
  12526. - brcmf_sdio_wd_timer(sdiodev->bus, 0);
  12527. -
  12528. -+ sdio_flags = MMC_PM_KEEP_POWER;
  12529. - if (sdiodev->wowl_enabled) {
  12530. -- sdio_flags = MMC_PM_KEEP_POWER;
  12531. - if (sdiodev->pdata->oob_irq_supported)
  12532. - enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  12533. - else
  12534. -- sdio_flags = MMC_PM_WAKE_SDIO_IRQ;
  12535. -- if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  12536. -- brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  12537. -+ sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
  12538. - }
  12539. -+ if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  12540. -+ brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  12541. - return 0;
  12542. - }
  12543. -
  12544. diff --git a/package/kernel/mac80211/patches/361-brcmfmac-add-support-for-BCM4358-PCIe-device.patch b/package/kernel/mac80211/patches/361-brcmfmac-add-support-for-BCM4358-PCIe-device.patch
  12545. deleted file mode 100644
  12546. index a521b65..0000000
  12547. --- a/package/kernel/mac80211/patches/361-brcmfmac-add-support-for-BCM4358-PCIe-device.patch
  12548. +++ /dev/null
  12549. @@ -1,77 +0,0 @@
  12550. -From: Arend van Spriel <arend@broadcom.com>
  12551. -Date: Tue, 14 Apr 2015 20:10:31 +0200
  12552. -Subject: [PATCH] brcmfmac: add support for BCM4358 PCIe device
  12553. -
  12554. -This patch adds support for the BCM4358 2x2 11ac device.
  12555. -
  12556. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12557. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12558. ----
  12559. -
  12560. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  12561. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  12562. -@@ -649,6 +649,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  12563. - case BRCM_CC_43567_CHIP_ID:
  12564. - case BRCM_CC_43569_CHIP_ID:
  12565. - case BRCM_CC_43570_CHIP_ID:
  12566. -+ case BRCM_CC_4358_CHIP_ID:
  12567. - case BRCM_CC_43602_CHIP_ID:
  12568. - return 0x180000;
  12569. - default:
  12570. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12571. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12572. -@@ -51,6 +51,8 @@ enum brcmf_pcie_state {
  12573. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  12574. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  12575. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  12576. -+#define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  12577. -+#define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  12578. -
  12579. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  12580. -
  12581. -@@ -189,6 +191,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME)
  12582. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  12583. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  12584. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  12585. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  12586. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  12587. -
  12588. -
  12589. - struct brcmf_pcie_console {
  12590. -@@ -1333,6 +1337,10 @@ static int brcmf_pcie_get_fwnames(struct
  12591. - fw_name = BRCMF_PCIE_43570_FW_NAME;
  12592. - nvram_name = BRCMF_PCIE_43570_NVRAM_NAME;
  12593. - break;
  12594. -+ case BRCM_CC_4358_CHIP_ID:
  12595. -+ fw_name = BRCMF_PCIE_4358_FW_NAME;
  12596. -+ nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  12597. -+ break;
  12598. - default:
  12599. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  12600. - return -ENODEV;
  12601. -@@ -1850,6 +1858,7 @@ static struct pci_device_id brcmf_pcie_d
  12602. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  12603. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  12604. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  12605. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID),
  12606. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  12607. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  12608. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  12609. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  12610. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  12611. -@@ -45,6 +45,7 @@
  12612. - #define BRCM_CC_43567_CHIP_ID 43567
  12613. - #define BRCM_CC_43569_CHIP_ID 43569
  12614. - #define BRCM_CC_43570_CHIP_ID 43570
  12615. -+#define BRCM_CC_4358_CHIP_ID 0x4358
  12616. - #define BRCM_CC_43602_CHIP_ID 43602
  12617. -
  12618. - /* USB Device IDs */
  12619. -@@ -59,6 +60,7 @@
  12620. - #define BRCM_PCIE_4356_DEVICE_ID 0x43ec
  12621. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  12622. - #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
  12623. -+#define BRCM_PCIE_4358_DEVICE_ID 0x43e9
  12624. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  12625. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  12626. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  12627. diff --git a/package/kernel/mac80211/patches/362-brcmfmac-add-additional-43602-pcie-device-id.patch b/package/kernel/mac80211/patches/362-brcmfmac-add-additional-43602-pcie-device-id.patch
  12628. deleted file mode 100644
  12629. index bcbb984..0000000
  12630. --- a/package/kernel/mac80211/patches/362-brcmfmac-add-additional-43602-pcie-device-id.patch
  12631. +++ /dev/null
  12632. @@ -1,30 +0,0 @@
  12633. -From: Hante Meuleman <meuleman@broadcom.com>
  12634. -Date: Tue, 14 Apr 2015 20:10:32 +0200
  12635. -Subject: [PATCH] brcmfmac: add additional 43602 pcie device id.
  12636. -
  12637. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12638. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12639. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12640. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12641. ----
  12642. -
  12643. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12644. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12645. -@@ -1862,6 +1862,7 @@ static struct pci_device_id brcmf_pcie_d
  12646. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  12647. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  12648. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  12649. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID),
  12650. - { /* end: all zeroes */ }
  12651. - };
  12652. -
  12653. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  12654. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  12655. -@@ -64,6 +64,7 @@
  12656. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  12657. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  12658. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  12659. -+#define BRCM_PCIE_43602_RAW_DEVICE_ID 43602
  12660. -
  12661. - /* brcmsmac IDs */
  12662. - #define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
  12663. diff --git a/package/kernel/mac80211/patches/363-brcmfmac-Add-support-for-multiple-PCIE-devices-in-nv.patch b/package/kernel/mac80211/patches/363-brcmfmac-Add-support-for-multiple-PCIE-devices-in-nv.patch
  12664. deleted file mode 100644
  12665. index 5f9bbea..0000000
  12666. --- a/package/kernel/mac80211/patches/363-brcmfmac-Add-support-for-multiple-PCIE-devices-in-nv.patch
  12667. +++ /dev/null
  12668. @@ -1,351 +0,0 @@
  12669. -From: Hante Meuleman <meuleman@broadcom.com>
  12670. -Date: Tue, 14 Apr 2015 20:10:33 +0200
  12671. -Subject: [PATCH] brcmfmac: Add support for multiple PCIE devices in
  12672. - nvram.
  12673. -
  12674. -With PCIE it is possible to support multiple devices with the
  12675. -same device type. They all load the same nvram file. In order to
  12676. -support this the nvram can specify which part of the nvram is
  12677. -for which pcie device. This patch adds support for these new
  12678. -types of nvram files.
  12679. -
  12680. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12681. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12682. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12683. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  12684. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12685. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12686. ----
  12687. -
  12688. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  12689. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  12690. -@@ -23,6 +23,10 @@
  12691. - #include "debug.h"
  12692. - #include "firmware.h"
  12693. -
  12694. -+#define BRCMF_FW_MAX_NVRAM_SIZE 64000
  12695. -+#define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  12696. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  12697. -+
  12698. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  12699. - module_param_string(firmware_path, brcmf_firmware_path,
  12700. - BRCMF_FW_PATH_LEN, 0440);
  12701. -@@ -46,6 +50,8 @@ enum nvram_parser_state {
  12702. - * @column: current column in line.
  12703. - * @pos: byte offset in input buffer.
  12704. - * @entry: start position of key,value entry.
  12705. -+ * @multi_dev_v1: detect pcie multi device v1 (compressed).
  12706. -+ * @multi_dev_v2: detect pcie multi device v2.
  12707. - */
  12708. - struct nvram_parser {
  12709. - enum nvram_parser_state state;
  12710. -@@ -56,6 +62,8 @@ struct nvram_parser {
  12711. - u32 column;
  12712. - u32 pos;
  12713. - u32 entry;
  12714. -+ bool multi_dev_v1;
  12715. -+ bool multi_dev_v2;
  12716. - };
  12717. -
  12718. - static bool is_nvram_char(char c)
  12719. -@@ -108,6 +116,10 @@ static enum nvram_parser_state brcmf_nvr
  12720. - st = COMMENT;
  12721. - else
  12722. - st = VALUE;
  12723. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  12724. -+ nvp->multi_dev_v1 = true;
  12725. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  12726. -+ nvp->multi_dev_v2 = true;
  12727. - } else if (!is_nvram_char(c)) {
  12728. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  12729. - nvp->line, nvp->column);
  12730. -@@ -133,6 +145,8 @@ brcmf_nvram_handle_value(struct nvram_pa
  12731. - ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  12732. - skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  12733. - cplen = ekv - skv;
  12734. -+ if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  12735. -+ return END;
  12736. - /* copy to output buffer */
  12737. - memcpy(&nvp->nvram[nvp->nvram_len], skv, cplen);
  12738. - nvp->nvram_len += cplen;
  12739. -@@ -180,10 +194,18 @@ static enum nvram_parser_state
  12740. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  12741. - const struct firmware *nv)
  12742. - {
  12743. -+ size_t size;
  12744. -+
  12745. - memset(nvp, 0, sizeof(*nvp));
  12746. - nvp->fwnv = nv;
  12747. -+ /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  12748. -+ if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  12749. -+ size = BRCMF_FW_MAX_NVRAM_SIZE;
  12750. -+ else
  12751. -+ size = nv->size;
  12752. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  12753. -- nvp->nvram = kzalloc(nv->size + 1 + 3 + sizeof(u32), GFP_KERNEL);
  12754. -+ size += 1 + 3 + sizeof(u32);
  12755. -+ nvp->nvram = kzalloc(size, GFP_KERNEL);
  12756. - if (!nvp->nvram)
  12757. - return -ENOMEM;
  12758. -
  12759. -@@ -192,12 +214,136 @@ static int brcmf_init_nvram_parser(struc
  12760. - return 0;
  12761. - }
  12762. -
  12763. -+/* brcmf_fw_strip_multi_v1 :Some nvram files contain settings for multiple
  12764. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  12765. -+ * which data is to be returned. v1 is the version where nvram is stored
  12766. -+ * compressed and "devpath" maps to index for valid entries.
  12767. -+ */
  12768. -+static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  12769. -+ u16 bus_nr)
  12770. -+{
  12771. -+ u32 i, j;
  12772. -+ bool found;
  12773. -+ u8 *nvram;
  12774. -+ u8 id;
  12775. -+
  12776. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  12777. -+ if (!nvram)
  12778. -+ goto fail;
  12779. -+
  12780. -+ /* min length: devpath0=pcie/1/4/ + 0:x=y */
  12781. -+ if (nvp->nvram_len < BRCMF_FW_NVRAM_DEVPATH_LEN + 6)
  12782. -+ goto fail;
  12783. -+
  12784. -+ /* First search for the devpathX and see if it is the configuration
  12785. -+ * for domain_nr/bus_nr. Search complete nvp
  12786. -+ */
  12787. -+ found = false;
  12788. -+ i = 0;
  12789. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  12790. -+ /* Format: devpathX=pcie/Y/Z/
  12791. -+ * Y = domain_nr, Z = bus_nr, X = virtual ID
  12792. -+ */
  12793. -+ if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  12794. -+ (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  12795. -+ if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  12796. -+ ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  12797. -+ id = nvp->nvram[i + 7] - '0';
  12798. -+ found = true;
  12799. -+ break;
  12800. -+ }
  12801. -+ }
  12802. -+ while (nvp->nvram[i] != 0)
  12803. -+ i++;
  12804. -+ i++;
  12805. -+ }
  12806. -+ if (!found)
  12807. -+ goto fail;
  12808. -+
  12809. -+ /* Now copy all valid entries, release old nvram and assign new one */
  12810. -+ i = 0;
  12811. -+ j = 0;
  12812. -+ while (i < nvp->nvram_len) {
  12813. -+ if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  12814. -+ i += 2;
  12815. -+ while (nvp->nvram[i] != 0) {
  12816. -+ nvram[j] = nvp->nvram[i];
  12817. -+ i++;
  12818. -+ j++;
  12819. -+ }
  12820. -+ nvram[j] = 0;
  12821. -+ j++;
  12822. -+ }
  12823. -+ while (nvp->nvram[i] != 0)
  12824. -+ i++;
  12825. -+ i++;
  12826. -+ }
  12827. -+ kfree(nvp->nvram);
  12828. -+ nvp->nvram = nvram;
  12829. -+ nvp->nvram_len = j;
  12830. -+ return;
  12831. -+
  12832. -+fail:
  12833. -+ kfree(nvram);
  12834. -+ nvp->nvram_len = 0;
  12835. -+}
  12836. -+
  12837. -+/* brcmf_fw_strip_multi_v2 :Some nvram files contain settings for multiple
  12838. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  12839. -+ * which data is to be returned. v2 is the version where nvram is stored
  12840. -+ * uncompressed, all relevant valid entries are identified by
  12841. -+ * pcie/domain_nr/bus_nr:
  12842. -+ */
  12843. -+static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  12844. -+ u16 bus_nr)
  12845. -+{
  12846. -+ u32 i, j;
  12847. -+ u8 *nvram;
  12848. -+
  12849. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  12850. -+ if (!nvram)
  12851. -+ goto fail;
  12852. -+
  12853. -+ /* Copy all valid entries, release old nvram and assign new one.
  12854. -+ * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  12855. -+ * Y = bus_nr.
  12856. -+ */
  12857. -+ i = 0;
  12858. -+ j = 0;
  12859. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  12860. -+ if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  12861. -+ (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  12862. -+ ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  12863. -+ ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  12864. -+ i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  12865. -+ while (nvp->nvram[i] != 0) {
  12866. -+ nvram[j] = nvp->nvram[i];
  12867. -+ i++;
  12868. -+ j++;
  12869. -+ }
  12870. -+ nvram[j] = 0;
  12871. -+ j++;
  12872. -+ }
  12873. -+ while (nvp->nvram[i] != 0)
  12874. -+ i++;
  12875. -+ i++;
  12876. -+ }
  12877. -+ kfree(nvp->nvram);
  12878. -+ nvp->nvram = nvram;
  12879. -+ nvp->nvram_len = j;
  12880. -+ return;
  12881. -+fail:
  12882. -+ kfree(nvram);
  12883. -+ nvp->nvram_len = 0;
  12884. -+}
  12885. -+
  12886. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  12887. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  12888. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  12889. - * End of buffer is completed with token identifying length of buffer.
  12890. - */
  12891. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length)
  12892. -+static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  12893. -+ u16 domain_nr, u16 bus_nr)
  12894. - {
  12895. - struct nvram_parser nvp;
  12896. - u32 pad;
  12897. -@@ -212,6 +358,16 @@ static void *brcmf_fw_nvram_strip(const
  12898. - if (nvp.state == END)
  12899. - break;
  12900. - }
  12901. -+ if (nvp.multi_dev_v1)
  12902. -+ brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  12903. -+ else if (nvp.multi_dev_v2)
  12904. -+ brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  12905. -+
  12906. -+ if (nvp.nvram_len == 0) {
  12907. -+ kfree(nvp.nvram);
  12908. -+ return NULL;
  12909. -+ }
  12910. -+
  12911. - pad = nvp.nvram_len;
  12912. - *new_length = roundup(nvp.nvram_len + 1, 4);
  12913. - while (pad != *new_length) {
  12914. -@@ -239,6 +395,8 @@ struct brcmf_fw {
  12915. - u16 flags;
  12916. - const struct firmware *code;
  12917. - const char *nvram_name;
  12918. -+ u16 domain_nr;
  12919. -+ u16 bus_nr;
  12920. - void (*done)(struct device *dev, const struct firmware *fw,
  12921. - void *nvram_image, u32 nvram_len);
  12922. - };
  12923. -@@ -254,7 +412,8 @@ static void brcmf_fw_request_nvram_done(
  12924. - goto fail;
  12925. -
  12926. - if (fw) {
  12927. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length);
  12928. -+ nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  12929. -+ fwctx->domain_nr, fwctx->bus_nr);
  12930. - release_firmware(fw);
  12931. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  12932. - goto fail;
  12933. -@@ -309,11 +468,12 @@ fail:
  12934. - kfree(fwctx);
  12935. - }
  12936. -
  12937. --int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  12938. -- const char *code, const char *nvram,
  12939. -- void (*fw_cb)(struct device *dev,
  12940. -- const struct firmware *fw,
  12941. -- void *nvram_image, u32 nvram_len))
  12942. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  12943. -+ const char *code, const char *nvram,
  12944. -+ void (*fw_cb)(struct device *dev,
  12945. -+ const struct firmware *fw,
  12946. -+ void *nvram_image, u32 nvram_len),
  12947. -+ u16 domain_nr, u16 bus_nr)
  12948. - {
  12949. - struct brcmf_fw *fwctx;
  12950. -
  12951. -@@ -333,8 +493,21 @@ int brcmf_fw_get_firmwares(struct device
  12952. - fwctx->done = fw_cb;
  12953. - if (flags & BRCMF_FW_REQUEST_NVRAM)
  12954. - fwctx->nvram_name = nvram;
  12955. -+ fwctx->domain_nr = domain_nr;
  12956. -+ fwctx->bus_nr = bus_nr;
  12957. -
  12958. - return request_firmware_nowait(THIS_MODULE, true, code, dev,
  12959. - GFP_KERNEL, fwctx,
  12960. - brcmf_fw_request_code_done);
  12961. - }
  12962. -+
  12963. -+int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  12964. -+ const char *code, const char *nvram,
  12965. -+ void (*fw_cb)(struct device *dev,
  12966. -+ const struct firmware *fw,
  12967. -+ void *nvram_image, u32 nvram_len))
  12968. -+{
  12969. -+ return brcmf_fw_get_firmwares_pcie(dev, flags, code, nvram, fw_cb, 0,
  12970. -+ 0);
  12971. -+}
  12972. -+
  12973. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  12974. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  12975. -@@ -32,6 +32,12 @@ void brcmf_fw_nvram_free(void *nvram);
  12976. - * fails it will not use the callback, but call device_release_driver()
  12977. - * instead which will call the driver .remove() callback.
  12978. - */
  12979. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  12980. -+ const char *code, const char *nvram,
  12981. -+ void (*fw_cb)(struct device *dev,
  12982. -+ const struct firmware *fw,
  12983. -+ void *nvram_image, u32 nvram_len),
  12984. -+ u16 domain_nr, u16 bus_nr);
  12985. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  12986. - const char *code, const char *nvram,
  12987. - void (*fw_cb)(struct device *dev,
  12988. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12989. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12990. -@@ -1649,8 +1649,13 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  12991. - struct brcmf_pciedev_info *devinfo;
  12992. - struct brcmf_pciedev *pcie_bus_dev;
  12993. - struct brcmf_bus *bus;
  12994. -+ u16 domain_nr;
  12995. -+ u16 bus_nr;
  12996. -
  12997. -- brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device);
  12998. -+ domain_nr = pci_domain_nr(pdev->bus) + 1;
  12999. -+ bus_nr = pdev->bus->number;
  13000. -+ brcmf_dbg(PCIE, "Enter %x:%x (%d/%d)\n", pdev->vendor, pdev->device,
  13001. -+ domain_nr, bus_nr);
  13002. -
  13003. - ret = -ENOMEM;
  13004. - devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL);
  13005. -@@ -1699,10 +1704,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  13006. - if (ret)
  13007. - goto fail_bus;
  13008. -
  13009. -- ret = brcmf_fw_get_firmwares(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  13010. -- BRCMF_FW_REQ_NV_OPTIONAL,
  13011. -- devinfo->fw_name, devinfo->nvram_name,
  13012. -- brcmf_pcie_setup);
  13013. -+ ret = brcmf_fw_get_firmwares_pcie(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  13014. -+ BRCMF_FW_REQ_NV_OPTIONAL,
  13015. -+ devinfo->fw_name, devinfo->nvram_name,
  13016. -+ brcmf_pcie_setup, domain_nr, bus_nr);
  13017. - if (ret == 0)
  13018. - return 0;
  13019. - fail_bus:
  13020. diff --git a/package/kernel/mac80211/patches/364-brcmfmac-cleanup-a-sizeof.patch b/package/kernel/mac80211/patches/364-brcmfmac-cleanup-a-sizeof.patch
  13021. deleted file mode 100644
  13022. index d26e118..0000000
  13023. --- a/package/kernel/mac80211/patches/364-brcmfmac-cleanup-a-sizeof.patch
  13024. +++ /dev/null
  13025. @@ -1,23 +0,0 @@
  13026. -From: Dan Carpenter <dan.carpenter@oracle.com>
  13027. -Date: Thu, 7 May 2015 12:59:19 +0300
  13028. -Subject: [PATCH] brcmfmac: cleanup a sizeof()
  13029. -
  13030. -"flowrings" and "*flowrings" are both pointers so this always returns
  13031. -sizeof(void *) and the current code works fine. But "*flowrings" is
  13032. -intended here and static checkers complain, so lets change it.
  13033. -
  13034. -Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  13035. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13036. ----
  13037. -
  13038. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13039. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13040. -@@ -1617,7 +1617,7 @@ static void brcmf_pcie_setup(struct devi
  13041. - bus->msgbuf->commonrings[i] =
  13042. - &devinfo->shared.commonrings[i]->commonring;
  13043. -
  13044. -- flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(flowrings),
  13045. -+ flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*flowrings),
  13046. - GFP_KERNEL);
  13047. - if (!flowrings)
  13048. - goto fail;
  13049. diff --git a/package/kernel/mac80211/patches/365-brcmfmac-check-result-of-USB-firmware-request.patch b/package/kernel/mac80211/patches/365-brcmfmac-check-result-of-USB-firmware-request.patch
  13050. deleted file mode 100644
  13051. index 9b2880d..0000000
  13052. --- a/package/kernel/mac80211/patches/365-brcmfmac-check-result-of-USB-firmware-request.patch
  13053. +++ /dev/null
  13054. @@ -1,33 +0,0 @@
  13055. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  13056. -Date: Thu, 7 May 2015 14:13:03 +0200
  13057. -Subject: [PATCH] brcmfmac: check result of USB firmware request
  13058. -MIME-Version: 1.0
  13059. -Content-Type: text/plain; charset=UTF-8
  13060. -Content-Transfer-Encoding: 8bit
  13061. -
  13062. -This prevents silence failures with driver waiting (infinitely) for a
  13063. -callback.
  13064. -
  13065. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13066. -Acked-by: Arend van Spriel <arend@broadcom.com>
  13067. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13068. ----
  13069. -
  13070. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  13071. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  13072. -@@ -1270,8 +1270,13 @@ static int brcmf_usb_probe_cb(struct brc
  13073. - bus->chiprev = bus_pub->chiprev;
  13074. -
  13075. - /* request firmware here */
  13076. -- brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL,
  13077. -- brcmf_usb_probe_phase2);
  13078. -+ ret = brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo),
  13079. -+ NULL, brcmf_usb_probe_phase2);
  13080. -+ if (ret) {
  13081. -+ brcmf_err("firmware request failed: %d\n", ret);
  13082. -+ goto fail;
  13083. -+ }
  13084. -+
  13085. - return 0;
  13086. -
  13087. - fail:
  13088. diff --git a/package/kernel/mac80211/patches/366-brcmfmac-prohibit-ACPI-power-management-for-brcmfmac.patch b/package/kernel/mac80211/patches/366-brcmfmac-prohibit-ACPI-power-management-for-brcmfmac.patch
  13089. deleted file mode 100644
  13090. index d46b300..0000000
  13091. --- a/package/kernel/mac80211/patches/366-brcmfmac-prohibit-ACPI-power-management-for-brcmfmac.patch
  13092. +++ /dev/null
  13093. @@ -1,47 +0,0 @@
  13094. -From: "Fu, Zhonghui" <zhonghui.fu@linux.intel.com>
  13095. -Date: Mon, 11 May 2015 10:41:32 +0800
  13096. -Subject: [PATCH] brcmfmac: prohibit ACPI power management for brcmfmac driver
  13097. -
  13098. -ACPI will manage WiFi chip's power state during suspend/resume
  13099. -process on some tablet platforms(such as ASUS T100TA). This is
  13100. -not supported by brcmfmac driver now, and the context of WiFi
  13101. -chip will be damaged after resume. This patch informs ACPI not
  13102. -to manage WiFi chip's power state.
  13103. -
  13104. -Signed-off-by: Zhonghui Fu <zhonghui.fu@linux.intel.com>
  13105. -Acked-by: Arend van Spriel <arend@broadcom.com>
  13106. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13107. ----
  13108. -
  13109. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13110. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13111. -@@ -33,6 +33,7 @@
  13112. - #include <linux/suspend.h>
  13113. - #include <linux/errno.h>
  13114. - #include <linux/module.h>
  13115. -+#include <linux/acpi.h>
  13116. - #include <net/cfg80211.h>
  13117. -
  13118. - #include <defs.h>
  13119. -@@ -1122,6 +1123,8 @@ static int brcmf_ops_sdio_probe(struct s
  13120. - int err;
  13121. - struct brcmf_sdio_dev *sdiodev;
  13122. - struct brcmf_bus *bus_if;
  13123. -+ struct device *dev;
  13124. -+ struct acpi_device *adev;
  13125. -
  13126. - brcmf_dbg(SDIO, "Enter\n");
  13127. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  13128. -@@ -1129,6 +1132,12 @@ static int brcmf_ops_sdio_probe(struct s
  13129. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  13130. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  13131. -
  13132. -+ /* prohibit ACPI power management for this device */
  13133. -+ dev = &func->dev;
  13134. -+ adev = ACPI_COMPANION(dev);
  13135. -+ if (adev)
  13136. -+ adev->flags.power_manageable = 0;
  13137. -+
  13138. - /* Consume func num 1 but dont do anything with it. */
  13139. - if (func->num == 1)
  13140. - return 0;
  13141. diff --git a/package/kernel/mac80211/patches/367-brcmfmac-avoid-gcc-5.1-warning.patch b/package/kernel/mac80211/patches/367-brcmfmac-avoid-gcc-5.1-warning.patch
  13142. deleted file mode 100644
  13143. index 9b4609f..0000000
  13144. --- a/package/kernel/mac80211/patches/367-brcmfmac-avoid-gcc-5.1-warning.patch
  13145. +++ /dev/null
  13146. @@ -1,30 +0,0 @@
  13147. -From: Arnd Bergmann <arnd@arndb.de>
  13148. -Date: Tue, 12 May 2015 23:54:25 +0200
  13149. -Subject: [PATCH] brcmfmac: avoid gcc-5.1 warning
  13150. -
  13151. -gcc-5.0 gained a new warning in the fwsignal portion of the brcmfmac
  13152. -driver:
  13153. -
  13154. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c: In function 'brcmf_fws_txs_process':
  13155. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c:1478:8: warning: 'skb' may be used uninitialized in this function [-Wmaybe-uninitialized]
  13156. -
  13157. -This is a false positive, and marking the brcmf_fws_hanger_poppkt function
  13158. -as 'static inline' makes the warning go away. I have checked the object
  13159. -file output and while a little code gets moved around, the size of
  13160. -the binary remains identical.
  13161. -
  13162. -Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  13163. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13164. ----
  13165. -
  13166. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  13167. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  13168. -@@ -635,7 +635,7 @@ static int brcmf_fws_hanger_pushpkt(stru
  13169. - return 0;
  13170. - }
  13171. -
  13172. --static int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  13173. -+static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  13174. - u32 slot_id, struct sk_buff **pktout,
  13175. - bool remove_item)
  13176. - {
  13177. diff --git a/package/kernel/mac80211/patches/368-brcmfmac-allow-device-tree-node-without-interrupts-p.patch b/package/kernel/mac80211/patches/368-brcmfmac-allow-device-tree-node-without-interrupts-p.patch
  13178. deleted file mode 100644
  13179. index b16782d..0000000
  13180. --- a/package/kernel/mac80211/patches/368-brcmfmac-allow-device-tree-node-without-interrupts-p.patch
  13181. +++ /dev/null
  13182. @@ -1,45 +0,0 @@
  13183. -From: Arend van Spriel <arend@broadcom.com>
  13184. -Date: Wed, 20 May 2015 14:09:47 +0200
  13185. -Subject: [PATCH] brcmfmac: allow device tree node without 'interrupts'
  13186. - property
  13187. -
  13188. -As described in the device tree bindings for 'brcm,bcm4329-fmac'
  13189. -nodes, the interrupts property is optional. So adding a check
  13190. -for the presence of this property before attempting to parse
  13191. -and map the interrupt. If not present or parsing fails return
  13192. -and fallback to in-band sdio interrupt.
  13193. -
  13194. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13195. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13196. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13197. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13198. ----
  13199. -
  13200. ---- a/drivers/net/wireless/brcm80211/brcmfmac/of.c
  13201. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c
  13202. -@@ -39,10 +39,16 @@ void brcmf_of_probe(struct brcmf_sdio_de
  13203. - if (!sdiodev->pdata)
  13204. - return;
  13205. -
  13206. -+ if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  13207. -+ sdiodev->pdata->drive_strength = val;
  13208. -+
  13209. -+ /* make sure there are interrupts defined in the node */
  13210. -+ if (!of_find_property(np, "interrupts", NULL))
  13211. -+ return;
  13212. -+
  13213. - irq = irq_of_parse_and_map(np, 0);
  13214. - if (!irq) {
  13215. - brcmf_err("interrupt could not be mapped\n");
  13216. -- devm_kfree(dev, sdiodev->pdata);
  13217. - return;
  13218. - }
  13219. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  13220. -@@ -50,7 +56,4 @@ void brcmf_of_probe(struct brcmf_sdio_de
  13221. - sdiodev->pdata->oob_irq_supported = true;
  13222. - sdiodev->pdata->oob_irq_nr = irq;
  13223. - sdiodev->pdata->oob_irq_flags = irqf;
  13224. --
  13225. -- if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  13226. -- sdiodev->pdata->drive_strength = val;
  13227. - }
  13228. diff --git a/package/kernel/mac80211/patches/369-brcmfmac-Improve-throughput-by-scheduling-msbug-flow.patch b/package/kernel/mac80211/patches/369-brcmfmac-Improve-throughput-by-scheduling-msbug-flow.patch
  13229. deleted file mode 100644
  13230. index f81250e..0000000
  13231. --- a/package/kernel/mac80211/patches/369-brcmfmac-Improve-throughput-by-scheduling-msbug-flow.patch
  13232. +++ /dev/null
  13233. @@ -1,87 +0,0 @@
  13234. -From: Hante Meuleman <meuleman@broadcom.com>
  13235. -Date: Wed, 20 May 2015 14:09:48 +0200
  13236. -Subject: [PATCH] brcmfmac: Improve throughput by scheduling msbug flow worker.
  13237. -
  13238. -The tx flow worker in msgbuf gets scheduled at tx till a certain
  13239. -threshold has been reached. Then the tx completes will take over
  13240. -the scheduling. When amsdu and ampdu is used the frames are
  13241. -transferred wireless in a very bulky fashion, in combination
  13242. -with this scheduling algorithm and buffer limiters in the stack
  13243. -this can result in limited throughput. This change causes the
  13244. -flow worker to be scheduled more frequently from tx.
  13245. -
  13246. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13247. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13248. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13249. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13250. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13251. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13252. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13253. ----
  13254. -
  13255. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  13256. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  13257. -@@ -249,8 +249,8 @@ void brcmf_flowring_delete(struct brcmf_
  13258. - }
  13259. -
  13260. -
  13261. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  13262. -- struct sk_buff *skb)
  13263. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  13264. -+ struct sk_buff *skb)
  13265. - {
  13266. - struct brcmf_flowring_ring *ring;
  13267. -
  13268. -@@ -271,6 +271,7 @@ void brcmf_flowring_enqueue(struct brcmf
  13269. - if (skb_queue_len(&ring->skblist) < BRCMF_FLOWRING_LOW)
  13270. - brcmf_flowring_block(flow, flowid, false);
  13271. - }
  13272. -+ return skb_queue_len(&ring->skblist);
  13273. - }
  13274. -
  13275. -
  13276. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  13277. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  13278. -@@ -64,8 +64,8 @@ u32 brcmf_flowring_create(struct brcmf_f
  13279. - void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  13280. - void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  13281. - u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  13282. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  13283. -- struct sk_buff *skb);
  13284. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  13285. -+ struct sk_buff *skb);
  13286. - struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  13287. - void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  13288. - struct sk_buff *skb);
  13289. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  13290. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  13291. -@@ -73,7 +73,7 @@
  13292. - #define BRCMF_MSGBUF_TX_FLUSH_CNT1 32
  13293. - #define BRCMF_MSGBUF_TX_FLUSH_CNT2 96
  13294. -
  13295. --#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 64
  13296. -+#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  13297. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  13298. -
  13299. - struct msgbuf_common_hdr {
  13300. -@@ -797,6 +797,8 @@ static int brcmf_msgbuf_txdata(struct br
  13301. - struct brcmf_flowring *flow = msgbuf->flow;
  13302. - struct ethhdr *eh = (struct ethhdr *)(skb->data);
  13303. - u32 flowid;
  13304. -+ u32 queue_count;
  13305. -+ bool force;
  13306. -
  13307. - flowid = brcmf_flowring_lookup(flow, eh->h_dest, skb->priority, ifidx);
  13308. - if (flowid == BRCMF_FLOWRING_INVALID_ID) {
  13309. -@@ -804,8 +806,9 @@ static int brcmf_msgbuf_txdata(struct br
  13310. - if (flowid == BRCMF_FLOWRING_INVALID_ID)
  13311. - return -ENOMEM;
  13312. - }
  13313. -- brcmf_flowring_enqueue(flow, flowid, skb);
  13314. -- brcmf_msgbuf_schedule_txdata(msgbuf, flowid, false);
  13315. -+ queue_count = brcmf_flowring_enqueue(flow, flowid, skb);
  13316. -+ force = ((queue_count % BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS) == 0);
  13317. -+ brcmf_msgbuf_schedule_txdata(msgbuf, flowid, force);
  13318. -
  13319. - return 0;
  13320. - }
  13321. diff --git a/package/kernel/mac80211/patches/370-brcmfmac-remove-pci-shared-structure-rev4-support.patch b/package/kernel/mac80211/patches/370-brcmfmac-remove-pci-shared-structure-rev4-support.patch
  13322. deleted file mode 100644
  13323. index 61153c4..0000000
  13324. --- a/package/kernel/mac80211/patches/370-brcmfmac-remove-pci-shared-structure-rev4-support.patch
  13325. +++ /dev/null
  13326. @@ -1,41 +0,0 @@
  13327. -From: Franky Lin <frankyl@broadcom.com>
  13328. -Date: Wed, 20 May 2015 14:09:49 +0200
  13329. -Subject: [PATCH] brcmfmac: remove pci shared structure rev4 support
  13330. -
  13331. -All pcie full dongle chips supported by fmac are using rev 5+ shared
  13332. -structure. This patch removes the rev4 related code.
  13333. -
  13334. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13335. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13336. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13337. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  13338. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13339. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13340. ----
  13341. -
  13342. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13343. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13344. -@@ -112,10 +112,9 @@ enum brcmf_pcie_state {
  13345. - BRCMF_PCIE_MB_INT_D2H3_DB0 | \
  13346. - BRCMF_PCIE_MB_INT_D2H3_DB1)
  13347. -
  13348. --#define BRCMF_PCIE_MIN_SHARED_VERSION 4
  13349. -+#define BRCMF_PCIE_MIN_SHARED_VERSION 5
  13350. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  13351. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  13352. --#define BRCMF_PCIE_SHARED_TXPUSH_SUPPORT 0x4000
  13353. -
  13354. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  13355. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  13356. -@@ -1280,11 +1279,6 @@ brcmf_pcie_init_share_ram_info(struct br
  13357. - brcmf_err("Unsupported PCIE version %d\n", version);
  13358. - return -EINVAL;
  13359. - }
  13360. -- if (shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT) {
  13361. -- brcmf_err("Unsupported legacy TX mode 0x%x\n",
  13362. -- shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT);
  13363. -- return -EINVAL;
  13364. -- }
  13365. -
  13366. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  13367. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  13368. diff --git a/package/kernel/mac80211/patches/371-brcmfmac-remove-dummy-cache-flush-invalidate-functio.patch b/package/kernel/mac80211/patches/371-brcmfmac-remove-dummy-cache-flush-invalidate-functio.patch
  13369. deleted file mode 100644
  13370. index 8c8eebe..0000000
  13371. --- a/package/kernel/mac80211/patches/371-brcmfmac-remove-dummy-cache-flush-invalidate-functio.patch
  13372. +++ /dev/null
  13373. @@ -1,120 +0,0 @@
  13374. -From: Franky Lin <frankyl@broadcom.com>
  13375. -Date: Wed, 20 May 2015 14:09:50 +0200
  13376. -Subject: [PATCH] brcmfmac: remove dummy cache flush/invalidate function
  13377. -
  13378. -brcmf_dma_flush and brcmf_dma_invalidate_cache are not necessary and
  13379. -have never been implemented.
  13380. -
  13381. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13382. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13383. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13384. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  13385. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13386. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13387. ----
  13388. -
  13389. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  13390. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  13391. -@@ -22,17 +22,6 @@
  13392. - #include "core.h"
  13393. - #include "commonring.h"
  13394. -
  13395. --
  13396. --/* dma flushing needs implementation for mips and arm platforms. Should
  13397. -- * be put in util. Note, this is not real flushing. It is virtual non
  13398. -- * cached memory. Only write buffers should have to be drained. Though
  13399. -- * this may be different depending on platform......
  13400. -- * SEE ALSO msgbuf.c
  13401. -- */
  13402. --#define brcmf_dma_flush(addr, len)
  13403. --#define brcmf_dma_invalidate_cache(addr, len)
  13404. --
  13405. --
  13406. - void brcmf_commonring_register_cb(struct brcmf_commonring *commonring,
  13407. - int (*cr_ring_bell)(void *ctx),
  13408. - int (*cr_update_rptr)(void *ctx),
  13409. -@@ -206,14 +195,9 @@ int brcmf_commonring_write_complete(stru
  13410. - address = commonring->buf_addr;
  13411. - address += (commonring->f_ptr * commonring->item_len);
  13412. - if (commonring->f_ptr > commonring->w_ptr) {
  13413. -- brcmf_dma_flush(address,
  13414. -- (commonring->depth - commonring->f_ptr) *
  13415. -- commonring->item_len);
  13416. - address = commonring->buf_addr;
  13417. - commonring->f_ptr = 0;
  13418. - }
  13419. -- brcmf_dma_flush(address, (commonring->w_ptr - commonring->f_ptr) *
  13420. -- commonring->item_len);
  13421. -
  13422. - commonring->f_ptr = commonring->w_ptr;
  13423. -
  13424. -@@ -258,8 +242,6 @@ void *brcmf_commonring_get_read_ptr(stru
  13425. - if (commonring->r_ptr == commonring->depth)
  13426. - commonring->r_ptr = 0;
  13427. -
  13428. -- brcmf_dma_invalidate_cache(ret_addr, *n_ items * commonring->item_len);
  13429. --
  13430. - return ret_addr;
  13431. - }
  13432. -
  13433. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  13434. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  13435. -@@ -278,16 +278,6 @@ struct brcmf_msgbuf_pktids {
  13436. - struct brcmf_msgbuf_pktid *array;
  13437. - };
  13438. -
  13439. --
  13440. --/* dma flushing needs implementation for mips and arm platforms. Should
  13441. -- * be put in util. Note, this is not real flushing. It is virtual non
  13442. -- * cached memory. Only write buffers should have to be drained. Though
  13443. -- * this may be different depending on platform......
  13444. -- */
  13445. --#define brcmf_dma_flush(addr, len)
  13446. --#define brcmf_dma_invalidate_cache(addr, len)
  13447. --
  13448. --
  13449. - static void brcmf_msgbuf_rxbuf_ioctlresp_post(struct brcmf_msgbuf *msgbuf);
  13450. -
  13451. -
  13452. -@@ -462,7 +452,6 @@ static int brcmf_msgbuf_tx_ioctl(struct
  13453. - memcpy(msgbuf->ioctbuf, buf, buf_len);
  13454. - else
  13455. - memset(msgbuf->ioctbuf, 0, buf_len);
  13456. -- brcmf_dma_flush(ioctl_buf, buf_len);
  13457. -
  13458. - err = brcmf_commonring_write_complete(commonring);
  13459. - brcmf_commonring_unlock(commonring);
  13460. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13461. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13462. -@@ -276,15 +276,6 @@ static const u32 brcmf_ring_itemsize[BRC
  13463. - };
  13464. -
  13465. -
  13466. --/* dma flushing needs implementation for mips and arm platforms. Should
  13467. -- * be put in util. Note, this is not real flushing. It is virtual non
  13468. -- * cached memory. Only write buffers should have to be drained. Though
  13469. -- * this may be different depending on platform......
  13470. -- */
  13471. --#define brcmf_dma_flush(addr, len)
  13472. --#define brcmf_dma_invalidate_cache(addr, len)
  13473. --
  13474. --
  13475. - static u32
  13476. - brcmf_pcie_read_reg32(struct brcmf_pciedev_info *devinfo, u32 reg_offset)
  13477. - {
  13478. -@@ -1174,7 +1165,6 @@ static int brcmf_pcie_init_scratchbuffer
  13479. - goto fail;
  13480. -
  13481. - memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  13482. -- brcmf_dma_flush(devinfo->shared.scratch, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  13483. -
  13484. - addr = devinfo->shared.tcm_base_address +
  13485. - BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
  13486. -@@ -1192,7 +1182,6 @@ static int brcmf_pcie_init_scratchbuffer
  13487. - goto fail;
  13488. -
  13489. - memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  13490. -- brcmf_dma_flush(devinfo->shared.ringupd, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  13491. -
  13492. - addr = devinfo->shared.tcm_base_address +
  13493. - BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
  13494. diff --git a/package/kernel/mac80211/patches/372-brcmfmac-add-support-for-dma-indices-feature.patch b/package/kernel/mac80211/patches/372-brcmfmac-add-support-for-dma-indices-feature.patch
  13495. deleted file mode 100644
  13496. index 2f50abd..0000000
  13497. --- a/package/kernel/mac80211/patches/372-brcmfmac-add-support-for-dma-indices-feature.patch
  13498. +++ /dev/null
  13499. @@ -1,270 +0,0 @@
  13500. -From: Franky Lin <frankyl@broadcom.com>
  13501. -Date: Wed, 20 May 2015 14:09:51 +0200
  13502. -Subject: [PATCH] brcmfmac: add support for dma indices feature
  13503. -
  13504. -PCIe full dongle firmware can support a dma indices feature with which
  13505. -firmware can update/fetch the read/write indices of message buffer
  13506. -rings on both host to dongle and dongle to host directions. The support is
  13507. -announced by firmware through shared flags.
  13508. -
  13509. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13510. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13511. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  13512. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13513. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13514. ----
  13515. -
  13516. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13517. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13518. -@@ -115,6 +115,8 @@ enum brcmf_pcie_state {
  13519. - #define BRCMF_PCIE_MIN_SHARED_VERSION 5
  13520. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  13521. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  13522. -+#define BRCMF_PCIE_SHARED_DMA_INDEX 0x10000
  13523. -+#define BRCMF_PCIE_SHARED_DMA_2B_IDX 0x100000
  13524. -
  13525. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  13526. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  13527. -@@ -146,6 +148,10 @@ enum brcmf_pcie_state {
  13528. - #define BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET 8
  13529. - #define BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET 12
  13530. - #define BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET 16
  13531. -+#define BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET 20
  13532. -+#define BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET 28
  13533. -+#define BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET 36
  13534. -+#define BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET 44
  13535. - #define BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET 0
  13536. - #define BRCMF_SHARED_RING_MAX_SUB_QUEUES 52
  13537. -
  13538. -@@ -247,6 +253,13 @@ struct brcmf_pciedev_info {
  13539. - bool mbdata_completed;
  13540. - bool irq_allocated;
  13541. - bool wowl_enabled;
  13542. -+ u8 dma_idx_sz;
  13543. -+ void *idxbuf;
  13544. -+ u32 idxbuf_sz;
  13545. -+ dma_addr_t idxbuf_dmahandle;
  13546. -+ u16 (*read_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset);
  13547. -+ void (*write_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  13548. -+ u16 value);
  13549. - };
  13550. -
  13551. - struct brcmf_pcie_ringbuf {
  13552. -@@ -323,6 +336,25 @@ brcmf_pcie_write_tcm16(struct brcmf_pcie
  13553. - }
  13554. -
  13555. -
  13556. -+static u16
  13557. -+brcmf_pcie_read_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  13558. -+{
  13559. -+ u16 *address = devinfo->idxbuf + mem_offset;
  13560. -+
  13561. -+ return (*(address));
  13562. -+}
  13563. -+
  13564. -+
  13565. -+static void
  13566. -+brcmf_pcie_write_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  13567. -+ u16 value)
  13568. -+{
  13569. -+ u16 *address = devinfo->idxbuf + mem_offset;
  13570. -+
  13571. -+ *(address) = value;
  13572. -+}
  13573. -+
  13574. -+
  13575. - static u32
  13576. - brcmf_pcie_read_tcm32(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  13577. - {
  13578. -@@ -868,7 +900,7 @@ static int brcmf_pcie_ring_mb_write_rptr
  13579. - brcmf_dbg(PCIE, "W r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  13580. - commonring->w_ptr, ring->id);
  13581. -
  13582. -- brcmf_pcie_write_tcm16(devinfo, ring->r_idx_addr, commonring->r_ptr);
  13583. -+ devinfo->write_ptr(devinfo, ring->r_idx_addr, commonring->r_ptr);
  13584. -
  13585. - return 0;
  13586. - }
  13587. -@@ -886,7 +918,7 @@ static int brcmf_pcie_ring_mb_write_wptr
  13588. - brcmf_dbg(PCIE, "W w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  13589. - commonring->r_ptr, ring->id);
  13590. -
  13591. -- brcmf_pcie_write_tcm16(devinfo, ring->w_idx_addr, commonring->w_ptr);
  13592. -+ devinfo->write_ptr(devinfo, ring->w_idx_addr, commonring->w_ptr);
  13593. -
  13594. - return 0;
  13595. - }
  13596. -@@ -915,7 +947,7 @@ static int brcmf_pcie_ring_mb_update_rpt
  13597. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  13598. - return -EIO;
  13599. -
  13600. -- commonring->r_ptr = brcmf_pcie_read_tcm16(devinfo, ring->r_idx_addr);
  13601. -+ commonring->r_ptr = devinfo->read_ptr(devinfo, ring->r_idx_addr);
  13602. -
  13603. - brcmf_dbg(PCIE, "R r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  13604. - commonring->w_ptr, ring->id);
  13605. -@@ -933,7 +965,7 @@ static int brcmf_pcie_ring_mb_update_wpt
  13606. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  13607. - return -EIO;
  13608. -
  13609. -- commonring->w_ptr = brcmf_pcie_read_tcm16(devinfo, ring->w_idx_addr);
  13610. -+ commonring->w_ptr = devinfo->read_ptr(devinfo, ring->w_idx_addr);
  13611. -
  13612. - brcmf_dbg(PCIE, "R w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  13613. - commonring->r_ptr, ring->id);
  13614. -@@ -1038,6 +1070,13 @@ static void brcmf_pcie_release_ringbuffe
  13615. - }
  13616. - kfree(devinfo->shared.flowrings);
  13617. - devinfo->shared.flowrings = NULL;
  13618. -+ if (devinfo->idxbuf) {
  13619. -+ dma_free_coherent(&devinfo->pdev->dev,
  13620. -+ devinfo->idxbuf_sz,
  13621. -+ devinfo->idxbuf,
  13622. -+ devinfo->idxbuf_dmahandle);
  13623. -+ devinfo->idxbuf = NULL;
  13624. -+ }
  13625. - }
  13626. -
  13627. -
  13628. -@@ -1053,19 +1092,72 @@ static int brcmf_pcie_init_ringbuffers(s
  13629. - u32 addr;
  13630. - u32 ring_mem_ptr;
  13631. - u32 i;
  13632. -+ u64 address;
  13633. -+ u32 bufsz;
  13634. - u16 max_sub_queues;
  13635. -+ u8 idx_offset;
  13636. -
  13637. - ring_addr = devinfo->shared.ring_info_addr;
  13638. - brcmf_dbg(PCIE, "Base ring addr = 0x%08x\n", ring_addr);
  13639. -+ addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  13640. -+ max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  13641. -
  13642. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  13643. -- d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  13644. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  13645. -- d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  13646. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  13647. -- h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  13648. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  13649. -- h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  13650. -+ if (devinfo->dma_idx_sz != 0) {
  13651. -+ bufsz = (BRCMF_NROF_D2H_COMMON_MSGRINGS + max_sub_queues) *
  13652. -+ devinfo->dma_idx_sz * 2;
  13653. -+ devinfo->idxbuf = dma_alloc_coherent(&devinfo->pdev->dev, bufsz,
  13654. -+ &devinfo->idxbuf_dmahandle,
  13655. -+ GFP_KERNEL);
  13656. -+ if (!devinfo->idxbuf)
  13657. -+ devinfo->dma_idx_sz = 0;
  13658. -+ }
  13659. -+
  13660. -+ if (devinfo->dma_idx_sz == 0) {
  13661. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  13662. -+ d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  13663. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  13664. -+ d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  13665. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  13666. -+ h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  13667. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  13668. -+ h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  13669. -+ idx_offset = sizeof(u32);
  13670. -+ devinfo->write_ptr = brcmf_pcie_write_tcm16;
  13671. -+ devinfo->read_ptr = brcmf_pcie_read_tcm16;
  13672. -+ brcmf_dbg(PCIE, "Using TCM indices\n");
  13673. -+ } else {
  13674. -+ memset(devinfo->idxbuf, 0, bufsz);
  13675. -+ devinfo->idxbuf_sz = bufsz;
  13676. -+ idx_offset = devinfo->dma_idx_sz;
  13677. -+ devinfo->write_ptr = brcmf_pcie_write_idx;
  13678. -+ devinfo->read_ptr = brcmf_pcie_read_idx;
  13679. -+
  13680. -+ h2d_w_idx_ptr = 0;
  13681. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET;
  13682. -+ address = (u64)devinfo->idxbuf_dmahandle;
  13683. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  13684. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  13685. -+
  13686. -+ h2d_r_idx_ptr = h2d_w_idx_ptr + max_sub_queues * idx_offset;
  13687. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET;
  13688. -+ address += max_sub_queues * idx_offset;
  13689. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  13690. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  13691. -+
  13692. -+ d2h_w_idx_ptr = h2d_r_idx_ptr + max_sub_queues * idx_offset;
  13693. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET;
  13694. -+ address += max_sub_queues * idx_offset;
  13695. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  13696. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  13697. -+
  13698. -+ d2h_r_idx_ptr = d2h_w_idx_ptr +
  13699. -+ BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  13700. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET;
  13701. -+ address += BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  13702. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  13703. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  13704. -+ brcmf_dbg(PCIE, "Using host memory indices\n");
  13705. -+ }
  13706. -
  13707. - addr = ring_addr + BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET;
  13708. - ring_mem_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  13709. -@@ -1079,8 +1171,8 @@ static int brcmf_pcie_init_ringbuffers(s
  13710. - ring->id = i;
  13711. - devinfo->shared.commonrings[i] = ring;
  13712. -
  13713. -- h2d_w_idx_ptr += sizeof(u32);
  13714. -- h2d_r_idx_ptr += sizeof(u32);
  13715. -+ h2d_w_idx_ptr += idx_offset;
  13716. -+ h2d_r_idx_ptr += idx_offset;
  13717. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  13718. - }
  13719. -
  13720. -@@ -1094,13 +1186,11 @@ static int brcmf_pcie_init_ringbuffers(s
  13721. - ring->id = i;
  13722. - devinfo->shared.commonrings[i] = ring;
  13723. -
  13724. -- d2h_w_idx_ptr += sizeof(u32);
  13725. -- d2h_r_idx_ptr += sizeof(u32);
  13726. -+ d2h_w_idx_ptr += idx_offset;
  13727. -+ d2h_r_idx_ptr += idx_offset;
  13728. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  13729. - }
  13730. -
  13731. -- addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  13732. -- max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  13733. - devinfo->shared.nrof_flowrings =
  13734. - max_sub_queues - BRCMF_NROF_H2D_COMMON_MSGRINGS;
  13735. - rings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*ring),
  13736. -@@ -1124,15 +1214,15 @@ static int brcmf_pcie_init_ringbuffers(s
  13737. - ring);
  13738. - ring->w_idx_addr = h2d_w_idx_ptr;
  13739. - ring->r_idx_addr = h2d_r_idx_ptr;
  13740. -- h2d_w_idx_ptr += sizeof(u32);
  13741. -- h2d_r_idx_ptr += sizeof(u32);
  13742. -+ h2d_w_idx_ptr += idx_offset;
  13743. -+ h2d_r_idx_ptr += idx_offset;
  13744. - }
  13745. - devinfo->shared.flowrings = rings;
  13746. -
  13747. - return 0;
  13748. -
  13749. - fail:
  13750. -- brcmf_err("Allocating commonring buffers failed\n");
  13751. -+ brcmf_err("Allocating ring buffers failed\n");
  13752. - brcmf_pcie_release_ringbuffers(devinfo);
  13753. - return -ENOMEM;
  13754. - }
  13755. -@@ -1269,6 +1359,14 @@ brcmf_pcie_init_share_ram_info(struct br
  13756. - return -EINVAL;
  13757. - }
  13758. -
  13759. -+ /* check firmware support dma indicies */
  13760. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_INDEX) {
  13761. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_2B_IDX)
  13762. -+ devinfo->dma_idx_sz = sizeof(u16);
  13763. -+ else
  13764. -+ devinfo->dma_idx_sz = sizeof(u32);
  13765. -+ }
  13766. -+
  13767. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  13768. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  13769. - if (shared->max_rxbufpost == 0)
  13770. diff --git a/package/kernel/mac80211/patches/373-brcmfmac-avoid-null-pointer-access-when-brcmf_msgbuf.patch b/package/kernel/mac80211/patches/373-brcmfmac-avoid-null-pointer-access-when-brcmf_msgbuf.patch
  13771. deleted file mode 100644
  13772. index 28408d2..0000000
  13773. --- a/package/kernel/mac80211/patches/373-brcmfmac-avoid-null-pointer-access-when-brcmf_msgbuf.patch
  13774. +++ /dev/null
  13775. @@ -1,102 +0,0 @@
  13776. -From: Arend van Spriel <arend@broadcom.com>
  13777. -Date: Tue, 26 May 2015 13:19:46 +0200
  13778. -Subject: [PATCH] brcmfmac: avoid null pointer access when
  13779. - brcmf_msgbuf_get_pktid() fails
  13780. -
  13781. -The function brcmf_msgbuf_get_pktid() may return a NULL pointer so
  13782. -the callers should check the return pointer before accessing it to
  13783. -avoid the crash below (see [1]):
  13784. -
  13785. -brcmfmac: brcmf_msgbuf_get_pktid: Invalid packet id 273 (not in use)
  13786. -BUG: unable to handle kernel NULL pointer dereference at 0000000000000080
  13787. -IP: [<ffffffff8145b225>] skb_pull+0x5/0x50
  13788. -PGD 0
  13789. -Oops: 0000 [#1] PREEMPT SMP
  13790. -Modules linked in: pci_stub vboxpci(O) vboxnetflt(O) vboxnetadp(O) vboxdrv(O)
  13791. - snd_hda_codec_hdmi bnep mousedev hid_generic ushwmon msr ext4 crc16 mbcache
  13792. - jbd2 sd_mod uas usb_storage ahci libahci libata scsi_mod xhci_pci xhci_hcd
  13793. - usbcore usb_common
  13794. -CPU: 0 PID: 1661 Comm: irq/61-brcmf_pc Tainted: G O 4.0.1-MacbookPro-ARCH #1
  13795. -Hardware name: Apple Inc. MacBookPro12,1/Mac-E43C1C25D4880AD6,
  13796. - BIOS MBP121.88Z.0167.B02.1503241251 03/24/2015
  13797. -task: ffff880264203cc0 ti: ffff88025ffe4000 task.ti: ffff88025ffe4000
  13798. -RIP: 0010:[<ffffffff8145b225>] [<ffffffff8145b225>] skb_pull+0x5/0x50
  13799. -RSP: 0018:ffff88025ffe7d40 EFLAGS: 00010202
  13800. -RAX: 0000000000000000 RBX: ffff88008a33c000 RCX: 0000000000000044
  13801. -RDX: 0000000000000000 RSI: 000000000000004a RDI: 0000000000000000
  13802. -RBP: ffff88025ffe7da8 R08: 0000000000000096 R09: 000000000000004a
  13803. -R10: 0000000000000000 R11: 000000000000048e R12: ffff88025ff14f00
  13804. -R13: 0000000000000000 R14: ffff880263b48200 R15: ffff88008a33c000
  13805. -FS: 0000000000000000(0000) GS:ffff88026ec00000(0000) knlGS:0000000000000000
  13806. -CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  13807. -CR2: 0000000000000080 CR3: 000000000180b000 CR4: 00000000003407f0
  13808. -Stack:
  13809. - ffffffffa06aed74 ffff88025ffe7dc8 ffff880263b48270 ffff880263b48278
  13810. - 05ea88020000004a 0002ffff81014635 000000001720b2f6 ffff88026ec116c0
  13811. - ffff880263b48200 0000000000010000 ffff880263b4ae00 ffff880264203cc0
  13812. -Call Trace:
  13813. - [<ffffffffa06aed74>] ? brcmf_msgbuf_process_rx+0x404/0x480 [brcmfmac]
  13814. - [<ffffffff810cea60>] ? irq_finalize_oneshot.part.30+0xf0/0xf0
  13815. - [<ffffffffa06afb55>] brcmf_proto_msgbuf_rx_trigger+0x35/0xf0 [brcmfmac]
  13816. - [<ffffffffa06baf2a>] brcmf_pcie_isr_thread_v2+0x8a/0x130 [brcmfmac]
  13817. - [<ffffffff810cea80>] irq_thread_fn+0x20/0x50
  13818. - [<ffffffff810ceddf>] irq_thread+0x13f/0x170
  13819. - [<ffffffff810cebf0>] ? wake_threads_waitq+0x30/0x30
  13820. - [<ffffffff810ceca0>] ? irq_thread_dtor+0xb0/0xb0
  13821. - [<ffffffff81092a08>] kthread+0xd8/0xf0
  13822. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  13823. - [<ffffffff8156d898>] ret_from_fork+0x58/0x90
  13824. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  13825. -Code: 01 83 e2 f7 88 50 01 48 83 c4 08 5b 5d f3 c3 0f 1f 80 00 00 00 00 83 e2
  13826. - f7 88 50 01 c3 66 0f 1f 84 00 00 00 00 00 0f 1f
  13827. -RIP [<ffffffff8145b225>] skb_pull+0x5/0x50
  13828. - RSP <ffff88025ffe7d40>
  13829. -CR2: 0000000000000080
  13830. ----[ end trace b074c0f90e7c997d ]---
  13831. -
  13832. -[1] http://mid.gmane.org/20150430193259.GA5630@googlemail.com
  13833. -
  13834. -Cc: <stable@vger.kernel.org> # v3.18, v3.19, v4.0, v4.1
  13835. -Reported-by: Michael Hornung <mhornung.linux@gmail.com>
  13836. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13837. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13838. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13839. ----
  13840. -
  13841. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  13842. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  13843. -@@ -500,11 +500,9 @@ static int brcmf_msgbuf_query_dcmd(struc
  13844. - msgbuf->rx_pktids,
  13845. - msgbuf->ioctl_resp_pktid);
  13846. - if (msgbuf->ioctl_resp_ret_len != 0) {
  13847. -- if (!skb) {
  13848. -- brcmf_err("Invalid packet id idx recv'd %d\n",
  13849. -- msgbuf->ioctl_resp_pktid);
  13850. -+ if (!skb)
  13851. - return -EBADF;
  13852. -- }
  13853. -+
  13854. - memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ?
  13855. - len : msgbuf->ioctl_resp_ret_len);
  13856. - }
  13857. -@@ -866,10 +864,8 @@ brcmf_msgbuf_process_txstatus(struct brc
  13858. - flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS;
  13859. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  13860. - msgbuf->tx_pktids, idx);
  13861. -- if (!skb) {
  13862. -- brcmf_err("Invalid packet id idx recv'd %d\n", idx);
  13863. -+ if (!skb)
  13864. - return;
  13865. -- }
  13866. -
  13867. - set_bit(flowid, msgbuf->txstatus_done_map);
  13868. - commonring = msgbuf->flowrings[flowid];
  13869. -@@ -1148,6 +1144,8 @@ brcmf_msgbuf_process_rx_complete(struct
  13870. -
  13871. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  13872. - msgbuf->rx_pktids, idx);
  13873. -+ if (!skb)
  13874. -+ return;
  13875. -
  13876. - if (data_offset)
  13877. - skb_pull(skb, data_offset);
  13878. diff --git a/package/kernel/mac80211/patches/374-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch b/package/kernel/mac80211/patches/374-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch
  13879. deleted file mode 100644
  13880. index f023034..0000000
  13881. --- a/package/kernel/mac80211/patches/374-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch
  13882. +++ /dev/null
  13883. @@ -1,63 +0,0 @@
  13884. -From: Arend van Spriel <arend@broadcom.com>
  13885. -Date: Wed, 27 May 2015 19:31:41 +0200
  13886. -Subject: [PATCH] brcmfmac: fix invalid access to struct acpi_device fields
  13887. -
  13888. -The fields of struct acpi_device are only known when CONFIG_ACPI is
  13889. -defined. Fix this by using a helper function. This will resolve the
  13890. -issue found in linux-next:
  13891. -
  13892. - ../brcmfmac/bcmsdh.c: In function 'brcmf_ops_sdio_probe':
  13893. - ../brcmfmac/bcmsdh.c:1139:7: error: dereferencing pointer to incomplete type
  13894. - adev->flags.power_manageable = 0;
  13895. - ^
  13896. -
  13897. -Fixes: f0992ace680c ("brcmfmac: prohibit ACPI power management ...")
  13898. -Cc: Fu, Zhonghui <zhonghui.fu@linux.intel.com>
  13899. -Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
  13900. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13901. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13902. ----
  13903. -
  13904. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13905. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13906. -@@ -1117,6 +1117,18 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_id
  13907. - static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
  13908. -
  13909. -
  13910. -+static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
  13911. -+ int val)
  13912. -+{
  13913. -+#if IS_ENABLED(CONFIG_ACPI)
  13914. -+ struct acpi_device *adev;
  13915. -+
  13916. -+ adev = ACPI_COMPANION(dev);
  13917. -+ if (adev)
  13918. -+ adev->flags.power_manageable = 0;
  13919. -+#endif
  13920. -+}
  13921. -+
  13922. - static int brcmf_ops_sdio_probe(struct sdio_func *func,
  13923. - const struct sdio_device_id *id)
  13924. - {
  13925. -@@ -1124,7 +1136,6 @@ static int brcmf_ops_sdio_probe(struct s
  13926. - struct brcmf_sdio_dev *sdiodev;
  13927. - struct brcmf_bus *bus_if;
  13928. - struct device *dev;
  13929. -- struct acpi_device *adev;
  13930. -
  13931. - brcmf_dbg(SDIO, "Enter\n");
  13932. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  13933. -@@ -1132,11 +1143,9 @@ static int brcmf_ops_sdio_probe(struct s
  13934. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  13935. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  13936. -
  13937. -- /* prohibit ACPI power management for this device */
  13938. - dev = &func->dev;
  13939. -- adev = ACPI_COMPANION(dev);
  13940. -- if (adev)
  13941. -- adev->flags.power_manageable = 0;
  13942. -+ /* prohibit ACPI power management for this device */
  13943. -+ brcmf_sdiod_acpi_set_power_manageable(dev, 0);
  13944. -
  13945. - /* Consume func num 1 but dont do anything with it. */
  13946. - if (func->num == 1)
  13947. diff --git a/package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch b/package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
  13948. deleted file mode 100644
  13949. index 2bfd44f..0000000
  13950. --- a/package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
  13951. +++ /dev/null
  13952. @@ -1,56 +0,0 @@
  13953. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  13954. -Date: Wed, 20 May 2015 09:34:21 +0200
  13955. -Subject: [PATCH] brcmfmac: simplify check stripping v2 NVRAM
  13956. -MIME-Version: 1.0
  13957. -Content-Type: text/plain; charset=UTF-8
  13958. -Content-Transfer-Encoding: 8bit
  13959. -
  13960. -Comparing NVRAM entry with a full filtering string is simpler than
  13961. -comparing it with a short prefix and then checking random chars at magic
  13962. -offsets. The cost of snprintf relatively low, we execute it just once.
  13963. -Tested on BCM43602 with NVRAM hacked to use V2 format.
  13964. -
  13965. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13966. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13967. ----
  13968. -
  13969. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  13970. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  13971. -@@ -25,7 +25,7 @@
  13972. -
  13973. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  13974. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  13975. --#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  13976. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  13977. -
  13978. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  13979. - module_param_string(firmware_path, brcmf_firmware_path,
  13980. -@@ -297,6 +297,8 @@ fail:
  13981. - static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  13982. - u16 bus_nr)
  13983. - {
  13984. -+ char prefix[BRCMF_FW_NVRAM_PCIEDEV_LEN];
  13985. -+ size_t len;
  13986. - u32 i, j;
  13987. - u8 *nvram;
  13988. -
  13989. -@@ -308,14 +310,13 @@ static void brcmf_fw_strip_multi_v2(stru
  13990. - * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  13991. - * Y = bus_nr.
  13992. - */
  13993. -+ snprintf(prefix, sizeof(prefix), "pcie/%d/%d/", domain_nr, bus_nr);
  13994. -+ len = strlen(prefix);
  13995. - i = 0;
  13996. - j = 0;
  13997. -- while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  13998. -- if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  13999. -- (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  14000. -- ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  14001. -- ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  14002. -- i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  14003. -+ while (i < nvp->nvram_len - len) {
  14004. -+ if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  14005. -+ i += len;
  14006. - while (nvp->nvram[i] != 0) {
  14007. - nvram[j] = nvp->nvram[i];
  14008. - i++;
  14009. diff --git a/package/kernel/mac80211/patches/376-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch b/package/kernel/mac80211/patches/376-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch
  14010. deleted file mode 100644
  14011. index 0e65114..0000000
  14012. --- a/package/kernel/mac80211/patches/376-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch
  14013. +++ /dev/null
  14014. @@ -1,57 +0,0 @@
  14015. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  14016. -Date: Wed, 20 May 2015 11:01:08 +0200
  14017. -Subject: [PATCH] brcmfmac: simplify check finding NVRAM v1 device path
  14018. -MIME-Version: 1.0
  14019. -Content-Type: text/plain; charset=UTF-8
  14020. -Content-Transfer-Encoding: 8bit
  14021. -
  14022. -With a simple use of snprintf and small buffer we can compare NVRAM
  14023. -entry value with a full string. This way we avoid checking random chars
  14024. -at magic offsets.
  14025. -Tested on BCM43602 with NVRAM hacked to use v1 format.
  14026. -
  14027. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  14028. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14029. ----
  14030. -
  14031. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  14032. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  14033. -@@ -222,6 +222,10 @@ static int brcmf_init_nvram_parser(struc
  14034. - static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  14035. - u16 bus_nr)
  14036. - {
  14037. -+ /* Device path with a leading '=' key-value separator */
  14038. -+ char pcie_path[] = "=pcie/?/?";
  14039. -+ size_t pcie_len;
  14040. -+
  14041. - u32 i, j;
  14042. - bool found;
  14043. - u8 *nvram;
  14044. -@@ -238,6 +242,9 @@ static void brcmf_fw_strip_multi_v1(stru
  14045. - /* First search for the devpathX and see if it is the configuration
  14046. - * for domain_nr/bus_nr. Search complete nvp
  14047. - */
  14048. -+ snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  14049. -+ bus_nr);
  14050. -+ pcie_len = strlen(pcie_path);
  14051. - found = false;
  14052. - i = 0;
  14053. - while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  14054. -@@ -245,13 +252,10 @@ static void brcmf_fw_strip_multi_v1(stru
  14055. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  14056. - */
  14057. - if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  14058. -- (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  14059. -- if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  14060. -- ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  14061. -- id = nvp->nvram[i + 7] - '0';
  14062. -- found = true;
  14063. -- break;
  14064. -- }
  14065. -+ (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  14066. -+ id = nvp->nvram[i + 7] - '0';
  14067. -+ found = true;
  14068. -+ break;
  14069. - }
  14070. - while (nvp->nvram[i] != 0)
  14071. - i++;
  14072. diff --git a/package/kernel/mac80211/patches/377-brcmfmac-treat-0-as-end-of-comment-when-parsing-NVRA.patch b/package/kernel/mac80211/patches/377-brcmfmac-treat-0-as-end-of-comment-when-parsing-NVRA.patch
  14073. deleted file mode 100644
  14074. index dc174e5..0000000
  14075. --- a/package/kernel/mac80211/patches/377-brcmfmac-treat-0-as-end-of-comment-when-parsing-NVRA.patch
  14076. +++ /dev/null
  14077. @@ -1,45 +0,0 @@
  14078. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  14079. -Date: Wed, 20 May 2015 13:59:54 +0200
  14080. -Subject: [PATCH] brcmfmac: treat \0 as end of comment when parsing NVRAM
  14081. -MIME-Version: 1.0
  14082. -Content-Type: text/plain; charset=UTF-8
  14083. -Content-Transfer-Encoding: 8bit
  14084. -
  14085. -This fixes brcmfmac dealing with NVRAM coming from platform e.g. from a
  14086. -flash MTD partition. In such cases entries are separated by \0 instead
  14087. -of \n which caused ignoring whole content after the first "comment".
  14088. -While platform NVRAM doesn't usually contain comments, we switch to
  14089. -COMMENT state after e.g. finding an unexpected char in key name.
  14090. -
  14091. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  14092. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14093. ----
  14094. -
  14095. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  14096. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  14097. -@@ -162,17 +162,20 @@ brcmf_nvram_handle_value(struct nvram_pa
  14098. - static enum nvram_parser_state
  14099. - brcmf_nvram_handle_comment(struct nvram_parser *nvp)
  14100. - {
  14101. -- char *eol, *sol;
  14102. -+ char *eoc, *sol;
  14103. -
  14104. - sol = (char *)&nvp->fwnv->data[nvp->pos];
  14105. -- eol = strchr(sol, '\n');
  14106. -- if (eol == NULL)
  14107. -- return END;
  14108. -+ eoc = strchr(sol, '\n');
  14109. -+ if (!eoc) {
  14110. -+ eoc = strchr(sol, '\0');
  14111. -+ if (!eoc)
  14112. -+ return END;
  14113. -+ }
  14114. -
  14115. - /* eat all moving to next line */
  14116. - nvp->line++;
  14117. - nvp->column = 1;
  14118. -- nvp->pos += (eol - sol) + 1;
  14119. -+ nvp->pos += (eoc - sol) + 1;
  14120. - return IDLE;
  14121. - }
  14122. -
  14123. diff --git a/package/kernel/mac80211/patches/378-brcmfmac-allow-NVRAM-values-to-contain-spaces.patch b/package/kernel/mac80211/patches/378-brcmfmac-allow-NVRAM-values-to-contain-spaces.patch
  14124. deleted file mode 100644
  14125. index 5700142..0000000
  14126. --- a/package/kernel/mac80211/patches/378-brcmfmac-allow-NVRAM-values-to-contain-spaces.patch
  14127. +++ /dev/null
  14128. @@ -1,50 +0,0 @@
  14129. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  14130. -Date: Sat, 23 May 2015 09:15:33 +0200
  14131. -Subject: [PATCH] brcmfmac: allow NVRAM values to contain spaces
  14132. -MIME-Version: 1.0
  14133. -Content-Type: text/plain; charset=UTF-8
  14134. -Content-Transfer-Encoding: 8bit
  14135. -
  14136. -Platform NVRAMs often contain values with spaces. Even if right now most
  14137. -firmware-supported entries are simple values, we shouldn't reject these
  14138. -with spaces. It was semi-confirmed by Broadcom in the early patch adding
  14139. -support for platform NVRAMs.
  14140. -
  14141. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  14142. -Acked-by: Arend van Spriel <arend@broadcom.com>
  14143. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14144. ----
  14145. -
  14146. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  14147. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  14148. -@@ -66,6 +66,12 @@ struct nvram_parser {
  14149. - bool multi_dev_v2;
  14150. - };
  14151. -
  14152. -+/**
  14153. -+ * is_nvram_char() - check if char is a valid one for NVRAM entry
  14154. -+ *
  14155. -+ * It accepts all printable ASCII chars except for '#' which opens a comment.
  14156. -+ * Please note that ' ' (space) while accepted is not a valid key name char.
  14157. -+ */
  14158. - static bool is_nvram_char(char c)
  14159. - {
  14160. - /* comment marker excluded */
  14161. -@@ -73,7 +79,7 @@ static bool is_nvram_char(char c)
  14162. - return false;
  14163. -
  14164. - /* key and value may have any other readable character */
  14165. -- return (c > 0x20 && c < 0x7f);
  14166. -+ return (c >= 0x20 && c < 0x7f);
  14167. - }
  14168. -
  14169. - static bool is_whitespace(char c)
  14170. -@@ -120,7 +126,7 @@ static enum nvram_parser_state brcmf_nvr
  14171. - nvp->multi_dev_v1 = true;
  14172. - if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  14173. - nvp->multi_dev_v2 = true;
  14174. -- } else if (!is_nvram_char(c)) {
  14175. -+ } else if (!is_nvram_char(c) || c == ' ') {
  14176. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  14177. - nvp->line, nvp->column);
  14178. - return COMMENT;
  14179. diff --git a/package/kernel/mac80211/patches/379-ath9k-fix-DMA-stop-sequence-for-AR9003.patch b/package/kernel/mac80211/patches/379-ath9k-fix-DMA-stop-sequence-for-AR9003.patch
  14180. deleted file mode 100644
  14181. index 814b0d7..0000000
  14182. --- a/package/kernel/mac80211/patches/379-ath9k-fix-DMA-stop-sequence-for-AR9003.patch
  14183. +++ /dev/null
  14184. @@ -1,33 +0,0 @@
  14185. -From: Felix Fietkau <nbd@openwrt.org>
  14186. -Date: Tue, 2 Jun 2015 10:35:46 +0200
  14187. -Subject: [PATCH] ath9k: fix DMA stop sequence for AR9003+
  14188. -
  14189. -AR93xx and newer needs to stop rx before tx to avoid getting the DMA
  14190. -engine or MAC into a stuck state.
  14191. -This should reduce/fix the occurence of "Failed to stop Tx DMA" logspam.
  14192. -
  14193. -Cc: stable@vger.kernel.org
  14194. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  14195. ----
  14196. -
  14197. ---- a/drivers/net/wireless/ath/ath9k/main.c
  14198. -+++ b/drivers/net/wireless/ath/ath9k/main.c
  14199. -@@ -216,11 +216,13 @@ static bool ath_prepare_reset(struct ath
  14200. - ath_stop_ani(sc);
  14201. - ath9k_hw_disable_interrupts(ah);
  14202. -
  14203. -- if (!ath_drain_all_txq(sc))
  14204. -- ret = false;
  14205. --
  14206. -- if (!ath_stoprecv(sc))
  14207. -- ret = false;
  14208. -+ if (AR_SREV_9300_20_OR_LATER(ah)) {
  14209. -+ ret &= ath_stoprecv(sc);
  14210. -+ ret &= ath_drain_all_txq(sc);
  14211. -+ } else {
  14212. -+ ret &= ath_drain_all_txq(sc);
  14213. -+ ret &= ath_stoprecv(sc);
  14214. -+ }
  14215. -
  14216. - return ret;
  14217. - }
  14218. diff --git a/package/kernel/mac80211/patches/380-brcmfmac-support-NVRAMs-containing-pci-devpaths-inst.patch b/package/kernel/mac80211/patches/380-brcmfmac-support-NVRAMs-containing-pci-devpaths-inst.patch
  14219. deleted file mode 100644
  14220. index 7bbd57e..0000000
  14221. --- a/package/kernel/mac80211/patches/380-brcmfmac-support-NVRAMs-containing-pci-devpaths-inst.patch
  14222. +++ /dev/null
  14223. @@ -1,56 +0,0 @@
  14224. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  14225. -Date: Thu, 28 May 2015 14:19:21 +0200
  14226. -Subject: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of
  14227. - pcie)
  14228. -MIME-Version: 1.0
  14229. -Content-Type: text/plain; charset=UTF-8
  14230. -Content-Transfer-Encoding: 8bit
  14231. -
  14232. -Recently Broadcom added support for NVRAMs with entries for multiple
  14233. -PCIe devices. One of the supported formats is based on prefixes defined
  14234. -like: devpath0=pcie/1/4/ and entries like 0:foo=bar 0:baz=qux etc.
  14235. -
  14236. -Unfortunately there are also a bit older devices using different way of
  14237. -defining prefixes, e.g. SmartRG SR400ac (2 x BCM43602) with entries:
  14238. -devpath0=pci/1/1/
  14239. -devpath1=pci/2/1
  14240. -Broadcom stated this old format will never be used/supported by brcmfmac
  14241. -but given the simplicity of this patch I'll insist on supporting it.
  14242. -
  14243. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  14244. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14245. ----
  14246. -
  14247. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  14248. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  14249. -@@ -232,6 +232,8 @@ static void brcmf_fw_strip_multi_v1(stru
  14250. - u16 bus_nr)
  14251. - {
  14252. - /* Device path with a leading '=' key-value separator */
  14253. -+ char pci_path[] = "=pci/?/?";
  14254. -+ size_t pci_len;
  14255. - char pcie_path[] = "=pcie/?/?";
  14256. - size_t pcie_len;
  14257. -
  14258. -@@ -251,6 +253,9 @@ static void brcmf_fw_strip_multi_v1(stru
  14259. - /* First search for the devpathX and see if it is the configuration
  14260. - * for domain_nr/bus_nr. Search complete nvp
  14261. - */
  14262. -+ snprintf(pci_path, sizeof(pci_path), "=pci/%d/%d", domain_nr,
  14263. -+ bus_nr);
  14264. -+ pci_len = strlen(pci_path);
  14265. - snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  14266. - bus_nr);
  14267. - pcie_len = strlen(pcie_path);
  14268. -@@ -260,8 +265,9 @@ static void brcmf_fw_strip_multi_v1(stru
  14269. - /* Format: devpathX=pcie/Y/Z/
  14270. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  14271. - */
  14272. -- if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  14273. -- (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  14274. -+ if (strncmp(&nvp->nvram[i], "devpath", 7) == 0 &&
  14275. -+ (!strncmp(&nvp->nvram[i + 8], pci_path, pci_len) ||
  14276. -+ !strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len))) {
  14277. - id = nvp->nvram[i + 7] - '0';
  14278. - found = true;
  14279. - break;
  14280. diff --git a/package/kernel/mac80211/patches/381-brcmfmac-set-wiphy-perm_addr-to-hardware-MAC-address.patch b/package/kernel/mac80211/patches/381-brcmfmac-set-wiphy-perm_addr-to-hardware-MAC-address.patch
  14281. deleted file mode 100644
  14282. index 1eff6ed..0000000
  14283. --- a/package/kernel/mac80211/patches/381-brcmfmac-set-wiphy-perm_addr-to-hardware-MAC-address.patch
  14284. +++ /dev/null
  14285. @@ -1,23 +0,0 @@
  14286. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  14287. -Date: Sun, 31 May 2015 02:52:26 +0200
  14288. -Subject: [PATCH] brcmfmac: set wiphy perm_addr to hardware MAC address
  14289. -MIME-Version: 1.0
  14290. -Content-Type: text/plain; charset=UTF-8
  14291. -Content-Transfer-Encoding: 8bit
  14292. -
  14293. -This allows e.g. user space to use /sys/class/ieee80211/*/macaddress
  14294. -
  14295. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  14296. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14297. ----
  14298. -
  14299. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  14300. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  14301. -@@ -6070,6 +6070,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  14302. - brcmf_err("Could not allocate wiphy device\n");
  14303. - return NULL;
  14304. - }
  14305. -+ memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
  14306. - set_wiphy_dev(wiphy, busdev);
  14307. -
  14308. - cfg = wiphy_priv(wiphy);
  14309. diff --git a/package/kernel/mac80211/patches/382-brcmfmac-use-direct-data-pointer-in-NVRAM-parser-str.patch b/package/kernel/mac80211/patches/382-brcmfmac-use-direct-data-pointer-in-NVRAM-parser-str.patch
  14310. deleted file mode 100644
  14311. index c6e83dd..0000000
  14312. --- a/package/kernel/mac80211/patches/382-brcmfmac-use-direct-data-pointer-in-NVRAM-parser-str.patch
  14313. +++ /dev/null
  14314. @@ -1,144 +0,0 @@
  14315. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  14316. -Date: Thu, 4 Jun 2015 22:11:07 +0200
  14317. -Subject: [PATCH] brcmfmac: use direct data pointer in NVRAM parser struct
  14318. -MIME-Version: 1.0
  14319. -Content-Type: text/plain; charset=UTF-8
  14320. -Content-Transfer-Encoding: 8bit
  14321. -
  14322. -As we plan to add support for platform NVRAM we should store direct
  14323. -data pointer without the extra struct firmware layer. This will allow
  14324. -us to support other sources with the only requirement being u8 buffer.
  14325. -
  14326. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  14327. -Acked-by: Arend van Spriel <arend@broadcom.com>
  14328. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14329. ----
  14330. -
  14331. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  14332. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  14333. -@@ -43,7 +43,7 @@ enum nvram_parser_state {
  14334. - * struct nvram_parser - internal info for parser.
  14335. - *
  14336. - * @state: current parser state.
  14337. -- * @fwnv: input buffer being parsed.
  14338. -+ * @data: input buffer being parsed.
  14339. - * @nvram: output buffer with parse result.
  14340. - * @nvram_len: lenght of parse result.
  14341. - * @line: current line.
  14342. -@@ -55,7 +55,7 @@ enum nvram_parser_state {
  14343. - */
  14344. - struct nvram_parser {
  14345. - enum nvram_parser_state state;
  14346. -- const struct firmware *fwnv;
  14347. -+ const u8 *data;
  14348. - u8 *nvram;
  14349. - u32 nvram_len;
  14350. - u32 line;
  14351. -@@ -91,7 +91,7 @@ static enum nvram_parser_state brcmf_nvr
  14352. - {
  14353. - char c;
  14354. -
  14355. -- c = nvp->fwnv->data[nvp->pos];
  14356. -+ c = nvp->data[nvp->pos];
  14357. - if (c == '\n')
  14358. - return COMMENT;
  14359. - if (is_whitespace(c))
  14360. -@@ -115,16 +115,16 @@ static enum nvram_parser_state brcmf_nvr
  14361. - enum nvram_parser_state st = nvp->state;
  14362. - char c;
  14363. -
  14364. -- c = nvp->fwnv->data[nvp->pos];
  14365. -+ c = nvp->data[nvp->pos];
  14366. - if (c == '=') {
  14367. - /* ignore RAW1 by treating as comment */
  14368. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "RAW1", 4) == 0)
  14369. -+ if (strncmp(&nvp->data[nvp->entry], "RAW1", 4) == 0)
  14370. - st = COMMENT;
  14371. - else
  14372. - st = VALUE;
  14373. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  14374. -+ if (strncmp(&nvp->data[nvp->entry], "devpath", 7) == 0)
  14375. - nvp->multi_dev_v1 = true;
  14376. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  14377. -+ if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  14378. - nvp->multi_dev_v2 = true;
  14379. - } else if (!is_nvram_char(c) || c == ' ') {
  14380. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  14381. -@@ -145,11 +145,11 @@ brcmf_nvram_handle_value(struct nvram_pa
  14382. - char *ekv;
  14383. - u32 cplen;
  14384. -
  14385. -- c = nvp->fwnv->data[nvp->pos];
  14386. -+ c = nvp->data[nvp->pos];
  14387. - if (!is_nvram_char(c)) {
  14388. - /* key,value pair complete */
  14389. -- ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  14390. -- skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  14391. -+ ekv = (u8 *)&nvp->data[nvp->pos];
  14392. -+ skv = (u8 *)&nvp->data[nvp->entry];
  14393. - cplen = ekv - skv;
  14394. - if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  14395. - return END;
  14396. -@@ -170,7 +170,7 @@ brcmf_nvram_handle_comment(struct nvram_
  14397. - {
  14398. - char *eoc, *sol;
  14399. -
  14400. -- sol = (char *)&nvp->fwnv->data[nvp->pos];
  14401. -+ sol = (char *)&nvp->data[nvp->pos];
  14402. - eoc = strchr(sol, '\n');
  14403. - if (!eoc) {
  14404. - eoc = strchr(sol, '\0');
  14405. -@@ -201,17 +201,17 @@ static enum nvram_parser_state
  14406. - };
  14407. -
  14408. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  14409. -- const struct firmware *nv)
  14410. -+ const u8 *data, size_t data_len)
  14411. - {
  14412. - size_t size;
  14413. -
  14414. - memset(nvp, 0, sizeof(*nvp));
  14415. -- nvp->fwnv = nv;
  14416. -+ nvp->data = data;
  14417. - /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  14418. -- if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  14419. -+ if (data_len > BRCMF_FW_MAX_NVRAM_SIZE)
  14420. - size = BRCMF_FW_MAX_NVRAM_SIZE;
  14421. - else
  14422. -- size = nv->size;
  14423. -+ size = data_len;
  14424. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  14425. - size += 1 + 3 + sizeof(u32);
  14426. - nvp->nvram = kzalloc(size, GFP_KERNEL);
  14427. -@@ -362,18 +362,18 @@ fail:
  14428. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  14429. - * End of buffer is completed with token identifying length of buffer.
  14430. - */
  14431. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  14432. -- u16 domain_nr, u16 bus_nr)
  14433. -+static void *brcmf_fw_nvram_strip(const u8 *data, size_t data_len,
  14434. -+ u32 *new_length, u16 domain_nr, u16 bus_nr)
  14435. - {
  14436. - struct nvram_parser nvp;
  14437. - u32 pad;
  14438. - u32 token;
  14439. - __le32 token_le;
  14440. -
  14441. -- if (brcmf_init_nvram_parser(&nvp, nv) < 0)
  14442. -+ if (brcmf_init_nvram_parser(&nvp, data, data_len) < 0)
  14443. - return NULL;
  14444. -
  14445. -- while (nvp.pos < nv->size) {
  14446. -+ while (nvp.pos < data_len) {
  14447. - nvp.state = nv_parser_states[nvp.state](&nvp);
  14448. - if (nvp.state == END)
  14449. - break;
  14450. -@@ -432,7 +432,7 @@ static void brcmf_fw_request_nvram_done(
  14451. - goto fail;
  14452. -
  14453. - if (fw) {
  14454. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  14455. -+ nvram = brcmf_fw_nvram_strip(fw->data, fw->size, &nvram_length,
  14456. - fwctx->domain_nr, fwctx->bus_nr);
  14457. - release_firmware(fw);
  14458. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  14459. diff --git a/package/kernel/mac80211/patches/383-b43-fix-support-for-14e4-4321-PCI-dev-with-BCM4321-c.patch b/package/kernel/mac80211/patches/383-b43-fix-support-for-14e4-4321-PCI-dev-with-BCM4321-c.patch
  14460. deleted file mode 100644
  14461. index 4ecef3b..0000000
  14462. --- a/package/kernel/mac80211/patches/383-b43-fix-support-for-14e4-4321-PCI-dev-with-BCM4321-c.patch
  14463. +++ /dev/null
  14464. @@ -1,32 +0,0 @@
  14465. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  14466. -Date: Sat, 6 Jun 2015 22:45:59 +0200
  14467. -Subject: [PATCH] b43: fix support for 14e4:4321 PCI dev with BCM4321 chipset
  14468. -MIME-Version: 1.0
  14469. -Content-Type: text/plain; charset=UTF-8
  14470. -Content-Transfer-Encoding: 8bit
  14471. -
  14472. -It seems Broadcom released two devices with conflicting device id. There
  14473. -are for sure 14e4:4321 PCI devices with BCM4321 (N-PHY) chipset, they
  14474. -can be found in routers, e.g. Netgear WNR834Bv2. However, according to
  14475. -Broadcom public sources 0x4321 is also used for 5 GHz BCM4306 (G-PHY).
  14476. -It's unsure if they meant PCI device id, or "virtual" id (from SPROM).
  14477. -To distinguish these devices lets check PHY type (G vs. N).
  14478. -
  14479. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  14480. -Cc: <stable@vger.kernel.org> # 3.16+
  14481. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14482. ----
  14483. -
  14484. ---- a/drivers/net/wireless/b43/main.c
  14485. -+++ b/drivers/net/wireless/b43/main.c
  14486. -@@ -5365,6 +5365,10 @@ static void b43_supported_bands(struct b
  14487. - *have_5ghz_phy = true;
  14488. - return;
  14489. - case 0x4321: /* BCM4306 */
  14490. -+ /* There are 14e4:4321 PCI devs with 2.4 GHz BCM4321 (N-PHY) */
  14491. -+ if (dev->phy.type != B43_PHYTYPE_G)
  14492. -+ break;
  14493. -+ /* fall through */
  14494. - case 0x4313: /* BCM4311 */
  14495. - case 0x431a: /* BCM4318 */
  14496. - case 0x432a: /* BCM4321 */
  14497. diff --git a/package/kernel/mac80211/patches/384-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/384-ath9k-force-rx_clear-when-disabling-rx.patch
  14498. deleted file mode 100644
  14499. index bddb15a..0000000
  14500. --- a/package/kernel/mac80211/patches/384-ath9k-force-rx_clear-when-disabling-rx.patch
  14501. +++ /dev/null
  14502. @@ -1,31 +0,0 @@
  14503. -From: Felix Fietkau <nbd@openwrt.org>
  14504. -Date: Sun, 7 Jun 2015 13:53:35 +0200
  14505. -Subject: [PATCH] ath9k: force rx_clear when disabling rx
  14506. -
  14507. -This makes stopping Rx more reliable and should reduce the frequency of
  14508. -Rx related DMA stop warnings
  14509. -
  14510. -Cc: stable@vger.kernel.org
  14511. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  14512. ----
  14513. -
  14514. ---- a/drivers/net/wireless/ath/ath9k/mac.c
  14515. -+++ b/drivers/net/wireless/ath/ath9k/mac.c
  14516. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  14517. -
  14518. - ath9k_ani_reset(ah, is_scanning);
  14519. -
  14520. -- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  14521. -+ REG_CLR_BIT(ah, AR_DIAG_SW,
  14522. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  14523. - }
  14524. - EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  14525. -
  14526. - void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  14527. - {
  14528. -- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  14529. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  14530. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  14531. -
  14532. - ath9k_hw_disable_mib_counters(ah);
  14533. - }
  14534. diff --git a/package/kernel/mac80211/patches/385-ath9k_hw-fix-device-ID-check-for-AR956x.patch b/package/kernel/mac80211/patches/385-ath9k_hw-fix-device-ID-check-for-AR956x.patch
  14535. deleted file mode 100644
  14536. index 2674efb..0000000
  14537. --- a/package/kernel/mac80211/patches/385-ath9k_hw-fix-device-ID-check-for-AR956x.patch
  14538. +++ /dev/null
  14539. @@ -1,20 +0,0 @@
  14540. -From: Felix Fietkau <nbd@openwrt.org>
  14541. -Date: Sun, 21 Jun 2015 19:45:59 +0200
  14542. -Subject: [PATCH] ath9k_hw: fix device ID check for AR956x
  14543. -
  14544. -Because of the missing return, the macVersion value was being
  14545. -overwritten with an invalid register read
  14546. -
  14547. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  14548. ----
  14549. -
  14550. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  14551. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  14552. -@@ -278,6 +278,7 @@ static void ath9k_hw_read_revisions(stru
  14553. - return;
  14554. - case AR9300_DEVID_QCA956X:
  14555. - ah->hw_version.macVersion = AR_SREV_VERSION_9561;
  14556. -+ return;
  14557. - }
  14558. -
  14559. - val = REG_READ(ah, AR_SREV) & AR_SREV_ID;
  14560. diff --git a/package/kernel/mac80211/patches/385-brcmfmac-Update-msgbuf-read-pointer-quicker.patch b/package/kernel/mac80211/patches/385-brcmfmac-Update-msgbuf-read-pointer-quicker.patch
  14561. deleted file mode 100644
  14562. index 74df9f9..0000000
  14563. --- a/package/kernel/mac80211/patches/385-brcmfmac-Update-msgbuf-read-pointer-quicker.patch
  14564. +++ /dev/null
  14565. @@ -1,109 +0,0 @@
  14566. -From: Hante Meuleman <meuleman@broadcom.com>
  14567. -Date: Mon, 8 Jun 2015 14:38:32 +0200
  14568. -Subject: [PATCH] brcmfmac: Update msgbuf read pointer quicker.
  14569. -
  14570. -On device to host data using msgbuf the read pointer gets updated
  14571. -once all data is processed. Updating this pointer more frequently
  14572. -allows the firmware to add more data quicker. This will result in
  14573. -slightly higher and more stable throughput on CPU bounded host
  14574. -processors.
  14575. -
  14576. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14577. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14578. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14579. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14580. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14581. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14582. ----
  14583. -
  14584. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  14585. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  14586. -@@ -223,8 +223,6 @@ void brcmf_commonring_write_cancel(struc
  14587. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  14588. - u16 *n_items)
  14589. - {
  14590. -- void *ret_addr;
  14591. --
  14592. - if (commonring->cr_update_wptr)
  14593. - commonring->cr_update_wptr(commonring->cr_ctx);
  14594. -
  14595. -@@ -235,19 +233,18 @@ void *brcmf_commonring_get_read_ptr(stru
  14596. - if (*n_items == 0)
  14597. - return NULL;
  14598. -
  14599. -- ret_addr = commonring->buf_addr +
  14600. -- (commonring->r_ptr * commonring->item_len);
  14601. --
  14602. -- commonring->r_ptr += *n_items;
  14603. -- if (commonring->r_ptr == commonring->depth)
  14604. -- commonring->r_ptr = 0;
  14605. --
  14606. -- return ret_addr;
  14607. -+ return commonring->buf_addr +
  14608. -+ (commonring->r_ptr * commonring->item_len);
  14609. - }
  14610. -
  14611. -
  14612. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring)
  14613. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  14614. -+ u16 n_items)
  14615. - {
  14616. -+ commonring->r_ptr += n_items;
  14617. -+ if (commonring->r_ptr == commonring->depth)
  14618. -+ commonring->r_ptr = 0;
  14619. -+
  14620. - if (commonring->cr_write_rptr)
  14621. - return commonring->cr_write_rptr(commonring->cr_ctx);
  14622. -
  14623. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  14624. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  14625. -@@ -62,7 +62,8 @@ void brcmf_commonring_write_cancel(struc
  14626. - u16 n_items);
  14627. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  14628. - u16 *n_items);
  14629. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring);
  14630. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  14631. -+ u16 n_items);
  14632. -
  14633. - #define brcmf_commonring_n_items(commonring) (commonring->depth)
  14634. - #define brcmf_commonring_len_item(commonring) (commonring->item_len)
  14635. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  14636. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  14637. -@@ -75,6 +75,8 @@
  14638. -
  14639. - #define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  14640. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  14641. -+#define BRCMF_MSGBUF_UPDATE_RX_PTR_THRS 48
  14642. -+
  14643. -
  14644. - struct msgbuf_common_hdr {
  14645. - u8 msgtype;
  14646. -@@ -1257,19 +1259,27 @@ static void brcmf_msgbuf_process_rx(stru
  14647. - {
  14648. - void *buf;
  14649. - u16 count;
  14650. -+ u16 processed;
  14651. -
  14652. - again:
  14653. - buf = brcmf_commonring_get_read_ptr(commonring, &count);
  14654. - if (buf == NULL)
  14655. - return;
  14656. -
  14657. -+ processed = 0;
  14658. - while (count) {
  14659. - brcmf_msgbuf_process_msgtype(msgbuf,
  14660. - buf + msgbuf->rx_dataoffset);
  14661. - buf += brcmf_commonring_len_item(commonring);
  14662. -+ processed++;
  14663. -+ if (processed == BRCMF_MSGBUF_UPDATE_RX_PTR_THRS) {
  14664. -+ brcmf_commonring_read_complete(commonring, processed);
  14665. -+ processed = 0;
  14666. -+ }
  14667. - count--;
  14668. - }
  14669. -- brcmf_commonring_read_complete(commonring);
  14670. -+ if (processed)
  14671. -+ brcmf_commonring_read_complete(commonring, processed);
  14672. -
  14673. - if (commonring->r_ptr == 0)
  14674. - goto again;
  14675. diff --git a/package/kernel/mac80211/patches/386-brcmfmac-remove-chipinfo-debugfs-entry.patch b/package/kernel/mac80211/patches/386-brcmfmac-remove-chipinfo-debugfs-entry.patch
  14676. deleted file mode 100644
  14677. index 9e5b486..0000000
  14678. --- a/package/kernel/mac80211/patches/386-brcmfmac-remove-chipinfo-debugfs-entry.patch
  14679. +++ /dev/null
  14680. @@ -1,39 +0,0 @@
  14681. -From: Arend van Spriel <arend@broadcom.com>
  14682. -Date: Mon, 8 Jun 2015 14:38:33 +0200
  14683. -Subject: [PATCH] brcmfmac: remove chipinfo debugfs entry
  14684. -
  14685. -The information provided by chipinfo is also provided by the
  14686. -revinfo debugfs entry. Removing it from debugfs.
  14687. -
  14688. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14689. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14690. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14691. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14692. ----
  14693. -
  14694. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  14695. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  14696. -@@ -41,15 +41,6 @@ void brcmf_debugfs_exit(void)
  14697. - root_folder = NULL;
  14698. - }
  14699. -
  14700. --static int brcmf_debugfs_chipinfo_read(struct seq_file *seq, void *data)
  14701. --{
  14702. -- struct brcmf_bus *bus = dev_get_drvdata(seq->private);
  14703. --
  14704. -- seq_printf(seq, "chip: %x(%u) rev %u\n",
  14705. -- bus->chip, bus->chip, bus->chiprev);
  14706. -- return 0;
  14707. --}
  14708. --
  14709. - int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  14710. - {
  14711. - struct device *dev = drvr->bus_if->dev;
  14712. -@@ -58,7 +49,6 @@ int brcmf_debugfs_attach(struct brcmf_pu
  14713. - return -ENODEV;
  14714. -
  14715. - drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
  14716. -- brcmf_debugfs_add_entry(drvr, "chipinfo", brcmf_debugfs_chipinfo_read);
  14717. -
  14718. - return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
  14719. - }
  14720. diff --git a/package/kernel/mac80211/patches/387-brcmfmac-remove-watchdog-reset-from-brcmf_pcie_busco.patch b/package/kernel/mac80211/patches/387-brcmfmac-remove-watchdog-reset-from-brcmf_pcie_busco.patch
  14721. deleted file mode 100644
  14722. index c38b2cd..0000000
  14723. --- a/package/kernel/mac80211/patches/387-brcmfmac-remove-watchdog-reset-from-brcmf_pcie_busco.patch
  14724. +++ /dev/null
  14725. @@ -1,53 +0,0 @@
  14726. -From: Arend van Spriel <arend@broadcom.com>
  14727. -Date: Mon, 8 Jun 2015 14:38:34 +0200
  14728. -Subject: [PATCH] brcmfmac: remove watchdog reset from
  14729. - brcmf_pcie_buscoreprep()
  14730. -
  14731. -The watchdog reset as done in brcmf_pcie_buscoreprep() is not
  14732. -sufficient. It needs to modify PCIe core registers as well
  14733. -which is properly done by brcmf_pcie_reset_device() after the
  14734. -chip recognition is done. So the faulty watchdog reset can be
  14735. -removed as it was causing driver reload to fail and hang the
  14736. -system requiring a power-cycle. Instead the call to to the
  14737. -brcmf_pcie_reset_device() function is done twice in the unload.
  14738. -
  14739. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14740. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14741. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14742. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14743. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14744. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14745. ----
  14746. -
  14747. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14748. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14749. -@@ -1629,20 +1629,7 @@ static void brcmf_pcie_buscore_write32(v
  14750. -
  14751. - static int brcmf_pcie_buscoreprep(void *ctx)
  14752. - {
  14753. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  14754. -- int err;
  14755. --
  14756. -- err = brcmf_pcie_get_resource(devinfo);
  14757. -- if (err == 0) {
  14758. -- /* Set CC watchdog to reset all the cores on the chip to bring
  14759. -- * back dongle to a sane state.
  14760. -- */
  14761. -- brcmf_pcie_buscore_write32(ctx, CORE_CC_REG(SI_ENUM_BASE,
  14762. -- watchdog), 4);
  14763. -- msleep(100);
  14764. -- }
  14765. --
  14766. -- return err;
  14767. -+ return brcmf_pcie_get_resource(ctx);
  14768. - }
  14769. -
  14770. -
  14771. -@@ -1824,6 +1811,7 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  14772. - brcmf_pcie_intr_disable(devinfo);
  14773. -
  14774. - brcmf_detach(&pdev->dev);
  14775. -+ brcmf_pcie_reset_device(devinfo);
  14776. -
  14777. - kfree(bus->bus_priv.pcie);
  14778. - kfree(bus->msgbuf->flowrings);
  14779. diff --git a/package/kernel/mac80211/patches/388-brcmfmac-use-debugfs_create_devm_seqfile-helper-func.patch b/package/kernel/mac80211/patches/388-brcmfmac-use-debugfs_create_devm_seqfile-helper-func.patch
  14780. deleted file mode 100644
  14781. index 756fbb2..0000000
  14782. --- a/package/kernel/mac80211/patches/388-brcmfmac-use-debugfs_create_devm_seqfile-helper-func.patch
  14783. +++ /dev/null
  14784. @@ -1,69 +0,0 @@
  14785. -From: Arend van Spriel <arend@broadcom.com>
  14786. -Date: Mon, 8 Jun 2015 14:38:35 +0200
  14787. -Subject: [PATCH] brcmfmac: use debugfs_create_devm_seqfile() helper
  14788. - function
  14789. -
  14790. -Some time ago the function debugfs_create_devm_seqfile() was
  14791. -introduced in debugfs. The caller simply needs to provide a
  14792. -device pointer and read function. The function brcmf_debugfs_add_entry()
  14793. -is now simply a wrapper only doing the work for CONFIG_BRCMDBG.
  14794. -
  14795. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14796. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14797. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14798. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14799. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14800. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14801. ----
  14802. -
  14803. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  14804. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  14805. -@@ -64,44 +64,12 @@ struct dentry *brcmf_debugfs_get_devdir(
  14806. - return drvr->dbgfs_dir;
  14807. - }
  14808. -
  14809. --struct brcmf_debugfs_entry {
  14810. -- int (*read)(struct seq_file *seq, void *data);
  14811. -- struct brcmf_pub *drvr;
  14812. --};
  14813. --
  14814. --static int brcmf_debugfs_entry_open(struct inode *inode, struct file *f)
  14815. --{
  14816. -- struct brcmf_debugfs_entry *entry = inode->i_private;
  14817. --
  14818. -- return single_open(f, entry->read, entry->drvr->bus_if->dev);
  14819. --}
  14820. --
  14821. --static const struct file_operations brcmf_debugfs_def_ops = {
  14822. -- .owner = THIS_MODULE,
  14823. -- .open = brcmf_debugfs_entry_open,
  14824. -- .release = single_release,
  14825. -- .read = seq_read,
  14826. -- .llseek = seq_lseek
  14827. --};
  14828. --
  14829. - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
  14830. - int (*read_fn)(struct seq_file *seq, void *data))
  14831. - {
  14832. -- struct dentry *dentry = drvr->dbgfs_dir;
  14833. -- struct brcmf_debugfs_entry *entry;
  14834. --
  14835. -- if (IS_ERR_OR_NULL(dentry))
  14836. -- return -ENOENT;
  14837. --
  14838. -- entry = devm_kzalloc(drvr->bus_if->dev, sizeof(*entry), GFP_KERNEL);
  14839. -- if (!entry)
  14840. -- return -ENOMEM;
  14841. --
  14842. -- entry->read = read_fn;
  14843. -- entry->drvr = drvr;
  14844. --
  14845. -- dentry = debugfs_create_file(fn, S_IRUGO, dentry, entry,
  14846. -- &brcmf_debugfs_def_ops);
  14847. -+ struct dentry *e;
  14848. -
  14849. -- return PTR_ERR_OR_ZERO(dentry);
  14850. -+ e = debugfs_create_devm_seqfile(drvr->bus_if->dev, fn,
  14851. -+ drvr->dbgfs_dir, read_fn);
  14852. -+ return PTR_ERR_OR_ZERO(e);
  14853. - }
  14854. diff --git a/package/kernel/mac80211/patches/389-0001-brcmfmac-Check-if-firmware-supports-p2p.patch b/package/kernel/mac80211/patches/389-0001-brcmfmac-Check-if-firmware-supports-p2p.patch
  14855. deleted file mode 100644
  14856. index ff24a4a..0000000
  14857. --- a/package/kernel/mac80211/patches/389-0001-brcmfmac-Check-if-firmware-supports-p2p.patch
  14858. +++ /dev/null
  14859. @@ -1,42 +0,0 @@
  14860. -From: Pontus Fuchs <pontusf@broadcom.com>
  14861. -Date: Thu, 11 Jun 2015 00:12:17 +0200
  14862. -Subject: [PATCH] brcmfmac: Check if firmware supports p2p
  14863. -
  14864. -Add a feature flag to reflect the firmware's p2p capability.
  14865. -
  14866. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14867. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14868. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14869. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  14870. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14871. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14872. ----
  14873. -
  14874. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  14875. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  14876. -@@ -129,6 +129,7 @@ void brcmf_feat_attach(struct brcmf_pub
  14877. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  14878. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  14879. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  14880. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  14881. -
  14882. - /* set chip related quirks */
  14883. - switch (drvr->bus_if->chip) {
  14884. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  14885. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  14886. -@@ -23,12 +23,14 @@
  14887. - * MCHAN: multi-channel for concurrent P2P.
  14888. - * PNO: preferred network offload.
  14889. - * WOWL: Wake-On-WLAN.
  14890. -+ * P2P: peer-to-peer
  14891. - */
  14892. - #define BRCMF_FEAT_LIST \
  14893. - BRCMF_FEAT_DEF(MBSS) \
  14894. - BRCMF_FEAT_DEF(MCHAN) \
  14895. - BRCMF_FEAT_DEF(PNO) \
  14896. -- BRCMF_FEAT_DEF(WOWL)
  14897. -+ BRCMF_FEAT_DEF(WOWL) \
  14898. -+ BRCMF_FEAT_DEF(P2P)
  14899. - /*
  14900. - * Quirks:
  14901. - *
  14902. diff --git a/package/kernel/mac80211/patches/389-0002-brcmfmac-Build-wiphy-mode-and-interface-combinations.patch b/package/kernel/mac80211/patches/389-0002-brcmfmac-Build-wiphy-mode-and-interface-combinations.patch
  14903. deleted file mode 100644
  14904. index 3876ba0..0000000
  14905. --- a/package/kernel/mac80211/patches/389-0002-brcmfmac-Build-wiphy-mode-and-interface-combinations.patch
  14906. +++ /dev/null
  14907. @@ -1,198 +0,0 @@
  14908. -From: Pontus Fuchs <pontusf@broadcom.com>
  14909. -Date: Thu, 11 Jun 2015 00:12:18 +0200
  14910. -Subject: [PATCH] brcmfmac: Build wiphy mode and interface combinations
  14911. - dynamically
  14912. -
  14913. -Switch from using semi hard coded interface combinations. This makes
  14914. -it easier to announce what the firmware actually supports. This fixes
  14915. -the case where brcmfmac announces p2p but the firmware doesn't
  14916. -support it.
  14917. -
  14918. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14919. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14920. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14921. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  14922. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14923. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14924. ----
  14925. -
  14926. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  14927. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  14928. -@@ -52,8 +52,6 @@
  14929. - #define BRCMF_PNO_SCAN_COMPLETE 1
  14930. - #define BRCMF_PNO_SCAN_INCOMPLETE 0
  14931. -
  14932. --#define BRCMF_IFACE_MAX_CNT 3
  14933. --
  14934. - #define WPA_OUI "\x00\x50\xF2" /* WPA OUI */
  14935. - #define WPA_OUI_TYPE 1
  14936. - #define RSN_OUI "\x00\x0F\xAC" /* RSN OUI */
  14937. -@@ -5639,53 +5637,6 @@ static int brcmf_setup_wiphybands(struct
  14938. - return 0;
  14939. - }
  14940. -
  14941. --static const struct ieee80211_iface_limit brcmf_iface_limits_mbss[] = {
  14942. -- {
  14943. -- .max = 1,
  14944. -- .types = BIT(NL80211_IFTYPE_STATION) |
  14945. -- BIT(NL80211_IFTYPE_ADHOC)
  14946. -- },
  14947. -- {
  14948. -- .max = 4,
  14949. -- .types = BIT(NL80211_IFTYPE_AP)
  14950. -- },
  14951. -- {
  14952. -- .max = 1,
  14953. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  14954. -- BIT(NL80211_IFTYPE_P2P_GO)
  14955. -- },
  14956. -- {
  14957. -- .max = 1,
  14958. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  14959. -- }
  14960. --};
  14961. --
  14962. --static const struct ieee80211_iface_limit brcmf_iface_limits_sbss[] = {
  14963. -- {
  14964. -- .max = 2,
  14965. -- .types = BIT(NL80211_IFTYPE_STATION) |
  14966. -- BIT(NL80211_IFTYPE_ADHOC) |
  14967. -- BIT(NL80211_IFTYPE_AP)
  14968. -- },
  14969. -- {
  14970. -- .max = 1,
  14971. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  14972. -- BIT(NL80211_IFTYPE_P2P_GO)
  14973. -- },
  14974. -- {
  14975. -- .max = 1,
  14976. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  14977. -- }
  14978. --};
  14979. --static struct ieee80211_iface_combination brcmf_iface_combos[] = {
  14980. -- {
  14981. -- .max_interfaces = BRCMF_IFACE_MAX_CNT,
  14982. -- .num_different_channels = 1,
  14983. -- .n_limits = ARRAY_SIZE(brcmf_iface_limits_sbss),
  14984. -- .limits = brcmf_iface_limits_sbss,
  14985. -- }
  14986. --};
  14987. --
  14988. - static const struct ieee80211_txrx_stypes
  14989. - brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = {
  14990. - [NL80211_IFTYPE_STATION] = {
  14991. -@@ -5715,6 +5666,67 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  14992. - }
  14993. - };
  14994. -
  14995. -+static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  14996. -+{
  14997. -+ struct ieee80211_iface_combination *combo = NULL;
  14998. -+ struct ieee80211_iface_limit *limits = NULL;
  14999. -+ int i = 0, max_iface_cnt;
  15000. -+
  15001. -+ combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  15002. -+ if (!combo)
  15003. -+ goto err;
  15004. -+
  15005. -+ limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  15006. -+ if (!limits)
  15007. -+ goto err;
  15008. -+
  15009. -+ wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  15010. -+ BIT(NL80211_IFTYPE_ADHOC) |
  15011. -+ BIT(NL80211_IFTYPE_AP);
  15012. -+
  15013. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  15014. -+ combo->num_different_channels = 2;
  15015. -+ else
  15016. -+ combo->num_different_channels = 1;
  15017. -+
  15018. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  15019. -+ limits[i].max = 1;
  15020. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  15021. -+ limits[i].max = 4;
  15022. -+ limits[i++].types = BIT(NL80211_IFTYPE_AP);
  15023. -+ max_iface_cnt = 5;
  15024. -+ } else {
  15025. -+ limits[i].max = 2;
  15026. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  15027. -+ BIT(NL80211_IFTYPE_AP);
  15028. -+ max_iface_cnt = 2;
  15029. -+ }
  15030. -+
  15031. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  15032. -+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  15033. -+ BIT(NL80211_IFTYPE_P2P_GO) |
  15034. -+ BIT(NL80211_IFTYPE_P2P_DEVICE);
  15035. -+ limits[i].max = 1;
  15036. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  15037. -+ BIT(NL80211_IFTYPE_P2P_GO);
  15038. -+ limits[i].max = 1;
  15039. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  15040. -+ max_iface_cnt += 2;
  15041. -+ }
  15042. -+ combo->max_interfaces = max_iface_cnt;
  15043. -+ combo->limits = limits;
  15044. -+ combo->n_limits = i;
  15045. -+
  15046. -+ wiphy->iface_combinations = combo;
  15047. -+ wiphy->n_iface_combinations = 1;
  15048. -+ return 0;
  15049. -+
  15050. -+err:
  15051. -+ kfree(limits);
  15052. -+ kfree(combo);
  15053. -+ return -ENOMEM;
  15054. -+}
  15055. -+
  15056. - static void brcmf_wiphy_pno_params(struct wiphy *wiphy)
  15057. - {
  15058. - /* scheduled scan settings */
  15059. -@@ -5745,7 +5757,6 @@ static void brcmf_wiphy_wowl_params(stru
  15060. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  15061. - {
  15062. - struct ieee80211_supported_band *band;
  15063. -- struct ieee80211_iface_combination ifc_combo;
  15064. - __le32 bandlist[3];
  15065. - u32 n_bands;
  15066. - int err, i;
  15067. -@@ -5753,24 +5764,11 @@ static int brcmf_setup_wiphy(struct wiph
  15068. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  15069. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  15070. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  15071. -- wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  15072. -- BIT(NL80211_IFTYPE_ADHOC) |
  15073. -- BIT(NL80211_IFTYPE_AP) |
  15074. -- BIT(NL80211_IFTYPE_P2P_CLIENT) |
  15075. -- BIT(NL80211_IFTYPE_P2P_GO) |
  15076. -- BIT(NL80211_IFTYPE_P2P_DEVICE);
  15077. -- /* need VSDB firmware feature for concurrent channels */
  15078. -- ifc_combo = brcmf_iface_combos[0];
  15079. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  15080. -- ifc_combo.num_different_channels = 2;
  15081. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  15082. -- ifc_combo.n_limits = ARRAY_SIZE(brcmf_iface_limits_mbss),
  15083. -- ifc_combo.limits = brcmf_iface_limits_mbss;
  15084. -- }
  15085. -- wiphy->iface_combinations = kmemdup(&ifc_combo,
  15086. -- sizeof(ifc_combo),
  15087. -- GFP_KERNEL);
  15088. -- wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos);
  15089. -+
  15090. -+ err = brcmf_setup_ifmodes(wiphy, ifp);
  15091. -+ if (err)
  15092. -+ return err;
  15093. -+
  15094. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  15095. - wiphy->cipher_suites = __wl_cipher_suites;
  15096. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  15097. -@@ -6035,6 +6033,8 @@ static void brcmf_free_wiphy(struct wiph
  15098. - if (!wiphy)
  15099. - return;
  15100. -
  15101. -+ if (wiphy->iface_combinations)
  15102. -+ kfree(wiphy->iface_combinations->limits);
  15103. - kfree(wiphy->iface_combinations);
  15104. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  15105. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  15106. diff --git a/package/kernel/mac80211/patches/389-0003-brcmfmac-rework-.get_station-callback.patch b/package/kernel/mac80211/patches/389-0003-brcmfmac-rework-.get_station-callback.patch
  15107. deleted file mode 100644
  15108. index 7bd0686..0000000
  15109. --- a/package/kernel/mac80211/patches/389-0003-brcmfmac-rework-.get_station-callback.patch
  15110. +++ /dev/null
  15111. @@ -1,326 +0,0 @@
  15112. -From: Arend van Spriel <arend@broadcom.com>
  15113. -Date: Thu, 11 Jun 2015 00:12:19 +0200
  15114. -Subject: [PATCH] brcmfmac: rework .get_station() callback
  15115. -
  15116. -The .get_station() cfg80211 callback is used in several scenarios. In
  15117. -managed mode it can obtain information about the access-point and its
  15118. -BSS parameters. In managed mode it can also obtain information about
  15119. -TDLS peers. In AP mode it can obtain information about connected
  15120. -clients.
  15121. -
  15122. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15123. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15124. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15125. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15126. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15127. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15128. ----
  15129. -
  15130. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15131. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15132. -@@ -2395,27 +2395,80 @@ brcmf_cfg80211_reconfigure_wep(struct br
  15133. - brcmf_err("set wsec error (%d)\n", err);
  15134. - }
  15135. -
  15136. -+static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
  15137. -+{
  15138. -+ struct nl80211_sta_flag_update *sfu;
  15139. -+
  15140. -+ brcmf_dbg(TRACE, "flags %08x\n", fw_sta_flags);
  15141. -+ si->filled |= BIT(NL80211_STA_INFO_STA_FLAGS);
  15142. -+ sfu = &si->sta_flags;
  15143. -+ sfu->mask = BIT(NL80211_STA_FLAG_WME) |
  15144. -+ BIT(NL80211_STA_FLAG_AUTHENTICATED) |
  15145. -+ BIT(NL80211_STA_FLAG_ASSOCIATED) |
  15146. -+ BIT(NL80211_STA_FLAG_AUTHORIZED);
  15147. -+ if (fw_sta_flags & BRCMF_STA_WME)
  15148. -+ sfu->set |= BIT(NL80211_STA_FLAG_WME);
  15149. -+ if (fw_sta_flags & BRCMF_STA_AUTHE)
  15150. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
  15151. -+ if (fw_sta_flags & BRCMF_STA_ASSOC)
  15152. -+ sfu->set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
  15153. -+ if (fw_sta_flags & BRCMF_STA_AUTHO)
  15154. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
  15155. -+}
  15156. -+
  15157. -+static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
  15158. -+{
  15159. -+ struct {
  15160. -+ __le32 len;
  15161. -+ struct brcmf_bss_info_le bss_le;
  15162. -+ } *buf;
  15163. -+ u16 capability;
  15164. -+ int err;
  15165. -+
  15166. -+ buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
  15167. -+ if (!buf)
  15168. -+ return;
  15169. -+
  15170. -+ buf->len = cpu_to_le32(WL_BSS_INFO_MAX);
  15171. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
  15172. -+ WL_BSS_INFO_MAX);
  15173. -+ if (err) {
  15174. -+ brcmf_err("Failed to get bss info (%d)\n", err);
  15175. -+ return;
  15176. -+ }
  15177. -+ si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  15178. -+ si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period);
  15179. -+ si->bss_param.dtim_period = buf->bss_le.dtim_period;
  15180. -+ capability = le16_to_cpu(buf->bss_le.capability);
  15181. -+ if (capability & IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT)
  15182. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
  15183. -+ if (capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
  15184. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  15185. -+ if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
  15186. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  15187. -+}
  15188. -+
  15189. - static s32
  15190. - brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
  15191. - const u8 *mac, struct station_info *sinfo)
  15192. - {
  15193. - struct brcmf_if *ifp = netdev_priv(ndev);
  15194. -- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
  15195. -- struct brcmf_scb_val_le scb_val;
  15196. -- int rssi;
  15197. -- s32 rate;
  15198. - s32 err = 0;
  15199. -- u8 *bssid = profile->bssid;
  15200. - struct brcmf_sta_info_le sta_info_le;
  15201. -- u32 beacon_period;
  15202. -- u32 dtim_period;
  15203. -+ u32 sta_flags;
  15204. -+ u32 is_tdls_peer;
  15205. -
  15206. - brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
  15207. - if (!check_vif_up(ifp->vif))
  15208. - return -EIO;
  15209. -
  15210. -- if (brcmf_is_apmode(ifp->vif)) {
  15211. -- memcpy(&sta_info_le, mac, ETH_ALEN);
  15212. -+ memset(&sta_info_le, 0, sizeof(sta_info_le));
  15213. -+ memcpy(&sta_info_le, mac, ETH_ALEN);
  15214. -+ err = brcmf_fil_iovar_data_get(ifp, "tdls_sta_info",
  15215. -+ &sta_info_le,
  15216. -+ sizeof(sta_info_le));
  15217. -+ is_tdls_peer = !err;
  15218. -+ if (err) {
  15219. - err = brcmf_fil_iovar_data_get(ifp, "sta_info",
  15220. - &sta_info_le,
  15221. - sizeof(sta_info_le));
  15222. -@@ -2423,73 +2476,48 @@ brcmf_cfg80211_get_station(struct wiphy
  15223. - brcmf_err("GET STA INFO failed, %d\n", err);
  15224. - goto done;
  15225. - }
  15226. -- sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  15227. -- sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  15228. -- if (le32_to_cpu(sta_info_le.flags) & BRCMF_STA_ASSOC) {
  15229. -- sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  15230. -- sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  15231. -- }
  15232. -- brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n",
  15233. -- sinfo->inactive_time, sinfo->connected_time);
  15234. -- } else if (ifp->vif->wdev.iftype == NL80211_IFTYPE_STATION) {
  15235. -- if (memcmp(mac, bssid, ETH_ALEN)) {
  15236. -- brcmf_err("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n",
  15237. -- mac, bssid);
  15238. -- err = -ENOENT;
  15239. -- goto done;
  15240. -- }
  15241. -- /* Report the current tx rate */
  15242. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
  15243. -- if (err) {
  15244. -- brcmf_err("Could not get rate (%d)\n", err);
  15245. -- goto done;
  15246. -- } else {
  15247. -+ }
  15248. -+ brcmf_dbg(TRACE, "version %d\n", le16_to_cpu(sta_info_le.ver));
  15249. -+ sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  15250. -+ sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  15251. -+ sta_flags = le32_to_cpu(sta_info_le.flags);
  15252. -+ brcmf_convert_sta_flags(sta_flags, sinfo);
  15253. -+ sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  15254. -+ if (is_tdls_peer)
  15255. -+ sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  15256. -+ else
  15257. -+ sinfo->sta_flags.set &= ~BIT(NL80211_STA_FLAG_TDLS_PEER);
  15258. -+ if (sta_flags & BRCMF_STA_ASSOC) {
  15259. -+ sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  15260. -+ sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  15261. -+ brcmf_fill_bss_param(ifp, sinfo);
  15262. -+ }
  15263. -+ if (sta_flags & BRCMF_STA_SCBSTATS) {
  15264. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED);
  15265. -+ sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures);
  15266. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
  15267. -+ sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts);
  15268. -+ sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts);
  15269. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
  15270. -+ sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts);
  15271. -+ sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts);
  15272. -+ if (sinfo->tx_packets) {
  15273. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
  15274. -- sinfo->txrate.legacy = rate * 5;
  15275. -- brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2);
  15276. -+ sinfo->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate);
  15277. -+ sinfo->txrate.legacy /= 100;
  15278. - }
  15279. --
  15280. -- if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
  15281. -- &ifp->vif->sme_state)) {
  15282. -- memset(&scb_val, 0, sizeof(scb_val));
  15283. -- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
  15284. -- &scb_val, sizeof(scb_val));
  15285. -- if (err) {
  15286. -- brcmf_err("Could not get rssi (%d)\n", err);
  15287. -- goto done;
  15288. -- } else {
  15289. -- rssi = le32_to_cpu(scb_val.val);
  15290. -- sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  15291. -- sinfo->signal = rssi;
  15292. -- brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
  15293. -- }
  15294. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_BCNPRD,
  15295. -- &beacon_period);
  15296. -- if (err) {
  15297. -- brcmf_err("Could not get beacon period (%d)\n",
  15298. -- err);
  15299. -- goto done;
  15300. -- } else {
  15301. -- sinfo->bss_param.beacon_interval =
  15302. -- beacon_period;
  15303. -- brcmf_dbg(CONN, "Beacon peroid %d\n",
  15304. -- beacon_period);
  15305. -- }
  15306. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_DTIMPRD,
  15307. -- &dtim_period);
  15308. -- if (err) {
  15309. -- brcmf_err("Could not get DTIM period (%d)\n",
  15310. -- err);
  15311. -- goto done;
  15312. -- } else {
  15313. -- sinfo->bss_param.dtim_period = dtim_period;
  15314. -- brcmf_dbg(CONN, "DTIM peroid %d\n",
  15315. -- dtim_period);
  15316. -- }
  15317. -- sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  15318. -+ if (sinfo->rx_packets) {
  15319. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
  15320. -+ sinfo->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate);
  15321. -+ sinfo->rxrate.legacy /= 100;
  15322. -+ }
  15323. -+ if (le16_to_cpu(sta_info_le.ver) >= 4) {
  15324. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES);
  15325. -+ sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes);
  15326. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES);
  15327. -+ sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
  15328. - }
  15329. -- } else
  15330. -- err = -EPERM;
  15331. -+ }
  15332. - done:
  15333. - brcmf_dbg(TRACE, "Exit\n");
  15334. - return err;
  15335. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  15336. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  15337. -@@ -32,7 +32,11 @@
  15338. - #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */
  15339. - #define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002
  15340. -
  15341. --#define BRCMF_STA_ASSOC 0x10 /* Associated */
  15342. -+#define BRCMF_STA_WME 0x00000002 /* WMM association */
  15343. -+#define BRCMF_STA_AUTHE 0x00000008 /* Authenticated */
  15344. -+#define BRCMF_STA_ASSOC 0x00000010 /* Associated */
  15345. -+#define BRCMF_STA_AUTHO 0x00000020 /* Authorized */
  15346. -+#define BRCMF_STA_SCBSTATS 0x00004000 /* Per STA debug stats */
  15347. -
  15348. - /* size of brcmf_scan_params not including variable length array */
  15349. - #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
  15350. -@@ -113,6 +117,7 @@
  15351. - #define BRCMF_WOWL_MAXPATTERNSIZE 128
  15352. -
  15353. - #define BRCMF_COUNTRY_BUF_SZ 4
  15354. -+#define BRCMF_ANT_MAX 4
  15355. -
  15356. - /* join preference types for join_pref iovar */
  15357. - enum brcmf_join_pref_types {
  15358. -@@ -456,25 +461,61 @@ struct brcmf_channel_info_le {
  15359. - };
  15360. -
  15361. - struct brcmf_sta_info_le {
  15362. -- __le16 ver; /* version of this struct */
  15363. -- __le16 len; /* length in bytes of this structure */
  15364. -- __le16 cap; /* sta's advertised capabilities */
  15365. -- __le32 flags; /* flags defined below */
  15366. -- __le32 idle; /* time since data pkt rx'd from sta */
  15367. -- u8 ea[ETH_ALEN]; /* Station address */
  15368. -- __le32 count; /* # rates in this set */
  15369. -- u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  15370. -+ __le16 ver; /* version of this struct */
  15371. -+ __le16 len; /* length in bytes of this structure */
  15372. -+ __le16 cap; /* sta's advertised capabilities */
  15373. -+ __le32 flags; /* flags defined below */
  15374. -+ __le32 idle; /* time since data pkt rx'd from sta */
  15375. -+ u8 ea[ETH_ALEN]; /* Station address */
  15376. -+ __le32 count; /* # rates in this set */
  15377. -+ u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  15378. - /* w/hi bit set if basic */
  15379. -- __le32 in; /* seconds elapsed since associated */
  15380. -- __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  15381. -- __le32 tx_pkts; /* # of packets transmitted */
  15382. -- __le32 tx_failures; /* # of packets failed */
  15383. -- __le32 rx_ucast_pkts; /* # of unicast packets received */
  15384. -- __le32 rx_mcast_pkts; /* # of multicast packets received */
  15385. -- __le32 tx_rate; /* Rate of last successful tx frame */
  15386. -- __le32 rx_rate; /* Rate of last successful rx frame */
  15387. -- __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  15388. -- __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  15389. -+ __le32 in; /* seconds elapsed since associated */
  15390. -+ __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  15391. -+ __le32 tx_pkts; /* # of packets transmitted */
  15392. -+ __le32 tx_failures; /* # of packets failed */
  15393. -+ __le32 rx_ucast_pkts; /* # of unicast packets received */
  15394. -+ __le32 rx_mcast_pkts; /* # of multicast packets received */
  15395. -+ __le32 tx_rate; /* Rate of last successful tx frame */
  15396. -+ __le32 rx_rate; /* Rate of last successful rx frame */
  15397. -+ __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  15398. -+ __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  15399. -+ __le32 tx_tot_pkts; /* # of tx pkts (ucast + mcast) */
  15400. -+ __le32 rx_tot_pkts; /* # of data packets recvd (uni + mcast) */
  15401. -+ __le32 tx_mcast_pkts; /* # of mcast pkts txed */
  15402. -+ __le64 tx_tot_bytes; /* data bytes txed (ucast + mcast) */
  15403. -+ __le64 rx_tot_bytes; /* data bytes recvd (ucast + mcast) */
  15404. -+ __le64 tx_ucast_bytes; /* data bytes txed (ucast) */
  15405. -+ __le64 tx_mcast_bytes; /* # data bytes txed (mcast) */
  15406. -+ __le64 rx_ucast_bytes; /* data bytes recvd (ucast) */
  15407. -+ __le64 rx_mcast_bytes; /* data bytes recvd (mcast) */
  15408. -+ s8 rssi[BRCMF_ANT_MAX]; /* per antenna rssi */
  15409. -+ s8 nf[BRCMF_ANT_MAX]; /* per antenna noise floor */
  15410. -+ __le16 aid; /* association ID */
  15411. -+ __le16 ht_capabilities; /* advertised ht caps */
  15412. -+ __le16 vht_flags; /* converted vht flags */
  15413. -+ __le32 tx_pkts_retry_cnt; /* # of frames where a retry was
  15414. -+ * exhausted.
  15415. -+ */
  15416. -+ __le32 tx_pkts_retry_exhausted; /* # of user frames where a retry
  15417. -+ * was exhausted
  15418. -+ */
  15419. -+ s8 rx_lastpkt_rssi[BRCMF_ANT_MAX]; /* Per antenna RSSI of last
  15420. -+ * received data frame.
  15421. -+ */
  15422. -+ /* TX WLAN retry/failure statistics:
  15423. -+ * Separated for host requested frames and locally generated frames.
  15424. -+ * Include unicast frame only where the retries/failures can be counted.
  15425. -+ */
  15426. -+ __le32 tx_pkts_total; /* # user frames sent successfully */
  15427. -+ __le32 tx_pkts_retries; /* # user frames retries */
  15428. -+ __le32 tx_pkts_fw_total; /* # FW generated sent successfully */
  15429. -+ __le32 tx_pkts_fw_retries; /* # retries for FW generated frames */
  15430. -+ __le32 tx_pkts_fw_retry_exhausted; /* # FW generated where a retry
  15431. -+ * was exhausted
  15432. -+ */
  15433. -+ __le32 rx_pkts_retried; /* # rx with retry bit set */
  15434. -+ __le32 tx_rate_fallback; /* lowest fallback TX rate */
  15435. - };
  15436. -
  15437. - struct brcmf_chanspec_list {
  15438. diff --git a/package/kernel/mac80211/patches/389-0004-brcmfmac-have-sdio-return-EIO-when-device-communicat.patch b/package/kernel/mac80211/patches/389-0004-brcmfmac-have-sdio-return-EIO-when-device-communicat.patch
  15439. deleted file mode 100644
  15440. index 302bc3e..0000000
  15441. --- a/package/kernel/mac80211/patches/389-0004-brcmfmac-have-sdio-return-EIO-when-device-communicat.patch
  15442. +++ /dev/null
  15443. @@ -1,56 +0,0 @@
  15444. -From: Arend van Spriel <arend@broadcom.com>
  15445. -Date: Thu, 11 Jun 2015 00:12:20 +0200
  15446. -Subject: [PATCH] brcmfmac: have sdio return -EIO when device communication
  15447. - is not possible
  15448. -
  15449. -The bus interface functions txctl and rxctl may be used while the device
  15450. -can not be accessed, eg. upon driver .remove() callback. This patch will
  15451. -immediately return -EIO when this is the case which speeds up the module
  15452. -unload.
  15453. -
  15454. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15455. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15456. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15457. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15458. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15459. ----
  15460. -
  15461. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15462. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15463. -@@ -988,6 +988,7 @@ static void brcmf_sdiod_freezer_detach(s
  15464. -
  15465. - static int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev)
  15466. - {
  15467. -+ sdiodev->state = BRCMF_SDIOD_DOWN;
  15468. - if (sdiodev->bus) {
  15469. - brcmf_sdio_remove(sdiodev->bus);
  15470. - sdiodev->bus = NULL;
  15471. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15472. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15473. -@@ -2820,6 +2820,8 @@ static int brcmf_sdio_bus_txdata(struct
  15474. - struct brcmf_sdio *bus = sdiodev->bus;
  15475. -
  15476. - brcmf_dbg(TRACE, "Enter: pkt: data %p len %d\n", pkt->data, pkt->len);
  15477. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  15478. -+ return -EIO;
  15479. -
  15480. - /* Add space for the header */
  15481. - skb_push(pkt, bus->tx_hdrlen);
  15482. -@@ -2948,6 +2950,8 @@ brcmf_sdio_bus_txctl(struct device *dev,
  15483. - int ret;
  15484. -
  15485. - brcmf_dbg(TRACE, "Enter\n");
  15486. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  15487. -+ return -EIO;
  15488. -
  15489. - /* Send from dpc */
  15490. - bus->ctrl_frame_buf = msg;
  15491. -@@ -3238,6 +3242,8 @@ brcmf_sdio_bus_rxctl(struct device *dev,
  15492. - struct brcmf_sdio *bus = sdiodev->bus;
  15493. -
  15494. - brcmf_dbg(TRACE, "Enter\n");
  15495. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  15496. -+ return -EIO;
  15497. -
  15498. - /* Wait until control frame is available */
  15499. - timeleft = brcmf_sdio_dcmd_resp_wait(bus, &bus->rxlen, &pending);
  15500. diff --git a/package/kernel/mac80211/patches/389-0005-ath9k-make-DMA-stop-related-messages-debug-only.patch b/package/kernel/mac80211/patches/389-0005-ath9k-make-DMA-stop-related-messages-debug-only.patch
  15501. deleted file mode 100644
  15502. index 34af6d2..0000000
  15503. --- a/package/kernel/mac80211/patches/389-0005-ath9k-make-DMA-stop-related-messages-debug-only.patch
  15504. +++ /dev/null
  15505. @@ -1,74 +0,0 @@
  15506. -From: Felix Fietkau <nbd@openwrt.org>
  15507. -Date: Thu, 2 Jul 2015 13:35:05 +0200
  15508. -Subject: [PATCH] ath9k: make DMA stop related messages debug-only
  15509. -
  15510. -A long time ago, ath9k had issues during reset where the DMA engine
  15511. -would stay active and could potentially corrupt memory.
  15512. -To debug those issues, the driver would print warnings whenever they
  15513. -occur.
  15514. -
  15515. -Nowadays, these issues are gone and the primary cause of these messages
  15516. -is if the MAC is stuck during reset or busy processing a long
  15517. -transmission. This is fairly harmless, yet these messages continue to
  15518. -worry users.
  15519. -
  15520. -To reduce the number of bogus bug reports, turn these messages into
  15521. -debug messages and count their occurence in the "reset" debugfs file.
  15522. -
  15523. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  15524. ----
  15525. -
  15526. ---- a/drivers/net/wireless/ath/ath9k/debug.c
  15527. -+++ b/drivers/net/wireless/ath/ath9k/debug.c
  15528. -@@ -765,6 +765,8 @@ static int read_file_reset(struct seq_fi
  15529. - [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
  15530. - [RESET_TYPE_MCI] = "MCI Reset",
  15531. - [RESET_TYPE_CALIBRATION] = "Calibration error",
  15532. -+ [RESET_TX_DMA_ERROR] = "Tx DMA stop error",
  15533. -+ [RESET_RX_DMA_ERROR] = "Rx DMA stop error",
  15534. - };
  15535. - int i;
  15536. -
  15537. ---- a/drivers/net/wireless/ath/ath9k/debug.h
  15538. -+++ b/drivers/net/wireless/ath/ath9k/debug.h
  15539. -@@ -50,6 +50,8 @@ enum ath_reset_type {
  15540. - RESET_TYPE_BEACON_STUCK,
  15541. - RESET_TYPE_MCI,
  15542. - RESET_TYPE_CALIBRATION,
  15543. -+ RESET_TX_DMA_ERROR,
  15544. -+ RESET_RX_DMA_ERROR,
  15545. - __RESET_TYPE_MAX
  15546. - };
  15547. -
  15548. ---- a/drivers/net/wireless/ath/ath9k/recv.c
  15549. -+++ b/drivers/net/wireless/ath/ath9k/recv.c
  15550. -@@ -496,10 +496,9 @@ bool ath_stoprecv(struct ath_softc *sc)
  15551. -
  15552. - if (!(ah->ah_flags & AH_UNPLUGGED) &&
  15553. - unlikely(!stopped)) {
  15554. -- ath_err(ath9k_hw_common(sc->sc_ah),
  15555. -- "Could not stop RX, we could be "
  15556. -- "confusing the DMA engine when we start RX up\n");
  15557. -- ATH_DBG_WARN_ON_ONCE(!stopped);
  15558. -+ ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
  15559. -+ "Failed to stop Rx DMA\n");
  15560. -+ RESET_STAT_INC(sc, RESET_RX_DMA_ERROR);
  15561. - }
  15562. - return stopped && !reset;
  15563. - }
  15564. ---- a/drivers/net/wireless/ath/ath9k/xmit.c
  15565. -+++ b/drivers/net/wireless/ath/ath9k/xmit.c
  15566. -@@ -1896,8 +1896,11 @@ bool ath_drain_all_txq(struct ath_softc
  15567. - npend |= BIT(i);
  15568. - }
  15569. -
  15570. -- if (npend)
  15571. -- ath_err(common, "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  15572. -+ if (npend) {
  15573. -+ RESET_STAT_INC(sc, RESET_TX_DMA_ERROR);
  15574. -+ ath_dbg(common, RESET,
  15575. -+ "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  15576. -+ }
  15577. -
  15578. - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
  15579. - if (!ATH_TXQ_SETUP(sc, i))
  15580. diff --git a/package/kernel/mac80211/patches/389-0006-brcmfmac-free-ifp-for-non-netdev-interface-in-p2p-mo.patch b/package/kernel/mac80211/patches/389-0006-brcmfmac-free-ifp-for-non-netdev-interface-in-p2p-mo.patch
  15581. deleted file mode 100644
  15582. index 06f2dce..0000000
  15583. --- a/package/kernel/mac80211/patches/389-0006-brcmfmac-free-ifp-for-non-netdev-interface-in-p2p-mo.patch
  15584. +++ /dev/null
  15585. @@ -1,44 +0,0 @@
  15586. -From: Arend van Spriel <arend@broadcom.com>
  15587. -Date: Thu, 11 Jun 2015 00:12:21 +0200
  15588. -Subject: [PATCH] brcmfmac: free ifp for non-netdev interface in p2p module
  15589. -
  15590. -Making it more clear by freeing the ifp in same place where the
  15591. -vif object is freed.
  15592. -
  15593. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15594. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15595. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15596. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15597. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15598. ----
  15599. -
  15600. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  15601. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  15602. -@@ -867,8 +867,6 @@ static void brcmf_del_if(struct brcmf_pu
  15603. - }
  15604. - /* unregister will take care of freeing it */
  15605. - unregister_netdev(ifp->ndev);
  15606. -- } else {
  15607. -- kfree(ifp);
  15608. - }
  15609. - }
  15610. -
  15611. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  15612. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  15613. -@@ -2238,6 +2238,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  15614. - {
  15615. - cfg80211_unregister_wdev(&vif->wdev);
  15616. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  15617. -+ kfree(vif->ifp);
  15618. - brcmf_free_vif(vif);
  15619. - }
  15620. -
  15621. -@@ -2361,6 +2362,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  15622. - break;
  15623. -
  15624. - case NL80211_IFTYPE_P2P_DEVICE:
  15625. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  15626. -+ brcmf_p2p_deinit_discovery(p2p);
  15627. - brcmf_p2p_delete_p2pdev(p2p, vif);
  15628. - return 0;
  15629. - default:
  15630. diff --git a/package/kernel/mac80211/patches/389-0007-brcmfmac-move-p2p-attach-detach-functions.patch b/package/kernel/mac80211/patches/389-0007-brcmfmac-move-p2p-attach-detach-functions.patch
  15631. deleted file mode 100644
  15632. index 0a6e093..0000000
  15633. --- a/package/kernel/mac80211/patches/389-0007-brcmfmac-move-p2p-attach-detach-functions.patch
  15634. +++ /dev/null
  15635. @@ -1,225 +0,0 @@
  15636. -From: Arend van Spriel <arend@broadcom.com>
  15637. -Date: Thu, 11 Jun 2015 00:12:22 +0200
  15638. -Subject: [PATCH] brcmfmac: move p2p attach/detach functions
  15639. -
  15640. -Moving two functions in p2p.c as is so next change will be
  15641. -easier to review.
  15642. -
  15643. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15644. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15645. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15646. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15647. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15648. ----
  15649. -
  15650. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  15651. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  15652. -@@ -1908,105 +1908,6 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  15653. -
  15654. -
  15655. - /**
  15656. -- * brcmf_p2p_attach() - attach for P2P.
  15657. -- *
  15658. -- * @cfg: driver private data for cfg80211 interface.
  15659. -- */
  15660. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  15661. --{
  15662. -- struct brcmf_if *pri_ifp;
  15663. -- struct brcmf_if *p2p_ifp;
  15664. -- struct brcmf_cfg80211_vif *p2p_vif;
  15665. -- struct brcmf_p2p_info *p2p;
  15666. -- struct brcmf_pub *drvr;
  15667. -- s32 bssidx;
  15668. -- s32 err = 0;
  15669. --
  15670. -- p2p = &cfg->p2p;
  15671. -- p2p->cfg = cfg;
  15672. --
  15673. -- drvr = cfg->pub;
  15674. --
  15675. -- pri_ifp = drvr->iflist[0];
  15676. -- p2p_ifp = drvr->iflist[1];
  15677. --
  15678. -- p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  15679. --
  15680. -- if (p2p_ifp) {
  15681. -- p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  15682. -- false);
  15683. -- if (IS_ERR(p2p_vif)) {
  15684. -- brcmf_err("could not create discovery vif\n");
  15685. -- err = -ENOMEM;
  15686. -- goto exit;
  15687. -- }
  15688. --
  15689. -- p2p_vif->ifp = p2p_ifp;
  15690. -- p2p_ifp->vif = p2p_vif;
  15691. -- p2p_vif->wdev.netdev = p2p_ifp->ndev;
  15692. -- p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  15693. -- SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  15694. --
  15695. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  15696. --
  15697. -- brcmf_p2p_generate_bss_mac(p2p, NULL);
  15698. -- memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  15699. -- brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  15700. --
  15701. -- /* Initialize P2P Discovery in the firmware */
  15702. -- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  15703. -- if (err < 0) {
  15704. -- brcmf_err("set p2p_disc error\n");
  15705. -- brcmf_free_vif(p2p_vif);
  15706. -- goto exit;
  15707. -- }
  15708. -- /* obtain bsscfg index for P2P discovery */
  15709. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  15710. -- if (err < 0) {
  15711. -- brcmf_err("retrieving discover bsscfg index failed\n");
  15712. -- brcmf_free_vif(p2p_vif);
  15713. -- goto exit;
  15714. -- }
  15715. -- /* Verify that firmware uses same bssidx as driver !! */
  15716. -- if (p2p_ifp->bssidx != bssidx) {
  15717. -- brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  15718. -- bssidx, p2p_ifp->bssidx);
  15719. -- brcmf_free_vif(p2p_vif);
  15720. -- goto exit;
  15721. -- }
  15722. --
  15723. -- init_completion(&p2p->send_af_done);
  15724. -- INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  15725. -- init_completion(&p2p->afx_hdl.act_frm_scan);
  15726. -- init_completion(&p2p->wait_next_af);
  15727. -- }
  15728. --exit:
  15729. -- return err;
  15730. --}
  15731. --
  15732. --
  15733. --/**
  15734. -- * brcmf_p2p_detach() - detach P2P.
  15735. -- *
  15736. -- * @p2p: P2P specific data.
  15737. -- */
  15738. --void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  15739. --{
  15740. -- struct brcmf_cfg80211_vif *vif;
  15741. --
  15742. -- vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  15743. -- if (vif != NULL) {
  15744. -- brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  15745. -- brcmf_p2p_deinit_discovery(p2p);
  15746. -- /* remove discovery interface */
  15747. -- brcmf_free_vif(vif);
  15748. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  15749. -- }
  15750. -- /* just set it all to zero */
  15751. -- memset(p2p, 0, sizeof(*p2p));
  15752. --}
  15753. --
  15754. --/**
  15755. - * brcmf_p2p_get_current_chanspec() - Get current operation channel.
  15756. - *
  15757. - * @p2p: P2P specific data.
  15758. -@@ -2425,3 +2326,102 @@ void brcmf_p2p_stop_device(struct wiphy
  15759. - clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  15760. - mutex_unlock(&cfg->usr_sync);
  15761. - }
  15762. -+
  15763. -+/**
  15764. -+ * brcmf_p2p_attach() - attach for P2P.
  15765. -+ *
  15766. -+ * @cfg: driver private data for cfg80211 interface.
  15767. -+ */
  15768. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  15769. -+{
  15770. -+ struct brcmf_if *pri_ifp;
  15771. -+ struct brcmf_if *p2p_ifp;
  15772. -+ struct brcmf_cfg80211_vif *p2p_vif;
  15773. -+ struct brcmf_p2p_info *p2p;
  15774. -+ struct brcmf_pub *drvr;
  15775. -+ s32 bssidx;
  15776. -+ s32 err = 0;
  15777. -+
  15778. -+ p2p = &cfg->p2p;
  15779. -+ p2p->cfg = cfg;
  15780. -+
  15781. -+ drvr = cfg->pub;
  15782. -+
  15783. -+ pri_ifp = drvr->iflist[0];
  15784. -+ p2p_ifp = drvr->iflist[1];
  15785. -+
  15786. -+ p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  15787. -+
  15788. -+ if (p2p_ifp) {
  15789. -+ p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  15790. -+ false);
  15791. -+ if (IS_ERR(p2p_vif)) {
  15792. -+ brcmf_err("could not create discovery vif\n");
  15793. -+ err = -ENOMEM;
  15794. -+ goto exit;
  15795. -+ }
  15796. -+
  15797. -+ p2p_vif->ifp = p2p_ifp;
  15798. -+ p2p_ifp->vif = p2p_vif;
  15799. -+ p2p_vif->wdev.netdev = p2p_ifp->ndev;
  15800. -+ p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  15801. -+ SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  15802. -+
  15803. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  15804. -+
  15805. -+ brcmf_p2p_generate_bss_mac(p2p, NULL);
  15806. -+ memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  15807. -+ brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  15808. -+
  15809. -+ /* Initialize P2P Discovery in the firmware */
  15810. -+ err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  15811. -+ if (err < 0) {
  15812. -+ brcmf_err("set p2p_disc error\n");
  15813. -+ brcmf_free_vif(p2p_vif);
  15814. -+ goto exit;
  15815. -+ }
  15816. -+ /* obtain bsscfg index for P2P discovery */
  15817. -+ err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  15818. -+ if (err < 0) {
  15819. -+ brcmf_err("retrieving discover bsscfg index failed\n");
  15820. -+ brcmf_free_vif(p2p_vif);
  15821. -+ goto exit;
  15822. -+ }
  15823. -+ /* Verify that firmware uses same bssidx as driver !! */
  15824. -+ if (p2p_ifp->bssidx != bssidx) {
  15825. -+ brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  15826. -+ bssidx, p2p_ifp->bssidx);
  15827. -+ brcmf_free_vif(p2p_vif);
  15828. -+ goto exit;
  15829. -+ }
  15830. -+
  15831. -+ init_completion(&p2p->send_af_done);
  15832. -+ INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  15833. -+ init_completion(&p2p->afx_hdl.act_frm_scan);
  15834. -+ init_completion(&p2p->wait_next_af);
  15835. -+ }
  15836. -+exit:
  15837. -+ return err;
  15838. -+}
  15839. -+
  15840. -+/**
  15841. -+ * brcmf_p2p_detach() - detach P2P.
  15842. -+ *
  15843. -+ * @p2p: P2P specific data.
  15844. -+ */
  15845. -+void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  15846. -+{
  15847. -+ struct brcmf_cfg80211_vif *vif;
  15848. -+
  15849. -+ vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  15850. -+ if (vif != NULL) {
  15851. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  15852. -+ brcmf_p2p_deinit_discovery(p2p);
  15853. -+ /* remove discovery interface */
  15854. -+ brcmf_free_vif(vif);
  15855. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  15856. -+ }
  15857. -+ /* just set it all to zero */
  15858. -+ memset(p2p, 0, sizeof(*p2p));
  15859. -+}
  15860. -+
  15861. diff --git a/package/kernel/mac80211/patches/389-0008-brcmfmac-assure-p2pdev-is-unregistered-upon-driver-u.patch b/package/kernel/mac80211/patches/389-0008-brcmfmac-assure-p2pdev-is-unregistered-upon-driver-u.patch
  15862. deleted file mode 100644
  15863. index 72e8eed..0000000
  15864. --- a/package/kernel/mac80211/patches/389-0008-brcmfmac-assure-p2pdev-is-unregistered-upon-driver-u.patch
  15865. +++ /dev/null
  15866. @@ -1,63 +0,0 @@
  15867. -From: Arend van Spriel <arend@broadcom.com>
  15868. -Date: Thu, 11 Jun 2015 00:12:23 +0200
  15869. -Subject: [PATCH] brcmfmac: assure p2pdev is unregistered upon driver
  15870. - unload
  15871. -
  15872. -When unloading the driver with a p2pdev interface it resulted in
  15873. -a warning upon calling wiphy_unregister() and subsequently a crash
  15874. -in the driver. This patch assures the p2pdev is unregistered calling
  15875. -unregister_wdev() before doing the wiphy_unregister().
  15876. -
  15877. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15878. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15879. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15880. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15881. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15882. ----
  15883. -
  15884. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15885. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15886. -@@ -6206,10 +6206,8 @@ void brcmf_cfg80211_detach(struct brcmf_
  15887. - if (!cfg)
  15888. - return;
  15889. -
  15890. -- WARN_ON(!list_empty(&cfg->vif_list));
  15891. -- wiphy_unregister(cfg->wiphy);
  15892. - brcmf_btcoex_detach(cfg);
  15893. -- brcmf_p2p_detach(&cfg->p2p);
  15894. -+ wiphy_unregister(cfg->wiphy);
  15895. - wl_deinit_priv(cfg);
  15896. - brcmf_free_wiphy(cfg->wiphy);
  15897. - }
  15898. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  15899. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  15900. -@@ -1098,6 +1098,7 @@ void brcmf_detach(struct device *dev)
  15901. -
  15902. - /* stop firmware event handling */
  15903. - brcmf_fweh_detach(drvr);
  15904. -+ brcmf_p2p_detach(&drvr->config->p2p);
  15905. -
  15906. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  15907. -
  15908. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  15909. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  15910. -@@ -16,6 +16,7 @@
  15911. - #include <linux/slab.h>
  15912. - #include <linux/netdevice.h>
  15913. - #include <linux/etherdevice.h>
  15914. -+#include <linux/rtnetlink.h>
  15915. - #include <net/cfg80211.h>
  15916. -
  15917. - #include <brcmu_wifi.h>
  15918. -@@ -2418,8 +2419,9 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  15919. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  15920. - brcmf_p2p_deinit_discovery(p2p);
  15921. - /* remove discovery interface */
  15922. -- brcmf_free_vif(vif);
  15923. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  15924. -+ rtnl_lock();
  15925. -+ brcmf_p2p_delete_p2pdev(p2p, vif);
  15926. -+ rtnl_unlock();
  15927. - }
  15928. - /* just set it all to zero */
  15929. - memset(p2p, 0, sizeof(*p2p));
  15930. diff --git a/package/kernel/mac80211/patches/390-0001-brcmfmac-fix-double-free-of-p2pdev-interface.patch b/package/kernel/mac80211/patches/390-0001-brcmfmac-fix-double-free-of-p2pdev-interface.patch
  15931. deleted file mode 100644
  15932. index 179c77e..0000000
  15933. --- a/package/kernel/mac80211/patches/390-0001-brcmfmac-fix-double-free-of-p2pdev-interface.patch
  15934. +++ /dev/null
  15935. @@ -1,27 +0,0 @@
  15936. -From: Arend van Spriel <arend@broadcom.com>
  15937. -Date: Mon, 15 Jun 2015 22:48:38 +0200
  15938. -Subject: [PATCH] brcmfmac: fix double free of p2pdev interface
  15939. -
  15940. -When freeing the driver ifp pointer it should also be removed from
  15941. -the driver interface list, which is what brcmf_remove_interface()
  15942. -does. Otherwise, the ifp pointer will be freed twice triggering
  15943. -a kernel oops.
  15944. -
  15945. -Fixes: f37d69a4babc ("brcmfmac: free ifp for non-netdev interface in p2p module")
  15946. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15947. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15948. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15949. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15950. ----
  15951. -
  15952. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  15953. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  15954. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  15955. - {
  15956. - cfg80211_unregister_wdev(&vif->wdev);
  15957. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  15958. -- kfree(vif->ifp);
  15959. -+ brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  15960. - brcmf_free_vif(vif);
  15961. - }
  15962. -
  15963. diff --git a/package/kernel/mac80211/patches/390-0002-brcmfmac-make-brcmf_p2p_detach-call-conditional.patch b/package/kernel/mac80211/patches/390-0002-brcmfmac-make-brcmf_p2p_detach-call-conditional.patch
  15964. deleted file mode 100644
  15965. index e4f88b5..0000000
  15966. --- a/package/kernel/mac80211/patches/390-0002-brcmfmac-make-brcmf_p2p_detach-call-conditional.patch
  15967. +++ /dev/null
  15968. @@ -1,29 +0,0 @@
  15969. -From: Arend van Spriel <arend@broadcom.com>
  15970. -Date: Mon, 15 Jun 2015 22:48:39 +0200
  15971. -Subject: [PATCH] brcmfmac: make brcmf_p2p_detach() call conditional
  15972. -
  15973. -During verification of error handling in brcmf_cfg80211_attach() a
  15974. -null pointer dereference occurred upon calling brcmf_p2p_detach()
  15975. -from brcmf_detach(). This should only be called when the
  15976. -brcmf_cfg80211_attach() has succeeded.
  15977. -
  15978. -Fixes: f7a40873d2fa ("brcmfmac: assure p2pdev is unregistered upon driver unload")
  15979. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15980. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15981. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15982. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15983. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15984. ----
  15985. -
  15986. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  15987. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  15988. -@@ -1098,7 +1098,8 @@ void brcmf_detach(struct device *dev)
  15989. -
  15990. - /* stop firmware event handling */
  15991. - brcmf_fweh_detach(drvr);
  15992. -- brcmf_p2p_detach(&drvr->config->p2p);
  15993. -+ if (drvr->config)
  15994. -+ brcmf_p2p_detach(&drvr->config->p2p);
  15995. -
  15996. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  15997. -
  15998. diff --git a/package/kernel/mac80211/patches/391-brcmfmac-set-wiphy-s-addresses-to-provide-valid-MACs.patch b/package/kernel/mac80211/patches/391-brcmfmac-set-wiphy-s-addresses-to-provide-valid-MACs.patch
  15999. deleted file mode 100644
  16000. index 0a81237..0000000
  16001. --- a/package/kernel/mac80211/patches/391-brcmfmac-set-wiphy-s-addresses-to-provide-valid-MACs.patch
  16002. +++ /dev/null
  16003. @@ -1,67 +0,0 @@
  16004. -From: Rafa? Mi?ecki <zajec5@gmail.com>
  16005. -Date: Thu, 9 Jul 2015 17:07:08 +0200
  16006. -Subject: [PATCH] brcmfmac: set wiphy's addresses to provide valid MACs
  16007. -
  16008. -Broadcom's firmware requires every BSS to use MAC address with unique
  16009. -last few bits. The amount of bits may depend on a particular firmware,
  16010. -it was verified to be 2 for BCM43602 one.
  16011. -If this condition won't be fulfilled firmware will reject such MAC:
  16012. -brcmfmac: _brcmf_set_mac_address: Setting cur_etheraddr failed, -52
  16013. -
  16014. -We don't want to simply set addr_mask as it would also disallow using
  16015. -locally administrated bit. Instead let's build a list of addresses
  16016. -manually enabling 0x2 bit for extra interfaces.
  16017. -
  16018. -Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
  16019. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16020. ----
  16021. -
  16022. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16023. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16024. -@@ -5784,6 +5784,7 @@ static void brcmf_wiphy_wowl_params(stru
  16025. -
  16026. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  16027. - {
  16028. -+ struct brcmf_pub *drvr = ifp->drvr;
  16029. - struct ieee80211_supported_band *band;
  16030. - __le32 bandlist[3];
  16031. - u32 n_bands;
  16032. -@@ -5797,6 +5798,19 @@ static int brcmf_setup_wiphy(struct wiph
  16033. - if (err)
  16034. - return err;
  16035. -
  16036. -+ for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  16037. -+ i < ARRAY_SIZE(drvr->addresses); i++) {
  16038. -+ u8 *addr = drvr->addresses[i].addr;
  16039. -+
  16040. -+ memcpy(addr, drvr->mac, ETH_ALEN);
  16041. -+ if (i) {
  16042. -+ addr[0] |= BIT(1);
  16043. -+ addr[ETH_ALEN - 1] ^= i;
  16044. -+ }
  16045. -+ }
  16046. -+ wiphy->addresses = drvr->addresses;
  16047. -+ wiphy->n_addresses = i;
  16048. -+
  16049. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  16050. - wiphy->cipher_suites = __wl_cipher_suites;
  16051. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  16052. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  16053. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  16054. -@@ -21,6 +21,7 @@
  16055. - #ifndef BRCMFMAC_CORE_H
  16056. - #define BRCMFMAC_CORE_H
  16057. -
  16058. -+#include <net/cfg80211.h>
  16059. - #include "fweh.h"
  16060. -
  16061. - #define TOE_TX_CSUM_OL 0x00000001
  16062. -@@ -118,6 +119,8 @@ struct brcmf_pub {
  16063. - /* Multicast data packets sent to dongle */
  16064. - unsigned long tx_multicast;
  16065. -
  16066. -+ struct mac_address addresses[BRCMF_MAX_IFS];
  16067. -+
  16068. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  16069. -
  16070. - struct mutex proto_block;
  16071. diff --git a/package/kernel/mac80211/patches/392-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch b/package/kernel/mac80211/patches/392-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  16072. deleted file mode 100644
  16073. index e44f121..0000000
  16074. --- a/package/kernel/mac80211/patches/392-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  16075. +++ /dev/null
  16076. @@ -1,45 +0,0 @@
  16077. -From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
  16078. -Date: Thu, 9 Jul 2015 13:43:18 +0530
  16079. -Subject: [PATCH] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
  16080. -
  16081. -There's already a generic implementation so use that instead.
  16082. -
  16083. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16084. ----
  16085. -
  16086. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16087. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16088. -@@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(st
  16089. - }
  16090. - }
  16091. -
  16092. --static void atomic_orr(int val, atomic_t *v)
  16093. --{
  16094. -- int old_val;
  16095. --
  16096. -- old_val = atomic_read(v);
  16097. -- while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
  16098. -- old_val = atomic_read(v);
  16099. --}
  16100. --
  16101. - static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
  16102. - {
  16103. - struct brcmf_core *buscore;
  16104. -@@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struc
  16105. - if (val) {
  16106. - brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
  16107. - bus->sdcnt.f1regdata++;
  16108. -- atomic_orr(val, &bus->intstatus);
  16109. -+ atomic_or(val, &bus->intstatus);
  16110. - }
  16111. -
  16112. - return ret;
  16113. -@@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  16114. -
  16115. - /* Keep still-pending events for next scheduling */
  16116. - if (intstatus)
  16117. -- atomic_orr(intstatus, &bus->intstatus);
  16118. -+ atomic_or(intstatus, &bus->intstatus);
  16119. -
  16120. - brcmf_sdio_clrintr(bus);
  16121. -
  16122. diff --git a/package/kernel/mac80211/patches/393-0001-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch b/package/kernel/mac80211/patches/393-0001-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  16123. deleted file mode 100644
  16124. index 76ca143..0000000
  16125. --- a/package/kernel/mac80211/patches/393-0001-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  16126. +++ /dev/null
  16127. @@ -1,46 +0,0 @@
  16128. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16129. -Date: Thu, 20 Aug 2015 00:16:42 +0200
  16130. -Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
  16131. - addresses
  16132. -MIME-Version: 1.0
  16133. -Content-Type: text/plain; charset=UTF-8
  16134. -Content-Transfer-Encoding: 8bit
  16135. -
  16136. -Broadcom is working on better reflection of interface combinations. With
  16137. -upcoming patches we may have 1st combination supporting less interfaces
  16138. -than others.
  16139. -To don't run out of addresses check all combinations to find the one
  16140. -with the greatest max_interfaces value.
  16141. -
  16142. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16143. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16144. ----
  16145. -
  16146. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16147. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16148. -@@ -5785,7 +5785,9 @@ static void brcmf_wiphy_wowl_params(stru
  16149. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  16150. - {
  16151. - struct brcmf_pub *drvr = ifp->drvr;
  16152. -+ const struct ieee80211_iface_combination *combo;
  16153. - struct ieee80211_supported_band *band;
  16154. -+ u16 max_interfaces = 0;
  16155. - __le32 bandlist[3];
  16156. - u32 n_bands;
  16157. - int err, i;
  16158. -@@ -5798,8 +5800,13 @@ static int brcmf_setup_wiphy(struct wiph
  16159. - if (err)
  16160. - return err;
  16161. -
  16162. -- for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  16163. -- i < ARRAY_SIZE(drvr->addresses); i++) {
  16164. -+ for (i = 0, combo = wiphy->iface_combinations;
  16165. -+ i < wiphy->n_iface_combinations; i++, combo++) {
  16166. -+ max_interfaces = max(max_interfaces, combo->max_interfaces);
  16167. -+ }
  16168. -+
  16169. -+ for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
  16170. -+ i++) {
  16171. - u8 *addr = drvr->addresses[i].addr;
  16172. -
  16173. - memcpy(addr, drvr->mac, ETH_ALEN);
  16174. diff --git a/package/kernel/mac80211/patches/393-0002-brcmfmac-correct-interface-combination-info.patch b/package/kernel/mac80211/patches/393-0002-brcmfmac-correct-interface-combination-info.patch
  16175. deleted file mode 100644
  16176. index c4a0720..0000000
  16177. --- a/package/kernel/mac80211/patches/393-0002-brcmfmac-correct-interface-combination-info.patch
  16178. +++ /dev/null
  16179. @@ -1,204 +0,0 @@
  16180. -From: Arend van Spriel <arend@broadcom.com>
  16181. -Date: Thu, 20 Aug 2015 22:06:03 +0200
  16182. -Subject: [PATCH] brcmfmac: correct interface combination info
  16183. -
  16184. -The interface combination provided by brcmfmac did not truly reflect
  16185. -the combinations supported by driver and/or firmware.
  16186. -
  16187. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16188. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16189. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16190. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  16191. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16192. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16193. ----
  16194. -
  16195. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16196. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16197. -@@ -5694,63 +5694,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  16198. - }
  16199. - };
  16200. -
  16201. -+/**
  16202. -+ * brcmf_setup_ifmodes() - determine interface modes and combinations.
  16203. -+ *
  16204. -+ * @wiphy: wiphy object.
  16205. -+ * @ifp: interface object needed for feat module api.
  16206. -+ *
  16207. -+ * The interface modes and combinations are determined dynamically here
  16208. -+ * based on firmware functionality.
  16209. -+ *
  16210. -+ * no p2p and no mbss:
  16211. -+ *
  16212. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  16213. -+ *
  16214. -+ * no p2p and mbss:
  16215. -+ *
  16216. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  16217. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  16218. -+ *
  16219. -+ * p2p, no mchan, and mbss:
  16220. -+ *
  16221. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
  16222. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  16223. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  16224. -+ *
  16225. -+ * p2p, mchan, and mbss:
  16226. -+ *
  16227. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  16228. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  16229. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  16230. -+ */
  16231. - static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  16232. - {
  16233. - struct ieee80211_iface_combination *combo = NULL;
  16234. -- struct ieee80211_iface_limit *limits = NULL;
  16235. -- int i = 0, max_iface_cnt;
  16236. -+ struct ieee80211_iface_limit *c0_limits = NULL;
  16237. -+ struct ieee80211_iface_limit *p2p_limits = NULL;
  16238. -+ struct ieee80211_iface_limit *mbss_limits = NULL;
  16239. -+ bool mbss, p2p;
  16240. -+ int i, c, n_combos;
  16241. -
  16242. -- combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  16243. -+ mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
  16244. -+ p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
  16245. -+
  16246. -+ n_combos = 1 + !!p2p + !!mbss;
  16247. -+ combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
  16248. - if (!combo)
  16249. - goto err;
  16250. -
  16251. -- limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  16252. -- if (!limits)
  16253. -+ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  16254. -+ if (!c0_limits)
  16255. - goto err;
  16256. -
  16257. -+ if (p2p) {
  16258. -+ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  16259. -+ if (!p2p_limits)
  16260. -+ goto err;
  16261. -+ }
  16262. -+
  16263. -+ if (mbss) {
  16264. -+ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  16265. -+ if (!mbss_limits)
  16266. -+ goto err;
  16267. -+ }
  16268. -+
  16269. - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  16270. - BIT(NL80211_IFTYPE_ADHOC) |
  16271. - BIT(NL80211_IFTYPE_AP);
  16272. -
  16273. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  16274. -- combo->num_different_channels = 2;
  16275. -- else
  16276. -- combo->num_different_channels = 1;
  16277. --
  16278. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  16279. -- limits[i].max = 1;
  16280. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  16281. -- limits[i].max = 4;
  16282. -- limits[i++].types = BIT(NL80211_IFTYPE_AP);
  16283. -- max_iface_cnt = 5;
  16284. -- } else {
  16285. -- limits[i].max = 2;
  16286. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  16287. -- BIT(NL80211_IFTYPE_AP);
  16288. -- max_iface_cnt = 2;
  16289. -- }
  16290. --
  16291. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  16292. -+ c = 0;
  16293. -+ i = 0;
  16294. -+ combo[c].num_different_channels = 1;
  16295. -+ c0_limits[i].max = 1;
  16296. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  16297. -+ if (p2p) {
  16298. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  16299. -+ combo[c].num_different_channels = 2;
  16300. - wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  16301. - BIT(NL80211_IFTYPE_P2P_GO) |
  16302. - BIT(NL80211_IFTYPE_P2P_DEVICE);
  16303. -- limits[i].max = 1;
  16304. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  16305. -- BIT(NL80211_IFTYPE_P2P_GO);
  16306. -- limits[i].max = 1;
  16307. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  16308. -- max_iface_cnt += 2;
  16309. -- }
  16310. -- combo->max_interfaces = max_iface_cnt;
  16311. -- combo->limits = limits;
  16312. -- combo->n_limits = i;
  16313. -+ c0_limits[i].max = 1;
  16314. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  16315. -+ c0_limits[i].max = 1;
  16316. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  16317. -+ BIT(NL80211_IFTYPE_P2P_GO);
  16318. -+ } else {
  16319. -+ c0_limits[i].max = 1;
  16320. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  16321. -+ }
  16322. -+ combo[c].max_interfaces = i;
  16323. -+ combo[c].n_limits = i;
  16324. -+ combo[c].limits = c0_limits;
  16325. -+
  16326. -+ if (p2p) {
  16327. -+ c++;
  16328. -+ i = 0;
  16329. -+ combo[c].num_different_channels = 1;
  16330. -+ p2p_limits[i].max = 1;
  16331. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  16332. -+ p2p_limits[i].max = 1;
  16333. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  16334. -+ p2p_limits[i].max = 1;
  16335. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  16336. -+ p2p_limits[i].max = 1;
  16337. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  16338. -+ combo[c].max_interfaces = i;
  16339. -+ combo[c].n_limits = i;
  16340. -+ combo[c].limits = p2p_limits;
  16341. -+ }
  16342. -
  16343. -+ if (mbss) {
  16344. -+ c++;
  16345. -+ combo[c].beacon_int_infra_match = true;
  16346. -+ combo[c].num_different_channels = 1;
  16347. -+ mbss_limits[0].max = 4;
  16348. -+ mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  16349. -+ combo[c].max_interfaces = 4;
  16350. -+ combo[c].n_limits = 1;
  16351. -+ combo[c].limits = mbss_limits;
  16352. -+ }
  16353. -+ wiphy->n_iface_combinations = n_combos;
  16354. - wiphy->iface_combinations = combo;
  16355. -- wiphy->n_iface_combinations = 1;
  16356. - return 0;
  16357. -
  16358. - err:
  16359. -- kfree(limits);
  16360. -+ kfree(c0_limits);
  16361. -+ kfree(p2p_limits);
  16362. -+ kfree(mbss_limits);
  16363. - kfree(combo);
  16364. - return -ENOMEM;
  16365. - }
  16366. -@@ -6079,11 +6148,15 @@ static void brcmf_cfg80211_reg_notifier(
  16367. -
  16368. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  16369. - {
  16370. -+ int i;
  16371. -+
  16372. - if (!wiphy)
  16373. - return;
  16374. -
  16375. -- if (wiphy->iface_combinations)
  16376. -- kfree(wiphy->iface_combinations->limits);
  16377. -+ if (wiphy->iface_combinations) {
  16378. -+ for (i = 0; i < wiphy->n_iface_combinations; i++)
  16379. -+ kfree(wiphy->iface_combinations[i].limits);
  16380. -+ }
  16381. - kfree(wiphy->iface_combinations);
  16382. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  16383. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  16384. diff --git a/package/kernel/mac80211/patches/393-0003-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch b/package/kernel/mac80211/patches/393-0003-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  16385. deleted file mode 100644
  16386. index 9768ef2..0000000
  16387. --- a/package/kernel/mac80211/patches/393-0003-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  16388. +++ /dev/null
  16389. @@ -1,87 +0,0 @@
  16390. -From: Franky Lin <frankyl@broadcom.com>
  16391. -Date: Thu, 20 Aug 2015 22:06:04 +0200
  16392. -Subject: [PATCH] brcmfmac: add debugfs entry for msgbuf statistics
  16393. -
  16394. -Expose ring buffer read/write pointers and other useful statistics
  16395. -through debugfs.
  16396. -
  16397. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16398. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16399. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16400. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16401. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16402. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16403. ----
  16404. -
  16405. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16406. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16407. -@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct
  16408. - }
  16409. - }
  16410. -
  16411. -+#ifdef DEBUG
  16412. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  16413. -+{
  16414. -+ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  16415. -+ struct brcmf_pub *drvr = bus_if->drvr;
  16416. -+ struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  16417. -+ struct brcmf_commonring *commonring;
  16418. -+ u16 i;
  16419. -+ struct brcmf_flowring_ring *ring;
  16420. -+ struct brcmf_flowring_hash *hash;
  16421. -+
  16422. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
  16423. -+ seq_printf(seq, "h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n",
  16424. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  16425. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
  16426. -+ seq_printf(seq, "h2d_rx_submit: rp %4u, wp %4u, depth %4u\n",
  16427. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  16428. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
  16429. -+ seq_printf(seq, "d2h_ctl_cmplt: rp %4u, wp %4u, depth %4u\n",
  16430. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  16431. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
  16432. -+ seq_printf(seq, "d2h_tx_cmplt: rp %4u, wp %4u, depth %4u\n",
  16433. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  16434. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
  16435. -+ seq_printf(seq, "d2h_rx_cmplt: rp %4u, wp %4u, depth %4u\n",
  16436. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  16437. -+
  16438. -+ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
  16439. -+ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
  16440. -+ seq_puts(seq, "Active flowrings:\n");
  16441. -+ hash = msgbuf->flow->hash;
  16442. -+ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
  16443. -+ if (!msgbuf->flow->rings[i])
  16444. -+ continue;
  16445. -+ ring = msgbuf->flow->rings[i];
  16446. -+ if (ring->status != RING_OPEN)
  16447. -+ continue;
  16448. -+ commonring = msgbuf->flowrings[i];
  16449. -+ hash = &msgbuf->flow->hash[ring->hash_id];
  16450. -+ seq_printf(seq, "id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n"
  16451. -+ " ifidx %u, fifo %u, da %pM\n",
  16452. -+ i, commonring->r_ptr, commonring->w_ptr,
  16453. -+ skb_queue_len(&ring->skblist), ring->blocked,
  16454. -+ hash->ifidx, hash->fifo, hash->mac);
  16455. -+ }
  16456. -+
  16457. -+ return 0;
  16458. -+}
  16459. -+#else
  16460. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  16461. -+{
  16462. -+ return 0;
  16463. -+}
  16464. -+#endif
  16465. -
  16466. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
  16467. - {
  16468. -@@ -1460,6 +1514,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  16469. - spin_lock_init(&msgbuf->flowring_work_lock);
  16470. - INIT_LIST_HEAD(&msgbuf->work_queue);
  16471. -
  16472. -+ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read);
  16473. -+
  16474. - return 0;
  16475. -
  16476. - fail:
  16477. diff --git a/package/kernel/mac80211/patches/393-0004-brcmfmac-make-use-of-cfg80211_check_combinations.patch b/package/kernel/mac80211/patches/393-0004-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  16478. deleted file mode 100644
  16479. index 2b84cf9..0000000
  16480. --- a/package/kernel/mac80211/patches/393-0004-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  16481. +++ /dev/null
  16482. @@ -1,83 +0,0 @@
  16483. -From: Arend van Spriel <arend@broadcom.com>
  16484. -Date: Thu, 20 Aug 2015 22:06:05 +0200
  16485. -Subject: [PATCH] brcmfmac: make use of cfg80211_check_combinations()
  16486. -
  16487. -Use cfg80211_check_combinations() so we can bail out early when an
  16488. -interface add or change results in an invalid combination.
  16489. -
  16490. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16491. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16492. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16493. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16494. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16495. ----
  16496. -
  16497. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16498. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16499. -@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 le
  16500. - return NULL;
  16501. - }
  16502. -
  16503. -+static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
  16504. -+ struct brcmf_cfg80211_vif *vif,
  16505. -+ enum nl80211_iftype new_type)
  16506. -+{
  16507. -+ int iftype_num[NUM_NL80211_IFTYPES];
  16508. -+ struct brcmf_cfg80211_vif *pos;
  16509. -+
  16510. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  16511. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  16512. -+ if (pos == vif)
  16513. -+ iftype_num[new_type]++;
  16514. -+ else
  16515. -+ iftype_num[pos->wdev.iftype]++;
  16516. -+
  16517. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  16518. -+}
  16519. -+
  16520. -+static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
  16521. -+ enum nl80211_iftype new_type)
  16522. -+{
  16523. -+ int iftype_num[NUM_NL80211_IFTYPES];
  16524. -+ struct brcmf_cfg80211_vif *pos;
  16525. -+
  16526. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  16527. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  16528. -+ iftype_num[pos->wdev.iftype]++;
  16529. -+
  16530. -+ iftype_num[new_type]++;
  16531. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  16532. -+}
  16533. -
  16534. - static void convert_key_from_CPU(struct brcmf_wsec_key *key,
  16535. - struct brcmf_wsec_key_le *key_le)
  16536. -@@ -662,8 +692,14 @@ static struct wireless_dev *brcmf_cfg802
  16537. - struct vif_params *params)
  16538. - {
  16539. - struct wireless_dev *wdev;
  16540. -+ int err;
  16541. -
  16542. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  16543. -+ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  16544. -+ if (err) {
  16545. -+ brcmf_err("iface validation failed: err=%d\n", err);
  16546. -+ return ERR_PTR(err);
  16547. -+ }
  16548. - switch (type) {
  16549. - case NL80211_IFTYPE_ADHOC:
  16550. - case NL80211_IFTYPE_STATION:
  16551. -@@ -822,8 +858,12 @@ brcmf_cfg80211_change_iface(struct wiphy
  16552. - s32 ap = 0;
  16553. - s32 err = 0;
  16554. -
  16555. -- brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
  16556. --
  16557. -+ brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  16558. -+ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  16559. -+ if (err) {
  16560. -+ brcmf_err("iface validation failed: err=%d\n", err);
  16561. -+ return err;
  16562. -+ }
  16563. - switch (type) {
  16564. - case NL80211_IFTYPE_MONITOR:
  16565. - case NL80211_IFTYPE_WDS:
  16566. diff --git a/package/kernel/mac80211/patches/393-0005-brcmfmac-block-the-correct-flowring-when-backup-queu.patch b/package/kernel/mac80211/patches/393-0005-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  16567. deleted file mode 100644
  16568. index 2d5f7b9..0000000
  16569. --- a/package/kernel/mac80211/patches/393-0005-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  16570. +++ /dev/null
  16571. @@ -1,48 +0,0 @@
  16572. -From: Franky Lin <frankyl@broadcom.com>
  16573. -Date: Thu, 20 Aug 2015 22:06:06 +0200
  16574. -Subject: [PATCH] brcmfmac: block the correct flowring when backup queue
  16575. - overflow
  16576. -
  16577. -brcmf_flowring_block blocks the last active flowring under the same
  16578. -interface instead of the one provided by caller. This could lead to a
  16579. -dead lock of netif stop if there are more than one flowring under the
  16580. -interface and the traffic is high enough so brcmf_flowring_enqueue can
  16581. -not unblock the ring right away.
  16582. -
  16583. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16584. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16585. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16586. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16587. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16588. ----
  16589. -
  16590. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  16591. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  16592. -@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct
  16593. - spin_lock_irqsave(&flow->block_lock, flags);
  16594. -
  16595. - ring = flow->rings[flowid];
  16596. -+ if (ring->blocked == blocked) {
  16597. -+ spin_unlock_irqrestore(&flow->block_lock, flags);
  16598. -+ return;
  16599. -+ }
  16600. - ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  16601. -
  16602. - currently_blocked = false;
  16603. - for (i = 0; i < flow->nrofrings; i++) {
  16604. -- if (flow->rings[i]) {
  16605. -+ if ((flow->rings[i]) && (i != flowid)) {
  16606. - ring = flow->rings[i];
  16607. - if ((ring->status == RING_OPEN) &&
  16608. - (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
  16609. -@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct
  16610. - }
  16611. - }
  16612. - }
  16613. -- ring->blocked = blocked;
  16614. -- if (currently_blocked == blocked) {
  16615. -+ flow->rings[flowid]->blocked = blocked;
  16616. -+ if (currently_blocked) {
  16617. - spin_unlock_irqrestore(&flow->block_lock, flags);
  16618. - return;
  16619. - }
  16620. diff --git a/package/kernel/mac80211/patches/393-0006-brcmfmac-bump-highest-event-number-for-4339-firmware.patch b/package/kernel/mac80211/patches/393-0006-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  16621. deleted file mode 100644
  16622. index 7378401..0000000
  16623. --- a/package/kernel/mac80211/patches/393-0006-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  16624. +++ /dev/null
  16625. @@ -1,52 +0,0 @@
  16626. -From: Arend van Spriel <arend@broadcom.com>
  16627. -Date: Thu, 20 Aug 2015 22:06:07 +0200
  16628. -Subject: [PATCH] brcmfmac: bump highest event number for 4339 firmware
  16629. -
  16630. -The event mask length is determined by the highest event number
  16631. -that is specified in the driver. When this length is shorter than
  16632. -firmware expects setting event mask will fail and device becomes
  16633. -pretty useless. This issue was reported with bcm4339 firmware that
  16634. -was recently released.
  16635. -
  16636. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  16637. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16638. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16639. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16640. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  16641. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16642. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16643. ----
  16644. -
  16645. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  16646. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  16647. -@@ -85,7 +85,6 @@ struct brcmf_event;
  16648. - BRCMF_ENUM_DEF(IF, 54) \
  16649. - BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \
  16650. - BRCMF_ENUM_DEF(RSSI, 56) \
  16651. -- BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
  16652. - BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
  16653. - BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
  16654. - BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
  16655. -@@ -103,8 +102,7 @@ struct brcmf_event;
  16656. - BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
  16657. - BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
  16658. - BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
  16659. -- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
  16660. -- BRCMF_ENUM_DEF(PSTA_PRIMARY_INTF_IND, 128)
  16661. -+ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
  16662. -
  16663. - #define BRCMF_ENUM_DEF(id, val) \
  16664. - BRCMF_E_##id = (val),
  16665. -@@ -112,7 +110,11 @@ struct brcmf_event;
  16666. - /* firmware event codes sent by the dongle */
  16667. - enum brcmf_fweh_event_code {
  16668. - BRCMF_FWEH_EVENT_ENUM_DEFLIST
  16669. -- BRCMF_E_LAST
  16670. -+ /* this determines event mask length which must match
  16671. -+ * minimum length check in device firmware so it is
  16672. -+ * hard-coded here.
  16673. -+ */
  16674. -+ BRCMF_E_LAST = 139
  16675. - };
  16676. - #undef BRCMF_ENUM_DEF
  16677. -
  16678. diff --git a/package/kernel/mac80211/patches/394-0001-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch b/package/kernel/mac80211/patches/394-0001-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  16679. deleted file mode 100644
  16680. index 97444b3..0000000
  16681. --- a/package/kernel/mac80211/patches/394-0001-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  16682. +++ /dev/null
  16683. @@ -1,138 +0,0 @@
  16684. -From: Arend van Spriel <arend@broadcom.com>
  16685. -Date: Wed, 26 Aug 2015 22:14:53 +0200
  16686. -Subject: [PATCH] brcmfmac: consolidate ifp lookup in driver core
  16687. -
  16688. -In rx path the firmware provide an interface index which is used to
  16689. -map to a struct brcmf_if instance. However, this involves some trick
  16690. -that is done in two places. This is changed by having driver core
  16691. -providing brcmf_get_ifp() function.
  16692. -
  16693. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16694. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16695. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16696. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16697. ----
  16698. -
  16699. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  16700. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  16701. -@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  16702. - struct sk_buff *pktbuf)
  16703. - {
  16704. - struct brcmf_proto_bcdc_header *h;
  16705. -+ struct brcmf_if *ifp;
  16706. -
  16707. - brcmf_dbg(BCDC, "Enter\n");
  16708. -
  16709. -@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  16710. - trace_brcmf_bcdchdr(pktbuf->data);
  16711. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  16712. -
  16713. -- *ifidx = BCDC_GET_IF_IDX(h);
  16714. -- if (*ifidx >= BRCMF_MAX_IFS) {
  16715. -- brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
  16716. -+ ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  16717. -+ if (IS_ERR_OR_NULL(ifp)) {
  16718. -+ brcmf_dbg(INFO, "no matching ifp found\n");
  16719. - return -EBADE;
  16720. - }
  16721. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  16722. -- * events this is easy because it contains the bssidx which maps
  16723. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  16724. -- * bssidx 1 is used for p2p0 and no data can be received or
  16725. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  16726. -- */
  16727. -- if (*ifidx)
  16728. -- (*ifidx)++;
  16729. --
  16730. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  16731. - BCDC_PROTO_VER) {
  16732. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  16733. -- brcmf_ifname(drvr, *ifidx), h->flags);
  16734. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  16735. - return -EBADE;
  16736. - }
  16737. -
  16738. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  16739. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  16740. -- brcmf_ifname(drvr, *ifidx), h->flags);
  16741. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  16742. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  16743. - }
  16744. -
  16745. -@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  16746. -
  16747. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  16748. - if (do_fws)
  16749. -- brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf);
  16750. -+ brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  16751. -+ pktbuf);
  16752. - else
  16753. - skb_pull(pktbuf, h->data_offset << 2);
  16754. -
  16755. - if (pktbuf->len == 0)
  16756. - return -ENODATA;
  16757. -+
  16758. -+ *ifidx = ifp->ifidx;
  16759. - return 0;
  16760. - }
  16761. -
  16762. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  16763. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  16764. -@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drv
  16765. - return "<if_none>";
  16766. - }
  16767. -
  16768. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  16769. -+{
  16770. -+ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  16771. -+ brcmf_err("ifidx %d out of range\n", ifidx);
  16772. -+ return ERR_PTR(-ERANGE);
  16773. -+ }
  16774. -+
  16775. -+ /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  16776. -+ * events this is easy because it contains the bssidx which maps
  16777. -+ * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  16778. -+ * bssidx 1 is used for p2p0 and no data can be received or
  16779. -+ * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  16780. -+ */
  16781. -+ if (ifidx)
  16782. -+ ifidx++;
  16783. -+
  16784. -+ return drvr->iflist[ifidx];
  16785. -+}
  16786. -+
  16787. - static void _brcmf_set_multicast_list(struct work_struct *work)
  16788. - {
  16789. - struct brcmf_if *ifp;
  16790. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  16791. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  16792. -@@ -202,7 +202,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  16793. -
  16794. - /* Return pointer to interface name */
  16795. - char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  16796. --
  16797. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  16798. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  16799. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  16800. - char *name, u8 *mac_addr);
  16801. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16802. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16803. -@@ -1081,16 +1081,8 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  16804. - {
  16805. - struct brcmf_if *ifp;
  16806. -
  16807. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  16808. -- * events this is easy because it contains the bssidx which maps
  16809. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  16810. -- * bssidx 1 is used for p2p0 and no data can be received or
  16811. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  16812. -- */
  16813. -- if (ifidx)
  16814. -- (ifidx)++;
  16815. -- ifp = msgbuf->drvr->iflist[ifidx];
  16816. -- if (!ifp || !ifp->ndev) {
  16817. -+ ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  16818. -+ if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  16819. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  16820. - brcmu_pkt_buf_free_skb(skb);
  16821. - return;
  16822. diff --git a/package/kernel/mac80211/patches/394-0002-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch b/package/kernel/mac80211/patches/394-0002-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  16823. deleted file mode 100644
  16824. index 632714c..0000000
  16825. --- a/package/kernel/mac80211/patches/394-0002-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  16826. +++ /dev/null
  16827. @@ -1,222 +0,0 @@
  16828. -From: Arend van Spriel <arend@broadcom.com>
  16829. -Date: Wed, 26 Aug 2015 22:14:54 +0200
  16830. -Subject: [PATCH] brcmfmac: make brcmf_proto_hdrpull() return struct
  16831. - brcmf_if instance
  16832. -
  16833. -Avoid spreading the ifidx in the driver, but have it return the
  16834. -struct brcmf_if instance.
  16835. -
  16836. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16837. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16838. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16839. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16840. ----
  16841. -
  16842. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  16843. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  16844. -@@ -272,11 +272,11 @@ brcmf_proto_bcdc_hdrpush(struct brcmf_pu
  16845. - }
  16846. -
  16847. - static int
  16848. --brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  16849. -- struct sk_buff *pktbuf)
  16850. -+brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  16851. -+ struct sk_buff *pktbuf, struct brcmf_if **ifp)
  16852. - {
  16853. - struct brcmf_proto_bcdc_header *h;
  16854. -- struct brcmf_if *ifp;
  16855. -+ struct brcmf_if *tmp_if;
  16856. -
  16857. - brcmf_dbg(BCDC, "Enter\n");
  16858. -
  16859. -@@ -290,21 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  16860. - trace_brcmf_bcdchdr(pktbuf->data);
  16861. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  16862. -
  16863. -- ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  16864. -- if (IS_ERR_OR_NULL(ifp)) {
  16865. -+ tmp_if = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  16866. -+ if (!tmp_if) {
  16867. - brcmf_dbg(INFO, "no matching ifp found\n");
  16868. - return -EBADE;
  16869. - }
  16870. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  16871. - BCDC_PROTO_VER) {
  16872. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  16873. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  16874. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  16875. - return -EBADE;
  16876. - }
  16877. -
  16878. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  16879. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  16880. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  16881. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  16882. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  16883. - }
  16884. -
  16885. -@@ -312,7 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  16886. -
  16887. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  16888. - if (do_fws)
  16889. -- brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  16890. -+ brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  16891. - pktbuf);
  16892. - else
  16893. - skb_pull(pktbuf, h->data_offset << 2);
  16894. -@@ -320,7 +320,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  16895. - if (pktbuf->len == 0)
  16896. - return -ENODATA;
  16897. -
  16898. -- *ifidx = ifp->ifidx;
  16899. -+ *ifp = tmp_if;
  16900. - return 0;
  16901. - }
  16902. -
  16903. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  16904. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  16905. -@@ -87,7 +87,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  16906. - {
  16907. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  16908. - brcmf_err("ifidx %d out of range\n", ifidx);
  16909. -- return ERR_PTR(-ERANGE);
  16910. -+ return NULL;
  16911. - }
  16912. -
  16913. - /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  16914. -@@ -539,17 +539,15 @@ void brcmf_rx_frame(struct device *dev,
  16915. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  16916. - struct brcmf_pub *drvr = bus_if->drvr;
  16917. - struct brcmf_skb_reorder_data *rd;
  16918. -- u8 ifidx;
  16919. - int ret;
  16920. -
  16921. - brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  16922. -
  16923. - /* process and remove protocol-specific header */
  16924. -- ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb);
  16925. -- ifp = drvr->iflist[ifidx];
  16926. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  16927. -
  16928. - if (ret || !ifp || !ifp->ndev) {
  16929. -- if ((ret != -ENODATA) && ifp)
  16930. -+ if (ret != -ENODATA && ifp)
  16931. - ifp->stats.rx_errors++;
  16932. - brcmu_pkt_buf_free_skb(skb);
  16933. - return;
  16934. -@@ -592,17 +590,17 @@ void brcmf_txcomplete(struct device *dev
  16935. - {
  16936. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  16937. - struct brcmf_pub *drvr = bus_if->drvr;
  16938. -- u8 ifidx;
  16939. -+ struct brcmf_if *ifp;
  16940. -
  16941. - /* await txstatus signal for firmware if active */
  16942. - if (brcmf_fws_fc_active(drvr->fws)) {
  16943. - if (!success)
  16944. - brcmf_fws_bustxfail(drvr->fws, txp);
  16945. - } else {
  16946. -- if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp))
  16947. -+ if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  16948. - brcmu_pkt_buf_free_skb(txp);
  16949. - else
  16950. -- brcmf_txfinalize(drvr, txp, ifidx, success);
  16951. -+ brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  16952. - }
  16953. - }
  16954. -
  16955. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  16956. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  16957. -@@ -1448,7 +1448,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  16958. - struct sk_buff *skb;
  16959. - struct brcmf_skbuff_cb *skcb;
  16960. - struct brcmf_fws_mac_descriptor *entry = NULL;
  16961. -- u8 ifidx;
  16962. -+ struct brcmf_if *ifp;
  16963. -
  16964. - brcmf_dbg(DATA, "flags %d\n", flags);
  16965. -
  16966. -@@ -1497,15 +1497,16 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  16967. - }
  16968. - brcmf_fws_macdesc_return_req_credit(skb);
  16969. -
  16970. -- if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) {
  16971. -+ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp);
  16972. -+ if (ret) {
  16973. - brcmu_pkt_buf_free_skb(skb);
  16974. - return -EINVAL;
  16975. - }
  16976. - if (!remove_from_hanger)
  16977. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx,
  16978. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  16979. - genbit, seq);
  16980. - if (remove_from_hanger || ret)
  16981. -- brcmf_txfinalize(fws->drvr, skb, ifidx, true);
  16982. -+ brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  16983. -
  16984. - return 0;
  16985. - }
  16986. -@@ -1848,7 +1849,7 @@ static int brcmf_fws_commit_skb(struct b
  16987. - entry->transit_count--;
  16988. - if (entry->suppressed)
  16989. - entry->suppr_transit_count--;
  16990. -- brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
  16991. -+ (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
  16992. - goto rollback;
  16993. - }
  16994. -
  16995. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16996. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16997. -@@ -522,7 +522,7 @@ static int brcmf_msgbuf_set_dcmd(struct
  16998. -
  16999. -
  17000. - static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  17001. -- u8 *ifidx, struct sk_buff *skb)
  17002. -+ struct sk_buff *skb, struct brcmf_if **ifp)
  17003. - {
  17004. - return -ENODEV;
  17005. - }
  17006. -@@ -1082,7 +1082,7 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  17007. - struct brcmf_if *ifp;
  17008. -
  17009. - ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  17010. -- if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  17011. -+ if (!ifp || !ifp->ndev) {
  17012. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  17013. - brcmu_pkt_buf_free_skb(skb);
  17014. - return;
  17015. ---- a/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  17016. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  17017. -@@ -24,8 +24,8 @@ enum proto_addr_mode {
  17018. -
  17019. -
  17020. - struct brcmf_proto {
  17021. -- int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  17022. -- struct sk_buff *skb);
  17023. -+ int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  17024. -+ struct sk_buff *skb, struct brcmf_if **ifp);
  17025. - int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
  17026. - void *buf, uint len);
  17027. - int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
  17028. -@@ -46,9 +46,19 @@ int brcmf_proto_attach(struct brcmf_pub
  17029. - void brcmf_proto_detach(struct brcmf_pub *drvr);
  17030. -
  17031. - static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  17032. -- u8 *ifidx, struct sk_buff *skb)
  17033. -+ struct sk_buff *skb,
  17034. -+ struct brcmf_if **ifp)
  17035. - {
  17036. -- return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
  17037. -+ struct brcmf_if *tmp = NULL;
  17038. -+
  17039. -+ /* assure protocol is always called with
  17040. -+ * non-null initialized pointer.
  17041. -+ */
  17042. -+ if (ifp)
  17043. -+ *ifp = NULL;
  17044. -+ else
  17045. -+ ifp = &tmp;
  17046. -+ return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
  17047. - }
  17048. - static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  17049. - uint cmd, void *buf, uint len)
  17050. diff --git a/package/kernel/mac80211/patches/394-0003-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch b/package/kernel/mac80211/patches/394-0003-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  17051. deleted file mode 100644
  17052. index 2d15a77..0000000
  17053. --- a/package/kernel/mac80211/patches/394-0003-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  17054. +++ /dev/null
  17055. @@ -1,87 +0,0 @@
  17056. -From: Arend van Spriel <arend@broadcom.com>
  17057. -Date: Wed, 26 Aug 2015 22:14:55 +0200
  17058. -Subject: [PATCH] brcmfmac: change parameters for
  17059. - brcmf_remove_interface()
  17060. -
  17061. -Just pass the interface to be removed, ie. the struct brcmf_if instance.
  17062. -
  17063. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17064. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17065. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17066. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17067. ----
  17068. -
  17069. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17070. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17071. -@@ -4982,7 +4982,7 @@ brcmf_notify_connect_status_ap(struct br
  17072. - brcmf_dbg(CONN, "AP mode link down\n");
  17073. - complete(&cfg->vif_disabled);
  17074. - if (ifp->vif->mbss)
  17075. -- brcmf_remove_interface(ifp->drvr, ifp->bssidx);
  17076. -+ brcmf_remove_interface(ifp);
  17077. - return 0;
  17078. - }
  17079. -
  17080. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  17081. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  17082. -@@ -887,12 +887,13 @@ static void brcmf_del_if(struct brcmf_pu
  17083. - }
  17084. - }
  17085. -
  17086. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx)
  17087. -+void brcmf_remove_interface(struct brcmf_if *ifp)
  17088. - {
  17089. -- if (drvr->iflist[bssidx]) {
  17090. -- brcmf_fws_del_interface(drvr->iflist[bssidx]);
  17091. -- brcmf_del_if(drvr, bssidx);
  17092. -- }
  17093. -+ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  17094. -+ return;
  17095. -+
  17096. -+ brcmf_fws_del_interface(ifp);
  17097. -+ brcmf_del_if(ifp->drvr, ifp->bssidx);
  17098. - }
  17099. -
  17100. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  17101. -@@ -1122,7 +1123,7 @@ void brcmf_detach(struct device *dev)
  17102. -
  17103. - /* make sure primary interface removed last */
  17104. - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  17105. -- brcmf_remove_interface(drvr, i);
  17106. -+ brcmf_remove_interface(drvr->iflist[i]);
  17107. -
  17108. - brcmf_cfg80211_detach(drvr->config);
  17109. -
  17110. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  17111. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  17112. -@@ -206,7 +206,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  17113. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  17114. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  17115. - char *name, u8 *mac_addr);
  17116. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx);
  17117. -+void brcmf_remove_interface(struct brcmf_if *ifp);
  17118. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  17119. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  17120. - enum brcmf_netif_stop_reason reason, bool state);
  17121. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  17122. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  17123. -@@ -222,7 +222,7 @@ static void brcmf_fweh_handle_if_event(s
  17124. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  17125. -
  17126. - if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  17127. -- brcmf_remove_interface(drvr, ifevent->bssidx);
  17128. -+ brcmf_remove_interface(ifp);
  17129. - }
  17130. -
  17131. - /**
  17132. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  17133. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  17134. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  17135. - {
  17136. - cfg80211_unregister_wdev(&vif->wdev);
  17137. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  17138. -- brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  17139. -+ brcmf_remove_interface(vif->ifp);
  17140. - brcmf_free_vif(vif);
  17141. - }
  17142. -
  17143. diff --git a/package/kernel/mac80211/patches/394-0004-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch b/package/kernel/mac80211/patches/394-0004-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  17144. deleted file mode 100644
  17145. index 2b61f4e..0000000
  17146. --- a/package/kernel/mac80211/patches/394-0004-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  17147. +++ /dev/null
  17148. @@ -1,92 +0,0 @@
  17149. -From: Arend van Spriel <arend@broadcom.com>
  17150. -Date: Wed, 26 Aug 2015 22:14:56 +0200
  17151. -Subject: [PATCH] brcmfmac: only call brcmf_cfg80211_detach() when attach
  17152. - was successful
  17153. -
  17154. -In brcmf_bus_start() the function brcmf_cfg80211_attach() is called which
  17155. -may fail. If this happens we should not call brcmf_cfg80211_detach() in
  17156. -the failure path as it will result in NULL pointer dereference:
  17157. -
  17158. - brcmf_fweh_activate_events: Set event_msgs error (-5)
  17159. - brcmf_bus_start: failed: -5
  17160. - brcmf_sdio_firmware_callback: dongle is not responding
  17161. - BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
  17162. - IP: [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  17163. - PGD 0
  17164. - Oops: 0000 [#1] SMP
  17165. - Modules linked in: brcmfmac(O) brcmutil(O) cfg80211 auth_rpcgss
  17166. - CPU: 1 PID: 45 Comm: kworker/1:1 Tainted: G O
  17167. - Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  17168. - Workqueue: events request_firmware_work_func
  17169. - task: ffff880036c09ac0 ti: ffff880036dd4000 task.ti: ffff880036dd4000
  17170. - RIP: 0010:[<ffffffff811e8f08>] [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  17171. - RSP: 0018:ffff880036dd7a28 EFLAGS: 00010246
  17172. - RAX: ffff880036c09ac0 RBX: 0000000000000000 RCX: 000000007fffffff
  17173. - RDX: 0000000000000000 RSI: ffffffff816578b9 RDI: 0000000000000000
  17174. - RBP: ffff880036dd7a48 R08: 0000000000000000 R09: ffff880036c0b340
  17175. - R10: 00000000000002ec R11: ffff880036dd7b08 R12: ffffffff816578b9
  17176. - R13: 0000000000000000 R14: ffffffff816578b9 R15: ffff8800c6c87000
  17177. - FS: 0000000000000000(0000) GS:ffff88012bc40000(0000) knlGS:0000000000000000
  17178. - CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  17179. - CR2: 0000000000000068 CR3: 0000000001a0b000 CR4: 00000000000006e0
  17180. - Stack:
  17181. - 0000000000000000 ffffffff816578b9 0000000000000000 ffff8800c0d003c8
  17182. - ffff880036dd7a78 ffffffff811e8ff5 0000000ffffffff1 ffffffff81a9b060
  17183. - ffff8800c789f880 ffff8800c0d00000 ffff880036dd7a98 ffffffff811ebe0d
  17184. - Call Trace:
  17185. - [<ffffffff811e8ff5>] kernfs_find_and_get_ns+0x35/0x60
  17186. - [<ffffffff811ebe0d>] sysfs_unmerge_group+0x1d/0x60
  17187. - [<ffffffff81404ef2>] dpm_sysfs_remove+0x22/0x60
  17188. - [<ffffffff813f9db9>] device_del+0x49/0x240
  17189. - [<ffffffff815da768>] rfkill_unregister+0x58/0xc0
  17190. - [<ffffffffa06bd91b>] wiphy_unregister+0xab/0x2f0 [cfg80211]
  17191. - [<ffffffffa0742fe3>] brcmf_cfg80211_detach+0x23/0x50 [brcmfmac]
  17192. - [<ffffffffa074d986>] brcmf_detach+0x86/0xe0 [brcmfmac]
  17193. - [<ffffffffa0757de8>] brcmf_sdio_remove+0x48/0x120 [brcmfmac]
  17194. - [<ffffffffa0758ed9>] brcmf_sdiod_remove+0x29/0xd0 [brcmfmac]
  17195. - [<ffffffffa0759031>] brcmf_ops_sdio_remove+0xb1/0x110 [brcmfmac]
  17196. - [<ffffffffa001c267>] sdio_bus_remove+0x37/0x100 [mmc_core]
  17197. - [<ffffffff813fe026>] __device_release_driver+0x96/0x130
  17198. - [<ffffffff813fe0e3>] device_release_driver+0x23/0x30
  17199. - [<ffffffffa0754bc8>] brcmf_sdio_firmware_callback+0x2a8/0x5d0 [brcmfmac]
  17200. - [<ffffffffa074deaf>] brcmf_fw_request_nvram_done+0x15f/0x5e0 [brcmfmac]
  17201. - [<ffffffff8140142f>] ? devres_add+0x3f/0x50
  17202. - [<ffffffff810642b5>] ? usermodehelper_read_unlock+0x15/0x20
  17203. - [<ffffffff81400000>] ? platform_match+0x70/0xa0
  17204. - [<ffffffff8140f400>] request_firmware_work_func+0x30/0x60
  17205. - [<ffffffff8106828c>] process_one_work+0x14c/0x3d0
  17206. - [<ffffffff8106862a>] worker_thread+0x11a/0x450
  17207. - [<ffffffff81068510>] ? process_one_work+0x3d0/0x3d0
  17208. - [<ffffffff8106d692>] kthread+0xd2/0xf0
  17209. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  17210. - [<ffffffff815ed35f>] ret_from_fork+0x3f/0x70
  17211. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  17212. - Code: e9 40 fe ff ff 48 89 d8 eb 87 66 0f 1f 84 00 00 00 00 00 66 66 66 66
  17213. - 90 55 48 89 e5 41 56 49 89 f6 41 55 49 89 d5 31 d2 41 54 53 <0f> b7
  17214. - 47 68 48 8b 5f 48 66 c1 e8 05 83 e0 01 4d 85 ed 0f b6 c8
  17215. - RIP [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  17216. - RSP <ffff880036dd7a28>
  17217. - CR2: 0000000000000068
  17218. - ---[ end trace 87d6ec0d3fe46740 ]---
  17219. -
  17220. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  17221. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17222. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17223. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17224. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17225. ----
  17226. -
  17227. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  17228. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  17229. -@@ -1049,7 +1049,10 @@ int brcmf_bus_start(struct device *dev)
  17230. - fail:
  17231. - if (ret < 0) {
  17232. - brcmf_err("failed: %d\n", ret);
  17233. -- brcmf_cfg80211_detach(drvr->config);
  17234. -+ if (drvr->config) {
  17235. -+ brcmf_cfg80211_detach(drvr->config);
  17236. -+ drvr->config = NULL;
  17237. -+ }
  17238. - if (drvr->fws) {
  17239. - brcmf_fws_del_interface(ifp);
  17240. - brcmf_fws_deinit(drvr);
  17241. diff --git a/package/kernel/mac80211/patches/394-0005-brcmfmac-correct-detection-of-p2pdev-interface-event.patch b/package/kernel/mac80211/patches/394-0005-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  17242. deleted file mode 100644
  17243. index 868b0a8..0000000
  17244. --- a/package/kernel/mac80211/patches/394-0005-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  17245. +++ /dev/null
  17246. @@ -1,105 +0,0 @@
  17247. -From: Arend van Spriel <arend@broadcom.com>
  17248. -Date: Wed, 26 Aug 2015 22:14:57 +0200
  17249. -Subject: [PATCH] brcmfmac: correct detection of p2pdev interface event
  17250. -
  17251. -The p2pdev interface is setup in firmware resulting in a interface
  17252. -event. This event has role and no-if flag. When role is p2p client
  17253. -and no-if flag is set it indicates that this is the p2pdev interface.
  17254. -This info is used in handling the event and adding interface in the
  17255. -driver.
  17256. -
  17257. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17258. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17259. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17260. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17261. ----
  17262. -
  17263. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  17264. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  17265. -@@ -795,7 +795,7 @@ fail:
  17266. - }
  17267. -
  17268. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  17269. -- char *name, u8 *mac_addr)
  17270. -+ bool is_p2pdev, char *name, u8 *mac_addr)
  17271. - {
  17272. - struct brcmf_if *ifp;
  17273. - struct net_device *ndev;
  17274. -@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  17275. - }
  17276. - }
  17277. -
  17278. -- if (!brcmf_p2p_enable && bssidx == 1) {
  17279. -+ if (!brcmf_p2p_enable && is_p2pdev) {
  17280. - /* this is P2P_DEVICE interface */
  17281. - brcmf_dbg(INFO, "allocate non-netdev interface\n");
  17282. - ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
  17283. -@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
  17284. - brcmf_dbg(TRACE, "\n");
  17285. -
  17286. - /* add primary networking interface */
  17287. -- ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL);
  17288. -+ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
  17289. - if (IS_ERR(ifp))
  17290. - return PTR_ERR(ifp);
  17291. -
  17292. - if (brcmf_p2p_enable)
  17293. -- p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL);
  17294. -+ p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  17295. - else
  17296. - p2p_ifp = NULL;
  17297. - if (IS_ERR(p2p_ifp))
  17298. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  17299. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  17300. -@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drv
  17301. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  17302. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  17303. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  17304. -- char *name, u8 *mac_addr);
  17305. -+ bool is_p2pdev, char *name, u8 *mac_addr);
  17306. - void brcmf_remove_interface(struct brcmf_if *ifp);
  17307. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  17308. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  17309. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  17310. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  17311. -@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(s
  17312. - {
  17313. - struct brcmf_if_event *ifevent = data;
  17314. - struct brcmf_if *ifp;
  17315. -+ bool is_p2pdev;
  17316. - int err = 0;
  17317. -
  17318. - brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  17319. -@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(s
  17320. - ifevent->flags, ifevent->role);
  17321. -
  17322. - /* The P2P Device interface event must not be ignored
  17323. -- * contrary to what firmware tells us. The only way to
  17324. -- * distinguish the P2P Device is by looking at the ifidx
  17325. -- * and bssidx received.
  17326. -+ * contrary to what firmware tells us.
  17327. - */
  17328. -- if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
  17329. -- (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  17330. -+ is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  17331. -+ ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  17332. -+ if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  17333. - brcmf_dbg(EVENT, "event can be ignored\n");
  17334. - return;
  17335. - }
  17336. - if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  17337. -- brcmf_err("invalid interface index: %u\n",
  17338. -- ifevent->ifidx);
  17339. -+ brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  17340. - return;
  17341. - }
  17342. -
  17343. -@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(s
  17344. - brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  17345. - emsg->addr);
  17346. - ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  17347. -- emsg->ifname, emsg->addr);
  17348. -+ is_p2pdev, emsg->ifname, emsg->addr);
  17349. - if (IS_ERR(ifp))
  17350. - return;
  17351. - brcmf_fws_add_interface(ifp);
  17352. diff --git a/package/kernel/mac80211/patches/394-0006-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch b/package/kernel/mac80211/patches/394-0006-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  17353. deleted file mode 100644
  17354. index aebbfa6..0000000
  17355. --- a/package/kernel/mac80211/patches/394-0006-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  17356. +++ /dev/null
  17357. @@ -1,126 +0,0 @@
  17358. -From: Arend van Spriel <arend@broadcom.com>
  17359. -Date: Wed, 26 Aug 2015 22:14:58 +0200
  17360. -Subject: [PATCH] brcmfmac: use brcmf_get_ifp() to map ifidx to struct
  17361. - brcmf_if instance
  17362. -
  17363. -The knowledge on how to map the interface index to a struct brcmf_if
  17364. -instance is in brcmf_get_ifp() so use that function when only the
  17365. -interface index is known instead of accessing brcmf_pub::iflist
  17366. -directly.
  17367. -
  17368. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17369. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17370. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17371. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17372. ----
  17373. -
  17374. ---- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  17375. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  17376. -@@ -149,7 +149,7 @@ static s32 brcmf_btcoex_params_read(stru
  17377. - static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
  17378. - bool trump_sco)
  17379. - {
  17380. -- struct brcmf_if *ifp = btci->cfg->pub->iflist[0];
  17381. -+ struct brcmf_if *ifp = brcmf_get_ifp(btci->cfg->pub, 0);
  17382. -
  17383. - if (trump_sco && !btci->saved_regs_part2) {
  17384. - /* this should reduce eSCO agressive
  17385. -@@ -468,7 +468,7 @@ int brcmf_btcoex_set_mode(struct brcmf_c
  17386. - {
  17387. - struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  17388. - struct brcmf_btcoex_info *btci = cfg->btcoex;
  17389. -- struct brcmf_if *ifp = cfg->pub->iflist[0];
  17390. -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  17391. -
  17392. - switch (mode) {
  17393. - case BRCMF_BTCOEX_DISABLED:
  17394. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17395. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17396. -@@ -6212,7 +6212,7 @@ static void brcmf_free_wiphy(struct wiph
  17397. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  17398. - struct device *busdev)
  17399. - {
  17400. -- struct net_device *ndev = drvr->iflist[0]->ndev;
  17401. -+ struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  17402. - struct brcmf_cfg80211_info *cfg;
  17403. - struct wiphy *wiphy;
  17404. - struct brcmf_cfg80211_vif *vif;
  17405. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  17406. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  17407. -@@ -121,7 +121,7 @@ static void brcmf_feat_iovar_int_set(str
  17408. -
  17409. - void brcmf_feat_attach(struct brcmf_pub *drvr)
  17410. - {
  17411. -- struct brcmf_if *ifp = drvr->iflist[0];
  17412. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  17413. -
  17414. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  17415. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  17416. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  17417. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  17418. -@@ -221,7 +221,7 @@ static void brcmf_flowring_block(struct
  17419. -
  17420. - bus_if = dev_get_drvdata(flow->dev);
  17421. - drvr = bus_if->drvr;
  17422. -- ifp = drvr->iflist[ifidx];
  17423. -+ ifp = brcmf_get_ifp(drvr, ifidx);
  17424. - brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
  17425. -
  17426. - spin_unlock_irqrestore(&flow->block_lock, flags);
  17427. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  17428. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  17429. -@@ -334,7 +334,7 @@ void brcmf_fweh_attach(struct brcmf_pub
  17430. - void brcmf_fweh_detach(struct brcmf_pub *drvr)
  17431. - {
  17432. - struct brcmf_fweh_info *fweh = &drvr->fweh;
  17433. -- struct brcmf_if *ifp = drvr->iflist[0];
  17434. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  17435. - s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  17436. -
  17437. - if (ifp) {
  17438. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17439. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17440. -@@ -972,7 +972,7 @@ static void
  17441. - brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
  17442. - u8 if_id)
  17443. - {
  17444. -- struct brcmf_if *ifp = fws->drvr->iflist[!if_id ? 0 : if_id + 1];
  17445. -+ struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id);
  17446. -
  17447. - if (WARN_ON(!ifp))
  17448. - return;
  17449. -@@ -2118,6 +2118,7 @@ static int brcmf_debugfs_fws_stats_read(
  17450. - int brcmf_fws_init(struct brcmf_pub *drvr)
  17451. - {
  17452. - struct brcmf_fws_info *fws;
  17453. -+ struct brcmf_if *ifp;
  17454. - u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS;
  17455. - int rc;
  17456. - u32 mode;
  17457. -@@ -2177,21 +2178,22 @@ int brcmf_fws_init(struct brcmf_pub *drv
  17458. - * continue. Set mode back to none indicating not enabled.
  17459. - */
  17460. - fws->fw_signals = true;
  17461. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) {
  17462. -+ ifp = brcmf_get_ifp(drvr, 0);
  17463. -+ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  17464. - brcmf_err("failed to set bdcv2 tlv signaling\n");
  17465. - fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  17466. - fws->fw_signals = false;
  17467. - }
  17468. -
  17469. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1))
  17470. -+ if (brcmf_fil_iovar_int_set(ifp, "ampdu_hostreorder", 1))
  17471. - brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n");
  17472. -
  17473. - /* Enable seq number reuse, if supported */
  17474. -- if (brcmf_fil_iovar_int_get(drvr->iflist[0], "wlfc_mode", &mode) == 0) {
  17475. -+ if (brcmf_fil_iovar_int_get(ifp, "wlfc_mode", &mode) == 0) {
  17476. - if (BRCMF_FWS_MODE_GET_REUSESEQ(mode)) {
  17477. - mode = 0;
  17478. - BRCMF_FWS_MODE_SET_REUSESEQ(mode, 1);
  17479. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0],
  17480. -+ if (brcmf_fil_iovar_int_set(ifp,
  17481. - "wlfc_mode", mode) == 0) {
  17482. - BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1);
  17483. - }
  17484. diff --git a/package/kernel/mac80211/patches/394-0007-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch b/package/kernel/mac80211/patches/394-0007-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  17485. deleted file mode 100644
  17486. index 23a7b6f..0000000
  17487. --- a/package/kernel/mac80211/patches/394-0007-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  17488. +++ /dev/null
  17489. @@ -1,122 +0,0 @@
  17490. -From: Arend van Spriel <arend@broadcom.com>
  17491. -Date: Wed, 26 Aug 2015 22:14:59 +0200
  17492. -Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  17493. - brcmf_txfinalize()
  17494. -
  17495. -Most call sites of brcmf_txfinalize already have struct brcmf_if
  17496. -instance so pass that to brcmf_txfinalize() as the function
  17497. -needs it anyway.
  17498. -
  17499. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17500. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17501. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17502. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17503. ----
  17504. -
  17505. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  17506. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  17507. -@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  17508. - brcmf_netif_rx(ifp, skb);
  17509. - }
  17510. -
  17511. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  17512. -- bool success)
  17513. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  17514. - {
  17515. -- struct brcmf_if *ifp;
  17516. - struct ethhdr *eh;
  17517. - u16 type;
  17518. -
  17519. -- ifp = drvr->iflist[ifidx];
  17520. -- if (!ifp)
  17521. -- goto done;
  17522. --
  17523. - eh = (struct ethhdr *)(txp->data);
  17524. - type = ntohs(eh->h_proto);
  17525. -
  17526. -@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  17527. -
  17528. - if (!success)
  17529. - ifp->stats.tx_errors++;
  17530. --done:
  17531. -+
  17532. - brcmu_pkt_buf_free_skb(txp);
  17533. - }
  17534. -
  17535. -@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  17536. - if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  17537. - brcmu_pkt_buf_free_skb(txp);
  17538. - else
  17539. -- brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  17540. -+ brcmf_txfinalize(ifp, txp, success);
  17541. - }
  17542. - }
  17543. -
  17544. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  17545. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  17546. -@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  17547. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  17548. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  17549. - enum brcmf_netif_stop_reason reason, bool state);
  17550. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  17551. -- bool success);
  17552. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  17553. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  17554. -
  17555. - /* Sets dongle media info (drv_version, mac address). */
  17556. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17557. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17558. -@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  17559. - ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  17560. - genbit, seq);
  17561. - if (remove_from_hanger || ret)
  17562. -- brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  17563. -+ brcmf_txfinalize(ifp, skb, true);
  17564. -
  17565. - return 0;
  17566. - }
  17567. -@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  17568. - if (fws->avoid_queueing) {
  17569. - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  17570. - if (rc < 0)
  17571. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  17572. -+ brcmf_txfinalize(ifp, skb, false);
  17573. - return rc;
  17574. - }
  17575. -
  17576. -@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  17577. - brcmf_fws_schedule_deq(fws);
  17578. - } else {
  17579. - brcmf_err("drop skb: no hanger slot\n");
  17580. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  17581. -+ brcmf_txfinalize(ifp, skb, false);
  17582. - rc = -ENOMEM;
  17583. - }
  17584. - brcmf_fws_unlock(fws);
  17585. -@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  17586. - ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  17587. - brcmf_fws_lock(fws);
  17588. - if (ret < 0)
  17589. -- brcmf_txfinalize(drvr, skb, ifidx,
  17590. -- false);
  17591. -+ brcmf_txfinalize(brcmf_get_ifp(drvr,
  17592. -+ ifidx),
  17593. -+ skb, false);
  17594. - if (fws->bus_flow_blocked)
  17595. - break;
  17596. - }
  17597. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17598. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17599. -@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  17600. - commonring = msgbuf->flowrings[flowid];
  17601. - atomic_dec(&commonring->outstanding_tx);
  17602. -
  17603. -- brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  17604. -+ /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  17605. -+ * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  17606. -+ */
  17607. -+ brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  17608. -+ skb, true);
  17609. - }
  17610. -
  17611. -
  17612. diff --git a/package/kernel/mac80211/patches/394-0008-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch b/package/kernel/mac80211/patches/394-0008-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  17613. deleted file mode 100644
  17614. index 8ddc0a6..0000000
  17615. --- a/package/kernel/mac80211/patches/394-0008-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  17616. +++ /dev/null
  17617. @@ -1,92 +0,0 @@
  17618. -From: Arend van Spriel <arend@broadcom.com>
  17619. -Date: Wed, 26 Aug 2015 22:15:00 +0200
  17620. -Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
  17621. - index
  17622. -
  17623. -Because the P2P Device interface in firmware uses the same interface
  17624. -index as the primary interface we use the bsscfg index as index in the
  17625. -struct brcmf_pub::iflist. However, in the data path we get the interface
  17626. -index and not the bsscfg index. So we need a mapping of interface index
  17627. -to bsscfg index, which can be determined upon handle adding the interface.
  17628. -
  17629. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17630. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17631. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17632. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17633. ----
  17634. -
  17635. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  17636. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  17637. -@@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
  17638. -
  17639. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  17640. - {
  17641. -+ struct brcmf_if *ifp;
  17642. -+ s32 bssidx;
  17643. -+
  17644. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  17645. - brcmf_err("ifidx %d out of range\n", ifidx);
  17646. - return NULL;
  17647. - }
  17648. -
  17649. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  17650. -- * events this is easy because it contains the bssidx which maps
  17651. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  17652. -- * bssidx 1 is used for p2p0 and no data can be received or
  17653. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  17654. -- */
  17655. -- if (ifidx)
  17656. -- ifidx++;
  17657. -+ ifp = NULL;
  17658. -+ bssidx = drvr->if2bss[ifidx];
  17659. -+ if (bssidx >= 0)
  17660. -+ ifp = drvr->iflist[bssidx];
  17661. -
  17662. -- return drvr->iflist[ifidx];
  17663. -+ return ifp;
  17664. - }
  17665. -
  17666. - static void _brcmf_set_multicast_list(struct work_struct *work)
  17667. -@@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  17668. -
  17669. - ifp = netdev_priv(ndev);
  17670. - ifp->ndev = ndev;
  17671. -+ /* store mapping ifidx to bssidx */
  17672. -+ drvr->if2bss[ifidx] = bssidx;
  17673. - }
  17674. -
  17675. - ifp->drvr = drvr;
  17676. -@@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
  17677. - struct brcmf_if *ifp;
  17678. -
  17679. - ifp = drvr->iflist[bssidx];
  17680. -+ drvr->if2bss[ifp->ifidx] = -1;
  17681. - drvr->iflist[bssidx] = NULL;
  17682. - if (!ifp) {
  17683. - brcmf_err("Null interface, idx=%d\n", bssidx);
  17684. -@@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
  17685. - }
  17686. - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  17687. - if (ifp->ndev) {
  17688. -+ drvr->if2bss[ifp->ifidx] = -1;
  17689. - if (bssidx == 0) {
  17690. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  17691. - rtnl_lock();
  17692. -@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  17693. - if (!drvr)
  17694. - return -ENOMEM;
  17695. -
  17696. -+ memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  17697. - mutex_init(&drvr->proto_block);
  17698. -
  17699. - /* Link to bus module */
  17700. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  17701. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  17702. -@@ -122,6 +122,7 @@ struct brcmf_pub {
  17703. - struct mac_address addresses[BRCMF_MAX_IFS];
  17704. -
  17705. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  17706. -+ s32 if2bss[BRCMF_MAX_IFS];
  17707. -
  17708. - struct mutex proto_block;
  17709. - unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  17710. diff --git a/package/kernel/mac80211/patches/394-0009-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch b/package/kernel/mac80211/patches/394-0009-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  17711. deleted file mode 100644
  17712. index a0a798b..0000000
  17713. --- a/package/kernel/mac80211/patches/394-0009-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  17714. +++ /dev/null
  17715. @@ -1,103 +0,0 @@
  17716. -From: Arend van Spriel <arend@broadcom.com>
  17717. -Date: Wed, 26 Aug 2015 22:15:01 +0200
  17718. -Subject: [PATCH] brcmfmac: add dedicated debug level for firmware
  17719. - console logging
  17720. -
  17721. -Both PCIe and SDIO devices have the possibility to log the firmware
  17722. -console output in kernel log. For PCIe it is logged when PCIE debug
  17723. -level is enabled. For SDIO it is logged when user specifies a non-zero
  17724. -console interval through debugfs. This patch tries to make it a
  17725. -bit more consistent. The firmware console output is only logged when
  17726. -FWCON debug level is enabled.
  17727. -
  17728. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17729. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17730. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17731. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  17732. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17733. ----
  17734. -
  17735. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  17736. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  17737. -@@ -37,6 +37,7 @@
  17738. - #define BRCMF_SDIO_VAL 0x00020000
  17739. - #define BRCMF_MSGBUF_VAL 0x00040000
  17740. - #define BRCMF_PCIE_VAL 0x00080000
  17741. -+#define BRCMF_FWCON_VAL 0x00100000
  17742. -
  17743. - /* set default print format */
  17744. - #undef pr_fmt
  17745. -@@ -78,6 +79,7 @@ do { \
  17746. - #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  17747. - #define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
  17748. - #define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
  17749. -+#define BRCMF_FWCON_ON() (brcmf_msg_level & BRCMF_FWCON_VAL)
  17750. -
  17751. - #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  17752. -
  17753. -@@ -90,6 +92,7 @@ do { \
  17754. - #define BRCMF_GLOM_ON() 0
  17755. - #define BRCMF_EVENT_ON() 0
  17756. - #define BRCMF_FIL_ON() 0
  17757. -+#define BRCMF_FWCON_ON() 0
  17758. -
  17759. - #endif /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  17760. -
  17761. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17762. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17763. -@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(
  17764. - addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
  17765. - console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
  17766. -
  17767. -- brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
  17768. -+ brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
  17769. - console->base_addr, console->buf_addr, console->bufsize);
  17770. - }
  17771. -
  17772. -@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(
  17773. - u8 ch;
  17774. - u32 newidx;
  17775. -
  17776. -+ if (!BRCMF_FWCON_ON())
  17777. -+ return;
  17778. -+
  17779. - console = &devinfo->shared.console;
  17780. - addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
  17781. - newidx = brcmf_pcie_read_tcm32(devinfo, addr);
  17782. -@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(
  17783. - }
  17784. - if (ch == '\n') {
  17785. - console->log_str[console->log_idx] = 0;
  17786. -- brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  17787. -+ pr_debug("CONSOLE: %s", console->log_str);
  17788. - console->log_idx = 0;
  17789. - }
  17790. - }
  17791. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  17792. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  17793. -@@ -123,6 +123,7 @@ struct rte_console {
  17794. -
  17795. - #define BRCMF_FIRSTREAD (1 << 6)
  17796. -
  17797. -+#define BRCMF_CONSOLE 10 /* watchdog interval to poll console */
  17798. -
  17799. - /* SBSDIO_DEVICE_CTL */
  17800. -
  17801. -@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(st
  17802. - if (IS_ERR_OR_NULL(dentry))
  17803. - return;
  17804. -
  17805. -+ bus->console_interval = BRCMF_CONSOLE;
  17806. -+
  17807. - brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
  17808. - brcmf_debugfs_add_entry(drvr, "counters",
  17809. - brcmf_debugfs_sdio_count_read);
  17810. -@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(stru
  17811. - }
  17812. - #ifdef DEBUG
  17813. - /* Poll for console output periodically */
  17814. -- if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
  17815. -+ if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
  17816. - bus->console_interval != 0) {
  17817. - bus->console.count += BRCMF_WD_POLL_MS;
  17818. - if (bus->console.count >= bus->console_interval) {
  17819. diff --git a/package/kernel/mac80211/patches/394-0010-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch b/package/kernel/mac80211/patches/394-0010-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  17820. deleted file mode 100644
  17821. index 53e7ede..0000000
  17822. --- a/package/kernel/mac80211/patches/394-0010-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  17823. +++ /dev/null
  17824. @@ -1,34 +0,0 @@
  17825. -From: Arend van Spriel <arend@broadcom.com>
  17826. -Date: Wed, 26 Aug 2015 22:15:02 +0200
  17827. -Subject: [PATCH] brcmfmac: remove ifidx parameter from
  17828. - brcmf_fws_txstatus_suppressed()
  17829. -
  17830. -The brcmf_fws_txstatus_suppressed() function prototype specifies an
  17831. -ifidx parameter which is not used within the function implementation.
  17832. -
  17833. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17834. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17835. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17836. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17837. ----
  17838. -
  17839. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17840. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17841. -@@ -1398,7 +1398,7 @@ done:
  17842. - }
  17843. -
  17844. - static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo,
  17845. -- struct sk_buff *skb, u8 ifidx,
  17846. -+ struct sk_buff *skb,
  17847. - u32 genbit, u16 seq)
  17848. - {
  17849. - struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac;
  17850. -@@ -1503,7 +1503,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  17851. - return -EINVAL;
  17852. - }
  17853. - if (!remove_from_hanger)
  17854. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  17855. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb,
  17856. - genbit, seq);
  17857. - if (remove_from_hanger || ret)
  17858. - brcmf_txfinalize(ifp, skb, true);
  17859. diff --git a/package/kernel/mac80211/patches/394-0011-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch b/package/kernel/mac80211/patches/394-0011-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  17860. deleted file mode 100644
  17861. index bb05235..0000000
  17862. --- a/package/kernel/mac80211/patches/394-0011-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  17863. +++ /dev/null
  17864. @@ -1,97 +0,0 @@
  17865. -From: Arend van Spriel <arend@broadcom.com>
  17866. -Date: Wed, 26 Aug 2015 22:15:03 +0200
  17867. -Subject: [PATCH] brcmfmac: change prototype for brcmf_fws_hdrpull()
  17868. -
  17869. -Instead of passing ifidx and drvr just pass struct brcmf_if pointer
  17870. -which holds both parameters.
  17871. -
  17872. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17873. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17874. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17875. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17876. ----
  17877. -
  17878. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  17879. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  17880. -@@ -312,8 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  17881. -
  17882. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  17883. - if (do_fws)
  17884. -- brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  17885. -- pktbuf);
  17886. -+ brcmf_fws_hdrpull(tmp_if, h->data_offset << 2, pktbuf);
  17887. - else
  17888. - skb_pull(pktbuf, h->data_offset << 2);
  17889. -
  17890. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17891. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17892. -@@ -1616,11 +1616,10 @@ static int brcmf_fws_notify_bcmc_credit_
  17893. - return 0;
  17894. - }
  17895. -
  17896. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  17897. -- struct sk_buff *skb)
  17898. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  17899. - {
  17900. - struct brcmf_skb_reorder_data *rd;
  17901. -- struct brcmf_fws_info *fws = drvr->fws;
  17902. -+ struct brcmf_fws_info *fws = ifp->drvr->fws;
  17903. - u8 *signal_data;
  17904. - s16 data_len;
  17905. - u8 type;
  17906. -@@ -1630,20 +1629,20 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  17907. - s32 err;
  17908. -
  17909. - brcmf_dbg(HDRS, "enter: ifidx %d, skblen %u, sig %d\n",
  17910. -- ifidx, skb->len, signal_len);
  17911. -+ ifp->ifidx, skb->len, siglen);
  17912. -
  17913. -- WARN_ON(signal_len > skb->len);
  17914. -+ WARN_ON(siglen > skb->len);
  17915. -
  17916. -- if (!signal_len)
  17917. -- return 0;
  17918. -+ if (!siglen)
  17919. -+ return;
  17920. - /* if flow control disabled, skip to packet data and leave */
  17921. - if ((!fws) || (!fws->fw_signals)) {
  17922. -- skb_pull(skb, signal_len);
  17923. -- return 0;
  17924. -+ skb_pull(skb, siglen);
  17925. -+ return;
  17926. - }
  17927. -
  17928. - fws->stats.header_pulls++;
  17929. -- data_len = signal_len;
  17930. -+ data_len = siglen;
  17931. - signal_data = skb->data;
  17932. -
  17933. - status = BRCMF_FWS_RET_OK_NOSCHEDULE;
  17934. -@@ -1731,14 +1730,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  17935. - /* signalling processing result does
  17936. - * not affect the actual ethernet packet.
  17937. - */
  17938. -- skb_pull(skb, signal_len);
  17939. -+ skb_pull(skb, siglen);
  17940. -
  17941. - /* this may be a signal-only packet
  17942. - */
  17943. - if (skb->len == 0)
  17944. - fws->stats.header_only_pkt++;
  17945. --
  17946. -- return 0;
  17947. - }
  17948. -
  17949. - static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
  17950. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  17951. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  17952. -@@ -21,8 +21,7 @@
  17953. - int brcmf_fws_init(struct brcmf_pub *drvr);
  17954. - void brcmf_fws_deinit(struct brcmf_pub *drvr);
  17955. - bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
  17956. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  17957. -- struct sk_buff *skb);
  17958. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
  17959. - int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);
  17960. -
  17961. - void brcmf_fws_reset_interface(struct brcmf_if *ifp);
  17962. diff --git a/package/kernel/mac80211/patches/394-0012-brcmfmac-introduce-brcmf_net_detach-function.patch b/package/kernel/mac80211/patches/394-0012-brcmfmac-introduce-brcmf_net_detach-function.patch
  17963. deleted file mode 100644
  17964. index ba92c67..0000000
  17965. --- a/package/kernel/mac80211/patches/394-0012-brcmfmac-introduce-brcmf_net_detach-function.patch
  17966. +++ /dev/null
  17967. @@ -1,99 +0,0 @@
  17968. -From: Arend van Spriel <arend@broadcom.com>
  17969. -Date: Wed, 26 Aug 2015 22:15:04 +0200
  17970. -Subject: [PATCH] brcmfmac: introduce brcmf_net_detach() function
  17971. -
  17972. -In case of error during brcmf_bus_start() the network interfaces were
  17973. -freed using free_netdev(). However, the interfaces may have additional
  17974. -memory allocated which is not freed. The netdev has destructor set to
  17975. -brcmf_cfg80211_free_netdev() which frees the additional memory if
  17976. -allocated and call free_netdev(). The brcmf_net_detach() either calls
  17977. -brcmf_cfg80211_free_netdev() directly or uses unregister_netdev() when
  17978. -struct net_device::reg_state indicates the netdev was registered.
  17979. -
  17980. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  17981. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17982. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17983. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17984. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17985. ----
  17986. -
  17987. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17988. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17989. -@@ -4746,7 +4746,8 @@ void brcmf_cfg80211_free_netdev(struct n
  17990. - ifp = netdev_priv(ndev);
  17991. - vif = ifp->vif;
  17992. -
  17993. -- brcmf_free_vif(vif);
  17994. -+ if (vif)
  17995. -+ brcmf_free_vif(vif);
  17996. - free_netdev(ndev);
  17997. - }
  17998. -
  17999. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18000. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18001. -@@ -718,8 +718,6 @@ int brcmf_net_attach(struct brcmf_if *if
  18002. - }
  18003. -
  18004. - brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
  18005. --
  18006. -- ndev->destructor = brcmf_cfg80211_free_netdev;
  18007. - return 0;
  18008. -
  18009. - fail:
  18010. -@@ -729,6 +727,14 @@ fail:
  18011. - return -EBADE;
  18012. - }
  18013. -
  18014. -+static void brcmf_net_detach(struct net_device *ndev)
  18015. -+{
  18016. -+ if (ndev->reg_state == NETREG_REGISTERED)
  18017. -+ unregister_netdev(ndev);
  18018. -+ else
  18019. -+ brcmf_cfg80211_free_netdev(ndev);
  18020. -+}
  18021. -+
  18022. - static int brcmf_net_p2p_open(struct net_device *ndev)
  18023. - {
  18024. - brcmf_dbg(TRACE, "Enter\n");
  18025. -@@ -805,8 +811,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  18026. - ifp->ndev->name);
  18027. - if (ifidx) {
  18028. - netif_stop_queue(ifp->ndev);
  18029. -- unregister_netdev(ifp->ndev);
  18030. -- free_netdev(ifp->ndev);
  18031. -+ brcmf_net_detach(ifp->ndev);
  18032. - drvr->iflist[bssidx] = NULL;
  18033. - } else {
  18034. - brcmf_err("ignore IF event\n");
  18035. -@@ -828,6 +833,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  18036. - if (!ndev)
  18037. - return ERR_PTR(-ENOMEM);
  18038. -
  18039. -+ ndev->destructor = brcmf_cfg80211_free_netdev;
  18040. - ifp = netdev_priv(ndev);
  18041. - ifp->ndev = ndev;
  18042. - /* store mapping ifidx to bssidx */
  18043. -@@ -879,8 +885,7 @@ static void brcmf_del_if(struct brcmf_pu
  18044. - cancel_work_sync(&ifp->setmacaddr_work);
  18045. - cancel_work_sync(&ifp->multicast_work);
  18046. - }
  18047. -- /* unregister will take care of freeing it */
  18048. -- unregister_netdev(ifp->ndev);
  18049. -+ brcmf_net_detach(ifp->ndev);
  18050. - }
  18051. - }
  18052. -
  18053. -@@ -1056,11 +1061,11 @@ fail:
  18054. - brcmf_fws_deinit(drvr);
  18055. - }
  18056. - if (drvr->iflist[0]) {
  18057. -- free_netdev(ifp->ndev);
  18058. -+ brcmf_net_detach(ifp->ndev);
  18059. - drvr->iflist[0] = NULL;
  18060. - }
  18061. - if (p2p_ifp) {
  18062. -- free_netdev(p2p_ifp->ndev);
  18063. -+ brcmf_net_detach(p2p_ifp->ndev);
  18064. - drvr->iflist[1] = NULL;
  18065. - }
  18066. - return ret;
  18067. diff --git a/package/kernel/mac80211/patches/395-brcmfmac-Reset-PCIE-devices-after-recognition.patch b/package/kernel/mac80211/patches/395-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  18068. deleted file mode 100644
  18069. index 5a7e447..0000000
  18070. --- a/package/kernel/mac80211/patches/395-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  18071. +++ /dev/null
  18072. @@ -1,193 +0,0 @@
  18073. -From: Hante Meuleman <meuleman@broadcom.com>
  18074. -Date: Thu, 27 Aug 2015 16:14:06 +0200
  18075. -Subject: [PATCH] brcmfmac: Reset PCIE devices after recognition.
  18076. -
  18077. -When PCIE type devices are being FW reloaded without being properly
  18078. -reset then the device ends up in a locked state, requiring the
  18079. -device to be completely powered down. This patch adds a reset
  18080. -through watchdog at the moment the device (cores) has been
  18081. -recognized. This will solve warm reboot issues.
  18082. -
  18083. -Cc: Rafal Milecki <zajec5@gmail.com>
  18084. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  18085. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18086. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18087. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  18088. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18089. ----
  18090. -
  18091. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  18092. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  18093. -@@ -101,6 +101,9 @@
  18094. - /* ARM Cortex M3 core, ID 0x82a */
  18095. - #define BCM4329_CORE_ARM_BASE 0x18002000
  18096. -
  18097. -+/* Max possibly supported memory size (limited by IO mapped memory) */
  18098. -+#define BRCMF_CHIP_MAX_MEMSIZE (4 * 1024 * 1024)
  18099. -+
  18100. - #define CORE_SB(base, field) \
  18101. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  18102. - #define SBCOREREV(sbidh) \
  18103. -@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct
  18104. - brcmf_err("RAM size is undetermined\n");
  18105. - return -ENOMEM;
  18106. - }
  18107. -+
  18108. -+ if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
  18109. -+ brcmf_err("RAM size is incorrect\n");
  18110. -+ return -ENOMEM;
  18111. -+ }
  18112. -+
  18113. - return 0;
  18114. - }
  18115. -
  18116. -@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct
  18117. -
  18118. - /* assure chip is passive for core access */
  18119. - brcmf_chip_set_passive(&ci->pub);
  18120. -+
  18121. -+ /* Call bus specific reset function now. Cores have been determined
  18122. -+ * but further access may require a chip specific reset at this point.
  18123. -+ */
  18124. -+ if (ci->ops->reset) {
  18125. -+ ci->ops->reset(ci->ctx, &ci->pub);
  18126. -+ brcmf_chip_set_passive(&ci->pub);
  18127. -+ }
  18128. -+
  18129. - return brcmf_chip_get_raminfo(ci);
  18130. - }
  18131. -
  18132. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  18133. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  18134. -@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
  18135. - u32 (*read32)(void *ctx, u32 addr);
  18136. - void (*write32)(void *ctx, u32 addr, u32 value);
  18137. - int (*prepare)(void *ctx);
  18138. -+ int (*reset)(void *ctx, struct brcmf_chip *chip);
  18139. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  18140. - void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  18141. - };
  18142. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  18143. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  18144. -@@ -74,6 +74,8 @@ enum brcmf_pcie_state {
  18145. - #define BRCMF_PCIE_REG_INTMASK 0x94
  18146. - #define BRCMF_PCIE_REG_SBMBX 0x98
  18147. -
  18148. -+#define BRCMF_PCIE_REG_LINK_STATUS_CTRL 0xBC
  18149. -+
  18150. - #define BRCMF_PCIE_PCIE2REG_INTMASK 0x24
  18151. - #define BRCMF_PCIE_PCIE2REG_MAILBOXINT 0x48
  18152. - #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C
  18153. -@@ -466,6 +468,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
  18154. -
  18155. - static void brcmf_pcie_reset_device(struct brcmf_pciedev_info *devinfo)
  18156. - {
  18157. -+ struct brcmf_core *core;
  18158. - u16 cfg_offset[] = { BRCMF_PCIE_CFGREG_STATUS_CMD,
  18159. - BRCMF_PCIE_CFGREG_PM_CSR,
  18160. - BRCMF_PCIE_CFGREG_MSI_CAP,
  18161. -@@ -484,32 +487,38 @@ static void brcmf_pcie_reset_device(stru
  18162. - if (!devinfo->ci)
  18163. - return;
  18164. -
  18165. -+ /* Disable ASPM */
  18166. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  18167. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  18168. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  18169. -- lsc = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  18170. -+ pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  18171. -+ &lsc);
  18172. - val = lsc & (~BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB);
  18173. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, val);
  18174. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  18175. -+ val);
  18176. -
  18177. -+ /* Watchdog reset */
  18178. - brcmf_pcie_select_core(devinfo, BCMA_CORE_CHIPCOMMON);
  18179. - WRITECC32(devinfo, watchdog, 4);
  18180. - msleep(100);
  18181. -
  18182. -+ /* Restore ASPM */
  18183. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  18184. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  18185. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  18186. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, lsc);
  18187. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  18188. -+ lsc);
  18189. -
  18190. -- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  18191. -- for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  18192. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  18193. -- cfg_offset[i]);
  18194. -- val = brcmf_pcie_read_reg32(devinfo,
  18195. -- BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  18196. -- brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  18197. -- cfg_offset[i], val);
  18198. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  18199. -- val);
  18200. -+ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
  18201. -+ if (core->rev <= 13) {
  18202. -+ for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  18203. -+ brcmf_pcie_write_reg32(devinfo,
  18204. -+ BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  18205. -+ cfg_offset[i]);
  18206. -+ val = brcmf_pcie_read_reg32(devinfo,
  18207. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  18208. -+ brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  18209. -+ cfg_offset[i], val);
  18210. -+ brcmf_pcie_write_reg32(devinfo,
  18211. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  18212. -+ val);
  18213. -+ }
  18214. - }
  18215. - }
  18216. -
  18217. -@@ -519,8 +528,6 @@ static void brcmf_pcie_attach(struct brc
  18218. - u32 config;
  18219. -
  18220. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  18221. -- if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0)
  18222. -- brcmf_pcie_reset_device(devinfo);
  18223. - /* BAR1 window may not be sized properly */
  18224. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  18225. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR, 0x4e0);
  18226. -@@ -1636,6 +1643,23 @@ static int brcmf_pcie_buscoreprep(void *
  18227. - }
  18228. -
  18229. -
  18230. -+static int brcmf_pcie_buscore_reset(void *ctx, struct brcmf_chip *chip)
  18231. -+{
  18232. -+ struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  18233. -+ u32 val;
  18234. -+
  18235. -+ devinfo->ci = chip;
  18236. -+ brcmf_pcie_reset_device(devinfo);
  18237. -+
  18238. -+ val = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  18239. -+ if (val != 0xffffffff)
  18240. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  18241. -+ val);
  18242. -+
  18243. -+ return 0;
  18244. -+}
  18245. -+
  18246. -+
  18247. - static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  18248. - u32 rstvec)
  18249. - {
  18250. -@@ -1647,6 +1671,7 @@ static void brcmf_pcie_buscore_activate(
  18251. -
  18252. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  18253. - .prepare = brcmf_pcie_buscoreprep,
  18254. -+ .reset = brcmf_pcie_buscore_reset,
  18255. - .activate = brcmf_pcie_buscore_activate,
  18256. - .read32 = brcmf_pcie_buscore_read32,
  18257. - .write32 = brcmf_pcie_buscore_write32,
  18258. -@@ -1814,7 +1839,6 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  18259. - brcmf_pcie_intr_disable(devinfo);
  18260. -
  18261. - brcmf_detach(&pdev->dev);
  18262. -- brcmf_pcie_reset_device(devinfo);
  18263. -
  18264. - kfree(bus->bus_priv.pcie);
  18265. - kfree(bus->msgbuf->flowrings);
  18266. diff --git a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  18267. index 298f722..72e9a41 100644
  18268. --- a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  18269. +++ b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  18270. @@ -14,7 +14,7 @@
  18271. ccflags-y += -D__CHECK_ENDIAN__
  18272. --- a/drivers/net/wireless/ath/ath.h
  18273. +++ b/drivers/net/wireless/ath/ath.h
  18274. -@@ -316,13 +316,6 @@ void _ath_dbg(struct ath_common *common,
  18275. +@@ -318,13 +318,6 @@ void _ath_dbg(struct ath_common *common,
  18276. #endif /* CPTCFG_ATH_DEBUG */
  18277. /** Returns string describing opmode, or NULL if unknown mode. */
  18278. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  18279. index 2dac505..f918c18 100644
  18280. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  18281. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  18282. @@ -59,7 +59,7 @@
  18283. ---help---
  18284. --- a/.local-symbols
  18285. +++ b/.local-symbols
  18286. -@@ -89,6 +89,7 @@ RTL8187_LEDS=
  18287. +@@ -137,6 +137,7 @@ RTL8187_LEDS=
  18288. ATH_COMMON=
  18289. ATH_CARDS=
  18290. ATH_DEBUG=
  18291. diff --git a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  18292. index 1476953..8b52ac3 100644
  18293. --- a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  18294. +++ b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  18295. @@ -1,6 +1,6 @@
  18296. --- a/net/wireless/reg.c
  18297. +++ b/net/wireless/reg.c
  18298. -@@ -2368,6 +2368,8 @@ void regulatory_hint_country_ie(struct w
  18299. +@@ -2390,6 +2390,8 @@ void regulatory_hint_country_ie(struct w
  18300. enum environment_cap env = ENVIRON_ANY;
  18301. struct regulatory_request *request = NULL, *lr;
  18302. @@ -9,7 +9,7 @@
  18303. /* IE len must be evenly divisible by 2 */
  18304. if (country_ie_len & 0x01)
  18305. return;
  18306. -@@ -2571,6 +2573,7 @@ static void restore_regulatory_settings(
  18307. +@@ -2596,6 +2598,7 @@ static void restore_regulatory_settings(
  18308. void regulatory_hint_disconnect(void)
  18309. {
  18310. diff --git a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  18311. index 93760f9..1a62484 100644
  18312. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  18313. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  18314. @@ -1,6 +1,6 @@
  18315. --- a/drivers/net/wireless/ath/ath9k/init.c
  18316. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18317. -@@ -715,6 +715,7 @@ static const struct ieee80211_iface_limi
  18318. +@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  18319. BIT(NL80211_IFTYPE_AP) },
  18320. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18321. BIT(NL80211_IFTYPE_P2P_GO) },
  18322. diff --git a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  18323. index aa521d2..42d43a4 100644
  18324. --- a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  18325. +++ b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  18326. @@ -121,7 +121,7 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++
  18327. debugfs_create_file("antenna", S_IWUSR | S_IRUSR, phydir, ah,
  18328. --- a/drivers/net/wireless/ath/ath5k/ath5k.h
  18329. +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  18330. -@@ -1371,6 +1371,7 @@ struct ath5k_hw {
  18331. +@@ -1370,6 +1370,7 @@ struct ath5k_hw {
  18332. u8 ah_coverage_class;
  18333. bool ah_ack_bitrate_high;
  18334. u8 ah_bwmode;
  18335. diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  18336. index c6f50be..a7f9d9f 100644
  18337. --- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  18338. +++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  18339. @@ -1,6 +1,6 @@
  18340. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18341. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18342. -@@ -1299,6 +1299,53 @@ void ath9k_deinit_debug(struct ath_softc
  18343. +@@ -1301,6 +1301,53 @@ void ath9k_deinit_debug(struct ath_softc
  18344. ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
  18345. }
  18346. @@ -54,7 +54,7 @@
  18347. int ath9k_init_debug(struct ath_hw *ah)
  18348. {
  18349. struct ath_common *common = ath9k_hw_common(ah);
  18350. -@@ -1318,6 +1365,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18351. +@@ -1320,6 +1367,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18352. ath9k_tx99_init_debug(sc);
  18353. ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
  18354. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  18355. index 0bdcae4..b4e9762 100644
  18356. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  18357. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  18358. @@ -1,6 +1,6 @@
  18359. --- a/drivers/net/wireless/ath/ath9k/init.c
  18360. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18361. -@@ -1023,23 +1023,23 @@ static int __init ath9k_init(void)
  18362. +@@ -1031,23 +1031,23 @@ static int __init ath9k_init(void)
  18363. {
  18364. int error;
  18365. diff --git a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  18366. index ed2cfee..d2a3b96 100644
  18367. --- a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  18368. +++ b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  18369. @@ -1,6 +1,6 @@
  18370. --- a/drivers/net/wireless/ath/ath9k/hw.c
  18371. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  18372. -@@ -389,13 +389,8 @@ static void ath9k_hw_init_config(struct
  18373. +@@ -390,13 +390,8 @@ static void ath9k_hw_init_config(struct
  18374. ah->config.rx_intr_mitigation = true;
  18375. @@ -14,5 +14,5 @@
  18376. + ah->config.rimt_last = 250;
  18377. + ah->config.rimt_first = 500;
  18378. - /*
  18379. - * We need this for PCI devices only (Cardbus, PCI, miniPCI)
  18380. + if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
  18381. + ah->config.pll_pwrsave = 7;
  18382. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  18383. index d4104f0..6766111 100644
  18384. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  18385. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  18386. @@ -1,6 +1,6 @@
  18387. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  18388. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  18389. -@@ -87,7 +87,7 @@ int ath_descdma_setup(struct ath_softc *
  18390. +@@ -88,7 +88,7 @@ int ath_descdma_setup(struct ath_softc *
  18391. (_l) &= ((_sz) - 1); \
  18392. } while (0)
  18393. diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  18394. index c0fbf5e..5ecf528 100644
  18395. --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  18396. +++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  18397. @@ -1,6 +1,6 @@
  18398. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18399. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18400. -@@ -1346,6 +1346,52 @@ static const struct file_operations fops
  18401. +@@ -1348,6 +1348,52 @@ static const struct file_operations fops
  18402. .owner = THIS_MODULE
  18403. };
  18404. @@ -53,7 +53,7 @@
  18405. int ath9k_init_debug(struct ath_hw *ah)
  18406. {
  18407. struct ath_common *common = ath9k_hw_common(ah);
  18408. -@@ -1367,6 +1413,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18409. +@@ -1369,6 +1415,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18410. debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  18411. &fops_eeprom);
  18412. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  18413. index 40b5c81..c84d1bc 100644
  18414. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  18415. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  18416. @@ -1,6 +1,6 @@
  18417. --- a/drivers/net/wireless/ath/ath9k/hw.c
  18418. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  18419. -@@ -647,6 +647,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  18420. +@@ -651,6 +651,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  18421. /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */
  18422. switch (ah->hw_version.devid) {
  18423. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  18424. index 0c50a0b..99bf7e8 100644
  18425. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  18426. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  18427. @@ -18,7 +18,7 @@
  18428. const u8 *addr);
  18429. --- a/include/net/mac80211.h
  18430. +++ b/include/net/mac80211.h
  18431. -@@ -1171,6 +1171,7 @@ enum ieee80211_smps_mode {
  18432. +@@ -1252,6 +1252,7 @@ enum ieee80211_smps_mode {
  18433. *
  18434. * @power_level: requested transmit power (in dBm), backward compatibility
  18435. * value only that is set to the minimum of all interfaces
  18436. @@ -26,7 +26,7 @@
  18437. *
  18438. * @chandef: the channel definition to tune to
  18439. * @radar_enabled: whether radar detection is enabled
  18440. -@@ -1192,6 +1193,7 @@ struct ieee80211_conf {
  18441. +@@ -1273,6 +1274,7 @@ struct ieee80211_conf {
  18442. u32 flags;
  18443. int power_level, dynamic_ps_timeout;
  18444. int max_sleep_period;
  18445. @@ -36,7 +36,7 @@
  18446. u8 ps_dtim_period;
  18447. --- a/include/uapi/linux/nl80211.h
  18448. +++ b/include/uapi/linux/nl80211.h
  18449. -@@ -1760,6 +1760,9 @@ enum nl80211_commands {
  18450. +@@ -1761,6 +1761,9 @@ enum nl80211_commands {
  18451. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  18452. * is operating in an indoor environment.
  18453. *
  18454. @@ -46,7 +46,7 @@
  18455. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  18456. * @NL80211_ATTR_MAX: highest attribute number currently defined
  18457. * @__NL80211_ATTR_AFTER_LAST: internal use
  18458. -@@ -2129,6 +2132,8 @@ enum nl80211_attrs {
  18459. +@@ -2130,6 +2133,8 @@ enum nl80211_attrs {
  18460. NL80211_ATTR_REG_INDOOR,
  18461. @@ -57,7 +57,7 @@
  18462. __NL80211_ATTR_AFTER_LAST,
  18463. --- a/net/mac80211/cfg.c
  18464. +++ b/net/mac80211/cfg.c
  18465. -@@ -2208,6 +2208,19 @@ static int ieee80211_get_tx_power(struct
  18466. +@@ -2233,6 +2233,19 @@ static int ieee80211_get_tx_power(struct
  18467. return 0;
  18468. }
  18469. @@ -77,7 +77,7 @@
  18470. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  18471. const u8 *addr)
  18472. {
  18473. -@@ -3771,6 +3784,7 @@ const struct cfg80211_ops mac80211_confi
  18474. +@@ -3845,6 +3858,7 @@ const struct cfg80211_ops mac80211_confi
  18475. .set_wiphy_params = ieee80211_set_wiphy_params,
  18476. .set_tx_power = ieee80211_set_tx_power,
  18477. .get_tx_power = ieee80211_get_tx_power,
  18478. @@ -87,7 +87,7 @@
  18479. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  18480. --- a/net/mac80211/ieee80211_i.h
  18481. +++ b/net/mac80211/ieee80211_i.h
  18482. -@@ -1333,6 +1333,7 @@ struct ieee80211_local {
  18483. +@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  18484. int dynamic_ps_forced_timeout;
  18485. int user_power_level; /* in dBm, for all interfaces */
  18486. @@ -97,7 +97,7 @@
  18487. --- a/net/mac80211/main.c
  18488. +++ b/net/mac80211/main.c
  18489. -@@ -98,7 +98,7 @@ static u32 ieee80211_hw_conf_chan(struct
  18490. +@@ -95,7 +95,7 @@ static u32 ieee80211_hw_conf_chan(struct
  18491. struct ieee80211_sub_if_data *sdata;
  18492. struct cfg80211_chan_def chandef = {};
  18493. u32 changed = 0;
  18494. @@ -106,7 +106,7 @@
  18495. u32 offchannel_flag;
  18496. offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
  18497. -@@ -155,6 +155,12 @@ static u32 ieee80211_hw_conf_chan(struct
  18498. +@@ -152,6 +152,12 @@ static u32 ieee80211_hw_conf_chan(struct
  18499. }
  18500. rcu_read_unlock();
  18501. @@ -119,7 +119,7 @@
  18502. if (local->hw.conf.power_level != power) {
  18503. changed |= IEEE80211_CONF_CHANGE_POWER;
  18504. local->hw.conf.power_level = power;
  18505. -@@ -578,6 +584,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  18506. +@@ -581,6 +587,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  18507. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  18508. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  18509. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  18510. @@ -129,7 +129,7 @@
  18511. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  18512. --- a/net/wireless/nl80211.c
  18513. +++ b/net/wireless/nl80211.c
  18514. -@@ -400,6 +400,7 @@ static const struct nla_policy nl80211_p
  18515. +@@ -402,6 +402,7 @@ static const struct nla_policy nl80211_p
  18516. [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  18517. [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  18518. [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  18519. @@ -137,7 +137,7 @@
  18520. };
  18521. /* policy for the key attributes */
  18522. -@@ -2206,6 +2207,20 @@ static int nl80211_set_wiphy(struct sk_b
  18523. +@@ -2207,6 +2208,20 @@ static int nl80211_set_wiphy(struct sk_b
  18524. if (result)
  18525. return result;
  18526. }
  18527. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  18528. index b0fb9fe..8aab45a 100644
  18529. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  18530. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  18531. @@ -1,6 +1,6 @@
  18532. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  18533. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  18534. -@@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  18535. +@@ -806,6 +806,9 @@ static inline int ath9k_dump_btcoex(stru
  18536. void ath_init_leds(struct ath_softc *sc);
  18537. void ath_deinit_leds(struct ath_softc *sc);
  18538. void ath_fill_led_pin(struct ath_softc *sc);
  18539. @@ -10,7 +10,7 @@
  18540. #else
  18541. static inline void ath_init_leds(struct ath_softc *sc)
  18542. {
  18543. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  18544. +@@ -945,6 +948,13 @@ void ath_ant_comb_scan(struct ath_softc
  18545. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  18546. @@ -24,7 +24,7 @@
  18547. struct ath_softc {
  18548. struct ieee80211_hw *hw;
  18549. struct device *dev;
  18550. -@@ -1004,9 +1014,8 @@ struct ath_softc {
  18551. +@@ -996,9 +1006,8 @@ struct ath_softc {
  18552. spinlock_t chan_lock;
  18553. #ifdef CPTCFG_MAC80211_LEDS
  18554. @@ -165,7 +165,7 @@
  18555. void ath_fill_led_pin(struct ath_softc *sc)
  18556. --- a/drivers/net/wireless/ath/ath9k/init.c
  18557. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18558. -@@ -935,7 +935,7 @@ int ath9k_init_device(u16 devid, struct
  18559. +@@ -943,7 +943,7 @@ int ath9k_init_device(u16 devid, struct
  18560. #ifdef CPTCFG_MAC80211_LEDS
  18561. /* must be initialized before ieee80211_register_hw */
  18562. @@ -176,7 +176,7 @@
  18563. #endif
  18564. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18565. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18566. -@@ -1391,6 +1391,61 @@ static const struct file_operations fops
  18567. +@@ -1393,6 +1393,61 @@ static const struct file_operations fops
  18568. .llseek = default_llseek,
  18569. };
  18570. @@ -238,7 +238,7 @@
  18571. int ath9k_init_debug(struct ath_hw *ah)
  18572. {
  18573. -@@ -1415,6 +1470,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  18574. +@@ -1417,6 +1472,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  18575. &fops_eeprom);
  18576. debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  18577. sc, &fops_chanbw);
  18578. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  18579. index 631a692..2b2c763 100644
  18580. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  18581. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  18582. @@ -1,6 +1,6 @@
  18583. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18584. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18585. -@@ -1447,6 +1447,50 @@ static const struct file_operations fops
  18586. +@@ -1449,6 +1449,50 @@ static const struct file_operations fops
  18587. #endif
  18588. @@ -51,7 +51,7 @@
  18589. int ath9k_init_debug(struct ath_hw *ah)
  18590. {
  18591. struct ath_common *common = ath9k_hw_common(ah);
  18592. -@@ -1474,6 +1518,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18593. +@@ -1476,6 +1520,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18594. debugfs_create_file("gpio_led", S_IWUSR,
  18595. sc->debug.debugfs_phy, sc, &fops_gpio_led);
  18596. #endif
  18597. @@ -62,7 +62,7 @@
  18598. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  18599. --- a/drivers/net/wireless/ath/ath9k/hw.h
  18600. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  18601. -@@ -513,6 +513,12 @@ enum {
  18602. +@@ -519,6 +519,12 @@ enum {
  18603. ATH9K_RESET_COLD,
  18604. };
  18605. @@ -75,7 +75,7 @@
  18606. struct ath9k_hw_version {
  18607. u32 magic;
  18608. u16 devid;
  18609. -@@ -794,6 +800,8 @@ struct ath_hw {
  18610. +@@ -804,6 +810,8 @@ struct ath_hw {
  18611. u32 rfkill_polarity;
  18612. u32 ah_flags;
  18613. @@ -84,7 +84,7 @@
  18614. bool reset_power_on;
  18615. bool htc_reset_init;
  18616. -@@ -1055,6 +1063,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  18617. +@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  18618. bool ath9k_hw_check_alive(struct ath_hw *ah);
  18619. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  18620. @@ -94,7 +94,7 @@
  18621. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  18622. --- a/drivers/net/wireless/ath/ath9k/hw.c
  18623. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  18624. -@@ -1804,6 +1804,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  18625. +@@ -1808,6 +1808,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  18626. }
  18627. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  18628. @@ -115,7 +115,7 @@
  18629. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  18630. struct ath9k_hw_cal_data *caldata, bool fastcc)
  18631. {
  18632. -@@ -2012,6 +2026,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  18633. +@@ -2016,6 +2030,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  18634. ar9003_hw_disable_phy_restart(ah);
  18635. ath9k_hw_apply_gpio_override(ah);
  18636. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  18637. index a8f1999..49b6367 100644
  18638. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  18639. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  18640. @@ -1,6 +1,6 @@
  18641. --- a/drivers/net/wireless/ath/ath9k/hw.h
  18642. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  18643. -@@ -710,6 +710,7 @@ struct ath_spec_scan {
  18644. +@@ -720,6 +720,7 @@ struct ath_spec_scan {
  18645. * @config_pci_powersave:
  18646. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  18647. *
  18648. @@ -8,7 +8,7 @@
  18649. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  18650. * @spectral_scan_trigger: trigger a spectral scan run
  18651. * @spectral_scan_wait: wait for a spectral scan run to finish
  18652. -@@ -732,6 +733,7 @@ struct ath_hw_ops {
  18653. +@@ -742,6 +743,7 @@ struct ath_hw_ops {
  18654. struct ath_hw_antcomb_conf *antconf);
  18655. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  18656. struct ath_hw_antcomb_conf *antconf);
  18657. @@ -55,7 +55,7 @@
  18658. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  18659. --- a/drivers/net/wireless/ath/ath9k/init.c
  18660. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18661. -@@ -703,7 +703,8 @@ static void ath9k_init_txpower_limits(st
  18662. +@@ -710,7 +710,8 @@ static void ath9k_init_txpower_limits(st
  18663. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  18664. ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  18665. @@ -65,7 +65,7 @@
  18666. }
  18667. static const struct ieee80211_iface_limit if_limits[] = {
  18668. -@@ -895,6 +896,18 @@ static void ath9k_set_hw_capab(struct at
  18669. +@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at
  18670. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  18671. }
  18672. @@ -84,7 +84,7 @@
  18673. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  18674. const struct ath_bus_ops *bus_ops)
  18675. {
  18676. -@@ -940,6 +953,8 @@ int ath9k_init_device(u16 devid, struct
  18677. +@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct
  18678. ARRAY_SIZE(ath9k_tpt_blink));
  18679. #endif
  18680. @@ -110,7 +110,7 @@
  18681. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  18682. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  18683. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  18684. -@@ -1316,9 +1316,30 @@ void ar5008_hw_init_rate_txpower(struct
  18685. +@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  18686. }
  18687. }
  18688. @@ -141,7 +141,7 @@
  18689. static const u32 ar5416_cca_regs[6] = {
  18690. AR_PHY_CCA,
  18691. AR_PHY_CH1_CCA,
  18692. -@@ -1333,6 +1354,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  18693. +@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  18694. if (ret)
  18695. return ret;
  18696. diff --git a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  18697. index 240b898..6ca642a 100644
  18698. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  18699. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  18700. @@ -1,6 +1,6 @@
  18701. --- a/drivers/net/wireless/ath/ath9k/hw.c
  18702. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  18703. -@@ -245,6 +245,19 @@ void ath9k_hw_get_channel_centers(struct
  18704. +@@ -246,6 +246,19 @@ void ath9k_hw_get_channel_centers(struct
  18705. centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT);
  18706. }
  18707. @@ -20,7 +20,7 @@
  18708. /******************/
  18709. /* Chip Revisions */
  18710. /******************/
  18711. -@@ -1382,6 +1395,9 @@ static bool ath9k_hw_set_reset(struct at
  18712. +@@ -1386,6 +1399,9 @@ static bool ath9k_hw_set_reset(struct at
  18713. if (AR_SREV_9100(ah))
  18714. udelay(50);
  18715. @@ -30,7 +30,7 @@
  18716. return true;
  18717. }
  18718. -@@ -1481,6 +1497,9 @@ static bool ath9k_hw_chip_reset(struct a
  18719. +@@ -1485,6 +1501,9 @@ static bool ath9k_hw_chip_reset(struct a
  18720. ar9003_hw_internal_regulator_apply(ah);
  18721. ath9k_hw_init_pll(ah, chan);
  18722. @@ -40,7 +40,7 @@
  18723. return true;
  18724. }
  18725. -@@ -1782,8 +1801,14 @@ static int ath9k_hw_do_fastcc(struct ath
  18726. +@@ -1786,8 +1805,14 @@ static int ath9k_hw_do_fastcc(struct ath
  18727. if (AR_SREV_9271(ah))
  18728. ar9002_hw_load_ani_reg(ah, chan);
  18729. @@ -55,7 +55,7 @@
  18730. return -EINVAL;
  18731. }
  18732. -@@ -2037,6 +2062,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  18733. +@@ -2041,6 +2066,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  18734. ath9k_hw_set_radar_params(ah);
  18735. }
  18736. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  18737. index 9610372..bc0aca6 100644
  18738. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  18739. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  18740. @@ -1,6 +1,6 @@
  18741. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  18742. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  18743. -@@ -945,55 +945,6 @@ static bool ar5008_hw_ani_control_new(st
  18744. +@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  18745. * on == 0 means more noise imm
  18746. */
  18747. u32 on = param ? 1 : 0;
  18748. diff --git a/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch b/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  18749. index c0dc4fe..15863a6 100644
  18750. --- a/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  18751. +++ b/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  18752. @@ -20,32 +20,14 @@ Changes since v1: ---
  18753. drivers/net/wireless/rt2x00/rt2800lib.h | 11 +++++++++++
  18754. 2 files changed, 11 insertions(+), 13 deletions(-)
  18755. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  18756. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  18757. -@@ -2960,17 +2960,4 @@ enum rt2800_eeprom_word {
  18758. - */
  18759. - #define BCN_TBTT_OFFSET 64
  18760. -
  18761. --/*
  18762. -- * RT2800 driver data structure
  18763. -- */
  18764. --struct rt2800_drv_data {
  18765. -- u8 calibration_bw20;
  18766. -- u8 calibration_bw40;
  18767. -- u8 bbp25;
  18768. -- u8 bbp26;
  18769. -- u8 txmixer_gain_24g;
  18770. -- u8 txmixer_gain_5g;
  18771. -- unsigned int tbtt_tick;
  18772. --};
  18773. --
  18774. - #endif /* RT2800_H */
  18775. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  18776. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  18777. -@@ -20,6 +20,17 @@
  18778. +@@ -20,6 +20,20 @@
  18779. #ifndef RT2800LIB_H
  18780. #define RT2800LIB_H
  18781. ++#include "rt2800.h"
  18782. ++
  18783. +/* RT2800 driver data structure */
  18784. +struct rt2800_drv_data {
  18785. + u8 calibration_bw20;
  18786. @@ -55,8 +37,30 @@ Changes since v1: ---
  18787. + u8 txmixer_gain_24g;
  18788. + u8 txmixer_gain_5g;
  18789. + unsigned int tbtt_tick;
  18790. ++ DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  18791. +};
  18792. +
  18793. struct rt2800_ops {
  18794. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  18795. const unsigned int offset, u32 *value);
  18796. +--- a/drivers/net/wireless/rt2x00/rt2800.h
  18797. ++++ b/drivers/net/wireless/rt2x00/rt2800.h
  18798. +@@ -2969,18 +2969,4 @@ enum rt2800_eeprom_word {
  18799. + #define WCID_END 222
  18800. + #define STA_IDS_SIZE (WCID_END - WCID_START + 2)
  18801. +
  18802. +-/*
  18803. +- * RT2800 driver data structure
  18804. +- */
  18805. +-struct rt2800_drv_data {
  18806. +- u8 calibration_bw20;
  18807. +- u8 calibration_bw40;
  18808. +- u8 bbp25;
  18809. +- u8 bbp26;
  18810. +- u8 txmixer_gain_24g;
  18811. +- u8 txmixer_gain_5g;
  18812. +- unsigned int tbtt_tick;
  18813. +- DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  18814. +-};
  18815. +-
  18816. + #endif /* RT2800_H */
  18817. diff --git a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  18818. index 6bad6ac..9165eec 100644
  18819. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  18820. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  18821. @@ -24,7 +24,7 @@ Changes since v1:
  18822. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  18823. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  18824. -@@ -7747,6 +7747,7 @@ static int rt2800_probe_rt(struct rt2x00
  18825. +@@ -7721,6 +7721,7 @@ static int rt2800_probe_rt(struct rt2x00
  18826. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  18827. {
  18828. @@ -32,7 +32,7 @@ Changes since v1:
  18829. int retval;
  18830. u32 reg;
  18831. -@@ -7754,6 +7755,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  18832. +@@ -7728,6 +7729,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  18833. if (retval)
  18834. return retval;
  18835. @@ -44,9 +44,9 @@ Changes since v1:
  18836. */
  18837. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  18838. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  18839. -@@ -20,6 +20,10 @@
  18840. - #ifndef RT2800LIB_H
  18841. - #define RT2800LIB_H
  18842. +@@ -22,6 +22,10 @@
  18843. +
  18844. + #include "rt2800.h"
  18845. +enum rt2800_flag {
  18846. + RT2800_HAS_HIGH_SHARED_MEM,
  18847. @@ -55,16 +55,16 @@ Changes since v1:
  18848. /* RT2800 driver data structure */
  18849. struct rt2800_drv_data {
  18850. u8 calibration_bw20;
  18851. -@@ -29,6 +33,8 @@ struct rt2800_drv_data {
  18852. - u8 txmixer_gain_24g;
  18853. +@@ -32,6 +36,8 @@ struct rt2800_drv_data {
  18854. u8 txmixer_gain_5g;
  18855. unsigned int tbtt_tick;
  18856. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  18857. +
  18858. + unsigned long rt2800_flags;
  18859. };
  18860. struct rt2800_ops {
  18861. -@@ -61,6 +67,13 @@ struct rt2800_ops {
  18862. +@@ -64,6 +70,13 @@ struct rt2800_ops {
  18863. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  18864. };
  18865. diff --git a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  18866. index 9f8dfcc..5671515 100644
  18867. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  18868. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  18869. @@ -175,7 +175,7 @@ Changes since v1: ---
  18870. /*
  18871. * Update WCID information
  18872. -@@ -1437,8 +1467,11 @@ int rt2800_config_pairwise_key(struct rt
  18873. +@@ -1405,8 +1435,11 @@ int rt2800_config_pairwise_key(struct rt
  18874. sizeof(key_entry.rx_mic));
  18875. offset = PAIRWISE_KEY_ENTRY(key->hw_key_idx);
  18876. @@ -187,7 +187,7 @@ Changes since v1: ---
  18877. }
  18878. /*
  18879. -@@ -4908,14 +4941,19 @@ static int rt2800_init_registers(struct
  18880. +@@ -4884,14 +4917,19 @@ static int rt2800_init_registers(struct
  18881. /*
  18882. * ASIC will keep garbage value after boot, clear encryption keys.
  18883. */
  18884. @@ -207,7 +207,7 @@ Changes since v1: ---
  18885. }
  18886. /*
  18887. -@@ -5041,8 +5079,10 @@ static int rt2800_wait_bbp_ready(struct
  18888. +@@ -5017,8 +5055,10 @@ static int rt2800_wait_bbp_ready(struct
  18889. * BBP was enabled after firmware was loaded,
  18890. * but we need to reactivate it now.
  18891. */
  18892. @@ -218,7 +218,7 @@ Changes since v1: ---
  18893. msleep(1);
  18894. for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
  18895. -@@ -6738,11 +6778,19 @@ int rt2800_enable_radio(struct rt2x00_de
  18896. +@@ -6714,11 +6754,19 @@ int rt2800_enable_radio(struct rt2x00_de
  18897. /*
  18898. * Send signal during boot time to initialize firmware.
  18899. */
  18900. @@ -239,7 +239,7 @@ Changes since v1: ---
  18901. msleep(1);
  18902. /*
  18903. -@@ -7751,6 +7799,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  18904. +@@ -7725,6 +7773,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  18905. int retval;
  18906. u32 reg;
  18907. @@ -248,22 +248,22 @@ Changes since v1: ---
  18908. retval = rt2800_probe_rt(rt2x00dev);
  18909. if (retval)
  18910. return retval;
  18911. -@@ -7830,8 +7880,11 @@ void rt2800_get_tkip_seq(struct ieee8021
  18912. - u32 offset;
  18913. +@@ -7808,8 +7858,11 @@ void rt2800_get_key_seq(struct ieee80211
  18914. + return;
  18915. - offset = MAC_IVEIV_ENTRY(hw_key_idx);
  18916. + offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  18917. +
  18918. + rt2800_shared_mem_lock(rt2x00dev);
  18919. rt2800_register_multiread(rt2x00dev, offset,
  18920. &iveiv_entry, sizeof(iveiv_entry));
  18921. + rt2800_shared_mem_unlock(rt2x00dev);
  18922. - memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16));
  18923. - memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32));
  18924. + memcpy(&seq->tkip.iv16, &iveiv_entry.iv[0], 2);
  18925. + memcpy(&seq->tkip.iv32, &iveiv_entry.iv[4], 4);
  18926. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  18927. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  18928. -@@ -35,6 +35,11 @@ struct rt2800_drv_data {
  18929. - unsigned int tbtt_tick;
  18930. +@@ -38,6 +38,11 @@ struct rt2800_drv_data {
  18931. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  18932. unsigned long rt2800_flags;
  18933. +
  18934. @@ -274,7 +274,7 @@ Changes since v1: ---
  18935. };
  18936. struct rt2800_ops {
  18937. -@@ -65,6 +70,10 @@ struct rt2800_ops {
  18938. +@@ -68,6 +73,10 @@ struct rt2800_ops {
  18939. const u8 *data, const size_t len);
  18940. int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
  18941. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  18942. @@ -285,7 +285,7 @@ Changes since v1: ---
  18943. };
  18944. static inline bool rt2800_has_high_shared_mem(struct rt2x00_dev *rt2x00dev)
  18945. -@@ -74,6 +83,29 @@ static inline bool rt2800_has_high_share
  18946. +@@ -77,6 +86,29 @@ static inline bool rt2800_has_high_share
  18947. return test_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  18948. }
  18949. @@ -486,7 +486,7 @@ Changes since v1: ---
  18950. /*
  18951. * Queue handlers.
  18952. */
  18953. -@@ -294,8 +315,10 @@ static int rt2800usb_write_firmware(stru
  18954. +@@ -299,8 +320,10 @@ static int rt2800usb_write_firmware(stru
  18955. data + offset, length);
  18956. }
  18957. @@ -497,7 +497,7 @@ Changes since v1: ---
  18958. /*
  18959. * Send firmware request to device to load firmware,
  18960. -@@ -310,7 +333,10 @@ static int rt2800usb_write_firmware(stru
  18961. +@@ -315,7 +338,10 @@ static int rt2800usb_write_firmware(stru
  18962. }
  18963. msleep(10);
  18964. @@ -508,7 +508,7 @@ Changes since v1: ---
  18965. return 0;
  18966. }
  18967. -@@ -328,8 +354,10 @@ static int rt2800usb_init_registers(stru
  18968. +@@ -333,8 +359,10 @@ static int rt2800usb_init_registers(stru
  18969. if (rt2800_wait_csr_ready(rt2x00dev))
  18970. return -EBUSY;
  18971. @@ -519,7 +519,7 @@ Changes since v1: ---
  18972. reg = 0;
  18973. rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
  18974. -@@ -859,6 +887,9 @@ static const struct rt2800_ops rt2800usb
  18975. +@@ -863,6 +891,9 @@ static const struct rt2800_ops rt2800usb
  18976. .drv_write_firmware = rt2800usb_write_firmware,
  18977. .drv_init_registers = rt2800usb_init_registers,
  18978. .drv_get_txwi = rt2800usb_get_txwi,
  18979. diff --git a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  18980. index e7eb630..d04998a 100644
  18981. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  18982. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  18983. @@ -24,7 +24,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  18984. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  18985. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  18986. -@@ -4638,6 +4638,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  18987. +@@ -4614,6 +4614,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  18988. */
  18989. static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
  18990. {
  18991. @@ -32,7 +32,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  18992. u32 reg;
  18993. u16 eeprom;
  18994. unsigned int i;
  18995. -@@ -5003,7 +5004,7 @@ static int rt2800_init_registers(struct
  18996. +@@ -4979,7 +4980,7 @@ static int rt2800_init_registers(struct
  18997. /*
  18998. * Clear all beacons
  18999. */
  19000. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19001. rt2800_clear_beacon_register(rt2x00dev, i);
  19002. if (rt2x00_is_usb(rt2x00dev)) {
  19003. -@@ -7852,6 +7853,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19004. +@@ -7826,6 +7827,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19005. if (rt2x00_rt(rt2x00dev, RT3593))
  19006. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  19007. @@ -52,11 +52,11 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19008. */
  19009. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  19010. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  19011. -@@ -33,6 +33,7 @@ struct rt2800_drv_data {
  19012. +@@ -35,6 +35,7 @@ struct rt2800_drv_data {
  19013. u8 txmixer_gain_24g;
  19014. u8 txmixer_gain_5g;
  19015. unsigned int tbtt_tick;
  19016. + unsigned int hw_beacon_count;
  19017. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  19018. unsigned long rt2800_flags;
  19019. -
  19020. diff --git a/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch b/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  19021. index b79b4be..f5231f0 100644
  19022. --- a/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  19023. +++ b/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  19024. @@ -34,7 +34,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19025. */
  19026. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19027. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19028. -@@ -4650,6 +4650,30 @@ static int rt2800_init_registers(struct
  19029. +@@ -4626,6 +4626,30 @@ static int rt2800_init_registers(struct
  19030. if (ret)
  19031. return ret;
  19032. diff --git a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  19033. index 180c5e3..4b21eae 100644
  19034. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  19035. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  19036. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19037. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19038. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19039. -@@ -7877,7 +7877,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19040. +@@ -7851,7 +7851,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19041. if (rt2x00_rt(rt2x00dev, RT3593))
  19042. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  19043. diff --git a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  19044. index 31aa34a..e77cd86 100644
  19045. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  19046. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  19047. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19048. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19049. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19050. -@@ -7847,6 +7847,7 @@ static int rt2800_probe_rt(struct rt2x00
  19051. +@@ -7821,6 +7821,7 @@ static int rt2800_probe_rt(struct rt2x00
  19052. case RT3390:
  19053. case RT3572:
  19054. case RT3593:
  19055. diff --git a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  19056. index a90c590..780c1dd 100644
  19057. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  19058. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  19059. @@ -31,7 +31,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19060. #define RF5370 0x5370
  19061. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19062. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19063. -@@ -7465,6 +7465,66 @@ static const struct rf_channel rf_vals_3
  19064. +@@ -7441,6 +7441,66 @@ static const struct rf_channel rf_vals_3
  19065. {173, 0x61, 0, 9},
  19066. };
  19067. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19068. static const struct rf_channel rf_vals_5592_xtal20[] = {
  19069. /* Channel, N, K, mod, R */
  19070. {1, 482, 4, 10, 3},
  19071. -@@ -7694,6 +7754,11 @@ static int rt2800_probe_hw_mode(struct r
  19072. +@@ -7668,6 +7728,11 @@ static int rt2800_probe_hw_mode(struct r
  19073. spec->channels = rf_vals_3x;
  19074. break;
  19075. diff --git a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  19076. index ab2673b..858dece 100644
  19077. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  19078. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  19079. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19080. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19081. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19082. -@@ -4402,6 +4402,7 @@ void rt2800_vco_calibration(struct rt2x0
  19083. +@@ -4378,6 +4378,7 @@ void rt2800_vco_calibration(struct rt2x0
  19084. case RF3053:
  19085. case RF3070:
  19086. case RF3290:
  19087. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19088. case RF5360:
  19089. case RF5362:
  19090. case RF5370:
  19091. -@@ -7873,6 +7874,7 @@ static int rt2800_probe_hw_mode(struct r
  19092. +@@ -7847,6 +7848,7 @@ static int rt2800_probe_hw_mode(struct r
  19093. case RF3053:
  19094. case RF3070:
  19095. case RF3290:
  19096. diff --git a/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch b/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  19097. index 05ed444..ed82e44 100644
  19098. --- a/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  19099. +++ b/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  19100. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19101. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19102. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19103. -@@ -2649,6 +2649,211 @@ static void rt2800_config_channel_rf3053
  19104. +@@ -2625,6 +2625,211 @@ static void rt2800_config_channel_rf3053
  19105. }
  19106. }
  19107. @@ -223,7 +223,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19108. #define POWER_BOUND 0x27
  19109. #define POWER_BOUND_5G 0x2b
  19110. -@@ -3261,6 +3466,9 @@ static void rt2800_config_channel(struct
  19111. +@@ -3237,6 +3442,9 @@ static void rt2800_config_channel(struct
  19112. case RF3322:
  19113. rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
  19114. break;
  19115. diff --git a/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch b/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  19116. index 3b50775..33cbc4c 100644
  19117. --- a/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  19118. +++ b/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  19119. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19120. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19121. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19122. -@@ -7430,6 +7430,7 @@ static int rt2800_init_eeprom(struct rt2
  19123. +@@ -7406,6 +7406,7 @@ static int rt2800_init_eeprom(struct rt2
  19124. case RF3290:
  19125. case RF3320:
  19126. case RF3322:
  19127. diff --git a/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch b/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  19128. index 4dfb068..c3a4798 100644
  19129. --- a/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  19130. +++ b/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  19131. @@ -35,7 +35,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19132. #define RX_FILTER_CFG 0x1400
  19133. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19134. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19135. -@@ -5005,6 +5005,12 @@ static int rt2800_init_registers(struct
  19136. +@@ -4981,6 +4981,12 @@ static int rt2800_init_registers(struct
  19137. rt2800_register_write(rt2x00dev, TX_SW_CFG2,
  19138. 0x00000000);
  19139. }
  19140. @@ -48,7 +48,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19141. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  19142. rt2x00_rt(rt2x00dev, RT5392) ||
  19143. rt2x00_rt(rt2x00dev, RT5592)) {
  19144. -@@ -5035,9 +5041,11 @@ static int rt2800_init_registers(struct
  19145. +@@ -5011,9 +5017,11 @@ static int rt2800_init_registers(struct
  19146. rt2800_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
  19147. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
  19148. @@ -63,7 +63,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19149. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
  19150. else
  19151. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
  19152. -@@ -5190,6 +5198,11 @@ static int rt2800_init_registers(struct
  19153. +@@ -5166,6 +5174,11 @@ static int rt2800_init_registers(struct
  19154. reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002;
  19155. rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);
  19156. diff --git a/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch b/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  19157. index 6663b78..e647777 100644
  19158. --- a/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  19159. +++ b/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  19160. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19161. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19162. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19163. -@@ -5808,6 +5808,47 @@ static void rt2800_init_bbp_3593(struct
  19164. +@@ -5784,6 +5784,47 @@ static void rt2800_init_bbp_3593(struct
  19165. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  19166. }
  19167. @@ -59,7 +59,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19168. static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev)
  19169. {
  19170. int ant, div_mode;
  19171. -@@ -6026,6 +6067,9 @@ static void rt2800_init_bbp(struct rt2x0
  19172. +@@ -6002,6 +6043,9 @@ static void rt2800_init_bbp(struct rt2x0
  19173. case RT3593:
  19174. rt2800_init_bbp_3593(rt2x00dev);
  19175. return;
  19176. diff --git a/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch b/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  19177. index 6e66f14..0fec3cd 100644
  19178. --- a/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  19179. +++ b/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  19180. @@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19181. /*
  19182. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19183. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19184. -@@ -6843,6 +6843,144 @@ static void rt2800_init_rfcsr_3593(struc
  19185. +@@ -6819,6 +6819,144 @@ static void rt2800_init_rfcsr_3593(struc
  19186. /* TODO: enable stream mode support */
  19187. }
  19188. @@ -166,7 +166,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19189. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  19190. {
  19191. rt2800_rf_init_calibration(rt2x00dev, 2);
  19192. -@@ -7074,6 +7212,9 @@ static void rt2800_init_rfcsr(struct rt2
  19193. +@@ -7050,6 +7188,9 @@ static void rt2800_init_rfcsr(struct rt2
  19194. case RT3390:
  19195. rt2800_init_rfcsr_3390(rt2x00dev);
  19196. break;
  19197. diff --git a/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch b/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  19198. index 9390f7e..c9d1e06 100644
  19199. --- a/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  19200. +++ b/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  19201. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19202. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19203. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19204. -@@ -7611,6 +7611,8 @@ static int rt2800_init_eeprom(struct rt2
  19205. +@@ -7587,6 +7587,8 @@ static int rt2800_init_eeprom(struct rt2
  19206. rt2x00_rt(rt2x00dev, RT5390) ||
  19207. rt2x00_rt(rt2x00dev, RT5392))
  19208. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  19209. diff --git a/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch b/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  19210. index 1cba4f6..12b9c33 100644
  19211. --- a/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  19212. +++ b/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  19213. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19214. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19215. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19216. -@@ -3429,6 +3429,36 @@ static char rt2800_txpower_to_dev(struct
  19217. +@@ -3405,6 +3405,36 @@ static char rt2800_txpower_to_dev(struct
  19218. return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
  19219. }
  19220. @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19221. static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
  19222. struct ieee80211_conf *conf,
  19223. struct rf_channel *rf,
  19224. -@@ -3447,6 +3477,12 @@ static void rt2800_config_channel(struct
  19225. +@@ -3423,6 +3453,12 @@ static void rt2800_config_channel(struct
  19226. rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  19227. info->default_power3);
  19228. @@ -60,7 +60,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19229. switch (rt2x00dev->chip.rf) {
  19230. case RF2020:
  19231. case RF3020:
  19232. -@@ -3530,6 +3566,15 @@ static void rt2800_config_channel(struct
  19233. +@@ -3506,6 +3542,15 @@ static void rt2800_config_channel(struct
  19234. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  19235. rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
  19236. rt2800_bbp_write(rt2x00dev, 77, 0x98);
  19237. @@ -76,7 +76,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19238. } else {
  19239. rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
  19240. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  19241. -@@ -3542,6 +3587,7 @@ static void rt2800_config_channel(struct
  19242. +@@ -3518,6 +3563,7 @@ static void rt2800_config_channel(struct
  19243. !rt2x00_rt(rt2x00dev, RT5392)) {
  19244. if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
  19245. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  19246. @@ -84,7 +84,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19247. rt2800_bbp_write(rt2x00dev, 75, 0x46);
  19248. } else {
  19249. if (rt2x00_rt(rt2x00dev, RT3593))
  19250. -@@ -3550,19 +3596,22 @@ static void rt2800_config_channel(struct
  19251. +@@ -3526,19 +3572,22 @@ static void rt2800_config_channel(struct
  19252. rt2800_bbp_write(rt2x00dev, 82, 0x84);
  19253. rt2800_bbp_write(rt2x00dev, 75, 0x50);
  19254. }
  19255. @@ -110,7 +110,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19256. rt2800_bbp_write(rt2x00dev, 83, 0x9a);
  19257. if (rt2x00_has_cap_external_lna_a(rt2x00dev))
  19258. -@@ -3684,6 +3733,23 @@ static void rt2800_config_channel(struct
  19259. +@@ -3660,6 +3709,23 @@ static void rt2800_config_channel(struct
  19260. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
  19261. diff --git a/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch b/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  19262. index 1773128..3f40b4e 100644
  19263. --- a/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  19264. +++ b/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  19265. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19266. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19267. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19268. -@@ -3416,13 +3416,15 @@ static char rt2800_txpower_to_dev(struct
  19269. +@@ -3392,13 +3392,15 @@ static char rt2800_txpower_to_dev(struct
  19270. unsigned int channel,
  19271. char txpower)
  19272. {
  19273. diff --git a/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch b/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  19274. index 36f0a4c..52baeec 100644
  19275. --- a/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  19276. +++ b/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  19277. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19278. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19279. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19280. -@@ -4635,7 +4635,8 @@ static void rt2800_config_txpower(struct
  19281. +@@ -4611,7 +4611,8 @@ static void rt2800_config_txpower(struct
  19282. struct ieee80211_channel *chan,
  19283. int power_level)
  19284. {
  19285. diff --git a/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch b/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  19286. index 8119f97..b9dafc6 100644
  19287. --- a/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  19288. +++ b/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  19289. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19290. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19291. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19292. -@@ -7493,7 +7493,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  19293. +@@ -7469,7 +7469,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  19294. {
  19295. u16 word;
  19296. @@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19297. return 0;
  19298. rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word);
  19299. -@@ -7507,7 +7508,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  19300. +@@ -7483,7 +7484,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  19301. {
  19302. u16 word;
  19303. diff --git a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  19304. index dfbdee7..f09f803 100644
  19305. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  19306. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  19307. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19308. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19309. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19310. -@@ -8428,7 +8428,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19311. +@@ -8402,7 +8402,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19312. if (rt2x00_rt(rt2x00dev, RT3593))
  19313. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  19314. diff --git a/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch b/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  19315. index 22f7110..f7d23fc 100644
  19316. --- a/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  19317. +++ b/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  19318. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19319. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19320. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19321. -@@ -1961,7 +1961,8 @@ void rt2800_config_ant(struct rt2x00_dev
  19322. +@@ -1937,7 +1937,8 @@ void rt2800_config_ant(struct rt2x00_dev
  19323. rt2800_bbp_write(rt2x00dev, 3, r3);
  19324. rt2800_bbp_write(rt2x00dev, 1, r1);
  19325. diff --git a/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch b/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  19326. index 9945f38..4da750e 100644
  19327. --- a/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  19328. +++ b/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  19329. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19330. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19331. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19332. -@@ -1984,7 +1984,8 @@ static void rt2800_config_lna_gain(struc
  19333. +@@ -1960,7 +1960,8 @@ static void rt2800_config_lna_gain(struc
  19334. rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
  19335. lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0);
  19336. } else if (libconf->rf.channel <= 128) {
  19337. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19338. rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &eeprom);
  19339. lna_gain = rt2x00_get_field16(eeprom,
  19340. EEPROM_EXT_LNA2_A1);
  19341. -@@ -1994,7 +1995,8 @@ static void rt2800_config_lna_gain(struc
  19342. +@@ -1970,7 +1971,8 @@ static void rt2800_config_lna_gain(struc
  19343. EEPROM_RSSI_BG2_LNA_A1);
  19344. }
  19345. } else {
  19346. diff --git a/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch b/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  19347. index beadea8..628b237 100644
  19348. --- a/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  19349. +++ b/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  19350. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19351. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19352. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19353. -@@ -4835,7 +4835,8 @@ static u8 rt2800_get_default_vgc(struct
  19354. +@@ -4811,7 +4811,8 @@ static u8 rt2800_get_default_vgc(struct
  19355. else
  19356. vgc = 0x2e + rt2x00dev->lna_gain;
  19357. } else { /* 5GHZ band */
  19358. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19359. vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3;
  19360. else if (rt2x00_rt(rt2x00dev, RT5592))
  19361. vgc = 0x24 + (2 * rt2x00dev->lna_gain);
  19362. -@@ -4855,7 +4856,8 @@ static inline void rt2800_set_vgc(struct
  19363. +@@ -4831,7 +4832,8 @@ static inline void rt2800_set_vgc(struct
  19364. {
  19365. if (qual->vgc_level != vgc_level) {
  19366. if (rt2x00_rt(rt2x00dev, RT3572) ||
  19367. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19368. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66,
  19369. vgc_level);
  19370. } else if (rt2x00_rt(rt2x00dev, RT5592)) {
  19371. -@@ -4902,6 +4904,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  19372. +@@ -4878,6 +4880,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  19373. }
  19374. break;
  19375. diff --git a/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch b/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  19376. index a6c0f58..216b8b6 100644
  19377. --- a/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  19378. +++ b/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  19379. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19380. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19381. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19382. -@@ -7630,7 +7630,8 @@ static int rt2800_validate_eeprom(struct
  19383. +@@ -7606,7 +7606,8 @@ static int rt2800_validate_eeprom(struct
  19384. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
  19385. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
  19386. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
  19387. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19388. if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
  19389. rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
  19390. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
  19391. -@@ -7650,7 +7651,8 @@ static int rt2800_validate_eeprom(struct
  19392. +@@ -7626,7 +7627,8 @@ static int rt2800_validate_eeprom(struct
  19393. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
  19394. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
  19395. rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
  19396. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19397. if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
  19398. rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
  19399. rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
  19400. -@@ -7658,7 +7660,8 @@ static int rt2800_validate_eeprom(struct
  19401. +@@ -7634,7 +7636,8 @@ static int rt2800_validate_eeprom(struct
  19402. }
  19403. rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
  19404. diff --git a/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch b/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  19405. index 910f9ec..515086f 100644
  19406. --- a/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  19407. +++ b/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  19408. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19409. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19410. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19411. -@@ -4005,6 +4005,9 @@ static u8 rt2800_compensate_txpower(stru
  19412. +@@ -3981,6 +3981,9 @@ static u8 rt2800_compensate_txpower(stru
  19413. if (rt2x00_rt(rt2x00dev, RT3593))
  19414. return min_t(u8, txpower, 0xc);
  19415. diff --git a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  19416. index bcdfc67..77e3f1b 100644
  19417. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  19418. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  19419. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19420. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19421. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19422. -@@ -8441,7 +8441,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19423. +@@ -8415,7 +8415,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19424. if (retval)
  19425. return retval;
  19426. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  19427. index 8f650a2..44b629f 100644
  19428. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  19429. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  19430. @@ -1,13 +1,13 @@
  19431. --- a/.local-symbols
  19432. +++ b/.local-symbols
  19433. -@@ -263,6 +263,7 @@ RT2X00_LIB_FIRMWARE=
  19434. +@@ -312,6 +312,7 @@ RT2X00_LIB_FIRMWARE=
  19435. RT2X00_LIB_CRYPTO=
  19436. RT2X00_LIB_LEDS=
  19437. RT2X00_LIB_DEBUGFS=
  19438. +RT2X00_LIB_EEPROM=
  19439. RT2X00_DEBUG=
  19440. - RTL_CARDS=
  19441. - RTL8192CE=
  19442. + WL_MEDIATEK=
  19443. + MT7601U=
  19444. --- a/drivers/net/wireless/rt2x00/Kconfig
  19445. +++ b/drivers/net/wireless/rt2x00/Kconfig
  19446. @@ -69,6 +69,7 @@ config RT2800PCI
  19447. @@ -48,7 +48,7 @@
  19448. obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o
  19449. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  19450. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  19451. -@@ -43,6 +43,8 @@ struct rt2800_drv_data {
  19452. +@@ -46,6 +46,8 @@ struct rt2800_drv_data {
  19453. } shmem_lock;
  19454. };
  19455. @@ -57,7 +57,7 @@
  19456. struct rt2800_ops {
  19457. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  19458. const unsigned int offset, u32 *value);
  19459. -@@ -176,6 +178,15 @@ static inline int rt2800_read_eeprom(str
  19460. +@@ -179,6 +181,15 @@ static inline int rt2800_read_eeprom(str
  19461. {
  19462. const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
  19463. diff --git a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  19464. index a35bd55..16a579d 100644
  19465. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  19466. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  19467. @@ -41,7 +41,7 @@
  19468. * Interrupt context handlers.
  19469. --- a/drivers/net/wireless/rt2x00/rt61pci.c
  19470. +++ b/drivers/net/wireless/rt2x00/rt61pci.c
  19471. -@@ -2392,6 +2392,7 @@ static int rt61pci_validate_eeprom(struc
  19472. +@@ -2390,6 +2390,7 @@ static int rt61pci_validate_eeprom(struc
  19473. u32 reg;
  19474. u16 word;
  19475. u8 *mac;
  19476. @@ -49,7 +49,7 @@
  19477. s8 value;
  19478. rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, &reg);
  19479. -@@ -2412,7 +2413,11 @@ static int rt61pci_validate_eeprom(struc
  19480. +@@ -2410,7 +2411,11 @@ static int rt61pci_validate_eeprom(struc
  19481. /*
  19482. * Start validation of the data that has been read.
  19483. */
  19484. diff --git a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  19485. index 067d2ea..39b1ccc 100644
  19486. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  19487. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  19488. @@ -1,6 +1,6 @@
  19489. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19490. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19491. -@@ -3552,11 +3552,18 @@ static void rt2800_config_channel(struct
  19492. +@@ -3528,11 +3528,18 @@ static void rt2800_config_channel(struct
  19493. /*
  19494. * Change BBP settings
  19495. */
  19496. @@ -19,7 +19,7 @@
  19497. } else if (rt2x00_rt(rt2x00dev, RT3593)) {
  19498. if (rf->channel > 14) {
  19499. /* Disable CCK Packet detection on 5GHz */
  19500. -@@ -6618,6 +6625,12 @@ static void rt2800_init_rfcsr_3290(struc
  19501. +@@ -6594,6 +6601,12 @@ static void rt2800_init_rfcsr_3290(struc
  19502. static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
  19503. {
  19504. @@ -32,7 +32,7 @@
  19505. rt2800_rf_init_calibration(rt2x00dev, 30);
  19506. rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
  19507. -@@ -6653,15 +6666,30 @@ static void rt2800_init_rfcsr_3352(struc
  19508. +@@ -6629,15 +6642,30 @@ static void rt2800_init_rfcsr_3352(struc
  19509. rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
  19510. rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
  19511. rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
  19512. @@ -66,7 +66,7 @@
  19513. rt2800_rfcsr_write(rt2x00dev, 43, 0xdb);
  19514. rt2800_rfcsr_write(rt2x00dev, 44, 0xdb);
  19515. rt2800_rfcsr_write(rt2x00dev, 45, 0xdb);
  19516. -@@ -6669,15 +6697,20 @@ static void rt2800_init_rfcsr_3352(struc
  19517. +@@ -6645,15 +6673,20 @@ static void rt2800_init_rfcsr_3352(struc
  19518. rt2800_rfcsr_write(rt2x00dev, 47, 0x0d);
  19519. rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
  19520. rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
  19521. @@ -96,7 +96,7 @@
  19522. rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
  19523. rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
  19524. rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
  19525. -@@ -7698,6 +7731,7 @@ static int rt2800_init_eeprom(struct rt2
  19526. +@@ -7674,6 +7707,7 @@ static int rt2800_init_eeprom(struct rt2
  19527. * RT53xx: defined in "EEPROM_CHIP_ID" field
  19528. */
  19529. if (rt2x00_rt(rt2x00dev, RT3290) ||
  19530. @@ -104,7 +104,7 @@
  19531. rt2x00_rt(rt2x00dev, RT5390) ||
  19532. rt2x00_rt(rt2x00dev, RT5392))
  19533. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  19534. -@@ -7793,7 +7827,8 @@ static int rt2800_init_eeprom(struct rt2
  19535. +@@ -7769,7 +7803,8 @@ static int rt2800_init_eeprom(struct rt2
  19536. /*
  19537. * Detect if this device has Bluetooth co-existence.
  19538. */
  19539. @@ -114,7 +114,7 @@
  19540. __set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags);
  19541. /*
  19542. -@@ -7822,6 +7857,22 @@ static int rt2800_init_eeprom(struct rt2
  19543. +@@ -7798,6 +7833,22 @@ static int rt2800_init_eeprom(struct rt2
  19544. EIRP_MAX_TX_POWER_LIMIT)
  19545. __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
  19546. diff --git a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  19547. index 1dcca36..dcecba4 100644
  19548. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  19549. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  19550. @@ -1,6 +1,6 @@
  19551. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19552. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19553. -@@ -8209,6 +8209,27 @@ static const struct rf_channel rf_vals_5
  19554. +@@ -8185,6 +8185,27 @@ static const struct rf_channel rf_vals_5
  19555. {196, 83, 0, 12, 1},
  19556. };
  19557. @@ -28,7 +28,7 @@
  19558. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  19559. {
  19560. struct hw_mode_spec *spec = &rt2x00dev->spec;
  19561. -@@ -8297,7 +8318,10 @@ static int rt2800_probe_hw_mode(struct r
  19562. +@@ -8271,7 +8292,10 @@ static int rt2800_probe_hw_mode(struct r
  19563. case RF5390:
  19564. case RF5392:
  19565. spec->num_channels = 14;
  19566. @@ -40,7 +40,7 @@
  19567. break;
  19568. case RF3052:
  19569. -@@ -8481,6 +8505,19 @@ static int rt2800_probe_rt(struct rt2x00
  19570. +@@ -8455,6 +8479,19 @@ static int rt2800_probe_rt(struct rt2x00
  19571. return 0;
  19572. }
  19573. @@ -60,7 +60,7 @@
  19574. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  19575. {
  19576. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  19577. -@@ -8523,6 +8560,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19578. +@@ -8497,6 +8534,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19579. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  19580. /*
  19581. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  19582. index c779a17..9f11862 100644
  19583. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  19584. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  19585. @@ -8,7 +8,7 @@
  19586. #include "rt2x00.h"
  19587. #include "rt2800lib.h"
  19588. -@@ -8507,13 +8508,14 @@ static int rt2800_probe_rt(struct rt2x00
  19589. +@@ -8481,13 +8482,14 @@ static int rt2800_probe_rt(struct rt2x00
  19590. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  19591. {
  19592. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  19593. index 840b3bc..9679d71 100644
  19594. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  19595. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  19596. @@ -10,7 +10,7 @@
  19597. #define RF5370 0x5370
  19598. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19599. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19600. -@@ -3038,6 +3038,13 @@ static void rt2800_config_channel_rf53xx
  19601. +@@ -3014,6 +3014,13 @@ static void rt2800_config_channel_rf53xx
  19602. rt2800_rfcsr_write(rt2x00dev, 59,
  19603. r59_non_bt[idx]);
  19604. @@ -24,7 +24,7 @@
  19605. }
  19606. }
  19607. }
  19608. -@@ -3516,6 +3523,7 @@ static void rt2800_config_channel(struct
  19609. +@@ -3492,6 +3499,7 @@ static void rt2800_config_channel(struct
  19610. rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info);
  19611. break;
  19612. case RF3070:
  19613. @@ -32,7 +32,7 @@
  19614. case RF5360:
  19615. case RF5362:
  19616. case RF5370:
  19617. -@@ -3534,6 +3542,7 @@ static void rt2800_config_channel(struct
  19618. +@@ -3510,6 +3518,7 @@ static void rt2800_config_channel(struct
  19619. if (rt2x00_rf(rt2x00dev, RF3070) ||
  19620. rt2x00_rf(rt2x00dev, RF3290) ||
  19621. rt2x00_rf(rt2x00dev, RF3322) ||
  19622. @@ -40,7 +40,7 @@
  19623. rt2x00_rf(rt2x00dev, RF5360) ||
  19624. rt2x00_rf(rt2x00dev, RF5362) ||
  19625. rt2x00_rf(rt2x00dev, RF5370) ||
  19626. -@@ -3812,7 +3821,8 @@ static void rt2800_config_channel(struct
  19627. +@@ -3788,7 +3797,8 @@ static void rt2800_config_channel(struct
  19628. /*
  19629. * Clear update flag
  19630. */
  19631. @@ -50,7 +50,7 @@
  19632. rt2800_bbp_read(rt2x00dev, 49, &bbp);
  19633. rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
  19634. rt2800_bbp_write(rt2x00dev, 49, bbp);
  19635. -@@ -4698,6 +4708,7 @@ void rt2800_vco_calibration(struct rt2x0
  19636. +@@ -4674,6 +4684,7 @@ void rt2800_vco_calibration(struct rt2x0
  19637. case RF3070:
  19638. case RF3290:
  19639. case RF3853:
  19640. @@ -58,7 +58,7 @@
  19641. case RF5360:
  19642. case RF5362:
  19643. case RF5370:
  19644. -@@ -5111,6 +5122,8 @@ static int rt2800_init_registers(struct
  19645. +@@ -5087,6 +5098,8 @@ static int rt2800_init_registers(struct
  19646. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  19647. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  19648. rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
  19649. @@ -67,7 +67,7 @@
  19650. } else {
  19651. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
  19652. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  19653. -@@ -5766,9 +5779,13 @@ static void rt2800_init_bbp_3352(struct
  19654. +@@ -5742,9 +5755,13 @@ static void rt2800_init_bbp_3352(struct
  19655. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  19656. @@ -84,7 +84,7 @@
  19657. rt2800_bbp_write(rt2x00dev, 86, 0x38);
  19658. -@@ -5782,9 +5799,13 @@ static void rt2800_init_bbp_3352(struct
  19659. +@@ -5758,9 +5775,13 @@ static void rt2800_init_bbp_3352(struct
  19660. rt2800_bbp_write(rt2x00dev, 104, 0x92);
  19661. @@ -101,7 +101,7 @@
  19662. rt2800_bbp_write(rt2x00dev, 120, 0x50);
  19663. -@@ -5809,6 +5830,13 @@ static void rt2800_init_bbp_3352(struct
  19664. +@@ -5785,6 +5806,13 @@ static void rt2800_init_bbp_3352(struct
  19665. rt2800_bbp_write(rt2x00dev, 143, 0xa2);
  19666. rt2800_bbp_write(rt2x00dev, 148, 0xc8);
  19667. @@ -115,7 +115,7 @@
  19668. }
  19669. static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
  19670. -@@ -6150,6 +6178,7 @@ static void rt2800_init_bbp(struct rt2x0
  19671. +@@ -6126,6 +6154,7 @@ static void rt2800_init_bbp(struct rt2x0
  19672. rt2800_init_bbp_3290(rt2x00dev);
  19673. break;
  19674. case RT3352:
  19675. @@ -123,7 +123,7 @@
  19676. rt2800_init_bbp_3352(rt2x00dev);
  19677. break;
  19678. case RT3390:
  19679. -@@ -7101,6 +7130,76 @@ static void rt2800_init_rfcsr_3883(struc
  19680. +@@ -7077,6 +7106,76 @@ static void rt2800_init_rfcsr_3883(struc
  19681. rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
  19682. }
  19683. @@ -200,7 +200,7 @@
  19684. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  19685. {
  19686. rt2800_rf_init_calibration(rt2x00dev, 2);
  19687. -@@ -7341,6 +7440,9 @@ static void rt2800_init_rfcsr(struct rt2
  19688. +@@ -7317,6 +7416,9 @@ static void rt2800_init_rfcsr(struct rt2
  19689. case RT3593:
  19690. rt2800_init_rfcsr_3593(rt2x00dev);
  19691. break;
  19692. @@ -210,7 +210,7 @@
  19693. case RT5390:
  19694. rt2800_init_rfcsr_5390(rt2x00dev);
  19695. break;
  19696. -@@ -7600,6 +7702,12 @@ static int rt2800_validate_eeprom(struct
  19697. +@@ -7576,6 +7678,12 @@ static int rt2800_validate_eeprom(struct
  19698. rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
  19699. rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
  19700. rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
  19701. @@ -223,7 +223,7 @@
  19702. } else if (rt2x00_rt(rt2x00dev, RT2860) ||
  19703. rt2x00_rt(rt2x00dev, RT2872)) {
  19704. /*
  19705. -@@ -7738,6 +7846,8 @@ static int rt2800_init_eeprom(struct rt2
  19706. +@@ -7714,6 +7822,8 @@ static int rt2800_init_eeprom(struct rt2
  19707. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  19708. else if (rt2x00_rt(rt2x00dev, RT3883))
  19709. rf = RF3853;
  19710. @@ -232,7 +232,7 @@
  19711. else
  19712. rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
  19713. -@@ -7757,6 +7867,7 @@ static int rt2800_init_eeprom(struct rt2
  19714. +@@ -7733,6 +7843,7 @@ static int rt2800_init_eeprom(struct rt2
  19715. case RF3320:
  19716. case RF3322:
  19717. case RF3853:
  19718. @@ -240,7 +240,7 @@
  19719. case RF5360:
  19720. case RF5362:
  19721. case RF5370:
  19722. -@@ -8312,6 +8423,7 @@ static int rt2800_probe_hw_mode(struct r
  19723. +@@ -8286,6 +8397,7 @@ static int rt2800_probe_hw_mode(struct r
  19724. case RF3290:
  19725. case RF3320:
  19726. case RF3322:
  19727. @@ -248,7 +248,7 @@
  19728. case RF5360:
  19729. case RF5362:
  19730. case RF5370:
  19731. -@@ -8451,6 +8563,7 @@ static int rt2800_probe_hw_mode(struct r
  19732. +@@ -8425,6 +8537,7 @@ static int rt2800_probe_hw_mode(struct r
  19733. case RF3070:
  19734. case RF3290:
  19735. case RF3853:
  19736. @@ -256,7 +256,7 @@
  19737. case RF5360:
  19738. case RF5362:
  19739. case RF5370:
  19740. -@@ -8491,6 +8604,7 @@ static int rt2800_probe_rt(struct rt2x00
  19741. +@@ -8465,6 +8578,7 @@ static int rt2800_probe_rt(struct rt2x00
  19742. case RT3572:
  19743. case RT3593:
  19744. case RT3883:
  19745. diff --git a/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch b/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  19746. index 13f2048..b085c5e 100644
  19747. --- a/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  19748. +++ b/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  19749. @@ -8,7 +8,7 @@
  19750. #include "rt2x00.h"
  19751. #include "rt2800lib.h"
  19752. -@@ -7957,6 +7958,17 @@ static int rt2800_init_eeprom(struct rt2
  19753. +@@ -7933,6 +7934,17 @@ static int rt2800_init_eeprom(struct rt2
  19754. rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
  19755. rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
  19756. diff --git a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  19757. index aaa8367..259cb1f 100644
  19758. --- a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  19759. +++ b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  19760. @@ -1,6 +1,6 @@
  19761. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19762. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19763. -@@ -7841,10 +7841,11 @@ static int rt2800_init_eeprom(struct rt2
  19764. +@@ -7817,10 +7817,11 @@ static int rt2800_init_eeprom(struct rt2
  19765. * RT53xx: defined in "EEPROM_CHIP_ID" field
  19766. */
  19767. if (rt2x00_rt(rt2x00dev, RT3290) ||
  19768. diff --git a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  19769. index bb2fc1c..77d63fe 100644
  19770. --- a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  19771. +++ b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  19772. @@ -11,7 +11,7 @@
  19773. * RFCSR 31:
  19774. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  19775. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  19776. -@@ -3551,8 +3551,13 @@ static void rt2800_config_channel(struct
  19777. +@@ -3527,8 +3527,13 @@ static void rt2800_config_channel(struct
  19778. rt2x00_rf(rt2x00dev, RF5390) ||
  19779. rt2x00_rf(rt2x00dev, RF5392)) {
  19780. rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
  19781. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  19782. index 9e29034..3b8b756 100644
  19783. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  19784. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  19785. @@ -1,6 +1,6 @@
  19786. --- a/drivers/net/wireless/libertas/cfg.c
  19787. +++ b/drivers/net/wireless/libertas/cfg.c
  19788. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  19789. +@@ -2083,6 +2083,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  19790. goto err_wiphy_new;
  19791. }
  19792. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  19793. index 252fa81..dace56b 100644
  19794. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  19795. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  19796. @@ -1,6 +1,6 @@
  19797. --- a/drivers/net/wireless/libertas/cfg.c
  19798. +++ b/drivers/net/wireless/libertas/cfg.c
  19799. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  19800. +@@ -2173,6 +2173,8 @@ int lbs_cfg_register(struct lbs_private
  19801. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  19802. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  19803. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  19804. index ac58dba..dd82ce5 100644
  19805. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  19806. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  19807. @@ -9,7 +9,7 @@
  19808. antenna = b43_antenna_to_phyctl(antenna);
  19809. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  19810. /* We can't send beacons with short preamble. Would get PHY errors. */
  19811. -@@ -3302,8 +3302,8 @@ static int b43_chip_init(struct b43_wlde
  19812. +@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  19813. /* Select the antennae */
  19814. if (phy->ops->set_rx_antenna)
  19815. @@ -20,7 +20,7 @@
  19816. if (phy->type == B43_PHYTYPE_B) {
  19817. value16 = b43_read16(dev, 0x005E);
  19818. -@@ -4003,7 +4003,6 @@ static int b43_op_config(struct ieee8021
  19819. +@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  19820. struct b43_wldev *dev = wl->current_dev;
  19821. struct b43_phy *phy = &dev->phy;
  19822. struct ieee80211_conf *conf = &hw->conf;
  19823. @@ -28,7 +28,7 @@
  19824. int err = 0;
  19825. mutex_lock(&wl->mutex);
  19826. -@@ -4046,11 +4045,9 @@ static int b43_op_config(struct ieee8021
  19827. +@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  19828. }
  19829. /* Antennas for RX and management frame TX. */
  19830. @@ -42,7 +42,7 @@
  19831. if (wl->radio_enabled != phy->radio_on) {
  19832. if (wl->radio_enabled) {
  19833. -@@ -5213,6 +5210,47 @@ static int b43_op_get_survey(struct ieee
  19834. +@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  19835. return 0;
  19836. }
  19837. @@ -90,7 +90,7 @@
  19838. static const struct ieee80211_ops b43_hw_ops = {
  19839. .tx = b43_op_tx,
  19840. .conf_tx = b43_op_conf_tx,
  19841. -@@ -5234,6 +5272,8 @@ static const struct ieee80211_ops b43_hw
  19842. +@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  19843. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  19844. .get_survey = b43_op_get_survey,
  19845. .rfkill_poll = b43_rfkill_poll,
  19846. @@ -99,7 +99,7 @@
  19847. };
  19848. /* Hard-reset the chip. Do not call this directly.
  19849. -@@ -5542,6 +5582,8 @@ static int b43_one_core_attach(struct b4
  19850. +@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  19851. if (!wldev)
  19852. goto out;
  19853. @@ -108,7 +108,7 @@
  19854. wldev->use_pio = b43_modparam_pio;
  19855. wldev->dev = dev;
  19856. wldev->wl = wl;
  19857. -@@ -5632,6 +5674,9 @@ static struct b43_wl *b43_wireless_init(
  19858. +@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  19859. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  19860. diff --git a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  19861. index 685a5f9..f9799ce 100644
  19862. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  19863. +++ b/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  19864. @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  19865. --- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19866. +++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19867. -@@ -1213,6 +1213,7 @@ static int __init brcmfmac_module_init(v
  19868. +@@ -1189,6 +1189,7 @@ static int __init brcmfmac_module_init(v
  19869. #endif
  19870. if (!schedule_work(&brcmf_driver_work))
  19871. return -EBUSY;
  19872. diff --git a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  19873. index 1cba2b3..5fdfa37 100644
  19874. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  19875. +++ b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  19876. @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  19877. --- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19878. +++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19879. -@@ -691,9 +691,37 @@ static struct wireless_dev *brcmf_cfg802
  19880. +@@ -692,9 +692,37 @@ static struct wireless_dev *brcmf_cfg802
  19881. u32 *flags,
  19882. struct vif_params *params)
  19883. {
  19884. diff --git a/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch b/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch
  19885. deleted file mode 100644
  19886. index 856dea8..0000000
  19887. --- a/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch
  19888. +++ /dev/null
  19889. @@ -1,139 +0,0 @@
  19890. -When running with DT, we no longer have a board file that can set up the
  19891. -platform data for wlcore. Allow this data to be passed from DT.
  19892. -
  19893. -Since some platforms use a gpio-irq, add support for passing either the
  19894. -irq number or the gpio number. For the latter case, the driver will
  19895. -request the gpio and convert it to the irq number. If an irq is
  19896. -specified, it'll be used as is.
  19897. -
  19898. -[Arik - the pdev_data pointer does not belong to us and is freed when
  19899. -the device is released. Dereference to our private data first.]
  19900. -
  19901. -Signed-off-by: Ido Yariv <ido@wizery.com>
  19902. -Signed-off-by: Arik Nemtsov <arik@wizery.com>
  19903. ----
  19904. - drivers/net/wireless/ti/wlcore/sdio.c | 71 ++++++++++++++++++++++++++++++++---
  19905. - include/linux/wl12xx.h | 3 +-
  19906. - 2 files changed, 67 insertions(+), 7 deletions(-)
  19907. -
  19908. ---- a/drivers/net/wireless/ti/wlcore/sdio.c
  19909. -+++ b/drivers/net/wireless/ti/wlcore/sdio.c
  19910. -@@ -34,6 +34,7 @@
  19911. - #include <linux/wl12xx.h>
  19912. - #include <linux/pm_runtime.h>
  19913. - #include <linux/printk.h>
  19914. -+#include <linux/of.h>
  19915. -
  19916. - #include "wlcore.h"
  19917. - #include "wl12xx_80211.h"
  19918. -@@ -214,6 +215,61 @@ static struct wl1271_if_operations sdio_
  19919. - .set_block_size = wl1271_sdio_set_block_size,
  19920. - };
  19921. -
  19922. -+static const struct of_device_id wlcore_of_match[] = {
  19923. -+ {
  19924. -+ .compatible = "wlcore",
  19925. -+ },
  19926. -+ {}
  19927. -+};
  19928. -+MODULE_DEVICE_TABLE(of, wlcore_of_match);
  19929. -+
  19930. -+static struct wl12xx_platform_data *get_platform_data(struct device *dev)
  19931. -+{
  19932. -+ struct wl12xx_platform_data *pdata;
  19933. -+ struct device_node *np;
  19934. -+ u32 gpio;
  19935. -+
  19936. -+ pdata = wl12xx_get_platform_data();
  19937. -+ if (!IS_ERR(pdata))
  19938. -+ return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL);
  19939. -+
  19940. -+ np = of_find_matching_node(NULL, wlcore_of_match);
  19941. -+ if (!np) {
  19942. -+ dev_err(dev, "No platform data set\n");
  19943. -+ return NULL;
  19944. -+ }
  19945. -+
  19946. -+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
  19947. -+ if (!pdata) {
  19948. -+ dev_err(dev, "Can't allocate platform data\n");
  19949. -+ return NULL;
  19950. -+ }
  19951. -+
  19952. -+ if (of_property_read_u32(np, "irq", &pdata->irq)) {
  19953. -+ if (!of_property_read_u32(np, "gpio", &gpio) &&
  19954. -+ !gpio_request_one(gpio, GPIOF_IN, "wlcore_irq")) {
  19955. -+ pdata->gpio = gpio;
  19956. -+ pdata->irq = gpio_to_irq(gpio);
  19957. -+ }
  19958. -+ }
  19959. -+
  19960. -+ /* Optional fields */
  19961. -+ pdata->use_eeprom = of_property_read_bool(np, "use-eeprom");
  19962. -+ of_property_read_u32(np, "board-ref-clock", &pdata->board_ref_clock);
  19963. -+ of_property_read_u32(np, "board-tcxo-clock", &pdata->board_tcxo_clock);
  19964. -+ of_property_read_u32(np, "platform-quirks", &pdata->platform_quirks);
  19965. -+
  19966. -+ return pdata;
  19967. -+}
  19968. -+
  19969. -+static void del_platform_data(struct wl12xx_platform_data *pdata)
  19970. -+{
  19971. -+ if (pdata->gpio)
  19972. -+ gpio_free(pdata->gpio);
  19973. -+
  19974. -+ kfree(pdata);
  19975. -+}
  19976. -+
  19977. - static int wl1271_probe(struct sdio_func *func,
  19978. - const struct sdio_device_id *id)
  19979. - {
  19980. -@@ -245,10 +301,10 @@ static int wl1271_probe(struct sdio_func
  19981. - /* Use block mode for transferring over one block size of data */
  19982. - func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
  19983. -
  19984. -- pdev_data.pdata = wl12xx_get_platform_data();
  19985. -- if (IS_ERR(pdev_data.pdata)) {
  19986. -- ret = PTR_ERR(pdev_data.pdata);
  19987. -- dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
  19988. -+ pdev_data.pdata = get_platform_data(&func->dev);
  19989. -+ if (!pdev_data.pdata) {
  19990. -+ ret = -EINVAL;
  19991. -+ dev_err(glue->dev, "missing wlan platform data\n");
  19992. - goto out_free_glue;
  19993. - }
  19994. -
  19995. -@@ -279,7 +335,7 @@ static int wl1271_probe(struct sdio_func
  19996. - if (!glue->core) {
  19997. - dev_err(glue->dev, "can't allocate platform_device");
  19998. - ret = -ENOMEM;
  19999. -- goto out_free_glue;
  20000. -+ goto out_free_pdata;
  20001. - }
  20002. -
  20003. - glue->core->dev.parent = &func->dev;
  20004. -@@ -313,6 +369,9 @@ static int wl1271_probe(struct sdio_func
  20005. - out_dev_put:
  20006. - platform_device_put(glue->core);
  20007. -
  20008. -+out_free_pdata:
  20009. -+ del_platform_data(pdev_data->pdata);
  20010. -+
  20011. - out_free_glue:
  20012. - kfree(glue);
  20013. -
  20014. -@@ -323,11 +382,14 @@ out:
  20015. - static void wl1271_remove(struct sdio_func *func)
  20016. - {
  20017. - struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);
  20018. -+ struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
  20019. -+ struct wl12xx_platform_data *pdata = pdev_data->pdata;
  20020. -
  20021. - /* Undo decrement done above in wl1271_probe */
  20022. - pm_runtime_get_noresume(&func->dev);
  20023. -
  20024. - platform_device_unregister(glue->core);
  20025. -+ del_platform_data(pdata);
  20026. - kfree(glue);
  20027. - }
  20028. -
  20029. diff --git a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  20030. index 501910f..b0536ce 100644
  20031. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  20032. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  20033. @@ -210,7 +210,7 @@
  20034. case RT5592:
  20035. *txwi_size = TXWI_DESC_SIZE_5WORDS;
  20036. *rxwi_size = RXWI_DESC_SIZE_6WORDS;
  20037. -@@ -3326,6 +3399,312 @@ static void rt2800_config_channel_rf55xx
  20038. +@@ -3302,6 +3375,312 @@ static void rt2800_config_channel_rf55xx
  20039. rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F);
  20040. }
  20041. @@ -258,6 +258,7 @@
  20042. + u32 mac_sys_ctrl, mac_status;
  20043. + u32 tx_pin = 0x00150F0F;
  20044. + struct hw_mode_spec *spec = &rt2x00dev->spec;
  20045. ++ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  20046. +
  20047. + /* Frequeny plan setting */
  20048. + /*
  20049. @@ -383,7 +384,6 @@
  20050. + rfcsr &= (~0x4);
  20051. + rt2800_rfcsr_write(rt2x00dev, 28, rfcsr);
  20052. +
  20053. -+ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  20054. + /*if (bScan == FALSE)*/
  20055. + if (conf_is_ht40(conf)) {
  20056. + txrx_agc_fc = rt2x00_get_field8(drv_data->calibration_bw40,
  20057. @@ -523,7 +523,7 @@
  20058. static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev,
  20059. const unsigned int word,
  20060. const u8 value)
  20061. -@@ -3482,7 +3861,7 @@ static void rt2800_config_channel(struct
  20062. +@@ -3458,7 +3837,7 @@ static void rt2800_config_channel(struct
  20063. struct channel_info *info)
  20064. {
  20065. u32 reg;
  20066. @@ -532,7 +532,7 @@
  20067. u8 bbp, rfcsr;
  20068. info->default_power1 = rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  20069. -@@ -3536,6 +3915,9 @@ static void rt2800_config_channel(struct
  20070. +@@ -3512,6 +3891,9 @@ static void rt2800_config_channel(struct
  20071. case RF5592:
  20072. rt2800_config_channel_rf55xx(rt2x00dev, conf, rf, info);
  20073. break;
  20074. @@ -542,7 +542,7 @@
  20075. default:
  20076. rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info);
  20077. }
  20078. -@@ -3638,7 +4020,7 @@ static void rt2800_config_channel(struct
  20079. +@@ -3614,7 +3996,7 @@ static void rt2800_config_channel(struct
  20080. else if (rt2x00_rt(rt2x00dev, RT3593) ||
  20081. rt2x00_rt(rt2x00dev, RT3883))
  20082. rt2800_bbp_write(rt2x00dev, 82, 0x82);
  20083. @@ -551,7 +551,7 @@
  20084. rt2800_bbp_write(rt2x00dev, 82, 0xf2);
  20085. if (rt2x00_rt(rt2x00dev, RT3593) ||
  20086. -@@ -3660,7 +4042,7 @@ static void rt2800_config_channel(struct
  20087. +@@ -3636,7 +4018,7 @@ static void rt2800_config_channel(struct
  20088. if (rt2x00_rt(rt2x00dev, RT3572))
  20089. rt2800_rfcsr_write(rt2x00dev, 8, 0);
  20090. @@ -560,7 +560,7 @@
  20091. switch (rt2x00dev->default_ant.tx_chain_num) {
  20092. case 3:
  20093. -@@ -3709,6 +4091,7 @@ static void rt2800_config_channel(struct
  20094. +@@ -3685,6 +4067,7 @@ static void rt2800_config_channel(struct
  20095. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
  20096. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
  20097. @@ -568,7 +568,7 @@
  20098. rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
  20099. -@@ -4725,6 +5108,14 @@ void rt2800_vco_calibration(struct rt2x0
  20100. +@@ -4701,6 +5084,14 @@ void rt2800_vco_calibration(struct rt2x0
  20101. rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
  20102. rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
  20103. break;
  20104. @@ -583,7 +583,7 @@
  20105. default:
  20106. return;
  20107. }
  20108. -@@ -5125,9 +5516,42 @@ static int rt2800_init_registers(struct
  20109. +@@ -5101,9 +5492,42 @@ static int rt2800_init_registers(struct
  20110. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  20111. rt2x00_rt(rt2x00dev, RT5392) ||
  20112. rt2x00_rt(rt2x00dev, RT5592)) {
  20113. @@ -629,7 +629,7 @@
  20114. } else if (rt2x00_rt(rt2x00dev, RT5350)) {
  20115. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  20116. } else {
  20117. -@@ -6159,6 +6583,225 @@ static void rt2800_init_bbp_5592(struct
  20118. +@@ -6135,6 +6559,225 @@ static void rt2800_init_bbp_5592(struct
  20119. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  20120. }
  20121. @@ -855,7 +855,7 @@
  20122. static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
  20123. {
  20124. unsigned int i;
  20125. -@@ -6201,7 +6844,10 @@ static void rt2800_init_bbp(struct rt2x0
  20126. +@@ -6177,7 +6820,10 @@ static void rt2800_init_bbp(struct rt2x0
  20127. return;
  20128. case RT5390:
  20129. case RT5392:
  20130. @@ -867,7 +867,7 @@
  20131. break;
  20132. case RT5592:
  20133. rt2800_init_bbp_5592(rt2x00dev);
  20134. -@@ -7415,6 +8061,295 @@ static void rt2800_init_rfcsr_5592(struc
  20135. +@@ -7391,6 +8037,296 @@ static void rt2800_init_rfcsr_5592(struc
  20136. rt2800_led_open_drain_enable(rt2x00dev);
  20137. }
  20138. @@ -875,6 +875,8 @@
  20139. +{
  20140. + u16 freq;
  20141. + u8 rfvalue;
  20142. ++ struct hw_mode_spec *spec = &rt2x00dev->spec;
  20143. ++
  20144. + /* Initialize RF central register to default value */
  20145. + rt2800_rfcsr_write(rt2x00dev, 0, 0x02);
  20146. + rt2800_rfcsr_write(rt2x00dev, 1, 0x03);
  20147. @@ -921,7 +923,6 @@
  20148. + rt2800_rfcsr_write(rt2x00dev, 42, 0x5B);
  20149. + rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
  20150. +
  20151. -+ struct hw_mode_spec *spec = &rt2x00dev->spec;
  20152. + rt2800_rfcsr_write(rt2x00dev, 11, 0x21);
  20153. + if (spec->clk_is_20mhz)
  20154. + rt2800_rfcsr_write(rt2x00dev, 13, 0x03);
  20155. @@ -1163,7 +1164,7 @@
  20156. static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
  20157. {
  20158. if (rt2800_is_305x_soc(rt2x00dev)) {
  20159. -@@ -7450,7 +8385,10 @@ static void rt2800_init_rfcsr(struct rt2
  20160. +@@ -7426,7 +8362,10 @@ static void rt2800_init_rfcsr(struct rt2
  20161. rt2800_init_rfcsr_5350(rt2x00dev);
  20162. break;
  20163. case RT5390:
  20164. @@ -1175,7 +1176,7 @@
  20165. break;
  20166. case RT5392:
  20167. rt2800_init_rfcsr_5392(rt2x00dev);
  20168. -@@ -7882,6 +8820,7 @@ static int rt2800_init_eeprom(struct rt2
  20169. +@@ -7858,6 +8797,7 @@ static int rt2800_init_eeprom(struct rt2
  20170. case RF5390:
  20171. case RF5392:
  20172. case RF5592:
  20173. @@ -1183,7 +1184,7 @@
  20174. break;
  20175. default:
  20176. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  20177. -@@ -8448,6 +9387,7 @@ static int rt2800_probe_hw_mode(struct r
  20178. +@@ -8422,6 +9362,7 @@ static int rt2800_probe_hw_mode(struct r
  20179. case RF5372:
  20180. case RF5390:
  20181. case RF5392:
  20182. @@ -1191,7 +1192,7 @@
  20183. spec->num_channels = 14;
  20184. if (spec->clk_is_20mhz)
  20185. spec->channels = rf_vals_xtal20mhz_3x;
  20186. -@@ -8588,6 +9528,7 @@ static int rt2800_probe_hw_mode(struct r
  20187. +@@ -8562,6 +9503,7 @@ static int rt2800_probe_hw_mode(struct r
  20188. case RF5372:
  20189. case RF5390:
  20190. case RF5392:
  20191. diff --git a/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch b/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch
  20192. deleted file mode 100644
  20193. index 4c04d4f..0000000
  20194. --- a/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch
  20195. +++ /dev/null
  20196. @@ -1,20 +0,0 @@
  20197. ---- a/drivers/net/wireless/ath/ath10k/core.c
  20198. -+++ b/drivers/net/wireless/ath/ath10k/core.c
  20199. -@@ -387,9 +387,14 @@ static int ath10k_download_and_run_otp(s
  20200. -
  20201. - ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
  20202. -
  20203. -- if (!skip_otp && result != 0) {
  20204. -- ath10k_err(ar, "otp calibration failed: %d", result);
  20205. -- return -EINVAL;
  20206. -+ if (!skip_otp) {
  20207. -+ if (result == 2) {
  20208. -+ ath10k_warn(ar, "otp stream is empty, using board.bin contents");
  20209. -+ return 0;
  20210. -+ } else if (result != 0) {
  20211. -+ ath10k_err(ar, "otp calibration failed: %d", result);
  20212. -+ return -EINVAL;
  20213. -+ }
  20214. - }
  20215. -
  20216. - return 0;
  20217. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  20218. index eed3814..93196e1 100644
  20219. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  20220. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  20221. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  20222. --- a/drivers/net/wireless/ath/ath10k/core.c
  20223. +++ b/drivers/net/wireless/ath/ath10k/core.c
  20224. -@@ -1323,6 +1323,16 @@ int ath10k_core_register(struct ath10k *
  20225. +@@ -1520,6 +1520,16 @@ int ath10k_core_register(struct ath10k *
  20226. ar->chip_id = chip_id;
  20227. queue_work(ar->workqueue, &ar->register_work);
  20228. diff --git a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  20229. index 8003f86..34910a0 100644
  20230. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  20231. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  20232. @@ -1,6 +1,6 @@
  20233. --- a/drivers/net/wireless/ath/ath10k/mac.c
  20234. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  20235. -@@ -5416,6 +5416,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  20236. +@@ -6804,6 +6804,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  20237. return arvif_iter.arvif;
  20238. }
  20239. @@ -22,7 +22,7 @@
  20240. int ath10k_mac_register(struct ath10k *ar)
  20241. {
  20242. static const u32 cipher_suites[] = {
  20243. -@@ -5590,6 +5605,12 @@ int ath10k_mac_register(struct ath10k *a
  20244. +@@ -7025,6 +7040,12 @@ int ath10k_mac_register(struct ath10k *a
  20245. ar->hw->wiphy->cipher_suites = cipher_suites;
  20246. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  20247. diff --git a/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  20248. new file mode 100644
  20249. index 0000000..75d8212
  20250. --- /dev/null
  20251. +++ b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  20252. @@ -0,0 +1,20 @@
  20253. +--- a/drivers/net/wireless/mwl8k.c
  20254. ++++ b/drivers/net/wireless/mwl8k.c
  20255. +@@ -6261,6 +6261,8 @@ static int mwl8k_probe(struct pci_dev *p
  20256. +
  20257. + priv->running_bsses = 0;
  20258. +
  20259. ++ wait_for_completion(&priv->firmware_loading_complete);
  20260. ++
  20261. + return rc;
  20262. +
  20263. + err_stop_firmware:
  20264. +@@ -6294,8 +6296,6 @@ static void mwl8k_remove(struct pci_dev
  20265. + return;
  20266. + priv = hw->priv;
  20267. +
  20268. +- wait_for_completion(&priv->firmware_loading_complete);
  20269. +-
  20270. + if (priv->fw_state == FW_STATE_ERROR) {
  20271. + mwl8k_hw_reset(priv);
  20272. + goto unmap;