0006-mac80211-backport-from-trunk-r47249.patch 840 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Tue, 23 Dec 2014 18:57:16 +0100
  3. Subject: mac80211: backport from trunk r47249
  4. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  5. index a1eedce..566e156 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. @@ -23,15 +23,28 @@ PKG_BUILD_PARALLEL:=1
  21. PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  22. PKG_DRIVERS = \
  23. - adm8211 ath5k libertas-usb libertas-sdio p54-common p54-pci p54-usb p54-spi \
  24. - rt2x00-lib rt2x00-pci rt2x00-usb rt2800-lib rt2400-pci rt2500-pci \
  25. - rt2500-usb rt61-pci rt73-usb rt2800-mmio rt2800-pci rt2800-usb rt2800-soc \
  26. - rtl8180 rtl8187 zd1211rw mac80211-hwsim carl9170 b43 b43legacy \
  27. - ath9k-common ath9k ath9k-htc ath10k ath net-libipw net-ipw2100 net-ipw2200 \
  28. - mwl8k mwifiex-pcie net-hermes net-hermes-pci net-hermes-plx net-hermes-pcmcia \
  29. - iwl-legacy iwl3945 iwl4965 iwlagn wlcore wl12xx wl18xx lib80211 \
  30. + adm8211 \
  31. + ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  32. + b43 b43legacy \
  33. + carl9170 \
  34. + hermes hermes-pci hermes-pcmcia hermes-plx\
  35. + iwl-legacy iwl3945 iwl4965 iwlwifi \
  36. + lib80211 \
  37. + libipw ipw2100 ipw2200 \
  38. + libertas-sdio libertas-usb \
  39. + mac80211-hwsim \
  40. + mt7601u \
  41. + mwl8k mwifiex-pcie \
  42. + p54-common p54-pci p54-spi p54-usb \
  43. + rt2x00-lib rt2x00-pci rt2x00-usb \
  44. + rt2400-pci rt2500-pci rt2500-usb \
  45. + rt2800-lib rt2800-mmio rt2800-pci rt2800-soc rt2800-usb \
  46. + rt61-pci rt73-usb \
  47. + rtl8180 rtl8187 \
  48. rtlwifi rtlwifi-pci rtlwifi-usb rtl8192c-common rtl8192ce rtl8192se \
  49. - rtl8192de rtl8192cu
  50. + rtl8192de rtl8192cu \
  51. + wlcore wl12xx wl18xx \
  52. + zd1211rw
  53. PKG_CONFIG_DEPENDS:= \
  54. CONFIG_PACKAGE_kmod-mac80211 \
  55. @@ -60,7 +73,6 @@ define KernelPackage/mac80211/Default
  56. SUBMENU:=$(WMENU)
  57. URL:=https://wireless.wiki.kernel.org/
  58. MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  59. - DEPENDS:=@!TARGET_uml
  60. endef
  61. define KernelPackage/cfg80211
  62. @@ -109,8 +121,8 @@ Generic IEEE 802.11 Networking Stack (mac80211)
  63. endef
  64. PKG_LINUX_FIRMWARE_NAME:=linux-firmware
  65. -PKG_LINUX_FIRMWARE_VERSION:=f404336ba808cbd57547196e13367079a23b822c
  66. -PKG_LINUX_FIRMWARE_SOURCE:=$(PKG_LINUX_FIRMWARE_NAME)-2015-03-20-$(PKG_LINUX_FIRMWARE_VERSION).tar.bz2
  67. +PKG_LINUX_FIRMWARE_VERSION:=6ebf5d57d9f6d0cf05558baef1af2b90a3fe98ed
  68. +PKG_LINUX_FIRMWARE_SOURCE:=$(PKG_LINUX_FIRMWARE_NAME)-2015-09-03-$(PKG_LINUX_FIRMWARE_VERSION).tar.xz
  69. PKG_LINUX_FIRMWARE_PROTO:=git
  70. PKG_LINUX_FIRMWARE_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  71. PKG_LINUX_FIRMWARE_SUBDIR:=$(PKG_LINUX_FIRMWARE_NAME)-$(PKG_LINUX_FIRMWARE_VERSION)
  72. @@ -127,723 +139,769 @@ define Download/linux-firmware
  73. endef
  74. $(eval $(call Download,linux-firmware))
  75. -PKG_ATH10K_LINUX_FIRMWARE_NAME:=ath10k-firmware
  76. -PKG_ATH10K_LINUX_FIRMWARE_VERSION:=da0f85d924226ee30c46e037120621c9e192b39e
  77. -PKG_ATH10K_LINUX_FIRMWARE_SOURCE:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION).tar.bz2
  78. -PKG_ATH10K_LINUX_FIRMWARE_PROTO:=git
  79. -PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  80. -PKG_ATH10K_LINUX_FIRMWARE_SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  81. -#PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM:=?
  82. -define Download/ath10k-firmware
  83. - FILE:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  84. - URL:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL)
  85. - PROTO:=$(PKG_ATH10K_LINUX_FIRMWARE_PROTO)
  86. - VERSION:=$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  87. - SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)
  88. - #MIRROR_MD5SUM:=$(PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM)
  89. +define KernelPackage/adm8211
  90. + $(call KernelPackage/mac80211/Default)
  91. + TITLE:=ADMTek 8211 support
  92. + DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  93. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/adm8211.ko
  94. + AUTOLOAD:=$(call AutoProbe,adm8211)
  95. endef
  96. -$(eval $(call Download,ath10k-firmware))
  97. -# Prism54 drivers
  98. -P54PCIFW:=2.13.12.0.arm
  99. -P54USBFW:=2.13.24.0.lm87.arm
  100. -P54SPIFW:=2.13.0.0.a.13.14.arm
  101. +define KernelPackage/ath/config
  102. + if PACKAGE_kmod-ath
  103. + config ATH_USER_REGD
  104. + bool "Force Atheros drivers to respect the user's regdomain settings"
  105. + help
  106. + Atheros' idea of regulatory handling is that the EEPROM of the card defines
  107. + the regulatory limits and the user is only allowed to restrict the settings
  108. + even further, even if the country allows frequencies or power levels that
  109. + are forbidden by the EEPROM settings.
  110. -define Download/p54usb
  111. - FILE:=$(P54USBFW)
  112. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  113. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  114. -endef
  115. -$(eval $(call Download,p54usb))
  116. + Select this option if you want the driver to respect the user's decision about
  117. + regulatory settings.
  118. -define Download/p54pci
  119. - FILE:=$(P54PCIFW)
  120. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  121. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  122. -endef
  123. -$(eval $(call Download,p54pci))
  124. + config PACKAGE_ATH_DEBUG
  125. + bool "Atheros wireless debugging"
  126. + help
  127. + Say Y, if you want to debug atheros wireless drivers.
  128. + Only ath9k & ath10k make use of this.
  129. -define Download/p54spi
  130. - FILE:=$(P54SPIFW)
  131. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  132. - MD5SUM:=42661f8ecbadd88012807493f596081d
  133. -endef
  134. -$(eval $(call Download,p54spi))
  135. + config PACKAGE_ATH_DFS
  136. + bool "Enable DFS support"
  137. + default y
  138. + help
  139. + Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  140. + channels in Europe, US, and Japan.
  141. -define KernelPackage/p54/Default
  142. - $(call KernelPackage/mac80211/Default)
  143. - TITLE:=Prism54 Drivers
  144. -endef
  145. + Select this option if you want to use such channels.
  146. -define KernelPackage/p54/description
  147. - Kernel module for Prism54 chipsets (mac80211)
  148. + endif
  149. endef
  150. -define KernelPackage/p54-common
  151. - $(call KernelPackage/p54/Default)
  152. - DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt
  153. - TITLE+= (COMMON)
  154. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54common.ko
  155. +define KernelPackage/ath
  156. + $(call KernelPackage/mac80211/Default)
  157. + TITLE:=Atheros common driver part
  158. + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  159. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  160. + MENU:=1
  161. endef
  162. -define KernelPackage/p54-pci
  163. - $(call KernelPackage/p54/Default)
  164. - TITLE+= (PCI)
  165. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  166. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54pci.ko
  167. - AUTOLOAD:=$(call AutoProbe,p54pci)
  168. +define KernelPackage/ath/description
  169. + This module contains some common parts needed by Atheros Wireless drivers.
  170. endef
  171. -define KernelPackage/p54-usb
  172. - $(call KernelPackage/p54/Default)
  173. - TITLE+= (USB)
  174. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  175. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54usb.ko
  176. - AUTOLOAD:=$(call AutoProbe,p54usb)
  177. +define KernelPackage/ath5k
  178. + $(call KernelPackage/mac80211/Default)
  179. + TITLE:=Atheros 5xxx wireless cards support
  180. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  181. + DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  182. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  183. + AUTOLOAD:=$(call AutoProbe,ath5k)
  184. endef
  185. -define KernelPackage/p54-spi
  186. - $(call KernelPackage/p54/Default)
  187. - TITLE+= (SPI)
  188. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  189. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54spi.ko
  190. - AUTOLOAD:=$(call AutoProbe,p54spi)
  191. +define KernelPackage/ath5k/description
  192. + This module adds support for wireless adapters based on
  193. + Atheros 5xxx chipset.
  194. endef
  195. -define KernelPackage/rt2x00/Default
  196. +define KernelPackage/ath9k-common
  197. $(call KernelPackage/mac80211/Default)
  198. - TITLE:=Ralink Drivers for RT2x00 cards
  199. + TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  200. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  201. + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  202. + FILES:= \
  203. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  204. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  205. endef
  206. -define KernelPackage/rt2x00-lib
  207. -$(call KernelPackage/rt2x00/Default)
  208. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t
  209. - TITLE+= (LIB)
  210. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00lib.ko
  211. - MENU:=1
  212. +define KernelPackage/ath9k
  213. + $(call KernelPackage/mac80211/Default)
  214. + TITLE:=Atheros 802.11n PCI wireless cards support
  215. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  216. + DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  217. + FILES:= \
  218. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  219. + AUTOLOAD:=$(call AutoProbe,ath9k)
  220. endef
  221. -define KernelPackage/rt2x00-lib/config
  222. - if PACKAGE_kmod-rt2x00-lib
  223. -
  224. - config PACKAGE_RT2X00_LIB_DEBUGFS
  225. - bool "Enable rt2x00 debugfs support"
  226. - depends on PACKAGE_MAC80211_DEBUGFS
  227. - help
  228. - Enable creation of debugfs files for the rt2x00 drivers.
  229. - These debugfs files support both reading and writing of the
  230. - most important register types of the rt2x00 hardware.
  231. -
  232. - config PACKAGE_RT2X00_DEBUG
  233. - bool "Enable rt2x00 debug output"
  234. - help
  235. - Enable debugging output for all rt2x00 modules
  236. -
  237. - endif
  238. +define KernelPackage/ath9k/description
  239. +This module adds support for wireless adapters based on
  240. +Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  241. endef
  242. -define KernelPackage/rt2x00-mmio
  243. -$(call KernelPackage/rt2x00/Default)
  244. - DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
  245. - HIDDEN:=1
  246. - TITLE+= (MMIO)
  247. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00mmio.ko
  248. -endef
  249. +define KernelPackage/ath9k/config
  250. -define KernelPackage/rt2x00-pci
  251. -$(call KernelPackage/rt2x00/Default)
  252. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib
  253. - HIDDEN:=1
  254. - TITLE+= (PCI)
  255. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00pci.ko
  256. - AUTOLOAD:=$(call AutoProbe,rt2x00pci)
  257. -endef
  258. + config ATH9K_SUPPORT_PCOEM
  259. + bool "Support chips used in PC OEM cards"
  260. + depends on PACKAGE_kmod-ath9k
  261. -define KernelPackage/rt2x00-usb
  262. -$(call KernelPackage/rt2x00/Default)
  263. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
  264. - HIDDEN:=1
  265. - TITLE+= (USB)
  266. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00usb.ko
  267. - AUTOLOAD:=$(call AutoProbe,rt2x00usb)
  268. endef
  269. -define KernelPackage/rt2800-lib
  270. -$(call KernelPackage/rt2x00/Default)
  271. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
  272. - HIDDEN:=1
  273. - TITLE+= (rt2800 LIB)
  274. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800lib.ko
  275. +define KernelPackage/ath9k-htc
  276. + $(call KernelPackage/mac80211/Default)
  277. + TITLE:=Atheros 802.11n USB device support
  278. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  279. + DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core
  280. + FILES:= \
  281. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  282. + AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  283. endef
  284. -define KernelPackage/rt2400-pci
  285. -$(call KernelPackage/rt2x00/Default)
  286. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  287. - TITLE+= (RT2400 PCI)
  288. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2400pci.ko
  289. - AUTOLOAD:=$(call AutoProbe,rt2400pci)
  290. +define KernelPackage/ath9k-htc/description
  291. +This module adds support for wireless adapters based on
  292. +Atheros USB AR9271 and AR7010 family of chipsets.
  293. endef
  294. -define KernelPackage/rt2500-pci
  295. -$(call KernelPackage/rt2x00/Default)
  296. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  297. - TITLE+= (RT2500 PCI)
  298. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500pci.ko
  299. - AUTOLOAD:=$(call AutoProbe,rt2500pci)
  300. +define KernelPackage/ath10k
  301. + $(call KernelPackage/mac80211/Default)
  302. + TITLE:=Atheros 802.11ac wireless cards support
  303. + URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  304. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT
  305. + FILES:= \
  306. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  307. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  308. + AUTOLOAD:=$(call AutoLoad,55,ath10k_core ath10k_pci)
  309. endef
  310. -define KernelPackage/rt2500-usb
  311. -$(call KernelPackage/rt2x00/Default)
  312. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  313. - TITLE+= (RT2500 USB)
  314. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500usb.ko
  315. - AUTOLOAD:=$(call AutoProbe,rt2500usb)
  316. +define KernelPackage/ath10k/description
  317. +This module adds support for wireless adapters based on
  318. +Atheros IEEE 802.11ac family of chipsets. For now only
  319. +PCI is supported.
  320. endef
  321. -define KernelPackage/rt61-pci
  322. -$(call KernelPackage/rt2x00/Default)
  323. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  324. - TITLE+= (RT2x61 PCI)
  325. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt61pci.ko
  326. - AUTOLOAD:=$(call AutoProbe,rt61pci)
  327. -endef
  328. +PKG_ATH10K_LINUX_FIRMWARE_NAME:=ath10k-firmware
  329. +PKG_ATH10K_LINUX_FIRMWARE_VERSION:=b46f3e01a6c1f9150fb4612ef53611d714565842
  330. +PKG_ATH10K_LINUX_FIRMWARE_SOURCE:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION).tar.bz2
  331. +PKG_ATH10K_LINUX_FIRMWARE_PROTO:=git
  332. +PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  333. +PKG_ATH10K_LINUX_FIRMWARE_SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  334. +#PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM:=?
  335. -define KernelPackage/rt73-usb
  336. - $(call KernelPackage/rt2x00/Default)
  337. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  338. - TITLE+= (RT73 USB)
  339. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt73usb.ko
  340. - AUTOLOAD:=$(call AutoProbe,rt73usb)
  341. +define Download/ath10k-firmware
  342. + FILE:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  343. + URL:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL)
  344. + PROTO:=$(PKG_ATH10K_LINUX_FIRMWARE_PROTO)
  345. + VERSION:=$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  346. + SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)
  347. + #MIRROR_MD5SUM:=$(PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM)
  348. endef
  349. +$(eval $(call Download,ath10k-firmware))
  350. -define KernelPackage/rt2800-mmio
  351. -$(call KernelPackage/rt2x00/Default)
  352. - TITLE += (RT28xx/RT3xxx MMIO)
  353. - DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
  354. - HIDDEN:=1
  355. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800mmio.ko
  356. -endef
  357. -define KernelPackage/rt2800-soc
  358. -$(call KernelPackage/rt2x00/Default)
  359. - DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
  360. - TITLE += (RT28xx/RT3xxx SoC)
  361. - FILES := \
  362. - $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko \
  363. - $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800soc.ko
  364. - AUTOLOAD:=$(call AutoProbe,rt2800soc)
  365. -endef
  366. +#Broadcom firmware
  367. +ifneq ($(CONFIG_B43_FW_6_30),)
  368. + PKG_B43_FWV4_NAME:=broadcom-wl
  369. + PKG_B43_FWV4_VERSION:=6.30.163.46
  370. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o
  371. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  372. + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  373. + PKG_B43_FWV4_MD5SUM:=6fe97e9368d25342a1ab943d3cf3496d
  374. +else
  375. +ifneq ($(CONFIG_B43_FW_5_10),)
  376. + PKG_B43_FWV4_NAME:=broadcom-wl
  377. + PKG_B43_FWV4_VERSION:=5.10.56.27.3
  378. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o
  379. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2
  380. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  381. + PKG_B43_FWV4_MD5SUM:=3363e3a6b3d9d73c49dea870c7834eac
  382. +else
  383. +ifneq ($(CONFIG_B43_FW_4_178),)
  384. + PKG_B43_FWV4_NAME:=broadcom-wl
  385. + PKG_B43_FWV4_VERSION:=4.178.10.4
  386. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  387. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  388. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  389. + PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
  390. +else
  391. +ifneq ($(CONFIG_B43_FW_5_100_138),)
  392. + PKG_B43_FWV4_NAME:=broadcom-wl
  393. + PKG_B43_FWV4_VERSION:=5.100.138
  394. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  395. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  396. + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  397. + PKG_B43_FWV4_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  398. +else
  399. + PKG_B43_FWV4_NAME:=broadcom-wl
  400. + PKG_B43_FWV4_VERSION:=4.150.10.5
  401. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
  402. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  403. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  404. + PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
  405. +endif
  406. +endif
  407. +endif
  408. +endif
  409. +ifneq ($(CONFIG_B43_OPENFIRMWARE),)
  410. + PKG_B43_FWV4_NAME:=broadcom-wl
  411. + PKG_B43_FWV4_VERSION:=5.2
  412. + PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
  413. + PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
  414. + PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
  415. + PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
  416. +endif
  417. -define KernelPackage/rt2800-pci
  418. -$(call KernelPackage/rt2x00/Default)
  419. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio
  420. - TITLE+= (RT2860 PCI)
  421. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.ko
  422. - AUTOLOAD:=$(call AutoProbe,rt2800pci)
  423. +
  424. +PKG_B43_FWV3_NAME:=wl_apsta
  425. +PKG_B43_FWV3_VERSION:=3.130.20.0
  426. +PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o
  427. +PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/
  428. +PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
  429. +
  430. +define Download/b43
  431. + FILE:=$(PKG_B43_FWV4_SOURCE)
  432. + URL:=$(PKG_B43_FWV4_SOURCE_URL)
  433. + MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
  434. endef
  435. +$(eval $(call Download,b43))
  436. -define KernelPackage/rt2800-usb
  437. -$(call KernelPackage/rt2x00/Default)
  438. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt
  439. - TITLE+= (RT2870 USB)
  440. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800usb.ko
  441. - AUTOLOAD:=$(call AutoProbe,rt2800usb)
  442. +define Download/b43legacy
  443. + FILE:=$(PKG_B43_FWV3_SOURCE)
  444. + URL:=$(PKG_B43_FWV3_SOURCE_URL)
  445. + MD5SUM:=$(PKG_B43_FWV3_MD5SUM)
  446. endef
  447. +$(eval $(call Download,b43legacy))
  448. -define KernelPackage/rtl818x/Default
  449. +
  450. +define KernelPackage/b43
  451. $(call KernelPackage/mac80211/Default)
  452. - TITLE:=Realtek Drivers for RTL818x devices
  453. - URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
  454. - DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
  455. + TITLE:=Broadcom 43xx wireless support
  456. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  457. + KCONFIG:= \
  458. + CONFIG_HW_RANDOM=y
  459. + # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb
  460. + DEPENDS += \
  461. + @PCI_SUPPORT +kmod-mac80211 \
  462. + $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \
  463. + $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma)
  464. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43/b43.ko
  465. + AUTOLOAD:=$(call AutoProbe,b43)
  466. + MENU:=1
  467. endef
  468. -define KernelPackage/rtl8180
  469. - $(call KernelPackage/rtl818x/Default)
  470. - DEPENDS+= @PCI_SUPPORT
  471. - TITLE+= (RTL8180 PCI)
  472. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8180/rtl818x_pci.ko
  473. - AUTOLOAD:=$(call AutoProbe,rtl818x_pci)
  474. -endef
  475. +define KernelPackage/b43/config
  476. -define KernelPackage/rtl8187
  477. -$(call KernelPackage/rtl818x/Default)
  478. - DEPENDS+= @USB_SUPPORT +kmod-usb-core
  479. - TITLE+= (RTL8187 USB)
  480. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
  481. - AUTOLOAD:=$(call AutoProbe,rtl8187)
  482. -endef
  483. +config PACKAGE_B43_USE_SSB
  484. + select PACKAGE_kmod-ssb
  485. + tristate
  486. + depends on !TARGET_brcm47xx && !TARGET_brcm63xx
  487. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  488. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB
  489. -define KernelPackage/rtlwifi/config
  490. - config PACKAGE_RTLWIFI_DEBUG
  491. - bool "Realtek wireless debugging"
  492. - depends on PACKAGE_kmod-rtlwifi
  493. +config PACKAGE_B43_USE_BCMA
  494. + select PACKAGE_kmod-bcma
  495. + tristate
  496. + depends on !TARGET_brcm47xx && !TARGET_bcm53xx
  497. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  498. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA
  499. +
  500. + if PACKAGE_kmod-b43
  501. +
  502. + choice
  503. + prompt "b43 firmware version"
  504. + default B43_FW_5_100_138
  505. help
  506. - Say Y, if you want to debug realtek wireless drivers.
  507. + This option allows you to select the version of the b43 firmware.
  508. -endef
  509. + config B43_FW_4_150
  510. + bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)"
  511. + help
  512. + Old stable firmware for BCM43xx devices.
  513. -define KernelPackage/rtlwifi
  514. - $(call KernelPackage/mac80211/Default)
  515. - TITLE:=Realtek common driver part
  516. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT
  517. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtlwifi.ko
  518. - HIDDEN:=1
  519. -endef
  520. + If unsure, select this.
  521. -define KernelPackage/rtlwifi-pci
  522. - $(call KernelPackage/mac80211/Default)
  523. - TITLE:=Realtek common driver part (PCI support)
  524. - DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi
  525. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_pci.ko
  526. - AUTOLOAD:=$(call AutoProbe,rtl_pci)
  527. - HIDDEN:=1
  528. -endef
  529. + config B43_FW_4_178
  530. + bool "Firmware 478.104 from driver 4.178.10.4"
  531. + help
  532. + Older firmware for BCM43xx devices.
  533. -define KernelPackage/rtlwifi-usb
  534. - $(call KernelPackage/mac80211/Default)
  535. - TITLE:=Realtek common driver part (USB support)
  536. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi
  537. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_usb.ko
  538. - AUTOLOAD:=$(call AutoProbe,rtl_usb)
  539. - HIDDEN:=1
  540. -endef
  541. + If unsure, select the "stable" firmware.
  542. -define KernelPackage/rtl8192c-common
  543. - $(call KernelPackage/mac80211/Default)
  544. - TITLE:=Realtek RTL8192CE/RTL8192CU common support module
  545. - DEPENDS+= +kmod-rtlwifi
  546. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
  547. - HIDDEN:=1
  548. -endef
  549. + config B43_FW_5_10
  550. + bool "Firmware 508.1084 from driver 5.10.56.27"
  551. + help
  552. + Older firmware for BCM43xx devices.
  553. -define KernelPackage/rtl8192ce
  554. - $(call KernelPackage/mac80211/Default)
  555. - TITLE:=Realtek RTL8192CE/RTL8188CE support
  556. - DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common
  557. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko
  558. - AUTOLOAD:=$(call AutoProbe,rtl8192ce)
  559. -endef
  560. + If unsure, select the "stable" firmware.
  561. -define KernelPackage/rtl8192ce/install
  562. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  563. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfw.bin $(1)/lib/firmware/rtlwifi
  564. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU.bin $(1)/lib/firmware/rtlwifi
  565. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU_B.bin $(1)/lib/firmware/rtlwifi
  566. -endef
  567. + config B43_FW_5_100_138
  568. + bool "Firmware 666.2 from driver 5.100.138 (stable)"
  569. + help
  570. + The currently default firmware for BCM43xx devices.
  571. -define KernelPackage/rtl8192se
  572. - $(call KernelPackage/mac80211/Default)
  573. - TITLE:=Realtek RTL8192SE/RTL8191SE support
  574. - DEPENDS+= +kmod-rtlwifi-pci
  575. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192se/rtl8192se.ko
  576. - AUTOLOAD:=$(call AutoProbe,rtl8192se)
  577. -endef
  578. + This firmware currently gets most of the testing and is needed for some N-PHY devices.
  579. -define KernelPackage/rtl8192se/install
  580. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  581. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  582. -endef
  583. + If unsure, select the this firmware.
  584. -define KernelPackage/rtl8192de
  585. - $(call KernelPackage/mac80211/Default)
  586. - TITLE:=Realtek RTL8192DE/RTL8188DE support
  587. - DEPENDS+= +kmod-rtlwifi-pci
  588. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192de/rtl8192de.ko
  589. - AUTOLOAD:=$(call AutoProbe,rtl8192de)
  590. -endef
  591. + config B43_FW_6_30
  592. + bool "Firmware 784.2 from driver 6.30.163.46 (experimental)"
  593. + help
  594. + Newer experimental firmware for BCM43xx devices.
  595. -define KernelPackage/rtl8192de/install
  596. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  597. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192defw.bin $(1)/lib/firmware/rtlwifi
  598. -endef
  599. + This firmware is mostly untested.
  600. -define KernelPackage/rtl8192cu
  601. - $(call KernelPackage/mac80211/Default)
  602. - TITLE:=Realtek RTL8192CU/RTL8188CU support
  603. - DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common
  604. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko
  605. - AUTOLOAD:=$(call AutoProbe,rtl8192cu)
  606. -endef
  607. + If unsure, select the "stable" firmware.
  608. -define KernelPackage/rtl8192cu/install
  609. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  610. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw.bin $(1)/lib/firmware/rtlwifi
  611. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_A.bin $(1)/lib/firmware/rtlwifi
  612. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_B.bin $(1)/lib/firmware/rtlwifi
  613. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_TMSC.bin $(1)/lib/firmware/rtlwifi
  614. -endef
  615. + config B43_OPENFIRMWARE
  616. + bool "Open FirmWare for WiFi networks"
  617. + help
  618. + Opensource firmware for BCM43xx devices.
  619. -ZD1211FW_NAME:=zd1211-firmware
  620. -ZD1211FW_VERSION:=1.4
  621. -define Download/zd1211rw
  622. - FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  623. - URL:=@SF/zd1211/
  624. - MD5SUM:=19f28781d76569af8551c9d11294c870
  625. -endef
  626. -$(eval $(call Download,zd1211rw))
  627. + Do _not_ select this, unless you know what you are doing.
  628. + The Opensource firmware is not suitable for embedded devices, yet.
  629. + It does not support QoS, which is bad for AccessPoints.
  630. + It does not support hardware crypto acceleration, which is a showstopper
  631. + for embedded devices with low CPU resources.
  632. -define KernelPackage/zd1211rw
  633. - $(call KernelPackage/mac80211/Default)
  634. - TITLE:=Zydas ZD1211 support
  635. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  636. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zd1211rw/zd1211rw.ko
  637. - AUTOLOAD:=$(call AutoProbe,zd1211rw)
  638. -endef
  639. + If unsure, select the "stable" firmware.
  640. -define KernelPackage/adm8211
  641. - $(call KernelPackage/mac80211/Default)
  642. - TITLE:=ADMTek 8211 support
  643. - DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  644. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/adm8211.ko
  645. - AUTOLOAD:=$(call AutoProbe,adm8211)
  646. -endef
  647. + endchoice
  648. +
  649. + config B43_FW_SQUASH
  650. + bool "Remove unnecessary firmware files"
  651. + depends on !B43_OPENFIRMWARE
  652. + default y
  653. + help
  654. + This options allows you to remove unnecessary b43 firmware files
  655. + from the final rootfs image. This can reduce the rootfs size by
  656. + up to 200k.
  657. +
  658. + If unsure, say Y.
  659. +
  660. + config B43_FW_SQUASH_COREREVS
  661. + string "Core revisions to include"
  662. + depends on B43_FW_SQUASH
  663. + default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy
  664. + default "16,28,29,30" if TARGET_brcm47xx_mips74k
  665. + default "5,6,7,8,9,10,11,13,15,16,28,29,30"
  666. + help
  667. + This is a comma seperated list of core revision numbers.
  668. +
  669. + Example (keep files for rev5 only):
  670. + 5
  671. +
  672. + Example (keep files for rev5 and rev11):
  673. + 5,11
  674. +
  675. + config B43_FW_SQUASH_PHYTYPES
  676. + string "PHY types to include"
  677. + depends on B43_FW_SQUASH
  678. + default "G,N,LP" if TARGET_brcm47xx_legacy
  679. + default "N,HT" if TARGET_brcm47xx_mips74k
  680. + default "G,N,LP,HT"
  681. + help
  682. + This is a comma seperated list of PHY types:
  683. + A => A-PHY
  684. + AG => Dual A-PHY G-PHY
  685. + G => G-PHY
  686. + LP => LP-PHY
  687. + N => N-PHY
  688. + HT => HT-PHY
  689. + LCN => LCN-PHY
  690. + LCN40 => LCN40-PHY
  691. + AC => AC-PHY
  692. +
  693. + Example (keep files for G-PHY only):
  694. + G
  695. +
  696. + Example (keep files for G-PHY and N-PHY):
  697. + G,N
  698. +
  699. + choice
  700. + prompt "Supported buses"
  701. + default PACKAGE_B43_BUSES_BCMA_AND_SSB
  702. + help
  703. + This allows choosing buses that b43 should support.
  704. +
  705. + config PACKAGE_B43_BUSES_BCMA_AND_SSB
  706. + depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  707. + bool "BCMA and SSB"
  708. +
  709. + config PACKAGE_B43_BUSES_BCMA
  710. + depends on !TARGET_brcm47xx_legacy
  711. + bool "BCMA only"
  712. +
  713. + config PACKAGE_B43_BUSES_SSB
  714. + depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  715. + bool "SSB only"
  716. +
  717. + endchoice
  718. +
  719. + config PACKAGE_B43_DEBUG
  720. + bool "Enable debug output and debugfs for b43"
  721. + default n
  722. + help
  723. + Enable additional debug output and runtime sanity checks for b43
  724. + and enables the debugfs interface.
  725. +
  726. + If unsure, say N.
  727. +
  728. + config PACKAGE_B43_PIO
  729. + bool "Enable support for PIO transfer mode"
  730. + default n
  731. + help
  732. + Enable support for using PIO instead of DMA. Unless you have DMA
  733. + transfer problems you don't need this.
  734. +
  735. + If unsure, say N.
  736. +
  737. + config PACKAGE_B43_PHY_G
  738. + bool "Enable support for G-PHYs"
  739. + default n if TARGET_brcm47xx_mips74k
  740. + default y
  741. + help
  742. + Enable support for G-PHY. This includes support for the following devices:
  743. + PCI: BCM4306, BCM4311, BCM4318
  744. + SoC: BCM5352E, BCM4712
  745. -define KernelPackage/ath/config
  746. - if PACKAGE_kmod-ath
  747. - config ATH_USER_REGD
  748. - bool "Force Atheros drivers to respect the user's regdomain settings"
  749. + If unsure, say Y.
  750. +
  751. + config PACKAGE_B43_PHY_N
  752. + bool "Enable support for N-PHYs"
  753. + default y
  754. help
  755. - Atheros' idea of regulatory handling is that the EEPROM of the card defines
  756. - the regulatory limits and the user is only allowed to restrict the settings
  757. - even further, even if the country allows frequencies or power levels that
  758. - are forbidden by the EEPROM settings.
  759. + Enable support for N-PHY. This includes support for the following devices:
  760. + PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225
  761. + SoC: BCM4716, BCM4717, BCM4718
  762. - Select this option if you want the driver to respect the user's decision about
  763. - regulatory settings.
  764. + Currently only 11g speed is available.
  765. - config PACKAGE_ATH_DEBUG
  766. - bool "Atheros wireless debugging"
  767. + If unsure, say Y.
  768. +
  769. + config PACKAGE_B43_PHY_LP
  770. + bool "Enable support for LP-PHYs"
  771. + default n if TARGET_brcm47xx_mips74k
  772. + default y
  773. help
  774. - Say Y, if you want to debug atheros wireless drivers.
  775. - Right now only ath9k makes use of this.
  776. + Enable support for LP-PHY. This includes support for the following devices:
  777. + PCI: BCM4312
  778. + SoC: BCM5354
  779. - config PACKAGE_ATH_DFS
  780. - bool "Enable DFS support"
  781. + If unsure, say Y.
  782. +
  783. + config PACKAGE_B43_PHY_HT
  784. + bool "Enable support for HT-PHYs"
  785. + default n if TARGET_brcm47xx_legacy
  786. default y
  787. help
  788. - Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  789. - channels in Europe, US, and Japan.
  790. + Enable support for HT-PHY. This includes support for the following devices:
  791. + PCI: BCM4331
  792. - Select this option if you want to use such channels.
  793. + Currently only 11g speed is available.
  794. - endif
  795. -endef
  796. + If unsure, say Y.
  797. -define KernelPackage/ath
  798. - $(call KernelPackage/mac80211/Default)
  799. - TITLE:=Atheros common driver part
  800. - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  801. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  802. - MENU:=1
  803. -endef
  804. + config PACKAGE_B43_PHY_LCN
  805. + bool "Enable support for LCN-PHYs"
  806. + depends on BROKEN
  807. + default n
  808. + help
  809. + Currently broken.
  810. -define KernelPackage/ath/description
  811. - This module contains some common parts needed by Atheros Wireless drivers.
  812. -endef
  813. + If unsure, say N.
  814. -define KernelPackage/ath5k
  815. - $(call KernelPackage/mac80211/Default)
  816. - TITLE:=Atheros 5xxx wireless cards support
  817. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  818. - DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  819. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  820. - AUTOLOAD:=$(call AutoProbe,ath5k)
  821. + endif
  822. endef
  823. -define KernelPackage/ath5k/description
  824. - This module adds support for wireless adapters based on
  825. - Atheros 5xxx chipset.
  826. +define KernelPackage/b43/description
  827. +Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
  828. endef
  829. -define KernelPackage/ath9k-common
  830. +define KernelPackage/b43legacy
  831. $(call KernelPackage/mac80211/Default)
  832. - TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  833. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  834. - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@KERNEL_RELAY
  835. - FILES:= \
  836. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  837. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  838. + TITLE:=Broadcom 43xx-legacy wireless support
  839. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  840. + KCONFIG:= \
  841. + CONFIG_HW_RANDOM=y
  842. + DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb
  843. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43legacy/b43legacy.ko
  844. + AUTOLOAD:=$(call AutoProbe,b43legacy)
  845. + MENU:=1
  846. endef
  847. -define KernelPackage/ath9k
  848. - $(call KernelPackage/mac80211/Default)
  849. - TITLE:=Atheros 802.11n PCI wireless cards support
  850. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  851. - DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  852. - FILES:= \
  853. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  854. - AUTOLOAD:=$(call AutoProbe,ath9k)
  855. -endef
  856. +define KernelPackage/b43legacy/config
  857. + if PACKAGE_kmod-b43legacy
  858. -define KernelPackage/ath9k/description
  859. -This module adds support for wireless adapters based on
  860. -Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  861. -endef
  862. + config B43LEGACY_FW_SQUASH
  863. + bool "Remove unnecessary firmware files"
  864. + default y
  865. + help
  866. + This options allows you to remove unnecessary b43legacy firmware files
  867. + from the final rootfs image. This can reduce the rootfs size by
  868. + up to 50k.
  869. -define KernelPackage/ath9k/config
  870. + If unsure, say Y.
  871. - config ATH9K_SUPPORT_PCOEM
  872. - bool "Support chips used in PC OEM cards"
  873. - depends on PACKAGE_kmod-ath9k
  874. -
  875. -endef
  876. + config B43LEGACY_FW_SQUASH_COREREVS
  877. + string "Core revisions to include"
  878. + depends on B43LEGACY_FW_SQUASH
  879. + default "1,2,3,4"
  880. + help
  881. + This is a comma seperated list of core revision numbers.
  882. -define KernelPackage/ath9k-htc
  883. - $(call KernelPackage/mac80211/Default)
  884. - TITLE:=Atheros 802.11n USB device support
  885. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  886. - DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core
  887. - FILES:= \
  888. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  889. - AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  890. + Example (keep files for rev4 only):
  891. + 4
  892. +
  893. + Example (keep files for rev2 and rev4):
  894. + 2,4
  895. +
  896. + endif
  897. endef
  898. -define KernelPackage/ath9k-htc/description
  899. -This module adds support for wireless adapters based on
  900. -Atheros USB AR9271 and AR7010 family of chipsets.
  901. +define KernelPackage/b43legacy/description
  902. +Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
  903. endef
  904. -define KernelPackage/ath10k
  905. +
  906. +define KernelPackage/brcmutil
  907. $(call KernelPackage/mac80211/Default)
  908. - TITLE:=Atheros 802.11ac wireless cards support
  909. - URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  910. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT
  911. - FILES:= \
  912. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  913. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  914. - AUTOLOAD:=$(call AutoLoad,55,ath10k_core ath10k_pci)
  915. + TITLE:=Broadcom IEEE802.11n common driver parts
  916. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  917. + DEPENDS+=@PCI_SUPPORT||USB_SUPPORT
  918. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmutil/brcmutil.ko
  919. + AUTOLOAD:=$(call AutoProbe,brcmutil)
  920. + MENU:=1
  921. endef
  922. -define KernelPackage/ath10k/description
  923. -This module adds support for wireless adapters based on
  924. -Atheros IEEE 802.11ac family of chipsets. For now only
  925. -PCI is supported.
  926. +define KernelPackage/brcmutil/description
  927. + This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac.
  928. endef
  929. -define KernelPackage/ath10k/config
  930. - if PACKAGE_kmod-ath10k
  931. -
  932. - config ATH10K_STA_FW
  933. - bool "Firmware optimized for STA operation"
  934. - default n
  935. - help
  936. - Use the ath10k firmware optimized for wireless client instead
  937. - of access point operation.
  938. +define KernelPackage/brcmutil/config
  939. + if PACKAGE_kmod-brcmutil
  940. - config ATH10K_API2_FW
  941. - bool "Firmware optimized for AP operation (v10.1 / API v2)"
  942. - default n
  943. - depends on !ATH10K_STA_FW
  944. + config PACKAGE_BRCM80211_DEBUG
  945. + bool "Broadcom wireless driver debugging"
  946. help
  947. - Use the ath10k firmware from the 10.1 SDK using API v2 optimized
  948. - for access point operation if the default firmware keeps crashing.
  949. + Say Y, if you want to debug brcmsmac and brcmfmac wireless driver.
  950. endif
  951. endef
  952. -define KernelPackage/carl9170
  953. - $(call KernelPackage/mac80211/Default)
  954. - TITLE:=Driver for Atheros AR9170 USB sticks
  955. - DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT
  956. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
  957. - AUTOLOAD:=$(call AutoProbe,carl9170)
  958. +PKG_BRCMSMAC_FW_NAME:=broadcom-wl
  959. +PKG_BRCMSMAC_FW_VERSION:=5.100.138
  960. +PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o
  961. +PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2
  962. +PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  963. +PKG_BRCMSMAC_FW_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  964. +
  965. +define Download/brcmsmac
  966. + FILE:=$(PKG_BRCMSMAC_FW_SOURCE)
  967. + URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL)
  968. + MD5SUM:=$(PKG_BRCMSMAC_FW_MD5SUM)
  969. endef
  970. +$(eval $(call Download,brcmsmac))
  971. -define KernelPackage/lib80211
  972. +define KernelPackage/brcmsmac
  973. $(call KernelPackage/mac80211/Default)
  974. - TITLE:=802.11 Networking stack
  975. - DEPENDS:=+kmod-cfg80211
  976. - FILES:= \
  977. - $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  978. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  979. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  980. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  981. - AUTOLOAD:=$(call AutoProbe, \
  982. - lib80211 \
  983. - lib80211_crypt_wep \
  984. - lib80211_crypt_ccmp \
  985. - lib80211_crypt_tkip \
  986. - )
  987. + TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
  988. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  989. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil
  990. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmsmac/brcmsmac.ko
  991. + AUTOLOAD:=$(call AutoProbe,brcmsmac)
  992. + MENU:=1
  993. endef
  994. -define KernelPackage/lib80211/description
  995. - Kernel modules for 802.11 Networking stack
  996. - Includes:
  997. - - lib80211
  998. - - lib80211_crypt_wep
  999. - - lib80211_crypt_tkip
  1000. - - lib80211_crytp_ccmp
  1001. +define KernelPackage/brcmsmac/description
  1002. + Kernel module for Broadcom IEEE802.11n PCIe Wireless cards
  1003. endef
  1004. -define KernelPackage/libertas-usb
  1005. - $(call KernelPackage/mac80211/Default)
  1006. - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT
  1007. - TITLE:=Marvell 88W8015 Wireless Driver
  1008. - FILES:= \
  1009. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1010. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/usb8xxx.ko
  1011. - AUTOLOAD:=$(call AutoProbe,libertas usb8xxx)
  1012. -endef
  1013. +define KernelPackage/brcmsmac/config
  1014. + if PACKAGE_kmod-brcmsmac
  1015. -define KernelPackage/libertas-sdio
  1016. - $(call KernelPackage/mac80211/Default)
  1017. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml
  1018. - TITLE:=Marvell 88W8686 Wireless Driver
  1019. - FILES:= \
  1020. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1021. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas_sdio.ko
  1022. - AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio)
  1023. + config BRCMSMAC_USE_FW_FROM_WL
  1024. + bool "Use firmware extracted from broadcom proprietary driver"
  1025. + default y
  1026. + help
  1027. + Instead of using the official brcmsmac firmware a firmware
  1028. + version 666.2 extracted from the proprietary Broadcom driver
  1029. + is used. This is needed to get core rev 17 used in bcm4716
  1030. + to work.
  1031. +
  1032. + If unsure, say Y.
  1033. +
  1034. + endif
  1035. endef
  1036. -define KernelPackage/mac80211-hwsim
  1037. - $(call KernelPackage/mac80211/Default)
  1038. - TITLE:=mac80211 HW simulation device
  1039. - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1040. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  1041. - AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  1042. -endef
  1043. -define KernelPackage/net-libipw
  1044. +define KernelPackage/brcmfmac
  1045. $(call KernelPackage/mac80211/Default)
  1046. - TITLE:=libipw for ipw2100 and ipw2200
  1047. - 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
  1048. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/libipw.ko
  1049. - AUTOLOAD:=$(call AutoProbe,libipw)
  1050. + TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
  1051. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  1052. + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_USB:kmod-usb-core
  1053. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko
  1054. + AUTOLOAD:=$(call AutoProbe,brcmfmac)
  1055. endef
  1056. -define KernelPackage/net-libipw/description
  1057. - Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
  1058. +define KernelPackage/brcmfmac/description
  1059. + Kernel module for Broadcom IEEE802.11n USB Wireless cards
  1060. endef
  1061. -IPW2100_NAME:=ipw2100-fw
  1062. -IPW2100_VERSION:=1.3
  1063. -
  1064. -define Download/net-ipw2100
  1065. - URL:=http://bughost.org/firmware/
  1066. - FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  1067. - MD5SUM=46aa75bcda1a00efa841f9707bbbd113
  1068. -endef
  1069. -$(eval $(call Download,net-ipw2100))
  1070. +define KernelPackage/brcmfmac/config
  1071. + if PACKAGE_kmod-brcmfmac
  1072. -define KernelPackage/net-ipw2100
  1073. - $(call KernelPackage/mac80211/Default)
  1074. - TITLE:=Intel IPW2100 driver
  1075. - DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
  1076. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2100.ko
  1077. - AUTOLOAD:=$(call AutoProbe,ipw2100)
  1078. -endef
  1079. + config BRCMFMAC_SDIO
  1080. + bool "Enable SDIO bus interface support"
  1081. + default n
  1082. + help
  1083. + Enable support for cards attached to an SDIO bus.
  1084. + Select this option only if you are sure that your
  1085. + board has a Broadcom wireless chip atacched to
  1086. + that bus.
  1087. -define KernelPackage/net-ipw2100/description
  1088. - Kernel support for Intel IPW2100
  1089. - Includes:
  1090. - - ipw2100
  1091. -endef
  1092. + config BRCMFMAC_USB
  1093. + bool "Enable USB bus interface support"
  1094. + depends on USB_SUPPORT
  1095. + default y
  1096. + help
  1097. + Supported USB connected chipsets:
  1098. + BCM43235, BCM43236, BCM43238 (all in revision 3 only)
  1099. + BCM43143, BCM43242, BCM43566, BCM43569
  1100. -IPW2200_NAME:=ipw2200-fw
  1101. -IPW2200_VERSION:=3.1
  1102. + config BRCMFMAC_PCIE
  1103. + bool "Enable PCIE bus interface support"
  1104. + depends on PCI_SUPPORT
  1105. + default y
  1106. + help
  1107. + Supported PCIe connected chipsets:
  1108. + BCM4354, BCM4356, BCM43567, BCM43570, BCM43602
  1109. -define Download/net-ipw2200
  1110. - URL:=http://bughost.org/firmware/
  1111. - FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  1112. - MD5SUM=eaba788643c7cc7483dd67ace70f6e99
  1113. + endif
  1114. endef
  1115. -$(eval $(call Download,net-ipw2200))
  1116. -define KernelPackage/net-ipw2200
  1117. - $(call KernelPackage/mac80211/Default)
  1118. - TITLE:=Intel IPW2200 driver
  1119. - DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
  1120. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2200.ko
  1121. - AUTOLOAD:=$(call AutoProbe,ipw2200)
  1122. -endef
  1123. -define KernelPackage/net-ipw2200/description
  1124. - Kernel support for Intel IPW2200
  1125. - Includes:
  1126. - - ipw2200
  1127. +define KernelPackage/carl9170
  1128. + $(call KernelPackage/mac80211/Default)
  1129. + TITLE:=Driver for Atheros AR9170 USB sticks
  1130. + DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT
  1131. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
  1132. + AUTOLOAD:=$(call AutoProbe,carl9170)
  1133. endef
  1134. -define KernelPackage/net-hermes
  1135. +define KernelPackage/hermes
  1136. $(call KernelPackage/mac80211/Default)
  1137. TITLE:=Hermes 802.11b chipset support
  1138. - DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT
  1139. + DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT +kmod-crypto-michael-mic
  1140. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco.ko
  1141. AUTOLOAD:=$(call AutoProbe,orinoco)
  1142. endef
  1143. -define KernelPackage/net-hermes/description
  1144. +define KernelPackage/hermes/description
  1145. Kernel support for Hermes 802.11b chipsets
  1146. endef
  1147. -define KernelPackage/net-hermes-pci
  1148. +define KernelPackage/hermes-pci
  1149. $(call KernelPackage/mac80211/Default)
  1150. TITLE:=Intersil Prism 2.5 PCI support
  1151. - DEPENDS:=@PCI_SUPPORT +kmod-net-hermes
  1152. + DEPENDS:=@PCI_SUPPORT +kmod-hermes
  1153. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_pci.ko
  1154. AUTOLOAD:=$(call AutoProbe,orinoco_pci)
  1155. endef
  1156. -define KernelPackage/net-hermes-pci/description
  1157. +define KernelPackage/hermes-pci/description
  1158. Kernel modules for Intersil Prism 2.5 PCI support
  1159. endef
  1160. -define KernelPackage/net-hermes-plx
  1161. +define KernelPackage/hermes-plx
  1162. $(call KernelPackage/mac80211/Default)
  1163. TITLE:=PLX9052 based PCI adaptor
  1164. - DEPENDS:=@PCI_SUPPORT +kmod-net-hermes
  1165. + DEPENDS:=@PCI_SUPPORT +kmod-hermes
  1166. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_plx.ko
  1167. AUTOLOAD:=$(call AutoProbe,orinoco_plx)
  1168. endef
  1169. -define KernelPackage/net-hermes-plx/description
  1170. +define KernelPackage/hermes-plx/description
  1171. Kernel modules for Hermes in PLX9052 based PCI adaptors
  1172. endef
  1173. -define KernelPackage/net-hermes-pcmcia
  1174. +define KernelPackage/hermes-pcmcia
  1175. $(call KernelPackage/mac80211/Default)
  1176. TITLE:=Hermes based PCMCIA adaptors
  1177. - DEPENDS:=@PCMCIA_SUPPORT +kmod-net-hermes @BROKEN
  1178. + DEPENDS:=@PCMCIA_SUPPORT +kmod-hermes @BROKEN
  1179. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_cs.ko
  1180. AUTOLOAD:=$(call AutoProbe,orinoco_cs)
  1181. endef
  1182. -define KernelPackage/net-hermes-pcmcia/description
  1183. +define KernelPackage/hermes-pcmcia/description
  1184. Kernel modules for Hermes based PCMCIA adaptors
  1185. endef
  1186. -define KernelPackage/iwlagn
  1187. +
  1188. +define KernelPackage/iwlwifi
  1189. $(call KernelPackage/mac80211/Default)
  1190. DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT
  1191. TITLE:=Intel AGN Wireless support
  1192. FILES:= \
  1193. $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/iwlwifi.ko \
  1194. - $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko
  1195. - AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm)
  1196. + $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko \
  1197. + $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/mvm/iwlmvm.ko
  1198. + AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm iwlmvm)
  1199. MENU:=1
  1200. endef
  1201. -define KernelPackage/iwlagn/description
  1202. - iwlagn kernel module for Intel 5000/5150/1000/6000/6050/6005/6030/100 support
  1203. -endef
  1204. +define KernelPackage/iwlwifi/description
  1205. + iwlwifi kernel module for
  1206. + Intel Wireless WiFi Link 6250AGN Adapter
  1207. + Intel 6000 Series Wi-Fi Adapters (6200AGN and 6300AGN)
  1208. + Intel WiFi Link 1000BGN
  1209. + Intel Wireless WiFi 5150AGN
  1210. + Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  1211. + Intel 6005 Series Wi-Fi Adapters
  1212. + Intel 6030 Series Wi-Fi Adapters
  1213. + Intel Wireless WiFi Link 6150BGN 2 Adapter
  1214. + Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN)
  1215. + Intel 2000 Series Wi-Fi Adapters
  1216. + Intel 7260 Wi-Fi Adapter
  1217. + Intel 3160 Wi-Fi Adapter
  1218. + Intel 7265 Wi-Fi Adapter
  1219. + Intel 8260 Wi-Fi Adapter
  1220. + Intel 3165 Wi-Fi Adapter
  1221. +endef
  1222. +
  1223. +define KernelPackage/iwlwifi/config
  1224. + if PACKAGE_kmod-iwlwifi
  1225. +
  1226. + config PACKAGE_IWLWIFI_DEBUG
  1227. + bool "Enable full debugging output in the iwlwifi driver"
  1228. + default n
  1229. + help
  1230. + This option will enable debug tracing output for the iwlwifi drivers
  1231. -define KernelPackage/iwlagn/config
  1232. - if PACKAGE_kmod-iwlagn
  1233. + This will result in the kernel module being ~100k larger. You can
  1234. + control which debug output is sent to the kernel log by setting the
  1235. + value in
  1236. - config IWL5000_FW
  1237. - bool "Intel 5000 Firmware"
  1238. - default y
  1239. + /sys/module/iwlwifi/parameters/debug
  1240. +
  1241. + This entry will only exist if this option is enabled.
  1242. +
  1243. + To set a value, simply echo an 8-byte hex value to the same file:
  1244. +
  1245. + % echo 0x43fff > /sys/module/iwlwifi/parameters/debug
  1246. +
  1247. + You can find the list of debug mask values in:
  1248. + drivers/net/wireless/iwlwifi/iwl-debug.h
  1249. +
  1250. + If this is your first time using this driver, you should say Y here
  1251. + as the debug information can assist others in helping you resolve
  1252. + any problems you may encounter.
  1253. +
  1254. + config PACKAGE_IWLWIFI_DEBUGFS
  1255. + bool "iwlwifi debugfs support"
  1256. + depends on PACKAGE_MAC80211_DEBUGFS
  1257. + default n
  1258. help
  1259. - Download and install firmware for:
  1260. - Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  1261. + Enable creation of debugfs files for the iwlwifi drivers. This
  1262. + is a low-impact option that allows getting insight into the
  1263. + driver's state at runtime.
  1264. - config IWL5150_FW
  1265. - bool "Intel 5150 Firmware"
  1266. + config IWL100_FW
  1267. + bool "Intel 100 Firmware"
  1268. default y
  1269. help
  1270. Download and install firmware for:
  1271. - Intel Wireless WiFi 5150AGN
  1272. + Intel Centrino Wireless-N 100
  1273. config IWL1000_FW
  1274. bool "Intel 1000 Firmware"
  1275. @@ -852,89 +910,104 @@ define KernelPackage/iwlagn/config
  1276. Download and install firmware for:
  1277. Intel Centrino Wireless-N 1000
  1278. - config IWL6000_FW
  1279. - bool "Intel 6000 Firmware"
  1280. + config IWL105_FW
  1281. + bool "Intel 105 Firmware"
  1282. default y
  1283. help
  1284. Download and install firmware for:
  1285. - Intel Centrino Ultimate-N 6300 and Advanced-N 6200
  1286. + Intel Centrino Wireless-N 105
  1287. - config IWL6050_FW
  1288. - bool "Intel 6050 Firmware"
  1289. + config IWL135_FW
  1290. + bool "Intel 135 Firmware"
  1291. default y
  1292. help
  1293. Download and install firmware for:
  1294. - Intel Centrino Advanced-N + WiMAX 6250 and Wireless-N + WiMAX 6150
  1295. + Intel Centrino Wireless-N 135
  1296. - config IWL6005_FW
  1297. - bool "Intel 6005 Firmware"
  1298. + config IWL2000_FW
  1299. + bool "Intel 2000 Firmware"
  1300. default y
  1301. help
  1302. Download and install firmware for:
  1303. - Intel Centrino Advanced-N 6205
  1304. + Intel Centrino Wireless-N 2200
  1305. - config IWL6030_FW
  1306. - bool "Intel 6030 Firmware"
  1307. + config IWL2030_FW
  1308. + bool "Intel 2030 Firmware"
  1309. default y
  1310. help
  1311. Download and install firmware for:
  1312. - Intel Centrino Advanced-N 6230, Wireless-N 1030, Wireless-N 130 and Advanced-N 6235
  1313. + Intel Centrino Wireless-N 2230
  1314. - config IWL7260_FW
  1315. - bool "Intel 7260 Firmware"
  1316. + config IWL3160_FW
  1317. + bool "Intel 3160 Firmware"
  1318. default y
  1319. help
  1320. Download and install firmware for:
  1321. - Intel Dual Band Wireless-N 7260 and Intel Dual Band Wireless-AC 7260
  1322. + Intel Wireless WiFi 3160
  1323. - config IWL7265_FW
  1324. - bool "Intel 7265 Firmware"
  1325. + config IWL5000_FW
  1326. + bool "Intel 5000 Firmware"
  1327. default y
  1328. help
  1329. Download and install firmware for:
  1330. - Intel Wireless 7265
  1331. + Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  1332. - config IWL100_FW
  1333. - bool "Intel 100 Firmware"
  1334. + config IWL5150_FW
  1335. + bool "Intel 5150 Firmware"
  1336. default y
  1337. help
  1338. Download and install firmware for:
  1339. - Intel Centrino Wireless-N 100
  1340. + Intel Wireless WiFi 5150AGN
  1341. - config IWL2000_FW
  1342. - bool "Intel 2000 Firmware"
  1343. + config IWL6000_FW
  1344. + bool "Intel 6000 Firmware"
  1345. default y
  1346. help
  1347. Download and install firmware for:
  1348. - Intel Centrino Wireless-N 2200
  1349. + Intel Centrino Ultimate-N 6300 and Advanced-N 6200
  1350. - config IWL2030_FW
  1351. - bool "Intel 2030 Firmware"
  1352. + config IWL6005_FW
  1353. + bool "Intel 6005 Firmware"
  1354. default y
  1355. help
  1356. Download and install firmware for:
  1357. - Intel Centrino Wireless-N 2230
  1358. + Intel Centrino Advanced-N 6205
  1359. - config IWL105_FW
  1360. - bool "Intel 105 Firmware"
  1361. + config IWL6030_FW
  1362. + bool "Intel 6030 Firmware"
  1363. default y
  1364. help
  1365. Download and install firmware for:
  1366. - Intel Centrino Wireless-N 105
  1367. + Intel Centrino Advanced-N 6230, Wireless-N 1030, Wireless-N 130 and Advanced-N 6235
  1368. - config IWL135_FW
  1369. - bool "Intel 135 Firmware"
  1370. + config IWL6050_FW
  1371. + bool "Intel 6050 Firmware"
  1372. default y
  1373. help
  1374. Download and install firmware for:
  1375. - Intel Centrino Wireless-N 135
  1376. + Intel Centrino Advanced-N + WiMAX 6250 and Wireless-N + WiMAX 6150
  1377. - config IWL3160_FW
  1378. - bool "Intel 3160 Firmware"
  1379. + config IWL7260_FW
  1380. + bool "Intel 7260 Firmware"
  1381. + default y
  1382. + help
  1383. + Download and install firmware for:
  1384. + Intel Dual Band Wireless-N 7260 and Intel Dual Band Wireless-AC 7260
  1385. +
  1386. + config IWL7265_FW
  1387. + bool "Intel 7265 Firmware"
  1388. + default y
  1389. + help
  1390. + Download and install firmware for:
  1391. + Intel Wireless 7265, 7265D, 3165
  1392. +
  1393. + config IWL8000_FW
  1394. + bool "Intel 8000 Series Firmware"
  1395. default y
  1396. help
  1397. Download and install firmware for:
  1398. - Intel Wireless 3160
  1399. + Intel Wireless Series 8260, 4165
  1400. +
  1401. endif
  1402. endef
  1403. @@ -953,578 +1026,587 @@ endef
  1404. define KernelPackage/iwl3945
  1405. $(call KernelPackage/mac80211/Default)
  1406. DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy
  1407. - TITLE:=Intel iwl3945 Wireless support
  1408. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl3945.ko
  1409. - AUTOLOAD:=$(call AutoProbe,iwl3945)
  1410. -endef
  1411. -
  1412. -define KernelPackage/iwl3945/description
  1413. - iwl3945 kernel module for Intel 3945 support
  1414. -endef
  1415. -
  1416. -define KernelPackage/iwl4965
  1417. - $(call KernelPackage/mac80211/Default)
  1418. - DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT
  1419. - TITLE:=Intel iwl4965 Wireless support
  1420. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl4965.ko
  1421. - AUTOLOAD:=$(call AutoProbe,iwl4965)
  1422. -endef
  1423. -
  1424. -define KernelPackage/iwl4965/description
  1425. - iwl4965 kernel module for Intel 4965 support
  1426. -endef
  1427. -
  1428. -
  1429. -define KernelPackage/mwl8k
  1430. - $(call KernelPackage/mac80211/Default)
  1431. - TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
  1432. - URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
  1433. - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1434. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mwl8k.ko
  1435. - AUTOLOAD:=$(call AutoProbe,mwl8k)
  1436. -endef
  1437. -
  1438. -define KernelPackage/mwl8k/description
  1439. - Kernel modules for Marvell TOPDOG 802.11 Wireless cards
  1440. -endef
  1441. -
  1442. -
  1443. -define KernelPackage/mwifiex-pcie
  1444. - $(call KernelPackage/mac80211/Default)
  1445. - TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
  1446. - URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
  1447. - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1448. - FILES:= \
  1449. - $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex.ko \
  1450. - $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex_pcie.ko
  1451. - AUTOLOAD:=$(call AutoProbe,mwifiex_pcie)
  1452. -endef
  1453. -
  1454. -define KernelPackage/mwifiex-pcie/description
  1455. - Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  1456. -endef
  1457. -
  1458. -
  1459. -define KernelPackage/wlcore
  1460. - $(call KernelPackage/mac80211/Default)
  1461. - TITLE:=TI common driver part
  1462. - DEPENDS+= @TARGET_omap +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1463. - FILES:= \
  1464. - $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
  1465. - $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
  1466. - AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
  1467. -endef
  1468. -
  1469. -define KernelPackage/wlcore/description
  1470. - This module contains some common parts needed by TI Wireless drivers.
  1471. -endef
  1472. -
  1473. -define KernelPackage/wl12xx
  1474. - $(call KernelPackage/mac80211/Default)
  1475. - TITLE:=Driver for TI WL12xx
  1476. - URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
  1477. - DEPENDS+= +kmod-wlcore
  1478. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
  1479. - AUTOLOAD:=$(call AutoProbe,wl12xx)
  1480. + TITLE:=Intel iwl3945 Wireless support
  1481. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl3945.ko
  1482. + AUTOLOAD:=$(call AutoProbe,iwl3945)
  1483. endef
  1484. -define KernelPackage/wl12xx/description
  1485. - Kernel modules for TI WL12xx
  1486. +define KernelPackage/iwl3945/description
  1487. + iwl3945 kernel module for Intel 3945 support
  1488. endef
  1489. -define KernelPackage/wl18xx
  1490. +define KernelPackage/iwl4965
  1491. $(call KernelPackage/mac80211/Default)
  1492. - TITLE:=Driver for TI WL18xx
  1493. - URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
  1494. - DEPENDS+= +kmod-wlcore
  1495. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
  1496. - AUTOLOAD:=$(call AutoProbe,wl18xx)
  1497. + DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT
  1498. + TITLE:=Intel iwl4965 Wireless support
  1499. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl4965.ko
  1500. + AUTOLOAD:=$(call AutoProbe,iwl4965)
  1501. endef
  1502. -define KernelPackage/wl18xx/description
  1503. - Kernel modules for TI WL18xx
  1504. +define KernelPackage/iwl4965/description
  1505. + iwl4965 kernel module for Intel 4965 support
  1506. endef
  1507. -#Broadcom firmware
  1508. -ifneq ($(CONFIG_B43_FW_6_30),)
  1509. - PKG_B43_FWV4_NAME:=broadcom-wl
  1510. - PKG_B43_FWV4_VERSION:=6.30.163.46
  1511. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o
  1512. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1513. - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  1514. - PKG_B43_FWV4_MD5SUM:=6fe97e9368d25342a1ab943d3cf3496d
  1515. -else
  1516. -ifneq ($(CONFIG_B43_FW_5_10),)
  1517. - PKG_B43_FWV4_NAME:=broadcom-wl
  1518. - PKG_B43_FWV4_VERSION:=5.10.56.27.3
  1519. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o
  1520. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2
  1521. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1522. - PKG_B43_FWV4_MD5SUM:=3363e3a6b3d9d73c49dea870c7834eac
  1523. -else
  1524. -ifneq ($(CONFIG_B43_FW_4_178),)
  1525. - PKG_B43_FWV4_NAME:=broadcom-wl
  1526. - PKG_B43_FWV4_VERSION:=4.178.10.4
  1527. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  1528. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1529. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1530. - PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
  1531. -else
  1532. -ifneq ($(CONFIG_B43_FW_5_100_138),)
  1533. - PKG_B43_FWV4_NAME:=broadcom-wl
  1534. - PKG_B43_FWV4_VERSION:=5.100.138
  1535. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  1536. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1537. - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  1538. - PKG_B43_FWV4_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  1539. -else
  1540. - PKG_B43_FWV4_NAME:=broadcom-wl
  1541. - PKG_B43_FWV4_VERSION:=4.150.10.5
  1542. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
  1543. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1544. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1545. - PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
  1546. -endif
  1547. -endif
  1548. -endif
  1549. -endif
  1550. -ifneq ($(CONFIG_B43_OPENFIRMWARE),)
  1551. - PKG_B43_FWV4_NAME:=broadcom-wl
  1552. - PKG_B43_FWV4_VERSION:=5.2
  1553. - PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
  1554. - PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
  1555. - PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
  1556. - PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
  1557. -endif
  1558. -
  1559. -
  1560. -PKG_B43_FWV3_NAME:=wl_apsta
  1561. -PKG_B43_FWV3_VERSION:=3.130.20.0
  1562. -PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o
  1563. -PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/
  1564. -PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
  1565. -
  1566. -define Download/b43
  1567. - FILE:=$(PKG_B43_FWV4_SOURCE)
  1568. - URL:=$(PKG_B43_FWV4_SOURCE_URL)
  1569. - MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
  1570. +define KernelPackage/lib80211
  1571. + $(call KernelPackage/mac80211/Default)
  1572. + TITLE:=802.11 Networking stack
  1573. + DEPENDS:=+kmod-cfg80211
  1574. + FILES:= \
  1575. + $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  1576. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  1577. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  1578. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  1579. + AUTOLOAD:=$(call AutoProbe, \
  1580. + lib80211 \
  1581. + lib80211_crypt_wep \
  1582. + lib80211_crypt_ccmp \
  1583. + lib80211_crypt_tkip \
  1584. + )
  1585. endef
  1586. -$(eval $(call Download,b43))
  1587. -define Download/b43legacy
  1588. - FILE:=$(PKG_B43_FWV3_SOURCE)
  1589. - URL:=$(PKG_B43_FWV3_SOURCE_URL)
  1590. - MD5SUM:=$(PKG_B43_FWV3_MD5SUM)
  1591. +define KernelPackage/lib80211/description
  1592. + Kernel modules for 802.11 Networking stack
  1593. + Includes:
  1594. + - lib80211
  1595. + - lib80211_crypt_wep
  1596. + - lib80211_crypt_tkip
  1597. + - lib80211_crytp_ccmp
  1598. endef
  1599. -$(eval $(call Download,b43legacy))
  1600. -define KernelPackage/b43
  1601. +define KernelPackage/libipw
  1602. $(call KernelPackage/mac80211/Default)
  1603. - TITLE:=Broadcom 43xx wireless support
  1604. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  1605. - KCONFIG:= \
  1606. - CONFIG_HW_RANDOM=y
  1607. - # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb
  1608. - DEPENDS += \
  1609. - @PCI_SUPPORT +kmod-mac80211 \
  1610. - $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \
  1611. - $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma)
  1612. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43/b43.ko
  1613. - AUTOLOAD:=$(call AutoProbe,b43)
  1614. - MENU:=1
  1615. + TITLE:=libipw for ipw2100 and ipw2200
  1616. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  1617. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/libipw.ko
  1618. + AUTOLOAD:=$(call AutoProbe,libipw)
  1619. endef
  1620. -define KernelPackage/b43/config
  1621. -
  1622. -config PACKAGE_B43_USE_SSB
  1623. - select PACKAGE_kmod-ssb
  1624. - tristate
  1625. - depends on !TARGET_brcm47xx && !TARGET_brcm63xx
  1626. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  1627. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB
  1628. +define KernelPackage/libipw/description
  1629. + Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
  1630. +endef
  1631. -config PACKAGE_B43_USE_BCMA
  1632. - select PACKAGE_kmod-bcma
  1633. - tristate
  1634. - depends on !TARGET_brcm47xx && !TARGET_bcm53xx
  1635. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  1636. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA
  1637. +IPW2100_NAME:=ipw2100-fw
  1638. +IPW2100_VERSION:=1.3
  1639. - if PACKAGE_kmod-b43
  1640. +define Download/ipw2100
  1641. + URL:=http://bughost.org/firmware/
  1642. + FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  1643. + MD5SUM=46aa75bcda1a00efa841f9707bbbd113
  1644. +endef
  1645. +$(eval $(call Download,ipw2100))
  1646. - choice
  1647. - prompt "b43 firmware version"
  1648. - default B43_FW_5_100_138
  1649. - help
  1650. - This option allows you to select the version of the b43 firmware.
  1651. +define KernelPackage/ipw2100
  1652. + $(call KernelPackage/mac80211/Default)
  1653. + TITLE:=Intel IPW2100 driver
  1654. + DEPENDS:=@PCI_SUPPORT +kmod-libipw
  1655. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2100.ko
  1656. + AUTOLOAD:=$(call AutoProbe,ipw2100)
  1657. +endef
  1658. - config B43_FW_4_150
  1659. - bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)"
  1660. - help
  1661. - Old stable firmware for BCM43xx devices.
  1662. +define KernelPackage/ipw2100/description
  1663. + Kernel support for Intel IPW2100
  1664. + Includes:
  1665. + - ipw2100
  1666. +endef
  1667. - If unsure, select this.
  1668. +IPW2200_NAME:=ipw2200-fw
  1669. +IPW2200_VERSION:=3.1
  1670. - config B43_FW_4_178
  1671. - bool "Firmware 478.104 from driver 4.178.10.4"
  1672. - help
  1673. - Older firmware for BCM43xx devices.
  1674. +define Download/ipw2200
  1675. + URL:=http://bughost.org/firmware/
  1676. + FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  1677. + MD5SUM=eaba788643c7cc7483dd67ace70f6e99
  1678. +endef
  1679. +$(eval $(call Download,ipw2200))
  1680. - If unsure, select the "stable" firmware.
  1681. +define KernelPackage/ipw2200
  1682. + $(call KernelPackage/mac80211/Default)
  1683. + TITLE:=Intel IPW2200 driver
  1684. + DEPENDS:=@PCI_SUPPORT +kmod-libipw
  1685. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2200.ko
  1686. + AUTOLOAD:=$(call AutoProbe,ipw2200)
  1687. +endef
  1688. - config B43_FW_5_10
  1689. - bool "Firmware 508.1084 from driver 5.10.56.27"
  1690. - help
  1691. - Older firmware for BCM43xx devices.
  1692. +define KernelPackage/ipw2200/description
  1693. + Kernel support for Intel IPW2200
  1694. + Includes:
  1695. + - ipw2200
  1696. +endef
  1697. - If unsure, select the "stable" firmware.
  1698. - config B43_FW_5_100_138
  1699. - bool "Firmware 666.2 from driver 5.100.138 (stable)"
  1700. - help
  1701. - The currently default firmware for BCM43xx devices.
  1702. +define KernelPackage/libertas-usb
  1703. + $(call KernelPackage/mac80211/Default)
  1704. + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT
  1705. + TITLE:=Marvell 88W8015 Wireless Driver
  1706. + FILES:= \
  1707. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1708. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/usb8xxx.ko
  1709. + AUTOLOAD:=$(call AutoProbe,libertas usb8xxx)
  1710. +endef
  1711. - This firmware currently gets most of the testing and is needed for some N-PHY devices.
  1712. +define KernelPackage/libertas-sdio
  1713. + $(call KernelPackage/mac80211/Default)
  1714. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml
  1715. + TITLE:=Marvell 88W8686 Wireless Driver
  1716. + FILES:= \
  1717. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1718. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas_sdio.ko
  1719. + AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio)
  1720. +endef
  1721. - If unsure, select the this firmware.
  1722. +define KernelPackage/mac80211-hwsim
  1723. + $(call KernelPackage/mac80211/Default)
  1724. + TITLE:=mac80211 HW simulation device
  1725. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1726. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  1727. + AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  1728. +endef
  1729. - config B43_FW_6_30
  1730. - bool "Firmware 784.2 from driver 6.30.163.46 (experimental)"
  1731. - help
  1732. - Newer experimental firmware for BCM43xx devices.
  1733. +PKG_MT7601U_FW_NAME:=DPO_MT7601U_LinuxSTA
  1734. +PKG_MT7601U_FW_VERSION:=3.0.0.4_20130913
  1735. +PKG_MT7601U_FW_MD5SUM:=5f440dccc8bc952745a191994fc34699
  1736. +PKG_MT7601U_FW_SOURCE:=$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION).tar.bz2
  1737. +PKG_MT7601U_FW_SOURCE_URL:=http://www.mediatek.com/AmazonS3/Downloads/linux/
  1738. +define Download/mt7601u-firmware
  1739. + FILE:=$(PKG_MT7601U_FW_SOURCE)
  1740. + URL:=$(PKG_MT7601U_FW_SOURCE_URL)
  1741. + MD5SUM:=$(PKG_MT7601U_FW_MD5SUM)
  1742. + SUBDIR:=$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION)
  1743. +endef
  1744. +$(eval $(call Download,mt7601u-firmware))
  1745. - This firmware is mostly untested.
  1746. +define KernelPackage/mt7601u
  1747. + $(call KernelPackage/mac80211/Default)
  1748. + TITLE:=MT7601U-based USB dongles Wireless Driver
  1749. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT @USB_SUPPORT +kmod-usb-core
  1750. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko
  1751. + AUTOLOAD:=$(call AutoProbe,mt7601)
  1752. +endef
  1753. - If unsure, select the "stable" firmware.
  1754. - config B43_OPENFIRMWARE
  1755. - bool "Open FirmWare for WiFi networks"
  1756. - help
  1757. - Opensource firmware for BCM43xx devices.
  1758. +define KernelPackage/mwl8k
  1759. + $(call KernelPackage/mac80211/Default)
  1760. + TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
  1761. + URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
  1762. + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1763. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mwl8k.ko
  1764. + AUTOLOAD:=$(call AutoProbe,mwl8k)
  1765. +endef
  1766. - Do _not_ select this, unless you know what you are doing.
  1767. - The Opensource firmware is not suitable for embedded devices, yet.
  1768. - It does not support QoS, which is bad for AccessPoints.
  1769. - It does not support hardware crypto acceleration, which is a showstopper
  1770. - for embedded devices with low CPU resources.
  1771. +define KernelPackage/mwl8k/description
  1772. + Kernel modules for Marvell TOPDOG 802.11 Wireless cards
  1773. +endef
  1774. - If unsure, select the "stable" firmware.
  1775. - endchoice
  1776. +define KernelPackage/mwifiex-pcie
  1777. + $(call KernelPackage/mac80211/Default)
  1778. + TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
  1779. + URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
  1780. + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1781. + FILES:= \
  1782. + $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex.ko \
  1783. + $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex_pcie.ko
  1784. + AUTOLOAD:=$(call AutoProbe,mwifiex_pcie)
  1785. +endef
  1786. - config B43_FW_SQUASH
  1787. - bool "Remove unnecessary firmware files"
  1788. - depends on !B43_OPENFIRMWARE
  1789. - default y
  1790. - help
  1791. - This options allows you to remove unnecessary b43 firmware files
  1792. - from the final rootfs image. This can reduce the rootfs size by
  1793. - up to 200k.
  1794. +define KernelPackage/mwifiex-pcie/description
  1795. + Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  1796. +endef
  1797. - If unsure, say Y.
  1798. - config B43_FW_SQUASH_COREREVS
  1799. - string "Core revisions to include"
  1800. - depends on B43_FW_SQUASH
  1801. - default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy
  1802. - default "16,28,29,30" if TARGET_brcm47xx_mips74k
  1803. - default "5,6,7,8,9,10,11,13,15,16,28,29,30"
  1804. - help
  1805. - This is a comma seperated list of core revision numbers.
  1806. +# Prism54 drivers
  1807. +P54PCIFW:=2.13.12.0.arm
  1808. +P54USBFW:=2.13.24.0.lm87.arm
  1809. +P54SPIFW:=2.13.0.0.a.13.14.arm
  1810. - Example (keep files for rev5 only):
  1811. - 5
  1812. +define Download/p54usb
  1813. + FILE:=$(P54USBFW)
  1814. + URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  1815. + MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  1816. +endef
  1817. +$(eval $(call Download,p54usb))
  1818. - Example (keep files for rev5 and rev11):
  1819. - 5,11
  1820. +define Download/p54pci
  1821. + FILE:=$(P54PCIFW)
  1822. + URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  1823. + MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  1824. +endef
  1825. +$(eval $(call Download,p54pci))
  1826. - config B43_FW_SQUASH_PHYTYPES
  1827. - string "PHY types to include"
  1828. - depends on B43_FW_SQUASH
  1829. - default "G,N,LP" if TARGET_brcm47xx_legacy
  1830. - default "N,HT" if TARGET_brcm47xx_mips74k
  1831. - default "G,N,LP,HT"
  1832. - help
  1833. - This is a comma seperated list of PHY types:
  1834. - A => A-PHY
  1835. - AG => Dual A-PHY G-PHY
  1836. - G => G-PHY
  1837. - LP => LP-PHY
  1838. - N => N-PHY
  1839. - HT => HT-PHY
  1840. - LCN => LCN-PHY
  1841. - LCN40 => LCN40-PHY
  1842. - AC => AC-PHY
  1843. +define Download/p54spi
  1844. + FILE:=$(P54SPIFW)
  1845. + URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  1846. + MD5SUM:=42661f8ecbadd88012807493f596081d
  1847. +endef
  1848. +$(eval $(call Download,p54spi))
  1849. - Example (keep files for G-PHY only):
  1850. - G
  1851. +define KernelPackage/p54/Default
  1852. + $(call KernelPackage/mac80211/Default)
  1853. + TITLE:=Prism54 Drivers
  1854. +endef
  1855. - Example (keep files for G-PHY and N-PHY):
  1856. - G,N
  1857. +define KernelPackage/p54/description
  1858. + Kernel module for Prism54 chipsets (mac80211)
  1859. +endef
  1860. - choice
  1861. - prompt "Supported buses"
  1862. - default PACKAGE_B43_BUSES_BCMA_AND_SSB
  1863. - help
  1864. - This allows choosing buses that b43 should support.
  1865. +define KernelPackage/p54-common
  1866. + $(call KernelPackage/p54/Default)
  1867. + DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt
  1868. + TITLE+= (COMMON)
  1869. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54common.ko
  1870. +endef
  1871. - config PACKAGE_B43_BUSES_BCMA_AND_SSB
  1872. - depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  1873. - bool "BCMA and SSB"
  1874. +define KernelPackage/p54-pci
  1875. + $(call KernelPackage/p54/Default)
  1876. + TITLE+= (PCI)
  1877. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  1878. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54pci.ko
  1879. + AUTOLOAD:=$(call AutoProbe,p54pci)
  1880. +endef
  1881. - config PACKAGE_B43_BUSES_BCMA
  1882. - depends on !TARGET_brcm47xx_legacy
  1883. - bool "BCMA only"
  1884. +define KernelPackage/p54-usb
  1885. + $(call KernelPackage/p54/Default)
  1886. + TITLE+= (USB)
  1887. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  1888. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54usb.ko
  1889. + AUTOLOAD:=$(call AutoProbe,p54usb)
  1890. +endef
  1891. - config PACKAGE_B43_BUSES_SSB
  1892. - depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  1893. - bool "SSB only"
  1894. +define KernelPackage/p54-spi
  1895. + $(call KernelPackage/p54/Default)
  1896. + TITLE+= (SPI)
  1897. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  1898. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54spi.ko
  1899. + AUTOLOAD:=$(call AutoProbe,p54spi)
  1900. +endef
  1901. - endchoice
  1902. +define KernelPackage/rt2x00/Default
  1903. + $(call KernelPackage/mac80211/Default)
  1904. + TITLE:=Ralink Drivers for RT2x00 cards
  1905. +endef
  1906. - config PACKAGE_B43_DEBUG
  1907. - bool "Enable debug output and debugfs for b43"
  1908. - default n
  1909. - help
  1910. - Enable additional debug output and runtime sanity checks for b43
  1911. - and enables the debugfs interface.
  1912. +define KernelPackage/rt2x00-lib
  1913. +$(call KernelPackage/rt2x00/Default)
  1914. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t
  1915. + TITLE+= (LIB)
  1916. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00lib.ko
  1917. + MENU:=1
  1918. +endef
  1919. - If unsure, say N.
  1920. +define KernelPackage/rt2x00-lib/config
  1921. + if PACKAGE_kmod-rt2x00-lib
  1922. - config PACKAGE_B43_PIO
  1923. - bool "Enable support for PIO transfer mode"
  1924. - default n
  1925. + config PACKAGE_RT2X00_LIB_DEBUGFS
  1926. + bool "Enable rt2x00 debugfs support"
  1927. + depends on PACKAGE_MAC80211_DEBUGFS
  1928. help
  1929. - Enable support for using PIO instead of DMA. Unless you have DMA
  1930. - transfer problems you don't need this.
  1931. -
  1932. - If unsure, say N.
  1933. + Enable creation of debugfs files for the rt2x00 drivers.
  1934. + These debugfs files support both reading and writing of the
  1935. + most important register types of the rt2x00 hardware.
  1936. - config PACKAGE_B43_PHY_G
  1937. - bool "Enable support for G-PHYs"
  1938. - default n if TARGET_brcm47xx_mips74k
  1939. - default y
  1940. + config PACKAGE_RT2X00_DEBUG
  1941. + bool "Enable rt2x00 debug output"
  1942. help
  1943. - Enable support for G-PHY. This includes support for the following devices:
  1944. - PCI: BCM4306, BCM4311, BCM4318
  1945. - SoC: BCM5352E, BCM4712
  1946. + Enable debugging output for all rt2x00 modules
  1947. - If unsure, say Y.
  1948. + endif
  1949. +endef
  1950. - config PACKAGE_B43_PHY_N
  1951. - bool "Enable support for N-PHYs"
  1952. - default y
  1953. - help
  1954. - Enable support for N-PHY. This includes support for the following devices:
  1955. - PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225
  1956. - SoC: BCM4716, BCM4717, BCM4718
  1957. +define KernelPackage/rt2x00-mmio
  1958. +$(call KernelPackage/rt2x00/Default)
  1959. + DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
  1960. + HIDDEN:=1
  1961. + TITLE+= (MMIO)
  1962. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00mmio.ko
  1963. +endef
  1964. - Currently only 11g speed is available.
  1965. +define KernelPackage/rt2x00-pci
  1966. +$(call KernelPackage/rt2x00/Default)
  1967. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib
  1968. + HIDDEN:=1
  1969. + TITLE+= (PCI)
  1970. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00pci.ko
  1971. + AUTOLOAD:=$(call AutoProbe,rt2x00pci)
  1972. +endef
  1973. - If unsure, say Y.
  1974. +define KernelPackage/rt2x00-usb
  1975. +$(call KernelPackage/rt2x00/Default)
  1976. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
  1977. + HIDDEN:=1
  1978. + TITLE+= (USB)
  1979. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00usb.ko
  1980. + AUTOLOAD:=$(call AutoProbe,rt2x00usb)
  1981. +endef
  1982. - config PACKAGE_B43_PHY_LP
  1983. - bool "Enable support for LP-PHYs"
  1984. - default n if TARGET_brcm47xx_mips74k
  1985. - default y
  1986. - help
  1987. - Enable support for LP-PHY. This includes support for the following devices:
  1988. - PCI: BCM4312
  1989. - SoC: BCM5354
  1990. +define KernelPackage/rt2800-lib
  1991. +$(call KernelPackage/rt2x00/Default)
  1992. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
  1993. + HIDDEN:=1
  1994. + TITLE+= (rt2800 LIB)
  1995. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800lib.ko
  1996. +endef
  1997. - If unsure, say Y.
  1998. +define KernelPackage/rt2400-pci
  1999. +$(call KernelPackage/rt2x00/Default)
  2000. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  2001. + TITLE+= (RT2400 PCI)
  2002. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2400pci.ko
  2003. + AUTOLOAD:=$(call AutoProbe,rt2400pci)
  2004. +endef
  2005. - config PACKAGE_B43_PHY_HT
  2006. - bool "Enable support for HT-PHYs"
  2007. - default n if TARGET_brcm47xx_legacy
  2008. - default y
  2009. - help
  2010. - Enable support for HT-PHY. This includes support for the following devices:
  2011. - PCI: BCM4331
  2012. +define KernelPackage/rt2500-pci
  2013. +$(call KernelPackage/rt2x00/Default)
  2014. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  2015. + TITLE+= (RT2500 PCI)
  2016. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500pci.ko
  2017. + AUTOLOAD:=$(call AutoProbe,rt2500pci)
  2018. +endef
  2019. +
  2020. +define KernelPackage/rt2500-usb
  2021. +$(call KernelPackage/rt2x00/Default)
  2022. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  2023. + TITLE+= (RT2500 USB)
  2024. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500usb.ko
  2025. + AUTOLOAD:=$(call AutoProbe,rt2500usb)
  2026. +endef
  2027. +
  2028. +define KernelPackage/rt2800-mmio
  2029. +$(call KernelPackage/rt2x00/Default)
  2030. + TITLE += (RT28xx/RT3xxx MMIO)
  2031. + DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
  2032. + HIDDEN:=1
  2033. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800mmio.ko
  2034. +endef
  2035. - Currently only 11g speed is available.
  2036. +define KernelPackage/rt2800-soc
  2037. +$(call KernelPackage/rt2x00/Default)
  2038. + DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
  2039. + TITLE += (RT28xx/RT3xxx SoC)
  2040. + FILES := \
  2041. + $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko \
  2042. + $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800soc.ko
  2043. + AUTOLOAD:=$(call AutoProbe,rt2800soc)
  2044. +endef
  2045. - If unsure, say Y.
  2046. +define KernelPackage/rt2800-pci
  2047. +$(call KernelPackage/rt2x00/Default)
  2048. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio
  2049. + TITLE+= (RT2860 PCI)
  2050. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.ko
  2051. + AUTOLOAD:=$(call AutoProbe,rt2800pci)
  2052. +endef
  2053. - config PACKAGE_B43_PHY_LCN
  2054. - bool "Enable support for LCN-PHYs"
  2055. - depends on BROKEN
  2056. - default n
  2057. - help
  2058. - Currently broken.
  2059. +define KernelPackage/rt2800-usb
  2060. +$(call KernelPackage/rt2x00/Default)
  2061. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt
  2062. + TITLE+= (RT2870 USB)
  2063. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800usb.ko
  2064. + AUTOLOAD:=$(call AutoProbe,rt2800usb)
  2065. +endef
  2066. - If unsure, say N.
  2067. - endif
  2068. +define KernelPackage/rt61-pci
  2069. +$(call KernelPackage/rt2x00/Default)
  2070. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  2071. + TITLE+= (RT2x61 PCI)
  2072. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt61pci.ko
  2073. + AUTOLOAD:=$(call AutoProbe,rt61pci)
  2074. endef
  2075. -define KernelPackage/b43/description
  2076. -Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
  2077. +define KernelPackage/rt73-usb
  2078. + $(call KernelPackage/rt2x00/Default)
  2079. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  2080. + TITLE+= (RT73 USB)
  2081. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt73usb.ko
  2082. + AUTOLOAD:=$(call AutoProbe,rt73usb)
  2083. endef
  2084. -define KernelPackage/b43legacy
  2085. +
  2086. +define KernelPackage/rtl818x/Default
  2087. $(call KernelPackage/mac80211/Default)
  2088. - TITLE:=Broadcom 43xx-legacy wireless support
  2089. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  2090. - KCONFIG:= \
  2091. - CONFIG_HW_RANDOM=y
  2092. - DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb
  2093. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43legacy/b43legacy.ko
  2094. - AUTOLOAD:=$(call AutoProbe,b43legacy)
  2095. - MENU:=1
  2096. + TITLE:=Realtek Drivers for RTL818x devices
  2097. + URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
  2098. + DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
  2099. endef
  2100. -define KernelPackage/b43legacy/config
  2101. - if PACKAGE_kmod-b43legacy
  2102. -
  2103. - config B43LEGACY_FW_SQUASH
  2104. - bool "Remove unnecessary firmware files"
  2105. - default y
  2106. - help
  2107. - This options allows you to remove unnecessary b43legacy firmware files
  2108. - from the final rootfs image. This can reduce the rootfs size by
  2109. - up to 50k.
  2110. +define KernelPackage/rtl8180
  2111. + $(call KernelPackage/rtl818x/Default)
  2112. + DEPENDS+= @PCI_SUPPORT
  2113. + TITLE+= (RTL8180 PCI)
  2114. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8180/rtl818x_pci.ko
  2115. + AUTOLOAD:=$(call AutoProbe,rtl818x_pci)
  2116. +endef
  2117. - If unsure, say Y.
  2118. +define KernelPackage/rtl8187
  2119. +$(call KernelPackage/rtl818x/Default)
  2120. + DEPENDS+= @USB_SUPPORT +kmod-usb-core
  2121. + TITLE+= (RTL8187 USB)
  2122. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
  2123. + AUTOLOAD:=$(call AutoProbe,rtl8187)
  2124. +endef
  2125. - config B43LEGACY_FW_SQUASH_COREREVS
  2126. - string "Core revisions to include"
  2127. - depends on B43LEGACY_FW_SQUASH
  2128. - default "1,2,3,4"
  2129. +define KernelPackage/rtlwifi/config
  2130. + config PACKAGE_RTLWIFI_DEBUG
  2131. + bool "Realtek wireless debugging"
  2132. + depends on PACKAGE_kmod-rtlwifi
  2133. help
  2134. - This is a comma seperated list of core revision numbers.
  2135. + Say Y, if you want to debug realtek wireless drivers.
  2136. - Example (keep files for rev4 only):
  2137. - 4
  2138. +endef
  2139. - Example (keep files for rev2 and rev4):
  2140. - 2,4
  2141. +define KernelPackage/rtlwifi
  2142. + $(call KernelPackage/mac80211/Default)
  2143. + TITLE:=Realtek common driver part
  2144. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2145. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtlwifi.ko
  2146. + HIDDEN:=1
  2147. +endef
  2148. - endif
  2149. +define KernelPackage/rtlwifi-pci
  2150. + $(call KernelPackage/mac80211/Default)
  2151. + TITLE:=Realtek common driver part (PCI support)
  2152. + DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi
  2153. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_pci.ko
  2154. + AUTOLOAD:=$(call AutoProbe,rtl_pci)
  2155. + HIDDEN:=1
  2156. endef
  2157. -define KernelPackage/b43legacy/description
  2158. -Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
  2159. +define KernelPackage/rtlwifi-usb
  2160. + $(call KernelPackage/mac80211/Default)
  2161. + TITLE:=Realtek common driver part (USB support)
  2162. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi
  2163. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_usb.ko
  2164. + AUTOLOAD:=$(call AutoProbe,rtl_usb)
  2165. + HIDDEN:=1
  2166. endef
  2167. +define KernelPackage/rtl8192c-common
  2168. + $(call KernelPackage/mac80211/Default)
  2169. + TITLE:=Realtek RTL8192CE/RTL8192CU common support module
  2170. + DEPENDS+= +kmod-rtlwifi
  2171. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
  2172. + HIDDEN:=1
  2173. +endef
  2174. -define KernelPackage/brcmutil
  2175. +define KernelPackage/rtl8192ce
  2176. $(call KernelPackage/mac80211/Default)
  2177. - TITLE:=Broadcom IEEE802.11n common driver parts
  2178. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2179. - DEPENDS+=@PCI_SUPPORT||USB_SUPPORT
  2180. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmutil/brcmutil.ko
  2181. - AUTOLOAD:=$(call AutoProbe,brcmutil)
  2182. - MENU:=1
  2183. + TITLE:=Realtek RTL8192CE/RTL8188CE support
  2184. + DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common
  2185. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko
  2186. + AUTOLOAD:=$(call AutoProbe,rtl8192ce)
  2187. endef
  2188. -define KernelPackage/brcmutil/description
  2189. - This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac.
  2190. +define KernelPackage/rtl8192ce/install
  2191. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2192. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfw.bin $(1)/lib/firmware/rtlwifi
  2193. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU.bin $(1)/lib/firmware/rtlwifi
  2194. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU_B.bin $(1)/lib/firmware/rtlwifi
  2195. endef
  2196. -define KernelPackage/brcmutil/config
  2197. - if PACKAGE_kmod-brcmutil
  2198. +define KernelPackage/rtl8192se
  2199. + $(call KernelPackage/mac80211/Default)
  2200. + TITLE:=Realtek RTL8192SE/RTL8191SE support
  2201. + DEPENDS+= +kmod-rtlwifi-pci
  2202. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192se/rtl8192se.ko
  2203. + AUTOLOAD:=$(call AutoProbe,rtl8192se)
  2204. +endef
  2205. - config PACKAGE_BRCM80211_DEBUG
  2206. - bool "Broadcom wireless driver debugging"
  2207. - help
  2208. - Say Y, if you want to debug brcmsmac and brcmfmac wireless driver.
  2209. +define KernelPackage/rtl8192se/install
  2210. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2211. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  2212. +endef
  2213. - endif
  2214. +define KernelPackage/rtl8192de
  2215. + $(call KernelPackage/mac80211/Default)
  2216. + TITLE:=Realtek RTL8192DE/RTL8188DE support
  2217. + DEPENDS+= +kmod-rtlwifi-pci
  2218. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192de/rtl8192de.ko
  2219. + AUTOLOAD:=$(call AutoProbe,rtl8192de)
  2220. endef
  2221. -PKG_BRCMSMAC_FW_NAME:=broadcom-wl
  2222. -PKG_BRCMSMAC_FW_VERSION:=5.100.138
  2223. -PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o
  2224. -PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2
  2225. -PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  2226. -PKG_BRCMSMAC_FW_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  2227. +define KernelPackage/rtl8192de/install
  2228. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2229. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192defw.bin $(1)/lib/firmware/rtlwifi
  2230. +endef
  2231. -define Download/brcmsmac
  2232. - FILE:=$(PKG_BRCMSMAC_FW_SOURCE)
  2233. - URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL)
  2234. - MD5SUM:=$(PKG_BRCMSMAC_FW_MD5SUM)
  2235. +define KernelPackage/rtl8192cu
  2236. + $(call KernelPackage/mac80211/Default)
  2237. + TITLE:=Realtek RTL8192CU/RTL8188CU support
  2238. + DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common
  2239. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko
  2240. + AUTOLOAD:=$(call AutoProbe,rtl8192cu)
  2241. endef
  2242. -$(eval $(call Download,brcmsmac))
  2243. -define KernelPackage/brcmsmac
  2244. +define KernelPackage/rtl8192cu/install
  2245. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2246. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw.bin $(1)/lib/firmware/rtlwifi
  2247. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_A.bin $(1)/lib/firmware/rtlwifi
  2248. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_B.bin $(1)/lib/firmware/rtlwifi
  2249. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_TMSC.bin $(1)/lib/firmware/rtlwifi
  2250. +endef
  2251. +
  2252. +
  2253. +define KernelPackage/wlcore
  2254. $(call KernelPackage/mac80211/Default)
  2255. - TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
  2256. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2257. - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil
  2258. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmsmac/brcmsmac.ko
  2259. - AUTOLOAD:=$(call AutoProbe,brcmsmac)
  2260. - MENU:=1
  2261. + TITLE:=TI common driver part
  2262. + DEPENDS+= @TARGET_omap +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2263. + FILES:= \
  2264. + $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
  2265. + $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
  2266. + AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
  2267. endef
  2268. -define KernelPackage/brcmsmac/description
  2269. - Kernel module for Broadcom IEEE802.11n PCIe Wireless cards
  2270. +define KernelPackage/wlcore/description
  2271. + This module contains some common parts needed by TI Wireless drivers.
  2272. endef
  2273. -define KernelPackage/brcmsmac/config
  2274. - if PACKAGE_kmod-brcmsmac
  2275. +define KernelPackage/wl12xx
  2276. + $(call KernelPackage/mac80211/Default)
  2277. + TITLE:=Driver for TI WL12xx
  2278. + URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
  2279. + DEPENDS+= +kmod-wlcore
  2280. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
  2281. + AUTOLOAD:=$(call AutoProbe,wl12xx)
  2282. +endef
  2283. - config BRCMSMAC_USE_FW_FROM_WL
  2284. - bool "Use firmware extracted from broadcom proprietary driver"
  2285. - default y
  2286. - help
  2287. - Instead of using the official brcmsmac firmware a firmware
  2288. - version 666.2 extracted from the proprietary Broadcom driver
  2289. - is used. This is needed to get core rev 17 used in bcm4716
  2290. - to work.
  2291. +define KernelPackage/wl12xx/description
  2292. + Kernel modules for TI WL12xx
  2293. +endef
  2294. - If unsure, say Y.
  2295. +define KernelPackage/wl18xx
  2296. + $(call KernelPackage/mac80211/Default)
  2297. + TITLE:=Driver for TI WL18xx
  2298. + URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
  2299. + DEPENDS+= +kmod-wlcore
  2300. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
  2301. + AUTOLOAD:=$(call AutoProbe,wl18xx)
  2302. +endef
  2303. - endif
  2304. +define KernelPackage/wl18xx/description
  2305. + Kernel modules for TI WL18xx
  2306. endef
  2307. -define KernelPackage/brcmfmac
  2308. - $(call KernelPackage/mac80211/Default)
  2309. - TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
  2310. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2311. - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_USB:kmod-usb-core
  2312. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko
  2313. - AUTOLOAD:=$(call AutoProbe,brcmfmac)
  2314. +ZD1211FW_NAME:=zd1211-firmware
  2315. +ZD1211FW_VERSION:=1.4
  2316. +define Download/zd1211rw
  2317. + FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  2318. + URL:=@SF/zd1211/
  2319. + MD5SUM:=19f28781d76569af8551c9d11294c870
  2320. endef
  2321. +$(eval $(call Download,zd1211rw))
  2322. -define KernelPackage/brcmfmac/description
  2323. - Kernel module for Broadcom IEEE802.11n USB Wireless cards
  2324. +define KernelPackage/zd1211rw
  2325. + $(call KernelPackage/mac80211/Default)
  2326. + TITLE:=Zydas ZD1211 support
  2327. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  2328. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zd1211rw/zd1211rw.ko
  2329. + AUTOLOAD:=$(call AutoProbe,zd1211rw)
  2330. endef
  2331. -define KernelPackage/brcmfmac/config
  2332. - if PACKAGE_kmod-brcmfmac
  2333. -
  2334. - config BRCMFMAC_SDIO
  2335. - bool "Enable SDIO bus interface support"
  2336. - default n
  2337. - help
  2338. - Enable support for cards attached to an SDIO bus.
  2339. - Select this option only if you are sure that your
  2340. - board has a Broadcom wireless chip atacched to
  2341. - that bus.
  2342. -
  2343. - config BRCMFMAC_USB
  2344. - bool "Enable USB bus interface support"
  2345. - depends on USB_SUPPORT
  2346. - default y
  2347. - help
  2348. - Supported USB connected chipsets:
  2349. - BCM43235, BCM43236, BCM43238 (all in revision 3 only)
  2350. - BCM43143, BCM43242, BCM43566, BCM43569
  2351. -
  2352. - config BRCMFMAC_PCIE
  2353. - bool "Enable PCIE bus interface support"
  2354. - depends on PCI_SUPPORT
  2355. - default y
  2356. - help
  2357. - Supported PCIe connected chipsets:
  2358. - BCM4354, BCM4356, BCM43567, BCM43570, BCM43602
  2359. - endif
  2360. -endef
  2361. config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m)
  2362. @@ -1602,6 +1684,8 @@ config-$(CONFIG_BRCMFMAC_PCIE) += BRCMFMAC_PCIE
  2363. config-$(CONFIG_PACKAGE_BRCM80211_DEBUG) += BRCMDBG
  2364. config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
  2365. +config-$(call config_package,mt7601u) += MT7601U
  2366. +config-y += WL_MEDIATEK
  2367. config-$(call config_package,rt2x00-lib) += RT2X00 RT2X00_LIB
  2368. config-$(call config_package,rt2x00-pci) += RT2X00_LIB_PCI
  2369. @@ -1623,26 +1707,28 @@ config-$(call config_package,rt2800-pci) += RT2800PCI
  2370. config-y += RT2800PCI_RT33XX RT2800PCI_RT35XX RT2800PCI_RT53XX RT2800PCI_RT3290
  2371. config-$(call config_package,rt2800-usb) += RT2800USB
  2372. -config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX
  2373. +config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX RT2800USB_UNKNOWN
  2374. config-$(call config_package,iwl-legacy) += IWLEGACY
  2375. config-$(call config_package,iwl3945) += IWL3945
  2376. config-$(call config_package,iwl4965) += IWL4965
  2377. -config-$(call config_package,iwlagn) += IWLWIFI IWLDVM
  2378. +config-$(call config_package,iwlwifi) += IWLWIFI IWLDVM IWLMVM
  2379. +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUG)+= IWLWIFI_DEBUG
  2380. +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUGFS)+= IWLWIFI_DEBUGFS
  2381. -config-$(call config_package,net-libipw) += LIBIPW
  2382. -config-$(call config_package,net-ipw2100) += IPW2100
  2383. -config-$(call config_package,net-ipw2200) += IPW2200
  2384. +config-$(call config_package,libipw) += LIBIPW
  2385. +config-$(call config_package,ipw2100) += IPW2100
  2386. +config-$(call config_package,ipw2200) += IPW2200
  2387. config-$(call config_package,p54-common) += P54_COMMON
  2388. config-$(call config_package,p54-pci) += P54_PCI
  2389. config-$(call config_package,p54-usb) += P54_USB
  2390. config-$(call config_package,p54-spi) += P54_SPI
  2391. -config-$(call config_package,net-hermes) += HERMES
  2392. -config-$(call config_package,net-hermes-pci) += PCI_HERMES
  2393. -config-$(call config_package,net-hermes-plx) += PLX_HERMES
  2394. -config-$(call config_package,net-hermes-pcmcia) += PCMCIA_HERMES
  2395. +config-$(call config_package,hermes) += HERMES
  2396. +config-$(call config_package,hermes-pci) += PCI_HERMES
  2397. +config-$(call config_package,hermes-plx) += PLX_HERMES
  2398. +config-$(call config_package,hermes-pcmcia) += PCMCIA_HERMES
  2399. config-y += HERMES_PRISM
  2400. config-$(call config_package,adm8211) += ADM8211
  2401. @@ -1702,8 +1788,9 @@ define Build/Prepare
  2402. $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  2403. $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  2404. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  2405. - $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_LINUX_FIRMWARE_SOURCE)
  2406. + $(TAR) -C $(PKG_BUILD_DIR) -xJf $(DL_DIR)/$(PKG_LINUX_FIRMWARE_SOURCE)
  2407. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  2408. + $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_MT7601U_FW_SOURCE)
  2409. rm -rf \
  2410. $(PKG_BUILD_DIR)/include/linux/ssb \
  2411. $(PKG_BUILD_DIR)/include/linux/bcma \
  2412. @@ -1739,233 +1826,37 @@ define Build/Compile
  2413. $(MAKE) $(MAKE_OPTS) allnoconfig
  2414. $(call Build/Compile/kmod)
  2415. endef
  2416. -
  2417. -define Build/InstallDev
  2418. - mkdir -p \
  2419. - $(1)/usr/include/mac80211 \
  2420. - $(1)/usr/include/mac80211-backport \
  2421. - $(1)/usr/include/mac80211/ath \
  2422. - $(1)/usr/include/net/mac80211
  2423. - $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
  2424. - $(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
  2425. - $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
  2426. - $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
  2427. - rm -f $(1)/usr/include/mac80211-backport/linux/module.h
  2428. -endef
  2429. -
  2430. -define KernelPackage/libertas-usb/install
  2431. - $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2432. - $(INSTALL_DATA) \
  2433. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8388_v9.bin \
  2434. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8682.bin \
  2435. - $(1)/lib/firmware/libertas/
  2436. -endef
  2437. -
  2438. -define KernelPackage/libertas-sdio/install
  2439. - $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2440. - $(INSTALL_DATA) \
  2441. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385_helper.bin \
  2442. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385.bin \
  2443. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9_helper.bin \
  2444. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9.bin \
  2445. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688_helper.bin \
  2446. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688.bin \
  2447. - $(1)/lib/firmware/libertas
  2448. -endef
  2449. -
  2450. -define KernelPackage/cfg80211/install
  2451. - $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  2452. - $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  2453. - $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  2454. -endef
  2455. -
  2456. -define KernelPackage/p54-pci/install
  2457. - $(INSTALL_DIR) $(1)/lib/firmware
  2458. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  2459. -endef
  2460. -
  2461. -define KernelPackage/p54-usb/install
  2462. - $(INSTALL_DIR) $(1)/lib/firmware
  2463. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  2464. -endef
  2465. -
  2466. -define KernelPackage/p54-spi/install
  2467. - $(INSTALL_DIR) $(1)/lib/firmware
  2468. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  2469. -endef
  2470. -
  2471. -define KernelPackage/rt61-pci/install
  2472. - $(INSTALL_DIR) $(1)/lib/firmware
  2473. - $(INSTALL_DATA) \
  2474. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561.bin \
  2475. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561s.bin \
  2476. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2661.bin \
  2477. - $(1)/lib/firmware/
  2478. -endef
  2479. -
  2480. -define KernelPackage/rt73-usb/install
  2481. - $(INSTALL_DIR) $(1)/lib/firmware
  2482. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt73.bin $(1)/lib/firmware/
  2483. -endef
  2484. -
  2485. -define KernelPackage/rt2800-pci/install
  2486. - $(INSTALL_DIR) $(1)/lib/firmware
  2487. - $(INSTALL_DATA) \
  2488. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2860.bin \
  2489. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt3290.bin \
  2490. - $(1)/lib/firmware
  2491. -endef
  2492. -
  2493. -define KernelPackage/rt2800-usb/install
  2494. - $(INSTALL_DIR) $(1)/lib/firmware
  2495. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2870.bin $(1)/lib/firmware/
  2496. -endef
  2497. -
  2498. -define KernelPackage/wl12xx/install
  2499. - $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2500. - $(INSTALL_DATA) \
  2501. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-mr.bin \
  2502. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-plt.bin \
  2503. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-sr.bin \
  2504. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl1271-nvs.bin \
  2505. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-mr.bin \
  2506. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-plt.bin \
  2507. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-sr.bin \
  2508. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-nvs.bin \
  2509. - $(1)/lib/firmware/ti-connectivity
  2510. -endef
  2511. -
  2512. -define KernelPackage/wl18xx/install
  2513. - $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2514. - $(INSTALL_DATA) \
  2515. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-conf.bin \
  2516. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-fw-3.bin \
  2517. - $(1)/lib/firmware/ti-connectivity
  2518. -endef
  2519. -
  2520. -define KernelPackage/zd1211rw/install
  2521. - $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  2522. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  2523. -endef
  2524. -
  2525. -define KernelPackage/carl9170/install
  2526. - $(INSTALL_DIR) $(1)/lib/firmware
  2527. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/carl9170-1.fw $(1)/lib/firmware
  2528. -endef
  2529. -
  2530. -define KernelPackage/ath9k-htc/install
  2531. - $(INSTALL_DIR) $(1)/lib/firmware
  2532. - $(INSTALL_DATA) \
  2533. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
  2534. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
  2535. - $(1)/lib/firmware/
  2536. -endef
  2537. -
  2538. -define KernelPackage/ath10k/install
  2539. - $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  2540. - $(INSTALL_DATA) \
  2541. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/ath10k/QCA988X/hw2.0/board.bin \
  2542. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  2543. -ifeq ($(CONFIG_ATH10K_STA_FW),y)
  2544. - $(INSTALL_DATA) \
  2545. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/main/firmware-2.bin_999.999.0.636 \
  2546. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  2547. -else ifeq ($(CONFIG_ATH10K_API2_FW),y)
  2548. - $(INSTALL_DATA) \
  2549. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.1/firmware-2.bin_10.1.467.2-1 \
  2550. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  2551. -else
  2552. - $(INSTALL_DATA) \
  2553. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/firmware-4.bin_10.2.4.45 \
  2554. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-4.bin
  2555. -endif
  2556. -endef
  2557. -
  2558. -define KernelPackage/mwl8k/install
  2559. - $(INSTALL_DIR) $(1)/lib/firmware/mwl8k
  2560. - $(INSTALL_DATA) \
  2561. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366_ap-3.fw \
  2562. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366.fw \
  2563. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8366.fw \
  2564. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8687.fw \
  2565. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8687.fw \
  2566. - $(1)/lib/firmware/mwl8k/
  2567. -endef
  2568. -
  2569. -define KernelPackage/mwifiex-pcie/install
  2570. - $(INSTALL_DIR) $(1)/lib/firmware/mrvl
  2571. - $(INSTALL_DATA) \
  2572. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mrvl/pcie8897_uapsta.bin \
  2573. - $(1)/lib/firmware/mrvl/
  2574. -endef
  2575. -
  2576. -define KernelPackage/net-ipw2100/install
  2577. - $(INSTALL_DIR) $(1)/lib/firmware
  2578. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
  2579. -endef
  2580. -
  2581. -define KernelPackage/net-ipw2200/install
  2582. - $(INSTALL_DIR) $(1)/lib/firmware
  2583. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  2584. -endef
  2585. -
  2586. -define KernelPackage/iwlagn/install
  2587. - $(INSTALL_DIR) $(1)/lib/firmware
  2588. -ifneq ($(CONFIG_IWL5000_FW),)
  2589. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5000-5.ucode $(1)/lib/firmware
  2590. -endif
  2591. -ifneq ($(CONFIG_IWL5150_FW),)
  2592. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5150-2.ucode $(1)/lib/firmware
  2593. -endif
  2594. -ifneq ($(CONFIG_IWL1000_FW),)
  2595. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-1000-5.ucode $(1)/lib/firmware
  2596. -endif
  2597. -ifneq ($(CONFIG_IWL6000_FW),)
  2598. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000-4.ucode $(1)/lib/firmware
  2599. -endif
  2600. -ifneq ($(CONFIG_IWL6050_FW),)
  2601. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6050-5.ucode $(1)/lib/firmware
  2602. -endif
  2603. -ifneq ($(CONFIG_IWL6005_FW),)
  2604. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2a-6.ucode $(1)/lib/firmware
  2605. -endif
  2606. -ifneq ($(CONFIG_IWL6030_FW),)
  2607. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2b-6.ucode $(1)/lib/firmware
  2608. -endif
  2609. -ifneq ($(CONFIG_IWL7260_FW),)
  2610. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7260-9.ucode $(1)/lib/firmware
  2611. -endif
  2612. -ifneq ($(CONFIG_IWL7265_FW),)
  2613. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265-9.ucode $(1)/lib/firmware
  2614. -endif
  2615. -ifneq ($(CONFIG_IWL100_FW),)
  2616. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-100-5.ucode $(1)/lib/firmware
  2617. -endif
  2618. -ifneq ($(CONFIG_IWL2000_FW),)
  2619. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2000-6.ucode $(1)/lib/firmware
  2620. -endif
  2621. -ifneq ($(CONFIG_IWL2030_FW),)
  2622. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2030-6.ucode $(1)/lib/firmware
  2623. -endif
  2624. -ifneq ($(CONFIG_IWL105_FW),)
  2625. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-105-6.ucode $(1)/lib/firmware
  2626. -endif
  2627. -ifneq ($(CONFIG_IWL135_FW),)
  2628. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-135-6.ucode $(1)/lib/firmware
  2629. -endif
  2630. -ifneq ($(CONFIG_IWL3160_FW),)
  2631. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3160-9.ucode $(1)/lib/firmware
  2632. -endif
  2633. +
  2634. +define Build/InstallDev
  2635. + mkdir -p \
  2636. + $(1)/usr/include/mac80211 \
  2637. + $(1)/usr/include/mac80211-backport \
  2638. + $(1)/usr/include/mac80211/ath \
  2639. + $(1)/usr/include/net/mac80211
  2640. + $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
  2641. + $(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
  2642. + $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
  2643. + $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
  2644. + rm -f $(1)/usr/include/mac80211-backport/linux/module.h
  2645. endef
  2646. -define KernelPackage/iwl3945/install
  2647. +
  2648. +define KernelPackage/ath9k-htc/install
  2649. $(INSTALL_DIR) $(1)/lib/firmware
  2650. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3945-2.ucode $(1)/lib/firmware
  2651. + $(INSTALL_DATA) \
  2652. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
  2653. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
  2654. + $(1)/lib/firmware/
  2655. endef
  2656. -define KernelPackage/iwl4965/install
  2657. - $(INSTALL_DIR) $(1)/lib/firmware
  2658. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware
  2659. +define KernelPackage/ath10k/install
  2660. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  2661. + $(INSTALL_DATA) \
  2662. + $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/ath10k/QCA988X/hw2.0/board.bin \
  2663. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  2664. + $(INSTALL_DATA) \
  2665. + $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/untested/firmware-5.bin_10.2.4.70-2 \
  2666. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  2667. endef
  2668. define KernelPackage/b43/install
  2669. @@ -2028,13 +1919,237 @@ ifneq ($(CONFIG_BRCMFMAC_PCIE),)
  2670. endif
  2671. endef
  2672. +define KernelPackage/carl9170/install
  2673. + $(INSTALL_DIR) $(1)/lib/firmware
  2674. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/carl9170-1.fw $(1)/lib/firmware
  2675. +endef
  2676. +
  2677. +define KernelPackage/cfg80211/install
  2678. + $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  2679. + $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  2680. + $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  2681. +endef
  2682. +
  2683. +define KernelPackage/ipw2100/install
  2684. + $(INSTALL_DIR) $(1)/lib/firmware
  2685. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
  2686. +endef
  2687. +
  2688. +define KernelPackage/ipw2200/install
  2689. + $(INSTALL_DIR) $(1)/lib/firmware
  2690. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  2691. +endef
  2692. +
  2693. +define KernelPackage/iwlwifi/install
  2694. + $(INSTALL_DIR) $(1)/lib/firmware
  2695. +ifneq ($(CONFIG_IWL100_FW),)
  2696. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-100-5.ucode $(1)/lib/firmware
  2697. +endif
  2698. +ifneq ($(CONFIG_IWL1000_FW),)
  2699. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-1000-5.ucode $(1)/lib/firmware
  2700. +endif
  2701. +ifneq ($(CONFIG_IWL105_FW),)
  2702. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-105-6.ucode $(1)/lib/firmware
  2703. +endif
  2704. +ifneq ($(CONFIG_IWL135_FW),)
  2705. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-135-6.ucode $(1)/lib/firmware
  2706. +endif
  2707. +ifneq ($(CONFIG_IWL2000_FW),)
  2708. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2000-6.ucode $(1)/lib/firmware
  2709. +endif
  2710. +ifneq ($(CONFIG_IWL2030_FW),)
  2711. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2030-6.ucode $(1)/lib/firmware
  2712. +endif
  2713. +ifneq ($(CONFIG_IWL3160_FW),)
  2714. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3160-13.ucode $(1)/lib/firmware
  2715. +endif
  2716. +ifneq ($(CONFIG_IWL5000_FW),)
  2717. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5000-5.ucode $(1)/lib/firmware
  2718. +endif
  2719. +ifneq ($(CONFIG_IWL5150_FW),)
  2720. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5150-2.ucode $(1)/lib/firmware
  2721. +endif
  2722. +ifneq ($(CONFIG_IWL6000_FW),)
  2723. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000-4.ucode $(1)/lib/firmware
  2724. +endif
  2725. +ifneq ($(CONFIG_IWL6005_FW),)
  2726. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2a-6.ucode $(1)/lib/firmware
  2727. +endif
  2728. +ifneq ($(CONFIG_IWL6030_FW),)
  2729. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2b-6.ucode $(1)/lib/firmware
  2730. +endif
  2731. +ifneq ($(CONFIG_IWL6050_FW),)
  2732. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6050-5.ucode $(1)/lib/firmware
  2733. +endif
  2734. +ifneq ($(CONFIG_IWL7260_FW),)
  2735. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7260-13.ucode $(1)/lib/firmware
  2736. +endif
  2737. +ifneq ($(CONFIG_IWL7265_FW),)
  2738. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265-13.ucode $(1)/lib/firmware
  2739. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265D-13.ucode $(1)/lib/firmware
  2740. +endif
  2741. +ifneq ($(CONFIG_IWL8000_FW),)
  2742. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-8000C-13.ucode $(1)/lib/firmware
  2743. +endif
  2744. +endef
  2745. +
  2746. +define KernelPackage/iwl3945/install
  2747. + $(INSTALL_DIR) $(1)/lib/firmware
  2748. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3945-2.ucode $(1)/lib/firmware
  2749. +endef
  2750. +
  2751. +define KernelPackage/iwl4965/install
  2752. + $(INSTALL_DIR) $(1)/lib/firmware
  2753. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware
  2754. +endef
  2755. +
  2756. +define KernelPackage/libertas-usb/install
  2757. + $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2758. + $(INSTALL_DATA) \
  2759. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8388_v9.bin \
  2760. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8682.bin \
  2761. + $(1)/lib/firmware/libertas/
  2762. +endef
  2763. +
  2764. +define KernelPackage/libertas-sdio/install
  2765. + $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2766. + $(INSTALL_DATA) \
  2767. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385_helper.bin \
  2768. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385.bin \
  2769. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9_helper.bin \
  2770. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9.bin \
  2771. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688_helper.bin \
  2772. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688.bin \
  2773. + $(1)/lib/firmware/libertas
  2774. +endef
  2775. +
  2776. +define KernelPackage/mt7601u/install
  2777. + $(INSTALL_DIR) $(1)/lib/firmware
  2778. + $(INSTALL_DATA) \
  2779. + $(PKG_BUILD_DIR)/$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION)/mcu/bin/MT7601.bin \
  2780. + $(1)/lib/firmware/mt7601u.bin
  2781. +endef
  2782. +
  2783. +define KernelPackage/mwl8k/install
  2784. + $(INSTALL_DIR) $(1)/lib/firmware/mwl8k
  2785. + $(INSTALL_DATA) \
  2786. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366_ap-3.fw \
  2787. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366.fw \
  2788. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8366.fw \
  2789. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8687.fw \
  2790. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8687.fw \
  2791. + $(1)/lib/firmware/mwl8k/
  2792. +endef
  2793. +
  2794. +define KernelPackage/mwifiex-pcie/install
  2795. + $(INSTALL_DIR) $(1)/lib/firmware/mrvl
  2796. + $(INSTALL_DATA) \
  2797. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mrvl/pcie8897_uapsta.bin \
  2798. + $(1)/lib/firmware/mrvl/
  2799. +endef
  2800. +
  2801. +define KernelPackage/p54-pci/install
  2802. + $(INSTALL_DIR) $(1)/lib/firmware
  2803. + $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  2804. +endef
  2805. +
  2806. +define KernelPackage/p54-usb/install
  2807. + $(INSTALL_DIR) $(1)/lib/firmware
  2808. + $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  2809. +endef
  2810. +
  2811. +define KernelPackage/p54-spi/install
  2812. + $(INSTALL_DIR) $(1)/lib/firmware
  2813. + $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  2814. +endef
  2815. +
  2816. +define KernelPackage/rt2800-pci/install
  2817. + $(INSTALL_DIR) $(1)/lib/firmware
  2818. + $(INSTALL_DATA) \
  2819. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2860.bin \
  2820. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt3290.bin \
  2821. + $(1)/lib/firmware
  2822. +endef
  2823. +
  2824. +define KernelPackage/rt2800-usb/install
  2825. + $(INSTALL_DIR) $(1)/lib/firmware
  2826. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2870.bin $(1)/lib/firmware/
  2827. +endef
  2828. +
  2829. +define KernelPackage/rt61-pci/install
  2830. + $(INSTALL_DIR) $(1)/lib/firmware
  2831. + $(INSTALL_DATA) \
  2832. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561.bin \
  2833. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561s.bin \
  2834. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2661.bin \
  2835. + $(1)/lib/firmware/
  2836. +endef
  2837. +
  2838. +define KernelPackage/rt73-usb/install
  2839. + $(INSTALL_DIR) $(1)/lib/firmware
  2840. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt73.bin $(1)/lib/firmware/
  2841. +endef
  2842. +
  2843. +define KernelPackage/wl12xx/install
  2844. + $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2845. + $(INSTALL_DATA) \
  2846. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-mr.bin \
  2847. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-plt.bin \
  2848. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-sr.bin \
  2849. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl1271-nvs.bin \
  2850. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-mr.bin \
  2851. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-plt.bin \
  2852. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-sr.bin \
  2853. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-nvs.bin \
  2854. + $(1)/lib/firmware/ti-connectivity
  2855. +endef
  2856. +
  2857. +define KernelPackage/wl18xx/install
  2858. + $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2859. + $(INSTALL_DATA) \
  2860. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-fw-4.bin \
  2861. + $(1)/lib/firmware/ti-connectivity
  2862. +endef
  2863. +
  2864. +define KernelPackage/zd1211rw/install
  2865. + $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  2866. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  2867. +endef
  2868. +
  2869. +
  2870. $(eval $(call KernelPackage,adm8211))
  2871. +$(eval $(call KernelPackage,ath))
  2872. +$(eval $(call KernelPackage,ath10k))
  2873. $(eval $(call KernelPackage,ath5k))
  2874. +$(eval $(call KernelPackage,ath9k))
  2875. +$(eval $(call KernelPackage,ath9k-common))
  2876. +$(eval $(call KernelPackage,ath9k-htc))
  2877. +$(eval $(call KernelPackage,b43))
  2878. +$(eval $(call KernelPackage,b43legacy))
  2879. +$(eval $(call KernelPackage,brcmsmac))
  2880. +$(eval $(call KernelPackage,brcmfmac))
  2881. +$(eval $(call KernelPackage,brcmutil))
  2882. +$(eval $(call KernelPackage,carl9170))
  2883. +$(eval $(call KernelPackage,cfg80211))
  2884. +$(eval $(call KernelPackage,hermes))
  2885. +$(eval $(call KernelPackage,hermes-pci))
  2886. +$(eval $(call KernelPackage,hermes-plx))
  2887. +$(eval $(call KernelPackage,hermes-pcmcia))
  2888. +$(eval $(call KernelPackage,iwlwifi))
  2889. +$(eval $(call KernelPackage,iwl-legacy))
  2890. +$(eval $(call KernelPackage,iwl4965))
  2891. +$(eval $(call KernelPackage,iwl3945))
  2892. $(eval $(call KernelPackage,lib80211))
  2893. $(eval $(call KernelPackage,libertas-usb))
  2894. $(eval $(call KernelPackage,libertas-sdio))
  2895. -$(eval $(call KernelPackage,cfg80211))
  2896. +$(eval $(call KernelPackage,libipw))
  2897. +$(eval $(call KernelPackage,ipw2100))
  2898. +$(eval $(call KernelPackage,ipw2200))
  2899. $(eval $(call KernelPackage,mac80211))
  2900. +$(eval $(call KernelPackage,mac80211-hwsim))
  2901. +$(eval $(call KernelPackage,mt7601u))
  2902. +$(eval $(call KernelPackage,mwl8k))
  2903. +$(eval $(call KernelPackage,mwifiex-pcie))
  2904. $(eval $(call KernelPackage,p54-common))
  2905. $(eval $(call KernelPackage,p54-pci))
  2906. $(eval $(call KernelPackage,p54-usb))
  2907. @@ -2047,12 +2162,12 @@ $(eval $(call KernelPackage,rt2800-lib))
  2908. $(eval $(call KernelPackage,rt2400-pci))
  2909. $(eval $(call KernelPackage,rt2500-pci))
  2910. $(eval $(call KernelPackage,rt2500-usb))
  2911. -$(eval $(call KernelPackage,rt61-pci))
  2912. -$(eval $(call KernelPackage,rt73-usb))
  2913. $(eval $(call KernelPackage,rt2800-mmio))
  2914. $(eval $(call KernelPackage,rt2800-soc))
  2915. $(eval $(call KernelPackage,rt2800-pci))
  2916. $(eval $(call KernelPackage,rt2800-usb))
  2917. +$(eval $(call KernelPackage,rt61-pci))
  2918. +$(eval $(call KernelPackage,rt73-usb))
  2919. $(eval $(call KernelPackage,rtl8180))
  2920. $(eval $(call KernelPackage,rtl8187))
  2921. $(eval $(call KernelPackage,rtlwifi))
  2922. @@ -2063,32 +2178,7 @@ $(eval $(call KernelPackage,rtl8192ce))
  2923. $(eval $(call KernelPackage,rtl8192se))
  2924. $(eval $(call KernelPackage,rtl8192de))
  2925. $(eval $(call KernelPackage,rtl8192cu))
  2926. -$(eval $(call KernelPackage,zd1211rw))
  2927. -$(eval $(call KernelPackage,mac80211-hwsim))
  2928. -$(eval $(call KernelPackage,ath9k-common))
  2929. -$(eval $(call KernelPackage,ath9k))
  2930. -$(eval $(call KernelPackage,ath9k-htc))
  2931. -$(eval $(call KernelPackage,ath10k))
  2932. -$(eval $(call KernelPackage,ath))
  2933. -$(eval $(call KernelPackage,carl9170))
  2934. -$(eval $(call KernelPackage,b43))
  2935. -$(eval $(call KernelPackage,b43legacy))
  2936. -$(eval $(call KernelPackage,brcmutil))
  2937. -$(eval $(call KernelPackage,brcmsmac))
  2938. -$(eval $(call KernelPackage,brcmfmac))
  2939. -$(eval $(call KernelPackage,net-libipw))
  2940. -$(eval $(call KernelPackage,net-ipw2100))
  2941. -$(eval $(call KernelPackage,net-ipw2200))
  2942. -$(eval $(call KernelPackage,iwlagn))
  2943. -$(eval $(call KernelPackage,iwl-legacy))
  2944. -$(eval $(call KernelPackage,iwl4965))
  2945. -$(eval $(call KernelPackage,iwl3945))
  2946. -$(eval $(call KernelPackage,mwl8k))
  2947. -$(eval $(call KernelPackage,mwifiex-pcie))
  2948. -$(eval $(call KernelPackage,net-hermes))
  2949. -$(eval $(call KernelPackage,net-hermes-pci))
  2950. -$(eval $(call KernelPackage,net-hermes-plx))
  2951. -$(eval $(call KernelPackage,net-hermes-pcmcia))
  2952. $(eval $(call KernelPackage,wlcore))
  2953. $(eval $(call KernelPackage,wl12xx))
  2954. $(eval $(call KernelPackage,wl18xx))
  2955. +$(eval $(call KernelPackage,zd1211rw))
  2956. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  2957. index c9bc3d6..2a8d2f9 100644
  2958. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  2959. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  2960. @@ -486,7 +486,7 @@ mac80211_prepare_vif() {
  2961. # All interfaces must have unique mac addresses
  2962. # which can either be explicitly set in the device
  2963. # section, or automatically generated
  2964. - ifconfig "$ifname" hw ether "$macaddr"
  2965. + ip link set dev "$ifname" address "$macaddr"
  2966. fi
  2967. json_select ..
  2968. @@ -582,7 +582,7 @@ mac80211_setup_vif() {
  2969. json_get_vars mode
  2970. json_get_var vif_txpower txpower
  2971. - ifconfig "$ifname" up || {
  2972. + ip link set dev "$ifname" up || {
  2973. wireless_setup_vif_failed IFUP_ERROR
  2974. json_select ..
  2975. return
  2976. @@ -638,7 +638,7 @@ mac80211_interface_cleanup() {
  2977. local phy="$1"
  2978. for wdev in $(list_phy_interfaces "$phy"); do
  2979. - ifconfig "$wdev" down 2>/dev/null
  2980. + ip link set dev "$wdev" down 2>/dev/null
  2981. iw dev "$wdev" del
  2982. done
  2983. }
  2984. diff --git a/package/kernel/mac80211/files/regdb.txt b/package/kernel/mac80211/files/regdb.txt
  2985. index ba95fc6..84413fd 100644
  2986. --- a/package/kernel/mac80211/files/regdb.txt
  2987. +++ b/package/kernel/mac80211/files/regdb.txt
  2988. @@ -6,7 +6,7 @@ country 00:
  2989. # Channel 14. Only JP enables this and for 802.11b only
  2990. (2474 - 2494 @ 20), (20), NO-IR, NO-OFDM
  2991. # Channel 36 - 48
  2992. - (5170 - 5250 @ 80), (20)
  2993. + (5170 - 5250 @ 80), (20), AUTO-BW
  2994. # Channel 52 - 64
  2995. (5250 - 5330 @ 80), (20), NO-IR, DFS, AUTO-BW
  2996. # Channel 100 - 144
  2997. @@ -54,8 +54,8 @@ country AL: DFS-ETSI
  2998. country AM: DFS-ETSI
  2999. (2402 - 2482 @ 40), (20)
  3000. - (5170 - 5250 @ 80), (18)
  3001. - (5250 - 5330 @ 80), (18), DFS
  3002. + (5170 - 5250 @ 20), (18)
  3003. + (5250 - 5330 @ 20), (18), DFS
  3004. country AN: DFS-ETSI
  3005. (2402 - 2482 @ 40), (20)
  3006. @@ -85,7 +85,7 @@ country AT: DFS-ETSI
  3007. # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3008. (57000 - 66000 @ 2160), (40)
  3009. -country AU:
  3010. +country AU: DFS-ETSI
  3011. (2402 - 2482 @ 40), (20)
  3012. (5170 - 5250 @ 80), (17), AUTO-BW
  3013. (5250 - 5330 @ 80), (24), DFS, AUTO-BW
  3014. @@ -141,14 +141,20 @@ country BG: DFS-ETSI
  3015. (5170 - 5250 @ 80), (20), AUTO-BW
  3016. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3017. (5490 - 5710 @ 160), (27), DFS
  3018. + # 5 gHz Short Range Devices, ref:
  3019. + # Etsi EN 300 440-1
  3020. + # Etsi EN 300 440-2
  3021. + # http://crc.bg/files/_bg/Spisak_2015.pdf
  3022. + # http://crc.bg/files/_bg/Pravila_2015_resh24.pdf
  3023. + (5725 - 5875 @ 80), (14)
  3024. # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3025. (57000 - 66000 @ 2160), (40)
  3026. country BH: DFS-JP
  3027. (2402 - 2482 @ 40), (20)
  3028. - (5170 - 5250 @ 80), (20)
  3029. - (5250 - 5330 @ 80), (20), DFS
  3030. - (5735 - 5835 @ 80), (20)
  3031. + (5170 - 5250 @ 20), (20)
  3032. + (5250 - 5330 @ 20), (20), DFS
  3033. + (5735 - 5835 @ 20), (20)
  3034. country BL: DFS-ETSI
  3035. (2402 - 2482 @ 40), (20)
  3036. @@ -263,10 +269,10 @@ country CO: DFS-FCC
  3037. country CR: DFS-FCC
  3038. (2402 - 2482 @ 40), (20)
  3039. - (5170 - 5250 @ 80), (17)
  3040. - (5250 - 5330 @ 80), (24), DFS
  3041. - (5490 - 5730 @ 80), (24), DFS
  3042. - (5735 - 5835 @ 80), (30)
  3043. + (5170 - 5250 @ 20), (17)
  3044. + (5250 - 5330 @ 20), (24), DFS
  3045. + (5490 - 5730 @ 20), (24), DFS
  3046. + (5735 - 5835 @ 20), (30)
  3047. country CX: DFS-FCC
  3048. (2402 - 2482 @ 40), (20)
  3049. @@ -349,10 +355,10 @@ country DZ: DFS-JP
  3050. country EC: DFS-FCC
  3051. (2402 - 2482 @ 40), (20)
  3052. - (5170 - 5250 @ 80), (17)
  3053. - (5250 - 5330 @ 80), (24), DFS
  3054. - (5490 - 5730 @ 80), (24), DFS
  3055. - (5735 - 5835 @ 80), (30)
  3056. + (5170 - 5250 @ 20), (17)
  3057. + (5250 - 5330 @ 20), (24), DFS
  3058. + (5490 - 5730 @ 20), (24), DFS
  3059. + (5735 - 5835 @ 20), (30)
  3060. country EE: DFS-ETSI
  3061. (2402 - 2482 @ 40), (20)
  3062. @@ -364,8 +370,8 @@ country EE: DFS-ETSI
  3063. country EG: DFS-ETSI
  3064. (2402 - 2482 @ 40), (20)
  3065. - (5170 - 5250 @ 80), (20)
  3066. - (5250 - 5330 @ 80), (20), DFS
  3067. + (5170 - 5250 @ 40), (20)
  3068. + (5250 - 5330 @ 40), (20), DFS
  3069. # Orden IET/787/2013, de 25 de abril, por la que se aprueba
  3070. # el cuadro nacional de atribución de frecuencias.
  3071. @@ -474,10 +480,10 @@ country GT: DFS-FCC
  3072. country GU: DFS-FCC
  3073. (2402 - 2472 @ 40), (30)
  3074. - (5170 - 5250 @ 80), (17)
  3075. - (5250 - 5330 @ 80), (24), DFS
  3076. - (5490 - 5730 @ 80), (24), DFS
  3077. - (5735 - 5835 @ 80), (30)
  3078. + (5170 - 5250 @ 20), (17)
  3079. + (5250 - 5330 @ 20), (24), DFS
  3080. + (5490 - 5730 @ 20), (24), DFS
  3081. + (5735 - 5835 @ 20), (30)
  3082. country GY:
  3083. (2402 - 2482 @ 40), (30)
  3084. @@ -522,8 +528,8 @@ country HU: DFS-ETSI
  3085. country ID: DFS-JP
  3086. # ref: http://www.postel.go.id/content/ID/regulasi/standardisasi/kepdir/bwa%205,8%20ghz.pdf
  3087. - (2402 - 2482 @ 40), (20)
  3088. - (5735 - 5815 @ 80), (23)
  3089. + (2402 - 2482 @ 20), (20)
  3090. + (5735 - 5815 @ 20), (23)
  3091. country IE: DFS-ETSI
  3092. (2402 - 2482 @ 40), (20)
  3093. @@ -584,6 +590,9 @@ country JP: DFS-JP
  3094. (5170 - 5250 @ 80), (20), AUTO-BW
  3095. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3096. (5490 - 5710 @ 160), (23), DFS
  3097. + # 60 GHz band channels 2-4 at 10mW,
  3098. + # ref: http://www.arib.or.jp/english/html/overview/doc/1-STD-T74v1_1.pdf
  3099. + (59000 - 66000 @ 2160), (10 mW)
  3100. country KE: DFS-JP
  3101. (2402 - 2482 @ 40), (20)
  3102. @@ -607,11 +616,11 @@ country KN: DFS-ETSI
  3103. (5735 - 5815 @ 80), (30)
  3104. country KP: DFS-JP
  3105. - (2402 - 2482 @ 40), (20)
  3106. - (5170 - 5250 @ 80), (20), AUTO-BW
  3107. - (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3108. - (5490 - 5630 @ 80), (30), DFS
  3109. - (5735 - 5815 @ 80), (30)
  3110. + (2402 - 2482 @ 20), (20)
  3111. + (5170 - 5250 @ 20), (20)
  3112. + (5250 - 5330 @ 20), (20), DFS
  3113. + (5490 - 5630 @ 20), (30), DFS
  3114. + (5735 - 5815 @ 20), (30)
  3115. country KR: DFS-JP
  3116. (2402 - 2482 @ 40), (20)
  3117. @@ -659,10 +668,10 @@ country LI: DFS-ETSI
  3118. country LK: DFS-FCC
  3119. (2402 - 2482 @ 40), (20)
  3120. - (5170 - 5250 @ 80), (17)
  3121. - (5250 - 5330 @ 80), (24), DFS
  3122. - (5490 - 5730 @ 80), (24), DFS
  3123. - (5735 - 5835 @ 80), (30)
  3124. + (5170 - 5250 @ 20), (17)
  3125. + (5250 - 5330 @ 20), (24), DFS
  3126. + (5490 - 5730 @ 20), (24), DFS
  3127. + (5735 - 5835 @ 20), (30)
  3128. # Source:
  3129. # http://lca.org.ls/images/documents/lesotho_national_frequency_allocation_plan.pdf
  3130. @@ -751,11 +760,12 @@ country MN: DFS-FCC
  3131. (5490 - 5730 @ 160), (24), DFS
  3132. (5735 - 5835 @ 80), (30)
  3133. -country MO:
  3134. - (2402 - 2482 @ 40), (20)
  3135. - (5170 - 5250 @ 40), (23)
  3136. - (5250 - 5330 @ 40), (23), DFS
  3137. - (5735 - 5835 @ 40), (30)
  3138. +country MO: DFS-FCC
  3139. + (2402 - 2482 @ 40), (23)
  3140. + (5170 - 5250 @ 80), (23), AUTO-BW
  3141. + (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  3142. + (5490 - 5730 @ 160), (30), DFS
  3143. + (5735 - 5835 @ 80), (30)
  3144. country MP: DFS-FCC
  3145. (2402 - 2472 @ 40), (30)
  3146. @@ -793,6 +803,14 @@ country MU: DFS-FCC
  3147. (5490 - 5730 @ 160), (24), DFS
  3148. (5735 - 5835 @ 80), (30)
  3149. +# Source:
  3150. +# http://www.cam.gov.mv/docs/tech_standards/TAM-TS-100-2004-WLAN.pdf
  3151. +country MV: DFS-ETSI
  3152. + (2400 - 2483.5 @ 40), (100 mW)
  3153. + (5150 - 5250 @ 80), (200 mW), AUTO-BW
  3154. + (5250 - 5350 @ 80), (100 mW), DFS, AUTO-BW
  3155. + (5725 - 5850 @ 80), (100 mW)
  3156. +
  3157. country MW: DFS-ETSI
  3158. (2402 - 2482 @ 40), (20)
  3159. (5170 - 5250 @ 80), (20), AUTO-BW
  3160. @@ -812,6 +830,11 @@ country MY: DFS-FCC
  3161. (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  3162. (5735 - 5835 @ 80), (30)
  3163. +country NG: DFS-ETSI
  3164. + (2402 - 2482 @ 40), (20)
  3165. + (5250 - 5330 @ 80), (30), DFS
  3166. + (5735 - 5835 @ 80), (30)
  3167. +
  3168. country NI: DFS-FCC
  3169. (2402 - 2472 @ 40), (30)
  3170. (5170 - 5250 @ 80), (24), AUTO-BW
  3171. @@ -848,7 +871,7 @@ country NP: DFS-JP
  3172. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3173. (5735 - 5835 @ 80), (20)
  3174. -country NZ: DFS-FCC
  3175. +country NZ: DFS-ETSI
  3176. (2402 - 2482 @ 40), (30)
  3177. (5170 - 5250 @ 80), (17), AUTO-BW
  3178. (5250 - 5330 @ 80), (24), DFS, AUTO-BW
  3179. @@ -971,10 +994,12 @@ country RS: DFS-ETSI
  3180. country RU: DFS-ETSI
  3181. (2402 - 2482 @ 40), (20)
  3182. - (5170 - 5250 @ 80), (20)
  3183. - (5250 - 5330 @ 80), (20), DFS
  3184. - (5650 - 5730 @ 80), (30), DFS
  3185. - (5735 - 5835 @ 80), (30)
  3186. + (5170 - 5250 @ 40), (20)
  3187. + (5250 - 5330 @ 40), (20), DFS
  3188. + (5650 - 5730 @ 40), (30), DFS
  3189. + (5735 - 5835 @ 40), (30)
  3190. + # 60 GHz band channels 1-4, ref: Changes to NLA 124_Order №129_22042015.pdf
  3191. + (57000 - 66000 @ 2160), (40)
  3192. country RW: DFS-FCC
  3193. (2402 - 2482 @ 40), (20)
  3194. @@ -1037,9 +1062,9 @@ country SR: DFS-ETSI
  3195. country SV: DFS-FCC
  3196. (2402 - 2482 @ 40), (20)
  3197. - (5170 - 5250 @ 80), (17)
  3198. - (5250 - 5330 @ 80), (23), DFS
  3199. - (5735 - 5835 @ 80), (30)
  3200. + (5170 - 5250 @ 20), (17)
  3201. + (5250 - 5330 @ 20), (23), DFS
  3202. + (5735 - 5835 @ 20), (30)
  3203. country SY:
  3204. (2402 - 2482 @ 40), (20)
  3205. @@ -1099,6 +1124,10 @@ country TW: DFS-JP
  3206. (5650 - 5710 @ 40), (30), DFS
  3207. (5735 - 5835 @ 80), (30)
  3208. +country TZ:
  3209. + (2402 - 2482 @ 40), (20)
  3210. + (5735 - 5835 @ 80), (30)
  3211. +
  3212. # Source:
  3213. # #914 / 06 Sep 2007: http://www.ucrf.gov.ua/uk/doc/nkrz/1196068874
  3214. # #1174 / 23 Oct 2008: http://www.nkrz.gov.ua/uk/activities/ruling/1225269361
  3215. @@ -1125,6 +1154,7 @@ country US: DFS-FCC
  3216. (2402 - 2472 @ 40), (30)
  3217. (5170 - 5250 @ 80), (17), AUTO-BW
  3218. (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  3219. + (5490 - 5730 @ 160), (23), DFS
  3220. (5735 - 5835 @ 80), (30)
  3221. # 60g band
  3222. # reference: http://cfr.regstoday.com/47cfr15.aspx#47_CFR_15p255
  3223. @@ -1192,6 +1222,12 @@ country WF: DFS-ETSI
  3224. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3225. (5490 - 5710 @ 160), (27), DFS
  3226. +country WS: DFS-ETSI
  3227. + (2402 - 2482 @ 40), (20)
  3228. + (5170 - 5250 @ 40), (20)
  3229. + (5250 - 5330 @ 40), (20), DFS
  3230. + (5490 - 5710 @ 40), (27), DFS
  3231. +
  3232. country YE:
  3233. (2402 - 2482 @ 40), (20)
  3234. diff --git a/package/kernel/mac80211/patches/001-fix_build.patch b/package/kernel/mac80211/patches/001-fix_build.patch
  3235. index 818983e..402649d 100644
  3236. --- a/package/kernel/mac80211/patches/001-fix_build.patch
  3237. +++ b/package/kernel/mac80211/patches/001-fix_build.patch
  3238. @@ -27,7 +27,7 @@
  3239. @set -e ; test -f .local-symbols || ( \
  3240. echo "/--------------" ;\
  3241. echo "| You shouldn't run make in the backports tree, but only in" ;\
  3242. -@@ -60,56 +62,60 @@ mrproper:
  3243. +@@ -60,57 +62,61 @@ mrproper:
  3244. echo "| (that isn't currently running.)" ;\
  3245. echo "\\--" ;\
  3246. false)
  3247. @@ -56,11 +56,12 @@
  3248. - done \
  3249. - ) > Kconfig.kernel ;\
  3250. - kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  3251. -- sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3252. +- sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3253. - test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  3254. - test "$$kver" != "" ;\
  3255. - kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  3256. -- kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  3257. +- kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  3258. +- kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  3259. - print=0 ;\
  3260. - for v in $$kvers ; do \
  3261. - if [ "$$print" = "1" ] ; then \
  3262. @@ -111,11 +112,12 @@
  3263. +
  3264. +Kconfig.versions: Kconfig.kernel
  3265. + @kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  3266. -+ sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3267. ++ sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3268. + test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  3269. + test "$$kver" != "" ;\
  3270. + kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  3271. -+ kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  3272. ++ kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  3273. ++ kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  3274. + print=0 ;\
  3275. + for v in $$kvers ; do \
  3276. + if [ "$$print" = "1" ] ; then \
  3277. diff --git a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch b/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  3278. deleted file mode 100644
  3279. index d48a723..0000000
  3280. --- a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  3281. +++ /dev/null
  3282. @@ -1,10 +0,0 @@
  3283. ---- a/backport-include/linux/debugfs.h
  3284. -+++ b/backport-include/linux/debugfs.h
  3285. -@@ -3,6 +3,7 @@
  3286. - #include_next <linux/debugfs.h>
  3287. - #include <linux/version.h>
  3288. - #include <generated/utsrelease.h>
  3289. -+#include <linux/device.h>
  3290. -
  3291. - #if defined(CONFIG_DEBUG_FS)
  3292. - struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
  3293. diff --git a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch b/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  3294. deleted file mode 100644
  3295. index e07f323..0000000
  3296. --- a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  3297. +++ /dev/null
  3298. @@ -1,16 +0,0 @@
  3299. ---- a/net/mac80211/iface.c
  3300. -+++ b/net/mac80211/iface.c
  3301. -@@ -1858,6 +1858,13 @@ void ieee80211_remove_interfaces(struct
  3302. - }
  3303. - mutex_unlock(&local->iflist_mtx);
  3304. - unregister_netdevice_many(&unreg_list);
  3305. -+#if (!(LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,45) && \
  3306. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) && \
  3307. -+ !(LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,9) && \
  3308. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) && \
  3309. -+ (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)))
  3310. -+ list_del(&unreg_list);
  3311. -+#endif
  3312. -
  3313. - list_for_each_entry_safe(sdata, tmp, &wdev_list, list) {
  3314. - list_del(&sdata->list);
  3315. diff --git a/package/kernel/mac80211/patches/020-add_mpls_h.patch b/package/kernel/mac80211/patches/020-add_mpls_h.patch
  3316. deleted file mode 100644
  3317. index e5310bc..0000000
  3318. --- a/package/kernel/mac80211/patches/020-add_mpls_h.patch
  3319. +++ /dev/null
  3320. @@ -1,37 +0,0 @@
  3321. ---- /dev/null
  3322. -+++ b/include/uapi/linux/mpls.h
  3323. -@@ -0,0 +1,34 @@
  3324. -+#ifndef _UAPI_MPLS_H
  3325. -+#define _UAPI_MPLS_H
  3326. -+
  3327. -+#include <linux/types.h>
  3328. -+#include <asm/byteorder.h>
  3329. -+
  3330. -+/* Reference: RFC 5462, RFC 3032
  3331. -+ *
  3332. -+ * 0 1 2 3
  3333. -+ * 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
  3334. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  3335. -+ * | Label | TC |S| TTL |
  3336. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  3337. -+ *
  3338. -+ * Label: Label Value, 20 bits
  3339. -+ * TC: Traffic Class field, 3 bits
  3340. -+ * S: Bottom of Stack, 1 bit
  3341. -+ * TTL: Time to Live, 8 bits
  3342. -+ */
  3343. -+
  3344. -+struct mpls_label {
  3345. -+ __be32 entry;
  3346. -+};
  3347. -+
  3348. -+#define MPLS_LS_LABEL_MASK 0xFFFFF000
  3349. -+#define MPLS_LS_LABEL_SHIFT 12
  3350. -+#define MPLS_LS_TC_MASK 0x00000E00
  3351. -+#define MPLS_LS_TC_SHIFT 9
  3352. -+#define MPLS_LS_S_MASK 0x00000100
  3353. -+#define MPLS_LS_S_SHIFT 8
  3354. -+#define MPLS_LS_TTL_MASK 0x000000FF
  3355. -+#define MPLS_LS_TTL_SHIFT 0
  3356. -+
  3357. -+#endif /* _UAPI_MPLS_H */
  3358. 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
  3359. new file mode 100644
  3360. index 0000000..97f678c
  3361. --- /dev/null
  3362. +++ b/package/kernel/mac80211/patches/020-backports-do-not-add-debugfs_create_devm_seqfile-on-.patch
  3363. @@ -0,0 +1,33 @@
  3364. +From e15e9231e7a9f81f5264d294fd3fd96a20d92516 Mon Sep 17 00:00:00 2001
  3365. +From: Hauke Mehrtens <hauke@hauke-m.de>
  3366. +Date: Sat, 25 Jul 2015 15:19:17 +0200
  3367. +Subject: [PATCH 3/3] backports: do not add debugfs_create_devm_seqfile() on
  3368. + recent kernel versions
  3369. +
  3370. +An #ifdef for the kernel version was missing around the header of
  3371. +debugfs_create_devm_seqfile() and the LINUX_BACKPORT() was also not
  3372. +done.
  3373. +
  3374. +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  3375. +---
  3376. + backport/backport-include/linux/debugfs.h | 3 +++
  3377. + 1 file changed, 3 insertions(+)
  3378. +
  3379. +--- a/backport-include/linux/debugfs.h
  3380. ++++ b/backport-include/linux/debugfs.h
  3381. +@@ -5,6 +5,8 @@
  3382. + #include <linux/device.h>
  3383. + #include <generated/utsrelease.h>
  3384. +
  3385. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  3386. ++#define debugfs_create_devm_seqfile LINUX_BACKPORT(debugfs_create_devm_seqfile)
  3387. + #if defined(CONFIG_DEBUG_FS)
  3388. + struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
  3389. + struct dentry *parent,
  3390. +@@ -20,5 +22,6 @@ static inline struct dentry *debugfs_cre
  3391. + return ERR_PTR(-ENODEV);
  3392. + }
  3393. + #endif /* CONFIG_DEBUG_FS */
  3394. ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  3395. +
  3396. + #endif /* __BACKPORT_DEBUGFS_H_ */
  3397. diff --git a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch b/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  3398. deleted file mode 100644
  3399. index dce217f..0000000
  3400. --- a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  3401. +++ /dev/null
  3402. @@ -1,104 +0,0 @@
  3403. ---- a/drivers/bcma/driver_pci.c
  3404. -+++ b/drivers/bcma/driver_pci.c
  3405. -@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcm
  3406. - }
  3407. - EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
  3408. -
  3409. --int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  3410. -- bool enable)
  3411. --{
  3412. -- struct pci_dev *pdev;
  3413. -- u32 coremask, tmp;
  3414. -- int err = 0;
  3415. --
  3416. -- if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  3417. -- /* This bcma device is not on a PCI host-bus. So the IRQs are
  3418. -- * not routed through the PCI core.
  3419. -- * So we must not enable routing through the PCI core. */
  3420. -- goto out;
  3421. -- }
  3422. --
  3423. -- pdev = bus->host_pci;
  3424. --
  3425. -- err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  3426. -- if (err)
  3427. -- goto out;
  3428. --
  3429. -- coremask = BIT(core->core_index) << 8;
  3430. -- if (enable)
  3431. -- tmp |= coremask;
  3432. -- else
  3433. -- tmp &= ~coremask;
  3434. --
  3435. -- err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  3436. --
  3437. --out:
  3438. -- return err;
  3439. --}
  3440. --EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl);
  3441. --
  3442. - static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
  3443. - {
  3444. - u32 w;
  3445. ---- a/drivers/bcma/host_pci.c
  3446. -+++ b/drivers/bcma/host_pci.c
  3447. -@@ -351,3 +351,37 @@ void bcma_host_pci_down(struct bcma_bus
  3448. - bcma_core_pci_down(&bus->drv_pci[0]);
  3449. - }
  3450. - EXPORT_SYMBOL_GPL(bcma_host_pci_down);
  3451. -+
  3452. -+/* See also si_pci_setup */
  3453. -+int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  3454. -+ bool enable)
  3455. -+{
  3456. -+ struct pci_dev *pdev;
  3457. -+ u32 coremask, tmp;
  3458. -+ int err = 0;
  3459. -+
  3460. -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  3461. -+ /* This bcma device is not on a PCI host-bus. So the IRQs are
  3462. -+ * not routed through the PCI core.
  3463. -+ * So we must not enable routing through the PCI core. */
  3464. -+ goto out;
  3465. -+ }
  3466. -+
  3467. -+ pdev = bus->host_pci;
  3468. -+
  3469. -+ err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  3470. -+ if (err)
  3471. -+ goto out;
  3472. -+
  3473. -+ coremask = BIT(core->core_index) << 8;
  3474. -+ if (enable)
  3475. -+ tmp |= coremask;
  3476. -+ else
  3477. -+ tmp &= ~coremask;
  3478. -+
  3479. -+ err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  3480. -+
  3481. -+out:
  3482. -+ return err;
  3483. -+}
  3484. -+EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl);
  3485. ---- a/drivers/net/wireless/b43/main.c
  3486. -+++ b/drivers/net/wireless/b43/main.c
  3487. -@@ -4866,7 +4866,7 @@ static int b43_wireless_core_init(struct
  3488. - switch (dev->dev->bus_type) {
  3489. - #ifdef CPTCFG_B43_BCMA
  3490. - case B43_BUS_BCMA:
  3491. -- bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
  3492. -+ bcma_host_pci_irq_ctl(dev->dev->bdev->bus,
  3493. - dev->dev->bdev, true);
  3494. - bcma_host_pci_up(dev->dev->bdev->bus);
  3495. - break;
  3496. ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
  3497. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
  3498. -@@ -4959,7 +4959,7 @@ static int brcms_b_up_prep(struct brcms_
  3499. - * Configure pci/pcmcia here instead of in brcms_c_attach()
  3500. - * to allow mfg hotswap: down, hotswap (chip power cycle), up.
  3501. - */
  3502. -- bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  3503. -+ bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  3504. - true);
  3505. -
  3506. - /*
  3507. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  3508. index d307949..4fbab23 100644
  3509. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  3510. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  3511. @@ -1,6 +1,6 @@
  3512. --- a/.local-symbols
  3513. +++ b/.local-symbols
  3514. -@@ -344,40 +344,3 @@ USB_CDC_PHONET=
  3515. +@@ -449,43 +449,6 @@ USB_CDC_PHONET=
  3516. USB_IPHETH=
  3517. USB_SIERRA_NET=
  3518. USB_VL600=
  3519. @@ -32,26 +32,18 @@
  3520. -BCMA_BLOCKIO=
  3521. -BCMA_HOST_PCI_POSSIBLE=
  3522. -BCMA_HOST_PCI=
  3523. --BCMA_DRIVER_PCI_HOSTMODE=
  3524. -BCMA_HOST_SOC=
  3525. -BCMA_DRIVER_PCI=
  3526. +-BCMA_DRIVER_PCI_HOSTMODE=
  3527. -BCMA_DRIVER_MIPS=
  3528. -BCMA_SFLASH=
  3529. -BCMA_NFLASH=
  3530. -BCMA_DRIVER_GMAC_CMN=
  3531. -BCMA_DRIVER_GPIO=
  3532. -BCMA_DEBUG=
  3533. ---- a/Makefile.kernel
  3534. -+++ b/Makefile.kernel
  3535. -@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  3536. - obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  3537. - #obj-$(CPTCFG_BT) += net/bluetooth/
  3538. - #obj-$(CPTCFG_BT) += drivers/bluetooth/
  3539. --obj-$(CPTCFG_SSB) += drivers/ssb/
  3540. --obj-$(CPTCFG_BCMA) += drivers/bcma/
  3541. - #obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  3542. - obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  3543. - #obj-$(CPTCFG_NFC) += net/nfc/
  3544. + NFC=
  3545. + NFC_DIGITAL=
  3546. + NFC_NCI=
  3547. --- a/drivers/net/wireless/b43/main.c
  3548. +++ b/drivers/net/wireless/b43/main.c
  3549. @@ -2866,7 +2866,7 @@ static struct ssb_device *b43_ssb_gpio_d
  3550. @@ -63,7 +55,7 @@
  3551. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  3552. #else
  3553. return bus->chipco.dev;
  3554. -@@ -4907,7 +4907,7 @@ static int b43_wireless_core_init(struct
  3555. +@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  3556. }
  3557. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  3558. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  3559. @@ -116,12 +108,23 @@
  3560. --- a/Kconfig.sources
  3561. +++ b/Kconfig.sources
  3562. @@ -9,9 +9,6 @@ source "$BACKPORT_DIR/drivers/net/wirele
  3563. - #source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  3564. + source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  3565. source "$BACKPORT_DIR/drivers/net/usb/Kconfig"
  3566. -source "$BACKPORT_DIR/drivers/ssb/Kconfig"
  3567. -source "$BACKPORT_DIR/drivers/bcma/Kconfig"
  3568. -
  3569. - #source "$BACKPORT_DIR/net/nfc/Kconfig"
  3570. + source "$BACKPORT_DIR/net/nfc/Kconfig"
  3571. - #source "$BACKPORT_DIR/drivers/media/Kconfig"
  3572. + source "$BACKPORT_DIR/drivers/media/Kconfig"
  3573. +--- a/Makefile.kernel
  3574. ++++ b/Makefile.kernel
  3575. +@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  3576. + obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  3577. + obj-$(CPTCFG_BT) += net/bluetooth/
  3578. + obj-$(CPTCFG_BT) += drivers/bluetooth/
  3579. +-obj-$(CPTCFG_SSB) += drivers/ssb/
  3580. +-obj-$(CPTCFG_BCMA) += drivers/bcma/
  3581. + obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  3582. + obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  3583. + obj-$(CPTCFG_NFC) += net/nfc/
  3584. 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
  3585. deleted file mode 100644
  3586. index 85c5280..0000000
  3587. --- a/package/kernel/mac80211/patches/090-linux_3_18_12_compat.patch
  3588. +++ /dev/null
  3589. @@ -1,29 +0,0 @@
  3590. ---- a/backport-include/linux/wait.h
  3591. -+++ b/backport-include/linux/wait.h
  3592. -@@ -23,7 +23,7 @@ backport_wait_on_bit_io(void *word, int
  3593. -
  3594. - #endif
  3595. -
  3596. --#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  3597. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  3598. - #define WQ_FLAG_WOKEN 0x02
  3599. -
  3600. - #define wait_woken LINUX_BACKPORT(wait_woken)
  3601. ---- a/compat/backport-3.19.c
  3602. -+++ b/compat/backport-3.19.c
  3603. -@@ -15,6 +15,7 @@
  3604. - #include <linux/netdevice.h>
  3605. - #include <linux/debugfs.h>
  3606. -
  3607. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  3608. - static inline bool is_kthread_should_stop(void)
  3609. - {
  3610. - return (current->flags & PF_KTHREAD) && kthread_should_stop();
  3611. -@@ -79,6 +80,7 @@ int woken_wake_function(wait_queue_t *wa
  3612. - return default_wake_function(wait, mode, sync, key);
  3613. - }
  3614. - EXPORT_SYMBOL(woken_wake_function);
  3615. -+#endif
  3616. -
  3617. - #ifdef __BACKPORT_NETDEV_RSS_KEY_FILL
  3618. - u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
  3619. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  3620. new file mode 100644
  3621. index 0000000..07dde54
  3622. --- /dev/null
  3623. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  3624. @@ -0,0 +1,376 @@
  3625. +--- a/net/mac80211/Kconfig
  3626. ++++ b/net/mac80211/Kconfig
  3627. +@@ -5,8 +5,6 @@ config MAC80211
  3628. + depends on CRYPTO
  3629. + depends on CRYPTO_ARC4
  3630. + depends on CRYPTO_AES
  3631. +- select BPAUTO_CRYPTO_CCM
  3632. +- depends on CRYPTO_GCM
  3633. + depends on CRC32
  3634. + select BPAUTO_AVERAGE
  3635. + ---help---
  3636. +--- a/net/mac80211/Makefile
  3637. ++++ b/net/mac80211/Makefile
  3638. +@@ -15,9 +15,7 @@ mac80211-y := \
  3639. + michael.o \
  3640. + tkip.o \
  3641. + aes_ccm.o \
  3642. +- aes_gcm.o \
  3643. + aes_cmac.o \
  3644. +- aes_gmac.o \
  3645. + cfg.o \
  3646. + ethtool.o \
  3647. + rx.o \
  3648. +--- a/net/mac80211/aes_ccm.c
  3649. ++++ b/net/mac80211/aes_ccm.c
  3650. +@@ -13,89 +13,132 @@
  3651. + #include <linux/types.h>
  3652. + #include <linux/err.h>
  3653. + #include <crypto/aead.h>
  3654. ++#include <crypto/aes.h>
  3655. +
  3656. + #include <net/mac80211.h>
  3657. + #include "key.h"
  3658. + #include "aes_ccm.h"
  3659. +
  3660. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  3661. +- u8 *data, size_t data_len, u8 *mic,
  3662. +- size_t mic_len)
  3663. ++static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0,
  3664. ++ u8 *a, u8 *b)
  3665. + {
  3666. +- struct scatterlist sg[3];
  3667. ++ int i;
  3668. ++
  3669. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  3670. ++
  3671. ++ /* Extra Authenticate-only data (always two AES blocks) */
  3672. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  3673. ++ aad[i] ^= b[i];
  3674. ++ crypto_cipher_encrypt_one(tfm, b, aad);
  3675. ++
  3676. ++ aad += AES_BLOCK_SIZE;
  3677. ++
  3678. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  3679. ++ aad[i] ^= b[i];
  3680. ++ crypto_cipher_encrypt_one(tfm, a, aad);
  3681. +
  3682. +- char aead_req_data[sizeof(struct aead_request) +
  3683. +- crypto_aead_reqsize(tfm)]
  3684. +- __aligned(__alignof__(struct aead_request));
  3685. +- struct aead_request *aead_req = (void *) aead_req_data;
  3686. ++ /* Mask out bits from auth-only-b_0 */
  3687. ++ b_0[0] &= 0x07;
  3688. +
  3689. +- memset(aead_req, 0, sizeof(aead_req_data));
  3690. ++ /* S_0 is used to encrypt T (= MIC) */
  3691. ++ b_0[14] = 0;
  3692. ++ b_0[15] = 0;
  3693. ++ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  3694. ++}
  3695. +
  3696. +- sg_init_table(sg, 3);
  3697. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  3698. +- sg_set_buf(&sg[1], data, data_len);
  3699. +- sg_set_buf(&sg[2], mic, mic_len);
  3700. +
  3701. +- aead_request_set_tfm(aead_req, tfm);
  3702. +- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
  3703. +- aead_request_set_ad(aead_req, sg[0].length);
  3704. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  3705. ++ u8 *data, size_t data_len, u8 *mic,
  3706. ++ size_t mic_len)
  3707. ++{
  3708. ++ int i, j, last_len, num_blocks;
  3709. ++ u8 b[AES_BLOCK_SIZE];
  3710. ++ u8 s_0[AES_BLOCK_SIZE];
  3711. ++ u8 e[AES_BLOCK_SIZE];
  3712. ++ u8 *pos, *cpos;
  3713. ++
  3714. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  3715. ++ last_len = data_len % AES_BLOCK_SIZE;
  3716. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
  3717. ++
  3718. ++ /* Process payload blocks */
  3719. ++ pos = data;
  3720. ++ cpos = data;
  3721. ++ for (j = 1; j <= num_blocks; j++) {
  3722. ++ int blen = (j == num_blocks && last_len) ?
  3723. ++ last_len : AES_BLOCK_SIZE;
  3724. ++
  3725. ++ /* Authentication followed by encryption */
  3726. ++ for (i = 0; i < blen; i++)
  3727. ++ b[i] ^= pos[i];
  3728. ++ crypto_cipher_encrypt_one(tfm, b, b);
  3729. ++
  3730. ++ b_0[14] = (j >> 8) & 0xff;
  3731. ++ b_0[15] = j & 0xff;
  3732. ++ crypto_cipher_encrypt_one(tfm, e, b_0);
  3733. ++ for (i = 0; i < blen; i++)
  3734. ++ *cpos++ = *pos++ ^ e[i];
  3735. ++ }
  3736. +
  3737. +- crypto_aead_encrypt(aead_req);
  3738. ++ for (i = 0; i < mic_len; i++)
  3739. ++ mic[i] = b[i] ^ s_0[i];
  3740. + }
  3741. +
  3742. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  3743. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  3744. + u8 *data, size_t data_len, u8 *mic,
  3745. + size_t mic_len)
  3746. + {
  3747. +- struct scatterlist sg[3];
  3748. +- char aead_req_data[sizeof(struct aead_request) +
  3749. +- crypto_aead_reqsize(tfm)]
  3750. +- __aligned(__alignof__(struct aead_request));
  3751. +- struct aead_request *aead_req = (void *) aead_req_data;
  3752. +-
  3753. +- if (data_len == 0)
  3754. +- return -EINVAL;
  3755. +-
  3756. +- memset(aead_req, 0, sizeof(aead_req_data));
  3757. +-
  3758. +- sg_init_table(sg, 3);
  3759. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  3760. +- sg_set_buf(&sg[1], data, data_len);
  3761. +- sg_set_buf(&sg[2], mic, mic_len);
  3762. +-
  3763. +- aead_request_set_tfm(aead_req, tfm);
  3764. +- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
  3765. +- aead_request_set_ad(aead_req, sg[0].length);
  3766. ++ int i, j, last_len, num_blocks;
  3767. ++ u8 *pos, *cpos;
  3768. ++ u8 a[AES_BLOCK_SIZE];
  3769. ++ u8 b[AES_BLOCK_SIZE];
  3770. ++ u8 s_0[AES_BLOCK_SIZE];
  3771. ++
  3772. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  3773. ++ last_len = data_len % AES_BLOCK_SIZE;
  3774. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, a, b);
  3775. ++
  3776. ++ /* Process payload blocks */
  3777. ++ cpos = data;
  3778. ++ pos = data;
  3779. ++ for (j = 1; j <= num_blocks; j++) {
  3780. ++ int blen = (j == num_blocks && last_len) ?
  3781. ++ last_len : AES_BLOCK_SIZE;
  3782. ++
  3783. ++ /* Decryption followed by authentication */
  3784. ++ b_0[14] = (j >> 8) & 0xff;
  3785. ++ b_0[15] = j & 0xff;
  3786. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  3787. ++ for (i = 0; i < blen; i++) {
  3788. ++ *pos = *cpos++ ^ b[i];
  3789. ++ a[i] ^= *pos++;
  3790. ++ }
  3791. ++ crypto_cipher_encrypt_one(tfm, a, a);
  3792. ++ }
  3793. ++
  3794. ++ for (i = 0; i < mic_len; i++) {
  3795. ++ if ((mic[i] ^ s_0[i]) != a[i])
  3796. ++ return -1;
  3797. ++ }
  3798. +
  3799. +- return crypto_aead_decrypt(aead_req);
  3800. ++ return 0;
  3801. + }
  3802. +
  3803. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  3804. +- size_t key_len,
  3805. +- size_t mic_len)
  3806. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  3807. ++ size_t key_len,
  3808. ++ size_t mic_len)
  3809. + {
  3810. +- struct crypto_aead *tfm;
  3811. +- int err;
  3812. ++ struct crypto_cipher *tfm;
  3813. +
  3814. +- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  3815. +- if (IS_ERR(tfm))
  3816. +- return tfm;
  3817. +-
  3818. +- err = crypto_aead_setkey(tfm, key, key_len);
  3819. +- if (err)
  3820. +- goto free_aead;
  3821. +- err = crypto_aead_setauthsize(tfm, mic_len);
  3822. +- if (err)
  3823. +- goto free_aead;
  3824. ++ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  3825. ++ if (!IS_ERR(tfm))
  3826. ++ crypto_cipher_setkey(tfm, key, key_len);
  3827. +
  3828. + return tfm;
  3829. +-
  3830. +-free_aead:
  3831. +- crypto_free_aead(tfm);
  3832. +- return ERR_PTR(err);
  3833. + }
  3834. +
  3835. +-void ieee80211_aes_key_free(struct crypto_aead *tfm)
  3836. ++
  3837. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  3838. + {
  3839. +- crypto_free_aead(tfm);
  3840. ++ crypto_free_cipher(tfm);
  3841. + }
  3842. +--- a/net/mac80211/aes_ccm.h
  3843. ++++ b/net/mac80211/aes_ccm.h
  3844. +@@ -12,15 +12,15 @@
  3845. +
  3846. + #include <linux/crypto.h>
  3847. +
  3848. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  3849. +- size_t key_len,
  3850. +- size_t mic_len);
  3851. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  3852. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  3853. ++ size_t key_len,
  3854. ++ size_t mic_len);
  3855. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  3856. + u8 *data, size_t data_len, u8 *mic,
  3857. + size_t mic_len);
  3858. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  3859. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  3860. + u8 *data, size_t data_len, u8 *mic,
  3861. + size_t mic_len);
  3862. +-void ieee80211_aes_key_free(struct crypto_aead *tfm);
  3863. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  3864. +
  3865. + #endif /* AES_CCM_H */
  3866. +--- a/net/mac80211/aes_gcm.h
  3867. ++++ b/net/mac80211/aes_gcm.h
  3868. +@@ -11,12 +11,28 @@
  3869. +
  3870. + #include <linux/crypto.h>
  3871. +
  3872. +-void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  3873. +- u8 *data, size_t data_len, u8 *mic);
  3874. +-int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  3875. +- u8 *data, size_t data_len, u8 *mic);
  3876. +-struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  3877. +- size_t key_len);
  3878. +-void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  3879. ++static inline void
  3880. ++ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  3881. ++ u8 *data, size_t data_len, u8 *mic)
  3882. ++{
  3883. ++}
  3884. ++
  3885. ++static inline int
  3886. ++ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  3887. ++ u8 *data, size_t data_len, u8 *mic)
  3888. ++{
  3889. ++ return -EOPNOTSUPP;
  3890. ++}
  3891. ++
  3892. ++static inline struct crypto_aead *
  3893. ++ieee80211_aes_gcm_key_setup_encrypt(const u8 key[], size_t key_len)
  3894. ++{
  3895. ++ return NULL;
  3896. ++}
  3897. ++
  3898. ++static inline void
  3899. ++ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  3900. ++{
  3901. ++}
  3902. +
  3903. + #endif /* AES_GCM_H */
  3904. +--- a/net/mac80211/aes_gmac.h
  3905. ++++ b/net/mac80211/aes_gmac.h
  3906. +@@ -11,10 +11,22 @@
  3907. +
  3908. + #include <linux/crypto.h>
  3909. +
  3910. +-struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  3911. +- size_t key_len);
  3912. +-int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  3913. +- const u8 *data, size_t data_len, u8 *mic);
  3914. +-void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  3915. ++static inline struct crypto_aead *
  3916. ++ieee80211_aes_gmac_key_setup(const u8 key[], size_t key_len)
  3917. ++{
  3918. ++ return NULL;
  3919. ++}
  3920. ++
  3921. ++static inline int
  3922. ++ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  3923. ++ const u8 *data, size_t data_len, u8 *mic)
  3924. ++{
  3925. ++ return -EOPNOTSUPP;
  3926. ++}
  3927. ++
  3928. ++static inline void
  3929. ++ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  3930. ++{
  3931. ++}
  3932. +
  3933. + #endif /* AES_GMAC_H */
  3934. +--- a/net/mac80211/key.h
  3935. ++++ b/net/mac80211/key.h
  3936. +@@ -84,7 +84,7 @@ struct ieee80211_key {
  3937. + * Management frames.
  3938. + */
  3939. + u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  3940. +- struct crypto_aead *tfm;
  3941. ++ struct crypto_cipher *tfm;
  3942. + u32 replays; /* dot11RSNAStatsCCMPReplays */
  3943. + } ccmp;
  3944. + struct {
  3945. +--- a/net/mac80211/wpa.c
  3946. ++++ b/net/mac80211/wpa.c
  3947. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  3948. + }
  3949. +
  3950. +
  3951. +-static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  3952. ++static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
  3953. ++ u16 data_len)
  3954. + {
  3955. + __le16 mask_fc;
  3956. + int a4_included, mgmt;
  3957. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  3958. + else
  3959. + qos_tid = 0;
  3960. +
  3961. +- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  3962. +- * mode authentication are not allowed to collide, yet both are derived
  3963. +- * from this vector b_0. We only set L := 1 here to indicate that the
  3964. +- * data size can be represented in (L+1) bytes. The CCM layer will take
  3965. +- * care of storing the data length in the top (L+1) bytes and setting
  3966. +- * and clearing the other bits as is required to derive the two IVs.
  3967. +- */
  3968. +- b_0[0] = 0x1;
  3969. ++ /* First block, b_0 */
  3970. ++ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  3971. +
  3972. + /* Nonce: Nonce Flags | A2 | PN
  3973. + * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  3974. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  3975. + b_0[1] = qos_tid | (mgmt << 4);
  3976. + memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  3977. + memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  3978. ++ /* l(m) */
  3979. ++ put_unaligned_be16(data_len, &b_0[14]);
  3980. +
  3981. + /* AAD (extra authenticate-only data) / masked 802.11 header
  3982. + * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  3983. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  3984. + return 0;
  3985. +
  3986. + pos += IEEE80211_CCMP_HDR_LEN;
  3987. +- ccmp_special_blocks(skb, pn, b_0, aad);
  3988. ++ ccmp_special_blocks(skb, pn, b_0, aad, len);
  3989. + ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  3990. + skb_put(skb, mic_len), mic_len);
  3991. +
  3992. +@@ -531,7 +528,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  3993. + u8 aad[2 * AES_BLOCK_SIZE];
  3994. + u8 b_0[AES_BLOCK_SIZE];
  3995. + /* hardware didn't decrypt/verify MIC */
  3996. +- ccmp_special_blocks(skb, pn, b_0, aad);
  3997. ++ ccmp_special_blocks(skb, pn, b_0, aad, data_len);
  3998. +
  3999. + if (ieee80211_aes_ccm_decrypt(
  4000. + key->u.ccmp.tfm, b_0, aad,
  4001. diff --git a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch b/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  4002. deleted file mode 100644
  4003. index ceca952..0000000
  4004. --- a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  4005. +++ /dev/null
  4006. @@ -1,2055 +0,0 @@
  4007. -This patch reverts the following commits from wireless-testing:
  4008. -
  4009. -8ade538bf39b1ee53418528fdacd36b8e65621b9
  4010. -56c52da2d554f081e8fce58ecbcf6a40c605b95b
  4011. -2b2ba0db1c820d04d5143452d70012cd44d7b578
  4012. -00b9cfa3ff38401bd70c34b250ca13e5ea347b4a
  4013. -4f031fa9f188b2b0641ac20087d9e16bcfb4e49d
  4014. -6e1ee5d2e9e411892b5d84e3ea93e3fc88ac786c
  4015. -30ef7ef9672d92ab2cac37f60a31955c118321e7
  4016. -f359d3fe832e49eeec2232b2af5a9e3aee6b4862 (only the changes in aes_cmac.{c,h})
  4017. -7ec7c4a9a686c608315739ab6a2b0527a240883c
  4018. ----
  4019. -
  4020. ---- a/include/linux/ieee80211.h
  4021. -+++ b/include/linux/ieee80211.h
  4022. -@@ -1017,15 +1017,6 @@ struct ieee80211_mmie {
  4023. - u8 mic[8];
  4024. - } __packed;
  4025. -
  4026. --/* Management MIC information element (IEEE 802.11w) for GMAC and CMAC-256 */
  4027. --struct ieee80211_mmie_16 {
  4028. -- u8 element_id;
  4029. -- u8 length;
  4030. -- __le16 key_id;
  4031. -- u8 sequence_number[6];
  4032. -- u8 mic[16];
  4033. --} __packed;
  4034. --
  4035. - struct ieee80211_vendor_ie {
  4036. - u8 element_id;
  4037. - u8 len;
  4038. ---- a/include/net/mac80211.h
  4039. -+++ b/include/net/mac80211.h
  4040. -@@ -1306,8 +1306,8 @@ struct ieee80211_vif *wdev_to_ieee80211_
  4041. - * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
  4042. - * that the key is pairwise rather then a shared key.
  4043. - * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a
  4044. -- * CCMP/GCMP key if it requires CCMP/GCMP encryption of management frames
  4045. -- * (MFP) to be done in software.
  4046. -+ * CCMP key if it requires CCMP encryption of management frames (MFP) to
  4047. -+ * be done in software.
  4048. - * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
  4049. - * if space should be prepared for the IV, but the IV
  4050. - * itself should not be generated. Do not set together with
  4051. -@@ -1322,7 +1322,7 @@ struct ieee80211_vif *wdev_to_ieee80211_
  4052. - * RX, if your crypto engine can't deal with TX you can also set the
  4053. - * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
  4054. - * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
  4055. -- * driver for a CCMP/GCMP key to indicate that is requires IV generation
  4056. -+ * driver for a CCMP key to indicate that is requires IV generation
  4057. - * only for managment frames (MFP).
  4058. - * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the
  4059. - * driver for a key to indicate that sufficient tailroom must always
  4060. -@@ -4112,10 +4112,6 @@ void ieee80211_aes_cmac_calculate_k1_k2(
  4061. - * reverse order than in packet)
  4062. - * @aes_cmac: PN data, most significant byte first (big endian,
  4063. - * reverse order than in packet)
  4064. -- * @aes_gmac: PN data, most significant byte first (big endian,
  4065. -- * reverse order than in packet)
  4066. -- * @gcmp: PN data, most significant byte first (big endian,
  4067. -- * reverse order than in packet)
  4068. - */
  4069. - struct ieee80211_key_seq {
  4070. - union {
  4071. -@@ -4129,12 +4125,6 @@ struct ieee80211_key_seq {
  4072. - struct {
  4073. - u8 pn[6];
  4074. - } aes_cmac;
  4075. -- struct {
  4076. -- u8 pn[6];
  4077. -- } aes_gmac;
  4078. -- struct {
  4079. -- u8 pn[6];
  4080. -- } gcmp;
  4081. - };
  4082. - };
  4083. -
  4084. -@@ -4159,7 +4149,7 @@ void ieee80211_get_key_tx_seq(struct iee
  4085. - * ieee80211_get_key_rx_seq - get key RX sequence counter
  4086. - *
  4087. - * @keyconf: the parameter passed with the set key
  4088. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  4089. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  4090. - * the value on TID 0 is also used for non-QoS frames. For
  4091. - * CMAC, only TID 0 is valid.
  4092. - * @seq: buffer to receive the sequence data
  4093. -@@ -4195,7 +4185,7 @@ void ieee80211_set_key_tx_seq(struct iee
  4094. - * ieee80211_set_key_rx_seq - set key RX sequence counter
  4095. - *
  4096. - * @keyconf: the parameter passed with the set key
  4097. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  4098. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  4099. - * the value on TID 0 is also used for non-QoS frames. For
  4100. - * CMAC, only TID 0 is valid.
  4101. - * @seq: new sequence data
  4102. ---- a/net/mac80211/Kconfig
  4103. -+++ b/net/mac80211/Kconfig
  4104. -@@ -5,8 +5,6 @@ config MAC80211
  4105. - depends on CRYPTO
  4106. - depends on CRYPTO_ARC4
  4107. - depends on CRYPTO_AES
  4108. -- select BPAUTO_CRYPTO_CCM
  4109. -- depends on CRYPTO_GCM
  4110. - depends on CRC32
  4111. - select BPAUTO_AVERAGE
  4112. - ---help---
  4113. ---- a/net/mac80211/Makefile
  4114. -+++ b/net/mac80211/Makefile
  4115. -@@ -15,9 +15,7 @@ mac80211-y := \
  4116. - michael.o \
  4117. - tkip.o \
  4118. - aes_ccm.o \
  4119. -- aes_gcm.o \
  4120. - aes_cmac.o \
  4121. -- aes_gmac.o \
  4122. - cfg.o \
  4123. - ethtool.o \
  4124. - rx.o \
  4125. ---- a/net/mac80211/aes_ccm.c
  4126. -+++ b/net/mac80211/aes_ccm.c
  4127. -@@ -2,8 +2,6 @@
  4128. - * Copyright 2003-2004, Instant802 Networks, Inc.
  4129. - * Copyright 2005-2006, Devicescape Software, Inc.
  4130. - *
  4131. -- * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
  4132. -- *
  4133. - * This program is free software; you can redistribute it and/or modify
  4134. - * it under the terms of the GNU General Public License version 2 as
  4135. - * published by the Free Software Foundation.
  4136. -@@ -19,82 +17,134 @@
  4137. - #include "key.h"
  4138. - #include "aes_ccm.h"
  4139. -
  4140. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4141. -- u8 *data, size_t data_len, u8 *mic,
  4142. -- size_t mic_len)
  4143. -+static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a)
  4144. -+{
  4145. -+ int i;
  4146. -+ u8 *b_0, *aad, *b, *s_0;
  4147. -+
  4148. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  4149. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  4150. -+ b = scratch;
  4151. -+ s_0 = scratch + AES_BLOCK_SIZE;
  4152. -+
  4153. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  4154. -+
  4155. -+ /* Extra Authenticate-only data (always two AES blocks) */
  4156. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  4157. -+ aad[i] ^= b[i];
  4158. -+ crypto_cipher_encrypt_one(tfm, b, aad);
  4159. -+
  4160. -+ aad += AES_BLOCK_SIZE;
  4161. -+
  4162. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  4163. -+ aad[i] ^= b[i];
  4164. -+ crypto_cipher_encrypt_one(tfm, a, aad);
  4165. -+
  4166. -+ /* Mask out bits from auth-only-b_0 */
  4167. -+ b_0[0] &= 0x07;
  4168. -+
  4169. -+ /* S_0 is used to encrypt T (= MIC) */
  4170. -+ b_0[14] = 0;
  4171. -+ b_0[15] = 0;
  4172. -+ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  4173. -+}
  4174. -+
  4175. -+
  4176. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  4177. -+ u8 *data, size_t data_len,
  4178. -+ u8 *cdata, u8 *mic)
  4179. - {
  4180. -- struct scatterlist assoc, pt, ct[2];
  4181. -+ int i, j, last_len, num_blocks;
  4182. -+ u8 *pos, *cpos, *b, *s_0, *e, *b_0;
  4183. -
  4184. -- char aead_req_data[sizeof(struct aead_request) +
  4185. -- crypto_aead_reqsize(tfm)]
  4186. -- __aligned(__alignof__(struct aead_request));
  4187. -- struct aead_request *aead_req = (void *) aead_req_data;
  4188. --
  4189. -- memset(aead_req, 0, sizeof(aead_req_data));
  4190. --
  4191. -- sg_init_one(&pt, data, data_len);
  4192. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4193. -- sg_init_table(ct, 2);
  4194. -- sg_set_buf(&ct[0], data, data_len);
  4195. -- sg_set_buf(&ct[1], mic, mic_len);
  4196. --
  4197. -- aead_request_set_tfm(aead_req, tfm);
  4198. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4199. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, b_0);
  4200. -+ b = scratch;
  4201. -+ s_0 = scratch + AES_BLOCK_SIZE;
  4202. -+ e = scratch + 2 * AES_BLOCK_SIZE;
  4203. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  4204. -+
  4205. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  4206. -+ last_len = data_len % AES_BLOCK_SIZE;
  4207. -+ aes_ccm_prepare(tfm, scratch, b);
  4208. -+
  4209. -+ /* Process payload blocks */
  4210. -+ pos = data;
  4211. -+ cpos = cdata;
  4212. -+ for (j = 1; j <= num_blocks; j++) {
  4213. -+ int blen = (j == num_blocks && last_len) ?
  4214. -+ last_len : AES_BLOCK_SIZE;
  4215. -+
  4216. -+ /* Authentication followed by encryption */
  4217. -+ for (i = 0; i < blen; i++)
  4218. -+ b[i] ^= pos[i];
  4219. -+ crypto_cipher_encrypt_one(tfm, b, b);
  4220. -+
  4221. -+ b_0[14] = (j >> 8) & 0xff;
  4222. -+ b_0[15] = j & 0xff;
  4223. -+ crypto_cipher_encrypt_one(tfm, e, b_0);
  4224. -+ for (i = 0; i < blen; i++)
  4225. -+ *cpos++ = *pos++ ^ e[i];
  4226. -+ }
  4227. -
  4228. -- crypto_aead_encrypt(aead_req);
  4229. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++)
  4230. -+ mic[i] = b[i] ^ s_0[i];
  4231. - }
  4232. -
  4233. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4234. -- u8 *data, size_t data_len, u8 *mic,
  4235. -- size_t mic_len)
  4236. -+
  4237. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  4238. -+ u8 *cdata, size_t data_len, u8 *mic, u8 *data)
  4239. - {
  4240. -- struct scatterlist assoc, pt, ct[2];
  4241. -- char aead_req_data[sizeof(struct aead_request) +
  4242. -- crypto_aead_reqsize(tfm)]
  4243. -- __aligned(__alignof__(struct aead_request));
  4244. -- struct aead_request *aead_req = (void *) aead_req_data;
  4245. --
  4246. -- if (data_len == 0)
  4247. -- return -EINVAL;
  4248. --
  4249. -- memset(aead_req, 0, sizeof(aead_req_data));
  4250. --
  4251. -- sg_init_one(&pt, data, data_len);
  4252. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4253. -- sg_init_table(ct, 2);
  4254. -- sg_set_buf(&ct[0], data, data_len);
  4255. -- sg_set_buf(&ct[1], mic, mic_len);
  4256. --
  4257. -- aead_request_set_tfm(aead_req, tfm);
  4258. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4259. -- aead_request_set_crypt(aead_req, ct, &pt, data_len + mic_len, b_0);
  4260. -+ int i, j, last_len, num_blocks;
  4261. -+ u8 *pos, *cpos, *b, *s_0, *a, *b_0;
  4262. -+
  4263. -+ b = scratch;
  4264. -+ s_0 = scratch + AES_BLOCK_SIZE;
  4265. -+ a = scratch + 2 * AES_BLOCK_SIZE;
  4266. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  4267. -+
  4268. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  4269. -+ last_len = data_len % AES_BLOCK_SIZE;
  4270. -+ aes_ccm_prepare(tfm, scratch, a);
  4271. -+
  4272. -+ /* Process payload blocks */
  4273. -+ cpos = cdata;
  4274. -+ pos = data;
  4275. -+ for (j = 1; j <= num_blocks; j++) {
  4276. -+ int blen = (j == num_blocks && last_len) ?
  4277. -+ last_len : AES_BLOCK_SIZE;
  4278. -+
  4279. -+ /* Decryption followed by authentication */
  4280. -+ b_0[14] = (j >> 8) & 0xff;
  4281. -+ b_0[15] = j & 0xff;
  4282. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  4283. -+ for (i = 0; i < blen; i++) {
  4284. -+ *pos = *cpos++ ^ b[i];
  4285. -+ a[i] ^= *pos++;
  4286. -+ }
  4287. -+ crypto_cipher_encrypt_one(tfm, a, a);
  4288. -+ }
  4289. -+
  4290. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) {
  4291. -+ if ((mic[i] ^ s_0[i]) != a[i])
  4292. -+ return -1;
  4293. -+ }
  4294. -
  4295. -- return crypto_aead_decrypt(aead_req);
  4296. -+ return 0;
  4297. - }
  4298. -
  4299. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4300. -- size_t key_len,
  4301. -- size_t mic_len)
  4302. -+
  4303. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])
  4304. - {
  4305. -- struct crypto_aead *tfm;
  4306. -- int err;
  4307. -+ struct crypto_cipher *tfm;
  4308. -
  4309. -- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  4310. -- if (IS_ERR(tfm))
  4311. -- return tfm;
  4312. --
  4313. -- err = crypto_aead_setkey(tfm, key, key_len);
  4314. -- if (!err)
  4315. -- err = crypto_aead_setauthsize(tfm, mic_len);
  4316. -- if (!err)
  4317. -- return tfm;
  4318. -+ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  4319. -+ if (!IS_ERR(tfm))
  4320. -+ crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
  4321. -
  4322. -- crypto_free_aead(tfm);
  4323. -- return ERR_PTR(err);
  4324. -+ return tfm;
  4325. - }
  4326. -
  4327. --void ieee80211_aes_key_free(struct crypto_aead *tfm)
  4328. -+
  4329. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  4330. - {
  4331. -- crypto_free_aead(tfm);
  4332. -+ crypto_free_cipher(tfm);
  4333. - }
  4334. ---- a/net/mac80211/aes_ccm.h
  4335. -+++ b/net/mac80211/aes_ccm.h
  4336. -@@ -12,15 +12,13 @@
  4337. -
  4338. - #include <linux/crypto.h>
  4339. -
  4340. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4341. -- size_t key_len,
  4342. -- size_t mic_len);
  4343. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4344. -- u8 *data, size_t data_len, u8 *mic,
  4345. -- size_t mic_len);
  4346. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4347. -- u8 *data, size_t data_len, u8 *mic,
  4348. -- size_t mic_len);
  4349. --void ieee80211_aes_key_free(struct crypto_aead *tfm);
  4350. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]);
  4351. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  4352. -+ u8 *data, size_t data_len,
  4353. -+ u8 *cdata, u8 *mic);
  4354. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  4355. -+ u8 *cdata, size_t data_len,
  4356. -+ u8 *mic, u8 *data);
  4357. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  4358. -
  4359. - #endif /* AES_CCM_H */
  4360. ---- a/net/mac80211/aes_cmac.c
  4361. -+++ b/net/mac80211/aes_cmac.c
  4362. -@@ -18,8 +18,8 @@
  4363. - #include "key.h"
  4364. - #include "aes_cmac.h"
  4365. -
  4366. -+#define AES_CMAC_KEY_LEN 16
  4367. - #define CMAC_TLEN 8 /* CMAC TLen = 64 bits (8 octets) */
  4368. --#define CMAC_TLEN_256 16 /* CMAC TLen = 128 bits (16 octets) */
  4369. - #define AAD_LEN 20
  4370. -
  4371. -
  4372. -@@ -35,9 +35,9 @@ static void gf_mulx(u8 *pad)
  4373. - pad[AES_BLOCK_SIZE - 1] ^= 0x87;
  4374. - }
  4375. -
  4376. --static void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  4377. -- const u8 *addr[], const size_t *len, u8 *mac,
  4378. -- size_t mac_len)
  4379. -+
  4380. -+static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  4381. -+ const u8 *addr[], const size_t *len, u8 *mac)
  4382. - {
  4383. - u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
  4384. - const u8 *pos, *end;
  4385. -@@ -88,7 +88,7 @@ static void aes_cmac_vector(struct crypt
  4386. - for (i = 0; i < AES_BLOCK_SIZE; i++)
  4387. - pad[i] ^= cbc[i];
  4388. - crypto_cipher_encrypt_one(tfm, pad, pad);
  4389. -- memcpy(mac, pad, mac_len);
  4390. -+ memcpy(mac, pad, CMAC_TLEN);
  4391. - }
  4392. -
  4393. -
  4394. -@@ -107,35 +107,17 @@ void ieee80211_aes_cmac(struct crypto_ci
  4395. - addr[2] = zero;
  4396. - len[2] = CMAC_TLEN;
  4397. -
  4398. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN);
  4399. -+ aes_128_cmac_vector(tfm, 3, addr, len, mic);
  4400. - }
  4401. -
  4402. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  4403. -- const u8 *data, size_t data_len, u8 *mic)
  4404. --{
  4405. -- const u8 *addr[3];
  4406. -- size_t len[3];
  4407. -- u8 zero[CMAC_TLEN_256];
  4408. --
  4409. -- memset(zero, 0, CMAC_TLEN_256);
  4410. -- addr[0] = aad;
  4411. -- len[0] = AAD_LEN;
  4412. -- addr[1] = data;
  4413. -- len[1] = data_len - CMAC_TLEN_256;
  4414. -- addr[2] = zero;
  4415. -- len[2] = CMAC_TLEN_256;
  4416. --
  4417. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN_256);
  4418. --}
  4419. -
  4420. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  4421. -- size_t key_len)
  4422. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[])
  4423. - {
  4424. - struct crypto_cipher *tfm;
  4425. -
  4426. - tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  4427. - if (!IS_ERR(tfm))
  4428. -- crypto_cipher_setkey(tfm, key, key_len);
  4429. -+ crypto_cipher_setkey(tfm, key, AES_CMAC_KEY_LEN);
  4430. -
  4431. - return tfm;
  4432. - }
  4433. ---- a/net/mac80211/aes_cmac.h
  4434. -+++ b/net/mac80211/aes_cmac.h
  4435. -@@ -11,12 +11,9 @@
  4436. -
  4437. - #include <linux/crypto.h>
  4438. -
  4439. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  4440. -- size_t key_len);
  4441. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]);
  4442. - void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,
  4443. - const u8 *data, size_t data_len, u8 *mic);
  4444. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  4445. -- const u8 *data, size_t data_len, u8 *mic);
  4446. - void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm);
  4447. -
  4448. - #endif /* AES_CMAC_H */
  4449. ---- a/net/mac80211/aes_gcm.c
  4450. -+++ /dev/null
  4451. -@@ -1,95 +0,0 @@
  4452. --/*
  4453. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  4454. -- *
  4455. -- * This program is free software; you can redistribute it and/or modify
  4456. -- * it under the terms of the GNU General Public License version 2 as
  4457. -- * published by the Free Software Foundation.
  4458. -- */
  4459. --
  4460. --#include <linux/kernel.h>
  4461. --#include <linux/types.h>
  4462. --#include <linux/crypto.h>
  4463. --#include <linux/err.h>
  4464. --#include <crypto/aes.h>
  4465. --
  4466. --#include <net/mac80211.h>
  4467. --#include "key.h"
  4468. --#include "aes_gcm.h"
  4469. --
  4470. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4471. -- u8 *data, size_t data_len, u8 *mic)
  4472. --{
  4473. -- struct scatterlist assoc, pt, ct[2];
  4474. --
  4475. -- char aead_req_data[sizeof(struct aead_request) +
  4476. -- crypto_aead_reqsize(tfm)]
  4477. -- __aligned(__alignof__(struct aead_request));
  4478. -- struct aead_request *aead_req = (void *)aead_req_data;
  4479. --
  4480. -- memset(aead_req, 0, sizeof(aead_req_data));
  4481. --
  4482. -- sg_init_one(&pt, data, data_len);
  4483. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4484. -- sg_init_table(ct, 2);
  4485. -- sg_set_buf(&ct[0], data, data_len);
  4486. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  4487. --
  4488. -- aead_request_set_tfm(aead_req, tfm);
  4489. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4490. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, j_0);
  4491. --
  4492. -- crypto_aead_encrypt(aead_req);
  4493. --}
  4494. --
  4495. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4496. -- u8 *data, size_t data_len, u8 *mic)
  4497. --{
  4498. -- struct scatterlist assoc, pt, ct[2];
  4499. -- char aead_req_data[sizeof(struct aead_request) +
  4500. -- crypto_aead_reqsize(tfm)]
  4501. -- __aligned(__alignof__(struct aead_request));
  4502. -- struct aead_request *aead_req = (void *)aead_req_data;
  4503. --
  4504. -- if (data_len == 0)
  4505. -- return -EINVAL;
  4506. --
  4507. -- memset(aead_req, 0, sizeof(aead_req_data));
  4508. --
  4509. -- sg_init_one(&pt, data, data_len);
  4510. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4511. -- sg_init_table(ct, 2);
  4512. -- sg_set_buf(&ct[0], data, data_len);
  4513. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  4514. --
  4515. -- aead_request_set_tfm(aead_req, tfm);
  4516. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4517. -- aead_request_set_crypt(aead_req, ct, &pt,
  4518. -- data_len + IEEE80211_GCMP_MIC_LEN, j_0);
  4519. --
  4520. -- return crypto_aead_decrypt(aead_req);
  4521. --}
  4522. --
  4523. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  4524. -- size_t key_len)
  4525. --{
  4526. -- struct crypto_aead *tfm;
  4527. -- int err;
  4528. --
  4529. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  4530. -- if (IS_ERR(tfm))
  4531. -- return tfm;
  4532. --
  4533. -- err = crypto_aead_setkey(tfm, key, key_len);
  4534. -- if (!err)
  4535. -- err = crypto_aead_setauthsize(tfm, IEEE80211_GCMP_MIC_LEN);
  4536. -- if (!err)
  4537. -- return tfm;
  4538. --
  4539. -- crypto_free_aead(tfm);
  4540. -- return ERR_PTR(err);
  4541. --}
  4542. --
  4543. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  4544. --{
  4545. -- crypto_free_aead(tfm);
  4546. --}
  4547. ---- a/net/mac80211/aes_gcm.h
  4548. -+++ /dev/null
  4549. -@@ -1,22 +0,0 @@
  4550. --/*
  4551. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  4552. -- *
  4553. -- * This program is free software; you can redistribute it and/or modify
  4554. -- * it under the terms of the GNU General Public License version 2 as
  4555. -- * published by the Free Software Foundation.
  4556. -- */
  4557. --
  4558. --#ifndef AES_GCM_H
  4559. --#define AES_GCM_H
  4560. --
  4561. --#include <linux/crypto.h>
  4562. --
  4563. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4564. -- u8 *data, size_t data_len, u8 *mic);
  4565. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4566. -- u8 *data, size_t data_len, u8 *mic);
  4567. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  4568. -- size_t key_len);
  4569. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  4570. --
  4571. --#endif /* AES_GCM_H */
  4572. ---- a/net/mac80211/aes_gmac.c
  4573. -+++ /dev/null
  4574. -@@ -1,84 +0,0 @@
  4575. --/*
  4576. -- * AES-GMAC for IEEE 802.11 BIP-GMAC-128 and BIP-GMAC-256
  4577. -- * Copyright 2015, Qualcomm Atheros, Inc.
  4578. -- *
  4579. -- * This program is free software; you can redistribute it and/or modify
  4580. -- * it under the terms of the GNU General Public License version 2 as
  4581. -- * published by the Free Software Foundation.
  4582. -- */
  4583. --
  4584. --#include <linux/kernel.h>
  4585. --#include <linux/types.h>
  4586. --#include <linux/crypto.h>
  4587. --#include <linux/err.h>
  4588. --#include <crypto/aes.h>
  4589. --
  4590. --#include <net/mac80211.h>
  4591. --#include "key.h"
  4592. --#include "aes_gmac.h"
  4593. --
  4594. --#define GMAC_MIC_LEN 16
  4595. --#define GMAC_NONCE_LEN 12
  4596. --#define AAD_LEN 20
  4597. --
  4598. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4599. -- const u8 *data, size_t data_len, u8 *mic)
  4600. --{
  4601. -- struct scatterlist sg[3], ct[1];
  4602. -- char aead_req_data[sizeof(struct aead_request) +
  4603. -- crypto_aead_reqsize(tfm)]
  4604. -- __aligned(__alignof__(struct aead_request));
  4605. -- struct aead_request *aead_req = (void *)aead_req_data;
  4606. -- u8 zero[GMAC_MIC_LEN], iv[AES_BLOCK_SIZE];
  4607. --
  4608. -- if (data_len < GMAC_MIC_LEN)
  4609. -- return -EINVAL;
  4610. --
  4611. -- memset(aead_req, 0, sizeof(aead_req_data));
  4612. --
  4613. -- memset(zero, 0, GMAC_MIC_LEN);
  4614. -- sg_init_table(sg, 3);
  4615. -- sg_set_buf(&sg[0], aad, AAD_LEN);
  4616. -- sg_set_buf(&sg[1], data, data_len - GMAC_MIC_LEN);
  4617. -- sg_set_buf(&sg[2], zero, GMAC_MIC_LEN);
  4618. --
  4619. -- memcpy(iv, nonce, GMAC_NONCE_LEN);
  4620. -- memset(iv + GMAC_NONCE_LEN, 0, sizeof(iv) - GMAC_NONCE_LEN);
  4621. -- iv[AES_BLOCK_SIZE - 1] = 0x01;
  4622. --
  4623. -- sg_init_table(ct, 1);
  4624. -- sg_set_buf(&ct[0], mic, GMAC_MIC_LEN);
  4625. --
  4626. -- aead_request_set_tfm(aead_req, tfm);
  4627. -- aead_request_set_assoc(aead_req, sg, AAD_LEN + data_len);
  4628. -- aead_request_set_crypt(aead_req, NULL, ct, 0, iv);
  4629. --
  4630. -- crypto_aead_encrypt(aead_req);
  4631. --
  4632. -- return 0;
  4633. --}
  4634. --
  4635. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  4636. -- size_t key_len)
  4637. --{
  4638. -- struct crypto_aead *tfm;
  4639. -- int err;
  4640. --
  4641. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  4642. -- if (IS_ERR(tfm))
  4643. -- return tfm;
  4644. --
  4645. -- err = crypto_aead_setkey(tfm, key, key_len);
  4646. -- if (!err)
  4647. -- return tfm;
  4648. -- if (!err)
  4649. -- err = crypto_aead_setauthsize(tfm, GMAC_MIC_LEN);
  4650. --
  4651. -- crypto_free_aead(tfm);
  4652. -- return ERR_PTR(err);
  4653. --}
  4654. --
  4655. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  4656. --{
  4657. -- crypto_free_aead(tfm);
  4658. --}
  4659. ---- a/net/mac80211/aes_gmac.h
  4660. -+++ /dev/null
  4661. -@@ -1,20 +0,0 @@
  4662. --/*
  4663. -- * Copyright 2015, Qualcomm Atheros, Inc.
  4664. -- *
  4665. -- * This program is free software; you can redistribute it and/or modify
  4666. -- * it under the terms of the GNU General Public License version 2 as
  4667. -- * published by the Free Software Foundation.
  4668. -- */
  4669. --
  4670. --#ifndef AES_GMAC_H
  4671. --#define AES_GMAC_H
  4672. --
  4673. --#include <linux/crypto.h>
  4674. --
  4675. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  4676. -- size_t key_len);
  4677. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4678. -- const u8 *data, size_t data_len, u8 *mic);
  4679. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  4680. --
  4681. --#endif /* AES_GMAC_H */
  4682. ---- a/net/mac80211/cfg.c
  4683. -+++ b/net/mac80211/cfg.c
  4684. -@@ -162,13 +162,8 @@ static int ieee80211_add_key(struct wiph
  4685. - return -EINVAL;
  4686. - break;
  4687. - case WLAN_CIPHER_SUITE_CCMP:
  4688. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4689. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4690. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4691. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4692. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4693. - case WLAN_CIPHER_SUITE_GCMP:
  4694. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4695. - break;
  4696. - default:
  4697. - cs = ieee80211_cs_get(local, params->cipher, sdata->vif.type);
  4698. -@@ -353,7 +348,6 @@ static int ieee80211_get_key(struct wiph
  4699. - params.seq_len = 6;
  4700. - break;
  4701. - case WLAN_CIPHER_SUITE_CCMP:
  4702. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4703. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  4704. - seq[0] = pn64;
  4705. - seq[1] = pn64 >> 8;
  4706. -@@ -365,35 +359,10 @@ static int ieee80211_get_key(struct wiph
  4707. - params.seq_len = 6;
  4708. - break;
  4709. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4710. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4711. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  4712. - seq[0] = pn64;
  4713. - seq[1] = pn64 >> 8;
  4714. - seq[2] = pn64 >> 16;
  4715. -- seq[3] = pn64 >> 24;
  4716. -- seq[4] = pn64 >> 32;
  4717. -- seq[5] = pn64 >> 40;
  4718. -- params.seq = seq;
  4719. -- params.seq_len = 6;
  4720. -- break;
  4721. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4722. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4723. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  4724. -- seq[0] = pn64;
  4725. -- seq[1] = pn64 >> 8;
  4726. -- seq[2] = pn64 >> 16;
  4727. -- seq[3] = pn64 >> 24;
  4728. -- seq[4] = pn64 >> 32;
  4729. -- seq[5] = pn64 >> 40;
  4730. -- params.seq = seq;
  4731. -- params.seq_len = 6;
  4732. -- break;
  4733. -- case WLAN_CIPHER_SUITE_GCMP:
  4734. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4735. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  4736. -- seq[0] = pn64;
  4737. -- seq[1] = pn64 >> 8;
  4738. -- seq[2] = pn64 >> 16;
  4739. - seq[3] = pn64 >> 24;
  4740. - seq[4] = pn64 >> 32;
  4741. - seq[5] = pn64 >> 40;
  4742. ---- a/net/mac80211/debugfs_key.c
  4743. -+++ b/net/mac80211/debugfs_key.c
  4744. -@@ -94,33 +94,17 @@ static ssize_t key_tx_spec_read(struct f
  4745. - key->u.tkip.tx.iv16);
  4746. - break;
  4747. - case WLAN_CIPHER_SUITE_CCMP:
  4748. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4749. - pn = atomic64_read(&key->u.ccmp.tx_pn);
  4750. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4751. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4752. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4753. - break;
  4754. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4755. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4756. - pn = atomic64_read(&key->u.aes_cmac.tx_pn);
  4757. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4758. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4759. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4760. - break;
  4761. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4762. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4763. -- pn = atomic64_read(&key->u.aes_gmac.tx_pn);
  4764. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4765. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4766. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4767. -- break;
  4768. -- case WLAN_CIPHER_SUITE_GCMP:
  4769. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4770. -- pn = atomic64_read(&key->u.gcmp.tx_pn);
  4771. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4772. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4773. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4774. -- break;
  4775. - default:
  4776. - return 0;
  4777. - }
  4778. -@@ -150,7 +134,6 @@ static ssize_t key_rx_spec_read(struct f
  4779. - len = p - buf;
  4780. - break;
  4781. - case WLAN_CIPHER_SUITE_CCMP:
  4782. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4783. - for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  4784. - rpn = key->u.ccmp.rx_pn[i];
  4785. - p += scnprintf(p, sizeof(buf)+buf-p,
  4786. -@@ -161,7 +144,6 @@ static ssize_t key_rx_spec_read(struct f
  4787. - len = p - buf;
  4788. - break;
  4789. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4790. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4791. - rpn = key->u.aes_cmac.rx_pn;
  4792. - p += scnprintf(p, sizeof(buf)+buf-p,
  4793. - "%02x%02x%02x%02x%02x%02x\n",
  4794. -@@ -169,26 +151,6 @@ static ssize_t key_rx_spec_read(struct f
  4795. - rpn[3], rpn[4], rpn[5]);
  4796. - len = p - buf;
  4797. - break;
  4798. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4799. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4800. -- rpn = key->u.aes_gmac.rx_pn;
  4801. -- p += scnprintf(p, sizeof(buf)+buf-p,
  4802. -- "%02x%02x%02x%02x%02x%02x\n",
  4803. -- rpn[0], rpn[1], rpn[2],
  4804. -- rpn[3], rpn[4], rpn[5]);
  4805. -- len = p - buf;
  4806. -- break;
  4807. -- case WLAN_CIPHER_SUITE_GCMP:
  4808. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4809. -- for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  4810. -- rpn = key->u.gcmp.rx_pn[i];
  4811. -- p += scnprintf(p, sizeof(buf)+buf-p,
  4812. -- "%02x%02x%02x%02x%02x%02x\n",
  4813. -- rpn[0], rpn[1], rpn[2],
  4814. -- rpn[3], rpn[4], rpn[5]);
  4815. -- }
  4816. -- len = p - buf;
  4817. -- break;
  4818. - default:
  4819. - return 0;
  4820. - }
  4821. -@@ -205,23 +167,12 @@ static ssize_t key_replays_read(struct f
  4822. -
  4823. - switch (key->conf.cipher) {
  4824. - case WLAN_CIPHER_SUITE_CCMP:
  4825. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4826. - len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays);
  4827. - break;
  4828. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4829. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4830. - len = scnprintf(buf, sizeof(buf), "%u\n",
  4831. - key->u.aes_cmac.replays);
  4832. - break;
  4833. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4834. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4835. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  4836. -- key->u.aes_gmac.replays);
  4837. -- break;
  4838. -- case WLAN_CIPHER_SUITE_GCMP:
  4839. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4840. -- len = scnprintf(buf, sizeof(buf), "%u\n", key->u.gcmp.replays);
  4841. -- break;
  4842. - default:
  4843. - return 0;
  4844. - }
  4845. -@@ -238,15 +189,9 @@ static ssize_t key_icverrors_read(struct
  4846. -
  4847. - switch (key->conf.cipher) {
  4848. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4849. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4850. - len = scnprintf(buf, sizeof(buf), "%u\n",
  4851. - key->u.aes_cmac.icverrors);
  4852. - break;
  4853. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4854. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4855. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  4856. -- key->u.aes_gmac.icverrors);
  4857. -- break;
  4858. - default:
  4859. - return 0;
  4860. - }
  4861. ---- a/net/mac80211/key.c
  4862. -+++ b/net/mac80211/key.c
  4863. -@@ -24,8 +24,6 @@
  4864. - #include "debugfs_key.h"
  4865. - #include "aes_ccm.h"
  4866. - #include "aes_cmac.h"
  4867. --#include "aes_gmac.h"
  4868. --#include "aes_gcm.h"
  4869. -
  4870. -
  4871. - /**
  4872. -@@ -164,13 +162,7 @@ static int ieee80211_key_enable_hw_accel
  4873. - case WLAN_CIPHER_SUITE_WEP104:
  4874. - case WLAN_CIPHER_SUITE_TKIP:
  4875. - case WLAN_CIPHER_SUITE_CCMP:
  4876. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4877. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4878. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4879. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4880. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4881. -- case WLAN_CIPHER_SUITE_GCMP:
  4882. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4883. - /* all of these we can do in software - if driver can */
  4884. - if (ret == 1)
  4885. - return 0;
  4886. -@@ -394,26 +386,7 @@ ieee80211_key_alloc(u32 cipher, int idx,
  4887. - * Initialize AES key state here as an optimization so that
  4888. - * it does not need to be initialized for every packet.
  4889. - */
  4890. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  4891. -- key_data, key_len, IEEE80211_CCMP_MIC_LEN);
  4892. -- if (IS_ERR(key->u.ccmp.tfm)) {
  4893. -- err = PTR_ERR(key->u.ccmp.tfm);
  4894. -- kfree(key);
  4895. -- return ERR_PTR(err);
  4896. -- }
  4897. -- break;
  4898. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4899. -- key->conf.iv_len = IEEE80211_CCMP_256_HDR_LEN;
  4900. -- key->conf.icv_len = IEEE80211_CCMP_256_MIC_LEN;
  4901. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  4902. -- for (j = 0; j < IEEE80211_CCMP_256_PN_LEN; j++)
  4903. -- key->u.ccmp.rx_pn[i][j] =
  4904. -- seq[IEEE80211_CCMP_256_PN_LEN - j - 1];
  4905. -- /* Initialize AES key state here as an optimization so that
  4906. -- * it does not need to be initialized for every packet.
  4907. -- */
  4908. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  4909. -- key_data, key_len, IEEE80211_CCMP_256_MIC_LEN);
  4910. -+ key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(key_data);
  4911. - if (IS_ERR(key->u.ccmp.tfm)) {
  4912. - err = PTR_ERR(key->u.ccmp.tfm);
  4913. - kfree(key);
  4914. -@@ -421,12 +394,8 @@ ieee80211_key_alloc(u32 cipher, int idx,
  4915. - }
  4916. - break;
  4917. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4918. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4919. - key->conf.iv_len = 0;
  4920. -- if (cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  4921. -- key->conf.icv_len = sizeof(struct ieee80211_mmie);
  4922. -- else
  4923. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  4924. -+ key->conf.icv_len = sizeof(struct ieee80211_mmie);
  4925. - if (seq)
  4926. - for (j = 0; j < IEEE80211_CMAC_PN_LEN; j++)
  4927. - key->u.aes_cmac.rx_pn[j] =
  4928. -@@ -436,51 +405,13 @@ ieee80211_key_alloc(u32 cipher, int idx,
  4929. - * it does not need to be initialized for every packet.
  4930. - */
  4931. - key->u.aes_cmac.tfm =
  4932. -- ieee80211_aes_cmac_key_setup(key_data, key_len);
  4933. -+ ieee80211_aes_cmac_key_setup(key_data);
  4934. - if (IS_ERR(key->u.aes_cmac.tfm)) {
  4935. - err = PTR_ERR(key->u.aes_cmac.tfm);
  4936. - kfree(key);
  4937. - return ERR_PTR(err);
  4938. - }
  4939. - break;
  4940. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4941. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4942. -- key->conf.iv_len = 0;
  4943. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  4944. -- if (seq)
  4945. -- for (j = 0; j < IEEE80211_GMAC_PN_LEN; j++)
  4946. -- key->u.aes_gmac.rx_pn[j] =
  4947. -- seq[IEEE80211_GMAC_PN_LEN - j - 1];
  4948. -- /* Initialize AES key state here as an optimization so that
  4949. -- * it does not need to be initialized for every packet.
  4950. -- */
  4951. -- key->u.aes_gmac.tfm =
  4952. -- ieee80211_aes_gmac_key_setup(key_data, key_len);
  4953. -- if (IS_ERR(key->u.aes_gmac.tfm)) {
  4954. -- err = PTR_ERR(key->u.aes_gmac.tfm);
  4955. -- kfree(key);
  4956. -- return ERR_PTR(err);
  4957. -- }
  4958. -- break;
  4959. -- case WLAN_CIPHER_SUITE_GCMP:
  4960. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4961. -- key->conf.iv_len = IEEE80211_GCMP_HDR_LEN;
  4962. -- key->conf.icv_len = IEEE80211_GCMP_MIC_LEN;
  4963. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  4964. -- for (j = 0; j < IEEE80211_GCMP_PN_LEN; j++)
  4965. -- key->u.gcmp.rx_pn[i][j] =
  4966. -- seq[IEEE80211_GCMP_PN_LEN - j - 1];
  4967. -- /* Initialize AES key state here as an optimization so that
  4968. -- * it does not need to be initialized for every packet.
  4969. -- */
  4970. -- key->u.gcmp.tfm = ieee80211_aes_gcm_key_setup_encrypt(key_data,
  4971. -- key_len);
  4972. -- if (IS_ERR(key->u.gcmp.tfm)) {
  4973. -- err = PTR_ERR(key->u.gcmp.tfm);
  4974. -- kfree(key);
  4975. -- return ERR_PTR(err);
  4976. -- }
  4977. -- break;
  4978. - default:
  4979. - if (cs) {
  4980. - size_t len = (seq_len > MAX_PN_LEN) ?
  4981. -@@ -502,24 +433,10 @@ ieee80211_key_alloc(u32 cipher, int idx,
  4982. -
  4983. - static void ieee80211_key_free_common(struct ieee80211_key *key)
  4984. - {
  4985. -- switch (key->conf.cipher) {
  4986. -- case WLAN_CIPHER_SUITE_CCMP:
  4987. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4988. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_CCMP)
  4989. - ieee80211_aes_key_free(key->u.ccmp.tfm);
  4990. -- break;
  4991. -- case WLAN_CIPHER_SUITE_AES_CMAC:
  4992. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4993. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  4994. - ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
  4995. -- break;
  4996. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4997. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4998. -- ieee80211_aes_gmac_key_free(key->u.aes_gmac.tfm);
  4999. -- break;
  5000. -- case WLAN_CIPHER_SUITE_GCMP:
  5001. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5002. -- ieee80211_aes_gcm_key_free(key->u.gcmp.tfm);
  5003. -- break;
  5004. -- }
  5005. - kzfree(key);
  5006. - }
  5007. -
  5008. -@@ -826,7 +743,6 @@ void ieee80211_get_key_tx_seq(struct iee
  5009. - seq->tkip.iv16 = key->u.tkip.tx.iv16;
  5010. - break;
  5011. - case WLAN_CIPHER_SUITE_CCMP:
  5012. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5013. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  5014. - seq->ccmp.pn[5] = pn64;
  5015. - seq->ccmp.pn[4] = pn64 >> 8;
  5016. -@@ -836,7 +752,6 @@ void ieee80211_get_key_tx_seq(struct iee
  5017. - seq->ccmp.pn[0] = pn64 >> 40;
  5018. - break;
  5019. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5020. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5021. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  5022. - seq->ccmp.pn[5] = pn64;
  5023. - seq->ccmp.pn[4] = pn64 >> 8;
  5024. -@@ -845,26 +760,6 @@ void ieee80211_get_key_tx_seq(struct iee
  5025. - seq->ccmp.pn[1] = pn64 >> 32;
  5026. - seq->ccmp.pn[0] = pn64 >> 40;
  5027. - break;
  5028. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5029. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5030. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  5031. -- seq->ccmp.pn[5] = pn64;
  5032. -- seq->ccmp.pn[4] = pn64 >> 8;
  5033. -- seq->ccmp.pn[3] = pn64 >> 16;
  5034. -- seq->ccmp.pn[2] = pn64 >> 24;
  5035. -- seq->ccmp.pn[1] = pn64 >> 32;
  5036. -- seq->ccmp.pn[0] = pn64 >> 40;
  5037. -- break;
  5038. -- case WLAN_CIPHER_SUITE_GCMP:
  5039. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5040. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  5041. -- seq->gcmp.pn[5] = pn64;
  5042. -- seq->gcmp.pn[4] = pn64 >> 8;
  5043. -- seq->gcmp.pn[3] = pn64 >> 16;
  5044. -- seq->gcmp.pn[2] = pn64 >> 24;
  5045. -- seq->gcmp.pn[1] = pn64 >> 32;
  5046. -- seq->gcmp.pn[0] = pn64 >> 40;
  5047. -- break;
  5048. - default:
  5049. - WARN_ON(1);
  5050. - }
  5051. -@@ -887,7 +782,6 @@ void ieee80211_get_key_rx_seq(struct iee
  5052. - seq->tkip.iv16 = key->u.tkip.rx[tid].iv16;
  5053. - break;
  5054. - case WLAN_CIPHER_SUITE_CCMP:
  5055. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5056. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5057. - return;
  5058. - if (tid < 0)
  5059. -@@ -897,29 +791,11 @@ void ieee80211_get_key_rx_seq(struct iee
  5060. - memcpy(seq->ccmp.pn, pn, IEEE80211_CCMP_PN_LEN);
  5061. - break;
  5062. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5063. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5064. - if (WARN_ON(tid != 0))
  5065. - return;
  5066. - pn = key->u.aes_cmac.rx_pn;
  5067. - memcpy(seq->aes_cmac.pn, pn, IEEE80211_CMAC_PN_LEN);
  5068. - break;
  5069. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5070. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5071. -- if (WARN_ON(tid != 0))
  5072. -- return;
  5073. -- pn = key->u.aes_gmac.rx_pn;
  5074. -- memcpy(seq->aes_gmac.pn, pn, IEEE80211_GMAC_PN_LEN);
  5075. -- break;
  5076. -- case WLAN_CIPHER_SUITE_GCMP:
  5077. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5078. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5079. -- return;
  5080. -- if (tid < 0)
  5081. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  5082. -- else
  5083. -- pn = key->u.gcmp.rx_pn[tid];
  5084. -- memcpy(seq->gcmp.pn, pn, IEEE80211_GCMP_PN_LEN);
  5085. -- break;
  5086. - }
  5087. - }
  5088. - EXPORT_SYMBOL(ieee80211_get_key_rx_seq);
  5089. -@@ -938,7 +814,6 @@ void ieee80211_set_key_tx_seq(struct iee
  5090. - key->u.tkip.tx.iv16 = seq->tkip.iv16;
  5091. - break;
  5092. - case WLAN_CIPHER_SUITE_CCMP:
  5093. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5094. - pn64 = (u64)seq->ccmp.pn[5] |
  5095. - ((u64)seq->ccmp.pn[4] << 8) |
  5096. - ((u64)seq->ccmp.pn[3] << 16) |
  5097. -@@ -948,7 +823,6 @@ void ieee80211_set_key_tx_seq(struct iee
  5098. - atomic64_set(&key->u.ccmp.tx_pn, pn64);
  5099. - break;
  5100. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5101. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5102. - pn64 = (u64)seq->aes_cmac.pn[5] |
  5103. - ((u64)seq->aes_cmac.pn[4] << 8) |
  5104. - ((u64)seq->aes_cmac.pn[3] << 16) |
  5105. -@@ -957,26 +831,6 @@ void ieee80211_set_key_tx_seq(struct iee
  5106. - ((u64)seq->aes_cmac.pn[0] << 40);
  5107. - atomic64_set(&key->u.aes_cmac.tx_pn, pn64);
  5108. - break;
  5109. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5110. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5111. -- pn64 = (u64)seq->aes_gmac.pn[5] |
  5112. -- ((u64)seq->aes_gmac.pn[4] << 8) |
  5113. -- ((u64)seq->aes_gmac.pn[3] << 16) |
  5114. -- ((u64)seq->aes_gmac.pn[2] << 24) |
  5115. -- ((u64)seq->aes_gmac.pn[1] << 32) |
  5116. -- ((u64)seq->aes_gmac.pn[0] << 40);
  5117. -- atomic64_set(&key->u.aes_gmac.tx_pn, pn64);
  5118. -- break;
  5119. -- case WLAN_CIPHER_SUITE_GCMP:
  5120. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5121. -- pn64 = (u64)seq->gcmp.pn[5] |
  5122. -- ((u64)seq->gcmp.pn[4] << 8) |
  5123. -- ((u64)seq->gcmp.pn[3] << 16) |
  5124. -- ((u64)seq->gcmp.pn[2] << 24) |
  5125. -- ((u64)seq->gcmp.pn[1] << 32) |
  5126. -- ((u64)seq->gcmp.pn[0] << 40);
  5127. -- atomic64_set(&key->u.gcmp.tx_pn, pn64);
  5128. -- break;
  5129. - default:
  5130. - WARN_ON(1);
  5131. - break;
  5132. -@@ -1000,7 +854,6 @@ void ieee80211_set_key_rx_seq(struct iee
  5133. - key->u.tkip.rx[tid].iv16 = seq->tkip.iv16;
  5134. - break;
  5135. - case WLAN_CIPHER_SUITE_CCMP:
  5136. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5137. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5138. - return;
  5139. - if (tid < 0)
  5140. -@@ -1010,29 +863,11 @@ void ieee80211_set_key_rx_seq(struct iee
  5141. - memcpy(pn, seq->ccmp.pn, IEEE80211_CCMP_PN_LEN);
  5142. - break;
  5143. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5144. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5145. - if (WARN_ON(tid != 0))
  5146. - return;
  5147. - pn = key->u.aes_cmac.rx_pn;
  5148. - memcpy(pn, seq->aes_cmac.pn, IEEE80211_CMAC_PN_LEN);
  5149. - break;
  5150. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5151. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5152. -- if (WARN_ON(tid != 0))
  5153. -- return;
  5154. -- pn = key->u.aes_gmac.rx_pn;
  5155. -- memcpy(pn, seq->aes_gmac.pn, IEEE80211_GMAC_PN_LEN);
  5156. -- break;
  5157. -- case WLAN_CIPHER_SUITE_GCMP:
  5158. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5159. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5160. -- return;
  5161. -- if (tid < 0)
  5162. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  5163. -- else
  5164. -- pn = key->u.gcmp.rx_pn[tid];
  5165. -- memcpy(pn, seq->gcmp.pn, IEEE80211_GCMP_PN_LEN);
  5166. -- break;
  5167. - default:
  5168. - WARN_ON(1);
  5169. - break;
  5170. ---- a/net/mac80211/key.h
  5171. -+++ b/net/mac80211/key.h
  5172. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  5173. - * Management frames.
  5174. - */
  5175. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  5176. -- struct crypto_aead *tfm;
  5177. -+ struct crypto_cipher *tfm;
  5178. - u32 replays; /* dot11RSNAStatsCCMPReplays */
  5179. - } ccmp;
  5180. - struct {
  5181. -@@ -95,24 +95,6 @@ struct ieee80211_key {
  5182. - u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  5183. - } aes_cmac;
  5184. - struct {
  5185. -- atomic64_t tx_pn;
  5186. -- u8 rx_pn[IEEE80211_GMAC_PN_LEN];
  5187. -- struct crypto_aead *tfm;
  5188. -- u32 replays; /* dot11RSNAStatsCMACReplays */
  5189. -- u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  5190. -- } aes_gmac;
  5191. -- struct {
  5192. -- atomic64_t tx_pn;
  5193. -- /* Last received packet number. The first
  5194. -- * IEEE80211_NUM_TIDS counters are used with Data
  5195. -- * frames and the last counter is used with Robust
  5196. -- * Management frames.
  5197. -- */
  5198. -- u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_GCMP_PN_LEN];
  5199. -- struct crypto_aead *tfm;
  5200. -- u32 replays; /* dot11RSNAStatsGCMPReplays */
  5201. -- } gcmp;
  5202. -- struct {
  5203. - /* generic cipher scheme */
  5204. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][MAX_PN_LEN];
  5205. - } gen;
  5206. ---- a/net/mac80211/main.c
  5207. -+++ b/net/mac80211/main.c
  5208. -@@ -666,15 +666,9 @@ static int ieee80211_init_cipher_suites(
  5209. - WLAN_CIPHER_SUITE_WEP104,
  5210. - WLAN_CIPHER_SUITE_TKIP,
  5211. - WLAN_CIPHER_SUITE_CCMP,
  5212. -- WLAN_CIPHER_SUITE_CCMP_256,
  5213. -- WLAN_CIPHER_SUITE_GCMP,
  5214. -- WLAN_CIPHER_SUITE_GCMP_256,
  5215. -
  5216. - /* keep last -- depends on hw flags! */
  5217. -- WLAN_CIPHER_SUITE_AES_CMAC,
  5218. -- WLAN_CIPHER_SUITE_BIP_CMAC_256,
  5219. -- WLAN_CIPHER_SUITE_BIP_GMAC_128,
  5220. -- WLAN_CIPHER_SUITE_BIP_GMAC_256,
  5221. -+ WLAN_CIPHER_SUITE_AES_CMAC
  5222. - };
  5223. -
  5224. - if (local->hw.flags & IEEE80211_HW_SW_CRYPTO_CONTROL ||
  5225. -@@ -713,7 +707,7 @@ static int ieee80211_init_cipher_suites(
  5226. - local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  5227. -
  5228. - if (!have_mfp)
  5229. -- local->hw.wiphy->n_cipher_suites -= 4;
  5230. -+ local->hw.wiphy->n_cipher_suites--;
  5231. -
  5232. - if (!have_wep) {
  5233. - local->hw.wiphy->cipher_suites += 2;
  5234. -@@ -730,42 +724,32 @@ static int ieee80211_init_cipher_suites(
  5235. - /* Driver specifies cipher schemes only (but not cipher suites
  5236. - * including the schemes)
  5237. - *
  5238. -- * We start counting ciphers defined by schemes, TKIP, CCMP,
  5239. -- * CCMP-256, GCMP, and GCMP-256
  5240. -+ * We start counting ciphers defined by schemes, TKIP and CCMP
  5241. - */
  5242. -- n_suites = local->hw.n_cipher_schemes + 5;
  5243. -+ n_suites = local->hw.n_cipher_schemes + 2;
  5244. -
  5245. - /* check if we have WEP40 and WEP104 */
  5246. - if (have_wep)
  5247. - n_suites += 2;
  5248. -
  5249. -- /* check if we have AES_CMAC, BIP-CMAC-256, BIP-GMAC-128,
  5250. -- * BIP-GMAC-256
  5251. -- */
  5252. -+ /* check if we have AES_CMAC */
  5253. - if (have_mfp)
  5254. -- n_suites += 4;
  5255. -+ n_suites++;
  5256. -
  5257. - suites = kmalloc(sizeof(u32) * n_suites, GFP_KERNEL);
  5258. - if (!suites)
  5259. - return -ENOMEM;
  5260. -
  5261. - suites[w++] = WLAN_CIPHER_SUITE_CCMP;
  5262. -- suites[w++] = WLAN_CIPHER_SUITE_CCMP_256;
  5263. - suites[w++] = WLAN_CIPHER_SUITE_TKIP;
  5264. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP;
  5265. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP_256;
  5266. -
  5267. - if (have_wep) {
  5268. - suites[w++] = WLAN_CIPHER_SUITE_WEP40;
  5269. - suites[w++] = WLAN_CIPHER_SUITE_WEP104;
  5270. - }
  5271. -
  5272. -- if (have_mfp) {
  5273. -+ if (have_mfp)
  5274. - suites[w++] = WLAN_CIPHER_SUITE_AES_CMAC;
  5275. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_CMAC_256;
  5276. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_128;
  5277. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_256;
  5278. -- }
  5279. -
  5280. - for (r = 0; r < local->hw.n_cipher_schemes; r++)
  5281. - suites[w++] = cs[r].cipher;
  5282. ---- a/net/mac80211/rx.c
  5283. -+++ b/net/mac80211/rx.c
  5284. -@@ -647,7 +647,6 @@ static int ieee80211_get_mmie_keyidx(str
  5285. - {
  5286. - struct ieee80211_mgmt *hdr = (struct ieee80211_mgmt *) skb->data;
  5287. - struct ieee80211_mmie *mmie;
  5288. -- struct ieee80211_mmie_16 *mmie16;
  5289. -
  5290. - if (skb->len < 24 + sizeof(*mmie) || !is_multicast_ether_addr(hdr->da))
  5291. - return -1;
  5292. -@@ -657,18 +656,11 @@ static int ieee80211_get_mmie_keyidx(str
  5293. -
  5294. - mmie = (struct ieee80211_mmie *)
  5295. - (skb->data + skb->len - sizeof(*mmie));
  5296. -- if (mmie->element_id == WLAN_EID_MMIE &&
  5297. -- mmie->length == sizeof(*mmie) - 2)
  5298. -- return le16_to_cpu(mmie->key_id);
  5299. --
  5300. -- mmie16 = (struct ieee80211_mmie_16 *)
  5301. -- (skb->data + skb->len - sizeof(*mmie16));
  5302. -- if (skb->len >= 24 + sizeof(*mmie16) &&
  5303. -- mmie16->element_id == WLAN_EID_MMIE &&
  5304. -- mmie16->length == sizeof(*mmie16) - 2)
  5305. -- return le16_to_cpu(mmie16->key_id);
  5306. -+ if (mmie->element_id != WLAN_EID_MMIE ||
  5307. -+ mmie->length != sizeof(*mmie) - 2)
  5308. -+ return -1;
  5309. -
  5310. -- return -1;
  5311. -+ return le16_to_cpu(mmie->key_id);
  5312. - }
  5313. -
  5314. - static int iwl80211_get_cs_keyid(const struct ieee80211_cipher_scheme *cs,
  5315. -@@ -1658,27 +1650,11 @@ ieee80211_rx_h_decrypt(struct ieee80211_
  5316. - result = ieee80211_crypto_tkip_decrypt(rx);
  5317. - break;
  5318. - case WLAN_CIPHER_SUITE_CCMP:
  5319. -- result = ieee80211_crypto_ccmp_decrypt(
  5320. -- rx, IEEE80211_CCMP_MIC_LEN);
  5321. -- break;
  5322. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5323. -- result = ieee80211_crypto_ccmp_decrypt(
  5324. -- rx, IEEE80211_CCMP_256_MIC_LEN);
  5325. -+ result = ieee80211_crypto_ccmp_decrypt(rx);
  5326. - break;
  5327. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5328. - result = ieee80211_crypto_aes_cmac_decrypt(rx);
  5329. - break;
  5330. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5331. -- result = ieee80211_crypto_aes_cmac_256_decrypt(rx);
  5332. -- break;
  5333. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5334. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5335. -- result = ieee80211_crypto_aes_gmac_decrypt(rx);
  5336. -- break;
  5337. -- case WLAN_CIPHER_SUITE_GCMP:
  5338. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5339. -- result = ieee80211_crypto_gcmp_decrypt(rx);
  5340. -- break;
  5341. - default:
  5342. - result = ieee80211_crypto_hw_decrypt(rx);
  5343. - }
  5344. -@@ -1805,9 +1781,7 @@ ieee80211_rx_h_defragment(struct ieee802
  5345. - /* This is the first fragment of a new frame. */
  5346. - entry = ieee80211_reassemble_add(rx->sdata, frag, seq,
  5347. - rx->seqno_idx, &(rx->skb));
  5348. -- if (rx->key &&
  5349. -- (rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP ||
  5350. -- rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP_256) &&
  5351. -+ if (rx->key && rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP &&
  5352. - ieee80211_has_protected(fc)) {
  5353. - int queue = rx->security_idx;
  5354. - /* Store CCMP PN so that we can verify that the next
  5355. -@@ -1836,9 +1810,7 @@ ieee80211_rx_h_defragment(struct ieee802
  5356. - int i;
  5357. - u8 pn[IEEE80211_CCMP_PN_LEN], *rpn;
  5358. - int queue;
  5359. -- if (!rx->key ||
  5360. -- (rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP &&
  5361. -- rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP_256))
  5362. -+ if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP)
  5363. - return RX_DROP_UNUSABLE;
  5364. - memcpy(pn, entry->last_pn, IEEE80211_CCMP_PN_LEN);
  5365. - for (i = IEEE80211_CCMP_PN_LEN - 1; i >= 0; i--) {
  5366. ---- a/net/mac80211/tx.c
  5367. -+++ b/net/mac80211/tx.c
  5368. -@@ -626,9 +626,6 @@ ieee80211_tx_h_select_key(struct ieee802
  5369. - tx->key = NULL;
  5370. - break;
  5371. - case WLAN_CIPHER_SUITE_CCMP:
  5372. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5373. -- case WLAN_CIPHER_SUITE_GCMP:
  5374. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5375. - if (!ieee80211_is_data_present(hdr->frame_control) &&
  5376. - !ieee80211_use_mfp(hdr->frame_control, tx->sta,
  5377. - tx->skb))
  5378. -@@ -639,9 +636,6 @@ ieee80211_tx_h_select_key(struct ieee802
  5379. - ieee80211_is_mgmt(hdr->frame_control);
  5380. - break;
  5381. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5382. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5383. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5384. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5385. - if (!ieee80211_is_mgmt(hdr->frame_control))
  5386. - tx->key = NULL;
  5387. - break;
  5388. -@@ -1017,21 +1011,9 @@ ieee80211_tx_h_encrypt(struct ieee80211_
  5389. - case WLAN_CIPHER_SUITE_TKIP:
  5390. - return ieee80211_crypto_tkip_encrypt(tx);
  5391. - case WLAN_CIPHER_SUITE_CCMP:
  5392. -- return ieee80211_crypto_ccmp_encrypt(
  5393. -- tx, IEEE80211_CCMP_MIC_LEN);
  5394. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5395. -- return ieee80211_crypto_ccmp_encrypt(
  5396. -- tx, IEEE80211_CCMP_256_MIC_LEN);
  5397. -+ return ieee80211_crypto_ccmp_encrypt(tx);
  5398. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5399. - return ieee80211_crypto_aes_cmac_encrypt(tx);
  5400. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5401. -- return ieee80211_crypto_aes_cmac_256_encrypt(tx);
  5402. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5403. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5404. -- return ieee80211_crypto_aes_gmac_encrypt(tx);
  5405. -- case WLAN_CIPHER_SUITE_GCMP:
  5406. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5407. -- return ieee80211_crypto_gcmp_encrypt(tx);
  5408. - default:
  5409. - return ieee80211_crypto_hw_encrypt(tx);
  5410. - }
  5411. ---- a/net/mac80211/wpa.c
  5412. -+++ b/net/mac80211/wpa.c
  5413. -@@ -22,8 +22,6 @@
  5414. - #include "tkip.h"
  5415. - #include "aes_ccm.h"
  5416. - #include "aes_cmac.h"
  5417. --#include "aes_gmac.h"
  5418. --#include "aes_gcm.h"
  5419. - #include "wpa.h"
  5420. -
  5421. - ieee80211_tx_result
  5422. -@@ -304,15 +302,22 @@ ieee80211_crypto_tkip_decrypt(struct iee
  5423. - }
  5424. -
  5425. -
  5426. --static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  5427. -+static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
  5428. -+ int encrypted)
  5429. - {
  5430. - __le16 mask_fc;
  5431. - int a4_included, mgmt;
  5432. - u8 qos_tid;
  5433. -- u16 len_a;
  5434. -+ u8 *b_0, *aad;
  5435. -+ u16 data_len, len_a;
  5436. - unsigned int hdrlen;
  5437. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5438. -
  5439. -+ memset(scratch, 0, 6 * AES_BLOCK_SIZE);
  5440. -+
  5441. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  5442. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  5443. -+
  5444. - /*
  5445. - * Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  5446. - * Retry, PwrMgt, MoreData; set Protected
  5447. -@@ -334,21 +339,20 @@ static void ccmp_special_blocks(struct s
  5448. - else
  5449. - qos_tid = 0;
  5450. -
  5451. -- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  5452. -- * mode authentication are not allowed to collide, yet both are derived
  5453. -- * from this vector b_0. We only set L := 1 here to indicate that the
  5454. -- * data size can be represented in (L+1) bytes. The CCM layer will take
  5455. -- * care of storing the data length in the top (L+1) bytes and setting
  5456. -- * and clearing the other bits as is required to derive the two IVs.
  5457. -- */
  5458. -- b_0[0] = 0x1;
  5459. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN;
  5460. -+ if (encrypted)
  5461. -+ data_len -= IEEE80211_CCMP_MIC_LEN;
  5462. -
  5463. -+ /* First block, b_0 */
  5464. -+ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  5465. - /* Nonce: Nonce Flags | A2 | PN
  5466. - * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  5467. - */
  5468. - b_0[1] = qos_tid | (mgmt << 4);
  5469. - memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  5470. - memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  5471. -+ /* l(m) */
  5472. -+ put_unaligned_be16(data_len, &b_0[14]);
  5473. -
  5474. - /* AAD (extra authenticate-only data) / masked 802.11 header
  5475. - * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  5476. -@@ -395,8 +399,7 @@ static inline void ccmp_hdr2pn(u8 *pn, u
  5477. - }
  5478. -
  5479. -
  5480. --static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb,
  5481. -- unsigned int mic_len)
  5482. -+static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  5483. - {
  5484. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  5485. - struct ieee80211_key *key = tx->key;
  5486. -@@ -405,8 +408,7 @@ static int ccmp_encrypt_skb(struct ieee8
  5487. - u8 *pos;
  5488. - u8 pn[6];
  5489. - u64 pn64;
  5490. -- u8 aad[2 * AES_BLOCK_SIZE];
  5491. -- u8 b_0[AES_BLOCK_SIZE];
  5492. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  5493. -
  5494. - if (info->control.hw_key &&
  5495. - !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  5496. -@@ -427,7 +429,7 @@ static int ccmp_encrypt_skb(struct ieee8
  5497. - if (info->control.hw_key)
  5498. - tail = 0;
  5499. - else
  5500. -- tail = mic_len;
  5501. -+ tail = IEEE80211_CCMP_MIC_LEN;
  5502. -
  5503. - if (WARN_ON(skb_tailroom(skb) < tail ||
  5504. - skb_headroom(skb) < IEEE80211_CCMP_HDR_LEN))
  5505. -@@ -460,24 +462,23 @@ static int ccmp_encrypt_skb(struct ieee8
  5506. - return 0;
  5507. -
  5508. - pos += IEEE80211_CCMP_HDR_LEN;
  5509. -- ccmp_special_blocks(skb, pn, b_0, aad);
  5510. -- ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  5511. -- skb_put(skb, mic_len), mic_len);
  5512. -+ ccmp_special_blocks(skb, pn, scratch, 0);
  5513. -+ ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len,
  5514. -+ pos, skb_put(skb, IEEE80211_CCMP_MIC_LEN));
  5515. -
  5516. - return 0;
  5517. - }
  5518. -
  5519. -
  5520. - ieee80211_tx_result
  5521. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  5522. -- unsigned int mic_len)
  5523. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
  5524. - {
  5525. - struct sk_buff *skb;
  5526. -
  5527. - ieee80211_tx_set_protected(tx);
  5528. -
  5529. - skb_queue_walk(&tx->skbs, skb) {
  5530. -- if (ccmp_encrypt_skb(tx, skb, mic_len) < 0)
  5531. -+ if (ccmp_encrypt_skb(tx, skb) < 0)
  5532. - return TX_DROP;
  5533. - }
  5534. -
  5535. -@@ -486,8 +487,7 @@ ieee80211_crypto_ccmp_encrypt(struct iee
  5536. -
  5537. -
  5538. - ieee80211_rx_result
  5539. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  5540. -- unsigned int mic_len)
  5541. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
  5542. - {
  5543. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  5544. - int hdrlen;
  5545. -@@ -504,7 +504,8 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  5546. - !ieee80211_is_robust_mgmt_frame(skb))
  5547. - return RX_CONTINUE;
  5548. -
  5549. -- data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len;
  5550. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN -
  5551. -+ IEEE80211_CCMP_MIC_LEN;
  5552. - if (!rx->sta || data_len < 0)
  5553. - return RX_DROP_UNUSABLE;
  5554. -
  5555. -@@ -526,23 +527,23 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  5556. - }
  5557. -
  5558. - if (!(status->flag & RX_FLAG_DECRYPTED)) {
  5559. -- u8 aad[2 * AES_BLOCK_SIZE];
  5560. -- u8 b_0[AES_BLOCK_SIZE];
  5561. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  5562. - /* hardware didn't decrypt/verify MIC */
  5563. -- ccmp_special_blocks(skb, pn, b_0, aad);
  5564. -+ ccmp_special_blocks(skb, pn, scratch, 1);
  5565. -
  5566. - if (ieee80211_aes_ccm_decrypt(
  5567. -- key->u.ccmp.tfm, b_0, aad,
  5568. -+ key->u.ccmp.tfm, scratch,
  5569. - skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
  5570. - data_len,
  5571. -- skb->data + skb->len - mic_len, mic_len))
  5572. -+ skb->data + skb->len - IEEE80211_CCMP_MIC_LEN,
  5573. -+ skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
  5574. - return RX_DROP_UNUSABLE;
  5575. - }
  5576. -
  5577. - memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
  5578. -
  5579. - /* Remove CCMP header and MIC */
  5580. -- if (pskb_trim(skb, skb->len - mic_len))
  5581. -+ if (pskb_trim(skb, skb->len - IEEE80211_CCMP_MIC_LEN))
  5582. - return RX_DROP_UNUSABLE;
  5583. - memmove(skb->data + IEEE80211_CCMP_HDR_LEN, skb->data, hdrlen);
  5584. - skb_pull(skb, IEEE80211_CCMP_HDR_LEN);
  5585. -@@ -550,229 +551,6 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  5586. - return RX_CONTINUE;
  5587. - }
  5588. -
  5589. --static void gcmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *j_0, u8 *aad)
  5590. --{
  5591. -- __le16 mask_fc;
  5592. -- u8 qos_tid;
  5593. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5594. --
  5595. -- memcpy(j_0, hdr->addr2, ETH_ALEN);
  5596. -- memcpy(&j_0[ETH_ALEN], pn, IEEE80211_GCMP_PN_LEN);
  5597. -- j_0[13] = 0;
  5598. -- j_0[14] = 0;
  5599. -- j_0[AES_BLOCK_SIZE - 1] = 0x01;
  5600. --
  5601. -- /* AAD (extra authenticate-only data) / masked 802.11 header
  5602. -- * FC | A1 | A2 | A3 | SC | [A4] | [QC]
  5603. -- */
  5604. -- put_unaligned_be16(ieee80211_hdrlen(hdr->frame_control) - 2, &aad[0]);
  5605. -- /* Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  5606. -- * Retry, PwrMgt, MoreData; set Protected
  5607. -- */
  5608. -- mask_fc = hdr->frame_control;
  5609. -- mask_fc &= ~cpu_to_le16(IEEE80211_FCTL_RETRY |
  5610. -- IEEE80211_FCTL_PM | IEEE80211_FCTL_MOREDATA);
  5611. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  5612. -- mask_fc &= ~cpu_to_le16(0x0070);
  5613. -- mask_fc |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  5614. --
  5615. -- put_unaligned(mask_fc, (__le16 *)&aad[2]);
  5616. -- memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN);
  5617. --
  5618. -- /* Mask Seq#, leave Frag# */
  5619. -- aad[22] = *((u8 *)&hdr->seq_ctrl) & 0x0f;
  5620. -- aad[23] = 0;
  5621. --
  5622. -- if (ieee80211_is_data_qos(hdr->frame_control))
  5623. -- qos_tid = *ieee80211_get_qos_ctl(hdr) &
  5624. -- IEEE80211_QOS_CTL_TID_MASK;
  5625. -- else
  5626. -- qos_tid = 0;
  5627. --
  5628. -- if (ieee80211_has_a4(hdr->frame_control)) {
  5629. -- memcpy(&aad[24], hdr->addr4, ETH_ALEN);
  5630. -- aad[30] = qos_tid;
  5631. -- aad[31] = 0;
  5632. -- } else {
  5633. -- memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN);
  5634. -- aad[24] = qos_tid;
  5635. -- }
  5636. --}
  5637. --
  5638. --static inline void gcmp_pn2hdr(u8 *hdr, const u8 *pn, int key_id)
  5639. --{
  5640. -- hdr[0] = pn[5];
  5641. -- hdr[1] = pn[4];
  5642. -- hdr[2] = 0;
  5643. -- hdr[3] = 0x20 | (key_id << 6);
  5644. -- hdr[4] = pn[3];
  5645. -- hdr[5] = pn[2];
  5646. -- hdr[6] = pn[1];
  5647. -- hdr[7] = pn[0];
  5648. --}
  5649. --
  5650. --static inline void gcmp_hdr2pn(u8 *pn, const u8 *hdr)
  5651. --{
  5652. -- pn[0] = hdr[7];
  5653. -- pn[1] = hdr[6];
  5654. -- pn[2] = hdr[5];
  5655. -- pn[3] = hdr[4];
  5656. -- pn[4] = hdr[1];
  5657. -- pn[5] = hdr[0];
  5658. --}
  5659. --
  5660. --static int gcmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  5661. --{
  5662. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5663. -- struct ieee80211_key *key = tx->key;
  5664. -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5665. -- int hdrlen, len, tail;
  5666. -- u8 *pos;
  5667. -- u8 pn[6];
  5668. -- u64 pn64;
  5669. -- u8 aad[2 * AES_BLOCK_SIZE];
  5670. -- u8 j_0[AES_BLOCK_SIZE];
  5671. --
  5672. -- if (info->control.hw_key &&
  5673. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  5674. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) &&
  5675. -- !((info->control.hw_key->flags &
  5676. -- IEEE80211_KEY_FLAG_GENERATE_IV_MGMT) &&
  5677. -- ieee80211_is_mgmt(hdr->frame_control))) {
  5678. -- /* hwaccel has no need for preallocated room for GCMP
  5679. -- * header or MIC fields
  5680. -- */
  5681. -- return 0;
  5682. -- }
  5683. --
  5684. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5685. -- len = skb->len - hdrlen;
  5686. --
  5687. -- if (info->control.hw_key)
  5688. -- tail = 0;
  5689. -- else
  5690. -- tail = IEEE80211_GCMP_MIC_LEN;
  5691. --
  5692. -- if (WARN_ON(skb_tailroom(skb) < tail ||
  5693. -- skb_headroom(skb) < IEEE80211_GCMP_HDR_LEN))
  5694. -- return -1;
  5695. --
  5696. -- pos = skb_push(skb, IEEE80211_GCMP_HDR_LEN);
  5697. -- memmove(pos, pos + IEEE80211_GCMP_HDR_LEN, hdrlen);
  5698. -- skb_set_network_header(skb, skb_network_offset(skb) +
  5699. -- IEEE80211_GCMP_HDR_LEN);
  5700. --
  5701. -- /* the HW only needs room for the IV, but not the actual IV */
  5702. -- if (info->control.hw_key &&
  5703. -- (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))
  5704. -- return 0;
  5705. --
  5706. -- hdr = (struct ieee80211_hdr *)pos;
  5707. -- pos += hdrlen;
  5708. --
  5709. -- pn64 = atomic64_inc_return(&key->u.gcmp.tx_pn);
  5710. --
  5711. -- pn[5] = pn64;
  5712. -- pn[4] = pn64 >> 8;
  5713. -- pn[3] = pn64 >> 16;
  5714. -- pn[2] = pn64 >> 24;
  5715. -- pn[1] = pn64 >> 32;
  5716. -- pn[0] = pn64 >> 40;
  5717. --
  5718. -- gcmp_pn2hdr(pos, pn, key->conf.keyidx);
  5719. --
  5720. -- /* hwaccel - with software GCMP header */
  5721. -- if (info->control.hw_key)
  5722. -- return 0;
  5723. --
  5724. -- pos += IEEE80211_GCMP_HDR_LEN;
  5725. -- gcmp_special_blocks(skb, pn, j_0, aad);
  5726. -- ieee80211_aes_gcm_encrypt(key->u.gcmp.tfm, j_0, aad, pos, len,
  5727. -- skb_put(skb, IEEE80211_GCMP_MIC_LEN));
  5728. --
  5729. -- return 0;
  5730. --}
  5731. --
  5732. --ieee80211_tx_result
  5733. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx)
  5734. --{
  5735. -- struct sk_buff *skb;
  5736. --
  5737. -- ieee80211_tx_set_protected(tx);
  5738. --
  5739. -- skb_queue_walk(&tx->skbs, skb) {
  5740. -- if (gcmp_encrypt_skb(tx, skb) < 0)
  5741. -- return TX_DROP;
  5742. -- }
  5743. --
  5744. -- return TX_CONTINUE;
  5745. --}
  5746. --
  5747. --ieee80211_rx_result
  5748. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx)
  5749. --{
  5750. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  5751. -- int hdrlen;
  5752. -- struct ieee80211_key *key = rx->key;
  5753. -- struct sk_buff *skb = rx->skb;
  5754. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  5755. -- u8 pn[IEEE80211_GCMP_PN_LEN];
  5756. -- int data_len;
  5757. -- int queue;
  5758. --
  5759. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5760. --
  5761. -- if (!ieee80211_is_data(hdr->frame_control) &&
  5762. -- !ieee80211_is_robust_mgmt_frame(skb))
  5763. -- return RX_CONTINUE;
  5764. --
  5765. -- data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN -
  5766. -- IEEE80211_GCMP_MIC_LEN;
  5767. -- if (!rx->sta || data_len < 0)
  5768. -- return RX_DROP_UNUSABLE;
  5769. --
  5770. -- if (status->flag & RX_FLAG_DECRYPTED) {
  5771. -- if (!pskb_may_pull(rx->skb, hdrlen + IEEE80211_GCMP_HDR_LEN))
  5772. -- return RX_DROP_UNUSABLE;
  5773. -- } else {
  5774. -- if (skb_linearize(rx->skb))
  5775. -- return RX_DROP_UNUSABLE;
  5776. -- }
  5777. --
  5778. -- gcmp_hdr2pn(pn, skb->data + hdrlen);
  5779. --
  5780. -- queue = rx->security_idx;
  5781. --
  5782. -- if (memcmp(pn, key->u.gcmp.rx_pn[queue], IEEE80211_GCMP_PN_LEN) <= 0) {
  5783. -- key->u.gcmp.replays++;
  5784. -- return RX_DROP_UNUSABLE;
  5785. -- }
  5786. --
  5787. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  5788. -- u8 aad[2 * AES_BLOCK_SIZE];
  5789. -- u8 j_0[AES_BLOCK_SIZE];
  5790. -- /* hardware didn't decrypt/verify MIC */
  5791. -- gcmp_special_blocks(skb, pn, j_0, aad);
  5792. --
  5793. -- if (ieee80211_aes_gcm_decrypt(
  5794. -- key->u.gcmp.tfm, j_0, aad,
  5795. -- skb->data + hdrlen + IEEE80211_GCMP_HDR_LEN,
  5796. -- data_len,
  5797. -- skb->data + skb->len - IEEE80211_GCMP_MIC_LEN))
  5798. -- return RX_DROP_UNUSABLE;
  5799. -- }
  5800. --
  5801. -- memcpy(key->u.gcmp.rx_pn[queue], pn, IEEE80211_GCMP_PN_LEN);
  5802. --
  5803. -- /* Remove GCMP header and MIC */
  5804. -- if (pskb_trim(skb, skb->len - IEEE80211_GCMP_MIC_LEN))
  5805. -- return RX_DROP_UNUSABLE;
  5806. -- memmove(skb->data + IEEE80211_GCMP_HDR_LEN, skb->data, hdrlen);
  5807. -- skb_pull(skb, IEEE80211_GCMP_HDR_LEN);
  5808. --
  5809. -- return RX_CONTINUE;
  5810. --}
  5811. --
  5812. - static ieee80211_tx_result
  5813. - ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  5814. - struct sk_buff *skb)
  5815. -@@ -956,48 +734,6 @@ ieee80211_crypto_aes_cmac_encrypt(struct
  5816. - return TX_CONTINUE;
  5817. - }
  5818. -
  5819. --ieee80211_tx_result
  5820. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx)
  5821. --{
  5822. -- struct sk_buff *skb;
  5823. -- struct ieee80211_tx_info *info;
  5824. -- struct ieee80211_key *key = tx->key;
  5825. -- struct ieee80211_mmie_16 *mmie;
  5826. -- u8 aad[20];
  5827. -- u64 pn64;
  5828. --
  5829. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  5830. -- return TX_DROP;
  5831. --
  5832. -- skb = skb_peek(&tx->skbs);
  5833. --
  5834. -- info = IEEE80211_SKB_CB(skb);
  5835. --
  5836. -- if (info->control.hw_key)
  5837. -- return TX_CONTINUE;
  5838. --
  5839. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  5840. -- return TX_DROP;
  5841. --
  5842. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  5843. -- mmie->element_id = WLAN_EID_MMIE;
  5844. -- mmie->length = sizeof(*mmie) - 2;
  5845. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  5846. --
  5847. -- /* PN = PN + 1 */
  5848. -- pn64 = atomic64_inc_return(&key->u.aes_cmac.tx_pn);
  5849. --
  5850. -- bip_ipn_set64(mmie->sequence_number, pn64);
  5851. --
  5852. -- bip_aad(skb, aad);
  5853. --
  5854. -- /* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128)
  5855. -- */
  5856. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  5857. -- skb->data + 24, skb->len - 24, mmie->mic);
  5858. --
  5859. -- return TX_CONTINUE;
  5860. --}
  5861. -
  5862. - ieee80211_rx_result
  5863. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
  5864. -@@ -1045,160 +781,6 @@ ieee80211_crypto_aes_cmac_decrypt(struct
  5865. -
  5866. - /* Remove MMIE */
  5867. - skb_trim(skb, skb->len - sizeof(*mmie));
  5868. --
  5869. -- return RX_CONTINUE;
  5870. --}
  5871. --
  5872. --ieee80211_rx_result
  5873. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx)
  5874. --{
  5875. -- struct sk_buff *skb = rx->skb;
  5876. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  5877. -- struct ieee80211_key *key = rx->key;
  5878. -- struct ieee80211_mmie_16 *mmie;
  5879. -- u8 aad[20], mic[16], ipn[6];
  5880. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5881. --
  5882. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  5883. -- return RX_CONTINUE;
  5884. --
  5885. -- /* management frames are already linear */
  5886. --
  5887. -- if (skb->len < 24 + sizeof(*mmie))
  5888. -- return RX_DROP_UNUSABLE;
  5889. --
  5890. -- mmie = (struct ieee80211_mmie_16 *)
  5891. -- (skb->data + skb->len - sizeof(*mmie));
  5892. -- if (mmie->element_id != WLAN_EID_MMIE ||
  5893. -- mmie->length != sizeof(*mmie) - 2)
  5894. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  5895. --
  5896. -- bip_ipn_swap(ipn, mmie->sequence_number);
  5897. --
  5898. -- if (memcmp(ipn, key->u.aes_cmac.rx_pn, 6) <= 0) {
  5899. -- key->u.aes_cmac.replays++;
  5900. -- return RX_DROP_UNUSABLE;
  5901. -- }
  5902. --
  5903. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  5904. -- /* hardware didn't decrypt/verify MIC */
  5905. -- bip_aad(skb, aad);
  5906. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  5907. -- skb->data + 24, skb->len - 24, mic);
  5908. -- if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  5909. -- key->u.aes_cmac.icverrors++;
  5910. -- return RX_DROP_UNUSABLE;
  5911. -- }
  5912. -- }
  5913. --
  5914. -- memcpy(key->u.aes_cmac.rx_pn, ipn, 6);
  5915. --
  5916. -- /* Remove MMIE */
  5917. -- skb_trim(skb, skb->len - sizeof(*mmie));
  5918. --
  5919. -- return RX_CONTINUE;
  5920. --}
  5921. --
  5922. --ieee80211_tx_result
  5923. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx)
  5924. --{
  5925. -- struct sk_buff *skb;
  5926. -- struct ieee80211_tx_info *info;
  5927. -- struct ieee80211_key *key = tx->key;
  5928. -- struct ieee80211_mmie_16 *mmie;
  5929. -- struct ieee80211_hdr *hdr;
  5930. -- u8 aad[20];
  5931. -- u64 pn64;
  5932. -- u8 nonce[12];
  5933. --
  5934. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  5935. -- return TX_DROP;
  5936. --
  5937. -- skb = skb_peek(&tx->skbs);
  5938. --
  5939. -- info = IEEE80211_SKB_CB(skb);
  5940. --
  5941. -- if (info->control.hw_key)
  5942. -- return TX_CONTINUE;
  5943. --
  5944. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  5945. -- return TX_DROP;
  5946. --
  5947. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  5948. -- mmie->element_id = WLAN_EID_MMIE;
  5949. -- mmie->length = sizeof(*mmie) - 2;
  5950. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  5951. --
  5952. -- /* PN = PN + 1 */
  5953. -- pn64 = atomic64_inc_return(&key->u.aes_gmac.tx_pn);
  5954. --
  5955. -- bip_ipn_set64(mmie->sequence_number, pn64);
  5956. --
  5957. -- bip_aad(skb, aad);
  5958. --
  5959. -- hdr = (struct ieee80211_hdr *)skb->data;
  5960. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  5961. -- bip_ipn_swap(nonce + ETH_ALEN, mmie->sequence_number);
  5962. --
  5963. -- /* MIC = AES-GMAC(IGTK, AAD || Management Frame Body || MMIE, 128) */
  5964. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  5965. -- skb->data + 24, skb->len - 24, mmie->mic) < 0)
  5966. -- return TX_DROP;
  5967. --
  5968. -- return TX_CONTINUE;
  5969. --}
  5970. --
  5971. --ieee80211_rx_result
  5972. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx)
  5973. --{
  5974. -- struct sk_buff *skb = rx->skb;
  5975. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  5976. -- struct ieee80211_key *key = rx->key;
  5977. -- struct ieee80211_mmie_16 *mmie;
  5978. -- u8 aad[20], mic[16], ipn[6], nonce[12];
  5979. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5980. --
  5981. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  5982. -- return RX_CONTINUE;
  5983. --
  5984. -- /* management frames are already linear */
  5985. --
  5986. -- if (skb->len < 24 + sizeof(*mmie))
  5987. -- return RX_DROP_UNUSABLE;
  5988. --
  5989. -- mmie = (struct ieee80211_mmie_16 *)
  5990. -- (skb->data + skb->len - sizeof(*mmie));
  5991. -- if (mmie->element_id != WLAN_EID_MMIE ||
  5992. -- mmie->length != sizeof(*mmie) - 2)
  5993. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  5994. --
  5995. -- bip_ipn_swap(ipn, mmie->sequence_number);
  5996. --
  5997. -- if (memcmp(ipn, key->u.aes_gmac.rx_pn, 6) <= 0) {
  5998. -- key->u.aes_gmac.replays++;
  5999. -- return RX_DROP_UNUSABLE;
  6000. -- }
  6001. --
  6002. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6003. -- /* hardware didn't decrypt/verify MIC */
  6004. -- bip_aad(skb, aad);
  6005. --
  6006. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  6007. -- memcpy(nonce + ETH_ALEN, ipn, 6);
  6008. --
  6009. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  6010. -- skb->data + 24, skb->len - 24,
  6011. -- mic) < 0 ||
  6012. -- memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  6013. -- key->u.aes_gmac.icverrors++;
  6014. -- return RX_DROP_UNUSABLE;
  6015. -- }
  6016. -- }
  6017. --
  6018. -- memcpy(key->u.aes_gmac.rx_pn, ipn, 6);
  6019. --
  6020. -- /* Remove MMIE */
  6021. -- skb_trim(skb, skb->len - sizeof(*mmie));
  6022. -
  6023. - return RX_CONTINUE;
  6024. - }
  6025. ---- a/net/mac80211/wpa.h
  6026. -+++ b/net/mac80211/wpa.h
  6027. -@@ -24,32 +24,17 @@ ieee80211_rx_result
  6028. - ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx);
  6029. -
  6030. - ieee80211_tx_result
  6031. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  6032. -- unsigned int mic_len);
  6033. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx);
  6034. - ieee80211_rx_result
  6035. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  6036. -- unsigned int mic_len);
  6037. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx);
  6038. -
  6039. - ieee80211_tx_result
  6040. - ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx);
  6041. --ieee80211_tx_result
  6042. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx);
  6043. - ieee80211_rx_result
  6044. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx);
  6045. --ieee80211_rx_result
  6046. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx);
  6047. --ieee80211_tx_result
  6048. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx);
  6049. --ieee80211_rx_result
  6050. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx);
  6051. - ieee80211_tx_result
  6052. - ieee80211_crypto_hw_encrypt(struct ieee80211_tx_data *tx);
  6053. - ieee80211_rx_result
  6054. - ieee80211_crypto_hw_decrypt(struct ieee80211_rx_data *rx);
  6055. -
  6056. --ieee80211_tx_result
  6057. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx);
  6058. --ieee80211_rx_result
  6059. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx);
  6060. --
  6061. - #endif /* WPA_H */
  6062. 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
  6063. index 41a3c4f..cff6d89 100644
  6064. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  6065. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  6066. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  6067. --- a/net/mac80211/cfg.c
  6068. +++ b/net/mac80211/cfg.c
  6069. -@@ -856,7 +856,6 @@ static int ieee80211_stop_ap(struct wiph
  6070. +@@ -886,7 +886,6 @@ static int ieee80211_stop_ap(struct wiph
  6071. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  6072. __sta_info_flush(sdata, true);
  6073. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  6074. index de79bd2..5fc9454 100644
  6075. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  6076. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  6077. @@ -18,7 +18,7 @@
  6078. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  6079. unsigned long data, void *arg)
  6080. {
  6081. -@@ -1057,14 +1057,14 @@ int ieee80211_register_hw(struct ieee802
  6082. +@@ -1086,14 +1086,14 @@ int ieee80211_register_hw(struct ieee802
  6083. if (result)
  6084. goto fail_pm_qos;
  6085. @@ -35,7 +35,7 @@
  6086. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  6087. result = register_inet6addr_notifier(&local->ifa6_notifier);
  6088. if (result)
  6089. -@@ -1073,13 +1073,13 @@ int ieee80211_register_hw(struct ieee802
  6090. +@@ -1102,13 +1102,13 @@ int ieee80211_register_hw(struct ieee802
  6091. return 0;
  6092. @@ -52,7 +52,7 @@
  6093. fail_ifa:
  6094. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  6095. &local->network_latency_notifier);
  6096. -@@ -1124,10 +1124,10 @@ void ieee80211_unregister_hw(struct ieee
  6097. +@@ -1141,10 +1141,10 @@ void ieee80211_unregister_hw(struct ieee
  6098. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  6099. &local->network_latency_notifier);
  6100. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  6101. index 47dcec3..29f05c4 100644
  6102. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  6103. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  6104. @@ -1,6 +1,6 @@
  6105. --- a/net/mac80211/cfg.c
  6106. +++ b/net/mac80211/cfg.c
  6107. -@@ -1963,7 +1963,7 @@ static int ieee80211_scan(struct wiphy *
  6108. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  6109. * the frames sent while scanning on other channel will be
  6110. * lost)
  6111. */
  6112. 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
  6113. new file mode 100644
  6114. index 0000000..bddb15a
  6115. --- /dev/null
  6116. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  6117. @@ -0,0 +1,31 @@
  6118. +From: Felix Fietkau <nbd@openwrt.org>
  6119. +Date: Sun, 7 Jun 2015 13:53:35 +0200
  6120. +Subject: [PATCH] ath9k: force rx_clear when disabling rx
  6121. +
  6122. +This makes stopping Rx more reliable and should reduce the frequency of
  6123. +Rx related DMA stop warnings
  6124. +
  6125. +Cc: stable@vger.kernel.org
  6126. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6127. +---
  6128. +
  6129. +--- a/drivers/net/wireless/ath/ath9k/mac.c
  6130. ++++ b/drivers/net/wireless/ath/ath9k/mac.c
  6131. +@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  6132. +
  6133. + ath9k_ani_reset(ah, is_scanning);
  6134. +
  6135. +- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  6136. ++ REG_CLR_BIT(ah, AR_DIAG_SW,
  6137. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  6138. + }
  6139. + EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  6140. +
  6141. + void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  6142. + {
  6143. +- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  6144. ++ REG_SET_BIT(ah, AR_DIAG_SW,
  6145. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  6146. +
  6147. + ath9k_hw_disable_mib_counters(ah);
  6148. + }
  6149. 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
  6150. deleted file mode 100644
  6151. index 237121b..0000000
  6152. --- a/package/kernel/mac80211/patches/300-mac80211-add-an-intermediate-software-queue-implemen.patch
  6153. +++ /dev/null
  6154. @@ -1,882 +0,0 @@
  6155. -From: Felix Fietkau <nbd@openwrt.org>
  6156. -Date: Tue, 18 Nov 2014 23:58:51 +0100
  6157. -Subject: [PATCH] mac80211: add an intermediate software queue implementation
  6158. -
  6159. -This allows drivers to request per-vif and per-sta-tid queues from which
  6160. -they can pull frames. This makes it easier to keep the hardware queues
  6161. -short, and to improve fairness between clients and vifs.
  6162. -
  6163. -The task of scheduling packet transmission is left up to the driver -
  6164. -queueing is controlled by mac80211. Drivers can only dequeue packets by
  6165. -calling ieee80211_tx_dequeue. This makes it possible to add active queue
  6166. -management later without changing drivers using this code.
  6167. -
  6168. -This can also be used as a starting point to implement A-MSDU
  6169. -aggregation in a way that does not add artificially induced latency.
  6170. -
  6171. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6172. ----
  6173. -
  6174. ---- a/include/net/mac80211.h
  6175. -+++ b/include/net/mac80211.h
  6176. -@@ -84,6 +84,39 @@
  6177. - *
  6178. - */
  6179. -
  6180. -+/**
  6181. -+ * DOC: mac80211 software tx queueing
  6182. -+ *
  6183. -+ * mac80211 provides an optional intermediate queueing implementation designed
  6184. -+ * to allow the driver to keep hardware queues short and provide some fairness
  6185. -+ * between different stations/interfaces.
  6186. -+ * In this model, the driver pulls data frames from the mac80211 queue instead
  6187. -+ * of letting mac80211 push them via drv_tx().
  6188. -+ * Other frames (e.g. control or management) are still pushed using drv_tx().
  6189. -+ *
  6190. -+ * Drivers indicate that they use this model by implementing the .wake_tx_queue
  6191. -+ * driver operation.
  6192. -+ *
  6193. -+ * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with a
  6194. -+ * single per-vif queue for multicast data frames.
  6195. -+ *
  6196. -+ * The driver is expected to initialize its private per-queue data for stations
  6197. -+ * and interfaces in the .add_interface and .sta_add ops.
  6198. -+ *
  6199. -+ * The driver can't access the queue directly. To dequeue a frame, it calls
  6200. -+ * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
  6201. -+ * calls the .wake_tx_queue driver op.
  6202. -+ *
  6203. -+ * For AP powersave TIM handling, the driver only needs to indicate if it has
  6204. -+ * buffered packets in the driver specific data structures by calling
  6205. -+ * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
  6206. -+ * struct, mac80211 sets the appropriate TIM PVB bits and calls
  6207. -+ * .release_buffered_frames().
  6208. -+ * In that callback the driver is therefore expected to release its own
  6209. -+ * buffered frames and afterwards also frames from the ieee80211_txq (obtained
  6210. -+ * via the usual ieee80211_tx_dequeue).
  6211. -+ */
  6212. -+
  6213. - struct device;
  6214. -
  6215. - /**
  6216. -@@ -1246,6 +1279,7 @@ enum ieee80211_vif_flags {
  6217. - * monitor interface (if that is requested.)
  6218. - * @drv_priv: data area for driver use, will always be aligned to
  6219. - * sizeof(void *).
  6220. -+ * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
  6221. - */
  6222. - struct ieee80211_vif {
  6223. - enum nl80211_iftype type;
  6224. -@@ -1257,6 +1291,8 @@ struct ieee80211_vif {
  6225. - u8 cab_queue;
  6226. - u8 hw_queue[IEEE80211_NUM_ACS];
  6227. -
  6228. -+ struct ieee80211_txq *txq;
  6229. -+
  6230. - struct ieee80211_chanctx_conf __rcu *chanctx_conf;
  6231. -
  6232. - u32 driver_flags;
  6233. -@@ -1501,6 +1537,7 @@ struct ieee80211_sta_rates {
  6234. - * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
  6235. - * valid if the STA is a TDLS peer in the first place.
  6236. - * @mfp: indicates whether the STA uses management frame protection or not.
  6237. -+ * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  6238. - */
  6239. - struct ieee80211_sta {
  6240. - u32 supp_rates[IEEE80211_NUM_BANDS];
  6241. -@@ -1519,6 +1556,8 @@ struct ieee80211_sta {
  6242. - bool tdls_initiator;
  6243. - bool mfp;
  6244. -
  6245. -+ struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  6246. -+
  6247. - /* must be last */
  6248. - u8 drv_priv[0] __aligned(sizeof(void *));
  6249. - };
  6250. -@@ -1547,6 +1586,27 @@ struct ieee80211_tx_control {
  6251. - };
  6252. -
  6253. - /**
  6254. -+ * struct ieee80211_txq - Software intermediate tx queue
  6255. -+ *
  6256. -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6257. -+ * @sta: station table entry, %NULL for per-vif queue
  6258. -+ * @tid: the TID for this queue (unused for per-vif queue)
  6259. -+ * @ac: the AC for this queue
  6260. -+ *
  6261. -+ * The driver can obtain packets from this queue by calling
  6262. -+ * ieee80211_tx_dequeue().
  6263. -+ */
  6264. -+struct ieee80211_txq {
  6265. -+ struct ieee80211_vif *vif;
  6266. -+ struct ieee80211_sta *sta;
  6267. -+ u8 tid;
  6268. -+ u8 ac;
  6269. -+
  6270. -+ /* must be last */
  6271. -+ u8 drv_priv[0] __aligned(sizeof(void *));
  6272. -+};
  6273. -+
  6274. -+/**
  6275. - * enum ieee80211_hw_flags - hardware flags
  6276. - *
  6277. - * These flags are used to indicate hardware capabilities to
  6278. -@@ -1770,6 +1830,8 @@ enum ieee80211_hw_flags {
  6279. - * within &struct ieee80211_sta.
  6280. - * @chanctx_data_size: size (in bytes) of the drv_priv data area
  6281. - * within &struct ieee80211_chanctx_conf.
  6282. -+ * @txq_data_size: size (in bytes) of the drv_priv data area
  6283. -+ * within @struct ieee80211_txq.
  6284. - *
  6285. - * @max_rates: maximum number of alternate rate retry stages the hw
  6286. - * can handle.
  6287. -@@ -1818,6 +1880,9 @@ enum ieee80211_hw_flags {
  6288. - * @n_cipher_schemes: a size of an array of cipher schemes definitions.
  6289. - * @cipher_schemes: a pointer to an array of cipher scheme definitions
  6290. - * supported by HW.
  6291. -+ *
  6292. -+ * @txq_ac_max_pending: maximum number of frames per AC pending in all txq
  6293. -+ * entries for a vif.
  6294. - */
  6295. - struct ieee80211_hw {
  6296. - struct ieee80211_conf conf;
  6297. -@@ -1830,6 +1895,7 @@ struct ieee80211_hw {
  6298. - int vif_data_size;
  6299. - int sta_data_size;
  6300. - int chanctx_data_size;
  6301. -+ int txq_data_size;
  6302. - u16 queues;
  6303. - u16 max_listen_interval;
  6304. - s8 max_signal;
  6305. -@@ -1846,6 +1912,7 @@ struct ieee80211_hw {
  6306. - u8 uapsd_max_sp_len;
  6307. - u8 n_cipher_schemes;
  6308. - const struct ieee80211_cipher_scheme *cipher_schemes;
  6309. -+ int txq_ac_max_pending;
  6310. - };
  6311. -
  6312. - /**
  6313. -@@ -3007,6 +3074,8 @@ enum ieee80211_reconfig_type {
  6314. - * response template is provided, together with the location of the
  6315. - * switch-timing IE within the template. The skb can only be used within
  6316. - * the function call.
  6317. -+ *
  6318. -+ * @wake_tx_queue: Called when new packets have been added to the queue.
  6319. - */
  6320. - struct ieee80211_ops {
  6321. - void (*tx)(struct ieee80211_hw *hw,
  6322. -@@ -3238,6 +3307,9 @@ struct ieee80211_ops {
  6323. - void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
  6324. - struct ieee80211_vif *vif,
  6325. - struct ieee80211_tdls_ch_sw_params *params);
  6326. -+
  6327. -+ void (*wake_tx_queue)(struct ieee80211_hw *hw,
  6328. -+ struct ieee80211_txq *txq);
  6329. - };
  6330. -
  6331. - /**
  6332. -@@ -5249,4 +5321,15 @@ void ieee80211_unreserve_tid(struct ieee
  6333. - */
  6334. - size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
  6335. - const u8 *ids, int n_ids, size_t offset);
  6336. -+
  6337. -+/**
  6338. -+ * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
  6339. -+ *
  6340. -+ * @hw: pointer as obtained from ieee80211_alloc_hw()
  6341. -+ * @txq: pointer obtained from station or virtual interface
  6342. -+ *
  6343. -+ * Returns the skb if successful, %NULL if no frame was available.
  6344. -+ */
  6345. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  6346. -+ struct ieee80211_txq *txq);
  6347. - #endif /* MAC80211_H */
  6348. ---- a/net/mac80211/driver-ops.h
  6349. -+++ b/net/mac80211/driver-ops.h
  6350. -@@ -1367,4 +1367,16 @@ drv_tdls_recv_channel_switch(struct ieee
  6351. - trace_drv_return_void(local);
  6352. - }
  6353. -
  6354. -+static inline void drv_wake_tx_queue(struct ieee80211_local *local,
  6355. -+ struct txq_info *txq)
  6356. -+{
  6357. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
  6358. -+
  6359. -+ if (!check_sdata_in_driver(sdata))
  6360. -+ return;
  6361. -+
  6362. -+ trace_drv_wake_tx_queue(local, sdata, txq);
  6363. -+ local->ops->wake_tx_queue(&local->hw, &txq->txq);
  6364. -+}
  6365. -+
  6366. - #endif /* __MAC80211_DRIVER_OPS */
  6367. ---- a/net/mac80211/ieee80211_i.h
  6368. -+++ b/net/mac80211/ieee80211_i.h
  6369. -@@ -809,6 +809,19 @@ struct mac80211_qos_map {
  6370. - struct rcu_head rcu_head;
  6371. - };
  6372. -
  6373. -+enum txq_info_flags {
  6374. -+ IEEE80211_TXQ_STOP,
  6375. -+ IEEE80211_TXQ_AMPDU,
  6376. -+};
  6377. -+
  6378. -+struct txq_info {
  6379. -+ struct sk_buff_head queue;
  6380. -+ unsigned long flags;
  6381. -+
  6382. -+ /* keep last! */
  6383. -+ struct ieee80211_txq txq;
  6384. -+};
  6385. -+
  6386. - struct ieee80211_sub_if_data {
  6387. - struct list_head list;
  6388. -
  6389. -@@ -853,6 +866,7 @@ struct ieee80211_sub_if_data {
  6390. - bool control_port_no_encrypt;
  6391. - int encrypt_headroom;
  6392. -
  6393. -+ atomic_t txqs_len[IEEE80211_NUM_ACS];
  6394. - struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
  6395. - struct mac80211_qos_map __rcu *qos_map;
  6396. -
  6397. -@@ -1453,6 +1467,10 @@ static inline struct ieee80211_local *hw
  6398. - return container_of(hw, struct ieee80211_local, hw);
  6399. - }
  6400. -
  6401. -+static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
  6402. -+{
  6403. -+ return container_of(txq, struct txq_info, txq);
  6404. -+}
  6405. -
  6406. - static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
  6407. - {
  6408. -@@ -1905,6 +1923,9 @@ static inline bool ieee80211_can_run_wor
  6409. - return true;
  6410. - }
  6411. -
  6412. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  6413. -+ struct sta_info *sta,
  6414. -+ struct txq_info *txq, int tid);
  6415. - void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
  6416. - u16 transaction, u16 auth_alg, u16 status,
  6417. - const u8 *extra, size_t extra_len, const u8 *bssid,
  6418. ---- a/net/mac80211/iface.c
  6419. -+++ b/net/mac80211/iface.c
  6420. -@@ -969,6 +969,13 @@ static void ieee80211_do_stop(struct iee
  6421. - }
  6422. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  6423. -
  6424. -+ if (sdata->vif.txq) {
  6425. -+ struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  6426. -+
  6427. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  6428. -+ atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  6429. -+ }
  6430. -+
  6431. - if (local->open_count == 0)
  6432. - ieee80211_clear_tx_pending(local);
  6433. -
  6434. -@@ -1674,6 +1681,7 @@ int ieee80211_if_add(struct ieee80211_lo
  6435. - {
  6436. - struct net_device *ndev = NULL;
  6437. - struct ieee80211_sub_if_data *sdata = NULL;
  6438. -+ struct txq_info *txqi;
  6439. - int ret, i;
  6440. - int txqs = 1;
  6441. -
  6442. -@@ -1693,10 +1701,18 @@ int ieee80211_if_add(struct ieee80211_lo
  6443. - ieee80211_assign_perm_addr(local, wdev->address, type);
  6444. - memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
  6445. - } else {
  6446. -+ int size = ALIGN(sizeof(*sdata) + local->hw.vif_data_size,
  6447. -+ sizeof(void *));
  6448. -+ int txq_size = 0;
  6449. -+
  6450. -+ if (local->ops->wake_tx_queue)
  6451. -+ txq_size += sizeof(struct txq_info) +
  6452. -+ local->hw.txq_data_size;
  6453. -+
  6454. - if (local->hw.queues >= IEEE80211_NUM_ACS)
  6455. - txqs = IEEE80211_NUM_ACS;
  6456. -
  6457. -- ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size,
  6458. -+ ndev = alloc_netdev_mqs(size + txq_size,
  6459. - name, NET_NAME_UNKNOWN,
  6460. - ieee80211_if_setup, txqs, 1);
  6461. - if (!ndev)
  6462. -@@ -1731,6 +1747,11 @@ int ieee80211_if_add(struct ieee80211_lo
  6463. - memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN);
  6464. - memcpy(sdata->name, ndev->name, IFNAMSIZ);
  6465. -
  6466. -+ if (txq_size) {
  6467. -+ txqi = netdev_priv(ndev) + size;
  6468. -+ ieee80211_init_tx_queue(sdata, NULL, txqi, 0);
  6469. -+ }
  6470. -+
  6471. - sdata->dev = ndev;
  6472. - }
  6473. -
  6474. ---- a/net/mac80211/main.c
  6475. -+++ b/net/mac80211/main.c
  6476. -@@ -1019,6 +1019,9 @@ int ieee80211_register_hw(struct ieee802
  6477. -
  6478. - local->dynamic_ps_forced_timeout = -1;
  6479. -
  6480. -+ if (!local->hw.txq_ac_max_pending)
  6481. -+ local->hw.txq_ac_max_pending = 64;
  6482. -+
  6483. - result = ieee80211_wep_init(local);
  6484. - if (result < 0)
  6485. - wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
  6486. ---- a/net/mac80211/sta_info.c
  6487. -+++ b/net/mac80211/sta_info.c
  6488. -@@ -118,6 +118,16 @@ static void __cleanup_single_sta(struct
  6489. - atomic_dec(&ps->num_sta_ps);
  6490. - }
  6491. -
  6492. -+ if (sta->sta.txq[0]) {
  6493. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  6494. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  6495. -+ int n = skb_queue_len(&txqi->queue);
  6496. -+
  6497. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  6498. -+ atomic_sub(n, &sdata->txqs_len[txqi->txq.ac]);
  6499. -+ }
  6500. -+ }
  6501. -+
  6502. - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
  6503. - local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]);
  6504. - ieee80211_purge_tx_queue(&local->hw, &sta->ps_tx_buf[ac]);
  6505. -@@ -234,6 +244,8 @@ void sta_info_free(struct ieee80211_loca
  6506. -
  6507. - sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
  6508. -
  6509. -+ if (sta->sta.txq[0])
  6510. -+ kfree(to_txq_info(sta->sta.txq[0]));
  6511. - kfree(rcu_dereference_raw(sta->sta.rates));
  6512. - kfree(sta);
  6513. - }
  6514. -@@ -285,11 +297,12 @@ struct sta_info *sta_info_alloc(struct i
  6515. - const u8 *addr, gfp_t gfp)
  6516. - {
  6517. - struct ieee80211_local *local = sdata->local;
  6518. -+ struct ieee80211_hw *hw = &local->hw;
  6519. - struct sta_info *sta;
  6520. - struct timespec uptime;
  6521. - int i;
  6522. -
  6523. -- sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp);
  6524. -+ sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp);
  6525. - if (!sta)
  6526. - return NULL;
  6527. -
  6528. -@@ -321,11 +334,25 @@ struct sta_info *sta_info_alloc(struct i
  6529. - for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++)
  6530. - ewma_init(&sta->chain_signal_avg[i], 1024, 8);
  6531. -
  6532. -- if (sta_prepare_rate_control(local, sta, gfp)) {
  6533. -- kfree(sta);
  6534. -- return NULL;
  6535. -+ if (local->ops->wake_tx_queue) {
  6536. -+ void *txq_data;
  6537. -+ int size = sizeof(struct txq_info) +
  6538. -+ ALIGN(hw->txq_data_size, sizeof(void *));
  6539. -+
  6540. -+ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp);
  6541. -+ if (!txq_data)
  6542. -+ goto free;
  6543. -+
  6544. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  6545. -+ struct txq_info *txq = txq_data + i * size;
  6546. -+
  6547. -+ ieee80211_init_tx_queue(sdata, sta, txq, i);
  6548. -+ }
  6549. - }
  6550. -
  6551. -+ if (sta_prepare_rate_control(local, sta, gfp))
  6552. -+ goto free_txq;
  6553. -+
  6554. - for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
  6555. - /*
  6556. - * timer_to_tid must be initialized with identity mapping
  6557. -@@ -346,7 +373,7 @@ struct sta_info *sta_info_alloc(struct i
  6558. - if (sdata->vif.type == NL80211_IFTYPE_AP ||
  6559. - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  6560. - struct ieee80211_supported_band *sband =
  6561. -- local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)];
  6562. -+ hw->wiphy->bands[ieee80211_get_sdata_band(sdata)];
  6563. - u8 smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >>
  6564. - IEEE80211_HT_CAP_SM_PS_SHIFT;
  6565. - /*
  6566. -@@ -371,6 +398,13 @@ struct sta_info *sta_info_alloc(struct i
  6567. - sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
  6568. -
  6569. - return sta;
  6570. -+
  6571. -+free_txq:
  6572. -+ if (sta->sta.txq[0])
  6573. -+ kfree(to_txq_info(sta->sta.txq[0]));
  6574. -+free:
  6575. -+ kfree(sta);
  6576. -+ return NULL;
  6577. - }
  6578. -
  6579. - static int sta_info_insert_check(struct sta_info *sta)
  6580. -@@ -640,6 +674,8 @@ static void __sta_info_recalc_tim(struct
  6581. -
  6582. - indicate_tim |=
  6583. - sta->driver_buffered_tids & tids;
  6584. -+ indicate_tim |=
  6585. -+ sta->txq_buffered_tids & tids;
  6586. - }
  6587. -
  6588. - done:
  6589. -@@ -1071,7 +1107,7 @@ void ieee80211_sta_ps_deliver_wakeup(str
  6590. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  6591. - struct ieee80211_local *local = sdata->local;
  6592. - struct sk_buff_head pending;
  6593. -- int filtered = 0, buffered = 0, ac;
  6594. -+ int filtered = 0, buffered = 0, ac, i;
  6595. - unsigned long flags;
  6596. - struct ps_data *ps;
  6597. -
  6598. -@@ -1090,10 +1126,22 @@ void ieee80211_sta_ps_deliver_wakeup(str
  6599. -
  6600. - BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1);
  6601. - sta->driver_buffered_tids = 0;
  6602. -+ sta->txq_buffered_tids = 0;
  6603. -
  6604. - if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
  6605. - drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
  6606. -
  6607. -+ if (sta->sta.txq[0]) {
  6608. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  6609. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  6610. -+
  6611. -+ if (!skb_queue_len(&txqi->queue))
  6612. -+ continue;
  6613. -+
  6614. -+ drv_wake_tx_queue(local, txqi);
  6615. -+ }
  6616. -+ }
  6617. -+
  6618. - skb_queue_head_init(&pending);
  6619. -
  6620. - /* sync with ieee80211_tx_h_unicast_ps_buf */
  6621. -@@ -1275,8 +1323,10 @@ ieee80211_sta_ps_deliver_response(struct
  6622. - /* if we already have frames from software, then we can't also
  6623. - * release from hardware queues
  6624. - */
  6625. -- if (skb_queue_empty(&frames))
  6626. -+ if (skb_queue_empty(&frames)) {
  6627. - driver_release_tids |= sta->driver_buffered_tids & tids;
  6628. -+ driver_release_tids |= sta->txq_buffered_tids & tids;
  6629. -+ }
  6630. -
  6631. - if (driver_release_tids) {
  6632. - /* If the driver has data on more than one TID then
  6633. -@@ -1447,6 +1497,9 @@ ieee80211_sta_ps_deliver_response(struct
  6634. -
  6635. - sta_info_recalc_tim(sta);
  6636. - } else {
  6637. -+ unsigned long tids = sta->txq_buffered_tids & driver_release_tids;
  6638. -+ int tid;
  6639. -+
  6640. - /*
  6641. - * We need to release a frame that is buffered somewhere in the
  6642. - * driver ... it'll have to handle that.
  6643. -@@ -1466,8 +1519,22 @@ ieee80211_sta_ps_deliver_response(struct
  6644. - * that the TID(s) became empty before returning here from the
  6645. - * release function.
  6646. - * Either way, however, when the driver tells us that the TID(s)
  6647. -- * became empty we'll do the TIM recalculation.
  6648. -+ * became empty or we find that a txq became empty, we'll do the
  6649. -+ * TIM recalculation.
  6650. - */
  6651. -+
  6652. -+ if (!sta->sta.txq[0])
  6653. -+ return;
  6654. -+
  6655. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  6656. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  6657. -+
  6658. -+ if (!(tids & BIT(tid)) || skb_queue_len(&txqi->queue))
  6659. -+ continue;
  6660. -+
  6661. -+ sta_info_recalc_tim(sta);
  6662. -+ break;
  6663. -+ }
  6664. - }
  6665. - }
  6666. -
  6667. ---- a/net/mac80211/sta_info.h
  6668. -+++ b/net/mac80211/sta_info.h
  6669. -@@ -274,6 +274,7 @@ struct sta_ampdu_mlme {
  6670. - * entered power saving state, these are also delivered to
  6671. - * the station when it leaves powersave or polls for frames
  6672. - * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
  6673. -+ * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on
  6674. - * @rx_packets: Number of MSDUs received from this STA
  6675. - * @rx_bytes: Number of bytes received from this STA
  6676. - * @last_rx: time (in jiffies) when last frame was received from this STA
  6677. -@@ -368,6 +369,7 @@ struct sta_info {
  6678. - struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];
  6679. - struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];
  6680. - unsigned long driver_buffered_tids;
  6681. -+ unsigned long txq_buffered_tids;
  6682. -
  6683. - /* Updated from RX path only, no locking requirements */
  6684. - unsigned long rx_packets;
  6685. ---- a/net/mac80211/trace.h
  6686. -+++ b/net/mac80211/trace.h
  6687. -@@ -2312,6 +2312,37 @@ TRACE_EVENT(drv_tdls_recv_channel_switch
  6688. - )
  6689. - );
  6690. -
  6691. -+TRACE_EVENT(drv_wake_tx_queue,
  6692. -+ TP_PROTO(struct ieee80211_local *local,
  6693. -+ struct ieee80211_sub_if_data *sdata,
  6694. -+ struct txq_info *txq),
  6695. -+
  6696. -+ TP_ARGS(local, sdata, txq),
  6697. -+
  6698. -+ TP_STRUCT__entry(
  6699. -+ LOCAL_ENTRY
  6700. -+ VIF_ENTRY
  6701. -+ STA_ENTRY
  6702. -+ __field(u8, ac)
  6703. -+ __field(u8, tid)
  6704. -+ ),
  6705. -+
  6706. -+ TP_fast_assign(
  6707. -+ struct ieee80211_sta *sta = txq->txq.sta;
  6708. -+
  6709. -+ LOCAL_ASSIGN;
  6710. -+ VIF_ASSIGN;
  6711. -+ STA_ASSIGN;
  6712. -+ __entry->ac = txq->txq.ac;
  6713. -+ __entry->tid = txq->txq.tid;
  6714. -+ ),
  6715. -+
  6716. -+ TP_printk(
  6717. -+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " ac:%d tid:%d",
  6718. -+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->ac, __entry->tid
  6719. -+ )
  6720. -+);
  6721. -+
  6722. - #ifdef CPTCFG_MAC80211_MESSAGE_TRACING
  6723. - #undef TRACE_SYSTEM
  6724. - #define TRACE_SYSTEM mac80211_msg
  6725. ---- a/net/mac80211/tx.c
  6726. -+++ b/net/mac80211/tx.c
  6727. -@@ -776,12 +776,22 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  6728. - return TX_CONTINUE;
  6729. - }
  6730. -
  6731. -+static __le16 ieee80211_tx_next_seq(struct sta_info *sta, int tid)
  6732. -+{
  6733. -+ u16 *seq = &sta->tid_seq[tid];
  6734. -+ __le16 ret = cpu_to_le16(*seq);
  6735. -+
  6736. -+ /* Increase the sequence number. */
  6737. -+ *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  6738. -+
  6739. -+ return ret;
  6740. -+}
  6741. -+
  6742. - static ieee80211_tx_result debug_noinline
  6743. - ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
  6744. - {
  6745. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
  6746. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
  6747. -- u16 *seq;
  6748. - u8 *qc;
  6749. - int tid;
  6750. -
  6751. -@@ -832,13 +842,10 @@ ieee80211_tx_h_sequence(struct ieee80211
  6752. -
  6753. - qc = ieee80211_get_qos_ctl(hdr);
  6754. - tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
  6755. -- seq = &tx->sta->tid_seq[tid];
  6756. - tx->sta->tx_msdu[tid]++;
  6757. -
  6758. -- hdr->seq_ctrl = cpu_to_le16(*seq);
  6759. --
  6760. -- /* Increase the sequence number. */
  6761. -- *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  6762. -+ if (!tx->sta->sta.txq[0])
  6763. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);
  6764. -
  6765. - return TX_CONTINUE;
  6766. - }
  6767. -@@ -1067,7 +1074,7 @@ static bool ieee80211_tx_prep_agg(struct
  6768. - * nothing -- this aggregation session is being started
  6769. - * but that might still fail with the driver
  6770. - */
  6771. -- } else {
  6772. -+ } else if (!tx->sta->sta.txq[tid]) {
  6773. - spin_lock(&tx->sta->lock);
  6774. - /*
  6775. - * Need to re-check now, because we may get here
  6776. -@@ -1201,13 +1208,102 @@ ieee80211_tx_prepare(struct ieee80211_su
  6777. - return TX_CONTINUE;
  6778. - }
  6779. -
  6780. -+static void ieee80211_drv_tx(struct ieee80211_local *local,
  6781. -+ struct ieee80211_vif *vif,
  6782. -+ struct ieee80211_sta *pubsta,
  6783. -+ struct sk_buff *skb)
  6784. -+{
  6785. -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  6786. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
  6787. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6788. -+ struct ieee80211_tx_control control = {
  6789. -+ .sta = pubsta,
  6790. -+ };
  6791. -+ struct ieee80211_txq *txq = NULL;
  6792. -+ struct txq_info *txqi;
  6793. -+ u8 ac;
  6794. -+
  6795. -+ if (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)
  6796. -+ goto tx_normal;
  6797. -+
  6798. -+ if (!ieee80211_is_data(hdr->frame_control))
  6799. -+ goto tx_normal;
  6800. -+
  6801. -+ if (pubsta) {
  6802. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
  6803. -+
  6804. -+ txq = pubsta->txq[tid];
  6805. -+ } else if (vif) {
  6806. -+ txq = vif->txq;
  6807. -+ }
  6808. -+
  6809. -+ if (!txq)
  6810. -+ goto tx_normal;
  6811. -+
  6812. -+ ac = txq->ac;
  6813. -+ txqi = to_txq_info(txq);
  6814. -+ atomic_inc(&sdata->txqs_len[ac]);
  6815. -+ if (atomic_read(&sdata->txqs_len[ac]) >= local->hw.txq_ac_max_pending)
  6816. -+ netif_stop_subqueue(sdata->dev, ac);
  6817. -+
  6818. -+ skb_queue_tail(&txqi->queue, skb);
  6819. -+ drv_wake_tx_queue(local, txqi);
  6820. -+
  6821. -+ return;
  6822. -+
  6823. -+tx_normal:
  6824. -+ drv_tx(local, &control, skb);
  6825. -+}
  6826. -+
  6827. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  6828. -+ struct ieee80211_txq *txq)
  6829. -+{
  6830. -+ struct ieee80211_local *local = hw_to_local(hw);
  6831. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif);
  6832. -+ struct txq_info *txqi = container_of(txq, struct txq_info, txq);
  6833. -+ struct ieee80211_hdr *hdr;
  6834. -+ struct sk_buff *skb = NULL;
  6835. -+ u8 ac = txq->ac;
  6836. -+
  6837. -+ spin_lock_bh(&txqi->queue.lock);
  6838. -+
  6839. -+ if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags))
  6840. -+ goto out;
  6841. -+
  6842. -+ skb = __skb_dequeue(&txqi->queue);
  6843. -+ if (!skb)
  6844. -+ goto out;
  6845. -+
  6846. -+ atomic_dec(&sdata->txqs_len[ac]);
  6847. -+ if (__netif_subqueue_stopped(sdata->dev, ac))
  6848. -+ ieee80211_propagate_queue_wake(local, sdata->vif.hw_queue[ac]);
  6849. -+
  6850. -+ hdr = (struct ieee80211_hdr *)skb->data;
  6851. -+ if (txq->sta && ieee80211_is_data_qos(hdr->frame_control)) {
  6852. -+ struct sta_info *sta = container_of(txq->sta, struct sta_info,
  6853. -+ sta);
  6854. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6855. -+
  6856. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, txq->tid);
  6857. -+ if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
  6858. -+ info->flags |= IEEE80211_TX_CTL_AMPDU;
  6859. -+ else
  6860. -+ info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  6861. -+ }
  6862. -+
  6863. -+out:
  6864. -+ spin_unlock_bh(&txqi->queue.lock);
  6865. -+
  6866. -+ return skb;
  6867. -+}
  6868. -+EXPORT_SYMBOL(ieee80211_tx_dequeue);
  6869. -+
  6870. - static bool ieee80211_tx_frags(struct ieee80211_local *local,
  6871. - struct ieee80211_vif *vif,
  6872. - struct ieee80211_sta *sta,
  6873. - struct sk_buff_head *skbs,
  6874. - bool txpending)
  6875. - {
  6876. -- struct ieee80211_tx_control control;
  6877. - struct sk_buff *skb, *tmp;
  6878. - unsigned long flags;
  6879. -
  6880. -@@ -1265,10 +1361,9 @@ static bool ieee80211_tx_frags(struct ie
  6881. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  6882. -
  6883. - info->control.vif = vif;
  6884. -- control.sta = sta;
  6885. -
  6886. - __skb_unlink(skb, skbs);
  6887. -- drv_tx(local, &control, skb);
  6888. -+ ieee80211_drv_tx(local, vif, sta, skb);
  6889. - }
  6890. -
  6891. - return true;
  6892. ---- a/net/mac80211/util.c
  6893. -+++ b/net/mac80211/util.c
  6894. -@@ -308,6 +308,11 @@ void ieee80211_propagate_queue_wake(stru
  6895. - for (ac = 0; ac < n_acs; ac++) {
  6896. - int ac_queue = sdata->vif.hw_queue[ac];
  6897. -
  6898. -+ if (local->ops->wake_tx_queue &&
  6899. -+ (atomic_read(&sdata->txqs_len[ac]) >
  6900. -+ local->hw.txq_ac_max_pending))
  6901. -+ continue;
  6902. -+
  6903. - if (ac_queue == queue ||
  6904. - (sdata->vif.cab_queue == queue &&
  6905. - local->queue_stop_reasons[ac_queue] == 0 &&
  6906. -@@ -3307,3 +3312,20 @@ u8 *ieee80211_add_wmm_info_ie(u8 *buf, u
  6907. -
  6908. - return buf;
  6909. - }
  6910. -+
  6911. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  6912. -+ struct sta_info *sta,
  6913. -+ struct txq_info *txqi, int tid)
  6914. -+{
  6915. -+ skb_queue_head_init(&txqi->queue);
  6916. -+ txqi->txq.vif = &sdata->vif;
  6917. -+
  6918. -+ if (sta) {
  6919. -+ txqi->txq.sta = &sta->sta;
  6920. -+ sta->sta.txq[tid] = &txqi->txq;
  6921. -+ txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  6922. -+ } else {
  6923. -+ sdata->vif.txq = &txqi->txq;
  6924. -+ txqi->txq.ac = IEEE80211_AC_BE;
  6925. -+ }
  6926. -+}
  6927. ---- a/net/mac80211/rx.c
  6928. -+++ b/net/mac80211/rx.c
  6929. -@@ -1176,6 +1176,7 @@ static void sta_ps_start(struct sta_info
  6930. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  6931. - struct ieee80211_local *local = sdata->local;
  6932. - struct ps_data *ps;
  6933. -+ int tid;
  6934. -
  6935. - if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
  6936. - sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
  6937. -@@ -1189,6 +1190,18 @@ static void sta_ps_start(struct sta_info
  6938. - drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
  6939. - ps_dbg(sdata, "STA %pM aid %d enters power save mode\n",
  6940. - sta->sta.addr, sta->sta.aid);
  6941. -+
  6942. -+ if (!sta->sta.txq[0])
  6943. -+ return;
  6944. -+
  6945. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  6946. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  6947. -+
  6948. -+ if (!skb_queue_len(&txqi->queue))
  6949. -+ set_bit(tid, &sta->txq_buffered_tids);
  6950. -+ else
  6951. -+ clear_bit(tid, &sta->txq_buffered_tids);
  6952. -+ }
  6953. - }
  6954. -
  6955. - static void sta_ps_end(struct sta_info *sta)
  6956. ---- a/net/mac80211/agg-tx.c
  6957. -+++ b/net/mac80211/agg-tx.c
  6958. -@@ -188,6 +188,43 @@ ieee80211_wake_queue_agg(struct ieee8021
  6959. - __release(agg_queue);
  6960. - }
  6961. -
  6962. -+static void
  6963. -+ieee80211_agg_stop_txq(struct sta_info *sta, int tid)
  6964. -+{
  6965. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  6966. -+ struct txq_info *txqi;
  6967. -+
  6968. -+ if (!txq)
  6969. -+ return;
  6970. -+
  6971. -+ txqi = to_txq_info(txq);
  6972. -+
  6973. -+ /* Lock here to protect against further seqno updates on dequeue */
  6974. -+ spin_lock_bh(&txqi->queue.lock);
  6975. -+ set_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  6976. -+ spin_unlock_bh(&txqi->queue.lock);
  6977. -+}
  6978. -+
  6979. -+static void
  6980. -+ieee80211_agg_start_txq(struct sta_info *sta, int tid, bool enable)
  6981. -+{
  6982. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  6983. -+ struct txq_info *txqi;
  6984. -+
  6985. -+ if (!txq)
  6986. -+ return;
  6987. -+
  6988. -+ txqi = to_txq_info(txq);
  6989. -+
  6990. -+ if (enable)
  6991. -+ set_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  6992. -+ else
  6993. -+ clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  6994. -+
  6995. -+ clear_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  6996. -+ drv_wake_tx_queue(sta->sdata->local, txqi);
  6997. -+}
  6998. -+
  6999. - /*
  7000. - * splice packets from the STA's pending to the local pending,
  7001. - * requires a call to ieee80211_agg_splice_finish later
  7002. -@@ -247,6 +284,7 @@ static void ieee80211_remove_tid_tx(stru
  7003. - ieee80211_assign_tid_tx(sta, tid, NULL);
  7004. -
  7005. - ieee80211_agg_splice_finish(sta->sdata, tid);
  7006. -+ ieee80211_agg_start_txq(sta, tid, false);
  7007. -
  7008. - kfree_rcu(tid_tx, rcu_head);
  7009. - }
  7010. -@@ -418,6 +456,8 @@ void ieee80211_tx_ba_session_handle_star
  7011. - */
  7012. - clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
  7013. -
  7014. -+ ieee80211_agg_stop_txq(sta, tid);
  7015. -+
  7016. - /*
  7017. - * Make sure no packets are being processed. This ensures that
  7018. - * we have a valid starting sequence number and that in-flight
  7019. -@@ -440,6 +480,8 @@ void ieee80211_tx_ba_session_handle_star
  7020. - ieee80211_agg_splice_finish(sdata, tid);
  7021. - spin_unlock_bh(&sta->lock);
  7022. -
  7023. -+ ieee80211_agg_start_txq(sta, tid, false);
  7024. -+
  7025. - kfree_rcu(tid_tx, rcu_head);
  7026. - return;
  7027. - }
  7028. -@@ -666,6 +708,8 @@ static void ieee80211_agg_tx_operational
  7029. - ieee80211_agg_splice_finish(sta->sdata, tid);
  7030. -
  7031. - spin_unlock_bh(&sta->lock);
  7032. -+
  7033. -+ ieee80211_agg_start_txq(sta, tid, true);
  7034. - }
  7035. -
  7036. - void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
  7037. 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
  7038. new file mode 100644
  7039. index 0000000..4faac0d
  7040. --- /dev/null
  7041. +++ b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch
  7042. @@ -0,0 +1,121 @@
  7043. +From: Felix Fietkau <nbd@openwrt.org>
  7044. +Date: Thu, 2 Jul 2015 15:20:56 +0200
  7045. +Subject: [PATCH] ath9k: limit retries for powersave response frames
  7046. +
  7047. +In some cases, the channel might be busy enough that an ath9k AP's
  7048. +response to PS-Poll frames might be too slow and the station has already
  7049. +gone to sleep. To avoid wasting too much airtime on this, limit the
  7050. +number of retries on such frames and ensure that no sample rate gets
  7051. +used.
  7052. +
  7053. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7054. +---
  7055. +
  7056. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  7057. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  7058. +@@ -147,10 +147,25 @@ static void ath_send_bar(struct ath_atx_
  7059. + }
  7060. +
  7061. + static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
  7062. +- struct ath_buf *bf)
  7063. ++ struct ath_buf *bf, bool ps)
  7064. + {
  7065. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
  7066. ++
  7067. ++ if (ps) {
  7068. ++ /* Clear the first rate to avoid using a sample rate for PS frames */
  7069. ++ info->control.rates[0].idx = -1;
  7070. ++ info->control.rates[0].count = 0;
  7071. ++ }
  7072. ++
  7073. + ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
  7074. + ARRAY_SIZE(bf->rates));
  7075. ++ if (!ps)
  7076. ++ return;
  7077. ++
  7078. ++ if (bf->rates[0].count > 2)
  7079. ++ bf->rates[0].count = 2;
  7080. ++
  7081. ++ bf->rates[1].idx = -1;
  7082. + }
  7083. +
  7084. + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
  7085. +@@ -1430,7 +1445,7 @@ ath_tx_form_burst(struct ath_softc *sc,
  7086. + if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  7087. + break;
  7088. +
  7089. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  7090. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  7091. + } while (1);
  7092. + }
  7093. +
  7094. +@@ -1461,7 +1476,7 @@ static bool ath_tx_sched_aggr(struct ath
  7095. + return false;
  7096. + }
  7097. +
  7098. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  7099. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  7100. + if (aggr)
  7101. + last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
  7102. + tid_q, &aggr_len);
  7103. +@@ -1653,7 +1668,7 @@ void ath9k_release_buffered_frames(struc
  7104. +
  7105. + __skb_unlink(bf->bf_mpdu, tid_q);
  7106. + list_add_tail(&bf->list, &bf_q);
  7107. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  7108. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  7109. + if (bf_isampdu(bf)) {
  7110. + ath_tx_addto_baw(sc, tid, bf);
  7111. + bf->bf_state.bf_type &= ~BUF_AGGR;
  7112. +@@ -2318,7 +2333,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  7113. + struct ath_txq *txq = txctl->txq;
  7114. + struct ath_atx_tid *tid = NULL;
  7115. + struct ath_buf *bf;
  7116. +- bool queue, skip_uapsd = false, ps_resp;
  7117. ++ bool queue, ps_resp;
  7118. + int q, ret;
  7119. +
  7120. + if (vif)
  7121. +@@ -2365,13 +2380,13 @@ int ath_tx_start(struct ieee80211_hw *hw
  7122. + if (!txctl->an)
  7123. + txctl->an = &avp->mcast_node;
  7124. + queue = true;
  7125. +- skip_uapsd = true;
  7126. ++ ps_resp = false;
  7127. + }
  7128. +
  7129. + if (txctl->an && queue)
  7130. + tid = ath_get_skb_tid(sc, txctl->an, skb);
  7131. +
  7132. +- if (!skip_uapsd && ps_resp) {
  7133. ++ if (ps_resp) {
  7134. + ath_txq_unlock(sc, txq);
  7135. + txq = sc->tx.uapsdq;
  7136. + ath_txq_lock(sc, txq);
  7137. +@@ -2409,7 +2424,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  7138. + if (txctl->paprd)
  7139. + bf->bf_state.bfs_paprd_timestamp = jiffies;
  7140. +
  7141. +- ath_set_rates(vif, sta, bf);
  7142. ++ ath_set_rates(vif, sta, bf, ps_resp);
  7143. + ath_tx_send_normal(sc, txq, tid, skb);
  7144. +
  7145. + out:
  7146. +@@ -2448,7 +2463,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw
  7147. + break;
  7148. +
  7149. + bf->bf_lastbf = bf;
  7150. +- ath_set_rates(vif, NULL, bf);
  7151. ++ ath_set_rates(vif, NULL, bf, false);
  7152. + ath_buf_set_rate(sc, bf, &info, fi->framelen, false);
  7153. + duration += info.rates[0].PktDuration;
  7154. + if (bf_tail)
  7155. +@@ -2968,7 +2983,7 @@ int ath9k_tx99_send(struct ath_softc *sc
  7156. + return -EINVAL;
  7157. + }
  7158. +
  7159. +- ath_set_rates(sc->tx99_vif, NULL, bf);
  7160. ++ ath_set_rates(sc->tx99_vif, NULL, bf, false);
  7161. +
  7162. + ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);
  7163. + ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum);
  7164. diff --git a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch b/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  7165. deleted file mode 100644
  7166. index 465d943..0000000
  7167. --- a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  7168. +++ /dev/null
  7169. @@ -1,125 +0,0 @@
  7170. -From: Johannes Berg <johannes.berg@intel.com>
  7171. -Date: Wed, 11 Mar 2015 09:14:15 +0100
  7172. -Subject: [PATCH] mac80211: lock rate control
  7173. -
  7174. -Both minstrel (reported by Sven Eckelmann) and the iwlwifi rate
  7175. -control aren't properly taking concurrency into account. It's
  7176. -likely that the same is true for other rate control algorithms.
  7177. -
  7178. -In the case of minstrel this manifests itself in crashes when an
  7179. -update and other data access are run concurrently, for example
  7180. -when the stations change bandwidth or similar. In iwlwifi, this
  7181. -can cause firmware crashes.
  7182. -
  7183. -Since fixing all rate control algorithms will be very difficult,
  7184. -just provide locking for invocations. This protects the internal
  7185. -data structures the algorithms maintain.
  7186. -
  7187. -I've manipulated hostapd to test this, by having it change its
  7188. -advertised bandwidth roughly ever 150ms. At the same time, I'm
  7189. -running a flood ping between the client and the AP, which causes
  7190. -this race of update vs. get_rate/status to easily happen on the
  7191. -client. With this change, the system survives this test.
  7192. -
  7193. -Reported-by: Sven Eckelmann <sven@open-mesh.com>
  7194. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7195. ----
  7196. -
  7197. ---- a/net/mac80211/rate.c
  7198. -+++ b/net/mac80211/rate.c
  7199. -@@ -683,7 +683,13 @@ void rate_control_get_rate(struct ieee80
  7200. - if (sdata->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
  7201. - return;
  7202. -
  7203. -- ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  7204. -+ if (ista) {
  7205. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7206. -+ ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  7207. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7208. -+ } else {
  7209. -+ ref->ops->get_rate(ref->priv, NULL, NULL, txrc);
  7210. -+ }
  7211. -
  7212. - if (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_RC_TABLE)
  7213. - return;
  7214. ---- a/net/mac80211/rate.h
  7215. -+++ b/net/mac80211/rate.h
  7216. -@@ -42,10 +42,12 @@ static inline void rate_control_tx_statu
  7217. - if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
  7218. - return;
  7219. -
  7220. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7221. - if (ref->ops->tx_status)
  7222. - ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
  7223. - else
  7224. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  7225. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7226. - }
  7227. -
  7228. - static inline void
  7229. -@@ -64,7 +66,9 @@ rate_control_tx_status_noskb(struct ieee
  7230. - if (WARN_ON_ONCE(!ref->ops->tx_status_noskb))
  7231. - return;
  7232. -
  7233. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7234. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  7235. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7236. - }
  7237. -
  7238. - static inline void rate_control_rate_init(struct sta_info *sta)
  7239. -@@ -91,8 +95,10 @@ static inline void rate_control_rate_ini
  7240. -
  7241. - sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  7242. -
  7243. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7244. - ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  7245. - priv_sta);
  7246. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7247. - rcu_read_unlock();
  7248. - set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  7249. - }
  7250. -@@ -115,18 +121,20 @@ static inline void rate_control_rate_upd
  7251. - return;
  7252. - }
  7253. -
  7254. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7255. - ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  7256. - ista, priv_sta, changed);
  7257. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7258. - rcu_read_unlock();
  7259. - }
  7260. - drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  7261. - }
  7262. -
  7263. - static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  7264. -- struct ieee80211_sta *sta,
  7265. -- gfp_t gfp)
  7266. -+ struct sta_info *sta, gfp_t gfp)
  7267. - {
  7268. -- return ref->ops->alloc_sta(ref->priv, sta, gfp);
  7269. -+ spin_lock_init(&sta->rate_ctrl_lock);
  7270. -+ return ref->ops->alloc_sta(ref->priv, &sta->sta, gfp);
  7271. - }
  7272. -
  7273. - static inline void rate_control_free_sta(struct sta_info *sta)
  7274. ---- a/net/mac80211/sta_info.c
  7275. -+++ b/net/mac80211/sta_info.c
  7276. -@@ -286,7 +286,7 @@ static int sta_prepare_rate_control(stru
  7277. -
  7278. - sta->rate_ctrl = local->rate_ctrl;
  7279. - sta->rate_ctrl_priv = rate_control_alloc_sta(sta->rate_ctrl,
  7280. -- &sta->sta, gfp);
  7281. -+ sta, gfp);
  7282. - if (!sta->rate_ctrl_priv)
  7283. - return -ENOMEM;
  7284. -
  7285. ---- a/net/mac80211/sta_info.h
  7286. -+++ b/net/mac80211/sta_info.h
  7287. -@@ -349,6 +349,7 @@ struct sta_info {
  7288. - u8 ptk_idx;
  7289. - struct rate_control_ref *rate_ctrl;
  7290. - void *rate_ctrl_priv;
  7291. -+ spinlock_t rate_ctrl_lock;
  7292. - spinlock_t lock;
  7293. -
  7294. - struct work_struct drv_deliver_wk;
  7295. 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
  7296. new file mode 100644
  7297. index 0000000..820aa9a
  7298. --- /dev/null
  7299. +++ b/package/kernel/mac80211/patches/302-ath10k-Delay-device-access-after-cold-reset.patch
  7300. @@ -0,0 +1,56 @@
  7301. +From: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
  7302. +Date: Fri, 3 Jul 2015 11:45:42 +0530
  7303. +Subject: [PATCH] ath10k: Delay device access after cold reset
  7304. +
  7305. +It is observed that during cold reset pcie access right
  7306. +after a write operation to SOC_GLOBAL_RESET_ADDRESS causes
  7307. +Data Bus Error and system hard lockup. The reason
  7308. +for bus error is that pcie needs some time to get
  7309. +back to stable state for any transaction during cold reset. Add
  7310. +delay of 20 msecs after write of SOC_GLOBAL_RESET_ADDRESS
  7311. +to fix this issue.
  7312. +
  7313. +Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
  7314. +---
  7315. +
  7316. +--- a/drivers/net/wireless/ath/ath10k/pci.c
  7317. ++++ b/drivers/net/wireless/ath/ath10k/pci.c
  7318. +@@ -2761,7 +2761,6 @@ static int ath10k_pci_wait_for_target_in
  7319. +
  7320. + static int ath10k_pci_cold_reset(struct ath10k *ar)
  7321. + {
  7322. +- int i;
  7323. + u32 val;
  7324. +
  7325. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot cold reset\n");
  7326. +@@ -2777,23 +2776,18 @@ static int ath10k_pci_cold_reset(struct
  7327. + val |= 1;
  7328. + ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
  7329. +
  7330. +- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
  7331. +- if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
  7332. +- RTC_STATE_COLD_RESET_MASK)
  7333. +- break;
  7334. +- msleep(1);
  7335. +- }
  7336. ++ /* After writing into SOC_GLOBAL_RESET to put device into
  7337. ++ * reset and pulling out of reset pcie may not be stable
  7338. ++ * for any immediate pcie register access and cause bus error,
  7339. ++ * add delay before any pcie access request to fix this issue.
  7340. ++ */
  7341. ++ msleep(20);
  7342. +
  7343. + /* Pull Target, including PCIe, out of RESET. */
  7344. + val &= ~1;
  7345. + ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
  7346. +
  7347. +- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
  7348. +- if (!(ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
  7349. +- RTC_STATE_COLD_RESET_MASK))
  7350. +- break;
  7351. +- msleep(1);
  7352. +- }
  7353. ++ msleep(20);
  7354. +
  7355. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot cold reset complete\n");
  7356. +
  7357. 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
  7358. deleted file mode 100644
  7359. index e54e16e..0000000
  7360. --- a/package/kernel/mac80211/patches/302-ath9k-restart-only-triggering-DFS-detector-line.patch
  7361. +++ /dev/null
  7362. @@ -1,21 +0,0 @@
  7363. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7364. -Date: Tue, 10 Mar 2015 17:49:29 +0100
  7365. -Subject: [PATCH] ath9k: restart only triggering DFS detector line
  7366. -
  7367. -To support HT40 DFS mode, a triggering detector must
  7368. -reset only itself but not other detector lines.
  7369. -
  7370. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7371. ----
  7372. -
  7373. ---- a/drivers/net/wireless/ath/dfs_pattern_detector.c
  7374. -+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
  7375. -@@ -289,7 +289,7 @@ dpd_add_pulse(struct dfs_pattern_detecto
  7376. - "count=%d, count_false=%d\n",
  7377. - event->freq, pd->rs->type_id,
  7378. - ps->pri, ps->count, ps->count_falses);
  7379. -- channel_detector_reset(dpd, cd);
  7380. -+ pd->reset(pd, dpd->last_pulse_ts);
  7381. - return true;
  7382. - }
  7383. - }
  7384. 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
  7385. deleted file mode 100644
  7386. index ed268ea..0000000
  7387. --- a/package/kernel/mac80211/patches/303-ath9k-add-DFS-support-for-extension-channel.patch
  7388. +++ /dev/null
  7389. @@ -1,76 +0,0 @@
  7390. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7391. -Date: Tue, 10 Mar 2015 17:49:30 +0100
  7392. -Subject: [PATCH] ath9k: add DFS support for extension channel
  7393. -
  7394. -In HT40 modes, pulse events on primary and extension
  7395. -channel are processed individually. If valid, a pulse
  7396. -event will be fed into the detector
  7397. -* for primary frequency, or
  7398. -* for extension frequency (+/-20MHz based on HT40-mode)
  7399. -* or both
  7400. -
  7401. -With that, a 40MHz radar will result in two individual
  7402. -radar events.
  7403. -
  7404. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7405. ----
  7406. -
  7407. ---- a/drivers/net/wireless/ath/ath9k/dfs.c
  7408. -+++ b/drivers/net/wireless/ath/ath9k/dfs.c
  7409. -@@ -126,8 +126,19 @@ ath9k_postprocess_radar_event(struct ath
  7410. - DFS_STAT_INC(sc, pulses_detected);
  7411. - return true;
  7412. - }
  7413. --#undef PRI_CH_RADAR_FOUND
  7414. --#undef EXT_CH_RADAR_FOUND
  7415. -+
  7416. -+static void
  7417. -+ath9k_dfs_process_radar_pulse(struct ath_softc *sc, struct pulse_event *pe)
  7418. -+{
  7419. -+ struct dfs_pattern_detector *pd = sc->dfs_detector;
  7420. -+ DFS_STAT_INC(sc, pulses_processed);
  7421. -+ if (pd == NULL)
  7422. -+ return;
  7423. -+ if (!pd->add_pulse(pd, pe))
  7424. -+ return;
  7425. -+ DFS_STAT_INC(sc, radar_detected);
  7426. -+ ieee80211_radar_detected(sc->hw);
  7427. -+}
  7428. -
  7429. - /*
  7430. - * DFS: check PHY-error for radar pulse and feed the detector
  7431. -@@ -176,18 +187,21 @@ void ath9k_dfs_process_phyerr(struct ath
  7432. - ard.pulse_length_pri = vdata_end[-3];
  7433. - pe.freq = ah->curchan->channel;
  7434. - pe.ts = mactime;
  7435. -- if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
  7436. -- struct dfs_pattern_detector *pd = sc->dfs_detector;
  7437. -- ath_dbg(common, DFS,
  7438. -- "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, "
  7439. -- "width=%d, rssi=%d, delta_ts=%llu\n",
  7440. -- pe.freq, pe.ts, pe.width, pe.rssi,
  7441. -- pe.ts - sc->dfs_prev_pulse_ts);
  7442. -- sc->dfs_prev_pulse_ts = pe.ts;
  7443. -- DFS_STAT_INC(sc, pulses_processed);
  7444. -- if (pd != NULL && pd->add_pulse(pd, &pe)) {
  7445. -- DFS_STAT_INC(sc, radar_detected);
  7446. -- ieee80211_radar_detected(sc->hw);
  7447. -- }
  7448. -+ if (!ath9k_postprocess_radar_event(sc, &ard, &pe))
  7449. -+ return;
  7450. -+
  7451. -+ ath_dbg(common, DFS,
  7452. -+ "ath9k_dfs_process_phyerr: type=%d, freq=%d, ts=%llu, "
  7453. -+ "width=%d, rssi=%d, delta_ts=%llu\n",
  7454. -+ ard.pulse_bw_info, pe.freq, pe.ts, pe.width, pe.rssi,
  7455. -+ pe.ts - sc->dfs_prev_pulse_ts);
  7456. -+ sc->dfs_prev_pulse_ts = pe.ts;
  7457. -+ if (ard.pulse_bw_info & PRI_CH_RADAR_FOUND)
  7458. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  7459. -+ if (ard.pulse_bw_info & EXT_CH_RADAR_FOUND) {
  7460. -+ pe.freq += IS_CHAN_HT40PLUS(ah->curchan) ? 20 : -20;
  7461. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  7462. - }
  7463. - }
  7464. -+#undef PRI_CH_RADAR_FOUND
  7465. -+#undef EXT_CH_RADAR_FOUND
  7466. 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
  7467. new file mode 100644
  7468. index 0000000..139015c
  7469. --- /dev/null
  7470. +++ b/package/kernel/mac80211/patches/303-ath9k-add-fast-xmit-support.patch
  7471. @@ -0,0 +1,17 @@
  7472. +From: Felix Fietkau <nbd@openwrt.org>
  7473. +Date: Mon, 11 May 2015 18:35:20 +0200
  7474. +Subject: [PATCH] ath9k: add fast-xmit support
  7475. +
  7476. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7477. +---
  7478. +
  7479. +--- a/drivers/net/wireless/ath/ath9k/init.c
  7480. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  7481. +@@ -826,6 +826,7 @@ static void ath9k_set_hw_capab(struct at
  7482. + ieee80211_hw_set(hw, SIGNAL_DBM);
  7483. + ieee80211_hw_set(hw, RX_INCLUDES_FCS);
  7484. + ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
  7485. ++ ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
  7486. +
  7487. + if (ath9k_ps_enable)
  7488. + ieee80211_hw_set(hw, SUPPORTS_PS);
  7489. 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
  7490. deleted file mode 100644
  7491. index e1eab64..0000000
  7492. --- a/package/kernel/mac80211/patches/304-ath9k-allow-40MHz-radar-detection-width.patch
  7493. +++ /dev/null
  7494. @@ -1,19 +0,0 @@
  7495. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7496. -Date: Tue, 10 Mar 2015 17:49:31 +0100
  7497. -Subject: [PATCH] ath9k: allow 40MHz radar detection width
  7498. -
  7499. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7500. ----
  7501. -
  7502. ---- a/drivers/net/wireless/ath/ath9k/init.c
  7503. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  7504. -@@ -763,7 +763,8 @@ static const struct ieee80211_iface_comb
  7505. - .num_different_channels = 1,
  7506. - .beacon_int_infra_match = true,
  7507. - .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  7508. -- BIT(NL80211_CHAN_WIDTH_20),
  7509. -+ BIT(NL80211_CHAN_WIDTH_20) |
  7510. -+ BIT(NL80211_CHAN_WIDTH_40),
  7511. - }
  7512. - #endif
  7513. - };
  7514. 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
  7515. new file mode 100644
  7516. index 0000000..9f04276
  7517. --- /dev/null
  7518. +++ b/package/kernel/mac80211/patches/304-ath9k-remove-struct-ath_atx_ac.patch
  7519. @@ -0,0 +1,385 @@
  7520. +From: Felix Fietkau <nbd@openwrt.org>
  7521. +Date: Sat, 4 Apr 2015 18:39:06 +0200
  7522. +Subject: [PATCH] ath9k: remove struct ath_atx_ac
  7523. +
  7524. +struct ath_atx_ac contains a list of active TIDs belonging to one WMM AC.
  7525. +This patch changes the code to track active station TIDs in the txq directly.
  7526. +
  7527. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7528. +---
  7529. +
  7530. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  7531. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  7532. +@@ -173,14 +173,6 @@ struct ath_txq {
  7533. + struct sk_buff_head complete_q;
  7534. + };
  7535. +
  7536. +-struct ath_atx_ac {
  7537. +- struct ath_txq *txq;
  7538. +- struct list_head list;
  7539. +- struct list_head tid_q;
  7540. +- bool clear_ps_filter;
  7541. +- bool sched;
  7542. +-};
  7543. +-
  7544. + struct ath_frame_info {
  7545. + struct ath_buf *bf;
  7546. + u16 framelen;
  7547. +@@ -243,7 +235,7 @@ struct ath_atx_tid {
  7548. + struct sk_buff_head buf_q;
  7549. + struct sk_buff_head retry_q;
  7550. + struct ath_node *an;
  7551. +- struct ath_atx_ac *ac;
  7552. ++ struct ath_txq *txq;
  7553. + unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
  7554. + u16 seq_start;
  7555. + u16 seq_next;
  7556. +@@ -255,6 +247,7 @@ struct ath_atx_tid {
  7557. + s8 bar_index;
  7558. + bool sched;
  7559. + bool active;
  7560. ++ bool clear_ps_filter;
  7561. + };
  7562. +
  7563. + struct ath_node {
  7564. +@@ -262,7 +255,6 @@ struct ath_node {
  7565. + struct ieee80211_sta *sta; /* station struct we're part of */
  7566. + struct ieee80211_vif *vif; /* interface with which we're associated */
  7567. + struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
  7568. +- struct ath_atx_ac ac[IEEE80211_NUM_ACS];
  7569. +
  7570. + u16 maxampdu;
  7571. + u8 mpdudensity;
  7572. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  7573. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  7574. +@@ -106,7 +106,6 @@ void ath_txq_unlock_complete(struct ath_
  7575. + static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq,
  7576. + struct ath_atx_tid *tid)
  7577. + {
  7578. +- struct ath_atx_ac *ac = tid->ac;
  7579. + struct list_head *list;
  7580. + struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv;
  7581. + struct ath_chanctx *ctx = avp->chanctx;
  7582. +@@ -118,15 +117,8 @@ static void ath_tx_queue_tid(struct ath_
  7583. + return;
  7584. +
  7585. + tid->sched = true;
  7586. +- list_add_tail(&tid->list, &ac->tid_q);
  7587. +-
  7588. +- if (ac->sched)
  7589. +- return;
  7590. +-
  7591. +- ac->sched = true;
  7592. +-
  7593. + list = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
  7594. +- list_add_tail(&ac->list, list);
  7595. ++ list_add_tail(&tid->list, list);
  7596. + }
  7597. +
  7598. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  7599. +@@ -223,7 +215,7 @@ static struct sk_buff *ath_tid_dequeue(s
  7600. + static void
  7601. + ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid)
  7602. + {
  7603. +- struct ath_txq *txq = tid->ac->txq;
  7604. ++ struct ath_txq *txq = tid->txq;
  7605. + struct ieee80211_tx_info *tx_info;
  7606. + struct sk_buff *skb, *tskb;
  7607. + struct ath_buf *bf;
  7608. +@@ -252,7 +244,7 @@ ath_tx_tid_change_state(struct ath_softc
  7609. +
  7610. + static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  7611. + {
  7612. +- struct ath_txq *txq = tid->ac->txq;
  7613. ++ struct ath_txq *txq = tid->txq;
  7614. + struct sk_buff *skb;
  7615. + struct ath_buf *bf;
  7616. + struct list_head bf_head;
  7617. +@@ -659,7 +651,7 @@ static void ath_tx_complete_aggr(struct
  7618. + ath_tx_queue_tid(sc, txq, tid);
  7619. +
  7620. + if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
  7621. +- tid->ac->clear_ps_filter = true;
  7622. ++ tid->clear_ps_filter = true;
  7623. + }
  7624. + }
  7625. +
  7626. +@@ -749,7 +741,7 @@ static u32 ath_lookup_rate(struct ath_so
  7627. + struct ieee80211_tx_rate *rates;
  7628. + u32 max_4ms_framelen, frmlen;
  7629. + u16 aggr_limit, bt_aggr_limit, legacy = 0;
  7630. +- int q = tid->ac->txq->mac80211_qnum;
  7631. ++ int q = tid->txq->mac80211_qnum;
  7632. + int i;
  7633. +
  7634. + skb = bf->bf_mpdu;
  7635. +@@ -1486,8 +1478,8 @@ static bool ath_tx_sched_aggr(struct ath
  7636. + if (list_empty(&bf_q))
  7637. + return false;
  7638. +
  7639. +- if (tid->ac->clear_ps_filter || tid->an->no_ps_filter) {
  7640. +- tid->ac->clear_ps_filter = false;
  7641. ++ if (tid->clear_ps_filter || tid->an->no_ps_filter) {
  7642. ++ tid->clear_ps_filter = false;
  7643. + tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  7644. + }
  7645. +
  7646. +@@ -1506,7 +1498,7 @@ int ath_tx_aggr_start(struct ath_softc *
  7647. +
  7648. + an = (struct ath_node *)sta->drv_priv;
  7649. + txtid = ATH_AN_2_TID(an, tid);
  7650. +- txq = txtid->ac->txq;
  7651. ++ txq = txtid->txq;
  7652. +
  7653. + ath_txq_lock(sc, txq);
  7654. +
  7655. +@@ -1540,7 +1532,7 @@ void ath_tx_aggr_stop(struct ath_softc *
  7656. + {
  7657. + struct ath_node *an = (struct ath_node *)sta->drv_priv;
  7658. + struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
  7659. +- struct ath_txq *txq = txtid->ac->txq;
  7660. ++ struct ath_txq *txq = txtid->txq;
  7661. +
  7662. + ath_txq_lock(sc, txq);
  7663. + txtid->active = false;
  7664. +@@ -1553,7 +1545,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7665. + struct ath_node *an)
  7666. + {
  7667. + struct ath_atx_tid *tid;
  7668. +- struct ath_atx_ac *ac;
  7669. + struct ath_txq *txq;
  7670. + bool buffered;
  7671. + int tidno;
  7672. +@@ -1561,8 +1552,7 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7673. + for (tidno = 0, tid = &an->tid[tidno];
  7674. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  7675. +
  7676. +- ac = tid->ac;
  7677. +- txq = ac->txq;
  7678. ++ txq = tid->txq;
  7679. +
  7680. + ath_txq_lock(sc, txq);
  7681. +
  7682. +@@ -1576,11 +1566,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7683. + tid->sched = false;
  7684. + list_del(&tid->list);
  7685. +
  7686. +- if (ac->sched) {
  7687. +- ac->sched = false;
  7688. +- list_del(&ac->list);
  7689. +- }
  7690. +-
  7691. + ath_txq_unlock(sc, txq);
  7692. +
  7693. + ieee80211_sta_set_buffered(sta, tidno, buffered);
  7694. +@@ -1590,18 +1575,16 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7695. + void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
  7696. + {
  7697. + struct ath_atx_tid *tid;
  7698. +- struct ath_atx_ac *ac;
  7699. + struct ath_txq *txq;
  7700. + int tidno;
  7701. +
  7702. + for (tidno = 0, tid = &an->tid[tidno];
  7703. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  7704. +
  7705. +- ac = tid->ac;
  7706. +- txq = ac->txq;
  7707. ++ txq = tid->txq;
  7708. +
  7709. + ath_txq_lock(sc, txq);
  7710. +- ac->clear_ps_filter = true;
  7711. ++ tid->clear_ps_filter = true;
  7712. +
  7713. + if (ath_tid_has_buffered(tid)) {
  7714. + ath_tx_queue_tid(sc, txq, tid);
  7715. +@@ -1621,7 +1604,7 @@ void ath_tx_aggr_resume(struct ath_softc
  7716. +
  7717. + an = (struct ath_node *)sta->drv_priv;
  7718. + tid = ATH_AN_2_TID(an, tidno);
  7719. +- txq = tid->ac->txq;
  7720. ++ txq = tid->txq;
  7721. +
  7722. + ath_txq_lock(sc, txq);
  7723. +
  7724. +@@ -1660,7 +1643,7 @@ void ath9k_release_buffered_frames(struc
  7725. +
  7726. + tid = ATH_AN_2_TID(an, i);
  7727. +
  7728. +- ath_txq_lock(sc, tid->ac->txq);
  7729. ++ ath_txq_lock(sc, tid->txq);
  7730. + while (nframes > 0) {
  7731. + bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
  7732. + if (!bf)
  7733. +@@ -1684,7 +1667,7 @@ void ath9k_release_buffered_frames(struc
  7734. + if (an->sta && !ath_tid_has_buffered(tid))
  7735. + ieee80211_sta_set_buffered(an->sta, i, false);
  7736. + }
  7737. +- ath_txq_unlock_complete(sc, tid->ac->txq);
  7738. ++ ath_txq_unlock_complete(sc, tid->txq);
  7739. + }
  7740. +
  7741. + if (list_empty(&bf_q))
  7742. +@@ -1933,9 +1916,8 @@ void ath_tx_cleanupq(struct ath_softc *s
  7743. + void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
  7744. + {
  7745. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  7746. +- struct ath_atx_ac *ac, *last_ac;
  7747. + struct ath_atx_tid *tid, *last_tid;
  7748. +- struct list_head *ac_list;
  7749. ++ struct list_head *tid_list;
  7750. + bool sent = false;
  7751. +
  7752. + if (txq->mac80211_qnum < 0)
  7753. +@@ -1945,63 +1927,46 @@ void ath_txq_schedule(struct ath_softc *
  7754. + return;
  7755. +
  7756. + spin_lock_bh(&sc->chan_lock);
  7757. +- ac_list = &sc->cur_chan->acq[txq->mac80211_qnum];
  7758. ++ tid_list = &sc->cur_chan->acq[txq->mac80211_qnum];
  7759. +
  7760. +- if (list_empty(ac_list)) {
  7761. ++ if (list_empty(tid_list)) {
  7762. + spin_unlock_bh(&sc->chan_lock);
  7763. + return;
  7764. + }
  7765. +
  7766. + rcu_read_lock();
  7767. +
  7768. +- last_ac = list_entry(ac_list->prev, struct ath_atx_ac, list);
  7769. +- while (!list_empty(ac_list)) {
  7770. ++ last_tid = list_entry(tid_list->prev, struct ath_atx_tid, list);
  7771. ++ while (!list_empty(tid_list)) {
  7772. + bool stop = false;
  7773. +
  7774. + if (sc->cur_chan->stopped)
  7775. + break;
  7776. +
  7777. +- ac = list_first_entry(ac_list, struct ath_atx_ac, list);
  7778. +- last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
  7779. +- list_del(&ac->list);
  7780. +- ac->sched = false;
  7781. +-
  7782. +- while (!list_empty(&ac->tid_q)) {
  7783. +-
  7784. +- tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
  7785. +- list);
  7786. +- list_del(&tid->list);
  7787. +- tid->sched = false;
  7788. +-
  7789. +- if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  7790. +- sent = true;
  7791. +-
  7792. +- /*
  7793. +- * add tid to round-robin queue if more frames
  7794. +- * are pending for the tid
  7795. +- */
  7796. +- if (ath_tid_has_buffered(tid))
  7797. +- ath_tx_queue_tid(sc, txq, tid);
  7798. ++ tid = list_first_entry(tid_list, struct ath_atx_tid, list);
  7799. ++ list_del(&tid->list);
  7800. ++ tid->sched = false;
  7801. +
  7802. +- if (stop || tid == last_tid)
  7803. +- break;
  7804. +- }
  7805. ++ if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  7806. ++ sent = true;
  7807. +
  7808. +- if (!list_empty(&ac->tid_q) && !ac->sched) {
  7809. +- ac->sched = true;
  7810. +- list_add_tail(&ac->list, ac_list);
  7811. +- }
  7812. ++ /*
  7813. ++ * add tid to round-robin queue if more frames
  7814. ++ * are pending for the tid
  7815. ++ */
  7816. ++ if (ath_tid_has_buffered(tid))
  7817. ++ ath_tx_queue_tid(sc, txq, tid);
  7818. +
  7819. + if (stop)
  7820. + break;
  7821. +
  7822. +- if (ac == last_ac) {
  7823. ++ if (tid == last_tid) {
  7824. + if (!sent)
  7825. + break;
  7826. +
  7827. + sent = false;
  7828. +- last_ac = list_entry(ac_list->prev,
  7829. +- struct ath_atx_ac, list);
  7830. ++ last_tid = list_entry(tid_list->prev,
  7831. ++ struct ath_atx_tid, list);
  7832. + }
  7833. + }
  7834. +
  7835. +@@ -2391,10 +2356,10 @@ int ath_tx_start(struct ieee80211_hw *hw
  7836. + txq = sc->tx.uapsdq;
  7837. + ath_txq_lock(sc, txq);
  7838. + } else if (txctl->an && queue) {
  7839. +- WARN_ON(tid->ac->txq != txctl->txq);
  7840. ++ WARN_ON(tid->txq != txctl->txq);
  7841. +
  7842. + if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
  7843. +- tid->ac->clear_ps_filter = true;
  7844. ++ tid->clear_ps_filter = true;
  7845. +
  7846. + /*
  7847. + * Add this frame to software queue for scheduling later
  7848. +@@ -2888,7 +2853,6 @@ int ath_tx_init(struct ath_softc *sc, in
  7849. + void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
  7850. + {
  7851. + struct ath_atx_tid *tid;
  7852. +- struct ath_atx_ac *ac;
  7853. + int tidno, acno;
  7854. +
  7855. + for (tidno = 0, tid = &an->tid[tidno];
  7856. +@@ -2901,24 +2865,16 @@ void ath_tx_node_init(struct ath_softc *
  7857. + tid->baw_head = tid->baw_tail = 0;
  7858. + tid->sched = false;
  7859. + tid->active = false;
  7860. ++ tid->clear_ps_filter = true;
  7861. + __skb_queue_head_init(&tid->buf_q);
  7862. + __skb_queue_head_init(&tid->retry_q);
  7863. + acno = TID_TO_WME_AC(tidno);
  7864. +- tid->ac = &an->ac[acno];
  7865. +- }
  7866. +-
  7867. +- for (acno = 0, ac = &an->ac[acno];
  7868. +- acno < IEEE80211_NUM_ACS; acno++, ac++) {
  7869. +- ac->sched = false;
  7870. +- ac->clear_ps_filter = true;
  7871. +- ac->txq = sc->tx.txq_map[acno];
  7872. +- INIT_LIST_HEAD(&ac->tid_q);
  7873. ++ tid->txq = sc->tx.txq_map[acno];
  7874. + }
  7875. + }
  7876. +
  7877. + void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
  7878. + {
  7879. +- struct ath_atx_ac *ac;
  7880. + struct ath_atx_tid *tid;
  7881. + struct ath_txq *txq;
  7882. + int tidno;
  7883. +@@ -2926,8 +2882,7 @@ void ath_tx_node_cleanup(struct ath_soft
  7884. + for (tidno = 0, tid = &an->tid[tidno];
  7885. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  7886. +
  7887. +- ac = tid->ac;
  7888. +- txq = ac->txq;
  7889. ++ txq = tid->txq;
  7890. +
  7891. + ath_txq_lock(sc, txq);
  7892. +
  7893. +@@ -2936,11 +2891,6 @@ void ath_tx_node_cleanup(struct ath_soft
  7894. + tid->sched = false;
  7895. + }
  7896. +
  7897. +- if (ac->sched) {
  7898. +- list_del(&ac->list);
  7899. +- tid->ac->sched = false;
  7900. +- }
  7901. +-
  7902. + ath_tid_drain(sc, txq, tid);
  7903. + tid->active = false;
  7904. +
  7905. diff --git a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch b/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  7906. deleted file mode 100644
  7907. index 4cfa53f..0000000
  7908. --- a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  7909. +++ /dev/null
  7910. @@ -1,137 +0,0 @@
  7911. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  7912. -Date: Wed, 4 Mar 2015 05:12:10 +0300
  7913. -Subject: [PATCH] ath5k: channel change fix
  7914. -
  7915. -ath5k updates the channel pointer and after that it stops the Rx logic
  7916. -and apply channel to HW. In case of channel switch, such sequence
  7917. -creates a small window when a frame, which is received on the old
  7918. -channel is considered as a frame received on the new one.
  7919. -
  7920. -The most notable consequence of this situation occurs during the switch
  7921. -from 2 GHz band (CCK+OFDM) to the 5GHz band (OFDM-only). Frame received
  7922. -with CCK rate, e.g. beacon received at the 1mbps, causes the following
  7923. -warning:
  7924. -
  7925. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  7926. - invalid hw_rix: 1a
  7927. - [..]
  7928. - Call Trace:
  7929. - [<802656a8>] show_stack+0x48/0x70
  7930. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  7931. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  7932. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  7933. - [<8028ac64>] tasklet_action+0x8c/0xf0
  7934. - [<80075804>] __do_softirq+0x180/0x32c
  7935. - [<80196ce8>] irq_exit+0x54/0x70
  7936. - [<80041848>] ret_from_irq+0x0/0x4
  7937. - [<80182fdc>] ioread32+0x4/0xc
  7938. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  7939. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  7940. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  7941. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  7942. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  7943. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  7944. - [<8022c3f4>] process_one_work+0x28c/0x400
  7945. - [<802df8f8>] worker_thread+0x258/0x3c0
  7946. - [<801b5710>] kthread+0xe0/0xec
  7947. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  7948. -
  7949. -The easiest way to reproduce this warning is to run scan with dualband
  7950. -NIC in noisy environments, when the channel 11 runs multiple APs. In my
  7951. -tests if the APs num >= 12, the warning appears in the first few
  7952. -seconds of scanning.
  7953. -
  7954. -In order to fix this, the Rx disable code moved to a higher level and
  7955. -placed before the channel pointer update. This is also makes the code a
  7956. -bit more symmetrical, since we disable and enable the Rx in the same
  7957. -function.
  7958. -
  7959. -In fact, at the pointer update time new frames should not appear,
  7960. -because interrupt generation at this point should already be disabled.
  7961. -The next patch should address this issue.
  7962. -
  7963. -CC: Jiri Slaby <jirislaby@gmail.com>
  7964. -CC: Nick Kossifidis <mickflemm@gmail.com>
  7965. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  7966. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  7967. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  7968. -Tested-by: Eric Bree <ebree@nltinc.com>
  7969. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  7970. ----
  7971. -
  7972. ---- a/drivers/net/wireless/ath/ath5k/base.c
  7973. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  7974. -@@ -2858,7 +2858,7 @@ ath5k_reset(struct ath5k_hw *ah, struct
  7975. - {
  7976. - struct ath_common *common = ath5k_hw_common(ah);
  7977. - int ret, ani_mode;
  7978. -- bool fast;
  7979. -+ bool fast = chan && modparam_fastchanswitch ? 1 : 0;
  7980. -
  7981. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  7982. -
  7983. -@@ -2876,11 +2876,29 @@ ath5k_reset(struct ath5k_hw *ah, struct
  7984. - * so we should also free any remaining
  7985. - * tx buffers */
  7986. - ath5k_drain_tx_buffs(ah);
  7987. -+
  7988. -+ /* Stop PCU */
  7989. -+ ath5k_hw_stop_rx_pcu(ah);
  7990. -+
  7991. -+ /* Stop DMA
  7992. -+ *
  7993. -+ * Note: If DMA didn't stop continue
  7994. -+ * since only a reset will fix it.
  7995. -+ */
  7996. -+ ret = ath5k_hw_dma_stop(ah);
  7997. -+
  7998. -+ /* RF Bus grant won't work if we have pending
  7999. -+ * frames
  8000. -+ */
  8001. -+ if (ret && fast) {
  8002. -+ ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  8003. -+ "DMA didn't stop, falling back to normal reset\n");
  8004. -+ fast = false;
  8005. -+ }
  8006. -+
  8007. - if (chan)
  8008. - ah->curchan = chan;
  8009. -
  8010. -- fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0;
  8011. --
  8012. - ret = ath5k_hw_reset(ah, ah->opmode, ah->curchan, fast, skip_pcu);
  8013. - if (ret) {
  8014. - ATH5K_ERR(ah, "can't reset hardware (%d)\n", ret);
  8015. ---- a/drivers/net/wireless/ath/ath5k/reset.c
  8016. -+++ b/drivers/net/wireless/ath/ath5k/reset.c
  8017. -@@ -1169,30 +1169,6 @@ ath5k_hw_reset(struct ath5k_hw *ah, enum
  8018. - if (ah->ah_version == AR5K_AR5212)
  8019. - ath5k_hw_set_sleep_clock(ah, false);
  8020. -
  8021. -- /*
  8022. -- * Stop PCU
  8023. -- */
  8024. -- ath5k_hw_stop_rx_pcu(ah);
  8025. --
  8026. -- /*
  8027. -- * Stop DMA
  8028. -- *
  8029. -- * Note: If DMA didn't stop continue
  8030. -- * since only a reset will fix it.
  8031. -- */
  8032. -- ret = ath5k_hw_dma_stop(ah);
  8033. --
  8034. -- /* RF Bus grant won't work if we have pending
  8035. -- * frames */
  8036. -- if (ret && fast) {
  8037. -- ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  8038. -- "DMA didn't stop, falling back to normal reset\n");
  8039. -- fast = false;
  8040. -- /* Non fatal, just continue with
  8041. -- * normal reset */
  8042. -- ret = 0;
  8043. -- }
  8044. --
  8045. - mode = channel->hw_value;
  8046. - switch (mode) {
  8047. - case AR5K_MODE_11A:
  8048. 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
  8049. new file mode 100644
  8050. index 0000000..ec860dc
  8051. --- /dev/null
  8052. +++ b/package/kernel/mac80211/patches/305-ath9k-remove-the-sched-field-in-struct-ath_atx_tid.patch
  8053. @@ -0,0 +1,90 @@
  8054. +From: Felix Fietkau <nbd@openwrt.org>
  8055. +Date: Sat, 4 Apr 2015 18:42:33 +0200
  8056. +Subject: [PATCH] ath9k: remove the sched field in struct ath_atx_tid
  8057. +
  8058. +Use list_empty(&tid->list) instead
  8059. +
  8060. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8061. +---
  8062. +
  8063. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  8064. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  8065. +@@ -245,7 +245,6 @@ struct ath_atx_tid {
  8066. + int baw_tail; /* next unused tx buffer slot */
  8067. +
  8068. + s8 bar_index;
  8069. +- bool sched;
  8070. + bool active;
  8071. + bool clear_ps_filter;
  8072. + };
  8073. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  8074. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  8075. +@@ -113,12 +113,9 @@ static void ath_tx_queue_tid(struct ath_
  8076. + if (!ctx)
  8077. + return;
  8078. +
  8079. +- if (tid->sched)
  8080. +- return;
  8081. +-
  8082. +- tid->sched = true;
  8083. + list = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
  8084. +- list_add_tail(&tid->list, list);
  8085. ++ if (list_empty(&tid->list))
  8086. ++ list_add_tail(&tid->list, list);
  8087. + }
  8088. +
  8089. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  8090. +@@ -1556,15 +1553,14 @@ void ath_tx_aggr_sleep(struct ieee80211_
  8091. +
  8092. + ath_txq_lock(sc, txq);
  8093. +
  8094. +- if (!tid->sched) {
  8095. ++ if (list_empty(&tid->list)) {
  8096. + ath_txq_unlock(sc, txq);
  8097. + continue;
  8098. + }
  8099. +
  8100. + buffered = ath_tid_has_buffered(tid);
  8101. +
  8102. +- tid->sched = false;
  8103. +- list_del(&tid->list);
  8104. ++ list_del_init(&tid->list);
  8105. +
  8106. + ath_txq_unlock(sc, txq);
  8107. +
  8108. +@@ -1944,8 +1940,7 @@ void ath_txq_schedule(struct ath_softc *
  8109. + break;
  8110. +
  8111. + tid = list_first_entry(tid_list, struct ath_atx_tid, list);
  8112. +- list_del(&tid->list);
  8113. +- tid->sched = false;
  8114. ++ list_del_init(&tid->list);
  8115. +
  8116. + if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  8117. + sent = true;
  8118. +@@ -2863,11 +2858,11 @@ void ath_tx_node_init(struct ath_softc *
  8119. + tid->seq_start = tid->seq_next = 0;
  8120. + tid->baw_size = WME_MAX_BA;
  8121. + tid->baw_head = tid->baw_tail = 0;
  8122. +- tid->sched = false;
  8123. + tid->active = false;
  8124. + tid->clear_ps_filter = true;
  8125. + __skb_queue_head_init(&tid->buf_q);
  8126. + __skb_queue_head_init(&tid->retry_q);
  8127. ++ INIT_LIST_HEAD(&tid->list);
  8128. + acno = TID_TO_WME_AC(tidno);
  8129. + tid->txq = sc->tx.txq_map[acno];
  8130. + }
  8131. +@@ -2886,10 +2881,8 @@ void ath_tx_node_cleanup(struct ath_soft
  8132. +
  8133. + ath_txq_lock(sc, txq);
  8134. +
  8135. +- if (tid->sched) {
  8136. +- list_del(&tid->list);
  8137. +- tid->sched = false;
  8138. +- }
  8139. ++ if (!list_empty(&tid->list))
  8140. ++ list_del_init(&tid->list);
  8141. +
  8142. + ath_tid_drain(sc, txq, tid);
  8143. + tid->active = false;
  8144. diff --git a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch b/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  8145. deleted file mode 100644
  8146. index 85a1904..0000000
  8147. --- a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  8148. +++ /dev/null
  8149. @@ -1,96 +0,0 @@
  8150. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8151. -Date: Wed, 4 Mar 2015 05:12:11 +0300
  8152. -Subject: [PATCH] ath5k: fix reset race
  8153. -
  8154. -To prepare for reset ath5k should finish all asynchronous tasks. At
  8155. -first, it disables the interrupt generation, then it waits for the
  8156. -interrupt handler and tasklets completion, and then proceeds to the HW
  8157. -configuration update. But it does not consider that the interrupt
  8158. -handler or tasklet re-enables the interrupt generation. And we fall in a
  8159. -situation when ath5k assumes that interrupts are disabled, but it is
  8160. -not.
  8161. -
  8162. -This can lead to different consequences, such as reception of the frame,
  8163. -when we do not expect it. Under certain circumstances, this can lead to
  8164. -the following warning:
  8165. -
  8166. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  8167. - invalid hw_rix: 1a
  8168. - [..]
  8169. - Call Trace:
  8170. - [<802656a8>] show_stack+0x48/0x70
  8171. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  8172. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  8173. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  8174. - [<8028ac64>] tasklet_action+0x8c/0xf0
  8175. - [<80075804>] __do_softirq+0x180/0x32c
  8176. - [<80196ce8>] irq_exit+0x54/0x70
  8177. - [<80041848>] ret_from_irq+0x0/0x4
  8178. - [<80182fdc>] ioread32+0x4/0xc
  8179. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  8180. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  8181. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  8182. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  8183. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  8184. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  8185. - [<8022c3f4>] process_one_work+0x28c/0x400
  8186. - [<802df8f8>] worker_thread+0x258/0x3c0
  8187. - [<801b5710>] kthread+0xe0/0xec
  8188. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  8189. -
  8190. -Fix this issue by adding a new status flag, which forbids to re-enable
  8191. -the interrupt generation until the HW configuration is completed.
  8192. -
  8193. -Note: previous patch, which reorders the Rx disable code helps to avoid
  8194. -the above warning, but not fixes the root cause of unexpected frame
  8195. -receiving.
  8196. -
  8197. -CC: Jiri Slaby <jirislaby@gmail.com>
  8198. -CC: Nick Kossifidis <mickflemm@gmail.com>
  8199. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  8200. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8201. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8202. -Tested-by: Eric Bree <ebree@nltinc.com>
  8203. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8204. ----
  8205. -
  8206. ---- a/drivers/net/wireless/ath/ath5k/ath5k.h
  8207. -+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  8208. -@@ -1283,6 +1283,7 @@ struct ath5k_hw {
  8209. - #define ATH_STAT_PROMISC 1
  8210. - #define ATH_STAT_LEDSOFT 2 /* enable LED gpio status */
  8211. - #define ATH_STAT_STARTED 3 /* opened & irqs enabled */
  8212. -+#define ATH_STAT_RESET 4 /* hw reset */
  8213. -
  8214. - unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
  8215. - unsigned int fif_filter_flags; /* Current FIF_* filter flags */
  8216. ---- a/drivers/net/wireless/ath/ath5k/base.c
  8217. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  8218. -@@ -1523,6 +1523,9 @@ ath5k_set_current_imask(struct ath5k_hw
  8219. - enum ath5k_int imask;
  8220. - unsigned long flags;
  8221. -
  8222. -+ if (test_bit(ATH_STAT_RESET, ah->status))
  8223. -+ return;
  8224. -+
  8225. - spin_lock_irqsave(&ah->irqlock, flags);
  8226. - imask = ah->imask;
  8227. - if (ah->rx_pending)
  8228. -@@ -2862,6 +2865,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8229. -
  8230. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  8231. -
  8232. -+ __set_bit(ATH_STAT_RESET, ah->status);
  8233. -+
  8234. - ath5k_hw_set_imr(ah, 0);
  8235. - synchronize_irq(ah->irq);
  8236. - ath5k_stop_tasklets(ah);
  8237. -@@ -2952,6 +2957,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8238. - */
  8239. - /* ath5k_chan_change(ah, c); */
  8240. -
  8241. -+ __clear_bit(ATH_STAT_RESET, ah->status);
  8242. -+
  8243. - ath5k_beacon_config(ah);
  8244. - /* intrs are enabled by ath5k_beacon_config */
  8245. -
  8246. 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
  8247. new file mode 100644
  8248. index 0000000..928c93b
  8249. --- /dev/null
  8250. +++ b/package/kernel/mac80211/patches/306-mac80211-Deinline-rate_control_rate_init-rate_contro.patch
  8251. @@ -0,0 +1,161 @@
  8252. +From: Denys Vlasenko <dvlasenk@redhat.com>
  8253. +Date: Wed, 15 Jul 2015 14:56:06 +0200
  8254. +Subject: [PATCH] mac80211: Deinline rate_control_rate_init,
  8255. + rate_control_rate_update
  8256. +
  8257. +With this .config: http://busybox.net/~vda/kernel_config,
  8258. +after deinlining these functions have sizes and callsite counts
  8259. +as follows:
  8260. +
  8261. +rate_control_rate_init: 554 bytes, 8 calls
  8262. +rate_control_rate_update: 1596 bytes, 5 calls
  8263. +
  8264. +Total size reduction: about 11 kbytes.
  8265. +
  8266. +Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
  8267. +CC: John Linville <linville@tuxdriver.com>
  8268. +CC: Michal Kazior <michal.kazior@tieto.com>
  8269. +CC: Johannes Berg <johannes.berg@intel.com>
  8270. +Cc: linux-wireless@vger.kernel.org
  8271. +Cc: netdev@vger.kernel.org
  8272. +CC: linux-kernel@vger.kernel.org
  8273. +---
  8274. +
  8275. +--- a/net/mac80211/rate.c
  8276. ++++ b/net/mac80211/rate.c
  8277. +@@ -29,6 +29,65 @@ module_param(ieee80211_default_rc_algo,
  8278. + MODULE_PARM_DESC(ieee80211_default_rc_algo,
  8279. + "Default rate control algorithm for mac80211 to use");
  8280. +
  8281. ++void rate_control_rate_init(struct sta_info *sta)
  8282. ++{
  8283. ++ struct ieee80211_local *local = sta->sdata->local;
  8284. ++ struct rate_control_ref *ref = sta->rate_ctrl;
  8285. ++ struct ieee80211_sta *ista = &sta->sta;
  8286. ++ void *priv_sta = sta->rate_ctrl_priv;
  8287. ++ struct ieee80211_supported_band *sband;
  8288. ++ struct ieee80211_chanctx_conf *chanctx_conf;
  8289. ++
  8290. ++ ieee80211_sta_set_rx_nss(sta);
  8291. ++
  8292. ++ if (!ref)
  8293. ++ return;
  8294. ++
  8295. ++ rcu_read_lock();
  8296. ++
  8297. ++ chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8298. ++ if (WARN_ON(!chanctx_conf)) {
  8299. ++ rcu_read_unlock();
  8300. ++ return;
  8301. ++ }
  8302. ++
  8303. ++ sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  8304. ++
  8305. ++ spin_lock_bh(&sta->rate_ctrl_lock);
  8306. ++ ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  8307. ++ priv_sta);
  8308. ++ spin_unlock_bh(&sta->rate_ctrl_lock);
  8309. ++ rcu_read_unlock();
  8310. ++ set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  8311. ++}
  8312. ++
  8313. ++void rate_control_rate_update(struct ieee80211_local *local,
  8314. ++ struct ieee80211_supported_band *sband,
  8315. ++ struct sta_info *sta, u32 changed)
  8316. ++{
  8317. ++ struct rate_control_ref *ref = local->rate_ctrl;
  8318. ++ struct ieee80211_sta *ista = &sta->sta;
  8319. ++ void *priv_sta = sta->rate_ctrl_priv;
  8320. ++ struct ieee80211_chanctx_conf *chanctx_conf;
  8321. ++
  8322. ++ if (ref && ref->ops->rate_update) {
  8323. ++ rcu_read_lock();
  8324. ++
  8325. ++ chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8326. ++ if (WARN_ON(!chanctx_conf)) {
  8327. ++ rcu_read_unlock();
  8328. ++ return;
  8329. ++ }
  8330. ++
  8331. ++ spin_lock_bh(&sta->rate_ctrl_lock);
  8332. ++ ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  8333. ++ ista, priv_sta, changed);
  8334. ++ spin_unlock_bh(&sta->rate_ctrl_lock);
  8335. ++ rcu_read_unlock();
  8336. ++ }
  8337. ++ drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  8338. ++}
  8339. ++
  8340. + int ieee80211_rate_control_register(const struct rate_control_ops *ops)
  8341. + {
  8342. + struct rate_control_alg *alg;
  8343. +--- a/net/mac80211/rate.h
  8344. ++++ b/net/mac80211/rate.h
  8345. +@@ -71,64 +71,10 @@ rate_control_tx_status_noskb(struct ieee
  8346. + spin_unlock_bh(&sta->rate_ctrl_lock);
  8347. + }
  8348. +
  8349. +-static inline void rate_control_rate_init(struct sta_info *sta)
  8350. +-{
  8351. +- struct ieee80211_local *local = sta->sdata->local;
  8352. +- struct rate_control_ref *ref = sta->rate_ctrl;
  8353. +- struct ieee80211_sta *ista = &sta->sta;
  8354. +- void *priv_sta = sta->rate_ctrl_priv;
  8355. +- struct ieee80211_supported_band *sband;
  8356. +- struct ieee80211_chanctx_conf *chanctx_conf;
  8357. +-
  8358. +- ieee80211_sta_set_rx_nss(sta);
  8359. +-
  8360. +- if (!ref)
  8361. +- return;
  8362. +-
  8363. +- rcu_read_lock();
  8364. +-
  8365. +- chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8366. +- if (WARN_ON(!chanctx_conf)) {
  8367. +- rcu_read_unlock();
  8368. +- return;
  8369. +- }
  8370. +-
  8371. +- sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  8372. +-
  8373. +- spin_lock_bh(&sta->rate_ctrl_lock);
  8374. +- ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  8375. +- priv_sta);
  8376. +- spin_unlock_bh(&sta->rate_ctrl_lock);
  8377. +- rcu_read_unlock();
  8378. +- set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  8379. +-}
  8380. +-
  8381. +-static inline void rate_control_rate_update(struct ieee80211_local *local,
  8382. ++void rate_control_rate_init(struct sta_info *sta);
  8383. ++void rate_control_rate_update(struct ieee80211_local *local,
  8384. + struct ieee80211_supported_band *sband,
  8385. +- struct sta_info *sta, u32 changed)
  8386. +-{
  8387. +- struct rate_control_ref *ref = local->rate_ctrl;
  8388. +- struct ieee80211_sta *ista = &sta->sta;
  8389. +- void *priv_sta = sta->rate_ctrl_priv;
  8390. +- struct ieee80211_chanctx_conf *chanctx_conf;
  8391. +-
  8392. +- if (ref && ref->ops->rate_update) {
  8393. +- rcu_read_lock();
  8394. +-
  8395. +- chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8396. +- if (WARN_ON(!chanctx_conf)) {
  8397. +- rcu_read_unlock();
  8398. +- return;
  8399. +- }
  8400. +-
  8401. +- spin_lock_bh(&sta->rate_ctrl_lock);
  8402. +- ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  8403. +- ista, priv_sta, changed);
  8404. +- spin_unlock_bh(&sta->rate_ctrl_lock);
  8405. +- rcu_read_unlock();
  8406. +- }
  8407. +- drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  8408. +-}
  8409. ++ struct sta_info *sta, u32 changed);
  8410. +
  8411. + static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  8412. + struct sta_info *sta, gfp_t gfp)
  8413. 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
  8414. deleted file mode 100644
  8415. index ab9771e..0000000
  8416. --- a/package/kernel/mac80211/patches/307-ath9k-fix-tracking-of-enabled-AP-beacons.patch
  8417. +++ /dev/null
  8418. @@ -1,76 +0,0 @@
  8419. -From: Felix Fietkau <nbd@openwrt.org>
  8420. -Date: Thu, 12 Mar 2015 17:10:50 +0100
  8421. -Subject: [PATCH] ath9k: fix tracking of enabled AP beacons
  8422. -
  8423. -sc->nbcnvifs tracks assigned beacon slots, not enabled beacons.
  8424. -Therefore, it cannot be used to decide if cur_conf->enable_beacon (bool)
  8425. -should be updated, or if beacons have been enabled already.
  8426. -With the current code (depending on the order of calls), beacons often
  8427. -do not get enabled in an AP+STA setup.
  8428. -To fix tracking of enabled beacons, convert cur_conf->enable_beacon to a
  8429. -bitmask of enabled beacon slots.
  8430. -
  8431. -Cc: stable@vger.kernel.org
  8432. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8433. ----
  8434. -
  8435. ---- a/drivers/net/wireless/ath/ath9k/beacon.c
  8436. -+++ b/drivers/net/wireless/ath/ath9k/beacon.c
  8437. -@@ -219,12 +219,15 @@ void ath9k_beacon_remove_slot(struct ath
  8438. - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  8439. - struct ath_vif *avp = (void *)vif->drv_priv;
  8440. - struct ath_buf *bf = avp->av_bcbuf;
  8441. -+ struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  8442. -
  8443. - ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  8444. - avp->av_bslot);
  8445. -
  8446. - tasklet_disable(&sc->bcon_tasklet);
  8447. -
  8448. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  8449. -+
  8450. - if (bf && bf->bf_mpdu) {
  8451. - struct sk_buff *skb = bf->bf_mpdu;
  8452. - dma_unmap_single(sc->dev, bf->bf_buf_addr,
  8453. -@@ -521,8 +524,7 @@ static bool ath9k_allow_beacon_config(st
  8454. - }
  8455. -
  8456. - if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  8457. -- if ((vif->type != NL80211_IFTYPE_AP) ||
  8458. -- (sc->nbcnvifs > 1)) {
  8459. -+ if (vif->type != NL80211_IFTYPE_AP) {
  8460. - ath_dbg(common, CONFIG,
  8461. - "An AP interface is already present !\n");
  8462. - return false;
  8463. -@@ -616,12 +618,14 @@ void ath9k_beacon_config(struct ath_soft
  8464. - * enabling/disabling SWBA.
  8465. - */
  8466. - if (changed & BSS_CHANGED_BEACON_ENABLED) {
  8467. -- if (!bss_conf->enable_beacon &&
  8468. -- (sc->nbcnvifs <= 1)) {
  8469. -- cur_conf->enable_beacon = false;
  8470. -- } else if (bss_conf->enable_beacon) {
  8471. -- cur_conf->enable_beacon = true;
  8472. -- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  8473. -+ bool enabled = cur_conf->enable_beacon;
  8474. -+
  8475. -+ if (!bss_conf->enable_beacon) {
  8476. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  8477. -+ } else {
  8478. -+ cur_conf->enable_beacon |= BIT(avp->av_bslot);
  8479. -+ if (!enabled)
  8480. -+ ath9k_cache_beacon_config(sc, ctx, bss_conf);
  8481. - }
  8482. - }
  8483. -
  8484. ---- a/drivers/net/wireless/ath/ath9k/common.h
  8485. -+++ b/drivers/net/wireless/ath/ath9k/common.h
  8486. -@@ -54,7 +54,7 @@ struct ath_beacon_config {
  8487. - u16 dtim_period;
  8488. - u16 bmiss_timeout;
  8489. - u8 dtim_count;
  8490. -- bool enable_beacon;
  8491. -+ u8 enable_beacon;
  8492. - bool ibss_creator;
  8493. - u32 nexttbtt;
  8494. - u32 intval;
  8495. 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
  8496. new file mode 100644
  8497. index 0000000..474c409
  8498. --- /dev/null
  8499. +++ b/package/kernel/mac80211/patches/307-mac80211-Deinline-drv_sta_state.patch
  8500. @@ -0,0 +1,116 @@
  8501. +From: Denys Vlasenko <dvlasenk@redhat.com>
  8502. +Date: Wed, 15 Jul 2015 14:56:05 +0200
  8503. +Subject: [PATCH] mac80211: Deinline drv_sta_state
  8504. +
  8505. +With this .config: http://busybox.net/~vda/kernel_config,
  8506. +after deinlining the function size is 3132 bytes and there are
  8507. +7 callsites.
  8508. +
  8509. +Total size reduction: about 20 kbytes.
  8510. +
  8511. +Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
  8512. +CC: John Linville <linville@tuxdriver.com>
  8513. +CC: Michal Kazior <michal.kazior@tieto.com>
  8514. +Cc: Johannes Berg <johannes.berg@intel.com>
  8515. +Cc: linux-wireless@vger.kernel.org
  8516. +Cc: netdev@vger.kernel.org
  8517. +CC: linux-kernel@vger.kernel.org
  8518. +---
  8519. + create mode 100644 net/mac80211/driver-ops.c
  8520. +
  8521. +--- a/net/mac80211/Makefile
  8522. ++++ b/net/mac80211/Makefile
  8523. +@@ -3,6 +3,7 @@ obj-$(CPTCFG_MAC80211) += mac80211.o
  8524. + # mac80211 objects
  8525. + mac80211-y := \
  8526. + main.o status.o \
  8527. ++ driver-ops.o \
  8528. + sta_info.o \
  8529. + wep.o \
  8530. + wpa.o \
  8531. +--- /dev/null
  8532. ++++ b/net/mac80211/driver-ops.c
  8533. +@@ -0,0 +1,41 @@
  8534. ++/*
  8535. ++ * This program is free software; you can redistribute it and/or modify
  8536. ++ * it under the terms of the GNU General Public License version 2 as
  8537. ++ * published by the Free Software Foundation.
  8538. ++ */
  8539. ++#include <net/mac80211.h>
  8540. ++#include "ieee80211_i.h"
  8541. ++#include "trace.h"
  8542. ++#include "driver-ops.h"
  8543. ++
  8544. ++__must_check
  8545. ++int drv_sta_state(struct ieee80211_local *local,
  8546. ++ struct ieee80211_sub_if_data *sdata,
  8547. ++ struct sta_info *sta,
  8548. ++ enum ieee80211_sta_state old_state,
  8549. ++ enum ieee80211_sta_state new_state)
  8550. ++{
  8551. ++ int ret = 0;
  8552. ++
  8553. ++ might_sleep();
  8554. ++
  8555. ++ sdata = get_bss_sdata(sdata);
  8556. ++ if (!check_sdata_in_driver(sdata))
  8557. ++ return -EIO;
  8558. ++
  8559. ++ trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  8560. ++ if (local->ops->sta_state) {
  8561. ++ ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  8562. ++ old_state, new_state);
  8563. ++ } else if (old_state == IEEE80211_STA_AUTH &&
  8564. ++ new_state == IEEE80211_STA_ASSOC) {
  8565. ++ ret = drv_sta_add(local, sdata, &sta->sta);
  8566. ++ if (ret == 0)
  8567. ++ sta->uploaded = true;
  8568. ++ } else if (old_state == IEEE80211_STA_ASSOC &&
  8569. ++ new_state == IEEE80211_STA_AUTH) {
  8570. ++ drv_sta_remove(local, sdata, &sta->sta);
  8571. ++ }
  8572. ++ trace_drv_return_int(local, ret);
  8573. ++ return ret;
  8574. ++}
  8575. +--- a/net/mac80211/driver-ops.h
  8576. ++++ b/net/mac80211/driver-ops.h
  8577. +@@ -573,37 +573,12 @@ static inline void drv_sta_pre_rcu_remov
  8578. + trace_drv_return_void(local);
  8579. + }
  8580. +
  8581. +-static inline __must_check
  8582. ++__must_check
  8583. + int drv_sta_state(struct ieee80211_local *local,
  8584. + struct ieee80211_sub_if_data *sdata,
  8585. + struct sta_info *sta,
  8586. + enum ieee80211_sta_state old_state,
  8587. +- enum ieee80211_sta_state new_state)
  8588. +-{
  8589. +- int ret = 0;
  8590. +-
  8591. +- might_sleep();
  8592. +-
  8593. +- sdata = get_bss_sdata(sdata);
  8594. +- if (!check_sdata_in_driver(sdata))
  8595. +- return -EIO;
  8596. +-
  8597. +- trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  8598. +- if (local->ops->sta_state) {
  8599. +- ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  8600. +- old_state, new_state);
  8601. +- } else if (old_state == IEEE80211_STA_AUTH &&
  8602. +- new_state == IEEE80211_STA_ASSOC) {
  8603. +- ret = drv_sta_add(local, sdata, &sta->sta);
  8604. +- if (ret == 0)
  8605. +- sta->uploaded = true;
  8606. +- } else if (old_state == IEEE80211_STA_ASSOC &&
  8607. +- new_state == IEEE80211_STA_AUTH) {
  8608. +- drv_sta_remove(local, sdata, &sta->sta);
  8609. +- }
  8610. +- trace_drv_return_int(local, ret);
  8611. +- return ret;
  8612. +-}
  8613. ++ enum ieee80211_sta_state new_state);
  8614. +
  8615. + static inline void drv_sta_rc_update(struct ieee80211_local *local,
  8616. + struct ieee80211_sub_if_data *sdata,
  8617. 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
  8618. new file mode 100644
  8619. index 0000000..1a3a9d4
  8620. --- /dev/null
  8621. +++ b/package/kernel/mac80211/patches/308-ath9k-Fix-NF-CCA-limits-for-AR9287-and-AR9227.patch
  8622. @@ -0,0 +1,30 @@
  8623. +From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  8624. +Date: Wed, 22 Jul 2015 10:42:43 +0200
  8625. +Subject: [PATCH] ath9k: Fix NF CCA limits for AR9287 and AR9227
  8626. +
  8627. +The FreeBSD driver [0] uses the same 2G values as for the AR9280 chips.
  8628. +Using the same values in ath9k results in much better throughput for me.
  8629. +
  8630. +Before this patch I had a huge amount of packet loss (sometimes up to
  8631. +40%) and the max transfer speed was somewhere around 5Mbit/s. With this
  8632. +patch applied I have zero packet loss and ten times the throughput.
  8633. +My device uses a AR9227 which is the PCI variant of the AR9287.
  8634. +
  8635. +[0] http://bxr.su/FreeBSD/sys/dev/ath/ath_hal/ar9002/ar9287.h
  8636. +
  8637. +Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  8638. +---
  8639. +
  8640. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  8641. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  8642. +@@ -610,8 +610,8 @@
  8643. + #define AR_PHY_CCA_MIN_GOOD_VAL_9271_2GHZ -127
  8644. + #define AR_PHY_CCA_MAX_GOOD_VAL_9271_2GHZ -116
  8645. +
  8646. +-#define AR_PHY_CCA_NOM_VAL_9287_2GHZ -120
  8647. ++#define AR_PHY_CCA_NOM_VAL_9287_2GHZ -112
  8648. + #define AR_PHY_CCA_MIN_GOOD_VAL_9287_2GHZ -127
  8649. +-#define AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ -110
  8650. ++#define AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ -97
  8651. +
  8652. + #endif
  8653. 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
  8654. deleted file mode 100644
  8655. index d132636..0000000
  8656. --- a/package/kernel/mac80211/patches/308-mac80211-minstrel_ht-fix-rounding-issue-in-MCS-durat.patch
  8657. +++ /dev/null
  8658. @@ -1,43 +0,0 @@
  8659. -From: Felix Fietkau <nbd@openwrt.org>
  8660. -Date: Fri, 13 Mar 2015 10:49:40 +0100
  8661. -Subject: [PATCH] mac80211: minstrel_ht: fix rounding issue in MCS duration
  8662. - calculation
  8663. -
  8664. -On very high MCS bitrates, the calculated duration of rates that are
  8665. -next to each other can be very imprecise, due to the small packet size
  8666. -used as reference (1200 bytes).
  8667. -This is most visible in VHT80 nss=2 MCS8/9, for which minstrel shows the
  8668. -same throughput when the probability is also the same. This leads to a
  8669. -bad rate selection for such rates.
  8670. -
  8671. -Fix this issue by introducing an average A-MPDU size factor into the
  8672. -calculation.
  8673. -
  8674. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8675. ----
  8676. -
  8677. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8678. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8679. -@@ -17,10 +17,11 @@
  8680. - #include "rc80211_minstrel.h"
  8681. - #include "rc80211_minstrel_ht.h"
  8682. -
  8683. -+#define AVG_AMPDU_SIZE 16
  8684. - #define AVG_PKT_SIZE 1200
  8685. -
  8686. - /* Number of bits for an average sized packet */
  8687. --#define MCS_NBITS (AVG_PKT_SIZE << 3)
  8688. -+#define MCS_NBITS ((AVG_PKT_SIZE * AVG_AMPDU_SIZE) << 3)
  8689. -
  8690. - /* Number of symbols for a packet with (bps) bits per symbol */
  8691. - #define MCS_NSYMS(bps) DIV_ROUND_UP(MCS_NBITS, (bps))
  8692. -@@ -33,7 +34,8 @@
  8693. - )
  8694. -
  8695. - /* Transmit duration for the raw data part of an average sized packet */
  8696. --#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
  8697. -+#define MCS_DURATION(streams, sgi, bps) \
  8698. -+ (MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) / AVG_AMPDU_SIZE)
  8699. -
  8700. - #define BW_20 0
  8701. - #define BW_40 1
  8702. 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
  8703. deleted file mode 100644
  8704. index 945fbce..0000000
  8705. --- a/package/kernel/mac80211/patches/309-ath9k-disable-TPC-support-again-for-now.patch
  8706. +++ /dev/null
  8707. @@ -1,22 +0,0 @@
  8708. -From: Felix Fietkau <nbd@openwrt.org>
  8709. -Date: Sun, 15 Mar 2015 08:02:37 +0100
  8710. -Subject: [PATCH] ath9k: disable TPC support again (for now)
  8711. -
  8712. -TPC support has been observed to cause some tx power fluctuations on
  8713. -some devices with at least AR934x and AR938x chips.
  8714. -Disable it for now until the bugs have been found and fixed
  8715. -
  8716. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8717. ----
  8718. -
  8719. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  8720. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  8721. -@@ -424,7 +424,7 @@ static void ath9k_hw_init_defaults(struc
  8722. - ah->power_mode = ATH9K_PM_UNDEFINED;
  8723. - ah->htc_reset_init = true;
  8724. -
  8725. -- ah->tpc_enabled = true;
  8726. -+ ah->tpc_enabled = false;
  8727. -
  8728. - ah->ani_function = ATH9K_ANI_ALL;
  8729. - if (!AR_SREV_9300_20_OR_LATER(ah))
  8730. 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
  8731. new file mode 100644
  8732. index 0000000..e8e9617
  8733. --- /dev/null
  8734. +++ b/package/kernel/mac80211/patches/309-mac80211-make-local-tx_headroom-a-multiple-of-4.patch
  8735. @@ -0,0 +1,20 @@
  8736. +From: Felix Fietkau <nbd@openwrt.org>
  8737. +Date: Thu, 30 Jul 2015 14:12:25 +0200
  8738. +Subject: [PATCH] mac80211: make local->tx_headroom a multiple of 4
  8739. +
  8740. +This ensures that mac80211 generated management frames and beacons are
  8741. +aligned before being passed to the driver
  8742. +
  8743. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8744. +---
  8745. +
  8746. +--- a/net/mac80211/main.c
  8747. ++++ b/net/mac80211/main.c
  8748. +@@ -1031,6 +1031,7 @@ int ieee80211_register_hw(struct ieee802
  8749. + */
  8750. + local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
  8751. + IEEE80211_TX_STATUS_HEADROOM);
  8752. ++ local->tx_headroom = ALIGN(local->tx_headroom, 4);
  8753. +
  8754. + debugfs_hw_add(local);
  8755. +
  8756. 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
  8757. deleted file mode 100644
  8758. index bd3050e..0000000
  8759. --- a/package/kernel/mac80211/patches/310-mac80211-don-t-look-up-stations-for-multicast-addres.patch
  8760. +++ /dev/null
  8761. @@ -1,21 +0,0 @@
  8762. -From: Johannes Berg <johannes.berg@intel.com>
  8763. -Date: Tue, 24 Feb 2015 00:28:18 +0100
  8764. -Subject: [PATCH] mac80211: don't look up stations for multicast addresses
  8765. -
  8766. -Since multicast addresses don't exist as stations, don't attempt
  8767. -to look them up in the hashtable on TX.
  8768. -
  8769. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8770. ----
  8771. -
  8772. ---- a/net/mac80211/tx.c
  8773. -+++ b/net/mac80211/tx.c
  8774. -@@ -1161,7 +1161,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  8775. - tx->sdata->control_port_protocol == tx->skb->protocol) {
  8776. - tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  8777. - }
  8778. -- if (!tx->sta)
  8779. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  8780. - tx->sta = sta_info_get(sdata, hdr->addr1);
  8781. -
  8782. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  8783. 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
  8784. new file mode 100644
  8785. index 0000000..51a315c
  8786. --- /dev/null
  8787. +++ b/package/kernel/mac80211/patches/310-mac80211-fix-invalid-read-in-minstrel_sort_best_tp_r.patch
  8788. @@ -0,0 +1,34 @@
  8789. +From: Adrien Schildknecht <adrien+dev@schischi.me>
  8790. +Date: Tue, 28 Jul 2015 10:30:16 +0200
  8791. +Subject: [PATCH] mac80211: fix invalid read in minstrel_sort_best_tp_rates()
  8792. +
  8793. +At the last iteration of the loop, j may equal zero and thus
  8794. +tp_list[j - 1] causes an invalid read.
  8795. +Changed the logic of the loop so that j - 1 is always >= 0.
  8796. +
  8797. +Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
  8798. +---
  8799. +
  8800. +--- a/net/mac80211/rc80211_minstrel.c
  8801. ++++ b/net/mac80211/rc80211_minstrel.c
  8802. +@@ -92,14 +92,15 @@ int minstrel_get_tp_avg(struct minstrel_
  8803. + static inline void
  8804. + minstrel_sort_best_tp_rates(struct minstrel_sta_info *mi, int i, u8 *tp_list)
  8805. + {
  8806. +- int j = MAX_THR_RATES;
  8807. +- struct minstrel_rate_stats *tmp_mrs = &mi->r[j - 1].stats;
  8808. ++ int j;
  8809. ++ struct minstrel_rate_stats *tmp_mrs;
  8810. + struct minstrel_rate_stats *cur_mrs = &mi->r[i].stats;
  8811. +
  8812. +- while (j > 0 && (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) >
  8813. +- minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))) {
  8814. +- j--;
  8815. ++ for (j = MAX_THR_RATES; j > 0; --j) {
  8816. + tmp_mrs = &mi->r[tp_list[j - 1]].stats;
  8817. ++ if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) <=
  8818. ++ minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))
  8819. ++ break;
  8820. + }
  8821. +
  8822. + if (j < MAX_THR_RATES - 1)
  8823. 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
  8824. new file mode 100644
  8825. index 0000000..e44f121
  8826. --- /dev/null
  8827. +++ b/package/kernel/mac80211/patches/311-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  8828. @@ -0,0 +1,45 @@
  8829. +From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
  8830. +Date: Thu, 9 Jul 2015 13:43:18 +0530
  8831. +Subject: [PATCH] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
  8832. +
  8833. +There's already a generic implementation so use that instead.
  8834. +
  8835. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  8836. +---
  8837. +
  8838. +--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  8839. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  8840. +@@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(st
  8841. + }
  8842. + }
  8843. +
  8844. +-static void atomic_orr(int val, atomic_t *v)
  8845. +-{
  8846. +- int old_val;
  8847. +-
  8848. +- old_val = atomic_read(v);
  8849. +- while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
  8850. +- old_val = atomic_read(v);
  8851. +-}
  8852. +-
  8853. + static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
  8854. + {
  8855. + struct brcmf_core *buscore;
  8856. +@@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struc
  8857. + if (val) {
  8858. + brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
  8859. + bus->sdcnt.f1regdata++;
  8860. +- atomic_orr(val, &bus->intstatus);
  8861. ++ atomic_or(val, &bus->intstatus);
  8862. + }
  8863. +
  8864. + return ret;
  8865. +@@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  8866. +
  8867. + /* Keep still-pending events for next scheduling */
  8868. + if (intstatus)
  8869. +- atomic_orr(intstatus, &bus->intstatus);
  8870. ++ atomic_or(intstatus, &bus->intstatus);
  8871. +
  8872. + brcmf_sdio_clrintr(bus);
  8873. +
  8874. 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
  8875. deleted file mode 100644
  8876. index b2475b9..0000000
  8877. --- a/package/kernel/mac80211/patches/311-mac80211-remove-drop_unencrypted-code.patch
  8878. +++ /dev/null
  8879. @@ -1,130 +0,0 @@
  8880. -From: Johannes Berg <johannes.berg@intel.com>
  8881. -Date: Fri, 20 Mar 2015 11:41:58 +0100
  8882. -Subject: [PATCH] mac80211: remove drop_unencrypted code
  8883. -
  8884. -This mechanism was historic, and only ever used by IBSS, which
  8885. -also doesn't need to have it as it properly manages station's
  8886. -802.1X PAE state (or, with WEP, always has a key.)
  8887. -
  8888. -Remove the mechanism to clean up the code.
  8889. -
  8890. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8891. ----
  8892. -
  8893. ---- a/net/mac80211/debugfs.c
  8894. -+++ b/net/mac80211/debugfs.c
  8895. -@@ -274,8 +274,6 @@ void debugfs_hw_add(struct ieee80211_loc
  8896. - #ifdef CPTCFG_MAC80211_DEBUG_COUNTERS
  8897. - DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
  8898. - DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
  8899. -- DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
  8900. -- local->tx_handlers_drop_unencrypted);
  8901. - DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
  8902. - local->tx_handlers_drop_fragment);
  8903. - DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
  8904. ---- a/net/mac80211/debugfs_netdev.c
  8905. -+++ b/net/mac80211/debugfs_netdev.c
  8906. -@@ -177,7 +177,6 @@ static ssize_t ieee80211_if_write_##name
  8907. - IEEE80211_IF_FILE_R(name)
  8908. -
  8909. - /* common attributes */
  8910. --IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
  8911. - IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
  8912. - HEX);
  8913. - IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
  8914. -@@ -562,7 +561,6 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDu
  8915. -
  8916. - static void add_common_files(struct ieee80211_sub_if_data *sdata)
  8917. - {
  8918. -- DEBUGFS_ADD(drop_unencrypted);
  8919. - DEBUGFS_ADD(rc_rateidx_mask_2ghz);
  8920. - DEBUGFS_ADD(rc_rateidx_mask_5ghz);
  8921. - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
  8922. ---- a/net/mac80211/ibss.c
  8923. -+++ b/net/mac80211/ibss.c
  8924. -@@ -249,8 +249,6 @@ static void __ieee80211_sta_join_ibss(st
  8925. - if (presp)
  8926. - kfree_rcu(presp, rcu_head);
  8927. -
  8928. -- sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
  8929. --
  8930. - /* make a copy of the chandef, it could be modified below. */
  8931. - chandef = *req_chandef;
  8932. - chan = chandef.chan;
  8933. -@@ -1289,8 +1287,6 @@ static void ieee80211_sta_create_ibss(st
  8934. -
  8935. - if (ifibss->privacy)
  8936. - capability |= WLAN_CAPABILITY_PRIVACY;
  8937. -- else
  8938. -- sdata->drop_unencrypted = 0;
  8939. -
  8940. - __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
  8941. - &ifibss->chandef, ifibss->basic_rates,
  8942. ---- a/net/mac80211/ieee80211_i.h
  8943. -+++ b/net/mac80211/ieee80211_i.h
  8944. -@@ -842,8 +842,6 @@ struct ieee80211_sub_if_data {
  8945. -
  8946. - unsigned long state;
  8947. -
  8948. -- int drop_unencrypted;
  8949. --
  8950. - char name[IFNAMSIZ];
  8951. -
  8952. - /* Fragment table for host-based reassembly */
  8953. -@@ -1289,7 +1287,6 @@ struct ieee80211_local {
  8954. - /* TX/RX handler statistics */
  8955. - unsigned int tx_handlers_drop;
  8956. - unsigned int tx_handlers_queued;
  8957. -- unsigned int tx_handlers_drop_unencrypted;
  8958. - unsigned int tx_handlers_drop_fragment;
  8959. - unsigned int tx_handlers_drop_wep;
  8960. - unsigned int tx_handlers_drop_not_assoc;
  8961. ---- a/net/mac80211/iface.c
  8962. -+++ b/net/mac80211/iface.c
  8963. -@@ -1535,7 +1535,6 @@ int ieee80211_if_change_type(struct ieee
  8964. - }
  8965. -
  8966. - /* reset some values that shouldn't be kept across type changes */
  8967. -- sdata->drop_unencrypted = 0;
  8968. - if (type == NL80211_IFTYPE_STATION)
  8969. - sdata->u.mgd.use_4addr = false;
  8970. -
  8971. ---- a/net/mac80211/rx.c
  8972. -+++ b/net/mac80211/rx.c
  8973. -@@ -1897,8 +1897,7 @@ static int ieee80211_drop_unencrypted(st
  8974. - /* Drop unencrypted frames if key is set. */
  8975. - if (unlikely(!ieee80211_has_protected(fc) &&
  8976. - !ieee80211_is_nullfunc(fc) &&
  8977. -- ieee80211_is_data(fc) &&
  8978. -- (rx->key || rx->sdata->drop_unencrypted)))
  8979. -+ ieee80211_is_data(fc) && rx->key))
  8980. - return -EACCES;
  8981. -
  8982. - return 0;
  8983. ---- a/net/mac80211/tx.c
  8984. -+++ b/net/mac80211/tx.c
  8985. -@@ -594,23 +594,8 @@ ieee80211_tx_h_select_key(struct ieee802
  8986. - else if (!is_multicast_ether_addr(hdr->addr1) &&
  8987. - (key = rcu_dereference(tx->sdata->default_unicast_key)))
  8988. - tx->key = key;
  8989. -- else if (info->flags & IEEE80211_TX_CTL_INJECTED)
  8990. -+ else
  8991. - tx->key = NULL;
  8992. -- else if (!tx->sdata->drop_unencrypted)
  8993. -- tx->key = NULL;
  8994. -- else if (tx->skb->protocol == tx->sdata->control_port_protocol)
  8995. -- tx->key = NULL;
  8996. -- else if (ieee80211_is_robust_mgmt_frame(tx->skb) &&
  8997. -- !(ieee80211_is_action(hdr->frame_control) &&
  8998. -- tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))
  8999. -- tx->key = NULL;
  9000. -- else if (ieee80211_is_mgmt(hdr->frame_control) &&
  9001. -- !ieee80211_is_robust_mgmt_frame(tx->skb))
  9002. -- tx->key = NULL;
  9003. -- else {
  9004. -- I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
  9005. -- return TX_DROP;
  9006. -- }
  9007. -
  9008. - if (tx->key) {
  9009. - bool skip_hw = false;
  9010. 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
  9011. new file mode 100644
  9012. index 0000000..bb27115
  9013. --- /dev/null
  9014. +++ b/package/kernel/mac80211/patches/312-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  9015. @@ -0,0 +1,46 @@
  9016. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  9017. +Date: Thu, 20 Aug 2015 00:16:42 +0200
  9018. +Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
  9019. + addresses
  9020. +MIME-Version: 1.0
  9021. +Content-Type: text/plain; charset=UTF-8
  9022. +Content-Transfer-Encoding: 8bit
  9023. +
  9024. +Broadcom is working on better reflection of interface combinations. With
  9025. +upcoming patches we may have 1st combination supporting less interfaces
  9026. +than others.
  9027. +To don't run out of addresses check all combinations to find the one
  9028. +with the greatest max_interfaces value.
  9029. +
  9030. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  9031. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9032. +---
  9033. +
  9034. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9035. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9036. +@@ -5786,7 +5786,9 @@ static void brcmf_wiphy_wowl_params(stru
  9037. + static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  9038. + {
  9039. + struct brcmf_pub *drvr = ifp->drvr;
  9040. ++ const struct ieee80211_iface_combination *combo;
  9041. + struct ieee80211_supported_band *band;
  9042. ++ u16 max_interfaces = 0;
  9043. + __le32 bandlist[3];
  9044. + u32 n_bands;
  9045. + int err, i;
  9046. +@@ -5799,8 +5801,13 @@ static int brcmf_setup_wiphy(struct wiph
  9047. + if (err)
  9048. + return err;
  9049. +
  9050. +- for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  9051. +- i < ARRAY_SIZE(drvr->addresses); i++) {
  9052. ++ for (i = 0, combo = wiphy->iface_combinations;
  9053. ++ i < wiphy->n_iface_combinations; i++, combo++) {
  9054. ++ max_interfaces = max(max_interfaces, combo->max_interfaces);
  9055. ++ }
  9056. ++
  9057. ++ for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
  9058. ++ i++) {
  9059. + u8 *addr = drvr->addresses[i].addr;
  9060. +
  9061. + memcpy(addr, drvr->mac, ETH_ALEN);
  9062. 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
  9063. deleted file mode 100644
  9064. index 02a7fab..0000000
  9065. --- a/package/kernel/mac80211/patches/312-mac80211-don-t-look-up-destination-station-twice.patch
  9066. +++ /dev/null
  9067. @@ -1,71 +0,0 @@
  9068. -From: Johannes Berg <johannes.berg@intel.com>
  9069. -Date: Fri, 20 Mar 2015 16:24:21 +0100
  9070. -Subject: [PATCH] mac80211: don't look up destination station twice
  9071. -
  9072. -There's no need to look up the destination station twice while
  9073. -building the 802.11 header for a given frame if the frame will
  9074. -actually be transmitted to the station we initially looked up.
  9075. -
  9076. -This happens for 4-addr VLAN interfaces and TDLS connections, which
  9077. -both directly send the frame to the station they looked up, though
  9078. -in the case of TDLS some station conditions need to be checked.
  9079. -
  9080. -To avoid that, add a variable indicating that we've looked up the
  9081. -station that the frame is going to be transmitted to, and avoid the
  9082. -lookup/flag checking if it already has been done.
  9083. -
  9084. -In the TDLS case, also move the authorized/wme_sta flag assignment
  9085. -to the correct place, i.e. only when that station is really used.
  9086. -Before this change, the new lookup should always have succeeded so
  9087. -that the potentially erroneous data would be overwritten.
  9088. -
  9089. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9090. ----
  9091. -
  9092. ---- a/net/mac80211/tx.c
  9093. -+++ b/net/mac80211/tx.c
  9094. -@@ -1894,6 +1894,7 @@ static struct sk_buff *ieee80211_build_h
  9095. - bool wme_sta = false, authorized = false, tdls_auth = false;
  9096. - bool tdls_peer = false, tdls_setup_frame = false;
  9097. - bool multicast;
  9098. -+ bool have_station = false;
  9099. - u16 info_id = 0;
  9100. - struct ieee80211_chanctx_conf *chanctx_conf;
  9101. - struct ieee80211_sub_if_data *ap_sdata;
  9102. -@@ -1918,6 +1919,7 @@ static struct sk_buff *ieee80211_build_h
  9103. - hdrlen = 30;
  9104. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9105. - wme_sta = sta->sta.wme;
  9106. -+ have_station = true;
  9107. - }
  9108. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  9109. - u.ap);
  9110. -@@ -2034,9 +2036,6 @@ static struct sk_buff *ieee80211_build_h
  9111. - if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) {
  9112. - sta = sta_info_get(sdata, skb->data);
  9113. - if (sta) {
  9114. -- authorized = test_sta_flag(sta,
  9115. -- WLAN_STA_AUTHORIZED);
  9116. -- wme_sta = sta->sta.wme;
  9117. - tdls_peer = test_sta_flag(sta,
  9118. - WLAN_STA_TDLS_PEER);
  9119. - tdls_auth = test_sta_flag(sta,
  9120. -@@ -2068,6 +2067,9 @@ static struct sk_buff *ieee80211_build_h
  9121. - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
  9122. - memcpy(hdr.addr3, sdata->u.mgd.bssid, ETH_ALEN);
  9123. - hdrlen = 24;
  9124. -+ have_station = true;
  9125. -+ authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9126. -+ wme_sta = sta->sta.wme;
  9127. - } else if (sdata->u.mgd.use_4addr &&
  9128. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  9129. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  9130. -@@ -2130,7 +2132,7 @@ static struct sk_buff *ieee80211_build_h
  9131. - * in AP mode)
  9132. - */
  9133. - multicast = is_multicast_ether_addr(hdr.addr1);
  9134. -- if (!multicast) {
  9135. -+ if (!multicast && !have_station) {
  9136. - sta = sta_info_get(sdata, hdr.addr1);
  9137. - if (sta) {
  9138. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9139. 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
  9140. new file mode 100644
  9141. index 0000000..baee295
  9142. --- /dev/null
  9143. +++ b/package/kernel/mac80211/patches/313-brcmfmac-correct-interface-combination-info.patch
  9144. @@ -0,0 +1,204 @@
  9145. +From: Arend van Spriel <arend@broadcom.com>
  9146. +Date: Thu, 20 Aug 2015 22:06:03 +0200
  9147. +Subject: [PATCH] brcmfmac: correct interface combination info
  9148. +
  9149. +The interface combination provided by brcmfmac did not truly reflect
  9150. +the combinations supported by driver and/or firmware.
  9151. +
  9152. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9153. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9154. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9155. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  9156. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9157. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9158. +---
  9159. +
  9160. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9161. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9162. +@@ -5695,63 +5695,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  9163. + }
  9164. + };
  9165. +
  9166. ++/**
  9167. ++ * brcmf_setup_ifmodes() - determine interface modes and combinations.
  9168. ++ *
  9169. ++ * @wiphy: wiphy object.
  9170. ++ * @ifp: interface object needed for feat module api.
  9171. ++ *
  9172. ++ * The interface modes and combinations are determined dynamically here
  9173. ++ * based on firmware functionality.
  9174. ++ *
  9175. ++ * no p2p and no mbss:
  9176. ++ *
  9177. ++ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  9178. ++ *
  9179. ++ * no p2p and mbss:
  9180. ++ *
  9181. ++ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  9182. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  9183. ++ *
  9184. ++ * p2p, no mchan, and mbss:
  9185. ++ *
  9186. ++ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
  9187. ++ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  9188. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  9189. ++ *
  9190. ++ * p2p, mchan, and mbss:
  9191. ++ *
  9192. ++ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  9193. ++ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  9194. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  9195. ++ */
  9196. + static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  9197. + {
  9198. + struct ieee80211_iface_combination *combo = NULL;
  9199. +- struct ieee80211_iface_limit *limits = NULL;
  9200. +- int i = 0, max_iface_cnt;
  9201. ++ struct ieee80211_iface_limit *c0_limits = NULL;
  9202. ++ struct ieee80211_iface_limit *p2p_limits = NULL;
  9203. ++ struct ieee80211_iface_limit *mbss_limits = NULL;
  9204. ++ bool mbss, p2p;
  9205. ++ int i, c, n_combos;
  9206. +
  9207. +- combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  9208. ++ mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
  9209. ++ p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
  9210. ++
  9211. ++ n_combos = 1 + !!p2p + !!mbss;
  9212. ++ combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
  9213. + if (!combo)
  9214. + goto err;
  9215. +
  9216. +- limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  9217. +- if (!limits)
  9218. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  9219. ++ if (!c0_limits)
  9220. + goto err;
  9221. +
  9222. ++ if (p2p) {
  9223. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  9224. ++ if (!p2p_limits)
  9225. ++ goto err;
  9226. ++ }
  9227. ++
  9228. ++ if (mbss) {
  9229. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  9230. ++ if (!mbss_limits)
  9231. ++ goto err;
  9232. ++ }
  9233. ++
  9234. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  9235. + BIT(NL80211_IFTYPE_ADHOC) |
  9236. + BIT(NL80211_IFTYPE_AP);
  9237. +
  9238. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  9239. +- combo->num_different_channels = 2;
  9240. +- else
  9241. +- combo->num_different_channels = 1;
  9242. +-
  9243. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  9244. +- limits[i].max = 1;
  9245. +- limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  9246. +- limits[i].max = 4;
  9247. +- limits[i++].types = BIT(NL80211_IFTYPE_AP);
  9248. +- max_iface_cnt = 5;
  9249. +- } else {
  9250. +- limits[i].max = 2;
  9251. +- limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  9252. +- BIT(NL80211_IFTYPE_AP);
  9253. +- max_iface_cnt = 2;
  9254. +- }
  9255. +-
  9256. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  9257. ++ c = 0;
  9258. ++ i = 0;
  9259. ++ combo[c].num_different_channels = 1;
  9260. ++ c0_limits[i].max = 1;
  9261. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  9262. ++ if (p2p) {
  9263. ++ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  9264. ++ combo[c].num_different_channels = 2;
  9265. + wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9266. + BIT(NL80211_IFTYPE_P2P_GO) |
  9267. + BIT(NL80211_IFTYPE_P2P_DEVICE);
  9268. +- limits[i].max = 1;
  9269. +- limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9270. +- BIT(NL80211_IFTYPE_P2P_GO);
  9271. +- limits[i].max = 1;
  9272. +- limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  9273. +- max_iface_cnt += 2;
  9274. +- }
  9275. +- combo->max_interfaces = max_iface_cnt;
  9276. +- combo->limits = limits;
  9277. +- combo->n_limits = i;
  9278. ++ c0_limits[i].max = 1;
  9279. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  9280. ++ c0_limits[i].max = 1;
  9281. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9282. ++ BIT(NL80211_IFTYPE_P2P_GO);
  9283. ++ } else {
  9284. ++ c0_limits[i].max = 1;
  9285. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  9286. ++ }
  9287. ++ combo[c].max_interfaces = i;
  9288. ++ combo[c].n_limits = i;
  9289. ++ combo[c].limits = c0_limits;
  9290. ++
  9291. ++ if (p2p) {
  9292. ++ c++;
  9293. ++ i = 0;
  9294. ++ combo[c].num_different_channels = 1;
  9295. ++ p2p_limits[i].max = 1;
  9296. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  9297. ++ p2p_limits[i].max = 1;
  9298. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  9299. ++ p2p_limits[i].max = 1;
  9300. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  9301. ++ p2p_limits[i].max = 1;
  9302. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  9303. ++ combo[c].max_interfaces = i;
  9304. ++ combo[c].n_limits = i;
  9305. ++ combo[c].limits = p2p_limits;
  9306. ++ }
  9307. +
  9308. ++ if (mbss) {
  9309. ++ c++;
  9310. ++ combo[c].beacon_int_infra_match = true;
  9311. ++ combo[c].num_different_channels = 1;
  9312. ++ mbss_limits[0].max = 4;
  9313. ++ mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  9314. ++ combo[c].max_interfaces = 4;
  9315. ++ combo[c].n_limits = 1;
  9316. ++ combo[c].limits = mbss_limits;
  9317. ++ }
  9318. ++ wiphy->n_iface_combinations = n_combos;
  9319. + wiphy->iface_combinations = combo;
  9320. +- wiphy->n_iface_combinations = 1;
  9321. + return 0;
  9322. +
  9323. + err:
  9324. +- kfree(limits);
  9325. ++ kfree(c0_limits);
  9326. ++ kfree(p2p_limits);
  9327. ++ kfree(mbss_limits);
  9328. + kfree(combo);
  9329. + return -ENOMEM;
  9330. + }
  9331. +@@ -6080,11 +6149,15 @@ static void brcmf_cfg80211_reg_notifier(
  9332. +
  9333. + static void brcmf_free_wiphy(struct wiphy *wiphy)
  9334. + {
  9335. ++ int i;
  9336. ++
  9337. + if (!wiphy)
  9338. + return;
  9339. +
  9340. +- if (wiphy->iface_combinations)
  9341. +- kfree(wiphy->iface_combinations->limits);
  9342. ++ if (wiphy->iface_combinations) {
  9343. ++ for (i = 0; i < wiphy->n_iface_combinations; i++)
  9344. ++ kfree(wiphy->iface_combinations[i].limits);
  9345. ++ }
  9346. + kfree(wiphy->iface_combinations);
  9347. + if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  9348. + kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  9349. 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
  9350. deleted file mode 100644
  9351. index 4125351..0000000
  9352. --- a/package/kernel/mac80211/patches/313-mac80211-drop-4-addr-VLAN-frames-earlier-if-not-conn.patch
  9353. +++ /dev/null
  9354. @@ -1,27 +0,0 @@
  9355. -From: Johannes Berg <johannes.berg@intel.com>
  9356. -Date: Fri, 20 Mar 2015 16:24:22 +0100
  9357. -Subject: [PATCH] mac80211: drop 4-addr VLAN frames earlier if not
  9358. - connected
  9359. -
  9360. -If there's no station on the 4-addr VLAN interface, then frames
  9361. -cannot be transmitted. Drop such frames earlier, before setting
  9362. -up all the information for them.
  9363. -
  9364. -We should keep the old check though since that code might be used
  9365. -for other internally-generated frames.
  9366. -
  9367. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9368. ----
  9369. -
  9370. ---- a/net/mac80211/tx.c
  9371. -+++ b/net/mac80211/tx.c
  9372. -@@ -1920,6 +1920,9 @@ static struct sk_buff *ieee80211_build_h
  9373. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9374. - wme_sta = sta->sta.wme;
  9375. - have_station = true;
  9376. -+ } else if (sdata->wdev.use_4addr) {
  9377. -+ ret = -ENOLINK;
  9378. -+ goto free;
  9379. - }
  9380. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  9381. - u.ap);
  9382. 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
  9383. new file mode 100644
  9384. index 0000000..9768ef2
  9385. --- /dev/null
  9386. +++ b/package/kernel/mac80211/patches/314-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  9387. @@ -0,0 +1,87 @@
  9388. +From: Franky Lin <frankyl@broadcom.com>
  9389. +Date: Thu, 20 Aug 2015 22:06:04 +0200
  9390. +Subject: [PATCH] brcmfmac: add debugfs entry for msgbuf statistics
  9391. +
  9392. +Expose ring buffer read/write pointers and other useful statistics
  9393. +through debugfs.
  9394. +
  9395. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9396. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9397. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9398. +Signed-off-by: Franky Lin <frankyl@broadcom.com>
  9399. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9400. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9401. +---
  9402. +
  9403. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  9404. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  9405. +@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct
  9406. + }
  9407. + }
  9408. +
  9409. ++#ifdef DEBUG
  9410. ++static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  9411. ++{
  9412. ++ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  9413. ++ struct brcmf_pub *drvr = bus_if->drvr;
  9414. ++ struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  9415. ++ struct brcmf_commonring *commonring;
  9416. ++ u16 i;
  9417. ++ struct brcmf_flowring_ring *ring;
  9418. ++ struct brcmf_flowring_hash *hash;
  9419. ++
  9420. ++ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
  9421. ++ seq_printf(seq, "h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n",
  9422. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9423. ++ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
  9424. ++ seq_printf(seq, "h2d_rx_submit: rp %4u, wp %4u, depth %4u\n",
  9425. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9426. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
  9427. ++ seq_printf(seq, "d2h_ctl_cmplt: rp %4u, wp %4u, depth %4u\n",
  9428. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9429. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
  9430. ++ seq_printf(seq, "d2h_tx_cmplt: rp %4u, wp %4u, depth %4u\n",
  9431. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9432. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
  9433. ++ seq_printf(seq, "d2h_rx_cmplt: rp %4u, wp %4u, depth %4u\n",
  9434. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9435. ++
  9436. ++ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
  9437. ++ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
  9438. ++ seq_puts(seq, "Active flowrings:\n");
  9439. ++ hash = msgbuf->flow->hash;
  9440. ++ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
  9441. ++ if (!msgbuf->flow->rings[i])
  9442. ++ continue;
  9443. ++ ring = msgbuf->flow->rings[i];
  9444. ++ if (ring->status != RING_OPEN)
  9445. ++ continue;
  9446. ++ commonring = msgbuf->flowrings[i];
  9447. ++ hash = &msgbuf->flow->hash[ring->hash_id];
  9448. ++ seq_printf(seq, "id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n"
  9449. ++ " ifidx %u, fifo %u, da %pM\n",
  9450. ++ i, commonring->r_ptr, commonring->w_ptr,
  9451. ++ skb_queue_len(&ring->skblist), ring->blocked,
  9452. ++ hash->ifidx, hash->fifo, hash->mac);
  9453. ++ }
  9454. ++
  9455. ++ return 0;
  9456. ++}
  9457. ++#else
  9458. ++static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  9459. ++{
  9460. ++ return 0;
  9461. ++}
  9462. ++#endif
  9463. +
  9464. + int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
  9465. + {
  9466. +@@ -1460,6 +1514,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  9467. + spin_lock_init(&msgbuf->flowring_work_lock);
  9468. + INIT_LIST_HEAD(&msgbuf->work_queue);
  9469. +
  9470. ++ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read);
  9471. ++
  9472. + return 0;
  9473. +
  9474. + fail:
  9475. 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
  9476. deleted file mode 100644
  9477. index 9105a64..0000000
  9478. --- a/package/kernel/mac80211/patches/314-mac80211-mesh-avoid-pointless-station-lookup.patch
  9479. +++ /dev/null
  9480. @@ -1,33 +0,0 @@
  9481. -From: Johannes Berg <johannes.berg@intel.com>
  9482. -Date: Fri, 20 Mar 2015 16:24:23 +0100
  9483. -Subject: [PATCH] mac80211: mesh: avoid pointless station lookup
  9484. -
  9485. -In ieee80211_build_hdr(), the station is looked up to build the
  9486. -header correctly (QoS field) and to check for authorization. For
  9487. -mesh, authorization isn't checked here, and QoS capability is
  9488. -mandatory, so the station lookup can be avoided.
  9489. -
  9490. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9491. ----
  9492. -
  9493. ---- a/net/mac80211/tx.c
  9494. -+++ b/net/mac80211/tx.c
  9495. -@@ -2130,12 +2130,14 @@ static struct sk_buff *ieee80211_build_h
  9496. - }
  9497. -
  9498. - /*
  9499. -- * There's no need to try to look up the destination
  9500. -- * if it is a multicast address (which can only happen
  9501. -- * in AP mode)
  9502. -+ * There's no need to try to look up the destination station
  9503. -+ * if it is a multicast address. In mesh, there's no need to
  9504. -+ * look up the station at all as it always must be QoS capable
  9505. -+ * and mesh mode checks authorization later.
  9506. - */
  9507. - multicast = is_multicast_ether_addr(hdr.addr1);
  9508. -- if (!multicast && !have_station) {
  9509. -+ if (!multicast && !have_station &&
  9510. -+ !ieee80211_vif_is_mesh(&sdata->vif)) {
  9511. - sta = sta_info_get(sdata, hdr.addr1);
  9512. - if (sta) {
  9513. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9514. 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
  9515. new file mode 100644
  9516. index 0000000..281f02b
  9517. --- /dev/null
  9518. +++ b/package/kernel/mac80211/patches/315-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  9519. @@ -0,0 +1,83 @@
  9520. +From: Arend van Spriel <arend@broadcom.com>
  9521. +Date: Thu, 20 Aug 2015 22:06:05 +0200
  9522. +Subject: [PATCH] brcmfmac: make use of cfg80211_check_combinations()
  9523. +
  9524. +Use cfg80211_check_combinations() so we can bail out early when an
  9525. +interface add or change results in an invalid combination.
  9526. +
  9527. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9528. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9529. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9530. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9531. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9532. +---
  9533. +
  9534. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9535. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9536. +@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 le
  9537. + return NULL;
  9538. + }
  9539. +
  9540. ++static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
  9541. ++ struct brcmf_cfg80211_vif *vif,
  9542. ++ enum nl80211_iftype new_type)
  9543. ++{
  9544. ++ int iftype_num[NUM_NL80211_IFTYPES];
  9545. ++ struct brcmf_cfg80211_vif *pos;
  9546. ++
  9547. ++ memset(&iftype_num[0], 0, sizeof(iftype_num));
  9548. ++ list_for_each_entry(pos, &cfg->vif_list, list)
  9549. ++ if (pos == vif)
  9550. ++ iftype_num[new_type]++;
  9551. ++ else
  9552. ++ iftype_num[pos->wdev.iftype]++;
  9553. ++
  9554. ++ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  9555. ++}
  9556. ++
  9557. ++static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
  9558. ++ enum nl80211_iftype new_type)
  9559. ++{
  9560. ++ int iftype_num[NUM_NL80211_IFTYPES];
  9561. ++ struct brcmf_cfg80211_vif *pos;
  9562. ++
  9563. ++ memset(&iftype_num[0], 0, sizeof(iftype_num));
  9564. ++ list_for_each_entry(pos, &cfg->vif_list, list)
  9565. ++ iftype_num[pos->wdev.iftype]++;
  9566. ++
  9567. ++ iftype_num[new_type]++;
  9568. ++ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  9569. ++}
  9570. +
  9571. + static void convert_key_from_CPU(struct brcmf_wsec_key *key,
  9572. + struct brcmf_wsec_key_le *key_le)
  9573. +@@ -663,8 +693,14 @@ static struct wireless_dev *brcmf_cfg802
  9574. + struct vif_params *params)
  9575. + {
  9576. + struct wireless_dev *wdev;
  9577. ++ int err;
  9578. +
  9579. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  9580. ++ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  9581. ++ if (err) {
  9582. ++ brcmf_err("iface validation failed: err=%d\n", err);
  9583. ++ return ERR_PTR(err);
  9584. ++ }
  9585. + switch (type) {
  9586. + case NL80211_IFTYPE_ADHOC:
  9587. + case NL80211_IFTYPE_STATION:
  9588. +@@ -823,8 +859,12 @@ brcmf_cfg80211_change_iface(struct wiphy
  9589. + s32 ap = 0;
  9590. + s32 err = 0;
  9591. +
  9592. +- brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
  9593. +-
  9594. ++ brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  9595. ++ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  9596. ++ if (err) {
  9597. ++ brcmf_err("iface validation failed: err=%d\n", err);
  9598. ++ return err;
  9599. ++ }
  9600. + switch (type) {
  9601. + case NL80211_IFTYPE_MONITOR:
  9602. + case NL80211_IFTYPE_WDS:
  9603. 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
  9604. deleted file mode 100644
  9605. index d143025..0000000
  9606. --- a/package/kernel/mac80211/patches/315-mac80211-avoid-duplicate-TX-path-station-lookup.patch
  9607. +++ /dev/null
  9608. @@ -1,267 +0,0 @@
  9609. -From: Johannes Berg <johannes.berg@intel.com>
  9610. -Date: Fri, 20 Mar 2015 14:18:27 +0100
  9611. -Subject: [PATCH] mac80211: avoid duplicate TX path station lookup
  9612. -
  9613. -Instead of looking up the destination station twice in the TX path
  9614. -(first to build the header, and then for control processing), save
  9615. -it when building the header and use it later in the TX path.
  9616. -
  9617. -To avoid having to look up the station in the many callers, allow
  9618. -those to pass %NULL which keeps the existing lookup.
  9619. -
  9620. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9621. ----
  9622. -
  9623. ---- a/net/mac80211/cfg.c
  9624. -+++ b/net/mac80211/cfg.c
  9625. -@@ -3565,7 +3565,7 @@ static int ieee80211_probe_client(struct
  9626. - nullfunc->qos_ctrl = cpu_to_le16(7);
  9627. -
  9628. - local_bh_disable();
  9629. -- ieee80211_xmit(sdata, skb);
  9630. -+ ieee80211_xmit(sdata, sta, skb);
  9631. - local_bh_enable();
  9632. - rcu_read_unlock();
  9633. -
  9634. ---- a/net/mac80211/ieee80211_i.h
  9635. -+++ b/net/mac80211/ieee80211_i.h
  9636. -@@ -1775,7 +1775,8 @@ void mac80211_ev_michael_mic_failure(str
  9637. - gfp_t gfp);
  9638. - void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
  9639. - bool bss_notify);
  9640. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
  9641. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  9642. -+ struct sta_info *sta, struct sk_buff *skb);
  9643. -
  9644. - void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
  9645. - struct sk_buff *skb, int tid,
  9646. ---- a/net/mac80211/sta_info.c
  9647. -+++ b/net/mac80211/sta_info.c
  9648. -@@ -1279,7 +1279,7 @@ static void ieee80211_send_null_response
  9649. - }
  9650. -
  9651. - info->band = chanctx_conf->def.chan->band;
  9652. -- ieee80211_xmit(sdata, skb);
  9653. -+ ieee80211_xmit(sdata, sta, skb);
  9654. - rcu_read_unlock();
  9655. - }
  9656. -
  9657. ---- a/net/mac80211/tx.c
  9658. -+++ b/net/mac80211/tx.c
  9659. -@@ -1110,11 +1110,13 @@ static bool ieee80211_tx_prep_agg(struct
  9660. -
  9661. - /*
  9662. - * initialises @tx
  9663. -+ * pass %NULL for the station if unknown, a valid pointer if known
  9664. -+ * or an ERR_PTR() if the station is known not to exist
  9665. - */
  9666. - static ieee80211_tx_result
  9667. - ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
  9668. - struct ieee80211_tx_data *tx,
  9669. -- struct sk_buff *skb)
  9670. -+ struct sta_info *sta, struct sk_buff *skb)
  9671. - {
  9672. - struct ieee80211_local *local = sdata->local;
  9673. - struct ieee80211_hdr *hdr;
  9674. -@@ -1137,17 +1139,22 @@ ieee80211_tx_prepare(struct ieee80211_su
  9675. -
  9676. - hdr = (struct ieee80211_hdr *) skb->data;
  9677. -
  9678. -- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  9679. -- tx->sta = rcu_dereference(sdata->u.vlan.sta);
  9680. -- if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
  9681. -- return TX_DROP;
  9682. -- } else if (info->flags & (IEEE80211_TX_CTL_INJECTED |
  9683. -- IEEE80211_TX_INTFL_NL80211_FRAME_TX) ||
  9684. -- tx->sdata->control_port_protocol == tx->skb->protocol) {
  9685. -- tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  9686. -+ if (likely(sta)) {
  9687. -+ if (!IS_ERR(sta))
  9688. -+ tx->sta = sta;
  9689. -+ } else {
  9690. -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  9691. -+ tx->sta = rcu_dereference(sdata->u.vlan.sta);
  9692. -+ if (!tx->sta && sdata->wdev.use_4addr)
  9693. -+ return TX_DROP;
  9694. -+ } else if (info->flags & (IEEE80211_TX_INTFL_NL80211_FRAME_TX |
  9695. -+ IEEE80211_TX_CTL_INJECTED) ||
  9696. -+ tx->sdata->control_port_protocol == tx->skb->protocol) {
  9697. -+ tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  9698. -+ }
  9699. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  9700. -+ tx->sta = sta_info_get(sdata, hdr->addr1);
  9701. - }
  9702. -- if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  9703. -- tx->sta = sta_info_get(sdata, hdr->addr1);
  9704. -
  9705. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  9706. - !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
  9707. -@@ -1485,7 +1492,7 @@ bool ieee80211_tx_prepare_skb(struct iee
  9708. - struct ieee80211_tx_data tx;
  9709. - struct sk_buff *skb2;
  9710. -
  9711. -- if (ieee80211_tx_prepare(sdata, &tx, skb) == TX_DROP)
  9712. -+ if (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP)
  9713. - return false;
  9714. -
  9715. - info->band = band;
  9716. -@@ -1518,7 +1525,8 @@ EXPORT_SYMBOL(ieee80211_tx_prepare_skb);
  9717. - * Returns false if the frame couldn't be transmitted but was queued instead.
  9718. - */
  9719. - static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
  9720. -- struct sk_buff *skb, bool txpending)
  9721. -+ struct sta_info *sta, struct sk_buff *skb,
  9722. -+ bool txpending)
  9723. - {
  9724. - struct ieee80211_local *local = sdata->local;
  9725. - struct ieee80211_tx_data tx;
  9726. -@@ -1534,7 +1542,7 @@ static bool ieee80211_tx(struct ieee8021
  9727. -
  9728. - /* initialises tx */
  9729. - led_len = skb->len;
  9730. -- res_prepare = ieee80211_tx_prepare(sdata, &tx, skb);
  9731. -+ res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
  9732. -
  9733. - if (unlikely(res_prepare == TX_DROP)) {
  9734. - ieee80211_free_txskb(&local->hw, skb);
  9735. -@@ -1590,7 +1598,8 @@ static int ieee80211_skb_resize(struct i
  9736. - return 0;
  9737. - }
  9738. -
  9739. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
  9740. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  9741. -+ struct sta_info *sta, struct sk_buff *skb)
  9742. - {
  9743. - struct ieee80211_local *local = sdata->local;
  9744. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  9745. -@@ -1625,7 +1634,7 @@ void ieee80211_xmit(struct ieee80211_sub
  9746. - }
  9747. -
  9748. - ieee80211_set_qos_hdr(sdata, skb);
  9749. -- ieee80211_tx(sdata, skb, false);
  9750. -+ ieee80211_tx(sdata, sta, skb, false);
  9751. - }
  9752. -
  9753. - static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  9754. -@@ -1846,7 +1855,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  9755. - goto fail_rcu;
  9756. -
  9757. - info->band = chandef->chan->band;
  9758. -- ieee80211_xmit(sdata, skb);
  9759. -+ ieee80211_xmit(sdata, NULL, skb);
  9760. - rcu_read_unlock();
  9761. -
  9762. - return NETDEV_TX_OK;
  9763. -@@ -1877,7 +1886,8 @@ fail:
  9764. - * Returns: the (possibly reallocated) skb or an ERR_PTR() code
  9765. - */
  9766. - static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
  9767. -- struct sk_buff *skb, u32 info_flags)
  9768. -+ struct sk_buff *skb, u32 info_flags,
  9769. -+ struct sta_info **sta_out)
  9770. - {
  9771. - struct ieee80211_local *local = sdata->local;
  9772. - struct ieee80211_tx_info *info;
  9773. -@@ -1920,6 +1930,7 @@ static struct sk_buff *ieee80211_build_h
  9774. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9775. - wme_sta = sta->sta.wme;
  9776. - have_station = true;
  9777. -+ *sta_out = sta;
  9778. - } else if (sdata->wdev.use_4addr) {
  9779. - ret = -ENOLINK;
  9780. - goto free;
  9781. -@@ -2073,6 +2084,7 @@ static struct sk_buff *ieee80211_build_h
  9782. - have_station = true;
  9783. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9784. - wme_sta = sta->sta.wme;
  9785. -+ *sta_out = sta;
  9786. - } else if (sdata->u.mgd.use_4addr &&
  9787. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  9788. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  9789. -@@ -2136,13 +2148,18 @@ static struct sk_buff *ieee80211_build_h
  9790. - * and mesh mode checks authorization later.
  9791. - */
  9792. - multicast = is_multicast_ether_addr(hdr.addr1);
  9793. -- if (!multicast && !have_station &&
  9794. -- !ieee80211_vif_is_mesh(&sdata->vif)) {
  9795. -- sta = sta_info_get(sdata, hdr.addr1);
  9796. -+ if (multicast) {
  9797. -+ *sta_out = ERR_PTR(-ENOENT);
  9798. -+ } else if (!have_station && !ieee80211_vif_is_mesh(&sdata->vif)) {
  9799. -+ if (sdata->control_port_protocol == skb->protocol)
  9800. -+ sta = sta_info_get_bss(sdata, hdr.addr1);
  9801. -+ else
  9802. -+ sta = sta_info_get(sdata, hdr.addr1);
  9803. - if (sta) {
  9804. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9805. - wme_sta = sta->sta.wme;
  9806. - }
  9807. -+ *sta_out = sta ?: ERR_PTR(-ENOENT);
  9808. - }
  9809. -
  9810. - /* For mesh, the use of the QoS header is mandatory */
  9811. -@@ -2320,6 +2337,7 @@ void __ieee80211_subif_start_xmit(struct
  9812. - u32 info_flags)
  9813. - {
  9814. - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  9815. -+ struct sta_info *sta = NULL;
  9816. -
  9817. - if (unlikely(skb->len < ETH_HLEN)) {
  9818. - kfree_skb(skb);
  9819. -@@ -2328,7 +2346,7 @@ void __ieee80211_subif_start_xmit(struct
  9820. -
  9821. - rcu_read_lock();
  9822. -
  9823. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  9824. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta);
  9825. - if (IS_ERR(skb))
  9826. - goto out;
  9827. -
  9828. -@@ -2336,7 +2354,7 @@ void __ieee80211_subif_start_xmit(struct
  9829. - dev->stats.tx_bytes += skb->len;
  9830. - dev->trans_start = jiffies;
  9831. -
  9832. -- ieee80211_xmit(sdata, skb);
  9833. -+ ieee80211_xmit(sdata, sta, skb);
  9834. - out:
  9835. - rcu_read_unlock();
  9836. - }
  9837. -@@ -2364,10 +2382,11 @@ ieee80211_build_data_template(struct iee
  9838. - .local = sdata->local,
  9839. - .sdata = sdata,
  9840. - };
  9841. -+ struct sta_info *sta_ignore;
  9842. -
  9843. - rcu_read_lock();
  9844. -
  9845. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  9846. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta_ignore);
  9847. - if (IS_ERR(skb))
  9848. - goto out;
  9849. -
  9850. -@@ -2425,7 +2444,7 @@ static bool ieee80211_tx_pending_skb(str
  9851. - return true;
  9852. - }
  9853. - info->band = chanctx_conf->def.chan->band;
  9854. -- result = ieee80211_tx(sdata, skb, true);
  9855. -+ result = ieee80211_tx(sdata, NULL, skb, true);
  9856. - } else {
  9857. - struct sk_buff_head skbs;
  9858. -
  9859. -@@ -3163,7 +3182,7 @@ ieee80211_get_buffered_bc(struct ieee802
  9860. -
  9861. - if (sdata->vif.type == NL80211_IFTYPE_AP)
  9862. - sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
  9863. -- if (!ieee80211_tx_prepare(sdata, &tx, skb))
  9864. -+ if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
  9865. - break;
  9866. - dev_kfree_skb_any(skb);
  9867. - }
  9868. -@@ -3295,6 +3314,6 @@ void __ieee80211_tx_skb_tid_band(struct
  9869. - */
  9870. - local_bh_disable();
  9871. - IEEE80211_SKB_CB(skb)->band = band;
  9872. -- ieee80211_xmit(sdata, skb);
  9873. -+ ieee80211_xmit(sdata, NULL, skb);
  9874. - local_bh_enable();
  9875. - }
  9876. 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
  9877. new file mode 100644
  9878. index 0000000..2d5f7b9
  9879. --- /dev/null
  9880. +++ b/package/kernel/mac80211/patches/316-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  9881. @@ -0,0 +1,48 @@
  9882. +From: Franky Lin <frankyl@broadcom.com>
  9883. +Date: Thu, 20 Aug 2015 22:06:06 +0200
  9884. +Subject: [PATCH] brcmfmac: block the correct flowring when backup queue
  9885. + overflow
  9886. +
  9887. +brcmf_flowring_block blocks the last active flowring under the same
  9888. +interface instead of the one provided by caller. This could lead to a
  9889. +dead lock of netif stop if there are more than one flowring under the
  9890. +interface and the traffic is high enough so brcmf_flowring_enqueue can
  9891. +not unblock the ring right away.
  9892. +
  9893. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9894. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9895. +Signed-off-by: Franky Lin <frankyl@broadcom.com>
  9896. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9897. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9898. +---
  9899. +
  9900. +--- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  9901. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  9902. +@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct
  9903. + spin_lock_irqsave(&flow->block_lock, flags);
  9904. +
  9905. + ring = flow->rings[flowid];
  9906. ++ if (ring->blocked == blocked) {
  9907. ++ spin_unlock_irqrestore(&flow->block_lock, flags);
  9908. ++ return;
  9909. ++ }
  9910. + ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  9911. +
  9912. + currently_blocked = false;
  9913. + for (i = 0; i < flow->nrofrings; i++) {
  9914. +- if (flow->rings[i]) {
  9915. ++ if ((flow->rings[i]) && (i != flowid)) {
  9916. + ring = flow->rings[i];
  9917. + if ((ring->status == RING_OPEN) &&
  9918. + (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
  9919. +@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct
  9920. + }
  9921. + }
  9922. + }
  9923. +- ring->blocked = blocked;
  9924. +- if (currently_blocked == blocked) {
  9925. ++ flow->rings[flowid]->blocked = blocked;
  9926. ++ if (currently_blocked) {
  9927. + spin_unlock_irqrestore(&flow->block_lock, flags);
  9928. + return;
  9929. + }
  9930. 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
  9931. deleted file mode 100644
  9932. index 77a82c2..0000000
  9933. --- a/package/kernel/mac80211/patches/316-mac80211-reduce-log-spam-from-ieee80211_handle_pwr_c.patch
  9934. +++ /dev/null
  9935. @@ -1,38 +0,0 @@
  9936. -From: John Linville <linville@tuxdriver.com>
  9937. -Date: Tue, 31 Mar 2015 10:49:14 -0400
  9938. -Subject: [PATCH] mac80211: reduce log spam from ieee80211_handle_pwr_constr
  9939. -
  9940. -This changes a couple of messages from sdata_info to sdata_dbg.
  9941. -This should reduce some log spam, as reported here:
  9942. -
  9943. - https://bugzilla.redhat.com/show_bug.cgi?id=1206468
  9944. -
  9945. -Signed-off-by: John W. Linville <linville@tuxdriver.com>
  9946. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9947. ----
  9948. -
  9949. ---- a/net/mac80211/mlme.c
  9950. -+++ b/net/mac80211/mlme.c
  9951. -@@ -1347,15 +1347,15 @@ static u32 ieee80211_handle_pwr_constr(s
  9952. - */
  9953. - if (has_80211h_pwr &&
  9954. - (!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) {
  9955. -- sdata_info(sdata,
  9956. -- "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  9957. -- pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  9958. -- sdata->u.mgd.bssid);
  9959. -+ sdata_dbg(sdata,
  9960. -+ "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  9961. -+ pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  9962. -+ sdata->u.mgd.bssid);
  9963. - new_ap_level = pwr_level_80211h;
  9964. - } else { /* has_cisco_pwr is always true here. */
  9965. -- sdata_info(sdata,
  9966. -- "Limiting TX power to %d dBm as advertised by %pM\n",
  9967. -- pwr_level_cisco, sdata->u.mgd.bssid);
  9968. -+ sdata_dbg(sdata,
  9969. -+ "Limiting TX power to %d dBm as advertised by %pM\n",
  9970. -+ pwr_level_cisco, sdata->u.mgd.bssid);
  9971. - new_ap_level = pwr_level_cisco;
  9972. - }
  9973. -
  9974. 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
  9975. deleted file mode 100644
  9976. index e005fe7..0000000
  9977. --- a/package/kernel/mac80211/patches/317-brcmfmac-Fix-race-condition-in-msgbuf-ioctl-processi.patch
  9978. +++ /dev/null
  9979. @@ -1,35 +0,0 @@
  9980. -From: Hante Meuleman <meuleman@broadcom.com>
  9981. -Date: Fri, 6 Mar 2015 18:40:41 +0100
  9982. -Subject: [PATCH] brcmfmac: Fix race condition in msgbuf ioctl processing.
  9983. -
  9984. -Msgbuf is using a wait_event_timeout to wait for the response on
  9985. -an ioctl. The wakeup routine uses waitqueue_active to see if
  9986. -wait_event_timeout has been called. There is a chance that the
  9987. -response arrives before wait_event_timeout is called, this
  9988. -will result in situation that wait_event_timeout never gets
  9989. -woken again and assumed result will be a timeout. This patch
  9990. -removes that errornous situation by always setting the
  9991. -ctl_completed var before checking for queue active.
  9992. -
  9993. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9994. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9995. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9996. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9997. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9998. ----
  9999. -
  10000. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10001. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10002. -@@ -481,10 +481,9 @@ static int brcmf_msgbuf_ioctl_resp_wait(
  10003. -
  10004. - static void brcmf_msgbuf_ioctl_resp_wake(struct brcmf_msgbuf *msgbuf)
  10005. - {
  10006. -- if (waitqueue_active(&msgbuf->ioctl_resp_wait)) {
  10007. -- msgbuf->ctl_completed = true;
  10008. -+ msgbuf->ctl_completed = true;
  10009. -+ if (waitqueue_active(&msgbuf->ioctl_resp_wait))
  10010. - wake_up(&msgbuf->ioctl_resp_wait);
  10011. -- }
  10012. - }
  10013. -
  10014. -
  10015. 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
  10016. new file mode 100644
  10017. index 0000000..7378401
  10018. --- /dev/null
  10019. +++ b/package/kernel/mac80211/patches/317-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  10020. @@ -0,0 +1,52 @@
  10021. +From: Arend van Spriel <arend@broadcom.com>
  10022. +Date: Thu, 20 Aug 2015 22:06:07 +0200
  10023. +Subject: [PATCH] brcmfmac: bump highest event number for 4339 firmware
  10024. +
  10025. +The event mask length is determined by the highest event number
  10026. +that is specified in the driver. When this length is shorter than
  10027. +firmware expects setting event mask will fail and device becomes
  10028. +pretty useless. This issue was reported with bcm4339 firmware that
  10029. +was recently released.
  10030. +
  10031. +Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  10032. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10033. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10034. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10035. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  10036. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10037. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10038. +---
  10039. +
  10040. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  10041. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  10042. +@@ -85,7 +85,6 @@ struct brcmf_event;
  10043. + BRCMF_ENUM_DEF(IF, 54) \
  10044. + BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \
  10045. + BRCMF_ENUM_DEF(RSSI, 56) \
  10046. +- BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
  10047. + BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
  10048. + BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
  10049. + BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
  10050. +@@ -103,8 +102,7 @@ struct brcmf_event;
  10051. + BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
  10052. + BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
  10053. + BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
  10054. +- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
  10055. +- BRCMF_ENUM_DEF(PSTA_PRIMARY_INTF_IND, 128)
  10056. ++ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
  10057. +
  10058. + #define BRCMF_ENUM_DEF(id, val) \
  10059. + BRCMF_E_##id = (val),
  10060. +@@ -112,7 +110,11 @@ struct brcmf_event;
  10061. + /* firmware event codes sent by the dongle */
  10062. + enum brcmf_fweh_event_code {
  10063. + BRCMF_FWEH_EVENT_ENUM_DEFLIST
  10064. +- BRCMF_E_LAST
  10065. ++ /* this determines event mask length which must match
  10066. ++ * minimum length check in device firmware so it is
  10067. ++ * hard-coded here.
  10068. ++ */
  10069. ++ BRCMF_E_LAST = 139
  10070. + };
  10071. + #undef BRCMF_ENUM_DEF
  10072. +
  10073. 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
  10074. deleted file mode 100644
  10075. index c2cd1c5..0000000
  10076. --- a/package/kernel/mac80211/patches/318-brcmfmac-Update-msgbuf-commonring-size-for-improved-.patch
  10077. +++ /dev/null
  10078. @@ -1,30 +0,0 @@
  10079. -From: Hante Meuleman <meuleman@broadcom.com>
  10080. -Date: Wed, 18 Mar 2015 13:25:23 +0100
  10081. -Subject: [PATCH] brcmfmac: Update msgbuf commonring size for improved
  10082. - throughput.
  10083. -
  10084. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10085. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10086. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10087. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10088. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10089. ----
  10090. -
  10091. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  10092. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  10093. -@@ -17,11 +17,11 @@
  10094. -
  10095. - #ifdef CPTCFG_BRCMFMAC_PROTO_MSGBUF
  10096. -
  10097. --#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20
  10098. --#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256
  10099. --#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 20
  10100. -+#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 64
  10101. -+#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 512
  10102. -+#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 64
  10103. - #define BRCMF_D2H_MSGRING_TX_COMPLETE_MAX_ITEM 1024
  10104. --#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 256
  10105. -+#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 512
  10106. - #define BRCMF_H2D_TXFLOWRING_MAX_ITEM 512
  10107. -
  10108. - #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE 40
  10109. 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
  10110. deleted file mode 100644
  10111. index 6af69eb..0000000
  10112. --- a/package/kernel/mac80211/patches/319-ath9k_htc-add-new-WMI_REG_RMW_CMDID-command.patch
  10113. +++ /dev/null
  10114. @@ -1,307 +0,0 @@
  10115. -From: Oleksij Rempel <linux@rempel-privat.de>
  10116. -Date: Sun, 22 Mar 2015 19:29:46 +0100
  10117. -Subject: [PATCH] ath9k_htc: add new WMI_REG_RMW_CMDID command
  10118. -
  10119. -Since usb bus add extra delay on each request, a command
  10120. -with read + write requests is too expensive. We can dramtically
  10121. -reduce usb load by moving this command to firmware.
  10122. -
  10123. -In my tests, this patch will reduce channel scan time
  10124. -for about 5-10 seconds.
  10125. -
  10126. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  10127. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10128. ----
  10129. -
  10130. ---- a/drivers/net/wireless/ath/ath.h
  10131. -+++ b/drivers/net/wireless/ath/ath.h
  10132. -@@ -131,6 +131,9 @@ struct ath_ops {
  10133. - void (*enable_write_buffer)(void *);
  10134. - void (*write_flush) (void *);
  10135. - u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
  10136. -+ void (*enable_rmw_buffer)(void *);
  10137. -+ void (*rmw_flush) (void *);
  10138. -+
  10139. - };
  10140. -
  10141. - struct ath_common;
  10142. ---- a/drivers/net/wireless/ath/ath9k/htc.h
  10143. -+++ b/drivers/net/wireless/ath/ath9k/htc.h
  10144. -@@ -444,6 +444,10 @@ static inline void ath9k_htc_stop_btcoex
  10145. - #define OP_BT_SCAN BIT(4)
  10146. - #define OP_TSF_RESET BIT(6)
  10147. -
  10148. -+enum htc_op_flags {
  10149. -+ HTC_FWFLAG_NO_RMW,
  10150. -+};
  10151. -+
  10152. - struct ath9k_htc_priv {
  10153. - struct device *dev;
  10154. - struct ieee80211_hw *hw;
  10155. -@@ -482,6 +486,7 @@ struct ath9k_htc_priv {
  10156. - bool reconfig_beacon;
  10157. - unsigned int rxfilter;
  10158. - unsigned long op_flags;
  10159. -+ unsigned long fw_flags;
  10160. -
  10161. - struct ath9k_hw_cal_data caldata;
  10162. - struct ath_spec_scan_priv spec_priv;
  10163. ---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  10164. -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  10165. -@@ -376,17 +376,139 @@ static void ath9k_regwrite_flush(void *h
  10166. - mutex_unlock(&priv->wmi->multi_write_mutex);
  10167. - }
  10168. -
  10169. --static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  10170. -+static void ath9k_reg_rmw_buffer(void *hw_priv,
  10171. -+ u32 reg_offset, u32 set, u32 clr)
  10172. -+{
  10173. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10174. -+ struct ath_common *common = ath9k_hw_common(ah);
  10175. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10176. -+ u32 rsp_status;
  10177. -+ int r;
  10178. -+
  10179. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  10180. -+
  10181. -+ /* Store the register/value */
  10182. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].reg =
  10183. -+ cpu_to_be32(reg_offset);
  10184. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].set =
  10185. -+ cpu_to_be32(set);
  10186. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].clr =
  10187. -+ cpu_to_be32(clr);
  10188. -+
  10189. -+ priv->wmi->multi_rmw_idx++;
  10190. -+
  10191. -+ /* If the buffer is full, send it out. */
  10192. -+ if (priv->wmi->multi_rmw_idx == MAX_RMW_CMD_NUMBER) {
  10193. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10194. -+ (u8 *) &priv->wmi->multi_rmw,
  10195. -+ sizeof(struct register_write) * priv->wmi->multi_rmw_idx,
  10196. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  10197. -+ 100);
  10198. -+ if (unlikely(r)) {
  10199. -+ ath_dbg(common, WMI,
  10200. -+ "REGISTER RMW FAILED, multi len: %d\n",
  10201. -+ priv->wmi->multi_rmw_idx);
  10202. -+ }
  10203. -+ priv->wmi->multi_rmw_idx = 0;
  10204. -+ }
  10205. -+
  10206. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  10207. -+}
  10208. -+
  10209. -+static void ath9k_reg_rmw_flush(void *hw_priv)
  10210. - {
  10211. -- u32 val;
  10212. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10213. -+ struct ath_common *common = ath9k_hw_common(ah);
  10214. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10215. -+ u32 rsp_status;
  10216. -+ int r;
  10217. -+
  10218. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  10219. -+ return;
  10220. -+
  10221. -+ atomic_dec(&priv->wmi->m_rmw_cnt);
  10222. -+
  10223. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  10224. -+
  10225. -+ if (priv->wmi->multi_rmw_idx) {
  10226. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10227. -+ (u8 *) &priv->wmi->multi_rmw,
  10228. -+ sizeof(struct register_rmw) * priv->wmi->multi_rmw_idx,
  10229. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  10230. -+ 100);
  10231. -+ if (unlikely(r)) {
  10232. -+ ath_dbg(common, WMI,
  10233. -+ "REGISTER RMW FAILED, multi len: %d\n",
  10234. -+ priv->wmi->multi_rmw_idx);
  10235. -+ }
  10236. -+ priv->wmi->multi_rmw_idx = 0;
  10237. -+ }
  10238. -
  10239. -- val = ath9k_regread(hw_priv, reg_offset);
  10240. -- val &= ~clr;
  10241. -- val |= set;
  10242. -- ath9k_regwrite(hw_priv, val, reg_offset);
  10243. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  10244. -+}
  10245. -+
  10246. -+static void ath9k_enable_rmw_buffer(void *hw_priv)
  10247. -+{
  10248. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10249. -+ struct ath_common *common = ath9k_hw_common(ah);
  10250. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10251. -+
  10252. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  10253. -+ return;
  10254. -+
  10255. -+ atomic_inc(&priv->wmi->m_rmw_cnt);
  10256. -+}
  10257. -+
  10258. -+static u32 ath9k_reg_rmw_single(void *hw_priv,
  10259. -+ u32 reg_offset, u32 set, u32 clr)
  10260. -+{
  10261. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10262. -+ struct ath_common *common = ath9k_hw_common(ah);
  10263. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10264. -+ struct register_rmw buf, buf_ret;
  10265. -+ int ret;
  10266. -+ u32 val = 0;
  10267. -+
  10268. -+ buf.reg = cpu_to_be32(reg_offset);
  10269. -+ buf.set = cpu_to_be32(set);
  10270. -+ buf.clr = cpu_to_be32(clr);
  10271. -+
  10272. -+ ret = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10273. -+ (u8 *) &buf, sizeof(buf),
  10274. -+ (u8 *) &buf_ret, sizeof(buf_ret),
  10275. -+ 100);
  10276. -+ if (unlikely(ret)) {
  10277. -+ ath_dbg(common, WMI, "REGISTER RMW FAILED:(0x%04x, %d)\n",
  10278. -+ reg_offset, ret);
  10279. -+ }
  10280. - return val;
  10281. - }
  10282. -
  10283. -+static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  10284. -+{
  10285. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10286. -+ struct ath_common *common = ath9k_hw_common(ah);
  10287. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10288. -+
  10289. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags)) {
  10290. -+ u32 val;
  10291. -+
  10292. -+ val = REG_READ(ah, reg_offset);
  10293. -+ val &= ~clr;
  10294. -+ val |= set;
  10295. -+ REG_WRITE(ah, reg_offset, val);
  10296. -+
  10297. -+ return 0;
  10298. -+ }
  10299. -+
  10300. -+ if (atomic_read(&priv->wmi->m_rmw_cnt))
  10301. -+ ath9k_reg_rmw_buffer(hw_priv, reg_offset, set, clr);
  10302. -+ else
  10303. -+ ath9k_reg_rmw_single(hw_priv, reg_offset, set, clr);
  10304. -+
  10305. -+ return 0;
  10306. -+}
  10307. -+
  10308. - static void ath_usb_read_cachesize(struct ath_common *common, int *csz)
  10309. - {
  10310. - *csz = L1_CACHE_BYTES >> 2;
  10311. -@@ -501,6 +623,8 @@ static int ath9k_init_priv(struct ath9k_
  10312. - ah->reg_ops.write = ath9k_regwrite;
  10313. - ah->reg_ops.enable_write_buffer = ath9k_enable_regwrite_buffer;
  10314. - ah->reg_ops.write_flush = ath9k_regwrite_flush;
  10315. -+ ah->reg_ops.enable_rmw_buffer = ath9k_enable_rmw_buffer;
  10316. -+ ah->reg_ops.rmw_flush = ath9k_reg_rmw_flush;
  10317. - ah->reg_ops.rmw = ath9k_reg_rmw;
  10318. - priv->ah = ah;
  10319. -
  10320. -@@ -686,6 +810,12 @@ static int ath9k_init_firmware_version(s
  10321. - return -EINVAL;
  10322. - }
  10323. -
  10324. -+ if (priv->fw_version_major == 1 && priv->fw_version_minor < 4)
  10325. -+ set_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags);
  10326. -+
  10327. -+ dev_info(priv->dev, "FW RMW support: %s\n",
  10328. -+ test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags) ? "Off" : "On");
  10329. -+
  10330. - return 0;
  10331. - }
  10332. -
  10333. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  10334. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  10335. -@@ -100,6 +100,18 @@
  10336. - (_ah)->reg_ops.write_flush((_ah)); \
  10337. - } while (0)
  10338. -
  10339. -+#define ENABLE_REG_RMW_BUFFER(_ah) \
  10340. -+ do { \
  10341. -+ if ((_ah)->reg_ops.enable_rmw_buffer) \
  10342. -+ (_ah)->reg_ops.enable_rmw_buffer((_ah)); \
  10343. -+ } while (0)
  10344. -+
  10345. -+#define REG_RMW_BUFFER_FLUSH(_ah) \
  10346. -+ do { \
  10347. -+ if ((_ah)->reg_ops.rmw_flush) \
  10348. -+ (_ah)->reg_ops.rmw_flush((_ah)); \
  10349. -+ } while (0)
  10350. -+
  10351. - #define PR_EEP(_s, _val) \
  10352. - do { \
  10353. - len += scnprintf(buf + len, size - len, "%20s : %10d\n",\
  10354. ---- a/drivers/net/wireless/ath/ath9k/wmi.c
  10355. -+++ b/drivers/net/wireless/ath/ath9k/wmi.c
  10356. -@@ -61,6 +61,8 @@ static const char *wmi_cmd_to_name(enum
  10357. - return "WMI_REG_READ_CMDID";
  10358. - case WMI_REG_WRITE_CMDID:
  10359. - return "WMI_REG_WRITE_CMDID";
  10360. -+ case WMI_REG_RMW_CMDID:
  10361. -+ return "WMI_REG_RMW_CMDID";
  10362. - case WMI_RC_STATE_CHANGE_CMDID:
  10363. - return "WMI_RC_STATE_CHANGE_CMDID";
  10364. - case WMI_RC_RATE_UPDATE_CMDID:
  10365. -@@ -101,6 +103,7 @@ struct wmi *ath9k_init_wmi(struct ath9k_
  10366. - spin_lock_init(&wmi->event_lock);
  10367. - mutex_init(&wmi->op_mutex);
  10368. - mutex_init(&wmi->multi_write_mutex);
  10369. -+ mutex_init(&wmi->multi_rmw_mutex);
  10370. - init_completion(&wmi->cmd_wait);
  10371. - INIT_LIST_HEAD(&wmi->pending_tx_events);
  10372. - tasklet_init(&wmi->wmi_event_tasklet, ath9k_wmi_event_tasklet,
  10373. ---- a/drivers/net/wireless/ath/ath9k/wmi.h
  10374. -+++ b/drivers/net/wireless/ath/ath9k/wmi.h
  10375. -@@ -112,6 +112,7 @@ enum wmi_cmd_id {
  10376. - WMI_TX_STATS_CMDID,
  10377. - WMI_RX_STATS_CMDID,
  10378. - WMI_BITRATE_MASK_CMDID,
  10379. -+ WMI_REG_RMW_CMDID,
  10380. - };
  10381. -
  10382. - enum wmi_event_id {
  10383. -@@ -125,12 +126,19 @@ enum wmi_event_id {
  10384. - };
  10385. -
  10386. - #define MAX_CMD_NUMBER 62
  10387. -+#define MAX_RMW_CMD_NUMBER 15
  10388. -
  10389. - struct register_write {
  10390. - __be32 reg;
  10391. - __be32 val;
  10392. - };
  10393. -
  10394. -+struct register_rmw {
  10395. -+ __be32 reg;
  10396. -+ __be32 set;
  10397. -+ __be32 clr;
  10398. -+} __packed;
  10399. -+
  10400. - struct ath9k_htc_tx_event {
  10401. - int count;
  10402. - struct __wmi_event_txstatus txs;
  10403. -@@ -156,10 +164,18 @@ struct wmi {
  10404. -
  10405. - spinlock_t wmi_lock;
  10406. -
  10407. -+ /* multi write section */
  10408. - atomic_t mwrite_cnt;
  10409. - struct register_write multi_write[MAX_CMD_NUMBER];
  10410. - u32 multi_write_idx;
  10411. - struct mutex multi_write_mutex;
  10412. -+
  10413. -+ /* multi rmw section */
  10414. -+ atomic_t m_rmw_cnt;
  10415. -+ struct register_rmw multi_rmw[MAX_RMW_CMD_NUMBER];
  10416. -+ u32 multi_rmw_idx;
  10417. -+ struct mutex multi_rmw_mutex;
  10418. -+
  10419. - };
  10420. -
  10421. - struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv);
  10422. 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
  10423. new file mode 100644
  10424. index 0000000..97444b3
  10425. --- /dev/null
  10426. +++ b/package/kernel/mac80211/patches/319-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  10427. @@ -0,0 +1,138 @@
  10428. +From: Arend van Spriel <arend@broadcom.com>
  10429. +Date: Wed, 26 Aug 2015 22:14:53 +0200
  10430. +Subject: [PATCH] brcmfmac: consolidate ifp lookup in driver core
  10431. +
  10432. +In rx path the firmware provide an interface index which is used to
  10433. +map to a struct brcmf_if instance. However, this involves some trick
  10434. +that is done in two places. This is changed by having driver core
  10435. +providing brcmf_get_ifp() function.
  10436. +
  10437. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10438. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10439. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10440. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10441. +---
  10442. +
  10443. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10444. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10445. +@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10446. + struct sk_buff *pktbuf)
  10447. + {
  10448. + struct brcmf_proto_bcdc_header *h;
  10449. ++ struct brcmf_if *ifp;
  10450. +
  10451. + brcmf_dbg(BCDC, "Enter\n");
  10452. +
  10453. +@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10454. + trace_brcmf_bcdchdr(pktbuf->data);
  10455. + h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  10456. +
  10457. +- *ifidx = BCDC_GET_IF_IDX(h);
  10458. +- if (*ifidx >= BRCMF_MAX_IFS) {
  10459. +- brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
  10460. ++ ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  10461. ++ if (IS_ERR_OR_NULL(ifp)) {
  10462. ++ brcmf_dbg(INFO, "no matching ifp found\n");
  10463. + return -EBADE;
  10464. + }
  10465. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10466. +- * events this is easy because it contains the bssidx which maps
  10467. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  10468. +- * bssidx 1 is used for p2p0 and no data can be received or
  10469. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  10470. +- */
  10471. +- if (*ifidx)
  10472. +- (*ifidx)++;
  10473. +-
  10474. + if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  10475. + BCDC_PROTO_VER) {
  10476. + brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  10477. +- brcmf_ifname(drvr, *ifidx), h->flags);
  10478. ++ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10479. + return -EBADE;
  10480. + }
  10481. +
  10482. + if (h->flags & BCDC_FLAG_SUM_GOOD) {
  10483. + brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  10484. +- brcmf_ifname(drvr, *ifidx), h->flags);
  10485. ++ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10486. + pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  10487. + }
  10488. +
  10489. +@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10490. +
  10491. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  10492. + if (do_fws)
  10493. +- brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf);
  10494. ++ brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  10495. ++ pktbuf);
  10496. + else
  10497. + skb_pull(pktbuf, h->data_offset << 2);
  10498. +
  10499. + if (pktbuf->len == 0)
  10500. + return -ENODATA;
  10501. ++
  10502. ++ *ifidx = ifp->ifidx;
  10503. + return 0;
  10504. + }
  10505. +
  10506. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10507. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10508. +@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drv
  10509. + return "<if_none>";
  10510. + }
  10511. +
  10512. ++struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  10513. ++{
  10514. ++ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  10515. ++ brcmf_err("ifidx %d out of range\n", ifidx);
  10516. ++ return ERR_PTR(-ERANGE);
  10517. ++ }
  10518. ++
  10519. ++ /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10520. ++ * events this is easy because it contains the bssidx which maps
  10521. ++ * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  10522. ++ * bssidx 1 is used for p2p0 and no data can be received or
  10523. ++ * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  10524. ++ */
  10525. ++ if (ifidx)
  10526. ++ ifidx++;
  10527. ++
  10528. ++ return drvr->iflist[ifidx];
  10529. ++}
  10530. ++
  10531. + static void _brcmf_set_multicast_list(struct work_struct *work)
  10532. + {
  10533. + struct brcmf_if *ifp;
  10534. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  10535. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  10536. +@@ -202,7 +202,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  10537. +
  10538. + /* Return pointer to interface name */
  10539. + char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  10540. +-
  10541. ++struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  10542. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  10543. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  10544. + char *name, u8 *mac_addr);
  10545. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10546. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10547. +@@ -1081,16 +1081,8 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  10548. + {
  10549. + struct brcmf_if *ifp;
  10550. +
  10551. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10552. +- * events this is easy because it contains the bssidx which maps
  10553. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  10554. +- * bssidx 1 is used for p2p0 and no data can be received or
  10555. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  10556. +- */
  10557. +- if (ifidx)
  10558. +- (ifidx)++;
  10559. +- ifp = msgbuf->drvr->iflist[ifidx];
  10560. +- if (!ifp || !ifp->ndev) {
  10561. ++ ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  10562. ++ if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  10563. + brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  10564. + brcmu_pkt_buf_free_skb(skb);
  10565. + return;
  10566. 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
  10567. deleted file mode 100644
  10568. index c4dd1af..0000000
  10569. --- a/package/kernel/mac80211/patches/320-ath9k-ar9271_hw_pa_cal-use-defs-instead-of-magin-num.patch
  10570. +++ /dev/null
  10571. @@ -1,89 +0,0 @@
  10572. -From: Oleksij Rempel <linux@rempel-privat.de>
  10573. -Date: Sun, 22 Mar 2015 19:29:47 +0100
  10574. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal - use defs instead of magin
  10575. - numbers
  10576. -
  10577. -This function uses mixed styles for register names/numbers which
  10578. -is make harder reading and optimisation.
  10579. -
  10580. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  10581. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10582. ----
  10583. -
  10584. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  10585. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  10586. -@@ -430,22 +430,22 @@ static void ar9271_hw_pa_cal(struct ath_
  10587. - u32 regVal;
  10588. - unsigned int i;
  10589. - u32 regList[][2] = {
  10590. -- { 0x786c, 0 },
  10591. -- { 0x7854, 0 },
  10592. -- { 0x7820, 0 },
  10593. -- { 0x7824, 0 },
  10594. -- { 0x7868, 0 },
  10595. -- { 0x783c, 0 },
  10596. -- { 0x7838, 0 } ,
  10597. -- { 0x7828, 0 } ,
  10598. -+ { AR9285_AN_TOP3, 0 },
  10599. -+ { AR9285_AN_RXTXBB1, 0 },
  10600. -+ { AR9285_AN_RF2G1, 0 },
  10601. -+ { AR9285_AN_RF2G2, 0 },
  10602. -+ { AR9285_AN_TOP2, 0 },
  10603. -+ { AR9285_AN_RF2G8, 0 },
  10604. -+ { AR9285_AN_RF2G7, 0 } ,
  10605. -+ { AR9285_AN_RF2G3, 0 } ,
  10606. - };
  10607. -
  10608. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  10609. - regList[i][1] = REG_READ(ah, regList[i][0]);
  10610. -
  10611. -- regVal = REG_READ(ah, 0x7834);
  10612. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  10613. - regVal &= (~(0x1));
  10614. -- REG_WRITE(ah, 0x7834, regVal);
  10615. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10616. - regVal = REG_READ(ah, 0x9808);
  10617. - regVal |= (0x1 << 27);
  10618. - REG_WRITE(ah, 0x9808, regVal);
  10619. -@@ -477,7 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  10620. - * does not matter since we turn it off
  10621. - */
  10622. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  10623. --
  10624. -+ /* 7828, b0-11, ccom=fff */
  10625. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  10626. -
  10627. - /* Set:
  10628. -@@ -490,15 +490,16 @@ static void ar9271_hw_pa_cal(struct ath_
  10629. -
  10630. - /* find off_6_1; */
  10631. - for (i = 6; i > 0; i--) {
  10632. -- regVal = REG_READ(ah, 0x7834);
  10633. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  10634. - regVal |= (1 << (20 + i));
  10635. -- REG_WRITE(ah, 0x7834, regVal);
  10636. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10637. - udelay(1);
  10638. - /* regVal = REG_READ(ah, 0x7834); */
  10639. - regVal &= (~(0x1 << (20 + i)));
  10640. -- regVal |= (MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9)
  10641. -+ regVal |= (MS(REG_READ(ah, AR9285_AN_RF2G9),
  10642. -+ AR9285_AN_RXTXBB1_SPARE9)
  10643. - << (20 + i));
  10644. -- REG_WRITE(ah, 0x7834, regVal);
  10645. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10646. - }
  10647. -
  10648. - regVal = (regVal >> 20) & 0x7f;
  10649. -@@ -517,9 +518,9 @@ static void ar9271_hw_pa_cal(struct ath_
  10650. -
  10651. - ENABLE_REGWRITE_BUFFER(ah);
  10652. -
  10653. -- regVal = REG_READ(ah, 0x7834);
  10654. -+ regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  10655. - regVal |= 0x1;
  10656. -- REG_WRITE(ah, 0x7834, regVal);
  10657. -+ REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  10658. - regVal = REG_READ(ah, 0x9808);
  10659. - regVal &= (~(0x1 << 27));
  10660. - REG_WRITE(ah, 0x9808, regVal);
  10661. 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
  10662. new file mode 100644
  10663. index 0000000..632714c
  10664. --- /dev/null
  10665. +++ b/package/kernel/mac80211/patches/320-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  10666. @@ -0,0 +1,222 @@
  10667. +From: Arend van Spriel <arend@broadcom.com>
  10668. +Date: Wed, 26 Aug 2015 22:14:54 +0200
  10669. +Subject: [PATCH] brcmfmac: make brcmf_proto_hdrpull() return struct
  10670. + brcmf_if instance
  10671. +
  10672. +Avoid spreading the ifidx in the driver, but have it return the
  10673. +struct brcmf_if instance.
  10674. +
  10675. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10676. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10677. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10678. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10679. +---
  10680. +
  10681. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10682. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10683. +@@ -272,11 +272,11 @@ brcmf_proto_bcdc_hdrpush(struct brcmf_pu
  10684. + }
  10685. +
  10686. + static int
  10687. +-brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  10688. +- struct sk_buff *pktbuf)
  10689. ++brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  10690. ++ struct sk_buff *pktbuf, struct brcmf_if **ifp)
  10691. + {
  10692. + struct brcmf_proto_bcdc_header *h;
  10693. +- struct brcmf_if *ifp;
  10694. ++ struct brcmf_if *tmp_if;
  10695. +
  10696. + brcmf_dbg(BCDC, "Enter\n");
  10697. +
  10698. +@@ -290,21 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10699. + trace_brcmf_bcdchdr(pktbuf->data);
  10700. + h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  10701. +
  10702. +- ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  10703. +- if (IS_ERR_OR_NULL(ifp)) {
  10704. ++ tmp_if = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  10705. ++ if (!tmp_if) {
  10706. + brcmf_dbg(INFO, "no matching ifp found\n");
  10707. + return -EBADE;
  10708. + }
  10709. + if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  10710. + BCDC_PROTO_VER) {
  10711. + brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  10712. +- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10713. ++ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  10714. + return -EBADE;
  10715. + }
  10716. +
  10717. + if (h->flags & BCDC_FLAG_SUM_GOOD) {
  10718. + brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  10719. +- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10720. ++ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  10721. + pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  10722. + }
  10723. +
  10724. +@@ -312,7 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10725. +
  10726. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  10727. + if (do_fws)
  10728. +- brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  10729. ++ brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  10730. + pktbuf);
  10731. + else
  10732. + skb_pull(pktbuf, h->data_offset << 2);
  10733. +@@ -320,7 +320,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10734. + if (pktbuf->len == 0)
  10735. + return -ENODATA;
  10736. +
  10737. +- *ifidx = ifp->ifidx;
  10738. ++ *ifp = tmp_if;
  10739. + return 0;
  10740. + }
  10741. +
  10742. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10743. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10744. +@@ -87,7 +87,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  10745. + {
  10746. + if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  10747. + brcmf_err("ifidx %d out of range\n", ifidx);
  10748. +- return ERR_PTR(-ERANGE);
  10749. ++ return NULL;
  10750. + }
  10751. +
  10752. + /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10753. +@@ -539,17 +539,15 @@ void brcmf_rx_frame(struct device *dev,
  10754. + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  10755. + struct brcmf_pub *drvr = bus_if->drvr;
  10756. + struct brcmf_skb_reorder_data *rd;
  10757. +- u8 ifidx;
  10758. + int ret;
  10759. +
  10760. + brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  10761. +
  10762. + /* process and remove protocol-specific header */
  10763. +- ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb);
  10764. +- ifp = drvr->iflist[ifidx];
  10765. ++ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  10766. +
  10767. + if (ret || !ifp || !ifp->ndev) {
  10768. +- if ((ret != -ENODATA) && ifp)
  10769. ++ if (ret != -ENODATA && ifp)
  10770. + ifp->stats.rx_errors++;
  10771. + brcmu_pkt_buf_free_skb(skb);
  10772. + return;
  10773. +@@ -592,17 +590,17 @@ void brcmf_txcomplete(struct device *dev
  10774. + {
  10775. + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  10776. + struct brcmf_pub *drvr = bus_if->drvr;
  10777. +- u8 ifidx;
  10778. ++ struct brcmf_if *ifp;
  10779. +
  10780. + /* await txstatus signal for firmware if active */
  10781. + if (brcmf_fws_fc_active(drvr->fws)) {
  10782. + if (!success)
  10783. + brcmf_fws_bustxfail(drvr->fws, txp);
  10784. + } else {
  10785. +- if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp))
  10786. ++ if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  10787. + brcmu_pkt_buf_free_skb(txp);
  10788. + else
  10789. +- brcmf_txfinalize(drvr, txp, ifidx, success);
  10790. ++ brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  10791. + }
  10792. + }
  10793. +
  10794. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  10795. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  10796. +@@ -1448,7 +1448,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  10797. + struct sk_buff *skb;
  10798. + struct brcmf_skbuff_cb *skcb;
  10799. + struct brcmf_fws_mac_descriptor *entry = NULL;
  10800. +- u8 ifidx;
  10801. ++ struct brcmf_if *ifp;
  10802. +
  10803. + brcmf_dbg(DATA, "flags %d\n", flags);
  10804. +
  10805. +@@ -1497,15 +1497,16 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  10806. + }
  10807. + brcmf_fws_macdesc_return_req_credit(skb);
  10808. +
  10809. +- if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) {
  10810. ++ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp);
  10811. ++ if (ret) {
  10812. + brcmu_pkt_buf_free_skb(skb);
  10813. + return -EINVAL;
  10814. + }
  10815. + if (!remove_from_hanger)
  10816. +- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx,
  10817. ++ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  10818. + genbit, seq);
  10819. + if (remove_from_hanger || ret)
  10820. +- brcmf_txfinalize(fws->drvr, skb, ifidx, true);
  10821. ++ brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  10822. +
  10823. + return 0;
  10824. + }
  10825. +@@ -1848,7 +1849,7 @@ static int brcmf_fws_commit_skb(struct b
  10826. + entry->transit_count--;
  10827. + if (entry->suppressed)
  10828. + entry->suppr_transit_count--;
  10829. +- brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
  10830. ++ (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
  10831. + goto rollback;
  10832. + }
  10833. +
  10834. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10835. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10836. +@@ -522,7 +522,7 @@ static int brcmf_msgbuf_set_dcmd(struct
  10837. +
  10838. +
  10839. + static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  10840. +- u8 *ifidx, struct sk_buff *skb)
  10841. ++ struct sk_buff *skb, struct brcmf_if **ifp)
  10842. + {
  10843. + return -ENODEV;
  10844. + }
  10845. +@@ -1082,7 +1082,7 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  10846. + struct brcmf_if *ifp;
  10847. +
  10848. + ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  10849. +- if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  10850. ++ if (!ifp || !ifp->ndev) {
  10851. + brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  10852. + brcmu_pkt_buf_free_skb(skb);
  10853. + return;
  10854. +--- a/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  10855. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  10856. +@@ -24,8 +24,8 @@ enum proto_addr_mode {
  10857. +
  10858. +
  10859. + struct brcmf_proto {
  10860. +- int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  10861. +- struct sk_buff *skb);
  10862. ++ int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  10863. ++ struct sk_buff *skb, struct brcmf_if **ifp);
  10864. + int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
  10865. + void *buf, uint len);
  10866. + int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
  10867. +@@ -46,9 +46,19 @@ int brcmf_proto_attach(struct brcmf_pub
  10868. + void brcmf_proto_detach(struct brcmf_pub *drvr);
  10869. +
  10870. + static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  10871. +- u8 *ifidx, struct sk_buff *skb)
  10872. ++ struct sk_buff *skb,
  10873. ++ struct brcmf_if **ifp)
  10874. + {
  10875. +- return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
  10876. ++ struct brcmf_if *tmp = NULL;
  10877. ++
  10878. ++ /* assure protocol is always called with
  10879. ++ * non-null initialized pointer.
  10880. ++ */
  10881. ++ if (ifp)
  10882. ++ *ifp = NULL;
  10883. ++ else
  10884. ++ ifp = &tmp;
  10885. ++ return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
  10886. + }
  10887. + static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  10888. + uint cmd, void *buf, uint len)
  10889. 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
  10890. deleted file mode 100644
  10891. index f05287d..0000000
  10892. --- a/package/kernel/mac80211/patches/321-ath9k-ar9271_hw_pa_cal-use-proper-makroses.patch
  10893. +++ /dev/null
  10894. @@ -1,79 +0,0 @@
  10895. -From: Oleksij Rempel <linux@rempel-privat.de>
  10896. -Date: Sun, 22 Mar 2015 19:29:48 +0100
  10897. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use proper makroses.
  10898. -
  10899. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  10900. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10901. ----
  10902. -
  10903. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  10904. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  10905. -@@ -443,33 +443,30 @@ static void ar9271_hw_pa_cal(struct ath_
  10906. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  10907. - regList[i][1] = REG_READ(ah, regList[i][0]);
  10908. -
  10909. -- regVal = REG_READ(ah, AR9285_AN_RF2G6);
  10910. -- regVal &= (~(0x1));
  10911. -- REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10912. -- regVal = REG_READ(ah, 0x9808);
  10913. -- regVal |= (0x1 << 27);
  10914. -- REG_WRITE(ah, 0x9808, regVal);
  10915. --
  10916. -+ /* 7834, b1=0 */
  10917. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  10918. -+ /* 9808, b27=1 */
  10919. -+ REG_SET_BIT(ah, 0x9808, 1 << 27);
  10920. - /* 786c,b23,1, pwddac=1 */
  10921. -- REG_RMW_FIELD(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC, 1);
  10922. -+ REG_SET_BIT(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC);
  10923. - /* 7854, b5,1, pdrxtxbb=1 */
  10924. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1, 1);
  10925. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1);
  10926. - /* 7854, b7,1, pdv2i=1 */
  10927. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I, 1);
  10928. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I);
  10929. - /* 7854, b8,1, pddacinterface=1 */
  10930. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF, 1);
  10931. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF);
  10932. - /* 7824,b12,0, offcal=0 */
  10933. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL, 0);
  10934. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL);
  10935. - /* 7838, b1,0, pwddb=0 */
  10936. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB, 0);
  10937. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB);
  10938. - /* 7820,b11,0, enpacal=0 */
  10939. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL, 0);
  10940. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL);
  10941. - /* 7820,b25,1, pdpadrv1=0 */
  10942. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1, 0);
  10943. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1);
  10944. - /* 7820,b24,0, pdpadrv2=0 */
  10945. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2, 0);
  10946. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2);
  10947. - /* 7820,b23,0, pdpaout=0 */
  10948. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT, 0);
  10949. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT);
  10950. - /* 783c,b14-16,7, padrvgn2tab_0=7 */
  10951. - REG_RMW_FIELD(ah, AR9285_AN_RF2G8, AR9285_AN_RF2G8_PADRVGN2TAB0, 7);
  10952. - /*
  10953. -@@ -516,15 +513,13 @@ static void ar9271_hw_pa_cal(struct ath_
  10954. - ah->pacal_info.prev_offset = regVal;
  10955. - }
  10956. -
  10957. -- ENABLE_REGWRITE_BUFFER(ah);
  10958. -
  10959. -- regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  10960. -- regVal |= 0x1;
  10961. -- REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  10962. -- regVal = REG_READ(ah, 0x9808);
  10963. -- regVal &= (~(0x1 << 27));
  10964. -- REG_WRITE(ah, 0x9808, regVal);
  10965. -+ /* 7834, b1=1 */
  10966. -+ REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  10967. -+ /* 9808, b27=0 */
  10968. -+ REG_CLR_BIT(ah, 0x9808, 1 << 27);
  10969. -
  10970. -+ ENABLE_REGWRITE_BUFFER(ah);
  10971. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  10972. - REG_WRITE(ah, regList[i][0], regList[i][1]);
  10973. -
  10974. 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
  10975. new file mode 100644
  10976. index 0000000..3360cbc
  10977. --- /dev/null
  10978. +++ b/package/kernel/mac80211/patches/321-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  10979. @@ -0,0 +1,87 @@
  10980. +From: Arend van Spriel <arend@broadcom.com>
  10981. +Date: Wed, 26 Aug 2015 22:14:55 +0200
  10982. +Subject: [PATCH] brcmfmac: change parameters for
  10983. + brcmf_remove_interface()
  10984. +
  10985. +Just pass the interface to be removed, ie. the struct brcmf_if instance.
  10986. +
  10987. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10988. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10989. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10990. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10991. +---
  10992. +
  10993. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  10994. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  10995. +@@ -4983,7 +4983,7 @@ brcmf_notify_connect_status_ap(struct br
  10996. + brcmf_dbg(CONN, "AP mode link down\n");
  10997. + complete(&cfg->vif_disabled);
  10998. + if (ifp->vif->mbss)
  10999. +- brcmf_remove_interface(ifp->drvr, ifp->bssidx);
  11000. ++ brcmf_remove_interface(ifp);
  11001. + return 0;
  11002. + }
  11003. +
  11004. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11005. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11006. +@@ -887,12 +887,13 @@ static void brcmf_del_if(struct brcmf_pu
  11007. + }
  11008. + }
  11009. +
  11010. +-void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx)
  11011. ++void brcmf_remove_interface(struct brcmf_if *ifp)
  11012. + {
  11013. +- if (drvr->iflist[bssidx]) {
  11014. +- brcmf_fws_del_interface(drvr->iflist[bssidx]);
  11015. +- brcmf_del_if(drvr, bssidx);
  11016. +- }
  11017. ++ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  11018. ++ return;
  11019. ++
  11020. ++ brcmf_fws_del_interface(ifp);
  11021. ++ brcmf_del_if(ifp->drvr, ifp->bssidx);
  11022. + }
  11023. +
  11024. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  11025. +@@ -1122,7 +1123,7 @@ void brcmf_detach(struct device *dev)
  11026. +
  11027. + /* make sure primary interface removed last */
  11028. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  11029. +- brcmf_remove_interface(drvr, i);
  11030. ++ brcmf_remove_interface(drvr->iflist[i]);
  11031. +
  11032. + brcmf_cfg80211_detach(drvr->config);
  11033. +
  11034. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11035. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11036. +@@ -206,7 +206,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  11037. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  11038. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  11039. + char *name, u8 *mac_addr);
  11040. +-void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx);
  11041. ++void brcmf_remove_interface(struct brcmf_if *ifp);
  11042. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  11043. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  11044. + enum brcmf_netif_stop_reason reason, bool state);
  11045. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11046. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11047. +@@ -222,7 +222,7 @@ static void brcmf_fweh_handle_if_event(s
  11048. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  11049. +
  11050. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  11051. +- brcmf_remove_interface(drvr, ifevent->bssidx);
  11052. ++ brcmf_remove_interface(ifp);
  11053. + }
  11054. +
  11055. + /**
  11056. +--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  11057. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  11058. +@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  11059. + {
  11060. + cfg80211_unregister_wdev(&vif->wdev);
  11061. + p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  11062. +- brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  11063. ++ brcmf_remove_interface(vif->ifp);
  11064. + brcmf_free_vif(vif);
  11065. + }
  11066. +
  11067. 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
  11068. deleted file mode 100644
  11069. index 7247369..0000000
  11070. --- a/package/kernel/mac80211/patches/322-ath9k-ar9271_hw_pa_cal-use-RMW-buffer.patch
  11071. +++ /dev/null
  11072. @@ -1,48 +0,0 @@
  11073. -From: Oleksij Rempel <linux@rempel-privat.de>
  11074. -Date: Sun, 22 Mar 2015 19:29:49 +0100
  11075. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use RMW buffer
  11076. -
  11077. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11078. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11079. ----
  11080. -
  11081. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11082. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11083. -@@ -436,13 +436,14 @@ static void ar9271_hw_pa_cal(struct ath_
  11084. - { AR9285_AN_RF2G2, 0 },
  11085. - { AR9285_AN_TOP2, 0 },
  11086. - { AR9285_AN_RF2G8, 0 },
  11087. -- { AR9285_AN_RF2G7, 0 } ,
  11088. -- { AR9285_AN_RF2G3, 0 } ,
  11089. -+ { AR9285_AN_RF2G7, 0 },
  11090. -+ { AR9285_AN_RF2G3, 0 },
  11091. - };
  11092. -
  11093. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11094. - regList[i][1] = REG_READ(ah, regList[i][0]);
  11095. -
  11096. -+ ENABLE_REG_RMW_BUFFER(ah);
  11097. - /* 7834, b1=0 */
  11098. - REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11099. - /* 9808, b27=1 */
  11100. -@@ -476,6 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  11101. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  11102. - /* 7828, b0-11, ccom=fff */
  11103. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  11104. -+ REG_RMW_BUFFER_FLUSH(ah);
  11105. -
  11106. - /* Set:
  11107. - * localmode=1,bmode=1,bmoderxtx=1,synthon=1,
  11108. -@@ -514,10 +516,12 @@ static void ar9271_hw_pa_cal(struct ath_
  11109. - }
  11110. -
  11111. -
  11112. -+ ENABLE_REG_RMW_BUFFER(ah);
  11113. - /* 7834, b1=1 */
  11114. - REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11115. - /* 9808, b27=0 */
  11116. - REG_CLR_BIT(ah, 0x9808, 1 << 27);
  11117. -+ REG_RMW_BUFFER_FLUSH(ah);
  11118. -
  11119. - ENABLE_REGWRITE_BUFFER(ah);
  11120. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11121. 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
  11122. new file mode 100644
  11123. index 0000000..2b61f4e
  11124. --- /dev/null
  11125. +++ b/package/kernel/mac80211/patches/322-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  11126. @@ -0,0 +1,92 @@
  11127. +From: Arend van Spriel <arend@broadcom.com>
  11128. +Date: Wed, 26 Aug 2015 22:14:56 +0200
  11129. +Subject: [PATCH] brcmfmac: only call brcmf_cfg80211_detach() when attach
  11130. + was successful
  11131. +
  11132. +In brcmf_bus_start() the function brcmf_cfg80211_attach() is called which
  11133. +may fail. If this happens we should not call brcmf_cfg80211_detach() in
  11134. +the failure path as it will result in NULL pointer dereference:
  11135. +
  11136. + brcmf_fweh_activate_events: Set event_msgs error (-5)
  11137. + brcmf_bus_start: failed: -5
  11138. + brcmf_sdio_firmware_callback: dongle is not responding
  11139. + BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
  11140. + IP: [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  11141. + PGD 0
  11142. + Oops: 0000 [#1] SMP
  11143. + Modules linked in: brcmfmac(O) brcmutil(O) cfg80211 auth_rpcgss
  11144. + CPU: 1 PID: 45 Comm: kworker/1:1 Tainted: G O
  11145. + Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  11146. + Workqueue: events request_firmware_work_func
  11147. + task: ffff880036c09ac0 ti: ffff880036dd4000 task.ti: ffff880036dd4000
  11148. + RIP: 0010:[<ffffffff811e8f08>] [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  11149. + RSP: 0018:ffff880036dd7a28 EFLAGS: 00010246
  11150. + RAX: ffff880036c09ac0 RBX: 0000000000000000 RCX: 000000007fffffff
  11151. + RDX: 0000000000000000 RSI: ffffffff816578b9 RDI: 0000000000000000
  11152. + RBP: ffff880036dd7a48 R08: 0000000000000000 R09: ffff880036c0b340
  11153. + R10: 00000000000002ec R11: ffff880036dd7b08 R12: ffffffff816578b9
  11154. + R13: 0000000000000000 R14: ffffffff816578b9 R15: ffff8800c6c87000
  11155. + FS: 0000000000000000(0000) GS:ffff88012bc40000(0000) knlGS:0000000000000000
  11156. + CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  11157. + CR2: 0000000000000068 CR3: 0000000001a0b000 CR4: 00000000000006e0
  11158. + Stack:
  11159. + 0000000000000000 ffffffff816578b9 0000000000000000 ffff8800c0d003c8
  11160. + ffff880036dd7a78 ffffffff811e8ff5 0000000ffffffff1 ffffffff81a9b060
  11161. + ffff8800c789f880 ffff8800c0d00000 ffff880036dd7a98 ffffffff811ebe0d
  11162. + Call Trace:
  11163. + [<ffffffff811e8ff5>] kernfs_find_and_get_ns+0x35/0x60
  11164. + [<ffffffff811ebe0d>] sysfs_unmerge_group+0x1d/0x60
  11165. + [<ffffffff81404ef2>] dpm_sysfs_remove+0x22/0x60
  11166. + [<ffffffff813f9db9>] device_del+0x49/0x240
  11167. + [<ffffffff815da768>] rfkill_unregister+0x58/0xc0
  11168. + [<ffffffffa06bd91b>] wiphy_unregister+0xab/0x2f0 [cfg80211]
  11169. + [<ffffffffa0742fe3>] brcmf_cfg80211_detach+0x23/0x50 [brcmfmac]
  11170. + [<ffffffffa074d986>] brcmf_detach+0x86/0xe0 [brcmfmac]
  11171. + [<ffffffffa0757de8>] brcmf_sdio_remove+0x48/0x120 [brcmfmac]
  11172. + [<ffffffffa0758ed9>] brcmf_sdiod_remove+0x29/0xd0 [brcmfmac]
  11173. + [<ffffffffa0759031>] brcmf_ops_sdio_remove+0xb1/0x110 [brcmfmac]
  11174. + [<ffffffffa001c267>] sdio_bus_remove+0x37/0x100 [mmc_core]
  11175. + [<ffffffff813fe026>] __device_release_driver+0x96/0x130
  11176. + [<ffffffff813fe0e3>] device_release_driver+0x23/0x30
  11177. + [<ffffffffa0754bc8>] brcmf_sdio_firmware_callback+0x2a8/0x5d0 [brcmfmac]
  11178. + [<ffffffffa074deaf>] brcmf_fw_request_nvram_done+0x15f/0x5e0 [brcmfmac]
  11179. + [<ffffffff8140142f>] ? devres_add+0x3f/0x50
  11180. + [<ffffffff810642b5>] ? usermodehelper_read_unlock+0x15/0x20
  11181. + [<ffffffff81400000>] ? platform_match+0x70/0xa0
  11182. + [<ffffffff8140f400>] request_firmware_work_func+0x30/0x60
  11183. + [<ffffffff8106828c>] process_one_work+0x14c/0x3d0
  11184. + [<ffffffff8106862a>] worker_thread+0x11a/0x450
  11185. + [<ffffffff81068510>] ? process_one_work+0x3d0/0x3d0
  11186. + [<ffffffff8106d692>] kthread+0xd2/0xf0
  11187. + [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  11188. + [<ffffffff815ed35f>] ret_from_fork+0x3f/0x70
  11189. + [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  11190. + Code: e9 40 fe ff ff 48 89 d8 eb 87 66 0f 1f 84 00 00 00 00 00 66 66 66 66
  11191. + 90 55 48 89 e5 41 56 49 89 f6 41 55 49 89 d5 31 d2 41 54 53 <0f> b7
  11192. + 47 68 48 8b 5f 48 66 c1 e8 05 83 e0 01 4d 85 ed 0f b6 c8
  11193. + RIP [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  11194. + RSP <ffff880036dd7a28>
  11195. + CR2: 0000000000000068
  11196. + ---[ end trace 87d6ec0d3fe46740 ]---
  11197. +
  11198. +Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  11199. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11200. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11201. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11202. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11203. +---
  11204. +
  11205. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11206. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11207. +@@ -1049,7 +1049,10 @@ int brcmf_bus_start(struct device *dev)
  11208. + fail:
  11209. + if (ret < 0) {
  11210. + brcmf_err("failed: %d\n", ret);
  11211. +- brcmf_cfg80211_detach(drvr->config);
  11212. ++ if (drvr->config) {
  11213. ++ brcmf_cfg80211_detach(drvr->config);
  11214. ++ drvr->config = NULL;
  11215. ++ }
  11216. + if (drvr->fws) {
  11217. + brcmf_fws_del_interface(ifp);
  11218. + brcmf_fws_deinit(drvr);
  11219. 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
  11220. deleted file mode 100644
  11221. index 246bb9d..0000000
  11222. --- a/package/kernel/mac80211/patches/323-ath9k-add-multi_read-to-be-compatible-with-ath9k_htc.patch
  11223. +++ /dev/null
  11224. @@ -1,35 +0,0 @@
  11225. -From: Oleksij Rempel <linux@rempel-privat.de>
  11226. -Date: Sun, 22 Mar 2015 19:29:50 +0100
  11227. -Subject: [PATCH] ath9k: add multi_read to be compatible with ath9k_htc
  11228. -
  11229. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11230. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11231. ----
  11232. -
  11233. ---- a/drivers/net/wireless/ath/ath9k/init.c
  11234. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  11235. -@@ -141,6 +141,16 @@ static unsigned int ath9k_ioread32(void
  11236. - return val;
  11237. - }
  11238. -
  11239. -+static void ath9k_multi_ioread32(void *hw_priv, u32 *addr,
  11240. -+ u32 *val, u16 count)
  11241. -+{
  11242. -+ int i;
  11243. -+
  11244. -+ for (i = 0; i < count; i++)
  11245. -+ val[i] = ath9k_ioread32(hw_priv, addr[i]);
  11246. -+}
  11247. -+
  11248. -+
  11249. - static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset,
  11250. - u32 set, u32 clr)
  11251. - {
  11252. -@@ -530,6 +540,7 @@ static int ath9k_init_softc(u16 devid, s
  11253. - ah->hw = sc->hw;
  11254. - ah->hw_version.devid = devid;
  11255. - ah->reg_ops.read = ath9k_ioread32;
  11256. -+ ah->reg_ops.multi_read = ath9k_multi_ioread32;
  11257. - ah->reg_ops.write = ath9k_iowrite32;
  11258. - ah->reg_ops.rmw = ath9k_reg_rmw;
  11259. - pCap = &ah->caps;
  11260. 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
  11261. new file mode 100644
  11262. index 0000000..868b0a8
  11263. --- /dev/null
  11264. +++ b/package/kernel/mac80211/patches/323-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  11265. @@ -0,0 +1,105 @@
  11266. +From: Arend van Spriel <arend@broadcom.com>
  11267. +Date: Wed, 26 Aug 2015 22:14:57 +0200
  11268. +Subject: [PATCH] brcmfmac: correct detection of p2pdev interface event
  11269. +
  11270. +The p2pdev interface is setup in firmware resulting in a interface
  11271. +event. This event has role and no-if flag. When role is p2p client
  11272. +and no-if flag is set it indicates that this is the p2pdev interface.
  11273. +This info is used in handling the event and adding interface in the
  11274. +driver.
  11275. +
  11276. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11277. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11278. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11279. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11280. +---
  11281. +
  11282. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11283. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11284. +@@ -795,7 +795,7 @@ fail:
  11285. + }
  11286. +
  11287. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  11288. +- char *name, u8 *mac_addr)
  11289. ++ bool is_p2pdev, char *name, u8 *mac_addr)
  11290. + {
  11291. + struct brcmf_if *ifp;
  11292. + struct net_device *ndev;
  11293. +@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  11294. + }
  11295. + }
  11296. +
  11297. +- if (!brcmf_p2p_enable && bssidx == 1) {
  11298. ++ if (!brcmf_p2p_enable && is_p2pdev) {
  11299. + /* this is P2P_DEVICE interface */
  11300. + brcmf_dbg(INFO, "allocate non-netdev interface\n");
  11301. + ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
  11302. +@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
  11303. + brcmf_dbg(TRACE, "\n");
  11304. +
  11305. + /* add primary networking interface */
  11306. +- ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL);
  11307. ++ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
  11308. + if (IS_ERR(ifp))
  11309. + return PTR_ERR(ifp);
  11310. +
  11311. + if (brcmf_p2p_enable)
  11312. +- p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL);
  11313. ++ p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  11314. + else
  11315. + p2p_ifp = NULL;
  11316. + if (IS_ERR(p2p_ifp))
  11317. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11318. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11319. +@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drv
  11320. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  11321. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  11322. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  11323. +- char *name, u8 *mac_addr);
  11324. ++ bool is_p2pdev, char *name, u8 *mac_addr);
  11325. + void brcmf_remove_interface(struct brcmf_if *ifp);
  11326. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  11327. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  11328. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11329. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11330. +@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(s
  11331. + {
  11332. + struct brcmf_if_event *ifevent = data;
  11333. + struct brcmf_if *ifp;
  11334. ++ bool is_p2pdev;
  11335. + int err = 0;
  11336. +
  11337. + brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  11338. +@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(s
  11339. + ifevent->flags, ifevent->role);
  11340. +
  11341. + /* The P2P Device interface event must not be ignored
  11342. +- * contrary to what firmware tells us. The only way to
  11343. +- * distinguish the P2P Device is by looking at the ifidx
  11344. +- * and bssidx received.
  11345. ++ * contrary to what firmware tells us.
  11346. + */
  11347. +- if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
  11348. +- (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  11349. ++ is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  11350. ++ ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  11351. ++ if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  11352. + brcmf_dbg(EVENT, "event can be ignored\n");
  11353. + return;
  11354. + }
  11355. + if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  11356. +- brcmf_err("invalid interface index: %u\n",
  11357. +- ifevent->ifidx);
  11358. ++ brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  11359. + return;
  11360. + }
  11361. +
  11362. +@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(s
  11363. + brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  11364. + emsg->addr);
  11365. + ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  11366. +- emsg->ifname, emsg->addr);
  11367. ++ is_p2pdev, emsg->ifname, emsg->addr);
  11368. + if (IS_ERR(ifp))
  11369. + return;
  11370. + brcmf_fws_add_interface(ifp);
  11371. 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
  11372. deleted file mode 100644
  11373. index 2eda1c9..0000000
  11374. --- a/package/kernel/mac80211/patches/324-ath9k-add-new-function-ath9k_hw_read_array.patch
  11375. +++ /dev/null
  11376. @@ -1,69 +0,0 @@
  11377. -From: Oleksij Rempel <linux@rempel-privat.de>
  11378. -Date: Sun, 22 Mar 2015 19:29:51 +0100
  11379. -Subject: [PATCH] ath9k: add new function ath9k_hw_read_array
  11380. -
  11381. -REG_READ generate most overhead on usb bus. It send and read micro packages
  11382. -and reduce usb bandwidth. To reduce this overhead we should read in batches.
  11383. -
  11384. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11385. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11386. ----
  11387. -
  11388. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  11389. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  11390. -@@ -121,6 +121,36 @@ void ath9k_hw_write_array(struct ath_hw
  11391. - REGWRITE_BUFFER_FLUSH(ah);
  11392. - }
  11393. -
  11394. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size)
  11395. -+{
  11396. -+ u32 *tmp_reg_list, *tmp_data;
  11397. -+ int i;
  11398. -+
  11399. -+ tmp_reg_list = kmalloc(size * sizeof(u32), GFP_KERNEL);
  11400. -+ if (!tmp_reg_list) {
  11401. -+ dev_err(ah->dev, "%s: tmp_reg_list: alloc filed\n", __func__);
  11402. -+ return;
  11403. -+ }
  11404. -+
  11405. -+ tmp_data = kmalloc(size * sizeof(u32), GFP_KERNEL);
  11406. -+ if (!tmp_data) {
  11407. -+ dev_err(ah->dev, "%s tmp_data: alloc filed\n", __func__);
  11408. -+ goto error_tmp_data;
  11409. -+ }
  11410. -+
  11411. -+ for (i = 0; i < size; i++)
  11412. -+ tmp_reg_list[i] = array[i][0];
  11413. -+
  11414. -+ REG_READ_MULTI(ah, tmp_reg_list, tmp_data, size);
  11415. -+
  11416. -+ for (i = 0; i < size; i++)
  11417. -+ array[i][1] = tmp_data[i];
  11418. -+
  11419. -+ kfree(tmp_data);
  11420. -+error_tmp_data:
  11421. -+ kfree(tmp_reg_list);
  11422. -+}
  11423. -+
  11424. - u32 ath9k_hw_reverse_bits(u32 val, u32 n)
  11425. - {
  11426. - u32 retval;
  11427. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  11428. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  11429. -@@ -138,6 +138,8 @@
  11430. -
  11431. - #define REG_WRITE_ARRAY(iniarray, column, regWr) \
  11432. - ath9k_hw_write_array(ah, iniarray, column, &(regWr))
  11433. -+#define REG_READ_ARRAY(ah, array, size) \
  11434. -+ ath9k_hw_read_array(ah, array, size)
  11435. -
  11436. - #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
  11437. - #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
  11438. -@@ -1020,6 +1022,7 @@ void ath9k_hw_synth_delay(struct ath_hw
  11439. - bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
  11440. - void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array,
  11441. - int column, unsigned int *writecnt);
  11442. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size);
  11443. - u32 ath9k_hw_reverse_bits(u32 val, u32 n);
  11444. - u16 ath9k_hw_computetxtime(struct ath_hw *ah,
  11445. - u8 phy, int kbps,
  11446. 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
  11447. new file mode 100644
  11448. index 0000000..abd6681
  11449. --- /dev/null
  11450. +++ b/package/kernel/mac80211/patches/324-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  11451. @@ -0,0 +1,126 @@
  11452. +From: Arend van Spriel <arend@broadcom.com>
  11453. +Date: Wed, 26 Aug 2015 22:14:58 +0200
  11454. +Subject: [PATCH] brcmfmac: use brcmf_get_ifp() to map ifidx to struct
  11455. + brcmf_if instance
  11456. +
  11457. +The knowledge on how to map the interface index to a struct brcmf_if
  11458. +instance is in brcmf_get_ifp() so use that function when only the
  11459. +interface index is known instead of accessing brcmf_pub::iflist
  11460. +directly.
  11461. +
  11462. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11463. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11464. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11465. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11466. +---
  11467. +
  11468. +--- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  11469. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  11470. +@@ -149,7 +149,7 @@ static s32 brcmf_btcoex_params_read(stru
  11471. + static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
  11472. + bool trump_sco)
  11473. + {
  11474. +- struct brcmf_if *ifp = btci->cfg->pub->iflist[0];
  11475. ++ struct brcmf_if *ifp = brcmf_get_ifp(btci->cfg->pub, 0);
  11476. +
  11477. + if (trump_sco && !btci->saved_regs_part2) {
  11478. + /* this should reduce eSCO agressive
  11479. +@@ -468,7 +468,7 @@ int brcmf_btcoex_set_mode(struct brcmf_c
  11480. + {
  11481. + struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  11482. + struct brcmf_btcoex_info *btci = cfg->btcoex;
  11483. +- struct brcmf_if *ifp = cfg->pub->iflist[0];
  11484. ++ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  11485. +
  11486. + switch (mode) {
  11487. + case BRCMF_BTCOEX_DISABLED:
  11488. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11489. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11490. +@@ -6213,7 +6213,7 @@ static void brcmf_free_wiphy(struct wiph
  11491. + struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  11492. + struct device *busdev)
  11493. + {
  11494. +- struct net_device *ndev = drvr->iflist[0]->ndev;
  11495. ++ struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  11496. + struct brcmf_cfg80211_info *cfg;
  11497. + struct wiphy *wiphy;
  11498. + struct brcmf_cfg80211_vif *vif;
  11499. +--- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  11500. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  11501. +@@ -121,7 +121,7 @@ static void brcmf_feat_iovar_int_set(str
  11502. +
  11503. + void brcmf_feat_attach(struct brcmf_pub *drvr)
  11504. + {
  11505. +- struct brcmf_if *ifp = drvr->iflist[0];
  11506. ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  11507. +
  11508. + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  11509. + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  11510. +--- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  11511. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  11512. +@@ -221,7 +221,7 @@ static void brcmf_flowring_block(struct
  11513. +
  11514. + bus_if = dev_get_drvdata(flow->dev);
  11515. + drvr = bus_if->drvr;
  11516. +- ifp = drvr->iflist[ifidx];
  11517. ++ ifp = brcmf_get_ifp(drvr, ifidx);
  11518. + brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
  11519. +
  11520. + spin_unlock_irqrestore(&flow->block_lock, flags);
  11521. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11522. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11523. +@@ -334,7 +334,7 @@ void brcmf_fweh_attach(struct brcmf_pub
  11524. + void brcmf_fweh_detach(struct brcmf_pub *drvr)
  11525. + {
  11526. + struct brcmf_fweh_info *fweh = &drvr->fweh;
  11527. +- struct brcmf_if *ifp = drvr->iflist[0];
  11528. ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  11529. + s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  11530. +
  11531. + if (ifp) {
  11532. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11533. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11534. +@@ -972,7 +972,7 @@ static void
  11535. + brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
  11536. + u8 if_id)
  11537. + {
  11538. +- struct brcmf_if *ifp = fws->drvr->iflist[!if_id ? 0 : if_id + 1];
  11539. ++ struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id);
  11540. +
  11541. + if (WARN_ON(!ifp))
  11542. + return;
  11543. +@@ -2118,6 +2118,7 @@ static int brcmf_debugfs_fws_stats_read(
  11544. + int brcmf_fws_init(struct brcmf_pub *drvr)
  11545. + {
  11546. + struct brcmf_fws_info *fws;
  11547. ++ struct brcmf_if *ifp;
  11548. + u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS;
  11549. + int rc;
  11550. + u32 mode;
  11551. +@@ -2177,21 +2178,22 @@ int brcmf_fws_init(struct brcmf_pub *drv
  11552. + * continue. Set mode back to none indicating not enabled.
  11553. + */
  11554. + fws->fw_signals = true;
  11555. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) {
  11556. ++ ifp = brcmf_get_ifp(drvr, 0);
  11557. ++ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  11558. + brcmf_err("failed to set bdcv2 tlv signaling\n");
  11559. + fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  11560. + fws->fw_signals = false;
  11561. + }
  11562. +
  11563. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1))
  11564. ++ if (brcmf_fil_iovar_int_set(ifp, "ampdu_hostreorder", 1))
  11565. + brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n");
  11566. +
  11567. + /* Enable seq number reuse, if supported */
  11568. +- if (brcmf_fil_iovar_int_get(drvr->iflist[0], "wlfc_mode", &mode) == 0) {
  11569. ++ if (brcmf_fil_iovar_int_get(ifp, "wlfc_mode", &mode) == 0) {
  11570. + if (BRCMF_FWS_MODE_GET_REUSESEQ(mode)) {
  11571. + mode = 0;
  11572. + BRCMF_FWS_MODE_SET_REUSESEQ(mode, 1);
  11573. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0],
  11574. ++ if (brcmf_fil_iovar_int_set(ifp,
  11575. + "wlfc_mode", mode) == 0) {
  11576. + BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1);
  11577. + }
  11578. 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
  11579. deleted file mode 100644
  11580. index 4e4888f..0000000
  11581. --- a/package/kernel/mac80211/patches/325-ath9k-ar9271_hw_pa_cal-use-REG_READ_ARRAY.patch
  11582. +++ /dev/null
  11583. @@ -1,24 +0,0 @@
  11584. -From: Oleksij Rempel <linux@rempel-privat.de>
  11585. -Date: Sun, 22 Mar 2015 19:29:52 +0100
  11586. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use REG_READ_ARRAY
  11587. -
  11588. -insted of reading each register separatly
  11589. -and waste 4ms on each operation, we can
  11590. -use one shot read.
  11591. -
  11592. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11593. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11594. ----
  11595. -
  11596. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11597. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11598. -@@ -440,8 +440,7 @@ static void ar9271_hw_pa_cal(struct ath_
  11599. - { AR9285_AN_RF2G3, 0 },
  11600. - };
  11601. -
  11602. -- for (i = 0; i < ARRAY_SIZE(regList); i++)
  11603. -- regList[i][1] = REG_READ(ah, regList[i][0]);
  11604. -+ REG_READ_ARRAY(ah, regList, ARRAY_SIZE(regList));
  11605. -
  11606. - ENABLE_REG_RMW_BUFFER(ah);
  11607. - /* 7834, b1=0 */
  11608. 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
  11609. new file mode 100644
  11610. index 0000000..23a7b6f
  11611. --- /dev/null
  11612. +++ b/package/kernel/mac80211/patches/325-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  11613. @@ -0,0 +1,122 @@
  11614. +From: Arend van Spriel <arend@broadcom.com>
  11615. +Date: Wed, 26 Aug 2015 22:14:59 +0200
  11616. +Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  11617. + brcmf_txfinalize()
  11618. +
  11619. +Most call sites of brcmf_txfinalize already have struct brcmf_if
  11620. +instance so pass that to brcmf_txfinalize() as the function
  11621. +needs it anyway.
  11622. +
  11623. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11624. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11625. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11626. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11627. +---
  11628. +
  11629. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11630. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11631. +@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  11632. + brcmf_netif_rx(ifp, skb);
  11633. + }
  11634. +
  11635. +-void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  11636. +- bool success)
  11637. ++void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  11638. + {
  11639. +- struct brcmf_if *ifp;
  11640. + struct ethhdr *eh;
  11641. + u16 type;
  11642. +
  11643. +- ifp = drvr->iflist[ifidx];
  11644. +- if (!ifp)
  11645. +- goto done;
  11646. +-
  11647. + eh = (struct ethhdr *)(txp->data);
  11648. + type = ntohs(eh->h_proto);
  11649. +
  11650. +@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  11651. +
  11652. + if (!success)
  11653. + ifp->stats.tx_errors++;
  11654. +-done:
  11655. ++
  11656. + brcmu_pkt_buf_free_skb(txp);
  11657. + }
  11658. +
  11659. +@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  11660. + if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  11661. + brcmu_pkt_buf_free_skb(txp);
  11662. + else
  11663. +- brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  11664. ++ brcmf_txfinalize(ifp, txp, success);
  11665. + }
  11666. + }
  11667. +
  11668. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11669. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11670. +@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  11671. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  11672. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  11673. + enum brcmf_netif_stop_reason reason, bool state);
  11674. +-void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  11675. +- bool success);
  11676. ++void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  11677. + void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  11678. +
  11679. + /* Sets dongle media info (drv_version, mac address). */
  11680. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11681. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11682. +@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  11683. + ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  11684. + genbit, seq);
  11685. + if (remove_from_hanger || ret)
  11686. +- brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  11687. ++ brcmf_txfinalize(ifp, skb, true);
  11688. +
  11689. + return 0;
  11690. + }
  11691. +@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  11692. + if (fws->avoid_queueing) {
  11693. + rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  11694. + if (rc < 0)
  11695. +- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  11696. ++ brcmf_txfinalize(ifp, skb, false);
  11697. + return rc;
  11698. + }
  11699. +
  11700. +@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  11701. + brcmf_fws_schedule_deq(fws);
  11702. + } else {
  11703. + brcmf_err("drop skb: no hanger slot\n");
  11704. +- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  11705. ++ brcmf_txfinalize(ifp, skb, false);
  11706. + rc = -ENOMEM;
  11707. + }
  11708. + brcmf_fws_unlock(fws);
  11709. +@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  11710. + ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  11711. + brcmf_fws_lock(fws);
  11712. + if (ret < 0)
  11713. +- brcmf_txfinalize(drvr, skb, ifidx,
  11714. +- false);
  11715. ++ brcmf_txfinalize(brcmf_get_ifp(drvr,
  11716. ++ ifidx),
  11717. ++ skb, false);
  11718. + if (fws->bus_flow_blocked)
  11719. + break;
  11720. + }
  11721. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  11722. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  11723. +@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  11724. + commonring = msgbuf->flowrings[flowid];
  11725. + atomic_dec(&commonring->outstanding_tx);
  11726. +
  11727. +- brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  11728. ++ /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  11729. ++ * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  11730. ++ */
  11731. ++ brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  11732. ++ skb, true);
  11733. + }
  11734. +
  11735. +
  11736. 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
  11737. deleted file mode 100644
  11738. index a22cd1d..0000000
  11739. --- a/package/kernel/mac80211/patches/326-ath9k-use-one-shot-read-in-ath9k_hw_update_mibstats.patch
  11740. +++ /dev/null
  11741. @@ -1,39 +0,0 @@
  11742. -From: Oleksij Rempel <linux@rempel-privat.de>
  11743. -Date: Sun, 22 Mar 2015 19:29:53 +0100
  11744. -Subject: [PATCH] ath9k: use one shot read in ath9k_hw_update_mibstats
  11745. -
  11746. -this will reduce some overhead on usb bus.
  11747. -
  11748. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11749. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11750. ----
  11751. -
  11752. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  11753. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  11754. -@@ -107,11 +107,21 @@ static const struct ani_cck_level_entry
  11755. - static void ath9k_hw_update_mibstats(struct ath_hw *ah,
  11756. - struct ath9k_mib_stats *stats)
  11757. - {
  11758. -- stats->ackrcv_bad += REG_READ(ah, AR_ACK_FAIL);
  11759. -- stats->rts_bad += REG_READ(ah, AR_RTS_FAIL);
  11760. -- stats->fcs_bad += REG_READ(ah, AR_FCS_FAIL);
  11761. -- stats->rts_good += REG_READ(ah, AR_RTS_OK);
  11762. -- stats->beacons += REG_READ(ah, AR_BEACON_CNT);
  11763. -+ u32 addr[5] = {AR_RTS_OK, AR_RTS_FAIL, AR_ACK_FAIL,
  11764. -+ AR_FCS_FAIL, AR_BEACON_CNT};
  11765. -+ u32 data[5];
  11766. -+
  11767. -+ REG_READ_MULTI(ah, &addr[0], &data[0], 5);
  11768. -+ /* AR_RTS_OK */
  11769. -+ stats->rts_good += data[0];
  11770. -+ /* AR_RTS_FAIL */
  11771. -+ stats->rts_bad += data[1];
  11772. -+ /* AR_ACK_FAIL */
  11773. -+ stats->ackrcv_bad += data[2];
  11774. -+ /* AR_FCS_FAIL */
  11775. -+ stats->fcs_bad += data[3];
  11776. -+ /* AR_BEACON_CNT */
  11777. -+ stats->beacons += data[4];
  11778. - }
  11779. -
  11780. - static void ath9k_ani_restart(struct ath_hw *ah)
  11781. 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
  11782. new file mode 100644
  11783. index 0000000..8ddc0a6
  11784. --- /dev/null
  11785. +++ b/package/kernel/mac80211/patches/326-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  11786. @@ -0,0 +1,92 @@
  11787. +From: Arend van Spriel <arend@broadcom.com>
  11788. +Date: Wed, 26 Aug 2015 22:15:00 +0200
  11789. +Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
  11790. + index
  11791. +
  11792. +Because the P2P Device interface in firmware uses the same interface
  11793. +index as the primary interface we use the bsscfg index as index in the
  11794. +struct brcmf_pub::iflist. However, in the data path we get the interface
  11795. +index and not the bsscfg index. So we need a mapping of interface index
  11796. +to bsscfg index, which can be determined upon handle adding the interface.
  11797. +
  11798. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11799. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11800. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11801. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11802. +---
  11803. +
  11804. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11805. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11806. +@@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
  11807. +
  11808. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  11809. + {
  11810. ++ struct brcmf_if *ifp;
  11811. ++ s32 bssidx;
  11812. ++
  11813. + if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  11814. + brcmf_err("ifidx %d out of range\n", ifidx);
  11815. + return NULL;
  11816. + }
  11817. +
  11818. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  11819. +- * events this is easy because it contains the bssidx which maps
  11820. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  11821. +- * bssidx 1 is used for p2p0 and no data can be received or
  11822. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  11823. +- */
  11824. +- if (ifidx)
  11825. +- ifidx++;
  11826. ++ ifp = NULL;
  11827. ++ bssidx = drvr->if2bss[ifidx];
  11828. ++ if (bssidx >= 0)
  11829. ++ ifp = drvr->iflist[bssidx];
  11830. +
  11831. +- return drvr->iflist[ifidx];
  11832. ++ return ifp;
  11833. + }
  11834. +
  11835. + static void _brcmf_set_multicast_list(struct work_struct *work)
  11836. +@@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  11837. +
  11838. + ifp = netdev_priv(ndev);
  11839. + ifp->ndev = ndev;
  11840. ++ /* store mapping ifidx to bssidx */
  11841. ++ drvr->if2bss[ifidx] = bssidx;
  11842. + }
  11843. +
  11844. + ifp->drvr = drvr;
  11845. +@@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
  11846. + struct brcmf_if *ifp;
  11847. +
  11848. + ifp = drvr->iflist[bssidx];
  11849. ++ drvr->if2bss[ifp->ifidx] = -1;
  11850. + drvr->iflist[bssidx] = NULL;
  11851. + if (!ifp) {
  11852. + brcmf_err("Null interface, idx=%d\n", bssidx);
  11853. +@@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
  11854. + }
  11855. + brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  11856. + if (ifp->ndev) {
  11857. ++ drvr->if2bss[ifp->ifidx] = -1;
  11858. + if (bssidx == 0) {
  11859. + if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  11860. + rtnl_lock();
  11861. +@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  11862. + if (!drvr)
  11863. + return -ENOMEM;
  11864. +
  11865. ++ memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  11866. + mutex_init(&drvr->proto_block);
  11867. +
  11868. + /* Link to bus module */
  11869. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11870. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11871. +@@ -122,6 +122,7 @@ struct brcmf_pub {
  11872. + struct mac_address addresses[BRCMF_MAX_IFS];
  11873. +
  11874. + struct brcmf_if *iflist[BRCMF_MAX_IFS];
  11875. ++ s32 if2bss[BRCMF_MAX_IFS];
  11876. +
  11877. + struct mutex proto_block;
  11878. + unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  11879. 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
  11880. deleted file mode 100644
  11881. index e5a362f..0000000
  11882. --- a/package/kernel/mac80211/patches/327-ath9k-ath9k_hw_loadnf-use-REG_RMW.patch
  11883. +++ /dev/null
  11884. @@ -1,71 +0,0 @@
  11885. -From: Oleksij Rempel <linux@rempel-privat.de>
  11886. -Date: Sun, 22 Mar 2015 19:29:54 +0100
  11887. -Subject: [PATCH] ath9k: ath9k_hw_loadnf: use REG_RMW
  11888. -
  11889. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11890. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11891. ----
  11892. -
  11893. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  11894. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  11895. -@@ -238,7 +238,6 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  11896. - {
  11897. - struct ath9k_nfcal_hist *h = NULL;
  11898. - unsigned i, j;
  11899. -- int32_t val;
  11900. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  11901. - struct ath_common *common = ath9k_hw_common(ah);
  11902. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  11903. -@@ -246,6 +245,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  11904. - if (ah->caldata)
  11905. - h = ah->caldata->nfCalHist;
  11906. -
  11907. -+ ENABLE_REG_RMW_BUFFER(ah);
  11908. - for (i = 0; i < NUM_NF_READINGS; i++) {
  11909. - if (chainmask & (1 << i)) {
  11910. - s16 nfval;
  11911. -@@ -258,10 +258,8 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  11912. - else
  11913. - nfval = default_nf;
  11914. -
  11915. -- val = REG_READ(ah, ah->nf_regs[i]);
  11916. -- val &= 0xFFFFFE00;
  11917. -- val |= (((u32) nfval << 1) & 0x1ff);
  11918. -- REG_WRITE(ah, ah->nf_regs[i], val);
  11919. -+ REG_RMW(ah, ah->nf_regs[i],
  11920. -+ (((u32) nfval << 1) & 0x1ff), 0x1ff);
  11921. - }
  11922. - }
  11923. -
  11924. -@@ -274,6 +272,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  11925. - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
  11926. - AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  11927. - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  11928. -+ REG_RMW_BUFFER_FLUSH(ah);
  11929. -
  11930. - /*
  11931. - * Wait for load to complete, should be fast, a few 10s of us.
  11932. -@@ -309,19 +308,17 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  11933. - * by the median we just loaded. This will be initial (and max) value
  11934. - * of next noise floor calibration the baseband does.
  11935. - */
  11936. -- ENABLE_REGWRITE_BUFFER(ah);
  11937. -+ ENABLE_REG_RMW_BUFFER(ah);
  11938. - for (i = 0; i < NUM_NF_READINGS; i++) {
  11939. - if (chainmask & (1 << i)) {
  11940. - if ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(chan))
  11941. - continue;
  11942. -
  11943. -- val = REG_READ(ah, ah->nf_regs[i]);
  11944. -- val &= 0xFFFFFE00;
  11945. -- val |= (((u32) (-50) << 1) & 0x1ff);
  11946. -- REG_WRITE(ah, ah->nf_regs[i], val);
  11947. -+ REG_RMW(ah, ah->nf_regs[i],
  11948. -+ (((u32) (-50) << 1) & 0x1ff), 0x1ff);
  11949. - }
  11950. - }
  11951. -- REGWRITE_BUFFER_FLUSH(ah);
  11952. -+ REG_RMW_BUFFER_FLUSH(ah);
  11953. -
  11954. - return 0;
  11955. - }
  11956. 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
  11957. new file mode 100644
  11958. index 0000000..a0a798b
  11959. --- /dev/null
  11960. +++ b/package/kernel/mac80211/patches/327-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  11961. @@ -0,0 +1,103 @@
  11962. +From: Arend van Spriel <arend@broadcom.com>
  11963. +Date: Wed, 26 Aug 2015 22:15:01 +0200
  11964. +Subject: [PATCH] brcmfmac: add dedicated debug level for firmware
  11965. + console logging
  11966. +
  11967. +Both PCIe and SDIO devices have the possibility to log the firmware
  11968. +console output in kernel log. For PCIe it is logged when PCIE debug
  11969. +level is enabled. For SDIO it is logged when user specifies a non-zero
  11970. +console interval through debugfs. This patch tries to make it a
  11971. +bit more consistent. The firmware console output is only logged when
  11972. +FWCON debug level is enabled.
  11973. +
  11974. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11975. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11976. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11977. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  11978. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11979. +---
  11980. +
  11981. +--- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  11982. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  11983. +@@ -37,6 +37,7 @@
  11984. + #define BRCMF_SDIO_VAL 0x00020000
  11985. + #define BRCMF_MSGBUF_VAL 0x00040000
  11986. + #define BRCMF_PCIE_VAL 0x00080000
  11987. ++#define BRCMF_FWCON_VAL 0x00100000
  11988. +
  11989. + /* set default print format */
  11990. + #undef pr_fmt
  11991. +@@ -78,6 +79,7 @@ do { \
  11992. + #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  11993. + #define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
  11994. + #define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
  11995. ++#define BRCMF_FWCON_ON() (brcmf_msg_level & BRCMF_FWCON_VAL)
  11996. +
  11997. + #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  11998. +
  11999. +@@ -90,6 +92,7 @@ do { \
  12000. + #define BRCMF_GLOM_ON() 0
  12001. + #define BRCMF_EVENT_ON() 0
  12002. + #define BRCMF_FIL_ON() 0
  12003. ++#define BRCMF_FWCON_ON() 0
  12004. +
  12005. + #endif /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  12006. +
  12007. +--- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12008. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12009. +@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(
  12010. + addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
  12011. + console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
  12012. +
  12013. +- brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
  12014. ++ brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
  12015. + console->base_addr, console->buf_addr, console->bufsize);
  12016. + }
  12017. +
  12018. +@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(
  12019. + u8 ch;
  12020. + u32 newidx;
  12021. +
  12022. ++ if (!BRCMF_FWCON_ON())
  12023. ++ return;
  12024. ++
  12025. + console = &devinfo->shared.console;
  12026. + addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
  12027. + newidx = brcmf_pcie_read_tcm32(devinfo, addr);
  12028. +@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(
  12029. + }
  12030. + if (ch == '\n') {
  12031. + console->log_str[console->log_idx] = 0;
  12032. +- brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  12033. ++ pr_debug("CONSOLE: %s", console->log_str);
  12034. + console->log_idx = 0;
  12035. + }
  12036. + }
  12037. +--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12038. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12039. +@@ -123,6 +123,7 @@ struct rte_console {
  12040. +
  12041. + #define BRCMF_FIRSTREAD (1 << 6)
  12042. +
  12043. ++#define BRCMF_CONSOLE 10 /* watchdog interval to poll console */
  12044. +
  12045. + /* SBSDIO_DEVICE_CTL */
  12046. +
  12047. +@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(st
  12048. + if (IS_ERR_OR_NULL(dentry))
  12049. + return;
  12050. +
  12051. ++ bus->console_interval = BRCMF_CONSOLE;
  12052. ++
  12053. + brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
  12054. + brcmf_debugfs_add_entry(drvr, "counters",
  12055. + brcmf_debugfs_sdio_count_read);
  12056. +@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(stru
  12057. + }
  12058. + #ifdef DEBUG
  12059. + /* Poll for console output periodically */
  12060. +- if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
  12061. ++ if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
  12062. + bus->console_interval != 0) {
  12063. + bus->console.count += BRCMF_WD_POLL_MS;
  12064. + if (bus->console.count >= bus->console_interval) {
  12065. 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
  12066. deleted file mode 100644
  12067. index 01c8011..0000000
  12068. --- a/package/kernel/mac80211/patches/328-ath9k-write-buffer-related-optimisation-in-ar5008_hw.patch
  12069. +++ /dev/null
  12070. @@ -1,27 +0,0 @@
  12071. -From: Oleksij Rempel <linux@rempel-privat.de>
  12072. -Date: Sun, 22 Mar 2015 19:29:55 +0100
  12073. -Subject: [PATCH] ath9k: write buffer related optimisation in
  12074. - ar5008_hw_set_channel_regs
  12075. -
  12076. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12077. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12078. ----
  12079. -
  12080. ---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12081. -+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12082. -@@ -681,12 +681,13 @@ static void ar5008_hw_set_channel_regs(s
  12083. - phymode |= AR_PHY_FC_DYN2040_PRI_CH;
  12084. -
  12085. - }
  12086. -+ ENABLE_REGWRITE_BUFFER(ah);
  12087. - REG_WRITE(ah, AR_PHY_TURBO, phymode);
  12088. -
  12089. -+ /* This function do only REG_WRITE, so
  12090. -+ * we can include it to REGWRITE_BUFFER. */
  12091. - ath9k_hw_set11nmac2040(ah, chan);
  12092. -
  12093. -- ENABLE_REGWRITE_BUFFER(ah);
  12094. --
  12095. - REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S);
  12096. - REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S);
  12097. -
  12098. 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
  12099. new file mode 100644
  12100. index 0000000..53e7ede
  12101. --- /dev/null
  12102. +++ b/package/kernel/mac80211/patches/328-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  12103. @@ -0,0 +1,34 @@
  12104. +From: Arend van Spriel <arend@broadcom.com>
  12105. +Date: Wed, 26 Aug 2015 22:15:02 +0200
  12106. +Subject: [PATCH] brcmfmac: remove ifidx parameter from
  12107. + brcmf_fws_txstatus_suppressed()
  12108. +
  12109. +The brcmf_fws_txstatus_suppressed() function prototype specifies an
  12110. +ifidx parameter which is not used within the function implementation.
  12111. +
  12112. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12113. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12114. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12115. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12116. +---
  12117. +
  12118. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12119. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12120. +@@ -1398,7 +1398,7 @@ done:
  12121. + }
  12122. +
  12123. + static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo,
  12124. +- struct sk_buff *skb, u8 ifidx,
  12125. ++ struct sk_buff *skb,
  12126. + u32 genbit, u16 seq)
  12127. + {
  12128. + struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac;
  12129. +@@ -1503,7 +1503,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  12130. + return -EINVAL;
  12131. + }
  12132. + if (!remove_from_hanger)
  12133. +- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  12134. ++ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb,
  12135. + genbit, seq);
  12136. + if (remove_from_hanger || ret)
  12137. + brcmf_txfinalize(ifp, skb, true);
  12138. 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
  12139. deleted file mode 100644
  12140. index e5219f2..0000000
  12141. --- a/package/kernel/mac80211/patches/329-ath9k-ath9k_hw_set_4k_power_cal_tabl-use-rmw-buffer.patch
  12142. +++ /dev/null
  12143. @@ -1,26 +0,0 @@
  12144. -From: Oleksij Rempel <linux@rempel-privat.de>
  12145. -Date: Sun, 22 Mar 2015 19:29:56 +0100
  12146. -Subject: [PATCH] ath9k: ath9k_hw_set_4k_power_cal_tabl: use rmw buffer
  12147. -
  12148. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12149. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12150. ----
  12151. -
  12152. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12153. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12154. -@@ -389,6 +389,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  12155. - }
  12156. - }
  12157. -
  12158. -+ ENABLE_REG_RMW_BUFFER(ah);
  12159. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
  12160. - (numXpdGain - 1) & 0x3);
  12161. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
  12162. -@@ -396,6 +397,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  12163. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
  12164. - xpdGainValues[1]);
  12165. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, 0);
  12166. -+ REG_RMW_BUFFER_FLUSH(ah);
  12167. -
  12168. - for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
  12169. - regChainOffset = i * 0x1000;
  12170. 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
  12171. new file mode 100644
  12172. index 0000000..bb05235
  12173. --- /dev/null
  12174. +++ b/package/kernel/mac80211/patches/329-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  12175. @@ -0,0 +1,97 @@
  12176. +From: Arend van Spriel <arend@broadcom.com>
  12177. +Date: Wed, 26 Aug 2015 22:15:03 +0200
  12178. +Subject: [PATCH] brcmfmac: change prototype for brcmf_fws_hdrpull()
  12179. +
  12180. +Instead of passing ifidx and drvr just pass struct brcmf_if pointer
  12181. +which holds both parameters.
  12182. +
  12183. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12184. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12185. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12186. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12187. +---
  12188. +
  12189. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  12190. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  12191. +@@ -312,8 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  12192. +
  12193. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  12194. + if (do_fws)
  12195. +- brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  12196. +- pktbuf);
  12197. ++ brcmf_fws_hdrpull(tmp_if, h->data_offset << 2, pktbuf);
  12198. + else
  12199. + skb_pull(pktbuf, h->data_offset << 2);
  12200. +
  12201. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12202. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12203. +@@ -1616,11 +1616,10 @@ static int brcmf_fws_notify_bcmc_credit_
  12204. + return 0;
  12205. + }
  12206. +
  12207. +-int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  12208. +- struct sk_buff *skb)
  12209. ++void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  12210. + {
  12211. + struct brcmf_skb_reorder_data *rd;
  12212. +- struct brcmf_fws_info *fws = drvr->fws;
  12213. ++ struct brcmf_fws_info *fws = ifp->drvr->fws;
  12214. + u8 *signal_data;
  12215. + s16 data_len;
  12216. + u8 type;
  12217. +@@ -1630,20 +1629,20 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  12218. + s32 err;
  12219. +
  12220. + brcmf_dbg(HDRS, "enter: ifidx %d, skblen %u, sig %d\n",
  12221. +- ifidx, skb->len, signal_len);
  12222. ++ ifp->ifidx, skb->len, siglen);
  12223. +
  12224. +- WARN_ON(signal_len > skb->len);
  12225. ++ WARN_ON(siglen > skb->len);
  12226. +
  12227. +- if (!signal_len)
  12228. +- return 0;
  12229. ++ if (!siglen)
  12230. ++ return;
  12231. + /* if flow control disabled, skip to packet data and leave */
  12232. + if ((!fws) || (!fws->fw_signals)) {
  12233. +- skb_pull(skb, signal_len);
  12234. +- return 0;
  12235. ++ skb_pull(skb, siglen);
  12236. ++ return;
  12237. + }
  12238. +
  12239. + fws->stats.header_pulls++;
  12240. +- data_len = signal_len;
  12241. ++ data_len = siglen;
  12242. + signal_data = skb->data;
  12243. +
  12244. + status = BRCMF_FWS_RET_OK_NOSCHEDULE;
  12245. +@@ -1731,14 +1730,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  12246. + /* signalling processing result does
  12247. + * not affect the actual ethernet packet.
  12248. + */
  12249. +- skb_pull(skb, signal_len);
  12250. ++ skb_pull(skb, siglen);
  12251. +
  12252. + /* this may be a signal-only packet
  12253. + */
  12254. + if (skb->len == 0)
  12255. + fws->stats.header_only_pkt++;
  12256. +-
  12257. +- return 0;
  12258. + }
  12259. +
  12260. + static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
  12261. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  12262. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  12263. +@@ -21,8 +21,7 @@
  12264. + int brcmf_fws_init(struct brcmf_pub *drvr);
  12265. + void brcmf_fws_deinit(struct brcmf_pub *drvr);
  12266. + bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
  12267. +-int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  12268. +- struct sk_buff *skb);
  12269. ++void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
  12270. + int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);
  12271. +
  12272. + void brcmf_fws_reset_interface(struct brcmf_if *ifp);
  12273. 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
  12274. deleted file mode 100644
  12275. index 6ce3f40..0000000
  12276. --- a/package/kernel/mac80211/patches/330-ath9k-use-rmw-buffer-in-ath9k_hw_set_operating_mode-.patch
  12277. +++ /dev/null
  12278. @@ -1,43 +0,0 @@
  12279. -From: Oleksij Rempel <linux@rempel-privat.de>
  12280. -Date: Sun, 22 Mar 2015 19:29:57 +0100
  12281. -Subject: [PATCH] ath9k: use rmw buffer in ath9k_hw_set_operating_mode
  12282. - and ath9k_hw_reset
  12283. -
  12284. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12285. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12286. ----
  12287. -
  12288. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  12289. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  12290. -@@ -1227,6 +1227,7 @@ static void ath9k_hw_set_operating_mode(
  12291. - u32 mask = AR_STA_ID1_STA_AP | AR_STA_ID1_ADHOC;
  12292. - u32 set = AR_STA_ID1_KSRCH_MODE;
  12293. -
  12294. -+ ENABLE_REG_RMW_BUFFER(ah);
  12295. - switch (opmode) {
  12296. - case NL80211_IFTYPE_ADHOC:
  12297. - if (!AR_SREV_9340_13(ah)) {
  12298. -@@ -1248,6 +1249,7 @@ static void ath9k_hw_set_operating_mode(
  12299. - break;
  12300. - }
  12301. - REG_RMW(ah, AR_STA_ID1, set, mask);
  12302. -+ REG_RMW_BUFFER_FLUSH(ah);
  12303. - }
  12304. -
  12305. - void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
  12306. -@@ -1960,6 +1962,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  12307. - if (!ath9k_hw_mci_is_enabled(ah))
  12308. - REG_WRITE(ah, AR_OBS, 8);
  12309. -
  12310. -+ ENABLE_REG_RMW_BUFFER(ah);
  12311. - if (ah->config.rx_intr_mitigation) {
  12312. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, ah->config.rimt_last);
  12313. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, ah->config.rimt_first);
  12314. -@@ -1969,6 +1972,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  12315. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300);
  12316. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750);
  12317. - }
  12318. -+ REG_RMW_BUFFER_FLUSH(ah);
  12319. -
  12320. - ath9k_hw_init_bb(ah, chan);
  12321. -
  12322. 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
  12323. new file mode 100644
  12324. index 0000000..0651a2f
  12325. --- /dev/null
  12326. +++ b/package/kernel/mac80211/patches/330-brcmfmac-introduce-brcmf_net_detach-function.patch
  12327. @@ -0,0 +1,99 @@
  12328. +From: Arend van Spriel <arend@broadcom.com>
  12329. +Date: Wed, 26 Aug 2015 22:15:04 +0200
  12330. +Subject: [PATCH] brcmfmac: introduce brcmf_net_detach() function
  12331. +
  12332. +In case of error during brcmf_bus_start() the network interfaces were
  12333. +freed using free_netdev(). However, the interfaces may have additional
  12334. +memory allocated which is not freed. The netdev has destructor set to
  12335. +brcmf_cfg80211_free_netdev() which frees the additional memory if
  12336. +allocated and call free_netdev(). The brcmf_net_detach() either calls
  12337. +brcmf_cfg80211_free_netdev() directly or uses unregister_netdev() when
  12338. +struct net_device::reg_state indicates the netdev was registered.
  12339. +
  12340. +Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  12341. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12342. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12343. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12344. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12345. +---
  12346. +
  12347. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  12348. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  12349. +@@ -4747,7 +4747,8 @@ void brcmf_cfg80211_free_netdev(struct n
  12350. + ifp = netdev_priv(ndev);
  12351. + vif = ifp->vif;
  12352. +
  12353. +- brcmf_free_vif(vif);
  12354. ++ if (vif)
  12355. ++ brcmf_free_vif(vif);
  12356. + free_netdev(ndev);
  12357. + }
  12358. +
  12359. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  12360. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  12361. +@@ -718,8 +718,6 @@ int brcmf_net_attach(struct brcmf_if *if
  12362. + }
  12363. +
  12364. + brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
  12365. +-
  12366. +- ndev->destructor = brcmf_cfg80211_free_netdev;
  12367. + return 0;
  12368. +
  12369. + fail:
  12370. +@@ -729,6 +727,14 @@ fail:
  12371. + return -EBADE;
  12372. + }
  12373. +
  12374. ++static void brcmf_net_detach(struct net_device *ndev)
  12375. ++{
  12376. ++ if (ndev->reg_state == NETREG_REGISTERED)
  12377. ++ unregister_netdev(ndev);
  12378. ++ else
  12379. ++ brcmf_cfg80211_free_netdev(ndev);
  12380. ++}
  12381. ++
  12382. + static int brcmf_net_p2p_open(struct net_device *ndev)
  12383. + {
  12384. + brcmf_dbg(TRACE, "Enter\n");
  12385. +@@ -805,8 +811,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  12386. + ifp->ndev->name);
  12387. + if (ifidx) {
  12388. + netif_stop_queue(ifp->ndev);
  12389. +- unregister_netdev(ifp->ndev);
  12390. +- free_netdev(ifp->ndev);
  12391. ++ brcmf_net_detach(ifp->ndev);
  12392. + drvr->iflist[bssidx] = NULL;
  12393. + } else {
  12394. + brcmf_err("ignore IF event\n");
  12395. +@@ -828,6 +833,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  12396. + if (!ndev)
  12397. + return ERR_PTR(-ENOMEM);
  12398. +
  12399. ++ ndev->destructor = brcmf_cfg80211_free_netdev;
  12400. + ifp = netdev_priv(ndev);
  12401. + ifp->ndev = ndev;
  12402. + /* store mapping ifidx to bssidx */
  12403. +@@ -879,8 +885,7 @@ static void brcmf_del_if(struct brcmf_pu
  12404. + cancel_work_sync(&ifp->setmacaddr_work);
  12405. + cancel_work_sync(&ifp->multicast_work);
  12406. + }
  12407. +- /* unregister will take care of freeing it */
  12408. +- unregister_netdev(ifp->ndev);
  12409. ++ brcmf_net_detach(ifp->ndev);
  12410. + }
  12411. + }
  12412. +
  12413. +@@ -1056,11 +1061,11 @@ fail:
  12414. + brcmf_fws_deinit(drvr);
  12415. + }
  12416. + if (drvr->iflist[0]) {
  12417. +- free_netdev(ifp->ndev);
  12418. ++ brcmf_net_detach(ifp->ndev);
  12419. + drvr->iflist[0] = NULL;
  12420. + }
  12421. + if (p2p_ifp) {
  12422. +- free_netdev(p2p_ifp->ndev);
  12423. ++ brcmf_net_detach(p2p_ifp->ndev);
  12424. + drvr->iflist[1] = NULL;
  12425. + }
  12426. + return ret;
  12427. 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
  12428. deleted file mode 100644
  12429. index edd6160..0000000
  12430. --- a/package/kernel/mac80211/patches/331-ath9k-ath9k_hw_4k_set_board_values-use-rmw-buffer.patch
  12431. +++ /dev/null
  12432. @@ -1,26 +0,0 @@
  12433. -From: Oleksij Rempel <linux@rempel-privat.de>
  12434. -Date: Sun, 22 Mar 2015 19:29:58 +0100
  12435. -Subject: [PATCH] ath9k: ath9k_hw_4k_set_board_values: use rmw buffer
  12436. -
  12437. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12438. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12439. ----
  12440. -
  12441. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12442. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12443. -@@ -1082,6 +1082,7 @@ static void ath9k_hw_4k_set_board_values
  12444. - mask = BIT(0)|BIT(5)|BIT(10)|BIT(15)|BIT(20)|BIT(25);
  12445. - pwrctrl = mask * bb_desired_scale;
  12446. - clr = mask * 0x1f;
  12447. -+ ENABLE_REG_RMW_BUFFER(ah);
  12448. - REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr);
  12449. - REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr);
  12450. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr);
  12451. -@@ -1096,6 +1097,7 @@ static void ath9k_hw_4k_set_board_values
  12452. - clr = mask * 0x1f;
  12453. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr);
  12454. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr);
  12455. -+ REG_RMW_BUFFER_FLUSH(ah);
  12456. - }
  12457. - }
  12458. -
  12459. 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
  12460. new file mode 100644
  12461. index 0000000..5a7e447
  12462. --- /dev/null
  12463. +++ b/package/kernel/mac80211/patches/331-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  12464. @@ -0,0 +1,193 @@
  12465. +From: Hante Meuleman <meuleman@broadcom.com>
  12466. +Date: Thu, 27 Aug 2015 16:14:06 +0200
  12467. +Subject: [PATCH] brcmfmac: Reset PCIE devices after recognition.
  12468. +
  12469. +When PCIE type devices are being FW reloaded without being properly
  12470. +reset then the device ends up in a locked state, requiring the
  12471. +device to be completely powered down. This patch adds a reset
  12472. +through watchdog at the moment the device (cores) has been
  12473. +recognized. This will solve warm reboot issues.
  12474. +
  12475. +Cc: Rafal Milecki <zajec5@gmail.com>
  12476. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12477. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12478. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12479. +Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12480. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12481. +---
  12482. +
  12483. +--- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  12484. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  12485. +@@ -101,6 +101,9 @@
  12486. + /* ARM Cortex M3 core, ID 0x82a */
  12487. + #define BCM4329_CORE_ARM_BASE 0x18002000
  12488. +
  12489. ++/* Max possibly supported memory size (limited by IO mapped memory) */
  12490. ++#define BRCMF_CHIP_MAX_MEMSIZE (4 * 1024 * 1024)
  12491. ++
  12492. + #define CORE_SB(base, field) \
  12493. + (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  12494. + #define SBCOREREV(sbidh) \
  12495. +@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct
  12496. + brcmf_err("RAM size is undetermined\n");
  12497. + return -ENOMEM;
  12498. + }
  12499. ++
  12500. ++ if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
  12501. ++ brcmf_err("RAM size is incorrect\n");
  12502. ++ return -ENOMEM;
  12503. ++ }
  12504. ++
  12505. + return 0;
  12506. + }
  12507. +
  12508. +@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct
  12509. +
  12510. + /* assure chip is passive for core access */
  12511. + brcmf_chip_set_passive(&ci->pub);
  12512. ++
  12513. ++ /* Call bus specific reset function now. Cores have been determined
  12514. ++ * but further access may require a chip specific reset at this point.
  12515. ++ */
  12516. ++ if (ci->ops->reset) {
  12517. ++ ci->ops->reset(ci->ctx, &ci->pub);
  12518. ++ brcmf_chip_set_passive(&ci->pub);
  12519. ++ }
  12520. ++
  12521. + return brcmf_chip_get_raminfo(ci);
  12522. + }
  12523. +
  12524. +--- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  12525. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  12526. +@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
  12527. + u32 (*read32)(void *ctx, u32 addr);
  12528. + void (*write32)(void *ctx, u32 addr, u32 value);
  12529. + int (*prepare)(void *ctx);
  12530. ++ int (*reset)(void *ctx, struct brcmf_chip *chip);
  12531. + int (*setup)(void *ctx, struct brcmf_chip *chip);
  12532. + void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  12533. + };
  12534. +--- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12535. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12536. +@@ -74,6 +74,8 @@ enum brcmf_pcie_state {
  12537. + #define BRCMF_PCIE_REG_INTMASK 0x94
  12538. + #define BRCMF_PCIE_REG_SBMBX 0x98
  12539. +
  12540. ++#define BRCMF_PCIE_REG_LINK_STATUS_CTRL 0xBC
  12541. ++
  12542. + #define BRCMF_PCIE_PCIE2REG_INTMASK 0x24
  12543. + #define BRCMF_PCIE_PCIE2REG_MAILBOXINT 0x48
  12544. + #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C
  12545. +@@ -466,6 +468,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
  12546. +
  12547. + static void brcmf_pcie_reset_device(struct brcmf_pciedev_info *devinfo)
  12548. + {
  12549. ++ struct brcmf_core *core;
  12550. + u16 cfg_offset[] = { BRCMF_PCIE_CFGREG_STATUS_CMD,
  12551. + BRCMF_PCIE_CFGREG_PM_CSR,
  12552. + BRCMF_PCIE_CFGREG_MSI_CAP,
  12553. +@@ -484,32 +487,38 @@ static void brcmf_pcie_reset_device(stru
  12554. + if (!devinfo->ci)
  12555. + return;
  12556. +
  12557. ++ /* Disable ASPM */
  12558. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12559. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12560. +- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  12561. +- lsc = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  12562. ++ pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  12563. ++ &lsc);
  12564. + val = lsc & (~BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB);
  12565. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, val);
  12566. ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  12567. ++ val);
  12568. +
  12569. ++ /* Watchdog reset */
  12570. + brcmf_pcie_select_core(devinfo, BCMA_CORE_CHIPCOMMON);
  12571. + WRITECC32(devinfo, watchdog, 4);
  12572. + msleep(100);
  12573. +
  12574. ++ /* Restore ASPM */
  12575. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12576. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12577. +- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  12578. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, lsc);
  12579. ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  12580. ++ lsc);
  12581. +
  12582. +- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12583. +- for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  12584. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12585. +- cfg_offset[i]);
  12586. +- val = brcmf_pcie_read_reg32(devinfo,
  12587. +- BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  12588. +- brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  12589. +- cfg_offset[i], val);
  12590. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  12591. +- val);
  12592. ++ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
  12593. ++ if (core->rev <= 13) {
  12594. ++ for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  12595. ++ brcmf_pcie_write_reg32(devinfo,
  12596. ++ BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12597. ++ cfg_offset[i]);
  12598. ++ val = brcmf_pcie_read_reg32(devinfo,
  12599. ++ BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  12600. ++ brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  12601. ++ cfg_offset[i], val);
  12602. ++ brcmf_pcie_write_reg32(devinfo,
  12603. ++ BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  12604. ++ val);
  12605. ++ }
  12606. + }
  12607. + }
  12608. +
  12609. +@@ -519,8 +528,6 @@ static void brcmf_pcie_attach(struct brc
  12610. + u32 config;
  12611. +
  12612. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12613. +- if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0)
  12614. +- brcmf_pcie_reset_device(devinfo);
  12615. + /* BAR1 window may not be sized properly */
  12616. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12617. + brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR, 0x4e0);
  12618. +@@ -1636,6 +1643,23 @@ static int brcmf_pcie_buscoreprep(void *
  12619. + }
  12620. +
  12621. +
  12622. ++static int brcmf_pcie_buscore_reset(void *ctx, struct brcmf_chip *chip)
  12623. ++{
  12624. ++ struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  12625. ++ u32 val;
  12626. ++
  12627. ++ devinfo->ci = chip;
  12628. ++ brcmf_pcie_reset_device(devinfo);
  12629. ++
  12630. ++ val = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  12631. ++ if (val != 0xffffffff)
  12632. ++ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  12633. ++ val);
  12634. ++
  12635. ++ return 0;
  12636. ++}
  12637. ++
  12638. ++
  12639. + static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  12640. + u32 rstvec)
  12641. + {
  12642. +@@ -1647,6 +1671,7 @@ static void brcmf_pcie_buscore_activate(
  12643. +
  12644. + static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  12645. + .prepare = brcmf_pcie_buscoreprep,
  12646. ++ .reset = brcmf_pcie_buscore_reset,
  12647. + .activate = brcmf_pcie_buscore_activate,
  12648. + .read32 = brcmf_pcie_buscore_read32,
  12649. + .write32 = brcmf_pcie_buscore_write32,
  12650. +@@ -1814,7 +1839,6 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  12651. + brcmf_pcie_intr_disable(devinfo);
  12652. +
  12653. + brcmf_detach(&pdev->dev);
  12654. +- brcmf_pcie_reset_device(devinfo);
  12655. +
  12656. + kfree(bus->bus_priv.pcie);
  12657. + kfree(bus->msgbuf->flowrings);
  12658. diff --git a/package/kernel/mac80211/patches/332-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch b/package/kernel/mac80211/patches/332-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  12659. new file mode 100644
  12660. index 0000000..52b7fa9
  12661. --- /dev/null
  12662. +++ b/package/kernel/mac80211/patches/332-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  12663. @@ -0,0 +1,33 @@
  12664. +From: Felix Fietkau <nbd@openwrt.org>
  12665. +Date: Sun, 13 Sep 2015 22:26:10 +0200
  12666. +Subject: [PATCH] ath10k: fix DMA related firmware crashes on multiple devices
  12667. +
  12668. +Some platforms really don't like DMA bursts of 256 bytes, and this
  12669. +causes the firmware to crash when sending beacons.
  12670. +Also, changing this based on the firmware version does not seem to make
  12671. +much sense, so use 128 bytes for all versions.
  12672. +
  12673. +Cc: stable@vger.kernel.org
  12674. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  12675. +---
  12676. +
  12677. +--- a/drivers/net/wireless/ath/ath10k/hw.h
  12678. ++++ b/drivers/net/wireless/ath/ath10k/hw.h
  12679. +@@ -340,7 +340,7 @@ enum ath10k_hw_rate_cck {
  12680. + #define TARGET_10X_MAX_FRAG_ENTRIES 0
  12681. +
  12682. + /* 10.2 parameters */
  12683. +-#define TARGET_10_2_DMA_BURST_SIZE 1
  12684. ++#define TARGET_10_2_DMA_BURST_SIZE 0
  12685. +
  12686. + /* Target specific defines for WMI-TLV firmware */
  12687. + #define TARGET_TLV_NUM_VDEVS 4
  12688. +@@ -397,7 +397,7 @@ enum ath10k_hw_rate_cck {
  12689. +
  12690. + #define TARGET_10_4_TX_DBG_LOG_SIZE 1024
  12691. + #define TARGET_10_4_NUM_WDS_ENTRIES 32
  12692. +-#define TARGET_10_4_DMA_BURST_SIZE 1
  12693. ++#define TARGET_10_4_DMA_BURST_SIZE 0
  12694. + #define TARGET_10_4_MAC_AGGR_DELIM 0
  12695. + #define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
  12696. + #define TARGET_10_4_VOW_CONFIG 0
  12697. 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
  12698. deleted file mode 100644
  12699. index 3ce4428..0000000
  12700. --- a/package/kernel/mac80211/patches/332-ath9k-ath9k_hw_analog_shift_rmw-use-REG_RMW.patch
  12701. +++ /dev/null
  12702. @@ -1,27 +0,0 @@
  12703. -From: Oleksij Rempel <linux@rempel-privat.de>
  12704. -Date: Sun, 22 Mar 2015 19:29:59 +0100
  12705. -Subject: [PATCH] ath9k: ath9k_hw_analog_shift_rmw: use REG_RMW
  12706. -
  12707. -use REG_RMW in ath9k_hw_analog_shift_rmw.
  12708. -It will double execution speed on usb bus.
  12709. -
  12710. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12711. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12712. ----
  12713. -
  12714. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  12715. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  12716. -@@ -27,12 +27,7 @@ void ath9k_hw_analog_shift_regwrite(stru
  12717. - void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask,
  12718. - u32 shift, u32 val)
  12719. - {
  12720. -- u32 regVal;
  12721. --
  12722. -- regVal = REG_READ(ah, reg) & ~mask;
  12723. -- regVal |= (val << shift) & mask;
  12724. --
  12725. -- REG_WRITE(ah, reg, regVal);
  12726. -+ REG_RMW(ah, reg, ((val << shift) & mask), mask);
  12727. -
  12728. - if (ah->config.analog_shiftreg)
  12729. - udelay(100);
  12730. diff --git a/package/kernel/mac80211/patches/333-ath9k-enable-hw-manual-peak-calibration-for-QCA9561.patch b/package/kernel/mac80211/patches/333-ath9k-enable-hw-manual-peak-calibration-for-QCA9561.patch
  12731. new file mode 100644
  12732. index 0000000..faf6cdc
  12733. --- /dev/null
  12734. +++ b/package/kernel/mac80211/patches/333-ath9k-enable-hw-manual-peak-calibration-for-QCA9561.patch
  12735. @@ -0,0 +1,33 @@
  12736. +From: Miaoqing Pan <miaoqing@qca.qualcomm.com>
  12737. +Date: Tue, 1 Sep 2015 10:56:09 +0800
  12738. +Subject: [PATCH] ath9k: enable hw manual peak calibration for QCA9561
  12739. +
  12740. +This patch fix https://lists.openwrt.org/pipermail/openwrt-devel/
  12741. +2015-August/034979.html. As the peak detect calibration is set
  12742. +incorrectly.
  12743. +
  12744. +Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
  12745. +---
  12746. +
  12747. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  12748. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  12749. +@@ -1249,7 +1249,8 @@ static void ar9003_hw_manual_peak_cal(st
  12750. + REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain),
  12751. + AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR, 0x0);
  12752. +
  12753. +- if (AR_SREV_9003_PCOEM(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
  12754. ++ if (AR_SREV_9003_PCOEM(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah) ||
  12755. ++ AR_SREV_9561(ah)) {
  12756. + if (is_2g)
  12757. + REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain),
  12758. + AR_PHY_65NM_RXRF_AGC_AGC2G_DBDAC_OVR,
  12759. +@@ -1640,7 +1641,8 @@ static bool ar9003_hw_init_cal_soc(struc
  12760. +
  12761. + skip_tx_iqcal:
  12762. + if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) {
  12763. +- if (AR_SREV_9330_11(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) {
  12764. ++ if (AR_SREV_9330_11(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah) ||
  12765. ++ AR_SREV_9561(ah)) {
  12766. + for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  12767. + if (!(ah->rxchainmask & (1 << i)))
  12768. + continue;
  12769. 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
  12770. deleted file mode 100644
  12771. index 8f12b36..0000000
  12772. --- a/package/kernel/mac80211/patches/333-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_4k_set_.patch
  12773. +++ /dev/null
  12774. @@ -1,47 +0,0 @@
  12775. -From: Oleksij Rempel <linux@rempel-privat.de>
  12776. -Date: Sun, 22 Mar 2015 19:30:01 +0100
  12777. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  12778. - ath9k_hw_4k_set_gain
  12779. -
  12780. -it is possible to reduce time needed for this function
  12781. -by rplacing REG_WRITE with REG_RMW (plus dummy 0) and putt all commands
  12782. -in same buffer.
  12783. -
  12784. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12785. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12786. ----
  12787. -
  12788. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12789. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12790. -@@ -772,15 +772,14 @@ static void ath9k_hw_4k_set_gain(struct
  12791. - struct ar5416_eeprom_4k *eep,
  12792. - u8 txRxAttenLocal)
  12793. - {
  12794. -- REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0,
  12795. -- pModal->antCtrlChain[0]);
  12796. --
  12797. -- REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0),
  12798. -- (REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) &
  12799. -- ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
  12800. -- AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
  12801. -- SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  12802. -- SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
  12803. -+ ENABLE_REG_RMW_BUFFER(ah);
  12804. -+ REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0,
  12805. -+ pModal->antCtrlChain[0], 0);
  12806. -+
  12807. -+ REG_RMW(ah, AR_PHY_TIMING_CTRL4(0),
  12808. -+ SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  12809. -+ SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF),
  12810. -+ AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF);
  12811. -
  12812. - if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
  12813. - AR5416_EEP_MINOR_VER_3) {
  12814. -@@ -819,6 +818,7 @@ static void ath9k_hw_4k_set_gain(struct
  12815. - AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
  12816. - REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
  12817. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]);
  12818. -+ REG_RMW_BUFFER_FLUSH(ah);
  12819. - }
  12820. -
  12821. - /*
  12822. 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
  12823. deleted file mode 100644
  12824. index f26e059..0000000
  12825. --- a/package/kernel/mac80211/patches/334-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_def_set.patch
  12826. +++ /dev/null
  12827. @@ -1,67 +0,0 @@
  12828. -From: Oleksij Rempel <linux@rempel-privat.de>
  12829. -Date: Sun, 22 Mar 2015 19:30:03 +0100
  12830. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  12831. - ath9k_hw_def_set_gain
  12832. -
  12833. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12834. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12835. ----
  12836. -
  12837. ---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
  12838. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
  12839. -@@ -466,6 +466,7 @@ static void ath9k_hw_def_set_gain(struct
  12840. - struct ar5416_eeprom_def *eep,
  12841. - u8 txRxAttenLocal, int regChainOffset, int i)
  12842. - {
  12843. -+ ENABLE_REG_RMW_BUFFER(ah);
  12844. - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
  12845. - txRxAttenLocal = pModal->txRxAttenCh[i];
  12846. -
  12847. -@@ -483,16 +484,12 @@ static void ath9k_hw_def_set_gain(struct
  12848. - AR_PHY_GAIN_2GHZ_XATTEN2_DB,
  12849. - pModal->xatten2Db[i]);
  12850. - } else {
  12851. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  12852. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  12853. -- ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
  12854. -- | SM(pModal-> bswMargin[i],
  12855. -- AR_PHY_GAIN_2GHZ_BSW_MARGIN));
  12856. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  12857. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  12858. -- ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
  12859. -- | SM(pModal->bswAtten[i],
  12860. -- AR_PHY_GAIN_2GHZ_BSW_ATTEN));
  12861. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  12862. -+ SM(pModal-> bswMargin[i], AR_PHY_GAIN_2GHZ_BSW_MARGIN),
  12863. -+ AR_PHY_GAIN_2GHZ_BSW_MARGIN);
  12864. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  12865. -+ SM(pModal->bswAtten[i], AR_PHY_GAIN_2GHZ_BSW_ATTEN),
  12866. -+ AR_PHY_GAIN_2GHZ_BSW_ATTEN);
  12867. - }
  12868. - }
  12869. -
  12870. -@@ -504,17 +501,14 @@ static void ath9k_hw_def_set_gain(struct
  12871. - AR_PHY_RXGAIN + regChainOffset,
  12872. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]);
  12873. - } else {
  12874. -- REG_WRITE(ah,
  12875. -- AR_PHY_RXGAIN + regChainOffset,
  12876. -- (REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) &
  12877. -- ~AR_PHY_RXGAIN_TXRX_ATTEN)
  12878. -- | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN));
  12879. -- REG_WRITE(ah,
  12880. -- AR_PHY_GAIN_2GHZ + regChainOffset,
  12881. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  12882. -- ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
  12883. -- SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
  12884. -+ REG_RMW(ah, AR_PHY_RXGAIN + regChainOffset,
  12885. -+ SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN),
  12886. -+ AR_PHY_RXGAIN_TXRX_ATTEN);
  12887. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  12888. -+ SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN),
  12889. -+ AR_PHY_GAIN_2GHZ_RXTX_MARGIN);
  12890. - }
  12891. -+ REG_RMW_BUFFER_FLUSH(ah);
  12892. - }
  12893. -
  12894. - static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
  12895. diff --git a/package/kernel/mac80211/patches/334-mac80211-fix-tx-sequence-number-assignment-with-soft.patch b/package/kernel/mac80211/patches/334-mac80211-fix-tx-sequence-number-assignment-with-soft.patch
  12896. new file mode 100644
  12897. index 0000000..b19e7ee
  12898. --- /dev/null
  12899. +++ b/package/kernel/mac80211/patches/334-mac80211-fix-tx-sequence-number-assignment-with-soft.patch
  12900. @@ -0,0 +1,23 @@
  12901. +From: Felix Fietkau <nbd@openwrt.org>
  12902. +Date: Thu, 24 Sep 2015 14:10:07 +0200
  12903. +Subject: [PATCH] mac80211: fix tx sequence number assignment with software
  12904. + queue + fast-xmit
  12905. +
  12906. +When using software queueing, tx sequence number assignment happens at
  12907. +ieee80211_tx_dequeue time, so the fast-xmit codepath must not do that.
  12908. +
  12909. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  12910. +---
  12911. +
  12912. +--- a/net/mac80211/tx.c
  12913. ++++ b/net/mac80211/tx.c
  12914. +@@ -2766,7 +2766,8 @@ static bool ieee80211_xmit_fast(struct i
  12915. +
  12916. + if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
  12917. + *ieee80211_get_qos_ctl(hdr) = tid;
  12918. +- hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid);
  12919. ++ if (!sta->sta.txq[0])
  12920. ++ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid);
  12921. + } else {
  12922. + info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
  12923. + hdr->seq_ctrl = cpu_to_le16(sdata->sequence_number);
  12924. 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
  12925. deleted file mode 100644
  12926. index 5e63a80..0000000
  12927. --- a/package/kernel/mac80211/patches/335-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch
  12928. +++ /dev/null
  12929. @@ -1,44 +0,0 @@
  12930. -From: Hante Meuleman <meuleman@broadcom.com>
  12931. -Date: Fri, 6 Mar 2015 18:40:38 +0100
  12932. -Subject: [PATCH] brcmfmac: Fix oops when SDIO device is removed.
  12933. -
  12934. -On removal of SDIO card both functions of card will be getting
  12935. -a remove call. When the first is hanging in ctrl frame xmit then
  12936. -the second will cause oops. This patch fixes the xmit ctrl
  12937. -handling in case of serious errors and also limits the handling
  12938. -for remove to function 1 only.
  12939. -
  12940. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12941. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12942. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12943. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  12944. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12945. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12946. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12947. ----
  12948. -
  12949. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  12950. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  12951. -@@ -1194,7 +1194,7 @@ static void brcmf_ops_sdio_remove(struct
  12952. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  12953. - brcmf_dbg(SDIO, "Function: %d\n", func->num);
  12954. -
  12955. -- if (func->num != 1 && func->num != 2)
  12956. -+ if (func->num != 1)
  12957. - return;
  12958. -
  12959. - bus_if = dev_get_drvdata(&func->dev);
  12960. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12961. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12962. -@@ -2740,6 +2740,11 @@ static void brcmf_sdio_dpc(struct brcmf_
  12963. - if ((bus->sdiodev->state != BRCMF_SDIOD_DATA) || (err != 0)) {
  12964. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  12965. - atomic_set(&bus->intstatus, 0);
  12966. -+ if (bus->ctrl_frame_stat) {
  12967. -+ bus->ctrl_frame_err = -ENODEV;
  12968. -+ bus->ctrl_frame_stat = false;
  12969. -+ brcmf_sdio_wait_event_wakeup(bus);
  12970. -+ }
  12971. - } else if (atomic_read(&bus->intstatus) ||
  12972. - atomic_read(&bus->ipend) > 0 ||
  12973. - (!atomic_read(&bus->fcstate) &&
  12974. diff --git a/package/kernel/mac80211/patches/335-mac80211-fix-handling-of-PS-filtering-with-fast-xmit.patch b/package/kernel/mac80211/patches/335-mac80211-fix-handling-of-PS-filtering-with-fast-xmit.patch
  12975. new file mode 100644
  12976. index 0000000..7aef205
  12977. --- /dev/null
  12978. +++ b/package/kernel/mac80211/patches/335-mac80211-fix-handling-of-PS-filtering-with-fast-xmit.patch
  12979. @@ -0,0 +1,45 @@
  12980. +From: Felix Fietkau <nbd@openwrt.org>
  12981. +Date: Thu, 24 Sep 2015 14:11:40 +0200
  12982. +Subject: [PATCH] mac80211: fix handling of PS filtering with fast-xmit
  12983. +
  12984. +Fixes dropped packets in the tx path in case a non-PS station triggers
  12985. +the tx filter.
  12986. +
  12987. +Cc: stable@vger.kernel.org # 4.2
  12988. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  12989. +---
  12990. +
  12991. +--- a/net/mac80211/status.c
  12992. ++++ b/net/mac80211/status.c
  12993. +@@ -101,6 +101,7 @@ static void ieee80211_handle_filtered_fr
  12994. + * when it wakes up for the next time.
  12995. + */
  12996. + set_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT);
  12997. ++ ieee80211_clear_fast_xmit(sta);
  12998. +
  12999. + /*
  13000. + * This code races in the following way:
  13001. +--- a/net/mac80211/tx.c
  13002. ++++ b/net/mac80211/tx.c
  13003. +@@ -1217,8 +1217,10 @@ ieee80211_tx_prepare(struct ieee80211_su
  13004. +
  13005. + if (!tx->sta)
  13006. + info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  13007. +- else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT))
  13008. ++ else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT)) {
  13009. + info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  13010. ++ ieee80211_check_fast_xmit(tx->sta);
  13011. ++ }
  13012. +
  13013. + info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT;
  13014. +
  13015. +@@ -2450,7 +2452,8 @@ void ieee80211_check_fast_xmit(struct st
  13016. +
  13017. + if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
  13018. + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
  13019. +- test_sta_flag(sta, WLAN_STA_PS_DELIVER))
  13020. ++ test_sta_flag(sta, WLAN_STA_PS_DELIVER) ||
  13021. ++ test_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT))
  13022. + goto out;
  13023. +
  13024. + if (sdata->noack_map)
  13025. diff --git a/package/kernel/mac80211/patches/336-ath9k-declare-required-extra-tx-headroom.patch b/package/kernel/mac80211/patches/336-ath9k-declare-required-extra-tx-headroom.patch
  13026. new file mode 100644
  13027. index 0000000..4d88591
  13028. --- /dev/null
  13029. +++ b/package/kernel/mac80211/patches/336-ath9k-declare-required-extra-tx-headroom.patch
  13030. @@ -0,0 +1,22 @@
  13031. +From: Felix Fietkau <nbd@openwrt.org>
  13032. +Date: Thu, 24 Sep 2015 16:57:37 +0200
  13033. +Subject: [PATCH] ath9k: declare required extra tx headroom
  13034. +
  13035. +ath9k inserts padding between the 802.11 header and the data area (to
  13036. +align it). Since it didn't declare this extra required headroom, this
  13037. +led to some nasty issues like randomly dropped packets in some setups.
  13038. +
  13039. +Cc: stable@vger.kernel.org
  13040. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  13041. +---
  13042. +
  13043. +--- a/drivers/net/wireless/ath/ath9k/init.c
  13044. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  13045. +@@ -875,6 +875,7 @@ static void ath9k_set_hw_capab(struct at
  13046. + hw->max_rate_tries = 10;
  13047. + hw->sta_data_size = sizeof(struct ath_node);
  13048. + hw->vif_data_size = sizeof(struct ath_vif);
  13049. ++ hw->extra_tx_headroom = 4;
  13050. +
  13051. + hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  13052. + hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
  13053. diff --git a/package/kernel/mac80211/patches/336-brcmfmac-Simplify-watchdog-sleep.patch b/package/kernel/mac80211/patches/336-brcmfmac-Simplify-watchdog-sleep.patch
  13054. deleted file mode 100644
  13055. index 201da75..0000000
  13056. --- a/package/kernel/mac80211/patches/336-brcmfmac-Simplify-watchdog-sleep.patch
  13057. +++ /dev/null
  13058. @@ -1,157 +0,0 @@
  13059. -From: Hante Meuleman <meuleman@broadcom.com>
  13060. -Date: Fri, 6 Mar 2015 18:40:39 +0100
  13061. -Subject: [PATCH] brcmfmac: Simplify watchdog sleep.
  13062. -
  13063. -The watchdog thread is used to put the SDIO bus to sleep when the
  13064. -system is idling. This patch simplifies the way it is determined
  13065. -when sleep can be entered.
  13066. -
  13067. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13068. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13069. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13070. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13071. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13072. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13073. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13074. ----
  13075. -
  13076. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13077. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13078. -@@ -485,10 +485,9 @@ struct brcmf_sdio {
  13079. - #endif /* DEBUG */
  13080. -
  13081. - uint clkstate; /* State of sd and backplane clock(s) */
  13082. -- bool activity; /* Activity flag for clock down */
  13083. - s32 idletime; /* Control for activity timeout */
  13084. -- s32 idlecount; /* Activity timeout counter */
  13085. -- s32 idleclock; /* How to set bus driver when idle */
  13086. -+ s32 idlecount; /* Activity timeout counter */
  13087. -+ s32 idleclock; /* How to set bus driver when idle */
  13088. - bool rxflow_mode; /* Rx flow control mode */
  13089. - bool rxflow; /* Is rx flow control on */
  13090. - bool alp_only; /* Don't use HT clock (ALP only) */
  13091. -@@ -511,6 +510,7 @@ struct brcmf_sdio {
  13092. - struct workqueue_struct *brcmf_wq;
  13093. - struct work_struct datawork;
  13094. - atomic_t dpc_tskcnt;
  13095. -+ atomic_t dpc_running;
  13096. -
  13097. - bool txoff; /* Transmit flow-controlled */
  13098. - struct brcmf_sdio_count sdcnt;
  13099. -@@ -959,13 +959,8 @@ static int brcmf_sdio_clkctl(struct brcm
  13100. - brcmf_dbg(SDIO, "Enter\n");
  13101. -
  13102. - /* Early exit if we're already there */
  13103. -- if (bus->clkstate == target) {
  13104. -- if (target == CLK_AVAIL) {
  13105. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  13106. -- bus->activity = true;
  13107. -- }
  13108. -+ if (bus->clkstate == target)
  13109. - return 0;
  13110. -- }
  13111. -
  13112. - switch (target) {
  13113. - case CLK_AVAIL:
  13114. -@@ -975,7 +970,6 @@ static int brcmf_sdio_clkctl(struct brcm
  13115. - /* Now request HT Avail on the backplane */
  13116. - brcmf_sdio_htclk(bus, true, pendok);
  13117. - brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  13118. -- bus->activity = true;
  13119. - break;
  13120. -
  13121. - case CLK_SDONLY:
  13122. -@@ -1024,17 +1018,6 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  13123. -
  13124. - /* Going to sleep */
  13125. - if (sleep) {
  13126. -- /* Don't sleep if something is pending */
  13127. -- if (atomic_read(&bus->intstatus) ||
  13128. -- atomic_read(&bus->ipend) > 0 ||
  13129. -- bus->ctrl_frame_stat ||
  13130. -- (!atomic_read(&bus->fcstate) &&
  13131. -- brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  13132. -- data_ok(bus))) {
  13133. -- err = -EBUSY;
  13134. -- goto done;
  13135. -- }
  13136. --
  13137. - clkcsr = brcmf_sdiod_regrb(bus->sdiodev,
  13138. - SBSDIO_FUNC1_CHIPCLKCSR,
  13139. - &err);
  13140. -@@ -1045,11 +1028,7 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  13141. - SBSDIO_ALP_AVAIL_REQ, &err);
  13142. - }
  13143. - err = brcmf_sdio_kso_control(bus, false);
  13144. -- /* disable watchdog */
  13145. -- if (!err)
  13146. -- brcmf_sdio_wd_timer(bus, 0);
  13147. - } else {
  13148. -- bus->idlecount = 0;
  13149. - err = brcmf_sdio_kso_control(bus, true);
  13150. - }
  13151. - if (err) {
  13152. -@@ -3566,7 +3545,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  13153. - queue_work(bus->brcmf_wq, &bus->datawork);
  13154. - }
  13155. -
  13156. --static bool brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  13157. -+static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  13158. - {
  13159. - brcmf_dbg(TIMER, "Enter\n");
  13160. -
  13161. -@@ -3627,22 +3606,21 @@ static bool brcmf_sdio_bus_watchdog(stru
  13162. - #endif /* DEBUG */
  13163. -
  13164. - /* On idle timeout clear activity flag and/or turn off clock */
  13165. -- if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  13166. -- if (++bus->idlecount >= bus->idletime) {
  13167. -+ if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  13168. -+ (atomic_read(&bus->dpc_running) == 0) &&
  13169. -+ (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  13170. -+ bus->idlecount++;
  13171. -+ if (bus->idlecount > bus->idletime) {
  13172. -+ brcmf_dbg(SDIO, "idle\n");
  13173. -+ sdio_claim_host(bus->sdiodev->func[1]);
  13174. -+ brcmf_sdio_wd_timer(bus, 0);
  13175. - bus->idlecount = 0;
  13176. -- if (bus->activity) {
  13177. -- bus->activity = false;
  13178. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  13179. -- } else {
  13180. -- brcmf_dbg(SDIO, "idle\n");
  13181. -- sdio_claim_host(bus->sdiodev->func[1]);
  13182. -- brcmf_sdio_bus_sleep(bus, true, false);
  13183. -- sdio_release_host(bus->sdiodev->func[1]);
  13184. -- }
  13185. -+ brcmf_sdio_bus_sleep(bus, true, false);
  13186. -+ sdio_release_host(bus->sdiodev->func[1]);
  13187. - }
  13188. -+ } else {
  13189. -+ bus->idlecount = 0;
  13190. - }
  13191. --
  13192. -- return (atomic_read(&bus->ipend) > 0);
  13193. - }
  13194. -
  13195. - static void brcmf_sdio_dataworker(struct work_struct *work)
  13196. -@@ -3651,8 +3629,11 @@ static void brcmf_sdio_dataworker(struct
  13197. - datawork);
  13198. -
  13199. - while (atomic_read(&bus->dpc_tskcnt)) {
  13200. -+ atomic_set(&bus->dpc_running, 1);
  13201. - atomic_set(&bus->dpc_tskcnt, 0);
  13202. - brcmf_sdio_dpc(bus);
  13203. -+ bus->idlecount = 0;
  13204. -+ atomic_set(&bus->dpc_running, 0);
  13205. - }
  13206. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  13207. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  13208. -@@ -4154,6 +4135,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  13209. - }
  13210. - /* Initialize DPC thread */
  13211. - atomic_set(&bus->dpc_tskcnt, 0);
  13212. -+ atomic_set(&bus->dpc_running, 0);
  13213. -
  13214. - /* Assign bus interface call back */
  13215. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  13216. 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
  13217. deleted file mode 100644
  13218. index 3a2de7a..0000000
  13219. --- a/package/kernel/mac80211/patches/337-brcmfmac-Fix-possible-race-condition.patch
  13220. +++ /dev/null
  13221. @@ -1,83 +0,0 @@
  13222. -From: Hante Meuleman <meuleman@broadcom.com>
  13223. -Date: Fri, 6 Mar 2015 18:40:40 +0100
  13224. -Subject: [PATCH] brcmfmac: Fix possible race-condition.
  13225. -
  13226. -SDIO is using a "shared" variable to handoff ctl frames to DPC
  13227. -and to see when they are done. In a timeout situation this can
  13228. -lead to erroneous situation where DPC started to handle the ctl
  13229. -frame while the timeout expired. This patch will fix this by
  13230. -adding locking around the shared variable.
  13231. -
  13232. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13233. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13234. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13235. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13236. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13237. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13238. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13239. ----
  13240. -
  13241. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13242. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13243. -@@ -2700,11 +2700,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  13244. - if (bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL) &&
  13245. - data_ok(bus)) {
  13246. - sdio_claim_host(bus->sdiodev->func[1]);
  13247. -- err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  13248. -- bus->ctrl_frame_len);
  13249. -+ if (bus->ctrl_frame_stat) {
  13250. -+ err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  13251. -+ bus->ctrl_frame_len);
  13252. -+ bus->ctrl_frame_err = err;
  13253. -+ bus->ctrl_frame_stat = false;
  13254. -+ }
  13255. - sdio_release_host(bus->sdiodev->func[1]);
  13256. -- bus->ctrl_frame_err = err;
  13257. -- bus->ctrl_frame_stat = false;
  13258. - brcmf_sdio_wait_event_wakeup(bus);
  13259. - }
  13260. - /* Send queued frames (limit 1 if rx may still be pending) */
  13261. -@@ -2720,9 +2722,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  13262. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  13263. - atomic_set(&bus->intstatus, 0);
  13264. - if (bus->ctrl_frame_stat) {
  13265. -- bus->ctrl_frame_err = -ENODEV;
  13266. -- bus->ctrl_frame_stat = false;
  13267. -- brcmf_sdio_wait_event_wakeup(bus);
  13268. -+ sdio_claim_host(bus->sdiodev->func[1]);
  13269. -+ if (bus->ctrl_frame_stat) {
  13270. -+ bus->ctrl_frame_err = -ENODEV;
  13271. -+ bus->ctrl_frame_stat = false;
  13272. -+ brcmf_sdio_wait_event_wakeup(bus);
  13273. -+ }
  13274. -+ sdio_release_host(bus->sdiodev->func[1]);
  13275. - }
  13276. - } else if (atomic_read(&bus->intstatus) ||
  13277. - atomic_read(&bus->ipend) > 0 ||
  13278. -@@ -2930,15 +2936,20 @@ brcmf_sdio_bus_txctl(struct device *dev,
  13279. - brcmf_sdio_trigger_dpc(bus);
  13280. - wait_event_interruptible_timeout(bus->ctrl_wait, !bus->ctrl_frame_stat,
  13281. - msecs_to_jiffies(CTL_DONE_TIMEOUT));
  13282. --
  13283. -- if (!bus->ctrl_frame_stat) {
  13284. -+ ret = 0;
  13285. -+ if (bus->ctrl_frame_stat) {
  13286. -+ sdio_claim_host(bus->sdiodev->func[1]);
  13287. -+ if (bus->ctrl_frame_stat) {
  13288. -+ brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  13289. -+ bus->ctrl_frame_stat = false;
  13290. -+ ret = -ETIMEDOUT;
  13291. -+ }
  13292. -+ sdio_release_host(bus->sdiodev->func[1]);
  13293. -+ }
  13294. -+ if (!ret) {
  13295. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  13296. - bus->ctrl_frame_err);
  13297. - ret = bus->ctrl_frame_err;
  13298. -- } else {
  13299. -- brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  13300. -- bus->ctrl_frame_stat = false;
  13301. -- ret = -ETIMEDOUT;
  13302. - }
  13303. -
  13304. - if (ret)
  13305. diff --git a/package/kernel/mac80211/patches/337-nl80211-put-current-TX-power-in-interface-info.patch b/package/kernel/mac80211/patches/337-nl80211-put-current-TX-power-in-interface-info.patch
  13306. new file mode 100644
  13307. index 0000000..df2cc4b
  13308. --- /dev/null
  13309. +++ b/package/kernel/mac80211/patches/337-nl80211-put-current-TX-power-in-interface-info.patch
  13310. @@ -0,0 +1,37 @@
  13311. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  13312. +Date: Mon, 31 Aug 2015 22:59:38 +0200
  13313. +Subject: [PATCH] nl80211: put current TX power in interface info
  13314. +MIME-Version: 1.0
  13315. +Content-Type: text/plain; charset=UTF-8
  13316. +Content-Transfer-Encoding: 8bit
  13317. +
  13318. +Many drivers implement reading current TX power (using either cfg80211
  13319. +or ieee80211 op) but userspace can't get it using nl80211. Right now the
  13320. +only way to access it is to call some wext ioctl.
  13321. +Let's put TX power in interface info reply (callback is wdev specific)
  13322. +just like we do with current channel.
  13323. +To be consistent (e.g. NL80211_CMD_SET_WIPHY) let's use mBm as na unit.
  13324. +
  13325. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13326. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  13327. +---
  13328. +
  13329. +--- a/net/wireless/nl80211.c
  13330. ++++ b/net/wireless/nl80211.c
  13331. +@@ -2406,6 +2406,16 @@ static int nl80211_send_iface(struct sk_
  13332. + }
  13333. + }
  13334. +
  13335. ++ if (rdev->ops->get_tx_power) {
  13336. ++ int dbm, ret;
  13337. ++
  13338. ++ ret = rdev_get_tx_power(rdev, wdev, &dbm);
  13339. ++ if (ret == 0 &&
  13340. ++ nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
  13341. ++ DBM_TO_MBM(dbm)))
  13342. ++ goto nla_put_failure;
  13343. ++ }
  13344. ++
  13345. + if (wdev->ssid_len) {
  13346. + if (nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid))
  13347. + goto nla_put_failure;
  13348. 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
  13349. deleted file mode 100644
  13350. index c9eb900..0000000
  13351. --- a/package/kernel/mac80211/patches/338-brcmfmac-Add-support-for-BCM4345-SDIO-chipset.patch
  13352. +++ /dev/null
  13353. @@ -1,86 +0,0 @@
  13354. -From: Syed Asifful Dayyan <syedd@broadcom.com>
  13355. -Date: Fri, 6 Mar 2015 18:40:42 +0100
  13356. -Subject: [PATCH] brcmfmac: Add support for BCM4345 SDIO chipset.
  13357. -
  13358. -These changes add support for BCM4345 SDIO chipset.
  13359. -
  13360. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13361. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13362. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13363. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13364. -Signed-off-by: Syed Asifful Dayyan <syedd@broadcom.com>
  13365. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13366. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13367. ----
  13368. -
  13369. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13370. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13371. -@@ -1096,6 +1096,7 @@ static const struct sdio_device_id brcmf
  13372. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  13373. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  13374. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  13375. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  13376. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  13377. - { /* end: all zeroes */ }
  13378. - };
  13379. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13380. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13381. -@@ -491,6 +491,10 @@ static void brcmf_chip_get_raminfo(struc
  13382. - case BRCM_CC_43362_CHIP_ID:
  13383. - ci->pub.ramsize = 0x3c000;
  13384. - break;
  13385. -+ case BRCM_CC_4345_CHIP_ID:
  13386. -+ ci->pub.ramsize = 0xc8000;
  13387. -+ ci->pub.rambase = 0x198000;
  13388. -+ break;
  13389. - case BRCM_CC_4339_CHIP_ID:
  13390. - case BRCM_CC_4354_CHIP_ID:
  13391. - case BRCM_CC_4356_CHIP_ID:
  13392. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13393. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13394. -@@ -617,6 +617,8 @@ static const struct sdiod_drive_str sdio
  13395. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  13396. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  13397. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  13398. -+#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  13399. -+#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  13400. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  13401. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  13402. -
  13403. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  13404. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  13405. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  13406. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  13407. -+MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  13408. -+MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  13409. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  13410. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  13411. -
  13412. -@@ -669,6 +673,7 @@ static const struct brcmf_firmware_names
  13413. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  13414. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  13415. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  13416. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  13417. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  13418. - };
  13419. -
  13420. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  13421. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  13422. -@@ -37,6 +37,7 @@
  13423. - #define BRCM_CC_43362_CHIP_ID 43362
  13424. - #define BRCM_CC_4335_CHIP_ID 0x4335
  13425. - #define BRCM_CC_4339_CHIP_ID 0x4339
  13426. -+#define BRCM_CC_4345_CHIP_ID 0x4345
  13427. - #define BRCM_CC_4354_CHIP_ID 0x4354
  13428. - #define BRCM_CC_4356_CHIP_ID 0x4356
  13429. - #define BRCM_CC_43566_CHIP_ID 43566
  13430. ---- a/include/linux/mmc/sdio_ids.h
  13431. -+++ b/include/linux/mmc/sdio_ids.h
  13432. -@@ -33,6 +33,7 @@
  13433. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  13434. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  13435. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  13436. -+#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  13437. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  13438. -
  13439. - #define SDIO_VENDOR_ID_INTEL 0x0089
  13440. diff --git a/package/kernel/mac80211/patches/338-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch b/package/kernel/mac80211/patches/338-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  13441. new file mode 100644
  13442. index 0000000..2f492e0
  13443. --- /dev/null
  13444. +++ b/package/kernel/mac80211/patches/338-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  13445. @@ -0,0 +1,21 @@
  13446. +From: Felix Fietkau <nbd@openwrt.org>
  13447. +Date: Mon, 5 Oct 2015 17:41:25 +0200
  13448. +Subject: [PATCH] mac80211: initialize tid field in struct ieee80211_txq
  13449. +
  13450. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  13451. +---
  13452. +
  13453. +--- a/net/mac80211/util.c
  13454. ++++ b/net/mac80211/util.c
  13455. +@@ -3288,9 +3288,11 @@ void ieee80211_init_tx_queue(struct ieee
  13456. + if (sta) {
  13457. + txqi->txq.sta = &sta->sta;
  13458. + sta->sta.txq[tid] = &txqi->txq;
  13459. ++ txqi->txq.tid = tid;
  13460. + txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  13461. + } else {
  13462. + sdata->vif.txq = &txqi->txq;
  13463. ++ txqi->txq.tid = 0;
  13464. + txqi->txq.ac = IEEE80211_AC_BE;
  13465. + }
  13466. + }
  13467. 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
  13468. deleted file mode 100644
  13469. index 7a688c4..0000000
  13470. --- a/package/kernel/mac80211/patches/339-brcmfmac-remove-duplication-of-ramsize-info.patch
  13471. +++ /dev/null
  13472. @@ -1,48 +0,0 @@
  13473. -From: Arend van Spriel <arend@broadcom.com>
  13474. -Date: Wed, 11 Mar 2015 16:11:27 +0100
  13475. -Subject: [PATCH] brcmfmac: remove duplication of ramsize info
  13476. -
  13477. -Removing the ramsize from the brcmf_sdio structure to avoid
  13478. -duplication. The information is available in brcmf_chip
  13479. -structure.
  13480. -
  13481. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13482. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13483. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13484. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13485. ----
  13486. -
  13487. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13488. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13489. -@@ -432,8 +432,6 @@ struct brcmf_sdio {
  13490. - struct brcmf_sdio_dev *sdiodev; /* sdio device handler */
  13491. - struct brcmf_chip *ci; /* Chip info struct */
  13492. -
  13493. -- u32 ramsize; /* Size of RAM in SOCRAM (bytes) */
  13494. --
  13495. - u32 hostintmask; /* Copy of Host Interrupt Mask */
  13496. - atomic_t intstatus; /* Intstatus bits (events) pending */
  13497. - atomic_t fcstate; /* State of dongle flow-control */
  13498. -@@ -1075,7 +1073,7 @@ static int brcmf_sdio_readshared(struct
  13499. - struct sdpcm_shared_le sh_le;
  13500. - __le32 addr_le;
  13501. -
  13502. -- shaddr = bus->ci->rambase + bus->ramsize - 4;
  13503. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  13504. -
  13505. - /*
  13506. - * Read last word in socram to determine
  13507. -@@ -3871,13 +3869,6 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  13508. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  13509. - brcmf_sdio_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength);
  13510. -
  13511. -- /* Get info on the SOCRAM cores... */
  13512. -- bus->ramsize = bus->ci->ramsize;
  13513. -- if (!(bus->ramsize)) {
  13514. -- brcmf_err("failed to find SOCRAM memory!\n");
  13515. -- goto fail;
  13516. -- }
  13517. --
  13518. - /* Set card control so an SDIO card reset does a WLAN backplane reset */
  13519. - reg_val = brcmf_sdiod_regrb(bus->sdiodev,
  13520. - SDIO_CCCR_BRCM_CARDCTRL, &err);
  13521. 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
  13522. deleted file mode 100644
  13523. index e2a2074..0000000
  13524. --- a/package/kernel/mac80211/patches/340-brcmfmac-always-perform-cores-checks.patch
  13525. +++ /dev/null
  13526. @@ -1,74 +0,0 @@
  13527. -From: Arend van Spriel <arend@broadcom.com>
  13528. -Date: Wed, 11 Mar 2015 16:11:28 +0100
  13529. -Subject: [PATCH] brcmfmac: always perform cores checks
  13530. -
  13531. -Instead of checking the cores in the chip only if CONFIG_BRCMDBG
  13532. -is selected perform the check always and extend it with more sanity
  13533. -checking.
  13534. -
  13535. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13536. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13537. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13538. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13539. ----
  13540. -
  13541. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13542. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13543. -@@ -419,13 +419,13 @@ static struct brcmf_core *brcmf_chip_add
  13544. - return &core->pub;
  13545. - }
  13546. -
  13547. --#ifdef DEBUG
  13548. - /* safety check for chipinfo */
  13549. - static int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  13550. - {
  13551. - struct brcmf_core_priv *core;
  13552. - bool need_socram = false;
  13553. - bool has_socram = false;
  13554. -+ bool cpu_found = false;
  13555. - int idx = 1;
  13556. -
  13557. - list_for_each_entry(core, &ci->cores, list) {
  13558. -@@ -435,12 +435,14 @@ static int brcmf_chip_cores_check(struct
  13559. -
  13560. - switch (core->pub.id) {
  13561. - case BCMA_CORE_ARM_CM3:
  13562. -+ cpu_found = true;
  13563. - need_socram = true;
  13564. - break;
  13565. - case BCMA_CORE_INTERNAL_MEM:
  13566. - has_socram = true;
  13567. - break;
  13568. - case BCMA_CORE_ARM_CR4:
  13569. -+ cpu_found = true;
  13570. - if (ci->pub.rambase == 0) {
  13571. - brcmf_err("RAM base not provided with ARM CR4 core\n");
  13572. - return -ENOMEM;
  13573. -@@ -451,19 +453,21 @@ static int brcmf_chip_cores_check(struct
  13574. - }
  13575. - }
  13576. -
  13577. -+ if (!cpu_found) {
  13578. -+ brcmf_err("CPU core not detected\n");
  13579. -+ return -ENXIO;
  13580. -+ }
  13581. - /* check RAM core presence for ARM CM3 core */
  13582. - if (need_socram && !has_socram) {
  13583. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  13584. - return -ENODEV;
  13585. - }
  13586. -+ if (!ci->pub.ramsize) {
  13587. -+ brcmf_err("RAM size is undetermined\n");
  13588. -+ return -ENOMEM;
  13589. -+ }
  13590. - return 0;
  13591. - }
  13592. --#else /* DEBUG */
  13593. --static inline int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  13594. --{
  13595. -- return 0;
  13596. --}
  13597. --#endif
  13598. -
  13599. - static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  13600. - {
  13601. 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
  13602. deleted file mode 100644
  13603. index a272800..0000000
  13604. --- a/package/kernel/mac80211/patches/341-brcmfmac-rename-chip-download-functions.patch
  13605. +++ /dev/null
  13606. @@ -1,240 +0,0 @@
  13607. -From: Arend van Spriel <arend@broadcom.com>
  13608. -Date: Wed, 11 Mar 2015 16:11:29 +0100
  13609. -Subject: [PATCH] brcmfmac: rename chip download functions
  13610. -
  13611. -The functions brcmf_chip_[enter/exit]_download() are not exclusively
  13612. -used for firmware download so rename these more appropriate.
  13613. -
  13614. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13615. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13616. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13617. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13618. ----
  13619. -
  13620. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13621. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13622. -@@ -807,7 +807,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  13623. - err = -EINVAL;
  13624. - if (WARN_ON(!ops->prepare))
  13625. - err = -EINVAL;
  13626. -- if (WARN_ON(!ops->exit_dl))
  13627. -+ if (WARN_ON(!ops->activate))
  13628. - err = -EINVAL;
  13629. - if (err < 0)
  13630. - return ERR_PTR(-EINVAL);
  13631. -@@ -905,7 +905,7 @@ void brcmf_chip_resetcore(struct brcmf_c
  13632. - }
  13633. -
  13634. - static void
  13635. --brcmf_chip_cm3_enterdl(struct brcmf_chip_priv *chip)
  13636. -+brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  13637. - {
  13638. - struct brcmf_core *core;
  13639. -
  13640. -@@ -919,7 +919,7 @@ brcmf_chip_cm3_enterdl(struct brcmf_chip
  13641. - brcmf_chip_resetcore(core, 0, 0, 0);
  13642. - }
  13643. -
  13644. --static bool brcmf_chip_cm3_exitdl(struct brcmf_chip_priv *chip)
  13645. -+static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  13646. - {
  13647. - struct brcmf_core *core;
  13648. -
  13649. -@@ -929,7 +929,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  13650. - return false;
  13651. - }
  13652. -
  13653. -- chip->ops->exit_dl(chip->ctx, &chip->pub, 0);
  13654. -+ chip->ops->activate(chip->ctx, &chip->pub, 0);
  13655. -
  13656. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CM3);
  13657. - brcmf_chip_resetcore(core, 0, 0, 0);
  13658. -@@ -938,7 +938,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  13659. - }
  13660. -
  13661. - static inline void
  13662. --brcmf_chip_cr4_enterdl(struct brcmf_chip_priv *chip)
  13663. -+brcmf_chip_cr4_set_passive(struct brcmf_chip_priv *chip)
  13664. - {
  13665. - struct brcmf_core *core;
  13666. -
  13667. -@@ -951,11 +951,11 @@ brcmf_chip_cr4_enterdl(struct brcmf_chip
  13668. - D11_BCMA_IOCTL_PHYCLOCKEN);
  13669. - }
  13670. -
  13671. --static bool brcmf_chip_cr4_exitdl(struct brcmf_chip_priv *chip, u32 rstvec)
  13672. -+static bool brcmf_chip_cr4_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
  13673. - {
  13674. - struct brcmf_core *core;
  13675. -
  13676. -- chip->ops->exit_dl(chip->ctx, &chip->pub, rstvec);
  13677. -+ chip->ops->activate(chip->ctx, &chip->pub, rstvec);
  13678. -
  13679. - /* restore ARM */
  13680. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CR4);
  13681. -@@ -964,7 +964,7 @@ static bool brcmf_chip_cr4_exitdl(struct
  13682. - return true;
  13683. - }
  13684. -
  13685. --void brcmf_chip_enter_download(struct brcmf_chip *pub)
  13686. -+void brcmf_chip_set_passive(struct brcmf_chip *pub)
  13687. - {
  13688. - struct brcmf_chip_priv *chip;
  13689. - struct brcmf_core *arm;
  13690. -@@ -974,14 +974,14 @@ void brcmf_chip_enter_download(struct br
  13691. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  13692. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  13693. - if (arm) {
  13694. -- brcmf_chip_cr4_enterdl(chip);
  13695. -+ brcmf_chip_cr4_set_passive(chip);
  13696. - return;
  13697. - }
  13698. -
  13699. -- brcmf_chip_cm3_enterdl(chip);
  13700. -+ brcmf_chip_cm3_set_passive(chip);
  13701. - }
  13702. -
  13703. --bool brcmf_chip_exit_download(struct brcmf_chip *pub, u32 rstvec)
  13704. -+bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
  13705. - {
  13706. - struct brcmf_chip_priv *chip;
  13707. - struct brcmf_core *arm;
  13708. -@@ -991,9 +991,9 @@ bool brcmf_chip_exit_download(struct brc
  13709. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  13710. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  13711. - if (arm)
  13712. -- return brcmf_chip_cr4_exitdl(chip, rstvec);
  13713. -+ return brcmf_chip_cr4_set_active(chip, rstvec);
  13714. -
  13715. -- return brcmf_chip_cm3_exitdl(chip);
  13716. -+ return brcmf_chip_cm3_set_active(chip);
  13717. - }
  13718. -
  13719. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
  13720. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  13721. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  13722. -@@ -64,7 +64,7 @@ struct brcmf_core {
  13723. - * @write32: write 32-bit value over bus.
  13724. - * @prepare: prepare bus for core configuration.
  13725. - * @setup: bus-specific core setup.
  13726. -- * @exit_dl: exit download state.
  13727. -+ * @active: chip becomes active.
  13728. - * The callback should use the provided @rstvec when non-zero.
  13729. - */
  13730. - struct brcmf_buscore_ops {
  13731. -@@ -72,7 +72,7 @@ struct brcmf_buscore_ops {
  13732. - void (*write32)(void *ctx, u32 addr, u32 value);
  13733. - int (*prepare)(void *ctx);
  13734. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  13735. -- void (*exit_dl)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  13736. -+ void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  13737. - };
  13738. -
  13739. - struct brcmf_chip *brcmf_chip_attach(void *ctx,
  13740. -@@ -84,8 +84,8 @@ bool brcmf_chip_iscoreup(struct brcmf_co
  13741. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  13742. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  13743. - u32 postreset);
  13744. --void brcmf_chip_enter_download(struct brcmf_chip *ci);
  13745. --bool brcmf_chip_exit_download(struct brcmf_chip *ci, u32 rstvec);
  13746. -+void brcmf_chip_set_passive(struct brcmf_chip *ci);
  13747. -+bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec);
  13748. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub);
  13749. -
  13750. - #endif /* BRCMF_AXIDMP_H */
  13751. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13752. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13753. -@@ -509,7 +509,7 @@ static void brcmf_pcie_attach(struct brc
  13754. -
  13755. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  13756. - {
  13757. -- brcmf_chip_enter_download(devinfo->ci);
  13758. -+ brcmf_chip_set_passive(devinfo->ci);
  13759. -
  13760. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  13761. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  13762. -@@ -536,7 +536,7 @@ static int brcmf_pcie_exit_download_stat
  13763. - brcmf_chip_resetcore(core, 0, 0, 0);
  13764. - }
  13765. -
  13766. -- return !brcmf_chip_exit_download(devinfo->ci, resetintr);
  13767. -+ return !brcmf_chip_set_active(devinfo->ci, resetintr);
  13768. - }
  13769. -
  13770. -
  13771. -@@ -1566,8 +1566,8 @@ static int brcmf_pcie_buscoreprep(void *
  13772. - }
  13773. -
  13774. -
  13775. --static void brcmf_pcie_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  13776. -- u32 rstvec)
  13777. -+static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  13778. -+ u32 rstvec)
  13779. - {
  13780. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  13781. -
  13782. -@@ -1577,7 +1577,7 @@ static void brcmf_pcie_buscore_exitdl(vo
  13783. -
  13784. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  13785. - .prepare = brcmf_pcie_buscoreprep,
  13786. -- .exit_dl = brcmf_pcie_buscore_exitdl,
  13787. -+ .activate = brcmf_pcie_buscore_activate,
  13788. - .read32 = brcmf_pcie_buscore_read32,
  13789. - .write32 = brcmf_pcie_buscore_write32,
  13790. - };
  13791. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13792. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13793. -@@ -3357,7 +3357,7 @@ static int brcmf_sdio_download_firmware(
  13794. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  13795. -
  13796. - /* Keep arm in reset */
  13797. -- brcmf_chip_enter_download(bus->ci);
  13798. -+ brcmf_chip_set_passive(bus->ci);
  13799. -
  13800. - rstvec = get_unaligned_le32(fw->data);
  13801. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  13802. -@@ -3378,7 +3378,7 @@ static int brcmf_sdio_download_firmware(
  13803. - }
  13804. -
  13805. - /* Take arm out of reset */
  13806. -- if (!brcmf_chip_exit_download(bus->ci, rstvec)) {
  13807. -+ if (!brcmf_chip_set_active(bus->ci, rstvec)) {
  13808. - brcmf_err("error getting out of ARM core reset\n");
  13809. - goto err;
  13810. - }
  13811. -@@ -3771,8 +3771,8 @@ static int brcmf_sdio_buscoreprep(void *
  13812. - return 0;
  13813. - }
  13814. -
  13815. --static void brcmf_sdio_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  13816. -- u32 rstvec)
  13817. -+static void brcmf_sdio_buscore_activate(void *ctx, struct brcmf_chip *chip,
  13818. -+ u32 rstvec)
  13819. - {
  13820. - struct brcmf_sdio_dev *sdiodev = ctx;
  13821. - struct brcmf_core *core;
  13822. -@@ -3815,7 +3815,7 @@ static void brcmf_sdio_buscore_write32(v
  13823. -
  13824. - static const struct brcmf_buscore_ops brcmf_sdio_buscore_ops = {
  13825. - .prepare = brcmf_sdio_buscoreprep,
  13826. -- .exit_dl = brcmf_sdio_buscore_exitdl,
  13827. -+ .activate = brcmf_sdio_buscore_activate,
  13828. - .read32 = brcmf_sdio_buscore_read32,
  13829. - .write32 = brcmf_sdio_buscore_write32,
  13830. - };
  13831. -@@ -4239,12 +4239,11 @@ void brcmf_sdio_remove(struct brcmf_sdio
  13832. - sdio_claim_host(bus->sdiodev->func[1]);
  13833. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  13834. - /* Leave the device in state where it is
  13835. -- * 'quiet'. This is done by putting it in
  13836. -- * download_state which essentially resets
  13837. -- * all necessary cores.
  13838. -+ * 'passive'. This is done by resetting all
  13839. -+ * necessary cores.
  13840. - */
  13841. - msleep(20);
  13842. -- brcmf_chip_enter_download(bus->ci);
  13843. -+ brcmf_chip_set_passive(bus->ci);
  13844. - brcmf_sdio_clkctl(bus, CLK_NONE, false);
  13845. - sdio_release_host(bus->sdiodev->func[1]);
  13846. - }
  13847. 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
  13848. deleted file mode 100644
  13849. index 6b1dd81..0000000
  13850. --- a/package/kernel/mac80211/patches/342-brcmfmac-assure-device-is-ready-for-download-after-b.patch
  13851. +++ /dev/null
  13852. @@ -1,61 +0,0 @@
  13853. -From: Arend van Spriel <arend@broadcom.com>
  13854. -Date: Wed, 11 Mar 2015 16:11:30 +0100
  13855. -Subject: [PATCH] brcmfmac: assure device is ready for download after
  13856. - brcmf_chip_attach()
  13857. -
  13858. -Make the brcmf_chip_attach() function responsible for putting the
  13859. -device in a state where it is accessible for firmware download.
  13860. -
  13861. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13862. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13863. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13864. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13865. ----
  13866. -
  13867. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13868. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13869. -@@ -786,12 +786,6 @@ static int brcmf_chip_setup(struct brcmf
  13870. - if (chip->ops->setup)
  13871. - ret = chip->ops->setup(chip->ctx, pub);
  13872. -
  13873. -- /*
  13874. -- * Make sure any on-chip ARM is off (in case strapping is wrong),
  13875. -- * or downloaded code was already running.
  13876. -- */
  13877. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  13878. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CR4);
  13879. - return ret;
  13880. - }
  13881. -
  13882. -@@ -833,6 +827,8 @@ struct brcmf_chip *brcmf_chip_attach(voi
  13883. - if (err < 0)
  13884. - goto fail;
  13885. -
  13886. -+ /* assure chip is passive for download */
  13887. -+ brcmf_chip_set_passive(&chip->pub);
  13888. - return &chip->pub;
  13889. -
  13890. - fail:
  13891. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13892. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13893. -@@ -509,8 +509,6 @@ static void brcmf_pcie_attach(struct brc
  13894. -
  13895. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  13896. - {
  13897. -- brcmf_chip_set_passive(devinfo->ci);
  13898. --
  13899. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  13900. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  13901. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_ARMCR4REG_BANKIDX,
  13902. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13903. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13904. -@@ -3356,9 +3356,6 @@ static int brcmf_sdio_download_firmware(
  13905. - sdio_claim_host(bus->sdiodev->func[1]);
  13906. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  13907. -
  13908. -- /* Keep arm in reset */
  13909. -- brcmf_chip_set_passive(bus->ci);
  13910. --
  13911. - rstvec = get_unaligned_le32(fw->data);
  13912. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  13913. -
  13914. 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
  13915. deleted file mode 100644
  13916. index bcc2ed4..0000000
  13917. --- a/package/kernel/mac80211/patches/343-brcmfmac-extract-ram-size-info-from-internal-memory-.patch
  13918. +++ /dev/null
  13919. @@ -1,367 +0,0 @@
  13920. -From: Arend van Spriel <arend@broadcom.com>
  13921. -Date: Wed, 11 Mar 2015 16:11:31 +0100
  13922. -Subject: [PATCH] brcmfmac: extract ram size info from internal memory
  13923. - registers
  13924. -
  13925. -Instead of hard-coded memory sizes it is possible to obtain that
  13926. -information from the internal memory registers.
  13927. -
  13928. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13929. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13930. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13931. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13932. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13933. ----
  13934. -
  13935. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13936. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13937. -@@ -100,9 +100,6 @@
  13938. - #define BCM4329_CORE_SOCRAM_BASE 0x18003000
  13939. - /* ARM Cortex M3 core, ID 0x82a */
  13940. - #define BCM4329_CORE_ARM_BASE 0x18002000
  13941. --#define BCM4329_RAMSIZE 0x48000
  13942. --/* bcm43143 */
  13943. --#define BCM43143_RAMSIZE 0x70000
  13944. -
  13945. - #define CORE_SB(base, field) \
  13946. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  13947. -@@ -150,6 +147,78 @@ struct sbconfig {
  13948. - u32 sbidhigh; /* identification */
  13949. - };
  13950. -
  13951. -+/* bankidx and bankinfo reg defines corerev >= 8 */
  13952. -+#define SOCRAM_BANKINFO_RETNTRAM_MASK 0x00010000
  13953. -+#define SOCRAM_BANKINFO_SZMASK 0x0000007f
  13954. -+#define SOCRAM_BANKIDX_ROM_MASK 0x00000100
  13955. -+
  13956. -+#define SOCRAM_BANKIDX_MEMTYPE_SHIFT 8
  13957. -+/* socram bankinfo memtype */
  13958. -+#define SOCRAM_MEMTYPE_RAM 0
  13959. -+#define SOCRAM_MEMTYPE_R0M 1
  13960. -+#define SOCRAM_MEMTYPE_DEVRAM 2
  13961. -+
  13962. -+#define SOCRAM_BANKINFO_SZBASE 8192
  13963. -+#define SRCI_LSS_MASK 0x00f00000
  13964. -+#define SRCI_LSS_SHIFT 20
  13965. -+#define SRCI_SRNB_MASK 0xf0
  13966. -+#define SRCI_SRNB_SHIFT 4
  13967. -+#define SRCI_SRBSZ_MASK 0xf
  13968. -+#define SRCI_SRBSZ_SHIFT 0
  13969. -+#define SR_BSZ_BASE 14
  13970. -+
  13971. -+struct sbsocramregs {
  13972. -+ u32 coreinfo;
  13973. -+ u32 bwalloc;
  13974. -+ u32 extracoreinfo;
  13975. -+ u32 biststat;
  13976. -+ u32 bankidx;
  13977. -+ u32 standbyctrl;
  13978. -+
  13979. -+ u32 errlogstatus; /* rev 6 */
  13980. -+ u32 errlogaddr; /* rev 6 */
  13981. -+ /* used for patching rev 3 & 5 */
  13982. -+ u32 cambankidx;
  13983. -+ u32 cambankstandbyctrl;
  13984. -+ u32 cambankpatchctrl;
  13985. -+ u32 cambankpatchtblbaseaddr;
  13986. -+ u32 cambankcmdreg;
  13987. -+ u32 cambankdatareg;
  13988. -+ u32 cambankmaskreg;
  13989. -+ u32 PAD[1];
  13990. -+ u32 bankinfo; /* corev 8 */
  13991. -+ u32 bankpda;
  13992. -+ u32 PAD[14];
  13993. -+ u32 extmemconfig;
  13994. -+ u32 extmemparitycsr;
  13995. -+ u32 extmemparityerrdata;
  13996. -+ u32 extmemparityerrcnt;
  13997. -+ u32 extmemwrctrlandsize;
  13998. -+ u32 PAD[84];
  13999. -+ u32 workaround;
  14000. -+ u32 pwrctl; /* corerev >= 2 */
  14001. -+ u32 PAD[133];
  14002. -+ u32 sr_control; /* corerev >= 15 */
  14003. -+ u32 sr_status; /* corerev >= 15 */
  14004. -+ u32 sr_address; /* corerev >= 15 */
  14005. -+ u32 sr_data; /* corerev >= 15 */
  14006. -+};
  14007. -+
  14008. -+#define SOCRAMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  14009. -+
  14010. -+#define ARMCR4_CAP (0x04)
  14011. -+#define ARMCR4_BANKIDX (0x40)
  14012. -+#define ARMCR4_BANKINFO (0x44)
  14013. -+#define ARMCR4_BANKPDA (0x4C)
  14014. -+
  14015. -+#define ARMCR4_TCBBNB_MASK 0xf0
  14016. -+#define ARMCR4_TCBBNB_SHIFT 4
  14017. -+#define ARMCR4_TCBANB_MASK 0xf
  14018. -+#define ARMCR4_TCBANB_SHIFT 0
  14019. -+
  14020. -+#define ARMCR4_BSZ_MASK 0x3f
  14021. -+#define ARMCR4_BSZ_MULT 8192
  14022. -+
  14023. - struct brcmf_core_priv {
  14024. - struct brcmf_core pub;
  14025. - u32 wrapbase;
  14026. -@@ -443,10 +512,6 @@ static int brcmf_chip_cores_check(struct
  14027. - break;
  14028. - case BCMA_CORE_ARM_CR4:
  14029. - cpu_found = true;
  14030. -- if (ci->pub.rambase == 0) {
  14031. -- brcmf_err("RAM base not provided with ARM CR4 core\n");
  14032. -- return -ENOMEM;
  14033. -- }
  14034. - break;
  14035. - default:
  14036. - break;
  14037. -@@ -462,60 +527,160 @@ static int brcmf_chip_cores_check(struct
  14038. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  14039. - return -ENODEV;
  14040. - }
  14041. -- if (!ci->pub.ramsize) {
  14042. -- brcmf_err("RAM size is undetermined\n");
  14043. -- return -ENOMEM;
  14044. -- }
  14045. - return 0;
  14046. - }
  14047. -
  14048. --static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  14049. -+static u32 brcmf_chip_core_read32(struct brcmf_core_priv *core, u16 reg)
  14050. - {
  14051. -- switch (ci->pub.chip) {
  14052. -- case BRCM_CC_4329_CHIP_ID:
  14053. -- ci->pub.ramsize = BCM4329_RAMSIZE;
  14054. -- break;
  14055. -- case BRCM_CC_43143_CHIP_ID:
  14056. -- ci->pub.ramsize = BCM43143_RAMSIZE;
  14057. -- break;
  14058. -- case BRCM_CC_43241_CHIP_ID:
  14059. -- ci->pub.ramsize = 0x90000;
  14060. -- break;
  14061. -- case BRCM_CC_4330_CHIP_ID:
  14062. -- ci->pub.ramsize = 0x48000;
  14063. -- break;
  14064. -+ return core->chip->ops->read32(core->chip->ctx, core->pub.base + reg);
  14065. -+}
  14066. -+
  14067. -+static void brcmf_chip_core_write32(struct brcmf_core_priv *core,
  14068. -+ u16 reg, u32 val)
  14069. -+{
  14070. -+ core->chip->ops->write32(core->chip->ctx, core->pub.base + reg, val);
  14071. -+}
  14072. -+
  14073. -+static bool brcmf_chip_socram_banksize(struct brcmf_core_priv *core, u8 idx,
  14074. -+ u32 *banksize)
  14075. -+{
  14076. -+ u32 bankinfo;
  14077. -+ u32 bankidx = (SOCRAM_MEMTYPE_RAM << SOCRAM_BANKIDX_MEMTYPE_SHIFT);
  14078. -+
  14079. -+ bankidx |= idx;
  14080. -+ brcmf_chip_core_write32(core, SOCRAMREGOFFS(bankidx), bankidx);
  14081. -+ bankinfo = brcmf_chip_core_read32(core, SOCRAMREGOFFS(bankinfo));
  14082. -+ *banksize = (bankinfo & SOCRAM_BANKINFO_SZMASK) + 1;
  14083. -+ *banksize *= SOCRAM_BANKINFO_SZBASE;
  14084. -+ return !!(bankinfo & SOCRAM_BANKINFO_RETNTRAM_MASK);
  14085. -+}
  14086. -+
  14087. -+static void brcmf_chip_socram_ramsize(struct brcmf_core_priv *sr, u32 *ramsize,
  14088. -+ u32 *srsize)
  14089. -+{
  14090. -+ u32 coreinfo;
  14091. -+ uint nb, banksize, lss;
  14092. -+ bool retent;
  14093. -+ int i;
  14094. -+
  14095. -+ *ramsize = 0;
  14096. -+ *srsize = 0;
  14097. -+
  14098. -+ if (WARN_ON(sr->pub.rev < 4))
  14099. -+ return;
  14100. -+
  14101. -+ if (!brcmf_chip_iscoreup(&sr->pub))
  14102. -+ brcmf_chip_resetcore(&sr->pub, 0, 0, 0);
  14103. -+
  14104. -+ /* Get info for determining size */
  14105. -+ coreinfo = brcmf_chip_core_read32(sr, SOCRAMREGOFFS(coreinfo));
  14106. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  14107. -+
  14108. -+ if ((sr->pub.rev <= 7) || (sr->pub.rev == 12)) {
  14109. -+ banksize = (coreinfo & SRCI_SRBSZ_MASK);
  14110. -+ lss = (coreinfo & SRCI_LSS_MASK) >> SRCI_LSS_SHIFT;
  14111. -+ if (lss != 0)
  14112. -+ nb--;
  14113. -+ *ramsize = nb * (1 << (banksize + SR_BSZ_BASE));
  14114. -+ if (lss != 0)
  14115. -+ *ramsize += (1 << ((lss - 1) + SR_BSZ_BASE));
  14116. -+ } else {
  14117. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  14118. -+ for (i = 0; i < nb; i++) {
  14119. -+ retent = brcmf_chip_socram_banksize(sr, i, &banksize);
  14120. -+ *ramsize += banksize;
  14121. -+ if (retent)
  14122. -+ *srsize += banksize;
  14123. -+ }
  14124. -+ }
  14125. -+
  14126. -+ /* hardcoded save&restore memory sizes */
  14127. -+ switch (sr->chip->pub.chip) {
  14128. - case BRCM_CC_4334_CHIP_ID:
  14129. -- case BRCM_CC_43340_CHIP_ID:
  14130. -- ci->pub.ramsize = 0x80000;
  14131. -+ if (sr->chip->pub.chiprev < 2)
  14132. -+ *srsize = (32 * 1024);
  14133. - break;
  14134. -- case BRCM_CC_4335_CHIP_ID:
  14135. -- ci->pub.ramsize = 0xc0000;
  14136. -- ci->pub.rambase = 0x180000;
  14137. -- break;
  14138. -- case BRCM_CC_43362_CHIP_ID:
  14139. -- ci->pub.ramsize = 0x3c000;
  14140. -+ default:
  14141. - break;
  14142. -+ }
  14143. -+}
  14144. -+
  14145. -+/** Return the TCM-RAM size of the ARMCR4 core. */
  14146. -+static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
  14147. -+{
  14148. -+ u32 corecap;
  14149. -+ u32 memsize = 0;
  14150. -+ u32 nab;
  14151. -+ u32 nbb;
  14152. -+ u32 totb;
  14153. -+ u32 bxinfo;
  14154. -+ u32 idx;
  14155. -+
  14156. -+ corecap = brcmf_chip_core_read32(cr4, ARMCR4_CAP);
  14157. -+
  14158. -+ nab = (corecap & ARMCR4_TCBANB_MASK) >> ARMCR4_TCBANB_SHIFT;
  14159. -+ nbb = (corecap & ARMCR4_TCBBNB_MASK) >> ARMCR4_TCBBNB_SHIFT;
  14160. -+ totb = nab + nbb;
  14161. -+
  14162. -+ for (idx = 0; idx < totb; idx++) {
  14163. -+ brcmf_chip_core_write32(cr4, ARMCR4_BANKIDX, idx);
  14164. -+ bxinfo = brcmf_chip_core_read32(cr4, ARMCR4_BANKINFO);
  14165. -+ memsize += ((bxinfo & ARMCR4_BSZ_MASK) + 1) * ARMCR4_BSZ_MULT;
  14166. -+ }
  14167. -+
  14168. -+ return memsize;
  14169. -+}
  14170. -+
  14171. -+static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
  14172. -+{
  14173. -+ switch (ci->pub.chip) {
  14174. - case BRCM_CC_4345_CHIP_ID:
  14175. -- ci->pub.ramsize = 0xc8000;
  14176. -- ci->pub.rambase = 0x198000;
  14177. -- break;
  14178. -+ return 0x198000;
  14179. -+ case BRCM_CC_4335_CHIP_ID:
  14180. - case BRCM_CC_4339_CHIP_ID:
  14181. - case BRCM_CC_4354_CHIP_ID:
  14182. - case BRCM_CC_4356_CHIP_ID:
  14183. - case BRCM_CC_43567_CHIP_ID:
  14184. - case BRCM_CC_43569_CHIP_ID:
  14185. - case BRCM_CC_43570_CHIP_ID:
  14186. -- ci->pub.ramsize = 0xc0000;
  14187. -- ci->pub.rambase = 0x180000;
  14188. -- break;
  14189. - case BRCM_CC_43602_CHIP_ID:
  14190. -- ci->pub.ramsize = 0xf0000;
  14191. -- ci->pub.rambase = 0x180000;
  14192. -- break;
  14193. -+ return 0x180000;
  14194. - default:
  14195. - brcmf_err("unknown chip: %s\n", ci->pub.name);
  14196. - break;
  14197. - }
  14198. -+ return 0;
  14199. -+}
  14200. -+
  14201. -+static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  14202. -+{
  14203. -+ struct brcmf_core_priv *mem_core;
  14204. -+ struct brcmf_core *mem;
  14205. -+
  14206. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_ARM_CR4);
  14207. -+ if (mem) {
  14208. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  14209. -+ ci->pub.ramsize = brcmf_chip_tcm_ramsize(mem_core);
  14210. -+ ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
  14211. -+ if (!ci->pub.rambase) {
  14212. -+ brcmf_err("RAM base not provided with ARM CR4 core\n");
  14213. -+ return -EINVAL;
  14214. -+ }
  14215. -+ } else {
  14216. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_INTERNAL_MEM);
  14217. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  14218. -+ brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  14219. -+ &ci->pub.srsize);
  14220. -+ }
  14221. -+ brcmf_dbg(INFO, "RAM: base=0x%x size=%d (0x%x) sr=%d (0x%x)\n",
  14222. -+ ci->pub.rambase, ci->pub.ramsize, ci->pub.ramsize,
  14223. -+ ci->pub.srsize, ci->pub.srsize);
  14224. -+
  14225. -+ if (!ci->pub.ramsize) {
  14226. -+ brcmf_err("RAM size is undetermined\n");
  14227. -+ return -ENOMEM;
  14228. -+ }
  14229. -+ return 0;
  14230. - }
  14231. -
  14232. - static u32 brcmf_chip_dmp_get_desc(struct brcmf_chip_priv *ci, u32 *eromaddr,
  14233. -@@ -668,6 +833,7 @@ static int brcmf_chip_recognition(struct
  14234. - struct brcmf_core *core;
  14235. - u32 regdata;
  14236. - u32 socitype;
  14237. -+ int ret;
  14238. -
  14239. - /* Get CC core rev
  14240. - * Chipid is assume to be at offset 0 from SI_ENUM_BASE
  14241. -@@ -720,9 +886,13 @@ static int brcmf_chip_recognition(struct
  14242. - return -ENODEV;
  14243. - }
  14244. -
  14245. -- brcmf_chip_get_raminfo(ci);
  14246. --
  14247. -- return brcmf_chip_cores_check(ci);
  14248. -+ ret = brcmf_chip_cores_check(ci);
  14249. -+ if (ret)
  14250. -+ return ret;
  14251. -+
  14252. -+ /* assure chip is passive for core access */
  14253. -+ brcmf_chip_set_passive(&ci->pub);
  14254. -+ return brcmf_chip_get_raminfo(ci);
  14255. - }
  14256. -
  14257. - static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id)
  14258. -@@ -827,8 +997,6 @@ struct brcmf_chip *brcmf_chip_attach(voi
  14259. - if (err < 0)
  14260. - goto fail;
  14261. -
  14262. -- /* assure chip is passive for download */
  14263. -- brcmf_chip_set_passive(&chip->pub);
  14264. - return &chip->pub;
  14265. -
  14266. - fail:
  14267. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  14268. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  14269. -@@ -30,7 +30,8 @@
  14270. - * @pmucaps: PMU capabilities.
  14271. - * @pmurev: PMU revision.
  14272. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  14273. -- * @ramsize: amount of RAM on chip.
  14274. -+ * @ramsize: amount of RAM on chip including retention.
  14275. -+ * @srsize: amount of retention RAM on chip.
  14276. - * @name: string representation of the chip identifier.
  14277. - */
  14278. - struct brcmf_chip {
  14279. -@@ -41,6 +42,7 @@ struct brcmf_chip {
  14280. - u32 pmurev;
  14281. - u32 rambase;
  14282. - u32 ramsize;
  14283. -+ u32 srsize;
  14284. - char name[8];
  14285. - };
  14286. -
  14287. 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
  14288. deleted file mode 100644
  14289. index 69618a7..0000000
  14290. --- a/package/kernel/mac80211/patches/344-brcmfmac-take-save-restore-memory-into-account-for-S.patch
  14291. +++ /dev/null
  14292. @@ -1,96 +0,0 @@
  14293. -From: Arend van Spriel <arend@broadcom.com>
  14294. -Date: Wed, 11 Mar 2015 16:11:32 +0100
  14295. -Subject: [PATCH] brcmfmac: take save&restore memory into account for SDIO
  14296. - shared info
  14297. -
  14298. -The firmware provides pointer to SDIO shared information at end of
  14299. -RAM during firmware initialization. End of RAM is obviously determined
  14300. -by the actual ram size, but part of that may be used for save&restore
  14301. -memory. In that case another location in RAM will hold the pointer.
  14302. -
  14303. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14304. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14305. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14306. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14307. ----
  14308. -
  14309. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14310. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14311. -@@ -1067,44 +1067,47 @@ static inline bool brcmf_sdio_valid_shar
  14312. - static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
  14313. - struct sdpcm_shared *sh)
  14314. - {
  14315. -- u32 addr;
  14316. -+ u32 addr = 0;
  14317. - int rv;
  14318. - u32 shaddr = 0;
  14319. - struct sdpcm_shared_le sh_le;
  14320. - __le32 addr_le;
  14321. -
  14322. -- shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  14323. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14324. -+ brcmf_sdio_bus_sleep(bus, false, false);
  14325. -
  14326. - /*
  14327. - * Read last word in socram to determine
  14328. - * address of sdpcm_shared structure
  14329. - */
  14330. -- sdio_claim_host(bus->sdiodev->func[1]);
  14331. -- brcmf_sdio_bus_sleep(bus, false, false);
  14332. -- rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4);
  14333. -- sdio_release_host(bus->sdiodev->func[1]);
  14334. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  14335. -+ if (!bus->ci->rambase && brcmf_chip_sr_capable(bus->ci))
  14336. -+ shaddr -= bus->ci->srsize;
  14337. -+ rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr,
  14338. -+ (u8 *)&addr_le, 4);
  14339. - if (rv < 0)
  14340. -- return rv;
  14341. --
  14342. -- addr = le32_to_cpu(addr_le);
  14343. --
  14344. -- brcmf_dbg(SDIO, "sdpcm_shared address 0x%08X\n", addr);
  14345. -+ goto fail;
  14346. -
  14347. - /*
  14348. - * Check if addr is valid.
  14349. - * NVRAM length at the end of memory should have been overwritten.
  14350. - */
  14351. -+ addr = le32_to_cpu(addr_le);
  14352. - if (!brcmf_sdio_valid_shared_address(addr)) {
  14353. -- brcmf_err("invalid sdpcm_shared address 0x%08X\n",
  14354. -- addr);
  14355. -- return -EINVAL;
  14356. -+ brcmf_err("invalid sdpcm_shared address 0x%08X\n", addr);
  14357. -+ rv = -EINVAL;
  14358. -+ goto fail;
  14359. - }
  14360. -
  14361. -+ brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr);
  14362. -+
  14363. - /* Read hndrte_shared structure */
  14364. - rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, (u8 *)&sh_le,
  14365. - sizeof(struct sdpcm_shared_le));
  14366. - if (rv < 0)
  14367. -- return rv;
  14368. -+ goto fail;
  14369. -+
  14370. -+ sdio_release_host(bus->sdiodev->func[1]);
  14371. -
  14372. - /* Endianness */
  14373. - sh->flags = le32_to_cpu(sh_le.flags);
  14374. -@@ -1121,8 +1124,13 @@ static int brcmf_sdio_readshared(struct
  14375. - sh->flags & SDPCM_SHARED_VERSION_MASK);
  14376. - return -EPROTO;
  14377. - }
  14378. --
  14379. - return 0;
  14380. -+
  14381. -+fail:
  14382. -+ brcmf_err("unable to obtain sdpcm_shared info: rv=%d (addr=0x%x)\n",
  14383. -+ rv, addr);
  14384. -+ sdio_release_host(bus->sdiodev->func[1]);
  14385. -+ return rv;
  14386. - }
  14387. -
  14388. - static void brcmf_sdio_get_console_addr(struct brcmf_sdio *bus)
  14389. 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
  14390. deleted file mode 100644
  14391. index 1b10dbb..0000000
  14392. --- a/package/kernel/mac80211/patches/345-brcmfmac-fix-watchdog-timer-regression.patch
  14393. +++ /dev/null
  14394. @@ -1,59 +0,0 @@
  14395. -From: Arend van Spriel <arend@broadcom.com>
  14396. -Date: Wed, 11 Mar 2015 16:11:33 +0100
  14397. -Subject: [PATCH] brcmfmac: fix watchdog timer regression
  14398. -
  14399. -The watchdog timer is used to put the device in a low-power mode when
  14400. -it is idle for some time. This timer is stopped during that mode and
  14401. -should be restarted upon activity. This has been broken by commit
  14402. -d4150fced0365 ("brcmfmac: Simplify watchdog sleep."). This patch
  14403. -restores the behaviour as it was before that commit.
  14404. -
  14405. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  14406. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14407. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14408. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14409. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14410. ----
  14411. -
  14412. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14413. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14414. -@@ -972,7 +972,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14415. - brcmf_sdio_sdclk(bus, true);
  14416. - /* Now request HT Avail on the backplane */
  14417. - brcmf_sdio_htclk(bus, true, pendok);
  14418. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14419. - break;
  14420. -
  14421. - case CLK_SDONLY:
  14422. -@@ -984,7 +983,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14423. - else
  14424. - brcmf_err("request for %d -> %d\n",
  14425. - bus->clkstate, target);
  14426. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14427. - break;
  14428. -
  14429. - case CLK_NONE:
  14430. -@@ -993,7 +991,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14431. - brcmf_sdio_htclk(bus, false, false);
  14432. - /* Now remove the SD clock */
  14433. - brcmf_sdio_sdclk(bus, false);
  14434. -- brcmf_sdio_wd_timer(bus, 0);
  14435. - break;
  14436. - }
  14437. - #ifdef DEBUG
  14438. -@@ -1048,6 +1045,7 @@ end:
  14439. - brcmf_sdio_clkctl(bus, CLK_NONE, pendok);
  14440. - } else {
  14441. - brcmf_sdio_clkctl(bus, CLK_AVAIL, pendok);
  14442. -+ brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14443. - }
  14444. - bus->sleeping = sleep;
  14445. - brcmf_dbg(SDIO, "new state %s\n",
  14446. -@@ -4242,6 +4240,7 @@ void brcmf_sdio_remove(struct brcmf_sdio
  14447. - if (bus->ci) {
  14448. - if (bus->sdiodev->state != BRCMF_SDIOD_NOMEDIUM) {
  14449. - sdio_claim_host(bus->sdiodev->func[1]);
  14450. -+ brcmf_sdio_wd_timer(bus, 0);
  14451. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  14452. - /* Leave the device in state where it is
  14453. - * 'passive'. This is done by resetting all
  14454. 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
  14455. deleted file mode 100644
  14456. index af76f13..0000000
  14457. --- a/package/kernel/mac80211/patches/346-brcmfmac-avoid-runtime-pm-for-sdio-host-controller.patch
  14458. +++ /dev/null
  14459. @@ -1,44 +0,0 @@
  14460. -From: Arend van Spriel <arend@broadcom.com>
  14461. -Date: Wed, 18 Mar 2015 13:25:21 +0100
  14462. -Subject: [PATCH] brcmfmac: avoid runtime-pm for sdio host controller
  14463. -
  14464. -Several host controllers supporting runtime-pm are causing issues
  14465. -with our sdio wireless cards because they disable the sdio interrupt
  14466. -upon going into runtime suspend. This patch avoids that by doing
  14467. -a pm_runtime_forbid() call during the probe. Tested with Sony Vaio
  14468. -Duo 13 which uses sdhci-acpi host controller.
  14469. -
  14470. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14471. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14472. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14473. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14474. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14475. ----
  14476. -
  14477. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14478. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14479. -@@ -29,6 +29,7 @@
  14480. - #include <linux/mmc/host.h>
  14481. - #include <linux/platform_device.h>
  14482. - #include <linux/platform_data/brcmfmac-sdio.h>
  14483. -+#include <linux/pm_runtime.h>
  14484. - #include <linux/suspend.h>
  14485. - #include <linux/errno.h>
  14486. - #include <linux/module.h>
  14487. -@@ -1006,6 +1007,7 @@ static int brcmf_sdiod_remove(struct brc
  14488. - sg_free_table(&sdiodev->sgtable);
  14489. - sdiodev->sbwad = 0;
  14490. -
  14491. -+ pm_runtime_allow(sdiodev->func[1]->card->host->parent);
  14492. - return 0;
  14493. - }
  14494. -
  14495. -@@ -1074,7 +1076,7 @@ static int brcmf_sdiod_probe(struct brcm
  14496. - ret = -ENODEV;
  14497. - goto out;
  14498. - }
  14499. --
  14500. -+ pm_runtime_forbid(host->parent);
  14501. - out:
  14502. - if (ret)
  14503. - brcmf_sdiod_remove(sdiodev);
  14504. 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
  14505. deleted file mode 100644
  14506. index c419cc6..0000000
  14507. --- a/package/kernel/mac80211/patches/347-brcmfmac-Add-necessary-memory-barriers-for-SDIO.patch
  14508. +++ /dev/null
  14509. @@ -1,171 +0,0 @@
  14510. -From: Hante Meuleman <meuleman@broadcom.com>
  14511. -Date: Wed, 18 Mar 2015 13:25:22 +0100
  14512. -Subject: [PATCH] brcmfmac: Add necessary memory barriers for SDIO.
  14513. -
  14514. -SDIO uses a thread to handle all communication with the device,
  14515. -for this data is exchanged between threads. This data needs proper
  14516. -memory barriers to make sure that data "exchange" is going correct.
  14517. -
  14518. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14519. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14520. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14521. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14522. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14523. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14524. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14525. ----
  14526. -
  14527. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14528. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14529. -@@ -507,8 +507,8 @@ struct brcmf_sdio {
  14530. -
  14531. - struct workqueue_struct *brcmf_wq;
  14532. - struct work_struct datawork;
  14533. -- atomic_t dpc_tskcnt;
  14534. -- atomic_t dpc_running;
  14535. -+ bool dpc_triggered;
  14536. -+ bool dpc_running;
  14537. -
  14538. - bool txoff; /* Transmit flow-controlled */
  14539. - struct brcmf_sdio_count sdcnt;
  14540. -@@ -2713,6 +2713,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  14541. - err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  14542. - bus->ctrl_frame_len);
  14543. - bus->ctrl_frame_err = err;
  14544. -+ wmb();
  14545. - bus->ctrl_frame_stat = false;
  14546. - }
  14547. - sdio_release_host(bus->sdiodev->func[1]);
  14548. -@@ -2734,6 +2735,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  14549. - sdio_claim_host(bus->sdiodev->func[1]);
  14550. - if (bus->ctrl_frame_stat) {
  14551. - bus->ctrl_frame_err = -ENODEV;
  14552. -+ wmb();
  14553. - bus->ctrl_frame_stat = false;
  14554. - brcmf_sdio_wait_event_wakeup(bus);
  14555. - }
  14556. -@@ -2744,7 +2746,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  14557. - (!atomic_read(&bus->fcstate) &&
  14558. - brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  14559. - data_ok(bus))) {
  14560. -- atomic_inc(&bus->dpc_tskcnt);
  14561. -+ bus->dpc_triggered = true;
  14562. - }
  14563. - }
  14564. -
  14565. -@@ -2940,6 +2942,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  14566. - /* Send from dpc */
  14567. - bus->ctrl_frame_buf = msg;
  14568. - bus->ctrl_frame_len = msglen;
  14569. -+ wmb();
  14570. - bus->ctrl_frame_stat = true;
  14571. -
  14572. - brcmf_sdio_trigger_dpc(bus);
  14573. -@@ -2958,6 +2961,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  14574. - if (!ret) {
  14575. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  14576. - bus->ctrl_frame_err);
  14577. -+ rmb();
  14578. - ret = bus->ctrl_frame_err;
  14579. - }
  14580. -
  14581. -@@ -3526,8 +3530,8 @@ done:
  14582. -
  14583. - void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus)
  14584. - {
  14585. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  14586. -- atomic_inc(&bus->dpc_tskcnt);
  14587. -+ if (!bus->dpc_triggered) {
  14588. -+ bus->dpc_triggered = true;
  14589. - queue_work(bus->brcmf_wq, &bus->datawork);
  14590. - }
  14591. - }
  14592. -@@ -3558,7 +3562,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  14593. - if (!bus->intr)
  14594. - brcmf_err("isr w/o interrupt configured!\n");
  14595. -
  14596. -- atomic_inc(&bus->dpc_tskcnt);
  14597. -+ bus->dpc_triggered = true;
  14598. - queue_work(bus->brcmf_wq, &bus->datawork);
  14599. - }
  14600. -
  14601. -@@ -3578,7 +3582,7 @@ static void brcmf_sdio_bus_watchdog(stru
  14602. - if (!bus->intr ||
  14603. - (bus->sdcnt.intrcount == bus->sdcnt.lastintrs)) {
  14604. -
  14605. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  14606. -+ if (!bus->dpc_triggered) {
  14607. - u8 devpend;
  14608. -
  14609. - sdio_claim_host(bus->sdiodev->func[1]);
  14610. -@@ -3596,7 +3600,7 @@ static void brcmf_sdio_bus_watchdog(stru
  14611. - bus->sdcnt.pollcnt++;
  14612. - atomic_set(&bus->ipend, 1);
  14613. -
  14614. -- atomic_inc(&bus->dpc_tskcnt);
  14615. -+ bus->dpc_triggered = true;
  14616. - queue_work(bus->brcmf_wq, &bus->datawork);
  14617. - }
  14618. - }
  14619. -@@ -3623,17 +3627,21 @@ static void brcmf_sdio_bus_watchdog(stru
  14620. - #endif /* DEBUG */
  14621. -
  14622. - /* On idle timeout clear activity flag and/or turn off clock */
  14623. -- if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  14624. -- (atomic_read(&bus->dpc_running) == 0) &&
  14625. -- (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  14626. -- bus->idlecount++;
  14627. -- if (bus->idlecount > bus->idletime) {
  14628. -- brcmf_dbg(SDIO, "idle\n");
  14629. -- sdio_claim_host(bus->sdiodev->func[1]);
  14630. -- brcmf_sdio_wd_timer(bus, 0);
  14631. -+ if (!bus->dpc_triggered) {
  14632. -+ rmb();
  14633. -+ if ((!bus->dpc_running) && (bus->idletime > 0) &&
  14634. -+ (bus->clkstate == CLK_AVAIL)) {
  14635. -+ bus->idlecount++;
  14636. -+ if (bus->idlecount > bus->idletime) {
  14637. -+ brcmf_dbg(SDIO, "idle\n");
  14638. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14639. -+ brcmf_sdio_wd_timer(bus, 0);
  14640. -+ bus->idlecount = 0;
  14641. -+ brcmf_sdio_bus_sleep(bus, true, false);
  14642. -+ sdio_release_host(bus->sdiodev->func[1]);
  14643. -+ }
  14644. -+ } else {
  14645. - bus->idlecount = 0;
  14646. -- brcmf_sdio_bus_sleep(bus, true, false);
  14647. -- sdio_release_host(bus->sdiodev->func[1]);
  14648. - }
  14649. - } else {
  14650. - bus->idlecount = 0;
  14651. -@@ -3645,13 +3653,14 @@ static void brcmf_sdio_dataworker(struct
  14652. - struct brcmf_sdio *bus = container_of(work, struct brcmf_sdio,
  14653. - datawork);
  14654. -
  14655. -- while (atomic_read(&bus->dpc_tskcnt)) {
  14656. -- atomic_set(&bus->dpc_running, 1);
  14657. -- atomic_set(&bus->dpc_tskcnt, 0);
  14658. -+ bus->dpc_running = true;
  14659. -+ wmb();
  14660. -+ while (ACCESS_ONCE(bus->dpc_triggered)) {
  14661. -+ bus->dpc_triggered = false;
  14662. - brcmf_sdio_dpc(bus);
  14663. - bus->idlecount = 0;
  14664. -- atomic_set(&bus->dpc_running, 0);
  14665. - }
  14666. -+ bus->dpc_running = false;
  14667. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  14668. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  14669. - brcmf_sdiod_try_freeze(bus->sdiodev);
  14670. -@@ -4144,8 +4153,8 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  14671. - bus->watchdog_tsk = NULL;
  14672. - }
  14673. - /* Initialize DPC thread */
  14674. -- atomic_set(&bus->dpc_tskcnt, 0);
  14675. -- atomic_set(&bus->dpc_running, 0);
  14676. -+ bus->dpc_triggered = false;
  14677. -+ bus->dpc_running = false;
  14678. -
  14679. - /* Assign bus interface call back */
  14680. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  14681. 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
  14682. deleted file mode 100644
  14683. index 1bc98a0..0000000
  14684. --- a/package/kernel/mac80211/patches/348-brcmfmac-Remove-unnecessary-new-line-in-pcie-console.patch
  14685. +++ /dev/null
  14686. @@ -1,26 +0,0 @@
  14687. -From: Hante Meuleman <meuleman@broadcom.com>
  14688. -Date: Wed, 18 Mar 2015 13:25:24 +0100
  14689. -Subject: [PATCH] brcmfmac: Remove unnecessary new-line in pcie console
  14690. - logging.
  14691. -
  14692. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14693. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14694. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14695. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14696. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14697. ----
  14698. -
  14699. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14700. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14701. -@@ -651,10 +651,9 @@ static void brcmf_pcie_bus_console_read(
  14702. - console->log_str[console->log_idx] = ch;
  14703. - console->log_idx++;
  14704. - }
  14705. --
  14706. - if (ch == '\n') {
  14707. - console->log_str[console->log_idx] = 0;
  14708. -- brcmf_dbg(PCIE, "CONSOLE: %s\n", console->log_str);
  14709. -+ brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  14710. - console->log_idx = 0;
  14711. - }
  14712. - }
  14713. 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
  14714. deleted file mode 100644
  14715. index fcf0bf3..0000000
  14716. --- a/package/kernel/mac80211/patches/349-brcmfmac-add-MODULE_FIRMWARE-macros-for-bcm4356-PCIe.patch
  14717. +++ /dev/null
  14718. @@ -1,26 +0,0 @@
  14719. -From: Arend van Spriel <arend@broadcom.com>
  14720. -Date: Wed, 18 Mar 2015 13:25:25 +0100
  14721. -Subject: [PATCH] brcmfmac: add MODULE_FIRMWARE() macros for bcm4356 PCIe
  14722. - device
  14723. -
  14724. -The BCM4356 PCIe wireless device was added recently but overlooked
  14725. -the fact that the MODULE_FIRMWARE() macros were missing for the
  14726. -firmwares needed by this device.
  14727. -
  14728. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14729. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14730. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14731. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14732. ----
  14733. -
  14734. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14735. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14736. -@@ -189,6 +189,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME
  14737. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  14738. - MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  14739. - MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  14740. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  14741. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  14742. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  14743. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  14744. -
  14745. 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
  14746. deleted file mode 100644
  14747. index b3e9bc9..0000000
  14748. --- a/package/kernel/mac80211/patches/350-brcmfmac-add-support-for-BCM43430-SDIO-chipset.patch
  14749. +++ /dev/null
  14750. @@ -1,138 +0,0 @@
  14751. -From: Arend van Spriel <arend@broadcom.com>
  14752. -Date: Wed, 18 Mar 2015 13:25:26 +0100
  14753. -Subject: [PATCH] brcmfmac: add support for BCM43430 SDIO chipset
  14754. -
  14755. -This patch added support for the BCM43430 802.11n SDIO chipset.
  14756. -
  14757. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14758. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14759. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14760. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14761. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14762. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14763. ----
  14764. -
  14765. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14766. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14767. -@@ -1098,6 +1098,7 @@ static const struct sdio_device_id brcmf
  14768. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  14769. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  14770. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  14771. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
  14772. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  14773. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  14774. - { /* end: all zeroes */ }
  14775. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14776. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14777. -@@ -600,6 +600,12 @@ static void brcmf_chip_socram_ramsize(st
  14778. - if (sr->chip->pub.chiprev < 2)
  14779. - *srsize = (32 * 1024);
  14780. - break;
  14781. -+ case BRCM_CC_43430_CHIP_ID:
  14782. -+ /* assume sr for now as we can not check
  14783. -+ * firmware sr capability at this point.
  14784. -+ */
  14785. -+ *srsize = (64 * 1024);
  14786. -+ break;
  14787. - default:
  14788. - break;
  14789. - }
  14790. -@@ -1072,6 +1078,7 @@ static void
  14791. - brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  14792. - {
  14793. - struct brcmf_core *core;
  14794. -+ struct brcmf_core_priv *sr;
  14795. -
  14796. - brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  14797. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_80211);
  14798. -@@ -1081,6 +1088,13 @@ brcmf_chip_cm3_set_passive(struct brcmf_
  14799. - D11_BCMA_IOCTL_PHYCLOCKEN);
  14800. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_INTERNAL_MEM);
  14801. - brcmf_chip_resetcore(core, 0, 0, 0);
  14802. -+
  14803. -+ /* disable bank #3 remap for this device */
  14804. -+ if (chip->pub.chip == BRCM_CC_43430_CHIP_ID) {
  14805. -+ sr = container_of(core, struct brcmf_core_priv, pub);
  14806. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankidx), 3);
  14807. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankpda), 0);
  14808. -+ }
  14809. - }
  14810. -
  14811. - static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  14812. -@@ -1188,6 +1202,10 @@ bool brcmf_chip_sr_capable(struct brcmf_
  14813. - addr = CORE_CC_REG(base, chipcontrol_data);
  14814. - reg = chip->ops->read32(chip->ctx, addr);
  14815. - return (reg & pmu_cc3_mask) != 0;
  14816. -+ case BRCM_CC_43430_CHIP_ID:
  14817. -+ addr = CORE_CC_REG(base, sr_control1);
  14818. -+ reg = chip->ops->read32(chip->ctx, addr);
  14819. -+ return reg != 0;
  14820. - default:
  14821. - addr = CORE_CC_REG(base, pmucapabilities_ext);
  14822. - reg = chip->ops->read32(chip->ctx, addr);
  14823. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14824. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14825. -@@ -615,6 +615,8 @@ static const struct sdiod_drive_str sdio
  14826. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  14827. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  14828. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  14829. -+#define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  14830. -+#define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  14831. - #define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  14832. - #define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  14833. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  14834. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  14835. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  14836. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  14837. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  14838. -+MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  14839. -+MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  14840. - MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  14841. - MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  14842. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  14843. -@@ -671,6 +675,7 @@ static const struct brcmf_firmware_names
  14844. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  14845. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  14846. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  14847. -+ { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  14848. - { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  14849. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  14850. - };
  14851. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  14852. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  14853. -@@ -37,6 +37,7 @@
  14854. - #define BRCM_CC_43362_CHIP_ID 43362
  14855. - #define BRCM_CC_4335_CHIP_ID 0x4335
  14856. - #define BRCM_CC_4339_CHIP_ID 0x4339
  14857. -+#define BRCM_CC_43430_CHIP_ID 43430
  14858. - #define BRCM_CC_4345_CHIP_ID 0x4345
  14859. - #define BRCM_CC_4354_CHIP_ID 0x4354
  14860. - #define BRCM_CC_4356_CHIP_ID 0x4356
  14861. ---- a/drivers/net/wireless/brcm80211/include/chipcommon.h
  14862. -+++ b/drivers/net/wireless/brcm80211/include/chipcommon.h
  14863. -@@ -183,7 +183,14 @@ struct chipcregs {
  14864. - u8 uart1lsr;
  14865. - u8 uart1msr;
  14866. - u8 uart1scratch;
  14867. -- u32 PAD[126];
  14868. -+ u32 PAD[62];
  14869. -+
  14870. -+ /* save/restore, corerev >= 48 */
  14871. -+ u32 sr_capability; /* 0x500 */
  14872. -+ u32 sr_control0; /* 0x504 */
  14873. -+ u32 sr_control1; /* 0x508 */
  14874. -+ u32 gpio_control; /* 0x50C */
  14875. -+ u32 PAD[60];
  14876. -
  14877. - /* PMU registers (corerev >= 20) */
  14878. - u32 pmucontrol; /* 0x600 */
  14879. ---- a/include/linux/mmc/sdio_ids.h
  14880. -+++ b/include/linux/mmc/sdio_ids.h
  14881. -@@ -33,6 +33,7 @@
  14882. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  14883. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  14884. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  14885. -+#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
  14886. - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  14887. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  14888. -
  14889. 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
  14890. deleted file mode 100644
  14891. index c3d7bc2..0000000
  14892. --- a/package/kernel/mac80211/patches/351-brcmfmac-only-support-the-BCM43455-7-device.patch
  14893. +++ /dev/null
  14894. @@ -1,50 +0,0 @@
  14895. -From: Arend van Spriel <arend@broadcom.com>
  14896. -Date: Wed, 18 Mar 2015 13:25:27 +0100
  14897. -Subject: [PATCH] brcmfmac: only support the BCM43455/7 device
  14898. -
  14899. -Recently support was added for the BCM4345 SDIO chipset by
  14900. -commit 9c51026509d7 ("brcmfmac: Add support for BCM4345 SDIO chipset")
  14901. -however this was verified using a BCM43455 device, which is
  14902. -a more recent revision of the chip. This patch assure that
  14903. -older revisions are not probed as they would fail.
  14904. -
  14905. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14906. -Reviewed-by: Syed Asifful Dayyan <syedd@broadcom.com>
  14907. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14908. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14909. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14910. ----
  14911. -
  14912. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14913. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14914. -@@ -617,8 +617,8 @@ static const struct sdiod_drive_str sdio
  14915. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  14916. - #define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  14917. - #define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  14918. --#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  14919. --#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  14920. -+#define BCM43455_FIRMWARE_NAME "brcm/brcmfmac43455-sdio.bin"
  14921. -+#define BCM43455_NVRAM_NAME "brcm/brcmfmac43455-sdio.txt"
  14922. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  14923. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  14924. -
  14925. -@@ -644,8 +644,8 @@ MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  14926. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  14927. - MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  14928. - MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  14929. --MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  14930. --MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  14931. -+MODULE_FIRMWARE(BCM43455_FIRMWARE_NAME);
  14932. -+MODULE_FIRMWARE(BCM43455_NVRAM_NAME);
  14933. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  14934. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  14935. -
  14936. -@@ -676,7 +676,7 @@ static const struct brcmf_firmware_names
  14937. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  14938. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  14939. - { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  14940. -- { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  14941. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43455) },
  14942. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  14943. - };
  14944. -
  14945. 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
  14946. deleted file mode 100644
  14947. index a62cfdf..0000000
  14948. --- a/package/kernel/mac80211/patches/352-brcmfmac-remove-support-for-unreleased-BCM4354-PCIe.patch
  14949. +++ /dev/null
  14950. @@ -1,52 +0,0 @@
  14951. -From: Arend van Spriel <arend@broadcom.com>
  14952. -Date: Wed, 18 Mar 2015 13:25:28 +0100
  14953. -Subject: [PATCH] brcmfmac: remove support for unreleased BCM4354 PCIe
  14954. -
  14955. -There are no known BCM4354 PCIe devices released so removing
  14956. -support from the driver until proven otherwise.
  14957. -
  14958. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14959. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14960. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14961. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14962. ----
  14963. -
  14964. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14965. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14966. -@@ -47,8 +47,6 @@ enum brcmf_pcie_state {
  14967. -
  14968. - #define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  14969. - #define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  14970. --#define BRCMF_PCIE_4354_FW_NAME "brcm/brcmfmac4354-pcie.bin"
  14971. --#define BRCMF_PCIE_4354_NVRAM_NAME "brcm/brcmfmac4354-pcie.txt"
  14972. - #define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  14973. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  14974. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  14975. -@@ -187,8 +185,6 @@ enum brcmf_pcie_state {
  14976. -
  14977. - MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  14978. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  14979. --MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  14980. --MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  14981. - MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  14982. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  14983. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  14984. -@@ -1327,10 +1323,6 @@ static int brcmf_pcie_get_fwnames(struct
  14985. - fw_name = BRCMF_PCIE_43602_FW_NAME;
  14986. - nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  14987. - break;
  14988. -- case BRCM_CC_4354_CHIP_ID:
  14989. -- fw_name = BRCMF_PCIE_4354_FW_NAME;
  14990. -- nvram_name = BRCMF_PCIE_4354_NVRAM_NAME;
  14991. -- break;
  14992. - case BRCM_CC_4356_CHIP_ID:
  14993. - fw_name = BRCMF_PCIE_4356_FW_NAME;
  14994. - nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  14995. -@@ -1855,7 +1847,6 @@ cleanup:
  14996. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  14997. -
  14998. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  14999. -- BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_DEVICE_ID),
  15000. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  15001. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  15002. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  15003. 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
  15004. deleted file mode 100644
  15005. index 366ff85..0000000
  15006. --- a/package/kernel/mac80211/patches/353-brcmfmac-disable-MBSS-feature-for-BCM43362.patch
  15007. +++ /dev/null
  15008. @@ -1,28 +0,0 @@
  15009. -From: Arend van Spriel <arend@broadcom.com>
  15010. -Date: Fri, 20 Mar 2015 22:18:17 +0100
  15011. -Subject: [PATCH] brcmfmac: disable MBSS feature for BCM43362
  15012. -
  15013. -The BCM43362 firmware falsely reports it is capable of providing
  15014. -MBSS. As a result AP mode no longer works for this device. Therefor
  15015. -disable MBSS in the driver for this chipset.
  15016. -
  15017. -Cc: stable@vger.kernel.org # 3.19.y
  15018. -Reported-by: Jorg Krause <jkrause@posteo.de>
  15019. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15020. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15021. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15022. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15023. ----
  15024. -
  15025. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15026. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15027. -@@ -126,7 +126,8 @@ void brcmf_feat_attach(struct brcmf_pub
  15028. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  15029. - if (drvr->bus_if->wowl_supported)
  15030. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  15031. -- brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  15032. -+ if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  15033. -+ brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  15034. -
  15035. - /* set chip related quirks */
  15036. - switch (drvr->bus_if->chip) {
  15037. 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
  15038. deleted file mode 100644
  15039. index 6e461f6..0000000
  15040. --- a/package/kernel/mac80211/patches/354-brcmfmac-use-static-superset-of-channels-for-wiphy-b.patch
  15041. +++ /dev/null
  15042. @@ -1,300 +0,0 @@
  15043. -From: Arend van Spriel <arend@broadcom.com>
  15044. -Date: Tue, 14 Apr 2015 20:10:24 +0200
  15045. -Subject: [PATCH] brcmfmac: use static superset of channels for wiphy
  15046. - bands
  15047. -
  15048. -The driver was constructing a list of channels per wiphy band
  15049. -by querying the device. This list is not what the hardware is
  15050. -able to do as it is already filtered by the country setting in
  15051. -the device. As user-space may change the country this would
  15052. -require updating the channel list which is not recommended [1].
  15053. -This patch introduces a superset of channels. The individual
  15054. -channels are disabled appropriately by querying the device.
  15055. -
  15056. -[1] http://mid.gmane.org/1426706320.3001.21.camel@sipsolutions.net
  15057. -
  15058. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15059. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15060. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15061. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15062. ----
  15063. -
  15064. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15065. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15066. -@@ -129,13 +129,47 @@ static struct ieee80211_rate __wl_rates[
  15067. - RATETAB_ENT(BRCM_RATE_54M, 0),
  15068. - };
  15069. -
  15070. --#define wl_a_rates (__wl_rates + 4)
  15071. --#define wl_a_rates_size 8
  15072. - #define wl_g_rates (__wl_rates + 0)
  15073. --#define wl_g_rates_size 12
  15074. -+#define wl_g_rates_size ARRAY_SIZE(__wl_rates)
  15075. -+#define wl_a_rates (__wl_rates + 4)
  15076. -+#define wl_a_rates_size (wl_g_rates_size - 4)
  15077. -+
  15078. -+#define CHAN2G(_channel, _freq) { \
  15079. -+ .band = IEEE80211_BAND_2GHZ, \
  15080. -+ .center_freq = (_freq), \
  15081. -+ .hw_value = (_channel), \
  15082. -+ .flags = IEEE80211_CHAN_DISABLED, \
  15083. -+ .max_antenna_gain = 0, \
  15084. -+ .max_power = 30, \
  15085. -+}
  15086. -+
  15087. -+#define CHAN5G(_channel) { \
  15088. -+ .band = IEEE80211_BAND_5GHZ, \
  15089. -+ .center_freq = 5000 + (5 * (_channel)), \
  15090. -+ .hw_value = (_channel), \
  15091. -+ .flags = IEEE80211_CHAN_DISABLED, \
  15092. -+ .max_antenna_gain = 0, \
  15093. -+ .max_power = 30, \
  15094. -+}
  15095. -+
  15096. -+static struct ieee80211_channel __wl_2ghz_channels[] = {
  15097. -+ CHAN2G(1, 2412), CHAN2G(2, 2417), CHAN2G(3, 2422), CHAN2G(4, 2427),
  15098. -+ CHAN2G(5, 2432), CHAN2G(6, 2437), CHAN2G(7, 2442), CHAN2G(8, 2447),
  15099. -+ CHAN2G(9, 2452), CHAN2G(10, 2457), CHAN2G(11, 2462), CHAN2G(12, 2467),
  15100. -+ CHAN2G(13, 2472), CHAN2G(14, 2484)
  15101. -+};
  15102. -+
  15103. -+static struct ieee80211_channel __wl_5ghz_channels[] = {
  15104. -+ CHAN5G(34), CHAN5G(36), CHAN5G(38), CHAN5G(40), CHAN5G(42),
  15105. -+ CHAN5G(44), CHAN5G(46), CHAN5G(48), CHAN5G(52), CHAN5G(56),
  15106. -+ CHAN5G(60), CHAN5G(64), CHAN5G(100), CHAN5G(104), CHAN5G(108),
  15107. -+ CHAN5G(112), CHAN5G(116), CHAN5G(120), CHAN5G(124), CHAN5G(128),
  15108. -+ CHAN5G(132), CHAN5G(136), CHAN5G(140), CHAN5G(144), CHAN5G(149),
  15109. -+ CHAN5G(153), CHAN5G(157), CHAN5G(161), CHAN5G(165)
  15110. -+};
  15111. -
  15112. - /* Band templates duplicated per wiphy. The channel info
  15113. -- * is filled in after querying the device.
  15114. -+ * above is added to the band during setup.
  15115. - */
  15116. - static const struct ieee80211_supported_band __wl_band_2ghz = {
  15117. - .band = IEEE80211_BAND_2GHZ,
  15118. -@@ -143,7 +177,7 @@ static const struct ieee80211_supported_
  15119. - .n_bitrates = wl_g_rates_size,
  15120. - };
  15121. -
  15122. --static const struct ieee80211_supported_band __wl_band_5ghz_a = {
  15123. -+static const struct ieee80211_supported_band __wl_band_5ghz = {
  15124. - .band = IEEE80211_BAND_5GHZ,
  15125. - .bitrates = wl_a_rates,
  15126. - .n_bitrates = wl_a_rates_size,
  15127. -@@ -5252,40 +5286,6 @@ dongle_scantime_out:
  15128. - return err;
  15129. - }
  15130. -
  15131. --/* Filter the list of channels received from firmware counting only
  15132. -- * the 20MHz channels. The wiphy band data only needs those which get
  15133. -- * flagged to indicate if they can take part in higher bandwidth.
  15134. -- */
  15135. --static void brcmf_count_20mhz_channels(struct brcmf_cfg80211_info *cfg,
  15136. -- struct brcmf_chanspec_list *chlist,
  15137. -- u32 chcnt[])
  15138. --{
  15139. -- u32 total = le32_to_cpu(chlist->count);
  15140. -- struct brcmu_chan ch;
  15141. -- int i;
  15142. --
  15143. -- for (i = 0; i < total; i++) {
  15144. -- ch.chspec = (u16)le32_to_cpu(chlist->element[i]);
  15145. -- cfg->d11inf.decchspec(&ch);
  15146. --
  15147. -- /* Firmware gives a ordered list. We skip non-20MHz
  15148. -- * channels is 2G. For 5G we can abort upon reaching
  15149. -- * a non-20MHz channel in the list.
  15150. -- */
  15151. -- if (ch.bw != BRCMU_CHAN_BW_20) {
  15152. -- if (ch.band == BRCMU_CHAN_BAND_5G)
  15153. -- break;
  15154. -- else
  15155. -- continue;
  15156. -- }
  15157. --
  15158. -- if (ch.band == BRCMU_CHAN_BAND_2G)
  15159. -- chcnt[0] += 1;
  15160. -- else if (ch.band == BRCMU_CHAN_BAND_5G)
  15161. -- chcnt[1] += 1;
  15162. -- }
  15163. --}
  15164. --
  15165. - static void brcmf_update_bw40_channel_flag(struct ieee80211_channel *channel,
  15166. - struct brcmu_chan *ch)
  15167. - {
  15168. -@@ -5321,7 +5321,6 @@ static int brcmf_construct_chaninfo(stru
  15169. - u32 i, j;
  15170. - u32 total;
  15171. - u32 chaninfo;
  15172. -- u32 chcnt[2] = { 0, 0 };
  15173. - u32 index;
  15174. -
  15175. - pbuf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
  15176. -@@ -5338,42 +5337,15 @@ static int brcmf_construct_chaninfo(stru
  15177. - goto fail_pbuf;
  15178. - }
  15179. -
  15180. -- brcmf_count_20mhz_channels(cfg, list, chcnt);
  15181. - wiphy = cfg_to_wiphy(cfg);
  15182. -- if (chcnt[0]) {
  15183. -- band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  15184. -- GFP_KERNEL);
  15185. -- if (band == NULL) {
  15186. -- err = -ENOMEM;
  15187. -- goto fail_pbuf;
  15188. -- }
  15189. -- band->channels = kcalloc(chcnt[0], sizeof(*channel),
  15190. -- GFP_KERNEL);
  15191. -- if (band->channels == NULL) {
  15192. -- kfree(band);
  15193. -- err = -ENOMEM;
  15194. -- goto fail_pbuf;
  15195. -- }
  15196. -- band->n_channels = 0;
  15197. -- wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  15198. -- }
  15199. -- if (chcnt[1]) {
  15200. -- band = kmemdup(&__wl_band_5ghz_a, sizeof(__wl_band_5ghz_a),
  15201. -- GFP_KERNEL);
  15202. -- if (band == NULL) {
  15203. -- err = -ENOMEM;
  15204. -- goto fail_band2g;
  15205. -- }
  15206. -- band->channels = kcalloc(chcnt[1], sizeof(*channel),
  15207. -- GFP_KERNEL);
  15208. -- if (band->channels == NULL) {
  15209. -- kfree(band);
  15210. -- err = -ENOMEM;
  15211. -- goto fail_band2g;
  15212. -- }
  15213. -- band->n_channels = 0;
  15214. -- wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  15215. -- }
  15216. -+ band = wiphy->bands[IEEE80211_BAND_2GHZ];
  15217. -+ if (band)
  15218. -+ for (i = 0; i < band->n_channels; i++)
  15219. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  15220. -+ band = wiphy->bands[IEEE80211_BAND_5GHZ];
  15221. -+ if (band)
  15222. -+ for (i = 0; i < band->n_channels; i++)
  15223. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  15224. -
  15225. - total = le32_to_cpu(list->count);
  15226. - for (i = 0; i < total; i++) {
  15227. -@@ -5388,6 +5360,8 @@ static int brcmf_construct_chaninfo(stru
  15228. - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
  15229. - continue;
  15230. - }
  15231. -+ if (!band)
  15232. -+ continue;
  15233. - if (!(bw_cap[band->band] & WLC_BW_40MHZ_BIT) &&
  15234. - ch.bw == BRCMU_CHAN_BW_40)
  15235. - continue;
  15236. -@@ -5415,9 +5389,9 @@ static int brcmf_construct_chaninfo(stru
  15237. - } else if (ch.bw == BRCMU_CHAN_BW_40) {
  15238. - brcmf_update_bw40_channel_flag(&channel[index], &ch);
  15239. - } else {
  15240. -- /* disable other bandwidths for now as mentioned
  15241. -- * order assure they are enabled for subsequent
  15242. -- * chanspecs.
  15243. -+ /* enable the channel and disable other bandwidths
  15244. -+ * for now as mentioned order assure they are enabled
  15245. -+ * for subsequent chanspecs.
  15246. - */
  15247. - channel[index].flags = IEEE80211_CHAN_NO_HT40 |
  15248. - IEEE80211_CHAN_NO_80MHZ;
  15249. -@@ -5436,16 +5410,8 @@ static int brcmf_construct_chaninfo(stru
  15250. - IEEE80211_CHAN_NO_IR;
  15251. - }
  15252. - }
  15253. -- if (index == band->n_channels)
  15254. -- band->n_channels++;
  15255. - }
  15256. -- kfree(pbuf);
  15257. -- return 0;
  15258. -
  15259. --fail_band2g:
  15260. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  15261. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]);
  15262. -- wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
  15263. - fail_pbuf:
  15264. - kfree(pbuf);
  15265. - return err;
  15266. -@@ -5778,7 +5744,12 @@ static void brcmf_wiphy_wowl_params(stru
  15267. -
  15268. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  15269. - {
  15270. -+ struct ieee80211_supported_band *band;
  15271. - struct ieee80211_iface_combination ifc_combo;
  15272. -+ __le32 bandlist[3];
  15273. -+ u32 n_bands;
  15274. -+ int err, i;
  15275. -+
  15276. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  15277. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  15278. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  15279. -@@ -5820,7 +5791,52 @@ static int brcmf_setup_wiphy(struct wiph
  15280. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL))
  15281. - brcmf_wiphy_wowl_params(wiphy);
  15282. -
  15283. -- return brcmf_setup_wiphybands(wiphy);
  15284. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
  15285. -+ sizeof(bandlist));
  15286. -+ if (err) {
  15287. -+ brcmf_err("could not obtain band info: err=%d\n", err);
  15288. -+ return err;
  15289. -+ }
  15290. -+ /* first entry in bandlist is number of bands */
  15291. -+ n_bands = le32_to_cpu(bandlist[0]);
  15292. -+ for (i = 1; i <= n_bands && i < ARRAY_SIZE(bandlist); i++) {
  15293. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_2G)) {
  15294. -+ band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  15295. -+ GFP_KERNEL);
  15296. -+ if (!band)
  15297. -+ return -ENOMEM;
  15298. -+
  15299. -+ band->channels = kmemdup(&__wl_2ghz_channels,
  15300. -+ sizeof(__wl_2ghz_channels),
  15301. -+ GFP_KERNEL);
  15302. -+ if (!band->channels) {
  15303. -+ kfree(band);
  15304. -+ return -ENOMEM;
  15305. -+ }
  15306. -+
  15307. -+ band->n_channels = ARRAY_SIZE(__wl_2ghz_channels);
  15308. -+ wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  15309. -+ }
  15310. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_5G)) {
  15311. -+ band = kmemdup(&__wl_band_5ghz, sizeof(__wl_band_5ghz),
  15312. -+ GFP_KERNEL);
  15313. -+ if (!band)
  15314. -+ return -ENOMEM;
  15315. -+
  15316. -+ band->channels = kmemdup(&__wl_5ghz_channels,
  15317. -+ sizeof(__wl_5ghz_channels),
  15318. -+ GFP_KERNEL);
  15319. -+ if (!band->channels) {
  15320. -+ kfree(band);
  15321. -+ return -ENOMEM;
  15322. -+ }
  15323. -+
  15324. -+ band->n_channels = ARRAY_SIZE(__wl_5ghz_channels);
  15325. -+ wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  15326. -+ }
  15327. -+ }
  15328. -+ err = brcmf_setup_wiphybands(wiphy);
  15329. -+ return err;
  15330. - }
  15331. -
  15332. - static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
  15333. -@@ -6011,6 +6027,9 @@ static void brcmf_cfg80211_reg_notifier(
  15334. -
  15335. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  15336. - {
  15337. -+ if (!wiphy)
  15338. -+ return;
  15339. -+
  15340. - kfree(wiphy->iface_combinations);
  15341. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  15342. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  15343. 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
  15344. deleted file mode 100644
  15345. index a0c22eb..0000000
  15346. --- a/package/kernel/mac80211/patches/355-brcmfmac-update-wiphy-band-information-upon-updating.patch
  15347. +++ /dev/null
  15348. @@ -1,29 +0,0 @@
  15349. -From: Arend van Spriel <arend@broadcom.com>
  15350. -Date: Tue, 14 Apr 2015 20:10:25 +0200
  15351. -Subject: [PATCH] brcmfmac: update wiphy band information upon updating
  15352. - regulatory domain
  15353. -
  15354. -When change the country code the available channels may change. So
  15355. -the wiphy bands should be updated accordingly.
  15356. -
  15357. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15358. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15359. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15360. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15361. ----
  15362. -
  15363. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15364. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15365. -@@ -6022,7 +6022,11 @@ static void brcmf_cfg80211_reg_notifier(
  15366. - memset(&ccreq, 0, sizeof(ccreq));
  15367. - ccreq.rev = cpu_to_le32(-1);
  15368. - memcpy(ccreq.ccode, req->alpha2, sizeof(req->alpha2));
  15369. -- brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  15370. -+ if (brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq))) {
  15371. -+ brcmf_err("firmware rejected country setting\n");
  15372. -+ return;
  15373. -+ }
  15374. -+ brcmf_setup_wiphybands(wiphy);
  15375. - }
  15376. -
  15377. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  15378. 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
  15379. deleted file mode 100644
  15380. index 193f507..0000000
  15381. --- a/package/kernel/mac80211/patches/356-brcmfmac-add-description-for-feature-flags.patch
  15382. +++ /dev/null
  15383. @@ -1,24 +0,0 @@
  15384. -From: Arend van Spriel <arend@broadcom.com>
  15385. -Date: Tue, 14 Apr 2015 20:10:26 +0200
  15386. -Subject: [PATCH] brcmfmac: add description for feature flags
  15387. -
  15388. -Some feature flags were not described in the header file. Adding
  15389. -the description.
  15390. -
  15391. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15392. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15393. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15394. ----
  15395. -
  15396. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15397. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15398. -@@ -19,7 +19,9 @@
  15399. - /*
  15400. - * Features:
  15401. - *
  15402. -+ * MBSS: multiple BSSID support (eg. guest network in AP mode).
  15403. - * MCHAN: multi-channel for concurrent P2P.
  15404. -+ * WOWL: Wake-On-WLAN.
  15405. - */
  15406. - #define BRCMF_FEAT_LIST \
  15407. - BRCMF_FEAT_DEF(MBSS) \
  15408. 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
  15409. deleted file mode 100644
  15410. index 42330b4..0000000
  15411. --- a/package/kernel/mac80211/patches/357-brcmfmac-make-scheduled-scan-support-conditional.patch
  15412. +++ /dev/null
  15413. @@ -1,51 +0,0 @@
  15414. -From: Arend van Spriel <arend@broadcom.com>
  15415. -Date: Tue, 14 Apr 2015 20:10:27 +0200
  15416. -Subject: [PATCH] brcmfmac: make scheduled scan support conditional
  15417. -
  15418. -The scheduled scan support depends on firmware supporting the PNO
  15419. -feature. This feature is optional so add a feature flag for this
  15420. -in the driver and announce scheduled scan support accordingly.
  15421. -
  15422. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15423. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15424. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15425. ----
  15426. -
  15427. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15428. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15429. -@@ -5782,7 +5782,8 @@ static int brcmf_setup_wiphy(struct wiph
  15430. - wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM;
  15431. - wiphy->mgmt_stypes = brcmf_txrx_stypes;
  15432. - wiphy->max_remain_on_channel_duration = 5000;
  15433. -- brcmf_wiphy_pno_params(wiphy);
  15434. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO))
  15435. -+ brcmf_wiphy_pno_params(wiphy);
  15436. -
  15437. - /* vendor commands/events support */
  15438. - wiphy->vendor_commands = brcmf_vendor_cmds;
  15439. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15440. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15441. -@@ -124,6 +124,7 @@ void brcmf_feat_attach(struct brcmf_pub
  15442. - struct brcmf_if *ifp = drvr->iflist[0];
  15443. -
  15444. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  15445. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  15446. - if (drvr->bus_if->wowl_supported)
  15447. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  15448. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  15449. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15450. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15451. -@@ -21,11 +21,13 @@
  15452. - *
  15453. - * MBSS: multiple BSSID support (eg. guest network in AP mode).
  15454. - * MCHAN: multi-channel for concurrent P2P.
  15455. -+ * PNO: preferred network offload.
  15456. - * WOWL: Wake-On-WLAN.
  15457. - */
  15458. - #define BRCMF_FEAT_LIST \
  15459. - BRCMF_FEAT_DEF(MBSS) \
  15460. - BRCMF_FEAT_DEF(MCHAN) \
  15461. -+ BRCMF_FEAT_DEF(PNO) \
  15462. - BRCMF_FEAT_DEF(WOWL)
  15463. - /*
  15464. - * Quirks:
  15465. 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
  15466. deleted file mode 100644
  15467. index b859d46..0000000
  15468. --- a/package/kernel/mac80211/patches/358-brcmfmac-add-support-for-BCM4324-rev-B5-chipset.patch
  15469. +++ /dev/null
  15470. @@ -1,43 +0,0 @@
  15471. -From: Arend van Spriel <arend@broadcom.com>
  15472. -Date: Tue, 14 Apr 2015 20:10:28 +0200
  15473. -Subject: [PATCH] brcmfmac: add support for BCM4324 rev B5 chipset
  15474. -
  15475. -This patch adds support for the BCM4324 B5 revision. This device
  15476. -is similar to BCM43241 from driver and firmware perspective. It
  15477. -is known to be used in Lenovo Thinkpad Tablet devices.
  15478. -
  15479. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15480. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15481. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15482. ----
  15483. -
  15484. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15485. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15486. -@@ -601,6 +601,8 @@ static const struct sdiod_drive_str sdio
  15487. - #define BCM43241B0_NVRAM_NAME "brcm/brcmfmac43241b0-sdio.txt"
  15488. - #define BCM43241B4_FIRMWARE_NAME "brcm/brcmfmac43241b4-sdio.bin"
  15489. - #define BCM43241B4_NVRAM_NAME "brcm/brcmfmac43241b4-sdio.txt"
  15490. -+#define BCM43241B5_FIRMWARE_NAME "brcm/brcmfmac43241b5-sdio.bin"
  15491. -+#define BCM43241B5_NVRAM_NAME "brcm/brcmfmac43241b5-sdio.txt"
  15492. - #define BCM4329_FIRMWARE_NAME "brcm/brcmfmac4329-sdio.bin"
  15493. - #define BCM4329_NVRAM_NAME "brcm/brcmfmac4329-sdio.txt"
  15494. - #define BCM4330_FIRMWARE_NAME "brcm/brcmfmac4330-sdio.bin"
  15495. -@@ -628,6 +630,8 @@ MODULE_FIRMWARE(BCM43241B0_FIRMWARE_NAME
  15496. - MODULE_FIRMWARE(BCM43241B0_NVRAM_NAME);
  15497. - MODULE_FIRMWARE(BCM43241B4_FIRMWARE_NAME);
  15498. - MODULE_FIRMWARE(BCM43241B4_NVRAM_NAME);
  15499. -+MODULE_FIRMWARE(BCM43241B5_FIRMWARE_NAME);
  15500. -+MODULE_FIRMWARE(BCM43241B5_NVRAM_NAME);
  15501. - MODULE_FIRMWARE(BCM4329_FIRMWARE_NAME);
  15502. - MODULE_FIRMWARE(BCM4329_NVRAM_NAME);
  15503. - MODULE_FIRMWARE(BCM4330_FIRMWARE_NAME);
  15504. -@@ -667,7 +671,8 @@ enum brcmf_firmware_type {
  15505. - static const struct brcmf_firmware_names brcmf_fwname_data[] = {
  15506. - { BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43143) },
  15507. - { BRCM_CC_43241_CHIP_ID, 0x0000001F, BRCMF_FIRMWARE_NVRAM(BCM43241B0) },
  15508. -- { BRCM_CC_43241_CHIP_ID, 0xFFFFFFE0, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  15509. -+ { BRCM_CC_43241_CHIP_ID, 0x00000020, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  15510. -+ { BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43241B5) },
  15511. - { BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4329) },
  15512. - { BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4330) },
  15513. - { BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4334) },
  15514. 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
  15515. deleted file mode 100644
  15516. index d420308..0000000
  15517. --- a/package/kernel/mac80211/patches/359-brcmfmac-process-interrupt-regardless-sdiod-state.patch
  15518. +++ /dev/null
  15519. @@ -1,27 +0,0 @@
  15520. -From: Arend van Spriel <arend@broadcom.com>
  15521. -Date: Tue, 14 Apr 2015 20:10:29 +0200
  15522. -Subject: [PATCH] brcmfmac: process interrupt regardless sdiod state
  15523. -
  15524. -When the sdio bus state is not ready to process we abort the
  15525. -interrupt service routine. This is not wanted as it keeps the
  15526. -interrupt source active. Better clear the interrupt source.
  15527. -
  15528. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15529. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15530. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15531. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15532. ----
  15533. -
  15534. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15535. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15536. -@@ -3555,10 +3555,6 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  15537. - return;
  15538. - }
  15539. -
  15540. -- if (bus->sdiodev->state != BRCMF_SDIOD_DATA) {
  15541. -- brcmf_err("bus is down. we have nothing to do\n");
  15542. -- return;
  15543. -- }
  15544. - /* Count the interrupt call */
  15545. - bus->sdcnt.intrcount++;
  15546. - if (in_interrupt())
  15547. 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
  15548. deleted file mode 100644
  15549. index ac5584e..0000000
  15550. --- a/package/kernel/mac80211/patches/360-brcmfmac-fix-sdio-suspend-and-resume.patch
  15551. +++ /dev/null
  15552. @@ -1,68 +0,0 @@
  15553. -From: Arend van Spriel <arend@broadcom.com>
  15554. -Date: Tue, 14 Apr 2015 20:10:30 +0200
  15555. -Subject: [PATCH] brcmfmac: fix sdio suspend and resume
  15556. -
  15557. -commit 330b4e4be937 ("brcmfmac: Add wowl support for SDIO devices.")
  15558. -changed the behaviour by removing the MMC_PM_KEEP_POWER flag for
  15559. -non-wowl scenario, which needs to be restored. Another necessary
  15560. -change is to mark the card as being non-removable. With this in place
  15561. -the suspend resume test passes successfully doing:
  15562. -
  15563. - # echo devices > /sys/power/pm_test
  15564. - # echo mem > /sys/power/state
  15565. -
  15566. -Note that power may still be switched off when system is going
  15567. -in S3 state.
  15568. -
  15569. -Reported-by: Fu, Zhonghui <<zhonghui.fu@linux.intel.com>
  15570. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15571. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15572. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15573. ----
  15574. -
  15575. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15576. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15577. -@@ -1011,6 +1011,14 @@ static int brcmf_sdiod_remove(struct brc
  15578. - return 0;
  15579. - }
  15580. -
  15581. -+static void brcmf_sdiod_host_fixup(struct mmc_host *host)
  15582. -+{
  15583. -+ /* runtime-pm powers off the device */
  15584. -+ pm_runtime_forbid(host->parent);
  15585. -+ /* avoid removal detection upon resume */
  15586. -+ host->caps |= MMC_CAP_NONREMOVABLE;
  15587. -+}
  15588. -+
  15589. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  15590. - {
  15591. - struct sdio_func *func;
  15592. -@@ -1076,7 +1084,7 @@ static int brcmf_sdiod_probe(struct brcm
  15593. - ret = -ENODEV;
  15594. - goto out;
  15595. - }
  15596. -- pm_runtime_forbid(host->parent);
  15597. -+ brcmf_sdiod_host_fixup(host);
  15598. - out:
  15599. - if (ret)
  15600. - brcmf_sdiod_remove(sdiodev);
  15601. -@@ -1246,15 +1254,15 @@ static int brcmf_ops_sdio_suspend(struct
  15602. - brcmf_sdiod_freezer_on(sdiodev);
  15603. - brcmf_sdio_wd_timer(sdiodev->bus, 0);
  15604. -
  15605. -+ sdio_flags = MMC_PM_KEEP_POWER;
  15606. - if (sdiodev->wowl_enabled) {
  15607. -- sdio_flags = MMC_PM_KEEP_POWER;
  15608. - if (sdiodev->pdata->oob_irq_supported)
  15609. - enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  15610. - else
  15611. -- sdio_flags = MMC_PM_WAKE_SDIO_IRQ;
  15612. -- if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  15613. -- brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  15614. -+ sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
  15615. - }
  15616. -+ if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  15617. -+ brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  15618. - return 0;
  15619. - }
  15620. -
  15621. 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
  15622. deleted file mode 100644
  15623. index a521b65..0000000
  15624. --- a/package/kernel/mac80211/patches/361-brcmfmac-add-support-for-BCM4358-PCIe-device.patch
  15625. +++ /dev/null
  15626. @@ -1,77 +0,0 @@
  15627. -From: Arend van Spriel <arend@broadcom.com>
  15628. -Date: Tue, 14 Apr 2015 20:10:31 +0200
  15629. -Subject: [PATCH] brcmfmac: add support for BCM4358 PCIe device
  15630. -
  15631. -This patch adds support for the BCM4358 2x2 11ac device.
  15632. -
  15633. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15634. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15635. ----
  15636. -
  15637. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15638. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15639. -@@ -649,6 +649,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  15640. - case BRCM_CC_43567_CHIP_ID:
  15641. - case BRCM_CC_43569_CHIP_ID:
  15642. - case BRCM_CC_43570_CHIP_ID:
  15643. -+ case BRCM_CC_4358_CHIP_ID:
  15644. - case BRCM_CC_43602_CHIP_ID:
  15645. - return 0x180000;
  15646. - default:
  15647. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15648. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15649. -@@ -51,6 +51,8 @@ enum brcmf_pcie_state {
  15650. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  15651. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  15652. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  15653. -+#define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  15654. -+#define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  15655. -
  15656. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  15657. -
  15658. -@@ -189,6 +191,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME)
  15659. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  15660. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  15661. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  15662. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  15663. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  15664. -
  15665. -
  15666. - struct brcmf_pcie_console {
  15667. -@@ -1333,6 +1337,10 @@ static int brcmf_pcie_get_fwnames(struct
  15668. - fw_name = BRCMF_PCIE_43570_FW_NAME;
  15669. - nvram_name = BRCMF_PCIE_43570_NVRAM_NAME;
  15670. - break;
  15671. -+ case BRCM_CC_4358_CHIP_ID:
  15672. -+ fw_name = BRCMF_PCIE_4358_FW_NAME;
  15673. -+ nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  15674. -+ break;
  15675. - default:
  15676. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  15677. - return -ENODEV;
  15678. -@@ -1850,6 +1858,7 @@ static struct pci_device_id brcmf_pcie_d
  15679. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  15680. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  15681. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  15682. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID),
  15683. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  15684. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  15685. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  15686. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15687. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15688. -@@ -45,6 +45,7 @@
  15689. - #define BRCM_CC_43567_CHIP_ID 43567
  15690. - #define BRCM_CC_43569_CHIP_ID 43569
  15691. - #define BRCM_CC_43570_CHIP_ID 43570
  15692. -+#define BRCM_CC_4358_CHIP_ID 0x4358
  15693. - #define BRCM_CC_43602_CHIP_ID 43602
  15694. -
  15695. - /* USB Device IDs */
  15696. -@@ -59,6 +60,7 @@
  15697. - #define BRCM_PCIE_4356_DEVICE_ID 0x43ec
  15698. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  15699. - #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
  15700. -+#define BRCM_PCIE_4358_DEVICE_ID 0x43e9
  15701. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  15702. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  15703. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  15704. 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
  15705. deleted file mode 100644
  15706. index bcbb984..0000000
  15707. --- a/package/kernel/mac80211/patches/362-brcmfmac-add-additional-43602-pcie-device-id.patch
  15708. +++ /dev/null
  15709. @@ -1,30 +0,0 @@
  15710. -From: Hante Meuleman <meuleman@broadcom.com>
  15711. -Date: Tue, 14 Apr 2015 20:10:32 +0200
  15712. -Subject: [PATCH] brcmfmac: add additional 43602 pcie device id.
  15713. -
  15714. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  15715. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15716. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  15717. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15718. ----
  15719. -
  15720. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15721. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15722. -@@ -1862,6 +1862,7 @@ static struct pci_device_id brcmf_pcie_d
  15723. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  15724. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  15725. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  15726. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID),
  15727. - { /* end: all zeroes */ }
  15728. - };
  15729. -
  15730. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15731. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15732. -@@ -64,6 +64,7 @@
  15733. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  15734. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  15735. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  15736. -+#define BRCM_PCIE_43602_RAW_DEVICE_ID 43602
  15737. -
  15738. - /* brcmsmac IDs */
  15739. - #define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
  15740. 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
  15741. deleted file mode 100644
  15742. index 5f9bbea..0000000
  15743. --- a/package/kernel/mac80211/patches/363-brcmfmac-Add-support-for-multiple-PCIE-devices-in-nv.patch
  15744. +++ /dev/null
  15745. @@ -1,351 +0,0 @@
  15746. -From: Hante Meuleman <meuleman@broadcom.com>
  15747. -Date: Tue, 14 Apr 2015 20:10:33 +0200
  15748. -Subject: [PATCH] brcmfmac: Add support for multiple PCIE devices in
  15749. - nvram.
  15750. -
  15751. -With PCIE it is possible to support multiple devices with the
  15752. -same device type. They all load the same nvram file. In order to
  15753. -support this the nvram can specify which part of the nvram is
  15754. -for which pcie device. This patch adds support for these new
  15755. -types of nvram files.
  15756. -
  15757. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  15758. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15759. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15760. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15761. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  15762. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15763. ----
  15764. -
  15765. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  15766. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  15767. -@@ -23,6 +23,10 @@
  15768. - #include "debug.h"
  15769. - #include "firmware.h"
  15770. -
  15771. -+#define BRCMF_FW_MAX_NVRAM_SIZE 64000
  15772. -+#define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  15773. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  15774. -+
  15775. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  15776. - module_param_string(firmware_path, brcmf_firmware_path,
  15777. - BRCMF_FW_PATH_LEN, 0440);
  15778. -@@ -46,6 +50,8 @@ enum nvram_parser_state {
  15779. - * @column: current column in line.
  15780. - * @pos: byte offset in input buffer.
  15781. - * @entry: start position of key,value entry.
  15782. -+ * @multi_dev_v1: detect pcie multi device v1 (compressed).
  15783. -+ * @multi_dev_v2: detect pcie multi device v2.
  15784. - */
  15785. - struct nvram_parser {
  15786. - enum nvram_parser_state state;
  15787. -@@ -56,6 +62,8 @@ struct nvram_parser {
  15788. - u32 column;
  15789. - u32 pos;
  15790. - u32 entry;
  15791. -+ bool multi_dev_v1;
  15792. -+ bool multi_dev_v2;
  15793. - };
  15794. -
  15795. - static bool is_nvram_char(char c)
  15796. -@@ -108,6 +116,10 @@ static enum nvram_parser_state brcmf_nvr
  15797. - st = COMMENT;
  15798. - else
  15799. - st = VALUE;
  15800. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  15801. -+ nvp->multi_dev_v1 = true;
  15802. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  15803. -+ nvp->multi_dev_v2 = true;
  15804. - } else if (!is_nvram_char(c)) {
  15805. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  15806. - nvp->line, nvp->column);
  15807. -@@ -133,6 +145,8 @@ brcmf_nvram_handle_value(struct nvram_pa
  15808. - ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  15809. - skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  15810. - cplen = ekv - skv;
  15811. -+ if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  15812. -+ return END;
  15813. - /* copy to output buffer */
  15814. - memcpy(&nvp->nvram[nvp->nvram_len], skv, cplen);
  15815. - nvp->nvram_len += cplen;
  15816. -@@ -180,10 +194,18 @@ static enum nvram_parser_state
  15817. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  15818. - const struct firmware *nv)
  15819. - {
  15820. -+ size_t size;
  15821. -+
  15822. - memset(nvp, 0, sizeof(*nvp));
  15823. - nvp->fwnv = nv;
  15824. -+ /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  15825. -+ if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  15826. -+ size = BRCMF_FW_MAX_NVRAM_SIZE;
  15827. -+ else
  15828. -+ size = nv->size;
  15829. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  15830. -- nvp->nvram = kzalloc(nv->size + 1 + 3 + sizeof(u32), GFP_KERNEL);
  15831. -+ size += 1 + 3 + sizeof(u32);
  15832. -+ nvp->nvram = kzalloc(size, GFP_KERNEL);
  15833. - if (!nvp->nvram)
  15834. - return -ENOMEM;
  15835. -
  15836. -@@ -192,12 +214,136 @@ static int brcmf_init_nvram_parser(struc
  15837. - return 0;
  15838. - }
  15839. -
  15840. -+/* brcmf_fw_strip_multi_v1 :Some nvram files contain settings for multiple
  15841. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  15842. -+ * which data is to be returned. v1 is the version where nvram is stored
  15843. -+ * compressed and "devpath" maps to index for valid entries.
  15844. -+ */
  15845. -+static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  15846. -+ u16 bus_nr)
  15847. -+{
  15848. -+ u32 i, j;
  15849. -+ bool found;
  15850. -+ u8 *nvram;
  15851. -+ u8 id;
  15852. -+
  15853. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  15854. -+ if (!nvram)
  15855. -+ goto fail;
  15856. -+
  15857. -+ /* min length: devpath0=pcie/1/4/ + 0:x=y */
  15858. -+ if (nvp->nvram_len < BRCMF_FW_NVRAM_DEVPATH_LEN + 6)
  15859. -+ goto fail;
  15860. -+
  15861. -+ /* First search for the devpathX and see if it is the configuration
  15862. -+ * for domain_nr/bus_nr. Search complete nvp
  15863. -+ */
  15864. -+ found = false;
  15865. -+ i = 0;
  15866. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  15867. -+ /* Format: devpathX=pcie/Y/Z/
  15868. -+ * Y = domain_nr, Z = bus_nr, X = virtual ID
  15869. -+ */
  15870. -+ if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  15871. -+ (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  15872. -+ if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  15873. -+ ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  15874. -+ id = nvp->nvram[i + 7] - '0';
  15875. -+ found = true;
  15876. -+ break;
  15877. -+ }
  15878. -+ }
  15879. -+ while (nvp->nvram[i] != 0)
  15880. -+ i++;
  15881. -+ i++;
  15882. -+ }
  15883. -+ if (!found)
  15884. -+ goto fail;
  15885. -+
  15886. -+ /* Now copy all valid entries, release old nvram and assign new one */
  15887. -+ i = 0;
  15888. -+ j = 0;
  15889. -+ while (i < nvp->nvram_len) {
  15890. -+ if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  15891. -+ i += 2;
  15892. -+ while (nvp->nvram[i] != 0) {
  15893. -+ nvram[j] = nvp->nvram[i];
  15894. -+ i++;
  15895. -+ j++;
  15896. -+ }
  15897. -+ nvram[j] = 0;
  15898. -+ j++;
  15899. -+ }
  15900. -+ while (nvp->nvram[i] != 0)
  15901. -+ i++;
  15902. -+ i++;
  15903. -+ }
  15904. -+ kfree(nvp->nvram);
  15905. -+ nvp->nvram = nvram;
  15906. -+ nvp->nvram_len = j;
  15907. -+ return;
  15908. -+
  15909. -+fail:
  15910. -+ kfree(nvram);
  15911. -+ nvp->nvram_len = 0;
  15912. -+}
  15913. -+
  15914. -+/* brcmf_fw_strip_multi_v2 :Some nvram files contain settings for multiple
  15915. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  15916. -+ * which data is to be returned. v2 is the version where nvram is stored
  15917. -+ * uncompressed, all relevant valid entries are identified by
  15918. -+ * pcie/domain_nr/bus_nr:
  15919. -+ */
  15920. -+static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  15921. -+ u16 bus_nr)
  15922. -+{
  15923. -+ u32 i, j;
  15924. -+ u8 *nvram;
  15925. -+
  15926. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  15927. -+ if (!nvram)
  15928. -+ goto fail;
  15929. -+
  15930. -+ /* Copy all valid entries, release old nvram and assign new one.
  15931. -+ * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  15932. -+ * Y = bus_nr.
  15933. -+ */
  15934. -+ i = 0;
  15935. -+ j = 0;
  15936. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  15937. -+ if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  15938. -+ (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  15939. -+ ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  15940. -+ ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  15941. -+ i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  15942. -+ while (nvp->nvram[i] != 0) {
  15943. -+ nvram[j] = nvp->nvram[i];
  15944. -+ i++;
  15945. -+ j++;
  15946. -+ }
  15947. -+ nvram[j] = 0;
  15948. -+ j++;
  15949. -+ }
  15950. -+ while (nvp->nvram[i] != 0)
  15951. -+ i++;
  15952. -+ i++;
  15953. -+ }
  15954. -+ kfree(nvp->nvram);
  15955. -+ nvp->nvram = nvram;
  15956. -+ nvp->nvram_len = j;
  15957. -+ return;
  15958. -+fail:
  15959. -+ kfree(nvram);
  15960. -+ nvp->nvram_len = 0;
  15961. -+}
  15962. -+
  15963. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  15964. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  15965. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  15966. - * End of buffer is completed with token identifying length of buffer.
  15967. - */
  15968. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length)
  15969. -+static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  15970. -+ u16 domain_nr, u16 bus_nr)
  15971. - {
  15972. - struct nvram_parser nvp;
  15973. - u32 pad;
  15974. -@@ -212,6 +358,16 @@ static void *brcmf_fw_nvram_strip(const
  15975. - if (nvp.state == END)
  15976. - break;
  15977. - }
  15978. -+ if (nvp.multi_dev_v1)
  15979. -+ brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  15980. -+ else if (nvp.multi_dev_v2)
  15981. -+ brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  15982. -+
  15983. -+ if (nvp.nvram_len == 0) {
  15984. -+ kfree(nvp.nvram);
  15985. -+ return NULL;
  15986. -+ }
  15987. -+
  15988. - pad = nvp.nvram_len;
  15989. - *new_length = roundup(nvp.nvram_len + 1, 4);
  15990. - while (pad != *new_length) {
  15991. -@@ -239,6 +395,8 @@ struct brcmf_fw {
  15992. - u16 flags;
  15993. - const struct firmware *code;
  15994. - const char *nvram_name;
  15995. -+ u16 domain_nr;
  15996. -+ u16 bus_nr;
  15997. - void (*done)(struct device *dev, const struct firmware *fw,
  15998. - void *nvram_image, u32 nvram_len);
  15999. - };
  16000. -@@ -254,7 +412,8 @@ static void brcmf_fw_request_nvram_done(
  16001. - goto fail;
  16002. -
  16003. - if (fw) {
  16004. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length);
  16005. -+ nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  16006. -+ fwctx->domain_nr, fwctx->bus_nr);
  16007. - release_firmware(fw);
  16008. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  16009. - goto fail;
  16010. -@@ -309,11 +468,12 @@ fail:
  16011. - kfree(fwctx);
  16012. - }
  16013. -
  16014. --int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16015. -- const char *code, const char *nvram,
  16016. -- void (*fw_cb)(struct device *dev,
  16017. -- const struct firmware *fw,
  16018. -- void *nvram_image, u32 nvram_len))
  16019. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  16020. -+ const char *code, const char *nvram,
  16021. -+ void (*fw_cb)(struct device *dev,
  16022. -+ const struct firmware *fw,
  16023. -+ void *nvram_image, u32 nvram_len),
  16024. -+ u16 domain_nr, u16 bus_nr)
  16025. - {
  16026. - struct brcmf_fw *fwctx;
  16027. -
  16028. -@@ -333,8 +493,21 @@ int brcmf_fw_get_firmwares(struct device
  16029. - fwctx->done = fw_cb;
  16030. - if (flags & BRCMF_FW_REQUEST_NVRAM)
  16031. - fwctx->nvram_name = nvram;
  16032. -+ fwctx->domain_nr = domain_nr;
  16033. -+ fwctx->bus_nr = bus_nr;
  16034. -
  16035. - return request_firmware_nowait(THIS_MODULE, true, code, dev,
  16036. - GFP_KERNEL, fwctx,
  16037. - brcmf_fw_request_code_done);
  16038. - }
  16039. -+
  16040. -+int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16041. -+ const char *code, const char *nvram,
  16042. -+ void (*fw_cb)(struct device *dev,
  16043. -+ const struct firmware *fw,
  16044. -+ void *nvram_image, u32 nvram_len))
  16045. -+{
  16046. -+ return brcmf_fw_get_firmwares_pcie(dev, flags, code, nvram, fw_cb, 0,
  16047. -+ 0);
  16048. -+}
  16049. -+
  16050. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  16051. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  16052. -@@ -32,6 +32,12 @@ void brcmf_fw_nvram_free(void *nvram);
  16053. - * fails it will not use the callback, but call device_release_driver()
  16054. - * instead which will call the driver .remove() callback.
  16055. - */
  16056. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  16057. -+ const char *code, const char *nvram,
  16058. -+ void (*fw_cb)(struct device *dev,
  16059. -+ const struct firmware *fw,
  16060. -+ void *nvram_image, u32 nvram_len),
  16061. -+ u16 domain_nr, u16 bus_nr);
  16062. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16063. - const char *code, const char *nvram,
  16064. - void (*fw_cb)(struct device *dev,
  16065. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16066. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16067. -@@ -1649,8 +1649,13 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  16068. - struct brcmf_pciedev_info *devinfo;
  16069. - struct brcmf_pciedev *pcie_bus_dev;
  16070. - struct brcmf_bus *bus;
  16071. -+ u16 domain_nr;
  16072. -+ u16 bus_nr;
  16073. -
  16074. -- brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device);
  16075. -+ domain_nr = pci_domain_nr(pdev->bus) + 1;
  16076. -+ bus_nr = pdev->bus->number;
  16077. -+ brcmf_dbg(PCIE, "Enter %x:%x (%d/%d)\n", pdev->vendor, pdev->device,
  16078. -+ domain_nr, bus_nr);
  16079. -
  16080. - ret = -ENOMEM;
  16081. - devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL);
  16082. -@@ -1699,10 +1704,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  16083. - if (ret)
  16084. - goto fail_bus;
  16085. -
  16086. -- ret = brcmf_fw_get_firmwares(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  16087. -- BRCMF_FW_REQ_NV_OPTIONAL,
  16088. -- devinfo->fw_name, devinfo->nvram_name,
  16089. -- brcmf_pcie_setup);
  16090. -+ ret = brcmf_fw_get_firmwares_pcie(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  16091. -+ BRCMF_FW_REQ_NV_OPTIONAL,
  16092. -+ devinfo->fw_name, devinfo->nvram_name,
  16093. -+ brcmf_pcie_setup, domain_nr, bus_nr);
  16094. - if (ret == 0)
  16095. - return 0;
  16096. - fail_bus:
  16097. diff --git a/package/kernel/mac80211/patches/364-brcmfmac-cleanup-a-sizeof.patch b/package/kernel/mac80211/patches/364-brcmfmac-cleanup-a-sizeof.patch
  16098. deleted file mode 100644
  16099. index d26e118..0000000
  16100. --- a/package/kernel/mac80211/patches/364-brcmfmac-cleanup-a-sizeof.patch
  16101. +++ /dev/null
  16102. @@ -1,23 +0,0 @@
  16103. -From: Dan Carpenter <dan.carpenter@oracle.com>
  16104. -Date: Thu, 7 May 2015 12:59:19 +0300
  16105. -Subject: [PATCH] brcmfmac: cleanup a sizeof()
  16106. -
  16107. -"flowrings" and "*flowrings" are both pointers so this always returns
  16108. -sizeof(void *) and the current code works fine. But "*flowrings" is
  16109. -intended here and static checkers complain, so lets change it.
  16110. -
  16111. -Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  16112. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16113. ----
  16114. -
  16115. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16116. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16117. -@@ -1617,7 +1617,7 @@ static void brcmf_pcie_setup(struct devi
  16118. - bus->msgbuf->commonrings[i] =
  16119. - &devinfo->shared.commonrings[i]->commonring;
  16120. -
  16121. -- flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(flowrings),
  16122. -+ flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*flowrings),
  16123. - GFP_KERNEL);
  16124. - if (!flowrings)
  16125. - goto fail;
  16126. 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
  16127. deleted file mode 100644
  16128. index 9b2880d..0000000
  16129. --- a/package/kernel/mac80211/patches/365-brcmfmac-check-result-of-USB-firmware-request.patch
  16130. +++ /dev/null
  16131. @@ -1,33 +0,0 @@
  16132. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16133. -Date: Thu, 7 May 2015 14:13:03 +0200
  16134. -Subject: [PATCH] brcmfmac: check result of USB firmware request
  16135. -MIME-Version: 1.0
  16136. -Content-Type: text/plain; charset=UTF-8
  16137. -Content-Transfer-Encoding: 8bit
  16138. -
  16139. -This prevents silence failures with driver waiting (infinitely) for a
  16140. -callback.
  16141. -
  16142. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16143. -Acked-by: Arend van Spriel <arend@broadcom.com>
  16144. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16145. ----
  16146. -
  16147. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  16148. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  16149. -@@ -1270,8 +1270,13 @@ static int brcmf_usb_probe_cb(struct brc
  16150. - bus->chiprev = bus_pub->chiprev;
  16151. -
  16152. - /* request firmware here */
  16153. -- brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL,
  16154. -- brcmf_usb_probe_phase2);
  16155. -+ ret = brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo),
  16156. -+ NULL, brcmf_usb_probe_phase2);
  16157. -+ if (ret) {
  16158. -+ brcmf_err("firmware request failed: %d\n", ret);
  16159. -+ goto fail;
  16160. -+ }
  16161. -+
  16162. - return 0;
  16163. -
  16164. - fail:
  16165. 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
  16166. deleted file mode 100644
  16167. index d46b300..0000000
  16168. --- a/package/kernel/mac80211/patches/366-brcmfmac-prohibit-ACPI-power-management-for-brcmfmac.patch
  16169. +++ /dev/null
  16170. @@ -1,47 +0,0 @@
  16171. -From: "Fu, Zhonghui" <zhonghui.fu@linux.intel.com>
  16172. -Date: Mon, 11 May 2015 10:41:32 +0800
  16173. -Subject: [PATCH] brcmfmac: prohibit ACPI power management for brcmfmac driver
  16174. -
  16175. -ACPI will manage WiFi chip's power state during suspend/resume
  16176. -process on some tablet platforms(such as ASUS T100TA). This is
  16177. -not supported by brcmfmac driver now, and the context of WiFi
  16178. -chip will be damaged after resume. This patch informs ACPI not
  16179. -to manage WiFi chip's power state.
  16180. -
  16181. -Signed-off-by: Zhonghui Fu <zhonghui.fu@linux.intel.com>
  16182. -Acked-by: Arend van Spriel <arend@broadcom.com>
  16183. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16184. ----
  16185. -
  16186. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16187. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16188. -@@ -33,6 +33,7 @@
  16189. - #include <linux/suspend.h>
  16190. - #include <linux/errno.h>
  16191. - #include <linux/module.h>
  16192. -+#include <linux/acpi.h>
  16193. - #include <net/cfg80211.h>
  16194. -
  16195. - #include <defs.h>
  16196. -@@ -1122,6 +1123,8 @@ static int brcmf_ops_sdio_probe(struct s
  16197. - int err;
  16198. - struct brcmf_sdio_dev *sdiodev;
  16199. - struct brcmf_bus *bus_if;
  16200. -+ struct device *dev;
  16201. -+ struct acpi_device *adev;
  16202. -
  16203. - brcmf_dbg(SDIO, "Enter\n");
  16204. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  16205. -@@ -1129,6 +1132,12 @@ static int brcmf_ops_sdio_probe(struct s
  16206. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  16207. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  16208. -
  16209. -+ /* prohibit ACPI power management for this device */
  16210. -+ dev = &func->dev;
  16211. -+ adev = ACPI_COMPANION(dev);
  16212. -+ if (adev)
  16213. -+ adev->flags.power_manageable = 0;
  16214. -+
  16215. - /* Consume func num 1 but dont do anything with it. */
  16216. - if (func->num == 1)
  16217. - return 0;
  16218. 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
  16219. deleted file mode 100644
  16220. index 9b4609f..0000000
  16221. --- a/package/kernel/mac80211/patches/367-brcmfmac-avoid-gcc-5.1-warning.patch
  16222. +++ /dev/null
  16223. @@ -1,30 +0,0 @@
  16224. -From: Arnd Bergmann <arnd@arndb.de>
  16225. -Date: Tue, 12 May 2015 23:54:25 +0200
  16226. -Subject: [PATCH] brcmfmac: avoid gcc-5.1 warning
  16227. -
  16228. -gcc-5.0 gained a new warning in the fwsignal portion of the brcmfmac
  16229. -driver:
  16230. -
  16231. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c: In function 'brcmf_fws_txs_process':
  16232. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c:1478:8: warning: 'skb' may be used uninitialized in this function [-Wmaybe-uninitialized]
  16233. -
  16234. -This is a false positive, and marking the brcmf_fws_hanger_poppkt function
  16235. -as 'static inline' makes the warning go away. I have checked the object
  16236. -file output and while a little code gets moved around, the size of
  16237. -the binary remains identical.
  16238. -
  16239. -Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  16240. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16241. ----
  16242. -
  16243. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  16244. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  16245. -@@ -635,7 +635,7 @@ static int brcmf_fws_hanger_pushpkt(stru
  16246. - return 0;
  16247. - }
  16248. -
  16249. --static int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  16250. -+static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  16251. - u32 slot_id, struct sk_buff **pktout,
  16252. - bool remove_item)
  16253. - {
  16254. 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
  16255. deleted file mode 100644
  16256. index b16782d..0000000
  16257. --- a/package/kernel/mac80211/patches/368-brcmfmac-allow-device-tree-node-without-interrupts-p.patch
  16258. +++ /dev/null
  16259. @@ -1,45 +0,0 @@
  16260. -From: Arend van Spriel <arend@broadcom.com>
  16261. -Date: Wed, 20 May 2015 14:09:47 +0200
  16262. -Subject: [PATCH] brcmfmac: allow device tree node without 'interrupts'
  16263. - property
  16264. -
  16265. -As described in the device tree bindings for 'brcm,bcm4329-fmac'
  16266. -nodes, the interrupts property is optional. So adding a check
  16267. -for the presence of this property before attempting to parse
  16268. -and map the interrupt. If not present or parsing fails return
  16269. -and fallback to in-band sdio interrupt.
  16270. -
  16271. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16272. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16273. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16274. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16275. ----
  16276. -
  16277. ---- a/drivers/net/wireless/brcm80211/brcmfmac/of.c
  16278. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c
  16279. -@@ -39,10 +39,16 @@ void brcmf_of_probe(struct brcmf_sdio_de
  16280. - if (!sdiodev->pdata)
  16281. - return;
  16282. -
  16283. -+ if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  16284. -+ sdiodev->pdata->drive_strength = val;
  16285. -+
  16286. -+ /* make sure there are interrupts defined in the node */
  16287. -+ if (!of_find_property(np, "interrupts", NULL))
  16288. -+ return;
  16289. -+
  16290. - irq = irq_of_parse_and_map(np, 0);
  16291. - if (!irq) {
  16292. - brcmf_err("interrupt could not be mapped\n");
  16293. -- devm_kfree(dev, sdiodev->pdata);
  16294. - return;
  16295. - }
  16296. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  16297. -@@ -50,7 +56,4 @@ void brcmf_of_probe(struct brcmf_sdio_de
  16298. - sdiodev->pdata->oob_irq_supported = true;
  16299. - sdiodev->pdata->oob_irq_nr = irq;
  16300. - sdiodev->pdata->oob_irq_flags = irqf;
  16301. --
  16302. -- if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  16303. -- sdiodev->pdata->drive_strength = val;
  16304. - }
  16305. 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
  16306. deleted file mode 100644
  16307. index f81250e..0000000
  16308. --- a/package/kernel/mac80211/patches/369-brcmfmac-Improve-throughput-by-scheduling-msbug-flow.patch
  16309. +++ /dev/null
  16310. @@ -1,87 +0,0 @@
  16311. -From: Hante Meuleman <meuleman@broadcom.com>
  16312. -Date: Wed, 20 May 2015 14:09:48 +0200
  16313. -Subject: [PATCH] brcmfmac: Improve throughput by scheduling msbug flow worker.
  16314. -
  16315. -The tx flow worker in msgbuf gets scheduled at tx till a certain
  16316. -threshold has been reached. Then the tx completes will take over
  16317. -the scheduling. When amsdu and ampdu is used the frames are
  16318. -transferred wireless in a very bulky fashion, in combination
  16319. -with this scheduling algorithm and buffer limiters in the stack
  16320. -this can result in limited throughput. This change causes the
  16321. -flow worker to be scheduled more frequently from tx.
  16322. -
  16323. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16324. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16325. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16326. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  16327. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  16328. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16329. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16330. ----
  16331. -
  16332. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  16333. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  16334. -@@ -249,8 +249,8 @@ void brcmf_flowring_delete(struct brcmf_
  16335. - }
  16336. -
  16337. -
  16338. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16339. -- struct sk_buff *skb)
  16340. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16341. -+ struct sk_buff *skb)
  16342. - {
  16343. - struct brcmf_flowring_ring *ring;
  16344. -
  16345. -@@ -271,6 +271,7 @@ void brcmf_flowring_enqueue(struct brcmf
  16346. - if (skb_queue_len(&ring->skblist) < BRCMF_FLOWRING_LOW)
  16347. - brcmf_flowring_block(flow, flowid, false);
  16348. - }
  16349. -+ return skb_queue_len(&ring->skblist);
  16350. - }
  16351. -
  16352. -
  16353. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  16354. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  16355. -@@ -64,8 +64,8 @@ u32 brcmf_flowring_create(struct brcmf_f
  16356. - void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  16357. - void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  16358. - u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  16359. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16360. -- struct sk_buff *skb);
  16361. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16362. -+ struct sk_buff *skb);
  16363. - struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  16364. - void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  16365. - struct sk_buff *skb);
  16366. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16367. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16368. -@@ -73,7 +73,7 @@
  16369. - #define BRCMF_MSGBUF_TX_FLUSH_CNT1 32
  16370. - #define BRCMF_MSGBUF_TX_FLUSH_CNT2 96
  16371. -
  16372. --#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 64
  16373. -+#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  16374. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  16375. -
  16376. - struct msgbuf_common_hdr {
  16377. -@@ -797,6 +797,8 @@ static int brcmf_msgbuf_txdata(struct br
  16378. - struct brcmf_flowring *flow = msgbuf->flow;
  16379. - struct ethhdr *eh = (struct ethhdr *)(skb->data);
  16380. - u32 flowid;
  16381. -+ u32 queue_count;
  16382. -+ bool force;
  16383. -
  16384. - flowid = brcmf_flowring_lookup(flow, eh->h_dest, skb->priority, ifidx);
  16385. - if (flowid == BRCMF_FLOWRING_INVALID_ID) {
  16386. -@@ -804,8 +806,9 @@ static int brcmf_msgbuf_txdata(struct br
  16387. - if (flowid == BRCMF_FLOWRING_INVALID_ID)
  16388. - return -ENOMEM;
  16389. - }
  16390. -- brcmf_flowring_enqueue(flow, flowid, skb);
  16391. -- brcmf_msgbuf_schedule_txdata(msgbuf, flowid, false);
  16392. -+ queue_count = brcmf_flowring_enqueue(flow, flowid, skb);
  16393. -+ force = ((queue_count % BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS) == 0);
  16394. -+ brcmf_msgbuf_schedule_txdata(msgbuf, flowid, force);
  16395. -
  16396. - return 0;
  16397. - }
  16398. 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
  16399. deleted file mode 100644
  16400. index 61153c4..0000000
  16401. --- a/package/kernel/mac80211/patches/370-brcmfmac-remove-pci-shared-structure-rev4-support.patch
  16402. +++ /dev/null
  16403. @@ -1,41 +0,0 @@
  16404. -From: Franky Lin <frankyl@broadcom.com>
  16405. -Date: Wed, 20 May 2015 14:09:49 +0200
  16406. -Subject: [PATCH] brcmfmac: remove pci shared structure rev4 support
  16407. -
  16408. -All pcie full dongle chips supported by fmac are using rev 5+ shared
  16409. -structure. This patch removes the rev4 related code.
  16410. -
  16411. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16412. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16413. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16414. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16415. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16416. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16417. ----
  16418. -
  16419. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16420. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16421. -@@ -112,10 +112,9 @@ enum brcmf_pcie_state {
  16422. - BRCMF_PCIE_MB_INT_D2H3_DB0 | \
  16423. - BRCMF_PCIE_MB_INT_D2H3_DB1)
  16424. -
  16425. --#define BRCMF_PCIE_MIN_SHARED_VERSION 4
  16426. -+#define BRCMF_PCIE_MIN_SHARED_VERSION 5
  16427. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  16428. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  16429. --#define BRCMF_PCIE_SHARED_TXPUSH_SUPPORT 0x4000
  16430. -
  16431. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  16432. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  16433. -@@ -1280,11 +1279,6 @@ brcmf_pcie_init_share_ram_info(struct br
  16434. - brcmf_err("Unsupported PCIE version %d\n", version);
  16435. - return -EINVAL;
  16436. - }
  16437. -- if (shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT) {
  16438. -- brcmf_err("Unsupported legacy TX mode 0x%x\n",
  16439. -- shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT);
  16440. -- return -EINVAL;
  16441. -- }
  16442. -
  16443. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  16444. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  16445. 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
  16446. deleted file mode 100644
  16447. index 8c8eebe..0000000
  16448. --- a/package/kernel/mac80211/patches/371-brcmfmac-remove-dummy-cache-flush-invalidate-functio.patch
  16449. +++ /dev/null
  16450. @@ -1,120 +0,0 @@
  16451. -From: Franky Lin <frankyl@broadcom.com>
  16452. -Date: Wed, 20 May 2015 14:09:50 +0200
  16453. -Subject: [PATCH] brcmfmac: remove dummy cache flush/invalidate function
  16454. -
  16455. -brcmf_dma_flush and brcmf_dma_invalidate_cache are not necessary and
  16456. -have never been implemented.
  16457. -
  16458. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16459. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16460. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16461. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16462. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16463. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16464. ----
  16465. -
  16466. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  16467. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  16468. -@@ -22,17 +22,6 @@
  16469. - #include "core.h"
  16470. - #include "commonring.h"
  16471. -
  16472. --
  16473. --/* dma flushing needs implementation for mips and arm platforms. Should
  16474. -- * be put in util. Note, this is not real flushing. It is virtual non
  16475. -- * cached memory. Only write buffers should have to be drained. Though
  16476. -- * this may be different depending on platform......
  16477. -- * SEE ALSO msgbuf.c
  16478. -- */
  16479. --#define brcmf_dma_flush(addr, len)
  16480. --#define brcmf_dma_invalidate_cache(addr, len)
  16481. --
  16482. --
  16483. - void brcmf_commonring_register_cb(struct brcmf_commonring *commonring,
  16484. - int (*cr_ring_bell)(void *ctx),
  16485. - int (*cr_update_rptr)(void *ctx),
  16486. -@@ -206,14 +195,9 @@ int brcmf_commonring_write_complete(stru
  16487. - address = commonring->buf_addr;
  16488. - address += (commonring->f_ptr * commonring->item_len);
  16489. - if (commonring->f_ptr > commonring->w_ptr) {
  16490. -- brcmf_dma_flush(address,
  16491. -- (commonring->depth - commonring->f_ptr) *
  16492. -- commonring->item_len);
  16493. - address = commonring->buf_addr;
  16494. - commonring->f_ptr = 0;
  16495. - }
  16496. -- brcmf_dma_flush(address, (commonring->w_ptr - commonring->f_ptr) *
  16497. -- commonring->item_len);
  16498. -
  16499. - commonring->f_ptr = commonring->w_ptr;
  16500. -
  16501. -@@ -258,8 +242,6 @@ void *brcmf_commonring_get_read_ptr(stru
  16502. - if (commonring->r_ptr == commonring->depth)
  16503. - commonring->r_ptr = 0;
  16504. -
  16505. -- brcmf_dma_invalidate_cache(ret_addr, *n_ items * commonring->item_len);
  16506. --
  16507. - return ret_addr;
  16508. - }
  16509. -
  16510. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16511. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16512. -@@ -278,16 +278,6 @@ struct brcmf_msgbuf_pktids {
  16513. - struct brcmf_msgbuf_pktid *array;
  16514. - };
  16515. -
  16516. --
  16517. --/* dma flushing needs implementation for mips and arm platforms. Should
  16518. -- * be put in util. Note, this is not real flushing. It is virtual non
  16519. -- * cached memory. Only write buffers should have to be drained. Though
  16520. -- * this may be different depending on platform......
  16521. -- */
  16522. --#define brcmf_dma_flush(addr, len)
  16523. --#define brcmf_dma_invalidate_cache(addr, len)
  16524. --
  16525. --
  16526. - static void brcmf_msgbuf_rxbuf_ioctlresp_post(struct brcmf_msgbuf *msgbuf);
  16527. -
  16528. -
  16529. -@@ -462,7 +452,6 @@ static int brcmf_msgbuf_tx_ioctl(struct
  16530. - memcpy(msgbuf->ioctbuf, buf, buf_len);
  16531. - else
  16532. - memset(msgbuf->ioctbuf, 0, buf_len);
  16533. -- brcmf_dma_flush(ioctl_buf, buf_len);
  16534. -
  16535. - err = brcmf_commonring_write_complete(commonring);
  16536. - brcmf_commonring_unlock(commonring);
  16537. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16538. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16539. -@@ -276,15 +276,6 @@ static const u32 brcmf_ring_itemsize[BRC
  16540. - };
  16541. -
  16542. -
  16543. --/* dma flushing needs implementation for mips and arm platforms. Should
  16544. -- * be put in util. Note, this is not real flushing. It is virtual non
  16545. -- * cached memory. Only write buffers should have to be drained. Though
  16546. -- * this may be different depending on platform......
  16547. -- */
  16548. --#define brcmf_dma_flush(addr, len)
  16549. --#define brcmf_dma_invalidate_cache(addr, len)
  16550. --
  16551. --
  16552. - static u32
  16553. - brcmf_pcie_read_reg32(struct brcmf_pciedev_info *devinfo, u32 reg_offset)
  16554. - {
  16555. -@@ -1174,7 +1165,6 @@ static int brcmf_pcie_init_scratchbuffer
  16556. - goto fail;
  16557. -
  16558. - memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  16559. -- brcmf_dma_flush(devinfo->shared.scratch, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  16560. -
  16561. - addr = devinfo->shared.tcm_base_address +
  16562. - BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
  16563. -@@ -1192,7 +1182,6 @@ static int brcmf_pcie_init_scratchbuffer
  16564. - goto fail;
  16565. -
  16566. - memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  16567. -- brcmf_dma_flush(devinfo->shared.ringupd, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  16568. -
  16569. - addr = devinfo->shared.tcm_base_address +
  16570. - BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
  16571. 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
  16572. deleted file mode 100644
  16573. index 2f50abd..0000000
  16574. --- a/package/kernel/mac80211/patches/372-brcmfmac-add-support-for-dma-indices-feature.patch
  16575. +++ /dev/null
  16576. @@ -1,270 +0,0 @@
  16577. -From: Franky Lin <frankyl@broadcom.com>
  16578. -Date: Wed, 20 May 2015 14:09:51 +0200
  16579. -Subject: [PATCH] brcmfmac: add support for dma indices feature
  16580. -
  16581. -PCIe full dongle firmware can support a dma indices feature with which
  16582. -firmware can update/fetch the read/write indices of message buffer
  16583. -rings on both host to dongle and dongle to host directions. The support is
  16584. -announced by firmware through shared flags.
  16585. -
  16586. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16587. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16588. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16589. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16590. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16591. ----
  16592. -
  16593. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16594. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16595. -@@ -115,6 +115,8 @@ enum brcmf_pcie_state {
  16596. - #define BRCMF_PCIE_MIN_SHARED_VERSION 5
  16597. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  16598. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  16599. -+#define BRCMF_PCIE_SHARED_DMA_INDEX 0x10000
  16600. -+#define BRCMF_PCIE_SHARED_DMA_2B_IDX 0x100000
  16601. -
  16602. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  16603. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  16604. -@@ -146,6 +148,10 @@ enum brcmf_pcie_state {
  16605. - #define BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET 8
  16606. - #define BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET 12
  16607. - #define BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET 16
  16608. -+#define BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET 20
  16609. -+#define BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET 28
  16610. -+#define BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET 36
  16611. -+#define BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET 44
  16612. - #define BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET 0
  16613. - #define BRCMF_SHARED_RING_MAX_SUB_QUEUES 52
  16614. -
  16615. -@@ -247,6 +253,13 @@ struct brcmf_pciedev_info {
  16616. - bool mbdata_completed;
  16617. - bool irq_allocated;
  16618. - bool wowl_enabled;
  16619. -+ u8 dma_idx_sz;
  16620. -+ void *idxbuf;
  16621. -+ u32 idxbuf_sz;
  16622. -+ dma_addr_t idxbuf_dmahandle;
  16623. -+ u16 (*read_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset);
  16624. -+ void (*write_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  16625. -+ u16 value);
  16626. - };
  16627. -
  16628. - struct brcmf_pcie_ringbuf {
  16629. -@@ -323,6 +336,25 @@ brcmf_pcie_write_tcm16(struct brcmf_pcie
  16630. - }
  16631. -
  16632. -
  16633. -+static u16
  16634. -+brcmf_pcie_read_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  16635. -+{
  16636. -+ u16 *address = devinfo->idxbuf + mem_offset;
  16637. -+
  16638. -+ return (*(address));
  16639. -+}
  16640. -+
  16641. -+
  16642. -+static void
  16643. -+brcmf_pcie_write_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  16644. -+ u16 value)
  16645. -+{
  16646. -+ u16 *address = devinfo->idxbuf + mem_offset;
  16647. -+
  16648. -+ *(address) = value;
  16649. -+}
  16650. -+
  16651. -+
  16652. - static u32
  16653. - brcmf_pcie_read_tcm32(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  16654. - {
  16655. -@@ -868,7 +900,7 @@ static int brcmf_pcie_ring_mb_write_rptr
  16656. - brcmf_dbg(PCIE, "W r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  16657. - commonring->w_ptr, ring->id);
  16658. -
  16659. -- brcmf_pcie_write_tcm16(devinfo, ring->r_idx_addr, commonring->r_ptr);
  16660. -+ devinfo->write_ptr(devinfo, ring->r_idx_addr, commonring->r_ptr);
  16661. -
  16662. - return 0;
  16663. - }
  16664. -@@ -886,7 +918,7 @@ static int brcmf_pcie_ring_mb_write_wptr
  16665. - brcmf_dbg(PCIE, "W w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  16666. - commonring->r_ptr, ring->id);
  16667. -
  16668. -- brcmf_pcie_write_tcm16(devinfo, ring->w_idx_addr, commonring->w_ptr);
  16669. -+ devinfo->write_ptr(devinfo, ring->w_idx_addr, commonring->w_ptr);
  16670. -
  16671. - return 0;
  16672. - }
  16673. -@@ -915,7 +947,7 @@ static int brcmf_pcie_ring_mb_update_rpt
  16674. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  16675. - return -EIO;
  16676. -
  16677. -- commonring->r_ptr = brcmf_pcie_read_tcm16(devinfo, ring->r_idx_addr);
  16678. -+ commonring->r_ptr = devinfo->read_ptr(devinfo, ring->r_idx_addr);
  16679. -
  16680. - brcmf_dbg(PCIE, "R r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  16681. - commonring->w_ptr, ring->id);
  16682. -@@ -933,7 +965,7 @@ static int brcmf_pcie_ring_mb_update_wpt
  16683. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  16684. - return -EIO;
  16685. -
  16686. -- commonring->w_ptr = brcmf_pcie_read_tcm16(devinfo, ring->w_idx_addr);
  16687. -+ commonring->w_ptr = devinfo->read_ptr(devinfo, ring->w_idx_addr);
  16688. -
  16689. - brcmf_dbg(PCIE, "R w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  16690. - commonring->r_ptr, ring->id);
  16691. -@@ -1038,6 +1070,13 @@ static void brcmf_pcie_release_ringbuffe
  16692. - }
  16693. - kfree(devinfo->shared.flowrings);
  16694. - devinfo->shared.flowrings = NULL;
  16695. -+ if (devinfo->idxbuf) {
  16696. -+ dma_free_coherent(&devinfo->pdev->dev,
  16697. -+ devinfo->idxbuf_sz,
  16698. -+ devinfo->idxbuf,
  16699. -+ devinfo->idxbuf_dmahandle);
  16700. -+ devinfo->idxbuf = NULL;
  16701. -+ }
  16702. - }
  16703. -
  16704. -
  16705. -@@ -1053,19 +1092,72 @@ static int brcmf_pcie_init_ringbuffers(s
  16706. - u32 addr;
  16707. - u32 ring_mem_ptr;
  16708. - u32 i;
  16709. -+ u64 address;
  16710. -+ u32 bufsz;
  16711. - u16 max_sub_queues;
  16712. -+ u8 idx_offset;
  16713. -
  16714. - ring_addr = devinfo->shared.ring_info_addr;
  16715. - brcmf_dbg(PCIE, "Base ring addr = 0x%08x\n", ring_addr);
  16716. -+ addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  16717. -+ max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  16718. -
  16719. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  16720. -- d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16721. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  16722. -- d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16723. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  16724. -- h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16725. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  16726. -- h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16727. -+ if (devinfo->dma_idx_sz != 0) {
  16728. -+ bufsz = (BRCMF_NROF_D2H_COMMON_MSGRINGS + max_sub_queues) *
  16729. -+ devinfo->dma_idx_sz * 2;
  16730. -+ devinfo->idxbuf = dma_alloc_coherent(&devinfo->pdev->dev, bufsz,
  16731. -+ &devinfo->idxbuf_dmahandle,
  16732. -+ GFP_KERNEL);
  16733. -+ if (!devinfo->idxbuf)
  16734. -+ devinfo->dma_idx_sz = 0;
  16735. -+ }
  16736. -+
  16737. -+ if (devinfo->dma_idx_sz == 0) {
  16738. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  16739. -+ d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16740. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  16741. -+ d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16742. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  16743. -+ h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16744. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  16745. -+ h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16746. -+ idx_offset = sizeof(u32);
  16747. -+ devinfo->write_ptr = brcmf_pcie_write_tcm16;
  16748. -+ devinfo->read_ptr = brcmf_pcie_read_tcm16;
  16749. -+ brcmf_dbg(PCIE, "Using TCM indices\n");
  16750. -+ } else {
  16751. -+ memset(devinfo->idxbuf, 0, bufsz);
  16752. -+ devinfo->idxbuf_sz = bufsz;
  16753. -+ idx_offset = devinfo->dma_idx_sz;
  16754. -+ devinfo->write_ptr = brcmf_pcie_write_idx;
  16755. -+ devinfo->read_ptr = brcmf_pcie_read_idx;
  16756. -+
  16757. -+ h2d_w_idx_ptr = 0;
  16758. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET;
  16759. -+ address = (u64)devinfo->idxbuf_dmahandle;
  16760. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16761. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16762. -+
  16763. -+ h2d_r_idx_ptr = h2d_w_idx_ptr + max_sub_queues * idx_offset;
  16764. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET;
  16765. -+ address += max_sub_queues * idx_offset;
  16766. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16767. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16768. -+
  16769. -+ d2h_w_idx_ptr = h2d_r_idx_ptr + max_sub_queues * idx_offset;
  16770. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET;
  16771. -+ address += max_sub_queues * idx_offset;
  16772. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16773. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16774. -+
  16775. -+ d2h_r_idx_ptr = d2h_w_idx_ptr +
  16776. -+ BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  16777. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET;
  16778. -+ address += BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  16779. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16780. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16781. -+ brcmf_dbg(PCIE, "Using host memory indices\n");
  16782. -+ }
  16783. -
  16784. - addr = ring_addr + BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET;
  16785. - ring_mem_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16786. -@@ -1079,8 +1171,8 @@ static int brcmf_pcie_init_ringbuffers(s
  16787. - ring->id = i;
  16788. - devinfo->shared.commonrings[i] = ring;
  16789. -
  16790. -- h2d_w_idx_ptr += sizeof(u32);
  16791. -- h2d_r_idx_ptr += sizeof(u32);
  16792. -+ h2d_w_idx_ptr += idx_offset;
  16793. -+ h2d_r_idx_ptr += idx_offset;
  16794. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  16795. - }
  16796. -
  16797. -@@ -1094,13 +1186,11 @@ static int brcmf_pcie_init_ringbuffers(s
  16798. - ring->id = i;
  16799. - devinfo->shared.commonrings[i] = ring;
  16800. -
  16801. -- d2h_w_idx_ptr += sizeof(u32);
  16802. -- d2h_r_idx_ptr += sizeof(u32);
  16803. -+ d2h_w_idx_ptr += idx_offset;
  16804. -+ d2h_r_idx_ptr += idx_offset;
  16805. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  16806. - }
  16807. -
  16808. -- addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  16809. -- max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  16810. - devinfo->shared.nrof_flowrings =
  16811. - max_sub_queues - BRCMF_NROF_H2D_COMMON_MSGRINGS;
  16812. - rings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*ring),
  16813. -@@ -1124,15 +1214,15 @@ static int brcmf_pcie_init_ringbuffers(s
  16814. - ring);
  16815. - ring->w_idx_addr = h2d_w_idx_ptr;
  16816. - ring->r_idx_addr = h2d_r_idx_ptr;
  16817. -- h2d_w_idx_ptr += sizeof(u32);
  16818. -- h2d_r_idx_ptr += sizeof(u32);
  16819. -+ h2d_w_idx_ptr += idx_offset;
  16820. -+ h2d_r_idx_ptr += idx_offset;
  16821. - }
  16822. - devinfo->shared.flowrings = rings;
  16823. -
  16824. - return 0;
  16825. -
  16826. - fail:
  16827. -- brcmf_err("Allocating commonring buffers failed\n");
  16828. -+ brcmf_err("Allocating ring buffers failed\n");
  16829. - brcmf_pcie_release_ringbuffers(devinfo);
  16830. - return -ENOMEM;
  16831. - }
  16832. -@@ -1269,6 +1359,14 @@ brcmf_pcie_init_share_ram_info(struct br
  16833. - return -EINVAL;
  16834. - }
  16835. -
  16836. -+ /* check firmware support dma indicies */
  16837. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_INDEX) {
  16838. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_2B_IDX)
  16839. -+ devinfo->dma_idx_sz = sizeof(u16);
  16840. -+ else
  16841. -+ devinfo->dma_idx_sz = sizeof(u32);
  16842. -+ }
  16843. -+
  16844. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  16845. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  16846. - if (shared->max_rxbufpost == 0)
  16847. 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
  16848. deleted file mode 100644
  16849. index 28408d2..0000000
  16850. --- a/package/kernel/mac80211/patches/373-brcmfmac-avoid-null-pointer-access-when-brcmf_msgbuf.patch
  16851. +++ /dev/null
  16852. @@ -1,102 +0,0 @@
  16853. -From: Arend van Spriel <arend@broadcom.com>
  16854. -Date: Tue, 26 May 2015 13:19:46 +0200
  16855. -Subject: [PATCH] brcmfmac: avoid null pointer access when
  16856. - brcmf_msgbuf_get_pktid() fails
  16857. -
  16858. -The function brcmf_msgbuf_get_pktid() may return a NULL pointer so
  16859. -the callers should check the return pointer before accessing it to
  16860. -avoid the crash below (see [1]):
  16861. -
  16862. -brcmfmac: brcmf_msgbuf_get_pktid: Invalid packet id 273 (not in use)
  16863. -BUG: unable to handle kernel NULL pointer dereference at 0000000000000080
  16864. -IP: [<ffffffff8145b225>] skb_pull+0x5/0x50
  16865. -PGD 0
  16866. -Oops: 0000 [#1] PREEMPT SMP
  16867. -Modules linked in: pci_stub vboxpci(O) vboxnetflt(O) vboxnetadp(O) vboxdrv(O)
  16868. - snd_hda_codec_hdmi bnep mousedev hid_generic ushwmon msr ext4 crc16 mbcache
  16869. - jbd2 sd_mod uas usb_storage ahci libahci libata scsi_mod xhci_pci xhci_hcd
  16870. - usbcore usb_common
  16871. -CPU: 0 PID: 1661 Comm: irq/61-brcmf_pc Tainted: G O 4.0.1-MacbookPro-ARCH #1
  16872. -Hardware name: Apple Inc. MacBookPro12,1/Mac-E43C1C25D4880AD6,
  16873. - BIOS MBP121.88Z.0167.B02.1503241251 03/24/2015
  16874. -task: ffff880264203cc0 ti: ffff88025ffe4000 task.ti: ffff88025ffe4000
  16875. -RIP: 0010:[<ffffffff8145b225>] [<ffffffff8145b225>] skb_pull+0x5/0x50
  16876. -RSP: 0018:ffff88025ffe7d40 EFLAGS: 00010202
  16877. -RAX: 0000000000000000 RBX: ffff88008a33c000 RCX: 0000000000000044
  16878. -RDX: 0000000000000000 RSI: 000000000000004a RDI: 0000000000000000
  16879. -RBP: ffff88025ffe7da8 R08: 0000000000000096 R09: 000000000000004a
  16880. -R10: 0000000000000000 R11: 000000000000048e R12: ffff88025ff14f00
  16881. -R13: 0000000000000000 R14: ffff880263b48200 R15: ffff88008a33c000
  16882. -FS: 0000000000000000(0000) GS:ffff88026ec00000(0000) knlGS:0000000000000000
  16883. -CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  16884. -CR2: 0000000000000080 CR3: 000000000180b000 CR4: 00000000003407f0
  16885. -Stack:
  16886. - ffffffffa06aed74 ffff88025ffe7dc8 ffff880263b48270 ffff880263b48278
  16887. - 05ea88020000004a 0002ffff81014635 000000001720b2f6 ffff88026ec116c0
  16888. - ffff880263b48200 0000000000010000 ffff880263b4ae00 ffff880264203cc0
  16889. -Call Trace:
  16890. - [<ffffffffa06aed74>] ? brcmf_msgbuf_process_rx+0x404/0x480 [brcmfmac]
  16891. - [<ffffffff810cea60>] ? irq_finalize_oneshot.part.30+0xf0/0xf0
  16892. - [<ffffffffa06afb55>] brcmf_proto_msgbuf_rx_trigger+0x35/0xf0 [brcmfmac]
  16893. - [<ffffffffa06baf2a>] brcmf_pcie_isr_thread_v2+0x8a/0x130 [brcmfmac]
  16894. - [<ffffffff810cea80>] irq_thread_fn+0x20/0x50
  16895. - [<ffffffff810ceddf>] irq_thread+0x13f/0x170
  16896. - [<ffffffff810cebf0>] ? wake_threads_waitq+0x30/0x30
  16897. - [<ffffffff810ceca0>] ? irq_thread_dtor+0xb0/0xb0
  16898. - [<ffffffff81092a08>] kthread+0xd8/0xf0
  16899. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  16900. - [<ffffffff8156d898>] ret_from_fork+0x58/0x90
  16901. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  16902. -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
  16903. - f7 88 50 01 c3 66 0f 1f 84 00 00 00 00 00 0f 1f
  16904. -RIP [<ffffffff8145b225>] skb_pull+0x5/0x50
  16905. - RSP <ffff88025ffe7d40>
  16906. -CR2: 0000000000000080
  16907. ----[ end trace b074c0f90e7c997d ]---
  16908. -
  16909. -[1] http://mid.gmane.org/20150430193259.GA5630@googlemail.com
  16910. -
  16911. -Cc: <stable@vger.kernel.org> # v3.18, v3.19, v4.0, v4.1
  16912. -Reported-by: Michael Hornung <mhornung.linux@gmail.com>
  16913. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16914. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16915. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16916. ----
  16917. -
  16918. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16919. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16920. -@@ -500,11 +500,9 @@ static int brcmf_msgbuf_query_dcmd(struc
  16921. - msgbuf->rx_pktids,
  16922. - msgbuf->ioctl_resp_pktid);
  16923. - if (msgbuf->ioctl_resp_ret_len != 0) {
  16924. -- if (!skb) {
  16925. -- brcmf_err("Invalid packet id idx recv'd %d\n",
  16926. -- msgbuf->ioctl_resp_pktid);
  16927. -+ if (!skb)
  16928. - return -EBADF;
  16929. -- }
  16930. -+
  16931. - memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ?
  16932. - len : msgbuf->ioctl_resp_ret_len);
  16933. - }
  16934. -@@ -866,10 +864,8 @@ brcmf_msgbuf_process_txstatus(struct brc
  16935. - flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS;
  16936. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  16937. - msgbuf->tx_pktids, idx);
  16938. -- if (!skb) {
  16939. -- brcmf_err("Invalid packet id idx recv'd %d\n", idx);
  16940. -+ if (!skb)
  16941. - return;
  16942. -- }
  16943. -
  16944. - set_bit(flowid, msgbuf->txstatus_done_map);
  16945. - commonring = msgbuf->flowrings[flowid];
  16946. -@@ -1148,6 +1144,8 @@ brcmf_msgbuf_process_rx_complete(struct
  16947. -
  16948. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  16949. - msgbuf->rx_pktids, idx);
  16950. -+ if (!skb)
  16951. -+ return;
  16952. -
  16953. - if (data_offset)
  16954. - skb_pull(skb, data_offset);
  16955. 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
  16956. deleted file mode 100644
  16957. index f023034..0000000
  16958. --- a/package/kernel/mac80211/patches/374-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch
  16959. +++ /dev/null
  16960. @@ -1,63 +0,0 @@
  16961. -From: Arend van Spriel <arend@broadcom.com>
  16962. -Date: Wed, 27 May 2015 19:31:41 +0200
  16963. -Subject: [PATCH] brcmfmac: fix invalid access to struct acpi_device fields
  16964. -
  16965. -The fields of struct acpi_device are only known when CONFIG_ACPI is
  16966. -defined. Fix this by using a helper function. This will resolve the
  16967. -issue found in linux-next:
  16968. -
  16969. - ../brcmfmac/bcmsdh.c: In function 'brcmf_ops_sdio_probe':
  16970. - ../brcmfmac/bcmsdh.c:1139:7: error: dereferencing pointer to incomplete type
  16971. - adev->flags.power_manageable = 0;
  16972. - ^
  16973. -
  16974. -Fixes: f0992ace680c ("brcmfmac: prohibit ACPI power management ...")
  16975. -Cc: Fu, Zhonghui <zhonghui.fu@linux.intel.com>
  16976. -Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
  16977. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16978. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16979. ----
  16980. -
  16981. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16982. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16983. -@@ -1117,6 +1117,18 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_id
  16984. - static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
  16985. -
  16986. -
  16987. -+static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
  16988. -+ int val)
  16989. -+{
  16990. -+#if IS_ENABLED(CONFIG_ACPI)
  16991. -+ struct acpi_device *adev;
  16992. -+
  16993. -+ adev = ACPI_COMPANION(dev);
  16994. -+ if (adev)
  16995. -+ adev->flags.power_manageable = 0;
  16996. -+#endif
  16997. -+}
  16998. -+
  16999. - static int brcmf_ops_sdio_probe(struct sdio_func *func,
  17000. - const struct sdio_device_id *id)
  17001. - {
  17002. -@@ -1124,7 +1136,6 @@ static int brcmf_ops_sdio_probe(struct s
  17003. - struct brcmf_sdio_dev *sdiodev;
  17004. - struct brcmf_bus *bus_if;
  17005. - struct device *dev;
  17006. -- struct acpi_device *adev;
  17007. -
  17008. - brcmf_dbg(SDIO, "Enter\n");
  17009. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  17010. -@@ -1132,11 +1143,9 @@ static int brcmf_ops_sdio_probe(struct s
  17011. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  17012. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  17013. -
  17014. -- /* prohibit ACPI power management for this device */
  17015. - dev = &func->dev;
  17016. -- adev = ACPI_COMPANION(dev);
  17017. -- if (adev)
  17018. -- adev->flags.power_manageable = 0;
  17019. -+ /* prohibit ACPI power management for this device */
  17020. -+ brcmf_sdiod_acpi_set_power_manageable(dev, 0);
  17021. -
  17022. - /* Consume func num 1 but dont do anything with it. */
  17023. - if (func->num == 1)
  17024. 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
  17025. deleted file mode 100644
  17026. index 2bfd44f..0000000
  17027. --- a/package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
  17028. +++ /dev/null
  17029. @@ -1,56 +0,0 @@
  17030. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17031. -Date: Wed, 20 May 2015 09:34:21 +0200
  17032. -Subject: [PATCH] brcmfmac: simplify check stripping v2 NVRAM
  17033. -MIME-Version: 1.0
  17034. -Content-Type: text/plain; charset=UTF-8
  17035. -Content-Transfer-Encoding: 8bit
  17036. -
  17037. -Comparing NVRAM entry with a full filtering string is simpler than
  17038. -comparing it with a short prefix and then checking random chars at magic
  17039. -offsets. The cost of snprintf relatively low, we execute it just once.
  17040. -Tested on BCM43602 with NVRAM hacked to use V2 format.
  17041. -
  17042. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17043. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17044. ----
  17045. -
  17046. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17047. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17048. -@@ -25,7 +25,7 @@
  17049. -
  17050. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  17051. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  17052. --#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  17053. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  17054. -
  17055. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  17056. - module_param_string(firmware_path, brcmf_firmware_path,
  17057. -@@ -297,6 +297,8 @@ fail:
  17058. - static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  17059. - u16 bus_nr)
  17060. - {
  17061. -+ char prefix[BRCMF_FW_NVRAM_PCIEDEV_LEN];
  17062. -+ size_t len;
  17063. - u32 i, j;
  17064. - u8 *nvram;
  17065. -
  17066. -@@ -308,14 +310,13 @@ static void brcmf_fw_strip_multi_v2(stru
  17067. - * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  17068. - * Y = bus_nr.
  17069. - */
  17070. -+ snprintf(prefix, sizeof(prefix), "pcie/%d/%d/", domain_nr, bus_nr);
  17071. -+ len = strlen(prefix);
  17072. - i = 0;
  17073. - j = 0;
  17074. -- while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  17075. -- if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  17076. -- (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  17077. -- ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  17078. -- ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  17079. -- i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  17080. -+ while (i < nvp->nvram_len - len) {
  17081. -+ if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  17082. -+ i += len;
  17083. - while (nvp->nvram[i] != 0) {
  17084. - nvram[j] = nvp->nvram[i];
  17085. - i++;
  17086. 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
  17087. deleted file mode 100644
  17088. index 0e65114..0000000
  17089. --- a/package/kernel/mac80211/patches/376-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch
  17090. +++ /dev/null
  17091. @@ -1,57 +0,0 @@
  17092. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17093. -Date: Wed, 20 May 2015 11:01:08 +0200
  17094. -Subject: [PATCH] brcmfmac: simplify check finding NVRAM v1 device path
  17095. -MIME-Version: 1.0
  17096. -Content-Type: text/plain; charset=UTF-8
  17097. -Content-Transfer-Encoding: 8bit
  17098. -
  17099. -With a simple use of snprintf and small buffer we can compare NVRAM
  17100. -entry value with a full string. This way we avoid checking random chars
  17101. -at magic offsets.
  17102. -Tested on BCM43602 with NVRAM hacked to use v1 format.
  17103. -
  17104. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17105. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17106. ----
  17107. -
  17108. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17109. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17110. -@@ -222,6 +222,10 @@ static int brcmf_init_nvram_parser(struc
  17111. - static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  17112. - u16 bus_nr)
  17113. - {
  17114. -+ /* Device path with a leading '=' key-value separator */
  17115. -+ char pcie_path[] = "=pcie/?/?";
  17116. -+ size_t pcie_len;
  17117. -+
  17118. - u32 i, j;
  17119. - bool found;
  17120. - u8 *nvram;
  17121. -@@ -238,6 +242,9 @@ static void brcmf_fw_strip_multi_v1(stru
  17122. - /* First search for the devpathX and see if it is the configuration
  17123. - * for domain_nr/bus_nr. Search complete nvp
  17124. - */
  17125. -+ snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  17126. -+ bus_nr);
  17127. -+ pcie_len = strlen(pcie_path);
  17128. - found = false;
  17129. - i = 0;
  17130. - while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  17131. -@@ -245,13 +252,10 @@ static void brcmf_fw_strip_multi_v1(stru
  17132. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  17133. - */
  17134. - if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  17135. -- (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  17136. -- if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  17137. -- ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  17138. -- id = nvp->nvram[i + 7] - '0';
  17139. -- found = true;
  17140. -- break;
  17141. -- }
  17142. -+ (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  17143. -+ id = nvp->nvram[i + 7] - '0';
  17144. -+ found = true;
  17145. -+ break;
  17146. - }
  17147. - while (nvp->nvram[i] != 0)
  17148. - i++;
  17149. 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
  17150. deleted file mode 100644
  17151. index dc174e5..0000000
  17152. --- a/package/kernel/mac80211/patches/377-brcmfmac-treat-0-as-end-of-comment-when-parsing-NVRA.patch
  17153. +++ /dev/null
  17154. @@ -1,45 +0,0 @@
  17155. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17156. -Date: Wed, 20 May 2015 13:59:54 +0200
  17157. -Subject: [PATCH] brcmfmac: treat \0 as end of comment when parsing NVRAM
  17158. -MIME-Version: 1.0
  17159. -Content-Type: text/plain; charset=UTF-8
  17160. -Content-Transfer-Encoding: 8bit
  17161. -
  17162. -This fixes brcmfmac dealing with NVRAM coming from platform e.g. from a
  17163. -flash MTD partition. In such cases entries are separated by \0 instead
  17164. -of \n which caused ignoring whole content after the first "comment".
  17165. -While platform NVRAM doesn't usually contain comments, we switch to
  17166. -COMMENT state after e.g. finding an unexpected char in key name.
  17167. -
  17168. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17169. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17170. ----
  17171. -
  17172. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17173. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17174. -@@ -162,17 +162,20 @@ brcmf_nvram_handle_value(struct nvram_pa
  17175. - static enum nvram_parser_state
  17176. - brcmf_nvram_handle_comment(struct nvram_parser *nvp)
  17177. - {
  17178. -- char *eol, *sol;
  17179. -+ char *eoc, *sol;
  17180. -
  17181. - sol = (char *)&nvp->fwnv->data[nvp->pos];
  17182. -- eol = strchr(sol, '\n');
  17183. -- if (eol == NULL)
  17184. -- return END;
  17185. -+ eoc = strchr(sol, '\n');
  17186. -+ if (!eoc) {
  17187. -+ eoc = strchr(sol, '\0');
  17188. -+ if (!eoc)
  17189. -+ return END;
  17190. -+ }
  17191. -
  17192. - /* eat all moving to next line */
  17193. - nvp->line++;
  17194. - nvp->column = 1;
  17195. -- nvp->pos += (eol - sol) + 1;
  17196. -+ nvp->pos += (eoc - sol) + 1;
  17197. - return IDLE;
  17198. - }
  17199. -
  17200. 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
  17201. deleted file mode 100644
  17202. index 5700142..0000000
  17203. --- a/package/kernel/mac80211/patches/378-brcmfmac-allow-NVRAM-values-to-contain-spaces.patch
  17204. +++ /dev/null
  17205. @@ -1,50 +0,0 @@
  17206. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17207. -Date: Sat, 23 May 2015 09:15:33 +0200
  17208. -Subject: [PATCH] brcmfmac: allow NVRAM values to contain spaces
  17209. -MIME-Version: 1.0
  17210. -Content-Type: text/plain; charset=UTF-8
  17211. -Content-Transfer-Encoding: 8bit
  17212. -
  17213. -Platform NVRAMs often contain values with spaces. Even if right now most
  17214. -firmware-supported entries are simple values, we shouldn't reject these
  17215. -with spaces. It was semi-confirmed by Broadcom in the early patch adding
  17216. -support for platform NVRAMs.
  17217. -
  17218. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17219. -Acked-by: Arend van Spriel <arend@broadcom.com>
  17220. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17221. ----
  17222. -
  17223. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17224. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17225. -@@ -66,6 +66,12 @@ struct nvram_parser {
  17226. - bool multi_dev_v2;
  17227. - };
  17228. -
  17229. -+/**
  17230. -+ * is_nvram_char() - check if char is a valid one for NVRAM entry
  17231. -+ *
  17232. -+ * It accepts all printable ASCII chars except for '#' which opens a comment.
  17233. -+ * Please note that ' ' (space) while accepted is not a valid key name char.
  17234. -+ */
  17235. - static bool is_nvram_char(char c)
  17236. - {
  17237. - /* comment marker excluded */
  17238. -@@ -73,7 +79,7 @@ static bool is_nvram_char(char c)
  17239. - return false;
  17240. -
  17241. - /* key and value may have any other readable character */
  17242. -- return (c > 0x20 && c < 0x7f);
  17243. -+ return (c >= 0x20 && c < 0x7f);
  17244. - }
  17245. -
  17246. - static bool is_whitespace(char c)
  17247. -@@ -120,7 +126,7 @@ static enum nvram_parser_state brcmf_nvr
  17248. - nvp->multi_dev_v1 = true;
  17249. - if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  17250. - nvp->multi_dev_v2 = true;
  17251. -- } else if (!is_nvram_char(c)) {
  17252. -+ } else if (!is_nvram_char(c) || c == ' ') {
  17253. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  17254. - nvp->line, nvp->column);
  17255. - return COMMENT;
  17256. 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
  17257. deleted file mode 100644
  17258. index 814b0d7..0000000
  17259. --- a/package/kernel/mac80211/patches/379-ath9k-fix-DMA-stop-sequence-for-AR9003.patch
  17260. +++ /dev/null
  17261. @@ -1,33 +0,0 @@
  17262. -From: Felix Fietkau <nbd@openwrt.org>
  17263. -Date: Tue, 2 Jun 2015 10:35:46 +0200
  17264. -Subject: [PATCH] ath9k: fix DMA stop sequence for AR9003+
  17265. -
  17266. -AR93xx and newer needs to stop rx before tx to avoid getting the DMA
  17267. -engine or MAC into a stuck state.
  17268. -This should reduce/fix the occurence of "Failed to stop Tx DMA" logspam.
  17269. -
  17270. -Cc: stable@vger.kernel.org
  17271. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  17272. ----
  17273. -
  17274. ---- a/drivers/net/wireless/ath/ath9k/main.c
  17275. -+++ b/drivers/net/wireless/ath/ath9k/main.c
  17276. -@@ -216,11 +216,13 @@ static bool ath_prepare_reset(struct ath
  17277. - ath_stop_ani(sc);
  17278. - ath9k_hw_disable_interrupts(ah);
  17279. -
  17280. -- if (!ath_drain_all_txq(sc))
  17281. -- ret = false;
  17282. --
  17283. -- if (!ath_stoprecv(sc))
  17284. -- ret = false;
  17285. -+ if (AR_SREV_9300_20_OR_LATER(ah)) {
  17286. -+ ret &= ath_stoprecv(sc);
  17287. -+ ret &= ath_drain_all_txq(sc);
  17288. -+ } else {
  17289. -+ ret &= ath_drain_all_txq(sc);
  17290. -+ ret &= ath_stoprecv(sc);
  17291. -+ }
  17292. -
  17293. - return ret;
  17294. - }
  17295. 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
  17296. deleted file mode 100644
  17297. index 7bbd57e..0000000
  17298. --- a/package/kernel/mac80211/patches/380-brcmfmac-support-NVRAMs-containing-pci-devpaths-inst.patch
  17299. +++ /dev/null
  17300. @@ -1,56 +0,0 @@
  17301. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17302. -Date: Thu, 28 May 2015 14:19:21 +0200
  17303. -Subject: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of
  17304. - pcie)
  17305. -MIME-Version: 1.0
  17306. -Content-Type: text/plain; charset=UTF-8
  17307. -Content-Transfer-Encoding: 8bit
  17308. -
  17309. -Recently Broadcom added support for NVRAMs with entries for multiple
  17310. -PCIe devices. One of the supported formats is based on prefixes defined
  17311. -like: devpath0=pcie/1/4/ and entries like 0:foo=bar 0:baz=qux etc.
  17312. -
  17313. -Unfortunately there are also a bit older devices using different way of
  17314. -defining prefixes, e.g. SmartRG SR400ac (2 x BCM43602) with entries:
  17315. -devpath0=pci/1/1/
  17316. -devpath1=pci/2/1
  17317. -Broadcom stated this old format will never be used/supported by brcmfmac
  17318. -but given the simplicity of this patch I'll insist on supporting it.
  17319. -
  17320. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17321. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17322. ----
  17323. -
  17324. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17325. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17326. -@@ -232,6 +232,8 @@ static void brcmf_fw_strip_multi_v1(stru
  17327. - u16 bus_nr)
  17328. - {
  17329. - /* Device path with a leading '=' key-value separator */
  17330. -+ char pci_path[] = "=pci/?/?";
  17331. -+ size_t pci_len;
  17332. - char pcie_path[] = "=pcie/?/?";
  17333. - size_t pcie_len;
  17334. -
  17335. -@@ -251,6 +253,9 @@ static void brcmf_fw_strip_multi_v1(stru
  17336. - /* First search for the devpathX and see if it is the configuration
  17337. - * for domain_nr/bus_nr. Search complete nvp
  17338. - */
  17339. -+ snprintf(pci_path, sizeof(pci_path), "=pci/%d/%d", domain_nr,
  17340. -+ bus_nr);
  17341. -+ pci_len = strlen(pci_path);
  17342. - snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  17343. - bus_nr);
  17344. - pcie_len = strlen(pcie_path);
  17345. -@@ -260,8 +265,9 @@ static void brcmf_fw_strip_multi_v1(stru
  17346. - /* Format: devpathX=pcie/Y/Z/
  17347. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  17348. - */
  17349. -- if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  17350. -- (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  17351. -+ if (strncmp(&nvp->nvram[i], "devpath", 7) == 0 &&
  17352. -+ (!strncmp(&nvp->nvram[i + 8], pci_path, pci_len) ||
  17353. -+ !strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len))) {
  17354. - id = nvp->nvram[i + 7] - '0';
  17355. - found = true;
  17356. - break;
  17357. 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
  17358. deleted file mode 100644
  17359. index 1eff6ed..0000000
  17360. --- a/package/kernel/mac80211/patches/381-brcmfmac-set-wiphy-perm_addr-to-hardware-MAC-address.patch
  17361. +++ /dev/null
  17362. @@ -1,23 +0,0 @@
  17363. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17364. -Date: Sun, 31 May 2015 02:52:26 +0200
  17365. -Subject: [PATCH] brcmfmac: set wiphy perm_addr to hardware MAC address
  17366. -MIME-Version: 1.0
  17367. -Content-Type: text/plain; charset=UTF-8
  17368. -Content-Transfer-Encoding: 8bit
  17369. -
  17370. -This allows e.g. user space to use /sys/class/ieee80211/*/macaddress
  17371. -
  17372. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17373. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17374. ----
  17375. -
  17376. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17377. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17378. -@@ -6070,6 +6070,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  17379. - brcmf_err("Could not allocate wiphy device\n");
  17380. - return NULL;
  17381. - }
  17382. -+ memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
  17383. - set_wiphy_dev(wiphy, busdev);
  17384. -
  17385. - cfg = wiphy_priv(wiphy);
  17386. 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
  17387. deleted file mode 100644
  17388. index c6e83dd..0000000
  17389. --- a/package/kernel/mac80211/patches/382-brcmfmac-use-direct-data-pointer-in-NVRAM-parser-str.patch
  17390. +++ /dev/null
  17391. @@ -1,144 +0,0 @@
  17392. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17393. -Date: Thu, 4 Jun 2015 22:11:07 +0200
  17394. -Subject: [PATCH] brcmfmac: use direct data pointer in NVRAM parser struct
  17395. -MIME-Version: 1.0
  17396. -Content-Type: text/plain; charset=UTF-8
  17397. -Content-Transfer-Encoding: 8bit
  17398. -
  17399. -As we plan to add support for platform NVRAM we should store direct
  17400. -data pointer without the extra struct firmware layer. This will allow
  17401. -us to support other sources with the only requirement being u8 buffer.
  17402. -
  17403. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17404. -Acked-by: Arend van Spriel <arend@broadcom.com>
  17405. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17406. ----
  17407. -
  17408. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17409. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17410. -@@ -43,7 +43,7 @@ enum nvram_parser_state {
  17411. - * struct nvram_parser - internal info for parser.
  17412. - *
  17413. - * @state: current parser state.
  17414. -- * @fwnv: input buffer being parsed.
  17415. -+ * @data: input buffer being parsed.
  17416. - * @nvram: output buffer with parse result.
  17417. - * @nvram_len: lenght of parse result.
  17418. - * @line: current line.
  17419. -@@ -55,7 +55,7 @@ enum nvram_parser_state {
  17420. - */
  17421. - struct nvram_parser {
  17422. - enum nvram_parser_state state;
  17423. -- const struct firmware *fwnv;
  17424. -+ const u8 *data;
  17425. - u8 *nvram;
  17426. - u32 nvram_len;
  17427. - u32 line;
  17428. -@@ -91,7 +91,7 @@ static enum nvram_parser_state brcmf_nvr
  17429. - {
  17430. - char c;
  17431. -
  17432. -- c = nvp->fwnv->data[nvp->pos];
  17433. -+ c = nvp->data[nvp->pos];
  17434. - if (c == '\n')
  17435. - return COMMENT;
  17436. - if (is_whitespace(c))
  17437. -@@ -115,16 +115,16 @@ static enum nvram_parser_state brcmf_nvr
  17438. - enum nvram_parser_state st = nvp->state;
  17439. - char c;
  17440. -
  17441. -- c = nvp->fwnv->data[nvp->pos];
  17442. -+ c = nvp->data[nvp->pos];
  17443. - if (c == '=') {
  17444. - /* ignore RAW1 by treating as comment */
  17445. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "RAW1", 4) == 0)
  17446. -+ if (strncmp(&nvp->data[nvp->entry], "RAW1", 4) == 0)
  17447. - st = COMMENT;
  17448. - else
  17449. - st = VALUE;
  17450. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  17451. -+ if (strncmp(&nvp->data[nvp->entry], "devpath", 7) == 0)
  17452. - nvp->multi_dev_v1 = true;
  17453. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  17454. -+ if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  17455. - nvp->multi_dev_v2 = true;
  17456. - } else if (!is_nvram_char(c) || c == ' ') {
  17457. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  17458. -@@ -145,11 +145,11 @@ brcmf_nvram_handle_value(struct nvram_pa
  17459. - char *ekv;
  17460. - u32 cplen;
  17461. -
  17462. -- c = nvp->fwnv->data[nvp->pos];
  17463. -+ c = nvp->data[nvp->pos];
  17464. - if (!is_nvram_char(c)) {
  17465. - /* key,value pair complete */
  17466. -- ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  17467. -- skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  17468. -+ ekv = (u8 *)&nvp->data[nvp->pos];
  17469. -+ skv = (u8 *)&nvp->data[nvp->entry];
  17470. - cplen = ekv - skv;
  17471. - if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  17472. - return END;
  17473. -@@ -170,7 +170,7 @@ brcmf_nvram_handle_comment(struct nvram_
  17474. - {
  17475. - char *eoc, *sol;
  17476. -
  17477. -- sol = (char *)&nvp->fwnv->data[nvp->pos];
  17478. -+ sol = (char *)&nvp->data[nvp->pos];
  17479. - eoc = strchr(sol, '\n');
  17480. - if (!eoc) {
  17481. - eoc = strchr(sol, '\0');
  17482. -@@ -201,17 +201,17 @@ static enum nvram_parser_state
  17483. - };
  17484. -
  17485. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  17486. -- const struct firmware *nv)
  17487. -+ const u8 *data, size_t data_len)
  17488. - {
  17489. - size_t size;
  17490. -
  17491. - memset(nvp, 0, sizeof(*nvp));
  17492. -- nvp->fwnv = nv;
  17493. -+ nvp->data = data;
  17494. - /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  17495. -- if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  17496. -+ if (data_len > BRCMF_FW_MAX_NVRAM_SIZE)
  17497. - size = BRCMF_FW_MAX_NVRAM_SIZE;
  17498. - else
  17499. -- size = nv->size;
  17500. -+ size = data_len;
  17501. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  17502. - size += 1 + 3 + sizeof(u32);
  17503. - nvp->nvram = kzalloc(size, GFP_KERNEL);
  17504. -@@ -362,18 +362,18 @@ fail:
  17505. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  17506. - * End of buffer is completed with token identifying length of buffer.
  17507. - */
  17508. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  17509. -- u16 domain_nr, u16 bus_nr)
  17510. -+static void *brcmf_fw_nvram_strip(const u8 *data, size_t data_len,
  17511. -+ u32 *new_length, u16 domain_nr, u16 bus_nr)
  17512. - {
  17513. - struct nvram_parser nvp;
  17514. - u32 pad;
  17515. - u32 token;
  17516. - __le32 token_le;
  17517. -
  17518. -- if (brcmf_init_nvram_parser(&nvp, nv) < 0)
  17519. -+ if (brcmf_init_nvram_parser(&nvp, data, data_len) < 0)
  17520. - return NULL;
  17521. -
  17522. -- while (nvp.pos < nv->size) {
  17523. -+ while (nvp.pos < data_len) {
  17524. - nvp.state = nv_parser_states[nvp.state](&nvp);
  17525. - if (nvp.state == END)
  17526. - break;
  17527. -@@ -432,7 +432,7 @@ static void brcmf_fw_request_nvram_done(
  17528. - goto fail;
  17529. -
  17530. - if (fw) {
  17531. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  17532. -+ nvram = brcmf_fw_nvram_strip(fw->data, fw->size, &nvram_length,
  17533. - fwctx->domain_nr, fwctx->bus_nr);
  17534. - release_firmware(fw);
  17535. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  17536. 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
  17537. deleted file mode 100644
  17538. index 4ecef3b..0000000
  17539. --- a/package/kernel/mac80211/patches/383-b43-fix-support-for-14e4-4321-PCI-dev-with-BCM4321-c.patch
  17540. +++ /dev/null
  17541. @@ -1,32 +0,0 @@
  17542. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17543. -Date: Sat, 6 Jun 2015 22:45:59 +0200
  17544. -Subject: [PATCH] b43: fix support for 14e4:4321 PCI dev with BCM4321 chipset
  17545. -MIME-Version: 1.0
  17546. -Content-Type: text/plain; charset=UTF-8
  17547. -Content-Transfer-Encoding: 8bit
  17548. -
  17549. -It seems Broadcom released two devices with conflicting device id. There
  17550. -are for sure 14e4:4321 PCI devices with BCM4321 (N-PHY) chipset, they
  17551. -can be found in routers, e.g. Netgear WNR834Bv2. However, according to
  17552. -Broadcom public sources 0x4321 is also used for 5 GHz BCM4306 (G-PHY).
  17553. -It's unsure if they meant PCI device id, or "virtual" id (from SPROM).
  17554. -To distinguish these devices lets check PHY type (G vs. N).
  17555. -
  17556. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17557. -Cc: <stable@vger.kernel.org> # 3.16+
  17558. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17559. ----
  17560. -
  17561. ---- a/drivers/net/wireless/b43/main.c
  17562. -+++ b/drivers/net/wireless/b43/main.c
  17563. -@@ -5365,6 +5365,10 @@ static void b43_supported_bands(struct b
  17564. - *have_5ghz_phy = true;
  17565. - return;
  17566. - case 0x4321: /* BCM4306 */
  17567. -+ /* There are 14e4:4321 PCI devs with 2.4 GHz BCM4321 (N-PHY) */
  17568. -+ if (dev->phy.type != B43_PHYTYPE_G)
  17569. -+ break;
  17570. -+ /* fall through */
  17571. - case 0x4313: /* BCM4311 */
  17572. - case 0x431a: /* BCM4318 */
  17573. - case 0x432a: /* BCM4321 */
  17574. 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
  17575. deleted file mode 100644
  17576. index bddb15a..0000000
  17577. --- a/package/kernel/mac80211/patches/384-ath9k-force-rx_clear-when-disabling-rx.patch
  17578. +++ /dev/null
  17579. @@ -1,31 +0,0 @@
  17580. -From: Felix Fietkau <nbd@openwrt.org>
  17581. -Date: Sun, 7 Jun 2015 13:53:35 +0200
  17582. -Subject: [PATCH] ath9k: force rx_clear when disabling rx
  17583. -
  17584. -This makes stopping Rx more reliable and should reduce the frequency of
  17585. -Rx related DMA stop warnings
  17586. -
  17587. -Cc: stable@vger.kernel.org
  17588. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  17589. ----
  17590. -
  17591. ---- a/drivers/net/wireless/ath/ath9k/mac.c
  17592. -+++ b/drivers/net/wireless/ath/ath9k/mac.c
  17593. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  17594. -
  17595. - ath9k_ani_reset(ah, is_scanning);
  17596. -
  17597. -- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  17598. -+ REG_CLR_BIT(ah, AR_DIAG_SW,
  17599. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  17600. - }
  17601. - EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  17602. -
  17603. - void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  17604. - {
  17605. -- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  17606. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  17607. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  17608. -
  17609. - ath9k_hw_disable_mib_counters(ah);
  17610. - }
  17611. 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
  17612. deleted file mode 100644
  17613. index 2674efb..0000000
  17614. --- a/package/kernel/mac80211/patches/385-ath9k_hw-fix-device-ID-check-for-AR956x.patch
  17615. +++ /dev/null
  17616. @@ -1,20 +0,0 @@
  17617. -From: Felix Fietkau <nbd@openwrt.org>
  17618. -Date: Sun, 21 Jun 2015 19:45:59 +0200
  17619. -Subject: [PATCH] ath9k_hw: fix device ID check for AR956x
  17620. -
  17621. -Because of the missing return, the macVersion value was being
  17622. -overwritten with an invalid register read
  17623. -
  17624. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  17625. ----
  17626. -
  17627. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  17628. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  17629. -@@ -278,6 +278,7 @@ static void ath9k_hw_read_revisions(stru
  17630. - return;
  17631. - case AR9300_DEVID_QCA956X:
  17632. - ah->hw_version.macVersion = AR_SREV_VERSION_9561;
  17633. -+ return;
  17634. - }
  17635. -
  17636. - val = REG_READ(ah, AR_SREV) & AR_SREV_ID;
  17637. 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
  17638. deleted file mode 100644
  17639. index 74df9f9..0000000
  17640. --- a/package/kernel/mac80211/patches/385-brcmfmac-Update-msgbuf-read-pointer-quicker.patch
  17641. +++ /dev/null
  17642. @@ -1,109 +0,0 @@
  17643. -From: Hante Meuleman <meuleman@broadcom.com>
  17644. -Date: Mon, 8 Jun 2015 14:38:32 +0200
  17645. -Subject: [PATCH] brcmfmac: Update msgbuf read pointer quicker.
  17646. -
  17647. -On device to host data using msgbuf the read pointer gets updated
  17648. -once all data is processed. Updating this pointer more frequently
  17649. -allows the firmware to add more data quicker. This will result in
  17650. -slightly higher and more stable throughput on CPU bounded host
  17651. -processors.
  17652. -
  17653. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17654. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17655. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17656. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  17657. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17658. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17659. ----
  17660. -
  17661. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  17662. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  17663. -@@ -223,8 +223,6 @@ void brcmf_commonring_write_cancel(struc
  17664. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  17665. - u16 *n_items)
  17666. - {
  17667. -- void *ret_addr;
  17668. --
  17669. - if (commonring->cr_update_wptr)
  17670. - commonring->cr_update_wptr(commonring->cr_ctx);
  17671. -
  17672. -@@ -235,19 +233,18 @@ void *brcmf_commonring_get_read_ptr(stru
  17673. - if (*n_items == 0)
  17674. - return NULL;
  17675. -
  17676. -- ret_addr = commonring->buf_addr +
  17677. -- (commonring->r_ptr * commonring->item_len);
  17678. --
  17679. -- commonring->r_ptr += *n_items;
  17680. -- if (commonring->r_ptr == commonring->depth)
  17681. -- commonring->r_ptr = 0;
  17682. --
  17683. -- return ret_addr;
  17684. -+ return commonring->buf_addr +
  17685. -+ (commonring->r_ptr * commonring->item_len);
  17686. - }
  17687. -
  17688. -
  17689. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring)
  17690. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  17691. -+ u16 n_items)
  17692. - {
  17693. -+ commonring->r_ptr += n_items;
  17694. -+ if (commonring->r_ptr == commonring->depth)
  17695. -+ commonring->r_ptr = 0;
  17696. -+
  17697. - if (commonring->cr_write_rptr)
  17698. - return commonring->cr_write_rptr(commonring->cr_ctx);
  17699. -
  17700. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  17701. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  17702. -@@ -62,7 +62,8 @@ void brcmf_commonring_write_cancel(struc
  17703. - u16 n_items);
  17704. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  17705. - u16 *n_items);
  17706. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring);
  17707. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  17708. -+ u16 n_items);
  17709. -
  17710. - #define brcmf_commonring_n_items(commonring) (commonring->depth)
  17711. - #define brcmf_commonring_len_item(commonring) (commonring->item_len)
  17712. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17713. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17714. -@@ -75,6 +75,8 @@
  17715. -
  17716. - #define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  17717. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  17718. -+#define BRCMF_MSGBUF_UPDATE_RX_PTR_THRS 48
  17719. -+
  17720. -
  17721. - struct msgbuf_common_hdr {
  17722. - u8 msgtype;
  17723. -@@ -1257,19 +1259,27 @@ static void brcmf_msgbuf_process_rx(stru
  17724. - {
  17725. - void *buf;
  17726. - u16 count;
  17727. -+ u16 processed;
  17728. -
  17729. - again:
  17730. - buf = brcmf_commonring_get_read_ptr(commonring, &count);
  17731. - if (buf == NULL)
  17732. - return;
  17733. -
  17734. -+ processed = 0;
  17735. - while (count) {
  17736. - brcmf_msgbuf_process_msgtype(msgbuf,
  17737. - buf + msgbuf->rx_dataoffset);
  17738. - buf += brcmf_commonring_len_item(commonring);
  17739. -+ processed++;
  17740. -+ if (processed == BRCMF_MSGBUF_UPDATE_RX_PTR_THRS) {
  17741. -+ brcmf_commonring_read_complete(commonring, processed);
  17742. -+ processed = 0;
  17743. -+ }
  17744. - count--;
  17745. - }
  17746. -- brcmf_commonring_read_complete(commonring);
  17747. -+ if (processed)
  17748. -+ brcmf_commonring_read_complete(commonring, processed);
  17749. -
  17750. - if (commonring->r_ptr == 0)
  17751. - goto again;
  17752. 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
  17753. deleted file mode 100644
  17754. index 9e5b486..0000000
  17755. --- a/package/kernel/mac80211/patches/386-brcmfmac-remove-chipinfo-debugfs-entry.patch
  17756. +++ /dev/null
  17757. @@ -1,39 +0,0 @@
  17758. -From: Arend van Spriel <arend@broadcom.com>
  17759. -Date: Mon, 8 Jun 2015 14:38:33 +0200
  17760. -Subject: [PATCH] brcmfmac: remove chipinfo debugfs entry
  17761. -
  17762. -The information provided by chipinfo is also provided by the
  17763. -revinfo debugfs entry. Removing it from debugfs.
  17764. -
  17765. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17766. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17767. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17768. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17769. ----
  17770. -
  17771. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  17772. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  17773. -@@ -41,15 +41,6 @@ void brcmf_debugfs_exit(void)
  17774. - root_folder = NULL;
  17775. - }
  17776. -
  17777. --static int brcmf_debugfs_chipinfo_read(struct seq_file *seq, void *data)
  17778. --{
  17779. -- struct brcmf_bus *bus = dev_get_drvdata(seq->private);
  17780. --
  17781. -- seq_printf(seq, "chip: %x(%u) rev %u\n",
  17782. -- bus->chip, bus->chip, bus->chiprev);
  17783. -- return 0;
  17784. --}
  17785. --
  17786. - int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  17787. - {
  17788. - struct device *dev = drvr->bus_if->dev;
  17789. -@@ -58,7 +49,6 @@ int brcmf_debugfs_attach(struct brcmf_pu
  17790. - return -ENODEV;
  17791. -
  17792. - drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
  17793. -- brcmf_debugfs_add_entry(drvr, "chipinfo", brcmf_debugfs_chipinfo_read);
  17794. -
  17795. - return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
  17796. - }
  17797. 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
  17798. deleted file mode 100644
  17799. index c38b2cd..0000000
  17800. --- a/package/kernel/mac80211/patches/387-brcmfmac-remove-watchdog-reset-from-brcmf_pcie_busco.patch
  17801. +++ /dev/null
  17802. @@ -1,53 +0,0 @@
  17803. -From: Arend van Spriel <arend@broadcom.com>
  17804. -Date: Mon, 8 Jun 2015 14:38:34 +0200
  17805. -Subject: [PATCH] brcmfmac: remove watchdog reset from
  17806. - brcmf_pcie_buscoreprep()
  17807. -
  17808. -The watchdog reset as done in brcmf_pcie_buscoreprep() is not
  17809. -sufficient. It needs to modify PCIe core registers as well
  17810. -which is properly done by brcmf_pcie_reset_device() after the
  17811. -chip recognition is done. So the faulty watchdog reset can be
  17812. -removed as it was causing driver reload to fail and hang the
  17813. -system requiring a power-cycle. Instead the call to to the
  17814. -brcmf_pcie_reset_device() function is done twice in the unload.
  17815. -
  17816. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17817. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  17818. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17819. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17820. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17821. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17822. ----
  17823. -
  17824. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17825. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17826. -@@ -1629,20 +1629,7 @@ static void brcmf_pcie_buscore_write32(v
  17827. -
  17828. - static int brcmf_pcie_buscoreprep(void *ctx)
  17829. - {
  17830. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  17831. -- int err;
  17832. --
  17833. -- err = brcmf_pcie_get_resource(devinfo);
  17834. -- if (err == 0) {
  17835. -- /* Set CC watchdog to reset all the cores on the chip to bring
  17836. -- * back dongle to a sane state.
  17837. -- */
  17838. -- brcmf_pcie_buscore_write32(ctx, CORE_CC_REG(SI_ENUM_BASE,
  17839. -- watchdog), 4);
  17840. -- msleep(100);
  17841. -- }
  17842. --
  17843. -- return err;
  17844. -+ return brcmf_pcie_get_resource(ctx);
  17845. - }
  17846. -
  17847. -
  17848. -@@ -1824,6 +1811,7 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  17849. - brcmf_pcie_intr_disable(devinfo);
  17850. -
  17851. - brcmf_detach(&pdev->dev);
  17852. -+ brcmf_pcie_reset_device(devinfo);
  17853. -
  17854. - kfree(bus->bus_priv.pcie);
  17855. - kfree(bus->msgbuf->flowrings);
  17856. 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
  17857. deleted file mode 100644
  17858. index 756fbb2..0000000
  17859. --- a/package/kernel/mac80211/patches/388-brcmfmac-use-debugfs_create_devm_seqfile-helper-func.patch
  17860. +++ /dev/null
  17861. @@ -1,69 +0,0 @@
  17862. -From: Arend van Spriel <arend@broadcom.com>
  17863. -Date: Mon, 8 Jun 2015 14:38:35 +0200
  17864. -Subject: [PATCH] brcmfmac: use debugfs_create_devm_seqfile() helper
  17865. - function
  17866. -
  17867. -Some time ago the function debugfs_create_devm_seqfile() was
  17868. -introduced in debugfs. The caller simply needs to provide a
  17869. -device pointer and read function. The function brcmf_debugfs_add_entry()
  17870. -is now simply a wrapper only doing the work for CONFIG_BRCMDBG.
  17871. -
  17872. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17873. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17874. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  17875. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17876. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17877. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17878. ----
  17879. -
  17880. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  17881. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  17882. -@@ -64,44 +64,12 @@ struct dentry *brcmf_debugfs_get_devdir(
  17883. - return drvr->dbgfs_dir;
  17884. - }
  17885. -
  17886. --struct brcmf_debugfs_entry {
  17887. -- int (*read)(struct seq_file *seq, void *data);
  17888. -- struct brcmf_pub *drvr;
  17889. --};
  17890. --
  17891. --static int brcmf_debugfs_entry_open(struct inode *inode, struct file *f)
  17892. --{
  17893. -- struct brcmf_debugfs_entry *entry = inode->i_private;
  17894. --
  17895. -- return single_open(f, entry->read, entry->drvr->bus_if->dev);
  17896. --}
  17897. --
  17898. --static const struct file_operations brcmf_debugfs_def_ops = {
  17899. -- .owner = THIS_MODULE,
  17900. -- .open = brcmf_debugfs_entry_open,
  17901. -- .release = single_release,
  17902. -- .read = seq_read,
  17903. -- .llseek = seq_lseek
  17904. --};
  17905. --
  17906. - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
  17907. - int (*read_fn)(struct seq_file *seq, void *data))
  17908. - {
  17909. -- struct dentry *dentry = drvr->dbgfs_dir;
  17910. -- struct brcmf_debugfs_entry *entry;
  17911. --
  17912. -- if (IS_ERR_OR_NULL(dentry))
  17913. -- return -ENOENT;
  17914. --
  17915. -- entry = devm_kzalloc(drvr->bus_if->dev, sizeof(*entry), GFP_KERNEL);
  17916. -- if (!entry)
  17917. -- return -ENOMEM;
  17918. --
  17919. -- entry->read = read_fn;
  17920. -- entry->drvr = drvr;
  17921. --
  17922. -- dentry = debugfs_create_file(fn, S_IRUGO, dentry, entry,
  17923. -- &brcmf_debugfs_def_ops);
  17924. -+ struct dentry *e;
  17925. -
  17926. -- return PTR_ERR_OR_ZERO(dentry);
  17927. -+ e = debugfs_create_devm_seqfile(drvr->bus_if->dev, fn,
  17928. -+ drvr->dbgfs_dir, read_fn);
  17929. -+ return PTR_ERR_OR_ZERO(e);
  17930. - }
  17931. 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
  17932. deleted file mode 100644
  17933. index ff24a4a..0000000
  17934. --- a/package/kernel/mac80211/patches/389-0001-brcmfmac-Check-if-firmware-supports-p2p.patch
  17935. +++ /dev/null
  17936. @@ -1,42 +0,0 @@
  17937. -From: Pontus Fuchs <pontusf@broadcom.com>
  17938. -Date: Thu, 11 Jun 2015 00:12:17 +0200
  17939. -Subject: [PATCH] brcmfmac: Check if firmware supports p2p
  17940. -
  17941. -Add a feature flag to reflect the firmware's p2p capability.
  17942. -
  17943. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17944. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17945. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17946. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  17947. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17948. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17949. ----
  17950. -
  17951. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  17952. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  17953. -@@ -129,6 +129,7 @@ void brcmf_feat_attach(struct brcmf_pub
  17954. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  17955. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  17956. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  17957. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  17958. -
  17959. - /* set chip related quirks */
  17960. - switch (drvr->bus_if->chip) {
  17961. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  17962. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  17963. -@@ -23,12 +23,14 @@
  17964. - * MCHAN: multi-channel for concurrent P2P.
  17965. - * PNO: preferred network offload.
  17966. - * WOWL: Wake-On-WLAN.
  17967. -+ * P2P: peer-to-peer
  17968. - */
  17969. - #define BRCMF_FEAT_LIST \
  17970. - BRCMF_FEAT_DEF(MBSS) \
  17971. - BRCMF_FEAT_DEF(MCHAN) \
  17972. - BRCMF_FEAT_DEF(PNO) \
  17973. -- BRCMF_FEAT_DEF(WOWL)
  17974. -+ BRCMF_FEAT_DEF(WOWL) \
  17975. -+ BRCMF_FEAT_DEF(P2P)
  17976. - /*
  17977. - * Quirks:
  17978. - *
  17979. 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
  17980. deleted file mode 100644
  17981. index 3876ba0..0000000
  17982. --- a/package/kernel/mac80211/patches/389-0002-brcmfmac-Build-wiphy-mode-and-interface-combinations.patch
  17983. +++ /dev/null
  17984. @@ -1,198 +0,0 @@
  17985. -From: Pontus Fuchs <pontusf@broadcom.com>
  17986. -Date: Thu, 11 Jun 2015 00:12:18 +0200
  17987. -Subject: [PATCH] brcmfmac: Build wiphy mode and interface combinations
  17988. - dynamically
  17989. -
  17990. -Switch from using semi hard coded interface combinations. This makes
  17991. -it easier to announce what the firmware actually supports. This fixes
  17992. -the case where brcmfmac announces p2p but the firmware doesn't
  17993. -support it.
  17994. -
  17995. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17996. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17997. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17998. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  17999. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18000. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18001. ----
  18002. -
  18003. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18004. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18005. -@@ -52,8 +52,6 @@
  18006. - #define BRCMF_PNO_SCAN_COMPLETE 1
  18007. - #define BRCMF_PNO_SCAN_INCOMPLETE 0
  18008. -
  18009. --#define BRCMF_IFACE_MAX_CNT 3
  18010. --
  18011. - #define WPA_OUI "\x00\x50\xF2" /* WPA OUI */
  18012. - #define WPA_OUI_TYPE 1
  18013. - #define RSN_OUI "\x00\x0F\xAC" /* RSN OUI */
  18014. -@@ -5639,53 +5637,6 @@ static int brcmf_setup_wiphybands(struct
  18015. - return 0;
  18016. - }
  18017. -
  18018. --static const struct ieee80211_iface_limit brcmf_iface_limits_mbss[] = {
  18019. -- {
  18020. -- .max = 1,
  18021. -- .types = BIT(NL80211_IFTYPE_STATION) |
  18022. -- BIT(NL80211_IFTYPE_ADHOC)
  18023. -- },
  18024. -- {
  18025. -- .max = 4,
  18026. -- .types = BIT(NL80211_IFTYPE_AP)
  18027. -- },
  18028. -- {
  18029. -- .max = 1,
  18030. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18031. -- BIT(NL80211_IFTYPE_P2P_GO)
  18032. -- },
  18033. -- {
  18034. -- .max = 1,
  18035. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  18036. -- }
  18037. --};
  18038. --
  18039. --static const struct ieee80211_iface_limit brcmf_iface_limits_sbss[] = {
  18040. -- {
  18041. -- .max = 2,
  18042. -- .types = BIT(NL80211_IFTYPE_STATION) |
  18043. -- BIT(NL80211_IFTYPE_ADHOC) |
  18044. -- BIT(NL80211_IFTYPE_AP)
  18045. -- },
  18046. -- {
  18047. -- .max = 1,
  18048. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18049. -- BIT(NL80211_IFTYPE_P2P_GO)
  18050. -- },
  18051. -- {
  18052. -- .max = 1,
  18053. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  18054. -- }
  18055. --};
  18056. --static struct ieee80211_iface_combination brcmf_iface_combos[] = {
  18057. -- {
  18058. -- .max_interfaces = BRCMF_IFACE_MAX_CNT,
  18059. -- .num_different_channels = 1,
  18060. -- .n_limits = ARRAY_SIZE(brcmf_iface_limits_sbss),
  18061. -- .limits = brcmf_iface_limits_sbss,
  18062. -- }
  18063. --};
  18064. --
  18065. - static const struct ieee80211_txrx_stypes
  18066. - brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = {
  18067. - [NL80211_IFTYPE_STATION] = {
  18068. -@@ -5715,6 +5666,67 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  18069. - }
  18070. - };
  18071. -
  18072. -+static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  18073. -+{
  18074. -+ struct ieee80211_iface_combination *combo = NULL;
  18075. -+ struct ieee80211_iface_limit *limits = NULL;
  18076. -+ int i = 0, max_iface_cnt;
  18077. -+
  18078. -+ combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  18079. -+ if (!combo)
  18080. -+ goto err;
  18081. -+
  18082. -+ limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  18083. -+ if (!limits)
  18084. -+ goto err;
  18085. -+
  18086. -+ wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  18087. -+ BIT(NL80211_IFTYPE_ADHOC) |
  18088. -+ BIT(NL80211_IFTYPE_AP);
  18089. -+
  18090. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  18091. -+ combo->num_different_channels = 2;
  18092. -+ else
  18093. -+ combo->num_different_channels = 1;
  18094. -+
  18095. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  18096. -+ limits[i].max = 1;
  18097. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  18098. -+ limits[i].max = 4;
  18099. -+ limits[i++].types = BIT(NL80211_IFTYPE_AP);
  18100. -+ max_iface_cnt = 5;
  18101. -+ } else {
  18102. -+ limits[i].max = 2;
  18103. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  18104. -+ BIT(NL80211_IFTYPE_AP);
  18105. -+ max_iface_cnt = 2;
  18106. -+ }
  18107. -+
  18108. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  18109. -+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18110. -+ BIT(NL80211_IFTYPE_P2P_GO) |
  18111. -+ BIT(NL80211_IFTYPE_P2P_DEVICE);
  18112. -+ limits[i].max = 1;
  18113. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18114. -+ BIT(NL80211_IFTYPE_P2P_GO);
  18115. -+ limits[i].max = 1;
  18116. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  18117. -+ max_iface_cnt += 2;
  18118. -+ }
  18119. -+ combo->max_interfaces = max_iface_cnt;
  18120. -+ combo->limits = limits;
  18121. -+ combo->n_limits = i;
  18122. -+
  18123. -+ wiphy->iface_combinations = combo;
  18124. -+ wiphy->n_iface_combinations = 1;
  18125. -+ return 0;
  18126. -+
  18127. -+err:
  18128. -+ kfree(limits);
  18129. -+ kfree(combo);
  18130. -+ return -ENOMEM;
  18131. -+}
  18132. -+
  18133. - static void brcmf_wiphy_pno_params(struct wiphy *wiphy)
  18134. - {
  18135. - /* scheduled scan settings */
  18136. -@@ -5745,7 +5757,6 @@ static void brcmf_wiphy_wowl_params(stru
  18137. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  18138. - {
  18139. - struct ieee80211_supported_band *band;
  18140. -- struct ieee80211_iface_combination ifc_combo;
  18141. - __le32 bandlist[3];
  18142. - u32 n_bands;
  18143. - int err, i;
  18144. -@@ -5753,24 +5764,11 @@ static int brcmf_setup_wiphy(struct wiph
  18145. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  18146. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  18147. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  18148. -- wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  18149. -- BIT(NL80211_IFTYPE_ADHOC) |
  18150. -- BIT(NL80211_IFTYPE_AP) |
  18151. -- BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18152. -- BIT(NL80211_IFTYPE_P2P_GO) |
  18153. -- BIT(NL80211_IFTYPE_P2P_DEVICE);
  18154. -- /* need VSDB firmware feature for concurrent channels */
  18155. -- ifc_combo = brcmf_iface_combos[0];
  18156. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  18157. -- ifc_combo.num_different_channels = 2;
  18158. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  18159. -- ifc_combo.n_limits = ARRAY_SIZE(brcmf_iface_limits_mbss),
  18160. -- ifc_combo.limits = brcmf_iface_limits_mbss;
  18161. -- }
  18162. -- wiphy->iface_combinations = kmemdup(&ifc_combo,
  18163. -- sizeof(ifc_combo),
  18164. -- GFP_KERNEL);
  18165. -- wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos);
  18166. -+
  18167. -+ err = brcmf_setup_ifmodes(wiphy, ifp);
  18168. -+ if (err)
  18169. -+ return err;
  18170. -+
  18171. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  18172. - wiphy->cipher_suites = __wl_cipher_suites;
  18173. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  18174. -@@ -6035,6 +6033,8 @@ static void brcmf_free_wiphy(struct wiph
  18175. - if (!wiphy)
  18176. - return;
  18177. -
  18178. -+ if (wiphy->iface_combinations)
  18179. -+ kfree(wiphy->iface_combinations->limits);
  18180. - kfree(wiphy->iface_combinations);
  18181. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  18182. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  18183. 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
  18184. deleted file mode 100644
  18185. index 7bd0686..0000000
  18186. --- a/package/kernel/mac80211/patches/389-0003-brcmfmac-rework-.get_station-callback.patch
  18187. +++ /dev/null
  18188. @@ -1,326 +0,0 @@
  18189. -From: Arend van Spriel <arend@broadcom.com>
  18190. -Date: Thu, 11 Jun 2015 00:12:19 +0200
  18191. -Subject: [PATCH] brcmfmac: rework .get_station() callback
  18192. -
  18193. -The .get_station() cfg80211 callback is used in several scenarios. In
  18194. -managed mode it can obtain information about the access-point and its
  18195. -BSS parameters. In managed mode it can also obtain information about
  18196. -TDLS peers. In AP mode it can obtain information about connected
  18197. -clients.
  18198. -
  18199. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18200. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  18201. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18202. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18203. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18204. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18205. ----
  18206. -
  18207. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18208. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18209. -@@ -2395,27 +2395,80 @@ brcmf_cfg80211_reconfigure_wep(struct br
  18210. - brcmf_err("set wsec error (%d)\n", err);
  18211. - }
  18212. -
  18213. -+static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
  18214. -+{
  18215. -+ struct nl80211_sta_flag_update *sfu;
  18216. -+
  18217. -+ brcmf_dbg(TRACE, "flags %08x\n", fw_sta_flags);
  18218. -+ si->filled |= BIT(NL80211_STA_INFO_STA_FLAGS);
  18219. -+ sfu = &si->sta_flags;
  18220. -+ sfu->mask = BIT(NL80211_STA_FLAG_WME) |
  18221. -+ BIT(NL80211_STA_FLAG_AUTHENTICATED) |
  18222. -+ BIT(NL80211_STA_FLAG_ASSOCIATED) |
  18223. -+ BIT(NL80211_STA_FLAG_AUTHORIZED);
  18224. -+ if (fw_sta_flags & BRCMF_STA_WME)
  18225. -+ sfu->set |= BIT(NL80211_STA_FLAG_WME);
  18226. -+ if (fw_sta_flags & BRCMF_STA_AUTHE)
  18227. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
  18228. -+ if (fw_sta_flags & BRCMF_STA_ASSOC)
  18229. -+ sfu->set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
  18230. -+ if (fw_sta_flags & BRCMF_STA_AUTHO)
  18231. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
  18232. -+}
  18233. -+
  18234. -+static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
  18235. -+{
  18236. -+ struct {
  18237. -+ __le32 len;
  18238. -+ struct brcmf_bss_info_le bss_le;
  18239. -+ } *buf;
  18240. -+ u16 capability;
  18241. -+ int err;
  18242. -+
  18243. -+ buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
  18244. -+ if (!buf)
  18245. -+ return;
  18246. -+
  18247. -+ buf->len = cpu_to_le32(WL_BSS_INFO_MAX);
  18248. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
  18249. -+ WL_BSS_INFO_MAX);
  18250. -+ if (err) {
  18251. -+ brcmf_err("Failed to get bss info (%d)\n", err);
  18252. -+ return;
  18253. -+ }
  18254. -+ si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  18255. -+ si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period);
  18256. -+ si->bss_param.dtim_period = buf->bss_le.dtim_period;
  18257. -+ capability = le16_to_cpu(buf->bss_le.capability);
  18258. -+ if (capability & IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT)
  18259. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
  18260. -+ if (capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
  18261. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  18262. -+ if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
  18263. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  18264. -+}
  18265. -+
  18266. - static s32
  18267. - brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
  18268. - const u8 *mac, struct station_info *sinfo)
  18269. - {
  18270. - struct brcmf_if *ifp = netdev_priv(ndev);
  18271. -- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
  18272. -- struct brcmf_scb_val_le scb_val;
  18273. -- int rssi;
  18274. -- s32 rate;
  18275. - s32 err = 0;
  18276. -- u8 *bssid = profile->bssid;
  18277. - struct brcmf_sta_info_le sta_info_le;
  18278. -- u32 beacon_period;
  18279. -- u32 dtim_period;
  18280. -+ u32 sta_flags;
  18281. -+ u32 is_tdls_peer;
  18282. -
  18283. - brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
  18284. - if (!check_vif_up(ifp->vif))
  18285. - return -EIO;
  18286. -
  18287. -- if (brcmf_is_apmode(ifp->vif)) {
  18288. -- memcpy(&sta_info_le, mac, ETH_ALEN);
  18289. -+ memset(&sta_info_le, 0, sizeof(sta_info_le));
  18290. -+ memcpy(&sta_info_le, mac, ETH_ALEN);
  18291. -+ err = brcmf_fil_iovar_data_get(ifp, "tdls_sta_info",
  18292. -+ &sta_info_le,
  18293. -+ sizeof(sta_info_le));
  18294. -+ is_tdls_peer = !err;
  18295. -+ if (err) {
  18296. - err = brcmf_fil_iovar_data_get(ifp, "sta_info",
  18297. - &sta_info_le,
  18298. - sizeof(sta_info_le));
  18299. -@@ -2423,73 +2476,48 @@ brcmf_cfg80211_get_station(struct wiphy
  18300. - brcmf_err("GET STA INFO failed, %d\n", err);
  18301. - goto done;
  18302. - }
  18303. -- sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  18304. -- sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  18305. -- if (le32_to_cpu(sta_info_le.flags) & BRCMF_STA_ASSOC) {
  18306. -- sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  18307. -- sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  18308. -- }
  18309. -- brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n",
  18310. -- sinfo->inactive_time, sinfo->connected_time);
  18311. -- } else if (ifp->vif->wdev.iftype == NL80211_IFTYPE_STATION) {
  18312. -- if (memcmp(mac, bssid, ETH_ALEN)) {
  18313. -- brcmf_err("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n",
  18314. -- mac, bssid);
  18315. -- err = -ENOENT;
  18316. -- goto done;
  18317. -- }
  18318. -- /* Report the current tx rate */
  18319. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
  18320. -- if (err) {
  18321. -- brcmf_err("Could not get rate (%d)\n", err);
  18322. -- goto done;
  18323. -- } else {
  18324. -+ }
  18325. -+ brcmf_dbg(TRACE, "version %d\n", le16_to_cpu(sta_info_le.ver));
  18326. -+ sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  18327. -+ sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  18328. -+ sta_flags = le32_to_cpu(sta_info_le.flags);
  18329. -+ brcmf_convert_sta_flags(sta_flags, sinfo);
  18330. -+ sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  18331. -+ if (is_tdls_peer)
  18332. -+ sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  18333. -+ else
  18334. -+ sinfo->sta_flags.set &= ~BIT(NL80211_STA_FLAG_TDLS_PEER);
  18335. -+ if (sta_flags & BRCMF_STA_ASSOC) {
  18336. -+ sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  18337. -+ sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  18338. -+ brcmf_fill_bss_param(ifp, sinfo);
  18339. -+ }
  18340. -+ if (sta_flags & BRCMF_STA_SCBSTATS) {
  18341. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED);
  18342. -+ sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures);
  18343. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
  18344. -+ sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts);
  18345. -+ sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts);
  18346. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
  18347. -+ sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts);
  18348. -+ sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts);
  18349. -+ if (sinfo->tx_packets) {
  18350. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
  18351. -- sinfo->txrate.legacy = rate * 5;
  18352. -- brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2);
  18353. -+ sinfo->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate);
  18354. -+ sinfo->txrate.legacy /= 100;
  18355. - }
  18356. --
  18357. -- if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
  18358. -- &ifp->vif->sme_state)) {
  18359. -- memset(&scb_val, 0, sizeof(scb_val));
  18360. -- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
  18361. -- &scb_val, sizeof(scb_val));
  18362. -- if (err) {
  18363. -- brcmf_err("Could not get rssi (%d)\n", err);
  18364. -- goto done;
  18365. -- } else {
  18366. -- rssi = le32_to_cpu(scb_val.val);
  18367. -- sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  18368. -- sinfo->signal = rssi;
  18369. -- brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
  18370. -- }
  18371. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_BCNPRD,
  18372. -- &beacon_period);
  18373. -- if (err) {
  18374. -- brcmf_err("Could not get beacon period (%d)\n",
  18375. -- err);
  18376. -- goto done;
  18377. -- } else {
  18378. -- sinfo->bss_param.beacon_interval =
  18379. -- beacon_period;
  18380. -- brcmf_dbg(CONN, "Beacon peroid %d\n",
  18381. -- beacon_period);
  18382. -- }
  18383. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_DTIMPRD,
  18384. -- &dtim_period);
  18385. -- if (err) {
  18386. -- brcmf_err("Could not get DTIM period (%d)\n",
  18387. -- err);
  18388. -- goto done;
  18389. -- } else {
  18390. -- sinfo->bss_param.dtim_period = dtim_period;
  18391. -- brcmf_dbg(CONN, "DTIM peroid %d\n",
  18392. -- dtim_period);
  18393. -- }
  18394. -- sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  18395. -+ if (sinfo->rx_packets) {
  18396. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
  18397. -+ sinfo->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate);
  18398. -+ sinfo->rxrate.legacy /= 100;
  18399. -+ }
  18400. -+ if (le16_to_cpu(sta_info_le.ver) >= 4) {
  18401. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES);
  18402. -+ sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes);
  18403. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES);
  18404. -+ sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
  18405. - }
  18406. -- } else
  18407. -- err = -EPERM;
  18408. -+ }
  18409. - done:
  18410. - brcmf_dbg(TRACE, "Exit\n");
  18411. - return err;
  18412. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  18413. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  18414. -@@ -32,7 +32,11 @@
  18415. - #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */
  18416. - #define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002
  18417. -
  18418. --#define BRCMF_STA_ASSOC 0x10 /* Associated */
  18419. -+#define BRCMF_STA_WME 0x00000002 /* WMM association */
  18420. -+#define BRCMF_STA_AUTHE 0x00000008 /* Authenticated */
  18421. -+#define BRCMF_STA_ASSOC 0x00000010 /* Associated */
  18422. -+#define BRCMF_STA_AUTHO 0x00000020 /* Authorized */
  18423. -+#define BRCMF_STA_SCBSTATS 0x00004000 /* Per STA debug stats */
  18424. -
  18425. - /* size of brcmf_scan_params not including variable length array */
  18426. - #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
  18427. -@@ -113,6 +117,7 @@
  18428. - #define BRCMF_WOWL_MAXPATTERNSIZE 128
  18429. -
  18430. - #define BRCMF_COUNTRY_BUF_SZ 4
  18431. -+#define BRCMF_ANT_MAX 4
  18432. -
  18433. - /* join preference types for join_pref iovar */
  18434. - enum brcmf_join_pref_types {
  18435. -@@ -456,25 +461,61 @@ struct brcmf_channel_info_le {
  18436. - };
  18437. -
  18438. - struct brcmf_sta_info_le {
  18439. -- __le16 ver; /* version of this struct */
  18440. -- __le16 len; /* length in bytes of this structure */
  18441. -- __le16 cap; /* sta's advertised capabilities */
  18442. -- __le32 flags; /* flags defined below */
  18443. -- __le32 idle; /* time since data pkt rx'd from sta */
  18444. -- u8 ea[ETH_ALEN]; /* Station address */
  18445. -- __le32 count; /* # rates in this set */
  18446. -- u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  18447. -+ __le16 ver; /* version of this struct */
  18448. -+ __le16 len; /* length in bytes of this structure */
  18449. -+ __le16 cap; /* sta's advertised capabilities */
  18450. -+ __le32 flags; /* flags defined below */
  18451. -+ __le32 idle; /* time since data pkt rx'd from sta */
  18452. -+ u8 ea[ETH_ALEN]; /* Station address */
  18453. -+ __le32 count; /* # rates in this set */
  18454. -+ u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  18455. - /* w/hi bit set if basic */
  18456. -- __le32 in; /* seconds elapsed since associated */
  18457. -- __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  18458. -- __le32 tx_pkts; /* # of packets transmitted */
  18459. -- __le32 tx_failures; /* # of packets failed */
  18460. -- __le32 rx_ucast_pkts; /* # of unicast packets received */
  18461. -- __le32 rx_mcast_pkts; /* # of multicast packets received */
  18462. -- __le32 tx_rate; /* Rate of last successful tx frame */
  18463. -- __le32 rx_rate; /* Rate of last successful rx frame */
  18464. -- __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  18465. -- __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  18466. -+ __le32 in; /* seconds elapsed since associated */
  18467. -+ __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  18468. -+ __le32 tx_pkts; /* # of packets transmitted */
  18469. -+ __le32 tx_failures; /* # of packets failed */
  18470. -+ __le32 rx_ucast_pkts; /* # of unicast packets received */
  18471. -+ __le32 rx_mcast_pkts; /* # of multicast packets received */
  18472. -+ __le32 tx_rate; /* Rate of last successful tx frame */
  18473. -+ __le32 rx_rate; /* Rate of last successful rx frame */
  18474. -+ __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  18475. -+ __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  18476. -+ __le32 tx_tot_pkts; /* # of tx pkts (ucast + mcast) */
  18477. -+ __le32 rx_tot_pkts; /* # of data packets recvd (uni + mcast) */
  18478. -+ __le32 tx_mcast_pkts; /* # of mcast pkts txed */
  18479. -+ __le64 tx_tot_bytes; /* data bytes txed (ucast + mcast) */
  18480. -+ __le64 rx_tot_bytes; /* data bytes recvd (ucast + mcast) */
  18481. -+ __le64 tx_ucast_bytes; /* data bytes txed (ucast) */
  18482. -+ __le64 tx_mcast_bytes; /* # data bytes txed (mcast) */
  18483. -+ __le64 rx_ucast_bytes; /* data bytes recvd (ucast) */
  18484. -+ __le64 rx_mcast_bytes; /* data bytes recvd (mcast) */
  18485. -+ s8 rssi[BRCMF_ANT_MAX]; /* per antenna rssi */
  18486. -+ s8 nf[BRCMF_ANT_MAX]; /* per antenna noise floor */
  18487. -+ __le16 aid; /* association ID */
  18488. -+ __le16 ht_capabilities; /* advertised ht caps */
  18489. -+ __le16 vht_flags; /* converted vht flags */
  18490. -+ __le32 tx_pkts_retry_cnt; /* # of frames where a retry was
  18491. -+ * exhausted.
  18492. -+ */
  18493. -+ __le32 tx_pkts_retry_exhausted; /* # of user frames where a retry
  18494. -+ * was exhausted
  18495. -+ */
  18496. -+ s8 rx_lastpkt_rssi[BRCMF_ANT_MAX]; /* Per antenna RSSI of last
  18497. -+ * received data frame.
  18498. -+ */
  18499. -+ /* TX WLAN retry/failure statistics:
  18500. -+ * Separated for host requested frames and locally generated frames.
  18501. -+ * Include unicast frame only where the retries/failures can be counted.
  18502. -+ */
  18503. -+ __le32 tx_pkts_total; /* # user frames sent successfully */
  18504. -+ __le32 tx_pkts_retries; /* # user frames retries */
  18505. -+ __le32 tx_pkts_fw_total; /* # FW generated sent successfully */
  18506. -+ __le32 tx_pkts_fw_retries; /* # retries for FW generated frames */
  18507. -+ __le32 tx_pkts_fw_retry_exhausted; /* # FW generated where a retry
  18508. -+ * was exhausted
  18509. -+ */
  18510. -+ __le32 rx_pkts_retried; /* # rx with retry bit set */
  18511. -+ __le32 tx_rate_fallback; /* lowest fallback TX rate */
  18512. - };
  18513. -
  18514. - struct brcmf_chanspec_list {
  18515. 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
  18516. deleted file mode 100644
  18517. index 302bc3e..0000000
  18518. --- a/package/kernel/mac80211/patches/389-0004-brcmfmac-have-sdio-return-EIO-when-device-communicat.patch
  18519. +++ /dev/null
  18520. @@ -1,56 +0,0 @@
  18521. -From: Arend van Spriel <arend@broadcom.com>
  18522. -Date: Thu, 11 Jun 2015 00:12:20 +0200
  18523. -Subject: [PATCH] brcmfmac: have sdio return -EIO when device communication
  18524. - is not possible
  18525. -
  18526. -The bus interface functions txctl and rxctl may be used while the device
  18527. -can not be accessed, eg. upon driver .remove() callback. This patch will
  18528. -immediately return -EIO when this is the case which speeds up the module
  18529. -unload.
  18530. -
  18531. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18532. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18533. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18534. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18535. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18536. ----
  18537. -
  18538. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  18539. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  18540. -@@ -988,6 +988,7 @@ static void brcmf_sdiod_freezer_detach(s
  18541. -
  18542. - static int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev)
  18543. - {
  18544. -+ sdiodev->state = BRCMF_SDIOD_DOWN;
  18545. - if (sdiodev->bus) {
  18546. - brcmf_sdio_remove(sdiodev->bus);
  18547. - sdiodev->bus = NULL;
  18548. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  18549. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  18550. -@@ -2820,6 +2820,8 @@ static int brcmf_sdio_bus_txdata(struct
  18551. - struct brcmf_sdio *bus = sdiodev->bus;
  18552. -
  18553. - brcmf_dbg(TRACE, "Enter: pkt: data %p len %d\n", pkt->data, pkt->len);
  18554. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  18555. -+ return -EIO;
  18556. -
  18557. - /* Add space for the header */
  18558. - skb_push(pkt, bus->tx_hdrlen);
  18559. -@@ -2948,6 +2950,8 @@ brcmf_sdio_bus_txctl(struct device *dev,
  18560. - int ret;
  18561. -
  18562. - brcmf_dbg(TRACE, "Enter\n");
  18563. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  18564. -+ return -EIO;
  18565. -
  18566. - /* Send from dpc */
  18567. - bus->ctrl_frame_buf = msg;
  18568. -@@ -3238,6 +3242,8 @@ brcmf_sdio_bus_rxctl(struct device *dev,
  18569. - struct brcmf_sdio *bus = sdiodev->bus;
  18570. -
  18571. - brcmf_dbg(TRACE, "Enter\n");
  18572. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  18573. -+ return -EIO;
  18574. -
  18575. - /* Wait until control frame is available */
  18576. - timeleft = brcmf_sdio_dcmd_resp_wait(bus, &bus->rxlen, &pending);
  18577. 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
  18578. deleted file mode 100644
  18579. index 34af6d2..0000000
  18580. --- a/package/kernel/mac80211/patches/389-0005-ath9k-make-DMA-stop-related-messages-debug-only.patch
  18581. +++ /dev/null
  18582. @@ -1,74 +0,0 @@
  18583. -From: Felix Fietkau <nbd@openwrt.org>
  18584. -Date: Thu, 2 Jul 2015 13:35:05 +0200
  18585. -Subject: [PATCH] ath9k: make DMA stop related messages debug-only
  18586. -
  18587. -A long time ago, ath9k had issues during reset where the DMA engine
  18588. -would stay active and could potentially corrupt memory.
  18589. -To debug those issues, the driver would print warnings whenever they
  18590. -occur.
  18591. -
  18592. -Nowadays, these issues are gone and the primary cause of these messages
  18593. -is if the MAC is stuck during reset or busy processing a long
  18594. -transmission. This is fairly harmless, yet these messages continue to
  18595. -worry users.
  18596. -
  18597. -To reduce the number of bogus bug reports, turn these messages into
  18598. -debug messages and count their occurence in the "reset" debugfs file.
  18599. -
  18600. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  18601. ----
  18602. -
  18603. ---- a/drivers/net/wireless/ath/ath9k/debug.c
  18604. -+++ b/drivers/net/wireless/ath/ath9k/debug.c
  18605. -@@ -765,6 +765,8 @@ static int read_file_reset(struct seq_fi
  18606. - [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
  18607. - [RESET_TYPE_MCI] = "MCI Reset",
  18608. - [RESET_TYPE_CALIBRATION] = "Calibration error",
  18609. -+ [RESET_TX_DMA_ERROR] = "Tx DMA stop error",
  18610. -+ [RESET_RX_DMA_ERROR] = "Rx DMA stop error",
  18611. - };
  18612. - int i;
  18613. -
  18614. ---- a/drivers/net/wireless/ath/ath9k/debug.h
  18615. -+++ b/drivers/net/wireless/ath/ath9k/debug.h
  18616. -@@ -50,6 +50,8 @@ enum ath_reset_type {
  18617. - RESET_TYPE_BEACON_STUCK,
  18618. - RESET_TYPE_MCI,
  18619. - RESET_TYPE_CALIBRATION,
  18620. -+ RESET_TX_DMA_ERROR,
  18621. -+ RESET_RX_DMA_ERROR,
  18622. - __RESET_TYPE_MAX
  18623. - };
  18624. -
  18625. ---- a/drivers/net/wireless/ath/ath9k/recv.c
  18626. -+++ b/drivers/net/wireless/ath/ath9k/recv.c
  18627. -@@ -496,10 +496,9 @@ bool ath_stoprecv(struct ath_softc *sc)
  18628. -
  18629. - if (!(ah->ah_flags & AH_UNPLUGGED) &&
  18630. - unlikely(!stopped)) {
  18631. -- ath_err(ath9k_hw_common(sc->sc_ah),
  18632. -- "Could not stop RX, we could be "
  18633. -- "confusing the DMA engine when we start RX up\n");
  18634. -- ATH_DBG_WARN_ON_ONCE(!stopped);
  18635. -+ ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
  18636. -+ "Failed to stop Rx DMA\n");
  18637. -+ RESET_STAT_INC(sc, RESET_RX_DMA_ERROR);
  18638. - }
  18639. - return stopped && !reset;
  18640. - }
  18641. ---- a/drivers/net/wireless/ath/ath9k/xmit.c
  18642. -+++ b/drivers/net/wireless/ath/ath9k/xmit.c
  18643. -@@ -1896,8 +1896,11 @@ bool ath_drain_all_txq(struct ath_softc
  18644. - npend |= BIT(i);
  18645. - }
  18646. -
  18647. -- if (npend)
  18648. -- ath_err(common, "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  18649. -+ if (npend) {
  18650. -+ RESET_STAT_INC(sc, RESET_TX_DMA_ERROR);
  18651. -+ ath_dbg(common, RESET,
  18652. -+ "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  18653. -+ }
  18654. -
  18655. - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
  18656. - if (!ATH_TXQ_SETUP(sc, i))
  18657. 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
  18658. deleted file mode 100644
  18659. index 06f2dce..0000000
  18660. --- a/package/kernel/mac80211/patches/389-0006-brcmfmac-free-ifp-for-non-netdev-interface-in-p2p-mo.patch
  18661. +++ /dev/null
  18662. @@ -1,44 +0,0 @@
  18663. -From: Arend van Spriel <arend@broadcom.com>
  18664. -Date: Thu, 11 Jun 2015 00:12:21 +0200
  18665. -Subject: [PATCH] brcmfmac: free ifp for non-netdev interface in p2p module
  18666. -
  18667. -Making it more clear by freeing the ifp in same place where the
  18668. -vif object is freed.
  18669. -
  18670. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18671. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18672. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18673. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18674. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18675. ----
  18676. -
  18677. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18678. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18679. -@@ -867,8 +867,6 @@ static void brcmf_del_if(struct brcmf_pu
  18680. - }
  18681. - /* unregister will take care of freeing it */
  18682. - unregister_netdev(ifp->ndev);
  18683. -- } else {
  18684. -- kfree(ifp);
  18685. - }
  18686. - }
  18687. -
  18688. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18689. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18690. -@@ -2238,6 +2238,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  18691. - {
  18692. - cfg80211_unregister_wdev(&vif->wdev);
  18693. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  18694. -+ kfree(vif->ifp);
  18695. - brcmf_free_vif(vif);
  18696. - }
  18697. -
  18698. -@@ -2361,6 +2362,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  18699. - break;
  18700. -
  18701. - case NL80211_IFTYPE_P2P_DEVICE:
  18702. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  18703. -+ brcmf_p2p_deinit_discovery(p2p);
  18704. - brcmf_p2p_delete_p2pdev(p2p, vif);
  18705. - return 0;
  18706. - default:
  18707. 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
  18708. deleted file mode 100644
  18709. index 0a6e093..0000000
  18710. --- a/package/kernel/mac80211/patches/389-0007-brcmfmac-move-p2p-attach-detach-functions.patch
  18711. +++ /dev/null
  18712. @@ -1,225 +0,0 @@
  18713. -From: Arend van Spriel <arend@broadcom.com>
  18714. -Date: Thu, 11 Jun 2015 00:12:22 +0200
  18715. -Subject: [PATCH] brcmfmac: move p2p attach/detach functions
  18716. -
  18717. -Moving two functions in p2p.c as is so next change will be
  18718. -easier to review.
  18719. -
  18720. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18721. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18722. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18723. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18724. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18725. ----
  18726. -
  18727. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18728. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18729. -@@ -1908,105 +1908,6 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  18730. -
  18731. -
  18732. - /**
  18733. -- * brcmf_p2p_attach() - attach for P2P.
  18734. -- *
  18735. -- * @cfg: driver private data for cfg80211 interface.
  18736. -- */
  18737. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  18738. --{
  18739. -- struct brcmf_if *pri_ifp;
  18740. -- struct brcmf_if *p2p_ifp;
  18741. -- struct brcmf_cfg80211_vif *p2p_vif;
  18742. -- struct brcmf_p2p_info *p2p;
  18743. -- struct brcmf_pub *drvr;
  18744. -- s32 bssidx;
  18745. -- s32 err = 0;
  18746. --
  18747. -- p2p = &cfg->p2p;
  18748. -- p2p->cfg = cfg;
  18749. --
  18750. -- drvr = cfg->pub;
  18751. --
  18752. -- pri_ifp = drvr->iflist[0];
  18753. -- p2p_ifp = drvr->iflist[1];
  18754. --
  18755. -- p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  18756. --
  18757. -- if (p2p_ifp) {
  18758. -- p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  18759. -- false);
  18760. -- if (IS_ERR(p2p_vif)) {
  18761. -- brcmf_err("could not create discovery vif\n");
  18762. -- err = -ENOMEM;
  18763. -- goto exit;
  18764. -- }
  18765. --
  18766. -- p2p_vif->ifp = p2p_ifp;
  18767. -- p2p_ifp->vif = p2p_vif;
  18768. -- p2p_vif->wdev.netdev = p2p_ifp->ndev;
  18769. -- p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  18770. -- SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  18771. --
  18772. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  18773. --
  18774. -- brcmf_p2p_generate_bss_mac(p2p, NULL);
  18775. -- memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  18776. -- brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  18777. --
  18778. -- /* Initialize P2P Discovery in the firmware */
  18779. -- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  18780. -- if (err < 0) {
  18781. -- brcmf_err("set p2p_disc error\n");
  18782. -- brcmf_free_vif(p2p_vif);
  18783. -- goto exit;
  18784. -- }
  18785. -- /* obtain bsscfg index for P2P discovery */
  18786. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  18787. -- if (err < 0) {
  18788. -- brcmf_err("retrieving discover bsscfg index failed\n");
  18789. -- brcmf_free_vif(p2p_vif);
  18790. -- goto exit;
  18791. -- }
  18792. -- /* Verify that firmware uses same bssidx as driver !! */
  18793. -- if (p2p_ifp->bssidx != bssidx) {
  18794. -- brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  18795. -- bssidx, p2p_ifp->bssidx);
  18796. -- brcmf_free_vif(p2p_vif);
  18797. -- goto exit;
  18798. -- }
  18799. --
  18800. -- init_completion(&p2p->send_af_done);
  18801. -- INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  18802. -- init_completion(&p2p->afx_hdl.act_frm_scan);
  18803. -- init_completion(&p2p->wait_next_af);
  18804. -- }
  18805. --exit:
  18806. -- return err;
  18807. --}
  18808. --
  18809. --
  18810. --/**
  18811. -- * brcmf_p2p_detach() - detach P2P.
  18812. -- *
  18813. -- * @p2p: P2P specific data.
  18814. -- */
  18815. --void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  18816. --{
  18817. -- struct brcmf_cfg80211_vif *vif;
  18818. --
  18819. -- vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  18820. -- if (vif != NULL) {
  18821. -- brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  18822. -- brcmf_p2p_deinit_discovery(p2p);
  18823. -- /* remove discovery interface */
  18824. -- brcmf_free_vif(vif);
  18825. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  18826. -- }
  18827. -- /* just set it all to zero */
  18828. -- memset(p2p, 0, sizeof(*p2p));
  18829. --}
  18830. --
  18831. --/**
  18832. - * brcmf_p2p_get_current_chanspec() - Get current operation channel.
  18833. - *
  18834. - * @p2p: P2P specific data.
  18835. -@@ -2425,3 +2326,102 @@ void brcmf_p2p_stop_device(struct wiphy
  18836. - clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  18837. - mutex_unlock(&cfg->usr_sync);
  18838. - }
  18839. -+
  18840. -+/**
  18841. -+ * brcmf_p2p_attach() - attach for P2P.
  18842. -+ *
  18843. -+ * @cfg: driver private data for cfg80211 interface.
  18844. -+ */
  18845. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  18846. -+{
  18847. -+ struct brcmf_if *pri_ifp;
  18848. -+ struct brcmf_if *p2p_ifp;
  18849. -+ struct brcmf_cfg80211_vif *p2p_vif;
  18850. -+ struct brcmf_p2p_info *p2p;
  18851. -+ struct brcmf_pub *drvr;
  18852. -+ s32 bssidx;
  18853. -+ s32 err = 0;
  18854. -+
  18855. -+ p2p = &cfg->p2p;
  18856. -+ p2p->cfg = cfg;
  18857. -+
  18858. -+ drvr = cfg->pub;
  18859. -+
  18860. -+ pri_ifp = drvr->iflist[0];
  18861. -+ p2p_ifp = drvr->iflist[1];
  18862. -+
  18863. -+ p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  18864. -+
  18865. -+ if (p2p_ifp) {
  18866. -+ p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  18867. -+ false);
  18868. -+ if (IS_ERR(p2p_vif)) {
  18869. -+ brcmf_err("could not create discovery vif\n");
  18870. -+ err = -ENOMEM;
  18871. -+ goto exit;
  18872. -+ }
  18873. -+
  18874. -+ p2p_vif->ifp = p2p_ifp;
  18875. -+ p2p_ifp->vif = p2p_vif;
  18876. -+ p2p_vif->wdev.netdev = p2p_ifp->ndev;
  18877. -+ p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  18878. -+ SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  18879. -+
  18880. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  18881. -+
  18882. -+ brcmf_p2p_generate_bss_mac(p2p, NULL);
  18883. -+ memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  18884. -+ brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  18885. -+
  18886. -+ /* Initialize P2P Discovery in the firmware */
  18887. -+ err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  18888. -+ if (err < 0) {
  18889. -+ brcmf_err("set p2p_disc error\n");
  18890. -+ brcmf_free_vif(p2p_vif);
  18891. -+ goto exit;
  18892. -+ }
  18893. -+ /* obtain bsscfg index for P2P discovery */
  18894. -+ err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  18895. -+ if (err < 0) {
  18896. -+ brcmf_err("retrieving discover bsscfg index failed\n");
  18897. -+ brcmf_free_vif(p2p_vif);
  18898. -+ goto exit;
  18899. -+ }
  18900. -+ /* Verify that firmware uses same bssidx as driver !! */
  18901. -+ if (p2p_ifp->bssidx != bssidx) {
  18902. -+ brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  18903. -+ bssidx, p2p_ifp->bssidx);
  18904. -+ brcmf_free_vif(p2p_vif);
  18905. -+ goto exit;
  18906. -+ }
  18907. -+
  18908. -+ init_completion(&p2p->send_af_done);
  18909. -+ INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  18910. -+ init_completion(&p2p->afx_hdl.act_frm_scan);
  18911. -+ init_completion(&p2p->wait_next_af);
  18912. -+ }
  18913. -+exit:
  18914. -+ return err;
  18915. -+}
  18916. -+
  18917. -+/**
  18918. -+ * brcmf_p2p_detach() - detach P2P.
  18919. -+ *
  18920. -+ * @p2p: P2P specific data.
  18921. -+ */
  18922. -+void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  18923. -+{
  18924. -+ struct brcmf_cfg80211_vif *vif;
  18925. -+
  18926. -+ vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  18927. -+ if (vif != NULL) {
  18928. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  18929. -+ brcmf_p2p_deinit_discovery(p2p);
  18930. -+ /* remove discovery interface */
  18931. -+ brcmf_free_vif(vif);
  18932. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  18933. -+ }
  18934. -+ /* just set it all to zero */
  18935. -+ memset(p2p, 0, sizeof(*p2p));
  18936. -+}
  18937. -+
  18938. 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
  18939. deleted file mode 100644
  18940. index 72e8eed..0000000
  18941. --- a/package/kernel/mac80211/patches/389-0008-brcmfmac-assure-p2pdev-is-unregistered-upon-driver-u.patch
  18942. +++ /dev/null
  18943. @@ -1,63 +0,0 @@
  18944. -From: Arend van Spriel <arend@broadcom.com>
  18945. -Date: Thu, 11 Jun 2015 00:12:23 +0200
  18946. -Subject: [PATCH] brcmfmac: assure p2pdev is unregistered upon driver
  18947. - unload
  18948. -
  18949. -When unloading the driver with a p2pdev interface it resulted in
  18950. -a warning upon calling wiphy_unregister() and subsequently a crash
  18951. -in the driver. This patch assures the p2pdev is unregistered calling
  18952. -unregister_wdev() before doing the wiphy_unregister().
  18953. -
  18954. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18955. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18956. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18957. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18958. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18959. ----
  18960. -
  18961. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18962. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18963. -@@ -6206,10 +6206,8 @@ void brcmf_cfg80211_detach(struct brcmf_
  18964. - if (!cfg)
  18965. - return;
  18966. -
  18967. -- WARN_ON(!list_empty(&cfg->vif_list));
  18968. -- wiphy_unregister(cfg->wiphy);
  18969. - brcmf_btcoex_detach(cfg);
  18970. -- brcmf_p2p_detach(&cfg->p2p);
  18971. -+ wiphy_unregister(cfg->wiphy);
  18972. - wl_deinit_priv(cfg);
  18973. - brcmf_free_wiphy(cfg->wiphy);
  18974. - }
  18975. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18976. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18977. -@@ -1098,6 +1098,7 @@ void brcmf_detach(struct device *dev)
  18978. -
  18979. - /* stop firmware event handling */
  18980. - brcmf_fweh_detach(drvr);
  18981. -+ brcmf_p2p_detach(&drvr->config->p2p);
  18982. -
  18983. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  18984. -
  18985. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18986. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18987. -@@ -16,6 +16,7 @@
  18988. - #include <linux/slab.h>
  18989. - #include <linux/netdevice.h>
  18990. - #include <linux/etherdevice.h>
  18991. -+#include <linux/rtnetlink.h>
  18992. - #include <net/cfg80211.h>
  18993. -
  18994. - #include <brcmu_wifi.h>
  18995. -@@ -2418,8 +2419,9 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  18996. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  18997. - brcmf_p2p_deinit_discovery(p2p);
  18998. - /* remove discovery interface */
  18999. -- brcmf_free_vif(vif);
  19000. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19001. -+ rtnl_lock();
  19002. -+ brcmf_p2p_delete_p2pdev(p2p, vif);
  19003. -+ rtnl_unlock();
  19004. - }
  19005. - /* just set it all to zero */
  19006. - memset(p2p, 0, sizeof(*p2p));
  19007. 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
  19008. deleted file mode 100644
  19009. index 179c77e..0000000
  19010. --- a/package/kernel/mac80211/patches/390-0001-brcmfmac-fix-double-free-of-p2pdev-interface.patch
  19011. +++ /dev/null
  19012. @@ -1,27 +0,0 @@
  19013. -From: Arend van Spriel <arend@broadcom.com>
  19014. -Date: Mon, 15 Jun 2015 22:48:38 +0200
  19015. -Subject: [PATCH] brcmfmac: fix double free of p2pdev interface
  19016. -
  19017. -When freeing the driver ifp pointer it should also be removed from
  19018. -the driver interface list, which is what brcmf_remove_interface()
  19019. -does. Otherwise, the ifp pointer will be freed twice triggering
  19020. -a kernel oops.
  19021. -
  19022. -Fixes: f37d69a4babc ("brcmfmac: free ifp for non-netdev interface in p2p module")
  19023. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19024. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19025. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19026. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19027. ----
  19028. -
  19029. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19030. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19031. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  19032. - {
  19033. - cfg80211_unregister_wdev(&vif->wdev);
  19034. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19035. -- kfree(vif->ifp);
  19036. -+ brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  19037. - brcmf_free_vif(vif);
  19038. - }
  19039. -
  19040. 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
  19041. deleted file mode 100644
  19042. index e4f88b5..0000000
  19043. --- a/package/kernel/mac80211/patches/390-0002-brcmfmac-make-brcmf_p2p_detach-call-conditional.patch
  19044. +++ /dev/null
  19045. @@ -1,29 +0,0 @@
  19046. -From: Arend van Spriel <arend@broadcom.com>
  19047. -Date: Mon, 15 Jun 2015 22:48:39 +0200
  19048. -Subject: [PATCH] brcmfmac: make brcmf_p2p_detach() call conditional
  19049. -
  19050. -During verification of error handling in brcmf_cfg80211_attach() a
  19051. -null pointer dereference occurred upon calling brcmf_p2p_detach()
  19052. -from brcmf_detach(). This should only be called when the
  19053. -brcmf_cfg80211_attach() has succeeded.
  19054. -
  19055. -Fixes: f7a40873d2fa ("brcmfmac: assure p2pdev is unregistered upon driver unload")
  19056. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19057. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19058. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19059. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19060. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19061. ----
  19062. -
  19063. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19064. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19065. -@@ -1098,7 +1098,8 @@ void brcmf_detach(struct device *dev)
  19066. -
  19067. - /* stop firmware event handling */
  19068. - brcmf_fweh_detach(drvr);
  19069. -- brcmf_p2p_detach(&drvr->config->p2p);
  19070. -+ if (drvr->config)
  19071. -+ brcmf_p2p_detach(&drvr->config->p2p);
  19072. -
  19073. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  19074. -
  19075. 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
  19076. deleted file mode 100644
  19077. index 0a81237..0000000
  19078. --- a/package/kernel/mac80211/patches/391-brcmfmac-set-wiphy-s-addresses-to-provide-valid-MACs.patch
  19079. +++ /dev/null
  19080. @@ -1,67 +0,0 @@
  19081. -From: Rafa? Mi?ecki <zajec5@gmail.com>
  19082. -Date: Thu, 9 Jul 2015 17:07:08 +0200
  19083. -Subject: [PATCH] brcmfmac: set wiphy's addresses to provide valid MACs
  19084. -
  19085. -Broadcom's firmware requires every BSS to use MAC address with unique
  19086. -last few bits. The amount of bits may depend on a particular firmware,
  19087. -it was verified to be 2 for BCM43602 one.
  19088. -If this condition won't be fulfilled firmware will reject such MAC:
  19089. -brcmfmac: _brcmf_set_mac_address: Setting cur_etheraddr failed, -52
  19090. -
  19091. -We don't want to simply set addr_mask as it would also disallow using
  19092. -locally administrated bit. Instead let's build a list of addresses
  19093. -manually enabling 0x2 bit for extra interfaces.
  19094. -
  19095. -Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
  19096. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19097. ----
  19098. -
  19099. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19100. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19101. -@@ -5784,6 +5784,7 @@ static void brcmf_wiphy_wowl_params(stru
  19102. -
  19103. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  19104. - {
  19105. -+ struct brcmf_pub *drvr = ifp->drvr;
  19106. - struct ieee80211_supported_band *band;
  19107. - __le32 bandlist[3];
  19108. - u32 n_bands;
  19109. -@@ -5797,6 +5798,19 @@ static int brcmf_setup_wiphy(struct wiph
  19110. - if (err)
  19111. - return err;
  19112. -
  19113. -+ for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  19114. -+ i < ARRAY_SIZE(drvr->addresses); i++) {
  19115. -+ u8 *addr = drvr->addresses[i].addr;
  19116. -+
  19117. -+ memcpy(addr, drvr->mac, ETH_ALEN);
  19118. -+ if (i) {
  19119. -+ addr[0] |= BIT(1);
  19120. -+ addr[ETH_ALEN - 1] ^= i;
  19121. -+ }
  19122. -+ }
  19123. -+ wiphy->addresses = drvr->addresses;
  19124. -+ wiphy->n_addresses = i;
  19125. -+
  19126. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  19127. - wiphy->cipher_suites = __wl_cipher_suites;
  19128. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  19129. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  19130. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  19131. -@@ -21,6 +21,7 @@
  19132. - #ifndef BRCMFMAC_CORE_H
  19133. - #define BRCMFMAC_CORE_H
  19134. -
  19135. -+#include <net/cfg80211.h>
  19136. - #include "fweh.h"
  19137. -
  19138. - #define TOE_TX_CSUM_OL 0x00000001
  19139. -@@ -118,6 +119,8 @@ struct brcmf_pub {
  19140. - /* Multicast data packets sent to dongle */
  19141. - unsigned long tx_multicast;
  19142. -
  19143. -+ struct mac_address addresses[BRCMF_MAX_IFS];
  19144. -+
  19145. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  19146. -
  19147. - struct mutex proto_block;
  19148. 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
  19149. deleted file mode 100644
  19150. index e44f121..0000000
  19151. --- a/package/kernel/mac80211/patches/392-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  19152. +++ /dev/null
  19153. @@ -1,45 +0,0 @@
  19154. -From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
  19155. -Date: Thu, 9 Jul 2015 13:43:18 +0530
  19156. -Subject: [PATCH] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
  19157. -
  19158. -There's already a generic implementation so use that instead.
  19159. -
  19160. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19161. ----
  19162. -
  19163. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  19164. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  19165. -@@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(st
  19166. - }
  19167. - }
  19168. -
  19169. --static void atomic_orr(int val, atomic_t *v)
  19170. --{
  19171. -- int old_val;
  19172. --
  19173. -- old_val = atomic_read(v);
  19174. -- while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
  19175. -- old_val = atomic_read(v);
  19176. --}
  19177. --
  19178. - static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
  19179. - {
  19180. - struct brcmf_core *buscore;
  19181. -@@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struc
  19182. - if (val) {
  19183. - brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
  19184. - bus->sdcnt.f1regdata++;
  19185. -- atomic_orr(val, &bus->intstatus);
  19186. -+ atomic_or(val, &bus->intstatus);
  19187. - }
  19188. -
  19189. - return ret;
  19190. -@@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  19191. -
  19192. - /* Keep still-pending events for next scheduling */
  19193. - if (intstatus)
  19194. -- atomic_orr(intstatus, &bus->intstatus);
  19195. -+ atomic_or(intstatus, &bus->intstatus);
  19196. -
  19197. - brcmf_sdio_clrintr(bus);
  19198. -
  19199. 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
  19200. deleted file mode 100644
  19201. index 76ca143..0000000
  19202. --- a/package/kernel/mac80211/patches/393-0001-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  19203. +++ /dev/null
  19204. @@ -1,46 +0,0 @@
  19205. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  19206. -Date: Thu, 20 Aug 2015 00:16:42 +0200
  19207. -Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
  19208. - addresses
  19209. -MIME-Version: 1.0
  19210. -Content-Type: text/plain; charset=UTF-8
  19211. -Content-Transfer-Encoding: 8bit
  19212. -
  19213. -Broadcom is working on better reflection of interface combinations. With
  19214. -upcoming patches we may have 1st combination supporting less interfaces
  19215. -than others.
  19216. -To don't run out of addresses check all combinations to find the one
  19217. -with the greatest max_interfaces value.
  19218. -
  19219. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  19220. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19221. ----
  19222. -
  19223. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19224. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19225. -@@ -5785,7 +5785,9 @@ static void brcmf_wiphy_wowl_params(stru
  19226. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  19227. - {
  19228. - struct brcmf_pub *drvr = ifp->drvr;
  19229. -+ const struct ieee80211_iface_combination *combo;
  19230. - struct ieee80211_supported_band *band;
  19231. -+ u16 max_interfaces = 0;
  19232. - __le32 bandlist[3];
  19233. - u32 n_bands;
  19234. - int err, i;
  19235. -@@ -5798,8 +5800,13 @@ static int brcmf_setup_wiphy(struct wiph
  19236. - if (err)
  19237. - return err;
  19238. -
  19239. -- for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  19240. -- i < ARRAY_SIZE(drvr->addresses); i++) {
  19241. -+ for (i = 0, combo = wiphy->iface_combinations;
  19242. -+ i < wiphy->n_iface_combinations; i++, combo++) {
  19243. -+ max_interfaces = max(max_interfaces, combo->max_interfaces);
  19244. -+ }
  19245. -+
  19246. -+ for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
  19247. -+ i++) {
  19248. - u8 *addr = drvr->addresses[i].addr;
  19249. -
  19250. - memcpy(addr, drvr->mac, ETH_ALEN);
  19251. 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
  19252. deleted file mode 100644
  19253. index c4a0720..0000000
  19254. --- a/package/kernel/mac80211/patches/393-0002-brcmfmac-correct-interface-combination-info.patch
  19255. +++ /dev/null
  19256. @@ -1,204 +0,0 @@
  19257. -From: Arend van Spriel <arend@broadcom.com>
  19258. -Date: Thu, 20 Aug 2015 22:06:03 +0200
  19259. -Subject: [PATCH] brcmfmac: correct interface combination info
  19260. -
  19261. -The interface combination provided by brcmfmac did not truly reflect
  19262. -the combinations supported by driver and/or firmware.
  19263. -
  19264. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19265. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19266. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19267. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  19268. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19269. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19270. ----
  19271. -
  19272. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19273. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19274. -@@ -5694,63 +5694,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  19275. - }
  19276. - };
  19277. -
  19278. -+/**
  19279. -+ * brcmf_setup_ifmodes() - determine interface modes and combinations.
  19280. -+ *
  19281. -+ * @wiphy: wiphy object.
  19282. -+ * @ifp: interface object needed for feat module api.
  19283. -+ *
  19284. -+ * The interface modes and combinations are determined dynamically here
  19285. -+ * based on firmware functionality.
  19286. -+ *
  19287. -+ * no p2p and no mbss:
  19288. -+ *
  19289. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  19290. -+ *
  19291. -+ * no p2p and mbss:
  19292. -+ *
  19293. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  19294. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  19295. -+ *
  19296. -+ * p2p, no mchan, and mbss:
  19297. -+ *
  19298. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
  19299. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  19300. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  19301. -+ *
  19302. -+ * p2p, mchan, and mbss:
  19303. -+ *
  19304. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  19305. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  19306. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  19307. -+ */
  19308. - static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  19309. - {
  19310. - struct ieee80211_iface_combination *combo = NULL;
  19311. -- struct ieee80211_iface_limit *limits = NULL;
  19312. -- int i = 0, max_iface_cnt;
  19313. -+ struct ieee80211_iface_limit *c0_limits = NULL;
  19314. -+ struct ieee80211_iface_limit *p2p_limits = NULL;
  19315. -+ struct ieee80211_iface_limit *mbss_limits = NULL;
  19316. -+ bool mbss, p2p;
  19317. -+ int i, c, n_combos;
  19318. -
  19319. -- combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  19320. -+ mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
  19321. -+ p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
  19322. -+
  19323. -+ n_combos = 1 + !!p2p + !!mbss;
  19324. -+ combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
  19325. - if (!combo)
  19326. - goto err;
  19327. -
  19328. -- limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  19329. -- if (!limits)
  19330. -+ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  19331. -+ if (!c0_limits)
  19332. - goto err;
  19333. -
  19334. -+ if (p2p) {
  19335. -+ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  19336. -+ if (!p2p_limits)
  19337. -+ goto err;
  19338. -+ }
  19339. -+
  19340. -+ if (mbss) {
  19341. -+ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  19342. -+ if (!mbss_limits)
  19343. -+ goto err;
  19344. -+ }
  19345. -+
  19346. - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  19347. - BIT(NL80211_IFTYPE_ADHOC) |
  19348. - BIT(NL80211_IFTYPE_AP);
  19349. -
  19350. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  19351. -- combo->num_different_channels = 2;
  19352. -- else
  19353. -- combo->num_different_channels = 1;
  19354. --
  19355. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  19356. -- limits[i].max = 1;
  19357. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  19358. -- limits[i].max = 4;
  19359. -- limits[i++].types = BIT(NL80211_IFTYPE_AP);
  19360. -- max_iface_cnt = 5;
  19361. -- } else {
  19362. -- limits[i].max = 2;
  19363. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  19364. -- BIT(NL80211_IFTYPE_AP);
  19365. -- max_iface_cnt = 2;
  19366. -- }
  19367. --
  19368. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  19369. -+ c = 0;
  19370. -+ i = 0;
  19371. -+ combo[c].num_different_channels = 1;
  19372. -+ c0_limits[i].max = 1;
  19373. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  19374. -+ if (p2p) {
  19375. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  19376. -+ combo[c].num_different_channels = 2;
  19377. - wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19378. - BIT(NL80211_IFTYPE_P2P_GO) |
  19379. - BIT(NL80211_IFTYPE_P2P_DEVICE);
  19380. -- limits[i].max = 1;
  19381. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19382. -- BIT(NL80211_IFTYPE_P2P_GO);
  19383. -- limits[i].max = 1;
  19384. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  19385. -- max_iface_cnt += 2;
  19386. -- }
  19387. -- combo->max_interfaces = max_iface_cnt;
  19388. -- combo->limits = limits;
  19389. -- combo->n_limits = i;
  19390. -+ c0_limits[i].max = 1;
  19391. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  19392. -+ c0_limits[i].max = 1;
  19393. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19394. -+ BIT(NL80211_IFTYPE_P2P_GO);
  19395. -+ } else {
  19396. -+ c0_limits[i].max = 1;
  19397. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  19398. -+ }
  19399. -+ combo[c].max_interfaces = i;
  19400. -+ combo[c].n_limits = i;
  19401. -+ combo[c].limits = c0_limits;
  19402. -+
  19403. -+ if (p2p) {
  19404. -+ c++;
  19405. -+ i = 0;
  19406. -+ combo[c].num_different_channels = 1;
  19407. -+ p2p_limits[i].max = 1;
  19408. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  19409. -+ p2p_limits[i].max = 1;
  19410. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  19411. -+ p2p_limits[i].max = 1;
  19412. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  19413. -+ p2p_limits[i].max = 1;
  19414. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  19415. -+ combo[c].max_interfaces = i;
  19416. -+ combo[c].n_limits = i;
  19417. -+ combo[c].limits = p2p_limits;
  19418. -+ }
  19419. -
  19420. -+ if (mbss) {
  19421. -+ c++;
  19422. -+ combo[c].beacon_int_infra_match = true;
  19423. -+ combo[c].num_different_channels = 1;
  19424. -+ mbss_limits[0].max = 4;
  19425. -+ mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  19426. -+ combo[c].max_interfaces = 4;
  19427. -+ combo[c].n_limits = 1;
  19428. -+ combo[c].limits = mbss_limits;
  19429. -+ }
  19430. -+ wiphy->n_iface_combinations = n_combos;
  19431. - wiphy->iface_combinations = combo;
  19432. -- wiphy->n_iface_combinations = 1;
  19433. - return 0;
  19434. -
  19435. - err:
  19436. -- kfree(limits);
  19437. -+ kfree(c0_limits);
  19438. -+ kfree(p2p_limits);
  19439. -+ kfree(mbss_limits);
  19440. - kfree(combo);
  19441. - return -ENOMEM;
  19442. - }
  19443. -@@ -6079,11 +6148,15 @@ static void brcmf_cfg80211_reg_notifier(
  19444. -
  19445. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  19446. - {
  19447. -+ int i;
  19448. -+
  19449. - if (!wiphy)
  19450. - return;
  19451. -
  19452. -- if (wiphy->iface_combinations)
  19453. -- kfree(wiphy->iface_combinations->limits);
  19454. -+ if (wiphy->iface_combinations) {
  19455. -+ for (i = 0; i < wiphy->n_iface_combinations; i++)
  19456. -+ kfree(wiphy->iface_combinations[i].limits);
  19457. -+ }
  19458. - kfree(wiphy->iface_combinations);
  19459. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  19460. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  19461. 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
  19462. deleted file mode 100644
  19463. index 9768ef2..0000000
  19464. --- a/package/kernel/mac80211/patches/393-0003-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  19465. +++ /dev/null
  19466. @@ -1,87 +0,0 @@
  19467. -From: Franky Lin <frankyl@broadcom.com>
  19468. -Date: Thu, 20 Aug 2015 22:06:04 +0200
  19469. -Subject: [PATCH] brcmfmac: add debugfs entry for msgbuf statistics
  19470. -
  19471. -Expose ring buffer read/write pointers and other useful statistics
  19472. -through debugfs.
  19473. -
  19474. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  19475. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19476. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19477. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  19478. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19479. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19480. ----
  19481. -
  19482. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  19483. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  19484. -@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct
  19485. - }
  19486. - }
  19487. -
  19488. -+#ifdef DEBUG
  19489. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  19490. -+{
  19491. -+ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  19492. -+ struct brcmf_pub *drvr = bus_if->drvr;
  19493. -+ struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  19494. -+ struct brcmf_commonring *commonring;
  19495. -+ u16 i;
  19496. -+ struct brcmf_flowring_ring *ring;
  19497. -+ struct brcmf_flowring_hash *hash;
  19498. -+
  19499. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
  19500. -+ seq_printf(seq, "h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n",
  19501. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19502. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
  19503. -+ seq_printf(seq, "h2d_rx_submit: rp %4u, wp %4u, depth %4u\n",
  19504. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19505. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
  19506. -+ seq_printf(seq, "d2h_ctl_cmplt: rp %4u, wp %4u, depth %4u\n",
  19507. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19508. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
  19509. -+ seq_printf(seq, "d2h_tx_cmplt: rp %4u, wp %4u, depth %4u\n",
  19510. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19511. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
  19512. -+ seq_printf(seq, "d2h_rx_cmplt: rp %4u, wp %4u, depth %4u\n",
  19513. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19514. -+
  19515. -+ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
  19516. -+ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
  19517. -+ seq_puts(seq, "Active flowrings:\n");
  19518. -+ hash = msgbuf->flow->hash;
  19519. -+ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
  19520. -+ if (!msgbuf->flow->rings[i])
  19521. -+ continue;
  19522. -+ ring = msgbuf->flow->rings[i];
  19523. -+ if (ring->status != RING_OPEN)
  19524. -+ continue;
  19525. -+ commonring = msgbuf->flowrings[i];
  19526. -+ hash = &msgbuf->flow->hash[ring->hash_id];
  19527. -+ seq_printf(seq, "id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n"
  19528. -+ " ifidx %u, fifo %u, da %pM\n",
  19529. -+ i, commonring->r_ptr, commonring->w_ptr,
  19530. -+ skb_queue_len(&ring->skblist), ring->blocked,
  19531. -+ hash->ifidx, hash->fifo, hash->mac);
  19532. -+ }
  19533. -+
  19534. -+ return 0;
  19535. -+}
  19536. -+#else
  19537. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  19538. -+{
  19539. -+ return 0;
  19540. -+}
  19541. -+#endif
  19542. -
  19543. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
  19544. - {
  19545. -@@ -1460,6 +1514,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  19546. - spin_lock_init(&msgbuf->flowring_work_lock);
  19547. - INIT_LIST_HEAD(&msgbuf->work_queue);
  19548. -
  19549. -+ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read);
  19550. -+
  19551. - return 0;
  19552. -
  19553. - fail:
  19554. 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
  19555. deleted file mode 100644
  19556. index 2b84cf9..0000000
  19557. --- a/package/kernel/mac80211/patches/393-0004-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  19558. +++ /dev/null
  19559. @@ -1,83 +0,0 @@
  19560. -From: Arend van Spriel <arend@broadcom.com>
  19561. -Date: Thu, 20 Aug 2015 22:06:05 +0200
  19562. -Subject: [PATCH] brcmfmac: make use of cfg80211_check_combinations()
  19563. -
  19564. -Use cfg80211_check_combinations() so we can bail out early when an
  19565. -interface add or change results in an invalid combination.
  19566. -
  19567. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19568. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19569. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19570. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19571. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19572. ----
  19573. -
  19574. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19575. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19576. -@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 le
  19577. - return NULL;
  19578. - }
  19579. -
  19580. -+static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
  19581. -+ struct brcmf_cfg80211_vif *vif,
  19582. -+ enum nl80211_iftype new_type)
  19583. -+{
  19584. -+ int iftype_num[NUM_NL80211_IFTYPES];
  19585. -+ struct brcmf_cfg80211_vif *pos;
  19586. -+
  19587. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  19588. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  19589. -+ if (pos == vif)
  19590. -+ iftype_num[new_type]++;
  19591. -+ else
  19592. -+ iftype_num[pos->wdev.iftype]++;
  19593. -+
  19594. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  19595. -+}
  19596. -+
  19597. -+static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
  19598. -+ enum nl80211_iftype new_type)
  19599. -+{
  19600. -+ int iftype_num[NUM_NL80211_IFTYPES];
  19601. -+ struct brcmf_cfg80211_vif *pos;
  19602. -+
  19603. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  19604. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  19605. -+ iftype_num[pos->wdev.iftype]++;
  19606. -+
  19607. -+ iftype_num[new_type]++;
  19608. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  19609. -+}
  19610. -
  19611. - static void convert_key_from_CPU(struct brcmf_wsec_key *key,
  19612. - struct brcmf_wsec_key_le *key_le)
  19613. -@@ -662,8 +692,14 @@ static struct wireless_dev *brcmf_cfg802
  19614. - struct vif_params *params)
  19615. - {
  19616. - struct wireless_dev *wdev;
  19617. -+ int err;
  19618. -
  19619. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  19620. -+ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  19621. -+ if (err) {
  19622. -+ brcmf_err("iface validation failed: err=%d\n", err);
  19623. -+ return ERR_PTR(err);
  19624. -+ }
  19625. - switch (type) {
  19626. - case NL80211_IFTYPE_ADHOC:
  19627. - case NL80211_IFTYPE_STATION:
  19628. -@@ -822,8 +858,12 @@ brcmf_cfg80211_change_iface(struct wiphy
  19629. - s32 ap = 0;
  19630. - s32 err = 0;
  19631. -
  19632. -- brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
  19633. --
  19634. -+ brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  19635. -+ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  19636. -+ if (err) {
  19637. -+ brcmf_err("iface validation failed: err=%d\n", err);
  19638. -+ return err;
  19639. -+ }
  19640. - switch (type) {
  19641. - case NL80211_IFTYPE_MONITOR:
  19642. - case NL80211_IFTYPE_WDS:
  19643. 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
  19644. deleted file mode 100644
  19645. index 2d5f7b9..0000000
  19646. --- a/package/kernel/mac80211/patches/393-0005-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  19647. +++ /dev/null
  19648. @@ -1,48 +0,0 @@
  19649. -From: Franky Lin <frankyl@broadcom.com>
  19650. -Date: Thu, 20 Aug 2015 22:06:06 +0200
  19651. -Subject: [PATCH] brcmfmac: block the correct flowring when backup queue
  19652. - overflow
  19653. -
  19654. -brcmf_flowring_block blocks the last active flowring under the same
  19655. -interface instead of the one provided by caller. This could lead to a
  19656. -dead lock of netif stop if there are more than one flowring under the
  19657. -interface and the traffic is high enough so brcmf_flowring_enqueue can
  19658. -not unblock the ring right away.
  19659. -
  19660. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19661. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19662. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  19663. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19664. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19665. ----
  19666. -
  19667. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  19668. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  19669. -@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct
  19670. - spin_lock_irqsave(&flow->block_lock, flags);
  19671. -
  19672. - ring = flow->rings[flowid];
  19673. -+ if (ring->blocked == blocked) {
  19674. -+ spin_unlock_irqrestore(&flow->block_lock, flags);
  19675. -+ return;
  19676. -+ }
  19677. - ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  19678. -
  19679. - currently_blocked = false;
  19680. - for (i = 0; i < flow->nrofrings; i++) {
  19681. -- if (flow->rings[i]) {
  19682. -+ if ((flow->rings[i]) && (i != flowid)) {
  19683. - ring = flow->rings[i];
  19684. - if ((ring->status == RING_OPEN) &&
  19685. - (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
  19686. -@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct
  19687. - }
  19688. - }
  19689. - }
  19690. -- ring->blocked = blocked;
  19691. -- if (currently_blocked == blocked) {
  19692. -+ flow->rings[flowid]->blocked = blocked;
  19693. -+ if (currently_blocked) {
  19694. - spin_unlock_irqrestore(&flow->block_lock, flags);
  19695. - return;
  19696. - }
  19697. 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
  19698. deleted file mode 100644
  19699. index 7378401..0000000
  19700. --- a/package/kernel/mac80211/patches/393-0006-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  19701. +++ /dev/null
  19702. @@ -1,52 +0,0 @@
  19703. -From: Arend van Spriel <arend@broadcom.com>
  19704. -Date: Thu, 20 Aug 2015 22:06:07 +0200
  19705. -Subject: [PATCH] brcmfmac: bump highest event number for 4339 firmware
  19706. -
  19707. -The event mask length is determined by the highest event number
  19708. -that is specified in the driver. When this length is shorter than
  19709. -firmware expects setting event mask will fail and device becomes
  19710. -pretty useless. This issue was reported with bcm4339 firmware that
  19711. -was recently released.
  19712. -
  19713. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  19714. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19715. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19716. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19717. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  19718. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19719. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19720. ----
  19721. -
  19722. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  19723. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  19724. -@@ -85,7 +85,6 @@ struct brcmf_event;
  19725. - BRCMF_ENUM_DEF(IF, 54) \
  19726. - BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \
  19727. - BRCMF_ENUM_DEF(RSSI, 56) \
  19728. -- BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
  19729. - BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
  19730. - BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
  19731. - BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
  19732. -@@ -103,8 +102,7 @@ struct brcmf_event;
  19733. - BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
  19734. - BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
  19735. - BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
  19736. -- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
  19737. -- BRCMF_ENUM_DEF(PSTA_PRIMARY_INTF_IND, 128)
  19738. -+ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
  19739. -
  19740. - #define BRCMF_ENUM_DEF(id, val) \
  19741. - BRCMF_E_##id = (val),
  19742. -@@ -112,7 +110,11 @@ struct brcmf_event;
  19743. - /* firmware event codes sent by the dongle */
  19744. - enum brcmf_fweh_event_code {
  19745. - BRCMF_FWEH_EVENT_ENUM_DEFLIST
  19746. -- BRCMF_E_LAST
  19747. -+ /* this determines event mask length which must match
  19748. -+ * minimum length check in device firmware so it is
  19749. -+ * hard-coded here.
  19750. -+ */
  19751. -+ BRCMF_E_LAST = 139
  19752. - };
  19753. - #undef BRCMF_ENUM_DEF
  19754. -
  19755. 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
  19756. deleted file mode 100644
  19757. index 97444b3..0000000
  19758. --- a/package/kernel/mac80211/patches/394-0001-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  19759. +++ /dev/null
  19760. @@ -1,138 +0,0 @@
  19761. -From: Arend van Spriel <arend@broadcom.com>
  19762. -Date: Wed, 26 Aug 2015 22:14:53 +0200
  19763. -Subject: [PATCH] brcmfmac: consolidate ifp lookup in driver core
  19764. -
  19765. -In rx path the firmware provide an interface index which is used to
  19766. -map to a struct brcmf_if instance. However, this involves some trick
  19767. -that is done in two places. This is changed by having driver core
  19768. -providing brcmf_get_ifp() function.
  19769. -
  19770. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19771. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19772. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19773. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19774. ----
  19775. -
  19776. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  19777. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  19778. -@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19779. - struct sk_buff *pktbuf)
  19780. - {
  19781. - struct brcmf_proto_bcdc_header *h;
  19782. -+ struct brcmf_if *ifp;
  19783. -
  19784. - brcmf_dbg(BCDC, "Enter\n");
  19785. -
  19786. -@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19787. - trace_brcmf_bcdchdr(pktbuf->data);
  19788. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  19789. -
  19790. -- *ifidx = BCDC_GET_IF_IDX(h);
  19791. -- if (*ifidx >= BRCMF_MAX_IFS) {
  19792. -- brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
  19793. -+ ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  19794. -+ if (IS_ERR_OR_NULL(ifp)) {
  19795. -+ brcmf_dbg(INFO, "no matching ifp found\n");
  19796. - return -EBADE;
  19797. - }
  19798. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  19799. -- * events this is easy because it contains the bssidx which maps
  19800. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  19801. -- * bssidx 1 is used for p2p0 and no data can be received or
  19802. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  19803. -- */
  19804. -- if (*ifidx)
  19805. -- (*ifidx)++;
  19806. --
  19807. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  19808. - BCDC_PROTO_VER) {
  19809. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  19810. -- brcmf_ifname(drvr, *ifidx), h->flags);
  19811. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  19812. - return -EBADE;
  19813. - }
  19814. -
  19815. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  19816. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  19817. -- brcmf_ifname(drvr, *ifidx), h->flags);
  19818. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  19819. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  19820. - }
  19821. -
  19822. -@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19823. -
  19824. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  19825. - if (do_fws)
  19826. -- brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf);
  19827. -+ brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  19828. -+ pktbuf);
  19829. - else
  19830. - skb_pull(pktbuf, h->data_offset << 2);
  19831. -
  19832. - if (pktbuf->len == 0)
  19833. - return -ENODATA;
  19834. -+
  19835. -+ *ifidx = ifp->ifidx;
  19836. - return 0;
  19837. - }
  19838. -
  19839. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19840. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19841. -@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drv
  19842. - return "<if_none>";
  19843. - }
  19844. -
  19845. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  19846. -+{
  19847. -+ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  19848. -+ brcmf_err("ifidx %d out of range\n", ifidx);
  19849. -+ return ERR_PTR(-ERANGE);
  19850. -+ }
  19851. -+
  19852. -+ /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  19853. -+ * events this is easy because it contains the bssidx which maps
  19854. -+ * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  19855. -+ * bssidx 1 is used for p2p0 and no data can be received or
  19856. -+ * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  19857. -+ */
  19858. -+ if (ifidx)
  19859. -+ ifidx++;
  19860. -+
  19861. -+ return drvr->iflist[ifidx];
  19862. -+}
  19863. -+
  19864. - static void _brcmf_set_multicast_list(struct work_struct *work)
  19865. - {
  19866. - struct brcmf_if *ifp;
  19867. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  19868. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  19869. -@@ -202,7 +202,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  19870. -
  19871. - /* Return pointer to interface name */
  19872. - char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  19873. --
  19874. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  19875. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  19876. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  19877. - char *name, u8 *mac_addr);
  19878. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  19879. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  19880. -@@ -1081,16 +1081,8 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  19881. - {
  19882. - struct brcmf_if *ifp;
  19883. -
  19884. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  19885. -- * events this is easy because it contains the bssidx which maps
  19886. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  19887. -- * bssidx 1 is used for p2p0 and no data can be received or
  19888. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  19889. -- */
  19890. -- if (ifidx)
  19891. -- (ifidx)++;
  19892. -- ifp = msgbuf->drvr->iflist[ifidx];
  19893. -- if (!ifp || !ifp->ndev) {
  19894. -+ ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  19895. -+ if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  19896. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  19897. - brcmu_pkt_buf_free_skb(skb);
  19898. - return;
  19899. 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
  19900. deleted file mode 100644
  19901. index 632714c..0000000
  19902. --- a/package/kernel/mac80211/patches/394-0002-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  19903. +++ /dev/null
  19904. @@ -1,222 +0,0 @@
  19905. -From: Arend van Spriel <arend@broadcom.com>
  19906. -Date: Wed, 26 Aug 2015 22:14:54 +0200
  19907. -Subject: [PATCH] brcmfmac: make brcmf_proto_hdrpull() return struct
  19908. - brcmf_if instance
  19909. -
  19910. -Avoid spreading the ifidx in the driver, but have it return the
  19911. -struct brcmf_if instance.
  19912. -
  19913. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19914. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19915. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19916. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19917. ----
  19918. -
  19919. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  19920. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  19921. -@@ -272,11 +272,11 @@ brcmf_proto_bcdc_hdrpush(struct brcmf_pu
  19922. - }
  19923. -
  19924. - static int
  19925. --brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  19926. -- struct sk_buff *pktbuf)
  19927. -+brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  19928. -+ struct sk_buff *pktbuf, struct brcmf_if **ifp)
  19929. - {
  19930. - struct brcmf_proto_bcdc_header *h;
  19931. -- struct brcmf_if *ifp;
  19932. -+ struct brcmf_if *tmp_if;
  19933. -
  19934. - brcmf_dbg(BCDC, "Enter\n");
  19935. -
  19936. -@@ -290,21 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19937. - trace_brcmf_bcdchdr(pktbuf->data);
  19938. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  19939. -
  19940. -- ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  19941. -- if (IS_ERR_OR_NULL(ifp)) {
  19942. -+ tmp_if = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  19943. -+ if (!tmp_if) {
  19944. - brcmf_dbg(INFO, "no matching ifp found\n");
  19945. - return -EBADE;
  19946. - }
  19947. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  19948. - BCDC_PROTO_VER) {
  19949. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  19950. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  19951. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  19952. - return -EBADE;
  19953. - }
  19954. -
  19955. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  19956. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  19957. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  19958. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  19959. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  19960. - }
  19961. -
  19962. -@@ -312,7 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19963. -
  19964. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  19965. - if (do_fws)
  19966. -- brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  19967. -+ brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  19968. - pktbuf);
  19969. - else
  19970. - skb_pull(pktbuf, h->data_offset << 2);
  19971. -@@ -320,7 +320,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19972. - if (pktbuf->len == 0)
  19973. - return -ENODATA;
  19974. -
  19975. -- *ifidx = ifp->ifidx;
  19976. -+ *ifp = tmp_if;
  19977. - return 0;
  19978. - }
  19979. -
  19980. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19981. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19982. -@@ -87,7 +87,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  19983. - {
  19984. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  19985. - brcmf_err("ifidx %d out of range\n", ifidx);
  19986. -- return ERR_PTR(-ERANGE);
  19987. -+ return NULL;
  19988. - }
  19989. -
  19990. - /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  19991. -@@ -539,17 +539,15 @@ void brcmf_rx_frame(struct device *dev,
  19992. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  19993. - struct brcmf_pub *drvr = bus_if->drvr;
  19994. - struct brcmf_skb_reorder_data *rd;
  19995. -- u8 ifidx;
  19996. - int ret;
  19997. -
  19998. - brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  19999. -
  20000. - /* process and remove protocol-specific header */
  20001. -- ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb);
  20002. -- ifp = drvr->iflist[ifidx];
  20003. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  20004. -
  20005. - if (ret || !ifp || !ifp->ndev) {
  20006. -- if ((ret != -ENODATA) && ifp)
  20007. -+ if (ret != -ENODATA && ifp)
  20008. - ifp->stats.rx_errors++;
  20009. - brcmu_pkt_buf_free_skb(skb);
  20010. - return;
  20011. -@@ -592,17 +590,17 @@ void brcmf_txcomplete(struct device *dev
  20012. - {
  20013. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  20014. - struct brcmf_pub *drvr = bus_if->drvr;
  20015. -- u8 ifidx;
  20016. -+ struct brcmf_if *ifp;
  20017. -
  20018. - /* await txstatus signal for firmware if active */
  20019. - if (brcmf_fws_fc_active(drvr->fws)) {
  20020. - if (!success)
  20021. - brcmf_fws_bustxfail(drvr->fws, txp);
  20022. - } else {
  20023. -- if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp))
  20024. -+ if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  20025. - brcmu_pkt_buf_free_skb(txp);
  20026. - else
  20027. -- brcmf_txfinalize(drvr, txp, ifidx, success);
  20028. -+ brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  20029. - }
  20030. - }
  20031. -
  20032. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20033. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20034. -@@ -1448,7 +1448,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20035. - struct sk_buff *skb;
  20036. - struct brcmf_skbuff_cb *skcb;
  20037. - struct brcmf_fws_mac_descriptor *entry = NULL;
  20038. -- u8 ifidx;
  20039. -+ struct brcmf_if *ifp;
  20040. -
  20041. - brcmf_dbg(DATA, "flags %d\n", flags);
  20042. -
  20043. -@@ -1497,15 +1497,16 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20044. - }
  20045. - brcmf_fws_macdesc_return_req_credit(skb);
  20046. -
  20047. -- if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) {
  20048. -+ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp);
  20049. -+ if (ret) {
  20050. - brcmu_pkt_buf_free_skb(skb);
  20051. - return -EINVAL;
  20052. - }
  20053. - if (!remove_from_hanger)
  20054. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx,
  20055. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  20056. - genbit, seq);
  20057. - if (remove_from_hanger || ret)
  20058. -- brcmf_txfinalize(fws->drvr, skb, ifidx, true);
  20059. -+ brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  20060. -
  20061. - return 0;
  20062. - }
  20063. -@@ -1848,7 +1849,7 @@ static int brcmf_fws_commit_skb(struct b
  20064. - entry->transit_count--;
  20065. - if (entry->suppressed)
  20066. - entry->suppr_transit_count--;
  20067. -- brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
  20068. -+ (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
  20069. - goto rollback;
  20070. - }
  20071. -
  20072. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20073. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20074. -@@ -522,7 +522,7 @@ static int brcmf_msgbuf_set_dcmd(struct
  20075. -
  20076. -
  20077. - static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  20078. -- u8 *ifidx, struct sk_buff *skb)
  20079. -+ struct sk_buff *skb, struct brcmf_if **ifp)
  20080. - {
  20081. - return -ENODEV;
  20082. - }
  20083. -@@ -1082,7 +1082,7 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  20084. - struct brcmf_if *ifp;
  20085. -
  20086. - ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  20087. -- if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  20088. -+ if (!ifp || !ifp->ndev) {
  20089. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  20090. - brcmu_pkt_buf_free_skb(skb);
  20091. - return;
  20092. ---- a/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  20093. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  20094. -@@ -24,8 +24,8 @@ enum proto_addr_mode {
  20095. -
  20096. -
  20097. - struct brcmf_proto {
  20098. -- int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  20099. -- struct sk_buff *skb);
  20100. -+ int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  20101. -+ struct sk_buff *skb, struct brcmf_if **ifp);
  20102. - int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
  20103. - void *buf, uint len);
  20104. - int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
  20105. -@@ -46,9 +46,19 @@ int brcmf_proto_attach(struct brcmf_pub
  20106. - void brcmf_proto_detach(struct brcmf_pub *drvr);
  20107. -
  20108. - static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  20109. -- u8 *ifidx, struct sk_buff *skb)
  20110. -+ struct sk_buff *skb,
  20111. -+ struct brcmf_if **ifp)
  20112. - {
  20113. -- return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
  20114. -+ struct brcmf_if *tmp = NULL;
  20115. -+
  20116. -+ /* assure protocol is always called with
  20117. -+ * non-null initialized pointer.
  20118. -+ */
  20119. -+ if (ifp)
  20120. -+ *ifp = NULL;
  20121. -+ else
  20122. -+ ifp = &tmp;
  20123. -+ return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
  20124. - }
  20125. - static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  20126. - uint cmd, void *buf, uint len)
  20127. 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
  20128. deleted file mode 100644
  20129. index 2d15a77..0000000
  20130. --- a/package/kernel/mac80211/patches/394-0003-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  20131. +++ /dev/null
  20132. @@ -1,87 +0,0 @@
  20133. -From: Arend van Spriel <arend@broadcom.com>
  20134. -Date: Wed, 26 Aug 2015 22:14:55 +0200
  20135. -Subject: [PATCH] brcmfmac: change parameters for
  20136. - brcmf_remove_interface()
  20137. -
  20138. -Just pass the interface to be removed, ie. the struct brcmf_if instance.
  20139. -
  20140. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20141. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20142. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20143. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20144. ----
  20145. -
  20146. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20147. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20148. -@@ -4982,7 +4982,7 @@ brcmf_notify_connect_status_ap(struct br
  20149. - brcmf_dbg(CONN, "AP mode link down\n");
  20150. - complete(&cfg->vif_disabled);
  20151. - if (ifp->vif->mbss)
  20152. -- brcmf_remove_interface(ifp->drvr, ifp->bssidx);
  20153. -+ brcmf_remove_interface(ifp);
  20154. - return 0;
  20155. - }
  20156. -
  20157. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20158. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20159. -@@ -887,12 +887,13 @@ static void brcmf_del_if(struct brcmf_pu
  20160. - }
  20161. - }
  20162. -
  20163. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx)
  20164. -+void brcmf_remove_interface(struct brcmf_if *ifp)
  20165. - {
  20166. -- if (drvr->iflist[bssidx]) {
  20167. -- brcmf_fws_del_interface(drvr->iflist[bssidx]);
  20168. -- brcmf_del_if(drvr, bssidx);
  20169. -- }
  20170. -+ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  20171. -+ return;
  20172. -+
  20173. -+ brcmf_fws_del_interface(ifp);
  20174. -+ brcmf_del_if(ifp->drvr, ifp->bssidx);
  20175. - }
  20176. -
  20177. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  20178. -@@ -1122,7 +1123,7 @@ void brcmf_detach(struct device *dev)
  20179. -
  20180. - /* make sure primary interface removed last */
  20181. - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  20182. -- brcmf_remove_interface(drvr, i);
  20183. -+ brcmf_remove_interface(drvr->iflist[i]);
  20184. -
  20185. - brcmf_cfg80211_detach(drvr->config);
  20186. -
  20187. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20188. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20189. -@@ -206,7 +206,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  20190. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  20191. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20192. - char *name, u8 *mac_addr);
  20193. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx);
  20194. -+void brcmf_remove_interface(struct brcmf_if *ifp);
  20195. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  20196. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  20197. - enum brcmf_netif_stop_reason reason, bool state);
  20198. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20199. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20200. -@@ -222,7 +222,7 @@ static void brcmf_fweh_handle_if_event(s
  20201. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  20202. -
  20203. - if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  20204. -- brcmf_remove_interface(drvr, ifevent->bssidx);
  20205. -+ brcmf_remove_interface(ifp);
  20206. - }
  20207. -
  20208. - /**
  20209. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20210. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20211. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  20212. - {
  20213. - cfg80211_unregister_wdev(&vif->wdev);
  20214. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  20215. -- brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  20216. -+ brcmf_remove_interface(vif->ifp);
  20217. - brcmf_free_vif(vif);
  20218. - }
  20219. -
  20220. 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
  20221. deleted file mode 100644
  20222. index 2b61f4e..0000000
  20223. --- a/package/kernel/mac80211/patches/394-0004-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  20224. +++ /dev/null
  20225. @@ -1,92 +0,0 @@
  20226. -From: Arend van Spriel <arend@broadcom.com>
  20227. -Date: Wed, 26 Aug 2015 22:14:56 +0200
  20228. -Subject: [PATCH] brcmfmac: only call brcmf_cfg80211_detach() when attach
  20229. - was successful
  20230. -
  20231. -In brcmf_bus_start() the function brcmf_cfg80211_attach() is called which
  20232. -may fail. If this happens we should not call brcmf_cfg80211_detach() in
  20233. -the failure path as it will result in NULL pointer dereference:
  20234. -
  20235. - brcmf_fweh_activate_events: Set event_msgs error (-5)
  20236. - brcmf_bus_start: failed: -5
  20237. - brcmf_sdio_firmware_callback: dongle is not responding
  20238. - BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
  20239. - IP: [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  20240. - PGD 0
  20241. - Oops: 0000 [#1] SMP
  20242. - Modules linked in: brcmfmac(O) brcmutil(O) cfg80211 auth_rpcgss
  20243. - CPU: 1 PID: 45 Comm: kworker/1:1 Tainted: G O
  20244. - Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  20245. - Workqueue: events request_firmware_work_func
  20246. - task: ffff880036c09ac0 ti: ffff880036dd4000 task.ti: ffff880036dd4000
  20247. - RIP: 0010:[<ffffffff811e8f08>] [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  20248. - RSP: 0018:ffff880036dd7a28 EFLAGS: 00010246
  20249. - RAX: ffff880036c09ac0 RBX: 0000000000000000 RCX: 000000007fffffff
  20250. - RDX: 0000000000000000 RSI: ffffffff816578b9 RDI: 0000000000000000
  20251. - RBP: ffff880036dd7a48 R08: 0000000000000000 R09: ffff880036c0b340
  20252. - R10: 00000000000002ec R11: ffff880036dd7b08 R12: ffffffff816578b9
  20253. - R13: 0000000000000000 R14: ffffffff816578b9 R15: ffff8800c6c87000
  20254. - FS: 0000000000000000(0000) GS:ffff88012bc40000(0000) knlGS:0000000000000000
  20255. - CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  20256. - CR2: 0000000000000068 CR3: 0000000001a0b000 CR4: 00000000000006e0
  20257. - Stack:
  20258. - 0000000000000000 ffffffff816578b9 0000000000000000 ffff8800c0d003c8
  20259. - ffff880036dd7a78 ffffffff811e8ff5 0000000ffffffff1 ffffffff81a9b060
  20260. - ffff8800c789f880 ffff8800c0d00000 ffff880036dd7a98 ffffffff811ebe0d
  20261. - Call Trace:
  20262. - [<ffffffff811e8ff5>] kernfs_find_and_get_ns+0x35/0x60
  20263. - [<ffffffff811ebe0d>] sysfs_unmerge_group+0x1d/0x60
  20264. - [<ffffffff81404ef2>] dpm_sysfs_remove+0x22/0x60
  20265. - [<ffffffff813f9db9>] device_del+0x49/0x240
  20266. - [<ffffffff815da768>] rfkill_unregister+0x58/0xc0
  20267. - [<ffffffffa06bd91b>] wiphy_unregister+0xab/0x2f0 [cfg80211]
  20268. - [<ffffffffa0742fe3>] brcmf_cfg80211_detach+0x23/0x50 [brcmfmac]
  20269. - [<ffffffffa074d986>] brcmf_detach+0x86/0xe0 [brcmfmac]
  20270. - [<ffffffffa0757de8>] brcmf_sdio_remove+0x48/0x120 [brcmfmac]
  20271. - [<ffffffffa0758ed9>] brcmf_sdiod_remove+0x29/0xd0 [brcmfmac]
  20272. - [<ffffffffa0759031>] brcmf_ops_sdio_remove+0xb1/0x110 [brcmfmac]
  20273. - [<ffffffffa001c267>] sdio_bus_remove+0x37/0x100 [mmc_core]
  20274. - [<ffffffff813fe026>] __device_release_driver+0x96/0x130
  20275. - [<ffffffff813fe0e3>] device_release_driver+0x23/0x30
  20276. - [<ffffffffa0754bc8>] brcmf_sdio_firmware_callback+0x2a8/0x5d0 [brcmfmac]
  20277. - [<ffffffffa074deaf>] brcmf_fw_request_nvram_done+0x15f/0x5e0 [brcmfmac]
  20278. - [<ffffffff8140142f>] ? devres_add+0x3f/0x50
  20279. - [<ffffffff810642b5>] ? usermodehelper_read_unlock+0x15/0x20
  20280. - [<ffffffff81400000>] ? platform_match+0x70/0xa0
  20281. - [<ffffffff8140f400>] request_firmware_work_func+0x30/0x60
  20282. - [<ffffffff8106828c>] process_one_work+0x14c/0x3d0
  20283. - [<ffffffff8106862a>] worker_thread+0x11a/0x450
  20284. - [<ffffffff81068510>] ? process_one_work+0x3d0/0x3d0
  20285. - [<ffffffff8106d692>] kthread+0xd2/0xf0
  20286. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  20287. - [<ffffffff815ed35f>] ret_from_fork+0x3f/0x70
  20288. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  20289. - Code: e9 40 fe ff ff 48 89 d8 eb 87 66 0f 1f 84 00 00 00 00 00 66 66 66 66
  20290. - 90 55 48 89 e5 41 56 49 89 f6 41 55 49 89 d5 31 d2 41 54 53 <0f> b7
  20291. - 47 68 48 8b 5f 48 66 c1 e8 05 83 e0 01 4d 85 ed 0f b6 c8
  20292. - RIP [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  20293. - RSP <ffff880036dd7a28>
  20294. - CR2: 0000000000000068
  20295. - ---[ end trace 87d6ec0d3fe46740 ]---
  20296. -
  20297. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  20298. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20299. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20300. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20301. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20302. ----
  20303. -
  20304. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20305. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20306. -@@ -1049,7 +1049,10 @@ int brcmf_bus_start(struct device *dev)
  20307. - fail:
  20308. - if (ret < 0) {
  20309. - brcmf_err("failed: %d\n", ret);
  20310. -- brcmf_cfg80211_detach(drvr->config);
  20311. -+ if (drvr->config) {
  20312. -+ brcmf_cfg80211_detach(drvr->config);
  20313. -+ drvr->config = NULL;
  20314. -+ }
  20315. - if (drvr->fws) {
  20316. - brcmf_fws_del_interface(ifp);
  20317. - brcmf_fws_deinit(drvr);
  20318. 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
  20319. deleted file mode 100644
  20320. index 868b0a8..0000000
  20321. --- a/package/kernel/mac80211/patches/394-0005-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  20322. +++ /dev/null
  20323. @@ -1,105 +0,0 @@
  20324. -From: Arend van Spriel <arend@broadcom.com>
  20325. -Date: Wed, 26 Aug 2015 22:14:57 +0200
  20326. -Subject: [PATCH] brcmfmac: correct detection of p2pdev interface event
  20327. -
  20328. -The p2pdev interface is setup in firmware resulting in a interface
  20329. -event. This event has role and no-if flag. When role is p2p client
  20330. -and no-if flag is set it indicates that this is the p2pdev interface.
  20331. -This info is used in handling the event and adding interface in the
  20332. -driver.
  20333. -
  20334. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20335. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20336. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20337. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20338. ----
  20339. -
  20340. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20341. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20342. -@@ -795,7 +795,7 @@ fail:
  20343. - }
  20344. -
  20345. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20346. -- char *name, u8 *mac_addr)
  20347. -+ bool is_p2pdev, char *name, u8 *mac_addr)
  20348. - {
  20349. - struct brcmf_if *ifp;
  20350. - struct net_device *ndev;
  20351. -@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  20352. - }
  20353. - }
  20354. -
  20355. -- if (!brcmf_p2p_enable && bssidx == 1) {
  20356. -+ if (!brcmf_p2p_enable && is_p2pdev) {
  20357. - /* this is P2P_DEVICE interface */
  20358. - brcmf_dbg(INFO, "allocate non-netdev interface\n");
  20359. - ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
  20360. -@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
  20361. - brcmf_dbg(TRACE, "\n");
  20362. -
  20363. - /* add primary networking interface */
  20364. -- ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL);
  20365. -+ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
  20366. - if (IS_ERR(ifp))
  20367. - return PTR_ERR(ifp);
  20368. -
  20369. - if (brcmf_p2p_enable)
  20370. -- p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL);
  20371. -+ p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  20372. - else
  20373. - p2p_ifp = NULL;
  20374. - if (IS_ERR(p2p_ifp))
  20375. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20376. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20377. -@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drv
  20378. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  20379. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  20380. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20381. -- char *name, u8 *mac_addr);
  20382. -+ bool is_p2pdev, char *name, u8 *mac_addr);
  20383. - void brcmf_remove_interface(struct brcmf_if *ifp);
  20384. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  20385. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  20386. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20387. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20388. -@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(s
  20389. - {
  20390. - struct brcmf_if_event *ifevent = data;
  20391. - struct brcmf_if *ifp;
  20392. -+ bool is_p2pdev;
  20393. - int err = 0;
  20394. -
  20395. - brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  20396. -@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(s
  20397. - ifevent->flags, ifevent->role);
  20398. -
  20399. - /* The P2P Device interface event must not be ignored
  20400. -- * contrary to what firmware tells us. The only way to
  20401. -- * distinguish the P2P Device is by looking at the ifidx
  20402. -- * and bssidx received.
  20403. -+ * contrary to what firmware tells us.
  20404. - */
  20405. -- if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
  20406. -- (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  20407. -+ is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  20408. -+ ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  20409. -+ if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  20410. - brcmf_dbg(EVENT, "event can be ignored\n");
  20411. - return;
  20412. - }
  20413. - if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  20414. -- brcmf_err("invalid interface index: %u\n",
  20415. -- ifevent->ifidx);
  20416. -+ brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  20417. - return;
  20418. - }
  20419. -
  20420. -@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(s
  20421. - brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  20422. - emsg->addr);
  20423. - ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  20424. -- emsg->ifname, emsg->addr);
  20425. -+ is_p2pdev, emsg->ifname, emsg->addr);
  20426. - if (IS_ERR(ifp))
  20427. - return;
  20428. - brcmf_fws_add_interface(ifp);
  20429. 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
  20430. deleted file mode 100644
  20431. index aebbfa6..0000000
  20432. --- a/package/kernel/mac80211/patches/394-0006-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  20433. +++ /dev/null
  20434. @@ -1,126 +0,0 @@
  20435. -From: Arend van Spriel <arend@broadcom.com>
  20436. -Date: Wed, 26 Aug 2015 22:14:58 +0200
  20437. -Subject: [PATCH] brcmfmac: use brcmf_get_ifp() to map ifidx to struct
  20438. - brcmf_if instance
  20439. -
  20440. -The knowledge on how to map the interface index to a struct brcmf_if
  20441. -instance is in brcmf_get_ifp() so use that function when only the
  20442. -interface index is known instead of accessing brcmf_pub::iflist
  20443. -directly.
  20444. -
  20445. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20446. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20447. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20448. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20449. ----
  20450. -
  20451. ---- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  20452. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  20453. -@@ -149,7 +149,7 @@ static s32 brcmf_btcoex_params_read(stru
  20454. - static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
  20455. - bool trump_sco)
  20456. - {
  20457. -- struct brcmf_if *ifp = btci->cfg->pub->iflist[0];
  20458. -+ struct brcmf_if *ifp = brcmf_get_ifp(btci->cfg->pub, 0);
  20459. -
  20460. - if (trump_sco && !btci->saved_regs_part2) {
  20461. - /* this should reduce eSCO agressive
  20462. -@@ -468,7 +468,7 @@ int brcmf_btcoex_set_mode(struct brcmf_c
  20463. - {
  20464. - struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  20465. - struct brcmf_btcoex_info *btci = cfg->btcoex;
  20466. -- struct brcmf_if *ifp = cfg->pub->iflist[0];
  20467. -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  20468. -
  20469. - switch (mode) {
  20470. - case BRCMF_BTCOEX_DISABLED:
  20471. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20472. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20473. -@@ -6212,7 +6212,7 @@ static void brcmf_free_wiphy(struct wiph
  20474. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  20475. - struct device *busdev)
  20476. - {
  20477. -- struct net_device *ndev = drvr->iflist[0]->ndev;
  20478. -+ struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  20479. - struct brcmf_cfg80211_info *cfg;
  20480. - struct wiphy *wiphy;
  20481. - struct brcmf_cfg80211_vif *vif;
  20482. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  20483. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  20484. -@@ -121,7 +121,7 @@ static void brcmf_feat_iovar_int_set(str
  20485. -
  20486. - void brcmf_feat_attach(struct brcmf_pub *drvr)
  20487. - {
  20488. -- struct brcmf_if *ifp = drvr->iflist[0];
  20489. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  20490. -
  20491. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  20492. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  20493. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  20494. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  20495. -@@ -221,7 +221,7 @@ static void brcmf_flowring_block(struct
  20496. -
  20497. - bus_if = dev_get_drvdata(flow->dev);
  20498. - drvr = bus_if->drvr;
  20499. -- ifp = drvr->iflist[ifidx];
  20500. -+ ifp = brcmf_get_ifp(drvr, ifidx);
  20501. - brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
  20502. -
  20503. - spin_unlock_irqrestore(&flow->block_lock, flags);
  20504. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20505. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20506. -@@ -334,7 +334,7 @@ void brcmf_fweh_attach(struct brcmf_pub
  20507. - void brcmf_fweh_detach(struct brcmf_pub *drvr)
  20508. - {
  20509. - struct brcmf_fweh_info *fweh = &drvr->fweh;
  20510. -- struct brcmf_if *ifp = drvr->iflist[0];
  20511. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  20512. - s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  20513. -
  20514. - if (ifp) {
  20515. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20516. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20517. -@@ -972,7 +972,7 @@ static void
  20518. - brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
  20519. - u8 if_id)
  20520. - {
  20521. -- struct brcmf_if *ifp = fws->drvr->iflist[!if_id ? 0 : if_id + 1];
  20522. -+ struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id);
  20523. -
  20524. - if (WARN_ON(!ifp))
  20525. - return;
  20526. -@@ -2118,6 +2118,7 @@ static int brcmf_debugfs_fws_stats_read(
  20527. - int brcmf_fws_init(struct brcmf_pub *drvr)
  20528. - {
  20529. - struct brcmf_fws_info *fws;
  20530. -+ struct brcmf_if *ifp;
  20531. - u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS;
  20532. - int rc;
  20533. - u32 mode;
  20534. -@@ -2177,21 +2178,22 @@ int brcmf_fws_init(struct brcmf_pub *drv
  20535. - * continue. Set mode back to none indicating not enabled.
  20536. - */
  20537. - fws->fw_signals = true;
  20538. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) {
  20539. -+ ifp = brcmf_get_ifp(drvr, 0);
  20540. -+ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  20541. - brcmf_err("failed to set bdcv2 tlv signaling\n");
  20542. - fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  20543. - fws->fw_signals = false;
  20544. - }
  20545. -
  20546. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1))
  20547. -+ if (brcmf_fil_iovar_int_set(ifp, "ampdu_hostreorder", 1))
  20548. - brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n");
  20549. -
  20550. - /* Enable seq number reuse, if supported */
  20551. -- if (brcmf_fil_iovar_int_get(drvr->iflist[0], "wlfc_mode", &mode) == 0) {
  20552. -+ if (brcmf_fil_iovar_int_get(ifp, "wlfc_mode", &mode) == 0) {
  20553. - if (BRCMF_FWS_MODE_GET_REUSESEQ(mode)) {
  20554. - mode = 0;
  20555. - BRCMF_FWS_MODE_SET_REUSESEQ(mode, 1);
  20556. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0],
  20557. -+ if (brcmf_fil_iovar_int_set(ifp,
  20558. - "wlfc_mode", mode) == 0) {
  20559. - BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1);
  20560. - }
  20561. 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
  20562. deleted file mode 100644
  20563. index 23a7b6f..0000000
  20564. --- a/package/kernel/mac80211/patches/394-0007-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  20565. +++ /dev/null
  20566. @@ -1,122 +0,0 @@
  20567. -From: Arend van Spriel <arend@broadcom.com>
  20568. -Date: Wed, 26 Aug 2015 22:14:59 +0200
  20569. -Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  20570. - brcmf_txfinalize()
  20571. -
  20572. -Most call sites of brcmf_txfinalize already have struct brcmf_if
  20573. -instance so pass that to brcmf_txfinalize() as the function
  20574. -needs it anyway.
  20575. -
  20576. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20577. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20578. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20579. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20580. ----
  20581. -
  20582. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20583. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20584. -@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  20585. - brcmf_netif_rx(ifp, skb);
  20586. - }
  20587. -
  20588. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  20589. -- bool success)
  20590. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  20591. - {
  20592. -- struct brcmf_if *ifp;
  20593. - struct ethhdr *eh;
  20594. - u16 type;
  20595. -
  20596. -- ifp = drvr->iflist[ifidx];
  20597. -- if (!ifp)
  20598. -- goto done;
  20599. --
  20600. - eh = (struct ethhdr *)(txp->data);
  20601. - type = ntohs(eh->h_proto);
  20602. -
  20603. -@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  20604. -
  20605. - if (!success)
  20606. - ifp->stats.tx_errors++;
  20607. --done:
  20608. -+
  20609. - brcmu_pkt_buf_free_skb(txp);
  20610. - }
  20611. -
  20612. -@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  20613. - if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  20614. - brcmu_pkt_buf_free_skb(txp);
  20615. - else
  20616. -- brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  20617. -+ brcmf_txfinalize(ifp, txp, success);
  20618. - }
  20619. - }
  20620. -
  20621. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20622. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20623. -@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  20624. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  20625. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  20626. - enum brcmf_netif_stop_reason reason, bool state);
  20627. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  20628. -- bool success);
  20629. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  20630. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  20631. -
  20632. - /* Sets dongle media info (drv_version, mac address). */
  20633. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20634. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20635. -@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20636. - ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  20637. - genbit, seq);
  20638. - if (remove_from_hanger || ret)
  20639. -- brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  20640. -+ brcmf_txfinalize(ifp, skb, true);
  20641. -
  20642. - return 0;
  20643. - }
  20644. -@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  20645. - if (fws->avoid_queueing) {
  20646. - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  20647. - if (rc < 0)
  20648. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  20649. -+ brcmf_txfinalize(ifp, skb, false);
  20650. - return rc;
  20651. - }
  20652. -
  20653. -@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  20654. - brcmf_fws_schedule_deq(fws);
  20655. - } else {
  20656. - brcmf_err("drop skb: no hanger slot\n");
  20657. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  20658. -+ brcmf_txfinalize(ifp, skb, false);
  20659. - rc = -ENOMEM;
  20660. - }
  20661. - brcmf_fws_unlock(fws);
  20662. -@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  20663. - ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  20664. - brcmf_fws_lock(fws);
  20665. - if (ret < 0)
  20666. -- brcmf_txfinalize(drvr, skb, ifidx,
  20667. -- false);
  20668. -+ brcmf_txfinalize(brcmf_get_ifp(drvr,
  20669. -+ ifidx),
  20670. -+ skb, false);
  20671. - if (fws->bus_flow_blocked)
  20672. - break;
  20673. - }
  20674. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20675. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20676. -@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  20677. - commonring = msgbuf->flowrings[flowid];
  20678. - atomic_dec(&commonring->outstanding_tx);
  20679. -
  20680. -- brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  20681. -+ /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  20682. -+ * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  20683. -+ */
  20684. -+ brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  20685. -+ skb, true);
  20686. - }
  20687. -
  20688. -
  20689. 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
  20690. deleted file mode 100644
  20691. index 8ddc0a6..0000000
  20692. --- a/package/kernel/mac80211/patches/394-0008-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  20693. +++ /dev/null
  20694. @@ -1,92 +0,0 @@
  20695. -From: Arend van Spriel <arend@broadcom.com>
  20696. -Date: Wed, 26 Aug 2015 22:15:00 +0200
  20697. -Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
  20698. - index
  20699. -
  20700. -Because the P2P Device interface in firmware uses the same interface
  20701. -index as the primary interface we use the bsscfg index as index in the
  20702. -struct brcmf_pub::iflist. However, in the data path we get the interface
  20703. -index and not the bsscfg index. So we need a mapping of interface index
  20704. -to bsscfg index, which can be determined upon handle adding the interface.
  20705. -
  20706. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20707. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20708. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20709. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20710. ----
  20711. -
  20712. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20713. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20714. -@@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
  20715. -
  20716. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  20717. - {
  20718. -+ struct brcmf_if *ifp;
  20719. -+ s32 bssidx;
  20720. -+
  20721. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  20722. - brcmf_err("ifidx %d out of range\n", ifidx);
  20723. - return NULL;
  20724. - }
  20725. -
  20726. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20727. -- * events this is easy because it contains the bssidx which maps
  20728. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  20729. -- * bssidx 1 is used for p2p0 and no data can be received or
  20730. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  20731. -- */
  20732. -- if (ifidx)
  20733. -- ifidx++;
  20734. -+ ifp = NULL;
  20735. -+ bssidx = drvr->if2bss[ifidx];
  20736. -+ if (bssidx >= 0)
  20737. -+ ifp = drvr->iflist[bssidx];
  20738. -
  20739. -- return drvr->iflist[ifidx];
  20740. -+ return ifp;
  20741. - }
  20742. -
  20743. - static void _brcmf_set_multicast_list(struct work_struct *work)
  20744. -@@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  20745. -
  20746. - ifp = netdev_priv(ndev);
  20747. - ifp->ndev = ndev;
  20748. -+ /* store mapping ifidx to bssidx */
  20749. -+ drvr->if2bss[ifidx] = bssidx;
  20750. - }
  20751. -
  20752. - ifp->drvr = drvr;
  20753. -@@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
  20754. - struct brcmf_if *ifp;
  20755. -
  20756. - ifp = drvr->iflist[bssidx];
  20757. -+ drvr->if2bss[ifp->ifidx] = -1;
  20758. - drvr->iflist[bssidx] = NULL;
  20759. - if (!ifp) {
  20760. - brcmf_err("Null interface, idx=%d\n", bssidx);
  20761. -@@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
  20762. - }
  20763. - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  20764. - if (ifp->ndev) {
  20765. -+ drvr->if2bss[ifp->ifidx] = -1;
  20766. - if (bssidx == 0) {
  20767. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  20768. - rtnl_lock();
  20769. -@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  20770. - if (!drvr)
  20771. - return -ENOMEM;
  20772. -
  20773. -+ memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  20774. - mutex_init(&drvr->proto_block);
  20775. -
  20776. - /* Link to bus module */
  20777. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20778. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20779. -@@ -122,6 +122,7 @@ struct brcmf_pub {
  20780. - struct mac_address addresses[BRCMF_MAX_IFS];
  20781. -
  20782. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  20783. -+ s32 if2bss[BRCMF_MAX_IFS];
  20784. -
  20785. - struct mutex proto_block;
  20786. - unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  20787. 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
  20788. deleted file mode 100644
  20789. index a0a798b..0000000
  20790. --- a/package/kernel/mac80211/patches/394-0009-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  20791. +++ /dev/null
  20792. @@ -1,103 +0,0 @@
  20793. -From: Arend van Spriel <arend@broadcom.com>
  20794. -Date: Wed, 26 Aug 2015 22:15:01 +0200
  20795. -Subject: [PATCH] brcmfmac: add dedicated debug level for firmware
  20796. - console logging
  20797. -
  20798. -Both PCIe and SDIO devices have the possibility to log the firmware
  20799. -console output in kernel log. For PCIe it is logged when PCIE debug
  20800. -level is enabled. For SDIO it is logged when user specifies a non-zero
  20801. -console interval through debugfs. This patch tries to make it a
  20802. -bit more consistent. The firmware console output is only logged when
  20803. -FWCON debug level is enabled.
  20804. -
  20805. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20806. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20807. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20808. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  20809. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20810. ----
  20811. -
  20812. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  20813. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  20814. -@@ -37,6 +37,7 @@
  20815. - #define BRCMF_SDIO_VAL 0x00020000
  20816. - #define BRCMF_MSGBUF_VAL 0x00040000
  20817. - #define BRCMF_PCIE_VAL 0x00080000
  20818. -+#define BRCMF_FWCON_VAL 0x00100000
  20819. -
  20820. - /* set default print format */
  20821. - #undef pr_fmt
  20822. -@@ -78,6 +79,7 @@ do { \
  20823. - #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  20824. - #define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
  20825. - #define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
  20826. -+#define BRCMF_FWCON_ON() (brcmf_msg_level & BRCMF_FWCON_VAL)
  20827. -
  20828. - #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  20829. -
  20830. -@@ -90,6 +92,7 @@ do { \
  20831. - #define BRCMF_GLOM_ON() 0
  20832. - #define BRCMF_EVENT_ON() 0
  20833. - #define BRCMF_FIL_ON() 0
  20834. -+#define BRCMF_FWCON_ON() 0
  20835. -
  20836. - #endif /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  20837. -
  20838. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  20839. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  20840. -@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(
  20841. - addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
  20842. - console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
  20843. -
  20844. -- brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
  20845. -+ brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
  20846. - console->base_addr, console->buf_addr, console->bufsize);
  20847. - }
  20848. -
  20849. -@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(
  20850. - u8 ch;
  20851. - u32 newidx;
  20852. -
  20853. -+ if (!BRCMF_FWCON_ON())
  20854. -+ return;
  20855. -+
  20856. - console = &devinfo->shared.console;
  20857. - addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
  20858. - newidx = brcmf_pcie_read_tcm32(devinfo, addr);
  20859. -@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(
  20860. - }
  20861. - if (ch == '\n') {
  20862. - console->log_str[console->log_idx] = 0;
  20863. -- brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  20864. -+ pr_debug("CONSOLE: %s", console->log_str);
  20865. - console->log_idx = 0;
  20866. - }
  20867. - }
  20868. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  20869. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  20870. -@@ -123,6 +123,7 @@ struct rte_console {
  20871. -
  20872. - #define BRCMF_FIRSTREAD (1 << 6)
  20873. -
  20874. -+#define BRCMF_CONSOLE 10 /* watchdog interval to poll console */
  20875. -
  20876. - /* SBSDIO_DEVICE_CTL */
  20877. -
  20878. -@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(st
  20879. - if (IS_ERR_OR_NULL(dentry))
  20880. - return;
  20881. -
  20882. -+ bus->console_interval = BRCMF_CONSOLE;
  20883. -+
  20884. - brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
  20885. - brcmf_debugfs_add_entry(drvr, "counters",
  20886. - brcmf_debugfs_sdio_count_read);
  20887. -@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(stru
  20888. - }
  20889. - #ifdef DEBUG
  20890. - /* Poll for console output periodically */
  20891. -- if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
  20892. -+ if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
  20893. - bus->console_interval != 0) {
  20894. - bus->console.count += BRCMF_WD_POLL_MS;
  20895. - if (bus->console.count >= bus->console_interval) {
  20896. 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
  20897. deleted file mode 100644
  20898. index 53e7ede..0000000
  20899. --- a/package/kernel/mac80211/patches/394-0010-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  20900. +++ /dev/null
  20901. @@ -1,34 +0,0 @@
  20902. -From: Arend van Spriel <arend@broadcom.com>
  20903. -Date: Wed, 26 Aug 2015 22:15:02 +0200
  20904. -Subject: [PATCH] brcmfmac: remove ifidx parameter from
  20905. - brcmf_fws_txstatus_suppressed()
  20906. -
  20907. -The brcmf_fws_txstatus_suppressed() function prototype specifies an
  20908. -ifidx parameter which is not used within the function implementation.
  20909. -
  20910. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20911. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20912. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20913. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20914. ----
  20915. -
  20916. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20917. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20918. -@@ -1398,7 +1398,7 @@ done:
  20919. - }
  20920. -
  20921. - static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo,
  20922. -- struct sk_buff *skb, u8 ifidx,
  20923. -+ struct sk_buff *skb,
  20924. - u32 genbit, u16 seq)
  20925. - {
  20926. - struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac;
  20927. -@@ -1503,7 +1503,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20928. - return -EINVAL;
  20929. - }
  20930. - if (!remove_from_hanger)
  20931. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  20932. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb,
  20933. - genbit, seq);
  20934. - if (remove_from_hanger || ret)
  20935. - brcmf_txfinalize(ifp, skb, true);
  20936. 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
  20937. deleted file mode 100644
  20938. index bb05235..0000000
  20939. --- a/package/kernel/mac80211/patches/394-0011-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  20940. +++ /dev/null
  20941. @@ -1,97 +0,0 @@
  20942. -From: Arend van Spriel <arend@broadcom.com>
  20943. -Date: Wed, 26 Aug 2015 22:15:03 +0200
  20944. -Subject: [PATCH] brcmfmac: change prototype for brcmf_fws_hdrpull()
  20945. -
  20946. -Instead of passing ifidx and drvr just pass struct brcmf_if pointer
  20947. -which holds both parameters.
  20948. -
  20949. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20950. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20951. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20952. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20953. ----
  20954. -
  20955. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  20956. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  20957. -@@ -312,8 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20958. -
  20959. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  20960. - if (do_fws)
  20961. -- brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  20962. -- pktbuf);
  20963. -+ brcmf_fws_hdrpull(tmp_if, h->data_offset << 2, pktbuf);
  20964. - else
  20965. - skb_pull(pktbuf, h->data_offset << 2);
  20966. -
  20967. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20968. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20969. -@@ -1616,11 +1616,10 @@ static int brcmf_fws_notify_bcmc_credit_
  20970. - return 0;
  20971. - }
  20972. -
  20973. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  20974. -- struct sk_buff *skb)
  20975. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  20976. - {
  20977. - struct brcmf_skb_reorder_data *rd;
  20978. -- struct brcmf_fws_info *fws = drvr->fws;
  20979. -+ struct brcmf_fws_info *fws = ifp->drvr->fws;
  20980. - u8 *signal_data;
  20981. - s16 data_len;
  20982. - u8 type;
  20983. -@@ -1630,20 +1629,20 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  20984. - s32 err;
  20985. -
  20986. - brcmf_dbg(HDRS, "enter: ifidx %d, skblen %u, sig %d\n",
  20987. -- ifidx, skb->len, signal_len);
  20988. -+ ifp->ifidx, skb->len, siglen);
  20989. -
  20990. -- WARN_ON(signal_len > skb->len);
  20991. -+ WARN_ON(siglen > skb->len);
  20992. -
  20993. -- if (!signal_len)
  20994. -- return 0;
  20995. -+ if (!siglen)
  20996. -+ return;
  20997. - /* if flow control disabled, skip to packet data and leave */
  20998. - if ((!fws) || (!fws->fw_signals)) {
  20999. -- skb_pull(skb, signal_len);
  21000. -- return 0;
  21001. -+ skb_pull(skb, siglen);
  21002. -+ return;
  21003. - }
  21004. -
  21005. - fws->stats.header_pulls++;
  21006. -- data_len = signal_len;
  21007. -+ data_len = siglen;
  21008. - signal_data = skb->data;
  21009. -
  21010. - status = BRCMF_FWS_RET_OK_NOSCHEDULE;
  21011. -@@ -1731,14 +1730,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  21012. - /* signalling processing result does
  21013. - * not affect the actual ethernet packet.
  21014. - */
  21015. -- skb_pull(skb, signal_len);
  21016. -+ skb_pull(skb, siglen);
  21017. -
  21018. - /* this may be a signal-only packet
  21019. - */
  21020. - if (skb->len == 0)
  21021. - fws->stats.header_only_pkt++;
  21022. --
  21023. -- return 0;
  21024. - }
  21025. -
  21026. - static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
  21027. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  21028. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  21029. -@@ -21,8 +21,7 @@
  21030. - int brcmf_fws_init(struct brcmf_pub *drvr);
  21031. - void brcmf_fws_deinit(struct brcmf_pub *drvr);
  21032. - bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
  21033. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  21034. -- struct sk_buff *skb);
  21035. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
  21036. - int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);
  21037. -
  21038. - void brcmf_fws_reset_interface(struct brcmf_if *ifp);
  21039. 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
  21040. deleted file mode 100644
  21041. index ba92c67..0000000
  21042. --- a/package/kernel/mac80211/patches/394-0012-brcmfmac-introduce-brcmf_net_detach-function.patch
  21043. +++ /dev/null
  21044. @@ -1,99 +0,0 @@
  21045. -From: Arend van Spriel <arend@broadcom.com>
  21046. -Date: Wed, 26 Aug 2015 22:15:04 +0200
  21047. -Subject: [PATCH] brcmfmac: introduce brcmf_net_detach() function
  21048. -
  21049. -In case of error during brcmf_bus_start() the network interfaces were
  21050. -freed using free_netdev(). However, the interfaces may have additional
  21051. -memory allocated which is not freed. The netdev has destructor set to
  21052. -brcmf_cfg80211_free_netdev() which frees the additional memory if
  21053. -allocated and call free_netdev(). The brcmf_net_detach() either calls
  21054. -brcmf_cfg80211_free_netdev() directly or uses unregister_netdev() when
  21055. -struct net_device::reg_state indicates the netdev was registered.
  21056. -
  21057. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  21058. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21059. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21060. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21061. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21062. ----
  21063. -
  21064. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21065. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21066. -@@ -4746,7 +4746,8 @@ void brcmf_cfg80211_free_netdev(struct n
  21067. - ifp = netdev_priv(ndev);
  21068. - vif = ifp->vif;
  21069. -
  21070. -- brcmf_free_vif(vif);
  21071. -+ if (vif)
  21072. -+ brcmf_free_vif(vif);
  21073. - free_netdev(ndev);
  21074. - }
  21075. -
  21076. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21077. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21078. -@@ -718,8 +718,6 @@ int brcmf_net_attach(struct brcmf_if *if
  21079. - }
  21080. -
  21081. - brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
  21082. --
  21083. -- ndev->destructor = brcmf_cfg80211_free_netdev;
  21084. - return 0;
  21085. -
  21086. - fail:
  21087. -@@ -729,6 +727,14 @@ fail:
  21088. - return -EBADE;
  21089. - }
  21090. -
  21091. -+static void brcmf_net_detach(struct net_device *ndev)
  21092. -+{
  21093. -+ if (ndev->reg_state == NETREG_REGISTERED)
  21094. -+ unregister_netdev(ndev);
  21095. -+ else
  21096. -+ brcmf_cfg80211_free_netdev(ndev);
  21097. -+}
  21098. -+
  21099. - static int brcmf_net_p2p_open(struct net_device *ndev)
  21100. - {
  21101. - brcmf_dbg(TRACE, "Enter\n");
  21102. -@@ -805,8 +811,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  21103. - ifp->ndev->name);
  21104. - if (ifidx) {
  21105. - netif_stop_queue(ifp->ndev);
  21106. -- unregister_netdev(ifp->ndev);
  21107. -- free_netdev(ifp->ndev);
  21108. -+ brcmf_net_detach(ifp->ndev);
  21109. - drvr->iflist[bssidx] = NULL;
  21110. - } else {
  21111. - brcmf_err("ignore IF event\n");
  21112. -@@ -828,6 +833,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  21113. - if (!ndev)
  21114. - return ERR_PTR(-ENOMEM);
  21115. -
  21116. -+ ndev->destructor = brcmf_cfg80211_free_netdev;
  21117. - ifp = netdev_priv(ndev);
  21118. - ifp->ndev = ndev;
  21119. - /* store mapping ifidx to bssidx */
  21120. -@@ -879,8 +885,7 @@ static void brcmf_del_if(struct brcmf_pu
  21121. - cancel_work_sync(&ifp->setmacaddr_work);
  21122. - cancel_work_sync(&ifp->multicast_work);
  21123. - }
  21124. -- /* unregister will take care of freeing it */
  21125. -- unregister_netdev(ifp->ndev);
  21126. -+ brcmf_net_detach(ifp->ndev);
  21127. - }
  21128. - }
  21129. -
  21130. -@@ -1056,11 +1061,11 @@ fail:
  21131. - brcmf_fws_deinit(drvr);
  21132. - }
  21133. - if (drvr->iflist[0]) {
  21134. -- free_netdev(ifp->ndev);
  21135. -+ brcmf_net_detach(ifp->ndev);
  21136. - drvr->iflist[0] = NULL;
  21137. - }
  21138. - if (p2p_ifp) {
  21139. -- free_netdev(p2p_ifp->ndev);
  21140. -+ brcmf_net_detach(p2p_ifp->ndev);
  21141. - drvr->iflist[1] = NULL;
  21142. - }
  21143. - return ret;
  21144. 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
  21145. deleted file mode 100644
  21146. index 5a7e447..0000000
  21147. --- a/package/kernel/mac80211/patches/395-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  21148. +++ /dev/null
  21149. @@ -1,193 +0,0 @@
  21150. -From: Hante Meuleman <meuleman@broadcom.com>
  21151. -Date: Thu, 27 Aug 2015 16:14:06 +0200
  21152. -Subject: [PATCH] brcmfmac: Reset PCIE devices after recognition.
  21153. -
  21154. -When PCIE type devices are being FW reloaded without being properly
  21155. -reset then the device ends up in a locked state, requiring the
  21156. -device to be completely powered down. This patch adds a reset
  21157. -through watchdog at the moment the device (cores) has been
  21158. -recognized. This will solve warm reboot issues.
  21159. -
  21160. -Cc: Rafal Milecki <zajec5@gmail.com>
  21161. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  21162. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21163. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21164. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  21165. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21166. ----
  21167. -
  21168. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  21169. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  21170. -@@ -101,6 +101,9 @@
  21171. - /* ARM Cortex M3 core, ID 0x82a */
  21172. - #define BCM4329_CORE_ARM_BASE 0x18002000
  21173. -
  21174. -+/* Max possibly supported memory size (limited by IO mapped memory) */
  21175. -+#define BRCMF_CHIP_MAX_MEMSIZE (4 * 1024 * 1024)
  21176. -+
  21177. - #define CORE_SB(base, field) \
  21178. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  21179. - #define SBCOREREV(sbidh) \
  21180. -@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct
  21181. - brcmf_err("RAM size is undetermined\n");
  21182. - return -ENOMEM;
  21183. - }
  21184. -+
  21185. -+ if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
  21186. -+ brcmf_err("RAM size is incorrect\n");
  21187. -+ return -ENOMEM;
  21188. -+ }
  21189. -+
  21190. - return 0;
  21191. - }
  21192. -
  21193. -@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct
  21194. -
  21195. - /* assure chip is passive for core access */
  21196. - brcmf_chip_set_passive(&ci->pub);
  21197. -+
  21198. -+ /* Call bus specific reset function now. Cores have been determined
  21199. -+ * but further access may require a chip specific reset at this point.
  21200. -+ */
  21201. -+ if (ci->ops->reset) {
  21202. -+ ci->ops->reset(ci->ctx, &ci->pub);
  21203. -+ brcmf_chip_set_passive(&ci->pub);
  21204. -+ }
  21205. -+
  21206. - return brcmf_chip_get_raminfo(ci);
  21207. - }
  21208. -
  21209. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  21210. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  21211. -@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
  21212. - u32 (*read32)(void *ctx, u32 addr);
  21213. - void (*write32)(void *ctx, u32 addr, u32 value);
  21214. - int (*prepare)(void *ctx);
  21215. -+ int (*reset)(void *ctx, struct brcmf_chip *chip);
  21216. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  21217. - void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  21218. - };
  21219. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21220. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21221. -@@ -74,6 +74,8 @@ enum brcmf_pcie_state {
  21222. - #define BRCMF_PCIE_REG_INTMASK 0x94
  21223. - #define BRCMF_PCIE_REG_SBMBX 0x98
  21224. -
  21225. -+#define BRCMF_PCIE_REG_LINK_STATUS_CTRL 0xBC
  21226. -+
  21227. - #define BRCMF_PCIE_PCIE2REG_INTMASK 0x24
  21228. - #define BRCMF_PCIE_PCIE2REG_MAILBOXINT 0x48
  21229. - #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C
  21230. -@@ -466,6 +468,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
  21231. -
  21232. - static void brcmf_pcie_reset_device(struct brcmf_pciedev_info *devinfo)
  21233. - {
  21234. -+ struct brcmf_core *core;
  21235. - u16 cfg_offset[] = { BRCMF_PCIE_CFGREG_STATUS_CMD,
  21236. - BRCMF_PCIE_CFGREG_PM_CSR,
  21237. - BRCMF_PCIE_CFGREG_MSI_CAP,
  21238. -@@ -484,32 +487,38 @@ static void brcmf_pcie_reset_device(stru
  21239. - if (!devinfo->ci)
  21240. - return;
  21241. -
  21242. -+ /* Disable ASPM */
  21243. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21244. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21245. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  21246. -- lsc = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  21247. -+ pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  21248. -+ &lsc);
  21249. - val = lsc & (~BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB);
  21250. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, val);
  21251. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  21252. -+ val);
  21253. -
  21254. -+ /* Watchdog reset */
  21255. - brcmf_pcie_select_core(devinfo, BCMA_CORE_CHIPCOMMON);
  21256. - WRITECC32(devinfo, watchdog, 4);
  21257. - msleep(100);
  21258. -
  21259. -+ /* Restore ASPM */
  21260. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21261. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21262. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  21263. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, lsc);
  21264. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  21265. -+ lsc);
  21266. -
  21267. -- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21268. -- for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  21269. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21270. -- cfg_offset[i]);
  21271. -- val = brcmf_pcie_read_reg32(devinfo,
  21272. -- BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  21273. -- brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  21274. -- cfg_offset[i], val);
  21275. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  21276. -- val);
  21277. -+ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
  21278. -+ if (core->rev <= 13) {
  21279. -+ for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  21280. -+ brcmf_pcie_write_reg32(devinfo,
  21281. -+ BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21282. -+ cfg_offset[i]);
  21283. -+ val = brcmf_pcie_read_reg32(devinfo,
  21284. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  21285. -+ brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  21286. -+ cfg_offset[i], val);
  21287. -+ brcmf_pcie_write_reg32(devinfo,
  21288. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  21289. -+ val);
  21290. -+ }
  21291. - }
  21292. - }
  21293. -
  21294. -@@ -519,8 +528,6 @@ static void brcmf_pcie_attach(struct brc
  21295. - u32 config;
  21296. -
  21297. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21298. -- if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0)
  21299. -- brcmf_pcie_reset_device(devinfo);
  21300. - /* BAR1 window may not be sized properly */
  21301. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21302. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR, 0x4e0);
  21303. -@@ -1636,6 +1643,23 @@ static int brcmf_pcie_buscoreprep(void *
  21304. - }
  21305. -
  21306. -
  21307. -+static int brcmf_pcie_buscore_reset(void *ctx, struct brcmf_chip *chip)
  21308. -+{
  21309. -+ struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  21310. -+ u32 val;
  21311. -+
  21312. -+ devinfo->ci = chip;
  21313. -+ brcmf_pcie_reset_device(devinfo);
  21314. -+
  21315. -+ val = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  21316. -+ if (val != 0xffffffff)
  21317. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  21318. -+ val);
  21319. -+
  21320. -+ return 0;
  21321. -+}
  21322. -+
  21323. -+
  21324. - static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  21325. - u32 rstvec)
  21326. - {
  21327. -@@ -1647,6 +1671,7 @@ static void brcmf_pcie_buscore_activate(
  21328. -
  21329. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  21330. - .prepare = brcmf_pcie_buscoreprep,
  21331. -+ .reset = brcmf_pcie_buscore_reset,
  21332. - .activate = brcmf_pcie_buscore_activate,
  21333. - .read32 = brcmf_pcie_buscore_read32,
  21334. - .write32 = brcmf_pcie_buscore_write32,
  21335. -@@ -1814,7 +1839,6 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  21336. - brcmf_pcie_intr_disable(devinfo);
  21337. -
  21338. - brcmf_detach(&pdev->dev);
  21339. -- brcmf_pcie_reset_device(devinfo);
  21340. -
  21341. - kfree(bus->bus_priv.pcie);
  21342. - kfree(bus->msgbuf->flowrings);
  21343. diff --git a/package/kernel/mac80211/patches/396-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch b/package/kernel/mac80211/patches/396-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  21344. deleted file mode 100644
  21345. index f7b3e40..0000000
  21346. --- a/package/kernel/mac80211/patches/396-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  21347. +++ /dev/null
  21348. @@ -1,24 +0,0 @@
  21349. -From: Felix Fietkau <nbd@openwrt.org>
  21350. -Date: Sun, 13 Sep 2015 22:26:10 +0200
  21351. -Subject: [PATCH] ath10k: fix DMA related firmware crashes on multiple devices
  21352. -
  21353. -Some platforms really don't like DMA bursts of 256 bytes, and this
  21354. -causes the firmware to crash when sending beacons.
  21355. -Also, changing this based on the firmware version does not seem to make
  21356. -much sense, so use 128 bytes for all versions.
  21357. -
  21358. -Cc: stable@vger.kernel.org
  21359. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  21360. ----
  21361. -
  21362. ---- a/drivers/net/wireless/ath/ath10k/hw.h
  21363. -+++ b/drivers/net/wireless/ath/ath10k/hw.h
  21364. -@@ -253,7 +253,7 @@ struct ath10k_pktlog_hdr {
  21365. - #define TARGET_10X_MAX_FRAG_ENTRIES 0
  21366. -
  21367. - /* 10.2 parameters */
  21368. --#define TARGET_10_2_DMA_BURST_SIZE 1
  21369. -+#define TARGET_10_2_DMA_BURST_SIZE 0
  21370. -
  21371. - /* Target specific defines for WMI-TLV firmware */
  21372. - #define TARGET_TLV_NUM_VDEVS 3
  21373. diff --git a/package/kernel/mac80211/patches/397-ath9k-declare-required-extra-tx-headroom.patch b/package/kernel/mac80211/patches/397-ath9k-declare-required-extra-tx-headroom.patch
  21374. deleted file mode 100644
  21375. index c420d20..0000000
  21376. --- a/package/kernel/mac80211/patches/397-ath9k-declare-required-extra-tx-headroom.patch
  21377. +++ /dev/null
  21378. @@ -1,22 +0,0 @@
  21379. -From: Felix Fietkau <nbd@openwrt.org>
  21380. -Date: Thu, 24 Sep 2015 16:57:37 +0200
  21381. -Subject: [PATCH] ath9k: declare required extra tx headroom
  21382. -
  21383. -ath9k inserts padding between the 802.11 header and the data area (to
  21384. -align it). Since it didn't declare this extra required headroom, this
  21385. -led to some nasty issues like randomly dropped packets in some setups.
  21386. -
  21387. -Cc: stable@vger.kernel.org
  21388. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  21389. ----
  21390. -
  21391. ---- a/drivers/net/wireless/ath/ath9k/init.c
  21392. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  21393. -@@ -867,6 +867,7 @@ static void ath9k_set_hw_capab(struct at
  21394. - hw->max_rate_tries = 10;
  21395. - hw->sta_data_size = sizeof(struct ath_node);
  21396. - hw->vif_data_size = sizeof(struct ath_vif);
  21397. -+ hw->extra_tx_headroom = 4;
  21398. -
  21399. - hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  21400. - hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
  21401. diff --git a/package/kernel/mac80211/patches/398-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch b/package/kernel/mac80211/patches/398-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  21402. deleted file mode 100644
  21403. index 1478efa..0000000
  21404. --- a/package/kernel/mac80211/patches/398-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  21405. +++ /dev/null
  21406. @@ -1,21 +0,0 @@
  21407. -From: Felix Fietkau <nbd@openwrt.org>
  21408. -Date: Mon, 5 Oct 2015 17:41:25 +0200
  21409. -Subject: [PATCH] mac80211: initialize tid field in struct ieee80211_txq
  21410. -
  21411. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  21412. ----
  21413. -
  21414. ---- a/net/mac80211/util.c
  21415. -+++ b/net/mac80211/util.c
  21416. -@@ -3323,9 +3323,11 @@ void ieee80211_init_tx_queue(struct ieee
  21417. - if (sta) {
  21418. - txqi->txq.sta = &sta->sta;
  21419. - sta->sta.txq[tid] = &txqi->txq;
  21420. -+ txqi->txq.tid = tid;
  21421. - txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  21422. - } else {
  21423. - sdata->vif.txq = &txqi->txq;
  21424. -+ txqi->txq.tid = 0;
  21425. - txqi->txq.ac = IEEE80211_AC_BE;
  21426. - }
  21427. - }
  21428. diff --git a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  21429. index 298f722..72e9a41 100644
  21430. --- a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  21431. +++ b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  21432. @@ -14,7 +14,7 @@
  21433. ccflags-y += -D__CHECK_ENDIAN__
  21434. --- a/drivers/net/wireless/ath/ath.h
  21435. +++ b/drivers/net/wireless/ath/ath.h
  21436. -@@ -316,13 +316,6 @@ void _ath_dbg(struct ath_common *common,
  21437. +@@ -318,13 +318,6 @@ void _ath_dbg(struct ath_common *common,
  21438. #endif /* CPTCFG_ATH_DEBUG */
  21439. /** Returns string describing opmode, or NULL if unknown mode. */
  21440. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  21441. index 2dac505..f918c18 100644
  21442. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  21443. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  21444. @@ -59,7 +59,7 @@
  21445. ---help---
  21446. --- a/.local-symbols
  21447. +++ b/.local-symbols
  21448. -@@ -89,6 +89,7 @@ RTL8187_LEDS=
  21449. +@@ -137,6 +137,7 @@ RTL8187_LEDS=
  21450. ATH_COMMON=
  21451. ATH_CARDS=
  21452. ATH_DEBUG=
  21453. diff --git a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  21454. index 1476953..8b52ac3 100644
  21455. --- a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  21456. +++ b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  21457. @@ -1,6 +1,6 @@
  21458. --- a/net/wireless/reg.c
  21459. +++ b/net/wireless/reg.c
  21460. -@@ -2368,6 +2368,8 @@ void regulatory_hint_country_ie(struct w
  21461. +@@ -2390,6 +2390,8 @@ void regulatory_hint_country_ie(struct w
  21462. enum environment_cap env = ENVIRON_ANY;
  21463. struct regulatory_request *request = NULL, *lr;
  21464. @@ -9,7 +9,7 @@
  21465. /* IE len must be evenly divisible by 2 */
  21466. if (country_ie_len & 0x01)
  21467. return;
  21468. -@@ -2571,6 +2573,7 @@ static void restore_regulatory_settings(
  21469. +@@ -2596,6 +2598,7 @@ static void restore_regulatory_settings(
  21470. void regulatory_hint_disconnect(void)
  21471. {
  21472. 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
  21473. index 93760f9..1a62484 100644
  21474. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  21475. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  21476. @@ -1,6 +1,6 @@
  21477. --- a/drivers/net/wireless/ath/ath9k/init.c
  21478. +++ b/drivers/net/wireless/ath/ath9k/init.c
  21479. -@@ -715,6 +715,7 @@ static const struct ieee80211_iface_limi
  21480. +@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  21481. BIT(NL80211_IFTYPE_AP) },
  21482. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  21483. BIT(NL80211_IFTYPE_P2P_GO) },
  21484. diff --git a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  21485. index aa521d2..42d43a4 100644
  21486. --- a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  21487. +++ b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  21488. @@ -121,7 +121,7 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++
  21489. debugfs_create_file("antenna", S_IWUSR | S_IRUSR, phydir, ah,
  21490. --- a/drivers/net/wireless/ath/ath5k/ath5k.h
  21491. +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  21492. -@@ -1371,6 +1371,7 @@ struct ath5k_hw {
  21493. +@@ -1370,6 +1370,7 @@ struct ath5k_hw {
  21494. u8 ah_coverage_class;
  21495. bool ah_ack_bitrate_high;
  21496. u8 ah_bwmode;
  21497. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  21498. index 5892c3e..5a3e37c 100644
  21499. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  21500. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  21501. @@ -1,6 +1,6 @@
  21502. --- a/drivers/net/wireless/ath/ath9k/init.c
  21503. +++ b/drivers/net/wireless/ath/ath9k/init.c
  21504. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  21505. +@@ -1032,23 +1032,23 @@ static int __init ath9k_init(void)
  21506. {
  21507. int error;
  21508. diff --git a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  21509. index ed2cfee..d2a3b96 100644
  21510. --- a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  21511. +++ b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  21512. @@ -1,6 +1,6 @@
  21513. --- a/drivers/net/wireless/ath/ath9k/hw.c
  21514. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  21515. -@@ -389,13 +389,8 @@ static void ath9k_hw_init_config(struct
  21516. +@@ -390,13 +390,8 @@ static void ath9k_hw_init_config(struct
  21517. ah->config.rx_intr_mitigation = true;
  21518. @@ -14,5 +14,5 @@
  21519. + ah->config.rimt_last = 250;
  21520. + ah->config.rimt_first = 500;
  21521. - /*
  21522. - * We need this for PCI devices only (Cardbus, PCI, miniPCI)
  21523. + if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
  21524. + ah->config.pll_pwrsave = 7;
  21525. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  21526. index d4104f0..6766111 100644
  21527. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  21528. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  21529. @@ -1,6 +1,6 @@
  21530. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  21531. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  21532. -@@ -87,7 +87,7 @@ int ath_descdma_setup(struct ath_softc *
  21533. +@@ -88,7 +88,7 @@ int ath_descdma_setup(struct ath_softc *
  21534. (_l) &= ((_sz) - 1); \
  21535. } while (0)
  21536. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  21537. index 40b5c81..c84d1bc 100644
  21538. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  21539. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  21540. @@ -1,6 +1,6 @@
  21541. --- a/drivers/net/wireless/ath/ath9k/hw.c
  21542. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  21543. -@@ -647,6 +647,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  21544. +@@ -651,6 +651,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  21545. /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */
  21546. switch (ah->hw_version.devid) {
  21547. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  21548. index 0c50a0b..99bf7e8 100644
  21549. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  21550. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  21551. @@ -18,7 +18,7 @@
  21552. const u8 *addr);
  21553. --- a/include/net/mac80211.h
  21554. +++ b/include/net/mac80211.h
  21555. -@@ -1171,6 +1171,7 @@ enum ieee80211_smps_mode {
  21556. +@@ -1252,6 +1252,7 @@ enum ieee80211_smps_mode {
  21557. *
  21558. * @power_level: requested transmit power (in dBm), backward compatibility
  21559. * value only that is set to the minimum of all interfaces
  21560. @@ -26,7 +26,7 @@
  21561. *
  21562. * @chandef: the channel definition to tune to
  21563. * @radar_enabled: whether radar detection is enabled
  21564. -@@ -1192,6 +1193,7 @@ struct ieee80211_conf {
  21565. +@@ -1273,6 +1274,7 @@ struct ieee80211_conf {
  21566. u32 flags;
  21567. int power_level, dynamic_ps_timeout;
  21568. int max_sleep_period;
  21569. @@ -36,7 +36,7 @@
  21570. u8 ps_dtim_period;
  21571. --- a/include/uapi/linux/nl80211.h
  21572. +++ b/include/uapi/linux/nl80211.h
  21573. -@@ -1760,6 +1760,9 @@ enum nl80211_commands {
  21574. +@@ -1761,6 +1761,9 @@ enum nl80211_commands {
  21575. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  21576. * is operating in an indoor environment.
  21577. *
  21578. @@ -46,7 +46,7 @@
  21579. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  21580. * @NL80211_ATTR_MAX: highest attribute number currently defined
  21581. * @__NL80211_ATTR_AFTER_LAST: internal use
  21582. -@@ -2129,6 +2132,8 @@ enum nl80211_attrs {
  21583. +@@ -2130,6 +2133,8 @@ enum nl80211_attrs {
  21584. NL80211_ATTR_REG_INDOOR,
  21585. @@ -57,7 +57,7 @@
  21586. __NL80211_ATTR_AFTER_LAST,
  21587. --- a/net/mac80211/cfg.c
  21588. +++ b/net/mac80211/cfg.c
  21589. -@@ -2208,6 +2208,19 @@ static int ieee80211_get_tx_power(struct
  21590. +@@ -2233,6 +2233,19 @@ static int ieee80211_get_tx_power(struct
  21591. return 0;
  21592. }
  21593. @@ -77,7 +77,7 @@
  21594. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  21595. const u8 *addr)
  21596. {
  21597. -@@ -3771,6 +3784,7 @@ const struct cfg80211_ops mac80211_confi
  21598. +@@ -3845,6 +3858,7 @@ const struct cfg80211_ops mac80211_confi
  21599. .set_wiphy_params = ieee80211_set_wiphy_params,
  21600. .set_tx_power = ieee80211_set_tx_power,
  21601. .get_tx_power = ieee80211_get_tx_power,
  21602. @@ -87,7 +87,7 @@
  21603. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  21604. --- a/net/mac80211/ieee80211_i.h
  21605. +++ b/net/mac80211/ieee80211_i.h
  21606. -@@ -1333,6 +1333,7 @@ struct ieee80211_local {
  21607. +@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  21608. int dynamic_ps_forced_timeout;
  21609. int user_power_level; /* in dBm, for all interfaces */
  21610. @@ -97,7 +97,7 @@
  21611. --- a/net/mac80211/main.c
  21612. +++ b/net/mac80211/main.c
  21613. -@@ -98,7 +98,7 @@ static u32 ieee80211_hw_conf_chan(struct
  21614. +@@ -95,7 +95,7 @@ static u32 ieee80211_hw_conf_chan(struct
  21615. struct ieee80211_sub_if_data *sdata;
  21616. struct cfg80211_chan_def chandef = {};
  21617. u32 changed = 0;
  21618. @@ -106,7 +106,7 @@
  21619. u32 offchannel_flag;
  21620. offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
  21621. -@@ -155,6 +155,12 @@ static u32 ieee80211_hw_conf_chan(struct
  21622. +@@ -152,6 +152,12 @@ static u32 ieee80211_hw_conf_chan(struct
  21623. }
  21624. rcu_read_unlock();
  21625. @@ -119,7 +119,7 @@
  21626. if (local->hw.conf.power_level != power) {
  21627. changed |= IEEE80211_CONF_CHANGE_POWER;
  21628. local->hw.conf.power_level = power;
  21629. -@@ -578,6 +584,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  21630. +@@ -581,6 +587,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  21631. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  21632. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  21633. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  21634. @@ -129,7 +129,7 @@
  21635. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  21636. --- a/net/wireless/nl80211.c
  21637. +++ b/net/wireless/nl80211.c
  21638. -@@ -400,6 +400,7 @@ static const struct nla_policy nl80211_p
  21639. +@@ -402,6 +402,7 @@ static const struct nla_policy nl80211_p
  21640. [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  21641. [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  21642. [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  21643. @@ -137,7 +137,7 @@
  21644. };
  21645. /* policy for the key attributes */
  21646. -@@ -2206,6 +2207,20 @@ static int nl80211_set_wiphy(struct sk_b
  21647. +@@ -2207,6 +2208,20 @@ static int nl80211_set_wiphy(struct sk_b
  21648. if (result)
  21649. return result;
  21650. }
  21651. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  21652. index 7512811..3cfffa0 100644
  21653. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  21654. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  21655. @@ -1,6 +1,6 @@
  21656. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  21657. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  21658. -@@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  21659. +@@ -806,6 +806,9 @@ static inline int ath9k_dump_btcoex(stru
  21660. void ath_init_leds(struct ath_softc *sc);
  21661. void ath_deinit_leds(struct ath_softc *sc);
  21662. void ath_fill_led_pin(struct ath_softc *sc);
  21663. @@ -10,7 +10,7 @@
  21664. #else
  21665. static inline void ath_init_leds(struct ath_softc *sc)
  21666. {
  21667. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  21668. +@@ -945,6 +948,13 @@ void ath_ant_comb_scan(struct ath_softc
  21669. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  21670. @@ -24,7 +24,7 @@
  21671. struct ath_softc {
  21672. struct ieee80211_hw *hw;
  21673. struct device *dev;
  21674. -@@ -1004,9 +1014,8 @@ struct ath_softc {
  21675. +@@ -996,9 +1006,8 @@ struct ath_softc {
  21676. spinlock_t chan_lock;
  21677. #ifdef CPTCFG_MAC80211_LEDS
  21678. @@ -165,7 +165,7 @@
  21679. void ath_fill_led_pin(struct ath_softc *sc)
  21680. --- a/drivers/net/wireless/ath/ath9k/init.c
  21681. +++ b/drivers/net/wireless/ath/ath9k/init.c
  21682. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  21683. +@@ -944,7 +944,7 @@ int ath9k_init_device(u16 devid, struct
  21684. #ifdef CPTCFG_MAC80211_LEDS
  21685. /* must be initialized before ieee80211_register_hw */
  21686. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  21687. index 08c5a0f..2b2c763 100644
  21688. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  21689. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  21690. @@ -62,7 +62,7 @@
  21691. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  21692. --- a/drivers/net/wireless/ath/ath9k/hw.h
  21693. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  21694. -@@ -513,6 +513,12 @@ enum {
  21695. +@@ -519,6 +519,12 @@ enum {
  21696. ATH9K_RESET_COLD,
  21697. };
  21698. @@ -75,7 +75,7 @@
  21699. struct ath9k_hw_version {
  21700. u32 magic;
  21701. u16 devid;
  21702. -@@ -794,6 +800,8 @@ struct ath_hw {
  21703. +@@ -804,6 +810,8 @@ struct ath_hw {
  21704. u32 rfkill_polarity;
  21705. u32 ah_flags;
  21706. @@ -84,7 +84,7 @@
  21707. bool reset_power_on;
  21708. bool htc_reset_init;
  21709. -@@ -1055,6 +1063,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  21710. +@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  21711. bool ath9k_hw_check_alive(struct ath_hw *ah);
  21712. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  21713. @@ -94,7 +94,7 @@
  21714. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  21715. --- a/drivers/net/wireless/ath/ath9k/hw.c
  21716. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  21717. -@@ -1804,6 +1804,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  21718. +@@ -1808,6 +1808,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  21719. }
  21720. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  21721. @@ -115,7 +115,7 @@
  21722. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  21723. struct ath9k_hw_cal_data *caldata, bool fastcc)
  21724. {
  21725. -@@ -2012,6 +2026,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21726. +@@ -2016,6 +2030,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21727. ar9003_hw_disable_phy_restart(ah);
  21728. ath9k_hw_apply_gpio_override(ah);
  21729. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  21730. index 8c9b34c..fddaf56 100644
  21731. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  21732. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  21733. @@ -1,6 +1,6 @@
  21734. --- a/drivers/net/wireless/ath/ath9k/hw.h
  21735. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  21736. -@@ -710,6 +710,7 @@ struct ath_spec_scan {
  21737. +@@ -720,6 +720,7 @@ struct ath_spec_scan {
  21738. * @config_pci_powersave:
  21739. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  21740. *
  21741. @@ -8,7 +8,7 @@
  21742. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  21743. * @spectral_scan_trigger: trigger a spectral scan run
  21744. * @spectral_scan_wait: wait for a spectral scan run to finish
  21745. -@@ -732,6 +733,7 @@ struct ath_hw_ops {
  21746. +@@ -742,6 +743,7 @@ struct ath_hw_ops {
  21747. struct ath_hw_antcomb_conf *antconf);
  21748. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  21749. struct ath_hw_antcomb_conf *antconf);
  21750. @@ -55,7 +55,7 @@
  21751. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  21752. --- a/drivers/net/wireless/ath/ath9k/init.c
  21753. +++ b/drivers/net/wireless/ath/ath9k/init.c
  21754. -@@ -703,7 +703,8 @@ static void ath9k_init_txpower_limits(st
  21755. +@@ -710,7 +710,8 @@ static void ath9k_init_txpower_limits(st
  21756. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  21757. ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  21758. @@ -65,7 +65,7 @@
  21759. }
  21760. static const struct ieee80211_iface_limit if_limits[] = {
  21761. -@@ -896,6 +897,18 @@ static void ath9k_set_hw_capab(struct at
  21762. +@@ -904,6 +905,18 @@ static void ath9k_set_hw_capab(struct at
  21763. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  21764. }
  21765. @@ -84,7 +84,7 @@
  21766. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  21767. const struct ath_bus_ops *bus_ops)
  21768. {
  21769. -@@ -941,6 +954,8 @@ int ath9k_init_device(u16 devid, struct
  21770. +@@ -949,6 +962,8 @@ int ath9k_init_device(u16 devid, struct
  21771. ARRAY_SIZE(ath9k_tpt_blink));
  21772. #endif
  21773. @@ -110,7 +110,7 @@
  21774. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  21775. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21776. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21777. -@@ -1316,9 +1316,30 @@ void ar5008_hw_init_rate_txpower(struct
  21778. +@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  21779. }
  21780. }
  21781. @@ -141,7 +141,7 @@
  21782. static const u32 ar5416_cca_regs[6] = {
  21783. AR_PHY_CCA,
  21784. AR_PHY_CH1_CCA,
  21785. -@@ -1333,6 +1354,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  21786. +@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  21787. if (ret)
  21788. return ret;
  21789. 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
  21790. index 240b898..6ca642a 100644
  21791. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  21792. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  21793. @@ -1,6 +1,6 @@
  21794. --- a/drivers/net/wireless/ath/ath9k/hw.c
  21795. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  21796. -@@ -245,6 +245,19 @@ void ath9k_hw_get_channel_centers(struct
  21797. +@@ -246,6 +246,19 @@ void ath9k_hw_get_channel_centers(struct
  21798. centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT);
  21799. }
  21800. @@ -20,7 +20,7 @@
  21801. /******************/
  21802. /* Chip Revisions */
  21803. /******************/
  21804. -@@ -1382,6 +1395,9 @@ static bool ath9k_hw_set_reset(struct at
  21805. +@@ -1386,6 +1399,9 @@ static bool ath9k_hw_set_reset(struct at
  21806. if (AR_SREV_9100(ah))
  21807. udelay(50);
  21808. @@ -30,7 +30,7 @@
  21809. return true;
  21810. }
  21811. -@@ -1481,6 +1497,9 @@ static bool ath9k_hw_chip_reset(struct a
  21812. +@@ -1485,6 +1501,9 @@ static bool ath9k_hw_chip_reset(struct a
  21813. ar9003_hw_internal_regulator_apply(ah);
  21814. ath9k_hw_init_pll(ah, chan);
  21815. @@ -40,7 +40,7 @@
  21816. return true;
  21817. }
  21818. -@@ -1782,8 +1801,14 @@ static int ath9k_hw_do_fastcc(struct ath
  21819. +@@ -1786,8 +1805,14 @@ static int ath9k_hw_do_fastcc(struct ath
  21820. if (AR_SREV_9271(ah))
  21821. ar9002_hw_load_ani_reg(ah, chan);
  21822. @@ -55,7 +55,7 @@
  21823. return -EINVAL;
  21824. }
  21825. -@@ -2037,6 +2062,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21826. +@@ -2041,6 +2066,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21827. ath9k_hw_set_radar_params(ah);
  21828. }
  21829. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  21830. index 9610372..bc0aca6 100644
  21831. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  21832. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  21833. @@ -1,6 +1,6 @@
  21834. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21835. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21836. -@@ -945,55 +945,6 @@ static bool ar5008_hw_ani_control_new(st
  21837. +@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  21838. * on == 0 means more noise imm
  21839. */
  21840. u32 on = param ? 1 : 0;
  21841. 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
  21842. index c0dc4fe..15863a6 100644
  21843. --- a/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  21844. +++ b/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  21845. @@ -20,32 +20,14 @@ Changes since v1: ---
  21846. drivers/net/wireless/rt2x00/rt2800lib.h | 11 +++++++++++
  21847. 2 files changed, 11 insertions(+), 13 deletions(-)
  21848. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  21849. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  21850. -@@ -2960,17 +2960,4 @@ enum rt2800_eeprom_word {
  21851. - */
  21852. - #define BCN_TBTT_OFFSET 64
  21853. -
  21854. --/*
  21855. -- * RT2800 driver data structure
  21856. -- */
  21857. --struct rt2800_drv_data {
  21858. -- u8 calibration_bw20;
  21859. -- u8 calibration_bw40;
  21860. -- u8 bbp25;
  21861. -- u8 bbp26;
  21862. -- u8 txmixer_gain_24g;
  21863. -- u8 txmixer_gain_5g;
  21864. -- unsigned int tbtt_tick;
  21865. --};
  21866. --
  21867. - #endif /* RT2800_H */
  21868. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  21869. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  21870. -@@ -20,6 +20,17 @@
  21871. +@@ -20,6 +20,20 @@
  21872. #ifndef RT2800LIB_H
  21873. #define RT2800LIB_H
  21874. ++#include "rt2800.h"
  21875. ++
  21876. +/* RT2800 driver data structure */
  21877. +struct rt2800_drv_data {
  21878. + u8 calibration_bw20;
  21879. @@ -55,8 +37,30 @@ Changes since v1: ---
  21880. + u8 txmixer_gain_24g;
  21881. + u8 txmixer_gain_5g;
  21882. + unsigned int tbtt_tick;
  21883. ++ DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  21884. +};
  21885. +
  21886. struct rt2800_ops {
  21887. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  21888. const unsigned int offset, u32 *value);
  21889. +--- a/drivers/net/wireless/rt2x00/rt2800.h
  21890. ++++ b/drivers/net/wireless/rt2x00/rt2800.h
  21891. +@@ -2969,18 +2969,4 @@ enum rt2800_eeprom_word {
  21892. + #define WCID_END 222
  21893. + #define STA_IDS_SIZE (WCID_END - WCID_START + 2)
  21894. +
  21895. +-/*
  21896. +- * RT2800 driver data structure
  21897. +- */
  21898. +-struct rt2800_drv_data {
  21899. +- u8 calibration_bw20;
  21900. +- u8 calibration_bw40;
  21901. +- u8 bbp25;
  21902. +- u8 bbp26;
  21903. +- u8 txmixer_gain_24g;
  21904. +- u8 txmixer_gain_5g;
  21905. +- unsigned int tbtt_tick;
  21906. +- DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  21907. +-};
  21908. +-
  21909. + #endif /* RT2800_H */
  21910. 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
  21911. index 6bad6ac..9165eec 100644
  21912. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  21913. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  21914. @@ -24,7 +24,7 @@ Changes since v1:
  21915. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  21916. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  21917. -@@ -7747,6 +7747,7 @@ static int rt2800_probe_rt(struct rt2x00
  21918. +@@ -7721,6 +7721,7 @@ static int rt2800_probe_rt(struct rt2x00
  21919. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  21920. {
  21921. @@ -32,7 +32,7 @@ Changes since v1:
  21922. int retval;
  21923. u32 reg;
  21924. -@@ -7754,6 +7755,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21925. +@@ -7728,6 +7729,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21926. if (retval)
  21927. return retval;
  21928. @@ -44,9 +44,9 @@ Changes since v1:
  21929. */
  21930. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  21931. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  21932. -@@ -20,6 +20,10 @@
  21933. - #ifndef RT2800LIB_H
  21934. - #define RT2800LIB_H
  21935. +@@ -22,6 +22,10 @@
  21936. +
  21937. + #include "rt2800.h"
  21938. +enum rt2800_flag {
  21939. + RT2800_HAS_HIGH_SHARED_MEM,
  21940. @@ -55,16 +55,16 @@ Changes since v1:
  21941. /* RT2800 driver data structure */
  21942. struct rt2800_drv_data {
  21943. u8 calibration_bw20;
  21944. -@@ -29,6 +33,8 @@ struct rt2800_drv_data {
  21945. - u8 txmixer_gain_24g;
  21946. +@@ -32,6 +36,8 @@ struct rt2800_drv_data {
  21947. u8 txmixer_gain_5g;
  21948. unsigned int tbtt_tick;
  21949. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  21950. +
  21951. + unsigned long rt2800_flags;
  21952. };
  21953. struct rt2800_ops {
  21954. -@@ -61,6 +67,13 @@ struct rt2800_ops {
  21955. +@@ -64,6 +70,13 @@ struct rt2800_ops {
  21956. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  21957. };
  21958. 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
  21959. index 9f8dfcc..5671515 100644
  21960. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  21961. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  21962. @@ -175,7 +175,7 @@ Changes since v1: ---
  21963. /*
  21964. * Update WCID information
  21965. -@@ -1437,8 +1467,11 @@ int rt2800_config_pairwise_key(struct rt
  21966. +@@ -1405,8 +1435,11 @@ int rt2800_config_pairwise_key(struct rt
  21967. sizeof(key_entry.rx_mic));
  21968. offset = PAIRWISE_KEY_ENTRY(key->hw_key_idx);
  21969. @@ -187,7 +187,7 @@ Changes since v1: ---
  21970. }
  21971. /*
  21972. -@@ -4908,14 +4941,19 @@ static int rt2800_init_registers(struct
  21973. +@@ -4884,14 +4917,19 @@ static int rt2800_init_registers(struct
  21974. /*
  21975. * ASIC will keep garbage value after boot, clear encryption keys.
  21976. */
  21977. @@ -207,7 +207,7 @@ Changes since v1: ---
  21978. }
  21979. /*
  21980. -@@ -5041,8 +5079,10 @@ static int rt2800_wait_bbp_ready(struct
  21981. +@@ -5017,8 +5055,10 @@ static int rt2800_wait_bbp_ready(struct
  21982. * BBP was enabled after firmware was loaded,
  21983. * but we need to reactivate it now.
  21984. */
  21985. @@ -218,7 +218,7 @@ Changes since v1: ---
  21986. msleep(1);
  21987. for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
  21988. -@@ -6738,11 +6778,19 @@ int rt2800_enable_radio(struct rt2x00_de
  21989. +@@ -6714,11 +6754,19 @@ int rt2800_enable_radio(struct rt2x00_de
  21990. /*
  21991. * Send signal during boot time to initialize firmware.
  21992. */
  21993. @@ -239,7 +239,7 @@ Changes since v1: ---
  21994. msleep(1);
  21995. /*
  21996. -@@ -7751,6 +7799,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21997. +@@ -7725,6 +7773,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21998. int retval;
  21999. u32 reg;
  22000. @@ -248,22 +248,22 @@ Changes since v1: ---
  22001. retval = rt2800_probe_rt(rt2x00dev);
  22002. if (retval)
  22003. return retval;
  22004. -@@ -7830,8 +7880,11 @@ void rt2800_get_tkip_seq(struct ieee8021
  22005. - u32 offset;
  22006. +@@ -7808,8 +7858,11 @@ void rt2800_get_key_seq(struct ieee80211
  22007. + return;
  22008. - offset = MAC_IVEIV_ENTRY(hw_key_idx);
  22009. + offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  22010. +
  22011. + rt2800_shared_mem_lock(rt2x00dev);
  22012. rt2800_register_multiread(rt2x00dev, offset,
  22013. &iveiv_entry, sizeof(iveiv_entry));
  22014. + rt2800_shared_mem_unlock(rt2x00dev);
  22015. - memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16));
  22016. - memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32));
  22017. + memcpy(&seq->tkip.iv16, &iveiv_entry.iv[0], 2);
  22018. + memcpy(&seq->tkip.iv32, &iveiv_entry.iv[4], 4);
  22019. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  22020. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  22021. -@@ -35,6 +35,11 @@ struct rt2800_drv_data {
  22022. - unsigned int tbtt_tick;
  22023. +@@ -38,6 +38,11 @@ struct rt2800_drv_data {
  22024. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  22025. unsigned long rt2800_flags;
  22026. +
  22027. @@ -274,7 +274,7 @@ Changes since v1: ---
  22028. };
  22029. struct rt2800_ops {
  22030. -@@ -65,6 +70,10 @@ struct rt2800_ops {
  22031. +@@ -68,6 +73,10 @@ struct rt2800_ops {
  22032. const u8 *data, const size_t len);
  22033. int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
  22034. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  22035. @@ -285,7 +285,7 @@ Changes since v1: ---
  22036. };
  22037. static inline bool rt2800_has_high_shared_mem(struct rt2x00_dev *rt2x00dev)
  22038. -@@ -74,6 +83,29 @@ static inline bool rt2800_has_high_share
  22039. +@@ -77,6 +86,29 @@ static inline bool rt2800_has_high_share
  22040. return test_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  22041. }
  22042. @@ -486,7 +486,7 @@ Changes since v1: ---
  22043. /*
  22044. * Queue handlers.
  22045. */
  22046. -@@ -294,8 +315,10 @@ static int rt2800usb_write_firmware(stru
  22047. +@@ -299,8 +320,10 @@ static int rt2800usb_write_firmware(stru
  22048. data + offset, length);
  22049. }
  22050. @@ -497,7 +497,7 @@ Changes since v1: ---
  22051. /*
  22052. * Send firmware request to device to load firmware,
  22053. -@@ -310,7 +333,10 @@ static int rt2800usb_write_firmware(stru
  22054. +@@ -315,7 +338,10 @@ static int rt2800usb_write_firmware(stru
  22055. }
  22056. msleep(10);
  22057. @@ -508,7 +508,7 @@ Changes since v1: ---
  22058. return 0;
  22059. }
  22060. -@@ -328,8 +354,10 @@ static int rt2800usb_init_registers(stru
  22061. +@@ -333,8 +359,10 @@ static int rt2800usb_init_registers(stru
  22062. if (rt2800_wait_csr_ready(rt2x00dev))
  22063. return -EBUSY;
  22064. @@ -519,7 +519,7 @@ Changes since v1: ---
  22065. reg = 0;
  22066. rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
  22067. -@@ -859,6 +887,9 @@ static const struct rt2800_ops rt2800usb
  22068. +@@ -863,6 +891,9 @@ static const struct rt2800_ops rt2800usb
  22069. .drv_write_firmware = rt2800usb_write_firmware,
  22070. .drv_init_registers = rt2800usb_init_registers,
  22071. .drv_get_txwi = rt2800usb_get_txwi,
  22072. 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
  22073. index e7eb630..d04998a 100644
  22074. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  22075. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  22076. @@ -24,7 +24,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22077. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22078. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22079. -@@ -4638,6 +4638,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  22080. +@@ -4614,6 +4614,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  22081. */
  22082. static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
  22083. {
  22084. @@ -32,7 +32,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22085. u32 reg;
  22086. u16 eeprom;
  22087. unsigned int i;
  22088. -@@ -5003,7 +5004,7 @@ static int rt2800_init_registers(struct
  22089. +@@ -4979,7 +4980,7 @@ static int rt2800_init_registers(struct
  22090. /*
  22091. * Clear all beacons
  22092. */
  22093. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22094. rt2800_clear_beacon_register(rt2x00dev, i);
  22095. if (rt2x00_is_usb(rt2x00dev)) {
  22096. -@@ -7852,6 +7853,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22097. +@@ -7826,6 +7827,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22098. if (rt2x00_rt(rt2x00dev, RT3593))
  22099. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  22100. @@ -52,11 +52,11 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22101. */
  22102. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  22103. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  22104. -@@ -33,6 +33,7 @@ struct rt2800_drv_data {
  22105. +@@ -35,6 +35,7 @@ struct rt2800_drv_data {
  22106. u8 txmixer_gain_24g;
  22107. u8 txmixer_gain_5g;
  22108. unsigned int tbtt_tick;
  22109. + unsigned int hw_beacon_count;
  22110. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  22111. unsigned long rt2800_flags;
  22112. -
  22113. 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
  22114. index b79b4be..f5231f0 100644
  22115. --- a/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  22116. +++ b/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  22117. @@ -34,7 +34,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22118. */
  22119. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22120. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22121. -@@ -4650,6 +4650,30 @@ static int rt2800_init_registers(struct
  22122. +@@ -4626,6 +4626,30 @@ static int rt2800_init_registers(struct
  22123. if (ret)
  22124. return ret;
  22125. 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
  22126. index 180c5e3..4b21eae 100644
  22127. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  22128. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  22129. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22130. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22131. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22132. -@@ -7877,7 +7877,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22133. +@@ -7851,7 +7851,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22134. if (rt2x00_rt(rt2x00dev, RT3593))
  22135. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  22136. 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
  22137. index 31aa34a..e77cd86 100644
  22138. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  22139. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  22140. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22141. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22142. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22143. -@@ -7847,6 +7847,7 @@ static int rt2800_probe_rt(struct rt2x00
  22144. +@@ -7821,6 +7821,7 @@ static int rt2800_probe_rt(struct rt2x00
  22145. case RT3390:
  22146. case RT3572:
  22147. case RT3593:
  22148. 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
  22149. index a90c590..780c1dd 100644
  22150. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  22151. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  22152. @@ -31,7 +31,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22153. #define RF5370 0x5370
  22154. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22155. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22156. -@@ -7465,6 +7465,66 @@ static const struct rf_channel rf_vals_3
  22157. +@@ -7441,6 +7441,66 @@ static const struct rf_channel rf_vals_3
  22158. {173, 0x61, 0, 9},
  22159. };
  22160. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22161. static const struct rf_channel rf_vals_5592_xtal20[] = {
  22162. /* Channel, N, K, mod, R */
  22163. {1, 482, 4, 10, 3},
  22164. -@@ -7694,6 +7754,11 @@ static int rt2800_probe_hw_mode(struct r
  22165. +@@ -7668,6 +7728,11 @@ static int rt2800_probe_hw_mode(struct r
  22166. spec->channels = rf_vals_3x;
  22167. break;
  22168. 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
  22169. index ab2673b..858dece 100644
  22170. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  22171. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  22172. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22173. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22174. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22175. -@@ -4402,6 +4402,7 @@ void rt2800_vco_calibration(struct rt2x0
  22176. +@@ -4378,6 +4378,7 @@ void rt2800_vco_calibration(struct rt2x0
  22177. case RF3053:
  22178. case RF3070:
  22179. case RF3290:
  22180. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22181. case RF5360:
  22182. case RF5362:
  22183. case RF5370:
  22184. -@@ -7873,6 +7874,7 @@ static int rt2800_probe_hw_mode(struct r
  22185. +@@ -7847,6 +7848,7 @@ static int rt2800_probe_hw_mode(struct r
  22186. case RF3053:
  22187. case RF3070:
  22188. case RF3290:
  22189. 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
  22190. index 05ed444..ed82e44 100644
  22191. --- a/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  22192. +++ b/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  22193. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22194. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22195. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22196. -@@ -2649,6 +2649,211 @@ static void rt2800_config_channel_rf3053
  22197. +@@ -2625,6 +2625,211 @@ static void rt2800_config_channel_rf3053
  22198. }
  22199. }
  22200. @@ -223,7 +223,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22201. #define POWER_BOUND 0x27
  22202. #define POWER_BOUND_5G 0x2b
  22203. -@@ -3261,6 +3466,9 @@ static void rt2800_config_channel(struct
  22204. +@@ -3237,6 +3442,9 @@ static void rt2800_config_channel(struct
  22205. case RF3322:
  22206. rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
  22207. break;
  22208. 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
  22209. index 3b50775..33cbc4c 100644
  22210. --- a/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  22211. +++ b/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  22212. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22213. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22214. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22215. -@@ -7430,6 +7430,7 @@ static int rt2800_init_eeprom(struct rt2
  22216. +@@ -7406,6 +7406,7 @@ static int rt2800_init_eeprom(struct rt2
  22217. case RF3290:
  22218. case RF3320:
  22219. case RF3322:
  22220. 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
  22221. index 4dfb068..c3a4798 100644
  22222. --- a/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  22223. +++ b/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  22224. @@ -35,7 +35,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22225. #define RX_FILTER_CFG 0x1400
  22226. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22227. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22228. -@@ -5005,6 +5005,12 @@ static int rt2800_init_registers(struct
  22229. +@@ -4981,6 +4981,12 @@ static int rt2800_init_registers(struct
  22230. rt2800_register_write(rt2x00dev, TX_SW_CFG2,
  22231. 0x00000000);
  22232. }
  22233. @@ -48,7 +48,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22234. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  22235. rt2x00_rt(rt2x00dev, RT5392) ||
  22236. rt2x00_rt(rt2x00dev, RT5592)) {
  22237. -@@ -5035,9 +5041,11 @@ static int rt2800_init_registers(struct
  22238. +@@ -5011,9 +5017,11 @@ static int rt2800_init_registers(struct
  22239. rt2800_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
  22240. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
  22241. @@ -63,7 +63,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22242. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
  22243. else
  22244. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
  22245. -@@ -5190,6 +5198,11 @@ static int rt2800_init_registers(struct
  22246. +@@ -5166,6 +5174,11 @@ static int rt2800_init_registers(struct
  22247. reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002;
  22248. rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);
  22249. 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
  22250. index 6663b78..e647777 100644
  22251. --- a/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  22252. +++ b/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  22253. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22254. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22255. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22256. -@@ -5808,6 +5808,47 @@ static void rt2800_init_bbp_3593(struct
  22257. +@@ -5784,6 +5784,47 @@ static void rt2800_init_bbp_3593(struct
  22258. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  22259. }
  22260. @@ -59,7 +59,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22261. static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev)
  22262. {
  22263. int ant, div_mode;
  22264. -@@ -6026,6 +6067,9 @@ static void rt2800_init_bbp(struct rt2x0
  22265. +@@ -6002,6 +6043,9 @@ static void rt2800_init_bbp(struct rt2x0
  22266. case RT3593:
  22267. rt2800_init_bbp_3593(rt2x00dev);
  22268. return;
  22269. 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
  22270. index 6e66f14..0fec3cd 100644
  22271. --- a/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  22272. +++ b/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  22273. @@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22274. /*
  22275. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22276. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22277. -@@ -6843,6 +6843,144 @@ static void rt2800_init_rfcsr_3593(struc
  22278. +@@ -6819,6 +6819,144 @@ static void rt2800_init_rfcsr_3593(struc
  22279. /* TODO: enable stream mode support */
  22280. }
  22281. @@ -166,7 +166,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22282. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  22283. {
  22284. rt2800_rf_init_calibration(rt2x00dev, 2);
  22285. -@@ -7074,6 +7212,9 @@ static void rt2800_init_rfcsr(struct rt2
  22286. +@@ -7050,6 +7188,9 @@ static void rt2800_init_rfcsr(struct rt2
  22287. case RT3390:
  22288. rt2800_init_rfcsr_3390(rt2x00dev);
  22289. break;
  22290. 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
  22291. index 9390f7e..c9d1e06 100644
  22292. --- a/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  22293. +++ b/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  22294. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22295. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22296. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22297. -@@ -7611,6 +7611,8 @@ static int rt2800_init_eeprom(struct rt2
  22298. +@@ -7587,6 +7587,8 @@ static int rt2800_init_eeprom(struct rt2
  22299. rt2x00_rt(rt2x00dev, RT5390) ||
  22300. rt2x00_rt(rt2x00dev, RT5392))
  22301. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  22302. 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
  22303. index 1cba4f6..12b9c33 100644
  22304. --- a/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  22305. +++ b/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  22306. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22307. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22308. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22309. -@@ -3429,6 +3429,36 @@ static char rt2800_txpower_to_dev(struct
  22310. +@@ -3405,6 +3405,36 @@ static char rt2800_txpower_to_dev(struct
  22311. return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
  22312. }
  22313. @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22314. static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
  22315. struct ieee80211_conf *conf,
  22316. struct rf_channel *rf,
  22317. -@@ -3447,6 +3477,12 @@ static void rt2800_config_channel(struct
  22318. +@@ -3423,6 +3453,12 @@ static void rt2800_config_channel(struct
  22319. rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  22320. info->default_power3);
  22321. @@ -60,7 +60,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22322. switch (rt2x00dev->chip.rf) {
  22323. case RF2020:
  22324. case RF3020:
  22325. -@@ -3530,6 +3566,15 @@ static void rt2800_config_channel(struct
  22326. +@@ -3506,6 +3542,15 @@ static void rt2800_config_channel(struct
  22327. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  22328. rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
  22329. rt2800_bbp_write(rt2x00dev, 77, 0x98);
  22330. @@ -76,7 +76,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22331. } else {
  22332. rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
  22333. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  22334. -@@ -3542,6 +3587,7 @@ static void rt2800_config_channel(struct
  22335. +@@ -3518,6 +3563,7 @@ static void rt2800_config_channel(struct
  22336. !rt2x00_rt(rt2x00dev, RT5392)) {
  22337. if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
  22338. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  22339. @@ -84,7 +84,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22340. rt2800_bbp_write(rt2x00dev, 75, 0x46);
  22341. } else {
  22342. if (rt2x00_rt(rt2x00dev, RT3593))
  22343. -@@ -3550,19 +3596,22 @@ static void rt2800_config_channel(struct
  22344. +@@ -3526,19 +3572,22 @@ static void rt2800_config_channel(struct
  22345. rt2800_bbp_write(rt2x00dev, 82, 0x84);
  22346. rt2800_bbp_write(rt2x00dev, 75, 0x50);
  22347. }
  22348. @@ -110,7 +110,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22349. rt2800_bbp_write(rt2x00dev, 83, 0x9a);
  22350. if (rt2x00_has_cap_external_lna_a(rt2x00dev))
  22351. -@@ -3684,6 +3733,23 @@ static void rt2800_config_channel(struct
  22352. +@@ -3660,6 +3709,23 @@ static void rt2800_config_channel(struct
  22353. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
  22354. 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
  22355. index 1773128..3f40b4e 100644
  22356. --- a/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  22357. +++ b/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  22358. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22359. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22360. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22361. -@@ -3416,13 +3416,15 @@ static char rt2800_txpower_to_dev(struct
  22362. +@@ -3392,13 +3392,15 @@ static char rt2800_txpower_to_dev(struct
  22363. unsigned int channel,
  22364. char txpower)
  22365. {
  22366. 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
  22367. index 36f0a4c..52baeec 100644
  22368. --- a/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  22369. +++ b/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  22370. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22371. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22372. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22373. -@@ -4635,7 +4635,8 @@ static void rt2800_config_txpower(struct
  22374. +@@ -4611,7 +4611,8 @@ static void rt2800_config_txpower(struct
  22375. struct ieee80211_channel *chan,
  22376. int power_level)
  22377. {
  22378. 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
  22379. index 8119f97..b9dafc6 100644
  22380. --- a/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  22381. +++ b/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  22382. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22383. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22384. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22385. -@@ -7493,7 +7493,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  22386. +@@ -7469,7 +7469,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  22387. {
  22388. u16 word;
  22389. @@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22390. return 0;
  22391. rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word);
  22392. -@@ -7507,7 +7508,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  22393. +@@ -7483,7 +7484,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  22394. {
  22395. u16 word;
  22396. 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
  22397. index dfbdee7..f09f803 100644
  22398. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  22399. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  22400. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22401. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22402. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22403. -@@ -8428,7 +8428,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22404. +@@ -8402,7 +8402,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22405. if (rt2x00_rt(rt2x00dev, RT3593))
  22406. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  22407. 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
  22408. index 22f7110..f7d23fc 100644
  22409. --- a/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  22410. +++ b/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  22411. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22412. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22413. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22414. -@@ -1961,7 +1961,8 @@ void rt2800_config_ant(struct rt2x00_dev
  22415. +@@ -1937,7 +1937,8 @@ void rt2800_config_ant(struct rt2x00_dev
  22416. rt2800_bbp_write(rt2x00dev, 3, r3);
  22417. rt2800_bbp_write(rt2x00dev, 1, r1);
  22418. 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
  22419. index 9945f38..4da750e 100644
  22420. --- a/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  22421. +++ b/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  22422. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22423. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22424. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22425. -@@ -1984,7 +1984,8 @@ static void rt2800_config_lna_gain(struc
  22426. +@@ -1960,7 +1960,8 @@ static void rt2800_config_lna_gain(struc
  22427. rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
  22428. lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0);
  22429. } else if (libconf->rf.channel <= 128) {
  22430. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22431. rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &eeprom);
  22432. lna_gain = rt2x00_get_field16(eeprom,
  22433. EEPROM_EXT_LNA2_A1);
  22434. -@@ -1994,7 +1995,8 @@ static void rt2800_config_lna_gain(struc
  22435. +@@ -1970,7 +1971,8 @@ static void rt2800_config_lna_gain(struc
  22436. EEPROM_RSSI_BG2_LNA_A1);
  22437. }
  22438. } else {
  22439. 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
  22440. index beadea8..628b237 100644
  22441. --- a/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  22442. +++ b/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  22443. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22444. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22445. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22446. -@@ -4835,7 +4835,8 @@ static u8 rt2800_get_default_vgc(struct
  22447. +@@ -4811,7 +4811,8 @@ static u8 rt2800_get_default_vgc(struct
  22448. else
  22449. vgc = 0x2e + rt2x00dev->lna_gain;
  22450. } else { /* 5GHZ band */
  22451. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22452. vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3;
  22453. else if (rt2x00_rt(rt2x00dev, RT5592))
  22454. vgc = 0x24 + (2 * rt2x00dev->lna_gain);
  22455. -@@ -4855,7 +4856,8 @@ static inline void rt2800_set_vgc(struct
  22456. +@@ -4831,7 +4832,8 @@ static inline void rt2800_set_vgc(struct
  22457. {
  22458. if (qual->vgc_level != vgc_level) {
  22459. if (rt2x00_rt(rt2x00dev, RT3572) ||
  22460. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22461. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66,
  22462. vgc_level);
  22463. } else if (rt2x00_rt(rt2x00dev, RT5592)) {
  22464. -@@ -4902,6 +4904,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  22465. +@@ -4878,6 +4880,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  22466. }
  22467. break;
  22468. 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
  22469. index a6c0f58..216b8b6 100644
  22470. --- a/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  22471. +++ b/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  22472. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22473. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22474. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22475. -@@ -7630,7 +7630,8 @@ static int rt2800_validate_eeprom(struct
  22476. +@@ -7606,7 +7606,8 @@ static int rt2800_validate_eeprom(struct
  22477. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
  22478. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
  22479. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
  22480. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22481. if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
  22482. rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
  22483. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
  22484. -@@ -7650,7 +7651,8 @@ static int rt2800_validate_eeprom(struct
  22485. +@@ -7626,7 +7627,8 @@ static int rt2800_validate_eeprom(struct
  22486. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
  22487. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
  22488. rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
  22489. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22490. if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
  22491. rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
  22492. rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
  22493. -@@ -7658,7 +7660,8 @@ static int rt2800_validate_eeprom(struct
  22494. +@@ -7634,7 +7636,8 @@ static int rt2800_validate_eeprom(struct
  22495. }
  22496. rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
  22497. 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
  22498. index 910f9ec..515086f 100644
  22499. --- a/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  22500. +++ b/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  22501. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22502. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22503. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22504. -@@ -4005,6 +4005,9 @@ static u8 rt2800_compensate_txpower(stru
  22505. +@@ -3981,6 +3981,9 @@ static u8 rt2800_compensate_txpower(stru
  22506. if (rt2x00_rt(rt2x00dev, RT3593))
  22507. return min_t(u8, txpower, 0xc);
  22508. 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
  22509. index bcdfc67..77e3f1b 100644
  22510. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  22511. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  22512. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22513. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22514. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22515. -@@ -8441,7 +8441,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22516. +@@ -8415,7 +8415,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22517. if (retval)
  22518. return retval;
  22519. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  22520. index 8f650a2..44b629f 100644
  22521. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  22522. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  22523. @@ -1,13 +1,13 @@
  22524. --- a/.local-symbols
  22525. +++ b/.local-symbols
  22526. -@@ -263,6 +263,7 @@ RT2X00_LIB_FIRMWARE=
  22527. +@@ -312,6 +312,7 @@ RT2X00_LIB_FIRMWARE=
  22528. RT2X00_LIB_CRYPTO=
  22529. RT2X00_LIB_LEDS=
  22530. RT2X00_LIB_DEBUGFS=
  22531. +RT2X00_LIB_EEPROM=
  22532. RT2X00_DEBUG=
  22533. - RTL_CARDS=
  22534. - RTL8192CE=
  22535. + WL_MEDIATEK=
  22536. + MT7601U=
  22537. --- a/drivers/net/wireless/rt2x00/Kconfig
  22538. +++ b/drivers/net/wireless/rt2x00/Kconfig
  22539. @@ -69,6 +69,7 @@ config RT2800PCI
  22540. @@ -48,7 +48,7 @@
  22541. obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o
  22542. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  22543. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  22544. -@@ -43,6 +43,8 @@ struct rt2800_drv_data {
  22545. +@@ -46,6 +46,8 @@ struct rt2800_drv_data {
  22546. } shmem_lock;
  22547. };
  22548. @@ -57,7 +57,7 @@
  22549. struct rt2800_ops {
  22550. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  22551. const unsigned int offset, u32 *value);
  22552. -@@ -176,6 +178,15 @@ static inline int rt2800_read_eeprom(str
  22553. +@@ -179,6 +181,15 @@ static inline int rt2800_read_eeprom(str
  22554. {
  22555. const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
  22556. 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
  22557. index a35bd55..16a579d 100644
  22558. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  22559. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  22560. @@ -41,7 +41,7 @@
  22561. * Interrupt context handlers.
  22562. --- a/drivers/net/wireless/rt2x00/rt61pci.c
  22563. +++ b/drivers/net/wireless/rt2x00/rt61pci.c
  22564. -@@ -2392,6 +2392,7 @@ static int rt61pci_validate_eeprom(struc
  22565. +@@ -2390,6 +2390,7 @@ static int rt61pci_validate_eeprom(struc
  22566. u32 reg;
  22567. u16 word;
  22568. u8 *mac;
  22569. @@ -49,7 +49,7 @@
  22570. s8 value;
  22571. rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, &reg);
  22572. -@@ -2412,7 +2413,11 @@ static int rt61pci_validate_eeprom(struc
  22573. +@@ -2410,7 +2411,11 @@ static int rt61pci_validate_eeprom(struc
  22574. /*
  22575. * Start validation of the data that has been read.
  22576. */
  22577. 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
  22578. index 067d2ea..39b1ccc 100644
  22579. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  22580. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  22581. @@ -1,6 +1,6 @@
  22582. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22583. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22584. -@@ -3552,11 +3552,18 @@ static void rt2800_config_channel(struct
  22585. +@@ -3528,11 +3528,18 @@ static void rt2800_config_channel(struct
  22586. /*
  22587. * Change BBP settings
  22588. */
  22589. @@ -19,7 +19,7 @@
  22590. } else if (rt2x00_rt(rt2x00dev, RT3593)) {
  22591. if (rf->channel > 14) {
  22592. /* Disable CCK Packet detection on 5GHz */
  22593. -@@ -6618,6 +6625,12 @@ static void rt2800_init_rfcsr_3290(struc
  22594. +@@ -6594,6 +6601,12 @@ static void rt2800_init_rfcsr_3290(struc
  22595. static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
  22596. {
  22597. @@ -32,7 +32,7 @@
  22598. rt2800_rf_init_calibration(rt2x00dev, 30);
  22599. rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
  22600. -@@ -6653,15 +6666,30 @@ static void rt2800_init_rfcsr_3352(struc
  22601. +@@ -6629,15 +6642,30 @@ static void rt2800_init_rfcsr_3352(struc
  22602. rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
  22603. rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
  22604. rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
  22605. @@ -66,7 +66,7 @@
  22606. rt2800_rfcsr_write(rt2x00dev, 43, 0xdb);
  22607. rt2800_rfcsr_write(rt2x00dev, 44, 0xdb);
  22608. rt2800_rfcsr_write(rt2x00dev, 45, 0xdb);
  22609. -@@ -6669,15 +6697,20 @@ static void rt2800_init_rfcsr_3352(struc
  22610. +@@ -6645,15 +6673,20 @@ static void rt2800_init_rfcsr_3352(struc
  22611. rt2800_rfcsr_write(rt2x00dev, 47, 0x0d);
  22612. rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
  22613. rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
  22614. @@ -96,7 +96,7 @@
  22615. rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
  22616. rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
  22617. rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
  22618. -@@ -7698,6 +7731,7 @@ static int rt2800_init_eeprom(struct rt2
  22619. +@@ -7674,6 +7707,7 @@ static int rt2800_init_eeprom(struct rt2
  22620. * RT53xx: defined in "EEPROM_CHIP_ID" field
  22621. */
  22622. if (rt2x00_rt(rt2x00dev, RT3290) ||
  22623. @@ -104,7 +104,7 @@
  22624. rt2x00_rt(rt2x00dev, RT5390) ||
  22625. rt2x00_rt(rt2x00dev, RT5392))
  22626. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  22627. -@@ -7793,7 +7827,8 @@ static int rt2800_init_eeprom(struct rt2
  22628. +@@ -7769,7 +7803,8 @@ static int rt2800_init_eeprom(struct rt2
  22629. /*
  22630. * Detect if this device has Bluetooth co-existence.
  22631. */
  22632. @@ -114,7 +114,7 @@
  22633. __set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags);
  22634. /*
  22635. -@@ -7822,6 +7857,22 @@ static int rt2800_init_eeprom(struct rt2
  22636. +@@ -7798,6 +7833,22 @@ static int rt2800_init_eeprom(struct rt2
  22637. EIRP_MAX_TX_POWER_LIMIT)
  22638. __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
  22639. 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
  22640. index 1dcca36..dcecba4 100644
  22641. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  22642. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  22643. @@ -1,6 +1,6 @@
  22644. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22645. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22646. -@@ -8209,6 +8209,27 @@ static const struct rf_channel rf_vals_5
  22647. +@@ -8185,6 +8185,27 @@ static const struct rf_channel rf_vals_5
  22648. {196, 83, 0, 12, 1},
  22649. };
  22650. @@ -28,7 +28,7 @@
  22651. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  22652. {
  22653. struct hw_mode_spec *spec = &rt2x00dev->spec;
  22654. -@@ -8297,7 +8318,10 @@ static int rt2800_probe_hw_mode(struct r
  22655. +@@ -8271,7 +8292,10 @@ static int rt2800_probe_hw_mode(struct r
  22656. case RF5390:
  22657. case RF5392:
  22658. spec->num_channels = 14;
  22659. @@ -40,7 +40,7 @@
  22660. break;
  22661. case RF3052:
  22662. -@@ -8481,6 +8505,19 @@ static int rt2800_probe_rt(struct rt2x00
  22663. +@@ -8455,6 +8479,19 @@ static int rt2800_probe_rt(struct rt2x00
  22664. return 0;
  22665. }
  22666. @@ -60,7 +60,7 @@
  22667. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  22668. {
  22669. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  22670. -@@ -8523,6 +8560,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22671. +@@ -8497,6 +8534,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22672. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  22673. /*
  22674. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  22675. index c779a17..9f11862 100644
  22676. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  22677. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  22678. @@ -8,7 +8,7 @@
  22679. #include "rt2x00.h"
  22680. #include "rt2800lib.h"
  22681. -@@ -8507,13 +8508,14 @@ static int rt2800_probe_rt(struct rt2x00
  22682. +@@ -8481,13 +8482,14 @@ static int rt2800_probe_rt(struct rt2x00
  22683. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  22684. {
  22685. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  22686. index 840b3bc..9679d71 100644
  22687. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  22688. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  22689. @@ -10,7 +10,7 @@
  22690. #define RF5370 0x5370
  22691. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22692. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22693. -@@ -3038,6 +3038,13 @@ static void rt2800_config_channel_rf53xx
  22694. +@@ -3014,6 +3014,13 @@ static void rt2800_config_channel_rf53xx
  22695. rt2800_rfcsr_write(rt2x00dev, 59,
  22696. r59_non_bt[idx]);
  22697. @@ -24,7 +24,7 @@
  22698. }
  22699. }
  22700. }
  22701. -@@ -3516,6 +3523,7 @@ static void rt2800_config_channel(struct
  22702. +@@ -3492,6 +3499,7 @@ static void rt2800_config_channel(struct
  22703. rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info);
  22704. break;
  22705. case RF3070:
  22706. @@ -32,7 +32,7 @@
  22707. case RF5360:
  22708. case RF5362:
  22709. case RF5370:
  22710. -@@ -3534,6 +3542,7 @@ static void rt2800_config_channel(struct
  22711. +@@ -3510,6 +3518,7 @@ static void rt2800_config_channel(struct
  22712. if (rt2x00_rf(rt2x00dev, RF3070) ||
  22713. rt2x00_rf(rt2x00dev, RF3290) ||
  22714. rt2x00_rf(rt2x00dev, RF3322) ||
  22715. @@ -40,7 +40,7 @@
  22716. rt2x00_rf(rt2x00dev, RF5360) ||
  22717. rt2x00_rf(rt2x00dev, RF5362) ||
  22718. rt2x00_rf(rt2x00dev, RF5370) ||
  22719. -@@ -3812,7 +3821,8 @@ static void rt2800_config_channel(struct
  22720. +@@ -3788,7 +3797,8 @@ static void rt2800_config_channel(struct
  22721. /*
  22722. * Clear update flag
  22723. */
  22724. @@ -50,7 +50,7 @@
  22725. rt2800_bbp_read(rt2x00dev, 49, &bbp);
  22726. rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
  22727. rt2800_bbp_write(rt2x00dev, 49, bbp);
  22728. -@@ -4698,6 +4708,7 @@ void rt2800_vco_calibration(struct rt2x0
  22729. +@@ -4674,6 +4684,7 @@ void rt2800_vco_calibration(struct rt2x0
  22730. case RF3070:
  22731. case RF3290:
  22732. case RF3853:
  22733. @@ -58,7 +58,7 @@
  22734. case RF5360:
  22735. case RF5362:
  22736. case RF5370:
  22737. -@@ -5111,6 +5122,8 @@ static int rt2800_init_registers(struct
  22738. +@@ -5087,6 +5098,8 @@ static int rt2800_init_registers(struct
  22739. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  22740. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  22741. rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
  22742. @@ -67,7 +67,7 @@
  22743. } else {
  22744. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
  22745. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  22746. -@@ -5766,9 +5779,13 @@ static void rt2800_init_bbp_3352(struct
  22747. +@@ -5742,9 +5755,13 @@ static void rt2800_init_bbp_3352(struct
  22748. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  22749. @@ -84,7 +84,7 @@
  22750. rt2800_bbp_write(rt2x00dev, 86, 0x38);
  22751. -@@ -5782,9 +5799,13 @@ static void rt2800_init_bbp_3352(struct
  22752. +@@ -5758,9 +5775,13 @@ static void rt2800_init_bbp_3352(struct
  22753. rt2800_bbp_write(rt2x00dev, 104, 0x92);
  22754. @@ -101,7 +101,7 @@
  22755. rt2800_bbp_write(rt2x00dev, 120, 0x50);
  22756. -@@ -5809,6 +5830,13 @@ static void rt2800_init_bbp_3352(struct
  22757. +@@ -5785,6 +5806,13 @@ static void rt2800_init_bbp_3352(struct
  22758. rt2800_bbp_write(rt2x00dev, 143, 0xa2);
  22759. rt2800_bbp_write(rt2x00dev, 148, 0xc8);
  22760. @@ -115,7 +115,7 @@
  22761. }
  22762. static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
  22763. -@@ -6150,6 +6178,7 @@ static void rt2800_init_bbp(struct rt2x0
  22764. +@@ -6126,6 +6154,7 @@ static void rt2800_init_bbp(struct rt2x0
  22765. rt2800_init_bbp_3290(rt2x00dev);
  22766. break;
  22767. case RT3352:
  22768. @@ -123,7 +123,7 @@
  22769. rt2800_init_bbp_3352(rt2x00dev);
  22770. break;
  22771. case RT3390:
  22772. -@@ -7101,6 +7130,76 @@ static void rt2800_init_rfcsr_3883(struc
  22773. +@@ -7077,6 +7106,76 @@ static void rt2800_init_rfcsr_3883(struc
  22774. rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
  22775. }
  22776. @@ -200,7 +200,7 @@
  22777. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  22778. {
  22779. rt2800_rf_init_calibration(rt2x00dev, 2);
  22780. -@@ -7341,6 +7440,9 @@ static void rt2800_init_rfcsr(struct rt2
  22781. +@@ -7317,6 +7416,9 @@ static void rt2800_init_rfcsr(struct rt2
  22782. case RT3593:
  22783. rt2800_init_rfcsr_3593(rt2x00dev);
  22784. break;
  22785. @@ -210,7 +210,7 @@
  22786. case RT5390:
  22787. rt2800_init_rfcsr_5390(rt2x00dev);
  22788. break;
  22789. -@@ -7600,6 +7702,12 @@ static int rt2800_validate_eeprom(struct
  22790. +@@ -7576,6 +7678,12 @@ static int rt2800_validate_eeprom(struct
  22791. rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
  22792. rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
  22793. rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
  22794. @@ -223,7 +223,7 @@
  22795. } else if (rt2x00_rt(rt2x00dev, RT2860) ||
  22796. rt2x00_rt(rt2x00dev, RT2872)) {
  22797. /*
  22798. -@@ -7738,6 +7846,8 @@ static int rt2800_init_eeprom(struct rt2
  22799. +@@ -7714,6 +7822,8 @@ static int rt2800_init_eeprom(struct rt2
  22800. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  22801. else if (rt2x00_rt(rt2x00dev, RT3883))
  22802. rf = RF3853;
  22803. @@ -232,7 +232,7 @@
  22804. else
  22805. rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
  22806. -@@ -7757,6 +7867,7 @@ static int rt2800_init_eeprom(struct rt2
  22807. +@@ -7733,6 +7843,7 @@ static int rt2800_init_eeprom(struct rt2
  22808. case RF3320:
  22809. case RF3322:
  22810. case RF3853:
  22811. @@ -240,7 +240,7 @@
  22812. case RF5360:
  22813. case RF5362:
  22814. case RF5370:
  22815. -@@ -8312,6 +8423,7 @@ static int rt2800_probe_hw_mode(struct r
  22816. +@@ -8286,6 +8397,7 @@ static int rt2800_probe_hw_mode(struct r
  22817. case RF3290:
  22818. case RF3320:
  22819. case RF3322:
  22820. @@ -248,7 +248,7 @@
  22821. case RF5360:
  22822. case RF5362:
  22823. case RF5370:
  22824. -@@ -8451,6 +8563,7 @@ static int rt2800_probe_hw_mode(struct r
  22825. +@@ -8425,6 +8537,7 @@ static int rt2800_probe_hw_mode(struct r
  22826. case RF3070:
  22827. case RF3290:
  22828. case RF3853:
  22829. @@ -256,7 +256,7 @@
  22830. case RF5360:
  22831. case RF5362:
  22832. case RF5370:
  22833. -@@ -8491,6 +8604,7 @@ static int rt2800_probe_rt(struct rt2x00
  22834. +@@ -8465,6 +8578,7 @@ static int rt2800_probe_rt(struct rt2x00
  22835. case RT3572:
  22836. case RT3593:
  22837. case RT3883:
  22838. 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
  22839. index 13f2048..b085c5e 100644
  22840. --- a/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  22841. +++ b/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  22842. @@ -8,7 +8,7 @@
  22843. #include "rt2x00.h"
  22844. #include "rt2800lib.h"
  22845. -@@ -7957,6 +7958,17 @@ static int rt2800_init_eeprom(struct rt2
  22846. +@@ -7933,6 +7934,17 @@ static int rt2800_init_eeprom(struct rt2
  22847. rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
  22848. rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
  22849. diff --git a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  22850. index aaa8367..259cb1f 100644
  22851. --- a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  22852. +++ b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  22853. @@ -1,6 +1,6 @@
  22854. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22855. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22856. -@@ -7841,10 +7841,11 @@ static int rt2800_init_eeprom(struct rt2
  22857. +@@ -7817,10 +7817,11 @@ static int rt2800_init_eeprom(struct rt2
  22858. * RT53xx: defined in "EEPROM_CHIP_ID" field
  22859. */
  22860. if (rt2x00_rt(rt2x00dev, RT3290) ||
  22861. diff --git a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  22862. index bb2fc1c..77d63fe 100644
  22863. --- a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  22864. +++ b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  22865. @@ -11,7 +11,7 @@
  22866. * RFCSR 31:
  22867. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22868. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22869. -@@ -3551,8 +3551,13 @@ static void rt2800_config_channel(struct
  22870. +@@ -3527,8 +3527,13 @@ static void rt2800_config_channel(struct
  22871. rt2x00_rf(rt2x00dev, RF5390) ||
  22872. rt2x00_rf(rt2x00dev, RF5392)) {
  22873. rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
  22874. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  22875. index 9e29034..3b8b756 100644
  22876. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  22877. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  22878. @@ -1,6 +1,6 @@
  22879. --- a/drivers/net/wireless/libertas/cfg.c
  22880. +++ b/drivers/net/wireless/libertas/cfg.c
  22881. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  22882. +@@ -2083,6 +2083,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  22883. goto err_wiphy_new;
  22884. }
  22885. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  22886. index 252fa81..dace56b 100644
  22887. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  22888. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  22889. @@ -1,6 +1,6 @@
  22890. --- a/drivers/net/wireless/libertas/cfg.c
  22891. +++ b/drivers/net/wireless/libertas/cfg.c
  22892. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  22893. +@@ -2173,6 +2173,8 @@ int lbs_cfg_register(struct lbs_private
  22894. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  22895. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  22896. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  22897. index ac58dba..dd82ce5 100644
  22898. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  22899. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  22900. @@ -9,7 +9,7 @@
  22901. antenna = b43_antenna_to_phyctl(antenna);
  22902. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  22903. /* We can't send beacons with short preamble. Would get PHY errors. */
  22904. -@@ -3302,8 +3302,8 @@ static int b43_chip_init(struct b43_wlde
  22905. +@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  22906. /* Select the antennae */
  22907. if (phy->ops->set_rx_antenna)
  22908. @@ -20,7 +20,7 @@
  22909. if (phy->type == B43_PHYTYPE_B) {
  22910. value16 = b43_read16(dev, 0x005E);
  22911. -@@ -4003,7 +4003,6 @@ static int b43_op_config(struct ieee8021
  22912. +@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  22913. struct b43_wldev *dev = wl->current_dev;
  22914. struct b43_phy *phy = &dev->phy;
  22915. struct ieee80211_conf *conf = &hw->conf;
  22916. @@ -28,7 +28,7 @@
  22917. int err = 0;
  22918. mutex_lock(&wl->mutex);
  22919. -@@ -4046,11 +4045,9 @@ static int b43_op_config(struct ieee8021
  22920. +@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  22921. }
  22922. /* Antennas for RX and management frame TX. */
  22923. @@ -42,7 +42,7 @@
  22924. if (wl->radio_enabled != phy->radio_on) {
  22925. if (wl->radio_enabled) {
  22926. -@@ -5213,6 +5210,47 @@ static int b43_op_get_survey(struct ieee
  22927. +@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  22928. return 0;
  22929. }
  22930. @@ -90,7 +90,7 @@
  22931. static const struct ieee80211_ops b43_hw_ops = {
  22932. .tx = b43_op_tx,
  22933. .conf_tx = b43_op_conf_tx,
  22934. -@@ -5234,6 +5272,8 @@ static const struct ieee80211_ops b43_hw
  22935. +@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  22936. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  22937. .get_survey = b43_op_get_survey,
  22938. .rfkill_poll = b43_rfkill_poll,
  22939. @@ -99,7 +99,7 @@
  22940. };
  22941. /* Hard-reset the chip. Do not call this directly.
  22942. -@@ -5542,6 +5582,8 @@ static int b43_one_core_attach(struct b4
  22943. +@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  22944. if (!wldev)
  22945. goto out;
  22946. @@ -108,7 +108,7 @@
  22947. wldev->use_pio = b43_modparam_pio;
  22948. wldev->dev = dev;
  22949. wldev->wl = wl;
  22950. -@@ -5632,6 +5674,9 @@ static struct b43_wl *b43_wireless_init(
  22951. +@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  22952. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  22953. 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
  22954. index 1cba2b3..5fdfa37 100644
  22955. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  22956. +++ b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  22957. @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  22958. --- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22959. +++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22960. -@@ -691,9 +691,37 @@ static struct wireless_dev *brcmf_cfg802
  22961. +@@ -692,9 +692,37 @@ static struct wireless_dev *brcmf_cfg802
  22962. u32 *flags,
  22963. struct vif_params *params)
  22964. {
  22965. 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
  22966. deleted file mode 100644
  22967. index 856dea8..0000000
  22968. --- a/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch
  22969. +++ /dev/null
  22970. @@ -1,139 +0,0 @@
  22971. -When running with DT, we no longer have a board file that can set up the
  22972. -platform data for wlcore. Allow this data to be passed from DT.
  22973. -
  22974. -Since some platforms use a gpio-irq, add support for passing either the
  22975. -irq number or the gpio number. For the latter case, the driver will
  22976. -request the gpio and convert it to the irq number. If an irq is
  22977. -specified, it'll be used as is.
  22978. -
  22979. -[Arik - the pdev_data pointer does not belong to us and is freed when
  22980. -the device is released. Dereference to our private data first.]
  22981. -
  22982. -Signed-off-by: Ido Yariv <ido@wizery.com>
  22983. -Signed-off-by: Arik Nemtsov <arik@wizery.com>
  22984. ----
  22985. - drivers/net/wireless/ti/wlcore/sdio.c | 71 ++++++++++++++++++++++++++++++++---
  22986. - include/linux/wl12xx.h | 3 +-
  22987. - 2 files changed, 67 insertions(+), 7 deletions(-)
  22988. -
  22989. ---- a/drivers/net/wireless/ti/wlcore/sdio.c
  22990. -+++ b/drivers/net/wireless/ti/wlcore/sdio.c
  22991. -@@ -34,6 +34,7 @@
  22992. - #include <linux/wl12xx.h>
  22993. - #include <linux/pm_runtime.h>
  22994. - #include <linux/printk.h>
  22995. -+#include <linux/of.h>
  22996. -
  22997. - #include "wlcore.h"
  22998. - #include "wl12xx_80211.h"
  22999. -@@ -214,6 +215,61 @@ static struct wl1271_if_operations sdio_
  23000. - .set_block_size = wl1271_sdio_set_block_size,
  23001. - };
  23002. -
  23003. -+static const struct of_device_id wlcore_of_match[] = {
  23004. -+ {
  23005. -+ .compatible = "wlcore",
  23006. -+ },
  23007. -+ {}
  23008. -+};
  23009. -+MODULE_DEVICE_TABLE(of, wlcore_of_match);
  23010. -+
  23011. -+static struct wl12xx_platform_data *get_platform_data(struct device *dev)
  23012. -+{
  23013. -+ struct wl12xx_platform_data *pdata;
  23014. -+ struct device_node *np;
  23015. -+ u32 gpio;
  23016. -+
  23017. -+ pdata = wl12xx_get_platform_data();
  23018. -+ if (!IS_ERR(pdata))
  23019. -+ return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL);
  23020. -+
  23021. -+ np = of_find_matching_node(NULL, wlcore_of_match);
  23022. -+ if (!np) {
  23023. -+ dev_err(dev, "No platform data set\n");
  23024. -+ return NULL;
  23025. -+ }
  23026. -+
  23027. -+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
  23028. -+ if (!pdata) {
  23029. -+ dev_err(dev, "Can't allocate platform data\n");
  23030. -+ return NULL;
  23031. -+ }
  23032. -+
  23033. -+ if (of_property_read_u32(np, "irq", &pdata->irq)) {
  23034. -+ if (!of_property_read_u32(np, "gpio", &gpio) &&
  23035. -+ !gpio_request_one(gpio, GPIOF_IN, "wlcore_irq")) {
  23036. -+ pdata->gpio = gpio;
  23037. -+ pdata->irq = gpio_to_irq(gpio);
  23038. -+ }
  23039. -+ }
  23040. -+
  23041. -+ /* Optional fields */
  23042. -+ pdata->use_eeprom = of_property_read_bool(np, "use-eeprom");
  23043. -+ of_property_read_u32(np, "board-ref-clock", &pdata->board_ref_clock);
  23044. -+ of_property_read_u32(np, "board-tcxo-clock", &pdata->board_tcxo_clock);
  23045. -+ of_property_read_u32(np, "platform-quirks", &pdata->platform_quirks);
  23046. -+
  23047. -+ return pdata;
  23048. -+}
  23049. -+
  23050. -+static void del_platform_data(struct wl12xx_platform_data *pdata)
  23051. -+{
  23052. -+ if (pdata->gpio)
  23053. -+ gpio_free(pdata->gpio);
  23054. -+
  23055. -+ kfree(pdata);
  23056. -+}
  23057. -+
  23058. - static int wl1271_probe(struct sdio_func *func,
  23059. - const struct sdio_device_id *id)
  23060. - {
  23061. -@@ -245,10 +301,10 @@ static int wl1271_probe(struct sdio_func
  23062. - /* Use block mode for transferring over one block size of data */
  23063. - func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
  23064. -
  23065. -- pdev_data.pdata = wl12xx_get_platform_data();
  23066. -- if (IS_ERR(pdev_data.pdata)) {
  23067. -- ret = PTR_ERR(pdev_data.pdata);
  23068. -- dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
  23069. -+ pdev_data.pdata = get_platform_data(&func->dev);
  23070. -+ if (!pdev_data.pdata) {
  23071. -+ ret = -EINVAL;
  23072. -+ dev_err(glue->dev, "missing wlan platform data\n");
  23073. - goto out_free_glue;
  23074. - }
  23075. -
  23076. -@@ -279,7 +335,7 @@ static int wl1271_probe(struct sdio_func
  23077. - if (!glue->core) {
  23078. - dev_err(glue->dev, "can't allocate platform_device");
  23079. - ret = -ENOMEM;
  23080. -- goto out_free_glue;
  23081. -+ goto out_free_pdata;
  23082. - }
  23083. -
  23084. - glue->core->dev.parent = &func->dev;
  23085. -@@ -313,6 +369,9 @@ static int wl1271_probe(struct sdio_func
  23086. - out_dev_put:
  23087. - platform_device_put(glue->core);
  23088. -
  23089. -+out_free_pdata:
  23090. -+ del_platform_data(pdev_data->pdata);
  23091. -+
  23092. - out_free_glue:
  23093. - kfree(glue);
  23094. -
  23095. -@@ -323,11 +382,14 @@ out:
  23096. - static void wl1271_remove(struct sdio_func *func)
  23097. - {
  23098. - struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);
  23099. -+ struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
  23100. -+ struct wl12xx_platform_data *pdata = pdev_data->pdata;
  23101. -
  23102. - /* Undo decrement done above in wl1271_probe */
  23103. - pm_runtime_get_noresume(&func->dev);
  23104. -
  23105. - platform_device_unregister(glue->core);
  23106. -+ del_platform_data(pdata);
  23107. - kfree(glue);
  23108. - }
  23109. -
  23110. 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
  23111. index 501910f..b0536ce 100644
  23112. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  23113. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  23114. @@ -210,7 +210,7 @@
  23115. case RT5592:
  23116. *txwi_size = TXWI_DESC_SIZE_5WORDS;
  23117. *rxwi_size = RXWI_DESC_SIZE_6WORDS;
  23118. -@@ -3326,6 +3399,312 @@ static void rt2800_config_channel_rf55xx
  23119. +@@ -3302,6 +3375,312 @@ static void rt2800_config_channel_rf55xx
  23120. rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F);
  23121. }
  23122. @@ -258,6 +258,7 @@
  23123. + u32 mac_sys_ctrl, mac_status;
  23124. + u32 tx_pin = 0x00150F0F;
  23125. + struct hw_mode_spec *spec = &rt2x00dev->spec;
  23126. ++ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  23127. +
  23128. + /* Frequeny plan setting */
  23129. + /*
  23130. @@ -383,7 +384,6 @@
  23131. + rfcsr &= (~0x4);
  23132. + rt2800_rfcsr_write(rt2x00dev, 28, rfcsr);
  23133. +
  23134. -+ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  23135. + /*if (bScan == FALSE)*/
  23136. + if (conf_is_ht40(conf)) {
  23137. + txrx_agc_fc = rt2x00_get_field8(drv_data->calibration_bw40,
  23138. @@ -523,7 +523,7 @@
  23139. static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev,
  23140. const unsigned int word,
  23141. const u8 value)
  23142. -@@ -3482,7 +3861,7 @@ static void rt2800_config_channel(struct
  23143. +@@ -3458,7 +3837,7 @@ static void rt2800_config_channel(struct
  23144. struct channel_info *info)
  23145. {
  23146. u32 reg;
  23147. @@ -532,7 +532,7 @@
  23148. u8 bbp, rfcsr;
  23149. info->default_power1 = rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  23150. -@@ -3536,6 +3915,9 @@ static void rt2800_config_channel(struct
  23151. +@@ -3512,6 +3891,9 @@ static void rt2800_config_channel(struct
  23152. case RF5592:
  23153. rt2800_config_channel_rf55xx(rt2x00dev, conf, rf, info);
  23154. break;
  23155. @@ -542,7 +542,7 @@
  23156. default:
  23157. rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info);
  23158. }
  23159. -@@ -3638,7 +4020,7 @@ static void rt2800_config_channel(struct
  23160. +@@ -3614,7 +3996,7 @@ static void rt2800_config_channel(struct
  23161. else if (rt2x00_rt(rt2x00dev, RT3593) ||
  23162. rt2x00_rt(rt2x00dev, RT3883))
  23163. rt2800_bbp_write(rt2x00dev, 82, 0x82);
  23164. @@ -551,7 +551,7 @@
  23165. rt2800_bbp_write(rt2x00dev, 82, 0xf2);
  23166. if (rt2x00_rt(rt2x00dev, RT3593) ||
  23167. -@@ -3660,7 +4042,7 @@ static void rt2800_config_channel(struct
  23168. +@@ -3636,7 +4018,7 @@ static void rt2800_config_channel(struct
  23169. if (rt2x00_rt(rt2x00dev, RT3572))
  23170. rt2800_rfcsr_write(rt2x00dev, 8, 0);
  23171. @@ -560,7 +560,7 @@
  23172. switch (rt2x00dev->default_ant.tx_chain_num) {
  23173. case 3:
  23174. -@@ -3709,6 +4091,7 @@ static void rt2800_config_channel(struct
  23175. +@@ -3685,6 +4067,7 @@ static void rt2800_config_channel(struct
  23176. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
  23177. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
  23178. @@ -568,7 +568,7 @@
  23179. rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
  23180. -@@ -4725,6 +5108,14 @@ void rt2800_vco_calibration(struct rt2x0
  23181. +@@ -4701,6 +5084,14 @@ void rt2800_vco_calibration(struct rt2x0
  23182. rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
  23183. rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
  23184. break;
  23185. @@ -583,7 +583,7 @@
  23186. default:
  23187. return;
  23188. }
  23189. -@@ -5125,9 +5516,42 @@ static int rt2800_init_registers(struct
  23190. +@@ -5101,9 +5492,42 @@ static int rt2800_init_registers(struct
  23191. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  23192. rt2x00_rt(rt2x00dev, RT5392) ||
  23193. rt2x00_rt(rt2x00dev, RT5592)) {
  23194. @@ -629,7 +629,7 @@
  23195. } else if (rt2x00_rt(rt2x00dev, RT5350)) {
  23196. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  23197. } else {
  23198. -@@ -6159,6 +6583,225 @@ static void rt2800_init_bbp_5592(struct
  23199. +@@ -6135,6 +6559,225 @@ static void rt2800_init_bbp_5592(struct
  23200. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  23201. }
  23202. @@ -855,7 +855,7 @@
  23203. static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
  23204. {
  23205. unsigned int i;
  23206. -@@ -6201,7 +6844,10 @@ static void rt2800_init_bbp(struct rt2x0
  23207. +@@ -6177,7 +6820,10 @@ static void rt2800_init_bbp(struct rt2x0
  23208. return;
  23209. case RT5390:
  23210. case RT5392:
  23211. @@ -867,7 +867,7 @@
  23212. break;
  23213. case RT5592:
  23214. rt2800_init_bbp_5592(rt2x00dev);
  23215. -@@ -7415,6 +8061,295 @@ static void rt2800_init_rfcsr_5592(struc
  23216. +@@ -7391,6 +8037,296 @@ static void rt2800_init_rfcsr_5592(struc
  23217. rt2800_led_open_drain_enable(rt2x00dev);
  23218. }
  23219. @@ -875,6 +875,8 @@
  23220. +{
  23221. + u16 freq;
  23222. + u8 rfvalue;
  23223. ++ struct hw_mode_spec *spec = &rt2x00dev->spec;
  23224. ++
  23225. + /* Initialize RF central register to default value */
  23226. + rt2800_rfcsr_write(rt2x00dev, 0, 0x02);
  23227. + rt2800_rfcsr_write(rt2x00dev, 1, 0x03);
  23228. @@ -921,7 +923,6 @@
  23229. + rt2800_rfcsr_write(rt2x00dev, 42, 0x5B);
  23230. + rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
  23231. +
  23232. -+ struct hw_mode_spec *spec = &rt2x00dev->spec;
  23233. + rt2800_rfcsr_write(rt2x00dev, 11, 0x21);
  23234. + if (spec->clk_is_20mhz)
  23235. + rt2800_rfcsr_write(rt2x00dev, 13, 0x03);
  23236. @@ -1163,7 +1164,7 @@
  23237. static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
  23238. {
  23239. if (rt2800_is_305x_soc(rt2x00dev)) {
  23240. -@@ -7450,7 +8385,10 @@ static void rt2800_init_rfcsr(struct rt2
  23241. +@@ -7426,7 +8362,10 @@ static void rt2800_init_rfcsr(struct rt2
  23242. rt2800_init_rfcsr_5350(rt2x00dev);
  23243. break;
  23244. case RT5390:
  23245. @@ -1175,7 +1176,7 @@
  23246. break;
  23247. case RT5392:
  23248. rt2800_init_rfcsr_5392(rt2x00dev);
  23249. -@@ -7882,6 +8820,7 @@ static int rt2800_init_eeprom(struct rt2
  23250. +@@ -7858,6 +8797,7 @@ static int rt2800_init_eeprom(struct rt2
  23251. case RF5390:
  23252. case RF5392:
  23253. case RF5592:
  23254. @@ -1183,7 +1184,7 @@
  23255. break;
  23256. default:
  23257. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  23258. -@@ -8448,6 +9387,7 @@ static int rt2800_probe_hw_mode(struct r
  23259. +@@ -8422,6 +9362,7 @@ static int rt2800_probe_hw_mode(struct r
  23260. case RF5372:
  23261. case RF5390:
  23262. case RF5392:
  23263. @@ -1191,7 +1192,7 @@
  23264. spec->num_channels = 14;
  23265. if (spec->clk_is_20mhz)
  23266. spec->channels = rf_vals_xtal20mhz_3x;
  23267. -@@ -8588,6 +9528,7 @@ static int rt2800_probe_hw_mode(struct r
  23268. +@@ -8562,6 +9503,7 @@ static int rt2800_probe_hw_mode(struct r
  23269. case RF5372:
  23270. case RF5390:
  23271. case RF5392:
  23272. 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
  23273. deleted file mode 100644
  23274. index 4c04d4f..0000000
  23275. --- a/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch
  23276. +++ /dev/null
  23277. @@ -1,20 +0,0 @@
  23278. ---- a/drivers/net/wireless/ath/ath10k/core.c
  23279. -+++ b/drivers/net/wireless/ath/ath10k/core.c
  23280. -@@ -387,9 +387,14 @@ static int ath10k_download_and_run_otp(s
  23281. -
  23282. - ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
  23283. -
  23284. -- if (!skip_otp && result != 0) {
  23285. -- ath10k_err(ar, "otp calibration failed: %d", result);
  23286. -- return -EINVAL;
  23287. -+ if (!skip_otp) {
  23288. -+ if (result == 2) {
  23289. -+ ath10k_warn(ar, "otp stream is empty, using board.bin contents");
  23290. -+ return 0;
  23291. -+ } else if (result != 0) {
  23292. -+ ath10k_err(ar, "otp calibration failed: %d", result);
  23293. -+ return -EINVAL;
  23294. -+ }
  23295. - }
  23296. -
  23297. - return 0;
  23298. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  23299. index eed3814..93196e1 100644
  23300. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  23301. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  23302. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  23303. --- a/drivers/net/wireless/ath/ath10k/core.c
  23304. +++ b/drivers/net/wireless/ath/ath10k/core.c
  23305. -@@ -1323,6 +1323,16 @@ int ath10k_core_register(struct ath10k *
  23306. +@@ -1520,6 +1520,16 @@ int ath10k_core_register(struct ath10k *
  23307. ar->chip_id = chip_id;
  23308. queue_work(ar->workqueue, &ar->register_work);
  23309. 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
  23310. index 8003f86..34910a0 100644
  23311. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  23312. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  23313. @@ -1,6 +1,6 @@
  23314. --- a/drivers/net/wireless/ath/ath10k/mac.c
  23315. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  23316. -@@ -5416,6 +5416,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  23317. +@@ -6804,6 +6804,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  23318. return arvif_iter.arvif;
  23319. }
  23320. @@ -22,7 +22,7 @@
  23321. int ath10k_mac_register(struct ath10k *ar)
  23322. {
  23323. static const u32 cipher_suites[] = {
  23324. -@@ -5590,6 +5605,12 @@ int ath10k_mac_register(struct ath10k *a
  23325. +@@ -7025,6 +7040,12 @@ int ath10k_mac_register(struct ath10k *a
  23326. ar->hw->wiphy->cipher_suites = cipher_suites;
  23327. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  23328. diff --git a/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  23329. new file mode 100644
  23330. index 0000000..75d8212
  23331. --- /dev/null
  23332. +++ b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  23333. @@ -0,0 +1,20 @@
  23334. +--- a/drivers/net/wireless/mwl8k.c
  23335. ++++ b/drivers/net/wireless/mwl8k.c
  23336. +@@ -6261,6 +6261,8 @@ static int mwl8k_probe(struct pci_dev *p
  23337. +
  23338. + priv->running_bsses = 0;
  23339. +
  23340. ++ wait_for_completion(&priv->firmware_loading_complete);
  23341. ++
  23342. + return rc;
  23343. +
  23344. + err_stop_firmware:
  23345. +@@ -6294,8 +6296,6 @@ static void mwl8k_remove(struct pci_dev
  23346. + return;
  23347. + priv = hw->priv;
  23348. +
  23349. +- wait_for_completion(&priv->firmware_loading_complete);
  23350. +-
  23351. + if (priv->fw_state == FW_STATE_ERROR) {
  23352. + mwl8k_hw_reset(priv);
  23353. + goto unmap;
  23354. diff --git a/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch b/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch
  23355. deleted file mode 100644
  23356. index e94574d..0000000
  23357. --- a/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch
  23358. +++ /dev/null
  23359. @@ -1,12 +0,0 @@
  23360. ---- a/init.c
  23361. -+++ b/init.c
  23362. -@@ -16,6 +16,9 @@
  23363. - #include "eeprom.h"
  23364. - #include "mcu.h"
  23365. -
  23366. -+#define ieee80211_hw_set(hw, flag) \
  23367. -+ do { (hw)->flags |= IEEE80211_HW_##flag; } while(0)
  23368. -+
  23369. - static bool
  23370. - mt76_wait_for_mac(struct mt76_dev *dev)
  23371. - {