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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813
  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..f332cbd 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. @@ -79,7 +91,7 @@ endef
  63. define KernelPackage/mac80211
  64. $(call KernelPackage/mac80211/Default)
  65. TITLE:=Linux 802.11 Wireless Networking Stack
  66. - DEPENDS+= +kmod-crypto-core +kmod-crypto-arc4 +kmod-crypto-aes +kmod-cfg80211 +hostapd-common
  67. + DEPENDS+= +kmod-cfg80211 +hostapd-common
  68. KCONFIG:=\
  69. CONFIG_AVERAGE=y
  70. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  71. @@ -109,8 +121,8 @@ Generic IEEE 802.11 Networking Stack (mac80211)
  72. endef
  73. PKG_LINUX_FIRMWARE_NAME:=linux-firmware
  74. -PKG_LINUX_FIRMWARE_VERSION:=f404336ba808cbd57547196e13367079a23b822c
  75. -PKG_LINUX_FIRMWARE_SOURCE:=$(PKG_LINUX_FIRMWARE_NAME)-2015-03-20-$(PKG_LINUX_FIRMWARE_VERSION).tar.bz2
  76. +PKG_LINUX_FIRMWARE_VERSION:=6ebf5d57d9f6d0cf05558baef1af2b90a3fe98ed
  77. +PKG_LINUX_FIRMWARE_SOURCE:=$(PKG_LINUX_FIRMWARE_NAME)-2015-09-03-$(PKG_LINUX_FIRMWARE_VERSION).tar.xz
  78. PKG_LINUX_FIRMWARE_PROTO:=git
  79. PKG_LINUX_FIRMWARE_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  80. PKG_LINUX_FIRMWARE_SUBDIR:=$(PKG_LINUX_FIRMWARE_NAME)-$(PKG_LINUX_FIRMWARE_VERSION)
  81. @@ -127,723 +139,769 @@ define Download/linux-firmware
  82. endef
  83. $(eval $(call Download,linux-firmware))
  84. -PKG_ATH10K_LINUX_FIRMWARE_NAME:=ath10k-firmware
  85. -PKG_ATH10K_LINUX_FIRMWARE_VERSION:=da0f85d924226ee30c46e037120621c9e192b39e
  86. -PKG_ATH10K_LINUX_FIRMWARE_SOURCE:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION).tar.bz2
  87. -PKG_ATH10K_LINUX_FIRMWARE_PROTO:=git
  88. -PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  89. -PKG_ATH10K_LINUX_FIRMWARE_SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  90. -#PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM:=?
  91. -define Download/ath10k-firmware
  92. - FILE:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  93. - URL:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL)
  94. - PROTO:=$(PKG_ATH10K_LINUX_FIRMWARE_PROTO)
  95. - VERSION:=$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  96. - SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)
  97. - #MIRROR_MD5SUM:=$(PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM)
  98. +define KernelPackage/adm8211
  99. + $(call KernelPackage/mac80211/Default)
  100. + TITLE:=ADMTek 8211 support
  101. + DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  102. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/adm8211.ko
  103. + AUTOLOAD:=$(call AutoProbe,adm8211)
  104. endef
  105. -$(eval $(call Download,ath10k-firmware))
  106. -# Prism54 drivers
  107. -P54PCIFW:=2.13.12.0.arm
  108. -P54USBFW:=2.13.24.0.lm87.arm
  109. -P54SPIFW:=2.13.0.0.a.13.14.arm
  110. +define KernelPackage/ath/config
  111. + if PACKAGE_kmod-ath
  112. + config ATH_USER_REGD
  113. + bool "Force Atheros drivers to respect the user's regdomain settings"
  114. + help
  115. + Atheros' idea of regulatory handling is that the EEPROM of the card defines
  116. + the regulatory limits and the user is only allowed to restrict the settings
  117. + even further, even if the country allows frequencies or power levels that
  118. + are forbidden by the EEPROM settings.
  119. -define Download/p54usb
  120. - FILE:=$(P54USBFW)
  121. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  122. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  123. -endef
  124. -$(eval $(call Download,p54usb))
  125. + Select this option if you want the driver to respect the user's decision about
  126. + regulatory settings.
  127. -define Download/p54pci
  128. - FILE:=$(P54PCIFW)
  129. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  130. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  131. -endef
  132. -$(eval $(call Download,p54pci))
  133. + config PACKAGE_ATH_DEBUG
  134. + bool "Atheros wireless debugging"
  135. + help
  136. + Say Y, if you want to debug atheros wireless drivers.
  137. + Only ath9k & ath10k make use of this.
  138. -define Download/p54spi
  139. - FILE:=$(P54SPIFW)
  140. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  141. - MD5SUM:=42661f8ecbadd88012807493f596081d
  142. -endef
  143. -$(eval $(call Download,p54spi))
  144. + config PACKAGE_ATH_DFS
  145. + bool "Enable DFS support"
  146. + default y
  147. + help
  148. + Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  149. + channels in Europe, US, and Japan.
  150. -define KernelPackage/p54/Default
  151. - $(call KernelPackage/mac80211/Default)
  152. - TITLE:=Prism54 Drivers
  153. -endef
  154. + Select this option if you want to use such channels.
  155. -define KernelPackage/p54/description
  156. - Kernel module for Prism54 chipsets (mac80211)
  157. + endif
  158. endef
  159. -define KernelPackage/p54-common
  160. - $(call KernelPackage/p54/Default)
  161. - DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt
  162. - TITLE+= (COMMON)
  163. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54common.ko
  164. +define KernelPackage/ath
  165. + $(call KernelPackage/mac80211/Default)
  166. + TITLE:=Atheros common driver part
  167. + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  168. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  169. + MENU:=1
  170. endef
  171. -define KernelPackage/p54-pci
  172. - $(call KernelPackage/p54/Default)
  173. - TITLE+= (PCI)
  174. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  175. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54pci.ko
  176. - AUTOLOAD:=$(call AutoProbe,p54pci)
  177. +define KernelPackage/ath/description
  178. + This module contains some common parts needed by Atheros Wireless drivers.
  179. endef
  180. -define KernelPackage/p54-usb
  181. - $(call KernelPackage/p54/Default)
  182. - TITLE+= (USB)
  183. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  184. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54usb.ko
  185. - AUTOLOAD:=$(call AutoProbe,p54usb)
  186. +define KernelPackage/ath5k
  187. + $(call KernelPackage/mac80211/Default)
  188. + TITLE:=Atheros 5xxx wireless cards support
  189. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  190. + DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  191. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  192. + AUTOLOAD:=$(call AutoProbe,ath5k)
  193. endef
  194. -define KernelPackage/p54-spi
  195. - $(call KernelPackage/p54/Default)
  196. - TITLE+= (SPI)
  197. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  198. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54spi.ko
  199. - AUTOLOAD:=$(call AutoProbe,p54spi)
  200. +define KernelPackage/ath5k/description
  201. + This module adds support for wireless adapters based on
  202. + Atheros 5xxx chipset.
  203. endef
  204. -define KernelPackage/rt2x00/Default
  205. +define KernelPackage/ath9k-common
  206. $(call KernelPackage/mac80211/Default)
  207. - TITLE:=Ralink Drivers for RT2x00 cards
  208. + TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  209. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  210. + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  211. + FILES:= \
  212. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  213. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  214. endef
  215. -define KernelPackage/rt2x00-lib
  216. -$(call KernelPackage/rt2x00/Default)
  217. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t
  218. - TITLE+= (LIB)
  219. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00lib.ko
  220. - MENU:=1
  221. +define KernelPackage/ath9k
  222. + $(call KernelPackage/mac80211/Default)
  223. + TITLE:=Atheros 802.11n PCI wireless cards support
  224. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  225. + DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  226. + FILES:= \
  227. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  228. + AUTOLOAD:=$(call AutoProbe,ath9k)
  229. endef
  230. -define KernelPackage/rt2x00-lib/config
  231. - if PACKAGE_kmod-rt2x00-lib
  232. -
  233. - config PACKAGE_RT2X00_LIB_DEBUGFS
  234. - bool "Enable rt2x00 debugfs support"
  235. - depends on PACKAGE_MAC80211_DEBUGFS
  236. - help
  237. - Enable creation of debugfs files for the rt2x00 drivers.
  238. - These debugfs files support both reading and writing of the
  239. - most important register types of the rt2x00 hardware.
  240. -
  241. - config PACKAGE_RT2X00_DEBUG
  242. - bool "Enable rt2x00 debug output"
  243. - help
  244. - Enable debugging output for all rt2x00 modules
  245. -
  246. - endif
  247. +define KernelPackage/ath9k/description
  248. +This module adds support for wireless adapters based on
  249. +Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  250. endef
  251. -define KernelPackage/rt2x00-mmio
  252. -$(call KernelPackage/rt2x00/Default)
  253. - DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
  254. - HIDDEN:=1
  255. - TITLE+= (MMIO)
  256. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00mmio.ko
  257. -endef
  258. +define KernelPackage/ath9k/config
  259. -define KernelPackage/rt2x00-pci
  260. -$(call KernelPackage/rt2x00/Default)
  261. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib
  262. - HIDDEN:=1
  263. - TITLE+= (PCI)
  264. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00pci.ko
  265. - AUTOLOAD:=$(call AutoProbe,rt2x00pci)
  266. -endef
  267. + config ATH9K_SUPPORT_PCOEM
  268. + bool "Support chips used in PC OEM cards"
  269. + depends on PACKAGE_kmod-ath9k
  270. -define KernelPackage/rt2x00-usb
  271. -$(call KernelPackage/rt2x00/Default)
  272. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
  273. - HIDDEN:=1
  274. - TITLE+= (USB)
  275. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00usb.ko
  276. - AUTOLOAD:=$(call AutoProbe,rt2x00usb)
  277. endef
  278. -define KernelPackage/rt2800-lib
  279. -$(call KernelPackage/rt2x00/Default)
  280. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
  281. - HIDDEN:=1
  282. - TITLE+= (rt2800 LIB)
  283. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800lib.ko
  284. +define KernelPackage/ath9k-htc
  285. + $(call KernelPackage/mac80211/Default)
  286. + TITLE:=Atheros 802.11n USB device support
  287. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  288. + DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core
  289. + FILES:= \
  290. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  291. + AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  292. endef
  293. -define KernelPackage/rt2400-pci
  294. -$(call KernelPackage/rt2x00/Default)
  295. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  296. - TITLE+= (RT2400 PCI)
  297. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2400pci.ko
  298. - AUTOLOAD:=$(call AutoProbe,rt2400pci)
  299. +define KernelPackage/ath9k-htc/description
  300. +This module adds support for wireless adapters based on
  301. +Atheros USB AR9271 and AR7010 family of chipsets.
  302. endef
  303. -define KernelPackage/rt2500-pci
  304. -$(call KernelPackage/rt2x00/Default)
  305. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  306. - TITLE+= (RT2500 PCI)
  307. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500pci.ko
  308. - AUTOLOAD:=$(call AutoProbe,rt2500pci)
  309. +define KernelPackage/ath10k
  310. + $(call KernelPackage/mac80211/Default)
  311. + TITLE:=Atheros 802.11ac wireless cards support
  312. + URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  313. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT
  314. + FILES:= \
  315. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  316. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  317. + AUTOLOAD:=$(call AutoLoad,55,ath10k_core ath10k_pci)
  318. endef
  319. -define KernelPackage/rt2500-usb
  320. -$(call KernelPackage/rt2x00/Default)
  321. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  322. - TITLE+= (RT2500 USB)
  323. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500usb.ko
  324. - AUTOLOAD:=$(call AutoProbe,rt2500usb)
  325. +define KernelPackage/ath10k/description
  326. +This module adds support for wireless adapters based on
  327. +Atheros IEEE 802.11ac family of chipsets. For now only
  328. +PCI is supported.
  329. endef
  330. -define KernelPackage/rt61-pci
  331. -$(call KernelPackage/rt2x00/Default)
  332. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  333. - TITLE+= (RT2x61 PCI)
  334. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt61pci.ko
  335. - AUTOLOAD:=$(call AutoProbe,rt61pci)
  336. -endef
  337. +PKG_ATH10K_LINUX_FIRMWARE_NAME:=ath10k-firmware
  338. +PKG_ATH10K_LINUX_FIRMWARE_VERSION:=b46f3e01a6c1f9150fb4612ef53611d714565842
  339. +PKG_ATH10K_LINUX_FIRMWARE_SOURCE:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION).tar.bz2
  340. +PKG_ATH10K_LINUX_FIRMWARE_PROTO:=git
  341. +PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  342. +PKG_ATH10K_LINUX_FIRMWARE_SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  343. +#PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM:=?
  344. -define KernelPackage/rt73-usb
  345. - $(call KernelPackage/rt2x00/Default)
  346. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  347. - TITLE+= (RT73 USB)
  348. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt73usb.ko
  349. - AUTOLOAD:=$(call AutoProbe,rt73usb)
  350. +define Download/ath10k-firmware
  351. + FILE:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  352. + URL:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL)
  353. + PROTO:=$(PKG_ATH10K_LINUX_FIRMWARE_PROTO)
  354. + VERSION:=$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  355. + SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)
  356. + #MIRROR_MD5SUM:=$(PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM)
  357. endef
  358. +$(eval $(call Download,ath10k-firmware))
  359. -define KernelPackage/rt2800-mmio
  360. -$(call KernelPackage/rt2x00/Default)
  361. - TITLE += (RT28xx/RT3xxx MMIO)
  362. - DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
  363. - HIDDEN:=1
  364. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800mmio.ko
  365. -endef
  366. -define KernelPackage/rt2800-soc
  367. -$(call KernelPackage/rt2x00/Default)
  368. - DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
  369. - TITLE += (RT28xx/RT3xxx SoC)
  370. - FILES := \
  371. - $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko \
  372. - $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800soc.ko
  373. - AUTOLOAD:=$(call AutoProbe,rt2800soc)
  374. -endef
  375. +#Broadcom firmware
  376. +ifneq ($(CONFIG_B43_FW_6_30),)
  377. + PKG_B43_FWV4_NAME:=broadcom-wl
  378. + PKG_B43_FWV4_VERSION:=6.30.163.46
  379. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o
  380. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  381. + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  382. + PKG_B43_FWV4_MD5SUM:=6fe97e9368d25342a1ab943d3cf3496d
  383. +else
  384. +ifneq ($(CONFIG_B43_FW_5_10),)
  385. + PKG_B43_FWV4_NAME:=broadcom-wl
  386. + PKG_B43_FWV4_VERSION:=5.10.56.27.3
  387. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o
  388. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2
  389. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  390. + PKG_B43_FWV4_MD5SUM:=3363e3a6b3d9d73c49dea870c7834eac
  391. +else
  392. +ifneq ($(CONFIG_B43_FW_4_178),)
  393. + PKG_B43_FWV4_NAME:=broadcom-wl
  394. + PKG_B43_FWV4_VERSION:=4.178.10.4
  395. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  396. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  397. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  398. + PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
  399. +else
  400. +ifneq ($(CONFIG_B43_FW_5_100_138),)
  401. + PKG_B43_FWV4_NAME:=broadcom-wl
  402. + PKG_B43_FWV4_VERSION:=5.100.138
  403. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  404. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  405. + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  406. + PKG_B43_FWV4_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  407. +else
  408. + PKG_B43_FWV4_NAME:=broadcom-wl
  409. + PKG_B43_FWV4_VERSION:=4.150.10.5
  410. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
  411. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  412. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  413. + PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
  414. +endif
  415. +endif
  416. +endif
  417. +endif
  418. +ifneq ($(CONFIG_B43_OPENFIRMWARE),)
  419. + PKG_B43_FWV4_NAME:=broadcom-wl
  420. + PKG_B43_FWV4_VERSION:=5.2
  421. + PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
  422. + PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
  423. + PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
  424. + PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
  425. +endif
  426. -define KernelPackage/rt2800-pci
  427. -$(call KernelPackage/rt2x00/Default)
  428. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio
  429. - TITLE+= (RT2860 PCI)
  430. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.ko
  431. - AUTOLOAD:=$(call AutoProbe,rt2800pci)
  432. +
  433. +PKG_B43_FWV3_NAME:=wl_apsta
  434. +PKG_B43_FWV3_VERSION:=3.130.20.0
  435. +PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o
  436. +PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/
  437. +PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
  438. +
  439. +define Download/b43
  440. + FILE:=$(PKG_B43_FWV4_SOURCE)
  441. + URL:=$(PKG_B43_FWV4_SOURCE_URL)
  442. + MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
  443. endef
  444. +$(eval $(call Download,b43))
  445. -define KernelPackage/rt2800-usb
  446. -$(call KernelPackage/rt2x00/Default)
  447. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt
  448. - TITLE+= (RT2870 USB)
  449. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800usb.ko
  450. - AUTOLOAD:=$(call AutoProbe,rt2800usb)
  451. +define Download/b43legacy
  452. + FILE:=$(PKG_B43_FWV3_SOURCE)
  453. + URL:=$(PKG_B43_FWV3_SOURCE_URL)
  454. + MD5SUM:=$(PKG_B43_FWV3_MD5SUM)
  455. endef
  456. +$(eval $(call Download,b43legacy))
  457. -define KernelPackage/rtl818x/Default
  458. +
  459. +define KernelPackage/b43
  460. $(call KernelPackage/mac80211/Default)
  461. - TITLE:=Realtek Drivers for RTL818x devices
  462. - URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
  463. - DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
  464. + TITLE:=Broadcom 43xx wireless support
  465. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  466. + KCONFIG:= \
  467. + CONFIG_HW_RANDOM=y
  468. + # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb
  469. + DEPENDS += \
  470. + @PCI_SUPPORT +kmod-mac80211 \
  471. + $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \
  472. + $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma)
  473. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43/b43.ko
  474. + AUTOLOAD:=$(call AutoProbe,b43)
  475. + MENU:=1
  476. endef
  477. -define KernelPackage/rtl8180
  478. - $(call KernelPackage/rtl818x/Default)
  479. - DEPENDS+= @PCI_SUPPORT
  480. - TITLE+= (RTL8180 PCI)
  481. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8180/rtl818x_pci.ko
  482. - AUTOLOAD:=$(call AutoProbe,rtl818x_pci)
  483. -endef
  484. +define KernelPackage/b43/config
  485. -define KernelPackage/rtl8187
  486. -$(call KernelPackage/rtl818x/Default)
  487. - DEPENDS+= @USB_SUPPORT +kmod-usb-core
  488. - TITLE+= (RTL8187 USB)
  489. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
  490. - AUTOLOAD:=$(call AutoProbe,rtl8187)
  491. -endef
  492. +config PACKAGE_B43_USE_SSB
  493. + select PACKAGE_kmod-ssb
  494. + tristate
  495. + depends on !TARGET_brcm47xx && !TARGET_brcm63xx
  496. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  497. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB
  498. -define KernelPackage/rtlwifi/config
  499. - config PACKAGE_RTLWIFI_DEBUG
  500. - bool "Realtek wireless debugging"
  501. - depends on PACKAGE_kmod-rtlwifi
  502. +config PACKAGE_B43_USE_BCMA
  503. + select PACKAGE_kmod-bcma
  504. + tristate
  505. + depends on !TARGET_brcm47xx && !TARGET_bcm53xx
  506. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  507. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA
  508. +
  509. + if PACKAGE_kmod-b43
  510. +
  511. + choice
  512. + prompt "b43 firmware version"
  513. + default B43_FW_5_100_138
  514. help
  515. - Say Y, if you want to debug realtek wireless drivers.
  516. + This option allows you to select the version of the b43 firmware.
  517. -endef
  518. + config B43_FW_4_150
  519. + bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)"
  520. + help
  521. + Old stable firmware for BCM43xx devices.
  522. -define KernelPackage/rtlwifi
  523. - $(call KernelPackage/mac80211/Default)
  524. - TITLE:=Realtek common driver part
  525. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT
  526. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtlwifi.ko
  527. - HIDDEN:=1
  528. -endef
  529. + If unsure, select this.
  530. -define KernelPackage/rtlwifi-pci
  531. - $(call KernelPackage/mac80211/Default)
  532. - TITLE:=Realtek common driver part (PCI support)
  533. - DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi
  534. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_pci.ko
  535. - AUTOLOAD:=$(call AutoProbe,rtl_pci)
  536. - HIDDEN:=1
  537. -endef
  538. + config B43_FW_4_178
  539. + bool "Firmware 478.104 from driver 4.178.10.4"
  540. + help
  541. + Older firmware for BCM43xx devices.
  542. -define KernelPackage/rtlwifi-usb
  543. - $(call KernelPackage/mac80211/Default)
  544. - TITLE:=Realtek common driver part (USB support)
  545. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi
  546. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_usb.ko
  547. - AUTOLOAD:=$(call AutoProbe,rtl_usb)
  548. - HIDDEN:=1
  549. -endef
  550. + If unsure, select the "stable" firmware.
  551. -define KernelPackage/rtl8192c-common
  552. - $(call KernelPackage/mac80211/Default)
  553. - TITLE:=Realtek RTL8192CE/RTL8192CU common support module
  554. - DEPENDS+= +kmod-rtlwifi
  555. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
  556. - HIDDEN:=1
  557. -endef
  558. + config B43_FW_5_10
  559. + bool "Firmware 508.1084 from driver 5.10.56.27"
  560. + help
  561. + Older firmware for BCM43xx devices.
  562. -define KernelPackage/rtl8192ce
  563. - $(call KernelPackage/mac80211/Default)
  564. - TITLE:=Realtek RTL8192CE/RTL8188CE support
  565. - DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common
  566. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko
  567. - AUTOLOAD:=$(call AutoProbe,rtl8192ce)
  568. -endef
  569. + If unsure, select the "stable" firmware.
  570. -define KernelPackage/rtl8192ce/install
  571. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  572. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfw.bin $(1)/lib/firmware/rtlwifi
  573. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU.bin $(1)/lib/firmware/rtlwifi
  574. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU_B.bin $(1)/lib/firmware/rtlwifi
  575. -endef
  576. + config B43_FW_5_100_138
  577. + bool "Firmware 666.2 from driver 5.100.138 (stable)"
  578. + help
  579. + The currently default firmware for BCM43xx devices.
  580. -define KernelPackage/rtl8192se
  581. - $(call KernelPackage/mac80211/Default)
  582. - TITLE:=Realtek RTL8192SE/RTL8191SE support
  583. - DEPENDS+= +kmod-rtlwifi-pci
  584. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192se/rtl8192se.ko
  585. - AUTOLOAD:=$(call AutoProbe,rtl8192se)
  586. -endef
  587. + This firmware currently gets most of the testing and is needed for some N-PHY devices.
  588. -define KernelPackage/rtl8192se/install
  589. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  590. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  591. -endef
  592. + If unsure, select the this firmware.
  593. -define KernelPackage/rtl8192de
  594. - $(call KernelPackage/mac80211/Default)
  595. - TITLE:=Realtek RTL8192DE/RTL8188DE support
  596. - DEPENDS+= +kmod-rtlwifi-pci
  597. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192de/rtl8192de.ko
  598. - AUTOLOAD:=$(call AutoProbe,rtl8192de)
  599. -endef
  600. + config B43_FW_6_30
  601. + bool "Firmware 784.2 from driver 6.30.163.46 (experimental)"
  602. + help
  603. + Newer experimental firmware for BCM43xx devices.
  604. -define KernelPackage/rtl8192de/install
  605. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  606. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192defw.bin $(1)/lib/firmware/rtlwifi
  607. -endef
  608. + This firmware is mostly untested.
  609. -define KernelPackage/rtl8192cu
  610. - $(call KernelPackage/mac80211/Default)
  611. - TITLE:=Realtek RTL8192CU/RTL8188CU support
  612. - DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common
  613. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko
  614. - AUTOLOAD:=$(call AutoProbe,rtl8192cu)
  615. -endef
  616. + If unsure, select the "stable" firmware.
  617. -define KernelPackage/rtl8192cu/install
  618. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  619. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw.bin $(1)/lib/firmware/rtlwifi
  620. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_A.bin $(1)/lib/firmware/rtlwifi
  621. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_B.bin $(1)/lib/firmware/rtlwifi
  622. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_TMSC.bin $(1)/lib/firmware/rtlwifi
  623. -endef
  624. + config B43_OPENFIRMWARE
  625. + bool "Open FirmWare for WiFi networks"
  626. + help
  627. + Opensource firmware for BCM43xx devices.
  628. -ZD1211FW_NAME:=zd1211-firmware
  629. -ZD1211FW_VERSION:=1.4
  630. -define Download/zd1211rw
  631. - FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  632. - URL:=@SF/zd1211/
  633. - MD5SUM:=19f28781d76569af8551c9d11294c870
  634. -endef
  635. -$(eval $(call Download,zd1211rw))
  636. + Do _not_ select this, unless you know what you are doing.
  637. + The Opensource firmware is not suitable for embedded devices, yet.
  638. + It does not support QoS, which is bad for AccessPoints.
  639. + It does not support hardware crypto acceleration, which is a showstopper
  640. + for embedded devices with low CPU resources.
  641. -define KernelPackage/zd1211rw
  642. - $(call KernelPackage/mac80211/Default)
  643. - TITLE:=Zydas ZD1211 support
  644. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  645. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zd1211rw/zd1211rw.ko
  646. - AUTOLOAD:=$(call AutoProbe,zd1211rw)
  647. -endef
  648. + If unsure, select the "stable" firmware.
  649. -define KernelPackage/adm8211
  650. - $(call KernelPackage/mac80211/Default)
  651. - TITLE:=ADMTek 8211 support
  652. - DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  653. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/adm8211.ko
  654. - AUTOLOAD:=$(call AutoProbe,adm8211)
  655. -endef
  656. + endchoice
  657. +
  658. + config B43_FW_SQUASH
  659. + bool "Remove unnecessary firmware files"
  660. + depends on !B43_OPENFIRMWARE
  661. + default y
  662. + help
  663. + This options allows you to remove unnecessary b43 firmware files
  664. + from the final rootfs image. This can reduce the rootfs size by
  665. + up to 200k.
  666. +
  667. + If unsure, say Y.
  668. +
  669. + config B43_FW_SQUASH_COREREVS
  670. + string "Core revisions to include"
  671. + depends on B43_FW_SQUASH
  672. + default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy
  673. + default "16,28,29,30" if TARGET_brcm47xx_mips74k
  674. + default "5,6,7,8,9,10,11,13,15,16,28,29,30"
  675. + help
  676. + This is a comma seperated list of core revision numbers.
  677. +
  678. + Example (keep files for rev5 only):
  679. + 5
  680. +
  681. + Example (keep files for rev5 and rev11):
  682. + 5,11
  683. +
  684. + config B43_FW_SQUASH_PHYTYPES
  685. + string "PHY types to include"
  686. + depends on B43_FW_SQUASH
  687. + default "G,N,LP" if TARGET_brcm47xx_legacy
  688. + default "N,HT" if TARGET_brcm47xx_mips74k
  689. + default "G,N,LP,HT"
  690. + help
  691. + This is a comma seperated list of PHY types:
  692. + A => A-PHY
  693. + AG => Dual A-PHY G-PHY
  694. + G => G-PHY
  695. + LP => LP-PHY
  696. + N => N-PHY
  697. + HT => HT-PHY
  698. + LCN => LCN-PHY
  699. + LCN40 => LCN40-PHY
  700. + AC => AC-PHY
  701. +
  702. + Example (keep files for G-PHY only):
  703. + G
  704. +
  705. + Example (keep files for G-PHY and N-PHY):
  706. + G,N
  707. +
  708. + choice
  709. + prompt "Supported buses"
  710. + default PACKAGE_B43_BUSES_BCMA_AND_SSB
  711. + help
  712. + This allows choosing buses that b43 should support.
  713. +
  714. + config PACKAGE_B43_BUSES_BCMA_AND_SSB
  715. + depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  716. + bool "BCMA and SSB"
  717. +
  718. + config PACKAGE_B43_BUSES_BCMA
  719. + depends on !TARGET_brcm47xx_legacy
  720. + bool "BCMA only"
  721. +
  722. + config PACKAGE_B43_BUSES_SSB
  723. + depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  724. + bool "SSB only"
  725. +
  726. + endchoice
  727. +
  728. + config PACKAGE_B43_DEBUG
  729. + bool "Enable debug output and debugfs for b43"
  730. + default n
  731. + help
  732. + Enable additional debug output and runtime sanity checks for b43
  733. + and enables the debugfs interface.
  734. +
  735. + If unsure, say N.
  736. +
  737. + config PACKAGE_B43_PIO
  738. + bool "Enable support for PIO transfer mode"
  739. + default n
  740. + help
  741. + Enable support for using PIO instead of DMA. Unless you have DMA
  742. + transfer problems you don't need this.
  743. +
  744. + If unsure, say N.
  745. +
  746. + config PACKAGE_B43_PHY_G
  747. + bool "Enable support for G-PHYs"
  748. + default n if TARGET_brcm47xx_mips74k
  749. + default y
  750. + help
  751. + Enable support for G-PHY. This includes support for the following devices:
  752. + PCI: BCM4306, BCM4311, BCM4318
  753. + SoC: BCM5352E, BCM4712
  754. -define KernelPackage/ath/config
  755. - if PACKAGE_kmod-ath
  756. - config ATH_USER_REGD
  757. - bool "Force Atheros drivers to respect the user's regdomain settings"
  758. + If unsure, say Y.
  759. +
  760. + config PACKAGE_B43_PHY_N
  761. + bool "Enable support for N-PHYs"
  762. + default y
  763. help
  764. - Atheros' idea of regulatory handling is that the EEPROM of the card defines
  765. - the regulatory limits and the user is only allowed to restrict the settings
  766. - even further, even if the country allows frequencies or power levels that
  767. - are forbidden by the EEPROM settings.
  768. + Enable support for N-PHY. This includes support for the following devices:
  769. + PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225
  770. + SoC: BCM4716, BCM4717, BCM4718
  771. - Select this option if you want the driver to respect the user's decision about
  772. - regulatory settings.
  773. + Currently only 11g speed is available.
  774. - config PACKAGE_ATH_DEBUG
  775. - bool "Atheros wireless debugging"
  776. + If unsure, say Y.
  777. +
  778. + config PACKAGE_B43_PHY_LP
  779. + bool "Enable support for LP-PHYs"
  780. + default n if TARGET_brcm47xx_mips74k
  781. + default y
  782. help
  783. - Say Y, if you want to debug atheros wireless drivers.
  784. - Right now only ath9k makes use of this.
  785. + Enable support for LP-PHY. This includes support for the following devices:
  786. + PCI: BCM4312
  787. + SoC: BCM5354
  788. - config PACKAGE_ATH_DFS
  789. - bool "Enable DFS support"
  790. + If unsure, say Y.
  791. +
  792. + config PACKAGE_B43_PHY_HT
  793. + bool "Enable support for HT-PHYs"
  794. + default n if TARGET_brcm47xx_legacy
  795. default y
  796. help
  797. - Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  798. - channels in Europe, US, and Japan.
  799. + Enable support for HT-PHY. This includes support for the following devices:
  800. + PCI: BCM4331
  801. - Select this option if you want to use such channels.
  802. + Currently only 11g speed is available.
  803. - endif
  804. -endef
  805. + If unsure, say Y.
  806. -define KernelPackage/ath
  807. - $(call KernelPackage/mac80211/Default)
  808. - TITLE:=Atheros common driver part
  809. - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  810. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  811. - MENU:=1
  812. -endef
  813. + config PACKAGE_B43_PHY_LCN
  814. + bool "Enable support for LCN-PHYs"
  815. + depends on BROKEN
  816. + default n
  817. + help
  818. + Currently broken.
  819. -define KernelPackage/ath/description
  820. - This module contains some common parts needed by Atheros Wireless drivers.
  821. -endef
  822. + If unsure, say N.
  823. -define KernelPackage/ath5k
  824. - $(call KernelPackage/mac80211/Default)
  825. - TITLE:=Atheros 5xxx wireless cards support
  826. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  827. - DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  828. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  829. - AUTOLOAD:=$(call AutoProbe,ath5k)
  830. + endif
  831. endef
  832. -define KernelPackage/ath5k/description
  833. - This module adds support for wireless adapters based on
  834. - Atheros 5xxx chipset.
  835. +define KernelPackage/b43/description
  836. +Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
  837. endef
  838. -define KernelPackage/ath9k-common
  839. +define KernelPackage/b43legacy
  840. $(call KernelPackage/mac80211/Default)
  841. - TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  842. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  843. - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@KERNEL_RELAY
  844. - FILES:= \
  845. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  846. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  847. + TITLE:=Broadcom 43xx-legacy wireless support
  848. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  849. + KCONFIG:= \
  850. + CONFIG_HW_RANDOM=y
  851. + DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb
  852. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43legacy/b43legacy.ko
  853. + AUTOLOAD:=$(call AutoProbe,b43legacy)
  854. + MENU:=1
  855. endef
  856. -define KernelPackage/ath9k
  857. - $(call KernelPackage/mac80211/Default)
  858. - TITLE:=Atheros 802.11n PCI wireless cards support
  859. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  860. - DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  861. - FILES:= \
  862. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  863. - AUTOLOAD:=$(call AutoProbe,ath9k)
  864. -endef
  865. +define KernelPackage/b43legacy/config
  866. + if PACKAGE_kmod-b43legacy
  867. -define KernelPackage/ath9k/description
  868. -This module adds support for wireless adapters based on
  869. -Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  870. -endef
  871. + config B43LEGACY_FW_SQUASH
  872. + bool "Remove unnecessary firmware files"
  873. + default y
  874. + help
  875. + This options allows you to remove unnecessary b43legacy firmware files
  876. + from the final rootfs image. This can reduce the rootfs size by
  877. + up to 50k.
  878. -define KernelPackage/ath9k/config
  879. + If unsure, say Y.
  880. - config ATH9K_SUPPORT_PCOEM
  881. - bool "Support chips used in PC OEM cards"
  882. - depends on PACKAGE_kmod-ath9k
  883. -
  884. -endef
  885. + config B43LEGACY_FW_SQUASH_COREREVS
  886. + string "Core revisions to include"
  887. + depends on B43LEGACY_FW_SQUASH
  888. + default "1,2,3,4"
  889. + help
  890. + This is a comma seperated list of core revision numbers.
  891. -define KernelPackage/ath9k-htc
  892. - $(call KernelPackage/mac80211/Default)
  893. - TITLE:=Atheros 802.11n USB device support
  894. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  895. - DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core
  896. - FILES:= \
  897. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  898. - AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  899. + Example (keep files for rev4 only):
  900. + 4
  901. +
  902. + Example (keep files for rev2 and rev4):
  903. + 2,4
  904. +
  905. + endif
  906. endef
  907. -define KernelPackage/ath9k-htc/description
  908. -This module adds support for wireless adapters based on
  909. -Atheros USB AR9271 and AR7010 family of chipsets.
  910. +define KernelPackage/b43legacy/description
  911. +Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
  912. endef
  913. -define KernelPackage/ath10k
  914. +
  915. +define KernelPackage/brcmutil
  916. $(call KernelPackage/mac80211/Default)
  917. - TITLE:=Atheros 802.11ac wireless cards support
  918. - URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  919. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT
  920. - FILES:= \
  921. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  922. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  923. - AUTOLOAD:=$(call AutoLoad,55,ath10k_core ath10k_pci)
  924. + TITLE:=Broadcom IEEE802.11n common driver parts
  925. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  926. + DEPENDS+=@PCI_SUPPORT||USB_SUPPORT
  927. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmutil/brcmutil.ko
  928. + AUTOLOAD:=$(call AutoProbe,brcmutil)
  929. + MENU:=1
  930. endef
  931. -define KernelPackage/ath10k/description
  932. -This module adds support for wireless adapters based on
  933. -Atheros IEEE 802.11ac family of chipsets. For now only
  934. -PCI is supported.
  935. +define KernelPackage/brcmutil/description
  936. + This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac.
  937. endef
  938. -define KernelPackage/ath10k/config
  939. - if PACKAGE_kmod-ath10k
  940. -
  941. - config ATH10K_STA_FW
  942. - bool "Firmware optimized for STA operation"
  943. - default n
  944. - help
  945. - Use the ath10k firmware optimized for wireless client instead
  946. - of access point operation.
  947. +define KernelPackage/brcmutil/config
  948. + if PACKAGE_kmod-brcmutil
  949. - config ATH10K_API2_FW
  950. - bool "Firmware optimized for AP operation (v10.1 / API v2)"
  951. - default n
  952. - depends on !ATH10K_STA_FW
  953. + config PACKAGE_BRCM80211_DEBUG
  954. + bool "Broadcom wireless driver debugging"
  955. help
  956. - Use the ath10k firmware from the 10.1 SDK using API v2 optimized
  957. - for access point operation if the default firmware keeps crashing.
  958. + Say Y, if you want to debug brcmsmac and brcmfmac wireless driver.
  959. endif
  960. endef
  961. -define KernelPackage/carl9170
  962. - $(call KernelPackage/mac80211/Default)
  963. - TITLE:=Driver for Atheros AR9170 USB sticks
  964. - DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT
  965. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
  966. - AUTOLOAD:=$(call AutoProbe,carl9170)
  967. +PKG_BRCMSMAC_FW_NAME:=broadcom-wl
  968. +PKG_BRCMSMAC_FW_VERSION:=5.100.138
  969. +PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o
  970. +PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2
  971. +PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  972. +PKG_BRCMSMAC_FW_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  973. +
  974. +define Download/brcmsmac
  975. + FILE:=$(PKG_BRCMSMAC_FW_SOURCE)
  976. + URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL)
  977. + MD5SUM:=$(PKG_BRCMSMAC_FW_MD5SUM)
  978. endef
  979. +$(eval $(call Download,brcmsmac))
  980. -define KernelPackage/lib80211
  981. +define KernelPackage/brcmsmac
  982. $(call KernelPackage/mac80211/Default)
  983. - TITLE:=802.11 Networking stack
  984. - DEPENDS:=+kmod-cfg80211
  985. - FILES:= \
  986. - $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  987. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  988. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  989. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  990. - AUTOLOAD:=$(call AutoProbe, \
  991. - lib80211 \
  992. - lib80211_crypt_wep \
  993. - lib80211_crypt_ccmp \
  994. - lib80211_crypt_tkip \
  995. - )
  996. + TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
  997. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  998. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil
  999. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmsmac/brcmsmac.ko
  1000. + AUTOLOAD:=$(call AutoProbe,brcmsmac)
  1001. + MENU:=1
  1002. endef
  1003. -define KernelPackage/lib80211/description
  1004. - Kernel modules for 802.11 Networking stack
  1005. - Includes:
  1006. - - lib80211
  1007. - - lib80211_crypt_wep
  1008. - - lib80211_crypt_tkip
  1009. - - lib80211_crytp_ccmp
  1010. +define KernelPackage/brcmsmac/description
  1011. + Kernel module for Broadcom IEEE802.11n PCIe Wireless cards
  1012. endef
  1013. -define KernelPackage/libertas-usb
  1014. - $(call KernelPackage/mac80211/Default)
  1015. - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT
  1016. - TITLE:=Marvell 88W8015 Wireless Driver
  1017. - FILES:= \
  1018. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1019. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/usb8xxx.ko
  1020. - AUTOLOAD:=$(call AutoProbe,libertas usb8xxx)
  1021. -endef
  1022. +define KernelPackage/brcmsmac/config
  1023. + if PACKAGE_kmod-brcmsmac
  1024. -define KernelPackage/libertas-sdio
  1025. - $(call KernelPackage/mac80211/Default)
  1026. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml
  1027. - TITLE:=Marvell 88W8686 Wireless Driver
  1028. - FILES:= \
  1029. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1030. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas_sdio.ko
  1031. - AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio)
  1032. + config BRCMSMAC_USE_FW_FROM_WL
  1033. + bool "Use firmware extracted from broadcom proprietary driver"
  1034. + default y
  1035. + help
  1036. + Instead of using the official brcmsmac firmware a firmware
  1037. + version 666.2 extracted from the proprietary Broadcom driver
  1038. + is used. This is needed to get core rev 17 used in bcm4716
  1039. + to work.
  1040. +
  1041. + If unsure, say Y.
  1042. +
  1043. + endif
  1044. endef
  1045. -define KernelPackage/mac80211-hwsim
  1046. - $(call KernelPackage/mac80211/Default)
  1047. - TITLE:=mac80211 HW simulation device
  1048. - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1049. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  1050. - AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  1051. -endef
  1052. -define KernelPackage/net-libipw
  1053. +define KernelPackage/brcmfmac
  1054. $(call KernelPackage/mac80211/Default)
  1055. - TITLE:=libipw for ipw2100 and ipw2200
  1056. - 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
  1057. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/libipw.ko
  1058. - AUTOLOAD:=$(call AutoProbe,libipw)
  1059. + TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
  1060. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  1061. + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_USB:kmod-usb-core
  1062. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko
  1063. + AUTOLOAD:=$(call AutoProbe,brcmfmac)
  1064. endef
  1065. -define KernelPackage/net-libipw/description
  1066. - Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
  1067. +define KernelPackage/brcmfmac/description
  1068. + Kernel module for Broadcom IEEE802.11n USB Wireless cards
  1069. endef
  1070. -IPW2100_NAME:=ipw2100-fw
  1071. -IPW2100_VERSION:=1.3
  1072. -
  1073. -define Download/net-ipw2100
  1074. - URL:=http://bughost.org/firmware/
  1075. - FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  1076. - MD5SUM=46aa75bcda1a00efa841f9707bbbd113
  1077. -endef
  1078. -$(eval $(call Download,net-ipw2100))
  1079. +define KernelPackage/brcmfmac/config
  1080. + if PACKAGE_kmod-brcmfmac
  1081. -define KernelPackage/net-ipw2100
  1082. - $(call KernelPackage/mac80211/Default)
  1083. - TITLE:=Intel IPW2100 driver
  1084. - DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
  1085. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2100.ko
  1086. - AUTOLOAD:=$(call AutoProbe,ipw2100)
  1087. -endef
  1088. + config BRCMFMAC_SDIO
  1089. + bool "Enable SDIO bus interface support"
  1090. + default n
  1091. + help
  1092. + Enable support for cards attached to an SDIO bus.
  1093. + Select this option only if you are sure that your
  1094. + board has a Broadcom wireless chip atacched to
  1095. + that bus.
  1096. -define KernelPackage/net-ipw2100/description
  1097. - Kernel support for Intel IPW2100
  1098. - Includes:
  1099. - - ipw2100
  1100. -endef
  1101. + config BRCMFMAC_USB
  1102. + bool "Enable USB bus interface support"
  1103. + depends on USB_SUPPORT
  1104. + default y
  1105. + help
  1106. + Supported USB connected chipsets:
  1107. + BCM43235, BCM43236, BCM43238 (all in revision 3 only)
  1108. + BCM43143, BCM43242, BCM43566, BCM43569
  1109. -IPW2200_NAME:=ipw2200-fw
  1110. -IPW2200_VERSION:=3.1
  1111. + config BRCMFMAC_PCIE
  1112. + bool "Enable PCIE bus interface support"
  1113. + depends on PCI_SUPPORT
  1114. + default y
  1115. + help
  1116. + Supported PCIe connected chipsets:
  1117. + BCM4354, BCM4356, BCM43567, BCM43570, BCM43602
  1118. -define Download/net-ipw2200
  1119. - URL:=http://bughost.org/firmware/
  1120. - FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  1121. - MD5SUM=eaba788643c7cc7483dd67ace70f6e99
  1122. + endif
  1123. endef
  1124. -$(eval $(call Download,net-ipw2200))
  1125. -define KernelPackage/net-ipw2200
  1126. - $(call KernelPackage/mac80211/Default)
  1127. - TITLE:=Intel IPW2200 driver
  1128. - DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
  1129. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2200.ko
  1130. - AUTOLOAD:=$(call AutoProbe,ipw2200)
  1131. -endef
  1132. -define KernelPackage/net-ipw2200/description
  1133. - Kernel support for Intel IPW2200
  1134. - Includes:
  1135. - - ipw2200
  1136. +define KernelPackage/carl9170
  1137. + $(call KernelPackage/mac80211/Default)
  1138. + TITLE:=Driver for Atheros AR9170 USB sticks
  1139. + DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT
  1140. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
  1141. + AUTOLOAD:=$(call AutoProbe,carl9170)
  1142. endef
  1143. -define KernelPackage/net-hermes
  1144. +define KernelPackage/hermes
  1145. $(call KernelPackage/mac80211/Default)
  1146. TITLE:=Hermes 802.11b chipset support
  1147. - DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT
  1148. + DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT +kmod-crypto-michael-mic
  1149. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco.ko
  1150. AUTOLOAD:=$(call AutoProbe,orinoco)
  1151. endef
  1152. -define KernelPackage/net-hermes/description
  1153. +define KernelPackage/hermes/description
  1154. Kernel support for Hermes 802.11b chipsets
  1155. endef
  1156. -define KernelPackage/net-hermes-pci
  1157. +define KernelPackage/hermes-pci
  1158. $(call KernelPackage/mac80211/Default)
  1159. TITLE:=Intersil Prism 2.5 PCI support
  1160. - DEPENDS:=@PCI_SUPPORT +kmod-net-hermes
  1161. + DEPENDS:=@PCI_SUPPORT +kmod-hermes
  1162. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_pci.ko
  1163. AUTOLOAD:=$(call AutoProbe,orinoco_pci)
  1164. endef
  1165. -define KernelPackage/net-hermes-pci/description
  1166. +define KernelPackage/hermes-pci/description
  1167. Kernel modules for Intersil Prism 2.5 PCI support
  1168. endef
  1169. -define KernelPackage/net-hermes-plx
  1170. +define KernelPackage/hermes-plx
  1171. $(call KernelPackage/mac80211/Default)
  1172. TITLE:=PLX9052 based PCI adaptor
  1173. - DEPENDS:=@PCI_SUPPORT +kmod-net-hermes
  1174. + DEPENDS:=@PCI_SUPPORT +kmod-hermes
  1175. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_plx.ko
  1176. AUTOLOAD:=$(call AutoProbe,orinoco_plx)
  1177. endef
  1178. -define KernelPackage/net-hermes-plx/description
  1179. +define KernelPackage/hermes-plx/description
  1180. Kernel modules for Hermes in PLX9052 based PCI adaptors
  1181. endef
  1182. -define KernelPackage/net-hermes-pcmcia
  1183. +define KernelPackage/hermes-pcmcia
  1184. $(call KernelPackage/mac80211/Default)
  1185. TITLE:=Hermes based PCMCIA adaptors
  1186. - DEPENDS:=@PCMCIA_SUPPORT +kmod-net-hermes @BROKEN
  1187. + DEPENDS:=@PCMCIA_SUPPORT +kmod-hermes @BROKEN
  1188. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_cs.ko
  1189. AUTOLOAD:=$(call AutoProbe,orinoco_cs)
  1190. endef
  1191. -define KernelPackage/net-hermes-pcmcia/description
  1192. +define KernelPackage/hermes-pcmcia/description
  1193. Kernel modules for Hermes based PCMCIA adaptors
  1194. endef
  1195. -define KernelPackage/iwlagn
  1196. +
  1197. +define KernelPackage/iwlwifi
  1198. $(call KernelPackage/mac80211/Default)
  1199. DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT
  1200. TITLE:=Intel AGN Wireless support
  1201. FILES:= \
  1202. $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/iwlwifi.ko \
  1203. - $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko
  1204. - AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm)
  1205. + $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko \
  1206. + $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/mvm/iwlmvm.ko
  1207. + AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm iwlmvm)
  1208. MENU:=1
  1209. endef
  1210. -define KernelPackage/iwlagn/description
  1211. - iwlagn kernel module for Intel 5000/5150/1000/6000/6050/6005/6030/100 support
  1212. -endef
  1213. +define KernelPackage/iwlwifi/description
  1214. + iwlwifi kernel module for
  1215. + Intel Wireless WiFi Link 6250AGN Adapter
  1216. + Intel 6000 Series Wi-Fi Adapters (6200AGN and 6300AGN)
  1217. + Intel WiFi Link 1000BGN
  1218. + Intel Wireless WiFi 5150AGN
  1219. + Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  1220. + Intel 6005 Series Wi-Fi Adapters
  1221. + Intel 6030 Series Wi-Fi Adapters
  1222. + Intel Wireless WiFi Link 6150BGN 2 Adapter
  1223. + Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN)
  1224. + Intel 2000 Series Wi-Fi Adapters
  1225. + Intel 7260 Wi-Fi Adapter
  1226. + Intel 3160 Wi-Fi Adapter
  1227. + Intel 7265 Wi-Fi Adapter
  1228. + Intel 8260 Wi-Fi Adapter
  1229. + Intel 3165 Wi-Fi Adapter
  1230. +endef
  1231. +
  1232. +define KernelPackage/iwlwifi/config
  1233. + if PACKAGE_kmod-iwlwifi
  1234. +
  1235. + config PACKAGE_IWLWIFI_DEBUG
  1236. + bool "Enable full debugging output in the iwlwifi driver"
  1237. + default n
  1238. + help
  1239. + This option will enable debug tracing output for the iwlwifi drivers
  1240. -define KernelPackage/iwlagn/config
  1241. - if PACKAGE_kmod-iwlagn
  1242. + This will result in the kernel module being ~100k larger. You can
  1243. + control which debug output is sent to the kernel log by setting the
  1244. + value in
  1245. - config IWL5000_FW
  1246. - bool "Intel 5000 Firmware"
  1247. - default y
  1248. + /sys/module/iwlwifi/parameters/debug
  1249. +
  1250. + This entry will only exist if this option is enabled.
  1251. +
  1252. + To set a value, simply echo an 8-byte hex value to the same file:
  1253. +
  1254. + % echo 0x43fff > /sys/module/iwlwifi/parameters/debug
  1255. +
  1256. + You can find the list of debug mask values in:
  1257. + drivers/net/wireless/iwlwifi/iwl-debug.h
  1258. +
  1259. + If this is your first time using this driver, you should say Y here
  1260. + as the debug information can assist others in helping you resolve
  1261. + any problems you may encounter.
  1262. +
  1263. + config PACKAGE_IWLWIFI_DEBUGFS
  1264. + bool "iwlwifi debugfs support"
  1265. + depends on PACKAGE_MAC80211_DEBUGFS
  1266. + default n
  1267. help
  1268. - Download and install firmware for:
  1269. - Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  1270. + Enable creation of debugfs files for the iwlwifi drivers. This
  1271. + is a low-impact option that allows getting insight into the
  1272. + driver's state at runtime.
  1273. - config IWL5150_FW
  1274. - bool "Intel 5150 Firmware"
  1275. + config IWL100_FW
  1276. + bool "Intel 100 Firmware"
  1277. default y
  1278. help
  1279. Download and install firmware for:
  1280. - Intel Wireless WiFi 5150AGN
  1281. + Intel Centrino Wireless-N 100
  1282. config IWL1000_FW
  1283. bool "Intel 1000 Firmware"
  1284. @@ -852,89 +910,104 @@ define KernelPackage/iwlagn/config
  1285. Download and install firmware for:
  1286. Intel Centrino Wireless-N 1000
  1287. - config IWL6000_FW
  1288. - bool "Intel 6000 Firmware"
  1289. + config IWL105_FW
  1290. + bool "Intel 105 Firmware"
  1291. default y
  1292. help
  1293. Download and install firmware for:
  1294. - Intel Centrino Ultimate-N 6300 and Advanced-N 6200
  1295. + Intel Centrino Wireless-N 105
  1296. - config IWL6050_FW
  1297. - bool "Intel 6050 Firmware"
  1298. + config IWL135_FW
  1299. + bool "Intel 135 Firmware"
  1300. default y
  1301. help
  1302. Download and install firmware for:
  1303. - Intel Centrino Advanced-N + WiMAX 6250 and Wireless-N + WiMAX 6150
  1304. + Intel Centrino Wireless-N 135
  1305. - config IWL6005_FW
  1306. - bool "Intel 6005 Firmware"
  1307. + config IWL2000_FW
  1308. + bool "Intel 2000 Firmware"
  1309. default y
  1310. help
  1311. Download and install firmware for:
  1312. - Intel Centrino Advanced-N 6205
  1313. + Intel Centrino Wireless-N 2200
  1314. - config IWL6030_FW
  1315. - bool "Intel 6030 Firmware"
  1316. + config IWL2030_FW
  1317. + bool "Intel 2030 Firmware"
  1318. default y
  1319. help
  1320. Download and install firmware for:
  1321. - Intel Centrino Advanced-N 6230, Wireless-N 1030, Wireless-N 130 and Advanced-N 6235
  1322. + Intel Centrino Wireless-N 2230
  1323. - config IWL7260_FW
  1324. - bool "Intel 7260 Firmware"
  1325. + config IWL3160_FW
  1326. + bool "Intel 3160 Firmware"
  1327. default y
  1328. help
  1329. Download and install firmware for:
  1330. - Intel Dual Band Wireless-N 7260 and Intel Dual Band Wireless-AC 7260
  1331. + Intel Wireless WiFi 3160
  1332. - config IWL7265_FW
  1333. - bool "Intel 7265 Firmware"
  1334. + config IWL5000_FW
  1335. + bool "Intel 5000 Firmware"
  1336. default y
  1337. help
  1338. Download and install firmware for:
  1339. - Intel Wireless 7265
  1340. + Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  1341. - config IWL100_FW
  1342. - bool "Intel 100 Firmware"
  1343. + config IWL5150_FW
  1344. + bool "Intel 5150 Firmware"
  1345. default y
  1346. help
  1347. Download and install firmware for:
  1348. - Intel Centrino Wireless-N 100
  1349. + Intel Wireless WiFi 5150AGN
  1350. - config IWL2000_FW
  1351. - bool "Intel 2000 Firmware"
  1352. + config IWL6000_FW
  1353. + bool "Intel 6000 Firmware"
  1354. default y
  1355. help
  1356. Download and install firmware for:
  1357. - Intel Centrino Wireless-N 2200
  1358. + Intel Centrino Ultimate-N 6300 and Advanced-N 6200
  1359. - config IWL2030_FW
  1360. - bool "Intel 2030 Firmware"
  1361. + config IWL6005_FW
  1362. + bool "Intel 6005 Firmware"
  1363. default y
  1364. help
  1365. Download and install firmware for:
  1366. - Intel Centrino Wireless-N 2230
  1367. + Intel Centrino Advanced-N 6205
  1368. - config IWL105_FW
  1369. - bool "Intel 105 Firmware"
  1370. + config IWL6030_FW
  1371. + bool "Intel 6030 Firmware"
  1372. default y
  1373. help
  1374. Download and install firmware for:
  1375. - Intel Centrino Wireless-N 105
  1376. + Intel Centrino Advanced-N 6230, Wireless-N 1030, Wireless-N 130 and Advanced-N 6235
  1377. - config IWL135_FW
  1378. - bool "Intel 135 Firmware"
  1379. + config IWL6050_FW
  1380. + bool "Intel 6050 Firmware"
  1381. default y
  1382. help
  1383. Download and install firmware for:
  1384. - Intel Centrino Wireless-N 135
  1385. + Intel Centrino Advanced-N + WiMAX 6250 and Wireless-N + WiMAX 6150
  1386. - config IWL3160_FW
  1387. - bool "Intel 3160 Firmware"
  1388. + config IWL7260_FW
  1389. + bool "Intel 7260 Firmware"
  1390. + default y
  1391. + help
  1392. + Download and install firmware for:
  1393. + Intel Dual Band Wireless-N 7260 and Intel Dual Band Wireless-AC 7260
  1394. +
  1395. + config IWL7265_FW
  1396. + bool "Intel 7265 Firmware"
  1397. + default y
  1398. + help
  1399. + Download and install firmware for:
  1400. + Intel Wireless 7265, 7265D, 3165
  1401. +
  1402. + config IWL8000_FW
  1403. + bool "Intel 8000 Series Firmware"
  1404. default y
  1405. help
  1406. Download and install firmware for:
  1407. - Intel Wireless 3160
  1408. + Intel Wireless Series 8260, 4165
  1409. +
  1410. endif
  1411. endef
  1412. @@ -953,578 +1026,587 @@ endef
  1413. define KernelPackage/iwl3945
  1414. $(call KernelPackage/mac80211/Default)
  1415. DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy
  1416. - TITLE:=Intel iwl3945 Wireless support
  1417. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl3945.ko
  1418. - AUTOLOAD:=$(call AutoProbe,iwl3945)
  1419. -endef
  1420. -
  1421. -define KernelPackage/iwl3945/description
  1422. - iwl3945 kernel module for Intel 3945 support
  1423. -endef
  1424. -
  1425. -define KernelPackage/iwl4965
  1426. - $(call KernelPackage/mac80211/Default)
  1427. - DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT
  1428. - TITLE:=Intel iwl4965 Wireless support
  1429. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl4965.ko
  1430. - AUTOLOAD:=$(call AutoProbe,iwl4965)
  1431. -endef
  1432. -
  1433. -define KernelPackage/iwl4965/description
  1434. - iwl4965 kernel module for Intel 4965 support
  1435. -endef
  1436. -
  1437. -
  1438. -define KernelPackage/mwl8k
  1439. - $(call KernelPackage/mac80211/Default)
  1440. - TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
  1441. - URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
  1442. - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1443. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mwl8k.ko
  1444. - AUTOLOAD:=$(call AutoProbe,mwl8k)
  1445. -endef
  1446. -
  1447. -define KernelPackage/mwl8k/description
  1448. - Kernel modules for Marvell TOPDOG 802.11 Wireless cards
  1449. -endef
  1450. -
  1451. -
  1452. -define KernelPackage/mwifiex-pcie
  1453. - $(call KernelPackage/mac80211/Default)
  1454. - TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
  1455. - URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
  1456. - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1457. - FILES:= \
  1458. - $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex.ko \
  1459. - $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex_pcie.ko
  1460. - AUTOLOAD:=$(call AutoProbe,mwifiex_pcie)
  1461. -endef
  1462. -
  1463. -define KernelPackage/mwifiex-pcie/description
  1464. - Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  1465. -endef
  1466. -
  1467. -
  1468. -define KernelPackage/wlcore
  1469. - $(call KernelPackage/mac80211/Default)
  1470. - TITLE:=TI common driver part
  1471. - DEPENDS+= @TARGET_omap +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1472. - FILES:= \
  1473. - $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
  1474. - $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
  1475. - AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
  1476. -endef
  1477. -
  1478. -define KernelPackage/wlcore/description
  1479. - This module contains some common parts needed by TI Wireless drivers.
  1480. -endef
  1481. -
  1482. -define KernelPackage/wl12xx
  1483. - $(call KernelPackage/mac80211/Default)
  1484. - TITLE:=Driver for TI WL12xx
  1485. - URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
  1486. - DEPENDS+= +kmod-wlcore
  1487. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
  1488. - AUTOLOAD:=$(call AutoProbe,wl12xx)
  1489. + TITLE:=Intel iwl3945 Wireless support
  1490. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl3945.ko
  1491. + AUTOLOAD:=$(call AutoProbe,iwl3945)
  1492. endef
  1493. -define KernelPackage/wl12xx/description
  1494. - Kernel modules for TI WL12xx
  1495. +define KernelPackage/iwl3945/description
  1496. + iwl3945 kernel module for Intel 3945 support
  1497. endef
  1498. -define KernelPackage/wl18xx
  1499. +define KernelPackage/iwl4965
  1500. $(call KernelPackage/mac80211/Default)
  1501. - TITLE:=Driver for TI WL18xx
  1502. - URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
  1503. - DEPENDS+= +kmod-wlcore
  1504. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
  1505. - AUTOLOAD:=$(call AutoProbe,wl18xx)
  1506. + DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT
  1507. + TITLE:=Intel iwl4965 Wireless support
  1508. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl4965.ko
  1509. + AUTOLOAD:=$(call AutoProbe,iwl4965)
  1510. endef
  1511. -define KernelPackage/wl18xx/description
  1512. - Kernel modules for TI WL18xx
  1513. +define KernelPackage/iwl4965/description
  1514. + iwl4965 kernel module for Intel 4965 support
  1515. endef
  1516. -#Broadcom firmware
  1517. -ifneq ($(CONFIG_B43_FW_6_30),)
  1518. - PKG_B43_FWV4_NAME:=broadcom-wl
  1519. - PKG_B43_FWV4_VERSION:=6.30.163.46
  1520. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o
  1521. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1522. - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  1523. - PKG_B43_FWV4_MD5SUM:=6fe97e9368d25342a1ab943d3cf3496d
  1524. -else
  1525. -ifneq ($(CONFIG_B43_FW_5_10),)
  1526. - PKG_B43_FWV4_NAME:=broadcom-wl
  1527. - PKG_B43_FWV4_VERSION:=5.10.56.27.3
  1528. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o
  1529. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2
  1530. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1531. - PKG_B43_FWV4_MD5SUM:=3363e3a6b3d9d73c49dea870c7834eac
  1532. -else
  1533. -ifneq ($(CONFIG_B43_FW_4_178),)
  1534. - PKG_B43_FWV4_NAME:=broadcom-wl
  1535. - PKG_B43_FWV4_VERSION:=4.178.10.4
  1536. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  1537. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1538. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1539. - PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
  1540. -else
  1541. -ifneq ($(CONFIG_B43_FW_5_100_138),)
  1542. - PKG_B43_FWV4_NAME:=broadcom-wl
  1543. - PKG_B43_FWV4_VERSION:=5.100.138
  1544. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  1545. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1546. - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  1547. - PKG_B43_FWV4_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  1548. -else
  1549. - PKG_B43_FWV4_NAME:=broadcom-wl
  1550. - PKG_B43_FWV4_VERSION:=4.150.10.5
  1551. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
  1552. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1553. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1554. - PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
  1555. -endif
  1556. -endif
  1557. -endif
  1558. -endif
  1559. -ifneq ($(CONFIG_B43_OPENFIRMWARE),)
  1560. - PKG_B43_FWV4_NAME:=broadcom-wl
  1561. - PKG_B43_FWV4_VERSION:=5.2
  1562. - PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
  1563. - PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
  1564. - PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
  1565. - PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
  1566. -endif
  1567. -
  1568. -
  1569. -PKG_B43_FWV3_NAME:=wl_apsta
  1570. -PKG_B43_FWV3_VERSION:=3.130.20.0
  1571. -PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o
  1572. -PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/
  1573. -PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
  1574. -
  1575. -define Download/b43
  1576. - FILE:=$(PKG_B43_FWV4_SOURCE)
  1577. - URL:=$(PKG_B43_FWV4_SOURCE_URL)
  1578. - MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
  1579. +define KernelPackage/lib80211
  1580. + $(call KernelPackage/mac80211/Default)
  1581. + TITLE:=802.11 Networking stack
  1582. + DEPENDS:=+kmod-cfg80211
  1583. + FILES:= \
  1584. + $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  1585. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  1586. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  1587. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  1588. + AUTOLOAD:=$(call AutoProbe, \
  1589. + lib80211 \
  1590. + lib80211_crypt_wep \
  1591. + lib80211_crypt_ccmp \
  1592. + lib80211_crypt_tkip \
  1593. + )
  1594. endef
  1595. -$(eval $(call Download,b43))
  1596. -define Download/b43legacy
  1597. - FILE:=$(PKG_B43_FWV3_SOURCE)
  1598. - URL:=$(PKG_B43_FWV3_SOURCE_URL)
  1599. - MD5SUM:=$(PKG_B43_FWV3_MD5SUM)
  1600. +define KernelPackage/lib80211/description
  1601. + Kernel modules for 802.11 Networking stack
  1602. + Includes:
  1603. + - lib80211
  1604. + - lib80211_crypt_wep
  1605. + - lib80211_crypt_tkip
  1606. + - lib80211_crytp_ccmp
  1607. endef
  1608. -$(eval $(call Download,b43legacy))
  1609. -define KernelPackage/b43
  1610. +define KernelPackage/libipw
  1611. $(call KernelPackage/mac80211/Default)
  1612. - TITLE:=Broadcom 43xx wireless support
  1613. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  1614. - KCONFIG:= \
  1615. - CONFIG_HW_RANDOM=y
  1616. - # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb
  1617. - DEPENDS += \
  1618. - @PCI_SUPPORT +kmod-mac80211 \
  1619. - $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \
  1620. - $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma)
  1621. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43/b43.ko
  1622. - AUTOLOAD:=$(call AutoProbe,b43)
  1623. - MENU:=1
  1624. + TITLE:=libipw for ipw2100 and ipw2200
  1625. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  1626. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/libipw.ko
  1627. + AUTOLOAD:=$(call AutoProbe,libipw)
  1628. endef
  1629. -define KernelPackage/b43/config
  1630. -
  1631. -config PACKAGE_B43_USE_SSB
  1632. - select PACKAGE_kmod-ssb
  1633. - tristate
  1634. - depends on !TARGET_brcm47xx && !TARGET_brcm63xx
  1635. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  1636. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB
  1637. +define KernelPackage/libipw/description
  1638. + Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
  1639. +endef
  1640. -config PACKAGE_B43_USE_BCMA
  1641. - select PACKAGE_kmod-bcma
  1642. - tristate
  1643. - depends on !TARGET_brcm47xx && !TARGET_bcm53xx
  1644. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  1645. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA
  1646. +IPW2100_NAME:=ipw2100-fw
  1647. +IPW2100_VERSION:=1.3
  1648. - if PACKAGE_kmod-b43
  1649. +define Download/ipw2100
  1650. + URL:=http://bughost.org/firmware/
  1651. + FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  1652. + MD5SUM=46aa75bcda1a00efa841f9707bbbd113
  1653. +endef
  1654. +$(eval $(call Download,ipw2100))
  1655. - choice
  1656. - prompt "b43 firmware version"
  1657. - default B43_FW_5_100_138
  1658. - help
  1659. - This option allows you to select the version of the b43 firmware.
  1660. +define KernelPackage/ipw2100
  1661. + $(call KernelPackage/mac80211/Default)
  1662. + TITLE:=Intel IPW2100 driver
  1663. + DEPENDS:=@PCI_SUPPORT +kmod-libipw
  1664. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2100.ko
  1665. + AUTOLOAD:=$(call AutoProbe,ipw2100)
  1666. +endef
  1667. - config B43_FW_4_150
  1668. - bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)"
  1669. - help
  1670. - Old stable firmware for BCM43xx devices.
  1671. +define KernelPackage/ipw2100/description
  1672. + Kernel support for Intel IPW2100
  1673. + Includes:
  1674. + - ipw2100
  1675. +endef
  1676. - If unsure, select this.
  1677. +IPW2200_NAME:=ipw2200-fw
  1678. +IPW2200_VERSION:=3.1
  1679. - config B43_FW_4_178
  1680. - bool "Firmware 478.104 from driver 4.178.10.4"
  1681. - help
  1682. - Older firmware for BCM43xx devices.
  1683. +define Download/ipw2200
  1684. + URL:=http://bughost.org/firmware/
  1685. + FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  1686. + MD5SUM=eaba788643c7cc7483dd67ace70f6e99
  1687. +endef
  1688. +$(eval $(call Download,ipw2200))
  1689. - If unsure, select the "stable" firmware.
  1690. +define KernelPackage/ipw2200
  1691. + $(call KernelPackage/mac80211/Default)
  1692. + TITLE:=Intel IPW2200 driver
  1693. + DEPENDS:=@PCI_SUPPORT +kmod-libipw
  1694. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2200.ko
  1695. + AUTOLOAD:=$(call AutoProbe,ipw2200)
  1696. +endef
  1697. - config B43_FW_5_10
  1698. - bool "Firmware 508.1084 from driver 5.10.56.27"
  1699. - help
  1700. - Older firmware for BCM43xx devices.
  1701. +define KernelPackage/ipw2200/description
  1702. + Kernel support for Intel IPW2200
  1703. + Includes:
  1704. + - ipw2200
  1705. +endef
  1706. - If unsure, select the "stable" firmware.
  1707. - config B43_FW_5_100_138
  1708. - bool "Firmware 666.2 from driver 5.100.138 (stable)"
  1709. - help
  1710. - The currently default firmware for BCM43xx devices.
  1711. +define KernelPackage/libertas-usb
  1712. + $(call KernelPackage/mac80211/Default)
  1713. + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT
  1714. + TITLE:=Marvell 88W8015 Wireless Driver
  1715. + FILES:= \
  1716. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1717. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/usb8xxx.ko
  1718. + AUTOLOAD:=$(call AutoProbe,libertas usb8xxx)
  1719. +endef
  1720. - This firmware currently gets most of the testing and is needed for some N-PHY devices.
  1721. +define KernelPackage/libertas-sdio
  1722. + $(call KernelPackage/mac80211/Default)
  1723. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml
  1724. + TITLE:=Marvell 88W8686 Wireless Driver
  1725. + FILES:= \
  1726. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1727. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas_sdio.ko
  1728. + AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio)
  1729. +endef
  1730. - If unsure, select the this firmware.
  1731. +define KernelPackage/mac80211-hwsim
  1732. + $(call KernelPackage/mac80211/Default)
  1733. + TITLE:=mac80211 HW simulation device
  1734. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1735. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  1736. + AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  1737. +endef
  1738. - config B43_FW_6_30
  1739. - bool "Firmware 784.2 from driver 6.30.163.46 (experimental)"
  1740. - help
  1741. - Newer experimental firmware for BCM43xx devices.
  1742. +PKG_MT7601U_FW_NAME:=DPO_MT7601U_LinuxSTA
  1743. +PKG_MT7601U_FW_VERSION:=3.0.0.4_20130913
  1744. +PKG_MT7601U_FW_MD5SUM:=5f440dccc8bc952745a191994fc34699
  1745. +PKG_MT7601U_FW_SOURCE:=$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION).tar.bz2
  1746. +PKG_MT7601U_FW_SOURCE_URL:=http://www.mediatek.com/AmazonS3/Downloads/linux/
  1747. +define Download/mt7601u-firmware
  1748. + FILE:=$(PKG_MT7601U_FW_SOURCE)
  1749. + URL:=$(PKG_MT7601U_FW_SOURCE_URL)
  1750. + MD5SUM:=$(PKG_MT7601U_FW_MD5SUM)
  1751. + SUBDIR:=$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION)
  1752. +endef
  1753. +$(eval $(call Download,mt7601u-firmware))
  1754. - This firmware is mostly untested.
  1755. +define KernelPackage/mt7601u
  1756. + $(call KernelPackage/mac80211/Default)
  1757. + TITLE:=MT7601U-based USB dongles Wireless Driver
  1758. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT @USB_SUPPORT +kmod-usb-core
  1759. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko
  1760. + AUTOLOAD:=$(call AutoProbe,mt7601)
  1761. +endef
  1762. - If unsure, select the "stable" firmware.
  1763. - config B43_OPENFIRMWARE
  1764. - bool "Open FirmWare for WiFi networks"
  1765. - help
  1766. - Opensource firmware for BCM43xx devices.
  1767. +define KernelPackage/mwl8k
  1768. + $(call KernelPackage/mac80211/Default)
  1769. + TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
  1770. + URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
  1771. + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1772. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mwl8k.ko
  1773. + AUTOLOAD:=$(call AutoProbe,mwl8k)
  1774. +endef
  1775. - Do _not_ select this, unless you know what you are doing.
  1776. - The Opensource firmware is not suitable for embedded devices, yet.
  1777. - It does not support QoS, which is bad for AccessPoints.
  1778. - It does not support hardware crypto acceleration, which is a showstopper
  1779. - for embedded devices with low CPU resources.
  1780. +define KernelPackage/mwl8k/description
  1781. + Kernel modules for Marvell TOPDOG 802.11 Wireless cards
  1782. +endef
  1783. - If unsure, select the "stable" firmware.
  1784. - endchoice
  1785. +define KernelPackage/mwifiex-pcie
  1786. + $(call KernelPackage/mac80211/Default)
  1787. + TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
  1788. + URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
  1789. + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1790. + FILES:= \
  1791. + $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex.ko \
  1792. + $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex_pcie.ko
  1793. + AUTOLOAD:=$(call AutoProbe,mwifiex_pcie)
  1794. +endef
  1795. - config B43_FW_SQUASH
  1796. - bool "Remove unnecessary firmware files"
  1797. - depends on !B43_OPENFIRMWARE
  1798. - default y
  1799. - help
  1800. - This options allows you to remove unnecessary b43 firmware files
  1801. - from the final rootfs image. This can reduce the rootfs size by
  1802. - up to 200k.
  1803. +define KernelPackage/mwifiex-pcie/description
  1804. + Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  1805. +endef
  1806. - If unsure, say Y.
  1807. - config B43_FW_SQUASH_COREREVS
  1808. - string "Core revisions to include"
  1809. - depends on B43_FW_SQUASH
  1810. - default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy
  1811. - default "16,28,29,30" if TARGET_brcm47xx_mips74k
  1812. - default "5,6,7,8,9,10,11,13,15,16,28,29,30"
  1813. - help
  1814. - This is a comma seperated list of core revision numbers.
  1815. +# Prism54 drivers
  1816. +P54PCIFW:=2.13.12.0.arm
  1817. +P54USBFW:=2.13.24.0.lm87.arm
  1818. +P54SPIFW:=2.13.0.0.a.13.14.arm
  1819. - Example (keep files for rev5 only):
  1820. - 5
  1821. +define Download/p54usb
  1822. + FILE:=$(P54USBFW)
  1823. + URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  1824. + MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  1825. +endef
  1826. +$(eval $(call Download,p54usb))
  1827. - Example (keep files for rev5 and rev11):
  1828. - 5,11
  1829. +define Download/p54pci
  1830. + FILE:=$(P54PCIFW)
  1831. + URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  1832. + MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  1833. +endef
  1834. +$(eval $(call Download,p54pci))
  1835. - config B43_FW_SQUASH_PHYTYPES
  1836. - string "PHY types to include"
  1837. - depends on B43_FW_SQUASH
  1838. - default "G,N,LP" if TARGET_brcm47xx_legacy
  1839. - default "N,HT" if TARGET_brcm47xx_mips74k
  1840. - default "G,N,LP,HT"
  1841. - help
  1842. - This is a comma seperated list of PHY types:
  1843. - A => A-PHY
  1844. - AG => Dual A-PHY G-PHY
  1845. - G => G-PHY
  1846. - LP => LP-PHY
  1847. - N => N-PHY
  1848. - HT => HT-PHY
  1849. - LCN => LCN-PHY
  1850. - LCN40 => LCN40-PHY
  1851. - AC => AC-PHY
  1852. +define Download/p54spi
  1853. + FILE:=$(P54SPIFW)
  1854. + URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  1855. + MD5SUM:=42661f8ecbadd88012807493f596081d
  1856. +endef
  1857. +$(eval $(call Download,p54spi))
  1858. - Example (keep files for G-PHY only):
  1859. - G
  1860. +define KernelPackage/p54/Default
  1861. + $(call KernelPackage/mac80211/Default)
  1862. + TITLE:=Prism54 Drivers
  1863. +endef
  1864. - Example (keep files for G-PHY and N-PHY):
  1865. - G,N
  1866. +define KernelPackage/p54/description
  1867. + Kernel module for Prism54 chipsets (mac80211)
  1868. +endef
  1869. - choice
  1870. - prompt "Supported buses"
  1871. - default PACKAGE_B43_BUSES_BCMA_AND_SSB
  1872. - help
  1873. - This allows choosing buses that b43 should support.
  1874. +define KernelPackage/p54-common
  1875. + $(call KernelPackage/p54/Default)
  1876. + DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt
  1877. + TITLE+= (COMMON)
  1878. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54common.ko
  1879. +endef
  1880. - config PACKAGE_B43_BUSES_BCMA_AND_SSB
  1881. - depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  1882. - bool "BCMA and SSB"
  1883. +define KernelPackage/p54-pci
  1884. + $(call KernelPackage/p54/Default)
  1885. + TITLE+= (PCI)
  1886. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  1887. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54pci.ko
  1888. + AUTOLOAD:=$(call AutoProbe,p54pci)
  1889. +endef
  1890. - config PACKAGE_B43_BUSES_BCMA
  1891. - depends on !TARGET_brcm47xx_legacy
  1892. - bool "BCMA only"
  1893. +define KernelPackage/p54-usb
  1894. + $(call KernelPackage/p54/Default)
  1895. + TITLE+= (USB)
  1896. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  1897. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54usb.ko
  1898. + AUTOLOAD:=$(call AutoProbe,p54usb)
  1899. +endef
  1900. - config PACKAGE_B43_BUSES_SSB
  1901. - depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  1902. - bool "SSB only"
  1903. +define KernelPackage/p54-spi
  1904. + $(call KernelPackage/p54/Default)
  1905. + TITLE+= (SPI)
  1906. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  1907. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54spi.ko
  1908. + AUTOLOAD:=$(call AutoProbe,p54spi)
  1909. +endef
  1910. - endchoice
  1911. +define KernelPackage/rt2x00/Default
  1912. + $(call KernelPackage/mac80211/Default)
  1913. + TITLE:=Ralink Drivers for RT2x00 cards
  1914. +endef
  1915. - config PACKAGE_B43_DEBUG
  1916. - bool "Enable debug output and debugfs for b43"
  1917. - default n
  1918. - help
  1919. - Enable additional debug output and runtime sanity checks for b43
  1920. - and enables the debugfs interface.
  1921. +define KernelPackage/rt2x00-lib
  1922. +$(call KernelPackage/rt2x00/Default)
  1923. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t
  1924. + TITLE+= (LIB)
  1925. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00lib.ko
  1926. + MENU:=1
  1927. +endef
  1928. - If unsure, say N.
  1929. +define KernelPackage/rt2x00-lib/config
  1930. + if PACKAGE_kmod-rt2x00-lib
  1931. - config PACKAGE_B43_PIO
  1932. - bool "Enable support for PIO transfer mode"
  1933. - default n
  1934. + config PACKAGE_RT2X00_LIB_DEBUGFS
  1935. + bool "Enable rt2x00 debugfs support"
  1936. + depends on PACKAGE_MAC80211_DEBUGFS
  1937. help
  1938. - Enable support for using PIO instead of DMA. Unless you have DMA
  1939. - transfer problems you don't need this.
  1940. -
  1941. - If unsure, say N.
  1942. + Enable creation of debugfs files for the rt2x00 drivers.
  1943. + These debugfs files support both reading and writing of the
  1944. + most important register types of the rt2x00 hardware.
  1945. - config PACKAGE_B43_PHY_G
  1946. - bool "Enable support for G-PHYs"
  1947. - default n if TARGET_brcm47xx_mips74k
  1948. - default y
  1949. + config PACKAGE_RT2X00_DEBUG
  1950. + bool "Enable rt2x00 debug output"
  1951. help
  1952. - Enable support for G-PHY. This includes support for the following devices:
  1953. - PCI: BCM4306, BCM4311, BCM4318
  1954. - SoC: BCM5352E, BCM4712
  1955. + Enable debugging output for all rt2x00 modules
  1956. - If unsure, say Y.
  1957. + endif
  1958. +endef
  1959. - config PACKAGE_B43_PHY_N
  1960. - bool "Enable support for N-PHYs"
  1961. - default y
  1962. - help
  1963. - Enable support for N-PHY. This includes support for the following devices:
  1964. - PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225
  1965. - SoC: BCM4716, BCM4717, BCM4718
  1966. +define KernelPackage/rt2x00-mmio
  1967. +$(call KernelPackage/rt2x00/Default)
  1968. + DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
  1969. + HIDDEN:=1
  1970. + TITLE+= (MMIO)
  1971. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00mmio.ko
  1972. +endef
  1973. - Currently only 11g speed is available.
  1974. +define KernelPackage/rt2x00-pci
  1975. +$(call KernelPackage/rt2x00/Default)
  1976. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib
  1977. + HIDDEN:=1
  1978. + TITLE+= (PCI)
  1979. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00pci.ko
  1980. + AUTOLOAD:=$(call AutoProbe,rt2x00pci)
  1981. +endef
  1982. - If unsure, say Y.
  1983. +define KernelPackage/rt2x00-usb
  1984. +$(call KernelPackage/rt2x00/Default)
  1985. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
  1986. + HIDDEN:=1
  1987. + TITLE+= (USB)
  1988. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00usb.ko
  1989. + AUTOLOAD:=$(call AutoProbe,rt2x00usb)
  1990. +endef
  1991. - config PACKAGE_B43_PHY_LP
  1992. - bool "Enable support for LP-PHYs"
  1993. - default n if TARGET_brcm47xx_mips74k
  1994. - default y
  1995. - help
  1996. - Enable support for LP-PHY. This includes support for the following devices:
  1997. - PCI: BCM4312
  1998. - SoC: BCM5354
  1999. +define KernelPackage/rt2800-lib
  2000. +$(call KernelPackage/rt2x00/Default)
  2001. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
  2002. + HIDDEN:=1
  2003. + TITLE+= (rt2800 LIB)
  2004. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800lib.ko
  2005. +endef
  2006. - If unsure, say Y.
  2007. +define KernelPackage/rt2400-pci
  2008. +$(call KernelPackage/rt2x00/Default)
  2009. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  2010. + TITLE+= (RT2400 PCI)
  2011. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2400pci.ko
  2012. + AUTOLOAD:=$(call AutoProbe,rt2400pci)
  2013. +endef
  2014. - config PACKAGE_B43_PHY_HT
  2015. - bool "Enable support for HT-PHYs"
  2016. - default n if TARGET_brcm47xx_legacy
  2017. - default y
  2018. - help
  2019. - Enable support for HT-PHY. This includes support for the following devices:
  2020. - PCI: BCM4331
  2021. +define KernelPackage/rt2500-pci
  2022. +$(call KernelPackage/rt2x00/Default)
  2023. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  2024. + TITLE+= (RT2500 PCI)
  2025. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500pci.ko
  2026. + AUTOLOAD:=$(call AutoProbe,rt2500pci)
  2027. +endef
  2028. +
  2029. +define KernelPackage/rt2500-usb
  2030. +$(call KernelPackage/rt2x00/Default)
  2031. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  2032. + TITLE+= (RT2500 USB)
  2033. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500usb.ko
  2034. + AUTOLOAD:=$(call AutoProbe,rt2500usb)
  2035. +endef
  2036. +
  2037. +define KernelPackage/rt2800-mmio
  2038. +$(call KernelPackage/rt2x00/Default)
  2039. + TITLE += (RT28xx/RT3xxx MMIO)
  2040. + DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
  2041. + HIDDEN:=1
  2042. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800mmio.ko
  2043. +endef
  2044. - Currently only 11g speed is available.
  2045. +define KernelPackage/rt2800-soc
  2046. +$(call KernelPackage/rt2x00/Default)
  2047. + DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
  2048. + TITLE += (RT28xx/RT3xxx SoC)
  2049. + FILES := \
  2050. + $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko \
  2051. + $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800soc.ko
  2052. + AUTOLOAD:=$(call AutoProbe,rt2800soc)
  2053. +endef
  2054. - If unsure, say Y.
  2055. +define KernelPackage/rt2800-pci
  2056. +$(call KernelPackage/rt2x00/Default)
  2057. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio
  2058. + TITLE+= (RT2860 PCI)
  2059. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.ko
  2060. + AUTOLOAD:=$(call AutoProbe,rt2800pci)
  2061. +endef
  2062. - config PACKAGE_B43_PHY_LCN
  2063. - bool "Enable support for LCN-PHYs"
  2064. - depends on BROKEN
  2065. - default n
  2066. - help
  2067. - Currently broken.
  2068. +define KernelPackage/rt2800-usb
  2069. +$(call KernelPackage/rt2x00/Default)
  2070. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt
  2071. + TITLE+= (RT2870 USB)
  2072. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800usb.ko
  2073. + AUTOLOAD:=$(call AutoProbe,rt2800usb)
  2074. +endef
  2075. - If unsure, say N.
  2076. - endif
  2077. +define KernelPackage/rt61-pci
  2078. +$(call KernelPackage/rt2x00/Default)
  2079. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  2080. + TITLE+= (RT2x61 PCI)
  2081. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt61pci.ko
  2082. + AUTOLOAD:=$(call AutoProbe,rt61pci)
  2083. endef
  2084. -define KernelPackage/b43/description
  2085. -Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
  2086. +define KernelPackage/rt73-usb
  2087. + $(call KernelPackage/rt2x00/Default)
  2088. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  2089. + TITLE+= (RT73 USB)
  2090. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt73usb.ko
  2091. + AUTOLOAD:=$(call AutoProbe,rt73usb)
  2092. endef
  2093. -define KernelPackage/b43legacy
  2094. +
  2095. +define KernelPackage/rtl818x/Default
  2096. $(call KernelPackage/mac80211/Default)
  2097. - TITLE:=Broadcom 43xx-legacy wireless support
  2098. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  2099. - KCONFIG:= \
  2100. - CONFIG_HW_RANDOM=y
  2101. - DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb
  2102. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43legacy/b43legacy.ko
  2103. - AUTOLOAD:=$(call AutoProbe,b43legacy)
  2104. - MENU:=1
  2105. + TITLE:=Realtek Drivers for RTL818x devices
  2106. + URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
  2107. + DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
  2108. endef
  2109. -define KernelPackage/b43legacy/config
  2110. - if PACKAGE_kmod-b43legacy
  2111. -
  2112. - config B43LEGACY_FW_SQUASH
  2113. - bool "Remove unnecessary firmware files"
  2114. - default y
  2115. - help
  2116. - This options allows you to remove unnecessary b43legacy firmware files
  2117. - from the final rootfs image. This can reduce the rootfs size by
  2118. - up to 50k.
  2119. +define KernelPackage/rtl8180
  2120. + $(call KernelPackage/rtl818x/Default)
  2121. + DEPENDS+= @PCI_SUPPORT
  2122. + TITLE+= (RTL8180 PCI)
  2123. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8180/rtl818x_pci.ko
  2124. + AUTOLOAD:=$(call AutoProbe,rtl818x_pci)
  2125. +endef
  2126. - If unsure, say Y.
  2127. +define KernelPackage/rtl8187
  2128. +$(call KernelPackage/rtl818x/Default)
  2129. + DEPENDS+= @USB_SUPPORT +kmod-usb-core
  2130. + TITLE+= (RTL8187 USB)
  2131. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
  2132. + AUTOLOAD:=$(call AutoProbe,rtl8187)
  2133. +endef
  2134. - config B43LEGACY_FW_SQUASH_COREREVS
  2135. - string "Core revisions to include"
  2136. - depends on B43LEGACY_FW_SQUASH
  2137. - default "1,2,3,4"
  2138. +define KernelPackage/rtlwifi/config
  2139. + config PACKAGE_RTLWIFI_DEBUG
  2140. + bool "Realtek wireless debugging"
  2141. + depends on PACKAGE_kmod-rtlwifi
  2142. help
  2143. - This is a comma seperated list of core revision numbers.
  2144. + Say Y, if you want to debug realtek wireless drivers.
  2145. - Example (keep files for rev4 only):
  2146. - 4
  2147. +endef
  2148. - Example (keep files for rev2 and rev4):
  2149. - 2,4
  2150. +define KernelPackage/rtlwifi
  2151. + $(call KernelPackage/mac80211/Default)
  2152. + TITLE:=Realtek common driver part
  2153. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2154. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtlwifi.ko
  2155. + HIDDEN:=1
  2156. +endef
  2157. - endif
  2158. +define KernelPackage/rtlwifi-pci
  2159. + $(call KernelPackage/mac80211/Default)
  2160. + TITLE:=Realtek common driver part (PCI support)
  2161. + DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi
  2162. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_pci.ko
  2163. + AUTOLOAD:=$(call AutoProbe,rtl_pci)
  2164. + HIDDEN:=1
  2165. endef
  2166. -define KernelPackage/b43legacy/description
  2167. -Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
  2168. +define KernelPackage/rtlwifi-usb
  2169. + $(call KernelPackage/mac80211/Default)
  2170. + TITLE:=Realtek common driver part (USB support)
  2171. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi
  2172. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_usb.ko
  2173. + AUTOLOAD:=$(call AutoProbe,rtl_usb)
  2174. + HIDDEN:=1
  2175. endef
  2176. +define KernelPackage/rtl8192c-common
  2177. + $(call KernelPackage/mac80211/Default)
  2178. + TITLE:=Realtek RTL8192CE/RTL8192CU common support module
  2179. + DEPENDS+= +kmod-rtlwifi
  2180. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
  2181. + HIDDEN:=1
  2182. +endef
  2183. -define KernelPackage/brcmutil
  2184. +define KernelPackage/rtl8192ce
  2185. $(call KernelPackage/mac80211/Default)
  2186. - TITLE:=Broadcom IEEE802.11n common driver parts
  2187. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2188. - DEPENDS+=@PCI_SUPPORT||USB_SUPPORT
  2189. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmutil/brcmutil.ko
  2190. - AUTOLOAD:=$(call AutoProbe,brcmutil)
  2191. - MENU:=1
  2192. + TITLE:=Realtek RTL8192CE/RTL8188CE support
  2193. + DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common
  2194. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko
  2195. + AUTOLOAD:=$(call AutoProbe,rtl8192ce)
  2196. endef
  2197. -define KernelPackage/brcmutil/description
  2198. - This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac.
  2199. +define KernelPackage/rtl8192ce/install
  2200. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2201. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfw.bin $(1)/lib/firmware/rtlwifi
  2202. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU.bin $(1)/lib/firmware/rtlwifi
  2203. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU_B.bin $(1)/lib/firmware/rtlwifi
  2204. endef
  2205. -define KernelPackage/brcmutil/config
  2206. - if PACKAGE_kmod-brcmutil
  2207. +define KernelPackage/rtl8192se
  2208. + $(call KernelPackage/mac80211/Default)
  2209. + TITLE:=Realtek RTL8192SE/RTL8191SE support
  2210. + DEPENDS+= +kmod-rtlwifi-pci
  2211. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192se/rtl8192se.ko
  2212. + AUTOLOAD:=$(call AutoProbe,rtl8192se)
  2213. +endef
  2214. - config PACKAGE_BRCM80211_DEBUG
  2215. - bool "Broadcom wireless driver debugging"
  2216. - help
  2217. - Say Y, if you want to debug brcmsmac and brcmfmac wireless driver.
  2218. +define KernelPackage/rtl8192se/install
  2219. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2220. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  2221. +endef
  2222. - endif
  2223. +define KernelPackage/rtl8192de
  2224. + $(call KernelPackage/mac80211/Default)
  2225. + TITLE:=Realtek RTL8192DE/RTL8188DE support
  2226. + DEPENDS+= +kmod-rtlwifi-pci
  2227. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192de/rtl8192de.ko
  2228. + AUTOLOAD:=$(call AutoProbe,rtl8192de)
  2229. endef
  2230. -PKG_BRCMSMAC_FW_NAME:=broadcom-wl
  2231. -PKG_BRCMSMAC_FW_VERSION:=5.100.138
  2232. -PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o
  2233. -PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2
  2234. -PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  2235. -PKG_BRCMSMAC_FW_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  2236. +define KernelPackage/rtl8192de/install
  2237. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2238. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192defw.bin $(1)/lib/firmware/rtlwifi
  2239. +endef
  2240. -define Download/brcmsmac
  2241. - FILE:=$(PKG_BRCMSMAC_FW_SOURCE)
  2242. - URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL)
  2243. - MD5SUM:=$(PKG_BRCMSMAC_FW_MD5SUM)
  2244. +define KernelPackage/rtl8192cu
  2245. + $(call KernelPackage/mac80211/Default)
  2246. + TITLE:=Realtek RTL8192CU/RTL8188CU support
  2247. + DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common
  2248. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko
  2249. + AUTOLOAD:=$(call AutoProbe,rtl8192cu)
  2250. endef
  2251. -$(eval $(call Download,brcmsmac))
  2252. -define KernelPackage/brcmsmac
  2253. +define KernelPackage/rtl8192cu/install
  2254. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2255. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw.bin $(1)/lib/firmware/rtlwifi
  2256. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_A.bin $(1)/lib/firmware/rtlwifi
  2257. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_B.bin $(1)/lib/firmware/rtlwifi
  2258. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_TMSC.bin $(1)/lib/firmware/rtlwifi
  2259. +endef
  2260. +
  2261. +
  2262. +define KernelPackage/wlcore
  2263. $(call KernelPackage/mac80211/Default)
  2264. - TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
  2265. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2266. - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil
  2267. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmsmac/brcmsmac.ko
  2268. - AUTOLOAD:=$(call AutoProbe,brcmsmac)
  2269. - MENU:=1
  2270. + TITLE:=TI common driver part
  2271. + DEPENDS+= @TARGET_omap +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2272. + FILES:= \
  2273. + $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
  2274. + $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
  2275. + AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
  2276. endef
  2277. -define KernelPackage/brcmsmac/description
  2278. - Kernel module for Broadcom IEEE802.11n PCIe Wireless cards
  2279. +define KernelPackage/wlcore/description
  2280. + This module contains some common parts needed by TI Wireless drivers.
  2281. endef
  2282. -define KernelPackage/brcmsmac/config
  2283. - if PACKAGE_kmod-brcmsmac
  2284. +define KernelPackage/wl12xx
  2285. + $(call KernelPackage/mac80211/Default)
  2286. + TITLE:=Driver for TI WL12xx
  2287. + URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
  2288. + DEPENDS+= +kmod-wlcore
  2289. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
  2290. + AUTOLOAD:=$(call AutoProbe,wl12xx)
  2291. +endef
  2292. - config BRCMSMAC_USE_FW_FROM_WL
  2293. - bool "Use firmware extracted from broadcom proprietary driver"
  2294. - default y
  2295. - help
  2296. - Instead of using the official brcmsmac firmware a firmware
  2297. - version 666.2 extracted from the proprietary Broadcom driver
  2298. - is used. This is needed to get core rev 17 used in bcm4716
  2299. - to work.
  2300. +define KernelPackage/wl12xx/description
  2301. + Kernel modules for TI WL12xx
  2302. +endef
  2303. - If unsure, say Y.
  2304. +define KernelPackage/wl18xx
  2305. + $(call KernelPackage/mac80211/Default)
  2306. + TITLE:=Driver for TI WL18xx
  2307. + URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
  2308. + DEPENDS+= +kmod-wlcore
  2309. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
  2310. + AUTOLOAD:=$(call AutoProbe,wl18xx)
  2311. +endef
  2312. - endif
  2313. +define KernelPackage/wl18xx/description
  2314. + Kernel modules for TI WL18xx
  2315. endef
  2316. -define KernelPackage/brcmfmac
  2317. - $(call KernelPackage/mac80211/Default)
  2318. - TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
  2319. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2320. - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_USB:kmod-usb-core
  2321. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko
  2322. - AUTOLOAD:=$(call AutoProbe,brcmfmac)
  2323. +ZD1211FW_NAME:=zd1211-firmware
  2324. +ZD1211FW_VERSION:=1.4
  2325. +define Download/zd1211rw
  2326. + FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  2327. + URL:=@SF/zd1211/
  2328. + MD5SUM:=19f28781d76569af8551c9d11294c870
  2329. endef
  2330. +$(eval $(call Download,zd1211rw))
  2331. -define KernelPackage/brcmfmac/description
  2332. - Kernel module for Broadcom IEEE802.11n USB Wireless cards
  2333. +define KernelPackage/zd1211rw
  2334. + $(call KernelPackage/mac80211/Default)
  2335. + TITLE:=Zydas ZD1211 support
  2336. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  2337. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zd1211rw/zd1211rw.ko
  2338. + AUTOLOAD:=$(call AutoProbe,zd1211rw)
  2339. endef
  2340. -define KernelPackage/brcmfmac/config
  2341. - if PACKAGE_kmod-brcmfmac
  2342. -
  2343. - config BRCMFMAC_SDIO
  2344. - bool "Enable SDIO bus interface support"
  2345. - default n
  2346. - help
  2347. - Enable support for cards attached to an SDIO bus.
  2348. - Select this option only if you are sure that your
  2349. - board has a Broadcom wireless chip atacched to
  2350. - that bus.
  2351. -
  2352. - config BRCMFMAC_USB
  2353. - bool "Enable USB bus interface support"
  2354. - depends on USB_SUPPORT
  2355. - default y
  2356. - help
  2357. - Supported USB connected chipsets:
  2358. - BCM43235, BCM43236, BCM43238 (all in revision 3 only)
  2359. - BCM43143, BCM43242, BCM43566, BCM43569
  2360. -
  2361. - config BRCMFMAC_PCIE
  2362. - bool "Enable PCIE bus interface support"
  2363. - depends on PCI_SUPPORT
  2364. - default y
  2365. - help
  2366. - Supported PCIe connected chipsets:
  2367. - BCM4354, BCM4356, BCM43567, BCM43570, BCM43602
  2368. - endif
  2369. -endef
  2370. config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m)
  2371. @@ -1602,6 +1684,8 @@ config-$(CONFIG_BRCMFMAC_PCIE) += BRCMFMAC_PCIE
  2372. config-$(CONFIG_PACKAGE_BRCM80211_DEBUG) += BRCMDBG
  2373. config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
  2374. +config-$(call config_package,mt7601u) += MT7601U
  2375. +config-y += WL_MEDIATEK
  2376. config-$(call config_package,rt2x00-lib) += RT2X00 RT2X00_LIB
  2377. config-$(call config_package,rt2x00-pci) += RT2X00_LIB_PCI
  2378. @@ -1623,26 +1707,28 @@ config-$(call config_package,rt2800-pci) += RT2800PCI
  2379. config-y += RT2800PCI_RT33XX RT2800PCI_RT35XX RT2800PCI_RT53XX RT2800PCI_RT3290
  2380. config-$(call config_package,rt2800-usb) += RT2800USB
  2381. -config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX
  2382. +config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX RT2800USB_UNKNOWN
  2383. config-$(call config_package,iwl-legacy) += IWLEGACY
  2384. config-$(call config_package,iwl3945) += IWL3945
  2385. config-$(call config_package,iwl4965) += IWL4965
  2386. -config-$(call config_package,iwlagn) += IWLWIFI IWLDVM
  2387. +config-$(call config_package,iwlwifi) += IWLWIFI IWLDVM IWLMVM
  2388. +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUG)+= IWLWIFI_DEBUG
  2389. +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUGFS)+= IWLWIFI_DEBUGFS
  2390. -config-$(call config_package,net-libipw) += LIBIPW
  2391. -config-$(call config_package,net-ipw2100) += IPW2100
  2392. -config-$(call config_package,net-ipw2200) += IPW2200
  2393. +config-$(call config_package,libipw) += LIBIPW
  2394. +config-$(call config_package,ipw2100) += IPW2100
  2395. +config-$(call config_package,ipw2200) += IPW2200
  2396. config-$(call config_package,p54-common) += P54_COMMON
  2397. config-$(call config_package,p54-pci) += P54_PCI
  2398. config-$(call config_package,p54-usb) += P54_USB
  2399. config-$(call config_package,p54-spi) += P54_SPI
  2400. -config-$(call config_package,net-hermes) += HERMES
  2401. -config-$(call config_package,net-hermes-pci) += PCI_HERMES
  2402. -config-$(call config_package,net-hermes-plx) += PLX_HERMES
  2403. -config-$(call config_package,net-hermes-pcmcia) += PCMCIA_HERMES
  2404. +config-$(call config_package,hermes) += HERMES
  2405. +config-$(call config_package,hermes-pci) += PCI_HERMES
  2406. +config-$(call config_package,hermes-plx) += PLX_HERMES
  2407. +config-$(call config_package,hermes-pcmcia) += PCMCIA_HERMES
  2408. config-y += HERMES_PRISM
  2409. config-$(call config_package,adm8211) += ADM8211
  2410. @@ -1702,8 +1788,9 @@ define Build/Prepare
  2411. $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  2412. $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  2413. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  2414. - $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_LINUX_FIRMWARE_SOURCE)
  2415. + $(TAR) -C $(PKG_BUILD_DIR) -xJf $(DL_DIR)/$(PKG_LINUX_FIRMWARE_SOURCE)
  2416. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  2417. + $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_MT7601U_FW_SOURCE)
  2418. rm -rf \
  2419. $(PKG_BUILD_DIR)/include/linux/ssb \
  2420. $(PKG_BUILD_DIR)/include/linux/bcma \
  2421. @@ -1739,233 +1826,37 @@ define Build/Compile
  2422. $(MAKE) $(MAKE_OPTS) allnoconfig
  2423. $(call Build/Compile/kmod)
  2424. endef
  2425. -
  2426. -define Build/InstallDev
  2427. - mkdir -p \
  2428. - $(1)/usr/include/mac80211 \
  2429. - $(1)/usr/include/mac80211-backport \
  2430. - $(1)/usr/include/mac80211/ath \
  2431. - $(1)/usr/include/net/mac80211
  2432. - $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
  2433. - $(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
  2434. - $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
  2435. - $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
  2436. - rm -f $(1)/usr/include/mac80211-backport/linux/module.h
  2437. -endef
  2438. -
  2439. -define KernelPackage/libertas-usb/install
  2440. - $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2441. - $(INSTALL_DATA) \
  2442. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8388_v9.bin \
  2443. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8682.bin \
  2444. - $(1)/lib/firmware/libertas/
  2445. -endef
  2446. -
  2447. -define KernelPackage/libertas-sdio/install
  2448. - $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2449. - $(INSTALL_DATA) \
  2450. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385_helper.bin \
  2451. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385.bin \
  2452. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9_helper.bin \
  2453. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9.bin \
  2454. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688_helper.bin \
  2455. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688.bin \
  2456. - $(1)/lib/firmware/libertas
  2457. -endef
  2458. -
  2459. -define KernelPackage/cfg80211/install
  2460. - $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  2461. - $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  2462. - $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  2463. -endef
  2464. -
  2465. -define KernelPackage/p54-pci/install
  2466. - $(INSTALL_DIR) $(1)/lib/firmware
  2467. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  2468. -endef
  2469. -
  2470. -define KernelPackage/p54-usb/install
  2471. - $(INSTALL_DIR) $(1)/lib/firmware
  2472. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  2473. -endef
  2474. -
  2475. -define KernelPackage/p54-spi/install
  2476. - $(INSTALL_DIR) $(1)/lib/firmware
  2477. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  2478. -endef
  2479. -
  2480. -define KernelPackage/rt61-pci/install
  2481. - $(INSTALL_DIR) $(1)/lib/firmware
  2482. - $(INSTALL_DATA) \
  2483. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561.bin \
  2484. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561s.bin \
  2485. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2661.bin \
  2486. - $(1)/lib/firmware/
  2487. -endef
  2488. -
  2489. -define KernelPackage/rt73-usb/install
  2490. - $(INSTALL_DIR) $(1)/lib/firmware
  2491. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt73.bin $(1)/lib/firmware/
  2492. -endef
  2493. -
  2494. -define KernelPackage/rt2800-pci/install
  2495. - $(INSTALL_DIR) $(1)/lib/firmware
  2496. - $(INSTALL_DATA) \
  2497. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2860.bin \
  2498. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt3290.bin \
  2499. - $(1)/lib/firmware
  2500. -endef
  2501. -
  2502. -define KernelPackage/rt2800-usb/install
  2503. - $(INSTALL_DIR) $(1)/lib/firmware
  2504. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2870.bin $(1)/lib/firmware/
  2505. -endef
  2506. -
  2507. -define KernelPackage/wl12xx/install
  2508. - $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2509. - $(INSTALL_DATA) \
  2510. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-mr.bin \
  2511. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-plt.bin \
  2512. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-sr.bin \
  2513. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl1271-nvs.bin \
  2514. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-mr.bin \
  2515. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-plt.bin \
  2516. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-sr.bin \
  2517. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-nvs.bin \
  2518. - $(1)/lib/firmware/ti-connectivity
  2519. -endef
  2520. -
  2521. -define KernelPackage/wl18xx/install
  2522. - $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2523. - $(INSTALL_DATA) \
  2524. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-conf.bin \
  2525. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-fw-3.bin \
  2526. - $(1)/lib/firmware/ti-connectivity
  2527. -endef
  2528. -
  2529. -define KernelPackage/zd1211rw/install
  2530. - $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  2531. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  2532. -endef
  2533. -
  2534. -define KernelPackage/carl9170/install
  2535. - $(INSTALL_DIR) $(1)/lib/firmware
  2536. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/carl9170-1.fw $(1)/lib/firmware
  2537. -endef
  2538. -
  2539. -define KernelPackage/ath9k-htc/install
  2540. - $(INSTALL_DIR) $(1)/lib/firmware
  2541. - $(INSTALL_DATA) \
  2542. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
  2543. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
  2544. - $(1)/lib/firmware/
  2545. -endef
  2546. -
  2547. -define KernelPackage/ath10k/install
  2548. - $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  2549. - $(INSTALL_DATA) \
  2550. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/ath10k/QCA988X/hw2.0/board.bin \
  2551. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  2552. -ifeq ($(CONFIG_ATH10K_STA_FW),y)
  2553. - $(INSTALL_DATA) \
  2554. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/main/firmware-2.bin_999.999.0.636 \
  2555. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  2556. -else ifeq ($(CONFIG_ATH10K_API2_FW),y)
  2557. - $(INSTALL_DATA) \
  2558. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.1/firmware-2.bin_10.1.467.2-1 \
  2559. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  2560. -else
  2561. - $(INSTALL_DATA) \
  2562. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/firmware-4.bin_10.2.4.45 \
  2563. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-4.bin
  2564. -endif
  2565. -endef
  2566. -
  2567. -define KernelPackage/mwl8k/install
  2568. - $(INSTALL_DIR) $(1)/lib/firmware/mwl8k
  2569. - $(INSTALL_DATA) \
  2570. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366_ap-3.fw \
  2571. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366.fw \
  2572. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8366.fw \
  2573. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8687.fw \
  2574. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8687.fw \
  2575. - $(1)/lib/firmware/mwl8k/
  2576. -endef
  2577. -
  2578. -define KernelPackage/mwifiex-pcie/install
  2579. - $(INSTALL_DIR) $(1)/lib/firmware/mrvl
  2580. - $(INSTALL_DATA) \
  2581. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mrvl/pcie8897_uapsta.bin \
  2582. - $(1)/lib/firmware/mrvl/
  2583. -endef
  2584. -
  2585. -define KernelPackage/net-ipw2100/install
  2586. - $(INSTALL_DIR) $(1)/lib/firmware
  2587. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
  2588. -endef
  2589. -
  2590. -define KernelPackage/net-ipw2200/install
  2591. - $(INSTALL_DIR) $(1)/lib/firmware
  2592. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  2593. -endef
  2594. -
  2595. -define KernelPackage/iwlagn/install
  2596. - $(INSTALL_DIR) $(1)/lib/firmware
  2597. -ifneq ($(CONFIG_IWL5000_FW),)
  2598. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5000-5.ucode $(1)/lib/firmware
  2599. -endif
  2600. -ifneq ($(CONFIG_IWL5150_FW),)
  2601. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5150-2.ucode $(1)/lib/firmware
  2602. -endif
  2603. -ifneq ($(CONFIG_IWL1000_FW),)
  2604. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-1000-5.ucode $(1)/lib/firmware
  2605. -endif
  2606. -ifneq ($(CONFIG_IWL6000_FW),)
  2607. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000-4.ucode $(1)/lib/firmware
  2608. -endif
  2609. -ifneq ($(CONFIG_IWL6050_FW),)
  2610. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6050-5.ucode $(1)/lib/firmware
  2611. -endif
  2612. -ifneq ($(CONFIG_IWL6005_FW),)
  2613. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2a-6.ucode $(1)/lib/firmware
  2614. -endif
  2615. -ifneq ($(CONFIG_IWL6030_FW),)
  2616. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2b-6.ucode $(1)/lib/firmware
  2617. -endif
  2618. -ifneq ($(CONFIG_IWL7260_FW),)
  2619. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7260-9.ucode $(1)/lib/firmware
  2620. -endif
  2621. -ifneq ($(CONFIG_IWL7265_FW),)
  2622. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265-9.ucode $(1)/lib/firmware
  2623. -endif
  2624. -ifneq ($(CONFIG_IWL100_FW),)
  2625. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-100-5.ucode $(1)/lib/firmware
  2626. -endif
  2627. -ifneq ($(CONFIG_IWL2000_FW),)
  2628. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2000-6.ucode $(1)/lib/firmware
  2629. -endif
  2630. -ifneq ($(CONFIG_IWL2030_FW),)
  2631. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2030-6.ucode $(1)/lib/firmware
  2632. -endif
  2633. -ifneq ($(CONFIG_IWL105_FW),)
  2634. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-105-6.ucode $(1)/lib/firmware
  2635. -endif
  2636. -ifneq ($(CONFIG_IWL135_FW),)
  2637. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-135-6.ucode $(1)/lib/firmware
  2638. -endif
  2639. -ifneq ($(CONFIG_IWL3160_FW),)
  2640. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3160-9.ucode $(1)/lib/firmware
  2641. -endif
  2642. +
  2643. +define Build/InstallDev
  2644. + mkdir -p \
  2645. + $(1)/usr/include/mac80211 \
  2646. + $(1)/usr/include/mac80211-backport \
  2647. + $(1)/usr/include/mac80211/ath \
  2648. + $(1)/usr/include/net/mac80211
  2649. + $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
  2650. + $(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
  2651. + $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
  2652. + $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
  2653. + rm -f $(1)/usr/include/mac80211-backport/linux/module.h
  2654. endef
  2655. -define KernelPackage/iwl3945/install
  2656. +
  2657. +define KernelPackage/ath9k-htc/install
  2658. $(INSTALL_DIR) $(1)/lib/firmware
  2659. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3945-2.ucode $(1)/lib/firmware
  2660. + $(INSTALL_DATA) \
  2661. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
  2662. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
  2663. + $(1)/lib/firmware/
  2664. endef
  2665. -define KernelPackage/iwl4965/install
  2666. - $(INSTALL_DIR) $(1)/lib/firmware
  2667. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware
  2668. +define KernelPackage/ath10k/install
  2669. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  2670. + $(INSTALL_DATA) \
  2671. + $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/ath10k/QCA988X/hw2.0/board.bin \
  2672. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  2673. + $(INSTALL_DATA) \
  2674. + $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/untested/firmware-5.bin_10.2.4.70-2 \
  2675. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  2676. endef
  2677. define KernelPackage/b43/install
  2678. @@ -2028,13 +1919,237 @@ ifneq ($(CONFIG_BRCMFMAC_PCIE),)
  2679. endif
  2680. endef
  2681. +define KernelPackage/carl9170/install
  2682. + $(INSTALL_DIR) $(1)/lib/firmware
  2683. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/carl9170-1.fw $(1)/lib/firmware
  2684. +endef
  2685. +
  2686. +define KernelPackage/cfg80211/install
  2687. + $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  2688. + $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  2689. + $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  2690. +endef
  2691. +
  2692. +define KernelPackage/ipw2100/install
  2693. + $(INSTALL_DIR) $(1)/lib/firmware
  2694. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
  2695. +endef
  2696. +
  2697. +define KernelPackage/ipw2200/install
  2698. + $(INSTALL_DIR) $(1)/lib/firmware
  2699. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  2700. +endef
  2701. +
  2702. +define KernelPackage/iwlwifi/install
  2703. + $(INSTALL_DIR) $(1)/lib/firmware
  2704. +ifneq ($(CONFIG_IWL100_FW),)
  2705. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-100-5.ucode $(1)/lib/firmware
  2706. +endif
  2707. +ifneq ($(CONFIG_IWL1000_FW),)
  2708. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-1000-5.ucode $(1)/lib/firmware
  2709. +endif
  2710. +ifneq ($(CONFIG_IWL105_FW),)
  2711. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-105-6.ucode $(1)/lib/firmware
  2712. +endif
  2713. +ifneq ($(CONFIG_IWL135_FW),)
  2714. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-135-6.ucode $(1)/lib/firmware
  2715. +endif
  2716. +ifneq ($(CONFIG_IWL2000_FW),)
  2717. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2000-6.ucode $(1)/lib/firmware
  2718. +endif
  2719. +ifneq ($(CONFIG_IWL2030_FW),)
  2720. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2030-6.ucode $(1)/lib/firmware
  2721. +endif
  2722. +ifneq ($(CONFIG_IWL3160_FW),)
  2723. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3160-13.ucode $(1)/lib/firmware
  2724. +endif
  2725. +ifneq ($(CONFIG_IWL5000_FW),)
  2726. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5000-5.ucode $(1)/lib/firmware
  2727. +endif
  2728. +ifneq ($(CONFIG_IWL5150_FW),)
  2729. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5150-2.ucode $(1)/lib/firmware
  2730. +endif
  2731. +ifneq ($(CONFIG_IWL6000_FW),)
  2732. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000-4.ucode $(1)/lib/firmware
  2733. +endif
  2734. +ifneq ($(CONFIG_IWL6005_FW),)
  2735. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2a-6.ucode $(1)/lib/firmware
  2736. +endif
  2737. +ifneq ($(CONFIG_IWL6030_FW),)
  2738. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2b-6.ucode $(1)/lib/firmware
  2739. +endif
  2740. +ifneq ($(CONFIG_IWL6050_FW),)
  2741. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6050-5.ucode $(1)/lib/firmware
  2742. +endif
  2743. +ifneq ($(CONFIG_IWL7260_FW),)
  2744. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7260-13.ucode $(1)/lib/firmware
  2745. +endif
  2746. +ifneq ($(CONFIG_IWL7265_FW),)
  2747. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265-13.ucode $(1)/lib/firmware
  2748. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265D-13.ucode $(1)/lib/firmware
  2749. +endif
  2750. +ifneq ($(CONFIG_IWL8000_FW),)
  2751. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-8000C-13.ucode $(1)/lib/firmware
  2752. +endif
  2753. +endef
  2754. +
  2755. +define KernelPackage/iwl3945/install
  2756. + $(INSTALL_DIR) $(1)/lib/firmware
  2757. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3945-2.ucode $(1)/lib/firmware
  2758. +endef
  2759. +
  2760. +define KernelPackage/iwl4965/install
  2761. + $(INSTALL_DIR) $(1)/lib/firmware
  2762. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware
  2763. +endef
  2764. +
  2765. +define KernelPackage/libertas-usb/install
  2766. + $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2767. + $(INSTALL_DATA) \
  2768. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8388_v9.bin \
  2769. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8682.bin \
  2770. + $(1)/lib/firmware/libertas/
  2771. +endef
  2772. +
  2773. +define KernelPackage/libertas-sdio/install
  2774. + $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2775. + $(INSTALL_DATA) \
  2776. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385_helper.bin \
  2777. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385.bin \
  2778. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9_helper.bin \
  2779. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9.bin \
  2780. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688_helper.bin \
  2781. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688.bin \
  2782. + $(1)/lib/firmware/libertas
  2783. +endef
  2784. +
  2785. +define KernelPackage/mt7601u/install
  2786. + $(INSTALL_DIR) $(1)/lib/firmware
  2787. + $(INSTALL_DATA) \
  2788. + $(PKG_BUILD_DIR)/$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION)/mcu/bin/MT7601.bin \
  2789. + $(1)/lib/firmware/mt7601u.bin
  2790. +endef
  2791. +
  2792. +define KernelPackage/mwl8k/install
  2793. + $(INSTALL_DIR) $(1)/lib/firmware/mwl8k
  2794. + $(INSTALL_DATA) \
  2795. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366_ap-3.fw \
  2796. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366.fw \
  2797. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8366.fw \
  2798. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8687.fw \
  2799. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8687.fw \
  2800. + $(1)/lib/firmware/mwl8k/
  2801. +endef
  2802. +
  2803. +define KernelPackage/mwifiex-pcie/install
  2804. + $(INSTALL_DIR) $(1)/lib/firmware/mrvl
  2805. + $(INSTALL_DATA) \
  2806. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mrvl/pcie8897_uapsta.bin \
  2807. + $(1)/lib/firmware/mrvl/
  2808. +endef
  2809. +
  2810. +define KernelPackage/p54-pci/install
  2811. + $(INSTALL_DIR) $(1)/lib/firmware
  2812. + $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  2813. +endef
  2814. +
  2815. +define KernelPackage/p54-usb/install
  2816. + $(INSTALL_DIR) $(1)/lib/firmware
  2817. + $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  2818. +endef
  2819. +
  2820. +define KernelPackage/p54-spi/install
  2821. + $(INSTALL_DIR) $(1)/lib/firmware
  2822. + $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  2823. +endef
  2824. +
  2825. +define KernelPackage/rt2800-pci/install
  2826. + $(INSTALL_DIR) $(1)/lib/firmware
  2827. + $(INSTALL_DATA) \
  2828. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2860.bin \
  2829. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt3290.bin \
  2830. + $(1)/lib/firmware
  2831. +endef
  2832. +
  2833. +define KernelPackage/rt2800-usb/install
  2834. + $(INSTALL_DIR) $(1)/lib/firmware
  2835. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2870.bin $(1)/lib/firmware/
  2836. +endef
  2837. +
  2838. +define KernelPackage/rt61-pci/install
  2839. + $(INSTALL_DIR) $(1)/lib/firmware
  2840. + $(INSTALL_DATA) \
  2841. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561.bin \
  2842. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561s.bin \
  2843. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2661.bin \
  2844. + $(1)/lib/firmware/
  2845. +endef
  2846. +
  2847. +define KernelPackage/rt73-usb/install
  2848. + $(INSTALL_DIR) $(1)/lib/firmware
  2849. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt73.bin $(1)/lib/firmware/
  2850. +endef
  2851. +
  2852. +define KernelPackage/wl12xx/install
  2853. + $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2854. + $(INSTALL_DATA) \
  2855. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-mr.bin \
  2856. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-plt.bin \
  2857. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-sr.bin \
  2858. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl1271-nvs.bin \
  2859. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-mr.bin \
  2860. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-plt.bin \
  2861. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-sr.bin \
  2862. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-nvs.bin \
  2863. + $(1)/lib/firmware/ti-connectivity
  2864. +endef
  2865. +
  2866. +define KernelPackage/wl18xx/install
  2867. + $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2868. + $(INSTALL_DATA) \
  2869. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-fw-4.bin \
  2870. + $(1)/lib/firmware/ti-connectivity
  2871. +endef
  2872. +
  2873. +define KernelPackage/zd1211rw/install
  2874. + $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  2875. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  2876. +endef
  2877. +
  2878. +
  2879. $(eval $(call KernelPackage,adm8211))
  2880. +$(eval $(call KernelPackage,ath))
  2881. +$(eval $(call KernelPackage,ath10k))
  2882. $(eval $(call KernelPackage,ath5k))
  2883. +$(eval $(call KernelPackage,ath9k))
  2884. +$(eval $(call KernelPackage,ath9k-common))
  2885. +$(eval $(call KernelPackage,ath9k-htc))
  2886. +$(eval $(call KernelPackage,b43))
  2887. +$(eval $(call KernelPackage,b43legacy))
  2888. +$(eval $(call KernelPackage,brcmsmac))
  2889. +$(eval $(call KernelPackage,brcmfmac))
  2890. +$(eval $(call KernelPackage,brcmutil))
  2891. +$(eval $(call KernelPackage,carl9170))
  2892. +$(eval $(call KernelPackage,cfg80211))
  2893. +$(eval $(call KernelPackage,hermes))
  2894. +$(eval $(call KernelPackage,hermes-pci))
  2895. +$(eval $(call KernelPackage,hermes-plx))
  2896. +$(eval $(call KernelPackage,hermes-pcmcia))
  2897. +$(eval $(call KernelPackage,iwlwifi))
  2898. +$(eval $(call KernelPackage,iwl-legacy))
  2899. +$(eval $(call KernelPackage,iwl4965))
  2900. +$(eval $(call KernelPackage,iwl3945))
  2901. $(eval $(call KernelPackage,lib80211))
  2902. $(eval $(call KernelPackage,libertas-usb))
  2903. $(eval $(call KernelPackage,libertas-sdio))
  2904. -$(eval $(call KernelPackage,cfg80211))
  2905. +$(eval $(call KernelPackage,libipw))
  2906. +$(eval $(call KernelPackage,ipw2100))
  2907. +$(eval $(call KernelPackage,ipw2200))
  2908. $(eval $(call KernelPackage,mac80211))
  2909. +$(eval $(call KernelPackage,mac80211-hwsim))
  2910. +$(eval $(call KernelPackage,mt7601u))
  2911. +$(eval $(call KernelPackage,mwl8k))
  2912. +$(eval $(call KernelPackage,mwifiex-pcie))
  2913. $(eval $(call KernelPackage,p54-common))
  2914. $(eval $(call KernelPackage,p54-pci))
  2915. $(eval $(call KernelPackage,p54-usb))
  2916. @@ -2047,12 +2162,12 @@ $(eval $(call KernelPackage,rt2800-lib))
  2917. $(eval $(call KernelPackage,rt2400-pci))
  2918. $(eval $(call KernelPackage,rt2500-pci))
  2919. $(eval $(call KernelPackage,rt2500-usb))
  2920. -$(eval $(call KernelPackage,rt61-pci))
  2921. -$(eval $(call KernelPackage,rt73-usb))
  2922. $(eval $(call KernelPackage,rt2800-mmio))
  2923. $(eval $(call KernelPackage,rt2800-soc))
  2924. $(eval $(call KernelPackage,rt2800-pci))
  2925. $(eval $(call KernelPackage,rt2800-usb))
  2926. +$(eval $(call KernelPackage,rt61-pci))
  2927. +$(eval $(call KernelPackage,rt73-usb))
  2928. $(eval $(call KernelPackage,rtl8180))
  2929. $(eval $(call KernelPackage,rtl8187))
  2930. $(eval $(call KernelPackage,rtlwifi))
  2931. @@ -2063,32 +2178,7 @@ $(eval $(call KernelPackage,rtl8192ce))
  2932. $(eval $(call KernelPackage,rtl8192se))
  2933. $(eval $(call KernelPackage,rtl8192de))
  2934. $(eval $(call KernelPackage,rtl8192cu))
  2935. -$(eval $(call KernelPackage,zd1211rw))
  2936. -$(eval $(call KernelPackage,mac80211-hwsim))
  2937. -$(eval $(call KernelPackage,ath9k-common))
  2938. -$(eval $(call KernelPackage,ath9k))
  2939. -$(eval $(call KernelPackage,ath9k-htc))
  2940. -$(eval $(call KernelPackage,ath10k))
  2941. -$(eval $(call KernelPackage,ath))
  2942. -$(eval $(call KernelPackage,carl9170))
  2943. -$(eval $(call KernelPackage,b43))
  2944. -$(eval $(call KernelPackage,b43legacy))
  2945. -$(eval $(call KernelPackage,brcmutil))
  2946. -$(eval $(call KernelPackage,brcmsmac))
  2947. -$(eval $(call KernelPackage,brcmfmac))
  2948. -$(eval $(call KernelPackage,net-libipw))
  2949. -$(eval $(call KernelPackage,net-ipw2100))
  2950. -$(eval $(call KernelPackage,net-ipw2200))
  2951. -$(eval $(call KernelPackage,iwlagn))
  2952. -$(eval $(call KernelPackage,iwl-legacy))
  2953. -$(eval $(call KernelPackage,iwl4965))
  2954. -$(eval $(call KernelPackage,iwl3945))
  2955. -$(eval $(call KernelPackage,mwl8k))
  2956. -$(eval $(call KernelPackage,mwifiex-pcie))
  2957. -$(eval $(call KernelPackage,net-hermes))
  2958. -$(eval $(call KernelPackage,net-hermes-pci))
  2959. -$(eval $(call KernelPackage,net-hermes-plx))
  2960. -$(eval $(call KernelPackage,net-hermes-pcmcia))
  2961. $(eval $(call KernelPackage,wlcore))
  2962. $(eval $(call KernelPackage,wl12xx))
  2963. $(eval $(call KernelPackage,wl18xx))
  2964. +$(eval $(call KernelPackage,zd1211rw))
  2965. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  2966. index c9bc3d6..2a8d2f9 100644
  2967. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  2968. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  2969. @@ -486,7 +486,7 @@ mac80211_prepare_vif() {
  2970. # All interfaces must have unique mac addresses
  2971. # which can either be explicitly set in the device
  2972. # section, or automatically generated
  2973. - ifconfig "$ifname" hw ether "$macaddr"
  2974. + ip link set dev "$ifname" address "$macaddr"
  2975. fi
  2976. json_select ..
  2977. @@ -582,7 +582,7 @@ mac80211_setup_vif() {
  2978. json_get_vars mode
  2979. json_get_var vif_txpower txpower
  2980. - ifconfig "$ifname" up || {
  2981. + ip link set dev "$ifname" up || {
  2982. wireless_setup_vif_failed IFUP_ERROR
  2983. json_select ..
  2984. return
  2985. @@ -638,7 +638,7 @@ mac80211_interface_cleanup() {
  2986. local phy="$1"
  2987. for wdev in $(list_phy_interfaces "$phy"); do
  2988. - ifconfig "$wdev" down 2>/dev/null
  2989. + ip link set dev "$wdev" down 2>/dev/null
  2990. iw dev "$wdev" del
  2991. done
  2992. }
  2993. diff --git a/package/kernel/mac80211/files/regdb.txt b/package/kernel/mac80211/files/regdb.txt
  2994. index ba95fc6..84413fd 100644
  2995. --- a/package/kernel/mac80211/files/regdb.txt
  2996. +++ b/package/kernel/mac80211/files/regdb.txt
  2997. @@ -6,7 +6,7 @@ country 00:
  2998. # Channel 14. Only JP enables this and for 802.11b only
  2999. (2474 - 2494 @ 20), (20), NO-IR, NO-OFDM
  3000. # Channel 36 - 48
  3001. - (5170 - 5250 @ 80), (20)
  3002. + (5170 - 5250 @ 80), (20), AUTO-BW
  3003. # Channel 52 - 64
  3004. (5250 - 5330 @ 80), (20), NO-IR, DFS, AUTO-BW
  3005. # Channel 100 - 144
  3006. @@ -54,8 +54,8 @@ country AL: DFS-ETSI
  3007. country AM: DFS-ETSI
  3008. (2402 - 2482 @ 40), (20)
  3009. - (5170 - 5250 @ 80), (18)
  3010. - (5250 - 5330 @ 80), (18), DFS
  3011. + (5170 - 5250 @ 20), (18)
  3012. + (5250 - 5330 @ 20), (18), DFS
  3013. country AN: DFS-ETSI
  3014. (2402 - 2482 @ 40), (20)
  3015. @@ -85,7 +85,7 @@ country AT: DFS-ETSI
  3016. # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3017. (57000 - 66000 @ 2160), (40)
  3018. -country AU:
  3019. +country AU: DFS-ETSI
  3020. (2402 - 2482 @ 40), (20)
  3021. (5170 - 5250 @ 80), (17), AUTO-BW
  3022. (5250 - 5330 @ 80), (24), DFS, AUTO-BW
  3023. @@ -141,14 +141,20 @@ country BG: DFS-ETSI
  3024. (5170 - 5250 @ 80), (20), AUTO-BW
  3025. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3026. (5490 - 5710 @ 160), (27), DFS
  3027. + # 5 gHz Short Range Devices, ref:
  3028. + # Etsi EN 300 440-1
  3029. + # Etsi EN 300 440-2
  3030. + # http://crc.bg/files/_bg/Spisak_2015.pdf
  3031. + # http://crc.bg/files/_bg/Pravila_2015_resh24.pdf
  3032. + (5725 - 5875 @ 80), (14)
  3033. # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3034. (57000 - 66000 @ 2160), (40)
  3035. country BH: DFS-JP
  3036. (2402 - 2482 @ 40), (20)
  3037. - (5170 - 5250 @ 80), (20)
  3038. - (5250 - 5330 @ 80), (20), DFS
  3039. - (5735 - 5835 @ 80), (20)
  3040. + (5170 - 5250 @ 20), (20)
  3041. + (5250 - 5330 @ 20), (20), DFS
  3042. + (5735 - 5835 @ 20), (20)
  3043. country BL: DFS-ETSI
  3044. (2402 - 2482 @ 40), (20)
  3045. @@ -263,10 +269,10 @@ country CO: DFS-FCC
  3046. country CR: DFS-FCC
  3047. (2402 - 2482 @ 40), (20)
  3048. - (5170 - 5250 @ 80), (17)
  3049. - (5250 - 5330 @ 80), (24), DFS
  3050. - (5490 - 5730 @ 80), (24), DFS
  3051. - (5735 - 5835 @ 80), (30)
  3052. + (5170 - 5250 @ 20), (17)
  3053. + (5250 - 5330 @ 20), (24), DFS
  3054. + (5490 - 5730 @ 20), (24), DFS
  3055. + (5735 - 5835 @ 20), (30)
  3056. country CX: DFS-FCC
  3057. (2402 - 2482 @ 40), (20)
  3058. @@ -349,10 +355,10 @@ country DZ: DFS-JP
  3059. country EC: DFS-FCC
  3060. (2402 - 2482 @ 40), (20)
  3061. - (5170 - 5250 @ 80), (17)
  3062. - (5250 - 5330 @ 80), (24), DFS
  3063. - (5490 - 5730 @ 80), (24), DFS
  3064. - (5735 - 5835 @ 80), (30)
  3065. + (5170 - 5250 @ 20), (17)
  3066. + (5250 - 5330 @ 20), (24), DFS
  3067. + (5490 - 5730 @ 20), (24), DFS
  3068. + (5735 - 5835 @ 20), (30)
  3069. country EE: DFS-ETSI
  3070. (2402 - 2482 @ 40), (20)
  3071. @@ -364,8 +370,8 @@ country EE: DFS-ETSI
  3072. country EG: DFS-ETSI
  3073. (2402 - 2482 @ 40), (20)
  3074. - (5170 - 5250 @ 80), (20)
  3075. - (5250 - 5330 @ 80), (20), DFS
  3076. + (5170 - 5250 @ 40), (20)
  3077. + (5250 - 5330 @ 40), (20), DFS
  3078. # Orden IET/787/2013, de 25 de abril, por la que se aprueba
  3079. # el cuadro nacional de atribución de frecuencias.
  3080. @@ -474,10 +480,10 @@ country GT: DFS-FCC
  3081. country GU: DFS-FCC
  3082. (2402 - 2472 @ 40), (30)
  3083. - (5170 - 5250 @ 80), (17)
  3084. - (5250 - 5330 @ 80), (24), DFS
  3085. - (5490 - 5730 @ 80), (24), DFS
  3086. - (5735 - 5835 @ 80), (30)
  3087. + (5170 - 5250 @ 20), (17)
  3088. + (5250 - 5330 @ 20), (24), DFS
  3089. + (5490 - 5730 @ 20), (24), DFS
  3090. + (5735 - 5835 @ 20), (30)
  3091. country GY:
  3092. (2402 - 2482 @ 40), (30)
  3093. @@ -522,8 +528,8 @@ country HU: DFS-ETSI
  3094. country ID: DFS-JP
  3095. # ref: http://www.postel.go.id/content/ID/regulasi/standardisasi/kepdir/bwa%205,8%20ghz.pdf
  3096. - (2402 - 2482 @ 40), (20)
  3097. - (5735 - 5815 @ 80), (23)
  3098. + (2402 - 2482 @ 20), (20)
  3099. + (5735 - 5815 @ 20), (23)
  3100. country IE: DFS-ETSI
  3101. (2402 - 2482 @ 40), (20)
  3102. @@ -584,6 +590,9 @@ country JP: DFS-JP
  3103. (5170 - 5250 @ 80), (20), AUTO-BW
  3104. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3105. (5490 - 5710 @ 160), (23), DFS
  3106. + # 60 GHz band channels 2-4 at 10mW,
  3107. + # ref: http://www.arib.or.jp/english/html/overview/doc/1-STD-T74v1_1.pdf
  3108. + (59000 - 66000 @ 2160), (10 mW)
  3109. country KE: DFS-JP
  3110. (2402 - 2482 @ 40), (20)
  3111. @@ -607,11 +616,11 @@ country KN: DFS-ETSI
  3112. (5735 - 5815 @ 80), (30)
  3113. country KP: DFS-JP
  3114. - (2402 - 2482 @ 40), (20)
  3115. - (5170 - 5250 @ 80), (20), AUTO-BW
  3116. - (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3117. - (5490 - 5630 @ 80), (30), DFS
  3118. - (5735 - 5815 @ 80), (30)
  3119. + (2402 - 2482 @ 20), (20)
  3120. + (5170 - 5250 @ 20), (20)
  3121. + (5250 - 5330 @ 20), (20), DFS
  3122. + (5490 - 5630 @ 20), (30), DFS
  3123. + (5735 - 5815 @ 20), (30)
  3124. country KR: DFS-JP
  3125. (2402 - 2482 @ 40), (20)
  3126. @@ -659,10 +668,10 @@ country LI: DFS-ETSI
  3127. country LK: DFS-FCC
  3128. (2402 - 2482 @ 40), (20)
  3129. - (5170 - 5250 @ 80), (17)
  3130. - (5250 - 5330 @ 80), (24), DFS
  3131. - (5490 - 5730 @ 80), (24), DFS
  3132. - (5735 - 5835 @ 80), (30)
  3133. + (5170 - 5250 @ 20), (17)
  3134. + (5250 - 5330 @ 20), (24), DFS
  3135. + (5490 - 5730 @ 20), (24), DFS
  3136. + (5735 - 5835 @ 20), (30)
  3137. # Source:
  3138. # http://lca.org.ls/images/documents/lesotho_national_frequency_allocation_plan.pdf
  3139. @@ -751,11 +760,12 @@ country MN: DFS-FCC
  3140. (5490 - 5730 @ 160), (24), DFS
  3141. (5735 - 5835 @ 80), (30)
  3142. -country MO:
  3143. - (2402 - 2482 @ 40), (20)
  3144. - (5170 - 5250 @ 40), (23)
  3145. - (5250 - 5330 @ 40), (23), DFS
  3146. - (5735 - 5835 @ 40), (30)
  3147. +country MO: DFS-FCC
  3148. + (2402 - 2482 @ 40), (23)
  3149. + (5170 - 5250 @ 80), (23), AUTO-BW
  3150. + (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  3151. + (5490 - 5730 @ 160), (30), DFS
  3152. + (5735 - 5835 @ 80), (30)
  3153. country MP: DFS-FCC
  3154. (2402 - 2472 @ 40), (30)
  3155. @@ -793,6 +803,14 @@ country MU: DFS-FCC
  3156. (5490 - 5730 @ 160), (24), DFS
  3157. (5735 - 5835 @ 80), (30)
  3158. +# Source:
  3159. +# http://www.cam.gov.mv/docs/tech_standards/TAM-TS-100-2004-WLAN.pdf
  3160. +country MV: DFS-ETSI
  3161. + (2400 - 2483.5 @ 40), (100 mW)
  3162. + (5150 - 5250 @ 80), (200 mW), AUTO-BW
  3163. + (5250 - 5350 @ 80), (100 mW), DFS, AUTO-BW
  3164. + (5725 - 5850 @ 80), (100 mW)
  3165. +
  3166. country MW: DFS-ETSI
  3167. (2402 - 2482 @ 40), (20)
  3168. (5170 - 5250 @ 80), (20), AUTO-BW
  3169. @@ -812,6 +830,11 @@ country MY: DFS-FCC
  3170. (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  3171. (5735 - 5835 @ 80), (30)
  3172. +country NG: DFS-ETSI
  3173. + (2402 - 2482 @ 40), (20)
  3174. + (5250 - 5330 @ 80), (30), DFS
  3175. + (5735 - 5835 @ 80), (30)
  3176. +
  3177. country NI: DFS-FCC
  3178. (2402 - 2472 @ 40), (30)
  3179. (5170 - 5250 @ 80), (24), AUTO-BW
  3180. @@ -848,7 +871,7 @@ country NP: DFS-JP
  3181. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3182. (5735 - 5835 @ 80), (20)
  3183. -country NZ: DFS-FCC
  3184. +country NZ: DFS-ETSI
  3185. (2402 - 2482 @ 40), (30)
  3186. (5170 - 5250 @ 80), (17), AUTO-BW
  3187. (5250 - 5330 @ 80), (24), DFS, AUTO-BW
  3188. @@ -971,10 +994,12 @@ country RS: DFS-ETSI
  3189. country RU: DFS-ETSI
  3190. (2402 - 2482 @ 40), (20)
  3191. - (5170 - 5250 @ 80), (20)
  3192. - (5250 - 5330 @ 80), (20), DFS
  3193. - (5650 - 5730 @ 80), (30), DFS
  3194. - (5735 - 5835 @ 80), (30)
  3195. + (5170 - 5250 @ 40), (20)
  3196. + (5250 - 5330 @ 40), (20), DFS
  3197. + (5650 - 5730 @ 40), (30), DFS
  3198. + (5735 - 5835 @ 40), (30)
  3199. + # 60 GHz band channels 1-4, ref: Changes to NLA 124_Order №129_22042015.pdf
  3200. + (57000 - 66000 @ 2160), (40)
  3201. country RW: DFS-FCC
  3202. (2402 - 2482 @ 40), (20)
  3203. @@ -1037,9 +1062,9 @@ country SR: DFS-ETSI
  3204. country SV: DFS-FCC
  3205. (2402 - 2482 @ 40), (20)
  3206. - (5170 - 5250 @ 80), (17)
  3207. - (5250 - 5330 @ 80), (23), DFS
  3208. - (5735 - 5835 @ 80), (30)
  3209. + (5170 - 5250 @ 20), (17)
  3210. + (5250 - 5330 @ 20), (23), DFS
  3211. + (5735 - 5835 @ 20), (30)
  3212. country SY:
  3213. (2402 - 2482 @ 40), (20)
  3214. @@ -1099,6 +1124,10 @@ country TW: DFS-JP
  3215. (5650 - 5710 @ 40), (30), DFS
  3216. (5735 - 5835 @ 80), (30)
  3217. +country TZ:
  3218. + (2402 - 2482 @ 40), (20)
  3219. + (5735 - 5835 @ 80), (30)
  3220. +
  3221. # Source:
  3222. # #914 / 06 Sep 2007: http://www.ucrf.gov.ua/uk/doc/nkrz/1196068874
  3223. # #1174 / 23 Oct 2008: http://www.nkrz.gov.ua/uk/activities/ruling/1225269361
  3224. @@ -1125,6 +1154,7 @@ country US: DFS-FCC
  3225. (2402 - 2472 @ 40), (30)
  3226. (5170 - 5250 @ 80), (17), AUTO-BW
  3227. (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  3228. + (5490 - 5730 @ 160), (23), DFS
  3229. (5735 - 5835 @ 80), (30)
  3230. # 60g band
  3231. # reference: http://cfr.regstoday.com/47cfr15.aspx#47_CFR_15p255
  3232. @@ -1192,6 +1222,12 @@ country WF: DFS-ETSI
  3233. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3234. (5490 - 5710 @ 160), (27), DFS
  3235. +country WS: DFS-ETSI
  3236. + (2402 - 2482 @ 40), (20)
  3237. + (5170 - 5250 @ 40), (20)
  3238. + (5250 - 5330 @ 40), (20), DFS
  3239. + (5490 - 5710 @ 40), (27), DFS
  3240. +
  3241. country YE:
  3242. (2402 - 2482 @ 40), (20)
  3243. diff --git a/package/kernel/mac80211/patches/001-fix_build.patch b/package/kernel/mac80211/patches/001-fix_build.patch
  3244. index 818983e..402649d 100644
  3245. --- a/package/kernel/mac80211/patches/001-fix_build.patch
  3246. +++ b/package/kernel/mac80211/patches/001-fix_build.patch
  3247. @@ -27,7 +27,7 @@
  3248. @set -e ; test -f .local-symbols || ( \
  3249. echo "/--------------" ;\
  3250. echo "| You shouldn't run make in the backports tree, but only in" ;\
  3251. -@@ -60,56 +62,60 @@ mrproper:
  3252. +@@ -60,57 +62,61 @@ mrproper:
  3253. echo "| (that isn't currently running.)" ;\
  3254. echo "\\--" ;\
  3255. false)
  3256. @@ -56,11 +56,12 @@
  3257. - done \
  3258. - ) > Kconfig.kernel ;\
  3259. - kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  3260. -- sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3261. +- sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3262. - test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  3263. - test "$$kver" != "" ;\
  3264. - kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  3265. -- kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  3266. +- kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  3267. +- kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  3268. - print=0 ;\
  3269. - for v in $$kvers ; do \
  3270. - if [ "$$print" = "1" ] ; then \
  3271. @@ -111,11 +112,12 @@
  3272. +
  3273. +Kconfig.versions: Kconfig.kernel
  3274. + @kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  3275. -+ sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3276. ++ sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3277. + test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  3278. + test "$$kver" != "" ;\
  3279. + kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  3280. -+ kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  3281. ++ kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  3282. ++ kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  3283. + print=0 ;\
  3284. + for v in $$kvers ; do \
  3285. + if [ "$$print" = "1" ] ; then \
  3286. diff --git a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch b/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  3287. deleted file mode 100644
  3288. index d48a723..0000000
  3289. --- a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  3290. +++ /dev/null
  3291. @@ -1,10 +0,0 @@
  3292. ---- a/backport-include/linux/debugfs.h
  3293. -+++ b/backport-include/linux/debugfs.h
  3294. -@@ -3,6 +3,7 @@
  3295. - #include_next <linux/debugfs.h>
  3296. - #include <linux/version.h>
  3297. - #include <generated/utsrelease.h>
  3298. -+#include <linux/device.h>
  3299. -
  3300. - #if defined(CONFIG_DEBUG_FS)
  3301. - struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
  3302. diff --git a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch b/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  3303. deleted file mode 100644
  3304. index e07f323..0000000
  3305. --- a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  3306. +++ /dev/null
  3307. @@ -1,16 +0,0 @@
  3308. ---- a/net/mac80211/iface.c
  3309. -+++ b/net/mac80211/iface.c
  3310. -@@ -1858,6 +1858,13 @@ void ieee80211_remove_interfaces(struct
  3311. - }
  3312. - mutex_unlock(&local->iflist_mtx);
  3313. - unregister_netdevice_many(&unreg_list);
  3314. -+#if (!(LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,45) && \
  3315. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) && \
  3316. -+ !(LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,9) && \
  3317. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) && \
  3318. -+ (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)))
  3319. -+ list_del(&unreg_list);
  3320. -+#endif
  3321. -
  3322. - list_for_each_entry_safe(sdata, tmp, &wdev_list, list) {
  3323. - list_del(&sdata->list);
  3324. diff --git a/package/kernel/mac80211/patches/020-add_mpls_h.patch b/package/kernel/mac80211/patches/020-add_mpls_h.patch
  3325. deleted file mode 100644
  3326. index e5310bc..0000000
  3327. --- a/package/kernel/mac80211/patches/020-add_mpls_h.patch
  3328. +++ /dev/null
  3329. @@ -1,37 +0,0 @@
  3330. ---- /dev/null
  3331. -+++ b/include/uapi/linux/mpls.h
  3332. -@@ -0,0 +1,34 @@
  3333. -+#ifndef _UAPI_MPLS_H
  3334. -+#define _UAPI_MPLS_H
  3335. -+
  3336. -+#include <linux/types.h>
  3337. -+#include <asm/byteorder.h>
  3338. -+
  3339. -+/* Reference: RFC 5462, RFC 3032
  3340. -+ *
  3341. -+ * 0 1 2 3
  3342. -+ * 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
  3343. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  3344. -+ * | Label | TC |S| TTL |
  3345. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  3346. -+ *
  3347. -+ * Label: Label Value, 20 bits
  3348. -+ * TC: Traffic Class field, 3 bits
  3349. -+ * S: Bottom of Stack, 1 bit
  3350. -+ * TTL: Time to Live, 8 bits
  3351. -+ */
  3352. -+
  3353. -+struct mpls_label {
  3354. -+ __be32 entry;
  3355. -+};
  3356. -+
  3357. -+#define MPLS_LS_LABEL_MASK 0xFFFFF000
  3358. -+#define MPLS_LS_LABEL_SHIFT 12
  3359. -+#define MPLS_LS_TC_MASK 0x00000E00
  3360. -+#define MPLS_LS_TC_SHIFT 9
  3361. -+#define MPLS_LS_S_MASK 0x00000100
  3362. -+#define MPLS_LS_S_SHIFT 8
  3363. -+#define MPLS_LS_TTL_MASK 0x000000FF
  3364. -+#define MPLS_LS_TTL_SHIFT 0
  3365. -+
  3366. -+#endif /* _UAPI_MPLS_H */
  3367. 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
  3368. new file mode 100644
  3369. index 0000000..97f678c
  3370. --- /dev/null
  3371. +++ b/package/kernel/mac80211/patches/020-backports-do-not-add-debugfs_create_devm_seqfile-on-.patch
  3372. @@ -0,0 +1,33 @@
  3373. +From e15e9231e7a9f81f5264d294fd3fd96a20d92516 Mon Sep 17 00:00:00 2001
  3374. +From: Hauke Mehrtens <hauke@hauke-m.de>
  3375. +Date: Sat, 25 Jul 2015 15:19:17 +0200
  3376. +Subject: [PATCH 3/3] backports: do not add debugfs_create_devm_seqfile() on
  3377. + recent kernel versions
  3378. +
  3379. +An #ifdef for the kernel version was missing around the header of
  3380. +debugfs_create_devm_seqfile() and the LINUX_BACKPORT() was also not
  3381. +done.
  3382. +
  3383. +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  3384. +---
  3385. + backport/backport-include/linux/debugfs.h | 3 +++
  3386. + 1 file changed, 3 insertions(+)
  3387. +
  3388. +--- a/backport-include/linux/debugfs.h
  3389. ++++ b/backport-include/linux/debugfs.h
  3390. +@@ -5,6 +5,8 @@
  3391. + #include <linux/device.h>
  3392. + #include <generated/utsrelease.h>
  3393. +
  3394. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  3395. ++#define debugfs_create_devm_seqfile LINUX_BACKPORT(debugfs_create_devm_seqfile)
  3396. + #if defined(CONFIG_DEBUG_FS)
  3397. + struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
  3398. + struct dentry *parent,
  3399. +@@ -20,5 +22,6 @@ static inline struct dentry *debugfs_cre
  3400. + return ERR_PTR(-ENODEV);
  3401. + }
  3402. + #endif /* CONFIG_DEBUG_FS */
  3403. ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  3404. +
  3405. + #endif /* __BACKPORT_DEBUGFS_H_ */
  3406. diff --git a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch b/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  3407. deleted file mode 100644
  3408. index dce217f..0000000
  3409. --- a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  3410. +++ /dev/null
  3411. @@ -1,104 +0,0 @@
  3412. ---- a/drivers/bcma/driver_pci.c
  3413. -+++ b/drivers/bcma/driver_pci.c
  3414. -@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcm
  3415. - }
  3416. - EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
  3417. -
  3418. --int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  3419. -- bool enable)
  3420. --{
  3421. -- struct pci_dev *pdev;
  3422. -- u32 coremask, tmp;
  3423. -- int err = 0;
  3424. --
  3425. -- if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  3426. -- /* This bcma device is not on a PCI host-bus. So the IRQs are
  3427. -- * not routed through the PCI core.
  3428. -- * So we must not enable routing through the PCI core. */
  3429. -- goto out;
  3430. -- }
  3431. --
  3432. -- pdev = bus->host_pci;
  3433. --
  3434. -- err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  3435. -- if (err)
  3436. -- goto out;
  3437. --
  3438. -- coremask = BIT(core->core_index) << 8;
  3439. -- if (enable)
  3440. -- tmp |= coremask;
  3441. -- else
  3442. -- tmp &= ~coremask;
  3443. --
  3444. -- err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  3445. --
  3446. --out:
  3447. -- return err;
  3448. --}
  3449. --EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl);
  3450. --
  3451. - static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
  3452. - {
  3453. - u32 w;
  3454. ---- a/drivers/bcma/host_pci.c
  3455. -+++ b/drivers/bcma/host_pci.c
  3456. -@@ -351,3 +351,37 @@ void bcma_host_pci_down(struct bcma_bus
  3457. - bcma_core_pci_down(&bus->drv_pci[0]);
  3458. - }
  3459. - EXPORT_SYMBOL_GPL(bcma_host_pci_down);
  3460. -+
  3461. -+/* See also si_pci_setup */
  3462. -+int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  3463. -+ bool enable)
  3464. -+{
  3465. -+ struct pci_dev *pdev;
  3466. -+ u32 coremask, tmp;
  3467. -+ int err = 0;
  3468. -+
  3469. -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  3470. -+ /* This bcma device is not on a PCI host-bus. So the IRQs are
  3471. -+ * not routed through the PCI core.
  3472. -+ * So we must not enable routing through the PCI core. */
  3473. -+ goto out;
  3474. -+ }
  3475. -+
  3476. -+ pdev = bus->host_pci;
  3477. -+
  3478. -+ err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  3479. -+ if (err)
  3480. -+ goto out;
  3481. -+
  3482. -+ coremask = BIT(core->core_index) << 8;
  3483. -+ if (enable)
  3484. -+ tmp |= coremask;
  3485. -+ else
  3486. -+ tmp &= ~coremask;
  3487. -+
  3488. -+ err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  3489. -+
  3490. -+out:
  3491. -+ return err;
  3492. -+}
  3493. -+EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl);
  3494. ---- a/drivers/net/wireless/b43/main.c
  3495. -+++ b/drivers/net/wireless/b43/main.c
  3496. -@@ -4866,7 +4866,7 @@ static int b43_wireless_core_init(struct
  3497. - switch (dev->dev->bus_type) {
  3498. - #ifdef CPTCFG_B43_BCMA
  3499. - case B43_BUS_BCMA:
  3500. -- bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
  3501. -+ bcma_host_pci_irq_ctl(dev->dev->bdev->bus,
  3502. - dev->dev->bdev, true);
  3503. - bcma_host_pci_up(dev->dev->bdev->bus);
  3504. - break;
  3505. ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
  3506. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
  3507. -@@ -4959,7 +4959,7 @@ static int brcms_b_up_prep(struct brcms_
  3508. - * Configure pci/pcmcia here instead of in brcms_c_attach()
  3509. - * to allow mfg hotswap: down, hotswap (chip power cycle), up.
  3510. - */
  3511. -- bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  3512. -+ bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  3513. - true);
  3514. -
  3515. - /*
  3516. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  3517. index d307949..4fbab23 100644
  3518. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  3519. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  3520. @@ -1,6 +1,6 @@
  3521. --- a/.local-symbols
  3522. +++ b/.local-symbols
  3523. -@@ -344,40 +344,3 @@ USB_CDC_PHONET=
  3524. +@@ -449,43 +449,6 @@ USB_CDC_PHONET=
  3525. USB_IPHETH=
  3526. USB_SIERRA_NET=
  3527. USB_VL600=
  3528. @@ -32,26 +32,18 @@
  3529. -BCMA_BLOCKIO=
  3530. -BCMA_HOST_PCI_POSSIBLE=
  3531. -BCMA_HOST_PCI=
  3532. --BCMA_DRIVER_PCI_HOSTMODE=
  3533. -BCMA_HOST_SOC=
  3534. -BCMA_DRIVER_PCI=
  3535. +-BCMA_DRIVER_PCI_HOSTMODE=
  3536. -BCMA_DRIVER_MIPS=
  3537. -BCMA_SFLASH=
  3538. -BCMA_NFLASH=
  3539. -BCMA_DRIVER_GMAC_CMN=
  3540. -BCMA_DRIVER_GPIO=
  3541. -BCMA_DEBUG=
  3542. ---- a/Makefile.kernel
  3543. -+++ b/Makefile.kernel
  3544. -@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  3545. - obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  3546. - #obj-$(CPTCFG_BT) += net/bluetooth/
  3547. - #obj-$(CPTCFG_BT) += drivers/bluetooth/
  3548. --obj-$(CPTCFG_SSB) += drivers/ssb/
  3549. --obj-$(CPTCFG_BCMA) += drivers/bcma/
  3550. - #obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  3551. - obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  3552. - #obj-$(CPTCFG_NFC) += net/nfc/
  3553. + NFC=
  3554. + NFC_DIGITAL=
  3555. + NFC_NCI=
  3556. --- a/drivers/net/wireless/b43/main.c
  3557. +++ b/drivers/net/wireless/b43/main.c
  3558. @@ -2866,7 +2866,7 @@ static struct ssb_device *b43_ssb_gpio_d
  3559. @@ -63,7 +55,7 @@
  3560. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  3561. #else
  3562. return bus->chipco.dev;
  3563. -@@ -4907,7 +4907,7 @@ static int b43_wireless_core_init(struct
  3564. +@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  3565. }
  3566. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  3567. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  3568. @@ -116,12 +108,23 @@
  3569. --- a/Kconfig.sources
  3570. +++ b/Kconfig.sources
  3571. @@ -9,9 +9,6 @@ source "$BACKPORT_DIR/drivers/net/wirele
  3572. - #source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  3573. + source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  3574. source "$BACKPORT_DIR/drivers/net/usb/Kconfig"
  3575. -source "$BACKPORT_DIR/drivers/ssb/Kconfig"
  3576. -source "$BACKPORT_DIR/drivers/bcma/Kconfig"
  3577. -
  3578. - #source "$BACKPORT_DIR/net/nfc/Kconfig"
  3579. + source "$BACKPORT_DIR/net/nfc/Kconfig"
  3580. - #source "$BACKPORT_DIR/drivers/media/Kconfig"
  3581. + source "$BACKPORT_DIR/drivers/media/Kconfig"
  3582. +--- a/Makefile.kernel
  3583. ++++ b/Makefile.kernel
  3584. +@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  3585. + obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  3586. + obj-$(CPTCFG_BT) += net/bluetooth/
  3587. + obj-$(CPTCFG_BT) += drivers/bluetooth/
  3588. +-obj-$(CPTCFG_SSB) += drivers/ssb/
  3589. +-obj-$(CPTCFG_BCMA) += drivers/bcma/
  3590. + obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  3591. + obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  3592. + obj-$(CPTCFG_NFC) += net/nfc/
  3593. 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
  3594. deleted file mode 100644
  3595. index 85c5280..0000000
  3596. --- a/package/kernel/mac80211/patches/090-linux_3_18_12_compat.patch
  3597. +++ /dev/null
  3598. @@ -1,29 +0,0 @@
  3599. ---- a/backport-include/linux/wait.h
  3600. -+++ b/backport-include/linux/wait.h
  3601. -@@ -23,7 +23,7 @@ backport_wait_on_bit_io(void *word, int
  3602. -
  3603. - #endif
  3604. -
  3605. --#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  3606. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  3607. - #define WQ_FLAG_WOKEN 0x02
  3608. -
  3609. - #define wait_woken LINUX_BACKPORT(wait_woken)
  3610. ---- a/compat/backport-3.19.c
  3611. -+++ b/compat/backport-3.19.c
  3612. -@@ -15,6 +15,7 @@
  3613. - #include <linux/netdevice.h>
  3614. - #include <linux/debugfs.h>
  3615. -
  3616. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  3617. - static inline bool is_kthread_should_stop(void)
  3618. - {
  3619. - return (current->flags & PF_KTHREAD) && kthread_should_stop();
  3620. -@@ -79,6 +80,7 @@ int woken_wake_function(wait_queue_t *wa
  3621. - return default_wake_function(wait, mode, sync, key);
  3622. - }
  3623. - EXPORT_SYMBOL(woken_wake_function);
  3624. -+#endif
  3625. -
  3626. - #ifdef __BACKPORT_NETDEV_RSS_KEY_FILL
  3627. - u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
  3628. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  3629. new file mode 100644
  3630. index 0000000..07dde54
  3631. --- /dev/null
  3632. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  3633. @@ -0,0 +1,376 @@
  3634. +--- a/net/mac80211/Kconfig
  3635. ++++ b/net/mac80211/Kconfig
  3636. +@@ -5,8 +5,6 @@ config MAC80211
  3637. + depends on CRYPTO
  3638. + depends on CRYPTO_ARC4
  3639. + depends on CRYPTO_AES
  3640. +- select BPAUTO_CRYPTO_CCM
  3641. +- depends on CRYPTO_GCM
  3642. + depends on CRC32
  3643. + select BPAUTO_AVERAGE
  3644. + ---help---
  3645. +--- a/net/mac80211/Makefile
  3646. ++++ b/net/mac80211/Makefile
  3647. +@@ -15,9 +15,7 @@ mac80211-y := \
  3648. + michael.o \
  3649. + tkip.o \
  3650. + aes_ccm.o \
  3651. +- aes_gcm.o \
  3652. + aes_cmac.o \
  3653. +- aes_gmac.o \
  3654. + cfg.o \
  3655. + ethtool.o \
  3656. + rx.o \
  3657. +--- a/net/mac80211/aes_ccm.c
  3658. ++++ b/net/mac80211/aes_ccm.c
  3659. +@@ -13,89 +13,132 @@
  3660. + #include <linux/types.h>
  3661. + #include <linux/err.h>
  3662. + #include <crypto/aead.h>
  3663. ++#include <crypto/aes.h>
  3664. +
  3665. + #include <net/mac80211.h>
  3666. + #include "key.h"
  3667. + #include "aes_ccm.h"
  3668. +
  3669. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  3670. +- u8 *data, size_t data_len, u8 *mic,
  3671. +- size_t mic_len)
  3672. ++static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0,
  3673. ++ u8 *a, u8 *b)
  3674. + {
  3675. +- struct scatterlist sg[3];
  3676. ++ int i;
  3677. ++
  3678. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  3679. ++
  3680. ++ /* Extra Authenticate-only data (always two AES blocks) */
  3681. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  3682. ++ aad[i] ^= b[i];
  3683. ++ crypto_cipher_encrypt_one(tfm, b, aad);
  3684. ++
  3685. ++ aad += AES_BLOCK_SIZE;
  3686. ++
  3687. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  3688. ++ aad[i] ^= b[i];
  3689. ++ crypto_cipher_encrypt_one(tfm, a, aad);
  3690. +
  3691. +- char aead_req_data[sizeof(struct aead_request) +
  3692. +- crypto_aead_reqsize(tfm)]
  3693. +- __aligned(__alignof__(struct aead_request));
  3694. +- struct aead_request *aead_req = (void *) aead_req_data;
  3695. ++ /* Mask out bits from auth-only-b_0 */
  3696. ++ b_0[0] &= 0x07;
  3697. +
  3698. +- memset(aead_req, 0, sizeof(aead_req_data));
  3699. ++ /* S_0 is used to encrypt T (= MIC) */
  3700. ++ b_0[14] = 0;
  3701. ++ b_0[15] = 0;
  3702. ++ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  3703. ++}
  3704. +
  3705. +- sg_init_table(sg, 3);
  3706. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  3707. +- sg_set_buf(&sg[1], data, data_len);
  3708. +- sg_set_buf(&sg[2], mic, mic_len);
  3709. +
  3710. +- aead_request_set_tfm(aead_req, tfm);
  3711. +- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
  3712. +- aead_request_set_ad(aead_req, sg[0].length);
  3713. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  3714. ++ u8 *data, size_t data_len, u8 *mic,
  3715. ++ size_t mic_len)
  3716. ++{
  3717. ++ int i, j, last_len, num_blocks;
  3718. ++ u8 b[AES_BLOCK_SIZE];
  3719. ++ u8 s_0[AES_BLOCK_SIZE];
  3720. ++ u8 e[AES_BLOCK_SIZE];
  3721. ++ u8 *pos, *cpos;
  3722. ++
  3723. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  3724. ++ last_len = data_len % AES_BLOCK_SIZE;
  3725. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
  3726. ++
  3727. ++ /* Process payload blocks */
  3728. ++ pos = data;
  3729. ++ cpos = data;
  3730. ++ for (j = 1; j <= num_blocks; j++) {
  3731. ++ int blen = (j == num_blocks && last_len) ?
  3732. ++ last_len : AES_BLOCK_SIZE;
  3733. ++
  3734. ++ /* Authentication followed by encryption */
  3735. ++ for (i = 0; i < blen; i++)
  3736. ++ b[i] ^= pos[i];
  3737. ++ crypto_cipher_encrypt_one(tfm, b, b);
  3738. ++
  3739. ++ b_0[14] = (j >> 8) & 0xff;
  3740. ++ b_0[15] = j & 0xff;
  3741. ++ crypto_cipher_encrypt_one(tfm, e, b_0);
  3742. ++ for (i = 0; i < blen; i++)
  3743. ++ *cpos++ = *pos++ ^ e[i];
  3744. ++ }
  3745. +
  3746. +- crypto_aead_encrypt(aead_req);
  3747. ++ for (i = 0; i < mic_len; i++)
  3748. ++ mic[i] = b[i] ^ s_0[i];
  3749. + }
  3750. +
  3751. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  3752. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  3753. + u8 *data, size_t data_len, u8 *mic,
  3754. + size_t mic_len)
  3755. + {
  3756. +- struct scatterlist sg[3];
  3757. +- char aead_req_data[sizeof(struct aead_request) +
  3758. +- crypto_aead_reqsize(tfm)]
  3759. +- __aligned(__alignof__(struct aead_request));
  3760. +- struct aead_request *aead_req = (void *) aead_req_data;
  3761. +-
  3762. +- if (data_len == 0)
  3763. +- return -EINVAL;
  3764. +-
  3765. +- memset(aead_req, 0, sizeof(aead_req_data));
  3766. +-
  3767. +- sg_init_table(sg, 3);
  3768. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  3769. +- sg_set_buf(&sg[1], data, data_len);
  3770. +- sg_set_buf(&sg[2], mic, mic_len);
  3771. +-
  3772. +- aead_request_set_tfm(aead_req, tfm);
  3773. +- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
  3774. +- aead_request_set_ad(aead_req, sg[0].length);
  3775. ++ int i, j, last_len, num_blocks;
  3776. ++ u8 *pos, *cpos;
  3777. ++ u8 a[AES_BLOCK_SIZE];
  3778. ++ u8 b[AES_BLOCK_SIZE];
  3779. ++ u8 s_0[AES_BLOCK_SIZE];
  3780. ++
  3781. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  3782. ++ last_len = data_len % AES_BLOCK_SIZE;
  3783. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, a, b);
  3784. ++
  3785. ++ /* Process payload blocks */
  3786. ++ cpos = data;
  3787. ++ pos = data;
  3788. ++ for (j = 1; j <= num_blocks; j++) {
  3789. ++ int blen = (j == num_blocks && last_len) ?
  3790. ++ last_len : AES_BLOCK_SIZE;
  3791. ++
  3792. ++ /* Decryption followed by authentication */
  3793. ++ b_0[14] = (j >> 8) & 0xff;
  3794. ++ b_0[15] = j & 0xff;
  3795. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  3796. ++ for (i = 0; i < blen; i++) {
  3797. ++ *pos = *cpos++ ^ b[i];
  3798. ++ a[i] ^= *pos++;
  3799. ++ }
  3800. ++ crypto_cipher_encrypt_one(tfm, a, a);
  3801. ++ }
  3802. ++
  3803. ++ for (i = 0; i < mic_len; i++) {
  3804. ++ if ((mic[i] ^ s_0[i]) != a[i])
  3805. ++ return -1;
  3806. ++ }
  3807. +
  3808. +- return crypto_aead_decrypt(aead_req);
  3809. ++ return 0;
  3810. + }
  3811. +
  3812. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  3813. +- size_t key_len,
  3814. +- size_t mic_len)
  3815. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  3816. ++ size_t key_len,
  3817. ++ size_t mic_len)
  3818. + {
  3819. +- struct crypto_aead *tfm;
  3820. +- int err;
  3821. ++ struct crypto_cipher *tfm;
  3822. +
  3823. +- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  3824. +- if (IS_ERR(tfm))
  3825. +- return tfm;
  3826. +-
  3827. +- err = crypto_aead_setkey(tfm, key, key_len);
  3828. +- if (err)
  3829. +- goto free_aead;
  3830. +- err = crypto_aead_setauthsize(tfm, mic_len);
  3831. +- if (err)
  3832. +- goto free_aead;
  3833. ++ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  3834. ++ if (!IS_ERR(tfm))
  3835. ++ crypto_cipher_setkey(tfm, key, key_len);
  3836. +
  3837. + return tfm;
  3838. +-
  3839. +-free_aead:
  3840. +- crypto_free_aead(tfm);
  3841. +- return ERR_PTR(err);
  3842. + }
  3843. +
  3844. +-void ieee80211_aes_key_free(struct crypto_aead *tfm)
  3845. ++
  3846. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  3847. + {
  3848. +- crypto_free_aead(tfm);
  3849. ++ crypto_free_cipher(tfm);
  3850. + }
  3851. +--- a/net/mac80211/aes_ccm.h
  3852. ++++ b/net/mac80211/aes_ccm.h
  3853. +@@ -12,15 +12,15 @@
  3854. +
  3855. + #include <linux/crypto.h>
  3856. +
  3857. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  3858. +- size_t key_len,
  3859. +- size_t mic_len);
  3860. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  3861. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  3862. ++ size_t key_len,
  3863. ++ size_t mic_len);
  3864. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  3865. + u8 *data, size_t data_len, u8 *mic,
  3866. + size_t mic_len);
  3867. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  3868. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  3869. + u8 *data, size_t data_len, u8 *mic,
  3870. + size_t mic_len);
  3871. +-void ieee80211_aes_key_free(struct crypto_aead *tfm);
  3872. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  3873. +
  3874. + #endif /* AES_CCM_H */
  3875. +--- a/net/mac80211/aes_gcm.h
  3876. ++++ b/net/mac80211/aes_gcm.h
  3877. +@@ -11,12 +11,28 @@
  3878. +
  3879. + #include <linux/crypto.h>
  3880. +
  3881. +-void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  3882. +- u8 *data, size_t data_len, u8 *mic);
  3883. +-int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  3884. +- u8 *data, size_t data_len, u8 *mic);
  3885. +-struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  3886. +- size_t key_len);
  3887. +-void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  3888. ++static inline void
  3889. ++ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  3890. ++ u8 *data, size_t data_len, u8 *mic)
  3891. ++{
  3892. ++}
  3893. ++
  3894. ++static inline int
  3895. ++ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  3896. ++ u8 *data, size_t data_len, u8 *mic)
  3897. ++{
  3898. ++ return -EOPNOTSUPP;
  3899. ++}
  3900. ++
  3901. ++static inline struct crypto_aead *
  3902. ++ieee80211_aes_gcm_key_setup_encrypt(const u8 key[], size_t key_len)
  3903. ++{
  3904. ++ return NULL;
  3905. ++}
  3906. ++
  3907. ++static inline void
  3908. ++ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  3909. ++{
  3910. ++}
  3911. +
  3912. + #endif /* AES_GCM_H */
  3913. +--- a/net/mac80211/aes_gmac.h
  3914. ++++ b/net/mac80211/aes_gmac.h
  3915. +@@ -11,10 +11,22 @@
  3916. +
  3917. + #include <linux/crypto.h>
  3918. +
  3919. +-struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  3920. +- size_t key_len);
  3921. +-int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  3922. +- const u8 *data, size_t data_len, u8 *mic);
  3923. +-void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  3924. ++static inline struct crypto_aead *
  3925. ++ieee80211_aes_gmac_key_setup(const u8 key[], size_t key_len)
  3926. ++{
  3927. ++ return NULL;
  3928. ++}
  3929. ++
  3930. ++static inline int
  3931. ++ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  3932. ++ const u8 *data, size_t data_len, u8 *mic)
  3933. ++{
  3934. ++ return -EOPNOTSUPP;
  3935. ++}
  3936. ++
  3937. ++static inline void
  3938. ++ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  3939. ++{
  3940. ++}
  3941. +
  3942. + #endif /* AES_GMAC_H */
  3943. +--- a/net/mac80211/key.h
  3944. ++++ b/net/mac80211/key.h
  3945. +@@ -84,7 +84,7 @@ struct ieee80211_key {
  3946. + * Management frames.
  3947. + */
  3948. + u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  3949. +- struct crypto_aead *tfm;
  3950. ++ struct crypto_cipher *tfm;
  3951. + u32 replays; /* dot11RSNAStatsCCMPReplays */
  3952. + } ccmp;
  3953. + struct {
  3954. +--- a/net/mac80211/wpa.c
  3955. ++++ b/net/mac80211/wpa.c
  3956. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  3957. + }
  3958. +
  3959. +
  3960. +-static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  3961. ++static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
  3962. ++ u16 data_len)
  3963. + {
  3964. + __le16 mask_fc;
  3965. + int a4_included, mgmt;
  3966. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  3967. + else
  3968. + qos_tid = 0;
  3969. +
  3970. +- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  3971. +- * mode authentication are not allowed to collide, yet both are derived
  3972. +- * from this vector b_0. We only set L := 1 here to indicate that the
  3973. +- * data size can be represented in (L+1) bytes. The CCM layer will take
  3974. +- * care of storing the data length in the top (L+1) bytes and setting
  3975. +- * and clearing the other bits as is required to derive the two IVs.
  3976. +- */
  3977. +- b_0[0] = 0x1;
  3978. ++ /* First block, b_0 */
  3979. ++ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  3980. +
  3981. + /* Nonce: Nonce Flags | A2 | PN
  3982. + * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  3983. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  3984. + b_0[1] = qos_tid | (mgmt << 4);
  3985. + memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  3986. + memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  3987. ++ /* l(m) */
  3988. ++ put_unaligned_be16(data_len, &b_0[14]);
  3989. +
  3990. + /* AAD (extra authenticate-only data) / masked 802.11 header
  3991. + * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  3992. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  3993. + return 0;
  3994. +
  3995. + pos += IEEE80211_CCMP_HDR_LEN;
  3996. +- ccmp_special_blocks(skb, pn, b_0, aad);
  3997. ++ ccmp_special_blocks(skb, pn, b_0, aad, len);
  3998. + ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  3999. + skb_put(skb, mic_len), mic_len);
  4000. +
  4001. +@@ -531,7 +528,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  4002. + u8 aad[2 * AES_BLOCK_SIZE];
  4003. + u8 b_0[AES_BLOCK_SIZE];
  4004. + /* hardware didn't decrypt/verify MIC */
  4005. +- ccmp_special_blocks(skb, pn, b_0, aad);
  4006. ++ ccmp_special_blocks(skb, pn, b_0, aad, data_len);
  4007. +
  4008. + if (ieee80211_aes_ccm_decrypt(
  4009. + key->u.ccmp.tfm, b_0, aad,
  4010. diff --git a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch b/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  4011. deleted file mode 100644
  4012. index ceca952..0000000
  4013. --- a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  4014. +++ /dev/null
  4015. @@ -1,2055 +0,0 @@
  4016. -This patch reverts the following commits from wireless-testing:
  4017. -
  4018. -8ade538bf39b1ee53418528fdacd36b8e65621b9
  4019. -56c52da2d554f081e8fce58ecbcf6a40c605b95b
  4020. -2b2ba0db1c820d04d5143452d70012cd44d7b578
  4021. -00b9cfa3ff38401bd70c34b250ca13e5ea347b4a
  4022. -4f031fa9f188b2b0641ac20087d9e16bcfb4e49d
  4023. -6e1ee5d2e9e411892b5d84e3ea93e3fc88ac786c
  4024. -30ef7ef9672d92ab2cac37f60a31955c118321e7
  4025. -f359d3fe832e49eeec2232b2af5a9e3aee6b4862 (only the changes in aes_cmac.{c,h})
  4026. -7ec7c4a9a686c608315739ab6a2b0527a240883c
  4027. ----
  4028. -
  4029. ---- a/include/linux/ieee80211.h
  4030. -+++ b/include/linux/ieee80211.h
  4031. -@@ -1017,15 +1017,6 @@ struct ieee80211_mmie {
  4032. - u8 mic[8];
  4033. - } __packed;
  4034. -
  4035. --/* Management MIC information element (IEEE 802.11w) for GMAC and CMAC-256 */
  4036. --struct ieee80211_mmie_16 {
  4037. -- u8 element_id;
  4038. -- u8 length;
  4039. -- __le16 key_id;
  4040. -- u8 sequence_number[6];
  4041. -- u8 mic[16];
  4042. --} __packed;
  4043. --
  4044. - struct ieee80211_vendor_ie {
  4045. - u8 element_id;
  4046. - u8 len;
  4047. ---- a/include/net/mac80211.h
  4048. -+++ b/include/net/mac80211.h
  4049. -@@ -1306,8 +1306,8 @@ struct ieee80211_vif *wdev_to_ieee80211_
  4050. - * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
  4051. - * that the key is pairwise rather then a shared key.
  4052. - * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a
  4053. -- * CCMP/GCMP key if it requires CCMP/GCMP encryption of management frames
  4054. -- * (MFP) to be done in software.
  4055. -+ * CCMP key if it requires CCMP encryption of management frames (MFP) to
  4056. -+ * be done in software.
  4057. - * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
  4058. - * if space should be prepared for the IV, but the IV
  4059. - * itself should not be generated. Do not set together with
  4060. -@@ -1322,7 +1322,7 @@ struct ieee80211_vif *wdev_to_ieee80211_
  4061. - * RX, if your crypto engine can't deal with TX you can also set the
  4062. - * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
  4063. - * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
  4064. -- * driver for a CCMP/GCMP key to indicate that is requires IV generation
  4065. -+ * driver for a CCMP key to indicate that is requires IV generation
  4066. - * only for managment frames (MFP).
  4067. - * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the
  4068. - * driver for a key to indicate that sufficient tailroom must always
  4069. -@@ -4112,10 +4112,6 @@ void ieee80211_aes_cmac_calculate_k1_k2(
  4070. - * reverse order than in packet)
  4071. - * @aes_cmac: PN data, most significant byte first (big endian,
  4072. - * reverse order than in packet)
  4073. -- * @aes_gmac: PN data, most significant byte first (big endian,
  4074. -- * reverse order than in packet)
  4075. -- * @gcmp: PN data, most significant byte first (big endian,
  4076. -- * reverse order than in packet)
  4077. - */
  4078. - struct ieee80211_key_seq {
  4079. - union {
  4080. -@@ -4129,12 +4125,6 @@ struct ieee80211_key_seq {
  4081. - struct {
  4082. - u8 pn[6];
  4083. - } aes_cmac;
  4084. -- struct {
  4085. -- u8 pn[6];
  4086. -- } aes_gmac;
  4087. -- struct {
  4088. -- u8 pn[6];
  4089. -- } gcmp;
  4090. - };
  4091. - };
  4092. -
  4093. -@@ -4159,7 +4149,7 @@ void ieee80211_get_key_tx_seq(struct iee
  4094. - * ieee80211_get_key_rx_seq - get 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: buffer to receive the sequence data
  4102. -@@ -4195,7 +4185,7 @@ void ieee80211_set_key_tx_seq(struct iee
  4103. - * ieee80211_set_key_rx_seq - set key RX sequence counter
  4104. - *
  4105. - * @keyconf: the parameter passed with the set key
  4106. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  4107. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  4108. - * the value on TID 0 is also used for non-QoS frames. For
  4109. - * CMAC, only TID 0 is valid.
  4110. - * @seq: new sequence data
  4111. ---- a/net/mac80211/Kconfig
  4112. -+++ b/net/mac80211/Kconfig
  4113. -@@ -5,8 +5,6 @@ config MAC80211
  4114. - depends on CRYPTO
  4115. - depends on CRYPTO_ARC4
  4116. - depends on CRYPTO_AES
  4117. -- select BPAUTO_CRYPTO_CCM
  4118. -- depends on CRYPTO_GCM
  4119. - depends on CRC32
  4120. - select BPAUTO_AVERAGE
  4121. - ---help---
  4122. ---- a/net/mac80211/Makefile
  4123. -+++ b/net/mac80211/Makefile
  4124. -@@ -15,9 +15,7 @@ mac80211-y := \
  4125. - michael.o \
  4126. - tkip.o \
  4127. - aes_ccm.o \
  4128. -- aes_gcm.o \
  4129. - aes_cmac.o \
  4130. -- aes_gmac.o \
  4131. - cfg.o \
  4132. - ethtool.o \
  4133. - rx.o \
  4134. ---- a/net/mac80211/aes_ccm.c
  4135. -+++ b/net/mac80211/aes_ccm.c
  4136. -@@ -2,8 +2,6 @@
  4137. - * Copyright 2003-2004, Instant802 Networks, Inc.
  4138. - * Copyright 2005-2006, Devicescape Software, Inc.
  4139. - *
  4140. -- * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
  4141. -- *
  4142. - * This program is free software; you can redistribute it and/or modify
  4143. - * it under the terms of the GNU General Public License version 2 as
  4144. - * published by the Free Software Foundation.
  4145. -@@ -19,82 +17,134 @@
  4146. - #include "key.h"
  4147. - #include "aes_ccm.h"
  4148. -
  4149. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4150. -- u8 *data, size_t data_len, u8 *mic,
  4151. -- size_t mic_len)
  4152. -+static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a)
  4153. -+{
  4154. -+ int i;
  4155. -+ u8 *b_0, *aad, *b, *s_0;
  4156. -+
  4157. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  4158. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  4159. -+ b = scratch;
  4160. -+ s_0 = scratch + AES_BLOCK_SIZE;
  4161. -+
  4162. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  4163. -+
  4164. -+ /* Extra Authenticate-only data (always two AES blocks) */
  4165. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  4166. -+ aad[i] ^= b[i];
  4167. -+ crypto_cipher_encrypt_one(tfm, b, aad);
  4168. -+
  4169. -+ aad += AES_BLOCK_SIZE;
  4170. -+
  4171. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  4172. -+ aad[i] ^= b[i];
  4173. -+ crypto_cipher_encrypt_one(tfm, a, aad);
  4174. -+
  4175. -+ /* Mask out bits from auth-only-b_0 */
  4176. -+ b_0[0] &= 0x07;
  4177. -+
  4178. -+ /* S_0 is used to encrypt T (= MIC) */
  4179. -+ b_0[14] = 0;
  4180. -+ b_0[15] = 0;
  4181. -+ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  4182. -+}
  4183. -+
  4184. -+
  4185. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  4186. -+ u8 *data, size_t data_len,
  4187. -+ u8 *cdata, u8 *mic)
  4188. - {
  4189. -- struct scatterlist assoc, pt, ct[2];
  4190. -+ int i, j, last_len, num_blocks;
  4191. -+ u8 *pos, *cpos, *b, *s_0, *e, *b_0;
  4192. -
  4193. -- char aead_req_data[sizeof(struct aead_request) +
  4194. -- crypto_aead_reqsize(tfm)]
  4195. -- __aligned(__alignof__(struct aead_request));
  4196. -- struct aead_request *aead_req = (void *) aead_req_data;
  4197. --
  4198. -- memset(aead_req, 0, sizeof(aead_req_data));
  4199. --
  4200. -- sg_init_one(&pt, data, data_len);
  4201. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4202. -- sg_init_table(ct, 2);
  4203. -- sg_set_buf(&ct[0], data, data_len);
  4204. -- sg_set_buf(&ct[1], mic, mic_len);
  4205. --
  4206. -- aead_request_set_tfm(aead_req, tfm);
  4207. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4208. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, b_0);
  4209. -+ b = scratch;
  4210. -+ s_0 = scratch + AES_BLOCK_SIZE;
  4211. -+ e = scratch + 2 * AES_BLOCK_SIZE;
  4212. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  4213. -+
  4214. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  4215. -+ last_len = data_len % AES_BLOCK_SIZE;
  4216. -+ aes_ccm_prepare(tfm, scratch, b);
  4217. -+
  4218. -+ /* Process payload blocks */
  4219. -+ pos = data;
  4220. -+ cpos = cdata;
  4221. -+ for (j = 1; j <= num_blocks; j++) {
  4222. -+ int blen = (j == num_blocks && last_len) ?
  4223. -+ last_len : AES_BLOCK_SIZE;
  4224. -+
  4225. -+ /* Authentication followed by encryption */
  4226. -+ for (i = 0; i < blen; i++)
  4227. -+ b[i] ^= pos[i];
  4228. -+ crypto_cipher_encrypt_one(tfm, b, b);
  4229. -+
  4230. -+ b_0[14] = (j >> 8) & 0xff;
  4231. -+ b_0[15] = j & 0xff;
  4232. -+ crypto_cipher_encrypt_one(tfm, e, b_0);
  4233. -+ for (i = 0; i < blen; i++)
  4234. -+ *cpos++ = *pos++ ^ e[i];
  4235. -+ }
  4236. -
  4237. -- crypto_aead_encrypt(aead_req);
  4238. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++)
  4239. -+ mic[i] = b[i] ^ s_0[i];
  4240. - }
  4241. -
  4242. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4243. -- u8 *data, size_t data_len, u8 *mic,
  4244. -- size_t mic_len)
  4245. -+
  4246. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  4247. -+ u8 *cdata, size_t data_len, u8 *mic, u8 *data)
  4248. - {
  4249. -- struct scatterlist assoc, pt, ct[2];
  4250. -- char aead_req_data[sizeof(struct aead_request) +
  4251. -- crypto_aead_reqsize(tfm)]
  4252. -- __aligned(__alignof__(struct aead_request));
  4253. -- struct aead_request *aead_req = (void *) aead_req_data;
  4254. --
  4255. -- if (data_len == 0)
  4256. -- return -EINVAL;
  4257. --
  4258. -- memset(aead_req, 0, sizeof(aead_req_data));
  4259. --
  4260. -- sg_init_one(&pt, data, data_len);
  4261. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4262. -- sg_init_table(ct, 2);
  4263. -- sg_set_buf(&ct[0], data, data_len);
  4264. -- sg_set_buf(&ct[1], mic, mic_len);
  4265. --
  4266. -- aead_request_set_tfm(aead_req, tfm);
  4267. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4268. -- aead_request_set_crypt(aead_req, ct, &pt, data_len + mic_len, b_0);
  4269. -+ int i, j, last_len, num_blocks;
  4270. -+ u8 *pos, *cpos, *b, *s_0, *a, *b_0;
  4271. -+
  4272. -+ b = scratch;
  4273. -+ s_0 = scratch + AES_BLOCK_SIZE;
  4274. -+ a = scratch + 2 * AES_BLOCK_SIZE;
  4275. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  4276. -+
  4277. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  4278. -+ last_len = data_len % AES_BLOCK_SIZE;
  4279. -+ aes_ccm_prepare(tfm, scratch, a);
  4280. -+
  4281. -+ /* Process payload blocks */
  4282. -+ cpos = cdata;
  4283. -+ pos = data;
  4284. -+ for (j = 1; j <= num_blocks; j++) {
  4285. -+ int blen = (j == num_blocks && last_len) ?
  4286. -+ last_len : AES_BLOCK_SIZE;
  4287. -+
  4288. -+ /* Decryption followed by authentication */
  4289. -+ b_0[14] = (j >> 8) & 0xff;
  4290. -+ b_0[15] = j & 0xff;
  4291. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  4292. -+ for (i = 0; i < blen; i++) {
  4293. -+ *pos = *cpos++ ^ b[i];
  4294. -+ a[i] ^= *pos++;
  4295. -+ }
  4296. -+ crypto_cipher_encrypt_one(tfm, a, a);
  4297. -+ }
  4298. -+
  4299. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) {
  4300. -+ if ((mic[i] ^ s_0[i]) != a[i])
  4301. -+ return -1;
  4302. -+ }
  4303. -
  4304. -- return crypto_aead_decrypt(aead_req);
  4305. -+ return 0;
  4306. - }
  4307. -
  4308. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4309. -- size_t key_len,
  4310. -- size_t mic_len)
  4311. -+
  4312. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])
  4313. - {
  4314. -- struct crypto_aead *tfm;
  4315. -- int err;
  4316. -+ struct crypto_cipher *tfm;
  4317. -
  4318. -- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  4319. -- if (IS_ERR(tfm))
  4320. -- return tfm;
  4321. --
  4322. -- err = crypto_aead_setkey(tfm, key, key_len);
  4323. -- if (!err)
  4324. -- err = crypto_aead_setauthsize(tfm, mic_len);
  4325. -- if (!err)
  4326. -- return tfm;
  4327. -+ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  4328. -+ if (!IS_ERR(tfm))
  4329. -+ crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
  4330. -
  4331. -- crypto_free_aead(tfm);
  4332. -- return ERR_PTR(err);
  4333. -+ return tfm;
  4334. - }
  4335. -
  4336. --void ieee80211_aes_key_free(struct crypto_aead *tfm)
  4337. -+
  4338. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  4339. - {
  4340. -- crypto_free_aead(tfm);
  4341. -+ crypto_free_cipher(tfm);
  4342. - }
  4343. ---- a/net/mac80211/aes_ccm.h
  4344. -+++ b/net/mac80211/aes_ccm.h
  4345. -@@ -12,15 +12,13 @@
  4346. -
  4347. - #include <linux/crypto.h>
  4348. -
  4349. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4350. -- size_t key_len,
  4351. -- size_t mic_len);
  4352. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4353. -- u8 *data, size_t data_len, u8 *mic,
  4354. -- size_t mic_len);
  4355. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4356. -- u8 *data, size_t data_len, u8 *mic,
  4357. -- size_t mic_len);
  4358. --void ieee80211_aes_key_free(struct crypto_aead *tfm);
  4359. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]);
  4360. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  4361. -+ u8 *data, size_t data_len,
  4362. -+ u8 *cdata, u8 *mic);
  4363. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  4364. -+ u8 *cdata, size_t data_len,
  4365. -+ u8 *mic, u8 *data);
  4366. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  4367. -
  4368. - #endif /* AES_CCM_H */
  4369. ---- a/net/mac80211/aes_cmac.c
  4370. -+++ b/net/mac80211/aes_cmac.c
  4371. -@@ -18,8 +18,8 @@
  4372. - #include "key.h"
  4373. - #include "aes_cmac.h"
  4374. -
  4375. -+#define AES_CMAC_KEY_LEN 16
  4376. - #define CMAC_TLEN 8 /* CMAC TLen = 64 bits (8 octets) */
  4377. --#define CMAC_TLEN_256 16 /* CMAC TLen = 128 bits (16 octets) */
  4378. - #define AAD_LEN 20
  4379. -
  4380. -
  4381. -@@ -35,9 +35,9 @@ static void gf_mulx(u8 *pad)
  4382. - pad[AES_BLOCK_SIZE - 1] ^= 0x87;
  4383. - }
  4384. -
  4385. --static void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  4386. -- const u8 *addr[], const size_t *len, u8 *mac,
  4387. -- size_t mac_len)
  4388. -+
  4389. -+static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  4390. -+ const u8 *addr[], const size_t *len, u8 *mac)
  4391. - {
  4392. - u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
  4393. - const u8 *pos, *end;
  4394. -@@ -88,7 +88,7 @@ static void aes_cmac_vector(struct crypt
  4395. - for (i = 0; i < AES_BLOCK_SIZE; i++)
  4396. - pad[i] ^= cbc[i];
  4397. - crypto_cipher_encrypt_one(tfm, pad, pad);
  4398. -- memcpy(mac, pad, mac_len);
  4399. -+ memcpy(mac, pad, CMAC_TLEN);
  4400. - }
  4401. -
  4402. -
  4403. -@@ -107,35 +107,17 @@ void ieee80211_aes_cmac(struct crypto_ci
  4404. - addr[2] = zero;
  4405. - len[2] = CMAC_TLEN;
  4406. -
  4407. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN);
  4408. -+ aes_128_cmac_vector(tfm, 3, addr, len, mic);
  4409. - }
  4410. -
  4411. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  4412. -- const u8 *data, size_t data_len, u8 *mic)
  4413. --{
  4414. -- const u8 *addr[3];
  4415. -- size_t len[3];
  4416. -- u8 zero[CMAC_TLEN_256];
  4417. --
  4418. -- memset(zero, 0, CMAC_TLEN_256);
  4419. -- addr[0] = aad;
  4420. -- len[0] = AAD_LEN;
  4421. -- addr[1] = data;
  4422. -- len[1] = data_len - CMAC_TLEN_256;
  4423. -- addr[2] = zero;
  4424. -- len[2] = CMAC_TLEN_256;
  4425. --
  4426. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN_256);
  4427. --}
  4428. -
  4429. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  4430. -- size_t key_len)
  4431. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[])
  4432. - {
  4433. - struct crypto_cipher *tfm;
  4434. -
  4435. - tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  4436. - if (!IS_ERR(tfm))
  4437. -- crypto_cipher_setkey(tfm, key, key_len);
  4438. -+ crypto_cipher_setkey(tfm, key, AES_CMAC_KEY_LEN);
  4439. -
  4440. - return tfm;
  4441. - }
  4442. ---- a/net/mac80211/aes_cmac.h
  4443. -+++ b/net/mac80211/aes_cmac.h
  4444. -@@ -11,12 +11,9 @@
  4445. -
  4446. - #include <linux/crypto.h>
  4447. -
  4448. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  4449. -- size_t key_len);
  4450. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]);
  4451. - void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,
  4452. - const u8 *data, size_t data_len, u8 *mic);
  4453. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  4454. -- const u8 *data, size_t data_len, u8 *mic);
  4455. - void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm);
  4456. -
  4457. - #endif /* AES_CMAC_H */
  4458. ---- a/net/mac80211/aes_gcm.c
  4459. -+++ /dev/null
  4460. -@@ -1,95 +0,0 @@
  4461. --/*
  4462. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  4463. -- *
  4464. -- * This program is free software; you can redistribute it and/or modify
  4465. -- * it under the terms of the GNU General Public License version 2 as
  4466. -- * published by the Free Software Foundation.
  4467. -- */
  4468. --
  4469. --#include <linux/kernel.h>
  4470. --#include <linux/types.h>
  4471. --#include <linux/crypto.h>
  4472. --#include <linux/err.h>
  4473. --#include <crypto/aes.h>
  4474. --
  4475. --#include <net/mac80211.h>
  4476. --#include "key.h"
  4477. --#include "aes_gcm.h"
  4478. --
  4479. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4480. -- u8 *data, size_t data_len, u8 *mic)
  4481. --{
  4482. -- struct scatterlist assoc, pt, ct[2];
  4483. --
  4484. -- char aead_req_data[sizeof(struct aead_request) +
  4485. -- crypto_aead_reqsize(tfm)]
  4486. -- __aligned(__alignof__(struct aead_request));
  4487. -- struct aead_request *aead_req = (void *)aead_req_data;
  4488. --
  4489. -- memset(aead_req, 0, sizeof(aead_req_data));
  4490. --
  4491. -- sg_init_one(&pt, data, data_len);
  4492. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4493. -- sg_init_table(ct, 2);
  4494. -- sg_set_buf(&ct[0], data, data_len);
  4495. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  4496. --
  4497. -- aead_request_set_tfm(aead_req, tfm);
  4498. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4499. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, j_0);
  4500. --
  4501. -- crypto_aead_encrypt(aead_req);
  4502. --}
  4503. --
  4504. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4505. -- u8 *data, size_t data_len, u8 *mic)
  4506. --{
  4507. -- struct scatterlist assoc, pt, ct[2];
  4508. -- char aead_req_data[sizeof(struct aead_request) +
  4509. -- crypto_aead_reqsize(tfm)]
  4510. -- __aligned(__alignof__(struct aead_request));
  4511. -- struct aead_request *aead_req = (void *)aead_req_data;
  4512. --
  4513. -- if (data_len == 0)
  4514. -- return -EINVAL;
  4515. --
  4516. -- memset(aead_req, 0, sizeof(aead_req_data));
  4517. --
  4518. -- sg_init_one(&pt, data, data_len);
  4519. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4520. -- sg_init_table(ct, 2);
  4521. -- sg_set_buf(&ct[0], data, data_len);
  4522. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  4523. --
  4524. -- aead_request_set_tfm(aead_req, tfm);
  4525. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4526. -- aead_request_set_crypt(aead_req, ct, &pt,
  4527. -- data_len + IEEE80211_GCMP_MIC_LEN, j_0);
  4528. --
  4529. -- return crypto_aead_decrypt(aead_req);
  4530. --}
  4531. --
  4532. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  4533. -- size_t key_len)
  4534. --{
  4535. -- struct crypto_aead *tfm;
  4536. -- int err;
  4537. --
  4538. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  4539. -- if (IS_ERR(tfm))
  4540. -- return tfm;
  4541. --
  4542. -- err = crypto_aead_setkey(tfm, key, key_len);
  4543. -- if (!err)
  4544. -- err = crypto_aead_setauthsize(tfm, IEEE80211_GCMP_MIC_LEN);
  4545. -- if (!err)
  4546. -- return tfm;
  4547. --
  4548. -- crypto_free_aead(tfm);
  4549. -- return ERR_PTR(err);
  4550. --}
  4551. --
  4552. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  4553. --{
  4554. -- crypto_free_aead(tfm);
  4555. --}
  4556. ---- a/net/mac80211/aes_gcm.h
  4557. -+++ /dev/null
  4558. -@@ -1,22 +0,0 @@
  4559. --/*
  4560. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  4561. -- *
  4562. -- * This program is free software; you can redistribute it and/or modify
  4563. -- * it under the terms of the GNU General Public License version 2 as
  4564. -- * published by the Free Software Foundation.
  4565. -- */
  4566. --
  4567. --#ifndef AES_GCM_H
  4568. --#define AES_GCM_H
  4569. --
  4570. --#include <linux/crypto.h>
  4571. --
  4572. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4573. -- u8 *data, size_t data_len, u8 *mic);
  4574. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4575. -- u8 *data, size_t data_len, u8 *mic);
  4576. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  4577. -- size_t key_len);
  4578. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  4579. --
  4580. --#endif /* AES_GCM_H */
  4581. ---- a/net/mac80211/aes_gmac.c
  4582. -+++ /dev/null
  4583. -@@ -1,84 +0,0 @@
  4584. --/*
  4585. -- * AES-GMAC for IEEE 802.11 BIP-GMAC-128 and BIP-GMAC-256
  4586. -- * Copyright 2015, Qualcomm Atheros, Inc.
  4587. -- *
  4588. -- * This program is free software; you can redistribute it and/or modify
  4589. -- * it under the terms of the GNU General Public License version 2 as
  4590. -- * published by the Free Software Foundation.
  4591. -- */
  4592. --
  4593. --#include <linux/kernel.h>
  4594. --#include <linux/types.h>
  4595. --#include <linux/crypto.h>
  4596. --#include <linux/err.h>
  4597. --#include <crypto/aes.h>
  4598. --
  4599. --#include <net/mac80211.h>
  4600. --#include "key.h"
  4601. --#include "aes_gmac.h"
  4602. --
  4603. --#define GMAC_MIC_LEN 16
  4604. --#define GMAC_NONCE_LEN 12
  4605. --#define AAD_LEN 20
  4606. --
  4607. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4608. -- const u8 *data, size_t data_len, u8 *mic)
  4609. --{
  4610. -- struct scatterlist sg[3], ct[1];
  4611. -- char aead_req_data[sizeof(struct aead_request) +
  4612. -- crypto_aead_reqsize(tfm)]
  4613. -- __aligned(__alignof__(struct aead_request));
  4614. -- struct aead_request *aead_req = (void *)aead_req_data;
  4615. -- u8 zero[GMAC_MIC_LEN], iv[AES_BLOCK_SIZE];
  4616. --
  4617. -- if (data_len < GMAC_MIC_LEN)
  4618. -- return -EINVAL;
  4619. --
  4620. -- memset(aead_req, 0, sizeof(aead_req_data));
  4621. --
  4622. -- memset(zero, 0, GMAC_MIC_LEN);
  4623. -- sg_init_table(sg, 3);
  4624. -- sg_set_buf(&sg[0], aad, AAD_LEN);
  4625. -- sg_set_buf(&sg[1], data, data_len - GMAC_MIC_LEN);
  4626. -- sg_set_buf(&sg[2], zero, GMAC_MIC_LEN);
  4627. --
  4628. -- memcpy(iv, nonce, GMAC_NONCE_LEN);
  4629. -- memset(iv + GMAC_NONCE_LEN, 0, sizeof(iv) - GMAC_NONCE_LEN);
  4630. -- iv[AES_BLOCK_SIZE - 1] = 0x01;
  4631. --
  4632. -- sg_init_table(ct, 1);
  4633. -- sg_set_buf(&ct[0], mic, GMAC_MIC_LEN);
  4634. --
  4635. -- aead_request_set_tfm(aead_req, tfm);
  4636. -- aead_request_set_assoc(aead_req, sg, AAD_LEN + data_len);
  4637. -- aead_request_set_crypt(aead_req, NULL, ct, 0, iv);
  4638. --
  4639. -- crypto_aead_encrypt(aead_req);
  4640. --
  4641. -- return 0;
  4642. --}
  4643. --
  4644. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  4645. -- size_t key_len)
  4646. --{
  4647. -- struct crypto_aead *tfm;
  4648. -- int err;
  4649. --
  4650. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  4651. -- if (IS_ERR(tfm))
  4652. -- return tfm;
  4653. --
  4654. -- err = crypto_aead_setkey(tfm, key, key_len);
  4655. -- if (!err)
  4656. -- return tfm;
  4657. -- if (!err)
  4658. -- err = crypto_aead_setauthsize(tfm, GMAC_MIC_LEN);
  4659. --
  4660. -- crypto_free_aead(tfm);
  4661. -- return ERR_PTR(err);
  4662. --}
  4663. --
  4664. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  4665. --{
  4666. -- crypto_free_aead(tfm);
  4667. --}
  4668. ---- a/net/mac80211/aes_gmac.h
  4669. -+++ /dev/null
  4670. -@@ -1,20 +0,0 @@
  4671. --/*
  4672. -- * Copyright 2015, Qualcomm Atheros, Inc.
  4673. -- *
  4674. -- * This program is free software; you can redistribute it and/or modify
  4675. -- * it under the terms of the GNU General Public License version 2 as
  4676. -- * published by the Free Software Foundation.
  4677. -- */
  4678. --
  4679. --#ifndef AES_GMAC_H
  4680. --#define AES_GMAC_H
  4681. --
  4682. --#include <linux/crypto.h>
  4683. --
  4684. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  4685. -- size_t key_len);
  4686. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4687. -- const u8 *data, size_t data_len, u8 *mic);
  4688. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  4689. --
  4690. --#endif /* AES_GMAC_H */
  4691. ---- a/net/mac80211/cfg.c
  4692. -+++ b/net/mac80211/cfg.c
  4693. -@@ -162,13 +162,8 @@ static int ieee80211_add_key(struct wiph
  4694. - return -EINVAL;
  4695. - break;
  4696. - case WLAN_CIPHER_SUITE_CCMP:
  4697. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4698. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4699. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4700. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4701. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4702. - case WLAN_CIPHER_SUITE_GCMP:
  4703. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4704. - break;
  4705. - default:
  4706. - cs = ieee80211_cs_get(local, params->cipher, sdata->vif.type);
  4707. -@@ -353,7 +348,6 @@ static int ieee80211_get_key(struct wiph
  4708. - params.seq_len = 6;
  4709. - break;
  4710. - case WLAN_CIPHER_SUITE_CCMP:
  4711. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4712. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  4713. - seq[0] = pn64;
  4714. - seq[1] = pn64 >> 8;
  4715. -@@ -365,35 +359,10 @@ static int ieee80211_get_key(struct wiph
  4716. - params.seq_len = 6;
  4717. - break;
  4718. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4719. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4720. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  4721. - seq[0] = pn64;
  4722. - seq[1] = pn64 >> 8;
  4723. - seq[2] = pn64 >> 16;
  4724. -- seq[3] = pn64 >> 24;
  4725. -- seq[4] = pn64 >> 32;
  4726. -- seq[5] = pn64 >> 40;
  4727. -- params.seq = seq;
  4728. -- params.seq_len = 6;
  4729. -- break;
  4730. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4731. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4732. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  4733. -- seq[0] = pn64;
  4734. -- seq[1] = pn64 >> 8;
  4735. -- seq[2] = pn64 >> 16;
  4736. -- seq[3] = pn64 >> 24;
  4737. -- seq[4] = pn64 >> 32;
  4738. -- seq[5] = pn64 >> 40;
  4739. -- params.seq = seq;
  4740. -- params.seq_len = 6;
  4741. -- break;
  4742. -- case WLAN_CIPHER_SUITE_GCMP:
  4743. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4744. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  4745. -- seq[0] = pn64;
  4746. -- seq[1] = pn64 >> 8;
  4747. -- seq[2] = pn64 >> 16;
  4748. - seq[3] = pn64 >> 24;
  4749. - seq[4] = pn64 >> 32;
  4750. - seq[5] = pn64 >> 40;
  4751. ---- a/net/mac80211/debugfs_key.c
  4752. -+++ b/net/mac80211/debugfs_key.c
  4753. -@@ -94,33 +94,17 @@ static ssize_t key_tx_spec_read(struct f
  4754. - key->u.tkip.tx.iv16);
  4755. - break;
  4756. - case WLAN_CIPHER_SUITE_CCMP:
  4757. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4758. - pn = atomic64_read(&key->u.ccmp.tx_pn);
  4759. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4760. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4761. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4762. - break;
  4763. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4764. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4765. - pn = atomic64_read(&key->u.aes_cmac.tx_pn);
  4766. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4767. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4768. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4769. - break;
  4770. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4771. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4772. -- pn = atomic64_read(&key->u.aes_gmac.tx_pn);
  4773. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4774. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4775. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4776. -- break;
  4777. -- case WLAN_CIPHER_SUITE_GCMP:
  4778. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4779. -- pn = atomic64_read(&key->u.gcmp.tx_pn);
  4780. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4781. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4782. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4783. -- break;
  4784. - default:
  4785. - return 0;
  4786. - }
  4787. -@@ -150,7 +134,6 @@ static ssize_t key_rx_spec_read(struct f
  4788. - len = p - buf;
  4789. - break;
  4790. - case WLAN_CIPHER_SUITE_CCMP:
  4791. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4792. - for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  4793. - rpn = key->u.ccmp.rx_pn[i];
  4794. - p += scnprintf(p, sizeof(buf)+buf-p,
  4795. -@@ -161,7 +144,6 @@ static ssize_t key_rx_spec_read(struct f
  4796. - len = p - buf;
  4797. - break;
  4798. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4799. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4800. - rpn = key->u.aes_cmac.rx_pn;
  4801. - p += scnprintf(p, sizeof(buf)+buf-p,
  4802. - "%02x%02x%02x%02x%02x%02x\n",
  4803. -@@ -169,26 +151,6 @@ static ssize_t key_rx_spec_read(struct f
  4804. - rpn[3], rpn[4], rpn[5]);
  4805. - len = p - buf;
  4806. - break;
  4807. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4808. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4809. -- rpn = key->u.aes_gmac.rx_pn;
  4810. -- p += scnprintf(p, sizeof(buf)+buf-p,
  4811. -- "%02x%02x%02x%02x%02x%02x\n",
  4812. -- rpn[0], rpn[1], rpn[2],
  4813. -- rpn[3], rpn[4], rpn[5]);
  4814. -- len = p - buf;
  4815. -- break;
  4816. -- case WLAN_CIPHER_SUITE_GCMP:
  4817. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4818. -- for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  4819. -- rpn = key->u.gcmp.rx_pn[i];
  4820. -- p += scnprintf(p, sizeof(buf)+buf-p,
  4821. -- "%02x%02x%02x%02x%02x%02x\n",
  4822. -- rpn[0], rpn[1], rpn[2],
  4823. -- rpn[3], rpn[4], rpn[5]);
  4824. -- }
  4825. -- len = p - buf;
  4826. -- break;
  4827. - default:
  4828. - return 0;
  4829. - }
  4830. -@@ -205,23 +167,12 @@ static ssize_t key_replays_read(struct f
  4831. -
  4832. - switch (key->conf.cipher) {
  4833. - case WLAN_CIPHER_SUITE_CCMP:
  4834. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4835. - len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays);
  4836. - break;
  4837. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4838. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4839. - len = scnprintf(buf, sizeof(buf), "%u\n",
  4840. - key->u.aes_cmac.replays);
  4841. - break;
  4842. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4843. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4844. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  4845. -- key->u.aes_gmac.replays);
  4846. -- break;
  4847. -- case WLAN_CIPHER_SUITE_GCMP:
  4848. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4849. -- len = scnprintf(buf, sizeof(buf), "%u\n", key->u.gcmp.replays);
  4850. -- break;
  4851. - default:
  4852. - return 0;
  4853. - }
  4854. -@@ -238,15 +189,9 @@ static ssize_t key_icverrors_read(struct
  4855. -
  4856. - switch (key->conf.cipher) {
  4857. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4858. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4859. - len = scnprintf(buf, sizeof(buf), "%u\n",
  4860. - key->u.aes_cmac.icverrors);
  4861. - break;
  4862. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4863. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4864. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  4865. -- key->u.aes_gmac.icverrors);
  4866. -- break;
  4867. - default:
  4868. - return 0;
  4869. - }
  4870. ---- a/net/mac80211/key.c
  4871. -+++ b/net/mac80211/key.c
  4872. -@@ -24,8 +24,6 @@
  4873. - #include "debugfs_key.h"
  4874. - #include "aes_ccm.h"
  4875. - #include "aes_cmac.h"
  4876. --#include "aes_gmac.h"
  4877. --#include "aes_gcm.h"
  4878. -
  4879. -
  4880. - /**
  4881. -@@ -164,13 +162,7 @@ static int ieee80211_key_enable_hw_accel
  4882. - case WLAN_CIPHER_SUITE_WEP104:
  4883. - case WLAN_CIPHER_SUITE_TKIP:
  4884. - case WLAN_CIPHER_SUITE_CCMP:
  4885. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4886. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4887. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4888. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4889. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4890. -- case WLAN_CIPHER_SUITE_GCMP:
  4891. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4892. - /* all of these we can do in software - if driver can */
  4893. - if (ret == 1)
  4894. - return 0;
  4895. -@@ -394,26 +386,7 @@ ieee80211_key_alloc(u32 cipher, int idx,
  4896. - * Initialize AES key state here as an optimization so that
  4897. - * it does not need to be initialized for every packet.
  4898. - */
  4899. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  4900. -- key_data, key_len, IEEE80211_CCMP_MIC_LEN);
  4901. -- if (IS_ERR(key->u.ccmp.tfm)) {
  4902. -- err = PTR_ERR(key->u.ccmp.tfm);
  4903. -- kfree(key);
  4904. -- return ERR_PTR(err);
  4905. -- }
  4906. -- break;
  4907. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4908. -- key->conf.iv_len = IEEE80211_CCMP_256_HDR_LEN;
  4909. -- key->conf.icv_len = IEEE80211_CCMP_256_MIC_LEN;
  4910. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  4911. -- for (j = 0; j < IEEE80211_CCMP_256_PN_LEN; j++)
  4912. -- key->u.ccmp.rx_pn[i][j] =
  4913. -- seq[IEEE80211_CCMP_256_PN_LEN - j - 1];
  4914. -- /* Initialize AES key state here as an optimization so that
  4915. -- * it does not need to be initialized for every packet.
  4916. -- */
  4917. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  4918. -- key_data, key_len, IEEE80211_CCMP_256_MIC_LEN);
  4919. -+ key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(key_data);
  4920. - if (IS_ERR(key->u.ccmp.tfm)) {
  4921. - err = PTR_ERR(key->u.ccmp.tfm);
  4922. - kfree(key);
  4923. -@@ -421,12 +394,8 @@ ieee80211_key_alloc(u32 cipher, int idx,
  4924. - }
  4925. - break;
  4926. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4927. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4928. - key->conf.iv_len = 0;
  4929. -- if (cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  4930. -- key->conf.icv_len = sizeof(struct ieee80211_mmie);
  4931. -- else
  4932. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  4933. -+ key->conf.icv_len = sizeof(struct ieee80211_mmie);
  4934. - if (seq)
  4935. - for (j = 0; j < IEEE80211_CMAC_PN_LEN; j++)
  4936. - key->u.aes_cmac.rx_pn[j] =
  4937. -@@ -436,51 +405,13 @@ ieee80211_key_alloc(u32 cipher, int idx,
  4938. - * it does not need to be initialized for every packet.
  4939. - */
  4940. - key->u.aes_cmac.tfm =
  4941. -- ieee80211_aes_cmac_key_setup(key_data, key_len);
  4942. -+ ieee80211_aes_cmac_key_setup(key_data);
  4943. - if (IS_ERR(key->u.aes_cmac.tfm)) {
  4944. - err = PTR_ERR(key->u.aes_cmac.tfm);
  4945. - kfree(key);
  4946. - return ERR_PTR(err);
  4947. - }
  4948. - break;
  4949. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4950. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4951. -- key->conf.iv_len = 0;
  4952. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  4953. -- if (seq)
  4954. -- for (j = 0; j < IEEE80211_GMAC_PN_LEN; j++)
  4955. -- key->u.aes_gmac.rx_pn[j] =
  4956. -- seq[IEEE80211_GMAC_PN_LEN - j - 1];
  4957. -- /* Initialize AES key state here as an optimization so that
  4958. -- * it does not need to be initialized for every packet.
  4959. -- */
  4960. -- key->u.aes_gmac.tfm =
  4961. -- ieee80211_aes_gmac_key_setup(key_data, key_len);
  4962. -- if (IS_ERR(key->u.aes_gmac.tfm)) {
  4963. -- err = PTR_ERR(key->u.aes_gmac.tfm);
  4964. -- kfree(key);
  4965. -- return ERR_PTR(err);
  4966. -- }
  4967. -- break;
  4968. -- case WLAN_CIPHER_SUITE_GCMP:
  4969. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4970. -- key->conf.iv_len = IEEE80211_GCMP_HDR_LEN;
  4971. -- key->conf.icv_len = IEEE80211_GCMP_MIC_LEN;
  4972. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  4973. -- for (j = 0; j < IEEE80211_GCMP_PN_LEN; j++)
  4974. -- key->u.gcmp.rx_pn[i][j] =
  4975. -- seq[IEEE80211_GCMP_PN_LEN - j - 1];
  4976. -- /* Initialize AES key state here as an optimization so that
  4977. -- * it does not need to be initialized for every packet.
  4978. -- */
  4979. -- key->u.gcmp.tfm = ieee80211_aes_gcm_key_setup_encrypt(key_data,
  4980. -- key_len);
  4981. -- if (IS_ERR(key->u.gcmp.tfm)) {
  4982. -- err = PTR_ERR(key->u.gcmp.tfm);
  4983. -- kfree(key);
  4984. -- return ERR_PTR(err);
  4985. -- }
  4986. -- break;
  4987. - default:
  4988. - if (cs) {
  4989. - size_t len = (seq_len > MAX_PN_LEN) ?
  4990. -@@ -502,24 +433,10 @@ ieee80211_key_alloc(u32 cipher, int idx,
  4991. -
  4992. - static void ieee80211_key_free_common(struct ieee80211_key *key)
  4993. - {
  4994. -- switch (key->conf.cipher) {
  4995. -- case WLAN_CIPHER_SUITE_CCMP:
  4996. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4997. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_CCMP)
  4998. - ieee80211_aes_key_free(key->u.ccmp.tfm);
  4999. -- break;
  5000. -- case WLAN_CIPHER_SUITE_AES_CMAC:
  5001. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5002. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  5003. - ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
  5004. -- break;
  5005. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5006. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5007. -- ieee80211_aes_gmac_key_free(key->u.aes_gmac.tfm);
  5008. -- break;
  5009. -- case WLAN_CIPHER_SUITE_GCMP:
  5010. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5011. -- ieee80211_aes_gcm_key_free(key->u.gcmp.tfm);
  5012. -- break;
  5013. -- }
  5014. - kzfree(key);
  5015. - }
  5016. -
  5017. -@@ -826,7 +743,6 @@ void ieee80211_get_key_tx_seq(struct iee
  5018. - seq->tkip.iv16 = key->u.tkip.tx.iv16;
  5019. - break;
  5020. - case WLAN_CIPHER_SUITE_CCMP:
  5021. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5022. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  5023. - seq->ccmp.pn[5] = pn64;
  5024. - seq->ccmp.pn[4] = pn64 >> 8;
  5025. -@@ -836,7 +752,6 @@ void ieee80211_get_key_tx_seq(struct iee
  5026. - seq->ccmp.pn[0] = pn64 >> 40;
  5027. - break;
  5028. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5029. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5030. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  5031. - seq->ccmp.pn[5] = pn64;
  5032. - seq->ccmp.pn[4] = pn64 >> 8;
  5033. -@@ -845,26 +760,6 @@ void ieee80211_get_key_tx_seq(struct iee
  5034. - seq->ccmp.pn[1] = pn64 >> 32;
  5035. - seq->ccmp.pn[0] = pn64 >> 40;
  5036. - break;
  5037. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5038. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5039. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  5040. -- seq->ccmp.pn[5] = pn64;
  5041. -- seq->ccmp.pn[4] = pn64 >> 8;
  5042. -- seq->ccmp.pn[3] = pn64 >> 16;
  5043. -- seq->ccmp.pn[2] = pn64 >> 24;
  5044. -- seq->ccmp.pn[1] = pn64 >> 32;
  5045. -- seq->ccmp.pn[0] = pn64 >> 40;
  5046. -- break;
  5047. -- case WLAN_CIPHER_SUITE_GCMP:
  5048. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5049. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  5050. -- seq->gcmp.pn[5] = pn64;
  5051. -- seq->gcmp.pn[4] = pn64 >> 8;
  5052. -- seq->gcmp.pn[3] = pn64 >> 16;
  5053. -- seq->gcmp.pn[2] = pn64 >> 24;
  5054. -- seq->gcmp.pn[1] = pn64 >> 32;
  5055. -- seq->gcmp.pn[0] = pn64 >> 40;
  5056. -- break;
  5057. - default:
  5058. - WARN_ON(1);
  5059. - }
  5060. -@@ -887,7 +782,6 @@ void ieee80211_get_key_rx_seq(struct iee
  5061. - seq->tkip.iv16 = key->u.tkip.rx[tid].iv16;
  5062. - break;
  5063. - case WLAN_CIPHER_SUITE_CCMP:
  5064. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5065. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5066. - return;
  5067. - if (tid < 0)
  5068. -@@ -897,29 +791,11 @@ void ieee80211_get_key_rx_seq(struct iee
  5069. - memcpy(seq->ccmp.pn, pn, IEEE80211_CCMP_PN_LEN);
  5070. - break;
  5071. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5072. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5073. - if (WARN_ON(tid != 0))
  5074. - return;
  5075. - pn = key->u.aes_cmac.rx_pn;
  5076. - memcpy(seq->aes_cmac.pn, pn, IEEE80211_CMAC_PN_LEN);
  5077. - break;
  5078. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5079. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5080. -- if (WARN_ON(tid != 0))
  5081. -- return;
  5082. -- pn = key->u.aes_gmac.rx_pn;
  5083. -- memcpy(seq->aes_gmac.pn, pn, IEEE80211_GMAC_PN_LEN);
  5084. -- break;
  5085. -- case WLAN_CIPHER_SUITE_GCMP:
  5086. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5087. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5088. -- return;
  5089. -- if (tid < 0)
  5090. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  5091. -- else
  5092. -- pn = key->u.gcmp.rx_pn[tid];
  5093. -- memcpy(seq->gcmp.pn, pn, IEEE80211_GCMP_PN_LEN);
  5094. -- break;
  5095. - }
  5096. - }
  5097. - EXPORT_SYMBOL(ieee80211_get_key_rx_seq);
  5098. -@@ -938,7 +814,6 @@ void ieee80211_set_key_tx_seq(struct iee
  5099. - key->u.tkip.tx.iv16 = seq->tkip.iv16;
  5100. - break;
  5101. - case WLAN_CIPHER_SUITE_CCMP:
  5102. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5103. - pn64 = (u64)seq->ccmp.pn[5] |
  5104. - ((u64)seq->ccmp.pn[4] << 8) |
  5105. - ((u64)seq->ccmp.pn[3] << 16) |
  5106. -@@ -948,7 +823,6 @@ void ieee80211_set_key_tx_seq(struct iee
  5107. - atomic64_set(&key->u.ccmp.tx_pn, pn64);
  5108. - break;
  5109. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5110. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5111. - pn64 = (u64)seq->aes_cmac.pn[5] |
  5112. - ((u64)seq->aes_cmac.pn[4] << 8) |
  5113. - ((u64)seq->aes_cmac.pn[3] << 16) |
  5114. -@@ -957,26 +831,6 @@ void ieee80211_set_key_tx_seq(struct iee
  5115. - ((u64)seq->aes_cmac.pn[0] << 40);
  5116. - atomic64_set(&key->u.aes_cmac.tx_pn, pn64);
  5117. - break;
  5118. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5119. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5120. -- pn64 = (u64)seq->aes_gmac.pn[5] |
  5121. -- ((u64)seq->aes_gmac.pn[4] << 8) |
  5122. -- ((u64)seq->aes_gmac.pn[3] << 16) |
  5123. -- ((u64)seq->aes_gmac.pn[2] << 24) |
  5124. -- ((u64)seq->aes_gmac.pn[1] << 32) |
  5125. -- ((u64)seq->aes_gmac.pn[0] << 40);
  5126. -- atomic64_set(&key->u.aes_gmac.tx_pn, pn64);
  5127. -- break;
  5128. -- case WLAN_CIPHER_SUITE_GCMP:
  5129. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5130. -- pn64 = (u64)seq->gcmp.pn[5] |
  5131. -- ((u64)seq->gcmp.pn[4] << 8) |
  5132. -- ((u64)seq->gcmp.pn[3] << 16) |
  5133. -- ((u64)seq->gcmp.pn[2] << 24) |
  5134. -- ((u64)seq->gcmp.pn[1] << 32) |
  5135. -- ((u64)seq->gcmp.pn[0] << 40);
  5136. -- atomic64_set(&key->u.gcmp.tx_pn, pn64);
  5137. -- break;
  5138. - default:
  5139. - WARN_ON(1);
  5140. - break;
  5141. -@@ -1000,7 +854,6 @@ void ieee80211_set_key_rx_seq(struct iee
  5142. - key->u.tkip.rx[tid].iv16 = seq->tkip.iv16;
  5143. - break;
  5144. - case WLAN_CIPHER_SUITE_CCMP:
  5145. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5146. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5147. - return;
  5148. - if (tid < 0)
  5149. -@@ -1010,29 +863,11 @@ void ieee80211_set_key_rx_seq(struct iee
  5150. - memcpy(pn, seq->ccmp.pn, IEEE80211_CCMP_PN_LEN);
  5151. - break;
  5152. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5153. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5154. - if (WARN_ON(tid != 0))
  5155. - return;
  5156. - pn = key->u.aes_cmac.rx_pn;
  5157. - memcpy(pn, seq->aes_cmac.pn, IEEE80211_CMAC_PN_LEN);
  5158. - break;
  5159. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5160. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5161. -- if (WARN_ON(tid != 0))
  5162. -- return;
  5163. -- pn = key->u.aes_gmac.rx_pn;
  5164. -- memcpy(pn, seq->aes_gmac.pn, IEEE80211_GMAC_PN_LEN);
  5165. -- break;
  5166. -- case WLAN_CIPHER_SUITE_GCMP:
  5167. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5168. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5169. -- return;
  5170. -- if (tid < 0)
  5171. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  5172. -- else
  5173. -- pn = key->u.gcmp.rx_pn[tid];
  5174. -- memcpy(pn, seq->gcmp.pn, IEEE80211_GCMP_PN_LEN);
  5175. -- break;
  5176. - default:
  5177. - WARN_ON(1);
  5178. - break;
  5179. ---- a/net/mac80211/key.h
  5180. -+++ b/net/mac80211/key.h
  5181. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  5182. - * Management frames.
  5183. - */
  5184. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  5185. -- struct crypto_aead *tfm;
  5186. -+ struct crypto_cipher *tfm;
  5187. - u32 replays; /* dot11RSNAStatsCCMPReplays */
  5188. - } ccmp;
  5189. - struct {
  5190. -@@ -95,24 +95,6 @@ struct ieee80211_key {
  5191. - u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  5192. - } aes_cmac;
  5193. - struct {
  5194. -- atomic64_t tx_pn;
  5195. -- u8 rx_pn[IEEE80211_GMAC_PN_LEN];
  5196. -- struct crypto_aead *tfm;
  5197. -- u32 replays; /* dot11RSNAStatsCMACReplays */
  5198. -- u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  5199. -- } aes_gmac;
  5200. -- struct {
  5201. -- atomic64_t tx_pn;
  5202. -- /* Last received packet number. The first
  5203. -- * IEEE80211_NUM_TIDS counters are used with Data
  5204. -- * frames and the last counter is used with Robust
  5205. -- * Management frames.
  5206. -- */
  5207. -- u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_GCMP_PN_LEN];
  5208. -- struct crypto_aead *tfm;
  5209. -- u32 replays; /* dot11RSNAStatsGCMPReplays */
  5210. -- } gcmp;
  5211. -- struct {
  5212. - /* generic cipher scheme */
  5213. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][MAX_PN_LEN];
  5214. - } gen;
  5215. ---- a/net/mac80211/main.c
  5216. -+++ b/net/mac80211/main.c
  5217. -@@ -666,15 +666,9 @@ static int ieee80211_init_cipher_suites(
  5218. - WLAN_CIPHER_SUITE_WEP104,
  5219. - WLAN_CIPHER_SUITE_TKIP,
  5220. - WLAN_CIPHER_SUITE_CCMP,
  5221. -- WLAN_CIPHER_SUITE_CCMP_256,
  5222. -- WLAN_CIPHER_SUITE_GCMP,
  5223. -- WLAN_CIPHER_SUITE_GCMP_256,
  5224. -
  5225. - /* keep last -- depends on hw flags! */
  5226. -- WLAN_CIPHER_SUITE_AES_CMAC,
  5227. -- WLAN_CIPHER_SUITE_BIP_CMAC_256,
  5228. -- WLAN_CIPHER_SUITE_BIP_GMAC_128,
  5229. -- WLAN_CIPHER_SUITE_BIP_GMAC_256,
  5230. -+ WLAN_CIPHER_SUITE_AES_CMAC
  5231. - };
  5232. -
  5233. - if (local->hw.flags & IEEE80211_HW_SW_CRYPTO_CONTROL ||
  5234. -@@ -713,7 +707,7 @@ static int ieee80211_init_cipher_suites(
  5235. - local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  5236. -
  5237. - if (!have_mfp)
  5238. -- local->hw.wiphy->n_cipher_suites -= 4;
  5239. -+ local->hw.wiphy->n_cipher_suites--;
  5240. -
  5241. - if (!have_wep) {
  5242. - local->hw.wiphy->cipher_suites += 2;
  5243. -@@ -730,42 +724,32 @@ static int ieee80211_init_cipher_suites(
  5244. - /* Driver specifies cipher schemes only (but not cipher suites
  5245. - * including the schemes)
  5246. - *
  5247. -- * We start counting ciphers defined by schemes, TKIP, CCMP,
  5248. -- * CCMP-256, GCMP, and GCMP-256
  5249. -+ * We start counting ciphers defined by schemes, TKIP and CCMP
  5250. - */
  5251. -- n_suites = local->hw.n_cipher_schemes + 5;
  5252. -+ n_suites = local->hw.n_cipher_schemes + 2;
  5253. -
  5254. - /* check if we have WEP40 and WEP104 */
  5255. - if (have_wep)
  5256. - n_suites += 2;
  5257. -
  5258. -- /* check if we have AES_CMAC, BIP-CMAC-256, BIP-GMAC-128,
  5259. -- * BIP-GMAC-256
  5260. -- */
  5261. -+ /* check if we have AES_CMAC */
  5262. - if (have_mfp)
  5263. -- n_suites += 4;
  5264. -+ n_suites++;
  5265. -
  5266. - suites = kmalloc(sizeof(u32) * n_suites, GFP_KERNEL);
  5267. - if (!suites)
  5268. - return -ENOMEM;
  5269. -
  5270. - suites[w++] = WLAN_CIPHER_SUITE_CCMP;
  5271. -- suites[w++] = WLAN_CIPHER_SUITE_CCMP_256;
  5272. - suites[w++] = WLAN_CIPHER_SUITE_TKIP;
  5273. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP;
  5274. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP_256;
  5275. -
  5276. - if (have_wep) {
  5277. - suites[w++] = WLAN_CIPHER_SUITE_WEP40;
  5278. - suites[w++] = WLAN_CIPHER_SUITE_WEP104;
  5279. - }
  5280. -
  5281. -- if (have_mfp) {
  5282. -+ if (have_mfp)
  5283. - suites[w++] = WLAN_CIPHER_SUITE_AES_CMAC;
  5284. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_CMAC_256;
  5285. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_128;
  5286. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_256;
  5287. -- }
  5288. -
  5289. - for (r = 0; r < local->hw.n_cipher_schemes; r++)
  5290. - suites[w++] = cs[r].cipher;
  5291. ---- a/net/mac80211/rx.c
  5292. -+++ b/net/mac80211/rx.c
  5293. -@@ -647,7 +647,6 @@ static int ieee80211_get_mmie_keyidx(str
  5294. - {
  5295. - struct ieee80211_mgmt *hdr = (struct ieee80211_mgmt *) skb->data;
  5296. - struct ieee80211_mmie *mmie;
  5297. -- struct ieee80211_mmie_16 *mmie16;
  5298. -
  5299. - if (skb->len < 24 + sizeof(*mmie) || !is_multicast_ether_addr(hdr->da))
  5300. - return -1;
  5301. -@@ -657,18 +656,11 @@ static int ieee80211_get_mmie_keyidx(str
  5302. -
  5303. - mmie = (struct ieee80211_mmie *)
  5304. - (skb->data + skb->len - sizeof(*mmie));
  5305. -- if (mmie->element_id == WLAN_EID_MMIE &&
  5306. -- mmie->length == sizeof(*mmie) - 2)
  5307. -- return le16_to_cpu(mmie->key_id);
  5308. --
  5309. -- mmie16 = (struct ieee80211_mmie_16 *)
  5310. -- (skb->data + skb->len - sizeof(*mmie16));
  5311. -- if (skb->len >= 24 + sizeof(*mmie16) &&
  5312. -- mmie16->element_id == WLAN_EID_MMIE &&
  5313. -- mmie16->length == sizeof(*mmie16) - 2)
  5314. -- return le16_to_cpu(mmie16->key_id);
  5315. -+ if (mmie->element_id != WLAN_EID_MMIE ||
  5316. -+ mmie->length != sizeof(*mmie) - 2)
  5317. -+ return -1;
  5318. -
  5319. -- return -1;
  5320. -+ return le16_to_cpu(mmie->key_id);
  5321. - }
  5322. -
  5323. - static int iwl80211_get_cs_keyid(const struct ieee80211_cipher_scheme *cs,
  5324. -@@ -1658,27 +1650,11 @@ ieee80211_rx_h_decrypt(struct ieee80211_
  5325. - result = ieee80211_crypto_tkip_decrypt(rx);
  5326. - break;
  5327. - case WLAN_CIPHER_SUITE_CCMP:
  5328. -- result = ieee80211_crypto_ccmp_decrypt(
  5329. -- rx, IEEE80211_CCMP_MIC_LEN);
  5330. -- break;
  5331. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5332. -- result = ieee80211_crypto_ccmp_decrypt(
  5333. -- rx, IEEE80211_CCMP_256_MIC_LEN);
  5334. -+ result = ieee80211_crypto_ccmp_decrypt(rx);
  5335. - break;
  5336. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5337. - result = ieee80211_crypto_aes_cmac_decrypt(rx);
  5338. - break;
  5339. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5340. -- result = ieee80211_crypto_aes_cmac_256_decrypt(rx);
  5341. -- break;
  5342. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5343. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5344. -- result = ieee80211_crypto_aes_gmac_decrypt(rx);
  5345. -- break;
  5346. -- case WLAN_CIPHER_SUITE_GCMP:
  5347. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5348. -- result = ieee80211_crypto_gcmp_decrypt(rx);
  5349. -- break;
  5350. - default:
  5351. - result = ieee80211_crypto_hw_decrypt(rx);
  5352. - }
  5353. -@@ -1805,9 +1781,7 @@ ieee80211_rx_h_defragment(struct ieee802
  5354. - /* This is the first fragment of a new frame. */
  5355. - entry = ieee80211_reassemble_add(rx->sdata, frag, seq,
  5356. - rx->seqno_idx, &(rx->skb));
  5357. -- if (rx->key &&
  5358. -- (rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP ||
  5359. -- rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP_256) &&
  5360. -+ if (rx->key && rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP &&
  5361. - ieee80211_has_protected(fc)) {
  5362. - int queue = rx->security_idx;
  5363. - /* Store CCMP PN so that we can verify that the next
  5364. -@@ -1836,9 +1810,7 @@ ieee80211_rx_h_defragment(struct ieee802
  5365. - int i;
  5366. - u8 pn[IEEE80211_CCMP_PN_LEN], *rpn;
  5367. - int queue;
  5368. -- if (!rx->key ||
  5369. -- (rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP &&
  5370. -- rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP_256))
  5371. -+ if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP)
  5372. - return RX_DROP_UNUSABLE;
  5373. - memcpy(pn, entry->last_pn, IEEE80211_CCMP_PN_LEN);
  5374. - for (i = IEEE80211_CCMP_PN_LEN - 1; i >= 0; i--) {
  5375. ---- a/net/mac80211/tx.c
  5376. -+++ b/net/mac80211/tx.c
  5377. -@@ -626,9 +626,6 @@ ieee80211_tx_h_select_key(struct ieee802
  5378. - tx->key = NULL;
  5379. - break;
  5380. - case WLAN_CIPHER_SUITE_CCMP:
  5381. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5382. -- case WLAN_CIPHER_SUITE_GCMP:
  5383. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5384. - if (!ieee80211_is_data_present(hdr->frame_control) &&
  5385. - !ieee80211_use_mfp(hdr->frame_control, tx->sta,
  5386. - tx->skb))
  5387. -@@ -639,9 +636,6 @@ ieee80211_tx_h_select_key(struct ieee802
  5388. - ieee80211_is_mgmt(hdr->frame_control);
  5389. - break;
  5390. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5391. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5392. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5393. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5394. - if (!ieee80211_is_mgmt(hdr->frame_control))
  5395. - tx->key = NULL;
  5396. - break;
  5397. -@@ -1017,21 +1011,9 @@ ieee80211_tx_h_encrypt(struct ieee80211_
  5398. - case WLAN_CIPHER_SUITE_TKIP:
  5399. - return ieee80211_crypto_tkip_encrypt(tx);
  5400. - case WLAN_CIPHER_SUITE_CCMP:
  5401. -- return ieee80211_crypto_ccmp_encrypt(
  5402. -- tx, IEEE80211_CCMP_MIC_LEN);
  5403. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5404. -- return ieee80211_crypto_ccmp_encrypt(
  5405. -- tx, IEEE80211_CCMP_256_MIC_LEN);
  5406. -+ return ieee80211_crypto_ccmp_encrypt(tx);
  5407. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5408. - return ieee80211_crypto_aes_cmac_encrypt(tx);
  5409. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5410. -- return ieee80211_crypto_aes_cmac_256_encrypt(tx);
  5411. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5412. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5413. -- return ieee80211_crypto_aes_gmac_encrypt(tx);
  5414. -- case WLAN_CIPHER_SUITE_GCMP:
  5415. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5416. -- return ieee80211_crypto_gcmp_encrypt(tx);
  5417. - default:
  5418. - return ieee80211_crypto_hw_encrypt(tx);
  5419. - }
  5420. ---- a/net/mac80211/wpa.c
  5421. -+++ b/net/mac80211/wpa.c
  5422. -@@ -22,8 +22,6 @@
  5423. - #include "tkip.h"
  5424. - #include "aes_ccm.h"
  5425. - #include "aes_cmac.h"
  5426. --#include "aes_gmac.h"
  5427. --#include "aes_gcm.h"
  5428. - #include "wpa.h"
  5429. -
  5430. - ieee80211_tx_result
  5431. -@@ -304,15 +302,22 @@ ieee80211_crypto_tkip_decrypt(struct iee
  5432. - }
  5433. -
  5434. -
  5435. --static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  5436. -+static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
  5437. -+ int encrypted)
  5438. - {
  5439. - __le16 mask_fc;
  5440. - int a4_included, mgmt;
  5441. - u8 qos_tid;
  5442. -- u16 len_a;
  5443. -+ u8 *b_0, *aad;
  5444. -+ u16 data_len, len_a;
  5445. - unsigned int hdrlen;
  5446. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5447. -
  5448. -+ memset(scratch, 0, 6 * AES_BLOCK_SIZE);
  5449. -+
  5450. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  5451. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  5452. -+
  5453. - /*
  5454. - * Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  5455. - * Retry, PwrMgt, MoreData; set Protected
  5456. -@@ -334,21 +339,20 @@ static void ccmp_special_blocks(struct s
  5457. - else
  5458. - qos_tid = 0;
  5459. -
  5460. -- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  5461. -- * mode authentication are not allowed to collide, yet both are derived
  5462. -- * from this vector b_0. We only set L := 1 here to indicate that the
  5463. -- * data size can be represented in (L+1) bytes. The CCM layer will take
  5464. -- * care of storing the data length in the top (L+1) bytes and setting
  5465. -- * and clearing the other bits as is required to derive the two IVs.
  5466. -- */
  5467. -- b_0[0] = 0x1;
  5468. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN;
  5469. -+ if (encrypted)
  5470. -+ data_len -= IEEE80211_CCMP_MIC_LEN;
  5471. -
  5472. -+ /* First block, b_0 */
  5473. -+ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  5474. - /* Nonce: Nonce Flags | A2 | PN
  5475. - * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  5476. - */
  5477. - b_0[1] = qos_tid | (mgmt << 4);
  5478. - memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  5479. - memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  5480. -+ /* l(m) */
  5481. -+ put_unaligned_be16(data_len, &b_0[14]);
  5482. -
  5483. - /* AAD (extra authenticate-only data) / masked 802.11 header
  5484. - * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  5485. -@@ -395,8 +399,7 @@ static inline void ccmp_hdr2pn(u8 *pn, u
  5486. - }
  5487. -
  5488. -
  5489. --static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb,
  5490. -- unsigned int mic_len)
  5491. -+static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  5492. - {
  5493. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  5494. - struct ieee80211_key *key = tx->key;
  5495. -@@ -405,8 +408,7 @@ static int ccmp_encrypt_skb(struct ieee8
  5496. - u8 *pos;
  5497. - u8 pn[6];
  5498. - u64 pn64;
  5499. -- u8 aad[2 * AES_BLOCK_SIZE];
  5500. -- u8 b_0[AES_BLOCK_SIZE];
  5501. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  5502. -
  5503. - if (info->control.hw_key &&
  5504. - !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  5505. -@@ -427,7 +429,7 @@ static int ccmp_encrypt_skb(struct ieee8
  5506. - if (info->control.hw_key)
  5507. - tail = 0;
  5508. - else
  5509. -- tail = mic_len;
  5510. -+ tail = IEEE80211_CCMP_MIC_LEN;
  5511. -
  5512. - if (WARN_ON(skb_tailroom(skb) < tail ||
  5513. - skb_headroom(skb) < IEEE80211_CCMP_HDR_LEN))
  5514. -@@ -460,24 +462,23 @@ static int ccmp_encrypt_skb(struct ieee8
  5515. - return 0;
  5516. -
  5517. - pos += IEEE80211_CCMP_HDR_LEN;
  5518. -- ccmp_special_blocks(skb, pn, b_0, aad);
  5519. -- ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  5520. -- skb_put(skb, mic_len), mic_len);
  5521. -+ ccmp_special_blocks(skb, pn, scratch, 0);
  5522. -+ ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len,
  5523. -+ pos, skb_put(skb, IEEE80211_CCMP_MIC_LEN));
  5524. -
  5525. - return 0;
  5526. - }
  5527. -
  5528. -
  5529. - ieee80211_tx_result
  5530. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  5531. -- unsigned int mic_len)
  5532. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
  5533. - {
  5534. - struct sk_buff *skb;
  5535. -
  5536. - ieee80211_tx_set_protected(tx);
  5537. -
  5538. - skb_queue_walk(&tx->skbs, skb) {
  5539. -- if (ccmp_encrypt_skb(tx, skb, mic_len) < 0)
  5540. -+ if (ccmp_encrypt_skb(tx, skb) < 0)
  5541. - return TX_DROP;
  5542. - }
  5543. -
  5544. -@@ -486,8 +487,7 @@ ieee80211_crypto_ccmp_encrypt(struct iee
  5545. -
  5546. -
  5547. - ieee80211_rx_result
  5548. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  5549. -- unsigned int mic_len)
  5550. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
  5551. - {
  5552. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  5553. - int hdrlen;
  5554. -@@ -504,7 +504,8 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  5555. - !ieee80211_is_robust_mgmt_frame(skb))
  5556. - return RX_CONTINUE;
  5557. -
  5558. -- data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len;
  5559. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN -
  5560. -+ IEEE80211_CCMP_MIC_LEN;
  5561. - if (!rx->sta || data_len < 0)
  5562. - return RX_DROP_UNUSABLE;
  5563. -
  5564. -@@ -526,23 +527,23 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  5565. - }
  5566. -
  5567. - if (!(status->flag & RX_FLAG_DECRYPTED)) {
  5568. -- u8 aad[2 * AES_BLOCK_SIZE];
  5569. -- u8 b_0[AES_BLOCK_SIZE];
  5570. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  5571. - /* hardware didn't decrypt/verify MIC */
  5572. -- ccmp_special_blocks(skb, pn, b_0, aad);
  5573. -+ ccmp_special_blocks(skb, pn, scratch, 1);
  5574. -
  5575. - if (ieee80211_aes_ccm_decrypt(
  5576. -- key->u.ccmp.tfm, b_0, aad,
  5577. -+ key->u.ccmp.tfm, scratch,
  5578. - skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
  5579. - data_len,
  5580. -- skb->data + skb->len - mic_len, mic_len))
  5581. -+ skb->data + skb->len - IEEE80211_CCMP_MIC_LEN,
  5582. -+ skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
  5583. - return RX_DROP_UNUSABLE;
  5584. - }
  5585. -
  5586. - memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
  5587. -
  5588. - /* Remove CCMP header and MIC */
  5589. -- if (pskb_trim(skb, skb->len - mic_len))
  5590. -+ if (pskb_trim(skb, skb->len - IEEE80211_CCMP_MIC_LEN))
  5591. - return RX_DROP_UNUSABLE;
  5592. - memmove(skb->data + IEEE80211_CCMP_HDR_LEN, skb->data, hdrlen);
  5593. - skb_pull(skb, IEEE80211_CCMP_HDR_LEN);
  5594. -@@ -550,229 +551,6 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  5595. - return RX_CONTINUE;
  5596. - }
  5597. -
  5598. --static void gcmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *j_0, u8 *aad)
  5599. --{
  5600. -- __le16 mask_fc;
  5601. -- u8 qos_tid;
  5602. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5603. --
  5604. -- memcpy(j_0, hdr->addr2, ETH_ALEN);
  5605. -- memcpy(&j_0[ETH_ALEN], pn, IEEE80211_GCMP_PN_LEN);
  5606. -- j_0[13] = 0;
  5607. -- j_0[14] = 0;
  5608. -- j_0[AES_BLOCK_SIZE - 1] = 0x01;
  5609. --
  5610. -- /* AAD (extra authenticate-only data) / masked 802.11 header
  5611. -- * FC | A1 | A2 | A3 | SC | [A4] | [QC]
  5612. -- */
  5613. -- put_unaligned_be16(ieee80211_hdrlen(hdr->frame_control) - 2, &aad[0]);
  5614. -- /* Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  5615. -- * Retry, PwrMgt, MoreData; set Protected
  5616. -- */
  5617. -- mask_fc = hdr->frame_control;
  5618. -- mask_fc &= ~cpu_to_le16(IEEE80211_FCTL_RETRY |
  5619. -- IEEE80211_FCTL_PM | IEEE80211_FCTL_MOREDATA);
  5620. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  5621. -- mask_fc &= ~cpu_to_le16(0x0070);
  5622. -- mask_fc |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  5623. --
  5624. -- put_unaligned(mask_fc, (__le16 *)&aad[2]);
  5625. -- memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN);
  5626. --
  5627. -- /* Mask Seq#, leave Frag# */
  5628. -- aad[22] = *((u8 *)&hdr->seq_ctrl) & 0x0f;
  5629. -- aad[23] = 0;
  5630. --
  5631. -- if (ieee80211_is_data_qos(hdr->frame_control))
  5632. -- qos_tid = *ieee80211_get_qos_ctl(hdr) &
  5633. -- IEEE80211_QOS_CTL_TID_MASK;
  5634. -- else
  5635. -- qos_tid = 0;
  5636. --
  5637. -- if (ieee80211_has_a4(hdr->frame_control)) {
  5638. -- memcpy(&aad[24], hdr->addr4, ETH_ALEN);
  5639. -- aad[30] = qos_tid;
  5640. -- aad[31] = 0;
  5641. -- } else {
  5642. -- memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN);
  5643. -- aad[24] = qos_tid;
  5644. -- }
  5645. --}
  5646. --
  5647. --static inline void gcmp_pn2hdr(u8 *hdr, const u8 *pn, int key_id)
  5648. --{
  5649. -- hdr[0] = pn[5];
  5650. -- hdr[1] = pn[4];
  5651. -- hdr[2] = 0;
  5652. -- hdr[3] = 0x20 | (key_id << 6);
  5653. -- hdr[4] = pn[3];
  5654. -- hdr[5] = pn[2];
  5655. -- hdr[6] = pn[1];
  5656. -- hdr[7] = pn[0];
  5657. --}
  5658. --
  5659. --static inline void gcmp_hdr2pn(u8 *pn, const u8 *hdr)
  5660. --{
  5661. -- pn[0] = hdr[7];
  5662. -- pn[1] = hdr[6];
  5663. -- pn[2] = hdr[5];
  5664. -- pn[3] = hdr[4];
  5665. -- pn[4] = hdr[1];
  5666. -- pn[5] = hdr[0];
  5667. --}
  5668. --
  5669. --static int gcmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  5670. --{
  5671. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5672. -- struct ieee80211_key *key = tx->key;
  5673. -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5674. -- int hdrlen, len, tail;
  5675. -- u8 *pos;
  5676. -- u8 pn[6];
  5677. -- u64 pn64;
  5678. -- u8 aad[2 * AES_BLOCK_SIZE];
  5679. -- u8 j_0[AES_BLOCK_SIZE];
  5680. --
  5681. -- if (info->control.hw_key &&
  5682. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  5683. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) &&
  5684. -- !((info->control.hw_key->flags &
  5685. -- IEEE80211_KEY_FLAG_GENERATE_IV_MGMT) &&
  5686. -- ieee80211_is_mgmt(hdr->frame_control))) {
  5687. -- /* hwaccel has no need for preallocated room for GCMP
  5688. -- * header or MIC fields
  5689. -- */
  5690. -- return 0;
  5691. -- }
  5692. --
  5693. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5694. -- len = skb->len - hdrlen;
  5695. --
  5696. -- if (info->control.hw_key)
  5697. -- tail = 0;
  5698. -- else
  5699. -- tail = IEEE80211_GCMP_MIC_LEN;
  5700. --
  5701. -- if (WARN_ON(skb_tailroom(skb) < tail ||
  5702. -- skb_headroom(skb) < IEEE80211_GCMP_HDR_LEN))
  5703. -- return -1;
  5704. --
  5705. -- pos = skb_push(skb, IEEE80211_GCMP_HDR_LEN);
  5706. -- memmove(pos, pos + IEEE80211_GCMP_HDR_LEN, hdrlen);
  5707. -- skb_set_network_header(skb, skb_network_offset(skb) +
  5708. -- IEEE80211_GCMP_HDR_LEN);
  5709. --
  5710. -- /* the HW only needs room for the IV, but not the actual IV */
  5711. -- if (info->control.hw_key &&
  5712. -- (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))
  5713. -- return 0;
  5714. --
  5715. -- hdr = (struct ieee80211_hdr *)pos;
  5716. -- pos += hdrlen;
  5717. --
  5718. -- pn64 = atomic64_inc_return(&key->u.gcmp.tx_pn);
  5719. --
  5720. -- pn[5] = pn64;
  5721. -- pn[4] = pn64 >> 8;
  5722. -- pn[3] = pn64 >> 16;
  5723. -- pn[2] = pn64 >> 24;
  5724. -- pn[1] = pn64 >> 32;
  5725. -- pn[0] = pn64 >> 40;
  5726. --
  5727. -- gcmp_pn2hdr(pos, pn, key->conf.keyidx);
  5728. --
  5729. -- /* hwaccel - with software GCMP header */
  5730. -- if (info->control.hw_key)
  5731. -- return 0;
  5732. --
  5733. -- pos += IEEE80211_GCMP_HDR_LEN;
  5734. -- gcmp_special_blocks(skb, pn, j_0, aad);
  5735. -- ieee80211_aes_gcm_encrypt(key->u.gcmp.tfm, j_0, aad, pos, len,
  5736. -- skb_put(skb, IEEE80211_GCMP_MIC_LEN));
  5737. --
  5738. -- return 0;
  5739. --}
  5740. --
  5741. --ieee80211_tx_result
  5742. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx)
  5743. --{
  5744. -- struct sk_buff *skb;
  5745. --
  5746. -- ieee80211_tx_set_protected(tx);
  5747. --
  5748. -- skb_queue_walk(&tx->skbs, skb) {
  5749. -- if (gcmp_encrypt_skb(tx, skb) < 0)
  5750. -- return TX_DROP;
  5751. -- }
  5752. --
  5753. -- return TX_CONTINUE;
  5754. --}
  5755. --
  5756. --ieee80211_rx_result
  5757. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx)
  5758. --{
  5759. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  5760. -- int hdrlen;
  5761. -- struct ieee80211_key *key = rx->key;
  5762. -- struct sk_buff *skb = rx->skb;
  5763. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  5764. -- u8 pn[IEEE80211_GCMP_PN_LEN];
  5765. -- int data_len;
  5766. -- int queue;
  5767. --
  5768. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5769. --
  5770. -- if (!ieee80211_is_data(hdr->frame_control) &&
  5771. -- !ieee80211_is_robust_mgmt_frame(skb))
  5772. -- return RX_CONTINUE;
  5773. --
  5774. -- data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN -
  5775. -- IEEE80211_GCMP_MIC_LEN;
  5776. -- if (!rx->sta || data_len < 0)
  5777. -- return RX_DROP_UNUSABLE;
  5778. --
  5779. -- if (status->flag & RX_FLAG_DECRYPTED) {
  5780. -- if (!pskb_may_pull(rx->skb, hdrlen + IEEE80211_GCMP_HDR_LEN))
  5781. -- return RX_DROP_UNUSABLE;
  5782. -- } else {
  5783. -- if (skb_linearize(rx->skb))
  5784. -- return RX_DROP_UNUSABLE;
  5785. -- }
  5786. --
  5787. -- gcmp_hdr2pn(pn, skb->data + hdrlen);
  5788. --
  5789. -- queue = rx->security_idx;
  5790. --
  5791. -- if (memcmp(pn, key->u.gcmp.rx_pn[queue], IEEE80211_GCMP_PN_LEN) <= 0) {
  5792. -- key->u.gcmp.replays++;
  5793. -- return RX_DROP_UNUSABLE;
  5794. -- }
  5795. --
  5796. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  5797. -- u8 aad[2 * AES_BLOCK_SIZE];
  5798. -- u8 j_0[AES_BLOCK_SIZE];
  5799. -- /* hardware didn't decrypt/verify MIC */
  5800. -- gcmp_special_blocks(skb, pn, j_0, aad);
  5801. --
  5802. -- if (ieee80211_aes_gcm_decrypt(
  5803. -- key->u.gcmp.tfm, j_0, aad,
  5804. -- skb->data + hdrlen + IEEE80211_GCMP_HDR_LEN,
  5805. -- data_len,
  5806. -- skb->data + skb->len - IEEE80211_GCMP_MIC_LEN))
  5807. -- return RX_DROP_UNUSABLE;
  5808. -- }
  5809. --
  5810. -- memcpy(key->u.gcmp.rx_pn[queue], pn, IEEE80211_GCMP_PN_LEN);
  5811. --
  5812. -- /* Remove GCMP header and MIC */
  5813. -- if (pskb_trim(skb, skb->len - IEEE80211_GCMP_MIC_LEN))
  5814. -- return RX_DROP_UNUSABLE;
  5815. -- memmove(skb->data + IEEE80211_GCMP_HDR_LEN, skb->data, hdrlen);
  5816. -- skb_pull(skb, IEEE80211_GCMP_HDR_LEN);
  5817. --
  5818. -- return RX_CONTINUE;
  5819. --}
  5820. --
  5821. - static ieee80211_tx_result
  5822. - ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  5823. - struct sk_buff *skb)
  5824. -@@ -956,48 +734,6 @@ ieee80211_crypto_aes_cmac_encrypt(struct
  5825. - return TX_CONTINUE;
  5826. - }
  5827. -
  5828. --ieee80211_tx_result
  5829. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx)
  5830. --{
  5831. -- struct sk_buff *skb;
  5832. -- struct ieee80211_tx_info *info;
  5833. -- struct ieee80211_key *key = tx->key;
  5834. -- struct ieee80211_mmie_16 *mmie;
  5835. -- u8 aad[20];
  5836. -- u64 pn64;
  5837. --
  5838. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  5839. -- return TX_DROP;
  5840. --
  5841. -- skb = skb_peek(&tx->skbs);
  5842. --
  5843. -- info = IEEE80211_SKB_CB(skb);
  5844. --
  5845. -- if (info->control.hw_key)
  5846. -- return TX_CONTINUE;
  5847. --
  5848. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  5849. -- return TX_DROP;
  5850. --
  5851. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  5852. -- mmie->element_id = WLAN_EID_MMIE;
  5853. -- mmie->length = sizeof(*mmie) - 2;
  5854. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  5855. --
  5856. -- /* PN = PN + 1 */
  5857. -- pn64 = atomic64_inc_return(&key->u.aes_cmac.tx_pn);
  5858. --
  5859. -- bip_ipn_set64(mmie->sequence_number, pn64);
  5860. --
  5861. -- bip_aad(skb, aad);
  5862. --
  5863. -- /* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128)
  5864. -- */
  5865. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  5866. -- skb->data + 24, skb->len - 24, mmie->mic);
  5867. --
  5868. -- return TX_CONTINUE;
  5869. --}
  5870. -
  5871. - ieee80211_rx_result
  5872. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
  5873. -@@ -1045,160 +781,6 @@ ieee80211_crypto_aes_cmac_decrypt(struct
  5874. -
  5875. - /* Remove MMIE */
  5876. - skb_trim(skb, skb->len - sizeof(*mmie));
  5877. --
  5878. -- return RX_CONTINUE;
  5879. --}
  5880. --
  5881. --ieee80211_rx_result
  5882. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx)
  5883. --{
  5884. -- struct sk_buff *skb = rx->skb;
  5885. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  5886. -- struct ieee80211_key *key = rx->key;
  5887. -- struct ieee80211_mmie_16 *mmie;
  5888. -- u8 aad[20], mic[16], ipn[6];
  5889. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5890. --
  5891. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  5892. -- return RX_CONTINUE;
  5893. --
  5894. -- /* management frames are already linear */
  5895. --
  5896. -- if (skb->len < 24 + sizeof(*mmie))
  5897. -- return RX_DROP_UNUSABLE;
  5898. --
  5899. -- mmie = (struct ieee80211_mmie_16 *)
  5900. -- (skb->data + skb->len - sizeof(*mmie));
  5901. -- if (mmie->element_id != WLAN_EID_MMIE ||
  5902. -- mmie->length != sizeof(*mmie) - 2)
  5903. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  5904. --
  5905. -- bip_ipn_swap(ipn, mmie->sequence_number);
  5906. --
  5907. -- if (memcmp(ipn, key->u.aes_cmac.rx_pn, 6) <= 0) {
  5908. -- key->u.aes_cmac.replays++;
  5909. -- return RX_DROP_UNUSABLE;
  5910. -- }
  5911. --
  5912. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  5913. -- /* hardware didn't decrypt/verify MIC */
  5914. -- bip_aad(skb, aad);
  5915. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  5916. -- skb->data + 24, skb->len - 24, mic);
  5917. -- if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  5918. -- key->u.aes_cmac.icverrors++;
  5919. -- return RX_DROP_UNUSABLE;
  5920. -- }
  5921. -- }
  5922. --
  5923. -- memcpy(key->u.aes_cmac.rx_pn, ipn, 6);
  5924. --
  5925. -- /* Remove MMIE */
  5926. -- skb_trim(skb, skb->len - sizeof(*mmie));
  5927. --
  5928. -- return RX_CONTINUE;
  5929. --}
  5930. --
  5931. --ieee80211_tx_result
  5932. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx)
  5933. --{
  5934. -- struct sk_buff *skb;
  5935. -- struct ieee80211_tx_info *info;
  5936. -- struct ieee80211_key *key = tx->key;
  5937. -- struct ieee80211_mmie_16 *mmie;
  5938. -- struct ieee80211_hdr *hdr;
  5939. -- u8 aad[20];
  5940. -- u64 pn64;
  5941. -- u8 nonce[12];
  5942. --
  5943. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  5944. -- return TX_DROP;
  5945. --
  5946. -- skb = skb_peek(&tx->skbs);
  5947. --
  5948. -- info = IEEE80211_SKB_CB(skb);
  5949. --
  5950. -- if (info->control.hw_key)
  5951. -- return TX_CONTINUE;
  5952. --
  5953. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  5954. -- return TX_DROP;
  5955. --
  5956. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  5957. -- mmie->element_id = WLAN_EID_MMIE;
  5958. -- mmie->length = sizeof(*mmie) - 2;
  5959. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  5960. --
  5961. -- /* PN = PN + 1 */
  5962. -- pn64 = atomic64_inc_return(&key->u.aes_gmac.tx_pn);
  5963. --
  5964. -- bip_ipn_set64(mmie->sequence_number, pn64);
  5965. --
  5966. -- bip_aad(skb, aad);
  5967. --
  5968. -- hdr = (struct ieee80211_hdr *)skb->data;
  5969. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  5970. -- bip_ipn_swap(nonce + ETH_ALEN, mmie->sequence_number);
  5971. --
  5972. -- /* MIC = AES-GMAC(IGTK, AAD || Management Frame Body || MMIE, 128) */
  5973. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  5974. -- skb->data + 24, skb->len - 24, mmie->mic) < 0)
  5975. -- return TX_DROP;
  5976. --
  5977. -- return TX_CONTINUE;
  5978. --}
  5979. --
  5980. --ieee80211_rx_result
  5981. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx)
  5982. --{
  5983. -- struct sk_buff *skb = rx->skb;
  5984. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  5985. -- struct ieee80211_key *key = rx->key;
  5986. -- struct ieee80211_mmie_16 *mmie;
  5987. -- u8 aad[20], mic[16], ipn[6], nonce[12];
  5988. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5989. --
  5990. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  5991. -- return RX_CONTINUE;
  5992. --
  5993. -- /* management frames are already linear */
  5994. --
  5995. -- if (skb->len < 24 + sizeof(*mmie))
  5996. -- return RX_DROP_UNUSABLE;
  5997. --
  5998. -- mmie = (struct ieee80211_mmie_16 *)
  5999. -- (skb->data + skb->len - sizeof(*mmie));
  6000. -- if (mmie->element_id != WLAN_EID_MMIE ||
  6001. -- mmie->length != sizeof(*mmie) - 2)
  6002. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  6003. --
  6004. -- bip_ipn_swap(ipn, mmie->sequence_number);
  6005. --
  6006. -- if (memcmp(ipn, key->u.aes_gmac.rx_pn, 6) <= 0) {
  6007. -- key->u.aes_gmac.replays++;
  6008. -- return RX_DROP_UNUSABLE;
  6009. -- }
  6010. --
  6011. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6012. -- /* hardware didn't decrypt/verify MIC */
  6013. -- bip_aad(skb, aad);
  6014. --
  6015. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  6016. -- memcpy(nonce + ETH_ALEN, ipn, 6);
  6017. --
  6018. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  6019. -- skb->data + 24, skb->len - 24,
  6020. -- mic) < 0 ||
  6021. -- memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  6022. -- key->u.aes_gmac.icverrors++;
  6023. -- return RX_DROP_UNUSABLE;
  6024. -- }
  6025. -- }
  6026. --
  6027. -- memcpy(key->u.aes_gmac.rx_pn, ipn, 6);
  6028. --
  6029. -- /* Remove MMIE */
  6030. -- skb_trim(skb, skb->len - sizeof(*mmie));
  6031. -
  6032. - return RX_CONTINUE;
  6033. - }
  6034. ---- a/net/mac80211/wpa.h
  6035. -+++ b/net/mac80211/wpa.h
  6036. -@@ -24,32 +24,17 @@ ieee80211_rx_result
  6037. - ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx);
  6038. -
  6039. - ieee80211_tx_result
  6040. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  6041. -- unsigned int mic_len);
  6042. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx);
  6043. - ieee80211_rx_result
  6044. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  6045. -- unsigned int mic_len);
  6046. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx);
  6047. -
  6048. - ieee80211_tx_result
  6049. - ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx);
  6050. --ieee80211_tx_result
  6051. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx);
  6052. - ieee80211_rx_result
  6053. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx);
  6054. --ieee80211_rx_result
  6055. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx);
  6056. --ieee80211_tx_result
  6057. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx);
  6058. --ieee80211_rx_result
  6059. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx);
  6060. - ieee80211_tx_result
  6061. - ieee80211_crypto_hw_encrypt(struct ieee80211_tx_data *tx);
  6062. - ieee80211_rx_result
  6063. - ieee80211_crypto_hw_decrypt(struct ieee80211_rx_data *rx);
  6064. -
  6065. --ieee80211_tx_result
  6066. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx);
  6067. --ieee80211_rx_result
  6068. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx);
  6069. --
  6070. - #endif /* WPA_H */
  6071. 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
  6072. index 41a3c4f..cff6d89 100644
  6073. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  6074. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  6075. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  6076. --- a/net/mac80211/cfg.c
  6077. +++ b/net/mac80211/cfg.c
  6078. -@@ -856,7 +856,6 @@ static int ieee80211_stop_ap(struct wiph
  6079. +@@ -886,7 +886,6 @@ static int ieee80211_stop_ap(struct wiph
  6080. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  6081. __sta_info_flush(sdata, true);
  6082. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  6083. index de79bd2..5fc9454 100644
  6084. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  6085. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  6086. @@ -18,7 +18,7 @@
  6087. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  6088. unsigned long data, void *arg)
  6089. {
  6090. -@@ -1057,14 +1057,14 @@ int ieee80211_register_hw(struct ieee802
  6091. +@@ -1086,14 +1086,14 @@ int ieee80211_register_hw(struct ieee802
  6092. if (result)
  6093. goto fail_pm_qos;
  6094. @@ -35,7 +35,7 @@
  6095. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  6096. result = register_inet6addr_notifier(&local->ifa6_notifier);
  6097. if (result)
  6098. -@@ -1073,13 +1073,13 @@ int ieee80211_register_hw(struct ieee802
  6099. +@@ -1102,13 +1102,13 @@ int ieee80211_register_hw(struct ieee802
  6100. return 0;
  6101. @@ -52,7 +52,7 @@
  6102. fail_ifa:
  6103. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  6104. &local->network_latency_notifier);
  6105. -@@ -1124,10 +1124,10 @@ void ieee80211_unregister_hw(struct ieee
  6106. +@@ -1141,10 +1141,10 @@ void ieee80211_unregister_hw(struct ieee
  6107. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  6108. &local->network_latency_notifier);
  6109. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  6110. index 47dcec3..29f05c4 100644
  6111. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  6112. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  6113. @@ -1,6 +1,6 @@
  6114. --- a/net/mac80211/cfg.c
  6115. +++ b/net/mac80211/cfg.c
  6116. -@@ -1963,7 +1963,7 @@ static int ieee80211_scan(struct wiphy *
  6117. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  6118. * the frames sent while scanning on other channel will be
  6119. * lost)
  6120. */
  6121. 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
  6122. new file mode 100644
  6123. index 0000000..bddb15a
  6124. --- /dev/null
  6125. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  6126. @@ -0,0 +1,31 @@
  6127. +From: Felix Fietkau <nbd@openwrt.org>
  6128. +Date: Sun, 7 Jun 2015 13:53:35 +0200
  6129. +Subject: [PATCH] ath9k: force rx_clear when disabling rx
  6130. +
  6131. +This makes stopping Rx more reliable and should reduce the frequency of
  6132. +Rx related DMA stop warnings
  6133. +
  6134. +Cc: stable@vger.kernel.org
  6135. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6136. +---
  6137. +
  6138. +--- a/drivers/net/wireless/ath/ath9k/mac.c
  6139. ++++ b/drivers/net/wireless/ath/ath9k/mac.c
  6140. +@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  6141. +
  6142. + ath9k_ani_reset(ah, is_scanning);
  6143. +
  6144. +- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  6145. ++ REG_CLR_BIT(ah, AR_DIAG_SW,
  6146. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  6147. + }
  6148. + EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  6149. +
  6150. + void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  6151. + {
  6152. +- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  6153. ++ REG_SET_BIT(ah, AR_DIAG_SW,
  6154. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  6155. +
  6156. + ath9k_hw_disable_mib_counters(ah);
  6157. + }
  6158. 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
  6159. deleted file mode 100644
  6160. index 237121b..0000000
  6161. --- a/package/kernel/mac80211/patches/300-mac80211-add-an-intermediate-software-queue-implemen.patch
  6162. +++ /dev/null
  6163. @@ -1,882 +0,0 @@
  6164. -From: Felix Fietkau <nbd@openwrt.org>
  6165. -Date: Tue, 18 Nov 2014 23:58:51 +0100
  6166. -Subject: [PATCH] mac80211: add an intermediate software queue implementation
  6167. -
  6168. -This allows drivers to request per-vif and per-sta-tid queues from which
  6169. -they can pull frames. This makes it easier to keep the hardware queues
  6170. -short, and to improve fairness between clients and vifs.
  6171. -
  6172. -The task of scheduling packet transmission is left up to the driver -
  6173. -queueing is controlled by mac80211. Drivers can only dequeue packets by
  6174. -calling ieee80211_tx_dequeue. This makes it possible to add active queue
  6175. -management later without changing drivers using this code.
  6176. -
  6177. -This can also be used as a starting point to implement A-MSDU
  6178. -aggregation in a way that does not add artificially induced latency.
  6179. -
  6180. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6181. ----
  6182. -
  6183. ---- a/include/net/mac80211.h
  6184. -+++ b/include/net/mac80211.h
  6185. -@@ -84,6 +84,39 @@
  6186. - *
  6187. - */
  6188. -
  6189. -+/**
  6190. -+ * DOC: mac80211 software tx queueing
  6191. -+ *
  6192. -+ * mac80211 provides an optional intermediate queueing implementation designed
  6193. -+ * to allow the driver to keep hardware queues short and provide some fairness
  6194. -+ * between different stations/interfaces.
  6195. -+ * In this model, the driver pulls data frames from the mac80211 queue instead
  6196. -+ * of letting mac80211 push them via drv_tx().
  6197. -+ * Other frames (e.g. control or management) are still pushed using drv_tx().
  6198. -+ *
  6199. -+ * Drivers indicate that they use this model by implementing the .wake_tx_queue
  6200. -+ * driver operation.
  6201. -+ *
  6202. -+ * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with a
  6203. -+ * single per-vif queue for multicast data frames.
  6204. -+ *
  6205. -+ * The driver is expected to initialize its private per-queue data for stations
  6206. -+ * and interfaces in the .add_interface and .sta_add ops.
  6207. -+ *
  6208. -+ * The driver can't access the queue directly. To dequeue a frame, it calls
  6209. -+ * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
  6210. -+ * calls the .wake_tx_queue driver op.
  6211. -+ *
  6212. -+ * For AP powersave TIM handling, the driver only needs to indicate if it has
  6213. -+ * buffered packets in the driver specific data structures by calling
  6214. -+ * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
  6215. -+ * struct, mac80211 sets the appropriate TIM PVB bits and calls
  6216. -+ * .release_buffered_frames().
  6217. -+ * In that callback the driver is therefore expected to release its own
  6218. -+ * buffered frames and afterwards also frames from the ieee80211_txq (obtained
  6219. -+ * via the usual ieee80211_tx_dequeue).
  6220. -+ */
  6221. -+
  6222. - struct device;
  6223. -
  6224. - /**
  6225. -@@ -1246,6 +1279,7 @@ enum ieee80211_vif_flags {
  6226. - * monitor interface (if that is requested.)
  6227. - * @drv_priv: data area for driver use, will always be aligned to
  6228. - * sizeof(void *).
  6229. -+ * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
  6230. - */
  6231. - struct ieee80211_vif {
  6232. - enum nl80211_iftype type;
  6233. -@@ -1257,6 +1291,8 @@ struct ieee80211_vif {
  6234. - u8 cab_queue;
  6235. - u8 hw_queue[IEEE80211_NUM_ACS];
  6236. -
  6237. -+ struct ieee80211_txq *txq;
  6238. -+
  6239. - struct ieee80211_chanctx_conf __rcu *chanctx_conf;
  6240. -
  6241. - u32 driver_flags;
  6242. -@@ -1501,6 +1537,7 @@ struct ieee80211_sta_rates {
  6243. - * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
  6244. - * valid if the STA is a TDLS peer in the first place.
  6245. - * @mfp: indicates whether the STA uses management frame protection or not.
  6246. -+ * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  6247. - */
  6248. - struct ieee80211_sta {
  6249. - u32 supp_rates[IEEE80211_NUM_BANDS];
  6250. -@@ -1519,6 +1556,8 @@ struct ieee80211_sta {
  6251. - bool tdls_initiator;
  6252. - bool mfp;
  6253. -
  6254. -+ struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  6255. -+
  6256. - /* must be last */
  6257. - u8 drv_priv[0] __aligned(sizeof(void *));
  6258. - };
  6259. -@@ -1547,6 +1586,27 @@ struct ieee80211_tx_control {
  6260. - };
  6261. -
  6262. - /**
  6263. -+ * struct ieee80211_txq - Software intermediate tx queue
  6264. -+ *
  6265. -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6266. -+ * @sta: station table entry, %NULL for per-vif queue
  6267. -+ * @tid: the TID for this queue (unused for per-vif queue)
  6268. -+ * @ac: the AC for this queue
  6269. -+ *
  6270. -+ * The driver can obtain packets from this queue by calling
  6271. -+ * ieee80211_tx_dequeue().
  6272. -+ */
  6273. -+struct ieee80211_txq {
  6274. -+ struct ieee80211_vif *vif;
  6275. -+ struct ieee80211_sta *sta;
  6276. -+ u8 tid;
  6277. -+ u8 ac;
  6278. -+
  6279. -+ /* must be last */
  6280. -+ u8 drv_priv[0] __aligned(sizeof(void *));
  6281. -+};
  6282. -+
  6283. -+/**
  6284. - * enum ieee80211_hw_flags - hardware flags
  6285. - *
  6286. - * These flags are used to indicate hardware capabilities to
  6287. -@@ -1770,6 +1830,8 @@ enum ieee80211_hw_flags {
  6288. - * within &struct ieee80211_sta.
  6289. - * @chanctx_data_size: size (in bytes) of the drv_priv data area
  6290. - * within &struct ieee80211_chanctx_conf.
  6291. -+ * @txq_data_size: size (in bytes) of the drv_priv data area
  6292. -+ * within @struct ieee80211_txq.
  6293. - *
  6294. - * @max_rates: maximum number of alternate rate retry stages the hw
  6295. - * can handle.
  6296. -@@ -1818,6 +1880,9 @@ enum ieee80211_hw_flags {
  6297. - * @n_cipher_schemes: a size of an array of cipher schemes definitions.
  6298. - * @cipher_schemes: a pointer to an array of cipher scheme definitions
  6299. - * supported by HW.
  6300. -+ *
  6301. -+ * @txq_ac_max_pending: maximum number of frames per AC pending in all txq
  6302. -+ * entries for a vif.
  6303. - */
  6304. - struct ieee80211_hw {
  6305. - struct ieee80211_conf conf;
  6306. -@@ -1830,6 +1895,7 @@ struct ieee80211_hw {
  6307. - int vif_data_size;
  6308. - int sta_data_size;
  6309. - int chanctx_data_size;
  6310. -+ int txq_data_size;
  6311. - u16 queues;
  6312. - u16 max_listen_interval;
  6313. - s8 max_signal;
  6314. -@@ -1846,6 +1912,7 @@ struct ieee80211_hw {
  6315. - u8 uapsd_max_sp_len;
  6316. - u8 n_cipher_schemes;
  6317. - const struct ieee80211_cipher_scheme *cipher_schemes;
  6318. -+ int txq_ac_max_pending;
  6319. - };
  6320. -
  6321. - /**
  6322. -@@ -3007,6 +3074,8 @@ enum ieee80211_reconfig_type {
  6323. - * response template is provided, together with the location of the
  6324. - * switch-timing IE within the template. The skb can only be used within
  6325. - * the function call.
  6326. -+ *
  6327. -+ * @wake_tx_queue: Called when new packets have been added to the queue.
  6328. - */
  6329. - struct ieee80211_ops {
  6330. - void (*tx)(struct ieee80211_hw *hw,
  6331. -@@ -3238,6 +3307,9 @@ struct ieee80211_ops {
  6332. - void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
  6333. - struct ieee80211_vif *vif,
  6334. - struct ieee80211_tdls_ch_sw_params *params);
  6335. -+
  6336. -+ void (*wake_tx_queue)(struct ieee80211_hw *hw,
  6337. -+ struct ieee80211_txq *txq);
  6338. - };
  6339. -
  6340. - /**
  6341. -@@ -5249,4 +5321,15 @@ void ieee80211_unreserve_tid(struct ieee
  6342. - */
  6343. - size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
  6344. - const u8 *ids, int n_ids, size_t offset);
  6345. -+
  6346. -+/**
  6347. -+ * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
  6348. -+ *
  6349. -+ * @hw: pointer as obtained from ieee80211_alloc_hw()
  6350. -+ * @txq: pointer obtained from station or virtual interface
  6351. -+ *
  6352. -+ * Returns the skb if successful, %NULL if no frame was available.
  6353. -+ */
  6354. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  6355. -+ struct ieee80211_txq *txq);
  6356. - #endif /* MAC80211_H */
  6357. ---- a/net/mac80211/driver-ops.h
  6358. -+++ b/net/mac80211/driver-ops.h
  6359. -@@ -1367,4 +1367,16 @@ drv_tdls_recv_channel_switch(struct ieee
  6360. - trace_drv_return_void(local);
  6361. - }
  6362. -
  6363. -+static inline void drv_wake_tx_queue(struct ieee80211_local *local,
  6364. -+ struct txq_info *txq)
  6365. -+{
  6366. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
  6367. -+
  6368. -+ if (!check_sdata_in_driver(sdata))
  6369. -+ return;
  6370. -+
  6371. -+ trace_drv_wake_tx_queue(local, sdata, txq);
  6372. -+ local->ops->wake_tx_queue(&local->hw, &txq->txq);
  6373. -+}
  6374. -+
  6375. - #endif /* __MAC80211_DRIVER_OPS */
  6376. ---- a/net/mac80211/ieee80211_i.h
  6377. -+++ b/net/mac80211/ieee80211_i.h
  6378. -@@ -809,6 +809,19 @@ struct mac80211_qos_map {
  6379. - struct rcu_head rcu_head;
  6380. - };
  6381. -
  6382. -+enum txq_info_flags {
  6383. -+ IEEE80211_TXQ_STOP,
  6384. -+ IEEE80211_TXQ_AMPDU,
  6385. -+};
  6386. -+
  6387. -+struct txq_info {
  6388. -+ struct sk_buff_head queue;
  6389. -+ unsigned long flags;
  6390. -+
  6391. -+ /* keep last! */
  6392. -+ struct ieee80211_txq txq;
  6393. -+};
  6394. -+
  6395. - struct ieee80211_sub_if_data {
  6396. - struct list_head list;
  6397. -
  6398. -@@ -853,6 +866,7 @@ struct ieee80211_sub_if_data {
  6399. - bool control_port_no_encrypt;
  6400. - int encrypt_headroom;
  6401. -
  6402. -+ atomic_t txqs_len[IEEE80211_NUM_ACS];
  6403. - struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
  6404. - struct mac80211_qos_map __rcu *qos_map;
  6405. -
  6406. -@@ -1453,6 +1467,10 @@ static inline struct ieee80211_local *hw
  6407. - return container_of(hw, struct ieee80211_local, hw);
  6408. - }
  6409. -
  6410. -+static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
  6411. -+{
  6412. -+ return container_of(txq, struct txq_info, txq);
  6413. -+}
  6414. -
  6415. - static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
  6416. - {
  6417. -@@ -1905,6 +1923,9 @@ static inline bool ieee80211_can_run_wor
  6418. - return true;
  6419. - }
  6420. -
  6421. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  6422. -+ struct sta_info *sta,
  6423. -+ struct txq_info *txq, int tid);
  6424. - void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
  6425. - u16 transaction, u16 auth_alg, u16 status,
  6426. - const u8 *extra, size_t extra_len, const u8 *bssid,
  6427. ---- a/net/mac80211/iface.c
  6428. -+++ b/net/mac80211/iface.c
  6429. -@@ -969,6 +969,13 @@ static void ieee80211_do_stop(struct iee
  6430. - }
  6431. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  6432. -
  6433. -+ if (sdata->vif.txq) {
  6434. -+ struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  6435. -+
  6436. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  6437. -+ atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  6438. -+ }
  6439. -+
  6440. - if (local->open_count == 0)
  6441. - ieee80211_clear_tx_pending(local);
  6442. -
  6443. -@@ -1674,6 +1681,7 @@ int ieee80211_if_add(struct ieee80211_lo
  6444. - {
  6445. - struct net_device *ndev = NULL;
  6446. - struct ieee80211_sub_if_data *sdata = NULL;
  6447. -+ struct txq_info *txqi;
  6448. - int ret, i;
  6449. - int txqs = 1;
  6450. -
  6451. -@@ -1693,10 +1701,18 @@ int ieee80211_if_add(struct ieee80211_lo
  6452. - ieee80211_assign_perm_addr(local, wdev->address, type);
  6453. - memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
  6454. - } else {
  6455. -+ int size = ALIGN(sizeof(*sdata) + local->hw.vif_data_size,
  6456. -+ sizeof(void *));
  6457. -+ int txq_size = 0;
  6458. -+
  6459. -+ if (local->ops->wake_tx_queue)
  6460. -+ txq_size += sizeof(struct txq_info) +
  6461. -+ local->hw.txq_data_size;
  6462. -+
  6463. - if (local->hw.queues >= IEEE80211_NUM_ACS)
  6464. - txqs = IEEE80211_NUM_ACS;
  6465. -
  6466. -- ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size,
  6467. -+ ndev = alloc_netdev_mqs(size + txq_size,
  6468. - name, NET_NAME_UNKNOWN,
  6469. - ieee80211_if_setup, txqs, 1);
  6470. - if (!ndev)
  6471. -@@ -1731,6 +1747,11 @@ int ieee80211_if_add(struct ieee80211_lo
  6472. - memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN);
  6473. - memcpy(sdata->name, ndev->name, IFNAMSIZ);
  6474. -
  6475. -+ if (txq_size) {
  6476. -+ txqi = netdev_priv(ndev) + size;
  6477. -+ ieee80211_init_tx_queue(sdata, NULL, txqi, 0);
  6478. -+ }
  6479. -+
  6480. - sdata->dev = ndev;
  6481. - }
  6482. -
  6483. ---- a/net/mac80211/main.c
  6484. -+++ b/net/mac80211/main.c
  6485. -@@ -1019,6 +1019,9 @@ int ieee80211_register_hw(struct ieee802
  6486. -
  6487. - local->dynamic_ps_forced_timeout = -1;
  6488. -
  6489. -+ if (!local->hw.txq_ac_max_pending)
  6490. -+ local->hw.txq_ac_max_pending = 64;
  6491. -+
  6492. - result = ieee80211_wep_init(local);
  6493. - if (result < 0)
  6494. - wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
  6495. ---- a/net/mac80211/sta_info.c
  6496. -+++ b/net/mac80211/sta_info.c
  6497. -@@ -118,6 +118,16 @@ static void __cleanup_single_sta(struct
  6498. - atomic_dec(&ps->num_sta_ps);
  6499. - }
  6500. -
  6501. -+ if (sta->sta.txq[0]) {
  6502. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  6503. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  6504. -+ int n = skb_queue_len(&txqi->queue);
  6505. -+
  6506. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  6507. -+ atomic_sub(n, &sdata->txqs_len[txqi->txq.ac]);
  6508. -+ }
  6509. -+ }
  6510. -+
  6511. - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
  6512. - local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]);
  6513. - ieee80211_purge_tx_queue(&local->hw, &sta->ps_tx_buf[ac]);
  6514. -@@ -234,6 +244,8 @@ void sta_info_free(struct ieee80211_loca
  6515. -
  6516. - sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
  6517. -
  6518. -+ if (sta->sta.txq[0])
  6519. -+ kfree(to_txq_info(sta->sta.txq[0]));
  6520. - kfree(rcu_dereference_raw(sta->sta.rates));
  6521. - kfree(sta);
  6522. - }
  6523. -@@ -285,11 +297,12 @@ struct sta_info *sta_info_alloc(struct i
  6524. - const u8 *addr, gfp_t gfp)
  6525. - {
  6526. - struct ieee80211_local *local = sdata->local;
  6527. -+ struct ieee80211_hw *hw = &local->hw;
  6528. - struct sta_info *sta;
  6529. - struct timespec uptime;
  6530. - int i;
  6531. -
  6532. -- sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp);
  6533. -+ sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp);
  6534. - if (!sta)
  6535. - return NULL;
  6536. -
  6537. -@@ -321,11 +334,25 @@ struct sta_info *sta_info_alloc(struct i
  6538. - for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++)
  6539. - ewma_init(&sta->chain_signal_avg[i], 1024, 8);
  6540. -
  6541. -- if (sta_prepare_rate_control(local, sta, gfp)) {
  6542. -- kfree(sta);
  6543. -- return NULL;
  6544. -+ if (local->ops->wake_tx_queue) {
  6545. -+ void *txq_data;
  6546. -+ int size = sizeof(struct txq_info) +
  6547. -+ ALIGN(hw->txq_data_size, sizeof(void *));
  6548. -+
  6549. -+ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp);
  6550. -+ if (!txq_data)
  6551. -+ goto free;
  6552. -+
  6553. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  6554. -+ struct txq_info *txq = txq_data + i * size;
  6555. -+
  6556. -+ ieee80211_init_tx_queue(sdata, sta, txq, i);
  6557. -+ }
  6558. - }
  6559. -
  6560. -+ if (sta_prepare_rate_control(local, sta, gfp))
  6561. -+ goto free_txq;
  6562. -+
  6563. - for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
  6564. - /*
  6565. - * timer_to_tid must be initialized with identity mapping
  6566. -@@ -346,7 +373,7 @@ struct sta_info *sta_info_alloc(struct i
  6567. - if (sdata->vif.type == NL80211_IFTYPE_AP ||
  6568. - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  6569. - struct ieee80211_supported_band *sband =
  6570. -- local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)];
  6571. -+ hw->wiphy->bands[ieee80211_get_sdata_band(sdata)];
  6572. - u8 smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >>
  6573. - IEEE80211_HT_CAP_SM_PS_SHIFT;
  6574. - /*
  6575. -@@ -371,6 +398,13 @@ struct sta_info *sta_info_alloc(struct i
  6576. - sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
  6577. -
  6578. - return sta;
  6579. -+
  6580. -+free_txq:
  6581. -+ if (sta->sta.txq[0])
  6582. -+ kfree(to_txq_info(sta->sta.txq[0]));
  6583. -+free:
  6584. -+ kfree(sta);
  6585. -+ return NULL;
  6586. - }
  6587. -
  6588. - static int sta_info_insert_check(struct sta_info *sta)
  6589. -@@ -640,6 +674,8 @@ static void __sta_info_recalc_tim(struct
  6590. -
  6591. - indicate_tim |=
  6592. - sta->driver_buffered_tids & tids;
  6593. -+ indicate_tim |=
  6594. -+ sta->txq_buffered_tids & tids;
  6595. - }
  6596. -
  6597. - done:
  6598. -@@ -1071,7 +1107,7 @@ void ieee80211_sta_ps_deliver_wakeup(str
  6599. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  6600. - struct ieee80211_local *local = sdata->local;
  6601. - struct sk_buff_head pending;
  6602. -- int filtered = 0, buffered = 0, ac;
  6603. -+ int filtered = 0, buffered = 0, ac, i;
  6604. - unsigned long flags;
  6605. - struct ps_data *ps;
  6606. -
  6607. -@@ -1090,10 +1126,22 @@ void ieee80211_sta_ps_deliver_wakeup(str
  6608. -
  6609. - BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1);
  6610. - sta->driver_buffered_tids = 0;
  6611. -+ sta->txq_buffered_tids = 0;
  6612. -
  6613. - if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
  6614. - drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
  6615. -
  6616. -+ if (sta->sta.txq[0]) {
  6617. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  6618. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  6619. -+
  6620. -+ if (!skb_queue_len(&txqi->queue))
  6621. -+ continue;
  6622. -+
  6623. -+ drv_wake_tx_queue(local, txqi);
  6624. -+ }
  6625. -+ }
  6626. -+
  6627. - skb_queue_head_init(&pending);
  6628. -
  6629. - /* sync with ieee80211_tx_h_unicast_ps_buf */
  6630. -@@ -1275,8 +1323,10 @@ ieee80211_sta_ps_deliver_response(struct
  6631. - /* if we already have frames from software, then we can't also
  6632. - * release from hardware queues
  6633. - */
  6634. -- if (skb_queue_empty(&frames))
  6635. -+ if (skb_queue_empty(&frames)) {
  6636. - driver_release_tids |= sta->driver_buffered_tids & tids;
  6637. -+ driver_release_tids |= sta->txq_buffered_tids & tids;
  6638. -+ }
  6639. -
  6640. - if (driver_release_tids) {
  6641. - /* If the driver has data on more than one TID then
  6642. -@@ -1447,6 +1497,9 @@ ieee80211_sta_ps_deliver_response(struct
  6643. -
  6644. - sta_info_recalc_tim(sta);
  6645. - } else {
  6646. -+ unsigned long tids = sta->txq_buffered_tids & driver_release_tids;
  6647. -+ int tid;
  6648. -+
  6649. - /*
  6650. - * We need to release a frame that is buffered somewhere in the
  6651. - * driver ... it'll have to handle that.
  6652. -@@ -1466,8 +1519,22 @@ ieee80211_sta_ps_deliver_response(struct
  6653. - * that the TID(s) became empty before returning here from the
  6654. - * release function.
  6655. - * Either way, however, when the driver tells us that the TID(s)
  6656. -- * became empty we'll do the TIM recalculation.
  6657. -+ * became empty or we find that a txq became empty, we'll do the
  6658. -+ * TIM recalculation.
  6659. - */
  6660. -+
  6661. -+ if (!sta->sta.txq[0])
  6662. -+ return;
  6663. -+
  6664. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  6665. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  6666. -+
  6667. -+ if (!(tids & BIT(tid)) || skb_queue_len(&txqi->queue))
  6668. -+ continue;
  6669. -+
  6670. -+ sta_info_recalc_tim(sta);
  6671. -+ break;
  6672. -+ }
  6673. - }
  6674. - }
  6675. -
  6676. ---- a/net/mac80211/sta_info.h
  6677. -+++ b/net/mac80211/sta_info.h
  6678. -@@ -274,6 +274,7 @@ struct sta_ampdu_mlme {
  6679. - * entered power saving state, these are also delivered to
  6680. - * the station when it leaves powersave or polls for frames
  6681. - * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
  6682. -+ * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on
  6683. - * @rx_packets: Number of MSDUs received from this STA
  6684. - * @rx_bytes: Number of bytes received from this STA
  6685. - * @last_rx: time (in jiffies) when last frame was received from this STA
  6686. -@@ -368,6 +369,7 @@ struct sta_info {
  6687. - struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];
  6688. - struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];
  6689. - unsigned long driver_buffered_tids;
  6690. -+ unsigned long txq_buffered_tids;
  6691. -
  6692. - /* Updated from RX path only, no locking requirements */
  6693. - unsigned long rx_packets;
  6694. ---- a/net/mac80211/trace.h
  6695. -+++ b/net/mac80211/trace.h
  6696. -@@ -2312,6 +2312,37 @@ TRACE_EVENT(drv_tdls_recv_channel_switch
  6697. - )
  6698. - );
  6699. -
  6700. -+TRACE_EVENT(drv_wake_tx_queue,
  6701. -+ TP_PROTO(struct ieee80211_local *local,
  6702. -+ struct ieee80211_sub_if_data *sdata,
  6703. -+ struct txq_info *txq),
  6704. -+
  6705. -+ TP_ARGS(local, sdata, txq),
  6706. -+
  6707. -+ TP_STRUCT__entry(
  6708. -+ LOCAL_ENTRY
  6709. -+ VIF_ENTRY
  6710. -+ STA_ENTRY
  6711. -+ __field(u8, ac)
  6712. -+ __field(u8, tid)
  6713. -+ ),
  6714. -+
  6715. -+ TP_fast_assign(
  6716. -+ struct ieee80211_sta *sta = txq->txq.sta;
  6717. -+
  6718. -+ LOCAL_ASSIGN;
  6719. -+ VIF_ASSIGN;
  6720. -+ STA_ASSIGN;
  6721. -+ __entry->ac = txq->txq.ac;
  6722. -+ __entry->tid = txq->txq.tid;
  6723. -+ ),
  6724. -+
  6725. -+ TP_printk(
  6726. -+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " ac:%d tid:%d",
  6727. -+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->ac, __entry->tid
  6728. -+ )
  6729. -+);
  6730. -+
  6731. - #ifdef CPTCFG_MAC80211_MESSAGE_TRACING
  6732. - #undef TRACE_SYSTEM
  6733. - #define TRACE_SYSTEM mac80211_msg
  6734. ---- a/net/mac80211/tx.c
  6735. -+++ b/net/mac80211/tx.c
  6736. -@@ -776,12 +776,22 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  6737. - return TX_CONTINUE;
  6738. - }
  6739. -
  6740. -+static __le16 ieee80211_tx_next_seq(struct sta_info *sta, int tid)
  6741. -+{
  6742. -+ u16 *seq = &sta->tid_seq[tid];
  6743. -+ __le16 ret = cpu_to_le16(*seq);
  6744. -+
  6745. -+ /* Increase the sequence number. */
  6746. -+ *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  6747. -+
  6748. -+ return ret;
  6749. -+}
  6750. -+
  6751. - static ieee80211_tx_result debug_noinline
  6752. - ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
  6753. - {
  6754. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
  6755. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
  6756. -- u16 *seq;
  6757. - u8 *qc;
  6758. - int tid;
  6759. -
  6760. -@@ -832,13 +842,10 @@ ieee80211_tx_h_sequence(struct ieee80211
  6761. -
  6762. - qc = ieee80211_get_qos_ctl(hdr);
  6763. - tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
  6764. -- seq = &tx->sta->tid_seq[tid];
  6765. - tx->sta->tx_msdu[tid]++;
  6766. -
  6767. -- hdr->seq_ctrl = cpu_to_le16(*seq);
  6768. --
  6769. -- /* Increase the sequence number. */
  6770. -- *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  6771. -+ if (!tx->sta->sta.txq[0])
  6772. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);
  6773. -
  6774. - return TX_CONTINUE;
  6775. - }
  6776. -@@ -1067,7 +1074,7 @@ static bool ieee80211_tx_prep_agg(struct
  6777. - * nothing -- this aggregation session is being started
  6778. - * but that might still fail with the driver
  6779. - */
  6780. -- } else {
  6781. -+ } else if (!tx->sta->sta.txq[tid]) {
  6782. - spin_lock(&tx->sta->lock);
  6783. - /*
  6784. - * Need to re-check now, because we may get here
  6785. -@@ -1201,13 +1208,102 @@ ieee80211_tx_prepare(struct ieee80211_su
  6786. - return TX_CONTINUE;
  6787. - }
  6788. -
  6789. -+static void ieee80211_drv_tx(struct ieee80211_local *local,
  6790. -+ struct ieee80211_vif *vif,
  6791. -+ struct ieee80211_sta *pubsta,
  6792. -+ struct sk_buff *skb)
  6793. -+{
  6794. -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  6795. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
  6796. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6797. -+ struct ieee80211_tx_control control = {
  6798. -+ .sta = pubsta,
  6799. -+ };
  6800. -+ struct ieee80211_txq *txq = NULL;
  6801. -+ struct txq_info *txqi;
  6802. -+ u8 ac;
  6803. -+
  6804. -+ if (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)
  6805. -+ goto tx_normal;
  6806. -+
  6807. -+ if (!ieee80211_is_data(hdr->frame_control))
  6808. -+ goto tx_normal;
  6809. -+
  6810. -+ if (pubsta) {
  6811. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
  6812. -+
  6813. -+ txq = pubsta->txq[tid];
  6814. -+ } else if (vif) {
  6815. -+ txq = vif->txq;
  6816. -+ }
  6817. -+
  6818. -+ if (!txq)
  6819. -+ goto tx_normal;
  6820. -+
  6821. -+ ac = txq->ac;
  6822. -+ txqi = to_txq_info(txq);
  6823. -+ atomic_inc(&sdata->txqs_len[ac]);
  6824. -+ if (atomic_read(&sdata->txqs_len[ac]) >= local->hw.txq_ac_max_pending)
  6825. -+ netif_stop_subqueue(sdata->dev, ac);
  6826. -+
  6827. -+ skb_queue_tail(&txqi->queue, skb);
  6828. -+ drv_wake_tx_queue(local, txqi);
  6829. -+
  6830. -+ return;
  6831. -+
  6832. -+tx_normal:
  6833. -+ drv_tx(local, &control, skb);
  6834. -+}
  6835. -+
  6836. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  6837. -+ struct ieee80211_txq *txq)
  6838. -+{
  6839. -+ struct ieee80211_local *local = hw_to_local(hw);
  6840. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif);
  6841. -+ struct txq_info *txqi = container_of(txq, struct txq_info, txq);
  6842. -+ struct ieee80211_hdr *hdr;
  6843. -+ struct sk_buff *skb = NULL;
  6844. -+ u8 ac = txq->ac;
  6845. -+
  6846. -+ spin_lock_bh(&txqi->queue.lock);
  6847. -+
  6848. -+ if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags))
  6849. -+ goto out;
  6850. -+
  6851. -+ skb = __skb_dequeue(&txqi->queue);
  6852. -+ if (!skb)
  6853. -+ goto out;
  6854. -+
  6855. -+ atomic_dec(&sdata->txqs_len[ac]);
  6856. -+ if (__netif_subqueue_stopped(sdata->dev, ac))
  6857. -+ ieee80211_propagate_queue_wake(local, sdata->vif.hw_queue[ac]);
  6858. -+
  6859. -+ hdr = (struct ieee80211_hdr *)skb->data;
  6860. -+ if (txq->sta && ieee80211_is_data_qos(hdr->frame_control)) {
  6861. -+ struct sta_info *sta = container_of(txq->sta, struct sta_info,
  6862. -+ sta);
  6863. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6864. -+
  6865. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, txq->tid);
  6866. -+ if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
  6867. -+ info->flags |= IEEE80211_TX_CTL_AMPDU;
  6868. -+ else
  6869. -+ info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  6870. -+ }
  6871. -+
  6872. -+out:
  6873. -+ spin_unlock_bh(&txqi->queue.lock);
  6874. -+
  6875. -+ return skb;
  6876. -+}
  6877. -+EXPORT_SYMBOL(ieee80211_tx_dequeue);
  6878. -+
  6879. - static bool ieee80211_tx_frags(struct ieee80211_local *local,
  6880. - struct ieee80211_vif *vif,
  6881. - struct ieee80211_sta *sta,
  6882. - struct sk_buff_head *skbs,
  6883. - bool txpending)
  6884. - {
  6885. -- struct ieee80211_tx_control control;
  6886. - struct sk_buff *skb, *tmp;
  6887. - unsigned long flags;
  6888. -
  6889. -@@ -1265,10 +1361,9 @@ static bool ieee80211_tx_frags(struct ie
  6890. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  6891. -
  6892. - info->control.vif = vif;
  6893. -- control.sta = sta;
  6894. -
  6895. - __skb_unlink(skb, skbs);
  6896. -- drv_tx(local, &control, skb);
  6897. -+ ieee80211_drv_tx(local, vif, sta, skb);
  6898. - }
  6899. -
  6900. - return true;
  6901. ---- a/net/mac80211/util.c
  6902. -+++ b/net/mac80211/util.c
  6903. -@@ -308,6 +308,11 @@ void ieee80211_propagate_queue_wake(stru
  6904. - for (ac = 0; ac < n_acs; ac++) {
  6905. - int ac_queue = sdata->vif.hw_queue[ac];
  6906. -
  6907. -+ if (local->ops->wake_tx_queue &&
  6908. -+ (atomic_read(&sdata->txqs_len[ac]) >
  6909. -+ local->hw.txq_ac_max_pending))
  6910. -+ continue;
  6911. -+
  6912. - if (ac_queue == queue ||
  6913. - (sdata->vif.cab_queue == queue &&
  6914. - local->queue_stop_reasons[ac_queue] == 0 &&
  6915. -@@ -3307,3 +3312,20 @@ u8 *ieee80211_add_wmm_info_ie(u8 *buf, u
  6916. -
  6917. - return buf;
  6918. - }
  6919. -+
  6920. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  6921. -+ struct sta_info *sta,
  6922. -+ struct txq_info *txqi, int tid)
  6923. -+{
  6924. -+ skb_queue_head_init(&txqi->queue);
  6925. -+ txqi->txq.vif = &sdata->vif;
  6926. -+
  6927. -+ if (sta) {
  6928. -+ txqi->txq.sta = &sta->sta;
  6929. -+ sta->sta.txq[tid] = &txqi->txq;
  6930. -+ txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  6931. -+ } else {
  6932. -+ sdata->vif.txq = &txqi->txq;
  6933. -+ txqi->txq.ac = IEEE80211_AC_BE;
  6934. -+ }
  6935. -+}
  6936. ---- a/net/mac80211/rx.c
  6937. -+++ b/net/mac80211/rx.c
  6938. -@@ -1176,6 +1176,7 @@ static void sta_ps_start(struct sta_info
  6939. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  6940. - struct ieee80211_local *local = sdata->local;
  6941. - struct ps_data *ps;
  6942. -+ int tid;
  6943. -
  6944. - if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
  6945. - sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
  6946. -@@ -1189,6 +1190,18 @@ static void sta_ps_start(struct sta_info
  6947. - drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
  6948. - ps_dbg(sdata, "STA %pM aid %d enters power save mode\n",
  6949. - sta->sta.addr, sta->sta.aid);
  6950. -+
  6951. -+ if (!sta->sta.txq[0])
  6952. -+ return;
  6953. -+
  6954. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  6955. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  6956. -+
  6957. -+ if (!skb_queue_len(&txqi->queue))
  6958. -+ set_bit(tid, &sta->txq_buffered_tids);
  6959. -+ else
  6960. -+ clear_bit(tid, &sta->txq_buffered_tids);
  6961. -+ }
  6962. - }
  6963. -
  6964. - static void sta_ps_end(struct sta_info *sta)
  6965. ---- a/net/mac80211/agg-tx.c
  6966. -+++ b/net/mac80211/agg-tx.c
  6967. -@@ -188,6 +188,43 @@ ieee80211_wake_queue_agg(struct ieee8021
  6968. - __release(agg_queue);
  6969. - }
  6970. -
  6971. -+static void
  6972. -+ieee80211_agg_stop_txq(struct sta_info *sta, int tid)
  6973. -+{
  6974. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  6975. -+ struct txq_info *txqi;
  6976. -+
  6977. -+ if (!txq)
  6978. -+ return;
  6979. -+
  6980. -+ txqi = to_txq_info(txq);
  6981. -+
  6982. -+ /* Lock here to protect against further seqno updates on dequeue */
  6983. -+ spin_lock_bh(&txqi->queue.lock);
  6984. -+ set_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  6985. -+ spin_unlock_bh(&txqi->queue.lock);
  6986. -+}
  6987. -+
  6988. -+static void
  6989. -+ieee80211_agg_start_txq(struct sta_info *sta, int tid, bool enable)
  6990. -+{
  6991. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  6992. -+ struct txq_info *txqi;
  6993. -+
  6994. -+ if (!txq)
  6995. -+ return;
  6996. -+
  6997. -+ txqi = to_txq_info(txq);
  6998. -+
  6999. -+ if (enable)
  7000. -+ set_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  7001. -+ else
  7002. -+ clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  7003. -+
  7004. -+ clear_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  7005. -+ drv_wake_tx_queue(sta->sdata->local, txqi);
  7006. -+}
  7007. -+
  7008. - /*
  7009. - * splice packets from the STA's pending to the local pending,
  7010. - * requires a call to ieee80211_agg_splice_finish later
  7011. -@@ -247,6 +284,7 @@ static void ieee80211_remove_tid_tx(stru
  7012. - ieee80211_assign_tid_tx(sta, tid, NULL);
  7013. -
  7014. - ieee80211_agg_splice_finish(sta->sdata, tid);
  7015. -+ ieee80211_agg_start_txq(sta, tid, false);
  7016. -
  7017. - kfree_rcu(tid_tx, rcu_head);
  7018. - }
  7019. -@@ -418,6 +456,8 @@ void ieee80211_tx_ba_session_handle_star
  7020. - */
  7021. - clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
  7022. -
  7023. -+ ieee80211_agg_stop_txq(sta, tid);
  7024. -+
  7025. - /*
  7026. - * Make sure no packets are being processed. This ensures that
  7027. - * we have a valid starting sequence number and that in-flight
  7028. -@@ -440,6 +480,8 @@ void ieee80211_tx_ba_session_handle_star
  7029. - ieee80211_agg_splice_finish(sdata, tid);
  7030. - spin_unlock_bh(&sta->lock);
  7031. -
  7032. -+ ieee80211_agg_start_txq(sta, tid, false);
  7033. -+
  7034. - kfree_rcu(tid_tx, rcu_head);
  7035. - return;
  7036. - }
  7037. -@@ -666,6 +708,8 @@ static void ieee80211_agg_tx_operational
  7038. - ieee80211_agg_splice_finish(sta->sdata, tid);
  7039. -
  7040. - spin_unlock_bh(&sta->lock);
  7041. -+
  7042. -+ ieee80211_agg_start_txq(sta, tid, true);
  7043. - }
  7044. -
  7045. - void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
  7046. 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
  7047. new file mode 100644
  7048. index 0000000..4faac0d
  7049. --- /dev/null
  7050. +++ b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch
  7051. @@ -0,0 +1,121 @@
  7052. +From: Felix Fietkau <nbd@openwrt.org>
  7053. +Date: Thu, 2 Jul 2015 15:20:56 +0200
  7054. +Subject: [PATCH] ath9k: limit retries for powersave response frames
  7055. +
  7056. +In some cases, the channel might be busy enough that an ath9k AP's
  7057. +response to PS-Poll frames might be too slow and the station has already
  7058. +gone to sleep. To avoid wasting too much airtime on this, limit the
  7059. +number of retries on such frames and ensure that no sample rate gets
  7060. +used.
  7061. +
  7062. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7063. +---
  7064. +
  7065. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  7066. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  7067. +@@ -147,10 +147,25 @@ static void ath_send_bar(struct ath_atx_
  7068. + }
  7069. +
  7070. + static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
  7071. +- struct ath_buf *bf)
  7072. ++ struct ath_buf *bf, bool ps)
  7073. + {
  7074. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
  7075. ++
  7076. ++ if (ps) {
  7077. ++ /* Clear the first rate to avoid using a sample rate for PS frames */
  7078. ++ info->control.rates[0].idx = -1;
  7079. ++ info->control.rates[0].count = 0;
  7080. ++ }
  7081. ++
  7082. + ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
  7083. + ARRAY_SIZE(bf->rates));
  7084. ++ if (!ps)
  7085. ++ return;
  7086. ++
  7087. ++ if (bf->rates[0].count > 2)
  7088. ++ bf->rates[0].count = 2;
  7089. ++
  7090. ++ bf->rates[1].idx = -1;
  7091. + }
  7092. +
  7093. + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
  7094. +@@ -1430,7 +1445,7 @@ ath_tx_form_burst(struct ath_softc *sc,
  7095. + if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  7096. + break;
  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. + } while (1);
  7101. + }
  7102. +
  7103. +@@ -1461,7 +1476,7 @@ static bool ath_tx_sched_aggr(struct ath
  7104. + return false;
  7105. + }
  7106. +
  7107. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  7108. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  7109. + if (aggr)
  7110. + last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
  7111. + tid_q, &aggr_len);
  7112. +@@ -1653,7 +1668,7 @@ void ath9k_release_buffered_frames(struc
  7113. +
  7114. + __skb_unlink(bf->bf_mpdu, tid_q);
  7115. + list_add_tail(&bf->list, &bf_q);
  7116. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  7117. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  7118. + if (bf_isampdu(bf)) {
  7119. + ath_tx_addto_baw(sc, tid, bf);
  7120. + bf->bf_state.bf_type &= ~BUF_AGGR;
  7121. +@@ -2318,7 +2333,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  7122. + struct ath_txq *txq = txctl->txq;
  7123. + struct ath_atx_tid *tid = NULL;
  7124. + struct ath_buf *bf;
  7125. +- bool queue, skip_uapsd = false, ps_resp;
  7126. ++ bool queue, ps_resp;
  7127. + int q, ret;
  7128. +
  7129. + if (vif)
  7130. +@@ -2365,13 +2380,13 @@ int ath_tx_start(struct ieee80211_hw *hw
  7131. + if (!txctl->an)
  7132. + txctl->an = &avp->mcast_node;
  7133. + queue = true;
  7134. +- skip_uapsd = true;
  7135. ++ ps_resp = false;
  7136. + }
  7137. +
  7138. + if (txctl->an && queue)
  7139. + tid = ath_get_skb_tid(sc, txctl->an, skb);
  7140. +
  7141. +- if (!skip_uapsd && ps_resp) {
  7142. ++ if (ps_resp) {
  7143. + ath_txq_unlock(sc, txq);
  7144. + txq = sc->tx.uapsdq;
  7145. + ath_txq_lock(sc, txq);
  7146. +@@ -2409,7 +2424,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  7147. + if (txctl->paprd)
  7148. + bf->bf_state.bfs_paprd_timestamp = jiffies;
  7149. +
  7150. +- ath_set_rates(vif, sta, bf);
  7151. ++ ath_set_rates(vif, sta, bf, ps_resp);
  7152. + ath_tx_send_normal(sc, txq, tid, skb);
  7153. +
  7154. + out:
  7155. +@@ -2448,7 +2463,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw
  7156. + break;
  7157. +
  7158. + bf->bf_lastbf = bf;
  7159. +- ath_set_rates(vif, NULL, bf);
  7160. ++ ath_set_rates(vif, NULL, bf, false);
  7161. + ath_buf_set_rate(sc, bf, &info, fi->framelen, false);
  7162. + duration += info.rates[0].PktDuration;
  7163. + if (bf_tail)
  7164. +@@ -2968,7 +2983,7 @@ int ath9k_tx99_send(struct ath_softc *sc
  7165. + return -EINVAL;
  7166. + }
  7167. +
  7168. +- ath_set_rates(sc->tx99_vif, NULL, bf);
  7169. ++ ath_set_rates(sc->tx99_vif, NULL, bf, false);
  7170. +
  7171. + ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);
  7172. + ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum);
  7173. diff --git a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch b/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  7174. deleted file mode 100644
  7175. index 465d943..0000000
  7176. --- a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  7177. +++ /dev/null
  7178. @@ -1,125 +0,0 @@
  7179. -From: Johannes Berg <johannes.berg@intel.com>
  7180. -Date: Wed, 11 Mar 2015 09:14:15 +0100
  7181. -Subject: [PATCH] mac80211: lock rate control
  7182. -
  7183. -Both minstrel (reported by Sven Eckelmann) and the iwlwifi rate
  7184. -control aren't properly taking concurrency into account. It's
  7185. -likely that the same is true for other rate control algorithms.
  7186. -
  7187. -In the case of minstrel this manifests itself in crashes when an
  7188. -update and other data access are run concurrently, for example
  7189. -when the stations change bandwidth or similar. In iwlwifi, this
  7190. -can cause firmware crashes.
  7191. -
  7192. -Since fixing all rate control algorithms will be very difficult,
  7193. -just provide locking for invocations. This protects the internal
  7194. -data structures the algorithms maintain.
  7195. -
  7196. -I've manipulated hostapd to test this, by having it change its
  7197. -advertised bandwidth roughly ever 150ms. At the same time, I'm
  7198. -running a flood ping between the client and the AP, which causes
  7199. -this race of update vs. get_rate/status to easily happen on the
  7200. -client. With this change, the system survives this test.
  7201. -
  7202. -Reported-by: Sven Eckelmann <sven@open-mesh.com>
  7203. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7204. ----
  7205. -
  7206. ---- a/net/mac80211/rate.c
  7207. -+++ b/net/mac80211/rate.c
  7208. -@@ -683,7 +683,13 @@ void rate_control_get_rate(struct ieee80
  7209. - if (sdata->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
  7210. - return;
  7211. -
  7212. -- ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  7213. -+ if (ista) {
  7214. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7215. -+ ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  7216. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7217. -+ } else {
  7218. -+ ref->ops->get_rate(ref->priv, NULL, NULL, txrc);
  7219. -+ }
  7220. -
  7221. - if (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_RC_TABLE)
  7222. - return;
  7223. ---- a/net/mac80211/rate.h
  7224. -+++ b/net/mac80211/rate.h
  7225. -@@ -42,10 +42,12 @@ static inline void rate_control_tx_statu
  7226. - if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
  7227. - return;
  7228. -
  7229. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7230. - if (ref->ops->tx_status)
  7231. - ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
  7232. - else
  7233. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  7234. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7235. - }
  7236. -
  7237. - static inline void
  7238. -@@ -64,7 +66,9 @@ rate_control_tx_status_noskb(struct ieee
  7239. - if (WARN_ON_ONCE(!ref->ops->tx_status_noskb))
  7240. - return;
  7241. -
  7242. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7243. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  7244. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7245. - }
  7246. -
  7247. - static inline void rate_control_rate_init(struct sta_info *sta)
  7248. -@@ -91,8 +95,10 @@ static inline void rate_control_rate_ini
  7249. -
  7250. - sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  7251. -
  7252. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7253. - ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  7254. - priv_sta);
  7255. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7256. - rcu_read_unlock();
  7257. - set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  7258. - }
  7259. -@@ -115,18 +121,20 @@ static inline void rate_control_rate_upd
  7260. - return;
  7261. - }
  7262. -
  7263. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7264. - ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  7265. - ista, priv_sta, changed);
  7266. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7267. - rcu_read_unlock();
  7268. - }
  7269. - drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  7270. - }
  7271. -
  7272. - static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  7273. -- struct ieee80211_sta *sta,
  7274. -- gfp_t gfp)
  7275. -+ struct sta_info *sta, gfp_t gfp)
  7276. - {
  7277. -- return ref->ops->alloc_sta(ref->priv, sta, gfp);
  7278. -+ spin_lock_init(&sta->rate_ctrl_lock);
  7279. -+ return ref->ops->alloc_sta(ref->priv, &sta->sta, gfp);
  7280. - }
  7281. -
  7282. - static inline void rate_control_free_sta(struct sta_info *sta)
  7283. ---- a/net/mac80211/sta_info.c
  7284. -+++ b/net/mac80211/sta_info.c
  7285. -@@ -286,7 +286,7 @@ static int sta_prepare_rate_control(stru
  7286. -
  7287. - sta->rate_ctrl = local->rate_ctrl;
  7288. - sta->rate_ctrl_priv = rate_control_alloc_sta(sta->rate_ctrl,
  7289. -- &sta->sta, gfp);
  7290. -+ sta, gfp);
  7291. - if (!sta->rate_ctrl_priv)
  7292. - return -ENOMEM;
  7293. -
  7294. ---- a/net/mac80211/sta_info.h
  7295. -+++ b/net/mac80211/sta_info.h
  7296. -@@ -349,6 +349,7 @@ struct sta_info {
  7297. - u8 ptk_idx;
  7298. - struct rate_control_ref *rate_ctrl;
  7299. - void *rate_ctrl_priv;
  7300. -+ spinlock_t rate_ctrl_lock;
  7301. - spinlock_t lock;
  7302. -
  7303. - struct work_struct drv_deliver_wk;
  7304. 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
  7305. new file mode 100644
  7306. index 0000000..820aa9a
  7307. --- /dev/null
  7308. +++ b/package/kernel/mac80211/patches/302-ath10k-Delay-device-access-after-cold-reset.patch
  7309. @@ -0,0 +1,56 @@
  7310. +From: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
  7311. +Date: Fri, 3 Jul 2015 11:45:42 +0530
  7312. +Subject: [PATCH] ath10k: Delay device access after cold reset
  7313. +
  7314. +It is observed that during cold reset pcie access right
  7315. +after a write operation to SOC_GLOBAL_RESET_ADDRESS causes
  7316. +Data Bus Error and system hard lockup. The reason
  7317. +for bus error is that pcie needs some time to get
  7318. +back to stable state for any transaction during cold reset. Add
  7319. +delay of 20 msecs after write of SOC_GLOBAL_RESET_ADDRESS
  7320. +to fix this issue.
  7321. +
  7322. +Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
  7323. +---
  7324. +
  7325. +--- a/drivers/net/wireless/ath/ath10k/pci.c
  7326. ++++ b/drivers/net/wireless/ath/ath10k/pci.c
  7327. +@@ -2761,7 +2761,6 @@ static int ath10k_pci_wait_for_target_in
  7328. +
  7329. + static int ath10k_pci_cold_reset(struct ath10k *ar)
  7330. + {
  7331. +- int i;
  7332. + u32 val;
  7333. +
  7334. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot cold reset\n");
  7335. +@@ -2777,23 +2776,18 @@ static int ath10k_pci_cold_reset(struct
  7336. + val |= 1;
  7337. + ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
  7338. +
  7339. +- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
  7340. +- if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
  7341. +- RTC_STATE_COLD_RESET_MASK)
  7342. +- break;
  7343. +- msleep(1);
  7344. +- }
  7345. ++ /* After writing into SOC_GLOBAL_RESET to put device into
  7346. ++ * reset and pulling out of reset pcie may not be stable
  7347. ++ * for any immediate pcie register access and cause bus error,
  7348. ++ * add delay before any pcie access request to fix this issue.
  7349. ++ */
  7350. ++ msleep(20);
  7351. +
  7352. + /* Pull Target, including PCIe, out of RESET. */
  7353. + val &= ~1;
  7354. + ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
  7355. +
  7356. +- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
  7357. +- if (!(ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
  7358. +- RTC_STATE_COLD_RESET_MASK))
  7359. +- break;
  7360. +- msleep(1);
  7361. +- }
  7362. ++ msleep(20);
  7363. +
  7364. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot cold reset complete\n");
  7365. +
  7366. 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
  7367. deleted file mode 100644
  7368. index e54e16e..0000000
  7369. --- a/package/kernel/mac80211/patches/302-ath9k-restart-only-triggering-DFS-detector-line.patch
  7370. +++ /dev/null
  7371. @@ -1,21 +0,0 @@
  7372. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7373. -Date: Tue, 10 Mar 2015 17:49:29 +0100
  7374. -Subject: [PATCH] ath9k: restart only triggering DFS detector line
  7375. -
  7376. -To support HT40 DFS mode, a triggering detector must
  7377. -reset only itself but not other detector lines.
  7378. -
  7379. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7380. ----
  7381. -
  7382. ---- a/drivers/net/wireless/ath/dfs_pattern_detector.c
  7383. -+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
  7384. -@@ -289,7 +289,7 @@ dpd_add_pulse(struct dfs_pattern_detecto
  7385. - "count=%d, count_false=%d\n",
  7386. - event->freq, pd->rs->type_id,
  7387. - ps->pri, ps->count, ps->count_falses);
  7388. -- channel_detector_reset(dpd, cd);
  7389. -+ pd->reset(pd, dpd->last_pulse_ts);
  7390. - return true;
  7391. - }
  7392. - }
  7393. 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
  7394. deleted file mode 100644
  7395. index ed268ea..0000000
  7396. --- a/package/kernel/mac80211/patches/303-ath9k-add-DFS-support-for-extension-channel.patch
  7397. +++ /dev/null
  7398. @@ -1,76 +0,0 @@
  7399. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7400. -Date: Tue, 10 Mar 2015 17:49:30 +0100
  7401. -Subject: [PATCH] ath9k: add DFS support for extension channel
  7402. -
  7403. -In HT40 modes, pulse events on primary and extension
  7404. -channel are processed individually. If valid, a pulse
  7405. -event will be fed into the detector
  7406. -* for primary frequency, or
  7407. -* for extension frequency (+/-20MHz based on HT40-mode)
  7408. -* or both
  7409. -
  7410. -With that, a 40MHz radar will result in two individual
  7411. -radar events.
  7412. -
  7413. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7414. ----
  7415. -
  7416. ---- a/drivers/net/wireless/ath/ath9k/dfs.c
  7417. -+++ b/drivers/net/wireless/ath/ath9k/dfs.c
  7418. -@@ -126,8 +126,19 @@ ath9k_postprocess_radar_event(struct ath
  7419. - DFS_STAT_INC(sc, pulses_detected);
  7420. - return true;
  7421. - }
  7422. --#undef PRI_CH_RADAR_FOUND
  7423. --#undef EXT_CH_RADAR_FOUND
  7424. -+
  7425. -+static void
  7426. -+ath9k_dfs_process_radar_pulse(struct ath_softc *sc, struct pulse_event *pe)
  7427. -+{
  7428. -+ struct dfs_pattern_detector *pd = sc->dfs_detector;
  7429. -+ DFS_STAT_INC(sc, pulses_processed);
  7430. -+ if (pd == NULL)
  7431. -+ return;
  7432. -+ if (!pd->add_pulse(pd, pe))
  7433. -+ return;
  7434. -+ DFS_STAT_INC(sc, radar_detected);
  7435. -+ ieee80211_radar_detected(sc->hw);
  7436. -+}
  7437. -
  7438. - /*
  7439. - * DFS: check PHY-error for radar pulse and feed the detector
  7440. -@@ -176,18 +187,21 @@ void ath9k_dfs_process_phyerr(struct ath
  7441. - ard.pulse_length_pri = vdata_end[-3];
  7442. - pe.freq = ah->curchan->channel;
  7443. - pe.ts = mactime;
  7444. -- if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
  7445. -- struct dfs_pattern_detector *pd = sc->dfs_detector;
  7446. -- ath_dbg(common, DFS,
  7447. -- "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, "
  7448. -- "width=%d, rssi=%d, delta_ts=%llu\n",
  7449. -- pe.freq, pe.ts, pe.width, pe.rssi,
  7450. -- pe.ts - sc->dfs_prev_pulse_ts);
  7451. -- sc->dfs_prev_pulse_ts = pe.ts;
  7452. -- DFS_STAT_INC(sc, pulses_processed);
  7453. -- if (pd != NULL && pd->add_pulse(pd, &pe)) {
  7454. -- DFS_STAT_INC(sc, radar_detected);
  7455. -- ieee80211_radar_detected(sc->hw);
  7456. -- }
  7457. -+ if (!ath9k_postprocess_radar_event(sc, &ard, &pe))
  7458. -+ return;
  7459. -+
  7460. -+ ath_dbg(common, DFS,
  7461. -+ "ath9k_dfs_process_phyerr: type=%d, freq=%d, ts=%llu, "
  7462. -+ "width=%d, rssi=%d, delta_ts=%llu\n",
  7463. -+ ard.pulse_bw_info, pe.freq, pe.ts, pe.width, pe.rssi,
  7464. -+ pe.ts - sc->dfs_prev_pulse_ts);
  7465. -+ sc->dfs_prev_pulse_ts = pe.ts;
  7466. -+ if (ard.pulse_bw_info & PRI_CH_RADAR_FOUND)
  7467. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  7468. -+ if (ard.pulse_bw_info & EXT_CH_RADAR_FOUND) {
  7469. -+ pe.freq += IS_CHAN_HT40PLUS(ah->curchan) ? 20 : -20;
  7470. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  7471. - }
  7472. - }
  7473. -+#undef PRI_CH_RADAR_FOUND
  7474. -+#undef EXT_CH_RADAR_FOUND
  7475. 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
  7476. new file mode 100644
  7477. index 0000000..139015c
  7478. --- /dev/null
  7479. +++ b/package/kernel/mac80211/patches/303-ath9k-add-fast-xmit-support.patch
  7480. @@ -0,0 +1,17 @@
  7481. +From: Felix Fietkau <nbd@openwrt.org>
  7482. +Date: Mon, 11 May 2015 18:35:20 +0200
  7483. +Subject: [PATCH] ath9k: add fast-xmit support
  7484. +
  7485. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7486. +---
  7487. +
  7488. +--- a/drivers/net/wireless/ath/ath9k/init.c
  7489. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  7490. +@@ -826,6 +826,7 @@ static void ath9k_set_hw_capab(struct at
  7491. + ieee80211_hw_set(hw, SIGNAL_DBM);
  7492. + ieee80211_hw_set(hw, RX_INCLUDES_FCS);
  7493. + ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
  7494. ++ ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
  7495. +
  7496. + if (ath9k_ps_enable)
  7497. + ieee80211_hw_set(hw, SUPPORTS_PS);
  7498. 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
  7499. deleted file mode 100644
  7500. index e1eab64..0000000
  7501. --- a/package/kernel/mac80211/patches/304-ath9k-allow-40MHz-radar-detection-width.patch
  7502. +++ /dev/null
  7503. @@ -1,19 +0,0 @@
  7504. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7505. -Date: Tue, 10 Mar 2015 17:49:31 +0100
  7506. -Subject: [PATCH] ath9k: allow 40MHz radar detection width
  7507. -
  7508. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7509. ----
  7510. -
  7511. ---- a/drivers/net/wireless/ath/ath9k/init.c
  7512. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  7513. -@@ -763,7 +763,8 @@ static const struct ieee80211_iface_comb
  7514. - .num_different_channels = 1,
  7515. - .beacon_int_infra_match = true,
  7516. - .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  7517. -- BIT(NL80211_CHAN_WIDTH_20),
  7518. -+ BIT(NL80211_CHAN_WIDTH_20) |
  7519. -+ BIT(NL80211_CHAN_WIDTH_40),
  7520. - }
  7521. - #endif
  7522. - };
  7523. 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
  7524. new file mode 100644
  7525. index 0000000..9f04276
  7526. --- /dev/null
  7527. +++ b/package/kernel/mac80211/patches/304-ath9k-remove-struct-ath_atx_ac.patch
  7528. @@ -0,0 +1,385 @@
  7529. +From: Felix Fietkau <nbd@openwrt.org>
  7530. +Date: Sat, 4 Apr 2015 18:39:06 +0200
  7531. +Subject: [PATCH] ath9k: remove struct ath_atx_ac
  7532. +
  7533. +struct ath_atx_ac contains a list of active TIDs belonging to one WMM AC.
  7534. +This patch changes the code to track active station TIDs in the txq directly.
  7535. +
  7536. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7537. +---
  7538. +
  7539. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  7540. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  7541. +@@ -173,14 +173,6 @@ struct ath_txq {
  7542. + struct sk_buff_head complete_q;
  7543. + };
  7544. +
  7545. +-struct ath_atx_ac {
  7546. +- struct ath_txq *txq;
  7547. +- struct list_head list;
  7548. +- struct list_head tid_q;
  7549. +- bool clear_ps_filter;
  7550. +- bool sched;
  7551. +-};
  7552. +-
  7553. + struct ath_frame_info {
  7554. + struct ath_buf *bf;
  7555. + u16 framelen;
  7556. +@@ -243,7 +235,7 @@ struct ath_atx_tid {
  7557. + struct sk_buff_head buf_q;
  7558. + struct sk_buff_head retry_q;
  7559. + struct ath_node *an;
  7560. +- struct ath_atx_ac *ac;
  7561. ++ struct ath_txq *txq;
  7562. + unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
  7563. + u16 seq_start;
  7564. + u16 seq_next;
  7565. +@@ -255,6 +247,7 @@ struct ath_atx_tid {
  7566. + s8 bar_index;
  7567. + bool sched;
  7568. + bool active;
  7569. ++ bool clear_ps_filter;
  7570. + };
  7571. +
  7572. + struct ath_node {
  7573. +@@ -262,7 +255,6 @@ struct ath_node {
  7574. + struct ieee80211_sta *sta; /* station struct we're part of */
  7575. + struct ieee80211_vif *vif; /* interface with which we're associated */
  7576. + struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
  7577. +- struct ath_atx_ac ac[IEEE80211_NUM_ACS];
  7578. +
  7579. + u16 maxampdu;
  7580. + u8 mpdudensity;
  7581. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  7582. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  7583. +@@ -106,7 +106,6 @@ void ath_txq_unlock_complete(struct ath_
  7584. + static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq,
  7585. + struct ath_atx_tid *tid)
  7586. + {
  7587. +- struct ath_atx_ac *ac = tid->ac;
  7588. + struct list_head *list;
  7589. + struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv;
  7590. + struct ath_chanctx *ctx = avp->chanctx;
  7591. +@@ -118,15 +117,8 @@ static void ath_tx_queue_tid(struct ath_
  7592. + return;
  7593. +
  7594. + tid->sched = true;
  7595. +- list_add_tail(&tid->list, &ac->tid_q);
  7596. +-
  7597. +- if (ac->sched)
  7598. +- return;
  7599. +-
  7600. +- ac->sched = true;
  7601. +-
  7602. + list = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
  7603. +- list_add_tail(&ac->list, list);
  7604. ++ list_add_tail(&tid->list, list);
  7605. + }
  7606. +
  7607. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  7608. +@@ -223,7 +215,7 @@ static struct sk_buff *ath_tid_dequeue(s
  7609. + static void
  7610. + ath_tx_tid_change_state(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 ieee80211_tx_info *tx_info;
  7615. + struct sk_buff *skb, *tskb;
  7616. + struct ath_buf *bf;
  7617. +@@ -252,7 +244,7 @@ ath_tx_tid_change_state(struct ath_softc
  7618. +
  7619. + static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  7620. + {
  7621. +- struct ath_txq *txq = tid->ac->txq;
  7622. ++ struct ath_txq *txq = tid->txq;
  7623. + struct sk_buff *skb;
  7624. + struct ath_buf *bf;
  7625. + struct list_head bf_head;
  7626. +@@ -659,7 +651,7 @@ static void ath_tx_complete_aggr(struct
  7627. + ath_tx_queue_tid(sc, txq, tid);
  7628. +
  7629. + if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
  7630. +- tid->ac->clear_ps_filter = true;
  7631. ++ tid->clear_ps_filter = true;
  7632. + }
  7633. + }
  7634. +
  7635. +@@ -749,7 +741,7 @@ static u32 ath_lookup_rate(struct ath_so
  7636. + struct ieee80211_tx_rate *rates;
  7637. + u32 max_4ms_framelen, frmlen;
  7638. + u16 aggr_limit, bt_aggr_limit, legacy = 0;
  7639. +- int q = tid->ac->txq->mac80211_qnum;
  7640. ++ int q = tid->txq->mac80211_qnum;
  7641. + int i;
  7642. +
  7643. + skb = bf->bf_mpdu;
  7644. +@@ -1486,8 +1478,8 @@ static bool ath_tx_sched_aggr(struct ath
  7645. + if (list_empty(&bf_q))
  7646. + return false;
  7647. +
  7648. +- if (tid->ac->clear_ps_filter || tid->an->no_ps_filter) {
  7649. +- tid->ac->clear_ps_filter = false;
  7650. ++ if (tid->clear_ps_filter || tid->an->no_ps_filter) {
  7651. ++ tid->clear_ps_filter = false;
  7652. + tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  7653. + }
  7654. +
  7655. +@@ -1506,7 +1498,7 @@ int ath_tx_aggr_start(struct ath_softc *
  7656. +
  7657. + an = (struct ath_node *)sta->drv_priv;
  7658. + txtid = ATH_AN_2_TID(an, tid);
  7659. +- txq = txtid->ac->txq;
  7660. ++ txq = txtid->txq;
  7661. +
  7662. + ath_txq_lock(sc, txq);
  7663. +
  7664. +@@ -1540,7 +1532,7 @@ void ath_tx_aggr_stop(struct ath_softc *
  7665. + {
  7666. + struct ath_node *an = (struct ath_node *)sta->drv_priv;
  7667. + struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
  7668. +- struct ath_txq *txq = txtid->ac->txq;
  7669. ++ struct ath_txq *txq = txtid->txq;
  7670. +
  7671. + ath_txq_lock(sc, txq);
  7672. + txtid->active = false;
  7673. +@@ -1553,7 +1545,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7674. + struct ath_node *an)
  7675. + {
  7676. + struct ath_atx_tid *tid;
  7677. +- struct ath_atx_ac *ac;
  7678. + struct ath_txq *txq;
  7679. + bool buffered;
  7680. + int tidno;
  7681. +@@ -1561,8 +1552,7 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7682. + for (tidno = 0, tid = &an->tid[tidno];
  7683. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  7684. +
  7685. +- ac = tid->ac;
  7686. +- txq = ac->txq;
  7687. ++ txq = tid->txq;
  7688. +
  7689. + ath_txq_lock(sc, txq);
  7690. +
  7691. +@@ -1576,11 +1566,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7692. + tid->sched = false;
  7693. + list_del(&tid->list);
  7694. +
  7695. +- if (ac->sched) {
  7696. +- ac->sched = false;
  7697. +- list_del(&ac->list);
  7698. +- }
  7699. +-
  7700. + ath_txq_unlock(sc, txq);
  7701. +
  7702. + ieee80211_sta_set_buffered(sta, tidno, buffered);
  7703. +@@ -1590,18 +1575,16 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7704. + void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
  7705. + {
  7706. + struct ath_atx_tid *tid;
  7707. +- struct ath_atx_ac *ac;
  7708. + struct ath_txq *txq;
  7709. + int tidno;
  7710. +
  7711. + for (tidno = 0, tid = &an->tid[tidno];
  7712. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  7713. +
  7714. +- ac = tid->ac;
  7715. +- txq = ac->txq;
  7716. ++ txq = tid->txq;
  7717. +
  7718. + ath_txq_lock(sc, txq);
  7719. +- ac->clear_ps_filter = true;
  7720. ++ tid->clear_ps_filter = true;
  7721. +
  7722. + if (ath_tid_has_buffered(tid)) {
  7723. + ath_tx_queue_tid(sc, txq, tid);
  7724. +@@ -1621,7 +1604,7 @@ void ath_tx_aggr_resume(struct ath_softc
  7725. +
  7726. + an = (struct ath_node *)sta->drv_priv;
  7727. + tid = ATH_AN_2_TID(an, tidno);
  7728. +- txq = tid->ac->txq;
  7729. ++ txq = tid->txq;
  7730. +
  7731. + ath_txq_lock(sc, txq);
  7732. +
  7733. +@@ -1660,7 +1643,7 @@ void ath9k_release_buffered_frames(struc
  7734. +
  7735. + tid = ATH_AN_2_TID(an, i);
  7736. +
  7737. +- ath_txq_lock(sc, tid->ac->txq);
  7738. ++ ath_txq_lock(sc, tid->txq);
  7739. + while (nframes > 0) {
  7740. + bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
  7741. + if (!bf)
  7742. +@@ -1684,7 +1667,7 @@ void ath9k_release_buffered_frames(struc
  7743. + if (an->sta && !ath_tid_has_buffered(tid))
  7744. + ieee80211_sta_set_buffered(an->sta, i, false);
  7745. + }
  7746. +- ath_txq_unlock_complete(sc, tid->ac->txq);
  7747. ++ ath_txq_unlock_complete(sc, tid->txq);
  7748. + }
  7749. +
  7750. + if (list_empty(&bf_q))
  7751. +@@ -1933,9 +1916,8 @@ void ath_tx_cleanupq(struct ath_softc *s
  7752. + void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
  7753. + {
  7754. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  7755. +- struct ath_atx_ac *ac, *last_ac;
  7756. + struct ath_atx_tid *tid, *last_tid;
  7757. +- struct list_head *ac_list;
  7758. ++ struct list_head *tid_list;
  7759. + bool sent = false;
  7760. +
  7761. + if (txq->mac80211_qnum < 0)
  7762. +@@ -1945,63 +1927,46 @@ void ath_txq_schedule(struct ath_softc *
  7763. + return;
  7764. +
  7765. + spin_lock_bh(&sc->chan_lock);
  7766. +- ac_list = &sc->cur_chan->acq[txq->mac80211_qnum];
  7767. ++ tid_list = &sc->cur_chan->acq[txq->mac80211_qnum];
  7768. +
  7769. +- if (list_empty(ac_list)) {
  7770. ++ if (list_empty(tid_list)) {
  7771. + spin_unlock_bh(&sc->chan_lock);
  7772. + return;
  7773. + }
  7774. +
  7775. + rcu_read_lock();
  7776. +
  7777. +- last_ac = list_entry(ac_list->prev, struct ath_atx_ac, list);
  7778. +- while (!list_empty(ac_list)) {
  7779. ++ last_tid = list_entry(tid_list->prev, struct ath_atx_tid, list);
  7780. ++ while (!list_empty(tid_list)) {
  7781. + bool stop = false;
  7782. +
  7783. + if (sc->cur_chan->stopped)
  7784. + break;
  7785. +
  7786. +- ac = list_first_entry(ac_list, struct ath_atx_ac, list);
  7787. +- last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
  7788. +- list_del(&ac->list);
  7789. +- ac->sched = false;
  7790. +-
  7791. +- while (!list_empty(&ac->tid_q)) {
  7792. +-
  7793. +- tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
  7794. +- list);
  7795. +- list_del(&tid->list);
  7796. +- tid->sched = false;
  7797. +-
  7798. +- if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  7799. +- sent = true;
  7800. +-
  7801. +- /*
  7802. +- * add tid to round-robin queue if more frames
  7803. +- * are pending for the tid
  7804. +- */
  7805. +- if (ath_tid_has_buffered(tid))
  7806. +- ath_tx_queue_tid(sc, txq, tid);
  7807. ++ tid = list_first_entry(tid_list, struct ath_atx_tid, list);
  7808. ++ list_del(&tid->list);
  7809. ++ tid->sched = false;
  7810. +
  7811. +- if (stop || tid == last_tid)
  7812. +- break;
  7813. +- }
  7814. ++ if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  7815. ++ sent = true;
  7816. +
  7817. +- if (!list_empty(&ac->tid_q) && !ac->sched) {
  7818. +- ac->sched = true;
  7819. +- list_add_tail(&ac->list, ac_list);
  7820. +- }
  7821. ++ /*
  7822. ++ * add tid to round-robin queue if more frames
  7823. ++ * are pending for the tid
  7824. ++ */
  7825. ++ if (ath_tid_has_buffered(tid))
  7826. ++ ath_tx_queue_tid(sc, txq, tid);
  7827. +
  7828. + if (stop)
  7829. + break;
  7830. +
  7831. +- if (ac == last_ac) {
  7832. ++ if (tid == last_tid) {
  7833. + if (!sent)
  7834. + break;
  7835. +
  7836. + sent = false;
  7837. +- last_ac = list_entry(ac_list->prev,
  7838. +- struct ath_atx_ac, list);
  7839. ++ last_tid = list_entry(tid_list->prev,
  7840. ++ struct ath_atx_tid, list);
  7841. + }
  7842. + }
  7843. +
  7844. +@@ -2391,10 +2356,10 @@ int ath_tx_start(struct ieee80211_hw *hw
  7845. + txq = sc->tx.uapsdq;
  7846. + ath_txq_lock(sc, txq);
  7847. + } else if (txctl->an && queue) {
  7848. +- WARN_ON(tid->ac->txq != txctl->txq);
  7849. ++ WARN_ON(tid->txq != txctl->txq);
  7850. +
  7851. + if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
  7852. +- tid->ac->clear_ps_filter = true;
  7853. ++ tid->clear_ps_filter = true;
  7854. +
  7855. + /*
  7856. + * Add this frame to software queue for scheduling later
  7857. +@@ -2888,7 +2853,6 @@ int ath_tx_init(struct ath_softc *sc, in
  7858. + void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
  7859. + {
  7860. + struct ath_atx_tid *tid;
  7861. +- struct ath_atx_ac *ac;
  7862. + int tidno, acno;
  7863. +
  7864. + for (tidno = 0, tid = &an->tid[tidno];
  7865. +@@ -2901,24 +2865,16 @@ void ath_tx_node_init(struct ath_softc *
  7866. + tid->baw_head = tid->baw_tail = 0;
  7867. + tid->sched = false;
  7868. + tid->active = false;
  7869. ++ tid->clear_ps_filter = true;
  7870. + __skb_queue_head_init(&tid->buf_q);
  7871. + __skb_queue_head_init(&tid->retry_q);
  7872. + acno = TID_TO_WME_AC(tidno);
  7873. +- tid->ac = &an->ac[acno];
  7874. +- }
  7875. +-
  7876. +- for (acno = 0, ac = &an->ac[acno];
  7877. +- acno < IEEE80211_NUM_ACS; acno++, ac++) {
  7878. +- ac->sched = false;
  7879. +- ac->clear_ps_filter = true;
  7880. +- ac->txq = sc->tx.txq_map[acno];
  7881. +- INIT_LIST_HEAD(&ac->tid_q);
  7882. ++ tid->txq = sc->tx.txq_map[acno];
  7883. + }
  7884. + }
  7885. +
  7886. + void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
  7887. + {
  7888. +- struct ath_atx_ac *ac;
  7889. + struct ath_atx_tid *tid;
  7890. + struct ath_txq *txq;
  7891. + int tidno;
  7892. +@@ -2926,8 +2882,7 @@ void ath_tx_node_cleanup(struct ath_soft
  7893. + for (tidno = 0, tid = &an->tid[tidno];
  7894. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  7895. +
  7896. +- ac = tid->ac;
  7897. +- txq = ac->txq;
  7898. ++ txq = tid->txq;
  7899. +
  7900. + ath_txq_lock(sc, txq);
  7901. +
  7902. +@@ -2936,11 +2891,6 @@ void ath_tx_node_cleanup(struct ath_soft
  7903. + tid->sched = false;
  7904. + }
  7905. +
  7906. +- if (ac->sched) {
  7907. +- list_del(&ac->list);
  7908. +- tid->ac->sched = false;
  7909. +- }
  7910. +-
  7911. + ath_tid_drain(sc, txq, tid);
  7912. + tid->active = false;
  7913. +
  7914. diff --git a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch b/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  7915. deleted file mode 100644
  7916. index 4cfa53f..0000000
  7917. --- a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  7918. +++ /dev/null
  7919. @@ -1,137 +0,0 @@
  7920. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  7921. -Date: Wed, 4 Mar 2015 05:12:10 +0300
  7922. -Subject: [PATCH] ath5k: channel change fix
  7923. -
  7924. -ath5k updates the channel pointer and after that it stops the Rx logic
  7925. -and apply channel to HW. In case of channel switch, such sequence
  7926. -creates a small window when a frame, which is received on the old
  7927. -channel is considered as a frame received on the new one.
  7928. -
  7929. -The most notable consequence of this situation occurs during the switch
  7930. -from 2 GHz band (CCK+OFDM) to the 5GHz band (OFDM-only). Frame received
  7931. -with CCK rate, e.g. beacon received at the 1mbps, causes the following
  7932. -warning:
  7933. -
  7934. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  7935. - invalid hw_rix: 1a
  7936. - [..]
  7937. - Call Trace:
  7938. - [<802656a8>] show_stack+0x48/0x70
  7939. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  7940. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  7941. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  7942. - [<8028ac64>] tasklet_action+0x8c/0xf0
  7943. - [<80075804>] __do_softirq+0x180/0x32c
  7944. - [<80196ce8>] irq_exit+0x54/0x70
  7945. - [<80041848>] ret_from_irq+0x0/0x4
  7946. - [<80182fdc>] ioread32+0x4/0xc
  7947. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  7948. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  7949. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  7950. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  7951. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  7952. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  7953. - [<8022c3f4>] process_one_work+0x28c/0x400
  7954. - [<802df8f8>] worker_thread+0x258/0x3c0
  7955. - [<801b5710>] kthread+0xe0/0xec
  7956. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  7957. -
  7958. -The easiest way to reproduce this warning is to run scan with dualband
  7959. -NIC in noisy environments, when the channel 11 runs multiple APs. In my
  7960. -tests if the APs num >= 12, the warning appears in the first few
  7961. -seconds of scanning.
  7962. -
  7963. -In order to fix this, the Rx disable code moved to a higher level and
  7964. -placed before the channel pointer update. This is also makes the code a
  7965. -bit more symmetrical, since we disable and enable the Rx in the same
  7966. -function.
  7967. -
  7968. -In fact, at the pointer update time new frames should not appear,
  7969. -because interrupt generation at this point should already be disabled.
  7970. -The next patch should address this issue.
  7971. -
  7972. -CC: Jiri Slaby <jirislaby@gmail.com>
  7973. -CC: Nick Kossifidis <mickflemm@gmail.com>
  7974. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  7975. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  7976. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  7977. -Tested-by: Eric Bree <ebree@nltinc.com>
  7978. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  7979. ----
  7980. -
  7981. ---- a/drivers/net/wireless/ath/ath5k/base.c
  7982. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  7983. -@@ -2858,7 +2858,7 @@ ath5k_reset(struct ath5k_hw *ah, struct
  7984. - {
  7985. - struct ath_common *common = ath5k_hw_common(ah);
  7986. - int ret, ani_mode;
  7987. -- bool fast;
  7988. -+ bool fast = chan && modparam_fastchanswitch ? 1 : 0;
  7989. -
  7990. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  7991. -
  7992. -@@ -2876,11 +2876,29 @@ ath5k_reset(struct ath5k_hw *ah, struct
  7993. - * so we should also free any remaining
  7994. - * tx buffers */
  7995. - ath5k_drain_tx_buffs(ah);
  7996. -+
  7997. -+ /* Stop PCU */
  7998. -+ ath5k_hw_stop_rx_pcu(ah);
  7999. -+
  8000. -+ /* Stop DMA
  8001. -+ *
  8002. -+ * Note: If DMA didn't stop continue
  8003. -+ * since only a reset will fix it.
  8004. -+ */
  8005. -+ ret = ath5k_hw_dma_stop(ah);
  8006. -+
  8007. -+ /* RF Bus grant won't work if we have pending
  8008. -+ * frames
  8009. -+ */
  8010. -+ if (ret && fast) {
  8011. -+ ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  8012. -+ "DMA didn't stop, falling back to normal reset\n");
  8013. -+ fast = false;
  8014. -+ }
  8015. -+
  8016. - if (chan)
  8017. - ah->curchan = chan;
  8018. -
  8019. -- fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0;
  8020. --
  8021. - ret = ath5k_hw_reset(ah, ah->opmode, ah->curchan, fast, skip_pcu);
  8022. - if (ret) {
  8023. - ATH5K_ERR(ah, "can't reset hardware (%d)\n", ret);
  8024. ---- a/drivers/net/wireless/ath/ath5k/reset.c
  8025. -+++ b/drivers/net/wireless/ath/ath5k/reset.c
  8026. -@@ -1169,30 +1169,6 @@ ath5k_hw_reset(struct ath5k_hw *ah, enum
  8027. - if (ah->ah_version == AR5K_AR5212)
  8028. - ath5k_hw_set_sleep_clock(ah, false);
  8029. -
  8030. -- /*
  8031. -- * Stop PCU
  8032. -- */
  8033. -- ath5k_hw_stop_rx_pcu(ah);
  8034. --
  8035. -- /*
  8036. -- * Stop DMA
  8037. -- *
  8038. -- * Note: If DMA didn't stop continue
  8039. -- * since only a reset will fix it.
  8040. -- */
  8041. -- ret = ath5k_hw_dma_stop(ah);
  8042. --
  8043. -- /* RF Bus grant won't work if we have pending
  8044. -- * frames */
  8045. -- if (ret && fast) {
  8046. -- ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  8047. -- "DMA didn't stop, falling back to normal reset\n");
  8048. -- fast = false;
  8049. -- /* Non fatal, just continue with
  8050. -- * normal reset */
  8051. -- ret = 0;
  8052. -- }
  8053. --
  8054. - mode = channel->hw_value;
  8055. - switch (mode) {
  8056. - case AR5K_MODE_11A:
  8057. 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
  8058. new file mode 100644
  8059. index 0000000..ec860dc
  8060. --- /dev/null
  8061. +++ b/package/kernel/mac80211/patches/305-ath9k-remove-the-sched-field-in-struct-ath_atx_tid.patch
  8062. @@ -0,0 +1,90 @@
  8063. +From: Felix Fietkau <nbd@openwrt.org>
  8064. +Date: Sat, 4 Apr 2015 18:42:33 +0200
  8065. +Subject: [PATCH] ath9k: remove the sched field in struct ath_atx_tid
  8066. +
  8067. +Use list_empty(&tid->list) instead
  8068. +
  8069. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8070. +---
  8071. +
  8072. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  8073. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  8074. +@@ -245,7 +245,6 @@ struct ath_atx_tid {
  8075. + int baw_tail; /* next unused tx buffer slot */
  8076. +
  8077. + s8 bar_index;
  8078. +- bool sched;
  8079. + bool active;
  8080. + bool clear_ps_filter;
  8081. + };
  8082. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  8083. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  8084. +@@ -113,12 +113,9 @@ static void ath_tx_queue_tid(struct ath_
  8085. + if (!ctx)
  8086. + return;
  8087. +
  8088. +- if (tid->sched)
  8089. +- return;
  8090. +-
  8091. +- tid->sched = true;
  8092. + list = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
  8093. +- list_add_tail(&tid->list, list);
  8094. ++ if (list_empty(&tid->list))
  8095. ++ list_add_tail(&tid->list, list);
  8096. + }
  8097. +
  8098. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  8099. +@@ -1556,15 +1553,14 @@ void ath_tx_aggr_sleep(struct ieee80211_
  8100. +
  8101. + ath_txq_lock(sc, txq);
  8102. +
  8103. +- if (!tid->sched) {
  8104. ++ if (list_empty(&tid->list)) {
  8105. + ath_txq_unlock(sc, txq);
  8106. + continue;
  8107. + }
  8108. +
  8109. + buffered = ath_tid_has_buffered(tid);
  8110. +
  8111. +- tid->sched = false;
  8112. +- list_del(&tid->list);
  8113. ++ list_del_init(&tid->list);
  8114. +
  8115. + ath_txq_unlock(sc, txq);
  8116. +
  8117. +@@ -1944,8 +1940,7 @@ void ath_txq_schedule(struct ath_softc *
  8118. + break;
  8119. +
  8120. + tid = list_first_entry(tid_list, struct ath_atx_tid, list);
  8121. +- list_del(&tid->list);
  8122. +- tid->sched = false;
  8123. ++ list_del_init(&tid->list);
  8124. +
  8125. + if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  8126. + sent = true;
  8127. +@@ -2863,11 +2858,11 @@ void ath_tx_node_init(struct ath_softc *
  8128. + tid->seq_start = tid->seq_next = 0;
  8129. + tid->baw_size = WME_MAX_BA;
  8130. + tid->baw_head = tid->baw_tail = 0;
  8131. +- tid->sched = false;
  8132. + tid->active = false;
  8133. + tid->clear_ps_filter = true;
  8134. + __skb_queue_head_init(&tid->buf_q);
  8135. + __skb_queue_head_init(&tid->retry_q);
  8136. ++ INIT_LIST_HEAD(&tid->list);
  8137. + acno = TID_TO_WME_AC(tidno);
  8138. + tid->txq = sc->tx.txq_map[acno];
  8139. + }
  8140. +@@ -2886,10 +2881,8 @@ void ath_tx_node_cleanup(struct ath_soft
  8141. +
  8142. + ath_txq_lock(sc, txq);
  8143. +
  8144. +- if (tid->sched) {
  8145. +- list_del(&tid->list);
  8146. +- tid->sched = false;
  8147. +- }
  8148. ++ if (!list_empty(&tid->list))
  8149. ++ list_del_init(&tid->list);
  8150. +
  8151. + ath_tid_drain(sc, txq, tid);
  8152. + tid->active = false;
  8153. diff --git a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch b/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  8154. deleted file mode 100644
  8155. index 85a1904..0000000
  8156. --- a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  8157. +++ /dev/null
  8158. @@ -1,96 +0,0 @@
  8159. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8160. -Date: Wed, 4 Mar 2015 05:12:11 +0300
  8161. -Subject: [PATCH] ath5k: fix reset race
  8162. -
  8163. -To prepare for reset ath5k should finish all asynchronous tasks. At
  8164. -first, it disables the interrupt generation, then it waits for the
  8165. -interrupt handler and tasklets completion, and then proceeds to the HW
  8166. -configuration update. But it does not consider that the interrupt
  8167. -handler or tasklet re-enables the interrupt generation. And we fall in a
  8168. -situation when ath5k assumes that interrupts are disabled, but it is
  8169. -not.
  8170. -
  8171. -This can lead to different consequences, such as reception of the frame,
  8172. -when we do not expect it. Under certain circumstances, this can lead to
  8173. -the following warning:
  8174. -
  8175. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  8176. - invalid hw_rix: 1a
  8177. - [..]
  8178. - Call Trace:
  8179. - [<802656a8>] show_stack+0x48/0x70
  8180. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  8181. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  8182. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  8183. - [<8028ac64>] tasklet_action+0x8c/0xf0
  8184. - [<80075804>] __do_softirq+0x180/0x32c
  8185. - [<80196ce8>] irq_exit+0x54/0x70
  8186. - [<80041848>] ret_from_irq+0x0/0x4
  8187. - [<80182fdc>] ioread32+0x4/0xc
  8188. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  8189. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  8190. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  8191. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  8192. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  8193. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  8194. - [<8022c3f4>] process_one_work+0x28c/0x400
  8195. - [<802df8f8>] worker_thread+0x258/0x3c0
  8196. - [<801b5710>] kthread+0xe0/0xec
  8197. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  8198. -
  8199. -Fix this issue by adding a new status flag, which forbids to re-enable
  8200. -the interrupt generation until the HW configuration is completed.
  8201. -
  8202. -Note: previous patch, which reorders the Rx disable code helps to avoid
  8203. -the above warning, but not fixes the root cause of unexpected frame
  8204. -receiving.
  8205. -
  8206. -CC: Jiri Slaby <jirislaby@gmail.com>
  8207. -CC: Nick Kossifidis <mickflemm@gmail.com>
  8208. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  8209. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8210. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8211. -Tested-by: Eric Bree <ebree@nltinc.com>
  8212. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8213. ----
  8214. -
  8215. ---- a/drivers/net/wireless/ath/ath5k/ath5k.h
  8216. -+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  8217. -@@ -1283,6 +1283,7 @@ struct ath5k_hw {
  8218. - #define ATH_STAT_PROMISC 1
  8219. - #define ATH_STAT_LEDSOFT 2 /* enable LED gpio status */
  8220. - #define ATH_STAT_STARTED 3 /* opened & irqs enabled */
  8221. -+#define ATH_STAT_RESET 4 /* hw reset */
  8222. -
  8223. - unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
  8224. - unsigned int fif_filter_flags; /* Current FIF_* filter flags */
  8225. ---- a/drivers/net/wireless/ath/ath5k/base.c
  8226. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  8227. -@@ -1523,6 +1523,9 @@ ath5k_set_current_imask(struct ath5k_hw
  8228. - enum ath5k_int imask;
  8229. - unsigned long flags;
  8230. -
  8231. -+ if (test_bit(ATH_STAT_RESET, ah->status))
  8232. -+ return;
  8233. -+
  8234. - spin_lock_irqsave(&ah->irqlock, flags);
  8235. - imask = ah->imask;
  8236. - if (ah->rx_pending)
  8237. -@@ -2862,6 +2865,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8238. -
  8239. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  8240. -
  8241. -+ __set_bit(ATH_STAT_RESET, ah->status);
  8242. -+
  8243. - ath5k_hw_set_imr(ah, 0);
  8244. - synchronize_irq(ah->irq);
  8245. - ath5k_stop_tasklets(ah);
  8246. -@@ -2952,6 +2957,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8247. - */
  8248. - /* ath5k_chan_change(ah, c); */
  8249. -
  8250. -+ __clear_bit(ATH_STAT_RESET, ah->status);
  8251. -+
  8252. - ath5k_beacon_config(ah);
  8253. - /* intrs are enabled by ath5k_beacon_config */
  8254. -
  8255. 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
  8256. new file mode 100644
  8257. index 0000000..928c93b
  8258. --- /dev/null
  8259. +++ b/package/kernel/mac80211/patches/306-mac80211-Deinline-rate_control_rate_init-rate_contro.patch
  8260. @@ -0,0 +1,161 @@
  8261. +From: Denys Vlasenko <dvlasenk@redhat.com>
  8262. +Date: Wed, 15 Jul 2015 14:56:06 +0200
  8263. +Subject: [PATCH] mac80211: Deinline rate_control_rate_init,
  8264. + rate_control_rate_update
  8265. +
  8266. +With this .config: http://busybox.net/~vda/kernel_config,
  8267. +after deinlining these functions have sizes and callsite counts
  8268. +as follows:
  8269. +
  8270. +rate_control_rate_init: 554 bytes, 8 calls
  8271. +rate_control_rate_update: 1596 bytes, 5 calls
  8272. +
  8273. +Total size reduction: about 11 kbytes.
  8274. +
  8275. +Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
  8276. +CC: John Linville <linville@tuxdriver.com>
  8277. +CC: Michal Kazior <michal.kazior@tieto.com>
  8278. +CC: Johannes Berg <johannes.berg@intel.com>
  8279. +Cc: linux-wireless@vger.kernel.org
  8280. +Cc: netdev@vger.kernel.org
  8281. +CC: linux-kernel@vger.kernel.org
  8282. +---
  8283. +
  8284. +--- a/net/mac80211/rate.c
  8285. ++++ b/net/mac80211/rate.c
  8286. +@@ -29,6 +29,65 @@ module_param(ieee80211_default_rc_algo,
  8287. + MODULE_PARM_DESC(ieee80211_default_rc_algo,
  8288. + "Default rate control algorithm for mac80211 to use");
  8289. +
  8290. ++void rate_control_rate_init(struct sta_info *sta)
  8291. ++{
  8292. ++ struct ieee80211_local *local = sta->sdata->local;
  8293. ++ struct rate_control_ref *ref = sta->rate_ctrl;
  8294. ++ struct ieee80211_sta *ista = &sta->sta;
  8295. ++ void *priv_sta = sta->rate_ctrl_priv;
  8296. ++ struct ieee80211_supported_band *sband;
  8297. ++ struct ieee80211_chanctx_conf *chanctx_conf;
  8298. ++
  8299. ++ ieee80211_sta_set_rx_nss(sta);
  8300. ++
  8301. ++ if (!ref)
  8302. ++ return;
  8303. ++
  8304. ++ rcu_read_lock();
  8305. ++
  8306. ++ chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8307. ++ if (WARN_ON(!chanctx_conf)) {
  8308. ++ rcu_read_unlock();
  8309. ++ return;
  8310. ++ }
  8311. ++
  8312. ++ sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  8313. ++
  8314. ++ spin_lock_bh(&sta->rate_ctrl_lock);
  8315. ++ ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  8316. ++ priv_sta);
  8317. ++ spin_unlock_bh(&sta->rate_ctrl_lock);
  8318. ++ rcu_read_unlock();
  8319. ++ set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  8320. ++}
  8321. ++
  8322. ++void rate_control_rate_update(struct ieee80211_local *local,
  8323. ++ struct ieee80211_supported_band *sband,
  8324. ++ struct sta_info *sta, u32 changed)
  8325. ++{
  8326. ++ struct rate_control_ref *ref = local->rate_ctrl;
  8327. ++ struct ieee80211_sta *ista = &sta->sta;
  8328. ++ void *priv_sta = sta->rate_ctrl_priv;
  8329. ++ struct ieee80211_chanctx_conf *chanctx_conf;
  8330. ++
  8331. ++ if (ref && ref->ops->rate_update) {
  8332. ++ rcu_read_lock();
  8333. ++
  8334. ++ chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8335. ++ if (WARN_ON(!chanctx_conf)) {
  8336. ++ rcu_read_unlock();
  8337. ++ return;
  8338. ++ }
  8339. ++
  8340. ++ spin_lock_bh(&sta->rate_ctrl_lock);
  8341. ++ ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  8342. ++ ista, priv_sta, changed);
  8343. ++ spin_unlock_bh(&sta->rate_ctrl_lock);
  8344. ++ rcu_read_unlock();
  8345. ++ }
  8346. ++ drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  8347. ++}
  8348. ++
  8349. + int ieee80211_rate_control_register(const struct rate_control_ops *ops)
  8350. + {
  8351. + struct rate_control_alg *alg;
  8352. +--- a/net/mac80211/rate.h
  8353. ++++ b/net/mac80211/rate.h
  8354. +@@ -71,64 +71,10 @@ rate_control_tx_status_noskb(struct ieee
  8355. + spin_unlock_bh(&sta->rate_ctrl_lock);
  8356. + }
  8357. +
  8358. +-static inline void rate_control_rate_init(struct sta_info *sta)
  8359. +-{
  8360. +- struct ieee80211_local *local = sta->sdata->local;
  8361. +- struct rate_control_ref *ref = sta->rate_ctrl;
  8362. +- struct ieee80211_sta *ista = &sta->sta;
  8363. +- void *priv_sta = sta->rate_ctrl_priv;
  8364. +- struct ieee80211_supported_band *sband;
  8365. +- struct ieee80211_chanctx_conf *chanctx_conf;
  8366. +-
  8367. +- ieee80211_sta_set_rx_nss(sta);
  8368. +-
  8369. +- if (!ref)
  8370. +- return;
  8371. +-
  8372. +- rcu_read_lock();
  8373. +-
  8374. +- chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8375. +- if (WARN_ON(!chanctx_conf)) {
  8376. +- rcu_read_unlock();
  8377. +- return;
  8378. +- }
  8379. +-
  8380. +- sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  8381. +-
  8382. +- spin_lock_bh(&sta->rate_ctrl_lock);
  8383. +- ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  8384. +- priv_sta);
  8385. +- spin_unlock_bh(&sta->rate_ctrl_lock);
  8386. +- rcu_read_unlock();
  8387. +- set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  8388. +-}
  8389. +-
  8390. +-static inline void rate_control_rate_update(struct ieee80211_local *local,
  8391. ++void rate_control_rate_init(struct sta_info *sta);
  8392. ++void rate_control_rate_update(struct ieee80211_local *local,
  8393. + struct ieee80211_supported_band *sband,
  8394. +- struct sta_info *sta, u32 changed)
  8395. +-{
  8396. +- struct rate_control_ref *ref = local->rate_ctrl;
  8397. +- struct ieee80211_sta *ista = &sta->sta;
  8398. +- void *priv_sta = sta->rate_ctrl_priv;
  8399. +- struct ieee80211_chanctx_conf *chanctx_conf;
  8400. +-
  8401. +- if (ref && ref->ops->rate_update) {
  8402. +- rcu_read_lock();
  8403. +-
  8404. +- chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8405. +- if (WARN_ON(!chanctx_conf)) {
  8406. +- rcu_read_unlock();
  8407. +- return;
  8408. +- }
  8409. +-
  8410. +- spin_lock_bh(&sta->rate_ctrl_lock);
  8411. +- ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  8412. +- ista, priv_sta, changed);
  8413. +- spin_unlock_bh(&sta->rate_ctrl_lock);
  8414. +- rcu_read_unlock();
  8415. +- }
  8416. +- drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  8417. +-}
  8418. ++ struct sta_info *sta, u32 changed);
  8419. +
  8420. + static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  8421. + struct sta_info *sta, gfp_t gfp)
  8422. 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
  8423. deleted file mode 100644
  8424. index ab9771e..0000000
  8425. --- a/package/kernel/mac80211/patches/307-ath9k-fix-tracking-of-enabled-AP-beacons.patch
  8426. +++ /dev/null
  8427. @@ -1,76 +0,0 @@
  8428. -From: Felix Fietkau <nbd@openwrt.org>
  8429. -Date: Thu, 12 Mar 2015 17:10:50 +0100
  8430. -Subject: [PATCH] ath9k: fix tracking of enabled AP beacons
  8431. -
  8432. -sc->nbcnvifs tracks assigned beacon slots, not enabled beacons.
  8433. -Therefore, it cannot be used to decide if cur_conf->enable_beacon (bool)
  8434. -should be updated, or if beacons have been enabled already.
  8435. -With the current code (depending on the order of calls), beacons often
  8436. -do not get enabled in an AP+STA setup.
  8437. -To fix tracking of enabled beacons, convert cur_conf->enable_beacon to a
  8438. -bitmask of enabled beacon slots.
  8439. -
  8440. -Cc: stable@vger.kernel.org
  8441. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8442. ----
  8443. -
  8444. ---- a/drivers/net/wireless/ath/ath9k/beacon.c
  8445. -+++ b/drivers/net/wireless/ath/ath9k/beacon.c
  8446. -@@ -219,12 +219,15 @@ void ath9k_beacon_remove_slot(struct ath
  8447. - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  8448. - struct ath_vif *avp = (void *)vif->drv_priv;
  8449. - struct ath_buf *bf = avp->av_bcbuf;
  8450. -+ struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  8451. -
  8452. - ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  8453. - avp->av_bslot);
  8454. -
  8455. - tasklet_disable(&sc->bcon_tasklet);
  8456. -
  8457. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  8458. -+
  8459. - if (bf && bf->bf_mpdu) {
  8460. - struct sk_buff *skb = bf->bf_mpdu;
  8461. - dma_unmap_single(sc->dev, bf->bf_buf_addr,
  8462. -@@ -521,8 +524,7 @@ static bool ath9k_allow_beacon_config(st
  8463. - }
  8464. -
  8465. - if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  8466. -- if ((vif->type != NL80211_IFTYPE_AP) ||
  8467. -- (sc->nbcnvifs > 1)) {
  8468. -+ if (vif->type != NL80211_IFTYPE_AP) {
  8469. - ath_dbg(common, CONFIG,
  8470. - "An AP interface is already present !\n");
  8471. - return false;
  8472. -@@ -616,12 +618,14 @@ void ath9k_beacon_config(struct ath_soft
  8473. - * enabling/disabling SWBA.
  8474. - */
  8475. - if (changed & BSS_CHANGED_BEACON_ENABLED) {
  8476. -- if (!bss_conf->enable_beacon &&
  8477. -- (sc->nbcnvifs <= 1)) {
  8478. -- cur_conf->enable_beacon = false;
  8479. -- } else if (bss_conf->enable_beacon) {
  8480. -- cur_conf->enable_beacon = true;
  8481. -- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  8482. -+ bool enabled = cur_conf->enable_beacon;
  8483. -+
  8484. -+ if (!bss_conf->enable_beacon) {
  8485. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  8486. -+ } else {
  8487. -+ cur_conf->enable_beacon |= BIT(avp->av_bslot);
  8488. -+ if (!enabled)
  8489. -+ ath9k_cache_beacon_config(sc, ctx, bss_conf);
  8490. - }
  8491. - }
  8492. -
  8493. ---- a/drivers/net/wireless/ath/ath9k/common.h
  8494. -+++ b/drivers/net/wireless/ath/ath9k/common.h
  8495. -@@ -54,7 +54,7 @@ struct ath_beacon_config {
  8496. - u16 dtim_period;
  8497. - u16 bmiss_timeout;
  8498. - u8 dtim_count;
  8499. -- bool enable_beacon;
  8500. -+ u8 enable_beacon;
  8501. - bool ibss_creator;
  8502. - u32 nexttbtt;
  8503. - u32 intval;
  8504. 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
  8505. new file mode 100644
  8506. index 0000000..474c409
  8507. --- /dev/null
  8508. +++ b/package/kernel/mac80211/patches/307-mac80211-Deinline-drv_sta_state.patch
  8509. @@ -0,0 +1,116 @@
  8510. +From: Denys Vlasenko <dvlasenk@redhat.com>
  8511. +Date: Wed, 15 Jul 2015 14:56:05 +0200
  8512. +Subject: [PATCH] mac80211: Deinline drv_sta_state
  8513. +
  8514. +With this .config: http://busybox.net/~vda/kernel_config,
  8515. +after deinlining the function size is 3132 bytes and there are
  8516. +7 callsites.
  8517. +
  8518. +Total size reduction: about 20 kbytes.
  8519. +
  8520. +Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
  8521. +CC: John Linville <linville@tuxdriver.com>
  8522. +CC: Michal Kazior <michal.kazior@tieto.com>
  8523. +Cc: Johannes Berg <johannes.berg@intel.com>
  8524. +Cc: linux-wireless@vger.kernel.org
  8525. +Cc: netdev@vger.kernel.org
  8526. +CC: linux-kernel@vger.kernel.org
  8527. +---
  8528. + create mode 100644 net/mac80211/driver-ops.c
  8529. +
  8530. +--- a/net/mac80211/Makefile
  8531. ++++ b/net/mac80211/Makefile
  8532. +@@ -3,6 +3,7 @@ obj-$(CPTCFG_MAC80211) += mac80211.o
  8533. + # mac80211 objects
  8534. + mac80211-y := \
  8535. + main.o status.o \
  8536. ++ driver-ops.o \
  8537. + sta_info.o \
  8538. + wep.o \
  8539. + wpa.o \
  8540. +--- /dev/null
  8541. ++++ b/net/mac80211/driver-ops.c
  8542. +@@ -0,0 +1,41 @@
  8543. ++/*
  8544. ++ * This program is free software; you can redistribute it and/or modify
  8545. ++ * it under the terms of the GNU General Public License version 2 as
  8546. ++ * published by the Free Software Foundation.
  8547. ++ */
  8548. ++#include <net/mac80211.h>
  8549. ++#include "ieee80211_i.h"
  8550. ++#include "trace.h"
  8551. ++#include "driver-ops.h"
  8552. ++
  8553. ++__must_check
  8554. ++int drv_sta_state(struct ieee80211_local *local,
  8555. ++ struct ieee80211_sub_if_data *sdata,
  8556. ++ struct sta_info *sta,
  8557. ++ enum ieee80211_sta_state old_state,
  8558. ++ enum ieee80211_sta_state new_state)
  8559. ++{
  8560. ++ int ret = 0;
  8561. ++
  8562. ++ might_sleep();
  8563. ++
  8564. ++ sdata = get_bss_sdata(sdata);
  8565. ++ if (!check_sdata_in_driver(sdata))
  8566. ++ return -EIO;
  8567. ++
  8568. ++ trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  8569. ++ if (local->ops->sta_state) {
  8570. ++ ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  8571. ++ old_state, new_state);
  8572. ++ } else if (old_state == IEEE80211_STA_AUTH &&
  8573. ++ new_state == IEEE80211_STA_ASSOC) {
  8574. ++ ret = drv_sta_add(local, sdata, &sta->sta);
  8575. ++ if (ret == 0)
  8576. ++ sta->uploaded = true;
  8577. ++ } else if (old_state == IEEE80211_STA_ASSOC &&
  8578. ++ new_state == IEEE80211_STA_AUTH) {
  8579. ++ drv_sta_remove(local, sdata, &sta->sta);
  8580. ++ }
  8581. ++ trace_drv_return_int(local, ret);
  8582. ++ return ret;
  8583. ++}
  8584. +--- a/net/mac80211/driver-ops.h
  8585. ++++ b/net/mac80211/driver-ops.h
  8586. +@@ -573,37 +573,12 @@ static inline void drv_sta_pre_rcu_remov
  8587. + trace_drv_return_void(local);
  8588. + }
  8589. +
  8590. +-static inline __must_check
  8591. ++__must_check
  8592. + int drv_sta_state(struct ieee80211_local *local,
  8593. + struct ieee80211_sub_if_data *sdata,
  8594. + struct sta_info *sta,
  8595. + enum ieee80211_sta_state old_state,
  8596. +- enum ieee80211_sta_state new_state)
  8597. +-{
  8598. +- int ret = 0;
  8599. +-
  8600. +- might_sleep();
  8601. +-
  8602. +- sdata = get_bss_sdata(sdata);
  8603. +- if (!check_sdata_in_driver(sdata))
  8604. +- return -EIO;
  8605. +-
  8606. +- trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  8607. +- if (local->ops->sta_state) {
  8608. +- ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  8609. +- old_state, new_state);
  8610. +- } else if (old_state == IEEE80211_STA_AUTH &&
  8611. +- new_state == IEEE80211_STA_ASSOC) {
  8612. +- ret = drv_sta_add(local, sdata, &sta->sta);
  8613. +- if (ret == 0)
  8614. +- sta->uploaded = true;
  8615. +- } else if (old_state == IEEE80211_STA_ASSOC &&
  8616. +- new_state == IEEE80211_STA_AUTH) {
  8617. +- drv_sta_remove(local, sdata, &sta->sta);
  8618. +- }
  8619. +- trace_drv_return_int(local, ret);
  8620. +- return ret;
  8621. +-}
  8622. ++ enum ieee80211_sta_state new_state);
  8623. +
  8624. + static inline void drv_sta_rc_update(struct ieee80211_local *local,
  8625. + struct ieee80211_sub_if_data *sdata,
  8626. 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
  8627. new file mode 100644
  8628. index 0000000..1a3a9d4
  8629. --- /dev/null
  8630. +++ b/package/kernel/mac80211/patches/308-ath9k-Fix-NF-CCA-limits-for-AR9287-and-AR9227.patch
  8631. @@ -0,0 +1,30 @@
  8632. +From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  8633. +Date: Wed, 22 Jul 2015 10:42:43 +0200
  8634. +Subject: [PATCH] ath9k: Fix NF CCA limits for AR9287 and AR9227
  8635. +
  8636. +The FreeBSD driver [0] uses the same 2G values as for the AR9280 chips.
  8637. +Using the same values in ath9k results in much better throughput for me.
  8638. +
  8639. +Before this patch I had a huge amount of packet loss (sometimes up to
  8640. +40%) and the max transfer speed was somewhere around 5Mbit/s. With this
  8641. +patch applied I have zero packet loss and ten times the throughput.
  8642. +My device uses a AR9227 which is the PCI variant of the AR9287.
  8643. +
  8644. +[0] http://bxr.su/FreeBSD/sys/dev/ath/ath_hal/ar9002/ar9287.h
  8645. +
  8646. +Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  8647. +---
  8648. +
  8649. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  8650. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  8651. +@@ -610,8 +610,8 @@
  8652. + #define AR_PHY_CCA_MIN_GOOD_VAL_9271_2GHZ -127
  8653. + #define AR_PHY_CCA_MAX_GOOD_VAL_9271_2GHZ -116
  8654. +
  8655. +-#define AR_PHY_CCA_NOM_VAL_9287_2GHZ -120
  8656. ++#define AR_PHY_CCA_NOM_VAL_9287_2GHZ -112
  8657. + #define AR_PHY_CCA_MIN_GOOD_VAL_9287_2GHZ -127
  8658. +-#define AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ -110
  8659. ++#define AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ -97
  8660. +
  8661. + #endif
  8662. 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
  8663. deleted file mode 100644
  8664. index d132636..0000000
  8665. --- a/package/kernel/mac80211/patches/308-mac80211-minstrel_ht-fix-rounding-issue-in-MCS-durat.patch
  8666. +++ /dev/null
  8667. @@ -1,43 +0,0 @@
  8668. -From: Felix Fietkau <nbd@openwrt.org>
  8669. -Date: Fri, 13 Mar 2015 10:49:40 +0100
  8670. -Subject: [PATCH] mac80211: minstrel_ht: fix rounding issue in MCS duration
  8671. - calculation
  8672. -
  8673. -On very high MCS bitrates, the calculated duration of rates that are
  8674. -next to each other can be very imprecise, due to the small packet size
  8675. -used as reference (1200 bytes).
  8676. -This is most visible in VHT80 nss=2 MCS8/9, for which minstrel shows the
  8677. -same throughput when the probability is also the same. This leads to a
  8678. -bad rate selection for such rates.
  8679. -
  8680. -Fix this issue by introducing an average A-MPDU size factor into the
  8681. -calculation.
  8682. -
  8683. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8684. ----
  8685. -
  8686. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8687. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8688. -@@ -17,10 +17,11 @@
  8689. - #include "rc80211_minstrel.h"
  8690. - #include "rc80211_minstrel_ht.h"
  8691. -
  8692. -+#define AVG_AMPDU_SIZE 16
  8693. - #define AVG_PKT_SIZE 1200
  8694. -
  8695. - /* Number of bits for an average sized packet */
  8696. --#define MCS_NBITS (AVG_PKT_SIZE << 3)
  8697. -+#define MCS_NBITS ((AVG_PKT_SIZE * AVG_AMPDU_SIZE) << 3)
  8698. -
  8699. - /* Number of symbols for a packet with (bps) bits per symbol */
  8700. - #define MCS_NSYMS(bps) DIV_ROUND_UP(MCS_NBITS, (bps))
  8701. -@@ -33,7 +34,8 @@
  8702. - )
  8703. -
  8704. - /* Transmit duration for the raw data part of an average sized packet */
  8705. --#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
  8706. -+#define MCS_DURATION(streams, sgi, bps) \
  8707. -+ (MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) / AVG_AMPDU_SIZE)
  8708. -
  8709. - #define BW_20 0
  8710. - #define BW_40 1
  8711. 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
  8712. deleted file mode 100644
  8713. index 945fbce..0000000
  8714. --- a/package/kernel/mac80211/patches/309-ath9k-disable-TPC-support-again-for-now.patch
  8715. +++ /dev/null
  8716. @@ -1,22 +0,0 @@
  8717. -From: Felix Fietkau <nbd@openwrt.org>
  8718. -Date: Sun, 15 Mar 2015 08:02:37 +0100
  8719. -Subject: [PATCH] ath9k: disable TPC support again (for now)
  8720. -
  8721. -TPC support has been observed to cause some tx power fluctuations on
  8722. -some devices with at least AR934x and AR938x chips.
  8723. -Disable it for now until the bugs have been found and fixed
  8724. -
  8725. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8726. ----
  8727. -
  8728. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  8729. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  8730. -@@ -424,7 +424,7 @@ static void ath9k_hw_init_defaults(struc
  8731. - ah->power_mode = ATH9K_PM_UNDEFINED;
  8732. - ah->htc_reset_init = true;
  8733. -
  8734. -- ah->tpc_enabled = true;
  8735. -+ ah->tpc_enabled = false;
  8736. -
  8737. - ah->ani_function = ATH9K_ANI_ALL;
  8738. - if (!AR_SREV_9300_20_OR_LATER(ah))
  8739. 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
  8740. new file mode 100644
  8741. index 0000000..e8e9617
  8742. --- /dev/null
  8743. +++ b/package/kernel/mac80211/patches/309-mac80211-make-local-tx_headroom-a-multiple-of-4.patch
  8744. @@ -0,0 +1,20 @@
  8745. +From: Felix Fietkau <nbd@openwrt.org>
  8746. +Date: Thu, 30 Jul 2015 14:12:25 +0200
  8747. +Subject: [PATCH] mac80211: make local->tx_headroom a multiple of 4
  8748. +
  8749. +This ensures that mac80211 generated management frames and beacons are
  8750. +aligned before being passed to the driver
  8751. +
  8752. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8753. +---
  8754. +
  8755. +--- a/net/mac80211/main.c
  8756. ++++ b/net/mac80211/main.c
  8757. +@@ -1031,6 +1031,7 @@ int ieee80211_register_hw(struct ieee802
  8758. + */
  8759. + local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
  8760. + IEEE80211_TX_STATUS_HEADROOM);
  8761. ++ local->tx_headroom = ALIGN(local->tx_headroom, 4);
  8762. +
  8763. + debugfs_hw_add(local);
  8764. +
  8765. 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
  8766. deleted file mode 100644
  8767. index bd3050e..0000000
  8768. --- a/package/kernel/mac80211/patches/310-mac80211-don-t-look-up-stations-for-multicast-addres.patch
  8769. +++ /dev/null
  8770. @@ -1,21 +0,0 @@
  8771. -From: Johannes Berg <johannes.berg@intel.com>
  8772. -Date: Tue, 24 Feb 2015 00:28:18 +0100
  8773. -Subject: [PATCH] mac80211: don't look up stations for multicast addresses
  8774. -
  8775. -Since multicast addresses don't exist as stations, don't attempt
  8776. -to look them up in the hashtable on TX.
  8777. -
  8778. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8779. ----
  8780. -
  8781. ---- a/net/mac80211/tx.c
  8782. -+++ b/net/mac80211/tx.c
  8783. -@@ -1161,7 +1161,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  8784. - tx->sdata->control_port_protocol == tx->skb->protocol) {
  8785. - tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  8786. - }
  8787. -- if (!tx->sta)
  8788. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  8789. - tx->sta = sta_info_get(sdata, hdr->addr1);
  8790. -
  8791. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  8792. 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
  8793. new file mode 100644
  8794. index 0000000..51a315c
  8795. --- /dev/null
  8796. +++ b/package/kernel/mac80211/patches/310-mac80211-fix-invalid-read-in-minstrel_sort_best_tp_r.patch
  8797. @@ -0,0 +1,34 @@
  8798. +From: Adrien Schildknecht <adrien+dev@schischi.me>
  8799. +Date: Tue, 28 Jul 2015 10:30:16 +0200
  8800. +Subject: [PATCH] mac80211: fix invalid read in minstrel_sort_best_tp_rates()
  8801. +
  8802. +At the last iteration of the loop, j may equal zero and thus
  8803. +tp_list[j - 1] causes an invalid read.
  8804. +Changed the logic of the loop so that j - 1 is always >= 0.
  8805. +
  8806. +Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
  8807. +---
  8808. +
  8809. +--- a/net/mac80211/rc80211_minstrel.c
  8810. ++++ b/net/mac80211/rc80211_minstrel.c
  8811. +@@ -92,14 +92,15 @@ int minstrel_get_tp_avg(struct minstrel_
  8812. + static inline void
  8813. + minstrel_sort_best_tp_rates(struct minstrel_sta_info *mi, int i, u8 *tp_list)
  8814. + {
  8815. +- int j = MAX_THR_RATES;
  8816. +- struct minstrel_rate_stats *tmp_mrs = &mi->r[j - 1].stats;
  8817. ++ int j;
  8818. ++ struct minstrel_rate_stats *tmp_mrs;
  8819. + struct minstrel_rate_stats *cur_mrs = &mi->r[i].stats;
  8820. +
  8821. +- while (j > 0 && (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) >
  8822. +- minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))) {
  8823. +- j--;
  8824. ++ for (j = MAX_THR_RATES; j > 0; --j) {
  8825. + tmp_mrs = &mi->r[tp_list[j - 1]].stats;
  8826. ++ if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) <=
  8827. ++ minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))
  8828. ++ break;
  8829. + }
  8830. +
  8831. + if (j < MAX_THR_RATES - 1)
  8832. 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
  8833. new file mode 100644
  8834. index 0000000..e44f121
  8835. --- /dev/null
  8836. +++ b/package/kernel/mac80211/patches/311-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  8837. @@ -0,0 +1,45 @@
  8838. +From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
  8839. +Date: Thu, 9 Jul 2015 13:43:18 +0530
  8840. +Subject: [PATCH] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
  8841. +
  8842. +There's already a generic implementation so use that instead.
  8843. +
  8844. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  8845. +---
  8846. +
  8847. +--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  8848. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  8849. +@@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(st
  8850. + }
  8851. + }
  8852. +
  8853. +-static void atomic_orr(int val, atomic_t *v)
  8854. +-{
  8855. +- int old_val;
  8856. +-
  8857. +- old_val = atomic_read(v);
  8858. +- while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
  8859. +- old_val = atomic_read(v);
  8860. +-}
  8861. +-
  8862. + static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
  8863. + {
  8864. + struct brcmf_core *buscore;
  8865. +@@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struc
  8866. + if (val) {
  8867. + brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
  8868. + bus->sdcnt.f1regdata++;
  8869. +- atomic_orr(val, &bus->intstatus);
  8870. ++ atomic_or(val, &bus->intstatus);
  8871. + }
  8872. +
  8873. + return ret;
  8874. +@@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  8875. +
  8876. + /* Keep still-pending events for next scheduling */
  8877. + if (intstatus)
  8878. +- atomic_orr(intstatus, &bus->intstatus);
  8879. ++ atomic_or(intstatus, &bus->intstatus);
  8880. +
  8881. + brcmf_sdio_clrintr(bus);
  8882. +
  8883. 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
  8884. deleted file mode 100644
  8885. index b2475b9..0000000
  8886. --- a/package/kernel/mac80211/patches/311-mac80211-remove-drop_unencrypted-code.patch
  8887. +++ /dev/null
  8888. @@ -1,130 +0,0 @@
  8889. -From: Johannes Berg <johannes.berg@intel.com>
  8890. -Date: Fri, 20 Mar 2015 11:41:58 +0100
  8891. -Subject: [PATCH] mac80211: remove drop_unencrypted code
  8892. -
  8893. -This mechanism was historic, and only ever used by IBSS, which
  8894. -also doesn't need to have it as it properly manages station's
  8895. -802.1X PAE state (or, with WEP, always has a key.)
  8896. -
  8897. -Remove the mechanism to clean up the code.
  8898. -
  8899. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8900. ----
  8901. -
  8902. ---- a/net/mac80211/debugfs.c
  8903. -+++ b/net/mac80211/debugfs.c
  8904. -@@ -274,8 +274,6 @@ void debugfs_hw_add(struct ieee80211_loc
  8905. - #ifdef CPTCFG_MAC80211_DEBUG_COUNTERS
  8906. - DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
  8907. - DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
  8908. -- DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
  8909. -- local->tx_handlers_drop_unencrypted);
  8910. - DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
  8911. - local->tx_handlers_drop_fragment);
  8912. - DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
  8913. ---- a/net/mac80211/debugfs_netdev.c
  8914. -+++ b/net/mac80211/debugfs_netdev.c
  8915. -@@ -177,7 +177,6 @@ static ssize_t ieee80211_if_write_##name
  8916. - IEEE80211_IF_FILE_R(name)
  8917. -
  8918. - /* common attributes */
  8919. --IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
  8920. - IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
  8921. - HEX);
  8922. - IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
  8923. -@@ -562,7 +561,6 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDu
  8924. -
  8925. - static void add_common_files(struct ieee80211_sub_if_data *sdata)
  8926. - {
  8927. -- DEBUGFS_ADD(drop_unencrypted);
  8928. - DEBUGFS_ADD(rc_rateidx_mask_2ghz);
  8929. - DEBUGFS_ADD(rc_rateidx_mask_5ghz);
  8930. - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
  8931. ---- a/net/mac80211/ibss.c
  8932. -+++ b/net/mac80211/ibss.c
  8933. -@@ -249,8 +249,6 @@ static void __ieee80211_sta_join_ibss(st
  8934. - if (presp)
  8935. - kfree_rcu(presp, rcu_head);
  8936. -
  8937. -- sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
  8938. --
  8939. - /* make a copy of the chandef, it could be modified below. */
  8940. - chandef = *req_chandef;
  8941. - chan = chandef.chan;
  8942. -@@ -1289,8 +1287,6 @@ static void ieee80211_sta_create_ibss(st
  8943. -
  8944. - if (ifibss->privacy)
  8945. - capability |= WLAN_CAPABILITY_PRIVACY;
  8946. -- else
  8947. -- sdata->drop_unencrypted = 0;
  8948. -
  8949. - __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
  8950. - &ifibss->chandef, ifibss->basic_rates,
  8951. ---- a/net/mac80211/ieee80211_i.h
  8952. -+++ b/net/mac80211/ieee80211_i.h
  8953. -@@ -842,8 +842,6 @@ struct ieee80211_sub_if_data {
  8954. -
  8955. - unsigned long state;
  8956. -
  8957. -- int drop_unencrypted;
  8958. --
  8959. - char name[IFNAMSIZ];
  8960. -
  8961. - /* Fragment table for host-based reassembly */
  8962. -@@ -1289,7 +1287,6 @@ struct ieee80211_local {
  8963. - /* TX/RX handler statistics */
  8964. - unsigned int tx_handlers_drop;
  8965. - unsigned int tx_handlers_queued;
  8966. -- unsigned int tx_handlers_drop_unencrypted;
  8967. - unsigned int tx_handlers_drop_fragment;
  8968. - unsigned int tx_handlers_drop_wep;
  8969. - unsigned int tx_handlers_drop_not_assoc;
  8970. ---- a/net/mac80211/iface.c
  8971. -+++ b/net/mac80211/iface.c
  8972. -@@ -1535,7 +1535,6 @@ int ieee80211_if_change_type(struct ieee
  8973. - }
  8974. -
  8975. - /* reset some values that shouldn't be kept across type changes */
  8976. -- sdata->drop_unencrypted = 0;
  8977. - if (type == NL80211_IFTYPE_STATION)
  8978. - sdata->u.mgd.use_4addr = false;
  8979. -
  8980. ---- a/net/mac80211/rx.c
  8981. -+++ b/net/mac80211/rx.c
  8982. -@@ -1897,8 +1897,7 @@ static int ieee80211_drop_unencrypted(st
  8983. - /* Drop unencrypted frames if key is set. */
  8984. - if (unlikely(!ieee80211_has_protected(fc) &&
  8985. - !ieee80211_is_nullfunc(fc) &&
  8986. -- ieee80211_is_data(fc) &&
  8987. -- (rx->key || rx->sdata->drop_unencrypted)))
  8988. -+ ieee80211_is_data(fc) && rx->key))
  8989. - return -EACCES;
  8990. -
  8991. - return 0;
  8992. ---- a/net/mac80211/tx.c
  8993. -+++ b/net/mac80211/tx.c
  8994. -@@ -594,23 +594,8 @@ ieee80211_tx_h_select_key(struct ieee802
  8995. - else if (!is_multicast_ether_addr(hdr->addr1) &&
  8996. - (key = rcu_dereference(tx->sdata->default_unicast_key)))
  8997. - tx->key = key;
  8998. -- else if (info->flags & IEEE80211_TX_CTL_INJECTED)
  8999. -+ else
  9000. - tx->key = NULL;
  9001. -- else if (!tx->sdata->drop_unencrypted)
  9002. -- tx->key = NULL;
  9003. -- else if (tx->skb->protocol == tx->sdata->control_port_protocol)
  9004. -- tx->key = NULL;
  9005. -- else if (ieee80211_is_robust_mgmt_frame(tx->skb) &&
  9006. -- !(ieee80211_is_action(hdr->frame_control) &&
  9007. -- tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))
  9008. -- tx->key = NULL;
  9009. -- else if (ieee80211_is_mgmt(hdr->frame_control) &&
  9010. -- !ieee80211_is_robust_mgmt_frame(tx->skb))
  9011. -- tx->key = NULL;
  9012. -- else {
  9013. -- I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
  9014. -- return TX_DROP;
  9015. -- }
  9016. -
  9017. - if (tx->key) {
  9018. - bool skip_hw = false;
  9019. 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
  9020. new file mode 100644
  9021. index 0000000..bb27115
  9022. --- /dev/null
  9023. +++ b/package/kernel/mac80211/patches/312-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  9024. @@ -0,0 +1,46 @@
  9025. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  9026. +Date: Thu, 20 Aug 2015 00:16:42 +0200
  9027. +Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
  9028. + addresses
  9029. +MIME-Version: 1.0
  9030. +Content-Type: text/plain; charset=UTF-8
  9031. +Content-Transfer-Encoding: 8bit
  9032. +
  9033. +Broadcom is working on better reflection of interface combinations. With
  9034. +upcoming patches we may have 1st combination supporting less interfaces
  9035. +than others.
  9036. +To don't run out of addresses check all combinations to find the one
  9037. +with the greatest max_interfaces value.
  9038. +
  9039. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  9040. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9041. +---
  9042. +
  9043. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9044. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9045. +@@ -5786,7 +5786,9 @@ static void brcmf_wiphy_wowl_params(stru
  9046. + static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  9047. + {
  9048. + struct brcmf_pub *drvr = ifp->drvr;
  9049. ++ const struct ieee80211_iface_combination *combo;
  9050. + struct ieee80211_supported_band *band;
  9051. ++ u16 max_interfaces = 0;
  9052. + __le32 bandlist[3];
  9053. + u32 n_bands;
  9054. + int err, i;
  9055. +@@ -5799,8 +5801,13 @@ static int brcmf_setup_wiphy(struct wiph
  9056. + if (err)
  9057. + return err;
  9058. +
  9059. +- for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  9060. +- i < ARRAY_SIZE(drvr->addresses); i++) {
  9061. ++ for (i = 0, combo = wiphy->iface_combinations;
  9062. ++ i < wiphy->n_iface_combinations; i++, combo++) {
  9063. ++ max_interfaces = max(max_interfaces, combo->max_interfaces);
  9064. ++ }
  9065. ++
  9066. ++ for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
  9067. ++ i++) {
  9068. + u8 *addr = drvr->addresses[i].addr;
  9069. +
  9070. + memcpy(addr, drvr->mac, ETH_ALEN);
  9071. 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
  9072. deleted file mode 100644
  9073. index 02a7fab..0000000
  9074. --- a/package/kernel/mac80211/patches/312-mac80211-don-t-look-up-destination-station-twice.patch
  9075. +++ /dev/null
  9076. @@ -1,71 +0,0 @@
  9077. -From: Johannes Berg <johannes.berg@intel.com>
  9078. -Date: Fri, 20 Mar 2015 16:24:21 +0100
  9079. -Subject: [PATCH] mac80211: don't look up destination station twice
  9080. -
  9081. -There's no need to look up the destination station twice while
  9082. -building the 802.11 header for a given frame if the frame will
  9083. -actually be transmitted to the station we initially looked up.
  9084. -
  9085. -This happens for 4-addr VLAN interfaces and TDLS connections, which
  9086. -both directly send the frame to the station they looked up, though
  9087. -in the case of TDLS some station conditions need to be checked.
  9088. -
  9089. -To avoid that, add a variable indicating that we've looked up the
  9090. -station that the frame is going to be transmitted to, and avoid the
  9091. -lookup/flag checking if it already has been done.
  9092. -
  9093. -In the TDLS case, also move the authorized/wme_sta flag assignment
  9094. -to the correct place, i.e. only when that station is really used.
  9095. -Before this change, the new lookup should always have succeeded so
  9096. -that the potentially erroneous data would be overwritten.
  9097. -
  9098. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9099. ----
  9100. -
  9101. ---- a/net/mac80211/tx.c
  9102. -+++ b/net/mac80211/tx.c
  9103. -@@ -1894,6 +1894,7 @@ static struct sk_buff *ieee80211_build_h
  9104. - bool wme_sta = false, authorized = false, tdls_auth = false;
  9105. - bool tdls_peer = false, tdls_setup_frame = false;
  9106. - bool multicast;
  9107. -+ bool have_station = false;
  9108. - u16 info_id = 0;
  9109. - struct ieee80211_chanctx_conf *chanctx_conf;
  9110. - struct ieee80211_sub_if_data *ap_sdata;
  9111. -@@ -1918,6 +1919,7 @@ static struct sk_buff *ieee80211_build_h
  9112. - hdrlen = 30;
  9113. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9114. - wme_sta = sta->sta.wme;
  9115. -+ have_station = true;
  9116. - }
  9117. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  9118. - u.ap);
  9119. -@@ -2034,9 +2036,6 @@ static struct sk_buff *ieee80211_build_h
  9120. - if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) {
  9121. - sta = sta_info_get(sdata, skb->data);
  9122. - if (sta) {
  9123. -- authorized = test_sta_flag(sta,
  9124. -- WLAN_STA_AUTHORIZED);
  9125. -- wme_sta = sta->sta.wme;
  9126. - tdls_peer = test_sta_flag(sta,
  9127. - WLAN_STA_TDLS_PEER);
  9128. - tdls_auth = test_sta_flag(sta,
  9129. -@@ -2068,6 +2067,9 @@ static struct sk_buff *ieee80211_build_h
  9130. - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
  9131. - memcpy(hdr.addr3, sdata->u.mgd.bssid, ETH_ALEN);
  9132. - hdrlen = 24;
  9133. -+ have_station = true;
  9134. -+ authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9135. -+ wme_sta = sta->sta.wme;
  9136. - } else if (sdata->u.mgd.use_4addr &&
  9137. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  9138. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  9139. -@@ -2130,7 +2132,7 @@ static struct sk_buff *ieee80211_build_h
  9140. - * in AP mode)
  9141. - */
  9142. - multicast = is_multicast_ether_addr(hdr.addr1);
  9143. -- if (!multicast) {
  9144. -+ if (!multicast && !have_station) {
  9145. - sta = sta_info_get(sdata, hdr.addr1);
  9146. - if (sta) {
  9147. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9148. 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
  9149. new file mode 100644
  9150. index 0000000..baee295
  9151. --- /dev/null
  9152. +++ b/package/kernel/mac80211/patches/313-brcmfmac-correct-interface-combination-info.patch
  9153. @@ -0,0 +1,204 @@
  9154. +From: Arend van Spriel <arend@broadcom.com>
  9155. +Date: Thu, 20 Aug 2015 22:06:03 +0200
  9156. +Subject: [PATCH] brcmfmac: correct interface combination info
  9157. +
  9158. +The interface combination provided by brcmfmac did not truly reflect
  9159. +the combinations supported by driver and/or firmware.
  9160. +
  9161. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9162. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9163. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9164. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  9165. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9166. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9167. +---
  9168. +
  9169. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9170. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9171. +@@ -5695,63 +5695,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  9172. + }
  9173. + };
  9174. +
  9175. ++/**
  9176. ++ * brcmf_setup_ifmodes() - determine interface modes and combinations.
  9177. ++ *
  9178. ++ * @wiphy: wiphy object.
  9179. ++ * @ifp: interface object needed for feat module api.
  9180. ++ *
  9181. ++ * The interface modes and combinations are determined dynamically here
  9182. ++ * based on firmware functionality.
  9183. ++ *
  9184. ++ * no p2p and no mbss:
  9185. ++ *
  9186. ++ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  9187. ++ *
  9188. ++ * no p2p and mbss:
  9189. ++ *
  9190. ++ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  9191. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  9192. ++ *
  9193. ++ * p2p, no mchan, and mbss:
  9194. ++ *
  9195. ++ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
  9196. ++ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  9197. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  9198. ++ *
  9199. ++ * p2p, mchan, and mbss:
  9200. ++ *
  9201. ++ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  9202. ++ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  9203. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  9204. ++ */
  9205. + static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  9206. + {
  9207. + struct ieee80211_iface_combination *combo = NULL;
  9208. +- struct ieee80211_iface_limit *limits = NULL;
  9209. +- int i = 0, max_iface_cnt;
  9210. ++ struct ieee80211_iface_limit *c0_limits = NULL;
  9211. ++ struct ieee80211_iface_limit *p2p_limits = NULL;
  9212. ++ struct ieee80211_iface_limit *mbss_limits = NULL;
  9213. ++ bool mbss, p2p;
  9214. ++ int i, c, n_combos;
  9215. +
  9216. +- combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  9217. ++ mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
  9218. ++ p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
  9219. ++
  9220. ++ n_combos = 1 + !!p2p + !!mbss;
  9221. ++ combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
  9222. + if (!combo)
  9223. + goto err;
  9224. +
  9225. +- limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  9226. +- if (!limits)
  9227. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  9228. ++ if (!c0_limits)
  9229. + goto err;
  9230. +
  9231. ++ if (p2p) {
  9232. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  9233. ++ if (!p2p_limits)
  9234. ++ goto err;
  9235. ++ }
  9236. ++
  9237. ++ if (mbss) {
  9238. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  9239. ++ if (!mbss_limits)
  9240. ++ goto err;
  9241. ++ }
  9242. ++
  9243. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  9244. + BIT(NL80211_IFTYPE_ADHOC) |
  9245. + BIT(NL80211_IFTYPE_AP);
  9246. +
  9247. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  9248. +- combo->num_different_channels = 2;
  9249. +- else
  9250. +- combo->num_different_channels = 1;
  9251. +-
  9252. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  9253. +- limits[i].max = 1;
  9254. +- limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  9255. +- limits[i].max = 4;
  9256. +- limits[i++].types = BIT(NL80211_IFTYPE_AP);
  9257. +- max_iface_cnt = 5;
  9258. +- } else {
  9259. +- limits[i].max = 2;
  9260. +- limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  9261. +- BIT(NL80211_IFTYPE_AP);
  9262. +- max_iface_cnt = 2;
  9263. +- }
  9264. +-
  9265. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  9266. ++ c = 0;
  9267. ++ i = 0;
  9268. ++ combo[c].num_different_channels = 1;
  9269. ++ c0_limits[i].max = 1;
  9270. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  9271. ++ if (p2p) {
  9272. ++ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  9273. ++ combo[c].num_different_channels = 2;
  9274. + wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9275. + BIT(NL80211_IFTYPE_P2P_GO) |
  9276. + BIT(NL80211_IFTYPE_P2P_DEVICE);
  9277. +- limits[i].max = 1;
  9278. +- limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9279. +- BIT(NL80211_IFTYPE_P2P_GO);
  9280. +- limits[i].max = 1;
  9281. +- limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  9282. +- max_iface_cnt += 2;
  9283. +- }
  9284. +- combo->max_interfaces = max_iface_cnt;
  9285. +- combo->limits = limits;
  9286. +- combo->n_limits = i;
  9287. ++ c0_limits[i].max = 1;
  9288. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  9289. ++ c0_limits[i].max = 1;
  9290. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9291. ++ BIT(NL80211_IFTYPE_P2P_GO);
  9292. ++ } else {
  9293. ++ c0_limits[i].max = 1;
  9294. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  9295. ++ }
  9296. ++ combo[c].max_interfaces = i;
  9297. ++ combo[c].n_limits = i;
  9298. ++ combo[c].limits = c0_limits;
  9299. ++
  9300. ++ if (p2p) {
  9301. ++ c++;
  9302. ++ i = 0;
  9303. ++ combo[c].num_different_channels = 1;
  9304. ++ p2p_limits[i].max = 1;
  9305. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  9306. ++ p2p_limits[i].max = 1;
  9307. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  9308. ++ p2p_limits[i].max = 1;
  9309. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  9310. ++ p2p_limits[i].max = 1;
  9311. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  9312. ++ combo[c].max_interfaces = i;
  9313. ++ combo[c].n_limits = i;
  9314. ++ combo[c].limits = p2p_limits;
  9315. ++ }
  9316. +
  9317. ++ if (mbss) {
  9318. ++ c++;
  9319. ++ combo[c].beacon_int_infra_match = true;
  9320. ++ combo[c].num_different_channels = 1;
  9321. ++ mbss_limits[0].max = 4;
  9322. ++ mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  9323. ++ combo[c].max_interfaces = 4;
  9324. ++ combo[c].n_limits = 1;
  9325. ++ combo[c].limits = mbss_limits;
  9326. ++ }
  9327. ++ wiphy->n_iface_combinations = n_combos;
  9328. + wiphy->iface_combinations = combo;
  9329. +- wiphy->n_iface_combinations = 1;
  9330. + return 0;
  9331. +
  9332. + err:
  9333. +- kfree(limits);
  9334. ++ kfree(c0_limits);
  9335. ++ kfree(p2p_limits);
  9336. ++ kfree(mbss_limits);
  9337. + kfree(combo);
  9338. + return -ENOMEM;
  9339. + }
  9340. +@@ -6080,11 +6149,15 @@ static void brcmf_cfg80211_reg_notifier(
  9341. +
  9342. + static void brcmf_free_wiphy(struct wiphy *wiphy)
  9343. + {
  9344. ++ int i;
  9345. ++
  9346. + if (!wiphy)
  9347. + return;
  9348. +
  9349. +- if (wiphy->iface_combinations)
  9350. +- kfree(wiphy->iface_combinations->limits);
  9351. ++ if (wiphy->iface_combinations) {
  9352. ++ for (i = 0; i < wiphy->n_iface_combinations; i++)
  9353. ++ kfree(wiphy->iface_combinations[i].limits);
  9354. ++ }
  9355. + kfree(wiphy->iface_combinations);
  9356. + if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  9357. + kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  9358. 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
  9359. deleted file mode 100644
  9360. index 4125351..0000000
  9361. --- a/package/kernel/mac80211/patches/313-mac80211-drop-4-addr-VLAN-frames-earlier-if-not-conn.patch
  9362. +++ /dev/null
  9363. @@ -1,27 +0,0 @@
  9364. -From: Johannes Berg <johannes.berg@intel.com>
  9365. -Date: Fri, 20 Mar 2015 16:24:22 +0100
  9366. -Subject: [PATCH] mac80211: drop 4-addr VLAN frames earlier if not
  9367. - connected
  9368. -
  9369. -If there's no station on the 4-addr VLAN interface, then frames
  9370. -cannot be transmitted. Drop such frames earlier, before setting
  9371. -up all the information for them.
  9372. -
  9373. -We should keep the old check though since that code might be used
  9374. -for other internally-generated frames.
  9375. -
  9376. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9377. ----
  9378. -
  9379. ---- a/net/mac80211/tx.c
  9380. -+++ b/net/mac80211/tx.c
  9381. -@@ -1920,6 +1920,9 @@ static struct sk_buff *ieee80211_build_h
  9382. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9383. - wme_sta = sta->sta.wme;
  9384. - have_station = true;
  9385. -+ } else if (sdata->wdev.use_4addr) {
  9386. -+ ret = -ENOLINK;
  9387. -+ goto free;
  9388. - }
  9389. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  9390. - u.ap);
  9391. 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
  9392. new file mode 100644
  9393. index 0000000..9768ef2
  9394. --- /dev/null
  9395. +++ b/package/kernel/mac80211/patches/314-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  9396. @@ -0,0 +1,87 @@
  9397. +From: Franky Lin <frankyl@broadcom.com>
  9398. +Date: Thu, 20 Aug 2015 22:06:04 +0200
  9399. +Subject: [PATCH] brcmfmac: add debugfs entry for msgbuf statistics
  9400. +
  9401. +Expose ring buffer read/write pointers and other useful statistics
  9402. +through debugfs.
  9403. +
  9404. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9405. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9406. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9407. +Signed-off-by: Franky Lin <frankyl@broadcom.com>
  9408. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9409. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9410. +---
  9411. +
  9412. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  9413. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  9414. +@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct
  9415. + }
  9416. + }
  9417. +
  9418. ++#ifdef DEBUG
  9419. ++static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  9420. ++{
  9421. ++ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  9422. ++ struct brcmf_pub *drvr = bus_if->drvr;
  9423. ++ struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  9424. ++ struct brcmf_commonring *commonring;
  9425. ++ u16 i;
  9426. ++ struct brcmf_flowring_ring *ring;
  9427. ++ struct brcmf_flowring_hash *hash;
  9428. ++
  9429. ++ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
  9430. ++ seq_printf(seq, "h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n",
  9431. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9432. ++ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
  9433. ++ seq_printf(seq, "h2d_rx_submit: rp %4u, wp %4u, depth %4u\n",
  9434. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9435. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
  9436. ++ seq_printf(seq, "d2h_ctl_cmplt: rp %4u, wp %4u, depth %4u\n",
  9437. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9438. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
  9439. ++ seq_printf(seq, "d2h_tx_cmplt: rp %4u, wp %4u, depth %4u\n",
  9440. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9441. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
  9442. ++ seq_printf(seq, "d2h_rx_cmplt: rp %4u, wp %4u, depth %4u\n",
  9443. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9444. ++
  9445. ++ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
  9446. ++ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
  9447. ++ seq_puts(seq, "Active flowrings:\n");
  9448. ++ hash = msgbuf->flow->hash;
  9449. ++ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
  9450. ++ if (!msgbuf->flow->rings[i])
  9451. ++ continue;
  9452. ++ ring = msgbuf->flow->rings[i];
  9453. ++ if (ring->status != RING_OPEN)
  9454. ++ continue;
  9455. ++ commonring = msgbuf->flowrings[i];
  9456. ++ hash = &msgbuf->flow->hash[ring->hash_id];
  9457. ++ seq_printf(seq, "id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n"
  9458. ++ " ifidx %u, fifo %u, da %pM\n",
  9459. ++ i, commonring->r_ptr, commonring->w_ptr,
  9460. ++ skb_queue_len(&ring->skblist), ring->blocked,
  9461. ++ hash->ifidx, hash->fifo, hash->mac);
  9462. ++ }
  9463. ++
  9464. ++ return 0;
  9465. ++}
  9466. ++#else
  9467. ++static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  9468. ++{
  9469. ++ return 0;
  9470. ++}
  9471. ++#endif
  9472. +
  9473. + int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
  9474. + {
  9475. +@@ -1460,6 +1514,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  9476. + spin_lock_init(&msgbuf->flowring_work_lock);
  9477. + INIT_LIST_HEAD(&msgbuf->work_queue);
  9478. +
  9479. ++ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read);
  9480. ++
  9481. + return 0;
  9482. +
  9483. + fail:
  9484. 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
  9485. deleted file mode 100644
  9486. index 9105a64..0000000
  9487. --- a/package/kernel/mac80211/patches/314-mac80211-mesh-avoid-pointless-station-lookup.patch
  9488. +++ /dev/null
  9489. @@ -1,33 +0,0 @@
  9490. -From: Johannes Berg <johannes.berg@intel.com>
  9491. -Date: Fri, 20 Mar 2015 16:24:23 +0100
  9492. -Subject: [PATCH] mac80211: mesh: avoid pointless station lookup
  9493. -
  9494. -In ieee80211_build_hdr(), the station is looked up to build the
  9495. -header correctly (QoS field) and to check for authorization. For
  9496. -mesh, authorization isn't checked here, and QoS capability is
  9497. -mandatory, so the station lookup can be avoided.
  9498. -
  9499. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9500. ----
  9501. -
  9502. ---- a/net/mac80211/tx.c
  9503. -+++ b/net/mac80211/tx.c
  9504. -@@ -2130,12 +2130,14 @@ static struct sk_buff *ieee80211_build_h
  9505. - }
  9506. -
  9507. - /*
  9508. -- * There's no need to try to look up the destination
  9509. -- * if it is a multicast address (which can only happen
  9510. -- * in AP mode)
  9511. -+ * There's no need to try to look up the destination station
  9512. -+ * if it is a multicast address. In mesh, there's no need to
  9513. -+ * look up the station at all as it always must be QoS capable
  9514. -+ * and mesh mode checks authorization later.
  9515. - */
  9516. - multicast = is_multicast_ether_addr(hdr.addr1);
  9517. -- if (!multicast && !have_station) {
  9518. -+ if (!multicast && !have_station &&
  9519. -+ !ieee80211_vif_is_mesh(&sdata->vif)) {
  9520. - sta = sta_info_get(sdata, hdr.addr1);
  9521. - if (sta) {
  9522. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9523. 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
  9524. new file mode 100644
  9525. index 0000000..281f02b
  9526. --- /dev/null
  9527. +++ b/package/kernel/mac80211/patches/315-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  9528. @@ -0,0 +1,83 @@
  9529. +From: Arend van Spriel <arend@broadcom.com>
  9530. +Date: Thu, 20 Aug 2015 22:06:05 +0200
  9531. +Subject: [PATCH] brcmfmac: make use of cfg80211_check_combinations()
  9532. +
  9533. +Use cfg80211_check_combinations() so we can bail out early when an
  9534. +interface add or change results in an invalid combination.
  9535. +
  9536. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9537. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9538. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9539. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9540. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9541. +---
  9542. +
  9543. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9544. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9545. +@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 le
  9546. + return NULL;
  9547. + }
  9548. +
  9549. ++static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
  9550. ++ struct brcmf_cfg80211_vif *vif,
  9551. ++ enum nl80211_iftype new_type)
  9552. ++{
  9553. ++ int iftype_num[NUM_NL80211_IFTYPES];
  9554. ++ struct brcmf_cfg80211_vif *pos;
  9555. ++
  9556. ++ memset(&iftype_num[0], 0, sizeof(iftype_num));
  9557. ++ list_for_each_entry(pos, &cfg->vif_list, list)
  9558. ++ if (pos == vif)
  9559. ++ iftype_num[new_type]++;
  9560. ++ else
  9561. ++ iftype_num[pos->wdev.iftype]++;
  9562. ++
  9563. ++ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  9564. ++}
  9565. ++
  9566. ++static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
  9567. ++ enum nl80211_iftype new_type)
  9568. ++{
  9569. ++ int iftype_num[NUM_NL80211_IFTYPES];
  9570. ++ struct brcmf_cfg80211_vif *pos;
  9571. ++
  9572. ++ memset(&iftype_num[0], 0, sizeof(iftype_num));
  9573. ++ list_for_each_entry(pos, &cfg->vif_list, list)
  9574. ++ iftype_num[pos->wdev.iftype]++;
  9575. ++
  9576. ++ iftype_num[new_type]++;
  9577. ++ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  9578. ++}
  9579. +
  9580. + static void convert_key_from_CPU(struct brcmf_wsec_key *key,
  9581. + struct brcmf_wsec_key_le *key_le)
  9582. +@@ -663,8 +693,14 @@ static struct wireless_dev *brcmf_cfg802
  9583. + struct vif_params *params)
  9584. + {
  9585. + struct wireless_dev *wdev;
  9586. ++ int err;
  9587. +
  9588. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  9589. ++ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  9590. ++ if (err) {
  9591. ++ brcmf_err("iface validation failed: err=%d\n", err);
  9592. ++ return ERR_PTR(err);
  9593. ++ }
  9594. + switch (type) {
  9595. + case NL80211_IFTYPE_ADHOC:
  9596. + case NL80211_IFTYPE_STATION:
  9597. +@@ -823,8 +859,12 @@ brcmf_cfg80211_change_iface(struct wiphy
  9598. + s32 ap = 0;
  9599. + s32 err = 0;
  9600. +
  9601. +- brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
  9602. +-
  9603. ++ brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  9604. ++ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  9605. ++ if (err) {
  9606. ++ brcmf_err("iface validation failed: err=%d\n", err);
  9607. ++ return err;
  9608. ++ }
  9609. + switch (type) {
  9610. + case NL80211_IFTYPE_MONITOR:
  9611. + case NL80211_IFTYPE_WDS:
  9612. 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
  9613. deleted file mode 100644
  9614. index d143025..0000000
  9615. --- a/package/kernel/mac80211/patches/315-mac80211-avoid-duplicate-TX-path-station-lookup.patch
  9616. +++ /dev/null
  9617. @@ -1,267 +0,0 @@
  9618. -From: Johannes Berg <johannes.berg@intel.com>
  9619. -Date: Fri, 20 Mar 2015 14:18:27 +0100
  9620. -Subject: [PATCH] mac80211: avoid duplicate TX path station lookup
  9621. -
  9622. -Instead of looking up the destination station twice in the TX path
  9623. -(first to build the header, and then for control processing), save
  9624. -it when building the header and use it later in the TX path.
  9625. -
  9626. -To avoid having to look up the station in the many callers, allow
  9627. -those to pass %NULL which keeps the existing lookup.
  9628. -
  9629. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9630. ----
  9631. -
  9632. ---- a/net/mac80211/cfg.c
  9633. -+++ b/net/mac80211/cfg.c
  9634. -@@ -3565,7 +3565,7 @@ static int ieee80211_probe_client(struct
  9635. - nullfunc->qos_ctrl = cpu_to_le16(7);
  9636. -
  9637. - local_bh_disable();
  9638. -- ieee80211_xmit(sdata, skb);
  9639. -+ ieee80211_xmit(sdata, sta, skb);
  9640. - local_bh_enable();
  9641. - rcu_read_unlock();
  9642. -
  9643. ---- a/net/mac80211/ieee80211_i.h
  9644. -+++ b/net/mac80211/ieee80211_i.h
  9645. -@@ -1775,7 +1775,8 @@ void mac80211_ev_michael_mic_failure(str
  9646. - gfp_t gfp);
  9647. - void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
  9648. - bool bss_notify);
  9649. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
  9650. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  9651. -+ struct sta_info *sta, struct sk_buff *skb);
  9652. -
  9653. - void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
  9654. - struct sk_buff *skb, int tid,
  9655. ---- a/net/mac80211/sta_info.c
  9656. -+++ b/net/mac80211/sta_info.c
  9657. -@@ -1279,7 +1279,7 @@ static void ieee80211_send_null_response
  9658. - }
  9659. -
  9660. - info->band = chanctx_conf->def.chan->band;
  9661. -- ieee80211_xmit(sdata, skb);
  9662. -+ ieee80211_xmit(sdata, sta, skb);
  9663. - rcu_read_unlock();
  9664. - }
  9665. -
  9666. ---- a/net/mac80211/tx.c
  9667. -+++ b/net/mac80211/tx.c
  9668. -@@ -1110,11 +1110,13 @@ static bool ieee80211_tx_prep_agg(struct
  9669. -
  9670. - /*
  9671. - * initialises @tx
  9672. -+ * pass %NULL for the station if unknown, a valid pointer if known
  9673. -+ * or an ERR_PTR() if the station is known not to exist
  9674. - */
  9675. - static ieee80211_tx_result
  9676. - ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
  9677. - struct ieee80211_tx_data *tx,
  9678. -- struct sk_buff *skb)
  9679. -+ struct sta_info *sta, struct sk_buff *skb)
  9680. - {
  9681. - struct ieee80211_local *local = sdata->local;
  9682. - struct ieee80211_hdr *hdr;
  9683. -@@ -1137,17 +1139,22 @@ ieee80211_tx_prepare(struct ieee80211_su
  9684. -
  9685. - hdr = (struct ieee80211_hdr *) skb->data;
  9686. -
  9687. -- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  9688. -- tx->sta = rcu_dereference(sdata->u.vlan.sta);
  9689. -- if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
  9690. -- return TX_DROP;
  9691. -- } else if (info->flags & (IEEE80211_TX_CTL_INJECTED |
  9692. -- IEEE80211_TX_INTFL_NL80211_FRAME_TX) ||
  9693. -- tx->sdata->control_port_protocol == tx->skb->protocol) {
  9694. -- tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  9695. -+ if (likely(sta)) {
  9696. -+ if (!IS_ERR(sta))
  9697. -+ tx->sta = sta;
  9698. -+ } else {
  9699. -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  9700. -+ tx->sta = rcu_dereference(sdata->u.vlan.sta);
  9701. -+ if (!tx->sta && sdata->wdev.use_4addr)
  9702. -+ return TX_DROP;
  9703. -+ } else if (info->flags & (IEEE80211_TX_INTFL_NL80211_FRAME_TX |
  9704. -+ IEEE80211_TX_CTL_INJECTED) ||
  9705. -+ tx->sdata->control_port_protocol == tx->skb->protocol) {
  9706. -+ tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  9707. -+ }
  9708. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  9709. -+ tx->sta = sta_info_get(sdata, hdr->addr1);
  9710. - }
  9711. -- if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  9712. -- tx->sta = sta_info_get(sdata, hdr->addr1);
  9713. -
  9714. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  9715. - !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
  9716. -@@ -1485,7 +1492,7 @@ bool ieee80211_tx_prepare_skb(struct iee
  9717. - struct ieee80211_tx_data tx;
  9718. - struct sk_buff *skb2;
  9719. -
  9720. -- if (ieee80211_tx_prepare(sdata, &tx, skb) == TX_DROP)
  9721. -+ if (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP)
  9722. - return false;
  9723. -
  9724. - info->band = band;
  9725. -@@ -1518,7 +1525,8 @@ EXPORT_SYMBOL(ieee80211_tx_prepare_skb);
  9726. - * Returns false if the frame couldn't be transmitted but was queued instead.
  9727. - */
  9728. - static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
  9729. -- struct sk_buff *skb, bool txpending)
  9730. -+ struct sta_info *sta, struct sk_buff *skb,
  9731. -+ bool txpending)
  9732. - {
  9733. - struct ieee80211_local *local = sdata->local;
  9734. - struct ieee80211_tx_data tx;
  9735. -@@ -1534,7 +1542,7 @@ static bool ieee80211_tx(struct ieee8021
  9736. -
  9737. - /* initialises tx */
  9738. - led_len = skb->len;
  9739. -- res_prepare = ieee80211_tx_prepare(sdata, &tx, skb);
  9740. -+ res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
  9741. -
  9742. - if (unlikely(res_prepare == TX_DROP)) {
  9743. - ieee80211_free_txskb(&local->hw, skb);
  9744. -@@ -1590,7 +1598,8 @@ static int ieee80211_skb_resize(struct i
  9745. - return 0;
  9746. - }
  9747. -
  9748. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
  9749. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  9750. -+ struct sta_info *sta, struct sk_buff *skb)
  9751. - {
  9752. - struct ieee80211_local *local = sdata->local;
  9753. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  9754. -@@ -1625,7 +1634,7 @@ void ieee80211_xmit(struct ieee80211_sub
  9755. - }
  9756. -
  9757. - ieee80211_set_qos_hdr(sdata, skb);
  9758. -- ieee80211_tx(sdata, skb, false);
  9759. -+ ieee80211_tx(sdata, sta, skb, false);
  9760. - }
  9761. -
  9762. - static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  9763. -@@ -1846,7 +1855,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  9764. - goto fail_rcu;
  9765. -
  9766. - info->band = chandef->chan->band;
  9767. -- ieee80211_xmit(sdata, skb);
  9768. -+ ieee80211_xmit(sdata, NULL, skb);
  9769. - rcu_read_unlock();
  9770. -
  9771. - return NETDEV_TX_OK;
  9772. -@@ -1877,7 +1886,8 @@ fail:
  9773. - * Returns: the (possibly reallocated) skb or an ERR_PTR() code
  9774. - */
  9775. - static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
  9776. -- struct sk_buff *skb, u32 info_flags)
  9777. -+ struct sk_buff *skb, u32 info_flags,
  9778. -+ struct sta_info **sta_out)
  9779. - {
  9780. - struct ieee80211_local *local = sdata->local;
  9781. - struct ieee80211_tx_info *info;
  9782. -@@ -1920,6 +1930,7 @@ static struct sk_buff *ieee80211_build_h
  9783. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9784. - wme_sta = sta->sta.wme;
  9785. - have_station = true;
  9786. -+ *sta_out = sta;
  9787. - } else if (sdata->wdev.use_4addr) {
  9788. - ret = -ENOLINK;
  9789. - goto free;
  9790. -@@ -2073,6 +2084,7 @@ static struct sk_buff *ieee80211_build_h
  9791. - have_station = true;
  9792. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9793. - wme_sta = sta->sta.wme;
  9794. -+ *sta_out = sta;
  9795. - } else if (sdata->u.mgd.use_4addr &&
  9796. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  9797. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  9798. -@@ -2136,13 +2148,18 @@ static struct sk_buff *ieee80211_build_h
  9799. - * and mesh mode checks authorization later.
  9800. - */
  9801. - multicast = is_multicast_ether_addr(hdr.addr1);
  9802. -- if (!multicast && !have_station &&
  9803. -- !ieee80211_vif_is_mesh(&sdata->vif)) {
  9804. -- sta = sta_info_get(sdata, hdr.addr1);
  9805. -+ if (multicast) {
  9806. -+ *sta_out = ERR_PTR(-ENOENT);
  9807. -+ } else if (!have_station && !ieee80211_vif_is_mesh(&sdata->vif)) {
  9808. -+ if (sdata->control_port_protocol == skb->protocol)
  9809. -+ sta = sta_info_get_bss(sdata, hdr.addr1);
  9810. -+ else
  9811. -+ sta = sta_info_get(sdata, hdr.addr1);
  9812. - if (sta) {
  9813. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9814. - wme_sta = sta->sta.wme;
  9815. - }
  9816. -+ *sta_out = sta ?: ERR_PTR(-ENOENT);
  9817. - }
  9818. -
  9819. - /* For mesh, the use of the QoS header is mandatory */
  9820. -@@ -2320,6 +2337,7 @@ void __ieee80211_subif_start_xmit(struct
  9821. - u32 info_flags)
  9822. - {
  9823. - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  9824. -+ struct sta_info *sta = NULL;
  9825. -
  9826. - if (unlikely(skb->len < ETH_HLEN)) {
  9827. - kfree_skb(skb);
  9828. -@@ -2328,7 +2346,7 @@ void __ieee80211_subif_start_xmit(struct
  9829. -
  9830. - rcu_read_lock();
  9831. -
  9832. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  9833. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta);
  9834. - if (IS_ERR(skb))
  9835. - goto out;
  9836. -
  9837. -@@ -2336,7 +2354,7 @@ void __ieee80211_subif_start_xmit(struct
  9838. - dev->stats.tx_bytes += skb->len;
  9839. - dev->trans_start = jiffies;
  9840. -
  9841. -- ieee80211_xmit(sdata, skb);
  9842. -+ ieee80211_xmit(sdata, sta, skb);
  9843. - out:
  9844. - rcu_read_unlock();
  9845. - }
  9846. -@@ -2364,10 +2382,11 @@ ieee80211_build_data_template(struct iee
  9847. - .local = sdata->local,
  9848. - .sdata = sdata,
  9849. - };
  9850. -+ struct sta_info *sta_ignore;
  9851. -
  9852. - rcu_read_lock();
  9853. -
  9854. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  9855. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta_ignore);
  9856. - if (IS_ERR(skb))
  9857. - goto out;
  9858. -
  9859. -@@ -2425,7 +2444,7 @@ static bool ieee80211_tx_pending_skb(str
  9860. - return true;
  9861. - }
  9862. - info->band = chanctx_conf->def.chan->band;
  9863. -- result = ieee80211_tx(sdata, skb, true);
  9864. -+ result = ieee80211_tx(sdata, NULL, skb, true);
  9865. - } else {
  9866. - struct sk_buff_head skbs;
  9867. -
  9868. -@@ -3163,7 +3182,7 @@ ieee80211_get_buffered_bc(struct ieee802
  9869. -
  9870. - if (sdata->vif.type == NL80211_IFTYPE_AP)
  9871. - sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
  9872. -- if (!ieee80211_tx_prepare(sdata, &tx, skb))
  9873. -+ if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
  9874. - break;
  9875. - dev_kfree_skb_any(skb);
  9876. - }
  9877. -@@ -3295,6 +3314,6 @@ void __ieee80211_tx_skb_tid_band(struct
  9878. - */
  9879. - local_bh_disable();
  9880. - IEEE80211_SKB_CB(skb)->band = band;
  9881. -- ieee80211_xmit(sdata, skb);
  9882. -+ ieee80211_xmit(sdata, NULL, skb);
  9883. - local_bh_enable();
  9884. - }
  9885. 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
  9886. new file mode 100644
  9887. index 0000000..2d5f7b9
  9888. --- /dev/null
  9889. +++ b/package/kernel/mac80211/patches/316-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  9890. @@ -0,0 +1,48 @@
  9891. +From: Franky Lin <frankyl@broadcom.com>
  9892. +Date: Thu, 20 Aug 2015 22:06:06 +0200
  9893. +Subject: [PATCH] brcmfmac: block the correct flowring when backup queue
  9894. + overflow
  9895. +
  9896. +brcmf_flowring_block blocks the last active flowring under the same
  9897. +interface instead of the one provided by caller. This could lead to a
  9898. +dead lock of netif stop if there are more than one flowring under the
  9899. +interface and the traffic is high enough so brcmf_flowring_enqueue can
  9900. +not unblock the ring right away.
  9901. +
  9902. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9903. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9904. +Signed-off-by: Franky Lin <frankyl@broadcom.com>
  9905. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9906. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9907. +---
  9908. +
  9909. +--- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  9910. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  9911. +@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct
  9912. + spin_lock_irqsave(&flow->block_lock, flags);
  9913. +
  9914. + ring = flow->rings[flowid];
  9915. ++ if (ring->blocked == blocked) {
  9916. ++ spin_unlock_irqrestore(&flow->block_lock, flags);
  9917. ++ return;
  9918. ++ }
  9919. + ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  9920. +
  9921. + currently_blocked = false;
  9922. + for (i = 0; i < flow->nrofrings; i++) {
  9923. +- if (flow->rings[i]) {
  9924. ++ if ((flow->rings[i]) && (i != flowid)) {
  9925. + ring = flow->rings[i];
  9926. + if ((ring->status == RING_OPEN) &&
  9927. + (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
  9928. +@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct
  9929. + }
  9930. + }
  9931. + }
  9932. +- ring->blocked = blocked;
  9933. +- if (currently_blocked == blocked) {
  9934. ++ flow->rings[flowid]->blocked = blocked;
  9935. ++ if (currently_blocked) {
  9936. + spin_unlock_irqrestore(&flow->block_lock, flags);
  9937. + return;
  9938. + }
  9939. 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
  9940. deleted file mode 100644
  9941. index 77a82c2..0000000
  9942. --- a/package/kernel/mac80211/patches/316-mac80211-reduce-log-spam-from-ieee80211_handle_pwr_c.patch
  9943. +++ /dev/null
  9944. @@ -1,38 +0,0 @@
  9945. -From: John Linville <linville@tuxdriver.com>
  9946. -Date: Tue, 31 Mar 2015 10:49:14 -0400
  9947. -Subject: [PATCH] mac80211: reduce log spam from ieee80211_handle_pwr_constr
  9948. -
  9949. -This changes a couple of messages from sdata_info to sdata_dbg.
  9950. -This should reduce some log spam, as reported here:
  9951. -
  9952. - https://bugzilla.redhat.com/show_bug.cgi?id=1206468
  9953. -
  9954. -Signed-off-by: John W. Linville <linville@tuxdriver.com>
  9955. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9956. ----
  9957. -
  9958. ---- a/net/mac80211/mlme.c
  9959. -+++ b/net/mac80211/mlme.c
  9960. -@@ -1347,15 +1347,15 @@ static u32 ieee80211_handle_pwr_constr(s
  9961. - */
  9962. - if (has_80211h_pwr &&
  9963. - (!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) {
  9964. -- sdata_info(sdata,
  9965. -- "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  9966. -- pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  9967. -- sdata->u.mgd.bssid);
  9968. -+ sdata_dbg(sdata,
  9969. -+ "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  9970. -+ pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  9971. -+ sdata->u.mgd.bssid);
  9972. - new_ap_level = pwr_level_80211h;
  9973. - } else { /* has_cisco_pwr is always true here. */
  9974. -- sdata_info(sdata,
  9975. -- "Limiting TX power to %d dBm as advertised by %pM\n",
  9976. -- pwr_level_cisco, sdata->u.mgd.bssid);
  9977. -+ sdata_dbg(sdata,
  9978. -+ "Limiting TX power to %d dBm as advertised by %pM\n",
  9979. -+ pwr_level_cisco, sdata->u.mgd.bssid);
  9980. - new_ap_level = pwr_level_cisco;
  9981. - }
  9982. -
  9983. 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
  9984. deleted file mode 100644
  9985. index e005fe7..0000000
  9986. --- a/package/kernel/mac80211/patches/317-brcmfmac-Fix-race-condition-in-msgbuf-ioctl-processi.patch
  9987. +++ /dev/null
  9988. @@ -1,35 +0,0 @@
  9989. -From: Hante Meuleman <meuleman@broadcom.com>
  9990. -Date: Fri, 6 Mar 2015 18:40:41 +0100
  9991. -Subject: [PATCH] brcmfmac: Fix race condition in msgbuf ioctl processing.
  9992. -
  9993. -Msgbuf is using a wait_event_timeout to wait for the response on
  9994. -an ioctl. The wakeup routine uses waitqueue_active to see if
  9995. -wait_event_timeout has been called. There is a chance that the
  9996. -response arrives before wait_event_timeout is called, this
  9997. -will result in situation that wait_event_timeout never gets
  9998. -woken again and assumed result will be a timeout. This patch
  9999. -removes that errornous situation by always setting the
  10000. -ctl_completed var before checking for queue active.
  10001. -
  10002. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10003. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10004. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10005. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10006. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10007. ----
  10008. -
  10009. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10010. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10011. -@@ -481,10 +481,9 @@ static int brcmf_msgbuf_ioctl_resp_wait(
  10012. -
  10013. - static void brcmf_msgbuf_ioctl_resp_wake(struct brcmf_msgbuf *msgbuf)
  10014. - {
  10015. -- if (waitqueue_active(&msgbuf->ioctl_resp_wait)) {
  10016. -- msgbuf->ctl_completed = true;
  10017. -+ msgbuf->ctl_completed = true;
  10018. -+ if (waitqueue_active(&msgbuf->ioctl_resp_wait))
  10019. - wake_up(&msgbuf->ioctl_resp_wait);
  10020. -- }
  10021. - }
  10022. -
  10023. -
  10024. 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
  10025. new file mode 100644
  10026. index 0000000..7378401
  10027. --- /dev/null
  10028. +++ b/package/kernel/mac80211/patches/317-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  10029. @@ -0,0 +1,52 @@
  10030. +From: Arend van Spriel <arend@broadcom.com>
  10031. +Date: Thu, 20 Aug 2015 22:06:07 +0200
  10032. +Subject: [PATCH] brcmfmac: bump highest event number for 4339 firmware
  10033. +
  10034. +The event mask length is determined by the highest event number
  10035. +that is specified in the driver. When this length is shorter than
  10036. +firmware expects setting event mask will fail and device becomes
  10037. +pretty useless. This issue was reported with bcm4339 firmware that
  10038. +was recently released.
  10039. +
  10040. +Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  10041. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10042. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10043. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10044. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  10045. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10046. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10047. +---
  10048. +
  10049. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  10050. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  10051. +@@ -85,7 +85,6 @@ struct brcmf_event;
  10052. + BRCMF_ENUM_DEF(IF, 54) \
  10053. + BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \
  10054. + BRCMF_ENUM_DEF(RSSI, 56) \
  10055. +- BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
  10056. + BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
  10057. + BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
  10058. + BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
  10059. +@@ -103,8 +102,7 @@ struct brcmf_event;
  10060. + BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
  10061. + BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
  10062. + BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
  10063. +- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
  10064. +- BRCMF_ENUM_DEF(PSTA_PRIMARY_INTF_IND, 128)
  10065. ++ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
  10066. +
  10067. + #define BRCMF_ENUM_DEF(id, val) \
  10068. + BRCMF_E_##id = (val),
  10069. +@@ -112,7 +110,11 @@ struct brcmf_event;
  10070. + /* firmware event codes sent by the dongle */
  10071. + enum brcmf_fweh_event_code {
  10072. + BRCMF_FWEH_EVENT_ENUM_DEFLIST
  10073. +- BRCMF_E_LAST
  10074. ++ /* this determines event mask length which must match
  10075. ++ * minimum length check in device firmware so it is
  10076. ++ * hard-coded here.
  10077. ++ */
  10078. ++ BRCMF_E_LAST = 139
  10079. + };
  10080. + #undef BRCMF_ENUM_DEF
  10081. +
  10082. 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
  10083. deleted file mode 100644
  10084. index c2cd1c5..0000000
  10085. --- a/package/kernel/mac80211/patches/318-brcmfmac-Update-msgbuf-commonring-size-for-improved-.patch
  10086. +++ /dev/null
  10087. @@ -1,30 +0,0 @@
  10088. -From: Hante Meuleman <meuleman@broadcom.com>
  10089. -Date: Wed, 18 Mar 2015 13:25:23 +0100
  10090. -Subject: [PATCH] brcmfmac: Update msgbuf commonring size for improved
  10091. - throughput.
  10092. -
  10093. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10094. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10095. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10096. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10097. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10098. ----
  10099. -
  10100. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  10101. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  10102. -@@ -17,11 +17,11 @@
  10103. -
  10104. - #ifdef CPTCFG_BRCMFMAC_PROTO_MSGBUF
  10105. -
  10106. --#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20
  10107. --#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256
  10108. --#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 20
  10109. -+#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 64
  10110. -+#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 512
  10111. -+#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 64
  10112. - #define BRCMF_D2H_MSGRING_TX_COMPLETE_MAX_ITEM 1024
  10113. --#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 256
  10114. -+#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 512
  10115. - #define BRCMF_H2D_TXFLOWRING_MAX_ITEM 512
  10116. -
  10117. - #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE 40
  10118. 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
  10119. deleted file mode 100644
  10120. index 6af69eb..0000000
  10121. --- a/package/kernel/mac80211/patches/319-ath9k_htc-add-new-WMI_REG_RMW_CMDID-command.patch
  10122. +++ /dev/null
  10123. @@ -1,307 +0,0 @@
  10124. -From: Oleksij Rempel <linux@rempel-privat.de>
  10125. -Date: Sun, 22 Mar 2015 19:29:46 +0100
  10126. -Subject: [PATCH] ath9k_htc: add new WMI_REG_RMW_CMDID command
  10127. -
  10128. -Since usb bus add extra delay on each request, a command
  10129. -with read + write requests is too expensive. We can dramtically
  10130. -reduce usb load by moving this command to firmware.
  10131. -
  10132. -In my tests, this patch will reduce channel scan time
  10133. -for about 5-10 seconds.
  10134. -
  10135. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  10136. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10137. ----
  10138. -
  10139. ---- a/drivers/net/wireless/ath/ath.h
  10140. -+++ b/drivers/net/wireless/ath/ath.h
  10141. -@@ -131,6 +131,9 @@ struct ath_ops {
  10142. - void (*enable_write_buffer)(void *);
  10143. - void (*write_flush) (void *);
  10144. - u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
  10145. -+ void (*enable_rmw_buffer)(void *);
  10146. -+ void (*rmw_flush) (void *);
  10147. -+
  10148. - };
  10149. -
  10150. - struct ath_common;
  10151. ---- a/drivers/net/wireless/ath/ath9k/htc.h
  10152. -+++ b/drivers/net/wireless/ath/ath9k/htc.h
  10153. -@@ -444,6 +444,10 @@ static inline void ath9k_htc_stop_btcoex
  10154. - #define OP_BT_SCAN BIT(4)
  10155. - #define OP_TSF_RESET BIT(6)
  10156. -
  10157. -+enum htc_op_flags {
  10158. -+ HTC_FWFLAG_NO_RMW,
  10159. -+};
  10160. -+
  10161. - struct ath9k_htc_priv {
  10162. - struct device *dev;
  10163. - struct ieee80211_hw *hw;
  10164. -@@ -482,6 +486,7 @@ struct ath9k_htc_priv {
  10165. - bool reconfig_beacon;
  10166. - unsigned int rxfilter;
  10167. - unsigned long op_flags;
  10168. -+ unsigned long fw_flags;
  10169. -
  10170. - struct ath9k_hw_cal_data caldata;
  10171. - struct ath_spec_scan_priv spec_priv;
  10172. ---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  10173. -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  10174. -@@ -376,17 +376,139 @@ static void ath9k_regwrite_flush(void *h
  10175. - mutex_unlock(&priv->wmi->multi_write_mutex);
  10176. - }
  10177. -
  10178. --static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  10179. -+static void ath9k_reg_rmw_buffer(void *hw_priv,
  10180. -+ u32 reg_offset, u32 set, u32 clr)
  10181. -+{
  10182. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10183. -+ struct ath_common *common = ath9k_hw_common(ah);
  10184. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10185. -+ u32 rsp_status;
  10186. -+ int r;
  10187. -+
  10188. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  10189. -+
  10190. -+ /* Store the register/value */
  10191. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].reg =
  10192. -+ cpu_to_be32(reg_offset);
  10193. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].set =
  10194. -+ cpu_to_be32(set);
  10195. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].clr =
  10196. -+ cpu_to_be32(clr);
  10197. -+
  10198. -+ priv->wmi->multi_rmw_idx++;
  10199. -+
  10200. -+ /* If the buffer is full, send it out. */
  10201. -+ if (priv->wmi->multi_rmw_idx == MAX_RMW_CMD_NUMBER) {
  10202. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10203. -+ (u8 *) &priv->wmi->multi_rmw,
  10204. -+ sizeof(struct register_write) * priv->wmi->multi_rmw_idx,
  10205. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  10206. -+ 100);
  10207. -+ if (unlikely(r)) {
  10208. -+ ath_dbg(common, WMI,
  10209. -+ "REGISTER RMW FAILED, multi len: %d\n",
  10210. -+ priv->wmi->multi_rmw_idx);
  10211. -+ }
  10212. -+ priv->wmi->multi_rmw_idx = 0;
  10213. -+ }
  10214. -+
  10215. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  10216. -+}
  10217. -+
  10218. -+static void ath9k_reg_rmw_flush(void *hw_priv)
  10219. - {
  10220. -- u32 val;
  10221. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10222. -+ struct ath_common *common = ath9k_hw_common(ah);
  10223. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10224. -+ u32 rsp_status;
  10225. -+ int r;
  10226. -+
  10227. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  10228. -+ return;
  10229. -+
  10230. -+ atomic_dec(&priv->wmi->m_rmw_cnt);
  10231. -+
  10232. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  10233. -+
  10234. -+ if (priv->wmi->multi_rmw_idx) {
  10235. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10236. -+ (u8 *) &priv->wmi->multi_rmw,
  10237. -+ sizeof(struct register_rmw) * priv->wmi->multi_rmw_idx,
  10238. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  10239. -+ 100);
  10240. -+ if (unlikely(r)) {
  10241. -+ ath_dbg(common, WMI,
  10242. -+ "REGISTER RMW FAILED, multi len: %d\n",
  10243. -+ priv->wmi->multi_rmw_idx);
  10244. -+ }
  10245. -+ priv->wmi->multi_rmw_idx = 0;
  10246. -+ }
  10247. -
  10248. -- val = ath9k_regread(hw_priv, reg_offset);
  10249. -- val &= ~clr;
  10250. -- val |= set;
  10251. -- ath9k_regwrite(hw_priv, val, reg_offset);
  10252. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  10253. -+}
  10254. -+
  10255. -+static void ath9k_enable_rmw_buffer(void *hw_priv)
  10256. -+{
  10257. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10258. -+ struct ath_common *common = ath9k_hw_common(ah);
  10259. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10260. -+
  10261. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  10262. -+ return;
  10263. -+
  10264. -+ atomic_inc(&priv->wmi->m_rmw_cnt);
  10265. -+}
  10266. -+
  10267. -+static u32 ath9k_reg_rmw_single(void *hw_priv,
  10268. -+ u32 reg_offset, u32 set, u32 clr)
  10269. -+{
  10270. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10271. -+ struct ath_common *common = ath9k_hw_common(ah);
  10272. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10273. -+ struct register_rmw buf, buf_ret;
  10274. -+ int ret;
  10275. -+ u32 val = 0;
  10276. -+
  10277. -+ buf.reg = cpu_to_be32(reg_offset);
  10278. -+ buf.set = cpu_to_be32(set);
  10279. -+ buf.clr = cpu_to_be32(clr);
  10280. -+
  10281. -+ ret = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10282. -+ (u8 *) &buf, sizeof(buf),
  10283. -+ (u8 *) &buf_ret, sizeof(buf_ret),
  10284. -+ 100);
  10285. -+ if (unlikely(ret)) {
  10286. -+ ath_dbg(common, WMI, "REGISTER RMW FAILED:(0x%04x, %d)\n",
  10287. -+ reg_offset, ret);
  10288. -+ }
  10289. - return val;
  10290. - }
  10291. -
  10292. -+static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  10293. -+{
  10294. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10295. -+ struct ath_common *common = ath9k_hw_common(ah);
  10296. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10297. -+
  10298. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags)) {
  10299. -+ u32 val;
  10300. -+
  10301. -+ val = REG_READ(ah, reg_offset);
  10302. -+ val &= ~clr;
  10303. -+ val |= set;
  10304. -+ REG_WRITE(ah, reg_offset, val);
  10305. -+
  10306. -+ return 0;
  10307. -+ }
  10308. -+
  10309. -+ if (atomic_read(&priv->wmi->m_rmw_cnt))
  10310. -+ ath9k_reg_rmw_buffer(hw_priv, reg_offset, set, clr);
  10311. -+ else
  10312. -+ ath9k_reg_rmw_single(hw_priv, reg_offset, set, clr);
  10313. -+
  10314. -+ return 0;
  10315. -+}
  10316. -+
  10317. - static void ath_usb_read_cachesize(struct ath_common *common, int *csz)
  10318. - {
  10319. - *csz = L1_CACHE_BYTES >> 2;
  10320. -@@ -501,6 +623,8 @@ static int ath9k_init_priv(struct ath9k_
  10321. - ah->reg_ops.write = ath9k_regwrite;
  10322. - ah->reg_ops.enable_write_buffer = ath9k_enable_regwrite_buffer;
  10323. - ah->reg_ops.write_flush = ath9k_regwrite_flush;
  10324. -+ ah->reg_ops.enable_rmw_buffer = ath9k_enable_rmw_buffer;
  10325. -+ ah->reg_ops.rmw_flush = ath9k_reg_rmw_flush;
  10326. - ah->reg_ops.rmw = ath9k_reg_rmw;
  10327. - priv->ah = ah;
  10328. -
  10329. -@@ -686,6 +810,12 @@ static int ath9k_init_firmware_version(s
  10330. - return -EINVAL;
  10331. - }
  10332. -
  10333. -+ if (priv->fw_version_major == 1 && priv->fw_version_minor < 4)
  10334. -+ set_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags);
  10335. -+
  10336. -+ dev_info(priv->dev, "FW RMW support: %s\n",
  10337. -+ test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags) ? "Off" : "On");
  10338. -+
  10339. - return 0;
  10340. - }
  10341. -
  10342. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  10343. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  10344. -@@ -100,6 +100,18 @@
  10345. - (_ah)->reg_ops.write_flush((_ah)); \
  10346. - } while (0)
  10347. -
  10348. -+#define ENABLE_REG_RMW_BUFFER(_ah) \
  10349. -+ do { \
  10350. -+ if ((_ah)->reg_ops.enable_rmw_buffer) \
  10351. -+ (_ah)->reg_ops.enable_rmw_buffer((_ah)); \
  10352. -+ } while (0)
  10353. -+
  10354. -+#define REG_RMW_BUFFER_FLUSH(_ah) \
  10355. -+ do { \
  10356. -+ if ((_ah)->reg_ops.rmw_flush) \
  10357. -+ (_ah)->reg_ops.rmw_flush((_ah)); \
  10358. -+ } while (0)
  10359. -+
  10360. - #define PR_EEP(_s, _val) \
  10361. - do { \
  10362. - len += scnprintf(buf + len, size - len, "%20s : %10d\n",\
  10363. ---- a/drivers/net/wireless/ath/ath9k/wmi.c
  10364. -+++ b/drivers/net/wireless/ath/ath9k/wmi.c
  10365. -@@ -61,6 +61,8 @@ static const char *wmi_cmd_to_name(enum
  10366. - return "WMI_REG_READ_CMDID";
  10367. - case WMI_REG_WRITE_CMDID:
  10368. - return "WMI_REG_WRITE_CMDID";
  10369. -+ case WMI_REG_RMW_CMDID:
  10370. -+ return "WMI_REG_RMW_CMDID";
  10371. - case WMI_RC_STATE_CHANGE_CMDID:
  10372. - return "WMI_RC_STATE_CHANGE_CMDID";
  10373. - case WMI_RC_RATE_UPDATE_CMDID:
  10374. -@@ -101,6 +103,7 @@ struct wmi *ath9k_init_wmi(struct ath9k_
  10375. - spin_lock_init(&wmi->event_lock);
  10376. - mutex_init(&wmi->op_mutex);
  10377. - mutex_init(&wmi->multi_write_mutex);
  10378. -+ mutex_init(&wmi->multi_rmw_mutex);
  10379. - init_completion(&wmi->cmd_wait);
  10380. - INIT_LIST_HEAD(&wmi->pending_tx_events);
  10381. - tasklet_init(&wmi->wmi_event_tasklet, ath9k_wmi_event_tasklet,
  10382. ---- a/drivers/net/wireless/ath/ath9k/wmi.h
  10383. -+++ b/drivers/net/wireless/ath/ath9k/wmi.h
  10384. -@@ -112,6 +112,7 @@ enum wmi_cmd_id {
  10385. - WMI_TX_STATS_CMDID,
  10386. - WMI_RX_STATS_CMDID,
  10387. - WMI_BITRATE_MASK_CMDID,
  10388. -+ WMI_REG_RMW_CMDID,
  10389. - };
  10390. -
  10391. - enum wmi_event_id {
  10392. -@@ -125,12 +126,19 @@ enum wmi_event_id {
  10393. - };
  10394. -
  10395. - #define MAX_CMD_NUMBER 62
  10396. -+#define MAX_RMW_CMD_NUMBER 15
  10397. -
  10398. - struct register_write {
  10399. - __be32 reg;
  10400. - __be32 val;
  10401. - };
  10402. -
  10403. -+struct register_rmw {
  10404. -+ __be32 reg;
  10405. -+ __be32 set;
  10406. -+ __be32 clr;
  10407. -+} __packed;
  10408. -+
  10409. - struct ath9k_htc_tx_event {
  10410. - int count;
  10411. - struct __wmi_event_txstatus txs;
  10412. -@@ -156,10 +164,18 @@ struct wmi {
  10413. -
  10414. - spinlock_t wmi_lock;
  10415. -
  10416. -+ /* multi write section */
  10417. - atomic_t mwrite_cnt;
  10418. - struct register_write multi_write[MAX_CMD_NUMBER];
  10419. - u32 multi_write_idx;
  10420. - struct mutex multi_write_mutex;
  10421. -+
  10422. -+ /* multi rmw section */
  10423. -+ atomic_t m_rmw_cnt;
  10424. -+ struct register_rmw multi_rmw[MAX_RMW_CMD_NUMBER];
  10425. -+ u32 multi_rmw_idx;
  10426. -+ struct mutex multi_rmw_mutex;
  10427. -+
  10428. - };
  10429. -
  10430. - struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv);
  10431. 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
  10432. new file mode 100644
  10433. index 0000000..97444b3
  10434. --- /dev/null
  10435. +++ b/package/kernel/mac80211/patches/319-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  10436. @@ -0,0 +1,138 @@
  10437. +From: Arend van Spriel <arend@broadcom.com>
  10438. +Date: Wed, 26 Aug 2015 22:14:53 +0200
  10439. +Subject: [PATCH] brcmfmac: consolidate ifp lookup in driver core
  10440. +
  10441. +In rx path the firmware provide an interface index which is used to
  10442. +map to a struct brcmf_if instance. However, this involves some trick
  10443. +that is done in two places. This is changed by having driver core
  10444. +providing brcmf_get_ifp() function.
  10445. +
  10446. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10447. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10448. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10449. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10450. +---
  10451. +
  10452. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10453. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10454. +@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10455. + struct sk_buff *pktbuf)
  10456. + {
  10457. + struct brcmf_proto_bcdc_header *h;
  10458. ++ struct brcmf_if *ifp;
  10459. +
  10460. + brcmf_dbg(BCDC, "Enter\n");
  10461. +
  10462. +@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10463. + trace_brcmf_bcdchdr(pktbuf->data);
  10464. + h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  10465. +
  10466. +- *ifidx = BCDC_GET_IF_IDX(h);
  10467. +- if (*ifidx >= BRCMF_MAX_IFS) {
  10468. +- brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
  10469. ++ ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  10470. ++ if (IS_ERR_OR_NULL(ifp)) {
  10471. ++ brcmf_dbg(INFO, "no matching ifp found\n");
  10472. + return -EBADE;
  10473. + }
  10474. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10475. +- * events this is easy because it contains the bssidx which maps
  10476. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  10477. +- * bssidx 1 is used for p2p0 and no data can be received or
  10478. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  10479. +- */
  10480. +- if (*ifidx)
  10481. +- (*ifidx)++;
  10482. +-
  10483. + if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  10484. + BCDC_PROTO_VER) {
  10485. + brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  10486. +- brcmf_ifname(drvr, *ifidx), h->flags);
  10487. ++ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10488. + return -EBADE;
  10489. + }
  10490. +
  10491. + if (h->flags & BCDC_FLAG_SUM_GOOD) {
  10492. + brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  10493. +- brcmf_ifname(drvr, *ifidx), h->flags);
  10494. ++ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10495. + pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  10496. + }
  10497. +
  10498. +@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10499. +
  10500. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  10501. + if (do_fws)
  10502. +- brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf);
  10503. ++ brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  10504. ++ pktbuf);
  10505. + else
  10506. + skb_pull(pktbuf, h->data_offset << 2);
  10507. +
  10508. + if (pktbuf->len == 0)
  10509. + return -ENODATA;
  10510. ++
  10511. ++ *ifidx = ifp->ifidx;
  10512. + return 0;
  10513. + }
  10514. +
  10515. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10516. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10517. +@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drv
  10518. + return "<if_none>";
  10519. + }
  10520. +
  10521. ++struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  10522. ++{
  10523. ++ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  10524. ++ brcmf_err("ifidx %d out of range\n", ifidx);
  10525. ++ return ERR_PTR(-ERANGE);
  10526. ++ }
  10527. ++
  10528. ++ /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10529. ++ * events this is easy because it contains the bssidx which maps
  10530. ++ * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  10531. ++ * bssidx 1 is used for p2p0 and no data can be received or
  10532. ++ * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  10533. ++ */
  10534. ++ if (ifidx)
  10535. ++ ifidx++;
  10536. ++
  10537. ++ return drvr->iflist[ifidx];
  10538. ++}
  10539. ++
  10540. + static void _brcmf_set_multicast_list(struct work_struct *work)
  10541. + {
  10542. + struct brcmf_if *ifp;
  10543. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  10544. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  10545. +@@ -202,7 +202,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  10546. +
  10547. + /* Return pointer to interface name */
  10548. + char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  10549. +-
  10550. ++struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  10551. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  10552. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  10553. + char *name, u8 *mac_addr);
  10554. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10555. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10556. +@@ -1081,16 +1081,8 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  10557. + {
  10558. + struct brcmf_if *ifp;
  10559. +
  10560. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10561. +- * events this is easy because it contains the bssidx which maps
  10562. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  10563. +- * bssidx 1 is used for p2p0 and no data can be received or
  10564. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  10565. +- */
  10566. +- if (ifidx)
  10567. +- (ifidx)++;
  10568. +- ifp = msgbuf->drvr->iflist[ifidx];
  10569. +- if (!ifp || !ifp->ndev) {
  10570. ++ ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  10571. ++ if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  10572. + brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  10573. + brcmu_pkt_buf_free_skb(skb);
  10574. + return;
  10575. 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
  10576. deleted file mode 100644
  10577. index c4dd1af..0000000
  10578. --- a/package/kernel/mac80211/patches/320-ath9k-ar9271_hw_pa_cal-use-defs-instead-of-magin-num.patch
  10579. +++ /dev/null
  10580. @@ -1,89 +0,0 @@
  10581. -From: Oleksij Rempel <linux@rempel-privat.de>
  10582. -Date: Sun, 22 Mar 2015 19:29:47 +0100
  10583. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal - use defs instead of magin
  10584. - numbers
  10585. -
  10586. -This function uses mixed styles for register names/numbers which
  10587. -is make harder reading and optimisation.
  10588. -
  10589. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  10590. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10591. ----
  10592. -
  10593. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  10594. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  10595. -@@ -430,22 +430,22 @@ static void ar9271_hw_pa_cal(struct ath_
  10596. - u32 regVal;
  10597. - unsigned int i;
  10598. - u32 regList[][2] = {
  10599. -- { 0x786c, 0 },
  10600. -- { 0x7854, 0 },
  10601. -- { 0x7820, 0 },
  10602. -- { 0x7824, 0 },
  10603. -- { 0x7868, 0 },
  10604. -- { 0x783c, 0 },
  10605. -- { 0x7838, 0 } ,
  10606. -- { 0x7828, 0 } ,
  10607. -+ { AR9285_AN_TOP3, 0 },
  10608. -+ { AR9285_AN_RXTXBB1, 0 },
  10609. -+ { AR9285_AN_RF2G1, 0 },
  10610. -+ { AR9285_AN_RF2G2, 0 },
  10611. -+ { AR9285_AN_TOP2, 0 },
  10612. -+ { AR9285_AN_RF2G8, 0 },
  10613. -+ { AR9285_AN_RF2G7, 0 } ,
  10614. -+ { AR9285_AN_RF2G3, 0 } ,
  10615. - };
  10616. -
  10617. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  10618. - regList[i][1] = REG_READ(ah, regList[i][0]);
  10619. -
  10620. -- regVal = REG_READ(ah, 0x7834);
  10621. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  10622. - regVal &= (~(0x1));
  10623. -- REG_WRITE(ah, 0x7834, regVal);
  10624. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10625. - regVal = REG_READ(ah, 0x9808);
  10626. - regVal |= (0x1 << 27);
  10627. - REG_WRITE(ah, 0x9808, regVal);
  10628. -@@ -477,7 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  10629. - * does not matter since we turn it off
  10630. - */
  10631. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  10632. --
  10633. -+ /* 7828, b0-11, ccom=fff */
  10634. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  10635. -
  10636. - /* Set:
  10637. -@@ -490,15 +490,16 @@ static void ar9271_hw_pa_cal(struct ath_
  10638. -
  10639. - /* find off_6_1; */
  10640. - for (i = 6; i > 0; i--) {
  10641. -- regVal = REG_READ(ah, 0x7834);
  10642. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  10643. - regVal |= (1 << (20 + i));
  10644. -- REG_WRITE(ah, 0x7834, regVal);
  10645. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10646. - udelay(1);
  10647. - /* regVal = REG_READ(ah, 0x7834); */
  10648. - regVal &= (~(0x1 << (20 + i)));
  10649. -- regVal |= (MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9)
  10650. -+ regVal |= (MS(REG_READ(ah, AR9285_AN_RF2G9),
  10651. -+ AR9285_AN_RXTXBB1_SPARE9)
  10652. - << (20 + i));
  10653. -- REG_WRITE(ah, 0x7834, regVal);
  10654. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10655. - }
  10656. -
  10657. - regVal = (regVal >> 20) & 0x7f;
  10658. -@@ -517,9 +518,9 @@ static void ar9271_hw_pa_cal(struct ath_
  10659. -
  10660. - ENABLE_REGWRITE_BUFFER(ah);
  10661. -
  10662. -- regVal = REG_READ(ah, 0x7834);
  10663. -+ regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  10664. - regVal |= 0x1;
  10665. -- REG_WRITE(ah, 0x7834, regVal);
  10666. -+ REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  10667. - regVal = REG_READ(ah, 0x9808);
  10668. - regVal &= (~(0x1 << 27));
  10669. - REG_WRITE(ah, 0x9808, regVal);
  10670. 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
  10671. new file mode 100644
  10672. index 0000000..632714c
  10673. --- /dev/null
  10674. +++ b/package/kernel/mac80211/patches/320-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  10675. @@ -0,0 +1,222 @@
  10676. +From: Arend van Spriel <arend@broadcom.com>
  10677. +Date: Wed, 26 Aug 2015 22:14:54 +0200
  10678. +Subject: [PATCH] brcmfmac: make brcmf_proto_hdrpull() return struct
  10679. + brcmf_if instance
  10680. +
  10681. +Avoid spreading the ifidx in the driver, but have it return the
  10682. +struct brcmf_if instance.
  10683. +
  10684. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10685. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10686. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10687. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10688. +---
  10689. +
  10690. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10691. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10692. +@@ -272,11 +272,11 @@ brcmf_proto_bcdc_hdrpush(struct brcmf_pu
  10693. + }
  10694. +
  10695. + static int
  10696. +-brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  10697. +- struct sk_buff *pktbuf)
  10698. ++brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  10699. ++ struct sk_buff *pktbuf, struct brcmf_if **ifp)
  10700. + {
  10701. + struct brcmf_proto_bcdc_header *h;
  10702. +- struct brcmf_if *ifp;
  10703. ++ struct brcmf_if *tmp_if;
  10704. +
  10705. + brcmf_dbg(BCDC, "Enter\n");
  10706. +
  10707. +@@ -290,21 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10708. + trace_brcmf_bcdchdr(pktbuf->data);
  10709. + h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  10710. +
  10711. +- ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  10712. +- if (IS_ERR_OR_NULL(ifp)) {
  10713. ++ tmp_if = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  10714. ++ if (!tmp_if) {
  10715. + brcmf_dbg(INFO, "no matching ifp found\n");
  10716. + return -EBADE;
  10717. + }
  10718. + if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  10719. + BCDC_PROTO_VER) {
  10720. + brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  10721. +- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10722. ++ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  10723. + return -EBADE;
  10724. + }
  10725. +
  10726. + if (h->flags & BCDC_FLAG_SUM_GOOD) {
  10727. + brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  10728. +- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10729. ++ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  10730. + pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  10731. + }
  10732. +
  10733. +@@ -312,7 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10734. +
  10735. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  10736. + if (do_fws)
  10737. +- brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  10738. ++ brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  10739. + pktbuf);
  10740. + else
  10741. + skb_pull(pktbuf, h->data_offset << 2);
  10742. +@@ -320,7 +320,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10743. + if (pktbuf->len == 0)
  10744. + return -ENODATA;
  10745. +
  10746. +- *ifidx = ifp->ifidx;
  10747. ++ *ifp = tmp_if;
  10748. + return 0;
  10749. + }
  10750. +
  10751. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10752. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10753. +@@ -87,7 +87,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  10754. + {
  10755. + if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  10756. + brcmf_err("ifidx %d out of range\n", ifidx);
  10757. +- return ERR_PTR(-ERANGE);
  10758. ++ return NULL;
  10759. + }
  10760. +
  10761. + /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10762. +@@ -539,17 +539,15 @@ void brcmf_rx_frame(struct device *dev,
  10763. + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  10764. + struct brcmf_pub *drvr = bus_if->drvr;
  10765. + struct brcmf_skb_reorder_data *rd;
  10766. +- u8 ifidx;
  10767. + int ret;
  10768. +
  10769. + brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  10770. +
  10771. + /* process and remove protocol-specific header */
  10772. +- ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb);
  10773. +- ifp = drvr->iflist[ifidx];
  10774. ++ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  10775. +
  10776. + if (ret || !ifp || !ifp->ndev) {
  10777. +- if ((ret != -ENODATA) && ifp)
  10778. ++ if (ret != -ENODATA && ifp)
  10779. + ifp->stats.rx_errors++;
  10780. + brcmu_pkt_buf_free_skb(skb);
  10781. + return;
  10782. +@@ -592,17 +590,17 @@ void brcmf_txcomplete(struct device *dev
  10783. + {
  10784. + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  10785. + struct brcmf_pub *drvr = bus_if->drvr;
  10786. +- u8 ifidx;
  10787. ++ struct brcmf_if *ifp;
  10788. +
  10789. + /* await txstatus signal for firmware if active */
  10790. + if (brcmf_fws_fc_active(drvr->fws)) {
  10791. + if (!success)
  10792. + brcmf_fws_bustxfail(drvr->fws, txp);
  10793. + } else {
  10794. +- if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp))
  10795. ++ if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  10796. + brcmu_pkt_buf_free_skb(txp);
  10797. + else
  10798. +- brcmf_txfinalize(drvr, txp, ifidx, success);
  10799. ++ brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  10800. + }
  10801. + }
  10802. +
  10803. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  10804. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  10805. +@@ -1448,7 +1448,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  10806. + struct sk_buff *skb;
  10807. + struct brcmf_skbuff_cb *skcb;
  10808. + struct brcmf_fws_mac_descriptor *entry = NULL;
  10809. +- u8 ifidx;
  10810. ++ struct brcmf_if *ifp;
  10811. +
  10812. + brcmf_dbg(DATA, "flags %d\n", flags);
  10813. +
  10814. +@@ -1497,15 +1497,16 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  10815. + }
  10816. + brcmf_fws_macdesc_return_req_credit(skb);
  10817. +
  10818. +- if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) {
  10819. ++ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp);
  10820. ++ if (ret) {
  10821. + brcmu_pkt_buf_free_skb(skb);
  10822. + return -EINVAL;
  10823. + }
  10824. + if (!remove_from_hanger)
  10825. +- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx,
  10826. ++ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  10827. + genbit, seq);
  10828. + if (remove_from_hanger || ret)
  10829. +- brcmf_txfinalize(fws->drvr, skb, ifidx, true);
  10830. ++ brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  10831. +
  10832. + return 0;
  10833. + }
  10834. +@@ -1848,7 +1849,7 @@ static int brcmf_fws_commit_skb(struct b
  10835. + entry->transit_count--;
  10836. + if (entry->suppressed)
  10837. + entry->suppr_transit_count--;
  10838. +- brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
  10839. ++ (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
  10840. + goto rollback;
  10841. + }
  10842. +
  10843. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10844. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10845. +@@ -522,7 +522,7 @@ static int brcmf_msgbuf_set_dcmd(struct
  10846. +
  10847. +
  10848. + static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  10849. +- u8 *ifidx, struct sk_buff *skb)
  10850. ++ struct sk_buff *skb, struct brcmf_if **ifp)
  10851. + {
  10852. + return -ENODEV;
  10853. + }
  10854. +@@ -1082,7 +1082,7 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  10855. + struct brcmf_if *ifp;
  10856. +
  10857. + ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  10858. +- if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  10859. ++ if (!ifp || !ifp->ndev) {
  10860. + brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  10861. + brcmu_pkt_buf_free_skb(skb);
  10862. + return;
  10863. +--- a/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  10864. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  10865. +@@ -24,8 +24,8 @@ enum proto_addr_mode {
  10866. +
  10867. +
  10868. + struct brcmf_proto {
  10869. +- int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  10870. +- struct sk_buff *skb);
  10871. ++ int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  10872. ++ struct sk_buff *skb, struct brcmf_if **ifp);
  10873. + int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
  10874. + void *buf, uint len);
  10875. + int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
  10876. +@@ -46,9 +46,19 @@ int brcmf_proto_attach(struct brcmf_pub
  10877. + void brcmf_proto_detach(struct brcmf_pub *drvr);
  10878. +
  10879. + static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  10880. +- u8 *ifidx, struct sk_buff *skb)
  10881. ++ struct sk_buff *skb,
  10882. ++ struct brcmf_if **ifp)
  10883. + {
  10884. +- return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
  10885. ++ struct brcmf_if *tmp = NULL;
  10886. ++
  10887. ++ /* assure protocol is always called with
  10888. ++ * non-null initialized pointer.
  10889. ++ */
  10890. ++ if (ifp)
  10891. ++ *ifp = NULL;
  10892. ++ else
  10893. ++ ifp = &tmp;
  10894. ++ return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
  10895. + }
  10896. + static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  10897. + uint cmd, void *buf, uint len)
  10898. 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
  10899. deleted file mode 100644
  10900. index f05287d..0000000
  10901. --- a/package/kernel/mac80211/patches/321-ath9k-ar9271_hw_pa_cal-use-proper-makroses.patch
  10902. +++ /dev/null
  10903. @@ -1,79 +0,0 @@
  10904. -From: Oleksij Rempel <linux@rempel-privat.de>
  10905. -Date: Sun, 22 Mar 2015 19:29:48 +0100
  10906. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use proper makroses.
  10907. -
  10908. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  10909. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10910. ----
  10911. -
  10912. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  10913. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  10914. -@@ -443,33 +443,30 @@ static void ar9271_hw_pa_cal(struct ath_
  10915. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  10916. - regList[i][1] = REG_READ(ah, regList[i][0]);
  10917. -
  10918. -- regVal = REG_READ(ah, AR9285_AN_RF2G6);
  10919. -- regVal &= (~(0x1));
  10920. -- REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10921. -- regVal = REG_READ(ah, 0x9808);
  10922. -- regVal |= (0x1 << 27);
  10923. -- REG_WRITE(ah, 0x9808, regVal);
  10924. --
  10925. -+ /* 7834, b1=0 */
  10926. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  10927. -+ /* 9808, b27=1 */
  10928. -+ REG_SET_BIT(ah, 0x9808, 1 << 27);
  10929. - /* 786c,b23,1, pwddac=1 */
  10930. -- REG_RMW_FIELD(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC, 1);
  10931. -+ REG_SET_BIT(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC);
  10932. - /* 7854, b5,1, pdrxtxbb=1 */
  10933. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1, 1);
  10934. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1);
  10935. - /* 7854, b7,1, pdv2i=1 */
  10936. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I, 1);
  10937. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I);
  10938. - /* 7854, b8,1, pddacinterface=1 */
  10939. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF, 1);
  10940. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF);
  10941. - /* 7824,b12,0, offcal=0 */
  10942. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL, 0);
  10943. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL);
  10944. - /* 7838, b1,0, pwddb=0 */
  10945. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB, 0);
  10946. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB);
  10947. - /* 7820,b11,0, enpacal=0 */
  10948. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL, 0);
  10949. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL);
  10950. - /* 7820,b25,1, pdpadrv1=0 */
  10951. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1, 0);
  10952. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1);
  10953. - /* 7820,b24,0, pdpadrv2=0 */
  10954. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2, 0);
  10955. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2);
  10956. - /* 7820,b23,0, pdpaout=0 */
  10957. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT, 0);
  10958. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT);
  10959. - /* 783c,b14-16,7, padrvgn2tab_0=7 */
  10960. - REG_RMW_FIELD(ah, AR9285_AN_RF2G8, AR9285_AN_RF2G8_PADRVGN2TAB0, 7);
  10961. - /*
  10962. -@@ -516,15 +513,13 @@ static void ar9271_hw_pa_cal(struct ath_
  10963. - ah->pacal_info.prev_offset = regVal;
  10964. - }
  10965. -
  10966. -- ENABLE_REGWRITE_BUFFER(ah);
  10967. -
  10968. -- regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  10969. -- regVal |= 0x1;
  10970. -- REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  10971. -- regVal = REG_READ(ah, 0x9808);
  10972. -- regVal &= (~(0x1 << 27));
  10973. -- REG_WRITE(ah, 0x9808, regVal);
  10974. -+ /* 7834, b1=1 */
  10975. -+ REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  10976. -+ /* 9808, b27=0 */
  10977. -+ REG_CLR_BIT(ah, 0x9808, 1 << 27);
  10978. -
  10979. -+ ENABLE_REGWRITE_BUFFER(ah);
  10980. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  10981. - REG_WRITE(ah, regList[i][0], regList[i][1]);
  10982. -
  10983. 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
  10984. new file mode 100644
  10985. index 0000000..3360cbc
  10986. --- /dev/null
  10987. +++ b/package/kernel/mac80211/patches/321-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  10988. @@ -0,0 +1,87 @@
  10989. +From: Arend van Spriel <arend@broadcom.com>
  10990. +Date: Wed, 26 Aug 2015 22:14:55 +0200
  10991. +Subject: [PATCH] brcmfmac: change parameters for
  10992. + brcmf_remove_interface()
  10993. +
  10994. +Just pass the interface to be removed, ie. the struct brcmf_if instance.
  10995. +
  10996. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10997. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10998. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10999. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11000. +---
  11001. +
  11002. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11003. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11004. +@@ -4983,7 +4983,7 @@ brcmf_notify_connect_status_ap(struct br
  11005. + brcmf_dbg(CONN, "AP mode link down\n");
  11006. + complete(&cfg->vif_disabled);
  11007. + if (ifp->vif->mbss)
  11008. +- brcmf_remove_interface(ifp->drvr, ifp->bssidx);
  11009. ++ brcmf_remove_interface(ifp);
  11010. + return 0;
  11011. + }
  11012. +
  11013. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11014. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11015. +@@ -887,12 +887,13 @@ static void brcmf_del_if(struct brcmf_pu
  11016. + }
  11017. + }
  11018. +
  11019. +-void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx)
  11020. ++void brcmf_remove_interface(struct brcmf_if *ifp)
  11021. + {
  11022. +- if (drvr->iflist[bssidx]) {
  11023. +- brcmf_fws_del_interface(drvr->iflist[bssidx]);
  11024. +- brcmf_del_if(drvr, bssidx);
  11025. +- }
  11026. ++ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  11027. ++ return;
  11028. ++
  11029. ++ brcmf_fws_del_interface(ifp);
  11030. ++ brcmf_del_if(ifp->drvr, ifp->bssidx);
  11031. + }
  11032. +
  11033. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  11034. +@@ -1122,7 +1123,7 @@ void brcmf_detach(struct device *dev)
  11035. +
  11036. + /* make sure primary interface removed last */
  11037. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  11038. +- brcmf_remove_interface(drvr, i);
  11039. ++ brcmf_remove_interface(drvr->iflist[i]);
  11040. +
  11041. + brcmf_cfg80211_detach(drvr->config);
  11042. +
  11043. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11044. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11045. +@@ -206,7 +206,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  11046. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  11047. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  11048. + char *name, u8 *mac_addr);
  11049. +-void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx);
  11050. ++void brcmf_remove_interface(struct brcmf_if *ifp);
  11051. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  11052. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  11053. + enum brcmf_netif_stop_reason reason, bool state);
  11054. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11055. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11056. +@@ -222,7 +222,7 @@ static void brcmf_fweh_handle_if_event(s
  11057. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  11058. +
  11059. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  11060. +- brcmf_remove_interface(drvr, ifevent->bssidx);
  11061. ++ brcmf_remove_interface(ifp);
  11062. + }
  11063. +
  11064. + /**
  11065. +--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  11066. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  11067. +@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  11068. + {
  11069. + cfg80211_unregister_wdev(&vif->wdev);
  11070. + p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  11071. +- brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  11072. ++ brcmf_remove_interface(vif->ifp);
  11073. + brcmf_free_vif(vif);
  11074. + }
  11075. +
  11076. 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
  11077. deleted file mode 100644
  11078. index 7247369..0000000
  11079. --- a/package/kernel/mac80211/patches/322-ath9k-ar9271_hw_pa_cal-use-RMW-buffer.patch
  11080. +++ /dev/null
  11081. @@ -1,48 +0,0 @@
  11082. -From: Oleksij Rempel <linux@rempel-privat.de>
  11083. -Date: Sun, 22 Mar 2015 19:29:49 +0100
  11084. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use RMW buffer
  11085. -
  11086. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11087. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11088. ----
  11089. -
  11090. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11091. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11092. -@@ -436,13 +436,14 @@ static void ar9271_hw_pa_cal(struct ath_
  11093. - { AR9285_AN_RF2G2, 0 },
  11094. - { AR9285_AN_TOP2, 0 },
  11095. - { AR9285_AN_RF2G8, 0 },
  11096. -- { AR9285_AN_RF2G7, 0 } ,
  11097. -- { AR9285_AN_RF2G3, 0 } ,
  11098. -+ { AR9285_AN_RF2G7, 0 },
  11099. -+ { AR9285_AN_RF2G3, 0 },
  11100. - };
  11101. -
  11102. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11103. - regList[i][1] = REG_READ(ah, regList[i][0]);
  11104. -
  11105. -+ ENABLE_REG_RMW_BUFFER(ah);
  11106. - /* 7834, b1=0 */
  11107. - REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11108. - /* 9808, b27=1 */
  11109. -@@ -476,6 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  11110. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  11111. - /* 7828, b0-11, ccom=fff */
  11112. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  11113. -+ REG_RMW_BUFFER_FLUSH(ah);
  11114. -
  11115. - /* Set:
  11116. - * localmode=1,bmode=1,bmoderxtx=1,synthon=1,
  11117. -@@ -514,10 +516,12 @@ static void ar9271_hw_pa_cal(struct ath_
  11118. - }
  11119. -
  11120. -
  11121. -+ ENABLE_REG_RMW_BUFFER(ah);
  11122. - /* 7834, b1=1 */
  11123. - REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11124. - /* 9808, b27=0 */
  11125. - REG_CLR_BIT(ah, 0x9808, 1 << 27);
  11126. -+ REG_RMW_BUFFER_FLUSH(ah);
  11127. -
  11128. - ENABLE_REGWRITE_BUFFER(ah);
  11129. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11130. 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
  11131. new file mode 100644
  11132. index 0000000..2b61f4e
  11133. --- /dev/null
  11134. +++ b/package/kernel/mac80211/patches/322-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  11135. @@ -0,0 +1,92 @@
  11136. +From: Arend van Spriel <arend@broadcom.com>
  11137. +Date: Wed, 26 Aug 2015 22:14:56 +0200
  11138. +Subject: [PATCH] brcmfmac: only call brcmf_cfg80211_detach() when attach
  11139. + was successful
  11140. +
  11141. +In brcmf_bus_start() the function brcmf_cfg80211_attach() is called which
  11142. +may fail. If this happens we should not call brcmf_cfg80211_detach() in
  11143. +the failure path as it will result in NULL pointer dereference:
  11144. +
  11145. + brcmf_fweh_activate_events: Set event_msgs error (-5)
  11146. + brcmf_bus_start: failed: -5
  11147. + brcmf_sdio_firmware_callback: dongle is not responding
  11148. + BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
  11149. + IP: [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  11150. + PGD 0
  11151. + Oops: 0000 [#1] SMP
  11152. + Modules linked in: brcmfmac(O) brcmutil(O) cfg80211 auth_rpcgss
  11153. + CPU: 1 PID: 45 Comm: kworker/1:1 Tainted: G O
  11154. + Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  11155. + Workqueue: events request_firmware_work_func
  11156. + task: ffff880036c09ac0 ti: ffff880036dd4000 task.ti: ffff880036dd4000
  11157. + RIP: 0010:[<ffffffff811e8f08>] [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  11158. + RSP: 0018:ffff880036dd7a28 EFLAGS: 00010246
  11159. + RAX: ffff880036c09ac0 RBX: 0000000000000000 RCX: 000000007fffffff
  11160. + RDX: 0000000000000000 RSI: ffffffff816578b9 RDI: 0000000000000000
  11161. + RBP: ffff880036dd7a48 R08: 0000000000000000 R09: ffff880036c0b340
  11162. + R10: 00000000000002ec R11: ffff880036dd7b08 R12: ffffffff816578b9
  11163. + R13: 0000000000000000 R14: ffffffff816578b9 R15: ffff8800c6c87000
  11164. + FS: 0000000000000000(0000) GS:ffff88012bc40000(0000) knlGS:0000000000000000
  11165. + CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  11166. + CR2: 0000000000000068 CR3: 0000000001a0b000 CR4: 00000000000006e0
  11167. + Stack:
  11168. + 0000000000000000 ffffffff816578b9 0000000000000000 ffff8800c0d003c8
  11169. + ffff880036dd7a78 ffffffff811e8ff5 0000000ffffffff1 ffffffff81a9b060
  11170. + ffff8800c789f880 ffff8800c0d00000 ffff880036dd7a98 ffffffff811ebe0d
  11171. + Call Trace:
  11172. + [<ffffffff811e8ff5>] kernfs_find_and_get_ns+0x35/0x60
  11173. + [<ffffffff811ebe0d>] sysfs_unmerge_group+0x1d/0x60
  11174. + [<ffffffff81404ef2>] dpm_sysfs_remove+0x22/0x60
  11175. + [<ffffffff813f9db9>] device_del+0x49/0x240
  11176. + [<ffffffff815da768>] rfkill_unregister+0x58/0xc0
  11177. + [<ffffffffa06bd91b>] wiphy_unregister+0xab/0x2f0 [cfg80211]
  11178. + [<ffffffffa0742fe3>] brcmf_cfg80211_detach+0x23/0x50 [brcmfmac]
  11179. + [<ffffffffa074d986>] brcmf_detach+0x86/0xe0 [brcmfmac]
  11180. + [<ffffffffa0757de8>] brcmf_sdio_remove+0x48/0x120 [brcmfmac]
  11181. + [<ffffffffa0758ed9>] brcmf_sdiod_remove+0x29/0xd0 [brcmfmac]
  11182. + [<ffffffffa0759031>] brcmf_ops_sdio_remove+0xb1/0x110 [brcmfmac]
  11183. + [<ffffffffa001c267>] sdio_bus_remove+0x37/0x100 [mmc_core]
  11184. + [<ffffffff813fe026>] __device_release_driver+0x96/0x130
  11185. + [<ffffffff813fe0e3>] device_release_driver+0x23/0x30
  11186. + [<ffffffffa0754bc8>] brcmf_sdio_firmware_callback+0x2a8/0x5d0 [brcmfmac]
  11187. + [<ffffffffa074deaf>] brcmf_fw_request_nvram_done+0x15f/0x5e0 [brcmfmac]
  11188. + [<ffffffff8140142f>] ? devres_add+0x3f/0x50
  11189. + [<ffffffff810642b5>] ? usermodehelper_read_unlock+0x15/0x20
  11190. + [<ffffffff81400000>] ? platform_match+0x70/0xa0
  11191. + [<ffffffff8140f400>] request_firmware_work_func+0x30/0x60
  11192. + [<ffffffff8106828c>] process_one_work+0x14c/0x3d0
  11193. + [<ffffffff8106862a>] worker_thread+0x11a/0x450
  11194. + [<ffffffff81068510>] ? process_one_work+0x3d0/0x3d0
  11195. + [<ffffffff8106d692>] kthread+0xd2/0xf0
  11196. + [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  11197. + [<ffffffff815ed35f>] ret_from_fork+0x3f/0x70
  11198. + [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  11199. + Code: e9 40 fe ff ff 48 89 d8 eb 87 66 0f 1f 84 00 00 00 00 00 66 66 66 66
  11200. + 90 55 48 89 e5 41 56 49 89 f6 41 55 49 89 d5 31 d2 41 54 53 <0f> b7
  11201. + 47 68 48 8b 5f 48 66 c1 e8 05 83 e0 01 4d 85 ed 0f b6 c8
  11202. + RIP [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  11203. + RSP <ffff880036dd7a28>
  11204. + CR2: 0000000000000068
  11205. + ---[ end trace 87d6ec0d3fe46740 ]---
  11206. +
  11207. +Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  11208. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11209. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11210. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11211. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11212. +---
  11213. +
  11214. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11215. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11216. +@@ -1049,7 +1049,10 @@ int brcmf_bus_start(struct device *dev)
  11217. + fail:
  11218. + if (ret < 0) {
  11219. + brcmf_err("failed: %d\n", ret);
  11220. +- brcmf_cfg80211_detach(drvr->config);
  11221. ++ if (drvr->config) {
  11222. ++ brcmf_cfg80211_detach(drvr->config);
  11223. ++ drvr->config = NULL;
  11224. ++ }
  11225. + if (drvr->fws) {
  11226. + brcmf_fws_del_interface(ifp);
  11227. + brcmf_fws_deinit(drvr);
  11228. 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
  11229. deleted file mode 100644
  11230. index 246bb9d..0000000
  11231. --- a/package/kernel/mac80211/patches/323-ath9k-add-multi_read-to-be-compatible-with-ath9k_htc.patch
  11232. +++ /dev/null
  11233. @@ -1,35 +0,0 @@
  11234. -From: Oleksij Rempel <linux@rempel-privat.de>
  11235. -Date: Sun, 22 Mar 2015 19:29:50 +0100
  11236. -Subject: [PATCH] ath9k: add multi_read to be compatible with ath9k_htc
  11237. -
  11238. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11239. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11240. ----
  11241. -
  11242. ---- a/drivers/net/wireless/ath/ath9k/init.c
  11243. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  11244. -@@ -141,6 +141,16 @@ static unsigned int ath9k_ioread32(void
  11245. - return val;
  11246. - }
  11247. -
  11248. -+static void ath9k_multi_ioread32(void *hw_priv, u32 *addr,
  11249. -+ u32 *val, u16 count)
  11250. -+{
  11251. -+ int i;
  11252. -+
  11253. -+ for (i = 0; i < count; i++)
  11254. -+ val[i] = ath9k_ioread32(hw_priv, addr[i]);
  11255. -+}
  11256. -+
  11257. -+
  11258. - static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset,
  11259. - u32 set, u32 clr)
  11260. - {
  11261. -@@ -530,6 +540,7 @@ static int ath9k_init_softc(u16 devid, s
  11262. - ah->hw = sc->hw;
  11263. - ah->hw_version.devid = devid;
  11264. - ah->reg_ops.read = ath9k_ioread32;
  11265. -+ ah->reg_ops.multi_read = ath9k_multi_ioread32;
  11266. - ah->reg_ops.write = ath9k_iowrite32;
  11267. - ah->reg_ops.rmw = ath9k_reg_rmw;
  11268. - pCap = &ah->caps;
  11269. 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
  11270. new file mode 100644
  11271. index 0000000..868b0a8
  11272. --- /dev/null
  11273. +++ b/package/kernel/mac80211/patches/323-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  11274. @@ -0,0 +1,105 @@
  11275. +From: Arend van Spriel <arend@broadcom.com>
  11276. +Date: Wed, 26 Aug 2015 22:14:57 +0200
  11277. +Subject: [PATCH] brcmfmac: correct detection of p2pdev interface event
  11278. +
  11279. +The p2pdev interface is setup in firmware resulting in a interface
  11280. +event. This event has role and no-if flag. When role is p2p client
  11281. +and no-if flag is set it indicates that this is the p2pdev interface.
  11282. +This info is used in handling the event and adding interface in the
  11283. +driver.
  11284. +
  11285. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11286. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11287. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11288. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11289. +---
  11290. +
  11291. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11292. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11293. +@@ -795,7 +795,7 @@ fail:
  11294. + }
  11295. +
  11296. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  11297. +- char *name, u8 *mac_addr)
  11298. ++ bool is_p2pdev, char *name, u8 *mac_addr)
  11299. + {
  11300. + struct brcmf_if *ifp;
  11301. + struct net_device *ndev;
  11302. +@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  11303. + }
  11304. + }
  11305. +
  11306. +- if (!brcmf_p2p_enable && bssidx == 1) {
  11307. ++ if (!brcmf_p2p_enable && is_p2pdev) {
  11308. + /* this is P2P_DEVICE interface */
  11309. + brcmf_dbg(INFO, "allocate non-netdev interface\n");
  11310. + ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
  11311. +@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
  11312. + brcmf_dbg(TRACE, "\n");
  11313. +
  11314. + /* add primary networking interface */
  11315. +- ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL);
  11316. ++ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
  11317. + if (IS_ERR(ifp))
  11318. + return PTR_ERR(ifp);
  11319. +
  11320. + if (brcmf_p2p_enable)
  11321. +- p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL);
  11322. ++ p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  11323. + else
  11324. + p2p_ifp = NULL;
  11325. + if (IS_ERR(p2p_ifp))
  11326. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11327. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11328. +@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drv
  11329. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  11330. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  11331. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  11332. +- char *name, u8 *mac_addr);
  11333. ++ bool is_p2pdev, char *name, u8 *mac_addr);
  11334. + void brcmf_remove_interface(struct brcmf_if *ifp);
  11335. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  11336. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  11337. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11338. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11339. +@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(s
  11340. + {
  11341. + struct brcmf_if_event *ifevent = data;
  11342. + struct brcmf_if *ifp;
  11343. ++ bool is_p2pdev;
  11344. + int err = 0;
  11345. +
  11346. + brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  11347. +@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(s
  11348. + ifevent->flags, ifevent->role);
  11349. +
  11350. + /* The P2P Device interface event must not be ignored
  11351. +- * contrary to what firmware tells us. The only way to
  11352. +- * distinguish the P2P Device is by looking at the ifidx
  11353. +- * and bssidx received.
  11354. ++ * contrary to what firmware tells us.
  11355. + */
  11356. +- if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
  11357. +- (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  11358. ++ is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  11359. ++ ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  11360. ++ if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  11361. + brcmf_dbg(EVENT, "event can be ignored\n");
  11362. + return;
  11363. + }
  11364. + if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  11365. +- brcmf_err("invalid interface index: %u\n",
  11366. +- ifevent->ifidx);
  11367. ++ brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  11368. + return;
  11369. + }
  11370. +
  11371. +@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(s
  11372. + brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  11373. + emsg->addr);
  11374. + ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  11375. +- emsg->ifname, emsg->addr);
  11376. ++ is_p2pdev, emsg->ifname, emsg->addr);
  11377. + if (IS_ERR(ifp))
  11378. + return;
  11379. + brcmf_fws_add_interface(ifp);
  11380. 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
  11381. deleted file mode 100644
  11382. index 2eda1c9..0000000
  11383. --- a/package/kernel/mac80211/patches/324-ath9k-add-new-function-ath9k_hw_read_array.patch
  11384. +++ /dev/null
  11385. @@ -1,69 +0,0 @@
  11386. -From: Oleksij Rempel <linux@rempel-privat.de>
  11387. -Date: Sun, 22 Mar 2015 19:29:51 +0100
  11388. -Subject: [PATCH] ath9k: add new function ath9k_hw_read_array
  11389. -
  11390. -REG_READ generate most overhead on usb bus. It send and read micro packages
  11391. -and reduce usb bandwidth. To reduce this overhead we should read in batches.
  11392. -
  11393. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11394. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11395. ----
  11396. -
  11397. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  11398. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  11399. -@@ -121,6 +121,36 @@ void ath9k_hw_write_array(struct ath_hw
  11400. - REGWRITE_BUFFER_FLUSH(ah);
  11401. - }
  11402. -
  11403. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size)
  11404. -+{
  11405. -+ u32 *tmp_reg_list, *tmp_data;
  11406. -+ int i;
  11407. -+
  11408. -+ tmp_reg_list = kmalloc(size * sizeof(u32), GFP_KERNEL);
  11409. -+ if (!tmp_reg_list) {
  11410. -+ dev_err(ah->dev, "%s: tmp_reg_list: alloc filed\n", __func__);
  11411. -+ return;
  11412. -+ }
  11413. -+
  11414. -+ tmp_data = kmalloc(size * sizeof(u32), GFP_KERNEL);
  11415. -+ if (!tmp_data) {
  11416. -+ dev_err(ah->dev, "%s tmp_data: alloc filed\n", __func__);
  11417. -+ goto error_tmp_data;
  11418. -+ }
  11419. -+
  11420. -+ for (i = 0; i < size; i++)
  11421. -+ tmp_reg_list[i] = array[i][0];
  11422. -+
  11423. -+ REG_READ_MULTI(ah, tmp_reg_list, tmp_data, size);
  11424. -+
  11425. -+ for (i = 0; i < size; i++)
  11426. -+ array[i][1] = tmp_data[i];
  11427. -+
  11428. -+ kfree(tmp_data);
  11429. -+error_tmp_data:
  11430. -+ kfree(tmp_reg_list);
  11431. -+}
  11432. -+
  11433. - u32 ath9k_hw_reverse_bits(u32 val, u32 n)
  11434. - {
  11435. - u32 retval;
  11436. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  11437. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  11438. -@@ -138,6 +138,8 @@
  11439. -
  11440. - #define REG_WRITE_ARRAY(iniarray, column, regWr) \
  11441. - ath9k_hw_write_array(ah, iniarray, column, &(regWr))
  11442. -+#define REG_READ_ARRAY(ah, array, size) \
  11443. -+ ath9k_hw_read_array(ah, array, size)
  11444. -
  11445. - #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
  11446. - #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
  11447. -@@ -1020,6 +1022,7 @@ void ath9k_hw_synth_delay(struct ath_hw
  11448. - bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
  11449. - void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array,
  11450. - int column, unsigned int *writecnt);
  11451. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size);
  11452. - u32 ath9k_hw_reverse_bits(u32 val, u32 n);
  11453. - u16 ath9k_hw_computetxtime(struct ath_hw *ah,
  11454. - u8 phy, int kbps,
  11455. 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
  11456. new file mode 100644
  11457. index 0000000..abd6681
  11458. --- /dev/null
  11459. +++ b/package/kernel/mac80211/patches/324-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  11460. @@ -0,0 +1,126 @@
  11461. +From: Arend van Spriel <arend@broadcom.com>
  11462. +Date: Wed, 26 Aug 2015 22:14:58 +0200
  11463. +Subject: [PATCH] brcmfmac: use brcmf_get_ifp() to map ifidx to struct
  11464. + brcmf_if instance
  11465. +
  11466. +The knowledge on how to map the interface index to a struct brcmf_if
  11467. +instance is in brcmf_get_ifp() so use that function when only the
  11468. +interface index is known instead of accessing brcmf_pub::iflist
  11469. +directly.
  11470. +
  11471. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11472. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11473. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11474. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11475. +---
  11476. +
  11477. +--- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  11478. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  11479. +@@ -149,7 +149,7 @@ static s32 brcmf_btcoex_params_read(stru
  11480. + static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
  11481. + bool trump_sco)
  11482. + {
  11483. +- struct brcmf_if *ifp = btci->cfg->pub->iflist[0];
  11484. ++ struct brcmf_if *ifp = brcmf_get_ifp(btci->cfg->pub, 0);
  11485. +
  11486. + if (trump_sco && !btci->saved_regs_part2) {
  11487. + /* this should reduce eSCO agressive
  11488. +@@ -468,7 +468,7 @@ int brcmf_btcoex_set_mode(struct brcmf_c
  11489. + {
  11490. + struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  11491. + struct brcmf_btcoex_info *btci = cfg->btcoex;
  11492. +- struct brcmf_if *ifp = cfg->pub->iflist[0];
  11493. ++ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  11494. +
  11495. + switch (mode) {
  11496. + case BRCMF_BTCOEX_DISABLED:
  11497. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11498. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11499. +@@ -6213,7 +6213,7 @@ static void brcmf_free_wiphy(struct wiph
  11500. + struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  11501. + struct device *busdev)
  11502. + {
  11503. +- struct net_device *ndev = drvr->iflist[0]->ndev;
  11504. ++ struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  11505. + struct brcmf_cfg80211_info *cfg;
  11506. + struct wiphy *wiphy;
  11507. + struct brcmf_cfg80211_vif *vif;
  11508. +--- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  11509. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  11510. +@@ -121,7 +121,7 @@ static void brcmf_feat_iovar_int_set(str
  11511. +
  11512. + void brcmf_feat_attach(struct brcmf_pub *drvr)
  11513. + {
  11514. +- struct brcmf_if *ifp = drvr->iflist[0];
  11515. ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  11516. +
  11517. + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  11518. + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  11519. +--- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  11520. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  11521. +@@ -221,7 +221,7 @@ static void brcmf_flowring_block(struct
  11522. +
  11523. + bus_if = dev_get_drvdata(flow->dev);
  11524. + drvr = bus_if->drvr;
  11525. +- ifp = drvr->iflist[ifidx];
  11526. ++ ifp = brcmf_get_ifp(drvr, ifidx);
  11527. + brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
  11528. +
  11529. + spin_unlock_irqrestore(&flow->block_lock, flags);
  11530. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11531. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11532. +@@ -334,7 +334,7 @@ void brcmf_fweh_attach(struct brcmf_pub
  11533. + void brcmf_fweh_detach(struct brcmf_pub *drvr)
  11534. + {
  11535. + struct brcmf_fweh_info *fweh = &drvr->fweh;
  11536. +- struct brcmf_if *ifp = drvr->iflist[0];
  11537. ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  11538. + s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  11539. +
  11540. + if (ifp) {
  11541. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11542. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11543. +@@ -972,7 +972,7 @@ static void
  11544. + brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
  11545. + u8 if_id)
  11546. + {
  11547. +- struct brcmf_if *ifp = fws->drvr->iflist[!if_id ? 0 : if_id + 1];
  11548. ++ struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id);
  11549. +
  11550. + if (WARN_ON(!ifp))
  11551. + return;
  11552. +@@ -2118,6 +2118,7 @@ static int brcmf_debugfs_fws_stats_read(
  11553. + int brcmf_fws_init(struct brcmf_pub *drvr)
  11554. + {
  11555. + struct brcmf_fws_info *fws;
  11556. ++ struct brcmf_if *ifp;
  11557. + u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS;
  11558. + int rc;
  11559. + u32 mode;
  11560. +@@ -2177,21 +2178,22 @@ int brcmf_fws_init(struct brcmf_pub *drv
  11561. + * continue. Set mode back to none indicating not enabled.
  11562. + */
  11563. + fws->fw_signals = true;
  11564. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) {
  11565. ++ ifp = brcmf_get_ifp(drvr, 0);
  11566. ++ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  11567. + brcmf_err("failed to set bdcv2 tlv signaling\n");
  11568. + fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  11569. + fws->fw_signals = false;
  11570. + }
  11571. +
  11572. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1))
  11573. ++ if (brcmf_fil_iovar_int_set(ifp, "ampdu_hostreorder", 1))
  11574. + brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n");
  11575. +
  11576. + /* Enable seq number reuse, if supported */
  11577. +- if (brcmf_fil_iovar_int_get(drvr->iflist[0], "wlfc_mode", &mode) == 0) {
  11578. ++ if (brcmf_fil_iovar_int_get(ifp, "wlfc_mode", &mode) == 0) {
  11579. + if (BRCMF_FWS_MODE_GET_REUSESEQ(mode)) {
  11580. + mode = 0;
  11581. + BRCMF_FWS_MODE_SET_REUSESEQ(mode, 1);
  11582. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0],
  11583. ++ if (brcmf_fil_iovar_int_set(ifp,
  11584. + "wlfc_mode", mode) == 0) {
  11585. + BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1);
  11586. + }
  11587. 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
  11588. deleted file mode 100644
  11589. index 4e4888f..0000000
  11590. --- a/package/kernel/mac80211/patches/325-ath9k-ar9271_hw_pa_cal-use-REG_READ_ARRAY.patch
  11591. +++ /dev/null
  11592. @@ -1,24 +0,0 @@
  11593. -From: Oleksij Rempel <linux@rempel-privat.de>
  11594. -Date: Sun, 22 Mar 2015 19:29:52 +0100
  11595. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use REG_READ_ARRAY
  11596. -
  11597. -insted of reading each register separatly
  11598. -and waste 4ms on each operation, we can
  11599. -use one shot read.
  11600. -
  11601. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11602. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11603. ----
  11604. -
  11605. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11606. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11607. -@@ -440,8 +440,7 @@ static void ar9271_hw_pa_cal(struct ath_
  11608. - { AR9285_AN_RF2G3, 0 },
  11609. - };
  11610. -
  11611. -- for (i = 0; i < ARRAY_SIZE(regList); i++)
  11612. -- regList[i][1] = REG_READ(ah, regList[i][0]);
  11613. -+ REG_READ_ARRAY(ah, regList, ARRAY_SIZE(regList));
  11614. -
  11615. - ENABLE_REG_RMW_BUFFER(ah);
  11616. - /* 7834, b1=0 */
  11617. 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
  11618. new file mode 100644
  11619. index 0000000..23a7b6f
  11620. --- /dev/null
  11621. +++ b/package/kernel/mac80211/patches/325-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  11622. @@ -0,0 +1,122 @@
  11623. +From: Arend van Spriel <arend@broadcom.com>
  11624. +Date: Wed, 26 Aug 2015 22:14:59 +0200
  11625. +Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  11626. + brcmf_txfinalize()
  11627. +
  11628. +Most call sites of brcmf_txfinalize already have struct brcmf_if
  11629. +instance so pass that to brcmf_txfinalize() as the function
  11630. +needs it anyway.
  11631. +
  11632. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11633. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11634. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11635. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11636. +---
  11637. +
  11638. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11639. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11640. +@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  11641. + brcmf_netif_rx(ifp, skb);
  11642. + }
  11643. +
  11644. +-void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  11645. +- bool success)
  11646. ++void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  11647. + {
  11648. +- struct brcmf_if *ifp;
  11649. + struct ethhdr *eh;
  11650. + u16 type;
  11651. +
  11652. +- ifp = drvr->iflist[ifidx];
  11653. +- if (!ifp)
  11654. +- goto done;
  11655. +-
  11656. + eh = (struct ethhdr *)(txp->data);
  11657. + type = ntohs(eh->h_proto);
  11658. +
  11659. +@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  11660. +
  11661. + if (!success)
  11662. + ifp->stats.tx_errors++;
  11663. +-done:
  11664. ++
  11665. + brcmu_pkt_buf_free_skb(txp);
  11666. + }
  11667. +
  11668. +@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  11669. + if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  11670. + brcmu_pkt_buf_free_skb(txp);
  11671. + else
  11672. +- brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  11673. ++ brcmf_txfinalize(ifp, txp, success);
  11674. + }
  11675. + }
  11676. +
  11677. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11678. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11679. +@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  11680. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  11681. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  11682. + enum brcmf_netif_stop_reason reason, bool state);
  11683. +-void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  11684. +- bool success);
  11685. ++void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  11686. + void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  11687. +
  11688. + /* Sets dongle media info (drv_version, mac address). */
  11689. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11690. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11691. +@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  11692. + ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  11693. + genbit, seq);
  11694. + if (remove_from_hanger || ret)
  11695. +- brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  11696. ++ brcmf_txfinalize(ifp, skb, true);
  11697. +
  11698. + return 0;
  11699. + }
  11700. +@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  11701. + if (fws->avoid_queueing) {
  11702. + rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  11703. + if (rc < 0)
  11704. +- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  11705. ++ brcmf_txfinalize(ifp, skb, false);
  11706. + return rc;
  11707. + }
  11708. +
  11709. +@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  11710. + brcmf_fws_schedule_deq(fws);
  11711. + } else {
  11712. + brcmf_err("drop skb: no hanger slot\n");
  11713. +- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  11714. ++ brcmf_txfinalize(ifp, skb, false);
  11715. + rc = -ENOMEM;
  11716. + }
  11717. + brcmf_fws_unlock(fws);
  11718. +@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  11719. + ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  11720. + brcmf_fws_lock(fws);
  11721. + if (ret < 0)
  11722. +- brcmf_txfinalize(drvr, skb, ifidx,
  11723. +- false);
  11724. ++ brcmf_txfinalize(brcmf_get_ifp(drvr,
  11725. ++ ifidx),
  11726. ++ skb, false);
  11727. + if (fws->bus_flow_blocked)
  11728. + break;
  11729. + }
  11730. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  11731. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  11732. +@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  11733. + commonring = msgbuf->flowrings[flowid];
  11734. + atomic_dec(&commonring->outstanding_tx);
  11735. +
  11736. +- brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  11737. ++ /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  11738. ++ * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  11739. ++ */
  11740. ++ brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  11741. ++ skb, true);
  11742. + }
  11743. +
  11744. +
  11745. 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
  11746. deleted file mode 100644
  11747. index a22cd1d..0000000
  11748. --- a/package/kernel/mac80211/patches/326-ath9k-use-one-shot-read-in-ath9k_hw_update_mibstats.patch
  11749. +++ /dev/null
  11750. @@ -1,39 +0,0 @@
  11751. -From: Oleksij Rempel <linux@rempel-privat.de>
  11752. -Date: Sun, 22 Mar 2015 19:29:53 +0100
  11753. -Subject: [PATCH] ath9k: use one shot read in ath9k_hw_update_mibstats
  11754. -
  11755. -this will reduce some overhead on usb bus.
  11756. -
  11757. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11758. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11759. ----
  11760. -
  11761. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  11762. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  11763. -@@ -107,11 +107,21 @@ static const struct ani_cck_level_entry
  11764. - static void ath9k_hw_update_mibstats(struct ath_hw *ah,
  11765. - struct ath9k_mib_stats *stats)
  11766. - {
  11767. -- stats->ackrcv_bad += REG_READ(ah, AR_ACK_FAIL);
  11768. -- stats->rts_bad += REG_READ(ah, AR_RTS_FAIL);
  11769. -- stats->fcs_bad += REG_READ(ah, AR_FCS_FAIL);
  11770. -- stats->rts_good += REG_READ(ah, AR_RTS_OK);
  11771. -- stats->beacons += REG_READ(ah, AR_BEACON_CNT);
  11772. -+ u32 addr[5] = {AR_RTS_OK, AR_RTS_FAIL, AR_ACK_FAIL,
  11773. -+ AR_FCS_FAIL, AR_BEACON_CNT};
  11774. -+ u32 data[5];
  11775. -+
  11776. -+ REG_READ_MULTI(ah, &addr[0], &data[0], 5);
  11777. -+ /* AR_RTS_OK */
  11778. -+ stats->rts_good += data[0];
  11779. -+ /* AR_RTS_FAIL */
  11780. -+ stats->rts_bad += data[1];
  11781. -+ /* AR_ACK_FAIL */
  11782. -+ stats->ackrcv_bad += data[2];
  11783. -+ /* AR_FCS_FAIL */
  11784. -+ stats->fcs_bad += data[3];
  11785. -+ /* AR_BEACON_CNT */
  11786. -+ stats->beacons += data[4];
  11787. - }
  11788. -
  11789. - static void ath9k_ani_restart(struct ath_hw *ah)
  11790. 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
  11791. new file mode 100644
  11792. index 0000000..8ddc0a6
  11793. --- /dev/null
  11794. +++ b/package/kernel/mac80211/patches/326-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  11795. @@ -0,0 +1,92 @@
  11796. +From: Arend van Spriel <arend@broadcom.com>
  11797. +Date: Wed, 26 Aug 2015 22:15:00 +0200
  11798. +Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
  11799. + index
  11800. +
  11801. +Because the P2P Device interface in firmware uses the same interface
  11802. +index as the primary interface we use the bsscfg index as index in the
  11803. +struct brcmf_pub::iflist. However, in the data path we get the interface
  11804. +index and not the bsscfg index. So we need a mapping of interface index
  11805. +to bsscfg index, which can be determined upon handle adding the interface.
  11806. +
  11807. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11808. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11809. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11810. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11811. +---
  11812. +
  11813. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11814. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11815. +@@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
  11816. +
  11817. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  11818. + {
  11819. ++ struct brcmf_if *ifp;
  11820. ++ s32 bssidx;
  11821. ++
  11822. + if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  11823. + brcmf_err("ifidx %d out of range\n", ifidx);
  11824. + return NULL;
  11825. + }
  11826. +
  11827. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  11828. +- * events this is easy because it contains the bssidx which maps
  11829. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  11830. +- * bssidx 1 is used for p2p0 and no data can be received or
  11831. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  11832. +- */
  11833. +- if (ifidx)
  11834. +- ifidx++;
  11835. ++ ifp = NULL;
  11836. ++ bssidx = drvr->if2bss[ifidx];
  11837. ++ if (bssidx >= 0)
  11838. ++ ifp = drvr->iflist[bssidx];
  11839. +
  11840. +- return drvr->iflist[ifidx];
  11841. ++ return ifp;
  11842. + }
  11843. +
  11844. + static void _brcmf_set_multicast_list(struct work_struct *work)
  11845. +@@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  11846. +
  11847. + ifp = netdev_priv(ndev);
  11848. + ifp->ndev = ndev;
  11849. ++ /* store mapping ifidx to bssidx */
  11850. ++ drvr->if2bss[ifidx] = bssidx;
  11851. + }
  11852. +
  11853. + ifp->drvr = drvr;
  11854. +@@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
  11855. + struct brcmf_if *ifp;
  11856. +
  11857. + ifp = drvr->iflist[bssidx];
  11858. ++ drvr->if2bss[ifp->ifidx] = -1;
  11859. + drvr->iflist[bssidx] = NULL;
  11860. + if (!ifp) {
  11861. + brcmf_err("Null interface, idx=%d\n", bssidx);
  11862. +@@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
  11863. + }
  11864. + brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  11865. + if (ifp->ndev) {
  11866. ++ drvr->if2bss[ifp->ifidx] = -1;
  11867. + if (bssidx == 0) {
  11868. + if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  11869. + rtnl_lock();
  11870. +@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  11871. + if (!drvr)
  11872. + return -ENOMEM;
  11873. +
  11874. ++ memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  11875. + mutex_init(&drvr->proto_block);
  11876. +
  11877. + /* Link to bus module */
  11878. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11879. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11880. +@@ -122,6 +122,7 @@ struct brcmf_pub {
  11881. + struct mac_address addresses[BRCMF_MAX_IFS];
  11882. +
  11883. + struct brcmf_if *iflist[BRCMF_MAX_IFS];
  11884. ++ s32 if2bss[BRCMF_MAX_IFS];
  11885. +
  11886. + struct mutex proto_block;
  11887. + unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  11888. 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
  11889. deleted file mode 100644
  11890. index e5a362f..0000000
  11891. --- a/package/kernel/mac80211/patches/327-ath9k-ath9k_hw_loadnf-use-REG_RMW.patch
  11892. +++ /dev/null
  11893. @@ -1,71 +0,0 @@
  11894. -From: Oleksij Rempel <linux@rempel-privat.de>
  11895. -Date: Sun, 22 Mar 2015 19:29:54 +0100
  11896. -Subject: [PATCH] ath9k: ath9k_hw_loadnf: use REG_RMW
  11897. -
  11898. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11899. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11900. ----
  11901. -
  11902. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  11903. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  11904. -@@ -238,7 +238,6 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  11905. - {
  11906. - struct ath9k_nfcal_hist *h = NULL;
  11907. - unsigned i, j;
  11908. -- int32_t val;
  11909. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  11910. - struct ath_common *common = ath9k_hw_common(ah);
  11911. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  11912. -@@ -246,6 +245,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  11913. - if (ah->caldata)
  11914. - h = ah->caldata->nfCalHist;
  11915. -
  11916. -+ ENABLE_REG_RMW_BUFFER(ah);
  11917. - for (i = 0; i < NUM_NF_READINGS; i++) {
  11918. - if (chainmask & (1 << i)) {
  11919. - s16 nfval;
  11920. -@@ -258,10 +258,8 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  11921. - else
  11922. - nfval = default_nf;
  11923. -
  11924. -- val = REG_READ(ah, ah->nf_regs[i]);
  11925. -- val &= 0xFFFFFE00;
  11926. -- val |= (((u32) nfval << 1) & 0x1ff);
  11927. -- REG_WRITE(ah, ah->nf_regs[i], val);
  11928. -+ REG_RMW(ah, ah->nf_regs[i],
  11929. -+ (((u32) nfval << 1) & 0x1ff), 0x1ff);
  11930. - }
  11931. - }
  11932. -
  11933. -@@ -274,6 +272,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  11934. - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
  11935. - AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  11936. - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  11937. -+ REG_RMW_BUFFER_FLUSH(ah);
  11938. -
  11939. - /*
  11940. - * Wait for load to complete, should be fast, a few 10s of us.
  11941. -@@ -309,19 +308,17 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  11942. - * by the median we just loaded. This will be initial (and max) value
  11943. - * of next noise floor calibration the baseband does.
  11944. - */
  11945. -- ENABLE_REGWRITE_BUFFER(ah);
  11946. -+ ENABLE_REG_RMW_BUFFER(ah);
  11947. - for (i = 0; i < NUM_NF_READINGS; i++) {
  11948. - if (chainmask & (1 << i)) {
  11949. - if ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(chan))
  11950. - continue;
  11951. -
  11952. -- val = REG_READ(ah, ah->nf_regs[i]);
  11953. -- val &= 0xFFFFFE00;
  11954. -- val |= (((u32) (-50) << 1) & 0x1ff);
  11955. -- REG_WRITE(ah, ah->nf_regs[i], val);
  11956. -+ REG_RMW(ah, ah->nf_regs[i],
  11957. -+ (((u32) (-50) << 1) & 0x1ff), 0x1ff);
  11958. - }
  11959. - }
  11960. -- REGWRITE_BUFFER_FLUSH(ah);
  11961. -+ REG_RMW_BUFFER_FLUSH(ah);
  11962. -
  11963. - return 0;
  11964. - }
  11965. 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
  11966. new file mode 100644
  11967. index 0000000..a0a798b
  11968. --- /dev/null
  11969. +++ b/package/kernel/mac80211/patches/327-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  11970. @@ -0,0 +1,103 @@
  11971. +From: Arend van Spriel <arend@broadcom.com>
  11972. +Date: Wed, 26 Aug 2015 22:15:01 +0200
  11973. +Subject: [PATCH] brcmfmac: add dedicated debug level for firmware
  11974. + console logging
  11975. +
  11976. +Both PCIe and SDIO devices have the possibility to log the firmware
  11977. +console output in kernel log. For PCIe it is logged when PCIE debug
  11978. +level is enabled. For SDIO it is logged when user specifies a non-zero
  11979. +console interval through debugfs. This patch tries to make it a
  11980. +bit more consistent. The firmware console output is only logged when
  11981. +FWCON debug level is enabled.
  11982. +
  11983. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11984. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11985. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11986. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  11987. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11988. +---
  11989. +
  11990. +--- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  11991. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  11992. +@@ -37,6 +37,7 @@
  11993. + #define BRCMF_SDIO_VAL 0x00020000
  11994. + #define BRCMF_MSGBUF_VAL 0x00040000
  11995. + #define BRCMF_PCIE_VAL 0x00080000
  11996. ++#define BRCMF_FWCON_VAL 0x00100000
  11997. +
  11998. + /* set default print format */
  11999. + #undef pr_fmt
  12000. +@@ -78,6 +79,7 @@ do { \
  12001. + #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  12002. + #define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
  12003. + #define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
  12004. ++#define BRCMF_FWCON_ON() (brcmf_msg_level & BRCMF_FWCON_VAL)
  12005. +
  12006. + #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  12007. +
  12008. +@@ -90,6 +92,7 @@ do { \
  12009. + #define BRCMF_GLOM_ON() 0
  12010. + #define BRCMF_EVENT_ON() 0
  12011. + #define BRCMF_FIL_ON() 0
  12012. ++#define BRCMF_FWCON_ON() 0
  12013. +
  12014. + #endif /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  12015. +
  12016. +--- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12017. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12018. +@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(
  12019. + addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
  12020. + console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
  12021. +
  12022. +- brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
  12023. ++ brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
  12024. + console->base_addr, console->buf_addr, console->bufsize);
  12025. + }
  12026. +
  12027. +@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(
  12028. + u8 ch;
  12029. + u32 newidx;
  12030. +
  12031. ++ if (!BRCMF_FWCON_ON())
  12032. ++ return;
  12033. ++
  12034. + console = &devinfo->shared.console;
  12035. + addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
  12036. + newidx = brcmf_pcie_read_tcm32(devinfo, addr);
  12037. +@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(
  12038. + }
  12039. + if (ch == '\n') {
  12040. + console->log_str[console->log_idx] = 0;
  12041. +- brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  12042. ++ pr_debug("CONSOLE: %s", console->log_str);
  12043. + console->log_idx = 0;
  12044. + }
  12045. + }
  12046. +--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12047. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12048. +@@ -123,6 +123,7 @@ struct rte_console {
  12049. +
  12050. + #define BRCMF_FIRSTREAD (1 << 6)
  12051. +
  12052. ++#define BRCMF_CONSOLE 10 /* watchdog interval to poll console */
  12053. +
  12054. + /* SBSDIO_DEVICE_CTL */
  12055. +
  12056. +@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(st
  12057. + if (IS_ERR_OR_NULL(dentry))
  12058. + return;
  12059. +
  12060. ++ bus->console_interval = BRCMF_CONSOLE;
  12061. ++
  12062. + brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
  12063. + brcmf_debugfs_add_entry(drvr, "counters",
  12064. + brcmf_debugfs_sdio_count_read);
  12065. +@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(stru
  12066. + }
  12067. + #ifdef DEBUG
  12068. + /* Poll for console output periodically */
  12069. +- if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
  12070. ++ if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
  12071. + bus->console_interval != 0) {
  12072. + bus->console.count += BRCMF_WD_POLL_MS;
  12073. + if (bus->console.count >= bus->console_interval) {
  12074. 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
  12075. deleted file mode 100644
  12076. index 01c8011..0000000
  12077. --- a/package/kernel/mac80211/patches/328-ath9k-write-buffer-related-optimisation-in-ar5008_hw.patch
  12078. +++ /dev/null
  12079. @@ -1,27 +0,0 @@
  12080. -From: Oleksij Rempel <linux@rempel-privat.de>
  12081. -Date: Sun, 22 Mar 2015 19:29:55 +0100
  12082. -Subject: [PATCH] ath9k: write buffer related optimisation in
  12083. - ar5008_hw_set_channel_regs
  12084. -
  12085. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12086. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12087. ----
  12088. -
  12089. ---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12090. -+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12091. -@@ -681,12 +681,13 @@ static void ar5008_hw_set_channel_regs(s
  12092. - phymode |= AR_PHY_FC_DYN2040_PRI_CH;
  12093. -
  12094. - }
  12095. -+ ENABLE_REGWRITE_BUFFER(ah);
  12096. - REG_WRITE(ah, AR_PHY_TURBO, phymode);
  12097. -
  12098. -+ /* This function do only REG_WRITE, so
  12099. -+ * we can include it to REGWRITE_BUFFER. */
  12100. - ath9k_hw_set11nmac2040(ah, chan);
  12101. -
  12102. -- ENABLE_REGWRITE_BUFFER(ah);
  12103. --
  12104. - REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S);
  12105. - REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S);
  12106. -
  12107. 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
  12108. new file mode 100644
  12109. index 0000000..53e7ede
  12110. --- /dev/null
  12111. +++ b/package/kernel/mac80211/patches/328-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  12112. @@ -0,0 +1,34 @@
  12113. +From: Arend van Spriel <arend@broadcom.com>
  12114. +Date: Wed, 26 Aug 2015 22:15:02 +0200
  12115. +Subject: [PATCH] brcmfmac: remove ifidx parameter from
  12116. + brcmf_fws_txstatus_suppressed()
  12117. +
  12118. +The brcmf_fws_txstatus_suppressed() function prototype specifies an
  12119. +ifidx parameter which is not used within the function implementation.
  12120. +
  12121. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12122. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12123. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12124. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12125. +---
  12126. +
  12127. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12128. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12129. +@@ -1398,7 +1398,7 @@ done:
  12130. + }
  12131. +
  12132. + static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo,
  12133. +- struct sk_buff *skb, u8 ifidx,
  12134. ++ struct sk_buff *skb,
  12135. + u32 genbit, u16 seq)
  12136. + {
  12137. + struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac;
  12138. +@@ -1503,7 +1503,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  12139. + return -EINVAL;
  12140. + }
  12141. + if (!remove_from_hanger)
  12142. +- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  12143. ++ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb,
  12144. + genbit, seq);
  12145. + if (remove_from_hanger || ret)
  12146. + brcmf_txfinalize(ifp, skb, true);
  12147. 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
  12148. deleted file mode 100644
  12149. index e5219f2..0000000
  12150. --- a/package/kernel/mac80211/patches/329-ath9k-ath9k_hw_set_4k_power_cal_tabl-use-rmw-buffer.patch
  12151. +++ /dev/null
  12152. @@ -1,26 +0,0 @@
  12153. -From: Oleksij Rempel <linux@rempel-privat.de>
  12154. -Date: Sun, 22 Mar 2015 19:29:56 +0100
  12155. -Subject: [PATCH] ath9k: ath9k_hw_set_4k_power_cal_tabl: use rmw buffer
  12156. -
  12157. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12158. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12159. ----
  12160. -
  12161. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12162. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12163. -@@ -389,6 +389,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  12164. - }
  12165. - }
  12166. -
  12167. -+ ENABLE_REG_RMW_BUFFER(ah);
  12168. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
  12169. - (numXpdGain - 1) & 0x3);
  12170. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
  12171. -@@ -396,6 +397,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  12172. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
  12173. - xpdGainValues[1]);
  12174. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, 0);
  12175. -+ REG_RMW_BUFFER_FLUSH(ah);
  12176. -
  12177. - for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
  12178. - regChainOffset = i * 0x1000;
  12179. 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
  12180. new file mode 100644
  12181. index 0000000..bb05235
  12182. --- /dev/null
  12183. +++ b/package/kernel/mac80211/patches/329-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  12184. @@ -0,0 +1,97 @@
  12185. +From: Arend van Spriel <arend@broadcom.com>
  12186. +Date: Wed, 26 Aug 2015 22:15:03 +0200
  12187. +Subject: [PATCH] brcmfmac: change prototype for brcmf_fws_hdrpull()
  12188. +
  12189. +Instead of passing ifidx and drvr just pass struct brcmf_if pointer
  12190. +which holds both parameters.
  12191. +
  12192. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12193. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12194. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12195. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12196. +---
  12197. +
  12198. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  12199. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  12200. +@@ -312,8 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  12201. +
  12202. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  12203. + if (do_fws)
  12204. +- brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  12205. +- pktbuf);
  12206. ++ brcmf_fws_hdrpull(tmp_if, h->data_offset << 2, pktbuf);
  12207. + else
  12208. + skb_pull(pktbuf, h->data_offset << 2);
  12209. +
  12210. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12211. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12212. +@@ -1616,11 +1616,10 @@ static int brcmf_fws_notify_bcmc_credit_
  12213. + return 0;
  12214. + }
  12215. +
  12216. +-int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  12217. +- struct sk_buff *skb)
  12218. ++void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  12219. + {
  12220. + struct brcmf_skb_reorder_data *rd;
  12221. +- struct brcmf_fws_info *fws = drvr->fws;
  12222. ++ struct brcmf_fws_info *fws = ifp->drvr->fws;
  12223. + u8 *signal_data;
  12224. + s16 data_len;
  12225. + u8 type;
  12226. +@@ -1630,20 +1629,20 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  12227. + s32 err;
  12228. +
  12229. + brcmf_dbg(HDRS, "enter: ifidx %d, skblen %u, sig %d\n",
  12230. +- ifidx, skb->len, signal_len);
  12231. ++ ifp->ifidx, skb->len, siglen);
  12232. +
  12233. +- WARN_ON(signal_len > skb->len);
  12234. ++ WARN_ON(siglen > skb->len);
  12235. +
  12236. +- if (!signal_len)
  12237. +- return 0;
  12238. ++ if (!siglen)
  12239. ++ return;
  12240. + /* if flow control disabled, skip to packet data and leave */
  12241. + if ((!fws) || (!fws->fw_signals)) {
  12242. +- skb_pull(skb, signal_len);
  12243. +- return 0;
  12244. ++ skb_pull(skb, siglen);
  12245. ++ return;
  12246. + }
  12247. +
  12248. + fws->stats.header_pulls++;
  12249. +- data_len = signal_len;
  12250. ++ data_len = siglen;
  12251. + signal_data = skb->data;
  12252. +
  12253. + status = BRCMF_FWS_RET_OK_NOSCHEDULE;
  12254. +@@ -1731,14 +1730,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  12255. + /* signalling processing result does
  12256. + * not affect the actual ethernet packet.
  12257. + */
  12258. +- skb_pull(skb, signal_len);
  12259. ++ skb_pull(skb, siglen);
  12260. +
  12261. + /* this may be a signal-only packet
  12262. + */
  12263. + if (skb->len == 0)
  12264. + fws->stats.header_only_pkt++;
  12265. +-
  12266. +- return 0;
  12267. + }
  12268. +
  12269. + static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
  12270. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  12271. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  12272. +@@ -21,8 +21,7 @@
  12273. + int brcmf_fws_init(struct brcmf_pub *drvr);
  12274. + void brcmf_fws_deinit(struct brcmf_pub *drvr);
  12275. + bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
  12276. +-int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  12277. +- struct sk_buff *skb);
  12278. ++void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
  12279. + int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);
  12280. +
  12281. + void brcmf_fws_reset_interface(struct brcmf_if *ifp);
  12282. 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
  12283. deleted file mode 100644
  12284. index 6ce3f40..0000000
  12285. --- a/package/kernel/mac80211/patches/330-ath9k-use-rmw-buffer-in-ath9k_hw_set_operating_mode-.patch
  12286. +++ /dev/null
  12287. @@ -1,43 +0,0 @@
  12288. -From: Oleksij Rempel <linux@rempel-privat.de>
  12289. -Date: Sun, 22 Mar 2015 19:29:57 +0100
  12290. -Subject: [PATCH] ath9k: use rmw buffer in ath9k_hw_set_operating_mode
  12291. - and ath9k_hw_reset
  12292. -
  12293. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12294. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12295. ----
  12296. -
  12297. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  12298. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  12299. -@@ -1227,6 +1227,7 @@ static void ath9k_hw_set_operating_mode(
  12300. - u32 mask = AR_STA_ID1_STA_AP | AR_STA_ID1_ADHOC;
  12301. - u32 set = AR_STA_ID1_KSRCH_MODE;
  12302. -
  12303. -+ ENABLE_REG_RMW_BUFFER(ah);
  12304. - switch (opmode) {
  12305. - case NL80211_IFTYPE_ADHOC:
  12306. - if (!AR_SREV_9340_13(ah)) {
  12307. -@@ -1248,6 +1249,7 @@ static void ath9k_hw_set_operating_mode(
  12308. - break;
  12309. - }
  12310. - REG_RMW(ah, AR_STA_ID1, set, mask);
  12311. -+ REG_RMW_BUFFER_FLUSH(ah);
  12312. - }
  12313. -
  12314. - void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
  12315. -@@ -1960,6 +1962,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  12316. - if (!ath9k_hw_mci_is_enabled(ah))
  12317. - REG_WRITE(ah, AR_OBS, 8);
  12318. -
  12319. -+ ENABLE_REG_RMW_BUFFER(ah);
  12320. - if (ah->config.rx_intr_mitigation) {
  12321. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, ah->config.rimt_last);
  12322. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, ah->config.rimt_first);
  12323. -@@ -1969,6 +1972,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  12324. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300);
  12325. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750);
  12326. - }
  12327. -+ REG_RMW_BUFFER_FLUSH(ah);
  12328. -
  12329. - ath9k_hw_init_bb(ah, chan);
  12330. -
  12331. 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
  12332. new file mode 100644
  12333. index 0000000..0651a2f
  12334. --- /dev/null
  12335. +++ b/package/kernel/mac80211/patches/330-brcmfmac-introduce-brcmf_net_detach-function.patch
  12336. @@ -0,0 +1,99 @@
  12337. +From: Arend van Spriel <arend@broadcom.com>
  12338. +Date: Wed, 26 Aug 2015 22:15:04 +0200
  12339. +Subject: [PATCH] brcmfmac: introduce brcmf_net_detach() function
  12340. +
  12341. +In case of error during brcmf_bus_start() the network interfaces were
  12342. +freed using free_netdev(). However, the interfaces may have additional
  12343. +memory allocated which is not freed. The netdev has destructor set to
  12344. +brcmf_cfg80211_free_netdev() which frees the additional memory if
  12345. +allocated and call free_netdev(). The brcmf_net_detach() either calls
  12346. +brcmf_cfg80211_free_netdev() directly or uses unregister_netdev() when
  12347. +struct net_device::reg_state indicates the netdev was registered.
  12348. +
  12349. +Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  12350. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12351. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12352. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12353. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12354. +---
  12355. +
  12356. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  12357. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  12358. +@@ -4747,7 +4747,8 @@ void brcmf_cfg80211_free_netdev(struct n
  12359. + ifp = netdev_priv(ndev);
  12360. + vif = ifp->vif;
  12361. +
  12362. +- brcmf_free_vif(vif);
  12363. ++ if (vif)
  12364. ++ brcmf_free_vif(vif);
  12365. + free_netdev(ndev);
  12366. + }
  12367. +
  12368. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  12369. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  12370. +@@ -718,8 +718,6 @@ int brcmf_net_attach(struct brcmf_if *if
  12371. + }
  12372. +
  12373. + brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
  12374. +-
  12375. +- ndev->destructor = brcmf_cfg80211_free_netdev;
  12376. + return 0;
  12377. +
  12378. + fail:
  12379. +@@ -729,6 +727,14 @@ fail:
  12380. + return -EBADE;
  12381. + }
  12382. +
  12383. ++static void brcmf_net_detach(struct net_device *ndev)
  12384. ++{
  12385. ++ if (ndev->reg_state == NETREG_REGISTERED)
  12386. ++ unregister_netdev(ndev);
  12387. ++ else
  12388. ++ brcmf_cfg80211_free_netdev(ndev);
  12389. ++}
  12390. ++
  12391. + static int brcmf_net_p2p_open(struct net_device *ndev)
  12392. + {
  12393. + brcmf_dbg(TRACE, "Enter\n");
  12394. +@@ -805,8 +811,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  12395. + ifp->ndev->name);
  12396. + if (ifidx) {
  12397. + netif_stop_queue(ifp->ndev);
  12398. +- unregister_netdev(ifp->ndev);
  12399. +- free_netdev(ifp->ndev);
  12400. ++ brcmf_net_detach(ifp->ndev);
  12401. + drvr->iflist[bssidx] = NULL;
  12402. + } else {
  12403. + brcmf_err("ignore IF event\n");
  12404. +@@ -828,6 +833,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  12405. + if (!ndev)
  12406. + return ERR_PTR(-ENOMEM);
  12407. +
  12408. ++ ndev->destructor = brcmf_cfg80211_free_netdev;
  12409. + ifp = netdev_priv(ndev);
  12410. + ifp->ndev = ndev;
  12411. + /* store mapping ifidx to bssidx */
  12412. +@@ -879,8 +885,7 @@ static void brcmf_del_if(struct brcmf_pu
  12413. + cancel_work_sync(&ifp->setmacaddr_work);
  12414. + cancel_work_sync(&ifp->multicast_work);
  12415. + }
  12416. +- /* unregister will take care of freeing it */
  12417. +- unregister_netdev(ifp->ndev);
  12418. ++ brcmf_net_detach(ifp->ndev);
  12419. + }
  12420. + }
  12421. +
  12422. +@@ -1056,11 +1061,11 @@ fail:
  12423. + brcmf_fws_deinit(drvr);
  12424. + }
  12425. + if (drvr->iflist[0]) {
  12426. +- free_netdev(ifp->ndev);
  12427. ++ brcmf_net_detach(ifp->ndev);
  12428. + drvr->iflist[0] = NULL;
  12429. + }
  12430. + if (p2p_ifp) {
  12431. +- free_netdev(p2p_ifp->ndev);
  12432. ++ brcmf_net_detach(p2p_ifp->ndev);
  12433. + drvr->iflist[1] = NULL;
  12434. + }
  12435. + return ret;
  12436. 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
  12437. deleted file mode 100644
  12438. index edd6160..0000000
  12439. --- a/package/kernel/mac80211/patches/331-ath9k-ath9k_hw_4k_set_board_values-use-rmw-buffer.patch
  12440. +++ /dev/null
  12441. @@ -1,26 +0,0 @@
  12442. -From: Oleksij Rempel <linux@rempel-privat.de>
  12443. -Date: Sun, 22 Mar 2015 19:29:58 +0100
  12444. -Subject: [PATCH] ath9k: ath9k_hw_4k_set_board_values: use rmw buffer
  12445. -
  12446. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12447. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12448. ----
  12449. -
  12450. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12451. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12452. -@@ -1082,6 +1082,7 @@ static void ath9k_hw_4k_set_board_values
  12453. - mask = BIT(0)|BIT(5)|BIT(10)|BIT(15)|BIT(20)|BIT(25);
  12454. - pwrctrl = mask * bb_desired_scale;
  12455. - clr = mask * 0x1f;
  12456. -+ ENABLE_REG_RMW_BUFFER(ah);
  12457. - REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr);
  12458. - REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr);
  12459. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr);
  12460. -@@ -1096,6 +1097,7 @@ static void ath9k_hw_4k_set_board_values
  12461. - clr = mask * 0x1f;
  12462. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr);
  12463. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr);
  12464. -+ REG_RMW_BUFFER_FLUSH(ah);
  12465. - }
  12466. - }
  12467. -
  12468. 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
  12469. new file mode 100644
  12470. index 0000000..5a7e447
  12471. --- /dev/null
  12472. +++ b/package/kernel/mac80211/patches/331-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  12473. @@ -0,0 +1,193 @@
  12474. +From: Hante Meuleman <meuleman@broadcom.com>
  12475. +Date: Thu, 27 Aug 2015 16:14:06 +0200
  12476. +Subject: [PATCH] brcmfmac: Reset PCIE devices after recognition.
  12477. +
  12478. +When PCIE type devices are being FW reloaded without being properly
  12479. +reset then the device ends up in a locked state, requiring the
  12480. +device to be completely powered down. This patch adds a reset
  12481. +through watchdog at the moment the device (cores) has been
  12482. +recognized. This will solve warm reboot issues.
  12483. +
  12484. +Cc: Rafal Milecki <zajec5@gmail.com>
  12485. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12486. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12487. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12488. +Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12489. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12490. +---
  12491. +
  12492. +--- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  12493. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  12494. +@@ -101,6 +101,9 @@
  12495. + /* ARM Cortex M3 core, ID 0x82a */
  12496. + #define BCM4329_CORE_ARM_BASE 0x18002000
  12497. +
  12498. ++/* Max possibly supported memory size (limited by IO mapped memory) */
  12499. ++#define BRCMF_CHIP_MAX_MEMSIZE (4 * 1024 * 1024)
  12500. ++
  12501. + #define CORE_SB(base, field) \
  12502. + (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  12503. + #define SBCOREREV(sbidh) \
  12504. +@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct
  12505. + brcmf_err("RAM size is undetermined\n");
  12506. + return -ENOMEM;
  12507. + }
  12508. ++
  12509. ++ if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
  12510. ++ brcmf_err("RAM size is incorrect\n");
  12511. ++ return -ENOMEM;
  12512. ++ }
  12513. ++
  12514. + return 0;
  12515. + }
  12516. +
  12517. +@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct
  12518. +
  12519. + /* assure chip is passive for core access */
  12520. + brcmf_chip_set_passive(&ci->pub);
  12521. ++
  12522. ++ /* Call bus specific reset function now. Cores have been determined
  12523. ++ * but further access may require a chip specific reset at this point.
  12524. ++ */
  12525. ++ if (ci->ops->reset) {
  12526. ++ ci->ops->reset(ci->ctx, &ci->pub);
  12527. ++ brcmf_chip_set_passive(&ci->pub);
  12528. ++ }
  12529. ++
  12530. + return brcmf_chip_get_raminfo(ci);
  12531. + }
  12532. +
  12533. +--- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  12534. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  12535. +@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
  12536. + u32 (*read32)(void *ctx, u32 addr);
  12537. + void (*write32)(void *ctx, u32 addr, u32 value);
  12538. + int (*prepare)(void *ctx);
  12539. ++ int (*reset)(void *ctx, struct brcmf_chip *chip);
  12540. + int (*setup)(void *ctx, struct brcmf_chip *chip);
  12541. + void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  12542. + };
  12543. +--- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12544. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12545. +@@ -74,6 +74,8 @@ enum brcmf_pcie_state {
  12546. + #define BRCMF_PCIE_REG_INTMASK 0x94
  12547. + #define BRCMF_PCIE_REG_SBMBX 0x98
  12548. +
  12549. ++#define BRCMF_PCIE_REG_LINK_STATUS_CTRL 0xBC
  12550. ++
  12551. + #define BRCMF_PCIE_PCIE2REG_INTMASK 0x24
  12552. + #define BRCMF_PCIE_PCIE2REG_MAILBOXINT 0x48
  12553. + #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C
  12554. +@@ -466,6 +468,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
  12555. +
  12556. + static void brcmf_pcie_reset_device(struct brcmf_pciedev_info *devinfo)
  12557. + {
  12558. ++ struct brcmf_core *core;
  12559. + u16 cfg_offset[] = { BRCMF_PCIE_CFGREG_STATUS_CMD,
  12560. + BRCMF_PCIE_CFGREG_PM_CSR,
  12561. + BRCMF_PCIE_CFGREG_MSI_CAP,
  12562. +@@ -484,32 +487,38 @@ static void brcmf_pcie_reset_device(stru
  12563. + if (!devinfo->ci)
  12564. + return;
  12565. +
  12566. ++ /* Disable ASPM */
  12567. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12568. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12569. +- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  12570. +- lsc = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  12571. ++ pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  12572. ++ &lsc);
  12573. + val = lsc & (~BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB);
  12574. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, val);
  12575. ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  12576. ++ val);
  12577. +
  12578. ++ /* Watchdog reset */
  12579. + brcmf_pcie_select_core(devinfo, BCMA_CORE_CHIPCOMMON);
  12580. + WRITECC32(devinfo, watchdog, 4);
  12581. + msleep(100);
  12582. +
  12583. ++ /* Restore ASPM */
  12584. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12585. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12586. +- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  12587. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, lsc);
  12588. ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  12589. ++ lsc);
  12590. +
  12591. +- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12592. +- for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  12593. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12594. +- cfg_offset[i]);
  12595. +- val = brcmf_pcie_read_reg32(devinfo,
  12596. +- BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  12597. +- brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  12598. +- cfg_offset[i], val);
  12599. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  12600. +- val);
  12601. ++ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
  12602. ++ if (core->rev <= 13) {
  12603. ++ for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  12604. ++ brcmf_pcie_write_reg32(devinfo,
  12605. ++ BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12606. ++ cfg_offset[i]);
  12607. ++ val = brcmf_pcie_read_reg32(devinfo,
  12608. ++ BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  12609. ++ brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  12610. ++ cfg_offset[i], val);
  12611. ++ brcmf_pcie_write_reg32(devinfo,
  12612. ++ BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  12613. ++ val);
  12614. ++ }
  12615. + }
  12616. + }
  12617. +
  12618. +@@ -519,8 +528,6 @@ static void brcmf_pcie_attach(struct brc
  12619. + u32 config;
  12620. +
  12621. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12622. +- if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0)
  12623. +- brcmf_pcie_reset_device(devinfo);
  12624. + /* BAR1 window may not be sized properly */
  12625. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12626. + brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR, 0x4e0);
  12627. +@@ -1636,6 +1643,23 @@ static int brcmf_pcie_buscoreprep(void *
  12628. + }
  12629. +
  12630. +
  12631. ++static int brcmf_pcie_buscore_reset(void *ctx, struct brcmf_chip *chip)
  12632. ++{
  12633. ++ struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  12634. ++ u32 val;
  12635. ++
  12636. ++ devinfo->ci = chip;
  12637. ++ brcmf_pcie_reset_device(devinfo);
  12638. ++
  12639. ++ val = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  12640. ++ if (val != 0xffffffff)
  12641. ++ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  12642. ++ val);
  12643. ++
  12644. ++ return 0;
  12645. ++}
  12646. ++
  12647. ++
  12648. + static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  12649. + u32 rstvec)
  12650. + {
  12651. +@@ -1647,6 +1671,7 @@ static void brcmf_pcie_buscore_activate(
  12652. +
  12653. + static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  12654. + .prepare = brcmf_pcie_buscoreprep,
  12655. ++ .reset = brcmf_pcie_buscore_reset,
  12656. + .activate = brcmf_pcie_buscore_activate,
  12657. + .read32 = brcmf_pcie_buscore_read32,
  12658. + .write32 = brcmf_pcie_buscore_write32,
  12659. +@@ -1814,7 +1839,6 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  12660. + brcmf_pcie_intr_disable(devinfo);
  12661. +
  12662. + brcmf_detach(&pdev->dev);
  12663. +- brcmf_pcie_reset_device(devinfo);
  12664. +
  12665. + kfree(bus->bus_priv.pcie);
  12666. + kfree(bus->msgbuf->flowrings);
  12667. 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
  12668. new file mode 100644
  12669. index 0000000..52b7fa9
  12670. --- /dev/null
  12671. +++ b/package/kernel/mac80211/patches/332-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  12672. @@ -0,0 +1,33 @@
  12673. +From: Felix Fietkau <nbd@openwrt.org>
  12674. +Date: Sun, 13 Sep 2015 22:26:10 +0200
  12675. +Subject: [PATCH] ath10k: fix DMA related firmware crashes on multiple devices
  12676. +
  12677. +Some platforms really don't like DMA bursts of 256 bytes, and this
  12678. +causes the firmware to crash when sending beacons.
  12679. +Also, changing this based on the firmware version does not seem to make
  12680. +much sense, so use 128 bytes for all versions.
  12681. +
  12682. +Cc: stable@vger.kernel.org
  12683. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  12684. +---
  12685. +
  12686. +--- a/drivers/net/wireless/ath/ath10k/hw.h
  12687. ++++ b/drivers/net/wireless/ath/ath10k/hw.h
  12688. +@@ -340,7 +340,7 @@ enum ath10k_hw_rate_cck {
  12689. + #define TARGET_10X_MAX_FRAG_ENTRIES 0
  12690. +
  12691. + /* 10.2 parameters */
  12692. +-#define TARGET_10_2_DMA_BURST_SIZE 1
  12693. ++#define TARGET_10_2_DMA_BURST_SIZE 0
  12694. +
  12695. + /* Target specific defines for WMI-TLV firmware */
  12696. + #define TARGET_TLV_NUM_VDEVS 4
  12697. +@@ -397,7 +397,7 @@ enum ath10k_hw_rate_cck {
  12698. +
  12699. + #define TARGET_10_4_TX_DBG_LOG_SIZE 1024
  12700. + #define TARGET_10_4_NUM_WDS_ENTRIES 32
  12701. +-#define TARGET_10_4_DMA_BURST_SIZE 1
  12702. ++#define TARGET_10_4_DMA_BURST_SIZE 0
  12703. + #define TARGET_10_4_MAC_AGGR_DELIM 0
  12704. + #define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
  12705. + #define TARGET_10_4_VOW_CONFIG 0
  12706. 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
  12707. deleted file mode 100644
  12708. index 3ce4428..0000000
  12709. --- a/package/kernel/mac80211/patches/332-ath9k-ath9k_hw_analog_shift_rmw-use-REG_RMW.patch
  12710. +++ /dev/null
  12711. @@ -1,27 +0,0 @@
  12712. -From: Oleksij Rempel <linux@rempel-privat.de>
  12713. -Date: Sun, 22 Mar 2015 19:29:59 +0100
  12714. -Subject: [PATCH] ath9k: ath9k_hw_analog_shift_rmw: use REG_RMW
  12715. -
  12716. -use REG_RMW in ath9k_hw_analog_shift_rmw.
  12717. -It will double execution speed on usb bus.
  12718. -
  12719. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12720. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12721. ----
  12722. -
  12723. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  12724. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  12725. -@@ -27,12 +27,7 @@ void ath9k_hw_analog_shift_regwrite(stru
  12726. - void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask,
  12727. - u32 shift, u32 val)
  12728. - {
  12729. -- u32 regVal;
  12730. --
  12731. -- regVal = REG_READ(ah, reg) & ~mask;
  12732. -- regVal |= (val << shift) & mask;
  12733. --
  12734. -- REG_WRITE(ah, reg, regVal);
  12735. -+ REG_RMW(ah, reg, ((val << shift) & mask), mask);
  12736. -
  12737. - if (ah->config.analog_shiftreg)
  12738. - udelay(100);
  12739. 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
  12740. new file mode 100644
  12741. index 0000000..faf6cdc
  12742. --- /dev/null
  12743. +++ b/package/kernel/mac80211/patches/333-ath9k-enable-hw-manual-peak-calibration-for-QCA9561.patch
  12744. @@ -0,0 +1,33 @@
  12745. +From: Miaoqing Pan <miaoqing@qca.qualcomm.com>
  12746. +Date: Tue, 1 Sep 2015 10:56:09 +0800
  12747. +Subject: [PATCH] ath9k: enable hw manual peak calibration for QCA9561
  12748. +
  12749. +This patch fix https://lists.openwrt.org/pipermail/openwrt-devel/
  12750. +2015-August/034979.html. As the peak detect calibration is set
  12751. +incorrectly.
  12752. +
  12753. +Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
  12754. +---
  12755. +
  12756. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  12757. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  12758. +@@ -1249,7 +1249,8 @@ static void ar9003_hw_manual_peak_cal(st
  12759. + REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain),
  12760. + AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR, 0x0);
  12761. +
  12762. +- if (AR_SREV_9003_PCOEM(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
  12763. ++ if (AR_SREV_9003_PCOEM(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah) ||
  12764. ++ AR_SREV_9561(ah)) {
  12765. + if (is_2g)
  12766. + REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain),
  12767. + AR_PHY_65NM_RXRF_AGC_AGC2G_DBDAC_OVR,
  12768. +@@ -1640,7 +1641,8 @@ static bool ar9003_hw_init_cal_soc(struc
  12769. +
  12770. + skip_tx_iqcal:
  12771. + if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) {
  12772. +- if (AR_SREV_9330_11(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) {
  12773. ++ if (AR_SREV_9330_11(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah) ||
  12774. ++ AR_SREV_9561(ah)) {
  12775. + for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  12776. + if (!(ah->rxchainmask & (1 << i)))
  12777. + continue;
  12778. 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
  12779. deleted file mode 100644
  12780. index 8f12b36..0000000
  12781. --- a/package/kernel/mac80211/patches/333-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_4k_set_.patch
  12782. +++ /dev/null
  12783. @@ -1,47 +0,0 @@
  12784. -From: Oleksij Rempel <linux@rempel-privat.de>
  12785. -Date: Sun, 22 Mar 2015 19:30:01 +0100
  12786. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  12787. - ath9k_hw_4k_set_gain
  12788. -
  12789. -it is possible to reduce time needed for this function
  12790. -by rplacing REG_WRITE with REG_RMW (plus dummy 0) and putt all commands
  12791. -in same buffer.
  12792. -
  12793. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12794. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12795. ----
  12796. -
  12797. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12798. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12799. -@@ -772,15 +772,14 @@ static void ath9k_hw_4k_set_gain(struct
  12800. - struct ar5416_eeprom_4k *eep,
  12801. - u8 txRxAttenLocal)
  12802. - {
  12803. -- REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0,
  12804. -- pModal->antCtrlChain[0]);
  12805. --
  12806. -- REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0),
  12807. -- (REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) &
  12808. -- ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
  12809. -- AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
  12810. -- SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  12811. -- SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
  12812. -+ ENABLE_REG_RMW_BUFFER(ah);
  12813. -+ REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0,
  12814. -+ pModal->antCtrlChain[0], 0);
  12815. -+
  12816. -+ REG_RMW(ah, AR_PHY_TIMING_CTRL4(0),
  12817. -+ SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  12818. -+ SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF),
  12819. -+ AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF);
  12820. -
  12821. - if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
  12822. - AR5416_EEP_MINOR_VER_3) {
  12823. -@@ -819,6 +818,7 @@ static void ath9k_hw_4k_set_gain(struct
  12824. - AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
  12825. - REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
  12826. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]);
  12827. -+ REG_RMW_BUFFER_FLUSH(ah);
  12828. - }
  12829. -
  12830. - /*
  12831. 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
  12832. deleted file mode 100644
  12833. index f26e059..0000000
  12834. --- a/package/kernel/mac80211/patches/334-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_def_set.patch
  12835. +++ /dev/null
  12836. @@ -1,67 +0,0 @@
  12837. -From: Oleksij Rempel <linux@rempel-privat.de>
  12838. -Date: Sun, 22 Mar 2015 19:30:03 +0100
  12839. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  12840. - ath9k_hw_def_set_gain
  12841. -
  12842. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12843. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12844. ----
  12845. -
  12846. ---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
  12847. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
  12848. -@@ -466,6 +466,7 @@ static void ath9k_hw_def_set_gain(struct
  12849. - struct ar5416_eeprom_def *eep,
  12850. - u8 txRxAttenLocal, int regChainOffset, int i)
  12851. - {
  12852. -+ ENABLE_REG_RMW_BUFFER(ah);
  12853. - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
  12854. - txRxAttenLocal = pModal->txRxAttenCh[i];
  12855. -
  12856. -@@ -483,16 +484,12 @@ static void ath9k_hw_def_set_gain(struct
  12857. - AR_PHY_GAIN_2GHZ_XATTEN2_DB,
  12858. - pModal->xatten2Db[i]);
  12859. - } else {
  12860. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  12861. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  12862. -- ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
  12863. -- | SM(pModal-> bswMargin[i],
  12864. -- AR_PHY_GAIN_2GHZ_BSW_MARGIN));
  12865. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  12866. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  12867. -- ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
  12868. -- | SM(pModal->bswAtten[i],
  12869. -- AR_PHY_GAIN_2GHZ_BSW_ATTEN));
  12870. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  12871. -+ SM(pModal-> bswMargin[i], AR_PHY_GAIN_2GHZ_BSW_MARGIN),
  12872. -+ AR_PHY_GAIN_2GHZ_BSW_MARGIN);
  12873. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  12874. -+ SM(pModal->bswAtten[i], AR_PHY_GAIN_2GHZ_BSW_ATTEN),
  12875. -+ AR_PHY_GAIN_2GHZ_BSW_ATTEN);
  12876. - }
  12877. - }
  12878. -
  12879. -@@ -504,17 +501,14 @@ static void ath9k_hw_def_set_gain(struct
  12880. - AR_PHY_RXGAIN + regChainOffset,
  12881. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]);
  12882. - } else {
  12883. -- REG_WRITE(ah,
  12884. -- AR_PHY_RXGAIN + regChainOffset,
  12885. -- (REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) &
  12886. -- ~AR_PHY_RXGAIN_TXRX_ATTEN)
  12887. -- | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN));
  12888. -- REG_WRITE(ah,
  12889. -- AR_PHY_GAIN_2GHZ + regChainOffset,
  12890. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  12891. -- ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
  12892. -- SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
  12893. -+ REG_RMW(ah, AR_PHY_RXGAIN + regChainOffset,
  12894. -+ SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN),
  12895. -+ AR_PHY_RXGAIN_TXRX_ATTEN);
  12896. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  12897. -+ SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN),
  12898. -+ AR_PHY_GAIN_2GHZ_RXTX_MARGIN);
  12899. - }
  12900. -+ REG_RMW_BUFFER_FLUSH(ah);
  12901. - }
  12902. -
  12903. - static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
  12904. 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
  12905. new file mode 100644
  12906. index 0000000..b19e7ee
  12907. --- /dev/null
  12908. +++ b/package/kernel/mac80211/patches/334-mac80211-fix-tx-sequence-number-assignment-with-soft.patch
  12909. @@ -0,0 +1,23 @@
  12910. +From: Felix Fietkau <nbd@openwrt.org>
  12911. +Date: Thu, 24 Sep 2015 14:10:07 +0200
  12912. +Subject: [PATCH] mac80211: fix tx sequence number assignment with software
  12913. + queue + fast-xmit
  12914. +
  12915. +When using software queueing, tx sequence number assignment happens at
  12916. +ieee80211_tx_dequeue time, so the fast-xmit codepath must not do that.
  12917. +
  12918. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  12919. +---
  12920. +
  12921. +--- a/net/mac80211/tx.c
  12922. ++++ b/net/mac80211/tx.c
  12923. +@@ -2766,7 +2766,8 @@ static bool ieee80211_xmit_fast(struct i
  12924. +
  12925. + if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
  12926. + *ieee80211_get_qos_ctl(hdr) = tid;
  12927. +- hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid);
  12928. ++ if (!sta->sta.txq[0])
  12929. ++ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid);
  12930. + } else {
  12931. + info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
  12932. + hdr->seq_ctrl = cpu_to_le16(sdata->sequence_number);
  12933. 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
  12934. deleted file mode 100644
  12935. index 5e63a80..0000000
  12936. --- a/package/kernel/mac80211/patches/335-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch
  12937. +++ /dev/null
  12938. @@ -1,44 +0,0 @@
  12939. -From: Hante Meuleman <meuleman@broadcom.com>
  12940. -Date: Fri, 6 Mar 2015 18:40:38 +0100
  12941. -Subject: [PATCH] brcmfmac: Fix oops when SDIO device is removed.
  12942. -
  12943. -On removal of SDIO card both functions of card will be getting
  12944. -a remove call. When the first is hanging in ctrl frame xmit then
  12945. -the second will cause oops. This patch fixes the xmit ctrl
  12946. -handling in case of serious errors and also limits the handling
  12947. -for remove to function 1 only.
  12948. -
  12949. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12950. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12951. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12952. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  12953. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12954. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12955. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12956. ----
  12957. -
  12958. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  12959. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  12960. -@@ -1194,7 +1194,7 @@ static void brcmf_ops_sdio_remove(struct
  12961. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  12962. - brcmf_dbg(SDIO, "Function: %d\n", func->num);
  12963. -
  12964. -- if (func->num != 1 && func->num != 2)
  12965. -+ if (func->num != 1)
  12966. - return;
  12967. -
  12968. - bus_if = dev_get_drvdata(&func->dev);
  12969. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12970. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12971. -@@ -2740,6 +2740,11 @@ static void brcmf_sdio_dpc(struct brcmf_
  12972. - if ((bus->sdiodev->state != BRCMF_SDIOD_DATA) || (err != 0)) {
  12973. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  12974. - atomic_set(&bus->intstatus, 0);
  12975. -+ if (bus->ctrl_frame_stat) {
  12976. -+ bus->ctrl_frame_err = -ENODEV;
  12977. -+ bus->ctrl_frame_stat = false;
  12978. -+ brcmf_sdio_wait_event_wakeup(bus);
  12979. -+ }
  12980. - } else if (atomic_read(&bus->intstatus) ||
  12981. - atomic_read(&bus->ipend) > 0 ||
  12982. - (!atomic_read(&bus->fcstate) &&
  12983. 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
  12984. new file mode 100644
  12985. index 0000000..7aef205
  12986. --- /dev/null
  12987. +++ b/package/kernel/mac80211/patches/335-mac80211-fix-handling-of-PS-filtering-with-fast-xmit.patch
  12988. @@ -0,0 +1,45 @@
  12989. +From: Felix Fietkau <nbd@openwrt.org>
  12990. +Date: Thu, 24 Sep 2015 14:11:40 +0200
  12991. +Subject: [PATCH] mac80211: fix handling of PS filtering with fast-xmit
  12992. +
  12993. +Fixes dropped packets in the tx path in case a non-PS station triggers
  12994. +the tx filter.
  12995. +
  12996. +Cc: stable@vger.kernel.org # 4.2
  12997. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  12998. +---
  12999. +
  13000. +--- a/net/mac80211/status.c
  13001. ++++ b/net/mac80211/status.c
  13002. +@@ -101,6 +101,7 @@ static void ieee80211_handle_filtered_fr
  13003. + * when it wakes up for the next time.
  13004. + */
  13005. + set_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT);
  13006. ++ ieee80211_clear_fast_xmit(sta);
  13007. +
  13008. + /*
  13009. + * This code races in the following way:
  13010. +--- a/net/mac80211/tx.c
  13011. ++++ b/net/mac80211/tx.c
  13012. +@@ -1217,8 +1217,10 @@ ieee80211_tx_prepare(struct ieee80211_su
  13013. +
  13014. + if (!tx->sta)
  13015. + info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  13016. +- else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT))
  13017. ++ else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT)) {
  13018. + info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  13019. ++ ieee80211_check_fast_xmit(tx->sta);
  13020. ++ }
  13021. +
  13022. + info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT;
  13023. +
  13024. +@@ -2450,7 +2452,8 @@ void ieee80211_check_fast_xmit(struct st
  13025. +
  13026. + if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
  13027. + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
  13028. +- test_sta_flag(sta, WLAN_STA_PS_DELIVER))
  13029. ++ test_sta_flag(sta, WLAN_STA_PS_DELIVER) ||
  13030. ++ test_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT))
  13031. + goto out;
  13032. +
  13033. + if (sdata->noack_map)
  13034. 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
  13035. new file mode 100644
  13036. index 0000000..4d88591
  13037. --- /dev/null
  13038. +++ b/package/kernel/mac80211/patches/336-ath9k-declare-required-extra-tx-headroom.patch
  13039. @@ -0,0 +1,22 @@
  13040. +From: Felix Fietkau <nbd@openwrt.org>
  13041. +Date: Thu, 24 Sep 2015 16:57:37 +0200
  13042. +Subject: [PATCH] ath9k: declare required extra tx headroom
  13043. +
  13044. +ath9k inserts padding between the 802.11 header and the data area (to
  13045. +align it). Since it didn't declare this extra required headroom, this
  13046. +led to some nasty issues like randomly dropped packets in some setups.
  13047. +
  13048. +Cc: stable@vger.kernel.org
  13049. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  13050. +---
  13051. +
  13052. +--- a/drivers/net/wireless/ath/ath9k/init.c
  13053. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  13054. +@@ -875,6 +875,7 @@ static void ath9k_set_hw_capab(struct at
  13055. + hw->max_rate_tries = 10;
  13056. + hw->sta_data_size = sizeof(struct ath_node);
  13057. + hw->vif_data_size = sizeof(struct ath_vif);
  13058. ++ hw->extra_tx_headroom = 4;
  13059. +
  13060. + hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  13061. + hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
  13062. diff --git a/package/kernel/mac80211/patches/336-brcmfmac-Simplify-watchdog-sleep.patch b/package/kernel/mac80211/patches/336-brcmfmac-Simplify-watchdog-sleep.patch
  13063. deleted file mode 100644
  13064. index 201da75..0000000
  13065. --- a/package/kernel/mac80211/patches/336-brcmfmac-Simplify-watchdog-sleep.patch
  13066. +++ /dev/null
  13067. @@ -1,157 +0,0 @@
  13068. -From: Hante Meuleman <meuleman@broadcom.com>
  13069. -Date: Fri, 6 Mar 2015 18:40:39 +0100
  13070. -Subject: [PATCH] brcmfmac: Simplify watchdog sleep.
  13071. -
  13072. -The watchdog thread is used to put the SDIO bus to sleep when the
  13073. -system is idling. This patch simplifies the way it is determined
  13074. -when sleep can be entered.
  13075. -
  13076. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13077. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13078. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13079. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13080. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13081. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13082. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13083. ----
  13084. -
  13085. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13086. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13087. -@@ -485,10 +485,9 @@ struct brcmf_sdio {
  13088. - #endif /* DEBUG */
  13089. -
  13090. - uint clkstate; /* State of sd and backplane clock(s) */
  13091. -- bool activity; /* Activity flag for clock down */
  13092. - s32 idletime; /* Control for activity timeout */
  13093. -- s32 idlecount; /* Activity timeout counter */
  13094. -- s32 idleclock; /* How to set bus driver when idle */
  13095. -+ s32 idlecount; /* Activity timeout counter */
  13096. -+ s32 idleclock; /* How to set bus driver when idle */
  13097. - bool rxflow_mode; /* Rx flow control mode */
  13098. - bool rxflow; /* Is rx flow control on */
  13099. - bool alp_only; /* Don't use HT clock (ALP only) */
  13100. -@@ -511,6 +510,7 @@ struct brcmf_sdio {
  13101. - struct workqueue_struct *brcmf_wq;
  13102. - struct work_struct datawork;
  13103. - atomic_t dpc_tskcnt;
  13104. -+ atomic_t dpc_running;
  13105. -
  13106. - bool txoff; /* Transmit flow-controlled */
  13107. - struct brcmf_sdio_count sdcnt;
  13108. -@@ -959,13 +959,8 @@ static int brcmf_sdio_clkctl(struct brcm
  13109. - brcmf_dbg(SDIO, "Enter\n");
  13110. -
  13111. - /* Early exit if we're already there */
  13112. -- if (bus->clkstate == target) {
  13113. -- if (target == CLK_AVAIL) {
  13114. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  13115. -- bus->activity = true;
  13116. -- }
  13117. -+ if (bus->clkstate == target)
  13118. - return 0;
  13119. -- }
  13120. -
  13121. - switch (target) {
  13122. - case CLK_AVAIL:
  13123. -@@ -975,7 +970,6 @@ static int brcmf_sdio_clkctl(struct brcm
  13124. - /* Now request HT Avail on the backplane */
  13125. - brcmf_sdio_htclk(bus, true, pendok);
  13126. - brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  13127. -- bus->activity = true;
  13128. - break;
  13129. -
  13130. - case CLK_SDONLY:
  13131. -@@ -1024,17 +1018,6 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  13132. -
  13133. - /* Going to sleep */
  13134. - if (sleep) {
  13135. -- /* Don't sleep if something is pending */
  13136. -- if (atomic_read(&bus->intstatus) ||
  13137. -- atomic_read(&bus->ipend) > 0 ||
  13138. -- bus->ctrl_frame_stat ||
  13139. -- (!atomic_read(&bus->fcstate) &&
  13140. -- brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  13141. -- data_ok(bus))) {
  13142. -- err = -EBUSY;
  13143. -- goto done;
  13144. -- }
  13145. --
  13146. - clkcsr = brcmf_sdiod_regrb(bus->sdiodev,
  13147. - SBSDIO_FUNC1_CHIPCLKCSR,
  13148. - &err);
  13149. -@@ -1045,11 +1028,7 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  13150. - SBSDIO_ALP_AVAIL_REQ, &err);
  13151. - }
  13152. - err = brcmf_sdio_kso_control(bus, false);
  13153. -- /* disable watchdog */
  13154. -- if (!err)
  13155. -- brcmf_sdio_wd_timer(bus, 0);
  13156. - } else {
  13157. -- bus->idlecount = 0;
  13158. - err = brcmf_sdio_kso_control(bus, true);
  13159. - }
  13160. - if (err) {
  13161. -@@ -3566,7 +3545,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  13162. - queue_work(bus->brcmf_wq, &bus->datawork);
  13163. - }
  13164. -
  13165. --static bool brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  13166. -+static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  13167. - {
  13168. - brcmf_dbg(TIMER, "Enter\n");
  13169. -
  13170. -@@ -3627,22 +3606,21 @@ static bool brcmf_sdio_bus_watchdog(stru
  13171. - #endif /* DEBUG */
  13172. -
  13173. - /* On idle timeout clear activity flag and/or turn off clock */
  13174. -- if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  13175. -- if (++bus->idlecount >= bus->idletime) {
  13176. -+ if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  13177. -+ (atomic_read(&bus->dpc_running) == 0) &&
  13178. -+ (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  13179. -+ bus->idlecount++;
  13180. -+ if (bus->idlecount > bus->idletime) {
  13181. -+ brcmf_dbg(SDIO, "idle\n");
  13182. -+ sdio_claim_host(bus->sdiodev->func[1]);
  13183. -+ brcmf_sdio_wd_timer(bus, 0);
  13184. - bus->idlecount = 0;
  13185. -- if (bus->activity) {
  13186. -- bus->activity = false;
  13187. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  13188. -- } else {
  13189. -- brcmf_dbg(SDIO, "idle\n");
  13190. -- sdio_claim_host(bus->sdiodev->func[1]);
  13191. -- brcmf_sdio_bus_sleep(bus, true, false);
  13192. -- sdio_release_host(bus->sdiodev->func[1]);
  13193. -- }
  13194. -+ brcmf_sdio_bus_sleep(bus, true, false);
  13195. -+ sdio_release_host(bus->sdiodev->func[1]);
  13196. - }
  13197. -+ } else {
  13198. -+ bus->idlecount = 0;
  13199. - }
  13200. --
  13201. -- return (atomic_read(&bus->ipend) > 0);
  13202. - }
  13203. -
  13204. - static void brcmf_sdio_dataworker(struct work_struct *work)
  13205. -@@ -3651,8 +3629,11 @@ static void brcmf_sdio_dataworker(struct
  13206. - datawork);
  13207. -
  13208. - while (atomic_read(&bus->dpc_tskcnt)) {
  13209. -+ atomic_set(&bus->dpc_running, 1);
  13210. - atomic_set(&bus->dpc_tskcnt, 0);
  13211. - brcmf_sdio_dpc(bus);
  13212. -+ bus->idlecount = 0;
  13213. -+ atomic_set(&bus->dpc_running, 0);
  13214. - }
  13215. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  13216. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  13217. -@@ -4154,6 +4135,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  13218. - }
  13219. - /* Initialize DPC thread */
  13220. - atomic_set(&bus->dpc_tskcnt, 0);
  13221. -+ atomic_set(&bus->dpc_running, 0);
  13222. -
  13223. - /* Assign bus interface call back */
  13224. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  13225. 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
  13226. deleted file mode 100644
  13227. index 3a2de7a..0000000
  13228. --- a/package/kernel/mac80211/patches/337-brcmfmac-Fix-possible-race-condition.patch
  13229. +++ /dev/null
  13230. @@ -1,83 +0,0 @@
  13231. -From: Hante Meuleman <meuleman@broadcom.com>
  13232. -Date: Fri, 6 Mar 2015 18:40:40 +0100
  13233. -Subject: [PATCH] brcmfmac: Fix possible race-condition.
  13234. -
  13235. -SDIO is using a "shared" variable to handoff ctl frames to DPC
  13236. -and to see when they are done. In a timeout situation this can
  13237. -lead to erroneous situation where DPC started to handle the ctl
  13238. -frame while the timeout expired. This patch will fix this by
  13239. -adding locking around the shared variable.
  13240. -
  13241. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13242. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13243. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13244. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13245. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13246. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13247. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13248. ----
  13249. -
  13250. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13251. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13252. -@@ -2700,11 +2700,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  13253. - if (bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL) &&
  13254. - data_ok(bus)) {
  13255. - sdio_claim_host(bus->sdiodev->func[1]);
  13256. -- err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  13257. -- bus->ctrl_frame_len);
  13258. -+ if (bus->ctrl_frame_stat) {
  13259. -+ err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  13260. -+ bus->ctrl_frame_len);
  13261. -+ bus->ctrl_frame_err = err;
  13262. -+ bus->ctrl_frame_stat = false;
  13263. -+ }
  13264. - sdio_release_host(bus->sdiodev->func[1]);
  13265. -- bus->ctrl_frame_err = err;
  13266. -- bus->ctrl_frame_stat = false;
  13267. - brcmf_sdio_wait_event_wakeup(bus);
  13268. - }
  13269. - /* Send queued frames (limit 1 if rx may still be pending) */
  13270. -@@ -2720,9 +2722,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  13271. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  13272. - atomic_set(&bus->intstatus, 0);
  13273. - if (bus->ctrl_frame_stat) {
  13274. -- bus->ctrl_frame_err = -ENODEV;
  13275. -- bus->ctrl_frame_stat = false;
  13276. -- brcmf_sdio_wait_event_wakeup(bus);
  13277. -+ sdio_claim_host(bus->sdiodev->func[1]);
  13278. -+ if (bus->ctrl_frame_stat) {
  13279. -+ bus->ctrl_frame_err = -ENODEV;
  13280. -+ bus->ctrl_frame_stat = false;
  13281. -+ brcmf_sdio_wait_event_wakeup(bus);
  13282. -+ }
  13283. -+ sdio_release_host(bus->sdiodev->func[1]);
  13284. - }
  13285. - } else if (atomic_read(&bus->intstatus) ||
  13286. - atomic_read(&bus->ipend) > 0 ||
  13287. -@@ -2930,15 +2936,20 @@ brcmf_sdio_bus_txctl(struct device *dev,
  13288. - brcmf_sdio_trigger_dpc(bus);
  13289. - wait_event_interruptible_timeout(bus->ctrl_wait, !bus->ctrl_frame_stat,
  13290. - msecs_to_jiffies(CTL_DONE_TIMEOUT));
  13291. --
  13292. -- if (!bus->ctrl_frame_stat) {
  13293. -+ ret = 0;
  13294. -+ if (bus->ctrl_frame_stat) {
  13295. -+ sdio_claim_host(bus->sdiodev->func[1]);
  13296. -+ if (bus->ctrl_frame_stat) {
  13297. -+ brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  13298. -+ bus->ctrl_frame_stat = false;
  13299. -+ ret = -ETIMEDOUT;
  13300. -+ }
  13301. -+ sdio_release_host(bus->sdiodev->func[1]);
  13302. -+ }
  13303. -+ if (!ret) {
  13304. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  13305. - bus->ctrl_frame_err);
  13306. - ret = bus->ctrl_frame_err;
  13307. -- } else {
  13308. -- brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  13309. -- bus->ctrl_frame_stat = false;
  13310. -- ret = -ETIMEDOUT;
  13311. - }
  13312. -
  13313. - if (ret)
  13314. 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
  13315. new file mode 100644
  13316. index 0000000..df2cc4b
  13317. --- /dev/null
  13318. +++ b/package/kernel/mac80211/patches/337-nl80211-put-current-TX-power-in-interface-info.patch
  13319. @@ -0,0 +1,37 @@
  13320. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  13321. +Date: Mon, 31 Aug 2015 22:59:38 +0200
  13322. +Subject: [PATCH] nl80211: put current TX power in interface info
  13323. +MIME-Version: 1.0
  13324. +Content-Type: text/plain; charset=UTF-8
  13325. +Content-Transfer-Encoding: 8bit
  13326. +
  13327. +Many drivers implement reading current TX power (using either cfg80211
  13328. +or ieee80211 op) but userspace can't get it using nl80211. Right now the
  13329. +only way to access it is to call some wext ioctl.
  13330. +Let's put TX power in interface info reply (callback is wdev specific)
  13331. +just like we do with current channel.
  13332. +To be consistent (e.g. NL80211_CMD_SET_WIPHY) let's use mBm as na unit.
  13333. +
  13334. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13335. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  13336. +---
  13337. +
  13338. +--- a/net/wireless/nl80211.c
  13339. ++++ b/net/wireless/nl80211.c
  13340. +@@ -2406,6 +2406,16 @@ static int nl80211_send_iface(struct sk_
  13341. + }
  13342. + }
  13343. +
  13344. ++ if (rdev->ops->get_tx_power) {
  13345. ++ int dbm, ret;
  13346. ++
  13347. ++ ret = rdev_get_tx_power(rdev, wdev, &dbm);
  13348. ++ if (ret == 0 &&
  13349. ++ nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
  13350. ++ DBM_TO_MBM(dbm)))
  13351. ++ goto nla_put_failure;
  13352. ++ }
  13353. ++
  13354. + if (wdev->ssid_len) {
  13355. + if (nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid))
  13356. + goto nla_put_failure;
  13357. 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
  13358. deleted file mode 100644
  13359. index c9eb900..0000000
  13360. --- a/package/kernel/mac80211/patches/338-brcmfmac-Add-support-for-BCM4345-SDIO-chipset.patch
  13361. +++ /dev/null
  13362. @@ -1,86 +0,0 @@
  13363. -From: Syed Asifful Dayyan <syedd@broadcom.com>
  13364. -Date: Fri, 6 Mar 2015 18:40:42 +0100
  13365. -Subject: [PATCH] brcmfmac: Add support for BCM4345 SDIO chipset.
  13366. -
  13367. -These changes add support for BCM4345 SDIO chipset.
  13368. -
  13369. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13370. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13371. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13372. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13373. -Signed-off-by: Syed Asifful Dayyan <syedd@broadcom.com>
  13374. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13375. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13376. ----
  13377. -
  13378. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13379. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13380. -@@ -1096,6 +1096,7 @@ static const struct sdio_device_id brcmf
  13381. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  13382. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  13383. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  13384. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  13385. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  13386. - { /* end: all zeroes */ }
  13387. - };
  13388. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13389. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13390. -@@ -491,6 +491,10 @@ static void brcmf_chip_get_raminfo(struc
  13391. - case BRCM_CC_43362_CHIP_ID:
  13392. - ci->pub.ramsize = 0x3c000;
  13393. - break;
  13394. -+ case BRCM_CC_4345_CHIP_ID:
  13395. -+ ci->pub.ramsize = 0xc8000;
  13396. -+ ci->pub.rambase = 0x198000;
  13397. -+ break;
  13398. - case BRCM_CC_4339_CHIP_ID:
  13399. - case BRCM_CC_4354_CHIP_ID:
  13400. - case BRCM_CC_4356_CHIP_ID:
  13401. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13402. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13403. -@@ -617,6 +617,8 @@ static const struct sdiod_drive_str sdio
  13404. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  13405. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  13406. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  13407. -+#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  13408. -+#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  13409. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  13410. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  13411. -
  13412. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  13413. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  13414. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  13415. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  13416. -+MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  13417. -+MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  13418. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  13419. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  13420. -
  13421. -@@ -669,6 +673,7 @@ static const struct brcmf_firmware_names
  13422. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  13423. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  13424. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  13425. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  13426. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  13427. - };
  13428. -
  13429. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  13430. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  13431. -@@ -37,6 +37,7 @@
  13432. - #define BRCM_CC_43362_CHIP_ID 43362
  13433. - #define BRCM_CC_4335_CHIP_ID 0x4335
  13434. - #define BRCM_CC_4339_CHIP_ID 0x4339
  13435. -+#define BRCM_CC_4345_CHIP_ID 0x4345
  13436. - #define BRCM_CC_4354_CHIP_ID 0x4354
  13437. - #define BRCM_CC_4356_CHIP_ID 0x4356
  13438. - #define BRCM_CC_43566_CHIP_ID 43566
  13439. ---- a/include/linux/mmc/sdio_ids.h
  13440. -+++ b/include/linux/mmc/sdio_ids.h
  13441. -@@ -33,6 +33,7 @@
  13442. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  13443. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  13444. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  13445. -+#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  13446. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  13447. -
  13448. - #define SDIO_VENDOR_ID_INTEL 0x0089
  13449. 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
  13450. new file mode 100644
  13451. index 0000000..2f492e0
  13452. --- /dev/null
  13453. +++ b/package/kernel/mac80211/patches/338-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  13454. @@ -0,0 +1,21 @@
  13455. +From: Felix Fietkau <nbd@openwrt.org>
  13456. +Date: Mon, 5 Oct 2015 17:41:25 +0200
  13457. +Subject: [PATCH] mac80211: initialize tid field in struct ieee80211_txq
  13458. +
  13459. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  13460. +---
  13461. +
  13462. +--- a/net/mac80211/util.c
  13463. ++++ b/net/mac80211/util.c
  13464. +@@ -3288,9 +3288,11 @@ void ieee80211_init_tx_queue(struct ieee
  13465. + if (sta) {
  13466. + txqi->txq.sta = &sta->sta;
  13467. + sta->sta.txq[tid] = &txqi->txq;
  13468. ++ txqi->txq.tid = tid;
  13469. + txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  13470. + } else {
  13471. + sdata->vif.txq = &txqi->txq;
  13472. ++ txqi->txq.tid = 0;
  13473. + txqi->txq.ac = IEEE80211_AC_BE;
  13474. + }
  13475. + }
  13476. 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
  13477. deleted file mode 100644
  13478. index 7a688c4..0000000
  13479. --- a/package/kernel/mac80211/patches/339-brcmfmac-remove-duplication-of-ramsize-info.patch
  13480. +++ /dev/null
  13481. @@ -1,48 +0,0 @@
  13482. -From: Arend van Spriel <arend@broadcom.com>
  13483. -Date: Wed, 11 Mar 2015 16:11:27 +0100
  13484. -Subject: [PATCH] brcmfmac: remove duplication of ramsize info
  13485. -
  13486. -Removing the ramsize from the brcmf_sdio structure to avoid
  13487. -duplication. The information is available in brcmf_chip
  13488. -structure.
  13489. -
  13490. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13491. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13492. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13493. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13494. ----
  13495. -
  13496. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13497. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13498. -@@ -432,8 +432,6 @@ struct brcmf_sdio {
  13499. - struct brcmf_sdio_dev *sdiodev; /* sdio device handler */
  13500. - struct brcmf_chip *ci; /* Chip info struct */
  13501. -
  13502. -- u32 ramsize; /* Size of RAM in SOCRAM (bytes) */
  13503. --
  13504. - u32 hostintmask; /* Copy of Host Interrupt Mask */
  13505. - atomic_t intstatus; /* Intstatus bits (events) pending */
  13506. - atomic_t fcstate; /* State of dongle flow-control */
  13507. -@@ -1075,7 +1073,7 @@ static int brcmf_sdio_readshared(struct
  13508. - struct sdpcm_shared_le sh_le;
  13509. - __le32 addr_le;
  13510. -
  13511. -- shaddr = bus->ci->rambase + bus->ramsize - 4;
  13512. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  13513. -
  13514. - /*
  13515. - * Read last word in socram to determine
  13516. -@@ -3871,13 +3869,6 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  13517. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  13518. - brcmf_sdio_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength);
  13519. -
  13520. -- /* Get info on the SOCRAM cores... */
  13521. -- bus->ramsize = bus->ci->ramsize;
  13522. -- if (!(bus->ramsize)) {
  13523. -- brcmf_err("failed to find SOCRAM memory!\n");
  13524. -- goto fail;
  13525. -- }
  13526. --
  13527. - /* Set card control so an SDIO card reset does a WLAN backplane reset */
  13528. - reg_val = brcmf_sdiod_regrb(bus->sdiodev,
  13529. - SDIO_CCCR_BRCM_CARDCTRL, &err);
  13530. 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
  13531. deleted file mode 100644
  13532. index e2a2074..0000000
  13533. --- a/package/kernel/mac80211/patches/340-brcmfmac-always-perform-cores-checks.patch
  13534. +++ /dev/null
  13535. @@ -1,74 +0,0 @@
  13536. -From: Arend van Spriel <arend@broadcom.com>
  13537. -Date: Wed, 11 Mar 2015 16:11:28 +0100
  13538. -Subject: [PATCH] brcmfmac: always perform cores checks
  13539. -
  13540. -Instead of checking the cores in the chip only if CONFIG_BRCMDBG
  13541. -is selected perform the check always and extend it with more sanity
  13542. -checking.
  13543. -
  13544. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13545. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13546. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13547. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13548. ----
  13549. -
  13550. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13551. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13552. -@@ -419,13 +419,13 @@ static struct brcmf_core *brcmf_chip_add
  13553. - return &core->pub;
  13554. - }
  13555. -
  13556. --#ifdef DEBUG
  13557. - /* safety check for chipinfo */
  13558. - static int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  13559. - {
  13560. - struct brcmf_core_priv *core;
  13561. - bool need_socram = false;
  13562. - bool has_socram = false;
  13563. -+ bool cpu_found = false;
  13564. - int idx = 1;
  13565. -
  13566. - list_for_each_entry(core, &ci->cores, list) {
  13567. -@@ -435,12 +435,14 @@ static int brcmf_chip_cores_check(struct
  13568. -
  13569. - switch (core->pub.id) {
  13570. - case BCMA_CORE_ARM_CM3:
  13571. -+ cpu_found = true;
  13572. - need_socram = true;
  13573. - break;
  13574. - case BCMA_CORE_INTERNAL_MEM:
  13575. - has_socram = true;
  13576. - break;
  13577. - case BCMA_CORE_ARM_CR4:
  13578. -+ cpu_found = true;
  13579. - if (ci->pub.rambase == 0) {
  13580. - brcmf_err("RAM base not provided with ARM CR4 core\n");
  13581. - return -ENOMEM;
  13582. -@@ -451,19 +453,21 @@ static int brcmf_chip_cores_check(struct
  13583. - }
  13584. - }
  13585. -
  13586. -+ if (!cpu_found) {
  13587. -+ brcmf_err("CPU core not detected\n");
  13588. -+ return -ENXIO;
  13589. -+ }
  13590. - /* check RAM core presence for ARM CM3 core */
  13591. - if (need_socram && !has_socram) {
  13592. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  13593. - return -ENODEV;
  13594. - }
  13595. -+ if (!ci->pub.ramsize) {
  13596. -+ brcmf_err("RAM size is undetermined\n");
  13597. -+ return -ENOMEM;
  13598. -+ }
  13599. - return 0;
  13600. - }
  13601. --#else /* DEBUG */
  13602. --static inline int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  13603. --{
  13604. -- return 0;
  13605. --}
  13606. --#endif
  13607. -
  13608. - static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  13609. - {
  13610. 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
  13611. deleted file mode 100644
  13612. index a272800..0000000
  13613. --- a/package/kernel/mac80211/patches/341-brcmfmac-rename-chip-download-functions.patch
  13614. +++ /dev/null
  13615. @@ -1,240 +0,0 @@
  13616. -From: Arend van Spriel <arend@broadcom.com>
  13617. -Date: Wed, 11 Mar 2015 16:11:29 +0100
  13618. -Subject: [PATCH] brcmfmac: rename chip download functions
  13619. -
  13620. -The functions brcmf_chip_[enter/exit]_download() are not exclusively
  13621. -used for firmware download so rename these more appropriate.
  13622. -
  13623. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13624. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13625. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13626. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13627. ----
  13628. -
  13629. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13630. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13631. -@@ -807,7 +807,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  13632. - err = -EINVAL;
  13633. - if (WARN_ON(!ops->prepare))
  13634. - err = -EINVAL;
  13635. -- if (WARN_ON(!ops->exit_dl))
  13636. -+ if (WARN_ON(!ops->activate))
  13637. - err = -EINVAL;
  13638. - if (err < 0)
  13639. - return ERR_PTR(-EINVAL);
  13640. -@@ -905,7 +905,7 @@ void brcmf_chip_resetcore(struct brcmf_c
  13641. - }
  13642. -
  13643. - static void
  13644. --brcmf_chip_cm3_enterdl(struct brcmf_chip_priv *chip)
  13645. -+brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  13646. - {
  13647. - struct brcmf_core *core;
  13648. -
  13649. -@@ -919,7 +919,7 @@ brcmf_chip_cm3_enterdl(struct brcmf_chip
  13650. - brcmf_chip_resetcore(core, 0, 0, 0);
  13651. - }
  13652. -
  13653. --static bool brcmf_chip_cm3_exitdl(struct brcmf_chip_priv *chip)
  13654. -+static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  13655. - {
  13656. - struct brcmf_core *core;
  13657. -
  13658. -@@ -929,7 +929,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  13659. - return false;
  13660. - }
  13661. -
  13662. -- chip->ops->exit_dl(chip->ctx, &chip->pub, 0);
  13663. -+ chip->ops->activate(chip->ctx, &chip->pub, 0);
  13664. -
  13665. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CM3);
  13666. - brcmf_chip_resetcore(core, 0, 0, 0);
  13667. -@@ -938,7 +938,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  13668. - }
  13669. -
  13670. - static inline void
  13671. --brcmf_chip_cr4_enterdl(struct brcmf_chip_priv *chip)
  13672. -+brcmf_chip_cr4_set_passive(struct brcmf_chip_priv *chip)
  13673. - {
  13674. - struct brcmf_core *core;
  13675. -
  13676. -@@ -951,11 +951,11 @@ brcmf_chip_cr4_enterdl(struct brcmf_chip
  13677. - D11_BCMA_IOCTL_PHYCLOCKEN);
  13678. - }
  13679. -
  13680. --static bool brcmf_chip_cr4_exitdl(struct brcmf_chip_priv *chip, u32 rstvec)
  13681. -+static bool brcmf_chip_cr4_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
  13682. - {
  13683. - struct brcmf_core *core;
  13684. -
  13685. -- chip->ops->exit_dl(chip->ctx, &chip->pub, rstvec);
  13686. -+ chip->ops->activate(chip->ctx, &chip->pub, rstvec);
  13687. -
  13688. - /* restore ARM */
  13689. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CR4);
  13690. -@@ -964,7 +964,7 @@ static bool brcmf_chip_cr4_exitdl(struct
  13691. - return true;
  13692. - }
  13693. -
  13694. --void brcmf_chip_enter_download(struct brcmf_chip *pub)
  13695. -+void brcmf_chip_set_passive(struct brcmf_chip *pub)
  13696. - {
  13697. - struct brcmf_chip_priv *chip;
  13698. - struct brcmf_core *arm;
  13699. -@@ -974,14 +974,14 @@ void brcmf_chip_enter_download(struct br
  13700. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  13701. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  13702. - if (arm) {
  13703. -- brcmf_chip_cr4_enterdl(chip);
  13704. -+ brcmf_chip_cr4_set_passive(chip);
  13705. - return;
  13706. - }
  13707. -
  13708. -- brcmf_chip_cm3_enterdl(chip);
  13709. -+ brcmf_chip_cm3_set_passive(chip);
  13710. - }
  13711. -
  13712. --bool brcmf_chip_exit_download(struct brcmf_chip *pub, u32 rstvec)
  13713. -+bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
  13714. - {
  13715. - struct brcmf_chip_priv *chip;
  13716. - struct brcmf_core *arm;
  13717. -@@ -991,9 +991,9 @@ bool brcmf_chip_exit_download(struct brc
  13718. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  13719. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  13720. - if (arm)
  13721. -- return brcmf_chip_cr4_exitdl(chip, rstvec);
  13722. -+ return brcmf_chip_cr4_set_active(chip, rstvec);
  13723. -
  13724. -- return brcmf_chip_cm3_exitdl(chip);
  13725. -+ return brcmf_chip_cm3_set_active(chip);
  13726. - }
  13727. -
  13728. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
  13729. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  13730. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  13731. -@@ -64,7 +64,7 @@ struct brcmf_core {
  13732. - * @write32: write 32-bit value over bus.
  13733. - * @prepare: prepare bus for core configuration.
  13734. - * @setup: bus-specific core setup.
  13735. -- * @exit_dl: exit download state.
  13736. -+ * @active: chip becomes active.
  13737. - * The callback should use the provided @rstvec when non-zero.
  13738. - */
  13739. - struct brcmf_buscore_ops {
  13740. -@@ -72,7 +72,7 @@ struct brcmf_buscore_ops {
  13741. - void (*write32)(void *ctx, u32 addr, u32 value);
  13742. - int (*prepare)(void *ctx);
  13743. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  13744. -- void (*exit_dl)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  13745. -+ void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  13746. - };
  13747. -
  13748. - struct brcmf_chip *brcmf_chip_attach(void *ctx,
  13749. -@@ -84,8 +84,8 @@ bool brcmf_chip_iscoreup(struct brcmf_co
  13750. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  13751. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  13752. - u32 postreset);
  13753. --void brcmf_chip_enter_download(struct brcmf_chip *ci);
  13754. --bool brcmf_chip_exit_download(struct brcmf_chip *ci, u32 rstvec);
  13755. -+void brcmf_chip_set_passive(struct brcmf_chip *ci);
  13756. -+bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec);
  13757. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub);
  13758. -
  13759. - #endif /* BRCMF_AXIDMP_H */
  13760. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13761. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13762. -@@ -509,7 +509,7 @@ static void brcmf_pcie_attach(struct brc
  13763. -
  13764. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  13765. - {
  13766. -- brcmf_chip_enter_download(devinfo->ci);
  13767. -+ brcmf_chip_set_passive(devinfo->ci);
  13768. -
  13769. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  13770. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  13771. -@@ -536,7 +536,7 @@ static int brcmf_pcie_exit_download_stat
  13772. - brcmf_chip_resetcore(core, 0, 0, 0);
  13773. - }
  13774. -
  13775. -- return !brcmf_chip_exit_download(devinfo->ci, resetintr);
  13776. -+ return !brcmf_chip_set_active(devinfo->ci, resetintr);
  13777. - }
  13778. -
  13779. -
  13780. -@@ -1566,8 +1566,8 @@ static int brcmf_pcie_buscoreprep(void *
  13781. - }
  13782. -
  13783. -
  13784. --static void brcmf_pcie_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  13785. -- u32 rstvec)
  13786. -+static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  13787. -+ u32 rstvec)
  13788. - {
  13789. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  13790. -
  13791. -@@ -1577,7 +1577,7 @@ static void brcmf_pcie_buscore_exitdl(vo
  13792. -
  13793. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  13794. - .prepare = brcmf_pcie_buscoreprep,
  13795. -- .exit_dl = brcmf_pcie_buscore_exitdl,
  13796. -+ .activate = brcmf_pcie_buscore_activate,
  13797. - .read32 = brcmf_pcie_buscore_read32,
  13798. - .write32 = brcmf_pcie_buscore_write32,
  13799. - };
  13800. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13801. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13802. -@@ -3357,7 +3357,7 @@ static int brcmf_sdio_download_firmware(
  13803. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  13804. -
  13805. - /* Keep arm in reset */
  13806. -- brcmf_chip_enter_download(bus->ci);
  13807. -+ brcmf_chip_set_passive(bus->ci);
  13808. -
  13809. - rstvec = get_unaligned_le32(fw->data);
  13810. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  13811. -@@ -3378,7 +3378,7 @@ static int brcmf_sdio_download_firmware(
  13812. - }
  13813. -
  13814. - /* Take arm out of reset */
  13815. -- if (!brcmf_chip_exit_download(bus->ci, rstvec)) {
  13816. -+ if (!brcmf_chip_set_active(bus->ci, rstvec)) {
  13817. - brcmf_err("error getting out of ARM core reset\n");
  13818. - goto err;
  13819. - }
  13820. -@@ -3771,8 +3771,8 @@ static int brcmf_sdio_buscoreprep(void *
  13821. - return 0;
  13822. - }
  13823. -
  13824. --static void brcmf_sdio_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  13825. -- u32 rstvec)
  13826. -+static void brcmf_sdio_buscore_activate(void *ctx, struct brcmf_chip *chip,
  13827. -+ u32 rstvec)
  13828. - {
  13829. - struct brcmf_sdio_dev *sdiodev = ctx;
  13830. - struct brcmf_core *core;
  13831. -@@ -3815,7 +3815,7 @@ static void brcmf_sdio_buscore_write32(v
  13832. -
  13833. - static const struct brcmf_buscore_ops brcmf_sdio_buscore_ops = {
  13834. - .prepare = brcmf_sdio_buscoreprep,
  13835. -- .exit_dl = brcmf_sdio_buscore_exitdl,
  13836. -+ .activate = brcmf_sdio_buscore_activate,
  13837. - .read32 = brcmf_sdio_buscore_read32,
  13838. - .write32 = brcmf_sdio_buscore_write32,
  13839. - };
  13840. -@@ -4239,12 +4239,11 @@ void brcmf_sdio_remove(struct brcmf_sdio
  13841. - sdio_claim_host(bus->sdiodev->func[1]);
  13842. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  13843. - /* Leave the device in state where it is
  13844. -- * 'quiet'. This is done by putting it in
  13845. -- * download_state which essentially resets
  13846. -- * all necessary cores.
  13847. -+ * 'passive'. This is done by resetting all
  13848. -+ * necessary cores.
  13849. - */
  13850. - msleep(20);
  13851. -- brcmf_chip_enter_download(bus->ci);
  13852. -+ brcmf_chip_set_passive(bus->ci);
  13853. - brcmf_sdio_clkctl(bus, CLK_NONE, false);
  13854. - sdio_release_host(bus->sdiodev->func[1]);
  13855. - }
  13856. 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
  13857. deleted file mode 100644
  13858. index 6b1dd81..0000000
  13859. --- a/package/kernel/mac80211/patches/342-brcmfmac-assure-device-is-ready-for-download-after-b.patch
  13860. +++ /dev/null
  13861. @@ -1,61 +0,0 @@
  13862. -From: Arend van Spriel <arend@broadcom.com>
  13863. -Date: Wed, 11 Mar 2015 16:11:30 +0100
  13864. -Subject: [PATCH] brcmfmac: assure device is ready for download after
  13865. - brcmf_chip_attach()
  13866. -
  13867. -Make the brcmf_chip_attach() function responsible for putting the
  13868. -device in a state where it is accessible for firmware download.
  13869. -
  13870. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13871. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13872. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13873. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13874. ----
  13875. -
  13876. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13877. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13878. -@@ -786,12 +786,6 @@ static int brcmf_chip_setup(struct brcmf
  13879. - if (chip->ops->setup)
  13880. - ret = chip->ops->setup(chip->ctx, pub);
  13881. -
  13882. -- /*
  13883. -- * Make sure any on-chip ARM is off (in case strapping is wrong),
  13884. -- * or downloaded code was already running.
  13885. -- */
  13886. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  13887. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CR4);
  13888. - return ret;
  13889. - }
  13890. -
  13891. -@@ -833,6 +827,8 @@ struct brcmf_chip *brcmf_chip_attach(voi
  13892. - if (err < 0)
  13893. - goto fail;
  13894. -
  13895. -+ /* assure chip is passive for download */
  13896. -+ brcmf_chip_set_passive(&chip->pub);
  13897. - return &chip->pub;
  13898. -
  13899. - fail:
  13900. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13901. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13902. -@@ -509,8 +509,6 @@ static void brcmf_pcie_attach(struct brc
  13903. -
  13904. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  13905. - {
  13906. -- brcmf_chip_set_passive(devinfo->ci);
  13907. --
  13908. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  13909. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  13910. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_ARMCR4REG_BANKIDX,
  13911. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13912. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13913. -@@ -3356,9 +3356,6 @@ static int brcmf_sdio_download_firmware(
  13914. - sdio_claim_host(bus->sdiodev->func[1]);
  13915. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  13916. -
  13917. -- /* Keep arm in reset */
  13918. -- brcmf_chip_set_passive(bus->ci);
  13919. --
  13920. - rstvec = get_unaligned_le32(fw->data);
  13921. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  13922. -
  13923. 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
  13924. deleted file mode 100644
  13925. index bcc2ed4..0000000
  13926. --- a/package/kernel/mac80211/patches/343-brcmfmac-extract-ram-size-info-from-internal-memory-.patch
  13927. +++ /dev/null
  13928. @@ -1,367 +0,0 @@
  13929. -From: Arend van Spriel <arend@broadcom.com>
  13930. -Date: Wed, 11 Mar 2015 16:11:31 +0100
  13931. -Subject: [PATCH] brcmfmac: extract ram size info from internal memory
  13932. - registers
  13933. -
  13934. -Instead of hard-coded memory sizes it is possible to obtain that
  13935. -information from the internal memory registers.
  13936. -
  13937. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13938. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13939. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13940. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13941. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13942. ----
  13943. -
  13944. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13945. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13946. -@@ -100,9 +100,6 @@
  13947. - #define BCM4329_CORE_SOCRAM_BASE 0x18003000
  13948. - /* ARM Cortex M3 core, ID 0x82a */
  13949. - #define BCM4329_CORE_ARM_BASE 0x18002000
  13950. --#define BCM4329_RAMSIZE 0x48000
  13951. --/* bcm43143 */
  13952. --#define BCM43143_RAMSIZE 0x70000
  13953. -
  13954. - #define CORE_SB(base, field) \
  13955. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  13956. -@@ -150,6 +147,78 @@ struct sbconfig {
  13957. - u32 sbidhigh; /* identification */
  13958. - };
  13959. -
  13960. -+/* bankidx and bankinfo reg defines corerev >= 8 */
  13961. -+#define SOCRAM_BANKINFO_RETNTRAM_MASK 0x00010000
  13962. -+#define SOCRAM_BANKINFO_SZMASK 0x0000007f
  13963. -+#define SOCRAM_BANKIDX_ROM_MASK 0x00000100
  13964. -+
  13965. -+#define SOCRAM_BANKIDX_MEMTYPE_SHIFT 8
  13966. -+/* socram bankinfo memtype */
  13967. -+#define SOCRAM_MEMTYPE_RAM 0
  13968. -+#define SOCRAM_MEMTYPE_R0M 1
  13969. -+#define SOCRAM_MEMTYPE_DEVRAM 2
  13970. -+
  13971. -+#define SOCRAM_BANKINFO_SZBASE 8192
  13972. -+#define SRCI_LSS_MASK 0x00f00000
  13973. -+#define SRCI_LSS_SHIFT 20
  13974. -+#define SRCI_SRNB_MASK 0xf0
  13975. -+#define SRCI_SRNB_SHIFT 4
  13976. -+#define SRCI_SRBSZ_MASK 0xf
  13977. -+#define SRCI_SRBSZ_SHIFT 0
  13978. -+#define SR_BSZ_BASE 14
  13979. -+
  13980. -+struct sbsocramregs {
  13981. -+ u32 coreinfo;
  13982. -+ u32 bwalloc;
  13983. -+ u32 extracoreinfo;
  13984. -+ u32 biststat;
  13985. -+ u32 bankidx;
  13986. -+ u32 standbyctrl;
  13987. -+
  13988. -+ u32 errlogstatus; /* rev 6 */
  13989. -+ u32 errlogaddr; /* rev 6 */
  13990. -+ /* used for patching rev 3 & 5 */
  13991. -+ u32 cambankidx;
  13992. -+ u32 cambankstandbyctrl;
  13993. -+ u32 cambankpatchctrl;
  13994. -+ u32 cambankpatchtblbaseaddr;
  13995. -+ u32 cambankcmdreg;
  13996. -+ u32 cambankdatareg;
  13997. -+ u32 cambankmaskreg;
  13998. -+ u32 PAD[1];
  13999. -+ u32 bankinfo; /* corev 8 */
  14000. -+ u32 bankpda;
  14001. -+ u32 PAD[14];
  14002. -+ u32 extmemconfig;
  14003. -+ u32 extmemparitycsr;
  14004. -+ u32 extmemparityerrdata;
  14005. -+ u32 extmemparityerrcnt;
  14006. -+ u32 extmemwrctrlandsize;
  14007. -+ u32 PAD[84];
  14008. -+ u32 workaround;
  14009. -+ u32 pwrctl; /* corerev >= 2 */
  14010. -+ u32 PAD[133];
  14011. -+ u32 sr_control; /* corerev >= 15 */
  14012. -+ u32 sr_status; /* corerev >= 15 */
  14013. -+ u32 sr_address; /* corerev >= 15 */
  14014. -+ u32 sr_data; /* corerev >= 15 */
  14015. -+};
  14016. -+
  14017. -+#define SOCRAMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  14018. -+
  14019. -+#define ARMCR4_CAP (0x04)
  14020. -+#define ARMCR4_BANKIDX (0x40)
  14021. -+#define ARMCR4_BANKINFO (0x44)
  14022. -+#define ARMCR4_BANKPDA (0x4C)
  14023. -+
  14024. -+#define ARMCR4_TCBBNB_MASK 0xf0
  14025. -+#define ARMCR4_TCBBNB_SHIFT 4
  14026. -+#define ARMCR4_TCBANB_MASK 0xf
  14027. -+#define ARMCR4_TCBANB_SHIFT 0
  14028. -+
  14029. -+#define ARMCR4_BSZ_MASK 0x3f
  14030. -+#define ARMCR4_BSZ_MULT 8192
  14031. -+
  14032. - struct brcmf_core_priv {
  14033. - struct brcmf_core pub;
  14034. - u32 wrapbase;
  14035. -@@ -443,10 +512,6 @@ static int brcmf_chip_cores_check(struct
  14036. - break;
  14037. - case BCMA_CORE_ARM_CR4:
  14038. - cpu_found = true;
  14039. -- if (ci->pub.rambase == 0) {
  14040. -- brcmf_err("RAM base not provided with ARM CR4 core\n");
  14041. -- return -ENOMEM;
  14042. -- }
  14043. - break;
  14044. - default:
  14045. - break;
  14046. -@@ -462,60 +527,160 @@ static int brcmf_chip_cores_check(struct
  14047. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  14048. - return -ENODEV;
  14049. - }
  14050. -- if (!ci->pub.ramsize) {
  14051. -- brcmf_err("RAM size is undetermined\n");
  14052. -- return -ENOMEM;
  14053. -- }
  14054. - return 0;
  14055. - }
  14056. -
  14057. --static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  14058. -+static u32 brcmf_chip_core_read32(struct brcmf_core_priv *core, u16 reg)
  14059. - {
  14060. -- switch (ci->pub.chip) {
  14061. -- case BRCM_CC_4329_CHIP_ID:
  14062. -- ci->pub.ramsize = BCM4329_RAMSIZE;
  14063. -- break;
  14064. -- case BRCM_CC_43143_CHIP_ID:
  14065. -- ci->pub.ramsize = BCM43143_RAMSIZE;
  14066. -- break;
  14067. -- case BRCM_CC_43241_CHIP_ID:
  14068. -- ci->pub.ramsize = 0x90000;
  14069. -- break;
  14070. -- case BRCM_CC_4330_CHIP_ID:
  14071. -- ci->pub.ramsize = 0x48000;
  14072. -- break;
  14073. -+ return core->chip->ops->read32(core->chip->ctx, core->pub.base + reg);
  14074. -+}
  14075. -+
  14076. -+static void brcmf_chip_core_write32(struct brcmf_core_priv *core,
  14077. -+ u16 reg, u32 val)
  14078. -+{
  14079. -+ core->chip->ops->write32(core->chip->ctx, core->pub.base + reg, val);
  14080. -+}
  14081. -+
  14082. -+static bool brcmf_chip_socram_banksize(struct brcmf_core_priv *core, u8 idx,
  14083. -+ u32 *banksize)
  14084. -+{
  14085. -+ u32 bankinfo;
  14086. -+ u32 bankidx = (SOCRAM_MEMTYPE_RAM << SOCRAM_BANKIDX_MEMTYPE_SHIFT);
  14087. -+
  14088. -+ bankidx |= idx;
  14089. -+ brcmf_chip_core_write32(core, SOCRAMREGOFFS(bankidx), bankidx);
  14090. -+ bankinfo = brcmf_chip_core_read32(core, SOCRAMREGOFFS(bankinfo));
  14091. -+ *banksize = (bankinfo & SOCRAM_BANKINFO_SZMASK) + 1;
  14092. -+ *banksize *= SOCRAM_BANKINFO_SZBASE;
  14093. -+ return !!(bankinfo & SOCRAM_BANKINFO_RETNTRAM_MASK);
  14094. -+}
  14095. -+
  14096. -+static void brcmf_chip_socram_ramsize(struct brcmf_core_priv *sr, u32 *ramsize,
  14097. -+ u32 *srsize)
  14098. -+{
  14099. -+ u32 coreinfo;
  14100. -+ uint nb, banksize, lss;
  14101. -+ bool retent;
  14102. -+ int i;
  14103. -+
  14104. -+ *ramsize = 0;
  14105. -+ *srsize = 0;
  14106. -+
  14107. -+ if (WARN_ON(sr->pub.rev < 4))
  14108. -+ return;
  14109. -+
  14110. -+ if (!brcmf_chip_iscoreup(&sr->pub))
  14111. -+ brcmf_chip_resetcore(&sr->pub, 0, 0, 0);
  14112. -+
  14113. -+ /* Get info for determining size */
  14114. -+ coreinfo = brcmf_chip_core_read32(sr, SOCRAMREGOFFS(coreinfo));
  14115. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  14116. -+
  14117. -+ if ((sr->pub.rev <= 7) || (sr->pub.rev == 12)) {
  14118. -+ banksize = (coreinfo & SRCI_SRBSZ_MASK);
  14119. -+ lss = (coreinfo & SRCI_LSS_MASK) >> SRCI_LSS_SHIFT;
  14120. -+ if (lss != 0)
  14121. -+ nb--;
  14122. -+ *ramsize = nb * (1 << (banksize + SR_BSZ_BASE));
  14123. -+ if (lss != 0)
  14124. -+ *ramsize += (1 << ((lss - 1) + SR_BSZ_BASE));
  14125. -+ } else {
  14126. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  14127. -+ for (i = 0; i < nb; i++) {
  14128. -+ retent = brcmf_chip_socram_banksize(sr, i, &banksize);
  14129. -+ *ramsize += banksize;
  14130. -+ if (retent)
  14131. -+ *srsize += banksize;
  14132. -+ }
  14133. -+ }
  14134. -+
  14135. -+ /* hardcoded save&restore memory sizes */
  14136. -+ switch (sr->chip->pub.chip) {
  14137. - case BRCM_CC_4334_CHIP_ID:
  14138. -- case BRCM_CC_43340_CHIP_ID:
  14139. -- ci->pub.ramsize = 0x80000;
  14140. -+ if (sr->chip->pub.chiprev < 2)
  14141. -+ *srsize = (32 * 1024);
  14142. - break;
  14143. -- case BRCM_CC_4335_CHIP_ID:
  14144. -- ci->pub.ramsize = 0xc0000;
  14145. -- ci->pub.rambase = 0x180000;
  14146. -- break;
  14147. -- case BRCM_CC_43362_CHIP_ID:
  14148. -- ci->pub.ramsize = 0x3c000;
  14149. -+ default:
  14150. - break;
  14151. -+ }
  14152. -+}
  14153. -+
  14154. -+/** Return the TCM-RAM size of the ARMCR4 core. */
  14155. -+static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
  14156. -+{
  14157. -+ u32 corecap;
  14158. -+ u32 memsize = 0;
  14159. -+ u32 nab;
  14160. -+ u32 nbb;
  14161. -+ u32 totb;
  14162. -+ u32 bxinfo;
  14163. -+ u32 idx;
  14164. -+
  14165. -+ corecap = brcmf_chip_core_read32(cr4, ARMCR4_CAP);
  14166. -+
  14167. -+ nab = (corecap & ARMCR4_TCBANB_MASK) >> ARMCR4_TCBANB_SHIFT;
  14168. -+ nbb = (corecap & ARMCR4_TCBBNB_MASK) >> ARMCR4_TCBBNB_SHIFT;
  14169. -+ totb = nab + nbb;
  14170. -+
  14171. -+ for (idx = 0; idx < totb; idx++) {
  14172. -+ brcmf_chip_core_write32(cr4, ARMCR4_BANKIDX, idx);
  14173. -+ bxinfo = brcmf_chip_core_read32(cr4, ARMCR4_BANKINFO);
  14174. -+ memsize += ((bxinfo & ARMCR4_BSZ_MASK) + 1) * ARMCR4_BSZ_MULT;
  14175. -+ }
  14176. -+
  14177. -+ return memsize;
  14178. -+}
  14179. -+
  14180. -+static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
  14181. -+{
  14182. -+ switch (ci->pub.chip) {
  14183. - case BRCM_CC_4345_CHIP_ID:
  14184. -- ci->pub.ramsize = 0xc8000;
  14185. -- ci->pub.rambase = 0x198000;
  14186. -- break;
  14187. -+ return 0x198000;
  14188. -+ case BRCM_CC_4335_CHIP_ID:
  14189. - case BRCM_CC_4339_CHIP_ID:
  14190. - case BRCM_CC_4354_CHIP_ID:
  14191. - case BRCM_CC_4356_CHIP_ID:
  14192. - case BRCM_CC_43567_CHIP_ID:
  14193. - case BRCM_CC_43569_CHIP_ID:
  14194. - case BRCM_CC_43570_CHIP_ID:
  14195. -- ci->pub.ramsize = 0xc0000;
  14196. -- ci->pub.rambase = 0x180000;
  14197. -- break;
  14198. - case BRCM_CC_43602_CHIP_ID:
  14199. -- ci->pub.ramsize = 0xf0000;
  14200. -- ci->pub.rambase = 0x180000;
  14201. -- break;
  14202. -+ return 0x180000;
  14203. - default:
  14204. - brcmf_err("unknown chip: %s\n", ci->pub.name);
  14205. - break;
  14206. - }
  14207. -+ return 0;
  14208. -+}
  14209. -+
  14210. -+static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  14211. -+{
  14212. -+ struct brcmf_core_priv *mem_core;
  14213. -+ struct brcmf_core *mem;
  14214. -+
  14215. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_ARM_CR4);
  14216. -+ if (mem) {
  14217. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  14218. -+ ci->pub.ramsize = brcmf_chip_tcm_ramsize(mem_core);
  14219. -+ ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
  14220. -+ if (!ci->pub.rambase) {
  14221. -+ brcmf_err("RAM base not provided with ARM CR4 core\n");
  14222. -+ return -EINVAL;
  14223. -+ }
  14224. -+ } else {
  14225. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_INTERNAL_MEM);
  14226. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  14227. -+ brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  14228. -+ &ci->pub.srsize);
  14229. -+ }
  14230. -+ brcmf_dbg(INFO, "RAM: base=0x%x size=%d (0x%x) sr=%d (0x%x)\n",
  14231. -+ ci->pub.rambase, ci->pub.ramsize, ci->pub.ramsize,
  14232. -+ ci->pub.srsize, ci->pub.srsize);
  14233. -+
  14234. -+ if (!ci->pub.ramsize) {
  14235. -+ brcmf_err("RAM size is undetermined\n");
  14236. -+ return -ENOMEM;
  14237. -+ }
  14238. -+ return 0;
  14239. - }
  14240. -
  14241. - static u32 brcmf_chip_dmp_get_desc(struct brcmf_chip_priv *ci, u32 *eromaddr,
  14242. -@@ -668,6 +833,7 @@ static int brcmf_chip_recognition(struct
  14243. - struct brcmf_core *core;
  14244. - u32 regdata;
  14245. - u32 socitype;
  14246. -+ int ret;
  14247. -
  14248. - /* Get CC core rev
  14249. - * Chipid is assume to be at offset 0 from SI_ENUM_BASE
  14250. -@@ -720,9 +886,13 @@ static int brcmf_chip_recognition(struct
  14251. - return -ENODEV;
  14252. - }
  14253. -
  14254. -- brcmf_chip_get_raminfo(ci);
  14255. --
  14256. -- return brcmf_chip_cores_check(ci);
  14257. -+ ret = brcmf_chip_cores_check(ci);
  14258. -+ if (ret)
  14259. -+ return ret;
  14260. -+
  14261. -+ /* assure chip is passive for core access */
  14262. -+ brcmf_chip_set_passive(&ci->pub);
  14263. -+ return brcmf_chip_get_raminfo(ci);
  14264. - }
  14265. -
  14266. - static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id)
  14267. -@@ -827,8 +997,6 @@ struct brcmf_chip *brcmf_chip_attach(voi
  14268. - if (err < 0)
  14269. - goto fail;
  14270. -
  14271. -- /* assure chip is passive for download */
  14272. -- brcmf_chip_set_passive(&chip->pub);
  14273. - return &chip->pub;
  14274. -
  14275. - fail:
  14276. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  14277. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  14278. -@@ -30,7 +30,8 @@
  14279. - * @pmucaps: PMU capabilities.
  14280. - * @pmurev: PMU revision.
  14281. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  14282. -- * @ramsize: amount of RAM on chip.
  14283. -+ * @ramsize: amount of RAM on chip including retention.
  14284. -+ * @srsize: amount of retention RAM on chip.
  14285. - * @name: string representation of the chip identifier.
  14286. - */
  14287. - struct brcmf_chip {
  14288. -@@ -41,6 +42,7 @@ struct brcmf_chip {
  14289. - u32 pmurev;
  14290. - u32 rambase;
  14291. - u32 ramsize;
  14292. -+ u32 srsize;
  14293. - char name[8];
  14294. - };
  14295. -
  14296. 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
  14297. deleted file mode 100644
  14298. index 69618a7..0000000
  14299. --- a/package/kernel/mac80211/patches/344-brcmfmac-take-save-restore-memory-into-account-for-S.patch
  14300. +++ /dev/null
  14301. @@ -1,96 +0,0 @@
  14302. -From: Arend van Spriel <arend@broadcom.com>
  14303. -Date: Wed, 11 Mar 2015 16:11:32 +0100
  14304. -Subject: [PATCH] brcmfmac: take save&restore memory into account for SDIO
  14305. - shared info
  14306. -
  14307. -The firmware provides pointer to SDIO shared information at end of
  14308. -RAM during firmware initialization. End of RAM is obviously determined
  14309. -by the actual ram size, but part of that may be used for save&restore
  14310. -memory. In that case another location in RAM will hold the pointer.
  14311. -
  14312. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14313. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14314. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14315. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14316. ----
  14317. -
  14318. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14319. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14320. -@@ -1067,44 +1067,47 @@ static inline bool brcmf_sdio_valid_shar
  14321. - static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
  14322. - struct sdpcm_shared *sh)
  14323. - {
  14324. -- u32 addr;
  14325. -+ u32 addr = 0;
  14326. - int rv;
  14327. - u32 shaddr = 0;
  14328. - struct sdpcm_shared_le sh_le;
  14329. - __le32 addr_le;
  14330. -
  14331. -- shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  14332. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14333. -+ brcmf_sdio_bus_sleep(bus, false, false);
  14334. -
  14335. - /*
  14336. - * Read last word in socram to determine
  14337. - * address of sdpcm_shared structure
  14338. - */
  14339. -- sdio_claim_host(bus->sdiodev->func[1]);
  14340. -- brcmf_sdio_bus_sleep(bus, false, false);
  14341. -- rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4);
  14342. -- sdio_release_host(bus->sdiodev->func[1]);
  14343. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  14344. -+ if (!bus->ci->rambase && brcmf_chip_sr_capable(bus->ci))
  14345. -+ shaddr -= bus->ci->srsize;
  14346. -+ rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr,
  14347. -+ (u8 *)&addr_le, 4);
  14348. - if (rv < 0)
  14349. -- return rv;
  14350. --
  14351. -- addr = le32_to_cpu(addr_le);
  14352. --
  14353. -- brcmf_dbg(SDIO, "sdpcm_shared address 0x%08X\n", addr);
  14354. -+ goto fail;
  14355. -
  14356. - /*
  14357. - * Check if addr is valid.
  14358. - * NVRAM length at the end of memory should have been overwritten.
  14359. - */
  14360. -+ addr = le32_to_cpu(addr_le);
  14361. - if (!brcmf_sdio_valid_shared_address(addr)) {
  14362. -- brcmf_err("invalid sdpcm_shared address 0x%08X\n",
  14363. -- addr);
  14364. -- return -EINVAL;
  14365. -+ brcmf_err("invalid sdpcm_shared address 0x%08X\n", addr);
  14366. -+ rv = -EINVAL;
  14367. -+ goto fail;
  14368. - }
  14369. -
  14370. -+ brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr);
  14371. -+
  14372. - /* Read hndrte_shared structure */
  14373. - rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, (u8 *)&sh_le,
  14374. - sizeof(struct sdpcm_shared_le));
  14375. - if (rv < 0)
  14376. -- return rv;
  14377. -+ goto fail;
  14378. -+
  14379. -+ sdio_release_host(bus->sdiodev->func[1]);
  14380. -
  14381. - /* Endianness */
  14382. - sh->flags = le32_to_cpu(sh_le.flags);
  14383. -@@ -1121,8 +1124,13 @@ static int brcmf_sdio_readshared(struct
  14384. - sh->flags & SDPCM_SHARED_VERSION_MASK);
  14385. - return -EPROTO;
  14386. - }
  14387. --
  14388. - return 0;
  14389. -+
  14390. -+fail:
  14391. -+ brcmf_err("unable to obtain sdpcm_shared info: rv=%d (addr=0x%x)\n",
  14392. -+ rv, addr);
  14393. -+ sdio_release_host(bus->sdiodev->func[1]);
  14394. -+ return rv;
  14395. - }
  14396. -
  14397. - static void brcmf_sdio_get_console_addr(struct brcmf_sdio *bus)
  14398. 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
  14399. deleted file mode 100644
  14400. index 1b10dbb..0000000
  14401. --- a/package/kernel/mac80211/patches/345-brcmfmac-fix-watchdog-timer-regression.patch
  14402. +++ /dev/null
  14403. @@ -1,59 +0,0 @@
  14404. -From: Arend van Spriel <arend@broadcom.com>
  14405. -Date: Wed, 11 Mar 2015 16:11:33 +0100
  14406. -Subject: [PATCH] brcmfmac: fix watchdog timer regression
  14407. -
  14408. -The watchdog timer is used to put the device in a low-power mode when
  14409. -it is idle for some time. This timer is stopped during that mode and
  14410. -should be restarted upon activity. This has been broken by commit
  14411. -d4150fced0365 ("brcmfmac: Simplify watchdog sleep."). This patch
  14412. -restores the behaviour as it was before that commit.
  14413. -
  14414. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  14415. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14416. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14417. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14418. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14419. ----
  14420. -
  14421. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14422. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14423. -@@ -972,7 +972,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14424. - brcmf_sdio_sdclk(bus, true);
  14425. - /* Now request HT Avail on the backplane */
  14426. - brcmf_sdio_htclk(bus, true, pendok);
  14427. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14428. - break;
  14429. -
  14430. - case CLK_SDONLY:
  14431. -@@ -984,7 +983,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14432. - else
  14433. - brcmf_err("request for %d -> %d\n",
  14434. - bus->clkstate, target);
  14435. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14436. - break;
  14437. -
  14438. - case CLK_NONE:
  14439. -@@ -993,7 +991,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14440. - brcmf_sdio_htclk(bus, false, false);
  14441. - /* Now remove the SD clock */
  14442. - brcmf_sdio_sdclk(bus, false);
  14443. -- brcmf_sdio_wd_timer(bus, 0);
  14444. - break;
  14445. - }
  14446. - #ifdef DEBUG
  14447. -@@ -1048,6 +1045,7 @@ end:
  14448. - brcmf_sdio_clkctl(bus, CLK_NONE, pendok);
  14449. - } else {
  14450. - brcmf_sdio_clkctl(bus, CLK_AVAIL, pendok);
  14451. -+ brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14452. - }
  14453. - bus->sleeping = sleep;
  14454. - brcmf_dbg(SDIO, "new state %s\n",
  14455. -@@ -4242,6 +4240,7 @@ void brcmf_sdio_remove(struct brcmf_sdio
  14456. - if (bus->ci) {
  14457. - if (bus->sdiodev->state != BRCMF_SDIOD_NOMEDIUM) {
  14458. - sdio_claim_host(bus->sdiodev->func[1]);
  14459. -+ brcmf_sdio_wd_timer(bus, 0);
  14460. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  14461. - /* Leave the device in state where it is
  14462. - * 'passive'. This is done by resetting all
  14463. 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
  14464. deleted file mode 100644
  14465. index af76f13..0000000
  14466. --- a/package/kernel/mac80211/patches/346-brcmfmac-avoid-runtime-pm-for-sdio-host-controller.patch
  14467. +++ /dev/null
  14468. @@ -1,44 +0,0 @@
  14469. -From: Arend van Spriel <arend@broadcom.com>
  14470. -Date: Wed, 18 Mar 2015 13:25:21 +0100
  14471. -Subject: [PATCH] brcmfmac: avoid runtime-pm for sdio host controller
  14472. -
  14473. -Several host controllers supporting runtime-pm are causing issues
  14474. -with our sdio wireless cards because they disable the sdio interrupt
  14475. -upon going into runtime suspend. This patch avoids that by doing
  14476. -a pm_runtime_forbid() call during the probe. Tested with Sony Vaio
  14477. -Duo 13 which uses sdhci-acpi host controller.
  14478. -
  14479. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14480. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14481. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14482. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14483. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14484. ----
  14485. -
  14486. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14487. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14488. -@@ -29,6 +29,7 @@
  14489. - #include <linux/mmc/host.h>
  14490. - #include <linux/platform_device.h>
  14491. - #include <linux/platform_data/brcmfmac-sdio.h>
  14492. -+#include <linux/pm_runtime.h>
  14493. - #include <linux/suspend.h>
  14494. - #include <linux/errno.h>
  14495. - #include <linux/module.h>
  14496. -@@ -1006,6 +1007,7 @@ static int brcmf_sdiod_remove(struct brc
  14497. - sg_free_table(&sdiodev->sgtable);
  14498. - sdiodev->sbwad = 0;
  14499. -
  14500. -+ pm_runtime_allow(sdiodev->func[1]->card->host->parent);
  14501. - return 0;
  14502. - }
  14503. -
  14504. -@@ -1074,7 +1076,7 @@ static int brcmf_sdiod_probe(struct brcm
  14505. - ret = -ENODEV;
  14506. - goto out;
  14507. - }
  14508. --
  14509. -+ pm_runtime_forbid(host->parent);
  14510. - out:
  14511. - if (ret)
  14512. - brcmf_sdiod_remove(sdiodev);
  14513. 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
  14514. deleted file mode 100644
  14515. index c419cc6..0000000
  14516. --- a/package/kernel/mac80211/patches/347-brcmfmac-Add-necessary-memory-barriers-for-SDIO.patch
  14517. +++ /dev/null
  14518. @@ -1,171 +0,0 @@
  14519. -From: Hante Meuleman <meuleman@broadcom.com>
  14520. -Date: Wed, 18 Mar 2015 13:25:22 +0100
  14521. -Subject: [PATCH] brcmfmac: Add necessary memory barriers for SDIO.
  14522. -
  14523. -SDIO uses a thread to handle all communication with the device,
  14524. -for this data is exchanged between threads. This data needs proper
  14525. -memory barriers to make sure that data "exchange" is going correct.
  14526. -
  14527. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14528. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14529. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14530. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14531. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14532. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14533. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14534. ----
  14535. -
  14536. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14537. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14538. -@@ -507,8 +507,8 @@ struct brcmf_sdio {
  14539. -
  14540. - struct workqueue_struct *brcmf_wq;
  14541. - struct work_struct datawork;
  14542. -- atomic_t dpc_tskcnt;
  14543. -- atomic_t dpc_running;
  14544. -+ bool dpc_triggered;
  14545. -+ bool dpc_running;
  14546. -
  14547. - bool txoff; /* Transmit flow-controlled */
  14548. - struct brcmf_sdio_count sdcnt;
  14549. -@@ -2713,6 +2713,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  14550. - err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  14551. - bus->ctrl_frame_len);
  14552. - bus->ctrl_frame_err = err;
  14553. -+ wmb();
  14554. - bus->ctrl_frame_stat = false;
  14555. - }
  14556. - sdio_release_host(bus->sdiodev->func[1]);
  14557. -@@ -2734,6 +2735,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  14558. - sdio_claim_host(bus->sdiodev->func[1]);
  14559. - if (bus->ctrl_frame_stat) {
  14560. - bus->ctrl_frame_err = -ENODEV;
  14561. -+ wmb();
  14562. - bus->ctrl_frame_stat = false;
  14563. - brcmf_sdio_wait_event_wakeup(bus);
  14564. - }
  14565. -@@ -2744,7 +2746,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  14566. - (!atomic_read(&bus->fcstate) &&
  14567. - brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  14568. - data_ok(bus))) {
  14569. -- atomic_inc(&bus->dpc_tskcnt);
  14570. -+ bus->dpc_triggered = true;
  14571. - }
  14572. - }
  14573. -
  14574. -@@ -2940,6 +2942,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  14575. - /* Send from dpc */
  14576. - bus->ctrl_frame_buf = msg;
  14577. - bus->ctrl_frame_len = msglen;
  14578. -+ wmb();
  14579. - bus->ctrl_frame_stat = true;
  14580. -
  14581. - brcmf_sdio_trigger_dpc(bus);
  14582. -@@ -2958,6 +2961,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  14583. - if (!ret) {
  14584. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  14585. - bus->ctrl_frame_err);
  14586. -+ rmb();
  14587. - ret = bus->ctrl_frame_err;
  14588. - }
  14589. -
  14590. -@@ -3526,8 +3530,8 @@ done:
  14591. -
  14592. - void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus)
  14593. - {
  14594. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  14595. -- atomic_inc(&bus->dpc_tskcnt);
  14596. -+ if (!bus->dpc_triggered) {
  14597. -+ bus->dpc_triggered = true;
  14598. - queue_work(bus->brcmf_wq, &bus->datawork);
  14599. - }
  14600. - }
  14601. -@@ -3558,7 +3562,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  14602. - if (!bus->intr)
  14603. - brcmf_err("isr w/o interrupt configured!\n");
  14604. -
  14605. -- atomic_inc(&bus->dpc_tskcnt);
  14606. -+ bus->dpc_triggered = true;
  14607. - queue_work(bus->brcmf_wq, &bus->datawork);
  14608. - }
  14609. -
  14610. -@@ -3578,7 +3582,7 @@ static void brcmf_sdio_bus_watchdog(stru
  14611. - if (!bus->intr ||
  14612. - (bus->sdcnt.intrcount == bus->sdcnt.lastintrs)) {
  14613. -
  14614. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  14615. -+ if (!bus->dpc_triggered) {
  14616. - u8 devpend;
  14617. -
  14618. - sdio_claim_host(bus->sdiodev->func[1]);
  14619. -@@ -3596,7 +3600,7 @@ static void brcmf_sdio_bus_watchdog(stru
  14620. - bus->sdcnt.pollcnt++;
  14621. - atomic_set(&bus->ipend, 1);
  14622. -
  14623. -- atomic_inc(&bus->dpc_tskcnt);
  14624. -+ bus->dpc_triggered = true;
  14625. - queue_work(bus->brcmf_wq, &bus->datawork);
  14626. - }
  14627. - }
  14628. -@@ -3623,17 +3627,21 @@ static void brcmf_sdio_bus_watchdog(stru
  14629. - #endif /* DEBUG */
  14630. -
  14631. - /* On idle timeout clear activity flag and/or turn off clock */
  14632. -- if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  14633. -- (atomic_read(&bus->dpc_running) == 0) &&
  14634. -- (bus->idletime > 0) && (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. -+ if (!bus->dpc_triggered) {
  14641. -+ rmb();
  14642. -+ if ((!bus->dpc_running) && (bus->idletime > 0) &&
  14643. -+ (bus->clkstate == CLK_AVAIL)) {
  14644. -+ bus->idlecount++;
  14645. -+ if (bus->idlecount > bus->idletime) {
  14646. -+ brcmf_dbg(SDIO, "idle\n");
  14647. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14648. -+ brcmf_sdio_wd_timer(bus, 0);
  14649. -+ bus->idlecount = 0;
  14650. -+ brcmf_sdio_bus_sleep(bus, true, false);
  14651. -+ sdio_release_host(bus->sdiodev->func[1]);
  14652. -+ }
  14653. -+ } else {
  14654. - bus->idlecount = 0;
  14655. -- brcmf_sdio_bus_sleep(bus, true, false);
  14656. -- sdio_release_host(bus->sdiodev->func[1]);
  14657. - }
  14658. - } else {
  14659. - bus->idlecount = 0;
  14660. -@@ -3645,13 +3653,14 @@ static void brcmf_sdio_dataworker(struct
  14661. - struct brcmf_sdio *bus = container_of(work, struct brcmf_sdio,
  14662. - datawork);
  14663. -
  14664. -- while (atomic_read(&bus->dpc_tskcnt)) {
  14665. -- atomic_set(&bus->dpc_running, 1);
  14666. -- atomic_set(&bus->dpc_tskcnt, 0);
  14667. -+ bus->dpc_running = true;
  14668. -+ wmb();
  14669. -+ while (ACCESS_ONCE(bus->dpc_triggered)) {
  14670. -+ bus->dpc_triggered = false;
  14671. - brcmf_sdio_dpc(bus);
  14672. - bus->idlecount = 0;
  14673. -- atomic_set(&bus->dpc_running, 0);
  14674. - }
  14675. -+ bus->dpc_running = false;
  14676. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  14677. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  14678. - brcmf_sdiod_try_freeze(bus->sdiodev);
  14679. -@@ -4144,8 +4153,8 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  14680. - bus->watchdog_tsk = NULL;
  14681. - }
  14682. - /* Initialize DPC thread */
  14683. -- atomic_set(&bus->dpc_tskcnt, 0);
  14684. -- atomic_set(&bus->dpc_running, 0);
  14685. -+ bus->dpc_triggered = false;
  14686. -+ bus->dpc_running = false;
  14687. -
  14688. - /* Assign bus interface call back */
  14689. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  14690. 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
  14691. deleted file mode 100644
  14692. index 1bc98a0..0000000
  14693. --- a/package/kernel/mac80211/patches/348-brcmfmac-Remove-unnecessary-new-line-in-pcie-console.patch
  14694. +++ /dev/null
  14695. @@ -1,26 +0,0 @@
  14696. -From: Hante Meuleman <meuleman@broadcom.com>
  14697. -Date: Wed, 18 Mar 2015 13:25:24 +0100
  14698. -Subject: [PATCH] brcmfmac: Remove unnecessary new-line in pcie console
  14699. - logging.
  14700. -
  14701. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14702. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14703. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14704. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14705. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14706. ----
  14707. -
  14708. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14709. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14710. -@@ -651,10 +651,9 @@ static void brcmf_pcie_bus_console_read(
  14711. - console->log_str[console->log_idx] = ch;
  14712. - console->log_idx++;
  14713. - }
  14714. --
  14715. - if (ch == '\n') {
  14716. - console->log_str[console->log_idx] = 0;
  14717. -- brcmf_dbg(PCIE, "CONSOLE: %s\n", console->log_str);
  14718. -+ brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  14719. - console->log_idx = 0;
  14720. - }
  14721. - }
  14722. 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
  14723. deleted file mode 100644
  14724. index fcf0bf3..0000000
  14725. --- a/package/kernel/mac80211/patches/349-brcmfmac-add-MODULE_FIRMWARE-macros-for-bcm4356-PCIe.patch
  14726. +++ /dev/null
  14727. @@ -1,26 +0,0 @@
  14728. -From: Arend van Spriel <arend@broadcom.com>
  14729. -Date: Wed, 18 Mar 2015 13:25:25 +0100
  14730. -Subject: [PATCH] brcmfmac: add MODULE_FIRMWARE() macros for bcm4356 PCIe
  14731. - device
  14732. -
  14733. -The BCM4356 PCIe wireless device was added recently but overlooked
  14734. -the fact that the MODULE_FIRMWARE() macros were missing for the
  14735. -firmwares needed by this device.
  14736. -
  14737. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14738. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14739. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14740. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14741. ----
  14742. -
  14743. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14744. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14745. -@@ -189,6 +189,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME
  14746. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  14747. - MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  14748. - MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  14749. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  14750. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  14751. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  14752. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  14753. -
  14754. 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
  14755. deleted file mode 100644
  14756. index b3e9bc9..0000000
  14757. --- a/package/kernel/mac80211/patches/350-brcmfmac-add-support-for-BCM43430-SDIO-chipset.patch
  14758. +++ /dev/null
  14759. @@ -1,138 +0,0 @@
  14760. -From: Arend van Spriel <arend@broadcom.com>
  14761. -Date: Wed, 18 Mar 2015 13:25:26 +0100
  14762. -Subject: [PATCH] brcmfmac: add support for BCM43430 SDIO chipset
  14763. -
  14764. -This patch added support for the BCM43430 802.11n SDIO chipset.
  14765. -
  14766. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14767. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14768. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14769. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14770. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14771. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14772. ----
  14773. -
  14774. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14775. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14776. -@@ -1098,6 +1098,7 @@ static const struct sdio_device_id brcmf
  14777. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  14778. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  14779. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  14780. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
  14781. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  14782. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  14783. - { /* end: all zeroes */ }
  14784. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14785. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14786. -@@ -600,6 +600,12 @@ static void brcmf_chip_socram_ramsize(st
  14787. - if (sr->chip->pub.chiprev < 2)
  14788. - *srsize = (32 * 1024);
  14789. - break;
  14790. -+ case BRCM_CC_43430_CHIP_ID:
  14791. -+ /* assume sr for now as we can not check
  14792. -+ * firmware sr capability at this point.
  14793. -+ */
  14794. -+ *srsize = (64 * 1024);
  14795. -+ break;
  14796. - default:
  14797. - break;
  14798. - }
  14799. -@@ -1072,6 +1078,7 @@ static void
  14800. - brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  14801. - {
  14802. - struct brcmf_core *core;
  14803. -+ struct brcmf_core_priv *sr;
  14804. -
  14805. - brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  14806. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_80211);
  14807. -@@ -1081,6 +1088,13 @@ brcmf_chip_cm3_set_passive(struct brcmf_
  14808. - D11_BCMA_IOCTL_PHYCLOCKEN);
  14809. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_INTERNAL_MEM);
  14810. - brcmf_chip_resetcore(core, 0, 0, 0);
  14811. -+
  14812. -+ /* disable bank #3 remap for this device */
  14813. -+ if (chip->pub.chip == BRCM_CC_43430_CHIP_ID) {
  14814. -+ sr = container_of(core, struct brcmf_core_priv, pub);
  14815. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankidx), 3);
  14816. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankpda), 0);
  14817. -+ }
  14818. - }
  14819. -
  14820. - static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  14821. -@@ -1188,6 +1202,10 @@ bool brcmf_chip_sr_capable(struct brcmf_
  14822. - addr = CORE_CC_REG(base, chipcontrol_data);
  14823. - reg = chip->ops->read32(chip->ctx, addr);
  14824. - return (reg & pmu_cc3_mask) != 0;
  14825. -+ case BRCM_CC_43430_CHIP_ID:
  14826. -+ addr = CORE_CC_REG(base, sr_control1);
  14827. -+ reg = chip->ops->read32(chip->ctx, addr);
  14828. -+ return reg != 0;
  14829. - default:
  14830. - addr = CORE_CC_REG(base, pmucapabilities_ext);
  14831. - reg = chip->ops->read32(chip->ctx, addr);
  14832. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14833. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14834. -@@ -615,6 +615,8 @@ static const struct sdiod_drive_str sdio
  14835. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  14836. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  14837. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  14838. -+#define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  14839. -+#define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  14840. - #define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  14841. - #define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  14842. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  14843. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  14844. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  14845. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  14846. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  14847. -+MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  14848. -+MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  14849. - MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  14850. - MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  14851. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  14852. -@@ -671,6 +675,7 @@ static const struct brcmf_firmware_names
  14853. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  14854. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  14855. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  14856. -+ { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  14857. - { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  14858. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  14859. - };
  14860. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  14861. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  14862. -@@ -37,6 +37,7 @@
  14863. - #define BRCM_CC_43362_CHIP_ID 43362
  14864. - #define BRCM_CC_4335_CHIP_ID 0x4335
  14865. - #define BRCM_CC_4339_CHIP_ID 0x4339
  14866. -+#define BRCM_CC_43430_CHIP_ID 43430
  14867. - #define BRCM_CC_4345_CHIP_ID 0x4345
  14868. - #define BRCM_CC_4354_CHIP_ID 0x4354
  14869. - #define BRCM_CC_4356_CHIP_ID 0x4356
  14870. ---- a/drivers/net/wireless/brcm80211/include/chipcommon.h
  14871. -+++ b/drivers/net/wireless/brcm80211/include/chipcommon.h
  14872. -@@ -183,7 +183,14 @@ struct chipcregs {
  14873. - u8 uart1lsr;
  14874. - u8 uart1msr;
  14875. - u8 uart1scratch;
  14876. -- u32 PAD[126];
  14877. -+ u32 PAD[62];
  14878. -+
  14879. -+ /* save/restore, corerev >= 48 */
  14880. -+ u32 sr_capability; /* 0x500 */
  14881. -+ u32 sr_control0; /* 0x504 */
  14882. -+ u32 sr_control1; /* 0x508 */
  14883. -+ u32 gpio_control; /* 0x50C */
  14884. -+ u32 PAD[60];
  14885. -
  14886. - /* PMU registers (corerev >= 20) */
  14887. - u32 pmucontrol; /* 0x600 */
  14888. ---- a/include/linux/mmc/sdio_ids.h
  14889. -+++ b/include/linux/mmc/sdio_ids.h
  14890. -@@ -33,6 +33,7 @@
  14891. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  14892. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  14893. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  14894. -+#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
  14895. - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  14896. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  14897. -
  14898. 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
  14899. deleted file mode 100644
  14900. index c3d7bc2..0000000
  14901. --- a/package/kernel/mac80211/patches/351-brcmfmac-only-support-the-BCM43455-7-device.patch
  14902. +++ /dev/null
  14903. @@ -1,50 +0,0 @@
  14904. -From: Arend van Spriel <arend@broadcom.com>
  14905. -Date: Wed, 18 Mar 2015 13:25:27 +0100
  14906. -Subject: [PATCH] brcmfmac: only support the BCM43455/7 device
  14907. -
  14908. -Recently support was added for the BCM4345 SDIO chipset by
  14909. -commit 9c51026509d7 ("brcmfmac: Add support for BCM4345 SDIO chipset")
  14910. -however this was verified using a BCM43455 device, which is
  14911. -a more recent revision of the chip. This patch assure that
  14912. -older revisions are not probed as they would fail.
  14913. -
  14914. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14915. -Reviewed-by: Syed Asifful Dayyan <syedd@broadcom.com>
  14916. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14917. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14918. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14919. ----
  14920. -
  14921. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14922. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14923. -@@ -617,8 +617,8 @@ static const struct sdiod_drive_str sdio
  14924. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  14925. - #define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  14926. - #define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  14927. --#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  14928. --#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  14929. -+#define BCM43455_FIRMWARE_NAME "brcm/brcmfmac43455-sdio.bin"
  14930. -+#define BCM43455_NVRAM_NAME "brcm/brcmfmac43455-sdio.txt"
  14931. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  14932. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  14933. -
  14934. -@@ -644,8 +644,8 @@ MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  14935. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  14936. - MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  14937. - MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  14938. --MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  14939. --MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  14940. -+MODULE_FIRMWARE(BCM43455_FIRMWARE_NAME);
  14941. -+MODULE_FIRMWARE(BCM43455_NVRAM_NAME);
  14942. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  14943. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  14944. -
  14945. -@@ -676,7 +676,7 @@ static const struct brcmf_firmware_names
  14946. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  14947. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  14948. - { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  14949. -- { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  14950. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43455) },
  14951. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  14952. - };
  14953. -
  14954. 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
  14955. deleted file mode 100644
  14956. index a62cfdf..0000000
  14957. --- a/package/kernel/mac80211/patches/352-brcmfmac-remove-support-for-unreleased-BCM4354-PCIe.patch
  14958. +++ /dev/null
  14959. @@ -1,52 +0,0 @@
  14960. -From: Arend van Spriel <arend@broadcom.com>
  14961. -Date: Wed, 18 Mar 2015 13:25:28 +0100
  14962. -Subject: [PATCH] brcmfmac: remove support for unreleased BCM4354 PCIe
  14963. -
  14964. -There are no known BCM4354 PCIe devices released so removing
  14965. -support from the driver until proven otherwise.
  14966. -
  14967. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14968. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14969. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14970. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14971. ----
  14972. -
  14973. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14974. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14975. -@@ -47,8 +47,6 @@ enum brcmf_pcie_state {
  14976. -
  14977. - #define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  14978. - #define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  14979. --#define BRCMF_PCIE_4354_FW_NAME "brcm/brcmfmac4354-pcie.bin"
  14980. --#define BRCMF_PCIE_4354_NVRAM_NAME "brcm/brcmfmac4354-pcie.txt"
  14981. - #define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  14982. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  14983. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  14984. -@@ -187,8 +185,6 @@ enum brcmf_pcie_state {
  14985. -
  14986. - MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  14987. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  14988. --MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  14989. --MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  14990. - MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  14991. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  14992. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  14993. -@@ -1327,10 +1323,6 @@ static int brcmf_pcie_get_fwnames(struct
  14994. - fw_name = BRCMF_PCIE_43602_FW_NAME;
  14995. - nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  14996. - break;
  14997. -- case BRCM_CC_4354_CHIP_ID:
  14998. -- fw_name = BRCMF_PCIE_4354_FW_NAME;
  14999. -- nvram_name = BRCMF_PCIE_4354_NVRAM_NAME;
  15000. -- break;
  15001. - case BRCM_CC_4356_CHIP_ID:
  15002. - fw_name = BRCMF_PCIE_4356_FW_NAME;
  15003. - nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  15004. -@@ -1855,7 +1847,6 @@ cleanup:
  15005. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  15006. -
  15007. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  15008. -- BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_DEVICE_ID),
  15009. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  15010. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  15011. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  15012. 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
  15013. deleted file mode 100644
  15014. index 366ff85..0000000
  15015. --- a/package/kernel/mac80211/patches/353-brcmfmac-disable-MBSS-feature-for-BCM43362.patch
  15016. +++ /dev/null
  15017. @@ -1,28 +0,0 @@
  15018. -From: Arend van Spriel <arend@broadcom.com>
  15019. -Date: Fri, 20 Mar 2015 22:18:17 +0100
  15020. -Subject: [PATCH] brcmfmac: disable MBSS feature for BCM43362
  15021. -
  15022. -The BCM43362 firmware falsely reports it is capable of providing
  15023. -MBSS. As a result AP mode no longer works for this device. Therefor
  15024. -disable MBSS in the driver for this chipset.
  15025. -
  15026. -Cc: stable@vger.kernel.org # 3.19.y
  15027. -Reported-by: Jorg Krause <jkrause@posteo.de>
  15028. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15029. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15030. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15031. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15032. ----
  15033. -
  15034. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15035. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15036. -@@ -126,7 +126,8 @@ void brcmf_feat_attach(struct brcmf_pub
  15037. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  15038. - if (drvr->bus_if->wowl_supported)
  15039. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  15040. -- brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  15041. -+ if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  15042. -+ brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  15043. -
  15044. - /* set chip related quirks */
  15045. - switch (drvr->bus_if->chip) {
  15046. 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
  15047. deleted file mode 100644
  15048. index 6e461f6..0000000
  15049. --- a/package/kernel/mac80211/patches/354-brcmfmac-use-static-superset-of-channels-for-wiphy-b.patch
  15050. +++ /dev/null
  15051. @@ -1,300 +0,0 @@
  15052. -From: Arend van Spriel <arend@broadcom.com>
  15053. -Date: Tue, 14 Apr 2015 20:10:24 +0200
  15054. -Subject: [PATCH] brcmfmac: use static superset of channels for wiphy
  15055. - bands
  15056. -
  15057. -The driver was constructing a list of channels per wiphy band
  15058. -by querying the device. This list is not what the hardware is
  15059. -able to do as it is already filtered by the country setting in
  15060. -the device. As user-space may change the country this would
  15061. -require updating the channel list which is not recommended [1].
  15062. -This patch introduces a superset of channels. The individual
  15063. -channels are disabled appropriately by querying the device.
  15064. -
  15065. -[1] http://mid.gmane.org/1426706320.3001.21.camel@sipsolutions.net
  15066. -
  15067. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15068. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15069. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15070. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15071. ----
  15072. -
  15073. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15074. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15075. -@@ -129,13 +129,47 @@ static struct ieee80211_rate __wl_rates[
  15076. - RATETAB_ENT(BRCM_RATE_54M, 0),
  15077. - };
  15078. -
  15079. --#define wl_a_rates (__wl_rates + 4)
  15080. --#define wl_a_rates_size 8
  15081. - #define wl_g_rates (__wl_rates + 0)
  15082. --#define wl_g_rates_size 12
  15083. -+#define wl_g_rates_size ARRAY_SIZE(__wl_rates)
  15084. -+#define wl_a_rates (__wl_rates + 4)
  15085. -+#define wl_a_rates_size (wl_g_rates_size - 4)
  15086. -+
  15087. -+#define CHAN2G(_channel, _freq) { \
  15088. -+ .band = IEEE80211_BAND_2GHZ, \
  15089. -+ .center_freq = (_freq), \
  15090. -+ .hw_value = (_channel), \
  15091. -+ .flags = IEEE80211_CHAN_DISABLED, \
  15092. -+ .max_antenna_gain = 0, \
  15093. -+ .max_power = 30, \
  15094. -+}
  15095. -+
  15096. -+#define CHAN5G(_channel) { \
  15097. -+ .band = IEEE80211_BAND_5GHZ, \
  15098. -+ .center_freq = 5000 + (5 * (_channel)), \
  15099. -+ .hw_value = (_channel), \
  15100. -+ .flags = IEEE80211_CHAN_DISABLED, \
  15101. -+ .max_antenna_gain = 0, \
  15102. -+ .max_power = 30, \
  15103. -+}
  15104. -+
  15105. -+static struct ieee80211_channel __wl_2ghz_channels[] = {
  15106. -+ CHAN2G(1, 2412), CHAN2G(2, 2417), CHAN2G(3, 2422), CHAN2G(4, 2427),
  15107. -+ CHAN2G(5, 2432), CHAN2G(6, 2437), CHAN2G(7, 2442), CHAN2G(8, 2447),
  15108. -+ CHAN2G(9, 2452), CHAN2G(10, 2457), CHAN2G(11, 2462), CHAN2G(12, 2467),
  15109. -+ CHAN2G(13, 2472), CHAN2G(14, 2484)
  15110. -+};
  15111. -+
  15112. -+static struct ieee80211_channel __wl_5ghz_channels[] = {
  15113. -+ CHAN5G(34), CHAN5G(36), CHAN5G(38), CHAN5G(40), CHAN5G(42),
  15114. -+ CHAN5G(44), CHAN5G(46), CHAN5G(48), CHAN5G(52), CHAN5G(56),
  15115. -+ CHAN5G(60), CHAN5G(64), CHAN5G(100), CHAN5G(104), CHAN5G(108),
  15116. -+ CHAN5G(112), CHAN5G(116), CHAN5G(120), CHAN5G(124), CHAN5G(128),
  15117. -+ CHAN5G(132), CHAN5G(136), CHAN5G(140), CHAN5G(144), CHAN5G(149),
  15118. -+ CHAN5G(153), CHAN5G(157), CHAN5G(161), CHAN5G(165)
  15119. -+};
  15120. -
  15121. - /* Band templates duplicated per wiphy. The channel info
  15122. -- * is filled in after querying the device.
  15123. -+ * above is added to the band during setup.
  15124. - */
  15125. - static const struct ieee80211_supported_band __wl_band_2ghz = {
  15126. - .band = IEEE80211_BAND_2GHZ,
  15127. -@@ -143,7 +177,7 @@ static const struct ieee80211_supported_
  15128. - .n_bitrates = wl_g_rates_size,
  15129. - };
  15130. -
  15131. --static const struct ieee80211_supported_band __wl_band_5ghz_a = {
  15132. -+static const struct ieee80211_supported_band __wl_band_5ghz = {
  15133. - .band = IEEE80211_BAND_5GHZ,
  15134. - .bitrates = wl_a_rates,
  15135. - .n_bitrates = wl_a_rates_size,
  15136. -@@ -5252,40 +5286,6 @@ dongle_scantime_out:
  15137. - return err;
  15138. - }
  15139. -
  15140. --/* Filter the list of channels received from firmware counting only
  15141. -- * the 20MHz channels. The wiphy band data only needs those which get
  15142. -- * flagged to indicate if they can take part in higher bandwidth.
  15143. -- */
  15144. --static void brcmf_count_20mhz_channels(struct brcmf_cfg80211_info *cfg,
  15145. -- struct brcmf_chanspec_list *chlist,
  15146. -- u32 chcnt[])
  15147. --{
  15148. -- u32 total = le32_to_cpu(chlist->count);
  15149. -- struct brcmu_chan ch;
  15150. -- int i;
  15151. --
  15152. -- for (i = 0; i < total; i++) {
  15153. -- ch.chspec = (u16)le32_to_cpu(chlist->element[i]);
  15154. -- cfg->d11inf.decchspec(&ch);
  15155. --
  15156. -- /* Firmware gives a ordered list. We skip non-20MHz
  15157. -- * channels is 2G. For 5G we can abort upon reaching
  15158. -- * a non-20MHz channel in the list.
  15159. -- */
  15160. -- if (ch.bw != BRCMU_CHAN_BW_20) {
  15161. -- if (ch.band == BRCMU_CHAN_BAND_5G)
  15162. -- break;
  15163. -- else
  15164. -- continue;
  15165. -- }
  15166. --
  15167. -- if (ch.band == BRCMU_CHAN_BAND_2G)
  15168. -- chcnt[0] += 1;
  15169. -- else if (ch.band == BRCMU_CHAN_BAND_5G)
  15170. -- chcnt[1] += 1;
  15171. -- }
  15172. --}
  15173. --
  15174. - static void brcmf_update_bw40_channel_flag(struct ieee80211_channel *channel,
  15175. - struct brcmu_chan *ch)
  15176. - {
  15177. -@@ -5321,7 +5321,6 @@ static int brcmf_construct_chaninfo(stru
  15178. - u32 i, j;
  15179. - u32 total;
  15180. - u32 chaninfo;
  15181. -- u32 chcnt[2] = { 0, 0 };
  15182. - u32 index;
  15183. -
  15184. - pbuf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
  15185. -@@ -5338,42 +5337,15 @@ static int brcmf_construct_chaninfo(stru
  15186. - goto fail_pbuf;
  15187. - }
  15188. -
  15189. -- brcmf_count_20mhz_channels(cfg, list, chcnt);
  15190. - wiphy = cfg_to_wiphy(cfg);
  15191. -- if (chcnt[0]) {
  15192. -- band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  15193. -- GFP_KERNEL);
  15194. -- if (band == NULL) {
  15195. -- err = -ENOMEM;
  15196. -- goto fail_pbuf;
  15197. -- }
  15198. -- band->channels = kcalloc(chcnt[0], sizeof(*channel),
  15199. -- GFP_KERNEL);
  15200. -- if (band->channels == NULL) {
  15201. -- kfree(band);
  15202. -- err = -ENOMEM;
  15203. -- goto fail_pbuf;
  15204. -- }
  15205. -- band->n_channels = 0;
  15206. -- wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  15207. -- }
  15208. -- if (chcnt[1]) {
  15209. -- band = kmemdup(&__wl_band_5ghz_a, sizeof(__wl_band_5ghz_a),
  15210. -- GFP_KERNEL);
  15211. -- if (band == NULL) {
  15212. -- err = -ENOMEM;
  15213. -- goto fail_band2g;
  15214. -- }
  15215. -- band->channels = kcalloc(chcnt[1], sizeof(*channel),
  15216. -- GFP_KERNEL);
  15217. -- if (band->channels == NULL) {
  15218. -- kfree(band);
  15219. -- err = -ENOMEM;
  15220. -- goto fail_band2g;
  15221. -- }
  15222. -- band->n_channels = 0;
  15223. -- wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  15224. -- }
  15225. -+ band = wiphy->bands[IEEE80211_BAND_2GHZ];
  15226. -+ if (band)
  15227. -+ for (i = 0; i < band->n_channels; i++)
  15228. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  15229. -+ band = wiphy->bands[IEEE80211_BAND_5GHZ];
  15230. -+ if (band)
  15231. -+ for (i = 0; i < band->n_channels; i++)
  15232. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  15233. -
  15234. - total = le32_to_cpu(list->count);
  15235. - for (i = 0; i < total; i++) {
  15236. -@@ -5388,6 +5360,8 @@ static int brcmf_construct_chaninfo(stru
  15237. - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
  15238. - continue;
  15239. - }
  15240. -+ if (!band)
  15241. -+ continue;
  15242. - if (!(bw_cap[band->band] & WLC_BW_40MHZ_BIT) &&
  15243. - ch.bw == BRCMU_CHAN_BW_40)
  15244. - continue;
  15245. -@@ -5415,9 +5389,9 @@ static int brcmf_construct_chaninfo(stru
  15246. - } else if (ch.bw == BRCMU_CHAN_BW_40) {
  15247. - brcmf_update_bw40_channel_flag(&channel[index], &ch);
  15248. - } else {
  15249. -- /* disable other bandwidths for now as mentioned
  15250. -- * order assure they are enabled for subsequent
  15251. -- * chanspecs.
  15252. -+ /* enable the channel and disable other bandwidths
  15253. -+ * for now as mentioned order assure they are enabled
  15254. -+ * for subsequent chanspecs.
  15255. - */
  15256. - channel[index].flags = IEEE80211_CHAN_NO_HT40 |
  15257. - IEEE80211_CHAN_NO_80MHZ;
  15258. -@@ -5436,16 +5410,8 @@ static int brcmf_construct_chaninfo(stru
  15259. - IEEE80211_CHAN_NO_IR;
  15260. - }
  15261. - }
  15262. -- if (index == band->n_channels)
  15263. -- band->n_channels++;
  15264. - }
  15265. -- kfree(pbuf);
  15266. -- return 0;
  15267. -
  15268. --fail_band2g:
  15269. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  15270. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]);
  15271. -- wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
  15272. - fail_pbuf:
  15273. - kfree(pbuf);
  15274. - return err;
  15275. -@@ -5778,7 +5744,12 @@ static void brcmf_wiphy_wowl_params(stru
  15276. -
  15277. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  15278. - {
  15279. -+ struct ieee80211_supported_band *band;
  15280. - struct ieee80211_iface_combination ifc_combo;
  15281. -+ __le32 bandlist[3];
  15282. -+ u32 n_bands;
  15283. -+ int err, i;
  15284. -+
  15285. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  15286. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  15287. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  15288. -@@ -5820,7 +5791,52 @@ static int brcmf_setup_wiphy(struct wiph
  15289. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL))
  15290. - brcmf_wiphy_wowl_params(wiphy);
  15291. -
  15292. -- return brcmf_setup_wiphybands(wiphy);
  15293. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
  15294. -+ sizeof(bandlist));
  15295. -+ if (err) {
  15296. -+ brcmf_err("could not obtain band info: err=%d\n", err);
  15297. -+ return err;
  15298. -+ }
  15299. -+ /* first entry in bandlist is number of bands */
  15300. -+ n_bands = le32_to_cpu(bandlist[0]);
  15301. -+ for (i = 1; i <= n_bands && i < ARRAY_SIZE(bandlist); i++) {
  15302. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_2G)) {
  15303. -+ band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  15304. -+ GFP_KERNEL);
  15305. -+ if (!band)
  15306. -+ return -ENOMEM;
  15307. -+
  15308. -+ band->channels = kmemdup(&__wl_2ghz_channels,
  15309. -+ sizeof(__wl_2ghz_channels),
  15310. -+ GFP_KERNEL);
  15311. -+ if (!band->channels) {
  15312. -+ kfree(band);
  15313. -+ return -ENOMEM;
  15314. -+ }
  15315. -+
  15316. -+ band->n_channels = ARRAY_SIZE(__wl_2ghz_channels);
  15317. -+ wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  15318. -+ }
  15319. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_5G)) {
  15320. -+ band = kmemdup(&__wl_band_5ghz, sizeof(__wl_band_5ghz),
  15321. -+ GFP_KERNEL);
  15322. -+ if (!band)
  15323. -+ return -ENOMEM;
  15324. -+
  15325. -+ band->channels = kmemdup(&__wl_5ghz_channels,
  15326. -+ sizeof(__wl_5ghz_channels),
  15327. -+ GFP_KERNEL);
  15328. -+ if (!band->channels) {
  15329. -+ kfree(band);
  15330. -+ return -ENOMEM;
  15331. -+ }
  15332. -+
  15333. -+ band->n_channels = ARRAY_SIZE(__wl_5ghz_channels);
  15334. -+ wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  15335. -+ }
  15336. -+ }
  15337. -+ err = brcmf_setup_wiphybands(wiphy);
  15338. -+ return err;
  15339. - }
  15340. -
  15341. - static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
  15342. -@@ -6011,6 +6027,9 @@ static void brcmf_cfg80211_reg_notifier(
  15343. -
  15344. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  15345. - {
  15346. -+ if (!wiphy)
  15347. -+ return;
  15348. -+
  15349. - kfree(wiphy->iface_combinations);
  15350. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  15351. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  15352. 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
  15353. deleted file mode 100644
  15354. index a0c22eb..0000000
  15355. --- a/package/kernel/mac80211/patches/355-brcmfmac-update-wiphy-band-information-upon-updating.patch
  15356. +++ /dev/null
  15357. @@ -1,29 +0,0 @@
  15358. -From: Arend van Spriel <arend@broadcom.com>
  15359. -Date: Tue, 14 Apr 2015 20:10:25 +0200
  15360. -Subject: [PATCH] brcmfmac: update wiphy band information upon updating
  15361. - regulatory domain
  15362. -
  15363. -When change the country code the available channels may change. So
  15364. -the wiphy bands should be updated accordingly.
  15365. -
  15366. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15367. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15368. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15369. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15370. ----
  15371. -
  15372. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15373. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15374. -@@ -6022,7 +6022,11 @@ static void brcmf_cfg80211_reg_notifier(
  15375. - memset(&ccreq, 0, sizeof(ccreq));
  15376. - ccreq.rev = cpu_to_le32(-1);
  15377. - memcpy(ccreq.ccode, req->alpha2, sizeof(req->alpha2));
  15378. -- brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  15379. -+ if (brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq))) {
  15380. -+ brcmf_err("firmware rejected country setting\n");
  15381. -+ return;
  15382. -+ }
  15383. -+ brcmf_setup_wiphybands(wiphy);
  15384. - }
  15385. -
  15386. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  15387. 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
  15388. deleted file mode 100644
  15389. index 193f507..0000000
  15390. --- a/package/kernel/mac80211/patches/356-brcmfmac-add-description-for-feature-flags.patch
  15391. +++ /dev/null
  15392. @@ -1,24 +0,0 @@
  15393. -From: Arend van Spriel <arend@broadcom.com>
  15394. -Date: Tue, 14 Apr 2015 20:10:26 +0200
  15395. -Subject: [PATCH] brcmfmac: add description for feature flags
  15396. -
  15397. -Some feature flags were not described in the header file. Adding
  15398. -the description.
  15399. -
  15400. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15401. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15402. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15403. ----
  15404. -
  15405. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15406. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15407. -@@ -19,7 +19,9 @@
  15408. - /*
  15409. - * Features:
  15410. - *
  15411. -+ * MBSS: multiple BSSID support (eg. guest network in AP mode).
  15412. - * MCHAN: multi-channel for concurrent P2P.
  15413. -+ * WOWL: Wake-On-WLAN.
  15414. - */
  15415. - #define BRCMF_FEAT_LIST \
  15416. - BRCMF_FEAT_DEF(MBSS) \
  15417. 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
  15418. deleted file mode 100644
  15419. index 42330b4..0000000
  15420. --- a/package/kernel/mac80211/patches/357-brcmfmac-make-scheduled-scan-support-conditional.patch
  15421. +++ /dev/null
  15422. @@ -1,51 +0,0 @@
  15423. -From: Arend van Spriel <arend@broadcom.com>
  15424. -Date: Tue, 14 Apr 2015 20:10:27 +0200
  15425. -Subject: [PATCH] brcmfmac: make scheduled scan support conditional
  15426. -
  15427. -The scheduled scan support depends on firmware supporting the PNO
  15428. -feature. This feature is optional so add a feature flag for this
  15429. -in the driver and announce scheduled scan support accordingly.
  15430. -
  15431. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15432. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15433. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15434. ----
  15435. -
  15436. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15437. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15438. -@@ -5782,7 +5782,8 @@ static int brcmf_setup_wiphy(struct wiph
  15439. - wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM;
  15440. - wiphy->mgmt_stypes = brcmf_txrx_stypes;
  15441. - wiphy->max_remain_on_channel_duration = 5000;
  15442. -- brcmf_wiphy_pno_params(wiphy);
  15443. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO))
  15444. -+ brcmf_wiphy_pno_params(wiphy);
  15445. -
  15446. - /* vendor commands/events support */
  15447. - wiphy->vendor_commands = brcmf_vendor_cmds;
  15448. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15449. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15450. -@@ -124,6 +124,7 @@ void brcmf_feat_attach(struct brcmf_pub
  15451. - struct brcmf_if *ifp = drvr->iflist[0];
  15452. -
  15453. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  15454. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  15455. - if (drvr->bus_if->wowl_supported)
  15456. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  15457. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  15458. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15459. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15460. -@@ -21,11 +21,13 @@
  15461. - *
  15462. - * MBSS: multiple BSSID support (eg. guest network in AP mode).
  15463. - * MCHAN: multi-channel for concurrent P2P.
  15464. -+ * PNO: preferred network offload.
  15465. - * WOWL: Wake-On-WLAN.
  15466. - */
  15467. - #define BRCMF_FEAT_LIST \
  15468. - BRCMF_FEAT_DEF(MBSS) \
  15469. - BRCMF_FEAT_DEF(MCHAN) \
  15470. -+ BRCMF_FEAT_DEF(PNO) \
  15471. - BRCMF_FEAT_DEF(WOWL)
  15472. - /*
  15473. - * Quirks:
  15474. 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
  15475. deleted file mode 100644
  15476. index b859d46..0000000
  15477. --- a/package/kernel/mac80211/patches/358-brcmfmac-add-support-for-BCM4324-rev-B5-chipset.patch
  15478. +++ /dev/null
  15479. @@ -1,43 +0,0 @@
  15480. -From: Arend van Spriel <arend@broadcom.com>
  15481. -Date: Tue, 14 Apr 2015 20:10:28 +0200
  15482. -Subject: [PATCH] brcmfmac: add support for BCM4324 rev B5 chipset
  15483. -
  15484. -This patch adds support for the BCM4324 B5 revision. This device
  15485. -is similar to BCM43241 from driver and firmware perspective. It
  15486. -is known to be used in Lenovo Thinkpad Tablet devices.
  15487. -
  15488. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15489. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15490. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15491. ----
  15492. -
  15493. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15494. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15495. -@@ -601,6 +601,8 @@ static const struct sdiod_drive_str sdio
  15496. - #define BCM43241B0_NVRAM_NAME "brcm/brcmfmac43241b0-sdio.txt"
  15497. - #define BCM43241B4_FIRMWARE_NAME "brcm/brcmfmac43241b4-sdio.bin"
  15498. - #define BCM43241B4_NVRAM_NAME "brcm/brcmfmac43241b4-sdio.txt"
  15499. -+#define BCM43241B5_FIRMWARE_NAME "brcm/brcmfmac43241b5-sdio.bin"
  15500. -+#define BCM43241B5_NVRAM_NAME "brcm/brcmfmac43241b5-sdio.txt"
  15501. - #define BCM4329_FIRMWARE_NAME "brcm/brcmfmac4329-sdio.bin"
  15502. - #define BCM4329_NVRAM_NAME "brcm/brcmfmac4329-sdio.txt"
  15503. - #define BCM4330_FIRMWARE_NAME "brcm/brcmfmac4330-sdio.bin"
  15504. -@@ -628,6 +630,8 @@ MODULE_FIRMWARE(BCM43241B0_FIRMWARE_NAME
  15505. - MODULE_FIRMWARE(BCM43241B0_NVRAM_NAME);
  15506. - MODULE_FIRMWARE(BCM43241B4_FIRMWARE_NAME);
  15507. - MODULE_FIRMWARE(BCM43241B4_NVRAM_NAME);
  15508. -+MODULE_FIRMWARE(BCM43241B5_FIRMWARE_NAME);
  15509. -+MODULE_FIRMWARE(BCM43241B5_NVRAM_NAME);
  15510. - MODULE_FIRMWARE(BCM4329_FIRMWARE_NAME);
  15511. - MODULE_FIRMWARE(BCM4329_NVRAM_NAME);
  15512. - MODULE_FIRMWARE(BCM4330_FIRMWARE_NAME);
  15513. -@@ -667,7 +671,8 @@ enum brcmf_firmware_type {
  15514. - static const struct brcmf_firmware_names brcmf_fwname_data[] = {
  15515. - { BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43143) },
  15516. - { BRCM_CC_43241_CHIP_ID, 0x0000001F, BRCMF_FIRMWARE_NVRAM(BCM43241B0) },
  15517. -- { BRCM_CC_43241_CHIP_ID, 0xFFFFFFE0, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  15518. -+ { BRCM_CC_43241_CHIP_ID, 0x00000020, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  15519. -+ { BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43241B5) },
  15520. - { BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4329) },
  15521. - { BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4330) },
  15522. - { BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4334) },
  15523. 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
  15524. deleted file mode 100644
  15525. index d420308..0000000
  15526. --- a/package/kernel/mac80211/patches/359-brcmfmac-process-interrupt-regardless-sdiod-state.patch
  15527. +++ /dev/null
  15528. @@ -1,27 +0,0 @@
  15529. -From: Arend van Spriel <arend@broadcom.com>
  15530. -Date: Tue, 14 Apr 2015 20:10:29 +0200
  15531. -Subject: [PATCH] brcmfmac: process interrupt regardless sdiod state
  15532. -
  15533. -When the sdio bus state is not ready to process we abort the
  15534. -interrupt service routine. This is not wanted as it keeps the
  15535. -interrupt source active. Better clear the interrupt source.
  15536. -
  15537. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15538. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15539. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15540. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15541. ----
  15542. -
  15543. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15544. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15545. -@@ -3555,10 +3555,6 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  15546. - return;
  15547. - }
  15548. -
  15549. -- if (bus->sdiodev->state != BRCMF_SDIOD_DATA) {
  15550. -- brcmf_err("bus is down. we have nothing to do\n");
  15551. -- return;
  15552. -- }
  15553. - /* Count the interrupt call */
  15554. - bus->sdcnt.intrcount++;
  15555. - if (in_interrupt())
  15556. 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
  15557. deleted file mode 100644
  15558. index ac5584e..0000000
  15559. --- a/package/kernel/mac80211/patches/360-brcmfmac-fix-sdio-suspend-and-resume.patch
  15560. +++ /dev/null
  15561. @@ -1,68 +0,0 @@
  15562. -From: Arend van Spriel <arend@broadcom.com>
  15563. -Date: Tue, 14 Apr 2015 20:10:30 +0200
  15564. -Subject: [PATCH] brcmfmac: fix sdio suspend and resume
  15565. -
  15566. -commit 330b4e4be937 ("brcmfmac: Add wowl support for SDIO devices.")
  15567. -changed the behaviour by removing the MMC_PM_KEEP_POWER flag for
  15568. -non-wowl scenario, which needs to be restored. Another necessary
  15569. -change is to mark the card as being non-removable. With this in place
  15570. -the suspend resume test passes successfully doing:
  15571. -
  15572. - # echo devices > /sys/power/pm_test
  15573. - # echo mem > /sys/power/state
  15574. -
  15575. -Note that power may still be switched off when system is going
  15576. -in S3 state.
  15577. -
  15578. -Reported-by: Fu, Zhonghui <<zhonghui.fu@linux.intel.com>
  15579. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15580. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15581. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15582. ----
  15583. -
  15584. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15585. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15586. -@@ -1011,6 +1011,14 @@ static int brcmf_sdiod_remove(struct brc
  15587. - return 0;
  15588. - }
  15589. -
  15590. -+static void brcmf_sdiod_host_fixup(struct mmc_host *host)
  15591. -+{
  15592. -+ /* runtime-pm powers off the device */
  15593. -+ pm_runtime_forbid(host->parent);
  15594. -+ /* avoid removal detection upon resume */
  15595. -+ host->caps |= MMC_CAP_NONREMOVABLE;
  15596. -+}
  15597. -+
  15598. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  15599. - {
  15600. - struct sdio_func *func;
  15601. -@@ -1076,7 +1084,7 @@ static int brcmf_sdiod_probe(struct brcm
  15602. - ret = -ENODEV;
  15603. - goto out;
  15604. - }
  15605. -- pm_runtime_forbid(host->parent);
  15606. -+ brcmf_sdiod_host_fixup(host);
  15607. - out:
  15608. - if (ret)
  15609. - brcmf_sdiod_remove(sdiodev);
  15610. -@@ -1246,15 +1254,15 @@ static int brcmf_ops_sdio_suspend(struct
  15611. - brcmf_sdiod_freezer_on(sdiodev);
  15612. - brcmf_sdio_wd_timer(sdiodev->bus, 0);
  15613. -
  15614. -+ sdio_flags = MMC_PM_KEEP_POWER;
  15615. - if (sdiodev->wowl_enabled) {
  15616. -- sdio_flags = MMC_PM_KEEP_POWER;
  15617. - if (sdiodev->pdata->oob_irq_supported)
  15618. - enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  15619. - else
  15620. -- sdio_flags = MMC_PM_WAKE_SDIO_IRQ;
  15621. -- if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  15622. -- brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  15623. -+ sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
  15624. - }
  15625. -+ if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  15626. -+ brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  15627. - return 0;
  15628. - }
  15629. -
  15630. 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
  15631. deleted file mode 100644
  15632. index a521b65..0000000
  15633. --- a/package/kernel/mac80211/patches/361-brcmfmac-add-support-for-BCM4358-PCIe-device.patch
  15634. +++ /dev/null
  15635. @@ -1,77 +0,0 @@
  15636. -From: Arend van Spriel <arend@broadcom.com>
  15637. -Date: Tue, 14 Apr 2015 20:10:31 +0200
  15638. -Subject: [PATCH] brcmfmac: add support for BCM4358 PCIe device
  15639. -
  15640. -This patch adds support for the BCM4358 2x2 11ac device.
  15641. -
  15642. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15643. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15644. ----
  15645. -
  15646. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15647. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15648. -@@ -649,6 +649,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  15649. - case BRCM_CC_43567_CHIP_ID:
  15650. - case BRCM_CC_43569_CHIP_ID:
  15651. - case BRCM_CC_43570_CHIP_ID:
  15652. -+ case BRCM_CC_4358_CHIP_ID:
  15653. - case BRCM_CC_43602_CHIP_ID:
  15654. - return 0x180000;
  15655. - default:
  15656. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15657. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15658. -@@ -51,6 +51,8 @@ enum brcmf_pcie_state {
  15659. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  15660. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  15661. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  15662. -+#define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  15663. -+#define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  15664. -
  15665. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  15666. -
  15667. -@@ -189,6 +191,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME)
  15668. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  15669. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  15670. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  15671. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  15672. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  15673. -
  15674. -
  15675. - struct brcmf_pcie_console {
  15676. -@@ -1333,6 +1337,10 @@ static int brcmf_pcie_get_fwnames(struct
  15677. - fw_name = BRCMF_PCIE_43570_FW_NAME;
  15678. - nvram_name = BRCMF_PCIE_43570_NVRAM_NAME;
  15679. - break;
  15680. -+ case BRCM_CC_4358_CHIP_ID:
  15681. -+ fw_name = BRCMF_PCIE_4358_FW_NAME;
  15682. -+ nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  15683. -+ break;
  15684. - default:
  15685. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  15686. - return -ENODEV;
  15687. -@@ -1850,6 +1858,7 @@ static struct pci_device_id brcmf_pcie_d
  15688. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  15689. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  15690. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  15691. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID),
  15692. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  15693. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  15694. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  15695. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15696. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15697. -@@ -45,6 +45,7 @@
  15698. - #define BRCM_CC_43567_CHIP_ID 43567
  15699. - #define BRCM_CC_43569_CHIP_ID 43569
  15700. - #define BRCM_CC_43570_CHIP_ID 43570
  15701. -+#define BRCM_CC_4358_CHIP_ID 0x4358
  15702. - #define BRCM_CC_43602_CHIP_ID 43602
  15703. -
  15704. - /* USB Device IDs */
  15705. -@@ -59,6 +60,7 @@
  15706. - #define BRCM_PCIE_4356_DEVICE_ID 0x43ec
  15707. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  15708. - #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
  15709. -+#define BRCM_PCIE_4358_DEVICE_ID 0x43e9
  15710. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  15711. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  15712. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  15713. 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
  15714. deleted file mode 100644
  15715. index bcbb984..0000000
  15716. --- a/package/kernel/mac80211/patches/362-brcmfmac-add-additional-43602-pcie-device-id.patch
  15717. +++ /dev/null
  15718. @@ -1,30 +0,0 @@
  15719. -From: Hante Meuleman <meuleman@broadcom.com>
  15720. -Date: Tue, 14 Apr 2015 20:10:32 +0200
  15721. -Subject: [PATCH] brcmfmac: add additional 43602 pcie device id.
  15722. -
  15723. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  15724. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15725. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  15726. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15727. ----
  15728. -
  15729. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15730. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15731. -@@ -1862,6 +1862,7 @@ static struct pci_device_id brcmf_pcie_d
  15732. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  15733. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  15734. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  15735. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID),
  15736. - { /* end: all zeroes */ }
  15737. - };
  15738. -
  15739. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15740. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15741. -@@ -64,6 +64,7 @@
  15742. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  15743. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  15744. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  15745. -+#define BRCM_PCIE_43602_RAW_DEVICE_ID 43602
  15746. -
  15747. - /* brcmsmac IDs */
  15748. - #define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
  15749. 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
  15750. deleted file mode 100644
  15751. index 5f9bbea..0000000
  15752. --- a/package/kernel/mac80211/patches/363-brcmfmac-Add-support-for-multiple-PCIE-devices-in-nv.patch
  15753. +++ /dev/null
  15754. @@ -1,351 +0,0 @@
  15755. -From: Hante Meuleman <meuleman@broadcom.com>
  15756. -Date: Tue, 14 Apr 2015 20:10:33 +0200
  15757. -Subject: [PATCH] brcmfmac: Add support for multiple PCIE devices in
  15758. - nvram.
  15759. -
  15760. -With PCIE it is possible to support multiple devices with the
  15761. -same device type. They all load the same nvram file. In order to
  15762. -support this the nvram can specify which part of the nvram is
  15763. -for which pcie device. This patch adds support for these new
  15764. -types of nvram files.
  15765. -
  15766. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  15767. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15768. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15769. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15770. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  15771. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15772. ----
  15773. -
  15774. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  15775. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  15776. -@@ -23,6 +23,10 @@
  15777. - #include "debug.h"
  15778. - #include "firmware.h"
  15779. -
  15780. -+#define BRCMF_FW_MAX_NVRAM_SIZE 64000
  15781. -+#define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  15782. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  15783. -+
  15784. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  15785. - module_param_string(firmware_path, brcmf_firmware_path,
  15786. - BRCMF_FW_PATH_LEN, 0440);
  15787. -@@ -46,6 +50,8 @@ enum nvram_parser_state {
  15788. - * @column: current column in line.
  15789. - * @pos: byte offset in input buffer.
  15790. - * @entry: start position of key,value entry.
  15791. -+ * @multi_dev_v1: detect pcie multi device v1 (compressed).
  15792. -+ * @multi_dev_v2: detect pcie multi device v2.
  15793. - */
  15794. - struct nvram_parser {
  15795. - enum nvram_parser_state state;
  15796. -@@ -56,6 +62,8 @@ struct nvram_parser {
  15797. - u32 column;
  15798. - u32 pos;
  15799. - u32 entry;
  15800. -+ bool multi_dev_v1;
  15801. -+ bool multi_dev_v2;
  15802. - };
  15803. -
  15804. - static bool is_nvram_char(char c)
  15805. -@@ -108,6 +116,10 @@ static enum nvram_parser_state brcmf_nvr
  15806. - st = COMMENT;
  15807. - else
  15808. - st = VALUE;
  15809. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  15810. -+ nvp->multi_dev_v1 = true;
  15811. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  15812. -+ nvp->multi_dev_v2 = true;
  15813. - } else if (!is_nvram_char(c)) {
  15814. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  15815. - nvp->line, nvp->column);
  15816. -@@ -133,6 +145,8 @@ brcmf_nvram_handle_value(struct nvram_pa
  15817. - ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  15818. - skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  15819. - cplen = ekv - skv;
  15820. -+ if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  15821. -+ return END;
  15822. - /* copy to output buffer */
  15823. - memcpy(&nvp->nvram[nvp->nvram_len], skv, cplen);
  15824. - nvp->nvram_len += cplen;
  15825. -@@ -180,10 +194,18 @@ static enum nvram_parser_state
  15826. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  15827. - const struct firmware *nv)
  15828. - {
  15829. -+ size_t size;
  15830. -+
  15831. - memset(nvp, 0, sizeof(*nvp));
  15832. - nvp->fwnv = nv;
  15833. -+ /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  15834. -+ if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  15835. -+ size = BRCMF_FW_MAX_NVRAM_SIZE;
  15836. -+ else
  15837. -+ size = nv->size;
  15838. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  15839. -- nvp->nvram = kzalloc(nv->size + 1 + 3 + sizeof(u32), GFP_KERNEL);
  15840. -+ size += 1 + 3 + sizeof(u32);
  15841. -+ nvp->nvram = kzalloc(size, GFP_KERNEL);
  15842. - if (!nvp->nvram)
  15843. - return -ENOMEM;
  15844. -
  15845. -@@ -192,12 +214,136 @@ static int brcmf_init_nvram_parser(struc
  15846. - return 0;
  15847. - }
  15848. -
  15849. -+/* brcmf_fw_strip_multi_v1 :Some nvram files contain settings for multiple
  15850. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  15851. -+ * which data is to be returned. v1 is the version where nvram is stored
  15852. -+ * compressed and "devpath" maps to index for valid entries.
  15853. -+ */
  15854. -+static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  15855. -+ u16 bus_nr)
  15856. -+{
  15857. -+ u32 i, j;
  15858. -+ bool found;
  15859. -+ u8 *nvram;
  15860. -+ u8 id;
  15861. -+
  15862. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  15863. -+ if (!nvram)
  15864. -+ goto fail;
  15865. -+
  15866. -+ /* min length: devpath0=pcie/1/4/ + 0:x=y */
  15867. -+ if (nvp->nvram_len < BRCMF_FW_NVRAM_DEVPATH_LEN + 6)
  15868. -+ goto fail;
  15869. -+
  15870. -+ /* First search for the devpathX and see if it is the configuration
  15871. -+ * for domain_nr/bus_nr. Search complete nvp
  15872. -+ */
  15873. -+ found = false;
  15874. -+ i = 0;
  15875. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  15876. -+ /* Format: devpathX=pcie/Y/Z/
  15877. -+ * Y = domain_nr, Z = bus_nr, X = virtual ID
  15878. -+ */
  15879. -+ if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  15880. -+ (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  15881. -+ if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  15882. -+ ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  15883. -+ id = nvp->nvram[i + 7] - '0';
  15884. -+ found = true;
  15885. -+ break;
  15886. -+ }
  15887. -+ }
  15888. -+ while (nvp->nvram[i] != 0)
  15889. -+ i++;
  15890. -+ i++;
  15891. -+ }
  15892. -+ if (!found)
  15893. -+ goto fail;
  15894. -+
  15895. -+ /* Now copy all valid entries, release old nvram and assign new one */
  15896. -+ i = 0;
  15897. -+ j = 0;
  15898. -+ while (i < nvp->nvram_len) {
  15899. -+ if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  15900. -+ i += 2;
  15901. -+ while (nvp->nvram[i] != 0) {
  15902. -+ nvram[j] = nvp->nvram[i];
  15903. -+ i++;
  15904. -+ j++;
  15905. -+ }
  15906. -+ nvram[j] = 0;
  15907. -+ j++;
  15908. -+ }
  15909. -+ while (nvp->nvram[i] != 0)
  15910. -+ i++;
  15911. -+ i++;
  15912. -+ }
  15913. -+ kfree(nvp->nvram);
  15914. -+ nvp->nvram = nvram;
  15915. -+ nvp->nvram_len = j;
  15916. -+ return;
  15917. -+
  15918. -+fail:
  15919. -+ kfree(nvram);
  15920. -+ nvp->nvram_len = 0;
  15921. -+}
  15922. -+
  15923. -+/* brcmf_fw_strip_multi_v2 :Some nvram files contain settings for multiple
  15924. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  15925. -+ * which data is to be returned. v2 is the version where nvram is stored
  15926. -+ * uncompressed, all relevant valid entries are identified by
  15927. -+ * pcie/domain_nr/bus_nr:
  15928. -+ */
  15929. -+static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  15930. -+ u16 bus_nr)
  15931. -+{
  15932. -+ u32 i, j;
  15933. -+ u8 *nvram;
  15934. -+
  15935. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  15936. -+ if (!nvram)
  15937. -+ goto fail;
  15938. -+
  15939. -+ /* Copy all valid entries, release old nvram and assign new one.
  15940. -+ * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  15941. -+ * Y = bus_nr.
  15942. -+ */
  15943. -+ i = 0;
  15944. -+ j = 0;
  15945. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  15946. -+ if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  15947. -+ (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  15948. -+ ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  15949. -+ ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  15950. -+ i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  15951. -+ while (nvp->nvram[i] != 0) {
  15952. -+ nvram[j] = nvp->nvram[i];
  15953. -+ i++;
  15954. -+ j++;
  15955. -+ }
  15956. -+ nvram[j] = 0;
  15957. -+ j++;
  15958. -+ }
  15959. -+ while (nvp->nvram[i] != 0)
  15960. -+ i++;
  15961. -+ i++;
  15962. -+ }
  15963. -+ kfree(nvp->nvram);
  15964. -+ nvp->nvram = nvram;
  15965. -+ nvp->nvram_len = j;
  15966. -+ return;
  15967. -+fail:
  15968. -+ kfree(nvram);
  15969. -+ nvp->nvram_len = 0;
  15970. -+}
  15971. -+
  15972. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  15973. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  15974. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  15975. - * End of buffer is completed with token identifying length of buffer.
  15976. - */
  15977. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length)
  15978. -+static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  15979. -+ u16 domain_nr, u16 bus_nr)
  15980. - {
  15981. - struct nvram_parser nvp;
  15982. - u32 pad;
  15983. -@@ -212,6 +358,16 @@ static void *brcmf_fw_nvram_strip(const
  15984. - if (nvp.state == END)
  15985. - break;
  15986. - }
  15987. -+ if (nvp.multi_dev_v1)
  15988. -+ brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  15989. -+ else if (nvp.multi_dev_v2)
  15990. -+ brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  15991. -+
  15992. -+ if (nvp.nvram_len == 0) {
  15993. -+ kfree(nvp.nvram);
  15994. -+ return NULL;
  15995. -+ }
  15996. -+
  15997. - pad = nvp.nvram_len;
  15998. - *new_length = roundup(nvp.nvram_len + 1, 4);
  15999. - while (pad != *new_length) {
  16000. -@@ -239,6 +395,8 @@ struct brcmf_fw {
  16001. - u16 flags;
  16002. - const struct firmware *code;
  16003. - const char *nvram_name;
  16004. -+ u16 domain_nr;
  16005. -+ u16 bus_nr;
  16006. - void (*done)(struct device *dev, const struct firmware *fw,
  16007. - void *nvram_image, u32 nvram_len);
  16008. - };
  16009. -@@ -254,7 +412,8 @@ static void brcmf_fw_request_nvram_done(
  16010. - goto fail;
  16011. -
  16012. - if (fw) {
  16013. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length);
  16014. -+ nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  16015. -+ fwctx->domain_nr, fwctx->bus_nr);
  16016. - release_firmware(fw);
  16017. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  16018. - goto fail;
  16019. -@@ -309,11 +468,12 @@ fail:
  16020. - kfree(fwctx);
  16021. - }
  16022. -
  16023. --int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16024. -- const char *code, const char *nvram,
  16025. -- void (*fw_cb)(struct device *dev,
  16026. -- const struct firmware *fw,
  16027. -- void *nvram_image, u32 nvram_len))
  16028. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  16029. -+ const char *code, const char *nvram,
  16030. -+ void (*fw_cb)(struct device *dev,
  16031. -+ const struct firmware *fw,
  16032. -+ void *nvram_image, u32 nvram_len),
  16033. -+ u16 domain_nr, u16 bus_nr)
  16034. - {
  16035. - struct brcmf_fw *fwctx;
  16036. -
  16037. -@@ -333,8 +493,21 @@ int brcmf_fw_get_firmwares(struct device
  16038. - fwctx->done = fw_cb;
  16039. - if (flags & BRCMF_FW_REQUEST_NVRAM)
  16040. - fwctx->nvram_name = nvram;
  16041. -+ fwctx->domain_nr = domain_nr;
  16042. -+ fwctx->bus_nr = bus_nr;
  16043. -
  16044. - return request_firmware_nowait(THIS_MODULE, true, code, dev,
  16045. - GFP_KERNEL, fwctx,
  16046. - brcmf_fw_request_code_done);
  16047. - }
  16048. -+
  16049. -+int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16050. -+ const char *code, const char *nvram,
  16051. -+ void (*fw_cb)(struct device *dev,
  16052. -+ const struct firmware *fw,
  16053. -+ void *nvram_image, u32 nvram_len))
  16054. -+{
  16055. -+ return brcmf_fw_get_firmwares_pcie(dev, flags, code, nvram, fw_cb, 0,
  16056. -+ 0);
  16057. -+}
  16058. -+
  16059. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  16060. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  16061. -@@ -32,6 +32,12 @@ void brcmf_fw_nvram_free(void *nvram);
  16062. - * fails it will not use the callback, but call device_release_driver()
  16063. - * instead which will call the driver .remove() callback.
  16064. - */
  16065. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  16066. -+ const char *code, const char *nvram,
  16067. -+ void (*fw_cb)(struct device *dev,
  16068. -+ const struct firmware *fw,
  16069. -+ void *nvram_image, u32 nvram_len),
  16070. -+ u16 domain_nr, u16 bus_nr);
  16071. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16072. - const char *code, const char *nvram,
  16073. - void (*fw_cb)(struct device *dev,
  16074. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16075. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16076. -@@ -1649,8 +1649,13 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  16077. - struct brcmf_pciedev_info *devinfo;
  16078. - struct brcmf_pciedev *pcie_bus_dev;
  16079. - struct brcmf_bus *bus;
  16080. -+ u16 domain_nr;
  16081. -+ u16 bus_nr;
  16082. -
  16083. -- brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device);
  16084. -+ domain_nr = pci_domain_nr(pdev->bus) + 1;
  16085. -+ bus_nr = pdev->bus->number;
  16086. -+ brcmf_dbg(PCIE, "Enter %x:%x (%d/%d)\n", pdev->vendor, pdev->device,
  16087. -+ domain_nr, bus_nr);
  16088. -
  16089. - ret = -ENOMEM;
  16090. - devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL);
  16091. -@@ -1699,10 +1704,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  16092. - if (ret)
  16093. - goto fail_bus;
  16094. -
  16095. -- ret = brcmf_fw_get_firmwares(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  16096. -- BRCMF_FW_REQ_NV_OPTIONAL,
  16097. -- devinfo->fw_name, devinfo->nvram_name,
  16098. -- brcmf_pcie_setup);
  16099. -+ ret = brcmf_fw_get_firmwares_pcie(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  16100. -+ BRCMF_FW_REQ_NV_OPTIONAL,
  16101. -+ devinfo->fw_name, devinfo->nvram_name,
  16102. -+ brcmf_pcie_setup, domain_nr, bus_nr);
  16103. - if (ret == 0)
  16104. - return 0;
  16105. - fail_bus:
  16106. diff --git a/package/kernel/mac80211/patches/364-brcmfmac-cleanup-a-sizeof.patch b/package/kernel/mac80211/patches/364-brcmfmac-cleanup-a-sizeof.patch
  16107. deleted file mode 100644
  16108. index d26e118..0000000
  16109. --- a/package/kernel/mac80211/patches/364-brcmfmac-cleanup-a-sizeof.patch
  16110. +++ /dev/null
  16111. @@ -1,23 +0,0 @@
  16112. -From: Dan Carpenter <dan.carpenter@oracle.com>
  16113. -Date: Thu, 7 May 2015 12:59:19 +0300
  16114. -Subject: [PATCH] brcmfmac: cleanup a sizeof()
  16115. -
  16116. -"flowrings" and "*flowrings" are both pointers so this always returns
  16117. -sizeof(void *) and the current code works fine. But "*flowrings" is
  16118. -intended here and static checkers complain, so lets change it.
  16119. -
  16120. -Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  16121. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16122. ----
  16123. -
  16124. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16125. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16126. -@@ -1617,7 +1617,7 @@ static void brcmf_pcie_setup(struct devi
  16127. - bus->msgbuf->commonrings[i] =
  16128. - &devinfo->shared.commonrings[i]->commonring;
  16129. -
  16130. -- flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(flowrings),
  16131. -+ flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*flowrings),
  16132. - GFP_KERNEL);
  16133. - if (!flowrings)
  16134. - goto fail;
  16135. 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
  16136. deleted file mode 100644
  16137. index 9b2880d..0000000
  16138. --- a/package/kernel/mac80211/patches/365-brcmfmac-check-result-of-USB-firmware-request.patch
  16139. +++ /dev/null
  16140. @@ -1,33 +0,0 @@
  16141. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16142. -Date: Thu, 7 May 2015 14:13:03 +0200
  16143. -Subject: [PATCH] brcmfmac: check result of USB firmware request
  16144. -MIME-Version: 1.0
  16145. -Content-Type: text/plain; charset=UTF-8
  16146. -Content-Transfer-Encoding: 8bit
  16147. -
  16148. -This prevents silence failures with driver waiting (infinitely) for a
  16149. -callback.
  16150. -
  16151. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16152. -Acked-by: Arend van Spriel <arend@broadcom.com>
  16153. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16154. ----
  16155. -
  16156. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  16157. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  16158. -@@ -1270,8 +1270,13 @@ static int brcmf_usb_probe_cb(struct brc
  16159. - bus->chiprev = bus_pub->chiprev;
  16160. -
  16161. - /* request firmware here */
  16162. -- brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL,
  16163. -- brcmf_usb_probe_phase2);
  16164. -+ ret = brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo),
  16165. -+ NULL, brcmf_usb_probe_phase2);
  16166. -+ if (ret) {
  16167. -+ brcmf_err("firmware request failed: %d\n", ret);
  16168. -+ goto fail;
  16169. -+ }
  16170. -+
  16171. - return 0;
  16172. -
  16173. - fail:
  16174. 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
  16175. deleted file mode 100644
  16176. index d46b300..0000000
  16177. --- a/package/kernel/mac80211/patches/366-brcmfmac-prohibit-ACPI-power-management-for-brcmfmac.patch
  16178. +++ /dev/null
  16179. @@ -1,47 +0,0 @@
  16180. -From: "Fu, Zhonghui" <zhonghui.fu@linux.intel.com>
  16181. -Date: Mon, 11 May 2015 10:41:32 +0800
  16182. -Subject: [PATCH] brcmfmac: prohibit ACPI power management for brcmfmac driver
  16183. -
  16184. -ACPI will manage WiFi chip's power state during suspend/resume
  16185. -process on some tablet platforms(such as ASUS T100TA). This is
  16186. -not supported by brcmfmac driver now, and the context of WiFi
  16187. -chip will be damaged after resume. This patch informs ACPI not
  16188. -to manage WiFi chip's power state.
  16189. -
  16190. -Signed-off-by: Zhonghui Fu <zhonghui.fu@linux.intel.com>
  16191. -Acked-by: Arend van Spriel <arend@broadcom.com>
  16192. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16193. ----
  16194. -
  16195. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16196. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16197. -@@ -33,6 +33,7 @@
  16198. - #include <linux/suspend.h>
  16199. - #include <linux/errno.h>
  16200. - #include <linux/module.h>
  16201. -+#include <linux/acpi.h>
  16202. - #include <net/cfg80211.h>
  16203. -
  16204. - #include <defs.h>
  16205. -@@ -1122,6 +1123,8 @@ static int brcmf_ops_sdio_probe(struct s
  16206. - int err;
  16207. - struct brcmf_sdio_dev *sdiodev;
  16208. - struct brcmf_bus *bus_if;
  16209. -+ struct device *dev;
  16210. -+ struct acpi_device *adev;
  16211. -
  16212. - brcmf_dbg(SDIO, "Enter\n");
  16213. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  16214. -@@ -1129,6 +1132,12 @@ static int brcmf_ops_sdio_probe(struct s
  16215. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  16216. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  16217. -
  16218. -+ /* prohibit ACPI power management for this device */
  16219. -+ dev = &func->dev;
  16220. -+ adev = ACPI_COMPANION(dev);
  16221. -+ if (adev)
  16222. -+ adev->flags.power_manageable = 0;
  16223. -+
  16224. - /* Consume func num 1 but dont do anything with it. */
  16225. - if (func->num == 1)
  16226. - return 0;
  16227. 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
  16228. deleted file mode 100644
  16229. index 9b4609f..0000000
  16230. --- a/package/kernel/mac80211/patches/367-brcmfmac-avoid-gcc-5.1-warning.patch
  16231. +++ /dev/null
  16232. @@ -1,30 +0,0 @@
  16233. -From: Arnd Bergmann <arnd@arndb.de>
  16234. -Date: Tue, 12 May 2015 23:54:25 +0200
  16235. -Subject: [PATCH] brcmfmac: avoid gcc-5.1 warning
  16236. -
  16237. -gcc-5.0 gained a new warning in the fwsignal portion of the brcmfmac
  16238. -driver:
  16239. -
  16240. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c: In function 'brcmf_fws_txs_process':
  16241. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c:1478:8: warning: 'skb' may be used uninitialized in this function [-Wmaybe-uninitialized]
  16242. -
  16243. -This is a false positive, and marking the brcmf_fws_hanger_poppkt function
  16244. -as 'static inline' makes the warning go away. I have checked the object
  16245. -file output and while a little code gets moved around, the size of
  16246. -the binary remains identical.
  16247. -
  16248. -Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  16249. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16250. ----
  16251. -
  16252. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  16253. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  16254. -@@ -635,7 +635,7 @@ static int brcmf_fws_hanger_pushpkt(stru
  16255. - return 0;
  16256. - }
  16257. -
  16258. --static int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  16259. -+static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  16260. - u32 slot_id, struct sk_buff **pktout,
  16261. - bool remove_item)
  16262. - {
  16263. 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
  16264. deleted file mode 100644
  16265. index b16782d..0000000
  16266. --- a/package/kernel/mac80211/patches/368-brcmfmac-allow-device-tree-node-without-interrupts-p.patch
  16267. +++ /dev/null
  16268. @@ -1,45 +0,0 @@
  16269. -From: Arend van Spriel <arend@broadcom.com>
  16270. -Date: Wed, 20 May 2015 14:09:47 +0200
  16271. -Subject: [PATCH] brcmfmac: allow device tree node without 'interrupts'
  16272. - property
  16273. -
  16274. -As described in the device tree bindings for 'brcm,bcm4329-fmac'
  16275. -nodes, the interrupts property is optional. So adding a check
  16276. -for the presence of this property before attempting to parse
  16277. -and map the interrupt. If not present or parsing fails return
  16278. -and fallback to in-band sdio interrupt.
  16279. -
  16280. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16281. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16282. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16283. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16284. ----
  16285. -
  16286. ---- a/drivers/net/wireless/brcm80211/brcmfmac/of.c
  16287. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c
  16288. -@@ -39,10 +39,16 @@ void brcmf_of_probe(struct brcmf_sdio_de
  16289. - if (!sdiodev->pdata)
  16290. - return;
  16291. -
  16292. -+ if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  16293. -+ sdiodev->pdata->drive_strength = val;
  16294. -+
  16295. -+ /* make sure there are interrupts defined in the node */
  16296. -+ if (!of_find_property(np, "interrupts", NULL))
  16297. -+ return;
  16298. -+
  16299. - irq = irq_of_parse_and_map(np, 0);
  16300. - if (!irq) {
  16301. - brcmf_err("interrupt could not be mapped\n");
  16302. -- devm_kfree(dev, sdiodev->pdata);
  16303. - return;
  16304. - }
  16305. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  16306. -@@ -50,7 +56,4 @@ void brcmf_of_probe(struct brcmf_sdio_de
  16307. - sdiodev->pdata->oob_irq_supported = true;
  16308. - sdiodev->pdata->oob_irq_nr = irq;
  16309. - sdiodev->pdata->oob_irq_flags = irqf;
  16310. --
  16311. -- if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  16312. -- sdiodev->pdata->drive_strength = val;
  16313. - }
  16314. 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
  16315. deleted file mode 100644
  16316. index f81250e..0000000
  16317. --- a/package/kernel/mac80211/patches/369-brcmfmac-Improve-throughput-by-scheduling-msbug-flow.patch
  16318. +++ /dev/null
  16319. @@ -1,87 +0,0 @@
  16320. -From: Hante Meuleman <meuleman@broadcom.com>
  16321. -Date: Wed, 20 May 2015 14:09:48 +0200
  16322. -Subject: [PATCH] brcmfmac: Improve throughput by scheduling msbug flow worker.
  16323. -
  16324. -The tx flow worker in msgbuf gets scheduled at tx till a certain
  16325. -threshold has been reached. Then the tx completes will take over
  16326. -the scheduling. When amsdu and ampdu is used the frames are
  16327. -transferred wireless in a very bulky fashion, in combination
  16328. -with this scheduling algorithm and buffer limiters in the stack
  16329. -this can result in limited throughput. This change causes the
  16330. -flow worker to be scheduled more frequently from tx.
  16331. -
  16332. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16333. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16334. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16335. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  16336. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  16337. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16338. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16339. ----
  16340. -
  16341. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  16342. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  16343. -@@ -249,8 +249,8 @@ void brcmf_flowring_delete(struct brcmf_
  16344. - }
  16345. -
  16346. -
  16347. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16348. -- struct sk_buff *skb)
  16349. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16350. -+ struct sk_buff *skb)
  16351. - {
  16352. - struct brcmf_flowring_ring *ring;
  16353. -
  16354. -@@ -271,6 +271,7 @@ void brcmf_flowring_enqueue(struct brcmf
  16355. - if (skb_queue_len(&ring->skblist) < BRCMF_FLOWRING_LOW)
  16356. - brcmf_flowring_block(flow, flowid, false);
  16357. - }
  16358. -+ return skb_queue_len(&ring->skblist);
  16359. - }
  16360. -
  16361. -
  16362. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  16363. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  16364. -@@ -64,8 +64,8 @@ u32 brcmf_flowring_create(struct brcmf_f
  16365. - void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  16366. - void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  16367. - u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  16368. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16369. -- struct sk_buff *skb);
  16370. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16371. -+ struct sk_buff *skb);
  16372. - struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  16373. - void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  16374. - struct sk_buff *skb);
  16375. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16376. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16377. -@@ -73,7 +73,7 @@
  16378. - #define BRCMF_MSGBUF_TX_FLUSH_CNT1 32
  16379. - #define BRCMF_MSGBUF_TX_FLUSH_CNT2 96
  16380. -
  16381. --#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 64
  16382. -+#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  16383. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  16384. -
  16385. - struct msgbuf_common_hdr {
  16386. -@@ -797,6 +797,8 @@ static int brcmf_msgbuf_txdata(struct br
  16387. - struct brcmf_flowring *flow = msgbuf->flow;
  16388. - struct ethhdr *eh = (struct ethhdr *)(skb->data);
  16389. - u32 flowid;
  16390. -+ u32 queue_count;
  16391. -+ bool force;
  16392. -
  16393. - flowid = brcmf_flowring_lookup(flow, eh->h_dest, skb->priority, ifidx);
  16394. - if (flowid == BRCMF_FLOWRING_INVALID_ID) {
  16395. -@@ -804,8 +806,9 @@ static int brcmf_msgbuf_txdata(struct br
  16396. - if (flowid == BRCMF_FLOWRING_INVALID_ID)
  16397. - return -ENOMEM;
  16398. - }
  16399. -- brcmf_flowring_enqueue(flow, flowid, skb);
  16400. -- brcmf_msgbuf_schedule_txdata(msgbuf, flowid, false);
  16401. -+ queue_count = brcmf_flowring_enqueue(flow, flowid, skb);
  16402. -+ force = ((queue_count % BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS) == 0);
  16403. -+ brcmf_msgbuf_schedule_txdata(msgbuf, flowid, force);
  16404. -
  16405. - return 0;
  16406. - }
  16407. 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
  16408. deleted file mode 100644
  16409. index 61153c4..0000000
  16410. --- a/package/kernel/mac80211/patches/370-brcmfmac-remove-pci-shared-structure-rev4-support.patch
  16411. +++ /dev/null
  16412. @@ -1,41 +0,0 @@
  16413. -From: Franky Lin <frankyl@broadcom.com>
  16414. -Date: Wed, 20 May 2015 14:09:49 +0200
  16415. -Subject: [PATCH] brcmfmac: remove pci shared structure rev4 support
  16416. -
  16417. -All pcie full dongle chips supported by fmac are using rev 5+ shared
  16418. -structure. This patch removes the rev4 related code.
  16419. -
  16420. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16421. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16422. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16423. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16424. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16425. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16426. ----
  16427. -
  16428. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16429. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16430. -@@ -112,10 +112,9 @@ enum brcmf_pcie_state {
  16431. - BRCMF_PCIE_MB_INT_D2H3_DB0 | \
  16432. - BRCMF_PCIE_MB_INT_D2H3_DB1)
  16433. -
  16434. --#define BRCMF_PCIE_MIN_SHARED_VERSION 4
  16435. -+#define BRCMF_PCIE_MIN_SHARED_VERSION 5
  16436. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  16437. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  16438. --#define BRCMF_PCIE_SHARED_TXPUSH_SUPPORT 0x4000
  16439. -
  16440. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  16441. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  16442. -@@ -1280,11 +1279,6 @@ brcmf_pcie_init_share_ram_info(struct br
  16443. - brcmf_err("Unsupported PCIE version %d\n", version);
  16444. - return -EINVAL;
  16445. - }
  16446. -- if (shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT) {
  16447. -- brcmf_err("Unsupported legacy TX mode 0x%x\n",
  16448. -- shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT);
  16449. -- return -EINVAL;
  16450. -- }
  16451. -
  16452. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  16453. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  16454. 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
  16455. deleted file mode 100644
  16456. index 8c8eebe..0000000
  16457. --- a/package/kernel/mac80211/patches/371-brcmfmac-remove-dummy-cache-flush-invalidate-functio.patch
  16458. +++ /dev/null
  16459. @@ -1,120 +0,0 @@
  16460. -From: Franky Lin <frankyl@broadcom.com>
  16461. -Date: Wed, 20 May 2015 14:09:50 +0200
  16462. -Subject: [PATCH] brcmfmac: remove dummy cache flush/invalidate function
  16463. -
  16464. -brcmf_dma_flush and brcmf_dma_invalidate_cache are not necessary and
  16465. -have never been implemented.
  16466. -
  16467. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16468. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16469. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16470. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16471. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16472. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16473. ----
  16474. -
  16475. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  16476. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  16477. -@@ -22,17 +22,6 @@
  16478. - #include "core.h"
  16479. - #include "commonring.h"
  16480. -
  16481. --
  16482. --/* dma flushing needs implementation for mips and arm platforms. Should
  16483. -- * be put in util. Note, this is not real flushing. It is virtual non
  16484. -- * cached memory. Only write buffers should have to be drained. Though
  16485. -- * this may be different depending on platform......
  16486. -- * SEE ALSO msgbuf.c
  16487. -- */
  16488. --#define brcmf_dma_flush(addr, len)
  16489. --#define brcmf_dma_invalidate_cache(addr, len)
  16490. --
  16491. --
  16492. - void brcmf_commonring_register_cb(struct brcmf_commonring *commonring,
  16493. - int (*cr_ring_bell)(void *ctx),
  16494. - int (*cr_update_rptr)(void *ctx),
  16495. -@@ -206,14 +195,9 @@ int brcmf_commonring_write_complete(stru
  16496. - address = commonring->buf_addr;
  16497. - address += (commonring->f_ptr * commonring->item_len);
  16498. - if (commonring->f_ptr > commonring->w_ptr) {
  16499. -- brcmf_dma_flush(address,
  16500. -- (commonring->depth - commonring->f_ptr) *
  16501. -- commonring->item_len);
  16502. - address = commonring->buf_addr;
  16503. - commonring->f_ptr = 0;
  16504. - }
  16505. -- brcmf_dma_flush(address, (commonring->w_ptr - commonring->f_ptr) *
  16506. -- commonring->item_len);
  16507. -
  16508. - commonring->f_ptr = commonring->w_ptr;
  16509. -
  16510. -@@ -258,8 +242,6 @@ void *brcmf_commonring_get_read_ptr(stru
  16511. - if (commonring->r_ptr == commonring->depth)
  16512. - commonring->r_ptr = 0;
  16513. -
  16514. -- brcmf_dma_invalidate_cache(ret_addr, *n_ items * commonring->item_len);
  16515. --
  16516. - return ret_addr;
  16517. - }
  16518. -
  16519. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16520. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16521. -@@ -278,16 +278,6 @@ struct brcmf_msgbuf_pktids {
  16522. - struct brcmf_msgbuf_pktid *array;
  16523. - };
  16524. -
  16525. --
  16526. --/* dma flushing needs implementation for mips and arm platforms. Should
  16527. -- * be put in util. Note, this is not real flushing. It is virtual non
  16528. -- * cached memory. Only write buffers should have to be drained. Though
  16529. -- * this may be different depending on platform......
  16530. -- */
  16531. --#define brcmf_dma_flush(addr, len)
  16532. --#define brcmf_dma_invalidate_cache(addr, len)
  16533. --
  16534. --
  16535. - static void brcmf_msgbuf_rxbuf_ioctlresp_post(struct brcmf_msgbuf *msgbuf);
  16536. -
  16537. -
  16538. -@@ -462,7 +452,6 @@ static int brcmf_msgbuf_tx_ioctl(struct
  16539. - memcpy(msgbuf->ioctbuf, buf, buf_len);
  16540. - else
  16541. - memset(msgbuf->ioctbuf, 0, buf_len);
  16542. -- brcmf_dma_flush(ioctl_buf, buf_len);
  16543. -
  16544. - err = brcmf_commonring_write_complete(commonring);
  16545. - brcmf_commonring_unlock(commonring);
  16546. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16547. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16548. -@@ -276,15 +276,6 @@ static const u32 brcmf_ring_itemsize[BRC
  16549. - };
  16550. -
  16551. -
  16552. --/* dma flushing needs implementation for mips and arm platforms. Should
  16553. -- * be put in util. Note, this is not real flushing. It is virtual non
  16554. -- * cached memory. Only write buffers should have to be drained. Though
  16555. -- * this may be different depending on platform......
  16556. -- */
  16557. --#define brcmf_dma_flush(addr, len)
  16558. --#define brcmf_dma_invalidate_cache(addr, len)
  16559. --
  16560. --
  16561. - static u32
  16562. - brcmf_pcie_read_reg32(struct brcmf_pciedev_info *devinfo, u32 reg_offset)
  16563. - {
  16564. -@@ -1174,7 +1165,6 @@ static int brcmf_pcie_init_scratchbuffer
  16565. - goto fail;
  16566. -
  16567. - memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  16568. -- brcmf_dma_flush(devinfo->shared.scratch, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  16569. -
  16570. - addr = devinfo->shared.tcm_base_address +
  16571. - BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
  16572. -@@ -1192,7 +1182,6 @@ static int brcmf_pcie_init_scratchbuffer
  16573. - goto fail;
  16574. -
  16575. - memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  16576. -- brcmf_dma_flush(devinfo->shared.ringupd, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  16577. -
  16578. - addr = devinfo->shared.tcm_base_address +
  16579. - BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
  16580. 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
  16581. deleted file mode 100644
  16582. index 2f50abd..0000000
  16583. --- a/package/kernel/mac80211/patches/372-brcmfmac-add-support-for-dma-indices-feature.patch
  16584. +++ /dev/null
  16585. @@ -1,270 +0,0 @@
  16586. -From: Franky Lin <frankyl@broadcom.com>
  16587. -Date: Wed, 20 May 2015 14:09:51 +0200
  16588. -Subject: [PATCH] brcmfmac: add support for dma indices feature
  16589. -
  16590. -PCIe full dongle firmware can support a dma indices feature with which
  16591. -firmware can update/fetch the read/write indices of message buffer
  16592. -rings on both host to dongle and dongle to host directions. The support is
  16593. -announced by firmware through shared flags.
  16594. -
  16595. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16596. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16597. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16598. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16599. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16600. ----
  16601. -
  16602. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16603. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16604. -@@ -115,6 +115,8 @@ enum brcmf_pcie_state {
  16605. - #define BRCMF_PCIE_MIN_SHARED_VERSION 5
  16606. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  16607. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  16608. -+#define BRCMF_PCIE_SHARED_DMA_INDEX 0x10000
  16609. -+#define BRCMF_PCIE_SHARED_DMA_2B_IDX 0x100000
  16610. -
  16611. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  16612. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  16613. -@@ -146,6 +148,10 @@ enum brcmf_pcie_state {
  16614. - #define BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET 8
  16615. - #define BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET 12
  16616. - #define BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET 16
  16617. -+#define BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET 20
  16618. -+#define BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET 28
  16619. -+#define BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET 36
  16620. -+#define BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET 44
  16621. - #define BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET 0
  16622. - #define BRCMF_SHARED_RING_MAX_SUB_QUEUES 52
  16623. -
  16624. -@@ -247,6 +253,13 @@ struct brcmf_pciedev_info {
  16625. - bool mbdata_completed;
  16626. - bool irq_allocated;
  16627. - bool wowl_enabled;
  16628. -+ u8 dma_idx_sz;
  16629. -+ void *idxbuf;
  16630. -+ u32 idxbuf_sz;
  16631. -+ dma_addr_t idxbuf_dmahandle;
  16632. -+ u16 (*read_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset);
  16633. -+ void (*write_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  16634. -+ u16 value);
  16635. - };
  16636. -
  16637. - struct brcmf_pcie_ringbuf {
  16638. -@@ -323,6 +336,25 @@ brcmf_pcie_write_tcm16(struct brcmf_pcie
  16639. - }
  16640. -
  16641. -
  16642. -+static u16
  16643. -+brcmf_pcie_read_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  16644. -+{
  16645. -+ u16 *address = devinfo->idxbuf + mem_offset;
  16646. -+
  16647. -+ return (*(address));
  16648. -+}
  16649. -+
  16650. -+
  16651. -+static void
  16652. -+brcmf_pcie_write_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  16653. -+ u16 value)
  16654. -+{
  16655. -+ u16 *address = devinfo->idxbuf + mem_offset;
  16656. -+
  16657. -+ *(address) = value;
  16658. -+}
  16659. -+
  16660. -+
  16661. - static u32
  16662. - brcmf_pcie_read_tcm32(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  16663. - {
  16664. -@@ -868,7 +900,7 @@ static int brcmf_pcie_ring_mb_write_rptr
  16665. - brcmf_dbg(PCIE, "W r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  16666. - commonring->w_ptr, ring->id);
  16667. -
  16668. -- brcmf_pcie_write_tcm16(devinfo, ring->r_idx_addr, commonring->r_ptr);
  16669. -+ devinfo->write_ptr(devinfo, ring->r_idx_addr, commonring->r_ptr);
  16670. -
  16671. - return 0;
  16672. - }
  16673. -@@ -886,7 +918,7 @@ static int brcmf_pcie_ring_mb_write_wptr
  16674. - brcmf_dbg(PCIE, "W w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  16675. - commonring->r_ptr, ring->id);
  16676. -
  16677. -- brcmf_pcie_write_tcm16(devinfo, ring->w_idx_addr, commonring->w_ptr);
  16678. -+ devinfo->write_ptr(devinfo, ring->w_idx_addr, commonring->w_ptr);
  16679. -
  16680. - return 0;
  16681. - }
  16682. -@@ -915,7 +947,7 @@ static int brcmf_pcie_ring_mb_update_rpt
  16683. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  16684. - return -EIO;
  16685. -
  16686. -- commonring->r_ptr = brcmf_pcie_read_tcm16(devinfo, ring->r_idx_addr);
  16687. -+ commonring->r_ptr = devinfo->read_ptr(devinfo, ring->r_idx_addr);
  16688. -
  16689. - brcmf_dbg(PCIE, "R r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  16690. - commonring->w_ptr, ring->id);
  16691. -@@ -933,7 +965,7 @@ static int brcmf_pcie_ring_mb_update_wpt
  16692. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  16693. - return -EIO;
  16694. -
  16695. -- commonring->w_ptr = brcmf_pcie_read_tcm16(devinfo, ring->w_idx_addr);
  16696. -+ commonring->w_ptr = devinfo->read_ptr(devinfo, ring->w_idx_addr);
  16697. -
  16698. - brcmf_dbg(PCIE, "R w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  16699. - commonring->r_ptr, ring->id);
  16700. -@@ -1038,6 +1070,13 @@ static void brcmf_pcie_release_ringbuffe
  16701. - }
  16702. - kfree(devinfo->shared.flowrings);
  16703. - devinfo->shared.flowrings = NULL;
  16704. -+ if (devinfo->idxbuf) {
  16705. -+ dma_free_coherent(&devinfo->pdev->dev,
  16706. -+ devinfo->idxbuf_sz,
  16707. -+ devinfo->idxbuf,
  16708. -+ devinfo->idxbuf_dmahandle);
  16709. -+ devinfo->idxbuf = NULL;
  16710. -+ }
  16711. - }
  16712. -
  16713. -
  16714. -@@ -1053,19 +1092,72 @@ static int brcmf_pcie_init_ringbuffers(s
  16715. - u32 addr;
  16716. - u32 ring_mem_ptr;
  16717. - u32 i;
  16718. -+ u64 address;
  16719. -+ u32 bufsz;
  16720. - u16 max_sub_queues;
  16721. -+ u8 idx_offset;
  16722. -
  16723. - ring_addr = devinfo->shared.ring_info_addr;
  16724. - brcmf_dbg(PCIE, "Base ring addr = 0x%08x\n", ring_addr);
  16725. -+ addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  16726. -+ max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  16727. -
  16728. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  16729. -- d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16730. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  16731. -- d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16732. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  16733. -- h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16734. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  16735. -- h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16736. -+ if (devinfo->dma_idx_sz != 0) {
  16737. -+ bufsz = (BRCMF_NROF_D2H_COMMON_MSGRINGS + max_sub_queues) *
  16738. -+ devinfo->dma_idx_sz * 2;
  16739. -+ devinfo->idxbuf = dma_alloc_coherent(&devinfo->pdev->dev, bufsz,
  16740. -+ &devinfo->idxbuf_dmahandle,
  16741. -+ GFP_KERNEL);
  16742. -+ if (!devinfo->idxbuf)
  16743. -+ devinfo->dma_idx_sz = 0;
  16744. -+ }
  16745. -+
  16746. -+ if (devinfo->dma_idx_sz == 0) {
  16747. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  16748. -+ d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16749. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  16750. -+ d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16751. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  16752. -+ h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16753. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  16754. -+ h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16755. -+ idx_offset = sizeof(u32);
  16756. -+ devinfo->write_ptr = brcmf_pcie_write_tcm16;
  16757. -+ devinfo->read_ptr = brcmf_pcie_read_tcm16;
  16758. -+ brcmf_dbg(PCIE, "Using TCM indices\n");
  16759. -+ } else {
  16760. -+ memset(devinfo->idxbuf, 0, bufsz);
  16761. -+ devinfo->idxbuf_sz = bufsz;
  16762. -+ idx_offset = devinfo->dma_idx_sz;
  16763. -+ devinfo->write_ptr = brcmf_pcie_write_idx;
  16764. -+ devinfo->read_ptr = brcmf_pcie_read_idx;
  16765. -+
  16766. -+ h2d_w_idx_ptr = 0;
  16767. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET;
  16768. -+ address = (u64)devinfo->idxbuf_dmahandle;
  16769. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16770. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16771. -+
  16772. -+ h2d_r_idx_ptr = h2d_w_idx_ptr + max_sub_queues * idx_offset;
  16773. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET;
  16774. -+ address += max_sub_queues * idx_offset;
  16775. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16776. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16777. -+
  16778. -+ d2h_w_idx_ptr = h2d_r_idx_ptr + max_sub_queues * idx_offset;
  16779. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET;
  16780. -+ address += max_sub_queues * idx_offset;
  16781. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16782. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16783. -+
  16784. -+ d2h_r_idx_ptr = d2h_w_idx_ptr +
  16785. -+ BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  16786. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET;
  16787. -+ address += BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  16788. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16789. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16790. -+ brcmf_dbg(PCIE, "Using host memory indices\n");
  16791. -+ }
  16792. -
  16793. - addr = ring_addr + BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET;
  16794. - ring_mem_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16795. -@@ -1079,8 +1171,8 @@ static int brcmf_pcie_init_ringbuffers(s
  16796. - ring->id = i;
  16797. - devinfo->shared.commonrings[i] = ring;
  16798. -
  16799. -- h2d_w_idx_ptr += sizeof(u32);
  16800. -- h2d_r_idx_ptr += sizeof(u32);
  16801. -+ h2d_w_idx_ptr += idx_offset;
  16802. -+ h2d_r_idx_ptr += idx_offset;
  16803. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  16804. - }
  16805. -
  16806. -@@ -1094,13 +1186,11 @@ static int brcmf_pcie_init_ringbuffers(s
  16807. - ring->id = i;
  16808. - devinfo->shared.commonrings[i] = ring;
  16809. -
  16810. -- d2h_w_idx_ptr += sizeof(u32);
  16811. -- d2h_r_idx_ptr += sizeof(u32);
  16812. -+ d2h_w_idx_ptr += idx_offset;
  16813. -+ d2h_r_idx_ptr += idx_offset;
  16814. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  16815. - }
  16816. -
  16817. -- addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  16818. -- max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  16819. - devinfo->shared.nrof_flowrings =
  16820. - max_sub_queues - BRCMF_NROF_H2D_COMMON_MSGRINGS;
  16821. - rings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*ring),
  16822. -@@ -1124,15 +1214,15 @@ static int brcmf_pcie_init_ringbuffers(s
  16823. - ring);
  16824. - ring->w_idx_addr = h2d_w_idx_ptr;
  16825. - ring->r_idx_addr = h2d_r_idx_ptr;
  16826. -- h2d_w_idx_ptr += sizeof(u32);
  16827. -- h2d_r_idx_ptr += sizeof(u32);
  16828. -+ h2d_w_idx_ptr += idx_offset;
  16829. -+ h2d_r_idx_ptr += idx_offset;
  16830. - }
  16831. - devinfo->shared.flowrings = rings;
  16832. -
  16833. - return 0;
  16834. -
  16835. - fail:
  16836. -- brcmf_err("Allocating commonring buffers failed\n");
  16837. -+ brcmf_err("Allocating ring buffers failed\n");
  16838. - brcmf_pcie_release_ringbuffers(devinfo);
  16839. - return -ENOMEM;
  16840. - }
  16841. -@@ -1269,6 +1359,14 @@ brcmf_pcie_init_share_ram_info(struct br
  16842. - return -EINVAL;
  16843. - }
  16844. -
  16845. -+ /* check firmware support dma indicies */
  16846. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_INDEX) {
  16847. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_2B_IDX)
  16848. -+ devinfo->dma_idx_sz = sizeof(u16);
  16849. -+ else
  16850. -+ devinfo->dma_idx_sz = sizeof(u32);
  16851. -+ }
  16852. -+
  16853. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  16854. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  16855. - if (shared->max_rxbufpost == 0)
  16856. 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
  16857. deleted file mode 100644
  16858. index 28408d2..0000000
  16859. --- a/package/kernel/mac80211/patches/373-brcmfmac-avoid-null-pointer-access-when-brcmf_msgbuf.patch
  16860. +++ /dev/null
  16861. @@ -1,102 +0,0 @@
  16862. -From: Arend van Spriel <arend@broadcom.com>
  16863. -Date: Tue, 26 May 2015 13:19:46 +0200
  16864. -Subject: [PATCH] brcmfmac: avoid null pointer access when
  16865. - brcmf_msgbuf_get_pktid() fails
  16866. -
  16867. -The function brcmf_msgbuf_get_pktid() may return a NULL pointer so
  16868. -the callers should check the return pointer before accessing it to
  16869. -avoid the crash below (see [1]):
  16870. -
  16871. -brcmfmac: brcmf_msgbuf_get_pktid: Invalid packet id 273 (not in use)
  16872. -BUG: unable to handle kernel NULL pointer dereference at 0000000000000080
  16873. -IP: [<ffffffff8145b225>] skb_pull+0x5/0x50
  16874. -PGD 0
  16875. -Oops: 0000 [#1] PREEMPT SMP
  16876. -Modules linked in: pci_stub vboxpci(O) vboxnetflt(O) vboxnetadp(O) vboxdrv(O)
  16877. - snd_hda_codec_hdmi bnep mousedev hid_generic ushwmon msr ext4 crc16 mbcache
  16878. - jbd2 sd_mod uas usb_storage ahci libahci libata scsi_mod xhci_pci xhci_hcd
  16879. - usbcore usb_common
  16880. -CPU: 0 PID: 1661 Comm: irq/61-brcmf_pc Tainted: G O 4.0.1-MacbookPro-ARCH #1
  16881. -Hardware name: Apple Inc. MacBookPro12,1/Mac-E43C1C25D4880AD6,
  16882. - BIOS MBP121.88Z.0167.B02.1503241251 03/24/2015
  16883. -task: ffff880264203cc0 ti: ffff88025ffe4000 task.ti: ffff88025ffe4000
  16884. -RIP: 0010:[<ffffffff8145b225>] [<ffffffff8145b225>] skb_pull+0x5/0x50
  16885. -RSP: 0018:ffff88025ffe7d40 EFLAGS: 00010202
  16886. -RAX: 0000000000000000 RBX: ffff88008a33c000 RCX: 0000000000000044
  16887. -RDX: 0000000000000000 RSI: 000000000000004a RDI: 0000000000000000
  16888. -RBP: ffff88025ffe7da8 R08: 0000000000000096 R09: 000000000000004a
  16889. -R10: 0000000000000000 R11: 000000000000048e R12: ffff88025ff14f00
  16890. -R13: 0000000000000000 R14: ffff880263b48200 R15: ffff88008a33c000
  16891. -FS: 0000000000000000(0000) GS:ffff88026ec00000(0000) knlGS:0000000000000000
  16892. -CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  16893. -CR2: 0000000000000080 CR3: 000000000180b000 CR4: 00000000003407f0
  16894. -Stack:
  16895. - ffffffffa06aed74 ffff88025ffe7dc8 ffff880263b48270 ffff880263b48278
  16896. - 05ea88020000004a 0002ffff81014635 000000001720b2f6 ffff88026ec116c0
  16897. - ffff880263b48200 0000000000010000 ffff880263b4ae00 ffff880264203cc0
  16898. -Call Trace:
  16899. - [<ffffffffa06aed74>] ? brcmf_msgbuf_process_rx+0x404/0x480 [brcmfmac]
  16900. - [<ffffffff810cea60>] ? irq_finalize_oneshot.part.30+0xf0/0xf0
  16901. - [<ffffffffa06afb55>] brcmf_proto_msgbuf_rx_trigger+0x35/0xf0 [brcmfmac]
  16902. - [<ffffffffa06baf2a>] brcmf_pcie_isr_thread_v2+0x8a/0x130 [brcmfmac]
  16903. - [<ffffffff810cea80>] irq_thread_fn+0x20/0x50
  16904. - [<ffffffff810ceddf>] irq_thread+0x13f/0x170
  16905. - [<ffffffff810cebf0>] ? wake_threads_waitq+0x30/0x30
  16906. - [<ffffffff810ceca0>] ? irq_thread_dtor+0xb0/0xb0
  16907. - [<ffffffff81092a08>] kthread+0xd8/0xf0
  16908. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  16909. - [<ffffffff8156d898>] ret_from_fork+0x58/0x90
  16910. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  16911. -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
  16912. - f7 88 50 01 c3 66 0f 1f 84 00 00 00 00 00 0f 1f
  16913. -RIP [<ffffffff8145b225>] skb_pull+0x5/0x50
  16914. - RSP <ffff88025ffe7d40>
  16915. -CR2: 0000000000000080
  16916. ----[ end trace b074c0f90e7c997d ]---
  16917. -
  16918. -[1] http://mid.gmane.org/20150430193259.GA5630@googlemail.com
  16919. -
  16920. -Cc: <stable@vger.kernel.org> # v3.18, v3.19, v4.0, v4.1
  16921. -Reported-by: Michael Hornung <mhornung.linux@gmail.com>
  16922. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16923. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16924. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16925. ----
  16926. -
  16927. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16928. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16929. -@@ -500,11 +500,9 @@ static int brcmf_msgbuf_query_dcmd(struc
  16930. - msgbuf->rx_pktids,
  16931. - msgbuf->ioctl_resp_pktid);
  16932. - if (msgbuf->ioctl_resp_ret_len != 0) {
  16933. -- if (!skb) {
  16934. -- brcmf_err("Invalid packet id idx recv'd %d\n",
  16935. -- msgbuf->ioctl_resp_pktid);
  16936. -+ if (!skb)
  16937. - return -EBADF;
  16938. -- }
  16939. -+
  16940. - memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ?
  16941. - len : msgbuf->ioctl_resp_ret_len);
  16942. - }
  16943. -@@ -866,10 +864,8 @@ brcmf_msgbuf_process_txstatus(struct brc
  16944. - flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS;
  16945. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  16946. - msgbuf->tx_pktids, idx);
  16947. -- if (!skb) {
  16948. -- brcmf_err("Invalid packet id idx recv'd %d\n", idx);
  16949. -+ if (!skb)
  16950. - return;
  16951. -- }
  16952. -
  16953. - set_bit(flowid, msgbuf->txstatus_done_map);
  16954. - commonring = msgbuf->flowrings[flowid];
  16955. -@@ -1148,6 +1144,8 @@ brcmf_msgbuf_process_rx_complete(struct
  16956. -
  16957. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  16958. - msgbuf->rx_pktids, idx);
  16959. -+ if (!skb)
  16960. -+ return;
  16961. -
  16962. - if (data_offset)
  16963. - skb_pull(skb, data_offset);
  16964. 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
  16965. deleted file mode 100644
  16966. index f023034..0000000
  16967. --- a/package/kernel/mac80211/patches/374-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch
  16968. +++ /dev/null
  16969. @@ -1,63 +0,0 @@
  16970. -From: Arend van Spriel <arend@broadcom.com>
  16971. -Date: Wed, 27 May 2015 19:31:41 +0200
  16972. -Subject: [PATCH] brcmfmac: fix invalid access to struct acpi_device fields
  16973. -
  16974. -The fields of struct acpi_device are only known when CONFIG_ACPI is
  16975. -defined. Fix this by using a helper function. This will resolve the
  16976. -issue found in linux-next:
  16977. -
  16978. - ../brcmfmac/bcmsdh.c: In function 'brcmf_ops_sdio_probe':
  16979. - ../brcmfmac/bcmsdh.c:1139:7: error: dereferencing pointer to incomplete type
  16980. - adev->flags.power_manageable = 0;
  16981. - ^
  16982. -
  16983. -Fixes: f0992ace680c ("brcmfmac: prohibit ACPI power management ...")
  16984. -Cc: Fu, Zhonghui <zhonghui.fu@linux.intel.com>
  16985. -Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
  16986. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16987. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16988. ----
  16989. -
  16990. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16991. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16992. -@@ -1117,6 +1117,18 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_id
  16993. - static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
  16994. -
  16995. -
  16996. -+static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
  16997. -+ int val)
  16998. -+{
  16999. -+#if IS_ENABLED(CONFIG_ACPI)
  17000. -+ struct acpi_device *adev;
  17001. -+
  17002. -+ adev = ACPI_COMPANION(dev);
  17003. -+ if (adev)
  17004. -+ adev->flags.power_manageable = 0;
  17005. -+#endif
  17006. -+}
  17007. -+
  17008. - static int brcmf_ops_sdio_probe(struct sdio_func *func,
  17009. - const struct sdio_device_id *id)
  17010. - {
  17011. -@@ -1124,7 +1136,6 @@ static int brcmf_ops_sdio_probe(struct s
  17012. - struct brcmf_sdio_dev *sdiodev;
  17013. - struct brcmf_bus *bus_if;
  17014. - struct device *dev;
  17015. -- struct acpi_device *adev;
  17016. -
  17017. - brcmf_dbg(SDIO, "Enter\n");
  17018. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  17019. -@@ -1132,11 +1143,9 @@ static int brcmf_ops_sdio_probe(struct s
  17020. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  17021. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  17022. -
  17023. -- /* prohibit ACPI power management for this device */
  17024. - dev = &func->dev;
  17025. -- adev = ACPI_COMPANION(dev);
  17026. -- if (adev)
  17027. -- adev->flags.power_manageable = 0;
  17028. -+ /* prohibit ACPI power management for this device */
  17029. -+ brcmf_sdiod_acpi_set_power_manageable(dev, 0);
  17030. -
  17031. - /* Consume func num 1 but dont do anything with it. */
  17032. - if (func->num == 1)
  17033. 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
  17034. deleted file mode 100644
  17035. index 2bfd44f..0000000
  17036. --- a/package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
  17037. +++ /dev/null
  17038. @@ -1,56 +0,0 @@
  17039. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17040. -Date: Wed, 20 May 2015 09:34:21 +0200
  17041. -Subject: [PATCH] brcmfmac: simplify check stripping v2 NVRAM
  17042. -MIME-Version: 1.0
  17043. -Content-Type: text/plain; charset=UTF-8
  17044. -Content-Transfer-Encoding: 8bit
  17045. -
  17046. -Comparing NVRAM entry with a full filtering string is simpler than
  17047. -comparing it with a short prefix and then checking random chars at magic
  17048. -offsets. The cost of snprintf relatively low, we execute it just once.
  17049. -Tested on BCM43602 with NVRAM hacked to use V2 format.
  17050. -
  17051. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17052. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17053. ----
  17054. -
  17055. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17056. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17057. -@@ -25,7 +25,7 @@
  17058. -
  17059. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  17060. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  17061. --#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  17062. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  17063. -
  17064. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  17065. - module_param_string(firmware_path, brcmf_firmware_path,
  17066. -@@ -297,6 +297,8 @@ fail:
  17067. - static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  17068. - u16 bus_nr)
  17069. - {
  17070. -+ char prefix[BRCMF_FW_NVRAM_PCIEDEV_LEN];
  17071. -+ size_t len;
  17072. - u32 i, j;
  17073. - u8 *nvram;
  17074. -
  17075. -@@ -308,14 +310,13 @@ static void brcmf_fw_strip_multi_v2(stru
  17076. - * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  17077. - * Y = bus_nr.
  17078. - */
  17079. -+ snprintf(prefix, sizeof(prefix), "pcie/%d/%d/", domain_nr, bus_nr);
  17080. -+ len = strlen(prefix);
  17081. - i = 0;
  17082. - j = 0;
  17083. -- while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  17084. -- if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  17085. -- (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  17086. -- ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  17087. -- ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  17088. -- i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  17089. -+ while (i < nvp->nvram_len - len) {
  17090. -+ if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  17091. -+ i += len;
  17092. - while (nvp->nvram[i] != 0) {
  17093. - nvram[j] = nvp->nvram[i];
  17094. - i++;
  17095. 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
  17096. deleted file mode 100644
  17097. index 0e65114..0000000
  17098. --- a/package/kernel/mac80211/patches/376-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch
  17099. +++ /dev/null
  17100. @@ -1,57 +0,0 @@
  17101. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17102. -Date: Wed, 20 May 2015 11:01:08 +0200
  17103. -Subject: [PATCH] brcmfmac: simplify check finding NVRAM v1 device path
  17104. -MIME-Version: 1.0
  17105. -Content-Type: text/plain; charset=UTF-8
  17106. -Content-Transfer-Encoding: 8bit
  17107. -
  17108. -With a simple use of snprintf and small buffer we can compare NVRAM
  17109. -entry value with a full string. This way we avoid checking random chars
  17110. -at magic offsets.
  17111. -Tested on BCM43602 with NVRAM hacked to use v1 format.
  17112. -
  17113. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17114. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17115. ----
  17116. -
  17117. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17118. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17119. -@@ -222,6 +222,10 @@ static int brcmf_init_nvram_parser(struc
  17120. - static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  17121. - u16 bus_nr)
  17122. - {
  17123. -+ /* Device path with a leading '=' key-value separator */
  17124. -+ char pcie_path[] = "=pcie/?/?";
  17125. -+ size_t pcie_len;
  17126. -+
  17127. - u32 i, j;
  17128. - bool found;
  17129. - u8 *nvram;
  17130. -@@ -238,6 +242,9 @@ static void brcmf_fw_strip_multi_v1(stru
  17131. - /* First search for the devpathX and see if it is the configuration
  17132. - * for domain_nr/bus_nr. Search complete nvp
  17133. - */
  17134. -+ snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  17135. -+ bus_nr);
  17136. -+ pcie_len = strlen(pcie_path);
  17137. - found = false;
  17138. - i = 0;
  17139. - while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  17140. -@@ -245,13 +252,10 @@ static void brcmf_fw_strip_multi_v1(stru
  17141. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  17142. - */
  17143. - if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  17144. -- (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  17145. -- if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  17146. -- ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  17147. -- id = nvp->nvram[i + 7] - '0';
  17148. -- found = true;
  17149. -- break;
  17150. -- }
  17151. -+ (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  17152. -+ id = nvp->nvram[i + 7] - '0';
  17153. -+ found = true;
  17154. -+ break;
  17155. - }
  17156. - while (nvp->nvram[i] != 0)
  17157. - i++;
  17158. 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
  17159. deleted file mode 100644
  17160. index dc174e5..0000000
  17161. --- a/package/kernel/mac80211/patches/377-brcmfmac-treat-0-as-end-of-comment-when-parsing-NVRA.patch
  17162. +++ /dev/null
  17163. @@ -1,45 +0,0 @@
  17164. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17165. -Date: Wed, 20 May 2015 13:59:54 +0200
  17166. -Subject: [PATCH] brcmfmac: treat \0 as end of comment when parsing NVRAM
  17167. -MIME-Version: 1.0
  17168. -Content-Type: text/plain; charset=UTF-8
  17169. -Content-Transfer-Encoding: 8bit
  17170. -
  17171. -This fixes brcmfmac dealing with NVRAM coming from platform e.g. from a
  17172. -flash MTD partition. In such cases entries are separated by \0 instead
  17173. -of \n which caused ignoring whole content after the first "comment".
  17174. -While platform NVRAM doesn't usually contain comments, we switch to
  17175. -COMMENT state after e.g. finding an unexpected char in key name.
  17176. -
  17177. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17178. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17179. ----
  17180. -
  17181. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17182. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17183. -@@ -162,17 +162,20 @@ brcmf_nvram_handle_value(struct nvram_pa
  17184. - static enum nvram_parser_state
  17185. - brcmf_nvram_handle_comment(struct nvram_parser *nvp)
  17186. - {
  17187. -- char *eol, *sol;
  17188. -+ char *eoc, *sol;
  17189. -
  17190. - sol = (char *)&nvp->fwnv->data[nvp->pos];
  17191. -- eol = strchr(sol, '\n');
  17192. -- if (eol == NULL)
  17193. -- return END;
  17194. -+ eoc = strchr(sol, '\n');
  17195. -+ if (!eoc) {
  17196. -+ eoc = strchr(sol, '\0');
  17197. -+ if (!eoc)
  17198. -+ return END;
  17199. -+ }
  17200. -
  17201. - /* eat all moving to next line */
  17202. - nvp->line++;
  17203. - nvp->column = 1;
  17204. -- nvp->pos += (eol - sol) + 1;
  17205. -+ nvp->pos += (eoc - sol) + 1;
  17206. - return IDLE;
  17207. - }
  17208. -
  17209. 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
  17210. deleted file mode 100644
  17211. index 5700142..0000000
  17212. --- a/package/kernel/mac80211/patches/378-brcmfmac-allow-NVRAM-values-to-contain-spaces.patch
  17213. +++ /dev/null
  17214. @@ -1,50 +0,0 @@
  17215. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17216. -Date: Sat, 23 May 2015 09:15:33 +0200
  17217. -Subject: [PATCH] brcmfmac: allow NVRAM values to contain spaces
  17218. -MIME-Version: 1.0
  17219. -Content-Type: text/plain; charset=UTF-8
  17220. -Content-Transfer-Encoding: 8bit
  17221. -
  17222. -Platform NVRAMs often contain values with spaces. Even if right now most
  17223. -firmware-supported entries are simple values, we shouldn't reject these
  17224. -with spaces. It was semi-confirmed by Broadcom in the early patch adding
  17225. -support for platform NVRAMs.
  17226. -
  17227. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17228. -Acked-by: Arend van Spriel <arend@broadcom.com>
  17229. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17230. ----
  17231. -
  17232. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17233. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17234. -@@ -66,6 +66,12 @@ struct nvram_parser {
  17235. - bool multi_dev_v2;
  17236. - };
  17237. -
  17238. -+/**
  17239. -+ * is_nvram_char() - check if char is a valid one for NVRAM entry
  17240. -+ *
  17241. -+ * It accepts all printable ASCII chars except for '#' which opens a comment.
  17242. -+ * Please note that ' ' (space) while accepted is not a valid key name char.
  17243. -+ */
  17244. - static bool is_nvram_char(char c)
  17245. - {
  17246. - /* comment marker excluded */
  17247. -@@ -73,7 +79,7 @@ static bool is_nvram_char(char c)
  17248. - return false;
  17249. -
  17250. - /* key and value may have any other readable character */
  17251. -- return (c > 0x20 && c < 0x7f);
  17252. -+ return (c >= 0x20 && c < 0x7f);
  17253. - }
  17254. -
  17255. - static bool is_whitespace(char c)
  17256. -@@ -120,7 +126,7 @@ static enum nvram_parser_state brcmf_nvr
  17257. - nvp->multi_dev_v1 = true;
  17258. - if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  17259. - nvp->multi_dev_v2 = true;
  17260. -- } else if (!is_nvram_char(c)) {
  17261. -+ } else if (!is_nvram_char(c) || c == ' ') {
  17262. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  17263. - nvp->line, nvp->column);
  17264. - return COMMENT;
  17265. 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
  17266. deleted file mode 100644
  17267. index 814b0d7..0000000
  17268. --- a/package/kernel/mac80211/patches/379-ath9k-fix-DMA-stop-sequence-for-AR9003.patch
  17269. +++ /dev/null
  17270. @@ -1,33 +0,0 @@
  17271. -From: Felix Fietkau <nbd@openwrt.org>
  17272. -Date: Tue, 2 Jun 2015 10:35:46 +0200
  17273. -Subject: [PATCH] ath9k: fix DMA stop sequence for AR9003+
  17274. -
  17275. -AR93xx and newer needs to stop rx before tx to avoid getting the DMA
  17276. -engine or MAC into a stuck state.
  17277. -This should reduce/fix the occurence of "Failed to stop Tx DMA" logspam.
  17278. -
  17279. -Cc: stable@vger.kernel.org
  17280. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  17281. ----
  17282. -
  17283. ---- a/drivers/net/wireless/ath/ath9k/main.c
  17284. -+++ b/drivers/net/wireless/ath/ath9k/main.c
  17285. -@@ -216,11 +216,13 @@ static bool ath_prepare_reset(struct ath
  17286. - ath_stop_ani(sc);
  17287. - ath9k_hw_disable_interrupts(ah);
  17288. -
  17289. -- if (!ath_drain_all_txq(sc))
  17290. -- ret = false;
  17291. --
  17292. -- if (!ath_stoprecv(sc))
  17293. -- ret = false;
  17294. -+ if (AR_SREV_9300_20_OR_LATER(ah)) {
  17295. -+ ret &= ath_stoprecv(sc);
  17296. -+ ret &= ath_drain_all_txq(sc);
  17297. -+ } else {
  17298. -+ ret &= ath_drain_all_txq(sc);
  17299. -+ ret &= ath_stoprecv(sc);
  17300. -+ }
  17301. -
  17302. - return ret;
  17303. - }
  17304. 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
  17305. deleted file mode 100644
  17306. index 7bbd57e..0000000
  17307. --- a/package/kernel/mac80211/patches/380-brcmfmac-support-NVRAMs-containing-pci-devpaths-inst.patch
  17308. +++ /dev/null
  17309. @@ -1,56 +0,0 @@
  17310. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17311. -Date: Thu, 28 May 2015 14:19:21 +0200
  17312. -Subject: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of
  17313. - pcie)
  17314. -MIME-Version: 1.0
  17315. -Content-Type: text/plain; charset=UTF-8
  17316. -Content-Transfer-Encoding: 8bit
  17317. -
  17318. -Recently Broadcom added support for NVRAMs with entries for multiple
  17319. -PCIe devices. One of the supported formats is based on prefixes defined
  17320. -like: devpath0=pcie/1/4/ and entries like 0:foo=bar 0:baz=qux etc.
  17321. -
  17322. -Unfortunately there are also a bit older devices using different way of
  17323. -defining prefixes, e.g. SmartRG SR400ac (2 x BCM43602) with entries:
  17324. -devpath0=pci/1/1/
  17325. -devpath1=pci/2/1
  17326. -Broadcom stated this old format will never be used/supported by brcmfmac
  17327. -but given the simplicity of this patch I'll insist on supporting it.
  17328. -
  17329. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17330. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17331. ----
  17332. -
  17333. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17334. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17335. -@@ -232,6 +232,8 @@ static void brcmf_fw_strip_multi_v1(stru
  17336. - u16 bus_nr)
  17337. - {
  17338. - /* Device path with a leading '=' key-value separator */
  17339. -+ char pci_path[] = "=pci/?/?";
  17340. -+ size_t pci_len;
  17341. - char pcie_path[] = "=pcie/?/?";
  17342. - size_t pcie_len;
  17343. -
  17344. -@@ -251,6 +253,9 @@ static void brcmf_fw_strip_multi_v1(stru
  17345. - /* First search for the devpathX and see if it is the configuration
  17346. - * for domain_nr/bus_nr. Search complete nvp
  17347. - */
  17348. -+ snprintf(pci_path, sizeof(pci_path), "=pci/%d/%d", domain_nr,
  17349. -+ bus_nr);
  17350. -+ pci_len = strlen(pci_path);
  17351. - snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  17352. - bus_nr);
  17353. - pcie_len = strlen(pcie_path);
  17354. -@@ -260,8 +265,9 @@ static void brcmf_fw_strip_multi_v1(stru
  17355. - /* Format: devpathX=pcie/Y/Z/
  17356. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  17357. - */
  17358. -- if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  17359. -- (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  17360. -+ if (strncmp(&nvp->nvram[i], "devpath", 7) == 0 &&
  17361. -+ (!strncmp(&nvp->nvram[i + 8], pci_path, pci_len) ||
  17362. -+ !strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len))) {
  17363. - id = nvp->nvram[i + 7] - '0';
  17364. - found = true;
  17365. - break;
  17366. 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
  17367. deleted file mode 100644
  17368. index 1eff6ed..0000000
  17369. --- a/package/kernel/mac80211/patches/381-brcmfmac-set-wiphy-perm_addr-to-hardware-MAC-address.patch
  17370. +++ /dev/null
  17371. @@ -1,23 +0,0 @@
  17372. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17373. -Date: Sun, 31 May 2015 02:52:26 +0200
  17374. -Subject: [PATCH] brcmfmac: set wiphy perm_addr to hardware MAC address
  17375. -MIME-Version: 1.0
  17376. -Content-Type: text/plain; charset=UTF-8
  17377. -Content-Transfer-Encoding: 8bit
  17378. -
  17379. -This allows e.g. user space to use /sys/class/ieee80211/*/macaddress
  17380. -
  17381. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17382. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17383. ----
  17384. -
  17385. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17386. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17387. -@@ -6070,6 +6070,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  17388. - brcmf_err("Could not allocate wiphy device\n");
  17389. - return NULL;
  17390. - }
  17391. -+ memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
  17392. - set_wiphy_dev(wiphy, busdev);
  17393. -
  17394. - cfg = wiphy_priv(wiphy);
  17395. 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
  17396. deleted file mode 100644
  17397. index c6e83dd..0000000
  17398. --- a/package/kernel/mac80211/patches/382-brcmfmac-use-direct-data-pointer-in-NVRAM-parser-str.patch
  17399. +++ /dev/null
  17400. @@ -1,144 +0,0 @@
  17401. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17402. -Date: Thu, 4 Jun 2015 22:11:07 +0200
  17403. -Subject: [PATCH] brcmfmac: use direct data pointer in NVRAM parser struct
  17404. -MIME-Version: 1.0
  17405. -Content-Type: text/plain; charset=UTF-8
  17406. -Content-Transfer-Encoding: 8bit
  17407. -
  17408. -As we plan to add support for platform NVRAM we should store direct
  17409. -data pointer without the extra struct firmware layer. This will allow
  17410. -us to support other sources with the only requirement being u8 buffer.
  17411. -
  17412. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17413. -Acked-by: Arend van Spriel <arend@broadcom.com>
  17414. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17415. ----
  17416. -
  17417. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17418. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17419. -@@ -43,7 +43,7 @@ enum nvram_parser_state {
  17420. - * struct nvram_parser - internal info for parser.
  17421. - *
  17422. - * @state: current parser state.
  17423. -- * @fwnv: input buffer being parsed.
  17424. -+ * @data: input buffer being parsed.
  17425. - * @nvram: output buffer with parse result.
  17426. - * @nvram_len: lenght of parse result.
  17427. - * @line: current line.
  17428. -@@ -55,7 +55,7 @@ enum nvram_parser_state {
  17429. - */
  17430. - struct nvram_parser {
  17431. - enum nvram_parser_state state;
  17432. -- const struct firmware *fwnv;
  17433. -+ const u8 *data;
  17434. - u8 *nvram;
  17435. - u32 nvram_len;
  17436. - u32 line;
  17437. -@@ -91,7 +91,7 @@ static enum nvram_parser_state brcmf_nvr
  17438. - {
  17439. - char c;
  17440. -
  17441. -- c = nvp->fwnv->data[nvp->pos];
  17442. -+ c = nvp->data[nvp->pos];
  17443. - if (c == '\n')
  17444. - return COMMENT;
  17445. - if (is_whitespace(c))
  17446. -@@ -115,16 +115,16 @@ static enum nvram_parser_state brcmf_nvr
  17447. - enum nvram_parser_state st = nvp->state;
  17448. - char c;
  17449. -
  17450. -- c = nvp->fwnv->data[nvp->pos];
  17451. -+ c = nvp->data[nvp->pos];
  17452. - if (c == '=') {
  17453. - /* ignore RAW1 by treating as comment */
  17454. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "RAW1", 4) == 0)
  17455. -+ if (strncmp(&nvp->data[nvp->entry], "RAW1", 4) == 0)
  17456. - st = COMMENT;
  17457. - else
  17458. - st = VALUE;
  17459. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  17460. -+ if (strncmp(&nvp->data[nvp->entry], "devpath", 7) == 0)
  17461. - nvp->multi_dev_v1 = true;
  17462. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  17463. -+ if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  17464. - nvp->multi_dev_v2 = true;
  17465. - } else if (!is_nvram_char(c) || c == ' ') {
  17466. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  17467. -@@ -145,11 +145,11 @@ brcmf_nvram_handle_value(struct nvram_pa
  17468. - char *ekv;
  17469. - u32 cplen;
  17470. -
  17471. -- c = nvp->fwnv->data[nvp->pos];
  17472. -+ c = nvp->data[nvp->pos];
  17473. - if (!is_nvram_char(c)) {
  17474. - /* key,value pair complete */
  17475. -- ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  17476. -- skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  17477. -+ ekv = (u8 *)&nvp->data[nvp->pos];
  17478. -+ skv = (u8 *)&nvp->data[nvp->entry];
  17479. - cplen = ekv - skv;
  17480. - if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  17481. - return END;
  17482. -@@ -170,7 +170,7 @@ brcmf_nvram_handle_comment(struct nvram_
  17483. - {
  17484. - char *eoc, *sol;
  17485. -
  17486. -- sol = (char *)&nvp->fwnv->data[nvp->pos];
  17487. -+ sol = (char *)&nvp->data[nvp->pos];
  17488. - eoc = strchr(sol, '\n');
  17489. - if (!eoc) {
  17490. - eoc = strchr(sol, '\0');
  17491. -@@ -201,17 +201,17 @@ static enum nvram_parser_state
  17492. - };
  17493. -
  17494. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  17495. -- const struct firmware *nv)
  17496. -+ const u8 *data, size_t data_len)
  17497. - {
  17498. - size_t size;
  17499. -
  17500. - memset(nvp, 0, sizeof(*nvp));
  17501. -- nvp->fwnv = nv;
  17502. -+ nvp->data = data;
  17503. - /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  17504. -- if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  17505. -+ if (data_len > BRCMF_FW_MAX_NVRAM_SIZE)
  17506. - size = BRCMF_FW_MAX_NVRAM_SIZE;
  17507. - else
  17508. -- size = nv->size;
  17509. -+ size = data_len;
  17510. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  17511. - size += 1 + 3 + sizeof(u32);
  17512. - nvp->nvram = kzalloc(size, GFP_KERNEL);
  17513. -@@ -362,18 +362,18 @@ fail:
  17514. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  17515. - * End of buffer is completed with token identifying length of buffer.
  17516. - */
  17517. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  17518. -- u16 domain_nr, u16 bus_nr)
  17519. -+static void *brcmf_fw_nvram_strip(const u8 *data, size_t data_len,
  17520. -+ u32 *new_length, u16 domain_nr, u16 bus_nr)
  17521. - {
  17522. - struct nvram_parser nvp;
  17523. - u32 pad;
  17524. - u32 token;
  17525. - __le32 token_le;
  17526. -
  17527. -- if (brcmf_init_nvram_parser(&nvp, nv) < 0)
  17528. -+ if (brcmf_init_nvram_parser(&nvp, data, data_len) < 0)
  17529. - return NULL;
  17530. -
  17531. -- while (nvp.pos < nv->size) {
  17532. -+ while (nvp.pos < data_len) {
  17533. - nvp.state = nv_parser_states[nvp.state](&nvp);
  17534. - if (nvp.state == END)
  17535. - break;
  17536. -@@ -432,7 +432,7 @@ static void brcmf_fw_request_nvram_done(
  17537. - goto fail;
  17538. -
  17539. - if (fw) {
  17540. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  17541. -+ nvram = brcmf_fw_nvram_strip(fw->data, fw->size, &nvram_length,
  17542. - fwctx->domain_nr, fwctx->bus_nr);
  17543. - release_firmware(fw);
  17544. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  17545. 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
  17546. deleted file mode 100644
  17547. index 4ecef3b..0000000
  17548. --- a/package/kernel/mac80211/patches/383-b43-fix-support-for-14e4-4321-PCI-dev-with-BCM4321-c.patch
  17549. +++ /dev/null
  17550. @@ -1,32 +0,0 @@
  17551. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17552. -Date: Sat, 6 Jun 2015 22:45:59 +0200
  17553. -Subject: [PATCH] b43: fix support for 14e4:4321 PCI dev with BCM4321 chipset
  17554. -MIME-Version: 1.0
  17555. -Content-Type: text/plain; charset=UTF-8
  17556. -Content-Transfer-Encoding: 8bit
  17557. -
  17558. -It seems Broadcom released two devices with conflicting device id. There
  17559. -are for sure 14e4:4321 PCI devices with BCM4321 (N-PHY) chipset, they
  17560. -can be found in routers, e.g. Netgear WNR834Bv2. However, according to
  17561. -Broadcom public sources 0x4321 is also used for 5 GHz BCM4306 (G-PHY).
  17562. -It's unsure if they meant PCI device id, or "virtual" id (from SPROM).
  17563. -To distinguish these devices lets check PHY type (G vs. N).
  17564. -
  17565. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17566. -Cc: <stable@vger.kernel.org> # 3.16+
  17567. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17568. ----
  17569. -
  17570. ---- a/drivers/net/wireless/b43/main.c
  17571. -+++ b/drivers/net/wireless/b43/main.c
  17572. -@@ -5365,6 +5365,10 @@ static void b43_supported_bands(struct b
  17573. - *have_5ghz_phy = true;
  17574. - return;
  17575. - case 0x4321: /* BCM4306 */
  17576. -+ /* There are 14e4:4321 PCI devs with 2.4 GHz BCM4321 (N-PHY) */
  17577. -+ if (dev->phy.type != B43_PHYTYPE_G)
  17578. -+ break;
  17579. -+ /* fall through */
  17580. - case 0x4313: /* BCM4311 */
  17581. - case 0x431a: /* BCM4318 */
  17582. - case 0x432a: /* BCM4321 */
  17583. 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
  17584. deleted file mode 100644
  17585. index bddb15a..0000000
  17586. --- a/package/kernel/mac80211/patches/384-ath9k-force-rx_clear-when-disabling-rx.patch
  17587. +++ /dev/null
  17588. @@ -1,31 +0,0 @@
  17589. -From: Felix Fietkau <nbd@openwrt.org>
  17590. -Date: Sun, 7 Jun 2015 13:53:35 +0200
  17591. -Subject: [PATCH] ath9k: force rx_clear when disabling rx
  17592. -
  17593. -This makes stopping Rx more reliable and should reduce the frequency of
  17594. -Rx related DMA stop warnings
  17595. -
  17596. -Cc: stable@vger.kernel.org
  17597. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  17598. ----
  17599. -
  17600. ---- a/drivers/net/wireless/ath/ath9k/mac.c
  17601. -+++ b/drivers/net/wireless/ath/ath9k/mac.c
  17602. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  17603. -
  17604. - ath9k_ani_reset(ah, is_scanning);
  17605. -
  17606. -- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  17607. -+ REG_CLR_BIT(ah, AR_DIAG_SW,
  17608. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  17609. - }
  17610. - EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  17611. -
  17612. - void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  17613. - {
  17614. -- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  17615. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  17616. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  17617. -
  17618. - ath9k_hw_disable_mib_counters(ah);
  17619. - }
  17620. 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
  17621. deleted file mode 100644
  17622. index 2674efb..0000000
  17623. --- a/package/kernel/mac80211/patches/385-ath9k_hw-fix-device-ID-check-for-AR956x.patch
  17624. +++ /dev/null
  17625. @@ -1,20 +0,0 @@
  17626. -From: Felix Fietkau <nbd@openwrt.org>
  17627. -Date: Sun, 21 Jun 2015 19:45:59 +0200
  17628. -Subject: [PATCH] ath9k_hw: fix device ID check for AR956x
  17629. -
  17630. -Because of the missing return, the macVersion value was being
  17631. -overwritten with an invalid register read
  17632. -
  17633. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  17634. ----
  17635. -
  17636. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  17637. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  17638. -@@ -278,6 +278,7 @@ static void ath9k_hw_read_revisions(stru
  17639. - return;
  17640. - case AR9300_DEVID_QCA956X:
  17641. - ah->hw_version.macVersion = AR_SREV_VERSION_9561;
  17642. -+ return;
  17643. - }
  17644. -
  17645. - val = REG_READ(ah, AR_SREV) & AR_SREV_ID;
  17646. 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
  17647. deleted file mode 100644
  17648. index 74df9f9..0000000
  17649. --- a/package/kernel/mac80211/patches/385-brcmfmac-Update-msgbuf-read-pointer-quicker.patch
  17650. +++ /dev/null
  17651. @@ -1,109 +0,0 @@
  17652. -From: Hante Meuleman <meuleman@broadcom.com>
  17653. -Date: Mon, 8 Jun 2015 14:38:32 +0200
  17654. -Subject: [PATCH] brcmfmac: Update msgbuf read pointer quicker.
  17655. -
  17656. -On device to host data using msgbuf the read pointer gets updated
  17657. -once all data is processed. Updating this pointer more frequently
  17658. -allows the firmware to add more data quicker. This will result in
  17659. -slightly higher and more stable throughput on CPU bounded host
  17660. -processors.
  17661. -
  17662. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17663. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17664. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17665. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  17666. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17667. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17668. ----
  17669. -
  17670. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  17671. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  17672. -@@ -223,8 +223,6 @@ void brcmf_commonring_write_cancel(struc
  17673. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  17674. - u16 *n_items)
  17675. - {
  17676. -- void *ret_addr;
  17677. --
  17678. - if (commonring->cr_update_wptr)
  17679. - commonring->cr_update_wptr(commonring->cr_ctx);
  17680. -
  17681. -@@ -235,19 +233,18 @@ void *brcmf_commonring_get_read_ptr(stru
  17682. - if (*n_items == 0)
  17683. - return NULL;
  17684. -
  17685. -- ret_addr = commonring->buf_addr +
  17686. -- (commonring->r_ptr * commonring->item_len);
  17687. --
  17688. -- commonring->r_ptr += *n_items;
  17689. -- if (commonring->r_ptr == commonring->depth)
  17690. -- commonring->r_ptr = 0;
  17691. --
  17692. -- return ret_addr;
  17693. -+ return commonring->buf_addr +
  17694. -+ (commonring->r_ptr * commonring->item_len);
  17695. - }
  17696. -
  17697. -
  17698. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring)
  17699. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  17700. -+ u16 n_items)
  17701. - {
  17702. -+ commonring->r_ptr += n_items;
  17703. -+ if (commonring->r_ptr == commonring->depth)
  17704. -+ commonring->r_ptr = 0;
  17705. -+
  17706. - if (commonring->cr_write_rptr)
  17707. - return commonring->cr_write_rptr(commonring->cr_ctx);
  17708. -
  17709. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  17710. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  17711. -@@ -62,7 +62,8 @@ void brcmf_commonring_write_cancel(struc
  17712. - u16 n_items);
  17713. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  17714. - u16 *n_items);
  17715. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring);
  17716. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  17717. -+ u16 n_items);
  17718. -
  17719. - #define brcmf_commonring_n_items(commonring) (commonring->depth)
  17720. - #define brcmf_commonring_len_item(commonring) (commonring->item_len)
  17721. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17722. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17723. -@@ -75,6 +75,8 @@
  17724. -
  17725. - #define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  17726. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  17727. -+#define BRCMF_MSGBUF_UPDATE_RX_PTR_THRS 48
  17728. -+
  17729. -
  17730. - struct msgbuf_common_hdr {
  17731. - u8 msgtype;
  17732. -@@ -1257,19 +1259,27 @@ static void brcmf_msgbuf_process_rx(stru
  17733. - {
  17734. - void *buf;
  17735. - u16 count;
  17736. -+ u16 processed;
  17737. -
  17738. - again:
  17739. - buf = brcmf_commonring_get_read_ptr(commonring, &count);
  17740. - if (buf == NULL)
  17741. - return;
  17742. -
  17743. -+ processed = 0;
  17744. - while (count) {
  17745. - brcmf_msgbuf_process_msgtype(msgbuf,
  17746. - buf + msgbuf->rx_dataoffset);
  17747. - buf += brcmf_commonring_len_item(commonring);
  17748. -+ processed++;
  17749. -+ if (processed == BRCMF_MSGBUF_UPDATE_RX_PTR_THRS) {
  17750. -+ brcmf_commonring_read_complete(commonring, processed);
  17751. -+ processed = 0;
  17752. -+ }
  17753. - count--;
  17754. - }
  17755. -- brcmf_commonring_read_complete(commonring);
  17756. -+ if (processed)
  17757. -+ brcmf_commonring_read_complete(commonring, processed);
  17758. -
  17759. - if (commonring->r_ptr == 0)
  17760. - goto again;
  17761. 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
  17762. deleted file mode 100644
  17763. index 9e5b486..0000000
  17764. --- a/package/kernel/mac80211/patches/386-brcmfmac-remove-chipinfo-debugfs-entry.patch
  17765. +++ /dev/null
  17766. @@ -1,39 +0,0 @@
  17767. -From: Arend van Spriel <arend@broadcom.com>
  17768. -Date: Mon, 8 Jun 2015 14:38:33 +0200
  17769. -Subject: [PATCH] brcmfmac: remove chipinfo debugfs entry
  17770. -
  17771. -The information provided by chipinfo is also provided by the
  17772. -revinfo debugfs entry. Removing it from debugfs.
  17773. -
  17774. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17775. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17776. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17777. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17778. ----
  17779. -
  17780. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  17781. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  17782. -@@ -41,15 +41,6 @@ void brcmf_debugfs_exit(void)
  17783. - root_folder = NULL;
  17784. - }
  17785. -
  17786. --static int brcmf_debugfs_chipinfo_read(struct seq_file *seq, void *data)
  17787. --{
  17788. -- struct brcmf_bus *bus = dev_get_drvdata(seq->private);
  17789. --
  17790. -- seq_printf(seq, "chip: %x(%u) rev %u\n",
  17791. -- bus->chip, bus->chip, bus->chiprev);
  17792. -- return 0;
  17793. --}
  17794. --
  17795. - int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  17796. - {
  17797. - struct device *dev = drvr->bus_if->dev;
  17798. -@@ -58,7 +49,6 @@ int brcmf_debugfs_attach(struct brcmf_pu
  17799. - return -ENODEV;
  17800. -
  17801. - drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
  17802. -- brcmf_debugfs_add_entry(drvr, "chipinfo", brcmf_debugfs_chipinfo_read);
  17803. -
  17804. - return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
  17805. - }
  17806. 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
  17807. deleted file mode 100644
  17808. index c38b2cd..0000000
  17809. --- a/package/kernel/mac80211/patches/387-brcmfmac-remove-watchdog-reset-from-brcmf_pcie_busco.patch
  17810. +++ /dev/null
  17811. @@ -1,53 +0,0 @@
  17812. -From: Arend van Spriel <arend@broadcom.com>
  17813. -Date: Mon, 8 Jun 2015 14:38:34 +0200
  17814. -Subject: [PATCH] brcmfmac: remove watchdog reset from
  17815. - brcmf_pcie_buscoreprep()
  17816. -
  17817. -The watchdog reset as done in brcmf_pcie_buscoreprep() is not
  17818. -sufficient. It needs to modify PCIe core registers as well
  17819. -which is properly done by brcmf_pcie_reset_device() after the
  17820. -chip recognition is done. So the faulty watchdog reset can be
  17821. -removed as it was causing driver reload to fail and hang the
  17822. -system requiring a power-cycle. Instead the call to to the
  17823. -brcmf_pcie_reset_device() function is done twice in the unload.
  17824. -
  17825. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17826. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  17827. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17828. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17829. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17830. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17831. ----
  17832. -
  17833. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17834. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17835. -@@ -1629,20 +1629,7 @@ static void brcmf_pcie_buscore_write32(v
  17836. -
  17837. - static int brcmf_pcie_buscoreprep(void *ctx)
  17838. - {
  17839. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  17840. -- int err;
  17841. --
  17842. -- err = brcmf_pcie_get_resource(devinfo);
  17843. -- if (err == 0) {
  17844. -- /* Set CC watchdog to reset all the cores on the chip to bring
  17845. -- * back dongle to a sane state.
  17846. -- */
  17847. -- brcmf_pcie_buscore_write32(ctx, CORE_CC_REG(SI_ENUM_BASE,
  17848. -- watchdog), 4);
  17849. -- msleep(100);
  17850. -- }
  17851. --
  17852. -- return err;
  17853. -+ return brcmf_pcie_get_resource(ctx);
  17854. - }
  17855. -
  17856. -
  17857. -@@ -1824,6 +1811,7 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  17858. - brcmf_pcie_intr_disable(devinfo);
  17859. -
  17860. - brcmf_detach(&pdev->dev);
  17861. -+ brcmf_pcie_reset_device(devinfo);
  17862. -
  17863. - kfree(bus->bus_priv.pcie);
  17864. - kfree(bus->msgbuf->flowrings);
  17865. 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
  17866. deleted file mode 100644
  17867. index 756fbb2..0000000
  17868. --- a/package/kernel/mac80211/patches/388-brcmfmac-use-debugfs_create_devm_seqfile-helper-func.patch
  17869. +++ /dev/null
  17870. @@ -1,69 +0,0 @@
  17871. -From: Arend van Spriel <arend@broadcom.com>
  17872. -Date: Mon, 8 Jun 2015 14:38:35 +0200
  17873. -Subject: [PATCH] brcmfmac: use debugfs_create_devm_seqfile() helper
  17874. - function
  17875. -
  17876. -Some time ago the function debugfs_create_devm_seqfile() was
  17877. -introduced in debugfs. The caller simply needs to provide a
  17878. -device pointer and read function. The function brcmf_debugfs_add_entry()
  17879. -is now simply a wrapper only doing the work for CONFIG_BRCMDBG.
  17880. -
  17881. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17882. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17883. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  17884. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17885. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17886. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17887. ----
  17888. -
  17889. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  17890. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  17891. -@@ -64,44 +64,12 @@ struct dentry *brcmf_debugfs_get_devdir(
  17892. - return drvr->dbgfs_dir;
  17893. - }
  17894. -
  17895. --struct brcmf_debugfs_entry {
  17896. -- int (*read)(struct seq_file *seq, void *data);
  17897. -- struct brcmf_pub *drvr;
  17898. --};
  17899. --
  17900. --static int brcmf_debugfs_entry_open(struct inode *inode, struct file *f)
  17901. --{
  17902. -- struct brcmf_debugfs_entry *entry = inode->i_private;
  17903. --
  17904. -- return single_open(f, entry->read, entry->drvr->bus_if->dev);
  17905. --}
  17906. --
  17907. --static const struct file_operations brcmf_debugfs_def_ops = {
  17908. -- .owner = THIS_MODULE,
  17909. -- .open = brcmf_debugfs_entry_open,
  17910. -- .release = single_release,
  17911. -- .read = seq_read,
  17912. -- .llseek = seq_lseek
  17913. --};
  17914. --
  17915. - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
  17916. - int (*read_fn)(struct seq_file *seq, void *data))
  17917. - {
  17918. -- struct dentry *dentry = drvr->dbgfs_dir;
  17919. -- struct brcmf_debugfs_entry *entry;
  17920. --
  17921. -- if (IS_ERR_OR_NULL(dentry))
  17922. -- return -ENOENT;
  17923. --
  17924. -- entry = devm_kzalloc(drvr->bus_if->dev, sizeof(*entry), GFP_KERNEL);
  17925. -- if (!entry)
  17926. -- return -ENOMEM;
  17927. --
  17928. -- entry->read = read_fn;
  17929. -- entry->drvr = drvr;
  17930. --
  17931. -- dentry = debugfs_create_file(fn, S_IRUGO, dentry, entry,
  17932. -- &brcmf_debugfs_def_ops);
  17933. -+ struct dentry *e;
  17934. -
  17935. -- return PTR_ERR_OR_ZERO(dentry);
  17936. -+ e = debugfs_create_devm_seqfile(drvr->bus_if->dev, fn,
  17937. -+ drvr->dbgfs_dir, read_fn);
  17938. -+ return PTR_ERR_OR_ZERO(e);
  17939. - }
  17940. 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
  17941. deleted file mode 100644
  17942. index ff24a4a..0000000
  17943. --- a/package/kernel/mac80211/patches/389-0001-brcmfmac-Check-if-firmware-supports-p2p.patch
  17944. +++ /dev/null
  17945. @@ -1,42 +0,0 @@
  17946. -From: Pontus Fuchs <pontusf@broadcom.com>
  17947. -Date: Thu, 11 Jun 2015 00:12:17 +0200
  17948. -Subject: [PATCH] brcmfmac: Check if firmware supports p2p
  17949. -
  17950. -Add a feature flag to reflect the firmware's p2p capability.
  17951. -
  17952. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17953. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17954. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17955. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  17956. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17957. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17958. ----
  17959. -
  17960. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  17961. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  17962. -@@ -129,6 +129,7 @@ void brcmf_feat_attach(struct brcmf_pub
  17963. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  17964. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  17965. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  17966. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  17967. -
  17968. - /* set chip related quirks */
  17969. - switch (drvr->bus_if->chip) {
  17970. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  17971. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  17972. -@@ -23,12 +23,14 @@
  17973. - * MCHAN: multi-channel for concurrent P2P.
  17974. - * PNO: preferred network offload.
  17975. - * WOWL: Wake-On-WLAN.
  17976. -+ * P2P: peer-to-peer
  17977. - */
  17978. - #define BRCMF_FEAT_LIST \
  17979. - BRCMF_FEAT_DEF(MBSS) \
  17980. - BRCMF_FEAT_DEF(MCHAN) \
  17981. - BRCMF_FEAT_DEF(PNO) \
  17982. -- BRCMF_FEAT_DEF(WOWL)
  17983. -+ BRCMF_FEAT_DEF(WOWL) \
  17984. -+ BRCMF_FEAT_DEF(P2P)
  17985. - /*
  17986. - * Quirks:
  17987. - *
  17988. 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
  17989. deleted file mode 100644
  17990. index 3876ba0..0000000
  17991. --- a/package/kernel/mac80211/patches/389-0002-brcmfmac-Build-wiphy-mode-and-interface-combinations.patch
  17992. +++ /dev/null
  17993. @@ -1,198 +0,0 @@
  17994. -From: Pontus Fuchs <pontusf@broadcom.com>
  17995. -Date: Thu, 11 Jun 2015 00:12:18 +0200
  17996. -Subject: [PATCH] brcmfmac: Build wiphy mode and interface combinations
  17997. - dynamically
  17998. -
  17999. -Switch from using semi hard coded interface combinations. This makes
  18000. -it easier to announce what the firmware actually supports. This fixes
  18001. -the case where brcmfmac announces p2p but the firmware doesn't
  18002. -support it.
  18003. -
  18004. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18005. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18006. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  18007. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  18008. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18009. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18010. ----
  18011. -
  18012. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18013. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18014. -@@ -52,8 +52,6 @@
  18015. - #define BRCMF_PNO_SCAN_COMPLETE 1
  18016. - #define BRCMF_PNO_SCAN_INCOMPLETE 0
  18017. -
  18018. --#define BRCMF_IFACE_MAX_CNT 3
  18019. --
  18020. - #define WPA_OUI "\x00\x50\xF2" /* WPA OUI */
  18021. - #define WPA_OUI_TYPE 1
  18022. - #define RSN_OUI "\x00\x0F\xAC" /* RSN OUI */
  18023. -@@ -5639,53 +5637,6 @@ static int brcmf_setup_wiphybands(struct
  18024. - return 0;
  18025. - }
  18026. -
  18027. --static const struct ieee80211_iface_limit brcmf_iface_limits_mbss[] = {
  18028. -- {
  18029. -- .max = 1,
  18030. -- .types = BIT(NL80211_IFTYPE_STATION) |
  18031. -- BIT(NL80211_IFTYPE_ADHOC)
  18032. -- },
  18033. -- {
  18034. -- .max = 4,
  18035. -- .types = BIT(NL80211_IFTYPE_AP)
  18036. -- },
  18037. -- {
  18038. -- .max = 1,
  18039. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18040. -- BIT(NL80211_IFTYPE_P2P_GO)
  18041. -- },
  18042. -- {
  18043. -- .max = 1,
  18044. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  18045. -- }
  18046. --};
  18047. --
  18048. --static const struct ieee80211_iface_limit brcmf_iface_limits_sbss[] = {
  18049. -- {
  18050. -- .max = 2,
  18051. -- .types = BIT(NL80211_IFTYPE_STATION) |
  18052. -- BIT(NL80211_IFTYPE_ADHOC) |
  18053. -- BIT(NL80211_IFTYPE_AP)
  18054. -- },
  18055. -- {
  18056. -- .max = 1,
  18057. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18058. -- BIT(NL80211_IFTYPE_P2P_GO)
  18059. -- },
  18060. -- {
  18061. -- .max = 1,
  18062. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  18063. -- }
  18064. --};
  18065. --static struct ieee80211_iface_combination brcmf_iface_combos[] = {
  18066. -- {
  18067. -- .max_interfaces = BRCMF_IFACE_MAX_CNT,
  18068. -- .num_different_channels = 1,
  18069. -- .n_limits = ARRAY_SIZE(brcmf_iface_limits_sbss),
  18070. -- .limits = brcmf_iface_limits_sbss,
  18071. -- }
  18072. --};
  18073. --
  18074. - static const struct ieee80211_txrx_stypes
  18075. - brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = {
  18076. - [NL80211_IFTYPE_STATION] = {
  18077. -@@ -5715,6 +5666,67 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  18078. - }
  18079. - };
  18080. -
  18081. -+static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  18082. -+{
  18083. -+ struct ieee80211_iface_combination *combo = NULL;
  18084. -+ struct ieee80211_iface_limit *limits = NULL;
  18085. -+ int i = 0, max_iface_cnt;
  18086. -+
  18087. -+ combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  18088. -+ if (!combo)
  18089. -+ goto err;
  18090. -+
  18091. -+ limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  18092. -+ if (!limits)
  18093. -+ goto err;
  18094. -+
  18095. -+ wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  18096. -+ BIT(NL80211_IFTYPE_ADHOC) |
  18097. -+ BIT(NL80211_IFTYPE_AP);
  18098. -+
  18099. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  18100. -+ combo->num_different_channels = 2;
  18101. -+ else
  18102. -+ combo->num_different_channels = 1;
  18103. -+
  18104. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  18105. -+ limits[i].max = 1;
  18106. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  18107. -+ limits[i].max = 4;
  18108. -+ limits[i++].types = BIT(NL80211_IFTYPE_AP);
  18109. -+ max_iface_cnt = 5;
  18110. -+ } else {
  18111. -+ limits[i].max = 2;
  18112. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  18113. -+ BIT(NL80211_IFTYPE_AP);
  18114. -+ max_iface_cnt = 2;
  18115. -+ }
  18116. -+
  18117. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  18118. -+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18119. -+ BIT(NL80211_IFTYPE_P2P_GO) |
  18120. -+ BIT(NL80211_IFTYPE_P2P_DEVICE);
  18121. -+ limits[i].max = 1;
  18122. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18123. -+ BIT(NL80211_IFTYPE_P2P_GO);
  18124. -+ limits[i].max = 1;
  18125. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  18126. -+ max_iface_cnt += 2;
  18127. -+ }
  18128. -+ combo->max_interfaces = max_iface_cnt;
  18129. -+ combo->limits = limits;
  18130. -+ combo->n_limits = i;
  18131. -+
  18132. -+ wiphy->iface_combinations = combo;
  18133. -+ wiphy->n_iface_combinations = 1;
  18134. -+ return 0;
  18135. -+
  18136. -+err:
  18137. -+ kfree(limits);
  18138. -+ kfree(combo);
  18139. -+ return -ENOMEM;
  18140. -+}
  18141. -+
  18142. - static void brcmf_wiphy_pno_params(struct wiphy *wiphy)
  18143. - {
  18144. - /* scheduled scan settings */
  18145. -@@ -5745,7 +5757,6 @@ static void brcmf_wiphy_wowl_params(stru
  18146. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  18147. - {
  18148. - struct ieee80211_supported_band *band;
  18149. -- struct ieee80211_iface_combination ifc_combo;
  18150. - __le32 bandlist[3];
  18151. - u32 n_bands;
  18152. - int err, i;
  18153. -@@ -5753,24 +5764,11 @@ static int brcmf_setup_wiphy(struct wiph
  18154. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  18155. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  18156. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  18157. -- wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  18158. -- BIT(NL80211_IFTYPE_ADHOC) |
  18159. -- BIT(NL80211_IFTYPE_AP) |
  18160. -- BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18161. -- BIT(NL80211_IFTYPE_P2P_GO) |
  18162. -- BIT(NL80211_IFTYPE_P2P_DEVICE);
  18163. -- /* need VSDB firmware feature for concurrent channels */
  18164. -- ifc_combo = brcmf_iface_combos[0];
  18165. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  18166. -- ifc_combo.num_different_channels = 2;
  18167. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  18168. -- ifc_combo.n_limits = ARRAY_SIZE(brcmf_iface_limits_mbss),
  18169. -- ifc_combo.limits = brcmf_iface_limits_mbss;
  18170. -- }
  18171. -- wiphy->iface_combinations = kmemdup(&ifc_combo,
  18172. -- sizeof(ifc_combo),
  18173. -- GFP_KERNEL);
  18174. -- wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos);
  18175. -+
  18176. -+ err = brcmf_setup_ifmodes(wiphy, ifp);
  18177. -+ if (err)
  18178. -+ return err;
  18179. -+
  18180. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  18181. - wiphy->cipher_suites = __wl_cipher_suites;
  18182. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  18183. -@@ -6035,6 +6033,8 @@ static void brcmf_free_wiphy(struct wiph
  18184. - if (!wiphy)
  18185. - return;
  18186. -
  18187. -+ if (wiphy->iface_combinations)
  18188. -+ kfree(wiphy->iface_combinations->limits);
  18189. - kfree(wiphy->iface_combinations);
  18190. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  18191. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  18192. 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
  18193. deleted file mode 100644
  18194. index 7bd0686..0000000
  18195. --- a/package/kernel/mac80211/patches/389-0003-brcmfmac-rework-.get_station-callback.patch
  18196. +++ /dev/null
  18197. @@ -1,326 +0,0 @@
  18198. -From: Arend van Spriel <arend@broadcom.com>
  18199. -Date: Thu, 11 Jun 2015 00:12:19 +0200
  18200. -Subject: [PATCH] brcmfmac: rework .get_station() callback
  18201. -
  18202. -The .get_station() cfg80211 callback is used in several scenarios. In
  18203. -managed mode it can obtain information about the access-point and its
  18204. -BSS parameters. In managed mode it can also obtain information about
  18205. -TDLS peers. In AP mode it can obtain information about connected
  18206. -clients.
  18207. -
  18208. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18209. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  18210. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18211. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18212. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18213. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18214. ----
  18215. -
  18216. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18217. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18218. -@@ -2395,27 +2395,80 @@ brcmf_cfg80211_reconfigure_wep(struct br
  18219. - brcmf_err("set wsec error (%d)\n", err);
  18220. - }
  18221. -
  18222. -+static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
  18223. -+{
  18224. -+ struct nl80211_sta_flag_update *sfu;
  18225. -+
  18226. -+ brcmf_dbg(TRACE, "flags %08x\n", fw_sta_flags);
  18227. -+ si->filled |= BIT(NL80211_STA_INFO_STA_FLAGS);
  18228. -+ sfu = &si->sta_flags;
  18229. -+ sfu->mask = BIT(NL80211_STA_FLAG_WME) |
  18230. -+ BIT(NL80211_STA_FLAG_AUTHENTICATED) |
  18231. -+ BIT(NL80211_STA_FLAG_ASSOCIATED) |
  18232. -+ BIT(NL80211_STA_FLAG_AUTHORIZED);
  18233. -+ if (fw_sta_flags & BRCMF_STA_WME)
  18234. -+ sfu->set |= BIT(NL80211_STA_FLAG_WME);
  18235. -+ if (fw_sta_flags & BRCMF_STA_AUTHE)
  18236. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
  18237. -+ if (fw_sta_flags & BRCMF_STA_ASSOC)
  18238. -+ sfu->set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
  18239. -+ if (fw_sta_flags & BRCMF_STA_AUTHO)
  18240. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
  18241. -+}
  18242. -+
  18243. -+static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
  18244. -+{
  18245. -+ struct {
  18246. -+ __le32 len;
  18247. -+ struct brcmf_bss_info_le bss_le;
  18248. -+ } *buf;
  18249. -+ u16 capability;
  18250. -+ int err;
  18251. -+
  18252. -+ buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
  18253. -+ if (!buf)
  18254. -+ return;
  18255. -+
  18256. -+ buf->len = cpu_to_le32(WL_BSS_INFO_MAX);
  18257. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
  18258. -+ WL_BSS_INFO_MAX);
  18259. -+ if (err) {
  18260. -+ brcmf_err("Failed to get bss info (%d)\n", err);
  18261. -+ return;
  18262. -+ }
  18263. -+ si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  18264. -+ si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period);
  18265. -+ si->bss_param.dtim_period = buf->bss_le.dtim_period;
  18266. -+ capability = le16_to_cpu(buf->bss_le.capability);
  18267. -+ if (capability & IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT)
  18268. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
  18269. -+ if (capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
  18270. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  18271. -+ if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
  18272. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  18273. -+}
  18274. -+
  18275. - static s32
  18276. - brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
  18277. - const u8 *mac, struct station_info *sinfo)
  18278. - {
  18279. - struct brcmf_if *ifp = netdev_priv(ndev);
  18280. -- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
  18281. -- struct brcmf_scb_val_le scb_val;
  18282. -- int rssi;
  18283. -- s32 rate;
  18284. - s32 err = 0;
  18285. -- u8 *bssid = profile->bssid;
  18286. - struct brcmf_sta_info_le sta_info_le;
  18287. -- u32 beacon_period;
  18288. -- u32 dtim_period;
  18289. -+ u32 sta_flags;
  18290. -+ u32 is_tdls_peer;
  18291. -
  18292. - brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
  18293. - if (!check_vif_up(ifp->vif))
  18294. - return -EIO;
  18295. -
  18296. -- if (brcmf_is_apmode(ifp->vif)) {
  18297. -- memcpy(&sta_info_le, mac, ETH_ALEN);
  18298. -+ memset(&sta_info_le, 0, sizeof(sta_info_le));
  18299. -+ memcpy(&sta_info_le, mac, ETH_ALEN);
  18300. -+ err = brcmf_fil_iovar_data_get(ifp, "tdls_sta_info",
  18301. -+ &sta_info_le,
  18302. -+ sizeof(sta_info_le));
  18303. -+ is_tdls_peer = !err;
  18304. -+ if (err) {
  18305. - err = brcmf_fil_iovar_data_get(ifp, "sta_info",
  18306. - &sta_info_le,
  18307. - sizeof(sta_info_le));
  18308. -@@ -2423,73 +2476,48 @@ brcmf_cfg80211_get_station(struct wiphy
  18309. - brcmf_err("GET STA INFO failed, %d\n", err);
  18310. - goto done;
  18311. - }
  18312. -- sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  18313. -- sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  18314. -- if (le32_to_cpu(sta_info_le.flags) & BRCMF_STA_ASSOC) {
  18315. -- sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  18316. -- sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  18317. -- }
  18318. -- brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n",
  18319. -- sinfo->inactive_time, sinfo->connected_time);
  18320. -- } else if (ifp->vif->wdev.iftype == NL80211_IFTYPE_STATION) {
  18321. -- if (memcmp(mac, bssid, ETH_ALEN)) {
  18322. -- brcmf_err("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n",
  18323. -- mac, bssid);
  18324. -- err = -ENOENT;
  18325. -- goto done;
  18326. -- }
  18327. -- /* Report the current tx rate */
  18328. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
  18329. -- if (err) {
  18330. -- brcmf_err("Could not get rate (%d)\n", err);
  18331. -- goto done;
  18332. -- } else {
  18333. -+ }
  18334. -+ brcmf_dbg(TRACE, "version %d\n", le16_to_cpu(sta_info_le.ver));
  18335. -+ sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  18336. -+ sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  18337. -+ sta_flags = le32_to_cpu(sta_info_le.flags);
  18338. -+ brcmf_convert_sta_flags(sta_flags, sinfo);
  18339. -+ sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  18340. -+ if (is_tdls_peer)
  18341. -+ sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  18342. -+ else
  18343. -+ sinfo->sta_flags.set &= ~BIT(NL80211_STA_FLAG_TDLS_PEER);
  18344. -+ if (sta_flags & BRCMF_STA_ASSOC) {
  18345. -+ sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  18346. -+ sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  18347. -+ brcmf_fill_bss_param(ifp, sinfo);
  18348. -+ }
  18349. -+ if (sta_flags & BRCMF_STA_SCBSTATS) {
  18350. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED);
  18351. -+ sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures);
  18352. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
  18353. -+ sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts);
  18354. -+ sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts);
  18355. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
  18356. -+ sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts);
  18357. -+ sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts);
  18358. -+ if (sinfo->tx_packets) {
  18359. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
  18360. -- sinfo->txrate.legacy = rate * 5;
  18361. -- brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2);
  18362. -+ sinfo->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate);
  18363. -+ sinfo->txrate.legacy /= 100;
  18364. - }
  18365. --
  18366. -- if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
  18367. -- &ifp->vif->sme_state)) {
  18368. -- memset(&scb_val, 0, sizeof(scb_val));
  18369. -- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
  18370. -- &scb_val, sizeof(scb_val));
  18371. -- if (err) {
  18372. -- brcmf_err("Could not get rssi (%d)\n", err);
  18373. -- goto done;
  18374. -- } else {
  18375. -- rssi = le32_to_cpu(scb_val.val);
  18376. -- sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  18377. -- sinfo->signal = rssi;
  18378. -- brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
  18379. -- }
  18380. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_BCNPRD,
  18381. -- &beacon_period);
  18382. -- if (err) {
  18383. -- brcmf_err("Could not get beacon period (%d)\n",
  18384. -- err);
  18385. -- goto done;
  18386. -- } else {
  18387. -- sinfo->bss_param.beacon_interval =
  18388. -- beacon_period;
  18389. -- brcmf_dbg(CONN, "Beacon peroid %d\n",
  18390. -- beacon_period);
  18391. -- }
  18392. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_DTIMPRD,
  18393. -- &dtim_period);
  18394. -- if (err) {
  18395. -- brcmf_err("Could not get DTIM period (%d)\n",
  18396. -- err);
  18397. -- goto done;
  18398. -- } else {
  18399. -- sinfo->bss_param.dtim_period = dtim_period;
  18400. -- brcmf_dbg(CONN, "DTIM peroid %d\n",
  18401. -- dtim_period);
  18402. -- }
  18403. -- sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  18404. -+ if (sinfo->rx_packets) {
  18405. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
  18406. -+ sinfo->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate);
  18407. -+ sinfo->rxrate.legacy /= 100;
  18408. -+ }
  18409. -+ if (le16_to_cpu(sta_info_le.ver) >= 4) {
  18410. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES);
  18411. -+ sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes);
  18412. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES);
  18413. -+ sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
  18414. - }
  18415. -- } else
  18416. -- err = -EPERM;
  18417. -+ }
  18418. - done:
  18419. - brcmf_dbg(TRACE, "Exit\n");
  18420. - return err;
  18421. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  18422. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  18423. -@@ -32,7 +32,11 @@
  18424. - #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */
  18425. - #define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002
  18426. -
  18427. --#define BRCMF_STA_ASSOC 0x10 /* Associated */
  18428. -+#define BRCMF_STA_WME 0x00000002 /* WMM association */
  18429. -+#define BRCMF_STA_AUTHE 0x00000008 /* Authenticated */
  18430. -+#define BRCMF_STA_ASSOC 0x00000010 /* Associated */
  18431. -+#define BRCMF_STA_AUTHO 0x00000020 /* Authorized */
  18432. -+#define BRCMF_STA_SCBSTATS 0x00004000 /* Per STA debug stats */
  18433. -
  18434. - /* size of brcmf_scan_params not including variable length array */
  18435. - #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
  18436. -@@ -113,6 +117,7 @@
  18437. - #define BRCMF_WOWL_MAXPATTERNSIZE 128
  18438. -
  18439. - #define BRCMF_COUNTRY_BUF_SZ 4
  18440. -+#define BRCMF_ANT_MAX 4
  18441. -
  18442. - /* join preference types for join_pref iovar */
  18443. - enum brcmf_join_pref_types {
  18444. -@@ -456,25 +461,61 @@ struct brcmf_channel_info_le {
  18445. - };
  18446. -
  18447. - struct brcmf_sta_info_le {
  18448. -- __le16 ver; /* version of this struct */
  18449. -- __le16 len; /* length in bytes of this structure */
  18450. -- __le16 cap; /* sta's advertised capabilities */
  18451. -- __le32 flags; /* flags defined below */
  18452. -- __le32 idle; /* time since data pkt rx'd from sta */
  18453. -- u8 ea[ETH_ALEN]; /* Station address */
  18454. -- __le32 count; /* # rates in this set */
  18455. -- u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  18456. -+ __le16 ver; /* version of this struct */
  18457. -+ __le16 len; /* length in bytes of this structure */
  18458. -+ __le16 cap; /* sta's advertised capabilities */
  18459. -+ __le32 flags; /* flags defined below */
  18460. -+ __le32 idle; /* time since data pkt rx'd from sta */
  18461. -+ u8 ea[ETH_ALEN]; /* Station address */
  18462. -+ __le32 count; /* # rates in this set */
  18463. -+ u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  18464. - /* w/hi bit set if basic */
  18465. -- __le32 in; /* seconds elapsed since associated */
  18466. -- __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  18467. -- __le32 tx_pkts; /* # of packets transmitted */
  18468. -- __le32 tx_failures; /* # of packets failed */
  18469. -- __le32 rx_ucast_pkts; /* # of unicast packets received */
  18470. -- __le32 rx_mcast_pkts; /* # of multicast packets received */
  18471. -- __le32 tx_rate; /* Rate of last successful tx frame */
  18472. -- __le32 rx_rate; /* Rate of last successful rx frame */
  18473. -- __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  18474. -- __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  18475. -+ __le32 in; /* seconds elapsed since associated */
  18476. -+ __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  18477. -+ __le32 tx_pkts; /* # of packets transmitted */
  18478. -+ __le32 tx_failures; /* # of packets failed */
  18479. -+ __le32 rx_ucast_pkts; /* # of unicast packets received */
  18480. -+ __le32 rx_mcast_pkts; /* # of multicast packets received */
  18481. -+ __le32 tx_rate; /* Rate of last successful tx frame */
  18482. -+ __le32 rx_rate; /* Rate of last successful rx frame */
  18483. -+ __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  18484. -+ __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  18485. -+ __le32 tx_tot_pkts; /* # of tx pkts (ucast + mcast) */
  18486. -+ __le32 rx_tot_pkts; /* # of data packets recvd (uni + mcast) */
  18487. -+ __le32 tx_mcast_pkts; /* # of mcast pkts txed */
  18488. -+ __le64 tx_tot_bytes; /* data bytes txed (ucast + mcast) */
  18489. -+ __le64 rx_tot_bytes; /* data bytes recvd (ucast + mcast) */
  18490. -+ __le64 tx_ucast_bytes; /* data bytes txed (ucast) */
  18491. -+ __le64 tx_mcast_bytes; /* # data bytes txed (mcast) */
  18492. -+ __le64 rx_ucast_bytes; /* data bytes recvd (ucast) */
  18493. -+ __le64 rx_mcast_bytes; /* data bytes recvd (mcast) */
  18494. -+ s8 rssi[BRCMF_ANT_MAX]; /* per antenna rssi */
  18495. -+ s8 nf[BRCMF_ANT_MAX]; /* per antenna noise floor */
  18496. -+ __le16 aid; /* association ID */
  18497. -+ __le16 ht_capabilities; /* advertised ht caps */
  18498. -+ __le16 vht_flags; /* converted vht flags */
  18499. -+ __le32 tx_pkts_retry_cnt; /* # of frames where a retry was
  18500. -+ * exhausted.
  18501. -+ */
  18502. -+ __le32 tx_pkts_retry_exhausted; /* # of user frames where a retry
  18503. -+ * was exhausted
  18504. -+ */
  18505. -+ s8 rx_lastpkt_rssi[BRCMF_ANT_MAX]; /* Per antenna RSSI of last
  18506. -+ * received data frame.
  18507. -+ */
  18508. -+ /* TX WLAN retry/failure statistics:
  18509. -+ * Separated for host requested frames and locally generated frames.
  18510. -+ * Include unicast frame only where the retries/failures can be counted.
  18511. -+ */
  18512. -+ __le32 tx_pkts_total; /* # user frames sent successfully */
  18513. -+ __le32 tx_pkts_retries; /* # user frames retries */
  18514. -+ __le32 tx_pkts_fw_total; /* # FW generated sent successfully */
  18515. -+ __le32 tx_pkts_fw_retries; /* # retries for FW generated frames */
  18516. -+ __le32 tx_pkts_fw_retry_exhausted; /* # FW generated where a retry
  18517. -+ * was exhausted
  18518. -+ */
  18519. -+ __le32 rx_pkts_retried; /* # rx with retry bit set */
  18520. -+ __le32 tx_rate_fallback; /* lowest fallback TX rate */
  18521. - };
  18522. -
  18523. - struct brcmf_chanspec_list {
  18524. 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
  18525. deleted file mode 100644
  18526. index 302bc3e..0000000
  18527. --- a/package/kernel/mac80211/patches/389-0004-brcmfmac-have-sdio-return-EIO-when-device-communicat.patch
  18528. +++ /dev/null
  18529. @@ -1,56 +0,0 @@
  18530. -From: Arend van Spriel <arend@broadcom.com>
  18531. -Date: Thu, 11 Jun 2015 00:12:20 +0200
  18532. -Subject: [PATCH] brcmfmac: have sdio return -EIO when device communication
  18533. - is not possible
  18534. -
  18535. -The bus interface functions txctl and rxctl may be used while the device
  18536. -can not be accessed, eg. upon driver .remove() callback. This patch will
  18537. -immediately return -EIO when this is the case which speeds up the module
  18538. -unload.
  18539. -
  18540. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18541. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18542. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18543. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18544. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18545. ----
  18546. -
  18547. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  18548. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  18549. -@@ -988,6 +988,7 @@ static void brcmf_sdiod_freezer_detach(s
  18550. -
  18551. - static int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev)
  18552. - {
  18553. -+ sdiodev->state = BRCMF_SDIOD_DOWN;
  18554. - if (sdiodev->bus) {
  18555. - brcmf_sdio_remove(sdiodev->bus);
  18556. - sdiodev->bus = NULL;
  18557. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  18558. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  18559. -@@ -2820,6 +2820,8 @@ static int brcmf_sdio_bus_txdata(struct
  18560. - struct brcmf_sdio *bus = sdiodev->bus;
  18561. -
  18562. - brcmf_dbg(TRACE, "Enter: pkt: data %p len %d\n", pkt->data, pkt->len);
  18563. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  18564. -+ return -EIO;
  18565. -
  18566. - /* Add space for the header */
  18567. - skb_push(pkt, bus->tx_hdrlen);
  18568. -@@ -2948,6 +2950,8 @@ brcmf_sdio_bus_txctl(struct device *dev,
  18569. - int ret;
  18570. -
  18571. - brcmf_dbg(TRACE, "Enter\n");
  18572. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  18573. -+ return -EIO;
  18574. -
  18575. - /* Send from dpc */
  18576. - bus->ctrl_frame_buf = msg;
  18577. -@@ -3238,6 +3242,8 @@ brcmf_sdio_bus_rxctl(struct device *dev,
  18578. - struct brcmf_sdio *bus = sdiodev->bus;
  18579. -
  18580. - brcmf_dbg(TRACE, "Enter\n");
  18581. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  18582. -+ return -EIO;
  18583. -
  18584. - /* Wait until control frame is available */
  18585. - timeleft = brcmf_sdio_dcmd_resp_wait(bus, &bus->rxlen, &pending);
  18586. 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
  18587. deleted file mode 100644
  18588. index 34af6d2..0000000
  18589. --- a/package/kernel/mac80211/patches/389-0005-ath9k-make-DMA-stop-related-messages-debug-only.patch
  18590. +++ /dev/null
  18591. @@ -1,74 +0,0 @@
  18592. -From: Felix Fietkau <nbd@openwrt.org>
  18593. -Date: Thu, 2 Jul 2015 13:35:05 +0200
  18594. -Subject: [PATCH] ath9k: make DMA stop related messages debug-only
  18595. -
  18596. -A long time ago, ath9k had issues during reset where the DMA engine
  18597. -would stay active and could potentially corrupt memory.
  18598. -To debug those issues, the driver would print warnings whenever they
  18599. -occur.
  18600. -
  18601. -Nowadays, these issues are gone and the primary cause of these messages
  18602. -is if the MAC is stuck during reset or busy processing a long
  18603. -transmission. This is fairly harmless, yet these messages continue to
  18604. -worry users.
  18605. -
  18606. -To reduce the number of bogus bug reports, turn these messages into
  18607. -debug messages and count their occurence in the "reset" debugfs file.
  18608. -
  18609. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  18610. ----
  18611. -
  18612. ---- a/drivers/net/wireless/ath/ath9k/debug.c
  18613. -+++ b/drivers/net/wireless/ath/ath9k/debug.c
  18614. -@@ -765,6 +765,8 @@ static int read_file_reset(struct seq_fi
  18615. - [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
  18616. - [RESET_TYPE_MCI] = "MCI Reset",
  18617. - [RESET_TYPE_CALIBRATION] = "Calibration error",
  18618. -+ [RESET_TX_DMA_ERROR] = "Tx DMA stop error",
  18619. -+ [RESET_RX_DMA_ERROR] = "Rx DMA stop error",
  18620. - };
  18621. - int i;
  18622. -
  18623. ---- a/drivers/net/wireless/ath/ath9k/debug.h
  18624. -+++ b/drivers/net/wireless/ath/ath9k/debug.h
  18625. -@@ -50,6 +50,8 @@ enum ath_reset_type {
  18626. - RESET_TYPE_BEACON_STUCK,
  18627. - RESET_TYPE_MCI,
  18628. - RESET_TYPE_CALIBRATION,
  18629. -+ RESET_TX_DMA_ERROR,
  18630. -+ RESET_RX_DMA_ERROR,
  18631. - __RESET_TYPE_MAX
  18632. - };
  18633. -
  18634. ---- a/drivers/net/wireless/ath/ath9k/recv.c
  18635. -+++ b/drivers/net/wireless/ath/ath9k/recv.c
  18636. -@@ -496,10 +496,9 @@ bool ath_stoprecv(struct ath_softc *sc)
  18637. -
  18638. - if (!(ah->ah_flags & AH_UNPLUGGED) &&
  18639. - unlikely(!stopped)) {
  18640. -- ath_err(ath9k_hw_common(sc->sc_ah),
  18641. -- "Could not stop RX, we could be "
  18642. -- "confusing the DMA engine when we start RX up\n");
  18643. -- ATH_DBG_WARN_ON_ONCE(!stopped);
  18644. -+ ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
  18645. -+ "Failed to stop Rx DMA\n");
  18646. -+ RESET_STAT_INC(sc, RESET_RX_DMA_ERROR);
  18647. - }
  18648. - return stopped && !reset;
  18649. - }
  18650. ---- a/drivers/net/wireless/ath/ath9k/xmit.c
  18651. -+++ b/drivers/net/wireless/ath/ath9k/xmit.c
  18652. -@@ -1896,8 +1896,11 @@ bool ath_drain_all_txq(struct ath_softc
  18653. - npend |= BIT(i);
  18654. - }
  18655. -
  18656. -- if (npend)
  18657. -- ath_err(common, "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  18658. -+ if (npend) {
  18659. -+ RESET_STAT_INC(sc, RESET_TX_DMA_ERROR);
  18660. -+ ath_dbg(common, RESET,
  18661. -+ "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  18662. -+ }
  18663. -
  18664. - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
  18665. - if (!ATH_TXQ_SETUP(sc, i))
  18666. 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
  18667. deleted file mode 100644
  18668. index 06f2dce..0000000
  18669. --- a/package/kernel/mac80211/patches/389-0006-brcmfmac-free-ifp-for-non-netdev-interface-in-p2p-mo.patch
  18670. +++ /dev/null
  18671. @@ -1,44 +0,0 @@
  18672. -From: Arend van Spriel <arend@broadcom.com>
  18673. -Date: Thu, 11 Jun 2015 00:12:21 +0200
  18674. -Subject: [PATCH] brcmfmac: free ifp for non-netdev interface in p2p module
  18675. -
  18676. -Making it more clear by freeing the ifp in same place where the
  18677. -vif object is freed.
  18678. -
  18679. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18680. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18681. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18682. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18683. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18684. ----
  18685. -
  18686. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18687. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18688. -@@ -867,8 +867,6 @@ static void brcmf_del_if(struct brcmf_pu
  18689. - }
  18690. - /* unregister will take care of freeing it */
  18691. - unregister_netdev(ifp->ndev);
  18692. -- } else {
  18693. -- kfree(ifp);
  18694. - }
  18695. - }
  18696. -
  18697. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18698. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18699. -@@ -2238,6 +2238,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  18700. - {
  18701. - cfg80211_unregister_wdev(&vif->wdev);
  18702. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  18703. -+ kfree(vif->ifp);
  18704. - brcmf_free_vif(vif);
  18705. - }
  18706. -
  18707. -@@ -2361,6 +2362,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  18708. - break;
  18709. -
  18710. - case NL80211_IFTYPE_P2P_DEVICE:
  18711. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  18712. -+ brcmf_p2p_deinit_discovery(p2p);
  18713. - brcmf_p2p_delete_p2pdev(p2p, vif);
  18714. - return 0;
  18715. - default:
  18716. 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
  18717. deleted file mode 100644
  18718. index 0a6e093..0000000
  18719. --- a/package/kernel/mac80211/patches/389-0007-brcmfmac-move-p2p-attach-detach-functions.patch
  18720. +++ /dev/null
  18721. @@ -1,225 +0,0 @@
  18722. -From: Arend van Spriel <arend@broadcom.com>
  18723. -Date: Thu, 11 Jun 2015 00:12:22 +0200
  18724. -Subject: [PATCH] brcmfmac: move p2p attach/detach functions
  18725. -
  18726. -Moving two functions in p2p.c as is so next change will be
  18727. -easier to review.
  18728. -
  18729. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18730. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18731. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18732. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18733. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18734. ----
  18735. -
  18736. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18737. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18738. -@@ -1908,105 +1908,6 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  18739. -
  18740. -
  18741. - /**
  18742. -- * brcmf_p2p_attach() - attach for P2P.
  18743. -- *
  18744. -- * @cfg: driver private data for cfg80211 interface.
  18745. -- */
  18746. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  18747. --{
  18748. -- struct brcmf_if *pri_ifp;
  18749. -- struct brcmf_if *p2p_ifp;
  18750. -- struct brcmf_cfg80211_vif *p2p_vif;
  18751. -- struct brcmf_p2p_info *p2p;
  18752. -- struct brcmf_pub *drvr;
  18753. -- s32 bssidx;
  18754. -- s32 err = 0;
  18755. --
  18756. -- p2p = &cfg->p2p;
  18757. -- p2p->cfg = cfg;
  18758. --
  18759. -- drvr = cfg->pub;
  18760. --
  18761. -- pri_ifp = drvr->iflist[0];
  18762. -- p2p_ifp = drvr->iflist[1];
  18763. --
  18764. -- p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  18765. --
  18766. -- if (p2p_ifp) {
  18767. -- p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  18768. -- false);
  18769. -- if (IS_ERR(p2p_vif)) {
  18770. -- brcmf_err("could not create discovery vif\n");
  18771. -- err = -ENOMEM;
  18772. -- goto exit;
  18773. -- }
  18774. --
  18775. -- p2p_vif->ifp = p2p_ifp;
  18776. -- p2p_ifp->vif = p2p_vif;
  18777. -- p2p_vif->wdev.netdev = p2p_ifp->ndev;
  18778. -- p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  18779. -- SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  18780. --
  18781. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  18782. --
  18783. -- brcmf_p2p_generate_bss_mac(p2p, NULL);
  18784. -- memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  18785. -- brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  18786. --
  18787. -- /* Initialize P2P Discovery in the firmware */
  18788. -- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  18789. -- if (err < 0) {
  18790. -- brcmf_err("set p2p_disc error\n");
  18791. -- brcmf_free_vif(p2p_vif);
  18792. -- goto exit;
  18793. -- }
  18794. -- /* obtain bsscfg index for P2P discovery */
  18795. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  18796. -- if (err < 0) {
  18797. -- brcmf_err("retrieving discover bsscfg index failed\n");
  18798. -- brcmf_free_vif(p2p_vif);
  18799. -- goto exit;
  18800. -- }
  18801. -- /* Verify that firmware uses same bssidx as driver !! */
  18802. -- if (p2p_ifp->bssidx != bssidx) {
  18803. -- brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  18804. -- bssidx, p2p_ifp->bssidx);
  18805. -- brcmf_free_vif(p2p_vif);
  18806. -- goto exit;
  18807. -- }
  18808. --
  18809. -- init_completion(&p2p->send_af_done);
  18810. -- INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  18811. -- init_completion(&p2p->afx_hdl.act_frm_scan);
  18812. -- init_completion(&p2p->wait_next_af);
  18813. -- }
  18814. --exit:
  18815. -- return err;
  18816. --}
  18817. --
  18818. --
  18819. --/**
  18820. -- * brcmf_p2p_detach() - detach P2P.
  18821. -- *
  18822. -- * @p2p: P2P specific data.
  18823. -- */
  18824. --void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  18825. --{
  18826. -- struct brcmf_cfg80211_vif *vif;
  18827. --
  18828. -- vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  18829. -- if (vif != NULL) {
  18830. -- brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  18831. -- brcmf_p2p_deinit_discovery(p2p);
  18832. -- /* remove discovery interface */
  18833. -- brcmf_free_vif(vif);
  18834. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  18835. -- }
  18836. -- /* just set it all to zero */
  18837. -- memset(p2p, 0, sizeof(*p2p));
  18838. --}
  18839. --
  18840. --/**
  18841. - * brcmf_p2p_get_current_chanspec() - Get current operation channel.
  18842. - *
  18843. - * @p2p: P2P specific data.
  18844. -@@ -2425,3 +2326,102 @@ void brcmf_p2p_stop_device(struct wiphy
  18845. - clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  18846. - mutex_unlock(&cfg->usr_sync);
  18847. - }
  18848. -+
  18849. -+/**
  18850. -+ * brcmf_p2p_attach() - attach for P2P.
  18851. -+ *
  18852. -+ * @cfg: driver private data for cfg80211 interface.
  18853. -+ */
  18854. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  18855. -+{
  18856. -+ struct brcmf_if *pri_ifp;
  18857. -+ struct brcmf_if *p2p_ifp;
  18858. -+ struct brcmf_cfg80211_vif *p2p_vif;
  18859. -+ struct brcmf_p2p_info *p2p;
  18860. -+ struct brcmf_pub *drvr;
  18861. -+ s32 bssidx;
  18862. -+ s32 err = 0;
  18863. -+
  18864. -+ p2p = &cfg->p2p;
  18865. -+ p2p->cfg = cfg;
  18866. -+
  18867. -+ drvr = cfg->pub;
  18868. -+
  18869. -+ pri_ifp = drvr->iflist[0];
  18870. -+ p2p_ifp = drvr->iflist[1];
  18871. -+
  18872. -+ p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  18873. -+
  18874. -+ if (p2p_ifp) {
  18875. -+ p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  18876. -+ false);
  18877. -+ if (IS_ERR(p2p_vif)) {
  18878. -+ brcmf_err("could not create discovery vif\n");
  18879. -+ err = -ENOMEM;
  18880. -+ goto exit;
  18881. -+ }
  18882. -+
  18883. -+ p2p_vif->ifp = p2p_ifp;
  18884. -+ p2p_ifp->vif = p2p_vif;
  18885. -+ p2p_vif->wdev.netdev = p2p_ifp->ndev;
  18886. -+ p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  18887. -+ SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  18888. -+
  18889. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  18890. -+
  18891. -+ brcmf_p2p_generate_bss_mac(p2p, NULL);
  18892. -+ memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  18893. -+ brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  18894. -+
  18895. -+ /* Initialize P2P Discovery in the firmware */
  18896. -+ err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  18897. -+ if (err < 0) {
  18898. -+ brcmf_err("set p2p_disc error\n");
  18899. -+ brcmf_free_vif(p2p_vif);
  18900. -+ goto exit;
  18901. -+ }
  18902. -+ /* obtain bsscfg index for P2P discovery */
  18903. -+ err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  18904. -+ if (err < 0) {
  18905. -+ brcmf_err("retrieving discover bsscfg index failed\n");
  18906. -+ brcmf_free_vif(p2p_vif);
  18907. -+ goto exit;
  18908. -+ }
  18909. -+ /* Verify that firmware uses same bssidx as driver !! */
  18910. -+ if (p2p_ifp->bssidx != bssidx) {
  18911. -+ brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  18912. -+ bssidx, p2p_ifp->bssidx);
  18913. -+ brcmf_free_vif(p2p_vif);
  18914. -+ goto exit;
  18915. -+ }
  18916. -+
  18917. -+ init_completion(&p2p->send_af_done);
  18918. -+ INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  18919. -+ init_completion(&p2p->afx_hdl.act_frm_scan);
  18920. -+ init_completion(&p2p->wait_next_af);
  18921. -+ }
  18922. -+exit:
  18923. -+ return err;
  18924. -+}
  18925. -+
  18926. -+/**
  18927. -+ * brcmf_p2p_detach() - detach P2P.
  18928. -+ *
  18929. -+ * @p2p: P2P specific data.
  18930. -+ */
  18931. -+void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  18932. -+{
  18933. -+ struct brcmf_cfg80211_vif *vif;
  18934. -+
  18935. -+ vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  18936. -+ if (vif != NULL) {
  18937. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  18938. -+ brcmf_p2p_deinit_discovery(p2p);
  18939. -+ /* remove discovery interface */
  18940. -+ brcmf_free_vif(vif);
  18941. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  18942. -+ }
  18943. -+ /* just set it all to zero */
  18944. -+ memset(p2p, 0, sizeof(*p2p));
  18945. -+}
  18946. -+
  18947. 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
  18948. deleted file mode 100644
  18949. index 72e8eed..0000000
  18950. --- a/package/kernel/mac80211/patches/389-0008-brcmfmac-assure-p2pdev-is-unregistered-upon-driver-u.patch
  18951. +++ /dev/null
  18952. @@ -1,63 +0,0 @@
  18953. -From: Arend van Spriel <arend@broadcom.com>
  18954. -Date: Thu, 11 Jun 2015 00:12:23 +0200
  18955. -Subject: [PATCH] brcmfmac: assure p2pdev is unregistered upon driver
  18956. - unload
  18957. -
  18958. -When unloading the driver with a p2pdev interface it resulted in
  18959. -a warning upon calling wiphy_unregister() and subsequently a crash
  18960. -in the driver. This patch assures the p2pdev is unregistered calling
  18961. -unregister_wdev() before doing the wiphy_unregister().
  18962. -
  18963. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18964. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18965. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18966. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18967. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18968. ----
  18969. -
  18970. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18971. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18972. -@@ -6206,10 +6206,8 @@ void brcmf_cfg80211_detach(struct brcmf_
  18973. - if (!cfg)
  18974. - return;
  18975. -
  18976. -- WARN_ON(!list_empty(&cfg->vif_list));
  18977. -- wiphy_unregister(cfg->wiphy);
  18978. - brcmf_btcoex_detach(cfg);
  18979. -- brcmf_p2p_detach(&cfg->p2p);
  18980. -+ wiphy_unregister(cfg->wiphy);
  18981. - wl_deinit_priv(cfg);
  18982. - brcmf_free_wiphy(cfg->wiphy);
  18983. - }
  18984. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18985. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18986. -@@ -1098,6 +1098,7 @@ void brcmf_detach(struct device *dev)
  18987. -
  18988. - /* stop firmware event handling */
  18989. - brcmf_fweh_detach(drvr);
  18990. -+ brcmf_p2p_detach(&drvr->config->p2p);
  18991. -
  18992. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  18993. -
  18994. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18995. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18996. -@@ -16,6 +16,7 @@
  18997. - #include <linux/slab.h>
  18998. - #include <linux/netdevice.h>
  18999. - #include <linux/etherdevice.h>
  19000. -+#include <linux/rtnetlink.h>
  19001. - #include <net/cfg80211.h>
  19002. -
  19003. - #include <brcmu_wifi.h>
  19004. -@@ -2418,8 +2419,9 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  19005. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  19006. - brcmf_p2p_deinit_discovery(p2p);
  19007. - /* remove discovery interface */
  19008. -- brcmf_free_vif(vif);
  19009. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19010. -+ rtnl_lock();
  19011. -+ brcmf_p2p_delete_p2pdev(p2p, vif);
  19012. -+ rtnl_unlock();
  19013. - }
  19014. - /* just set it all to zero */
  19015. - memset(p2p, 0, sizeof(*p2p));
  19016. 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
  19017. deleted file mode 100644
  19018. index 179c77e..0000000
  19019. --- a/package/kernel/mac80211/patches/390-0001-brcmfmac-fix-double-free-of-p2pdev-interface.patch
  19020. +++ /dev/null
  19021. @@ -1,27 +0,0 @@
  19022. -From: Arend van Spriel <arend@broadcom.com>
  19023. -Date: Mon, 15 Jun 2015 22:48:38 +0200
  19024. -Subject: [PATCH] brcmfmac: fix double free of p2pdev interface
  19025. -
  19026. -When freeing the driver ifp pointer it should also be removed from
  19027. -the driver interface list, which is what brcmf_remove_interface()
  19028. -does. Otherwise, the ifp pointer will be freed twice triggering
  19029. -a kernel oops.
  19030. -
  19031. -Fixes: f37d69a4babc ("brcmfmac: free ifp for non-netdev interface in p2p module")
  19032. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19033. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19034. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19035. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19036. ----
  19037. -
  19038. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19039. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19040. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  19041. - {
  19042. - cfg80211_unregister_wdev(&vif->wdev);
  19043. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19044. -- kfree(vif->ifp);
  19045. -+ brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  19046. - brcmf_free_vif(vif);
  19047. - }
  19048. -
  19049. 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
  19050. deleted file mode 100644
  19051. index e4f88b5..0000000
  19052. --- a/package/kernel/mac80211/patches/390-0002-brcmfmac-make-brcmf_p2p_detach-call-conditional.patch
  19053. +++ /dev/null
  19054. @@ -1,29 +0,0 @@
  19055. -From: Arend van Spriel <arend@broadcom.com>
  19056. -Date: Mon, 15 Jun 2015 22:48:39 +0200
  19057. -Subject: [PATCH] brcmfmac: make brcmf_p2p_detach() call conditional
  19058. -
  19059. -During verification of error handling in brcmf_cfg80211_attach() a
  19060. -null pointer dereference occurred upon calling brcmf_p2p_detach()
  19061. -from brcmf_detach(). This should only be called when the
  19062. -brcmf_cfg80211_attach() has succeeded.
  19063. -
  19064. -Fixes: f7a40873d2fa ("brcmfmac: assure p2pdev is unregistered upon driver unload")
  19065. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19066. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19067. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19068. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19069. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19070. ----
  19071. -
  19072. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19073. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19074. -@@ -1098,7 +1098,8 @@ void brcmf_detach(struct device *dev)
  19075. -
  19076. - /* stop firmware event handling */
  19077. - brcmf_fweh_detach(drvr);
  19078. -- brcmf_p2p_detach(&drvr->config->p2p);
  19079. -+ if (drvr->config)
  19080. -+ brcmf_p2p_detach(&drvr->config->p2p);
  19081. -
  19082. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  19083. -
  19084. 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
  19085. deleted file mode 100644
  19086. index 0a81237..0000000
  19087. --- a/package/kernel/mac80211/patches/391-brcmfmac-set-wiphy-s-addresses-to-provide-valid-MACs.patch
  19088. +++ /dev/null
  19089. @@ -1,67 +0,0 @@
  19090. -From: Rafa? Mi?ecki <zajec5@gmail.com>
  19091. -Date: Thu, 9 Jul 2015 17:07:08 +0200
  19092. -Subject: [PATCH] brcmfmac: set wiphy's addresses to provide valid MACs
  19093. -
  19094. -Broadcom's firmware requires every BSS to use MAC address with unique
  19095. -last few bits. The amount of bits may depend on a particular firmware,
  19096. -it was verified to be 2 for BCM43602 one.
  19097. -If this condition won't be fulfilled firmware will reject such MAC:
  19098. -brcmfmac: _brcmf_set_mac_address: Setting cur_etheraddr failed, -52
  19099. -
  19100. -We don't want to simply set addr_mask as it would also disallow using
  19101. -locally administrated bit. Instead let's build a list of addresses
  19102. -manually enabling 0x2 bit for extra interfaces.
  19103. -
  19104. -Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
  19105. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19106. ----
  19107. -
  19108. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19109. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19110. -@@ -5784,6 +5784,7 @@ static void brcmf_wiphy_wowl_params(stru
  19111. -
  19112. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  19113. - {
  19114. -+ struct brcmf_pub *drvr = ifp->drvr;
  19115. - struct ieee80211_supported_band *band;
  19116. - __le32 bandlist[3];
  19117. - u32 n_bands;
  19118. -@@ -5797,6 +5798,19 @@ static int brcmf_setup_wiphy(struct wiph
  19119. - if (err)
  19120. - return err;
  19121. -
  19122. -+ for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  19123. -+ i < ARRAY_SIZE(drvr->addresses); i++) {
  19124. -+ u8 *addr = drvr->addresses[i].addr;
  19125. -+
  19126. -+ memcpy(addr, drvr->mac, ETH_ALEN);
  19127. -+ if (i) {
  19128. -+ addr[0] |= BIT(1);
  19129. -+ addr[ETH_ALEN - 1] ^= i;
  19130. -+ }
  19131. -+ }
  19132. -+ wiphy->addresses = drvr->addresses;
  19133. -+ wiphy->n_addresses = i;
  19134. -+
  19135. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  19136. - wiphy->cipher_suites = __wl_cipher_suites;
  19137. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  19138. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  19139. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  19140. -@@ -21,6 +21,7 @@
  19141. - #ifndef BRCMFMAC_CORE_H
  19142. - #define BRCMFMAC_CORE_H
  19143. -
  19144. -+#include <net/cfg80211.h>
  19145. - #include "fweh.h"
  19146. -
  19147. - #define TOE_TX_CSUM_OL 0x00000001
  19148. -@@ -118,6 +119,8 @@ struct brcmf_pub {
  19149. - /* Multicast data packets sent to dongle */
  19150. - unsigned long tx_multicast;
  19151. -
  19152. -+ struct mac_address addresses[BRCMF_MAX_IFS];
  19153. -+
  19154. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  19155. -
  19156. - struct mutex proto_block;
  19157. 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
  19158. deleted file mode 100644
  19159. index e44f121..0000000
  19160. --- a/package/kernel/mac80211/patches/392-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  19161. +++ /dev/null
  19162. @@ -1,45 +0,0 @@
  19163. -From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
  19164. -Date: Thu, 9 Jul 2015 13:43:18 +0530
  19165. -Subject: [PATCH] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
  19166. -
  19167. -There's already a generic implementation so use that instead.
  19168. -
  19169. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19170. ----
  19171. -
  19172. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  19173. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  19174. -@@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(st
  19175. - }
  19176. - }
  19177. -
  19178. --static void atomic_orr(int val, atomic_t *v)
  19179. --{
  19180. -- int old_val;
  19181. --
  19182. -- old_val = atomic_read(v);
  19183. -- while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
  19184. -- old_val = atomic_read(v);
  19185. --}
  19186. --
  19187. - static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
  19188. - {
  19189. - struct brcmf_core *buscore;
  19190. -@@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struc
  19191. - if (val) {
  19192. - brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
  19193. - bus->sdcnt.f1regdata++;
  19194. -- atomic_orr(val, &bus->intstatus);
  19195. -+ atomic_or(val, &bus->intstatus);
  19196. - }
  19197. -
  19198. - return ret;
  19199. -@@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  19200. -
  19201. - /* Keep still-pending events for next scheduling */
  19202. - if (intstatus)
  19203. -- atomic_orr(intstatus, &bus->intstatus);
  19204. -+ atomic_or(intstatus, &bus->intstatus);
  19205. -
  19206. - brcmf_sdio_clrintr(bus);
  19207. -
  19208. 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
  19209. deleted file mode 100644
  19210. index 76ca143..0000000
  19211. --- a/package/kernel/mac80211/patches/393-0001-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  19212. +++ /dev/null
  19213. @@ -1,46 +0,0 @@
  19214. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  19215. -Date: Thu, 20 Aug 2015 00:16:42 +0200
  19216. -Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
  19217. - addresses
  19218. -MIME-Version: 1.0
  19219. -Content-Type: text/plain; charset=UTF-8
  19220. -Content-Transfer-Encoding: 8bit
  19221. -
  19222. -Broadcom is working on better reflection of interface combinations. With
  19223. -upcoming patches we may have 1st combination supporting less interfaces
  19224. -than others.
  19225. -To don't run out of addresses check all combinations to find the one
  19226. -with the greatest max_interfaces value.
  19227. -
  19228. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  19229. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19230. ----
  19231. -
  19232. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19233. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19234. -@@ -5785,7 +5785,9 @@ static void brcmf_wiphy_wowl_params(stru
  19235. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  19236. - {
  19237. - struct brcmf_pub *drvr = ifp->drvr;
  19238. -+ const struct ieee80211_iface_combination *combo;
  19239. - struct ieee80211_supported_band *band;
  19240. -+ u16 max_interfaces = 0;
  19241. - __le32 bandlist[3];
  19242. - u32 n_bands;
  19243. - int err, i;
  19244. -@@ -5798,8 +5800,13 @@ static int brcmf_setup_wiphy(struct wiph
  19245. - if (err)
  19246. - return err;
  19247. -
  19248. -- for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  19249. -- i < ARRAY_SIZE(drvr->addresses); i++) {
  19250. -+ for (i = 0, combo = wiphy->iface_combinations;
  19251. -+ i < wiphy->n_iface_combinations; i++, combo++) {
  19252. -+ max_interfaces = max(max_interfaces, combo->max_interfaces);
  19253. -+ }
  19254. -+
  19255. -+ for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
  19256. -+ i++) {
  19257. - u8 *addr = drvr->addresses[i].addr;
  19258. -
  19259. - memcpy(addr, drvr->mac, ETH_ALEN);
  19260. 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
  19261. deleted file mode 100644
  19262. index c4a0720..0000000
  19263. --- a/package/kernel/mac80211/patches/393-0002-brcmfmac-correct-interface-combination-info.patch
  19264. +++ /dev/null
  19265. @@ -1,204 +0,0 @@
  19266. -From: Arend van Spriel <arend@broadcom.com>
  19267. -Date: Thu, 20 Aug 2015 22:06:03 +0200
  19268. -Subject: [PATCH] brcmfmac: correct interface combination info
  19269. -
  19270. -The interface combination provided by brcmfmac did not truly reflect
  19271. -the combinations supported by driver and/or firmware.
  19272. -
  19273. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19274. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19275. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19276. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  19277. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19278. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19279. ----
  19280. -
  19281. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19282. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19283. -@@ -5694,63 +5694,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  19284. - }
  19285. - };
  19286. -
  19287. -+/**
  19288. -+ * brcmf_setup_ifmodes() - determine interface modes and combinations.
  19289. -+ *
  19290. -+ * @wiphy: wiphy object.
  19291. -+ * @ifp: interface object needed for feat module api.
  19292. -+ *
  19293. -+ * The interface modes and combinations are determined dynamically here
  19294. -+ * based on firmware functionality.
  19295. -+ *
  19296. -+ * no p2p and no mbss:
  19297. -+ *
  19298. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  19299. -+ *
  19300. -+ * no p2p and mbss:
  19301. -+ *
  19302. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  19303. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  19304. -+ *
  19305. -+ * p2p, no mchan, and mbss:
  19306. -+ *
  19307. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
  19308. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  19309. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  19310. -+ *
  19311. -+ * p2p, mchan, and mbss:
  19312. -+ *
  19313. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  19314. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  19315. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  19316. -+ */
  19317. - static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  19318. - {
  19319. - struct ieee80211_iface_combination *combo = NULL;
  19320. -- struct ieee80211_iface_limit *limits = NULL;
  19321. -- int i = 0, max_iface_cnt;
  19322. -+ struct ieee80211_iface_limit *c0_limits = NULL;
  19323. -+ struct ieee80211_iface_limit *p2p_limits = NULL;
  19324. -+ struct ieee80211_iface_limit *mbss_limits = NULL;
  19325. -+ bool mbss, p2p;
  19326. -+ int i, c, n_combos;
  19327. -
  19328. -- combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  19329. -+ mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
  19330. -+ p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
  19331. -+
  19332. -+ n_combos = 1 + !!p2p + !!mbss;
  19333. -+ combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
  19334. - if (!combo)
  19335. - goto err;
  19336. -
  19337. -- limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  19338. -- if (!limits)
  19339. -+ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  19340. -+ if (!c0_limits)
  19341. - goto err;
  19342. -
  19343. -+ if (p2p) {
  19344. -+ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  19345. -+ if (!p2p_limits)
  19346. -+ goto err;
  19347. -+ }
  19348. -+
  19349. -+ if (mbss) {
  19350. -+ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  19351. -+ if (!mbss_limits)
  19352. -+ goto err;
  19353. -+ }
  19354. -+
  19355. - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  19356. - BIT(NL80211_IFTYPE_ADHOC) |
  19357. - BIT(NL80211_IFTYPE_AP);
  19358. -
  19359. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  19360. -- combo->num_different_channels = 2;
  19361. -- else
  19362. -- combo->num_different_channels = 1;
  19363. --
  19364. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  19365. -- limits[i].max = 1;
  19366. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  19367. -- limits[i].max = 4;
  19368. -- limits[i++].types = BIT(NL80211_IFTYPE_AP);
  19369. -- max_iface_cnt = 5;
  19370. -- } else {
  19371. -- limits[i].max = 2;
  19372. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  19373. -- BIT(NL80211_IFTYPE_AP);
  19374. -- max_iface_cnt = 2;
  19375. -- }
  19376. --
  19377. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  19378. -+ c = 0;
  19379. -+ i = 0;
  19380. -+ combo[c].num_different_channels = 1;
  19381. -+ c0_limits[i].max = 1;
  19382. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  19383. -+ if (p2p) {
  19384. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  19385. -+ combo[c].num_different_channels = 2;
  19386. - wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19387. - BIT(NL80211_IFTYPE_P2P_GO) |
  19388. - BIT(NL80211_IFTYPE_P2P_DEVICE);
  19389. -- limits[i].max = 1;
  19390. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19391. -- BIT(NL80211_IFTYPE_P2P_GO);
  19392. -- limits[i].max = 1;
  19393. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  19394. -- max_iface_cnt += 2;
  19395. -- }
  19396. -- combo->max_interfaces = max_iface_cnt;
  19397. -- combo->limits = limits;
  19398. -- combo->n_limits = i;
  19399. -+ c0_limits[i].max = 1;
  19400. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  19401. -+ c0_limits[i].max = 1;
  19402. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19403. -+ BIT(NL80211_IFTYPE_P2P_GO);
  19404. -+ } else {
  19405. -+ c0_limits[i].max = 1;
  19406. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  19407. -+ }
  19408. -+ combo[c].max_interfaces = i;
  19409. -+ combo[c].n_limits = i;
  19410. -+ combo[c].limits = c0_limits;
  19411. -+
  19412. -+ if (p2p) {
  19413. -+ c++;
  19414. -+ i = 0;
  19415. -+ combo[c].num_different_channels = 1;
  19416. -+ p2p_limits[i].max = 1;
  19417. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  19418. -+ p2p_limits[i].max = 1;
  19419. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  19420. -+ p2p_limits[i].max = 1;
  19421. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  19422. -+ p2p_limits[i].max = 1;
  19423. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  19424. -+ combo[c].max_interfaces = i;
  19425. -+ combo[c].n_limits = i;
  19426. -+ combo[c].limits = p2p_limits;
  19427. -+ }
  19428. -
  19429. -+ if (mbss) {
  19430. -+ c++;
  19431. -+ combo[c].beacon_int_infra_match = true;
  19432. -+ combo[c].num_different_channels = 1;
  19433. -+ mbss_limits[0].max = 4;
  19434. -+ mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  19435. -+ combo[c].max_interfaces = 4;
  19436. -+ combo[c].n_limits = 1;
  19437. -+ combo[c].limits = mbss_limits;
  19438. -+ }
  19439. -+ wiphy->n_iface_combinations = n_combos;
  19440. - wiphy->iface_combinations = combo;
  19441. -- wiphy->n_iface_combinations = 1;
  19442. - return 0;
  19443. -
  19444. - err:
  19445. -- kfree(limits);
  19446. -+ kfree(c0_limits);
  19447. -+ kfree(p2p_limits);
  19448. -+ kfree(mbss_limits);
  19449. - kfree(combo);
  19450. - return -ENOMEM;
  19451. - }
  19452. -@@ -6079,11 +6148,15 @@ static void brcmf_cfg80211_reg_notifier(
  19453. -
  19454. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  19455. - {
  19456. -+ int i;
  19457. -+
  19458. - if (!wiphy)
  19459. - return;
  19460. -
  19461. -- if (wiphy->iface_combinations)
  19462. -- kfree(wiphy->iface_combinations->limits);
  19463. -+ if (wiphy->iface_combinations) {
  19464. -+ for (i = 0; i < wiphy->n_iface_combinations; i++)
  19465. -+ kfree(wiphy->iface_combinations[i].limits);
  19466. -+ }
  19467. - kfree(wiphy->iface_combinations);
  19468. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  19469. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  19470. 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
  19471. deleted file mode 100644
  19472. index 9768ef2..0000000
  19473. --- a/package/kernel/mac80211/patches/393-0003-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  19474. +++ /dev/null
  19475. @@ -1,87 +0,0 @@
  19476. -From: Franky Lin <frankyl@broadcom.com>
  19477. -Date: Thu, 20 Aug 2015 22:06:04 +0200
  19478. -Subject: [PATCH] brcmfmac: add debugfs entry for msgbuf statistics
  19479. -
  19480. -Expose ring buffer read/write pointers and other useful statistics
  19481. -through debugfs.
  19482. -
  19483. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  19484. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19485. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19486. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  19487. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19488. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19489. ----
  19490. -
  19491. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  19492. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  19493. -@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct
  19494. - }
  19495. - }
  19496. -
  19497. -+#ifdef DEBUG
  19498. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  19499. -+{
  19500. -+ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  19501. -+ struct brcmf_pub *drvr = bus_if->drvr;
  19502. -+ struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  19503. -+ struct brcmf_commonring *commonring;
  19504. -+ u16 i;
  19505. -+ struct brcmf_flowring_ring *ring;
  19506. -+ struct brcmf_flowring_hash *hash;
  19507. -+
  19508. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
  19509. -+ seq_printf(seq, "h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n",
  19510. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19511. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
  19512. -+ seq_printf(seq, "h2d_rx_submit: rp %4u, wp %4u, depth %4u\n",
  19513. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19514. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
  19515. -+ seq_printf(seq, "d2h_ctl_cmplt: rp %4u, wp %4u, depth %4u\n",
  19516. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19517. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
  19518. -+ seq_printf(seq, "d2h_tx_cmplt: rp %4u, wp %4u, depth %4u\n",
  19519. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19520. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
  19521. -+ seq_printf(seq, "d2h_rx_cmplt: rp %4u, wp %4u, depth %4u\n",
  19522. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19523. -+
  19524. -+ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
  19525. -+ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
  19526. -+ seq_puts(seq, "Active flowrings:\n");
  19527. -+ hash = msgbuf->flow->hash;
  19528. -+ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
  19529. -+ if (!msgbuf->flow->rings[i])
  19530. -+ continue;
  19531. -+ ring = msgbuf->flow->rings[i];
  19532. -+ if (ring->status != RING_OPEN)
  19533. -+ continue;
  19534. -+ commonring = msgbuf->flowrings[i];
  19535. -+ hash = &msgbuf->flow->hash[ring->hash_id];
  19536. -+ seq_printf(seq, "id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n"
  19537. -+ " ifidx %u, fifo %u, da %pM\n",
  19538. -+ i, commonring->r_ptr, commonring->w_ptr,
  19539. -+ skb_queue_len(&ring->skblist), ring->blocked,
  19540. -+ hash->ifidx, hash->fifo, hash->mac);
  19541. -+ }
  19542. -+
  19543. -+ return 0;
  19544. -+}
  19545. -+#else
  19546. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  19547. -+{
  19548. -+ return 0;
  19549. -+}
  19550. -+#endif
  19551. -
  19552. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
  19553. - {
  19554. -@@ -1460,6 +1514,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  19555. - spin_lock_init(&msgbuf->flowring_work_lock);
  19556. - INIT_LIST_HEAD(&msgbuf->work_queue);
  19557. -
  19558. -+ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read);
  19559. -+
  19560. - return 0;
  19561. -
  19562. - fail:
  19563. 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
  19564. deleted file mode 100644
  19565. index 2b84cf9..0000000
  19566. --- a/package/kernel/mac80211/patches/393-0004-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  19567. +++ /dev/null
  19568. @@ -1,83 +0,0 @@
  19569. -From: Arend van Spriel <arend@broadcom.com>
  19570. -Date: Thu, 20 Aug 2015 22:06:05 +0200
  19571. -Subject: [PATCH] brcmfmac: make use of cfg80211_check_combinations()
  19572. -
  19573. -Use cfg80211_check_combinations() so we can bail out early when an
  19574. -interface add or change results in an invalid combination.
  19575. -
  19576. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19577. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19578. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19579. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19580. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19581. ----
  19582. -
  19583. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19584. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19585. -@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 le
  19586. - return NULL;
  19587. - }
  19588. -
  19589. -+static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
  19590. -+ struct brcmf_cfg80211_vif *vif,
  19591. -+ enum nl80211_iftype new_type)
  19592. -+{
  19593. -+ int iftype_num[NUM_NL80211_IFTYPES];
  19594. -+ struct brcmf_cfg80211_vif *pos;
  19595. -+
  19596. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  19597. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  19598. -+ if (pos == vif)
  19599. -+ iftype_num[new_type]++;
  19600. -+ else
  19601. -+ iftype_num[pos->wdev.iftype]++;
  19602. -+
  19603. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  19604. -+}
  19605. -+
  19606. -+static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
  19607. -+ enum nl80211_iftype new_type)
  19608. -+{
  19609. -+ int iftype_num[NUM_NL80211_IFTYPES];
  19610. -+ struct brcmf_cfg80211_vif *pos;
  19611. -+
  19612. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  19613. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  19614. -+ iftype_num[pos->wdev.iftype]++;
  19615. -+
  19616. -+ iftype_num[new_type]++;
  19617. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  19618. -+}
  19619. -
  19620. - static void convert_key_from_CPU(struct brcmf_wsec_key *key,
  19621. - struct brcmf_wsec_key_le *key_le)
  19622. -@@ -662,8 +692,14 @@ static struct wireless_dev *brcmf_cfg802
  19623. - struct vif_params *params)
  19624. - {
  19625. - struct wireless_dev *wdev;
  19626. -+ int err;
  19627. -
  19628. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  19629. -+ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  19630. -+ if (err) {
  19631. -+ brcmf_err("iface validation failed: err=%d\n", err);
  19632. -+ return ERR_PTR(err);
  19633. -+ }
  19634. - switch (type) {
  19635. - case NL80211_IFTYPE_ADHOC:
  19636. - case NL80211_IFTYPE_STATION:
  19637. -@@ -822,8 +858,12 @@ brcmf_cfg80211_change_iface(struct wiphy
  19638. - s32 ap = 0;
  19639. - s32 err = 0;
  19640. -
  19641. -- brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
  19642. --
  19643. -+ brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  19644. -+ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  19645. -+ if (err) {
  19646. -+ brcmf_err("iface validation failed: err=%d\n", err);
  19647. -+ return err;
  19648. -+ }
  19649. - switch (type) {
  19650. - case NL80211_IFTYPE_MONITOR:
  19651. - case NL80211_IFTYPE_WDS:
  19652. 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
  19653. deleted file mode 100644
  19654. index 2d5f7b9..0000000
  19655. --- a/package/kernel/mac80211/patches/393-0005-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  19656. +++ /dev/null
  19657. @@ -1,48 +0,0 @@
  19658. -From: Franky Lin <frankyl@broadcom.com>
  19659. -Date: Thu, 20 Aug 2015 22:06:06 +0200
  19660. -Subject: [PATCH] brcmfmac: block the correct flowring when backup queue
  19661. - overflow
  19662. -
  19663. -brcmf_flowring_block blocks the last active flowring under the same
  19664. -interface instead of the one provided by caller. This could lead to a
  19665. -dead lock of netif stop if there are more than one flowring under the
  19666. -interface and the traffic is high enough so brcmf_flowring_enqueue can
  19667. -not unblock the ring right away.
  19668. -
  19669. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19670. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19671. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  19672. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19673. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19674. ----
  19675. -
  19676. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  19677. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  19678. -@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct
  19679. - spin_lock_irqsave(&flow->block_lock, flags);
  19680. -
  19681. - ring = flow->rings[flowid];
  19682. -+ if (ring->blocked == blocked) {
  19683. -+ spin_unlock_irqrestore(&flow->block_lock, flags);
  19684. -+ return;
  19685. -+ }
  19686. - ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  19687. -
  19688. - currently_blocked = false;
  19689. - for (i = 0; i < flow->nrofrings; i++) {
  19690. -- if (flow->rings[i]) {
  19691. -+ if ((flow->rings[i]) && (i != flowid)) {
  19692. - ring = flow->rings[i];
  19693. - if ((ring->status == RING_OPEN) &&
  19694. - (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
  19695. -@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct
  19696. - }
  19697. - }
  19698. - }
  19699. -- ring->blocked = blocked;
  19700. -- if (currently_blocked == blocked) {
  19701. -+ flow->rings[flowid]->blocked = blocked;
  19702. -+ if (currently_blocked) {
  19703. - spin_unlock_irqrestore(&flow->block_lock, flags);
  19704. - return;
  19705. - }
  19706. 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
  19707. deleted file mode 100644
  19708. index 7378401..0000000
  19709. --- a/package/kernel/mac80211/patches/393-0006-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  19710. +++ /dev/null
  19711. @@ -1,52 +0,0 @@
  19712. -From: Arend van Spriel <arend@broadcom.com>
  19713. -Date: Thu, 20 Aug 2015 22:06:07 +0200
  19714. -Subject: [PATCH] brcmfmac: bump highest event number for 4339 firmware
  19715. -
  19716. -The event mask length is determined by the highest event number
  19717. -that is specified in the driver. When this length is shorter than
  19718. -firmware expects setting event mask will fail and device becomes
  19719. -pretty useless. This issue was reported with bcm4339 firmware that
  19720. -was recently released.
  19721. -
  19722. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  19723. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19724. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19725. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19726. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  19727. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19728. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19729. ----
  19730. -
  19731. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  19732. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  19733. -@@ -85,7 +85,6 @@ struct brcmf_event;
  19734. - BRCMF_ENUM_DEF(IF, 54) \
  19735. - BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \
  19736. - BRCMF_ENUM_DEF(RSSI, 56) \
  19737. -- BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
  19738. - BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
  19739. - BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
  19740. - BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
  19741. -@@ -103,8 +102,7 @@ struct brcmf_event;
  19742. - BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
  19743. - BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
  19744. - BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
  19745. -- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
  19746. -- BRCMF_ENUM_DEF(PSTA_PRIMARY_INTF_IND, 128)
  19747. -+ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
  19748. -
  19749. - #define BRCMF_ENUM_DEF(id, val) \
  19750. - BRCMF_E_##id = (val),
  19751. -@@ -112,7 +110,11 @@ struct brcmf_event;
  19752. - /* firmware event codes sent by the dongle */
  19753. - enum brcmf_fweh_event_code {
  19754. - BRCMF_FWEH_EVENT_ENUM_DEFLIST
  19755. -- BRCMF_E_LAST
  19756. -+ /* this determines event mask length which must match
  19757. -+ * minimum length check in device firmware so it is
  19758. -+ * hard-coded here.
  19759. -+ */
  19760. -+ BRCMF_E_LAST = 139
  19761. - };
  19762. - #undef BRCMF_ENUM_DEF
  19763. -
  19764. 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
  19765. deleted file mode 100644
  19766. index 97444b3..0000000
  19767. --- a/package/kernel/mac80211/patches/394-0001-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  19768. +++ /dev/null
  19769. @@ -1,138 +0,0 @@
  19770. -From: Arend van Spriel <arend@broadcom.com>
  19771. -Date: Wed, 26 Aug 2015 22:14:53 +0200
  19772. -Subject: [PATCH] brcmfmac: consolidate ifp lookup in driver core
  19773. -
  19774. -In rx path the firmware provide an interface index which is used to
  19775. -map to a struct brcmf_if instance. However, this involves some trick
  19776. -that is done in two places. This is changed by having driver core
  19777. -providing brcmf_get_ifp() function.
  19778. -
  19779. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19780. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19781. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19782. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19783. ----
  19784. -
  19785. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  19786. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  19787. -@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19788. - struct sk_buff *pktbuf)
  19789. - {
  19790. - struct brcmf_proto_bcdc_header *h;
  19791. -+ struct brcmf_if *ifp;
  19792. -
  19793. - brcmf_dbg(BCDC, "Enter\n");
  19794. -
  19795. -@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19796. - trace_brcmf_bcdchdr(pktbuf->data);
  19797. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  19798. -
  19799. -- *ifidx = BCDC_GET_IF_IDX(h);
  19800. -- if (*ifidx >= BRCMF_MAX_IFS) {
  19801. -- brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
  19802. -+ ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  19803. -+ if (IS_ERR_OR_NULL(ifp)) {
  19804. -+ brcmf_dbg(INFO, "no matching ifp found\n");
  19805. - return -EBADE;
  19806. - }
  19807. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  19808. -- * events this is easy because it contains the bssidx which maps
  19809. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  19810. -- * bssidx 1 is used for p2p0 and no data can be received or
  19811. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  19812. -- */
  19813. -- if (*ifidx)
  19814. -- (*ifidx)++;
  19815. --
  19816. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  19817. - BCDC_PROTO_VER) {
  19818. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  19819. -- brcmf_ifname(drvr, *ifidx), h->flags);
  19820. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  19821. - return -EBADE;
  19822. - }
  19823. -
  19824. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  19825. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  19826. -- brcmf_ifname(drvr, *ifidx), h->flags);
  19827. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  19828. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  19829. - }
  19830. -
  19831. -@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19832. -
  19833. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  19834. - if (do_fws)
  19835. -- brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf);
  19836. -+ brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  19837. -+ pktbuf);
  19838. - else
  19839. - skb_pull(pktbuf, h->data_offset << 2);
  19840. -
  19841. - if (pktbuf->len == 0)
  19842. - return -ENODATA;
  19843. -+
  19844. -+ *ifidx = ifp->ifidx;
  19845. - return 0;
  19846. - }
  19847. -
  19848. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19849. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19850. -@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drv
  19851. - return "<if_none>";
  19852. - }
  19853. -
  19854. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  19855. -+{
  19856. -+ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  19857. -+ brcmf_err("ifidx %d out of range\n", ifidx);
  19858. -+ return ERR_PTR(-ERANGE);
  19859. -+ }
  19860. -+
  19861. -+ /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  19862. -+ * events this is easy because it contains the bssidx which maps
  19863. -+ * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  19864. -+ * bssidx 1 is used for p2p0 and no data can be received or
  19865. -+ * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  19866. -+ */
  19867. -+ if (ifidx)
  19868. -+ ifidx++;
  19869. -+
  19870. -+ return drvr->iflist[ifidx];
  19871. -+}
  19872. -+
  19873. - static void _brcmf_set_multicast_list(struct work_struct *work)
  19874. - {
  19875. - struct brcmf_if *ifp;
  19876. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  19877. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  19878. -@@ -202,7 +202,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  19879. -
  19880. - /* Return pointer to interface name */
  19881. - char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  19882. --
  19883. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  19884. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  19885. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  19886. - char *name, u8 *mac_addr);
  19887. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  19888. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  19889. -@@ -1081,16 +1081,8 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  19890. - {
  19891. - struct brcmf_if *ifp;
  19892. -
  19893. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  19894. -- * events this is easy because it contains the bssidx which maps
  19895. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  19896. -- * bssidx 1 is used for p2p0 and no data can be received or
  19897. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  19898. -- */
  19899. -- if (ifidx)
  19900. -- (ifidx)++;
  19901. -- ifp = msgbuf->drvr->iflist[ifidx];
  19902. -- if (!ifp || !ifp->ndev) {
  19903. -+ ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  19904. -+ if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  19905. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  19906. - brcmu_pkt_buf_free_skb(skb);
  19907. - return;
  19908. 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
  19909. deleted file mode 100644
  19910. index 632714c..0000000
  19911. --- a/package/kernel/mac80211/patches/394-0002-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  19912. +++ /dev/null
  19913. @@ -1,222 +0,0 @@
  19914. -From: Arend van Spriel <arend@broadcom.com>
  19915. -Date: Wed, 26 Aug 2015 22:14:54 +0200
  19916. -Subject: [PATCH] brcmfmac: make brcmf_proto_hdrpull() return struct
  19917. - brcmf_if instance
  19918. -
  19919. -Avoid spreading the ifidx in the driver, but have it return the
  19920. -struct brcmf_if instance.
  19921. -
  19922. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19923. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19924. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19925. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19926. ----
  19927. -
  19928. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  19929. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  19930. -@@ -272,11 +272,11 @@ brcmf_proto_bcdc_hdrpush(struct brcmf_pu
  19931. - }
  19932. -
  19933. - static int
  19934. --brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  19935. -- struct sk_buff *pktbuf)
  19936. -+brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  19937. -+ struct sk_buff *pktbuf, struct brcmf_if **ifp)
  19938. - {
  19939. - struct brcmf_proto_bcdc_header *h;
  19940. -- struct brcmf_if *ifp;
  19941. -+ struct brcmf_if *tmp_if;
  19942. -
  19943. - brcmf_dbg(BCDC, "Enter\n");
  19944. -
  19945. -@@ -290,21 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19946. - trace_brcmf_bcdchdr(pktbuf->data);
  19947. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  19948. -
  19949. -- ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  19950. -- if (IS_ERR_OR_NULL(ifp)) {
  19951. -+ tmp_if = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  19952. -+ if (!tmp_if) {
  19953. - brcmf_dbg(INFO, "no matching ifp found\n");
  19954. - return -EBADE;
  19955. - }
  19956. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  19957. - BCDC_PROTO_VER) {
  19958. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  19959. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  19960. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  19961. - return -EBADE;
  19962. - }
  19963. -
  19964. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  19965. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  19966. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  19967. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  19968. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  19969. - }
  19970. -
  19971. -@@ -312,7 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19972. -
  19973. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  19974. - if (do_fws)
  19975. -- brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  19976. -+ brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  19977. - pktbuf);
  19978. - else
  19979. - skb_pull(pktbuf, h->data_offset << 2);
  19980. -@@ -320,7 +320,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19981. - if (pktbuf->len == 0)
  19982. - return -ENODATA;
  19983. -
  19984. -- *ifidx = ifp->ifidx;
  19985. -+ *ifp = tmp_if;
  19986. - return 0;
  19987. - }
  19988. -
  19989. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19990. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19991. -@@ -87,7 +87,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  19992. - {
  19993. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  19994. - brcmf_err("ifidx %d out of range\n", ifidx);
  19995. -- return ERR_PTR(-ERANGE);
  19996. -+ return NULL;
  19997. - }
  19998. -
  19999. - /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20000. -@@ -539,17 +539,15 @@ void brcmf_rx_frame(struct device *dev,
  20001. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  20002. - struct brcmf_pub *drvr = bus_if->drvr;
  20003. - struct brcmf_skb_reorder_data *rd;
  20004. -- u8 ifidx;
  20005. - int ret;
  20006. -
  20007. - brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  20008. -
  20009. - /* process and remove protocol-specific header */
  20010. -- ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb);
  20011. -- ifp = drvr->iflist[ifidx];
  20012. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  20013. -
  20014. - if (ret || !ifp || !ifp->ndev) {
  20015. -- if ((ret != -ENODATA) && ifp)
  20016. -+ if (ret != -ENODATA && ifp)
  20017. - ifp->stats.rx_errors++;
  20018. - brcmu_pkt_buf_free_skb(skb);
  20019. - return;
  20020. -@@ -592,17 +590,17 @@ void brcmf_txcomplete(struct device *dev
  20021. - {
  20022. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  20023. - struct brcmf_pub *drvr = bus_if->drvr;
  20024. -- u8 ifidx;
  20025. -+ struct brcmf_if *ifp;
  20026. -
  20027. - /* await txstatus signal for firmware if active */
  20028. - if (brcmf_fws_fc_active(drvr->fws)) {
  20029. - if (!success)
  20030. - brcmf_fws_bustxfail(drvr->fws, txp);
  20031. - } else {
  20032. -- if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp))
  20033. -+ if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  20034. - brcmu_pkt_buf_free_skb(txp);
  20035. - else
  20036. -- brcmf_txfinalize(drvr, txp, ifidx, success);
  20037. -+ brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  20038. - }
  20039. - }
  20040. -
  20041. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20042. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20043. -@@ -1448,7 +1448,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20044. - struct sk_buff *skb;
  20045. - struct brcmf_skbuff_cb *skcb;
  20046. - struct brcmf_fws_mac_descriptor *entry = NULL;
  20047. -- u8 ifidx;
  20048. -+ struct brcmf_if *ifp;
  20049. -
  20050. - brcmf_dbg(DATA, "flags %d\n", flags);
  20051. -
  20052. -@@ -1497,15 +1497,16 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20053. - }
  20054. - brcmf_fws_macdesc_return_req_credit(skb);
  20055. -
  20056. -- if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) {
  20057. -+ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp);
  20058. -+ if (ret) {
  20059. - brcmu_pkt_buf_free_skb(skb);
  20060. - return -EINVAL;
  20061. - }
  20062. - if (!remove_from_hanger)
  20063. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx,
  20064. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  20065. - genbit, seq);
  20066. - if (remove_from_hanger || ret)
  20067. -- brcmf_txfinalize(fws->drvr, skb, ifidx, true);
  20068. -+ brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  20069. -
  20070. - return 0;
  20071. - }
  20072. -@@ -1848,7 +1849,7 @@ static int brcmf_fws_commit_skb(struct b
  20073. - entry->transit_count--;
  20074. - if (entry->suppressed)
  20075. - entry->suppr_transit_count--;
  20076. -- brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
  20077. -+ (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
  20078. - goto rollback;
  20079. - }
  20080. -
  20081. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20082. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20083. -@@ -522,7 +522,7 @@ static int brcmf_msgbuf_set_dcmd(struct
  20084. -
  20085. -
  20086. - static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  20087. -- u8 *ifidx, struct sk_buff *skb)
  20088. -+ struct sk_buff *skb, struct brcmf_if **ifp)
  20089. - {
  20090. - return -ENODEV;
  20091. - }
  20092. -@@ -1082,7 +1082,7 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  20093. - struct brcmf_if *ifp;
  20094. -
  20095. - ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  20096. -- if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  20097. -+ if (!ifp || !ifp->ndev) {
  20098. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  20099. - brcmu_pkt_buf_free_skb(skb);
  20100. - return;
  20101. ---- a/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  20102. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  20103. -@@ -24,8 +24,8 @@ enum proto_addr_mode {
  20104. -
  20105. -
  20106. - struct brcmf_proto {
  20107. -- int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  20108. -- struct sk_buff *skb);
  20109. -+ int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  20110. -+ struct sk_buff *skb, struct brcmf_if **ifp);
  20111. - int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
  20112. - void *buf, uint len);
  20113. - int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
  20114. -@@ -46,9 +46,19 @@ int brcmf_proto_attach(struct brcmf_pub
  20115. - void brcmf_proto_detach(struct brcmf_pub *drvr);
  20116. -
  20117. - static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  20118. -- u8 *ifidx, struct sk_buff *skb)
  20119. -+ struct sk_buff *skb,
  20120. -+ struct brcmf_if **ifp)
  20121. - {
  20122. -- return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
  20123. -+ struct brcmf_if *tmp = NULL;
  20124. -+
  20125. -+ /* assure protocol is always called with
  20126. -+ * non-null initialized pointer.
  20127. -+ */
  20128. -+ if (ifp)
  20129. -+ *ifp = NULL;
  20130. -+ else
  20131. -+ ifp = &tmp;
  20132. -+ return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
  20133. - }
  20134. - static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  20135. - uint cmd, void *buf, uint len)
  20136. 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
  20137. deleted file mode 100644
  20138. index 2d15a77..0000000
  20139. --- a/package/kernel/mac80211/patches/394-0003-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  20140. +++ /dev/null
  20141. @@ -1,87 +0,0 @@
  20142. -From: Arend van Spriel <arend@broadcom.com>
  20143. -Date: Wed, 26 Aug 2015 22:14:55 +0200
  20144. -Subject: [PATCH] brcmfmac: change parameters for
  20145. - brcmf_remove_interface()
  20146. -
  20147. -Just pass the interface to be removed, ie. the struct brcmf_if instance.
  20148. -
  20149. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20150. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20151. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20152. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20153. ----
  20154. -
  20155. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20156. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20157. -@@ -4982,7 +4982,7 @@ brcmf_notify_connect_status_ap(struct br
  20158. - brcmf_dbg(CONN, "AP mode link down\n");
  20159. - complete(&cfg->vif_disabled);
  20160. - if (ifp->vif->mbss)
  20161. -- brcmf_remove_interface(ifp->drvr, ifp->bssidx);
  20162. -+ brcmf_remove_interface(ifp);
  20163. - return 0;
  20164. - }
  20165. -
  20166. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20167. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20168. -@@ -887,12 +887,13 @@ static void brcmf_del_if(struct brcmf_pu
  20169. - }
  20170. - }
  20171. -
  20172. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx)
  20173. -+void brcmf_remove_interface(struct brcmf_if *ifp)
  20174. - {
  20175. -- if (drvr->iflist[bssidx]) {
  20176. -- brcmf_fws_del_interface(drvr->iflist[bssidx]);
  20177. -- brcmf_del_if(drvr, bssidx);
  20178. -- }
  20179. -+ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  20180. -+ return;
  20181. -+
  20182. -+ brcmf_fws_del_interface(ifp);
  20183. -+ brcmf_del_if(ifp->drvr, ifp->bssidx);
  20184. - }
  20185. -
  20186. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  20187. -@@ -1122,7 +1123,7 @@ void brcmf_detach(struct device *dev)
  20188. -
  20189. - /* make sure primary interface removed last */
  20190. - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  20191. -- brcmf_remove_interface(drvr, i);
  20192. -+ brcmf_remove_interface(drvr->iflist[i]);
  20193. -
  20194. - brcmf_cfg80211_detach(drvr->config);
  20195. -
  20196. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20197. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20198. -@@ -206,7 +206,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  20199. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  20200. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20201. - char *name, u8 *mac_addr);
  20202. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx);
  20203. -+void brcmf_remove_interface(struct brcmf_if *ifp);
  20204. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  20205. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  20206. - enum brcmf_netif_stop_reason reason, bool state);
  20207. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20208. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20209. -@@ -222,7 +222,7 @@ static void brcmf_fweh_handle_if_event(s
  20210. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  20211. -
  20212. - if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  20213. -- brcmf_remove_interface(drvr, ifevent->bssidx);
  20214. -+ brcmf_remove_interface(ifp);
  20215. - }
  20216. -
  20217. - /**
  20218. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20219. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20220. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  20221. - {
  20222. - cfg80211_unregister_wdev(&vif->wdev);
  20223. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  20224. -- brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  20225. -+ brcmf_remove_interface(vif->ifp);
  20226. - brcmf_free_vif(vif);
  20227. - }
  20228. -
  20229. 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
  20230. deleted file mode 100644
  20231. index 2b61f4e..0000000
  20232. --- a/package/kernel/mac80211/patches/394-0004-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  20233. +++ /dev/null
  20234. @@ -1,92 +0,0 @@
  20235. -From: Arend van Spriel <arend@broadcom.com>
  20236. -Date: Wed, 26 Aug 2015 22:14:56 +0200
  20237. -Subject: [PATCH] brcmfmac: only call brcmf_cfg80211_detach() when attach
  20238. - was successful
  20239. -
  20240. -In brcmf_bus_start() the function brcmf_cfg80211_attach() is called which
  20241. -may fail. If this happens we should not call brcmf_cfg80211_detach() in
  20242. -the failure path as it will result in NULL pointer dereference:
  20243. -
  20244. - brcmf_fweh_activate_events: Set event_msgs error (-5)
  20245. - brcmf_bus_start: failed: -5
  20246. - brcmf_sdio_firmware_callback: dongle is not responding
  20247. - BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
  20248. - IP: [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  20249. - PGD 0
  20250. - Oops: 0000 [#1] SMP
  20251. - Modules linked in: brcmfmac(O) brcmutil(O) cfg80211 auth_rpcgss
  20252. - CPU: 1 PID: 45 Comm: kworker/1:1 Tainted: G O
  20253. - Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  20254. - Workqueue: events request_firmware_work_func
  20255. - task: ffff880036c09ac0 ti: ffff880036dd4000 task.ti: ffff880036dd4000
  20256. - RIP: 0010:[<ffffffff811e8f08>] [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  20257. - RSP: 0018:ffff880036dd7a28 EFLAGS: 00010246
  20258. - RAX: ffff880036c09ac0 RBX: 0000000000000000 RCX: 000000007fffffff
  20259. - RDX: 0000000000000000 RSI: ffffffff816578b9 RDI: 0000000000000000
  20260. - RBP: ffff880036dd7a48 R08: 0000000000000000 R09: ffff880036c0b340
  20261. - R10: 00000000000002ec R11: ffff880036dd7b08 R12: ffffffff816578b9
  20262. - R13: 0000000000000000 R14: ffffffff816578b9 R15: ffff8800c6c87000
  20263. - FS: 0000000000000000(0000) GS:ffff88012bc40000(0000) knlGS:0000000000000000
  20264. - CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  20265. - CR2: 0000000000000068 CR3: 0000000001a0b000 CR4: 00000000000006e0
  20266. - Stack:
  20267. - 0000000000000000 ffffffff816578b9 0000000000000000 ffff8800c0d003c8
  20268. - ffff880036dd7a78 ffffffff811e8ff5 0000000ffffffff1 ffffffff81a9b060
  20269. - ffff8800c789f880 ffff8800c0d00000 ffff880036dd7a98 ffffffff811ebe0d
  20270. - Call Trace:
  20271. - [<ffffffff811e8ff5>] kernfs_find_and_get_ns+0x35/0x60
  20272. - [<ffffffff811ebe0d>] sysfs_unmerge_group+0x1d/0x60
  20273. - [<ffffffff81404ef2>] dpm_sysfs_remove+0x22/0x60
  20274. - [<ffffffff813f9db9>] device_del+0x49/0x240
  20275. - [<ffffffff815da768>] rfkill_unregister+0x58/0xc0
  20276. - [<ffffffffa06bd91b>] wiphy_unregister+0xab/0x2f0 [cfg80211]
  20277. - [<ffffffffa0742fe3>] brcmf_cfg80211_detach+0x23/0x50 [brcmfmac]
  20278. - [<ffffffffa074d986>] brcmf_detach+0x86/0xe0 [brcmfmac]
  20279. - [<ffffffffa0757de8>] brcmf_sdio_remove+0x48/0x120 [brcmfmac]
  20280. - [<ffffffffa0758ed9>] brcmf_sdiod_remove+0x29/0xd0 [brcmfmac]
  20281. - [<ffffffffa0759031>] brcmf_ops_sdio_remove+0xb1/0x110 [brcmfmac]
  20282. - [<ffffffffa001c267>] sdio_bus_remove+0x37/0x100 [mmc_core]
  20283. - [<ffffffff813fe026>] __device_release_driver+0x96/0x130
  20284. - [<ffffffff813fe0e3>] device_release_driver+0x23/0x30
  20285. - [<ffffffffa0754bc8>] brcmf_sdio_firmware_callback+0x2a8/0x5d0 [brcmfmac]
  20286. - [<ffffffffa074deaf>] brcmf_fw_request_nvram_done+0x15f/0x5e0 [brcmfmac]
  20287. - [<ffffffff8140142f>] ? devres_add+0x3f/0x50
  20288. - [<ffffffff810642b5>] ? usermodehelper_read_unlock+0x15/0x20
  20289. - [<ffffffff81400000>] ? platform_match+0x70/0xa0
  20290. - [<ffffffff8140f400>] request_firmware_work_func+0x30/0x60
  20291. - [<ffffffff8106828c>] process_one_work+0x14c/0x3d0
  20292. - [<ffffffff8106862a>] worker_thread+0x11a/0x450
  20293. - [<ffffffff81068510>] ? process_one_work+0x3d0/0x3d0
  20294. - [<ffffffff8106d692>] kthread+0xd2/0xf0
  20295. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  20296. - [<ffffffff815ed35f>] ret_from_fork+0x3f/0x70
  20297. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  20298. - Code: e9 40 fe ff ff 48 89 d8 eb 87 66 0f 1f 84 00 00 00 00 00 66 66 66 66
  20299. - 90 55 48 89 e5 41 56 49 89 f6 41 55 49 89 d5 31 d2 41 54 53 <0f> b7
  20300. - 47 68 48 8b 5f 48 66 c1 e8 05 83 e0 01 4d 85 ed 0f b6 c8
  20301. - RIP [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  20302. - RSP <ffff880036dd7a28>
  20303. - CR2: 0000000000000068
  20304. - ---[ end trace 87d6ec0d3fe46740 ]---
  20305. -
  20306. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  20307. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20308. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20309. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20310. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20311. ----
  20312. -
  20313. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20314. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20315. -@@ -1049,7 +1049,10 @@ int brcmf_bus_start(struct device *dev)
  20316. - fail:
  20317. - if (ret < 0) {
  20318. - brcmf_err("failed: %d\n", ret);
  20319. -- brcmf_cfg80211_detach(drvr->config);
  20320. -+ if (drvr->config) {
  20321. -+ brcmf_cfg80211_detach(drvr->config);
  20322. -+ drvr->config = NULL;
  20323. -+ }
  20324. - if (drvr->fws) {
  20325. - brcmf_fws_del_interface(ifp);
  20326. - brcmf_fws_deinit(drvr);
  20327. 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
  20328. deleted file mode 100644
  20329. index 868b0a8..0000000
  20330. --- a/package/kernel/mac80211/patches/394-0005-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  20331. +++ /dev/null
  20332. @@ -1,105 +0,0 @@
  20333. -From: Arend van Spriel <arend@broadcom.com>
  20334. -Date: Wed, 26 Aug 2015 22:14:57 +0200
  20335. -Subject: [PATCH] brcmfmac: correct detection of p2pdev interface event
  20336. -
  20337. -The p2pdev interface is setup in firmware resulting in a interface
  20338. -event. This event has role and no-if flag. When role is p2p client
  20339. -and no-if flag is set it indicates that this is the p2pdev interface.
  20340. -This info is used in handling the event and adding interface in the
  20341. -driver.
  20342. -
  20343. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20344. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20345. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20346. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20347. ----
  20348. -
  20349. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20350. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20351. -@@ -795,7 +795,7 @@ fail:
  20352. - }
  20353. -
  20354. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20355. -- char *name, u8 *mac_addr)
  20356. -+ bool is_p2pdev, char *name, u8 *mac_addr)
  20357. - {
  20358. - struct brcmf_if *ifp;
  20359. - struct net_device *ndev;
  20360. -@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  20361. - }
  20362. - }
  20363. -
  20364. -- if (!brcmf_p2p_enable && bssidx == 1) {
  20365. -+ if (!brcmf_p2p_enable && is_p2pdev) {
  20366. - /* this is P2P_DEVICE interface */
  20367. - brcmf_dbg(INFO, "allocate non-netdev interface\n");
  20368. - ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
  20369. -@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
  20370. - brcmf_dbg(TRACE, "\n");
  20371. -
  20372. - /* add primary networking interface */
  20373. -- ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL);
  20374. -+ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
  20375. - if (IS_ERR(ifp))
  20376. - return PTR_ERR(ifp);
  20377. -
  20378. - if (brcmf_p2p_enable)
  20379. -- p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL);
  20380. -+ p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  20381. - else
  20382. - p2p_ifp = NULL;
  20383. - if (IS_ERR(p2p_ifp))
  20384. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20385. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20386. -@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drv
  20387. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  20388. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  20389. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20390. -- char *name, u8 *mac_addr);
  20391. -+ bool is_p2pdev, char *name, u8 *mac_addr);
  20392. - void brcmf_remove_interface(struct brcmf_if *ifp);
  20393. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  20394. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  20395. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20396. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20397. -@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(s
  20398. - {
  20399. - struct brcmf_if_event *ifevent = data;
  20400. - struct brcmf_if *ifp;
  20401. -+ bool is_p2pdev;
  20402. - int err = 0;
  20403. -
  20404. - brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  20405. -@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(s
  20406. - ifevent->flags, ifevent->role);
  20407. -
  20408. - /* The P2P Device interface event must not be ignored
  20409. -- * contrary to what firmware tells us. The only way to
  20410. -- * distinguish the P2P Device is by looking at the ifidx
  20411. -- * and bssidx received.
  20412. -+ * contrary to what firmware tells us.
  20413. - */
  20414. -- if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
  20415. -- (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  20416. -+ is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  20417. -+ ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  20418. -+ if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  20419. - brcmf_dbg(EVENT, "event can be ignored\n");
  20420. - return;
  20421. - }
  20422. - if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  20423. -- brcmf_err("invalid interface index: %u\n",
  20424. -- ifevent->ifidx);
  20425. -+ brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  20426. - return;
  20427. - }
  20428. -
  20429. -@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(s
  20430. - brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  20431. - emsg->addr);
  20432. - ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  20433. -- emsg->ifname, emsg->addr);
  20434. -+ is_p2pdev, emsg->ifname, emsg->addr);
  20435. - if (IS_ERR(ifp))
  20436. - return;
  20437. - brcmf_fws_add_interface(ifp);
  20438. 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
  20439. deleted file mode 100644
  20440. index aebbfa6..0000000
  20441. --- a/package/kernel/mac80211/patches/394-0006-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  20442. +++ /dev/null
  20443. @@ -1,126 +0,0 @@
  20444. -From: Arend van Spriel <arend@broadcom.com>
  20445. -Date: Wed, 26 Aug 2015 22:14:58 +0200
  20446. -Subject: [PATCH] brcmfmac: use brcmf_get_ifp() to map ifidx to struct
  20447. - brcmf_if instance
  20448. -
  20449. -The knowledge on how to map the interface index to a struct brcmf_if
  20450. -instance is in brcmf_get_ifp() so use that function when only the
  20451. -interface index is known instead of accessing brcmf_pub::iflist
  20452. -directly.
  20453. -
  20454. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20455. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20456. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20457. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20458. ----
  20459. -
  20460. ---- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  20461. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  20462. -@@ -149,7 +149,7 @@ static s32 brcmf_btcoex_params_read(stru
  20463. - static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
  20464. - bool trump_sco)
  20465. - {
  20466. -- struct brcmf_if *ifp = btci->cfg->pub->iflist[0];
  20467. -+ struct brcmf_if *ifp = brcmf_get_ifp(btci->cfg->pub, 0);
  20468. -
  20469. - if (trump_sco && !btci->saved_regs_part2) {
  20470. - /* this should reduce eSCO agressive
  20471. -@@ -468,7 +468,7 @@ int brcmf_btcoex_set_mode(struct brcmf_c
  20472. - {
  20473. - struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  20474. - struct brcmf_btcoex_info *btci = cfg->btcoex;
  20475. -- struct brcmf_if *ifp = cfg->pub->iflist[0];
  20476. -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  20477. -
  20478. - switch (mode) {
  20479. - case BRCMF_BTCOEX_DISABLED:
  20480. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20481. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20482. -@@ -6212,7 +6212,7 @@ static void brcmf_free_wiphy(struct wiph
  20483. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  20484. - struct device *busdev)
  20485. - {
  20486. -- struct net_device *ndev = drvr->iflist[0]->ndev;
  20487. -+ struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  20488. - struct brcmf_cfg80211_info *cfg;
  20489. - struct wiphy *wiphy;
  20490. - struct brcmf_cfg80211_vif *vif;
  20491. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  20492. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  20493. -@@ -121,7 +121,7 @@ static void brcmf_feat_iovar_int_set(str
  20494. -
  20495. - void brcmf_feat_attach(struct brcmf_pub *drvr)
  20496. - {
  20497. -- struct brcmf_if *ifp = drvr->iflist[0];
  20498. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  20499. -
  20500. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  20501. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  20502. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  20503. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  20504. -@@ -221,7 +221,7 @@ static void brcmf_flowring_block(struct
  20505. -
  20506. - bus_if = dev_get_drvdata(flow->dev);
  20507. - drvr = bus_if->drvr;
  20508. -- ifp = drvr->iflist[ifidx];
  20509. -+ ifp = brcmf_get_ifp(drvr, ifidx);
  20510. - brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
  20511. -
  20512. - spin_unlock_irqrestore(&flow->block_lock, flags);
  20513. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20514. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20515. -@@ -334,7 +334,7 @@ void brcmf_fweh_attach(struct brcmf_pub
  20516. - void brcmf_fweh_detach(struct brcmf_pub *drvr)
  20517. - {
  20518. - struct brcmf_fweh_info *fweh = &drvr->fweh;
  20519. -- struct brcmf_if *ifp = drvr->iflist[0];
  20520. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  20521. - s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  20522. -
  20523. - if (ifp) {
  20524. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20525. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20526. -@@ -972,7 +972,7 @@ static void
  20527. - brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
  20528. - u8 if_id)
  20529. - {
  20530. -- struct brcmf_if *ifp = fws->drvr->iflist[!if_id ? 0 : if_id + 1];
  20531. -+ struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id);
  20532. -
  20533. - if (WARN_ON(!ifp))
  20534. - return;
  20535. -@@ -2118,6 +2118,7 @@ static int brcmf_debugfs_fws_stats_read(
  20536. - int brcmf_fws_init(struct brcmf_pub *drvr)
  20537. - {
  20538. - struct brcmf_fws_info *fws;
  20539. -+ struct brcmf_if *ifp;
  20540. - u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS;
  20541. - int rc;
  20542. - u32 mode;
  20543. -@@ -2177,21 +2178,22 @@ int brcmf_fws_init(struct brcmf_pub *drv
  20544. - * continue. Set mode back to none indicating not enabled.
  20545. - */
  20546. - fws->fw_signals = true;
  20547. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) {
  20548. -+ ifp = brcmf_get_ifp(drvr, 0);
  20549. -+ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  20550. - brcmf_err("failed to set bdcv2 tlv signaling\n");
  20551. - fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  20552. - fws->fw_signals = false;
  20553. - }
  20554. -
  20555. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1))
  20556. -+ if (brcmf_fil_iovar_int_set(ifp, "ampdu_hostreorder", 1))
  20557. - brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n");
  20558. -
  20559. - /* Enable seq number reuse, if supported */
  20560. -- if (brcmf_fil_iovar_int_get(drvr->iflist[0], "wlfc_mode", &mode) == 0) {
  20561. -+ if (brcmf_fil_iovar_int_get(ifp, "wlfc_mode", &mode) == 0) {
  20562. - if (BRCMF_FWS_MODE_GET_REUSESEQ(mode)) {
  20563. - mode = 0;
  20564. - BRCMF_FWS_MODE_SET_REUSESEQ(mode, 1);
  20565. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0],
  20566. -+ if (brcmf_fil_iovar_int_set(ifp,
  20567. - "wlfc_mode", mode) == 0) {
  20568. - BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1);
  20569. - }
  20570. 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
  20571. deleted file mode 100644
  20572. index 23a7b6f..0000000
  20573. --- a/package/kernel/mac80211/patches/394-0007-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  20574. +++ /dev/null
  20575. @@ -1,122 +0,0 @@
  20576. -From: Arend van Spriel <arend@broadcom.com>
  20577. -Date: Wed, 26 Aug 2015 22:14:59 +0200
  20578. -Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  20579. - brcmf_txfinalize()
  20580. -
  20581. -Most call sites of brcmf_txfinalize already have struct brcmf_if
  20582. -instance so pass that to brcmf_txfinalize() as the function
  20583. -needs it anyway.
  20584. -
  20585. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20586. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20587. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20588. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20589. ----
  20590. -
  20591. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20592. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20593. -@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  20594. - brcmf_netif_rx(ifp, skb);
  20595. - }
  20596. -
  20597. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  20598. -- bool success)
  20599. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  20600. - {
  20601. -- struct brcmf_if *ifp;
  20602. - struct ethhdr *eh;
  20603. - u16 type;
  20604. -
  20605. -- ifp = drvr->iflist[ifidx];
  20606. -- if (!ifp)
  20607. -- goto done;
  20608. --
  20609. - eh = (struct ethhdr *)(txp->data);
  20610. - type = ntohs(eh->h_proto);
  20611. -
  20612. -@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  20613. -
  20614. - if (!success)
  20615. - ifp->stats.tx_errors++;
  20616. --done:
  20617. -+
  20618. - brcmu_pkt_buf_free_skb(txp);
  20619. - }
  20620. -
  20621. -@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  20622. - if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  20623. - brcmu_pkt_buf_free_skb(txp);
  20624. - else
  20625. -- brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  20626. -+ brcmf_txfinalize(ifp, txp, success);
  20627. - }
  20628. - }
  20629. -
  20630. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20631. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20632. -@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  20633. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  20634. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  20635. - enum brcmf_netif_stop_reason reason, bool state);
  20636. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  20637. -- bool success);
  20638. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  20639. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  20640. -
  20641. - /* Sets dongle media info (drv_version, mac address). */
  20642. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20643. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20644. -@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20645. - ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  20646. - genbit, seq);
  20647. - if (remove_from_hanger || ret)
  20648. -- brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  20649. -+ brcmf_txfinalize(ifp, skb, true);
  20650. -
  20651. - return 0;
  20652. - }
  20653. -@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  20654. - if (fws->avoid_queueing) {
  20655. - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  20656. - if (rc < 0)
  20657. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  20658. -+ brcmf_txfinalize(ifp, skb, false);
  20659. - return rc;
  20660. - }
  20661. -
  20662. -@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  20663. - brcmf_fws_schedule_deq(fws);
  20664. - } else {
  20665. - brcmf_err("drop skb: no hanger slot\n");
  20666. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  20667. -+ brcmf_txfinalize(ifp, skb, false);
  20668. - rc = -ENOMEM;
  20669. - }
  20670. - brcmf_fws_unlock(fws);
  20671. -@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  20672. - ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  20673. - brcmf_fws_lock(fws);
  20674. - if (ret < 0)
  20675. -- brcmf_txfinalize(drvr, skb, ifidx,
  20676. -- false);
  20677. -+ brcmf_txfinalize(brcmf_get_ifp(drvr,
  20678. -+ ifidx),
  20679. -+ skb, false);
  20680. - if (fws->bus_flow_blocked)
  20681. - break;
  20682. - }
  20683. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20684. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20685. -@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  20686. - commonring = msgbuf->flowrings[flowid];
  20687. - atomic_dec(&commonring->outstanding_tx);
  20688. -
  20689. -- brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  20690. -+ /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  20691. -+ * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  20692. -+ */
  20693. -+ brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  20694. -+ skb, true);
  20695. - }
  20696. -
  20697. -
  20698. 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
  20699. deleted file mode 100644
  20700. index 8ddc0a6..0000000
  20701. --- a/package/kernel/mac80211/patches/394-0008-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  20702. +++ /dev/null
  20703. @@ -1,92 +0,0 @@
  20704. -From: Arend van Spriel <arend@broadcom.com>
  20705. -Date: Wed, 26 Aug 2015 22:15:00 +0200
  20706. -Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
  20707. - index
  20708. -
  20709. -Because the P2P Device interface in firmware uses the same interface
  20710. -index as the primary interface we use the bsscfg index as index in the
  20711. -struct brcmf_pub::iflist. However, in the data path we get the interface
  20712. -index and not the bsscfg index. So we need a mapping of interface index
  20713. -to bsscfg index, which can be determined upon handle adding the interface.
  20714. -
  20715. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20716. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20717. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20718. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20719. ----
  20720. -
  20721. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20722. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20723. -@@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
  20724. -
  20725. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  20726. - {
  20727. -+ struct brcmf_if *ifp;
  20728. -+ s32 bssidx;
  20729. -+
  20730. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  20731. - brcmf_err("ifidx %d out of range\n", ifidx);
  20732. - return NULL;
  20733. - }
  20734. -
  20735. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20736. -- * events this is easy because it contains the bssidx which maps
  20737. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  20738. -- * bssidx 1 is used for p2p0 and no data can be received or
  20739. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  20740. -- */
  20741. -- if (ifidx)
  20742. -- ifidx++;
  20743. -+ ifp = NULL;
  20744. -+ bssidx = drvr->if2bss[ifidx];
  20745. -+ if (bssidx >= 0)
  20746. -+ ifp = drvr->iflist[bssidx];
  20747. -
  20748. -- return drvr->iflist[ifidx];
  20749. -+ return ifp;
  20750. - }
  20751. -
  20752. - static void _brcmf_set_multicast_list(struct work_struct *work)
  20753. -@@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  20754. -
  20755. - ifp = netdev_priv(ndev);
  20756. - ifp->ndev = ndev;
  20757. -+ /* store mapping ifidx to bssidx */
  20758. -+ drvr->if2bss[ifidx] = bssidx;
  20759. - }
  20760. -
  20761. - ifp->drvr = drvr;
  20762. -@@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
  20763. - struct brcmf_if *ifp;
  20764. -
  20765. - ifp = drvr->iflist[bssidx];
  20766. -+ drvr->if2bss[ifp->ifidx] = -1;
  20767. - drvr->iflist[bssidx] = NULL;
  20768. - if (!ifp) {
  20769. - brcmf_err("Null interface, idx=%d\n", bssidx);
  20770. -@@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
  20771. - }
  20772. - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  20773. - if (ifp->ndev) {
  20774. -+ drvr->if2bss[ifp->ifidx] = -1;
  20775. - if (bssidx == 0) {
  20776. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  20777. - rtnl_lock();
  20778. -@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  20779. - if (!drvr)
  20780. - return -ENOMEM;
  20781. -
  20782. -+ memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  20783. - mutex_init(&drvr->proto_block);
  20784. -
  20785. - /* Link to bus module */
  20786. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20787. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20788. -@@ -122,6 +122,7 @@ struct brcmf_pub {
  20789. - struct mac_address addresses[BRCMF_MAX_IFS];
  20790. -
  20791. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  20792. -+ s32 if2bss[BRCMF_MAX_IFS];
  20793. -
  20794. - struct mutex proto_block;
  20795. - unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  20796. 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
  20797. deleted file mode 100644
  20798. index a0a798b..0000000
  20799. --- a/package/kernel/mac80211/patches/394-0009-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  20800. +++ /dev/null
  20801. @@ -1,103 +0,0 @@
  20802. -From: Arend van Spriel <arend@broadcom.com>
  20803. -Date: Wed, 26 Aug 2015 22:15:01 +0200
  20804. -Subject: [PATCH] brcmfmac: add dedicated debug level for firmware
  20805. - console logging
  20806. -
  20807. -Both PCIe and SDIO devices have the possibility to log the firmware
  20808. -console output in kernel log. For PCIe it is logged when PCIE debug
  20809. -level is enabled. For SDIO it is logged when user specifies a non-zero
  20810. -console interval through debugfs. This patch tries to make it a
  20811. -bit more consistent. The firmware console output is only logged when
  20812. -FWCON debug level is enabled.
  20813. -
  20814. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20815. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20816. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20817. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  20818. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20819. ----
  20820. -
  20821. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  20822. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  20823. -@@ -37,6 +37,7 @@
  20824. - #define BRCMF_SDIO_VAL 0x00020000
  20825. - #define BRCMF_MSGBUF_VAL 0x00040000
  20826. - #define BRCMF_PCIE_VAL 0x00080000
  20827. -+#define BRCMF_FWCON_VAL 0x00100000
  20828. -
  20829. - /* set default print format */
  20830. - #undef pr_fmt
  20831. -@@ -78,6 +79,7 @@ do { \
  20832. - #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  20833. - #define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
  20834. - #define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
  20835. -+#define BRCMF_FWCON_ON() (brcmf_msg_level & BRCMF_FWCON_VAL)
  20836. -
  20837. - #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  20838. -
  20839. -@@ -90,6 +92,7 @@ do { \
  20840. - #define BRCMF_GLOM_ON() 0
  20841. - #define BRCMF_EVENT_ON() 0
  20842. - #define BRCMF_FIL_ON() 0
  20843. -+#define BRCMF_FWCON_ON() 0
  20844. -
  20845. - #endif /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  20846. -
  20847. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  20848. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  20849. -@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(
  20850. - addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
  20851. - console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
  20852. -
  20853. -- brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
  20854. -+ brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
  20855. - console->base_addr, console->buf_addr, console->bufsize);
  20856. - }
  20857. -
  20858. -@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(
  20859. - u8 ch;
  20860. - u32 newidx;
  20861. -
  20862. -+ if (!BRCMF_FWCON_ON())
  20863. -+ return;
  20864. -+
  20865. - console = &devinfo->shared.console;
  20866. - addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
  20867. - newidx = brcmf_pcie_read_tcm32(devinfo, addr);
  20868. -@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(
  20869. - }
  20870. - if (ch == '\n') {
  20871. - console->log_str[console->log_idx] = 0;
  20872. -- brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  20873. -+ pr_debug("CONSOLE: %s", console->log_str);
  20874. - console->log_idx = 0;
  20875. - }
  20876. - }
  20877. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  20878. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  20879. -@@ -123,6 +123,7 @@ struct rte_console {
  20880. -
  20881. - #define BRCMF_FIRSTREAD (1 << 6)
  20882. -
  20883. -+#define BRCMF_CONSOLE 10 /* watchdog interval to poll console */
  20884. -
  20885. - /* SBSDIO_DEVICE_CTL */
  20886. -
  20887. -@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(st
  20888. - if (IS_ERR_OR_NULL(dentry))
  20889. - return;
  20890. -
  20891. -+ bus->console_interval = BRCMF_CONSOLE;
  20892. -+
  20893. - brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
  20894. - brcmf_debugfs_add_entry(drvr, "counters",
  20895. - brcmf_debugfs_sdio_count_read);
  20896. -@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(stru
  20897. - }
  20898. - #ifdef DEBUG
  20899. - /* Poll for console output periodically */
  20900. -- if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
  20901. -+ if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
  20902. - bus->console_interval != 0) {
  20903. - bus->console.count += BRCMF_WD_POLL_MS;
  20904. - if (bus->console.count >= bus->console_interval) {
  20905. 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
  20906. deleted file mode 100644
  20907. index 53e7ede..0000000
  20908. --- a/package/kernel/mac80211/patches/394-0010-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  20909. +++ /dev/null
  20910. @@ -1,34 +0,0 @@
  20911. -From: Arend van Spriel <arend@broadcom.com>
  20912. -Date: Wed, 26 Aug 2015 22:15:02 +0200
  20913. -Subject: [PATCH] brcmfmac: remove ifidx parameter from
  20914. - brcmf_fws_txstatus_suppressed()
  20915. -
  20916. -The brcmf_fws_txstatus_suppressed() function prototype specifies an
  20917. -ifidx parameter which is not used within the function implementation.
  20918. -
  20919. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20920. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20921. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20922. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20923. ----
  20924. -
  20925. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20926. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20927. -@@ -1398,7 +1398,7 @@ done:
  20928. - }
  20929. -
  20930. - static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo,
  20931. -- struct sk_buff *skb, u8 ifidx,
  20932. -+ struct sk_buff *skb,
  20933. - u32 genbit, u16 seq)
  20934. - {
  20935. - struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac;
  20936. -@@ -1503,7 +1503,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20937. - return -EINVAL;
  20938. - }
  20939. - if (!remove_from_hanger)
  20940. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  20941. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb,
  20942. - genbit, seq);
  20943. - if (remove_from_hanger || ret)
  20944. - brcmf_txfinalize(ifp, skb, true);
  20945. 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
  20946. deleted file mode 100644
  20947. index bb05235..0000000
  20948. --- a/package/kernel/mac80211/patches/394-0011-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  20949. +++ /dev/null
  20950. @@ -1,97 +0,0 @@
  20951. -From: Arend van Spriel <arend@broadcom.com>
  20952. -Date: Wed, 26 Aug 2015 22:15:03 +0200
  20953. -Subject: [PATCH] brcmfmac: change prototype for brcmf_fws_hdrpull()
  20954. -
  20955. -Instead of passing ifidx and drvr just pass struct brcmf_if pointer
  20956. -which holds both parameters.
  20957. -
  20958. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20959. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20960. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20961. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20962. ----
  20963. -
  20964. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  20965. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  20966. -@@ -312,8 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20967. -
  20968. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  20969. - if (do_fws)
  20970. -- brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  20971. -- pktbuf);
  20972. -+ brcmf_fws_hdrpull(tmp_if, h->data_offset << 2, pktbuf);
  20973. - else
  20974. - skb_pull(pktbuf, h->data_offset << 2);
  20975. -
  20976. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20977. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20978. -@@ -1616,11 +1616,10 @@ static int brcmf_fws_notify_bcmc_credit_
  20979. - return 0;
  20980. - }
  20981. -
  20982. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  20983. -- struct sk_buff *skb)
  20984. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  20985. - {
  20986. - struct brcmf_skb_reorder_data *rd;
  20987. -- struct brcmf_fws_info *fws = drvr->fws;
  20988. -+ struct brcmf_fws_info *fws = ifp->drvr->fws;
  20989. - u8 *signal_data;
  20990. - s16 data_len;
  20991. - u8 type;
  20992. -@@ -1630,20 +1629,20 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  20993. - s32 err;
  20994. -
  20995. - brcmf_dbg(HDRS, "enter: ifidx %d, skblen %u, sig %d\n",
  20996. -- ifidx, skb->len, signal_len);
  20997. -+ ifp->ifidx, skb->len, siglen);
  20998. -
  20999. -- WARN_ON(signal_len > skb->len);
  21000. -+ WARN_ON(siglen > skb->len);
  21001. -
  21002. -- if (!signal_len)
  21003. -- return 0;
  21004. -+ if (!siglen)
  21005. -+ return;
  21006. - /* if flow control disabled, skip to packet data and leave */
  21007. - if ((!fws) || (!fws->fw_signals)) {
  21008. -- skb_pull(skb, signal_len);
  21009. -- return 0;
  21010. -+ skb_pull(skb, siglen);
  21011. -+ return;
  21012. - }
  21013. -
  21014. - fws->stats.header_pulls++;
  21015. -- data_len = signal_len;
  21016. -+ data_len = siglen;
  21017. - signal_data = skb->data;
  21018. -
  21019. - status = BRCMF_FWS_RET_OK_NOSCHEDULE;
  21020. -@@ -1731,14 +1730,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  21021. - /* signalling processing result does
  21022. - * not affect the actual ethernet packet.
  21023. - */
  21024. -- skb_pull(skb, signal_len);
  21025. -+ skb_pull(skb, siglen);
  21026. -
  21027. - /* this may be a signal-only packet
  21028. - */
  21029. - if (skb->len == 0)
  21030. - fws->stats.header_only_pkt++;
  21031. --
  21032. -- return 0;
  21033. - }
  21034. -
  21035. - static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
  21036. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  21037. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  21038. -@@ -21,8 +21,7 @@
  21039. - int brcmf_fws_init(struct brcmf_pub *drvr);
  21040. - void brcmf_fws_deinit(struct brcmf_pub *drvr);
  21041. - bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
  21042. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  21043. -- struct sk_buff *skb);
  21044. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
  21045. - int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);
  21046. -
  21047. - void brcmf_fws_reset_interface(struct brcmf_if *ifp);
  21048. 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
  21049. deleted file mode 100644
  21050. index ba92c67..0000000
  21051. --- a/package/kernel/mac80211/patches/394-0012-brcmfmac-introduce-brcmf_net_detach-function.patch
  21052. +++ /dev/null
  21053. @@ -1,99 +0,0 @@
  21054. -From: Arend van Spriel <arend@broadcom.com>
  21055. -Date: Wed, 26 Aug 2015 22:15:04 +0200
  21056. -Subject: [PATCH] brcmfmac: introduce brcmf_net_detach() function
  21057. -
  21058. -In case of error during brcmf_bus_start() the network interfaces were
  21059. -freed using free_netdev(). However, the interfaces may have additional
  21060. -memory allocated which is not freed. The netdev has destructor set to
  21061. -brcmf_cfg80211_free_netdev() which frees the additional memory if
  21062. -allocated and call free_netdev(). The brcmf_net_detach() either calls
  21063. -brcmf_cfg80211_free_netdev() directly or uses unregister_netdev() when
  21064. -struct net_device::reg_state indicates the netdev was registered.
  21065. -
  21066. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  21067. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21068. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21069. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21070. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21071. ----
  21072. -
  21073. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21074. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21075. -@@ -4746,7 +4746,8 @@ void brcmf_cfg80211_free_netdev(struct n
  21076. - ifp = netdev_priv(ndev);
  21077. - vif = ifp->vif;
  21078. -
  21079. -- brcmf_free_vif(vif);
  21080. -+ if (vif)
  21081. -+ brcmf_free_vif(vif);
  21082. - free_netdev(ndev);
  21083. - }
  21084. -
  21085. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21086. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21087. -@@ -718,8 +718,6 @@ int brcmf_net_attach(struct brcmf_if *if
  21088. - }
  21089. -
  21090. - brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
  21091. --
  21092. -- ndev->destructor = brcmf_cfg80211_free_netdev;
  21093. - return 0;
  21094. -
  21095. - fail:
  21096. -@@ -729,6 +727,14 @@ fail:
  21097. - return -EBADE;
  21098. - }
  21099. -
  21100. -+static void brcmf_net_detach(struct net_device *ndev)
  21101. -+{
  21102. -+ if (ndev->reg_state == NETREG_REGISTERED)
  21103. -+ unregister_netdev(ndev);
  21104. -+ else
  21105. -+ brcmf_cfg80211_free_netdev(ndev);
  21106. -+}
  21107. -+
  21108. - static int brcmf_net_p2p_open(struct net_device *ndev)
  21109. - {
  21110. - brcmf_dbg(TRACE, "Enter\n");
  21111. -@@ -805,8 +811,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  21112. - ifp->ndev->name);
  21113. - if (ifidx) {
  21114. - netif_stop_queue(ifp->ndev);
  21115. -- unregister_netdev(ifp->ndev);
  21116. -- free_netdev(ifp->ndev);
  21117. -+ brcmf_net_detach(ifp->ndev);
  21118. - drvr->iflist[bssidx] = NULL;
  21119. - } else {
  21120. - brcmf_err("ignore IF event\n");
  21121. -@@ -828,6 +833,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  21122. - if (!ndev)
  21123. - return ERR_PTR(-ENOMEM);
  21124. -
  21125. -+ ndev->destructor = brcmf_cfg80211_free_netdev;
  21126. - ifp = netdev_priv(ndev);
  21127. - ifp->ndev = ndev;
  21128. - /* store mapping ifidx to bssidx */
  21129. -@@ -879,8 +885,7 @@ static void brcmf_del_if(struct brcmf_pu
  21130. - cancel_work_sync(&ifp->setmacaddr_work);
  21131. - cancel_work_sync(&ifp->multicast_work);
  21132. - }
  21133. -- /* unregister will take care of freeing it */
  21134. -- unregister_netdev(ifp->ndev);
  21135. -+ brcmf_net_detach(ifp->ndev);
  21136. - }
  21137. - }
  21138. -
  21139. -@@ -1056,11 +1061,11 @@ fail:
  21140. - brcmf_fws_deinit(drvr);
  21141. - }
  21142. - if (drvr->iflist[0]) {
  21143. -- free_netdev(ifp->ndev);
  21144. -+ brcmf_net_detach(ifp->ndev);
  21145. - drvr->iflist[0] = NULL;
  21146. - }
  21147. - if (p2p_ifp) {
  21148. -- free_netdev(p2p_ifp->ndev);
  21149. -+ brcmf_net_detach(p2p_ifp->ndev);
  21150. - drvr->iflist[1] = NULL;
  21151. - }
  21152. - return ret;
  21153. 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
  21154. deleted file mode 100644
  21155. index 5a7e447..0000000
  21156. --- a/package/kernel/mac80211/patches/395-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  21157. +++ /dev/null
  21158. @@ -1,193 +0,0 @@
  21159. -From: Hante Meuleman <meuleman@broadcom.com>
  21160. -Date: Thu, 27 Aug 2015 16:14:06 +0200
  21161. -Subject: [PATCH] brcmfmac: Reset PCIE devices after recognition.
  21162. -
  21163. -When PCIE type devices are being FW reloaded without being properly
  21164. -reset then the device ends up in a locked state, requiring the
  21165. -device to be completely powered down. This patch adds a reset
  21166. -through watchdog at the moment the device (cores) has been
  21167. -recognized. This will solve warm reboot issues.
  21168. -
  21169. -Cc: Rafal Milecki <zajec5@gmail.com>
  21170. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  21171. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21172. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21173. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  21174. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21175. ----
  21176. -
  21177. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  21178. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  21179. -@@ -101,6 +101,9 @@
  21180. - /* ARM Cortex M3 core, ID 0x82a */
  21181. - #define BCM4329_CORE_ARM_BASE 0x18002000
  21182. -
  21183. -+/* Max possibly supported memory size (limited by IO mapped memory) */
  21184. -+#define BRCMF_CHIP_MAX_MEMSIZE (4 * 1024 * 1024)
  21185. -+
  21186. - #define CORE_SB(base, field) \
  21187. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  21188. - #define SBCOREREV(sbidh) \
  21189. -@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct
  21190. - brcmf_err("RAM size is undetermined\n");
  21191. - return -ENOMEM;
  21192. - }
  21193. -+
  21194. -+ if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
  21195. -+ brcmf_err("RAM size is incorrect\n");
  21196. -+ return -ENOMEM;
  21197. -+ }
  21198. -+
  21199. - return 0;
  21200. - }
  21201. -
  21202. -@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct
  21203. -
  21204. - /* assure chip is passive for core access */
  21205. - brcmf_chip_set_passive(&ci->pub);
  21206. -+
  21207. -+ /* Call bus specific reset function now. Cores have been determined
  21208. -+ * but further access may require a chip specific reset at this point.
  21209. -+ */
  21210. -+ if (ci->ops->reset) {
  21211. -+ ci->ops->reset(ci->ctx, &ci->pub);
  21212. -+ brcmf_chip_set_passive(&ci->pub);
  21213. -+ }
  21214. -+
  21215. - return brcmf_chip_get_raminfo(ci);
  21216. - }
  21217. -
  21218. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  21219. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  21220. -@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
  21221. - u32 (*read32)(void *ctx, u32 addr);
  21222. - void (*write32)(void *ctx, u32 addr, u32 value);
  21223. - int (*prepare)(void *ctx);
  21224. -+ int (*reset)(void *ctx, struct brcmf_chip *chip);
  21225. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  21226. - void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  21227. - };
  21228. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21229. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21230. -@@ -74,6 +74,8 @@ enum brcmf_pcie_state {
  21231. - #define BRCMF_PCIE_REG_INTMASK 0x94
  21232. - #define BRCMF_PCIE_REG_SBMBX 0x98
  21233. -
  21234. -+#define BRCMF_PCIE_REG_LINK_STATUS_CTRL 0xBC
  21235. -+
  21236. - #define BRCMF_PCIE_PCIE2REG_INTMASK 0x24
  21237. - #define BRCMF_PCIE_PCIE2REG_MAILBOXINT 0x48
  21238. - #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C
  21239. -@@ -466,6 +468,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
  21240. -
  21241. - static void brcmf_pcie_reset_device(struct brcmf_pciedev_info *devinfo)
  21242. - {
  21243. -+ struct brcmf_core *core;
  21244. - u16 cfg_offset[] = { BRCMF_PCIE_CFGREG_STATUS_CMD,
  21245. - BRCMF_PCIE_CFGREG_PM_CSR,
  21246. - BRCMF_PCIE_CFGREG_MSI_CAP,
  21247. -@@ -484,32 +487,38 @@ static void brcmf_pcie_reset_device(stru
  21248. - if (!devinfo->ci)
  21249. - return;
  21250. -
  21251. -+ /* Disable ASPM */
  21252. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21253. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21254. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  21255. -- lsc = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  21256. -+ pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  21257. -+ &lsc);
  21258. - val = lsc & (~BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB);
  21259. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, val);
  21260. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  21261. -+ val);
  21262. -
  21263. -+ /* Watchdog reset */
  21264. - brcmf_pcie_select_core(devinfo, BCMA_CORE_CHIPCOMMON);
  21265. - WRITECC32(devinfo, watchdog, 4);
  21266. - msleep(100);
  21267. -
  21268. -+ /* Restore ASPM */
  21269. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21270. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21271. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  21272. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, lsc);
  21273. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  21274. -+ lsc);
  21275. -
  21276. -- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21277. -- for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  21278. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21279. -- cfg_offset[i]);
  21280. -- val = brcmf_pcie_read_reg32(devinfo,
  21281. -- BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  21282. -- brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  21283. -- cfg_offset[i], val);
  21284. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  21285. -- val);
  21286. -+ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
  21287. -+ if (core->rev <= 13) {
  21288. -+ for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  21289. -+ brcmf_pcie_write_reg32(devinfo,
  21290. -+ BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21291. -+ cfg_offset[i]);
  21292. -+ val = brcmf_pcie_read_reg32(devinfo,
  21293. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  21294. -+ brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  21295. -+ cfg_offset[i], val);
  21296. -+ brcmf_pcie_write_reg32(devinfo,
  21297. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  21298. -+ val);
  21299. -+ }
  21300. - }
  21301. - }
  21302. -
  21303. -@@ -519,8 +528,6 @@ static void brcmf_pcie_attach(struct brc
  21304. - u32 config;
  21305. -
  21306. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21307. -- if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0)
  21308. -- brcmf_pcie_reset_device(devinfo);
  21309. - /* BAR1 window may not be sized properly */
  21310. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21311. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR, 0x4e0);
  21312. -@@ -1636,6 +1643,23 @@ static int brcmf_pcie_buscoreprep(void *
  21313. - }
  21314. -
  21315. -
  21316. -+static int brcmf_pcie_buscore_reset(void *ctx, struct brcmf_chip *chip)
  21317. -+{
  21318. -+ struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  21319. -+ u32 val;
  21320. -+
  21321. -+ devinfo->ci = chip;
  21322. -+ brcmf_pcie_reset_device(devinfo);
  21323. -+
  21324. -+ val = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  21325. -+ if (val != 0xffffffff)
  21326. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  21327. -+ val);
  21328. -+
  21329. -+ return 0;
  21330. -+}
  21331. -+
  21332. -+
  21333. - static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  21334. - u32 rstvec)
  21335. - {
  21336. -@@ -1647,6 +1671,7 @@ static void brcmf_pcie_buscore_activate(
  21337. -
  21338. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  21339. - .prepare = brcmf_pcie_buscoreprep,
  21340. -+ .reset = brcmf_pcie_buscore_reset,
  21341. - .activate = brcmf_pcie_buscore_activate,
  21342. - .read32 = brcmf_pcie_buscore_read32,
  21343. - .write32 = brcmf_pcie_buscore_write32,
  21344. -@@ -1814,7 +1839,6 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  21345. - brcmf_pcie_intr_disable(devinfo);
  21346. -
  21347. - brcmf_detach(&pdev->dev);
  21348. -- brcmf_pcie_reset_device(devinfo);
  21349. -
  21350. - kfree(bus->bus_priv.pcie);
  21351. - kfree(bus->msgbuf->flowrings);
  21352. 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
  21353. deleted file mode 100644
  21354. index f7b3e40..0000000
  21355. --- a/package/kernel/mac80211/patches/396-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  21356. +++ /dev/null
  21357. @@ -1,24 +0,0 @@
  21358. -From: Felix Fietkau <nbd@openwrt.org>
  21359. -Date: Sun, 13 Sep 2015 22:26:10 +0200
  21360. -Subject: [PATCH] ath10k: fix DMA related firmware crashes on multiple devices
  21361. -
  21362. -Some platforms really don't like DMA bursts of 256 bytes, and this
  21363. -causes the firmware to crash when sending beacons.
  21364. -Also, changing this based on the firmware version does not seem to make
  21365. -much sense, so use 128 bytes for all versions.
  21366. -
  21367. -Cc: stable@vger.kernel.org
  21368. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  21369. ----
  21370. -
  21371. ---- a/drivers/net/wireless/ath/ath10k/hw.h
  21372. -+++ b/drivers/net/wireless/ath/ath10k/hw.h
  21373. -@@ -253,7 +253,7 @@ struct ath10k_pktlog_hdr {
  21374. - #define TARGET_10X_MAX_FRAG_ENTRIES 0
  21375. -
  21376. - /* 10.2 parameters */
  21377. --#define TARGET_10_2_DMA_BURST_SIZE 1
  21378. -+#define TARGET_10_2_DMA_BURST_SIZE 0
  21379. -
  21380. - /* Target specific defines for WMI-TLV firmware */
  21381. - #define TARGET_TLV_NUM_VDEVS 3
  21382. 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
  21383. deleted file mode 100644
  21384. index c420d20..0000000
  21385. --- a/package/kernel/mac80211/patches/397-ath9k-declare-required-extra-tx-headroom.patch
  21386. +++ /dev/null
  21387. @@ -1,22 +0,0 @@
  21388. -From: Felix Fietkau <nbd@openwrt.org>
  21389. -Date: Thu, 24 Sep 2015 16:57:37 +0200
  21390. -Subject: [PATCH] ath9k: declare required extra tx headroom
  21391. -
  21392. -ath9k inserts padding between the 802.11 header and the data area (to
  21393. -align it). Since it didn't declare this extra required headroom, this
  21394. -led to some nasty issues like randomly dropped packets in some setups.
  21395. -
  21396. -Cc: stable@vger.kernel.org
  21397. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  21398. ----
  21399. -
  21400. ---- a/drivers/net/wireless/ath/ath9k/init.c
  21401. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  21402. -@@ -867,6 +867,7 @@ static void ath9k_set_hw_capab(struct at
  21403. - hw->max_rate_tries = 10;
  21404. - hw->sta_data_size = sizeof(struct ath_node);
  21405. - hw->vif_data_size = sizeof(struct ath_vif);
  21406. -+ hw->extra_tx_headroom = 4;
  21407. -
  21408. - hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  21409. - hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
  21410. 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
  21411. deleted file mode 100644
  21412. index 1478efa..0000000
  21413. --- a/package/kernel/mac80211/patches/398-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  21414. +++ /dev/null
  21415. @@ -1,21 +0,0 @@
  21416. -From: Felix Fietkau <nbd@openwrt.org>
  21417. -Date: Mon, 5 Oct 2015 17:41:25 +0200
  21418. -Subject: [PATCH] mac80211: initialize tid field in struct ieee80211_txq
  21419. -
  21420. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  21421. ----
  21422. -
  21423. ---- a/net/mac80211/util.c
  21424. -+++ b/net/mac80211/util.c
  21425. -@@ -3323,9 +3323,11 @@ void ieee80211_init_tx_queue(struct ieee
  21426. - if (sta) {
  21427. - txqi->txq.sta = &sta->sta;
  21428. - sta->sta.txq[tid] = &txqi->txq;
  21429. -+ txqi->txq.tid = tid;
  21430. - txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  21431. - } else {
  21432. - sdata->vif.txq = &txqi->txq;
  21433. -+ txqi->txq.tid = 0;
  21434. - txqi->txq.ac = IEEE80211_AC_BE;
  21435. - }
  21436. - }
  21437. diff --git a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  21438. index 298f722..72e9a41 100644
  21439. --- a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  21440. +++ b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  21441. @@ -14,7 +14,7 @@
  21442. ccflags-y += -D__CHECK_ENDIAN__
  21443. --- a/drivers/net/wireless/ath/ath.h
  21444. +++ b/drivers/net/wireless/ath/ath.h
  21445. -@@ -316,13 +316,6 @@ void _ath_dbg(struct ath_common *common,
  21446. +@@ -318,13 +318,6 @@ void _ath_dbg(struct ath_common *common,
  21447. #endif /* CPTCFG_ATH_DEBUG */
  21448. /** Returns string describing opmode, or NULL if unknown mode. */
  21449. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  21450. index 2dac505..f918c18 100644
  21451. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  21452. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  21453. @@ -59,7 +59,7 @@
  21454. ---help---
  21455. --- a/.local-symbols
  21456. +++ b/.local-symbols
  21457. -@@ -89,6 +89,7 @@ RTL8187_LEDS=
  21458. +@@ -137,6 +137,7 @@ RTL8187_LEDS=
  21459. ATH_COMMON=
  21460. ATH_CARDS=
  21461. ATH_DEBUG=
  21462. diff --git a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  21463. index 1476953..8b52ac3 100644
  21464. --- a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  21465. +++ b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  21466. @@ -1,6 +1,6 @@
  21467. --- a/net/wireless/reg.c
  21468. +++ b/net/wireless/reg.c
  21469. -@@ -2368,6 +2368,8 @@ void regulatory_hint_country_ie(struct w
  21470. +@@ -2390,6 +2390,8 @@ void regulatory_hint_country_ie(struct w
  21471. enum environment_cap env = ENVIRON_ANY;
  21472. struct regulatory_request *request = NULL, *lr;
  21473. @@ -9,7 +9,7 @@
  21474. /* IE len must be evenly divisible by 2 */
  21475. if (country_ie_len & 0x01)
  21476. return;
  21477. -@@ -2571,6 +2573,7 @@ static void restore_regulatory_settings(
  21478. +@@ -2596,6 +2598,7 @@ static void restore_regulatory_settings(
  21479. void regulatory_hint_disconnect(void)
  21480. {
  21481. 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
  21482. index 93760f9..1a62484 100644
  21483. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  21484. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  21485. @@ -1,6 +1,6 @@
  21486. --- a/drivers/net/wireless/ath/ath9k/init.c
  21487. +++ b/drivers/net/wireless/ath/ath9k/init.c
  21488. -@@ -715,6 +715,7 @@ static const struct ieee80211_iface_limi
  21489. +@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  21490. BIT(NL80211_IFTYPE_AP) },
  21491. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  21492. BIT(NL80211_IFTYPE_P2P_GO) },
  21493. diff --git a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  21494. index aa521d2..42d43a4 100644
  21495. --- a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  21496. +++ b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  21497. @@ -121,7 +121,7 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++
  21498. debugfs_create_file("antenna", S_IWUSR | S_IRUSR, phydir, ah,
  21499. --- a/drivers/net/wireless/ath/ath5k/ath5k.h
  21500. +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  21501. -@@ -1371,6 +1371,7 @@ struct ath5k_hw {
  21502. +@@ -1370,6 +1370,7 @@ struct ath5k_hw {
  21503. u8 ah_coverage_class;
  21504. bool ah_ack_bitrate_high;
  21505. u8 ah_bwmode;
  21506. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  21507. index 5892c3e..5a3e37c 100644
  21508. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  21509. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  21510. @@ -1,6 +1,6 @@
  21511. --- a/drivers/net/wireless/ath/ath9k/init.c
  21512. +++ b/drivers/net/wireless/ath/ath9k/init.c
  21513. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  21514. +@@ -1032,23 +1032,23 @@ static int __init ath9k_init(void)
  21515. {
  21516. int error;
  21517. diff --git a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  21518. index ed2cfee..d2a3b96 100644
  21519. --- a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  21520. +++ b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  21521. @@ -1,6 +1,6 @@
  21522. --- a/drivers/net/wireless/ath/ath9k/hw.c
  21523. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  21524. -@@ -389,13 +389,8 @@ static void ath9k_hw_init_config(struct
  21525. +@@ -390,13 +390,8 @@ static void ath9k_hw_init_config(struct
  21526. ah->config.rx_intr_mitigation = true;
  21527. @@ -14,5 +14,5 @@
  21528. + ah->config.rimt_last = 250;
  21529. + ah->config.rimt_first = 500;
  21530. - /*
  21531. - * We need this for PCI devices only (Cardbus, PCI, miniPCI)
  21532. + if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
  21533. + ah->config.pll_pwrsave = 7;
  21534. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  21535. index d4104f0..6766111 100644
  21536. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  21537. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  21538. @@ -1,6 +1,6 @@
  21539. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  21540. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  21541. -@@ -87,7 +87,7 @@ int ath_descdma_setup(struct ath_softc *
  21542. +@@ -88,7 +88,7 @@ int ath_descdma_setup(struct ath_softc *
  21543. (_l) &= ((_sz) - 1); \
  21544. } while (0)
  21545. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  21546. index 40b5c81..c84d1bc 100644
  21547. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  21548. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  21549. @@ -1,6 +1,6 @@
  21550. --- a/drivers/net/wireless/ath/ath9k/hw.c
  21551. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  21552. -@@ -647,6 +647,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  21553. +@@ -651,6 +651,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  21554. /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */
  21555. switch (ah->hw_version.devid) {
  21556. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  21557. index 0c50a0b..99bf7e8 100644
  21558. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  21559. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  21560. @@ -18,7 +18,7 @@
  21561. const u8 *addr);
  21562. --- a/include/net/mac80211.h
  21563. +++ b/include/net/mac80211.h
  21564. -@@ -1171,6 +1171,7 @@ enum ieee80211_smps_mode {
  21565. +@@ -1252,6 +1252,7 @@ enum ieee80211_smps_mode {
  21566. *
  21567. * @power_level: requested transmit power (in dBm), backward compatibility
  21568. * value only that is set to the minimum of all interfaces
  21569. @@ -26,7 +26,7 @@
  21570. *
  21571. * @chandef: the channel definition to tune to
  21572. * @radar_enabled: whether radar detection is enabled
  21573. -@@ -1192,6 +1193,7 @@ struct ieee80211_conf {
  21574. +@@ -1273,6 +1274,7 @@ struct ieee80211_conf {
  21575. u32 flags;
  21576. int power_level, dynamic_ps_timeout;
  21577. int max_sleep_period;
  21578. @@ -36,7 +36,7 @@
  21579. u8 ps_dtim_period;
  21580. --- a/include/uapi/linux/nl80211.h
  21581. +++ b/include/uapi/linux/nl80211.h
  21582. -@@ -1760,6 +1760,9 @@ enum nl80211_commands {
  21583. +@@ -1761,6 +1761,9 @@ enum nl80211_commands {
  21584. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  21585. * is operating in an indoor environment.
  21586. *
  21587. @@ -46,7 +46,7 @@
  21588. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  21589. * @NL80211_ATTR_MAX: highest attribute number currently defined
  21590. * @__NL80211_ATTR_AFTER_LAST: internal use
  21591. -@@ -2129,6 +2132,8 @@ enum nl80211_attrs {
  21592. +@@ -2130,6 +2133,8 @@ enum nl80211_attrs {
  21593. NL80211_ATTR_REG_INDOOR,
  21594. @@ -57,7 +57,7 @@
  21595. __NL80211_ATTR_AFTER_LAST,
  21596. --- a/net/mac80211/cfg.c
  21597. +++ b/net/mac80211/cfg.c
  21598. -@@ -2208,6 +2208,19 @@ static int ieee80211_get_tx_power(struct
  21599. +@@ -2233,6 +2233,19 @@ static int ieee80211_get_tx_power(struct
  21600. return 0;
  21601. }
  21602. @@ -77,7 +77,7 @@
  21603. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  21604. const u8 *addr)
  21605. {
  21606. -@@ -3771,6 +3784,7 @@ const struct cfg80211_ops mac80211_confi
  21607. +@@ -3845,6 +3858,7 @@ const struct cfg80211_ops mac80211_confi
  21608. .set_wiphy_params = ieee80211_set_wiphy_params,
  21609. .set_tx_power = ieee80211_set_tx_power,
  21610. .get_tx_power = ieee80211_get_tx_power,
  21611. @@ -87,7 +87,7 @@
  21612. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  21613. --- a/net/mac80211/ieee80211_i.h
  21614. +++ b/net/mac80211/ieee80211_i.h
  21615. -@@ -1333,6 +1333,7 @@ struct ieee80211_local {
  21616. +@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  21617. int dynamic_ps_forced_timeout;
  21618. int user_power_level; /* in dBm, for all interfaces */
  21619. @@ -97,7 +97,7 @@
  21620. --- a/net/mac80211/main.c
  21621. +++ b/net/mac80211/main.c
  21622. -@@ -98,7 +98,7 @@ static u32 ieee80211_hw_conf_chan(struct
  21623. +@@ -95,7 +95,7 @@ static u32 ieee80211_hw_conf_chan(struct
  21624. struct ieee80211_sub_if_data *sdata;
  21625. struct cfg80211_chan_def chandef = {};
  21626. u32 changed = 0;
  21627. @@ -106,7 +106,7 @@
  21628. u32 offchannel_flag;
  21629. offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
  21630. -@@ -155,6 +155,12 @@ static u32 ieee80211_hw_conf_chan(struct
  21631. +@@ -152,6 +152,12 @@ static u32 ieee80211_hw_conf_chan(struct
  21632. }
  21633. rcu_read_unlock();
  21634. @@ -119,7 +119,7 @@
  21635. if (local->hw.conf.power_level != power) {
  21636. changed |= IEEE80211_CONF_CHANGE_POWER;
  21637. local->hw.conf.power_level = power;
  21638. -@@ -578,6 +584,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  21639. +@@ -581,6 +587,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  21640. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  21641. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  21642. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  21643. @@ -129,7 +129,7 @@
  21644. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  21645. --- a/net/wireless/nl80211.c
  21646. +++ b/net/wireless/nl80211.c
  21647. -@@ -400,6 +400,7 @@ static const struct nla_policy nl80211_p
  21648. +@@ -402,6 +402,7 @@ static const struct nla_policy nl80211_p
  21649. [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  21650. [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  21651. [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  21652. @@ -137,7 +137,7 @@
  21653. };
  21654. /* policy for the key attributes */
  21655. -@@ -2206,6 +2207,20 @@ static int nl80211_set_wiphy(struct sk_b
  21656. +@@ -2207,6 +2208,20 @@ static int nl80211_set_wiphy(struct sk_b
  21657. if (result)
  21658. return result;
  21659. }
  21660. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  21661. index 7512811..3cfffa0 100644
  21662. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  21663. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  21664. @@ -1,6 +1,6 @@
  21665. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  21666. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  21667. -@@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  21668. +@@ -806,6 +806,9 @@ static inline int ath9k_dump_btcoex(stru
  21669. void ath_init_leds(struct ath_softc *sc);
  21670. void ath_deinit_leds(struct ath_softc *sc);
  21671. void ath_fill_led_pin(struct ath_softc *sc);
  21672. @@ -10,7 +10,7 @@
  21673. #else
  21674. static inline void ath_init_leds(struct ath_softc *sc)
  21675. {
  21676. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  21677. +@@ -945,6 +948,13 @@ void ath_ant_comb_scan(struct ath_softc
  21678. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  21679. @@ -24,7 +24,7 @@
  21680. struct ath_softc {
  21681. struct ieee80211_hw *hw;
  21682. struct device *dev;
  21683. -@@ -1004,9 +1014,8 @@ struct ath_softc {
  21684. +@@ -996,9 +1006,8 @@ struct ath_softc {
  21685. spinlock_t chan_lock;
  21686. #ifdef CPTCFG_MAC80211_LEDS
  21687. @@ -165,7 +165,7 @@
  21688. void ath_fill_led_pin(struct ath_softc *sc)
  21689. --- a/drivers/net/wireless/ath/ath9k/init.c
  21690. +++ b/drivers/net/wireless/ath/ath9k/init.c
  21691. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  21692. +@@ -944,7 +944,7 @@ int ath9k_init_device(u16 devid, struct
  21693. #ifdef CPTCFG_MAC80211_LEDS
  21694. /* must be initialized before ieee80211_register_hw */
  21695. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  21696. index 08c5a0f..2b2c763 100644
  21697. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  21698. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  21699. @@ -62,7 +62,7 @@
  21700. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  21701. --- a/drivers/net/wireless/ath/ath9k/hw.h
  21702. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  21703. -@@ -513,6 +513,12 @@ enum {
  21704. +@@ -519,6 +519,12 @@ enum {
  21705. ATH9K_RESET_COLD,
  21706. };
  21707. @@ -75,7 +75,7 @@
  21708. struct ath9k_hw_version {
  21709. u32 magic;
  21710. u16 devid;
  21711. -@@ -794,6 +800,8 @@ struct ath_hw {
  21712. +@@ -804,6 +810,8 @@ struct ath_hw {
  21713. u32 rfkill_polarity;
  21714. u32 ah_flags;
  21715. @@ -84,7 +84,7 @@
  21716. bool reset_power_on;
  21717. bool htc_reset_init;
  21718. -@@ -1055,6 +1063,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  21719. +@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  21720. bool ath9k_hw_check_alive(struct ath_hw *ah);
  21721. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  21722. @@ -94,7 +94,7 @@
  21723. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  21724. --- a/drivers/net/wireless/ath/ath9k/hw.c
  21725. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  21726. -@@ -1804,6 +1804,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  21727. +@@ -1808,6 +1808,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  21728. }
  21729. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  21730. @@ -115,7 +115,7 @@
  21731. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  21732. struct ath9k_hw_cal_data *caldata, bool fastcc)
  21733. {
  21734. -@@ -2012,6 +2026,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21735. +@@ -2016,6 +2030,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21736. ar9003_hw_disable_phy_restart(ah);
  21737. ath9k_hw_apply_gpio_override(ah);
  21738. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  21739. index 8c9b34c..fddaf56 100644
  21740. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  21741. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  21742. @@ -1,6 +1,6 @@
  21743. --- a/drivers/net/wireless/ath/ath9k/hw.h
  21744. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  21745. -@@ -710,6 +710,7 @@ struct ath_spec_scan {
  21746. +@@ -720,6 +720,7 @@ struct ath_spec_scan {
  21747. * @config_pci_powersave:
  21748. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  21749. *
  21750. @@ -8,7 +8,7 @@
  21751. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  21752. * @spectral_scan_trigger: trigger a spectral scan run
  21753. * @spectral_scan_wait: wait for a spectral scan run to finish
  21754. -@@ -732,6 +733,7 @@ struct ath_hw_ops {
  21755. +@@ -742,6 +743,7 @@ struct ath_hw_ops {
  21756. struct ath_hw_antcomb_conf *antconf);
  21757. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  21758. struct ath_hw_antcomb_conf *antconf);
  21759. @@ -55,7 +55,7 @@
  21760. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  21761. --- a/drivers/net/wireless/ath/ath9k/init.c
  21762. +++ b/drivers/net/wireless/ath/ath9k/init.c
  21763. -@@ -703,7 +703,8 @@ static void ath9k_init_txpower_limits(st
  21764. +@@ -710,7 +710,8 @@ static void ath9k_init_txpower_limits(st
  21765. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  21766. ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  21767. @@ -65,7 +65,7 @@
  21768. }
  21769. static const struct ieee80211_iface_limit if_limits[] = {
  21770. -@@ -896,6 +897,18 @@ static void ath9k_set_hw_capab(struct at
  21771. +@@ -904,6 +905,18 @@ static void ath9k_set_hw_capab(struct at
  21772. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  21773. }
  21774. @@ -84,7 +84,7 @@
  21775. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  21776. const struct ath_bus_ops *bus_ops)
  21777. {
  21778. -@@ -941,6 +954,8 @@ int ath9k_init_device(u16 devid, struct
  21779. +@@ -949,6 +962,8 @@ int ath9k_init_device(u16 devid, struct
  21780. ARRAY_SIZE(ath9k_tpt_blink));
  21781. #endif
  21782. @@ -110,7 +110,7 @@
  21783. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  21784. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21785. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21786. -@@ -1316,9 +1316,30 @@ void ar5008_hw_init_rate_txpower(struct
  21787. +@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  21788. }
  21789. }
  21790. @@ -141,7 +141,7 @@
  21791. static const u32 ar5416_cca_regs[6] = {
  21792. AR_PHY_CCA,
  21793. AR_PHY_CH1_CCA,
  21794. -@@ -1333,6 +1354,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  21795. +@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  21796. if (ret)
  21797. return ret;
  21798. 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
  21799. index 240b898..6ca642a 100644
  21800. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  21801. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  21802. @@ -1,6 +1,6 @@
  21803. --- a/drivers/net/wireless/ath/ath9k/hw.c
  21804. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  21805. -@@ -245,6 +245,19 @@ void ath9k_hw_get_channel_centers(struct
  21806. +@@ -246,6 +246,19 @@ void ath9k_hw_get_channel_centers(struct
  21807. centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT);
  21808. }
  21809. @@ -20,7 +20,7 @@
  21810. /******************/
  21811. /* Chip Revisions */
  21812. /******************/
  21813. -@@ -1382,6 +1395,9 @@ static bool ath9k_hw_set_reset(struct at
  21814. +@@ -1386,6 +1399,9 @@ static bool ath9k_hw_set_reset(struct at
  21815. if (AR_SREV_9100(ah))
  21816. udelay(50);
  21817. @@ -30,7 +30,7 @@
  21818. return true;
  21819. }
  21820. -@@ -1481,6 +1497,9 @@ static bool ath9k_hw_chip_reset(struct a
  21821. +@@ -1485,6 +1501,9 @@ static bool ath9k_hw_chip_reset(struct a
  21822. ar9003_hw_internal_regulator_apply(ah);
  21823. ath9k_hw_init_pll(ah, chan);
  21824. @@ -40,7 +40,7 @@
  21825. return true;
  21826. }
  21827. -@@ -1782,8 +1801,14 @@ static int ath9k_hw_do_fastcc(struct ath
  21828. +@@ -1786,8 +1805,14 @@ static int ath9k_hw_do_fastcc(struct ath
  21829. if (AR_SREV_9271(ah))
  21830. ar9002_hw_load_ani_reg(ah, chan);
  21831. @@ -55,7 +55,7 @@
  21832. return -EINVAL;
  21833. }
  21834. -@@ -2037,6 +2062,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21835. +@@ -2041,6 +2066,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21836. ath9k_hw_set_radar_params(ah);
  21837. }
  21838. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  21839. index 9610372..bc0aca6 100644
  21840. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  21841. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  21842. @@ -1,6 +1,6 @@
  21843. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21844. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21845. -@@ -945,55 +945,6 @@ static bool ar5008_hw_ani_control_new(st
  21846. +@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  21847. * on == 0 means more noise imm
  21848. */
  21849. u32 on = param ? 1 : 0;
  21850. 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
  21851. index c0dc4fe..15863a6 100644
  21852. --- a/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  21853. +++ b/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  21854. @@ -20,32 +20,14 @@ Changes since v1: ---
  21855. drivers/net/wireless/rt2x00/rt2800lib.h | 11 +++++++++++
  21856. 2 files changed, 11 insertions(+), 13 deletions(-)
  21857. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  21858. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  21859. -@@ -2960,17 +2960,4 @@ enum rt2800_eeprom_word {
  21860. - */
  21861. - #define BCN_TBTT_OFFSET 64
  21862. -
  21863. --/*
  21864. -- * RT2800 driver data structure
  21865. -- */
  21866. --struct rt2800_drv_data {
  21867. -- u8 calibration_bw20;
  21868. -- u8 calibration_bw40;
  21869. -- u8 bbp25;
  21870. -- u8 bbp26;
  21871. -- u8 txmixer_gain_24g;
  21872. -- u8 txmixer_gain_5g;
  21873. -- unsigned int tbtt_tick;
  21874. --};
  21875. --
  21876. - #endif /* RT2800_H */
  21877. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  21878. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  21879. -@@ -20,6 +20,17 @@
  21880. +@@ -20,6 +20,20 @@
  21881. #ifndef RT2800LIB_H
  21882. #define RT2800LIB_H
  21883. ++#include "rt2800.h"
  21884. ++
  21885. +/* RT2800 driver data structure */
  21886. +struct rt2800_drv_data {
  21887. + u8 calibration_bw20;
  21888. @@ -55,8 +37,30 @@ Changes since v1: ---
  21889. + u8 txmixer_gain_24g;
  21890. + u8 txmixer_gain_5g;
  21891. + unsigned int tbtt_tick;
  21892. ++ DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  21893. +};
  21894. +
  21895. struct rt2800_ops {
  21896. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  21897. const unsigned int offset, u32 *value);
  21898. +--- a/drivers/net/wireless/rt2x00/rt2800.h
  21899. ++++ b/drivers/net/wireless/rt2x00/rt2800.h
  21900. +@@ -2969,18 +2969,4 @@ enum rt2800_eeprom_word {
  21901. + #define WCID_END 222
  21902. + #define STA_IDS_SIZE (WCID_END - WCID_START + 2)
  21903. +
  21904. +-/*
  21905. +- * RT2800 driver data structure
  21906. +- */
  21907. +-struct rt2800_drv_data {
  21908. +- u8 calibration_bw20;
  21909. +- u8 calibration_bw40;
  21910. +- u8 bbp25;
  21911. +- u8 bbp26;
  21912. +- u8 txmixer_gain_24g;
  21913. +- u8 txmixer_gain_5g;
  21914. +- unsigned int tbtt_tick;
  21915. +- DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  21916. +-};
  21917. +-
  21918. + #endif /* RT2800_H */
  21919. 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
  21920. index 6bad6ac..9165eec 100644
  21921. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  21922. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  21923. @@ -24,7 +24,7 @@ Changes since v1:
  21924. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  21925. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  21926. -@@ -7747,6 +7747,7 @@ static int rt2800_probe_rt(struct rt2x00
  21927. +@@ -7721,6 +7721,7 @@ static int rt2800_probe_rt(struct rt2x00
  21928. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  21929. {
  21930. @@ -32,7 +32,7 @@ Changes since v1:
  21931. int retval;
  21932. u32 reg;
  21933. -@@ -7754,6 +7755,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21934. +@@ -7728,6 +7729,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21935. if (retval)
  21936. return retval;
  21937. @@ -44,9 +44,9 @@ Changes since v1:
  21938. */
  21939. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  21940. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  21941. -@@ -20,6 +20,10 @@
  21942. - #ifndef RT2800LIB_H
  21943. - #define RT2800LIB_H
  21944. +@@ -22,6 +22,10 @@
  21945. +
  21946. + #include "rt2800.h"
  21947. +enum rt2800_flag {
  21948. + RT2800_HAS_HIGH_SHARED_MEM,
  21949. @@ -55,16 +55,16 @@ Changes since v1:
  21950. /* RT2800 driver data structure */
  21951. struct rt2800_drv_data {
  21952. u8 calibration_bw20;
  21953. -@@ -29,6 +33,8 @@ struct rt2800_drv_data {
  21954. - u8 txmixer_gain_24g;
  21955. +@@ -32,6 +36,8 @@ struct rt2800_drv_data {
  21956. u8 txmixer_gain_5g;
  21957. unsigned int tbtt_tick;
  21958. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  21959. +
  21960. + unsigned long rt2800_flags;
  21961. };
  21962. struct rt2800_ops {
  21963. -@@ -61,6 +67,13 @@ struct rt2800_ops {
  21964. +@@ -64,6 +70,13 @@ struct rt2800_ops {
  21965. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  21966. };
  21967. 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
  21968. index 9f8dfcc..5671515 100644
  21969. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  21970. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  21971. @@ -175,7 +175,7 @@ Changes since v1: ---
  21972. /*
  21973. * Update WCID information
  21974. -@@ -1437,8 +1467,11 @@ int rt2800_config_pairwise_key(struct rt
  21975. +@@ -1405,8 +1435,11 @@ int rt2800_config_pairwise_key(struct rt
  21976. sizeof(key_entry.rx_mic));
  21977. offset = PAIRWISE_KEY_ENTRY(key->hw_key_idx);
  21978. @@ -187,7 +187,7 @@ Changes since v1: ---
  21979. }
  21980. /*
  21981. -@@ -4908,14 +4941,19 @@ static int rt2800_init_registers(struct
  21982. +@@ -4884,14 +4917,19 @@ static int rt2800_init_registers(struct
  21983. /*
  21984. * ASIC will keep garbage value after boot, clear encryption keys.
  21985. */
  21986. @@ -207,7 +207,7 @@ Changes since v1: ---
  21987. }
  21988. /*
  21989. -@@ -5041,8 +5079,10 @@ static int rt2800_wait_bbp_ready(struct
  21990. +@@ -5017,8 +5055,10 @@ static int rt2800_wait_bbp_ready(struct
  21991. * BBP was enabled after firmware was loaded,
  21992. * but we need to reactivate it now.
  21993. */
  21994. @@ -218,7 +218,7 @@ Changes since v1: ---
  21995. msleep(1);
  21996. for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
  21997. -@@ -6738,11 +6778,19 @@ int rt2800_enable_radio(struct rt2x00_de
  21998. +@@ -6714,11 +6754,19 @@ int rt2800_enable_radio(struct rt2x00_de
  21999. /*
  22000. * Send signal during boot time to initialize firmware.
  22001. */
  22002. @@ -239,7 +239,7 @@ Changes since v1: ---
  22003. msleep(1);
  22004. /*
  22005. -@@ -7751,6 +7799,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22006. +@@ -7725,6 +7773,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22007. int retval;
  22008. u32 reg;
  22009. @@ -248,22 +248,22 @@ Changes since v1: ---
  22010. retval = rt2800_probe_rt(rt2x00dev);
  22011. if (retval)
  22012. return retval;
  22013. -@@ -7830,8 +7880,11 @@ void rt2800_get_tkip_seq(struct ieee8021
  22014. - u32 offset;
  22015. +@@ -7808,8 +7858,11 @@ void rt2800_get_key_seq(struct ieee80211
  22016. + return;
  22017. - offset = MAC_IVEIV_ENTRY(hw_key_idx);
  22018. + offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  22019. +
  22020. + rt2800_shared_mem_lock(rt2x00dev);
  22021. rt2800_register_multiread(rt2x00dev, offset,
  22022. &iveiv_entry, sizeof(iveiv_entry));
  22023. + rt2800_shared_mem_unlock(rt2x00dev);
  22024. - memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16));
  22025. - memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32));
  22026. + memcpy(&seq->tkip.iv16, &iveiv_entry.iv[0], 2);
  22027. + memcpy(&seq->tkip.iv32, &iveiv_entry.iv[4], 4);
  22028. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  22029. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  22030. -@@ -35,6 +35,11 @@ struct rt2800_drv_data {
  22031. - unsigned int tbtt_tick;
  22032. +@@ -38,6 +38,11 @@ struct rt2800_drv_data {
  22033. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  22034. unsigned long rt2800_flags;
  22035. +
  22036. @@ -274,7 +274,7 @@ Changes since v1: ---
  22037. };
  22038. struct rt2800_ops {
  22039. -@@ -65,6 +70,10 @@ struct rt2800_ops {
  22040. +@@ -68,6 +73,10 @@ struct rt2800_ops {
  22041. const u8 *data, const size_t len);
  22042. int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
  22043. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  22044. @@ -285,7 +285,7 @@ Changes since v1: ---
  22045. };
  22046. static inline bool rt2800_has_high_shared_mem(struct rt2x00_dev *rt2x00dev)
  22047. -@@ -74,6 +83,29 @@ static inline bool rt2800_has_high_share
  22048. +@@ -77,6 +86,29 @@ static inline bool rt2800_has_high_share
  22049. return test_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  22050. }
  22051. @@ -486,7 +486,7 @@ Changes since v1: ---
  22052. /*
  22053. * Queue handlers.
  22054. */
  22055. -@@ -294,8 +315,10 @@ static int rt2800usb_write_firmware(stru
  22056. +@@ -299,8 +320,10 @@ static int rt2800usb_write_firmware(stru
  22057. data + offset, length);
  22058. }
  22059. @@ -497,7 +497,7 @@ Changes since v1: ---
  22060. /*
  22061. * Send firmware request to device to load firmware,
  22062. -@@ -310,7 +333,10 @@ static int rt2800usb_write_firmware(stru
  22063. +@@ -315,7 +338,10 @@ static int rt2800usb_write_firmware(stru
  22064. }
  22065. msleep(10);
  22066. @@ -508,7 +508,7 @@ Changes since v1: ---
  22067. return 0;
  22068. }
  22069. -@@ -328,8 +354,10 @@ static int rt2800usb_init_registers(stru
  22070. +@@ -333,8 +359,10 @@ static int rt2800usb_init_registers(stru
  22071. if (rt2800_wait_csr_ready(rt2x00dev))
  22072. return -EBUSY;
  22073. @@ -519,7 +519,7 @@ Changes since v1: ---
  22074. reg = 0;
  22075. rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
  22076. -@@ -859,6 +887,9 @@ static const struct rt2800_ops rt2800usb
  22077. +@@ -863,6 +891,9 @@ static const struct rt2800_ops rt2800usb
  22078. .drv_write_firmware = rt2800usb_write_firmware,
  22079. .drv_init_registers = rt2800usb_init_registers,
  22080. .drv_get_txwi = rt2800usb_get_txwi,
  22081. 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
  22082. index e7eb630..d04998a 100644
  22083. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  22084. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  22085. @@ -24,7 +24,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22086. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22087. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22088. -@@ -4638,6 +4638,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  22089. +@@ -4614,6 +4614,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  22090. */
  22091. static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
  22092. {
  22093. @@ -32,7 +32,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22094. u32 reg;
  22095. u16 eeprom;
  22096. unsigned int i;
  22097. -@@ -5003,7 +5004,7 @@ static int rt2800_init_registers(struct
  22098. +@@ -4979,7 +4980,7 @@ static int rt2800_init_registers(struct
  22099. /*
  22100. * Clear all beacons
  22101. */
  22102. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22103. rt2800_clear_beacon_register(rt2x00dev, i);
  22104. if (rt2x00_is_usb(rt2x00dev)) {
  22105. -@@ -7852,6 +7853,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22106. +@@ -7826,6 +7827,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22107. if (rt2x00_rt(rt2x00dev, RT3593))
  22108. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  22109. @@ -52,11 +52,11 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22110. */
  22111. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  22112. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  22113. -@@ -33,6 +33,7 @@ struct rt2800_drv_data {
  22114. +@@ -35,6 +35,7 @@ struct rt2800_drv_data {
  22115. u8 txmixer_gain_24g;
  22116. u8 txmixer_gain_5g;
  22117. unsigned int tbtt_tick;
  22118. + unsigned int hw_beacon_count;
  22119. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  22120. unsigned long rt2800_flags;
  22121. -
  22122. 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
  22123. index b79b4be..f5231f0 100644
  22124. --- a/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  22125. +++ b/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  22126. @@ -34,7 +34,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22127. */
  22128. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22129. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22130. -@@ -4650,6 +4650,30 @@ static int rt2800_init_registers(struct
  22131. +@@ -4626,6 +4626,30 @@ static int rt2800_init_registers(struct
  22132. if (ret)
  22133. return ret;
  22134. 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
  22135. index 180c5e3..4b21eae 100644
  22136. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  22137. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  22138. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22139. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22140. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22141. -@@ -7877,7 +7877,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22142. +@@ -7851,7 +7851,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22143. if (rt2x00_rt(rt2x00dev, RT3593))
  22144. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  22145. 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
  22146. index 31aa34a..e77cd86 100644
  22147. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  22148. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  22149. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22150. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22151. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22152. -@@ -7847,6 +7847,7 @@ static int rt2800_probe_rt(struct rt2x00
  22153. +@@ -7821,6 +7821,7 @@ static int rt2800_probe_rt(struct rt2x00
  22154. case RT3390:
  22155. case RT3572:
  22156. case RT3593:
  22157. 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
  22158. index a90c590..780c1dd 100644
  22159. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  22160. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  22161. @@ -31,7 +31,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22162. #define RF5370 0x5370
  22163. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22164. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22165. -@@ -7465,6 +7465,66 @@ static const struct rf_channel rf_vals_3
  22166. +@@ -7441,6 +7441,66 @@ static const struct rf_channel rf_vals_3
  22167. {173, 0x61, 0, 9},
  22168. };
  22169. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22170. static const struct rf_channel rf_vals_5592_xtal20[] = {
  22171. /* Channel, N, K, mod, R */
  22172. {1, 482, 4, 10, 3},
  22173. -@@ -7694,6 +7754,11 @@ static int rt2800_probe_hw_mode(struct r
  22174. +@@ -7668,6 +7728,11 @@ static int rt2800_probe_hw_mode(struct r
  22175. spec->channels = rf_vals_3x;
  22176. break;
  22177. 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
  22178. index ab2673b..858dece 100644
  22179. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  22180. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  22181. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22182. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22183. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22184. -@@ -4402,6 +4402,7 @@ void rt2800_vco_calibration(struct rt2x0
  22185. +@@ -4378,6 +4378,7 @@ void rt2800_vco_calibration(struct rt2x0
  22186. case RF3053:
  22187. case RF3070:
  22188. case RF3290:
  22189. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22190. case RF5360:
  22191. case RF5362:
  22192. case RF5370:
  22193. -@@ -7873,6 +7874,7 @@ static int rt2800_probe_hw_mode(struct r
  22194. +@@ -7847,6 +7848,7 @@ static int rt2800_probe_hw_mode(struct r
  22195. case RF3053:
  22196. case RF3070:
  22197. case RF3290:
  22198. 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
  22199. index 05ed444..ed82e44 100644
  22200. --- a/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  22201. +++ b/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  22202. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22203. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22204. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22205. -@@ -2649,6 +2649,211 @@ static void rt2800_config_channel_rf3053
  22206. +@@ -2625,6 +2625,211 @@ static void rt2800_config_channel_rf3053
  22207. }
  22208. }
  22209. @@ -223,7 +223,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22210. #define POWER_BOUND 0x27
  22211. #define POWER_BOUND_5G 0x2b
  22212. -@@ -3261,6 +3466,9 @@ static void rt2800_config_channel(struct
  22213. +@@ -3237,6 +3442,9 @@ static void rt2800_config_channel(struct
  22214. case RF3322:
  22215. rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
  22216. break;
  22217. 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
  22218. index 3b50775..33cbc4c 100644
  22219. --- a/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  22220. +++ b/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  22221. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22222. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22223. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22224. -@@ -7430,6 +7430,7 @@ static int rt2800_init_eeprom(struct rt2
  22225. +@@ -7406,6 +7406,7 @@ static int rt2800_init_eeprom(struct rt2
  22226. case RF3290:
  22227. case RF3320:
  22228. case RF3322:
  22229. 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
  22230. index 4dfb068..c3a4798 100644
  22231. --- a/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  22232. +++ b/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  22233. @@ -35,7 +35,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22234. #define RX_FILTER_CFG 0x1400
  22235. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22236. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22237. -@@ -5005,6 +5005,12 @@ static int rt2800_init_registers(struct
  22238. +@@ -4981,6 +4981,12 @@ static int rt2800_init_registers(struct
  22239. rt2800_register_write(rt2x00dev, TX_SW_CFG2,
  22240. 0x00000000);
  22241. }
  22242. @@ -48,7 +48,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22243. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  22244. rt2x00_rt(rt2x00dev, RT5392) ||
  22245. rt2x00_rt(rt2x00dev, RT5592)) {
  22246. -@@ -5035,9 +5041,11 @@ static int rt2800_init_registers(struct
  22247. +@@ -5011,9 +5017,11 @@ static int rt2800_init_registers(struct
  22248. rt2800_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
  22249. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
  22250. @@ -63,7 +63,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22251. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
  22252. else
  22253. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
  22254. -@@ -5190,6 +5198,11 @@ static int rt2800_init_registers(struct
  22255. +@@ -5166,6 +5174,11 @@ static int rt2800_init_registers(struct
  22256. reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002;
  22257. rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);
  22258. 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
  22259. index 6663b78..e647777 100644
  22260. --- a/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  22261. +++ b/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  22262. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22263. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22264. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22265. -@@ -5808,6 +5808,47 @@ static void rt2800_init_bbp_3593(struct
  22266. +@@ -5784,6 +5784,47 @@ static void rt2800_init_bbp_3593(struct
  22267. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  22268. }
  22269. @@ -59,7 +59,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22270. static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev)
  22271. {
  22272. int ant, div_mode;
  22273. -@@ -6026,6 +6067,9 @@ static void rt2800_init_bbp(struct rt2x0
  22274. +@@ -6002,6 +6043,9 @@ static void rt2800_init_bbp(struct rt2x0
  22275. case RT3593:
  22276. rt2800_init_bbp_3593(rt2x00dev);
  22277. return;
  22278. 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
  22279. index 6e66f14..0fec3cd 100644
  22280. --- a/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  22281. +++ b/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  22282. @@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22283. /*
  22284. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22285. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22286. -@@ -6843,6 +6843,144 @@ static void rt2800_init_rfcsr_3593(struc
  22287. +@@ -6819,6 +6819,144 @@ static void rt2800_init_rfcsr_3593(struc
  22288. /* TODO: enable stream mode support */
  22289. }
  22290. @@ -166,7 +166,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22291. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  22292. {
  22293. rt2800_rf_init_calibration(rt2x00dev, 2);
  22294. -@@ -7074,6 +7212,9 @@ static void rt2800_init_rfcsr(struct rt2
  22295. +@@ -7050,6 +7188,9 @@ static void rt2800_init_rfcsr(struct rt2
  22296. case RT3390:
  22297. rt2800_init_rfcsr_3390(rt2x00dev);
  22298. break;
  22299. 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
  22300. index 9390f7e..c9d1e06 100644
  22301. --- a/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  22302. +++ b/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  22303. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22304. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22305. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22306. -@@ -7611,6 +7611,8 @@ static int rt2800_init_eeprom(struct rt2
  22307. +@@ -7587,6 +7587,8 @@ static int rt2800_init_eeprom(struct rt2
  22308. rt2x00_rt(rt2x00dev, RT5390) ||
  22309. rt2x00_rt(rt2x00dev, RT5392))
  22310. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  22311. 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
  22312. index 1cba4f6..12b9c33 100644
  22313. --- a/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  22314. +++ b/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  22315. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22316. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22317. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22318. -@@ -3429,6 +3429,36 @@ static char rt2800_txpower_to_dev(struct
  22319. +@@ -3405,6 +3405,36 @@ static char rt2800_txpower_to_dev(struct
  22320. return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
  22321. }
  22322. @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22323. static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
  22324. struct ieee80211_conf *conf,
  22325. struct rf_channel *rf,
  22326. -@@ -3447,6 +3477,12 @@ static void rt2800_config_channel(struct
  22327. +@@ -3423,6 +3453,12 @@ static void rt2800_config_channel(struct
  22328. rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  22329. info->default_power3);
  22330. @@ -60,7 +60,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22331. switch (rt2x00dev->chip.rf) {
  22332. case RF2020:
  22333. case RF3020:
  22334. -@@ -3530,6 +3566,15 @@ static void rt2800_config_channel(struct
  22335. +@@ -3506,6 +3542,15 @@ static void rt2800_config_channel(struct
  22336. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  22337. rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
  22338. rt2800_bbp_write(rt2x00dev, 77, 0x98);
  22339. @@ -76,7 +76,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22340. } else {
  22341. rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
  22342. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  22343. -@@ -3542,6 +3587,7 @@ static void rt2800_config_channel(struct
  22344. +@@ -3518,6 +3563,7 @@ static void rt2800_config_channel(struct
  22345. !rt2x00_rt(rt2x00dev, RT5392)) {
  22346. if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
  22347. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  22348. @@ -84,7 +84,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22349. rt2800_bbp_write(rt2x00dev, 75, 0x46);
  22350. } else {
  22351. if (rt2x00_rt(rt2x00dev, RT3593))
  22352. -@@ -3550,19 +3596,22 @@ static void rt2800_config_channel(struct
  22353. +@@ -3526,19 +3572,22 @@ static void rt2800_config_channel(struct
  22354. rt2800_bbp_write(rt2x00dev, 82, 0x84);
  22355. rt2800_bbp_write(rt2x00dev, 75, 0x50);
  22356. }
  22357. @@ -110,7 +110,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22358. rt2800_bbp_write(rt2x00dev, 83, 0x9a);
  22359. if (rt2x00_has_cap_external_lna_a(rt2x00dev))
  22360. -@@ -3684,6 +3733,23 @@ static void rt2800_config_channel(struct
  22361. +@@ -3660,6 +3709,23 @@ static void rt2800_config_channel(struct
  22362. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
  22363. 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
  22364. index 1773128..3f40b4e 100644
  22365. --- a/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  22366. +++ b/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  22367. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22368. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22369. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22370. -@@ -3416,13 +3416,15 @@ static char rt2800_txpower_to_dev(struct
  22371. +@@ -3392,13 +3392,15 @@ static char rt2800_txpower_to_dev(struct
  22372. unsigned int channel,
  22373. char txpower)
  22374. {
  22375. 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
  22376. index 36f0a4c..52baeec 100644
  22377. --- a/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  22378. +++ b/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  22379. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22380. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22381. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22382. -@@ -4635,7 +4635,8 @@ static void rt2800_config_txpower(struct
  22383. +@@ -4611,7 +4611,8 @@ static void rt2800_config_txpower(struct
  22384. struct ieee80211_channel *chan,
  22385. int power_level)
  22386. {
  22387. 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
  22388. index 8119f97..b9dafc6 100644
  22389. --- a/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  22390. +++ b/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  22391. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22392. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22393. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22394. -@@ -7493,7 +7493,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  22395. +@@ -7469,7 +7469,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  22396. {
  22397. u16 word;
  22398. @@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22399. return 0;
  22400. rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word);
  22401. -@@ -7507,7 +7508,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  22402. +@@ -7483,7 +7484,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  22403. {
  22404. u16 word;
  22405. 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
  22406. index dfbdee7..f09f803 100644
  22407. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  22408. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  22409. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22410. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22411. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22412. -@@ -8428,7 +8428,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22413. +@@ -8402,7 +8402,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22414. if (rt2x00_rt(rt2x00dev, RT3593))
  22415. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  22416. 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
  22417. index 22f7110..f7d23fc 100644
  22418. --- a/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  22419. +++ b/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  22420. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22421. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22422. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22423. -@@ -1961,7 +1961,8 @@ void rt2800_config_ant(struct rt2x00_dev
  22424. +@@ -1937,7 +1937,8 @@ void rt2800_config_ant(struct rt2x00_dev
  22425. rt2800_bbp_write(rt2x00dev, 3, r3);
  22426. rt2800_bbp_write(rt2x00dev, 1, r1);
  22427. 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
  22428. index 9945f38..4da750e 100644
  22429. --- a/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  22430. +++ b/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  22431. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22432. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22433. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22434. -@@ -1984,7 +1984,8 @@ static void rt2800_config_lna_gain(struc
  22435. +@@ -1960,7 +1960,8 @@ static void rt2800_config_lna_gain(struc
  22436. rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
  22437. lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0);
  22438. } else if (libconf->rf.channel <= 128) {
  22439. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22440. rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &eeprom);
  22441. lna_gain = rt2x00_get_field16(eeprom,
  22442. EEPROM_EXT_LNA2_A1);
  22443. -@@ -1994,7 +1995,8 @@ static void rt2800_config_lna_gain(struc
  22444. +@@ -1970,7 +1971,8 @@ static void rt2800_config_lna_gain(struc
  22445. EEPROM_RSSI_BG2_LNA_A1);
  22446. }
  22447. } else {
  22448. 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
  22449. index beadea8..628b237 100644
  22450. --- a/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  22451. +++ b/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  22452. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22453. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22454. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22455. -@@ -4835,7 +4835,8 @@ static u8 rt2800_get_default_vgc(struct
  22456. +@@ -4811,7 +4811,8 @@ static u8 rt2800_get_default_vgc(struct
  22457. else
  22458. vgc = 0x2e + rt2x00dev->lna_gain;
  22459. } else { /* 5GHZ band */
  22460. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22461. vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3;
  22462. else if (rt2x00_rt(rt2x00dev, RT5592))
  22463. vgc = 0x24 + (2 * rt2x00dev->lna_gain);
  22464. -@@ -4855,7 +4856,8 @@ static inline void rt2800_set_vgc(struct
  22465. +@@ -4831,7 +4832,8 @@ static inline void rt2800_set_vgc(struct
  22466. {
  22467. if (qual->vgc_level != vgc_level) {
  22468. if (rt2x00_rt(rt2x00dev, RT3572) ||
  22469. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22470. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66,
  22471. vgc_level);
  22472. } else if (rt2x00_rt(rt2x00dev, RT5592)) {
  22473. -@@ -4902,6 +4904,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  22474. +@@ -4878,6 +4880,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  22475. }
  22476. break;
  22477. 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
  22478. index a6c0f58..216b8b6 100644
  22479. --- a/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  22480. +++ b/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  22481. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22482. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22483. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22484. -@@ -7630,7 +7630,8 @@ static int rt2800_validate_eeprom(struct
  22485. +@@ -7606,7 +7606,8 @@ static int rt2800_validate_eeprom(struct
  22486. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
  22487. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
  22488. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
  22489. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22490. if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
  22491. rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
  22492. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
  22493. -@@ -7650,7 +7651,8 @@ static int rt2800_validate_eeprom(struct
  22494. +@@ -7626,7 +7627,8 @@ static int rt2800_validate_eeprom(struct
  22495. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
  22496. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
  22497. rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
  22498. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22499. if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
  22500. rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
  22501. rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
  22502. -@@ -7658,7 +7660,8 @@ static int rt2800_validate_eeprom(struct
  22503. +@@ -7634,7 +7636,8 @@ static int rt2800_validate_eeprom(struct
  22504. }
  22505. rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
  22506. 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
  22507. index 910f9ec..515086f 100644
  22508. --- a/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  22509. +++ b/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  22510. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22511. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22512. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22513. -@@ -4005,6 +4005,9 @@ static u8 rt2800_compensate_txpower(stru
  22514. +@@ -3981,6 +3981,9 @@ static u8 rt2800_compensate_txpower(stru
  22515. if (rt2x00_rt(rt2x00dev, RT3593))
  22516. return min_t(u8, txpower, 0xc);
  22517. 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
  22518. index bcdfc67..77e3f1b 100644
  22519. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  22520. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  22521. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  22522. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22523. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22524. -@@ -8441,7 +8441,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22525. +@@ -8415,7 +8415,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22526. if (retval)
  22527. return retval;
  22528. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  22529. index 8f650a2..44b629f 100644
  22530. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  22531. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  22532. @@ -1,13 +1,13 @@
  22533. --- a/.local-symbols
  22534. +++ b/.local-symbols
  22535. -@@ -263,6 +263,7 @@ RT2X00_LIB_FIRMWARE=
  22536. +@@ -312,6 +312,7 @@ RT2X00_LIB_FIRMWARE=
  22537. RT2X00_LIB_CRYPTO=
  22538. RT2X00_LIB_LEDS=
  22539. RT2X00_LIB_DEBUGFS=
  22540. +RT2X00_LIB_EEPROM=
  22541. RT2X00_DEBUG=
  22542. - RTL_CARDS=
  22543. - RTL8192CE=
  22544. + WL_MEDIATEK=
  22545. + MT7601U=
  22546. --- a/drivers/net/wireless/rt2x00/Kconfig
  22547. +++ b/drivers/net/wireless/rt2x00/Kconfig
  22548. @@ -69,6 +69,7 @@ config RT2800PCI
  22549. @@ -48,7 +48,7 @@
  22550. obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o
  22551. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  22552. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  22553. -@@ -43,6 +43,8 @@ struct rt2800_drv_data {
  22554. +@@ -46,6 +46,8 @@ struct rt2800_drv_data {
  22555. } shmem_lock;
  22556. };
  22557. @@ -57,7 +57,7 @@
  22558. struct rt2800_ops {
  22559. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  22560. const unsigned int offset, u32 *value);
  22561. -@@ -176,6 +178,15 @@ static inline int rt2800_read_eeprom(str
  22562. +@@ -179,6 +181,15 @@ static inline int rt2800_read_eeprom(str
  22563. {
  22564. const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
  22565. 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
  22566. index a35bd55..16a579d 100644
  22567. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  22568. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  22569. @@ -41,7 +41,7 @@
  22570. * Interrupt context handlers.
  22571. --- a/drivers/net/wireless/rt2x00/rt61pci.c
  22572. +++ b/drivers/net/wireless/rt2x00/rt61pci.c
  22573. -@@ -2392,6 +2392,7 @@ static int rt61pci_validate_eeprom(struc
  22574. +@@ -2390,6 +2390,7 @@ static int rt61pci_validate_eeprom(struc
  22575. u32 reg;
  22576. u16 word;
  22577. u8 *mac;
  22578. @@ -49,7 +49,7 @@
  22579. s8 value;
  22580. rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, &reg);
  22581. -@@ -2412,7 +2413,11 @@ static int rt61pci_validate_eeprom(struc
  22582. +@@ -2410,7 +2411,11 @@ static int rt61pci_validate_eeprom(struc
  22583. /*
  22584. * Start validation of the data that has been read.
  22585. */
  22586. 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
  22587. index 067d2ea..39b1ccc 100644
  22588. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  22589. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  22590. @@ -1,6 +1,6 @@
  22591. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22592. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22593. -@@ -3552,11 +3552,18 @@ static void rt2800_config_channel(struct
  22594. +@@ -3528,11 +3528,18 @@ static void rt2800_config_channel(struct
  22595. /*
  22596. * Change BBP settings
  22597. */
  22598. @@ -19,7 +19,7 @@
  22599. } else if (rt2x00_rt(rt2x00dev, RT3593)) {
  22600. if (rf->channel > 14) {
  22601. /* Disable CCK Packet detection on 5GHz */
  22602. -@@ -6618,6 +6625,12 @@ static void rt2800_init_rfcsr_3290(struc
  22603. +@@ -6594,6 +6601,12 @@ static void rt2800_init_rfcsr_3290(struc
  22604. static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
  22605. {
  22606. @@ -32,7 +32,7 @@
  22607. rt2800_rf_init_calibration(rt2x00dev, 30);
  22608. rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
  22609. -@@ -6653,15 +6666,30 @@ static void rt2800_init_rfcsr_3352(struc
  22610. +@@ -6629,15 +6642,30 @@ static void rt2800_init_rfcsr_3352(struc
  22611. rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
  22612. rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
  22613. rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
  22614. @@ -66,7 +66,7 @@
  22615. rt2800_rfcsr_write(rt2x00dev, 43, 0xdb);
  22616. rt2800_rfcsr_write(rt2x00dev, 44, 0xdb);
  22617. rt2800_rfcsr_write(rt2x00dev, 45, 0xdb);
  22618. -@@ -6669,15 +6697,20 @@ static void rt2800_init_rfcsr_3352(struc
  22619. +@@ -6645,15 +6673,20 @@ static void rt2800_init_rfcsr_3352(struc
  22620. rt2800_rfcsr_write(rt2x00dev, 47, 0x0d);
  22621. rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
  22622. rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
  22623. @@ -96,7 +96,7 @@
  22624. rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
  22625. rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
  22626. rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
  22627. -@@ -7698,6 +7731,7 @@ static int rt2800_init_eeprom(struct rt2
  22628. +@@ -7674,6 +7707,7 @@ static int rt2800_init_eeprom(struct rt2
  22629. * RT53xx: defined in "EEPROM_CHIP_ID" field
  22630. */
  22631. if (rt2x00_rt(rt2x00dev, RT3290) ||
  22632. @@ -104,7 +104,7 @@
  22633. rt2x00_rt(rt2x00dev, RT5390) ||
  22634. rt2x00_rt(rt2x00dev, RT5392))
  22635. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  22636. -@@ -7793,7 +7827,8 @@ static int rt2800_init_eeprom(struct rt2
  22637. +@@ -7769,7 +7803,8 @@ static int rt2800_init_eeprom(struct rt2
  22638. /*
  22639. * Detect if this device has Bluetooth co-existence.
  22640. */
  22641. @@ -114,7 +114,7 @@
  22642. __set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags);
  22643. /*
  22644. -@@ -7822,6 +7857,22 @@ static int rt2800_init_eeprom(struct rt2
  22645. +@@ -7798,6 +7833,22 @@ static int rt2800_init_eeprom(struct rt2
  22646. EIRP_MAX_TX_POWER_LIMIT)
  22647. __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
  22648. 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
  22649. index 1dcca36..dcecba4 100644
  22650. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  22651. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  22652. @@ -1,6 +1,6 @@
  22653. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22654. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22655. -@@ -8209,6 +8209,27 @@ static const struct rf_channel rf_vals_5
  22656. +@@ -8185,6 +8185,27 @@ static const struct rf_channel rf_vals_5
  22657. {196, 83, 0, 12, 1},
  22658. };
  22659. @@ -28,7 +28,7 @@
  22660. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  22661. {
  22662. struct hw_mode_spec *spec = &rt2x00dev->spec;
  22663. -@@ -8297,7 +8318,10 @@ static int rt2800_probe_hw_mode(struct r
  22664. +@@ -8271,7 +8292,10 @@ static int rt2800_probe_hw_mode(struct r
  22665. case RF5390:
  22666. case RF5392:
  22667. spec->num_channels = 14;
  22668. @@ -40,7 +40,7 @@
  22669. break;
  22670. case RF3052:
  22671. -@@ -8481,6 +8505,19 @@ static int rt2800_probe_rt(struct rt2x00
  22672. +@@ -8455,6 +8479,19 @@ static int rt2800_probe_rt(struct rt2x00
  22673. return 0;
  22674. }
  22675. @@ -60,7 +60,7 @@
  22676. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  22677. {
  22678. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  22679. -@@ -8523,6 +8560,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22680. +@@ -8497,6 +8534,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  22681. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  22682. /*
  22683. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  22684. index c779a17..9f11862 100644
  22685. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  22686. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  22687. @@ -8,7 +8,7 @@
  22688. #include "rt2x00.h"
  22689. #include "rt2800lib.h"
  22690. -@@ -8507,13 +8508,14 @@ static int rt2800_probe_rt(struct rt2x00
  22691. +@@ -8481,13 +8482,14 @@ static int rt2800_probe_rt(struct rt2x00
  22692. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  22693. {
  22694. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  22695. index 840b3bc..9679d71 100644
  22696. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  22697. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  22698. @@ -10,7 +10,7 @@
  22699. #define RF5370 0x5370
  22700. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22701. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22702. -@@ -3038,6 +3038,13 @@ static void rt2800_config_channel_rf53xx
  22703. +@@ -3014,6 +3014,13 @@ static void rt2800_config_channel_rf53xx
  22704. rt2800_rfcsr_write(rt2x00dev, 59,
  22705. r59_non_bt[idx]);
  22706. @@ -24,7 +24,7 @@
  22707. }
  22708. }
  22709. }
  22710. -@@ -3516,6 +3523,7 @@ static void rt2800_config_channel(struct
  22711. +@@ -3492,6 +3499,7 @@ static void rt2800_config_channel(struct
  22712. rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info);
  22713. break;
  22714. case RF3070:
  22715. @@ -32,7 +32,7 @@
  22716. case RF5360:
  22717. case RF5362:
  22718. case RF5370:
  22719. -@@ -3534,6 +3542,7 @@ static void rt2800_config_channel(struct
  22720. +@@ -3510,6 +3518,7 @@ static void rt2800_config_channel(struct
  22721. if (rt2x00_rf(rt2x00dev, RF3070) ||
  22722. rt2x00_rf(rt2x00dev, RF3290) ||
  22723. rt2x00_rf(rt2x00dev, RF3322) ||
  22724. @@ -40,7 +40,7 @@
  22725. rt2x00_rf(rt2x00dev, RF5360) ||
  22726. rt2x00_rf(rt2x00dev, RF5362) ||
  22727. rt2x00_rf(rt2x00dev, RF5370) ||
  22728. -@@ -3812,7 +3821,8 @@ static void rt2800_config_channel(struct
  22729. +@@ -3788,7 +3797,8 @@ static void rt2800_config_channel(struct
  22730. /*
  22731. * Clear update flag
  22732. */
  22733. @@ -50,7 +50,7 @@
  22734. rt2800_bbp_read(rt2x00dev, 49, &bbp);
  22735. rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
  22736. rt2800_bbp_write(rt2x00dev, 49, bbp);
  22737. -@@ -4698,6 +4708,7 @@ void rt2800_vco_calibration(struct rt2x0
  22738. +@@ -4674,6 +4684,7 @@ void rt2800_vco_calibration(struct rt2x0
  22739. case RF3070:
  22740. case RF3290:
  22741. case RF3853:
  22742. @@ -58,7 +58,7 @@
  22743. case RF5360:
  22744. case RF5362:
  22745. case RF5370:
  22746. -@@ -5111,6 +5122,8 @@ static int rt2800_init_registers(struct
  22747. +@@ -5087,6 +5098,8 @@ static int rt2800_init_registers(struct
  22748. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  22749. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  22750. rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
  22751. @@ -67,7 +67,7 @@
  22752. } else {
  22753. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
  22754. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  22755. -@@ -5766,9 +5779,13 @@ static void rt2800_init_bbp_3352(struct
  22756. +@@ -5742,9 +5755,13 @@ static void rt2800_init_bbp_3352(struct
  22757. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  22758. @@ -84,7 +84,7 @@
  22759. rt2800_bbp_write(rt2x00dev, 86, 0x38);
  22760. -@@ -5782,9 +5799,13 @@ static void rt2800_init_bbp_3352(struct
  22761. +@@ -5758,9 +5775,13 @@ static void rt2800_init_bbp_3352(struct
  22762. rt2800_bbp_write(rt2x00dev, 104, 0x92);
  22763. @@ -101,7 +101,7 @@
  22764. rt2800_bbp_write(rt2x00dev, 120, 0x50);
  22765. -@@ -5809,6 +5830,13 @@ static void rt2800_init_bbp_3352(struct
  22766. +@@ -5785,6 +5806,13 @@ static void rt2800_init_bbp_3352(struct
  22767. rt2800_bbp_write(rt2x00dev, 143, 0xa2);
  22768. rt2800_bbp_write(rt2x00dev, 148, 0xc8);
  22769. @@ -115,7 +115,7 @@
  22770. }
  22771. static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
  22772. -@@ -6150,6 +6178,7 @@ static void rt2800_init_bbp(struct rt2x0
  22773. +@@ -6126,6 +6154,7 @@ static void rt2800_init_bbp(struct rt2x0
  22774. rt2800_init_bbp_3290(rt2x00dev);
  22775. break;
  22776. case RT3352:
  22777. @@ -123,7 +123,7 @@
  22778. rt2800_init_bbp_3352(rt2x00dev);
  22779. break;
  22780. case RT3390:
  22781. -@@ -7101,6 +7130,76 @@ static void rt2800_init_rfcsr_3883(struc
  22782. +@@ -7077,6 +7106,76 @@ static void rt2800_init_rfcsr_3883(struc
  22783. rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
  22784. }
  22785. @@ -200,7 +200,7 @@
  22786. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  22787. {
  22788. rt2800_rf_init_calibration(rt2x00dev, 2);
  22789. -@@ -7341,6 +7440,9 @@ static void rt2800_init_rfcsr(struct rt2
  22790. +@@ -7317,6 +7416,9 @@ static void rt2800_init_rfcsr(struct rt2
  22791. case RT3593:
  22792. rt2800_init_rfcsr_3593(rt2x00dev);
  22793. break;
  22794. @@ -210,7 +210,7 @@
  22795. case RT5390:
  22796. rt2800_init_rfcsr_5390(rt2x00dev);
  22797. break;
  22798. -@@ -7600,6 +7702,12 @@ static int rt2800_validate_eeprom(struct
  22799. +@@ -7576,6 +7678,12 @@ static int rt2800_validate_eeprom(struct
  22800. rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
  22801. rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
  22802. rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
  22803. @@ -223,7 +223,7 @@
  22804. } else if (rt2x00_rt(rt2x00dev, RT2860) ||
  22805. rt2x00_rt(rt2x00dev, RT2872)) {
  22806. /*
  22807. -@@ -7738,6 +7846,8 @@ static int rt2800_init_eeprom(struct rt2
  22808. +@@ -7714,6 +7822,8 @@ static int rt2800_init_eeprom(struct rt2
  22809. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  22810. else if (rt2x00_rt(rt2x00dev, RT3883))
  22811. rf = RF3853;
  22812. @@ -232,7 +232,7 @@
  22813. else
  22814. rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
  22815. -@@ -7757,6 +7867,7 @@ static int rt2800_init_eeprom(struct rt2
  22816. +@@ -7733,6 +7843,7 @@ static int rt2800_init_eeprom(struct rt2
  22817. case RF3320:
  22818. case RF3322:
  22819. case RF3853:
  22820. @@ -240,7 +240,7 @@
  22821. case RF5360:
  22822. case RF5362:
  22823. case RF5370:
  22824. -@@ -8312,6 +8423,7 @@ static int rt2800_probe_hw_mode(struct r
  22825. +@@ -8286,6 +8397,7 @@ static int rt2800_probe_hw_mode(struct r
  22826. case RF3290:
  22827. case RF3320:
  22828. case RF3322:
  22829. @@ -248,7 +248,7 @@
  22830. case RF5360:
  22831. case RF5362:
  22832. case RF5370:
  22833. -@@ -8451,6 +8563,7 @@ static int rt2800_probe_hw_mode(struct r
  22834. +@@ -8425,6 +8537,7 @@ static int rt2800_probe_hw_mode(struct r
  22835. case RF3070:
  22836. case RF3290:
  22837. case RF3853:
  22838. @@ -256,7 +256,7 @@
  22839. case RF5360:
  22840. case RF5362:
  22841. case RF5370:
  22842. -@@ -8491,6 +8604,7 @@ static int rt2800_probe_rt(struct rt2x00
  22843. +@@ -8465,6 +8578,7 @@ static int rt2800_probe_rt(struct rt2x00
  22844. case RT3572:
  22845. case RT3593:
  22846. case RT3883:
  22847. 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
  22848. index 13f2048..b085c5e 100644
  22849. --- a/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  22850. +++ b/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  22851. @@ -8,7 +8,7 @@
  22852. #include "rt2x00.h"
  22853. #include "rt2800lib.h"
  22854. -@@ -7957,6 +7958,17 @@ static int rt2800_init_eeprom(struct rt2
  22855. +@@ -7933,6 +7934,17 @@ static int rt2800_init_eeprom(struct rt2
  22856. rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
  22857. rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
  22858. diff --git a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  22859. index aaa8367..259cb1f 100644
  22860. --- a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  22861. +++ b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  22862. @@ -1,6 +1,6 @@
  22863. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22864. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22865. -@@ -7841,10 +7841,11 @@ static int rt2800_init_eeprom(struct rt2
  22866. +@@ -7817,10 +7817,11 @@ static int rt2800_init_eeprom(struct rt2
  22867. * RT53xx: defined in "EEPROM_CHIP_ID" field
  22868. */
  22869. if (rt2x00_rt(rt2x00dev, RT3290) ||
  22870. diff --git a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  22871. index bb2fc1c..77d63fe 100644
  22872. --- a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  22873. +++ b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  22874. @@ -11,7 +11,7 @@
  22875. * RFCSR 31:
  22876. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  22877. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  22878. -@@ -3551,8 +3551,13 @@ static void rt2800_config_channel(struct
  22879. +@@ -3527,8 +3527,13 @@ static void rt2800_config_channel(struct
  22880. rt2x00_rf(rt2x00dev, RF5390) ||
  22881. rt2x00_rf(rt2x00dev, RF5392)) {
  22882. rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
  22883. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  22884. index 9e29034..3b8b756 100644
  22885. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  22886. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  22887. @@ -1,6 +1,6 @@
  22888. --- a/drivers/net/wireless/libertas/cfg.c
  22889. +++ b/drivers/net/wireless/libertas/cfg.c
  22890. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  22891. +@@ -2083,6 +2083,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  22892. goto err_wiphy_new;
  22893. }
  22894. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  22895. index 252fa81..dace56b 100644
  22896. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  22897. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  22898. @@ -1,6 +1,6 @@
  22899. --- a/drivers/net/wireless/libertas/cfg.c
  22900. +++ b/drivers/net/wireless/libertas/cfg.c
  22901. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  22902. +@@ -2173,6 +2173,8 @@ int lbs_cfg_register(struct lbs_private
  22903. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  22904. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  22905. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  22906. index ac58dba..dd82ce5 100644
  22907. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  22908. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  22909. @@ -9,7 +9,7 @@
  22910. antenna = b43_antenna_to_phyctl(antenna);
  22911. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  22912. /* We can't send beacons with short preamble. Would get PHY errors. */
  22913. -@@ -3302,8 +3302,8 @@ static int b43_chip_init(struct b43_wlde
  22914. +@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  22915. /* Select the antennae */
  22916. if (phy->ops->set_rx_antenna)
  22917. @@ -20,7 +20,7 @@
  22918. if (phy->type == B43_PHYTYPE_B) {
  22919. value16 = b43_read16(dev, 0x005E);
  22920. -@@ -4003,7 +4003,6 @@ static int b43_op_config(struct ieee8021
  22921. +@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  22922. struct b43_wldev *dev = wl->current_dev;
  22923. struct b43_phy *phy = &dev->phy;
  22924. struct ieee80211_conf *conf = &hw->conf;
  22925. @@ -28,7 +28,7 @@
  22926. int err = 0;
  22927. mutex_lock(&wl->mutex);
  22928. -@@ -4046,11 +4045,9 @@ static int b43_op_config(struct ieee8021
  22929. +@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  22930. }
  22931. /* Antennas for RX and management frame TX. */
  22932. @@ -42,7 +42,7 @@
  22933. if (wl->radio_enabled != phy->radio_on) {
  22934. if (wl->radio_enabled) {
  22935. -@@ -5213,6 +5210,47 @@ static int b43_op_get_survey(struct ieee
  22936. +@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  22937. return 0;
  22938. }
  22939. @@ -90,7 +90,7 @@
  22940. static const struct ieee80211_ops b43_hw_ops = {
  22941. .tx = b43_op_tx,
  22942. .conf_tx = b43_op_conf_tx,
  22943. -@@ -5234,6 +5272,8 @@ static const struct ieee80211_ops b43_hw
  22944. +@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  22945. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  22946. .get_survey = b43_op_get_survey,
  22947. .rfkill_poll = b43_rfkill_poll,
  22948. @@ -99,7 +99,7 @@
  22949. };
  22950. /* Hard-reset the chip. Do not call this directly.
  22951. -@@ -5542,6 +5582,8 @@ static int b43_one_core_attach(struct b4
  22952. +@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  22953. if (!wldev)
  22954. goto out;
  22955. @@ -108,7 +108,7 @@
  22956. wldev->use_pio = b43_modparam_pio;
  22957. wldev->dev = dev;
  22958. wldev->wl = wl;
  22959. -@@ -5632,6 +5674,9 @@ static struct b43_wl *b43_wireless_init(
  22960. +@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  22961. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  22962. 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
  22963. index 1cba2b3..5fdfa37 100644
  22964. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  22965. +++ b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  22966. @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  22967. --- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22968. +++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22969. -@@ -691,9 +691,37 @@ static struct wireless_dev *brcmf_cfg802
  22970. +@@ -692,9 +692,37 @@ static struct wireless_dev *brcmf_cfg802
  22971. u32 *flags,
  22972. struct vif_params *params)
  22973. {
  22974. 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
  22975. deleted file mode 100644
  22976. index 856dea8..0000000
  22977. --- a/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch
  22978. +++ /dev/null
  22979. @@ -1,139 +0,0 @@
  22980. -When running with DT, we no longer have a board file that can set up the
  22981. -platform data for wlcore. Allow this data to be passed from DT.
  22982. -
  22983. -Since some platforms use a gpio-irq, add support for passing either the
  22984. -irq number or the gpio number. For the latter case, the driver will
  22985. -request the gpio and convert it to the irq number. If an irq is
  22986. -specified, it'll be used as is.
  22987. -
  22988. -[Arik - the pdev_data pointer does not belong to us and is freed when
  22989. -the device is released. Dereference to our private data first.]
  22990. -
  22991. -Signed-off-by: Ido Yariv <ido@wizery.com>
  22992. -Signed-off-by: Arik Nemtsov <arik@wizery.com>
  22993. ----
  22994. - drivers/net/wireless/ti/wlcore/sdio.c | 71 ++++++++++++++++++++++++++++++++---
  22995. - include/linux/wl12xx.h | 3 +-
  22996. - 2 files changed, 67 insertions(+), 7 deletions(-)
  22997. -
  22998. ---- a/drivers/net/wireless/ti/wlcore/sdio.c
  22999. -+++ b/drivers/net/wireless/ti/wlcore/sdio.c
  23000. -@@ -34,6 +34,7 @@
  23001. - #include <linux/wl12xx.h>
  23002. - #include <linux/pm_runtime.h>
  23003. - #include <linux/printk.h>
  23004. -+#include <linux/of.h>
  23005. -
  23006. - #include "wlcore.h"
  23007. - #include "wl12xx_80211.h"
  23008. -@@ -214,6 +215,61 @@ static struct wl1271_if_operations sdio_
  23009. - .set_block_size = wl1271_sdio_set_block_size,
  23010. - };
  23011. -
  23012. -+static const struct of_device_id wlcore_of_match[] = {
  23013. -+ {
  23014. -+ .compatible = "wlcore",
  23015. -+ },
  23016. -+ {}
  23017. -+};
  23018. -+MODULE_DEVICE_TABLE(of, wlcore_of_match);
  23019. -+
  23020. -+static struct wl12xx_platform_data *get_platform_data(struct device *dev)
  23021. -+{
  23022. -+ struct wl12xx_platform_data *pdata;
  23023. -+ struct device_node *np;
  23024. -+ u32 gpio;
  23025. -+
  23026. -+ pdata = wl12xx_get_platform_data();
  23027. -+ if (!IS_ERR(pdata))
  23028. -+ return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL);
  23029. -+
  23030. -+ np = of_find_matching_node(NULL, wlcore_of_match);
  23031. -+ if (!np) {
  23032. -+ dev_err(dev, "No platform data set\n");
  23033. -+ return NULL;
  23034. -+ }
  23035. -+
  23036. -+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
  23037. -+ if (!pdata) {
  23038. -+ dev_err(dev, "Can't allocate platform data\n");
  23039. -+ return NULL;
  23040. -+ }
  23041. -+
  23042. -+ if (of_property_read_u32(np, "irq", &pdata->irq)) {
  23043. -+ if (!of_property_read_u32(np, "gpio", &gpio) &&
  23044. -+ !gpio_request_one(gpio, GPIOF_IN, "wlcore_irq")) {
  23045. -+ pdata->gpio = gpio;
  23046. -+ pdata->irq = gpio_to_irq(gpio);
  23047. -+ }
  23048. -+ }
  23049. -+
  23050. -+ /* Optional fields */
  23051. -+ pdata->use_eeprom = of_property_read_bool(np, "use-eeprom");
  23052. -+ of_property_read_u32(np, "board-ref-clock", &pdata->board_ref_clock);
  23053. -+ of_property_read_u32(np, "board-tcxo-clock", &pdata->board_tcxo_clock);
  23054. -+ of_property_read_u32(np, "platform-quirks", &pdata->platform_quirks);
  23055. -+
  23056. -+ return pdata;
  23057. -+}
  23058. -+
  23059. -+static void del_platform_data(struct wl12xx_platform_data *pdata)
  23060. -+{
  23061. -+ if (pdata->gpio)
  23062. -+ gpio_free(pdata->gpio);
  23063. -+
  23064. -+ kfree(pdata);
  23065. -+}
  23066. -+
  23067. - static int wl1271_probe(struct sdio_func *func,
  23068. - const struct sdio_device_id *id)
  23069. - {
  23070. -@@ -245,10 +301,10 @@ static int wl1271_probe(struct sdio_func
  23071. - /* Use block mode for transferring over one block size of data */
  23072. - func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
  23073. -
  23074. -- pdev_data.pdata = wl12xx_get_platform_data();
  23075. -- if (IS_ERR(pdev_data.pdata)) {
  23076. -- ret = PTR_ERR(pdev_data.pdata);
  23077. -- dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
  23078. -+ pdev_data.pdata = get_platform_data(&func->dev);
  23079. -+ if (!pdev_data.pdata) {
  23080. -+ ret = -EINVAL;
  23081. -+ dev_err(glue->dev, "missing wlan platform data\n");
  23082. - goto out_free_glue;
  23083. - }
  23084. -
  23085. -@@ -279,7 +335,7 @@ static int wl1271_probe(struct sdio_func
  23086. - if (!glue->core) {
  23087. - dev_err(glue->dev, "can't allocate platform_device");
  23088. - ret = -ENOMEM;
  23089. -- goto out_free_glue;
  23090. -+ goto out_free_pdata;
  23091. - }
  23092. -
  23093. - glue->core->dev.parent = &func->dev;
  23094. -@@ -313,6 +369,9 @@ static int wl1271_probe(struct sdio_func
  23095. - out_dev_put:
  23096. - platform_device_put(glue->core);
  23097. -
  23098. -+out_free_pdata:
  23099. -+ del_platform_data(pdev_data->pdata);
  23100. -+
  23101. - out_free_glue:
  23102. - kfree(glue);
  23103. -
  23104. -@@ -323,11 +382,14 @@ out:
  23105. - static void wl1271_remove(struct sdio_func *func)
  23106. - {
  23107. - struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);
  23108. -+ struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
  23109. -+ struct wl12xx_platform_data *pdata = pdev_data->pdata;
  23110. -
  23111. - /* Undo decrement done above in wl1271_probe */
  23112. - pm_runtime_get_noresume(&func->dev);
  23113. -
  23114. - platform_device_unregister(glue->core);
  23115. -+ del_platform_data(pdata);
  23116. - kfree(glue);
  23117. - }
  23118. -
  23119. 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
  23120. index 501910f..b0536ce 100644
  23121. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  23122. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  23123. @@ -210,7 +210,7 @@
  23124. case RT5592:
  23125. *txwi_size = TXWI_DESC_SIZE_5WORDS;
  23126. *rxwi_size = RXWI_DESC_SIZE_6WORDS;
  23127. -@@ -3326,6 +3399,312 @@ static void rt2800_config_channel_rf55xx
  23128. +@@ -3302,6 +3375,312 @@ static void rt2800_config_channel_rf55xx
  23129. rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F);
  23130. }
  23131. @@ -258,6 +258,7 @@
  23132. + u32 mac_sys_ctrl, mac_status;
  23133. + u32 tx_pin = 0x00150F0F;
  23134. + struct hw_mode_spec *spec = &rt2x00dev->spec;
  23135. ++ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  23136. +
  23137. + /* Frequeny plan setting */
  23138. + /*
  23139. @@ -383,7 +384,6 @@
  23140. + rfcsr &= (~0x4);
  23141. + rt2800_rfcsr_write(rt2x00dev, 28, rfcsr);
  23142. +
  23143. -+ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  23144. + /*if (bScan == FALSE)*/
  23145. + if (conf_is_ht40(conf)) {
  23146. + txrx_agc_fc = rt2x00_get_field8(drv_data->calibration_bw40,
  23147. @@ -523,7 +523,7 @@
  23148. static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev,
  23149. const unsigned int word,
  23150. const u8 value)
  23151. -@@ -3482,7 +3861,7 @@ static void rt2800_config_channel(struct
  23152. +@@ -3458,7 +3837,7 @@ static void rt2800_config_channel(struct
  23153. struct channel_info *info)
  23154. {
  23155. u32 reg;
  23156. @@ -532,7 +532,7 @@
  23157. u8 bbp, rfcsr;
  23158. info->default_power1 = rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  23159. -@@ -3536,6 +3915,9 @@ static void rt2800_config_channel(struct
  23160. +@@ -3512,6 +3891,9 @@ static void rt2800_config_channel(struct
  23161. case RF5592:
  23162. rt2800_config_channel_rf55xx(rt2x00dev, conf, rf, info);
  23163. break;
  23164. @@ -542,7 +542,7 @@
  23165. default:
  23166. rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info);
  23167. }
  23168. -@@ -3638,7 +4020,7 @@ static void rt2800_config_channel(struct
  23169. +@@ -3614,7 +3996,7 @@ static void rt2800_config_channel(struct
  23170. else if (rt2x00_rt(rt2x00dev, RT3593) ||
  23171. rt2x00_rt(rt2x00dev, RT3883))
  23172. rt2800_bbp_write(rt2x00dev, 82, 0x82);
  23173. @@ -551,7 +551,7 @@
  23174. rt2800_bbp_write(rt2x00dev, 82, 0xf2);
  23175. if (rt2x00_rt(rt2x00dev, RT3593) ||
  23176. -@@ -3660,7 +4042,7 @@ static void rt2800_config_channel(struct
  23177. +@@ -3636,7 +4018,7 @@ static void rt2800_config_channel(struct
  23178. if (rt2x00_rt(rt2x00dev, RT3572))
  23179. rt2800_rfcsr_write(rt2x00dev, 8, 0);
  23180. @@ -560,7 +560,7 @@
  23181. switch (rt2x00dev->default_ant.tx_chain_num) {
  23182. case 3:
  23183. -@@ -3709,6 +4091,7 @@ static void rt2800_config_channel(struct
  23184. +@@ -3685,6 +4067,7 @@ static void rt2800_config_channel(struct
  23185. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
  23186. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
  23187. @@ -568,7 +568,7 @@
  23188. rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
  23189. -@@ -4725,6 +5108,14 @@ void rt2800_vco_calibration(struct rt2x0
  23190. +@@ -4701,6 +5084,14 @@ void rt2800_vco_calibration(struct rt2x0
  23191. rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
  23192. rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
  23193. break;
  23194. @@ -583,7 +583,7 @@
  23195. default:
  23196. return;
  23197. }
  23198. -@@ -5125,9 +5516,42 @@ static int rt2800_init_registers(struct
  23199. +@@ -5101,9 +5492,42 @@ static int rt2800_init_registers(struct
  23200. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  23201. rt2x00_rt(rt2x00dev, RT5392) ||
  23202. rt2x00_rt(rt2x00dev, RT5592)) {
  23203. @@ -629,7 +629,7 @@
  23204. } else if (rt2x00_rt(rt2x00dev, RT5350)) {
  23205. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  23206. } else {
  23207. -@@ -6159,6 +6583,225 @@ static void rt2800_init_bbp_5592(struct
  23208. +@@ -6135,6 +6559,225 @@ static void rt2800_init_bbp_5592(struct
  23209. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  23210. }
  23211. @@ -855,7 +855,7 @@
  23212. static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
  23213. {
  23214. unsigned int i;
  23215. -@@ -6201,7 +6844,10 @@ static void rt2800_init_bbp(struct rt2x0
  23216. +@@ -6177,7 +6820,10 @@ static void rt2800_init_bbp(struct rt2x0
  23217. return;
  23218. case RT5390:
  23219. case RT5392:
  23220. @@ -867,7 +867,7 @@
  23221. break;
  23222. case RT5592:
  23223. rt2800_init_bbp_5592(rt2x00dev);
  23224. -@@ -7415,6 +8061,295 @@ static void rt2800_init_rfcsr_5592(struc
  23225. +@@ -7391,6 +8037,296 @@ static void rt2800_init_rfcsr_5592(struc
  23226. rt2800_led_open_drain_enable(rt2x00dev);
  23227. }
  23228. @@ -875,6 +875,8 @@
  23229. +{
  23230. + u16 freq;
  23231. + u8 rfvalue;
  23232. ++ struct hw_mode_spec *spec = &rt2x00dev->spec;
  23233. ++
  23234. + /* Initialize RF central register to default value */
  23235. + rt2800_rfcsr_write(rt2x00dev, 0, 0x02);
  23236. + rt2800_rfcsr_write(rt2x00dev, 1, 0x03);
  23237. @@ -921,7 +923,6 @@
  23238. + rt2800_rfcsr_write(rt2x00dev, 42, 0x5B);
  23239. + rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
  23240. +
  23241. -+ struct hw_mode_spec *spec = &rt2x00dev->spec;
  23242. + rt2800_rfcsr_write(rt2x00dev, 11, 0x21);
  23243. + if (spec->clk_is_20mhz)
  23244. + rt2800_rfcsr_write(rt2x00dev, 13, 0x03);
  23245. @@ -1163,7 +1164,7 @@
  23246. static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
  23247. {
  23248. if (rt2800_is_305x_soc(rt2x00dev)) {
  23249. -@@ -7450,7 +8385,10 @@ static void rt2800_init_rfcsr(struct rt2
  23250. +@@ -7426,7 +8362,10 @@ static void rt2800_init_rfcsr(struct rt2
  23251. rt2800_init_rfcsr_5350(rt2x00dev);
  23252. break;
  23253. case RT5390:
  23254. @@ -1175,7 +1176,7 @@
  23255. break;
  23256. case RT5392:
  23257. rt2800_init_rfcsr_5392(rt2x00dev);
  23258. -@@ -7882,6 +8820,7 @@ static int rt2800_init_eeprom(struct rt2
  23259. +@@ -7858,6 +8797,7 @@ static int rt2800_init_eeprom(struct rt2
  23260. case RF5390:
  23261. case RF5392:
  23262. case RF5592:
  23263. @@ -1183,7 +1184,7 @@
  23264. break;
  23265. default:
  23266. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  23267. -@@ -8448,6 +9387,7 @@ static int rt2800_probe_hw_mode(struct r
  23268. +@@ -8422,6 +9362,7 @@ static int rt2800_probe_hw_mode(struct r
  23269. case RF5372:
  23270. case RF5390:
  23271. case RF5392:
  23272. @@ -1191,7 +1192,7 @@
  23273. spec->num_channels = 14;
  23274. if (spec->clk_is_20mhz)
  23275. spec->channels = rf_vals_xtal20mhz_3x;
  23276. -@@ -8588,6 +9528,7 @@ static int rt2800_probe_hw_mode(struct r
  23277. +@@ -8562,6 +9503,7 @@ static int rt2800_probe_hw_mode(struct r
  23278. case RF5372:
  23279. case RF5390:
  23280. case RF5392:
  23281. 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
  23282. deleted file mode 100644
  23283. index 4c04d4f..0000000
  23284. --- a/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch
  23285. +++ /dev/null
  23286. @@ -1,20 +0,0 @@
  23287. ---- a/drivers/net/wireless/ath/ath10k/core.c
  23288. -+++ b/drivers/net/wireless/ath/ath10k/core.c
  23289. -@@ -387,9 +387,14 @@ static int ath10k_download_and_run_otp(s
  23290. -
  23291. - ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
  23292. -
  23293. -- if (!skip_otp && result != 0) {
  23294. -- ath10k_err(ar, "otp calibration failed: %d", result);
  23295. -- return -EINVAL;
  23296. -+ if (!skip_otp) {
  23297. -+ if (result == 2) {
  23298. -+ ath10k_warn(ar, "otp stream is empty, using board.bin contents");
  23299. -+ return 0;
  23300. -+ } else if (result != 0) {
  23301. -+ ath10k_err(ar, "otp calibration failed: %d", result);
  23302. -+ return -EINVAL;
  23303. -+ }
  23304. - }
  23305. -
  23306. - return 0;
  23307. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  23308. index eed3814..93196e1 100644
  23309. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  23310. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  23311. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  23312. --- a/drivers/net/wireless/ath/ath10k/core.c
  23313. +++ b/drivers/net/wireless/ath/ath10k/core.c
  23314. -@@ -1323,6 +1323,16 @@ int ath10k_core_register(struct ath10k *
  23315. +@@ -1520,6 +1520,16 @@ int ath10k_core_register(struct ath10k *
  23316. ar->chip_id = chip_id;
  23317. queue_work(ar->workqueue, &ar->register_work);
  23318. 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
  23319. index 8003f86..34910a0 100644
  23320. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  23321. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  23322. @@ -1,6 +1,6 @@
  23323. --- a/drivers/net/wireless/ath/ath10k/mac.c
  23324. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  23325. -@@ -5416,6 +5416,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  23326. +@@ -6804,6 +6804,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  23327. return arvif_iter.arvif;
  23328. }
  23329. @@ -22,7 +22,7 @@
  23330. int ath10k_mac_register(struct ath10k *ar)
  23331. {
  23332. static const u32 cipher_suites[] = {
  23333. -@@ -5590,6 +5605,12 @@ int ath10k_mac_register(struct ath10k *a
  23334. +@@ -7025,6 +7040,12 @@ int ath10k_mac_register(struct ath10k *a
  23335. ar->hw->wiphy->cipher_suites = cipher_suites;
  23336. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  23337. diff --git a/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  23338. new file mode 100644
  23339. index 0000000..75d8212
  23340. --- /dev/null
  23341. +++ b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  23342. @@ -0,0 +1,20 @@
  23343. +--- a/drivers/net/wireless/mwl8k.c
  23344. ++++ b/drivers/net/wireless/mwl8k.c
  23345. +@@ -6261,6 +6261,8 @@ static int mwl8k_probe(struct pci_dev *p
  23346. +
  23347. + priv->running_bsses = 0;
  23348. +
  23349. ++ wait_for_completion(&priv->firmware_loading_complete);
  23350. ++
  23351. + return rc;
  23352. +
  23353. + err_stop_firmware:
  23354. +@@ -6294,8 +6296,6 @@ static void mwl8k_remove(struct pci_dev
  23355. + return;
  23356. + priv = hw->priv;
  23357. +
  23358. +- wait_for_completion(&priv->firmware_loading_complete);
  23359. +-
  23360. + if (priv->fw_state == FW_STATE_ERROR) {
  23361. + mwl8k_hw_reset(priv);
  23362. + goto unmap;
  23363. diff --git a/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch b/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch
  23364. deleted file mode 100644
  23365. index e94574d..0000000
  23366. --- a/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch
  23367. +++ /dev/null
  23368. @@ -1,12 +0,0 @@
  23369. ---- a/init.c
  23370. -+++ b/init.c
  23371. -@@ -16,6 +16,9 @@
  23372. - #include "eeprom.h"
  23373. - #include "mcu.h"
  23374. -
  23375. -+#define ieee80211_hw_set(hw, flag) \
  23376. -+ do { (hw)->flags |= IEEE80211_HW_##flag; } while(0)
  23377. -+
  23378. - static bool
  23379. - mt76_wait_for_mac(struct mt76_dev *dev)
  23380. - {